diff --git a/.eslintrc.js b/.eslintrc.js index 23389a3..ca44f30 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,65 +1,44 @@ module.exports = { - "env": { - "es2021": true, - "node": true - }, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:import/recommended", - "plugin:import/typescript", - "prettier", - "plugin:prettier/recommended", - ], - "overrides": [ - { - "env": { - "node": true - }, - "files": [ - ".eslintrc.{js,cjs}" - ], - "parserOptions": { - "sourceType": "script" - } - } - ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": "latest", - "sourceType": "module" - }, - "plugins": [ - "@typescript-eslint", - "prettier" - ], - "rules": { - "prettier/prettier": [ - "error", - { - singleQuote: true, - printWidth: 120 - } + env: { + es2021: true, + node: true, + }, + extends: [ + 'prettier', + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:import/recommended', + 'plugin:import/typescript', + 'plugin:prettier/recommended', ], - "import/order": ["error"], - /** - "indent": [ - "error", - 2 + overrides: [ + { + env: { + node: true, + }, + files: ['.eslintrc.{js,cjs}'], + parserOptions: { + sourceType: 'script', + }, + }, ], - **/ - "linebreak-style": [ - "error", - "unix" - ], - "quotes": [ - "error", - "single" - ], - "semi": [ - "error", - "always" - ], - "@typescript-eslint/no-unused-vars": ["warn"] - } -} + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + }, + plugins: ['@typescript-eslint', 'prettier'], + rules: { + 'prettier/prettier': [ + 'error', + { + tabWidth: 4, + printWidth: 120, + singleQuote: true, + }, + ], + 'import/order': ['error'], + '@typescript-eslint/no-unused-vars': ['warn'], + '@typescript-eslint/no-unused-expressions': ['off'], + }, +}; diff --git a/.gitignore b/.gitignore index 3f2b777..83b44d2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ node_modules .env -/events -/trees -backup-tornado-* -backup-tornadoInvoice-* -backup-note-account-* \ No newline at end of file + +# coverage files +/coverage +/coverage.json +.nyc_output \ No newline at end of file diff --git a/.nycrc b/.nycrc new file mode 100644 index 0000000..51371e2 --- /dev/null +++ b/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "extension": [".ts"], + "report-dir": "coverage", + "reporter": [ + "html", + "lcov", + "text", + "text-summary" + ], + "include": ["src/**/*.ts"], + "exclude": ["src/typechain/**/*"] +} \ No newline at end of file diff --git a/dist/batch.d.ts b/dist/batch.d.ts index e32cb17..c07bd39 100644 --- a/dist/batch.d.ts +++ b/dist/batch.d.ts @@ -1,4 +1,14 @@ -import type { Provider, BlockTag, Block, TransactionResponse, BaseContract, ContractEventName, EventLog } from 'ethers'; +import { Provider, BlockTag, Block, TransactionResponse, BaseContract, ContractEventName, EventLog, TransactionReceipt, EventFragment, TopicFilter, Interface, Log } from 'ethers'; +/** + * Copied from ethers.js as they don't export this function + * https://github.com/ethers-io/ethers.js/blob/main/src.ts/contract/contract.ts#L464 + */ +export declare function getSubInfo(abiInterface: Interface, event: ContractEventName): Promise<{ + fragment: null | EventFragment; + tag: string; + topics: TopicFilter; +}>; +export declare function multiQueryFilter(address: string | string[], contract: BaseContract, event: ContractEventName, fromBlock?: BlockTag, toBlock?: BlockTag): Promise; export interface BatchBlockServiceConstructor { provider: Provider; onProgress?: BatchBlockOnProgress; @@ -42,12 +52,15 @@ export declare class BatchTransactionService { retryOn: number; constructor({ provider, onProgress, concurrencySize, batchSize, shouldRetry, retryMax, retryOn, }: BatchBlockServiceConstructor); getTransaction(txHash: string): Promise; - createBatchRequest(batchArray: string[][]): Promise[]; + getTransactionReceipt(txHash: string): Promise; + createBatchRequest(batchArray: string[][], receipt?: boolean): Promise[]; getBatchTransactions(txs: string[]): Promise; + getBatchReceipt(txs: string[]): Promise; } export interface BatchEventServiceConstructor { provider: Provider; contract: BaseContract; + address?: string | string[]; onProgress?: BatchEventOnProgress; concurrencySize?: number; blocksPerRequest?: number; @@ -62,24 +75,25 @@ export type BatchEventOnProgress = ({ percentage, type, fromBlock, toBlock, coun toBlock?: number; count?: number; }) => void; -export type EventInput = { +export interface EventInput { fromBlock: number; toBlock: number; type: ContractEventName; -}; +} /** * Fetch events from web3 provider on bulk */ export declare class BatchEventsService { provider: Provider; contract: BaseContract; + address?: string | string[]; onProgress?: BatchEventOnProgress; concurrencySize: number; blocksPerRequest: number; shouldRetry: boolean; retryMax: number; retryOn: number; - constructor({ provider, contract, onProgress, concurrencySize, blocksPerRequest, shouldRetry, retryMax, retryOn, }: BatchEventServiceConstructor); + constructor({ provider, contract, address, onProgress, concurrencySize, blocksPerRequest, shouldRetry, retryMax, retryOn, }: BatchEventServiceConstructor); getPastEvents({ fromBlock, toBlock, type }: EventInput): Promise; createBatchRequest(batchArray: EventInput[]): Promise[]; getBatchEvents({ fromBlock, toBlock, type }: EventInput): Promise; diff --git a/dist/contracts.d.ts b/dist/contracts.d.ts new file mode 100644 index 0000000..1ccd320 --- /dev/null +++ b/dist/contracts.d.ts @@ -0,0 +1,2 @@ +export * from '@tornado/contracts'; +export { Multicall, Multicall__factory, OffchainOracle, OffchainOracle__factory, OvmGasPriceOracle, OvmGasPriceOracle__factory, ReverseRecords, ReverseRecords__factory, ENSNameWrapper, ENSNameWrapper__factory, ENSRegistry, ENSRegistry__factory, ENSResolver, ENSResolver__factory, } from './typechain'; diff --git a/dist/deposits.d.ts b/dist/deposits.d.ts index ae2ca21..33913d6 100644 --- a/dist/deposits.d.ts +++ b/dist/deposits.d.ts @@ -1,36 +1,35 @@ import type { NetIdType } from './networkConfig'; -export type DepositType = { +export interface DepositType { currency: string; amount: string; netId: NetIdType; -}; -export type createDepositParams = { +} +export interface createDepositParams { nullifier: bigint; secret: bigint; -}; -export type createDepositObject = { +} +export interface createDepositObject { preimage: Uint8Array; noteHex: string; commitment: bigint; commitmentHex: string; nullifierHash: bigint; nullifierHex: string; -}; -export type createNoteParams = DepositType & { +} +export interface createNoteParams extends DepositType { nullifier?: bigint; secret?: bigint; -}; -export type parsedNoteExec = DepositType & { +} +export interface parsedNoteExec extends DepositType { note: string; -}; -export type depositTx = { - from: string; - transactionHash: string; -}; -export type withdrawalTx = { - to: string; - transactionHash: string; -}; + noteHex: string; +} +export interface parsedInvoiceExec extends DepositType { + invoice: string; + commitmentHex: string; +} +export declare function parseNote(noteString: string): parsedNoteExec | undefined; +export declare function parseInvoice(invoiceString: string): parsedInvoiceExec | undefined; export declare function createDeposit({ nullifier, secret }: createDepositParams): Promise; export interface DepositConstructor { currency: string; @@ -60,14 +59,11 @@ export declare class Deposit { static createNote({ currency, amount, netId, nullifier, secret }: createNoteParams): Promise; static parseNote(noteString: string): Promise; } -export type parsedInvoiceExec = DepositType & { - commitment: string; -}; export declare class Invoice { currency: string; amount: string; netId: NetIdType; - commitment: string; + commitmentHex: string; invoice: string; constructor(invoiceString: string); toString(): string; diff --git a/dist/encryptedNotes.d.ts b/dist/encryptedNotes.d.ts index 4e20fe0..a4367ad 100644 --- a/dist/encryptedNotes.d.ts +++ b/dist/encryptedNotes.d.ts @@ -1,8 +1,6 @@ import { EthEncryptedData } from '@metamask/eth-sig-util'; -import { Echoer } from '@tornado/contracts'; -import { Wallet } from 'ethers'; +import { Signer, Wallet } from 'ethers'; import { EchoEvents, EncryptedNotesEvents } from './events'; -import type { NetIdType } from './networkConfig'; export interface NoteToEncrypt { address: string; noteHex: string; @@ -17,24 +15,20 @@ export declare function unpackEncryptedMessage(encryptedMessage: string): EthEnc messageBuff: string; }; export interface NoteAccountConstructor { - netId: NetIdType; blockNumber?: number; recoveryKey?: string; - Echoer: Echoer; } export declare class NoteAccount { - netId: NetIdType; blockNumber?: number; recoveryKey: string; recoveryAddress: string; recoveryPublicKey: string; - Echoer: Echoer; - constructor({ netId, blockNumber, recoveryKey, Echoer }: NoteAccountConstructor); + constructor({ blockNumber, recoveryKey }: NoteAccountConstructor); /** * Intends to mock eth_getEncryptionPublicKey behavior from MetaMask * In order to make the recoveryKey retrival from Echoer possible from the bare private key */ - static getWalletPublicKey(wallet: Wallet): string; + static getSignerPublicKey(signer: Signer | Wallet): Promise; getEncryptedAccount(walletPublicKey: string): { encryptedData: EthEncryptedData; data: string; @@ -42,7 +36,7 @@ export declare class NoteAccount { /** * Decrypt Echoer backuped note encryption account with private keys */ - decryptAccountsWithWallet(wallet: Wallet, events: EchoEvents[]): NoteAccount[]; + static decryptSignerNoteAccounts(signer: Signer | Wallet, events: EchoEvents[]): Promise; decryptNotes(events: EncryptedNotesEvents[]): DecryptedNotes[]; encryptNote({ address, noteHex }: NoteToEncrypt): string; } diff --git a/dist/ens.d.ts b/dist/ens.d.ts new file mode 100644 index 0000000..809fe46 --- /dev/null +++ b/dist/ens.d.ts @@ -0,0 +1,34 @@ +import { EnsResolver, AbstractProvider, Signer } from 'ethers'; +import { ENSNameWrapper, ENSRegistry, ENSResolver } from './typechain'; +import { NetIdType } from './networkConfig'; +export declare function encodedLabelToLabelhash(label: string): string | null; +export declare function labelhash(label: string): string; +export declare function makeLabelNodeAndParent(name: string): { + label: string; + labelhash: string; + parentNode: string; +}; +export declare const EnsContracts: { + [key: NetIdType]: { + ensRegistry: string; + ensPublicResolver: string; + ensNameWrapper: string; + }; +}; +/** + * ENSUtils to manage on-chain registered relayers + */ +export declare class ENSUtils { + ENSRegistry?: ENSRegistry; + ENSResolver?: ENSResolver; + ENSNameWrapper?: ENSNameWrapper; + provider: AbstractProvider; + constructor(provider: AbstractProvider); + getContracts(): Promise; + getOwner(name: string): Promise; + unwrap(signer: Signer, name: string): Promise; + setSubnodeRecord(signer: Signer, name: string): Promise; + getResolver(name: string): Promise; + getText(name: string, key: string): Promise; + setText(signer: Signer, name: string, key: string, value: string): Promise; +} diff --git a/dist/events/base.d.ts b/dist/events/base.d.ts index 7e8379e..2d3d0ca 100644 --- a/dist/events/base.d.ts +++ b/dist/events/base.d.ts @@ -1,67 +1,50 @@ -import { BaseContract, Provider, EventLog, ContractEventName } from 'ethers'; -import type { Tornado, TornadoRouter, TornadoProxyLight, Governance, RelayerRegistry, Echoer } from '@tornado/contracts'; +import { BaseContract, Provider, EventLog } from 'ethers'; +import { Tornado, TornadoRouter, TornadoProxyLight, Governance, RelayerRegistry, Echoer, Aggregator } from '@tornado/contracts'; +import type { MerkleTree } from '@tornado/fixed-merkle-tree'; import { BatchEventsService, BatchBlockService, BatchTransactionService, BatchEventOnProgress, BatchBlockOnProgress } from '../batch'; import { fetchDataOptions } from '../providers'; -import type { NetIdType } from '../networkConfig'; -import type { BaseEvents, MinimalEvents, DepositsEvents, WithdrawalsEvents, EncryptedNotesEvents, AllGovernanceEvents, RegistersEvents, EchoEvents } from './types'; -export declare const DEPOSIT = "deposit"; -export declare const WITHDRAWAL = "withdrawal"; -export type BaseEventsServiceConstructor = { +import { type NetIdType, type SubdomainMap } from '../networkConfig'; +import { RelayerParams } from '../relayerClient'; +import type { TovarishClient } from '../tovarishClient'; +import type { ReverseRecords } from '../typechain'; +import type { MerkleTreeService } from '../merkleTree'; +import type { DepositType } from '../deposits'; +import type { BaseEvents, CachedEvents, MinimalEvents, DepositsEvents, WithdrawalsEvents, EncryptedNotesEvents, AllGovernanceEvents, GovernanceProposalCreatedEvents, GovernanceVotedEvents, EchoEvents, AllRelayerRegistryEvents, StakeBurnedEvents, MultiDepositsEvents, MultiWithdrawalsEvents } from './types'; +export interface BaseEventsServiceConstructor { netId: NetIdType; provider: Provider; - graphApi?: string; - subgraphName?: string; contract: BaseContract; - type?: string; + type: string; deployedBlock?: number; fetchDataOptions?: fetchDataOptions; -}; -export type BatchGraphOnProgress = ({ type, fromBlock, toBlock, count, }: { - type?: ContractEventName; - fromBlock?: number; - toBlock?: number; - count?: number; -}) => void; -export type BaseGraphParams = { - graphApi: string; - subgraphName: string; - fetchDataOptions?: fetchDataOptions; - onProgress?: BatchGraphOnProgress; -}; + tovarishClient?: TovarishClient; +} export declare class BaseEventsService { netId: NetIdType; provider: Provider; - graphApi?: string; - subgraphName?: string; contract: BaseContract; type: string; deployedBlock: number; batchEventsService: BatchEventsService; fetchDataOptions?: fetchDataOptions; - saveEventsPromise?: Promise; - constructor({ netId, provider, graphApi, subgraphName, contract, type, deployedBlock, fetchDataOptions, }: BaseEventsServiceConstructor); + tovarishClient?: TovarishClient; + constructor({ netId, provider, contract, type, deployedBlock, fetchDataOptions, tovarishClient, }: BaseEventsServiceConstructor); getInstanceName(): string; getType(): string; - getGraphMethod(): string; - getGraphParams(): BaseGraphParams; + getTovarishType(): string; updateEventProgress({ percentage, type, fromBlock, toBlock, count }: Parameters[0]): void; updateBlockProgress({ percentage, currentIndex, totalIndex }: Parameters[0]): void; updateTransactionProgress({ percentage, currentIndex, totalIndex }: Parameters[0]): void; - updateGraphProgress({ type, fromBlock, toBlock, count }: Parameters[0]): void; formatEvents(events: EventLog[]): Promise; /** * Get saved or cached events */ getEventsFromDB(): Promise>; - getEventsFromCache(): Promise>; - getSavedEvents(): Promise>; /** - * Get latest events + * Events from remote cache (Either from local cache, CDN, or from IPFS) */ - getEventsFromGraph({ fromBlock, methodName, }: { - fromBlock: number; - methodName?: string; - }): Promise>; + getEventsFromCache(): Promise>; + getSavedEvents(): Promise | CachedEvents>; getEventsFromRpc({ fromBlock, toBlock, }: { fromBlock: number; toBlock?: number; @@ -69,124 +52,203 @@ export declare class BaseEventsService { getLatestEvents({ fromBlock }: { fromBlock: number; }): Promise>; - validateEvents({ events, lastBlock }: BaseEvents): void; + validateEvents({ events, newEvents, lastBlock, }: BaseEvents & { + newEvents: EventType[]; + }): Promise; /** * Handle saving events */ - saveEvents({ events, lastBlock }: BaseEvents): Promise; + saveEvents({ events, newEvents, lastBlock }: BaseEvents & { + newEvents: EventType[]; + }): Promise; /** * Trigger saving and receiving latest events */ - updateEvents(): Promise<{ + updateEvents(): Promise<{ events: EventType[]; - lastBlock: number | null; + lastBlock: number; + validateResult: Awaited; }>; } -export type BaseTornadoServiceConstructor = { - netId: NetIdType; - provider: Provider; - graphApi?: string; - subgraphName?: string; +export interface BaseTornadoServiceConstructor extends Omit { Tornado: Tornado; - type: string; amount: string; currency: string; - deployedBlock?: number; - fetchDataOptions?: fetchDataOptions; -}; -export type DepositsGraphParams = BaseGraphParams & { - amount: string; - currency: string; -}; + optionalTree?: boolean; + merkleTreeService?: MerkleTreeService; +} export declare class BaseTornadoService extends BaseEventsService { amount: string; currency: string; + optionalTree?: boolean; + merkleTreeService?: MerkleTreeService; batchTransactionService: BatchTransactionService; batchBlockService: BatchBlockService; - constructor({ netId, provider, graphApi, subgraphName, Tornado, type, amount, currency, deployedBlock, fetchDataOptions, }: BaseTornadoServiceConstructor); + constructor(serviceConstructor: BaseTornadoServiceConstructor); getInstanceName(): string; - getGraphMethod(): string; - getGraphParams(): DepositsGraphParams; formatEvents(events: EventLog[]): Promise<(DepositsEvents | WithdrawalsEvents)[]>; - validateEvents({ events }: { - events: (DepositsEvents | WithdrawalsEvents)[]; - }): void; -} -export type BaseEchoServiceConstructor = { - netId: NetIdType; - provider: Provider; - graphApi?: string; - subgraphName?: string; - Echoer: Echoer; - deployedBlock?: number; - fetchDataOptions?: fetchDataOptions; -}; -export declare class BaseEchoService extends BaseEventsService { - constructor({ netId, provider, graphApi, subgraphName, Echoer, deployedBlock, fetchDataOptions, }: BaseEchoServiceConstructor); - getInstanceName(): string; - getType(): string; - getGraphMethod(): string; - formatEvents(events: EventLog[]): Promise; - getEventsFromGraph({ fromBlock }: { + validateEvents({ events, newEvents, }: BaseEvents & { + newEvents: (DepositsEvents | WithdrawalsEvents)[]; + }): Promise; + getLatestEvents({ fromBlock, }: { fromBlock: number; - }): Promise>; + }): Promise>; } -export type BaseEncryptedNotesServiceConstructor = { - netId: NetIdType; - provider: Provider; - graphApi?: string; - subgraphName?: string; - Router: TornadoRouter | TornadoProxyLight; - deployedBlock?: number; - fetchDataOptions?: fetchDataOptions; -}; -export declare class BaseEncryptedNotesService extends BaseEventsService { - constructor({ netId, provider, graphApi, subgraphName, Router, deployedBlock, fetchDataOptions, }: BaseEncryptedNotesServiceConstructor); +export interface BaseMultiTornadoServiceConstructor extends Omit { + instances: { + [key in string]: DepositType; + }; + optionalTree?: boolean; + merkleTreeService?: MerkleTreeService; +} +export declare class BaseMultiTornadoService extends BaseEventsService { + instances: { + [key in string]: DepositType; + }; + optionalTree?: boolean; + merkleTreeService?: MerkleTreeService; + batchTransactionService: BatchTransactionService; + batchBlockService: BatchBlockService; + constructor(serviceConstructor: BaseMultiTornadoServiceConstructor); getInstanceName(): string; - getType(): string; - getGraphMethod(): string; + getTovarishType(): string; + formatEvents(events: EventLog[]): Promise<(MultiDepositsEvents | MultiWithdrawalsEvents)[]>; + validateEvents({ events, newEvents, }: BaseEvents & { + newEvents: (MultiDepositsEvents | MultiWithdrawalsEvents)[]; + }): Promise; + getEvents(instanceAddress: string): Promise<{ + depositEvents: MultiDepositsEvents[]; + withdrawalEvents: MultiWithdrawalsEvents[]; + tree: MerkleTree | undefined; + lastBlock: number; + }>; +} +export interface BaseEchoServiceConstructor extends Omit { + Echoer: Echoer; +} +export declare class BaseEchoService extends BaseEventsService { + constructor(serviceConstructor: BaseEchoServiceConstructor); + getInstanceName(): string; + formatEvents(events: EventLog[]): Promise; +} +export interface BaseEncryptedNotesServiceConstructor extends Omit { + Router: TornadoRouter | TornadoProxyLight; +} +export declare class BaseEncryptedNotesService extends BaseEventsService { + constructor(serviceConstructor: BaseEncryptedNotesServiceConstructor); + getInstanceName(): string; + getTovarishType(): string; formatEvents(events: EventLog[]): Promise; } -export type BaseGovernanceServiceConstructor = { - netId: NetIdType; - provider: Provider; - graphApi?: string; - subgraphName?: string; +export declare const proposalState: { + [key: string]: string; +}; +export interface GovernanceProposals extends GovernanceProposalCreatedEvents { + title: string; + proposerName?: string; + forVotes: bigint; + againstVotes: bigint; + executed: boolean; + extended: boolean; + quorum: string; + state: string; +} +export interface GovernanceVotes extends GovernanceVotedEvents { + contact: string; + message: string; + fromName?: string; + voterName?: string; +} +export interface BaseGovernanceServiceConstructor extends Omit { Governance: Governance; - deployedBlock?: number; - fetchDataOptions?: fetchDataOptions; -}; + Aggregator: Aggregator; + ReverseRecords: ReverseRecords; +} export declare class BaseGovernanceService extends BaseEventsService { + Governance: Governance; + Aggregator: Aggregator; + ReverseRecords: ReverseRecords; batchTransactionService: BatchTransactionService; - constructor({ netId, provider, graphApi, subgraphName, Governance, deployedBlock, fetchDataOptions, }: BaseGovernanceServiceConstructor); + constructor(serviceConstructor: BaseGovernanceServiceConstructor); getInstanceName(): string; - getType(): string; - getGraphMethod(): string; + getTovarishType(): string; formatEvents(events: EventLog[]): Promise; - getEventsFromGraph({ fromBlock }: { - fromBlock: number; - }): Promise>; + getAllProposals(): Promise; + getVotes(proposalId: number): Promise; + getDelegatedBalance(ethAccount: string): Promise<{ + delegatedAccs: string[]; + undelegatedAccs: string[]; + uniq: string[]; + uniqNames: { + [key: string]: string; + }; + balances: bigint[]; + balance: bigint; + }>; } -export type BaseRegistryServiceConstructor = { - netId: NetIdType; - provider: Provider; - graphApi?: string; - subgraphName?: string; +export declare function getTovarishNetworks(registryService: BaseRegistryService, relayers: CachedRelayerInfo[]): Promise; +/** + * Essential params: + * ensName, relayerAddress, hostnames + * Other data is for historic purpose from relayer registry + */ +export interface CachedRelayerInfo extends RelayerParams { + isRegistered?: boolean; + registeredAddress?: string; + stakeBalance?: string; + hostnames: SubdomainMap; + tovarishHost?: string; + tovarishNetworks?: number[]; +} +export interface CachedRelayers { + lastBlock: number; + timestamp: number; + relayers: CachedRelayerInfo[]; + fromCache?: boolean; +} +export interface BaseRegistryServiceConstructor extends Omit { RelayerRegistry: RelayerRegistry; - deployedBlock?: number; - fetchDataOptions?: fetchDataOptions; -}; -export declare class BaseRegistryService extends BaseEventsService { - constructor({ netId, provider, graphApi, subgraphName, RelayerRegistry, deployedBlock, fetchDataOptions, }: BaseRegistryServiceConstructor); - getInstanceName(): string; - getType(): string; - getGraphMethod(): string; - formatEvents(events: EventLog[]): Promise<{ - ensName: any; - relayerAddress: any; - blockNumber: number; - logIndex: number; - transactionHash: string; - }[]>; - fetchRelayers(): Promise; + Aggregator: Aggregator; + relayerEnsSubdomains: SubdomainMap; +} +export declare class BaseRegistryService extends BaseEventsService { + Aggregator: Aggregator; + relayerEnsSubdomains: SubdomainMap; + updateInterval: number; + constructor(serviceConstructor: BaseRegistryServiceConstructor); + getInstanceName(): string; + getTovarishType(): string; + formatEvents(events: EventLog[]): Promise; + /** + * Get saved or cached relayers + */ + getRelayersFromDB(): Promise; + /** + * Relayers from remote cache (Either from local cache, CDN, or from IPFS) + */ + getRelayersFromCache(): Promise; + getSavedRelayers(): Promise; + getLatestRelayers(): Promise; + /** + * Handle saving relayers + */ + saveRelayers({ lastBlock, timestamp, relayers }: CachedRelayers): Promise; + /** + * Get cached or latest relayer and save to local + */ + updateRelayers(): Promise; +} +export interface BaseRevenueServiceConstructor extends Omit { + RelayerRegistry: RelayerRegistry; +} +/** + * Tracks TORN burned events from RelayerRegistry contract + */ +export declare class BaseRevenueService extends BaseEventsService { + batchTransactionService: BatchTransactionService; + batchBlockService: BatchBlockService; + constructor(serviceConstructor: BaseRevenueServiceConstructor); + getInstanceName(): string; + getTovarishType(): string; + formatEvents(events: EventLog[]): Promise; } diff --git a/dist/events/db.d.ts b/dist/events/db.d.ts new file mode 100644 index 0000000..45bc6a9 --- /dev/null +++ b/dist/events/db.d.ts @@ -0,0 +1,102 @@ +import { IndexedDB } from '../idb'; +import { BaseTornadoService, BaseTornadoServiceConstructor, BaseEchoService, BaseEchoServiceConstructor, BaseEncryptedNotesService, BaseEncryptedNotesServiceConstructor, BaseGovernanceService, BaseGovernanceServiceConstructor, BaseRegistryService, BaseRegistryServiceConstructor, BaseRevenueService, BaseRevenueServiceConstructor, CachedRelayers } from './base'; +import { BaseEvents, MinimalEvents, DepositsEvents, WithdrawalsEvents, CachedEvents, EchoEvents, EncryptedNotesEvents, AllGovernanceEvents, AllRelayerRegistryEvents, StakeBurnedEvents } from './types'; +export declare function saveDBEvents({ idb, instanceName, events, lastBlock, }: { + idb: IndexedDB; + instanceName: string; + events: T[]; + lastBlock: number; +}): Promise; +export declare function loadDBEvents({ idb, instanceName, }: { + idb: IndexedDB; + instanceName: string; +}): Promise>; +export declare function loadRemoteEvents({ staticUrl, instanceName, deployedBlock, zipDigest, }: { + staticUrl: string; + instanceName: string; + deployedBlock: number; + zipDigest?: string; +}): Promise>; +export interface DBTornadoServiceConstructor extends BaseTornadoServiceConstructor { + staticUrl: string; + idb: IndexedDB; +} +export declare class DBTornadoService extends BaseTornadoService { + staticUrl: string; + idb: IndexedDB; + zipDigest?: string; + constructor(params: DBTornadoServiceConstructor); + getEventsFromDB(): Promise>; + getEventsFromCache(): Promise>; + saveEvents({ events, lastBlock }: BaseEvents): Promise; +} +export interface DBEchoServiceConstructor extends BaseEchoServiceConstructor { + staticUrl: string; + idb: IndexedDB; +} +export declare class DBEchoService extends BaseEchoService { + staticUrl: string; + idb: IndexedDB; + zipDigest?: string; + constructor(params: DBEchoServiceConstructor); + getEventsFromDB(): Promise>; + getEventsFromCache(): Promise>; + saveEvents({ events, lastBlock }: BaseEvents): Promise; +} +export interface DBEncryptedNotesServiceConstructor extends BaseEncryptedNotesServiceConstructor { + staticUrl: string; + idb: IndexedDB; +} +export declare class DBEncryptedNotesService extends BaseEncryptedNotesService { + staticUrl: string; + idb: IndexedDB; + zipDigest?: string; + constructor(params: DBEncryptedNotesServiceConstructor); + getEventsFromDB(): Promise>; + getEventsFromCache(): Promise>; + saveEvents({ events, lastBlock }: BaseEvents): Promise; +} +export interface DBGovernanceServiceConstructor extends BaseGovernanceServiceConstructor { + staticUrl: string; + idb: IndexedDB; +} +export declare class DBGovernanceService extends BaseGovernanceService { + staticUrl: string; + idb: IndexedDB; + zipDigest?: string; + constructor(params: DBGovernanceServiceConstructor); + getEventsFromDB(): Promise>; + getEventsFromCache(): Promise>; + saveEvents({ events, lastBlock }: BaseEvents): Promise; +} +export interface DBRegistryServiceConstructor extends BaseRegistryServiceConstructor { + staticUrl: string; + idb: IndexedDB; +} +export declare class DBRegistryService extends BaseRegistryService { + staticUrl: string; + idb: IndexedDB; + zipDigest?: string; + relayerJsonDigest?: string; + constructor(params: DBRegistryServiceConstructor); + getEventsFromDB(): Promise>; + getEventsFromCache(): Promise>; + saveEvents({ events, lastBlock }: BaseEvents): Promise; + getRelayersFromDB(): Promise; + getRelayersFromCache(): Promise; + saveRelayers(cachedRelayers: CachedRelayers): Promise; +} +export interface DBRevenueServiceConstructor extends BaseRevenueServiceConstructor { + staticUrl: string; + idb: IndexedDB; +} +export declare class DBRevenueService extends BaseRevenueService { + staticUrl: string; + idb: IndexedDB; + zipDigest?: string; + relayerJsonDigest?: string; + constructor(params: DBRevenueServiceConstructor); + getEventsFromDB(): Promise>; + getEventsFromCache(): Promise>; + saveEvents({ events, lastBlock }: BaseEvents): Promise; +} diff --git a/dist/events/index.d.ts b/dist/events/index.d.ts index 63fa69b..77219eb 100644 --- a/dist/events/index.d.ts +++ b/dist/events/index.d.ts @@ -1,2 +1,3 @@ export * from './types'; export * from './base'; +export * from './db'; diff --git a/dist/events/types.d.ts b/dist/events/types.d.ts index 51cadee..68aba12 100644 --- a/dist/events/types.d.ts +++ b/dist/events/types.d.ts @@ -1,7 +1,10 @@ import { RelayerParams } from '../relayerClient'; export interface BaseEvents { events: T[]; - lastBlock: number | null; + lastBlock: number; +} +export interface CachedEvents extends BaseEvents { + fromCache: boolean; } export interface BaseGraphEvents { events: T[]; @@ -12,51 +15,87 @@ export interface MinimalEvents { logIndex: number; transactionHash: string; } -export type GovernanceEvents = MinimalEvents & { +export interface GovernanceEvents extends MinimalEvents { event: string; -}; -export type GovernanceProposalCreatedEvents = GovernanceEvents & { +} +export interface GovernanceProposalCreatedEvents extends GovernanceEvents { id: number; proposer: string; target: string; startTime: number; endTime: number; description: string; -}; -export type GovernanceVotedEvents = GovernanceEvents & { +} +export interface GovernanceVotedEvents extends GovernanceEvents { proposalId: number; voter: string; support: boolean; votes: string; from: string; input: string; -}; -export type GovernanceDelegatedEvents = GovernanceEvents & { +} +export interface GovernanceDelegatedEvents extends GovernanceEvents { account: string; delegateTo: string; -}; -export type GovernanceUndelegatedEvents = GovernanceEvents & { +} +export interface GovernanceUndelegatedEvents extends GovernanceEvents { account: string; delegateFrom: string; -}; +} export type AllGovernanceEvents = GovernanceProposalCreatedEvents | GovernanceVotedEvents | GovernanceDelegatedEvents | GovernanceUndelegatedEvents; +export interface RelayerRegistryEvents extends MinimalEvents { + event: string; +} +export interface RelayerRegisteredEvents extends RelayerRegistryEvents, RelayerParams { + ensHash: string; + stakedAmount: string; +} +export interface RelayerUnregisteredEvents extends RelayerRegistryEvents { + relayerAddress: string; +} +export interface WorkerRegisteredEvents extends RelayerRegistryEvents { + relayerAddress: string; + workerAddress: string; +} +export interface WorkerUnregisteredEvents extends RelayerRegistryEvents { + relayerAddress: string; + workerAddress: string; +} +export type AllRelayerRegistryEvents = RelayerRegisteredEvents | RelayerUnregisteredEvents | WorkerRegisteredEvents | WorkerUnregisteredEvents; +export interface StakeBurnedEvents extends MinimalEvents { + relayerAddress: string; + amountBurned: string; + instanceAddress: string; + gasFee: string; + relayerFee: string; + timestamp: number; +} export type RegistersEvents = MinimalEvents & RelayerParams; -export type DepositsEvents = MinimalEvents & { +export interface DepositsEvents extends MinimalEvents { commitment: string; leafIndex: number; timestamp: number; from: string; -}; -export type WithdrawalsEvents = MinimalEvents & { +} +export interface WithdrawalsEvents extends MinimalEvents { nullifierHash: string; to: string; fee: string; timestamp: number; -}; -export type EchoEvents = MinimalEvents & { +} +export interface BaseMultiTornadoEvents { + event: string; + instanceAddress: string; +} +export interface MultiDepositsEvents extends BaseMultiTornadoEvents, DepositsEvents { +} +export interface MultiWithdrawalsEvents extends BaseMultiTornadoEvents, WithdrawalsEvents { + relayerAddress: string; +} +export interface EchoEvents extends MinimalEvents { address: string; encryptedAccount: string; -}; -export type EncryptedNotesEvents = MinimalEvents & { +} +export interface EncryptedNotesEvents extends MinimalEvents { encryptedNote: string; -}; +} diff --git a/dist/fees.d.ts b/dist/fees.d.ts index e0703e0..d1c1222 100644 --- a/dist/fees.d.ts +++ b/dist/fees.d.ts @@ -1,4 +1,4 @@ -import type { BigNumberish, TransactionLike } from 'ethers'; +import type { BigNumberish, JsonRpcApiProvider, TransactionLike } from 'ethers'; import { OvmGasPriceOracle } from './typechain'; /** * Example: @@ -19,8 +19,17 @@ export interface RelayerFeeParams { premiumPercent?: number; } export declare class TornadoFeeOracle { + provider: JsonRpcApiProvider; ovmGasPriceOracle?: OvmGasPriceOracle; - constructor(ovmGasPriceOracle?: OvmGasPriceOracle); + constructor(provider: JsonRpcApiProvider, ovmGasPriceOracle?: OvmGasPriceOracle); + /** + * Calculates Gas Price + * We apply 50% premium of EIP-1559 network fees instead of 100% from ethers.js + * (This should cover up to 4 full blocks which is equivalent of minute) + * (A single block can bump 12.5% of fees, see the methodology https://hackmd.io/@tvanepps/1559-wallets) + * (Still it is recommended to use 100% premium for sending transactions to prevent stucking it) + */ + gasPrice(): Promise; /** * Calculate L1 fee for op-stack chains * diff --git a/dist/gaszip.d.ts b/dist/gaszip.d.ts new file mode 100644 index 0000000..aa40d75 --- /dev/null +++ b/dist/gaszip.d.ts @@ -0,0 +1,13 @@ +import { NetIdType } from './networkConfig'; +export declare const gasZipInbounds: { + [key in NetIdType]: string; +}; +export declare const gasZipID: { + [key in NetIdType]: number; +}; +export declare function gasZipInput(to: string, shorts: number[]): string | null; +export declare function gasZipMinMax(ethUsd: number): { + min: number; + max: number; + ethUsd: number; +}; diff --git a/dist/graphql/index.d.ts b/dist/graphql/index.d.ts index c9832ae..12a4e69 100644 --- a/dist/graphql/index.d.ts +++ b/dist/graphql/index.d.ts @@ -1,7 +1,14 @@ +import { ContractEventName } from 'ethers'; import { fetchDataOptions } from '../providers'; -import type { BaseGraphEvents, RegistersEvents, DepositsEvents, WithdrawalsEvents, EncryptedNotesEvents, BatchGraphOnProgress, EchoEvents, AllGovernanceEvents } from '../events'; +import type { BaseGraphEvents, RegistersEvents, DepositsEvents, WithdrawalsEvents, EncryptedNotesEvents, EchoEvents, AllGovernanceEvents } from '../events'; export * from './queries'; -export type queryGraphParams = { +export type BatchGraphOnProgress = ({ type, fromBlock, toBlock, count, }: { + type?: ContractEventName; + fromBlock?: number; + toBlock?: number; + count?: number; +}) => void; +export interface queryGraphParams { graphApi: string; subgraphName: string; query: string; @@ -9,7 +16,7 @@ export type queryGraphParams = { [key: string]: string | number; }; fetchDataOptions?: fetchDataOptions; -}; +} export declare function queryGraph({ graphApi, subgraphName, query, variables, fetchDataOptions, }: queryGraphParams): Promise; export interface GraphStatistic { deposits: { diff --git a/dist/hasher.d.ts b/dist/hasher.d.ts new file mode 100644 index 0000000..980b394 --- /dev/null +++ b/dist/hasher.d.ts @@ -0,0 +1,3 @@ +import { Signer } from 'ethers'; +export declare const hasherBytecode = "0x38600c600039612b1b6000f3606460006000377c01000000000000000000000000000000000000000000000000000000006000510463f47d33b5146200003557fe5b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000016004518160245181838180828009800909089082827f0fbe43c36a80e36d7c7c584d4f8f3759fb51f0d66065d8a227b688d12488c5d408839081808280098009098391089082827f9c48cd3e00a6195a253fc009e60f249456f802ff9baf6549210d201321efc1cc08839081808280098009098391089082827f27c0849dba2643077c13eb42ffb97663cdcecd669bf10f756be30bab71b86cf808839081808280098009098391089082827f2bf76744736132e5c68f7dfdd5b792681d415098554fd8280f00d11b172b80d208839081808280098009098391089082827f33133eb4a1a1ab45037c8bdf9adbb2999baf06f20a9c95180dc4ccdcbec5856808839081808280098009098391089082827f588bb66012356dbc9b059ef1d792b563d6c18624dddecc3fe4583fd3551e9b3008839081808280098009098391089082827f71bc3e244e1b92911fe7f53cf523e491fd6ff487d59337a1d92f92668c4f4c3608839081808280098009098391089082827fd1808e2b039fd010c489768f78d7499938ccc0858f3295151787cfe8b7e40be108839081808280098009098391089082827f76978af3ded437cf41b3faa40cd6bcfce94f27f4abcc3ed34be19abd2c4537d008839081808280098009098391089082827f0a9baee798a320b0ca5b1cf888386d1dc12c13b38e10225aa4e9f03069a099f508839081808280098009098391089082827fb79dbf6050a03b16c3ade8d77e11c767d2251af9cdbd6cdf9a8a0ee921b32c7908839081808280098009098391089082827fa74bbcf5067f067faec2cce4b98d130d7927456f5c5f6c00e0f5406a24eb8b1908839081808280098009098391089082827fab7ab080d4c4018bda6ecc8bd67468bc4619ba12f25b0da879a639c758c8855d08839081808280098009098391089082827fe6a5b797c2bba7e9a873b37f5c41adc47765e9be4a1f0e0650e6a24ad226876308839081808280098009098391089082827f6270ae87cf3d82cf9c0b5f428466c429d7b7cbe234cecff39969171af006016c08839081808280098009098391089082827f9951c9f6e76d636b52f7600d979ca9f3b643dfbe9551c83b31542830321b2a6608839081808280098009098391089082827f4119469e44229cc40c4ff555a2b6f6b39961088e741e3c20a3c9b47f130c555008839081808280098009098391089082827f5d795e02bbaf90ff1f384741e5f18f8b644a0080441315d0e5b3c8123452a0b008839081808280098009098391089082827f281e90a515e6409e9177b4f297f8049ce3d4c3659423c48b3fd64e83596ff10108839081808280098009098391089082827f424185c60a21e84970f7d32cacaa2725aa8a844caea7ed760d2b965af1bf3e7d08839081808280098009098391089082827fd96fcbc3960614ea887da609187a5dada2e1b829f23309a6375212cea1f25c0908839081808280098009098391089082827ffde84026d7c294300af18f7712fc3662f43387ae8cf7fdda1f9a810f4b24bcf208839081808280098009098391089082827f3a9d568575846aa6b8a890b3c237fd0447426db878e6e25333b8eb9b386195c108839081808280098009098391089082827f55a2aa32c84a4cae196dd4094b685dd11757470a3be094d98eea73f02452aa3608839081808280098009098391089082827fcbc9481380978d29ebc5b0a8d4481cd2ef654ee800907adb3d38dc2fd9265fab08839081808280098009098391089082827f24e53af71ef06bacb76d3294c11223911e9d177ff09b7009febc484add0beb7408839081808280098009098391089082827fdbd44e16108225766dac3e5fe7acbe9df519bbba97380e5e9437a90658f2139308839081808280098009098391089082827fc6f434863c79013bb2c202331e04bccea2251c1ff6f191dc2afa23e6f6d28e4e08839081808280098009098391089082827f3490eeb39a733c0e8062d87f981ae65a8fccf25c448f4455d27db3915351b06608839081808280098009098391089082827f30b89830ff7ade3558a5361a24869130ce1fcce97211602962e34859525dac4f08839081808280098009098391089082827f29bae21b579d080a75c1694da628d0ecfd83efc9c8468704f410300062f64ca908839081808280098009098391089082827fe326499de0476e719915dd1c661ef4550723d4aee9ee9af224edd208790fce4408839081808280098009098391089082827f8c45208b8baa6f473821415957088c0b7e72a465f460b09ece2d270aee2f184108839081808280098009098391089082827ffe2ad454f451348f26ce2cc7e7914aef3eb96e8f89a4619a1dc7d11f8401c35208839081808280098009098391089082827f0929db368ef2af2d29bca38845325b0b7a820a4889e44b5829bbe1ed47fd4d5208839081808280098009098391089082827f16531d424b0cbaf9abbf2d2acde698462ea4555bf32ccf1bbd26697e905066f608839081808280098009098391089082827ff5c30d247f045ff6d05cf0dd0a49c9823e7a24b0d751d3c721353b96f29d76f608839081808280098009098391089082827f6eb7a3614056c230c6f171370fdd9d1048bb00b2cdd1b2721d11bdda5023f48608839081808280098009098391089082827f0ee9c4621642a272f710908707557498d25a6fdd51866da5d9f0d205355a618908839081808280098009098391089082827f78ca1cb1c7f6c6894d1cf94f327b8763be173151b6b06f99dfc6a944bb5a72f008839081808280098009098391089082827f5d24d0b1b304d05311ce0f274b0d93746a4860ed5cdd8d4348de557ea7a5ee7a08839081808280098009098391089082827f77423dabd1a3cddc8691438fc5891e3fd49ac0f3e21aaf249791bfde1303d2f308839081808280098009098391089082827f0642e8800a48cc04c0168232c6f542396597a67cf395ad622d947e98bb68697a08839081808280098009098391089082827fc1e7d3cbbc4c35b7490647d8402e56d334336943bda91fe2d34ca9727c0e3df508839081808280098009098391089082827f8d6fb1730335204f38f85e408ac861e76f24349ab6ee0469c22e19350bb24fe108839081808280098009098391089082827f67d0faf5f0db32a1b60e13dc4914246b9edac7990fb4990b19aa86815586441a08839081808280098009098391089082827f2605b9b909ded1b04971eae979027c4e0de57f3b6a60d5ed58aba619c34749ce08839081808280098009098391089082827fd276890b2c205db85f000d1f5111ed8f177e279cae3e52862780f04e846228d008839081808280098009098391089082827f2ac5905f9450a21ef6905ed5951a91b3730e3a2e2d62b50bdeb810015d50376b08839081808280098009098391089082827f7a366839f0291ca54da674ac3f0e1e9aa8b687ba533926cb40268039e57b967a08839081808280098009098391089082827f67ab0f3466989c3dbbe209c37ec272ba83984ba6e445be6d472b63e3ca7270e308839081808280098009098391089082827f0e786007d0ce7e28a90e31d3263887d40c556dec88fcb8b56bc9e9c05ecc0c2908839081808280098009098391089082827f0b814ed99bd00eca389b0022663dbfddfbfa15e321c19abcf1eaf9556075fb6808839081808280098009098391089082827f65c0321ba26fcee4fdc35b4999b78ceb54dcaf9fec2e3bdea98e9f82925c093208839081808280098009098391089082827fab2d2a929601f9c3520e0b14aaa6ba9f1e79821a5b768919670a4ea970722bf408839081808280098009098391089082827fcdd2e0744d4af1a81918de69ec12128a5871367303ff83ed764771cbbdf6502308839081808280098009098391089082827f74527d0c0868f2ec628086b874fa66a7347d3d3b918d2e07a5f33e1067e8ac5808839081808280098009098391089082827f1c6bf6ac0314caead23e357bfcbbaa17d670672ae3a475f80934c716f10aca2508839081808280098009098391089082827f3c4007e286f8dc7efd5d0eeb0e95d7aa6589361d128a0cccb17b554c851a643208839081808280098009098391089082827fae468a86a5a7db7c763a053eb09ac1a02809ce095258c88101ee319e12b0697e08839081808280098009098391089082827f9333e3d052b7c77fcac1eb366f610f6f97852242b1317a87b80f3bbc5c8c2d1d08839081808280098009098391089082827f52ec1d675cf5353153f6b628414783ca6b7fc0fe01948ca206daad712296e39508839081808280098009098391089082827f13ceeeb301572b4991076750e11ea7e7fcbfee454d90dc1763989004a1894f9308839081808280098009098391089082827f8505737e7e94939a08d8cda10b6fbbbf879b2141ae7eabc30fcd22405135fe6408839081808280098009098391089082827f6127db7ac5200a212092b66ec2bfc63653f4dc8ac66c76008fef885258a258b508839081808280098009098391089082827f12692a7d808f44e31d628dbcfea377eb073fb918d7beb8136ea47f8cf094c88c08839081808280098009098391089082827f260e384b1268e3a347c91d6987fd280fa0a275541a7c5be34bf126af35c962e008839081808280098009098391089082827fd88c3b01966d90e713aee8d482ceaa6925311d2342e1a5aca4fcd2f44b6daddc08839081808280098009098391089082827fb87e868affd91b078a87fa75ac9332a6cf23587d94e20c3262db5e91f30bf04b08839081808280098009098391089082827fb5ba5f8acad1a950a3bbf2201055cd3ea27056c0c53f0c4c97f33cda8dbfe90908839081808280098009098391089082827f59ca814b49e00d7b3118c53a2986ded128584acd7428735e08ade6661c457f7508839081808280098009098391089082827f0fc4c0bea813a223fd510c07f7bbe337badd4bcf28649a0d378970c2a15b3aa508839081808280098009098391089082827f0053f1ea6dd60e7a6db09a00be77549ff3d4ee3737be7fb42052ae1321f667c308839081808280098009098391089082827feb937077bb10c8fe38716d4e38edc1f9e7b18c6414fef85fe7e9c5567baa4a0408839081808280098009098391089082827fbacb14c0f1508d828f7fd048d716b8044aec7f0fb48e85e717bf532db972520708839081808280098009098391089082827f4ca0abb8beb7cff572a0c1e6f58e080e1bb243d497a3e74538442a4555ad40be08839081808280098009098391089082827fda9eefd411e590d7e44592cce298af87b2c62aa3cc8bb137aa99ca8d4aa551b508839081808280098009098391089082827f153dae43cef763e7a2fc9846f09a2973b0ad9c35894c220699bcc2954501c6bd08839081808280098009098391089082827fd4ed2a09375813b4fb504c7a9ba13110bdd8549a47349db82c15a434c090e87b08839081808280098009098391089082827f0063a5c4c9c12dcf4bae72c69f3a225664469503d61d9eae5d9553bfb006095b08839081808280098009098391089082827fdc8a4d35ad28e59dd3713b45985cd3b70e37ccc2be42086f1ea078fe2dc9d82d08839081808280098009098391089082827f486ba219308f0c847b22fcb4449f8855192536c01b8057904e81c1c7814f483b08839081808280098009098391089082827f34d9604140a1ac9fdb204285b9fe1b303c281af2fc5fb362f6577282b423bcf308839081808280098009098391089082827fc1681959ec4bc3656911db2b2f56aa4db709c26f1a0a25c879286e37f437465d08839081808280098009098391089082827ffcd849f3b5f9e4368af75619fb27f2e335adbb9b44988f17c4d389fa751ad47a08839081808280098009098391089082827ff5f7fc22ad64c8e7c1e005110e13f4f1c6b1f8f8cc59000db0e3bb38f99554a508839081808280098009098391089082827fa9133b8a20fbae4633ec5f82cb47a38ae1877d12d1febb23982c7c808aa5317508839081808280098009098391089082827ff4827c5c7b61141cc31b75984bb3ed16ed579e5b72e32a1289b63ab55eaf8c1208839081808280098009098391089082827fcca361819ffefe3e50fe34c91a322c9405f4e5a168c1fc0a0a1883993e32c9f408839081808280098009098391089082827f6656088842bfc9e325a532784d3362cecfa86f9c7b208a6b499836ebe48ff15708839081808280098009098391089082827f00129c7cd00e42ed05a37dbceb80d47b65e1d750ef2148278a54723fdf42c4cc08839081808280098009098391089082827fa85b235631b786f85cd46f7768f6c71ae004ad267ae59bdf929ada149b19588808839081808280098009098391089082827f34df65a82686be09c5b237911abf237a9887c1a418f279ac79b446d7d311f5ea08839081808280098009098391089082827f815a850c3989df9ca6231e0bdd9916fc0e076f2c6c7f0f260a846d0179f9c32d08839081808280098009098391089082827f50fb0940848a67aee83d348421fadd79aefc7a2adabeec6e64904ebe1bf63e7d08839081808280098009098391089082827fbab63a16273599f8b66895461e62a19ff0d103693be771d93e3691bba89cdd8d08839081808280098009098391089082827f6931a091756e0bc709ebecfffba5038634c5b3d5d0c5876dd72aac67452db8a208839081808280098009098391089082827f55559b8bb79db8809c46ee627f1b5ce1d8e6d89bf94a9987a1407759d1ba896308839081808280098009098391089082827fa9a1a11b2979018cb155914d09f1df19b7ffec241e8b2487b6f6272a56a44a0a08839081808280098009098391089082827ff83293400e7bccea4bb86dcb0d5ca57fa2466e13a572d7d3531c6fa491cb0f1b08839081808280098009098391089082827fb7cb5742b6bc5339624d3568a33c21f31b877f8396972582028da999abf249f208839081808280098009098391089082827ff56efb400f8500b5c5bf811c65c86c7ed2e965f14f1a69bca436c0c60b79f46508839081808280098009098391089082827fd7c4427998d9c440f849dcd75b7157996eaad1b9a1d58cc2441931300e26eb2208839081808280098009098391089082827fca5ed18ad53e33fdc3ae8cf353ff3f6dd315f60060442b74f6b614b24ebd4cc308839081808280098009098391089082827f9ad3e9376c97b194a0fbf43e22a3616981d777365c765ead09a1d033fdf536b708839081808280098009098391089082827fc6daeff5769a06b26fe3b8fef30df07b1387373a7814cef364fe1d6059eaf54a08839081808280098009098391089082827fc20a78398345c6b8cf439643dab96223bf879c302648293eaf496fee5c978c6608839081808280098009098391089082827f589ca65b6cf0e90653c06dddc057dc61ba2839974569051c98b43e8618716efb08839081808280098009098391089082827f83064161f127d8c59fc73625957e21630dc6dc99e5443f6ce37ecd6bf28e69b708839081808280098009098391089082827f46d0ba662b50100b9a3af52052f68932feec1d12290b2033c4f49148893d8ba308839081808280098009098391089082827f18dd55b4a83a53f2ee578eb3e6d26f594824d44670fc3f4de80642344d15c09a08839081808280098009098391089082827f9fb5b594f48bc58b345ab90ded705920a7274b8e070eee8ce8cf90c72c3604b608839081808280098009098391089082827f1901d8f4f2c8449128e00663978f2050f2eb1cd6acb60d9d09c57c5d46ee54fe08839081808280098009098391089082827f5ec56789beab24ef7ee32f594d5fc561ec59dfeb93606dc7dcc6fe65133a7db408839081808280098009098391089082827f01c0b2cbe4fa9877a3d08eb67c510e8630da0a8beda94a6d9283e6f70d268bc508839081808280098009098391089082827f0b1d85acd9031a9107350eed946a25734e974799c5ba7cff13b15a5a623a25f008839081808280098009098391089082827f204497d1d359552905a2fe655f3d6f94926ea92d12cdaa6556ec26362f239f6408839081808280098009098391089082827fe075f7edc6631a8d7ffe33019f44fc91f286236d5a5f90f16de4791b72a2a5f008839081808280098009098391089082827f243f46e353354256ab8fe0ca4e9230dfc330bc163e602dfeaf307c1d1a7264b908839081808280098009098391089082827fd448ae5e09625fa1fcfd732fc9cd8f06e4c33b81f0a9240c83da56f41e9ecceb08839081808280098009098391089082827f2f312eef69a33d9fa753c08840275692a03432b3e6da67f9c59b9f9f4971cd5608839081808280098009098391089082827f5f333996af231bd5a293137da91801e191a6f24eb532ad1a7e6e9a2ad0efbc0008839081808280098009098391089082827fa8f771e0383a832dc8e2eaa8efabda300947acaf0684fabddf8b4abb0abd8a6208839081808280098009098391089082827f9ff0b3d7a4643596f651b70c1963cc4fa6c46018d78f05cb2c5f187e25df83a908839081808280098009098391089082827f9c373b704838325648273734dcdf962d7c156f431f70380ba4855832c4a238b808839081808280098009098391089082827fea2afa02604b8afeeb570f48a0e97a5e6bfe9613394b9a6b0026ecd6cec8c33a08839081808280098009098391089082827f68892258cd8eb43b71caa6d6837ec9959bfdfd72f25c9005ebaffc4011f8a7bf08839081808280098009098391089082827ff2824f561f6f82e3c1232836b0d268fa3b1b5489edd39a5fe1503bfc7ca91f4908839081808280098009098391089082827f164eda75fda2861f9d812f24e37ac938844fbe383c243b32b9f66ae2e76be71908839081808280098009098391089082827ff0a6fc431f5bf0dd1cca93b8b65b3f72c91f0693e2c74be9243b15abb31afcc008839081808280098009098391089082827fe68db66ba891ef0cd527f09ec6fff3ec0a269cf3d891a35ec13c902f70334b4f08839081808280098009098391089082827f3a44a5b102f7883a2b8630a3cae6e6db2e6e483bb7cfeb3492cbd91793ef598e08839081808280098009098391089082827f43939fe8ef789acb33cbf129ba8a3aa1bd61510a178022a05177c9c5a1c59bf108839081808280098009098391089082827f936fe3b66dfda1bc5a7aae241b4db442858bd720c1d579c0c869f273cd55d77408839081808280098009098391089082827f3490fcaa8ffa37f35dc67ae006e81352c7103945417b8e4b142afcaefa344b8508839081808280098009098391089082827fcae66096cff344caca53ffe0e58aafeb468bd174f00d8abc425b2099c088187408839081808280098009098391089082827fc7d05783a41bc14f3c9a45384b6d5e2547c5b6a224c8316910b208f2718a70ab08839081808280098009098391089082827f5ac6b9ba94040d5692b865b6677b60ef3201b5c2121699f70beb9f9b2528a02608839081808280098009098391089082827fa902a3d4d9ecbfb9b2c76fddf780554bf93cad97b244e805d3adb94e1816290008839081808280098009098391089082827fe9df91ffeeb086a4d26041c29dac6fca1d56a4d022fe34b38831267395b98d2708839081808280098009098391089082827f862646f851d91a8840ad9ee711f12ec13b3e8f980ff5ef5ee43ca4520d57def708839081808280098009098391089082827f30b7381c9725b9db07816baf8524943a79cea135807c84cce0833485c11e0c2e08839081808280098009098391089082827f96afc10c5cedaddbda99df79387397c9be74a5b50f3a0c04ccb68d4e0f3a989f08839081808280098009098391089082827f3543da80d10da251c548776fe907c4ef89993d62e0062ae5c0496fcb851c366108839081808280098009098391089082827fe5140fe26d8b008430fccd50a68e3e11c1163d63b6d8b7cc40bc6f3c1d0b1b0608839081808280098009098391089082827ffefdf1872e4475e8bbb0ef6fab7f561bff121314695c433bd4c29ec118060c9608839081808280098009098391089082827f6bb8c9f3d57b18e002df059db1e6a5d42ad566f153f18460774f68ac2650940008839081808280098009098391089082827f5415122d50b26f4fab5784004c56cf03f128f825ad2236f4b3d51f74737bd97308839081808280098009098391089082827f00e115c4a98efae6a3a5ecc873b0cef63ccd5b515710a3ab03ec52218f784dc908839081808280098009098391089082827fda7d525427bad87b88238657c21331245578bc76aa6240b7f972382537a202ab08839081808280098009098391089082827f83332e8b34505b83010270dc795290a2f515b8f89c163acecdf4799df04c62f808839081808280098009098391089082827fb09ecb6033d1a065f17a61066cd737d0c3c5873b51c3ab0a285e26939e62aa1808839081808280098009098391089082827f24e65c718938c2b937378e7435332174329730bde85a4185e37875824eb4985908839081808280098009098391089082827f68e41430ccd41cc5e92a9f9acd2e955c1385b9f5ed8d3f133d767429484a8eba08839081808280098009098391089082827fc038fe9d0125ab8be54545276f841274e414c596ed4c9eaa6919604603d1ffa908839081808280098009098391089082827f23248698612cd8e83234fcf5db9b6b225f4b0ba78d72ef13ea1edff5f0fb029808839081808280098009098391089082827fd2a9fa3d39c1ba91eefa666a1db71c6e0e4e3b707626b0197a4e59e7110cf0d408839081808280098009098391089082827fc28931ee7dfa02b62872e0d937ba3dc5c637118273a1f1f0c4fc880905c82efc08839081808280098009098391089082827f01cd399556445e3d7b201d6c5e56a5794e60be2cfd9a4643e7ead79bb4f60f7908839081808280098009098391089082827fac855cc58d5fbb0dff91a79683eb0e914c1b7d8d0a540d416838a89f83a8312f08839081808280098009098391089082827ff7798af7ccf36b836705849f7dd40328bf9346657255b431446ec75a6817181608839081808280098009098391089082827fe52a24c92d3f067bf551eeaf98c62ba525e84882d7adad835fad8de72986b2b108839081808280098009098391089082827fffc8682759a2bf1dd67c87a77c285467801f1c44fd78fa4eb5957a4832c9d72d08839081808280098009098391089082827f1482ac3e7e4f321627850d95a13942aea6d2923402b913046856ff7e8aaf9aff08839081808280098009098391089082827f17332b4c7aac2a07ccfe954de7ad22ccf6fcb4c5fa15c130ed22a40ae9398f4708839081808280098009098391089082827fd4be0546013f84a0d1e118b37589723b58e323983263616d1b036f8b3fdd858308839081808280098009098391089082827fa64ec737d31dddf939b184438ccdd3e1d3e667572857cd6c9c31a0d1d9b7b08508839081808280098009098391089082827f8ad12fbc74117cff4743d674539c86548c6758710a07a6abe3715e4b53526d3408839081808280098009098391089082827f15a16435a2300b27a337561401f06682ba85019aa0af61b264a1177d38b5c13c08839081808280098009098391089082827f22616f306e76352293a22ab6ee15509d9b108d4136b32fa7f9ed259793f392a108839081808280098009098391089082827f519727b25560caf00ce0d3f911bd4356f907160ab5186da10a629c7ccae1851e08839081808280098009098391089082827fcff39e77928ce9310118d50e29bc87e7f78b53ad51366359aa17f07902ae639208839081808280098009098391089082827f17dead3bfa1968c744118023dead77cdbee22c5b7c2414f5a6bdf82fd94cf3ad08839081808280098009098391089082827f2bef0f8b22a1cfb90100f4a552a9d02b772130123de8144a00c4d57497e1d7f408839081808280098009098391089082827fbf5188713fef90b31c35243f92cfa4331ab076e30e24b355c79b01f41d152a1108839081808280098009098391089082827f3baadd2fd92e3e12fb371be0578941dc0a108fbca0a7d81b88316fb94d6b4dfe08839081808280098009098391089082827fd4f955742e20a28d38611bf9fc4a478c97b673a7cd40d0113a58a1efe338d9aa08839081808280098009098391089082827f3c1c3fe9a5f7ccd54ad5a51a224b3f94775266d19c3733017e4920d7391ad64508839081808280098009098391089082827f6372df6148abeed66fda5461779a9651130c6c525df733852bcd929016768a7a08839081808280098009098391089082827f6d098e848fb853f95adb5a6364b5ab33c79fb08877f2cf3e0e160d9fcb3ebcc508839081808280098009098391089082827f48c5fc90f27431fabfe496dfba14bb0dba71141eb5472a365fd13023f4fe629608839081808280098009098391089082827fbb988dfc0c4dfe53999bd34840adcb63fdbf501ccd622ca2ddf5064ad8cdebf408839081808280098009098391089082827f25b068c942724c424ed5851c9575c22752c9bd25f91ebfa589de3d88ee7627f908839081808280098009098391089082827fed98a1931e361add218de11ff7879bd7114cda19c24ddbe15b3b0190ce01e1aa08839081808280098009098391089082827fc80b5a7d63f6c43542ad612023d3ffd6c684ce2eab837180addcb4decf51854408839081808280098009098391089082827fe2ef24bf47c5203118c6ff96657dd3c6fdff7212d5c798d826455de77b4b70cd08839081808280098009098391089082827f907da812fd5a8375587e4860f87691d0a8d61d454c507d09e5562e1a5d0fcc7608839081808280098009098391089082827fc459abbc62bc6070cacdff597e97990de56edc51cc6643afb0f6789fef1bad6308839081808280098009098391089082827f38d61f5e566855d70d36ef0f0f1fefcd7c829bdd60d95e0ef1fb5b98856280a408839081808280098009098391089082827f13218626665c420d3aa2b0fa49224a3dce8e08b8b56f8851bd9cb5e25cb3042d08839081808280098009098391089082827f6f685fb152dba21b4d02422e237e246df73d7d711ae6d7d33983bae0f873e31008839081808280098009098391089082827f5ade34719e2498dde70e4571c40474475a4af706a3cb82ac18a7fa44c22d1c4708839081808280098009098391089082827f8a0c3dc7a496adca059cb95d9b173812a00f3c4d435e0b9e8116e0c4b5f56acb08839081808280098009098391089082827f196bc98252f63169ed79073ee091a0e8ed0b5af51017da143940c00bdb86370908839081808280098009098391089082827fd979bf70695d93f8efb552a413701918afec9e12dfe213f4d0c27cfa68fad6c208839081808280098009098391089082827fb803072d02f54d237a3c6c4cc18eda6dce87a03c6819df54e4ed8aed6dc56d4608839081808280098009098391089082827f1efcda9d986cddcf431af4d59c6a7709d650885b7886cba70f0e7cd92b331cdc08839081808280098009098391089082827fd3ca5f7859b82ac50b63da06d43aa68a6b685f0a60397638bbea173b3f60419208839081808280098009098391089082827fa59d392c0667316ad37a06be2d51aabe9e79bdef0013bc109985648a14c7e41f08839081808280098009098391089082827fac2f5f0d2146791b396e2bed6cf15a20bc22cc4c8cf7dd4b3514ac00148dd0a708839081808280098009098391089082827f17a993a6af068d72bc36f0e814d29fef3f97d7a72aa963889b16a8457409861a08839081808280098009098391089082827f6f1bf99686550e0396f7f4e2df6fdaa090fbc272c8c76eb32a3c6791de5a07b508839081808280098009098391089082827f8234d705e1ecdc59cc6ed40749069d4b45e63deb49b5b7d7f527abd31c072b1b08839081808280098009098391089082827f6fe929a1fd6aacba5c4012c45dd727d2c816119567450003913d882cb97bc47e08839081808280098009098391089082827fad5371215f2aba49026b2e48739c11b4d8ffbb24dd4a6e41b9763862af96787a08839081808280098009098391089082827fd0e704566c49e1a11edc2c128b2e07f36dc0c755468268f8fe4c4859b9fa595b08839081808280098009098391089082827f263e1195090d00be1d8fb37de17ccf3b66d180645efa0d831865cfaa8797769e08839081808280098009098391089082827fe65c090eebde2cfa7f9c92cf75641c7683fb8e81f4a48f5b7a9c7eb26a85029f08839081808280098009098391089082827fa18971781c6855f6a9752912780bb9b719c14a677a4c6393d62d6e046b97a2ac08839081808280098009098391089082827ff6fc1ef1bca8bec055cc66edecc5dc99030fe78311a3f21d8cd624df4f89e62508839081808280098009098391089082827f824e4e2838501516d3296542cb47a59a1ca4326e947c9c874d88dccc8e37b99a08839081808280098009098391089082827f3cd5a9e7353a50e454c9c1381b556b543897cc89153c3e3749f2021d8237226308839081808280098009098391089082827fb4bcedbd54d0c917a315cc7ca785e3c5995abbeeb3deb3ebaf02c7a9bf6cc83f08839081808280098009098391089082827f1f7476211105b3039cef009c51155ae93526c53a74973ecfce40754b3df1052108839081808280098009098391089082827f58aefbd978440c94b4b9fbd36e00e6e36caeacf82b0da0a6161d34c541a5a6e308839081808280098009098391089082827fc22cd6d61be780a33c77677bc6ba40307b597ed981db57cb485313eec2a5a49708839081808280098009098391089082827fd9ffc4fe0dc5f835c8dcdc1e60b8f0b1637f32a809175371b94a057272b0748d08839081808280098009098391089082827ff6a5268541bc4c64ad0ade8f55dda3492604857a71c923662a214dd7e9c20c1008839081808280098009098391089082826000088390818082800980090983910860205260005260406000f3"; +export declare function deployHasher(signer: Signer): Promise; diff --git a/dist/idb.d.ts b/dist/idb.d.ts new file mode 100644 index 0000000..57662b6 --- /dev/null +++ b/dist/idb.d.ts @@ -0,0 +1,84 @@ +import { OpenDBCallbacks, IDBPDatabase } from 'idb'; +import { NetIdType } from './networkConfig'; +export declare const INDEX_DB_ERROR = "A mutation operation was attempted on a database that did not allow mutations."; +export interface IDBIndex { + name: string; + unique?: boolean; +} +export interface IDBStores { + name: string; + keyPath?: string; + indexes?: IDBIndex[]; +} +export interface IDBConstructor { + dbName: string; + stores?: IDBStores[]; +} +export declare class IndexedDB { + dbExists: boolean; + isBlocked: boolean; + options: OpenDBCallbacks; + dbName: string; + dbVersion: number; + db?: IDBPDatabase; + constructor({ dbName, stores }: IDBConstructor); + initDB(): Promise; + _removeExist(): Promise; + getFromIndex({ storeName, indexName, key, }: { + storeName: string; + indexName: string; + key?: string; + }): Promise; + getAllFromIndex({ storeName, indexName, key, count, }: { + storeName: string; + indexName: string; + key?: string; + count?: number; + }): Promise; + getItem({ storeName, key }: { + storeName: string; + key: string; + }): Promise; + addItem({ storeName, data, key }: { + storeName: string; + data: any; + key: string; + }): Promise; + putItem({ storeName, data, key }: { + storeName: string; + data: any; + key?: string; + }): Promise; + deleteItem({ storeName, key }: { + storeName: string; + key: string; + }): Promise; + getAll({ storeName }: { + storeName: string; + }): Promise; + /** + * Simple key-value store inspired by idb-keyval package + */ + getValue(key: string): Promise; + setValue(key: string, data: any): Promise; + delValue(key: string): Promise; + clearStore({ storeName, mode }: { + storeName: string; + mode: IDBTransactionMode; + }): Promise; + createTransactions({ storeName, data, mode, }: { + storeName: string; + data: any; + mode: IDBTransactionMode; + }): Promise; + createMultipleTransactions({ storeName, data, index, mode, }: { + storeName: string; + data: any[]; + index?: any; + mode?: IDBTransactionMode; + }): Promise; +} +/** + * Should check if DB is initialized well + */ +export declare function getIndexedDB(netId?: NetIdType): Promise; diff --git a/dist/index.d.ts b/dist/index.d.ts index 959e645..41361dc 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,19 +1,26 @@ export * from './events'; -export * from './graphql'; export * from './schemas'; export * from './typechain'; export * from './batch'; export * from './deposits'; export * from './encryptedNotes'; +export * from './ens'; export * from './fees'; +export * from './gaszip'; +export * from './hasher'; +export * from './idb'; +export * from './ip'; export * from './merkleTree'; export * from './mimc'; export * from './multicall'; export * from './networkConfig'; export * from './pedersen'; +export * from './permit'; export * from './prices'; export * from './providers'; export * from './relayerClient'; export * from './tokens'; +export * from './tovarishClient'; export * from './utils'; export * from './websnark'; +export * from './zip'; diff --git a/dist/index.js b/dist/index.js index 5585f37..e829230 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,37 +1,3609 @@ 'use strict'; var ethers = require('ethers'); -var crossFetch = require('cross-fetch'); +var contracts = require('@tornado/contracts'); var crypto$1 = require('crypto'); var BN = require('bn.js'); +var contentHashUtils = require('@ensdomains/content-hash'); +var crossFetch = require('cross-fetch'); var Ajv = require('ajv'); +var fflate = require('fflate'); var circomlibjs = require('circomlibjs'); var ethSigUtil = require('@metamask/eth-sig-util'); +var idb = require('idb'); var worker_threads = require('worker_threads'); var fixedMerkleTree = require('@tornado/fixed-merkle-tree'); var websnarkUtils = require('@tornado/websnark/src/utils'); var websnarkGroth = require('@tornado/websnark/src/groth16'); function _interopNamespaceDefault(e) { - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== 'default') { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d.get ? d : { + enumerable: true, + get: function () { return e[k]; } + }); + } + }); + } + n.default = e; + return Object.freeze(n); +} + +var contentHashUtils__namespace = /*#__PURE__*/_interopNamespaceDefault(contentHashUtils); +var websnarkUtils__namespace = /*#__PURE__*/_interopNamespaceDefault(websnarkUtils); + +BigInt.prototype.toJSON = function() { + return this.toString(); +}; +const isNode = !process.browser && typeof globalThis.window === "undefined"; +const crypto = isNode ? crypto$1.webcrypto : globalThis.crypto; +const chunk = (arr, size) => [...Array(Math.ceil(arr.length / size))].map((_, i) => arr.slice(size * i, size + size * i)); +function sleep(ms) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} +function validateUrl(url, protocols) { + try { + const parsedUrl = new URL(url); + if (protocols && protocols.length) { + return protocols.map((p) => p.toLowerCase()).includes(parsedUrl.protocol); + } + return true; + } catch { + return false; + } +} +function concatBytes(...arrays) { + const totalSize = arrays.reduce((acc, e) => acc + e.length, 0); + const merged = new Uint8Array(totalSize); + arrays.forEach((array, i, arrays2) => { + const offset = arrays2.slice(0, i).reduce((acc, e) => acc + e.length, 0); + merged.set(array, offset); + }); + return merged; +} +function bufferToBytes(b) { + return new Uint8Array(b.buffer); +} +function bytesToBase64(bytes) { + return btoa(bytes.reduce((data, byte) => data + String.fromCharCode(byte), "")); +} +function base64ToBytes(base64) { + return Uint8Array.from(atob(base64), (c) => c.charCodeAt(0)); +} +function bytesToHex(bytes) { + return "0x" + Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join(""); +} +function hexToBytes(hexString) { + if (hexString.slice(0, 2) === "0x") { + hexString = hexString.slice(2); + } + if (hexString.length % 2 !== 0) { + hexString = "0" + hexString; + } + return Uint8Array.from(hexString.match(/.{1,2}/g).map((byte) => parseInt(byte, 16))); +} +function bytesToBN(bytes) { + return BigInt(bytesToHex(bytes)); +} +function bnToBytes(bigint) { + let hexString = typeof bigint === "bigint" ? bigint.toString(16) : bigint; + if (hexString.slice(0, 2) === "0x") { + hexString = hexString.slice(2); + } + if (hexString.length % 2 !== 0) { + hexString = "0" + hexString; + } + return Uint8Array.from(hexString.match(/.{1,2}/g).map((byte) => parseInt(byte, 16))); +} +function leBuff2Int(bytes) { + return new BN(bytes, 16, "le"); +} +function leInt2Buff(bigint) { + return Uint8Array.from(new BN(bigint).toArray("le", 31)); +} +function toFixedHex(numberish, length = 32) { + return "0x" + BigInt(numberish).toString(16).padStart(length * 2, "0"); +} +function toFixedLength(string, length = 32) { + string = string.replace("0x", ""); + return "0x" + string.padStart(length * 2, "0"); +} +function rBigInt(nbytes = 31) { + return bytesToBN(crypto.getRandomValues(new Uint8Array(nbytes))); +} +function rHex(nbytes = 32) { + return bytesToHex(crypto.getRandomValues(new Uint8Array(nbytes))); +} +function bigIntReplacer(key, value) { + return typeof value === "bigint" ? value.toString() : value; +} +function substring(str, length = 10) { + if (str.length < length * 2) { + return str; + } + return `${str.substring(0, length)}...${str.substring(str.length - length)}`; +} +async function digest(bytes, algo = "SHA-384") { + return new Uint8Array(await crypto.subtle.digest(algo, bytes)); +} +function numberFormatter(num, digits = 3) { + const lookup = [ + { value: 1, symbol: "" }, + { value: 1e3, symbol: "K" }, + { value: 1e6, symbol: "M" }, + { value: 1e9, symbol: "G" }, + { value: 1e12, symbol: "T" }, + { value: 1e15, symbol: "P" }, + { value: 1e18, symbol: "E" } + ]; + const regexp = /\.0+$|(?<=\.[0-9]*[1-9])0+$/; + const item = lookup.slice().reverse().find((item2) => Number(num) >= item2.value); + return item ? (Number(num) / item.value).toFixed(digits).replace(regexp, "").concat(item.symbol) : "0"; +} +function isHex(value) { + return /^0x[0-9a-fA-F]*$/.test(value); +} +function toContentHash(ipfsUrl) { + return contentHashUtils__namespace.fromIpfs(ipfsUrl); +} +function fromContentHash(contentHash) { + return contentHashUtils__namespace.decode(contentHash); +} + +function isDeferred(value) { + return value && typeof value === "object" && "getTopicFilter" in value && typeof value.getTopicFilter === "function" && value.fragment; +} +async function getSubInfo(abiInterface, event) { + let topics; + let fragment = null; + if (Array.isArray(event)) { + const topicHashify = function(name) { + if (ethers.isHexString(name, 32)) { + return name; + } + const fragment2 = abiInterface.getEvent(name); + ethers.assertArgument(fragment2, "unknown fragment", "name", name); + return fragment2.topicHash; + }; + topics = event.map((e) => { + if (e == null) { + return null; + } + if (Array.isArray(e)) { + return e.map(topicHashify); + } + return topicHashify(e); + }); + } else if (event === "*") { + topics = [null]; + } else if (typeof event === "string") { + if (ethers.isHexString(event, 32)) { + topics = [event]; + } else { + fragment = abiInterface.getEvent(event); + ethers.assertArgument(fragment, "unknown fragment", "event", event); + topics = [fragment.topicHash]; + } + } else if (isDeferred(event)) { + topics = await event.getTopicFilter(); + } else if ("fragment" in event) { + fragment = event.fragment; + topics = [fragment.topicHash]; + } else { + ethers.assertArgument(false, "unknown event name", "event", event); + } + topics = topics.map((t) => { + if (t == null) { + return null; + } + if (Array.isArray(t)) { + const items = Array.from(new Set(t.map((t2) => t2.toLowerCase())).values()); + if (items.length === 1) { + return items[0]; + } + items.sort(); + return items; + } + return t.toLowerCase(); + }); + const tag = topics.map((t) => { + if (t == null) { + return "null"; + } + if (Array.isArray(t)) { + return t.join("|"); + } + return t; + }).join("&"); + return { fragment, tag, topics }; +} +async function multiQueryFilter(address, contract, event, fromBlock, toBlock) { + if (fromBlock == null) { + fromBlock = 0; + } + if (toBlock == null) { + toBlock = "latest"; + } + const { fragment, topics } = await getSubInfo(contract.interface, event); + const filter = { + address: address === "*" ? void 0 : address, + topics, + fromBlock, + toBlock + }; + const provider = contract.runner; + ethers.assert(provider, "contract runner does not have a provider", "UNSUPPORTED_OPERATION", { operation: "queryFilter" }); + return (await provider.getLogs(filter)).map((log) => { + let foundFragment = fragment; + if (foundFragment == null) { + try { + foundFragment = contract.interface.getEvent(log.topics[0]); + } catch { + } + } + if (foundFragment) { + try { + return new ethers.EventLog(log, contract.interface, foundFragment); + } catch (error) { + return new ethers.UndecodedEventLog(log, error); + } + } + return new ethers.Log(log, provider); + }); +} +class BatchBlockService { + provider; + onProgress; + concurrencySize; + batchSize; + shouldRetry; + retryMax; + retryOn; + constructor({ + provider, + onProgress, + concurrencySize = 10, + batchSize = 10, + shouldRetry = true, + retryMax = 5, + retryOn = 500 + }) { + this.provider = provider; + this.onProgress = onProgress; + this.concurrencySize = concurrencySize; + this.batchSize = batchSize; + this.shouldRetry = shouldRetry; + this.retryMax = retryMax; + this.retryOn = retryOn; + } + async getBlock(blockTag) { + const blockObject = await this.provider.getBlock(blockTag); + if (!blockObject) { + const errMsg = `No block for ${blockTag}`; + throw new Error(errMsg); + } + return blockObject; + } + createBatchRequest(batchArray) { + return batchArray.map(async (blocks, index) => { + await sleep(40 * index); + return (async () => { + let retries = 0; + let err; + while (!this.shouldRetry && retries === 0 || this.shouldRetry && retries < this.retryMax) { + try { + return await Promise.all(blocks.map((b) => this.getBlock(b))); + } catch (e) { + retries++; + err = e; + await sleep(this.retryOn); + } + } + throw err; + })(); + }); + } + async getBatchBlocks(blocks) { + let blockCount = 0; + const results = []; + for (const chunks of chunk(blocks, this.concurrencySize * this.batchSize)) { + const chunksResult = (await Promise.all(this.createBatchRequest(chunk(chunks, this.batchSize)))).flat(); + results.push(...chunksResult); + blockCount += chunks.length; + if (typeof this.onProgress === "function") { + this.onProgress({ + percentage: blockCount / blocks.length, + currentIndex: blockCount, + totalIndex: blocks.length + }); + } + } + return results; + } +} +class BatchTransactionService { + provider; + onProgress; + concurrencySize; + batchSize; + shouldRetry; + retryMax; + retryOn; + constructor({ + provider, + onProgress, + concurrencySize = 10, + batchSize = 10, + shouldRetry = true, + retryMax = 5, + retryOn = 500 + }) { + this.provider = provider; + this.onProgress = onProgress; + this.concurrencySize = concurrencySize; + this.batchSize = batchSize; + this.shouldRetry = shouldRetry; + this.retryMax = retryMax; + this.retryOn = retryOn; + } + async getTransaction(txHash) { + const txObject = await this.provider.getTransaction(txHash); + if (!txObject) { + const errMsg = `No transaction for ${txHash}`; + throw new Error(errMsg); + } + return txObject; + } + async getTransactionReceipt(txHash) { + const txObject = await this.provider.getTransactionReceipt(txHash); + if (!txObject) { + const errMsg = `No transaction receipt for ${txHash}`; + throw new Error(errMsg); + } + return txObject; + } + createBatchRequest(batchArray, receipt) { + return batchArray.map(async (txs, index) => { + await sleep(40 * index); + return (async () => { + let retries = 0; + let err; + while (!this.shouldRetry && retries === 0 || this.shouldRetry && retries < this.retryMax) { + try { + if (!receipt) { + return await Promise.all(txs.map((tx) => this.getTransaction(tx))); + } else { + return await Promise.all(txs.map((tx) => this.getTransactionReceipt(tx))); + } + } catch (e) { + retries++; + err = e; + await sleep(this.retryOn); + } + } + throw err; + })(); + }); + } + async getBatchTransactions(txs) { + let txCount = 0; + const results = []; + for (const chunks of chunk(txs, this.concurrencySize * this.batchSize)) { + const chunksResult = (await Promise.all(this.createBatchRequest(chunk(chunks, this.batchSize)))).flat(); + results.push(...chunksResult); + txCount += chunks.length; + if (typeof this.onProgress === "function") { + this.onProgress({ + percentage: txCount / txs.length, + currentIndex: txCount, + totalIndex: txs.length + }); + } + } + return results; + } + async getBatchReceipt(txs) { + let txCount = 0; + const results = []; + for (const chunks of chunk(txs, this.concurrencySize * this.batchSize)) { + const chunksResult = (await Promise.all(this.createBatchRequest(chunk(chunks, this.batchSize), true))).flat(); + results.push(...chunksResult); + txCount += chunks.length; + if (typeof this.onProgress === "function") { + this.onProgress({ + percentage: txCount / txs.length, + currentIndex: txCount, + totalIndex: txs.length + }); + } + } + return results; + } +} +class BatchEventsService { + provider; + contract; + address; + onProgress; + concurrencySize; + blocksPerRequest; + shouldRetry; + retryMax; + retryOn; + constructor({ + provider, + contract, + address, + onProgress, + concurrencySize = 10, + blocksPerRequest = 5e3, + shouldRetry = true, + retryMax = 5, + retryOn = 500 + }) { + this.provider = provider; + this.contract = contract; + this.address = address; + this.onProgress = onProgress; + this.concurrencySize = concurrencySize; + this.blocksPerRequest = blocksPerRequest; + this.shouldRetry = shouldRetry; + this.retryMax = retryMax; + this.retryOn = retryOn; + } + async getPastEvents({ fromBlock, toBlock, type }) { + let err; + let retries = 0; + while (!this.shouldRetry && retries === 0 || this.shouldRetry && retries < this.retryMax) { + try { + if (this.address) { + return await multiQueryFilter( + this.address, + this.contract, + type, + fromBlock, + toBlock + ); + } + return await this.contract.queryFilter(type, fromBlock, toBlock); + } catch (e) { + err = e; + retries++; + if (e.message.includes("after last accepted block")) { + const acceptedBlock = parseInt(e.message.split("after last accepted block ")[1]); + toBlock = acceptedBlock; + } + await sleep(this.retryOn); + } + } + throw err; + } + createBatchRequest(batchArray) { + return batchArray.map(async (event, index) => { + await sleep(10 * index); + return this.getPastEvents(event); + }); + } + async getBatchEvents({ fromBlock, toBlock, type = "*" }) { + if (!toBlock) { + toBlock = await this.provider.getBlockNumber(); + } + const eventsToSync = []; + for (let i = fromBlock; i < toBlock; i += this.blocksPerRequest) { + const j = i + this.blocksPerRequest - 1 > toBlock ? toBlock : i + this.blocksPerRequest - 1; + eventsToSync.push({ fromBlock: i, toBlock: j, type }); + } + const events = []; + const eventChunk = chunk(eventsToSync, this.concurrencySize); + let chunkCount = 0; + for (const chunk2 of eventChunk) { + chunkCount++; + const fetchedEvents = (await Promise.all(this.createBatchRequest(chunk2))).flat(); + events.push(...fetchedEvents); + if (typeof this.onProgress === "function") { + this.onProgress({ + percentage: chunkCount / eventChunk.length, + type, + fromBlock: chunk2[0].fromBlock, + toBlock: chunk2[chunk2.length - 1].toBlock, + count: fetchedEvents.length + }); + } + } + return events; + } +} + +const defaultUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0"; +function getHttpAgent({ + fetchUrl, + proxyUrl, + torPort, + retry +}) { + const { HttpProxyAgent } = require("http-proxy-agent"); + const { HttpsProxyAgent } = require("https-proxy-agent"); + const { SocksProxyAgent } = require("socks-proxy-agent"); + if (torPort) { + return new SocksProxyAgent(`socks5h://tor${retry}@127.0.0.1:${torPort}`); + } + if (!proxyUrl) { + return; + } + const isHttps = fetchUrl.includes("https://"); + if (proxyUrl.includes("socks://") || proxyUrl.includes("socks4://") || proxyUrl.includes("socks5://")) { + return new SocksProxyAgent(proxyUrl); + } + if (proxyUrl.includes("http://") || proxyUrl.includes("https://")) { + if (isHttps) { + return new HttpsProxyAgent(proxyUrl); + } + return new HttpProxyAgent(proxyUrl); + } +} +async function fetchData(url, options = {}) { + const MAX_RETRY = options.maxRetry ?? 3; + const RETRY_ON = options.retryOn ?? 500; + const userAgent = options.userAgent ?? defaultUserAgent; + const fetch = globalThis.useGlobalFetch ? globalThis.fetch : crossFetch; + let retry = 0; + let errorObject; + if (!options.method) { + if (!options.body) { + options.method = "GET"; + } else { + options.method = "POST"; + } + } + if (!options.headers) { + options.headers = {}; + } + if (isNode && !options.headers["User-Agent"]) { + options.headers["User-Agent"] = userAgent; + } + while (retry < MAX_RETRY + 1) { + let timeout; + if (!options.signal && options.timeout) { + const controller = new AbortController(); + options.signal = controller.signal; + timeout = setTimeout(() => { + controller.abort(); + }, options.timeout); + if (options.cancelSignal) { + if (options.cancelSignal.cancelled) { + throw new Error("request cancelled before sending"); + } + options.cancelSignal.addListener(() => { + controller.abort(); + }); + } + } + if (!options.agent && isNode && (options.proxy || options.torPort)) { + options.agent = getHttpAgent({ + fetchUrl: url, + proxyUrl: options.proxy, + torPort: options.torPort, + retry + }); + } + if (options.debug && typeof options.debug === "function") { + options.debug("request", { + url, + retry, + errorObject, + options + }); + } + try { + const resp = await fetch(url, { + method: options.method, + headers: options.headers, + body: options.body, + redirect: options.redirect, + signal: options.signal, + agent: options.agent + }); + if (options.debug && typeof options.debug === "function") { + options.debug("response", resp); + } + if (!resp.ok) { + const errMsg = `Request to ${url} failed with error code ${resp.status}: +` + await resp.text(); + throw new Error(errMsg); + } + if (options.returnResponse) { + return resp; + } + const contentType = resp.headers.get("content-type"); + if (contentType?.includes("application/json")) { + return await resp.json(); + } + if (contentType?.includes("text")) { + return await resp.text(); + } + return resp; + } catch (error) { + if (timeout) { + clearTimeout(timeout); + } + errorObject = error; + retry++; + await sleep(RETRY_ON); + } finally { + if (timeout) { + clearTimeout(timeout); + } + } + } + if (options.debug && typeof options.debug === "function") { + options.debug("error", errorObject); + } + throw errorObject; +} +const fetchGetUrlFunc = (options = {}) => async (req, _signal) => { + const init = { + ...options, + method: req.method || "POST", + headers: req.headers, + body: req.body || void 0, + timeout: options.timeout || req.timeout, + cancelSignal: _signal, + returnResponse: true + }; + const resp = await fetchData(req.url, init); + const headers = {}; + resp.headers.forEach((value, key) => { + headers[key.toLowerCase()] = value; + }); + const respBody = await resp.arrayBuffer(); + const body = respBody == null ? null : new Uint8Array(respBody); + return { + statusCode: resp.status, + statusMessage: resp.statusText, + headers, + body + }; +}; +async function getProvider(rpcUrl, fetchOptions) { + const fetchReq = new ethers.FetchRequest(rpcUrl); + fetchReq.getUrlFunc = fetchGetUrlFunc(fetchOptions); + const staticNetwork = await new ethers.JsonRpcProvider(fetchReq).getNetwork(); + const chainId = Number(staticNetwork.chainId); + if (fetchOptions?.netId && fetchOptions.netId !== chainId) { + const errMsg = `Wrong network for ${rpcUrl}, wants ${fetchOptions.netId} got ${chainId}`; + throw new Error(errMsg); + } + return new ethers.JsonRpcProvider(fetchReq, staticNetwork, { + staticNetwork, + pollingInterval: fetchOptions?.pollingInterval || 1e3 + }); +} +function getProviderWithNetId(netId, rpcUrl, config, fetchOptions) { + const { networkName, reverseRecordsContract, pollInterval } = config; + const hasEns = Boolean(reverseRecordsContract); + const fetchReq = new ethers.FetchRequest(rpcUrl); + fetchReq.getUrlFunc = fetchGetUrlFunc(fetchOptions); + const staticNetwork = new ethers.Network(networkName, netId); + if (hasEns) { + staticNetwork.attachPlugin(new ethers.EnsPlugin(null, Number(netId))); + } + staticNetwork.attachPlugin(new ethers.GasCostPlugin()); + const provider = new ethers.JsonRpcProvider(fetchReq, staticNetwork, { + staticNetwork, + pollingInterval: fetchOptions?.pollingInterval || pollInterval * 1e3 + }); + return provider; +} +const populateTransaction = async (signer, tx) => { + const provider = signer.provider; + if (!tx.from) { + tx.from = signer.address; + } else if (tx.from !== signer.address) { + const errMsg = `populateTransaction: signer mismatch for tx, wants ${tx.from} have ${signer.address}`; + throw new Error(errMsg); + } + const [feeData, nonce] = await Promise.all([ + tx.maxFeePerGas || tx.gasPrice ? void 0 : provider.getFeeData(), + tx.nonce ? void 0 : provider.getTransactionCount(signer.address, "pending") + ]); + if (feeData) { + if (feeData.maxFeePerGas) { + if (!tx.type) { + tx.type = 2; + } + tx.maxFeePerGas = feeData.maxFeePerGas * (BigInt(1e4) + BigInt(signer.gasPriceBump)) / BigInt(1e4); + tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + delete tx.gasPrice; + } else if (feeData.gasPrice) { + if (!tx.type) { + tx.type = 0; + } + tx.gasPrice = feeData.gasPrice; + delete tx.maxFeePerGas; + delete tx.maxPriorityFeePerGas; + } + } + if (nonce) { + tx.nonce = nonce; + } + if (!tx.gasLimit) { + try { + const gasLimit = await provider.estimateGas(tx); + tx.gasLimit = gasLimit === BigInt(21e3) ? gasLimit : gasLimit * (BigInt(1e4) + BigInt(signer.gasLimitBump)) / BigInt(1e4); + } catch (error) { + if (signer.gasFailover) { + console.log("populateTransaction: warning gas estimation failed falling back to 3M gas"); + tx.gasLimit = BigInt("3000000"); + } else { + throw error; + } + } + } + return tx; +}; +class TornadoWallet extends ethers.Wallet { + nonce; + gasPriceBump; + gasLimitBump; + gasFailover; + bumpNonce; + constructor(key, provider, { gasPriceBump, gasLimitBump, gasFailover, bumpNonce } = {}) { + super(key, provider); + this.gasPriceBump = gasPriceBump ?? 0; + this.gasLimitBump = gasLimitBump ?? 3e3; + this.gasFailover = gasFailover ?? false; + this.bumpNonce = bumpNonce ?? false; + } + static fromMnemonic(mneomnic, provider, index = 0, options) { + const defaultPath = `m/44'/60'/0'/0/${index}`; + const { privateKey } = ethers.HDNodeWallet.fromPhrase(mneomnic, void 0, defaultPath); + return new TornadoWallet(privateKey, provider, options); + } + async populateTransaction(tx) { + const txObject = await populateTransaction(this, tx); + this.nonce = Number(txObject.nonce); + return super.populateTransaction(txObject); + } +} +class TornadoVoidSigner extends ethers.VoidSigner { + nonce; + gasPriceBump; + gasLimitBump; + gasFailover; + bumpNonce; + constructor(address, provider, { gasPriceBump, gasLimitBump, gasFailover, bumpNonce } = {}) { + super(address, provider); + this.gasPriceBump = gasPriceBump ?? 0; + this.gasLimitBump = gasLimitBump ?? 3e3; + this.gasFailover = gasFailover ?? false; + this.bumpNonce = bumpNonce ?? false; + } + async populateTransaction(tx) { + const txObject = await populateTransaction(this, tx); + this.nonce = Number(txObject.nonce); + return super.populateTransaction(txObject); + } +} +class TornadoRpcSigner extends ethers.JsonRpcSigner { + nonce; + gasPriceBump; + gasLimitBump; + gasFailover; + bumpNonce; + constructor(provider, address, { gasPriceBump, gasLimitBump, gasFailover, bumpNonce } = {}) { + super(provider, address); + this.gasPriceBump = gasPriceBump ?? 0; + this.gasLimitBump = gasLimitBump ?? 3e3; + this.gasFailover = gasFailover ?? false; + this.bumpNonce = bumpNonce ?? false; + } + async sendUncheckedTransaction(tx) { + return super.sendUncheckedTransaction(await populateTransaction(this, tx)); + } +} +class TornadoBrowserProvider extends ethers.BrowserProvider { + options; + constructor(ethereum, network, options) { + super(ethereum, network); + this.options = options; + } + async getSigner(address) { + const signerAddress = (await super.getSigner(address)).address; + if (this.options?.netId && this.options?.connectWallet && Number(await super.send("net_version", [])) !== this.options?.netId) { + await this.options.connectWallet(this.options?.netId); + } + if (this.options?.handleNetworkChanges) { + window?.ethereum?.on("chainChanged", this.options.handleNetworkChanges); + } + if (this.options?.handleAccountChanges) { + window?.ethereum?.on("accountsChanged", this.options.handleAccountChanges); + } + if (this.options?.handleAccountDisconnect) { + window?.ethereum?.on("disconnect", this.options.handleAccountDisconnect); + } + return new TornadoRpcSigner(this, signerAddress, this.options); + } +} + +var NetId = /* @__PURE__ */ ((NetId2) => { + NetId2[NetId2["MAINNET"] = 1] = "MAINNET"; + NetId2[NetId2["BSC"] = 56] = "BSC"; + NetId2[NetId2["POLYGON"] = 137] = "POLYGON"; + NetId2[NetId2["OPTIMISM"] = 10] = "OPTIMISM"; + NetId2[NetId2["ARBITRUM"] = 42161] = "ARBITRUM"; + NetId2[NetId2["GNOSIS"] = 100] = "GNOSIS"; + NetId2[NetId2["AVALANCHE"] = 43114] = "AVALANCHE"; + NetId2[NetId2["SEPOLIA"] = 11155111] = "SEPOLIA"; + return NetId2; +})(NetId || {}); +const defaultConfig = { + [1 /* MAINNET */]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 80, + fast: 50, + standard: 25, + low: 8 + }, + nativeCurrency: "eth", + currencyName: "ETH", + explorerUrl: "https://etherscan.io", + merkleTreeHeight: 20, + emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", + networkName: "Ethereum Mainnet", + deployedBlock: 9116966, + rpcUrls: { + mevblockerRPC: { + name: "MEV Blocker", + url: "https://rpc.mevblocker.io" + }, + keydonix: { + name: "Horswap ( Keydonix )", + url: "https://ethereum.keydonix.com/v1/mainnet" + }, + SecureRpc: { + name: "SecureRpc", + url: "https://api.securerpc.com/v1" + }, + stackup: { + name: "Stackup", + url: "https://public.stackup.sh/api/v1/node/ethereum-mainnet" + }, + oneRpc: { + name: "1RPC", + url: "https://1rpc.io/eth" + } + }, + stablecoin: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", + routerContract: "0xd90e2f925DA726b50C4Ed8D0Fb90Ad053324F31b", + echoContract: "0x9B27DD5Bb15d42DC224FCD0B7caEbBe16161Df42", + offchainOracleContract: "0x00000000000D6FFc74A8feb35aF5827bf57f6786", + tornContract: "0x77777FeDdddFfC19Ff86DB637967013e6C6A116C", + governanceContract: "0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce", + stakingRewardsContract: "0x5B3f656C80E8ddb9ec01Dd9018815576E9238c29", + registryContract: "0x58E8dCC13BE9780fC42E8723D8EaD4CF46943dF2", + aggregatorContract: "0xE8F47A78A6D52D317D0D2FFFac56739fE14D1b49", + reverseRecordsContract: "0x3671aE578E63FdF66ad4F3E12CC0c0d71Ac7510C", + tornadoSubgraph: "tornadocash/mainnet-tornado-subgraph", + registrySubgraph: "tornadocash/tornado-relayer-registry", + governanceSubgraph: "tornadocash/tornado-governance", + subgraphs: {}, + tokens: { + eth: { + instanceAddress: { + "0.1": "0x12D66f87A04A9E220743712cE6d9bB1B5616B8Fc", + "1": "0x47CE0C6eD5B0Ce3d3A51fdb1C52DC66a7c3c2936", + "10": "0x910Cbd523D972eb0a6f4cAe4618aD62622b39DbF", + "100": "0xA160cdAB225685dA1d56aa342Ad8841c3b53f291" + }, + symbol: "ETH", + decimals: 18 + }, + dai: { + instanceAddress: { + "100": "0xD4B88Df4D29F5CedD6857912842cff3b20C8Cfa3", + "1000": "0xFD8610d20aA15b7B2E3Be39B396a1bC3516c7144", + "10000": "0x07687e702b410Fa43f4cB4Af7FA097918ffD2730", + "100000": "0x23773E65ed146A459791799d01336DB287f25334" + }, + tokenAddress: "0x6B175474E89094C44Da98b954EedeAC495271d0F", + tokenGasLimit: 7e4, + symbol: "DAI", + decimals: 18, + gasLimit: 7e5 + }, + cdai: { + instanceAddress: { + "5000": "0x22aaA7720ddd5388A3c0A3333430953C68f1849b", + "50000": "0x03893a7c7463AE47D46bc7f091665f1893656003", + "500000": "0x2717c5e28cf931547B621a5dddb772Ab6A35B701", + "5000000": "0xD21be7248e0197Ee08E0c20D4a96DEBdaC3D20Af" + }, + tokenAddress: "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643", + tokenGasLimit: 2e5, + symbol: "cDAI", + decimals: 8, + gasLimit: 7e5 + }, + usdc: { + instanceAddress: { + "100": "0xd96f2B1c14Db8458374d9Aca76E26c3D18364307", + "1000": "0x4736dCf1b7A3d580672CcE6E7c65cd5cc9cFBa9D" + }, + tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + tokenGasLimit: 7e4, + symbol: "USDC", + decimals: 6, + gasLimit: 7e5 + }, + usdt: { + instanceAddress: { + "100": "0x169AD27A470D064DEDE56a2D3ff727986b15D52B", + "1000": "0x0836222F2B2B24A3F36f98668Ed8F0B38D1a872f" + }, + tokenAddress: "0xdAC17F958D2ee523a2206206994597C13D831ec7", + tokenGasLimit: 7e4, + symbol: "USDT", + decimals: 6, + gasLimit: 7e5 + }, + wbtc: { + instanceAddress: { + "0.1": "0x178169B423a011fff22B9e3F3abeA13414dDD0F1", + "1": "0x610B717796ad172B316836AC95a2ffad065CeaB4", + "10": "0xbB93e510BbCD0B7beb5A853875f9eC60275CF498" + }, + tokenAddress: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + tokenGasLimit: 7e4, + symbol: "WBTC", + decimals: 8, + gasLimit: 7e5 + } + }, + // Inactive tokens to filter from schema verification and syncing events + disabledTokens: ["cdai", "usdt", "usdc"], + relayerEnsSubdomain: "mainnet-tornado", + pollInterval: 15, + constants: { + GOVERNANCE_BLOCK: 11474695, + NOTE_ACCOUNT_BLOCK: 11842486, + ENCRYPTED_NOTES_BLOCK: 12143762, + REGISTRY_BLOCK: 14173129, + MINING_BLOCK_TIME: 15 + } + }, + [56 /* BSC */]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 5, + fast: 5, + standard: 5, + low: 5 + }, + nativeCurrency: "bnb", + currencyName: "BNB", + explorerUrl: "https://bscscan.com", + merkleTreeHeight: 20, + emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", + networkName: "Binance Smart Chain", + deployedBlock: 8158799, + stablecoin: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", + multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", + routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", + echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", + offchainOracleContract: "0x00000000000D6FFc74A8feb35aF5827bf57f6786", + tornadoSubgraph: "tornadocash/bsc-tornado-subgraph", + subgraphs: {}, + rpcUrls: { + bnbchain: { + name: "BNB Chain", + url: "https://bsc-dataseed.bnbchain.org" + }, + ninicoin: { + name: "BNB Chain 2", + url: "https://bsc-dataseed1.ninicoin.io" + }, + nodereal: { + name: "NodeReal", + url: "https://binance.nodereal.io" + }, + stackup: { + name: "Stackup", + url: "https://public.stackup.sh/api/v1/node/bsc-mainnet" + }, + oneRpc: { + name: "1RPC", + url: "https://1rpc.io/bnb" + } + }, + tokens: { + bnb: { + instanceAddress: { + "0.1": "0x84443CFd09A48AF6eF360C6976C5392aC5023a1F", + "1": "0xd47438C816c9E7f2E2888E060936a499Af9582b3", + "10": "0x330bdFADE01eE9bF63C209Ee33102DD334618e0a", + "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD" + }, + symbol: "BNB", + decimals: 18 + } + }, + relayerEnsSubdomain: "bsc-tornado", + pollInterval: 10, + constants: { + NOTE_ACCOUNT_BLOCK: 8159269, + ENCRYPTED_NOTES_BLOCK: 8159269 + } + }, + [137 /* POLYGON */]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 100, + fast: 75, + standard: 50, + low: 30 + }, + nativeCurrency: "matic", + currencyName: "MATIC", + explorerUrl: "https://polygonscan.com", + merkleTreeHeight: 20, + emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", + networkName: "Polygon (Matic) Network", + deployedBlock: 16257962, + stablecoin: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", + multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", + routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", + echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", + offchainOracleContract: "0x00000000000D6FFc74A8feb35aF5827bf57f6786", + tornadoSubgraph: "tornadocash/matic-tornado-subgraph", + subgraphs: {}, + rpcUrls: { + oneRpc: { + name: "1RPC", + url: "https://1rpc.io/matic" + }, + stackup: { + name: "Stackup", + url: "https://public.stackup.sh/api/v1/node/polygon-mainnet" + } + }, + tokens: { + matic: { + instanceAddress: { + "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD", + "1000": "0xdf231d99Ff8b6c6CBF4E9B9a945CBAcEF9339178", + "10000": "0xaf4c0B70B2Ea9FB7487C7CbB37aDa259579fe040", + "100000": "0xa5C2254e4253490C54cef0a4347fddb8f75A4998" + }, + symbol: "MATIC", + decimals: 18 + } + }, + relayerEnsSubdomain: "polygon-tornado", + pollInterval: 10, + constants: { + NOTE_ACCOUNT_BLOCK: 16257996, + ENCRYPTED_NOTES_BLOCK: 16257996 + } + }, + [10 /* OPTIMISM */]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 1e-3, + fast: 1e-3, + standard: 1e-3, + low: 1e-3 + }, + nativeCurrency: "eth", + currencyName: "ETH", + explorerUrl: "https://optimistic.etherscan.io", + merkleTreeHeight: 20, + emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", + networkName: "Optimism", + deployedBlock: 2243689, + stablecoin: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85", + multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", + routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", + echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", + offchainOracleContract: "0x00000000000D6FFc74A8feb35aF5827bf57f6786", + ovmGasPriceOracleContract: "0x420000000000000000000000000000000000000F", + tornadoSubgraph: "tornadocash/optimism-tornado-subgraph", + subgraphs: {}, + rpcUrls: { + oneRpc: { + name: "1RPC", + url: "https://1rpc.io/op" + }, + stackup: { + name: "Stackup", + url: "https://public.stackup.sh/api/v1/node/optimism-mainnet" + } + }, + tokens: { + eth: { + instanceAddress: { + "0.1": "0x84443CFd09A48AF6eF360C6976C5392aC5023a1F", + "1": "0xd47438C816c9E7f2E2888E060936a499Af9582b3", + "10": "0x330bdFADE01eE9bF63C209Ee33102DD334618e0a", + "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD" + }, + symbol: "ETH", + decimals: 18 + } + }, + relayerEnsSubdomain: "optimism-tornado", + pollInterval: 15, + constants: { + NOTE_ACCOUNT_BLOCK: 2243694, + ENCRYPTED_NOTES_BLOCK: 2243694 + } + }, + [42161 /* ARBITRUM */]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 4, + fast: 3, + standard: 2.52, + low: 2.29 + }, + nativeCurrency: "eth", + currencyName: "ETH", + explorerUrl: "https://arbiscan.io", + merkleTreeHeight: 20, + emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", + networkName: "Arbitrum One", + deployedBlock: 3430648, + stablecoin: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", + multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", + routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", + echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", + offchainOracleContract: "0x00000000000D6FFc74A8feb35aF5827bf57f6786", + tornadoSubgraph: "tornadocash/arbitrum-tornado-subgraph", + subgraphs: {}, + rpcUrls: { + Arbitrum: { + name: "Arbitrum", + url: "https://arb1.arbitrum.io/rpc" + }, + stackup: { + name: "Stackup", + url: "https://public.stackup.sh/api/v1/node/arbitrum-one" + }, + oneRpc: { + name: "1RPC", + url: "https://1rpc.io/arb" + } + }, + tokens: { + eth: { + instanceAddress: { + "0.1": "0x84443CFd09A48AF6eF360C6976C5392aC5023a1F", + "1": "0xd47438C816c9E7f2E2888E060936a499Af9582b3", + "10": "0x330bdFADE01eE9bF63C209Ee33102DD334618e0a", + "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD" + }, + symbol: "ETH", + decimals: 18 + } + }, + relayerEnsSubdomain: "arbitrum-tornado", + pollInterval: 15, + constants: { + NOTE_ACCOUNT_BLOCK: 3430605, + ENCRYPTED_NOTES_BLOCK: 3430605 + } + }, + [100 /* GNOSIS */]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 6, + fast: 5, + standard: 4, + low: 1 + }, + nativeCurrency: "xdai", + currencyName: "xDAI", + explorerUrl: "https://gnosisscan.io", + merkleTreeHeight: 20, + emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", + networkName: "Gnosis Chain", + deployedBlock: 17754561, + stablecoin: "0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83", + multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", + routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", + echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", + offchainOracleContract: "0x00000000000D6FFc74A8feb35aF5827bf57f6786", + tornadoSubgraph: "tornadocash/xdai-tornado-subgraph", + subgraphs: {}, + rpcUrls: { + gnosis: { + name: "Gnosis", + url: "https://rpc.gnosischain.com" + }, + oneRpc: { + name: "1RPC", + url: "https://1rpc.io/gnosis" + } + }, + tokens: { + xdai: { + instanceAddress: { + "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD", + "1000": "0xdf231d99Ff8b6c6CBF4E9B9a945CBAcEF9339178", + "10000": "0xaf4c0B70B2Ea9FB7487C7CbB37aDa259579fe040", + "100000": "0xa5C2254e4253490C54cef0a4347fddb8f75A4998" + }, + symbol: "xDAI", + decimals: 18 + } + }, + relayerEnsSubdomain: "gnosis-tornado", + pollInterval: 15, + constants: { + NOTE_ACCOUNT_BLOCK: 17754564, + ENCRYPTED_NOTES_BLOCK: 17754564 + } + }, + [43114 /* AVALANCHE */]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 225, + fast: 35, + standard: 25, + low: 25 + }, + nativeCurrency: "avax", + currencyName: "AVAX", + explorerUrl: "https://snowtrace.io", + merkleTreeHeight: 20, + emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", + networkName: "Avalanche Mainnet", + deployedBlock: 4429818, + stablecoin: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", + multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", + routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", + echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", + offchainOracleContract: "0x00000000000D6FFc74A8feb35aF5827bf57f6786", + tornadoSubgraph: "tornadocash/avalanche-tornado-subgraph", + subgraphs: {}, + rpcUrls: { + oneRpc: { + name: "1RPC", + url: "https://1rpc.io/avax/c" + }, + stackup: { + name: "Stackup", + url: "https://public.stackup.sh/api/v1/node/avalanche-mainnet" + } + }, + tokens: { + avax: { + instanceAddress: { + "10": "0x330bdFADE01eE9bF63C209Ee33102DD334618e0a", + "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD", + "500": "0xaf8d1839c3c67cf571aa74B5c12398d4901147B3" + }, + symbol: "AVAX", + decimals: 18 + } + }, + relayerEnsSubdomain: "avalanche-tornado", + pollInterval: 10, + constants: { + NOTE_ACCOUNT_BLOCK: 4429813, + ENCRYPTED_NOTES_BLOCK: 4429813 + } + }, + [11155111 /* SEPOLIA */]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 2, + fast: 2, + standard: 2, + low: 2 + }, + nativeCurrency: "eth", + currencyName: "SepoliaETH", + explorerUrl: "https://sepolia.etherscan.io", + merkleTreeHeight: 20, + emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", + networkName: "Ethereum Sepolia", + deployedBlock: 5594395, + stablecoin: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238", + multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", + routerContract: "0x1572AFE6949fdF51Cb3E0856216670ae9Ee160Ee", + echoContract: "0xcDD1fc3F5ac2782D83449d3AbE80D6b7B273B0e5", + offchainOracleContract: "0x1f89EAF03E5b260Bc6D4Ae3c3334b1B750F3e127", + tornContract: "0x3AE6667167C0f44394106E197904519D808323cA", + governanceContract: "0xe5324cD7602eeb387418e594B87aCADee08aeCAD", + stakingRewardsContract: "0x6d0018890751Efd31feb8166711B16732E2b496b", + registryContract: "0x1428e5d2356b13778A13108b10c440C83011dfB8", + aggregatorContract: "0x4088712AC9fad39ea133cdb9130E465d235e9642", + reverseRecordsContract: "0xEc29700C0283e5Be64AcdFe8077d6cC95dE23C23", + tornadoSubgraph: "tornadocash/sepolia-tornado-subgraph", + subgraphs: {}, + rpcUrls: { + sepolia: { + name: "Sepolia RPC", + url: "https://rpc.sepolia.org" + }, + stackup: { + name: "Stackup", + url: "https://public.stackup.sh/api/v1/node/ethereum-sepolia" + }, + oneRpc: { + name: "1RPC", + url: "https://1rpc.io/sepolia" + }, + ethpandaops: { + name: "ethpandaops", + url: "https://rpc.sepolia.ethpandaops.io" + } + }, + tokens: { + eth: { + instanceAddress: { + "0.1": "0x8C4A04d872a6C1BE37964A21ba3a138525dFF50b", + "1": "0x8cc930096B4Df705A007c4A039BDFA1320Ed2508", + "10": "0x8D10d506D29Fc62ABb8A290B99F66dB27Fc43585", + "100": "0x44c5C92ed73dB43888210264f0C8b36Fd68D8379" + }, + symbol: "ETH", + decimals: 18 + }, + dai: { + instanceAddress: { + "100": "0x6921fd1a97441dd603a997ED6DDF388658daf754", + "1000": "0x50a637770F5d161999420F7d70d888DE47207145", + "10000": "0xecD649870407cD43923A816Cc6334a5bdf113621", + "100000": "0x73B4BD04bF83206B6e979BE2507098F92EDf4F90" + }, + tokenAddress: "0xFF34B3d4Aee8ddCd6F9AFFFB6Fe49bD371b8a357", + tokenGasLimit: 7e4, + symbol: "DAI", + decimals: 18, + gasLimit: 7e5 + } + }, + relayerEnsSubdomain: "sepolia-tornado", + pollInterval: 15, + constants: { + GOVERNANCE_BLOCK: 5594395, + NOTE_ACCOUNT_BLOCK: 5594395, + ENCRYPTED_NOTES_BLOCK: 5594395, + REGISTRY_BLOCK: 5594395, + MINING_BLOCK_TIME: 15 + } + } +}; +const enabledChains = Object.values(NetId).filter((n) => typeof n === "number"); +exports.customConfig = {}; +function addNetwork(newConfig) { + enabledChains.push( + ...Object.keys(newConfig).map((netId) => Number(netId)).filter((netId) => !enabledChains.includes(netId)) + ); + exports.customConfig = { + ...exports.customConfig, + ...newConfig + }; +} +function getNetworkConfig() { + const allConfig = { + ...defaultConfig, + ...exports.customConfig + }; + return enabledChains.reduce((acc, curr) => { + acc[curr] = allConfig[curr]; + return acc; + }, {}); +} +function getConfig(netId) { + const allConfig = getNetworkConfig(); + const chainConfig = allConfig[netId]; + if (!chainConfig) { + const errMsg = `No config found for network ${netId}!`; + throw new Error(errMsg); + } + return chainConfig; +} +function getActiveTokens(config) { + const { tokens, disabledTokens } = config; + return Object.keys(tokens).filter((t) => !disabledTokens?.includes(t)); +} +function getActiveTokenInstances(config) { + const { tokens, disabledTokens } = config; + return Object.entries(tokens).reduce((acc, [token, instances]) => { + if (!disabledTokens?.includes(token)) { + acc[token] = instances; + } + return acc; + }, {}); +} +function getInstanceByAddress(config, address) { + const { tokens, disabledTokens } = config; + for (const [currency, { instanceAddress, tokenAddress, symbol, decimals }] of Object.entries(tokens)) { + if (disabledTokens?.includes(currency)) { + continue; + } + for (const [amount, instance] of Object.entries(instanceAddress)) { + if (instance === address) { + return { + amount, + currency, + symbol, + decimals, + tokenAddress + }; + } + } + } +} +function getRelayerEnsSubdomains() { + const allConfig = getNetworkConfig(); + return enabledChains.reduce((acc, chain) => { + acc[chain] = allConfig[chain].relayerEnsSubdomain; + return acc; + }, {}); +} +function getMultiInstances(netId, config) { + return Object.entries(config.tokens).reduce( + (acc, [currency, { instanceAddress }]) => { + Object.entries(instanceAddress).forEach(([amount, contractAddress]) => { + acc[contractAddress] = { + currency, + amount, + netId + }; + }); + return acc; + }, + {} + ); +} + +const ajv = new Ajv({ allErrors: true }); +ajv.addKeyword({ + keyword: "BN", + // eslint-disable-next-line @typescript-eslint/no-explicit-any + validate: (schema, data) => { + try { + BigInt(data); + return true; + } catch { + return false; + } + }, + errors: true +}); +ajv.addKeyword({ + keyword: "isAddress", + // eslint-disable-next-line @typescript-eslint/no-explicit-any + validate: (schema, data) => { + try { + return ethers.isAddress(data); + } catch { + return false; + } + }, + errors: true +}); + +const addressSchemaType = { + type: "string", + pattern: "^0x[a-fA-F0-9]{40}$", + isAddress: true +}; +const bnSchemaType = { type: "string", BN: true }; +const proofSchemaType = { + type: "string", + pattern: "^0x[a-fA-F0-9]{512}$" +}; +const bytes32SchemaType = { + type: "string", + pattern: "^0x[a-fA-F0-9]{64}$" +}; +const bytes32BNSchemaType = { ...bytes32SchemaType, BN: true }; + +const baseEventsSchemaProperty = { + blockNumber: { + type: "number" + }, + logIndex: { + type: "number" + }, + transactionHash: bytes32SchemaType +}; +const baseEventsSchemaRequired = Object.keys(baseEventsSchemaProperty); +const governanceEventsSchema = { + type: "array", + items: { + anyOf: [ + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + id: { type: "number" }, + proposer: addressSchemaType, + target: addressSchemaType, + startTime: { type: "number" }, + endTime: { type: "number" }, + description: { type: "string" } + }, + required: [ + ...baseEventsSchemaRequired, + "event", + "id", + "proposer", + "target", + "startTime", + "endTime", + "description" + ], + additionalProperties: false + }, + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + proposalId: { type: "number" }, + voter: addressSchemaType, + support: { type: "boolean" }, + votes: { type: "string" }, + from: addressSchemaType, + input: { type: "string" } + }, + required: [ + ...baseEventsSchemaRequired, + "event", + "proposalId", + "voter", + "support", + "votes", + "from", + "input" + ], + additionalProperties: false + }, + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + account: addressSchemaType, + delegateTo: addressSchemaType + }, + required: [...baseEventsSchemaRequired, "account", "delegateTo"], + additionalProperties: false + }, + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + account: addressSchemaType, + delegateFrom: addressSchemaType + }, + required: [...baseEventsSchemaRequired, "account", "delegateFrom"], + additionalProperties: false + } + ] + } +}; +const relayerRegistryEventsSchema = { + type: "array", + items: { + anyOf: [ + // RelayerRegisteredEvents + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + ensName: { type: "string" }, + relayerAddress: addressSchemaType, + ensHash: { type: "string" }, + stakedAmount: { type: "string" } + }, + required: [ + ...baseEventsSchemaRequired, + "event", + "ensName", + "relayerAddress", + "ensHash", + "stakedAmount" + ], + additionalProperties: false + }, + // RelayerUnregisteredEvents + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + relayerAddress: addressSchemaType + }, + required: [...baseEventsSchemaRequired, "event", "relayerAddress"], + additionalProperties: false + }, + // WorkerRegisteredEvents & WorkerUnregisteredEvents + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + relayerAddress: addressSchemaType, + workerAddress: addressSchemaType + }, + required: [...baseEventsSchemaRequired, "event", "relayerAddress", "workerAddress"], + additionalProperties: false + } + ] + } +}; +const stakeBurnedEventsSchema = { + type: "array", + items: { + type: "object", + properties: { + ...baseEventsSchemaProperty, + relayerAddress: addressSchemaType, + amountBurned: bnSchemaType, + instanceAddress: addressSchemaType, + gasFee: bnSchemaType, + relayerFee: bnSchemaType, + timestamp: { type: "number" } + }, + required: [ + ...baseEventsSchemaRequired, + "relayerAddress", + "amountBurned", + "instanceAddress", + "gasFee", + "relayerFee", + "timestamp" + ], + additionalProperties: false + } +}; +const depositsEventsSchema = { + type: "array", + items: { + type: "object", + properties: { + ...baseEventsSchemaProperty, + commitment: bytes32SchemaType, + leafIndex: { type: "number" }, + timestamp: { type: "number" }, + from: addressSchemaType + }, + required: [...baseEventsSchemaRequired, "commitment", "leafIndex", "timestamp", "from"], + additionalProperties: false + } +}; +const withdrawalsEventsSchema = { + type: "array", + items: { + type: "object", + properties: { + ...baseEventsSchemaProperty, + nullifierHash: bytes32SchemaType, + to: addressSchemaType, + fee: bnSchemaType, + timestamp: { type: "number" } + }, + required: [...baseEventsSchemaRequired, "nullifierHash", "to", "fee", "timestamp"], + additionalProperties: false + } +}; +const tornadoEventsSchema = { + type: "array", + items: { + anyOf: [ + // depositsEvents + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + instanceAddress: { type: "string" }, + commitment: bytes32SchemaType, + leafIndex: { type: "number" }, + timestamp: { type: "number" }, + from: addressSchemaType + }, + required: [ + ...baseEventsSchemaRequired, + "event", + "instanceAddress", + "commitment", + "leafIndex", + "timestamp", + "from" + ], + additionalProperties: false + }, + // withdrawalEvents + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + instanceAddress: { type: "string" }, + nullifierHash: bytes32SchemaType, + to: addressSchemaType, + relayerAddress: addressSchemaType, + fee: bnSchemaType, + timestamp: { type: "number" } + }, + required: [ + ...baseEventsSchemaRequired, + "event", + "instanceAddress", + "nullifierHash", + "to", + "relayerAddress", + "fee", + "timestamp" + ], + additionalProperties: false + } + ] + } +}; +const echoEventsSchema = { + type: "array", + items: { + type: "object", + properties: { + ...baseEventsSchemaProperty, + address: addressSchemaType, + encryptedAccount: { type: "string" } + }, + required: [...baseEventsSchemaRequired, "address", "encryptedAccount"], + additionalProperties: false + } +}; +const encryptedNotesSchema = { + type: "array", + items: { + type: "object", + properties: { + ...baseEventsSchemaProperty, + encryptedNote: { type: "string" } + }, + required: [...baseEventsSchemaRequired, "encryptedNote"], + additionalProperties: false + } +}; +function getEventsSchemaValidator(type) { + if (type === "tornado") { + return ajv.compile(tornadoEventsSchema); + } + if (type === "deposit") { + return ajv.compile(depositsEventsSchema); + } + if (type === "withdrawal") { + return ajv.compile(withdrawalsEventsSchema); + } + if (type === "governance") { + return ajv.compile(governanceEventsSchema); + } + if (type === "registry") { + return ajv.compile(relayerRegistryEventsSchema); + } + if (type === "revenue") { + return ajv.compile(stakeBurnedEventsSchema); + } + if (type === "echo") { + return ajv.compile(echoEventsSchema); + } + if (type === "encrypted_notes") { + return ajv.compile(encryptedNotesSchema); + } + throw new Error("Unsupported event type for schema validation"); +} + +const statusSchema = { + type: "object", + properties: { + rewardAccount: addressSchemaType, + gasPrices: { + type: "object", + properties: { + fast: { type: "number" }, + additionalProperties: { type: "number" } + }, + required: ["fast"] + }, + netId: { type: "integer" }, + tornadoServiceFee: { type: "number", maximum: 20, minimum: 0 }, + latestBlock: { type: "number" }, + latestBalance: bnSchemaType, + version: { type: "string" }, + health: { + type: "object", + properties: { + status: { const: "true" }, + error: { type: "string" } + }, + required: ["status"] + }, + syncStatus: { + type: "object", + properties: { + events: { type: "boolean" }, + tokenPrice: { type: "boolean" }, + gasPrice: { type: "boolean" } + }, + required: ["events", "tokenPrice", "gasPrice"] + }, + onSyncEvents: { type: "boolean" }, + currentQueue: { type: "number" } + }, + required: ["rewardAccount", "instances", "netId", "tornadoServiceFee", "version", "health", "currentQueue"] +}; +function getStatusSchema(netId, config, tovarish) { + const { tokens, optionalTokens, disabledTokens, nativeCurrency } = config; + const schema = JSON.parse(JSON.stringify(statusSchema)); + const instances = Object.keys(tokens).reduce( + (acc, token) => { + const { instanceAddress, tokenAddress, symbol, decimals, optionalInstances = [] } = tokens[token]; + const amounts = Object.keys(instanceAddress); + const instanceProperties = { + type: "object", + properties: { + instanceAddress: { + type: "object", + properties: amounts.reduce( + (acc2, cur) => { + acc2[cur] = addressSchemaType; + return acc2; + }, + {} + ), + required: amounts.filter((amount) => !optionalInstances.includes(amount)) + }, + decimals: { enum: [decimals] } + }, + required: ["instanceAddress", "decimals"].concat( + tokenAddress ? ["tokenAddress"] : [], + symbol ? ["symbol"] : [] + ) + }; + if (tokenAddress) { + instanceProperties.properties.tokenAddress = addressSchemaType; + } + if (symbol) { + instanceProperties.properties.symbol = { enum: [symbol] }; + } + acc.properties[token] = instanceProperties; + if (!optionalTokens?.includes(token) && !disabledTokens?.includes(token)) { + acc.required.push(token); + } + return acc; + }, + { + type: "object", + properties: {}, + required: [] + } + ); + schema.properties.instances = instances; + const _tokens = Object.keys(tokens).filter( + (t) => t !== nativeCurrency && !config.optionalTokens?.includes(t) && !config.disabledTokens?.includes(t) + ); + if (netId === NetId.MAINNET) { + _tokens.push("torn"); + } + if (_tokens.length) { + const ethPrices = { + type: "object", + properties: _tokens.reduce((acc, token) => { + acc[token] = bnSchemaType; + return acc; + }, {}), + required: _tokens + }; + schema.properties.ethPrices = ethPrices; + schema.required.push("ethPrices"); + } + if (tovarish) { + schema.required.push("gasPrices", "latestBlock", "latestBalance", "syncStatus", "onSyncEvents"); + } + return schema; +} + +const jobsSchema = { + type: "object", + properties: { + error: { type: "string" }, + id: { type: "string" }, + type: { type: "string" }, + status: { type: "string" }, + contract: { type: "string" }, + proof: { type: "string" }, + args: { + type: "array", + items: { type: "string" } + }, + txHash: { type: "string" }, + confirmations: { type: "number" }, + failedReason: { type: "string" } + }, + required: ["id", "status"] +}; +const jobRequestSchema = { + ...jobsSchema, + required: ["id"] +}; + +const MIN_FEE = 0.1; +const MAX_FEE = 0.9; +const MIN_STAKE_BALANCE = ethers.parseEther("500"); +function calculateScore({ stakeBalance, tornadoServiceFee }) { + if (tornadoServiceFee < MIN_FEE) { + tornadoServiceFee = MIN_FEE; + } else if (tornadoServiceFee >= MAX_FEE) { + return BigInt(0); + } + const serviceFeeCoefficient = (tornadoServiceFee - MIN_FEE) ** 2; + const feeDiffCoefficient = 1 / (MAX_FEE - MIN_FEE) ** 2; + const coefficientsMultiplier = 1 - feeDiffCoefficient * serviceFeeCoefficient; + return BigInt(Math.floor(Number(stakeBalance || "0") * coefficientsMultiplier)); +} +function getWeightRandom(weightsScores, random) { + for (let i = 0; i < weightsScores.length; i++) { + if (random < weightsScores[i]) { + return i; + } + random = random - weightsScores[i]; + } + return Math.floor(Math.random() * weightsScores.length); +} +function getSupportedInstances(instanceList) { + const rawList = Object.values(instanceList).map(({ instanceAddress }) => { + return Object.values(instanceAddress); + }).flat(); + return rawList.map((l) => ethers.getAddress(l)); +} +function pickWeightedRandomRelayer(relayers) { + const weightsScores = relayers.map((el) => calculateScore(el)); + const totalWeight = weightsScores.reduce((acc, curr) => { + return acc = acc + curr; + }, BigInt("0")); + const random = BigInt(Math.floor(Number(totalWeight) * Math.random())); + const weightRandomIndex = getWeightRandom(weightsScores, random); + return relayers[weightRandomIndex]; +} +class RelayerClient { + netId; + config; + selectedRelayer; + fetchDataOptions; + tovarish; + constructor({ netId, config, fetchDataOptions: fetchDataOptions2 }) { + this.netId = netId; + this.config = config; + this.fetchDataOptions = fetchDataOptions2; + this.tovarish = false; + } + async askRelayerStatus({ + hostname, + url, + relayerAddress + }) { + if (!url && hostname) { + url = `https://${!hostname.endsWith("/") ? hostname + "/" : hostname}`; + } else if (url && !url.endsWith("/")) { + url += "/"; + } else { + url = ""; + } + const rawStatus = await fetchData(`${url}status`, { + ...this.fetchDataOptions, + headers: { + "Content-Type": "application/json, application/x-www-form-urlencoded" + }, + timeout: 3e4, + maxRetry: this.fetchDataOptions?.torPort ? 2 : 0 + }); + const statusValidator = ajv.compile(getStatusSchema(this.netId, this.config, this.tovarish)); + if (!statusValidator(rawStatus)) { + throw new Error("Invalid status schema"); + } + const status = { + ...rawStatus, + url + }; + if (status.currentQueue > 5) { + throw new Error("Withdrawal queue is overloaded"); + } + if (status.netId !== this.netId) { + throw new Error("This relayer serves a different network"); + } + if (relayerAddress && this.netId === NetId.MAINNET && status.rewardAccount !== relayerAddress) { + throw new Error("The Relayer reward address must match registered address"); + } + return status; + } + async filterRelayer(relayer) { + const hostname = relayer.hostnames[this.netId]; + const { ensName, relayerAddress } = relayer; + if (!hostname) { + return; + } + try { + const status = await this.askRelayerStatus({ + hostname, + relayerAddress + }); + return { + netId: status.netId, + url: status.url, + hostname, + ensName, + relayerAddress, + rewardAccount: ethers.getAddress(status.rewardAccount), + instances: getSupportedInstances(status.instances), + stakeBalance: relayer.stakeBalance, + gasPrice: status.gasPrices?.fast, + ethPrices: status.ethPrices, + currentQueue: status.currentQueue, + tornadoServiceFee: status.tornadoServiceFee + }; + } catch (err) { + return { + hostname, + relayerAddress, + errorMessage: err.message, + hasError: true + }; + } + } + async getValidRelayers(relayers) { + const invalidRelayers = []; + const validRelayers = (await Promise.all(relayers.map((relayer) => this.filterRelayer(relayer)))).filter( + (r) => { + if (!r) { + return false; + } + if (r.hasError) { + invalidRelayers.push(r); + return false; + } + return true; + } + ); + return { + validRelayers, + invalidRelayers + }; + } + pickWeightedRandomRelayer(relayers) { + return pickWeightedRandomRelayer(relayers); + } + async tornadoWithdraw({ contract, proof, args }, callback) { + const { url } = this.selectedRelayer; + const withdrawResponse = await fetchData(`${url}v1/tornadoWithdraw`, { + ...this.fetchDataOptions, + method: "POST", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify({ + contract, + proof, + args + }) + }); + const { id, error } = withdrawResponse; + if (error) { + throw new Error(error); + } + const jobValidator = ajv.compile(jobRequestSchema); + if (!jobValidator(withdrawResponse)) { + const errMsg = `${url}v1/tornadoWithdraw has an invalid job response`; + throw new Error(errMsg); + } + if (typeof callback === "function") { + callback(withdrawResponse); + } + let relayerStatus; + const jobUrl = `${url}v1/jobs/${id}`; + console.log(`Job submitted: ${jobUrl} +`); + while (!relayerStatus || !["FAILED", "CONFIRMED"].includes(relayerStatus)) { + const jobResponse = await fetchData(jobUrl, { + ...this.fetchDataOptions, + method: "GET", + headers: { + "Content-Type": "application/json" + } + }); + if (jobResponse.error) { + throw new Error(error); + } + const jobValidator2 = ajv.compile(jobsSchema); + if (!jobValidator2(jobResponse)) { + const errMsg = `${jobUrl} has an invalid job response`; + throw new Error(errMsg); + } + const { status, txHash, confirmations, failedReason } = jobResponse; + if (relayerStatus !== status) { + if (status === "FAILED") { + const errMsg = `Job ${status}: ${jobUrl} failed reason: ${failedReason}`; + throw new Error(errMsg); + } else if (status === "SENT") { + console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash} +`); + } else if (status === "MINED") { + console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash}, confirmations: ${confirmations} +`); + } else if (status === "CONFIRMED") { + console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash}, confirmations: ${confirmations} +`); + } else { + console.log(`Job ${status}: ${jobUrl} +`); + } + relayerStatus = status; + if (typeof callback === "function") { + callback(jobResponse); + } + } + await sleep(3e3); + } + } +} + +class BaseEventsService { + netId; + provider; + contract; + type; + deployedBlock; + batchEventsService; + fetchDataOptions; + tovarishClient; + constructor({ + netId, + provider, + contract, + type = "", + deployedBlock = 0, + fetchDataOptions: fetchDataOptions2, + tovarishClient + }) { + this.netId = netId; + this.provider = provider; + this.fetchDataOptions = fetchDataOptions2; + this.contract = contract; + this.type = type; + this.deployedBlock = deployedBlock; + this.batchEventsService = new BatchEventsService({ + provider, + contract, + onProgress: this.updateEventProgress + }); + this.tovarishClient = tovarishClient; + } + getInstanceName() { + return ""; + } + getType() { + return this.type || ""; + } + getTovarishType() { + return String(this.getType() || "").toLowerCase(); + } + /* eslint-disable @typescript-eslint/no-unused-vars */ + updateEventProgress({ percentage, type, fromBlock, toBlock, count }) { + } + updateBlockProgress({ percentage, currentIndex, totalIndex }) { + } + updateTransactionProgress({ percentage, currentIndex, totalIndex }) { + } + /* eslint-enable @typescript-eslint/no-unused-vars */ + async formatEvents(events) { + return await new Promise((resolve) => resolve(events)); + } + /** + * Get saved or cached events + */ + async getEventsFromDB() { + return { + events: [], + lastBlock: 0 + }; + } + /** + * Events from remote cache (Either from local cache, CDN, or from IPFS) + */ + async getEventsFromCache() { + return { + events: [], + lastBlock: 0, + fromCache: true + }; + } + async getSavedEvents() { + let dbEvents = await this.getEventsFromDB(); + if (!dbEvents.lastBlock) { + dbEvents = await this.getEventsFromCache(); + } + return dbEvents; + } + async getEventsFromRpc({ + fromBlock, + toBlock + }) { + try { + if (!toBlock) { + toBlock = await this.provider.getBlockNumber(); + } + if (fromBlock >= toBlock) { + return { + events: [], + lastBlock: toBlock + }; + } + this.updateEventProgress({ percentage: 0, type: this.getType() }); + const events = await this.formatEvents( + await this.batchEventsService.getBatchEvents({ + fromBlock, + toBlock, + type: this.getType() + }) + ); + return { + events, + lastBlock: toBlock + }; + } catch (err) { + console.log(err); + return { + events: [], + lastBlock: fromBlock + }; + } + } + async getLatestEvents({ fromBlock }) { + if (this.tovarishClient?.selectedRelayer) { + const { events, lastSyncBlock: lastBlock } = await this.tovarishClient.getEvents({ + type: this.getTovarishType(), + fromBlock + }); + return { + events, + lastBlock + }; + } + return await this.getEventsFromRpc({ + fromBlock + }); + } + /* eslint-disable @typescript-eslint/no-unused-vars */ + async validateEvents({ + events, + newEvents, + lastBlock + }) { + return void 0; + } + /* eslint-enable @typescript-eslint/no-unused-vars */ + /** + * Handle saving events + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + async saveEvents({ events, newEvents, lastBlock }) { + } + /** + * Trigger saving and receiving latest events + */ + async updateEvents() { + const savedEvents = await this.getSavedEvents(); + let fromBlock = this.deployedBlock; + if (savedEvents && savedEvents.lastBlock) { + fromBlock = savedEvents.lastBlock + 1; + } + const newEvents = await this.getLatestEvents({ fromBlock }); + const eventSet = /* @__PURE__ */ new Set(); + const allEvents = [...savedEvents.events, ...newEvents.events].sort((a, b) => { + if (a.blockNumber === b.blockNumber) { + return a.logIndex - b.logIndex; + } + return a.blockNumber - b.blockNumber; + }).filter(({ transactionHash, logIndex }) => { + const eventKey = `${transactionHash}_${logIndex}`; + const hasEvent = eventSet.has(eventKey); + eventSet.add(eventKey); + return !hasEvent; + }); + const lastBlock = newEvents.lastBlock || allEvents[allEvents.length - 1]?.blockNumber; + const validateResult = await this.validateEvents({ + events: allEvents, + newEvents: newEvents.events, + lastBlock + }); + if (savedEvents.fromCache || newEvents.events.length) { + await this.saveEvents({ events: allEvents, newEvents: newEvents.events, lastBlock }); + } + return { + events: allEvents, + lastBlock, + validateResult + }; + } +} +class BaseTornadoService extends BaseEventsService { + amount; + currency; + optionalTree; + merkleTreeService; + batchTransactionService; + batchBlockService; + constructor(serviceConstructor) { + const { Tornado: contract, amount, currency, provider, optionalTree, merkleTreeService } = serviceConstructor; + super({ + ...serviceConstructor, + contract + }); + this.amount = amount; + this.currency = currency; + this.optionalTree = optionalTree; + this.merkleTreeService = merkleTreeService; + this.batchTransactionService = new BatchTransactionService({ + provider, + onProgress: this.updateTransactionProgress + }); + this.batchBlockService = new BatchBlockService({ + provider, + onProgress: this.updateBlockProgress + }); + } + getInstanceName() { + return `${this.getType().toLowerCase()}s_${this.netId}_${this.currency}_${this.amount}`; + } + async formatEvents(events) { + const type = this.getType(); + if (type === "Deposit") { + const txs = await this.batchTransactionService.getBatchTransactions([ + ...new Set(events.map(({ transactionHash }) => transactionHash)) + ]); + return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { + const { commitment, leafIndex, timestamp } = args; + return { + blockNumber, + logIndex, + transactionHash, + commitment, + leafIndex: Number(leafIndex), + timestamp: Number(timestamp), + from: txs.find(({ hash }) => hash === transactionHash)?.from || "" + }; + }); + } else { + const blocks = await this.batchBlockService.getBatchBlocks([ + ...new Set(events.map(({ blockNumber }) => blockNumber)) + ]); + return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { + const { nullifierHash, to, fee } = args; + return { + blockNumber, + logIndex, + transactionHash, + nullifierHash: String(nullifierHash), + to: ethers.getAddress(to), + fee: String(fee), + timestamp: blocks.find(({ number }) => number === blockNumber)?.timestamp || 0 + }; + }); + } + } + async validateEvents({ + events, + newEvents + }) { + if (events.length && this.getType() === "Deposit") { + const depositEvents = events; + const lastEvent = depositEvents[depositEvents.length - 1]; + if (lastEvent.leafIndex !== depositEvents.length - 1) { + const errMsg = `Deposit events invalid wants ${depositEvents.length - 1} leafIndex have ${lastEvent.leafIndex}`; + throw new Error(errMsg); + } + if (this.merkleTreeService && (!this.optionalTree || newEvents.length)) { + return await this.merkleTreeService.verifyTree(depositEvents); + } + } + return void 0; + } + async getLatestEvents({ + fromBlock + }) { + if (this.tovarishClient?.selectedRelayer) { + const { events, lastSyncBlock: lastBlock } = await this.tovarishClient.getEvents({ + type: this.getTovarishType(), + currency: this.currency, + amount: this.amount, + fromBlock + }); + return { + events, + lastBlock + }; + } + return await this.getEventsFromRpc({ + fromBlock + }); + } +} +class BaseMultiTornadoService extends BaseEventsService { + instances; + optionalTree; + merkleTreeService; + batchTransactionService; + batchBlockService; + constructor(serviceConstructor) { + const { instances, provider, optionalTree, merkleTreeService } = serviceConstructor; + const contract = merkleTreeService?.Tornado || contracts.Tornado__factory.connect(Object.keys(instances)[0], provider); + super({ + ...serviceConstructor, + contract, + type: "*" + }); + this.batchEventsService = new BatchEventsService({ + provider, + contract, + address: Object.keys(instances), + onProgress: this.updateEventProgress + }); + this.instances = instances; + this.optionalTree = optionalTree; + this.merkleTreeService = merkleTreeService; + this.batchTransactionService = new BatchTransactionService({ + provider, + onProgress: this.updateTransactionProgress + }); + this.batchBlockService = new BatchBlockService({ + provider, + onProgress: this.updateBlockProgress + }); + } + getInstanceName() { + return `tornado_${this.netId}`; + } + getTovarishType() { + return "tornado"; + } + async formatEvents(events) { + const txs = await this.batchTransactionService.getBatchTransactions([ + ...new Set( + events.filter(({ eventName }) => eventName === "Deposit").map(({ transactionHash }) => transactionHash) + ) + ]); + const blocks = await this.batchBlockService.getBatchBlocks([ + ...new Set( + events.filter(({ eventName }) => eventName === "Withdrawal").map(({ blockNumber }) => blockNumber) + ) + ]); + return events.map( + ({ + address: instanceAddress, + blockNumber, + index: logIndex, + transactionHash, + args, + eventName: event + }) => { + const eventObjects = { + blockNumber, + logIndex, + transactionHash, + event, + instanceAddress + }; + if (event === "Deposit") { + const { commitment, leafIndex, timestamp } = args; + return { + ...eventObjects, + commitment, + leafIndex: Number(leafIndex), + timestamp: Number(timestamp), + from: txs.find(({ hash }) => hash === transactionHash)?.from || "" + }; + } + if (event === "Withdrawal") { + const { nullifierHash, to, relayer: relayerAddress, fee } = args; + return { + ...eventObjects, + logIndex, + transactionHash, + nullifierHash: String(nullifierHash), + to, + relayerAddress, + fee: String(fee), + timestamp: blocks.find(({ number }) => number === blockNumber)?.timestamp || 0 + }; + } + } + ).filter((e) => e); + } + async validateEvents({ + events, + newEvents + }) { + const instancesWithNewEvents = [ + ...new Set( + newEvents.filter(({ event }) => event === "Deposit").map(({ instanceAddress }) => instanceAddress) + ) + ]; + let tree; + const requiredTree = this.merkleTreeService?.Tornado?.target; + if (requiredTree && !instancesWithNewEvents.includes(requiredTree)) { + instancesWithNewEvents.push(requiredTree); + } + for (const instance of instancesWithNewEvents) { + const depositEvents = events.filter( + ({ instanceAddress, event }) => instanceAddress === instance && event === "Deposit" + ); + const lastEvent = depositEvents[depositEvents.length - 1]; + if (lastEvent.leafIndex !== depositEvents.length - 1) { + const errMsg = `Invalid deposit events for ${instance} wants ${depositEvents.length - 1} leafIndex have ${lastEvent.leafIndex}`; + throw new Error(errMsg); + } + if (requiredTree === instance && !this.optionalTree) { + tree = await this.merkleTreeService?.verifyTree(depositEvents); + } + } + return tree; + } + async getEvents(instanceAddress) { + const { events, validateResult: tree, lastBlock } = await this.updateEvents(); + const { depositEvents, withdrawalEvents } = events.reduce( + (acc, curr) => { + if (curr.instanceAddress === instanceAddress) { + if (curr.event === "Deposit") { + acc.depositEvents.push(curr); + } else if (curr.event === "Withdrawal") { + acc.withdrawalEvents.push(curr); + } + } + return acc; + }, + {} + ); + return { + depositEvents, + withdrawalEvents, + tree, + lastBlock + }; + } +} +class BaseEchoService extends BaseEventsService { + constructor(serviceConstructor) { + super({ + ...serviceConstructor, + contract: serviceConstructor.Echoer, + type: "Echo" + }); + } + getInstanceName() { + return `echo_${this.netId}`; + } + async formatEvents(events) { + return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { + const { who, data } = args; + if (who && data) { + const eventObjects = { + blockNumber, + logIndex, + transactionHash + }; + return { + ...eventObjects, + address: who, + encryptedAccount: data + }; + } + }).filter((e) => e); + } +} +class BaseEncryptedNotesService extends BaseEventsService { + constructor(serviceConstructor) { + super({ + ...serviceConstructor, + contract: serviceConstructor.Router, + type: "EncryptedNote" + }); + } + getInstanceName() { + return `encrypted_notes_${this.netId}`; + } + getTovarishType() { + return "encrypted_notes"; + } + async formatEvents(events) { + return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { + const { encryptedNote } = args; + if (encryptedNote && encryptedNote !== "0x") { + const eventObjects = { + blockNumber, + logIndex, + transactionHash + }; + return { + ...eventObjects, + encryptedNote + }; + } + }).filter((e) => e); + } +} +const abiCoder = ethers.AbiCoder.defaultAbiCoder(); +const proposalState = { + 0: "Pending", + 1: "Active", + 2: "Defeated", + 3: "Timelocked", + 4: "AwaitingExecution", + 5: "Executed", + 6: "Expired" +}; +function parseDescription(id, text) { + switch (id) { + case 1: + return { + title: text, + description: "See: https://torn.community/t/proposal-1-enable-torn-transfers/38" + }; + case 10: + text = text.replace("\n", "\\n\\n"); + break; + case 11: + text = text.replace('"description"', ',"description"'); + break; + case 13: + text = text.replace(/\\\\n\\\\n(\s)?(\\n)?/g, "\\n"); + break; + case 15: + text = text.replaceAll("'", '"'); + text = text.replace('"description"', ',"description"'); + break; + case 16: + text = text.replace("#16: ", ""); + break; + case 21: + return { + title: "Proposal #21: Restore Governance", + description: "" + }; + } + let title, description, rest; + try { + ({ title, description } = JSON.parse(text)); + } catch { + [title, ...rest] = text.split("\n", 2); + description = rest.join("\n"); + } + return { + title, + description + }; +} +function parseComment(Governance2, calldata) { + try { + const methodLength = 4; + const result = abiCoder.decode(["address[]", "uint256", "bool"], ethers.dataSlice(calldata, methodLength)); + const data = Governance2.interface.encodeFunctionData( + // @ts-expect-error encodeFunctionData is broken lol + "castDelegatedVote", + result + ); + const length = ethers.dataLength(data); + const str = abiCoder.decode(["string"], ethers.dataSlice(calldata, length))[0]; + const [contact, message] = JSON.parse(str); + return { + contact, + message + }; + } catch { + return { + contact: "", + message: "" + }; + } +} +class BaseGovernanceService extends BaseEventsService { + Governance; + Aggregator; + ReverseRecords; + batchTransactionService; + constructor(serviceConstructor) { + const { Governance: Governance2, Aggregator: Aggregator2, ReverseRecords, provider } = serviceConstructor; + super({ + ...serviceConstructor, + contract: Governance2, + type: "*" + }); + this.Governance = Governance2; + this.Aggregator = Aggregator2; + this.ReverseRecords = ReverseRecords; + this.batchTransactionService = new BatchTransactionService({ + provider, + onProgress: this.updateTransactionProgress + }); + } + getInstanceName() { + return `governance_${this.netId}`; + } + getTovarishType() { + return "governance"; + } + async formatEvents(events) { + const proposalEvents = []; + const votedEvents = []; + const delegatedEvents = []; + const undelegatedEvents = []; + events.forEach(({ blockNumber, index: logIndex, transactionHash, args, eventName: event }) => { + const eventObjects = { + blockNumber, + logIndex, + transactionHash, + event + }; + if (event === "ProposalCreated") { + const { id, proposer, target, startTime, endTime, description } = args; + proposalEvents.push({ + ...eventObjects, + id: Number(id), + proposer, + target, + startTime: Number(startTime), + endTime: Number(endTime), + description + }); + } + if (event === "Voted") { + const { proposalId, voter, support, votes } = args; + votedEvents.push({ + ...eventObjects, + proposalId: Number(proposalId), + voter, + support, + votes, + from: "", + input: "" + }); + } + if (event === "Delegated") { + const { account, to: delegateTo } = args; + delegatedEvents.push({ + ...eventObjects, + account, + delegateTo + }); + } + if (event === "Undelegated") { + const { account, from: delegateFrom } = args; + undelegatedEvents.push({ + ...eventObjects, + account, + delegateFrom }); } }); + if (votedEvents.length) { + this.updateTransactionProgress({ percentage: 0 }); + const txs = await this.batchTransactionService.getBatchTransactions([ + ...new Set(votedEvents.map(({ transactionHash }) => transactionHash)) + ]); + votedEvents.forEach((event, index) => { + let { data: input, from } = txs.find((t) => t.hash === event.transactionHash); + if (!input || input.length > 2048) { + input = ""; + } + votedEvents[index].from = from; + votedEvents[index].input = input; + }); + } + return [...proposalEvents, ...votedEvents, ...delegatedEvents, ...undelegatedEvents]; + } + async getAllProposals() { + const { events } = await this.updateEvents(); + const proposalEvents = events.filter((e) => e.event === "ProposalCreated"); + const allProposers = [...new Set(proposalEvents.map((e) => [e.proposer]).flat())]; + const [QUORUM_VOTES, proposalStatus, proposerNameRecords] = await Promise.all([ + this.Governance.QUORUM_VOTES(), + this.Aggregator.getAllProposals(this.Governance.target), + this.ReverseRecords.getNames(allProposers) + ]); + const proposerNames = allProposers.reduce( + (acc, address, index) => { + if (proposerNameRecords[index]) { + acc[address] = proposerNameRecords[index]; + } + return acc; + }, + {} + ); + return proposalEvents.map((event, index) => { + const { id, proposer, description: text } = event; + const status = proposalStatus[index]; + const { forVotes, againstVotes, executed, extended, state } = status; + const { title, description } = parseDescription(id, text); + const quorum = (Number(forVotes + againstVotes) / Number(QUORUM_VOTES) * 100).toFixed(0) + "%"; + return { + ...event, + title, + proposerName: proposerNames[proposer] || void 0, + description, + forVotes, + againstVotes, + executed, + extended, + quorum, + state: proposalState[String(state)] + }; + }); + } + async getVotes(proposalId) { + const { events } = await this.getSavedEvents(); + const votedEvents = events.filter( + (e) => e.event === "Voted" && e.proposalId === proposalId + ); + const allVoters = [...new Set(votedEvents.map((e) => [e.from, e.voter]).flat())]; + const names = await this.ReverseRecords.getNames(allVoters); + const ensNames = allVoters.reduce( + (acc, address, index) => { + if (names[index]) { + acc[address] = names[index]; + } + return acc; + }, + {} + ); + const votes = votedEvents.map((event) => { + const { from, voter } = event; + const { contact, message } = parseComment(this.Governance, event.input); + return { + ...event, + contact, + message, + fromName: ensNames[from] || void 0, + voterName: ensNames[voter] || void 0 + }; + }); + return votes; + } + async getDelegatedBalance(ethAccount) { + const { events } = await this.getSavedEvents(); + const delegatedAccs = events.filter((e) => e.event === "Delegated" && e.delegateTo === ethAccount).map((e) => e.account); + const undelegatedAccs = events.filter((e) => e.event === "Undelegated" && e.delegateFrom === ethAccount).map((e) => e.account); + const undel = [...undelegatedAccs]; + const uniq = delegatedAccs.filter((acc) => { + const indexUndelegated = undel.indexOf(acc); + if (indexUndelegated !== -1) { + undel.splice(indexUndelegated, 1); + return false; + } + return true; + }); + const [balances, uniqNameRecords] = await Promise.all([ + this.Aggregator.getGovernanceBalances(this.Governance.target, uniq), + this.ReverseRecords.getNames(uniq) + ]); + const uniqNames = uniq.reduce( + (acc, address, index) => { + if (uniqNameRecords[index]) { + acc[address] = uniqNameRecords[index]; + } + return acc; + }, + {} + ); + return { + delegatedAccs, + undelegatedAccs, + uniq, + uniqNames, + balances, + balance: balances.reduce((acc, curr) => acc + curr, BigInt(0)) + }; + } +} +async function getTovarishNetworks(registryService, relayers) { + await Promise.all( + relayers.filter((r) => r.tovarishHost).map(async (relayer) => { + try { + relayer.tovarishNetworks = await fetchData(relayer.tovarishHost, { + ...registryService.fetchDataOptions, + headers: { + "Content-Type": "application/json" + }, + timeout: 3e4, + maxRetry: registryService.fetchDataOptions?.torPort ? 2 : 0 + }); + } catch { + relayer.tovarishNetworks = []; + } + }) + ); +} +const staticRelayers = [ + { + ensName: "tornadowithdraw.eth", + relayerAddress: "0x40c3d1656a26C9266f4A10fed0D87EFf79F54E64", + hostnames: {}, + tovarishHost: "tornadowithdraw.com", + tovarishNetworks: enabledChains + } +]; +class BaseRegistryService extends BaseEventsService { + Aggregator; + relayerEnsSubdomains; + updateInterval; + constructor(serviceConstructor) { + const { RelayerRegistry: contract, Aggregator: Aggregator2, relayerEnsSubdomains } = serviceConstructor; + super({ + ...serviceConstructor, + contract, + type: "*" + }); + this.Aggregator = Aggregator2; + this.relayerEnsSubdomains = relayerEnsSubdomains; + this.updateInterval = 86400; + } + getInstanceName() { + return `registry_${this.netId}`; + } + getTovarishType() { + return "registry"; + } + async formatEvents(events) { + const relayerRegisteredEvents = []; + const relayerUnregisteredEvents = []; + const workerRegisteredEvents = []; + const workerUnregisteredEvents = []; + events.forEach(({ blockNumber, index: logIndex, transactionHash, args, eventName: event }) => { + const eventObjects = { + blockNumber, + logIndex, + transactionHash, + event + }; + if (event === "RelayerRegistered") { + const { relayer: ensHash, ensName, relayerAddress, stakedAmount } = args; + relayerRegisteredEvents.push({ + ...eventObjects, + ensName, + relayerAddress, + ensHash, + stakedAmount: ethers.formatEther(stakedAmount) + }); + } + if (event === "RelayerUnregistered") { + const { relayer: relayerAddress } = args; + relayerUnregisteredEvents.push({ + ...eventObjects, + relayerAddress + }); + } + if (event === "WorkerRegistered") { + const { relayer: relayerAddress, worker: workerAddress } = args; + workerRegisteredEvents.push({ + ...eventObjects, + relayerAddress, + workerAddress + }); + } + if (event === "WorkerUnregistered") { + const { relayer: relayerAddress, worker: workerAddress } = args; + workerUnregisteredEvents.push({ + ...eventObjects, + relayerAddress, + workerAddress + }); + } + }); + return [ + ...relayerRegisteredEvents, + ...relayerUnregisteredEvents, + ...workerRegisteredEvents, + ...workerUnregisteredEvents + ]; + } + /** + * Get saved or cached relayers + */ + async getRelayersFromDB() { + return { + lastBlock: 0, + timestamp: 0, + relayers: [] + }; + } + /** + * Relayers from remote cache (Either from local cache, CDN, or from IPFS) + */ + async getRelayersFromCache() { + return { + lastBlock: 0, + timestamp: 0, + relayers: [], + fromCache: true + }; + } + async getSavedRelayers() { + let cachedRelayers = await this.getRelayersFromDB(); + if (!cachedRelayers || !cachedRelayers.relayers.length) { + cachedRelayers = await this.getRelayersFromCache(); + } + return cachedRelayers; + } + async getLatestRelayers() { + const { events: allEvents, lastBlock } = await this.updateEvents(); + const events = allEvents.filter((e) => e.event === "RelayerRegistered"); + const subdomains = Object.values(this.relayerEnsSubdomains); + const registerSet = /* @__PURE__ */ new Set(); + const uniqueRegisters = events.filter(({ ensName }) => { + if (!registerSet.has(ensName)) { + registerSet.add(ensName); + return true; + } + return false; + }); + const relayerNameHashes = uniqueRegisters.map((r) => ethers.namehash(r.ensName)); + const [relayersData, timestamp] = await Promise.all([ + this.Aggregator.relayersData.staticCall(relayerNameHashes, subdomains.concat("tovarish-relayer")), + this.provider.getBlock(lastBlock).then((b) => Number(b?.timestamp)) + ]); + const relayers = relayersData.map(({ owner, balance: stakeBalance, records, isRegistered }, index) => { + const { ensName, relayerAddress } = uniqueRegisters[index]; + let tovarishHost = void 0; + const hostnames = records.reduce((acc, record, recordIndex) => { + if (record) { + if (recordIndex === records.length - 1) { + tovarishHost = record; + return acc; + } + acc[Number(Object.keys(this.relayerEnsSubdomains)[recordIndex])] = record; + } + return acc; + }, {}); + const hasMinBalance = stakeBalance >= MIN_STAKE_BALANCE; + const preCondition = Object.keys(hostnames).length && isRegistered && hasMinBalance; + if (preCondition) { + return { + ensName, + relayerAddress: owner, + registeredAddress: owner !== relayerAddress ? relayerAddress : void 0, + isRegistered, + stakeBalance: ethers.formatEther(stakeBalance), + hostnames, + tovarishHost + }; + } + }).filter((r) => r); + await getTovarishNetworks(this, relayers); + const allRelayers = [...staticRelayers, ...relayers]; + const tovarishRelayers = allRelayers.filter((r) => r.tovarishHost); + const classicRelayers = allRelayers.filter((r) => !r.tovarishHost); + return { + lastBlock, + timestamp, + relayers: [...tovarishRelayers, ...classicRelayers] + }; + } + /** + * Handle saving relayers + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + async saveRelayers({ lastBlock, timestamp, relayers }) { + } + /** + * Get cached or latest relayer and save to local + */ + async updateRelayers() { + let { lastBlock, timestamp, relayers, fromCache } = await this.getSavedRelayers(); + let shouldSave = fromCache ?? false; + if (!relayers.length || timestamp + this.updateInterval < Math.floor(Date.now() / 1e3)) { + console.log("\nUpdating relayers from registry\n"); + ({ lastBlock, timestamp, relayers } = await this.getLatestRelayers()); + shouldSave = true; + } + if (shouldSave) { + await this.saveRelayers({ lastBlock, timestamp, relayers }); + } + return { lastBlock, timestamp, relayers }; + } +} +class BaseRevenueService extends BaseEventsService { + batchTransactionService; + batchBlockService; + constructor(serviceConstructor) { + const { RelayerRegistry: contract, provider } = serviceConstructor; + super({ + ...serviceConstructor, + contract, + type: "StakeBurned" + }); + this.batchTransactionService = new BatchTransactionService({ + provider, + onProgress: this.updateTransactionProgress + }); + this.batchBlockService = new BatchBlockService({ + provider, + onProgress: this.updateBlockProgress + }); + } + getInstanceName() { + return `revenue_${this.netId}`; + } + getTovarishType() { + return "revenue"; + } + async formatEvents(events) { + const blocks = await this.batchBlockService.getBatchBlocks([ + ...new Set(events.map(({ blockNumber }) => blockNumber)) + ]); + const receipts = await this.batchTransactionService.getBatchReceipt([ + ...new Set(events.map(({ transactionHash }) => transactionHash)) + ]); + const registeredRelayers = new Set(events.map(({ args }) => args.relayer)); + const tornadoInterface = contracts.Tornado__factory.createInterface(); + const withdrawHash = tornadoInterface.getEvent("Withdrawal").topicHash; + const withdrawalLogs = receipts.map( + (receipt) => receipt.logs.map((log) => { + if (log.topics[0] === withdrawHash) { + const block = blocks.find((b) => b.number === log.blockNumber); + const parsedLog = tornadoInterface.parseLog(log); + if (parsedLog && registeredRelayers.has(parsedLog.args.relayer)) { + return { + instanceAddress: log.address, + gasFee: (receipt.cumulativeGasUsed * receipt.gasPrice).toString(), + relayerFee: parsedLog.args.fee.toString(), + timestamp: block?.timestamp || 0 + }; + } + } + }).filter((l) => l) + ).flat(); + if (withdrawalLogs.length !== events.length) { + console.log( + ` +RevenueService: Mismatch on withdrawal logs (${withdrawalLogs.length} ) and events logs (${events.length}) +` + ); + } + return events.map(({ blockNumber, index: logIndex, transactionHash, args }, index) => { + const eventObjects = { + blockNumber, + logIndex, + transactionHash + }; + const { relayer: relayerAddress, amountBurned } = args; + const { instanceAddress, gasFee, relayerFee, timestamp } = withdrawalLogs[index]; + return { + ...eventObjects, + relayerAddress, + amountBurned: amountBurned.toString(), + instanceAddress, + gasFee, + relayerFee, + timestamp + }; + }); } - n.default = e; - return Object.freeze(n); } -var websnarkUtils__namespace = /*#__PURE__*/_interopNamespaceDefault(websnarkUtils); +function zipAsync(file, options) { + return new Promise((res, rej) => { + fflate.zip(file, { ...options || {}, mtime: /* @__PURE__ */ new Date("1/1/1980") }, (err, data) => { + if (err) { + rej(err); + return; + } + res(data); + }); + }); +} +function unzipAsync(data) { + return new Promise((res, rej) => { + fflate.unzip(data, {}, (err, data2) => { + if (err) { + rej(err); + return; + } + res(data2); + }); + }); +} +async function downloadZip({ + staticUrl = "", + zipName, + zipDigest, + parseJson = true +}) { + const url = `${staticUrl}/${zipName}.zip`; + const resp = await fetchData(url, { + method: "GET", + returnResponse: true + }); + const data = new Uint8Array(await resp.arrayBuffer()); + if (zipDigest) { + const hash = "sha384-" + bytesToBase64(await digest(data)); + if (zipDigest !== hash) { + const errMsg = `Invalid digest hash for file ${url}, wants ${zipDigest} has ${hash}`; + throw new Error(errMsg); + } + } + const { [zipName]: content } = await unzipAsync(data); + console.log(`Downloaded ${url}${zipDigest ? ` ( Digest: ${zipDigest} )` : ""}`); + if (parseJson) { + return JSON.parse(new TextDecoder().decode(content)); + } + return content; +} -const _abi$6 = [ +async function saveDBEvents({ + idb, + instanceName, + events, + lastBlock +}) { + try { + const formattedEvents = events.map((e) => { + return { + eid: `${e.transactionHash}_${e.logIndex}`, + ...e + }; + }); + await idb.createMultipleTransactions({ + data: formattedEvents, + storeName: instanceName + }); + await idb.putItem({ + data: { + blockNumber: lastBlock, + name: instanceName + }, + storeName: "lastEvents" + }); + } catch (err) { + console.log("Method saveDBEvents has error"); + console.log(err); + } +} +async function loadDBEvents({ + idb, + instanceName +}) { + try { + const lastBlockStore = await idb.getItem({ + storeName: "lastEvents", + key: instanceName + }); + if (!lastBlockStore?.blockNumber) { + return { + events: [], + lastBlock: 0 + }; + } + const events = (await idb.getAll({ + storeName: instanceName + })).map((e) => { + delete e.eid; + return e; + }); + return { + events, + lastBlock: lastBlockStore.blockNumber + }; + } catch (err) { + console.log("Method loadDBEvents has error"); + console.log(err); + return { + events: [], + lastBlock: 0 + }; + } +} +async function loadRemoteEvents({ + staticUrl, + instanceName, + deployedBlock, + zipDigest +}) { + try { + const zipName = `${instanceName}.json`.toLowerCase(); + const events = await downloadZip({ + staticUrl, + zipName, + zipDigest + }); + if (!Array.isArray(events)) { + const errStr = `Invalid events from ${staticUrl}/${zipName}`; + throw new Error(errStr); + } + return { + events, + lastBlock: events[events.length - 1]?.blockNumber || deployedBlock, + fromCache: true + }; + } catch (err) { + console.log("Method loadRemoteEvents has error"); + console.log(err); + return { + events: [], + lastBlock: deployedBlock, + fromCache: true + }; + } +} +class DBTornadoService extends BaseTornadoService { + staticUrl; + idb; + zipDigest; + constructor(params) { + super(params); + this.staticUrl = params.staticUrl; + this.idb = params.idb; + } + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName() + }); + } + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest + }); + } + async saveEvents({ events, lastBlock }) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock + }); + } +} +class DBEchoService extends BaseEchoService { + staticUrl; + idb; + zipDigest; + constructor(params) { + super(params); + this.staticUrl = params.staticUrl; + this.idb = params.idb; + } + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName() + }); + } + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest + }); + } + async saveEvents({ events, lastBlock }) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock + }); + } +} +class DBEncryptedNotesService extends BaseEncryptedNotesService { + staticUrl; + idb; + zipDigest; + constructor(params) { + super(params); + this.staticUrl = params.staticUrl; + this.idb = params.idb; + } + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName() + }); + } + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest + }); + } + async saveEvents({ events, lastBlock }) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock + }); + } +} +class DBGovernanceService extends BaseGovernanceService { + staticUrl; + idb; + zipDigest; + constructor(params) { + super(params); + this.staticUrl = params.staticUrl; + this.idb = params.idb; + } + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName() + }); + } + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest + }); + } + async saveEvents({ events, lastBlock }) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock + }); + } +} +class DBRegistryService extends BaseRegistryService { + staticUrl; + idb; + zipDigest; + relayerJsonDigest; + constructor(params) { + super(params); + this.staticUrl = params.staticUrl; + this.idb = params.idb; + } + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName() + }); + } + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest + }); + } + async saveEvents({ events, lastBlock }) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock + }); + } + async getRelayersFromDB() { + try { + const allCachedRelayers = await this.idb.getAll({ + storeName: `relayers_${this.netId}` + }); + if (!allCachedRelayers?.length) { + return { + lastBlock: 0, + timestamp: 0, + relayers: [] + }; + } + return allCachedRelayers.slice(-1)[0]; + } catch (err) { + console.log("Method getRelayersFromDB has error"); + console.log(err); + return { + lastBlock: 0, + timestamp: 0, + relayers: [] + }; + } + } + async getRelayersFromCache() { + const url = `${this.staticUrl}/relayers.json`; + try { + const resp = await fetchData(url, { + method: "GET", + returnResponse: true + }); + const data = new Uint8Array(await resp.arrayBuffer()); + if (this.relayerJsonDigest) { + const hash = "sha384-" + bytesToBase64(await digest(data)); + if (hash !== this.relayerJsonDigest) { + const errMsg = `Invalid digest hash for ${url}, wants ${this.relayerJsonDigest} has ${hash}`; + throw new Error(errMsg); + } + } + return JSON.parse(new TextDecoder().decode(data)); + } catch (err) { + console.log("Method getRelayersFromCache has error"); + console.log(err); + return { + lastBlock: 0, + timestamp: 0, + relayers: [] + }; + } + } + async saveRelayers(cachedRelayers) { + try { + await this.idb.putItem({ + data: cachedRelayers, + storeName: `relayers_${this.netId}` + }); + } catch (err) { + console.log("Method saveRelayers has error"); + console.log(err); + } + } +} +class DBRevenueService extends BaseRevenueService { + staticUrl; + idb; + zipDigest; + relayerJsonDigest; + constructor(params) { + super(params); + this.staticUrl = params.staticUrl; + this.idb = params.idb; + } + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName() + }); + } + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest + }); + } + async saveEvents({ events, lastBlock }) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock + }); + } +} + +const _abi$8 = [ { constant: true, inputs: [ @@ -713,6 +4285,1904 @@ const _abi$6 = [ } ]; class ENS__factory { + static abi = _abi$8; + static createInterface() { + return new ethers.Interface(_abi$8); + } + static connect(address, runner) { + return new ethers.Contract(address, _abi$8, runner); + } +} + +const _abi$7 = [ + { + inputs: [ + { + internalType: "contract ENS", + name: "_ens", + type: "address" + }, + { + internalType: "contract IBaseRegistrar", + name: "_registrar", + type: "address" + }, + { + internalType: "contract IMetadataService", + name: "_metadataService", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "CannotUpgrade", + type: "error" + }, + { + inputs: [], + name: "IncompatibleParent", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "IncorrectTargetOwner", + type: "error" + }, + { + inputs: [], + name: "IncorrectTokenType", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "labelHash", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "expectedLabelhash", + type: "bytes32" + } + ], + name: "LabelMismatch", + type: "error" + }, + { + inputs: [ + { + internalType: "string", + name: "label", + type: "string" + } + ], + name: "LabelTooLong", + type: "error" + }, + { + inputs: [], + name: "LabelTooShort", + type: "error" + }, + { + inputs: [], + name: "NameIsNotWrapped", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "OperationProhibited", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "addr", + type: "address" + } + ], + name: "Unauthorised", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "approved", + type: "address" + }, + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "ApprovalForAll", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "controller", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "active", + type: "bool" + } + ], + name: "ControllerChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "ExpiryExtended", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint32", + name: "fuses", + type: "uint32" + } + ], + name: "FusesSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "NameUnwrapped", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes", + name: "name", + type: "bytes" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: false, + internalType: "uint32", + name: "fuses", + type: "uint32" + }, + { + indexed: false, + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "NameWrapped", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256[]", + name: "ids", + type: "uint256[]" + }, + { + indexed: false, + internalType: "uint256[]", + name: "values", + type: "uint256[]" + } + ], + name: "TransferBatch", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "TransferSingle", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "string", + name: "value", + type: "string" + }, + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256" + } + ], + name: "URI", + type: "event" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "_tokens", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint32", + name: "fuseMask", + type: "uint32" + } + ], + name: "allFusesBurned", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "approve", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "id", + type: "uint256" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "accounts", + type: "address[]" + }, + { + internalType: "uint256[]", + name: "ids", + type: "uint256[]" + } + ], + name: "balanceOfBatch", + outputs: [ + { + internalType: "uint256[]", + name: "", + type: "uint256[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "addr", + type: "address" + } + ], + name: "canExtendSubnames", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "addr", + type: "address" + } + ], + name: "canModifyName", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "controllers", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ens", + outputs: [ + { + internalType: "contract ENS", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32" + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "extendExpiry", + outputs: [ + { + internalType: "uint64", + name: "", + type: "uint64" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "id", + type: "uint256" + } + ], + name: "getApproved", + outputs: [ + { + internalType: "address", + name: "operator", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "id", + type: "uint256" + } + ], + name: "getData", + outputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint32", + name: "fuses", + type: "uint32" + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "address", + name: "operator", + type: "address" + } + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32" + } + ], + name: "isWrapped", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "isWrapped", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "metadataService", + outputs: [ + { + internalType: "contract IMetadataService", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "names", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "address", + name: "", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "onERC721Received", + outputs: [ + { + internalType: "bytes4", + name: "", + type: "bytes4" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "id", + type: "uint256" + } + ], + name: "ownerOf", + outputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_token", + type: "address" + }, + { + internalType: "address", + name: "_to", + type: "address" + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256" + } + ], + name: "recoverFunds", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "string", + name: "label", + type: "string" + }, + { + internalType: "address", + name: "wrappedOwner", + type: "address" + }, + { + internalType: "uint256", + name: "duration", + type: "uint256" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint16", + name: "ownerControlledFuses", + type: "uint16" + } + ], + name: "registerAndWrapETH2LD", + outputs: [ + { + internalType: "uint256", + name: "registrarExpiry", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "registrar", + outputs: [ + { + internalType: "contract IBaseRegistrar", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "duration", + type: "uint256" + } + ], + name: "renew", + outputs: [ + { + internalType: "uint256", + name: "expires", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256[]", + name: "ids", + type: "uint256[]" + }, + { + internalType: "uint256[]", + name: "amounts", + type: "uint256[]" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "safeBatchTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "setApprovalForAll", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32" + }, + { + internalType: "uint32", + name: "fuses", + type: "uint32" + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "setChildFuses", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "controller", + type: "address" + }, + { + internalType: "bool", + name: "active", + type: "bool" + } + ], + name: "setController", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint16", + name: "ownerControlledFuses", + type: "uint16" + } + ], + name: "setFuses", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IMetadataService", + name: "_metadataService", + type: "address" + } + ], + name: "setMetadataService", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setRecord", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "setResolver", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "string", + name: "label", + type: "string" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint32", + name: "fuses", + type: "uint32" + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "setSubnodeOwner", + outputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "string", + name: "label", + type: "string" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + }, + { + internalType: "uint32", + name: "fuses", + type: "uint32" + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "setSubnodeRecord", + outputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setTTL", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract INameWrapperUpgrade", + name: "_upgradeAddress", + type: "address" + } + ], + name: "setUpgradeContract", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32" + }, + { + internalType: "address", + name: "controller", + type: "address" + } + ], + name: "unwrap", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32" + }, + { + internalType: "address", + name: "registrant", + type: "address" + }, + { + internalType: "address", + name: "controller", + type: "address" + } + ], + name: "unwrapETH2LD", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "name", + type: "bytes" + }, + { + internalType: "bytes", + name: "extraData", + type: "bytes" + } + ], + name: "upgrade", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "upgradeContract", + outputs: [ + { + internalType: "contract INameWrapperUpgrade", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "uri", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "name", + type: "bytes" + }, + { + internalType: "address", + name: "wrappedOwner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "wrap", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "string", + name: "label", + type: "string" + }, + { + internalType: "address", + name: "wrappedOwner", + type: "address" + }, + { + internalType: "uint16", + name: "ownerControlledFuses", + type: "uint16" + }, + { + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "wrapETH2LD", + outputs: [ + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +class ENSNameWrapper__factory { + static abi = _abi$7; + static createInterface() { + return new ethers.Interface(_abi$7); + } + static connect(address, runner) { + return new ethers.Contract(address, _abi$7, runner); + } +} + +const _abi$6 = [ + { + inputs: [ + { + internalType: "contract ENS", + name: "_old", + type: "address" + } + ], + payable: false, + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "ApprovalForAll", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "bytes32", + name: "label", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "NewOwner", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "NewResolver", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "NewTTL", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "Transfer", + type: "event" + }, + { + constant: true, + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "operator", + type: "address" + } + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [], + name: "old", + outputs: [ + { + internalType: "contract ENS", + name: "", + type: "address" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "recordExists", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "resolver", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "setApprovalForAll", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "setOwner", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setRecord", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "setResolver", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "label", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "setSubnodeOwner", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "label", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setSubnodeRecord", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setTTL", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "ttl", + outputs: [ + { + internalType: "uint64", + name: "", + type: "uint64" + } + ], + payable: false, + stateMutability: "view", + type: "function" + } +]; +class ENSRegistry__factory { + static abi = _abi$6; static createInterface() { return new ethers.Interface(_abi$6); } @@ -720,9 +6190,1031 @@ class ENS__factory { return new ethers.Contract(address, _abi$6, runner); } } -ENS__factory.abi = _abi$6; const _abi$5 = [ + { + inputs: [ + { + internalType: "contract ENS", + name: "_ens", + type: "address" + }, + { + internalType: "contract INameWrapper", + name: "wrapperAddress", + type: "address" + }, + { + internalType: "address", + name: "_trustedETHController", + type: "address" + }, + { + internalType: "address", + name: "_trustedReverseRegistrar", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "uint256", + name: "contentType", + type: "uint256" + } + ], + name: "ABIChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "a", + type: "address" + } + ], + name: "AddrChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint256", + name: "coinType", + type: "uint256" + }, + { + indexed: false, + internalType: "bytes", + name: "newAddress", + type: "bytes" + } + ], + name: "AddressChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "ApprovalForAll", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "delegate", + type: "address" + }, + { + indexed: true, + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "Approved", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes", + name: "hash", + type: "bytes" + } + ], + name: "ContenthashChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes", + name: "name", + type: "bytes" + }, + { + indexed: false, + internalType: "uint16", + name: "resource", + type: "uint16" + }, + { + indexed: false, + internalType: "bytes", + name: "record", + type: "bytes" + } + ], + name: "DNSRecordChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes", + name: "name", + type: "bytes" + }, + { + indexed: false, + internalType: "uint16", + name: "resource", + type: "uint16" + } + ], + name: "DNSRecordDeleted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes", + name: "lastzonehash", + type: "bytes" + }, + { + indexed: false, + internalType: "bytes", + name: "zonehash", + type: "bytes" + } + ], + name: "DNSZonehashChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "bytes4", + name: "interfaceID", + type: "bytes4" + }, + { + indexed: false, + internalType: "address", + name: "implementer", + type: "address" + } + ], + name: "InterfaceChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "string", + name: "name", + type: "string" + } + ], + name: "NameChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes32", + name: "x", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes32", + name: "y", + type: "bytes32" + } + ], + name: "PubkeyChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "string", + name: "indexedKey", + type: "string" + }, + { + indexed: false, + internalType: "string", + name: "key", + type: "string" + }, + { + indexed: false, + internalType: "string", + name: "value", + type: "string" + } + ], + name: "TextChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint64", + name: "newVersion", + type: "uint64" + } + ], + name: "VersionChanged", + type: "event" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint256", + name: "contentTypes", + type: "uint256" + } + ], + name: "ABI", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + }, + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "addr", + outputs: [ + { + internalType: "address payable", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint256", + name: "coinType", + type: "uint256" + } + ], + name: "addr", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "delegate", + type: "address" + }, + { + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "approve", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "clearRecords", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "contenthash", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "name", + type: "bytes32" + }, + { + internalType: "uint16", + name: "resource", + type: "uint16" + } + ], + name: "dnsRecord", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "name", + type: "bytes32" + } + ], + name: "hasDNSRecords", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes4", + name: "interfaceID", + type: "bytes4" + } + ], + name: "interfaceImplementer", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "delegate", + type: "address" + } + ], + name: "isApprovedFor", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "address", + name: "operator", + type: "address" + } + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes[]", + name: "data", + type: "bytes[]" + } + ], + name: "multicall", + outputs: [ + { + internalType: "bytes[]", + name: "results", + type: "bytes[]" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "nodehash", + type: "bytes32" + }, + { + internalType: "bytes[]", + name: "data", + type: "bytes[]" + } + ], + name: "multicallWithNodeCheck", + outputs: [ + { + internalType: "bytes[]", + name: "results", + type: "bytes[]" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "pubkey", + outputs: [ + { + internalType: "bytes32", + name: "x", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "y", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "recordVersions", + outputs: [ + { + internalType: "uint64", + name: "", + type: "uint64" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint256", + name: "contentType", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "setABI", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint256", + name: "coinType", + type: "uint256" + }, + { + internalType: "bytes", + name: "a", + type: "bytes" + } + ], + name: "setAddr", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "a", + type: "address" + } + ], + name: "setAddr", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "setApprovalForAll", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes", + name: "hash", + type: "bytes" + } + ], + name: "setContenthash", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "setDNSRecords", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes4", + name: "interfaceID", + type: "bytes4" + }, + { + internalType: "address", + name: "implementer", + type: "address" + } + ], + name: "setInterface", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "string", + name: "newName", + type: "string" + } + ], + name: "setName", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "x", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "y", + type: "bytes32" + } + ], + name: "setPubkey", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "string", + name: "key", + type: "string" + }, + { + internalType: "string", + name: "value", + type: "string" + } + ], + name: "setText", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes", + name: "hash", + type: "bytes" + } + ], + name: "setZonehash", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceID", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "string", + name: "key", + type: "string" + } + ], + name: "text", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "zonehash", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + } +]; +class ENSResolver__factory { + static abi = _abi$5; + static createInterface() { + return new ethers.Interface(_abi$5); + } + static connect(address, runner) { + return new ethers.Contract(address, _abi$5, runner); + } +} + +const _abi$4 = [ { constant: true, inputs: [], @@ -1024,205 +7516,7 @@ const _abi$5 = [ } ]; class ERC20__factory { - static createInterface() { - return new ethers.Interface(_abi$5); - } - static connect(address, runner) { - return new ethers.Contract(address, _abi$5, runner); - } -} -ERC20__factory.abi = _abi$5; - -const _abi$4 = [ - { - inputs: [], - stateMutability: "nonpayable", - type: "constructor" - }, - { - inputs: [], - name: "GAS_UNIT", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [ - { - internalType: "uint32", - name: "_derivationThresold", - type: "uint32" - } - ], - name: "changeDerivationThresold", - outputs: [], - stateMutability: "nonpayable", - type: "function" - }, - { - inputs: [ - { - internalType: "uint32", - name: "_gasUnit", - type: "uint32" - } - ], - name: "changeGasUnit", - outputs: [], - stateMutability: "nonpayable", - type: "function" - }, - { - inputs: [ - { - internalType: "uint32", - name: "_heartbeat", - type: "uint32" - } - ], - name: "changeHeartbeat", - outputs: [], - stateMutability: "nonpayable", - type: "function" - }, - { - inputs: [ - { - internalType: "address", - name: "_owner", - type: "address" - } - ], - name: "changeOwnership", - outputs: [], - stateMutability: "nonpayable", - type: "function" - }, - { - inputs: [], - name: "derivationThresold", - outputs: [ - { - internalType: "uint32", - name: "", - type: "uint32" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [], - name: "gasPrice", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [], - name: "heartbeat", - outputs: [ - { - internalType: "uint32", - name: "", - type: "uint32" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [], - name: "maxFeePerGas", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [], - name: "maxPriorityFeePerGas", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [], - name: "owner", - outputs: [ - { - internalType: "address", - name: "", - type: "address" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [], - name: "pastGasPrice", - outputs: [ - { - internalType: "uint32", - name: "", - type: "uint32" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [ - { - internalType: "uint32", - name: "_gasPrice", - type: "uint32" - } - ], - name: "setGasPrice", - outputs: [], - stateMutability: "nonpayable", - type: "function" - }, - { - inputs: [], - name: "timestamp", - outputs: [ - { - internalType: "uint32", - name: "", - type: "uint32" - } - ], - stateMutability: "view", - type: "function" - } -]; -class GasPriceOracle__factory { + static abi = _abi$4; static createInterface() { return new ethers.Interface(_abi$4); } @@ -1230,7 +7524,6 @@ class GasPriceOracle__factory { return new ethers.Contract(address, _abi$4, runner); } } -GasPriceOracle__factory.abi = _abi$4; const _abi$3 = [ { @@ -1673,6 +7966,7 @@ const _abi$3 = [ } ]; class Multicall__factory { + static abi = _abi$3; static createInterface() { return new ethers.Interface(_abi$3); } @@ -1680,7 +7974,6 @@ class Multicall__factory { return new ethers.Contract(address, _abi$3, runner); } } -Multicall__factory.abi = _abi$3; const _abi$2 = [ { @@ -2198,6 +8491,7 @@ const _abi$2 = [ } ]; class OffchainOracle__factory { + static abi = _abi$2; static createInterface() { return new ethers.Interface(_abi$2); } @@ -2205,7 +8499,6 @@ class OffchainOracle__factory { return new ethers.Contract(address, _abi$2, runner); } } -OffchainOracle__factory.abi = _abi$2; const _abi$1 = [ { @@ -2506,6 +8799,7 @@ const _abi$1 = [ } ]; class OvmGasPriceOracle__factory { + static abi = _abi$1; static createInterface() { return new ethers.Interface(_abi$1); } @@ -2513,7 +8807,6 @@ class OvmGasPriceOracle__factory { return new ethers.Contract(address, _abi$1, runner); } } -OvmGasPriceOracle__factory.abi = _abi$1; const _abi = [ { @@ -2548,6 +8841,7 @@ const _abi = [ } ]; class ReverseRecords__factory { + static abi = _abi; static createInterface() { return new ethers.Interface(_abi); } @@ -2555,3270 +8849,102 @@ class ReverseRecords__factory { return new ethers.Contract(address, _abi, runner); } } -ReverseRecords__factory.abi = _abi; var index = /*#__PURE__*/Object.freeze({ - __proto__: null, - ENS__factory: ENS__factory, - ERC20__factory: ERC20__factory, - GasPriceOracle__factory: GasPriceOracle__factory, - Multicall__factory: Multicall__factory, - OffchainOracle__factory: OffchainOracle__factory, - OvmGasPriceOracle__factory: OvmGasPriceOracle__factory, - ReverseRecords__factory: ReverseRecords__factory + __proto__: null, + ENSNameWrapper__factory: ENSNameWrapper__factory, + ENSRegistry__factory: ENSRegistry__factory, + ENSResolver__factory: ENSResolver__factory, + ENS__factory: ENS__factory, + ERC20__factory: ERC20__factory, + Multicall__factory: Multicall__factory, + OffchainOracle__factory: OffchainOracle__factory, + OvmGasPriceOracle__factory: OvmGasPriceOracle__factory, + ReverseRecords__factory: ReverseRecords__factory }); -BigInt.prototype.toJSON = function() { - return this.toString(); -}; -const isNode = !process.browser && typeof globalThis.window === "undefined"; -const crypto = isNode ? crypto$1.webcrypto : globalThis.crypto; -const chunk = (arr, size) => [...Array(Math.ceil(arr.length / size))].map((_, i) => arr.slice(size * i, size + size * i)); -function sleep(ms) { - return new Promise((resolve) => setTimeout(resolve, ms)); -} -function validateUrl(url, protocols) { - try { - const parsedUrl = new URL(url); - if (protocols && protocols.length) { - return protocols.map((p) => p.toLowerCase()).includes(parsedUrl.protocol); - } - return true; - } catch (e) { - return false; - } -} -function concatBytes(...arrays) { - const totalSize = arrays.reduce((acc, e) => acc + e.length, 0); - const merged = new Uint8Array(totalSize); - arrays.forEach((array, i, arrays2) => { - const offset = arrays2.slice(0, i).reduce((acc, e) => acc + e.length, 0); - merged.set(array, offset); - }); - return merged; -} -function bufferToBytes(b) { - return new Uint8Array(b.buffer); -} -function bytesToBase64(bytes) { - return btoa(String.fromCharCode.apply(null, Array.from(bytes))); -} -function base64ToBytes(base64) { - return Uint8Array.from(atob(base64), (c) => c.charCodeAt(0)); -} -function bytesToHex(bytes) { - return "0x" + Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join(""); -} -function hexToBytes(hexString) { - if (hexString.slice(0, 2) === "0x") { - hexString = hexString.replace("0x", ""); - } - if (hexString.length % 2 !== 0) { - hexString = "0" + hexString; - } - return Uint8Array.from(hexString.match(/.{1,2}/g).map((byte) => parseInt(byte, 16))); -} -function bytesToBN(bytes) { - return BigInt(bytesToHex(bytes)); -} -function bnToBytes(bigint) { - let hexString = typeof bigint === "bigint" ? bigint.toString(16) : bigint; - if (hexString.startsWith("0x")) { - hexString = hexString.replace("0x", ""); - } - if (hexString.length % 2 !== 0) { - hexString = "0" + hexString; - } - return Uint8Array.from(hexString.match(/.{1,2}/g).map((byte) => parseInt(byte, 16))); -} -function leBuff2Int(bytes) { - return new BN(bytes, 16, "le"); -} -function leInt2Buff(bigint) { - return Uint8Array.from(new BN(bigint).toArray("le", 31)); -} -function toFixedHex(numberish, length = 32) { - return "0x" + BigInt(numberish).toString(16).padStart(length * 2, "0"); -} -function toFixedLength(string, length = 32) { - string = string.replace("0x", ""); - return "0x" + string.padStart(length * 2, "0"); -} -function rBigInt(nbytes = 31) { - return bytesToBN(crypto.getRandomValues(new Uint8Array(nbytes))); -} -function bigIntReplacer(key, value) { - return typeof value === "bigint" ? value.toString() : value; -} -function substring(str, length = 10) { - if (str.length < length * 2) { - return str; - } - return `${str.substring(0, length)}...${str.substring(str.length - length)}`; -} - -var __async$c = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; -function multicall(Multicall2, calls) { - return __async$c(this, null, function* () { - const calldata = calls.map((call) => { - var _a, _b, _c; - const target = ((_a = call.contract) == null ? void 0 : _a.target) || call.address; - const callInterface = ((_b = call.contract) == null ? void 0 : _b.interface) || call.interface; - return { - target, - callData: callInterface.encodeFunctionData(call.name, call.params), - allowFailure: (_c = call.allowFailure) != null ? _c : false - }; - }); - const returnData = yield Multicall2.aggregate3.staticCall(calldata); - const res = returnData.map((call, i) => { - var _a; - const callInterface = ((_a = calls[i].contract) == null ? void 0 : _a.interface) || calls[i].interface; - const [result, data] = call; - const decodeResult = result && data && data !== "0x" ? callInterface.decodeFunctionResult(calls[i].name, data) : null; - return !decodeResult ? null : decodeResult.length === 1 ? decodeResult[0] : decodeResult; - }); - return res; - }); -} - -var __defProp$4 = Object.defineProperty; -var __defProps$3 = Object.defineProperties; -var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors; -var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols; -var __getProtoOf$1 = Object.getPrototypeOf; -var __hasOwnProp$4 = Object.prototype.hasOwnProperty; -var __propIsEnum$4 = Object.prototype.propertyIsEnumerable; -var __reflectGet$1 = Reflect.get; -var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __spreadValues$4 = (a, b) => { - for (var prop in b || (b = {})) - if (__hasOwnProp$4.call(b, prop)) - __defNormalProp$4(a, prop, b[prop]); - if (__getOwnPropSymbols$4) - for (var prop of __getOwnPropSymbols$4(b)) { - if (__propIsEnum$4.call(b, prop)) - __defNormalProp$4(a, prop, b[prop]); - } - return a; -}; -var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b)); -var __superGet$1 = (cls, obj, key) => __reflectGet$1(__getProtoOf$1(cls), key, obj); -var __async$b = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; -const defaultUserAgent = "Mozilla/5.0 (Windows NT 10.0; rv:109.0) Gecko/20100101 Firefox/115.0"; -const fetch = crossFetch; -function getHttpAgent({ - fetchUrl, - proxyUrl, - torPort, - retry -}) { - const { HttpProxyAgent } = require("http-proxy-agent"); - const { HttpsProxyAgent } = require("https-proxy-agent"); - const { SocksProxyAgent } = require("socks-proxy-agent"); - if (torPort) { - return new SocksProxyAgent(`socks5h://tor${retry}@127.0.0.1:${torPort}`); - } - if (!proxyUrl) { - return; - } - const isHttps = fetchUrl.includes("https://"); - if (proxyUrl.includes("socks://") || proxyUrl.includes("socks4://") || proxyUrl.includes("socks5://")) { - return new SocksProxyAgent(proxyUrl); - } - if (proxyUrl.includes("http://") || proxyUrl.includes("https://")) { - if (isHttps) { - return new HttpsProxyAgent(proxyUrl); - } - return new HttpProxyAgent(proxyUrl); - } -} -function fetchData(_0) { - return __async$b(this, arguments, function* (url, options = {}) { - var _a, _b, _c; - const MAX_RETRY = (_a = options.maxRetry) != null ? _a : 3; - const RETRY_ON = (_b = options.retryOn) != null ? _b : 500; - const userAgent = (_c = options.userAgent) != null ? _c : defaultUserAgent; - let retry = 0; - let errorObject; - if (!options.method) { - if (!options.body) { - options.method = "GET"; - } else { - options.method = "POST"; - } - } - if (!options.headers) { - options.headers = {}; - } - if (isNode && !options.headers["User-Agent"]) { - options.headers["User-Agent"] = userAgent; - } - while (retry < MAX_RETRY + 1) { - let timeout; - if (!options.signal && options.timeout) { - const controller = new AbortController(); - options.signal = controller.signal; - timeout = setTimeout(() => { - controller.abort(); - }, options.timeout); - } - if (!options.agent && isNode && (options.proxy || options.torPort)) { - options.agent = getHttpAgent({ - fetchUrl: url, - proxyUrl: options.proxy, - torPort: options.torPort, - retry - }); - } - if (options.debug && typeof options.debug === "function") { - options.debug("request", { - url, - retry, - errorObject, - options - }); - } - try { - const resp = yield fetch(url, { - method: options.method, - headers: options.headers, - body: options.body, - redirect: options.redirect, - signal: options.signal, - agent: options.agent - }); - if (options.debug && typeof options.debug === "function") { - options.debug("response", resp); - } - if (!resp.ok) { - const errMsg = `Request to ${url} failed with error code ${resp.status}: -` + (yield resp.text()); - throw new Error(errMsg); - } - if (options.returnResponse) { - return resp; - } - const contentType = resp.headers.get("content-type"); - if (contentType == null ? void 0 : contentType.includes("application/json")) { - return yield resp.json(); - } - if (contentType == null ? void 0 : contentType.includes("text")) { - return yield resp.text(); - } - return resp; - } catch (error) { - if (timeout) { - clearTimeout(timeout); - } - errorObject = error; - retry++; - yield sleep(RETRY_ON); - } finally { - if (timeout) { - clearTimeout(timeout); - } - } - } - if (options.debug && typeof options.debug === "function") { - options.debug("error", errorObject); - } - throw errorObject; - }); -} -const fetchGetUrlFunc = (options = {}) => (req, _signal) => __async$b(void 0, null, function* () { - let signal; - if (_signal) { - const controller = new AbortController(); - signal = controller.signal; - _signal.addListener(() => { - controller.abort(); - }); - } - const init = __spreadProps$3(__spreadValues$4({}, options), { - method: req.method || "POST", - headers: req.headers, - body: req.body || void 0, - signal, - returnResponse: true - }); - const resp = yield fetchData(req.url, init); - const headers = {}; - resp.headers.forEach((value, key) => { - headers[key.toLowerCase()] = value; - }); - const respBody = yield resp.arrayBuffer(); - const body = respBody == null ? null : new Uint8Array(respBody); - return { - statusCode: resp.status, - statusMessage: resp.statusText, - headers, - body - }; -}); -const oracleMapper = /* @__PURE__ */ new Map(); -const multicallMapper = /* @__PURE__ */ new Map(); -function getGasOraclePlugin(networkKey, fetchOptions) { - const gasStationApi = (fetchOptions == null ? void 0 : fetchOptions.gasStationApi) || "https://gasstation.polygon.technology/v2"; - return new ethers.FetchUrlFeeDataNetworkPlugin(gasStationApi, (fetchFeeData, provider, request) => __async$b(this, null, function* () { - if (!oracleMapper.has(networkKey)) { - oracleMapper.set(networkKey, GasPriceOracle__factory.connect(fetchOptions == null ? void 0 : fetchOptions.gasPriceOracle, provider)); - } - if (!multicallMapper.has(networkKey)) { - multicallMapper.set( - networkKey, - Multicall__factory.connect("0xcA11bde05977b3631167028862bE2a173976CA11", provider) - ); - } - const Oracle = oracleMapper.get(networkKey); - const Multicall2 = multicallMapper.get(networkKey); - const [timestamp, heartbeat, feePerGas, priorityFeePerGas] = yield multicall(Multicall2, [ - { - contract: Oracle, - name: "timestamp" - }, - { - contract: Oracle, - name: "heartbeat" - }, - { - contract: Oracle, - name: "maxFeePerGas" - }, - { - contract: Oracle, - name: "maxPriorityFeePerGas" - } - ]); - const isOutdated = Number(timestamp) <= Date.now() / 1e3 - Number(heartbeat); - if (!isOutdated) { - const maxPriorityFeePerGas = priorityFeePerGas * BigInt(13) / BigInt(10); - const maxFeePerGas = feePerGas * BigInt(2) + maxPriorityFeePerGas; - return { - gasPrice: maxFeePerGas, - maxFeePerGas, - maxPriorityFeePerGas - }; - } - const fetchReq = new ethers.FetchRequest(gasStationApi); - fetchReq.getUrlFunc = fetchGetUrlFunc(fetchOptions); - if (isNode) { - fetchReq.setHeader("User-Agent", "ethers"); - } - const [ - { - bodyJson: { fast } - }, - { gasPrice } - ] = yield Promise.all([fetchReq.send(), fetchFeeData()]); - return { - gasPrice, - maxFeePerGas: ethers.parseUnits(`${fast.maxFee}`, 9), - maxPriorityFeePerGas: ethers.parseUnits(`${fast.maxPriorityFee}`, 9) - }; - })); -} -function getProvider(rpcUrl, fetchOptions) { - return __async$b(this, null, function* () { - const fetchReq = new ethers.FetchRequest(rpcUrl); - fetchReq.getUrlFunc = fetchGetUrlFunc(fetchOptions); - const _staticNetwork = yield new ethers.JsonRpcProvider(fetchReq).getNetwork(); - const ensPlugin = _staticNetwork.getPlugin("org.ethers.plugins.network.Ens"); - const gasCostPlugin = _staticNetwork.getPlugin("org.ethers.plugins.network.GasCost"); - const gasStationPlugin = _staticNetwork.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin"); - const staticNetwork = new ethers.Network(_staticNetwork.name, _staticNetwork.chainId); - if (ensPlugin) { - staticNetwork.attachPlugin(ensPlugin); - } - if (gasCostPlugin) { - staticNetwork.attachPlugin(gasCostPlugin); - } - if (fetchOptions == null ? void 0 : fetchOptions.gasPriceOracle) { - staticNetwork.attachPlugin(getGasOraclePlugin(`${_staticNetwork.chainId}_${rpcUrl}`, fetchOptions)); - } else if (gasStationPlugin) { - staticNetwork.attachPlugin(gasStationPlugin); - } - const provider = new ethers.JsonRpcProvider(fetchReq, staticNetwork, { - staticNetwork - }); - provider.pollingInterval = (fetchOptions == null ? void 0 : fetchOptions.pollingInterval) || 1e3; - return provider; - }); -} -function getProviderWithNetId(netId, rpcUrl, config, fetchOptions) { - const { networkName, reverseRecordsContract, gasPriceOracleContract, gasStationApi, pollInterval } = config; - const hasEns = Boolean(reverseRecordsContract); - const fetchReq = new ethers.FetchRequest(rpcUrl); - fetchReq.getUrlFunc = fetchGetUrlFunc(fetchOptions); - const staticNetwork = new ethers.Network(networkName, netId); - if (hasEns) { - staticNetwork.attachPlugin(new ethers.EnsPlugin(null, Number(netId))); - } - staticNetwork.attachPlugin(new ethers.GasCostPlugin()); - if (gasPriceOracleContract) { - staticNetwork.attachPlugin( - getGasOraclePlugin(`${netId}_${rpcUrl}`, { - gasPriceOracle: gasPriceOracleContract, - gasStationApi - }) - ); - } - const provider = new ethers.JsonRpcProvider(fetchReq, staticNetwork, { - staticNetwork - }); - provider.pollingInterval = (fetchOptions == null ? void 0 : fetchOptions.pollingInterval) || pollInterval * 1e3; - return provider; -} -const populateTransaction = (signer, tx) => __async$b(void 0, null, function* () { - const provider = signer.provider; - if (!tx.from) { - tx.from = signer.address; - } else if (tx.from !== signer.address) { - const errMsg = `populateTransaction: signer mismatch for tx, wants ${tx.from} have ${signer.address}`; - throw new Error(errMsg); - } - const [feeData, nonce] = yield Promise.all([ - (() => __async$b(void 0, null, function* () { - if (tx.maxFeePerGas && tx.maxPriorityFeePerGas) { - return new ethers.FeeData(null, BigInt(tx.maxFeePerGas), BigInt(tx.maxPriorityFeePerGas)); - } - if (tx.gasPrice) { - return new ethers.FeeData(BigInt(tx.gasPrice), null, null); - } - const fetchedFeeData = yield provider.getFeeData(); - if (fetchedFeeData.maxFeePerGas && fetchedFeeData.maxPriorityFeePerGas) { - return new ethers.FeeData( - null, - fetchedFeeData.maxFeePerGas * (BigInt(1e4) + BigInt(signer.gasPriceBump)) / BigInt(1e4), - fetchedFeeData.maxPriorityFeePerGas - ); - } else { - return new ethers.FeeData( - fetchedFeeData.gasPrice * (BigInt(1e4) + BigInt(signer.gasPriceBump)) / BigInt(1e4), - null, - null - ); - } - }))(), - (() => __async$b(void 0, null, function* () { - if (tx.nonce) { - return tx.nonce; - } - let fetchedNonce = yield provider.getTransactionCount(signer.address, "pending"); - if (signer.bumpNonce && signer.nonce && signer.nonce >= fetchedNonce) { - console.log( - `populateTransaction: bumping nonce from ${fetchedNonce} to ${fetchedNonce + 1} for ${signer.address}` - ); - fetchedNonce++; - } - return fetchedNonce; - }))() - ]); - tx.nonce = nonce; - if (feeData.maxFeePerGas && feeData.maxPriorityFeePerGas) { - tx.maxFeePerGas = feeData.maxFeePerGas; - tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; - if (!tx.type) { - tx.type = 2; - } - delete tx.gasPrice; - } else if (feeData.gasPrice) { - tx.gasPrice = feeData.gasPrice; - if (!tx.type) { - tx.type = 0; - } - delete tx.maxFeePerGas; - delete tx.maxPriorityFeePerGas; - } - tx.gasLimit = tx.gasLimit || (yield (() => __async$b(void 0, null, function* () { - try { - const gasLimit = yield provider.estimateGas(tx); - return gasLimit === BigInt(21e3) ? gasLimit : gasLimit * (BigInt(1e4) + BigInt(signer.gasLimitBump)) / BigInt(1e4); - } catch (err) { - if (signer.gasFailover) { - console.log("populateTransaction: warning gas estimation failed falling back to 3M gas"); - return BigInt("3000000"); - } - throw err; - } - }))()); - return tx; -}); -class TornadoWallet extends ethers.Wallet { - constructor(key, provider, { gasPriceBump, gasLimitBump, gasFailover, bumpNonce } = {}) { - super(key, provider); - this.gasPriceBump = gasPriceBump != null ? gasPriceBump : 1e3; - this.gasLimitBump = gasLimitBump != null ? gasLimitBump : 3e3; - this.gasFailover = gasFailover != null ? gasFailover : false; - this.bumpNonce = bumpNonce != null ? bumpNonce : false; - } - static fromMnemonic(mneomnic, provider, index = 0, options) { - const defaultPath = `m/44'/60'/0'/0/${index}`; - const { privateKey } = ethers.HDNodeWallet.fromPhrase(mneomnic, void 0, defaultPath); - return new TornadoWallet(privateKey, provider, options); - } - populateTransaction(tx) { - return __async$b(this, null, function* () { - const txObject = yield populateTransaction(this, tx); - this.nonce = txObject.nonce; - return __superGet$1(TornadoWallet.prototype, this, "populateTransaction").call(this, txObject); - }); - } -} -class TornadoVoidSigner extends ethers.VoidSigner { - constructor(address, provider, { gasPriceBump, gasLimitBump, gasFailover, bumpNonce } = {}) { - super(address, provider); - this.gasPriceBump = gasPriceBump != null ? gasPriceBump : 1e3; - this.gasLimitBump = gasLimitBump != null ? gasLimitBump : 3e3; - this.gasFailover = gasFailover != null ? gasFailover : false; - this.bumpNonce = bumpNonce != null ? bumpNonce : false; - } - populateTransaction(tx) { - return __async$b(this, null, function* () { - const txObject = yield populateTransaction(this, tx); - this.nonce = txObject.nonce; - return __superGet$1(TornadoVoidSigner.prototype, this, "populateTransaction").call(this, txObject); - }); - } -} -class TornadoRpcSigner extends ethers.JsonRpcSigner { - constructor(provider, address, { gasPriceBump, gasLimitBump, gasFailover, bumpNonce } = {}) { - super(provider, address); - this.gasPriceBump = gasPriceBump != null ? gasPriceBump : 1e3; - this.gasLimitBump = gasLimitBump != null ? gasLimitBump : 3e3; - this.gasFailover = gasFailover != null ? gasFailover : false; - this.bumpNonce = bumpNonce != null ? bumpNonce : false; - } - sendUncheckedTransaction(tx) { - return __async$b(this, null, function* () { - return __superGet$1(TornadoRpcSigner.prototype, this, "sendUncheckedTransaction").call(this, yield populateTransaction(this, tx)); - }); - } -} -class TornadoBrowserProvider extends ethers.BrowserProvider { - constructor(ethereum, network, options) { - super(ethereum, network); - this.options = options; - } - getSigner(address) { - return __async$b(this, null, function* () { - var _a, _b, _c, _d, _e, _f, _g, _h, _i; - const signerAddress = (yield __superGet$1(TornadoBrowserProvider.prototype, this, "getSigner").call(this, address)).address; - if (((_a = this.options) == null ? void 0 : _a.webChainId) && ((_b = this.options) == null ? void 0 : _b.connectWallet) && Number(yield __superGet$1(TornadoBrowserProvider.prototype, this, "send").call(this, "eth_chainId", [])) !== Number((_c = this.options) == null ? void 0 : _c.webChainId)) { - yield this.options.connectWallet(); - } - if ((_d = this.options) == null ? void 0 : _d.handleNetworkChanges) { - (_e = window == null ? void 0 : window.ethereum) == null ? void 0 : _e.on("chainChanged", this.options.handleNetworkChanges); - } - if ((_f = this.options) == null ? void 0 : _f.handleAccountChanges) { - (_g = window == null ? void 0 : window.ethereum) == null ? void 0 : _g.on("accountsChanged", this.options.handleAccountChanges); - } - if ((_h = this.options) == null ? void 0 : _h.handleAccountDisconnect) { - (_i = window == null ? void 0 : window.ethereum) == null ? void 0 : _i.on("disconnect", this.options.handleAccountDisconnect); - } - return new TornadoRpcSigner(this, signerAddress, this.options); - }); - } -} - -const GET_STATISTIC = ` - query getStatistic($currency: String!, $amount: String!, $first: Int, $orderBy: BigInt, $orderDirection: String) { - deposits(first: $first, orderBy: $orderBy, orderDirection: $orderDirection, where: { currency: $currency, amount: $amount }) { - index - timestamp - blockNumber - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const _META = ` - query getMeta { - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_REGISTERED = ` - query getRegistered($first: Int, $fromBlock: Int) { - relayers(first: $first, orderBy: blockRegistration, orderDirection: asc, where: { - blockRegistration_gte: $fromBlock - }) { - id - address - ensName - blockRegistration - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_DEPOSITS = ` - query getDeposits($currency: String!, $amount: String!, $first: Int, $fromBlock: Int) { - deposits(first: $first, orderBy: index, orderDirection: asc, where: { - amount: $amount, - currency: $currency, - blockNumber_gte: $fromBlock - }) { - id - blockNumber - commitment - index - timestamp - from - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_WITHDRAWALS = ` - query getWithdrawals($currency: String!, $amount: String!, $first: Int, $fromBlock: Int!) { - withdrawals(first: $first, orderBy: blockNumber, orderDirection: asc, where: { - currency: $currency, - amount: $amount, - blockNumber_gte: $fromBlock - }) { - id - blockNumber - nullifier - to - fee - timestamp - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_NOTE_ACCOUNTS = ` - query getNoteAccount($address: String!) { - noteAccounts(where: { address: $address }) { - id - index - address - encryptedAccount - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_ECHO_EVENTS = ` - query getNoteAccounts($first: Int, $fromBlock: Int) { - noteAccounts(first: $first, orderBy: blockNumber, orderDirection: asc, where: { blockNumber_gte: $fromBlock }) { - id - blockNumber - address - encryptedAccount - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_ENCRYPTED_NOTES = ` - query getEncryptedNotes($first: Int, $fromBlock: Int) { - encryptedNotes(first: $first, orderBy: blockNumber, orderDirection: asc, where: { blockNumber_gte: $fromBlock }) { - blockNumber - index - transactionHash - encryptedNote - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_GOVERNANCE_EVENTS = ` - query getGovernanceEvents($first: Int, $fromBlock: Int) { - proposals(first: $first, orderBy: blockNumber, orderDirection: asc, where: { blockNumber_gte: $fromBlock }) { - blockNumber - logIndex - transactionHash - proposalId - proposer - target - startTime - endTime - description - } - votes(first: $first, orderBy: blockNumber, orderDirection: asc, where: { blockNumber_gte: $fromBlock }) { - blockNumber - logIndex - transactionHash - proposalId - voter - support - votes - from - input - } - delegates(first: $first, orderBy: blockNumber, orderDirection: asc, where: { blockNumber_gte: $fromBlock }) { - blockNumber - logIndex - transactionHash - account - delegateTo - } - undelegates(first: $first, orderBy: blockNumber, orderDirection: asc, where: { blockNumber_gte: $fromBlock }) { - blockNumber - logIndex - transactionHash - account - delegateFrom - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_GOVERNANCE_APY = ` - stakeDailyBurns(first: 30, orderBy: date, orderDirection: desc) { - id - date - dailyAmountBurned - } -`; - -var __defProp$3 = Object.defineProperty; -var __defProps$2 = Object.defineProperties; -var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors; -var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols; -var __hasOwnProp$3 = Object.prototype.hasOwnProperty; -var __propIsEnum$3 = Object.prototype.propertyIsEnumerable; -var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __spreadValues$3 = (a, b) => { - for (var prop in b || (b = {})) - if (__hasOwnProp$3.call(b, prop)) - __defNormalProp$3(a, prop, b[prop]); - if (__getOwnPropSymbols$3) - for (var prop of __getOwnPropSymbols$3(b)) { - if (__propIsEnum$3.call(b, prop)) - __defNormalProp$3(a, prop, b[prop]); - } - return a; -}; -var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b)); -var __async$a = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; -const isEmptyArray = (arr) => !Array.isArray(arr) || !arr.length; -const GRAPHQL_LIMIT = 1e3; -function queryGraph(_0) { - return __async$a(this, arguments, function* ({ - graphApi, - subgraphName, - query, - variables, - fetchDataOptions: fetchDataOptions2 - }) { - var _a; - const graphUrl = `${graphApi}/subgraphs/name/${subgraphName}`; - const { data, errors } = yield fetchData(graphUrl, __spreadProps$2(__spreadValues$3({}, fetchDataOptions2), { - method: "POST", - headers: { - "Content-Type": "application/json" - }, - body: JSON.stringify({ - query, - variables - }) - })); - if (errors) { - throw new Error(JSON.stringify(errors)); - } - if ((_a = data == null ? void 0 : data._meta) == null ? void 0 : _a.hasIndexingErrors) { - throw new Error("Subgraph has indexing errors"); - } - return data; - }); -} -function getStatistic(_0) { - return __async$a(this, arguments, function* ({ - graphApi, - subgraphName, - currency, - amount, - fetchDataOptions: fetchDataOptions2 - }) { - try { - const { - deposits, - _meta: { - block: { number: lastSyncBlock } - } - } = yield queryGraph({ - graphApi, - subgraphName, - query: GET_STATISTIC, - variables: { - currency, - first: 10, - orderBy: "index", - orderDirection: "desc", - amount - }, - fetchDataOptions: fetchDataOptions2 - }); - const events = deposits.map((e) => ({ - timestamp: Number(e.timestamp), - leafIndex: Number(e.index), - blockNumber: Number(e.blockNumber) - })).reverse(); - const [lastEvent] = events.slice(-1); - return { - events, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock - }; - } catch (err) { - console.log("Error from getStatistic query"); - console.log(err); - return { - events: [], - lastSyncBlock: null - }; - } - }); -} -function getMeta(_0) { - return __async$a(this, arguments, function* ({ graphApi, subgraphName, fetchDataOptions: fetchDataOptions2 }) { - try { - const { - _meta: { - block: { number: lastSyncBlock }, - hasIndexingErrors - } - } = yield queryGraph({ - graphApi, - subgraphName, - query: _META, - fetchDataOptions: fetchDataOptions2 - }); - return { - lastSyncBlock, - hasIndexingErrors - }; - } catch (err) { - console.log("Error from getMeta query"); - console.log(err); - return { - lastSyncBlock: null, - hasIndexingErrors: null - }; - } - }); -} -function getRegisters({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2 -}) { - return queryGraph({ - graphApi, - subgraphName, - query: GET_REGISTERED, - variables: { - first: GRAPHQL_LIMIT, - fromBlock - }, - fetchDataOptions: fetchDataOptions2 - }); -} -function getAllRegisters(_0) { - return __async$a(this, arguments, function* ({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2, - onProgress - }) { - try { - const events = []; - let lastSyncBlock = fromBlock; - while (true) { - let { - relayers: result2, - _meta: { - // eslint-disable-next-line prefer-const - block: { number: currentBlock } - } - } = yield getRegisters({ graphApi, subgraphName, fromBlock, fetchDataOptions: fetchDataOptions2 }); - lastSyncBlock = currentBlock; - if (isEmptyArray(result2)) { - break; - } - const [firstEvent] = result2; - const [lastEvent] = result2.slice(-1); - if (typeof onProgress === "function") { - onProgress({ - type: "Registers", - fromBlock: Number(firstEvent.blockRegistration), - toBlock: Number(lastEvent.blockRegistration), - count: result2.length - }); - } - if (result2.length < 900) { - events.push(...result2); - break; - } - result2 = result2.filter(({ blockRegistration }) => blockRegistration !== lastEvent.blockRegistration); - fromBlock = Number(lastEvent.blockRegistration); - events.push(...result2); - } - if (!events.length) { - return { - events: [], - lastSyncBlock - }; - } - const result = events.map(({ id, address, ensName, blockRegistration }) => { - const [transactionHash, logIndex] = id.split("-"); - return { - blockNumber: Number(blockRegistration), - logIndex: Number(logIndex), - transactionHash, - ensName, - relayerAddress: ethers.getAddress(address) - }; - }); - return { - events: result, - lastSyncBlock - }; - } catch (err) { - console.log("Error from getAllRegisters query"); - console.log(err); - return { events: [], lastSyncBlock: fromBlock }; - } - }); -} -function getDeposits({ - graphApi, - subgraphName, - currency, - amount, - fromBlock, - fetchDataOptions: fetchDataOptions2 -}) { - return queryGraph({ - graphApi, - subgraphName, - query: GET_DEPOSITS, - variables: { - currency, - amount, - first: GRAPHQL_LIMIT, - fromBlock - }, - fetchDataOptions: fetchDataOptions2 - }); -} -function getAllDeposits(_0) { - return __async$a(this, arguments, function* ({ - graphApi, - subgraphName, - currency, - amount, - fromBlock, - fetchDataOptions: fetchDataOptions2, - onProgress - }) { - try { - const events = []; - let lastSyncBlock = fromBlock; - while (true) { - let { - deposits: result2, - _meta: { - // eslint-disable-next-line prefer-const - block: { number: currentBlock } - } - } = yield getDeposits({ graphApi, subgraphName, currency, amount, fromBlock, fetchDataOptions: fetchDataOptions2 }); - lastSyncBlock = currentBlock; - if (isEmptyArray(result2)) { - break; - } - const [firstEvent] = result2; - const [lastEvent2] = result2.slice(-1); - if (typeof onProgress === "function") { - onProgress({ - type: "Deposits", - fromBlock: Number(firstEvent.blockNumber), - toBlock: Number(lastEvent2.blockNumber), - count: result2.length - }); - } - if (result2.length < 900) { - events.push(...result2); - break; - } - result2 = result2.filter(({ blockNumber }) => blockNumber !== lastEvent2.blockNumber); - fromBlock = Number(lastEvent2.blockNumber); - events.push(...result2); - } - if (!events.length) { - return { - events: [], - lastSyncBlock - }; - } - const result = events.map(({ id, blockNumber, commitment, index, timestamp, from }) => { - const [transactionHash, logIndex] = id.split("-"); - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - commitment, - leafIndex: Number(index), - timestamp: Number(timestamp), - from: ethers.getAddress(from) - }; - }); - const [lastEvent] = result.slice(-1); - return { - events: result, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock - }; - } catch (err) { - console.log("Error from getAllDeposits query"); - console.log(err); - return { - events: [], - lastSyncBlock: fromBlock - }; - } - }); -} -function getWithdrawals({ - graphApi, - subgraphName, - currency, - amount, - fromBlock, - fetchDataOptions: fetchDataOptions2 -}) { - return queryGraph({ - graphApi, - subgraphName, - query: GET_WITHDRAWALS, - variables: { - currency, - amount, - first: GRAPHQL_LIMIT, - fromBlock - }, - fetchDataOptions: fetchDataOptions2 - }); -} -function getAllWithdrawals(_0) { - return __async$a(this, arguments, function* ({ - graphApi, - subgraphName, - currency, - amount, - fromBlock, - fetchDataOptions: fetchDataOptions2, - onProgress - }) { - try { - const events = []; - let lastSyncBlock = fromBlock; - while (true) { - let { - withdrawals: result2, - _meta: { - // eslint-disable-next-line prefer-const - block: { number: currentBlock } - } - } = yield getWithdrawals({ graphApi, subgraphName, currency, amount, fromBlock, fetchDataOptions: fetchDataOptions2 }); - lastSyncBlock = currentBlock; - if (isEmptyArray(result2)) { - break; - } - const [firstEvent] = result2; - const [lastEvent2] = result2.slice(-1); - if (typeof onProgress === "function") { - onProgress({ - type: "Withdrawals", - fromBlock: Number(firstEvent.blockNumber), - toBlock: Number(lastEvent2.blockNumber), - count: result2.length - }); - } - if (result2.length < 900) { - events.push(...result2); - break; - } - result2 = result2.filter(({ blockNumber }) => blockNumber !== lastEvent2.blockNumber); - fromBlock = Number(lastEvent2.blockNumber); - events.push(...result2); - } - if (!events.length) { - return { - events: [], - lastSyncBlock - }; - } - const result = events.map(({ id, blockNumber, nullifier, to, fee, timestamp }) => { - const [transactionHash, logIndex] = id.split("-"); - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - nullifierHash: nullifier, - to: ethers.getAddress(to), - fee, - timestamp: Number(timestamp) - }; - }); - const [lastEvent] = result.slice(-1); - return { - events: result, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock - }; - } catch (err) { - console.log("Error from getAllWithdrawals query"); - console.log(err); - return { - events: [], - lastSyncBlock: fromBlock - }; - } - }); -} -function getNoteAccounts(_0) { - return __async$a(this, arguments, function* ({ - graphApi, - subgraphName, - address, - fetchDataOptions: fetchDataOptions2 - }) { - try { - const { - noteAccounts: events, - _meta: { - block: { number: lastSyncBlock } - } - } = yield queryGraph({ - graphApi, - subgraphName, - query: GET_NOTE_ACCOUNTS, - variables: { - address: address.toLowerCase() - }, - fetchDataOptions: fetchDataOptions2 - }); - return { - events, - lastSyncBlock - }; - } catch (err) { - console.log("Error from getNoteAccounts query"); - console.log(err); - return { - events: [], - lastSyncBlock: null - }; - } - }); -} -function getGraphEchoEvents({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2 -}) { - return queryGraph({ - graphApi, - subgraphName, - query: GET_ECHO_EVENTS, - variables: { - first: GRAPHQL_LIMIT, - fromBlock - }, - fetchDataOptions: fetchDataOptions2 - }); -} -function getAllGraphEchoEvents(_0) { - return __async$a(this, arguments, function* ({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2, - onProgress - }) { - try { - const events = []; - let lastSyncBlock = fromBlock; - while (true) { - let { - noteAccounts: result2, - _meta: { - // eslint-disable-next-line prefer-const - block: { number: currentBlock } - } - } = yield getGraphEchoEvents({ graphApi, subgraphName, fromBlock, fetchDataOptions: fetchDataOptions2 }); - lastSyncBlock = currentBlock; - if (isEmptyArray(result2)) { - break; - } - const [firstEvent] = result2; - const [lastEvent2] = result2.slice(-1); - if (typeof onProgress === "function") { - onProgress({ - type: "EchoEvents", - fromBlock: Number(firstEvent.blockNumber), - toBlock: Number(lastEvent2.blockNumber), - count: result2.length - }); - } - if (result2.length < 900) { - events.push(...result2); - break; - } - result2 = result2.filter(({ blockNumber }) => blockNumber !== lastEvent2.blockNumber); - fromBlock = Number(lastEvent2.blockNumber); - events.push(...result2); - } - if (!events.length) { - return { - events: [], - lastSyncBlock - }; - } - const result = events.map((e) => { - const [transactionHash, logIndex] = e.id.split("-"); - return { - blockNumber: Number(e.blockNumber), - logIndex: Number(logIndex), - transactionHash, - address: ethers.getAddress(e.address), - encryptedAccount: e.encryptedAccount - }; - }); - const [lastEvent] = result.slice(-1); - return { - events: result, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock - }; - } catch (err) { - console.log("Error from getAllGraphEchoEvents query"); - console.log(err); - return { - events: [], - lastSyncBlock: fromBlock - }; - } - }); -} -function getEncryptedNotes({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2 -}) { - return queryGraph({ - graphApi, - subgraphName, - query: GET_ENCRYPTED_NOTES, - variables: { - first: GRAPHQL_LIMIT, - fromBlock - }, - fetchDataOptions: fetchDataOptions2 - }); -} -function getAllEncryptedNotes(_0) { - return __async$a(this, arguments, function* ({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2, - onProgress - }) { - try { - const events = []; - let lastSyncBlock = fromBlock; - while (true) { - let { - encryptedNotes: result2, - _meta: { - // eslint-disable-next-line prefer-const - block: { number: currentBlock } - } - } = yield getEncryptedNotes({ graphApi, subgraphName, fromBlock, fetchDataOptions: fetchDataOptions2 }); - lastSyncBlock = currentBlock; - if (isEmptyArray(result2)) { - break; - } - const [firstEvent] = result2; - const [lastEvent2] = result2.slice(-1); - if (typeof onProgress === "function") { - onProgress({ - type: "EncryptedNotes", - fromBlock: Number(firstEvent.blockNumber), - toBlock: Number(lastEvent2.blockNumber), - count: result2.length - }); - } - if (result2.length < 900) { - events.push(...result2); - break; - } - result2 = result2.filter(({ blockNumber }) => blockNumber !== lastEvent2.blockNumber); - fromBlock = Number(lastEvent2.blockNumber); - events.push(...result2); - } - if (!events.length) { - return { - events: [], - lastSyncBlock - }; - } - const result = events.map((e) => ({ - blockNumber: Number(e.blockNumber), - logIndex: Number(e.index), - transactionHash: e.transactionHash, - encryptedNote: e.encryptedNote - })); - const [lastEvent] = result.slice(-1); - return { - events: result, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock - }; - } catch (err) { - console.log("Error from getAllEncryptedNotes query"); - console.log(err); - return { - events: [], - lastSyncBlock: fromBlock - }; - } - }); -} -function getGovernanceEvents({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2 -}) { - return queryGraph({ - graphApi, - subgraphName, - query: GET_GOVERNANCE_EVENTS, - variables: { - first: GRAPHQL_LIMIT, - fromBlock - }, - fetchDataOptions: fetchDataOptions2 - }); -} -function getAllGovernanceEvents(_0) { - return __async$a(this, arguments, function* ({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2, - onProgress - }) { - try { - const result = []; - let lastSyncBlock = fromBlock; - while (true) { - const { - proposals, - votes, - delegates, - undelegates, - _meta: { - block: { number: currentBlock } - } - } = yield getGovernanceEvents({ graphApi, subgraphName, fromBlock, fetchDataOptions: fetchDataOptions2 }); - lastSyncBlock = currentBlock; - const eventsLength = proposals.length + votes.length + delegates.length + undelegates.length; - if (eventsLength === 0) { - break; - } - const formattedProposals = proposals.map( - ({ blockNumber, logIndex, transactionHash, proposalId, proposer, target, startTime, endTime, description }) => { - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - event: "ProposalCreated", - id: Number(proposalId), - proposer: ethers.getAddress(proposer), - target: ethers.getAddress(target), - startTime: Number(startTime), - endTime: Number(endTime), - description - }; - } - ); - const formattedVotes = votes.map( - ({ blockNumber, logIndex, transactionHash, proposalId, voter, support, votes: votes2, from, input }) => { - if (!input || input.length > 2048) { - input = ""; - } - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - event: "Voted", - proposalId: Number(proposalId), - voter: ethers.getAddress(voter), - support, - votes: votes2, - from: ethers.getAddress(from), - input - }; - } - ); - const formattedDelegates = delegates.map( - ({ blockNumber, logIndex, transactionHash, account, delegateTo }) => { - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - event: "Delegated", - account: ethers.getAddress(account), - delegateTo: ethers.getAddress(delegateTo) - }; - } - ); - const formattedUndelegates = undelegates.map( - ({ blockNumber, logIndex, transactionHash, account, delegateFrom }) => { - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - event: "Undelegated", - account: ethers.getAddress(account), - delegateFrom: ethers.getAddress(delegateFrom) - }; - } - ); - let formattedEvents = [ - ...formattedProposals, - ...formattedVotes, - ...formattedDelegates, - ...formattedUndelegates - ].sort((a, b) => { - if (a.blockNumber === b.blockNumber) { - return a.logIndex - b.logIndex; - } - return a.blockNumber - b.blockNumber; - }); - if (eventsLength < 900) { - result.push(...formattedEvents); - break; - } - const [firstEvent] = formattedEvents; - const [lastEvent2] = formattedEvents.slice(-1); - if (typeof onProgress === "function") { - onProgress({ - type: "Governance Events", - fromBlock: Number(firstEvent.blockNumber), - toBlock: Number(lastEvent2.blockNumber), - count: eventsLength - }); - } - formattedEvents = formattedEvents.filter(({ blockNumber }) => blockNumber !== lastEvent2.blockNumber); - fromBlock = Number(lastEvent2.blockNumber); - result.push(...formattedEvents); - } - const [lastEvent] = result.slice(-1); - return { - events: result, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock - }; - } catch (err) { - console.log("Error from getAllGovernance query"); - console.log(err); - return { - events: [], - lastSyncBlock: fromBlock - }; - } - }); -} - -var graph = /*#__PURE__*/Object.freeze({ - __proto__: null, - GET_DEPOSITS: GET_DEPOSITS, - GET_ECHO_EVENTS: GET_ECHO_EVENTS, - GET_ENCRYPTED_NOTES: GET_ENCRYPTED_NOTES, - GET_GOVERNANCE_APY: GET_GOVERNANCE_APY, - GET_GOVERNANCE_EVENTS: GET_GOVERNANCE_EVENTS, - GET_NOTE_ACCOUNTS: GET_NOTE_ACCOUNTS, - GET_REGISTERED: GET_REGISTERED, - GET_STATISTIC: GET_STATISTIC, - GET_WITHDRAWALS: GET_WITHDRAWALS, - _META: _META, - getAllDeposits: getAllDeposits, - getAllEncryptedNotes: getAllEncryptedNotes, - getAllGovernanceEvents: getAllGovernanceEvents, - getAllGraphEchoEvents: getAllGraphEchoEvents, - getAllRegisters: getAllRegisters, - getAllWithdrawals: getAllWithdrawals, - getDeposits: getDeposits, - getEncryptedNotes: getEncryptedNotes, - getGovernanceEvents: getGovernanceEvents, - getGraphEchoEvents: getGraphEchoEvents, - getMeta: getMeta, - getNoteAccounts: getNoteAccounts, - getRegisters: getRegisters, - getStatistic: getStatistic, - getWithdrawals: getWithdrawals, - queryGraph: queryGraph -}); - -var __async$9 = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; -class BatchBlockService { - constructor({ - provider, - onProgress, - concurrencySize = 10, - batchSize = 10, - shouldRetry = true, - retryMax = 5, - retryOn = 500 - }) { - this.provider = provider; - this.onProgress = onProgress; - this.concurrencySize = concurrencySize; - this.batchSize = batchSize; - this.shouldRetry = shouldRetry; - this.retryMax = retryMax; - this.retryOn = retryOn; - } - getBlock(blockTag) { - return __async$9(this, null, function* () { - const blockObject = yield this.provider.getBlock(blockTag); - if (!blockObject) { - const errMsg = `No block for ${blockTag}`; - throw new Error(errMsg); - } - return blockObject; - }); - } - createBatchRequest(batchArray) { - return batchArray.map((blocks, index) => __async$9(this, null, function* () { - yield sleep(20 * index); - return (() => __async$9(this, null, function* () { - let retries = 0; - let err; - while (!this.shouldRetry && retries === 0 || this.shouldRetry && retries < this.retryMax) { - try { - return yield Promise.all(blocks.map((b) => this.getBlock(b))); - } catch (e) { - retries++; - err = e; - yield sleep(this.retryOn); - } - } - throw err; - }))(); - })); - } - getBatchBlocks(blocks) { - return __async$9(this, null, function* () { - let blockCount = 0; - const results = []; - for (const chunks of chunk(blocks, this.concurrencySize * this.batchSize)) { - const chunksResult = (yield Promise.all(this.createBatchRequest(chunk(chunks, this.batchSize)))).flat(); - results.push(...chunksResult); - blockCount += chunks.length; - if (typeof this.onProgress === "function") { - this.onProgress({ - percentage: blockCount / blocks.length, - currentIndex: blockCount, - totalIndex: blocks.length - }); - } - } - return results; - }); - } -} -class BatchTransactionService { - constructor({ - provider, - onProgress, - concurrencySize = 10, - batchSize = 10, - shouldRetry = true, - retryMax = 5, - retryOn = 500 - }) { - this.provider = provider; - this.onProgress = onProgress; - this.concurrencySize = concurrencySize; - this.batchSize = batchSize; - this.shouldRetry = shouldRetry; - this.retryMax = retryMax; - this.retryOn = retryOn; - } - getTransaction(txHash) { - return __async$9(this, null, function* () { - const txObject = yield this.provider.getTransaction(txHash); - if (!txObject) { - const errMsg = `No transaction for ${txHash}`; - throw new Error(errMsg); - } - return txObject; - }); - } - createBatchRequest(batchArray) { - return batchArray.map((txs, index) => __async$9(this, null, function* () { - yield sleep(20 * index); - return (() => __async$9(this, null, function* () { - let retries = 0; - let err; - while (!this.shouldRetry && retries === 0 || this.shouldRetry && retries < this.retryMax) { - try { - return yield Promise.all(txs.map((tx) => this.getTransaction(tx))); - } catch (e) { - retries++; - err = e; - yield sleep(this.retryOn); - } - } - throw err; - }))(); - })); - } - getBatchTransactions(txs) { - return __async$9(this, null, function* () { - let txCount = 0; - const results = []; - for (const chunks of chunk(txs, this.concurrencySize * this.batchSize)) { - const chunksResult = (yield Promise.all(this.createBatchRequest(chunk(chunks, this.batchSize)))).flat(); - results.push(...chunksResult); - txCount += chunks.length; - if (typeof this.onProgress === "function") { - this.onProgress({ percentage: txCount / txs.length, currentIndex: txCount, totalIndex: txs.length }); - } - } - return results; - }); - } -} -class BatchEventsService { - constructor({ - provider, - contract, - onProgress, - concurrencySize = 10, - blocksPerRequest = 2e3, - shouldRetry = true, - retryMax = 5, - retryOn = 500 - }) { - this.provider = provider; - this.contract = contract; - this.onProgress = onProgress; - this.concurrencySize = concurrencySize; - this.blocksPerRequest = blocksPerRequest; - this.shouldRetry = shouldRetry; - this.retryMax = retryMax; - this.retryOn = retryOn; - } - getPastEvents(_0) { - return __async$9(this, arguments, function* ({ fromBlock, toBlock, type }) { - let err; - let retries = 0; - while (!this.shouldRetry && retries === 0 || this.shouldRetry && retries < this.retryMax) { - try { - return yield this.contract.queryFilter(type, fromBlock, toBlock); - } catch (e) { - err = e; - retries++; - if (e.message.includes("after last accepted block")) { - const acceptedBlock = parseInt(e.message.split("after last accepted block ")[1]); - toBlock = acceptedBlock; - } - yield sleep(this.retryOn); - } - } - throw err; - }); - } - createBatchRequest(batchArray) { - return batchArray.map((event, index) => __async$9(this, null, function* () { - yield sleep(20 * index); - return this.getPastEvents(event); - })); - } - getBatchEvents(_0) { - return __async$9(this, arguments, function* ({ fromBlock, toBlock, type = "*" }) { - if (!toBlock) { - toBlock = yield this.provider.getBlockNumber(); - } - const eventsToSync = []; - for (let i = fromBlock; i < toBlock; i += this.blocksPerRequest) { - const j = i + this.blocksPerRequest - 1 > toBlock ? toBlock : i + this.blocksPerRequest - 1; - eventsToSync.push({ fromBlock: i, toBlock: j, type }); - } - const events = []; - const eventChunk = chunk(eventsToSync, this.concurrencySize); - let chunkCount = 0; - for (const chunk2 of eventChunk) { - chunkCount++; - const fetchedEvents = (yield Promise.all(this.createBatchRequest(chunk2))).flat(); - events.push(...fetchedEvents); - if (typeof this.onProgress === "function") { - this.onProgress({ - percentage: chunkCount / eventChunk.length, - type, - fromBlock: chunk2[0].fromBlock, - toBlock: chunk2[chunk2.length - 1].toBlock, - count: fetchedEvents.length - }); - } - } - return events; - }); - } -} - -var __defProp$2 = Object.defineProperty; -var __defProps$1 = Object.defineProperties; -var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors; -var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols; -var __getProtoOf = Object.getPrototypeOf; -var __hasOwnProp$2 = Object.prototype.hasOwnProperty; -var __propIsEnum$2 = Object.prototype.propertyIsEnumerable; -var __reflectGet = Reflect.get; -var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __spreadValues$2 = (a, b) => { - for (var prop in b || (b = {})) - if (__hasOwnProp$2.call(b, prop)) - __defNormalProp$2(a, prop, b[prop]); - if (__getOwnPropSymbols$2) - for (var prop of __getOwnPropSymbols$2(b)) { - if (__propIsEnum$2.call(b, prop)) - __defNormalProp$2(a, prop, b[prop]); - } - return a; -}; -var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b)); -var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj); -var __async$8 = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; -const DEPOSIT = "deposit"; -const WITHDRAWAL = "withdrawal"; -class BaseEventsService { - constructor({ - netId, - provider, - graphApi, - subgraphName, - contract, - type = "", - deployedBlock = 0, - fetchDataOptions: fetchDataOptions2 - }) { - this.netId = netId; - this.provider = provider; - this.graphApi = graphApi; - this.subgraphName = subgraphName; - this.fetchDataOptions = fetchDataOptions2; - this.contract = contract; - this.type = type; - this.deployedBlock = deployedBlock; - this.batchEventsService = new BatchEventsService({ - provider, - contract, - onProgress: this.updateEventProgress - }); - } - getInstanceName() { - return ""; - } - getType() { - return this.type || ""; - } - getGraphMethod() { - return ""; - } - getGraphParams() { - return { - graphApi: this.graphApi || "", - subgraphName: this.subgraphName || "", - fetchDataOptions: this.fetchDataOptions, - onProgress: this.updateGraphProgress - }; - } - /* eslint-disable @typescript-eslint/no-unused-vars */ - updateEventProgress({ percentage, type, fromBlock, toBlock, count }) { - } - updateBlockProgress({ percentage, currentIndex, totalIndex }) { - } - updateTransactionProgress({ percentage, currentIndex, totalIndex }) { - } - updateGraphProgress({ type, fromBlock, toBlock, count }) { - } - /* eslint-enable @typescript-eslint/no-unused-vars */ - formatEvents(events) { - return __async$8(this, null, function* () { - return yield new Promise((resolve) => resolve(events)); - }); - } - /** - * Get saved or cached events - */ - getEventsFromDB() { - return __async$8(this, null, function* () { - return { - events: [], - lastBlock: null - }; - }); - } - getEventsFromCache() { - return __async$8(this, null, function* () { - return { - events: [], - lastBlock: null - }; - }); - } - getSavedEvents() { - return __async$8(this, null, function* () { - let cachedEvents = yield this.getEventsFromDB(); - if (!cachedEvents || !cachedEvents.events.length) { - cachedEvents = yield this.getEventsFromCache(); - } - return cachedEvents; - }); - } - /** - * Get latest events - */ - getEventsFromGraph(_0) { - return __async$8(this, arguments, function* ({ - fromBlock, - methodName = "" - }) { - if (!this.graphApi || !this.subgraphName) { - return { - events: [], - lastBlock: fromBlock - }; - } - const { events, lastSyncBlock } = yield graph[methodName || this.getGraphMethod()](__spreadValues$2({ - fromBlock - }, this.getGraphParams())); - return { - events, - lastBlock: lastSyncBlock - }; - }); - } - getEventsFromRpc(_0) { - return __async$8(this, arguments, function* ({ - fromBlock, - toBlock - }) { - try { - if (!toBlock) { - toBlock = yield this.provider.getBlockNumber(); - } - if (fromBlock >= toBlock) { - return { - events: [], - lastBlock: toBlock - }; - } - this.updateEventProgress({ percentage: 0, type: this.getType() }); - const events = yield this.formatEvents( - yield this.batchEventsService.getBatchEvents({ fromBlock, toBlock, type: this.getType() }) - ); - if (!events.length) { - return { - events, - lastBlock: toBlock - }; - } - return { - events, - lastBlock: toBlock - }; - } catch (err) { - console.log(err); - return { - events: [], - lastBlock: fromBlock - }; - } - }); - } - getLatestEvents(_0) { - return __async$8(this, arguments, function* ({ fromBlock }) { - const allEvents = []; - const graphEvents = yield this.getEventsFromGraph({ fromBlock }); - const lastSyncBlock = graphEvents.lastBlock && graphEvents.lastBlock >= fromBlock ? graphEvents.lastBlock : fromBlock; - const rpcEvents = yield this.getEventsFromRpc({ fromBlock: lastSyncBlock }); - allEvents.push(...graphEvents.events); - allEvents.push(...rpcEvents.events); - const lastBlock = rpcEvents ? rpcEvents.lastBlock : allEvents[allEvents.length - 1] ? allEvents[allEvents.length - 1].blockNumber : fromBlock; - return { - events: allEvents, - lastBlock - }; - }); - } - // eslint-disable-next-line @typescript-eslint/no-unused-vars - validateEvents({ events, lastBlock }) { - } - /** - * Handle saving events - */ - // eslint-disable-next-line @typescript-eslint/no-unused-vars - saveEvents(_0) { - return __async$8(this, arguments, function* ({ events, lastBlock }) { - }); - } - /** - * Trigger saving and receiving latest events - */ - updateEvents() { - return __async$8(this, null, function* () { - const savedEvents = yield this.getSavedEvents(); - let fromBlock = this.deployedBlock; - if (savedEvents && savedEvents.lastBlock) { - fromBlock = savedEvents.lastBlock + 1; - } - const newEvents = yield this.getLatestEvents({ fromBlock }); - const eventSet = /* @__PURE__ */ new Set(); - let allEvents = []; - allEvents.push(...savedEvents.events); - allEvents.push(...newEvents.events); - allEvents = allEvents.sort((a, b) => { - if (a.blockNumber === b.blockNumber) { - return a.logIndex - b.logIndex; - } - return a.blockNumber - b.blockNumber; - }).filter(({ transactionHash, logIndex }) => { - const eventKey = `${transactionHash}_${logIndex}`; - const hasEvent = eventSet.has(eventKey); - eventSet.add(eventKey); - return !hasEvent; - }); - const lastBlock = newEvents ? newEvents.lastBlock : allEvents[allEvents.length - 1] ? allEvents[allEvents.length - 1].blockNumber : null; - this.validateEvents({ events: allEvents, lastBlock }); - this.saveEventsPromise = this.saveEvents({ events: allEvents, lastBlock }); - return { - events: allEvents, - lastBlock - }; - }); - } -} -class BaseTornadoService extends BaseEventsService { - constructor({ - netId, - provider, - graphApi, - subgraphName, - Tornado, - type, - amount, - currency, - deployedBlock, - fetchDataOptions: fetchDataOptions2 - }) { - super({ netId, provider, graphApi, subgraphName, contract: Tornado, type, deployedBlock, fetchDataOptions: fetchDataOptions2 }); - this.amount = amount; - this.currency = currency; - this.batchTransactionService = new BatchTransactionService({ - provider, - onProgress: this.updateTransactionProgress - }); - this.batchBlockService = new BatchBlockService({ - provider, - onProgress: this.updateBlockProgress - }); - } - getInstanceName() { - return `${this.getType().toLowerCase()}s_${this.netId}_${this.currency}_${this.amount}`; - } - getGraphMethod() { - return `getAll${this.getType()}s`; - } - getGraphParams() { - return { - graphApi: this.graphApi || "", - subgraphName: this.subgraphName || "", - amount: this.amount, - currency: this.currency, - fetchDataOptions: this.fetchDataOptions, - onProgress: this.updateGraphProgress - }; - } - formatEvents(events) { - return __async$8(this, null, function* () { - const type = this.getType().toLowerCase(); - if (type === DEPOSIT) { - const formattedEvents = events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { - const { commitment, leafIndex, timestamp } = args; - return { - blockNumber, - logIndex, - transactionHash, - commitment, - leafIndex: Number(leafIndex), - timestamp: Number(timestamp) - }; - }); - const txs = yield this.batchTransactionService.getBatchTransactions([ - ...new Set(formattedEvents.map(({ transactionHash }) => transactionHash)) - ]); - return formattedEvents.map((event) => { - const { from } = txs.find(({ hash }) => hash === event.transactionHash); - return __spreadProps$1(__spreadValues$2({}, event), { - from - }); - }); - } else { - const formattedEvents = events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { - const { nullifierHash, to, fee } = args; - return { - blockNumber, - logIndex, - transactionHash, - nullifierHash: String(nullifierHash), - to: ethers.getAddress(to), - fee: String(fee) - }; - }); - const blocks = yield this.batchBlockService.getBatchBlocks([ - ...new Set(formattedEvents.map(({ blockNumber }) => blockNumber)) - ]); - return formattedEvents.map((event) => { - const { timestamp } = blocks.find(({ number }) => number === event.blockNumber); - return __spreadProps$1(__spreadValues$2({}, event), { - timestamp - }); - }); - } - }); - } - validateEvents({ events }) { - if (events.length && this.getType().toLowerCase() === DEPOSIT) { - const lastEvent = events[events.length - 1]; - if (lastEvent.leafIndex !== events.length - 1) { - const errMsg = `Deposit events invalid wants ${events.length - 1} leafIndex have ${lastEvent.leafIndex}`; - throw new Error(errMsg); - } - } - } -} -class BaseEchoService extends BaseEventsService { - constructor({ - netId, - provider, - graphApi, - subgraphName, - Echoer, - deployedBlock, - fetchDataOptions: fetchDataOptions2 - }) { - super({ netId, provider, graphApi, subgraphName, contract: Echoer, deployedBlock, fetchDataOptions: fetchDataOptions2 }); - } - getInstanceName() { - return `echo_${this.netId}`; - } - getType() { - return "Echo"; - } - getGraphMethod() { - return "getAllGraphEchoEvents"; - } - formatEvents(events) { - return __async$8(this, null, function* () { - return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { - const { who, data } = args; - if (who && data) { - const eventObjects = { - blockNumber, - logIndex, - transactionHash - }; - return __spreadProps$1(__spreadValues$2({}, eventObjects), { - address: who, - encryptedAccount: data - }); - } - }).filter((e) => e); - }); - } - getEventsFromGraph(_0) { - return __async$8(this, arguments, function* ({ fromBlock }) { - if (!this.graphApi || this.graphApi.includes("api.thegraph.com")) { - return { - events: [], - lastBlock: fromBlock - }; - } - return __superGet(BaseEchoService.prototype, this, "getEventsFromGraph").call(this, { fromBlock }); - }); - } -} -class BaseEncryptedNotesService extends BaseEventsService { - constructor({ - netId, - provider, - graphApi, - subgraphName, - Router, - deployedBlock, - fetchDataOptions: fetchDataOptions2 - }) { - super({ netId, provider, graphApi, subgraphName, contract: Router, deployedBlock, fetchDataOptions: fetchDataOptions2 }); - } - getInstanceName() { - return `encrypted_notes_${this.netId}`; - } - getType() { - return "EncryptedNote"; - } - getGraphMethod() { - return "getAllEncryptedNotes"; - } - formatEvents(events) { - return __async$8(this, null, function* () { - return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { - const { encryptedNote } = args; - if (encryptedNote) { - const eventObjects = { - blockNumber, - logIndex, - transactionHash - }; - return __spreadProps$1(__spreadValues$2({}, eventObjects), { - encryptedNote - }); - } - }).filter((e) => e); - }); - } -} -class BaseGovernanceService extends BaseEventsService { - constructor({ - netId, - provider, - graphApi, - subgraphName, - Governance, - deployedBlock, - fetchDataOptions: fetchDataOptions2 - }) { - super({ netId, provider, graphApi, subgraphName, contract: Governance, deployedBlock, fetchDataOptions: fetchDataOptions2 }); - this.batchTransactionService = new BatchTransactionService({ - provider, - onProgress: this.updateTransactionProgress - }); - } - getInstanceName() { - return `governance_${this.netId}`; - } - getType() { - return "*"; - } - getGraphMethod() { - return "getAllGovernanceEvents"; - } - formatEvents(events) { - return __async$8(this, null, function* () { - const proposalEvents = []; - const votedEvents = []; - const delegatedEvents = []; - const undelegatedEvents = []; - events.forEach(({ blockNumber, index: logIndex, transactionHash, args, eventName: event }) => { - const eventObjects = { - blockNumber, - logIndex, - transactionHash, - event - }; - if (event === "ProposalCreated") { - const { id, proposer, target, startTime, endTime, description } = args; - proposalEvents.push(__spreadProps$1(__spreadValues$2({}, eventObjects), { - id: Number(id), - proposer, - target, - startTime: Number(startTime), - endTime: Number(endTime), - description - })); - } - if (event === "Voted") { - const { proposalId, voter, support, votes } = args; - votedEvents.push(__spreadProps$1(__spreadValues$2({}, eventObjects), { - proposalId: Number(proposalId), - voter, - support, - votes, - from: "", - input: "" - })); - } - if (event === "Delegated") { - const { account, to: delegateTo } = args; - delegatedEvents.push(__spreadProps$1(__spreadValues$2({}, eventObjects), { - account, - delegateTo - })); - } - if (event === "Undelegated") { - const { account, from: delegateFrom } = args; - undelegatedEvents.push(__spreadProps$1(__spreadValues$2({}, eventObjects), { - account, - delegateFrom - })); - } - }); - if (votedEvents.length) { - this.updateTransactionProgress({ percentage: 0 }); - const txs = yield this.batchTransactionService.getBatchTransactions([ - ...new Set(votedEvents.map(({ transactionHash }) => transactionHash)) - ]); - votedEvents.forEach((event, index) => { - let { data: input, from } = txs.find((t) => t.hash === event.transactionHash); - if (!input || input.length > 2048) { - input = ""; - } - votedEvents[index].from = from; - votedEvents[index].input = input; - }); - } - return [...proposalEvents, ...votedEvents, ...delegatedEvents, ...undelegatedEvents]; - }); - } - getEventsFromGraph(_0) { - return __async$8(this, arguments, function* ({ fromBlock }) { - if (!this.graphApi || !this.subgraphName || this.graphApi.includes("api.thegraph.com")) { - return { - events: [], - lastBlock: fromBlock - }; - } - return __superGet(BaseGovernanceService.prototype, this, "getEventsFromGraph").call(this, { fromBlock }); - }); - } -} -class BaseRegistryService extends BaseEventsService { - constructor({ - netId, - provider, - graphApi, - subgraphName, - RelayerRegistry, - deployedBlock, - fetchDataOptions: fetchDataOptions2 - }) { - super({ netId, provider, graphApi, subgraphName, contract: RelayerRegistry, deployedBlock, fetchDataOptions: fetchDataOptions2 }); - } - getInstanceName() { - return `registered_${this.netId}`; - } - // Name of type used for events - getType() { - return "RelayerRegistered"; - } - // Name of method used for graph - getGraphMethod() { - return "getAllRegisters"; - } - formatEvents(events) { - return __async$8(this, null, function* () { - return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { - const eventObjects = { - blockNumber, - logIndex, - transactionHash - }; - return __spreadProps$1(__spreadValues$2({}, eventObjects), { - ensName: args.ensName, - relayerAddress: args.relayerAddress - }); - }); - }); - } - fetchRelayers() { - return __async$8(this, null, function* () { - return (yield this.updateEvents()).events; - }); - } -} - -var __defProp$1 = Object.defineProperty; -var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols; -var __hasOwnProp$1 = Object.prototype.hasOwnProperty; -var __propIsEnum$1 = Object.prototype.propertyIsEnumerable; -var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __spreadValues$1 = (a, b) => { - for (var prop in b || (b = {})) - if (__hasOwnProp$1.call(b, prop)) - __defNormalProp$1(a, prop, b[prop]); - if (__getOwnPropSymbols$1) - for (var prop of __getOwnPropSymbols$1(b)) { - if (__propIsEnum$1.call(b, prop)) - __defNormalProp$1(a, prop, b[prop]); - } - return a; -}; -var NetId = /* @__PURE__ */ ((NetId2) => { - NetId2[NetId2["MAINNET"] = 1] = "MAINNET"; - NetId2[NetId2["BSC"] = 56] = "BSC"; - NetId2[NetId2["POLYGON"] = 137] = "POLYGON"; - NetId2[NetId2["OPTIMISM"] = 10] = "OPTIMISM"; - NetId2[NetId2["ARBITRUM"] = 42161] = "ARBITRUM"; - NetId2[NetId2["GNOSIS"] = 100] = "GNOSIS"; - NetId2[NetId2["AVALANCHE"] = 43114] = "AVALANCHE"; - NetId2[NetId2["SEPOLIA"] = 11155111] = "SEPOLIA"; - return NetId2; -})(NetId || {}); -const theGraph = { - name: "Hosted Graph", - url: "https://api.thegraph.com" -}; -const tornado = { - name: "Tornado Subgraphs", - url: "https://tornadocash-rpc.com" -}; -const defaultConfig = { - [1 /* MAINNET */]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 80, - fast: 50, - standard: 25, - low: 8 - }, - nativeCurrency: "eth", - currencyName: "ETH", - explorerUrl: "https://etherscan.io", - merkleTreeHeight: 20, - emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", - networkName: "Ethereum Mainnet", - deployedBlock: 9116966, - rpcUrls: { - tornadoRPC: { - name: "Tornado RPC", - url: "https://tornadocash-rpc.com/mainnet" - }, - chainnodes: { - name: "Chainnodes RPC", - url: "https://mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607" - }, - mevblockerRPC: { - name: "MevblockerRPC", - url: "https://rpc.mevblocker.io" - }, - oneRPC: { - name: "1RPC", - url: "https://1rpc.io/eth" - } - }, - multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", - routerContract: "0xd90e2f925DA726b50C4Ed8D0Fb90Ad053324F31b", - echoContract: "0x9B27DD5Bb15d42DC224FCD0B7caEbBe16161Df42", - offchainOracleContract: "0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8", - tornContract: "0x77777FeDdddFfC19Ff86DB637967013e6C6A116C", - governanceContract: "0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce", - stakingRewardsContract: "0x5B3f656C80E8ddb9ec01Dd9018815576E9238c29", - registryContract: "0x58E8dCC13BE9780fC42E8723D8EaD4CF46943dF2", - aggregatorContract: "0xE8F47A78A6D52D317D0D2FFFac56739fE14D1b49", - reverseRecordsContract: "0x3671aE578E63FdF66ad4F3E12CC0c0d71Ac7510C", - tornadoSubgraph: "tornadocash/mainnet-tornado-subgraph", - registrySubgraph: "tornadocash/tornado-relayer-registry", - governanceSubgraph: "tornadocash/tornado-governance", - subgraphs: { - tornado, - theGraph - }, - tokens: { - eth: { - instanceAddress: { - "0.1": "0x12D66f87A04A9E220743712cE6d9bB1B5616B8Fc", - "1": "0x47CE0C6eD5B0Ce3d3A51fdb1C52DC66a7c3c2936", - "10": "0x910Cbd523D972eb0a6f4cAe4618aD62622b39DbF", - "100": "0xA160cdAB225685dA1d56aa342Ad8841c3b53f291" - }, - symbol: "ETH", - decimals: 18 - }, - dai: { - instanceAddress: { - "100": "0xD4B88Df4D29F5CedD6857912842cff3b20C8Cfa3", - "1000": "0xFD8610d20aA15b7B2E3Be39B396a1bC3516c7144", - "10000": "0x07687e702b410Fa43f4cB4Af7FA097918ffD2730", - "100000": "0x23773E65ed146A459791799d01336DB287f25334" - }, - tokenAddress: "0x6B175474E89094C44Da98b954EedeAC495271d0F", - tokenGasLimit: 7e4, - symbol: "DAI", - decimals: 18, - gasLimit: 7e5 - }, - cdai: { - instanceAddress: { - "5000": "0x22aaA7720ddd5388A3c0A3333430953C68f1849b", - "50000": "0x03893a7c7463AE47D46bc7f091665f1893656003", - "500000": "0x2717c5e28cf931547B621a5dddb772Ab6A35B701", - "5000000": "0xD21be7248e0197Ee08E0c20D4a96DEBdaC3D20Af" - }, - tokenAddress: "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643", - tokenGasLimit: 2e5, - symbol: "cDAI", - decimals: 8, - gasLimit: 7e5 - }, - usdc: { - instanceAddress: { - "100": "0xd96f2B1c14Db8458374d9Aca76E26c3D18364307", - "1000": "0x4736dCf1b7A3d580672CcE6E7c65cd5cc9cFBa9D" - }, - tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - tokenGasLimit: 7e4, - symbol: "USDC", - decimals: 6, - gasLimit: 7e5 - }, - usdt: { - instanceAddress: { - "100": "0x169AD27A470D064DEDE56a2D3ff727986b15D52B", - "1000": "0x0836222F2B2B24A3F36f98668Ed8F0B38D1a872f" - }, - tokenAddress: "0xdAC17F958D2ee523a2206206994597C13D831ec7", - tokenGasLimit: 7e4, - symbol: "USDT", - decimals: 6, - gasLimit: 7e5 - }, - wbtc: { - instanceAddress: { - "0.1": "0x178169B423a011fff22B9e3F3abeA13414dDD0F1", - "1": "0x610B717796ad172B316836AC95a2ffad065CeaB4", - "10": "0xbB93e510BbCD0B7beb5A853875f9eC60275CF498" - }, - tokenAddress: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", - tokenGasLimit: 7e4, - symbol: "WBTC", - decimals: 8, - gasLimit: 7e5 - } - }, - relayerEnsSubdomain: "mainnet-tornado", - pollInterval: 15, - constants: { - GOVERNANCE_BLOCK: 11474695, - NOTE_ACCOUNT_BLOCK: 11842486, - ENCRYPTED_NOTES_BLOCK: 12143762, - REGISTRY_BLOCK: 14173129, - MINING_BLOCK_TIME: 15 - } - }, - [56 /* BSC */]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 5, - fast: 5, - standard: 5, - low: 5 - }, - nativeCurrency: "bnb", - currencyName: "BNB", - explorerUrl: "https://bscscan.com", - merkleTreeHeight: 20, - emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", - networkName: "Binance Smart Chain", - deployedBlock: 8158799, - multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", - routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", - echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", - offchainOracleContract: "0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8", - tornadoSubgraph: "tornadocash/bsc-tornado-subgraph", - subgraphs: { - tornado, - theGraph - }, - rpcUrls: { - tornadoRPC: { - name: "Tornado RPC", - url: "https://tornadocash-rpc.com/bsc" - }, - chainnodes: { - name: "Chainnodes RPC", - url: "https://bsc-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607" - }, - oneRPC: { - name: "1RPC", - url: "https://1rpc.io/bnb" - } - }, - tokens: { - bnb: { - instanceAddress: { - "0.1": "0x84443CFd09A48AF6eF360C6976C5392aC5023a1F", - "1": "0xd47438C816c9E7f2E2888E060936a499Af9582b3", - "10": "0x330bdFADE01eE9bF63C209Ee33102DD334618e0a", - "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD" - }, - symbol: "BNB", - decimals: 18 - } - }, - relayerEnsSubdomain: "bsc-tornado", - pollInterval: 10, - constants: { - NOTE_ACCOUNT_BLOCK: 8159269, - ENCRYPTED_NOTES_BLOCK: 8159269 - } - }, - [137 /* POLYGON */]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 100, - fast: 75, - standard: 50, - low: 30 - }, - nativeCurrency: "matic", - currencyName: "MATIC", - explorerUrl: "https://polygonscan.com", - merkleTreeHeight: 20, - emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", - networkName: "Polygon (Matic) Network", - deployedBlock: 16257962, - multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", - routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", - echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", - offchainOracleContract: "0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8", - gasPriceOracleContract: "0xF81A8D8D3581985D3969fe53bFA67074aDFa8F3C", - tornadoSubgraph: "tornadocash/matic-tornado-subgraph", - subgraphs: { - tornado, - theGraph - }, - rpcUrls: { - chainnodes: { - name: "Chainnodes RPC", - url: "https://polygon-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607" - }, - oneRpc: { - name: "1RPC", - url: "https://1rpc.io/matic" - } - }, - tokens: { - matic: { - instanceAddress: { - "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD", - "1000": "0xdf231d99Ff8b6c6CBF4E9B9a945CBAcEF9339178", - "10000": "0xaf4c0B70B2Ea9FB7487C7CbB37aDa259579fe040", - "100000": "0xa5C2254e4253490C54cef0a4347fddb8f75A4998" - }, - symbol: "MATIC", - decimals: 18 - } - }, - relayerEnsSubdomain: "polygon-tornado", - pollInterval: 10, - constants: { - NOTE_ACCOUNT_BLOCK: 16257996, - ENCRYPTED_NOTES_BLOCK: 16257996 - } - }, - [10 /* OPTIMISM */]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 1e-3, - fast: 1e-3, - standard: 1e-3, - low: 1e-3 - }, - nativeCurrency: "eth", - currencyName: "ETH", - explorerUrl: "https://optimistic.etherscan.io", - merkleTreeHeight: 20, - emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", - networkName: "Optimism", - deployedBlock: 2243689, - multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", - routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", - echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", - offchainOracleContract: "0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8", - ovmGasPriceOracleContract: "0x420000000000000000000000000000000000000F", - tornadoSubgraph: "tornadocash/optimism-tornado-subgraph", - subgraphs: { - tornado, - theGraph - }, - rpcUrls: { - tornadoRPC: { - name: "Tornado RPC", - url: "https://tornadocash-rpc.com/op" - }, - chainnodes: { - name: "Chainnodes RPC", - url: "https://optimism-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607" - }, - oneRpc: { - name: "1RPC", - url: "https://1rpc.io/op" - } - }, - tokens: { - eth: { - instanceAddress: { - "0.1": "0x84443CFd09A48AF6eF360C6976C5392aC5023a1F", - "1": "0xd47438C816c9E7f2E2888E060936a499Af9582b3", - "10": "0x330bdFADE01eE9bF63C209Ee33102DD334618e0a", - "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD" - }, - symbol: "ETH", - decimals: 18 - } - }, - relayerEnsSubdomain: "optimism-tornado", - pollInterval: 15, - constants: { - NOTE_ACCOUNT_BLOCK: 2243694, - ENCRYPTED_NOTES_BLOCK: 2243694 - } - }, - [42161 /* ARBITRUM */]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 4, - fast: 3, - standard: 2.52, - low: 2.29 - }, - nativeCurrency: "eth", - currencyName: "ETH", - explorerUrl: "https://arbiscan.io", - merkleTreeHeight: 20, - emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", - networkName: "Arbitrum One", - deployedBlock: 3430648, - multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", - routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", - echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", - offchainOracleContract: "0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8", - tornadoSubgraph: "tornadocash/arbitrum-tornado-subgraph", - subgraphs: { - tornado, - theGraph - }, - rpcUrls: { - tornadoRPC: { - name: "Tornado RPC", - url: "https://tornadocash-rpc.com/arbitrum" - }, - chainnodes: { - name: "Chainnodes RPC", - url: "https://arbitrum-one.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607" - }, - oneRpc: { - name: "1rpc", - url: "https://1rpc.io/arb" - }, - Arbitrum: { - name: "Arbitrum RPC", - url: "https://arb1.arbitrum.io/rpc" - } - }, - tokens: { - eth: { - instanceAddress: { - "0.1": "0x84443CFd09A48AF6eF360C6976C5392aC5023a1F", - "1": "0xd47438C816c9E7f2E2888E060936a499Af9582b3", - "10": "0x330bdFADE01eE9bF63C209Ee33102DD334618e0a", - "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD" - }, - symbol: "ETH", - decimals: 18 - } - }, - relayerEnsSubdomain: "arbitrum-tornado", - pollInterval: 15, - constants: { - NOTE_ACCOUNT_BLOCK: 3430605, - ENCRYPTED_NOTES_BLOCK: 3430605 - } - }, - [100 /* GNOSIS */]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 6, - fast: 5, - standard: 4, - low: 1 - }, - nativeCurrency: "xdai", - currencyName: "xDAI", - explorerUrl: "https://gnosisscan.io", - merkleTreeHeight: 20, - emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", - networkName: "Gnosis Chain", - deployedBlock: 17754561, - multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", - routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", - echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", - offchainOracleContract: "0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8", - tornadoSubgraph: "tornadocash/xdai-tornado-subgraph", - subgraphs: { - tornado, - theGraph - }, - rpcUrls: { - tornadoRPC: { - name: "Tornado RPC", - url: "https://tornadocash-rpc.com/gnosis" - }, - chainnodes: { - name: "Chainnodes RPC", - url: "https://gnosis-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607" - }, - blockPi: { - name: "BlockPi", - url: "https://gnosis.blockpi.network/v1/rpc/public" - } - }, - tokens: { - xdai: { - instanceAddress: { - "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD", - "1000": "0xdf231d99Ff8b6c6CBF4E9B9a945CBAcEF9339178", - "10000": "0xaf4c0B70B2Ea9FB7487C7CbB37aDa259579fe040", - "100000": "0xa5C2254e4253490C54cef0a4347fddb8f75A4998" - }, - symbol: "xDAI", - decimals: 18 - } - }, - relayerEnsSubdomain: "gnosis-tornado", - pollInterval: 15, - constants: { - NOTE_ACCOUNT_BLOCK: 17754564, - ENCRYPTED_NOTES_BLOCK: 17754564 - } - }, - [43114 /* AVALANCHE */]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 225, - fast: 35, - standard: 25, - low: 25 - }, - nativeCurrency: "avax", - currencyName: "AVAX", - explorerUrl: "https://snowtrace.io", - merkleTreeHeight: 20, - emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", - networkName: "Avalanche Mainnet", - deployedBlock: 4429818, - multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", - routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", - echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", - offchainOracleContract: "0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8", - tornadoSubgraph: "tornadocash/avalanche-tornado-subgraph", - subgraphs: { - theGraph - }, - rpcUrls: { - publicRpc: { - name: "Avalanche RPC", - url: "https://api.avax.network/ext/bc/C/rpc" - }, - meowRPC: { - name: "Meow RPC", - url: "https://avax.meowrpc.com" - }, - oneRPC: { - name: "OneRPC", - url: "https://1rpc.io/avax/c" - } - }, - tokens: { - avax: { - instanceAddress: { - "10": "0x330bdFADE01eE9bF63C209Ee33102DD334618e0a", - "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD", - "500": "0xaf8d1839c3c67cf571aa74B5c12398d4901147B3" - }, - symbol: "AVAX", - decimals: 18 - } - }, - relayerEnsSubdomain: "avalanche-tornado", - pollInterval: 10, - constants: { - NOTE_ACCOUNT_BLOCK: 4429813, - ENCRYPTED_NOTES_BLOCK: 4429813 - } - }, - [11155111 /* SEPOLIA */]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 2, - fast: 2, - standard: 2, - low: 2 - }, - nativeCurrency: "eth", - currencyName: "SepoliaETH", - explorerUrl: "https://sepolia.etherscan.io", - merkleTreeHeight: 20, - emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", - networkName: "Ethereum Sepolia", - deployedBlock: 5594395, - multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", - routerContract: "0x1572AFE6949fdF51Cb3E0856216670ae9Ee160Ee", - echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", - tornContract: "0x3AE6667167C0f44394106E197904519D808323cA", - governanceContract: "0xe5324cD7602eeb387418e594B87aCADee08aeCAD", - stakingRewardsContract: "0x6d0018890751Efd31feb8166711B16732E2b496b", - registryContract: "0x1428e5d2356b13778A13108b10c440C83011dfB8", - aggregatorContract: "0x4088712AC9fad39ea133cdb9130E465d235e9642", - reverseRecordsContract: "0xEc29700C0283e5Be64AcdFe8077d6cC95dE23C23", - tornadoSubgraph: "tornadocash/sepolia-tornado-subgraph", - subgraphs: { - tornado - }, - rpcUrls: { - tornadoRPC: { - name: "Tornado RPC", - url: "https://tornadocash-rpc.com/sepolia" - }, - sepolia: { - name: "Sepolia RPC", - url: "https://rpc.sepolia.org" - }, - chainnodes: { - name: "Chainnodes RPC", - url: "https://sepolia.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607" - } - }, - tokens: { - eth: { - instanceAddress: { - "0.1": "0x8C4A04d872a6C1BE37964A21ba3a138525dFF50b", - "1": "0x8cc930096B4Df705A007c4A039BDFA1320Ed2508", - "10": "0x8D10d506D29Fc62ABb8A290B99F66dB27Fc43585", - "100": "0x44c5C92ed73dB43888210264f0C8b36Fd68D8379" - }, - symbol: "ETH", - decimals: 18 - }, - dai: { - instanceAddress: { - "100": "0x6921fd1a97441dd603a997ED6DDF388658daf754", - "1000": "0x50a637770F5d161999420F7d70d888DE47207145", - "10000": "0xecD649870407cD43923A816Cc6334a5bdf113621", - "100000": "0x73B4BD04bF83206B6e979BE2507098F92EDf4F90" - }, - tokenAddress: "0xFF34B3d4Aee8ddCd6F9AFFFB6Fe49bD371b8a357", - tokenGasLimit: 7e4, - symbol: "DAI", - decimals: 18, - gasLimit: 7e5 - } - }, - relayerEnsSubdomain: "sepolia-tornado", - pollInterval: 15, - constants: { - GOVERNANCE_BLOCK: 5594395, - NOTE_ACCOUNT_BLOCK: 5594395, - ENCRYPTED_NOTES_BLOCK: 5594395, - MINING_BLOCK_TIME: 15 - } - } -}; -const enabledChains = Object.values(NetId).filter((n) => typeof n === "number"); -exports.customConfig = {}; -function addNetwork(newConfig) { - enabledChains.push( - ...Object.keys(newConfig).map((netId) => Number(netId)).filter((netId) => !enabledChains.includes(netId)) - ); - exports.customConfig = __spreadValues$1(__spreadValues$1({}, exports.customConfig), newConfig); -} -function getNetworkConfig() { - const allConfig = __spreadValues$1(__spreadValues$1({}, defaultConfig), exports.customConfig); - return enabledChains.reduce((acc, curr) => { - acc[curr] = allConfig[curr]; - return acc; - }, {}); -} -function getConfig(netId) { - const allConfig = getNetworkConfig(); - const chainConfig = allConfig[netId]; - if (!chainConfig) { - const errMsg = `No config found for network ${netId}!`; - throw new Error(errMsg); - } - return chainConfig; -} -function getInstanceByAddress({ netId, address }) { - const { tokens } = getConfig(netId); - for (const [currency, { instanceAddress }] of Object.entries(tokens)) { - for (const [amount, instance] of Object.entries(instanceAddress)) { - if (instance === address) { - return { - amount, - currency - }; - } - } - } -} -function getSubdomains() { - const allConfig = getNetworkConfig(); - return enabledChains.map((chain) => allConfig[chain].relayerEnsSubdomain); -} - -const addressType = { type: "string", pattern: "^0x[a-fA-F0-9]{40}$" }; -const bnType = { type: "string", BN: true }; -const statusSchema = { - type: "object", - properties: { - rewardAccount: addressType, - gasPrices: { - type: "object", - properties: { - fast: { type: "number" }, - additionalProperties: { type: "number" } - }, - required: ["fast"] - }, - netId: { type: "integer" }, - tornadoServiceFee: { type: "number", maximum: 20, minimum: 0 }, - latestBlock: { type: "number" }, - version: { type: "string" }, - health: { - type: "object", - properties: { - status: { const: "true" }, - error: { type: "string" } - }, - required: ["status"] - }, - currentQueue: { type: "number" } - }, - required: ["rewardAccount", "instances", "netId", "tornadoServiceFee", "version", "health"] -}; -function getStatusSchema(netId, config) { - const { tokens, optionalTokens = [], nativeCurrency } = config; - const schema = JSON.parse(JSON.stringify(statusSchema)); - const instances = Object.keys(tokens).reduce( - (acc, token) => { - const { instanceAddress, tokenAddress, symbol, decimals, optionalInstances = [] } = tokens[token]; - const amounts = Object.keys(instanceAddress); - const instanceProperties = { - type: "object", - properties: { - instanceAddress: { - type: "object", - properties: amounts.reduce((acc2, cur) => { - acc2[cur] = addressType; - return acc2; - }, {}), - required: amounts.filter((amount) => !optionalInstances.includes(amount)) - }, - decimals: { enum: [decimals] } - }, - required: ["instanceAddress", "decimals"].concat( - tokenAddress ? ["tokenAddress"] : [], - symbol ? ["symbol"] : [] - ) - }; - if (tokenAddress) { - instanceProperties.properties.tokenAddress = addressType; - } - if (symbol) { - instanceProperties.properties.symbol = { enum: [symbol] }; - } - acc.properties[token] = instanceProperties; - if (!optionalTokens.includes(token)) { - acc.required.push(token); - } - return acc; - }, - { - type: "object", - properties: {}, - required: [] - } - ); - schema.properties.instances = instances; - if (netId === NetId.MAINNET) { - const _tokens = Object.keys(tokens).filter((t) => t !== nativeCurrency); - const ethPrices = { - type: "object", - properties: _tokens.reduce((acc, token) => { - acc[token] = bnType; - return acc; - }, {}) - // required: _tokens - }; - schema.properties.ethPrices = ethPrices; - } - return schema; -} - -const jobsSchema = { - type: "object", - properties: { - error: { type: "string" }, - id: { type: "string" }, - type: { type: "string" }, - status: { type: "string" }, - contract: { type: "string" }, - proof: { type: "string" }, - args: { - type: "array", - items: { type: "string" } - }, - txHash: { type: "string" }, - confirmations: { type: "number" }, - failedReason: { type: "string" } - }, - required: ["id", "status"] -}; - -const ajv = new Ajv({ allErrors: true }); -ajv.addKeyword({ - keyword: "BN", - // eslint-disable-next-line @typescript-eslint/no-explicit-any - validate: (schema, data) => { - try { - BigInt(data); - return true; - } catch (e) { - return false; - } - }, - errors: true -}); - -var __async$7 = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; class Pedersen { + pedersenHash; + babyJub; + pedersenPromise; constructor() { this.pedersenPromise = this.initPedersen(); } - initPedersen() { - return __async$7(this, null, function* () { - this.pedersenHash = yield circomlibjs.buildPedersenHash(); - this.babyJub = this.pedersenHash.babyJub; - }); + async initPedersen() { + this.pedersenHash = await circomlibjs.buildPedersenHash(); + this.babyJub = this.pedersenHash.babyJub; } - unpackPoint(buffer) { - return __async$7(this, null, function* () { - var _a, _b; - yield this.pedersenPromise; - return (_b = this.babyJub) == null ? void 0 : _b.unpackPoint((_a = this.pedersenHash) == null ? void 0 : _a.hash(buffer)); - }); + async unpackPoint(buffer) { + await this.pedersenPromise; + return this.babyJub?.unpackPoint(this.pedersenHash?.hash(buffer)); } toStringBuffer(buffer) { - var _a; - return (_a = this.babyJub) == null ? void 0 : _a.F.toString(buffer); + return this.babyJub?.F.toString(buffer); } } const pedersen = new Pedersen(); -function buffPedersenHash(buffer) { - return __async$7(this, null, function* () { - const [hash] = yield pedersen.unpackPoint(buffer); - return pedersen.toStringBuffer(hash); - }); +async function buffPedersenHash(buffer) { + const [hash] = await pedersen.unpackPoint(buffer); + return pedersen.toStringBuffer(hash); } -var __async$6 = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; -function createDeposit(_0) { - return __async$6(this, arguments, function* ({ nullifier, secret }) { - const preimage = new Uint8Array([...leInt2Buff(nullifier), ...leInt2Buff(secret)]); - const noteHex = toFixedHex(bytesToBN(preimage), 62); - const commitment = BigInt(yield buffPedersenHash(preimage)); - const commitmentHex = toFixedHex(commitment); - const nullifierHash = BigInt(yield buffPedersenHash(leInt2Buff(nullifier))); - const nullifierHex = toFixedHex(nullifierHash); - return { - preimage, - noteHex, - commitment, - commitmentHex, - nullifierHash, - nullifierHex - }; - }); +function parseNote(noteString) { + const noteRegex = /tornado-(?\w+)-(?[\d.]+)-(?\d+)-0x(?[0-9a-fA-F]{124})/g; + const match = noteRegex.exec(noteString); + if (!match) { + return; + } + const { currency, amount, netId, noteHex } = match.groups; + return { + currency: currency.toLowerCase(), + amount, + netId: Number(netId), + noteHex: "0x" + noteHex, + note: noteString + }; +} +function parseInvoice(invoiceString) { + const invoiceRegex = /tornadoInvoice-(?\w+)-(?[\d.]+)-(?\d+)-0x(?[0-9a-fA-F]{64})/g; + const match = invoiceRegex.exec(invoiceString); + if (!match) { + return; + } + const { currency, amount, netId, commitmentHex } = match.groups; + return { + currency: currency.toLowerCase(), + amount, + netId: Number(netId), + commitmentHex: "0x" + commitmentHex, + invoice: invoiceString + }; +} +async function createDeposit({ nullifier, secret }) { + const preimage = new Uint8Array([...leInt2Buff(nullifier), ...leInt2Buff(secret)]); + const noteHex = toFixedHex(bytesToBN(preimage), 62); + const commitment = BigInt(await buffPedersenHash(preimage)); + const commitmentHex = toFixedHex(commitment); + const nullifierHash = BigInt(await buffPedersenHash(leInt2Buff(nullifier))); + const nullifierHex = toFixedHex(nullifierHash); + return { + preimage, + noteHex, + commitment, + commitmentHex, + nullifierHash, + nullifierHex + }; } class Deposit { + currency; + amount; + netId; + nullifier; + secret; + note; + noteHex; + invoice; + commitmentHex; + nullifierHex; constructor({ currency, amount, @@ -5860,81 +8986,77 @@ class Deposit { 2 ); } - static createNote(_0) { - return __async$6(this, arguments, function* ({ currency, amount, netId, nullifier, secret }) { - if (!nullifier) { - nullifier = rBigInt(31); - } - if (!secret) { - secret = rBigInt(31); - } - const depositObject = yield createDeposit({ - nullifier, - secret - }); - const newDeposit = new Deposit({ - currency: currency.toLowerCase(), - amount, - netId, - note: `tornado-${currency.toLowerCase()}-${amount}-${netId}-${depositObject.noteHex}`, - noteHex: depositObject.noteHex, - invoice: `tornadoInvoice-${currency.toLowerCase()}-${amount}-${netId}-${depositObject.commitmentHex}`, - nullifier, - secret, - commitmentHex: depositObject.commitmentHex, - nullifierHex: depositObject.nullifierHex - }); - return newDeposit; + static async createNote({ currency, amount, netId, nullifier, secret }) { + if (!nullifier) { + nullifier = rBigInt(31); + } + if (!secret) { + secret = rBigInt(31); + } + const depositObject = await createDeposit({ + nullifier, + secret }); + const newDeposit = new Deposit({ + currency: currency.toLowerCase(), + amount, + netId, + note: `tornado-${currency.toLowerCase()}-${amount}-${netId}-${depositObject.noteHex}`, + noteHex: depositObject.noteHex, + invoice: `tornadoInvoice-${currency.toLowerCase()}-${amount}-${netId}-${depositObject.commitmentHex}`, + nullifier, + secret, + commitmentHex: depositObject.commitmentHex, + nullifierHex: depositObject.nullifierHex + }); + return newDeposit; } - static parseNote(noteString) { - return __async$6(this, null, function* () { - const noteRegex = new RegExp("tornado-(?\\w+)-(?[\\d.]+)-(?\\d+)-0x(?[0-9a-fA-F]{124})", "g"); - const match = noteRegex.exec(noteString); - if (!match) { - throw new Error("The note has invalid format"); - } - const matchGroup = match == null ? void 0 : match.groups; - const currency = matchGroup.currency.toLowerCase(); - const amount = matchGroup.amount; - const netId = Number(matchGroup.netId); - const bytes = bnToBytes("0x" + matchGroup.note); - const nullifier = BigInt(leBuff2Int(bytes.slice(0, 31)).toString()); - const secret = BigInt(leBuff2Int(bytes.slice(31, 62)).toString()); - const depositObject = yield createDeposit({ nullifier, secret }); - const invoice = `tornadoInvoice-${currency}-${amount}-${netId}-${depositObject.commitmentHex}`; - const newDeposit = new Deposit({ - currency, - amount, - netId, - note: noteString, - noteHex: depositObject.noteHex, - invoice, - nullifier, - secret, - commitmentHex: depositObject.commitmentHex, - nullifierHex: depositObject.nullifierHex - }); - return newDeposit; + static async parseNote(noteString) { + const parsedNote = parseNote(noteString); + if (!parsedNote) { + throw new Error("The note has invalid format"); + } + const { currency, amount, netId, note, noteHex: parsedNoteHex } = parsedNote; + const bytes = bnToBytes(parsedNoteHex); + const nullifier = BigInt(leBuff2Int(bytes.slice(0, 31)).toString()); + const secret = BigInt(leBuff2Int(bytes.slice(31, 62)).toString()); + const { noteHex, commitmentHex, nullifierHex } = await createDeposit({ + nullifier, + secret }); + const invoice = `tornadoInvoice-${currency}-${amount}-${netId}-${commitmentHex}`; + const newDeposit = new Deposit({ + currency, + amount, + netId, + note, + noteHex, + invoice, + nullifier, + secret, + commitmentHex, + nullifierHex + }); + return newDeposit; } } class Invoice { + currency; + amount; + netId; + commitmentHex; + invoice; constructor(invoiceString) { - const invoiceRegex = new RegExp("tornadoInvoice-(?\\w+)-(?[\\d.]+)-(?\\d+)-0x(?[0-9a-fA-F]{64})", "g"); - const match = invoiceRegex.exec(invoiceString); - if (!match) { - throw new Error("The note has invalid format"); + const parsedInvoice = parseInvoice(invoiceString); + if (!parsedInvoice) { + throw new Error("The invoice has invalid format"); } - const matchGroup = match == null ? void 0 : match.groups; - const currency = matchGroup.currency.toLowerCase(); - const amount = matchGroup.amount; - const netId = Number(matchGroup.netId); + const { currency, amount, netId, invoice, commitmentHex } = parsedInvoice; this.currency = currency; this.amount = amount; this.netId = netId; - this.commitment = "0x" + matchGroup.commitment; - this.invoice = invoiceString; + this.commitmentHex = commitmentHex; + this.invoice = invoice; } toString() { return JSON.stringify( @@ -5942,7 +9064,7 @@ class Invoice { currency: this.currency, amount: this.amount, netId: this.netId, - commitment: this.commitment, + commitmentHex: this.commitmentHex, invoice: this.invoice }, null, @@ -5972,27 +9094,37 @@ function unpackEncryptedMessage(encryptedMessage) { }; } class NoteAccount { - constructor({ netId, blockNumber, recoveryKey, Echoer: Echoer2 }) { + blockNumber; + // Dedicated 32 bytes private key only used for note encryption, backed up to an Echoer and local for future derivation + // Note that unlike the private key it shouldn't have the 0x prefix + recoveryKey; + // Address derived from recoveryKey, only used for frontend UI + recoveryAddress; + // Note encryption public key derived from recoveryKey + recoveryPublicKey; + constructor({ blockNumber, recoveryKey }) { if (!recoveryKey) { - recoveryKey = bytesToHex(crypto.getRandomValues(new Uint8Array(32))).slice(2); + recoveryKey = rHex(32).slice(2); } - this.netId = Math.floor(Number(netId)); this.blockNumber = blockNumber; this.recoveryKey = recoveryKey; this.recoveryAddress = ethers.computeAddress("0x" + recoveryKey); this.recoveryPublicKey = ethSigUtil.getEncryptionPublicKey(recoveryKey); - this.Echoer = Echoer2; } /** * Intends to mock eth_getEncryptionPublicKey behavior from MetaMask * In order to make the recoveryKey retrival from Echoer possible from the bare private key */ - static getWalletPublicKey(wallet) { - let { privateKey } = wallet; - if (privateKey.startsWith("0x")) { - privateKey = privateKey.replace("0x", ""); + static async getSignerPublicKey(signer) { + if (signer.privateKey) { + const wallet = signer; + const privateKey = wallet.privateKey.slice(0, 2) === "0x" ? wallet.privateKey.slice(2) : wallet.privateKey; + return ethSigUtil.getEncryptionPublicKey(privateKey); } - return ethSigUtil.getEncryptionPublicKey(privateKey); + const provider = signer.provider; + return await provider.send("eth_getEncryptionPublicKey", [ + signer.address + ]); } // This function intends to provide an encrypted value of recoveryKey for an on-chain Echoer backup purpose // Thus, the pubKey should be derived by a Wallet instance or from Web3 wallets @@ -6016,28 +9148,45 @@ class NoteAccount { /** * Decrypt Echoer backuped note encryption account with private keys */ - decryptAccountsWithWallet(wallet, events) { - let { privateKey } = wallet; - if (privateKey.startsWith("0x")) { - privateKey = privateKey.replace("0x", ""); - } + static async decryptSignerNoteAccounts(signer, events) { + const signerAddress = signer.address; const decryptedEvents = []; for (const event of events) { + if (event.address !== signerAddress) { + continue; + } try { const unpackedMessage = unpackEncryptedMessage(event.encryptedAccount); - const recoveryKey = ethSigUtil.decrypt({ - encryptedData: unpackedMessage, - privateKey - }); + let recoveryKey; + if (signer.privateKey) { + const wallet = signer; + const privateKey = wallet.privateKey.slice(0, 2) === "0x" ? wallet.privateKey.slice(2) : wallet.privateKey; + recoveryKey = ethSigUtil.decrypt({ + encryptedData: unpackedMessage, + privateKey + }); + } else { + const { version, nonce, ephemPublicKey, ciphertext } = unpackedMessage; + const unpackedBuffer = bytesToHex( + new TextEncoder().encode( + JSON.stringify({ + version, + nonce, + ephemPublicKey, + ciphertext + }) + ) + ); + const provider = signer.provider; + recoveryKey = await provider.send("eth_decrypt", [unpackedBuffer, signerAddress]); + } decryptedEvents.push( new NoteAccount({ - netId: this.netId, blockNumber: event.blockNumber, - recoveryKey, - Echoer: this.Echoer + recoveryKey }) ); - } catch (e) { + } catch { continue; } } @@ -6057,7 +9206,7 @@ class NoteAccount { address: ethers.getAddress(address), noteHex }); - } catch (e) { + } catch { continue; } } @@ -6073,19 +9222,144 @@ class NoteAccount { } } +function encodedLabelToLabelhash(label) { + if (label.length !== 66) return null; + if (label.indexOf("[") !== 0) return null; + if (label.indexOf("]") !== 65) return null; + const hash = `0x${label.slice(1, 65)}`; + if (!isHex(hash)) return null; + return hash; +} +function labelhash(label) { + if (!label) { + return bytesToHex(new Uint8Array(32).fill(0)); + } + return encodedLabelToLabelhash(label) || ethers.keccak256(new TextEncoder().encode(label)); +} +function makeLabelNodeAndParent(name) { + const labels = name.split("."); + const label = labels.shift(); + const parentNode = ethers.namehash(labels.join(".")); + return { + label, + labelhash: labelhash(label), + parentNode + }; +} +const EnsContracts = { + [NetId.MAINNET]: { + ensRegistry: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + ensPublicResolver: "0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63", + ensNameWrapper: "0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401" + }, + [NetId.SEPOLIA]: { + ensRegistry: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + ensPublicResolver: "0x8FADE66B79cC9f707aB26799354482EB93a5B7dD", + ensNameWrapper: "0x0635513f179D50A207757E05759CbD106d7dFcE8" + } +}; +class ENSUtils { + ENSRegistry; + ENSResolver; + ENSNameWrapper; + provider; + constructor(provider) { + this.provider = provider; + } + async getContracts() { + const { chainId } = await this.provider.getNetwork(); + const { ensRegistry, ensPublicResolver, ensNameWrapper } = EnsContracts[Number(chainId)]; + this.ENSRegistry = ENSRegistry__factory.connect(ensRegistry, this.provider); + this.ENSResolver = ENSResolver__factory.connect(ensPublicResolver, this.provider); + this.ENSNameWrapper = ENSNameWrapper__factory.connect(ensNameWrapper, this.provider); + } + async getOwner(name) { + if (!this.ENSRegistry) { + await this.getContracts(); + } + return this.ENSRegistry.owner(ethers.namehash(name)); + } + // nameWrapper connected with wallet signer + async unwrap(signer, name) { + if (!this.ENSNameWrapper) { + await this.getContracts(); + } + const owner = signer.address; + const nameWrapper = this.ENSNameWrapper.connect(signer); + const { labelhash: labelhash2 } = makeLabelNodeAndParent(name); + return nameWrapper.unwrapETH2LD(labelhash2, owner, owner); + } + // https://github.com/ensdomains/ensjs/blob/main/packages/ensjs/src/functions/wallet/createSubname.ts + async setSubnodeRecord(signer, name) { + if (!this.ENSResolver) { + await this.getContracts(); + } + const resolver = this.ENSResolver; + const registry = this.ENSRegistry.connect(signer); + const owner = signer.address; + const { labelhash: labelhash2, parentNode } = makeLabelNodeAndParent(name); + return registry.setSubnodeRecord(parentNode, labelhash2, owner, resolver.target, BigInt(0)); + } + getResolver(name) { + return ethers.EnsResolver.fromName(this.provider, name); + } + async getText(name, key) { + const resolver = await this.getResolver(name); + if (!resolver) { + return resolver; + } + return await resolver.getText(key) || ""; + } + // https://github.com/ensdomains/ensjs/blob/main/packages/ensjs/src/functions/wallet/setTextRecord.ts + async setText(signer, name, key, value) { + const resolver = ENSResolver__factory.connect((await this.getResolver(name))?.address, signer); + return resolver.setText(ethers.namehash(name), key, value); + } +} + const DUMMY_ADDRESS = "0x1111111111111111111111111111111111111111"; -const DUMMY_NONCE = "0x1111111111111111111111111111111111111111111111111111111111111111"; +const DUMMY_NONCE = 1024; const DUMMY_WITHDRAW_DATA = "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"; function convertETHToTokenAmount(amountInWei, tokenPriceInWei, tokenDecimals = 18) { const tokenDecimalsMultiplier = BigInt(10 ** Number(tokenDecimals)); return BigInt(amountInWei) * tokenDecimalsMultiplier / BigInt(tokenPriceInWei); } class TornadoFeeOracle { - constructor(ovmGasPriceOracle) { + provider; + ovmGasPriceOracle; + constructor(provider, ovmGasPriceOracle) { + this.provider = provider; if (ovmGasPriceOracle) { this.ovmGasPriceOracle = ovmGasPriceOracle; } } + /** + * Calculates Gas Price + * We apply 50% premium of EIP-1559 network fees instead of 100% from ethers.js + * (This should cover up to 4 full blocks which is equivalent of minute) + * (A single block can bump 12.5% of fees, see the methodology https://hackmd.io/@tvanepps/1559-wallets) + * (Still it is recommended to use 100% premium for sending transactions to prevent stucking it) + */ + async gasPrice() { + const [block, getGasPrice, getPriorityFee] = await Promise.all([ + this.provider.getBlock("latest"), + (async () => { + try { + return BigInt(await this.provider.send("eth_gasPrice", [])); + } catch { + return ethers.parseUnits("1", "gwei"); + } + })(), + (async () => { + try { + return BigInt(await this.provider.send("eth_maxPriorityFeePerGas", [])); + } catch { + return BigInt(0); + } + })() + ]); + return block?.baseFeePerGas ? block.baseFeePerGas * BigInt(15) / BigInt(10) + getPriorityFee : getGasPrice; + } /** * Calculate L1 fee for op-stack chains * @@ -6099,10 +9373,9 @@ class TornadoFeeOracle { tx = { type: 0, gasLimit: 1e6, - nonce: Number(DUMMY_NONCE), + nonce: DUMMY_NONCE, data: DUMMY_WITHDRAW_DATA, gasPrice: ethers.parseUnits("1", "gwei"), - from: DUMMY_ADDRESS, to: DUMMY_ADDRESS }; } @@ -6148,72 +9421,457 @@ class TornadoFeeOracle { } } -var __async$5 = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); +const gasZipInbounds = { + [NetId.MAINNET]: "0x391E7C679d29bD940d63be94AD22A25d25b5A604", + [NetId.BSC]: "0x391E7C679d29bD940d63be94AD22A25d25b5A604", + [NetId.POLYGON]: "0x391E7C679d29bD940d63be94AD22A25d25b5A604", + [NetId.OPTIMISM]: "0x391E7C679d29bD940d63be94AD22A25d25b5A604", + [NetId.ARBITRUM]: "0x391E7C679d29bD940d63be94AD22A25d25b5A604", + [NetId.GNOSIS]: "0x391E7C679d29bD940d63be94AD22A25d25b5A604", + [NetId.AVALANCHE]: "0x391E7C679d29bD940d63be94AD22A25d25b5A604" }; +const gasZipID = { + [NetId.MAINNET]: 255, + [NetId.BSC]: 14, + [NetId.POLYGON]: 17, + [NetId.OPTIMISM]: 55, + [NetId.ARBITRUM]: 57, + [NetId.GNOSIS]: 16, + [NetId.AVALANCHE]: 15, + [NetId.SEPOLIA]: 102 +}; +function gasZipInput(to, shorts) { + let data = "0x"; + if (ethers.isAddress(to)) { + if (to.length === 42) { + data += "02"; + data += to.slice(2); + } else { + return null; + } + } else { + data += "01"; + } + for (const i in shorts) { + data += Number(shorts[i]).toString(16).padStart(4, "0"); + } + return data; +} +function gasZipMinMax(ethUsd) { + return { + min: 1 / ethUsd, + max: 50 / ethUsd, + ethUsd + }; +} + +const hasherBytecode = "0x38600c600039612b1b6000f3606460006000377c01000000000000000000000000000000000000000000000000000000006000510463f47d33b5146200003557fe5b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000016004518160245181838180828009800909089082827f0fbe43c36a80e36d7c7c584d4f8f3759fb51f0d66065d8a227b688d12488c5d408839081808280098009098391089082827f9c48cd3e00a6195a253fc009e60f249456f802ff9baf6549210d201321efc1cc08839081808280098009098391089082827f27c0849dba2643077c13eb42ffb97663cdcecd669bf10f756be30bab71b86cf808839081808280098009098391089082827f2bf76744736132e5c68f7dfdd5b792681d415098554fd8280f00d11b172b80d208839081808280098009098391089082827f33133eb4a1a1ab45037c8bdf9adbb2999baf06f20a9c95180dc4ccdcbec5856808839081808280098009098391089082827f588bb66012356dbc9b059ef1d792b563d6c18624dddecc3fe4583fd3551e9b3008839081808280098009098391089082827f71bc3e244e1b92911fe7f53cf523e491fd6ff487d59337a1d92f92668c4f4c3608839081808280098009098391089082827fd1808e2b039fd010c489768f78d7499938ccc0858f3295151787cfe8b7e40be108839081808280098009098391089082827f76978af3ded437cf41b3faa40cd6bcfce94f27f4abcc3ed34be19abd2c4537d008839081808280098009098391089082827f0a9baee798a320b0ca5b1cf888386d1dc12c13b38e10225aa4e9f03069a099f508839081808280098009098391089082827fb79dbf6050a03b16c3ade8d77e11c767d2251af9cdbd6cdf9a8a0ee921b32c7908839081808280098009098391089082827fa74bbcf5067f067faec2cce4b98d130d7927456f5c5f6c00e0f5406a24eb8b1908839081808280098009098391089082827fab7ab080d4c4018bda6ecc8bd67468bc4619ba12f25b0da879a639c758c8855d08839081808280098009098391089082827fe6a5b797c2bba7e9a873b37f5c41adc47765e9be4a1f0e0650e6a24ad226876308839081808280098009098391089082827f6270ae87cf3d82cf9c0b5f428466c429d7b7cbe234cecff39969171af006016c08839081808280098009098391089082827f9951c9f6e76d636b52f7600d979ca9f3b643dfbe9551c83b31542830321b2a6608839081808280098009098391089082827f4119469e44229cc40c4ff555a2b6f6b39961088e741e3c20a3c9b47f130c555008839081808280098009098391089082827f5d795e02bbaf90ff1f384741e5f18f8b644a0080441315d0e5b3c8123452a0b008839081808280098009098391089082827f281e90a515e6409e9177b4f297f8049ce3d4c3659423c48b3fd64e83596ff10108839081808280098009098391089082827f424185c60a21e84970f7d32cacaa2725aa8a844caea7ed760d2b965af1bf3e7d08839081808280098009098391089082827fd96fcbc3960614ea887da609187a5dada2e1b829f23309a6375212cea1f25c0908839081808280098009098391089082827ffde84026d7c294300af18f7712fc3662f43387ae8cf7fdda1f9a810f4b24bcf208839081808280098009098391089082827f3a9d568575846aa6b8a890b3c237fd0447426db878e6e25333b8eb9b386195c108839081808280098009098391089082827f55a2aa32c84a4cae196dd4094b685dd11757470a3be094d98eea73f02452aa3608839081808280098009098391089082827fcbc9481380978d29ebc5b0a8d4481cd2ef654ee800907adb3d38dc2fd9265fab08839081808280098009098391089082827f24e53af71ef06bacb76d3294c11223911e9d177ff09b7009febc484add0beb7408839081808280098009098391089082827fdbd44e16108225766dac3e5fe7acbe9df519bbba97380e5e9437a90658f2139308839081808280098009098391089082827fc6f434863c79013bb2c202331e04bccea2251c1ff6f191dc2afa23e6f6d28e4e08839081808280098009098391089082827f3490eeb39a733c0e8062d87f981ae65a8fccf25c448f4455d27db3915351b06608839081808280098009098391089082827f30b89830ff7ade3558a5361a24869130ce1fcce97211602962e34859525dac4f08839081808280098009098391089082827f29bae21b579d080a75c1694da628d0ecfd83efc9c8468704f410300062f64ca908839081808280098009098391089082827fe326499de0476e719915dd1c661ef4550723d4aee9ee9af224edd208790fce4408839081808280098009098391089082827f8c45208b8baa6f473821415957088c0b7e72a465f460b09ece2d270aee2f184108839081808280098009098391089082827ffe2ad454f451348f26ce2cc7e7914aef3eb96e8f89a4619a1dc7d11f8401c35208839081808280098009098391089082827f0929db368ef2af2d29bca38845325b0b7a820a4889e44b5829bbe1ed47fd4d5208839081808280098009098391089082827f16531d424b0cbaf9abbf2d2acde698462ea4555bf32ccf1bbd26697e905066f608839081808280098009098391089082827ff5c30d247f045ff6d05cf0dd0a49c9823e7a24b0d751d3c721353b96f29d76f608839081808280098009098391089082827f6eb7a3614056c230c6f171370fdd9d1048bb00b2cdd1b2721d11bdda5023f48608839081808280098009098391089082827f0ee9c4621642a272f710908707557498d25a6fdd51866da5d9f0d205355a618908839081808280098009098391089082827f78ca1cb1c7f6c6894d1cf94f327b8763be173151b6b06f99dfc6a944bb5a72f008839081808280098009098391089082827f5d24d0b1b304d05311ce0f274b0d93746a4860ed5cdd8d4348de557ea7a5ee7a08839081808280098009098391089082827f77423dabd1a3cddc8691438fc5891e3fd49ac0f3e21aaf249791bfde1303d2f308839081808280098009098391089082827f0642e8800a48cc04c0168232c6f542396597a67cf395ad622d947e98bb68697a08839081808280098009098391089082827fc1e7d3cbbc4c35b7490647d8402e56d334336943bda91fe2d34ca9727c0e3df508839081808280098009098391089082827f8d6fb1730335204f38f85e408ac861e76f24349ab6ee0469c22e19350bb24fe108839081808280098009098391089082827f67d0faf5f0db32a1b60e13dc4914246b9edac7990fb4990b19aa86815586441a08839081808280098009098391089082827f2605b9b909ded1b04971eae979027c4e0de57f3b6a60d5ed58aba619c34749ce08839081808280098009098391089082827fd276890b2c205db85f000d1f5111ed8f177e279cae3e52862780f04e846228d008839081808280098009098391089082827f2ac5905f9450a21ef6905ed5951a91b3730e3a2e2d62b50bdeb810015d50376b08839081808280098009098391089082827f7a366839f0291ca54da674ac3f0e1e9aa8b687ba533926cb40268039e57b967a08839081808280098009098391089082827f67ab0f3466989c3dbbe209c37ec272ba83984ba6e445be6d472b63e3ca7270e308839081808280098009098391089082827f0e786007d0ce7e28a90e31d3263887d40c556dec88fcb8b56bc9e9c05ecc0c2908839081808280098009098391089082827f0b814ed99bd00eca389b0022663dbfddfbfa15e321c19abcf1eaf9556075fb6808839081808280098009098391089082827f65c0321ba26fcee4fdc35b4999b78ceb54dcaf9fec2e3bdea98e9f82925c093208839081808280098009098391089082827fab2d2a929601f9c3520e0b14aaa6ba9f1e79821a5b768919670a4ea970722bf408839081808280098009098391089082827fcdd2e0744d4af1a81918de69ec12128a5871367303ff83ed764771cbbdf6502308839081808280098009098391089082827f74527d0c0868f2ec628086b874fa66a7347d3d3b918d2e07a5f33e1067e8ac5808839081808280098009098391089082827f1c6bf6ac0314caead23e357bfcbbaa17d670672ae3a475f80934c716f10aca2508839081808280098009098391089082827f3c4007e286f8dc7efd5d0eeb0e95d7aa6589361d128a0cccb17b554c851a643208839081808280098009098391089082827fae468a86a5a7db7c763a053eb09ac1a02809ce095258c88101ee319e12b0697e08839081808280098009098391089082827f9333e3d052b7c77fcac1eb366f610f6f97852242b1317a87b80f3bbc5c8c2d1d08839081808280098009098391089082827f52ec1d675cf5353153f6b628414783ca6b7fc0fe01948ca206daad712296e39508839081808280098009098391089082827f13ceeeb301572b4991076750e11ea7e7fcbfee454d90dc1763989004a1894f9308839081808280098009098391089082827f8505737e7e94939a08d8cda10b6fbbbf879b2141ae7eabc30fcd22405135fe6408839081808280098009098391089082827f6127db7ac5200a212092b66ec2bfc63653f4dc8ac66c76008fef885258a258b508839081808280098009098391089082827f12692a7d808f44e31d628dbcfea377eb073fb918d7beb8136ea47f8cf094c88c08839081808280098009098391089082827f260e384b1268e3a347c91d6987fd280fa0a275541a7c5be34bf126af35c962e008839081808280098009098391089082827fd88c3b01966d90e713aee8d482ceaa6925311d2342e1a5aca4fcd2f44b6daddc08839081808280098009098391089082827fb87e868affd91b078a87fa75ac9332a6cf23587d94e20c3262db5e91f30bf04b08839081808280098009098391089082827fb5ba5f8acad1a950a3bbf2201055cd3ea27056c0c53f0c4c97f33cda8dbfe90908839081808280098009098391089082827f59ca814b49e00d7b3118c53a2986ded128584acd7428735e08ade6661c457f7508839081808280098009098391089082827f0fc4c0bea813a223fd510c07f7bbe337badd4bcf28649a0d378970c2a15b3aa508839081808280098009098391089082827f0053f1ea6dd60e7a6db09a00be77549ff3d4ee3737be7fb42052ae1321f667c308839081808280098009098391089082827feb937077bb10c8fe38716d4e38edc1f9e7b18c6414fef85fe7e9c5567baa4a0408839081808280098009098391089082827fbacb14c0f1508d828f7fd048d716b8044aec7f0fb48e85e717bf532db972520708839081808280098009098391089082827f4ca0abb8beb7cff572a0c1e6f58e080e1bb243d497a3e74538442a4555ad40be08839081808280098009098391089082827fda9eefd411e590d7e44592cce298af87b2c62aa3cc8bb137aa99ca8d4aa551b508839081808280098009098391089082827f153dae43cef763e7a2fc9846f09a2973b0ad9c35894c220699bcc2954501c6bd08839081808280098009098391089082827fd4ed2a09375813b4fb504c7a9ba13110bdd8549a47349db82c15a434c090e87b08839081808280098009098391089082827f0063a5c4c9c12dcf4bae72c69f3a225664469503d61d9eae5d9553bfb006095b08839081808280098009098391089082827fdc8a4d35ad28e59dd3713b45985cd3b70e37ccc2be42086f1ea078fe2dc9d82d08839081808280098009098391089082827f486ba219308f0c847b22fcb4449f8855192536c01b8057904e81c1c7814f483b08839081808280098009098391089082827f34d9604140a1ac9fdb204285b9fe1b303c281af2fc5fb362f6577282b423bcf308839081808280098009098391089082827fc1681959ec4bc3656911db2b2f56aa4db709c26f1a0a25c879286e37f437465d08839081808280098009098391089082827ffcd849f3b5f9e4368af75619fb27f2e335adbb9b44988f17c4d389fa751ad47a08839081808280098009098391089082827ff5f7fc22ad64c8e7c1e005110e13f4f1c6b1f8f8cc59000db0e3bb38f99554a508839081808280098009098391089082827fa9133b8a20fbae4633ec5f82cb47a38ae1877d12d1febb23982c7c808aa5317508839081808280098009098391089082827ff4827c5c7b61141cc31b75984bb3ed16ed579e5b72e32a1289b63ab55eaf8c1208839081808280098009098391089082827fcca361819ffefe3e50fe34c91a322c9405f4e5a168c1fc0a0a1883993e32c9f408839081808280098009098391089082827f6656088842bfc9e325a532784d3362cecfa86f9c7b208a6b499836ebe48ff15708839081808280098009098391089082827f00129c7cd00e42ed05a37dbceb80d47b65e1d750ef2148278a54723fdf42c4cc08839081808280098009098391089082827fa85b235631b786f85cd46f7768f6c71ae004ad267ae59bdf929ada149b19588808839081808280098009098391089082827f34df65a82686be09c5b237911abf237a9887c1a418f279ac79b446d7d311f5ea08839081808280098009098391089082827f815a850c3989df9ca6231e0bdd9916fc0e076f2c6c7f0f260a846d0179f9c32d08839081808280098009098391089082827f50fb0940848a67aee83d348421fadd79aefc7a2adabeec6e64904ebe1bf63e7d08839081808280098009098391089082827fbab63a16273599f8b66895461e62a19ff0d103693be771d93e3691bba89cdd8d08839081808280098009098391089082827f6931a091756e0bc709ebecfffba5038634c5b3d5d0c5876dd72aac67452db8a208839081808280098009098391089082827f55559b8bb79db8809c46ee627f1b5ce1d8e6d89bf94a9987a1407759d1ba896308839081808280098009098391089082827fa9a1a11b2979018cb155914d09f1df19b7ffec241e8b2487b6f6272a56a44a0a08839081808280098009098391089082827ff83293400e7bccea4bb86dcb0d5ca57fa2466e13a572d7d3531c6fa491cb0f1b08839081808280098009098391089082827fb7cb5742b6bc5339624d3568a33c21f31b877f8396972582028da999abf249f208839081808280098009098391089082827ff56efb400f8500b5c5bf811c65c86c7ed2e965f14f1a69bca436c0c60b79f46508839081808280098009098391089082827fd7c4427998d9c440f849dcd75b7157996eaad1b9a1d58cc2441931300e26eb2208839081808280098009098391089082827fca5ed18ad53e33fdc3ae8cf353ff3f6dd315f60060442b74f6b614b24ebd4cc308839081808280098009098391089082827f9ad3e9376c97b194a0fbf43e22a3616981d777365c765ead09a1d033fdf536b708839081808280098009098391089082827fc6daeff5769a06b26fe3b8fef30df07b1387373a7814cef364fe1d6059eaf54a08839081808280098009098391089082827fc20a78398345c6b8cf439643dab96223bf879c302648293eaf496fee5c978c6608839081808280098009098391089082827f589ca65b6cf0e90653c06dddc057dc61ba2839974569051c98b43e8618716efb08839081808280098009098391089082827f83064161f127d8c59fc73625957e21630dc6dc99e5443f6ce37ecd6bf28e69b708839081808280098009098391089082827f46d0ba662b50100b9a3af52052f68932feec1d12290b2033c4f49148893d8ba308839081808280098009098391089082827f18dd55b4a83a53f2ee578eb3e6d26f594824d44670fc3f4de80642344d15c09a08839081808280098009098391089082827f9fb5b594f48bc58b345ab90ded705920a7274b8e070eee8ce8cf90c72c3604b608839081808280098009098391089082827f1901d8f4f2c8449128e00663978f2050f2eb1cd6acb60d9d09c57c5d46ee54fe08839081808280098009098391089082827f5ec56789beab24ef7ee32f594d5fc561ec59dfeb93606dc7dcc6fe65133a7db408839081808280098009098391089082827f01c0b2cbe4fa9877a3d08eb67c510e8630da0a8beda94a6d9283e6f70d268bc508839081808280098009098391089082827f0b1d85acd9031a9107350eed946a25734e974799c5ba7cff13b15a5a623a25f008839081808280098009098391089082827f204497d1d359552905a2fe655f3d6f94926ea92d12cdaa6556ec26362f239f6408839081808280098009098391089082827fe075f7edc6631a8d7ffe33019f44fc91f286236d5a5f90f16de4791b72a2a5f008839081808280098009098391089082827f243f46e353354256ab8fe0ca4e9230dfc330bc163e602dfeaf307c1d1a7264b908839081808280098009098391089082827fd448ae5e09625fa1fcfd732fc9cd8f06e4c33b81f0a9240c83da56f41e9ecceb08839081808280098009098391089082827f2f312eef69a33d9fa753c08840275692a03432b3e6da67f9c59b9f9f4971cd5608839081808280098009098391089082827f5f333996af231bd5a293137da91801e191a6f24eb532ad1a7e6e9a2ad0efbc0008839081808280098009098391089082827fa8f771e0383a832dc8e2eaa8efabda300947acaf0684fabddf8b4abb0abd8a6208839081808280098009098391089082827f9ff0b3d7a4643596f651b70c1963cc4fa6c46018d78f05cb2c5f187e25df83a908839081808280098009098391089082827f9c373b704838325648273734dcdf962d7c156f431f70380ba4855832c4a238b808839081808280098009098391089082827fea2afa02604b8afeeb570f48a0e97a5e6bfe9613394b9a6b0026ecd6cec8c33a08839081808280098009098391089082827f68892258cd8eb43b71caa6d6837ec9959bfdfd72f25c9005ebaffc4011f8a7bf08839081808280098009098391089082827ff2824f561f6f82e3c1232836b0d268fa3b1b5489edd39a5fe1503bfc7ca91f4908839081808280098009098391089082827f164eda75fda2861f9d812f24e37ac938844fbe383c243b32b9f66ae2e76be71908839081808280098009098391089082827ff0a6fc431f5bf0dd1cca93b8b65b3f72c91f0693e2c74be9243b15abb31afcc008839081808280098009098391089082827fe68db66ba891ef0cd527f09ec6fff3ec0a269cf3d891a35ec13c902f70334b4f08839081808280098009098391089082827f3a44a5b102f7883a2b8630a3cae6e6db2e6e483bb7cfeb3492cbd91793ef598e08839081808280098009098391089082827f43939fe8ef789acb33cbf129ba8a3aa1bd61510a178022a05177c9c5a1c59bf108839081808280098009098391089082827f936fe3b66dfda1bc5a7aae241b4db442858bd720c1d579c0c869f273cd55d77408839081808280098009098391089082827f3490fcaa8ffa37f35dc67ae006e81352c7103945417b8e4b142afcaefa344b8508839081808280098009098391089082827fcae66096cff344caca53ffe0e58aafeb468bd174f00d8abc425b2099c088187408839081808280098009098391089082827fc7d05783a41bc14f3c9a45384b6d5e2547c5b6a224c8316910b208f2718a70ab08839081808280098009098391089082827f5ac6b9ba94040d5692b865b6677b60ef3201b5c2121699f70beb9f9b2528a02608839081808280098009098391089082827fa902a3d4d9ecbfb9b2c76fddf780554bf93cad97b244e805d3adb94e1816290008839081808280098009098391089082827fe9df91ffeeb086a4d26041c29dac6fca1d56a4d022fe34b38831267395b98d2708839081808280098009098391089082827f862646f851d91a8840ad9ee711f12ec13b3e8f980ff5ef5ee43ca4520d57def708839081808280098009098391089082827f30b7381c9725b9db07816baf8524943a79cea135807c84cce0833485c11e0c2e08839081808280098009098391089082827f96afc10c5cedaddbda99df79387397c9be74a5b50f3a0c04ccb68d4e0f3a989f08839081808280098009098391089082827f3543da80d10da251c548776fe907c4ef89993d62e0062ae5c0496fcb851c366108839081808280098009098391089082827fe5140fe26d8b008430fccd50a68e3e11c1163d63b6d8b7cc40bc6f3c1d0b1b0608839081808280098009098391089082827ffefdf1872e4475e8bbb0ef6fab7f561bff121314695c433bd4c29ec118060c9608839081808280098009098391089082827f6bb8c9f3d57b18e002df059db1e6a5d42ad566f153f18460774f68ac2650940008839081808280098009098391089082827f5415122d50b26f4fab5784004c56cf03f128f825ad2236f4b3d51f74737bd97308839081808280098009098391089082827f00e115c4a98efae6a3a5ecc873b0cef63ccd5b515710a3ab03ec52218f784dc908839081808280098009098391089082827fda7d525427bad87b88238657c21331245578bc76aa6240b7f972382537a202ab08839081808280098009098391089082827f83332e8b34505b83010270dc795290a2f515b8f89c163acecdf4799df04c62f808839081808280098009098391089082827fb09ecb6033d1a065f17a61066cd737d0c3c5873b51c3ab0a285e26939e62aa1808839081808280098009098391089082827f24e65c718938c2b937378e7435332174329730bde85a4185e37875824eb4985908839081808280098009098391089082827f68e41430ccd41cc5e92a9f9acd2e955c1385b9f5ed8d3f133d767429484a8eba08839081808280098009098391089082827fc038fe9d0125ab8be54545276f841274e414c596ed4c9eaa6919604603d1ffa908839081808280098009098391089082827f23248698612cd8e83234fcf5db9b6b225f4b0ba78d72ef13ea1edff5f0fb029808839081808280098009098391089082827fd2a9fa3d39c1ba91eefa666a1db71c6e0e4e3b707626b0197a4e59e7110cf0d408839081808280098009098391089082827fc28931ee7dfa02b62872e0d937ba3dc5c637118273a1f1f0c4fc880905c82efc08839081808280098009098391089082827f01cd399556445e3d7b201d6c5e56a5794e60be2cfd9a4643e7ead79bb4f60f7908839081808280098009098391089082827fac855cc58d5fbb0dff91a79683eb0e914c1b7d8d0a540d416838a89f83a8312f08839081808280098009098391089082827ff7798af7ccf36b836705849f7dd40328bf9346657255b431446ec75a6817181608839081808280098009098391089082827fe52a24c92d3f067bf551eeaf98c62ba525e84882d7adad835fad8de72986b2b108839081808280098009098391089082827fffc8682759a2bf1dd67c87a77c285467801f1c44fd78fa4eb5957a4832c9d72d08839081808280098009098391089082827f1482ac3e7e4f321627850d95a13942aea6d2923402b913046856ff7e8aaf9aff08839081808280098009098391089082827f17332b4c7aac2a07ccfe954de7ad22ccf6fcb4c5fa15c130ed22a40ae9398f4708839081808280098009098391089082827fd4be0546013f84a0d1e118b37589723b58e323983263616d1b036f8b3fdd858308839081808280098009098391089082827fa64ec737d31dddf939b184438ccdd3e1d3e667572857cd6c9c31a0d1d9b7b08508839081808280098009098391089082827f8ad12fbc74117cff4743d674539c86548c6758710a07a6abe3715e4b53526d3408839081808280098009098391089082827f15a16435a2300b27a337561401f06682ba85019aa0af61b264a1177d38b5c13c08839081808280098009098391089082827f22616f306e76352293a22ab6ee15509d9b108d4136b32fa7f9ed259793f392a108839081808280098009098391089082827f519727b25560caf00ce0d3f911bd4356f907160ab5186da10a629c7ccae1851e08839081808280098009098391089082827fcff39e77928ce9310118d50e29bc87e7f78b53ad51366359aa17f07902ae639208839081808280098009098391089082827f17dead3bfa1968c744118023dead77cdbee22c5b7c2414f5a6bdf82fd94cf3ad08839081808280098009098391089082827f2bef0f8b22a1cfb90100f4a552a9d02b772130123de8144a00c4d57497e1d7f408839081808280098009098391089082827fbf5188713fef90b31c35243f92cfa4331ab076e30e24b355c79b01f41d152a1108839081808280098009098391089082827f3baadd2fd92e3e12fb371be0578941dc0a108fbca0a7d81b88316fb94d6b4dfe08839081808280098009098391089082827fd4f955742e20a28d38611bf9fc4a478c97b673a7cd40d0113a58a1efe338d9aa08839081808280098009098391089082827f3c1c3fe9a5f7ccd54ad5a51a224b3f94775266d19c3733017e4920d7391ad64508839081808280098009098391089082827f6372df6148abeed66fda5461779a9651130c6c525df733852bcd929016768a7a08839081808280098009098391089082827f6d098e848fb853f95adb5a6364b5ab33c79fb08877f2cf3e0e160d9fcb3ebcc508839081808280098009098391089082827f48c5fc90f27431fabfe496dfba14bb0dba71141eb5472a365fd13023f4fe629608839081808280098009098391089082827fbb988dfc0c4dfe53999bd34840adcb63fdbf501ccd622ca2ddf5064ad8cdebf408839081808280098009098391089082827f25b068c942724c424ed5851c9575c22752c9bd25f91ebfa589de3d88ee7627f908839081808280098009098391089082827fed98a1931e361add218de11ff7879bd7114cda19c24ddbe15b3b0190ce01e1aa08839081808280098009098391089082827fc80b5a7d63f6c43542ad612023d3ffd6c684ce2eab837180addcb4decf51854408839081808280098009098391089082827fe2ef24bf47c5203118c6ff96657dd3c6fdff7212d5c798d826455de77b4b70cd08839081808280098009098391089082827f907da812fd5a8375587e4860f87691d0a8d61d454c507d09e5562e1a5d0fcc7608839081808280098009098391089082827fc459abbc62bc6070cacdff597e97990de56edc51cc6643afb0f6789fef1bad6308839081808280098009098391089082827f38d61f5e566855d70d36ef0f0f1fefcd7c829bdd60d95e0ef1fb5b98856280a408839081808280098009098391089082827f13218626665c420d3aa2b0fa49224a3dce8e08b8b56f8851bd9cb5e25cb3042d08839081808280098009098391089082827f6f685fb152dba21b4d02422e237e246df73d7d711ae6d7d33983bae0f873e31008839081808280098009098391089082827f5ade34719e2498dde70e4571c40474475a4af706a3cb82ac18a7fa44c22d1c4708839081808280098009098391089082827f8a0c3dc7a496adca059cb95d9b173812a00f3c4d435e0b9e8116e0c4b5f56acb08839081808280098009098391089082827f196bc98252f63169ed79073ee091a0e8ed0b5af51017da143940c00bdb86370908839081808280098009098391089082827fd979bf70695d93f8efb552a413701918afec9e12dfe213f4d0c27cfa68fad6c208839081808280098009098391089082827fb803072d02f54d237a3c6c4cc18eda6dce87a03c6819df54e4ed8aed6dc56d4608839081808280098009098391089082827f1efcda9d986cddcf431af4d59c6a7709d650885b7886cba70f0e7cd92b331cdc08839081808280098009098391089082827fd3ca5f7859b82ac50b63da06d43aa68a6b685f0a60397638bbea173b3f60419208839081808280098009098391089082827fa59d392c0667316ad37a06be2d51aabe9e79bdef0013bc109985648a14c7e41f08839081808280098009098391089082827fac2f5f0d2146791b396e2bed6cf15a20bc22cc4c8cf7dd4b3514ac00148dd0a708839081808280098009098391089082827f17a993a6af068d72bc36f0e814d29fef3f97d7a72aa963889b16a8457409861a08839081808280098009098391089082827f6f1bf99686550e0396f7f4e2df6fdaa090fbc272c8c76eb32a3c6791de5a07b508839081808280098009098391089082827f8234d705e1ecdc59cc6ed40749069d4b45e63deb49b5b7d7f527abd31c072b1b08839081808280098009098391089082827f6fe929a1fd6aacba5c4012c45dd727d2c816119567450003913d882cb97bc47e08839081808280098009098391089082827fad5371215f2aba49026b2e48739c11b4d8ffbb24dd4a6e41b9763862af96787a08839081808280098009098391089082827fd0e704566c49e1a11edc2c128b2e07f36dc0c755468268f8fe4c4859b9fa595b08839081808280098009098391089082827f263e1195090d00be1d8fb37de17ccf3b66d180645efa0d831865cfaa8797769e08839081808280098009098391089082827fe65c090eebde2cfa7f9c92cf75641c7683fb8e81f4a48f5b7a9c7eb26a85029f08839081808280098009098391089082827fa18971781c6855f6a9752912780bb9b719c14a677a4c6393d62d6e046b97a2ac08839081808280098009098391089082827ff6fc1ef1bca8bec055cc66edecc5dc99030fe78311a3f21d8cd624df4f89e62508839081808280098009098391089082827f824e4e2838501516d3296542cb47a59a1ca4326e947c9c874d88dccc8e37b99a08839081808280098009098391089082827f3cd5a9e7353a50e454c9c1381b556b543897cc89153c3e3749f2021d8237226308839081808280098009098391089082827fb4bcedbd54d0c917a315cc7ca785e3c5995abbeeb3deb3ebaf02c7a9bf6cc83f08839081808280098009098391089082827f1f7476211105b3039cef009c51155ae93526c53a74973ecfce40754b3df1052108839081808280098009098391089082827f58aefbd978440c94b4b9fbd36e00e6e36caeacf82b0da0a6161d34c541a5a6e308839081808280098009098391089082827fc22cd6d61be780a33c77677bc6ba40307b597ed981db57cb485313eec2a5a49708839081808280098009098391089082827fd9ffc4fe0dc5f835c8dcdc1e60b8f0b1637f32a809175371b94a057272b0748d08839081808280098009098391089082827ff6a5268541bc4c64ad0ade8f55dda3492604857a71c923662a214dd7e9c20c1008839081808280098009098391089082826000088390818082800980090983910860205260005260406000f3"; +function deployHasher(signer) { + return signer.sendTransaction({ data: hasherBytecode }); +} + +const INDEX_DB_ERROR = "A mutation operation was attempted on a database that did not allow mutations."; +class IndexedDB { + dbExists; + isBlocked; + // todo: TestDBSchema on any + options; + dbName; + dbVersion; + db; + constructor({ dbName, stores }) { + this.dbExists = false; + this.isBlocked = false; + this.options = { + upgrade(db) { + Object.values(db.objectStoreNames).forEach((value) => { + db.deleteObjectStore(value); + }); + [{ name: "keyval" }, ...stores || []].forEach(({ name, keyPath, indexes }) => { + const store = db.createObjectStore(name, { + keyPath, + autoIncrement: true + }); + if (Array.isArray(indexes)) { + indexes.forEach(({ name: name2, unique = false }) => { + store.createIndex(name2, name2, { unique }); + }); + } + }); + } + }; + this.dbName = dbName; + this.dbVersion = 35; + } + async initDB() { + try { + if (this.dbExists || this.isBlocked) { + return; + } + this.db = await idb.openDB(this.dbName, this.dbVersion, this.options); + this.db.addEventListener("onupgradeneeded", async () => { + await this._removeExist(); + }); + this.dbExists = true; + } catch (err) { + if (err.message.includes(INDEX_DB_ERROR)) { + console.log("This browser does not support IndexedDB!"); + this.isBlocked = true; + return; + } + if (err.message.includes("less than the existing version")) { + console.log(`Upgrading DB ${this.dbName} to ${this.dbVersion}`); + await this._removeExist(); + return; + } + console.error(`Method initDB has error: ${err.message}`); + } + } + async _removeExist() { + await idb.deleteDB(this.dbName); + this.dbExists = false; + await this.initDB(); + } + async getFromIndex({ + storeName, + indexName, + key + }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + return await this.db.getFromIndex(storeName, indexName, key); + } catch (err) { + throw new Error(`Method getFromIndex has error: ${err.message}`); + } + } + async getAllFromIndex({ + storeName, + indexName, + key, + count + }) { + await this.initDB(); + if (!this.db) { + return []; + } + try { + return await this.db.getAllFromIndex(storeName, indexName, key, count); + } catch (err) { + throw new Error(`Method getAllFromIndex has error: ${err.message}`); + } + } + async getItem({ storeName, key }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + const store = this.db.transaction(storeName).objectStore(storeName); + return await store.get(key); + } catch (err) { + throw new Error(`Method getItem has error: ${err.message}`); + } + } + async addItem({ storeName, data, key = "" }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + const tx = this.db.transaction(storeName, "readwrite"); + const isExist = await tx.objectStore(storeName).get(key); + if (!isExist) { + await tx.objectStore(storeName).add(data); + } + } catch (err) { + throw new Error(`Method addItem has error: ${err.message}`); + } + } + async putItem({ storeName, data, key }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + const tx = this.db.transaction(storeName, "readwrite"); + await tx.objectStore(storeName).put(data, key); + } catch (err) { + throw new Error(`Method putItem has error: ${err.message}`); + } + } + async deleteItem({ storeName, key }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + const tx = this.db.transaction(storeName, "readwrite"); + await tx.objectStore(storeName).delete(key); + } catch (err) { + throw new Error(`Method deleteItem has error: ${err.message}`); + } + } + async getAll({ storeName }) { + await this.initDB(); + if (!this.db) { + return []; + } + try { + const tx = this.db.transaction(storeName, "readonly"); + return await tx.objectStore(storeName).getAll(); + } catch (err) { + throw new Error(`Method getAll has error: ${err.message}`); + } + } + /** + * Simple key-value store inspired by idb-keyval package + */ + getValue(key) { + return this.getItem({ storeName: "keyval", key }); + } + setValue(key, data) { + return this.putItem({ storeName: "keyval", key, data }); + } + delValue(key) { + return this.deleteItem({ storeName: "keyval", key }); + } + async clearStore({ storeName, mode = "readwrite" }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + const tx = this.db.transaction(storeName, mode); + await tx.objectStore(storeName).clear(); + } catch (err) { + throw new Error(`Method clearStore has error: ${err.message}`); + } + } + async createTransactions({ + storeName, + data, + mode = "readwrite" + }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + const tx = this.db.transaction(storeName, mode); + await tx.objectStore(storeName).add(data); + await tx.done; + } catch (err) { + throw new Error(`Method createTransactions has error: ${err.message}`); + } + } + async createMultipleTransactions({ + storeName, + data, + index, + mode = "readwrite" + }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + const tx = this.db.transaction(storeName, mode); + for (const item of data) { + if (item) { + await tx.store.put({ ...item, ...index }); + } + } + } catch (err) { + throw new Error(`Method createMultipleTransactions has error: ${err.message}`); + } + } +} +async function getIndexedDB(netId) { + if (!netId) { + const idb2 = new IndexedDB({ dbName: "tornado-core" }); + await idb2.initDB(); + return idb2; + } + const minimalIndexes = [ + { + name: "blockNumber", + unique: false + }, + { + name: "transactionHash", + unique: false + } + ]; + const defaultState = [ + { + name: `echo_${netId}`, + keyPath: "eid", + indexes: [ + ...minimalIndexes, + { + name: "address", + unique: false + } + ] + }, + { + name: `encrypted_notes_${netId}`, + keyPath: "eid", + indexes: minimalIndexes + }, + { + name: "lastEvents", + keyPath: "name", + indexes: [ + { + name: "name", + unique: false + } + ] + } + ]; + const config = getConfig(netId); + const { tokens, nativeCurrency, registryContract, governanceContract } = config; + const stores = [...defaultState]; + if (registryContract) { + stores.push({ + name: `registry_${netId}`, + keyPath: "ensName", + indexes: [ + ...minimalIndexes, + { + name: "event", + unique: false + } + ] + }); + stores.push({ + name: `relayers_${netId}`, + keyPath: "timestamp", + indexes: [ + { + name: "timestamp", + unique: true + } + ] + }); + stores.push({ + name: `revenue_${netId}`, + keyPath: "timestamp", + indexes: [ + { + name: "timestamp", + unique: true + } + ] + }); + } + if (governanceContract) { + stores.push({ + name: `governance_${netId}`, + keyPath: "eid", + indexes: [ + ...minimalIndexes, + { + name: "event", + unique: false + } + ] + }); + } + Object.entries(tokens).forEach(([token, { instanceAddress }]) => { + Object.keys(instanceAddress).forEach((amount) => { + if (nativeCurrency === token) { + stores.push( + { + name: `stringify_bloom_${netId}_${token}_${amount}`, + keyPath: "hashBloom", + indexes: [] + }, + { + name: `stringify_tree_${netId}_${token}_${amount}`, + keyPath: "hashTree", + indexes: [] + } + ); + } + stores.push( + { + name: `deposits_${netId}_${token}_${amount}`, + keyPath: "leafIndex", + // the key by which it refers to the object must be in all instances of the storage + indexes: [ + ...minimalIndexes, + { + name: "commitment", + unique: true + } + ] + }, + { + name: `withdrawals_${netId}_${token}_${amount}`, + keyPath: "eid", + indexes: [ + ...minimalIndexes, + { + name: "nullifierHash", + unique: true + } + // keys on which the index is created + ] + } + ); + }); + }); + const idb = new IndexedDB({ + dbName: `tornado_core_${netId}`, + stores + }); + await idb.initDB(); + return idb; +} + +async function fetchIp(ipEcho) { + return await fetchData(ipEcho, { + method: "GET", + timeout: 3e4 + }); +} + class Mimc { + sponge; + hash; + mimcPromise; constructor() { this.mimcPromise = this.initMimc(); } - initMimc() { - return __async$5(this, null, function* () { - this.sponge = yield circomlibjs.buildMimcSponge(); - this.hash = (left, right) => { - var _a, _b; - return (_b = this.sponge) == null ? void 0 : _b.F.toString((_a = this.sponge) == null ? void 0 : _a.multiHash([BigInt(left), BigInt(right)])); - }; - }); + async initMimc() { + this.sponge = await circomlibjs.buildMimcSponge(); + this.hash = (left, right) => this.sponge?.F.toString(this.sponge?.multiHash([BigInt(left), BigInt(right)])); } - getHash() { - return __async$5(this, null, function* () { - yield this.mimcPromise; - return { - sponge: this.sponge, - hash: this.hash - }; - }); + async getHash() { + await this.mimcPromise; + return { + sponge: this.sponge, + hash: this.hash + }; } } const mimc = new Mimc(); -var __async$4 = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; class MerkleTreeService { + currency; + amount; + netId; + Tornado; + commitmentHex; + instanceName; + merkleTreeHeight; + emptyElement; + merkleWorkerPath; constructor({ netId, amount, @@ -6235,632 +9893,770 @@ class MerkleTreeService { this.emptyElement = emptyElement; this.merkleWorkerPath = merkleWorkerPath; } - createTree(events) { - return __async$4(this, null, function* () { - const { hash: hashFunction } = yield mimc.getHash(); - if (this.merkleWorkerPath) { - console.log("Using merkleWorker\n"); - try { - if (isNode) { - const merkleWorkerPromise = new Promise((resolve, reject) => { - const worker = new worker_threads.Worker(this.merkleWorkerPath, { - workerData: { - merkleTreeHeight: this.merkleTreeHeight, - elements: events, - zeroElement: this.emptyElement - } - }); - worker.on("message", resolve); - worker.on("error", reject); - worker.on("exit", (code) => { - if (code !== 0) { - reject(new Error(`Worker stopped with exit code ${code}`)); - } - }); - }); - return fixedMerkleTree.MerkleTree.deserialize(JSON.parse(yield merkleWorkerPromise), hashFunction); - } else { - const merkleWorkerPromise = new Promise((resolve, reject) => { - const worker = new Worker(this.merkleWorkerPath); - worker.onmessage = (e) => { - resolve(e.data); - }; - worker.onerror = (e) => { - reject(e); - }; - worker.postMessage({ + async createTree(events) { + const { hash: hashFunction } = await mimc.getHash(); + if (this.merkleWorkerPath) { + console.log("Using merkleWorker\n"); + try { + if (isNode) { + const merkleWorkerPromise = new Promise((resolve, reject) => { + const worker = new worker_threads.Worker(this.merkleWorkerPath, { + workerData: { merkleTreeHeight: this.merkleTreeHeight, elements: events, zeroElement: this.emptyElement - }); + } }); - return fixedMerkleTree.MerkleTree.deserialize(JSON.parse(yield merkleWorkerPromise), hashFunction); - } - } catch (err) { - console.log("merkleWorker failed, falling back to synchronous merkle tree"); - console.log(err); + worker.on("message", resolve); + worker.on("error", reject); + worker.on("exit", (code) => { + if (code !== 0) { + reject(new Error(`Worker stopped with exit code ${code}`)); + } + }); + }); + return fixedMerkleTree.MerkleTree.deserialize(JSON.parse(await merkleWorkerPromise), hashFunction); + } else { + const merkleWorkerPromise = new Promise((resolve, reject) => { + const worker = new Worker(this.merkleWorkerPath); + worker.onmessage = (e) => { + resolve(e.data); + }; + worker.onerror = (e) => { + reject(e); + }; + worker.postMessage({ + merkleTreeHeight: this.merkleTreeHeight, + elements: events, + zeroElement: this.emptyElement + }); + }); + return fixedMerkleTree.MerkleTree.deserialize(JSON.parse(await merkleWorkerPromise), hashFunction); } + } catch (err) { + console.log("merkleWorker failed, falling back to synchronous merkle tree"); + console.log(err); } - return new fixedMerkleTree.MerkleTree(this.merkleTreeHeight, events, { - zeroElement: this.emptyElement, - hashFunction - }); + } + return new fixedMerkleTree.MerkleTree(this.merkleTreeHeight, events, { + zeroElement: this.emptyElement, + hashFunction }); } - createPartialTree(_0) { - return __async$4(this, arguments, function* ({ edge, elements }) { - const { hash: hashFunction } = yield mimc.getHash(); - if (this.merkleWorkerPath) { - console.log("Using merkleWorker\n"); - try { - if (isNode) { - const merkleWorkerPromise = new Promise((resolve, reject) => { - const worker = new worker_threads.Worker(this.merkleWorkerPath, { - workerData: { - merkleTreeHeight: this.merkleTreeHeight, - edge, - elements, - zeroElement: this.emptyElement - } - }); - worker.on("message", resolve); - worker.on("error", reject); - worker.on("exit", (code) => { - if (code !== 0) { - reject(new Error(`Worker stopped with exit code ${code}`)); - } - }); - }); - return fixedMerkleTree.PartialMerkleTree.deserialize(JSON.parse(yield merkleWorkerPromise), hashFunction); - } else { - const merkleWorkerPromise = new Promise((resolve, reject) => { - const worker = new Worker(this.merkleWorkerPath); - worker.onmessage = (e) => { - resolve(e.data); - }; - worker.onerror = (e) => { - reject(e); - }; - worker.postMessage({ + async createPartialTree({ edge, elements }) { + const { hash: hashFunction } = await mimc.getHash(); + if (this.merkleWorkerPath) { + console.log("Using merkleWorker\n"); + try { + if (isNode) { + const merkleWorkerPromise = new Promise((resolve, reject) => { + const worker = new worker_threads.Worker(this.merkleWorkerPath, { + workerData: { merkleTreeHeight: this.merkleTreeHeight, edge, elements, zeroElement: this.emptyElement - }); + } }); - return fixedMerkleTree.PartialMerkleTree.deserialize(JSON.parse(yield merkleWorkerPromise), hashFunction); - } - } catch (err) { - console.log("merkleWorker failed, falling back to synchronous merkle tree"); - console.log(err); + worker.on("message", resolve); + worker.on("error", reject); + worker.on("exit", (code) => { + if (code !== 0) { + reject(new Error(`Worker stopped with exit code ${code}`)); + } + }); + }); + return fixedMerkleTree.PartialMerkleTree.deserialize(JSON.parse(await merkleWorkerPromise), hashFunction); + } else { + const merkleWorkerPromise = new Promise((resolve, reject) => { + const worker = new Worker(this.merkleWorkerPath); + worker.onmessage = (e) => { + resolve(e.data); + }; + worker.onerror = (e) => { + reject(e); + }; + worker.postMessage({ + merkleTreeHeight: this.merkleTreeHeight, + edge, + elements, + zeroElement: this.emptyElement + }); + }); + return fixedMerkleTree.PartialMerkleTree.deserialize(JSON.parse(await merkleWorkerPromise), hashFunction); } + } catch (err) { + console.log("merkleWorker failed, falling back to synchronous merkle tree"); + console.log(err); } - return new fixedMerkleTree.PartialMerkleTree(this.merkleTreeHeight, edge, elements, { - zeroElement: this.emptyElement, - hashFunction - }); + } + return new fixedMerkleTree.PartialMerkleTree(this.merkleTreeHeight, edge, elements, { + zeroElement: this.emptyElement, + hashFunction }); } - verifyTree(events) { - return __async$4(this, null, function* () { - console.log( - ` + async verifyTree(events) { + console.log( + ` Creating deposit tree for ${this.netId} ${this.amount} ${this.currency.toUpperCase()} would take a while ` - ); - console.time("Created tree in"); - const tree = yield this.createTree(events.map(({ commitment }) => commitment)); - console.timeEnd("Created tree in"); - console.log(""); - const isKnownRoot = yield this.Tornado.isKnownRoot(toFixedHex(BigInt(tree.root))); - if (!isKnownRoot) { - const errMsg = `Deposit Event ${this.netId} ${this.amount} ${this.currency} is invalid`; - throw new Error(errMsg); - } - return tree; - }); + ); + const timeStart = Date.now(); + const tree = await this.createTree(events.map(({ commitment }) => commitment)); + const isKnownRoot = await this.Tornado.isKnownRoot(toFixedHex(BigInt(tree.root))); + if (!isKnownRoot) { + const errMsg = `Deposit Event ${this.netId} ${this.amount} ${this.currency} is invalid`; + throw new Error(errMsg); + } + console.log( + ` +Created ${this.netId} ${this.amount} ${this.currency.toUpperCase()} tree in ${Date.now() - timeStart}ms +` + ); + return tree; } } -var __async$3 = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } +async function multicall(Multicall2, calls) { + const calldata = calls.map((call) => { + const target = call.contract?.target || call.address; + const callInterface = call.contract?.interface || call.interface; + return { + target, + callData: callInterface.encodeFunctionData(call.name, call.params), + allowFailure: call.allowFailure ?? false }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); }); -}; + const returnData = await Multicall2.aggregate3.staticCall(calldata); + const res = returnData.map((call, i) => { + const callInterface = calls[i].contract?.interface || calls[i].interface; + const [result, data] = call; + const decodeResult = result && data && data !== "0x" ? callInterface.decodeFunctionResult(calls[i].name, data) : null; + return !decodeResult ? null : decodeResult.length === 1 ? decodeResult[0] : decodeResult; + }); + return res; +} + +const permit2Address = "0x000000000022D473030F116dDEE9F6B43aC78BA3"; +async function getPermitSignature({ + Token, + signer, + spender, + value, + nonce, + deadline +}) { + const sigSigner = signer || Token.runner; + const provider = sigSigner.provider; + const [name, lastNonce, { chainId }] = await Promise.all([ + Token.name(), + Token.nonces(sigSigner.address), + provider.getNetwork() + ]); + const DOMAIN_SEPARATOR = { + name, + version: "1", + chainId, + verifyingContract: Token.target + }; + const PERMIT_TYPE = { + Permit: [ + { name: "owner", type: "address" }, + { name: "spender", type: "address" }, + { name: "value", type: "uint256" }, + { name: "nonce", type: "uint256" }, + { name: "deadline", type: "uint256" } + ] + }; + return ethers.Signature.from( + await sigSigner.signTypedData(DOMAIN_SEPARATOR, PERMIT_TYPE, { + owner: sigSigner.address, + spender, + value, + nonce: nonce || lastNonce, + deadline: deadline || ethers.MaxUint256 + }) + ); +} +async function getPermitCommitmentsSignature({ + PermitTornado: PermitTornado2, + Token, + signer, + denomination, + commitments, + nonce +}) { + const value = BigInt(commitments.length) * denomination; + const commitmentsHash = ethers.solidityPackedKeccak256(["bytes32[]"], [commitments]); + return await getPermitSignature({ + Token, + signer, + spender: PermitTornado2.target, + value, + nonce, + deadline: BigInt(commitmentsHash) + }); +} +async function getPermit2Signature({ + Token, + signer, + spender, + value: amount, + nonce, + deadline, + witness +}) { + const sigSigner = signer || Token.runner; + const provider = sigSigner.provider; + const domain = { + name: "Permit2", + chainId: (await provider.getNetwork()).chainId, + verifyingContract: permit2Address + }; + const types = !witness ? { + PermitTransferFrom: [ + { name: "permitted", type: "TokenPermissions" }, + { name: "spender", type: "address" }, + { name: "nonce", type: "uint256" }, + { name: "deadline", type: "uint256" } + ], + TokenPermissions: [ + { name: "token", type: "address" }, + { name: "amount", type: "uint256" } + ] + } : { + PermitWitnessTransferFrom: [ + { name: "permitted", type: "TokenPermissions" }, + { name: "spender", type: "address" }, + { name: "nonce", type: "uint256" }, + { name: "deadline", type: "uint256" }, + { name: "witness", type: witness.witnessTypeName } + ], + TokenPermissions: [ + { name: "token", type: "address" }, + { name: "amount", type: "uint256" } + ], + ...witness.witnessType + }; + const values = { + permitted: { + token: Token.target, + amount + }, + spender, + // Sorted nonce are not required for Permit2 + nonce: nonce || rBigInt(16), + deadline: deadline || ethers.MaxUint256 + }; + if (witness) { + values.witness = witness.witness; + } + const hash = new ethers.TypedDataEncoder(types).hash(values); + const signature = ethers.Signature.from(await sigSigner.signTypedData(domain, types, values)); + return { + domain, + types, + values, + hash, + signature + }; +} +async function getPermit2CommitmentsSignature({ + PermitTornado: PermitTornado2, + Token, + signer, + denomination, + commitments, + nonce, + deadline +}) { + const value = BigInt(commitments.length) * denomination; + const commitmentsHash = ethers.solidityPackedKeccak256(["bytes32[]"], [commitments]); + return await getPermit2Signature({ + Token, + signer, + spender: PermitTornado2.target, + value, + nonce, + deadline, + witness: { + witnessTypeName: "PermitCommitments", + witnessType: { + PermitCommitments: [ + { name: "instance", type: "address" }, + { name: "commitmentsHash", type: "bytes32" } + ] + }, + witness: { + instance: PermitTornado2.target, + commitmentsHash + } + } + }); +} + class TokenPriceOracle { + oracle; + multicall; + provider; + fallbackPrice; constructor(provider, multicall2, oracle) { this.provider = provider; this.multicall = multicall2; this.oracle = oracle; + this.fallbackPrice = ethers.parseEther("0.0001"); } - fetchPrices(tokens) { - return __async$3(this, null, function* () { - if (!this.oracle) { - return new Promise((resolve) => resolve(tokens.map(() => ethers.parseEther("0.0001")))); + buildCalls(tokens) { + return tokens.map(({ tokenAddress }) => ({ + contract: this.oracle, + name: "getRateToEth", + params: [tokenAddress, true], + allowFailure: true + })); + } + buildStable(stablecoinAddress) { + const stablecoin = ERC20__factory.connect(stablecoinAddress, this.provider); + return [ + { + contract: stablecoin, + name: "decimals" + }, + { + contract: this.oracle, + name: "getRateToEth", + params: [stablecoin.target, true], + allowFailure: true } - const prices = yield multicall( - this.multicall, - tokens.map(({ tokenAddress }) => ({ - contract: this.oracle, - name: "getRateToEth", - params: [tokenAddress, true] - })) + ]; + } + async fetchPrice(tokenAddress, decimals) { + if (!this.oracle) { + return new Promise((resolve) => resolve(this.fallbackPrice)); + } + try { + const price = await this.oracle.getRateToEth(tokenAddress, true); + return price * BigInt(10 ** decimals) / BigInt(10 ** 18); + } catch (err) { + console.log( + `Failed to fetch oracle price for ${tokenAddress}, will use fallback price ${this.fallbackPrice}` ); - return prices.map((price, index) => { - return price * BigInt(10 ** tokens[index].decimals) / BigInt(10 ** 18); - }); + console.log(err); + return this.fallbackPrice; + } + } + async fetchPrices(tokens) { + if (!this.oracle) { + return new Promise((resolve) => resolve(tokens.map(() => this.fallbackPrice))); + } + const prices = await multicall(this.multicall, this.buildCalls(tokens)); + return prices.map((price, index) => { + if (!price) { + price = this.fallbackPrice; + } + return price * BigInt(10 ** tokens[index].decimals) / BigInt(10 ** 18); }); } + async fetchEthUSD(stablecoinAddress) { + if (!this.oracle) { + return new Promise((resolve) => resolve(10 ** 18 / Number(this.fallbackPrice))); + } + const [decimals, price] = await multicall(this.multicall, this.buildStable(stablecoinAddress)); + const ethPrice = (price || this.fallbackPrice) * BigInt(10n ** decimals) / BigInt(10 ** 18); + return 1 / Number(ethers.formatEther(ethPrice)); + } } -var __defProp = Object.defineProperty; -var __defProps = Object.defineProperties; -var __getOwnPropDescs = Object.getOwnPropertyDescriptors; -var __getOwnPropSymbols = Object.getOwnPropertySymbols; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __propIsEnum = Object.prototype.propertyIsEnumerable; -var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __spreadValues = (a, b) => { - for (var prop in b || (b = {})) - if (__hasOwnProp.call(b, prop)) - __defNormalProp(a, prop, b[prop]); - if (__getOwnPropSymbols) - for (var prop of __getOwnPropSymbols(b)) { - if (__propIsEnum.call(b, prop)) - __defNormalProp(a, prop, b[prop]); - } - return a; -}; -var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); -var __async$2 = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); +async function getTokenBalances({ + provider, + Multicall: Multicall2, + currencyName, + userAddress, + tokenAddresses = [] +}) { + const tokenCalls = tokenAddresses.map((tokenAddress) => { + const Token = ERC20__factory.connect(tokenAddress, provider); + return [ + { + contract: Token, + name: "balanceOf", + params: [userAddress] + }, + { + contract: Token, + name: "name" + }, + { + contract: Token, + name: "symbol" + }, + { + contract: Token, + name: "decimals" } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; -const MIN_STAKE_BALANCE = ethers.parseEther("500"); -const semVerRegex = new RegExp("^(?0|[1-9]\\d*)\\.(?0|[1-9]\\d*)\\.(?0|[1-9]\\d*)(?:-(?(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+(?[0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"); -function parseSemanticVersion(version) { - const { groups } = semVerRegex.exec(version); - return groups; -} -function isRelayerUpdated(relayerVersion, netId) { - const { major, patch, prerelease } = parseSemanticVersion(relayerVersion); - const requiredMajor = netId === NetId.MAINNET ? "4" : "5"; - const isUpdatedMajor = major === requiredMajor; - if (prerelease) - return false; - return isUpdatedMajor && (Number(patch) >= 5 || netId !== NetId.MAINNET); -} -function calculateScore({ stakeBalance, tornadoServiceFee }, minFee = 0.33, maxFee = 0.53) { - if (tornadoServiceFee < minFee) { - tornadoServiceFee = minFee; - } else if (tornadoServiceFee >= maxFee) { - return BigInt(0); - } - const serviceFeeCoefficient = (tornadoServiceFee - minFee) ** 2; - const feeDiffCoefficient = 1 / (maxFee - minFee) ** 2; - const coefficientsMultiplier = 1 - feeDiffCoefficient * serviceFeeCoefficient; - return BigInt(Math.floor(Number(stakeBalance) * coefficientsMultiplier)); -} -function getWeightRandom(weightsScores, random) { - for (let i = 0; i < weightsScores.length; i++) { - if (random < weightsScores[i]) { - return i; - } - random = random - weightsScores[i]; - } - return Math.floor(Math.random() * weightsScores.length); -} -function getSupportedInstances(instanceList) { - const rawList = Object.values(instanceList).map(({ instanceAddress }) => { - return Object.values(instanceAddress); + ]; }).flat(); - return rawList.map((l) => ethers.getAddress(l)); + const multicallResults = await multicall(Multicall2, [ + { + contract: Multicall2, + name: "getEthBalance", + params: [userAddress] + }, + ...tokenCalls.length ? tokenCalls : [] + ]); + const ethResults = multicallResults[0]; + const tokenResults = multicallResults.slice(1).length ? chunk(multicallResults.slice(1), tokenCalls.length / tokenAddresses.length) : []; + const tokenBalances = tokenResults.map((tokenResult, index) => { + const [tokenBalance, tokenName, tokenSymbol, tokenDecimals] = tokenResult; + const tokenAddress = tokenAddresses[index]; + return { + address: tokenAddress, + name: tokenName, + symbol: tokenSymbol, + decimals: Number(tokenDecimals), + balance: tokenBalance + }; + }); + return [ + { + address: ethers.ZeroAddress, + name: currencyName, + symbol: currencyName, + decimals: 18, + balance: ethResults + }, + ...tokenBalances + ]; } -function pickWeightedRandomRelayer(relayers, netId) { - let minFee, maxFee; - if (netId !== NetId.MAINNET) { - minFee = 0.01; - maxFee = 0.3; + +const MAX_TOVARISH_EVENTS = 5e3; +class TovarishClient extends RelayerClient { + constructor(clientConstructor) { + super(clientConstructor); + this.tovarish = true; } - const weightsScores = relayers.map((el) => calculateScore(el, minFee, maxFee)); - const totalWeight = weightsScores.reduce((acc, curr) => { - return acc = acc + curr; - }, BigInt("0")); - const random = BigInt(Number(totalWeight) * Math.random()); - const weightRandomIndex = getWeightRandom(weightsScores, random); - return relayers[weightRandomIndex]; -} -class RelayerClient { - constructor({ netId, config, Aggregator, fetchDataOptions: fetchDataOptions2 }) { - this.netId = netId; - this.config = config; - this.Aggregator = Aggregator; - this.fetchDataOptions = fetchDataOptions2; - } - askRelayerStatus(_0) { - return __async$2(this, arguments, function* ({ + async askRelayerStatus({ + hostname, + url, + relayerAddress + }) { + const status = await super.askRelayerStatus({ hostname, + url, relayerAddress - }) { - var _a, _b; - const url = `https://${!hostname.endsWith("/") ? hostname + "/" : hostname}`; - const rawStatus = yield fetchData(`${url}status`, __spreadProps(__spreadValues({}, this.fetchDataOptions), { - headers: { - "Content-Type": "application/json, application/x-www-form-urlencoded" - }, - timeout: ((_a = this.fetchDataOptions) == null ? void 0 : _a.torPort) ? 1e4 : 3e3, - maxRetry: ((_b = this.fetchDataOptions) == null ? void 0 : _b.torPort) ? 2 : 0 - })); - const statusValidator = ajv.compile(getStatusSchema(this.netId, this.config)); - if (!statusValidator(rawStatus)) { - throw new Error("Invalid status schema"); + }); + if (!status.version.includes("tovarish")) { + throw new Error("Not a tovarish relayer!"); + } + return status; + } + /** + * Ask status for all enabled chains for tovarish relayer + */ + async askAllStatus({ + hostname, + url, + relayerAddress + }) { + if (!url && hostname) { + url = `https://${!hostname.endsWith("/") ? hostname + "/" : hostname}`; + } else if (url && !url.endsWith("/")) { + url += "/"; + } else { + url = ""; + } + const statusArray = await fetchData(`${url}status`, { + ...this.fetchDataOptions, + headers: { + "Content-Type": "application/json, application/x-www-form-urlencoded" + }, + timeout: 3e4, + maxRetry: this.fetchDataOptions?.torPort ? 2 : 0 + }); + if (!Array.isArray(statusArray)) { + return []; + } + const tovarishStatus = []; + for (const rawStatus of statusArray) { + const netId = rawStatus.netId; + const config = getConfig(netId); + const statusValidator = ajv.compile( + getStatusSchema( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + rawStatus.netId, + config, + this.tovarish + ) + ); + if (!statusValidator) { + continue; } - const status = __spreadProps(__spreadValues({}, rawStatus), { - url - }); + const status = { + ...rawStatus, + url: `${url}${netId}/` + }; if (status.currentQueue > 5) { throw new Error("Withdrawal queue is overloaded"); } - if (status.netId !== this.netId) { + if (!enabledChains.includes(status.netId)) { throw new Error("This relayer serves a different network"); } - if (relayerAddress && this.netId === NetId.MAINNET && status.rewardAccount !== relayerAddress) { + if (relayerAddress && status.netId === NetId.MAINNET && status.rewardAccount !== relayerAddress) { throw new Error("The Relayer reward address must match registered address"); } - if (!isRelayerUpdated(status.version, this.netId)) { - throw new Error("Outdated version."); + if (!status.version.includes("tovarish")) { + throw new Error("Not a tovarish relayer!"); } - return status; - }); + tovarishStatus.push(status); + } + return tovarishStatus; } - filterRelayer(curr, relayer, subdomains, debugRelayer = false) { - return __async$2(this, null, function* () { - var _a; - const { relayerEnsSubdomain } = this.config; - const subdomainIndex = subdomains.indexOf(relayerEnsSubdomain); - const mainnetSubdomain = curr.records[0]; - const hostname = curr.records[subdomainIndex]; - const isHostWithProtocol = hostname.includes("http"); - const { owner, balance: stakeBalance, isRegistered } = curr; - const { ensName, relayerAddress } = relayer; - const isOwner = !relayerAddress || relayerAddress === owner; - const hasMinBalance = stakeBalance >= MIN_STAKE_BALANCE; - const preCondition = hostname && isOwner && mainnetSubdomain && isRegistered && hasMinBalance && !isHostWithProtocol; - if (preCondition || debugRelayer) { - try { - const status = yield this.askRelayerStatus({ hostname, relayerAddress }); - return { - netId: status.netId, - url: status.url, - hostname, - ensName, - stakeBalance, - relayerAddress, - rewardAccount: ethers.getAddress(status.rewardAccount), - instances: getSupportedInstances(status.instances), - gasPrice: (_a = status.gasPrices) == null ? void 0 : _a.fast, - ethPrices: status.ethPrices, - currentQueue: status.currentQueue, - tornadoServiceFee: status.tornadoServiceFee - }; - } catch (err) { - if (debugRelayer) { - throw err; - } - return { - hostname, - relayerAddress, - errorMessage: err.message - }; - } - } else { - if (debugRelayer) { - const errMsg = `Relayer ${hostname} condition not met`; - throw new Error(errMsg); - } - return { - hostname, - relayerAddress, - errorMessage: `Relayer ${hostname} condition not met` - }; - } - }); - } - getValidRelayers(relayers, subdomains, debugRelayer = false) { - return __async$2(this, null, function* () { - const relayersSet = /* @__PURE__ */ new Set(); - const uniqueRelayers = relayers.reverse().filter(({ ensName }) => { - if (!relayersSet.has(ensName)) { - relayersSet.add(ensName); - return true; - } - return false; + async filterRelayer(relayer) { + const { ensName, relayerAddress, tovarishHost, tovarishNetworks } = relayer; + if (!tovarishHost || !tovarishNetworks?.includes(this.netId)) { + return; + } + const hostname = `${tovarishHost}/${this.netId}`; + try { + const status = await this.askRelayerStatus({ + hostname, + relayerAddress }); - const relayerNameHashes = uniqueRelayers.map((r) => ethers.namehash(r.ensName)); - const relayersData = yield this.Aggregator.relayersData.staticCall(relayerNameHashes, subdomains); - const invalidRelayers = []; - const validRelayers = (yield Promise.all( - relayersData.map((curr, index) => this.filterRelayer(curr, uniqueRelayers[index], subdomains, debugRelayer)) - )).filter((r) => { - if (r.errorMessage) { + return { + netId: status.netId, + url: status.url, + hostname, + ensName, + relayerAddress, + rewardAccount: ethers.getAddress(status.rewardAccount), + instances: getSupportedInstances(status.instances), + stakeBalance: relayer.stakeBalance, + gasPrice: status.gasPrices?.fast, + ethPrices: status.ethPrices, + currentQueue: status.currentQueue, + tornadoServiceFee: status.tornadoServiceFee, + // Additional fields for tovarish relayer + latestBlock: Number(status.latestBlock), + latestBalance: status.latestBalance, + version: status.version, + events: status.events, + syncStatus: status.syncStatus + }; + } catch (err) { + return { + hostname, + relayerAddress, + errorMessage: err.message, + hasError: true + }; + } + } + async getValidRelayers(relayers) { + const invalidRelayers = []; + const validRelayers = (await Promise.all(relayers.map((relayer) => this.filterRelayer(relayer)))).filter( + (r) => { + if (!r) { + return false; + } + if (r.hasError) { invalidRelayers.push(r); return false; } return true; - }); - return { - validRelayers, - invalidRelayers - }; - }); - } - pickWeightedRandomRelayer(relayers) { - return pickWeightedRandomRelayer(relayers, this.netId); - } - tornadoWithdraw(_0) { - return __async$2(this, arguments, function* ({ contract, proof, args }) { - const { url } = this.selectedRelayer; - const withdrawResponse = yield fetchData(`${url}v1/tornadoWithdraw`, __spreadProps(__spreadValues({}, this.fetchDataOptions), { - method: "POST", - headers: { - "Content-Type": "application/json" - }, - body: JSON.stringify({ - contract, - proof, - args - }) - })); - const { id, error } = withdrawResponse; - if (error) { - throw new Error(error); } - let relayerStatus; - const jobUrl = `${url}v1/jobs/${id}`; - console.log(`Job submitted: ${jobUrl} -`); - while (!relayerStatus || !["FAILED", "CONFIRMED"].includes(relayerStatus)) { - const jobResponse = yield fetchData(jobUrl, __spreadProps(__spreadValues({}, this.fetchDataOptions), { - method: "GET", + ); + return { + validRelayers, + invalidRelayers + }; + } + async getTovarishRelayers(relayers) { + const validRelayers = []; + const invalidRelayers = []; + await Promise.all( + relayers.filter((r) => r.tovarishHost && r.tovarishNetworks?.length).map(async (relayer) => { + const { ensName, relayerAddress, tovarishHost } = relayer; + try { + const statusArray = await this.askAllStatus({ + hostname: tovarishHost, + relayerAddress + }); + for (const status of statusArray) { + validRelayers.push({ + netId: status.netId, + url: status.url, + hostname: tovarishHost, + ensName, + relayerAddress, + rewardAccount: ethers.getAddress(status.rewardAccount), + instances: getSupportedInstances(status.instances), + stakeBalance: relayer.stakeBalance, + gasPrice: status.gasPrices?.fast, + ethPrices: status.ethPrices, + currentQueue: status.currentQueue, + tornadoServiceFee: status.tornadoServiceFee, + // Additional fields for tovarish relayer + latestBlock: Number(status.latestBlock), + latestBalance: status.latestBalance, + version: status.version, + events: status.events, + syncStatus: status.syncStatus + }); + } + } catch (err) { + invalidRelayers.push({ + hostname: tovarishHost, + relayerAddress, + errorMessage: err.message, + hasError: true + }); + } + }) + ); + return { + validRelayers, + invalidRelayers + }; + } + async getEvents({ + type, + currency, + amount, + fromBlock, + recent + }) { + const url = `${this.selectedRelayer?.url}events`; + const schemaValidator = getEventsSchemaValidator(type); + try { + const events = []; + let lastSyncBlock = fromBlock; + while (true) { + let { events: fetchedEvents, lastSyncBlock: currentBlock } = await fetchData(url, { + ...this.fetchDataOptions, + method: "POST", headers: { "Content-Type": "application/json" - } - })); - if (jobResponse.error) { - throw new Error(error); - } - const jobValidator = ajv.compile(jobsSchema); - if (!jobValidator(jobResponse)) { - const errMsg = `${jobUrl} has an invalid job response`; + }, + body: JSON.stringify({ + type, + currency, + amount, + fromBlock, + recent + }) + }); + if (!schemaValidator(fetchedEvents)) { + const errMsg = `Schema validation failed for ${type} events`; throw new Error(errMsg); } - const { status, txHash, confirmations, failedReason } = jobResponse; - if (relayerStatus !== status) { - if (status === "FAILED") { - const errMsg = `Job ${status}: ${jobUrl} failed reason: ${failedReason}`; - throw new Error(errMsg); - } else if (status === "SENT") { - console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash} -`); - } else if (status === "MINED") { - console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash}, confirmations: ${confirmations} -`); - } else if (status === "CONFIRMED") { - console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash}, confirmations: ${confirmations} -`); - } else { - console.log(`Job ${status}: ${jobUrl} -`); - } - relayerStatus = status; + if (recent) { + return { + events: fetchedEvents, + lastSyncBlock: currentBlock + }; } - yield sleep(3e3); + lastSyncBlock = currentBlock; + if (!Array.isArray(fetchedEvents) || !fetchedEvents.length) { + break; + } + fetchedEvents = fetchedEvents.sort((a, b) => { + if (a.blockNumber === b.blockNumber) { + return a.logIndex - b.logIndex; + } + return a.blockNumber - b.blockNumber; + }); + const [lastEvent] = fetchedEvents.slice(-1); + if (fetchedEvents.length < MAX_TOVARISH_EVENTS - 100) { + events.push(...fetchedEvents); + break; + } + fetchedEvents = fetchedEvents.filter((e) => e.blockNumber !== lastEvent.blockNumber); + fromBlock = Number(lastEvent.blockNumber); + events.push(...fetchedEvents); } - }); + return { + events, + lastSyncBlock + }; + } catch (err) { + console.log("Error from TovarishClient events endpoint"); + console.log(err); + return { + events: [], + lastSyncBlock: fromBlock + }; + } } } -var __async$1 = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; -function getTokenBalances(_0) { - return __async$1(this, arguments, function* ({ - provider, - Multicall: Multicall2, - currencyName, - userAddress, - tokenAddresses = [] - }) { - const tokenCalls = tokenAddresses.map((tokenAddress) => { - const Token = ERC20__factory.connect(tokenAddress, provider); - return [ - { - contract: Token, - name: "balanceOf", - params: [userAddress] - }, - { - contract: Token, - name: "name" - }, - { - contract: Token, - name: "symbol" - }, - { - contract: Token, - name: "decimals" - } - ]; - }).flat(); - const multicallResults = yield multicall(Multicall2, [ - { - contract: Multicall2, - name: "getEthBalance", - params: [userAddress] - }, - ...tokenCalls.length ? tokenCalls : [] - ]); - const ethResults = multicallResults[0]; - const tokenResults = multicallResults.slice(1).length ? chunk(multicallResults.slice(1), tokenCalls.length / tokenAddresses.length) : []; - const tokenBalances = tokenResults.map((tokenResult, index) => { - const [tokenBalance, tokenName, tokenSymbol, tokenDecimals] = tokenResult; - const tokenAddress = tokenAddresses[index]; - return { - address: tokenAddress, - name: tokenName, - symbol: tokenSymbol, - decimals: Number(tokenDecimals), - balance: tokenBalance - }; - }); - return [ - { - address: ethers.ZeroAddress, - name: currencyName, - symbol: currencyName, - decimals: 18, - balance: ethResults - }, - ...tokenBalances - ]; - }); -} - -var __async = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; let groth16; -function initGroth16() { - return __async(this, null, function* () { - if (!groth16) { - groth16 = yield websnarkGroth({ wasmInitialMemory: 2e3 }); - } - }); +async function initGroth16() { + if (!groth16) { + groth16 = await websnarkGroth({ wasmInitialMemory: 2e3 }); + } } -function calculateSnarkProof(input, circuit, provingKey) { - return __async(this, null, function* () { - if (!groth16) { - yield initGroth16(); - } - const snarkInput = { - root: input.root, - nullifierHash: BigInt(input.nullifierHex).toString(), - recipient: BigInt(input.recipient), - relayer: BigInt(input.relayer), - fee: input.fee, - refund: input.refund, - nullifier: input.nullifier, - secret: input.secret, - pathElements: input.pathElements, - pathIndices: input.pathIndices - }; - console.log("Start generating SNARK proof", snarkInput); - console.time("SNARK proof time"); - const proofData = yield websnarkUtils__namespace.genWitnessAndProve(yield groth16, snarkInput, circuit, provingKey); - const proof = websnarkUtils__namespace.toSolidityInput(proofData).proof; - console.timeEnd("SNARK proof time"); - const args = [ - toFixedHex(input.root, 32), - toFixedHex(input.nullifierHex, 32), - input.recipient, - input.relayer, - toFixedHex(input.fee, 32), - toFixedHex(input.refund, 32) - ]; - return { proof, args }; - }); +async function calculateSnarkProof(input, circuit, provingKey) { + if (!groth16) { + await initGroth16(); + } + const snarkInput = { + root: input.root, + nullifierHash: BigInt(input.nullifierHex).toString(), + recipient: BigInt(input.recipient), + relayer: BigInt(input.relayer), + fee: input.fee, + refund: input.refund, + nullifier: input.nullifier, + secret: input.secret, + pathElements: input.pathElements, + pathIndices: input.pathIndices + }; + console.log("Start generating SNARK proof", snarkInput); + console.time("SNARK proof time"); + const proofData = await websnarkUtils__namespace.genWitnessAndProve(await groth16, snarkInput, circuit, provingKey); + const proof = websnarkUtils__namespace.toSolidityInput(proofData).proof; + console.timeEnd("SNARK proof time"); + const args = [ + toFixedHex(input.root, 32), + toFixedHex(input.nullifierHex, 32), + input.recipient, + input.relayer, + toFixedHex(input.fee, 32), + toFixedHex(input.refund, 32) + ]; + return { proof, args }; } exports.BaseEchoService = BaseEchoService; exports.BaseEncryptedNotesService = BaseEncryptedNotesService; exports.BaseEventsService = BaseEventsService; exports.BaseGovernanceService = BaseGovernanceService; +exports.BaseMultiTornadoService = BaseMultiTornadoService; exports.BaseRegistryService = BaseRegistryService; +exports.BaseRevenueService = BaseRevenueService; exports.BaseTornadoService = BaseTornadoService; exports.BatchBlockService = BatchBlockService; exports.BatchEventsService = BatchEventsService; exports.BatchTransactionService = BatchTransactionService; -exports.DEPOSIT = DEPOSIT; +exports.DBEchoService = DBEchoService; +exports.DBEncryptedNotesService = DBEncryptedNotesService; +exports.DBGovernanceService = DBGovernanceService; +exports.DBRegistryService = DBRegistryService; +exports.DBRevenueService = DBRevenueService; +exports.DBTornadoService = DBTornadoService; exports.Deposit = Deposit; +exports.ENSNameWrapper__factory = ENSNameWrapper__factory; +exports.ENSRegistry__factory = ENSRegistry__factory; +exports.ENSResolver__factory = ENSResolver__factory; +exports.ENSUtils = ENSUtils; exports.ENS__factory = ENS__factory; exports.ERC20__factory = ERC20__factory; -exports.GET_DEPOSITS = GET_DEPOSITS; -exports.GET_ECHO_EVENTS = GET_ECHO_EVENTS; -exports.GET_ENCRYPTED_NOTES = GET_ENCRYPTED_NOTES; -exports.GET_GOVERNANCE_APY = GET_GOVERNANCE_APY; -exports.GET_GOVERNANCE_EVENTS = GET_GOVERNANCE_EVENTS; -exports.GET_NOTE_ACCOUNTS = GET_NOTE_ACCOUNTS; -exports.GET_REGISTERED = GET_REGISTERED; -exports.GET_STATISTIC = GET_STATISTIC; -exports.GET_WITHDRAWALS = GET_WITHDRAWALS; -exports.GasPriceOracle__factory = GasPriceOracle__factory; +exports.EnsContracts = EnsContracts; +exports.INDEX_DB_ERROR = INDEX_DB_ERROR; +exports.IndexedDB = IndexedDB; exports.Invoice = Invoice; +exports.MAX_FEE = MAX_FEE; +exports.MAX_TOVARISH_EVENTS = MAX_TOVARISH_EVENTS; +exports.MIN_FEE = MIN_FEE; exports.MIN_STAKE_BALANCE = MIN_STAKE_BALANCE; exports.MerkleTreeService = MerkleTreeService; exports.Mimc = Mimc; @@ -6878,15 +10674,18 @@ exports.TornadoFeeOracle = TornadoFeeOracle; exports.TornadoRpcSigner = TornadoRpcSigner; exports.TornadoVoidSigner = TornadoVoidSigner; exports.TornadoWallet = TornadoWallet; -exports.WITHDRAWAL = WITHDRAWAL; -exports._META = _META; +exports.TovarishClient = TovarishClient; exports.addNetwork = addNetwork; +exports.addressSchemaType = addressSchemaType; exports.ajv = ajv; exports.base64ToBytes = base64ToBytes; exports.bigIntReplacer = bigIntReplacer; +exports.bnSchemaType = bnSchemaType; exports.bnToBytes = bnToBytes; exports.buffPedersenHash = buffPedersenHash; exports.bufferToBytes = bufferToBytes; +exports.bytes32BNSchemaType = bytes32BNSchemaType; +exports.bytes32SchemaType = bytes32SchemaType; exports.bytesToBN = bytesToBN; exports.bytesToBase64 = bytesToBase64; exports.bytesToHex = bytesToHex; @@ -6899,57 +10698,85 @@ exports.createDeposit = createDeposit; exports.crypto = crypto; exports.defaultConfig = defaultConfig; exports.defaultUserAgent = defaultUserAgent; +exports.deployHasher = deployHasher; +exports.depositsEventsSchema = depositsEventsSchema; +exports.digest = digest; +exports.downloadZip = downloadZip; +exports.echoEventsSchema = echoEventsSchema; exports.enabledChains = enabledChains; +exports.encodedLabelToLabelhash = encodedLabelToLabelhash; +exports.encryptedNotesSchema = encryptedNotesSchema; exports.factories = index; -exports.fetch = fetch; exports.fetchData = fetchData; exports.fetchGetUrlFunc = fetchGetUrlFunc; -exports.getAllDeposits = getAllDeposits; -exports.getAllEncryptedNotes = getAllEncryptedNotes; -exports.getAllGovernanceEvents = getAllGovernanceEvents; -exports.getAllGraphEchoEvents = getAllGraphEchoEvents; -exports.getAllRegisters = getAllRegisters; -exports.getAllWithdrawals = getAllWithdrawals; +exports.fetchIp = fetchIp; +exports.fromContentHash = fromContentHash; +exports.gasZipID = gasZipID; +exports.gasZipInbounds = gasZipInbounds; +exports.gasZipInput = gasZipInput; +exports.gasZipMinMax = gasZipMinMax; +exports.getActiveTokenInstances = getActiveTokenInstances; +exports.getActiveTokens = getActiveTokens; exports.getConfig = getConfig; -exports.getDeposits = getDeposits; -exports.getEncryptedNotes = getEncryptedNotes; -exports.getGasOraclePlugin = getGasOraclePlugin; -exports.getGovernanceEvents = getGovernanceEvents; -exports.getGraphEchoEvents = getGraphEchoEvents; +exports.getEventsSchemaValidator = getEventsSchemaValidator; exports.getHttpAgent = getHttpAgent; +exports.getIndexedDB = getIndexedDB; exports.getInstanceByAddress = getInstanceByAddress; -exports.getMeta = getMeta; +exports.getMultiInstances = getMultiInstances; exports.getNetworkConfig = getNetworkConfig; -exports.getNoteAccounts = getNoteAccounts; +exports.getPermit2CommitmentsSignature = getPermit2CommitmentsSignature; +exports.getPermit2Signature = getPermit2Signature; +exports.getPermitCommitmentsSignature = getPermitCommitmentsSignature; +exports.getPermitSignature = getPermitSignature; exports.getProvider = getProvider; exports.getProviderWithNetId = getProviderWithNetId; -exports.getRegisters = getRegisters; -exports.getStatistic = getStatistic; +exports.getRelayerEnsSubdomains = getRelayerEnsSubdomains; exports.getStatusSchema = getStatusSchema; -exports.getSubdomains = getSubdomains; +exports.getSubInfo = getSubInfo; exports.getSupportedInstances = getSupportedInstances; exports.getTokenBalances = getTokenBalances; +exports.getTovarishNetworks = getTovarishNetworks; exports.getWeightRandom = getWeightRandom; -exports.getWithdrawals = getWithdrawals; +exports.governanceEventsSchema = governanceEventsSchema; +exports.hasherBytecode = hasherBytecode; exports.hexToBytes = hexToBytes; exports.initGroth16 = initGroth16; +exports.isHex = isHex; exports.isNode = isNode; -exports.isRelayerUpdated = isRelayerUpdated; +exports.jobRequestSchema = jobRequestSchema; exports.jobsSchema = jobsSchema; +exports.labelhash = labelhash; exports.leBuff2Int = leBuff2Int; exports.leInt2Buff = leInt2Buff; +exports.loadDBEvents = loadDBEvents; +exports.loadRemoteEvents = loadRemoteEvents; +exports.makeLabelNodeAndParent = makeLabelNodeAndParent; exports.mimc = mimc; +exports.multiQueryFilter = multiQueryFilter; exports.multicall = multicall; +exports.numberFormatter = numberFormatter; exports.packEncryptedMessage = packEncryptedMessage; -exports.parseSemanticVersion = parseSemanticVersion; +exports.parseInvoice = parseInvoice; +exports.parseNote = parseNote; exports.pedersen = pedersen; +exports.permit2Address = permit2Address; exports.pickWeightedRandomRelayer = pickWeightedRandomRelayer; exports.populateTransaction = populateTransaction; -exports.queryGraph = queryGraph; +exports.proofSchemaType = proofSchemaType; +exports.proposalState = proposalState; exports.rBigInt = rBigInt; +exports.rHex = rHex; +exports.relayerRegistryEventsSchema = relayerRegistryEventsSchema; +exports.saveDBEvents = saveDBEvents; exports.sleep = sleep; +exports.stakeBurnedEventsSchema = stakeBurnedEventsSchema; exports.substring = substring; +exports.toContentHash = toContentHash; exports.toFixedHex = toFixedHex; exports.toFixedLength = toFixedLength; +exports.tornadoEventsSchema = tornadoEventsSchema; exports.unpackEncryptedMessage = unpackEncryptedMessage; +exports.unzipAsync = unzipAsync; exports.validateUrl = validateUrl; +exports.withdrawalsEventsSchema = withdrawalsEventsSchema; +exports.zipAsync = zipAsync; diff --git a/dist/index.mjs b/dist/index.mjs index c61113d..672c8eb 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -1,16 +1,3587 @@ -import { Interface, Contract, FetchUrlFeeDataNetworkPlugin, FetchRequest, Network, EnsPlugin, GasCostPlugin, JsonRpcProvider, Wallet, HDNodeWallet, VoidSigner, JsonRpcSigner, BrowserProvider, parseUnits, FeeData, getAddress, computeAddress, Transaction, parseEther, namehash, ZeroAddress } from 'ethers'; -import crossFetch from 'cross-fetch'; +import { isHexString, assertArgument, assert, EventLog, UndecodedEventLog, Log, FetchRequest, JsonRpcProvider, Network, EnsPlugin, GasCostPlugin, Wallet, HDNodeWallet, VoidSigner, JsonRpcSigner, BrowserProvider, isAddress, parseEther, getAddress, AbiCoder, formatEther, namehash, dataSlice, dataLength, Interface, Contract, computeAddress, keccak256, EnsResolver, parseUnits, Transaction, Signature, MaxUint256, solidityPackedKeccak256, TypedDataEncoder, ZeroAddress } from 'ethers'; +import { Tornado__factory } from '@tornado/contracts'; import { webcrypto } from 'crypto'; import BN from 'bn.js'; +import * as contentHashUtils from '@ensdomains/content-hash'; +import crossFetch from 'cross-fetch'; import Ajv from 'ajv'; +import { zip, unzip } from 'fflate'; import { buildPedersenHash, buildMimcSponge } from 'circomlibjs'; import { getEncryptionPublicKey, encrypt, decrypt } from '@metamask/eth-sig-util'; +import { openDB, deleteDB } from 'idb'; import { Worker as Worker$1 } from 'worker_threads'; import { MerkleTree, PartialMerkleTree } from '@tornado/fixed-merkle-tree'; import * as websnarkUtils from '@tornado/websnark/src/utils'; import websnarkGroth from '@tornado/websnark/src/groth16'; -const _abi$6 = [ +BigInt.prototype.toJSON = function() { + return this.toString(); +}; +const isNode = !process.browser && typeof globalThis.window === "undefined"; +const crypto = isNode ? webcrypto : globalThis.crypto; +const chunk = (arr, size) => [...Array(Math.ceil(arr.length / size))].map((_, i) => arr.slice(size * i, size + size * i)); +function sleep(ms) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} +function validateUrl(url, protocols) { + try { + const parsedUrl = new URL(url); + if (protocols && protocols.length) { + return protocols.map((p) => p.toLowerCase()).includes(parsedUrl.protocol); + } + return true; + } catch { + return false; + } +} +function concatBytes(...arrays) { + const totalSize = arrays.reduce((acc, e) => acc + e.length, 0); + const merged = new Uint8Array(totalSize); + arrays.forEach((array, i, arrays2) => { + const offset = arrays2.slice(0, i).reduce((acc, e) => acc + e.length, 0); + merged.set(array, offset); + }); + return merged; +} +function bufferToBytes(b) { + return new Uint8Array(b.buffer); +} +function bytesToBase64(bytes) { + return btoa(bytes.reduce((data, byte) => data + String.fromCharCode(byte), "")); +} +function base64ToBytes(base64) { + return Uint8Array.from(atob(base64), (c) => c.charCodeAt(0)); +} +function bytesToHex(bytes) { + return "0x" + Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join(""); +} +function hexToBytes(hexString) { + if (hexString.slice(0, 2) === "0x") { + hexString = hexString.slice(2); + } + if (hexString.length % 2 !== 0) { + hexString = "0" + hexString; + } + return Uint8Array.from(hexString.match(/.{1,2}/g).map((byte) => parseInt(byte, 16))); +} +function bytesToBN(bytes) { + return BigInt(bytesToHex(bytes)); +} +function bnToBytes(bigint) { + let hexString = typeof bigint === "bigint" ? bigint.toString(16) : bigint; + if (hexString.slice(0, 2) === "0x") { + hexString = hexString.slice(2); + } + if (hexString.length % 2 !== 0) { + hexString = "0" + hexString; + } + return Uint8Array.from(hexString.match(/.{1,2}/g).map((byte) => parseInt(byte, 16))); +} +function leBuff2Int(bytes) { + return new BN(bytes, 16, "le"); +} +function leInt2Buff(bigint) { + return Uint8Array.from(new BN(bigint).toArray("le", 31)); +} +function toFixedHex(numberish, length = 32) { + return "0x" + BigInt(numberish).toString(16).padStart(length * 2, "0"); +} +function toFixedLength(string, length = 32) { + string = string.replace("0x", ""); + return "0x" + string.padStart(length * 2, "0"); +} +function rBigInt(nbytes = 31) { + return bytesToBN(crypto.getRandomValues(new Uint8Array(nbytes))); +} +function rHex(nbytes = 32) { + return bytesToHex(crypto.getRandomValues(new Uint8Array(nbytes))); +} +function bigIntReplacer(key, value) { + return typeof value === "bigint" ? value.toString() : value; +} +function substring(str, length = 10) { + if (str.length < length * 2) { + return str; + } + return `${str.substring(0, length)}...${str.substring(str.length - length)}`; +} +async function digest(bytes, algo = "SHA-384") { + return new Uint8Array(await crypto.subtle.digest(algo, bytes)); +} +function numberFormatter(num, digits = 3) { + const lookup = [ + { value: 1, symbol: "" }, + { value: 1e3, symbol: "K" }, + { value: 1e6, symbol: "M" }, + { value: 1e9, symbol: "G" }, + { value: 1e12, symbol: "T" }, + { value: 1e15, symbol: "P" }, + { value: 1e18, symbol: "E" } + ]; + const regexp = /\.0+$|(?<=\.[0-9]*[1-9])0+$/; + const item = lookup.slice().reverse().find((item2) => Number(num) >= item2.value); + return item ? (Number(num) / item.value).toFixed(digits).replace(regexp, "").concat(item.symbol) : "0"; +} +function isHex(value) { + return /^0x[0-9a-fA-F]*$/.test(value); +} +function toContentHash(ipfsUrl) { + return contentHashUtils.fromIpfs(ipfsUrl); +} +function fromContentHash(contentHash) { + return contentHashUtils.decode(contentHash); +} + +function isDeferred(value) { + return value && typeof value === "object" && "getTopicFilter" in value && typeof value.getTopicFilter === "function" && value.fragment; +} +async function getSubInfo(abiInterface, event) { + let topics; + let fragment = null; + if (Array.isArray(event)) { + const topicHashify = function(name) { + if (isHexString(name, 32)) { + return name; + } + const fragment2 = abiInterface.getEvent(name); + assertArgument(fragment2, "unknown fragment", "name", name); + return fragment2.topicHash; + }; + topics = event.map((e) => { + if (e == null) { + return null; + } + if (Array.isArray(e)) { + return e.map(topicHashify); + } + return topicHashify(e); + }); + } else if (event === "*") { + topics = [null]; + } else if (typeof event === "string") { + if (isHexString(event, 32)) { + topics = [event]; + } else { + fragment = abiInterface.getEvent(event); + assertArgument(fragment, "unknown fragment", "event", event); + topics = [fragment.topicHash]; + } + } else if (isDeferred(event)) { + topics = await event.getTopicFilter(); + } else if ("fragment" in event) { + fragment = event.fragment; + topics = [fragment.topicHash]; + } else { + assertArgument(false, "unknown event name", "event", event); + } + topics = topics.map((t) => { + if (t == null) { + return null; + } + if (Array.isArray(t)) { + const items = Array.from(new Set(t.map((t2) => t2.toLowerCase())).values()); + if (items.length === 1) { + return items[0]; + } + items.sort(); + return items; + } + return t.toLowerCase(); + }); + const tag = topics.map((t) => { + if (t == null) { + return "null"; + } + if (Array.isArray(t)) { + return t.join("|"); + } + return t; + }).join("&"); + return { fragment, tag, topics }; +} +async function multiQueryFilter(address, contract, event, fromBlock, toBlock) { + if (fromBlock == null) { + fromBlock = 0; + } + if (toBlock == null) { + toBlock = "latest"; + } + const { fragment, topics } = await getSubInfo(contract.interface, event); + const filter = { + address: address === "*" ? void 0 : address, + topics, + fromBlock, + toBlock + }; + const provider = contract.runner; + assert(provider, "contract runner does not have a provider", "UNSUPPORTED_OPERATION", { operation: "queryFilter" }); + return (await provider.getLogs(filter)).map((log) => { + let foundFragment = fragment; + if (foundFragment == null) { + try { + foundFragment = contract.interface.getEvent(log.topics[0]); + } catch { + } + } + if (foundFragment) { + try { + return new EventLog(log, contract.interface, foundFragment); + } catch (error) { + return new UndecodedEventLog(log, error); + } + } + return new Log(log, provider); + }); +} +class BatchBlockService { + provider; + onProgress; + concurrencySize; + batchSize; + shouldRetry; + retryMax; + retryOn; + constructor({ + provider, + onProgress, + concurrencySize = 10, + batchSize = 10, + shouldRetry = true, + retryMax = 5, + retryOn = 500 + }) { + this.provider = provider; + this.onProgress = onProgress; + this.concurrencySize = concurrencySize; + this.batchSize = batchSize; + this.shouldRetry = shouldRetry; + this.retryMax = retryMax; + this.retryOn = retryOn; + } + async getBlock(blockTag) { + const blockObject = await this.provider.getBlock(blockTag); + if (!blockObject) { + const errMsg = `No block for ${blockTag}`; + throw new Error(errMsg); + } + return blockObject; + } + createBatchRequest(batchArray) { + return batchArray.map(async (blocks, index) => { + await sleep(40 * index); + return (async () => { + let retries = 0; + let err; + while (!this.shouldRetry && retries === 0 || this.shouldRetry && retries < this.retryMax) { + try { + return await Promise.all(blocks.map((b) => this.getBlock(b))); + } catch (e) { + retries++; + err = e; + await sleep(this.retryOn); + } + } + throw err; + })(); + }); + } + async getBatchBlocks(blocks) { + let blockCount = 0; + const results = []; + for (const chunks of chunk(blocks, this.concurrencySize * this.batchSize)) { + const chunksResult = (await Promise.all(this.createBatchRequest(chunk(chunks, this.batchSize)))).flat(); + results.push(...chunksResult); + blockCount += chunks.length; + if (typeof this.onProgress === "function") { + this.onProgress({ + percentage: blockCount / blocks.length, + currentIndex: blockCount, + totalIndex: blocks.length + }); + } + } + return results; + } +} +class BatchTransactionService { + provider; + onProgress; + concurrencySize; + batchSize; + shouldRetry; + retryMax; + retryOn; + constructor({ + provider, + onProgress, + concurrencySize = 10, + batchSize = 10, + shouldRetry = true, + retryMax = 5, + retryOn = 500 + }) { + this.provider = provider; + this.onProgress = onProgress; + this.concurrencySize = concurrencySize; + this.batchSize = batchSize; + this.shouldRetry = shouldRetry; + this.retryMax = retryMax; + this.retryOn = retryOn; + } + async getTransaction(txHash) { + const txObject = await this.provider.getTransaction(txHash); + if (!txObject) { + const errMsg = `No transaction for ${txHash}`; + throw new Error(errMsg); + } + return txObject; + } + async getTransactionReceipt(txHash) { + const txObject = await this.provider.getTransactionReceipt(txHash); + if (!txObject) { + const errMsg = `No transaction receipt for ${txHash}`; + throw new Error(errMsg); + } + return txObject; + } + createBatchRequest(batchArray, receipt) { + return batchArray.map(async (txs, index) => { + await sleep(40 * index); + return (async () => { + let retries = 0; + let err; + while (!this.shouldRetry && retries === 0 || this.shouldRetry && retries < this.retryMax) { + try { + if (!receipt) { + return await Promise.all(txs.map((tx) => this.getTransaction(tx))); + } else { + return await Promise.all(txs.map((tx) => this.getTransactionReceipt(tx))); + } + } catch (e) { + retries++; + err = e; + await sleep(this.retryOn); + } + } + throw err; + })(); + }); + } + async getBatchTransactions(txs) { + let txCount = 0; + const results = []; + for (const chunks of chunk(txs, this.concurrencySize * this.batchSize)) { + const chunksResult = (await Promise.all(this.createBatchRequest(chunk(chunks, this.batchSize)))).flat(); + results.push(...chunksResult); + txCount += chunks.length; + if (typeof this.onProgress === "function") { + this.onProgress({ + percentage: txCount / txs.length, + currentIndex: txCount, + totalIndex: txs.length + }); + } + } + return results; + } + async getBatchReceipt(txs) { + let txCount = 0; + const results = []; + for (const chunks of chunk(txs, this.concurrencySize * this.batchSize)) { + const chunksResult = (await Promise.all(this.createBatchRequest(chunk(chunks, this.batchSize), true))).flat(); + results.push(...chunksResult); + txCount += chunks.length; + if (typeof this.onProgress === "function") { + this.onProgress({ + percentage: txCount / txs.length, + currentIndex: txCount, + totalIndex: txs.length + }); + } + } + return results; + } +} +class BatchEventsService { + provider; + contract; + address; + onProgress; + concurrencySize; + blocksPerRequest; + shouldRetry; + retryMax; + retryOn; + constructor({ + provider, + contract, + address, + onProgress, + concurrencySize = 10, + blocksPerRequest = 5e3, + shouldRetry = true, + retryMax = 5, + retryOn = 500 + }) { + this.provider = provider; + this.contract = contract; + this.address = address; + this.onProgress = onProgress; + this.concurrencySize = concurrencySize; + this.blocksPerRequest = blocksPerRequest; + this.shouldRetry = shouldRetry; + this.retryMax = retryMax; + this.retryOn = retryOn; + } + async getPastEvents({ fromBlock, toBlock, type }) { + let err; + let retries = 0; + while (!this.shouldRetry && retries === 0 || this.shouldRetry && retries < this.retryMax) { + try { + if (this.address) { + return await multiQueryFilter( + this.address, + this.contract, + type, + fromBlock, + toBlock + ); + } + return await this.contract.queryFilter(type, fromBlock, toBlock); + } catch (e) { + err = e; + retries++; + if (e.message.includes("after last accepted block")) { + const acceptedBlock = parseInt(e.message.split("after last accepted block ")[1]); + toBlock = acceptedBlock; + } + await sleep(this.retryOn); + } + } + throw err; + } + createBatchRequest(batchArray) { + return batchArray.map(async (event, index) => { + await sleep(10 * index); + return this.getPastEvents(event); + }); + } + async getBatchEvents({ fromBlock, toBlock, type = "*" }) { + if (!toBlock) { + toBlock = await this.provider.getBlockNumber(); + } + const eventsToSync = []; + for (let i = fromBlock; i < toBlock; i += this.blocksPerRequest) { + const j = i + this.blocksPerRequest - 1 > toBlock ? toBlock : i + this.blocksPerRequest - 1; + eventsToSync.push({ fromBlock: i, toBlock: j, type }); + } + const events = []; + const eventChunk = chunk(eventsToSync, this.concurrencySize); + let chunkCount = 0; + for (const chunk2 of eventChunk) { + chunkCount++; + const fetchedEvents = (await Promise.all(this.createBatchRequest(chunk2))).flat(); + events.push(...fetchedEvents); + if (typeof this.onProgress === "function") { + this.onProgress({ + percentage: chunkCount / eventChunk.length, + type, + fromBlock: chunk2[0].fromBlock, + toBlock: chunk2[chunk2.length - 1].toBlock, + count: fetchedEvents.length + }); + } + } + return events; + } +} + +const defaultUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0"; +function getHttpAgent({ + fetchUrl, + proxyUrl, + torPort, + retry +}) { + const { HttpProxyAgent } = require("http-proxy-agent"); + const { HttpsProxyAgent } = require("https-proxy-agent"); + const { SocksProxyAgent } = require("socks-proxy-agent"); + if (torPort) { + return new SocksProxyAgent(`socks5h://tor${retry}@127.0.0.1:${torPort}`); + } + if (!proxyUrl) { + return; + } + const isHttps = fetchUrl.includes("https://"); + if (proxyUrl.includes("socks://") || proxyUrl.includes("socks4://") || proxyUrl.includes("socks5://")) { + return new SocksProxyAgent(proxyUrl); + } + if (proxyUrl.includes("http://") || proxyUrl.includes("https://")) { + if (isHttps) { + return new HttpsProxyAgent(proxyUrl); + } + return new HttpProxyAgent(proxyUrl); + } +} +async function fetchData(url, options = {}) { + const MAX_RETRY = options.maxRetry ?? 3; + const RETRY_ON = options.retryOn ?? 500; + const userAgent = options.userAgent ?? defaultUserAgent; + const fetch = globalThis.useGlobalFetch ? globalThis.fetch : crossFetch; + let retry = 0; + let errorObject; + if (!options.method) { + if (!options.body) { + options.method = "GET"; + } else { + options.method = "POST"; + } + } + if (!options.headers) { + options.headers = {}; + } + if (isNode && !options.headers["User-Agent"]) { + options.headers["User-Agent"] = userAgent; + } + while (retry < MAX_RETRY + 1) { + let timeout; + if (!options.signal && options.timeout) { + const controller = new AbortController(); + options.signal = controller.signal; + timeout = setTimeout(() => { + controller.abort(); + }, options.timeout); + if (options.cancelSignal) { + if (options.cancelSignal.cancelled) { + throw new Error("request cancelled before sending"); + } + options.cancelSignal.addListener(() => { + controller.abort(); + }); + } + } + if (!options.agent && isNode && (options.proxy || options.torPort)) { + options.agent = getHttpAgent({ + fetchUrl: url, + proxyUrl: options.proxy, + torPort: options.torPort, + retry + }); + } + if (options.debug && typeof options.debug === "function") { + options.debug("request", { + url, + retry, + errorObject, + options + }); + } + try { + const resp = await fetch(url, { + method: options.method, + headers: options.headers, + body: options.body, + redirect: options.redirect, + signal: options.signal, + agent: options.agent + }); + if (options.debug && typeof options.debug === "function") { + options.debug("response", resp); + } + if (!resp.ok) { + const errMsg = `Request to ${url} failed with error code ${resp.status}: +` + await resp.text(); + throw new Error(errMsg); + } + if (options.returnResponse) { + return resp; + } + const contentType = resp.headers.get("content-type"); + if (contentType?.includes("application/json")) { + return await resp.json(); + } + if (contentType?.includes("text")) { + return await resp.text(); + } + return resp; + } catch (error) { + if (timeout) { + clearTimeout(timeout); + } + errorObject = error; + retry++; + await sleep(RETRY_ON); + } finally { + if (timeout) { + clearTimeout(timeout); + } + } + } + if (options.debug && typeof options.debug === "function") { + options.debug("error", errorObject); + } + throw errorObject; +} +const fetchGetUrlFunc = (options = {}) => async (req, _signal) => { + const init = { + ...options, + method: req.method || "POST", + headers: req.headers, + body: req.body || void 0, + timeout: options.timeout || req.timeout, + cancelSignal: _signal, + returnResponse: true + }; + const resp = await fetchData(req.url, init); + const headers = {}; + resp.headers.forEach((value, key) => { + headers[key.toLowerCase()] = value; + }); + const respBody = await resp.arrayBuffer(); + const body = respBody == null ? null : new Uint8Array(respBody); + return { + statusCode: resp.status, + statusMessage: resp.statusText, + headers, + body + }; +}; +async function getProvider(rpcUrl, fetchOptions) { + const fetchReq = new FetchRequest(rpcUrl); + fetchReq.getUrlFunc = fetchGetUrlFunc(fetchOptions); + const staticNetwork = await new JsonRpcProvider(fetchReq).getNetwork(); + const chainId = Number(staticNetwork.chainId); + if (fetchOptions?.netId && fetchOptions.netId !== chainId) { + const errMsg = `Wrong network for ${rpcUrl}, wants ${fetchOptions.netId} got ${chainId}`; + throw new Error(errMsg); + } + return new JsonRpcProvider(fetchReq, staticNetwork, { + staticNetwork, + pollingInterval: fetchOptions?.pollingInterval || 1e3 + }); +} +function getProviderWithNetId(netId, rpcUrl, config, fetchOptions) { + const { networkName, reverseRecordsContract, pollInterval } = config; + const hasEns = Boolean(reverseRecordsContract); + const fetchReq = new FetchRequest(rpcUrl); + fetchReq.getUrlFunc = fetchGetUrlFunc(fetchOptions); + const staticNetwork = new Network(networkName, netId); + if (hasEns) { + staticNetwork.attachPlugin(new EnsPlugin(null, Number(netId))); + } + staticNetwork.attachPlugin(new GasCostPlugin()); + const provider = new JsonRpcProvider(fetchReq, staticNetwork, { + staticNetwork, + pollingInterval: fetchOptions?.pollingInterval || pollInterval * 1e3 + }); + return provider; +} +const populateTransaction = async (signer, tx) => { + const provider = signer.provider; + if (!tx.from) { + tx.from = signer.address; + } else if (tx.from !== signer.address) { + const errMsg = `populateTransaction: signer mismatch for tx, wants ${tx.from} have ${signer.address}`; + throw new Error(errMsg); + } + const [feeData, nonce] = await Promise.all([ + tx.maxFeePerGas || tx.gasPrice ? void 0 : provider.getFeeData(), + tx.nonce ? void 0 : provider.getTransactionCount(signer.address, "pending") + ]); + if (feeData) { + if (feeData.maxFeePerGas) { + if (!tx.type) { + tx.type = 2; + } + tx.maxFeePerGas = feeData.maxFeePerGas * (BigInt(1e4) + BigInt(signer.gasPriceBump)) / BigInt(1e4); + tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + delete tx.gasPrice; + } else if (feeData.gasPrice) { + if (!tx.type) { + tx.type = 0; + } + tx.gasPrice = feeData.gasPrice; + delete tx.maxFeePerGas; + delete tx.maxPriorityFeePerGas; + } + } + if (nonce) { + tx.nonce = nonce; + } + if (!tx.gasLimit) { + try { + const gasLimit = await provider.estimateGas(tx); + tx.gasLimit = gasLimit === BigInt(21e3) ? gasLimit : gasLimit * (BigInt(1e4) + BigInt(signer.gasLimitBump)) / BigInt(1e4); + } catch (error) { + if (signer.gasFailover) { + console.log("populateTransaction: warning gas estimation failed falling back to 3M gas"); + tx.gasLimit = BigInt("3000000"); + } else { + throw error; + } + } + } + return tx; +}; +class TornadoWallet extends Wallet { + nonce; + gasPriceBump; + gasLimitBump; + gasFailover; + bumpNonce; + constructor(key, provider, { gasPriceBump, gasLimitBump, gasFailover, bumpNonce } = {}) { + super(key, provider); + this.gasPriceBump = gasPriceBump ?? 0; + this.gasLimitBump = gasLimitBump ?? 3e3; + this.gasFailover = gasFailover ?? false; + this.bumpNonce = bumpNonce ?? false; + } + static fromMnemonic(mneomnic, provider, index = 0, options) { + const defaultPath = `m/44'/60'/0'/0/${index}`; + const { privateKey } = HDNodeWallet.fromPhrase(mneomnic, void 0, defaultPath); + return new TornadoWallet(privateKey, provider, options); + } + async populateTransaction(tx) { + const txObject = await populateTransaction(this, tx); + this.nonce = Number(txObject.nonce); + return super.populateTransaction(txObject); + } +} +class TornadoVoidSigner extends VoidSigner { + nonce; + gasPriceBump; + gasLimitBump; + gasFailover; + bumpNonce; + constructor(address, provider, { gasPriceBump, gasLimitBump, gasFailover, bumpNonce } = {}) { + super(address, provider); + this.gasPriceBump = gasPriceBump ?? 0; + this.gasLimitBump = gasLimitBump ?? 3e3; + this.gasFailover = gasFailover ?? false; + this.bumpNonce = bumpNonce ?? false; + } + async populateTransaction(tx) { + const txObject = await populateTransaction(this, tx); + this.nonce = Number(txObject.nonce); + return super.populateTransaction(txObject); + } +} +class TornadoRpcSigner extends JsonRpcSigner { + nonce; + gasPriceBump; + gasLimitBump; + gasFailover; + bumpNonce; + constructor(provider, address, { gasPriceBump, gasLimitBump, gasFailover, bumpNonce } = {}) { + super(provider, address); + this.gasPriceBump = gasPriceBump ?? 0; + this.gasLimitBump = gasLimitBump ?? 3e3; + this.gasFailover = gasFailover ?? false; + this.bumpNonce = bumpNonce ?? false; + } + async sendUncheckedTransaction(tx) { + return super.sendUncheckedTransaction(await populateTransaction(this, tx)); + } +} +class TornadoBrowserProvider extends BrowserProvider { + options; + constructor(ethereum, network, options) { + super(ethereum, network); + this.options = options; + } + async getSigner(address) { + const signerAddress = (await super.getSigner(address)).address; + if (this.options?.netId && this.options?.connectWallet && Number(await super.send("net_version", [])) !== this.options?.netId) { + await this.options.connectWallet(this.options?.netId); + } + if (this.options?.handleNetworkChanges) { + window?.ethereum?.on("chainChanged", this.options.handleNetworkChanges); + } + if (this.options?.handleAccountChanges) { + window?.ethereum?.on("accountsChanged", this.options.handleAccountChanges); + } + if (this.options?.handleAccountDisconnect) { + window?.ethereum?.on("disconnect", this.options.handleAccountDisconnect); + } + return new TornadoRpcSigner(this, signerAddress, this.options); + } +} + +var NetId = /* @__PURE__ */ ((NetId2) => { + NetId2[NetId2["MAINNET"] = 1] = "MAINNET"; + NetId2[NetId2["BSC"] = 56] = "BSC"; + NetId2[NetId2["POLYGON"] = 137] = "POLYGON"; + NetId2[NetId2["OPTIMISM"] = 10] = "OPTIMISM"; + NetId2[NetId2["ARBITRUM"] = 42161] = "ARBITRUM"; + NetId2[NetId2["GNOSIS"] = 100] = "GNOSIS"; + NetId2[NetId2["AVALANCHE"] = 43114] = "AVALANCHE"; + NetId2[NetId2["SEPOLIA"] = 11155111] = "SEPOLIA"; + return NetId2; +})(NetId || {}); +const defaultConfig = { + [1 /* MAINNET */]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 80, + fast: 50, + standard: 25, + low: 8 + }, + nativeCurrency: "eth", + currencyName: "ETH", + explorerUrl: "https://etherscan.io", + merkleTreeHeight: 20, + emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", + networkName: "Ethereum Mainnet", + deployedBlock: 9116966, + rpcUrls: { + mevblockerRPC: { + name: "MEV Blocker", + url: "https://rpc.mevblocker.io" + }, + keydonix: { + name: "Horswap ( Keydonix )", + url: "https://ethereum.keydonix.com/v1/mainnet" + }, + SecureRpc: { + name: "SecureRpc", + url: "https://api.securerpc.com/v1" + }, + stackup: { + name: "Stackup", + url: "https://public.stackup.sh/api/v1/node/ethereum-mainnet" + }, + oneRpc: { + name: "1RPC", + url: "https://1rpc.io/eth" + } + }, + stablecoin: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", + routerContract: "0xd90e2f925DA726b50C4Ed8D0Fb90Ad053324F31b", + echoContract: "0x9B27DD5Bb15d42DC224FCD0B7caEbBe16161Df42", + offchainOracleContract: "0x00000000000D6FFc74A8feb35aF5827bf57f6786", + tornContract: "0x77777FeDdddFfC19Ff86DB637967013e6C6A116C", + governanceContract: "0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce", + stakingRewardsContract: "0x5B3f656C80E8ddb9ec01Dd9018815576E9238c29", + registryContract: "0x58E8dCC13BE9780fC42E8723D8EaD4CF46943dF2", + aggregatorContract: "0xE8F47A78A6D52D317D0D2FFFac56739fE14D1b49", + reverseRecordsContract: "0x3671aE578E63FdF66ad4F3E12CC0c0d71Ac7510C", + tornadoSubgraph: "tornadocash/mainnet-tornado-subgraph", + registrySubgraph: "tornadocash/tornado-relayer-registry", + governanceSubgraph: "tornadocash/tornado-governance", + subgraphs: {}, + tokens: { + eth: { + instanceAddress: { + "0.1": "0x12D66f87A04A9E220743712cE6d9bB1B5616B8Fc", + "1": "0x47CE0C6eD5B0Ce3d3A51fdb1C52DC66a7c3c2936", + "10": "0x910Cbd523D972eb0a6f4cAe4618aD62622b39DbF", + "100": "0xA160cdAB225685dA1d56aa342Ad8841c3b53f291" + }, + symbol: "ETH", + decimals: 18 + }, + dai: { + instanceAddress: { + "100": "0xD4B88Df4D29F5CedD6857912842cff3b20C8Cfa3", + "1000": "0xFD8610d20aA15b7B2E3Be39B396a1bC3516c7144", + "10000": "0x07687e702b410Fa43f4cB4Af7FA097918ffD2730", + "100000": "0x23773E65ed146A459791799d01336DB287f25334" + }, + tokenAddress: "0x6B175474E89094C44Da98b954EedeAC495271d0F", + tokenGasLimit: 7e4, + symbol: "DAI", + decimals: 18, + gasLimit: 7e5 + }, + cdai: { + instanceAddress: { + "5000": "0x22aaA7720ddd5388A3c0A3333430953C68f1849b", + "50000": "0x03893a7c7463AE47D46bc7f091665f1893656003", + "500000": "0x2717c5e28cf931547B621a5dddb772Ab6A35B701", + "5000000": "0xD21be7248e0197Ee08E0c20D4a96DEBdaC3D20Af" + }, + tokenAddress: "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643", + tokenGasLimit: 2e5, + symbol: "cDAI", + decimals: 8, + gasLimit: 7e5 + }, + usdc: { + instanceAddress: { + "100": "0xd96f2B1c14Db8458374d9Aca76E26c3D18364307", + "1000": "0x4736dCf1b7A3d580672CcE6E7c65cd5cc9cFBa9D" + }, + tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + tokenGasLimit: 7e4, + symbol: "USDC", + decimals: 6, + gasLimit: 7e5 + }, + usdt: { + instanceAddress: { + "100": "0x169AD27A470D064DEDE56a2D3ff727986b15D52B", + "1000": "0x0836222F2B2B24A3F36f98668Ed8F0B38D1a872f" + }, + tokenAddress: "0xdAC17F958D2ee523a2206206994597C13D831ec7", + tokenGasLimit: 7e4, + symbol: "USDT", + decimals: 6, + gasLimit: 7e5 + }, + wbtc: { + instanceAddress: { + "0.1": "0x178169B423a011fff22B9e3F3abeA13414dDD0F1", + "1": "0x610B717796ad172B316836AC95a2ffad065CeaB4", + "10": "0xbB93e510BbCD0B7beb5A853875f9eC60275CF498" + }, + tokenAddress: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + tokenGasLimit: 7e4, + symbol: "WBTC", + decimals: 8, + gasLimit: 7e5 + } + }, + // Inactive tokens to filter from schema verification and syncing events + disabledTokens: ["cdai", "usdt", "usdc"], + relayerEnsSubdomain: "mainnet-tornado", + pollInterval: 15, + constants: { + GOVERNANCE_BLOCK: 11474695, + NOTE_ACCOUNT_BLOCK: 11842486, + ENCRYPTED_NOTES_BLOCK: 12143762, + REGISTRY_BLOCK: 14173129, + MINING_BLOCK_TIME: 15 + } + }, + [56 /* BSC */]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 5, + fast: 5, + standard: 5, + low: 5 + }, + nativeCurrency: "bnb", + currencyName: "BNB", + explorerUrl: "https://bscscan.com", + merkleTreeHeight: 20, + emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", + networkName: "Binance Smart Chain", + deployedBlock: 8158799, + stablecoin: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", + multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", + routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", + echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", + offchainOracleContract: "0x00000000000D6FFc74A8feb35aF5827bf57f6786", + tornadoSubgraph: "tornadocash/bsc-tornado-subgraph", + subgraphs: {}, + rpcUrls: { + bnbchain: { + name: "BNB Chain", + url: "https://bsc-dataseed.bnbchain.org" + }, + ninicoin: { + name: "BNB Chain 2", + url: "https://bsc-dataseed1.ninicoin.io" + }, + nodereal: { + name: "NodeReal", + url: "https://binance.nodereal.io" + }, + stackup: { + name: "Stackup", + url: "https://public.stackup.sh/api/v1/node/bsc-mainnet" + }, + oneRpc: { + name: "1RPC", + url: "https://1rpc.io/bnb" + } + }, + tokens: { + bnb: { + instanceAddress: { + "0.1": "0x84443CFd09A48AF6eF360C6976C5392aC5023a1F", + "1": "0xd47438C816c9E7f2E2888E060936a499Af9582b3", + "10": "0x330bdFADE01eE9bF63C209Ee33102DD334618e0a", + "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD" + }, + symbol: "BNB", + decimals: 18 + } + }, + relayerEnsSubdomain: "bsc-tornado", + pollInterval: 10, + constants: { + NOTE_ACCOUNT_BLOCK: 8159269, + ENCRYPTED_NOTES_BLOCK: 8159269 + } + }, + [137 /* POLYGON */]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 100, + fast: 75, + standard: 50, + low: 30 + }, + nativeCurrency: "matic", + currencyName: "MATIC", + explorerUrl: "https://polygonscan.com", + merkleTreeHeight: 20, + emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", + networkName: "Polygon (Matic) Network", + deployedBlock: 16257962, + stablecoin: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", + multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", + routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", + echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", + offchainOracleContract: "0x00000000000D6FFc74A8feb35aF5827bf57f6786", + tornadoSubgraph: "tornadocash/matic-tornado-subgraph", + subgraphs: {}, + rpcUrls: { + oneRpc: { + name: "1RPC", + url: "https://1rpc.io/matic" + }, + stackup: { + name: "Stackup", + url: "https://public.stackup.sh/api/v1/node/polygon-mainnet" + } + }, + tokens: { + matic: { + instanceAddress: { + "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD", + "1000": "0xdf231d99Ff8b6c6CBF4E9B9a945CBAcEF9339178", + "10000": "0xaf4c0B70B2Ea9FB7487C7CbB37aDa259579fe040", + "100000": "0xa5C2254e4253490C54cef0a4347fddb8f75A4998" + }, + symbol: "MATIC", + decimals: 18 + } + }, + relayerEnsSubdomain: "polygon-tornado", + pollInterval: 10, + constants: { + NOTE_ACCOUNT_BLOCK: 16257996, + ENCRYPTED_NOTES_BLOCK: 16257996 + } + }, + [10 /* OPTIMISM */]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 1e-3, + fast: 1e-3, + standard: 1e-3, + low: 1e-3 + }, + nativeCurrency: "eth", + currencyName: "ETH", + explorerUrl: "https://optimistic.etherscan.io", + merkleTreeHeight: 20, + emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", + networkName: "Optimism", + deployedBlock: 2243689, + stablecoin: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85", + multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", + routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", + echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", + offchainOracleContract: "0x00000000000D6FFc74A8feb35aF5827bf57f6786", + ovmGasPriceOracleContract: "0x420000000000000000000000000000000000000F", + tornadoSubgraph: "tornadocash/optimism-tornado-subgraph", + subgraphs: {}, + rpcUrls: { + oneRpc: { + name: "1RPC", + url: "https://1rpc.io/op" + }, + stackup: { + name: "Stackup", + url: "https://public.stackup.sh/api/v1/node/optimism-mainnet" + } + }, + tokens: { + eth: { + instanceAddress: { + "0.1": "0x84443CFd09A48AF6eF360C6976C5392aC5023a1F", + "1": "0xd47438C816c9E7f2E2888E060936a499Af9582b3", + "10": "0x330bdFADE01eE9bF63C209Ee33102DD334618e0a", + "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD" + }, + symbol: "ETH", + decimals: 18 + } + }, + relayerEnsSubdomain: "optimism-tornado", + pollInterval: 15, + constants: { + NOTE_ACCOUNT_BLOCK: 2243694, + ENCRYPTED_NOTES_BLOCK: 2243694 + } + }, + [42161 /* ARBITRUM */]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 4, + fast: 3, + standard: 2.52, + low: 2.29 + }, + nativeCurrency: "eth", + currencyName: "ETH", + explorerUrl: "https://arbiscan.io", + merkleTreeHeight: 20, + emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", + networkName: "Arbitrum One", + deployedBlock: 3430648, + stablecoin: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", + multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", + routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", + echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", + offchainOracleContract: "0x00000000000D6FFc74A8feb35aF5827bf57f6786", + tornadoSubgraph: "tornadocash/arbitrum-tornado-subgraph", + subgraphs: {}, + rpcUrls: { + Arbitrum: { + name: "Arbitrum", + url: "https://arb1.arbitrum.io/rpc" + }, + stackup: { + name: "Stackup", + url: "https://public.stackup.sh/api/v1/node/arbitrum-one" + }, + oneRpc: { + name: "1RPC", + url: "https://1rpc.io/arb" + } + }, + tokens: { + eth: { + instanceAddress: { + "0.1": "0x84443CFd09A48AF6eF360C6976C5392aC5023a1F", + "1": "0xd47438C816c9E7f2E2888E060936a499Af9582b3", + "10": "0x330bdFADE01eE9bF63C209Ee33102DD334618e0a", + "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD" + }, + symbol: "ETH", + decimals: 18 + } + }, + relayerEnsSubdomain: "arbitrum-tornado", + pollInterval: 15, + constants: { + NOTE_ACCOUNT_BLOCK: 3430605, + ENCRYPTED_NOTES_BLOCK: 3430605 + } + }, + [100 /* GNOSIS */]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 6, + fast: 5, + standard: 4, + low: 1 + }, + nativeCurrency: "xdai", + currencyName: "xDAI", + explorerUrl: "https://gnosisscan.io", + merkleTreeHeight: 20, + emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", + networkName: "Gnosis Chain", + deployedBlock: 17754561, + stablecoin: "0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83", + multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", + routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", + echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", + offchainOracleContract: "0x00000000000D6FFc74A8feb35aF5827bf57f6786", + tornadoSubgraph: "tornadocash/xdai-tornado-subgraph", + subgraphs: {}, + rpcUrls: { + gnosis: { + name: "Gnosis", + url: "https://rpc.gnosischain.com" + }, + oneRpc: { + name: "1RPC", + url: "https://1rpc.io/gnosis" + } + }, + tokens: { + xdai: { + instanceAddress: { + "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD", + "1000": "0xdf231d99Ff8b6c6CBF4E9B9a945CBAcEF9339178", + "10000": "0xaf4c0B70B2Ea9FB7487C7CbB37aDa259579fe040", + "100000": "0xa5C2254e4253490C54cef0a4347fddb8f75A4998" + }, + symbol: "xDAI", + decimals: 18 + } + }, + relayerEnsSubdomain: "gnosis-tornado", + pollInterval: 15, + constants: { + NOTE_ACCOUNT_BLOCK: 17754564, + ENCRYPTED_NOTES_BLOCK: 17754564 + } + }, + [43114 /* AVALANCHE */]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 225, + fast: 35, + standard: 25, + low: 25 + }, + nativeCurrency: "avax", + currencyName: "AVAX", + explorerUrl: "https://snowtrace.io", + merkleTreeHeight: 20, + emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", + networkName: "Avalanche Mainnet", + deployedBlock: 4429818, + stablecoin: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", + multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", + routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", + echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", + offchainOracleContract: "0x00000000000D6FFc74A8feb35aF5827bf57f6786", + tornadoSubgraph: "tornadocash/avalanche-tornado-subgraph", + subgraphs: {}, + rpcUrls: { + oneRpc: { + name: "1RPC", + url: "https://1rpc.io/avax/c" + }, + stackup: { + name: "Stackup", + url: "https://public.stackup.sh/api/v1/node/avalanche-mainnet" + } + }, + tokens: { + avax: { + instanceAddress: { + "10": "0x330bdFADE01eE9bF63C209Ee33102DD334618e0a", + "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD", + "500": "0xaf8d1839c3c67cf571aa74B5c12398d4901147B3" + }, + symbol: "AVAX", + decimals: 18 + } + }, + relayerEnsSubdomain: "avalanche-tornado", + pollInterval: 10, + constants: { + NOTE_ACCOUNT_BLOCK: 4429813, + ENCRYPTED_NOTES_BLOCK: 4429813 + } + }, + [11155111 /* SEPOLIA */]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 2, + fast: 2, + standard: 2, + low: 2 + }, + nativeCurrency: "eth", + currencyName: "SepoliaETH", + explorerUrl: "https://sepolia.etherscan.io", + merkleTreeHeight: 20, + emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", + networkName: "Ethereum Sepolia", + deployedBlock: 5594395, + stablecoin: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238", + multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", + routerContract: "0x1572AFE6949fdF51Cb3E0856216670ae9Ee160Ee", + echoContract: "0xcDD1fc3F5ac2782D83449d3AbE80D6b7B273B0e5", + offchainOracleContract: "0x1f89EAF03E5b260Bc6D4Ae3c3334b1B750F3e127", + tornContract: "0x3AE6667167C0f44394106E197904519D808323cA", + governanceContract: "0xe5324cD7602eeb387418e594B87aCADee08aeCAD", + stakingRewardsContract: "0x6d0018890751Efd31feb8166711B16732E2b496b", + registryContract: "0x1428e5d2356b13778A13108b10c440C83011dfB8", + aggregatorContract: "0x4088712AC9fad39ea133cdb9130E465d235e9642", + reverseRecordsContract: "0xEc29700C0283e5Be64AcdFe8077d6cC95dE23C23", + tornadoSubgraph: "tornadocash/sepolia-tornado-subgraph", + subgraphs: {}, + rpcUrls: { + sepolia: { + name: "Sepolia RPC", + url: "https://rpc.sepolia.org" + }, + stackup: { + name: "Stackup", + url: "https://public.stackup.sh/api/v1/node/ethereum-sepolia" + }, + oneRpc: { + name: "1RPC", + url: "https://1rpc.io/sepolia" + }, + ethpandaops: { + name: "ethpandaops", + url: "https://rpc.sepolia.ethpandaops.io" + } + }, + tokens: { + eth: { + instanceAddress: { + "0.1": "0x8C4A04d872a6C1BE37964A21ba3a138525dFF50b", + "1": "0x8cc930096B4Df705A007c4A039BDFA1320Ed2508", + "10": "0x8D10d506D29Fc62ABb8A290B99F66dB27Fc43585", + "100": "0x44c5C92ed73dB43888210264f0C8b36Fd68D8379" + }, + symbol: "ETH", + decimals: 18 + }, + dai: { + instanceAddress: { + "100": "0x6921fd1a97441dd603a997ED6DDF388658daf754", + "1000": "0x50a637770F5d161999420F7d70d888DE47207145", + "10000": "0xecD649870407cD43923A816Cc6334a5bdf113621", + "100000": "0x73B4BD04bF83206B6e979BE2507098F92EDf4F90" + }, + tokenAddress: "0xFF34B3d4Aee8ddCd6F9AFFFB6Fe49bD371b8a357", + tokenGasLimit: 7e4, + symbol: "DAI", + decimals: 18, + gasLimit: 7e5 + } + }, + relayerEnsSubdomain: "sepolia-tornado", + pollInterval: 15, + constants: { + GOVERNANCE_BLOCK: 5594395, + NOTE_ACCOUNT_BLOCK: 5594395, + ENCRYPTED_NOTES_BLOCK: 5594395, + REGISTRY_BLOCK: 5594395, + MINING_BLOCK_TIME: 15 + } + } +}; +const enabledChains = Object.values(NetId).filter((n) => typeof n === "number"); +let customConfig = {}; +function addNetwork(newConfig) { + enabledChains.push( + ...Object.keys(newConfig).map((netId) => Number(netId)).filter((netId) => !enabledChains.includes(netId)) + ); + customConfig = { + ...customConfig, + ...newConfig + }; +} +function getNetworkConfig() { + const allConfig = { + ...defaultConfig, + ...customConfig + }; + return enabledChains.reduce((acc, curr) => { + acc[curr] = allConfig[curr]; + return acc; + }, {}); +} +function getConfig(netId) { + const allConfig = getNetworkConfig(); + const chainConfig = allConfig[netId]; + if (!chainConfig) { + const errMsg = `No config found for network ${netId}!`; + throw new Error(errMsg); + } + return chainConfig; +} +function getActiveTokens(config) { + const { tokens, disabledTokens } = config; + return Object.keys(tokens).filter((t) => !disabledTokens?.includes(t)); +} +function getActiveTokenInstances(config) { + const { tokens, disabledTokens } = config; + return Object.entries(tokens).reduce((acc, [token, instances]) => { + if (!disabledTokens?.includes(token)) { + acc[token] = instances; + } + return acc; + }, {}); +} +function getInstanceByAddress(config, address) { + const { tokens, disabledTokens } = config; + for (const [currency, { instanceAddress, tokenAddress, symbol, decimals }] of Object.entries(tokens)) { + if (disabledTokens?.includes(currency)) { + continue; + } + for (const [amount, instance] of Object.entries(instanceAddress)) { + if (instance === address) { + return { + amount, + currency, + symbol, + decimals, + tokenAddress + }; + } + } + } +} +function getRelayerEnsSubdomains() { + const allConfig = getNetworkConfig(); + return enabledChains.reduce((acc, chain) => { + acc[chain] = allConfig[chain].relayerEnsSubdomain; + return acc; + }, {}); +} +function getMultiInstances(netId, config) { + return Object.entries(config.tokens).reduce( + (acc, [currency, { instanceAddress }]) => { + Object.entries(instanceAddress).forEach(([amount, contractAddress]) => { + acc[contractAddress] = { + currency, + amount, + netId + }; + }); + return acc; + }, + {} + ); +} + +const ajv = new Ajv({ allErrors: true }); +ajv.addKeyword({ + keyword: "BN", + // eslint-disable-next-line @typescript-eslint/no-explicit-any + validate: (schema, data) => { + try { + BigInt(data); + return true; + } catch { + return false; + } + }, + errors: true +}); +ajv.addKeyword({ + keyword: "isAddress", + // eslint-disable-next-line @typescript-eslint/no-explicit-any + validate: (schema, data) => { + try { + return isAddress(data); + } catch { + return false; + } + }, + errors: true +}); + +const addressSchemaType = { + type: "string", + pattern: "^0x[a-fA-F0-9]{40}$", + isAddress: true +}; +const bnSchemaType = { type: "string", BN: true }; +const proofSchemaType = { + type: "string", + pattern: "^0x[a-fA-F0-9]{512}$" +}; +const bytes32SchemaType = { + type: "string", + pattern: "^0x[a-fA-F0-9]{64}$" +}; +const bytes32BNSchemaType = { ...bytes32SchemaType, BN: true }; + +const baseEventsSchemaProperty = { + blockNumber: { + type: "number" + }, + logIndex: { + type: "number" + }, + transactionHash: bytes32SchemaType +}; +const baseEventsSchemaRequired = Object.keys(baseEventsSchemaProperty); +const governanceEventsSchema = { + type: "array", + items: { + anyOf: [ + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + id: { type: "number" }, + proposer: addressSchemaType, + target: addressSchemaType, + startTime: { type: "number" }, + endTime: { type: "number" }, + description: { type: "string" } + }, + required: [ + ...baseEventsSchemaRequired, + "event", + "id", + "proposer", + "target", + "startTime", + "endTime", + "description" + ], + additionalProperties: false + }, + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + proposalId: { type: "number" }, + voter: addressSchemaType, + support: { type: "boolean" }, + votes: { type: "string" }, + from: addressSchemaType, + input: { type: "string" } + }, + required: [ + ...baseEventsSchemaRequired, + "event", + "proposalId", + "voter", + "support", + "votes", + "from", + "input" + ], + additionalProperties: false + }, + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + account: addressSchemaType, + delegateTo: addressSchemaType + }, + required: [...baseEventsSchemaRequired, "account", "delegateTo"], + additionalProperties: false + }, + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + account: addressSchemaType, + delegateFrom: addressSchemaType + }, + required: [...baseEventsSchemaRequired, "account", "delegateFrom"], + additionalProperties: false + } + ] + } +}; +const relayerRegistryEventsSchema = { + type: "array", + items: { + anyOf: [ + // RelayerRegisteredEvents + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + ensName: { type: "string" }, + relayerAddress: addressSchemaType, + ensHash: { type: "string" }, + stakedAmount: { type: "string" } + }, + required: [ + ...baseEventsSchemaRequired, + "event", + "ensName", + "relayerAddress", + "ensHash", + "stakedAmount" + ], + additionalProperties: false + }, + // RelayerUnregisteredEvents + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + relayerAddress: addressSchemaType + }, + required: [...baseEventsSchemaRequired, "event", "relayerAddress"], + additionalProperties: false + }, + // WorkerRegisteredEvents & WorkerUnregisteredEvents + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + relayerAddress: addressSchemaType, + workerAddress: addressSchemaType + }, + required: [...baseEventsSchemaRequired, "event", "relayerAddress", "workerAddress"], + additionalProperties: false + } + ] + } +}; +const stakeBurnedEventsSchema = { + type: "array", + items: { + type: "object", + properties: { + ...baseEventsSchemaProperty, + relayerAddress: addressSchemaType, + amountBurned: bnSchemaType, + instanceAddress: addressSchemaType, + gasFee: bnSchemaType, + relayerFee: bnSchemaType, + timestamp: { type: "number" } + }, + required: [ + ...baseEventsSchemaRequired, + "relayerAddress", + "amountBurned", + "instanceAddress", + "gasFee", + "relayerFee", + "timestamp" + ], + additionalProperties: false + } +}; +const depositsEventsSchema = { + type: "array", + items: { + type: "object", + properties: { + ...baseEventsSchemaProperty, + commitment: bytes32SchemaType, + leafIndex: { type: "number" }, + timestamp: { type: "number" }, + from: addressSchemaType + }, + required: [...baseEventsSchemaRequired, "commitment", "leafIndex", "timestamp", "from"], + additionalProperties: false + } +}; +const withdrawalsEventsSchema = { + type: "array", + items: { + type: "object", + properties: { + ...baseEventsSchemaProperty, + nullifierHash: bytes32SchemaType, + to: addressSchemaType, + fee: bnSchemaType, + timestamp: { type: "number" } + }, + required: [...baseEventsSchemaRequired, "nullifierHash", "to", "fee", "timestamp"], + additionalProperties: false + } +}; +const tornadoEventsSchema = { + type: "array", + items: { + anyOf: [ + // depositsEvents + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + instanceAddress: { type: "string" }, + commitment: bytes32SchemaType, + leafIndex: { type: "number" }, + timestamp: { type: "number" }, + from: addressSchemaType + }, + required: [ + ...baseEventsSchemaRequired, + "event", + "instanceAddress", + "commitment", + "leafIndex", + "timestamp", + "from" + ], + additionalProperties: false + }, + // withdrawalEvents + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + instanceAddress: { type: "string" }, + nullifierHash: bytes32SchemaType, + to: addressSchemaType, + relayerAddress: addressSchemaType, + fee: bnSchemaType, + timestamp: { type: "number" } + }, + required: [ + ...baseEventsSchemaRequired, + "event", + "instanceAddress", + "nullifierHash", + "to", + "relayerAddress", + "fee", + "timestamp" + ], + additionalProperties: false + } + ] + } +}; +const echoEventsSchema = { + type: "array", + items: { + type: "object", + properties: { + ...baseEventsSchemaProperty, + address: addressSchemaType, + encryptedAccount: { type: "string" } + }, + required: [...baseEventsSchemaRequired, "address", "encryptedAccount"], + additionalProperties: false + } +}; +const encryptedNotesSchema = { + type: "array", + items: { + type: "object", + properties: { + ...baseEventsSchemaProperty, + encryptedNote: { type: "string" } + }, + required: [...baseEventsSchemaRequired, "encryptedNote"], + additionalProperties: false + } +}; +function getEventsSchemaValidator(type) { + if (type === "tornado") { + return ajv.compile(tornadoEventsSchema); + } + if (type === "deposit") { + return ajv.compile(depositsEventsSchema); + } + if (type === "withdrawal") { + return ajv.compile(withdrawalsEventsSchema); + } + if (type === "governance") { + return ajv.compile(governanceEventsSchema); + } + if (type === "registry") { + return ajv.compile(relayerRegistryEventsSchema); + } + if (type === "revenue") { + return ajv.compile(stakeBurnedEventsSchema); + } + if (type === "echo") { + return ajv.compile(echoEventsSchema); + } + if (type === "encrypted_notes") { + return ajv.compile(encryptedNotesSchema); + } + throw new Error("Unsupported event type for schema validation"); +} + +const statusSchema = { + type: "object", + properties: { + rewardAccount: addressSchemaType, + gasPrices: { + type: "object", + properties: { + fast: { type: "number" }, + additionalProperties: { type: "number" } + }, + required: ["fast"] + }, + netId: { type: "integer" }, + tornadoServiceFee: { type: "number", maximum: 20, minimum: 0 }, + latestBlock: { type: "number" }, + latestBalance: bnSchemaType, + version: { type: "string" }, + health: { + type: "object", + properties: { + status: { const: "true" }, + error: { type: "string" } + }, + required: ["status"] + }, + syncStatus: { + type: "object", + properties: { + events: { type: "boolean" }, + tokenPrice: { type: "boolean" }, + gasPrice: { type: "boolean" } + }, + required: ["events", "tokenPrice", "gasPrice"] + }, + onSyncEvents: { type: "boolean" }, + currentQueue: { type: "number" } + }, + required: ["rewardAccount", "instances", "netId", "tornadoServiceFee", "version", "health", "currentQueue"] +}; +function getStatusSchema(netId, config, tovarish) { + const { tokens, optionalTokens, disabledTokens, nativeCurrency } = config; + const schema = JSON.parse(JSON.stringify(statusSchema)); + const instances = Object.keys(tokens).reduce( + (acc, token) => { + const { instanceAddress, tokenAddress, symbol, decimals, optionalInstances = [] } = tokens[token]; + const amounts = Object.keys(instanceAddress); + const instanceProperties = { + type: "object", + properties: { + instanceAddress: { + type: "object", + properties: amounts.reduce( + (acc2, cur) => { + acc2[cur] = addressSchemaType; + return acc2; + }, + {} + ), + required: amounts.filter((amount) => !optionalInstances.includes(amount)) + }, + decimals: { enum: [decimals] } + }, + required: ["instanceAddress", "decimals"].concat( + tokenAddress ? ["tokenAddress"] : [], + symbol ? ["symbol"] : [] + ) + }; + if (tokenAddress) { + instanceProperties.properties.tokenAddress = addressSchemaType; + } + if (symbol) { + instanceProperties.properties.symbol = { enum: [symbol] }; + } + acc.properties[token] = instanceProperties; + if (!optionalTokens?.includes(token) && !disabledTokens?.includes(token)) { + acc.required.push(token); + } + return acc; + }, + { + type: "object", + properties: {}, + required: [] + } + ); + schema.properties.instances = instances; + const _tokens = Object.keys(tokens).filter( + (t) => t !== nativeCurrency && !config.optionalTokens?.includes(t) && !config.disabledTokens?.includes(t) + ); + if (netId === NetId.MAINNET) { + _tokens.push("torn"); + } + if (_tokens.length) { + const ethPrices = { + type: "object", + properties: _tokens.reduce((acc, token) => { + acc[token] = bnSchemaType; + return acc; + }, {}), + required: _tokens + }; + schema.properties.ethPrices = ethPrices; + schema.required.push("ethPrices"); + } + if (tovarish) { + schema.required.push("gasPrices", "latestBlock", "latestBalance", "syncStatus", "onSyncEvents"); + } + return schema; +} + +const jobsSchema = { + type: "object", + properties: { + error: { type: "string" }, + id: { type: "string" }, + type: { type: "string" }, + status: { type: "string" }, + contract: { type: "string" }, + proof: { type: "string" }, + args: { + type: "array", + items: { type: "string" } + }, + txHash: { type: "string" }, + confirmations: { type: "number" }, + failedReason: { type: "string" } + }, + required: ["id", "status"] +}; +const jobRequestSchema = { + ...jobsSchema, + required: ["id"] +}; + +const MIN_FEE = 0.1; +const MAX_FEE = 0.9; +const MIN_STAKE_BALANCE = parseEther("500"); +function calculateScore({ stakeBalance, tornadoServiceFee }) { + if (tornadoServiceFee < MIN_FEE) { + tornadoServiceFee = MIN_FEE; + } else if (tornadoServiceFee >= MAX_FEE) { + return BigInt(0); + } + const serviceFeeCoefficient = (tornadoServiceFee - MIN_FEE) ** 2; + const feeDiffCoefficient = 1 / (MAX_FEE - MIN_FEE) ** 2; + const coefficientsMultiplier = 1 - feeDiffCoefficient * serviceFeeCoefficient; + return BigInt(Math.floor(Number(stakeBalance || "0") * coefficientsMultiplier)); +} +function getWeightRandom(weightsScores, random) { + for (let i = 0; i < weightsScores.length; i++) { + if (random < weightsScores[i]) { + return i; + } + random = random - weightsScores[i]; + } + return Math.floor(Math.random() * weightsScores.length); +} +function getSupportedInstances(instanceList) { + const rawList = Object.values(instanceList).map(({ instanceAddress }) => { + return Object.values(instanceAddress); + }).flat(); + return rawList.map((l) => getAddress(l)); +} +function pickWeightedRandomRelayer(relayers) { + const weightsScores = relayers.map((el) => calculateScore(el)); + const totalWeight = weightsScores.reduce((acc, curr) => { + return acc = acc + curr; + }, BigInt("0")); + const random = BigInt(Math.floor(Number(totalWeight) * Math.random())); + const weightRandomIndex = getWeightRandom(weightsScores, random); + return relayers[weightRandomIndex]; +} +class RelayerClient { + netId; + config; + selectedRelayer; + fetchDataOptions; + tovarish; + constructor({ netId, config, fetchDataOptions: fetchDataOptions2 }) { + this.netId = netId; + this.config = config; + this.fetchDataOptions = fetchDataOptions2; + this.tovarish = false; + } + async askRelayerStatus({ + hostname, + url, + relayerAddress + }) { + if (!url && hostname) { + url = `https://${!hostname.endsWith("/") ? hostname + "/" : hostname}`; + } else if (url && !url.endsWith("/")) { + url += "/"; + } else { + url = ""; + } + const rawStatus = await fetchData(`${url}status`, { + ...this.fetchDataOptions, + headers: { + "Content-Type": "application/json, application/x-www-form-urlencoded" + }, + timeout: 3e4, + maxRetry: this.fetchDataOptions?.torPort ? 2 : 0 + }); + const statusValidator = ajv.compile(getStatusSchema(this.netId, this.config, this.tovarish)); + if (!statusValidator(rawStatus)) { + throw new Error("Invalid status schema"); + } + const status = { + ...rawStatus, + url + }; + if (status.currentQueue > 5) { + throw new Error("Withdrawal queue is overloaded"); + } + if (status.netId !== this.netId) { + throw new Error("This relayer serves a different network"); + } + if (relayerAddress && this.netId === NetId.MAINNET && status.rewardAccount !== relayerAddress) { + throw new Error("The Relayer reward address must match registered address"); + } + return status; + } + async filterRelayer(relayer) { + const hostname = relayer.hostnames[this.netId]; + const { ensName, relayerAddress } = relayer; + if (!hostname) { + return; + } + try { + const status = await this.askRelayerStatus({ + hostname, + relayerAddress + }); + return { + netId: status.netId, + url: status.url, + hostname, + ensName, + relayerAddress, + rewardAccount: getAddress(status.rewardAccount), + instances: getSupportedInstances(status.instances), + stakeBalance: relayer.stakeBalance, + gasPrice: status.gasPrices?.fast, + ethPrices: status.ethPrices, + currentQueue: status.currentQueue, + tornadoServiceFee: status.tornadoServiceFee + }; + } catch (err) { + return { + hostname, + relayerAddress, + errorMessage: err.message, + hasError: true + }; + } + } + async getValidRelayers(relayers) { + const invalidRelayers = []; + const validRelayers = (await Promise.all(relayers.map((relayer) => this.filterRelayer(relayer)))).filter( + (r) => { + if (!r) { + return false; + } + if (r.hasError) { + invalidRelayers.push(r); + return false; + } + return true; + } + ); + return { + validRelayers, + invalidRelayers + }; + } + pickWeightedRandomRelayer(relayers) { + return pickWeightedRandomRelayer(relayers); + } + async tornadoWithdraw({ contract, proof, args }, callback) { + const { url } = this.selectedRelayer; + const withdrawResponse = await fetchData(`${url}v1/tornadoWithdraw`, { + ...this.fetchDataOptions, + method: "POST", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify({ + contract, + proof, + args + }) + }); + const { id, error } = withdrawResponse; + if (error) { + throw new Error(error); + } + const jobValidator = ajv.compile(jobRequestSchema); + if (!jobValidator(withdrawResponse)) { + const errMsg = `${url}v1/tornadoWithdraw has an invalid job response`; + throw new Error(errMsg); + } + if (typeof callback === "function") { + callback(withdrawResponse); + } + let relayerStatus; + const jobUrl = `${url}v1/jobs/${id}`; + console.log(`Job submitted: ${jobUrl} +`); + while (!relayerStatus || !["FAILED", "CONFIRMED"].includes(relayerStatus)) { + const jobResponse = await fetchData(jobUrl, { + ...this.fetchDataOptions, + method: "GET", + headers: { + "Content-Type": "application/json" + } + }); + if (jobResponse.error) { + throw new Error(error); + } + const jobValidator2 = ajv.compile(jobsSchema); + if (!jobValidator2(jobResponse)) { + const errMsg = `${jobUrl} has an invalid job response`; + throw new Error(errMsg); + } + const { status, txHash, confirmations, failedReason } = jobResponse; + if (relayerStatus !== status) { + if (status === "FAILED") { + const errMsg = `Job ${status}: ${jobUrl} failed reason: ${failedReason}`; + throw new Error(errMsg); + } else if (status === "SENT") { + console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash} +`); + } else if (status === "MINED") { + console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash}, confirmations: ${confirmations} +`); + } else if (status === "CONFIRMED") { + console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash}, confirmations: ${confirmations} +`); + } else { + console.log(`Job ${status}: ${jobUrl} +`); + } + relayerStatus = status; + if (typeof callback === "function") { + callback(jobResponse); + } + } + await sleep(3e3); + } + } +} + +class BaseEventsService { + netId; + provider; + contract; + type; + deployedBlock; + batchEventsService; + fetchDataOptions; + tovarishClient; + constructor({ + netId, + provider, + contract, + type = "", + deployedBlock = 0, + fetchDataOptions: fetchDataOptions2, + tovarishClient + }) { + this.netId = netId; + this.provider = provider; + this.fetchDataOptions = fetchDataOptions2; + this.contract = contract; + this.type = type; + this.deployedBlock = deployedBlock; + this.batchEventsService = new BatchEventsService({ + provider, + contract, + onProgress: this.updateEventProgress + }); + this.tovarishClient = tovarishClient; + } + getInstanceName() { + return ""; + } + getType() { + return this.type || ""; + } + getTovarishType() { + return String(this.getType() || "").toLowerCase(); + } + /* eslint-disable @typescript-eslint/no-unused-vars */ + updateEventProgress({ percentage, type, fromBlock, toBlock, count }) { + } + updateBlockProgress({ percentage, currentIndex, totalIndex }) { + } + updateTransactionProgress({ percentage, currentIndex, totalIndex }) { + } + /* eslint-enable @typescript-eslint/no-unused-vars */ + async formatEvents(events) { + return await new Promise((resolve) => resolve(events)); + } + /** + * Get saved or cached events + */ + async getEventsFromDB() { + return { + events: [], + lastBlock: 0 + }; + } + /** + * Events from remote cache (Either from local cache, CDN, or from IPFS) + */ + async getEventsFromCache() { + return { + events: [], + lastBlock: 0, + fromCache: true + }; + } + async getSavedEvents() { + let dbEvents = await this.getEventsFromDB(); + if (!dbEvents.lastBlock) { + dbEvents = await this.getEventsFromCache(); + } + return dbEvents; + } + async getEventsFromRpc({ + fromBlock, + toBlock + }) { + try { + if (!toBlock) { + toBlock = await this.provider.getBlockNumber(); + } + if (fromBlock >= toBlock) { + return { + events: [], + lastBlock: toBlock + }; + } + this.updateEventProgress({ percentage: 0, type: this.getType() }); + const events = await this.formatEvents( + await this.batchEventsService.getBatchEvents({ + fromBlock, + toBlock, + type: this.getType() + }) + ); + return { + events, + lastBlock: toBlock + }; + } catch (err) { + console.log(err); + return { + events: [], + lastBlock: fromBlock + }; + } + } + async getLatestEvents({ fromBlock }) { + if (this.tovarishClient?.selectedRelayer) { + const { events, lastSyncBlock: lastBlock } = await this.tovarishClient.getEvents({ + type: this.getTovarishType(), + fromBlock + }); + return { + events, + lastBlock + }; + } + return await this.getEventsFromRpc({ + fromBlock + }); + } + /* eslint-disable @typescript-eslint/no-unused-vars */ + async validateEvents({ + events, + newEvents, + lastBlock + }) { + return void 0; + } + /* eslint-enable @typescript-eslint/no-unused-vars */ + /** + * Handle saving events + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + async saveEvents({ events, newEvents, lastBlock }) { + } + /** + * Trigger saving and receiving latest events + */ + async updateEvents() { + const savedEvents = await this.getSavedEvents(); + let fromBlock = this.deployedBlock; + if (savedEvents && savedEvents.lastBlock) { + fromBlock = savedEvents.lastBlock + 1; + } + const newEvents = await this.getLatestEvents({ fromBlock }); + const eventSet = /* @__PURE__ */ new Set(); + const allEvents = [...savedEvents.events, ...newEvents.events].sort((a, b) => { + if (a.blockNumber === b.blockNumber) { + return a.logIndex - b.logIndex; + } + return a.blockNumber - b.blockNumber; + }).filter(({ transactionHash, logIndex }) => { + const eventKey = `${transactionHash}_${logIndex}`; + const hasEvent = eventSet.has(eventKey); + eventSet.add(eventKey); + return !hasEvent; + }); + const lastBlock = newEvents.lastBlock || allEvents[allEvents.length - 1]?.blockNumber; + const validateResult = await this.validateEvents({ + events: allEvents, + newEvents: newEvents.events, + lastBlock + }); + if (savedEvents.fromCache || newEvents.events.length) { + await this.saveEvents({ events: allEvents, newEvents: newEvents.events, lastBlock }); + } + return { + events: allEvents, + lastBlock, + validateResult + }; + } +} +class BaseTornadoService extends BaseEventsService { + amount; + currency; + optionalTree; + merkleTreeService; + batchTransactionService; + batchBlockService; + constructor(serviceConstructor) { + const { Tornado: contract, amount, currency, provider, optionalTree, merkleTreeService } = serviceConstructor; + super({ + ...serviceConstructor, + contract + }); + this.amount = amount; + this.currency = currency; + this.optionalTree = optionalTree; + this.merkleTreeService = merkleTreeService; + this.batchTransactionService = new BatchTransactionService({ + provider, + onProgress: this.updateTransactionProgress + }); + this.batchBlockService = new BatchBlockService({ + provider, + onProgress: this.updateBlockProgress + }); + } + getInstanceName() { + return `${this.getType().toLowerCase()}s_${this.netId}_${this.currency}_${this.amount}`; + } + async formatEvents(events) { + const type = this.getType(); + if (type === "Deposit") { + const txs = await this.batchTransactionService.getBatchTransactions([ + ...new Set(events.map(({ transactionHash }) => transactionHash)) + ]); + return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { + const { commitment, leafIndex, timestamp } = args; + return { + blockNumber, + logIndex, + transactionHash, + commitment, + leafIndex: Number(leafIndex), + timestamp: Number(timestamp), + from: txs.find(({ hash }) => hash === transactionHash)?.from || "" + }; + }); + } else { + const blocks = await this.batchBlockService.getBatchBlocks([ + ...new Set(events.map(({ blockNumber }) => blockNumber)) + ]); + return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { + const { nullifierHash, to, fee } = args; + return { + blockNumber, + logIndex, + transactionHash, + nullifierHash: String(nullifierHash), + to: getAddress(to), + fee: String(fee), + timestamp: blocks.find(({ number }) => number === blockNumber)?.timestamp || 0 + }; + }); + } + } + async validateEvents({ + events, + newEvents + }) { + if (events.length && this.getType() === "Deposit") { + const depositEvents = events; + const lastEvent = depositEvents[depositEvents.length - 1]; + if (lastEvent.leafIndex !== depositEvents.length - 1) { + const errMsg = `Deposit events invalid wants ${depositEvents.length - 1} leafIndex have ${lastEvent.leafIndex}`; + throw new Error(errMsg); + } + if (this.merkleTreeService && (!this.optionalTree || newEvents.length)) { + return await this.merkleTreeService.verifyTree(depositEvents); + } + } + return void 0; + } + async getLatestEvents({ + fromBlock + }) { + if (this.tovarishClient?.selectedRelayer) { + const { events, lastSyncBlock: lastBlock } = await this.tovarishClient.getEvents({ + type: this.getTovarishType(), + currency: this.currency, + amount: this.amount, + fromBlock + }); + return { + events, + lastBlock + }; + } + return await this.getEventsFromRpc({ + fromBlock + }); + } +} +class BaseMultiTornadoService extends BaseEventsService { + instances; + optionalTree; + merkleTreeService; + batchTransactionService; + batchBlockService; + constructor(serviceConstructor) { + const { instances, provider, optionalTree, merkleTreeService } = serviceConstructor; + const contract = merkleTreeService?.Tornado || Tornado__factory.connect(Object.keys(instances)[0], provider); + super({ + ...serviceConstructor, + contract, + type: "*" + }); + this.batchEventsService = new BatchEventsService({ + provider, + contract, + address: Object.keys(instances), + onProgress: this.updateEventProgress + }); + this.instances = instances; + this.optionalTree = optionalTree; + this.merkleTreeService = merkleTreeService; + this.batchTransactionService = new BatchTransactionService({ + provider, + onProgress: this.updateTransactionProgress + }); + this.batchBlockService = new BatchBlockService({ + provider, + onProgress: this.updateBlockProgress + }); + } + getInstanceName() { + return `tornado_${this.netId}`; + } + getTovarishType() { + return "tornado"; + } + async formatEvents(events) { + const txs = await this.batchTransactionService.getBatchTransactions([ + ...new Set( + events.filter(({ eventName }) => eventName === "Deposit").map(({ transactionHash }) => transactionHash) + ) + ]); + const blocks = await this.batchBlockService.getBatchBlocks([ + ...new Set( + events.filter(({ eventName }) => eventName === "Withdrawal").map(({ blockNumber }) => blockNumber) + ) + ]); + return events.map( + ({ + address: instanceAddress, + blockNumber, + index: logIndex, + transactionHash, + args, + eventName: event + }) => { + const eventObjects = { + blockNumber, + logIndex, + transactionHash, + event, + instanceAddress + }; + if (event === "Deposit") { + const { commitment, leafIndex, timestamp } = args; + return { + ...eventObjects, + commitment, + leafIndex: Number(leafIndex), + timestamp: Number(timestamp), + from: txs.find(({ hash }) => hash === transactionHash)?.from || "" + }; + } + if (event === "Withdrawal") { + const { nullifierHash, to, relayer: relayerAddress, fee } = args; + return { + ...eventObjects, + logIndex, + transactionHash, + nullifierHash: String(nullifierHash), + to, + relayerAddress, + fee: String(fee), + timestamp: blocks.find(({ number }) => number === blockNumber)?.timestamp || 0 + }; + } + } + ).filter((e) => e); + } + async validateEvents({ + events, + newEvents + }) { + const instancesWithNewEvents = [ + ...new Set( + newEvents.filter(({ event }) => event === "Deposit").map(({ instanceAddress }) => instanceAddress) + ) + ]; + let tree; + const requiredTree = this.merkleTreeService?.Tornado?.target; + if (requiredTree && !instancesWithNewEvents.includes(requiredTree)) { + instancesWithNewEvents.push(requiredTree); + } + for (const instance of instancesWithNewEvents) { + const depositEvents = events.filter( + ({ instanceAddress, event }) => instanceAddress === instance && event === "Deposit" + ); + const lastEvent = depositEvents[depositEvents.length - 1]; + if (lastEvent.leafIndex !== depositEvents.length - 1) { + const errMsg = `Invalid deposit events for ${instance} wants ${depositEvents.length - 1} leafIndex have ${lastEvent.leafIndex}`; + throw new Error(errMsg); + } + if (requiredTree === instance && !this.optionalTree) { + tree = await this.merkleTreeService?.verifyTree(depositEvents); + } + } + return tree; + } + async getEvents(instanceAddress) { + const { events, validateResult: tree, lastBlock } = await this.updateEvents(); + const { depositEvents, withdrawalEvents } = events.reduce( + (acc, curr) => { + if (curr.instanceAddress === instanceAddress) { + if (curr.event === "Deposit") { + acc.depositEvents.push(curr); + } else if (curr.event === "Withdrawal") { + acc.withdrawalEvents.push(curr); + } + } + return acc; + }, + {} + ); + return { + depositEvents, + withdrawalEvents, + tree, + lastBlock + }; + } +} +class BaseEchoService extends BaseEventsService { + constructor(serviceConstructor) { + super({ + ...serviceConstructor, + contract: serviceConstructor.Echoer, + type: "Echo" + }); + } + getInstanceName() { + return `echo_${this.netId}`; + } + async formatEvents(events) { + return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { + const { who, data } = args; + if (who && data) { + const eventObjects = { + blockNumber, + logIndex, + transactionHash + }; + return { + ...eventObjects, + address: who, + encryptedAccount: data + }; + } + }).filter((e) => e); + } +} +class BaseEncryptedNotesService extends BaseEventsService { + constructor(serviceConstructor) { + super({ + ...serviceConstructor, + contract: serviceConstructor.Router, + type: "EncryptedNote" + }); + } + getInstanceName() { + return `encrypted_notes_${this.netId}`; + } + getTovarishType() { + return "encrypted_notes"; + } + async formatEvents(events) { + return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { + const { encryptedNote } = args; + if (encryptedNote && encryptedNote !== "0x") { + const eventObjects = { + blockNumber, + logIndex, + transactionHash + }; + return { + ...eventObjects, + encryptedNote + }; + } + }).filter((e) => e); + } +} +const abiCoder = AbiCoder.defaultAbiCoder(); +const proposalState = { + 0: "Pending", + 1: "Active", + 2: "Defeated", + 3: "Timelocked", + 4: "AwaitingExecution", + 5: "Executed", + 6: "Expired" +}; +function parseDescription(id, text) { + switch (id) { + case 1: + return { + title: text, + description: "See: https://torn.community/t/proposal-1-enable-torn-transfers/38" + }; + case 10: + text = text.replace("\n", "\\n\\n"); + break; + case 11: + text = text.replace('"description"', ',"description"'); + break; + case 13: + text = text.replace(/\\\\n\\\\n(\s)?(\\n)?/g, "\\n"); + break; + case 15: + text = text.replaceAll("'", '"'); + text = text.replace('"description"', ',"description"'); + break; + case 16: + text = text.replace("#16: ", ""); + break; + case 21: + return { + title: "Proposal #21: Restore Governance", + description: "" + }; + } + let title, description, rest; + try { + ({ title, description } = JSON.parse(text)); + } catch { + [title, ...rest] = text.split("\n", 2); + description = rest.join("\n"); + } + return { + title, + description + }; +} +function parseComment(Governance2, calldata) { + try { + const methodLength = 4; + const result = abiCoder.decode(["address[]", "uint256", "bool"], dataSlice(calldata, methodLength)); + const data = Governance2.interface.encodeFunctionData( + // @ts-expect-error encodeFunctionData is broken lol + "castDelegatedVote", + result + ); + const length = dataLength(data); + const str = abiCoder.decode(["string"], dataSlice(calldata, length))[0]; + const [contact, message] = JSON.parse(str); + return { + contact, + message + }; + } catch { + return { + contact: "", + message: "" + }; + } +} +class BaseGovernanceService extends BaseEventsService { + Governance; + Aggregator; + ReverseRecords; + batchTransactionService; + constructor(serviceConstructor) { + const { Governance: Governance2, Aggregator: Aggregator2, ReverseRecords, provider } = serviceConstructor; + super({ + ...serviceConstructor, + contract: Governance2, + type: "*" + }); + this.Governance = Governance2; + this.Aggregator = Aggregator2; + this.ReverseRecords = ReverseRecords; + this.batchTransactionService = new BatchTransactionService({ + provider, + onProgress: this.updateTransactionProgress + }); + } + getInstanceName() { + return `governance_${this.netId}`; + } + getTovarishType() { + return "governance"; + } + async formatEvents(events) { + const proposalEvents = []; + const votedEvents = []; + const delegatedEvents = []; + const undelegatedEvents = []; + events.forEach(({ blockNumber, index: logIndex, transactionHash, args, eventName: event }) => { + const eventObjects = { + blockNumber, + logIndex, + transactionHash, + event + }; + if (event === "ProposalCreated") { + const { id, proposer, target, startTime, endTime, description } = args; + proposalEvents.push({ + ...eventObjects, + id: Number(id), + proposer, + target, + startTime: Number(startTime), + endTime: Number(endTime), + description + }); + } + if (event === "Voted") { + const { proposalId, voter, support, votes } = args; + votedEvents.push({ + ...eventObjects, + proposalId: Number(proposalId), + voter, + support, + votes, + from: "", + input: "" + }); + } + if (event === "Delegated") { + const { account, to: delegateTo } = args; + delegatedEvents.push({ + ...eventObjects, + account, + delegateTo + }); + } + if (event === "Undelegated") { + const { account, from: delegateFrom } = args; + undelegatedEvents.push({ + ...eventObjects, + account, + delegateFrom + }); + } + }); + if (votedEvents.length) { + this.updateTransactionProgress({ percentage: 0 }); + const txs = await this.batchTransactionService.getBatchTransactions([ + ...new Set(votedEvents.map(({ transactionHash }) => transactionHash)) + ]); + votedEvents.forEach((event, index) => { + let { data: input, from } = txs.find((t) => t.hash === event.transactionHash); + if (!input || input.length > 2048) { + input = ""; + } + votedEvents[index].from = from; + votedEvents[index].input = input; + }); + } + return [...proposalEvents, ...votedEvents, ...delegatedEvents, ...undelegatedEvents]; + } + async getAllProposals() { + const { events } = await this.updateEvents(); + const proposalEvents = events.filter((e) => e.event === "ProposalCreated"); + const allProposers = [...new Set(proposalEvents.map((e) => [e.proposer]).flat())]; + const [QUORUM_VOTES, proposalStatus, proposerNameRecords] = await Promise.all([ + this.Governance.QUORUM_VOTES(), + this.Aggregator.getAllProposals(this.Governance.target), + this.ReverseRecords.getNames(allProposers) + ]); + const proposerNames = allProposers.reduce( + (acc, address, index) => { + if (proposerNameRecords[index]) { + acc[address] = proposerNameRecords[index]; + } + return acc; + }, + {} + ); + return proposalEvents.map((event, index) => { + const { id, proposer, description: text } = event; + const status = proposalStatus[index]; + const { forVotes, againstVotes, executed, extended, state } = status; + const { title, description } = parseDescription(id, text); + const quorum = (Number(forVotes + againstVotes) / Number(QUORUM_VOTES) * 100).toFixed(0) + "%"; + return { + ...event, + title, + proposerName: proposerNames[proposer] || void 0, + description, + forVotes, + againstVotes, + executed, + extended, + quorum, + state: proposalState[String(state)] + }; + }); + } + async getVotes(proposalId) { + const { events } = await this.getSavedEvents(); + const votedEvents = events.filter( + (e) => e.event === "Voted" && e.proposalId === proposalId + ); + const allVoters = [...new Set(votedEvents.map((e) => [e.from, e.voter]).flat())]; + const names = await this.ReverseRecords.getNames(allVoters); + const ensNames = allVoters.reduce( + (acc, address, index) => { + if (names[index]) { + acc[address] = names[index]; + } + return acc; + }, + {} + ); + const votes = votedEvents.map((event) => { + const { from, voter } = event; + const { contact, message } = parseComment(this.Governance, event.input); + return { + ...event, + contact, + message, + fromName: ensNames[from] || void 0, + voterName: ensNames[voter] || void 0 + }; + }); + return votes; + } + async getDelegatedBalance(ethAccount) { + const { events } = await this.getSavedEvents(); + const delegatedAccs = events.filter((e) => e.event === "Delegated" && e.delegateTo === ethAccount).map((e) => e.account); + const undelegatedAccs = events.filter((e) => e.event === "Undelegated" && e.delegateFrom === ethAccount).map((e) => e.account); + const undel = [...undelegatedAccs]; + const uniq = delegatedAccs.filter((acc) => { + const indexUndelegated = undel.indexOf(acc); + if (indexUndelegated !== -1) { + undel.splice(indexUndelegated, 1); + return false; + } + return true; + }); + const [balances, uniqNameRecords] = await Promise.all([ + this.Aggregator.getGovernanceBalances(this.Governance.target, uniq), + this.ReverseRecords.getNames(uniq) + ]); + const uniqNames = uniq.reduce( + (acc, address, index) => { + if (uniqNameRecords[index]) { + acc[address] = uniqNameRecords[index]; + } + return acc; + }, + {} + ); + return { + delegatedAccs, + undelegatedAccs, + uniq, + uniqNames, + balances, + balance: balances.reduce((acc, curr) => acc + curr, BigInt(0)) + }; + } +} +async function getTovarishNetworks(registryService, relayers) { + await Promise.all( + relayers.filter((r) => r.tovarishHost).map(async (relayer) => { + try { + relayer.tovarishNetworks = await fetchData(relayer.tovarishHost, { + ...registryService.fetchDataOptions, + headers: { + "Content-Type": "application/json" + }, + timeout: 3e4, + maxRetry: registryService.fetchDataOptions?.torPort ? 2 : 0 + }); + } catch { + relayer.tovarishNetworks = []; + } + }) + ); +} +const staticRelayers = [ + { + ensName: "tornadowithdraw.eth", + relayerAddress: "0x40c3d1656a26C9266f4A10fed0D87EFf79F54E64", + hostnames: {}, + tovarishHost: "tornadowithdraw.com", + tovarishNetworks: enabledChains + } +]; +class BaseRegistryService extends BaseEventsService { + Aggregator; + relayerEnsSubdomains; + updateInterval; + constructor(serviceConstructor) { + const { RelayerRegistry: contract, Aggregator: Aggregator2, relayerEnsSubdomains } = serviceConstructor; + super({ + ...serviceConstructor, + contract, + type: "*" + }); + this.Aggregator = Aggregator2; + this.relayerEnsSubdomains = relayerEnsSubdomains; + this.updateInterval = 86400; + } + getInstanceName() { + return `registry_${this.netId}`; + } + getTovarishType() { + return "registry"; + } + async formatEvents(events) { + const relayerRegisteredEvents = []; + const relayerUnregisteredEvents = []; + const workerRegisteredEvents = []; + const workerUnregisteredEvents = []; + events.forEach(({ blockNumber, index: logIndex, transactionHash, args, eventName: event }) => { + const eventObjects = { + blockNumber, + logIndex, + transactionHash, + event + }; + if (event === "RelayerRegistered") { + const { relayer: ensHash, ensName, relayerAddress, stakedAmount } = args; + relayerRegisteredEvents.push({ + ...eventObjects, + ensName, + relayerAddress, + ensHash, + stakedAmount: formatEther(stakedAmount) + }); + } + if (event === "RelayerUnregistered") { + const { relayer: relayerAddress } = args; + relayerUnregisteredEvents.push({ + ...eventObjects, + relayerAddress + }); + } + if (event === "WorkerRegistered") { + const { relayer: relayerAddress, worker: workerAddress } = args; + workerRegisteredEvents.push({ + ...eventObjects, + relayerAddress, + workerAddress + }); + } + if (event === "WorkerUnregistered") { + const { relayer: relayerAddress, worker: workerAddress } = args; + workerUnregisteredEvents.push({ + ...eventObjects, + relayerAddress, + workerAddress + }); + } + }); + return [ + ...relayerRegisteredEvents, + ...relayerUnregisteredEvents, + ...workerRegisteredEvents, + ...workerUnregisteredEvents + ]; + } + /** + * Get saved or cached relayers + */ + async getRelayersFromDB() { + return { + lastBlock: 0, + timestamp: 0, + relayers: [] + }; + } + /** + * Relayers from remote cache (Either from local cache, CDN, or from IPFS) + */ + async getRelayersFromCache() { + return { + lastBlock: 0, + timestamp: 0, + relayers: [], + fromCache: true + }; + } + async getSavedRelayers() { + let cachedRelayers = await this.getRelayersFromDB(); + if (!cachedRelayers || !cachedRelayers.relayers.length) { + cachedRelayers = await this.getRelayersFromCache(); + } + return cachedRelayers; + } + async getLatestRelayers() { + const { events: allEvents, lastBlock } = await this.updateEvents(); + const events = allEvents.filter((e) => e.event === "RelayerRegistered"); + const subdomains = Object.values(this.relayerEnsSubdomains); + const registerSet = /* @__PURE__ */ new Set(); + const uniqueRegisters = events.filter(({ ensName }) => { + if (!registerSet.has(ensName)) { + registerSet.add(ensName); + return true; + } + return false; + }); + const relayerNameHashes = uniqueRegisters.map((r) => namehash(r.ensName)); + const [relayersData, timestamp] = await Promise.all([ + this.Aggregator.relayersData.staticCall(relayerNameHashes, subdomains.concat("tovarish-relayer")), + this.provider.getBlock(lastBlock).then((b) => Number(b?.timestamp)) + ]); + const relayers = relayersData.map(({ owner, balance: stakeBalance, records, isRegistered }, index) => { + const { ensName, relayerAddress } = uniqueRegisters[index]; + let tovarishHost = void 0; + const hostnames = records.reduce((acc, record, recordIndex) => { + if (record) { + if (recordIndex === records.length - 1) { + tovarishHost = record; + return acc; + } + acc[Number(Object.keys(this.relayerEnsSubdomains)[recordIndex])] = record; + } + return acc; + }, {}); + const hasMinBalance = stakeBalance >= MIN_STAKE_BALANCE; + const preCondition = Object.keys(hostnames).length && isRegistered && hasMinBalance; + if (preCondition) { + return { + ensName, + relayerAddress: owner, + registeredAddress: owner !== relayerAddress ? relayerAddress : void 0, + isRegistered, + stakeBalance: formatEther(stakeBalance), + hostnames, + tovarishHost + }; + } + }).filter((r) => r); + await getTovarishNetworks(this, relayers); + const allRelayers = [...staticRelayers, ...relayers]; + const tovarishRelayers = allRelayers.filter((r) => r.tovarishHost); + const classicRelayers = allRelayers.filter((r) => !r.tovarishHost); + return { + lastBlock, + timestamp, + relayers: [...tovarishRelayers, ...classicRelayers] + }; + } + /** + * Handle saving relayers + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + async saveRelayers({ lastBlock, timestamp, relayers }) { + } + /** + * Get cached or latest relayer and save to local + */ + async updateRelayers() { + let { lastBlock, timestamp, relayers, fromCache } = await this.getSavedRelayers(); + let shouldSave = fromCache ?? false; + if (!relayers.length || timestamp + this.updateInterval < Math.floor(Date.now() / 1e3)) { + console.log("\nUpdating relayers from registry\n"); + ({ lastBlock, timestamp, relayers } = await this.getLatestRelayers()); + shouldSave = true; + } + if (shouldSave) { + await this.saveRelayers({ lastBlock, timestamp, relayers }); + } + return { lastBlock, timestamp, relayers }; + } +} +class BaseRevenueService extends BaseEventsService { + batchTransactionService; + batchBlockService; + constructor(serviceConstructor) { + const { RelayerRegistry: contract, provider } = serviceConstructor; + super({ + ...serviceConstructor, + contract, + type: "StakeBurned" + }); + this.batchTransactionService = new BatchTransactionService({ + provider, + onProgress: this.updateTransactionProgress + }); + this.batchBlockService = new BatchBlockService({ + provider, + onProgress: this.updateBlockProgress + }); + } + getInstanceName() { + return `revenue_${this.netId}`; + } + getTovarishType() { + return "revenue"; + } + async formatEvents(events) { + const blocks = await this.batchBlockService.getBatchBlocks([ + ...new Set(events.map(({ blockNumber }) => blockNumber)) + ]); + const receipts = await this.batchTransactionService.getBatchReceipt([ + ...new Set(events.map(({ transactionHash }) => transactionHash)) + ]); + const registeredRelayers = new Set(events.map(({ args }) => args.relayer)); + const tornadoInterface = Tornado__factory.createInterface(); + const withdrawHash = tornadoInterface.getEvent("Withdrawal").topicHash; + const withdrawalLogs = receipts.map( + (receipt) => receipt.logs.map((log) => { + if (log.topics[0] === withdrawHash) { + const block = blocks.find((b) => b.number === log.blockNumber); + const parsedLog = tornadoInterface.parseLog(log); + if (parsedLog && registeredRelayers.has(parsedLog.args.relayer)) { + return { + instanceAddress: log.address, + gasFee: (receipt.cumulativeGasUsed * receipt.gasPrice).toString(), + relayerFee: parsedLog.args.fee.toString(), + timestamp: block?.timestamp || 0 + }; + } + } + }).filter((l) => l) + ).flat(); + if (withdrawalLogs.length !== events.length) { + console.log( + ` +RevenueService: Mismatch on withdrawal logs (${withdrawalLogs.length} ) and events logs (${events.length}) +` + ); + } + return events.map(({ blockNumber, index: logIndex, transactionHash, args }, index) => { + const eventObjects = { + blockNumber, + logIndex, + transactionHash + }; + const { relayer: relayerAddress, amountBurned } = args; + const { instanceAddress, gasFee, relayerFee, timestamp } = withdrawalLogs[index]; + return { + ...eventObjects, + relayerAddress, + amountBurned: amountBurned.toString(), + instanceAddress, + gasFee, + relayerFee, + timestamp + }; + }); + } +} + +function zipAsync(file, options) { + return new Promise((res, rej) => { + zip(file, { ...options || {}, mtime: /* @__PURE__ */ new Date("1/1/1980") }, (err, data) => { + if (err) { + rej(err); + return; + } + res(data); + }); + }); +} +function unzipAsync(data) { + return new Promise((res, rej) => { + unzip(data, {}, (err, data2) => { + if (err) { + rej(err); + return; + } + res(data2); + }); + }); +} +async function downloadZip({ + staticUrl = "", + zipName, + zipDigest, + parseJson = true +}) { + const url = `${staticUrl}/${zipName}.zip`; + const resp = await fetchData(url, { + method: "GET", + returnResponse: true + }); + const data = new Uint8Array(await resp.arrayBuffer()); + if (zipDigest) { + const hash = "sha384-" + bytesToBase64(await digest(data)); + if (zipDigest !== hash) { + const errMsg = `Invalid digest hash for file ${url}, wants ${zipDigest} has ${hash}`; + throw new Error(errMsg); + } + } + const { [zipName]: content } = await unzipAsync(data); + console.log(`Downloaded ${url}${zipDigest ? ` ( Digest: ${zipDigest} )` : ""}`); + if (parseJson) { + return JSON.parse(new TextDecoder().decode(content)); + } + return content; +} + +async function saveDBEvents({ + idb, + instanceName, + events, + lastBlock +}) { + try { + const formattedEvents = events.map((e) => { + return { + eid: `${e.transactionHash}_${e.logIndex}`, + ...e + }; + }); + await idb.createMultipleTransactions({ + data: formattedEvents, + storeName: instanceName + }); + await idb.putItem({ + data: { + blockNumber: lastBlock, + name: instanceName + }, + storeName: "lastEvents" + }); + } catch (err) { + console.log("Method saveDBEvents has error"); + console.log(err); + } +} +async function loadDBEvents({ + idb, + instanceName +}) { + try { + const lastBlockStore = await idb.getItem({ + storeName: "lastEvents", + key: instanceName + }); + if (!lastBlockStore?.blockNumber) { + return { + events: [], + lastBlock: 0 + }; + } + const events = (await idb.getAll({ + storeName: instanceName + })).map((e) => { + delete e.eid; + return e; + }); + return { + events, + lastBlock: lastBlockStore.blockNumber + }; + } catch (err) { + console.log("Method loadDBEvents has error"); + console.log(err); + return { + events: [], + lastBlock: 0 + }; + } +} +async function loadRemoteEvents({ + staticUrl, + instanceName, + deployedBlock, + zipDigest +}) { + try { + const zipName = `${instanceName}.json`.toLowerCase(); + const events = await downloadZip({ + staticUrl, + zipName, + zipDigest + }); + if (!Array.isArray(events)) { + const errStr = `Invalid events from ${staticUrl}/${zipName}`; + throw new Error(errStr); + } + return { + events, + lastBlock: events[events.length - 1]?.blockNumber || deployedBlock, + fromCache: true + }; + } catch (err) { + console.log("Method loadRemoteEvents has error"); + console.log(err); + return { + events: [], + lastBlock: deployedBlock, + fromCache: true + }; + } +} +class DBTornadoService extends BaseTornadoService { + staticUrl; + idb; + zipDigest; + constructor(params) { + super(params); + this.staticUrl = params.staticUrl; + this.idb = params.idb; + } + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName() + }); + } + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest + }); + } + async saveEvents({ events, lastBlock }) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock + }); + } +} +class DBEchoService extends BaseEchoService { + staticUrl; + idb; + zipDigest; + constructor(params) { + super(params); + this.staticUrl = params.staticUrl; + this.idb = params.idb; + } + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName() + }); + } + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest + }); + } + async saveEvents({ events, lastBlock }) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock + }); + } +} +class DBEncryptedNotesService extends BaseEncryptedNotesService { + staticUrl; + idb; + zipDigest; + constructor(params) { + super(params); + this.staticUrl = params.staticUrl; + this.idb = params.idb; + } + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName() + }); + } + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest + }); + } + async saveEvents({ events, lastBlock }) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock + }); + } +} +class DBGovernanceService extends BaseGovernanceService { + staticUrl; + idb; + zipDigest; + constructor(params) { + super(params); + this.staticUrl = params.staticUrl; + this.idb = params.idb; + } + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName() + }); + } + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest + }); + } + async saveEvents({ events, lastBlock }) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock + }); + } +} +class DBRegistryService extends BaseRegistryService { + staticUrl; + idb; + zipDigest; + relayerJsonDigest; + constructor(params) { + super(params); + this.staticUrl = params.staticUrl; + this.idb = params.idb; + } + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName() + }); + } + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest + }); + } + async saveEvents({ events, lastBlock }) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock + }); + } + async getRelayersFromDB() { + try { + const allCachedRelayers = await this.idb.getAll({ + storeName: `relayers_${this.netId}` + }); + if (!allCachedRelayers?.length) { + return { + lastBlock: 0, + timestamp: 0, + relayers: [] + }; + } + return allCachedRelayers.slice(-1)[0]; + } catch (err) { + console.log("Method getRelayersFromDB has error"); + console.log(err); + return { + lastBlock: 0, + timestamp: 0, + relayers: [] + }; + } + } + async getRelayersFromCache() { + const url = `${this.staticUrl}/relayers.json`; + try { + const resp = await fetchData(url, { + method: "GET", + returnResponse: true + }); + const data = new Uint8Array(await resp.arrayBuffer()); + if (this.relayerJsonDigest) { + const hash = "sha384-" + bytesToBase64(await digest(data)); + if (hash !== this.relayerJsonDigest) { + const errMsg = `Invalid digest hash for ${url}, wants ${this.relayerJsonDigest} has ${hash}`; + throw new Error(errMsg); + } + } + return JSON.parse(new TextDecoder().decode(data)); + } catch (err) { + console.log("Method getRelayersFromCache has error"); + console.log(err); + return { + lastBlock: 0, + timestamp: 0, + relayers: [] + }; + } + } + async saveRelayers(cachedRelayers) { + try { + await this.idb.putItem({ + data: cachedRelayers, + storeName: `relayers_${this.netId}` + }); + } catch (err) { + console.log("Method saveRelayers has error"); + console.log(err); + } + } +} +class DBRevenueService extends BaseRevenueService { + staticUrl; + idb; + zipDigest; + relayerJsonDigest; + constructor(params) { + super(params); + this.staticUrl = params.staticUrl; + this.idb = params.idb; + } + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName() + }); + } + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest + }); + } + async saveEvents({ events, lastBlock }) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock + }); + } +} + +const _abi$8 = [ { constant: true, inputs: [ @@ -692,6 +4263,1904 @@ const _abi$6 = [ } ]; class ENS__factory { + static abi = _abi$8; + static createInterface() { + return new Interface(_abi$8); + } + static connect(address, runner) { + return new Contract(address, _abi$8, runner); + } +} + +const _abi$7 = [ + { + inputs: [ + { + internalType: "contract ENS", + name: "_ens", + type: "address" + }, + { + internalType: "contract IBaseRegistrar", + name: "_registrar", + type: "address" + }, + { + internalType: "contract IMetadataService", + name: "_metadataService", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "CannotUpgrade", + type: "error" + }, + { + inputs: [], + name: "IncompatibleParent", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "IncorrectTargetOwner", + type: "error" + }, + { + inputs: [], + name: "IncorrectTokenType", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "labelHash", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "expectedLabelhash", + type: "bytes32" + } + ], + name: "LabelMismatch", + type: "error" + }, + { + inputs: [ + { + internalType: "string", + name: "label", + type: "string" + } + ], + name: "LabelTooLong", + type: "error" + }, + { + inputs: [], + name: "LabelTooShort", + type: "error" + }, + { + inputs: [], + name: "NameIsNotWrapped", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "OperationProhibited", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "addr", + type: "address" + } + ], + name: "Unauthorised", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "approved", + type: "address" + }, + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "ApprovalForAll", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "controller", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "active", + type: "bool" + } + ], + name: "ControllerChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "ExpiryExtended", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint32", + name: "fuses", + type: "uint32" + } + ], + name: "FusesSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "NameUnwrapped", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes", + name: "name", + type: "bytes" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: false, + internalType: "uint32", + name: "fuses", + type: "uint32" + }, + { + indexed: false, + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "NameWrapped", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256[]", + name: "ids", + type: "uint256[]" + }, + { + indexed: false, + internalType: "uint256[]", + name: "values", + type: "uint256[]" + } + ], + name: "TransferBatch", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "TransferSingle", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "string", + name: "value", + type: "string" + }, + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256" + } + ], + name: "URI", + type: "event" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "_tokens", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint32", + name: "fuseMask", + type: "uint32" + } + ], + name: "allFusesBurned", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "approve", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "id", + type: "uint256" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "accounts", + type: "address[]" + }, + { + internalType: "uint256[]", + name: "ids", + type: "uint256[]" + } + ], + name: "balanceOfBatch", + outputs: [ + { + internalType: "uint256[]", + name: "", + type: "uint256[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "addr", + type: "address" + } + ], + name: "canExtendSubnames", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "addr", + type: "address" + } + ], + name: "canModifyName", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "controllers", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ens", + outputs: [ + { + internalType: "contract ENS", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32" + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "extendExpiry", + outputs: [ + { + internalType: "uint64", + name: "", + type: "uint64" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "id", + type: "uint256" + } + ], + name: "getApproved", + outputs: [ + { + internalType: "address", + name: "operator", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "id", + type: "uint256" + } + ], + name: "getData", + outputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint32", + name: "fuses", + type: "uint32" + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "address", + name: "operator", + type: "address" + } + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32" + } + ], + name: "isWrapped", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "isWrapped", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "metadataService", + outputs: [ + { + internalType: "contract IMetadataService", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "names", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "address", + name: "", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "onERC721Received", + outputs: [ + { + internalType: "bytes4", + name: "", + type: "bytes4" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "id", + type: "uint256" + } + ], + name: "ownerOf", + outputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_token", + type: "address" + }, + { + internalType: "address", + name: "_to", + type: "address" + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256" + } + ], + name: "recoverFunds", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "string", + name: "label", + type: "string" + }, + { + internalType: "address", + name: "wrappedOwner", + type: "address" + }, + { + internalType: "uint256", + name: "duration", + type: "uint256" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint16", + name: "ownerControlledFuses", + type: "uint16" + } + ], + name: "registerAndWrapETH2LD", + outputs: [ + { + internalType: "uint256", + name: "registrarExpiry", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "registrar", + outputs: [ + { + internalType: "contract IBaseRegistrar", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "duration", + type: "uint256" + } + ], + name: "renew", + outputs: [ + { + internalType: "uint256", + name: "expires", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256[]", + name: "ids", + type: "uint256[]" + }, + { + internalType: "uint256[]", + name: "amounts", + type: "uint256[]" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "safeBatchTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "setApprovalForAll", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32" + }, + { + internalType: "uint32", + name: "fuses", + type: "uint32" + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "setChildFuses", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "controller", + type: "address" + }, + { + internalType: "bool", + name: "active", + type: "bool" + } + ], + name: "setController", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint16", + name: "ownerControlledFuses", + type: "uint16" + } + ], + name: "setFuses", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IMetadataService", + name: "_metadataService", + type: "address" + } + ], + name: "setMetadataService", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setRecord", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "setResolver", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "string", + name: "label", + type: "string" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint32", + name: "fuses", + type: "uint32" + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "setSubnodeOwner", + outputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "string", + name: "label", + type: "string" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + }, + { + internalType: "uint32", + name: "fuses", + type: "uint32" + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "setSubnodeRecord", + outputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setTTL", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract INameWrapperUpgrade", + name: "_upgradeAddress", + type: "address" + } + ], + name: "setUpgradeContract", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32" + }, + { + internalType: "address", + name: "controller", + type: "address" + } + ], + name: "unwrap", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32" + }, + { + internalType: "address", + name: "registrant", + type: "address" + }, + { + internalType: "address", + name: "controller", + type: "address" + } + ], + name: "unwrapETH2LD", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "name", + type: "bytes" + }, + { + internalType: "bytes", + name: "extraData", + type: "bytes" + } + ], + name: "upgrade", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "upgradeContract", + outputs: [ + { + internalType: "contract INameWrapperUpgrade", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "uri", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "name", + type: "bytes" + }, + { + internalType: "address", + name: "wrappedOwner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "wrap", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "string", + name: "label", + type: "string" + }, + { + internalType: "address", + name: "wrappedOwner", + type: "address" + }, + { + internalType: "uint16", + name: "ownerControlledFuses", + type: "uint16" + }, + { + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "wrapETH2LD", + outputs: [ + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +class ENSNameWrapper__factory { + static abi = _abi$7; + static createInterface() { + return new Interface(_abi$7); + } + static connect(address, runner) { + return new Contract(address, _abi$7, runner); + } +} + +const _abi$6 = [ + { + inputs: [ + { + internalType: "contract ENS", + name: "_old", + type: "address" + } + ], + payable: false, + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "ApprovalForAll", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "bytes32", + name: "label", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "NewOwner", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "NewResolver", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "NewTTL", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "Transfer", + type: "event" + }, + { + constant: true, + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "operator", + type: "address" + } + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [], + name: "old", + outputs: [ + { + internalType: "contract ENS", + name: "", + type: "address" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "recordExists", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "resolver", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "setApprovalForAll", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "setOwner", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setRecord", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "setResolver", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "label", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "setSubnodeOwner", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "label", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setSubnodeRecord", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setTTL", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "ttl", + outputs: [ + { + internalType: "uint64", + name: "", + type: "uint64" + } + ], + payable: false, + stateMutability: "view", + type: "function" + } +]; +class ENSRegistry__factory { + static abi = _abi$6; static createInterface() { return new Interface(_abi$6); } @@ -699,9 +6168,1031 @@ class ENS__factory { return new Contract(address, _abi$6, runner); } } -ENS__factory.abi = _abi$6; const _abi$5 = [ + { + inputs: [ + { + internalType: "contract ENS", + name: "_ens", + type: "address" + }, + { + internalType: "contract INameWrapper", + name: "wrapperAddress", + type: "address" + }, + { + internalType: "address", + name: "_trustedETHController", + type: "address" + }, + { + internalType: "address", + name: "_trustedReverseRegistrar", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "uint256", + name: "contentType", + type: "uint256" + } + ], + name: "ABIChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "a", + type: "address" + } + ], + name: "AddrChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint256", + name: "coinType", + type: "uint256" + }, + { + indexed: false, + internalType: "bytes", + name: "newAddress", + type: "bytes" + } + ], + name: "AddressChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "ApprovalForAll", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "delegate", + type: "address" + }, + { + indexed: true, + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "Approved", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes", + name: "hash", + type: "bytes" + } + ], + name: "ContenthashChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes", + name: "name", + type: "bytes" + }, + { + indexed: false, + internalType: "uint16", + name: "resource", + type: "uint16" + }, + { + indexed: false, + internalType: "bytes", + name: "record", + type: "bytes" + } + ], + name: "DNSRecordChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes", + name: "name", + type: "bytes" + }, + { + indexed: false, + internalType: "uint16", + name: "resource", + type: "uint16" + } + ], + name: "DNSRecordDeleted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes", + name: "lastzonehash", + type: "bytes" + }, + { + indexed: false, + internalType: "bytes", + name: "zonehash", + type: "bytes" + } + ], + name: "DNSZonehashChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "bytes4", + name: "interfaceID", + type: "bytes4" + }, + { + indexed: false, + internalType: "address", + name: "implementer", + type: "address" + } + ], + name: "InterfaceChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "string", + name: "name", + type: "string" + } + ], + name: "NameChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes32", + name: "x", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes32", + name: "y", + type: "bytes32" + } + ], + name: "PubkeyChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "string", + name: "indexedKey", + type: "string" + }, + { + indexed: false, + internalType: "string", + name: "key", + type: "string" + }, + { + indexed: false, + internalType: "string", + name: "value", + type: "string" + } + ], + name: "TextChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint64", + name: "newVersion", + type: "uint64" + } + ], + name: "VersionChanged", + type: "event" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint256", + name: "contentTypes", + type: "uint256" + } + ], + name: "ABI", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + }, + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "addr", + outputs: [ + { + internalType: "address payable", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint256", + name: "coinType", + type: "uint256" + } + ], + name: "addr", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "delegate", + type: "address" + }, + { + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "approve", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "clearRecords", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "contenthash", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "name", + type: "bytes32" + }, + { + internalType: "uint16", + name: "resource", + type: "uint16" + } + ], + name: "dnsRecord", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "name", + type: "bytes32" + } + ], + name: "hasDNSRecords", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes4", + name: "interfaceID", + type: "bytes4" + } + ], + name: "interfaceImplementer", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "delegate", + type: "address" + } + ], + name: "isApprovedFor", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "address", + name: "operator", + type: "address" + } + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes[]", + name: "data", + type: "bytes[]" + } + ], + name: "multicall", + outputs: [ + { + internalType: "bytes[]", + name: "results", + type: "bytes[]" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "nodehash", + type: "bytes32" + }, + { + internalType: "bytes[]", + name: "data", + type: "bytes[]" + } + ], + name: "multicallWithNodeCheck", + outputs: [ + { + internalType: "bytes[]", + name: "results", + type: "bytes[]" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "pubkey", + outputs: [ + { + internalType: "bytes32", + name: "x", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "y", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "recordVersions", + outputs: [ + { + internalType: "uint64", + name: "", + type: "uint64" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint256", + name: "contentType", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "setABI", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint256", + name: "coinType", + type: "uint256" + }, + { + internalType: "bytes", + name: "a", + type: "bytes" + } + ], + name: "setAddr", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "a", + type: "address" + } + ], + name: "setAddr", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "setApprovalForAll", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes", + name: "hash", + type: "bytes" + } + ], + name: "setContenthash", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "setDNSRecords", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes4", + name: "interfaceID", + type: "bytes4" + }, + { + internalType: "address", + name: "implementer", + type: "address" + } + ], + name: "setInterface", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "string", + name: "newName", + type: "string" + } + ], + name: "setName", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "x", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "y", + type: "bytes32" + } + ], + name: "setPubkey", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "string", + name: "key", + type: "string" + }, + { + internalType: "string", + name: "value", + type: "string" + } + ], + name: "setText", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes", + name: "hash", + type: "bytes" + } + ], + name: "setZonehash", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceID", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "string", + name: "key", + type: "string" + } + ], + name: "text", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "zonehash", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + } +]; +class ENSResolver__factory { + static abi = _abi$5; + static createInterface() { + return new Interface(_abi$5); + } + static connect(address, runner) { + return new Contract(address, _abi$5, runner); + } +} + +const _abi$4 = [ { constant: true, inputs: [], @@ -1003,205 +7494,7 @@ const _abi$5 = [ } ]; class ERC20__factory { - static createInterface() { - return new Interface(_abi$5); - } - static connect(address, runner) { - return new Contract(address, _abi$5, runner); - } -} -ERC20__factory.abi = _abi$5; - -const _abi$4 = [ - { - inputs: [], - stateMutability: "nonpayable", - type: "constructor" - }, - { - inputs: [], - name: "GAS_UNIT", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [ - { - internalType: "uint32", - name: "_derivationThresold", - type: "uint32" - } - ], - name: "changeDerivationThresold", - outputs: [], - stateMutability: "nonpayable", - type: "function" - }, - { - inputs: [ - { - internalType: "uint32", - name: "_gasUnit", - type: "uint32" - } - ], - name: "changeGasUnit", - outputs: [], - stateMutability: "nonpayable", - type: "function" - }, - { - inputs: [ - { - internalType: "uint32", - name: "_heartbeat", - type: "uint32" - } - ], - name: "changeHeartbeat", - outputs: [], - stateMutability: "nonpayable", - type: "function" - }, - { - inputs: [ - { - internalType: "address", - name: "_owner", - type: "address" - } - ], - name: "changeOwnership", - outputs: [], - stateMutability: "nonpayable", - type: "function" - }, - { - inputs: [], - name: "derivationThresold", - outputs: [ - { - internalType: "uint32", - name: "", - type: "uint32" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [], - name: "gasPrice", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [], - name: "heartbeat", - outputs: [ - { - internalType: "uint32", - name: "", - type: "uint32" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [], - name: "maxFeePerGas", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [], - name: "maxPriorityFeePerGas", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [], - name: "owner", - outputs: [ - { - internalType: "address", - name: "", - type: "address" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [], - name: "pastGasPrice", - outputs: [ - { - internalType: "uint32", - name: "", - type: "uint32" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [ - { - internalType: "uint32", - name: "_gasPrice", - type: "uint32" - } - ], - name: "setGasPrice", - outputs: [], - stateMutability: "nonpayable", - type: "function" - }, - { - inputs: [], - name: "timestamp", - outputs: [ - { - internalType: "uint32", - name: "", - type: "uint32" - } - ], - stateMutability: "view", - type: "function" - } -]; -class GasPriceOracle__factory { + static abi = _abi$4; static createInterface() { return new Interface(_abi$4); } @@ -1209,7 +7502,6 @@ class GasPriceOracle__factory { return new Contract(address, _abi$4, runner); } } -GasPriceOracle__factory.abi = _abi$4; const _abi$3 = [ { @@ -1652,6 +7944,7 @@ const _abi$3 = [ } ]; class Multicall__factory { + static abi = _abi$3; static createInterface() { return new Interface(_abi$3); } @@ -1659,7 +7952,6 @@ class Multicall__factory { return new Contract(address, _abi$3, runner); } } -Multicall__factory.abi = _abi$3; const _abi$2 = [ { @@ -2177,6 +8469,7 @@ const _abi$2 = [ } ]; class OffchainOracle__factory { + static abi = _abi$2; static createInterface() { return new Interface(_abi$2); } @@ -2184,7 +8477,6 @@ class OffchainOracle__factory { return new Contract(address, _abi$2, runner); } } -OffchainOracle__factory.abi = _abi$2; const _abi$1 = [ { @@ -2485,6 +8777,7 @@ const _abi$1 = [ } ]; class OvmGasPriceOracle__factory { + static abi = _abi$1; static createInterface() { return new Interface(_abi$1); } @@ -2492,7 +8785,6 @@ class OvmGasPriceOracle__factory { return new Contract(address, _abi$1, runner); } } -OvmGasPriceOracle__factory.abi = _abi$1; const _abi = [ { @@ -2527,6 +8819,7 @@ const _abi = [ } ]; class ReverseRecords__factory { + static abi = _abi; static createInterface() { return new Interface(_abi); } @@ -2534,3270 +8827,102 @@ class ReverseRecords__factory { return new Contract(address, _abi, runner); } } -ReverseRecords__factory.abi = _abi; var index = /*#__PURE__*/Object.freeze({ - __proto__: null, - ENS__factory: ENS__factory, - ERC20__factory: ERC20__factory, - GasPriceOracle__factory: GasPriceOracle__factory, - Multicall__factory: Multicall__factory, - OffchainOracle__factory: OffchainOracle__factory, - OvmGasPriceOracle__factory: OvmGasPriceOracle__factory, - ReverseRecords__factory: ReverseRecords__factory + __proto__: null, + ENSNameWrapper__factory: ENSNameWrapper__factory, + ENSRegistry__factory: ENSRegistry__factory, + ENSResolver__factory: ENSResolver__factory, + ENS__factory: ENS__factory, + ERC20__factory: ERC20__factory, + Multicall__factory: Multicall__factory, + OffchainOracle__factory: OffchainOracle__factory, + OvmGasPriceOracle__factory: OvmGasPriceOracle__factory, + ReverseRecords__factory: ReverseRecords__factory }); -BigInt.prototype.toJSON = function() { - return this.toString(); -}; -const isNode = !process.browser && typeof globalThis.window === "undefined"; -const crypto = isNode ? webcrypto : globalThis.crypto; -const chunk = (arr, size) => [...Array(Math.ceil(arr.length / size))].map((_, i) => arr.slice(size * i, size + size * i)); -function sleep(ms) { - return new Promise((resolve) => setTimeout(resolve, ms)); -} -function validateUrl(url, protocols) { - try { - const parsedUrl = new URL(url); - if (protocols && protocols.length) { - return protocols.map((p) => p.toLowerCase()).includes(parsedUrl.protocol); - } - return true; - } catch (e) { - return false; - } -} -function concatBytes(...arrays) { - const totalSize = arrays.reduce((acc, e) => acc + e.length, 0); - const merged = new Uint8Array(totalSize); - arrays.forEach((array, i, arrays2) => { - const offset = arrays2.slice(0, i).reduce((acc, e) => acc + e.length, 0); - merged.set(array, offset); - }); - return merged; -} -function bufferToBytes(b) { - return new Uint8Array(b.buffer); -} -function bytesToBase64(bytes) { - return btoa(String.fromCharCode.apply(null, Array.from(bytes))); -} -function base64ToBytes(base64) { - return Uint8Array.from(atob(base64), (c) => c.charCodeAt(0)); -} -function bytesToHex(bytes) { - return "0x" + Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join(""); -} -function hexToBytes(hexString) { - if (hexString.slice(0, 2) === "0x") { - hexString = hexString.replace("0x", ""); - } - if (hexString.length % 2 !== 0) { - hexString = "0" + hexString; - } - return Uint8Array.from(hexString.match(/.{1,2}/g).map((byte) => parseInt(byte, 16))); -} -function bytesToBN(bytes) { - return BigInt(bytesToHex(bytes)); -} -function bnToBytes(bigint) { - let hexString = typeof bigint === "bigint" ? bigint.toString(16) : bigint; - if (hexString.startsWith("0x")) { - hexString = hexString.replace("0x", ""); - } - if (hexString.length % 2 !== 0) { - hexString = "0" + hexString; - } - return Uint8Array.from(hexString.match(/.{1,2}/g).map((byte) => parseInt(byte, 16))); -} -function leBuff2Int(bytes) { - return new BN(bytes, 16, "le"); -} -function leInt2Buff(bigint) { - return Uint8Array.from(new BN(bigint).toArray("le", 31)); -} -function toFixedHex(numberish, length = 32) { - return "0x" + BigInt(numberish).toString(16).padStart(length * 2, "0"); -} -function toFixedLength(string, length = 32) { - string = string.replace("0x", ""); - return "0x" + string.padStart(length * 2, "0"); -} -function rBigInt(nbytes = 31) { - return bytesToBN(crypto.getRandomValues(new Uint8Array(nbytes))); -} -function bigIntReplacer(key, value) { - return typeof value === "bigint" ? value.toString() : value; -} -function substring(str, length = 10) { - if (str.length < length * 2) { - return str; - } - return `${str.substring(0, length)}...${str.substring(str.length - length)}`; -} - -var __async$c = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; -function multicall(Multicall2, calls) { - return __async$c(this, null, function* () { - const calldata = calls.map((call) => { - var _a, _b, _c; - const target = ((_a = call.contract) == null ? void 0 : _a.target) || call.address; - const callInterface = ((_b = call.contract) == null ? void 0 : _b.interface) || call.interface; - return { - target, - callData: callInterface.encodeFunctionData(call.name, call.params), - allowFailure: (_c = call.allowFailure) != null ? _c : false - }; - }); - const returnData = yield Multicall2.aggregate3.staticCall(calldata); - const res = returnData.map((call, i) => { - var _a; - const callInterface = ((_a = calls[i].contract) == null ? void 0 : _a.interface) || calls[i].interface; - const [result, data] = call; - const decodeResult = result && data && data !== "0x" ? callInterface.decodeFunctionResult(calls[i].name, data) : null; - return !decodeResult ? null : decodeResult.length === 1 ? decodeResult[0] : decodeResult; - }); - return res; - }); -} - -var __defProp$4 = Object.defineProperty; -var __defProps$3 = Object.defineProperties; -var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors; -var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols; -var __getProtoOf$1 = Object.getPrototypeOf; -var __hasOwnProp$4 = Object.prototype.hasOwnProperty; -var __propIsEnum$4 = Object.prototype.propertyIsEnumerable; -var __reflectGet$1 = Reflect.get; -var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __spreadValues$4 = (a, b) => { - for (var prop in b || (b = {})) - if (__hasOwnProp$4.call(b, prop)) - __defNormalProp$4(a, prop, b[prop]); - if (__getOwnPropSymbols$4) - for (var prop of __getOwnPropSymbols$4(b)) { - if (__propIsEnum$4.call(b, prop)) - __defNormalProp$4(a, prop, b[prop]); - } - return a; -}; -var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b)); -var __superGet$1 = (cls, obj, key) => __reflectGet$1(__getProtoOf$1(cls), key, obj); -var __async$b = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; -const defaultUserAgent = "Mozilla/5.0 (Windows NT 10.0; rv:109.0) Gecko/20100101 Firefox/115.0"; -const fetch = crossFetch; -function getHttpAgent({ - fetchUrl, - proxyUrl, - torPort, - retry -}) { - const { HttpProxyAgent } = require("http-proxy-agent"); - const { HttpsProxyAgent } = require("https-proxy-agent"); - const { SocksProxyAgent } = require("socks-proxy-agent"); - if (torPort) { - return new SocksProxyAgent(`socks5h://tor${retry}@127.0.0.1:${torPort}`); - } - if (!proxyUrl) { - return; - } - const isHttps = fetchUrl.includes("https://"); - if (proxyUrl.includes("socks://") || proxyUrl.includes("socks4://") || proxyUrl.includes("socks5://")) { - return new SocksProxyAgent(proxyUrl); - } - if (proxyUrl.includes("http://") || proxyUrl.includes("https://")) { - if (isHttps) { - return new HttpsProxyAgent(proxyUrl); - } - return new HttpProxyAgent(proxyUrl); - } -} -function fetchData(_0) { - return __async$b(this, arguments, function* (url, options = {}) { - var _a, _b, _c; - const MAX_RETRY = (_a = options.maxRetry) != null ? _a : 3; - const RETRY_ON = (_b = options.retryOn) != null ? _b : 500; - const userAgent = (_c = options.userAgent) != null ? _c : defaultUserAgent; - let retry = 0; - let errorObject; - if (!options.method) { - if (!options.body) { - options.method = "GET"; - } else { - options.method = "POST"; - } - } - if (!options.headers) { - options.headers = {}; - } - if (isNode && !options.headers["User-Agent"]) { - options.headers["User-Agent"] = userAgent; - } - while (retry < MAX_RETRY + 1) { - let timeout; - if (!options.signal && options.timeout) { - const controller = new AbortController(); - options.signal = controller.signal; - timeout = setTimeout(() => { - controller.abort(); - }, options.timeout); - } - if (!options.agent && isNode && (options.proxy || options.torPort)) { - options.agent = getHttpAgent({ - fetchUrl: url, - proxyUrl: options.proxy, - torPort: options.torPort, - retry - }); - } - if (options.debug && typeof options.debug === "function") { - options.debug("request", { - url, - retry, - errorObject, - options - }); - } - try { - const resp = yield fetch(url, { - method: options.method, - headers: options.headers, - body: options.body, - redirect: options.redirect, - signal: options.signal, - agent: options.agent - }); - if (options.debug && typeof options.debug === "function") { - options.debug("response", resp); - } - if (!resp.ok) { - const errMsg = `Request to ${url} failed with error code ${resp.status}: -` + (yield resp.text()); - throw new Error(errMsg); - } - if (options.returnResponse) { - return resp; - } - const contentType = resp.headers.get("content-type"); - if (contentType == null ? void 0 : contentType.includes("application/json")) { - return yield resp.json(); - } - if (contentType == null ? void 0 : contentType.includes("text")) { - return yield resp.text(); - } - return resp; - } catch (error) { - if (timeout) { - clearTimeout(timeout); - } - errorObject = error; - retry++; - yield sleep(RETRY_ON); - } finally { - if (timeout) { - clearTimeout(timeout); - } - } - } - if (options.debug && typeof options.debug === "function") { - options.debug("error", errorObject); - } - throw errorObject; - }); -} -const fetchGetUrlFunc = (options = {}) => (req, _signal) => __async$b(void 0, null, function* () { - let signal; - if (_signal) { - const controller = new AbortController(); - signal = controller.signal; - _signal.addListener(() => { - controller.abort(); - }); - } - const init = __spreadProps$3(__spreadValues$4({}, options), { - method: req.method || "POST", - headers: req.headers, - body: req.body || void 0, - signal, - returnResponse: true - }); - const resp = yield fetchData(req.url, init); - const headers = {}; - resp.headers.forEach((value, key) => { - headers[key.toLowerCase()] = value; - }); - const respBody = yield resp.arrayBuffer(); - const body = respBody == null ? null : new Uint8Array(respBody); - return { - statusCode: resp.status, - statusMessage: resp.statusText, - headers, - body - }; -}); -const oracleMapper = /* @__PURE__ */ new Map(); -const multicallMapper = /* @__PURE__ */ new Map(); -function getGasOraclePlugin(networkKey, fetchOptions) { - const gasStationApi = (fetchOptions == null ? void 0 : fetchOptions.gasStationApi) || "https://gasstation.polygon.technology/v2"; - return new FetchUrlFeeDataNetworkPlugin(gasStationApi, (fetchFeeData, provider, request) => __async$b(this, null, function* () { - if (!oracleMapper.has(networkKey)) { - oracleMapper.set(networkKey, GasPriceOracle__factory.connect(fetchOptions == null ? void 0 : fetchOptions.gasPriceOracle, provider)); - } - if (!multicallMapper.has(networkKey)) { - multicallMapper.set( - networkKey, - Multicall__factory.connect("0xcA11bde05977b3631167028862bE2a173976CA11", provider) - ); - } - const Oracle = oracleMapper.get(networkKey); - const Multicall2 = multicallMapper.get(networkKey); - const [timestamp, heartbeat, feePerGas, priorityFeePerGas] = yield multicall(Multicall2, [ - { - contract: Oracle, - name: "timestamp" - }, - { - contract: Oracle, - name: "heartbeat" - }, - { - contract: Oracle, - name: "maxFeePerGas" - }, - { - contract: Oracle, - name: "maxPriorityFeePerGas" - } - ]); - const isOutdated = Number(timestamp) <= Date.now() / 1e3 - Number(heartbeat); - if (!isOutdated) { - const maxPriorityFeePerGas = priorityFeePerGas * BigInt(13) / BigInt(10); - const maxFeePerGas = feePerGas * BigInt(2) + maxPriorityFeePerGas; - return { - gasPrice: maxFeePerGas, - maxFeePerGas, - maxPriorityFeePerGas - }; - } - const fetchReq = new FetchRequest(gasStationApi); - fetchReq.getUrlFunc = fetchGetUrlFunc(fetchOptions); - if (isNode) { - fetchReq.setHeader("User-Agent", "ethers"); - } - const [ - { - bodyJson: { fast } - }, - { gasPrice } - ] = yield Promise.all([fetchReq.send(), fetchFeeData()]); - return { - gasPrice, - maxFeePerGas: parseUnits(`${fast.maxFee}`, 9), - maxPriorityFeePerGas: parseUnits(`${fast.maxPriorityFee}`, 9) - }; - })); -} -function getProvider(rpcUrl, fetchOptions) { - return __async$b(this, null, function* () { - const fetchReq = new FetchRequest(rpcUrl); - fetchReq.getUrlFunc = fetchGetUrlFunc(fetchOptions); - const _staticNetwork = yield new JsonRpcProvider(fetchReq).getNetwork(); - const ensPlugin = _staticNetwork.getPlugin("org.ethers.plugins.network.Ens"); - const gasCostPlugin = _staticNetwork.getPlugin("org.ethers.plugins.network.GasCost"); - const gasStationPlugin = _staticNetwork.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin"); - const staticNetwork = new Network(_staticNetwork.name, _staticNetwork.chainId); - if (ensPlugin) { - staticNetwork.attachPlugin(ensPlugin); - } - if (gasCostPlugin) { - staticNetwork.attachPlugin(gasCostPlugin); - } - if (fetchOptions == null ? void 0 : fetchOptions.gasPriceOracle) { - staticNetwork.attachPlugin(getGasOraclePlugin(`${_staticNetwork.chainId}_${rpcUrl}`, fetchOptions)); - } else if (gasStationPlugin) { - staticNetwork.attachPlugin(gasStationPlugin); - } - const provider = new JsonRpcProvider(fetchReq, staticNetwork, { - staticNetwork - }); - provider.pollingInterval = (fetchOptions == null ? void 0 : fetchOptions.pollingInterval) || 1e3; - return provider; - }); -} -function getProviderWithNetId(netId, rpcUrl, config, fetchOptions) { - const { networkName, reverseRecordsContract, gasPriceOracleContract, gasStationApi, pollInterval } = config; - const hasEns = Boolean(reverseRecordsContract); - const fetchReq = new FetchRequest(rpcUrl); - fetchReq.getUrlFunc = fetchGetUrlFunc(fetchOptions); - const staticNetwork = new Network(networkName, netId); - if (hasEns) { - staticNetwork.attachPlugin(new EnsPlugin(null, Number(netId))); - } - staticNetwork.attachPlugin(new GasCostPlugin()); - if (gasPriceOracleContract) { - staticNetwork.attachPlugin( - getGasOraclePlugin(`${netId}_${rpcUrl}`, { - gasPriceOracle: gasPriceOracleContract, - gasStationApi - }) - ); - } - const provider = new JsonRpcProvider(fetchReq, staticNetwork, { - staticNetwork - }); - provider.pollingInterval = (fetchOptions == null ? void 0 : fetchOptions.pollingInterval) || pollInterval * 1e3; - return provider; -} -const populateTransaction = (signer, tx) => __async$b(void 0, null, function* () { - const provider = signer.provider; - if (!tx.from) { - tx.from = signer.address; - } else if (tx.from !== signer.address) { - const errMsg = `populateTransaction: signer mismatch for tx, wants ${tx.from} have ${signer.address}`; - throw new Error(errMsg); - } - const [feeData, nonce] = yield Promise.all([ - (() => __async$b(void 0, null, function* () { - if (tx.maxFeePerGas && tx.maxPriorityFeePerGas) { - return new FeeData(null, BigInt(tx.maxFeePerGas), BigInt(tx.maxPriorityFeePerGas)); - } - if (tx.gasPrice) { - return new FeeData(BigInt(tx.gasPrice), null, null); - } - const fetchedFeeData = yield provider.getFeeData(); - if (fetchedFeeData.maxFeePerGas && fetchedFeeData.maxPriorityFeePerGas) { - return new FeeData( - null, - fetchedFeeData.maxFeePerGas * (BigInt(1e4) + BigInt(signer.gasPriceBump)) / BigInt(1e4), - fetchedFeeData.maxPriorityFeePerGas - ); - } else { - return new FeeData( - fetchedFeeData.gasPrice * (BigInt(1e4) + BigInt(signer.gasPriceBump)) / BigInt(1e4), - null, - null - ); - } - }))(), - (() => __async$b(void 0, null, function* () { - if (tx.nonce) { - return tx.nonce; - } - let fetchedNonce = yield provider.getTransactionCount(signer.address, "pending"); - if (signer.bumpNonce && signer.nonce && signer.nonce >= fetchedNonce) { - console.log( - `populateTransaction: bumping nonce from ${fetchedNonce} to ${fetchedNonce + 1} for ${signer.address}` - ); - fetchedNonce++; - } - return fetchedNonce; - }))() - ]); - tx.nonce = nonce; - if (feeData.maxFeePerGas && feeData.maxPriorityFeePerGas) { - tx.maxFeePerGas = feeData.maxFeePerGas; - tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; - if (!tx.type) { - tx.type = 2; - } - delete tx.gasPrice; - } else if (feeData.gasPrice) { - tx.gasPrice = feeData.gasPrice; - if (!tx.type) { - tx.type = 0; - } - delete tx.maxFeePerGas; - delete tx.maxPriorityFeePerGas; - } - tx.gasLimit = tx.gasLimit || (yield (() => __async$b(void 0, null, function* () { - try { - const gasLimit = yield provider.estimateGas(tx); - return gasLimit === BigInt(21e3) ? gasLimit : gasLimit * (BigInt(1e4) + BigInt(signer.gasLimitBump)) / BigInt(1e4); - } catch (err) { - if (signer.gasFailover) { - console.log("populateTransaction: warning gas estimation failed falling back to 3M gas"); - return BigInt("3000000"); - } - throw err; - } - }))()); - return tx; -}); -class TornadoWallet extends Wallet { - constructor(key, provider, { gasPriceBump, gasLimitBump, gasFailover, bumpNonce } = {}) { - super(key, provider); - this.gasPriceBump = gasPriceBump != null ? gasPriceBump : 1e3; - this.gasLimitBump = gasLimitBump != null ? gasLimitBump : 3e3; - this.gasFailover = gasFailover != null ? gasFailover : false; - this.bumpNonce = bumpNonce != null ? bumpNonce : false; - } - static fromMnemonic(mneomnic, provider, index = 0, options) { - const defaultPath = `m/44'/60'/0'/0/${index}`; - const { privateKey } = HDNodeWallet.fromPhrase(mneomnic, void 0, defaultPath); - return new TornadoWallet(privateKey, provider, options); - } - populateTransaction(tx) { - return __async$b(this, null, function* () { - const txObject = yield populateTransaction(this, tx); - this.nonce = txObject.nonce; - return __superGet$1(TornadoWallet.prototype, this, "populateTransaction").call(this, txObject); - }); - } -} -class TornadoVoidSigner extends VoidSigner { - constructor(address, provider, { gasPriceBump, gasLimitBump, gasFailover, bumpNonce } = {}) { - super(address, provider); - this.gasPriceBump = gasPriceBump != null ? gasPriceBump : 1e3; - this.gasLimitBump = gasLimitBump != null ? gasLimitBump : 3e3; - this.gasFailover = gasFailover != null ? gasFailover : false; - this.bumpNonce = bumpNonce != null ? bumpNonce : false; - } - populateTransaction(tx) { - return __async$b(this, null, function* () { - const txObject = yield populateTransaction(this, tx); - this.nonce = txObject.nonce; - return __superGet$1(TornadoVoidSigner.prototype, this, "populateTransaction").call(this, txObject); - }); - } -} -class TornadoRpcSigner extends JsonRpcSigner { - constructor(provider, address, { gasPriceBump, gasLimitBump, gasFailover, bumpNonce } = {}) { - super(provider, address); - this.gasPriceBump = gasPriceBump != null ? gasPriceBump : 1e3; - this.gasLimitBump = gasLimitBump != null ? gasLimitBump : 3e3; - this.gasFailover = gasFailover != null ? gasFailover : false; - this.bumpNonce = bumpNonce != null ? bumpNonce : false; - } - sendUncheckedTransaction(tx) { - return __async$b(this, null, function* () { - return __superGet$1(TornadoRpcSigner.prototype, this, "sendUncheckedTransaction").call(this, yield populateTransaction(this, tx)); - }); - } -} -class TornadoBrowserProvider extends BrowserProvider { - constructor(ethereum, network, options) { - super(ethereum, network); - this.options = options; - } - getSigner(address) { - return __async$b(this, null, function* () { - var _a, _b, _c, _d, _e, _f, _g, _h, _i; - const signerAddress = (yield __superGet$1(TornadoBrowserProvider.prototype, this, "getSigner").call(this, address)).address; - if (((_a = this.options) == null ? void 0 : _a.webChainId) && ((_b = this.options) == null ? void 0 : _b.connectWallet) && Number(yield __superGet$1(TornadoBrowserProvider.prototype, this, "send").call(this, "eth_chainId", [])) !== Number((_c = this.options) == null ? void 0 : _c.webChainId)) { - yield this.options.connectWallet(); - } - if ((_d = this.options) == null ? void 0 : _d.handleNetworkChanges) { - (_e = window == null ? void 0 : window.ethereum) == null ? void 0 : _e.on("chainChanged", this.options.handleNetworkChanges); - } - if ((_f = this.options) == null ? void 0 : _f.handleAccountChanges) { - (_g = window == null ? void 0 : window.ethereum) == null ? void 0 : _g.on("accountsChanged", this.options.handleAccountChanges); - } - if ((_h = this.options) == null ? void 0 : _h.handleAccountDisconnect) { - (_i = window == null ? void 0 : window.ethereum) == null ? void 0 : _i.on("disconnect", this.options.handleAccountDisconnect); - } - return new TornadoRpcSigner(this, signerAddress, this.options); - }); - } -} - -const GET_STATISTIC = ` - query getStatistic($currency: String!, $amount: String!, $first: Int, $orderBy: BigInt, $orderDirection: String) { - deposits(first: $first, orderBy: $orderBy, orderDirection: $orderDirection, where: { currency: $currency, amount: $amount }) { - index - timestamp - blockNumber - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const _META = ` - query getMeta { - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_REGISTERED = ` - query getRegistered($first: Int, $fromBlock: Int) { - relayers(first: $first, orderBy: blockRegistration, orderDirection: asc, where: { - blockRegistration_gte: $fromBlock - }) { - id - address - ensName - blockRegistration - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_DEPOSITS = ` - query getDeposits($currency: String!, $amount: String!, $first: Int, $fromBlock: Int) { - deposits(first: $first, orderBy: index, orderDirection: asc, where: { - amount: $amount, - currency: $currency, - blockNumber_gte: $fromBlock - }) { - id - blockNumber - commitment - index - timestamp - from - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_WITHDRAWALS = ` - query getWithdrawals($currency: String!, $amount: String!, $first: Int, $fromBlock: Int!) { - withdrawals(first: $first, orderBy: blockNumber, orderDirection: asc, where: { - currency: $currency, - amount: $amount, - blockNumber_gte: $fromBlock - }) { - id - blockNumber - nullifier - to - fee - timestamp - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_NOTE_ACCOUNTS = ` - query getNoteAccount($address: String!) { - noteAccounts(where: { address: $address }) { - id - index - address - encryptedAccount - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_ECHO_EVENTS = ` - query getNoteAccounts($first: Int, $fromBlock: Int) { - noteAccounts(first: $first, orderBy: blockNumber, orderDirection: asc, where: { blockNumber_gte: $fromBlock }) { - id - blockNumber - address - encryptedAccount - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_ENCRYPTED_NOTES = ` - query getEncryptedNotes($first: Int, $fromBlock: Int) { - encryptedNotes(first: $first, orderBy: blockNumber, orderDirection: asc, where: { blockNumber_gte: $fromBlock }) { - blockNumber - index - transactionHash - encryptedNote - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_GOVERNANCE_EVENTS = ` - query getGovernanceEvents($first: Int, $fromBlock: Int) { - proposals(first: $first, orderBy: blockNumber, orderDirection: asc, where: { blockNumber_gte: $fromBlock }) { - blockNumber - logIndex - transactionHash - proposalId - proposer - target - startTime - endTime - description - } - votes(first: $first, orderBy: blockNumber, orderDirection: asc, where: { blockNumber_gte: $fromBlock }) { - blockNumber - logIndex - transactionHash - proposalId - voter - support - votes - from - input - } - delegates(first: $first, orderBy: blockNumber, orderDirection: asc, where: { blockNumber_gte: $fromBlock }) { - blockNumber - logIndex - transactionHash - account - delegateTo - } - undelegates(first: $first, orderBy: blockNumber, orderDirection: asc, where: { blockNumber_gte: $fromBlock }) { - blockNumber - logIndex - transactionHash - account - delegateFrom - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_GOVERNANCE_APY = ` - stakeDailyBurns(first: 30, orderBy: date, orderDirection: desc) { - id - date - dailyAmountBurned - } -`; - -var __defProp$3 = Object.defineProperty; -var __defProps$2 = Object.defineProperties; -var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors; -var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols; -var __hasOwnProp$3 = Object.prototype.hasOwnProperty; -var __propIsEnum$3 = Object.prototype.propertyIsEnumerable; -var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __spreadValues$3 = (a, b) => { - for (var prop in b || (b = {})) - if (__hasOwnProp$3.call(b, prop)) - __defNormalProp$3(a, prop, b[prop]); - if (__getOwnPropSymbols$3) - for (var prop of __getOwnPropSymbols$3(b)) { - if (__propIsEnum$3.call(b, prop)) - __defNormalProp$3(a, prop, b[prop]); - } - return a; -}; -var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b)); -var __async$a = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; -const isEmptyArray = (arr) => !Array.isArray(arr) || !arr.length; -const GRAPHQL_LIMIT = 1e3; -function queryGraph(_0) { - return __async$a(this, arguments, function* ({ - graphApi, - subgraphName, - query, - variables, - fetchDataOptions: fetchDataOptions2 - }) { - var _a; - const graphUrl = `${graphApi}/subgraphs/name/${subgraphName}`; - const { data, errors } = yield fetchData(graphUrl, __spreadProps$2(__spreadValues$3({}, fetchDataOptions2), { - method: "POST", - headers: { - "Content-Type": "application/json" - }, - body: JSON.stringify({ - query, - variables - }) - })); - if (errors) { - throw new Error(JSON.stringify(errors)); - } - if ((_a = data == null ? void 0 : data._meta) == null ? void 0 : _a.hasIndexingErrors) { - throw new Error("Subgraph has indexing errors"); - } - return data; - }); -} -function getStatistic(_0) { - return __async$a(this, arguments, function* ({ - graphApi, - subgraphName, - currency, - amount, - fetchDataOptions: fetchDataOptions2 - }) { - try { - const { - deposits, - _meta: { - block: { number: lastSyncBlock } - } - } = yield queryGraph({ - graphApi, - subgraphName, - query: GET_STATISTIC, - variables: { - currency, - first: 10, - orderBy: "index", - orderDirection: "desc", - amount - }, - fetchDataOptions: fetchDataOptions2 - }); - const events = deposits.map((e) => ({ - timestamp: Number(e.timestamp), - leafIndex: Number(e.index), - blockNumber: Number(e.blockNumber) - })).reverse(); - const [lastEvent] = events.slice(-1); - return { - events, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock - }; - } catch (err) { - console.log("Error from getStatistic query"); - console.log(err); - return { - events: [], - lastSyncBlock: null - }; - } - }); -} -function getMeta(_0) { - return __async$a(this, arguments, function* ({ graphApi, subgraphName, fetchDataOptions: fetchDataOptions2 }) { - try { - const { - _meta: { - block: { number: lastSyncBlock }, - hasIndexingErrors - } - } = yield queryGraph({ - graphApi, - subgraphName, - query: _META, - fetchDataOptions: fetchDataOptions2 - }); - return { - lastSyncBlock, - hasIndexingErrors - }; - } catch (err) { - console.log("Error from getMeta query"); - console.log(err); - return { - lastSyncBlock: null, - hasIndexingErrors: null - }; - } - }); -} -function getRegisters({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2 -}) { - return queryGraph({ - graphApi, - subgraphName, - query: GET_REGISTERED, - variables: { - first: GRAPHQL_LIMIT, - fromBlock - }, - fetchDataOptions: fetchDataOptions2 - }); -} -function getAllRegisters(_0) { - return __async$a(this, arguments, function* ({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2, - onProgress - }) { - try { - const events = []; - let lastSyncBlock = fromBlock; - while (true) { - let { - relayers: result2, - _meta: { - // eslint-disable-next-line prefer-const - block: { number: currentBlock } - } - } = yield getRegisters({ graphApi, subgraphName, fromBlock, fetchDataOptions: fetchDataOptions2 }); - lastSyncBlock = currentBlock; - if (isEmptyArray(result2)) { - break; - } - const [firstEvent] = result2; - const [lastEvent] = result2.slice(-1); - if (typeof onProgress === "function") { - onProgress({ - type: "Registers", - fromBlock: Number(firstEvent.blockRegistration), - toBlock: Number(lastEvent.blockRegistration), - count: result2.length - }); - } - if (result2.length < 900) { - events.push(...result2); - break; - } - result2 = result2.filter(({ blockRegistration }) => blockRegistration !== lastEvent.blockRegistration); - fromBlock = Number(lastEvent.blockRegistration); - events.push(...result2); - } - if (!events.length) { - return { - events: [], - lastSyncBlock - }; - } - const result = events.map(({ id, address, ensName, blockRegistration }) => { - const [transactionHash, logIndex] = id.split("-"); - return { - blockNumber: Number(blockRegistration), - logIndex: Number(logIndex), - transactionHash, - ensName, - relayerAddress: getAddress(address) - }; - }); - return { - events: result, - lastSyncBlock - }; - } catch (err) { - console.log("Error from getAllRegisters query"); - console.log(err); - return { events: [], lastSyncBlock: fromBlock }; - } - }); -} -function getDeposits({ - graphApi, - subgraphName, - currency, - amount, - fromBlock, - fetchDataOptions: fetchDataOptions2 -}) { - return queryGraph({ - graphApi, - subgraphName, - query: GET_DEPOSITS, - variables: { - currency, - amount, - first: GRAPHQL_LIMIT, - fromBlock - }, - fetchDataOptions: fetchDataOptions2 - }); -} -function getAllDeposits(_0) { - return __async$a(this, arguments, function* ({ - graphApi, - subgraphName, - currency, - amount, - fromBlock, - fetchDataOptions: fetchDataOptions2, - onProgress - }) { - try { - const events = []; - let lastSyncBlock = fromBlock; - while (true) { - let { - deposits: result2, - _meta: { - // eslint-disable-next-line prefer-const - block: { number: currentBlock } - } - } = yield getDeposits({ graphApi, subgraphName, currency, amount, fromBlock, fetchDataOptions: fetchDataOptions2 }); - lastSyncBlock = currentBlock; - if (isEmptyArray(result2)) { - break; - } - const [firstEvent] = result2; - const [lastEvent2] = result2.slice(-1); - if (typeof onProgress === "function") { - onProgress({ - type: "Deposits", - fromBlock: Number(firstEvent.blockNumber), - toBlock: Number(lastEvent2.blockNumber), - count: result2.length - }); - } - if (result2.length < 900) { - events.push(...result2); - break; - } - result2 = result2.filter(({ blockNumber }) => blockNumber !== lastEvent2.blockNumber); - fromBlock = Number(lastEvent2.blockNumber); - events.push(...result2); - } - if (!events.length) { - return { - events: [], - lastSyncBlock - }; - } - const result = events.map(({ id, blockNumber, commitment, index, timestamp, from }) => { - const [transactionHash, logIndex] = id.split("-"); - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - commitment, - leafIndex: Number(index), - timestamp: Number(timestamp), - from: getAddress(from) - }; - }); - const [lastEvent] = result.slice(-1); - return { - events: result, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock - }; - } catch (err) { - console.log("Error from getAllDeposits query"); - console.log(err); - return { - events: [], - lastSyncBlock: fromBlock - }; - } - }); -} -function getWithdrawals({ - graphApi, - subgraphName, - currency, - amount, - fromBlock, - fetchDataOptions: fetchDataOptions2 -}) { - return queryGraph({ - graphApi, - subgraphName, - query: GET_WITHDRAWALS, - variables: { - currency, - amount, - first: GRAPHQL_LIMIT, - fromBlock - }, - fetchDataOptions: fetchDataOptions2 - }); -} -function getAllWithdrawals(_0) { - return __async$a(this, arguments, function* ({ - graphApi, - subgraphName, - currency, - amount, - fromBlock, - fetchDataOptions: fetchDataOptions2, - onProgress - }) { - try { - const events = []; - let lastSyncBlock = fromBlock; - while (true) { - let { - withdrawals: result2, - _meta: { - // eslint-disable-next-line prefer-const - block: { number: currentBlock } - } - } = yield getWithdrawals({ graphApi, subgraphName, currency, amount, fromBlock, fetchDataOptions: fetchDataOptions2 }); - lastSyncBlock = currentBlock; - if (isEmptyArray(result2)) { - break; - } - const [firstEvent] = result2; - const [lastEvent2] = result2.slice(-1); - if (typeof onProgress === "function") { - onProgress({ - type: "Withdrawals", - fromBlock: Number(firstEvent.blockNumber), - toBlock: Number(lastEvent2.blockNumber), - count: result2.length - }); - } - if (result2.length < 900) { - events.push(...result2); - break; - } - result2 = result2.filter(({ blockNumber }) => blockNumber !== lastEvent2.blockNumber); - fromBlock = Number(lastEvent2.blockNumber); - events.push(...result2); - } - if (!events.length) { - return { - events: [], - lastSyncBlock - }; - } - const result = events.map(({ id, blockNumber, nullifier, to, fee, timestamp }) => { - const [transactionHash, logIndex] = id.split("-"); - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - nullifierHash: nullifier, - to: getAddress(to), - fee, - timestamp: Number(timestamp) - }; - }); - const [lastEvent] = result.slice(-1); - return { - events: result, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock - }; - } catch (err) { - console.log("Error from getAllWithdrawals query"); - console.log(err); - return { - events: [], - lastSyncBlock: fromBlock - }; - } - }); -} -function getNoteAccounts(_0) { - return __async$a(this, arguments, function* ({ - graphApi, - subgraphName, - address, - fetchDataOptions: fetchDataOptions2 - }) { - try { - const { - noteAccounts: events, - _meta: { - block: { number: lastSyncBlock } - } - } = yield queryGraph({ - graphApi, - subgraphName, - query: GET_NOTE_ACCOUNTS, - variables: { - address: address.toLowerCase() - }, - fetchDataOptions: fetchDataOptions2 - }); - return { - events, - lastSyncBlock - }; - } catch (err) { - console.log("Error from getNoteAccounts query"); - console.log(err); - return { - events: [], - lastSyncBlock: null - }; - } - }); -} -function getGraphEchoEvents({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2 -}) { - return queryGraph({ - graphApi, - subgraphName, - query: GET_ECHO_EVENTS, - variables: { - first: GRAPHQL_LIMIT, - fromBlock - }, - fetchDataOptions: fetchDataOptions2 - }); -} -function getAllGraphEchoEvents(_0) { - return __async$a(this, arguments, function* ({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2, - onProgress - }) { - try { - const events = []; - let lastSyncBlock = fromBlock; - while (true) { - let { - noteAccounts: result2, - _meta: { - // eslint-disable-next-line prefer-const - block: { number: currentBlock } - } - } = yield getGraphEchoEvents({ graphApi, subgraphName, fromBlock, fetchDataOptions: fetchDataOptions2 }); - lastSyncBlock = currentBlock; - if (isEmptyArray(result2)) { - break; - } - const [firstEvent] = result2; - const [lastEvent2] = result2.slice(-1); - if (typeof onProgress === "function") { - onProgress({ - type: "EchoEvents", - fromBlock: Number(firstEvent.blockNumber), - toBlock: Number(lastEvent2.blockNumber), - count: result2.length - }); - } - if (result2.length < 900) { - events.push(...result2); - break; - } - result2 = result2.filter(({ blockNumber }) => blockNumber !== lastEvent2.blockNumber); - fromBlock = Number(lastEvent2.blockNumber); - events.push(...result2); - } - if (!events.length) { - return { - events: [], - lastSyncBlock - }; - } - const result = events.map((e) => { - const [transactionHash, logIndex] = e.id.split("-"); - return { - blockNumber: Number(e.blockNumber), - logIndex: Number(logIndex), - transactionHash, - address: getAddress(e.address), - encryptedAccount: e.encryptedAccount - }; - }); - const [lastEvent] = result.slice(-1); - return { - events: result, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock - }; - } catch (err) { - console.log("Error from getAllGraphEchoEvents query"); - console.log(err); - return { - events: [], - lastSyncBlock: fromBlock - }; - } - }); -} -function getEncryptedNotes({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2 -}) { - return queryGraph({ - graphApi, - subgraphName, - query: GET_ENCRYPTED_NOTES, - variables: { - first: GRAPHQL_LIMIT, - fromBlock - }, - fetchDataOptions: fetchDataOptions2 - }); -} -function getAllEncryptedNotes(_0) { - return __async$a(this, arguments, function* ({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2, - onProgress - }) { - try { - const events = []; - let lastSyncBlock = fromBlock; - while (true) { - let { - encryptedNotes: result2, - _meta: { - // eslint-disable-next-line prefer-const - block: { number: currentBlock } - } - } = yield getEncryptedNotes({ graphApi, subgraphName, fromBlock, fetchDataOptions: fetchDataOptions2 }); - lastSyncBlock = currentBlock; - if (isEmptyArray(result2)) { - break; - } - const [firstEvent] = result2; - const [lastEvent2] = result2.slice(-1); - if (typeof onProgress === "function") { - onProgress({ - type: "EncryptedNotes", - fromBlock: Number(firstEvent.blockNumber), - toBlock: Number(lastEvent2.blockNumber), - count: result2.length - }); - } - if (result2.length < 900) { - events.push(...result2); - break; - } - result2 = result2.filter(({ blockNumber }) => blockNumber !== lastEvent2.blockNumber); - fromBlock = Number(lastEvent2.blockNumber); - events.push(...result2); - } - if (!events.length) { - return { - events: [], - lastSyncBlock - }; - } - const result = events.map((e) => ({ - blockNumber: Number(e.blockNumber), - logIndex: Number(e.index), - transactionHash: e.transactionHash, - encryptedNote: e.encryptedNote - })); - const [lastEvent] = result.slice(-1); - return { - events: result, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock - }; - } catch (err) { - console.log("Error from getAllEncryptedNotes query"); - console.log(err); - return { - events: [], - lastSyncBlock: fromBlock - }; - } - }); -} -function getGovernanceEvents({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2 -}) { - return queryGraph({ - graphApi, - subgraphName, - query: GET_GOVERNANCE_EVENTS, - variables: { - first: GRAPHQL_LIMIT, - fromBlock - }, - fetchDataOptions: fetchDataOptions2 - }); -} -function getAllGovernanceEvents(_0) { - return __async$a(this, arguments, function* ({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2, - onProgress - }) { - try { - const result = []; - let lastSyncBlock = fromBlock; - while (true) { - const { - proposals, - votes, - delegates, - undelegates, - _meta: { - block: { number: currentBlock } - } - } = yield getGovernanceEvents({ graphApi, subgraphName, fromBlock, fetchDataOptions: fetchDataOptions2 }); - lastSyncBlock = currentBlock; - const eventsLength = proposals.length + votes.length + delegates.length + undelegates.length; - if (eventsLength === 0) { - break; - } - const formattedProposals = proposals.map( - ({ blockNumber, logIndex, transactionHash, proposalId, proposer, target, startTime, endTime, description }) => { - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - event: "ProposalCreated", - id: Number(proposalId), - proposer: getAddress(proposer), - target: getAddress(target), - startTime: Number(startTime), - endTime: Number(endTime), - description - }; - } - ); - const formattedVotes = votes.map( - ({ blockNumber, logIndex, transactionHash, proposalId, voter, support, votes: votes2, from, input }) => { - if (!input || input.length > 2048) { - input = ""; - } - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - event: "Voted", - proposalId: Number(proposalId), - voter: getAddress(voter), - support, - votes: votes2, - from: getAddress(from), - input - }; - } - ); - const formattedDelegates = delegates.map( - ({ blockNumber, logIndex, transactionHash, account, delegateTo }) => { - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - event: "Delegated", - account: getAddress(account), - delegateTo: getAddress(delegateTo) - }; - } - ); - const formattedUndelegates = undelegates.map( - ({ blockNumber, logIndex, transactionHash, account, delegateFrom }) => { - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - event: "Undelegated", - account: getAddress(account), - delegateFrom: getAddress(delegateFrom) - }; - } - ); - let formattedEvents = [ - ...formattedProposals, - ...formattedVotes, - ...formattedDelegates, - ...formattedUndelegates - ].sort((a, b) => { - if (a.blockNumber === b.blockNumber) { - return a.logIndex - b.logIndex; - } - return a.blockNumber - b.blockNumber; - }); - if (eventsLength < 900) { - result.push(...formattedEvents); - break; - } - const [firstEvent] = formattedEvents; - const [lastEvent2] = formattedEvents.slice(-1); - if (typeof onProgress === "function") { - onProgress({ - type: "Governance Events", - fromBlock: Number(firstEvent.blockNumber), - toBlock: Number(lastEvent2.blockNumber), - count: eventsLength - }); - } - formattedEvents = formattedEvents.filter(({ blockNumber }) => blockNumber !== lastEvent2.blockNumber); - fromBlock = Number(lastEvent2.blockNumber); - result.push(...formattedEvents); - } - const [lastEvent] = result.slice(-1); - return { - events: result, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock - }; - } catch (err) { - console.log("Error from getAllGovernance query"); - console.log(err); - return { - events: [], - lastSyncBlock: fromBlock - }; - } - }); -} - -var graph = /*#__PURE__*/Object.freeze({ - __proto__: null, - GET_DEPOSITS: GET_DEPOSITS, - GET_ECHO_EVENTS: GET_ECHO_EVENTS, - GET_ENCRYPTED_NOTES: GET_ENCRYPTED_NOTES, - GET_GOVERNANCE_APY: GET_GOVERNANCE_APY, - GET_GOVERNANCE_EVENTS: GET_GOVERNANCE_EVENTS, - GET_NOTE_ACCOUNTS: GET_NOTE_ACCOUNTS, - GET_REGISTERED: GET_REGISTERED, - GET_STATISTIC: GET_STATISTIC, - GET_WITHDRAWALS: GET_WITHDRAWALS, - _META: _META, - getAllDeposits: getAllDeposits, - getAllEncryptedNotes: getAllEncryptedNotes, - getAllGovernanceEvents: getAllGovernanceEvents, - getAllGraphEchoEvents: getAllGraphEchoEvents, - getAllRegisters: getAllRegisters, - getAllWithdrawals: getAllWithdrawals, - getDeposits: getDeposits, - getEncryptedNotes: getEncryptedNotes, - getGovernanceEvents: getGovernanceEvents, - getGraphEchoEvents: getGraphEchoEvents, - getMeta: getMeta, - getNoteAccounts: getNoteAccounts, - getRegisters: getRegisters, - getStatistic: getStatistic, - getWithdrawals: getWithdrawals, - queryGraph: queryGraph -}); - -var __async$9 = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; -class BatchBlockService { - constructor({ - provider, - onProgress, - concurrencySize = 10, - batchSize = 10, - shouldRetry = true, - retryMax = 5, - retryOn = 500 - }) { - this.provider = provider; - this.onProgress = onProgress; - this.concurrencySize = concurrencySize; - this.batchSize = batchSize; - this.shouldRetry = shouldRetry; - this.retryMax = retryMax; - this.retryOn = retryOn; - } - getBlock(blockTag) { - return __async$9(this, null, function* () { - const blockObject = yield this.provider.getBlock(blockTag); - if (!blockObject) { - const errMsg = `No block for ${blockTag}`; - throw new Error(errMsg); - } - return blockObject; - }); - } - createBatchRequest(batchArray) { - return batchArray.map((blocks, index) => __async$9(this, null, function* () { - yield sleep(20 * index); - return (() => __async$9(this, null, function* () { - let retries = 0; - let err; - while (!this.shouldRetry && retries === 0 || this.shouldRetry && retries < this.retryMax) { - try { - return yield Promise.all(blocks.map((b) => this.getBlock(b))); - } catch (e) { - retries++; - err = e; - yield sleep(this.retryOn); - } - } - throw err; - }))(); - })); - } - getBatchBlocks(blocks) { - return __async$9(this, null, function* () { - let blockCount = 0; - const results = []; - for (const chunks of chunk(blocks, this.concurrencySize * this.batchSize)) { - const chunksResult = (yield Promise.all(this.createBatchRequest(chunk(chunks, this.batchSize)))).flat(); - results.push(...chunksResult); - blockCount += chunks.length; - if (typeof this.onProgress === "function") { - this.onProgress({ - percentage: blockCount / blocks.length, - currentIndex: blockCount, - totalIndex: blocks.length - }); - } - } - return results; - }); - } -} -class BatchTransactionService { - constructor({ - provider, - onProgress, - concurrencySize = 10, - batchSize = 10, - shouldRetry = true, - retryMax = 5, - retryOn = 500 - }) { - this.provider = provider; - this.onProgress = onProgress; - this.concurrencySize = concurrencySize; - this.batchSize = batchSize; - this.shouldRetry = shouldRetry; - this.retryMax = retryMax; - this.retryOn = retryOn; - } - getTransaction(txHash) { - return __async$9(this, null, function* () { - const txObject = yield this.provider.getTransaction(txHash); - if (!txObject) { - const errMsg = `No transaction for ${txHash}`; - throw new Error(errMsg); - } - return txObject; - }); - } - createBatchRequest(batchArray) { - return batchArray.map((txs, index) => __async$9(this, null, function* () { - yield sleep(20 * index); - return (() => __async$9(this, null, function* () { - let retries = 0; - let err; - while (!this.shouldRetry && retries === 0 || this.shouldRetry && retries < this.retryMax) { - try { - return yield Promise.all(txs.map((tx) => this.getTransaction(tx))); - } catch (e) { - retries++; - err = e; - yield sleep(this.retryOn); - } - } - throw err; - }))(); - })); - } - getBatchTransactions(txs) { - return __async$9(this, null, function* () { - let txCount = 0; - const results = []; - for (const chunks of chunk(txs, this.concurrencySize * this.batchSize)) { - const chunksResult = (yield Promise.all(this.createBatchRequest(chunk(chunks, this.batchSize)))).flat(); - results.push(...chunksResult); - txCount += chunks.length; - if (typeof this.onProgress === "function") { - this.onProgress({ percentage: txCount / txs.length, currentIndex: txCount, totalIndex: txs.length }); - } - } - return results; - }); - } -} -class BatchEventsService { - constructor({ - provider, - contract, - onProgress, - concurrencySize = 10, - blocksPerRequest = 2e3, - shouldRetry = true, - retryMax = 5, - retryOn = 500 - }) { - this.provider = provider; - this.contract = contract; - this.onProgress = onProgress; - this.concurrencySize = concurrencySize; - this.blocksPerRequest = blocksPerRequest; - this.shouldRetry = shouldRetry; - this.retryMax = retryMax; - this.retryOn = retryOn; - } - getPastEvents(_0) { - return __async$9(this, arguments, function* ({ fromBlock, toBlock, type }) { - let err; - let retries = 0; - while (!this.shouldRetry && retries === 0 || this.shouldRetry && retries < this.retryMax) { - try { - return yield this.contract.queryFilter(type, fromBlock, toBlock); - } catch (e) { - err = e; - retries++; - if (e.message.includes("after last accepted block")) { - const acceptedBlock = parseInt(e.message.split("after last accepted block ")[1]); - toBlock = acceptedBlock; - } - yield sleep(this.retryOn); - } - } - throw err; - }); - } - createBatchRequest(batchArray) { - return batchArray.map((event, index) => __async$9(this, null, function* () { - yield sleep(20 * index); - return this.getPastEvents(event); - })); - } - getBatchEvents(_0) { - return __async$9(this, arguments, function* ({ fromBlock, toBlock, type = "*" }) { - if (!toBlock) { - toBlock = yield this.provider.getBlockNumber(); - } - const eventsToSync = []; - for (let i = fromBlock; i < toBlock; i += this.blocksPerRequest) { - const j = i + this.blocksPerRequest - 1 > toBlock ? toBlock : i + this.blocksPerRequest - 1; - eventsToSync.push({ fromBlock: i, toBlock: j, type }); - } - const events = []; - const eventChunk = chunk(eventsToSync, this.concurrencySize); - let chunkCount = 0; - for (const chunk2 of eventChunk) { - chunkCount++; - const fetchedEvents = (yield Promise.all(this.createBatchRequest(chunk2))).flat(); - events.push(...fetchedEvents); - if (typeof this.onProgress === "function") { - this.onProgress({ - percentage: chunkCount / eventChunk.length, - type, - fromBlock: chunk2[0].fromBlock, - toBlock: chunk2[chunk2.length - 1].toBlock, - count: fetchedEvents.length - }); - } - } - return events; - }); - } -} - -var __defProp$2 = Object.defineProperty; -var __defProps$1 = Object.defineProperties; -var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors; -var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols; -var __getProtoOf = Object.getPrototypeOf; -var __hasOwnProp$2 = Object.prototype.hasOwnProperty; -var __propIsEnum$2 = Object.prototype.propertyIsEnumerable; -var __reflectGet = Reflect.get; -var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __spreadValues$2 = (a, b) => { - for (var prop in b || (b = {})) - if (__hasOwnProp$2.call(b, prop)) - __defNormalProp$2(a, prop, b[prop]); - if (__getOwnPropSymbols$2) - for (var prop of __getOwnPropSymbols$2(b)) { - if (__propIsEnum$2.call(b, prop)) - __defNormalProp$2(a, prop, b[prop]); - } - return a; -}; -var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b)); -var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj); -var __async$8 = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; -const DEPOSIT = "deposit"; -const WITHDRAWAL = "withdrawal"; -class BaseEventsService { - constructor({ - netId, - provider, - graphApi, - subgraphName, - contract, - type = "", - deployedBlock = 0, - fetchDataOptions: fetchDataOptions2 - }) { - this.netId = netId; - this.provider = provider; - this.graphApi = graphApi; - this.subgraphName = subgraphName; - this.fetchDataOptions = fetchDataOptions2; - this.contract = contract; - this.type = type; - this.deployedBlock = deployedBlock; - this.batchEventsService = new BatchEventsService({ - provider, - contract, - onProgress: this.updateEventProgress - }); - } - getInstanceName() { - return ""; - } - getType() { - return this.type || ""; - } - getGraphMethod() { - return ""; - } - getGraphParams() { - return { - graphApi: this.graphApi || "", - subgraphName: this.subgraphName || "", - fetchDataOptions: this.fetchDataOptions, - onProgress: this.updateGraphProgress - }; - } - /* eslint-disable @typescript-eslint/no-unused-vars */ - updateEventProgress({ percentage, type, fromBlock, toBlock, count }) { - } - updateBlockProgress({ percentage, currentIndex, totalIndex }) { - } - updateTransactionProgress({ percentage, currentIndex, totalIndex }) { - } - updateGraphProgress({ type, fromBlock, toBlock, count }) { - } - /* eslint-enable @typescript-eslint/no-unused-vars */ - formatEvents(events) { - return __async$8(this, null, function* () { - return yield new Promise((resolve) => resolve(events)); - }); - } - /** - * Get saved or cached events - */ - getEventsFromDB() { - return __async$8(this, null, function* () { - return { - events: [], - lastBlock: null - }; - }); - } - getEventsFromCache() { - return __async$8(this, null, function* () { - return { - events: [], - lastBlock: null - }; - }); - } - getSavedEvents() { - return __async$8(this, null, function* () { - let cachedEvents = yield this.getEventsFromDB(); - if (!cachedEvents || !cachedEvents.events.length) { - cachedEvents = yield this.getEventsFromCache(); - } - return cachedEvents; - }); - } - /** - * Get latest events - */ - getEventsFromGraph(_0) { - return __async$8(this, arguments, function* ({ - fromBlock, - methodName = "" - }) { - if (!this.graphApi || !this.subgraphName) { - return { - events: [], - lastBlock: fromBlock - }; - } - const { events, lastSyncBlock } = yield graph[methodName || this.getGraphMethod()](__spreadValues$2({ - fromBlock - }, this.getGraphParams())); - return { - events, - lastBlock: lastSyncBlock - }; - }); - } - getEventsFromRpc(_0) { - return __async$8(this, arguments, function* ({ - fromBlock, - toBlock - }) { - try { - if (!toBlock) { - toBlock = yield this.provider.getBlockNumber(); - } - if (fromBlock >= toBlock) { - return { - events: [], - lastBlock: toBlock - }; - } - this.updateEventProgress({ percentage: 0, type: this.getType() }); - const events = yield this.formatEvents( - yield this.batchEventsService.getBatchEvents({ fromBlock, toBlock, type: this.getType() }) - ); - if (!events.length) { - return { - events, - lastBlock: toBlock - }; - } - return { - events, - lastBlock: toBlock - }; - } catch (err) { - console.log(err); - return { - events: [], - lastBlock: fromBlock - }; - } - }); - } - getLatestEvents(_0) { - return __async$8(this, arguments, function* ({ fromBlock }) { - const allEvents = []; - const graphEvents = yield this.getEventsFromGraph({ fromBlock }); - const lastSyncBlock = graphEvents.lastBlock && graphEvents.lastBlock >= fromBlock ? graphEvents.lastBlock : fromBlock; - const rpcEvents = yield this.getEventsFromRpc({ fromBlock: lastSyncBlock }); - allEvents.push(...graphEvents.events); - allEvents.push(...rpcEvents.events); - const lastBlock = rpcEvents ? rpcEvents.lastBlock : allEvents[allEvents.length - 1] ? allEvents[allEvents.length - 1].blockNumber : fromBlock; - return { - events: allEvents, - lastBlock - }; - }); - } - // eslint-disable-next-line @typescript-eslint/no-unused-vars - validateEvents({ events, lastBlock }) { - } - /** - * Handle saving events - */ - // eslint-disable-next-line @typescript-eslint/no-unused-vars - saveEvents(_0) { - return __async$8(this, arguments, function* ({ events, lastBlock }) { - }); - } - /** - * Trigger saving and receiving latest events - */ - updateEvents() { - return __async$8(this, null, function* () { - const savedEvents = yield this.getSavedEvents(); - let fromBlock = this.deployedBlock; - if (savedEvents && savedEvents.lastBlock) { - fromBlock = savedEvents.lastBlock + 1; - } - const newEvents = yield this.getLatestEvents({ fromBlock }); - const eventSet = /* @__PURE__ */ new Set(); - let allEvents = []; - allEvents.push(...savedEvents.events); - allEvents.push(...newEvents.events); - allEvents = allEvents.sort((a, b) => { - if (a.blockNumber === b.blockNumber) { - return a.logIndex - b.logIndex; - } - return a.blockNumber - b.blockNumber; - }).filter(({ transactionHash, logIndex }) => { - const eventKey = `${transactionHash}_${logIndex}`; - const hasEvent = eventSet.has(eventKey); - eventSet.add(eventKey); - return !hasEvent; - }); - const lastBlock = newEvents ? newEvents.lastBlock : allEvents[allEvents.length - 1] ? allEvents[allEvents.length - 1].blockNumber : null; - this.validateEvents({ events: allEvents, lastBlock }); - this.saveEventsPromise = this.saveEvents({ events: allEvents, lastBlock }); - return { - events: allEvents, - lastBlock - }; - }); - } -} -class BaseTornadoService extends BaseEventsService { - constructor({ - netId, - provider, - graphApi, - subgraphName, - Tornado, - type, - amount, - currency, - deployedBlock, - fetchDataOptions: fetchDataOptions2 - }) { - super({ netId, provider, graphApi, subgraphName, contract: Tornado, type, deployedBlock, fetchDataOptions: fetchDataOptions2 }); - this.amount = amount; - this.currency = currency; - this.batchTransactionService = new BatchTransactionService({ - provider, - onProgress: this.updateTransactionProgress - }); - this.batchBlockService = new BatchBlockService({ - provider, - onProgress: this.updateBlockProgress - }); - } - getInstanceName() { - return `${this.getType().toLowerCase()}s_${this.netId}_${this.currency}_${this.amount}`; - } - getGraphMethod() { - return `getAll${this.getType()}s`; - } - getGraphParams() { - return { - graphApi: this.graphApi || "", - subgraphName: this.subgraphName || "", - amount: this.amount, - currency: this.currency, - fetchDataOptions: this.fetchDataOptions, - onProgress: this.updateGraphProgress - }; - } - formatEvents(events) { - return __async$8(this, null, function* () { - const type = this.getType().toLowerCase(); - if (type === DEPOSIT) { - const formattedEvents = events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { - const { commitment, leafIndex, timestamp } = args; - return { - blockNumber, - logIndex, - transactionHash, - commitment, - leafIndex: Number(leafIndex), - timestamp: Number(timestamp) - }; - }); - const txs = yield this.batchTransactionService.getBatchTransactions([ - ...new Set(formattedEvents.map(({ transactionHash }) => transactionHash)) - ]); - return formattedEvents.map((event) => { - const { from } = txs.find(({ hash }) => hash === event.transactionHash); - return __spreadProps$1(__spreadValues$2({}, event), { - from - }); - }); - } else { - const formattedEvents = events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { - const { nullifierHash, to, fee } = args; - return { - blockNumber, - logIndex, - transactionHash, - nullifierHash: String(nullifierHash), - to: getAddress(to), - fee: String(fee) - }; - }); - const blocks = yield this.batchBlockService.getBatchBlocks([ - ...new Set(formattedEvents.map(({ blockNumber }) => blockNumber)) - ]); - return formattedEvents.map((event) => { - const { timestamp } = blocks.find(({ number }) => number === event.blockNumber); - return __spreadProps$1(__spreadValues$2({}, event), { - timestamp - }); - }); - } - }); - } - validateEvents({ events }) { - if (events.length && this.getType().toLowerCase() === DEPOSIT) { - const lastEvent = events[events.length - 1]; - if (lastEvent.leafIndex !== events.length - 1) { - const errMsg = `Deposit events invalid wants ${events.length - 1} leafIndex have ${lastEvent.leafIndex}`; - throw new Error(errMsg); - } - } - } -} -class BaseEchoService extends BaseEventsService { - constructor({ - netId, - provider, - graphApi, - subgraphName, - Echoer, - deployedBlock, - fetchDataOptions: fetchDataOptions2 - }) { - super({ netId, provider, graphApi, subgraphName, contract: Echoer, deployedBlock, fetchDataOptions: fetchDataOptions2 }); - } - getInstanceName() { - return `echo_${this.netId}`; - } - getType() { - return "Echo"; - } - getGraphMethod() { - return "getAllGraphEchoEvents"; - } - formatEvents(events) { - return __async$8(this, null, function* () { - return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { - const { who, data } = args; - if (who && data) { - const eventObjects = { - blockNumber, - logIndex, - transactionHash - }; - return __spreadProps$1(__spreadValues$2({}, eventObjects), { - address: who, - encryptedAccount: data - }); - } - }).filter((e) => e); - }); - } - getEventsFromGraph(_0) { - return __async$8(this, arguments, function* ({ fromBlock }) { - if (!this.graphApi || this.graphApi.includes("api.thegraph.com")) { - return { - events: [], - lastBlock: fromBlock - }; - } - return __superGet(BaseEchoService.prototype, this, "getEventsFromGraph").call(this, { fromBlock }); - }); - } -} -class BaseEncryptedNotesService extends BaseEventsService { - constructor({ - netId, - provider, - graphApi, - subgraphName, - Router, - deployedBlock, - fetchDataOptions: fetchDataOptions2 - }) { - super({ netId, provider, graphApi, subgraphName, contract: Router, deployedBlock, fetchDataOptions: fetchDataOptions2 }); - } - getInstanceName() { - return `encrypted_notes_${this.netId}`; - } - getType() { - return "EncryptedNote"; - } - getGraphMethod() { - return "getAllEncryptedNotes"; - } - formatEvents(events) { - return __async$8(this, null, function* () { - return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { - const { encryptedNote } = args; - if (encryptedNote) { - const eventObjects = { - blockNumber, - logIndex, - transactionHash - }; - return __spreadProps$1(__spreadValues$2({}, eventObjects), { - encryptedNote - }); - } - }).filter((e) => e); - }); - } -} -class BaseGovernanceService extends BaseEventsService { - constructor({ - netId, - provider, - graphApi, - subgraphName, - Governance, - deployedBlock, - fetchDataOptions: fetchDataOptions2 - }) { - super({ netId, provider, graphApi, subgraphName, contract: Governance, deployedBlock, fetchDataOptions: fetchDataOptions2 }); - this.batchTransactionService = new BatchTransactionService({ - provider, - onProgress: this.updateTransactionProgress - }); - } - getInstanceName() { - return `governance_${this.netId}`; - } - getType() { - return "*"; - } - getGraphMethod() { - return "getAllGovernanceEvents"; - } - formatEvents(events) { - return __async$8(this, null, function* () { - const proposalEvents = []; - const votedEvents = []; - const delegatedEvents = []; - const undelegatedEvents = []; - events.forEach(({ blockNumber, index: logIndex, transactionHash, args, eventName: event }) => { - const eventObjects = { - blockNumber, - logIndex, - transactionHash, - event - }; - if (event === "ProposalCreated") { - const { id, proposer, target, startTime, endTime, description } = args; - proposalEvents.push(__spreadProps$1(__spreadValues$2({}, eventObjects), { - id: Number(id), - proposer, - target, - startTime: Number(startTime), - endTime: Number(endTime), - description - })); - } - if (event === "Voted") { - const { proposalId, voter, support, votes } = args; - votedEvents.push(__spreadProps$1(__spreadValues$2({}, eventObjects), { - proposalId: Number(proposalId), - voter, - support, - votes, - from: "", - input: "" - })); - } - if (event === "Delegated") { - const { account, to: delegateTo } = args; - delegatedEvents.push(__spreadProps$1(__spreadValues$2({}, eventObjects), { - account, - delegateTo - })); - } - if (event === "Undelegated") { - const { account, from: delegateFrom } = args; - undelegatedEvents.push(__spreadProps$1(__spreadValues$2({}, eventObjects), { - account, - delegateFrom - })); - } - }); - if (votedEvents.length) { - this.updateTransactionProgress({ percentage: 0 }); - const txs = yield this.batchTransactionService.getBatchTransactions([ - ...new Set(votedEvents.map(({ transactionHash }) => transactionHash)) - ]); - votedEvents.forEach((event, index) => { - let { data: input, from } = txs.find((t) => t.hash === event.transactionHash); - if (!input || input.length > 2048) { - input = ""; - } - votedEvents[index].from = from; - votedEvents[index].input = input; - }); - } - return [...proposalEvents, ...votedEvents, ...delegatedEvents, ...undelegatedEvents]; - }); - } - getEventsFromGraph(_0) { - return __async$8(this, arguments, function* ({ fromBlock }) { - if (!this.graphApi || !this.subgraphName || this.graphApi.includes("api.thegraph.com")) { - return { - events: [], - lastBlock: fromBlock - }; - } - return __superGet(BaseGovernanceService.prototype, this, "getEventsFromGraph").call(this, { fromBlock }); - }); - } -} -class BaseRegistryService extends BaseEventsService { - constructor({ - netId, - provider, - graphApi, - subgraphName, - RelayerRegistry, - deployedBlock, - fetchDataOptions: fetchDataOptions2 - }) { - super({ netId, provider, graphApi, subgraphName, contract: RelayerRegistry, deployedBlock, fetchDataOptions: fetchDataOptions2 }); - } - getInstanceName() { - return `registered_${this.netId}`; - } - // Name of type used for events - getType() { - return "RelayerRegistered"; - } - // Name of method used for graph - getGraphMethod() { - return "getAllRegisters"; - } - formatEvents(events) { - return __async$8(this, null, function* () { - return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { - const eventObjects = { - blockNumber, - logIndex, - transactionHash - }; - return __spreadProps$1(__spreadValues$2({}, eventObjects), { - ensName: args.ensName, - relayerAddress: args.relayerAddress - }); - }); - }); - } - fetchRelayers() { - return __async$8(this, null, function* () { - return (yield this.updateEvents()).events; - }); - } -} - -var __defProp$1 = Object.defineProperty; -var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols; -var __hasOwnProp$1 = Object.prototype.hasOwnProperty; -var __propIsEnum$1 = Object.prototype.propertyIsEnumerable; -var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __spreadValues$1 = (a, b) => { - for (var prop in b || (b = {})) - if (__hasOwnProp$1.call(b, prop)) - __defNormalProp$1(a, prop, b[prop]); - if (__getOwnPropSymbols$1) - for (var prop of __getOwnPropSymbols$1(b)) { - if (__propIsEnum$1.call(b, prop)) - __defNormalProp$1(a, prop, b[prop]); - } - return a; -}; -var NetId = /* @__PURE__ */ ((NetId2) => { - NetId2[NetId2["MAINNET"] = 1] = "MAINNET"; - NetId2[NetId2["BSC"] = 56] = "BSC"; - NetId2[NetId2["POLYGON"] = 137] = "POLYGON"; - NetId2[NetId2["OPTIMISM"] = 10] = "OPTIMISM"; - NetId2[NetId2["ARBITRUM"] = 42161] = "ARBITRUM"; - NetId2[NetId2["GNOSIS"] = 100] = "GNOSIS"; - NetId2[NetId2["AVALANCHE"] = 43114] = "AVALANCHE"; - NetId2[NetId2["SEPOLIA"] = 11155111] = "SEPOLIA"; - return NetId2; -})(NetId || {}); -const theGraph = { - name: "Hosted Graph", - url: "https://api.thegraph.com" -}; -const tornado = { - name: "Tornado Subgraphs", - url: "https://tornadocash-rpc.com" -}; -const defaultConfig = { - [1 /* MAINNET */]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 80, - fast: 50, - standard: 25, - low: 8 - }, - nativeCurrency: "eth", - currencyName: "ETH", - explorerUrl: "https://etherscan.io", - merkleTreeHeight: 20, - emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", - networkName: "Ethereum Mainnet", - deployedBlock: 9116966, - rpcUrls: { - tornadoRPC: { - name: "Tornado RPC", - url: "https://tornadocash-rpc.com/mainnet" - }, - chainnodes: { - name: "Chainnodes RPC", - url: "https://mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607" - }, - mevblockerRPC: { - name: "MevblockerRPC", - url: "https://rpc.mevblocker.io" - }, - oneRPC: { - name: "1RPC", - url: "https://1rpc.io/eth" - } - }, - multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", - routerContract: "0xd90e2f925DA726b50C4Ed8D0Fb90Ad053324F31b", - echoContract: "0x9B27DD5Bb15d42DC224FCD0B7caEbBe16161Df42", - offchainOracleContract: "0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8", - tornContract: "0x77777FeDdddFfC19Ff86DB637967013e6C6A116C", - governanceContract: "0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce", - stakingRewardsContract: "0x5B3f656C80E8ddb9ec01Dd9018815576E9238c29", - registryContract: "0x58E8dCC13BE9780fC42E8723D8EaD4CF46943dF2", - aggregatorContract: "0xE8F47A78A6D52D317D0D2FFFac56739fE14D1b49", - reverseRecordsContract: "0x3671aE578E63FdF66ad4F3E12CC0c0d71Ac7510C", - tornadoSubgraph: "tornadocash/mainnet-tornado-subgraph", - registrySubgraph: "tornadocash/tornado-relayer-registry", - governanceSubgraph: "tornadocash/tornado-governance", - subgraphs: { - tornado, - theGraph - }, - tokens: { - eth: { - instanceAddress: { - "0.1": "0x12D66f87A04A9E220743712cE6d9bB1B5616B8Fc", - "1": "0x47CE0C6eD5B0Ce3d3A51fdb1C52DC66a7c3c2936", - "10": "0x910Cbd523D972eb0a6f4cAe4618aD62622b39DbF", - "100": "0xA160cdAB225685dA1d56aa342Ad8841c3b53f291" - }, - symbol: "ETH", - decimals: 18 - }, - dai: { - instanceAddress: { - "100": "0xD4B88Df4D29F5CedD6857912842cff3b20C8Cfa3", - "1000": "0xFD8610d20aA15b7B2E3Be39B396a1bC3516c7144", - "10000": "0x07687e702b410Fa43f4cB4Af7FA097918ffD2730", - "100000": "0x23773E65ed146A459791799d01336DB287f25334" - }, - tokenAddress: "0x6B175474E89094C44Da98b954EedeAC495271d0F", - tokenGasLimit: 7e4, - symbol: "DAI", - decimals: 18, - gasLimit: 7e5 - }, - cdai: { - instanceAddress: { - "5000": "0x22aaA7720ddd5388A3c0A3333430953C68f1849b", - "50000": "0x03893a7c7463AE47D46bc7f091665f1893656003", - "500000": "0x2717c5e28cf931547B621a5dddb772Ab6A35B701", - "5000000": "0xD21be7248e0197Ee08E0c20D4a96DEBdaC3D20Af" - }, - tokenAddress: "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643", - tokenGasLimit: 2e5, - symbol: "cDAI", - decimals: 8, - gasLimit: 7e5 - }, - usdc: { - instanceAddress: { - "100": "0xd96f2B1c14Db8458374d9Aca76E26c3D18364307", - "1000": "0x4736dCf1b7A3d580672CcE6E7c65cd5cc9cFBa9D" - }, - tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - tokenGasLimit: 7e4, - symbol: "USDC", - decimals: 6, - gasLimit: 7e5 - }, - usdt: { - instanceAddress: { - "100": "0x169AD27A470D064DEDE56a2D3ff727986b15D52B", - "1000": "0x0836222F2B2B24A3F36f98668Ed8F0B38D1a872f" - }, - tokenAddress: "0xdAC17F958D2ee523a2206206994597C13D831ec7", - tokenGasLimit: 7e4, - symbol: "USDT", - decimals: 6, - gasLimit: 7e5 - }, - wbtc: { - instanceAddress: { - "0.1": "0x178169B423a011fff22B9e3F3abeA13414dDD0F1", - "1": "0x610B717796ad172B316836AC95a2ffad065CeaB4", - "10": "0xbB93e510BbCD0B7beb5A853875f9eC60275CF498" - }, - tokenAddress: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", - tokenGasLimit: 7e4, - symbol: "WBTC", - decimals: 8, - gasLimit: 7e5 - } - }, - relayerEnsSubdomain: "mainnet-tornado", - pollInterval: 15, - constants: { - GOVERNANCE_BLOCK: 11474695, - NOTE_ACCOUNT_BLOCK: 11842486, - ENCRYPTED_NOTES_BLOCK: 12143762, - REGISTRY_BLOCK: 14173129, - MINING_BLOCK_TIME: 15 - } - }, - [56 /* BSC */]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 5, - fast: 5, - standard: 5, - low: 5 - }, - nativeCurrency: "bnb", - currencyName: "BNB", - explorerUrl: "https://bscscan.com", - merkleTreeHeight: 20, - emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", - networkName: "Binance Smart Chain", - deployedBlock: 8158799, - multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", - routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", - echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", - offchainOracleContract: "0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8", - tornadoSubgraph: "tornadocash/bsc-tornado-subgraph", - subgraphs: { - tornado, - theGraph - }, - rpcUrls: { - tornadoRPC: { - name: "Tornado RPC", - url: "https://tornadocash-rpc.com/bsc" - }, - chainnodes: { - name: "Chainnodes RPC", - url: "https://bsc-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607" - }, - oneRPC: { - name: "1RPC", - url: "https://1rpc.io/bnb" - } - }, - tokens: { - bnb: { - instanceAddress: { - "0.1": "0x84443CFd09A48AF6eF360C6976C5392aC5023a1F", - "1": "0xd47438C816c9E7f2E2888E060936a499Af9582b3", - "10": "0x330bdFADE01eE9bF63C209Ee33102DD334618e0a", - "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD" - }, - symbol: "BNB", - decimals: 18 - } - }, - relayerEnsSubdomain: "bsc-tornado", - pollInterval: 10, - constants: { - NOTE_ACCOUNT_BLOCK: 8159269, - ENCRYPTED_NOTES_BLOCK: 8159269 - } - }, - [137 /* POLYGON */]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 100, - fast: 75, - standard: 50, - low: 30 - }, - nativeCurrency: "matic", - currencyName: "MATIC", - explorerUrl: "https://polygonscan.com", - merkleTreeHeight: 20, - emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", - networkName: "Polygon (Matic) Network", - deployedBlock: 16257962, - multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", - routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", - echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", - offchainOracleContract: "0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8", - gasPriceOracleContract: "0xF81A8D8D3581985D3969fe53bFA67074aDFa8F3C", - tornadoSubgraph: "tornadocash/matic-tornado-subgraph", - subgraphs: { - tornado, - theGraph - }, - rpcUrls: { - chainnodes: { - name: "Chainnodes RPC", - url: "https://polygon-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607" - }, - oneRpc: { - name: "1RPC", - url: "https://1rpc.io/matic" - } - }, - tokens: { - matic: { - instanceAddress: { - "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD", - "1000": "0xdf231d99Ff8b6c6CBF4E9B9a945CBAcEF9339178", - "10000": "0xaf4c0B70B2Ea9FB7487C7CbB37aDa259579fe040", - "100000": "0xa5C2254e4253490C54cef0a4347fddb8f75A4998" - }, - symbol: "MATIC", - decimals: 18 - } - }, - relayerEnsSubdomain: "polygon-tornado", - pollInterval: 10, - constants: { - NOTE_ACCOUNT_BLOCK: 16257996, - ENCRYPTED_NOTES_BLOCK: 16257996 - } - }, - [10 /* OPTIMISM */]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 1e-3, - fast: 1e-3, - standard: 1e-3, - low: 1e-3 - }, - nativeCurrency: "eth", - currencyName: "ETH", - explorerUrl: "https://optimistic.etherscan.io", - merkleTreeHeight: 20, - emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", - networkName: "Optimism", - deployedBlock: 2243689, - multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", - routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", - echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", - offchainOracleContract: "0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8", - ovmGasPriceOracleContract: "0x420000000000000000000000000000000000000F", - tornadoSubgraph: "tornadocash/optimism-tornado-subgraph", - subgraphs: { - tornado, - theGraph - }, - rpcUrls: { - tornadoRPC: { - name: "Tornado RPC", - url: "https://tornadocash-rpc.com/op" - }, - chainnodes: { - name: "Chainnodes RPC", - url: "https://optimism-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607" - }, - oneRpc: { - name: "1RPC", - url: "https://1rpc.io/op" - } - }, - tokens: { - eth: { - instanceAddress: { - "0.1": "0x84443CFd09A48AF6eF360C6976C5392aC5023a1F", - "1": "0xd47438C816c9E7f2E2888E060936a499Af9582b3", - "10": "0x330bdFADE01eE9bF63C209Ee33102DD334618e0a", - "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD" - }, - symbol: "ETH", - decimals: 18 - } - }, - relayerEnsSubdomain: "optimism-tornado", - pollInterval: 15, - constants: { - NOTE_ACCOUNT_BLOCK: 2243694, - ENCRYPTED_NOTES_BLOCK: 2243694 - } - }, - [42161 /* ARBITRUM */]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 4, - fast: 3, - standard: 2.52, - low: 2.29 - }, - nativeCurrency: "eth", - currencyName: "ETH", - explorerUrl: "https://arbiscan.io", - merkleTreeHeight: 20, - emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", - networkName: "Arbitrum One", - deployedBlock: 3430648, - multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", - routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", - echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", - offchainOracleContract: "0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8", - tornadoSubgraph: "tornadocash/arbitrum-tornado-subgraph", - subgraphs: { - tornado, - theGraph - }, - rpcUrls: { - tornadoRPC: { - name: "Tornado RPC", - url: "https://tornadocash-rpc.com/arbitrum" - }, - chainnodes: { - name: "Chainnodes RPC", - url: "https://arbitrum-one.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607" - }, - oneRpc: { - name: "1rpc", - url: "https://1rpc.io/arb" - }, - Arbitrum: { - name: "Arbitrum RPC", - url: "https://arb1.arbitrum.io/rpc" - } - }, - tokens: { - eth: { - instanceAddress: { - "0.1": "0x84443CFd09A48AF6eF360C6976C5392aC5023a1F", - "1": "0xd47438C816c9E7f2E2888E060936a499Af9582b3", - "10": "0x330bdFADE01eE9bF63C209Ee33102DD334618e0a", - "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD" - }, - symbol: "ETH", - decimals: 18 - } - }, - relayerEnsSubdomain: "arbitrum-tornado", - pollInterval: 15, - constants: { - NOTE_ACCOUNT_BLOCK: 3430605, - ENCRYPTED_NOTES_BLOCK: 3430605 - } - }, - [100 /* GNOSIS */]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 6, - fast: 5, - standard: 4, - low: 1 - }, - nativeCurrency: "xdai", - currencyName: "xDAI", - explorerUrl: "https://gnosisscan.io", - merkleTreeHeight: 20, - emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", - networkName: "Gnosis Chain", - deployedBlock: 17754561, - multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", - routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", - echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", - offchainOracleContract: "0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8", - tornadoSubgraph: "tornadocash/xdai-tornado-subgraph", - subgraphs: { - tornado, - theGraph - }, - rpcUrls: { - tornadoRPC: { - name: "Tornado RPC", - url: "https://tornadocash-rpc.com/gnosis" - }, - chainnodes: { - name: "Chainnodes RPC", - url: "https://gnosis-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607" - }, - blockPi: { - name: "BlockPi", - url: "https://gnosis.blockpi.network/v1/rpc/public" - } - }, - tokens: { - xdai: { - instanceAddress: { - "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD", - "1000": "0xdf231d99Ff8b6c6CBF4E9B9a945CBAcEF9339178", - "10000": "0xaf4c0B70B2Ea9FB7487C7CbB37aDa259579fe040", - "100000": "0xa5C2254e4253490C54cef0a4347fddb8f75A4998" - }, - symbol: "xDAI", - decimals: 18 - } - }, - relayerEnsSubdomain: "gnosis-tornado", - pollInterval: 15, - constants: { - NOTE_ACCOUNT_BLOCK: 17754564, - ENCRYPTED_NOTES_BLOCK: 17754564 - } - }, - [43114 /* AVALANCHE */]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 225, - fast: 35, - standard: 25, - low: 25 - }, - nativeCurrency: "avax", - currencyName: "AVAX", - explorerUrl: "https://snowtrace.io", - merkleTreeHeight: 20, - emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", - networkName: "Avalanche Mainnet", - deployedBlock: 4429818, - multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", - routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", - echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", - offchainOracleContract: "0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8", - tornadoSubgraph: "tornadocash/avalanche-tornado-subgraph", - subgraphs: { - theGraph - }, - rpcUrls: { - publicRpc: { - name: "Avalanche RPC", - url: "https://api.avax.network/ext/bc/C/rpc" - }, - meowRPC: { - name: "Meow RPC", - url: "https://avax.meowrpc.com" - }, - oneRPC: { - name: "OneRPC", - url: "https://1rpc.io/avax/c" - } - }, - tokens: { - avax: { - instanceAddress: { - "10": "0x330bdFADE01eE9bF63C209Ee33102DD334618e0a", - "100": "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD", - "500": "0xaf8d1839c3c67cf571aa74B5c12398d4901147B3" - }, - symbol: "AVAX", - decimals: 18 - } - }, - relayerEnsSubdomain: "avalanche-tornado", - pollInterval: 10, - constants: { - NOTE_ACCOUNT_BLOCK: 4429813, - ENCRYPTED_NOTES_BLOCK: 4429813 - } - }, - [11155111 /* SEPOLIA */]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 2, - fast: 2, - standard: 2, - low: 2 - }, - nativeCurrency: "eth", - currencyName: "SepoliaETH", - explorerUrl: "https://sepolia.etherscan.io", - merkleTreeHeight: 20, - emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", - networkName: "Ethereum Sepolia", - deployedBlock: 5594395, - multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", - routerContract: "0x1572AFE6949fdF51Cb3E0856216670ae9Ee160Ee", - echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", - tornContract: "0x3AE6667167C0f44394106E197904519D808323cA", - governanceContract: "0xe5324cD7602eeb387418e594B87aCADee08aeCAD", - stakingRewardsContract: "0x6d0018890751Efd31feb8166711B16732E2b496b", - registryContract: "0x1428e5d2356b13778A13108b10c440C83011dfB8", - aggregatorContract: "0x4088712AC9fad39ea133cdb9130E465d235e9642", - reverseRecordsContract: "0xEc29700C0283e5Be64AcdFe8077d6cC95dE23C23", - tornadoSubgraph: "tornadocash/sepolia-tornado-subgraph", - subgraphs: { - tornado - }, - rpcUrls: { - tornadoRPC: { - name: "Tornado RPC", - url: "https://tornadocash-rpc.com/sepolia" - }, - sepolia: { - name: "Sepolia RPC", - url: "https://rpc.sepolia.org" - }, - chainnodes: { - name: "Chainnodes RPC", - url: "https://sepolia.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607" - } - }, - tokens: { - eth: { - instanceAddress: { - "0.1": "0x8C4A04d872a6C1BE37964A21ba3a138525dFF50b", - "1": "0x8cc930096B4Df705A007c4A039BDFA1320Ed2508", - "10": "0x8D10d506D29Fc62ABb8A290B99F66dB27Fc43585", - "100": "0x44c5C92ed73dB43888210264f0C8b36Fd68D8379" - }, - symbol: "ETH", - decimals: 18 - }, - dai: { - instanceAddress: { - "100": "0x6921fd1a97441dd603a997ED6DDF388658daf754", - "1000": "0x50a637770F5d161999420F7d70d888DE47207145", - "10000": "0xecD649870407cD43923A816Cc6334a5bdf113621", - "100000": "0x73B4BD04bF83206B6e979BE2507098F92EDf4F90" - }, - tokenAddress: "0xFF34B3d4Aee8ddCd6F9AFFFB6Fe49bD371b8a357", - tokenGasLimit: 7e4, - symbol: "DAI", - decimals: 18, - gasLimit: 7e5 - } - }, - relayerEnsSubdomain: "sepolia-tornado", - pollInterval: 15, - constants: { - GOVERNANCE_BLOCK: 5594395, - NOTE_ACCOUNT_BLOCK: 5594395, - ENCRYPTED_NOTES_BLOCK: 5594395, - MINING_BLOCK_TIME: 15 - } - } -}; -const enabledChains = Object.values(NetId).filter((n) => typeof n === "number"); -let customConfig = {}; -function addNetwork(newConfig) { - enabledChains.push( - ...Object.keys(newConfig).map((netId) => Number(netId)).filter((netId) => !enabledChains.includes(netId)) - ); - customConfig = __spreadValues$1(__spreadValues$1({}, customConfig), newConfig); -} -function getNetworkConfig() { - const allConfig = __spreadValues$1(__spreadValues$1({}, defaultConfig), customConfig); - return enabledChains.reduce((acc, curr) => { - acc[curr] = allConfig[curr]; - return acc; - }, {}); -} -function getConfig(netId) { - const allConfig = getNetworkConfig(); - const chainConfig = allConfig[netId]; - if (!chainConfig) { - const errMsg = `No config found for network ${netId}!`; - throw new Error(errMsg); - } - return chainConfig; -} -function getInstanceByAddress({ netId, address }) { - const { tokens } = getConfig(netId); - for (const [currency, { instanceAddress }] of Object.entries(tokens)) { - for (const [amount, instance] of Object.entries(instanceAddress)) { - if (instance === address) { - return { - amount, - currency - }; - } - } - } -} -function getSubdomains() { - const allConfig = getNetworkConfig(); - return enabledChains.map((chain) => allConfig[chain].relayerEnsSubdomain); -} - -const addressType = { type: "string", pattern: "^0x[a-fA-F0-9]{40}$" }; -const bnType = { type: "string", BN: true }; -const statusSchema = { - type: "object", - properties: { - rewardAccount: addressType, - gasPrices: { - type: "object", - properties: { - fast: { type: "number" }, - additionalProperties: { type: "number" } - }, - required: ["fast"] - }, - netId: { type: "integer" }, - tornadoServiceFee: { type: "number", maximum: 20, minimum: 0 }, - latestBlock: { type: "number" }, - version: { type: "string" }, - health: { - type: "object", - properties: { - status: { const: "true" }, - error: { type: "string" } - }, - required: ["status"] - }, - currentQueue: { type: "number" } - }, - required: ["rewardAccount", "instances", "netId", "tornadoServiceFee", "version", "health"] -}; -function getStatusSchema(netId, config) { - const { tokens, optionalTokens = [], nativeCurrency } = config; - const schema = JSON.parse(JSON.stringify(statusSchema)); - const instances = Object.keys(tokens).reduce( - (acc, token) => { - const { instanceAddress, tokenAddress, symbol, decimals, optionalInstances = [] } = tokens[token]; - const amounts = Object.keys(instanceAddress); - const instanceProperties = { - type: "object", - properties: { - instanceAddress: { - type: "object", - properties: amounts.reduce((acc2, cur) => { - acc2[cur] = addressType; - return acc2; - }, {}), - required: amounts.filter((amount) => !optionalInstances.includes(amount)) - }, - decimals: { enum: [decimals] } - }, - required: ["instanceAddress", "decimals"].concat( - tokenAddress ? ["tokenAddress"] : [], - symbol ? ["symbol"] : [] - ) - }; - if (tokenAddress) { - instanceProperties.properties.tokenAddress = addressType; - } - if (symbol) { - instanceProperties.properties.symbol = { enum: [symbol] }; - } - acc.properties[token] = instanceProperties; - if (!optionalTokens.includes(token)) { - acc.required.push(token); - } - return acc; - }, - { - type: "object", - properties: {}, - required: [] - } - ); - schema.properties.instances = instances; - if (netId === NetId.MAINNET) { - const _tokens = Object.keys(tokens).filter((t) => t !== nativeCurrency); - const ethPrices = { - type: "object", - properties: _tokens.reduce((acc, token) => { - acc[token] = bnType; - return acc; - }, {}) - // required: _tokens - }; - schema.properties.ethPrices = ethPrices; - } - return schema; -} - -const jobsSchema = { - type: "object", - properties: { - error: { type: "string" }, - id: { type: "string" }, - type: { type: "string" }, - status: { type: "string" }, - contract: { type: "string" }, - proof: { type: "string" }, - args: { - type: "array", - items: { type: "string" } - }, - txHash: { type: "string" }, - confirmations: { type: "number" }, - failedReason: { type: "string" } - }, - required: ["id", "status"] -}; - -const ajv = new Ajv({ allErrors: true }); -ajv.addKeyword({ - keyword: "BN", - // eslint-disable-next-line @typescript-eslint/no-explicit-any - validate: (schema, data) => { - try { - BigInt(data); - return true; - } catch (e) { - return false; - } - }, - errors: true -}); - -var __async$7 = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; class Pedersen { + pedersenHash; + babyJub; + pedersenPromise; constructor() { this.pedersenPromise = this.initPedersen(); } - initPedersen() { - return __async$7(this, null, function* () { - this.pedersenHash = yield buildPedersenHash(); - this.babyJub = this.pedersenHash.babyJub; - }); + async initPedersen() { + this.pedersenHash = await buildPedersenHash(); + this.babyJub = this.pedersenHash.babyJub; } - unpackPoint(buffer) { - return __async$7(this, null, function* () { - var _a, _b; - yield this.pedersenPromise; - return (_b = this.babyJub) == null ? void 0 : _b.unpackPoint((_a = this.pedersenHash) == null ? void 0 : _a.hash(buffer)); - }); + async unpackPoint(buffer) { + await this.pedersenPromise; + return this.babyJub?.unpackPoint(this.pedersenHash?.hash(buffer)); } toStringBuffer(buffer) { - var _a; - return (_a = this.babyJub) == null ? void 0 : _a.F.toString(buffer); + return this.babyJub?.F.toString(buffer); } } const pedersen = new Pedersen(); -function buffPedersenHash(buffer) { - return __async$7(this, null, function* () { - const [hash] = yield pedersen.unpackPoint(buffer); - return pedersen.toStringBuffer(hash); - }); +async function buffPedersenHash(buffer) { + const [hash] = await pedersen.unpackPoint(buffer); + return pedersen.toStringBuffer(hash); } -var __async$6 = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; -function createDeposit(_0) { - return __async$6(this, arguments, function* ({ nullifier, secret }) { - const preimage = new Uint8Array([...leInt2Buff(nullifier), ...leInt2Buff(secret)]); - const noteHex = toFixedHex(bytesToBN(preimage), 62); - const commitment = BigInt(yield buffPedersenHash(preimage)); - const commitmentHex = toFixedHex(commitment); - const nullifierHash = BigInt(yield buffPedersenHash(leInt2Buff(nullifier))); - const nullifierHex = toFixedHex(nullifierHash); - return { - preimage, - noteHex, - commitment, - commitmentHex, - nullifierHash, - nullifierHex - }; - }); +function parseNote(noteString) { + const noteRegex = /tornado-(?\w+)-(?[\d.]+)-(?\d+)-0x(?[0-9a-fA-F]{124})/g; + const match = noteRegex.exec(noteString); + if (!match) { + return; + } + const { currency, amount, netId, noteHex } = match.groups; + return { + currency: currency.toLowerCase(), + amount, + netId: Number(netId), + noteHex: "0x" + noteHex, + note: noteString + }; +} +function parseInvoice(invoiceString) { + const invoiceRegex = /tornadoInvoice-(?\w+)-(?[\d.]+)-(?\d+)-0x(?[0-9a-fA-F]{64})/g; + const match = invoiceRegex.exec(invoiceString); + if (!match) { + return; + } + const { currency, amount, netId, commitmentHex } = match.groups; + return { + currency: currency.toLowerCase(), + amount, + netId: Number(netId), + commitmentHex: "0x" + commitmentHex, + invoice: invoiceString + }; +} +async function createDeposit({ nullifier, secret }) { + const preimage = new Uint8Array([...leInt2Buff(nullifier), ...leInt2Buff(secret)]); + const noteHex = toFixedHex(bytesToBN(preimage), 62); + const commitment = BigInt(await buffPedersenHash(preimage)); + const commitmentHex = toFixedHex(commitment); + const nullifierHash = BigInt(await buffPedersenHash(leInt2Buff(nullifier))); + const nullifierHex = toFixedHex(nullifierHash); + return { + preimage, + noteHex, + commitment, + commitmentHex, + nullifierHash, + nullifierHex + }; } class Deposit { + currency; + amount; + netId; + nullifier; + secret; + note; + noteHex; + invoice; + commitmentHex; + nullifierHex; constructor({ currency, amount, @@ -5839,81 +8964,77 @@ class Deposit { 2 ); } - static createNote(_0) { - return __async$6(this, arguments, function* ({ currency, amount, netId, nullifier, secret }) { - if (!nullifier) { - nullifier = rBigInt(31); - } - if (!secret) { - secret = rBigInt(31); - } - const depositObject = yield createDeposit({ - nullifier, - secret - }); - const newDeposit = new Deposit({ - currency: currency.toLowerCase(), - amount, - netId, - note: `tornado-${currency.toLowerCase()}-${amount}-${netId}-${depositObject.noteHex}`, - noteHex: depositObject.noteHex, - invoice: `tornadoInvoice-${currency.toLowerCase()}-${amount}-${netId}-${depositObject.commitmentHex}`, - nullifier, - secret, - commitmentHex: depositObject.commitmentHex, - nullifierHex: depositObject.nullifierHex - }); - return newDeposit; + static async createNote({ currency, amount, netId, nullifier, secret }) { + if (!nullifier) { + nullifier = rBigInt(31); + } + if (!secret) { + secret = rBigInt(31); + } + const depositObject = await createDeposit({ + nullifier, + secret }); + const newDeposit = new Deposit({ + currency: currency.toLowerCase(), + amount, + netId, + note: `tornado-${currency.toLowerCase()}-${amount}-${netId}-${depositObject.noteHex}`, + noteHex: depositObject.noteHex, + invoice: `tornadoInvoice-${currency.toLowerCase()}-${amount}-${netId}-${depositObject.commitmentHex}`, + nullifier, + secret, + commitmentHex: depositObject.commitmentHex, + nullifierHex: depositObject.nullifierHex + }); + return newDeposit; } - static parseNote(noteString) { - return __async$6(this, null, function* () { - const noteRegex = new RegExp("tornado-(?\\w+)-(?[\\d.]+)-(?\\d+)-0x(?[0-9a-fA-F]{124})", "g"); - const match = noteRegex.exec(noteString); - if (!match) { - throw new Error("The note has invalid format"); - } - const matchGroup = match == null ? void 0 : match.groups; - const currency = matchGroup.currency.toLowerCase(); - const amount = matchGroup.amount; - const netId = Number(matchGroup.netId); - const bytes = bnToBytes("0x" + matchGroup.note); - const nullifier = BigInt(leBuff2Int(bytes.slice(0, 31)).toString()); - const secret = BigInt(leBuff2Int(bytes.slice(31, 62)).toString()); - const depositObject = yield createDeposit({ nullifier, secret }); - const invoice = `tornadoInvoice-${currency}-${amount}-${netId}-${depositObject.commitmentHex}`; - const newDeposit = new Deposit({ - currency, - amount, - netId, - note: noteString, - noteHex: depositObject.noteHex, - invoice, - nullifier, - secret, - commitmentHex: depositObject.commitmentHex, - nullifierHex: depositObject.nullifierHex - }); - return newDeposit; + static async parseNote(noteString) { + const parsedNote = parseNote(noteString); + if (!parsedNote) { + throw new Error("The note has invalid format"); + } + const { currency, amount, netId, note, noteHex: parsedNoteHex } = parsedNote; + const bytes = bnToBytes(parsedNoteHex); + const nullifier = BigInt(leBuff2Int(bytes.slice(0, 31)).toString()); + const secret = BigInt(leBuff2Int(bytes.slice(31, 62)).toString()); + const { noteHex, commitmentHex, nullifierHex } = await createDeposit({ + nullifier, + secret }); + const invoice = `tornadoInvoice-${currency}-${amount}-${netId}-${commitmentHex}`; + const newDeposit = new Deposit({ + currency, + amount, + netId, + note, + noteHex, + invoice, + nullifier, + secret, + commitmentHex, + nullifierHex + }); + return newDeposit; } } class Invoice { + currency; + amount; + netId; + commitmentHex; + invoice; constructor(invoiceString) { - const invoiceRegex = new RegExp("tornadoInvoice-(?\\w+)-(?[\\d.]+)-(?\\d+)-0x(?[0-9a-fA-F]{64})", "g"); - const match = invoiceRegex.exec(invoiceString); - if (!match) { - throw new Error("The note has invalid format"); + const parsedInvoice = parseInvoice(invoiceString); + if (!parsedInvoice) { + throw new Error("The invoice has invalid format"); } - const matchGroup = match == null ? void 0 : match.groups; - const currency = matchGroup.currency.toLowerCase(); - const amount = matchGroup.amount; - const netId = Number(matchGroup.netId); + const { currency, amount, netId, invoice, commitmentHex } = parsedInvoice; this.currency = currency; this.amount = amount; this.netId = netId; - this.commitment = "0x" + matchGroup.commitment; - this.invoice = invoiceString; + this.commitmentHex = commitmentHex; + this.invoice = invoice; } toString() { return JSON.stringify( @@ -5921,7 +9042,7 @@ class Invoice { currency: this.currency, amount: this.amount, netId: this.netId, - commitment: this.commitment, + commitmentHex: this.commitmentHex, invoice: this.invoice }, null, @@ -5951,27 +9072,37 @@ function unpackEncryptedMessage(encryptedMessage) { }; } class NoteAccount { - constructor({ netId, blockNumber, recoveryKey, Echoer: Echoer2 }) { + blockNumber; + // Dedicated 32 bytes private key only used for note encryption, backed up to an Echoer and local for future derivation + // Note that unlike the private key it shouldn't have the 0x prefix + recoveryKey; + // Address derived from recoveryKey, only used for frontend UI + recoveryAddress; + // Note encryption public key derived from recoveryKey + recoveryPublicKey; + constructor({ blockNumber, recoveryKey }) { if (!recoveryKey) { - recoveryKey = bytesToHex(crypto.getRandomValues(new Uint8Array(32))).slice(2); + recoveryKey = rHex(32).slice(2); } - this.netId = Math.floor(Number(netId)); this.blockNumber = blockNumber; this.recoveryKey = recoveryKey; this.recoveryAddress = computeAddress("0x" + recoveryKey); this.recoveryPublicKey = getEncryptionPublicKey(recoveryKey); - this.Echoer = Echoer2; } /** * Intends to mock eth_getEncryptionPublicKey behavior from MetaMask * In order to make the recoveryKey retrival from Echoer possible from the bare private key */ - static getWalletPublicKey(wallet) { - let { privateKey } = wallet; - if (privateKey.startsWith("0x")) { - privateKey = privateKey.replace("0x", ""); + static async getSignerPublicKey(signer) { + if (signer.privateKey) { + const wallet = signer; + const privateKey = wallet.privateKey.slice(0, 2) === "0x" ? wallet.privateKey.slice(2) : wallet.privateKey; + return getEncryptionPublicKey(privateKey); } - return getEncryptionPublicKey(privateKey); + const provider = signer.provider; + return await provider.send("eth_getEncryptionPublicKey", [ + signer.address + ]); } // This function intends to provide an encrypted value of recoveryKey for an on-chain Echoer backup purpose // Thus, the pubKey should be derived by a Wallet instance or from Web3 wallets @@ -5995,28 +9126,45 @@ class NoteAccount { /** * Decrypt Echoer backuped note encryption account with private keys */ - decryptAccountsWithWallet(wallet, events) { - let { privateKey } = wallet; - if (privateKey.startsWith("0x")) { - privateKey = privateKey.replace("0x", ""); - } + static async decryptSignerNoteAccounts(signer, events) { + const signerAddress = signer.address; const decryptedEvents = []; for (const event of events) { + if (event.address !== signerAddress) { + continue; + } try { const unpackedMessage = unpackEncryptedMessage(event.encryptedAccount); - const recoveryKey = decrypt({ - encryptedData: unpackedMessage, - privateKey - }); + let recoveryKey; + if (signer.privateKey) { + const wallet = signer; + const privateKey = wallet.privateKey.slice(0, 2) === "0x" ? wallet.privateKey.slice(2) : wallet.privateKey; + recoveryKey = decrypt({ + encryptedData: unpackedMessage, + privateKey + }); + } else { + const { version, nonce, ephemPublicKey, ciphertext } = unpackedMessage; + const unpackedBuffer = bytesToHex( + new TextEncoder().encode( + JSON.stringify({ + version, + nonce, + ephemPublicKey, + ciphertext + }) + ) + ); + const provider = signer.provider; + recoveryKey = await provider.send("eth_decrypt", [unpackedBuffer, signerAddress]); + } decryptedEvents.push( new NoteAccount({ - netId: this.netId, blockNumber: event.blockNumber, - recoveryKey, - Echoer: this.Echoer + recoveryKey }) ); - } catch (e) { + } catch { continue; } } @@ -6036,7 +9184,7 @@ class NoteAccount { address: getAddress(address), noteHex }); - } catch (e) { + } catch { continue; } } @@ -6052,19 +9200,144 @@ class NoteAccount { } } +function encodedLabelToLabelhash(label) { + if (label.length !== 66) return null; + if (label.indexOf("[") !== 0) return null; + if (label.indexOf("]") !== 65) return null; + const hash = `0x${label.slice(1, 65)}`; + if (!isHex(hash)) return null; + return hash; +} +function labelhash(label) { + if (!label) { + return bytesToHex(new Uint8Array(32).fill(0)); + } + return encodedLabelToLabelhash(label) || keccak256(new TextEncoder().encode(label)); +} +function makeLabelNodeAndParent(name) { + const labels = name.split("."); + const label = labels.shift(); + const parentNode = namehash(labels.join(".")); + return { + label, + labelhash: labelhash(label), + parentNode + }; +} +const EnsContracts = { + [NetId.MAINNET]: { + ensRegistry: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + ensPublicResolver: "0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63", + ensNameWrapper: "0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401" + }, + [NetId.SEPOLIA]: { + ensRegistry: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + ensPublicResolver: "0x8FADE66B79cC9f707aB26799354482EB93a5B7dD", + ensNameWrapper: "0x0635513f179D50A207757E05759CbD106d7dFcE8" + } +}; +class ENSUtils { + ENSRegistry; + ENSResolver; + ENSNameWrapper; + provider; + constructor(provider) { + this.provider = provider; + } + async getContracts() { + const { chainId } = await this.provider.getNetwork(); + const { ensRegistry, ensPublicResolver, ensNameWrapper } = EnsContracts[Number(chainId)]; + this.ENSRegistry = ENSRegistry__factory.connect(ensRegistry, this.provider); + this.ENSResolver = ENSResolver__factory.connect(ensPublicResolver, this.provider); + this.ENSNameWrapper = ENSNameWrapper__factory.connect(ensNameWrapper, this.provider); + } + async getOwner(name) { + if (!this.ENSRegistry) { + await this.getContracts(); + } + return this.ENSRegistry.owner(namehash(name)); + } + // nameWrapper connected with wallet signer + async unwrap(signer, name) { + if (!this.ENSNameWrapper) { + await this.getContracts(); + } + const owner = signer.address; + const nameWrapper = this.ENSNameWrapper.connect(signer); + const { labelhash: labelhash2 } = makeLabelNodeAndParent(name); + return nameWrapper.unwrapETH2LD(labelhash2, owner, owner); + } + // https://github.com/ensdomains/ensjs/blob/main/packages/ensjs/src/functions/wallet/createSubname.ts + async setSubnodeRecord(signer, name) { + if (!this.ENSResolver) { + await this.getContracts(); + } + const resolver = this.ENSResolver; + const registry = this.ENSRegistry.connect(signer); + const owner = signer.address; + const { labelhash: labelhash2, parentNode } = makeLabelNodeAndParent(name); + return registry.setSubnodeRecord(parentNode, labelhash2, owner, resolver.target, BigInt(0)); + } + getResolver(name) { + return EnsResolver.fromName(this.provider, name); + } + async getText(name, key) { + const resolver = await this.getResolver(name); + if (!resolver) { + return resolver; + } + return await resolver.getText(key) || ""; + } + // https://github.com/ensdomains/ensjs/blob/main/packages/ensjs/src/functions/wallet/setTextRecord.ts + async setText(signer, name, key, value) { + const resolver = ENSResolver__factory.connect((await this.getResolver(name))?.address, signer); + return resolver.setText(namehash(name), key, value); + } +} + const DUMMY_ADDRESS = "0x1111111111111111111111111111111111111111"; -const DUMMY_NONCE = "0x1111111111111111111111111111111111111111111111111111111111111111"; +const DUMMY_NONCE = 1024; const DUMMY_WITHDRAW_DATA = "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"; function convertETHToTokenAmount(amountInWei, tokenPriceInWei, tokenDecimals = 18) { const tokenDecimalsMultiplier = BigInt(10 ** Number(tokenDecimals)); return BigInt(amountInWei) * tokenDecimalsMultiplier / BigInt(tokenPriceInWei); } class TornadoFeeOracle { - constructor(ovmGasPriceOracle) { + provider; + ovmGasPriceOracle; + constructor(provider, ovmGasPriceOracle) { + this.provider = provider; if (ovmGasPriceOracle) { this.ovmGasPriceOracle = ovmGasPriceOracle; } } + /** + * Calculates Gas Price + * We apply 50% premium of EIP-1559 network fees instead of 100% from ethers.js + * (This should cover up to 4 full blocks which is equivalent of minute) + * (A single block can bump 12.5% of fees, see the methodology https://hackmd.io/@tvanepps/1559-wallets) + * (Still it is recommended to use 100% premium for sending transactions to prevent stucking it) + */ + async gasPrice() { + const [block, getGasPrice, getPriorityFee] = await Promise.all([ + this.provider.getBlock("latest"), + (async () => { + try { + return BigInt(await this.provider.send("eth_gasPrice", [])); + } catch { + return parseUnits("1", "gwei"); + } + })(), + (async () => { + try { + return BigInt(await this.provider.send("eth_maxPriorityFeePerGas", [])); + } catch { + return BigInt(0); + } + })() + ]); + return block?.baseFeePerGas ? block.baseFeePerGas * BigInt(15) / BigInt(10) + getPriorityFee : getGasPrice; + } /** * Calculate L1 fee for op-stack chains * @@ -6078,10 +9351,9 @@ class TornadoFeeOracle { tx = { type: 0, gasLimit: 1e6, - nonce: Number(DUMMY_NONCE), + nonce: DUMMY_NONCE, data: DUMMY_WITHDRAW_DATA, gasPrice: parseUnits("1", "gwei"), - from: DUMMY_ADDRESS, to: DUMMY_ADDRESS }; } @@ -6127,72 +9399,457 @@ class TornadoFeeOracle { } } -var __async$5 = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); +const gasZipInbounds = { + [NetId.MAINNET]: "0x391E7C679d29bD940d63be94AD22A25d25b5A604", + [NetId.BSC]: "0x391E7C679d29bD940d63be94AD22A25d25b5A604", + [NetId.POLYGON]: "0x391E7C679d29bD940d63be94AD22A25d25b5A604", + [NetId.OPTIMISM]: "0x391E7C679d29bD940d63be94AD22A25d25b5A604", + [NetId.ARBITRUM]: "0x391E7C679d29bD940d63be94AD22A25d25b5A604", + [NetId.GNOSIS]: "0x391E7C679d29bD940d63be94AD22A25d25b5A604", + [NetId.AVALANCHE]: "0x391E7C679d29bD940d63be94AD22A25d25b5A604" }; +const gasZipID = { + [NetId.MAINNET]: 255, + [NetId.BSC]: 14, + [NetId.POLYGON]: 17, + [NetId.OPTIMISM]: 55, + [NetId.ARBITRUM]: 57, + [NetId.GNOSIS]: 16, + [NetId.AVALANCHE]: 15, + [NetId.SEPOLIA]: 102 +}; +function gasZipInput(to, shorts) { + let data = "0x"; + if (isAddress(to)) { + if (to.length === 42) { + data += "02"; + data += to.slice(2); + } else { + return null; + } + } else { + data += "01"; + } + for (const i in shorts) { + data += Number(shorts[i]).toString(16).padStart(4, "0"); + } + return data; +} +function gasZipMinMax(ethUsd) { + return { + min: 1 / ethUsd, + max: 50 / ethUsd, + ethUsd + }; +} + +const hasherBytecode = "0x38600c600039612b1b6000f3606460006000377c01000000000000000000000000000000000000000000000000000000006000510463f47d33b5146200003557fe5b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000016004518160245181838180828009800909089082827f0fbe43c36a80e36d7c7c584d4f8f3759fb51f0d66065d8a227b688d12488c5d408839081808280098009098391089082827f9c48cd3e00a6195a253fc009e60f249456f802ff9baf6549210d201321efc1cc08839081808280098009098391089082827f27c0849dba2643077c13eb42ffb97663cdcecd669bf10f756be30bab71b86cf808839081808280098009098391089082827f2bf76744736132e5c68f7dfdd5b792681d415098554fd8280f00d11b172b80d208839081808280098009098391089082827f33133eb4a1a1ab45037c8bdf9adbb2999baf06f20a9c95180dc4ccdcbec5856808839081808280098009098391089082827f588bb66012356dbc9b059ef1d792b563d6c18624dddecc3fe4583fd3551e9b3008839081808280098009098391089082827f71bc3e244e1b92911fe7f53cf523e491fd6ff487d59337a1d92f92668c4f4c3608839081808280098009098391089082827fd1808e2b039fd010c489768f78d7499938ccc0858f3295151787cfe8b7e40be108839081808280098009098391089082827f76978af3ded437cf41b3faa40cd6bcfce94f27f4abcc3ed34be19abd2c4537d008839081808280098009098391089082827f0a9baee798a320b0ca5b1cf888386d1dc12c13b38e10225aa4e9f03069a099f508839081808280098009098391089082827fb79dbf6050a03b16c3ade8d77e11c767d2251af9cdbd6cdf9a8a0ee921b32c7908839081808280098009098391089082827fa74bbcf5067f067faec2cce4b98d130d7927456f5c5f6c00e0f5406a24eb8b1908839081808280098009098391089082827fab7ab080d4c4018bda6ecc8bd67468bc4619ba12f25b0da879a639c758c8855d08839081808280098009098391089082827fe6a5b797c2bba7e9a873b37f5c41adc47765e9be4a1f0e0650e6a24ad226876308839081808280098009098391089082827f6270ae87cf3d82cf9c0b5f428466c429d7b7cbe234cecff39969171af006016c08839081808280098009098391089082827f9951c9f6e76d636b52f7600d979ca9f3b643dfbe9551c83b31542830321b2a6608839081808280098009098391089082827f4119469e44229cc40c4ff555a2b6f6b39961088e741e3c20a3c9b47f130c555008839081808280098009098391089082827f5d795e02bbaf90ff1f384741e5f18f8b644a0080441315d0e5b3c8123452a0b008839081808280098009098391089082827f281e90a515e6409e9177b4f297f8049ce3d4c3659423c48b3fd64e83596ff10108839081808280098009098391089082827f424185c60a21e84970f7d32cacaa2725aa8a844caea7ed760d2b965af1bf3e7d08839081808280098009098391089082827fd96fcbc3960614ea887da609187a5dada2e1b829f23309a6375212cea1f25c0908839081808280098009098391089082827ffde84026d7c294300af18f7712fc3662f43387ae8cf7fdda1f9a810f4b24bcf208839081808280098009098391089082827f3a9d568575846aa6b8a890b3c237fd0447426db878e6e25333b8eb9b386195c108839081808280098009098391089082827f55a2aa32c84a4cae196dd4094b685dd11757470a3be094d98eea73f02452aa3608839081808280098009098391089082827fcbc9481380978d29ebc5b0a8d4481cd2ef654ee800907adb3d38dc2fd9265fab08839081808280098009098391089082827f24e53af71ef06bacb76d3294c11223911e9d177ff09b7009febc484add0beb7408839081808280098009098391089082827fdbd44e16108225766dac3e5fe7acbe9df519bbba97380e5e9437a90658f2139308839081808280098009098391089082827fc6f434863c79013bb2c202331e04bccea2251c1ff6f191dc2afa23e6f6d28e4e08839081808280098009098391089082827f3490eeb39a733c0e8062d87f981ae65a8fccf25c448f4455d27db3915351b06608839081808280098009098391089082827f30b89830ff7ade3558a5361a24869130ce1fcce97211602962e34859525dac4f08839081808280098009098391089082827f29bae21b579d080a75c1694da628d0ecfd83efc9c8468704f410300062f64ca908839081808280098009098391089082827fe326499de0476e719915dd1c661ef4550723d4aee9ee9af224edd208790fce4408839081808280098009098391089082827f8c45208b8baa6f473821415957088c0b7e72a465f460b09ece2d270aee2f184108839081808280098009098391089082827ffe2ad454f451348f26ce2cc7e7914aef3eb96e8f89a4619a1dc7d11f8401c35208839081808280098009098391089082827f0929db368ef2af2d29bca38845325b0b7a820a4889e44b5829bbe1ed47fd4d5208839081808280098009098391089082827f16531d424b0cbaf9abbf2d2acde698462ea4555bf32ccf1bbd26697e905066f608839081808280098009098391089082827ff5c30d247f045ff6d05cf0dd0a49c9823e7a24b0d751d3c721353b96f29d76f608839081808280098009098391089082827f6eb7a3614056c230c6f171370fdd9d1048bb00b2cdd1b2721d11bdda5023f48608839081808280098009098391089082827f0ee9c4621642a272f710908707557498d25a6fdd51866da5d9f0d205355a618908839081808280098009098391089082827f78ca1cb1c7f6c6894d1cf94f327b8763be173151b6b06f99dfc6a944bb5a72f008839081808280098009098391089082827f5d24d0b1b304d05311ce0f274b0d93746a4860ed5cdd8d4348de557ea7a5ee7a08839081808280098009098391089082827f77423dabd1a3cddc8691438fc5891e3fd49ac0f3e21aaf249791bfde1303d2f308839081808280098009098391089082827f0642e8800a48cc04c0168232c6f542396597a67cf395ad622d947e98bb68697a08839081808280098009098391089082827fc1e7d3cbbc4c35b7490647d8402e56d334336943bda91fe2d34ca9727c0e3df508839081808280098009098391089082827f8d6fb1730335204f38f85e408ac861e76f24349ab6ee0469c22e19350bb24fe108839081808280098009098391089082827f67d0faf5f0db32a1b60e13dc4914246b9edac7990fb4990b19aa86815586441a08839081808280098009098391089082827f2605b9b909ded1b04971eae979027c4e0de57f3b6a60d5ed58aba619c34749ce08839081808280098009098391089082827fd276890b2c205db85f000d1f5111ed8f177e279cae3e52862780f04e846228d008839081808280098009098391089082827f2ac5905f9450a21ef6905ed5951a91b3730e3a2e2d62b50bdeb810015d50376b08839081808280098009098391089082827f7a366839f0291ca54da674ac3f0e1e9aa8b687ba533926cb40268039e57b967a08839081808280098009098391089082827f67ab0f3466989c3dbbe209c37ec272ba83984ba6e445be6d472b63e3ca7270e308839081808280098009098391089082827f0e786007d0ce7e28a90e31d3263887d40c556dec88fcb8b56bc9e9c05ecc0c2908839081808280098009098391089082827f0b814ed99bd00eca389b0022663dbfddfbfa15e321c19abcf1eaf9556075fb6808839081808280098009098391089082827f65c0321ba26fcee4fdc35b4999b78ceb54dcaf9fec2e3bdea98e9f82925c093208839081808280098009098391089082827fab2d2a929601f9c3520e0b14aaa6ba9f1e79821a5b768919670a4ea970722bf408839081808280098009098391089082827fcdd2e0744d4af1a81918de69ec12128a5871367303ff83ed764771cbbdf6502308839081808280098009098391089082827f74527d0c0868f2ec628086b874fa66a7347d3d3b918d2e07a5f33e1067e8ac5808839081808280098009098391089082827f1c6bf6ac0314caead23e357bfcbbaa17d670672ae3a475f80934c716f10aca2508839081808280098009098391089082827f3c4007e286f8dc7efd5d0eeb0e95d7aa6589361d128a0cccb17b554c851a643208839081808280098009098391089082827fae468a86a5a7db7c763a053eb09ac1a02809ce095258c88101ee319e12b0697e08839081808280098009098391089082827f9333e3d052b7c77fcac1eb366f610f6f97852242b1317a87b80f3bbc5c8c2d1d08839081808280098009098391089082827f52ec1d675cf5353153f6b628414783ca6b7fc0fe01948ca206daad712296e39508839081808280098009098391089082827f13ceeeb301572b4991076750e11ea7e7fcbfee454d90dc1763989004a1894f9308839081808280098009098391089082827f8505737e7e94939a08d8cda10b6fbbbf879b2141ae7eabc30fcd22405135fe6408839081808280098009098391089082827f6127db7ac5200a212092b66ec2bfc63653f4dc8ac66c76008fef885258a258b508839081808280098009098391089082827f12692a7d808f44e31d628dbcfea377eb073fb918d7beb8136ea47f8cf094c88c08839081808280098009098391089082827f260e384b1268e3a347c91d6987fd280fa0a275541a7c5be34bf126af35c962e008839081808280098009098391089082827fd88c3b01966d90e713aee8d482ceaa6925311d2342e1a5aca4fcd2f44b6daddc08839081808280098009098391089082827fb87e868affd91b078a87fa75ac9332a6cf23587d94e20c3262db5e91f30bf04b08839081808280098009098391089082827fb5ba5f8acad1a950a3bbf2201055cd3ea27056c0c53f0c4c97f33cda8dbfe90908839081808280098009098391089082827f59ca814b49e00d7b3118c53a2986ded128584acd7428735e08ade6661c457f7508839081808280098009098391089082827f0fc4c0bea813a223fd510c07f7bbe337badd4bcf28649a0d378970c2a15b3aa508839081808280098009098391089082827f0053f1ea6dd60e7a6db09a00be77549ff3d4ee3737be7fb42052ae1321f667c308839081808280098009098391089082827feb937077bb10c8fe38716d4e38edc1f9e7b18c6414fef85fe7e9c5567baa4a0408839081808280098009098391089082827fbacb14c0f1508d828f7fd048d716b8044aec7f0fb48e85e717bf532db972520708839081808280098009098391089082827f4ca0abb8beb7cff572a0c1e6f58e080e1bb243d497a3e74538442a4555ad40be08839081808280098009098391089082827fda9eefd411e590d7e44592cce298af87b2c62aa3cc8bb137aa99ca8d4aa551b508839081808280098009098391089082827f153dae43cef763e7a2fc9846f09a2973b0ad9c35894c220699bcc2954501c6bd08839081808280098009098391089082827fd4ed2a09375813b4fb504c7a9ba13110bdd8549a47349db82c15a434c090e87b08839081808280098009098391089082827f0063a5c4c9c12dcf4bae72c69f3a225664469503d61d9eae5d9553bfb006095b08839081808280098009098391089082827fdc8a4d35ad28e59dd3713b45985cd3b70e37ccc2be42086f1ea078fe2dc9d82d08839081808280098009098391089082827f486ba219308f0c847b22fcb4449f8855192536c01b8057904e81c1c7814f483b08839081808280098009098391089082827f34d9604140a1ac9fdb204285b9fe1b303c281af2fc5fb362f6577282b423bcf308839081808280098009098391089082827fc1681959ec4bc3656911db2b2f56aa4db709c26f1a0a25c879286e37f437465d08839081808280098009098391089082827ffcd849f3b5f9e4368af75619fb27f2e335adbb9b44988f17c4d389fa751ad47a08839081808280098009098391089082827ff5f7fc22ad64c8e7c1e005110e13f4f1c6b1f8f8cc59000db0e3bb38f99554a508839081808280098009098391089082827fa9133b8a20fbae4633ec5f82cb47a38ae1877d12d1febb23982c7c808aa5317508839081808280098009098391089082827ff4827c5c7b61141cc31b75984bb3ed16ed579e5b72e32a1289b63ab55eaf8c1208839081808280098009098391089082827fcca361819ffefe3e50fe34c91a322c9405f4e5a168c1fc0a0a1883993e32c9f408839081808280098009098391089082827f6656088842bfc9e325a532784d3362cecfa86f9c7b208a6b499836ebe48ff15708839081808280098009098391089082827f00129c7cd00e42ed05a37dbceb80d47b65e1d750ef2148278a54723fdf42c4cc08839081808280098009098391089082827fa85b235631b786f85cd46f7768f6c71ae004ad267ae59bdf929ada149b19588808839081808280098009098391089082827f34df65a82686be09c5b237911abf237a9887c1a418f279ac79b446d7d311f5ea08839081808280098009098391089082827f815a850c3989df9ca6231e0bdd9916fc0e076f2c6c7f0f260a846d0179f9c32d08839081808280098009098391089082827f50fb0940848a67aee83d348421fadd79aefc7a2adabeec6e64904ebe1bf63e7d08839081808280098009098391089082827fbab63a16273599f8b66895461e62a19ff0d103693be771d93e3691bba89cdd8d08839081808280098009098391089082827f6931a091756e0bc709ebecfffba5038634c5b3d5d0c5876dd72aac67452db8a208839081808280098009098391089082827f55559b8bb79db8809c46ee627f1b5ce1d8e6d89bf94a9987a1407759d1ba896308839081808280098009098391089082827fa9a1a11b2979018cb155914d09f1df19b7ffec241e8b2487b6f6272a56a44a0a08839081808280098009098391089082827ff83293400e7bccea4bb86dcb0d5ca57fa2466e13a572d7d3531c6fa491cb0f1b08839081808280098009098391089082827fb7cb5742b6bc5339624d3568a33c21f31b877f8396972582028da999abf249f208839081808280098009098391089082827ff56efb400f8500b5c5bf811c65c86c7ed2e965f14f1a69bca436c0c60b79f46508839081808280098009098391089082827fd7c4427998d9c440f849dcd75b7157996eaad1b9a1d58cc2441931300e26eb2208839081808280098009098391089082827fca5ed18ad53e33fdc3ae8cf353ff3f6dd315f60060442b74f6b614b24ebd4cc308839081808280098009098391089082827f9ad3e9376c97b194a0fbf43e22a3616981d777365c765ead09a1d033fdf536b708839081808280098009098391089082827fc6daeff5769a06b26fe3b8fef30df07b1387373a7814cef364fe1d6059eaf54a08839081808280098009098391089082827fc20a78398345c6b8cf439643dab96223bf879c302648293eaf496fee5c978c6608839081808280098009098391089082827f589ca65b6cf0e90653c06dddc057dc61ba2839974569051c98b43e8618716efb08839081808280098009098391089082827f83064161f127d8c59fc73625957e21630dc6dc99e5443f6ce37ecd6bf28e69b708839081808280098009098391089082827f46d0ba662b50100b9a3af52052f68932feec1d12290b2033c4f49148893d8ba308839081808280098009098391089082827f18dd55b4a83a53f2ee578eb3e6d26f594824d44670fc3f4de80642344d15c09a08839081808280098009098391089082827f9fb5b594f48bc58b345ab90ded705920a7274b8e070eee8ce8cf90c72c3604b608839081808280098009098391089082827f1901d8f4f2c8449128e00663978f2050f2eb1cd6acb60d9d09c57c5d46ee54fe08839081808280098009098391089082827f5ec56789beab24ef7ee32f594d5fc561ec59dfeb93606dc7dcc6fe65133a7db408839081808280098009098391089082827f01c0b2cbe4fa9877a3d08eb67c510e8630da0a8beda94a6d9283e6f70d268bc508839081808280098009098391089082827f0b1d85acd9031a9107350eed946a25734e974799c5ba7cff13b15a5a623a25f008839081808280098009098391089082827f204497d1d359552905a2fe655f3d6f94926ea92d12cdaa6556ec26362f239f6408839081808280098009098391089082827fe075f7edc6631a8d7ffe33019f44fc91f286236d5a5f90f16de4791b72a2a5f008839081808280098009098391089082827f243f46e353354256ab8fe0ca4e9230dfc330bc163e602dfeaf307c1d1a7264b908839081808280098009098391089082827fd448ae5e09625fa1fcfd732fc9cd8f06e4c33b81f0a9240c83da56f41e9ecceb08839081808280098009098391089082827f2f312eef69a33d9fa753c08840275692a03432b3e6da67f9c59b9f9f4971cd5608839081808280098009098391089082827f5f333996af231bd5a293137da91801e191a6f24eb532ad1a7e6e9a2ad0efbc0008839081808280098009098391089082827fa8f771e0383a832dc8e2eaa8efabda300947acaf0684fabddf8b4abb0abd8a6208839081808280098009098391089082827f9ff0b3d7a4643596f651b70c1963cc4fa6c46018d78f05cb2c5f187e25df83a908839081808280098009098391089082827f9c373b704838325648273734dcdf962d7c156f431f70380ba4855832c4a238b808839081808280098009098391089082827fea2afa02604b8afeeb570f48a0e97a5e6bfe9613394b9a6b0026ecd6cec8c33a08839081808280098009098391089082827f68892258cd8eb43b71caa6d6837ec9959bfdfd72f25c9005ebaffc4011f8a7bf08839081808280098009098391089082827ff2824f561f6f82e3c1232836b0d268fa3b1b5489edd39a5fe1503bfc7ca91f4908839081808280098009098391089082827f164eda75fda2861f9d812f24e37ac938844fbe383c243b32b9f66ae2e76be71908839081808280098009098391089082827ff0a6fc431f5bf0dd1cca93b8b65b3f72c91f0693e2c74be9243b15abb31afcc008839081808280098009098391089082827fe68db66ba891ef0cd527f09ec6fff3ec0a269cf3d891a35ec13c902f70334b4f08839081808280098009098391089082827f3a44a5b102f7883a2b8630a3cae6e6db2e6e483bb7cfeb3492cbd91793ef598e08839081808280098009098391089082827f43939fe8ef789acb33cbf129ba8a3aa1bd61510a178022a05177c9c5a1c59bf108839081808280098009098391089082827f936fe3b66dfda1bc5a7aae241b4db442858bd720c1d579c0c869f273cd55d77408839081808280098009098391089082827f3490fcaa8ffa37f35dc67ae006e81352c7103945417b8e4b142afcaefa344b8508839081808280098009098391089082827fcae66096cff344caca53ffe0e58aafeb468bd174f00d8abc425b2099c088187408839081808280098009098391089082827fc7d05783a41bc14f3c9a45384b6d5e2547c5b6a224c8316910b208f2718a70ab08839081808280098009098391089082827f5ac6b9ba94040d5692b865b6677b60ef3201b5c2121699f70beb9f9b2528a02608839081808280098009098391089082827fa902a3d4d9ecbfb9b2c76fddf780554bf93cad97b244e805d3adb94e1816290008839081808280098009098391089082827fe9df91ffeeb086a4d26041c29dac6fca1d56a4d022fe34b38831267395b98d2708839081808280098009098391089082827f862646f851d91a8840ad9ee711f12ec13b3e8f980ff5ef5ee43ca4520d57def708839081808280098009098391089082827f30b7381c9725b9db07816baf8524943a79cea135807c84cce0833485c11e0c2e08839081808280098009098391089082827f96afc10c5cedaddbda99df79387397c9be74a5b50f3a0c04ccb68d4e0f3a989f08839081808280098009098391089082827f3543da80d10da251c548776fe907c4ef89993d62e0062ae5c0496fcb851c366108839081808280098009098391089082827fe5140fe26d8b008430fccd50a68e3e11c1163d63b6d8b7cc40bc6f3c1d0b1b0608839081808280098009098391089082827ffefdf1872e4475e8bbb0ef6fab7f561bff121314695c433bd4c29ec118060c9608839081808280098009098391089082827f6bb8c9f3d57b18e002df059db1e6a5d42ad566f153f18460774f68ac2650940008839081808280098009098391089082827f5415122d50b26f4fab5784004c56cf03f128f825ad2236f4b3d51f74737bd97308839081808280098009098391089082827f00e115c4a98efae6a3a5ecc873b0cef63ccd5b515710a3ab03ec52218f784dc908839081808280098009098391089082827fda7d525427bad87b88238657c21331245578bc76aa6240b7f972382537a202ab08839081808280098009098391089082827f83332e8b34505b83010270dc795290a2f515b8f89c163acecdf4799df04c62f808839081808280098009098391089082827fb09ecb6033d1a065f17a61066cd737d0c3c5873b51c3ab0a285e26939e62aa1808839081808280098009098391089082827f24e65c718938c2b937378e7435332174329730bde85a4185e37875824eb4985908839081808280098009098391089082827f68e41430ccd41cc5e92a9f9acd2e955c1385b9f5ed8d3f133d767429484a8eba08839081808280098009098391089082827fc038fe9d0125ab8be54545276f841274e414c596ed4c9eaa6919604603d1ffa908839081808280098009098391089082827f23248698612cd8e83234fcf5db9b6b225f4b0ba78d72ef13ea1edff5f0fb029808839081808280098009098391089082827fd2a9fa3d39c1ba91eefa666a1db71c6e0e4e3b707626b0197a4e59e7110cf0d408839081808280098009098391089082827fc28931ee7dfa02b62872e0d937ba3dc5c637118273a1f1f0c4fc880905c82efc08839081808280098009098391089082827f01cd399556445e3d7b201d6c5e56a5794e60be2cfd9a4643e7ead79bb4f60f7908839081808280098009098391089082827fac855cc58d5fbb0dff91a79683eb0e914c1b7d8d0a540d416838a89f83a8312f08839081808280098009098391089082827ff7798af7ccf36b836705849f7dd40328bf9346657255b431446ec75a6817181608839081808280098009098391089082827fe52a24c92d3f067bf551eeaf98c62ba525e84882d7adad835fad8de72986b2b108839081808280098009098391089082827fffc8682759a2bf1dd67c87a77c285467801f1c44fd78fa4eb5957a4832c9d72d08839081808280098009098391089082827f1482ac3e7e4f321627850d95a13942aea6d2923402b913046856ff7e8aaf9aff08839081808280098009098391089082827f17332b4c7aac2a07ccfe954de7ad22ccf6fcb4c5fa15c130ed22a40ae9398f4708839081808280098009098391089082827fd4be0546013f84a0d1e118b37589723b58e323983263616d1b036f8b3fdd858308839081808280098009098391089082827fa64ec737d31dddf939b184438ccdd3e1d3e667572857cd6c9c31a0d1d9b7b08508839081808280098009098391089082827f8ad12fbc74117cff4743d674539c86548c6758710a07a6abe3715e4b53526d3408839081808280098009098391089082827f15a16435a2300b27a337561401f06682ba85019aa0af61b264a1177d38b5c13c08839081808280098009098391089082827f22616f306e76352293a22ab6ee15509d9b108d4136b32fa7f9ed259793f392a108839081808280098009098391089082827f519727b25560caf00ce0d3f911bd4356f907160ab5186da10a629c7ccae1851e08839081808280098009098391089082827fcff39e77928ce9310118d50e29bc87e7f78b53ad51366359aa17f07902ae639208839081808280098009098391089082827f17dead3bfa1968c744118023dead77cdbee22c5b7c2414f5a6bdf82fd94cf3ad08839081808280098009098391089082827f2bef0f8b22a1cfb90100f4a552a9d02b772130123de8144a00c4d57497e1d7f408839081808280098009098391089082827fbf5188713fef90b31c35243f92cfa4331ab076e30e24b355c79b01f41d152a1108839081808280098009098391089082827f3baadd2fd92e3e12fb371be0578941dc0a108fbca0a7d81b88316fb94d6b4dfe08839081808280098009098391089082827fd4f955742e20a28d38611bf9fc4a478c97b673a7cd40d0113a58a1efe338d9aa08839081808280098009098391089082827f3c1c3fe9a5f7ccd54ad5a51a224b3f94775266d19c3733017e4920d7391ad64508839081808280098009098391089082827f6372df6148abeed66fda5461779a9651130c6c525df733852bcd929016768a7a08839081808280098009098391089082827f6d098e848fb853f95adb5a6364b5ab33c79fb08877f2cf3e0e160d9fcb3ebcc508839081808280098009098391089082827f48c5fc90f27431fabfe496dfba14bb0dba71141eb5472a365fd13023f4fe629608839081808280098009098391089082827fbb988dfc0c4dfe53999bd34840adcb63fdbf501ccd622ca2ddf5064ad8cdebf408839081808280098009098391089082827f25b068c942724c424ed5851c9575c22752c9bd25f91ebfa589de3d88ee7627f908839081808280098009098391089082827fed98a1931e361add218de11ff7879bd7114cda19c24ddbe15b3b0190ce01e1aa08839081808280098009098391089082827fc80b5a7d63f6c43542ad612023d3ffd6c684ce2eab837180addcb4decf51854408839081808280098009098391089082827fe2ef24bf47c5203118c6ff96657dd3c6fdff7212d5c798d826455de77b4b70cd08839081808280098009098391089082827f907da812fd5a8375587e4860f87691d0a8d61d454c507d09e5562e1a5d0fcc7608839081808280098009098391089082827fc459abbc62bc6070cacdff597e97990de56edc51cc6643afb0f6789fef1bad6308839081808280098009098391089082827f38d61f5e566855d70d36ef0f0f1fefcd7c829bdd60d95e0ef1fb5b98856280a408839081808280098009098391089082827f13218626665c420d3aa2b0fa49224a3dce8e08b8b56f8851bd9cb5e25cb3042d08839081808280098009098391089082827f6f685fb152dba21b4d02422e237e246df73d7d711ae6d7d33983bae0f873e31008839081808280098009098391089082827f5ade34719e2498dde70e4571c40474475a4af706a3cb82ac18a7fa44c22d1c4708839081808280098009098391089082827f8a0c3dc7a496adca059cb95d9b173812a00f3c4d435e0b9e8116e0c4b5f56acb08839081808280098009098391089082827f196bc98252f63169ed79073ee091a0e8ed0b5af51017da143940c00bdb86370908839081808280098009098391089082827fd979bf70695d93f8efb552a413701918afec9e12dfe213f4d0c27cfa68fad6c208839081808280098009098391089082827fb803072d02f54d237a3c6c4cc18eda6dce87a03c6819df54e4ed8aed6dc56d4608839081808280098009098391089082827f1efcda9d986cddcf431af4d59c6a7709d650885b7886cba70f0e7cd92b331cdc08839081808280098009098391089082827fd3ca5f7859b82ac50b63da06d43aa68a6b685f0a60397638bbea173b3f60419208839081808280098009098391089082827fa59d392c0667316ad37a06be2d51aabe9e79bdef0013bc109985648a14c7e41f08839081808280098009098391089082827fac2f5f0d2146791b396e2bed6cf15a20bc22cc4c8cf7dd4b3514ac00148dd0a708839081808280098009098391089082827f17a993a6af068d72bc36f0e814d29fef3f97d7a72aa963889b16a8457409861a08839081808280098009098391089082827f6f1bf99686550e0396f7f4e2df6fdaa090fbc272c8c76eb32a3c6791de5a07b508839081808280098009098391089082827f8234d705e1ecdc59cc6ed40749069d4b45e63deb49b5b7d7f527abd31c072b1b08839081808280098009098391089082827f6fe929a1fd6aacba5c4012c45dd727d2c816119567450003913d882cb97bc47e08839081808280098009098391089082827fad5371215f2aba49026b2e48739c11b4d8ffbb24dd4a6e41b9763862af96787a08839081808280098009098391089082827fd0e704566c49e1a11edc2c128b2e07f36dc0c755468268f8fe4c4859b9fa595b08839081808280098009098391089082827f263e1195090d00be1d8fb37de17ccf3b66d180645efa0d831865cfaa8797769e08839081808280098009098391089082827fe65c090eebde2cfa7f9c92cf75641c7683fb8e81f4a48f5b7a9c7eb26a85029f08839081808280098009098391089082827fa18971781c6855f6a9752912780bb9b719c14a677a4c6393d62d6e046b97a2ac08839081808280098009098391089082827ff6fc1ef1bca8bec055cc66edecc5dc99030fe78311a3f21d8cd624df4f89e62508839081808280098009098391089082827f824e4e2838501516d3296542cb47a59a1ca4326e947c9c874d88dccc8e37b99a08839081808280098009098391089082827f3cd5a9e7353a50e454c9c1381b556b543897cc89153c3e3749f2021d8237226308839081808280098009098391089082827fb4bcedbd54d0c917a315cc7ca785e3c5995abbeeb3deb3ebaf02c7a9bf6cc83f08839081808280098009098391089082827f1f7476211105b3039cef009c51155ae93526c53a74973ecfce40754b3df1052108839081808280098009098391089082827f58aefbd978440c94b4b9fbd36e00e6e36caeacf82b0da0a6161d34c541a5a6e308839081808280098009098391089082827fc22cd6d61be780a33c77677bc6ba40307b597ed981db57cb485313eec2a5a49708839081808280098009098391089082827fd9ffc4fe0dc5f835c8dcdc1e60b8f0b1637f32a809175371b94a057272b0748d08839081808280098009098391089082827ff6a5268541bc4c64ad0ade8f55dda3492604857a71c923662a214dd7e9c20c1008839081808280098009098391089082826000088390818082800980090983910860205260005260406000f3"; +function deployHasher(signer) { + return signer.sendTransaction({ data: hasherBytecode }); +} + +const INDEX_DB_ERROR = "A mutation operation was attempted on a database that did not allow mutations."; +class IndexedDB { + dbExists; + isBlocked; + // todo: TestDBSchema on any + options; + dbName; + dbVersion; + db; + constructor({ dbName, stores }) { + this.dbExists = false; + this.isBlocked = false; + this.options = { + upgrade(db) { + Object.values(db.objectStoreNames).forEach((value) => { + db.deleteObjectStore(value); + }); + [{ name: "keyval" }, ...stores || []].forEach(({ name, keyPath, indexes }) => { + const store = db.createObjectStore(name, { + keyPath, + autoIncrement: true + }); + if (Array.isArray(indexes)) { + indexes.forEach(({ name: name2, unique = false }) => { + store.createIndex(name2, name2, { unique }); + }); + } + }); + } + }; + this.dbName = dbName; + this.dbVersion = 35; + } + async initDB() { + try { + if (this.dbExists || this.isBlocked) { + return; + } + this.db = await openDB(this.dbName, this.dbVersion, this.options); + this.db.addEventListener("onupgradeneeded", async () => { + await this._removeExist(); + }); + this.dbExists = true; + } catch (err) { + if (err.message.includes(INDEX_DB_ERROR)) { + console.log("This browser does not support IndexedDB!"); + this.isBlocked = true; + return; + } + if (err.message.includes("less than the existing version")) { + console.log(`Upgrading DB ${this.dbName} to ${this.dbVersion}`); + await this._removeExist(); + return; + } + console.error(`Method initDB has error: ${err.message}`); + } + } + async _removeExist() { + await deleteDB(this.dbName); + this.dbExists = false; + await this.initDB(); + } + async getFromIndex({ + storeName, + indexName, + key + }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + return await this.db.getFromIndex(storeName, indexName, key); + } catch (err) { + throw new Error(`Method getFromIndex has error: ${err.message}`); + } + } + async getAllFromIndex({ + storeName, + indexName, + key, + count + }) { + await this.initDB(); + if (!this.db) { + return []; + } + try { + return await this.db.getAllFromIndex(storeName, indexName, key, count); + } catch (err) { + throw new Error(`Method getAllFromIndex has error: ${err.message}`); + } + } + async getItem({ storeName, key }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + const store = this.db.transaction(storeName).objectStore(storeName); + return await store.get(key); + } catch (err) { + throw new Error(`Method getItem has error: ${err.message}`); + } + } + async addItem({ storeName, data, key = "" }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + const tx = this.db.transaction(storeName, "readwrite"); + const isExist = await tx.objectStore(storeName).get(key); + if (!isExist) { + await tx.objectStore(storeName).add(data); + } + } catch (err) { + throw new Error(`Method addItem has error: ${err.message}`); + } + } + async putItem({ storeName, data, key }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + const tx = this.db.transaction(storeName, "readwrite"); + await tx.objectStore(storeName).put(data, key); + } catch (err) { + throw new Error(`Method putItem has error: ${err.message}`); + } + } + async deleteItem({ storeName, key }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + const tx = this.db.transaction(storeName, "readwrite"); + await tx.objectStore(storeName).delete(key); + } catch (err) { + throw new Error(`Method deleteItem has error: ${err.message}`); + } + } + async getAll({ storeName }) { + await this.initDB(); + if (!this.db) { + return []; + } + try { + const tx = this.db.transaction(storeName, "readonly"); + return await tx.objectStore(storeName).getAll(); + } catch (err) { + throw new Error(`Method getAll has error: ${err.message}`); + } + } + /** + * Simple key-value store inspired by idb-keyval package + */ + getValue(key) { + return this.getItem({ storeName: "keyval", key }); + } + setValue(key, data) { + return this.putItem({ storeName: "keyval", key, data }); + } + delValue(key) { + return this.deleteItem({ storeName: "keyval", key }); + } + async clearStore({ storeName, mode = "readwrite" }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + const tx = this.db.transaction(storeName, mode); + await tx.objectStore(storeName).clear(); + } catch (err) { + throw new Error(`Method clearStore has error: ${err.message}`); + } + } + async createTransactions({ + storeName, + data, + mode = "readwrite" + }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + const tx = this.db.transaction(storeName, mode); + await tx.objectStore(storeName).add(data); + await tx.done; + } catch (err) { + throw new Error(`Method createTransactions has error: ${err.message}`); + } + } + async createMultipleTransactions({ + storeName, + data, + index, + mode = "readwrite" + }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + const tx = this.db.transaction(storeName, mode); + for (const item of data) { + if (item) { + await tx.store.put({ ...item, ...index }); + } + } + } catch (err) { + throw new Error(`Method createMultipleTransactions has error: ${err.message}`); + } + } +} +async function getIndexedDB(netId) { + if (!netId) { + const idb2 = new IndexedDB({ dbName: "tornado-core" }); + await idb2.initDB(); + return idb2; + } + const minimalIndexes = [ + { + name: "blockNumber", + unique: false + }, + { + name: "transactionHash", + unique: false + } + ]; + const defaultState = [ + { + name: `echo_${netId}`, + keyPath: "eid", + indexes: [ + ...minimalIndexes, + { + name: "address", + unique: false + } + ] + }, + { + name: `encrypted_notes_${netId}`, + keyPath: "eid", + indexes: minimalIndexes + }, + { + name: "lastEvents", + keyPath: "name", + indexes: [ + { + name: "name", + unique: false + } + ] + } + ]; + const config = getConfig(netId); + const { tokens, nativeCurrency, registryContract, governanceContract } = config; + const stores = [...defaultState]; + if (registryContract) { + stores.push({ + name: `registry_${netId}`, + keyPath: "ensName", + indexes: [ + ...minimalIndexes, + { + name: "event", + unique: false + } + ] + }); + stores.push({ + name: `relayers_${netId}`, + keyPath: "timestamp", + indexes: [ + { + name: "timestamp", + unique: true + } + ] + }); + stores.push({ + name: `revenue_${netId}`, + keyPath: "timestamp", + indexes: [ + { + name: "timestamp", + unique: true + } + ] + }); + } + if (governanceContract) { + stores.push({ + name: `governance_${netId}`, + keyPath: "eid", + indexes: [ + ...minimalIndexes, + { + name: "event", + unique: false + } + ] + }); + } + Object.entries(tokens).forEach(([token, { instanceAddress }]) => { + Object.keys(instanceAddress).forEach((amount) => { + if (nativeCurrency === token) { + stores.push( + { + name: `stringify_bloom_${netId}_${token}_${amount}`, + keyPath: "hashBloom", + indexes: [] + }, + { + name: `stringify_tree_${netId}_${token}_${amount}`, + keyPath: "hashTree", + indexes: [] + } + ); + } + stores.push( + { + name: `deposits_${netId}_${token}_${amount}`, + keyPath: "leafIndex", + // the key by which it refers to the object must be in all instances of the storage + indexes: [ + ...minimalIndexes, + { + name: "commitment", + unique: true + } + ] + }, + { + name: `withdrawals_${netId}_${token}_${amount}`, + keyPath: "eid", + indexes: [ + ...minimalIndexes, + { + name: "nullifierHash", + unique: true + } + // keys on which the index is created + ] + } + ); + }); + }); + const idb = new IndexedDB({ + dbName: `tornado_core_${netId}`, + stores + }); + await idb.initDB(); + return idb; +} + +async function fetchIp(ipEcho) { + return await fetchData(ipEcho, { + method: "GET", + timeout: 3e4 + }); +} + class Mimc { + sponge; + hash; + mimcPromise; constructor() { this.mimcPromise = this.initMimc(); } - initMimc() { - return __async$5(this, null, function* () { - this.sponge = yield buildMimcSponge(); - this.hash = (left, right) => { - var _a, _b; - return (_b = this.sponge) == null ? void 0 : _b.F.toString((_a = this.sponge) == null ? void 0 : _a.multiHash([BigInt(left), BigInt(right)])); - }; - }); + async initMimc() { + this.sponge = await buildMimcSponge(); + this.hash = (left, right) => this.sponge?.F.toString(this.sponge?.multiHash([BigInt(left), BigInt(right)])); } - getHash() { - return __async$5(this, null, function* () { - yield this.mimcPromise; - return { - sponge: this.sponge, - hash: this.hash - }; - }); + async getHash() { + await this.mimcPromise; + return { + sponge: this.sponge, + hash: this.hash + }; } } const mimc = new Mimc(); -var __async$4 = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; class MerkleTreeService { + currency; + amount; + netId; + Tornado; + commitmentHex; + instanceName; + merkleTreeHeight; + emptyElement; + merkleWorkerPath; constructor({ netId, amount, @@ -6214,606 +9871,737 @@ class MerkleTreeService { this.emptyElement = emptyElement; this.merkleWorkerPath = merkleWorkerPath; } - createTree(events) { - return __async$4(this, null, function* () { - const { hash: hashFunction } = yield mimc.getHash(); - if (this.merkleWorkerPath) { - console.log("Using merkleWorker\n"); - try { - if (isNode) { - const merkleWorkerPromise = new Promise((resolve, reject) => { - const worker = new Worker$1(this.merkleWorkerPath, { - workerData: { - merkleTreeHeight: this.merkleTreeHeight, - elements: events, - zeroElement: this.emptyElement - } - }); - worker.on("message", resolve); - worker.on("error", reject); - worker.on("exit", (code) => { - if (code !== 0) { - reject(new Error(`Worker stopped with exit code ${code}`)); - } - }); - }); - return MerkleTree.deserialize(JSON.parse(yield merkleWorkerPromise), hashFunction); - } else { - const merkleWorkerPromise = new Promise((resolve, reject) => { - const worker = new Worker(this.merkleWorkerPath); - worker.onmessage = (e) => { - resolve(e.data); - }; - worker.onerror = (e) => { - reject(e); - }; - worker.postMessage({ + async createTree(events) { + const { hash: hashFunction } = await mimc.getHash(); + if (this.merkleWorkerPath) { + console.log("Using merkleWorker\n"); + try { + if (isNode) { + const merkleWorkerPromise = new Promise((resolve, reject) => { + const worker = new Worker$1(this.merkleWorkerPath, { + workerData: { merkleTreeHeight: this.merkleTreeHeight, elements: events, zeroElement: this.emptyElement - }); + } }); - return MerkleTree.deserialize(JSON.parse(yield merkleWorkerPromise), hashFunction); - } - } catch (err) { - console.log("merkleWorker failed, falling back to synchronous merkle tree"); - console.log(err); + worker.on("message", resolve); + worker.on("error", reject); + worker.on("exit", (code) => { + if (code !== 0) { + reject(new Error(`Worker stopped with exit code ${code}`)); + } + }); + }); + return MerkleTree.deserialize(JSON.parse(await merkleWorkerPromise), hashFunction); + } else { + const merkleWorkerPromise = new Promise((resolve, reject) => { + const worker = new Worker(this.merkleWorkerPath); + worker.onmessage = (e) => { + resolve(e.data); + }; + worker.onerror = (e) => { + reject(e); + }; + worker.postMessage({ + merkleTreeHeight: this.merkleTreeHeight, + elements: events, + zeroElement: this.emptyElement + }); + }); + return MerkleTree.deserialize(JSON.parse(await merkleWorkerPromise), hashFunction); } + } catch (err) { + console.log("merkleWorker failed, falling back to synchronous merkle tree"); + console.log(err); } - return new MerkleTree(this.merkleTreeHeight, events, { - zeroElement: this.emptyElement, - hashFunction - }); + } + return new MerkleTree(this.merkleTreeHeight, events, { + zeroElement: this.emptyElement, + hashFunction }); } - createPartialTree(_0) { - return __async$4(this, arguments, function* ({ edge, elements }) { - const { hash: hashFunction } = yield mimc.getHash(); - if (this.merkleWorkerPath) { - console.log("Using merkleWorker\n"); - try { - if (isNode) { - const merkleWorkerPromise = new Promise((resolve, reject) => { - const worker = new Worker$1(this.merkleWorkerPath, { - workerData: { - merkleTreeHeight: this.merkleTreeHeight, - edge, - elements, - zeroElement: this.emptyElement - } - }); - worker.on("message", resolve); - worker.on("error", reject); - worker.on("exit", (code) => { - if (code !== 0) { - reject(new Error(`Worker stopped with exit code ${code}`)); - } - }); - }); - return PartialMerkleTree.deserialize(JSON.parse(yield merkleWorkerPromise), hashFunction); - } else { - const merkleWorkerPromise = new Promise((resolve, reject) => { - const worker = new Worker(this.merkleWorkerPath); - worker.onmessage = (e) => { - resolve(e.data); - }; - worker.onerror = (e) => { - reject(e); - }; - worker.postMessage({ + async createPartialTree({ edge, elements }) { + const { hash: hashFunction } = await mimc.getHash(); + if (this.merkleWorkerPath) { + console.log("Using merkleWorker\n"); + try { + if (isNode) { + const merkleWorkerPromise = new Promise((resolve, reject) => { + const worker = new Worker$1(this.merkleWorkerPath, { + workerData: { merkleTreeHeight: this.merkleTreeHeight, edge, elements, zeroElement: this.emptyElement - }); + } }); - return PartialMerkleTree.deserialize(JSON.parse(yield merkleWorkerPromise), hashFunction); - } - } catch (err) { - console.log("merkleWorker failed, falling back to synchronous merkle tree"); - console.log(err); + worker.on("message", resolve); + worker.on("error", reject); + worker.on("exit", (code) => { + if (code !== 0) { + reject(new Error(`Worker stopped with exit code ${code}`)); + } + }); + }); + return PartialMerkleTree.deserialize(JSON.parse(await merkleWorkerPromise), hashFunction); + } else { + const merkleWorkerPromise = new Promise((resolve, reject) => { + const worker = new Worker(this.merkleWorkerPath); + worker.onmessage = (e) => { + resolve(e.data); + }; + worker.onerror = (e) => { + reject(e); + }; + worker.postMessage({ + merkleTreeHeight: this.merkleTreeHeight, + edge, + elements, + zeroElement: this.emptyElement + }); + }); + return PartialMerkleTree.deserialize(JSON.parse(await merkleWorkerPromise), hashFunction); } + } catch (err) { + console.log("merkleWorker failed, falling back to synchronous merkle tree"); + console.log(err); } - return new PartialMerkleTree(this.merkleTreeHeight, edge, elements, { - zeroElement: this.emptyElement, - hashFunction - }); + } + return new PartialMerkleTree(this.merkleTreeHeight, edge, elements, { + zeroElement: this.emptyElement, + hashFunction }); } - verifyTree(events) { - return __async$4(this, null, function* () { - console.log( - ` + async verifyTree(events) { + console.log( + ` Creating deposit tree for ${this.netId} ${this.amount} ${this.currency.toUpperCase()} would take a while ` - ); - console.time("Created tree in"); - const tree = yield this.createTree(events.map(({ commitment }) => commitment)); - console.timeEnd("Created tree in"); - console.log(""); - const isKnownRoot = yield this.Tornado.isKnownRoot(toFixedHex(BigInt(tree.root))); - if (!isKnownRoot) { - const errMsg = `Deposit Event ${this.netId} ${this.amount} ${this.currency} is invalid`; - throw new Error(errMsg); - } - return tree; - }); + ); + const timeStart = Date.now(); + const tree = await this.createTree(events.map(({ commitment }) => commitment)); + const isKnownRoot = await this.Tornado.isKnownRoot(toFixedHex(BigInt(tree.root))); + if (!isKnownRoot) { + const errMsg = `Deposit Event ${this.netId} ${this.amount} ${this.currency} is invalid`; + throw new Error(errMsg); + } + console.log( + ` +Created ${this.netId} ${this.amount} ${this.currency.toUpperCase()} tree in ${Date.now() - timeStart}ms +` + ); + return tree; } } -var __async$3 = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } +async function multicall(Multicall2, calls) { + const calldata = calls.map((call) => { + const target = call.contract?.target || call.address; + const callInterface = call.contract?.interface || call.interface; + return { + target, + callData: callInterface.encodeFunctionData(call.name, call.params), + allowFailure: call.allowFailure ?? false }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); }); -}; + const returnData = await Multicall2.aggregate3.staticCall(calldata); + const res = returnData.map((call, i) => { + const callInterface = calls[i].contract?.interface || calls[i].interface; + const [result, data] = call; + const decodeResult = result && data && data !== "0x" ? callInterface.decodeFunctionResult(calls[i].name, data) : null; + return !decodeResult ? null : decodeResult.length === 1 ? decodeResult[0] : decodeResult; + }); + return res; +} + +const permit2Address = "0x000000000022D473030F116dDEE9F6B43aC78BA3"; +async function getPermitSignature({ + Token, + signer, + spender, + value, + nonce, + deadline +}) { + const sigSigner = signer || Token.runner; + const provider = sigSigner.provider; + const [name, lastNonce, { chainId }] = await Promise.all([ + Token.name(), + Token.nonces(sigSigner.address), + provider.getNetwork() + ]); + const DOMAIN_SEPARATOR = { + name, + version: "1", + chainId, + verifyingContract: Token.target + }; + const PERMIT_TYPE = { + Permit: [ + { name: "owner", type: "address" }, + { name: "spender", type: "address" }, + { name: "value", type: "uint256" }, + { name: "nonce", type: "uint256" }, + { name: "deadline", type: "uint256" } + ] + }; + return Signature.from( + await sigSigner.signTypedData(DOMAIN_SEPARATOR, PERMIT_TYPE, { + owner: sigSigner.address, + spender, + value, + nonce: nonce || lastNonce, + deadline: deadline || MaxUint256 + }) + ); +} +async function getPermitCommitmentsSignature({ + PermitTornado: PermitTornado2, + Token, + signer, + denomination, + commitments, + nonce +}) { + const value = BigInt(commitments.length) * denomination; + const commitmentsHash = solidityPackedKeccak256(["bytes32[]"], [commitments]); + return await getPermitSignature({ + Token, + signer, + spender: PermitTornado2.target, + value, + nonce, + deadline: BigInt(commitmentsHash) + }); +} +async function getPermit2Signature({ + Token, + signer, + spender, + value: amount, + nonce, + deadline, + witness +}) { + const sigSigner = signer || Token.runner; + const provider = sigSigner.provider; + const domain = { + name: "Permit2", + chainId: (await provider.getNetwork()).chainId, + verifyingContract: permit2Address + }; + const types = !witness ? { + PermitTransferFrom: [ + { name: "permitted", type: "TokenPermissions" }, + { name: "spender", type: "address" }, + { name: "nonce", type: "uint256" }, + { name: "deadline", type: "uint256" } + ], + TokenPermissions: [ + { name: "token", type: "address" }, + { name: "amount", type: "uint256" } + ] + } : { + PermitWitnessTransferFrom: [ + { name: "permitted", type: "TokenPermissions" }, + { name: "spender", type: "address" }, + { name: "nonce", type: "uint256" }, + { name: "deadline", type: "uint256" }, + { name: "witness", type: witness.witnessTypeName } + ], + TokenPermissions: [ + { name: "token", type: "address" }, + { name: "amount", type: "uint256" } + ], + ...witness.witnessType + }; + const values = { + permitted: { + token: Token.target, + amount + }, + spender, + // Sorted nonce are not required for Permit2 + nonce: nonce || rBigInt(16), + deadline: deadline || MaxUint256 + }; + if (witness) { + values.witness = witness.witness; + } + const hash = new TypedDataEncoder(types).hash(values); + const signature = Signature.from(await sigSigner.signTypedData(domain, types, values)); + return { + domain, + types, + values, + hash, + signature + }; +} +async function getPermit2CommitmentsSignature({ + PermitTornado: PermitTornado2, + Token, + signer, + denomination, + commitments, + nonce, + deadline +}) { + const value = BigInt(commitments.length) * denomination; + const commitmentsHash = solidityPackedKeccak256(["bytes32[]"], [commitments]); + return await getPermit2Signature({ + Token, + signer, + spender: PermitTornado2.target, + value, + nonce, + deadline, + witness: { + witnessTypeName: "PermitCommitments", + witnessType: { + PermitCommitments: [ + { name: "instance", type: "address" }, + { name: "commitmentsHash", type: "bytes32" } + ] + }, + witness: { + instance: PermitTornado2.target, + commitmentsHash + } + } + }); +} + class TokenPriceOracle { + oracle; + multicall; + provider; + fallbackPrice; constructor(provider, multicall2, oracle) { this.provider = provider; this.multicall = multicall2; this.oracle = oracle; + this.fallbackPrice = parseEther("0.0001"); } - fetchPrices(tokens) { - return __async$3(this, null, function* () { - if (!this.oracle) { - return new Promise((resolve) => resolve(tokens.map(() => parseEther("0.0001")))); + buildCalls(tokens) { + return tokens.map(({ tokenAddress }) => ({ + contract: this.oracle, + name: "getRateToEth", + params: [tokenAddress, true], + allowFailure: true + })); + } + buildStable(stablecoinAddress) { + const stablecoin = ERC20__factory.connect(stablecoinAddress, this.provider); + return [ + { + contract: stablecoin, + name: "decimals" + }, + { + contract: this.oracle, + name: "getRateToEth", + params: [stablecoin.target, true], + allowFailure: true } - const prices = yield multicall( - this.multicall, - tokens.map(({ tokenAddress }) => ({ - contract: this.oracle, - name: "getRateToEth", - params: [tokenAddress, true] - })) + ]; + } + async fetchPrice(tokenAddress, decimals) { + if (!this.oracle) { + return new Promise((resolve) => resolve(this.fallbackPrice)); + } + try { + const price = await this.oracle.getRateToEth(tokenAddress, true); + return price * BigInt(10 ** decimals) / BigInt(10 ** 18); + } catch (err) { + console.log( + `Failed to fetch oracle price for ${tokenAddress}, will use fallback price ${this.fallbackPrice}` ); - return prices.map((price, index) => { - return price * BigInt(10 ** tokens[index].decimals) / BigInt(10 ** 18); - }); + console.log(err); + return this.fallbackPrice; + } + } + async fetchPrices(tokens) { + if (!this.oracle) { + return new Promise((resolve) => resolve(tokens.map(() => this.fallbackPrice))); + } + const prices = await multicall(this.multicall, this.buildCalls(tokens)); + return prices.map((price, index) => { + if (!price) { + price = this.fallbackPrice; + } + return price * BigInt(10 ** tokens[index].decimals) / BigInt(10 ** 18); }); } + async fetchEthUSD(stablecoinAddress) { + if (!this.oracle) { + return new Promise((resolve) => resolve(10 ** 18 / Number(this.fallbackPrice))); + } + const [decimals, price] = await multicall(this.multicall, this.buildStable(stablecoinAddress)); + const ethPrice = (price || this.fallbackPrice) * BigInt(10n ** decimals) / BigInt(10 ** 18); + return 1 / Number(formatEther(ethPrice)); + } } -var __defProp = Object.defineProperty; -var __defProps = Object.defineProperties; -var __getOwnPropDescs = Object.getOwnPropertyDescriptors; -var __getOwnPropSymbols = Object.getOwnPropertySymbols; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __propIsEnum = Object.prototype.propertyIsEnumerable; -var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __spreadValues = (a, b) => { - for (var prop in b || (b = {})) - if (__hasOwnProp.call(b, prop)) - __defNormalProp(a, prop, b[prop]); - if (__getOwnPropSymbols) - for (var prop of __getOwnPropSymbols(b)) { - if (__propIsEnum.call(b, prop)) - __defNormalProp(a, prop, b[prop]); - } - return a; -}; -var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); -var __async$2 = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); +async function getTokenBalances({ + provider, + Multicall: Multicall2, + currencyName, + userAddress, + tokenAddresses = [] +}) { + const tokenCalls = tokenAddresses.map((tokenAddress) => { + const Token = ERC20__factory.connect(tokenAddress, provider); + return [ + { + contract: Token, + name: "balanceOf", + params: [userAddress] + }, + { + contract: Token, + name: "name" + }, + { + contract: Token, + name: "symbol" + }, + { + contract: Token, + name: "decimals" } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; -const MIN_STAKE_BALANCE = parseEther("500"); -const semVerRegex = new RegExp("^(?0|[1-9]\\d*)\\.(?0|[1-9]\\d*)\\.(?0|[1-9]\\d*)(?:-(?(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+(?[0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"); -function parseSemanticVersion(version) { - const { groups } = semVerRegex.exec(version); - return groups; -} -function isRelayerUpdated(relayerVersion, netId) { - const { major, patch, prerelease } = parseSemanticVersion(relayerVersion); - const requiredMajor = netId === NetId.MAINNET ? "4" : "5"; - const isUpdatedMajor = major === requiredMajor; - if (prerelease) - return false; - return isUpdatedMajor && (Number(patch) >= 5 || netId !== NetId.MAINNET); -} -function calculateScore({ stakeBalance, tornadoServiceFee }, minFee = 0.33, maxFee = 0.53) { - if (tornadoServiceFee < minFee) { - tornadoServiceFee = minFee; - } else if (tornadoServiceFee >= maxFee) { - return BigInt(0); - } - const serviceFeeCoefficient = (tornadoServiceFee - minFee) ** 2; - const feeDiffCoefficient = 1 / (maxFee - minFee) ** 2; - const coefficientsMultiplier = 1 - feeDiffCoefficient * serviceFeeCoefficient; - return BigInt(Math.floor(Number(stakeBalance) * coefficientsMultiplier)); -} -function getWeightRandom(weightsScores, random) { - for (let i = 0; i < weightsScores.length; i++) { - if (random < weightsScores[i]) { - return i; - } - random = random - weightsScores[i]; - } - return Math.floor(Math.random() * weightsScores.length); -} -function getSupportedInstances(instanceList) { - const rawList = Object.values(instanceList).map(({ instanceAddress }) => { - return Object.values(instanceAddress); + ]; }).flat(); - return rawList.map((l) => getAddress(l)); + const multicallResults = await multicall(Multicall2, [ + { + contract: Multicall2, + name: "getEthBalance", + params: [userAddress] + }, + ...tokenCalls.length ? tokenCalls : [] + ]); + const ethResults = multicallResults[0]; + const tokenResults = multicallResults.slice(1).length ? chunk(multicallResults.slice(1), tokenCalls.length / tokenAddresses.length) : []; + const tokenBalances = tokenResults.map((tokenResult, index) => { + const [tokenBalance, tokenName, tokenSymbol, tokenDecimals] = tokenResult; + const tokenAddress = tokenAddresses[index]; + return { + address: tokenAddress, + name: tokenName, + symbol: tokenSymbol, + decimals: Number(tokenDecimals), + balance: tokenBalance + }; + }); + return [ + { + address: ZeroAddress, + name: currencyName, + symbol: currencyName, + decimals: 18, + balance: ethResults + }, + ...tokenBalances + ]; } -function pickWeightedRandomRelayer(relayers, netId) { - let minFee, maxFee; - if (netId !== NetId.MAINNET) { - minFee = 0.01; - maxFee = 0.3; + +const MAX_TOVARISH_EVENTS = 5e3; +class TovarishClient extends RelayerClient { + constructor(clientConstructor) { + super(clientConstructor); + this.tovarish = true; } - const weightsScores = relayers.map((el) => calculateScore(el, minFee, maxFee)); - const totalWeight = weightsScores.reduce((acc, curr) => { - return acc = acc + curr; - }, BigInt("0")); - const random = BigInt(Number(totalWeight) * Math.random()); - const weightRandomIndex = getWeightRandom(weightsScores, random); - return relayers[weightRandomIndex]; -} -class RelayerClient { - constructor({ netId, config, Aggregator, fetchDataOptions: fetchDataOptions2 }) { - this.netId = netId; - this.config = config; - this.Aggregator = Aggregator; - this.fetchDataOptions = fetchDataOptions2; - } - askRelayerStatus(_0) { - return __async$2(this, arguments, function* ({ + async askRelayerStatus({ + hostname, + url, + relayerAddress + }) { + const status = await super.askRelayerStatus({ hostname, + url, relayerAddress - }) { - var _a, _b; - const url = `https://${!hostname.endsWith("/") ? hostname + "/" : hostname}`; - const rawStatus = yield fetchData(`${url}status`, __spreadProps(__spreadValues({}, this.fetchDataOptions), { - headers: { - "Content-Type": "application/json, application/x-www-form-urlencoded" - }, - timeout: ((_a = this.fetchDataOptions) == null ? void 0 : _a.torPort) ? 1e4 : 3e3, - maxRetry: ((_b = this.fetchDataOptions) == null ? void 0 : _b.torPort) ? 2 : 0 - })); - const statusValidator = ajv.compile(getStatusSchema(this.netId, this.config)); - if (!statusValidator(rawStatus)) { - throw new Error("Invalid status schema"); + }); + if (!status.version.includes("tovarish")) { + throw new Error("Not a tovarish relayer!"); + } + return status; + } + /** + * Ask status for all enabled chains for tovarish relayer + */ + async askAllStatus({ + hostname, + url, + relayerAddress + }) { + if (!url && hostname) { + url = `https://${!hostname.endsWith("/") ? hostname + "/" : hostname}`; + } else if (url && !url.endsWith("/")) { + url += "/"; + } else { + url = ""; + } + const statusArray = await fetchData(`${url}status`, { + ...this.fetchDataOptions, + headers: { + "Content-Type": "application/json, application/x-www-form-urlencoded" + }, + timeout: 3e4, + maxRetry: this.fetchDataOptions?.torPort ? 2 : 0 + }); + if (!Array.isArray(statusArray)) { + return []; + } + const tovarishStatus = []; + for (const rawStatus of statusArray) { + const netId = rawStatus.netId; + const config = getConfig(netId); + const statusValidator = ajv.compile( + getStatusSchema( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + rawStatus.netId, + config, + this.tovarish + ) + ); + if (!statusValidator) { + continue; } - const status = __spreadProps(__spreadValues({}, rawStatus), { - url - }); + const status = { + ...rawStatus, + url: `${url}${netId}/` + }; if (status.currentQueue > 5) { throw new Error("Withdrawal queue is overloaded"); } - if (status.netId !== this.netId) { + if (!enabledChains.includes(status.netId)) { throw new Error("This relayer serves a different network"); } - if (relayerAddress && this.netId === NetId.MAINNET && status.rewardAccount !== relayerAddress) { + if (relayerAddress && status.netId === NetId.MAINNET && status.rewardAccount !== relayerAddress) { throw new Error("The Relayer reward address must match registered address"); } - if (!isRelayerUpdated(status.version, this.netId)) { - throw new Error("Outdated version."); + if (!status.version.includes("tovarish")) { + throw new Error("Not a tovarish relayer!"); } - return status; - }); + tovarishStatus.push(status); + } + return tovarishStatus; } - filterRelayer(curr, relayer, subdomains, debugRelayer = false) { - return __async$2(this, null, function* () { - var _a; - const { relayerEnsSubdomain } = this.config; - const subdomainIndex = subdomains.indexOf(relayerEnsSubdomain); - const mainnetSubdomain = curr.records[0]; - const hostname = curr.records[subdomainIndex]; - const isHostWithProtocol = hostname.includes("http"); - const { owner, balance: stakeBalance, isRegistered } = curr; - const { ensName, relayerAddress } = relayer; - const isOwner = !relayerAddress || relayerAddress === owner; - const hasMinBalance = stakeBalance >= MIN_STAKE_BALANCE; - const preCondition = hostname && isOwner && mainnetSubdomain && isRegistered && hasMinBalance && !isHostWithProtocol; - if (preCondition || debugRelayer) { - try { - const status = yield this.askRelayerStatus({ hostname, relayerAddress }); - return { - netId: status.netId, - url: status.url, - hostname, - ensName, - stakeBalance, - relayerAddress, - rewardAccount: getAddress(status.rewardAccount), - instances: getSupportedInstances(status.instances), - gasPrice: (_a = status.gasPrices) == null ? void 0 : _a.fast, - ethPrices: status.ethPrices, - currentQueue: status.currentQueue, - tornadoServiceFee: status.tornadoServiceFee - }; - } catch (err) { - if (debugRelayer) { - throw err; - } - return { - hostname, - relayerAddress, - errorMessage: err.message - }; - } - } else { - if (debugRelayer) { - const errMsg = `Relayer ${hostname} condition not met`; - throw new Error(errMsg); - } - return { - hostname, - relayerAddress, - errorMessage: `Relayer ${hostname} condition not met` - }; - } - }); - } - getValidRelayers(relayers, subdomains, debugRelayer = false) { - return __async$2(this, null, function* () { - const relayersSet = /* @__PURE__ */ new Set(); - const uniqueRelayers = relayers.reverse().filter(({ ensName }) => { - if (!relayersSet.has(ensName)) { - relayersSet.add(ensName); - return true; - } - return false; + async filterRelayer(relayer) { + const { ensName, relayerAddress, tovarishHost, tovarishNetworks } = relayer; + if (!tovarishHost || !tovarishNetworks?.includes(this.netId)) { + return; + } + const hostname = `${tovarishHost}/${this.netId}`; + try { + const status = await this.askRelayerStatus({ + hostname, + relayerAddress }); - const relayerNameHashes = uniqueRelayers.map((r) => namehash(r.ensName)); - const relayersData = yield this.Aggregator.relayersData.staticCall(relayerNameHashes, subdomains); - const invalidRelayers = []; - const validRelayers = (yield Promise.all( - relayersData.map((curr, index) => this.filterRelayer(curr, uniqueRelayers[index], subdomains, debugRelayer)) - )).filter((r) => { - if (r.errorMessage) { + return { + netId: status.netId, + url: status.url, + hostname, + ensName, + relayerAddress, + rewardAccount: getAddress(status.rewardAccount), + instances: getSupportedInstances(status.instances), + stakeBalance: relayer.stakeBalance, + gasPrice: status.gasPrices?.fast, + ethPrices: status.ethPrices, + currentQueue: status.currentQueue, + tornadoServiceFee: status.tornadoServiceFee, + // Additional fields for tovarish relayer + latestBlock: Number(status.latestBlock), + latestBalance: status.latestBalance, + version: status.version, + events: status.events, + syncStatus: status.syncStatus + }; + } catch (err) { + return { + hostname, + relayerAddress, + errorMessage: err.message, + hasError: true + }; + } + } + async getValidRelayers(relayers) { + const invalidRelayers = []; + const validRelayers = (await Promise.all(relayers.map((relayer) => this.filterRelayer(relayer)))).filter( + (r) => { + if (!r) { + return false; + } + if (r.hasError) { invalidRelayers.push(r); return false; } return true; - }); - return { - validRelayers, - invalidRelayers - }; - }); - } - pickWeightedRandomRelayer(relayers) { - return pickWeightedRandomRelayer(relayers, this.netId); - } - tornadoWithdraw(_0) { - return __async$2(this, arguments, function* ({ contract, proof, args }) { - const { url } = this.selectedRelayer; - const withdrawResponse = yield fetchData(`${url}v1/tornadoWithdraw`, __spreadProps(__spreadValues({}, this.fetchDataOptions), { - method: "POST", - headers: { - "Content-Type": "application/json" - }, - body: JSON.stringify({ - contract, - proof, - args - }) - })); - const { id, error } = withdrawResponse; - if (error) { - throw new Error(error); } - let relayerStatus; - const jobUrl = `${url}v1/jobs/${id}`; - console.log(`Job submitted: ${jobUrl} -`); - while (!relayerStatus || !["FAILED", "CONFIRMED"].includes(relayerStatus)) { - const jobResponse = yield fetchData(jobUrl, __spreadProps(__spreadValues({}, this.fetchDataOptions), { - method: "GET", + ); + return { + validRelayers, + invalidRelayers + }; + } + async getTovarishRelayers(relayers) { + const validRelayers = []; + const invalidRelayers = []; + await Promise.all( + relayers.filter((r) => r.tovarishHost && r.tovarishNetworks?.length).map(async (relayer) => { + const { ensName, relayerAddress, tovarishHost } = relayer; + try { + const statusArray = await this.askAllStatus({ + hostname: tovarishHost, + relayerAddress + }); + for (const status of statusArray) { + validRelayers.push({ + netId: status.netId, + url: status.url, + hostname: tovarishHost, + ensName, + relayerAddress, + rewardAccount: getAddress(status.rewardAccount), + instances: getSupportedInstances(status.instances), + stakeBalance: relayer.stakeBalance, + gasPrice: status.gasPrices?.fast, + ethPrices: status.ethPrices, + currentQueue: status.currentQueue, + tornadoServiceFee: status.tornadoServiceFee, + // Additional fields for tovarish relayer + latestBlock: Number(status.latestBlock), + latestBalance: status.latestBalance, + version: status.version, + events: status.events, + syncStatus: status.syncStatus + }); + } + } catch (err) { + invalidRelayers.push({ + hostname: tovarishHost, + relayerAddress, + errorMessage: err.message, + hasError: true + }); + } + }) + ); + return { + validRelayers, + invalidRelayers + }; + } + async getEvents({ + type, + currency, + amount, + fromBlock, + recent + }) { + const url = `${this.selectedRelayer?.url}events`; + const schemaValidator = getEventsSchemaValidator(type); + try { + const events = []; + let lastSyncBlock = fromBlock; + while (true) { + let { events: fetchedEvents, lastSyncBlock: currentBlock } = await fetchData(url, { + ...this.fetchDataOptions, + method: "POST", headers: { "Content-Type": "application/json" - } - })); - if (jobResponse.error) { - throw new Error(error); - } - const jobValidator = ajv.compile(jobsSchema); - if (!jobValidator(jobResponse)) { - const errMsg = `${jobUrl} has an invalid job response`; + }, + body: JSON.stringify({ + type, + currency, + amount, + fromBlock, + recent + }) + }); + if (!schemaValidator(fetchedEvents)) { + const errMsg = `Schema validation failed for ${type} events`; throw new Error(errMsg); } - const { status, txHash, confirmations, failedReason } = jobResponse; - if (relayerStatus !== status) { - if (status === "FAILED") { - const errMsg = `Job ${status}: ${jobUrl} failed reason: ${failedReason}`; - throw new Error(errMsg); - } else if (status === "SENT") { - console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash} -`); - } else if (status === "MINED") { - console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash}, confirmations: ${confirmations} -`); - } else if (status === "CONFIRMED") { - console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash}, confirmations: ${confirmations} -`); - } else { - console.log(`Job ${status}: ${jobUrl} -`); - } - relayerStatus = status; + if (recent) { + return { + events: fetchedEvents, + lastSyncBlock: currentBlock + }; } - yield sleep(3e3); + lastSyncBlock = currentBlock; + if (!Array.isArray(fetchedEvents) || !fetchedEvents.length) { + break; + } + fetchedEvents = fetchedEvents.sort((a, b) => { + if (a.blockNumber === b.blockNumber) { + return a.logIndex - b.logIndex; + } + return a.blockNumber - b.blockNumber; + }); + const [lastEvent] = fetchedEvents.slice(-1); + if (fetchedEvents.length < MAX_TOVARISH_EVENTS - 100) { + events.push(...fetchedEvents); + break; + } + fetchedEvents = fetchedEvents.filter((e) => e.blockNumber !== lastEvent.blockNumber); + fromBlock = Number(lastEvent.blockNumber); + events.push(...fetchedEvents); } - }); + return { + events, + lastSyncBlock + }; + } catch (err) { + console.log("Error from TovarishClient events endpoint"); + console.log(err); + return { + events: [], + lastSyncBlock: fromBlock + }; + } } } -var __async$1 = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; -function getTokenBalances(_0) { - return __async$1(this, arguments, function* ({ - provider, - Multicall: Multicall2, - currencyName, - userAddress, - tokenAddresses = [] - }) { - const tokenCalls = tokenAddresses.map((tokenAddress) => { - const Token = ERC20__factory.connect(tokenAddress, provider); - return [ - { - contract: Token, - name: "balanceOf", - params: [userAddress] - }, - { - contract: Token, - name: "name" - }, - { - contract: Token, - name: "symbol" - }, - { - contract: Token, - name: "decimals" - } - ]; - }).flat(); - const multicallResults = yield multicall(Multicall2, [ - { - contract: Multicall2, - name: "getEthBalance", - params: [userAddress] - }, - ...tokenCalls.length ? tokenCalls : [] - ]); - const ethResults = multicallResults[0]; - const tokenResults = multicallResults.slice(1).length ? chunk(multicallResults.slice(1), tokenCalls.length / tokenAddresses.length) : []; - const tokenBalances = tokenResults.map((tokenResult, index) => { - const [tokenBalance, tokenName, tokenSymbol, tokenDecimals] = tokenResult; - const tokenAddress = tokenAddresses[index]; - return { - address: tokenAddress, - name: tokenName, - symbol: tokenSymbol, - decimals: Number(tokenDecimals), - balance: tokenBalance - }; - }); - return [ - { - address: ZeroAddress, - name: currencyName, - symbol: currencyName, - decimals: 18, - balance: ethResults - }, - ...tokenBalances - ]; - }); -} - -var __async = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; let groth16; -function initGroth16() { - return __async(this, null, function* () { - if (!groth16) { - groth16 = yield websnarkGroth({ wasmInitialMemory: 2e3 }); - } - }); +async function initGroth16() { + if (!groth16) { + groth16 = await websnarkGroth({ wasmInitialMemory: 2e3 }); + } } -function calculateSnarkProof(input, circuit, provingKey) { - return __async(this, null, function* () { - if (!groth16) { - yield initGroth16(); - } - const snarkInput = { - root: input.root, - nullifierHash: BigInt(input.nullifierHex).toString(), - recipient: BigInt(input.recipient), - relayer: BigInt(input.relayer), - fee: input.fee, - refund: input.refund, - nullifier: input.nullifier, - secret: input.secret, - pathElements: input.pathElements, - pathIndices: input.pathIndices - }; - console.log("Start generating SNARK proof", snarkInput); - console.time("SNARK proof time"); - const proofData = yield websnarkUtils.genWitnessAndProve(yield groth16, snarkInput, circuit, provingKey); - const proof = websnarkUtils.toSolidityInput(proofData).proof; - console.timeEnd("SNARK proof time"); - const args = [ - toFixedHex(input.root, 32), - toFixedHex(input.nullifierHex, 32), - input.recipient, - input.relayer, - toFixedHex(input.fee, 32), - toFixedHex(input.refund, 32) - ]; - return { proof, args }; - }); +async function calculateSnarkProof(input, circuit, provingKey) { + if (!groth16) { + await initGroth16(); + } + const snarkInput = { + root: input.root, + nullifierHash: BigInt(input.nullifierHex).toString(), + recipient: BigInt(input.recipient), + relayer: BigInt(input.relayer), + fee: input.fee, + refund: input.refund, + nullifier: input.nullifier, + secret: input.secret, + pathElements: input.pathElements, + pathIndices: input.pathIndices + }; + console.log("Start generating SNARK proof", snarkInput); + console.time("SNARK proof time"); + const proofData = await websnarkUtils.genWitnessAndProve(await groth16, snarkInput, circuit, provingKey); + const proof = websnarkUtils.toSolidityInput(proofData).proof; + console.timeEnd("SNARK proof time"); + const args = [ + toFixedHex(input.root, 32), + toFixedHex(input.nullifierHex, 32), + input.recipient, + input.relayer, + toFixedHex(input.fee, 32), + toFixedHex(input.refund, 32) + ]; + return { proof, args }; } -export { BaseEchoService, BaseEncryptedNotesService, BaseEventsService, BaseGovernanceService, BaseRegistryService, BaseTornadoService, BatchBlockService, BatchEventsService, BatchTransactionService, DEPOSIT, Deposit, ENS__factory, ERC20__factory, GET_DEPOSITS, GET_ECHO_EVENTS, GET_ENCRYPTED_NOTES, GET_GOVERNANCE_APY, GET_GOVERNANCE_EVENTS, GET_NOTE_ACCOUNTS, GET_REGISTERED, GET_STATISTIC, GET_WITHDRAWALS, GasPriceOracle__factory, Invoice, MIN_STAKE_BALANCE, MerkleTreeService, Mimc, Multicall__factory, NetId, NoteAccount, OffchainOracle__factory, OvmGasPriceOracle__factory, Pedersen, RelayerClient, ReverseRecords__factory, TokenPriceOracle, TornadoBrowserProvider, TornadoFeeOracle, TornadoRpcSigner, TornadoVoidSigner, TornadoWallet, WITHDRAWAL, _META, addNetwork, ajv, base64ToBytes, bigIntReplacer, bnToBytes, buffPedersenHash, bufferToBytes, bytesToBN, bytesToBase64, bytesToHex, calculateScore, calculateSnarkProof, chunk, concatBytes, convertETHToTokenAmount, createDeposit, crypto, customConfig, defaultConfig, defaultUserAgent, enabledChains, index as factories, fetch, fetchData, fetchGetUrlFunc, getAllDeposits, getAllEncryptedNotes, getAllGovernanceEvents, getAllGraphEchoEvents, getAllRegisters, getAllWithdrawals, getConfig, getDeposits, getEncryptedNotes, getGasOraclePlugin, getGovernanceEvents, getGraphEchoEvents, getHttpAgent, getInstanceByAddress, getMeta, getNetworkConfig, getNoteAccounts, getProvider, getProviderWithNetId, getRegisters, getStatistic, getStatusSchema, getSubdomains, getSupportedInstances, getTokenBalances, getWeightRandom, getWithdrawals, hexToBytes, initGroth16, isNode, isRelayerUpdated, jobsSchema, leBuff2Int, leInt2Buff, mimc, multicall, packEncryptedMessage, parseSemanticVersion, pedersen, pickWeightedRandomRelayer, populateTransaction, queryGraph, rBigInt, sleep, substring, toFixedHex, toFixedLength, unpackEncryptedMessage, validateUrl }; +export { BaseEchoService, BaseEncryptedNotesService, BaseEventsService, BaseGovernanceService, BaseMultiTornadoService, BaseRegistryService, BaseRevenueService, BaseTornadoService, BatchBlockService, BatchEventsService, BatchTransactionService, DBEchoService, DBEncryptedNotesService, DBGovernanceService, DBRegistryService, DBRevenueService, DBTornadoService, Deposit, ENSNameWrapper__factory, ENSRegistry__factory, ENSResolver__factory, ENSUtils, ENS__factory, ERC20__factory, EnsContracts, INDEX_DB_ERROR, IndexedDB, Invoice, MAX_FEE, MAX_TOVARISH_EVENTS, MIN_FEE, MIN_STAKE_BALANCE, MerkleTreeService, Mimc, Multicall__factory, NetId, NoteAccount, OffchainOracle__factory, OvmGasPriceOracle__factory, Pedersen, RelayerClient, ReverseRecords__factory, TokenPriceOracle, TornadoBrowserProvider, TornadoFeeOracle, TornadoRpcSigner, TornadoVoidSigner, TornadoWallet, TovarishClient, addNetwork, addressSchemaType, ajv, base64ToBytes, bigIntReplacer, bnSchemaType, bnToBytes, buffPedersenHash, bufferToBytes, bytes32BNSchemaType, bytes32SchemaType, bytesToBN, bytesToBase64, bytesToHex, calculateScore, calculateSnarkProof, chunk, concatBytes, convertETHToTokenAmount, createDeposit, crypto, customConfig, defaultConfig, defaultUserAgent, deployHasher, depositsEventsSchema, digest, downloadZip, echoEventsSchema, enabledChains, encodedLabelToLabelhash, encryptedNotesSchema, index as factories, fetchData, fetchGetUrlFunc, fetchIp, fromContentHash, gasZipID, gasZipInbounds, gasZipInput, gasZipMinMax, getActiveTokenInstances, getActiveTokens, getConfig, getEventsSchemaValidator, getHttpAgent, getIndexedDB, getInstanceByAddress, getMultiInstances, getNetworkConfig, getPermit2CommitmentsSignature, getPermit2Signature, getPermitCommitmentsSignature, getPermitSignature, getProvider, getProviderWithNetId, getRelayerEnsSubdomains, getStatusSchema, getSubInfo, getSupportedInstances, getTokenBalances, getTovarishNetworks, getWeightRandom, governanceEventsSchema, hasherBytecode, hexToBytes, initGroth16, isHex, isNode, jobRequestSchema, jobsSchema, labelhash, leBuff2Int, leInt2Buff, loadDBEvents, loadRemoteEvents, makeLabelNodeAndParent, mimc, multiQueryFilter, multicall, numberFormatter, packEncryptedMessage, parseInvoice, parseNote, pedersen, permit2Address, pickWeightedRandomRelayer, populateTransaction, proofSchemaType, proposalState, rBigInt, rHex, relayerRegistryEventsSchema, saveDBEvents, sleep, stakeBurnedEventsSchema, substring, toContentHash, toFixedHex, toFixedLength, tornadoEventsSchema, unpackEncryptedMessage, unzipAsync, validateUrl, withdrawalsEventsSchema, zipAsync }; diff --git a/dist/ip.d.ts b/dist/ip.d.ts new file mode 100644 index 0000000..65c83e6 --- /dev/null +++ b/dist/ip.d.ts @@ -0,0 +1,6 @@ +export interface IPResult { + ip: string; + iso?: string; + tor?: boolean; +} +export declare function fetchIp(ipEcho: string): Promise; diff --git a/dist/merkleTree.d.ts b/dist/merkleTree.d.ts index 663ba99..f7e7453 100644 --- a/dist/merkleTree.d.ts +++ b/dist/merkleTree.d.ts @@ -3,13 +3,13 @@ import type { Tornado } from '@tornado/contracts'; import type { DepositType } from './deposits'; import type { DepositsEvents } from './events'; import type { NetIdType } from './networkConfig'; -export type MerkleTreeConstructor = DepositType & { +export interface MerkleTreeConstructor extends DepositType { Tornado: Tornado; commitmentHex?: string; merkleTreeHeight?: number; emptyElement?: string; merkleWorkerPath?: string; -}; +} export declare class MerkleTreeService { currency: string; amount: string; diff --git a/dist/merkleTreeWorker.js b/dist/merkleTreeWorker.js index 835b909..2d7356e 100644 --- a/dist/merkleTreeWorker.js +++ b/dist/merkleTreeWorker.js @@ -1,10 +1,7 @@ 'use strict'; -var threads = require('worker_threads'); -var crypto = require('crypto'); -var os = require('os'); -var URL = require('url'); -var VM = require('vm'); +var workerThreads = require('worker_threads'); +var ffjavascript = require('ffjavascript'); var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; @@ -16,18415 +13,511 @@ var lib = {}; var FixedMerkleTree = {}; -var simpleHash$1 = {}; +var simpleHash = {}; -Object.defineProperty(simpleHash$1, "__esModule", { value: true }); -simpleHash$1.simpleHash = void 0; -/*** - * This is insecure hash function, just for example only - * @param data - * @param seed - * @param hashLength - */ -function simpleHash(data, seed, hashLength = 40) { - const str = data.join(''); - let i, l, hval = seed !== null && seed !== void 0 ? seed : 0x811c9dcc5; - for (i = 0, l = str.length; i < l; i++) { - hval ^= str.charCodeAt(i); - hval += (hval << 1) + (hval << 4) + (hval << 6) + (hval << 8) + (hval << 24); - } - const hash = (hval >>> 0).toString(16); - return BigInt('0x' + hash.padEnd(hashLength - (hash.length - 1), '0')).toString(10); +var hasRequiredSimpleHash; + +function requireSimpleHash () { + if (hasRequiredSimpleHash) return simpleHash; + hasRequiredSimpleHash = 1; + Object.defineProperty(simpleHash, "__esModule", { value: true }); + simpleHash.simpleHash = void 0; + /*** + * This is insecure hash function, just for example only + * @param data + * @param seed + * @param hashLength + */ + function simpleHash$1(data, seed, hashLength = 40) { + const str = data.join(''); + let i, l, hval = seed !== null && seed !== void 0 ? seed : 0x811c9dcc5; + for (i = 0, l = str.length; i < l; i++) { + hval ^= str.charCodeAt(i); + hval += (hval << 1) + (hval << 4) + (hval << 6) + (hval << 8) + (hval << 24); + } + const hash = (hval >>> 0).toString(16); + return BigInt('0x' + hash.padEnd(hashLength - (hash.length - 1), '0')).toString(10); + } + simpleHash.simpleHash = simpleHash$1; + simpleHash.default = (left, right) => simpleHash$1([left, right]); + return simpleHash; } -simpleHash$1.simpleHash = simpleHash; -simpleHash$1.default = (left, right) => simpleHash([left, right]); -var BaseTree$1 = {}; +var BaseTree = {}; -Object.defineProperty(BaseTree$1, "__esModule", { value: true }); -BaseTree$1.BaseTree = void 0; -class BaseTree { - get capacity() { - return 2 ** this.levels; - } - get layers() { - return this._layers.slice(); - } - get zeros() { - return this._zeros.slice(); - } - get elements() { - return this._layers[0].slice(); - } - get root() { - var _a; - return (_a = this._layers[this.levels][0]) !== null && _a !== void 0 ? _a : this._zeros[this.levels]; - } - /** - * Find an element in the tree - * @param elements elements of tree - * @param element An element to find - * @param comparator A function that checks leaf value equality - * @param fromIndex The index to start the search at. If the index is greater than or equal to the array's length, -1 is returned - * @returns {number} Index if element is found, otherwise -1 - */ - static indexOf(elements, element, fromIndex, comparator) { - if (comparator) { - return elements.findIndex((el) => comparator(element, el)); - } - else { - return elements.indexOf(element, fromIndex); - } - } - /** - * Insert new element into the tree - * @param element Element to insert - */ - insert(element) { - if (this._layers[0].length >= this.capacity) { - throw new Error('Tree is full'); - } - this.update(this._layers[0].length, element); - } - /* - * Insert multiple elements into the tree. - * @param {Array} elements Elements to insert - */ - bulkInsert(elements) { - if (!elements.length) { - return; - } - if (this._layers[0].length + elements.length > this.capacity) { - throw new Error('Tree is full'); - } - // First we insert all elements except the last one - // updating only full subtree hashes (all layers where inserted element has odd index) - // the last element will update the full path to the root making the tree consistent again - for (let i = 0; i < elements.length - 1; i++) { - this._layers[0].push(elements[i]); - let level = 0; - let index = this._layers[0].length - 1; - while (index % 2 === 1) { - level++; - index >>= 1; - const left = this._layers[level - 1][index * 2]; - const right = this._layers[level - 1][index * 2 + 1]; - this._layers[level][index] = this._hashFn(left, right); - } - } - this.insert(elements[elements.length - 1]); - } - /** - * Change an element in the tree - * @param {number} index Index of element to change - * @param element Updated element value - */ - update(index, element) { - if (isNaN(Number(index)) || index < 0 || index > this._layers[0].length || index >= this.capacity) { - throw new Error('Insert index out of bounds: ' + index); - } - this._layers[0][index] = element; - this._processUpdate(index); - } - /** - * Get merkle path to a leaf - * @param {number} index Leaf index to generate path for - * @returns {{pathElements: Object[], pathIndex: number[]}} An object containing adjacent elements and left-right index - */ - path(index) { - if (isNaN(Number(index)) || index < 0 || index >= this._layers[0].length) { - throw new Error('Index out of bounds: ' + index); - } - let elIndex = +index; - const pathElements = []; - const pathIndices = []; - const pathPositions = []; - for (let level = 0; level < this.levels; level++) { - pathIndices[level] = elIndex % 2; - const leafIndex = elIndex ^ 1; - if (leafIndex < this._layers[level].length) { - pathElements[level] = this._layers[level][leafIndex]; - pathPositions[level] = leafIndex; - } - else { - pathElements[level] = this._zeros[level]; - pathPositions[level] = 0; - } - elIndex >>= 1; - } - return { - pathElements, - pathIndices, - pathPositions, - pathRoot: this.root, - }; - } - _buildZeros() { - this._zeros = [this.zeroElement]; - for (let i = 1; i <= this.levels; i++) { - this._zeros[i] = this._hashFn(this._zeros[i - 1], this._zeros[i - 1]); - } - } - _processNodes(nodes, layerIndex) { - const length = nodes.length; - let currentLength = Math.ceil(length / 2); - const currentLayer = new Array(currentLength); - currentLength--; - const starFrom = length - ((length % 2) ^ 1); - let j = 0; - for (let i = starFrom; i >= 0; i -= 2) { - if (nodes[i - 1] === undefined) - break; - const left = nodes[i - 1]; - const right = (i === starFrom && length % 2 === 1) ? this._zeros[layerIndex - 1] : nodes[i]; - currentLayer[currentLength - j] = this._hashFn(left, right); - j++; - } - return currentLayer; - } - _processUpdate(index) { - for (let level = 1; level <= this.levels; level++) { - index >>= 1; - const left = this._layers[level - 1][index * 2]; - const right = index * 2 + 1 < this._layers[level - 1].length - ? this._layers[level - 1][index * 2 + 1] - : this._zeros[level - 1]; - this._layers[level][index] = this._hashFn(left, right); - } - } +var hasRequiredBaseTree; + +function requireBaseTree () { + if (hasRequiredBaseTree) return BaseTree; + hasRequiredBaseTree = 1; + Object.defineProperty(BaseTree, "__esModule", { value: true }); + BaseTree.BaseTree = void 0; + let BaseTree$1 = class BaseTree { + get capacity() { + return 2 ** this.levels; + } + get layers() { + return this._layers.slice(); + } + get zeros() { + return this._zeros.slice(); + } + get elements() { + return this._layers[0].slice(); + } + get root() { + var _a; + return (_a = this._layers[this.levels][0]) !== null && _a !== void 0 ? _a : this._zeros[this.levels]; + } + /** + * Find an element in the tree + * @param elements elements of tree + * @param element An element to find + * @param comparator A function that checks leaf value equality + * @param fromIndex The index to start the search at. If the index is greater than or equal to the array's length, -1 is returned + * @returns {number} Index if element is found, otherwise -1 + */ + static indexOf(elements, element, fromIndex, comparator) { + if (comparator) { + return elements.findIndex((el) => comparator(element, el)); + } + else { + return elements.indexOf(element, fromIndex); + } + } + /** + * Insert new element into the tree + * @param element Element to insert + */ + insert(element) { + if (this._layers[0].length >= this.capacity) { + throw new Error('Tree is full'); + } + this.update(this._layers[0].length, element); + } + /* + * Insert multiple elements into the tree. + * @param {Array} elements Elements to insert + */ + bulkInsert(elements) { + if (!elements.length) { + return; + } + if (this._layers[0].length + elements.length > this.capacity) { + throw new Error('Tree is full'); + } + // First we insert all elements except the last one + // updating only full subtree hashes (all layers where inserted element has odd index) + // the last element will update the full path to the root making the tree consistent again + for (let i = 0; i < elements.length - 1; i++) { + this._layers[0].push(elements[i]); + let level = 0; + let index = this._layers[0].length - 1; + while (index % 2 === 1) { + level++; + index >>= 1; + const left = this._layers[level - 1][index * 2]; + const right = this._layers[level - 1][index * 2 + 1]; + this._layers[level][index] = this._hashFn(left, right); + } + } + this.insert(elements[elements.length - 1]); + } + /** + * Change an element in the tree + * @param {number} index Index of element to change + * @param element Updated element value + */ + update(index, element) { + if (isNaN(Number(index)) || index < 0 || index > this._layers[0].length || index >= this.capacity) { + throw new Error('Insert index out of bounds: ' + index); + } + this._layers[0][index] = element; + this._processUpdate(index); + } + /** + * Get merkle path to a leaf + * @param {number} index Leaf index to generate path for + * @returns {{pathElements: Object[], pathIndex: number[]}} An object containing adjacent elements and left-right index + */ + path(index) { + if (isNaN(Number(index)) || index < 0 || index >= this._layers[0].length) { + throw new Error('Index out of bounds: ' + index); + } + let elIndex = +index; + const pathElements = []; + const pathIndices = []; + const pathPositions = []; + for (let level = 0; level < this.levels; level++) { + pathIndices[level] = elIndex % 2; + const leafIndex = elIndex ^ 1; + if (leafIndex < this._layers[level].length) { + pathElements[level] = this._layers[level][leafIndex]; + pathPositions[level] = leafIndex; + } + else { + pathElements[level] = this._zeros[level]; + pathPositions[level] = 0; + } + elIndex >>= 1; + } + return { + pathElements, + pathIndices, + pathPositions, + pathRoot: this.root, + }; + } + _buildZeros() { + this._zeros = [this.zeroElement]; + for (let i = 1; i <= this.levels; i++) { + this._zeros[i] = this._hashFn(this._zeros[i - 1], this._zeros[i - 1]); + } + } + _processNodes(nodes, layerIndex) { + const length = nodes.length; + let currentLength = Math.ceil(length / 2); + const currentLayer = new Array(currentLength); + currentLength--; + const starFrom = length - ((length % 2) ^ 1); + let j = 0; + for (let i = starFrom; i >= 0; i -= 2) { + if (nodes[i - 1] === undefined) + break; + const left = nodes[i - 1]; + const right = (i === starFrom && length % 2 === 1) ? this._zeros[layerIndex - 1] : nodes[i]; + currentLayer[currentLength - j] = this._hashFn(left, right); + j++; + } + return currentLayer; + } + _processUpdate(index) { + for (let level = 1; level <= this.levels; level++) { + index >>= 1; + const left = this._layers[level - 1][index * 2]; + const right = index * 2 + 1 < this._layers[level - 1].length + ? this._layers[level - 1][index * 2 + 1] + : this._zeros[level - 1]; + this._layers[level][index] = this._hashFn(left, right); + } + } + }; + BaseTree.BaseTree = BaseTree$1; + return BaseTree; } -BaseTree$1.BaseTree = BaseTree; -var __importDefault$1 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(FixedMerkleTree, "__esModule", { value: true }); -const simpleHash_1$1 = __importDefault$1(simpleHash$1); -const BaseTree_1$1 = BaseTree$1; -class MerkleTree extends BaseTree_1$1.BaseTree { - constructor(levels, elements = [], { hashFunction = simpleHash_1$1.default, zeroElement = 0, } = {}) { - super(); - this.levels = levels; - if (elements.length > this.capacity) { - throw new Error('Tree is full'); - } - this._hashFn = hashFunction; - this.zeroElement = zeroElement; - this._layers = []; - const leaves = elements.slice(); - this._layers = [leaves]; - this._buildZeros(); - this._buildHashes(); - } - _buildHashes() { - for (let layerIndex = 1; layerIndex <= this.levels; layerIndex++) { - const nodes = this._layers[layerIndex - 1]; - this._layers[layerIndex] = this._processNodes(nodes, layerIndex); - } - } - /** - * Insert multiple elements into the tree. - * @param {Array} elements Elements to insert - */ - bulkInsert(elements) { - if (!elements.length) { - return; - } - if (this._layers[0].length + elements.length > this.capacity) { - throw new Error('Tree is full'); - } - // First we insert all elements except the last one - // updating only full subtree hashes (all layers where inserted element has odd index) - // the last element will update the full path to the root making the tree consistent again - for (let i = 0; i < elements.length - 1; i++) { - this._layers[0].push(elements[i]); - let level = 0; - let index = this._layers[0].length - 1; - while (index % 2 === 1) { - level++; - index >>= 1; - this._layers[level][index] = this._hashFn(this._layers[level - 1][index * 2], this._layers[level - 1][index * 2 + 1]); - } - } - this.insert(elements[elements.length - 1]); - } - indexOf(element, comparator) { - return BaseTree_1$1.BaseTree.indexOf(this._layers[0], element, 0, comparator); - } - proof(element) { - const index = this.indexOf(element); - return this.path(index); - } - getTreeEdge(edgeIndex) { - const edgeElement = this._layers[0][edgeIndex]; - if (edgeElement === undefined) { - throw new Error('Element not found'); - } - const edgePath = this.path(edgeIndex); - return { edgePath, edgeElement, edgeIndex, edgeElementsCount: this._layers[0].length }; - } - /** - * 🪓 - * @param count - */ - getTreeSlices(count = 4) { - const length = this._layers[0].length; - let size = Math.ceil(length / count); - if (size % 2) - size++; - const slices = []; - for (let i = 0; i < length; i += size) { - const edgeLeft = i; - const edgeRight = i + size; - slices.push({ edge: this.getTreeEdge(edgeLeft), elements: this.elements.slice(edgeLeft, edgeRight) }); - } - return slices; - } - /** - * Serialize entire tree state including intermediate layers into a plain object - * Deserializing it back will not require to recompute any hashes - * Elements are not converted to a plain type, this is responsibility of the caller - */ - serialize() { - return { - levels: this.levels, - _zeros: this._zeros, - _layers: this._layers, - }; - } - /** - * Deserialize data into a MerkleTree instance - * Make sure to provide the same hashFunction as was used in the source tree, - * otherwise the tree state will be invalid - */ - static deserialize(data, hashFunction) { - const instance = Object.assign(Object.create(this.prototype), data); - instance._hashFn = hashFunction || simpleHash_1$1.default; - instance.zeroElement = instance._zeros[0]; - return instance; - } - toString() { - return JSON.stringify(this.serialize()); - } -} -FixedMerkleTree.default = MerkleTree; +var hasRequiredFixedMerkleTree; -var PartialMerkleTree$1 = {}; - -var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(PartialMerkleTree$1, "__esModule", { value: true }); -PartialMerkleTree$1.PartialMerkleTree = void 0; -const simpleHash_1 = __importDefault(simpleHash$1); -const BaseTree_1 = BaseTree$1; -class PartialMerkleTree extends BaseTree_1.BaseTree { - constructor(levels, { edgePath, edgeElement, edgeIndex, edgeElementsCount, }, leaves, { hashFunction, zeroElement } = {}) { - super(); - if (edgeIndex + leaves.length !== edgeElementsCount) - throw new Error('Invalid number of elements'); - this._edgeLeafProof = edgePath; - this._initialRoot = edgePath.pathRoot; - this.zeroElement = zeroElement !== null && zeroElement !== void 0 ? zeroElement : 0; - this._edgeLeaf = { data: edgeElement, index: edgeIndex }; - this._leavesAfterEdge = leaves; - this.levels = levels; - this._hashFn = hashFunction || simpleHash_1.default; - this._createProofMap(); - this._buildTree(); - } - get edgeIndex() { - return this._edgeLeaf.index; - } - get edgeElement() { - return this._edgeLeaf.data; - } - get edgeLeafProof() { - return this._edgeLeafProof; - } - _createProofMap() { - this._proofMap = this.edgeLeafProof.pathPositions.reduce((p, c, i) => { - p.set(i, [c, this.edgeLeafProof.pathElements[i]]); - return p; - }, new Map()); - this._proofMap.set(this.levels, [0, this.edgeLeafProof.pathRoot]); - } - _buildTree() { - const edgeLeafIndex = this._edgeLeaf.index; - this._leaves = Array(edgeLeafIndex).concat(this._leavesAfterEdge); - if (this._proofMap.has(0)) { - const [proofPos, proofEl] = this._proofMap.get(0); - this._leaves[proofPos] = proofEl; - } - this._layers = [this._leaves]; - this._buildZeros(); - this._buildHashes(); - } - _buildHashes() { - for (let layerIndex = 1; layerIndex <= this.levels; layerIndex++) { - const nodes = this._layers[layerIndex - 1]; - const currentLayer = this._processNodes(nodes, layerIndex); - if (this._proofMap.has(layerIndex)) { - const [proofPos, proofEl] = this._proofMap.get(layerIndex); - if (!currentLayer[proofPos]) - currentLayer[proofPos] = proofEl; - } - this._layers[layerIndex] = currentLayer; - } - } - /** - * Change an element in the tree - * @param {number} index Index of element to change - * @param element Updated element value - */ - update(index, element) { - if (isNaN(Number(index)) || index < 0 || index > this._layers[0].length || index >= this.capacity) { - throw new Error('Insert index out of bounds: ' + index); - } - if (index < this._edgeLeaf.index) { - throw new Error(`Index ${index} is below the edge: ${this._edgeLeaf.index}`); - } - this._layers[0][index] = element; - this._processUpdate(index); - } - path(index) { - var _a; - if (isNaN(Number(index)) || index < 0 || index >= this._layers[0].length) { - throw new Error('Index out of bounds: ' + index); - } - if (index < this._edgeLeaf.index) { - throw new Error(`Index ${index} is below the edge: ${this._edgeLeaf.index}`); - } - let elIndex = Number(index); - const pathElements = []; - const pathIndices = []; - const pathPositions = []; - for (let level = 0; level < this.levels; level++) { - pathIndices[level] = elIndex % 2; - const leafIndex = elIndex ^ 1; - if (leafIndex < this._layers[level].length) { - pathElements[level] = this._layers[level][leafIndex]; - pathPositions[level] = leafIndex; - } - else { - pathElements[level] = this._zeros[level]; - pathPositions[level] = 0; - } - const [proofPos, proofEl] = this._proofMap.get(level); - pathElements[level] = (_a = pathElements[level]) !== null && _a !== void 0 ? _a : (proofPos === leafIndex ? proofEl : this._zeros[level]); - elIndex >>= 1; - } - return { - pathElements, - pathIndices, - pathPositions, - pathRoot: this.root, - }; - } - indexOf(element, comparator) { - return BaseTree_1.BaseTree.indexOf(this._layers[0], element, this.edgeIndex, comparator); - } - proof(element) { - const index = this.indexOf(element); - return this.path(index); - } - /** - * Shifts edge of tree to left - * @param edge new TreeEdge below current edge - * @param elements leaves between old and new edge - */ - shiftEdge(edge, elements) { - if (this._edgeLeaf.index <= edge.edgeIndex) { - throw new Error(`New edgeIndex should be smaller then ${this._edgeLeaf.index}`); - } - if (elements.length !== (this._edgeLeaf.index - edge.edgeIndex)) { - throw new Error(`Elements length should be ${this._edgeLeaf.index - edge.edgeIndex}`); - } - this._edgeLeafProof = edge.edgePath; - this._edgeLeaf = { index: edge.edgeIndex, data: edge.edgeElement }; - this._leavesAfterEdge = [...elements, ...this._leavesAfterEdge]; - this._createProofMap(); - this._buildTree(); - } - serialize() { - return { - _edgeLeafProof: this._edgeLeafProof, - _edgeLeaf: this._edgeLeaf, - _layers: this._layers, - _zeros: this._zeros, - levels: this.levels, - }; - } - static deserialize(data, hashFunction) { - const instance = Object.assign(Object.create(this.prototype), data); - instance._hashFn = hashFunction || simpleHash_1.default; - instance._initialRoot = data._edgeLeafProof.pathRoot; - instance.zeroElement = instance._zeros[0]; - instance._leavesAfterEdge = instance._layers[0].slice(data._edgeLeaf.index); - instance._createProofMap(); - return instance; - } - toString() { - return JSON.stringify(this.serialize()); - } -} -PartialMerkleTree$1.PartialMerkleTree = PartialMerkleTree; - -(function (exports) { - var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { +function requireFixedMerkleTree () { + if (hasRequiredFixedMerkleTree) return FixedMerkleTree; + hasRequiredFixedMerkleTree = 1; + var __importDefault = (FixedMerkleTree && FixedMerkleTree.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.MerkleTree = exports.simpleHash = exports.PartialMerkleTree = void 0; - const FixedMerkleTree_1 = __importDefault(FixedMerkleTree); - Object.defineProperty(exports, "MerkleTree", { enumerable: true, get: function () { return FixedMerkleTree_1.default; } }); - var PartialMerkleTree_1 = PartialMerkleTree$1; - Object.defineProperty(exports, "PartialMerkleTree", { enumerable: true, get: function () { return PartialMerkleTree_1.PartialMerkleTree; } }); - var simpleHash_1 = simpleHash$1; - Object.defineProperty(exports, "simpleHash", { enumerable: true, get: function () { return simpleHash_1.simpleHash; } }); - exports.default = FixedMerkleTree_1.default; -} (lib)); - -/* global BigInt */ -const hexLen = [ 0, 1, 2, 2, 3, 3, 3, 3, 4 ,4 ,4 ,4 ,4 ,4 ,4 ,4]; - -function fromString$2(s, radix) { - if ((!radix)||(radix==10)) { - return BigInt(s); - } else if (radix==16) { - if (s.slice(0,2) == "0x") { - return BigInt(s); - } else { - return BigInt("0x"+s); - } - } -} - -const e$2 = fromString$2; - -function fromArray$2(a, radix) { - let acc =BigInt(0); - radix = BigInt(radix); - for (let i=0; i> BigInt(n); -} - -const shl$2 = shiftLeft$2; -const shr$2 = shiftRight$2; - -function isOdd$2(a) { - return (BigInt(a) & BigInt(1)) == BigInt(1); -} - - -function naf$2(n) { - let E = BigInt(n); - const res = []; - while (E) { - if (E & BigInt(1)) { - const z = 2 - Number(E % BigInt(4)); - res.push( z ); - E = E - BigInt(z); - } else { - res.push( 0 ); - } - E = E >> BigInt(1); - } - return res; -} - - -function bits$2(n) { - let E = BigInt(n); - const res = []; - while (E) { - if (E & BigInt(1)) { - res.push(1); - } else { - res.push( 0 ); - } - E = E >> BigInt(1); - } - return res; -} - -function toNumber$3(s) { - if (s>BigInt(Number.MAX_SAFE_INTEGER )) { - throw new Error("Number too big"); - } - return Number(s); -} - -function toArray$2(s, radix) { - const res = []; - let rem = BigInt(s); - radix = BigInt(radix); - while (rem) { - res.unshift( Number(rem % radix)); - rem = rem / radix; - } - return res; -} - - -function add$2(a, b) { - return BigInt(a) + BigInt(b); -} - -function sub$2(a, b) { - return BigInt(a) - BigInt(b); -} - -function neg$2(a) { - return -BigInt(a); -} - -function mul$2(a, b) { - return BigInt(a) * BigInt(b); -} - -function square$2(a) { - return BigInt(a) * BigInt(a); -} - -function pow$2(a, b) { - return BigInt(a) ** BigInt(b); -} - -function exp$2(a, b) { - return BigInt(a) ** BigInt(b); -} - -function abs$2(a) { - return BigInt(a) >= 0 ? BigInt(a) : -BigInt(a); -} - -function div$2(a, b) { - return BigInt(a) / BigInt(b); -} - -function mod$2(a, b) { - return BigInt(a) % BigInt(b); -} - -function eq$2(a, b) { - return BigInt(a) == BigInt(b); -} - -function neq$2(a, b) { - return BigInt(a) != BigInt(b); -} - -function lt$2(a, b) { - return BigInt(a) < BigInt(b); -} - -function gt$2(a, b) { - return BigInt(a) > BigInt(b); -} - -function leq$2(a, b) { - return BigInt(a) <= BigInt(b); -} - -function geq$2(a, b) { - return BigInt(a) >= BigInt(b); -} - -function band$2(a, b) { - return BigInt(a) & BigInt(b); -} - -function bor$2(a, b) { - return BigInt(a) | BigInt(b); -} - -function bxor$2(a, b) { - return BigInt(a) ^ BigInt(b); -} - -function land$2(a, b) { - return BigInt(a) && BigInt(b); -} - -function lor$2(a, b) { - return BigInt(a) || BigInt(b); -} - -function lnot$2(a) { - return !BigInt(a); -} - -var Scalar_native = /*#__PURE__*/Object.freeze({ - __proto__: null, - abs: abs$2, - add: add$2, - band: band$2, - bitLength: bitLength$2, - bits: bits$2, - bor: bor$2, - bxor: bxor$2, - div: div$2, - e: e$2, - eq: eq$2, - exp: exp$2, - fromArray: fromArray$2, - fromString: fromString$2, - geq: geq$2, - gt: gt$2, - isNegative: isNegative$2, - isOdd: isOdd$2, - isZero: isZero$2, - land: land$2, - leq: leq$2, - lnot: lnot$2, - lor: lor$2, - lt: lt$2, - mod: mod$2, - mul: mul$2, - naf: naf$2, - neg: neg$2, - neq: neq$2, - pow: pow$2, - shiftLeft: shiftLeft$2, - shiftRight: shiftRight$2, - shl: shl$2, - shr: shr$2, - square: square$2, - sub: sub$2, - toArray: toArray$2, - toNumber: toNumber$3 -}); - -var BigInteger = {exports: {}}; - -(function (module) { - var bigInt = (function (undefined$1) { - - var BASE = 1e7, - LOG_BASE = 7, - MAX_INT = 9007199254740992, - MAX_INT_ARR = smallToArray(MAX_INT), - DEFAULT_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz"; - - var supportsNativeBigInt = typeof BigInt === "function"; - - function Integer(v, radix, alphabet, caseSensitive) { - if (typeof v === "undefined") return Integer[0]; - if (typeof radix !== "undefined") return +radix === 10 && !alphabet ? parseValue(v) : parseBase(v, radix, alphabet, caseSensitive); - return parseValue(v); - } - - function BigInteger(value, sign) { - this.value = value; - this.sign = sign; - this.isSmall = false; - } - BigInteger.prototype = Object.create(Integer.prototype); - - function SmallInteger(value) { - this.value = value; - this.sign = value < 0; - this.isSmall = true; - } - SmallInteger.prototype = Object.create(Integer.prototype); - - function NativeBigInt(value) { - this.value = value; - } - NativeBigInt.prototype = Object.create(Integer.prototype); - - function isPrecise(n) { - return -MAX_INT < n && n < MAX_INT; - } - - function smallToArray(n) { // For performance reasons doesn't reference BASE, need to change this function if BASE changes - if (n < 1e7) - return [n]; - if (n < 1e14) - return [n % 1e7, Math.floor(n / 1e7)]; - return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)]; - } - - function arrayToSmall(arr) { // If BASE changes this function may need to change - trim(arr); - var length = arr.length; - if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) { - switch (length) { - case 0: return 0; - case 1: return arr[0]; - case 2: return arr[0] + arr[1] * BASE; - default: return arr[0] + (arr[1] + arr[2] * BASE) * BASE; - } - } - return arr; - } - - function trim(v) { - var i = v.length; - while (v[--i] === 0); - v.length = i + 1; - } - - function createArray(length) { // function shamelessly stolen from Yaffle's library https://github.com/Yaffle/BigInteger - var x = new Array(length); - var i = -1; - while (++i < length) { - x[i] = 0; - } - return x; - } - - function truncate(n) { - if (n > 0) return Math.floor(n); - return Math.ceil(n); - } - - function add(a, b) { // assumes a and b are arrays with a.length >= b.length - var l_a = a.length, - l_b = b.length, - r = new Array(l_a), - carry = 0, - base = BASE, - sum, i; - for (i = 0; i < l_b; i++) { - sum = a[i] + b[i] + carry; - carry = sum >= base ? 1 : 0; - r[i] = sum - carry * base; - } - while (i < l_a) { - sum = a[i] + carry; - carry = sum === base ? 1 : 0; - r[i++] = sum - carry * base; - } - if (carry > 0) r.push(carry); - return r; - } - - function addAny(a, b) { - if (a.length >= b.length) return add(a, b); - return add(b, a); - } - - function addSmall(a, carry) { // assumes a is array, carry is number with 0 <= carry < MAX_INT - var l = a.length, - r = new Array(l), - base = BASE, - sum, i; - for (i = 0; i < l; i++) { - sum = a[i] - base + carry; - carry = Math.floor(sum / base); - r[i] = sum - carry * base; - carry += 1; - } - while (carry > 0) { - r[i++] = carry % base; - carry = Math.floor(carry / base); - } - return r; - } - - BigInteger.prototype.add = function (v) { - var n = parseValue(v); - if (this.sign !== n.sign) { - return this.subtract(n.negate()); - } - var a = this.value, b = n.value; - if (n.isSmall) { - return new BigInteger(addSmall(a, Math.abs(b)), this.sign); - } - return new BigInteger(addAny(a, b), this.sign); - }; - BigInteger.prototype.plus = BigInteger.prototype.add; - - SmallInteger.prototype.add = function (v) { - var n = parseValue(v); - var a = this.value; - if (a < 0 !== n.sign) { - return this.subtract(n.negate()); - } - var b = n.value; - if (n.isSmall) { - if (isPrecise(a + b)) return new SmallInteger(a + b); - b = smallToArray(Math.abs(b)); - } - return new BigInteger(addSmall(b, Math.abs(a)), a < 0); - }; - SmallInteger.prototype.plus = SmallInteger.prototype.add; - - NativeBigInt.prototype.add = function (v) { - return new NativeBigInt(this.value + parseValue(v).value); - }; - NativeBigInt.prototype.plus = NativeBigInt.prototype.add; - - function subtract(a, b) { // assumes a and b are arrays with a >= b - var a_l = a.length, - b_l = b.length, - r = new Array(a_l), - borrow = 0, - base = BASE, - i, difference; - for (i = 0; i < b_l; i++) { - difference = a[i] - borrow - b[i]; - if (difference < 0) { - difference += base; - borrow = 1; - } else borrow = 0; - r[i] = difference; - } - for (i = b_l; i < a_l; i++) { - difference = a[i] - borrow; - if (difference < 0) difference += base; - else { - r[i++] = difference; - break; - } - r[i] = difference; - } - for (; i < a_l; i++) { - r[i] = a[i]; - } - trim(r); - return r; - } - - function subtractAny(a, b, sign) { - var value; - if (compareAbs(a, b) >= 0) { - value = subtract(a, b); - } else { - value = subtract(b, a); - sign = !sign; - } - value = arrayToSmall(value); - if (typeof value === "number") { - if (sign) value = -value; - return new SmallInteger(value); - } - return new BigInteger(value, sign); - } - - function subtractSmall(a, b, sign) { // assumes a is array, b is number with 0 <= b < MAX_INT - var l = a.length, - r = new Array(l), - carry = -b, - base = BASE, - i, difference; - for (i = 0; i < l; i++) { - difference = a[i] + carry; - carry = Math.floor(difference / base); - difference %= base; - r[i] = difference < 0 ? difference + base : difference; - } - r = arrayToSmall(r); - if (typeof r === "number") { - if (sign) r = -r; - return new SmallInteger(r); - } return new BigInteger(r, sign); - } - - BigInteger.prototype.subtract = function (v) { - var n = parseValue(v); - if (this.sign !== n.sign) { - return this.add(n.negate()); - } - var a = this.value, b = n.value; - if (n.isSmall) - return subtractSmall(a, Math.abs(b), this.sign); - return subtractAny(a, b, this.sign); - }; - BigInteger.prototype.minus = BigInteger.prototype.subtract; - - SmallInteger.prototype.subtract = function (v) { - var n = parseValue(v); - var a = this.value; - if (a < 0 !== n.sign) { - return this.add(n.negate()); - } - var b = n.value; - if (n.isSmall) { - return new SmallInteger(a - b); - } - return subtractSmall(b, Math.abs(a), a >= 0); - }; - SmallInteger.prototype.minus = SmallInteger.prototype.subtract; - - NativeBigInt.prototype.subtract = function (v) { - return new NativeBigInt(this.value - parseValue(v).value); - }; - NativeBigInt.prototype.minus = NativeBigInt.prototype.subtract; - - BigInteger.prototype.negate = function () { - return new BigInteger(this.value, !this.sign); - }; - SmallInteger.prototype.negate = function () { - var sign = this.sign; - var small = new SmallInteger(-this.value); - small.sign = !sign; - return small; - }; - NativeBigInt.prototype.negate = function () { - return new NativeBigInt(-this.value); - }; - - BigInteger.prototype.abs = function () { - return new BigInteger(this.value, false); - }; - SmallInteger.prototype.abs = function () { - return new SmallInteger(Math.abs(this.value)); - }; - NativeBigInt.prototype.abs = function () { - return new NativeBigInt(this.value >= 0 ? this.value : -this.value); - }; - - - function multiplyLong(a, b) { - var a_l = a.length, - b_l = b.length, - l = a_l + b_l, - r = createArray(l), - base = BASE, - product, carry, i, a_i, b_j; - for (i = 0; i < a_l; ++i) { - a_i = a[i]; - for (var j = 0; j < b_l; ++j) { - b_j = b[j]; - product = a_i * b_j + r[i + j]; - carry = Math.floor(product / base); - r[i + j] = product - carry * base; - r[i + j + 1] += carry; - } - } - trim(r); - return r; - } - - function multiplySmall(a, b) { // assumes a is array, b is number with |b| < BASE - var l = a.length, - r = new Array(l), - base = BASE, - carry = 0, - product, i; - for (i = 0; i < l; i++) { - product = a[i] * b + carry; - carry = Math.floor(product / base); - r[i] = product - carry * base; - } - while (carry > 0) { - r[i++] = carry % base; - carry = Math.floor(carry / base); - } - return r; - } - - function shiftLeft(x, n) { - var r = []; - while (n-- > 0) r.push(0); - return r.concat(x); - } - - function multiplyKaratsuba(x, y) { - var n = Math.max(x.length, y.length); - - if (n <= 30) return multiplyLong(x, y); - n = Math.ceil(n / 2); - - var b = x.slice(n), - a = x.slice(0, n), - d = y.slice(n), - c = y.slice(0, n); - - var ac = multiplyKaratsuba(a, c), - bd = multiplyKaratsuba(b, d), - abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d)); - - var product = addAny(addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)), shiftLeft(bd, 2 * n)); - trim(product); - return product; - } - - // The following function is derived from a surface fit of a graph plotting the performance difference - // between long multiplication and karatsuba multiplication versus the lengths of the two arrays. - function useKaratsuba(l1, l2) { - return -0.012 * l1 - 0.012 * l2 + 0.000015 * l1 * l2 > 0; - } - - BigInteger.prototype.multiply = function (v) { - var n = parseValue(v), - a = this.value, b = n.value, - sign = this.sign !== n.sign, - abs; - if (n.isSmall) { - if (b === 0) return Integer[0]; - if (b === 1) return this; - if (b === -1) return this.negate(); - abs = Math.abs(b); - if (abs < BASE) { - return new BigInteger(multiplySmall(a, abs), sign); - } - b = smallToArray(abs); - } - if (useKaratsuba(a.length, b.length)) // Karatsuba is only faster for certain array sizes - return new BigInteger(multiplyKaratsuba(a, b), sign); - return new BigInteger(multiplyLong(a, b), sign); - }; - - BigInteger.prototype.times = BigInteger.prototype.multiply; - - function multiplySmallAndArray(a, b, sign) { // a >= 0 - if (a < BASE) { - return new BigInteger(multiplySmall(b, a), sign); - } - return new BigInteger(multiplyLong(b, smallToArray(a)), sign); - } - SmallInteger.prototype._multiplyBySmall = function (a) { - if (isPrecise(a.value * this.value)) { - return new SmallInteger(a.value * this.value); - } - return multiplySmallAndArray(Math.abs(a.value), smallToArray(Math.abs(this.value)), this.sign !== a.sign); - }; - BigInteger.prototype._multiplyBySmall = function (a) { - if (a.value === 0) return Integer[0]; - if (a.value === 1) return this; - if (a.value === -1) return this.negate(); - return multiplySmallAndArray(Math.abs(a.value), this.value, this.sign !== a.sign); - }; - SmallInteger.prototype.multiply = function (v) { - return parseValue(v)._multiplyBySmall(this); - }; - SmallInteger.prototype.times = SmallInteger.prototype.multiply; - - NativeBigInt.prototype.multiply = function (v) { - return new NativeBigInt(this.value * parseValue(v).value); - }; - NativeBigInt.prototype.times = NativeBigInt.prototype.multiply; - - function square(a) { - //console.assert(2 * BASE * BASE < MAX_INT); - var l = a.length, - r = createArray(l + l), - base = BASE, - product, carry, i, a_i, a_j; - for (i = 0; i < l; i++) { - a_i = a[i]; - carry = 0 - a_i * a_i; - for (var j = i; j < l; j++) { - a_j = a[j]; - product = 2 * (a_i * a_j) + r[i + j] + carry; - carry = Math.floor(product / base); - r[i + j] = product - carry * base; - } - r[i + l] = carry; - } - trim(r); - return r; - } - - BigInteger.prototype.square = function () { - return new BigInteger(square(this.value), false); - }; - - SmallInteger.prototype.square = function () { - var value = this.value * this.value; - if (isPrecise(value)) return new SmallInteger(value); - return new BigInteger(square(smallToArray(Math.abs(this.value))), false); - }; - - NativeBigInt.prototype.square = function (v) { - return new NativeBigInt(this.value * this.value); - }; - - function divMod1(a, b) { // Left over from previous version. Performs faster than divMod2 on smaller input sizes. - var a_l = a.length, - b_l = b.length, - base = BASE, - result = createArray(b.length), - divisorMostSignificantDigit = b[b_l - 1], - // normalization - lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)), - remainder = multiplySmall(a, lambda), - divisor = multiplySmall(b, lambda), - quotientDigit, shift, carry, borrow, i, l, q; - if (remainder.length <= a_l) remainder.push(0); - divisor.push(0); - divisorMostSignificantDigit = divisor[b_l - 1]; - for (shift = a_l - b_l; shift >= 0; shift--) { - quotientDigit = base - 1; - if (remainder[shift + b_l] !== divisorMostSignificantDigit) { - quotientDigit = Math.floor((remainder[shift + b_l] * base + remainder[shift + b_l - 1]) / divisorMostSignificantDigit); - } - // quotientDigit <= base - 1 - carry = 0; - borrow = 0; - l = divisor.length; - for (i = 0; i < l; i++) { - carry += quotientDigit * divisor[i]; - q = Math.floor(carry / base); - borrow += remainder[shift + i] - (carry - q * base); - carry = q; - if (borrow < 0) { - remainder[shift + i] = borrow + base; - borrow = -1; - } else { - remainder[shift + i] = borrow; - borrow = 0; - } - } - while (borrow !== 0) { - quotientDigit -= 1; - carry = 0; - for (i = 0; i < l; i++) { - carry += remainder[shift + i] - base + divisor[i]; - if (carry < 0) { - remainder[shift + i] = carry + base; - carry = 0; - } else { - remainder[shift + i] = carry; - carry = 1; - } - } - borrow += carry; - } - result[shift] = quotientDigit; - } - // denormalization - remainder = divModSmall(remainder, lambda)[0]; - return [arrayToSmall(result), arrayToSmall(remainder)]; - } - - function divMod2(a, b) { // Implementation idea shamelessly stolen from Silent Matt's library http://silentmatt.com/biginteger/ - // Performs faster than divMod1 on larger input sizes. - var a_l = a.length, - b_l = b.length, - result = [], - part = [], - base = BASE, - guess, xlen, highx, highy, check; - while (a_l) { - part.unshift(a[--a_l]); - trim(part); - if (compareAbs(part, b) < 0) { - result.push(0); - continue; - } - xlen = part.length; - highx = part[xlen - 1] * base + part[xlen - 2]; - highy = b[b_l - 1] * base + b[b_l - 2]; - if (xlen > b_l) { - highx = (highx + 1) * base; - } - guess = Math.ceil(highx / highy); - do { - check = multiplySmall(b, guess); - if (compareAbs(check, part) <= 0) break; - guess--; - } while (guess); - result.push(guess); - part = subtract(part, check); - } - result.reverse(); - return [arrayToSmall(result), arrayToSmall(part)]; - } - - function divModSmall(value, lambda) { - var length = value.length, - quotient = createArray(length), - base = BASE, - i, q, remainder, divisor; - remainder = 0; - for (i = length - 1; i >= 0; --i) { - divisor = remainder * base + value[i]; - q = truncate(divisor / lambda); - remainder = divisor - q * lambda; - quotient[i] = q | 0; - } - return [quotient, remainder | 0]; - } - - function divModAny(self, v) { - var value, n = parseValue(v); - if (supportsNativeBigInt) { - return [new NativeBigInt(self.value / n.value), new NativeBigInt(self.value % n.value)]; - } - var a = self.value, b = n.value; - var quotient; - if (b === 0) throw new Error("Cannot divide by zero"); - if (self.isSmall) { - if (n.isSmall) { - return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)]; - } - return [Integer[0], self]; - } - if (n.isSmall) { - if (b === 1) return [self, Integer[0]]; - if (b == -1) return [self.negate(), Integer[0]]; - var abs = Math.abs(b); - if (abs < BASE) { - value = divModSmall(a, abs); - quotient = arrayToSmall(value[0]); - var remainder = value[1]; - if (self.sign) remainder = -remainder; - if (typeof quotient === "number") { - if (self.sign !== n.sign) quotient = -quotient; - return [new SmallInteger(quotient), new SmallInteger(remainder)]; - } - return [new BigInteger(quotient, self.sign !== n.sign), new SmallInteger(remainder)]; - } - b = smallToArray(abs); - } - var comparison = compareAbs(a, b); - if (comparison === -1) return [Integer[0], self]; - if (comparison === 0) return [Integer[self.sign === n.sign ? 1 : -1], Integer[0]]; - - // divMod1 is faster on smaller input sizes - if (a.length + b.length <= 200) - value = divMod1(a, b); - else value = divMod2(a, b); - - quotient = value[0]; - var qSign = self.sign !== n.sign, - mod = value[1], - mSign = self.sign; - if (typeof quotient === "number") { - if (qSign) quotient = -quotient; - quotient = new SmallInteger(quotient); - } else quotient = new BigInteger(quotient, qSign); - if (typeof mod === "number") { - if (mSign) mod = -mod; - mod = new SmallInteger(mod); - } else mod = new BigInteger(mod, mSign); - return [quotient, mod]; - } - - BigInteger.prototype.divmod = function (v) { - var result = divModAny(this, v); - return { - quotient: result[0], - remainder: result[1] - }; - }; - NativeBigInt.prototype.divmod = SmallInteger.prototype.divmod = BigInteger.prototype.divmod; - - - BigInteger.prototype.divide = function (v) { - return divModAny(this, v)[0]; - }; - NativeBigInt.prototype.over = NativeBigInt.prototype.divide = function (v) { - return new NativeBigInt(this.value / parseValue(v).value); - }; - SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over = BigInteger.prototype.divide; - - BigInteger.prototype.mod = function (v) { - return divModAny(this, v)[1]; - }; - NativeBigInt.prototype.mod = NativeBigInt.prototype.remainder = function (v) { - return new NativeBigInt(this.value % parseValue(v).value); - }; - SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder = BigInteger.prototype.mod; - - BigInteger.prototype.pow = function (v) { - var n = parseValue(v), - a = this.value, - b = n.value, - value, x, y; - if (b === 0) return Integer[1]; - if (a === 0) return Integer[0]; - if (a === 1) return Integer[1]; - if (a === -1) return n.isEven() ? Integer[1] : Integer[-1]; - if (n.sign) { - return Integer[0]; - } - if (!n.isSmall) throw new Error("The exponent " + n.toString() + " is too large."); - if (this.isSmall) { - if (isPrecise(value = Math.pow(a, b))) - return new SmallInteger(truncate(value)); - } - x = this; - y = Integer[1]; - while (true) { - if (b & 1 === 1) { - y = y.times(x); - --b; - } - if (b === 0) break; - b /= 2; - x = x.square(); - } - return y; - }; - SmallInteger.prototype.pow = BigInteger.prototype.pow; - - NativeBigInt.prototype.pow = function (v) { - var n = parseValue(v); - var a = this.value, b = n.value; - var _0 = BigInt(0), _1 = BigInt(1), _2 = BigInt(2); - if (b === _0) return Integer[1]; - if (a === _0) return Integer[0]; - if (a === _1) return Integer[1]; - if (a === BigInt(-1)) return n.isEven() ? Integer[1] : Integer[-1]; - if (n.isNegative()) return new NativeBigInt(_0); - var x = this; - var y = Integer[1]; - while (true) { - if ((b & _1) === _1) { - y = y.times(x); - --b; - } - if (b === _0) break; - b /= _2; - x = x.square(); - } - return y; - }; - - BigInteger.prototype.modPow = function (exp, mod) { - exp = parseValue(exp); - mod = parseValue(mod); - if (mod.isZero()) throw new Error("Cannot take modPow with modulus 0"); - var r = Integer[1], - base = this.mod(mod); - if (exp.isNegative()) { - exp = exp.multiply(Integer[-1]); - base = base.modInv(mod); - } - while (exp.isPositive()) { - if (base.isZero()) return Integer[0]; - if (exp.isOdd()) r = r.multiply(base).mod(mod); - exp = exp.divide(2); - base = base.square().mod(mod); - } - return r; - }; - NativeBigInt.prototype.modPow = SmallInteger.prototype.modPow = BigInteger.prototype.modPow; - - function compareAbs(a, b) { - if (a.length !== b.length) { - return a.length > b.length ? 1 : -1; - } - for (var i = a.length - 1; i >= 0; i--) { - if (a[i] !== b[i]) return a[i] > b[i] ? 1 : -1; - } - return 0; - } - - BigInteger.prototype.compareAbs = function (v) { - var n = parseValue(v), - a = this.value, - b = n.value; - if (n.isSmall) return 1; - return compareAbs(a, b); - }; - SmallInteger.prototype.compareAbs = function (v) { - var n = parseValue(v), - a = Math.abs(this.value), - b = n.value; - if (n.isSmall) { - b = Math.abs(b); - return a === b ? 0 : a > b ? 1 : -1; - } - return -1; - }; - NativeBigInt.prototype.compareAbs = function (v) { - var a = this.value; - var b = parseValue(v).value; - a = a >= 0 ? a : -a; - b = b >= 0 ? b : -b; - return a === b ? 0 : a > b ? 1 : -1; - }; - - BigInteger.prototype.compare = function (v) { - // See discussion about comparison with Infinity: - // https://github.com/peterolson/BigInteger.js/issues/61 - if (v === Infinity) { - return -1; - } - if (v === -Infinity) { - return 1; - } - - var n = parseValue(v), - a = this.value, - b = n.value; - if (this.sign !== n.sign) { - return n.sign ? 1 : -1; - } - if (n.isSmall) { - return this.sign ? -1 : 1; - } - return compareAbs(a, b) * (this.sign ? -1 : 1); - }; - BigInteger.prototype.compareTo = BigInteger.prototype.compare; - - SmallInteger.prototype.compare = function (v) { - if (v === Infinity) { - return -1; - } - if (v === -Infinity) { - return 1; - } - - var n = parseValue(v), - a = this.value, - b = n.value; - if (n.isSmall) { - return a == b ? 0 : a > b ? 1 : -1; - } - if (a < 0 !== n.sign) { - return a < 0 ? -1 : 1; - } - return a < 0 ? 1 : -1; - }; - SmallInteger.prototype.compareTo = SmallInteger.prototype.compare; - - NativeBigInt.prototype.compare = function (v) { - if (v === Infinity) { - return -1; - } - if (v === -Infinity) { - return 1; - } - var a = this.value; - var b = parseValue(v).value; - return a === b ? 0 : a > b ? 1 : -1; - }; - NativeBigInt.prototype.compareTo = NativeBigInt.prototype.compare; - - BigInteger.prototype.equals = function (v) { - return this.compare(v) === 0; - }; - NativeBigInt.prototype.eq = NativeBigInt.prototype.equals = SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq = BigInteger.prototype.equals; - - BigInteger.prototype.notEquals = function (v) { - return this.compare(v) !== 0; - }; - NativeBigInt.prototype.neq = NativeBigInt.prototype.notEquals = SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq = BigInteger.prototype.notEquals; - - BigInteger.prototype.greater = function (v) { - return this.compare(v) > 0; - }; - NativeBigInt.prototype.gt = NativeBigInt.prototype.greater = SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt = BigInteger.prototype.greater; - - BigInteger.prototype.lesser = function (v) { - return this.compare(v) < 0; - }; - NativeBigInt.prototype.lt = NativeBigInt.prototype.lesser = SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt = BigInteger.prototype.lesser; - - BigInteger.prototype.greaterOrEquals = function (v) { - return this.compare(v) >= 0; - }; - NativeBigInt.prototype.geq = NativeBigInt.prototype.greaterOrEquals = SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq = BigInteger.prototype.greaterOrEquals; - - BigInteger.prototype.lesserOrEquals = function (v) { - return this.compare(v) <= 0; - }; - NativeBigInt.prototype.leq = NativeBigInt.prototype.lesserOrEquals = SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq = BigInteger.prototype.lesserOrEquals; - - BigInteger.prototype.isEven = function () { - return (this.value[0] & 1) === 0; - }; - SmallInteger.prototype.isEven = function () { - return (this.value & 1) === 0; - }; - NativeBigInt.prototype.isEven = function () { - return (this.value & BigInt(1)) === BigInt(0); - }; - - BigInteger.prototype.isOdd = function () { - return (this.value[0] & 1) === 1; - }; - SmallInteger.prototype.isOdd = function () { - return (this.value & 1) === 1; - }; - NativeBigInt.prototype.isOdd = function () { - return (this.value & BigInt(1)) === BigInt(1); - }; - - BigInteger.prototype.isPositive = function () { - return !this.sign; - }; - SmallInteger.prototype.isPositive = function () { - return this.value > 0; - }; - NativeBigInt.prototype.isPositive = SmallInteger.prototype.isPositive; - - BigInteger.prototype.isNegative = function () { - return this.sign; - }; - SmallInteger.prototype.isNegative = function () { - return this.value < 0; - }; - NativeBigInt.prototype.isNegative = SmallInteger.prototype.isNegative; - - BigInteger.prototype.isUnit = function () { - return false; - }; - SmallInteger.prototype.isUnit = function () { - return Math.abs(this.value) === 1; - }; - NativeBigInt.prototype.isUnit = function () { - return this.abs().value === BigInt(1); - }; - - BigInteger.prototype.isZero = function () { - return false; - }; - SmallInteger.prototype.isZero = function () { - return this.value === 0; - }; - NativeBigInt.prototype.isZero = function () { - return this.value === BigInt(0); - }; - - BigInteger.prototype.isDivisibleBy = function (v) { - var n = parseValue(v); - if (n.isZero()) return false; - if (n.isUnit()) return true; - if (n.compareAbs(2) === 0) return this.isEven(); - return this.mod(n).isZero(); - }; - NativeBigInt.prototype.isDivisibleBy = SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy; - - function isBasicPrime(v) { - var n = v.abs(); - if (n.isUnit()) return false; - if (n.equals(2) || n.equals(3) || n.equals(5)) return true; - if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false; - if (n.lesser(49)) return true; - // we don't know if it's prime: let the other functions figure it out - } - - function millerRabinTest(n, a) { - var nPrev = n.prev(), - b = nPrev, - r = 0, - d, i, x; - while (b.isEven()) b = b.divide(2), r++; - next: for (i = 0; i < a.length; i++) { - if (n.lesser(a[i])) continue; - x = bigInt(a[i]).modPow(b, n); - if (x.isUnit() || x.equals(nPrev)) continue; - for (d = r - 1; d != 0; d--) { - x = x.square().mod(n); - if (x.isUnit()) return false; - if (x.equals(nPrev)) continue next; - } - return false; - } - return true; - } - - // Set "strict" to true to force GRH-supported lower bound of 2*log(N)^2 - BigInteger.prototype.isPrime = function (strict) { - var isPrime = isBasicPrime(this); - if (isPrime !== undefined$1) return isPrime; - var n = this.abs(); - var bits = n.bitLength(); - if (bits <= 64) - return millerRabinTest(n, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]); - var logN = Math.log(2) * bits.toJSNumber(); - var t = Math.ceil((strict === true) ? (2 * Math.pow(logN, 2)) : logN); - for (var a = [], i = 0; i < t; i++) { - a.push(bigInt(i + 2)); - } - return millerRabinTest(n, a); - }; - NativeBigInt.prototype.isPrime = SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime; - - BigInteger.prototype.isProbablePrime = function (iterations, rng) { - var isPrime = isBasicPrime(this); - if (isPrime !== undefined$1) return isPrime; - var n = this.abs(); - var t = iterations === undefined$1 ? 5 : iterations; - for (var a = [], i = 0; i < t; i++) { - a.push(bigInt.randBetween(2, n.minus(2), rng)); - } - return millerRabinTest(n, a); - }; - NativeBigInt.prototype.isProbablePrime = SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime; - - BigInteger.prototype.modInv = function (n) { - var t = bigInt.zero, newT = bigInt.one, r = parseValue(n), newR = this.abs(), q, lastT, lastR; - while (!newR.isZero()) { - q = r.divide(newR); - lastT = t; - lastR = r; - t = newT; - r = newR; - newT = lastT.subtract(q.multiply(newT)); - newR = lastR.subtract(q.multiply(newR)); - } - if (!r.isUnit()) throw new Error(this.toString() + " and " + n.toString() + " are not co-prime"); - if (t.compare(0) === -1) { - t = t.add(n); - } - if (this.isNegative()) { - return t.negate(); - } - return t; - }; - - NativeBigInt.prototype.modInv = SmallInteger.prototype.modInv = BigInteger.prototype.modInv; - - BigInteger.prototype.next = function () { - var value = this.value; - if (this.sign) { - return subtractSmall(value, 1, this.sign); - } - return new BigInteger(addSmall(value, 1), this.sign); - }; - SmallInteger.prototype.next = function () { - var value = this.value; - if (value + 1 < MAX_INT) return new SmallInteger(value + 1); - return new BigInteger(MAX_INT_ARR, false); - }; - NativeBigInt.prototype.next = function () { - return new NativeBigInt(this.value + BigInt(1)); - }; - - BigInteger.prototype.prev = function () { - var value = this.value; - if (this.sign) { - return new BigInteger(addSmall(value, 1), true); - } - return subtractSmall(value, 1, this.sign); - }; - SmallInteger.prototype.prev = function () { - var value = this.value; - if (value - 1 > -MAX_INT) return new SmallInteger(value - 1); - return new BigInteger(MAX_INT_ARR, true); - }; - NativeBigInt.prototype.prev = function () { - return new NativeBigInt(this.value - BigInt(1)); - }; - - var powersOfTwo = [1]; - while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE) powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]); - var powers2Length = powersOfTwo.length, highestPower2 = powersOfTwo[powers2Length - 1]; - - function shift_isSmall(n) { - return Math.abs(n) <= BASE; - } - - BigInteger.prototype.shiftLeft = function (v) { - var n = parseValue(v).toJSNumber(); - if (!shift_isSmall(n)) { - throw new Error(String(n) + " is too large for shifting."); - } - if (n < 0) return this.shiftRight(-n); - var result = this; - if (result.isZero()) return result; - while (n >= powers2Length) { - result = result.multiply(highestPower2); - n -= powers2Length - 1; - } - return result.multiply(powersOfTwo[n]); - }; - NativeBigInt.prototype.shiftLeft = SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft; - - BigInteger.prototype.shiftRight = function (v) { - var remQuo; - var n = parseValue(v).toJSNumber(); - if (!shift_isSmall(n)) { - throw new Error(String(n) + " is too large for shifting."); - } - if (n < 0) return this.shiftLeft(-n); - var result = this; - while (n >= powers2Length) { - if (result.isZero() || (result.isNegative() && result.isUnit())) return result; - remQuo = divModAny(result, highestPower2); - result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0]; - n -= powers2Length - 1; - } - remQuo = divModAny(result, powersOfTwo[n]); - return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0]; - }; - NativeBigInt.prototype.shiftRight = SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight; - - function bitwise(x, y, fn) { - y = parseValue(y); - var xSign = x.isNegative(), ySign = y.isNegative(); - var xRem = xSign ? x.not() : x, - yRem = ySign ? y.not() : y; - var xDigit = 0, yDigit = 0; - var xDivMod = null, yDivMod = null; - var result = []; - while (!xRem.isZero() || !yRem.isZero()) { - xDivMod = divModAny(xRem, highestPower2); - xDigit = xDivMod[1].toJSNumber(); - if (xSign) { - xDigit = highestPower2 - 1 - xDigit; // two's complement for negative numbers - } - - yDivMod = divModAny(yRem, highestPower2); - yDigit = yDivMod[1].toJSNumber(); - if (ySign) { - yDigit = highestPower2 - 1 - yDigit; // two's complement for negative numbers - } - - xRem = xDivMod[0]; - yRem = yDivMod[0]; - result.push(fn(xDigit, yDigit)); - } - var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0); - for (var i = result.length - 1; i >= 0; i -= 1) { - sum = sum.multiply(highestPower2).add(bigInt(result[i])); - } - return sum; - } - - BigInteger.prototype.not = function () { - return this.negate().prev(); - }; - NativeBigInt.prototype.not = SmallInteger.prototype.not = BigInteger.prototype.not; - - BigInteger.prototype.and = function (n) { - return bitwise(this, n, function (a, b) { return a & b; }); - }; - NativeBigInt.prototype.and = SmallInteger.prototype.and = BigInteger.prototype.and; - - BigInteger.prototype.or = function (n) { - return bitwise(this, n, function (a, b) { return a | b; }); - }; - NativeBigInt.prototype.or = SmallInteger.prototype.or = BigInteger.prototype.or; - - BigInteger.prototype.xor = function (n) { - return bitwise(this, n, function (a, b) { return a ^ b; }); - }; - NativeBigInt.prototype.xor = SmallInteger.prototype.xor = BigInteger.prototype.xor; - - var LOBMASK_I = 1 << 30, LOBMASK_BI = (BASE & -BASE) * (BASE & -BASE) | LOBMASK_I; - function roughLOB(n) { // get lowestOneBit (rough) - // SmallInteger: return Min(lowestOneBit(n), 1 << 30) - // BigInteger: return Min(lowestOneBit(n), 1 << 14) [BASE=1e7] - var v = n.value, - x = typeof v === "number" ? v | LOBMASK_I : - typeof v === "bigint" ? v | BigInt(LOBMASK_I) : - v[0] + v[1] * BASE | LOBMASK_BI; - return x & -x; - } - - function integerLogarithm(value, base) { - if (base.compareTo(value) <= 0) { - var tmp = integerLogarithm(value, base.square(base)); - var p = tmp.p; - var e = tmp.e; - var t = p.multiply(base); - return t.compareTo(value) <= 0 ? { p: t, e: e * 2 + 1 } : { p: p, e: e * 2 }; - } - return { p: bigInt(1), e: 0 }; - } - - BigInteger.prototype.bitLength = function () { - var n = this; - if (n.compareTo(bigInt(0)) < 0) { - n = n.negate().subtract(bigInt(1)); - } - if (n.compareTo(bigInt(0)) === 0) { - return bigInt(0); - } - return bigInt(integerLogarithm(n, bigInt(2)).e).add(bigInt(1)); - }; - NativeBigInt.prototype.bitLength = SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength; - - function max(a, b) { - a = parseValue(a); - b = parseValue(b); - return a.greater(b) ? a : b; - } - function min(a, b) { - a = parseValue(a); - b = parseValue(b); - return a.lesser(b) ? a : b; - } - function gcd(a, b) { - a = parseValue(a).abs(); - b = parseValue(b).abs(); - if (a.equals(b)) return a; - if (a.isZero()) return b; - if (b.isZero()) return a; - var c = Integer[1], d, t; - while (a.isEven() && b.isEven()) { - d = min(roughLOB(a), roughLOB(b)); - a = a.divide(d); - b = b.divide(d); - c = c.multiply(d); - } - while (a.isEven()) { - a = a.divide(roughLOB(a)); - } - do { - while (b.isEven()) { - b = b.divide(roughLOB(b)); - } - if (a.greater(b)) { - t = b; b = a; a = t; - } - b = b.subtract(a); - } while (!b.isZero()); - return c.isUnit() ? a : a.multiply(c); - } - function lcm(a, b) { - a = parseValue(a).abs(); - b = parseValue(b).abs(); - return a.divide(gcd(a, b)).multiply(b); - } - function randBetween(a, b, rng) { - a = parseValue(a); - b = parseValue(b); - var usedRNG = rng || Math.random; - var low = min(a, b), high = max(a, b); - var range = high.subtract(low).add(1); - if (range.isSmall) return low.add(Math.floor(usedRNG() * range)); - var digits = toBase(range, BASE).value; - var result = [], restricted = true; - for (var i = 0; i < digits.length; i++) { - var top = restricted ? digits[i] + (i + 1 < digits.length ? digits[i + 1] / BASE : 0) : BASE; - var digit = truncate(usedRNG() * top); - result.push(digit); - if (digit < digits[i]) restricted = false; - } - return low.add(Integer.fromArray(result, BASE, false)); - } - - var parseBase = function (text, base, alphabet, caseSensitive) { - alphabet = alphabet || DEFAULT_ALPHABET; - text = String(text); - if (!caseSensitive) { - text = text.toLowerCase(); - alphabet = alphabet.toLowerCase(); - } - var length = text.length; - var i; - var absBase = Math.abs(base); - var alphabetValues = {}; - for (i = 0; i < alphabet.length; i++) { - alphabetValues[alphabet[i]] = i; - } - for (i = 0; i < length; i++) { - var c = text[i]; - if (c === "-") continue; - if (c in alphabetValues) { - if (alphabetValues[c] >= absBase) { - if (c === "1" && absBase === 1) continue; - throw new Error(c + " is not a valid digit in base " + base + "."); - } - } - } - base = parseValue(base); - var digits = []; - var isNegative = text[0] === "-"; - for (i = isNegative ? 1 : 0; i < text.length; i++) { - var c = text[i]; - if (c in alphabetValues) digits.push(parseValue(alphabetValues[c])); - else if (c === "<") { - var start = i; - do { i++; } while (text[i] !== ">" && i < text.length); - digits.push(parseValue(text.slice(start + 1, i))); - } - else throw new Error(c + " is not a valid character"); - } - return parseBaseFromArray(digits, base, isNegative); - }; - - function parseBaseFromArray(digits, base, isNegative) { - var val = Integer[0], pow = Integer[1], i; - for (i = digits.length - 1; i >= 0; i--) { - val = val.add(digits[i].times(pow)); - pow = pow.times(base); - } - return isNegative ? val.negate() : val; - } - - function stringify(digit, alphabet) { - alphabet = alphabet || DEFAULT_ALPHABET; - if (digit < alphabet.length) { - return alphabet[digit]; - } - return "<" + digit + ">"; - } - - function toBase(n, base) { - base = bigInt(base); - if (base.isZero()) { - if (n.isZero()) return { value: [0], isNegative: false }; - throw new Error("Cannot convert nonzero numbers to base 0."); - } - if (base.equals(-1)) { - if (n.isZero()) return { value: [0], isNegative: false }; - if (n.isNegative()) - return { - value: [].concat.apply([], Array.apply(null, Array(-n.toJSNumber())) - .map(Array.prototype.valueOf, [1, 0]) - ), - isNegative: false - }; - - var arr = Array.apply(null, Array(n.toJSNumber() - 1)) - .map(Array.prototype.valueOf, [0, 1]); - arr.unshift([1]); - return { - value: [].concat.apply([], arr), - isNegative: false - }; - } - - var neg = false; - if (n.isNegative() && base.isPositive()) { - neg = true; - n = n.abs(); - } - if (base.isUnit()) { - if (n.isZero()) return { value: [0], isNegative: false }; - - return { - value: Array.apply(null, Array(n.toJSNumber())) - .map(Number.prototype.valueOf, 1), - isNegative: neg - }; - } - var out = []; - var left = n, divmod; - while (left.isNegative() || left.compareAbs(base) >= 0) { - divmod = left.divmod(base); - left = divmod.quotient; - var digit = divmod.remainder; - if (digit.isNegative()) { - digit = base.minus(digit).abs(); - left = left.next(); - } - out.push(digit.toJSNumber()); - } - out.push(left.toJSNumber()); - return { value: out.reverse(), isNegative: neg }; - } - - function toBaseString(n, base, alphabet) { - var arr = toBase(n, base); - return (arr.isNegative ? "-" : "") + arr.value.map(function (x) { - return stringify(x, alphabet); - }).join(''); - } - - BigInteger.prototype.toArray = function (radix) { - return toBase(this, radix); - }; - - SmallInteger.prototype.toArray = function (radix) { - return toBase(this, radix); - }; - - NativeBigInt.prototype.toArray = function (radix) { - return toBase(this, radix); - }; - - BigInteger.prototype.toString = function (radix, alphabet) { - if (radix === undefined$1) radix = 10; - if (radix !== 10 || alphabet) return toBaseString(this, radix, alphabet); - var v = this.value, l = v.length, str = String(v[--l]), zeros = "0000000", digit; - while (--l >= 0) { - digit = String(v[l]); - str += zeros.slice(digit.length) + digit; - } - var sign = this.sign ? "-" : ""; - return sign + str; - }; - - SmallInteger.prototype.toString = function (radix, alphabet) { - if (radix === undefined$1) radix = 10; - if (radix != 10 || alphabet) return toBaseString(this, radix, alphabet); - return String(this.value); - }; - - NativeBigInt.prototype.toString = SmallInteger.prototype.toString; - - NativeBigInt.prototype.toJSON = BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function () { return this.toString(); }; - - BigInteger.prototype.valueOf = function () { - return parseInt(this.toString(), 10); - }; - BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf; - - SmallInteger.prototype.valueOf = function () { - return this.value; - }; - SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf; - NativeBigInt.prototype.valueOf = NativeBigInt.prototype.toJSNumber = function () { - return parseInt(this.toString(), 10); - }; - - function parseStringValue(v) { - if (isPrecise(+v)) { - var x = +v; - if (x === truncate(x)) - return supportsNativeBigInt ? new NativeBigInt(BigInt(x)) : new SmallInteger(x); - throw new Error("Invalid integer: " + v); - } - var sign = v[0] === "-"; - if (sign) v = v.slice(1); - var split = v.split(/e/i); - if (split.length > 2) throw new Error("Invalid integer: " + split.join("e")); - if (split.length === 2) { - var exp = split[1]; - if (exp[0] === "+") exp = exp.slice(1); - exp = +exp; - if (exp !== truncate(exp) || !isPrecise(exp)) throw new Error("Invalid integer: " + exp + " is not a valid exponent."); - var text = split[0]; - var decimalPlace = text.indexOf("."); - if (decimalPlace >= 0) { - exp -= text.length - decimalPlace - 1; - text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1); - } - if (exp < 0) throw new Error("Cannot include negative exponent part for integers"); - text += (new Array(exp + 1)).join("0"); - v = text; - } - var isValid = /^([0-9][0-9]*)$/.test(v); - if (!isValid) throw new Error("Invalid integer: " + v); - if (supportsNativeBigInt) { - return new NativeBigInt(BigInt(sign ? "-" + v : v)); - } - var r = [], max = v.length, l = LOG_BASE, min = max - l; - while (max > 0) { - r.push(+v.slice(min, max)); - min -= l; - if (min < 0) min = 0; - max -= l; - } - trim(r); - return new BigInteger(r, sign); - } - - function parseNumberValue(v) { - if (supportsNativeBigInt) { - return new NativeBigInt(BigInt(v)); - } - if (isPrecise(v)) { - if (v !== truncate(v)) throw new Error(v + " is not an integer."); - return new SmallInteger(v); - } - return parseStringValue(v.toString()); - } - - function parseValue(v) { - if (typeof v === "number") { - return parseNumberValue(v); - } - if (typeof v === "string") { - return parseStringValue(v); - } - if (typeof v === "bigint") { - return new NativeBigInt(v); - } - return v; - } - // Pre-define numbers in range [-999,999] - for (var i = 0; i < 1000; i++) { - Integer[i] = parseValue(i); - if (i > 0) Integer[-i] = parseValue(-i); - } - // Backwards compatibility - Integer.one = Integer[1]; - Integer.zero = Integer[0]; - Integer.minusOne = Integer[-1]; - Integer.max = max; - Integer.min = min; - Integer.gcd = gcd; - Integer.lcm = lcm; - Integer.isInstance = function (x) { return x instanceof BigInteger || x instanceof SmallInteger || x instanceof NativeBigInt; }; - Integer.randBetween = randBetween; - - Integer.fromArray = function (digits, base, isNegative) { - return parseBaseFromArray(digits.map(parseValue), parseValue(base || 10), isNegative); - }; - - return Integer; - })(); - - // Node.js check - if (module.hasOwnProperty("exports")) { - module.exports = bigInt; - } -} (BigInteger)); - -var BigIntegerExports = BigInteger.exports; -var bigInt$8 = /*@__PURE__*/getDefaultExportFromCjs(BigIntegerExports); - -function fromString$1(s, radix) { - if (typeof s == "string") { - if (s.slice(0,2) == "0x") { - return bigInt$8(s.slice(2), 16); - } else { - return bigInt$8(s,radix); - } - } else { - return bigInt$8(s, radix); - } -} - -const e$1 = fromString$1; - -function fromArray$1(a, radix) { - return bigInt$8.fromArray(a, radix); -} - -function bitLength$1(a) { - return bigInt$8(a).bitLength(); -} - -function isNegative$1(a) { - return bigInt$8(a).isNegative(); -} - -function isZero$1(a) { - return bigInt$8(a).isZero(); -} - -function shiftLeft$1(a, n) { - return bigInt$8(a).shiftLeft(n); -} - -function shiftRight$1(a, n) { - return bigInt$8(a).shiftRight(n); -} - -const shl$1 = shiftLeft$1; -const shr$1 = shiftRight$1; - -function isOdd$1(a) { - return bigInt$8(a).isOdd(); -} - - -function naf$1(n) { - let E = bigInt$8(n); - const res = []; - while (E.gt(bigInt$8.zero)) { - if (E.isOdd()) { - const z = 2 - E.mod(4).toJSNumber(); - res.push( z ); - E = E.minus(z); - } else { - res.push( 0 ); - } - E = E.shiftRight(1); - } - return res; -} - -function bits$1(n) { - let E = bigInt$8(n); - const res = []; - while (E.gt(bigInt$8.zero)) { - if (E.isOdd()) { - res.push(1); - } else { - res.push( 0 ); - } - E = E.shiftRight(1); - } - return res; -} - -function toNumber$2(s) { - if (!s.lt(bigInt$8("9007199254740992", 10))) { - throw new Error("Number too big"); - } - return s.toJSNumber(); -} - -function toArray$1(s, radix) { - return bigInt$8(s).toArray(radix); -} - -function add$1(a, b) { - return bigInt$8(a).add(bigInt$8(b)); -} - -function sub$1(a, b) { - return bigInt$8(a).minus(bigInt$8(b)); -} - -function neg$1(a) { - return bigInt$8.zero.minus(bigInt$8(a)); -} - -function mul$1(a, b) { - return bigInt$8(a).times(bigInt$8(b)); -} - -function square$1(a) { - return bigInt$8(a).square(); -} - -function pow$1(a, b) { - return bigInt$8(a).pow(bigInt$8(b)); -} - -function exp$1(a, b) { - return bigInt$8(a).pow(bigInt$8(b)); -} - -function abs$1(a) { - return bigInt$8(a).abs(); -} - -function div$1(a, b) { - return bigInt$8(a).divide(bigInt$8(b)); -} - -function mod$1(a, b) { - return bigInt$8(a).mod(bigInt$8(b)); -} - -function eq$1(a, b) { - return bigInt$8(a).eq(bigInt$8(b)); -} - -function neq$1(a, b) { - return bigInt$8(a).neq(bigInt$8(b)); -} - -function lt$1(a, b) { - return bigInt$8(a).lt(bigInt$8(b)); -} - -function gt$1(a, b) { - return bigInt$8(a).gt(bigInt$8(b)); -} - -function leq$1(a, b) { - return bigInt$8(a).leq(bigInt$8(b)); -} - -function geq$1(a, b) { - return bigInt$8(a).geq(bigInt$8(b)); -} - -function band$1(a, b) { - return bigInt$8(a).and(bigInt$8(b)); -} - -function bor$1(a, b) { - return bigInt$8(a).or(bigInt$8(b)); -} - -function bxor$1(a, b) { - return bigInt$8(a).xor(bigInt$8(b)); -} - -function land$1(a, b) { - return (!bigInt$8(a).isZero()) && (!bigInt$8(b).isZero()); -} - -function lor$1(a, b) { - return (!bigInt$8(a).isZero()) || (!bigInt$8(b).isZero()); -} - -function lnot$1(a) { - return bigInt$8(a).isZero(); -} - -var Scalar_bigint = /*#__PURE__*/Object.freeze({ - __proto__: null, - abs: abs$1, - add: add$1, - band: band$1, - bitLength: bitLength$1, - bits: bits$1, - bor: bor$1, - bxor: bxor$1, - div: div$1, - e: e$1, - eq: eq$1, - exp: exp$1, - fromArray: fromArray$1, - fromString: fromString$1, - geq: geq$1, - gt: gt$1, - isNegative: isNegative$1, - isOdd: isOdd$1, - isZero: isZero$1, - land: land$1, - leq: leq$1, - lnot: lnot$1, - lor: lor$1, - lt: lt$1, - mod: mod$1, - mul: mul$1, - naf: naf$1, - neg: neg$1, - neq: neq$1, - pow: pow$1, - shiftLeft: shiftLeft$1, - shiftRight: shiftRight$1, - shl: shl$1, - shr: shr$1, - square: square$1, - sub: sub$1, - toArray: toArray$1, - toNumber: toNumber$2 -}); - -const supportsNativeBigInt$1 = typeof BigInt === "function"; - -let Scalar$1 = {}; -if (supportsNativeBigInt$1) { - Object.assign(Scalar$1, Scalar_native); -} else { - Object.assign(Scalar$1, Scalar_bigint); -} - - -// Returns a buffer with Little Endian Representation -Scalar$1.toRprLE = function rprBE(buff, o, e, n8) { - const s = "0000000" + e.toString(16); - const v = new Uint32Array(buff.buffer, o, n8/4); - const l = (((s.length-7)*4 - 1) >> 5)+1; // Number of 32bit words; - for (let i=0; i> 5)+1; // Number of 32bit words; - for (let i=0; i a[a.length-i-1] = ch.toString(16).padStart(8,"0") ); - return Scalar$1.fromString(a.join(""), 16); -}; - -// Pases a buffer with Big Endian Representation -Scalar$1.fromRprBE = function rprLEM(buff, o, n8) { - n8 = n8 || buff.byteLength; - o = o || 0; - const v = new DataView(buff.buffer, buff.byteOffset + o, n8); - const a = new Array(n8/4); - for (let i=0; i>> 0; - st[d] = (st[d] ^ st[a]) >>> 0; - st[d] = ((st[d] << 16) | ((st[d]>>>16) & 0xFFFF)) >>> 0; - - st[c] = (st[c] + st[d]) >>> 0; - st[b] = (st[b] ^ st[c]) >>> 0; - st[b] = ((st[b] << 12) | ((st[b]>>>20) & 0xFFF)) >>> 0; - - st[a] = (st[a] + st[b]) >>> 0; - st[d] = (st[d] ^ st[a]) >>> 0; - st[d] = ((st[d] << 8) | ((st[d]>>>24) & 0xFF)) >>> 0; - - st[c] = (st[c] + st[d]) >>> 0; - st[b] = (st[b] ^ st[c]) >>> 0; - st[b] = ((st[b] << 7) | ((st[b]>>>25) & 0x7F)) >>> 0; -} - -function doubleRound(st) { - quarterRound(st, 0, 4, 8,12); - quarterRound(st, 1, 5, 9,13); - quarterRound(st, 2, 6,10,14); - quarterRound(st, 3, 7,11,15); - - quarterRound(st, 0, 5,10,15); - quarterRound(st, 1, 6,11,12); - quarterRound(st, 2, 7, 8,13); - quarterRound(st, 3, 4, 9,14); -} - -class ChaCha { - - constructor(seed) { - seed = seed || [0,0,0,0,0,0,0,0]; - this.state = [ - 0x61707865, - 0x3320646E, - 0x79622D32, - 0x6B206574, - seed[0], - seed[1], - seed[2], - seed[3], - seed[4], - seed[5], - seed[6], - seed[7], - 0, - 0, - 0, - 0 - ]; - this.idx = 16; - this.buff = new Array(16); - } - - nextU32() { - if (this.idx == 16) this.update(); - return this.buff[this.idx++]; - } - - nextU64() { - return add(mul(this.nextU32(), 0x100000000), this.nextU32()); - } - - nextBool() { - return (this.nextU32() & 1) == 1; - } - - update() { - // Copy the state - for (let i=0; i<16; i++) this.buff[i] = this.state[i]; - - // Apply the rounds - for (let i=0; i<10; i++) doubleRound(this.buff); - - // Add to the initial - for (let i=0; i<16; i++) this.buff[i] = (this.buff[i] + this.state[i]) >>> 0; - - this.idx = 0; - - this.state[12] = (this.state[12] + 1) >>> 0; - if (this.state[12] != 0) return; - this.state[13] = (this.state[13] + 1) >>> 0; - if (this.state[13] != 0) return; - this.state[14] = (this.state[14] + 1) >>> 0; - if (this.state[14] != 0) return; - this.state[15] = (this.state[15] + 1) >>> 0; - } -} - -function getRandomBytes(n) { - let array = new Uint8Array(n); - if (process.browser) { // Browser - if (typeof globalThis.crypto !== "undefined") { // Supported - globalThis.crypto.getRandomValues(array); - } else { // fallback - for (let i=0; i>>0; - } - } - } - else { // NodeJS - crypto.randomFillSync(array); - } - return array; -} - -function getRandomSeed() { - const arr = getRandomBytes(32); - const arrV = new Uint32Array(arr.buffer); - const seed = []; - for (let i=0; i<8; i++) { - seed.push(arrV[i]); - } - return seed; -} - -let threadRng = null; - -function getThreadRng() { - if (threadRng) return threadRng; - threadRng = new ChaCha(getRandomSeed()); - return threadRng; -} - -var utils$b = {}; - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ - -const bigInt$7 = BigIntegerExports; - -utils$b.bigInt2BytesLE = function bigInt2BytesLE(_a, len) { - const b = Array(len); - let v = bigInt$7(_a); - for (let i=0; i. -*/ - -const utils$a = utils$b; - -var build_int = function buildInt(module, n64, _prefix) { - - const prefix = _prefix || "int"; - if (module.modules[prefix]) return prefix; // already builded - module.modules[prefix] = {}; - - const n32 = n64*2; - const n8 = n64*8; - - module.alloc(n8, utils$a.bigInt2BytesLE(1, n8)); - - function buildCopy() { - const f = module.addFunction(prefix+"_copy"); - f.addParam("px", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - for (let i=0; i>1) )&&(i>1, k>>1) - ) - ) - ); - - f.addCode( - c.setLocal(c1, - c.i64_add( - c.getLocal(c1), - c.i64_shr_u( - c.getLocal(c0), - c.i64_const(32) - ) - ) - ) - ); - } - - // Add the old carry - - if (k>0) { - f.addCode( - c.setLocal(c0, - c.i64_add( - c.i64_and( - c.getLocal(c0), - c.i64_const(0xFFFFFFFF) - ), - c.i64_and( - c.getLocal(c0_old), - c.i64_const(0xFFFFFFFF) - ), - ) - ) - ); - - f.addCode( - c.setLocal(c1, - c.i64_add( - c.i64_add( - c.getLocal(c1), - c.i64_shr_u( - c.getLocal(c0), - c.i64_const(32) - ) - ), - c.getLocal(c1_old) - ) - ) - ); - } - - f.addCode( - c.i64_store32( - c.getLocal("r"), - k*4, - c.getLocal(c0) - ) - ); - - f.addCode( - c.setLocal( - c0_old, - c.getLocal(c1) - ), - c.setLocal( - c1_old, - c.i64_shr_u( - c.getLocal(c0_old), - c.i64_const(32) - ) - ) - ); - - } - f.addCode( - c.i64_store32( - c.getLocal("r"), - n32*4*2-4, - c.getLocal(c0_old) - ) - ); - - } - - - function buildSquareOld() { - const f = module.addFunction(prefix+"_squareOld"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode(c.call(prefix + "_mul", c.getLocal("x"), c.getLocal("x"), c.getLocal("r"))); - } - - function _buildMul1() { - const f = module.addFunction(prefix+"__mul1"); - f.addParam("px", "i32"); - f.addParam("y", "i64"); - f.addParam("pr", "i32"); - f.addLocal("c", "i64"); - - const c = f.getCodeBuilder(); - - f.addCode(c.setLocal( - "c", - c.i64_mul( - c.i64_load32_u(c.getLocal("px"), 0, 0), - c.getLocal("y") - ) - )); - - f.addCode(c.i64_store32( - c.getLocal("pr"), - 0, - 0, - c.getLocal("c"), - )); - - for (let i=1; i3)&&(Y[eY]==0) ey--; - f.addCode(c.block(c.loop( - c.br_if( - 1, - c.i32_or( - c.i32_load8_u( - c.i32_add(Y , c.getLocal("eY")), - 0, - 0 - ), - c.i32_eq( - c.getLocal("eY"), - c.i32_const(3) - ) - ) - ), - c.setLocal("eY", c.i32_sub(c.getLocal("eY"), c.i32_const(1))), - c.br(0) - ))); - - f.addCode( - c.setLocal( - "sy", - c.i64_add( - c.i64_load32_u( - c.i32_sub( - c.i32_add( Y, c.getLocal("eY")), - c.i32_const(3) - ), - 0, - 0 - ), - c.i64_const(1) - ) - ) - ); - - // Force a divide by 0 if quotien is 0 - f.addCode( - c.if( - c.i64_eq( - c.getLocal("sy"), - c.i64_const(1) - ), - c.drop(c.i64_div_u(c.i64_const(0), c.i64_const(0))) - ) - ); - - f.addCode(c.block(c.loop( - - // while (eX>7)&&(Y[eX]==0) ex--; - c.block(c.loop( - c.br_if( - 1, - c.i32_or( - c.i32_load8_u( - c.i32_add(R , c.getLocal("eX")), - 0, - 0 - ), - c.i32_eq( - c.getLocal("eX"), - c.i32_const(7) - ) - ) - ), - c.setLocal("eX", c.i32_sub(c.getLocal("eX"), c.i32_const(1))), - c.br(0) - )), - - c.setLocal( - "sx", - c.i64_load( - c.i32_sub( - c.i32_add( R, c.getLocal("eX")), - c.i32_const(7) - ), - 0, - 0 - ) - ), - - c.setLocal( - "sx", - c.i64_div_u( - c.getLocal("sx"), - c.getLocal("sy") - ) - ), - c.setLocal( - "ec", - c.i32_sub( - c.i32_sub( - c.getLocal("eX"), - c.getLocal("eY") - ), - c.i32_const(4) - ) - ), - - // While greater than 32 bits or ec is neg, shr and inc exp - c.block(c.loop( - c.br_if( - 1, - c.i32_and( - c.i64_eqz( - c.i64_and( - c.getLocal("sx"), - c.i64_const("0xFFFFFFFF00000000") - ) - ), - c.i32_ge_s( - c.getLocal("ec"), - c.i32_const(0) - ) - ) - ), - - c.setLocal( - "sx", - c.i64_shr_u( - c.getLocal("sx"), - c.i64_const(8) - ) - ), - - c.setLocal( - "ec", - c.i32_add( - c.getLocal("ec"), - c.i32_const(1) - ) - ), - c.br(0) - )), - - c.if( - c.i64_eqz(c.getLocal("sx")), - [ - ...c.br_if( - 2, - c.i32_eqz(c.call(prefix + "_gte", R, Y)) - ), - ...c.setLocal("sx", c.i64_const(1)), - ...c.setLocal("ec", c.i32_const(0)) - ] - ), - - c.call(prefix + "__mul1", Y, c.getLocal("sx"), R2), - c.drop(c.call( - prefix + "_sub", - R, - c.i32_sub(R2, c.getLocal("ec")), - R - )), - c.call( - prefix + "__add1", - c.i32_add(C, c.getLocal("ec")), - c.getLocal("sx") - ), - c.br(0) - ))); - } - - function buildInverseMod() { - - const f = module.addFunction(prefix+"_inverseMod"); - f.addParam("px", "i32"); - f.addParam("pm", "i32"); - f.addParam("pr", "i32"); - f.addLocal("t", "i32"); - f.addLocal("newt", "i32"); - f.addLocal("r", "i32"); - f.addLocal("qq", "i32"); - f.addLocal("qr", "i32"); - f.addLocal("newr", "i32"); - f.addLocal("swp", "i32"); - f.addLocal("x", "i32"); - f.addLocal("signt", "i32"); - f.addLocal("signnewt", "i32"); - f.addLocal("signx", "i32"); - - const c = f.getCodeBuilder(); - - const aux1 = c.i32_const(module.alloc(n8)); - const aux2 = c.i32_const(module.alloc(n8)); - const aux3 = c.i32_const(module.alloc(n8)); - const aux4 = c.i32_const(module.alloc(n8)); - const aux5 = c.i32_const(module.alloc(n8)); - const aux6 = c.i32_const(module.alloc(n8)); - const mulBuff = c.i32_const(module.alloc(n8*2)); - const aux7 = c.i32_const(module.alloc(n8)); - - f.addCode( - c.setLocal("t", aux1), - c.call(prefix + "_zero", aux1), - c.setLocal("signt", c.i32_const(0)), - ); - - f.addCode( - c.setLocal("r", aux2), - c.call(prefix + "_copy", c.getLocal("pm"), aux2) - ); - - f.addCode( - c.setLocal("newt", aux3), - c.call(prefix + "_one", aux3), - c.setLocal("signnewt", c.i32_const(0)), - ); - - f.addCode( - c.setLocal("newr", aux4), - c.call(prefix + "_copy", c.getLocal("px"), aux4) - ); - - - - - f.addCode(c.setLocal("qq", aux5)); - f.addCode(c.setLocal("qr", aux6)); - f.addCode(c.setLocal("x", aux7)); - - f.addCode(c.block(c.loop( - c.br_if( - 1, - c.call(prefix + "_isZero", c.getLocal("newr") ) - ), - c.call(prefix + "_div", c.getLocal("r"), c.getLocal("newr"), c.getLocal("qq"), c.getLocal("qr")), - - c.call(prefix + "_mul", c.getLocal("qq"), c.getLocal("newt"), mulBuff), - - c.if( - c.getLocal("signt"), - c.if( - c.getLocal("signnewt"), - c.if ( - c.call(prefix + "_gte", mulBuff, c.getLocal("t")), - [ - ...c.drop(c.call(prefix + "_sub", mulBuff, c.getLocal("t"), c.getLocal("x"))), - ...c.setLocal("signx", c.i32_const(0)) - ], - [ - ...c.drop(c.call(prefix + "_sub", c.getLocal("t"), mulBuff, c.getLocal("x"))), - ...c.setLocal("signx", c.i32_const(1)) - ], - ), - [ - ...c.drop(c.call(prefix + "_add", mulBuff, c.getLocal("t"), c.getLocal("x"))), - ...c.setLocal("signx", c.i32_const(1)) - ] - ), - c.if( - c.getLocal("signnewt"), - [ - ...c.drop(c.call(prefix + "_add", mulBuff, c.getLocal("t"), c.getLocal("x"))), - ...c.setLocal("signx", c.i32_const(0)) - ], - c.if ( - c.call(prefix + "_gte", c.getLocal("t"), mulBuff), - [ - ...c.drop(c.call(prefix + "_sub", c.getLocal("t"), mulBuff, c.getLocal("x"))), - ...c.setLocal("signx", c.i32_const(0)) - ], - [ - ...c.drop(c.call(prefix + "_sub", mulBuff, c.getLocal("t"), c.getLocal("x"))), - ...c.setLocal("signx", c.i32_const(1)) - ] - ) - ) - ), - - c.setLocal("swp", c.getLocal("t")), - c.setLocal("t", c.getLocal("newt")), - c.setLocal("newt", c.getLocal("x")), - c.setLocal("x", c.getLocal("swp")), - - c.setLocal("signt", c.getLocal("signnewt")), - c.setLocal("signnewt", c.getLocal("signx")), - - c.setLocal("swp", c.getLocal("r")), - c.setLocal("r", c.getLocal("newr")), - c.setLocal("newr", c.getLocal("qr")), - c.setLocal("qr", c.getLocal("swp")), - - c.br(0) - ))); - - f.addCode(c.if( - c.getLocal("signt"), - c.drop(c.call(prefix + "_sub", c.getLocal("pm"), c.getLocal("t"), c.getLocal("pr"))), - c.call(prefix + "_copy", c.getLocal("t"), c.getLocal("pr")) - )); - } - - - buildCopy(); - buildZero(); - buildIsZero(); - buildOne(); - buildEq(); - buildGte(); - buildAdd(); - buildSub(); - buildMul(); - buildSquare(); - buildSquareOld(); - buildDiv(); - buildInverseMod(); - module.exportFunction(prefix+"_copy"); - module.exportFunction(prefix+"_zero"); - module.exportFunction(prefix+"_one"); - module.exportFunction(prefix+"_isZero"); - module.exportFunction(prefix+"_eq"); - module.exportFunction(prefix+"_gte"); - module.exportFunction(prefix+"_add"); - module.exportFunction(prefix+"_sub"); - module.exportFunction(prefix+"_mul"); - module.exportFunction(prefix+"_square"); - module.exportFunction(prefix+"_squareOld"); - module.exportFunction(prefix+"_div"); - module.exportFunction(prefix+"_inverseMod"); - - return prefix; -}; - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ - -var build_timesscalar = function buildTimesScalar(module, fnName, elementLen, opAB, opAA, opCopy, opInit) { - - const f = module.addFunction(fnName); - f.addParam("base", "i32"); - f.addParam("scalar", "i32"); - f.addParam("scalarLength", "i32"); - f.addParam("r", "i32"); - f.addLocal("i", "i32"); - f.addLocal("b", "i32"); - - const c = f.getCodeBuilder(); - - const aux = c.i32_const(module.alloc(elementLen)); - - f.addCode( - c.if( - c.i32_eqz(c.getLocal("scalarLength")), - [ - ...c.call(opInit, c.getLocal("r")), - ...c.ret([]) - ] - ) - ); - f.addCode(c.call(opCopy, c.getLocal("base"), aux)); - f.addCode(c.call(opInit, c.getLocal("r"))); - f.addCode(c.setLocal("i", c.getLocal("scalarLength"))); - f.addCode(c.block(c.loop( - c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), - - c.setLocal( - "b", - c.i32_load8_u( - c.i32_add( - c.getLocal("scalar"), - c.getLocal("i") - ) - ) - ), - ...innerLoop(), - c.br_if(1, c.i32_eqz ( c.getLocal("i") )), - c.br(0) - ))); - - - function innerLoop() { - const code = []; - for (let i=0; i<8; i++) { - code.push( - ...c.call(opAA, c.getLocal("r"), c.getLocal("r")), - ...c.if( - c.i32_ge_u( c.getLocal("b"), c.i32_const(0x80 >> i)), - [ - ...c.setLocal( - "b", - c.i32_sub( - c.getLocal("b"), - c.i32_const(0x80 >> i) - ) - ), - ...c.call(opAB, c.getLocal("r"),aux, c.getLocal("r")) - ] - ) - ); - } - return code; - } - -}; - -var build_batchinverse = buildBatchInverse$3; - -function buildBatchInverse$3(module, prefix) { - - - const n8 = module.modules[prefix].n64*8; - - const f = module.addFunction(prefix+"_batchInverse"); - f.addParam("pIn", "i32"); - f.addParam("inStep", "i32"); - f.addParam("n", "i32"); - f.addParam("pOut", "i32"); - f.addParam("outStep", "i32"); - f.addLocal("itAux", "i32"); - f.addLocal("itIn", "i32"); - f.addLocal("itOut","i32"); - f.addLocal("i","i32"); - - const c = f.getCodeBuilder(); - - const AUX = c.i32_const(module.alloc(n8)); - - - // Alloc Working space for accumulated umltiplications - f.addCode( - c.setLocal("itAux", c.i32_load( c.i32_const(0) )), - c.i32_store( - c.i32_const(0), - c.i32_add( - c.getLocal("itAux"), - c.i32_mul( - c.i32_add( - c.getLocal("n"), - c.i32_const(1) - ), - c.i32_const(n8) - ) - ) - ) - ); - - f.addCode( - - // aux[0] = a; - c.call(prefix+"_one", c.getLocal("itAux")), - // for (i=0;i. -*/ - -const bigInt$6 = BigIntegerExports; -const buildInt = build_int; -const utils$9 = utils$b; -const buildExp$2 = build_timesscalar; -const buildBatchInverse$2 = build_batchinverse; -const buildBatchConvertion$1 = build_batchconvertion; -const buildBatchOp = build_batchop; - -var build_f1m = function buildF1m(module, _q, _prefix, _intPrefix) { - const q = bigInt$6(_q); - const n64 = Math.floor((q.minus(1).bitLength() - 1)/64) +1; - const n32 = n64*2; - const n8 = n64*8; - - const prefix = _prefix || "f1m"; - if (module.modules[prefix]) return prefix; // already builded - - const intPrefix = buildInt(module, n64, _intPrefix); - const pq = module.alloc(n8, utils$9.bigInt2BytesLE(q, n8)); - - module.alloc(utils$9.bigInt2BytesLE(bigInt$6.one.shiftLeft(n64*64).mod(q), n8)); - const pR2 = module.alloc(utils$9.bigInt2BytesLE(bigInt$6.one.shiftLeft(n64*64).square().mod(q), n8)); - const pOne = module.alloc(utils$9.bigInt2BytesLE(bigInt$6.one.shiftLeft(n64*64).mod(q), n8)); - const pZero = module.alloc(utils$9.bigInt2BytesLE(bigInt$6.zero, n8)); - const _minusOne = q.minus(bigInt$6.one); - const _e = _minusOne.shiftRight(1); // e = (p-1)/2 - const pe = module.alloc(n8, utils$9.bigInt2BytesLE(_e, n8)); - - const _ePlusOne = _e.add(bigInt$6.one); // e = (p-1)/2 - const pePlusOne = module.alloc(n8, utils$9.bigInt2BytesLE(_ePlusOne, n8)); - - module.modules[prefix] = { - pq: pq, - pR2: pR2, - n64: n64, - q: q, - pOne: pOne, - pZero: pZero, - pePlusOne: pePlusOne - }; - - function buildOne() { - const f = module.addFunction(prefix+"_one"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode(c.call(intPrefix + "_copy", c.i32_const(pOne), c.getLocal("pr"))); - } - - function buildAdd() { - const f = module.addFunction(prefix+"_add"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.if( - c.call(intPrefix+"_add", c.getLocal("x"), c.getLocal("y"), c.getLocal("r")), - c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), - c.if( - c.call(intPrefix+"_gte", c.getLocal("r"), c.i32_const(pq) ), - c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), - ) - ) - ); - } - - function buildSub() { - const f = module.addFunction(prefix+"_sub"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.if( - c.call(intPrefix+"_sub", c.getLocal("x"), c.getLocal("y"), c.getLocal("r")), - c.drop(c.call(intPrefix+"_add", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))) - ) - ); - } - - function buildNeg() { - const f = module.addFunction(prefix+"_neg"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call(prefix + "_sub", c.i32_const(pZero), c.getLocal("x"), c.getLocal("r")) - ); - } - - - function buildIsNegative() { - const f = module.addFunction(prefix+"_isNegative"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const AUX = c.i32_const(module.alloc(n8)); - - f.addCode( - c.call(prefix + "_fromMontgomery", c.getLocal("x"), AUX), - c.call(intPrefix + "_gte", AUX, c.i32_const(pePlusOne) ) - ); - } - - -/* - function buildIsNegative() { - const f = module.addFunction(prefix+"_isNegative"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const AUX = c.i32_const(module.alloc(n8)); - - f.addCode( - c.call(prefix + "_fromMontgomery", c.getLocal("x"), AUX), - c.i32_and( - c.i32_load(AUX), - c.i32_const(1) - ) - ); - } -*/ - - function buildSign() { - const f = module.addFunction(prefix+"_sign"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const AUX = c.i32_const(module.alloc(n8)); - - f.addCode( - c.if ( - c.call(intPrefix + "_isZero", c.getLocal("x")), - c.ret(c.i32_const(0)) - ), - c.call(prefix + "_fromMontgomery", c.getLocal("x"), AUX), - c.if( - c.call(intPrefix + "_gte", AUX, c.i32_const(pePlusOne)), - c.ret(c.i32_const(-1)) - ), - c.ret(c.i32_const(1)) - ); - } - - - function buildMReduct() { - const carries = module.alloc(n32*n32*8); - - const f = module.addFunction(prefix+"_mReduct"); - f.addParam("t", "i32"); - f.addParam("r", "i32"); - f.addLocal("np32", "i64"); - f.addLocal("c", "i64"); - f.addLocal("m", "i64"); - - const c = f.getCodeBuilder(); - - const np32 = bigInt$6("100000000",16).minus( q.modInv(bigInt$6("100000000",16))).toJSNumber(); - - f.addCode(c.setLocal("np32", c.i64_const(np32))); - - for (let i=0; i=n32) { - f.addCode( - c.i64_store32( - c.getLocal("r"), - (k-n32)*4, - c.getLocal(c0) - ) - ); - } - [c0, c1] = [c1, c0]; - f.addCode( - c.setLocal(c1, - c.i64_shr_u( - c.getLocal(c0), - c.i64_const(32) - ) - ) - ); - } - f.addCode( - c.i64_store32( - c.getLocal("r"), - n32*4-4, - c.getLocal(c0) - ) - ); - - f.addCode( - c.if( - c.i32_wrap_i64(c.getLocal(c1)), - c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), - c.if( - c.call(intPrefix+"_gte", c.getLocal("r"), c.i32_const(pq) ), - c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), - ) - ) - ); - } - - - function buildSquare() { - - const f = module.addFunction(prefix+"_square"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - f.addLocal("c0", "i64"); - f.addLocal("c1", "i64"); - f.addLocal("c0_old", "i64"); - f.addLocal("c1_old", "i64"); - f.addLocal("np32", "i64"); - - - for (let i=0;i>1) )&&(i>1, k>>1) - ) - ) - ); - - f.addCode( - c.setLocal(c1, - c.i64_add( - c.getLocal(c1), - c.i64_shr_u( - c.getLocal(c0), - c.i64_const(32) - ) - ) - ) - ); - } - - // Add the old carry - - if (k>0) { - f.addCode( - c.setLocal(c0, - c.i64_add( - c.i64_and( - c.getLocal(c0), - c.i64_const(0xFFFFFFFF) - ), - c.i64_and( - c.getLocal(c0_old), - c.i64_const(0xFFFFFFFF) - ), - ) - ) - ); - - f.addCode( - c.setLocal(c1, - c.i64_add( - c.i64_add( - c.getLocal(c1), - c.i64_shr_u( - c.getLocal(c0), - c.i64_const(32) - ) - ), - c.getLocal(c1_old) - ) - ) - ); - } - - - for (let i=Math.max(1, k-n32+1); (i<=k)&&(i=n32) { - f.addCode( - c.i64_store32( - c.getLocal("r"), - (k-n32)*4, - c.getLocal(c0) - ) - ); - } - f.addCode( - c.setLocal( - c0_old, - c.getLocal(c1) - ), - c.setLocal( - c1_old, - c.i64_shr_u( - c.getLocal(c0_old), - c.i64_const(32) - ) - ) - ); - } - f.addCode( - c.i64_store32( - c.getLocal("r"), - n32*4-4, - c.getLocal(c0_old) - ) - ); - - f.addCode( - c.if( - c.i32_wrap_i64(c.getLocal(c1_old)), - c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), - c.if( - c.call(intPrefix+"_gte", c.getLocal("r"), c.i32_const(pq) ), - c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), - ) - ) - ); - } - - - function buildSquareOld() { - const f = module.addFunction(prefix+"_squareOld"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode(c.call(prefix + "_mul", c.getLocal("x"), c.getLocal("x"), c.getLocal("r"))); - } - - function buildToMontgomery() { - const f = module.addFunction(prefix+"_toMontgomery"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - f.addCode(c.call(prefix+"_mul", c.getLocal("x"), c.i32_const(pR2), c.getLocal("r"))); - } - - function buildFromMontgomery() { - - const pAux2 = module.alloc(n8*2); - - const f = module.addFunction(prefix+"_fromMontgomery"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - f.addCode(c.call(intPrefix + "_copy", c.getLocal("x"), c.i32_const(pAux2) )); - f.addCode(c.call(intPrefix + "_zero", c.i32_const(pAux2 + n8) )); - f.addCode(c.call(prefix+"_mReduct", c.i32_const(pAux2), c.getLocal("r"))); - } - - function buildInverse() { - - const f = module.addFunction(prefix+ "_inverse"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - f.addCode(c.call(prefix + "_fromMontgomery", c.getLocal("x"), c.getLocal("r"))); - f.addCode(c.call(intPrefix + "_inverseMod", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))); - f.addCode(c.call(prefix + "_toMontgomery", c.getLocal("r"), c.getLocal("r"))); - } - - // Calculate various valuse needed for sqrt - - - let _nqr = bigInt$6(2); - if (q.isPrime()) { - while (!_nqr.modPow(_e, q).equals(_minusOne)) _nqr = _nqr.add(bigInt$6.one); - } - - module.alloc(utils$9.bigInt2BytesLE(_nqr.shiftLeft(n64*64).mod(q), n8)); - - let s2 = 0; - let _t = _minusOne; - - while ((!_t.isOdd())&&(!_t.isZero())) { - s2++; - _t = _t.shiftRight(1); - } - const pt = module.alloc(n8, utils$9.bigInt2BytesLE(_t, n8)); - - const _nqrToT = _nqr.modPow(_t, q); - const pNqrToT = module.alloc(utils$9.bigInt2BytesLE(_nqrToT.shiftLeft(n64*64).mod(q), n8)); - - const _tPlusOneOver2 = _t.add(1).shiftRight(1); - const ptPlusOneOver2 = module.alloc(n8, utils$9.bigInt2BytesLE(_tPlusOneOver2, n8)); - - function buildSqrt() { - - const f = module.addFunction(prefix+ "_sqrt"); - f.addParam("n", "i32"); - f.addParam("r", "i32"); - f.addLocal("m", "i32"); - f.addLocal("i", "i32"); - f.addLocal("j", "i32"); - - const c = f.getCodeBuilder(); - - const ONE = c.i32_const(pOne); - const C = c.i32_const(module.alloc(n8)); - const T = c.i32_const(module.alloc(n8)); - const R = c.i32_const(module.alloc(n8)); - const SQ = c.i32_const(module.alloc(n8)); - const B = c.i32_const(module.alloc(n8)); - - f.addCode( - - // If (n==0) return 0 - c.if( - c.call(prefix + "_isZero", c.getLocal("n")), - c.ret( - c.call(prefix + "_zero", c.getLocal("r")) - ) - ), - - c.setLocal("m", c.i32_const(s2)), - c.call(prefix + "_copy", c.i32_const(pNqrToT), C), - c.call(prefix + "_exp", c.getLocal("n"), c.i32_const(pt), c.i32_const(n8), T), - c.call(prefix + "_exp", c.getLocal("n"), c.i32_const(ptPlusOneOver2), c.i32_const(n8), R), - - c.block(c.loop( - c.br_if(1, c.call(prefix + "_eq", T, ONE)), - - c.call(prefix + "_square", T, SQ), - c.setLocal("i", c.i32_const(1)), - c.block(c.loop( - c.br_if(1, c.call(prefix + "_eq", SQ, ONE)), - c.call(prefix + "_square", SQ, SQ), - c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )), - - c.call(prefix + "_copy", C, B), - c.setLocal("j", c.i32_sub(c.i32_sub( c.getLocal("m"), c.getLocal("i")), c.i32_const(1)) ), - c.block(c.loop( - c.br_if(1, c.i32_eqz(c.getLocal("j"))), - c.call(prefix + "_square", B, B), - c.setLocal("j", c.i32_sub(c.getLocal("j"), c.i32_const(1))), - c.br(0) - )), - - c.setLocal("m", c.getLocal("i")), - c.call(prefix + "_square", B, C), - c.call(prefix + "_mul", T, C, T), - c.call(prefix + "_mul", R, B, R), - - c.br(0) - )), - - c.if( - c.call(prefix + "_isNegative", R), - c.call(prefix + "_neg", R, c.getLocal("r")), - c.call(prefix + "_copy", R, c.getLocal("r")), - ) - ); - } - - function buildIsSquare() { - const f = module.addFunction(prefix+"_isSquare"); - f.addParam("n", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const ONE = c.i32_const(pOne); - const AUX = c.i32_const(module.alloc(n8)); - - f.addCode( - c.if( - c.call(prefix + "_isZero", c.getLocal("n")), - c.ret(c.i32_const(1)) - ), - c.call(prefix + "_exp", c.getLocal("n"), c.i32_const(pe), c.i32_const(n8), AUX), - c.call(prefix + "_eq", AUX, ONE) - ); - } - - - function buildLoad() { - const f = module.addFunction(prefix+"_load"); - f.addParam("scalar", "i32"); - f.addParam("scalarLen", "i32"); - f.addParam("r", "i32"); - f.addLocal("p", "i32"); - f.addLocal("l", "i32"); - f.addLocal("i", "i32"); - f.addLocal("j", "i32"); - const c = f.getCodeBuilder(); - - const R = c.i32_const(module.alloc(n8)); - const pAux = module.alloc(n8); - const AUX = c.i32_const(pAux); - - f.addCode( - c.call(intPrefix + "_zero", c.getLocal("r")), - c.setLocal("i", c.i32_const(n8)), - c.setLocal("p", c.getLocal("scalar")), - c.block(c.loop( - c.br_if(1, c.i32_gt_u(c.getLocal("i"), c.getLocal("scalarLen"))), - - c.if( - c.i32_eq(c.getLocal("i"), c.i32_const(n8)), - c.call(prefix + "_one", R), - c.call(prefix + "_mul", R, c.i32_const(pR2), R) - ), - c.call(prefix + "_mul", c.getLocal("p"), R, AUX), - c.call(prefix + "_add", c.getLocal("r"), AUX, c.getLocal("r")), - - c.setLocal("p", c.i32_add(c.getLocal("p"), c.i32_const(n8))), - c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(n8))), - c.br(0) - )), - - c.setLocal("l", c.i32_rem_u( c.getLocal("scalarLen"), c.i32_const(n8))), - c.if(c.i32_eqz(c.getLocal("l")), c.ret([])), - c.call(intPrefix + "_zero", AUX), - c.setLocal("j", c.i32_const(0)), - c.block(c.loop( - c.br_if(1, c.i32_eq(c.getLocal("j"), c.getLocal("l"))), - - c.i32_store8( - c.getLocal("j"), - pAux, - c.i32_load8_u(c.getLocal("p")), - ), - c.setLocal("p", c.i32_add(c.getLocal("p"), c.i32_const(1))), - c.setLocal("j", c.i32_add(c.getLocal("j"), c.i32_const(1))), - c.br(0) - )), - - c.if( - c.i32_eq(c.getLocal("i"), c.i32_const(n8)), - c.call(prefix + "_one", R), - c.call(prefix + "_mul", R, c.i32_const(pR2), R) - ), - c.call(prefix + "_mul", AUX, R, AUX), - c.call(prefix + "_add", c.getLocal("r"), AUX, c.getLocal("r")), - ); - } - - function buildTimesScalar() { - const f = module.addFunction(prefix+"_timesScalar"); - f.addParam("x", "i32"); - f.addParam("scalar", "i32"); - f.addParam("scalarLen", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const AUX = c.i32_const(module.alloc(n8)); - - f.addCode( - c.call(prefix + "_load", c.getLocal("scalar"), c.getLocal("scalarLen"), AUX), - c.call(prefix + "_toMontgomery", AUX, AUX), - c.call(prefix + "_mul", c.getLocal("x"), AUX, c.getLocal("r")), - ); - } - - function buildIsOne() { - const f = module.addFunction(prefix+"_isOne"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - f.addCode( - c.ret(c.call(intPrefix + "_eq", c.getLocal("x"), c.i32_const(pOne))) - ); - } - - - module.exportFunction(intPrefix + "_copy", prefix+"_copy"); - module.exportFunction(intPrefix + "_zero", prefix+"_zero"); - module.exportFunction(intPrefix + "_isZero", prefix+"_isZero"); - module.exportFunction(intPrefix + "_eq", prefix+"_eq"); - - buildIsOne(); - buildAdd(); - buildSub(); - buildNeg(); - buildMReduct(); - buildMul(); - buildSquare(); - buildSquareOld(); - buildToMontgomery(); - buildFromMontgomery(); - buildIsNegative(); - buildSign(); - buildInverse(); - buildOne(); - buildLoad(); - buildTimesScalar(); - buildBatchInverse$2(module, prefix); - buildBatchConvertion$1(module, prefix + "_batchToMontgomery", prefix + "_toMontgomery", n8, n8); - buildBatchConvertion$1(module, prefix + "_batchFromMontgomery", prefix + "_fromMontgomery", n8, n8); - buildBatchConvertion$1(module, prefix + "_batchNeg", prefix + "_neg", n8, n8); - buildBatchOp(module, prefix + "_batchAdd", prefix + "_add", n8, n8); - buildBatchOp(module, prefix + "_batchSub", prefix + "_sub", n8, n8); - buildBatchOp(module, prefix + "_batchMul", prefix + "_mul", n8, n8); - - module.exportFunction(prefix + "_add"); - module.exportFunction(prefix + "_sub"); - module.exportFunction(prefix + "_neg"); - module.exportFunction(prefix + "_isNegative"); - module.exportFunction(prefix + "_isOne"); - module.exportFunction(prefix + "_sign"); - module.exportFunction(prefix + "_mReduct"); - module.exportFunction(prefix + "_mul"); - module.exportFunction(prefix + "_square"); - module.exportFunction(prefix + "_squareOld"); - module.exportFunction(prefix + "_fromMontgomery"); - module.exportFunction(prefix + "_toMontgomery"); - module.exportFunction(prefix + "_inverse"); - module.exportFunction(prefix + "_one"); - module.exportFunction(prefix + "_load"); - module.exportFunction(prefix + "_timesScalar"); - buildExp$2( - module, - prefix + "_exp", - n8, - prefix + "_mul", - prefix + "_square", - intPrefix + "_copy", - prefix + "_one", - ); - module.exportFunction(prefix + "_exp"); - module.exportFunction(prefix + "_batchInverse"); - if (q.isPrime()) { - buildSqrt(); - buildIsSquare(); - module.exportFunction(prefix + "_sqrt"); - module.exportFunction(prefix + "_isSquare"); - } - module.exportFunction(prefix + "_batchToMontgomery"); - module.exportFunction(prefix + "_batchFromMontgomery"); - // console.log(module.functionIdxByName); - - return prefix; -}; - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ - -const bigInt$5 = BigIntegerExports; - -const buildF1m$2 =build_f1m; - -var build_f1 = function buildF1(module, _q, _prefix, _f1mPrefix, _intPrefix) { - - const q = bigInt$5(_q); - const n64 = Math.floor((q.minus(1).bitLength() - 1)/64) +1; - const n8 = n64*8; - - const prefix = _prefix || "f1"; - if (module.modules[prefix]) return prefix; // already builded - module.modules[prefix] = { - n64: n64 - }; - - const intPrefix = _intPrefix || "int"; - const f1mPrefix = buildF1m$2(module, q, _f1mPrefix, intPrefix); - - - const pR2 = module.modules[f1mPrefix].pR2; - const pq = module.modules[f1mPrefix].pq; - const pePlusOne = module.modules[f1mPrefix].pePlusOne; - - function buildMul() { - const pAux1 = module.alloc(n8); - - const f = module.addFunction(prefix+ "_mul"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - f.addCode(c.call(f1mPrefix + "_mul", c.getLocal("x"), c.getLocal("y"), c.i32_const(pAux1))); - f.addCode(c.call(f1mPrefix + "_mul", c.i32_const(pAux1), c.i32_const(pR2), c.getLocal("r"))); - } - - function buildSquare() { - const f = module.addFunction(prefix+"_square"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode(c.call(prefix + "_mul", c.getLocal("x"), c.getLocal("x"), c.getLocal("r"))); - } - - - function buildInverse() { - - const f = module.addFunction(prefix+ "_inverse"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - f.addCode(c.call(intPrefix + "_inverseMod", c.getLocal("x"), c.i32_const(pq), c.getLocal("r"))); - } - - function buildIsNegative() { - const f = module.addFunction(prefix+"_isNegative"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call(intPrefix + "_gte", c.getLocal("x"), c.i32_const(pePlusOne) ) - ); - } - - - buildMul(); - buildSquare(); - buildInverse(); - buildIsNegative(); - module.exportFunction(f1mPrefix + "_add", prefix + "_add"); - module.exportFunction(f1mPrefix + "_sub", prefix + "_sub"); - module.exportFunction(f1mPrefix + "_neg", prefix + "_neg"); - module.exportFunction(prefix + "_mul"); - module.exportFunction(prefix + "_square"); - module.exportFunction(prefix + "_inverse"); - module.exportFunction(prefix + "_isNegative"); - module.exportFunction(f1mPrefix + "_copy", prefix+"_copy"); - module.exportFunction(f1mPrefix + "_zero", prefix+"_zero"); - module.exportFunction(f1mPrefix + "_one", prefix+"_one"); - module.exportFunction(f1mPrefix + "_isZero", prefix+"_isZero"); - module.exportFunction(f1mPrefix + "_eq", prefix+"_eq"); - - return prefix; -}; - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ - -const buildExp$1 = build_timesscalar; -const buildBatchInverse$1 = build_batchinverse; -const bigInt$4 = BigIntegerExports; -const utils$8 = utils$b; - -var build_f2m = function buildF2m(module, mulNonResidueFn, prefix, f1mPrefix) { - - if (module.modules[prefix]) return prefix; // already builded - - const f1n8 = module.modules[f1mPrefix].n64*8; - const q = module.modules[f1mPrefix].q; - - module.modules[prefix] = { - n64: module.modules[f1mPrefix].n64*2 - }; - - function buildAdd() { - const f = module.addFunction(prefix+"_add"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const y0 = c.getLocal("y"); - const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_add", x0, y0, r0), - c.call(f1mPrefix+"_add", x1, y1, r1), - ); - } - - function buildTimesScalar() { - const f = module.addFunction(prefix+"_timesScalar"); - f.addParam("x", "i32"); - f.addParam("scalar", "i32"); - f.addParam("scalarLen", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_timesScalar", x0, c.getLocal("scalar"), c.getLocal("scalarLen"), r0), - c.call(f1mPrefix+"_timesScalar", x1, c.getLocal("scalar"), c.getLocal("scalarLen"), r1), - ); - } - - function buildSub() { - const f = module.addFunction(prefix+"_sub"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const y0 = c.getLocal("y"); - const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_sub", x0, y0, r0), - c.call(f1mPrefix+"_sub", x1, y1, r1), - ); - } - - function buildNeg() { - const f = module.addFunction(prefix+"_neg"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_neg", x0, r0), - c.call(f1mPrefix+"_neg", x1, r1), - ); - } - - function buildConjugate() { - const f = module.addFunction(prefix+"_conjugate"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_copy", x0, r0), - c.call(f1mPrefix+"_neg", x1, r1), - ); - } - - - function buildIsNegative() { - const f = module.addFunction(prefix+"_isNegative"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - - f.addCode( - c.if( - c.call(f1mPrefix+"_isZero", x1), - c.ret(c.call(f1mPrefix+"_isNegative", x0)) - ), - c.ret(c.call(f1mPrefix+"_isNegative", x1)) - ); - } - - function buildMul() { - const f = module.addFunction(prefix+"_mul"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const y0 = c.getLocal("y"); - const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - const A = c.i32_const(module.alloc(f1n8)); - const B = c.i32_const(module.alloc(f1n8)); - const C = c.i32_const(module.alloc(f1n8)); - const D = c.i32_const(module.alloc(f1n8)); - - - f.addCode( - c.call(f1mPrefix + "_mul", x0, y0, A), // A = x0*y0 - c.call(f1mPrefix + "_mul", x1, y1, B), // B = x1*y1 - - c.call(f1mPrefix + "_add", x0, x1, C), // C = x0 + x1 - c.call(f1mPrefix + "_add", y0, y1, D), // D = y0 + y1 - c.call(f1mPrefix + "_mul", C, D, C), // C = (x0 + x1)*(y0 + y1) = x0*y0+x0*y1+x1*y0+x1*y1 - - // c.call(f1mPrefix + "_mul", B, c.i32_const(pNonResidue), r0), // r0 = nr*(x1*y1) - c.call(mulNonResidueFn, B, r0), // r0 = nr*(x1*y1) - c.call(f1mPrefix + "_add", A, r0, r0), // r0 = x0*y0 + nr*(x1*y1) - c.call(f1mPrefix + "_add", A, B, r1), // r1 = x0*y0+x1*y1 - c.call(f1mPrefix + "_sub", C, r1, r1) // r1 = x0*y0+x0*y1+x1*y0+x1*y1 - x0*y0+x1*y1 = x0*y1+x1*y0 - ); - - } - - function buildMul1() { - const f = module.addFunction(prefix+"_mul1"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const y = c.getLocal("y"); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - - f.addCode( - c.call(f1mPrefix + "_mul", x0, y, r0), // A = x0*y - c.call(f1mPrefix + "_mul", x1, y, r1), // B = x1*y - ); - } - - function buildSquare() { - const f = module.addFunction(prefix+"_square"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - const AB = c.i32_const(module.alloc(f1n8)); - const APB = c.i32_const(module.alloc(f1n8)); - const APNB = c.i32_const(module.alloc(f1n8)); - const ABPNAB = c.i32_const(module.alloc(f1n8)); - - - f.addCode( - // AB = x0*y1 - c.call(f1mPrefix + "_mul", x0, x1, AB), - - // APB = x0+y1 - c.call(f1mPrefix + "_add", x0, x1, APB), - - // APBN0 = x0 + nr*x1 - c.call(mulNonResidueFn, x1, APNB), - c.call(f1mPrefix + "_add", x0, APNB, APNB), - - // ABPNAB = ab + nr*ab - c.call(mulNonResidueFn, AB, ABPNAB), - c.call(f1mPrefix + "_add", ABPNAB, AB, ABPNAB), - - // r0 = APB * APNB - ABPNAB - c.call(f1mPrefix + "_mul", APB, APNB, r0), - c.call(f1mPrefix + "_sub", r0, ABPNAB, r0), - - // r1 = AB + AB - c.call(f1mPrefix + "_add", AB, AB, r1), - ); - - } - - - function buildToMontgomery() { - const f = module.addFunction(prefix+"_toMontgomery"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_toMontgomery", x0, r0), - c.call(f1mPrefix+"_toMontgomery", x1, r1) - ); - } - - function buildFromMontgomery() { - const f = module.addFunction(prefix+"_fromMontgomery"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_fromMontgomery", x0, r0), - c.call(f1mPrefix+"_fromMontgomery", x1, r1) - ); - } - - function buildCopy() { - const f = module.addFunction(prefix+"_copy"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_copy", x0, r0), - c.call(f1mPrefix+"_copy", x1, r1) - ); - } - - function buildZero() { - const f = module.addFunction(prefix+"_zero"); - f.addParam("x", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_zero", x0), - c.call(f1mPrefix+"_zero", x1) - ); - } - - function buildOne() { - const f = module.addFunction(prefix+"_one"); - f.addParam("x", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_one", x0), - c.call(f1mPrefix+"_zero", x1) - ); - } - - function buildEq() { - const f = module.addFunction(prefix+"_eq"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const y0 = c.getLocal("y"); - const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); - - f.addCode( - c.i32_and( - c.call(f1mPrefix+"_eq", x0, y0), - c.call(f1mPrefix+"_eq", x1, y1) - ) - ); - } - - function buildIsZero() { - const f = module.addFunction(prefix+"_isZero"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - - f.addCode( - c.i32_and( - c.call(f1mPrefix+"_isZero", x0), - c.call(f1mPrefix+"_isZero", x1) - ) - ); - } - - function buildInverse() { - const f = module.addFunction(prefix+"_inverse"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - const t0 = c.i32_const(module.alloc(f1n8)); - const t1 = c.i32_const(module.alloc(f1n8)); - const t2 = c.i32_const(module.alloc(f1n8)); - const t3 = c.i32_const(module.alloc(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_square", x0, t0), - c.call(f1mPrefix+"_square", x1, t1), - // c.call(f1mPrefix+"_mul", t1, c.i32_const(pNonResidue), t2), - c.call(mulNonResidueFn, t1, t2), - - c.call(f1mPrefix+"_sub", t0, t2, t2), - c.call(f1mPrefix+"_inverse", t2, t3), - - c.call(f1mPrefix+"_mul", x0, t3, r0), - c.call(f1mPrefix+"_mul", x1, t3, r1), - c.call(f1mPrefix+"_neg", r1, r1), - ); - } - - - function buildSign() { - const f = module.addFunction(prefix+"_sign"); - f.addParam("x", "i32"); - f.addLocal("s", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - - f.addCode( - c.setLocal("s" , c.call( f1mPrefix + "_sign", x1)), - c.if( - c.getLocal("s"), - c.ret(c.getLocal("s")) - ), - c.ret(c.call( f1mPrefix + "_sign", x0)) - ); - } - - function buildIsOne() { - const f = module.addFunction(prefix+"_isOne"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - - f.addCode( - c.ret(c.i32_and( - c.call(f1mPrefix + "_isOne", x0), - c.call(f1mPrefix + "_isZero", x1), - )) - ); - } - - - // Check here: https://eprint.iacr.org/2012/685.pdf - // Alg 9adj - function buildSqrt() { - - const f = module.addFunction(prefix+"_sqrt"); - f.addParam("a", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - const e34 = c.i32_const(module.alloc(utils$8.bigInt2BytesLE(bigInt$4(q).minus(bigInt$4(3)).divide(4), f1n8 ))); - const e12 = c.i32_const(module.alloc(utils$8.bigInt2BytesLE(bigInt$4(q).minus(bigInt$4(1)).divide(2), f1n8 ))); - - const a = c.getLocal("a"); - const a1 = c.i32_const(module.alloc(f1n8*2)); - const alpha = c.i32_const(module.alloc(f1n8*2)); - const a0 = c.i32_const(module.alloc(f1n8*2)); - const pn1 = module.alloc(f1n8*2); - const n1 = c.i32_const(pn1); - const n1a = c.i32_const(pn1); - const n1b = c.i32_const(pn1+f1n8); - const x0 = c.i32_const(module.alloc(f1n8*2)); - const b = c.i32_const(module.alloc(f1n8*2)); - - f.addCode( - - c.call(prefix + "_one", n1), - c.call(prefix + "_neg", n1, n1), - - // const a1 = F.pow(a, F.sqrt_e34); - c.call(prefix + "_exp", a, e34, c.i32_const(f1n8), a1), - - // const a1 = F.pow(a, F.sqrt_e34); - c.call(prefix + "_square", a1, alpha), - c.call(prefix + "_mul", a, alpha, alpha), - - // const a0 = F.mul(F.frobenius(1, alfa), alfa); - c.call(prefix + "_conjugate", alpha, a0), - c.call(prefix + "_mul", a0, alpha, a0), - - // if (F.eq(a0, F.negone)) return null; - c.if(c.call(prefix + "_eq",a0,n1), c.unreachable() ), - - // const x0 = F.mul(a1, a); - c.call(prefix + "_mul", a1, a, x0), - - // if (F.eq(alfa, F.negone)) { - c.if( - c.call(prefix + "_eq", alpha, n1), - [ - // x = F.mul(x0, [F.F.zero, F.F.one]); - ...c.call(f1mPrefix + "_zero", n1a), - ...c.call(f1mPrefix + "_one", n1b), - ...c.call(prefix + "_mul", n1, x0, c.getLocal("pr")), - ], - [ - // const b = F.pow(F.add(F.one, alfa), F.sqrt_e12); - ...c.call(prefix + "_one", b), - ...c.call(prefix + "_add", b, alpha, b), - ...c.call(prefix + "_exp", b, e12, c.i32_const(f1n8), b), - - // x = F.mul(b, x0); - ...c.call(prefix + "_mul", b, x0, c.getLocal("pr")), - ] - ) - ); - - } - - - function buildIsSquare() { - - const f = module.addFunction(prefix+"_isSquare"); - f.addParam("a", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const e34 = c.i32_const(module.alloc(utils$8.bigInt2BytesLE(bigInt$4(q).minus(bigInt$4(3)).divide(4), f1n8 ))); - - const a = c.getLocal("a"); - const a1 = c.i32_const(module.alloc(f1n8*2)); - const alpha = c.i32_const(module.alloc(f1n8*2)); - const a0 = c.i32_const(module.alloc(f1n8*2)); - const pn1 = module.alloc(f1n8*2); - const n1 = c.i32_const(pn1); - - f.addCode( - - c.call(prefix + "_one", n1), - c.call(prefix + "_neg", n1, n1), - - // const a1 = F.pow(a, F.sqrt_e34); - c.call(prefix + "_exp", a, e34, c.i32_const(f1n8), a1), - - // const a1 = F.pow(a, F.sqrt_e34); - c.call(prefix + "_square", a1, alpha), - c.call(prefix + "_mul", a, alpha, alpha), - - // const a0 = F.mul(F.frobenius(1, alfa), alfa); - c.call(prefix + "_conjugate", alpha, a0), - c.call(prefix + "_mul", a0, alpha, a0), - - // if (F.eq(a0, F.negone)) return null; - c.if( - c.call( - prefix + "_eq", - a0, - n1 - ), - c.ret(c.i32_const(0)) - ), - c.ret(c.i32_const(1)) - ); - - } - - - buildIsZero(); - buildIsOne(); - buildZero(); - buildOne(); - buildCopy(); - buildMul(); - buildMul1(); - buildSquare(); - buildAdd(); - buildSub(); - buildNeg(); - buildConjugate(); - buildToMontgomery(); - buildFromMontgomery(); - buildEq(); - buildInverse(); - buildTimesScalar(); - buildSign(); - buildIsNegative(); - - module.exportFunction(prefix + "_isZero"); - module.exportFunction(prefix + "_isOne"); - module.exportFunction(prefix + "_zero"); - module.exportFunction(prefix + "_one"); - module.exportFunction(prefix + "_copy"); - module.exportFunction(prefix + "_mul"); - module.exportFunction(prefix + "_mul1"); - module.exportFunction(prefix + "_square"); - module.exportFunction(prefix + "_add"); - module.exportFunction(prefix + "_sub"); - module.exportFunction(prefix + "_neg"); - module.exportFunction(prefix + "_sign"); - module.exportFunction(prefix + "_conjugate"); - module.exportFunction(prefix + "_fromMontgomery"); - module.exportFunction(prefix + "_toMontgomery"); - module.exportFunction(prefix + "_eq"); - module.exportFunction(prefix + "_inverse"); - buildBatchInverse$1(module, prefix); - buildExp$1( - module, - prefix + "_exp", - f1n8*2, - prefix + "_mul", - prefix + "_square", - prefix + "_copy", - prefix + "_one", - ); - buildSqrt(); - buildIsSquare(); - - module.exportFunction(prefix + "_exp"); - module.exportFunction(prefix + "_timesScalar"); - module.exportFunction(prefix + "_batchInverse"); - module.exportFunction(prefix + "_sqrt"); - module.exportFunction(prefix + "_isSquare"); - module.exportFunction(prefix + "_isNegative"); - - - return prefix; -}; - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ - -const buildExp = build_timesscalar; -const buildBatchInverse = build_batchinverse; - -var build_f3m = function buildF3m(module, mulNonResidueFn, prefix, f1mPrefix) { - - if (module.modules[prefix]) return prefix; // already builded - - const f1n8 = module.modules[f1mPrefix].n64*8; - module.modules[prefix] = { - n64: module.modules[f1mPrefix].n64*3 - }; - - function buildAdd() { - const f = module.addFunction(prefix+"_add"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const y0 = c.getLocal("y"); - const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); - const y2 = c.i32_add(c.getLocal("y"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_add", x0, y0, r0), - c.call(f1mPrefix+"_add", x1, y1, r1), - c.call(f1mPrefix+"_add", x2, y2, r2), - ); - } - - function buildTimesScalar() { - const f = module.addFunction(prefix+"_timesScalar"); - f.addParam("x", "i32"); - f.addParam("scalar", "i32"); - f.addParam("scalarLen", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_timesScalar", x0, c.getLocal("scalar"), c.getLocal("scalarLen"), r0), - c.call(f1mPrefix+"_timesScalar", x1, c.getLocal("scalar"), c.getLocal("scalarLen"), r1), - c.call(f1mPrefix+"_timesScalar", x2, c.getLocal("scalar"), c.getLocal("scalarLen"), r2), - ); - } - - - function buildSub() { - const f = module.addFunction(prefix+"_sub"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const y0 = c.getLocal("y"); - const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); - const y2 = c.i32_add(c.getLocal("y"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_sub", x0, y0, r0), - c.call(f1mPrefix+"_sub", x1, y1, r1), - c.call(f1mPrefix+"_sub", x2, y2, r2), - ); - } - - function buildNeg() { - const f = module.addFunction(prefix+"_neg"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_neg", x0, r0), - c.call(f1mPrefix+"_neg", x1, r1), - c.call(f1mPrefix+"_neg", x2, r2), - ); - } - - function buildIsNegative() { - const f = module.addFunction(prefix+"_isNegative"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - - f.addCode( - c.if( - c.call(f1mPrefix+"_isZero", x2), - c.if( - c.call(f1mPrefix+"_isZero", x1), - c.ret(c.call(f1mPrefix+"_isNegative", x0)), - c.ret(c.call(f1mPrefix+"_isNegative", x1)) - ) - ), - c.ret(c.call(f1mPrefix+"_isNegative", x2)) - ); - } - - - function buildMul() { - const f = module.addFunction(prefix+"_mul"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const cd = f.getCodeBuilder(); - - const a = cd.getLocal("x"); - const b = cd.i32_add(cd.getLocal("x"), cd.i32_const(f1n8)); - const c = cd.i32_add(cd.getLocal("x"), cd.i32_const(2*f1n8)); - const A = cd.getLocal("y"); - const B = cd.i32_add(cd.getLocal("y"), cd.i32_const(f1n8)); - const C = cd.i32_add(cd.getLocal("y"), cd.i32_const(2*f1n8)); - const r0 = cd.getLocal("r"); - const r1 = cd.i32_add(cd.getLocal("r"), cd.i32_const(f1n8)); - const r2 = cd.i32_add(cd.getLocal("r"), cd.i32_const(2*f1n8)); - - const aA = cd.i32_const(module.alloc(f1n8)); - const bB = cd.i32_const(module.alloc(f1n8)); - const cC = cd.i32_const(module.alloc(f1n8)); - const a_b = cd.i32_const(module.alloc(f1n8)); - const A_B = cd.i32_const(module.alloc(f1n8)); - const a_c = cd.i32_const(module.alloc(f1n8)); - const A_C = cd.i32_const(module.alloc(f1n8)); - const b_c = cd.i32_const(module.alloc(f1n8)); - const B_C = cd.i32_const(module.alloc(f1n8)); - const aA_bB = cd.i32_const(module.alloc(f1n8)); - const aA_cC = cd.i32_const(module.alloc(f1n8)); - const bB_cC = cd.i32_const(module.alloc(f1n8)); - const AUX = cd.i32_const(module.alloc(f1n8)); - - - f.addCode( - cd.call(f1mPrefix + "_mul", a, A, aA), - cd.call(f1mPrefix + "_mul", b, B, bB), - cd.call(f1mPrefix + "_mul", c, C, cC), - - cd.call(f1mPrefix + "_add", a, b, a_b), - cd.call(f1mPrefix + "_add", A, B, A_B), - cd.call(f1mPrefix + "_add", a, c, a_c), - cd.call(f1mPrefix + "_add", A, C, A_C), - cd.call(f1mPrefix + "_add", b, c, b_c), - cd.call(f1mPrefix + "_add", B, C, B_C), - - cd.call(f1mPrefix + "_add", aA, bB, aA_bB), - cd.call(f1mPrefix + "_add", aA, cC, aA_cC), - cd.call(f1mPrefix + "_add", bB, cC, bB_cC), - - cd.call(f1mPrefix + "_mul", b_c, B_C, r0), - cd.call(f1mPrefix + "_sub", r0, bB_cC, r0), - cd.call(mulNonResidueFn, r0, r0), - cd.call(f1mPrefix + "_add", aA, r0, r0), - - cd.call(f1mPrefix + "_mul", a_b, A_B, r1), - cd.call(f1mPrefix + "_sub", r1, aA_bB, r1), - cd.call(mulNonResidueFn, cC, AUX), - cd.call(f1mPrefix + "_add", r1, AUX, r1), - - cd.call(f1mPrefix + "_mul", a_c, A_C, r2), - cd.call(f1mPrefix + "_sub", r2, aA_cC, r2), - cd.call(f1mPrefix + "_add", r2, bB, r2), - ); - - } - - function buildSquare() { - const f = module.addFunction(prefix+"_square"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const A = c.getLocal("x"); - const B = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const C = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - const s0 = c.i32_const(module.alloc(f1n8)); - const ab = c.i32_const(module.alloc(f1n8)); - const s1 = c.i32_const(module.alloc(f1n8)); - const s2 = c.i32_const(module.alloc(f1n8)); - const bc = c.i32_const(module.alloc(f1n8)); - const s3 = c.i32_const(module.alloc(f1n8)); - const s4 = c.i32_const(module.alloc(f1n8)); - - - f.addCode( - - c.call(f1mPrefix + "_square", A, s0), - c.call(f1mPrefix + "_mul", A, B, ab), - c.call(f1mPrefix + "_add", ab, ab, s1), - - c.call(f1mPrefix + "_sub", A, B, s2), - c.call(f1mPrefix + "_add", s2, C, s2), - c.call(f1mPrefix + "_square", s2, s2), - - c.call(f1mPrefix + "_mul", B, C, bc), - c.call(f1mPrefix + "_add", bc, bc, s3), - - c.call(f1mPrefix + "_square", C, s4), - - c.call(mulNonResidueFn, s3, r0), - c.call(f1mPrefix + "_add", s0, r0, r0), - - c.call(mulNonResidueFn, s4, r1), - c.call(f1mPrefix + "_add", s1, r1, r1), - - c.call(f1mPrefix + "_add", s0, s4, r2), - c.call(f1mPrefix + "_sub", s3, r2, r2), - c.call(f1mPrefix + "_add", s2, r2, r2), - c.call(f1mPrefix + "_add", s1, r2, r2), - ); - - } - - - function buildToMontgomery() { - const f = module.addFunction(prefix+"_toMontgomery"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_toMontgomery", x0, r0), - c.call(f1mPrefix+"_toMontgomery", x1, r1), - c.call(f1mPrefix+"_toMontgomery", x2, r2) - ); - } - - function buildFromMontgomery() { - const f = module.addFunction(prefix+"_fromMontgomery"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_fromMontgomery", x0, r0), - c.call(f1mPrefix+"_fromMontgomery", x1, r1), - c.call(f1mPrefix+"_fromMontgomery", x2, r2) - ); - } - - function buildCopy() { - const f = module.addFunction(prefix+"_copy"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_copy", x0, r0), - c.call(f1mPrefix+"_copy", x1, r1), - c.call(f1mPrefix+"_copy", x2, r2), - ); - } - - function buildZero() { - const f = module.addFunction(prefix+"_zero"); - f.addParam("x", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_zero", x0), - c.call(f1mPrefix+"_zero", x1), - c.call(f1mPrefix+"_zero", x2), - ); - } - - function buildOne() { - const f = module.addFunction(prefix+"_one"); - f.addParam("x", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_one", x0), - c.call(f1mPrefix+"_zero", x1), - c.call(f1mPrefix+"_zero", x2), - ); - } - - function buildEq() { - const f = module.addFunction(prefix+"_eq"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const y0 = c.getLocal("y"); - const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); - const y2 = c.i32_add(c.getLocal("y"), c.i32_const(2*f1n8)); - - f.addCode( - c.i32_and( - c.i32_and( - c.call(f1mPrefix+"_eq", x0, y0), - c.call(f1mPrefix+"_eq", x1, y1), - ), - c.call(f1mPrefix+"_eq", x2, y2) - ) - ); - } - - function buildIsZero() { - const f = module.addFunction(prefix+"_isZero"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - - f.addCode( - c.i32_and( - c.i32_and( - c.call(f1mPrefix+"_isZero", x0), - c.call(f1mPrefix+"_isZero", x1) - ), - c.call(f1mPrefix+"_isZero", x2) - ) - ); - } - - function buildInverse() { - const f = module.addFunction(prefix+"_inverse"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - const t0 = c.i32_const(module.alloc(f1n8)); - const t1 = c.i32_const(module.alloc(f1n8)); - const t2 = c.i32_const(module.alloc(f1n8)); - const t3 = c.i32_const(module.alloc(f1n8)); - const t4 = c.i32_const(module.alloc(f1n8)); - const t5 = c.i32_const(module.alloc(f1n8)); - const c0 = c.i32_const(module.alloc(f1n8)); - const c1 = c.i32_const(module.alloc(f1n8)); - const c2 = c.i32_const(module.alloc(f1n8)); - const t6 = c.i32_const(module.alloc(f1n8)); - const AUX = c.i32_const(module.alloc(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_square", x0, t0), - c.call(f1mPrefix+"_square", x1, t1), - c.call(f1mPrefix+"_square", x2, t2), - c.call(f1mPrefix+"_mul", x0, x1, t3), - c.call(f1mPrefix+"_mul", x0, x2, t4), - c.call(f1mPrefix+"_mul", x1, x2, t5), - - c.call(mulNonResidueFn, t5, c0), - c.call(f1mPrefix+"_sub", t0, c0, c0), - - c.call(mulNonResidueFn, t2, c1), - c.call(f1mPrefix+"_sub", c1, t3, c1), - - c.call(f1mPrefix+"_sub", t1, t4, c2), - - c.call(f1mPrefix+"_mul", x2, c1, t6), - c.call(f1mPrefix+"_mul", x1, c2, AUX), - c.call(f1mPrefix+"_add", t6, AUX, t6), - c.call(mulNonResidueFn, t6, t6), - c.call(f1mPrefix+"_mul", x0, c0, AUX), - c.call(f1mPrefix+"_add", AUX, t6, t6), - - c.call(f1mPrefix+"_inverse", t6, t6), - - c.call(f1mPrefix+"_mul", t6, c0, r0), - c.call(f1mPrefix+"_mul", t6, c1, r1), - c.call(f1mPrefix+"_mul", t6, c2, r2) - ); - } - - - function buildSign() { - const f = module.addFunction(prefix+"_sign"); - f.addParam("x", "i32"); - f.addLocal("s", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - - f.addCode( - c.setLocal("s" , c.call( f1mPrefix + "_sign", x2)), - c.if( - c.getLocal("s"), - c.ret(c.getLocal("s")) - ), - c.setLocal("s" , c.call( f1mPrefix + "_sign", x1)), - c.if( - c.getLocal("s"), - c.ret(c.getLocal("s")) - ), - c.ret(c.call( f1mPrefix + "_sign", x0)) - ); - } - - function buildIsOne() { - const f = module.addFunction(prefix+"_isOne"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8*2)); - - f.addCode( - c.ret( - c.i32_and( - c.i32_and( - c.call(f1mPrefix + "_isOne", x0), - c.call(f1mPrefix + "_isZero", x1) - ), - c.call(f1mPrefix + "_isZero", x2) - ) - ) - ); - } - - buildIsZero(); - buildIsOne(); - buildZero(); - buildOne(); - buildCopy(); - buildMul(); - buildSquare(); - buildAdd(); - buildSub(); - buildNeg(); - buildSign(); - buildToMontgomery(); - buildFromMontgomery(); - buildEq(); - buildInverse(); - buildTimesScalar(); - buildIsNegative(); - - module.exportFunction(prefix + "_isZero"); - module.exportFunction(prefix + "_isOne"); - module.exportFunction(prefix + "_zero"); - module.exportFunction(prefix + "_one"); - module.exportFunction(prefix + "_copy"); - module.exportFunction(prefix + "_mul"); - module.exportFunction(prefix + "_square"); - module.exportFunction(prefix + "_add"); - module.exportFunction(prefix + "_sub"); - module.exportFunction(prefix + "_neg"); - module.exportFunction(prefix + "_sign"); - module.exportFunction(prefix + "_fromMontgomery"); - module.exportFunction(prefix + "_toMontgomery"); - module.exportFunction(prefix + "_eq"); - module.exportFunction(prefix + "_inverse"); - buildBatchInverse(module, prefix); - buildExp( - module, - prefix + "_exp", - f1n8*3, - prefix + "_mul", - prefix + "_square", - prefix + "_copy", - prefix + "_one" - ); - module.exportFunction(prefix + "_exp"); - module.exportFunction(prefix + "_timesScalar"); - module.exportFunction(prefix + "_batchInverse"); - module.exportFunction(prefix + "_isNegative"); - - return prefix; -}; - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ - -var build_timesscalarnaf = function buildTimesScalarNAF(module, fnName, elementLen, opAB, opAA, opAmB, opCopy, opInit) { - - const f = module.addFunction(fnName); - f.addParam("base", "i32"); - f.addParam("scalar", "i32"); - f.addParam("scalarLength", "i32"); - f.addParam("r", "i32"); - f.addLocal("old0", "i32"); - f.addLocal("nbits", "i32"); - f.addLocal("i", "i32"); - f.addLocal("last", "i32"); - f.addLocal("cur", "i32"); - f.addLocal("carry", "i32"); - f.addLocal("p", "i32"); - - const c = f.getCodeBuilder(); - - const aux = c.i32_const(module.alloc(elementLen)); - - function getBit(IDX) { - return c.i32_and( - c.i32_shr_u( - c.i32_load( - c.i32_add( - c.getLocal("scalar"), - c.i32_and( - c.i32_shr_u( - IDX, - c.i32_const(3) - ), - c.i32_const(0xFFFFFFFC) - ) - ) - ), - c.i32_and( - IDX, - c.i32_const(0x1F) - ) - ), - c.i32_const(1) - ); - } - - function pushBit(b) { - return [ - ...c.i32_store8( - c.getLocal("p"), - c.i32_const(b) - ), - ...c.setLocal( - "p", - c.i32_add( - c.getLocal("p"), - c.i32_const(1) - ) - ) - ]; - } - - f.addCode( - c.if( - c.i32_eqz(c.getLocal("scalarLength")), - [ - ...c.call(opInit, c.getLocal("r")), - ...c.ret([]) - ] - ), - c.setLocal("nbits", c.i32_shl(c.getLocal("scalarLength"), c.i32_const(3))), - c.setLocal("old0", c.i32_load(c.i32_const(0))), - c.setLocal("p", c.getLocal("old0")), - c.i32_store( - c.i32_const(0), - c.i32_and( - c.i32_add( - c.i32_add( - c.getLocal("old0"), - c.i32_const(32) - ), - c.getLocal("nbits") - ), - c.i32_const(0xFFFFFFF8) - ) - ), - c.setLocal("i", c.i32_const(1)), - - c.setLocal("last",getBit(c.i32_const(0))), - c.setLocal("carry",c.i32_const(0)), - - c.block(c.loop( - c.br_if(1, c.i32_eq( c.getLocal("i"), c.getLocal("nbits"))), - - c.setLocal("cur", getBit(c.getLocal("i"))), - c.if( c.getLocal("last"), - c.if( c.getLocal("cur"), - c.if(c.getLocal("carry"), - [ - ...c.setLocal("last", c.i32_const(0)), - ...c.setLocal("carry", c.i32_const(1)), - ...pushBit(1) - ] - , - [ - ...c.setLocal("last", c.i32_const(0)), - ...c.setLocal("carry", c.i32_const(1)), - ...pushBit(255) - ], - ), - c.if(c.getLocal("carry"), - [ - ...c.setLocal("last", c.i32_const(0)), - ...c.setLocal("carry", c.i32_const(1)), - ...pushBit(255) - ] - , - [ - ...c.setLocal("last", c.i32_const(0)), - ...c.setLocal("carry", c.i32_const(0)), - ...pushBit(1) - ], - ), - ), - c.if( c.getLocal("cur"), - c.if(c.getLocal("carry"), - [ - ...c.setLocal("last", c.i32_const(0)), - ...c.setLocal("carry", c.i32_const(1)), - ...pushBit(0) - ] - , - [ - ...c.setLocal("last", c.i32_const(1)), - ...c.setLocal("carry", c.i32_const(0)), - ...pushBit(0) - ], - ), - c.if(c.getLocal("carry"), - [ - ...c.setLocal("last", c.i32_const(1)), - ...c.setLocal("carry", c.i32_const(0)), - ...pushBit(0) - ] - , - [ - ...c.setLocal("last", c.i32_const(0)), - ...c.setLocal("carry", c.i32_const(0)), - ...pushBit(0) - ], - ), - ) - ), - c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )), - - c.if( c.getLocal("last"), - c.if(c.getLocal("carry"), - [ - ...pushBit(255), - ...pushBit(0), - ...pushBit(1) - ] - , - [ - ...pushBit(1) - ], - ), - c.if(c.getLocal("carry"), - [ - ...pushBit(0), - ...pushBit(1) - ] - ), - ), - - c.setLocal("p", c.i32_sub(c.getLocal("p"), c.i32_const(1))), - - // p already points to the last bit - - c.call(opCopy, c.getLocal("base"), aux), - - c.call(opInit, c.getLocal("r")), - - c.block(c.loop( - - - c.call(opAA, c.getLocal("r"), c.getLocal("r")), - - - c.setLocal("cur", - c.i32_load8_u( - c.getLocal("p") - ) - ), - - c.if( - c.getLocal("cur"), - c.if( - c.i32_eq(c.getLocal("cur"), c.i32_const(1)), - c.call(opAB, c.getLocal("r"), aux, c.getLocal("r")), - c.call(opAmB, c.getLocal("r"), aux, c.getLocal("r")), - ) - ), - - c.br_if(1, c.i32_eq( c.getLocal("old0"), c.getLocal("p"))), - c.setLocal("p", c.i32_sub(c.getLocal("p"), c.i32_const(1))), - c.br(0) - - )), - - c.i32_store( c.i32_const(0), c.getLocal("old0")) - - ); - -}; - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ - -var build_multiexp = function buildMultiexp(module, prefix, fnName, opAdd, n8b) { - - const n64g = module.modules[prefix].n64; - const n8g = n64g*8; - - function buildGetChunk() { - const f = module.addFunction(fnName + "_getChunk"); - f.addParam("pScalar", "i32"); - f.addParam("scalarSize", "i32"); // Number of bytes of the scalar - f.addParam("startBit", "i32"); // Bit to start extract - f.addParam("chunkSize", "i32"); // Chunk size in bits - f.addLocal("bitsToEnd", "i32"); - f.addLocal("mask", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.setLocal("bitsToEnd", - c.i32_sub( - c.i32_mul( - c.getLocal("scalarSize"), - c.i32_const(8) - ), - c.getLocal("startBit") - ) - ), - c.if( - c.i32_gt_s( - c.getLocal("chunkSize"), - c.getLocal("bitsToEnd") - ), - c.setLocal( - "mask", - c.i32_sub( - c.i32_shl( - c.i32_const(1), - c.getLocal("bitsToEnd") - ), - c.i32_const(1) - ) - ), - c.setLocal( - "mask", - c.i32_sub( - c.i32_shl( - c.i32_const(1), - c.getLocal("chunkSize") - ), - c.i32_const(1) - ) - ) - ), - c.i32_and( - c.i32_shr_u( - c.i32_load( - c.i32_add( - c.getLocal("pScalar"), - c.i32_shr_u( - c.getLocal("startBit"), - c.i32_const(3) - ) - ), - 0, // offset - 0 // align to byte. - ), - c.i32_and( - c.getLocal("startBit"), - c.i32_const(0x7) - ) - ), - c.getLocal("mask") - ) - ); - } - - function buildMutiexpChunk() { - const f = module.addFunction(fnName + "_chunk"); - f.addParam("pBases", "i32"); - f.addParam("pScalars", "i32"); - f.addParam("scalarSize", "i32"); // Number of points - f.addParam("n", "i32"); // Number of points - f.addParam("startBit", "i32"); // bit where it starts the chunk - f.addParam("chunkSize", "i32"); // bit where it starts the chunk - f.addParam("pr", "i32"); - f.addLocal("nChunks", "i32"); - f.addLocal("itScalar", "i32"); - f.addLocal("endScalar", "i32"); - f.addLocal("itBase", "i32"); - f.addLocal("i", "i32"); - f.addLocal("j", "i32"); - f.addLocal("nTable", "i32"); - f.addLocal("pTable", "i32"); - f.addLocal("idx", "i32"); - f.addLocal("pIdxTable", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.if( - c.i32_eqz(c.getLocal("n")), - [ - ...c.call(prefix + "_zero", c.getLocal("pr")), - ...c.ret([]) - ] - ), - - // Allocate memory - - c.setLocal( - "nTable", - c.i32_shl( - c.i32_const(1), - c.getLocal("chunkSize") - ) - ), - c.setLocal("pTable", c.i32_load( c.i32_const(0) )), - c.i32_store( - c.i32_const(0), - c.i32_add( - c.getLocal("pTable"), - c.i32_mul( - c.getLocal("nTable"), - c.i32_const(n8g) - ) - ) - ), - - // Reset Table - c.setLocal("j", c.i32_const(0)), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("j"), - c.getLocal("nTable") - ) - ), - - c.call( - prefix + "_zero", - c.i32_add( - c.getLocal("pTable"), - c.i32_mul( - c.getLocal("j"), - c.i32_const(n8g) - ) - ) - ), - - c.setLocal("j", c.i32_add(c.getLocal("j"), c.i32_const(1))), - c.br(0) - )), - - // Distribute elements - c.setLocal("itBase", c.getLocal("pBases")), - c.setLocal("itScalar", c.getLocal("pScalars")), - c.setLocal("endScalar", - c.i32_add( - c.getLocal("pScalars"), - c.i32_mul( - c.getLocal("n"), - c.getLocal("scalarSize") - ) - ) - ), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("itScalar"), - c.getLocal("endScalar") - ) - ), - - c.setLocal( - "idx", - c.call(fnName + "_getChunk", - c.getLocal("itScalar"), - c.getLocal("scalarSize"), - c.getLocal("startBit"), - c.getLocal("chunkSize") - ) - ), - - c.if( - c.getLocal("idx"), - [ - ...c.setLocal( - "pIdxTable", - c.i32_add( - c.getLocal("pTable"), - c.i32_mul( - c.i32_sub( - c.getLocal("idx"), - c.i32_const(1) - ), - c.i32_const(n8g) - ) - ) - ), - ...c.call( - opAdd, - c.getLocal("pIdxTable"), - c.getLocal("itBase"), - c.getLocal("pIdxTable"), - ) - ] - ), - - c.setLocal("itScalar", c.i32_add(c.getLocal("itScalar"), c.getLocal("scalarSize"))), - c.setLocal("itBase", c.i32_add(c.getLocal("itBase"), c.i32_const(n8b))), - c.br(0) - )), - - c.call(fnName + "_reduceTable", c.getLocal("pTable"), c.getLocal("chunkSize")), - c.call( - prefix + "_copy", - c.getLocal("pTable"), - c.getLocal("pr") - ), - - - c.i32_store( - c.i32_const(0), - c.getLocal("pTable") - ) - - ); - } - - function buildMultiexp() { - const f = module.addFunction(fnName); - f.addParam("pBases", "i32"); - f.addParam("pScalars", "i32"); - f.addParam("scalarSize", "i32"); // Number of points - f.addParam("n", "i32"); // Number of points - f.addParam("pr", "i32"); - f.addLocal("chunkSize", "i32"); - f.addLocal("nChunks", "i32"); - f.addLocal("itScalar", "i32"); - f.addLocal("endScalar", "i32"); - f.addLocal("itBase", "i32"); - f.addLocal("itBit", "i32"); - f.addLocal("i", "i32"); - f.addLocal("j", "i32"); - f.addLocal("nTable", "i32"); - f.addLocal("pTable", "i32"); - f.addLocal("idx", "i32"); - f.addLocal("pIdxTable", "i32"); - - const c = f.getCodeBuilder(); - - const aux = c.i32_const(module.alloc(n8g)); - - const pTSizes = module.alloc([ - 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 16, 16, 15, 14, 13, 13, - 12, 11, 10, 9, 8, 7, 7, 6, - 5 , 4, 3, 2, 1, 1, 1, 1 - ]); - - f.addCode( - c.call(prefix + "_zero", c.getLocal("pr")), - c.if( - c.i32_eqz(c.getLocal("n")), - c.ret([]) - ), - c.setLocal("chunkSize", c.i32_load8_u( c.i32_clz(c.getLocal("n")), pTSizes )), - c.setLocal( - "nChunks", - c.i32_add( - c.i32_div_u( - c.i32_sub( - c.i32_shl( - c.getLocal("scalarSize"), - c.i32_const(3) - ), - c.i32_const(1) - ), - c.getLocal("chunkSize") - ), - c.i32_const(1) - ) - ), - - - // Allocate memory - - c.setLocal( - "itBit", - c.i32_mul( - c.i32_sub( - c.getLocal("nChunks"), - c.i32_const(1) - ), - c.getLocal("chunkSize") - ) - ), - c.block(c.loop( - c.br_if( - 1, - c.i32_lt_s( - c.getLocal("itBit"), - c.i32_const(0) - ) - ), - - // Double nChunk times - c.if( - c.i32_eqz(c.call(prefix + "_isZero", c.getLocal("pr"))), - [ - ...c.setLocal("j", c.i32_const(0)), - ...c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("j"), - c.getLocal("chunkSize") - ) - ), - - c.call(prefix + "_double", c.getLocal("pr"), c.getLocal("pr")), - - c.setLocal("j", c.i32_add(c.getLocal("j"), c.i32_const(1))), - c.br(0) - )) - ] - ), - - c.call( - fnName + "_chunk", - c.getLocal("pBases"), - c.getLocal("pScalars"), - c.getLocal("scalarSize"), - c.getLocal("n"), - c.getLocal("itBit"), - c.getLocal("chunkSize"), - aux - ), - - c.call( - prefix + "_add", - c.getLocal("pr"), - aux, - c.getLocal("pr") - ), - c.setLocal("itBit", c.i32_sub(c.getLocal("itBit"), c.getLocal("chunkSize"))), - c.br(0) - )) - ); - } - - function buildReduceTable() { - const f = module.addFunction(fnName + "_reduceTable"); - f.addParam("pTable", "i32"); - f.addParam("p", "i32"); // Number of bits of the table - f.addLocal("half", "i32"); - f.addLocal("it1", "i32"); - f.addLocal("it2", "i32"); - f.addLocal("pAcc", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.if( - c.i32_eq(c.getLocal("p"), c.i32_const(1)), - c.ret([]) - ), - c.setLocal( - "half", - c.i32_shl( - c.i32_const(1), - c.i32_sub( - c.getLocal("p"), - c.i32_const(1) - ) - ) - ), - - c.setLocal("it1", c.getLocal("pTable")), - c.setLocal( - "it2", - c.i32_add( - c.getLocal("pTable"), - c.i32_mul( - c.getLocal("half"), - c.i32_const(n8g) - ) - ) - ), - c.setLocal("pAcc", - c.i32_sub( - c.getLocal("it2"), - c.i32_const(n8g) - ) - ), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("it1"), - c.getLocal("pAcc") - ) - ), - c.call( - prefix + "_add", - c.getLocal("it1"), - c.getLocal("it2"), - c.getLocal("it1") - ), - c.call( - prefix + "_add", - c.getLocal("pAcc"), - c.getLocal("it2"), - c.getLocal("pAcc") - ), - c.setLocal("it1", c.i32_add(c.getLocal("it1"), c.i32_const(n8g))), - c.setLocal("it2", c.i32_add(c.getLocal("it2"), c.i32_const(n8g))), - c.br(0) - )), - - c.call( - fnName + "_reduceTable", - c.getLocal("pTable"), - c.i32_sub( - c.getLocal("p"), - c.i32_const(1) - ) - ), - - c.setLocal("p", c.i32_sub(c.getLocal("p"), c.i32_const(1))), - c.block(c.loop( - c.br_if(1, c.i32_eqz(c.getLocal("p"))), - c.call(prefix + "_double", c.getLocal("pAcc"), c.getLocal("pAcc")), - c.setLocal("p", c.i32_sub(c.getLocal("p"), c.i32_const(1))), - c.br(0) - )), - - c.call(prefix + "_add", c.getLocal("pTable"), c.getLocal("pAcc"), c.getLocal("pTable")) - ); - } - - buildGetChunk(); - buildReduceTable(); - buildMutiexpChunk(); - buildMultiexp(); - - module.exportFunction(fnName); - module.exportFunction(fnName +"_chunk"); - - -}; - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ - -const buildTimesScalarNAF = build_timesscalarnaf; -//const buildTimesScalar = require("./build_timesscalar"); -const buildBatchConvertion = build_batchconvertion; -const buildMultiexp$1 = build_multiexp; - -var build_curve_jacobian_a0 = function buildCurve(module, prefix, prefixField, pB) { - - - const n64 = module.modules[prefixField].n64; - const n8 = n64*8; - - if (module.modules[prefix]) return prefix; // already builded - module.modules[prefix] = { - n64: n64*3 - }; - - function buildIsZero() { - const f = module.addFunction(prefix + "_isZero"); - f.addParam("p1", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - f.addCode(c.call( - prefixField + "_isZero", - c.i32_add( - c.getLocal("p1"), - c.i32_const(n8*2) - ) - )); - } - function buildIsZeroAffine() { - const f = module.addFunction(prefix + "_isZeroAffine"); - f.addParam("p1", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.i32_and( - c.call( - prefixField + "_isZero", - c.getLocal("p1") - ), - c.call( - prefixField + "_isZero", - c.i32_add( - c.getLocal("p1"), - c.i32_const(n8) - ) - ) - ) - ); - } - - function buildCopy() { - const f = module.addFunction(prefix + "_copy"); - f.addParam("ps", "i32"); - f.addParam("pd", "i32"); - - const c = f.getCodeBuilder(); - - for (let i=0; i. -*/ - -const bigInt$3 = BigIntegerExports; -const utils$7 = utils$b; - -var build_fft = function buildFFT(module, prefix, gPrefix, fPrefix, opGtimesF) { - - const n64f = module.modules[fPrefix].n64; - const n8f = n64f*8; - - const n64g = module.modules[gPrefix].n64; - const n8g = n64g*8; - - const q = module.modules[fPrefix].q; - - let rem = q.minus(bigInt$3(1)); - let maxBits = 0; - while (!rem.isOdd()) { - maxBits ++; - rem = rem.shiftRight(1); - } - - let nr = bigInt$3(2); - - while ( nr.modPow(q.shiftRight(1), q).equals(1) ) nr = nr.add(1); - - // console.log(nr); - - const w = new Array(maxBits+1); - w[maxBits] = nr.modPow(rem, q); - - let n=maxBits-1; - while (n>=0) { - w[n] = w[n+1].modPow(2, q); - n--; - } - - const bytes = []; - const R = bigInt$3(1).shiftLeft(n8f*8).mod(q); - - for (let i=0; i> i); - } - } - return r; - } - - const rtable = Array(256); - for (let i=0; i<256; i++) { - rtable[i] = rev(i); - } - - const REVTABLE = module.alloc(rtable); - - - function buildLog2() { - const f = module.addFunction(prefix+"__log2"); - f.addParam("n", "i32"); - f.setReturnType("i32"); - f.addLocal("bits", "i32"); - f.addLocal("aux", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.setLocal( - "aux", - c.i32_shr_u( - c.getLocal("n"), - c.i32_const(1) - ) - ) - ); - f.addCode(c.setLocal("bits", c.i32_const(0))); - - f.addCode(c.block(c.loop( - c.br_if( - 1, - c.i32_eqz(c.getLocal("aux")) - ), - - c.setLocal( - "aux", - c.i32_shr_u( - c.getLocal("aux"), - c.i32_const(1) - ) - ), - - c.setLocal( - "bits", - c.i32_add( - c.getLocal("bits"), - c.i32_const(1) - ) - ), - - c.br(0) - ))); - - f.addCode(c.if( - c.i32_ne( - c.getLocal("n"), - c.i32_shl( - c.i32_const(1), - c.getLocal("bits") - ) - ), - c.unreachable() - )); - - f.addCode(c.if( - c.i32_gt_u( - c.getLocal("bits"), - c.i32_const(maxBits) - ), - c.unreachable() - )); - - f.addCode(c.getLocal("bits")); - } - - function buildFFT() { - const f = module.addFunction(prefix+"_fft"); - f.addParam("px", "i32"); - f.addParam("n", "i32"); - - f.addLocal("bits", "i32"); - - const c = f.getCodeBuilder(); - - const One = c.i32_const(module.alloc(n8f)); - - f.addCode( - c.setLocal( - "bits", - c.call( - prefix + "__log2", - c.getLocal("n") - ) - ), - c.call(fPrefix + "_one", One), - c.call( - prefix+"_rawfft", - c.getLocal("px"), - c.getLocal("bits"), - c.i32_const(0), - One - ) - ); - - } - - function buildIFFT() { - const f = module.addFunction(prefix+"_ifft"); - f.addParam("px", "i32"); - f.addParam("n", "i32"); - f.addLocal("bits", "i32"); - f.addLocal("pInv2", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.setLocal( - "bits", - c.call( - prefix + "__log2", - c.getLocal("n") - ) - ), - c.setLocal( - "pInv2", - c.i32_add( - c.i32_const(INV2), - c.i32_mul( - c.getLocal("bits"), - c.i32_const(n8f) - ) - ) - ), - - c.call( - prefix+"_rawfft", - c.getLocal("px"), - c.getLocal("bits"), - c.i32_const(1), - c.getLocal("pInv2") - ), - ); - } - - function buildRawFFT() { - const f = module.addFunction(prefix+"_rawfft"); - f.addParam("px", "i32"); - f.addParam("bits", "i32"); // 2 power - f.addParam("reverse", "i32"); - f.addParam("mulFactor", "i32"); - - f.addLocal("s", "i32"); - f.addLocal("k", "i32"); - f.addLocal("j", "i32"); - f.addLocal("m", "i32"); - f.addLocal("mdiv2", "i32"); - f.addLocal("n", "i32"); - f.addLocal("pwm", "i32"); - f.addLocal("idx1", "i32"); - f.addLocal("idx2", "i32"); - - const c = f.getCodeBuilder(); - - const W = c.i32_const(module.alloc(n8f)); - const T = c.i32_const(module.alloc(n8g)); - const U = c.i32_const(module.alloc(n8g)); - - f.addCode( - c.call(prefix + "__reversePermutation", c.getLocal("px"), c.getLocal("bits")), - c.setLocal("n", c.i32_shl(c.i32_const(1), c.getLocal("bits"))), - c.setLocal("s", c.i32_const(1)), - c.block(c.loop( - c.br_if( - 1, - c.i32_gt_u( - c.getLocal("s"), - c.getLocal("bits") - ) - ), - c.setLocal("m", c.i32_shl(c.i32_const(1), c.getLocal("s"))), - c.setLocal("pwm", - c.i32_add( - c.i32_const(ROOTs), - c.i32_mul( - c.getLocal("s"), - c.i32_const(n8f) - ) - ) - ), - c.setLocal("k", c.i32_const(0)), - c.block(c.loop( - c.br_if( - 1, - c.i32_ge_u( - c.getLocal("k"), - c.getLocal("n") - ) - ), - - c.call(fPrefix + "_one", W), - - c.setLocal("mdiv2", c.i32_shr_u(c.getLocal("m"), c.i32_const(1)) ), - c.setLocal("j", c.i32_const(0)), - c.block(c.loop( - c.br_if( - 1, - c.i32_ge_u( - c.getLocal("j"), - c.getLocal("mdiv2") - ) - ), - - c.setLocal( - "idx1", - c.i32_add( - c.getLocal("px"), - c.i32_mul( - c.i32_add( - c.getLocal("k"), - c.getLocal("j") - ), - c.i32_const(n8g) - ) - ) - ), - - c.setLocal( - "idx2", - c.i32_add( - c.getLocal("idx1"), - c.i32_mul( - c.getLocal("mdiv2"), - c.i32_const(n8g) - ) - ) - ), - - c.call( - opGtimesF, - c.getLocal("idx2"), - W, - T - ), - - c.call( - gPrefix + "_copy", - c.getLocal("idx1"), - U - ), - - c.call( - gPrefix + "_add", - U, - T, - c.getLocal("idx1"), - ), - - c.call( - gPrefix + "_sub", - U, - T, - c.getLocal("idx2"), - ), - - c.call( - fPrefix + "_mul", - W, - c.getLocal("pwm"), - W, - ), - - c.setLocal("j", c.i32_add(c.getLocal("j"), c.i32_const(1))), - c.br(0) - )), - - c.setLocal("k", c.i32_add(c.getLocal("k"), c.getLocal("m"))), - c.br(0) - )), - - c.setLocal("s", c.i32_add(c.getLocal("s"), c.i32_const(1))), - c.br(0) - )), - c.call( - prefix + "__fftFinal", - c.getLocal("px"), - c.getLocal("bits"), - c.getLocal("reverse"), - c.getLocal("mulFactor") - ) - ); - } - - - function buildFinalInverse() { - const f = module.addFunction(prefix+"__fftFinal"); - f.addParam("px", "i32"); - f.addParam("bits", "i32"); - f.addParam("reverse", "i32"); - f.addParam("mulFactor", "i32"); - f.addLocal("n", "i32"); - f.addLocal("ndiv2", "i32"); - f.addLocal("pInv2", "i32"); - f.addLocal("i", "i32"); - f.addLocal("mask", "i32"); - f.addLocal("idx1", "i32"); - f.addLocal("idx2", "i32"); - - const c = f.getCodeBuilder(); - - const T = c.i32_const(module.alloc(n8g)); - - f.addCode( - c.if( - c.i32_and( - c.i32_eqz(c.getLocal("reverse")), - c.call(fPrefix + "_isOne", c.getLocal("mulFactor")) - ), - c.ret([]) - ), - c.setLocal("n", c.i32_shl( c.i32_const(1), c.getLocal("bits"))), - - c.setLocal("mask", c.i32_sub( c.getLocal("n") , c.i32_const(1))), - c.setLocal("i", c.i32_const(1)), - c.setLocal( - "ndiv2", - c.i32_shr_u( - c.getLocal("n"), - c.i32_const(1) - ) - ), - c.block(c.loop( - c.br_if( - 1, - c.i32_ge_u( - c.getLocal("i"), - c.getLocal("ndiv2") - ) - ), - - c.setLocal("idx1", - c.i32_add( - c.getLocal("px"), - c.i32_mul( - c.getLocal("i"), - c.i32_const(n8g) - ) - ) - ), - - c.setLocal("idx2", - c.i32_add( - c.getLocal("px"), - c.i32_mul( - c.i32_sub( - c.getLocal("n"), - c.getLocal("i") - ), - c.i32_const(n8g) - ) - ) - ), - - c.if( - c.getLocal("reverse"), - c.if( - c.call(fPrefix + "_isOne", c.getLocal("mulFactor")), - [ - ...c.call(gPrefix + "_copy", c.getLocal("idx1"), T), - ...c.call(gPrefix + "_copy", c.getLocal("idx2") , c.getLocal("idx1") ), - ...c.call(gPrefix + "_copy", T , c.getLocal("idx2")), - ], - [ - ...c.call(gPrefix + "_copy", c.getLocal("idx1"), T), - ...c.call(opGtimesF , c.getLocal("idx2") , c.getLocal("mulFactor"), c.getLocal("idx1") ), - ...c.call(opGtimesF , T , c.getLocal("mulFactor"), c.getLocal("idx2")), - ] - ), - c.if( - c.call(fPrefix + "_isOne", c.getLocal("mulFactor")), - [ - // Do nothing (It should not be here) - ], - [ - ...c.call(opGtimesF , c.getLocal("idx1") , c.getLocal("mulFactor"), c.getLocal("idx1") ), - ...c.call(opGtimesF , c.getLocal("idx2") , c.getLocal("mulFactor"), c.getLocal("idx2")), - ] - ) - ), - c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), - - c.br(0) - )), - - c.if( - c.call(fPrefix + "_isOne", c.getLocal("mulFactor")), - [ - // Do nothing (It should not be here) - ], - [ - ...c.call(opGtimesF, c.getLocal("px") , c.getLocal("mulFactor"), c.getLocal("px")), - ...c.setLocal("idx2", - c.i32_add( - c.getLocal("px"), - c.i32_mul( - c.getLocal("ndiv2"), - c.i32_const(n8g) - ) - ) - ), - ...c.call(opGtimesF, c.getLocal("idx2"),c.getLocal("mulFactor"), c.getLocal("idx2")) - ] - ) - ); - } - - function buildReversePermutation() { - const f = module.addFunction(prefix+"__reversePermutation"); - f.addParam("px", "i32"); - f.addParam("bits", "i32"); - f.addLocal("n", "i32"); - f.addLocal("i", "i32"); - f.addLocal("ri", "i32"); - f.addLocal("idx1", "i32"); - f.addLocal("idx2", "i32"); - - const c = f.getCodeBuilder(); - - const T = c.i32_const(module.alloc(n8g)); - - f.addCode( - c.setLocal("n", c.i32_shl( c.i32_const(1), c.getLocal("bits"))), - c.setLocal("i", c.i32_const(0)), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("i"), - c.getLocal("n") - ) - ), - - c.setLocal("idx1", - c.i32_add( - c.getLocal("px"), - c.i32_mul( - c.getLocal("i"), - c.i32_const(n8g) - ) - ) - ), - - c.setLocal("ri", c.call(prefix + "__rev", c.getLocal("i"), c.getLocal("bits"))), - - c.setLocal("idx2", - c.i32_add( - c.getLocal("px"), - c.i32_mul( - c.getLocal("ri"), - c.i32_const(n8g) - ) - ) - ), - - c.if( - c.i32_lt_u( - c.getLocal("i"), - c.getLocal("ri") - ), - [ - ...c.call(gPrefix + "_copy", c.getLocal("idx1"), T), - ...c.call(gPrefix + "_copy", c.getLocal("idx2") , c.getLocal("idx1")), - ...c.call(gPrefix + "_copy", T , c.getLocal("idx2")) - ] - ), - - c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), - - c.br(0) - )) - ); - } - - function buildRev() { - const f = module.addFunction(prefix+"__rev"); - f.addParam("x", "i32"); - f.addParam("bits", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.i32_rotl( - c.i32_add( - c.i32_add( - c.i32_shl( - c.i32_load8_u( - c.i32_and( - c.getLocal("x"), - c.i32_const(0xFF) - ), - REVTABLE, - 0 - ), - c.i32_const(24) - ), - c.i32_shl( - c.i32_load8_u( - c.i32_and( - c.i32_shr_u( - c.getLocal("x"), - c.i32_const(8) - ), - c.i32_const(0xFF) - ), - REVTABLE, - 0 - ), - c.i32_const(16) - ), - ), - c.i32_add( - c.i32_shl( - c.i32_load8_u( - c.i32_and( - c.i32_shr_u( - c.getLocal("x"), - c.i32_const(16) - ), - c.i32_const(0xFF) - ), - REVTABLE, - 0 - ), - c.i32_const(8) - ), - c.i32_load8_u( - c.i32_and( - c.i32_shr_u( - c.getLocal("x"), - c.i32_const(24) - ), - c.i32_const(0xFF) - ), - REVTABLE, - 0 - ), - ) - ), - c.getLocal("bits") - ) - ); - } - - - function buildFFTJoin() { - const f = module.addFunction(prefix+"_fftJoin"); - f.addParam("pBuff1", "i32"); - f.addParam("pBuff2", "i32"); - f.addParam("n", "i32"); - f.addParam("first", "i32"); - f.addParam("inc", "i32"); - f.addLocal("idx1", "i32"); - f.addLocal("idx2", "i32"); - f.addLocal("i", "i32"); - - const c = f.getCodeBuilder(); - - const W = c.i32_const(module.alloc(n8f)); - const T = c.i32_const(module.alloc(n8g)); - const U = c.i32_const(module.alloc(n8g)); - - f.addCode( - c.call( fPrefix + "_copy", c.getLocal("first"), W), - c.setLocal("i", c.i32_const(0)), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("i"), - c.getLocal("n") - ) - ), - - c.setLocal( - "idx1", - c.i32_add( - c.getLocal("pBuff1"), - c.i32_mul( - c.getLocal("i"), - c.i32_const(n8g) - ) - ) - ), - - c.setLocal( - "idx2", - c.i32_add( - c.getLocal("pBuff2"), - c.i32_mul( - c.getLocal("i"), - c.i32_const(n8g) - ) - ) - ), - - c.call( - opGtimesF, - c.getLocal("idx2"), - W, - T - ), - - c.call( - gPrefix + "_copy", - c.getLocal("idx1"), - U - ), - - c.call( - gPrefix + "_add", - U, - T, - c.getLocal("idx1"), - ), - - c.call( - gPrefix + "_sub", - U, - T, - c.getLocal("idx2"), - ), - - c.call( - fPrefix + "_mul", - W, - c.getLocal("inc"), - W, - ), - - c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - ); - } - - - function buildFFTJoinExt() { - const f = module.addFunction(prefix+"_fftJoinExt"); - f.addParam("pBuff1", "i32"); - f.addParam("pBuff2", "i32"); - f.addParam("n", "i32"); - f.addParam("first", "i32"); - f.addParam("inc", "i32"); - f.addParam("totalBits", "i32"); - f.addLocal("idx1", "i32"); - f.addLocal("idx2", "i32"); - f.addLocal("i", "i32"); - f.addLocal("pShiftToM", "i32"); - - const c = f.getCodeBuilder(); - - const W = c.i32_const(module.alloc(n8f)); - const U = c.i32_const(module.alloc(n8g)); - - f.addCode( - - c.setLocal("pShiftToM", - c.i32_add( - c.i32_const(SHIFT_TO_M), - c.i32_mul( - c.getLocal("totalBits"), - c.i32_const(n8f) - ) - ) - ), - - - c.call( fPrefix + "_copy", c.getLocal("first"), W), - c.setLocal("i", c.i32_const(0)), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("i"), - c.getLocal("n") - ) - ), - - c.setLocal( - "idx1", - c.i32_add( - c.getLocal("pBuff1"), - c.i32_mul( - c.getLocal("i"), - c.i32_const(n8g) - ) - ) - ), - - c.setLocal( - "idx2", - c.i32_add( - c.getLocal("pBuff2"), - c.i32_mul( - c.getLocal("i"), - c.i32_const(n8g) - ) - ) - ), - - c.call( - gPrefix + "_add", - c.getLocal("idx1"), - c.getLocal("idx2"), - U - ), - - c.call( - opGtimesF, - c.getLocal("idx2"), - c.getLocal("pShiftToM"), - c.getLocal("idx2") - ), - - c.call( - gPrefix + "_add", - c.getLocal("idx1"), - c.getLocal("idx2"), - c.getLocal("idx2") - ), - - c.call( - opGtimesF, - c.getLocal("idx2"), - W, - c.getLocal("idx2"), - ), - - c.call( - gPrefix + "_copy", - U, - c.getLocal("idx1") - ), - - c.call( - fPrefix + "_mul", - W, - c.getLocal("inc"), - W - ), - - c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - ); - } - - function buildFFTJoinExtInv() { - const f = module.addFunction(prefix+"_fftJoinExtInv"); - f.addParam("pBuff1", "i32"); - f.addParam("pBuff2", "i32"); - f.addParam("n", "i32"); - f.addParam("first", "i32"); - f.addParam("inc", "i32"); - f.addParam("totalBits", "i32"); - f.addLocal("idx1", "i32"); - f.addLocal("idx2", "i32"); - f.addLocal("i", "i32"); - f.addLocal("pShiftToM", "i32"); - f.addLocal("pSConst", "i32"); - - const c = f.getCodeBuilder(); - - const W = c.i32_const(module.alloc(n8f)); - const U = c.i32_const(module.alloc(n8g)); - - f.addCode( - - c.setLocal("pShiftToM", - c.i32_add( - c.i32_const(SHIFT_TO_M), - c.i32_mul( - c.getLocal("totalBits"), - c.i32_const(n8f) - ) - ) - ), - c.setLocal("pSConst", - c.i32_add( - c.i32_const(SCONST), - c.i32_mul( - c.getLocal("totalBits"), - c.i32_const(n8f) - ) - ) - ), - - - c.call( fPrefix + "_copy", c.getLocal("first"), W), - c.setLocal("i", c.i32_const(0)), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("i"), - c.getLocal("n") - ) - ), - - c.setLocal( - "idx1", - c.i32_add( - c.getLocal("pBuff1"), - c.i32_mul( - c.getLocal("i"), - c.i32_const(n8g) - ) - ) - ), - - c.setLocal( - "idx2", - c.i32_add( - c.getLocal("pBuff2"), - c.i32_mul( - c.getLocal("i"), - c.i32_const(n8g) - ) - ) - ), - - c.call( - opGtimesF, - c.getLocal("idx2"), - W, - U - ), - - c.call( - gPrefix + "_sub", - c.getLocal("idx1"), - U, - c.getLocal("idx2"), - ), - - c.call( - opGtimesF, - c.getLocal("idx2"), - c.getLocal("pSConst"), - c.getLocal("idx2") - ), - - c.call( - opGtimesF, - c.getLocal("idx1"), - c.getLocal("pShiftToM"), - c.getLocal("idx1") - ), - - c.call( - gPrefix + "_sub", - U, - c.getLocal("idx1"), - c.getLocal("idx1") - ), - - c.call( - opGtimesF, - c.getLocal("idx1"), - c.getLocal("pSConst"), - c.getLocal("idx1") - ), - - c.call( - fPrefix + "_mul", - W, - c.getLocal("inc"), - W - ), - - c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - ); - } - - - - function buildPrepareLagrangeEvaluation() { - const f = module.addFunction(prefix+"_prepareLagrangeEvaluation"); - f.addParam("pBuff1", "i32"); - f.addParam("pBuff2", "i32"); - f.addParam("n", "i32"); - f.addParam("first", "i32"); - f.addParam("inc", "i32"); - f.addParam("totalBits", "i32"); - f.addLocal("idx1", "i32"); - f.addLocal("idx2", "i32"); - f.addLocal("i", "i32"); - f.addLocal("pShiftToM", "i32"); - f.addLocal("pSConst", "i32"); - - const c = f.getCodeBuilder(); - - const W = c.i32_const(module.alloc(n8f)); - const U = c.i32_const(module.alloc(n8g)); - - f.addCode( - - c.setLocal("pShiftToM", - c.i32_add( - c.i32_const(SHIFT_TO_M), - c.i32_mul( - c.getLocal("totalBits"), - c.i32_const(n8f) - ) - ) - ), - c.setLocal("pSConst", - c.i32_add( - c.i32_const(SCONST), - c.i32_mul( - c.getLocal("totalBits"), - c.i32_const(n8f) - ) - ) - ), - - - c.call( fPrefix + "_copy", c.getLocal("first"), W), - c.setLocal("i", c.i32_const(0)), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("i"), - c.getLocal("n") - ) - ), - - c.setLocal( - "idx1", - c.i32_add( - c.getLocal("pBuff1"), - c.i32_mul( - c.getLocal("i"), - c.i32_const(n8g) - ) - ) - ), - - c.setLocal( - "idx2", - c.i32_add( - c.getLocal("pBuff2"), - c.i32_mul( - c.getLocal("i"), - c.i32_const(n8g) - ) - ) - ), - - - c.call( - opGtimesF, - c.getLocal("idx1"), - c.getLocal("pShiftToM"), - U - ), - - c.call( - gPrefix + "_sub", - c.getLocal("idx2"), - U, - U - ), - - c.call( - gPrefix + "_sub", - c.getLocal("idx1"), - c.getLocal("idx2"), - c.getLocal("idx2"), - ), - - c.call( - opGtimesF, - U, - c.getLocal("pSConst"), - c.getLocal("idx1"), - ), - - c.call( - opGtimesF, - c.getLocal("idx2"), - W, - c.getLocal("idx2"), - ), - - c.call( - fPrefix + "_mul", - W, - c.getLocal("inc"), - W - ), - - c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - ); - } - - function buildFFTMix() { - const f = module.addFunction(prefix+"_fftMix"); - f.addParam("pBuff", "i32"); - f.addParam("n", "i32"); - f.addParam("exp", "i32"); - f.addLocal("nGroups", "i32"); - f.addLocal("nPerGroup", "i32"); - f.addLocal("nPerGroupDiv2", "i32"); - f.addLocal("pairOffset", "i32"); - f.addLocal("idx1", "i32"); - f.addLocal("idx2", "i32"); - f.addLocal("i", "i32"); - f.addLocal("j", "i32"); - f.addLocal("pwm", "i32"); - - const c = f.getCodeBuilder(); - - const W = c.i32_const(module.alloc(n8f)); - const T = c.i32_const(module.alloc(n8g)); - const U = c.i32_const(module.alloc(n8g)); - - f.addCode( - c.setLocal("nPerGroup", c.i32_shl(c.i32_const(1), c.getLocal("exp"))), - c.setLocal("nPerGroupDiv2", c.i32_shr_u(c.getLocal("nPerGroup"), c.i32_const(1))), - c.setLocal("nGroups", c.i32_shr_u(c.getLocal("n"), c.getLocal("exp"))), - c.setLocal("pairOffset", c.i32_mul(c.getLocal("nPerGroupDiv2"), c.i32_const(n8g))), - c.setLocal("pwm", - c.i32_add( - c.i32_const(ROOTs), - c.i32_mul( - c.getLocal("exp"), - c.i32_const(n8f) - ) - ) - ), - c.setLocal("i", c.i32_const(0)), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("i"), - c.getLocal("nGroups") - ) - ), - c.call( fPrefix + "_one", W), - c.setLocal("j", c.i32_const(0)), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("j"), - c.getLocal("nPerGroupDiv2") - ) - ), - - c.setLocal( - "idx1", - c.i32_add( - c.getLocal("pBuff"), - c.i32_mul( - c.i32_add( - c.i32_mul( - c.getLocal("i"), - c.getLocal("nPerGroup") - ), - c.getLocal("j") - ), - c.i32_const(n8g) - ) - ) - ), - - c.setLocal( - "idx2", - c.i32_add( - c.getLocal("idx1"), - c.getLocal("pairOffset") - ) - ), - - c.call( - opGtimesF, - c.getLocal("idx2"), - W, - T - ), - - c.call( - gPrefix + "_copy", - c.getLocal("idx1"), - U - ), - - c.call( - gPrefix + "_add", - U, - T, - c.getLocal("idx1"), - ), - - c.call( - gPrefix + "_sub", - U, - T, - c.getLocal("idx2"), - ), - - c.call( - fPrefix + "_mul", - W, - c.getLocal("pwm"), - W, - ), - c.setLocal("j", c.i32_add(c.getLocal("j"), c.i32_const(1))), - c.br(0) - )), - c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - ); - } - - - // Reverse all and multiply by factor - function buildFFTFinal() { - const f = module.addFunction(prefix+"_fftFinal"); - f.addParam("pBuff", "i32"); - f.addParam("n", "i32"); - f.addParam("factor", "i32"); - f.addLocal("idx1", "i32"); - f.addLocal("idx2", "i32"); - f.addLocal("i", "i32"); - f.addLocal("ndiv2", "i32"); - - const c = f.getCodeBuilder(); - - const T = c.i32_const(module.alloc(n8g)); - - f.addCode( - c.setLocal("ndiv2", c.i32_shr_u(c.getLocal("n"), c.i32_const(1))), - c.if( - c.i32_and( - c.getLocal("n"), - c.i32_const(1) - ), - c.call( - opGtimesF, - c.i32_add( - c.getLocal("pBuff"), - c.i32_mul( - c.getLocal("ndiv2"), - c.i32_const(n8g) - ) - ), - c.getLocal("factor"), - c.i32_add( - c.getLocal("pBuff"), - c.i32_mul( - c.getLocal("ndiv2"), - c.i32_const(n8g) - ) - ), - ), - ), - c.setLocal("i", c.i32_const(0)), - c.block(c.loop( - c.br_if( - 1, - c.i32_ge_u( - c.getLocal("i"), - c.getLocal("ndiv2") - ) - ), - - c.setLocal( - "idx1", - c.i32_add( - c.getLocal("pBuff"), - c.i32_mul( - c.getLocal("i"), - c.i32_const(n8g) - ) - ) - ), - - c.setLocal( - "idx2", - c.i32_add( - c.getLocal("pBuff"), - c.i32_mul( - c.i32_sub( - c.i32_sub( - c.getLocal("n"), - c.i32_const(1) - ), - c.getLocal("i") - ), - c.i32_const(n8g) - ) - ) - ), - - c.call( - opGtimesF, - c.getLocal("idx2"), - c.getLocal("factor"), - T - ), - - c.call( - opGtimesF, - c.getLocal("idx1"), - c.getLocal("factor"), - c.getLocal("idx2"), - ), - - c.call( - gPrefix + "_copy", - T, - c.getLocal("idx1"), - ), - - c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - ); - } - - buildRev(); - buildReversePermutation(); - buildFinalInverse(); - buildRawFFT(); - buildLog2(); - buildFFT(); - buildIFFT(); - buildFFTJoin(); - buildFFTJoinExt(); - buildFFTJoinExtInv(); - buildFFTMix(); - buildFFTFinal(); - buildPrepareLagrangeEvaluation(); - - module.exportFunction(prefix+"_fft"); - module.exportFunction(prefix+"_ifft"); - module.exportFunction(prefix+"_rawfft"); - module.exportFunction(prefix+"_fftJoin"); - module.exportFunction(prefix+"_fftJoinExt"); - module.exportFunction(prefix+"_fftJoinExtInv"); - module.exportFunction(prefix+"_fftMix"); - module.exportFunction(prefix+"_fftFinal"); - module.exportFunction(prefix+"_prepareLagrangeEvaluation"); - -}; - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ - -var build_pol = function buildPol(module, prefix, prefixField) { - - const n64 = module.modules[prefixField].n64; - const n8 = n64*8; - - - function buildZero() { - const f = module.addFunction(prefix+"_zero"); - f.addParam("px", "i32"); - f.addParam("n", "i32"); - f.addLocal("lastp", "i32"); - f.addLocal("p", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.setLocal("p", c.getLocal("px")), - c.setLocal( - "lastp", - c.i32_add( - c.getLocal("px"), - c.i32_mul( - c.getLocal("n"), - c.i32_const(n8) - ) - ) - ), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("p"), - c.getLocal("lastp") - ) - ), - c.call(prefixField + "_zero", c.getLocal("p")), - c.setLocal("p", c.i32_add(c.getLocal("p"), c.i32_const(n8))), - c.br(0) - )) - ); - } - - function buildConstructLC() { - const f = module.addFunction(prefix+"_constructLC"); - f.addParam("ppolynomials", "i32"); - f.addParam("psignals", "i32"); - f.addParam("nSignals", "i32"); - f.addParam("pres", "i32"); - f.addLocal("i", "i32"); - f.addLocal("j", "i32"); - f.addLocal("pp", "i32"); - f.addLocal("ps", "i32"); - f.addLocal("pd", "i32"); - f.addLocal("ncoefs", "i32"); - - const c = f.getCodeBuilder(); - - const aux = c.i32_const(module.alloc(n8)); - - f.addCode( - c.setLocal("i", c.i32_const(0)), - c.setLocal("pp", c.getLocal("ppolynomials")), - c.setLocal("ps", c.getLocal("psignals")), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("i"), - c.getLocal("nSignals") - ) - ), - - c.setLocal("ncoefs", c.i32_load(c.getLocal("pp"))), - c.setLocal("pp", c.i32_add(c.getLocal("pp"), c.i32_const(4))), - - c.setLocal("j", c.i32_const(0)), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("j"), - c.getLocal("ncoefs") - ) - ), - - c.setLocal( - "pd", - c.i32_add( - c.getLocal("pres"), - c.i32_mul( - c.i32_load(c.getLocal("pp")), - c.i32_const(n8) - ) - ) - ), - - c.setLocal("pp", c.i32_add(c.getLocal("pp"), c.i32_const(4))), - - - c.call( - prefixField + "_mul", - c.getLocal("ps"), - c.getLocal("pp"), - aux - ), - - c.call( - prefixField + "_add", - aux, - c.getLocal("pd"), - c.getLocal("pd") - ), - - c.setLocal("pp", c.i32_add(c.getLocal("pp"), c.i32_const(n8))), - c.setLocal("j", c.i32_add(c.getLocal("j"), c.i32_const(1))), - c.br(0) - )), - - c.setLocal("ps", c.i32_add(c.getLocal("ps"), c.i32_const(n8))), - c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - ); - - } - - buildZero(); - buildConstructLC(); - - - module.exportFunction(prefix + "_zero"); - module.exportFunction(prefix + "_constructLC"); - - return prefix; - - - - -}; - -var build_qap = function buildQAP(module, prefix, prefixField) { - - const n64 = module.modules[prefixField].n64; - const n8 = n64*8; - - - function buildBuildABC() { - const f = module.addFunction(prefix+"_buildABC"); - f.addParam("pCoefs", "i32"); - f.addParam("nCoefs", "i32"); - f.addParam("pWitness", "i32"); - f.addParam("pA", "i32"); - f.addParam("pB", "i32"); - f.addParam("pC", "i32"); - f.addParam("offsetOut", "i32"); - f.addParam("nOut", "i32"); - f.addParam("offsetWitness", "i32"); - f.addParam("nWitness", "i32"); - f.addLocal("it", "i32"); - f.addLocal("ita", "i32"); - f.addLocal("itb", "i32"); - f.addLocal("last", "i32"); - f.addLocal("m", "i32"); - f.addLocal("c", "i32"); - f.addLocal("s", "i32"); - f.addLocal("pOut", "i32"); - - const c = f.getCodeBuilder(); - - const aux = c.i32_const(module.alloc(n8)); - - f.addCode( - - // Set output a and b to 0 - c.setLocal("ita", c.getLocal("pA")), - c.setLocal("itb", c.getLocal("pB")), - c.setLocal( - "last", - c.i32_add( - c.getLocal("pA"), - c.i32_mul( - c.getLocal("nOut"), - c.i32_const(n8) - ) - ) - ), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("ita"), - c.getLocal("last") - ) - ), - c.call(prefixField + "_zero", c.getLocal("ita")), - c.call(prefixField + "_zero", c.getLocal("itb")), - c.setLocal("ita", c.i32_add(c.getLocal("ita"), c.i32_const(n8))), - c.setLocal("itb", c.i32_add(c.getLocal("itb"), c.i32_const(n8))), - c.br(0) - )), - - - c.setLocal("it", c.getLocal("pCoefs")), - c.setLocal( - "last", - c.i32_add( - c.getLocal("pCoefs"), - c.i32_mul( - c.getLocal("nCoefs"), - c.i32_const(n8+12) - ) - ) - ), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("it"), - c.getLocal("last") - ) - ), - c.setLocal( - "s", - c.i32_load(c.getLocal("it"), 8) - ), - c.if( - c.i32_or( - c.i32_lt_u( - c.getLocal("s"), - c.getLocal("offsetWitness"), - ), - c.i32_ge_u( - c.getLocal("s"), - c.i32_add( - c.getLocal("offsetWitness"), - c.getLocal("nWitness"), - ) - ) - ), - [ - ...c.setLocal("it", c.i32_add(c.getLocal("it"), c.i32_const(n8+12))), - ...c.br(1) - ] - ), - - c.setLocal( - "m", - c.i32_load(c.getLocal("it")) - ), - c.if( - c.i32_eq(c.getLocal("m"), c.i32_const(0)), - c.setLocal("pOut", c.getLocal("pA")), - c.if( - c.i32_eq(c.getLocal("m"), c.i32_const(1)), - c.setLocal("pOut", c.getLocal("pB")), - [ - ...c.setLocal("it", c.i32_add(c.getLocal("it"), c.i32_const(n8+12))), - ...c.br(1) - ] - ) - ), - c.setLocal( - "c", - c.i32_load(c.getLocal("it"), 4) - ), - c.if( - c.i32_or( - c.i32_lt_u( - c.getLocal("c"), - c.getLocal("offsetOut"), - ), - c.i32_ge_u( - c.getLocal("c"), - c.i32_add( - c.getLocal("offsetOut"), - c.getLocal("nOut"), - ) - ) - ), - [ - ...c.setLocal("it", c.i32_add(c.getLocal("it"), c.i32_const(n8+12))), - ...c.br(1) - ] - ), - c.setLocal( - "pOut", - c.i32_add( - c.getLocal("pOut"), - c.i32_mul( - c.i32_sub( - c.getLocal("c"), - c.getLocal("offsetOut") - ), - c.i32_const(n8) - ) - ) - ), - c.call( - prefixField + "_mul", - c.i32_add( - c.getLocal("pWitness"), - c.i32_mul( - c.i32_sub(c.getLocal("s"), c.getLocal("offsetWitness")), - c.i32_const(n8) - ) - ), - c.i32_add( c.getLocal("it"), c.i32_const(12)), - aux - ), - c.call( - prefixField + "_add", - c.getLocal("pOut"), - aux, - c.getLocal("pOut"), - ), - c.setLocal("it", c.i32_add(c.getLocal("it"), c.i32_const(n8+12))), - c.br(0) - )), - - c.setLocal("ita", c.getLocal("pA")), - c.setLocal("itb", c.getLocal("pB")), - c.setLocal("it", c.getLocal("pC")), - c.setLocal( - "last", - c.i32_add( - c.getLocal("pA"), - c.i32_mul( - c.getLocal("nOut"), - c.i32_const(n8) - ) - ) - ), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("ita"), - c.getLocal("last") - ) - ), - c.call( - prefixField + "_mul", - c.getLocal("ita"), - c.getLocal("itb"), - c.getLocal("it") - ), - c.setLocal("ita", c.i32_add(c.getLocal("ita"), c.i32_const(n8))), - c.setLocal("itb", c.i32_add(c.getLocal("itb"), c.i32_const(n8))), - c.setLocal("it", c.i32_add(c.getLocal("it"), c.i32_const(n8))), - c.br(0) - )), - - ); - } - - function buildJoinABC() { - const f = module.addFunction(prefix+"_joinABC"); - f.addParam("pA", "i32"); - f.addParam("pB", "i32"); - f.addParam("pC", "i32"); - f.addParam("n", "i32"); - f.addParam("pP", "i32"); - f.addLocal("ita", "i32"); - f.addLocal("itb", "i32"); - f.addLocal("itc", "i32"); - f.addLocal("itp", "i32"); - f.addLocal("last", "i32"); - - const c = f.getCodeBuilder(); - - const aux = c.i32_const(module.alloc(n8)); - - f.addCode( - c.setLocal("ita", c.getLocal("pA")), - c.setLocal("itb", c.getLocal("pB")), - c.setLocal("itc", c.getLocal("pC")), - c.setLocal("itp", c.getLocal("pP")), - c.setLocal( - "last", - c.i32_add( - c.getLocal("pA"), - c.i32_mul( - c.getLocal("n"), - c.i32_const(n8) - ) - ) - ), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("ita"), - c.getLocal("last") - ) - ), - c.call( - prefixField + "_mul", - c.getLocal("ita"), - c.getLocal("itb"), - aux - ), - c.call( - prefixField + "_sub", - aux, - c.getLocal("itc"), - c.getLocal("itp"), - ), - c.setLocal("ita", c.i32_add(c.getLocal("ita"), c.i32_const(n8))), - c.setLocal("itb", c.i32_add(c.getLocal("itb"), c.i32_const(n8))), - c.setLocal("itc", c.i32_add(c.getLocal("itc"), c.i32_const(n8))), - c.setLocal("itp", c.i32_add(c.getLocal("itp"), c.i32_const(n8))), - c.br(0) - )) - ); - } - - function buildBatchAdd() { - const f = module.addFunction(prefix+"_batchAdd"); - f.addParam("pa", "i32"); - f.addParam("pb", "i32"); - f.addParam("n", "i32"); - f.addParam("pr", "i32"); - f.addLocal("ita", "i32"); - f.addLocal("itb", "i32"); - f.addLocal("itr", "i32"); - f.addLocal("last", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.setLocal("ita", c.getLocal("pa")), - c.setLocal("itb", c.getLocal("pb")), - c.setLocal("itr", c.getLocal("pr")), - c.setLocal( - "last", - c.i32_add( - c.getLocal("pa"), - c.i32_mul( - c.getLocal("n"), - c.i32_const(n8) - ) - ) - ), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("ita"), - c.getLocal("last") - ) - ), - c.call( - prefixField + "_add", - c.getLocal("ita"), - c.getLocal("itb"), - c.getLocal("itr"), - ), - c.setLocal("ita", c.i32_add(c.getLocal("ita"), c.i32_const(n8))), - c.setLocal("itb", c.i32_add(c.getLocal("itb"), c.i32_const(n8))), - c.setLocal("itr", c.i32_add(c.getLocal("itr"), c.i32_const(n8))), - c.br(0) - )) - ); - } - - buildBuildABC(); - buildJoinABC(); - buildBatchAdd(); - - module.exportFunction(prefix + "_buildABC"); - module.exportFunction(prefix + "_joinABC"); - module.exportFunction(prefix + "_batchAdd"); - - return prefix; - -}; - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ - -var build_applykey = function buildApplyKey(module, fnName, gPrefix, frPrefix, sizeGIn, sizeGOut, sizeF, opGtimesF) { - - const f = module.addFunction(fnName); - f.addParam("pIn", "i32"); - f.addParam("n", "i32"); - f.addParam("pFirst", "i32"); - f.addParam("pInc", "i32"); - f.addParam("pOut", "i32"); - f.addLocal("pOldFree", "i32"); - f.addLocal("i", "i32"); - f.addLocal("pFrom", "i32"); - f.addLocal("pTo", "i32"); - - const c = f.getCodeBuilder(); - - const t = c.i32_const(module.alloc(sizeF)); - - f.addCode( - c.setLocal("pFrom", c.getLocal("pIn")), - c.setLocal("pTo", c.getLocal("pOut")), - ); - - // t = first - f.addCode( - c.call( - frPrefix + "_copy", - c.getLocal("pFirst"), - t - ) - ); - f.addCode( - c.setLocal("i", c.i32_const(0)), - c.block(c.loop( - c.br_if(1, c.i32_eq ( c.getLocal("i"), c.getLocal("n") )), - - c.call( - opGtimesF, - c.getLocal("pFrom"), - t, - c.getLocal("pTo") - ), - c.setLocal("pFrom", c.i32_add(c.getLocal("pFrom"), c.i32_const(sizeGIn))), - c.setLocal("pTo", c.i32_add(c.getLocal("pTo"), c.i32_const(sizeGOut))), - - // t = t* inc - c.call( - frPrefix + "_mul", - t, - c.getLocal("pInc"), - t - ), - c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - ); - - module.exportFunction(fnName); - -}; - -const bigInt$2 = BigIntegerExports; -const utils$6 = utils$b; - -const buildF1m$1 =build_f1m; -const buildF1$1 =build_f1; -const buildF2m$1 =build_f2m; -const buildF3m$1 =build_f3m; -const buildCurve$1 =build_curve_jacobian_a0; -const buildFFT$2 = build_fft; -const buildPol$1 = build_pol; -const buildQAP$1 = build_qap; -const buildApplyKey$1 = build_applykey; - -var build_bn128 = function buildBN128(module, _prefix) { - - const prefix = _prefix || "bn128"; - - if (module.modules[prefix]) return prefix; // already builded - - const q = bigInt$2("21888242871839275222246405745257275088696311157297823662689037894645226208583"); - const r = bigInt$2("21888242871839275222246405745257275088548364400416034343698204186575808495617"); - - - const n64 = Math.floor((q.minus(1).bitLength() - 1)/64) +1; - const n8 = n64*8; - const frsize = n8; - const f1size = n8; - const f2size = f1size * 2; - const ftsize = f1size * 12; - - const pr = module.alloc(utils$6.bigInt2BytesLE( r, frsize )); - - const f1mPrefix = buildF1m$1(module, q, "f1m"); - buildF1$1(module, r, "fr", "frm"); - - const pG1b = module.alloc(utils$6.bigInt2BytesLE( toMontgomery(bigInt$2(3)), f1size )); - const g1mPrefix = buildCurve$1(module, "g1m", "f1m", pG1b); - - buildFFT$2(module, "frm", "frm", "frm", "frm_mul"); - - buildPol$1(module, "pol", "frm"); - buildQAP$1(module, "qap", "frm"); - - const f2mPrefix = buildF2m$1(module, "f1m_neg", "f2m", "f1m"); - const pG2b = module.alloc([ - ...utils$6.bigInt2BytesLE( toMontgomery(bigInt$2("19485874751759354771024239261021720505790618469301721065564631296452457478373")), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(bigInt$2("266929791119991161246907387137283842545076965332900288569378510910307636690")), f1size ) - ]); - const g2mPrefix = buildCurve$1(module, "g2m", "f2m", pG2b); - - - function buildGTimesFr(fnName, opMul) { - const f = module.addFunction(fnName); - f.addParam("pG", "i32"); - f.addParam("pFr", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - const AUX = c.i32_const(module.alloc(n8)); - - f.addCode( - c.call("frm_fromMontgomery", c.getLocal("pFr"), AUX), - c.call( - opMul, - c.getLocal("pG"), - AUX, - c.i32_const(n8), - c.getLocal("pr") - ) - ); - - module.exportFunction(fnName); - } - buildGTimesFr("g1m_timesFr", "g1m_timesScalar"); - buildFFT$2(module, "g1m", "g1m", "frm", "g1m_timesFr"); - - buildGTimesFr("g2m_timesFr", "g2m_timesScalar"); - buildFFT$2(module, "g2m", "g2m", "frm", "g2m_timesFr"); - - buildGTimesFr("g1m_timesFrAffine", "g1m_timesScalarAffine"); - buildGTimesFr("g2m_timesFrAffine", "g2m_timesScalarAffine"); - - buildApplyKey$1(module, "frm_batchApplyKey", "fmr", "frm", n8, n8, n8, "frm_mul"); - buildApplyKey$1(module, "g1m_batchApplyKey", "g1m", "frm", n8*3, n8*3, n8, "g1m_timesFr"); - buildApplyKey$1(module, "g1m_batchApplyKeyMixed", "g1m", "frm", n8*2, n8*3, n8, "g1m_timesFrAffine"); - buildApplyKey$1(module, "g2m_batchApplyKey", "g2m", "frm", n8*2*3, n8*3*2, n8, "g2m_timesFr"); - buildApplyKey$1(module, "g2m_batchApplyKeyMixed", "g2m", "frm", n8*2*2, n8*3*2, n8, "g2m_timesFrAffine"); - - function toMontgomery(a) { - return bigInt$2(a).times( bigInt$2.one.shiftLeft(f1size*8)).mod(q); - } - - const G1gen = [ - bigInt$2("1"), - bigInt$2("2"), - bigInt$2.one - ]; - - const pG1gen = module.alloc( - [ - ...utils$6.bigInt2BytesLE( toMontgomery(G1gen[0]), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(G1gen[1]), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(G1gen[2]), f1size ), - ] - ); - - const G1zero = [ - bigInt$2.zero, - bigInt$2.one, - bigInt$2.zero - ]; - - const pG1zero = module.alloc( - [ - ...utils$6.bigInt2BytesLE( toMontgomery(G1zero[0]), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(G1zero[1]), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(G1zero[2]), f1size ) - ] - ); - - const G2gen = [ - [ - bigInt$2("10857046999023057135944570762232829481370756359578518086990519993285655852781"), - bigInt$2("11559732032986387107991004021392285783925812861821192530917403151452391805634"), - ],[ - bigInt$2("8495653923123431417604973247489272438418190587263600148770280649306958101930"), - bigInt$2("4082367875863433681332203403145435568316851327593401208105741076214120093531"), - ],[ - bigInt$2.one, - bigInt$2.zero, - ] - ]; - - const pG2gen = module.alloc( - [ - ...utils$6.bigInt2BytesLE( toMontgomery(G2gen[0][0]), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(G2gen[0][1]), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(G2gen[1][0]), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(G2gen[1][1]), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(G2gen[2][0]), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(G2gen[2][1]), f1size ), - ] - ); - - const G2zero = [ - [ - bigInt$2.zero, - bigInt$2.zero, - ],[ - bigInt$2.one, - bigInt$2.zero, - ],[ - bigInt$2.zero, - bigInt$2.zero, - ] - ]; - - const pG2zero = module.alloc( - [ - ...utils$6.bigInt2BytesLE( toMontgomery(G2zero[0][0]), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(G2zero[0][1]), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(G2zero[1][0]), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(G2zero[1][1]), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(G2zero[2][0]), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(G2zero[2][1]), f1size ), - ] - ); - - const pOneT = module.alloc([ - ...utils$6.bigInt2BytesLE( toMontgomery(1), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(0), f1size ), - ]); - - const pNonResidueF6 = module.alloc([ - ...utils$6.bigInt2BytesLE( toMontgomery(9), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery(1), f1size ), - ]); - - const pTwoInv = module.alloc([ - ...utils$6.bigInt2BytesLE( toMontgomery( bigInt$2(2).modInv(q)), f1size ), - ...utils$6.bigInt2BytesLE( bigInt$2(0), f1size ) - ]); - - const pAltBn128Twist = pNonResidueF6; - - const pTwistCoefB = module.alloc([ - ...utils$6.bigInt2BytesLE( toMontgomery("19485874751759354771024239261021720505790618469301721065564631296452457478373"), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery("266929791119991161246907387137283842545076965332900288569378510910307636690"), f1size ), - ]); - - function build_mulNR6() { - const f = module.addFunction(prefix + "_mulNR6"); - f.addParam("x", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call( - f2mPrefix + "_mul", - c.i32_const(pNonResidueF6), - c.getLocal("x"), - c.getLocal("pr") - ) - ); - } - build_mulNR6(); - - const f6mPrefix = buildF3m$1(module, prefix+"_mulNR6", "f6m", "f2m"); - - function build_mulNR12() { - const f = module.addFunction(prefix + "_mulNR12"); - f.addParam("x", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call( - f2mPrefix + "_mul", - c.i32_const(pNonResidueF6), - c.i32_add(c.getLocal("x"), c.i32_const(n8*4)), - c.getLocal("pr") - ), - c.call( - f2mPrefix + "_copy", - c.getLocal("x"), - c.i32_add(c.getLocal("pr"), c.i32_const(n8*2)), - ), - c.call( - f2mPrefix + "_copy", - c.i32_add(c.getLocal("x"), c.i32_const(n8*2)), - c.i32_add(c.getLocal("pr"), c.i32_const(n8*4)), - ) - ); - } - build_mulNR12(); - - const ftmPrefix = buildF2m$1(module, prefix+"_mulNR12", "ftm", f6mPrefix); - - - const ateLoopCount = bigInt$2("29793968203157093288"); - const ateLoopBitBytes = bits(ateLoopCount); - const pAteLoopBitBytes = module.alloc(ateLoopBitBytes); - - const ateCoefSize = 3 * f2size; - const ateNDblCoefs = ateLoopBitBytes.length-1; - const ateNAddCoefs = ateLoopBitBytes.reduce((acc, b) => acc + ( b!=0 ? 1 : 0) ,0); - const ateNCoefs = ateNAddCoefs + ateNDblCoefs + 1; - const prePSize = 3*2*n8; - const preQSize = 3*n8*2 + ateNCoefs*ateCoefSize; - - - module.modules[prefix] = { - n64: n64, - pG1gen: pG1gen, - pG1zero: pG1zero, - pG1b: pG1b, - pG2gen: pG2gen, - pG2zero: pG2zero, - pG2b: pG2b, - pq: module.modules["f1m"].pq, - pr: pr, - pOneT: pOneT, - prePSize: prePSize, - preQSize: preQSize, - r: r.toString(), - q: q.toString() - }; - - // console.log("PrePSize: " +prePSize); - // console.log("PreQSize: " +preQSize); - - const finalExpZ = bigInt$2("4965661367192848881"); - - function naf(n) { - let E = n; - const res = []; - while (E.gt(bigInt$2.zero)) { - if (E.isOdd()) { - const z = 2 - E.mod(4).toJSNumber(); - res.push( z ); - E = E.minus(z); - } else { - res.push( 0 ); - } - E = E.shiftRight(1); - } - return res; - } - - function bits(n) { - let E = n; - const res = []; - while (E.gt(bigInt$2.zero)) { - if (E.isOdd()) { - res.push( 1 ); - } else { - res.push( 0 ); - } - E = E.shiftRight(1); - } - return res; - } - - function buildPrepareG1() { - const f = module.addFunction(prefix+ "_prepareG1"); - f.addParam("pP", "i32"); - f.addParam("ppreP", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call(g1mPrefix + "_normalize", c.getLocal("pP"), c.getLocal("ppreP")), // TODO Remove if already in affine - ); - } - - function buildPrepAddStep() { - const f = module.addFunction(prefix+ "_prepAddStep"); - f.addParam("pQ", "i32"); - f.addParam("pR", "i32"); - f.addParam("pCoef", "i32"); - - const c = f.getCodeBuilder(); - - const X2 = c.getLocal("pQ"); - const Y2 = c.i32_add(c.getLocal("pQ"), c.i32_const(f2size)); - - const X1 = c.getLocal("pR"); - const Y1 = c.i32_add(c.getLocal("pR"), c.i32_const(f2size)); - const Z1 = c.i32_add(c.getLocal("pR"), c.i32_const(2*f2size)); - - const ELL_0 = c.getLocal("pCoef"); - const ELL_VW = c.i32_add(c.getLocal("pCoef"), c.i32_const(f2size)); - const ELL_VV = c.i32_add(c.getLocal("pCoef"), c.i32_const(2*f2size)); - - const D = ELL_VW; - const E = c.i32_const(module.alloc(f2size)); - const F = c.i32_const(module.alloc(f2size)); - const G = c.i32_const(module.alloc(f2size)); - const H = c.i32_const(module.alloc(f2size)); - const I = c.i32_const(module.alloc(f2size)); - const J = c.i32_const(module.alloc(f2size)); - const AUX = c.i32_const(module.alloc(f2size)); - - f.addCode( - // D = X1 - X2*Z1 - c.call(f2mPrefix + "_mul", X2, Z1, D), - c.call(f2mPrefix + "_sub", X1, D, D), - - // E = Y1 - Y2*Z1 - c.call(f2mPrefix + "_mul", Y2, Z1, E), - c.call(f2mPrefix + "_sub", Y1, E, E), - - // F = D^2 - c.call(f2mPrefix + "_square", D, F), - - // G = E^2 - c.call(f2mPrefix + "_square", E, G), - - // H = D*F - c.call(f2mPrefix + "_mul", D, F, H), - - // I = X1 * F - c.call(f2mPrefix + "_mul", X1, F, I), - - // J = H + Z1*G - (I+I) - c.call(f2mPrefix + "_add", I, I, AUX), - c.call(f2mPrefix + "_mul", Z1, G, J), - c.call(f2mPrefix + "_add", H, J, J), - c.call(f2mPrefix + "_sub", J, AUX, J), - - - // X3 (X1) = D*J - c.call(f2mPrefix + "_mul", D, J, X1), - - // Y3 (Y1) = E*(I-J)-(H*Y1) - c.call(f2mPrefix + "_mul", H, Y1, Y1), - c.call(f2mPrefix + "_sub", I, J, AUX), - c.call(f2mPrefix + "_mul", E, AUX, AUX), - c.call(f2mPrefix + "_sub", AUX, Y1, Y1), - - // Z3 (Z1) = Z1*H - c.call(f2mPrefix + "_mul", Z1, H, Z1), - - // ell_0 = xi * (E * X2 - D * Y2) - c.call(f2mPrefix + "_mul", D, Y2, AUX), - c.call(f2mPrefix + "_mul", E, X2, ELL_0), - c.call(f2mPrefix + "_sub", ELL_0, AUX, ELL_0), - c.call(f2mPrefix + "_mul", ELL_0, c.i32_const(pAltBn128Twist), ELL_0), - - - // ell_VV = - E (later: * xP) - c.call(f2mPrefix + "_neg", E, ELL_VV), - - // ell_VW = D (later: * yP ) - // Already assigned - - ); - } - - - - function buildPrepDoubleStep() { - const f = module.addFunction(prefix+ "_prepDblStep"); - f.addParam("pR", "i32"); - f.addParam("pCoef", "i32"); - - const c = f.getCodeBuilder(); - - const X1 = c.getLocal("pR"); - const Y1 = c.i32_add(c.getLocal("pR"), c.i32_const(f2size)); - const Z1 = c.i32_add(c.getLocal("pR"), c.i32_const(2*f2size)); - - const ELL_0 = c.getLocal("pCoef"); - const ELL_VW = c.i32_add(c.getLocal("pCoef"), c.i32_const(f2size)); - const ELL_VV = c.i32_add(c.getLocal("pCoef"), c.i32_const(2*f2size)); - - const A = c.i32_const(module.alloc(f2size)); - const B = c.i32_const(module.alloc(f2size)); - const C = c.i32_const(module.alloc(f2size)); - const D = c.i32_const(module.alloc(f2size)); - const E = c.i32_const(module.alloc(f2size)); - const F = c.i32_const(module.alloc(f2size)); - const G = c.i32_const(module.alloc(f2size)); - const H = c.i32_const(module.alloc(f2size)); - const I = c.i32_const(module.alloc(f2size)); - const J = c.i32_const(module.alloc(f2size)); - const E2 = c.i32_const(module.alloc(f2size)); - const AUX = c.i32_const(module.alloc(f2size)); - - f.addCode( - - // A = X1 * Y1 / 2 - c.call(f2mPrefix + "_mul", Y1, c.i32_const(pTwoInv), A), - c.call(f2mPrefix + "_mul", X1, A, A), - - // B = Y1^2 - c.call(f2mPrefix + "_square", Y1, B), - - // C = Z1^2 - c.call(f2mPrefix + "_square", Z1, C), - - // D = 3 * C - c.call(f2mPrefix + "_add", C, C, D), - c.call(f2mPrefix + "_add", D, C, D), - - // E = twist_b * D - c.call(f2mPrefix + "_mul", c.i32_const(pTwistCoefB), D, E), - - // F = 3 * E - c.call(f2mPrefix + "_add", E, E, F), - c.call(f2mPrefix + "_add", E, F, F), - - // G = (B+F)/2 - c.call(f2mPrefix + "_add", B, F, G), - c.call(f2mPrefix + "_mul", G, c.i32_const(pTwoInv), G), - - // H = (Y1+Z1)^2-(B+C) - c.call(f2mPrefix + "_add", B, C, AUX), - c.call(f2mPrefix + "_add", Y1, Z1, H), - c.call(f2mPrefix + "_square", H, H), - c.call(f2mPrefix + "_sub", H, AUX, H), - - // I = E-B - c.call(f2mPrefix + "_sub", E, B, I), - - // J = X1^2 - c.call(f2mPrefix + "_square", X1, J), - - // E_squared = E^2 - c.call(f2mPrefix + "_square", E, E2), - - // X3 (X1) = A * (B-F) - c.call(f2mPrefix + "_sub", B, F, AUX), - c.call(f2mPrefix + "_mul", A, AUX, X1), - - // Y3 (Y1) = G^2 - 3*E^2 - c.call(f2mPrefix + "_add", E2, E2, AUX), - c.call(f2mPrefix + "_add", E2, AUX, AUX), - c.call(f2mPrefix + "_square", G, Y1), - c.call(f2mPrefix + "_sub", Y1, AUX, Y1), - - // Z3 (Z1) = B * H - c.call(f2mPrefix + "_mul", B, H, Z1), - - // ell_0 = xi * I - c.call(f2mPrefix + "_mul", c.i32_const(pAltBn128Twist), I, ELL_0), - - // ell_VW = - H (later: * yP) - c.call(f2mPrefix + "_neg", H, ELL_VW), - - // ell_VV = 3*J (later: * xP) - c.call(f2mPrefix + "_add", J, J, ELL_VV), - c.call(f2mPrefix + "_add", J, ELL_VV, ELL_VV), - - ); - } - - function buildMulByQ() { - const f = module.addFunction(prefix + "_mulByQ"); - f.addParam("p1", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - const x = c.getLocal("p1"); - const y = c.i32_add(c.getLocal("p1"), c.i32_const(f2size)); - const z = c.i32_add(c.getLocal("p1"), c.i32_const(f2size*2)); - const x3 = c.getLocal("pr"); - const y3 = c.i32_add(c.getLocal("pr"), c.i32_const(f2size)); - const z3 = c.i32_add(c.getLocal("pr"), c.i32_const(f2size*2)); - - const MulByQX = c.i32_const(module.alloc([ - ...utils$6.bigInt2BytesLE( toMontgomery("21575463638280843010398324269430826099269044274347216827212613867836435027261"), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery("10307601595873709700152284273816112264069230130616436755625194854815875713954"), f1size ), - ])); - - const MulByQY = c.i32_const(module.alloc([ - ...utils$6.bigInt2BytesLE( toMontgomery("2821565182194536844548159561693502659359617185244120367078079554186484126554"), f1size ), - ...utils$6.bigInt2BytesLE( toMontgomery("3505843767911556378687030309984248845540243509899259641013678093033130930403"), f1size ), - ])); - - f.addCode( - // The frobeniusMap(1) in this field, is the conjugate - c.call(f2mPrefix + "_conjugate", x, x3), - c.call(f2mPrefix + "_mul", MulByQX, x3, x3), - c.call(f2mPrefix + "_conjugate", y, y3), - c.call(f2mPrefix + "_mul", MulByQY, y3, y3), - c.call(f2mPrefix + "_conjugate", z, z3), - ); - } - - - function buildPrepareG2() { - buildMulByQ(); - const f = module.addFunction(prefix+ "_prepareG2"); - f.addParam("pQ", "i32"); - f.addParam("ppreQ", "i32"); - f.addLocal("pCoef", "i32"); - f.addLocal("i", "i32"); - - const c = f.getCodeBuilder(); - - const QX = c.getLocal("pQ"); - c.i32_add( c.getLocal("pQ"), c.i32_const(f2size)); - c.i32_add( c.getLocal("pQ"), c.i32_const(f2size*2)); - - const pR = module.alloc(f2size*3); - const R = c.i32_const(pR); - const RX = c.i32_const(pR); - const RY = c.i32_const(pR+f2size); - const RZ = c.i32_const(pR+2*f2size); - - const cQX = c.i32_add( c.getLocal("ppreQ"), c.i32_const(0)); - const cQY = c.i32_add( c.getLocal("ppreQ"), c.i32_const(f2size)); - c.i32_add( c.getLocal("ppreQ"), c.i32_const(f2size*2)); - - const pQ1 = module.alloc(f2size*3); - const Q1 = c.i32_const(pQ1); - - const pQ2 = module.alloc(f2size*3); - const Q2 = c.i32_const(pQ2); - c.i32_const(pQ2); - const Q2Y = c.i32_const(pQ2 + f2size); - c.i32_const(pQ2 + f2size*2); - - f.addCode( - c.call(g2mPrefix + "_normalize", QX, cQX), // TODO Remove if already in affine - c.call(f2mPrefix + "_copy", cQX, RX), - c.call(f2mPrefix + "_copy", cQY, RY), - c.call(f2mPrefix + "_one", RZ), - ); - - f.addCode( - c.setLocal("pCoef", c.i32_add( c.getLocal("ppreQ"), c.i32_const(f2size*3))), - c.setLocal("i", c.i32_const(ateLoopBitBytes.length-2)), - c.block(c.loop( - - c.call(prefix + "_prepDblStep", R, c.getLocal("pCoef")), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - c.if( - c.i32_load8_s(c.getLocal("i"), pAteLoopBitBytes), - [ - ...c.call(prefix + "_prepAddStep", cQX, R, c.getLocal("pCoef")), - ...c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - ] - ), - c.br_if(1, c.i32_eqz ( c.getLocal("i") )), - c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - ); - - f.addCode( - c.call(prefix + "_mulByQ", cQX, Q1), - c.call(prefix + "_mulByQ", Q1, Q2) - ); - - f.addCode( - c.call(f2mPrefix + "_neg", Q2Y, Q2Y), - - c.call(prefix + "_prepAddStep", Q1, R, c.getLocal("pCoef")), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - c.call(prefix + "_prepAddStep", Q2, R, c.getLocal("pCoef")), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - ); - } - - function buildMulBy024Old() { - const f = module.addFunction(prefix+ "__mulBy024Old"); - f.addParam("pEll0", "i32"); - f.addParam("pEllVW", "i32"); - f.addParam("pEllVV", "i32"); - f.addParam("pR", "i32"); // Result in F12 - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("pEll0"); - const x2 = c.getLocal("pEllVV"); - const x4 = c.getLocal("pEllVW"); - - const z0 = c.getLocal("pR"); - - const pAUX12 = module.alloc(ftsize); - const AUX12 = c.i32_const(pAUX12); - const AUX12_0 = c.i32_const(pAUX12); - const AUX12_2 = c.i32_const(pAUX12+f2size); - const AUX12_4 = c.i32_const(pAUX12+f2size*2); - const AUX12_6 = c.i32_const(pAUX12+f2size*3); - const AUX12_8 = c.i32_const(pAUX12+f2size*4); - const AUX12_10 = c.i32_const(pAUX12+f2size*5); - - f.addCode( - - c.call(f2mPrefix + "_copy", x0, AUX12_0), - c.call(f2mPrefix + "_zero", AUX12_2), - c.call(f2mPrefix + "_copy", x2, AUX12_4), - c.call(f2mPrefix + "_zero", AUX12_6), - c.call(f2mPrefix + "_copy", x4, AUX12_8), - c.call(f2mPrefix + "_zero", AUX12_10), - c.call(ftmPrefix + "_mul", AUX12, z0, z0), - ); - } - - function buildMulBy024() { - const f = module.addFunction(prefix+ "__mulBy024"); - f.addParam("pEll0", "i32"); - f.addParam("pEllVW", "i32"); - f.addParam("pEllVV", "i32"); - f.addParam("pR", "i32"); // Result in F12 - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("pEll0"); - const x2 = c.getLocal("pEllVV"); - const x4 = c.getLocal("pEllVW"); - - const z0 = c.getLocal("pR"); - const z1 = c.i32_add(c.getLocal("pR"), c.i32_const(2*n8)); - const z2 = c.i32_add(c.getLocal("pR"), c.i32_const(4*n8)); - const z3 = c.i32_add(c.getLocal("pR"), c.i32_const(6*n8)); - const z4 = c.i32_add(c.getLocal("pR"), c.i32_const(8*n8)); - const z5 = c.i32_add(c.getLocal("pR"), c.i32_const(10*n8)); - - const t0 = c.i32_const(module.alloc(f2size)); - const t1 = c.i32_const(module.alloc(f2size)); - const t2 = c.i32_const(module.alloc(f2size)); - const s0 = c.i32_const(module.alloc(f2size)); - const T3 = c.i32_const(module.alloc(f2size)); - const T4 = c.i32_const(module.alloc(f2size)); - const D0 = c.i32_const(module.alloc(f2size)); - const D2 = c.i32_const(module.alloc(f2size)); - const D4 = c.i32_const(module.alloc(f2size)); - const S1 = c.i32_const(module.alloc(f2size)); - const AUX = c.i32_const(module.alloc(f2size)); - - f.addCode( - - // D0 = z0 * x0; - c.call(f2mPrefix + "_mul", z0, x0, D0), - // D2 = z2 * x2; - c.call(f2mPrefix + "_mul", z2, x2, D2), - // D4 = z4 * x4; - c.call(f2mPrefix + "_mul", z4, x4, D4), - // t2 = z0 + z4; - c.call(f2mPrefix + "_add", z0, z4, t2), - // t1 = z0 + z2; - c.call(f2mPrefix + "_add", z0, z2, t1), - // s0 = z1 + z3 + z5; - c.call(f2mPrefix + "_add", z1, z3, s0), - c.call(f2mPrefix + "_add", s0, z5, s0), - - - // For z.a_.a_ = z0. - // S1 = z1 * x2; - c.call(f2mPrefix + "_mul", z1, x2, S1), - // T3 = S1 + D4; - c.call(f2mPrefix + "_add", S1, D4, T3), - // T4 = my_Fp6::non_residue * T3 + D0; - c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), T3, T4), - c.call(f2mPrefix + "_add", T4, D0, z0), - // z0 = T4; - - // For z.a_.b_ = z1 - // T3 = z5 * x4; - c.call(f2mPrefix + "_mul", z5, x4, T3), - // S1 = S1 + T3; - c.call(f2mPrefix + "_add", S1, T3, S1), - // T3 = T3 + D2; - c.call(f2mPrefix + "_add", T3, D2, T3), - // T4 = my_Fp6::non_residue * T3; - c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), T3, T4), - // T3 = z1 * x0; - c.call(f2mPrefix + "_mul", z1, x0, T3), - // S1 = S1 + T3; - c.call(f2mPrefix + "_add", S1, T3, S1), - // T4 = T4 + T3; - c.call(f2mPrefix + "_add", T4, T3, z1), - // z1 = T4; - - - - // For z.a_.c_ = z2 - // t0 = x0 + x2; - c.call(f2mPrefix + "_add", x0, x2, t0), - // T3 = t1 * t0 - D0 - D2; - c.call(f2mPrefix + "_mul", t1, t0, T3), - c.call(f2mPrefix + "_add", D0, D2, AUX), - c.call(f2mPrefix + "_sub", T3, AUX, T3), - // T4 = z3 * x4; - c.call(f2mPrefix + "_mul", z3, x4, T4), - // S1 = S1 + T4; - c.call(f2mPrefix + "_add", S1, T4, S1), - - - // For z.b_.a_ = z3 (z3 needs z2) - // t0 = z2 + z4; - c.call(f2mPrefix + "_add", z2, z4, t0), - // T3 = T3 + T4; - // z2 = T3; - c.call(f2mPrefix + "_add", T3, T4, z2), - // t1 = x2 + x4; - c.call(f2mPrefix + "_add", x2, x4, t1), - // T3 = t0 * t1 - D2 - D4; - c.call(f2mPrefix + "_mul", t1, t0, T3), - c.call(f2mPrefix + "_add", D2, D4, AUX), - c.call(f2mPrefix + "_sub", T3, AUX, T3), - // T4 = my_Fp6::non_residue * T3; - c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), T3, T4), - // T3 = z3 * x0; - c.call(f2mPrefix + "_mul", z3, x0, T3), - // S1 = S1 + T3; - c.call(f2mPrefix + "_add", S1, T3, S1), - // T4 = T4 + T3; - c.call(f2mPrefix + "_add", T4, T3, z3), - // z3 = T4; - - // For z.b_.b_ = z4 - // T3 = z5 * x2; - c.call(f2mPrefix + "_mul", z5, x2, T3), - // S1 = S1 + T3; - c.call(f2mPrefix + "_add", S1, T3, S1), - // T4 = my_Fp6::non_residue * T3; - c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), T3, T4), - // t0 = x0 + x4; - c.call(f2mPrefix + "_add", x0, x4, t0), - // T3 = t2 * t0 - D0 - D4; - c.call(f2mPrefix + "_mul", t2, t0, T3), - c.call(f2mPrefix + "_add", D0, D4, AUX), - c.call(f2mPrefix + "_sub", T3, AUX, T3), - // T4 = T4 + T3; - c.call(f2mPrefix + "_add", T4, T3, z4), - // z4 = T4; - - // For z.b_.c_ = z5. - // t0 = x0 + x2 + x4; - c.call(f2mPrefix + "_add", x0, x2, t0), - c.call(f2mPrefix + "_add", t0, x4, t0), - // T3 = s0 * t0 - S1; - c.call(f2mPrefix + "_mul", s0, t0, T3), - c.call(f2mPrefix + "_sub", T3, S1, z5), - // z5 = T3; - - ); - } - - - function buildMillerLoop() { - const f = module.addFunction(prefix+ "_millerLoop"); - f.addParam("ppreP", "i32"); - f.addParam("ppreQ", "i32"); - f.addParam("r", "i32"); - f.addLocal("pCoef", "i32"); - f.addLocal("i", "i32"); - - const c = f.getCodeBuilder(); - - const preP_PX = c.getLocal("ppreP"); - const preP_PY = c.i32_add(c.getLocal("ppreP"), c.i32_const(f1size)); - - const ELL_0 = c.getLocal("pCoef"); - const ELL_VW = c.i32_add(c.getLocal("pCoef"), c.i32_const(f2size)); - const ELL_VV = c.i32_add(c.getLocal("pCoef"), c.i32_const(2*f2size)); - - - const pVW = module.alloc(f2size); - const VW = c.i32_const(pVW); - const pVV = module.alloc(f2size); - const VV = c.i32_const(pVV); - - const F = c.getLocal("r"); - - - f.addCode( - c.call(ftmPrefix + "_one", F), - - c.setLocal("pCoef", c.i32_add( c.getLocal("ppreQ"), c.i32_const(f2size*3))), - - c.setLocal("i", c.i32_const(ateLoopBitBytes.length-2)), - c.block(c.loop( - - - c.call(ftmPrefix + "_square", F, F), - - c.call(f2mPrefix + "_mul1", ELL_VW,preP_PY, VW), - c.call(f2mPrefix + "_mul1", ELL_VV, preP_PX, VV), - c.call(prefix + "__mulBy024", ELL_0, VW, VV, F), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - c.if( - c.i32_load8_s(c.getLocal("i"), pAteLoopBitBytes), - [ - ...c.call(f2mPrefix + "_mul1", ELL_VW, preP_PY, VW), - ...c.call(f2mPrefix + "_mul1", ELL_VV, preP_PX, VV), - - ...c.call(prefix + "__mulBy024", ELL_0, VW, VV, F), - ...c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - ] - ), - c.br_if(1, c.i32_eqz ( c.getLocal("i") )), - c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - - ); - - f.addCode( - c.call(f2mPrefix + "_mul1", ELL_VW, preP_PY, VW), - c.call(f2mPrefix + "_mul1", ELL_VV, preP_PX, VV), - c.call(prefix + "__mulBy024", ELL_0, VW, VV, F), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - c.call(f2mPrefix + "_mul1", ELL_VW, preP_PY, VW), - c.call(f2mPrefix + "_mul1", ELL_VV, preP_PX, VV), - c.call(prefix + "__mulBy024", ELL_0, VW, VV, F), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - ); - - } - - - function buildFrobeniusMap(n) { - const F12 = [ - [ - [bigInt$2("1"), bigInt$2("0")], - [bigInt$2("1"), bigInt$2("0")], - [bigInt$2("1"), bigInt$2("0")], - [bigInt$2("1"), bigInt$2("0")], - [bigInt$2("1"), bigInt$2("0")], - [bigInt$2("1"), bigInt$2("0")], - [bigInt$2("1"), bigInt$2("0")], - [bigInt$2("1"), bigInt$2("0")], - [bigInt$2("1"), bigInt$2("0")], - [bigInt$2("1"), bigInt$2("0")], - [bigInt$2("1"), bigInt$2("0")], - [bigInt$2("1"), bigInt$2("0")], - ], - [ - [bigInt$2("1"), bigInt$2("0")], - [bigInt$2("8376118865763821496583973867626364092589906065868298776909617916018768340080"), bigInt$2("16469823323077808223889137241176536799009286646108169935659301613961712198316")], - [bigInt$2("21888242871839275220042445260109153167277707414472061641714758635765020556617"), bigInt$2("0")], - [bigInt$2("11697423496358154304825782922584725312912383441159505038794027105778954184319"), bigInt$2("303847389135065887422783454877609941456349188919719272345083954437860409601")], - [bigInt$2("21888242871839275220042445260109153167277707414472061641714758635765020556616"), bigInt$2("0")], - [bigInt$2("3321304630594332808241809054958361220322477375291206261884409189760185844239"), bigInt$2("5722266937896532885780051958958348231143373700109372999374820235121374419868")], - [bigInt$2("21888242871839275222246405745257275088696311157297823662689037894645226208582"), bigInt$2("0")], - [bigInt$2("13512124006075453725662431877630910996106405091429524885779419978626457868503"), bigInt$2("5418419548761466998357268504080738289687024511189653727029736280683514010267")], - [bigInt$2("2203960485148121921418603742825762020974279258880205651966"), bigInt$2("0")], - [bigInt$2("10190819375481120917420622822672549775783927716138318623895010788866272024264"), bigInt$2("21584395482704209334823622290379665147239961968378104390343953940207365798982")], - [bigInt$2("2203960485148121921418603742825762020974279258880205651967"), bigInt$2("0")], - [bigInt$2("18566938241244942414004596690298913868373833782006617400804628704885040364344"), bigInt$2("16165975933942742336466353786298926857552937457188450663314217659523851788715")], - ] - ]; - - const F6 = [ - [ - [bigInt$2("1"), bigInt$2("0")], - [bigInt$2("1"), bigInt$2("0")], - [bigInt$2("1"), bigInt$2("0")], - [bigInt$2("1"), bigInt$2("0")], - [bigInt$2("1"), bigInt$2("0")], - [bigInt$2("1"), bigInt$2("0")], - ], - [ - [bigInt$2("1"), bigInt$2("0")], - [bigInt$2("21575463638280843010398324269430826099269044274347216827212613867836435027261"), bigInt$2("10307601595873709700152284273816112264069230130616436755625194854815875713954")], - [bigInt$2("21888242871839275220042445260109153167277707414472061641714758635765020556616"), bigInt$2("0")], - [bigInt$2("3772000881919853776433695186713858239009073593817195771773381919316419345261"), bigInt$2("2236595495967245188281701248203181795121068902605861227855261137820944008926")], - [bigInt$2("2203960485148121921418603742825762020974279258880205651966"), bigInt$2("0")], - [bigInt$2("18429021223477853657660792034369865839114504446431234726392080002137598044644"), bigInt$2("9344045779998320333812420223237981029506012124075525679208581902008406485703")], - ], - [ - [bigInt$2("1"), bigInt$2("0")], - [bigInt$2("2581911344467009335267311115468803099551665605076196740867805258568234346338"), bigInt$2("19937756971775647987995932169929341994314640652964949448313374472400716661030")], - [bigInt$2("2203960485148121921418603742825762020974279258880205651966"), bigInt$2("0")], - [bigInt$2("5324479202449903542726783395506214481928257762400643279780343368557297135718"), bigInt$2("16208900380737693084919495127334387981393726419856888799917914180988844123039")], - [bigInt$2("21888242871839275220042445260109153167277707414472061641714758635765020556616"), bigInt$2("0")], - [bigInt$2("13981852324922362344252311234282257507216387789820983642040889267519694726527"), bigInt$2("7629828391165209371577384193250820201684255241773809077146787135900891633097")], - ] - ]; - - const f = module.addFunction(prefix+ "__frobeniusMap"+n); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - for (let i=0; i<6; i++) { - const X = (i==0) ? c.getLocal("x") : c.i32_add(c.getLocal("x"), c.i32_const(i*f2size)); - const Xc0 = X; - const Xc1 = c.i32_add(c.getLocal("x"), c.i32_const(i*f2size + f1size)); - const R = (i==0) ? c.getLocal("r") : c.i32_add(c.getLocal("r"), c.i32_const(i*f2size)); - const Rc0 = R; - const Rc1 = c.i32_add(c.getLocal("r"), c.i32_const(i*f2size + f1size)); - const coef = mul2(F12[Math.floor(i/3)][n%12] , F6[i%3][n%6]); - const pCoef = module.alloc([ - ...utils$6.bigInt2BytesLE(toMontgomery(coef[0]), 32), - ...utils$6.bigInt2BytesLE(toMontgomery(coef[1]), 32), - ]); - if (n%2 == 1) { - f.addCode( - c.call(f1mPrefix + "_copy", Xc0, Rc0), - c.call(f1mPrefix + "_neg", Xc1, Rc1), - c.call(f2mPrefix + "_mul", R, c.i32_const(pCoef), R), - ); - } else { - f.addCode(c.call(f2mPrefix + "_mul", X, c.i32_const(pCoef), R)); - } - } - - function mul2(a, b) { - const ac0 = bigInt$2(a[0]); - const ac1 = bigInt$2(a[1]); - const bc0 = bigInt$2(b[0]); - const bc1 = bigInt$2(b[1]); - const res = [ - ac0.times(bc0).minus( ac1.times(bc1) ).mod(q), - ac0.times(bc1).add( ac1.times(bc0) ).mod(q), - ]; - if (res[0].isNegative()) res[0] = res[0].add(q); - return res; - } - - } - - - - function buildFinalExponentiationFirstChunk() { - - const f = module.addFunction(prefix+ "__finalExponentiationFirstChunk"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const elt = c.getLocal("x"); - const eltC0 = elt; - const eltC1 = c.i32_add(elt, c.i32_const(n8*6)); - const r = c.getLocal("r"); - const pA = module.alloc(ftsize); - const A = c.i32_const(pA); - const Ac0 = A; - const Ac1 = c.i32_const(pA + n8*6); - const B = c.i32_const(module.alloc(ftsize)); - const C = c.i32_const(module.alloc(ftsize)); - const D = c.i32_const(module.alloc(ftsize)); - - f.addCode( - // const alt_bn128_Fq12 A = alt_bn128_Fq12(elt.c0,-elt.c1); - c.call(f6mPrefix + "_copy", eltC0, Ac0), - c.call(f6mPrefix + "_neg", eltC1, Ac1), - - // const alt_bn128_Fq12 B = elt.inverse(); - c.call(ftmPrefix + "_inverse", elt, B), - - // const alt_bn128_Fq12 C = A * B; - c.call(ftmPrefix + "_mul", A, B, C), - // const alt_bn128_Fq12 D = C.Frobenius_map(2); - c.call(prefix + "__frobeniusMap2", C, D), - // const alt_bn128_Fq12 result = D * C; - c.call(ftmPrefix + "_mul", C, D, r), - ); - } - - function buildCyclotomicSquare() { - const f = module.addFunction(prefix+ "__cyclotomicSquare"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x4 = c.i32_add(c.getLocal("x"), c.i32_const(f2size)); - const x3 = c.i32_add(c.getLocal("x"), c.i32_const(2*f2size)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(3*f2size)); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(4*f2size)); - const x5 = c.i32_add(c.getLocal("x"), c.i32_const(5*f2size)); - - const r0 = c.getLocal("r"); - const r4 = c.i32_add(c.getLocal("r"), c.i32_const(f2size)); - const r3 = c.i32_add(c.getLocal("r"), c.i32_const(2*f2size)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(3*f2size)); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(4*f2size)); - const r5 = c.i32_add(c.getLocal("r"), c.i32_const(5*f2size)); - - const t0 = c.i32_const(module.alloc(f2size)); - const t1 = c.i32_const(module.alloc(f2size)); - const t2 = c.i32_const(module.alloc(f2size)); - const t3 = c.i32_const(module.alloc(f2size)); - const t4 = c.i32_const(module.alloc(f2size)); - const t5 = c.i32_const(module.alloc(f2size)); - const tmp = c.i32_const(module.alloc(f2size)); - const AUX = c.i32_const(module.alloc(f2size)); - - - f.addCode( - -// c.call(ftmPrefix + "_square", x0, r0), - - // // t0 + t1*y = (z0 + z1*y)^2 = a^2 - // tmp = z0 * z1; - // t0 = (z0 + z1) * (z0 + my_Fp6::non_residue * z1) - tmp - my_Fp6::non_residue * tmp; - // t1 = tmp + tmp; - c.call(f2mPrefix + "_mul", x0, x1, tmp), - c.call(f2mPrefix + "_mul", x1, c.i32_const(pNonResidueF6), t0), - c.call(f2mPrefix + "_add", x0, t0, t0), - c.call(f2mPrefix + "_add", x0, x1, AUX), - c.call(f2mPrefix + "_mul", AUX, t0, t0), - c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), tmp, AUX), - c.call(f2mPrefix + "_add", tmp, AUX, AUX), - c.call(f2mPrefix + "_sub", t0, AUX, t0), - c.call(f2mPrefix + "_add", tmp, tmp, t1), - - // // t2 + t3*y = (z2 + z3*y)^2 = b^2 - // tmp = z2 * z3; - // t2 = (z2 + z3) * (z2 + my_Fp6::non_residue * z3) - tmp - my_Fp6::non_residue * tmp; - // t3 = tmp + tmp; - c.call(f2mPrefix + "_mul", x2, x3, tmp), - c.call(f2mPrefix + "_mul", x3, c.i32_const(pNonResidueF6), t2), - c.call(f2mPrefix + "_add", x2, t2, t2), - c.call(f2mPrefix + "_add", x2, x3, AUX), - c.call(f2mPrefix + "_mul", AUX, t2, t2), - c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), tmp, AUX), - c.call(f2mPrefix + "_add", tmp, AUX, AUX), - c.call(f2mPrefix + "_sub", t2, AUX, t2), - c.call(f2mPrefix + "_add", tmp, tmp, t3), - - // // t4 + t5*y = (z4 + z5*y)^2 = c^2 - // tmp = z4 * z5; - // t4 = (z4 + z5) * (z4 + my_Fp6::non_residue * z5) - tmp - my_Fp6::non_residue * tmp; - // t5 = tmp + tmp; - c.call(f2mPrefix + "_mul", x4, x5, tmp), - c.call(f2mPrefix + "_mul", x5, c.i32_const(pNonResidueF6), t4), - c.call(f2mPrefix + "_add", x4, t4, t4), - c.call(f2mPrefix + "_add", x4, x5, AUX), - c.call(f2mPrefix + "_mul", AUX, t4, t4), - c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), tmp, AUX), - c.call(f2mPrefix + "_add", tmp, AUX, AUX), - c.call(f2mPrefix + "_sub", t4, AUX, t4), - c.call(f2mPrefix + "_add", tmp, tmp, t5), - - // For A - // z0 = 3 * t0 - 2 * z0 - c.call(f2mPrefix + "_sub", t0, x0, r0), - c.call(f2mPrefix + "_add", r0, r0, r0), - c.call(f2mPrefix + "_add", t0, r0, r0), - // z1 = 3 * t1 + 2 * z1 - c.call(f2mPrefix + "_add", t1, x1, r1), - c.call(f2mPrefix + "_add", r1, r1, r1), - c.call(f2mPrefix + "_add", t1, r1, r1), - - // For B - // z2 = 3 * (xi * t5) + 2 * z2 - c.call(f2mPrefix + "_mul", t5, c.i32_const(pAltBn128Twist), AUX), - c.call(f2mPrefix + "_add", AUX, x2, r2), - c.call(f2mPrefix + "_add", r2, r2, r2), - c.call(f2mPrefix + "_add", AUX, r2, r2), - // z3 = 3 * t4 - 2 * z3 - c.call(f2mPrefix + "_sub", t4, x3, r3), - c.call(f2mPrefix + "_add", r3, r3, r3), - c.call(f2mPrefix + "_add", t4, r3, r3), - - // For C - // z4 = 3 * t2 - 2 * z4 - c.call(f2mPrefix + "_sub", t2, x4, r4), - c.call(f2mPrefix + "_add", r4, r4, r4), - c.call(f2mPrefix + "_add", t2, r4, r4), - // z5 = 3 * t3 + 2 * z5 - c.call(f2mPrefix + "_add", t3, x5, r5), - c.call(f2mPrefix + "_add", r5, r5, r5), - c.call(f2mPrefix + "_add", t3, r5, r5), - - ); - } - - - function buildCyclotomicExp(exponent, fnName) { - const exponentNafBytes = naf(exponent).map( (b) => (b==-1 ? 0xFF: b) ); - const pExponentNafBytes = module.alloc(exponentNafBytes); - module.alloc(utils$6.bigInt2BytesLE(exponent, 32)); - - const f = module.addFunction(prefix+ "__cyclotomicExp_"+fnName); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - f.addLocal("bit", "i32"); - f.addLocal("i", "i32"); - - const c = f.getCodeBuilder(); - - const x = c.getLocal("x"); - - const res = c.getLocal("r"); - - const inverse = c.i32_const(module.alloc(ftsize)); - - - f.addCode( -// c.call(ftmPrefix + "_exp", x, c.i32_const(pExponent), c.i32_const(32), res), - - c.call(ftmPrefix + "_conjugate", x, inverse), - c.call(ftmPrefix + "_one", res), - - c.if( - c.teeLocal("bit", c.i32_load8_s(c.i32_const(exponentNafBytes.length-1), pExponentNafBytes)), - c.if( - c.i32_eq( - c.getLocal("bit"), - c.i32_const(1) - ), - c.call(ftmPrefix + "_mul", res, x, res), - c.call(ftmPrefix + "_mul", res, inverse, res), - ) - ), - - c.setLocal("i", c.i32_const(exponentNafBytes.length-2)), - c.block(c.loop( -// c.call(ftmPrefix + "_square", res, res), - c.call(prefix + "__cyclotomicSquare", res, res), - c.if( - c.teeLocal("bit", c.i32_load8_s(c.getLocal("i"), pExponentNafBytes)), - c.if( - c.i32_eq( - c.getLocal("bit"), - c.i32_const(1) - ), - c.call(ftmPrefix + "_mul", res, x, res), - c.call(ftmPrefix + "_mul", res, inverse, res), - ) - ), - c.br_if(1, c.i32_eqz ( c.getLocal("i") )), - c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - ); - } - - - - function buildFinalExponentiationLastChunk() { - buildCyclotomicSquare(); - buildCyclotomicExp(finalExpZ, "w0"); - - const f = module.addFunction(prefix+ "__finalExponentiationLastChunk"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const elt = c.getLocal("x"); - const result = c.getLocal("r"); - const A = c.i32_const(module.alloc(ftsize)); - const B = c.i32_const(module.alloc(ftsize)); - const C = c.i32_const(module.alloc(ftsize)); - const D = c.i32_const(module.alloc(ftsize)); - const E = c.i32_const(module.alloc(ftsize)); - const F = c.i32_const(module.alloc(ftsize)); - const G = c.i32_const(module.alloc(ftsize)); - const H = c.i32_const(module.alloc(ftsize)); - const I = c.i32_const(module.alloc(ftsize)); - const J = c.i32_const(module.alloc(ftsize)); - const K = c.i32_const(module.alloc(ftsize)); - const L = c.i32_const(module.alloc(ftsize)); - const M = c.i32_const(module.alloc(ftsize)); - const N = c.i32_const(module.alloc(ftsize)); - const O = c.i32_const(module.alloc(ftsize)); - const P = c.i32_const(module.alloc(ftsize)); - const Q = c.i32_const(module.alloc(ftsize)); - const R = c.i32_const(module.alloc(ftsize)); - const S = c.i32_const(module.alloc(ftsize)); - const T = c.i32_const(module.alloc(ftsize)); - const U = c.i32_const(module.alloc(ftsize)); - - f.addCode( - - - // A = exp_by_neg_z(elt) // = elt^(-z) - c.call(prefix + "__cyclotomicExp_w0", elt, A), - c.call(ftmPrefix + "_conjugate", A, A), - // B = A^2 // = elt^(-2*z) - c.call(prefix + "__cyclotomicSquare", A, B), - // C = B^2 // = elt^(-4*z) - c.call(prefix + "__cyclotomicSquare", B, C), - // D = C * B // = elt^(-6*z) - c.call(ftmPrefix + "_mul", C, B, D), - // E = exp_by_neg_z(D) // = elt^(6*z^2) - c.call(prefix + "__cyclotomicExp_w0", D, E), - c.call(ftmPrefix + "_conjugate", E, E), - // F = E^2 // = elt^(12*z^2) - c.call(prefix + "__cyclotomicSquare", E, F), - // G = epx_by_neg_z(F) // = elt^(-12*z^3) - c.call(prefix + "__cyclotomicExp_w0", F, G), - c.call(ftmPrefix + "_conjugate", G, G), - // H = conj(D) // = elt^(6*z) - c.call(ftmPrefix + "_conjugate", D, H), - // I = conj(G) // = elt^(12*z^3) - c.call(ftmPrefix + "_conjugate", G, I), - // J = I * E // = elt^(12*z^3 + 6*z^2) - c.call(ftmPrefix + "_mul", I, E, J), - // K = J * H // = elt^(12*z^3 + 6*z^2 + 6*z) - c.call(ftmPrefix + "_mul", J, H, K), - // L = K * B // = elt^(12*z^3 + 6*z^2 + 4*z) - c.call(ftmPrefix + "_mul", K, B, L), - // M = K * E // = elt^(12*z^3 + 12*z^2 + 6*z) - c.call(ftmPrefix + "_mul", K, E, M), - - // N = M * elt // = elt^(12*z^3 + 12*z^2 + 6*z + 1) - c.call(ftmPrefix + "_mul", M, elt, N), - - // O = L.Frobenius_map(1) // = elt^(q*(12*z^3 + 6*z^2 + 4*z)) - c.call(prefix + "__frobeniusMap1", L, O), - // P = O * N // = elt^(q*(12*z^3 + 6*z^2 + 4*z) * (12*z^3 + 12*z^2 + 6*z + 1)) - c.call(ftmPrefix + "_mul", O, N, P), - // Q = K.Frobenius_map(2) // = elt^(q^2 * (12*z^3 + 6*z^2 + 6*z)) - c.call(prefix + "__frobeniusMap2", K, Q), - // R = Q * P // = elt^(q^2 * (12*z^3 + 6*z^2 + 6*z) + q*(12*z^3 + 6*z^2 + 4*z) * (12*z^3 + 12*z^2 + 6*z + 1)) - c.call(ftmPrefix + "_mul", Q, P, R), - // S = conj(elt) // = elt^(-1) - c.call(ftmPrefix + "_conjugate", elt, S), - // T = S * L // = elt^(12*z^3 + 6*z^2 + 4*z - 1) - c.call(ftmPrefix + "_mul", S, L, T), - // U = T.Frobenius_map(3) // = elt^(q^3(12*z^3 + 6*z^2 + 4*z - 1)) - c.call(prefix + "__frobeniusMap3", T, U), - // V = U * R // = elt^(q^3(12*z^3 + 6*z^2 + 4*z - 1) + q^2 * (12*z^3 + 6*z^2 + 6*z) + q*(12*z^3 + 6*z^2 + 4*z) * (12*z^3 + 12*z^2 + 6*z + 1)) - c.call(ftmPrefix + "_mul", U, R, result), - // result = V - ); - } - - - function buildFinalExponentiation() { - buildFinalExponentiationFirstChunk(); - buildFinalExponentiationLastChunk(); - const f = module.addFunction(prefix+ "_finalExponentiation"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const elt = c.getLocal("x"); - const result = c.getLocal("r"); - const eltToFirstChunk = c.i32_const(module.alloc(ftsize)); - - f.addCode( - c.call(prefix + "__finalExponentiationFirstChunk", elt, eltToFirstChunk ), - c.call(prefix + "__finalExponentiationLastChunk", eltToFirstChunk, result ) - ); - } - - - function buildFinalExponentiationOld() { - const f = module.addFunction(prefix+ "_finalExponentiationOld"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const exponent = bigInt$2("552484233613224096312617126783173147097382103762957654188882734314196910839907541213974502761540629817009608548654680343627701153829446747810907373256841551006201639677726139946029199968412598804882391702273019083653272047566316584365559776493027495458238373902875937659943504873220554161550525926302303331747463515644711876653177129578303191095900909191624817826566688241804408081892785725967931714097716709526092261278071952560171111444072049229123565057483750161460024353346284167282452756217662335528813519139808291170539072125381230815729071544861602750936964829313608137325426383735122175229541155376346436093930287402089517426973178917569713384748081827255472576937471496195752727188261435633271238710131736096299798168852925540549342330775279877006784354801422249722573783561685179618816480037695005515426162362431072245638324744480"); - - const pExponent = module.alloc(utils$6.bigInt2BytesLE( exponent, 352 )); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call(ftmPrefix + "_exp", c.getLocal("x"), c.i32_const(pExponent), c.i32_const(352), c.getLocal("r")), - ); - } - - - - - const pPreP = module.alloc(prePSize); - const pPreQ = module.alloc(preQSize); - - function buildPairingEquation(nPairings) { - - const f = module.addFunction(prefix+ "_pairingEq"+nPairings); - for (let i=0; i acc + ( b!=0 ? 1 : 0) ,0); - const ateNCoefs = ateNAddCoefs + ateNDblCoefs + 1; - const prePSize = 3*2*n8q; - const preQSize = 3*n8q*2 + ateNCoefs*ateCoefSize; - const finalExpIsNegative = true; - - const finalExpZ = bigInt$1("15132376222941642752"); - - - module.modules[prefix] = { - n64q: n64q, - n64r: n64r, - n8q: n8q, - n8r: n8r, - pG1gen: pG1gen, - pG1zero: pG1zero, - pG1b: pG1b, - pG2gen: pG2gen, - pG2zero: pG2zero, - pG2b: pG2b, - pq: module.modules["f1m"].pq, - pr: pr, - pOneT: pOneT, - r: r, - q: q, - prePSize: prePSize, - preQSize: preQSize - }; - - - function naf(n) { - let E = n; - const res = []; - while (E.gt(bigInt$1.zero)) { - if (E.isOdd()) { - const z = 2 - E.mod(4).toJSNumber(); - res.push( z ); - E = E.minus(z); - } else { - res.push( 0 ); - } - E = E.shiftRight(1); - } - return res; - } - - function bits(n) { - let E = n; - const res = []; - while (E.gt(bigInt$1.zero)) { - if (E.isOdd()) { - res.push( 1 ); - } else { - res.push( 0 ); - } - E = E.shiftRight(1); - } - return res; - } - - function buildPrepareG1() { - const f = module.addFunction(prefix+ "_prepareG1"); - f.addParam("pP", "i32"); - f.addParam("ppreP", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call(g1mPrefix + "_normalize", c.getLocal("pP"), c.getLocal("ppreP")), // TODO Remove if already in affine - ); - } - - - - function buildPrepDoubleStep() { - const f = module.addFunction(prefix+ "_prepDblStep"); - f.addParam("R", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const Rx = c.getLocal("R"); - const Ry = c.i32_add(c.getLocal("R"), c.i32_const(2*n8q)); - const Rz = c.i32_add(c.getLocal("R"), c.i32_const(4*n8q)); - - const t0 = c.getLocal("r"); - const t3 = c.i32_add(c.getLocal("r"), c.i32_const(2*n8q)); - const t6 = c.i32_add(c.getLocal("r"), c.i32_const(4*n8q)); - - - const zsquared = c.i32_const(module.alloc(f2size)); - const t1 = c.i32_const(module.alloc(f2size)); - const t2 = c.i32_const(module.alloc(f2size)); - const t4 = c.i32_const(module.alloc(f2size)); - const t5 = c.i32_const(module.alloc(f2size)); - - f.addCode( - - // tmp0 = r.x.square(); - c.call(f2mPrefix + "_square", Rx, t0), - - // tmp1 = r.y.square(); - c.call(f2mPrefix + "_square", Ry, t1), - - // tmp2 = tmp1.square(); - c.call(f2mPrefix + "_square", t1, t2), - - // tmp3 = (tmp1 + r.x).square() - tmp0 - tmp2; - c.call(f2mPrefix + "_add", t1, Rx, t3), - c.call(f2mPrefix + "_square", t3, t3), - c.call(f2mPrefix + "_sub", t3, t0, t3), - c.call(f2mPrefix + "_sub", t3, t2, t3), - - // tmp3 = tmp3 + tmp3; - c.call(f2mPrefix + "_add", t3, t3, t3), - - // tmp4 = tmp0 + tmp0 + tmp0; - c.call(f2mPrefix + "_add", t0, t0, t4), - c.call(f2mPrefix + "_add", t4, t0, t4), - - // tmp6 = r.x + tmp4; - c.call(f2mPrefix + "_add", Rx, t4, t6), - - // tmp5 = tmp4.square(); - c.call(f2mPrefix + "_square", t4, t5), - - // zsquared = r.z.square(); - c.call(f2mPrefix + "_square", Rz, zsquared), - - // r.x = tmp5 - tmp3 - tmp3; - c.call(f2mPrefix + "_sub", t5, t3, Rx), - c.call(f2mPrefix + "_sub", Rx, t3, Rx), - - // r.z = (r.z + r.y).square() - tmp1 - zsquared; - c.call(f2mPrefix + "_add", Rz, Ry, Rz), - c.call(f2mPrefix + "_square", Rz, Rz), - c.call(f2mPrefix + "_sub", Rz, t1, Rz), - c.call(f2mPrefix + "_sub", Rz, zsquared, Rz), - - // r.y = (tmp3 - r.x) * tmp4; - c.call(f2mPrefix + "_sub", t3, Rx, Ry), - c.call(f2mPrefix + "_mul", Ry, t4, Ry), - - // tmp2 = tmp2 + tmp2; - c.call(f2mPrefix + "_add", t2, t2, t2), - - // tmp2 = tmp2 + tmp2; - c.call(f2mPrefix + "_add", t2, t2, t2), - - // tmp2 = tmp2 + tmp2; - c.call(f2mPrefix + "_add", t2, t2, t2), - - // r.y -= tmp2; - c.call(f2mPrefix + "_sub", Ry, t2, Ry), - - // tmp3 = tmp4 * zsquared; - c.call(f2mPrefix + "_mul", t4, zsquared, t3), - - // tmp3 = tmp3 + tmp3; - c.call(f2mPrefix + "_add", t3, t3, t3), - - // tmp3 = -tmp3; - c.call(f2mPrefix + "_neg", t3, t3), - - // tmp6 = tmp6.square() - tmp0 - tmp5; - c.call(f2mPrefix + "_square", t6, t6), - c.call(f2mPrefix + "_sub", t6, t0, t6), - c.call(f2mPrefix + "_sub", t6, t5, t6), - - // tmp1 = tmp1 + tmp1; - c.call(f2mPrefix + "_add", t1, t1, t1), - - // tmp1 = tmp1 + tmp1; - c.call(f2mPrefix + "_add", t1, t1, t1), - - // tmp6 = tmp6 - tmp1; - c.call(f2mPrefix + "_sub", t6, t1, t6), - - // tmp0 = r.z * zsquared; - c.call(f2mPrefix + "_mul", Rz, zsquared, t0), - - // tmp0 = tmp0 + tmp0; - c.call(f2mPrefix + "_add", t0, t0, t0), - - ); - } - - function buildPrepAddStep() { - const f = module.addFunction(prefix+ "_prepAddStep"); - f.addParam("R", "i32"); - f.addParam("Q", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const Rx = c.getLocal("R"); - const Ry = c.i32_add(c.getLocal("R"), c.i32_const(2*n8q)); - const Rz = c.i32_add(c.getLocal("R"), c.i32_const(4*n8q)); - - const Qx = c.getLocal("Q"); - const Qy = c.i32_add(c.getLocal("Q"), c.i32_const(2*n8q)); - - const t10 = c.getLocal("r"); - const t1 = c.i32_add(c.getLocal("r"), c.i32_const(2*n8q)); - const t9 = c.i32_add(c.getLocal("r"), c.i32_const(4*n8q)); - - const zsquared = c.i32_const(module.alloc(f2size)); - const ysquared = c.i32_const(module.alloc(f2size)); - const ztsquared = c.i32_const(module.alloc(f2size)); - const t0 = c.i32_const(module.alloc(f2size)); - const t2 = c.i32_const(module.alloc(f2size)); - const t3 = c.i32_const(module.alloc(f2size)); - const t4 = c.i32_const(module.alloc(f2size)); - const t5 = c.i32_const(module.alloc(f2size)); - const t6 = c.i32_const(module.alloc(f2size)); - const t7 = c.i32_const(module.alloc(f2size)); - const t8 = c.i32_const(module.alloc(f2size)); - - f.addCode( - - // zsquared = r.z.square(); - c.call(f2mPrefix + "_square", Rz, zsquared), - - // ysquared = q.y.square(); - c.call(f2mPrefix + "_square", Qy, ysquared), - - // t0 = zsquared * q.x; - c.call(f2mPrefix + "_mul", zsquared, Qx, t0), - - // t1 = ((q.y + r.z).square() - ysquared - zsquared) * zsquared; - c.call(f2mPrefix + "_add", Qy, Rz, t1), - c.call(f2mPrefix + "_square", t1, t1), - c.call(f2mPrefix + "_sub", t1, ysquared, t1), - c.call(f2mPrefix + "_sub", t1, zsquared, t1), - c.call(f2mPrefix + "_mul", t1, zsquared, t1), - - // t2 = t0 - r.x; - c.call(f2mPrefix + "_sub", t0, Rx, t2), - - // t3 = t2.square(); - c.call(f2mPrefix + "_square", t2, t3), - - // t4 = t3 + t3; - c.call(f2mPrefix + "_add", t3, t3, t4), - - // t4 = t4 + t4; - c.call(f2mPrefix + "_add", t4, t4, t4), - - // t5 = t4 * t2; - c.call(f2mPrefix + "_mul", t4, t2, t5), - - // t6 = t1 - r.y - r.y; - c.call(f2mPrefix + "_sub", t1, Ry, t6), - c.call(f2mPrefix + "_sub", t6, Ry, t6), - - // t9 = t6 * q.x; - c.call(f2mPrefix + "_mul", t6, Qx, t9), - - // t7 = t4 * r.x; - c.call(f2mPrefix + "_mul", t4, Rx, t7), - - // r.x = t6.square() - t5 - t7 - t7; - c.call(f2mPrefix + "_square", t6, Rx), - c.call(f2mPrefix + "_sub", Rx, t5, Rx), - c.call(f2mPrefix + "_sub", Rx, t7, Rx), - c.call(f2mPrefix + "_sub", Rx, t7, Rx), - - // r.z = (r.z + t2).square() - zsquared - t3; - c.call(f2mPrefix + "_add", Rz, t2, Rz), - c.call(f2mPrefix + "_square", Rz, Rz), - c.call(f2mPrefix + "_sub", Rz, zsquared, Rz), - c.call(f2mPrefix + "_sub", Rz, t3, Rz), - - // t10 = q.y + r.z; - c.call(f2mPrefix + "_add", Qy, Rz, t10), - - // t8 = (t7 - r.x) * t6; - c.call(f2mPrefix + "_sub", t7, Rx, t8), - c.call(f2mPrefix + "_mul", t8, t6, t8), - - // t0 = r.y * t5; - c.call(f2mPrefix + "_mul", Ry, t5, t0), - - // t0 = t0 + t0; - c.call(f2mPrefix + "_add", t0, t0, t0), - - // r.y = t8 - t0; - c.call(f2mPrefix + "_sub", t8, t0, Ry), - - // t10 = t10.square() - ysquared; - c.call(f2mPrefix + "_square", t10, t10), - c.call(f2mPrefix + "_sub", t10, ysquared, t10), - - // ztsquared = r.z.square(); - c.call(f2mPrefix + "_square", Rz, ztsquared), - - // t10 = t10 - ztsquared; - c.call(f2mPrefix + "_sub", t10, ztsquared, t10), - - // t9 = t9 + t9 - t10; - c.call(f2mPrefix + "_add", t9, t9, t9), - c.call(f2mPrefix + "_sub", t9, t10, t9), - - // t10 = r.z + r.z; - c.call(f2mPrefix + "_add", Rz, Rz, t10), - - // t6 = -t6; - c.call(f2mPrefix + "_neg", t6, t6), - - // t1 = t6 + t6; - c.call(f2mPrefix + "_add", t6, t6, t1), - ); - } - - - function buildPrepareG2() { - const f = module.addFunction(prefix+ "_prepareG2"); - f.addParam("pQ", "i32"); - f.addParam("ppreQ", "i32"); - f.addLocal("pCoef", "i32"); - f.addLocal("i", "i32"); - - const c = f.getCodeBuilder(); - - - const Q = c.getLocal("pQ"); - - const pR = module.alloc(f2size*3); - const R = c.i32_const(pR); - - const base = c.getLocal("ppreQ"); - - f.addCode( - c.call(g2mPrefix + "_normalize", Q, base), - c.if( - c.call(g2mPrefix + "_isZero", base), - c.ret([]) - ), - c.call(g2mPrefix + "_copy", base, R), - c.setLocal("pCoef", c.i32_add(c.getLocal("ppreQ"), c.i32_const(f2size*3))), - ); - - f.addCode( - c.setLocal("i", c.i32_const(ateLoopBitBytes.length-2)), - c.block(c.loop( - - c.call(prefix + "_prepDblStep", R, c.getLocal("pCoef")), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - c.if( - c.i32_load8_s(c.getLocal("i"), pAteLoopBitBytes), - [ - ...c.call(prefix + "_prepAddStep", R, base, c.getLocal("pCoef")), - ...c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - ] - ), - c.br_if(1, c.i32_eqz ( c.getLocal("i") )), - c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - ); - } - - - function buildF6Mul1() { - const f = module.addFunction(f6mPrefix+ "_mul1"); - f.addParam("pA", "i32"); // F6 - f.addParam("pC1", "i32"); // F2 - f.addParam("pR", "i32"); // F6 - - const c = f.getCodeBuilder(); - - const A_c0 = c.getLocal("pA"); - const A_c1 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*2)); - const A_c2 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*4)); - - const c1 = c.getLocal("pC1"); - - const t1 = c.getLocal("pR"); - const t2 = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*2)); - const b_b = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*4)); - - const Ac0_Ac1 = c.i32_const(module.alloc(f1size*2)); - const Ac1_Ac2 = c.i32_const(module.alloc(f1size*2)); - - f.addCode( - - c.call(f2mPrefix + "_add", A_c0, A_c1, Ac0_Ac1), - c.call(f2mPrefix + "_add", A_c1, A_c2, Ac1_Ac2), - - // let b_b = self.c1 * c1; - c.call(f2mPrefix + "_mul", A_c1, c1, b_b), - - // let t1 = (self.c1 + self.c2) * c1 - b_b; - c.call(f2mPrefix + "_mul", Ac1_Ac2, c1, t1), - c.call(f2mPrefix + "_sub", t1, b_b, t1), - - // let t1 = t1.mul_by_nonresidue(); - c.call(f2mPrefix + "_mulNR", t1, t1), - - // let t2 = (self.c0 + self.c1) * c1 - b_b; - c.call(f2mPrefix + "_mul", Ac0_Ac1, c1, t2), - c.call(f2mPrefix + "_sub", t2, b_b, t2), - ); - } - buildF6Mul1(); - - function buildF6Mul01() { - const f = module.addFunction(f6mPrefix+ "_mul01"); - f.addParam("pA", "i32"); // F6 - f.addParam("pC0", "i32"); // F2 - f.addParam("pC1", "i32"); // F2 - f.addParam("pR", "i32"); // F6 - - const c = f.getCodeBuilder(); - - const A_c0 = c.getLocal("pA"); - const A_c1 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*2)); - const A_c2 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*4)); - - const c0 = c.getLocal("pC0"); - const c1 = c.getLocal("pC1"); - - const t1 = c.getLocal("pR"); - const t2 = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*2)); - const t3 = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*4)); - - const a_a = c.i32_const(module.alloc(f1size*2)); - const b_b = c.i32_const(module.alloc(f1size*2)); - const Ac0_Ac1 = c.i32_const(module.alloc(f1size*2)); - const Ac0_Ac2 = c.i32_const(module.alloc(f1size*2)); - - f.addCode( - // let a_a = self.c0 * c0; - c.call(f2mPrefix + "_mul", A_c0, c0, a_a), - - // let b_b = self.c1 * c1; - c.call(f2mPrefix + "_mul", A_c1, c1, b_b), - - - c.call(f2mPrefix + "_add", A_c0, A_c1, Ac0_Ac1), - c.call(f2mPrefix + "_add", A_c0, A_c2, Ac0_Ac2), - - // let t1 = (self.c1 + self.c2) * c1 - b_b; - c.call(f2mPrefix + "_add", A_c1, A_c2, t1), - c.call(f2mPrefix + "_mul", t1, c1, t1), - c.call(f2mPrefix + "_sub", t1, b_b, t1), - - // let t1 = t1.mul_by_nonresidue() + a_a; - c.call(f2mPrefix + "_mulNR", t1, t1), - c.call(f2mPrefix + "_add", t1, a_a, t1), - - // let t2 = (c0 + c1) * (self.c0 + self.c1) - a_a - b_b; - c.call(f2mPrefix + "_add", c0, c1, t2), - c.call(f2mPrefix + "_mul", t2, Ac0_Ac1, t2), - c.call(f2mPrefix + "_sub", t2, a_a, t2), - c.call(f2mPrefix + "_sub", t2, b_b, t2), - - // let t3 = (self.c0 + self.c2) * c0 - a_a + b_b; - c.call(f2mPrefix + "_mul", Ac0_Ac2, c0, t3), - c.call(f2mPrefix + "_sub", t3, a_a, t3), - c.call(f2mPrefix + "_add", t3, b_b, t3), - - - ); - } - buildF6Mul01(); - - - function buildF12Mul014() { - - const f = module.addFunction(ftmPrefix+ "_mul014"); - f.addParam("pA", "i32"); // F12 - f.addParam("pC0", "i32"); // F2 - f.addParam("pC1", "i32"); // F2 - f.addParam("pC4", "i32"); // F2 - f.addParam("pR", "i32"); // F12 - - const c = f.getCodeBuilder(); - - - const A_c0 = c.getLocal("pA"); - const A_c1 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*6)); - - const c0 = c.getLocal("pC0"); - const c1 = c.getLocal("pC1"); - const c4 = c.getLocal("pC4"); - - const aa = c.i32_const(module.alloc(f1size*6)); - const bb = c.i32_const(module.alloc(f1size*6)); - const o = c.i32_const(module.alloc(f1size*2)); - - const R_c0 = c.getLocal("pR"); - const R_c1 = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*6)); - - f.addCode( - // let aa = self.c0.mul_by_01(c0, c1); - c.call(f6mPrefix + "_mul01", A_c0, c0, c1, aa), - - // let bb = self.c1.mul_by_1(c4); - c.call(f6mPrefix + "_mul1", A_c1, c4, bb), - - // let o = c1 + c4; - c.call(f2mPrefix + "_add", c1, c4, o), - - // let c1 = self.c1 + self.c0; - c.call(f6mPrefix + "_add", A_c1, A_c0, R_c1), - - // let c1 = c1.mul_by_01(c0, &o); - c.call(f6mPrefix + "_mul01", R_c1, c0, o, R_c1), - - // let c1 = c1 - aa - bb; - c.call(f6mPrefix + "_sub", R_c1, aa, R_c1), - c.call(f6mPrefix + "_sub", R_c1, bb, R_c1), - - // let c0 = bb; - c.call(f6mPrefix + "_copy", bb, R_c0), - - // let c0 = c0.mul_by_nonresidue(); - c.call(f6mPrefix + "_mulNR", R_c0, R_c0), - - // let c0 = c0 + aa; - c.call(f6mPrefix + "_add", R_c0, aa, R_c0), - ); - } - buildF12Mul014(); - - - function buildELL() { - const f = module.addFunction(prefix+ "_ell"); - f.addParam("pP", "i32"); - f.addParam("pCoefs", "i32"); - f.addParam("pF", "i32"); - - const c = f.getCodeBuilder(); - - const Px = c.getLocal("pP"); - const Py = c.i32_add(c.getLocal("pP"), c.i32_const(n8q)); - - const F = c.getLocal("pF"); - - const coef0_0 = c.getLocal("pCoefs"); - const coef0_1 = c.i32_add(c.getLocal("pCoefs"), c.i32_const(f1size)); - const coef1_0 = c.i32_add(c.getLocal("pCoefs"), c.i32_const(f1size*2)); - const coef1_1 = c.i32_add(c.getLocal("pCoefs"), c.i32_const(f1size*3)); - const coef2 = c.i32_add(c.getLocal("pCoefs"), c.i32_const(f1size*4)); - - const pc0 = module.alloc(f1size*2); - const c0 = c.i32_const(pc0); - const c0_c0 = c.i32_const(pc0); - const c0_c1 = c.i32_const(pc0+f1size); - - const pc1 = module.alloc(f1size*2); - const c1 = c.i32_const(pc1); - const c1_c0 = c.i32_const(pc1); - const c1_c1 = c.i32_const(pc1+f1size); - f.addCode( - // let mut c0 = coeffs.0; - // let mut c1 = coeffs.1; - // - // c0.c0 *= p.y; - // c0.c1 *= p.y; - // - // c1.c0 *= p.x; - // c1.c1 *= p.x; - // - // f.mul_by_014(&coeffs.2, &c1, &c0) - - c.call(f1mPrefix + "_mul", coef0_0, Py, c0_c0), - c.call(f1mPrefix + "_mul", coef0_1, Py, c0_c1), - c.call(f1mPrefix + "_mul", coef1_0, Px, c1_c0), - c.call(f1mPrefix + "_mul", coef1_1, Px, c1_c1), - - c.call(ftmPrefix + "_mul014", F, coef2, c1, c0, F), - - ); - - } - buildELL(); - - function buildMillerLoop() { - const f = module.addFunction(prefix+ "_millerLoop"); - f.addParam("ppreP", "i32"); - f.addParam("ppreQ", "i32"); - f.addParam("r", "i32"); - f.addLocal("pCoef", "i32"); - f.addLocal("i", "i32"); - - const c = f.getCodeBuilder(); - - const preP = c.getLocal("ppreP"); - c.getLocal("ppreQ"); - - const coefs = c.getLocal("pCoef"); - - const F = c.getLocal("r"); - - - f.addCode( - c.call(ftmPrefix + "_one", F), - - c.if( - c.call(g1mPrefix + "_isZero", preP), - c.ret([]) - ), - c.if( - c.call(g1mPrefix + "_isZero", c.getLocal("ppreQ")), - c.ret([]) - ), - c.setLocal("pCoef", c.i32_add( c.getLocal("ppreQ"), c.i32_const(f2size*3))), - - c.setLocal("i", c.i32_const(ateLoopBitBytes.length-2)), - c.block(c.loop( - - - c.call(prefix + "_ell", preP, coefs, F), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - c.if( - c.i32_load8_s(c.getLocal("i"), pAteLoopBitBytes), - [ - ...c.call(prefix + "_ell", preP, coefs, F), - ...c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - ] - ), - c.call(ftmPrefix + "_square", F, F), - - c.br_if(1, c.i32_eq ( c.getLocal("i"), c.i32_const(1) )), - c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )), - c.call(prefix + "_ell", preP, coefs, F), - - ); - - - { - f.addCode( - c.call(ftmPrefix + "_conjugate", F, F), - ); - } - } - - - function buildFrobeniusMap(n) { - const F12 = [ - [ - [bigInt$1("1"), bigInt$1("0")], - [bigInt$1("1"), bigInt$1("0")], - [bigInt$1("1"), bigInt$1("0")], - [bigInt$1("1"), bigInt$1("0")], - [bigInt$1("1"), bigInt$1("0")], - [bigInt$1("1"), bigInt$1("0")], - [bigInt$1("1"), bigInt$1("0")], - [bigInt$1("1"), bigInt$1("0")], - [bigInt$1("1"), bigInt$1("0")], - [bigInt$1("1"), bigInt$1("0")], - [bigInt$1("1"), bigInt$1("0")], - [bigInt$1("1"), bigInt$1("0")], - ], - [ - [bigInt$1("1"), bigInt$1("0")], - [bigInt$1("3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760"), bigInt$1("151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027")], - [bigInt$1("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351"), bigInt$1("0")], - [bigInt$1("2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530"), bigInt$1("1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257")], - [bigInt$1("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350"), bigInt$1("0")], - [bigInt$1("3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557"), bigInt$1("877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230")], - [bigInt$1("4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786"), bigInt$1("0")], - [bigInt$1("151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027"), bigInt$1("3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760")], - [bigInt$1("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436"), bigInt$1("0")], - [bigInt$1("1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257"), bigInt$1("2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530")], - [bigInt$1("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437"), bigInt$1("0")], - [bigInt$1("877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230"), bigInt$1("3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557")], - ] - ]; - - const F6 = [ - [ - [bigInt$1("1"), bigInt$1("0")], - [bigInt$1("1"), bigInt$1("0")], - [bigInt$1("1"), bigInt$1("0")], - [bigInt$1("1"), bigInt$1("0")], - [bigInt$1("1"), bigInt$1("0")], - [bigInt$1("1"), bigInt$1("0")], - ], - [ - [bigInt$1("1"), bigInt$1("0")], - [bigInt$1("0"), bigInt$1("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436")], - [bigInt$1("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350"), bigInt$1("0")], - [bigInt$1("0"), bigInt$1("1")], - [bigInt$1("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436"), bigInt$1("0")], - [bigInt$1("0"), bigInt$1("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350")], - ], - [ - [bigInt$1("1"), bigInt$1("0")], - [bigInt$1("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437"), bigInt$1("0")], - [bigInt$1("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436"), bigInt$1("0")], - [bigInt$1("4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786"), bigInt$1("0")], - [bigInt$1("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350"), bigInt$1("0")], - [bigInt$1("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351"), bigInt$1("0")], - ] - ]; - - const f = module.addFunction(ftmPrefix + "_frobeniusMap"+n); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - for (let i=0; i<6; i++) { - const X = (i==0) ? c.getLocal("x") : c.i32_add(c.getLocal("x"), c.i32_const(i*f2size)); - const Xc0 = X; - const Xc1 = c.i32_add(c.getLocal("x"), c.i32_const(i*f2size + f1size)); - const R = (i==0) ? c.getLocal("r") : c.i32_add(c.getLocal("r"), c.i32_const(i*f2size)); - const Rc0 = R; - const Rc1 = c.i32_add(c.getLocal("r"), c.i32_const(i*f2size + f1size)); - const coef = mul2(F12[Math.floor(i/3)][n%12] , F6[i%3][n%6]); - const pCoef = module.alloc([ - ...utils$5.bigInt2BytesLE(toMontgomery(coef[0]), n8q), - ...utils$5.bigInt2BytesLE(toMontgomery(coef[1]), n8q), - ]); - if (n%2 == 1) { - f.addCode( - c.call(f1mPrefix + "_copy", Xc0, Rc0), - c.call(f1mPrefix + "_neg", Xc1, Rc1), - c.call(f2mPrefix + "_mul", R, c.i32_const(pCoef), R), - ); - } else { - f.addCode(c.call(f2mPrefix + "_mul", X, c.i32_const(pCoef), R)); - } - } - - function mul2(a, b) { - const ac0 = bigInt$1(a[0]); - const ac1 = bigInt$1(a[1]); - const bc0 = bigInt$1(b[0]); - const bc1 = bigInt$1(b[1]); - const res = [ - ac0.times(bc0).minus( ac1.times(bc1) ).mod(q), - ac0.times(bc1).add( ac1.times(bc0) ).mod(q), - ]; - if (res[0].isNegative()) res[0] = res[0].add(q); - return res; - } - - } - - - function buildCyclotomicSquare() { - const f = module.addFunction(prefix+ "__cyclotomicSquare"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x4 = c.i32_add(c.getLocal("x"), c.i32_const(f2size)); - const x3 = c.i32_add(c.getLocal("x"), c.i32_const(2*f2size)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(3*f2size)); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(4*f2size)); - const x5 = c.i32_add(c.getLocal("x"), c.i32_const(5*f2size)); - - const r0 = c.getLocal("r"); - const r4 = c.i32_add(c.getLocal("r"), c.i32_const(f2size)); - const r3 = c.i32_add(c.getLocal("r"), c.i32_const(2*f2size)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(3*f2size)); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(4*f2size)); - const r5 = c.i32_add(c.getLocal("r"), c.i32_const(5*f2size)); - - const t0 = c.i32_const(module.alloc(f2size)); - const t1 = c.i32_const(module.alloc(f2size)); - const t2 = c.i32_const(module.alloc(f2size)); - const t3 = c.i32_const(module.alloc(f2size)); - const t4 = c.i32_const(module.alloc(f2size)); - const t5 = c.i32_const(module.alloc(f2size)); - const tmp = c.i32_const(module.alloc(f2size)); - const AUX = c.i32_const(module.alloc(f2size)); - - - f.addCode( - -// c.call(ftmPrefix + "_square", x0, r0), - - // // t0 + t1*y = (z0 + z1*y)^2 = a^2 - // tmp = z0 * z1; - // t0 = (z0 + z1) * (z0 + my_Fp6::non_residue * z1) - tmp - my_Fp6::non_residue * tmp; - // t1 = tmp + tmp; - c.call(f2mPrefix + "_mul", x0, x1, tmp), - c.call(f2mPrefix + "_mulNR", x1, t0), - c.call(f2mPrefix + "_add", x0, t0, t0), - c.call(f2mPrefix + "_add", x0, x1, AUX), - c.call(f2mPrefix + "_mul", AUX, t0, t0), - c.call(f2mPrefix + "_mulNR", tmp, AUX), - c.call(f2mPrefix + "_add", tmp, AUX, AUX), - c.call(f2mPrefix + "_sub", t0, AUX, t0), - c.call(f2mPrefix + "_add", tmp, tmp, t1), - - // // t2 + t3*y = (z2 + z3*y)^2 = b^2 - // tmp = z2 * z3; - // t2 = (z2 + z3) * (z2 + my_Fp6::non_residue * z3) - tmp - my_Fp6::non_residue * tmp; - // t3 = tmp + tmp; - c.call(f2mPrefix + "_mul", x2, x3, tmp), - c.call(f2mPrefix + "_mulNR", x3, t2), - c.call(f2mPrefix + "_add", x2, t2, t2), - c.call(f2mPrefix + "_add", x2, x3, AUX), - c.call(f2mPrefix + "_mul", AUX, t2, t2), - c.call(f2mPrefix + "_mulNR", tmp, AUX), - c.call(f2mPrefix + "_add", tmp, AUX, AUX), - c.call(f2mPrefix + "_sub", t2, AUX, t2), - c.call(f2mPrefix + "_add", tmp, tmp, t3), - - // // t4 + t5*y = (z4 + z5*y)^2 = c^2 - // tmp = z4 * z5; - // t4 = (z4 + z5) * (z4 + my_Fp6::non_residue * z5) - tmp - my_Fp6::non_residue * tmp; - // t5 = tmp + tmp; - c.call(f2mPrefix + "_mul", x4, x5, tmp), - c.call(f2mPrefix + "_mulNR", x5, t4), - c.call(f2mPrefix + "_add", x4, t4, t4), - c.call(f2mPrefix + "_add", x4, x5, AUX), - c.call(f2mPrefix + "_mul", AUX, t4, t4), - c.call(f2mPrefix + "_mulNR", tmp, AUX), - c.call(f2mPrefix + "_add", tmp, AUX, AUX), - c.call(f2mPrefix + "_sub", t4, AUX, t4), - c.call(f2mPrefix + "_add", tmp, tmp, t5), - - // For A - // z0 = 3 * t0 - 2 * z0 - c.call(f2mPrefix + "_sub", t0, x0, r0), - c.call(f2mPrefix + "_add", r0, r0, r0), - c.call(f2mPrefix + "_add", t0, r0, r0), - // z1 = 3 * t1 + 2 * z1 - c.call(f2mPrefix + "_add", t1, x1, r1), - c.call(f2mPrefix + "_add", r1, r1, r1), - c.call(f2mPrefix + "_add", t1, r1, r1), - - // For B - // z2 = 3 * (xi * t5) + 2 * z2 - c.call(f2mPrefix + "_mul", t5, c.i32_const(pBls12381Twist), AUX), - c.call(f2mPrefix + "_add", AUX, x2, r2), - c.call(f2mPrefix + "_add", r2, r2, r2), - c.call(f2mPrefix + "_add", AUX, r2, r2), - // z3 = 3 * t4 - 2 * z3 - c.call(f2mPrefix + "_sub", t4, x3, r3), - c.call(f2mPrefix + "_add", r3, r3, r3), - c.call(f2mPrefix + "_add", t4, r3, r3), - - // For C - // z4 = 3 * t2 - 2 * z4 - c.call(f2mPrefix + "_sub", t2, x4, r4), - c.call(f2mPrefix + "_add", r4, r4, r4), - c.call(f2mPrefix + "_add", t2, r4, r4), - // z5 = 3 * t3 + 2 * z5 - c.call(f2mPrefix + "_add", t3, x5, r5), - c.call(f2mPrefix + "_add", r5, r5, r5), - c.call(f2mPrefix + "_add", t3, r5, r5), - - ); - } - - - function buildCyclotomicExp(exponent, isExpNegative, fnName) { - const exponentNafBytes = naf(exponent).map( (b) => (b==-1 ? 0xFF: b) ); - const pExponentNafBytes = module.alloc(exponentNafBytes); - // const pExponent = module.alloc(utils.bigInt2BytesLE(exponent, n8)); - - const f = module.addFunction(prefix+ "__cyclotomicExp_"+fnName); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - f.addLocal("bit", "i32"); - f.addLocal("i", "i32"); - - const c = f.getCodeBuilder(); - - const x = c.getLocal("x"); - - const res = c.getLocal("r"); - - const inverse = c.i32_const(module.alloc(ftsize)); - - - f.addCode( -// c.call(ftmPrefix + "_exp", x, c.i32_const(pExponent), c.i32_const(32), res), - - c.call(ftmPrefix + "_conjugate", x, inverse), - c.call(ftmPrefix + "_one", res), - - c.if( - c.teeLocal("bit", c.i32_load8_s(c.i32_const(exponentNafBytes.length-1), pExponentNafBytes)), - c.if( - c.i32_eq( - c.getLocal("bit"), - c.i32_const(1) - ), - c.call(ftmPrefix + "_mul", res, x, res), - c.call(ftmPrefix + "_mul", res, inverse, res), - ) - ), - - c.setLocal("i", c.i32_const(exponentNafBytes.length-2)), - c.block(c.loop( -// c.call(ftmPrefix + "_square", res, res), - c.call(prefix + "__cyclotomicSquare", res, res), - c.if( - c.teeLocal("bit", c.i32_load8_s(c.getLocal("i"), pExponentNafBytes)), - c.if( - c.i32_eq( - c.getLocal("bit"), - c.i32_const(1) - ), - c.call(ftmPrefix + "_mul", res, x, res), - c.call(ftmPrefix + "_mul", res, inverse, res), - ) - ), - c.br_if(1, c.i32_eqz ( c.getLocal("i") )), - c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - ); - - if (isExpNegative) { - f.addCode( - c.call(ftmPrefix + "_conjugate", res, res), - ); - } - - } - - function buildFinalExponentiation() { - buildCyclotomicSquare(); - buildCyclotomicExp(finalExpZ, finalExpIsNegative, "w0"); - - const f = module.addFunction(prefix+ "_finalExponentiation"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const elt = c.getLocal("x"); - const res = c.getLocal("r"); - const t0 = c.i32_const(module.alloc(ftsize)); - const t1 = c.i32_const(module.alloc(ftsize)); - const t2 = c.i32_const(module.alloc(ftsize)); - const t3 = c.i32_const(module.alloc(ftsize)); - const t4 = c.i32_const(module.alloc(ftsize)); - const t5 = c.i32_const(module.alloc(ftsize)); - const t6 = c.i32_const(module.alloc(ftsize)); - - f.addCode( - - // let mut t0 = f.frobenius_map(6) - c.call(ftmPrefix + "_frobeniusMap6", elt, t0), - - // let t1 = f.invert() - c.call(ftmPrefix + "_inverse", elt, t1), - - // let mut t2 = t0 * t1; - c.call(ftmPrefix + "_mul", t0, t1, t2), - - // t1 = t2.clone(); - c.call(ftmPrefix + "_copy", t2, t1), - - // t2 = t2.frobenius_map().frobenius_map(); - c.call(ftmPrefix + "_frobeniusMap2", t2, t2), - - // t2 *= t1; - c.call(ftmPrefix + "_mul", t2, t1, t2), - - - // t1 = cyclotomic_square(t2).conjugate(); - c.call(prefix + "__cyclotomicSquare", t2, t1), - c.call(ftmPrefix + "_conjugate", t1, t1), - - // let mut t3 = cycolotomic_exp(t2); - c.call(prefix + "__cyclotomicExp_w0", t2, t3), - - // let mut t4 = cyclotomic_square(t3); - c.call(prefix + "__cyclotomicSquare", t3, t4), - - // let mut t5 = t1 * t3; - c.call(ftmPrefix + "_mul", t1, t3, t5), - - // t1 = cycolotomic_exp(t5); - c.call(prefix + "__cyclotomicExp_w0", t5, t1), - - // t0 = cycolotomic_exp(t1); - c.call(prefix + "__cyclotomicExp_w0", t1, t0), - - // let mut t6 = cycolotomic_exp(t0); - c.call(prefix + "__cyclotomicExp_w0", t0, t6), - - // t6 *= t4; - c.call(ftmPrefix + "_mul", t6, t4, t6), - - // t4 = cycolotomic_exp(t6); - c.call(prefix + "__cyclotomicExp_w0", t6, t4), - - // t5 = t5.conjugate(); - c.call(ftmPrefix + "_conjugate", t5, t5), - - // t4 *= t5 * t2; - c.call(ftmPrefix + "_mul", t4, t5, t4), - c.call(ftmPrefix + "_mul", t4, t2, t4), - - // t5 = t2.conjugate(); - c.call(ftmPrefix + "_conjugate", t2, t5), - - // t1 *= t2; - c.call(ftmPrefix + "_mul", t1, t2, t1), - - // t1 = t1.frobenius_map().frobenius_map().frobenius_map(); - c.call(ftmPrefix + "_frobeniusMap3", t1, t1), - - // t6 *= t5; - c.call(ftmPrefix + "_mul", t6, t5, t6), - - // t6 = t6.frobenius_map(); - c.call(ftmPrefix + "_frobeniusMap1", t6, t6), - - // t3 *= t0; - c.call(ftmPrefix + "_mul", t3, t0, t3), - - // t3 = t3.frobenius_map().frobenius_map(); - c.call(ftmPrefix + "_frobeniusMap2", t3, t3), - - // t3 *= t1; - c.call(ftmPrefix + "_mul", t3, t1, t3), - - // t3 *= t6; - c.call(ftmPrefix + "_mul", t3, t6, t3), - - // f = t3 * t4; - c.call(ftmPrefix + "_mul", t3, t4, res), - - ); - } - - - function buildFinalExponentiationOld() { - const f = module.addFunction(prefix+ "_finalExponentiationOld"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const exponent = bigInt$1("322277361516934140462891564586510139908379969514828494218366688025288661041104682794998680497580008899973249814104447692778988208376779573819485263026159588510513834876303014016798809919343532899164848730280942609956670917565618115867287399623286813270357901731510188149934363360381614501334086825442271920079363289954510565375378443704372994881406797882676971082200626541916413184642520269678897559532260949334760604962086348898118982248842634379637598665468817769075878555493752214492790122785850202957575200176084204422751485957336465472324810982833638490904279282696134323072515220044451592646885410572234451732790590013479358343841220074174848221722017083597872017638514103174122784843925578370430843522959600095676285723737049438346544753168912974976791528535276317256904336520179281145394686565050419250614107803233314658825463117900250701199181529205942363159325765991819433914303908860460720581408201373164047773794825411011922305820065611121544561808414055302212057471395719432072209245600258134364584636810093520285711072578721435517884103526483832733289802426157301542744476740008494780363354305116978805620671467071400711358839553375340724899735460480144599782014906586543813292157922220645089192130209334926661588737007768565838519456601560804957985667880395221049249803753582637708560"); - - const pExponent = module.alloc(utils$5.bigInt2BytesLE( exponent, 544 )); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call(ftmPrefix + "_exp", c.getLocal("x"), c.i32_const(pExponent), c.i32_const(544), c.getLocal("r")), - ); - } - - - const pPreP = module.alloc(prePSize); - const pPreQ = module.alloc(preQSize); - - function buildPairingEquation(nPairings) { - - const f = module.addFunction(prefix+ "_pairingEq"+nPairings); - for (let i=0; i. -*/ - -// module.exports.bn128_wasm = require("./build/bn128_wasm.js"); -// module.exports.bls12381_wasm = require("./build/bls12381_wasm.js"); -// module.exports.mnt6753_wasm = require("./build/mnt6753_wasm.js"); - -var buildBn128$1 = build_bn128; -var buildBls12381$1 = build_bls12381; - -/* global BigInt */ - -function stringifyBigInts$2(o) { - if ((typeof(o) == "bigint") || o.eq !== undefined) { - return o.toString(10); - } else if (o instanceof Uint8Array) { - return fromRprLE(o, 0); - } else if (Array.isArray(o)) { - return o.map(stringifyBigInts$2); - } else if (typeof o == "object") { - const res = {}; - const keys = Object.keys(o); - keys.forEach( (k) => { - res[k] = stringifyBigInts$2(o[k]); - }); - return res; - } else { - return o; - } -} - -function unstringifyBigInts$2(o) { - if ((typeof(o) == "string") && (/^[0-9]+$/.test(o) )) { - return BigInt(o); - } else if ((typeof(o) == "string") && (/^0x[0-9a-fA-F]+$/.test(o) )) { - return BigInt(o); - } else if (Array.isArray(o)) { - return o.map(unstringifyBigInts$2); - } else if (typeof o == "object") { - if (o===null) return null; - const res = {}; - const keys = Object.keys(o); - keys.forEach( (k) => { - res[k] = unstringifyBigInts$2(o[k]); - }); - return res; - } else { - return o; - } -} - -function beBuff2int$2(buff) { - let res = BigInt(0); - let i = buff.length; - let offset = 0; - const buffV = new DataView(buff.buffer, buff.byteOffset, buff.byteLength); - while (i>0) { - if (i >= 4) { - i -= 4; - res += BigInt(buffV.getUint32(i)) << BigInt(offset*8); - offset += 4; - } else if (i >= 2) { - i -= 2; - res += BigInt(buffV.getUint16(i)) << BigInt(offset*8); - offset += 2; - } else { - i -= 1; - res += BigInt(buffV.getUint8(i)) << BigInt(offset*8); - offset += 1; - } - } - return res; -} - -function beInt2Buff$2(n, len) { - let r = n; - const buff = new Uint8Array(len); - const buffV = new DataView(buff.buffer); - let o = len; - while (o > 0) { - if (o-4 >= 0) { - o -= 4; - buffV.setUint32(o, Number(r & BigInt(0xFFFFFFFF))); - r = r >> BigInt(32); - } else if (o-2 >= 0) { - o -= 2; - buffV.setUint16(o, Number(r & BigInt(0xFFFF))); - r = r >> BigInt(16); - } else { - o -= 1; - buffV.setUint8(o, Number(r & BigInt(0xFF))); - r = r >> BigInt(8); - } - } - if (r) { - throw new Error("Number does not fit in this length"); - } - return buff; -} - - -function leBuff2int$2(buff) { - let res = BigInt(0); - let i = 0; - const buffV = new DataView(buff.buffer, buff.byteOffset, buff.byteLength); - while (i> BigInt(32); - } else if (o+2 <= len) { - buffV.setUint16(Number(o, r & BigInt(0xFFFF)), true ); - o += 2; - r = r >> BigInt(16); - } else { - buffV.setUint8(Number(o, r & BigInt(0xFF)), true ); - o += 1; - r = r >> BigInt(8); - } - } - if (r) { - throw new Error("Number does not fit in this length"); - } - return buff; -} - - -function stringifyFElements$1(F, o) { - if ((typeof(o) == "bigint") || o.eq !== undefined) { - return o.toString(10); - } else if (o instanceof Uint8Array) { - return F.toString(F.e(o)); - } else if (Array.isArray(o)) { - return o.map(stringifyFElements$1.bind(this,F)); - } else if (typeof o == "object") { - const res = {}; - const keys = Object.keys(o); - keys.forEach( (k) => { - res[k] = stringifyFElements$1(F, o[k]); - }); - return res; - } else { - return o; - } -} - - -function unstringifyFElements$1(F, o) { - if ((typeof(o) == "string") && (/^[0-9]+$/.test(o) )) { - return F.e(o); - } else if ((typeof(o) == "string") && (/^0x[0-9a-fA-F]+$/.test(o) )) { - return F.e(o); - } else if (Array.isArray(o)) { - return o.map(unstringifyFElements$1.bind(this,F)); - } else if (typeof o == "object") { - if (o===null) return null; - const res = {}; - const keys = Object.keys(o); - keys.forEach( (k) => { - res[k] = unstringifyFElements$1(F, o[k]); - }); - return res; - } else { - return o; - } -} - -var utils_native = /*#__PURE__*/Object.freeze({ - __proto__: null, - beBuff2int: beBuff2int$2, - beInt2Buff: beInt2Buff$2, - leBuff2int: leBuff2int$2, - leInt2Buff: leInt2Buff$2, - stringifyBigInts: stringifyBigInts$2, - stringifyFElements: stringifyFElements$1, - unstringifyBigInts: unstringifyBigInts$2, - unstringifyFElements: unstringifyFElements$1 -}); - -function stringifyBigInts$1(o) { - if ((typeof(o) == "bigint") || o.eq !== undefined) { - return o.toString(10); - } else if (Array.isArray(o)) { - return o.map(stringifyBigInts$1); - } else if (typeof o == "object") { - const res = {}; - const keys = Object.keys(o); - keys.forEach( (k) => { - res[k] = stringifyBigInts$1(o[k]); - }); - return res; - } else { - return o; - } -} - -function unstringifyBigInts$1(o) { - if ((typeof(o) == "string") && (/^[0-9]+$/.test(o) )) { - return bigInt$8(o); - } else if ((typeof(o) == "string") && (/^0x[0-9a-fA-F]+$/.test(o) )) { - return bigInt$8(o); - } else if (Array.isArray(o)) { - return o.map(unstringifyBigInts$1); - } else if (typeof o == "object") { - const res = {}; - const keys = Object.keys(o); - keys.forEach( (k) => { - res[k] = unstringifyBigInts$1(o[k]); - }); - return res; - } else { - return o; - } -} - -function beBuff2int$1(buff) { - let res = bigInt$8.zero; - for (let i=0; i=0)) { - let c = Number(r.and(bigInt$8("255"))); - buff[o] = c; - o--; - r = r.shiftRight(8); - } - if (!r.eq(bigInt$8.zero)) { - throw new Error("Number does not fit in this length"); - } - return buff; -} - - -function leBuff2int$1 (buff) { - let res = bigInt$8.zero; - for (let i=0; i>=1; - } - return res; -} - -utils$4.bitReverse = function bitReverse(idx, bits) { - return ( - _revTable[idx >>> 24] | - (_revTable[(idx >>> 16) & 0xFF] << 8) | - (_revTable[(idx >>> 8) & 0xFF] << 16) | - (_revTable[idx & 0xFF] << 24) - ) >>> (32-bits); -}; - - -utils$4.log2 = function log2( V ) -{ - return( ( ( V & 0xFFFF0000 ) !== 0 ? ( V &= 0xFFFF0000, 16 ) : 0 ) | ( ( V & 0xFF00FF00 ) !== 0 ? ( V &= 0xFF00FF00, 8 ) : 0 ) | ( ( V & 0xF0F0F0F0 ) !== 0 ? ( V &= 0xF0F0F0F0, 4 ) : 0 ) | ( ( V & 0xCCCCCCCC ) !== 0 ? ( V &= 0xCCCCCCCC, 2 ) : 0 ) | ( ( V & 0xAAAAAAAA ) !== 0 ) ); -}; - -utils$4.buffReverseBits = function buffReverseBits(buff, eSize) { - const n = buff.byteLength /eSize; - const bits = utils$4.log2(n); - if (n != (1 << bits)) { - throw new Error("Invalid number of pointers"); - } - for (let i=0; ir) { - const tmp = buff.slice(i*eSize, (i+1)*eSize); - buff.set( buff.slice(r*eSize, (r+1)*eSize), i*eSize); - buff.set(tmp, r*eSize); - } - } -}; - - -utils$4.array2buffer = function(arr, sG) { - const buff = new Uint8Array(sG*arr.length); - - for (let i=0; i0) { - // bytes to copy from this page - const l = (o+r > PAGE_SIZE) ? (PAGE_SIZE -o) : r; - const srcView = new Uint8Array(this.buffers[p].buffer, this.buffers[p].byteOffset+o, l); - if (l == len) return srcView.slice(); - if (!buff) { - if (len <= PAGE_SIZE) { - buff = new Uint8Array(len); - } else { - buff = new BigBuffer(len); - } - } - buff.set(srcView, len-r); - r = r-l; - p ++; - o = 0; - } - - return buff; - } - - set(buff, offset) { - if (offset === undefined) offset = 0; - - const len = buff.byteLength; - - if (len==0) return; - - const firstPage = Math.floor(offset / PAGE_SIZE); - const lastPage = Math.floor((offset+len-1) / PAGE_SIZE); - - if (firstPage == lastPage) { - if ((buff instanceof BigBuffer)&&(buff.buffers.length==1)) { - return this.buffers[firstPage].set(buff.buffers[0], offset % PAGE_SIZE); - } else { - return this.buffers[firstPage].set(buff, offset % PAGE_SIZE); - } - - } - - - let p = firstPage; - let o = offset % PAGE_SIZE; - let r = len; - while (r>0) { - const l = (o+r > PAGE_SIZE) ? (PAGE_SIZE -o) : r; - const srcView = buff.slice( len -r, len -r+l); - const dstView = new Uint8Array(this.buffers[p].buffer, this.buffers[p].byteOffset + o, l); - dstView.set(srcView); - r = r-l; - p ++; - o = 0; - } - - } -} - -function buildBatchConvert(tm, fnName, sIn, sOut) { - return async function batchConvert(buffIn) { - const nPoints = Math.floor(buffIn.byteLength / sIn); - if ( nPoints * sIn !== buffIn.byteLength) { - throw new Error("Invalid buffer size"); - } - const pointsPerChunk = Math.floor(nPoints/tm.concurrency); - const opPromises = []; - for (let i=0; i=0; i--) { - this.w[i] = this.square(this.w[i+1]); - } - - if (!this.eq(this.w[0], this.one)) { - throw new Error("Error calculating roots of unity"); - } - - this.batchToMontgomery = buildBatchConvert(tm, prefix + "_batchToMontgomery", this.n8, this.n8); - this.batchFromMontgomery = buildBatchConvert(tm, prefix + "_batchFromMontgomery", this.n8, this.n8); - } - - - op2(opName, a, b) { - this.tm.setBuff(this.pOp1, a); - this.tm.setBuff(this.pOp2, b); - this.tm.instance.exports[this.prefix + opName](this.pOp1, this.pOp2, this.pOp3); - return this.tm.getBuff(this.pOp3, this.n8); - } - - op2Bool(opName, a, b) { - this.tm.setBuff(this.pOp1, a); - this.tm.setBuff(this.pOp2, b); - return !!this.tm.instance.exports[this.prefix + opName](this.pOp1, this.pOp2); - } - - op1(opName, a) { - this.tm.setBuff(this.pOp1, a); - this.tm.instance.exports[this.prefix + opName](this.pOp1, this.pOp3); - return this.tm.getBuff(this.pOp3, this.n8); - } - - op1Bool(opName, a) { - this.tm.setBuff(this.pOp1, a); - return !!this.tm.instance.exports[this.prefix + opName](this.pOp1, this.pOp3); - } - - add(a,b) { - return this.op2("_add", a, b); - } - - - eq(a,b) { - return this.op2Bool("_eq", a, b); - } - - isZero(a) { - return this.op1Bool("_isZero", a); - } - - sub(a,b) { - return this.op2("_sub", a, b); - } - - neg(a) { - return this.op1("_neg", a); - } - - inv(a) { - return this.op1("_inverse", a); - } - - toMontgomery(a) { - return this.op1("_toMontgomery", a); - } - - fromMontgomery(a) { - return this.op1("_fromMontgomery", a); - } - - mul(a,b) { - return this.op2("_mul", a, b); - } - - div(a, b) { - this.tm.setBuff(this.pOp1, a); - this.tm.setBuff(this.pOp2, b); - this.tm.instance.exports[this.prefix + "_inverse"](this.pOp2, this.pOp2); - this.tm.instance.exports[this.prefix + "_mul"](this.pOp1, this.pOp2, this.pOp3); - return this.tm.getBuff(this.pOp3, this.n8); - } - - square(a) { - return this.op1("_square", a); - } - - isSquare(a) { - return this.op1Bool("_isSquare", a); - } - - sqrt(a) { - return this.op1("_sqrt", a); - } - - exp(a, b) { - if (!(b instanceof Uint8Array)) { - b = toLEBuff(e(b)); - } - this.tm.setBuff(this.pOp1, a); - this.tm.setBuff(this.pOp2, b); - this.tm.instance.exports[this.prefix + "_exp"](this.pOp1, this.pOp2, b.byteLength, this.pOp3); - return this.tm.getBuff(this.pOp3, this.n8); - } - - isNegative(a) { - return this.op1Bool("_isNegative", a); - } - - e(a, b) { - if (a instanceof Uint8Array) return a; - let ra = e(a, b); - if (isNegative(ra)) { - ra = neg(ra); - if (gt(ra, this.p)) { - ra = mod(ra, this.p); - } - ra = sub(this.p, ra); - } else { - if (gt(ra, this.p)) { - ra = mod(ra, this.p); - } - } - const buff = leInt2Buff(ra, this.n8); - return this.toMontgomery(buff); - } - - toString(a, radix) { - const an = this.fromMontgomery(a); - const s = fromRprLE(an, 0); - return toString(s, radix); - } - - fromRng(rng) { - let v; - const buff = new Uint8Array(this.n8); - do { - v = zero; - for (let i=0; i memory.buffer.byteLength) { - const currentPages = memory.buffer.byteLength / 0x10000; - let requiredPages = Math.floor((u32[0] + length) / 0x10000)+1; - if (requiredPages>MAXMEM) requiredPages=MAXMEM; - memory.grow(requiredPages-currentPages); - } - return res; - } - - function allocBuffer(buffer) { - const p = alloc(buffer.byteLength); - setBuffer(p, buffer); - return p; - } - - function getBuffer(pointer, length) { - const u8 = new Uint8Array(memory.buffer); - return new Uint8Array(u8.buffer, u8.byteOffset + pointer, length); - } - - function setBuffer(pointer, buffer) { - const u8 = new Uint8Array(memory.buffer); - u8.set(new Uint8Array(buffer), pointer); - } - - function runTask(task) { - if (task[0].cmd == "INIT") { - return init(task[0]); - } - const ctx = { - vars: [], - out: [] - }; - const u32a = new Uint32Array(memory.buffer, 0, 1); - const oldAlloc = u32a[0]; - for (let i=0; i { - try { - handler.call(this, event); - } - catch (err) { - console.error(err); - } - }); - } - addEventListener(type, fn) { - let events = this[EVENTS].get(type); - if (!events) this[EVENTS].set(type, events = []); - events.push(fn); - } - removeEventListener(type, fn) { - let events = this[EVENTS].get(type); - if (events) { - const index = events.indexOf(fn); - if (index !== -1) events.splice(index, 1); - } + Object.defineProperty(FixedMerkleTree, "__esModule", { value: true }); + const simpleHash_1 = __importDefault(/*@__PURE__*/ requireSimpleHash()); + const BaseTree_1 = /*@__PURE__*/ requireBaseTree(); + class MerkleTree extends BaseTree_1.BaseTree { + constructor(levels, elements = [], { hashFunction = simpleHash_1.default, zeroElement = 0, } = {}) { + super(); + this.levels = levels; + if (elements.length > this.capacity) { + throw new Error('Tree is full'); + } + this._hashFn = hashFunction; + this.zeroElement = zeroElement; + this._layers = []; + const leaves = elements.slice(); + this._layers = [leaves]; + this._buildZeros(); + this._buildHashes(); + } + _buildHashes() { + for (let layerIndex = 1; layerIndex <= this.levels; layerIndex++) { + const nodes = this._layers[layerIndex - 1]; + this._layers[layerIndex] = this._processNodes(nodes, layerIndex); + } + } + /** + * Insert multiple elements into the tree. + * @param {Array} elements Elements to insert + */ + bulkInsert(elements) { + if (!elements.length) { + return; + } + if (this._layers[0].length + elements.length > this.capacity) { + throw new Error('Tree is full'); + } + // First we insert all elements except the last one + // updating only full subtree hashes (all layers where inserted element has odd index) + // the last element will update the full path to the root making the tree consistent again + for (let i = 0; i < elements.length - 1; i++) { + this._layers[0].push(elements[i]); + let level = 0; + let index = this._layers[0].length - 1; + while (index % 2 === 1) { + level++; + index >>= 1; + this._layers[level][index] = this._hashFn(this._layers[level - 1][index * 2], this._layers[level - 1][index * 2 + 1]); + } + } + this.insert(elements[elements.length - 1]); + } + indexOf(element, comparator) { + return BaseTree_1.BaseTree.indexOf(this._layers[0], element, 0, comparator); + } + proof(element) { + const index = this.indexOf(element); + return this.path(index); + } + getTreeEdge(edgeIndex) { + const edgeElement = this._layers[0][edgeIndex]; + if (edgeElement === undefined) { + throw new Error('Element not found'); + } + const edgePath = this.path(edgeIndex); + return { edgePath, edgeElement, edgeIndex, edgeElementsCount: this._layers[0].length }; + } + /** + * 🪓 + * @param count + */ + getTreeSlices(count = 4) { + const length = this._layers[0].length; + let size = Math.ceil(length / count); + if (size % 2) + size++; + const slices = []; + for (let i = 0; i < length; i += size) { + const edgeLeft = i; + const edgeRight = i + size; + slices.push({ edge: this.getTreeEdge(edgeLeft), elements: this.elements.slice(edgeLeft, edgeRight) }); + } + return slices; + } + /** + * Serialize entire tree state including intermediate layers into a plain object + * Deserializing it back will not require to recompute any hashes + * Elements are not converted to a plain type, this is responsibility of the caller + */ + serialize() { + return { + levels: this.levels, + _zeros: this._zeros, + _layers: this._layers, + }; + } + /** + * Deserialize data into a MerkleTree instance + * Make sure to provide the same hashFunction as was used in the source tree, + * otherwise the tree state will be invalid + */ + static deserialize(data, hashFunction) { + const instance = Object.assign(Object.create(this.prototype), data); + instance._hashFn = hashFunction || simpleHash_1.default; + instance.zeroElement = instance._zeros[0]; + return instance; + } + toString() { + return JSON.stringify(this.serialize()); + } } + FixedMerkleTree.default = MerkleTree; + return FixedMerkleTree; } -function Event(type, target) { - this.type = type; - this.timeStamp = Date.now(); - this.target = this.currentTarget = this.data = null; +var PartialMerkleTree = {}; + +var hasRequiredPartialMerkleTree; + +function requirePartialMerkleTree () { + if (hasRequiredPartialMerkleTree) return PartialMerkleTree; + hasRequiredPartialMerkleTree = 1; + var __importDefault = (PartialMerkleTree && PartialMerkleTree.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + Object.defineProperty(PartialMerkleTree, "__esModule", { value: true }); + PartialMerkleTree.PartialMerkleTree = void 0; + const simpleHash_1 = __importDefault(/*@__PURE__*/ requireSimpleHash()); + const BaseTree_1 = /*@__PURE__*/ requireBaseTree(); + let PartialMerkleTree$1 = class PartialMerkleTree extends BaseTree_1.BaseTree { + constructor(levels, { edgePath, edgeElement, edgeIndex, edgeElementsCount, }, leaves, { hashFunction, zeroElement } = {}) { + super(); + if (edgeIndex + leaves.length !== edgeElementsCount) + throw new Error('Invalid number of elements'); + this._edgeLeafProof = edgePath; + this._initialRoot = edgePath.pathRoot; + this.zeroElement = zeroElement !== null && zeroElement !== void 0 ? zeroElement : 0; + this._edgeLeaf = { data: edgeElement, index: edgeIndex }; + this._leavesAfterEdge = leaves; + this.levels = levels; + this._hashFn = hashFunction || simpleHash_1.default; + this._createProofMap(); + this._buildTree(); + } + get edgeIndex() { + return this._edgeLeaf.index; + } + get edgeElement() { + return this._edgeLeaf.data; + } + get edgeLeafProof() { + return this._edgeLeafProof; + } + _createProofMap() { + this._proofMap = this.edgeLeafProof.pathPositions.reduce((p, c, i) => { + p.set(i, [c, this.edgeLeafProof.pathElements[i]]); + return p; + }, new Map()); + this._proofMap.set(this.levels, [0, this.edgeLeafProof.pathRoot]); + } + _buildTree() { + const edgeLeafIndex = this._edgeLeaf.index; + this._leaves = Array(edgeLeafIndex).concat(this._leavesAfterEdge); + if (this._proofMap.has(0)) { + const [proofPos, proofEl] = this._proofMap.get(0); + this._leaves[proofPos] = proofEl; + } + this._layers = [this._leaves]; + this._buildZeros(); + this._buildHashes(); + } + _buildHashes() { + for (let layerIndex = 1; layerIndex <= this.levels; layerIndex++) { + const nodes = this._layers[layerIndex - 1]; + const currentLayer = this._processNodes(nodes, layerIndex); + if (this._proofMap.has(layerIndex)) { + const [proofPos, proofEl] = this._proofMap.get(layerIndex); + if (!currentLayer[proofPos]) + currentLayer[proofPos] = proofEl; + } + this._layers[layerIndex] = currentLayer; + } + } + /** + * Change an element in the tree + * @param {number} index Index of element to change + * @param element Updated element value + */ + update(index, element) { + if (isNaN(Number(index)) || index < 0 || index > this._layers[0].length || index >= this.capacity) { + throw new Error('Insert index out of bounds: ' + index); + } + if (index < this._edgeLeaf.index) { + throw new Error(`Index ${index} is below the edge: ${this._edgeLeaf.index}`); + } + this._layers[0][index] = element; + this._processUpdate(index); + } + path(index) { + var _a; + if (isNaN(Number(index)) || index < 0 || index >= this._layers[0].length) { + throw new Error('Index out of bounds: ' + index); + } + if (index < this._edgeLeaf.index) { + throw new Error(`Index ${index} is below the edge: ${this._edgeLeaf.index}`); + } + let elIndex = Number(index); + const pathElements = []; + const pathIndices = []; + const pathPositions = []; + for (let level = 0; level < this.levels; level++) { + pathIndices[level] = elIndex % 2; + const leafIndex = elIndex ^ 1; + if (leafIndex < this._layers[level].length) { + pathElements[level] = this._layers[level][leafIndex]; + pathPositions[level] = leafIndex; + } + else { + pathElements[level] = this._zeros[level]; + pathPositions[level] = 0; + } + const [proofPos, proofEl] = this._proofMap.get(level); + pathElements[level] = (_a = pathElements[level]) !== null && _a !== void 0 ? _a : (proofPos === leafIndex ? proofEl : this._zeros[level]); + elIndex >>= 1; + } + return { + pathElements, + pathIndices, + pathPositions, + pathRoot: this.root, + }; + } + indexOf(element, comparator) { + return BaseTree_1.BaseTree.indexOf(this._layers[0], element, this.edgeIndex, comparator); + } + proof(element) { + const index = this.indexOf(element); + return this.path(index); + } + /** + * Shifts edge of tree to left + * @param edge new TreeEdge below current edge + * @param elements leaves between old and new edge + */ + shiftEdge(edge, elements) { + if (this._edgeLeaf.index <= edge.edgeIndex) { + throw new Error(`New edgeIndex should be smaller then ${this._edgeLeaf.index}`); + } + if (elements.length !== (this._edgeLeaf.index - edge.edgeIndex)) { + throw new Error(`Elements length should be ${this._edgeLeaf.index - edge.edgeIndex}`); + } + this._edgeLeafProof = edge.edgePath; + this._edgeLeaf = { index: edge.edgeIndex, data: edge.edgeElement }; + this._leavesAfterEdge = [...elements, ...this._leavesAfterEdge]; + this._createProofMap(); + this._buildTree(); + } + serialize() { + return { + _edgeLeafProof: this._edgeLeafProof, + _edgeLeaf: this._edgeLeaf, + _layers: this._layers, + _zeros: this._zeros, + levels: this.levels, + }; + } + static deserialize(data, hashFunction) { + const instance = Object.assign(Object.create(this.prototype), data); + instance._hashFn = hashFunction || simpleHash_1.default; + instance._initialRoot = data._edgeLeafProof.pathRoot; + instance.zeroElement = instance._zeros[0]; + instance._leavesAfterEdge = instance._layers[0].slice(data._edgeLeaf.index); + instance._createProofMap(); + return instance; + } + toString() { + return JSON.stringify(this.serialize()); + } + }; + PartialMerkleTree.PartialMerkleTree = PartialMerkleTree$1; + return PartialMerkleTree; } -// this module is used self-referentially on both sides of the -// thread boundary, but behaves differently in each context. -var Worker = threads.isMainThread ? mainThread() : workerThread(); +var hasRequiredLib; -const baseUrl = URL.pathToFileURL(process.cwd() + '/'); - -function mainThread() { - - /** - * A web-compatible Worker implementation atop Node's worker_threads. - * - uses DOM-style events (Event.data, Event.type, etc) - * - supports event handler properties (worker.onmessage) - * - Worker() constructor accepts a module URL - * - accepts the {type:'module'} option - * - emulates WorkerGlobalScope within the worker - * @param {string} url The URL or module specifier to load - * @param {object} [options] Worker construction options - * @param {string} [options.name] Available as `self.name` within the Worker - * @param {string} [options.type="classic"] Pass "module" to create a Module Worker. - */ - class Worker extends EventTarget { - constructor(url, options) { - super(); - const { name, type } = options || {}; - url += ''; - let mod; - if (/^data:/.test(url)) { - mod = url; - } - else { - mod = URL.fileURLToPath(new URL.URL(url, baseUrl)); - } - const worker = new threads.Worker( - __filename, - { workerData: { mod, name, type } } - ); - Object.defineProperty(this, WORKER, { - value: worker - }); - worker.on('message', data => { - const event = new Event('message'); - event.data = data; - this.dispatchEvent(event); - }); - worker.on('error', error => { - error.type = 'error'; - this.dispatchEvent(error); - }); - worker.on('exit', () => { - this.dispatchEvent(new Event('close')); - }); - } - postMessage(data, transferList) { - this[WORKER].postMessage(data, transferList); - } - terminate() { - this[WORKER].terminate(); - } - } - Worker.prototype.onmessage = Worker.prototype.onerror = Worker.prototype.onclose = null; - return Worker; +function requireLib () { + if (hasRequiredLib) return lib; + hasRequiredLib = 1; + (function (exports) { + var __importDefault = (lib && lib.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.MerkleTree = exports.simpleHash = exports.PartialMerkleTree = void 0; + const FixedMerkleTree_1 = __importDefault(/*@__PURE__*/ requireFixedMerkleTree()); + Object.defineProperty(exports, "MerkleTree", { enumerable: true, get: function () { return FixedMerkleTree_1.default; } }); + var PartialMerkleTree_1 = /*@__PURE__*/ requirePartialMerkleTree(); + Object.defineProperty(exports, "PartialMerkleTree", { enumerable: true, get: function () { return PartialMerkleTree_1.PartialMerkleTree; } }); + var simpleHash_1 = /*@__PURE__*/ requireSimpleHash(); + Object.defineProperty(exports, "simpleHash", { enumerable: true, get: function () { return simpleHash_1.simpleHash; } }); + exports.default = FixedMerkleTree_1.default; + } (lib)); + return lib; } -function workerThread() { - let { mod, name, type } = threads.workerData; - if (!mod) return mainThread(); - - // turn global into a mock WorkerGlobalScope - const self = global.self = global; - - // enqueue messages to dispatch after modules are loaded - let q = []; - function flush() { - const buffered = q; - q = null; - buffered.forEach(event => { self.dispatchEvent(event); }); - } - threads.parentPort.on('message', data => { - const event = new Event('message'); - event.data = data; - if (q == null) self.dispatchEvent(event); - else q.push(event); - }); - threads.parentPort.on('error', err => { - err.type = 'Error'; - self.dispatchEvent(err); - }); - - class WorkerGlobalScope extends EventTarget { - postMessage(data, transferList) { - threads.parentPort.postMessage(data, transferList); - } - // Emulates https://developer.mozilla.org/en-US/docs/Web/API/DedicatedWorkerGlobalScope/close - close() { - process.exit(); - } - } - let proto = Object.getPrototypeOf(global); - delete proto.constructor; - Object.defineProperties(WorkerGlobalScope.prototype, proto); - proto = Object.setPrototypeOf(global, new WorkerGlobalScope()); - ['postMessage', 'addEventListener', 'removeEventListener', 'dispatchEvent'].forEach(fn => { - proto[fn] = proto[fn].bind(global); - }); - global.name = name; - - const isDataUrl = /^data:/.test(mod); - if (type === 'module') { - import(mod) - .catch(err => { - if (isDataUrl && err.message === 'Not supported') { - console.warn('Worker(): Importing data: URLs requires Node 12.10+. Falling back to classic worker.'); - return evaluateDataUrl(mod, name); - } - console.error(err); - }) - .then(flush); - } - else { - try { - if (/^data:/.test(mod)) { - evaluateDataUrl(mod, name); - } - else { - require(mod); - } - } - catch (err) { - console.error(err); - } - Promise.resolve().then(flush); - } -} - -function evaluateDataUrl(url, name) { - const { data } = parseDataUrl(url); - return VM.runInThisContext(data, { - filename: 'worker.<'+(name || 'data:')+'>' - }); -} - -function parseDataUrl(url) { - let [m, type, encoding, data] = url.match(/^data: *([^;,]*)(?: *; *([^,]*))? *,(.*)$/) || []; - if (!m) throw Error('Invalid Data URL.'); - if (encoding) switch (encoding.toLowerCase()) { - case 'base64': - data = Buffer.from(data, 'base64').toString(); - break; - default: - throw Error('Unknown Data URL encoding "' + encoding + '"'); - } - return { type, data }; -} - -/* global navigator, WebAssembly */ -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ - -// const MEM_SIZE = 1000; // Memory size in 64K Pakes (512Mb) -const MEM_SIZE = 25; // Memory size in 64K Pakes (1600Kb) - -class Deferred { - constructor() { - this.promise = new Promise((resolve, reject)=> { - this.reject = reject; - this.resolve = resolve; - }); - } -} - -function sleep(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); -} - -function stringToBase64(str) { - if (process.browser) { - return globalThis.btoa(str); - } else { - return Buffer.from(str).toString("base64"); - } -} - -const threadSource = stringToBase64("(" + thread.toString() + ")(self)"); -const workerSource = "data:application/javascript;base64," + threadSource; - - - -async function buildThreadManager(wasm, singleThread) { - const tm = new ThreadManager(); - - tm.memory = new WebAssembly.Memory({initial:MEM_SIZE}); - tm.u8 = new Uint8Array(tm.memory.buffer); - tm.u32 = new Uint32Array(tm.memory.buffer); - - const wasmModule = await WebAssembly.compile(wasm.code); - - tm.instance = await WebAssembly.instantiate(wasmModule, { - env: { - "memory": tm.memory - } - }); - - tm.singleThread = singleThread; - tm.initalPFree = tm.u32[0]; // Save the Pointer to free space. - tm.pq = wasm.pq; - tm.pr = wasm.pr; - tm.pG1gen = wasm.pG1gen; - tm.pG1zero = wasm.pG1zero; - tm.pG2gen = wasm.pG2gen; - tm.pG2zero = wasm.pG2zero; - tm.pOneT = wasm.pOneT; - - // tm.pTmp0 = tm.alloc(curve.G2.F.n8*3); - // tm.pTmp1 = tm.alloc(curve.G2.F.n8*3); - - - if (singleThread) { - tm.code = wasm.code; - tm.taskManager = thread(); - await tm.taskManager([{ - cmd: "INIT", - init: MEM_SIZE, - code: tm.code.slice() - }]); - tm.concurrency = 1; - } else { - tm.workers = []; - tm.pendingDeferreds = []; - tm.working = []; - - let concurrency; - - if ((typeof(navigator) === "object") && navigator.hardwareConcurrency) { - concurrency = navigator.hardwareConcurrency; - } else { - concurrency = os.cpus().length; - } - - if(concurrency == 0){ - concurrency = 2; - } - - // Limit to 64 threads for memory reasons. - if (concurrency>64) concurrency=64; - tm.concurrency = concurrency; - - for (let i = 0; i 0); i++) { - if (this.working[i] == false) { - const work = this.actionQueue.shift(); - this.postAction(i, work.data, work.transfers, work.deferred); - } - } - } - - queueAction(actionData, transfers) { - const d = new Deferred(); - - if (this.singleThread) { - const res = this.taskManager(actionData); - d.resolve(res); - } else { - this.actionQueue.push({ - data: actionData, - transfers: transfers, - deferred: d - }); - this.processWorks(); - } - return d.promise; - } - - resetMemory() { - this.u32[0] = this.initalPFree; - } - - allocBuff(buff) { - const pointer = this.alloc(buff.byteLength); - this.setBuff(pointer, buff); - return pointer; - } - - getBuff(pointer, length) { - return this.u8.slice(pointer, pointer+ length); - } - - setBuff(pointer, buffer) { - this.u8.set(new Uint8Array(buffer), pointer); - } - - alloc(length) { - while (this.u32[0] & 3) this.u32[0]++; // Return always aligned pointers - const res = this.u32[0]; - this.u32[0] += length; - return res; - } - - async terminate() { - for (let i=0; i=0; i--) { - if (!G.isZero(res)) { - for (let j=0; jMAX_CHUNK_SIZE) chunkSize = MAX_CHUNK_SIZE; - if (chunkSize { - if (logger) logger.debug(`Multiexp end: ${logText}: ${i}/${nPoints}`); - return r; - })); - } - - const result = await Promise.all(opPromises); - - let res = G.zero; - for (let i=result.length-1; i>=0; i--) { - res = G.add(res, result[i]); - } - - return res; - } - - G.multiExp = async function multiExpAffine(buffBases, buffScalars, logger, logText) { - return await _multiExp(buffBases, buffScalars, "jacobian", logger, logText); - }; - G.multiExpAffine = async function multiExpAffine(buffBases, buffScalars, logger, logText) { - return await _multiExp(buffBases, buffScalars, "affine", logger, logText); - }; -} - -function buildFFT(curve, groupName) { - const G = curve[groupName]; - const Fr = curve.Fr; - const tm = G.tm; - async function _fft(buff, inverse, inType, outType, logger, loggerTxt) { - - inType = inType || "affine"; - outType = outType || "affine"; - const MAX_BITS_THREAD = 14; - - let sIn, sMid, sOut, fnIn2Mid, fnMid2Out, fnFFTMix, fnFFTJoin, fnFFTFinal; - if (groupName == "G1") { - if (inType == "affine") { - sIn = G.F.n8*2; - fnIn2Mid = "g1m_batchToJacobian"; - } else { - sIn = G.F.n8*3; - } - sMid = G.F.n8*3; - if (inverse) { - fnFFTFinal = "g1m_fftFinal"; - } - fnFFTJoin = "g1m_fftJoin"; - fnFFTMix = "g1m_fftMix"; - - if (outType == "affine") { - sOut = G.F.n8*2; - fnMid2Out = "g1m_batchToAffine"; - } else { - sOut = G.F.n8*3; - } - - } else if (groupName == "G2") { - if (inType == "affine") { - sIn = G.F.n8*2; - fnIn2Mid = "g2m_batchToJacobian"; - } else { - sIn = G.F.n8*3; - } - sMid = G.F.n8*3; - if (inverse) { - fnFFTFinal = "g2m_fftFinal"; - } - fnFFTJoin = "g2m_fftJoin"; - fnFFTMix = "g2m_fftMix"; - if (outType == "affine") { - sOut = G.F.n8*2; - fnMid2Out = "g2m_batchToAffine"; - } else { - sOut = G.F.n8*3; - } - } else if (groupName == "Fr") { - sIn = G.n8; - sMid = G.n8; - sOut = G.n8; - if (inverse) { - fnFFTFinal = "frm_fftFinal"; - } - fnFFTMix = "frm_fftMix"; - fnFFTJoin = "frm_fftJoin"; - } - - - let returnArray = false; - if (Array.isArray(buff)) { - buff = array2buffer(buff, sIn); - returnArray = true; - } else { - buff = buff.slice(0, buff.byteLength); - } - - const nPoints = buff.byteLength / sIn; - const bits = log2(nPoints); - - if ((1 << bits) != nPoints) { - throw new Error("fft must be multiple of 2" ); - } - - if (bits == Fr.s +1) { - let buffOut; - - if (inverse) { - buffOut = await _fftExtInv(buff, inType, outType, logger, loggerTxt); - } else { - buffOut = await _fftExt(buff, inType, outType, logger, loggerTxt); - } - - if (returnArray) { - return buffer2array(buffOut, sOut); - } else { - return buffOut; - } - } - - let inv; - if (inverse) { - inv = Fr.inv(Fr.e(nPoints)); - } - - let buffOut; - - buffReverseBits(buff, sIn); - - let chunks; - let pointsInChunk = Math.min(1 << MAX_BITS_THREAD, nPoints); - let nChunks = nPoints / pointsInChunk; - - while ((nChunks < tm.concurrency)&&(pointsInChunk>=16)) { - nChunks *= 2; - pointsInChunk /= 2; - } - - const l2Chunk = log2(pointsInChunk); - - const promises = []; - for (let i = 0; i< nChunks; i++) { - if (logger) logger.debug(`${loggerTxt}: fft ${bits} mix start: ${i}/${nChunks}`); - const task = []; - task.push({cmd: "ALLOC", var: 0, len: sMid*pointsInChunk}); - const buffChunk = buff.slice( (pointsInChunk * i)*sIn, (pointsInChunk * (i+1))*sIn); - task.push({cmd: "SET", var: 0, buff: buffChunk}); - if (fnIn2Mid) { - task.push({cmd: "CALL", fnName:fnIn2Mid, params: [{var:0}, {val: pointsInChunk}, {var: 0}]}); - } - for (let j=1; j<=l2Chunk;j++) { - task.push({cmd: "CALL", fnName:fnFFTMix, params: [{var:0}, {val: pointsInChunk}, {val: j}]}); - } - - if (l2Chunk==bits) { - if (fnFFTFinal) { - task.push({cmd: "ALLOCSET", var: 1, buff: inv}); - task.push({cmd: "CALL", fnName: fnFFTFinal, params:[ - {var: 0}, - {val: pointsInChunk}, - {var: 1}, - ]}); - } - if (fnMid2Out) { - task.push({cmd: "CALL", fnName:fnMid2Out, params: [{var:0}, {val: pointsInChunk}, {var: 0}]}); - } - task.push({cmd: "GET", out: 0, var: 0, len: pointsInChunk*sOut}); - } else { - task.push({cmd: "GET", out:0, var: 0, len: sMid*pointsInChunk}); - } - promises.push(tm.queueAction(task).then( (r) => { - if (logger) logger.debug(`${loggerTxt}: fft ${bits} mix end: ${i}/${nChunks}`); - return r; - })); - } - - chunks = await Promise.all(promises); - for (let i = 0; i< nChunks; i++) chunks[i] = chunks[i][0]; - - for (let i = l2Chunk+1; i<=bits; i++) { - if (logger) logger.debug(`${loggerTxt}: fft ${bits} join: ${i}/${bits}`); - const nGroups = 1 << (bits - i); - const nChunksPerGroup = nChunks / nGroups; - const opPromises = []; - for (let j=0; j { - if (logger) logger.debug(`${loggerTxt}: fft ${bits} join ${i}/${bits} ${j+1}/${nGroups} ${k}/${nChunksPerGroup/2}`); - return r; - })); - } - } - - const res = await Promise.all(opPromises); - for (let j=0; j0; i--) { - buffOut.set(chunks[i], p); - p += pointsInChunk*sOut; - delete chunks[i]; // Liberate mem - } - buffOut.set(chunks[0].slice(0, (pointsInChunk-1)*sOut), p); - delete chunks[0]; - } else { - for (let i=0; i (1<<28)) { - buffOut = new BigBuffer(res1[0].byteLength*2); - } else { - buffOut = new Uint8Array(res1[0].byteLength*2); - } - - buffOut.set(res1[0]); - buffOut.set(res1[1], res1[0].byteLength); - - return buffOut; - } - - async function _fftExtInv(buff, inType, outType, logger, loggerTxt) { - let b1, b2; - b1 = buff.slice( 0 , buff.byteLength/2); - b2 = buff.slice( buff.byteLength/2, buff.byteLength); - - const promises = []; - - promises.push( _fft(b1, true, inType, "jacobian", logger, loggerTxt)); - promises.push( _fft(b2, true, inType, "jacobian", logger, loggerTxt)); - - [b1, b2] = await Promise.all(promises); - - const res1 = await _fftJoinExt(b1, b2, "fftJoinExtInv", Fr.one, Fr.shiftInv, "jacobian", outType, logger, loggerTxt); - - let buffOut; - if (res1[0].byteLength > (1<<28)) { - buffOut = new BigBuffer(res1[0].byteLength*2); - } else { - buffOut = new Uint8Array(res1[0].byteLength*2); - } - - buffOut.set(res1[0]); - buffOut.set(res1[1], res1[0].byteLength); - - return buffOut; - } - - - async function _fftJoinExt(buff1, buff2, fn, first, inc, inType, outType, logger, loggerTxt) { - const MAX_CHUNK_SIZE = 1<<16; - const MIN_CHUNK_SIZE = 1<<4; - - let fnName; - let fnIn2Mid, fnMid2Out; - let sOut, sIn, sMid; - - if (groupName == "G1") { - if (inType == "affine") { - sIn = G.F.n8*2; - fnIn2Mid = "g1m_batchToJacobian"; - } else { - sIn = G.F.n8*3; - } - sMid = G.F.n8*3; - fnName = "g1m_"+fn; - if (outType == "affine") { - fnMid2Out = "g1m_batchToAffine"; - sOut = G.F.n8*2; - } else { - sOut = G.F.n8*3; - } - } else if (groupName == "G2") { - if (inType == "affine") { - sIn = G.F.n8*2; - fnIn2Mid = "g2m_batchToJacobian"; - } else { - sIn = G.F.n8*3; - } - fnName = "g2m_"+fn; - sMid = G.F.n8*3; - if (outType == "affine") { - fnMid2Out = "g2m_batchToAffine"; - sOut = G.F.n8*2; - } else { - sOut = G.F.n8*3; - } - } else if (groupName == "Fr") { - sIn = Fr.n8; - sOut = Fr.n8; - sMid = Fr.n8; - fnName = "frm_" + fn; - } else { - throw new Error("Invalid group"); - } - - if (buff1.byteLength != buff2.byteLength) { - throw new Error("Invalid buffer size"); - } - const nPoints = Math.floor(buff1.byteLength / sIn); - if (nPoints != 1 << log2(nPoints)) { - throw new Error("Invalid number of points"); - } - - let chunkSize = Math.floor(nPoints /tm.concurrency); - if (chunkSize < MIN_CHUNK_SIZE) chunkSize = MIN_CHUNK_SIZE; - if (chunkSize > MAX_CHUNK_SIZE) chunkSize = MAX_CHUNK_SIZE; - - const opPromises = []; - - for (let i=0; i { - if (logger) logger.debug(`${loggerTxt}: fftJoinExt End: ${i}/${nPoints}`); - return r; - }) - ); - } - - const result = await Promise.all(opPromises); - - let fullBuffOut1; - let fullBuffOut2; - if (nPoints * sOut > 1<<28) { - fullBuffOut1 = new BigBuffer(nPoints*sOut); - fullBuffOut2 = new BigBuffer(nPoints*sOut); - } else { - fullBuffOut1 = new Uint8Array(nPoints*sOut); - fullBuffOut2 = new Uint8Array(nPoints*sOut); - } - - let p =0; - for (let i=0; i Fr.s+1) { - if (logger) logger.error("lagrangeEvaluations input too big"); - throw new Error("lagrangeEvaluations input too big"); - } - - let t0 = buff.slice(0, buff.byteLength/2); - let t1 = buff.slice(buff.byteLength/2, buff.byteLength); - - - const shiftToSmallM = Fr.exp(Fr.shift, nPoints/2); - const sConst = Fr.inv( Fr.sub(Fr.one, shiftToSmallM)); - - [t0, t1] = await _fftJoinExt(t0, t1, "prepareLagrangeEvaluation", sConst, Fr.shiftInv, inType, "jacobian", logger, loggerTxt + " prep"); - - const promises = []; - - promises.push( _fft(t0, true, "jacobian", outType, logger, loggerTxt + " t0")); - promises.push( _fft(t1, true, "jacobian", outType, logger, loggerTxt + " t1")); - - [t0, t1] = await Promise.all(promises); - - let buffOut; - if (t0.byteLength > (1<<28)) { - buffOut = new BigBuffer(t0.byteLength*2); - } else { - buffOut = new Uint8Array(t0.byteLength*2); - } - - buffOut.set(t0); - buffOut.set(t1, t0.byteLength); - - return buffOut; - }; - - G.fftMix = async function fftMix(buff) { - const sG = G.F.n8*3; - let fnName, fnFFTJoin; - if (groupName == "G1") { - fnName = "g1m_fftMix"; - fnFFTJoin = "g1m_fftJoin"; - } else if (groupName == "G2") { - fnName = "g2m_fftMix"; - fnFFTJoin = "g2m_fftJoin"; - } else if (groupName == "Fr") { - fnName = "frm_fftMix"; - fnFFTJoin = "frm_fftJoin"; - } else { - throw new Error("Invalid group"); - } - - const nPoints = Math.floor(buff.byteLength / sG); - const power = log2(nPoints); - - let nChunks = 1 << log2(tm.concurrency); - - if (nPoints <= nChunks*2) nChunks = 1; - - const pointsPerChunk = nPoints / nChunks; - - const powerChunk = log2(pointsPerChunk); - - const opPromises = []; - for (let i=0; i=0; i--) { - fullBuffOut.set(result[i][0], p); - p+=result[i][0].byteLength; - } - - return fullBuffOut; - }; -} - -async function buildEngine(params) { - - const tm = await buildThreadManager(params.wasm, params.singleThread); - - - const curve = {}; - - curve.q = e(params.wasm.q); - curve.r = e(params.wasm.r); - curve.name = params.name; - curve.tm = tm; - curve.prePSize = params.wasm.prePSize; - curve.preQSize = params.wasm.preQSize; - curve.Fr = new WasmField1(tm, "frm", params.n8r, params.r); - curve.F1 = new WasmField1(tm, "f1m", params.n8q, params.q); - curve.F2 = new WasmField2(tm, "f2m", curve.F1); - curve.G1 = new WasmCurve(tm, "g1m", curve.F1, params.wasm.pG1gen, params.wasm.pG1b, params.cofactorG1); - curve.G2 = new WasmCurve(tm, "g2m", curve.F2, params.wasm.pG2gen, params.wasm.pG2b, params.cofactorG2); - curve.F6 = new WasmField3(tm, "f6m", curve.F2); - curve.F12 = new WasmField2(tm, "ftm", curve.F6); - - curve.Gt = curve.F12; - - buildBatchApplyKey(curve, "G1"); - buildBatchApplyKey(curve, "G2"); - buildBatchApplyKey(curve, "Fr"); - - buildMultiexp(curve, "G1"); - buildMultiexp(curve, "G2"); - - buildFFT(curve, "G1"); - buildFFT(curve, "G2"); - buildFFT(curve, "Fr"); - - buildPairing(curve); - - curve.array2buffer = function(arr, sG) { - const buff = new Uint8Array(sG*arr.length); - - for (let i=0; i. -*/ - -const bigInt = BigIntegerExports; - -function toNumber(n) { - let v; - if (typeof n=="string") { - if (n.slice(0,2).toLowerCase() == "0x") { - v = bigInt(n.slice(2),16); - } else { - v = bigInt(n); - } - } else { - v = bigInt(n); - } - return v; -} - -function u32(n) { - const b = []; - const v = toNumber(n); - b.push(v.and(0xFF).toJSNumber()); - b.push(v.shiftRight(8).and(0xFF).toJSNumber()); - b.push(v.shiftRight(16).and(0xFF).toJSNumber()); - b.push(v.shiftRight(24).and(0xFF).toJSNumber()); - return b; -} - -function u64(n) { - const b = []; - const v = toNumber(n); - b.push(v.and(0xFF).toJSNumber()); - b.push(v.shiftRight(8).and(0xFF).toJSNumber()); - b.push(v.shiftRight(16).and(0xFF).toJSNumber()); - b.push(v.shiftRight(24).and(0xFF).toJSNumber()); - b.push(v.shiftRight(32).and(0xFF).toJSNumber()); - b.push(v.shiftRight(40).and(0xFF).toJSNumber()); - b.push(v.shiftRight(48).and(0xFF).toJSNumber()); - b.push(v.shiftRight(56).and(0xFF).toJSNumber()); - return b; -} - -function toUTF8Array(str) { - var utf8 = []; - for (var i=0; i < str.length; i++) { - var charcode = str.charCodeAt(i); - if (charcode < 0x80) utf8.push(charcode); - else if (charcode < 0x800) { - utf8.push(0xc0 | (charcode >> 6), - 0x80 | (charcode & 0x3f)); - } - else if (charcode < 0xd800 || charcode >= 0xe000) { - utf8.push(0xe0 | (charcode >> 12), - 0x80 | ((charcode>>6) & 0x3f), - 0x80 | (charcode & 0x3f)); - } - // surrogate pair - else { - i++; - // UTF-16 encodes 0x10000-0x10FFFF by - // subtracting 0x10000 and splitting the - // 20 bits of 0x0-0xFFFFF into two halves - charcode = 0x10000 + (((charcode & 0x3ff)<<10) - | (str.charCodeAt(i) & 0x3ff)); - utf8.push(0xf0 | (charcode >>18), - 0x80 | ((charcode>>12) & 0x3f), - 0x80 | ((charcode>>6) & 0x3f), - 0x80 | (charcode & 0x3f)); - } - } - return utf8; -} - -function string(str) { - const bytes = toUTF8Array(str); - return [ ...varuint32(bytes.length), ...bytes ]; -} - -function varuint(n) { - const code = []; - let v = toNumber(n); - if (v.isNegative()) throw new Error("Number cannot be negative"); - while (!v.isZero()) { - code.push(v.and(0x7F).toJSNumber()); - v = v.shiftRight(7); - } - if (code.length==0) code.push(0); - for (let i=0; i. -*/ - -const utils$2 = utils$3; - -let CodeBuilder$1 = class CodeBuilder { - constructor(func) { - this.func = func; - this.functionName = func.functionName; - this.module = func.module; - } - - setLocal(localName, valCode) { - const idx = this.func.localIdxByName[localName]; - if (idx === undefined) - throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${localName} `); - return [...valCode, 0x21, ...utils$2.varuint32( idx )]; - } - - teeLocal(localName, valCode) { - const idx = this.func.localIdxByName[localName]; - if (idx === undefined) - throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${localName} `); - return [...valCode, 0x22, ...utils$2.varuint32( idx )]; - } - - getLocal(localName) { - const idx = this.func.localIdxByName[localName]; - if (idx === undefined) - throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${localName} `); - return [0x20, ...utils$2.varuint32( idx )]; - } - - i64_load8_s(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 0 : _align; // 8 bits alignment by default - return [...idxCode, 0x30, align, ...utils$2.varuint32(offset)]; - } - - i64_load8_u(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 0 : _align; // 8 bits alignment by default - return [...idxCode, 0x31, align, ...utils$2.varuint32(offset)]; - } - - i64_load16_s(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 1 : _align; // 16 bits alignment by default - return [...idxCode, 0x32, align, ...utils$2.varuint32(offset)]; - } - - i64_load16_u(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 1 : _align; // 16 bits alignment by default - return [...idxCode, 0x33, align, ...utils$2.varuint32(offset)]; - } - - i64_load32_s(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 2 : _align; // 32 bits alignment by default - return [...idxCode, 0x34, align, ...utils$2.varuint32(offset)]; - } - - i64_load32_u(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 2 : _align; // 32 bits alignment by default - return [...idxCode, 0x35, align, ...utils$2.varuint32(offset)]; - } - - i64_load(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 3 : _align; // 64 bits alignment by default - return [...idxCode, 0x29, align, ...utils$2.varuint32(offset)]; - } - - - i64_store(idxCode, _offset, _align, _codeVal) { - let offset, align, codeVal; - if (Array.isArray(_offset)) { - offset = 0; - align = 3; - codeVal = _offset; - } else if (Array.isArray(_align)) { - offset = _offset; - align = 3; - codeVal = _align; - } else if (Array.isArray(_codeVal)) { - offset = _offset; - align = _align; - codeVal = _codeVal; - } - return [...idxCode, ...codeVal, 0x37, align, ...utils$2.varuint32(offset)]; - } - - i64_store32(idxCode, _offset, _align, _codeVal) { - let offset, align, codeVal; - if (Array.isArray(_offset)) { - offset = 0; - align = 2; - codeVal = _offset; - } else if (Array.isArray(_align)) { - offset = _offset; - align = 2; - codeVal = _align; - } else if (Array.isArray(_codeVal)) { - offset = _offset; - align = _align; - codeVal = _codeVal; - } - return [...idxCode, ...codeVal, 0x3e, align, ...utils$2.varuint32(offset)]; - } - - - i64_store16(idxCode, _offset, _align, _codeVal) { - let offset, align, codeVal; - if (Array.isArray(_offset)) { - offset = 0; - align = 1; - codeVal = _offset; - } else if (Array.isArray(_align)) { - offset = _offset; - align = 1; - codeVal = _align; - } else if (Array.isArray(_codeVal)) { - offset = _offset; - align = _align; - codeVal = _codeVal; - } - return [...idxCode, ...codeVal, 0x3d, align, ...utils$2.varuint32(offset)]; - } - - - i64_store8(idxCode, _offset, _align, _codeVal) { - let offset, align, codeVal; - if (Array.isArray(_offset)) { - offset = 0; - align = 0; - codeVal = _offset; - } else if (Array.isArray(_align)) { - offset = _offset; - align = 0; - codeVal = _align; - } else if (Array.isArray(_codeVal)) { - offset = _offset; - align = _align; - codeVal = _codeVal; - } - return [...idxCode, ...codeVal, 0x3c, align, ...utils$2.varuint32(offset)]; - } - - i32_load8_s(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 0 : _align; // 32 bits alignment by default - return [...idxCode, 0x2c, align, ...utils$2.varuint32(offset)]; - } - - i32_load8_u(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 0 : _align; // 32 bits alignment by default - return [...idxCode, 0x2d, align, ...utils$2.varuint32(offset)]; - } - - i32_load16_s(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 1 : _align; // 32 bits alignment by default - return [...idxCode, 0x2e, align, ...utils$2.varuint32(offset)]; - } - - i32_load16_u(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 1 : _align; // 32 bits alignment by default - return [...idxCode, 0x2f, align, ...utils$2.varuint32(offset)]; - } - - i32_load(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 2 : _align; // 32 bits alignment by default - return [...idxCode, 0x28, align, ...utils$2.varuint32(offset)]; - } - - i32_store(idxCode, _offset, _align, _codeVal) { - let offset, align, codeVal; - if (Array.isArray(_offset)) { - offset = 0; - align = 2; - codeVal = _offset; - } else if (Array.isArray(_align)) { - offset = _offset; - align = 2; - codeVal = _align; - } else if (Array.isArray(_codeVal)) { - offset = _offset; - align = _align; - codeVal = _codeVal; - } - return [...idxCode, ...codeVal, 0x36, align, ...utils$2.varuint32(offset)]; - } - - - i32_store16(idxCode, _offset, _align, _codeVal) { - let offset, align, codeVal; - if (Array.isArray(_offset)) { - offset = 0; - align = 1; - codeVal = _offset; - } else if (Array.isArray(_align)) { - offset = _offset; - align = 1; - codeVal = _align; - } else if (Array.isArray(_codeVal)) { - offset = _offset; - align = _align; - codeVal = _codeVal; - } - return [...idxCode, ...codeVal, 0x3b, align, ...utils$2.varuint32(offset)]; - } - - i32_store8(idxCode, _offset, _align, _codeVal) { - let offset, align, codeVal; - if (Array.isArray(_offset)) { - offset = 0; - align = 0; - codeVal = _offset; - } else if (Array.isArray(_align)) { - offset = _offset; - align = 0; - codeVal = _align; - } else if (Array.isArray(_codeVal)) { - offset = _offset; - align = _align; - codeVal = _codeVal; - } - return [...idxCode, ...codeVal, 0x3a, align, ...utils$2.varuint32(offset)]; - } - - call(fnName, ...args) { - const idx = this.module.functionIdxByName[fnName]; - if (idx === undefined) - throw new Error(`Function not defined: Function: ${fnName}`); - return [...[].concat(...args), 0x10, ...utils$2.varuint32(idx)]; - } - - call_indirect(fnIdx, ...args) { - return [...[].concat(...args), ...fnIdx, 0x11, 0, 0]; - } - - if(condCode, thenCode, elseCode) { - if (elseCode) { - return [...condCode, 0x04, 0x40, ...thenCode, 0x05, ...elseCode, 0x0b]; - } else { - return [...condCode, 0x04, 0x40, ...thenCode, 0x0b]; - } - } - - block(bCode) { return [0x02, 0x40, ...bCode, 0x0b]; } - loop(...args) { - return [0x03, 0x40, ...[].concat(...[...args]), 0x0b]; - } - br_if(relPath, condCode) { return [...condCode, 0x0d, ...utils$2.varuint32(relPath)]; } - br(relPath) { return [0x0c, ...utils$2.varuint32(relPath)]; } - ret(rCode) { return [...rCode, 0x0f]; } - drop(dCode) { return [...dCode, 0x1a]; } - - i64_const(num) { return [0x42, ...utils$2.varint64(num)]; } - i32_const(num) { return [0x41, ...utils$2.varint32(num)]; } - - - i64_eqz(opcode) { return [...opcode, 0x50]; } - i64_eq(op1code, op2code) { return [...op1code, ...op2code, 0x51]; } - i64_ne(op1code, op2code) { return [...op1code, ...op2code, 0x52]; } - i64_lt_s(op1code, op2code) { return [...op1code, ...op2code, 0x53]; } - i64_lt_u(op1code, op2code) { return [...op1code, ...op2code, 0x54]; } - i64_gt_s(op1code, op2code) { return [...op1code, ...op2code, 0x55]; } - i64_gt_u(op1code, op2code) { return [...op1code, ...op2code, 0x56]; } - i64_le_s(op1code, op2code) { return [...op1code, ...op2code, 0x57]; } - i64_le_u(op1code, op2code) { return [...op1code, ...op2code, 0x58]; } - i64_ge_s(op1code, op2code) { return [...op1code, ...op2code, 0x59]; } - i64_ge_u(op1code, op2code) { return [...op1code, ...op2code, 0x5a]; } - i64_add(op1code, op2code) { return [...op1code, ...op2code, 0x7c]; } - i64_sub(op1code, op2code) { return [...op1code, ...op2code, 0x7d]; } - i64_mul(op1code, op2code) { return [...op1code, ...op2code, 0x7e]; } - i64_div_s(op1code, op2code) { return [...op1code, ...op2code, 0x7f]; } - i64_div_u(op1code, op2code) { return [...op1code, ...op2code, 0x80]; } - i64_rem_s(op1code, op2code) { return [...op1code, ...op2code, 0x81]; } - i64_rem_u(op1code, op2code) { return [...op1code, ...op2code, 0x82]; } - i64_and(op1code, op2code) { return [...op1code, ...op2code, 0x83]; } - i64_or(op1code, op2code) { return [...op1code, ...op2code, 0x84]; } - i64_xor(op1code, op2code) { return [...op1code, ...op2code, 0x85]; } - i64_shl(op1code, op2code) { return [...op1code, ...op2code, 0x86]; } - i64_shr_s(op1code, op2code) { return [...op1code, ...op2code, 0x87]; } - i64_shr_u(op1code, op2code) { return [...op1code, ...op2code, 0x88]; } - i64_extend_i32_s(op1code) { return [...op1code, 0xac]; } - i64_extend_i32_u(op1code) { return [...op1code, 0xad]; } - i64_clz(op1code) { return [...op1code, 0x79]; } - i64_ctz(op1code) { return [...op1code, 0x7a]; } - - i32_eqz(op1code) { return [...op1code, 0x45]; } - i32_eq(op1code, op2code) { return [...op1code, ...op2code, 0x46]; } - i32_ne(op1code, op2code) { return [...op1code, ...op2code, 0x47]; } - i32_lt_s(op1code, op2code) { return [...op1code, ...op2code, 0x48]; } - i32_lt_u(op1code, op2code) { return [...op1code, ...op2code, 0x49]; } - i32_gt_s(op1code, op2code) { return [...op1code, ...op2code, 0x4a]; } - i32_gt_u(op1code, op2code) { return [...op1code, ...op2code, 0x4b]; } - i32_le_s(op1code, op2code) { return [...op1code, ...op2code, 0x4c]; } - i32_le_u(op1code, op2code) { return [...op1code, ...op2code, 0x4d]; } - i32_ge_s(op1code, op2code) { return [...op1code, ...op2code, 0x4e]; } - i32_ge_u(op1code, op2code) { return [...op1code, ...op2code, 0x4f]; } - i32_add(op1code, op2code) { return [...op1code, ...op2code, 0x6a]; } - i32_sub(op1code, op2code) { return [...op1code, ...op2code, 0x6b]; } - i32_mul(op1code, op2code) { return [...op1code, ...op2code, 0x6c]; } - i32_div_s(op1code, op2code) { return [...op1code, ...op2code, 0x6d]; } - i32_div_u(op1code, op2code) { return [...op1code, ...op2code, 0x6e]; } - i32_rem_s(op1code, op2code) { return [...op1code, ...op2code, 0x6f]; } - i32_rem_u(op1code, op2code) { return [...op1code, ...op2code, 0x70]; } - i32_and(op1code, op2code) { return [...op1code, ...op2code, 0x71]; } - i32_or(op1code, op2code) { return [...op1code, ...op2code, 0x72]; } - i32_xor(op1code, op2code) { return [...op1code, ...op2code, 0x73]; } - i32_shl(op1code, op2code) { return [...op1code, ...op2code, 0x74]; } - i32_shr_s(op1code, op2code) { return [...op1code, ...op2code, 0x75]; } - i32_shr_u(op1code, op2code) { return [...op1code, ...op2code, 0x76]; } - i32_rotl(op1code, op2code) { return [...op1code, ...op2code, 0x77]; } - i32_rotr(op1code, op2code) { return [...op1code, ...op2code, 0x78]; } - i32_wrap_i64(op1code) { return [...op1code, 0xa7]; } - i32_clz(op1code) { return [...op1code, 0x67]; } - i32_ctz(op1code) { return [...op1code, 0x68]; } - - unreachable() { return [ 0x0 ]; } - - current_memory() { return [ 0x3f, 0]; } - - comment() { return []; } -}; - -var codebuilder = CodeBuilder$1; - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmbuilder - - wasmbuilder is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmbuilder is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmbuilder. If not, see . -*/ - -const CodeBuilder = codebuilder; -const utils$1 = utils$3; - -const typeCodes = { - "i32": 0x7f, - "i64": 0x7e, - "f32": 0x7d, - "f64": 0x7c, - "anyfunc": 0x70, - "func": 0x60, - "emptyblock": 0x40 -}; - - -let FunctionBuilder$1 = class FunctionBuilder { - - constructor (module, fnName, fnType, moduleName, fieldName) { - if (fnType == "import") { - this.fnType = "import"; - this.moduleName = moduleName; - this.fieldName = fieldName; - } else if (fnType == "internal") { - this.fnType = "internal"; - } else { - throw new Error("Invalid function fnType: " + fnType); - } - this.module = module; - this.fnName = fnName; - this.params = []; - this.locals = []; - this.localIdxByName = {}; - this.code = []; - this.returnType = null; - this.nextLocal =0; - } - - addParam(paramName, paramType) { - if (this.localIdxByName[paramName]) - throw new Error(`param already exists. Function: ${this.fnName}, Param: ${paramName} `); - const idx = this.nextLocal++; - this.localIdxByName[paramName] = idx; - this.params.push({ - type: paramType - }); - } - - addLocal(localName, localType, _length) { - const length = _length || 1; - if (this.localIdxByName[localName]) - throw new Error(`local already exists. Function: ${this.fnName}, Param: ${localName} `); - const idx = this.nextLocal++; - this.localIdxByName[localName] = idx; - this.locals.push({ - type: localType, - length: length - }); - } - - setReturnType(returnType) { - if (this.returnType) - throw new Error(`returnType already defined. Function: ${this.fnName}`); - this.returnType = returnType; - } - - getSignature() { - const params = [...utils$1.varuint32(this.params.length), ...this.params.map((p) => typeCodes[p.type])]; - const returns = this.returnType ? [0x01, typeCodes[this.returnType]] : [0]; - return [0x60, ...params, ...returns]; - } - - getBody() { - const locals = this.locals.map((l) => [ - ...utils$1.varuint32(l.length), - typeCodes[l.type] - ]); - - const body = [ - ...utils$1.varuint32(this.locals.length), - ...[].concat(...locals), - ...this.code, - 0x0b - ]; - return [ - ...utils$1.varuint32(body.length), - ...body - ]; - } - - addCode(...code) { - this.code.push(...[].concat(...[...code])); - } - - getCodeBuilder() { - return new CodeBuilder(this); - } -}; - -var functionbuilder = FunctionBuilder$1; - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmbuilder - - wasmbuilder is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmbuilder is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmbuilder. If not, see . -*/ - -const FunctionBuilder = functionbuilder; -const utils = utils$3; - -let ModuleBuilder$1 = class ModuleBuilder { - - constructor() { - this.functions = []; - this.functionIdxByName = {}; - this.nImportFunctions = 0; - this.nInternalFunctions =0; - this.memory = { - pagesSize: 1, - moduleName: "env", - fieldName: "memory" - }; - this.free = 8; - this.datas = []; - this.modules = {}; - this.exports = []; - this.functionsTable = []; - } - - build() { - this._setSignatures(); - return new Uint8Array([ - ...utils.u32(0x6d736100), - ...utils.u32(1), - ...this._buildType(), - ...this._buildImport(), - ...this._buildFunctionDeclarations(), - ...this._buildFunctionsTable(), - ...this._buildExports(), - ...this._buildElements(), - ...this._buildCode(), - ...this._buildData() - ]); - } - - addFunction(fnName) { - if (typeof(this.functionIdxByName[fnName]) !== "undefined") - throw new Error(`Function already defined: ${fnName}`); - - const idx = this.functions.length; - this.functionIdxByName[fnName] = idx; - - this.functions.push(new FunctionBuilder(this, fnName, "internal")); - - this.nInternalFunctions++; - return this.functions[idx]; - } - - addIimportFunction(fnName, moduleName, _fieldName) { - if (typeof(this.functionIdxByName[fnName]) !== "undefined") - throw new Error(`Function already defined: ${fnName}`); - - if ( (this.functions.length>0) - &&(this.functions[this.functions.length-1].type == "internal")) - throw new Error(`Import functions must be declared before internal: ${fnName}`); - - let fieldName = _fieldName || fnName; - - const idx = this.functions.length; - this.functionIdxByName[fnName] = idx; - - this.functions.push(new FunctionBuilder(this, fnName, "import", moduleName, fieldName)); - - this.nImportFunctions ++; - return this.functions[idx]; - } - - setMemory(pagesSize, moduleName, fieldName) { - this.memory = { - pagesSize: pagesSize, - moduleName: moduleName || "env", - fieldName: fieldName || "memory" - }; - } - - exportFunction(fnName, _exportName) { - const exportName = _exportName || fnName; - if (typeof(this.functionIdxByName[fnName]) === "undefined") - throw new Error(`Function not defined: ${fnName}`); - const idx = this.functionIdxByName[fnName]; - if (exportName != fnName) { - this.functionIdxByName[exportName] = idx; - } - this.exports.push({ - exportName: exportName, - idx: idx - }); - } - - addFunctionToTable(fnName) { - const idx = this.functionIdxByName[fnName]; - this.functionsTable.push(idx); - } - - addData(offset, bytes) { - this.datas.push({ - offset: offset, - bytes: bytes - }); - } - - alloc(a, b) { - let size; - let bytes; - if ((Array.isArray(a) || ArrayBuffer.isView(a)) && (typeof(b) === "undefined")) { - size = a.length; - bytes = a; - } else { - size = a; - bytes = b; - } - size = (((size-1)>>3) +1)<<3; // Align to 64 bits. - const p = this.free; - this.free += size; - if (bytes) { - this.addData(p, bytes); - } - return p; - } - - allocString(s) { - const encoder = new globalThis.TextEncoder(); - const uint8array = encoder.encode(s); - return this.alloc([...uint8array, 0]); - } - - _setSignatures() { - this.signatures = []; - const signatureIdxByName = {}; - if (this.functionsTable.length>0) { - const signature = this.functions[this.functionsTable[0]].getSignature(); - const signatureName = "s_"+utils.toHexString(signature); - signatureIdxByName[signatureName] = 0; - this.signatures.push(signature); - } - for (let i=0; i. -*/ - -var ModuleBuilder = modulebuilder; - -globalThis.curve_bn128 = null; - -async function buildBn128(singleThread, plugins) { - - const moduleBuilder = new ModuleBuilder(); - moduleBuilder.setMemory(25); - buildBn128$1(moduleBuilder); - - if (plugins) plugins(moduleBuilder); - - const bn128wasm = {}; - - bn128wasm.code = moduleBuilder.build(); - bn128wasm.pq = moduleBuilder.modules.f1m.pq; - bn128wasm.pr = moduleBuilder.modules.frm.pq; - bn128wasm.pG1gen = moduleBuilder.modules.bn128.pG1gen; - bn128wasm.pG1zero = moduleBuilder.modules.bn128.pG1zero; - bn128wasm.pG1b = moduleBuilder.modules.bn128.pG1b; - bn128wasm.pG2gen = moduleBuilder.modules.bn128.pG2gen; - bn128wasm.pG2zero = moduleBuilder.modules.bn128.pG2zero; - bn128wasm.pG2b = moduleBuilder.modules.bn128.pG2b; - bn128wasm.pOneT = moduleBuilder.modules.bn128.pOneT; - bn128wasm.prePSize = moduleBuilder.modules.bn128.prePSize; - bn128wasm.preQSize = moduleBuilder.modules.bn128.preQSize; - bn128wasm.n8q = 32; - bn128wasm.n8r = 32; - bn128wasm.q = moduleBuilder.modules.bn128.q; - bn128wasm.r = moduleBuilder.modules.bn128.r; - - if ((!singleThread) && (globalThis.curve_bn128)) return globalThis.curve_bn128; - const params = { - name: "bn128", - wasm: bn128wasm, - q: e("21888242871839275222246405745257275088696311157297823662689037894645226208583"), - r: e("21888242871839275222246405745257275088548364400416034343698204186575808495617"), - n8q: 32, - n8r: 32, - cofactorG2: e("30644e72e131a029b85045b68181585e06ceecda572a2489345f2299c0f9fa8d", 16), - singleThread: singleThread ? true : false - }; - - const curve = await buildEngine(params); - curve.terminate = async function () { - if (!params.singleThread) { - globalThis.curve_bn128 = null; - await this.tm.terminate(); - } - }; - - if (!singleThread) { - globalThis.curve_bn128 = curve; - } - - return curve; -} - -globalThis.curve_bls12381 = null; - -async function buildBls12381(singleThread, plugins) { - - const moduleBuilder = new ModuleBuilder(); - moduleBuilder.setMemory(25); - buildBls12381$1(moduleBuilder); - - if (plugins) plugins(moduleBuilder); - - const bls12381wasm = {}; - - bls12381wasm.code = moduleBuilder.build(); - bls12381wasm.pq = moduleBuilder.modules.f1m.pq; - bls12381wasm.pr = moduleBuilder.modules.frm.pq; - bls12381wasm.pG1gen = moduleBuilder.modules.bls12381.pG1gen; - bls12381wasm.pG1zero = moduleBuilder.modules.bls12381.pG1zero; - bls12381wasm.pG1b = moduleBuilder.modules.bls12381.pG1b; - bls12381wasm.pG2gen = moduleBuilder.modules.bls12381.pG2gen; - bls12381wasm.pG2zero = moduleBuilder.modules.bls12381.pG2zero; - bls12381wasm.pG2b = moduleBuilder.modules.bls12381.pG2b; - bls12381wasm.pOneT = moduleBuilder.modules.bls12381.pOneT; - bls12381wasm.prePSize = moduleBuilder.modules.bls12381.prePSize; - bls12381wasm.preQSize = moduleBuilder.modules.bls12381.preQSize; - bls12381wasm.n8q = 48; - bls12381wasm.n8r = 32; - bls12381wasm.q = moduleBuilder.modules.bn128.q; - bls12381wasm.r = moduleBuilder.modules.bn128.r; - - - if ((!singleThread) && (globalThis.curve_bls12381)) return globalThis.curve_bls12381; - const params = { - name: "bls12381", - wasm: bls12381wasm, - q: e("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab", 16), - r: e("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001", 16), - n8q: 48, - n8r: 32, - cofactorG1: e("0x396c8c005555e1568c00aaab0000aaab", 16), - cofactorG2: e("0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5", 16), - singleThread: singleThread ? true : false - }; - - const curve = await buildEngine(params); - curve.terminate = async function () { - if (!params.singleThread) { - globalThis.curve_bls12381 = null; - await this.tm.terminate(); - } - }; - - if (!singleThread) { - globalThis.curve_bls12381 = curve; - } - - return curve; -} - -e("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001", 16); -e("21888242871839275222246405745257275088548364400416034343698204186575808495617"); - -e("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab", 16); -e("21888242871839275222246405745257275088696311157297823662689037894645226208583"); - -async function getCurveFromName(name, singleThread, plugins) { - let curve; - const normName = normalizeName(name); - if (["BN128", "BN254", "ALTBN128"].indexOf(normName) >= 0) { - curve = await buildBn128(singleThread, plugins); - } else if (["BLS12381"].indexOf(normName) >= 0) { - curve = await buildBls12381(singleThread, plugins); - } else { - throw new Error(`Curve not supported: ${name}`); - } - return curve; - - function normalizeName(n) { - return n.toUpperCase().match(/[A-Za-z0-9]+/g).join(""); - } - -} - -const Scalar=_Scalar; +var libExports = /*@__PURE__*/ requireLib(); const version$2 = "logger/5.7.0"; @@ -18867,9 +960,6 @@ function isHexString(value, length) { if (typeof (value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { return false; } - if (length && value.length !== 2 + 2 * length) { - return false; - } return true; } @@ -18884,651 +974,658 @@ var sha3$1 = {exports: {}}; * @license MIT */ -(function (module) { - /*jslint bitwise: true */ - (function () { +var hasRequiredSha3; - var INPUT_ERROR = 'input is invalid type'; - var FINALIZE_ERROR = 'finalize already called'; - var WINDOW = typeof window === 'object'; - var root = WINDOW ? window : {}; - if (root.JS_SHA3_NO_WINDOW) { - WINDOW = false; - } - var WEB_WORKER = !WINDOW && typeof self === 'object'; - var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node; - if (NODE_JS) { - root = commonjsGlobal; - } else if (WEB_WORKER) { - root = self; - } - var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && 'object' === 'object' && module.exports; - var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined'; - var HEX_CHARS = '0123456789abcdef'.split(''); - var SHAKE_PADDING = [31, 7936, 2031616, 520093696]; - var CSHAKE_PADDING = [4, 1024, 262144, 67108864]; - var KECCAK_PADDING = [1, 256, 65536, 16777216]; - var PADDING = [6, 1536, 393216, 100663296]; - var SHIFT = [0, 8, 16, 24]; - var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, - 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, - 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, - 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, - 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648]; - var BITS = [224, 256, 384, 512]; - var SHAKE_BITS = [128, 256]; - var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array', 'digest']; - var CSHAKE_BYTEPAD = { - '128': 168, - '256': 136 - }; +function requireSha3 () { + if (hasRequiredSha3) return sha3$1.exports; + hasRequiredSha3 = 1; + (function (module) { + /*jslint bitwise: true */ + (function () { - if (root.JS_SHA3_NO_NODE_JS || !Array.isArray) { - Array.isArray = function (obj) { - return Object.prototype.toString.call(obj) === '[object Array]'; - }; - } + var INPUT_ERROR = 'input is invalid type'; + var FINALIZE_ERROR = 'finalize already called'; + var WINDOW = typeof window === 'object'; + var root = WINDOW ? window : {}; + if (root.JS_SHA3_NO_WINDOW) { + WINDOW = false; + } + var WEB_WORKER = !WINDOW && typeof self === 'object'; + var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node; + if (NODE_JS) { + root = commonjsGlobal; + } else if (WEB_WORKER) { + root = self; + } + var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && 'object' === 'object' && module.exports; + var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined'; + var HEX_CHARS = '0123456789abcdef'.split(''); + var SHAKE_PADDING = [31, 7936, 2031616, 520093696]; + var CSHAKE_PADDING = [4, 1024, 262144, 67108864]; + var KECCAK_PADDING = [1, 256, 65536, 16777216]; + var PADDING = [6, 1536, 393216, 100663296]; + var SHIFT = [0, 8, 16, 24]; + var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, + 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, + 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, + 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, + 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648]; + var BITS = [224, 256, 384, 512]; + var SHAKE_BITS = [128, 256]; + var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array', 'digest']; + var CSHAKE_BYTEPAD = { + '128': 168, + '256': 136 + }; - if (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) { - ArrayBuffer.isView = function (obj) { - return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer; - }; - } + if (root.JS_SHA3_NO_NODE_JS || !Array.isArray) { + Array.isArray = function (obj) { + return Object.prototype.toString.call(obj) === '[object Array]'; + }; + } - var createOutputMethod = function (bits, padding, outputType) { - return function (message) { - return new Keccak(bits, padding, bits).update(message)[outputType](); - }; - }; + if (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) { + ArrayBuffer.isView = function (obj) { + return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer; + }; + } - var createShakeOutputMethod = function (bits, padding, outputType) { - return function (message, outputBits) { - return new Keccak(bits, padding, outputBits).update(message)[outputType](); - }; - }; + var createOutputMethod = function (bits, padding, outputType) { + return function (message) { + return new Keccak(bits, padding, bits).update(message)[outputType](); + }; + }; - var createCshakeOutputMethod = function (bits, padding, outputType) { - return function (message, outputBits, n, s) { - return methods['cshake' + bits].update(message, outputBits, n, s)[outputType](); - }; - }; + var createShakeOutputMethod = function (bits, padding, outputType) { + return function (message, outputBits) { + return new Keccak(bits, padding, outputBits).update(message)[outputType](); + }; + }; - var createKmacOutputMethod = function (bits, padding, outputType) { - return function (key, message, outputBits, s) { - return methods['kmac' + bits].update(key, message, outputBits, s)[outputType](); - }; - }; + var createCshakeOutputMethod = function (bits, padding, outputType) { + return function (message, outputBits, n, s) { + return methods['cshake' + bits].update(message, outputBits, n, s)[outputType](); + }; + }; - var createOutputMethods = function (method, createMethod, bits, padding) { - for (var i = 0; i < OUTPUT_TYPES.length; ++i) { - var type = OUTPUT_TYPES[i]; - method[type] = createMethod(bits, padding, type); - } - return method; - }; + var createKmacOutputMethod = function (bits, padding, outputType) { + return function (key, message, outputBits, s) { + return methods['kmac' + bits].update(key, message, outputBits, s)[outputType](); + }; + }; - var createMethod = function (bits, padding) { - var method = createOutputMethod(bits, padding, 'hex'); - method.create = function () { - return new Keccak(bits, padding, bits); - }; - method.update = function (message) { - return method.create().update(message); - }; - return createOutputMethods(method, createOutputMethod, bits, padding); - }; + var createOutputMethods = function (method, createMethod, bits, padding) { + for (var i = 0; i < OUTPUT_TYPES.length; ++i) { + var type = OUTPUT_TYPES[i]; + method[type] = createMethod(bits, padding, type); + } + return method; + }; - var createShakeMethod = function (bits, padding) { - var method = createShakeOutputMethod(bits, padding, 'hex'); - method.create = function (outputBits) { - return new Keccak(bits, padding, outputBits); - }; - method.update = function (message, outputBits) { - return method.create(outputBits).update(message); - }; - return createOutputMethods(method, createShakeOutputMethod, bits, padding); - }; + var createMethod = function (bits, padding) { + var method = createOutputMethod(bits, padding, 'hex'); + method.create = function () { + return new Keccak(bits, padding, bits); + }; + method.update = function (message) { + return method.create().update(message); + }; + return createOutputMethods(method, createOutputMethod, bits, padding); + }; - var createCshakeMethod = function (bits, padding) { - var w = CSHAKE_BYTEPAD[bits]; - var method = createCshakeOutputMethod(bits, padding, 'hex'); - method.create = function (outputBits, n, s) { - if (!n && !s) { - return methods['shake' + bits].create(outputBits); - } else { - return new Keccak(bits, padding, outputBits).bytepad([n, s], w); - } - }; - method.update = function (message, outputBits, n, s) { - return method.create(outputBits, n, s).update(message); - }; - return createOutputMethods(method, createCshakeOutputMethod, bits, padding); - }; + var createShakeMethod = function (bits, padding) { + var method = createShakeOutputMethod(bits, padding, 'hex'); + method.create = function (outputBits) { + return new Keccak(bits, padding, outputBits); + }; + method.update = function (message, outputBits) { + return method.create(outputBits).update(message); + }; + return createOutputMethods(method, createShakeOutputMethod, bits, padding); + }; - var createKmacMethod = function (bits, padding) { - var w = CSHAKE_BYTEPAD[bits]; - var method = createKmacOutputMethod(bits, padding, 'hex'); - method.create = function (key, outputBits, s) { - return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w); - }; - method.update = function (key, message, outputBits, s) { - return method.create(key, outputBits, s).update(message); - }; - return createOutputMethods(method, createKmacOutputMethod, bits, padding); - }; + var createCshakeMethod = function (bits, padding) { + var w = CSHAKE_BYTEPAD[bits]; + var method = createCshakeOutputMethod(bits, padding, 'hex'); + method.create = function (outputBits, n, s) { + if (!n && !s) { + return methods['shake' + bits].create(outputBits); + } else { + return new Keccak(bits, padding, outputBits).bytepad([n, s], w); + } + }; + method.update = function (message, outputBits, n, s) { + return method.create(outputBits, n, s).update(message); + }; + return createOutputMethods(method, createCshakeOutputMethod, bits, padding); + }; - var algorithms = [ - { name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod }, - { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod }, - { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod }, - { name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod }, - { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod } - ]; + var createKmacMethod = function (bits, padding) { + var w = CSHAKE_BYTEPAD[bits]; + var method = createKmacOutputMethod(bits, padding, 'hex'); + method.create = function (key, outputBits, s) { + return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w); + }; + method.update = function (key, message, outputBits, s) { + return method.create(key, outputBits, s).update(message); + }; + return createOutputMethods(method, createKmacOutputMethod, bits, padding); + }; - var methods = {}, methodNames = []; + var algorithms = [ + { name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod }, + { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod }, + { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod }, + { name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod }, + { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod } + ]; - for (var i = 0; i < algorithms.length; ++i) { - var algorithm = algorithms[i]; - var bits = algorithm.bits; - for (var j = 0; j < bits.length; ++j) { - var methodName = algorithm.name + '_' + bits[j]; - methodNames.push(methodName); - methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding); - if (algorithm.name !== 'sha3') { - var newMethodName = algorithm.name + bits[j]; - methodNames.push(newMethodName); - methods[newMethodName] = methods[methodName]; - } - } - } + var methods = {}, methodNames = []; - function Keccak(bits, padding, outputBits) { - this.blocks = []; - this.s = []; - this.padding = padding; - this.outputBits = outputBits; - this.reset = true; - this.finalized = false; - this.block = 0; - this.start = 0; - this.blockCount = (1600 - (bits << 1)) >> 5; - this.byteCount = this.blockCount << 2; - this.outputBlocks = outputBits >> 5; - this.extraBytes = (outputBits & 31) >> 3; + for (var i = 0; i < algorithms.length; ++i) { + var algorithm = algorithms[i]; + var bits = algorithm.bits; + for (var j = 0; j < bits.length; ++j) { + var methodName = algorithm.name + '_' + bits[j]; + methodNames.push(methodName); + methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding); + if (algorithm.name !== 'sha3') { + var newMethodName = algorithm.name + bits[j]; + methodNames.push(newMethodName); + methods[newMethodName] = methods[methodName]; + } + } + } - for (var i = 0; i < 50; ++i) { - this.s[i] = 0; - } - } + function Keccak(bits, padding, outputBits) { + this.blocks = []; + this.s = []; + this.padding = padding; + this.outputBits = outputBits; + this.reset = true; + this.finalized = false; + this.block = 0; + this.start = 0; + this.blockCount = (1600 - (bits << 1)) >> 5; + this.byteCount = this.blockCount << 2; + this.outputBlocks = outputBits >> 5; + this.extraBytes = (outputBits & 31) >> 3; - Keccak.prototype.update = function (message) { - if (this.finalized) { - throw new Error(FINALIZE_ERROR); - } - var notString, type = typeof message; - if (type !== 'string') { - if (type === 'object') { - if (message === null) { - throw new Error(INPUT_ERROR); - } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) { - message = new Uint8Array(message); - } else if (!Array.isArray(message)) { - if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) { - throw new Error(INPUT_ERROR); - } - } - } else { - throw new Error(INPUT_ERROR); - } - notString = true; - } - var blocks = this.blocks, byteCount = this.byteCount, length = message.length, - blockCount = this.blockCount, index = 0, s = this.s, i, code; + for (var i = 0; i < 50; ++i) { + this.s[i] = 0; + } + } - while (index < length) { - if (this.reset) { - this.reset = false; - blocks[0] = this.block; - for (i = 1; i < blockCount + 1; ++i) { - blocks[i] = 0; - } - } - if (notString) { - for (i = this.start; index < length && i < byteCount; ++index) { - blocks[i >> 2] |= message[index] << SHIFT[i++ & 3]; - } - } else { - for (i = this.start; index < length && i < byteCount; ++index) { - code = message.charCodeAt(index); - if (code < 0x80) { - blocks[i >> 2] |= code << SHIFT[i++ & 3]; - } else if (code < 0x800) { - blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } else if (code < 0xd800 || code >= 0xe000) { - blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } else { - code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff)); - blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } - } - } - this.lastByteIndex = i; - if (i >= byteCount) { - this.start = i - byteCount; - this.block = blocks[blockCount]; - for (i = 0; i < blockCount; ++i) { - s[i] ^= blocks[i]; - } - f(s); - this.reset = true; - } else { - this.start = i; - } - } - return this; - }; + Keccak.prototype.update = function (message) { + if (this.finalized) { + throw new Error(FINALIZE_ERROR); + } + var notString, type = typeof message; + if (type !== 'string') { + if (type === 'object') { + if (message === null) { + throw new Error(INPUT_ERROR); + } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) { + message = new Uint8Array(message); + } else if (!Array.isArray(message)) { + if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) { + throw new Error(INPUT_ERROR); + } + } + } else { + throw new Error(INPUT_ERROR); + } + notString = true; + } + var blocks = this.blocks, byteCount = this.byteCount, length = message.length, + blockCount = this.blockCount, index = 0, s = this.s, i, code; - Keccak.prototype.encode = function (x, right) { - var o = x & 255, n = 1; - var bytes = [o]; - x = x >> 8; - o = x & 255; - while (o > 0) { - bytes.unshift(o); - x = x >> 8; - o = x & 255; - ++n; - } - if (right) { - bytes.push(n); - } else { - bytes.unshift(n); - } - this.update(bytes); - return bytes.length; - }; + while (index < length) { + if (this.reset) { + this.reset = false; + blocks[0] = this.block; + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } + } + if (notString) { + for (i = this.start; index < length && i < byteCount; ++index) { + blocks[i >> 2] |= message[index] << SHIFT[i++ & 3]; + } + } else { + for (i = this.start; index < length && i < byteCount; ++index) { + code = message.charCodeAt(index); + if (code < 0x80) { + blocks[i >> 2] |= code << SHIFT[i++ & 3]; + } else if (code < 0x800) { + blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } else if (code < 0xd800 || code >= 0xe000) { + blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } else { + code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff)); + blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } + } + } + this.lastByteIndex = i; + if (i >= byteCount) { + this.start = i - byteCount; + this.block = blocks[blockCount]; + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; + } + f(s); + this.reset = true; + } else { + this.start = i; + } + } + return this; + }; - Keccak.prototype.encodeString = function (str) { - var notString, type = typeof str; - if (type !== 'string') { - if (type === 'object') { - if (str === null) { - throw new Error(INPUT_ERROR); - } else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) { - str = new Uint8Array(str); - } else if (!Array.isArray(str)) { - if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) { - throw new Error(INPUT_ERROR); - } - } - } else { - throw new Error(INPUT_ERROR); - } - notString = true; - } - var bytes = 0, length = str.length; - if (notString) { - bytes = length; - } else { - for (var i = 0; i < str.length; ++i) { - var code = str.charCodeAt(i); - if (code < 0x80) { - bytes += 1; - } else if (code < 0x800) { - bytes += 2; - } else if (code < 0xd800 || code >= 0xe000) { - bytes += 3; - } else { - code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff)); - bytes += 4; - } - } - } - bytes += this.encode(bytes * 8); - this.update(str); - return bytes; - }; + Keccak.prototype.encode = function (x, right) { + var o = x & 255, n = 1; + var bytes = [o]; + x = x >> 8; + o = x & 255; + while (o > 0) { + bytes.unshift(o); + x = x >> 8; + o = x & 255; + ++n; + } + if (right) { + bytes.push(n); + } else { + bytes.unshift(n); + } + this.update(bytes); + return bytes.length; + }; - Keccak.prototype.bytepad = function (strs, w) { - var bytes = this.encode(w); - for (var i = 0; i < strs.length; ++i) { - bytes += this.encodeString(strs[i]); - } - var paddingBytes = w - bytes % w; - var zeros = []; - zeros.length = paddingBytes; - this.update(zeros); - return this; - }; + Keccak.prototype.encodeString = function (str) { + var notString, type = typeof str; + if (type !== 'string') { + if (type === 'object') { + if (str === null) { + throw new Error(INPUT_ERROR); + } else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) { + str = new Uint8Array(str); + } else if (!Array.isArray(str)) { + if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) { + throw new Error(INPUT_ERROR); + } + } + } else { + throw new Error(INPUT_ERROR); + } + notString = true; + } + var bytes = 0, length = str.length; + if (notString) { + bytes = length; + } else { + for (var i = 0; i < str.length; ++i) { + var code = str.charCodeAt(i); + if (code < 0x80) { + bytes += 1; + } else if (code < 0x800) { + bytes += 2; + } else if (code < 0xd800 || code >= 0xe000) { + bytes += 3; + } else { + code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff)); + bytes += 4; + } + } + } + bytes += this.encode(bytes * 8); + this.update(str); + return bytes; + }; - Keccak.prototype.finalize = function () { - if (this.finalized) { - return; - } - this.finalized = true; - var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s; - blocks[i >> 2] |= this.padding[i & 3]; - if (this.lastByteIndex === this.byteCount) { - blocks[0] = blocks[blockCount]; - for (i = 1; i < blockCount + 1; ++i) { - blocks[i] = 0; - } - } - blocks[blockCount - 1] |= 0x80000000; - for (i = 0; i < blockCount; ++i) { - s[i] ^= blocks[i]; - } - f(s); - }; + Keccak.prototype.bytepad = function (strs, w) { + var bytes = this.encode(w); + for (var i = 0; i < strs.length; ++i) { + bytes += this.encodeString(strs[i]); + } + var paddingBytes = w - bytes % w; + var zeros = []; + zeros.length = paddingBytes; + this.update(zeros); + return this; + }; - Keccak.prototype.toString = Keccak.prototype.hex = function () { - this.finalize(); + Keccak.prototype.finalize = function () { + if (this.finalized) { + return; + } + this.finalized = true; + var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s; + blocks[i >> 2] |= this.padding[i & 3]; + if (this.lastByteIndex === this.byteCount) { + blocks[0] = blocks[blockCount]; + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } + } + blocks[blockCount - 1] |= 0x80000000; + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; + } + f(s); + }; - var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, - extraBytes = this.extraBytes, i = 0, j = 0; - var hex = '', block; - while (j < outputBlocks) { - for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { - block = s[i]; - hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] + - HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] + - HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] + - HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F]; - } - if (j % blockCount === 0) { - f(s); - i = 0; - } - } - if (extraBytes) { - block = s[i]; - hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F]; - if (extraBytes > 1) { - hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F]; - } - if (extraBytes > 2) { - hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F]; - } - } - return hex; - }; + Keccak.prototype.toString = Keccak.prototype.hex = function () { + this.finalize(); - Keccak.prototype.arrayBuffer = function () { - this.finalize(); + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var hex = '', block; + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + block = s[i]; + hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] + + HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] + + HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] + + HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F]; + } + if (j % blockCount === 0) { + f(s); + i = 0; + } + } + if (extraBytes) { + block = s[i]; + hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F]; + if (extraBytes > 1) { + hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F]; + } + if (extraBytes > 2) { + hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F]; + } + } + return hex; + }; - var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, - extraBytes = this.extraBytes, i = 0, j = 0; - var bytes = this.outputBits >> 3; - var buffer; - if (extraBytes) { - buffer = new ArrayBuffer((outputBlocks + 1) << 2); - } else { - buffer = new ArrayBuffer(bytes); - } - var array = new Uint32Array(buffer); - while (j < outputBlocks) { - for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { - array[j] = s[i]; - } - if (j % blockCount === 0) { - f(s); - } - } - if (extraBytes) { - array[i] = s[i]; - buffer = buffer.slice(0, bytes); - } - return buffer; - }; + Keccak.prototype.arrayBuffer = function () { + this.finalize(); - Keccak.prototype.buffer = Keccak.prototype.arrayBuffer; + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var bytes = this.outputBits >> 3; + var buffer; + if (extraBytes) { + buffer = new ArrayBuffer((outputBlocks + 1) << 2); + } else { + buffer = new ArrayBuffer(bytes); + } + var array = new Uint32Array(buffer); + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + array[j] = s[i]; + } + if (j % blockCount === 0) { + f(s); + } + } + if (extraBytes) { + array[i] = s[i]; + buffer = buffer.slice(0, bytes); + } + return buffer; + }; - Keccak.prototype.digest = Keccak.prototype.array = function () { - this.finalize(); + Keccak.prototype.buffer = Keccak.prototype.arrayBuffer; - var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, - extraBytes = this.extraBytes, i = 0, j = 0; - var array = [], offset, block; - while (j < outputBlocks) { - for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { - offset = j << 2; - block = s[i]; - array[offset] = block & 0xFF; - array[offset + 1] = (block >> 8) & 0xFF; - array[offset + 2] = (block >> 16) & 0xFF; - array[offset + 3] = (block >> 24) & 0xFF; - } - if (j % blockCount === 0) { - f(s); - } - } - if (extraBytes) { - offset = j << 2; - block = s[i]; - array[offset] = block & 0xFF; - if (extraBytes > 1) { - array[offset + 1] = (block >> 8) & 0xFF; - } - if (extraBytes > 2) { - array[offset + 2] = (block >> 16) & 0xFF; - } - } - return array; - }; + Keccak.prototype.digest = Keccak.prototype.array = function () { + this.finalize(); - function Kmac(bits, padding, outputBits) { - Keccak.call(this, bits, padding, outputBits); - } + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var array = [], offset, block; + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + offset = j << 2; + block = s[i]; + array[offset] = block & 0xFF; + array[offset + 1] = (block >> 8) & 0xFF; + array[offset + 2] = (block >> 16) & 0xFF; + array[offset + 3] = (block >> 24) & 0xFF; + } + if (j % blockCount === 0) { + f(s); + } + } + if (extraBytes) { + offset = j << 2; + block = s[i]; + array[offset] = block & 0xFF; + if (extraBytes > 1) { + array[offset + 1] = (block >> 8) & 0xFF; + } + if (extraBytes > 2) { + array[offset + 2] = (block >> 16) & 0xFF; + } + } + return array; + }; - Kmac.prototype = new Keccak(); + function Kmac(bits, padding, outputBits) { + Keccak.call(this, bits, padding, outputBits); + } - Kmac.prototype.finalize = function () { - this.encode(this.outputBits, true); - return Keccak.prototype.finalize.call(this); - }; + Kmac.prototype = new Keccak(); - var f = function (s) { - var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, - b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, - b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, - b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49; - for (n = 0; n < 48; n += 2) { - c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]; - c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]; - c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]; - c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]; - c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]; - c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]; - c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]; - c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]; - c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]; - c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]; + Kmac.prototype.finalize = function () { + this.encode(this.outputBits, true); + return Keccak.prototype.finalize.call(this); + }; - h = c8 ^ ((c2 << 1) | (c3 >>> 31)); - l = c9 ^ ((c3 << 1) | (c2 >>> 31)); - s[0] ^= h; - s[1] ^= l; - s[10] ^= h; - s[11] ^= l; - s[20] ^= h; - s[21] ^= l; - s[30] ^= h; - s[31] ^= l; - s[40] ^= h; - s[41] ^= l; - h = c0 ^ ((c4 << 1) | (c5 >>> 31)); - l = c1 ^ ((c5 << 1) | (c4 >>> 31)); - s[2] ^= h; - s[3] ^= l; - s[12] ^= h; - s[13] ^= l; - s[22] ^= h; - s[23] ^= l; - s[32] ^= h; - s[33] ^= l; - s[42] ^= h; - s[43] ^= l; - h = c2 ^ ((c6 << 1) | (c7 >>> 31)); - l = c3 ^ ((c7 << 1) | (c6 >>> 31)); - s[4] ^= h; - s[5] ^= l; - s[14] ^= h; - s[15] ^= l; - s[24] ^= h; - s[25] ^= l; - s[34] ^= h; - s[35] ^= l; - s[44] ^= h; - s[45] ^= l; - h = c4 ^ ((c8 << 1) | (c9 >>> 31)); - l = c5 ^ ((c9 << 1) | (c8 >>> 31)); - s[6] ^= h; - s[7] ^= l; - s[16] ^= h; - s[17] ^= l; - s[26] ^= h; - s[27] ^= l; - s[36] ^= h; - s[37] ^= l; - s[46] ^= h; - s[47] ^= l; - h = c6 ^ ((c0 << 1) | (c1 >>> 31)); - l = c7 ^ ((c1 << 1) | (c0 >>> 31)); - s[8] ^= h; - s[9] ^= l; - s[18] ^= h; - s[19] ^= l; - s[28] ^= h; - s[29] ^= l; - s[38] ^= h; - s[39] ^= l; - s[48] ^= h; - s[49] ^= l; + var f = function (s) { + var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, + b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, + b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, + b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49; + for (n = 0; n < 48; n += 2) { + c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]; + c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]; + c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]; + c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]; + c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]; + c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]; + c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]; + c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]; + c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]; + c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]; - b0 = s[0]; - b1 = s[1]; - b32 = (s[11] << 4) | (s[10] >>> 28); - b33 = (s[10] << 4) | (s[11] >>> 28); - b14 = (s[20] << 3) | (s[21] >>> 29); - b15 = (s[21] << 3) | (s[20] >>> 29); - b46 = (s[31] << 9) | (s[30] >>> 23); - b47 = (s[30] << 9) | (s[31] >>> 23); - b28 = (s[40] << 18) | (s[41] >>> 14); - b29 = (s[41] << 18) | (s[40] >>> 14); - b20 = (s[2] << 1) | (s[3] >>> 31); - b21 = (s[3] << 1) | (s[2] >>> 31); - b2 = (s[13] << 12) | (s[12] >>> 20); - b3 = (s[12] << 12) | (s[13] >>> 20); - b34 = (s[22] << 10) | (s[23] >>> 22); - b35 = (s[23] << 10) | (s[22] >>> 22); - b16 = (s[33] << 13) | (s[32] >>> 19); - b17 = (s[32] << 13) | (s[33] >>> 19); - b48 = (s[42] << 2) | (s[43] >>> 30); - b49 = (s[43] << 2) | (s[42] >>> 30); - b40 = (s[5] << 30) | (s[4] >>> 2); - b41 = (s[4] << 30) | (s[5] >>> 2); - b22 = (s[14] << 6) | (s[15] >>> 26); - b23 = (s[15] << 6) | (s[14] >>> 26); - b4 = (s[25] << 11) | (s[24] >>> 21); - b5 = (s[24] << 11) | (s[25] >>> 21); - b36 = (s[34] << 15) | (s[35] >>> 17); - b37 = (s[35] << 15) | (s[34] >>> 17); - b18 = (s[45] << 29) | (s[44] >>> 3); - b19 = (s[44] << 29) | (s[45] >>> 3); - b10 = (s[6] << 28) | (s[7] >>> 4); - b11 = (s[7] << 28) | (s[6] >>> 4); - b42 = (s[17] << 23) | (s[16] >>> 9); - b43 = (s[16] << 23) | (s[17] >>> 9); - b24 = (s[26] << 25) | (s[27] >>> 7); - b25 = (s[27] << 25) | (s[26] >>> 7); - b6 = (s[36] << 21) | (s[37] >>> 11); - b7 = (s[37] << 21) | (s[36] >>> 11); - b38 = (s[47] << 24) | (s[46] >>> 8); - b39 = (s[46] << 24) | (s[47] >>> 8); - b30 = (s[8] << 27) | (s[9] >>> 5); - b31 = (s[9] << 27) | (s[8] >>> 5); - b12 = (s[18] << 20) | (s[19] >>> 12); - b13 = (s[19] << 20) | (s[18] >>> 12); - b44 = (s[29] << 7) | (s[28] >>> 25); - b45 = (s[28] << 7) | (s[29] >>> 25); - b26 = (s[38] << 8) | (s[39] >>> 24); - b27 = (s[39] << 8) | (s[38] >>> 24); - b8 = (s[48] << 14) | (s[49] >>> 18); - b9 = (s[49] << 14) | (s[48] >>> 18); + h = c8 ^ ((c2 << 1) | (c3 >>> 31)); + l = c9 ^ ((c3 << 1) | (c2 >>> 31)); + s[0] ^= h; + s[1] ^= l; + s[10] ^= h; + s[11] ^= l; + s[20] ^= h; + s[21] ^= l; + s[30] ^= h; + s[31] ^= l; + s[40] ^= h; + s[41] ^= l; + h = c0 ^ ((c4 << 1) | (c5 >>> 31)); + l = c1 ^ ((c5 << 1) | (c4 >>> 31)); + s[2] ^= h; + s[3] ^= l; + s[12] ^= h; + s[13] ^= l; + s[22] ^= h; + s[23] ^= l; + s[32] ^= h; + s[33] ^= l; + s[42] ^= h; + s[43] ^= l; + h = c2 ^ ((c6 << 1) | (c7 >>> 31)); + l = c3 ^ ((c7 << 1) | (c6 >>> 31)); + s[4] ^= h; + s[5] ^= l; + s[14] ^= h; + s[15] ^= l; + s[24] ^= h; + s[25] ^= l; + s[34] ^= h; + s[35] ^= l; + s[44] ^= h; + s[45] ^= l; + h = c4 ^ ((c8 << 1) | (c9 >>> 31)); + l = c5 ^ ((c9 << 1) | (c8 >>> 31)); + s[6] ^= h; + s[7] ^= l; + s[16] ^= h; + s[17] ^= l; + s[26] ^= h; + s[27] ^= l; + s[36] ^= h; + s[37] ^= l; + s[46] ^= h; + s[47] ^= l; + h = c6 ^ ((c0 << 1) | (c1 >>> 31)); + l = c7 ^ ((c1 << 1) | (c0 >>> 31)); + s[8] ^= h; + s[9] ^= l; + s[18] ^= h; + s[19] ^= l; + s[28] ^= h; + s[29] ^= l; + s[38] ^= h; + s[39] ^= l; + s[48] ^= h; + s[49] ^= l; - s[0] = b0 ^ (~b2 & b4); - s[1] = b1 ^ (~b3 & b5); - s[10] = b10 ^ (~b12 & b14); - s[11] = b11 ^ (~b13 & b15); - s[20] = b20 ^ (~b22 & b24); - s[21] = b21 ^ (~b23 & b25); - s[30] = b30 ^ (~b32 & b34); - s[31] = b31 ^ (~b33 & b35); - s[40] = b40 ^ (~b42 & b44); - s[41] = b41 ^ (~b43 & b45); - s[2] = b2 ^ (~b4 & b6); - s[3] = b3 ^ (~b5 & b7); - s[12] = b12 ^ (~b14 & b16); - s[13] = b13 ^ (~b15 & b17); - s[22] = b22 ^ (~b24 & b26); - s[23] = b23 ^ (~b25 & b27); - s[32] = b32 ^ (~b34 & b36); - s[33] = b33 ^ (~b35 & b37); - s[42] = b42 ^ (~b44 & b46); - s[43] = b43 ^ (~b45 & b47); - s[4] = b4 ^ (~b6 & b8); - s[5] = b5 ^ (~b7 & b9); - s[14] = b14 ^ (~b16 & b18); - s[15] = b15 ^ (~b17 & b19); - s[24] = b24 ^ (~b26 & b28); - s[25] = b25 ^ (~b27 & b29); - s[34] = b34 ^ (~b36 & b38); - s[35] = b35 ^ (~b37 & b39); - s[44] = b44 ^ (~b46 & b48); - s[45] = b45 ^ (~b47 & b49); - s[6] = b6 ^ (~b8 & b0); - s[7] = b7 ^ (~b9 & b1); - s[16] = b16 ^ (~b18 & b10); - s[17] = b17 ^ (~b19 & b11); - s[26] = b26 ^ (~b28 & b20); - s[27] = b27 ^ (~b29 & b21); - s[36] = b36 ^ (~b38 & b30); - s[37] = b37 ^ (~b39 & b31); - s[46] = b46 ^ (~b48 & b40); - s[47] = b47 ^ (~b49 & b41); - s[8] = b8 ^ (~b0 & b2); - s[9] = b9 ^ (~b1 & b3); - s[18] = b18 ^ (~b10 & b12); - s[19] = b19 ^ (~b11 & b13); - s[28] = b28 ^ (~b20 & b22); - s[29] = b29 ^ (~b21 & b23); - s[38] = b38 ^ (~b30 & b32); - s[39] = b39 ^ (~b31 & b33); - s[48] = b48 ^ (~b40 & b42); - s[49] = b49 ^ (~b41 & b43); + b0 = s[0]; + b1 = s[1]; + b32 = (s[11] << 4) | (s[10] >>> 28); + b33 = (s[10] << 4) | (s[11] >>> 28); + b14 = (s[20] << 3) | (s[21] >>> 29); + b15 = (s[21] << 3) | (s[20] >>> 29); + b46 = (s[31] << 9) | (s[30] >>> 23); + b47 = (s[30] << 9) | (s[31] >>> 23); + b28 = (s[40] << 18) | (s[41] >>> 14); + b29 = (s[41] << 18) | (s[40] >>> 14); + b20 = (s[2] << 1) | (s[3] >>> 31); + b21 = (s[3] << 1) | (s[2] >>> 31); + b2 = (s[13] << 12) | (s[12] >>> 20); + b3 = (s[12] << 12) | (s[13] >>> 20); + b34 = (s[22] << 10) | (s[23] >>> 22); + b35 = (s[23] << 10) | (s[22] >>> 22); + b16 = (s[33] << 13) | (s[32] >>> 19); + b17 = (s[32] << 13) | (s[33] >>> 19); + b48 = (s[42] << 2) | (s[43] >>> 30); + b49 = (s[43] << 2) | (s[42] >>> 30); + b40 = (s[5] << 30) | (s[4] >>> 2); + b41 = (s[4] << 30) | (s[5] >>> 2); + b22 = (s[14] << 6) | (s[15] >>> 26); + b23 = (s[15] << 6) | (s[14] >>> 26); + b4 = (s[25] << 11) | (s[24] >>> 21); + b5 = (s[24] << 11) | (s[25] >>> 21); + b36 = (s[34] << 15) | (s[35] >>> 17); + b37 = (s[35] << 15) | (s[34] >>> 17); + b18 = (s[45] << 29) | (s[44] >>> 3); + b19 = (s[44] << 29) | (s[45] >>> 3); + b10 = (s[6] << 28) | (s[7] >>> 4); + b11 = (s[7] << 28) | (s[6] >>> 4); + b42 = (s[17] << 23) | (s[16] >>> 9); + b43 = (s[16] << 23) | (s[17] >>> 9); + b24 = (s[26] << 25) | (s[27] >>> 7); + b25 = (s[27] << 25) | (s[26] >>> 7); + b6 = (s[36] << 21) | (s[37] >>> 11); + b7 = (s[37] << 21) | (s[36] >>> 11); + b38 = (s[47] << 24) | (s[46] >>> 8); + b39 = (s[46] << 24) | (s[47] >>> 8); + b30 = (s[8] << 27) | (s[9] >>> 5); + b31 = (s[9] << 27) | (s[8] >>> 5); + b12 = (s[18] << 20) | (s[19] >>> 12); + b13 = (s[19] << 20) | (s[18] >>> 12); + b44 = (s[29] << 7) | (s[28] >>> 25); + b45 = (s[28] << 7) | (s[29] >>> 25); + b26 = (s[38] << 8) | (s[39] >>> 24); + b27 = (s[39] << 8) | (s[38] >>> 24); + b8 = (s[48] << 14) | (s[49] >>> 18); + b9 = (s[49] << 14) | (s[48] >>> 18); - s[0] ^= RC[n]; - s[1] ^= RC[n + 1]; - } - }; + s[0] = b0 ^ (~b2 & b4); + s[1] = b1 ^ (~b3 & b5); + s[10] = b10 ^ (~b12 & b14); + s[11] = b11 ^ (~b13 & b15); + s[20] = b20 ^ (~b22 & b24); + s[21] = b21 ^ (~b23 & b25); + s[30] = b30 ^ (~b32 & b34); + s[31] = b31 ^ (~b33 & b35); + s[40] = b40 ^ (~b42 & b44); + s[41] = b41 ^ (~b43 & b45); + s[2] = b2 ^ (~b4 & b6); + s[3] = b3 ^ (~b5 & b7); + s[12] = b12 ^ (~b14 & b16); + s[13] = b13 ^ (~b15 & b17); + s[22] = b22 ^ (~b24 & b26); + s[23] = b23 ^ (~b25 & b27); + s[32] = b32 ^ (~b34 & b36); + s[33] = b33 ^ (~b35 & b37); + s[42] = b42 ^ (~b44 & b46); + s[43] = b43 ^ (~b45 & b47); + s[4] = b4 ^ (~b6 & b8); + s[5] = b5 ^ (~b7 & b9); + s[14] = b14 ^ (~b16 & b18); + s[15] = b15 ^ (~b17 & b19); + s[24] = b24 ^ (~b26 & b28); + s[25] = b25 ^ (~b27 & b29); + s[34] = b34 ^ (~b36 & b38); + s[35] = b35 ^ (~b37 & b39); + s[44] = b44 ^ (~b46 & b48); + s[45] = b45 ^ (~b47 & b49); + s[6] = b6 ^ (~b8 & b0); + s[7] = b7 ^ (~b9 & b1); + s[16] = b16 ^ (~b18 & b10); + s[17] = b17 ^ (~b19 & b11); + s[26] = b26 ^ (~b28 & b20); + s[27] = b27 ^ (~b29 & b21); + s[36] = b36 ^ (~b38 & b30); + s[37] = b37 ^ (~b39 & b31); + s[46] = b46 ^ (~b48 & b40); + s[47] = b47 ^ (~b49 & b41); + s[8] = b8 ^ (~b0 & b2); + s[9] = b9 ^ (~b1 & b3); + s[18] = b18 ^ (~b10 & b12); + s[19] = b19 ^ (~b11 & b13); + s[28] = b28 ^ (~b20 & b22); + s[29] = b29 ^ (~b21 & b23); + s[38] = b38 ^ (~b30 & b32); + s[39] = b39 ^ (~b31 & b33); + s[48] = b48 ^ (~b40 & b42); + s[49] = b49 ^ (~b41 & b43); - if (COMMON_JS) { - module.exports = methods; - } else { - for (i = 0; i < methodNames.length; ++i) { - root[methodNames[i]] = methods[methodNames[i]]; - } - } - })(); -} (sha3$1)); + s[0] ^= RC[n]; + s[1] ^= RC[n + 1]; + } + }; -var sha3Exports = sha3$1.exports; + if (COMMON_JS) { + module.exports = methods; + } else { + for (i = 0; i < methodNames.length; ++i) { + root[methodNames[i]] = methods[methodNames[i]]; + } + } + })(); + } (sha3$1)); + return sha3$1.exports; +} + +var sha3Exports = /*@__PURE__*/ requireSha3(); var sha3 = /*@__PURE__*/getDefaultExportFromCjs(sha3Exports); function keccak256(data) { @@ -19616,7 +1713,7 @@ const SEED = "mimcsponge"; const NROUNDS = 220; async function buildMimcSponge() { - const bn128 = await getCurveFromName("bn128", true); + const bn128 = await ffjavascript.getCurveFromName("bn128", true); return new MimcSponge(bn128.Fr); } @@ -19630,7 +1727,7 @@ class MimcSponge { const F = this.F; if (typeof seed === "undefined") seed = SEED; const c = keccak256(toUtf8Bytes(seed+"_iv")); - const cn = Scalar.e(c); + const cn = ffjavascript.Scalar.e(c); const iv = cn.mod(F.p); return iv; }; @@ -19708,47 +1805,23 @@ class MimcSponge { } } -var __async$1 = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; class Mimc { + sponge; + hash; + mimcPromise; constructor() { this.mimcPromise = this.initMimc(); } - initMimc() { - return __async$1(this, null, function* () { - this.sponge = yield buildMimcSponge(); - this.hash = (left, right) => { - var _a, _b; - return (_b = this.sponge) == null ? void 0 : _b.F.toString((_a = this.sponge) == null ? void 0 : _a.multiHash([BigInt(left), BigInt(right)])); - }; - }); + async initMimc() { + this.sponge = await buildMimcSponge(); + this.hash = (left, right) => this.sponge?.F.toString(this.sponge?.multiHash([BigInt(left), BigInt(right)])); } - getHash() { - return __async$1(this, null, function* () { - yield this.mimcPromise; - return { - sponge: this.sponge, - hash: this.hash - }; - }); + async getHash() { + await this.mimcPromise; + return { + sponge: this.sponge, + hash: this.hash + }; } } const mimc = new Mimc(); @@ -19758,71 +1831,49 @@ BigInt.prototype.toJSON = function() { }; const isNode = !process.browser && typeof globalThis.window === "undefined"; -var __async = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; -function nodePostWork() { - return __async(this, null, function* () { - const { hash: hashFunction } = yield mimc.getHash(); - const { merkleTreeHeight, edge, elements, zeroElement } = threads.workerData; - if (edge) { - const merkleTree2 = new lib.PartialMerkleTree(merkleTreeHeight, edge, elements, { - zeroElement, - hashFunction - }); - threads.parentPort.postMessage(merkleTree2.toString()); - return; - } - const merkleTree = new lib.MerkleTree(merkleTreeHeight, elements, { +async function nodePostWork() { + const { hash: hashFunction } = await mimc.getHash(); + const { merkleTreeHeight, edge, elements, zeroElement } = workerThreads.workerData; + if (edge) { + const merkleTree2 = new libExports.PartialMerkleTree(merkleTreeHeight, edge, elements, { zeroElement, hashFunction }); - threads.parentPort.postMessage(merkleTree.toString()); + workerThreads.parentPort.postMessage(merkleTree2.toString()); + return; + } + const merkleTree = new libExports.MerkleTree(merkleTreeHeight, elements, { + zeroElement, + hashFunction }); + workerThreads.parentPort.postMessage(merkleTree.toString()); } -if (isNode && threads) { +if (isNode && workerThreads) { nodePostWork(); } else if (!isNode && typeof addEventListener === "function" && typeof postMessage === "function") { - addEventListener("message", (e) => __async(undefined, null, function* () { + addEventListener("message", async (e) => { let data; if (e.data) { data = e.data; } else { data = e; } - const { hash: hashFunction } = yield mimc.getHash(); + const { hash: hashFunction } = await mimc.getHash(); const { merkleTreeHeight, edge, elements, zeroElement } = data; if (edge) { - const merkleTree2 = new lib.PartialMerkleTree(merkleTreeHeight, edge, elements, { + const merkleTree2 = new libExports.PartialMerkleTree(merkleTreeHeight, edge, elements, { zeroElement, hashFunction }); postMessage(merkleTree2.toString()); return; } - const merkleTree = new lib.MerkleTree(merkleTreeHeight, elements, { + const merkleTree = new libExports.MerkleTree(merkleTreeHeight, elements, { zeroElement, hashFunction }); postMessage(merkleTree.toString()); - })); + }); } else { throw new Error("This browser / environment does not support workers!"); } diff --git a/dist/merkleTreeWorker.umd.js b/dist/merkleTreeWorker.umd.js index e29bdd7..1323174 100644 --- a/dist/merkleTreeWorker.umd.js +++ b/dist/merkleTreeWorker.umd.js @@ -1,3 +1,5 @@ +globalThis.process = { browser: true, env: {}, }; + (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); @@ -11,6 +13,525 @@ return /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ +/***/ 8176: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +/* + ISC License + + Copyright (c) 2019, Pierre-Louis Despaigne + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +const CID = __webpack_require__(6613); + +// Label's max length in DNS (https://tools.ietf.org/html/rfc1034#page-7) +const dnsLabelMaxLength = 63; + +/** + * Take any ipfsHash and convert it to DNS-compatible CID + * @param {string} ipfsHash a regular ipfs hash either a cid v0 or v1 + * @return {string} the resulting ipfs hash as a cid v1 + */ +const cidForWeb = (ipfsHash) => { + let cid = new CID(ipfsHash); + if (cid.version === 0) { + cid = cid.toV1(); + } + let dnsLabel = cid.toString('base32'); + if (dnsLabel.length > dnsLabelMaxLength) { + const b36 = cid.toString('base36'); + if (b36.length <= dnsLabelMaxLength) { + return b36; + } + throw new TypeError ('CID is longer than DNS limit of 63 characters and is not compatible with public gateways'); + } + return dnsLabel; +} + +exports.cidForWeb = cidForWeb; + + +/** + * Take any ipfsHash and convert it to a CID v1 encoded in base32. + * @param {string} ipfsHash a regular ipfs hash either a cid v0 or v1 (v1 will remain unchanged) + * @return {string} the resulting ipfs hash as a cid v1 + */ +const cidV0ToV1Base32 = (ipfsHash) => { + let cid = new CID(ipfsHash); + if (cid.version === 0) { + cid = cid.toV1(); + } + return cid.toString('base32'); +} + +exports.cidV0ToV1Base32 = cidV0ToV1Base32; + + +/***/ }), + +/***/ 1810: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/* + ISC License + + Copyright (c) 2019, Pierre-Louis Despaigne + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +const multiC = __webpack_require__(2021); +const multiH = __webpack_require__(4243); + +const { hexStringToBuffer, profiles } = __webpack_require__(5262); +const { cidForWeb, cidV0ToV1Base32 } = __webpack_require__(8176); + +module.exports = { + + //export some helpers functions + helpers: { + cidForWeb, + cidV0ToV1Base32, + }, + + /** + * Decode a Content Hash. + * @param {string} hash an hex string containing a content hash + * @return {string} the decoded content + */ + decode: function (contentHash) { + const buffer = hexStringToBuffer(contentHash); + const codec = multiC.getCodec(buffer); + const value = multiC.rmPrefix(buffer); + let profile = profiles[codec]; + if (!profile) profile = profiles['default']; + return profile.decode(value); + }, + + /** + * Encode an IPFS address into a content hash + * @param {string} ipfsHash string containing an IPFS address + * @return {string} the resulting content hash + */ + fromIpfs: function (ipfsHash) { + return this.encode('ipfs-ns', ipfsHash); + }, + + /** + * Encode a Skylink into a content hash + * @param {string} skylink string containing a Skylink + * @return {string} the resulting content hash + */ + fromSkylink: function (skylink) { + return this.encode('skynet-ns', skylink); + }, + + /** + * Encode a Swarm address into a content hash + * @param {string} swarmHash string containing a Swarm address + * @return {string} the resulting content hash + */ + fromSwarm: function (swarmHash) { + return this.encode('swarm-ns', swarmHash); + }, + + /** + * Encode a arweave address into a content hash + * @param {string} swarmHash string containing a arweave address + * @return {string} the resulting content hash + */ + fromArweave: function(arweave) { + return this.encode('arweave-ns', arweave); + }, + + /** + * General purpose encoding function + * @param {string} codec + * @param {string} value + */ + encode: function (codec, value) { + let profile = profiles[codec]; + if (!profile) profile = profiles['default']; + const encodedValue = profile.encode(value); + return multiH.toHexString(multiC.addPrefix(codec, encodedValue)) + }, + + /** + * Extract the codec of a content hash + * @param {string} hash hex string containing a content hash + * @return {string} the extracted codec + */ + getCodec: function (hash) { + let buffer = hexStringToBuffer(hash); + return multiC.getCodec(buffer); + }, +} + + +/***/ }), + +/***/ 5262: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +/* provided dependency */ var Buffer = __webpack_require__(2045)["hp"]; +/* + ISC License + + Copyright (c) 2019, Pierre-Louis Despaigne + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +const CID = __webpack_require__(6613); +const multiH = __webpack_require__(4243); +const base64 = __webpack_require__(8127) + +/** + * Convert an hexadecimal string to a Buffer, the string can start with or without '0x' + * @param {string} hex an hexadecimal value + * @return {Buffer} the resulting Buffer + */ +const hexStringToBuffer = (hex) => { + let prefix = hex.slice(0, 2); + let value = hex.slice(2); + let res = ''; + if (prefix === '0x') res = value; + else res = hex; + return multiH.fromHexString(res); +} + +/** + * Validates IPNS identifier to safeguard against insecure names. + * @param {CID} name ised in ipns-ns + * @return {bool} + */ +const isCryptographicIPNS = (cid) => { + try { + const { multihash } = cid + // Additional check for identifiers shorter + // than what inlined ED25519 pubkey would be + // https://github.com/ensdomains/ens-app/issues/849#issuecomment-777088950 + if (multihash.length < 38) { + const mh = multiH.decode(multihash) + // ED25519 pubkeys are inlined using identity hash function + // and we should not see anything shorter than that + if (mh.name === 'identity' && mh.length < 36) { + // One can read inlined string value via: + // console.log('ipns-ns id:', String(multiH.decode(new CID(value).multihash).digest)) + return false + } + } + // ok, CID looks fine + return true + } catch (_) { return false } +} + +/** +* list of known encoding, +* encoding should be a function that takes a `string` input, +* and return a `Buffer` result +*/ +const encodes = { + /** + * @param {string} value + * @return {Buffer} + */ + skynet: (value) => { + return base64.toUint8Array(value) + }, + /** + * @param {string} value + * @return {Buffer} + */ + swarm: (value) => { + const multihash = multiH.encode(hexStringToBuffer(value), 'keccak-256'); + return new CID(1, 'swarm-manifest', multihash).bytes; + }, + /** + * @param {string} value + * @return {Buffer} + */ + ipfs: (value) => { + return new CID(value).toV1().bytes; + }, + /** + * @param {string} value + * @return {Buffer} + */ + ipns: (value) => { + const cid = new CID(value) + if (!isCryptographicIPNS(cid)) { + throw Error('ipns-ns allows only valid cryptographic libp2p-key identifiers, try using ED25519 pubkey instead') + } + // Represent IPNS name as a CID with libp2p-key codec + // https://github.com/libp2p/specs/blob/master/RFC/0001-text-peerid-cid.md + return new CID(1, 'libp2p-key', cid.multihash).bytes + }, + /** + * @param {string} value + * @return {Buffer} + */ + utf8: (value) => { + return Buffer.from(value, 'utf8'); + }, + /** + * @param {string} value + * @return {Buffer} + */ + arweave: (value) => { + return base64.toUint8Array(value) + }, +}; + +/** +* list of known decoding, +* decoding should be a function that takes a `Buffer` input, +* and return a `string` result +*/ +const decodes = { + /** + * @param {Buffer} value + */ + hexMultiHash: (value) => { + const cid = new CID(value); + return multiH.decode(cid.multihash).digest.toString('hex'); + }, + /** + * @param {Buffer} value + */ + ipfs: (value) => { + const cid = new CID(value).toV1(); + return cid.toString(cid.codec === 'libp2p-key' ? 'base36' : 'base32') + }, + /** + * @param {Buffer} value + */ + ipns: (value) => { + const cid = new CID(value).toV1() + if (!isCryptographicIPNS(cid)) { + // Value is not a libp2p-key, return original string + console.warn('[ensdomains/content-hash] use of non-cryptographic identifiers in ipns-ns is deprecated and will be removed, migrate to ED25519 libp2p-key') + return String(multiH.decode(new CID(value).multihash).digest) + // TODO: start throwing an error (after some deprecation period) + // throw Error('ipns-ns allows only valid cryptographic libp2p-key identifiers, try using ED25519 pubkey instead') + } + return cid.toString('base36') + }, + /** + * @param {Buffer} value + */ + utf8: (value) => { + return value.toString('utf8'); + }, + base64: (value) => { + // `true` option makes it URL safe (replaces / and + with - and _ ) + return base64.fromUint8Array(value, true) + } +}; + +/** +* list of known encoding/decoding for a given codec, +* `encode` should be chosen among the `encodes` functions +* `decode` should be chosen among the `decodes` functions +*/ +const profiles = { + 'skynet-ns': { + encode: encodes.skynet, + decode: decodes.base64, + }, + 'swarm-ns': { + encode: encodes.swarm, + decode: decodes.hexMultiHash, + }, + 'ipfs-ns': { + encode: encodes.ipfs, + decode: decodes.ipfs, + }, + 'ipns-ns': { + encode: encodes.ipns, + decode: decodes.ipns, + }, + 'arweave-ns': { + encode: encodes.arweave, + decode: decodes.base64, + }, + 'default': { + encode: encodes.utf8, + decode: decodes.utf8, + }, +}; + +exports.hexStringToBuffer = hexStringToBuffer; +exports.profiles = profiles; + + +/***/ }), + +/***/ 5084: +/***/ ((module) => { + +"use strict"; + +// base-x encoding / decoding +// Copyright (c) 2018 base-x contributors +// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp) +// Distributed under the MIT software license, see the accompanying +// file LICENSE or http://www.opensource.org/licenses/mit-license.php. +function base (ALPHABET) { + if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') } + var BASE_MAP = new Uint8Array(256) + for (var j = 0; j < BASE_MAP.length; j++) { + BASE_MAP[j] = 255 + } + for (var i = 0; i < ALPHABET.length; i++) { + var x = ALPHABET.charAt(i) + var xc = x.charCodeAt(0) + if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') } + BASE_MAP[xc] = i + } + var BASE = ALPHABET.length + var LEADER = ALPHABET.charAt(0) + var FACTOR = Math.log(BASE) / Math.log(256) // log(BASE) / log(256), rounded up + var iFACTOR = Math.log(256) / Math.log(BASE) // log(256) / log(BASE), rounded up + function encode (source) { + if (source instanceof Uint8Array) { + } else if (ArrayBuffer.isView(source)) { + source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength) + } else if (Array.isArray(source)) { + source = Uint8Array.from(source) + } + if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') } + if (source.length === 0) { return '' } + // Skip & count leading zeroes. + var zeroes = 0 + var length = 0 + var pbegin = 0 + var pend = source.length + while (pbegin !== pend && source[pbegin] === 0) { + pbegin++ + zeroes++ + } + // Allocate enough space in big-endian base58 representation. + var size = ((pend - pbegin) * iFACTOR + 1) >>> 0 + var b58 = new Uint8Array(size) + // Process the bytes. + while (pbegin !== pend) { + var carry = source[pbegin] + // Apply "b58 = b58 * 256 + ch". + var i = 0 + for (var it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) { + carry += (256 * b58[it1]) >>> 0 + b58[it1] = (carry % BASE) >>> 0 + carry = (carry / BASE) >>> 0 + } + if (carry !== 0) { throw new Error('Non-zero carry') } + length = i + pbegin++ + } + // Skip leading zeroes in base58 result. + var it2 = size - length + while (it2 !== size && b58[it2] === 0) { + it2++ + } + // Translate the result into a string. + var str = LEADER.repeat(zeroes) + for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]) } + return str + } + function decodeUnsafe (source) { + if (typeof source !== 'string') { throw new TypeError('Expected String') } + if (source.length === 0) { return new Uint8Array() } + var psz = 0 + // Skip leading spaces. + if (source[psz] === ' ') { return } + // Skip and count leading '1's. + var zeroes = 0 + var length = 0 + while (source[psz] === LEADER) { + zeroes++ + psz++ + } + // Allocate enough space in big-endian base256 representation. + var size = (((source.length - psz) * FACTOR) + 1) >>> 0 // log(58) / log(256), rounded up. + var b256 = new Uint8Array(size) + // Process the characters. + while (source[psz]) { + // Decode character + var carry = BASE_MAP[source.charCodeAt(psz)] + // Invalid character + if (carry === 255) { return } + var i = 0 + for (var it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) { + carry += (BASE * b256[it3]) >>> 0 + b256[it3] = (carry % 256) >>> 0 + carry = (carry / 256) >>> 0 + } + if (carry !== 0) { throw new Error('Non-zero carry') } + length = i + psz++ + } + // Skip trailing spaces. + if (source[psz] === ' ') { return } + // Skip leading zeroes in b256. + var it4 = size - length + while (it4 !== size && b256[it4] === 0) { + it4++ + } + var vch = new Uint8Array(zeroes + (size - it4)) + var j = zeroes + while (it4 !== size) { + vch[j++] = b256[it4++] + } + return vch + } + function decode (string) { + var buffer = decodeUnsafe(string) + if (buffer) { return buffer } + throw new Error('Non-base' + BASE + ' character') + } + return { + encode: encode, + decodeUnsafe: decodeUnsafe, + decode: decode + } +} +module.exports = base + + +/***/ }), + /***/ 7736: /***/ ((__unused_webpack_module, exports) => { @@ -5773,8 +6294,6 @@ PEMEncoder.prototype.encode = function encode(data, options) { /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(5606); -/* provided dependency */ var console = __webpack_require__(6763); // Currently in sync with Node.js lib/assert.js // https://github.com/nodejs/node/commit/2a51ae424a513ec9a6aa3466baa0cc1d55dd4f3b @@ -6372,7 +6891,6 @@ assert.strict.strict = assert.strict; /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(5606); // Currently in sync with Node.js lib/internal/assert/assertion_error.js // https://github.com/nodejs/node/commit/0817840f775032169ddd70c85ac059f18ffcc81c @@ -8452,6 +8970,133 @@ module.exports = { } +/***/ }), + +/***/ 5364: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +// base-x encoding / decoding +// Copyright (c) 2018 base-x contributors +// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp) +// Distributed under the MIT software license, see the accompanying +// file LICENSE or http://www.opensource.org/licenses/mit-license.php. +// @ts-ignore +var _Buffer = (__webpack_require__(2861).Buffer) +function base (ALPHABET) { + if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') } + var BASE_MAP = new Uint8Array(256) + for (var j = 0; j < BASE_MAP.length; j++) { + BASE_MAP[j] = 255 + } + for (var i = 0; i < ALPHABET.length; i++) { + var x = ALPHABET.charAt(i) + var xc = x.charCodeAt(0) + if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') } + BASE_MAP[xc] = i + } + var BASE = ALPHABET.length + var LEADER = ALPHABET.charAt(0) + var FACTOR = Math.log(BASE) / Math.log(256) // log(BASE) / log(256), rounded up + var iFACTOR = Math.log(256) / Math.log(BASE) // log(256) / log(BASE), rounded up + function encode (source) { + if (Array.isArray(source) || source instanceof Uint8Array) { source = _Buffer.from(source) } + if (!_Buffer.isBuffer(source)) { throw new TypeError('Expected Buffer') } + if (source.length === 0) { return '' } + // Skip & count leading zeroes. + var zeroes = 0 + var length = 0 + var pbegin = 0 + var pend = source.length + while (pbegin !== pend && source[pbegin] === 0) { + pbegin++ + zeroes++ + } + // Allocate enough space in big-endian base58 representation. + var size = ((pend - pbegin) * iFACTOR + 1) >>> 0 + var b58 = new Uint8Array(size) + // Process the bytes. + while (pbegin !== pend) { + var carry = source[pbegin] + // Apply "b58 = b58 * 256 + ch". + var i = 0 + for (var it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) { + carry += (256 * b58[it1]) >>> 0 + b58[it1] = (carry % BASE) >>> 0 + carry = (carry / BASE) >>> 0 + } + if (carry !== 0) { throw new Error('Non-zero carry') } + length = i + pbegin++ + } + // Skip leading zeroes in base58 result. + var it2 = size - length + while (it2 !== size && b58[it2] === 0) { + it2++ + } + // Translate the result into a string. + var str = LEADER.repeat(zeroes) + for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]) } + return str + } + function decodeUnsafe (source) { + if (typeof source !== 'string') { throw new TypeError('Expected String') } + if (source.length === 0) { return _Buffer.alloc(0) } + var psz = 0 + // Skip and count leading '1's. + var zeroes = 0 + var length = 0 + while (source[psz] === LEADER) { + zeroes++ + psz++ + } + // Allocate enough space in big-endian base256 representation. + var size = (((source.length - psz) * FACTOR) + 1) >>> 0 // log(58) / log(256), rounded up. + var b256 = new Uint8Array(size) + // Process the characters. + while (psz < source.length) { + // Decode character + var carry = BASE_MAP[source.charCodeAt(psz)] + // Invalid character + if (carry === 255) { return } + var i = 0 + for (var it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) { + carry += (BASE * b256[it3]) >>> 0 + b256[it3] = (carry % 256) >>> 0 + carry = (carry / 256) >>> 0 + } + if (carry !== 0) { throw new Error('Non-zero carry') } + length = i + psz++ + } + // Skip leading zeroes in b256. + var it4 = size - length + while (it4 !== size && b256[it4] === 0) { + it4++ + } + var vch = _Buffer.allocUnsafe(zeroes + (size - it4)) + vch.fill(0x00, 0, zeroes) + var j = zeroes + while (it4 !== size) { + vch[j++] = b256[it4++] + } + return vch + } + function decode (string) { + var buffer = decodeUnsafe(string) + if (buffer) { return buffer } + throw new Error('Non-base' + BASE + ' character') + } + return { + encode: encode, + decodeUnsafe: decodeUnsafe, + decode: decode + } +} +module.exports = base + + /***/ }), /***/ 7526: @@ -8610,1468 +9255,6 @@ function fromByteArray (uint8) { } -/***/ }), - -/***/ 2096: -/***/ ((module, exports, __webpack_require__) => { - -/* module decorator */ module = __webpack_require__.nmd(module); -var __WEBPACK_AMD_DEFINE_RESULT__;var bigInt = (function (undefined) { - "use strict"; - - var BASE = 1e7, - LOG_BASE = 7, - MAX_INT = 9007199254740992, - MAX_INT_ARR = smallToArray(MAX_INT), - DEFAULT_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz"; - - var supportsNativeBigInt = typeof BigInt === "function"; - - function Integer(v, radix, alphabet, caseSensitive) { - if (typeof v === "undefined") return Integer[0]; - if (typeof radix !== "undefined") return +radix === 10 && !alphabet ? parseValue(v) : parseBase(v, radix, alphabet, caseSensitive); - return parseValue(v); - } - - function BigInteger(value, sign) { - this.value = value; - this.sign = sign; - this.isSmall = false; - } - BigInteger.prototype = Object.create(Integer.prototype); - - function SmallInteger(value) { - this.value = value; - this.sign = value < 0; - this.isSmall = true; - } - SmallInteger.prototype = Object.create(Integer.prototype); - - function NativeBigInt(value) { - this.value = value; - } - NativeBigInt.prototype = Object.create(Integer.prototype); - - function isPrecise(n) { - return -MAX_INT < n && n < MAX_INT; - } - - function smallToArray(n) { // For performance reasons doesn't reference BASE, need to change this function if BASE changes - if (n < 1e7) - return [n]; - if (n < 1e14) - return [n % 1e7, Math.floor(n / 1e7)]; - return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)]; - } - - function arrayToSmall(arr) { // If BASE changes this function may need to change - trim(arr); - var length = arr.length; - if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) { - switch (length) { - case 0: return 0; - case 1: return arr[0]; - case 2: return arr[0] + arr[1] * BASE; - default: return arr[0] + (arr[1] + arr[2] * BASE) * BASE; - } - } - return arr; - } - - function trim(v) { - var i = v.length; - while (v[--i] === 0); - v.length = i + 1; - } - - function createArray(length) { // function shamelessly stolen from Yaffle's library https://github.com/Yaffle/BigInteger - var x = new Array(length); - var i = -1; - while (++i < length) { - x[i] = 0; - } - return x; - } - - function truncate(n) { - if (n > 0) return Math.floor(n); - return Math.ceil(n); - } - - function add(a, b) { // assumes a and b are arrays with a.length >= b.length - var l_a = a.length, - l_b = b.length, - r = new Array(l_a), - carry = 0, - base = BASE, - sum, i; - for (i = 0; i < l_b; i++) { - sum = a[i] + b[i] + carry; - carry = sum >= base ? 1 : 0; - r[i] = sum - carry * base; - } - while (i < l_a) { - sum = a[i] + carry; - carry = sum === base ? 1 : 0; - r[i++] = sum - carry * base; - } - if (carry > 0) r.push(carry); - return r; - } - - function addAny(a, b) { - if (a.length >= b.length) return add(a, b); - return add(b, a); - } - - function addSmall(a, carry) { // assumes a is array, carry is number with 0 <= carry < MAX_INT - var l = a.length, - r = new Array(l), - base = BASE, - sum, i; - for (i = 0; i < l; i++) { - sum = a[i] - base + carry; - carry = Math.floor(sum / base); - r[i] = sum - carry * base; - carry += 1; - } - while (carry > 0) { - r[i++] = carry % base; - carry = Math.floor(carry / base); - } - return r; - } - - BigInteger.prototype.add = function (v) { - var n = parseValue(v); - if (this.sign !== n.sign) { - return this.subtract(n.negate()); - } - var a = this.value, b = n.value; - if (n.isSmall) { - return new BigInteger(addSmall(a, Math.abs(b)), this.sign); - } - return new BigInteger(addAny(a, b), this.sign); - }; - BigInteger.prototype.plus = BigInteger.prototype.add; - - SmallInteger.prototype.add = function (v) { - var n = parseValue(v); - var a = this.value; - if (a < 0 !== n.sign) { - return this.subtract(n.negate()); - } - var b = n.value; - if (n.isSmall) { - if (isPrecise(a + b)) return new SmallInteger(a + b); - b = smallToArray(Math.abs(b)); - } - return new BigInteger(addSmall(b, Math.abs(a)), a < 0); - }; - SmallInteger.prototype.plus = SmallInteger.prototype.add; - - NativeBigInt.prototype.add = function (v) { - return new NativeBigInt(this.value + parseValue(v).value); - } - NativeBigInt.prototype.plus = NativeBigInt.prototype.add; - - function subtract(a, b) { // assumes a and b are arrays with a >= b - var a_l = a.length, - b_l = b.length, - r = new Array(a_l), - borrow = 0, - base = BASE, - i, difference; - for (i = 0; i < b_l; i++) { - difference = a[i] - borrow - b[i]; - if (difference < 0) { - difference += base; - borrow = 1; - } else borrow = 0; - r[i] = difference; - } - for (i = b_l; i < a_l; i++) { - difference = a[i] - borrow; - if (difference < 0) difference += base; - else { - r[i++] = difference; - break; - } - r[i] = difference; - } - for (; i < a_l; i++) { - r[i] = a[i]; - } - trim(r); - return r; - } - - function subtractAny(a, b, sign) { - var value; - if (compareAbs(a, b) >= 0) { - value = subtract(a, b); - } else { - value = subtract(b, a); - sign = !sign; - } - value = arrayToSmall(value); - if (typeof value === "number") { - if (sign) value = -value; - return new SmallInteger(value); - } - return new BigInteger(value, sign); - } - - function subtractSmall(a, b, sign) { // assumes a is array, b is number with 0 <= b < MAX_INT - var l = a.length, - r = new Array(l), - carry = -b, - base = BASE, - i, difference; - for (i = 0; i < l; i++) { - difference = a[i] + carry; - carry = Math.floor(difference / base); - difference %= base; - r[i] = difference < 0 ? difference + base : difference; - } - r = arrayToSmall(r); - if (typeof r === "number") { - if (sign) r = -r; - return new SmallInteger(r); - } return new BigInteger(r, sign); - } - - BigInteger.prototype.subtract = function (v) { - var n = parseValue(v); - if (this.sign !== n.sign) { - return this.add(n.negate()); - } - var a = this.value, b = n.value; - if (n.isSmall) - return subtractSmall(a, Math.abs(b), this.sign); - return subtractAny(a, b, this.sign); - }; - BigInteger.prototype.minus = BigInteger.prototype.subtract; - - SmallInteger.prototype.subtract = function (v) { - var n = parseValue(v); - var a = this.value; - if (a < 0 !== n.sign) { - return this.add(n.negate()); - } - var b = n.value; - if (n.isSmall) { - return new SmallInteger(a - b); - } - return subtractSmall(b, Math.abs(a), a >= 0); - }; - SmallInteger.prototype.minus = SmallInteger.prototype.subtract; - - NativeBigInt.prototype.subtract = function (v) { - return new NativeBigInt(this.value - parseValue(v).value); - } - NativeBigInt.prototype.minus = NativeBigInt.prototype.subtract; - - BigInteger.prototype.negate = function () { - return new BigInteger(this.value, !this.sign); - }; - SmallInteger.prototype.negate = function () { - var sign = this.sign; - var small = new SmallInteger(-this.value); - small.sign = !sign; - return small; - }; - NativeBigInt.prototype.negate = function () { - return new NativeBigInt(-this.value); - } - - BigInteger.prototype.abs = function () { - return new BigInteger(this.value, false); - }; - SmallInteger.prototype.abs = function () { - return new SmallInteger(Math.abs(this.value)); - }; - NativeBigInt.prototype.abs = function () { - return new NativeBigInt(this.value >= 0 ? this.value : -this.value); - } - - - function multiplyLong(a, b) { - var a_l = a.length, - b_l = b.length, - l = a_l + b_l, - r = createArray(l), - base = BASE, - product, carry, i, a_i, b_j; - for (i = 0; i < a_l; ++i) { - a_i = a[i]; - for (var j = 0; j < b_l; ++j) { - b_j = b[j]; - product = a_i * b_j + r[i + j]; - carry = Math.floor(product / base); - r[i + j] = product - carry * base; - r[i + j + 1] += carry; - } - } - trim(r); - return r; - } - - function multiplySmall(a, b) { // assumes a is array, b is number with |b| < BASE - var l = a.length, - r = new Array(l), - base = BASE, - carry = 0, - product, i; - for (i = 0; i < l; i++) { - product = a[i] * b + carry; - carry = Math.floor(product / base); - r[i] = product - carry * base; - } - while (carry > 0) { - r[i++] = carry % base; - carry = Math.floor(carry / base); - } - return r; - } - - function shiftLeft(x, n) { - var r = []; - while (n-- > 0) r.push(0); - return r.concat(x); - } - - function multiplyKaratsuba(x, y) { - var n = Math.max(x.length, y.length); - - if (n <= 30) return multiplyLong(x, y); - n = Math.ceil(n / 2); - - var b = x.slice(n), - a = x.slice(0, n), - d = y.slice(n), - c = y.slice(0, n); - - var ac = multiplyKaratsuba(a, c), - bd = multiplyKaratsuba(b, d), - abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d)); - - var product = addAny(addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)), shiftLeft(bd, 2 * n)); - trim(product); - return product; - } - - // The following function is derived from a surface fit of a graph plotting the performance difference - // between long multiplication and karatsuba multiplication versus the lengths of the two arrays. - function useKaratsuba(l1, l2) { - return -0.012 * l1 - 0.012 * l2 + 0.000015 * l1 * l2 > 0; - } - - BigInteger.prototype.multiply = function (v) { - var n = parseValue(v), - a = this.value, b = n.value, - sign = this.sign !== n.sign, - abs; - if (n.isSmall) { - if (b === 0) return Integer[0]; - if (b === 1) return this; - if (b === -1) return this.negate(); - abs = Math.abs(b); - if (abs < BASE) { - return new BigInteger(multiplySmall(a, abs), sign); - } - b = smallToArray(abs); - } - if (useKaratsuba(a.length, b.length)) // Karatsuba is only faster for certain array sizes - return new BigInteger(multiplyKaratsuba(a, b), sign); - return new BigInteger(multiplyLong(a, b), sign); - }; - - BigInteger.prototype.times = BigInteger.prototype.multiply; - - function multiplySmallAndArray(a, b, sign) { // a >= 0 - if (a < BASE) { - return new BigInteger(multiplySmall(b, a), sign); - } - return new BigInteger(multiplyLong(b, smallToArray(a)), sign); - } - SmallInteger.prototype._multiplyBySmall = function (a) { - if (isPrecise(a.value * this.value)) { - return new SmallInteger(a.value * this.value); - } - return multiplySmallAndArray(Math.abs(a.value), smallToArray(Math.abs(this.value)), this.sign !== a.sign); - }; - BigInteger.prototype._multiplyBySmall = function (a) { - if (a.value === 0) return Integer[0]; - if (a.value === 1) return this; - if (a.value === -1) return this.negate(); - return multiplySmallAndArray(Math.abs(a.value), this.value, this.sign !== a.sign); - }; - SmallInteger.prototype.multiply = function (v) { - return parseValue(v)._multiplyBySmall(this); - }; - SmallInteger.prototype.times = SmallInteger.prototype.multiply; - - NativeBigInt.prototype.multiply = function (v) { - return new NativeBigInt(this.value * parseValue(v).value); - } - NativeBigInt.prototype.times = NativeBigInt.prototype.multiply; - - function square(a) { - //console.assert(2 * BASE * BASE < MAX_INT); - var l = a.length, - r = createArray(l + l), - base = BASE, - product, carry, i, a_i, a_j; - for (i = 0; i < l; i++) { - a_i = a[i]; - carry = 0 - a_i * a_i; - for (var j = i; j < l; j++) { - a_j = a[j]; - product = 2 * (a_i * a_j) + r[i + j] + carry; - carry = Math.floor(product / base); - r[i + j] = product - carry * base; - } - r[i + l] = carry; - } - trim(r); - return r; - } - - BigInteger.prototype.square = function () { - return new BigInteger(square(this.value), false); - }; - - SmallInteger.prototype.square = function () { - var value = this.value * this.value; - if (isPrecise(value)) return new SmallInteger(value); - return new BigInteger(square(smallToArray(Math.abs(this.value))), false); - }; - - NativeBigInt.prototype.square = function (v) { - return new NativeBigInt(this.value * this.value); - } - - function divMod1(a, b) { // Left over from previous version. Performs faster than divMod2 on smaller input sizes. - var a_l = a.length, - b_l = b.length, - base = BASE, - result = createArray(b.length), - divisorMostSignificantDigit = b[b_l - 1], - // normalization - lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)), - remainder = multiplySmall(a, lambda), - divisor = multiplySmall(b, lambda), - quotientDigit, shift, carry, borrow, i, l, q; - if (remainder.length <= a_l) remainder.push(0); - divisor.push(0); - divisorMostSignificantDigit = divisor[b_l - 1]; - for (shift = a_l - b_l; shift >= 0; shift--) { - quotientDigit = base - 1; - if (remainder[shift + b_l] !== divisorMostSignificantDigit) { - quotientDigit = Math.floor((remainder[shift + b_l] * base + remainder[shift + b_l - 1]) / divisorMostSignificantDigit); - } - // quotientDigit <= base - 1 - carry = 0; - borrow = 0; - l = divisor.length; - for (i = 0; i < l; i++) { - carry += quotientDigit * divisor[i]; - q = Math.floor(carry / base); - borrow += remainder[shift + i] - (carry - q * base); - carry = q; - if (borrow < 0) { - remainder[shift + i] = borrow + base; - borrow = -1; - } else { - remainder[shift + i] = borrow; - borrow = 0; - } - } - while (borrow !== 0) { - quotientDigit -= 1; - carry = 0; - for (i = 0; i < l; i++) { - carry += remainder[shift + i] - base + divisor[i]; - if (carry < 0) { - remainder[shift + i] = carry + base; - carry = 0; - } else { - remainder[shift + i] = carry; - carry = 1; - } - } - borrow += carry; - } - result[shift] = quotientDigit; - } - // denormalization - remainder = divModSmall(remainder, lambda)[0]; - return [arrayToSmall(result), arrayToSmall(remainder)]; - } - - function divMod2(a, b) { // Implementation idea shamelessly stolen from Silent Matt's library http://silentmatt.com/biginteger/ - // Performs faster than divMod1 on larger input sizes. - var a_l = a.length, - b_l = b.length, - result = [], - part = [], - base = BASE, - guess, xlen, highx, highy, check; - while (a_l) { - part.unshift(a[--a_l]); - trim(part); - if (compareAbs(part, b) < 0) { - result.push(0); - continue; - } - xlen = part.length; - highx = part[xlen - 1] * base + part[xlen - 2]; - highy = b[b_l - 1] * base + b[b_l - 2]; - if (xlen > b_l) { - highx = (highx + 1) * base; - } - guess = Math.ceil(highx / highy); - do { - check = multiplySmall(b, guess); - if (compareAbs(check, part) <= 0) break; - guess--; - } while (guess); - result.push(guess); - part = subtract(part, check); - } - result.reverse(); - return [arrayToSmall(result), arrayToSmall(part)]; - } - - function divModSmall(value, lambda) { - var length = value.length, - quotient = createArray(length), - base = BASE, - i, q, remainder, divisor; - remainder = 0; - for (i = length - 1; i >= 0; --i) { - divisor = remainder * base + value[i]; - q = truncate(divisor / lambda); - remainder = divisor - q * lambda; - quotient[i] = q | 0; - } - return [quotient, remainder | 0]; - } - - function divModAny(self, v) { - var value, n = parseValue(v); - if (supportsNativeBigInt) { - return [new NativeBigInt(self.value / n.value), new NativeBigInt(self.value % n.value)]; - } - var a = self.value, b = n.value; - var quotient; - if (b === 0) throw new Error("Cannot divide by zero"); - if (self.isSmall) { - if (n.isSmall) { - return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)]; - } - return [Integer[0], self]; - } - if (n.isSmall) { - if (b === 1) return [self, Integer[0]]; - if (b == -1) return [self.negate(), Integer[0]]; - var abs = Math.abs(b); - if (abs < BASE) { - value = divModSmall(a, abs); - quotient = arrayToSmall(value[0]); - var remainder = value[1]; - if (self.sign) remainder = -remainder; - if (typeof quotient === "number") { - if (self.sign !== n.sign) quotient = -quotient; - return [new SmallInteger(quotient), new SmallInteger(remainder)]; - } - return [new BigInteger(quotient, self.sign !== n.sign), new SmallInteger(remainder)]; - } - b = smallToArray(abs); - } - var comparison = compareAbs(a, b); - if (comparison === -1) return [Integer[0], self]; - if (comparison === 0) return [Integer[self.sign === n.sign ? 1 : -1], Integer[0]]; - - // divMod1 is faster on smaller input sizes - if (a.length + b.length <= 200) - value = divMod1(a, b); - else value = divMod2(a, b); - - quotient = value[0]; - var qSign = self.sign !== n.sign, - mod = value[1], - mSign = self.sign; - if (typeof quotient === "number") { - if (qSign) quotient = -quotient; - quotient = new SmallInteger(quotient); - } else quotient = new BigInteger(quotient, qSign); - if (typeof mod === "number") { - if (mSign) mod = -mod; - mod = new SmallInteger(mod); - } else mod = new BigInteger(mod, mSign); - return [quotient, mod]; - } - - BigInteger.prototype.divmod = function (v) { - var result = divModAny(this, v); - return { - quotient: result[0], - remainder: result[1] - }; - }; - NativeBigInt.prototype.divmod = SmallInteger.prototype.divmod = BigInteger.prototype.divmod; - - - BigInteger.prototype.divide = function (v) { - return divModAny(this, v)[0]; - }; - NativeBigInt.prototype.over = NativeBigInt.prototype.divide = function (v) { - return new NativeBigInt(this.value / parseValue(v).value); - }; - SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over = BigInteger.prototype.divide; - - BigInteger.prototype.mod = function (v) { - return divModAny(this, v)[1]; - }; - NativeBigInt.prototype.mod = NativeBigInt.prototype.remainder = function (v) { - return new NativeBigInt(this.value % parseValue(v).value); - }; - SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder = BigInteger.prototype.mod; - - BigInteger.prototype.pow = function (v) { - var n = parseValue(v), - a = this.value, - b = n.value, - value, x, y; - if (b === 0) return Integer[1]; - if (a === 0) return Integer[0]; - if (a === 1) return Integer[1]; - if (a === -1) return n.isEven() ? Integer[1] : Integer[-1]; - if (n.sign) { - return Integer[0]; - } - if (!n.isSmall) throw new Error("The exponent " + n.toString() + " is too large."); - if (this.isSmall) { - if (isPrecise(value = Math.pow(a, b))) - return new SmallInteger(truncate(value)); - } - x = this; - y = Integer[1]; - while (true) { - if (b & 1 === 1) { - y = y.times(x); - --b; - } - if (b === 0) break; - b /= 2; - x = x.square(); - } - return y; - }; - SmallInteger.prototype.pow = BigInteger.prototype.pow; - - NativeBigInt.prototype.pow = function (v) { - var n = parseValue(v); - var a = this.value, b = n.value; - var _0 = BigInt(0), _1 = BigInt(1), _2 = BigInt(2); - if (b === _0) return Integer[1]; - if (a === _0) return Integer[0]; - if (a === _1) return Integer[1]; - if (a === BigInt(-1)) return n.isEven() ? Integer[1] : Integer[-1]; - if (n.isNegative()) return new NativeBigInt(_0); - var x = this; - var y = Integer[1]; - while (true) { - if ((b & _1) === _1) { - y = y.times(x); - --b; - } - if (b === _0) break; - b /= _2; - x = x.square(); - } - return y; - } - - BigInteger.prototype.modPow = function (exp, mod) { - exp = parseValue(exp); - mod = parseValue(mod); - if (mod.isZero()) throw new Error("Cannot take modPow with modulus 0"); - var r = Integer[1], - base = this.mod(mod); - if (exp.isNegative()) { - exp = exp.multiply(Integer[-1]); - base = base.modInv(mod); - } - while (exp.isPositive()) { - if (base.isZero()) return Integer[0]; - if (exp.isOdd()) r = r.multiply(base).mod(mod); - exp = exp.divide(2); - base = base.square().mod(mod); - } - return r; - }; - NativeBigInt.prototype.modPow = SmallInteger.prototype.modPow = BigInteger.prototype.modPow; - - function compareAbs(a, b) { - if (a.length !== b.length) { - return a.length > b.length ? 1 : -1; - } - for (var i = a.length - 1; i >= 0; i--) { - if (a[i] !== b[i]) return a[i] > b[i] ? 1 : -1; - } - return 0; - } - - BigInteger.prototype.compareAbs = function (v) { - var n = parseValue(v), - a = this.value, - b = n.value; - if (n.isSmall) return 1; - return compareAbs(a, b); - }; - SmallInteger.prototype.compareAbs = function (v) { - var n = parseValue(v), - a = Math.abs(this.value), - b = n.value; - if (n.isSmall) { - b = Math.abs(b); - return a === b ? 0 : a > b ? 1 : -1; - } - return -1; - }; - NativeBigInt.prototype.compareAbs = function (v) { - var a = this.value; - var b = parseValue(v).value; - a = a >= 0 ? a : -a; - b = b >= 0 ? b : -b; - return a === b ? 0 : a > b ? 1 : -1; - } - - BigInteger.prototype.compare = function (v) { - // See discussion about comparison with Infinity: - // https://github.com/peterolson/BigInteger.js/issues/61 - if (v === Infinity) { - return -1; - } - if (v === -Infinity) { - return 1; - } - - var n = parseValue(v), - a = this.value, - b = n.value; - if (this.sign !== n.sign) { - return n.sign ? 1 : -1; - } - if (n.isSmall) { - return this.sign ? -1 : 1; - } - return compareAbs(a, b) * (this.sign ? -1 : 1); - }; - BigInteger.prototype.compareTo = BigInteger.prototype.compare; - - SmallInteger.prototype.compare = function (v) { - if (v === Infinity) { - return -1; - } - if (v === -Infinity) { - return 1; - } - - var n = parseValue(v), - a = this.value, - b = n.value; - if (n.isSmall) { - return a == b ? 0 : a > b ? 1 : -1; - } - if (a < 0 !== n.sign) { - return a < 0 ? -1 : 1; - } - return a < 0 ? 1 : -1; - }; - SmallInteger.prototype.compareTo = SmallInteger.prototype.compare; - - NativeBigInt.prototype.compare = function (v) { - if (v === Infinity) { - return -1; - } - if (v === -Infinity) { - return 1; - } - var a = this.value; - var b = parseValue(v).value; - return a === b ? 0 : a > b ? 1 : -1; - } - NativeBigInt.prototype.compareTo = NativeBigInt.prototype.compare; - - BigInteger.prototype.equals = function (v) { - return this.compare(v) === 0; - }; - NativeBigInt.prototype.eq = NativeBigInt.prototype.equals = SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq = BigInteger.prototype.equals; - - BigInteger.prototype.notEquals = function (v) { - return this.compare(v) !== 0; - }; - NativeBigInt.prototype.neq = NativeBigInt.prototype.notEquals = SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq = BigInteger.prototype.notEquals; - - BigInteger.prototype.greater = function (v) { - return this.compare(v) > 0; - }; - NativeBigInt.prototype.gt = NativeBigInt.prototype.greater = SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt = BigInteger.prototype.greater; - - BigInteger.prototype.lesser = function (v) { - return this.compare(v) < 0; - }; - NativeBigInt.prototype.lt = NativeBigInt.prototype.lesser = SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt = BigInteger.prototype.lesser; - - BigInteger.prototype.greaterOrEquals = function (v) { - return this.compare(v) >= 0; - }; - NativeBigInt.prototype.geq = NativeBigInt.prototype.greaterOrEquals = SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq = BigInteger.prototype.greaterOrEquals; - - BigInteger.prototype.lesserOrEquals = function (v) { - return this.compare(v) <= 0; - }; - NativeBigInt.prototype.leq = NativeBigInt.prototype.lesserOrEquals = SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq = BigInteger.prototype.lesserOrEquals; - - BigInteger.prototype.isEven = function () { - return (this.value[0] & 1) === 0; - }; - SmallInteger.prototype.isEven = function () { - return (this.value & 1) === 0; - }; - NativeBigInt.prototype.isEven = function () { - return (this.value & BigInt(1)) === BigInt(0); - } - - BigInteger.prototype.isOdd = function () { - return (this.value[0] & 1) === 1; - }; - SmallInteger.prototype.isOdd = function () { - return (this.value & 1) === 1; - }; - NativeBigInt.prototype.isOdd = function () { - return (this.value & BigInt(1)) === BigInt(1); - } - - BigInteger.prototype.isPositive = function () { - return !this.sign; - }; - SmallInteger.prototype.isPositive = function () { - return this.value > 0; - }; - NativeBigInt.prototype.isPositive = SmallInteger.prototype.isPositive; - - BigInteger.prototype.isNegative = function () { - return this.sign; - }; - SmallInteger.prototype.isNegative = function () { - return this.value < 0; - }; - NativeBigInt.prototype.isNegative = SmallInteger.prototype.isNegative; - - BigInteger.prototype.isUnit = function () { - return false; - }; - SmallInteger.prototype.isUnit = function () { - return Math.abs(this.value) === 1; - }; - NativeBigInt.prototype.isUnit = function () { - return this.abs().value === BigInt(1); - } - - BigInteger.prototype.isZero = function () { - return false; - }; - SmallInteger.prototype.isZero = function () { - return this.value === 0; - }; - NativeBigInt.prototype.isZero = function () { - return this.value === BigInt(0); - } - - BigInteger.prototype.isDivisibleBy = function (v) { - var n = parseValue(v); - if (n.isZero()) return false; - if (n.isUnit()) return true; - if (n.compareAbs(2) === 0) return this.isEven(); - return this.mod(n).isZero(); - }; - NativeBigInt.prototype.isDivisibleBy = SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy; - - function isBasicPrime(v) { - var n = v.abs(); - if (n.isUnit()) return false; - if (n.equals(2) || n.equals(3) || n.equals(5)) return true; - if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false; - if (n.lesser(49)) return true; - // we don't know if it's prime: let the other functions figure it out - } - - function millerRabinTest(n, a) { - var nPrev = n.prev(), - b = nPrev, - r = 0, - d, t, i, x; - while (b.isEven()) b = b.divide(2), r++; - next: for (i = 0; i < a.length; i++) { - if (n.lesser(a[i])) continue; - x = bigInt(a[i]).modPow(b, n); - if (x.isUnit() || x.equals(nPrev)) continue; - for (d = r - 1; d != 0; d--) { - x = x.square().mod(n); - if (x.isUnit()) return false; - if (x.equals(nPrev)) continue next; - } - return false; - } - return true; - } - - // Set "strict" to true to force GRH-supported lower bound of 2*log(N)^2 - BigInteger.prototype.isPrime = function (strict) { - var isPrime = isBasicPrime(this); - if (isPrime !== undefined) return isPrime; - var n = this.abs(); - var bits = n.bitLength(); - if (bits <= 64) - return millerRabinTest(n, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]); - var logN = Math.log(2) * bits.toJSNumber(); - var t = Math.ceil((strict === true) ? (2 * Math.pow(logN, 2)) : logN); - for (var a = [], i = 0; i < t; i++) { - a.push(bigInt(i + 2)); - } - return millerRabinTest(n, a); - }; - NativeBigInt.prototype.isPrime = SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime; - - BigInteger.prototype.isProbablePrime = function (iterations, rng) { - var isPrime = isBasicPrime(this); - if (isPrime !== undefined) return isPrime; - var n = this.abs(); - var t = iterations === undefined ? 5 : iterations; - for (var a = [], i = 0; i < t; i++) { - a.push(bigInt.randBetween(2, n.minus(2), rng)); - } - return millerRabinTest(n, a); - }; - NativeBigInt.prototype.isProbablePrime = SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime; - - BigInteger.prototype.modInv = function (n) { - var t = bigInt.zero, newT = bigInt.one, r = parseValue(n), newR = this.abs(), q, lastT, lastR; - while (!newR.isZero()) { - q = r.divide(newR); - lastT = t; - lastR = r; - t = newT; - r = newR; - newT = lastT.subtract(q.multiply(newT)); - newR = lastR.subtract(q.multiply(newR)); - } - if (!r.isUnit()) throw new Error(this.toString() + " and " + n.toString() + " are not co-prime"); - if (t.compare(0) === -1) { - t = t.add(n); - } - if (this.isNegative()) { - return t.negate(); - } - return t; - }; - - NativeBigInt.prototype.modInv = SmallInteger.prototype.modInv = BigInteger.prototype.modInv; - - BigInteger.prototype.next = function () { - var value = this.value; - if (this.sign) { - return subtractSmall(value, 1, this.sign); - } - return new BigInteger(addSmall(value, 1), this.sign); - }; - SmallInteger.prototype.next = function () { - var value = this.value; - if (value + 1 < MAX_INT) return new SmallInteger(value + 1); - return new BigInteger(MAX_INT_ARR, false); - }; - NativeBigInt.prototype.next = function () { - return new NativeBigInt(this.value + BigInt(1)); - } - - BigInteger.prototype.prev = function () { - var value = this.value; - if (this.sign) { - return new BigInteger(addSmall(value, 1), true); - } - return subtractSmall(value, 1, this.sign); - }; - SmallInteger.prototype.prev = function () { - var value = this.value; - if (value - 1 > -MAX_INT) return new SmallInteger(value - 1); - return new BigInteger(MAX_INT_ARR, true); - }; - NativeBigInt.prototype.prev = function () { - return new NativeBigInt(this.value - BigInt(1)); - } - - var powersOfTwo = [1]; - while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE) powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]); - var powers2Length = powersOfTwo.length, highestPower2 = powersOfTwo[powers2Length - 1]; - - function shift_isSmall(n) { - return Math.abs(n) <= BASE; - } - - BigInteger.prototype.shiftLeft = function (v) { - var n = parseValue(v).toJSNumber(); - if (!shift_isSmall(n)) { - throw new Error(String(n) + " is too large for shifting."); - } - if (n < 0) return this.shiftRight(-n); - var result = this; - if (result.isZero()) return result; - while (n >= powers2Length) { - result = result.multiply(highestPower2); - n -= powers2Length - 1; - } - return result.multiply(powersOfTwo[n]); - }; - NativeBigInt.prototype.shiftLeft = SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft; - - BigInteger.prototype.shiftRight = function (v) { - var remQuo; - var n = parseValue(v).toJSNumber(); - if (!shift_isSmall(n)) { - throw new Error(String(n) + " is too large for shifting."); - } - if (n < 0) return this.shiftLeft(-n); - var result = this; - while (n >= powers2Length) { - if (result.isZero() || (result.isNegative() && result.isUnit())) return result; - remQuo = divModAny(result, highestPower2); - result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0]; - n -= powers2Length - 1; - } - remQuo = divModAny(result, powersOfTwo[n]); - return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0]; - }; - NativeBigInt.prototype.shiftRight = SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight; - - function bitwise(x, y, fn) { - y = parseValue(y); - var xSign = x.isNegative(), ySign = y.isNegative(); - var xRem = xSign ? x.not() : x, - yRem = ySign ? y.not() : y; - var xDigit = 0, yDigit = 0; - var xDivMod = null, yDivMod = null; - var result = []; - while (!xRem.isZero() || !yRem.isZero()) { - xDivMod = divModAny(xRem, highestPower2); - xDigit = xDivMod[1].toJSNumber(); - if (xSign) { - xDigit = highestPower2 - 1 - xDigit; // two's complement for negative numbers - } - - yDivMod = divModAny(yRem, highestPower2); - yDigit = yDivMod[1].toJSNumber(); - if (ySign) { - yDigit = highestPower2 - 1 - yDigit; // two's complement for negative numbers - } - - xRem = xDivMod[0]; - yRem = yDivMod[0]; - result.push(fn(xDigit, yDigit)); - } - var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0); - for (var i = result.length - 1; i >= 0; i -= 1) { - sum = sum.multiply(highestPower2).add(bigInt(result[i])); - } - return sum; - } - - BigInteger.prototype.not = function () { - return this.negate().prev(); - }; - NativeBigInt.prototype.not = SmallInteger.prototype.not = BigInteger.prototype.not; - - BigInteger.prototype.and = function (n) { - return bitwise(this, n, function (a, b) { return a & b; }); - }; - NativeBigInt.prototype.and = SmallInteger.prototype.and = BigInteger.prototype.and; - - BigInteger.prototype.or = function (n) { - return bitwise(this, n, function (a, b) { return a | b; }); - }; - NativeBigInt.prototype.or = SmallInteger.prototype.or = BigInteger.prototype.or; - - BigInteger.prototype.xor = function (n) { - return bitwise(this, n, function (a, b) { return a ^ b; }); - }; - NativeBigInt.prototype.xor = SmallInteger.prototype.xor = BigInteger.prototype.xor; - - var LOBMASK_I = 1 << 30, LOBMASK_BI = (BASE & -BASE) * (BASE & -BASE) | LOBMASK_I; - function roughLOB(n) { // get lowestOneBit (rough) - // SmallInteger: return Min(lowestOneBit(n), 1 << 30) - // BigInteger: return Min(lowestOneBit(n), 1 << 14) [BASE=1e7] - var v = n.value, - x = typeof v === "number" ? v | LOBMASK_I : - typeof v === "bigint" ? v | BigInt(LOBMASK_I) : - v[0] + v[1] * BASE | LOBMASK_BI; - return x & -x; - } - - function integerLogarithm(value, base) { - if (base.compareTo(value) <= 0) { - var tmp = integerLogarithm(value, base.square(base)); - var p = tmp.p; - var e = tmp.e; - var t = p.multiply(base); - return t.compareTo(value) <= 0 ? { p: t, e: e * 2 + 1 } : { p: p, e: e * 2 }; - } - return { p: bigInt(1), e: 0 }; - } - - BigInteger.prototype.bitLength = function () { - var n = this; - if (n.compareTo(bigInt(0)) < 0) { - n = n.negate().subtract(bigInt(1)); - } - if (n.compareTo(bigInt(0)) === 0) { - return bigInt(0); - } - return bigInt(integerLogarithm(n, bigInt(2)).e).add(bigInt(1)); - } - NativeBigInt.prototype.bitLength = SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength; - - function max(a, b) { - a = parseValue(a); - b = parseValue(b); - return a.greater(b) ? a : b; - } - function min(a, b) { - a = parseValue(a); - b = parseValue(b); - return a.lesser(b) ? a : b; - } - function gcd(a, b) { - a = parseValue(a).abs(); - b = parseValue(b).abs(); - if (a.equals(b)) return a; - if (a.isZero()) return b; - if (b.isZero()) return a; - var c = Integer[1], d, t; - while (a.isEven() && b.isEven()) { - d = min(roughLOB(a), roughLOB(b)); - a = a.divide(d); - b = b.divide(d); - c = c.multiply(d); - } - while (a.isEven()) { - a = a.divide(roughLOB(a)); - } - do { - while (b.isEven()) { - b = b.divide(roughLOB(b)); - } - if (a.greater(b)) { - t = b; b = a; a = t; - } - b = b.subtract(a); - } while (!b.isZero()); - return c.isUnit() ? a : a.multiply(c); - } - function lcm(a, b) { - a = parseValue(a).abs(); - b = parseValue(b).abs(); - return a.divide(gcd(a, b)).multiply(b); - } - function randBetween(a, b, rng) { - a = parseValue(a); - b = parseValue(b); - var usedRNG = rng || Math.random; - var low = min(a, b), high = max(a, b); - var range = high.subtract(low).add(1); - if (range.isSmall) return low.add(Math.floor(usedRNG() * range)); - var digits = toBase(range, BASE).value; - var result = [], restricted = true; - for (var i = 0; i < digits.length; i++) { - var top = restricted ? digits[i] + (i + 1 < digits.length ? digits[i + 1] / BASE : 0) : BASE; - var digit = truncate(usedRNG() * top); - result.push(digit); - if (digit < digits[i]) restricted = false; - } - return low.add(Integer.fromArray(result, BASE, false)); - } - - var parseBase = function (text, base, alphabet, caseSensitive) { - alphabet = alphabet || DEFAULT_ALPHABET; - text = String(text); - if (!caseSensitive) { - text = text.toLowerCase(); - alphabet = alphabet.toLowerCase(); - } - var length = text.length; - var i; - var absBase = Math.abs(base); - var alphabetValues = {}; - for (i = 0; i < alphabet.length; i++) { - alphabetValues[alphabet[i]] = i; - } - for (i = 0; i < length; i++) { - var c = text[i]; - if (c === "-") continue; - if (c in alphabetValues) { - if (alphabetValues[c] >= absBase) { - if (c === "1" && absBase === 1) continue; - throw new Error(c + " is not a valid digit in base " + base + "."); - } - } - } - base = parseValue(base); - var digits = []; - var isNegative = text[0] === "-"; - for (i = isNegative ? 1 : 0; i < text.length; i++) { - var c = text[i]; - if (c in alphabetValues) digits.push(parseValue(alphabetValues[c])); - else if (c === "<") { - var start = i; - do { i++; } while (text[i] !== ">" && i < text.length); - digits.push(parseValue(text.slice(start + 1, i))); - } - else throw new Error(c + " is not a valid character"); - } - return parseBaseFromArray(digits, base, isNegative); - }; - - function parseBaseFromArray(digits, base, isNegative) { - var val = Integer[0], pow = Integer[1], i; - for (i = digits.length - 1; i >= 0; i--) { - val = val.add(digits[i].times(pow)); - pow = pow.times(base); - } - return isNegative ? val.negate() : val; - } - - function stringify(digit, alphabet) { - alphabet = alphabet || DEFAULT_ALPHABET; - if (digit < alphabet.length) { - return alphabet[digit]; - } - return "<" + digit + ">"; - } - - function toBase(n, base) { - base = bigInt(base); - if (base.isZero()) { - if (n.isZero()) return { value: [0], isNegative: false }; - throw new Error("Cannot convert nonzero numbers to base 0."); - } - if (base.equals(-1)) { - if (n.isZero()) return { value: [0], isNegative: false }; - if (n.isNegative()) - return { - value: [].concat.apply([], Array.apply(null, Array(-n.toJSNumber())) - .map(Array.prototype.valueOf, [1, 0]) - ), - isNegative: false - }; - - var arr = Array.apply(null, Array(n.toJSNumber() - 1)) - .map(Array.prototype.valueOf, [0, 1]); - arr.unshift([1]); - return { - value: [].concat.apply([], arr), - isNegative: false - }; - } - - var neg = false; - if (n.isNegative() && base.isPositive()) { - neg = true; - n = n.abs(); - } - if (base.isUnit()) { - if (n.isZero()) return { value: [0], isNegative: false }; - - return { - value: Array.apply(null, Array(n.toJSNumber())) - .map(Number.prototype.valueOf, 1), - isNegative: neg - }; - } - var out = []; - var left = n, divmod; - while (left.isNegative() || left.compareAbs(base) >= 0) { - divmod = left.divmod(base); - left = divmod.quotient; - var digit = divmod.remainder; - if (digit.isNegative()) { - digit = base.minus(digit).abs(); - left = left.next(); - } - out.push(digit.toJSNumber()); - } - out.push(left.toJSNumber()); - return { value: out.reverse(), isNegative: neg }; - } - - function toBaseString(n, base, alphabet) { - var arr = toBase(n, base); - return (arr.isNegative ? "-" : "") + arr.value.map(function (x) { - return stringify(x, alphabet); - }).join(''); - } - - BigInteger.prototype.toArray = function (radix) { - return toBase(this, radix); - }; - - SmallInteger.prototype.toArray = function (radix) { - return toBase(this, radix); - }; - - NativeBigInt.prototype.toArray = function (radix) { - return toBase(this, radix); - }; - - BigInteger.prototype.toString = function (radix, alphabet) { - if (radix === undefined) radix = 10; - if (radix !== 10 || alphabet) return toBaseString(this, radix, alphabet); - var v = this.value, l = v.length, str = String(v[--l]), zeros = "0000000", digit; - while (--l >= 0) { - digit = String(v[l]); - str += zeros.slice(digit.length) + digit; - } - var sign = this.sign ? "-" : ""; - return sign + str; - }; - - SmallInteger.prototype.toString = function (radix, alphabet) { - if (radix === undefined) radix = 10; - if (radix != 10 || alphabet) return toBaseString(this, radix, alphabet); - return String(this.value); - }; - - NativeBigInt.prototype.toString = SmallInteger.prototype.toString; - - NativeBigInt.prototype.toJSON = BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function () { return this.toString(); } - - BigInteger.prototype.valueOf = function () { - return parseInt(this.toString(), 10); - }; - BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf; - - SmallInteger.prototype.valueOf = function () { - return this.value; - }; - SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf; - NativeBigInt.prototype.valueOf = NativeBigInt.prototype.toJSNumber = function () { - return parseInt(this.toString(), 10); - } - - function parseStringValue(v) { - if (isPrecise(+v)) { - var x = +v; - if (x === truncate(x)) - return supportsNativeBigInt ? new NativeBigInt(BigInt(x)) : new SmallInteger(x); - throw new Error("Invalid integer: " + v); - } - var sign = v[0] === "-"; - if (sign) v = v.slice(1); - var split = v.split(/e/i); - if (split.length > 2) throw new Error("Invalid integer: " + split.join("e")); - if (split.length === 2) { - var exp = split[1]; - if (exp[0] === "+") exp = exp.slice(1); - exp = +exp; - if (exp !== truncate(exp) || !isPrecise(exp)) throw new Error("Invalid integer: " + exp + " is not a valid exponent."); - var text = split[0]; - var decimalPlace = text.indexOf("."); - if (decimalPlace >= 0) { - exp -= text.length - decimalPlace - 1; - text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1); - } - if (exp < 0) throw new Error("Cannot include negative exponent part for integers"); - text += (new Array(exp + 1)).join("0"); - v = text; - } - var isValid = /^([0-9][0-9]*)$/.test(v); - if (!isValid) throw new Error("Invalid integer: " + v); - if (supportsNativeBigInt) { - return new NativeBigInt(BigInt(sign ? "-" + v : v)); - } - var r = [], max = v.length, l = LOG_BASE, min = max - l; - while (max > 0) { - r.push(+v.slice(min, max)); - min -= l; - if (min < 0) min = 0; - max -= l; - } - trim(r); - return new BigInteger(r, sign); - } - - function parseNumberValue(v) { - if (supportsNativeBigInt) { - return new NativeBigInt(BigInt(v)); - } - if (isPrecise(v)) { - if (v !== truncate(v)) throw new Error(v + " is not an integer."); - return new SmallInteger(v); - } - return parseStringValue(v.toString()); - } - - function parseValue(v) { - if (typeof v === "number") { - return parseNumberValue(v); - } - if (typeof v === "string") { - return parseStringValue(v); - } - if (typeof v === "bigint") { - return new NativeBigInt(v); - } - return v; - } - // Pre-define numbers in range [-999,999] - for (var i = 0; i < 1000; i++) { - Integer[i] = parseValue(i); - if (i > 0) Integer[-i] = parseValue(-i); - } - // Backwards compatibility - Integer.one = Integer[1]; - Integer.zero = Integer[0]; - Integer.minusOne = Integer[-1]; - Integer.max = max; - Integer.min = min; - Integer.gcd = gcd; - Integer.lcm = lcm; - Integer.isInstance = function (x) { return x instanceof BigInteger || x instanceof SmallInteger || x instanceof NativeBigInt; }; - Integer.randBetween = randBetween; - - Integer.fromArray = function (digits, base, isNegative) { - return parseBaseFromArray(digits.map(parseValue), parseValue(base || 10), isNegative); - }; - - return Integer; -})(); - -// Node.js check -if ( true && module.hasOwnProperty("exports")) { - module.exports = bigInt; -} - -//amd check -if (true) { - !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () { - return bigInt; - }).call(exports, __webpack_require__, exports, module), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); -} - - /***/ }), /***/ 654: @@ -10085,7 +9268,7 @@ module.exports = __webpack_require__(5702)(__webpack_require__(6989)) /***/ 4315: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(8287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(2045)["hp"]; const Transform = (__webpack_require__(8399).Transform) module.exports = class Blake extends Transform { @@ -10172,7 +9355,7 @@ module.exports = (engines) => { /***/ 4588: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(8287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(2045)["hp"]; class Blake { _lengthCarry (arr) { for (let j = 0; j < arr.length; ++j) { @@ -10256,7 +9439,7 @@ module.exports = Blake /***/ 8746: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(8287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(2045)["hp"]; const Blake256 = __webpack_require__(3287) const zo = Buffer.from([0x00]) @@ -10290,7 +9473,7 @@ module.exports = class Blake224 extends Blake256 { /***/ 3287: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(8287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(2045)["hp"]; const Blake = __webpack_require__(4588) const zo = Buffer.from([0x01]) @@ -10419,7 +9602,7 @@ module.exports = class Blake256 extends Blake { /***/ 399: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(8287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(2045)["hp"]; const Blake512 = __webpack_require__(1070) const zo = Buffer.from([0x00]) @@ -10455,7 +9638,7 @@ module.exports = class Blake384 extends Blake512 { /***/ 1070: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(8287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(2045)["hp"]; const Blake = __webpack_require__(4588) const zo = Buffer.from([0x01]) @@ -15757,7 +14940,7 @@ module.exports = modes /***/ 6843: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(8287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(2045)["hp"]; var xor = __webpack_require__(295) function getBlock (self) { @@ -15977,7 +15160,7 @@ exports["des-ede"] = { /***/ 7332: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(8287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(2045)["hp"]; var BN = __webpack_require__(9404) var randomBytes = __webpack_require__(3209) @@ -16588,7 +15771,6 @@ PassThrough.prototype._transform = function (chunk, encoding, cb) { /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(5606); // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -17836,7 +17018,6 @@ function done(stream, er, data) { /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(5606); // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -19167,7 +18348,7 @@ SafeBuffer.allocUnsafeSlow = function (size) { /***/ 295: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(8287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(2045)["hp"]; module.exports = function xor (a, b) { var length = Math.min(a.length, b.length) var buffer = new Buffer(length) @@ -19186,7 +18367,6 @@ module.exports = function xor (a, b) { /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var console = __webpack_require__(6763); /*! * The buffer module from node.js, for the browser. * @@ -19197,9 +18377,9 @@ module.exports = function xor (a, b) { -const base64 = __webpack_require__(7526) -const ieee754 = __webpack_require__(251) -const customInspectSymbol = +var base64 = __webpack_require__(7526) +var ieee754 = __webpack_require__(251) +var 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 @@ -19208,7 +18388,7 @@ exports.Buffer = Buffer exports.SlowBuffer = SlowBuffer exports.INSPECT_MAX_BYTES = 50 -const K_MAX_LENGTH = 0x7fffffff +var K_MAX_LENGTH = 0x7fffffff exports.kMaxLength = K_MAX_LENGTH /** @@ -19238,8 +18418,8 @@ if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && function typedArraySupport () { // Can typed array instances can be augmented? try { - const arr = new Uint8Array(1) - const proto = { foo: function () { return 42 } } + var arr = new Uint8Array(1) + var proto = { foo: function () { return 42 } } Object.setPrototypeOf(proto, Uint8Array.prototype) Object.setPrototypeOf(arr, proto) return arr.foo() === 42 @@ -19269,7 +18449,7 @@ function createBuffer (length) { throw new RangeError('The value "' + length + '" is invalid for option "size"') } // Return an augmented `Uint8Array` instance - const buf = new Uint8Array(length) + var buf = new Uint8Array(length) Object.setPrototypeOf(buf, Buffer.prototype) return buf } @@ -19332,17 +18512,19 @@ function from (value, encodingOrOffset, length) { ) } - const valueOf = value.valueOf && value.valueOf() + var valueOf = value.valueOf && value.valueOf() if (valueOf != null && valueOf !== value) { return Buffer.from(valueOf, encodingOrOffset, length) } - const b = fromObject(value) + var 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) + return Buffer.from( + value[Symbol.toPrimitive]('string'), encodingOrOffset, length + ) } throw new TypeError( @@ -19427,10 +18609,10 @@ function fromString (string, encoding) { throw new TypeError('Unknown encoding: ' + encoding) } - const length = byteLength(string, encoding) | 0 - let buf = createBuffer(length) + var length = byteLength(string, encoding) | 0 + var buf = createBuffer(length) - const actual = buf.write(string, encoding) + var actual = buf.write(string, encoding) if (actual !== length) { // Writing a hex string, for example, that contains invalid characters will @@ -19443,9 +18625,9 @@ function fromString (string, encoding) { } 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) { + var length = array.length < 0 ? 0 : checked(array.length) | 0 + var buf = createBuffer(length) + for (var i = 0; i < length; i += 1) { buf[i] = array[i] & 255 } return buf @@ -19453,7 +18635,7 @@ function fromArrayLike (array) { function fromArrayView (arrayView) { if (isInstance(arrayView, Uint8Array)) { - const copy = new Uint8Array(arrayView) + var copy = new Uint8Array(arrayView) return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength) } return fromArrayLike(arrayView) @@ -19468,7 +18650,7 @@ function fromArrayBuffer (array, byteOffset, length) { throw new RangeError('"length" is outside of buffer bounds') } - let buf + var buf if (byteOffset === undefined && length === undefined) { buf = new Uint8Array(array) } else if (length === undefined) { @@ -19485,8 +18667,8 @@ function fromArrayBuffer (array, byteOffset, length) { function fromObject (obj) { if (Buffer.isBuffer(obj)) { - const len = checked(obj.length) | 0 - const buf = createBuffer(len) + var len = checked(obj.length) | 0 + var buf = createBuffer(len) if (buf.length === 0) { return buf @@ -19541,10 +18723,10 @@ Buffer.compare = function compare (a, b) { if (a === b) return 0 - let x = a.length - let y = b.length + var x = a.length + var y = b.length - for (let i = 0, len = Math.min(x, y); i < len; ++i) { + for (var i = 0, len = Math.min(x, y); i < len; ++i) { if (a[i] !== b[i]) { x = a[i] y = b[i] @@ -19585,7 +18767,7 @@ Buffer.concat = function concat (list, length) { return Buffer.alloc(0) } - let i + var i if (length === undefined) { length = 0 for (i = 0; i < list.length; ++i) { @@ -19593,14 +18775,13 @@ Buffer.concat = function concat (list, length) { } } - const buffer = Buffer.allocUnsafe(length) - let pos = 0 + var buffer = Buffer.allocUnsafe(length) + var pos = 0 for (i = 0; i < list.length; ++i) { - let buf = list[i] + var 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) + Buffer.from(buf).copy(buffer, pos) } else { Uint8Array.prototype.set.call( buffer, @@ -19632,12 +18813,12 @@ function byteLength (string, encoding) { ) } - const len = string.length - const mustMatch = (arguments.length > 2 && arguments[2] === true) + var len = string.length + var mustMatch = (arguments.length > 2 && arguments[2] === true) if (!mustMatch && len === 0) return 0 // Use a for loop to avoid recursion - let loweredCase = false + var loweredCase = false for (;;) { switch (encoding) { case 'ascii': @@ -19668,7 +18849,7 @@ function byteLength (string, encoding) { Buffer.byteLength = byteLength function slowToString (encoding, start, end) { - let loweredCase = false + var loweredCase = false // No need to verify that "this.length <= MAX_UINT32" since it's a read-only // property of a typed array. @@ -19746,28 +18927,28 @@ function slowToString (encoding, start, end) { Buffer.prototype._isBuffer = true function swap (b, n, m) { - const i = b[n] + var i = b[n] b[n] = b[m] b[m] = i } Buffer.prototype.swap16 = function swap16 () { - const len = this.length + var 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) { + for (var i = 0; i < len; i += 2) { swap(this, i, i + 1) } return this } Buffer.prototype.swap32 = function swap32 () { - const len = this.length + var 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) { + for (var i = 0; i < len; i += 4) { swap(this, i, i + 3) swap(this, i + 1, i + 2) } @@ -19775,11 +18956,11 @@ Buffer.prototype.swap32 = function swap32 () { } Buffer.prototype.swap64 = function swap64 () { - const len = this.length + var 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) { + for (var i = 0; i < len; i += 8) { swap(this, i, i + 7) swap(this, i + 1, i + 6) swap(this, i + 2, i + 5) @@ -19789,7 +18970,7 @@ Buffer.prototype.swap64 = function swap64 () { } Buffer.prototype.toString = function toString () { - const length = this.length + var length = this.length if (length === 0) return '' if (arguments.length === 0) return utf8Slice(this, 0, length) return slowToString.apply(this, arguments) @@ -19804,8 +18985,8 @@ Buffer.prototype.equals = function equals (b) { } Buffer.prototype.inspect = function inspect () { - let str = '' - const max = exports.INSPECT_MAX_BYTES + var str = '' + var max = exports.INSPECT_MAX_BYTES str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() if (this.length > max) str += ' ... ' return '' @@ -19859,14 +19040,14 @@ Buffer.prototype.compare = function compare (target, start, end, thisStart, this if (this === target) return 0 - let x = thisEnd - thisStart - let y = end - start - const len = Math.min(x, y) + var x = thisEnd - thisStart + var y = end - start + var len = Math.min(x, y) - const thisCopy = this.slice(thisStart, thisEnd) - const targetCopy = target.slice(start, end) + var thisCopy = this.slice(thisStart, thisEnd) + var targetCopy = target.slice(start, end) - for (let i = 0; i < len; ++i) { + for (var i = 0; i < len; ++i) { if (thisCopy[i] !== targetCopy[i]) { x = thisCopy[i] y = targetCopy[i] @@ -19945,9 +19126,9 @@ function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { } function arrayIndexOf (arr, val, byteOffset, encoding, dir) { - let indexSize = 1 - let arrLength = arr.length - let valLength = val.length + var indexSize = 1 + var arrLength = arr.length + var valLength = val.length if (encoding !== undefined) { encoding = String(encoding).toLowerCase() @@ -19971,9 +19152,9 @@ function arrayIndexOf (arr, val, byteOffset, encoding, dir) { } } - let i + var i if (dir) { - let foundIndex = -1 + var foundIndex = -1 for (i = byteOffset; i < arrLength; i++) { if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { if (foundIndex === -1) foundIndex = i @@ -19986,8 +19167,8 @@ function arrayIndexOf (arr, val, byteOffset, encoding, dir) { } else { if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength for (i = byteOffset; i >= 0; i--) { - let found = true - for (let j = 0; j < valLength; j++) { + var found = true + for (var j = 0; j < valLength; j++) { if (read(arr, i + j) !== read(val, j)) { found = false break @@ -20014,7 +19195,7 @@ Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) function hexWrite (buf, string, offset, length) { offset = Number(offset) || 0 - const remaining = buf.length - offset + var remaining = buf.length - offset if (!length) { length = remaining } else { @@ -20024,14 +19205,13 @@ function hexWrite (buf, string, offset, length) { } } - const strLen = string.length + var 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) + for (var i = 0; i < length; ++i) { + var parsed = parseInt(string.substr(i * 2, 2), 16) if (numberIsNaN(parsed)) return i buf[offset + i] = parsed } @@ -20081,7 +19261,7 @@ Buffer.prototype.write = function write (string, offset, length, encoding) { ) } - const remaining = this.length - offset + var remaining = this.length - offset if (length === undefined || length > remaining) length = remaining if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { @@ -20090,7 +19270,7 @@ Buffer.prototype.write = function write (string, offset, length, encoding) { if (!encoding) encoding = 'utf8' - let loweredCase = false + var loweredCase = false for (;;) { switch (encoding) { case 'hex': @@ -20140,13 +19320,13 @@ function base64Slice (buf, start, end) { function utf8Slice (buf, start, end) { end = Math.min(buf.length, end) - const res = [] + var res = [] - let i = start + var i = start while (i < end) { - const firstByte = buf[i] - let codePoint = null - let bytesPerSequence = (firstByte > 0xEF) + var firstByte = buf[i] + var codePoint = null + var bytesPerSequence = (firstByte > 0xEF) ? 4 : (firstByte > 0xDF) ? 3 @@ -20155,7 +19335,7 @@ function utf8Slice (buf, start, end) { : 1 if (i + bytesPerSequence <= end) { - let secondByte, thirdByte, fourthByte, tempCodePoint + var secondByte, thirdByte, fourthByte, tempCodePoint switch (bytesPerSequence) { case 1: @@ -20217,17 +19397,17 @@ function utf8Slice (buf, start, end) { // 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 +var MAX_ARGUMENTS_LENGTH = 0x1000 function decodeCodePointsArray (codePoints) { - const len = codePoints.length + var len = codePoints.length if (len <= MAX_ARGUMENTS_LENGTH) { return String.fromCharCode.apply(String, codePoints) // avoid extra slice() } // Decode in chunks to avoid "call stack size exceeded". - let res = '' - let i = 0 + var res = '' + var i = 0 while (i < len) { res += String.fromCharCode.apply( String, @@ -20238,50 +19418,50 @@ function decodeCodePointsArray (codePoints) { } function asciiSlice (buf, start, end) { - let ret = '' + var ret = '' end = Math.min(buf.length, end) - for (let i = start; i < end; ++i) { + for (var i = start; i < end; ++i) { ret += String.fromCharCode(buf[i] & 0x7F) } return ret } function latin1Slice (buf, start, end) { - let ret = '' + var ret = '' end = Math.min(buf.length, end) - for (let i = start; i < end; ++i) { + for (var i = start; i < end; ++i) { ret += String.fromCharCode(buf[i]) } return ret } function hexSlice (buf, start, end) { - const len = buf.length + var 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) { + var out = '' + for (var i = start; i < end; ++i) { out += hexSliceLookupTable[buf[i]] } return out } function utf16leSlice (buf, start, end) { - const bytes = buf.slice(start, end) - let res = '' + var bytes = buf.slice(start, end) + var 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) { + for (var 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 + var len = this.length start = ~~start end = end === undefined ? len : ~~end @@ -20301,7 +19481,7 @@ Buffer.prototype.slice = function slice (start, end) { if (end < start) end = start - const newBuf = this.subarray(start, end) + var newBuf = this.subarray(start, end) // Return an augmented `Uint8Array` instance Object.setPrototypeOf(newBuf, Buffer.prototype) @@ -20322,9 +19502,9 @@ Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) byteLength = byteLength >>> 0 if (!noAssert) checkOffset(offset, byteLength, this.length) - let val = this[offset] - let mul = 1 - let i = 0 + var val = this[offset] + var mul = 1 + var i = 0 while (++i < byteLength && (mul *= 0x100)) { val += this[offset + i] * mul } @@ -20340,8 +19520,8 @@ Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) checkOffset(offset, byteLength, this.length) } - let val = this[offset + --byteLength] - let mul = 1 + var val = this[offset + --byteLength] + var mul = 1 while (byteLength > 0 && (mul *= 0x100)) { val += this[offset + --byteLength] * mul } @@ -20392,58 +19572,14 @@ Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { 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 + var val = this[offset] + var mul = 1 + var i = 0 while (++i < byteLength && (mul *= 0x100)) { val += this[offset + i] * mul } @@ -20459,9 +19595,9 @@ Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { byteLength = byteLength >>> 0 if (!noAssert) checkOffset(offset, byteLength, this.length) - let i = byteLength - let mul = 1 - let val = this[offset + --i] + var i = byteLength + var mul = 1 + var val = this[offset + --i] while (i > 0 && (mul *= 0x100)) { val += this[offset + --i] * mul } @@ -20482,14 +19618,14 @@ Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { 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) + var 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) + var val = this[offset + 1] | (this[offset] << 8) return (val & 0x8000) ? val | 0xFFFF0000 : val } @@ -20513,48 +19649,6 @@ Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { (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) @@ -20591,12 +19685,12 @@ Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, offset = offset >>> 0 byteLength = byteLength >>> 0 if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength) - 1 + var maxBytes = Math.pow(2, 8 * byteLength) - 1 checkInt(this, value, offset, byteLength, maxBytes, 0) } - let mul = 1 - let i = 0 + var mul = 1 + var i = 0 this[offset] = value & 0xFF while (++i < byteLength && (mul *= 0x100)) { this[offset + i] = (value / mul) & 0xFF @@ -20611,12 +19705,12 @@ Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, offset = offset >>> 0 byteLength = byteLength >>> 0 if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength) - 1 + var maxBytes = Math.pow(2, 8 * byteLength) - 1 checkInt(this, value, offset, byteLength, maxBytes, 0) } - let i = byteLength - 1 - let mul = 1 + var i = byteLength - 1 + var mul = 1 this[offset + i] = value & 0xFF while (--i >= 0 && (mul *= 0x100)) { this[offset + i] = (value / mul) & 0xFF @@ -20678,70 +19772,18 @@ Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert 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) + var limit = Math.pow(2, (8 * byteLength) - 1) checkInt(this, value, offset, byteLength, limit - 1, -limit) } - let i = 0 - let mul = 1 - let sub = 0 + var i = 0 + var mul = 1 + var sub = 0 this[offset] = value & 0xFF while (++i < byteLength && (mul *= 0x100)) { if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { @@ -20757,14 +19799,14 @@ Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, no value = +value offset = offset >>> 0 if (!noAssert) { - const limit = Math.pow(2, (8 * byteLength) - 1) + var 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 + var i = byteLength - 1 + var mul = 1 + var sub = 0 this[offset + i] = value & 0xFF while (--i >= 0 && (mul *= 0x100)) { if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { @@ -20826,14 +19868,6 @@ Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) 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') @@ -20901,7 +19935,7 @@ Buffer.prototype.copy = function copy (target, targetStart, start, end) { end = target.length - targetStart + start } - const len = end - start + var len = end - start if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { // Use built-in when available, missing from IE11 @@ -20939,7 +19973,7 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) { throw new TypeError('Unknown encoding: ' + encoding) } if (val.length === 1) { - const code = val.charCodeAt(0) + var code = val.charCodeAt(0) if ((encoding === 'utf8' && code < 128) || encoding === 'latin1') { // Fast path: If `val` fits into a single byte, use that numeric value. @@ -20966,16 +20000,16 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) { if (!val) val = 0 - let i + var i if (typeof val === 'number') { for (i = start; i < end; ++i) { this[i] = val } } else { - const bytes = Buffer.isBuffer(val) + var bytes = Buffer.isBuffer(val) ? val : Buffer.from(val, encoding) - const len = bytes.length + var len = bytes.length if (len === 0) { throw new TypeError('The value "' + val + '" is invalid for argument "value"') @@ -20988,143 +20022,10 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) { 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 +var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g function base64clean (str) { // Node takes equal signs as end of the Base64 encoding @@ -21142,12 +20043,12 @@ function base64clean (str) { function utf8ToBytes (string, units) { units = units || Infinity - let codePoint - const length = string.length - let leadSurrogate = null - const bytes = [] + var codePoint + var length = string.length + var leadSurrogate = null + var bytes = [] - for (let i = 0; i < length; ++i) { + for (var i = 0; i < length; ++i) { codePoint = string.charCodeAt(i) // is surrogate component @@ -21221,8 +20122,8 @@ function utf8ToBytes (string, units) { } function asciiToBytes (str) { - const byteArray = [] - for (let i = 0; i < str.length; ++i) { + var byteArray = [] + for (var i = 0; i < str.length; ++i) { // Node's code seems to be doing this and not & 0x7F.. byteArray.push(str.charCodeAt(i) & 0xFF) } @@ -21230,9 +20131,9 @@ function asciiToBytes (str) { } function utf16leToBytes (str, units) { - let c, hi, lo - const byteArray = [] - for (let i = 0; i < str.length; ++i) { + var c, hi, lo + var byteArray = [] + for (var i = 0; i < str.length; ++i) { if ((units -= 2) < 0) break c = str.charCodeAt(i) @@ -21250,8 +20151,7 @@ function base64ToBytes (str) { } function blitBuffer (src, dst, offset, length) { - let i - for (i = 0; i < length; ++i) { + for (var i = 0; i < length; ++i) { if ((i + offset >= dst.length) || (i >= src.length)) break dst[i + offset] = src[i] } @@ -21273,27 +20173,18 @@ function numberIsNaN (obj) { // 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) { +var hexSliceLookupTable = (function () { + var alphabet = '0123456789abcdef' + var table = new Array(256) + for (var i = 0; i < 16; ++i) { + var i16 = i * 16 + for (var 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') -} - /***/ }), @@ -21361,6 +20252,1073 @@ if ($defineProperty) { } +/***/ }), + +/***/ 297: +/***/ ((module) => { + +"use strict"; +/* eslint quote-props: off */ + + +/** + * Names for all available hashes + * + * @typedef { "identity" | "sha1" | "sha2-256" | "sha2-512" | "sha3-512" | "sha3-384" | "sha3-256" | "sha3-224" | "shake-128" | "shake-256" | "keccak-224" | "keccak-256" | "keccak-384" | "keccak-512" | "blake3" | "murmur3-128" | "murmur3-32" | "dbl-sha2-256" | "md4" | "md5" | "bmt" | "sha2-256-trunc254-padded" | "ripemd-128" | "ripemd-160" | "ripemd-256" | "ripemd-320" | "x11" | "kangarootwelve" | "sm3-256" | "blake2b-8" | "blake2b-16" | "blake2b-24" | "blake2b-32" | "blake2b-40" | "blake2b-48" | "blake2b-56" | "blake2b-64" | "blake2b-72" | "blake2b-80" | "blake2b-88" | "blake2b-96" | "blake2b-104" | "blake2b-112" | "blake2b-120" | "blake2b-128" | "blake2b-136" | "blake2b-144" | "blake2b-152" | "blake2b-160" | "blake2b-168" | "blake2b-176" | "blake2b-184" | "blake2b-192" | "blake2b-200" | "blake2b-208" | "blake2b-216" | "blake2b-224" | "blake2b-232" | "blake2b-240" | "blake2b-248" | "blake2b-256" | "blake2b-264" | "blake2b-272" | "blake2b-280" | "blake2b-288" | "blake2b-296" | "blake2b-304" | "blake2b-312" | "blake2b-320" | "blake2b-328" | "blake2b-336" | "blake2b-344" | "blake2b-352" | "blake2b-360" | "blake2b-368" | "blake2b-376" | "blake2b-384" | "blake2b-392" | "blake2b-400" | "blake2b-408" | "blake2b-416" | "blake2b-424" | "blake2b-432" | "blake2b-440" | "blake2b-448" | "blake2b-456" | "blake2b-464" | "blake2b-472" | "blake2b-480" | "blake2b-488" | "blake2b-496" | "blake2b-504" | "blake2b-512" | "blake2s-8" | "blake2s-16" | "blake2s-24" | "blake2s-32" | "blake2s-40" | "blake2s-48" | "blake2s-56" | "blake2s-64" | "blake2s-72" | "blake2s-80" | "blake2s-88" | "blake2s-96" | "blake2s-104" | "blake2s-112" | "blake2s-120" | "blake2s-128" | "blake2s-136" | "blake2s-144" | "blake2s-152" | "blake2s-160" | "blake2s-168" | "blake2s-176" | "blake2s-184" | "blake2s-192" | "blake2s-200" | "blake2s-208" | "blake2s-216" | "blake2s-224" | "blake2s-232" | "blake2s-240" | "blake2s-248" | "blake2s-256" | "skein256-8" | "skein256-16" | "skein256-24" | "skein256-32" | "skein256-40" | "skein256-48" | "skein256-56" | "skein256-64" | "skein256-72" | "skein256-80" | "skein256-88" | "skein256-96" | "skein256-104" | "skein256-112" | "skein256-120" | "skein256-128" | "skein256-136" | "skein256-144" | "skein256-152" | "skein256-160" | "skein256-168" | "skein256-176" | "skein256-184" | "skein256-192" | "skein256-200" | "skein256-208" | "skein256-216" | "skein256-224" | "skein256-232" | "skein256-240" | "skein256-248" | "skein256-256" | "skein512-8" | "skein512-16" | "skein512-24" | "skein512-32" | "skein512-40" | "skein512-48" | "skein512-56" | "skein512-64" | "skein512-72" | "skein512-80" | "skein512-88" | "skein512-96" | "skein512-104" | "skein512-112" | "skein512-120" | "skein512-128" | "skein512-136" | "skein512-144" | "skein512-152" | "skein512-160" | "skein512-168" | "skein512-176" | "skein512-184" | "skein512-192" | "skein512-200" | "skein512-208" | "skein512-216" | "skein512-224" | "skein512-232" | "skein512-240" | "skein512-248" | "skein512-256" | "skein512-264" | "skein512-272" | "skein512-280" | "skein512-288" | "skein512-296" | "skein512-304" | "skein512-312" | "skein512-320" | "skein512-328" | "skein512-336" | "skein512-344" | "skein512-352" | "skein512-360" | "skein512-368" | "skein512-376" | "skein512-384" | "skein512-392" | "skein512-400" | "skein512-408" | "skein512-416" | "skein512-424" | "skein512-432" | "skein512-440" | "skein512-448" | "skein512-456" | "skein512-464" | "skein512-472" | "skein512-480" | "skein512-488" | "skein512-496" | "skein512-504" | "skein512-512" | "skein1024-8" | "skein1024-16" | "skein1024-24" | "skein1024-32" | "skein1024-40" | "skein1024-48" | "skein1024-56" | "skein1024-64" | "skein1024-72" | "skein1024-80" | "skein1024-88" | "skein1024-96" | "skein1024-104" | "skein1024-112" | "skein1024-120" | "skein1024-128" | "skein1024-136" | "skein1024-144" | "skein1024-152" | "skein1024-160" | "skein1024-168" | "skein1024-176" | "skein1024-184" | "skein1024-192" | "skein1024-200" | "skein1024-208" | "skein1024-216" | "skein1024-224" | "skein1024-232" | "skein1024-240" | "skein1024-248" | "skein1024-256" | "skein1024-264" | "skein1024-272" | "skein1024-280" | "skein1024-288" | "skein1024-296" | "skein1024-304" | "skein1024-312" | "skein1024-320" | "skein1024-328" | "skein1024-336" | "skein1024-344" | "skein1024-352" | "skein1024-360" | "skein1024-368" | "skein1024-376" | "skein1024-384" | "skein1024-392" | "skein1024-400" | "skein1024-408" | "skein1024-416" | "skein1024-424" | "skein1024-432" | "skein1024-440" | "skein1024-448" | "skein1024-456" | "skein1024-464" | "skein1024-472" | "skein1024-480" | "skein1024-488" | "skein1024-496" | "skein1024-504" | "skein1024-512" | "skein1024-520" | "skein1024-528" | "skein1024-536" | "skein1024-544" | "skein1024-552" | "skein1024-560" | "skein1024-568" | "skein1024-576" | "skein1024-584" | "skein1024-592" | "skein1024-600" | "skein1024-608" | "skein1024-616" | "skein1024-624" | "skein1024-632" | "skein1024-640" | "skein1024-648" | "skein1024-656" | "skein1024-664" | "skein1024-672" | "skein1024-680" | "skein1024-688" | "skein1024-696" | "skein1024-704" | "skein1024-712" | "skein1024-720" | "skein1024-728" | "skein1024-736" | "skein1024-744" | "skein1024-752" | "skein1024-760" | "skein1024-768" | "skein1024-776" | "skein1024-784" | "skein1024-792" | "skein1024-800" | "skein1024-808" | "skein1024-816" | "skein1024-824" | "skein1024-832" | "skein1024-840" | "skein1024-848" | "skein1024-856" | "skein1024-864" | "skein1024-872" | "skein1024-880" | "skein1024-888" | "skein1024-896" | "skein1024-904" | "skein1024-912" | "skein1024-920" | "skein1024-928" | "skein1024-936" | "skein1024-944" | "skein1024-952" | "skein1024-960" | "skein1024-968" | "skein1024-976" | "skein1024-984" | "skein1024-992" | "skein1024-1000" | "skein1024-1008" | "skein1024-1016" | "skein1024-1024" | "poseidon-bls12_381-a2-fc1" | "poseidon-bls12_381-a2-fc1-sc" } HashName + */ +/** + * Codes for all available hashes + * + * @typedef { 0x00 | 0x11 | 0x12 | 0x13 | 0x14 | 0x15 | 0x16 | 0x17 | 0x18 | 0x19 | 0x1a | 0x1b | 0x1c | 0x1d | 0x1e | 0x22 | 0x23 | 0x56 | 0xd4 | 0xd5 | 0xd6 | 0x1012 | 0x1052 | 0x1053 | 0x1054 | 0x1055 | 0x1100 | 0x1d01 | 0x534d | 0xb201 | 0xb202 | 0xb203 | 0xb204 | 0xb205 | 0xb206 | 0xb207 | 0xb208 | 0xb209 | 0xb20a | 0xb20b | 0xb20c | 0xb20d | 0xb20e | 0xb20f | 0xb210 | 0xb211 | 0xb212 | 0xb213 | 0xb214 | 0xb215 | 0xb216 | 0xb217 | 0xb218 | 0xb219 | 0xb21a | 0xb21b | 0xb21c | 0xb21d | 0xb21e | 0xb21f | 0xb220 | 0xb221 | 0xb222 | 0xb223 | 0xb224 | 0xb225 | 0xb226 | 0xb227 | 0xb228 | 0xb229 | 0xb22a | 0xb22b | 0xb22c | 0xb22d | 0xb22e | 0xb22f | 0xb230 | 0xb231 | 0xb232 | 0xb233 | 0xb234 | 0xb235 | 0xb236 | 0xb237 | 0xb238 | 0xb239 | 0xb23a | 0xb23b | 0xb23c | 0xb23d | 0xb23e | 0xb23f | 0xb240 | 0xb241 | 0xb242 | 0xb243 | 0xb244 | 0xb245 | 0xb246 | 0xb247 | 0xb248 | 0xb249 | 0xb24a | 0xb24b | 0xb24c | 0xb24d | 0xb24e | 0xb24f | 0xb250 | 0xb251 | 0xb252 | 0xb253 | 0xb254 | 0xb255 | 0xb256 | 0xb257 | 0xb258 | 0xb259 | 0xb25a | 0xb25b | 0xb25c | 0xb25d | 0xb25e | 0xb25f | 0xb260 | 0xb301 | 0xb302 | 0xb303 | 0xb304 | 0xb305 | 0xb306 | 0xb307 | 0xb308 | 0xb309 | 0xb30a | 0xb30b | 0xb30c | 0xb30d | 0xb30e | 0xb30f | 0xb310 | 0xb311 | 0xb312 | 0xb313 | 0xb314 | 0xb315 | 0xb316 | 0xb317 | 0xb318 | 0xb319 | 0xb31a | 0xb31b | 0xb31c | 0xb31d | 0xb31e | 0xb31f | 0xb320 | 0xb321 | 0xb322 | 0xb323 | 0xb324 | 0xb325 | 0xb326 | 0xb327 | 0xb328 | 0xb329 | 0xb32a | 0xb32b | 0xb32c | 0xb32d | 0xb32e | 0xb32f | 0xb330 | 0xb331 | 0xb332 | 0xb333 | 0xb334 | 0xb335 | 0xb336 | 0xb337 | 0xb338 | 0xb339 | 0xb33a | 0xb33b | 0xb33c | 0xb33d | 0xb33e | 0xb33f | 0xb340 | 0xb341 | 0xb342 | 0xb343 | 0xb344 | 0xb345 | 0xb346 | 0xb347 | 0xb348 | 0xb349 | 0xb34a | 0xb34b | 0xb34c | 0xb34d | 0xb34e | 0xb34f | 0xb350 | 0xb351 | 0xb352 | 0xb353 | 0xb354 | 0xb355 | 0xb356 | 0xb357 | 0xb358 | 0xb359 | 0xb35a | 0xb35b | 0xb35c | 0xb35d | 0xb35e | 0xb35f | 0xb360 | 0xb361 | 0xb362 | 0xb363 | 0xb364 | 0xb365 | 0xb366 | 0xb367 | 0xb368 | 0xb369 | 0xb36a | 0xb36b | 0xb36c | 0xb36d | 0xb36e | 0xb36f | 0xb370 | 0xb371 | 0xb372 | 0xb373 | 0xb374 | 0xb375 | 0xb376 | 0xb377 | 0xb378 | 0xb379 | 0xb37a | 0xb37b | 0xb37c | 0xb37d | 0xb37e | 0xb37f | 0xb380 | 0xb381 | 0xb382 | 0xb383 | 0xb384 | 0xb385 | 0xb386 | 0xb387 | 0xb388 | 0xb389 | 0xb38a | 0xb38b | 0xb38c | 0xb38d | 0xb38e | 0xb38f | 0xb390 | 0xb391 | 0xb392 | 0xb393 | 0xb394 | 0xb395 | 0xb396 | 0xb397 | 0xb398 | 0xb399 | 0xb39a | 0xb39b | 0xb39c | 0xb39d | 0xb39e | 0xb39f | 0xb3a0 | 0xb3a1 | 0xb3a2 | 0xb3a3 | 0xb3a4 | 0xb3a5 | 0xb3a6 | 0xb3a7 | 0xb3a8 | 0xb3a9 | 0xb3aa | 0xb3ab | 0xb3ac | 0xb3ad | 0xb3ae | 0xb3af | 0xb3b0 | 0xb3b1 | 0xb3b2 | 0xb3b3 | 0xb3b4 | 0xb3b5 | 0xb3b6 | 0xb3b7 | 0xb3b8 | 0xb3b9 | 0xb3ba | 0xb3bb | 0xb3bc | 0xb3bd | 0xb3be | 0xb3bf | 0xb3c0 | 0xb3c1 | 0xb3c2 | 0xb3c3 | 0xb3c4 | 0xb3c5 | 0xb3c6 | 0xb3c7 | 0xb3c8 | 0xb3c9 | 0xb3ca | 0xb3cb | 0xb3cc | 0xb3cd | 0xb3ce | 0xb3cf | 0xb3d0 | 0xb3d1 | 0xb3d2 | 0xb3d3 | 0xb3d4 | 0xb3d5 | 0xb3d6 | 0xb3d7 | 0xb3d8 | 0xb3d9 | 0xb3da | 0xb3db | 0xb3dc | 0xb3dd | 0xb3de | 0xb3df | 0xb3e0 | 0xb401 | 0xb402 } HashCode + */ + +/** + * @type { Record } + */ +const names = Object.freeze({ + 'identity': 0x00, + 'sha1': 0x11, + 'sha2-256': 0x12, + 'sha2-512': 0x13, + 'sha3-512': 0x14, + 'sha3-384': 0x15, + 'sha3-256': 0x16, + 'sha3-224': 0x17, + 'shake-128': 0x18, + 'shake-256': 0x19, + 'keccak-224': 0x1a, + 'keccak-256': 0x1b, + 'keccak-384': 0x1c, + 'keccak-512': 0x1d, + 'blake3': 0x1e, + 'murmur3-128': 0x22, + 'murmur3-32': 0x23, + 'dbl-sha2-256': 0x56, + 'md4': 0xd4, + 'md5': 0xd5, + 'bmt': 0xd6, + 'sha2-256-trunc254-padded': 0x1012, + 'ripemd-128': 0x1052, + 'ripemd-160': 0x1053, + 'ripemd-256': 0x1054, + 'ripemd-320': 0x1055, + 'x11': 0x1100, + 'kangarootwelve': 0x1d01, + 'sm3-256': 0x534d, + 'blake2b-8': 0xb201, + 'blake2b-16': 0xb202, + 'blake2b-24': 0xb203, + 'blake2b-32': 0xb204, + 'blake2b-40': 0xb205, + 'blake2b-48': 0xb206, + 'blake2b-56': 0xb207, + 'blake2b-64': 0xb208, + 'blake2b-72': 0xb209, + 'blake2b-80': 0xb20a, + 'blake2b-88': 0xb20b, + 'blake2b-96': 0xb20c, + 'blake2b-104': 0xb20d, + 'blake2b-112': 0xb20e, + 'blake2b-120': 0xb20f, + 'blake2b-128': 0xb210, + 'blake2b-136': 0xb211, + 'blake2b-144': 0xb212, + 'blake2b-152': 0xb213, + 'blake2b-160': 0xb214, + 'blake2b-168': 0xb215, + 'blake2b-176': 0xb216, + 'blake2b-184': 0xb217, + 'blake2b-192': 0xb218, + 'blake2b-200': 0xb219, + 'blake2b-208': 0xb21a, + 'blake2b-216': 0xb21b, + 'blake2b-224': 0xb21c, + 'blake2b-232': 0xb21d, + 'blake2b-240': 0xb21e, + 'blake2b-248': 0xb21f, + 'blake2b-256': 0xb220, + 'blake2b-264': 0xb221, + 'blake2b-272': 0xb222, + 'blake2b-280': 0xb223, + 'blake2b-288': 0xb224, + 'blake2b-296': 0xb225, + 'blake2b-304': 0xb226, + 'blake2b-312': 0xb227, + 'blake2b-320': 0xb228, + 'blake2b-328': 0xb229, + 'blake2b-336': 0xb22a, + 'blake2b-344': 0xb22b, + 'blake2b-352': 0xb22c, + 'blake2b-360': 0xb22d, + 'blake2b-368': 0xb22e, + 'blake2b-376': 0xb22f, + 'blake2b-384': 0xb230, + 'blake2b-392': 0xb231, + 'blake2b-400': 0xb232, + 'blake2b-408': 0xb233, + 'blake2b-416': 0xb234, + 'blake2b-424': 0xb235, + 'blake2b-432': 0xb236, + 'blake2b-440': 0xb237, + 'blake2b-448': 0xb238, + 'blake2b-456': 0xb239, + 'blake2b-464': 0xb23a, + 'blake2b-472': 0xb23b, + 'blake2b-480': 0xb23c, + 'blake2b-488': 0xb23d, + 'blake2b-496': 0xb23e, + 'blake2b-504': 0xb23f, + 'blake2b-512': 0xb240, + 'blake2s-8': 0xb241, + 'blake2s-16': 0xb242, + 'blake2s-24': 0xb243, + 'blake2s-32': 0xb244, + 'blake2s-40': 0xb245, + 'blake2s-48': 0xb246, + 'blake2s-56': 0xb247, + 'blake2s-64': 0xb248, + 'blake2s-72': 0xb249, + 'blake2s-80': 0xb24a, + 'blake2s-88': 0xb24b, + 'blake2s-96': 0xb24c, + 'blake2s-104': 0xb24d, + 'blake2s-112': 0xb24e, + 'blake2s-120': 0xb24f, + 'blake2s-128': 0xb250, + 'blake2s-136': 0xb251, + 'blake2s-144': 0xb252, + 'blake2s-152': 0xb253, + 'blake2s-160': 0xb254, + 'blake2s-168': 0xb255, + 'blake2s-176': 0xb256, + 'blake2s-184': 0xb257, + 'blake2s-192': 0xb258, + 'blake2s-200': 0xb259, + 'blake2s-208': 0xb25a, + 'blake2s-216': 0xb25b, + 'blake2s-224': 0xb25c, + 'blake2s-232': 0xb25d, + 'blake2s-240': 0xb25e, + 'blake2s-248': 0xb25f, + 'blake2s-256': 0xb260, + 'skein256-8': 0xb301, + 'skein256-16': 0xb302, + 'skein256-24': 0xb303, + 'skein256-32': 0xb304, + 'skein256-40': 0xb305, + 'skein256-48': 0xb306, + 'skein256-56': 0xb307, + 'skein256-64': 0xb308, + 'skein256-72': 0xb309, + 'skein256-80': 0xb30a, + 'skein256-88': 0xb30b, + 'skein256-96': 0xb30c, + 'skein256-104': 0xb30d, + 'skein256-112': 0xb30e, + 'skein256-120': 0xb30f, + 'skein256-128': 0xb310, + 'skein256-136': 0xb311, + 'skein256-144': 0xb312, + 'skein256-152': 0xb313, + 'skein256-160': 0xb314, + 'skein256-168': 0xb315, + 'skein256-176': 0xb316, + 'skein256-184': 0xb317, + 'skein256-192': 0xb318, + 'skein256-200': 0xb319, + 'skein256-208': 0xb31a, + 'skein256-216': 0xb31b, + 'skein256-224': 0xb31c, + 'skein256-232': 0xb31d, + 'skein256-240': 0xb31e, + 'skein256-248': 0xb31f, + 'skein256-256': 0xb320, + 'skein512-8': 0xb321, + 'skein512-16': 0xb322, + 'skein512-24': 0xb323, + 'skein512-32': 0xb324, + 'skein512-40': 0xb325, + 'skein512-48': 0xb326, + 'skein512-56': 0xb327, + 'skein512-64': 0xb328, + 'skein512-72': 0xb329, + 'skein512-80': 0xb32a, + 'skein512-88': 0xb32b, + 'skein512-96': 0xb32c, + 'skein512-104': 0xb32d, + 'skein512-112': 0xb32e, + 'skein512-120': 0xb32f, + 'skein512-128': 0xb330, + 'skein512-136': 0xb331, + 'skein512-144': 0xb332, + 'skein512-152': 0xb333, + 'skein512-160': 0xb334, + 'skein512-168': 0xb335, + 'skein512-176': 0xb336, + 'skein512-184': 0xb337, + 'skein512-192': 0xb338, + 'skein512-200': 0xb339, + 'skein512-208': 0xb33a, + 'skein512-216': 0xb33b, + 'skein512-224': 0xb33c, + 'skein512-232': 0xb33d, + 'skein512-240': 0xb33e, + 'skein512-248': 0xb33f, + 'skein512-256': 0xb340, + 'skein512-264': 0xb341, + 'skein512-272': 0xb342, + 'skein512-280': 0xb343, + 'skein512-288': 0xb344, + 'skein512-296': 0xb345, + 'skein512-304': 0xb346, + 'skein512-312': 0xb347, + 'skein512-320': 0xb348, + 'skein512-328': 0xb349, + 'skein512-336': 0xb34a, + 'skein512-344': 0xb34b, + 'skein512-352': 0xb34c, + 'skein512-360': 0xb34d, + 'skein512-368': 0xb34e, + 'skein512-376': 0xb34f, + 'skein512-384': 0xb350, + 'skein512-392': 0xb351, + 'skein512-400': 0xb352, + 'skein512-408': 0xb353, + 'skein512-416': 0xb354, + 'skein512-424': 0xb355, + 'skein512-432': 0xb356, + 'skein512-440': 0xb357, + 'skein512-448': 0xb358, + 'skein512-456': 0xb359, + 'skein512-464': 0xb35a, + 'skein512-472': 0xb35b, + 'skein512-480': 0xb35c, + 'skein512-488': 0xb35d, + 'skein512-496': 0xb35e, + 'skein512-504': 0xb35f, + 'skein512-512': 0xb360, + 'skein1024-8': 0xb361, + 'skein1024-16': 0xb362, + 'skein1024-24': 0xb363, + 'skein1024-32': 0xb364, + 'skein1024-40': 0xb365, + 'skein1024-48': 0xb366, + 'skein1024-56': 0xb367, + 'skein1024-64': 0xb368, + 'skein1024-72': 0xb369, + 'skein1024-80': 0xb36a, + 'skein1024-88': 0xb36b, + 'skein1024-96': 0xb36c, + 'skein1024-104': 0xb36d, + 'skein1024-112': 0xb36e, + 'skein1024-120': 0xb36f, + 'skein1024-128': 0xb370, + 'skein1024-136': 0xb371, + 'skein1024-144': 0xb372, + 'skein1024-152': 0xb373, + 'skein1024-160': 0xb374, + 'skein1024-168': 0xb375, + 'skein1024-176': 0xb376, + 'skein1024-184': 0xb377, + 'skein1024-192': 0xb378, + 'skein1024-200': 0xb379, + 'skein1024-208': 0xb37a, + 'skein1024-216': 0xb37b, + 'skein1024-224': 0xb37c, + 'skein1024-232': 0xb37d, + 'skein1024-240': 0xb37e, + 'skein1024-248': 0xb37f, + 'skein1024-256': 0xb380, + 'skein1024-264': 0xb381, + 'skein1024-272': 0xb382, + 'skein1024-280': 0xb383, + 'skein1024-288': 0xb384, + 'skein1024-296': 0xb385, + 'skein1024-304': 0xb386, + 'skein1024-312': 0xb387, + 'skein1024-320': 0xb388, + 'skein1024-328': 0xb389, + 'skein1024-336': 0xb38a, + 'skein1024-344': 0xb38b, + 'skein1024-352': 0xb38c, + 'skein1024-360': 0xb38d, + 'skein1024-368': 0xb38e, + 'skein1024-376': 0xb38f, + 'skein1024-384': 0xb390, + 'skein1024-392': 0xb391, + 'skein1024-400': 0xb392, + 'skein1024-408': 0xb393, + 'skein1024-416': 0xb394, + 'skein1024-424': 0xb395, + 'skein1024-432': 0xb396, + 'skein1024-440': 0xb397, + 'skein1024-448': 0xb398, + 'skein1024-456': 0xb399, + 'skein1024-464': 0xb39a, + 'skein1024-472': 0xb39b, + 'skein1024-480': 0xb39c, + 'skein1024-488': 0xb39d, + 'skein1024-496': 0xb39e, + 'skein1024-504': 0xb39f, + 'skein1024-512': 0xb3a0, + 'skein1024-520': 0xb3a1, + 'skein1024-528': 0xb3a2, + 'skein1024-536': 0xb3a3, + 'skein1024-544': 0xb3a4, + 'skein1024-552': 0xb3a5, + 'skein1024-560': 0xb3a6, + 'skein1024-568': 0xb3a7, + 'skein1024-576': 0xb3a8, + 'skein1024-584': 0xb3a9, + 'skein1024-592': 0xb3aa, + 'skein1024-600': 0xb3ab, + 'skein1024-608': 0xb3ac, + 'skein1024-616': 0xb3ad, + 'skein1024-624': 0xb3ae, + 'skein1024-632': 0xb3af, + 'skein1024-640': 0xb3b0, + 'skein1024-648': 0xb3b1, + 'skein1024-656': 0xb3b2, + 'skein1024-664': 0xb3b3, + 'skein1024-672': 0xb3b4, + 'skein1024-680': 0xb3b5, + 'skein1024-688': 0xb3b6, + 'skein1024-696': 0xb3b7, + 'skein1024-704': 0xb3b8, + 'skein1024-712': 0xb3b9, + 'skein1024-720': 0xb3ba, + 'skein1024-728': 0xb3bb, + 'skein1024-736': 0xb3bc, + 'skein1024-744': 0xb3bd, + 'skein1024-752': 0xb3be, + 'skein1024-760': 0xb3bf, + 'skein1024-768': 0xb3c0, + 'skein1024-776': 0xb3c1, + 'skein1024-784': 0xb3c2, + 'skein1024-792': 0xb3c3, + 'skein1024-800': 0xb3c4, + 'skein1024-808': 0xb3c5, + 'skein1024-816': 0xb3c6, + 'skein1024-824': 0xb3c7, + 'skein1024-832': 0xb3c8, + 'skein1024-840': 0xb3c9, + 'skein1024-848': 0xb3ca, + 'skein1024-856': 0xb3cb, + 'skein1024-864': 0xb3cc, + 'skein1024-872': 0xb3cd, + 'skein1024-880': 0xb3ce, + 'skein1024-888': 0xb3cf, + 'skein1024-896': 0xb3d0, + 'skein1024-904': 0xb3d1, + 'skein1024-912': 0xb3d2, + 'skein1024-920': 0xb3d3, + 'skein1024-928': 0xb3d4, + 'skein1024-936': 0xb3d5, + 'skein1024-944': 0xb3d6, + 'skein1024-952': 0xb3d7, + 'skein1024-960': 0xb3d8, + 'skein1024-968': 0xb3d9, + 'skein1024-976': 0xb3da, + 'skein1024-984': 0xb3db, + 'skein1024-992': 0xb3dc, + 'skein1024-1000': 0xb3dd, + 'skein1024-1008': 0xb3de, + 'skein1024-1016': 0xb3df, + 'skein1024-1024': 0xb3e0, + 'poseidon-bls12_381-a2-fc1': 0xb401, + 'poseidon-bls12_381-a2-fc1-sc': 0xb402 +}) + +module.exports = { names } + + +/***/ }), + +/***/ 7684: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/** + * Multihash implementation in JavaScript. + */ + + +const multibase = __webpack_require__(1466) +const varint = __webpack_require__(1203) +const { names } = __webpack_require__(297) +const { toString: uint8ArrayToString } = __webpack_require__(7302) +const { fromString: uint8ArrayFromString } = __webpack_require__(4117) +const { concat: uint8ArrayConcat } = __webpack_require__(5007) + +const codes = /** @type {import('./types').CodeNameMap} */({}) + +// eslint-disable-next-line guard-for-in +for (const key in names) { + const name = /** @type {HashName} */(key) + codes[names[name]] = name +} +Object.freeze(codes) + +/** + * Convert the given multihash to a hex encoded string. + * + * @param {Uint8Array} hash + * @returns {string} + */ +function toHexString (hash) { + if (!(hash instanceof Uint8Array)) { + throw new Error('must be passed a Uint8Array') + } + + return uint8ArrayToString(hash, 'base16') +} + +/** + * Convert the given hex encoded string to a multihash. + * + * @param {string} hash + * @returns {Uint8Array} + */ +function fromHexString (hash) { + return uint8ArrayFromString(hash, 'base16') +} + +/** + * Convert the given multihash to a base58 encoded string. + * + * @param {Uint8Array} hash + * @returns {string} + */ +function toB58String (hash) { + if (!(hash instanceof Uint8Array)) { + throw new Error('must be passed a Uint8Array') + } + + return uint8ArrayToString(multibase.encode('base58btc', hash)).slice(1) +} + +/** + * Convert the given base58 encoded string to a multihash. + * + * @param {string|Uint8Array} hash + * @returns {Uint8Array} + */ +function fromB58String (hash) { + const encoded = hash instanceof Uint8Array + ? uint8ArrayToString(hash) + : hash + + return multibase.decode('z' + encoded) +} + +/** + * Decode a hash from the given multihash. + * + * @param {Uint8Array} bytes + * @returns {{code: HashCode, name: HashName, length: number, digest: Uint8Array}} result + */ +function decode (bytes) { + if (!(bytes instanceof Uint8Array)) { + throw new Error('multihash must be a Uint8Array') + } + + if (bytes.length < 2) { + throw new Error('multihash too short. must be > 2 bytes.') + } + + const code = /** @type {HashCode} */(varint.decode(bytes)) + if (!isValidCode(code)) { + throw new Error(`multihash unknown function code: 0x${code.toString(16)}`) + } + bytes = bytes.slice(varint.decode.bytes) + + const len = varint.decode(bytes) + if (len < 0) { + throw new Error(`multihash invalid length: ${len}`) + } + bytes = bytes.slice(varint.decode.bytes) + + if (bytes.length !== len) { + throw new Error(`multihash length inconsistent: 0x${uint8ArrayToString(bytes, 'base16')}`) + } + + return { + code, + name: codes[code], + length: len, + digest: bytes + } +} + +/** + * Encode a hash digest along with the specified function code. + * + * > **Note:** the length is derived from the length of the digest itself. + * + * @param {Uint8Array} digest + * @param {HashName | HashCode} code + * @param {number} [length] + * @returns {Uint8Array} + */ +function encode (digest, code, length) { + if (!digest || code === undefined) { + throw new Error('multihash encode requires at least two args: digest, code') + } + + // ensure it's a hashfunction code. + const hashfn = coerceCode(code) + + if (!(digest instanceof Uint8Array)) { + throw new Error('digest should be a Uint8Array') + } + + if (length == null) { + length = digest.length + } + + if (length && digest.length !== length) { + throw new Error('digest length should be equal to specified length.') + } + + const hash = varint.encode(hashfn) + const len = varint.encode(length) + return uint8ArrayConcat([hash, len, digest], hash.length + len.length + digest.length) +} + +/** + * Converts a hash function name into the matching code. + * If passed a number it will return the number if it's a valid code. + * + * @param {HashName | number} name + * @returns {number} + */ +function coerceCode (name) { + let code = name + + if (typeof name === 'string') { + if (names[name] === undefined) { + throw new Error(`Unrecognized hash function named: ${name}`) + } + code = names[name] + } + + if (typeof code !== 'number') { + throw new Error(`Hash function code should be a number. Got: ${code}`) + } + + // @ts-ignore + if (codes[code] === undefined && !isAppCode(code)) { + throw new Error(`Unrecognized function code: ${code}`) + } + + return code +} + +/** + * Checks if a code is part of the app range + * + * @param {number} code + * @returns {boolean} + */ +function isAppCode (code) { + return code > 0 && code < 0x10 +} + +/** + * Checks whether a multihash code is valid. + * + * @param {HashCode} code + * @returns {boolean} + */ +function isValidCode (code) { + if (isAppCode(code)) { + return true + } + + if (codes[code]) { + return true + } + + return false +} + +/** + * Check if the given buffer is a valid multihash. Throws an error if it is not valid. + * + * @param {Uint8Array} multihash + * @returns {void} + * @throws {Error} + */ +function validate (multihash) { + decode(multihash) // throws if bad. +} + +/** + * Returns a prefix from a valid multihash. Throws an error if it is not valid. + * + * @param {Uint8Array} multihash + * @returns {Uint8Array} + * @throws {Error} + */ +function prefix (multihash) { + validate(multihash) + + return multihash.subarray(0, 2) +} + +module.exports = { + names, + codes, + toHexString, + fromHexString, + toB58String, + fromB58String, + decode, + encode, + coerceCode, + isAppCode, + validate, + prefix, + isValidCode +} + +/** + * @typedef { import("./constants").HashCode } HashCode + * @typedef { import("./constants").HashName } HashName + */ + + +/***/ }), + +/***/ 4378: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const mh = __webpack_require__(7684) + +const CIDUtil = { + /** + * Test if the given input is a valid CID object. + * Returns an error message if it is not. + * Returns undefined if it is a valid CID. + * + * @param {any} other + * @returns {string|undefined} + */ + checkCIDComponents: function (other) { + if (other == null) { + return 'null values are not valid CIDs' + } + + if (!(other.version === 0 || other.version === 1)) { + return 'Invalid version, must be a number equal to 1 or 0' + } + + if (typeof other.codec !== 'string') { + return 'codec must be string' + } + + if (other.version === 0) { + if (other.codec !== 'dag-pb') { + return "codec must be 'dag-pb' for CIDv0" + } + if (other.multibaseName !== 'base58btc') { + return "multibaseName must be 'base58btc' for CIDv0" + } + } + + if (!(other.multihash instanceof Uint8Array)) { + return 'multihash must be a Uint8Array' + } + + try { + mh.validate(other.multihash) + } catch (err) { + let errorMsg = err.message + if (!errorMsg) { // Just in case mh.validate() throws an error with empty error message + errorMsg = 'Multihash validation failed' + } + return errorMsg + } + } +} + +module.exports = CIDUtil + + +/***/ }), + +/***/ 6613: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const mh = __webpack_require__(7684) +const multibase = __webpack_require__(1466) +const multicodec = __webpack_require__(2021) +const CIDUtil = __webpack_require__(4378) +const { concat: uint8ArrayConcat } = __webpack_require__(5007) +const { toString: uint8ArrayToString } = __webpack_require__(7302) +const { equals: uint8ArrayEquals } = __webpack_require__(8402) + +const codecs = multicodec.nameToCode +const codecInts = /** @type {CodecName[]} */(Object.keys(codecs)).reduce((p, name) => { + p[codecs[name]] = name + return p +}, /** @type {Record} */({})) + +const symbol = Symbol.for('@ipld/js-cid/CID') + +/** + * @typedef {Object} SerializedCID + * @property {string} codec + * @property {number} version + * @property {Uint8Array} hash + */ +/** + * @typedef {0|1} CIDVersion + * @typedef {import('multibase').BaseNameOrCode} BaseNameOrCode + * @typedef {import('multicodec').CodecName} CodecName + * @typedef {import('multicodec').CodecCode} CodecCode + */ + +/** + * Class representing a CID `` + * , as defined in [ipld/cid](https://github.com/multiformats/cid). + * + * @class CID + */ +class CID { + /** + * Create a new CID. + * + * The algorithm for argument input is roughly: + * ``` + * if (cid) + * -> create a copy + * else if (str) + * if (1st char is on multibase table) -> CID String + * else -> bs58 encoded multihash + * else if (Uint8Array) + * if (1st byte is 0 or 1) -> CID + * else -> multihash + * else if (Number) + * -> construct CID by parts + * ``` + * + * @param {CIDVersion | string | Uint8Array | CID} version + * @param {string|number} [codec] + * @param {Uint8Array} [multihash] + * @param {string} [multibaseName] + * + * @example + * new CID(, , , ) + * new CID() + * new CID() + * new CID() + * new CID() + * new CID() + */ + constructor (version, codec, multihash, multibaseName) { + // We have below three blank field accessors only because + // otherwise TS will not pick them up if done after assignemnts + + /** + * The version of the CID. + * + * @type {CIDVersion} + */ + // eslint-disable-next-line no-unused-expressions + this.version + + /** + * The codec of the CID. + * + * @deprecated + * @type {CodecName} + */ + // eslint-disable-next-line no-unused-expressions + this.codec + + /** + * The multihash of the CID. + * + * @type {Uint8Array} + */ + // eslint-disable-next-line no-unused-expressions + this.multihash + + Object.defineProperty(this, symbol, { value: true }) + if (CID.isCID(version)) { + // version is an exising CID instance + const cid = /** @type {CID} */(version) + this.version = cid.version + this.codec = cid.codec + this.multihash = cid.multihash + // Default guard for when a CID < 0.7 is passed with no multibaseName + // @ts-ignore + this.multibaseName = cid.multibaseName || (cid.version === 0 ? 'base58btc' : 'base32') + return + } + + if (typeof version === 'string') { + // e.g. 'base32' or false + const baseName = multibase.isEncoded(version) + if (baseName) { + // version is a CID String encoded with multibase, so v1 + const cid = multibase.decode(version) + this.version = /** @type {CIDVersion} */(parseInt(cid[0].toString(), 16)) + this.codec = multicodec.getCodec(cid.slice(1)) + this.multihash = multicodec.rmPrefix(cid.slice(1)) + this.multibaseName = baseName + } else { + // version is a base58btc string multihash, so v0 + this.version = 0 + this.codec = 'dag-pb' + this.multihash = mh.fromB58String(version) + this.multibaseName = 'base58btc' + } + CID.validateCID(this) + Object.defineProperty(this, 'string', { value: version }) + return + } + + if (version instanceof Uint8Array) { + const v = parseInt(version[0].toString(), 16) + if (v === 1) { + // version is a CID Uint8Array + const cid = version + this.version = v + this.codec = multicodec.getCodec(cid.slice(1)) + this.multihash = multicodec.rmPrefix(cid.slice(1)) + this.multibaseName = 'base32' + } else { + // version is a raw multihash Uint8Array, so v0 + this.version = 0 + this.codec = 'dag-pb' + this.multihash = version + this.multibaseName = 'base58btc' + } + CID.validateCID(this) + return + } + + // otherwise, assemble the CID from the parameters + + this.version = version + + if (typeof codec === 'number') { + // @ts-ignore + codec = codecInts[codec] + } + + this.codec = /** @type {CodecName} */ (codec) + + this.multihash = /** @type {Uint8Array} */ (multihash) + + /** + * Multibase name as string. + * + * @deprecated + * @type {string} + */ + this.multibaseName = multibaseName || (version === 0 ? 'base58btc' : 'base32') + + CID.validateCID(this) + } + + /** + * The CID as a `Uint8Array` + * + * @returns {Uint8Array} + * + */ + get bytes () { + // @ts-ignore + let bytes = this._bytes + + if (!bytes) { + if (this.version === 0) { + bytes = this.multihash + } else if (this.version === 1) { + const codec = multicodec.getCodeVarint(this.codec) + bytes = uint8ArrayConcat([ + [1], codec, this.multihash + ], 1 + codec.byteLength + this.multihash.byteLength) + } else { + throw new Error('unsupported version') + } + + // Cache this Uint8Array so it doesn't have to be recreated + Object.defineProperty(this, '_bytes', { value: bytes }) + } + + return bytes + } + + /** + * The prefix of the CID. + * + * @returns {Uint8Array} + */ + get prefix () { + const codec = multicodec.getCodeVarint(this.codec) + const multihash = mh.prefix(this.multihash) + const prefix = uint8ArrayConcat([ + [this.version], codec, multihash + ], 1 + codec.byteLength + multihash.byteLength) + + return prefix + } + + /** + * The codec of the CID in its number form. + * + * @returns {CodecCode} + */ + get code () { + return codecs[this.codec] + } + + /** + * Convert to a CID of version `0`. + * + * @returns {CID} + */ + toV0 () { + if (this.codec !== 'dag-pb') { + throw new Error('Cannot convert a non dag-pb CID to CIDv0') + } + + const { name, length } = mh.decode(this.multihash) + + if (name !== 'sha2-256') { + throw new Error('Cannot convert non sha2-256 multihash CID to CIDv0') + } + + if (length !== 32) { + throw new Error('Cannot convert non 32 byte multihash CID to CIDv0') + } + + return new CID(0, this.codec, this.multihash) + } + + /** + * Convert to a CID of version `1`. + * + * @returns {CID} + */ + toV1 () { + return new CID(1, this.codec, this.multihash, this.multibaseName) + } + + /** + * Encode the CID into a string. + * + * @param {BaseNameOrCode} [base=this.multibaseName] - Base encoding to use. + * @returns {string} + */ + toBaseEncodedString (base = this.multibaseName) { + // @ts-ignore non enumerable cache property + if (this.string && this.string.length !== 0 && base === this.multibaseName) { + // @ts-ignore non enumerable cache property + return this.string + } + let str + if (this.version === 0) { + if (base !== 'base58btc') { + throw new Error('not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()') + } + str = mh.toB58String(this.multihash) + } else if (this.version === 1) { + str = uint8ArrayToString(multibase.encode(base, this.bytes)) + } else { + throw new Error('unsupported version') + } + if (base === this.multibaseName) { + // cache the string value + Object.defineProperty(this, 'string', { value: str }) + } + return str + } + + /** + * CID(QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n) + * + * @returns {string} + */ + [Symbol.for('nodejs.util.inspect.custom')] () { + return 'CID(' + this.toString() + ')' + } + + /** + * Encode the CID into a string. + * + * @param {BaseNameOrCode} [base=this.multibaseName] - Base encoding to use. + * @returns {string} + */ + toString (base) { + return this.toBaseEncodedString(base) + } + + /** + * Serialize to a plain object. + * + * @returns {SerializedCID} + */ + toJSON () { + return { + codec: this.codec, + version: this.version, + hash: this.multihash + } + } + + /** + * Compare equality with another CID. + * + * @param {CID} other + * @returns {boolean} + */ + equals (other) { + return this.codec === other.codec && + this.version === other.version && + uint8ArrayEquals(this.multihash, other.multihash) + } + + /** + * Test if the given input is a valid CID object. + * Throws if it is not. + * + * @param {any} other - The other CID. + * @returns {void} + */ + static validateCID (other) { + const errorMsg = CIDUtil.checkCIDComponents(other) + if (errorMsg) { + throw new Error(errorMsg) + } + } + + /** + * Check if object is a CID instance + * + * @param {any} value + * @returns {value is CID} + */ + static isCID (value) { + return value instanceof CID || Boolean(value && value[symbol]) + } +} + +CID.codecs = codecs + +module.exports = CID + + /***/ }), /***/ 6168: @@ -21467,100 +21425,6 @@ CipherBase.prototype._toString = function (value, enc, fin) { module.exports = CipherBase -/***/ }), - -/***/ 6763: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/*global window, global*/ -var util = __webpack_require__(537) -var assert = __webpack_require__(4148) -function now() { return new Date().getTime() } - -var slice = Array.prototype.slice -var console -var times = {} - -if (typeof __webpack_require__.g !== "undefined" && __webpack_require__.g.console) { - console = __webpack_require__.g.console -} else if (typeof window !== "undefined" && window.console) { - console = window.console -} else { - console = {} -} - -var functions = [ - [log, "log"], - [info, "info"], - [warn, "warn"], - [error, "error"], - [time, "time"], - [timeEnd, "timeEnd"], - [trace, "trace"], - [dir, "dir"], - [consoleAssert, "assert"] -] - -for (var i = 0; i < functions.length; i++) { - var tuple = functions[i] - var f = tuple[0] - var name = tuple[1] - - if (!console[name]) { - console[name] = f - } -} - -module.exports = console - -function log() {} - -function info() { - console.log.apply(console, arguments) -} - -function warn() { - console.log.apply(console, arguments) -} - -function error() { - console.warn.apply(console, arguments) -} - -function time(label) { - times[label] = now() -} - -function timeEnd(label) { - var time = times[label] - if (!time) { - throw new Error("No such label: " + label) - } - - delete times[label] - var duration = now() - time - console.log(label + ": " + duration + "ms") -} - -function trace() { - var err = new Error() - err.name = "Trace" - err.message = util.format.apply(null, arguments) - console.error(err.stack) -} - -function dir(object) { - console.log(util.inspect(object) + "\n") -} - -function consoleAssert(expression) { - if (!expression) { - var arr = slice.call(arguments, 1) - assert.ok(false, util.format.apply(null, arr)) - } -} - - /***/ }), /***/ 5622: @@ -21680,7 +21544,7 @@ function objectToString(o) { /***/ 1324: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(8287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(2045)["hp"]; var elliptic = __webpack_require__(6729) var BN = __webpack_require__(2801) @@ -25441,59 +25305,60 @@ module.exports = Hmac /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; +var __webpack_unused_export__; -exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = __webpack_require__(3209) -exports.createHash = exports.Hash = __webpack_require__(7108) -exports.createHmac = exports.Hmac = __webpack_require__(3507) +__webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = /* unused reexport */ __webpack_require__(3209) +__webpack_unused_export__ = /* unused reexport */ __webpack_require__(7108) +__webpack_unused_export__ = /* unused reexport */ __webpack_require__(3507) var algos = __webpack_require__(5715) var algoKeys = Object.keys(algos) var hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(algoKeys) -exports.getHashes = function () { +__webpack_unused_export__ = function () { return hashes } var p = __webpack_require__(8396) -exports.pbkdf2 = p.pbkdf2 -exports.pbkdf2Sync = p.pbkdf2Sync +__webpack_unused_export__ = p.pbkdf2 +__webpack_unused_export__ = p.pbkdf2Sync var aes = __webpack_require__(125) -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 +__webpack_unused_export__ = aes.Cipher +__webpack_unused_export__ = aes.createCipher +__webpack_unused_export__ = aes.Cipheriv +__webpack_unused_export__ = aes.createCipheriv +__webpack_unused_export__ = aes.Decipher +__webpack_unused_export__ = aes.createDecipher +__webpack_unused_export__ = aes.Decipheriv +__webpack_unused_export__ = aes.createDecipheriv +__webpack_unused_export__ = aes.getCiphers +__webpack_unused_export__ = aes.listCiphers var dh = __webpack_require__(5380) -exports.DiffieHellmanGroup = dh.DiffieHellmanGroup -exports.createDiffieHellmanGroup = dh.createDiffieHellmanGroup -exports.getDiffieHellman = dh.getDiffieHellman -exports.createDiffieHellman = dh.createDiffieHellman -exports.DiffieHellman = dh.DiffieHellman +__webpack_unused_export__ = dh.DiffieHellmanGroup +__webpack_unused_export__ = dh.createDiffieHellmanGroup +__webpack_unused_export__ = dh.getDiffieHellman +__webpack_unused_export__ = dh.createDiffieHellman +__webpack_unused_export__ = dh.DiffieHellman var sign = __webpack_require__(20) -exports.createSign = sign.createSign -exports.Sign = sign.Sign -exports.createVerify = sign.createVerify -exports.Verify = sign.Verify +__webpack_unused_export__ = sign.createSign +__webpack_unused_export__ = sign.Sign +__webpack_unused_export__ = sign.createVerify +__webpack_unused_export__ = sign.Verify -exports.createECDH = __webpack_require__(1324) +/* unused reexport */ __webpack_require__(1324) var publicEncrypt = __webpack_require__(7168) -exports.publicEncrypt = publicEncrypt.publicEncrypt -exports.privateEncrypt = publicEncrypt.privateEncrypt -exports.publicDecrypt = publicEncrypt.publicDecrypt -exports.privateDecrypt = publicEncrypt.privateDecrypt +__webpack_unused_export__ = publicEncrypt.publicEncrypt +__webpack_unused_export__ = publicEncrypt.privateEncrypt +__webpack_unused_export__ = publicEncrypt.publicDecrypt +__webpack_unused_export__ = publicEncrypt.privateDecrypt // the least I can do is make error messages for the rest of the node.js/crypto api. // ;[ @@ -25510,10 +25375,10 @@ exports.privateDecrypt = publicEncrypt.privateDecrypt var rf = __webpack_require__(6983) -exports.randomFill = rf.randomFill -exports.randomFillSync = rf.randomFillSync +__webpack_unused_export__ = rf.randomFill +__webpack_unused_export__ = rf.randomFillSync -exports.createCredentials = function () { +__webpack_unused_export__ = function () { throw new Error([ 'sorry, createCredentials is not implemented yet', 'we accept pull requests', @@ -25521,7 +25386,7 @@ exports.createCredentials = function () { ].join('\n')) } -exports.constants = { +__webpack_unused_export__ = { 'DH_CHECK_P_NOT_SAFE_PRIME': 2, 'DH_CHECK_P_NOT_PRIME': 1, 'DH_UNABLE_TO_CHECK_GENERATOR': 4, @@ -26386,7 +26251,7 @@ exports.padSplit = function padSplit(num, size, group) { /***/ 5380: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(8287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(2045)["hp"]; var generatePrime = __webpack_require__(4934) var primes = __webpack_require__(3241) @@ -26436,7 +26301,7 @@ exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman /***/ 4910: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(8287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(2045)["hp"]; var BN = __webpack_require__(6473); var MillerRabin = __webpack_require__(2244); var millerRabin = new MillerRabin(); @@ -32810,6 +32675,10 @@ function getLength(buf, p) { return false; } + if(buf[p.place] === 0x00) { + return false; + } + var val = 0; for (var i = 0, off = p.place; i < octetLen; i++, off++) { val <<= 8; @@ -32858,6 +32727,9 @@ Signature.prototype._importDER = function _importDER(data, enc) { if (rlen === false) { return false; } + if ((data[p.place] & 128) !== 0) { + return false; + } var r = data.slice(p.place, rlen + p.place); p.place += rlen; if (data[p.place++] !== 0x02) { @@ -32870,6 +32742,9 @@ Signature.prototype._importDER = function _importDER(data, enc) { if (data.length !== slen + p.place) { return false; } + if ((data[p.place] & 128) !== 0) { + return false; + } var s = data.slice(p.place, slen + p.place); if (r[0] === 0) { if (r[1] & 0x80) { @@ -32998,6 +32873,9 @@ EDDSA.prototype.sign = function sign(message, secret) { EDDSA.prototype.verify = function verify(message, sig, pub) { message = parseBytes(message); sig = this.makeSignature(sig); + if (sig.S().gte(sig.eddsa.curve.n) || sig.S().isNeg()) { + return false; + } var key = this.keyFromPublic(pub); var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message); var SG = this.g.mul(sig.S()); @@ -33196,6 +33074,7 @@ function Signature(eddsa, sig) { sig = parseBytes(sig); if (Array.isArray(sig)) { + assert(sig.length === eddsa.encodingLength * 2, 'Signature has invalid size'); sig = { R: sig.slice(0, eddsa.encodingLength), S: sig.slice(eddsa.encodingLength), @@ -37722,10 +37601,9 @@ module.exports = URIError; /***/ }), /***/ 7007: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ ((module) => { "use strict"; -/* provided dependency */ var console = __webpack_require__(6763); // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -40846,12 +40724,318 @@ module.exports = function isTypedArray(value) { }; +/***/ }), + +/***/ 8127: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/* provided dependency */ var Buffer = __webpack_require__(2045)["hp"]; +// +// THIS FILE IS AUTOMATICALLY GENERATED! DO NOT EDIT BY HAND! +// +; +(function (global, factory) { + true + ? module.exports = factory() + : 0; +}((typeof self !== 'undefined' ? self + : typeof window !== 'undefined' ? window + : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g + : this), function () { + 'use strict'; + /** + * base64.ts + * + * Licensed under the BSD 3-Clause License. + * http://opensource.org/licenses/BSD-3-Clause + * + * References: + * http://en.wikipedia.org/wiki/Base64 + * + * @author Dan Kogai (https://github.com/dankogai) + */ + var version = '3.7.7'; + /** + * @deprecated use lowercase `version`. + */ + var VERSION = version; + var _hasBuffer = typeof Buffer === 'function'; + var _TD = typeof TextDecoder === 'function' ? new TextDecoder() : undefined; + var _TE = typeof TextEncoder === 'function' ? new TextEncoder() : undefined; + var b64ch = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; + var b64chs = Array.prototype.slice.call(b64ch); + var b64tab = (function (a) { + var tab = {}; + a.forEach(function (c, i) { return tab[c] = i; }); + return tab; + })(b64chs); + var b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/; + var _fromCC = String.fromCharCode.bind(String); + var _U8Afrom = typeof Uint8Array.from === 'function' + ? Uint8Array.from.bind(Uint8Array) + : function (it) { return new Uint8Array(Array.prototype.slice.call(it, 0)); }; + var _mkUriSafe = function (src) { return src + .replace(/=/g, '').replace(/[+\/]/g, function (m0) { return m0 == '+' ? '-' : '_'; }); }; + var _tidyB64 = function (s) { return s.replace(/[^A-Za-z0-9\+\/]/g, ''); }; + /** + * polyfill version of `btoa` + */ + var btoaPolyfill = function (bin) { + // console.log('polyfilled'); + var u32, c0, c1, c2, asc = ''; + var pad = bin.length % 3; + for (var i = 0; i < bin.length;) { + if ((c0 = bin.charCodeAt(i++)) > 255 || + (c1 = bin.charCodeAt(i++)) > 255 || + (c2 = bin.charCodeAt(i++)) > 255) + throw new TypeError('invalid character found'); + u32 = (c0 << 16) | (c1 << 8) | c2; + asc += b64chs[u32 >> 18 & 63] + + b64chs[u32 >> 12 & 63] + + b64chs[u32 >> 6 & 63] + + b64chs[u32 & 63]; + } + return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc; + }; + /** + * does what `window.btoa` of web browsers do. + * @param {String} bin binary string + * @returns {string} Base64-encoded string + */ + var _btoa = typeof btoa === 'function' ? function (bin) { return btoa(bin); } + : _hasBuffer ? function (bin) { return Buffer.from(bin, 'binary').toString('base64'); } + : btoaPolyfill; + var _fromUint8Array = _hasBuffer + ? function (u8a) { return Buffer.from(u8a).toString('base64'); } + : function (u8a) { + // cf. https://stackoverflow.com/questions/12710001/how-to-convert-uint8-array-to-base64-encoded-string/12713326#12713326 + var maxargs = 0x1000; + var strs = []; + for (var i = 0, l = u8a.length; i < l; i += maxargs) { + strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs))); + } + return _btoa(strs.join('')); + }; + /** + * converts a Uint8Array to a Base64 string. + * @param {boolean} [urlsafe] URL-and-filename-safe a la RFC4648 §5 + * @returns {string} Base64 string + */ + var fromUint8Array = function (u8a, urlsafe) { + if (urlsafe === void 0) { urlsafe = false; } + return urlsafe ? _mkUriSafe(_fromUint8Array(u8a)) : _fromUint8Array(u8a); + }; + // This trick is found broken https://github.com/dankogai/js-base64/issues/130 + // const utob = (src: string) => unescape(encodeURIComponent(src)); + // reverting good old fationed regexp + var cb_utob = function (c) { + if (c.length < 2) { + var cc = c.charCodeAt(0); + return cc < 0x80 ? c + : cc < 0x800 ? (_fromCC(0xc0 | (cc >>> 6)) + + _fromCC(0x80 | (cc & 0x3f))) + : (_fromCC(0xe0 | ((cc >>> 12) & 0x0f)) + + _fromCC(0x80 | ((cc >>> 6) & 0x3f)) + + _fromCC(0x80 | (cc & 0x3f))); + } + else { + var cc = 0x10000 + + (c.charCodeAt(0) - 0xD800) * 0x400 + + (c.charCodeAt(1) - 0xDC00); + return (_fromCC(0xf0 | ((cc >>> 18) & 0x07)) + + _fromCC(0x80 | ((cc >>> 12) & 0x3f)) + + _fromCC(0x80 | ((cc >>> 6) & 0x3f)) + + _fromCC(0x80 | (cc & 0x3f))); + } + }; + var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g; + /** + * @deprecated should have been internal use only. + * @param {string} src UTF-8 string + * @returns {string} UTF-16 string + */ + var utob = function (u) { return u.replace(re_utob, cb_utob); }; + // + var _encode = _hasBuffer + ? function (s) { return Buffer.from(s, 'utf8').toString('base64'); } + : _TE + ? function (s) { return _fromUint8Array(_TE.encode(s)); } + : function (s) { return _btoa(utob(s)); }; + /** + * converts a UTF-8-encoded string to a Base64 string. + * @param {boolean} [urlsafe] if `true` make the result URL-safe + * @returns {string} Base64 string + */ + var encode = function (src, urlsafe) { + if (urlsafe === void 0) { urlsafe = false; } + return urlsafe + ? _mkUriSafe(_encode(src)) + : _encode(src); + }; + /** + * converts a UTF-8-encoded string to URL-safe Base64 RFC4648 §5. + * @returns {string} Base64 string + */ + var encodeURI = function (src) { return encode(src, true); }; + // This trick is found broken https://github.com/dankogai/js-base64/issues/130 + // const btou = (src: string) => decodeURIComponent(escape(src)); + // reverting good old fationed regexp + var re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g; + var cb_btou = function (cccc) { + switch (cccc.length) { + case 4: + var cp = ((0x07 & cccc.charCodeAt(0)) << 18) + | ((0x3f & cccc.charCodeAt(1)) << 12) + | ((0x3f & cccc.charCodeAt(2)) << 6) + | (0x3f & cccc.charCodeAt(3)), offset = cp - 0x10000; + return (_fromCC((offset >>> 10) + 0xD800) + + _fromCC((offset & 0x3FF) + 0xDC00)); + case 3: + return _fromCC(((0x0f & cccc.charCodeAt(0)) << 12) + | ((0x3f & cccc.charCodeAt(1)) << 6) + | (0x3f & cccc.charCodeAt(2))); + default: + return _fromCC(((0x1f & cccc.charCodeAt(0)) << 6) + | (0x3f & cccc.charCodeAt(1))); + } + }; + /** + * @deprecated should have been internal use only. + * @param {string} src UTF-16 string + * @returns {string} UTF-8 string + */ + var btou = function (b) { return b.replace(re_btou, cb_btou); }; + /** + * polyfill version of `atob` + */ + var atobPolyfill = function (asc) { + // console.log('polyfilled'); + asc = asc.replace(/\s+/g, ''); + if (!b64re.test(asc)) + throw new TypeError('malformed base64.'); + asc += '=='.slice(2 - (asc.length & 3)); + var u24, bin = '', r1, r2; + for (var i = 0; i < asc.length;) { + u24 = b64tab[asc.charAt(i++)] << 18 + | b64tab[asc.charAt(i++)] << 12 + | (r1 = b64tab[asc.charAt(i++)]) << 6 + | (r2 = b64tab[asc.charAt(i++)]); + bin += r1 === 64 ? _fromCC(u24 >> 16 & 255) + : r2 === 64 ? _fromCC(u24 >> 16 & 255, u24 >> 8 & 255) + : _fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255); + } + return bin; + }; + /** + * does what `window.atob` of web browsers do. + * @param {String} asc Base64-encoded string + * @returns {string} binary string + */ + var _atob = typeof atob === 'function' ? function (asc) { return atob(_tidyB64(asc)); } + : _hasBuffer ? function (asc) { return Buffer.from(asc, 'base64').toString('binary'); } + : atobPolyfill; + // + var _toUint8Array = _hasBuffer + ? function (a) { return _U8Afrom(Buffer.from(a, 'base64')); } + : function (a) { return _U8Afrom(_atob(a).split('').map(function (c) { return c.charCodeAt(0); })); }; + /** + * converts a Base64 string to a Uint8Array. + */ + var toUint8Array = function (a) { return _toUint8Array(_unURI(a)); }; + // + var _decode = _hasBuffer + ? function (a) { return Buffer.from(a, 'base64').toString('utf8'); } + : _TD + ? function (a) { return _TD.decode(_toUint8Array(a)); } + : function (a) { return btou(_atob(a)); }; + var _unURI = function (a) { return _tidyB64(a.replace(/[-_]/g, function (m0) { return m0 == '-' ? '+' : '/'; })); }; + /** + * converts a Base64 string to a UTF-8 string. + * @param {String} src Base64 string. Both normal and URL-safe are supported + * @returns {string} UTF-8 string + */ + var decode = function (src) { return _decode(_unURI(src)); }; + /** + * check if a value is a valid Base64 string + * @param {String} src a value to check + */ + var isValid = function (src) { + if (typeof src !== 'string') + return false; + var s = src.replace(/\s+/g, '').replace(/={0,2}$/, ''); + return !/[^\s0-9a-zA-Z\+/]/.test(s) || !/[^\s0-9a-zA-Z\-_]/.test(s); + }; + // + var _noEnum = function (v) { + return { + value: v, enumerable: false, writable: true, configurable: true + }; + }; + /** + * extend String.prototype with relevant methods + */ + var extendString = function () { + var _add = function (name, body) { return Object.defineProperty(String.prototype, name, _noEnum(body)); }; + _add('fromBase64', function () { return decode(this); }); + _add('toBase64', function (urlsafe) { return encode(this, urlsafe); }); + _add('toBase64URI', function () { return encode(this, true); }); + _add('toBase64URL', function () { return encode(this, true); }); + _add('toUint8Array', function () { return toUint8Array(this); }); + }; + /** + * extend Uint8Array.prototype with relevant methods + */ + var extendUint8Array = function () { + var _add = function (name, body) { return Object.defineProperty(Uint8Array.prototype, name, _noEnum(body)); }; + _add('toBase64', function (urlsafe) { return fromUint8Array(this, urlsafe); }); + _add('toBase64URI', function () { return fromUint8Array(this, true); }); + _add('toBase64URL', function () { return fromUint8Array(this, true); }); + }; + /** + * extend Builtin prototypes with relevant methods + */ + var extendBuiltins = function () { + extendString(); + extendUint8Array(); + }; + var gBase64 = { + version: version, + VERSION: VERSION, + atob: _atob, + atobPolyfill: atobPolyfill, + btoa: _btoa, + btoaPolyfill: btoaPolyfill, + fromBase64: decode, + toBase64: encode, + encode: encode, + encodeURI: encodeURI, + encodeURL: encodeURI, + utob: utob, + btou: btou, + decode: decode, + isValid: isValid, + fromUint8Array: fromUint8Array, + toUint8Array: toUint8Array, + extendString: extendString, + extendUint8Array: extendUint8Array, + extendBuiltins: extendBuiltins + }; + // + // export Base64 to the namespace + // + // ES5 is yet to have Object.assign() that may make transpilers unhappy. + // gBase64.Base64 = Object.assign({}, gBase64); + gBase64.Base64 = {}; + Object.keys(gBase64).forEach(function (k) { return gBase64.Base64[k] = gBase64[k]; }); + return gBase64; +})); + + /***/ }), /***/ 1176: /***/ ((module, exports, __webpack_require__) => { -/* provided dependency */ var process = __webpack_require__(5606); var __WEBPACK_AMD_DEFINE_RESULT__;/** * [js-sha3]{@link https://github.com/emn178/js-sha3} * @@ -45428,6 +45612,2465 @@ utils.encode = function encode(arr, enc) { }; +/***/ }), + +/***/ 8633: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { encodeText } = __webpack_require__(4084) + +/** @typedef {import('./types').CodecFactory} CodecFactory */ +/** @typedef {import("./types").BaseName} BaseName */ +/** @typedef {import("./types").BaseCode} BaseCode */ + +/** + * Class to encode/decode in the supported Bases + * + */ +class Base { + /** + * @param {BaseName} name + * @param {BaseCode} code + * @param {CodecFactory} factory + * @param {string} alphabet + */ + constructor (name, code, factory, alphabet) { + this.name = name + this.code = code + this.codeBuf = encodeText(this.code) + this.alphabet = alphabet + this.codec = factory(alphabet) + } + + /** + * @param {Uint8Array} buf + * @returns {string} + */ + encode (buf) { + return this.codec.encode(buf) + } + + /** + * @param {string} string + * @returns {Uint8Array} + */ + decode (string) { + for (const char of string) { + if (this.alphabet && this.alphabet.indexOf(char) < 0) { + throw new Error(`invalid character '${char}' in '${string}'`) + } + } + return this.codec.decode(string) + } +} + +module.exports = Base + + +/***/ }), + +/***/ 7579: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const baseX = __webpack_require__(5084) +const Base = __webpack_require__(8633) +const { rfc4648 } = __webpack_require__(9417) +const { decodeText, encodeText } = __webpack_require__(4084) + +/** @typedef {import('./types').CodecFactory} CodecFactory */ +/** @typedef {import('./types').Codec} Codec */ +/** @typedef {import('./types').BaseName} BaseName */ +/** @typedef {import('./types').BaseCode} BaseCode */ + +/** @type {CodecFactory} */ +const identity = () => { + return { + encode: decodeText, + decode: encodeText + } +} + +/** + * + * name, code, implementation, alphabet + * + * @type {Array<[BaseName, BaseCode, CodecFactory, string]>} + */ +const constants = [ + ['identity', '\x00', identity, ''], + ['base2', '0', rfc4648(1), '01'], + ['base8', '7', rfc4648(3), '01234567'], + ['base10', '9', baseX, '0123456789'], + ['base16', 'f', rfc4648(4), '0123456789abcdef'], + ['base16upper', 'F', rfc4648(4), '0123456789ABCDEF'], + ['base32hex', 'v', rfc4648(5), '0123456789abcdefghijklmnopqrstuv'], + ['base32hexupper', 'V', rfc4648(5), '0123456789ABCDEFGHIJKLMNOPQRSTUV'], + ['base32hexpad', 't', rfc4648(5), '0123456789abcdefghijklmnopqrstuv='], + ['base32hexpadupper', 'T', rfc4648(5), '0123456789ABCDEFGHIJKLMNOPQRSTUV='], + ['base32', 'b', rfc4648(5), 'abcdefghijklmnopqrstuvwxyz234567'], + ['base32upper', 'B', rfc4648(5), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'], + ['base32pad', 'c', rfc4648(5), 'abcdefghijklmnopqrstuvwxyz234567='], + ['base32padupper', 'C', rfc4648(5), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567='], + ['base32z', 'h', rfc4648(5), 'ybndrfg8ejkmcpqxot1uwisza345h769'], + ['base36', 'k', baseX, '0123456789abcdefghijklmnopqrstuvwxyz'], + ['base36upper', 'K', baseX, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'], + ['base58btc', 'z', baseX, '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'], + ['base58flickr', 'Z', baseX, '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'], + ['base64', 'm', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'], + ['base64pad', 'M', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='], + ['base64url', 'u', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'], + ['base64urlpad', 'U', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_='] +] + +/** @type {Record} */ +const names = constants.reduce((prev, tupple) => { + prev[tupple[0]] = new Base(tupple[0], tupple[1], tupple[2], tupple[3]) + return prev +}, /** @type {Record} */({})) + +/** @type {Record} */ +const codes = constants.reduce((prev, tupple) => { + prev[tupple[1]] = names[tupple[0]] + return prev +}, /** @type {Record} */({})) + +module.exports = { + names, + codes +} + + +/***/ }), + +/***/ 1466: +/***/ ((module, exports, __webpack_require__) => { + +"use strict"; +/** + * Implementation of the [multibase](https://github.com/multiformats/multibase) specification. + * + */ + + +const constants = __webpack_require__(7579) +const { encodeText, decodeText, concat } = __webpack_require__(4084) + +/** @typedef {import('./base')} Base */ +/** @typedef {import("./types").BaseNameOrCode} BaseNameOrCode */ +/** @typedef {import("./types").BaseCode} BaseCode */ +/** @typedef {import("./types").BaseName} BaseName */ + +/** + * Create a new Uint8Array with the multibase varint+code. + * + * @param {BaseNameOrCode} nameOrCode - The multibase name or code number. + * @param {Uint8Array} buf - The data to be prefixed with multibase. + * @returns {Uint8Array} + * @throws {Error} Will throw if the encoding is not supported + */ +function multibase (nameOrCode, buf) { + if (!buf) { + throw new Error('requires an encoded Uint8Array') + } + const { name, codeBuf } = encoding(nameOrCode) + validEncode(name, buf) + + return concat([codeBuf, buf], codeBuf.length + buf.length) +} + +/** + * Encode data with the specified base and add the multibase prefix. + * + * @param {BaseNameOrCode} nameOrCode - The multibase name or code number. + * @param {Uint8Array} buf - The data to be encoded. + * @returns {Uint8Array} + * @throws {Error} Will throw if the encoding is not supported + * + */ +function encode (nameOrCode, buf) { + const enc = encoding(nameOrCode) + const data = encodeText(enc.encode(buf)) + + return concat([enc.codeBuf, data], enc.codeBuf.length + data.length) +} + +/** + * Takes a Uint8Array or string encoded with multibase header, decodes it and + * returns the decoded buffer + * + * @param {Uint8Array|string} data + * @returns {Uint8Array} + * @throws {Error} Will throw if the encoding is not supported + * + */ +function decode (data) { + if (data instanceof Uint8Array) { + data = decodeText(data) + } + const prefix = data[0] + + // Make all encodings case-insensitive except the ones that include upper and lower chars in the alphabet + if (['f', 'F', 'v', 'V', 't', 'T', 'b', 'B', 'c', 'C', 'h', 'k', 'K'].includes(prefix)) { + data = data.toLowerCase() + } + const enc = encoding(/** @type {BaseCode} */(data[0])) + return enc.decode(data.substring(1)) +} + +/** + * Is the given data multibase encoded? + * + * @param {Uint8Array|string} data + */ +function isEncoded (data) { + if (data instanceof Uint8Array) { + data = decodeText(data) + } + + // Ensure bufOrString is a string + if (Object.prototype.toString.call(data) !== '[object String]') { + return false + } + + try { + const enc = encoding(/** @type {BaseCode} */(data[0])) + return enc.name + } catch (err) { + return false + } +} + +/** + * Validate encoded data + * + * @param {BaseNameOrCode} name + * @param {Uint8Array} buf + * @returns {void} + * @throws {Error} Will throw if the encoding is not supported + */ +function validEncode (name, buf) { + const enc = encoding(name) + enc.decode(decodeText(buf)) +} + +/** + * Get the encoding by name or code + * + * @param {BaseNameOrCode} nameOrCode + * @returns {Base} + * @throws {Error} Will throw if the encoding is not supported + */ +function encoding (nameOrCode) { + if (Object.prototype.hasOwnProperty.call(constants.names, /** @type {BaseName} */(nameOrCode))) { + return constants.names[/** @type {BaseName} */(nameOrCode)] + } else if (Object.prototype.hasOwnProperty.call(constants.codes, /** @type {BaseCode} */(nameOrCode))) { + return constants.codes[/** @type {BaseCode} */(nameOrCode)] + } else { + throw new Error(`Unsupported encoding: ${nameOrCode}`) + } +} + +/** + * Get encoding from data + * + * @param {string|Uint8Array} data + * @returns {Base} + * @throws {Error} Will throw if the encoding is not supported + */ +function encodingFromData (data) { + if (data instanceof Uint8Array) { + data = decodeText(data) + } + + return encoding(/** @type {BaseCode} */(data[0])) +} + +exports = module.exports = multibase +exports.encode = encode +exports.decode = decode +exports.isEncoded = isEncoded +exports.encoding = encoding +exports.encodingFromData = encodingFromData +const names = Object.freeze(constants.names) +const codes = Object.freeze(constants.codes) +exports.names = names +exports.codes = codes + + +/***/ }), + +/***/ 9417: +/***/ ((module) => { + +"use strict"; + + +/** @typedef {import('./types').CodecFactory} CodecFactory */ + +/** + * @param {string} string + * @param {string} alphabet + * @param {number} bitsPerChar + * @returns {Uint8Array} + */ +const decode = (string, alphabet, bitsPerChar) => { + // Build the character lookup table: + /** @type {Record} */ + const codes = {} + for (let i = 0; i < alphabet.length; ++i) { + codes[alphabet[i]] = i + } + + // Count the padding bytes: + let end = string.length + while (string[end - 1] === '=') { + --end + } + + // Allocate the output: + const out = new Uint8Array((end * bitsPerChar / 8) | 0) + + // Parse the data: + let bits = 0 // Number of bits currently in the buffer + let buffer = 0 // Bits waiting to be written out, MSB first + let written = 0 // Next byte to write + for (let i = 0; i < end; ++i) { + // Read one character from the string: + const value = codes[string[i]] + if (value === undefined) { + throw new SyntaxError('Invalid character ' + string[i]) + } + + // Append the bits to the buffer: + buffer = (buffer << bitsPerChar) | value + bits += bitsPerChar + + // Write out some bits if the buffer has a byte's worth: + if (bits >= 8) { + bits -= 8 + out[written++] = 0xff & (buffer >> bits) + } + } + + // Verify that we have received just enough bits: + if (bits >= bitsPerChar || 0xff & (buffer << (8 - bits))) { + throw new SyntaxError('Unexpected end of data') + } + + return out +} + +/** + * @param {Uint8Array} data + * @param {string} alphabet + * @param {number} bitsPerChar + * @returns {string} + */ +const encode = (data, alphabet, bitsPerChar) => { + const pad = alphabet[alphabet.length - 1] === '=' + const mask = (1 << bitsPerChar) - 1 + let out = '' + + let bits = 0 // Number of bits currently in the buffer + let buffer = 0 // Bits waiting to be written out, MSB first + for (let i = 0; i < data.length; ++i) { + // Slurp data into the buffer: + buffer = (buffer << 8) | data[i] + bits += 8 + + // Write out as much as we can: + while (bits > bitsPerChar) { + bits -= bitsPerChar + out += alphabet[mask & (buffer >> bits)] + } + } + + // Partial character: + if (bits) { + out += alphabet[mask & (buffer << (bitsPerChar - bits))] + } + + // Add padding characters until we hit a byte boundary: + if (pad) { + while ((out.length * bitsPerChar) & 7) { + out += '=' + } + } + + return out +} + +/** + * RFC4648 Factory + * + * @param {number} bitsPerChar + * @returns {CodecFactory} + */ +const rfc4648 = (bitsPerChar) => (alphabet) => { + return { + /** + * @param {Uint8Array} input + * @returns {string} + */ + encode (input) { + return encode(input, alphabet, bitsPerChar) + }, + /** + * @param {string} input + * @returns {Uint8Array} + */ + decode (input) { + return decode(input, alphabet, bitsPerChar) + } + } +} + +module.exports = { rfc4648 } + + +/***/ }), + +/***/ 4084: +/***/ ((module) => { + +"use strict"; + + +const textDecoder = new TextDecoder() +/** + * @param {ArrayBufferView|ArrayBuffer} bytes + * @returns {string} + */ +const decodeText = (bytes) => textDecoder.decode(bytes) + +const textEncoder = new TextEncoder() +/** + * @param {string} text + * @returns {Uint8Array} + */ +const encodeText = (text) => textEncoder.encode(text) + +/** + * Returns a new Uint8Array created by concatenating the passed Arrays + * + * @param {Array>} arrs + * @param {number} length + * @returns {Uint8Array} + */ +function concat (arrs, length) { + const output = new Uint8Array(length) + let offset = 0 + + for (const arr of arrs) { + output.set(arr, offset) + offset += arr.length + } + + return output +} + +module.exports = { decodeText, encodeText, concat } + + +/***/ }), + +/***/ 5194: +/***/ ((module) => { + +module.exports = read + +var MSB = 0x80 + , REST = 0x7F + +function read(buf, offset) { + var res = 0 + , offset = offset || 0 + , shift = 0 + , counter = offset + , b + , l = buf.length + + do { + if (counter >= l || shift > 49) { + read.bytes = 0 + throw new RangeError('Could not decode varint') + } + b = buf[counter++] + res += shift < 28 + ? (b & REST) << shift + : (b & REST) * Math.pow(2, shift) + shift += 7 + } while (b >= MSB) + + read.bytes = counter - offset + + return res +} + + +/***/ }), + +/***/ 5134: +/***/ ((module) => { + +module.exports = encode + +var MSB = 0x80 + , REST = 0x7F + , MSBALL = ~REST + , INT = Math.pow(2, 31) + +function encode(num, out, offset) { + if (Number.MAX_SAFE_INTEGER && num > Number.MAX_SAFE_INTEGER) { + encode.bytes = 0 + throw new RangeError('Could not encode varint') + } + out = out || [] + offset = offset || 0 + var oldOffset = offset + + while(num >= INT) { + out[offset++] = (num & 0xFF) | MSB + num /= 128 + } + while(num & MSBALL) { + out[offset++] = (num & 0xFF) | MSB + num >>>= 7 + } + out[offset] = num | 0 + + encode.bytes = offset - oldOffset + 1 + + return out +} + + +/***/ }), + +/***/ 38: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +module.exports = { + encode: __webpack_require__(5134) + , decode: __webpack_require__(5194) + , encodingLength: __webpack_require__(6516) +} + + +/***/ }), + +/***/ 6516: +/***/ ((module) => { + + +var N1 = Math.pow(2, 7) +var N2 = Math.pow(2, 14) +var N3 = Math.pow(2, 21) +var N4 = Math.pow(2, 28) +var N5 = Math.pow(2, 35) +var N6 = Math.pow(2, 42) +var N7 = Math.pow(2, 49) +var N8 = Math.pow(2, 56) +var N9 = Math.pow(2, 63) + +module.exports = function (value) { + return ( + value < N1 ? 1 + : value < N2 ? 2 + : value < N3 ? 3 + : value < N4 ? 4 + : value < N5 ? 5 + : value < N6 ? 6 + : value < N7 ? 7 + : value < N8 ? 8 + : value < N9 ? 9 + : 10 + ) +} + + +/***/ }), + +/***/ 5661: +/***/ ((module) => { + +"use strict"; +// DO NOT CHANGE THIS FILE. IT IS GENERATED BY tools/update-table.js +/* eslint quote-props: off */ + + +/** + * @type {import('./generated-types').NameCodeMap} + */ +const baseTable = Object.freeze({ + 'identity': 0x00, + 'cidv1': 0x01, + 'cidv2': 0x02, + 'cidv3': 0x03, + 'ip4': 0x04, + 'tcp': 0x06, + 'sha1': 0x11, + 'sha2-256': 0x12, + 'sha2-512': 0x13, + 'sha3-512': 0x14, + 'sha3-384': 0x15, + 'sha3-256': 0x16, + 'sha3-224': 0x17, + 'shake-128': 0x18, + 'shake-256': 0x19, + 'keccak-224': 0x1a, + 'keccak-256': 0x1b, + 'keccak-384': 0x1c, + 'keccak-512': 0x1d, + 'blake3': 0x1e, + 'dccp': 0x21, + 'murmur3-128': 0x22, + 'murmur3-32': 0x23, + 'ip6': 0x29, + 'ip6zone': 0x2a, + 'path': 0x2f, + 'multicodec': 0x30, + 'multihash': 0x31, + 'multiaddr': 0x32, + 'multibase': 0x33, + 'dns': 0x35, + 'dns4': 0x36, + 'dns6': 0x37, + 'dnsaddr': 0x38, + 'protobuf': 0x50, + 'cbor': 0x51, + 'raw': 0x55, + 'dbl-sha2-256': 0x56, + 'rlp': 0x60, + 'bencode': 0x63, + 'dag-pb': 0x70, + 'dag-cbor': 0x71, + 'libp2p-key': 0x72, + 'git-raw': 0x78, + 'torrent-info': 0x7b, + 'torrent-file': 0x7c, + 'leofcoin-block': 0x81, + 'leofcoin-tx': 0x82, + 'leofcoin-pr': 0x83, + 'sctp': 0x84, + 'dag-jose': 0x85, + 'dag-cose': 0x86, + 'eth-block': 0x90, + 'eth-block-list': 0x91, + 'eth-tx-trie': 0x92, + 'eth-tx': 0x93, + 'eth-tx-receipt-trie': 0x94, + 'eth-tx-receipt': 0x95, + 'eth-state-trie': 0x96, + 'eth-account-snapshot': 0x97, + 'eth-storage-trie': 0x98, + 'eth-receipt-log-trie': 0x99, + 'eth-reciept-log': 0x9a, + 'bitcoin-block': 0xb0, + 'bitcoin-tx': 0xb1, + 'bitcoin-witness-commitment': 0xb2, + 'zcash-block': 0xc0, + 'zcash-tx': 0xc1, + 'caip-50': 0xca, + 'streamid': 0xce, + 'stellar-block': 0xd0, + 'stellar-tx': 0xd1, + 'md4': 0xd4, + 'md5': 0xd5, + 'bmt': 0xd6, + 'decred-block': 0xe0, + 'decred-tx': 0xe1, + 'ipld-ns': 0xe2, + 'ipfs-ns': 0xe3, + 'swarm-ns': 0xe4, + 'ipns-ns': 0xe5, + 'zeronet': 0xe6, + 'secp256k1-pub': 0xe7, + 'bls12_381-g1-pub': 0xea, + 'bls12_381-g2-pub': 0xeb, + 'x25519-pub': 0xec, + 'ed25519-pub': 0xed, + 'bls12_381-g1g2-pub': 0xee, + 'dash-block': 0xf0, + 'dash-tx': 0xf1, + 'swarm-manifest': 0xfa, + 'swarm-feed': 0xfb, + 'udp': 0x0111, + 'p2p-webrtc-star': 0x0113, + 'p2p-webrtc-direct': 0x0114, + 'p2p-stardust': 0x0115, + 'p2p-circuit': 0x0122, + 'dag-json': 0x0129, + 'udt': 0x012d, + 'utp': 0x012e, + 'unix': 0x0190, + 'thread': 0x0196, + 'p2p': 0x01a5, + 'ipfs': 0x01a5, + 'https': 0x01bb, + 'onion': 0x01bc, + 'onion3': 0x01bd, + 'garlic64': 0x01be, + 'garlic32': 0x01bf, + 'tls': 0x01c0, + 'noise': 0x01c6, + 'quic': 0x01cc, + 'ws': 0x01dd, + 'wss': 0x01de, + 'p2p-websocket-star': 0x01df, + 'http': 0x01e0, + 'swhid-1-snp': 0x01f0, + 'json': 0x0200, + 'messagepack': 0x0201, + 'libp2p-peer-record': 0x0301, + 'libp2p-relay-rsvp': 0x0302, + 'car-index-sorted': 0x0400, + 'sha2-256-trunc254-padded': 0x1012, + 'ripemd-128': 0x1052, + 'ripemd-160': 0x1053, + 'ripemd-256': 0x1054, + 'ripemd-320': 0x1055, + 'x11': 0x1100, + 'p256-pub': 0x1200, + 'p384-pub': 0x1201, + 'p521-pub': 0x1202, + 'ed448-pub': 0x1203, + 'x448-pub': 0x1204, + 'ed25519-priv': 0x1300, + 'secp256k1-priv': 0x1301, + 'x25519-priv': 0x1302, + 'kangarootwelve': 0x1d01, + 'sm3-256': 0x534d, + 'blake2b-8': 0xb201, + 'blake2b-16': 0xb202, + 'blake2b-24': 0xb203, + 'blake2b-32': 0xb204, + 'blake2b-40': 0xb205, + 'blake2b-48': 0xb206, + 'blake2b-56': 0xb207, + 'blake2b-64': 0xb208, + 'blake2b-72': 0xb209, + 'blake2b-80': 0xb20a, + 'blake2b-88': 0xb20b, + 'blake2b-96': 0xb20c, + 'blake2b-104': 0xb20d, + 'blake2b-112': 0xb20e, + 'blake2b-120': 0xb20f, + 'blake2b-128': 0xb210, + 'blake2b-136': 0xb211, + 'blake2b-144': 0xb212, + 'blake2b-152': 0xb213, + 'blake2b-160': 0xb214, + 'blake2b-168': 0xb215, + 'blake2b-176': 0xb216, + 'blake2b-184': 0xb217, + 'blake2b-192': 0xb218, + 'blake2b-200': 0xb219, + 'blake2b-208': 0xb21a, + 'blake2b-216': 0xb21b, + 'blake2b-224': 0xb21c, + 'blake2b-232': 0xb21d, + 'blake2b-240': 0xb21e, + 'blake2b-248': 0xb21f, + 'blake2b-256': 0xb220, + 'blake2b-264': 0xb221, + 'blake2b-272': 0xb222, + 'blake2b-280': 0xb223, + 'blake2b-288': 0xb224, + 'blake2b-296': 0xb225, + 'blake2b-304': 0xb226, + 'blake2b-312': 0xb227, + 'blake2b-320': 0xb228, + 'blake2b-328': 0xb229, + 'blake2b-336': 0xb22a, + 'blake2b-344': 0xb22b, + 'blake2b-352': 0xb22c, + 'blake2b-360': 0xb22d, + 'blake2b-368': 0xb22e, + 'blake2b-376': 0xb22f, + 'blake2b-384': 0xb230, + 'blake2b-392': 0xb231, + 'blake2b-400': 0xb232, + 'blake2b-408': 0xb233, + 'blake2b-416': 0xb234, + 'blake2b-424': 0xb235, + 'blake2b-432': 0xb236, + 'blake2b-440': 0xb237, + 'blake2b-448': 0xb238, + 'blake2b-456': 0xb239, + 'blake2b-464': 0xb23a, + 'blake2b-472': 0xb23b, + 'blake2b-480': 0xb23c, + 'blake2b-488': 0xb23d, + 'blake2b-496': 0xb23e, + 'blake2b-504': 0xb23f, + 'blake2b-512': 0xb240, + 'blake2s-8': 0xb241, + 'blake2s-16': 0xb242, + 'blake2s-24': 0xb243, + 'blake2s-32': 0xb244, + 'blake2s-40': 0xb245, + 'blake2s-48': 0xb246, + 'blake2s-56': 0xb247, + 'blake2s-64': 0xb248, + 'blake2s-72': 0xb249, + 'blake2s-80': 0xb24a, + 'blake2s-88': 0xb24b, + 'blake2s-96': 0xb24c, + 'blake2s-104': 0xb24d, + 'blake2s-112': 0xb24e, + 'blake2s-120': 0xb24f, + 'blake2s-128': 0xb250, + 'blake2s-136': 0xb251, + 'blake2s-144': 0xb252, + 'blake2s-152': 0xb253, + 'blake2s-160': 0xb254, + 'blake2s-168': 0xb255, + 'blake2s-176': 0xb256, + 'blake2s-184': 0xb257, + 'blake2s-192': 0xb258, + 'blake2s-200': 0xb259, + 'blake2s-208': 0xb25a, + 'blake2s-216': 0xb25b, + 'blake2s-224': 0xb25c, + 'blake2s-232': 0xb25d, + 'blake2s-240': 0xb25e, + 'blake2s-248': 0xb25f, + 'blake2s-256': 0xb260, + 'skein256-8': 0xb301, + 'skein256-16': 0xb302, + 'skein256-24': 0xb303, + 'skein256-32': 0xb304, + 'skein256-40': 0xb305, + 'skein256-48': 0xb306, + 'skein256-56': 0xb307, + 'skein256-64': 0xb308, + 'skein256-72': 0xb309, + 'skein256-80': 0xb30a, + 'skein256-88': 0xb30b, + 'skein256-96': 0xb30c, + 'skein256-104': 0xb30d, + 'skein256-112': 0xb30e, + 'skein256-120': 0xb30f, + 'skein256-128': 0xb310, + 'skein256-136': 0xb311, + 'skein256-144': 0xb312, + 'skein256-152': 0xb313, + 'skein256-160': 0xb314, + 'skein256-168': 0xb315, + 'skein256-176': 0xb316, + 'skein256-184': 0xb317, + 'skein256-192': 0xb318, + 'skein256-200': 0xb319, + 'skein256-208': 0xb31a, + 'skein256-216': 0xb31b, + 'skein256-224': 0xb31c, + 'skein256-232': 0xb31d, + 'skein256-240': 0xb31e, + 'skein256-248': 0xb31f, + 'skein256-256': 0xb320, + 'skein512-8': 0xb321, + 'skein512-16': 0xb322, + 'skein512-24': 0xb323, + 'skein512-32': 0xb324, + 'skein512-40': 0xb325, + 'skein512-48': 0xb326, + 'skein512-56': 0xb327, + 'skein512-64': 0xb328, + 'skein512-72': 0xb329, + 'skein512-80': 0xb32a, + 'skein512-88': 0xb32b, + 'skein512-96': 0xb32c, + 'skein512-104': 0xb32d, + 'skein512-112': 0xb32e, + 'skein512-120': 0xb32f, + 'skein512-128': 0xb330, + 'skein512-136': 0xb331, + 'skein512-144': 0xb332, + 'skein512-152': 0xb333, + 'skein512-160': 0xb334, + 'skein512-168': 0xb335, + 'skein512-176': 0xb336, + 'skein512-184': 0xb337, + 'skein512-192': 0xb338, + 'skein512-200': 0xb339, + 'skein512-208': 0xb33a, + 'skein512-216': 0xb33b, + 'skein512-224': 0xb33c, + 'skein512-232': 0xb33d, + 'skein512-240': 0xb33e, + 'skein512-248': 0xb33f, + 'skein512-256': 0xb340, + 'skein512-264': 0xb341, + 'skein512-272': 0xb342, + 'skein512-280': 0xb343, + 'skein512-288': 0xb344, + 'skein512-296': 0xb345, + 'skein512-304': 0xb346, + 'skein512-312': 0xb347, + 'skein512-320': 0xb348, + 'skein512-328': 0xb349, + 'skein512-336': 0xb34a, + 'skein512-344': 0xb34b, + 'skein512-352': 0xb34c, + 'skein512-360': 0xb34d, + 'skein512-368': 0xb34e, + 'skein512-376': 0xb34f, + 'skein512-384': 0xb350, + 'skein512-392': 0xb351, + 'skein512-400': 0xb352, + 'skein512-408': 0xb353, + 'skein512-416': 0xb354, + 'skein512-424': 0xb355, + 'skein512-432': 0xb356, + 'skein512-440': 0xb357, + 'skein512-448': 0xb358, + 'skein512-456': 0xb359, + 'skein512-464': 0xb35a, + 'skein512-472': 0xb35b, + 'skein512-480': 0xb35c, + 'skein512-488': 0xb35d, + 'skein512-496': 0xb35e, + 'skein512-504': 0xb35f, + 'skein512-512': 0xb360, + 'skein1024-8': 0xb361, + 'skein1024-16': 0xb362, + 'skein1024-24': 0xb363, + 'skein1024-32': 0xb364, + 'skein1024-40': 0xb365, + 'skein1024-48': 0xb366, + 'skein1024-56': 0xb367, + 'skein1024-64': 0xb368, + 'skein1024-72': 0xb369, + 'skein1024-80': 0xb36a, + 'skein1024-88': 0xb36b, + 'skein1024-96': 0xb36c, + 'skein1024-104': 0xb36d, + 'skein1024-112': 0xb36e, + 'skein1024-120': 0xb36f, + 'skein1024-128': 0xb370, + 'skein1024-136': 0xb371, + 'skein1024-144': 0xb372, + 'skein1024-152': 0xb373, + 'skein1024-160': 0xb374, + 'skein1024-168': 0xb375, + 'skein1024-176': 0xb376, + 'skein1024-184': 0xb377, + 'skein1024-192': 0xb378, + 'skein1024-200': 0xb379, + 'skein1024-208': 0xb37a, + 'skein1024-216': 0xb37b, + 'skein1024-224': 0xb37c, + 'skein1024-232': 0xb37d, + 'skein1024-240': 0xb37e, + 'skein1024-248': 0xb37f, + 'skein1024-256': 0xb380, + 'skein1024-264': 0xb381, + 'skein1024-272': 0xb382, + 'skein1024-280': 0xb383, + 'skein1024-288': 0xb384, + 'skein1024-296': 0xb385, + 'skein1024-304': 0xb386, + 'skein1024-312': 0xb387, + 'skein1024-320': 0xb388, + 'skein1024-328': 0xb389, + 'skein1024-336': 0xb38a, + 'skein1024-344': 0xb38b, + 'skein1024-352': 0xb38c, + 'skein1024-360': 0xb38d, + 'skein1024-368': 0xb38e, + 'skein1024-376': 0xb38f, + 'skein1024-384': 0xb390, + 'skein1024-392': 0xb391, + 'skein1024-400': 0xb392, + 'skein1024-408': 0xb393, + 'skein1024-416': 0xb394, + 'skein1024-424': 0xb395, + 'skein1024-432': 0xb396, + 'skein1024-440': 0xb397, + 'skein1024-448': 0xb398, + 'skein1024-456': 0xb399, + 'skein1024-464': 0xb39a, + 'skein1024-472': 0xb39b, + 'skein1024-480': 0xb39c, + 'skein1024-488': 0xb39d, + 'skein1024-496': 0xb39e, + 'skein1024-504': 0xb39f, + 'skein1024-512': 0xb3a0, + 'skein1024-520': 0xb3a1, + 'skein1024-528': 0xb3a2, + 'skein1024-536': 0xb3a3, + 'skein1024-544': 0xb3a4, + 'skein1024-552': 0xb3a5, + 'skein1024-560': 0xb3a6, + 'skein1024-568': 0xb3a7, + 'skein1024-576': 0xb3a8, + 'skein1024-584': 0xb3a9, + 'skein1024-592': 0xb3aa, + 'skein1024-600': 0xb3ab, + 'skein1024-608': 0xb3ac, + 'skein1024-616': 0xb3ad, + 'skein1024-624': 0xb3ae, + 'skein1024-632': 0xb3af, + 'skein1024-640': 0xb3b0, + 'skein1024-648': 0xb3b1, + 'skein1024-656': 0xb3b2, + 'skein1024-664': 0xb3b3, + 'skein1024-672': 0xb3b4, + 'skein1024-680': 0xb3b5, + 'skein1024-688': 0xb3b6, + 'skein1024-696': 0xb3b7, + 'skein1024-704': 0xb3b8, + 'skein1024-712': 0xb3b9, + 'skein1024-720': 0xb3ba, + 'skein1024-728': 0xb3bb, + 'skein1024-736': 0xb3bc, + 'skein1024-744': 0xb3bd, + 'skein1024-752': 0xb3be, + 'skein1024-760': 0xb3bf, + 'skein1024-768': 0xb3c0, + 'skein1024-776': 0xb3c1, + 'skein1024-784': 0xb3c2, + 'skein1024-792': 0xb3c3, + 'skein1024-800': 0xb3c4, + 'skein1024-808': 0xb3c5, + 'skein1024-816': 0xb3c6, + 'skein1024-824': 0xb3c7, + 'skein1024-832': 0xb3c8, + 'skein1024-840': 0xb3c9, + 'skein1024-848': 0xb3ca, + 'skein1024-856': 0xb3cb, + 'skein1024-864': 0xb3cc, + 'skein1024-872': 0xb3cd, + 'skein1024-880': 0xb3ce, + 'skein1024-888': 0xb3cf, + 'skein1024-896': 0xb3d0, + 'skein1024-904': 0xb3d1, + 'skein1024-912': 0xb3d2, + 'skein1024-920': 0xb3d3, + 'skein1024-928': 0xb3d4, + 'skein1024-936': 0xb3d5, + 'skein1024-944': 0xb3d6, + 'skein1024-952': 0xb3d7, + 'skein1024-960': 0xb3d8, + 'skein1024-968': 0xb3d9, + 'skein1024-976': 0xb3da, + 'skein1024-984': 0xb3db, + 'skein1024-992': 0xb3dc, + 'skein1024-1000': 0xb3dd, + 'skein1024-1008': 0xb3de, + 'skein1024-1016': 0xb3df, + 'skein1024-1024': 0xb3e0, + 'poseidon-bls12_381-a2-fc1': 0xb401, + 'poseidon-bls12_381-a2-fc1-sc': 0xb402, + 'zeroxcert-imprint-256': 0xce11, + 'fil-commitment-unsealed': 0xf101, + 'fil-commitment-sealed': 0xf102, + 'holochain-adr-v0': 0x807124, + 'holochain-adr-v1': 0x817124, + 'holochain-key-v0': 0x947124, + 'holochain-key-v1': 0x957124, + 'holochain-sig-v0': 0xa27124, + 'holochain-sig-v1': 0xa37124, + 'skynet-ns': 0xb19910, + 'arweave-ns': 0xb29910 +}) + +module.exports = { baseTable } + + +/***/ }), + +/***/ 2021: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/** + * Implementation of the multicodec specification. + * + * @module multicodec + * @example + * const multicodec = require('multicodec') + * + * const prefixedProtobuf = multicodec.addPrefix('protobuf', protobufBuffer) + * // prefixedProtobuf 0x50... + * + */ + + +/** @typedef {import('./generated-types').CodecName} CodecName */ +/** @typedef {import('./generated-types').CodecCode} CodecCode */ + +const varint = __webpack_require__(38) +const { concat: uint8ArrayConcat } = __webpack_require__(5007) +const util = __webpack_require__(2693) +const { nameToVarint, constantToCode, nameToCode, codeToName } = __webpack_require__(482) + +/** + * Prefix a buffer with a multicodec-packed. + * + * @param {CodecName|Uint8Array} multicodecStrOrCode + * @param {Uint8Array} data + * @returns {Uint8Array} + */ +function addPrefix (multicodecStrOrCode, data) { + let prefix + + if (multicodecStrOrCode instanceof Uint8Array) { + prefix = util.varintUint8ArrayEncode(multicodecStrOrCode) + } else { + if (nameToVarint[multicodecStrOrCode]) { + prefix = nameToVarint[multicodecStrOrCode] + } else { + throw new Error('multicodec not recognized') + } + } + + return uint8ArrayConcat([prefix, data], prefix.length + data.length) +} + +/** + * Decapsulate the multicodec-packed prefix from the data. + * + * @param {Uint8Array} data + * @returns {Uint8Array} + */ +function rmPrefix (data) { + varint.decode(/** @type {Buffer} */(data)) + return data.slice(varint.decode.bytes) +} + +/** + * Get the codec name of the prefixed data. + * + * @param {Uint8Array} prefixedData + * @returns {CodecName} + */ +function getNameFromData (prefixedData) { + const code = /** @type {CodecCode} */(varint.decode(/** @type {Buffer} */(prefixedData))) + const name = codeToName[code] + if (name === undefined) { + throw new Error(`Code "${code}" not found`) + } + return name +} + +/** + * Get the codec name from a code. + * + * @param {CodecCode} codec + * @returns {CodecName} + */ +function getNameFromCode (codec) { + return codeToName[codec] +} + +/** + * Get the code of the codec + * + * @param {CodecName} name + * @returns {CodecCode} + */ +function getCodeFromName (name) { + const code = nameToCode[name] + if (code === undefined) { + throw new Error(`Codec "${name}" not found`) + } + return code +} + +/** + * Get the code of the prefixed data. + * + * @param {Uint8Array} prefixedData + * @returns {CodecCode} + */ +function getCodeFromData (prefixedData) { + return /** @type {CodecCode} */(varint.decode(/** @type {Buffer} */(prefixedData))) +} + +/** + * Get the code as varint of a codec name. + * + * @param {CodecName} name + * @returns {Uint8Array} + */ +function getVarintFromName (name) { + const code = nameToVarint[name] + if (code === undefined) { + throw new Error(`Codec "${name}" not found`) + } + return code +} + +/** + * Get the varint of a code. + * + * @param {CodecCode} code + * @returns {Uint8Array} + */ +function getVarintFromCode (code) { + return util.varintEncode(code) +} + +/** + * Get the codec name of the prefixed data. + * + * @deprecated use getNameFromData instead. + * @param {Uint8Array} prefixedData + * @returns {CodecName} + */ +function getCodec (prefixedData) { + return getNameFromData(prefixedData) +} + +/** + * Get the codec name from a code. + * + * @deprecated use getNameFromCode instead. + * @param {CodecCode} codec + * @returns {CodecName} + */ +function getName (codec) { + return getNameFromCode(codec) +} + +/** + * Get the code of the codec + * + * @deprecated use getCodeFromName instead. + * @param {CodecName} name + * @returns {CodecCode} + */ +function getNumber (name) { + return getCodeFromName(name) +} + +/** + * Get the code of the prefixed data. + * + * @deprecated use getCodeFromData instead. + * @param {Uint8Array} prefixedData + * @returns {CodecCode} + */ +function getCode (prefixedData) { + return getCodeFromData(prefixedData) +} + +/** + * Get the code as varint of a codec name. + * + * @deprecated use getVarintFromName instead. + * @param {CodecName} name + * @returns {Uint8Array} + */ +function getCodeVarint (name) { + return getVarintFromName(name) +} + +/** + * Get the varint of a code. + * + * @deprecated use getVarintFromCode instead. + * @param {CodecCode} code + * @returns {Array.} + */ +function getVarint (code) { + return Array.from(getVarintFromCode(code)) +} + +module.exports = { + addPrefix, + rmPrefix, + getNameFromData, + getNameFromCode, + getCodeFromName, + getCodeFromData, + getVarintFromName, + getVarintFromCode, + // Deprecated + getCodec, + getName, + getNumber, + getCode, + getCodeVarint, + getVarint, + // Make the constants top-level constants + ...constantToCode, + // Export the maps + nameToVarint, + nameToCode, + codeToName +} + + +/***/ }), + +/***/ 482: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +/** @typedef {import('./generated-types').ConstantCodeMap} ConstantCodeMap */ +/** @typedef {import('./generated-types').NameUint8ArrayMap} NameUint8ArrayMap */ +/** @typedef {import('./generated-types').CodeNameMap} CodeNameMap */ +/** @typedef {import('./generated-types').CodecName} CodecName */ +/** @typedef {import('./generated-types').CodecConstant} CodecConstant */ + +const { baseTable } = __webpack_require__(5661) +const varintEncode = (__webpack_require__(2693).varintEncode) + +const nameToVarint = /** @type {NameUint8ArrayMap} */ ({}) +const constantToCode = /** @type {ConstantCodeMap} */({}) +const codeToName = /** @type {CodeNameMap} */({}) + +// eslint-disable-next-line guard-for-in +for (const name in baseTable) { + const codecName = /** @type {CodecName} */(name) + const code = baseTable[codecName] + nameToVarint[codecName] = varintEncode(code) + + const constant = /** @type {CodecConstant} */(codecName.toUpperCase().replace(/-/g, '_')) + constantToCode[constant] = code + + if (!codeToName[code]) { + codeToName[code] = codecName + } +} + +Object.freeze(nameToVarint) +Object.freeze(constantToCode) +Object.freeze(codeToName) +const nameToCode = Object.freeze(baseTable) +module.exports = { + nameToVarint, + constantToCode, + nameToCode, + codeToName +} + + +/***/ }), + +/***/ 2693: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const varint = __webpack_require__(38) +const { toString: uint8ArrayToString } = __webpack_require__(7302) +const { fromString: uint8ArrayFromString } = __webpack_require__(4117) + +module.exports = { + numberToUint8Array, + uint8ArrayToNumber, + varintUint8ArrayEncode, + varintEncode +} + +/** + * @param {Uint8Array} buf + */ +function uint8ArrayToNumber (buf) { + return parseInt(uint8ArrayToString(buf, 'base16'), 16) +} + +/** + * @param {number} num + */ +function numberToUint8Array (num) { + let hexString = num.toString(16) + if (hexString.length % 2 === 1) { + hexString = '0' + hexString + } + return uint8ArrayFromString(hexString, 'base16') +} + +/** + * @param {Uint8Array} input + */ +function varintUint8ArrayEncode (input) { + return Uint8Array.from(varint.encode(uint8ArrayToNumber(input))) +} + +/** + * @param {number} num + */ +function varintEncode (num) { + return Uint8Array.from(varint.encode(num)) +} + + +/***/ }), + +/***/ 6994: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// @ts-check + +const { Buffer } = __webpack_require__(8287) + +/** + * @typedef {Object} Codec + * @property {function(Uint8Array):string} encode + * @property {function(string):Uint8Array} decode + * + * @typedef {function(string):Codec} CodecFactory + */ + +class Base { + /** + * @param {string} name + * @param {string} code + * @param {CodecFactory} implementation + * @param {string} alphabet + */ + constructor (name, code, implementation, alphabet) { + this.name = name + this.code = code + this.codeBuf = Buffer.from(this.code) + this.alphabet = alphabet + this.engine = implementation(alphabet) + } + + /** + * @param {Uint8Array} buf + * @returns {string} + */ + encode (buf) { + return this.engine.encode(buf) + } + + /** + * @param {string} string + * @returns {Uint8Array} + */ + decode (string) { + for (const char of string) { + if (this.alphabet && this.alphabet.indexOf(char) < 0) { + throw new Error(`invalid character '${char}' in '${string}'`) + } + } + return this.engine.decode(string) + } +} + +module.exports = Base + + +/***/ }), + +/***/ 6082: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// @ts-check + + +const baseX = __webpack_require__(5364) +const Base = __webpack_require__(6994) +const rfc4648 = __webpack_require__(5920) +const { decodeText, encodeText } = __webpack_require__(639) + +const identity = () => { + return { + encode: decodeText, + decode: encodeText + } +} + +/** + * @typedef {import('./base').CodecFactory} CodecFactory + * + * name, code, implementation, alphabet + * @type {Array<[string, string, CodecFactory, string]>} + */ +const constants = [ + ['identity', '\x00', identity, ''], + ['base2', '0', rfc4648(1), '01'], + ['base8', '7', rfc4648(3), '01234567'], + ['base10', '9', baseX, '0123456789'], + ['base16', 'f', rfc4648(4), '0123456789abcdef'], + ['base16upper', 'F', rfc4648(4), '0123456789ABCDEF'], + ['base32hex', 'v', rfc4648(5), '0123456789abcdefghijklmnopqrstuv'], + ['base32hexupper', 'V', rfc4648(5), '0123456789ABCDEFGHIJKLMNOPQRSTUV'], + ['base32hexpad', 't', rfc4648(5), '0123456789abcdefghijklmnopqrstuv='], + ['base32hexpadupper', 'T', rfc4648(5), '0123456789ABCDEFGHIJKLMNOPQRSTUV='], + ['base32', 'b', rfc4648(5), 'abcdefghijklmnopqrstuvwxyz234567'], + ['base32upper', 'B', rfc4648(5), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'], + ['base32pad', 'c', rfc4648(5), 'abcdefghijklmnopqrstuvwxyz234567='], + ['base32padupper', 'C', rfc4648(5), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567='], + ['base32z', 'h', rfc4648(5), 'ybndrfg8ejkmcpqxot1uwisza345h769'], + ['base36', 'k', baseX, '0123456789abcdefghijklmnopqrstuvwxyz'], + ['base36upper', 'K', baseX, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'], + ['base58btc', 'z', baseX, '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'], + ['base58flickr', 'Z', baseX, '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'], + ['base64', 'm', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'], + ['base64pad', 'M', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='], + ['base64url', 'u', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'], + ['base64urlpad', 'U', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_='] +] + +const names = constants.reduce((prev, tupple) => { + prev[tupple[0]] = new Base(tupple[0], tupple[1], tupple[2], tupple[3]) + return prev +}, {}) + +const codes = constants.reduce((prev, tupple) => { + prev[tupple[1]] = names[tupple[0]] + return prev +}, {}) + +module.exports = { + names, + codes +} + + +/***/ }), + +/***/ 2879: +/***/ ((module, exports, __webpack_require__) => { + +"use strict"; +// @ts-check +/** + * Implementation of the [multibase](https://github.com/multiformats/multibase) specification. + * + * @module Multibase + */ + + +const { Buffer } = __webpack_require__(8287) +const constants = __webpack_require__(6082) +const { decodeText, asBuffer } = __webpack_require__(639) + +/** @typedef {import("./base")} Base */ + +/** + * Create a new buffer with the multibase varint+code. + * + * @param {string|number} nameOrCode - The multibase name or code number. + * @param {Uint8Array} buf - The data to be prefixed with multibase. + * @returns {Buffer} + * @throws {Error} Will throw if the encoding is not supported + */ +function multibase (nameOrCode, buf) { + if (!buf) { + throw new Error('requires an encoded buffer') + } + const { name, codeBuf } = encoding(nameOrCode) + validEncode(name, buf) + + const buffer = Buffer.alloc(codeBuf.length + buf.length) + buffer.set(codeBuf, 0) + buffer.set(buf, codeBuf.length) + + return buffer +} + +/** + * Encode data with the specified base and add the multibase prefix. + * + * @param {string|number} nameOrCode - The multibase name or code number. + * @param {Uint8Array} buf - The data to be encoded. + * @returns {Buffer} + * @throws {Error} Will throw if the encoding is not supported + * + */ +function encode (nameOrCode, buf) { + const enc = encoding(nameOrCode) + + return Buffer.concat([enc.codeBuf, Buffer.from(enc.encode(buf))]) +} + +/** + * Takes a Uint8Array or string encoded with multibase header, decodes it and + * returns the decoded buffer + * + * @param {Uint8Array|string} data + * @returns {Buffer} + * @throws {Error} Will throw if the encoding is not supported + * + */ +function decode (data) { + if (ArrayBuffer.isView(data)) { + data = decodeText(data) + } + const prefix = data[0] + + // Make all encodings case-insensitive except the ones that include upper and lower chars in the alphabet + if (['f', 'F', 'v', 'V', 't', 'T', 'b', 'B', 'c', 'C', 'h', 'k', 'K'].includes(prefix)) { + data = data.toLowerCase() + } + const enc = encoding(data[0]) + return asBuffer(enc.decode(data.substring(1))) +} + +/** + * Is the given data multibase encoded? + * + * @param {Uint8Array|string} data + * @returns {false|string} + */ +function isEncoded (data) { + if (data instanceof Uint8Array) { + data = decodeText(data) + } + + // Ensure bufOrString is a string + if (Object.prototype.toString.call(data) !== '[object String]') { + return false + } + + try { + const enc = encoding(data[0]) + return enc.name + } catch (err) { + return false + } +} + +/** + * Validate encoded data + * + * @param {string} name + * @param {Uint8Array} buf + * @returns {void} + * @throws {Error} Will throw if the encoding is not supported + */ +function validEncode (name, buf) { + const enc = encoding(name) + enc.decode(decodeText(buf)) +} + +/** + * Get the encoding by name or code + * + * @param {string|number} nameOrCode + * @returns {Base} + * @throws {Error} Will throw if the encoding is not supported + */ +function encoding (nameOrCode) { + if (constants.names[nameOrCode]) { + return constants.names[nameOrCode] + } else if (constants.codes[nameOrCode]) { + return constants.codes[nameOrCode] + } else { + throw new Error(`Unsupported encoding: ${nameOrCode}`) + } +} + +/** + * Get encoding from data + * + * @param {string|Uint8Array} data + * @returns {Base} + * @throws {Error} Will throw if the encoding is not supported + */ +function encodingFromData (data) { + if (data instanceof Uint8Array) { + data = decodeText(data) + } + + return encoding(data[0]) +} + +exports = module.exports = multibase +exports.encode = encode +exports.decode = decode +exports.isEncoded = isEncoded +exports.encoding = encoding +exports.encodingFromData = encodingFromData +exports.names = Object.freeze(constants.names) +exports.codes = Object.freeze(constants.codes) + + +/***/ }), + +/***/ 5920: +/***/ ((module) => { + +"use strict"; +// @ts-check + + +/** @typedef {import('./base').CodecFactory} CodecFactory */ + +/** + * @param {string} string + * @param {string} alphabet + * @param {number} bitsPerChar + * @returns {Uint8Array} + */ +const decode = (string, alphabet, bitsPerChar) => { + // Build the character lookup table: + const codes = {} + for (let i = 0; i < alphabet.length; ++i) { + codes[alphabet[i]] = i + } + + // Count the padding bytes: + let end = string.length + while (string[end - 1] === '=') { + --end + } + + // Allocate the output: + const out = new Uint8Array((end * bitsPerChar / 8) | 0) + + // Parse the data: + let bits = 0 // Number of bits currently in the buffer + let buffer = 0 // Bits waiting to be written out, MSB first + let written = 0 // Next byte to write + for (let i = 0; i < end; ++i) { + // Read one character from the string: + const value = codes[string[i]] + if (value === undefined) { + throw new SyntaxError('Invalid character ' + string[i]) + } + + // Append the bits to the buffer: + buffer = (buffer << bitsPerChar) | value + bits += bitsPerChar + + // Write out some bits if the buffer has a byte's worth: + if (bits >= 8) { + bits -= 8 + out[written++] = 0xff & (buffer >> bits) + } + } + + // Verify that we have received just enough bits: + if (bits >= bitsPerChar || 0xff & (buffer << (8 - bits))) { + throw new SyntaxError('Unexpected end of data') + } + + return out +} + +/** + * @param {Uint8Array} data + * @param {string} alphabet + * @param {number} bitsPerChar + * @returns {string} + */ +const encode = (data, alphabet, bitsPerChar) => { + const pad = alphabet[alphabet.length - 1] === '=' + const mask = (1 << bitsPerChar) - 1 + let out = '' + + let bits = 0 // Number of bits currently in the buffer + let buffer = 0 // Bits waiting to be written out, MSB first + for (let i = 0; i < data.length; ++i) { + // Slurp data into the buffer: + buffer = (buffer << 8) | data[i] + bits += 8 + + // Write out as much as we can: + while (bits > bitsPerChar) { + bits -= bitsPerChar + out += alphabet[mask & (buffer >> bits)] + } + } + + // Partial character: + if (bits) { + out += alphabet[mask & (buffer << (bitsPerChar - bits))] + } + + // Add padding characters until we hit a byte boundary: + if (pad) { + while ((out.length * bitsPerChar) & 7) { + out += '=' + } + } + + return out +} + +/** + * @param {number} bitsPerChar + * @returns {CodecFactory} + */ +module.exports = (bitsPerChar) => (alphabet) => { + return { + /** + * @param {Uint8Array} input + * @returns {string} + */ + encode (input) { + return encode(input, alphabet, bitsPerChar) + }, + /** + * @param {string} input + * @returns {Uint8Array} + */ + decode (input) { + return decode(input, alphabet, bitsPerChar) + } + } +} + + +/***/ }), + +/***/ 639: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// @ts-check + + +const { Buffer } = __webpack_require__(8287) +const { TextEncoder, TextDecoder } = __webpack_require__(7019) + +const textDecoder = new TextDecoder() +/** + * @param {ArrayBufferView|ArrayBuffer} bytes + * @returns {string} + */ +const decodeText = (bytes) => textDecoder.decode(bytes) + +const textEncoder = new TextEncoder() +/** + * @param {string} text + * @returns {Uint8Array} + */ +const encodeText = (text) => textEncoder.encode(text) + +/** + * @param {ArrayBufferView} bytes + * @returns {Buffer} + */ +const asBuffer = ({ buffer, byteLength, byteOffset }) => + Buffer.from(buffer, byteOffset, byteLength) + +module.exports = { decodeText, encodeText, asBuffer } + + +/***/ }), + +/***/ 3702: +/***/ ((module) => { + +"use strict"; +/* eslint quote-props: off */ + + +const names = Object.freeze({ + 'identity': 0x00, + 'sha1': 0x11, + 'sha2-256': 0x12, + 'sha2-512': 0x13, + 'sha3-512': 0x14, + 'sha3-384': 0x15, + 'sha3-256': 0x16, + 'sha3-224': 0x17, + 'shake-128': 0x18, + 'shake-256': 0x19, + 'keccak-224': 0x1a, + 'keccak-256': 0x1b, + 'keccak-384': 0x1c, + 'keccak-512': 0x1d, + 'blake3': 0x1e, + 'murmur3-128': 0x22, + 'murmur3-32': 0x23, + 'dbl-sha2-256': 0x56, + 'md4': 0xd4, + 'md5': 0xd5, + 'bmt': 0xd6, + 'sha2-256-trunc254-padded': 0x1012, + 'ripemd-128': 0x1052, + 'ripemd-160': 0x1053, + 'ripemd-256': 0x1054, + 'ripemd-320': 0x1055, + 'x11': 0x1100, + 'sm3-256': 0x534d, + 'blake2b-8': 0xb201, + 'blake2b-16': 0xb202, + 'blake2b-24': 0xb203, + 'blake2b-32': 0xb204, + 'blake2b-40': 0xb205, + 'blake2b-48': 0xb206, + 'blake2b-56': 0xb207, + 'blake2b-64': 0xb208, + 'blake2b-72': 0xb209, + 'blake2b-80': 0xb20a, + 'blake2b-88': 0xb20b, + 'blake2b-96': 0xb20c, + 'blake2b-104': 0xb20d, + 'blake2b-112': 0xb20e, + 'blake2b-120': 0xb20f, + 'blake2b-128': 0xb210, + 'blake2b-136': 0xb211, + 'blake2b-144': 0xb212, + 'blake2b-152': 0xb213, + 'blake2b-160': 0xb214, + 'blake2b-168': 0xb215, + 'blake2b-176': 0xb216, + 'blake2b-184': 0xb217, + 'blake2b-192': 0xb218, + 'blake2b-200': 0xb219, + 'blake2b-208': 0xb21a, + 'blake2b-216': 0xb21b, + 'blake2b-224': 0xb21c, + 'blake2b-232': 0xb21d, + 'blake2b-240': 0xb21e, + 'blake2b-248': 0xb21f, + 'blake2b-256': 0xb220, + 'blake2b-264': 0xb221, + 'blake2b-272': 0xb222, + 'blake2b-280': 0xb223, + 'blake2b-288': 0xb224, + 'blake2b-296': 0xb225, + 'blake2b-304': 0xb226, + 'blake2b-312': 0xb227, + 'blake2b-320': 0xb228, + 'blake2b-328': 0xb229, + 'blake2b-336': 0xb22a, + 'blake2b-344': 0xb22b, + 'blake2b-352': 0xb22c, + 'blake2b-360': 0xb22d, + 'blake2b-368': 0xb22e, + 'blake2b-376': 0xb22f, + 'blake2b-384': 0xb230, + 'blake2b-392': 0xb231, + 'blake2b-400': 0xb232, + 'blake2b-408': 0xb233, + 'blake2b-416': 0xb234, + 'blake2b-424': 0xb235, + 'blake2b-432': 0xb236, + 'blake2b-440': 0xb237, + 'blake2b-448': 0xb238, + 'blake2b-456': 0xb239, + 'blake2b-464': 0xb23a, + 'blake2b-472': 0xb23b, + 'blake2b-480': 0xb23c, + 'blake2b-488': 0xb23d, + 'blake2b-496': 0xb23e, + 'blake2b-504': 0xb23f, + 'blake2b-512': 0xb240, + 'blake2s-8': 0xb241, + 'blake2s-16': 0xb242, + 'blake2s-24': 0xb243, + 'blake2s-32': 0xb244, + 'blake2s-40': 0xb245, + 'blake2s-48': 0xb246, + 'blake2s-56': 0xb247, + 'blake2s-64': 0xb248, + 'blake2s-72': 0xb249, + 'blake2s-80': 0xb24a, + 'blake2s-88': 0xb24b, + 'blake2s-96': 0xb24c, + 'blake2s-104': 0xb24d, + 'blake2s-112': 0xb24e, + 'blake2s-120': 0xb24f, + 'blake2s-128': 0xb250, + 'blake2s-136': 0xb251, + 'blake2s-144': 0xb252, + 'blake2s-152': 0xb253, + 'blake2s-160': 0xb254, + 'blake2s-168': 0xb255, + 'blake2s-176': 0xb256, + 'blake2s-184': 0xb257, + 'blake2s-192': 0xb258, + 'blake2s-200': 0xb259, + 'blake2s-208': 0xb25a, + 'blake2s-216': 0xb25b, + 'blake2s-224': 0xb25c, + 'blake2s-232': 0xb25d, + 'blake2s-240': 0xb25e, + 'blake2s-248': 0xb25f, + 'blake2s-256': 0xb260, + 'skein256-8': 0xb301, + 'skein256-16': 0xb302, + 'skein256-24': 0xb303, + 'skein256-32': 0xb304, + 'skein256-40': 0xb305, + 'skein256-48': 0xb306, + 'skein256-56': 0xb307, + 'skein256-64': 0xb308, + 'skein256-72': 0xb309, + 'skein256-80': 0xb30a, + 'skein256-88': 0xb30b, + 'skein256-96': 0xb30c, + 'skein256-104': 0xb30d, + 'skein256-112': 0xb30e, + 'skein256-120': 0xb30f, + 'skein256-128': 0xb310, + 'skein256-136': 0xb311, + 'skein256-144': 0xb312, + 'skein256-152': 0xb313, + 'skein256-160': 0xb314, + 'skein256-168': 0xb315, + 'skein256-176': 0xb316, + 'skein256-184': 0xb317, + 'skein256-192': 0xb318, + 'skein256-200': 0xb319, + 'skein256-208': 0xb31a, + 'skein256-216': 0xb31b, + 'skein256-224': 0xb31c, + 'skein256-232': 0xb31d, + 'skein256-240': 0xb31e, + 'skein256-248': 0xb31f, + 'skein256-256': 0xb320, + 'skein512-8': 0xb321, + 'skein512-16': 0xb322, + 'skein512-24': 0xb323, + 'skein512-32': 0xb324, + 'skein512-40': 0xb325, + 'skein512-48': 0xb326, + 'skein512-56': 0xb327, + 'skein512-64': 0xb328, + 'skein512-72': 0xb329, + 'skein512-80': 0xb32a, + 'skein512-88': 0xb32b, + 'skein512-96': 0xb32c, + 'skein512-104': 0xb32d, + 'skein512-112': 0xb32e, + 'skein512-120': 0xb32f, + 'skein512-128': 0xb330, + 'skein512-136': 0xb331, + 'skein512-144': 0xb332, + 'skein512-152': 0xb333, + 'skein512-160': 0xb334, + 'skein512-168': 0xb335, + 'skein512-176': 0xb336, + 'skein512-184': 0xb337, + 'skein512-192': 0xb338, + 'skein512-200': 0xb339, + 'skein512-208': 0xb33a, + 'skein512-216': 0xb33b, + 'skein512-224': 0xb33c, + 'skein512-232': 0xb33d, + 'skein512-240': 0xb33e, + 'skein512-248': 0xb33f, + 'skein512-256': 0xb340, + 'skein512-264': 0xb341, + 'skein512-272': 0xb342, + 'skein512-280': 0xb343, + 'skein512-288': 0xb344, + 'skein512-296': 0xb345, + 'skein512-304': 0xb346, + 'skein512-312': 0xb347, + 'skein512-320': 0xb348, + 'skein512-328': 0xb349, + 'skein512-336': 0xb34a, + 'skein512-344': 0xb34b, + 'skein512-352': 0xb34c, + 'skein512-360': 0xb34d, + 'skein512-368': 0xb34e, + 'skein512-376': 0xb34f, + 'skein512-384': 0xb350, + 'skein512-392': 0xb351, + 'skein512-400': 0xb352, + 'skein512-408': 0xb353, + 'skein512-416': 0xb354, + 'skein512-424': 0xb355, + 'skein512-432': 0xb356, + 'skein512-440': 0xb357, + 'skein512-448': 0xb358, + 'skein512-456': 0xb359, + 'skein512-464': 0xb35a, + 'skein512-472': 0xb35b, + 'skein512-480': 0xb35c, + 'skein512-488': 0xb35d, + 'skein512-496': 0xb35e, + 'skein512-504': 0xb35f, + 'skein512-512': 0xb360, + 'skein1024-8': 0xb361, + 'skein1024-16': 0xb362, + 'skein1024-24': 0xb363, + 'skein1024-32': 0xb364, + 'skein1024-40': 0xb365, + 'skein1024-48': 0xb366, + 'skein1024-56': 0xb367, + 'skein1024-64': 0xb368, + 'skein1024-72': 0xb369, + 'skein1024-80': 0xb36a, + 'skein1024-88': 0xb36b, + 'skein1024-96': 0xb36c, + 'skein1024-104': 0xb36d, + 'skein1024-112': 0xb36e, + 'skein1024-120': 0xb36f, + 'skein1024-128': 0xb370, + 'skein1024-136': 0xb371, + 'skein1024-144': 0xb372, + 'skein1024-152': 0xb373, + 'skein1024-160': 0xb374, + 'skein1024-168': 0xb375, + 'skein1024-176': 0xb376, + 'skein1024-184': 0xb377, + 'skein1024-192': 0xb378, + 'skein1024-200': 0xb379, + 'skein1024-208': 0xb37a, + 'skein1024-216': 0xb37b, + 'skein1024-224': 0xb37c, + 'skein1024-232': 0xb37d, + 'skein1024-240': 0xb37e, + 'skein1024-248': 0xb37f, + 'skein1024-256': 0xb380, + 'skein1024-264': 0xb381, + 'skein1024-272': 0xb382, + 'skein1024-280': 0xb383, + 'skein1024-288': 0xb384, + 'skein1024-296': 0xb385, + 'skein1024-304': 0xb386, + 'skein1024-312': 0xb387, + 'skein1024-320': 0xb388, + 'skein1024-328': 0xb389, + 'skein1024-336': 0xb38a, + 'skein1024-344': 0xb38b, + 'skein1024-352': 0xb38c, + 'skein1024-360': 0xb38d, + 'skein1024-368': 0xb38e, + 'skein1024-376': 0xb38f, + 'skein1024-384': 0xb390, + 'skein1024-392': 0xb391, + 'skein1024-400': 0xb392, + 'skein1024-408': 0xb393, + 'skein1024-416': 0xb394, + 'skein1024-424': 0xb395, + 'skein1024-432': 0xb396, + 'skein1024-440': 0xb397, + 'skein1024-448': 0xb398, + 'skein1024-456': 0xb399, + 'skein1024-464': 0xb39a, + 'skein1024-472': 0xb39b, + 'skein1024-480': 0xb39c, + 'skein1024-488': 0xb39d, + 'skein1024-496': 0xb39e, + 'skein1024-504': 0xb39f, + 'skein1024-512': 0xb3a0, + 'skein1024-520': 0xb3a1, + 'skein1024-528': 0xb3a2, + 'skein1024-536': 0xb3a3, + 'skein1024-544': 0xb3a4, + 'skein1024-552': 0xb3a5, + 'skein1024-560': 0xb3a6, + 'skein1024-568': 0xb3a7, + 'skein1024-576': 0xb3a8, + 'skein1024-584': 0xb3a9, + 'skein1024-592': 0xb3aa, + 'skein1024-600': 0xb3ab, + 'skein1024-608': 0xb3ac, + 'skein1024-616': 0xb3ad, + 'skein1024-624': 0xb3ae, + 'skein1024-632': 0xb3af, + 'skein1024-640': 0xb3b0, + 'skein1024-648': 0xb3b1, + 'skein1024-656': 0xb3b2, + 'skein1024-664': 0xb3b3, + 'skein1024-672': 0xb3b4, + 'skein1024-680': 0xb3b5, + 'skein1024-688': 0xb3b6, + 'skein1024-696': 0xb3b7, + 'skein1024-704': 0xb3b8, + 'skein1024-712': 0xb3b9, + 'skein1024-720': 0xb3ba, + 'skein1024-728': 0xb3bb, + 'skein1024-736': 0xb3bc, + 'skein1024-744': 0xb3bd, + 'skein1024-752': 0xb3be, + 'skein1024-760': 0xb3bf, + 'skein1024-768': 0xb3c0, + 'skein1024-776': 0xb3c1, + 'skein1024-784': 0xb3c2, + 'skein1024-792': 0xb3c3, + 'skein1024-800': 0xb3c4, + 'skein1024-808': 0xb3c5, + 'skein1024-816': 0xb3c6, + 'skein1024-824': 0xb3c7, + 'skein1024-832': 0xb3c8, + 'skein1024-840': 0xb3c9, + 'skein1024-848': 0xb3ca, + 'skein1024-856': 0xb3cb, + 'skein1024-864': 0xb3cc, + 'skein1024-872': 0xb3cd, + 'skein1024-880': 0xb3ce, + 'skein1024-888': 0xb3cf, + 'skein1024-896': 0xb3d0, + 'skein1024-904': 0xb3d1, + 'skein1024-912': 0xb3d2, + 'skein1024-920': 0xb3d3, + 'skein1024-928': 0xb3d4, + 'skein1024-936': 0xb3d5, + 'skein1024-944': 0xb3d6, + 'skein1024-952': 0xb3d7, + 'skein1024-960': 0xb3d8, + 'skein1024-968': 0xb3d9, + 'skein1024-976': 0xb3da, + 'skein1024-984': 0xb3db, + 'skein1024-992': 0xb3dc, + 'skein1024-1000': 0xb3dd, + 'skein1024-1008': 0xb3de, + 'skein1024-1016': 0xb3df, + 'skein1024-1024': 0xb3e0, + 'poseidon-bls12_381-a2-fc1': 0xb401, + 'poseidon-bls12_381-a2-fc1-sc': 0xb402 +}) + +module.exports = { names } + + +/***/ }), + +/***/ 4243: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; +// @ts-check +/* eslint-disable guard-for-in */ +/** + * Multihash implementation in JavaScript. + * + * @module multihash + */ + + +const { Buffer } = __webpack_require__(8287) +const multibase = __webpack_require__(2879) +const varint = __webpack_require__(1203) +const { names } = __webpack_require__(3702) +const { TextDecoder } = __webpack_require__(7019) + +const textDecoder = new TextDecoder() +const codes = {} + +for (const key in names) { + codes[names[key]] = key +} +exports.names = names +exports.codes = Object.freeze(codes) + +/** + * Convert the given multihash to a hex encoded string. + * + * @param {Uint8Array} hash + * @returns {string} + */ +exports.toHexString = function toHexString (hash) { + if (!(hash instanceof Uint8Array)) { + throw new Error('must be passed a Uint8Array') + } + + const buffer = Buffer.isBuffer(hash) + ? hash + : Buffer.from(hash.buffer, hash.byteOffset, hash.byteLength) + + return buffer.toString('hex') +} + +/** + * Convert the given hex encoded string to a multihash. + * + * @param {string} hash + * @returns {Buffer} + */ +exports.fromHexString = function fromHexString (hash) { + return Buffer.from(hash, 'hex') +} + +/** + * Convert the given multihash to a base58 encoded string. + * + * @param {Uint8Array} hash + * @returns {string} + */ +exports.toB58String = function toB58String (hash) { + if (!(hash instanceof Uint8Array)) { + throw new Error('must be passed a Uint8Array') + } + + return textDecoder.decode(multibase.encode('base58btc', hash)).slice(1) +} + +/** + * Convert the given base58 encoded string to a multihash. + * + * @param {string|Uint8Array} hash + * @returns {Buffer} + */ +exports.fromB58String = function fromB58String (hash) { + const encoded = hash instanceof Uint8Array + ? textDecoder.decode(hash) + : hash + + return multibase.decode('z' + encoded) +} + +/** + * Decode a hash from the given multihash. + * + * @param {Uint8Array} bytes + * @returns {{code: number, name: string, length: number, digest: Buffer}} result + */ +exports.decode = function decode (bytes) { + if (!(bytes instanceof Uint8Array)) { + throw new Error('multihash must be a Uint8Array') + } + let buf = Buffer.isBuffer(bytes) + ? bytes + : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength) + + if (buf.length < 2) { + throw new Error('multihash too short. must be > 2 bytes.') + } + + const code = varint.decode(buf) + if (!exports.isValidCode(code)) { + throw new Error(`multihash unknown function code: 0x${code.toString(16)}`) + } + buf = buf.slice(varint.decode.bytes) + + const len = varint.decode(buf) + if (len < 0) { + throw new Error(`multihash invalid length: ${len}`) + } + buf = buf.slice(varint.decode.bytes) + + if (buf.length !== len) { + throw new Error(`multihash length inconsistent: 0x${buf.toString('hex')}`) + } + + return { + code, + name: codes[code], + length: len, + digest: buf + } +} + +/** + * Encode a hash digest along with the specified function code. + * + * > **Note:** the length is derived from the length of the digest itself. + * + * @param {Uint8Array} digest + * @param {string|number} code + * @param {number} [length] + * @returns {Buffer} + */ +exports.encode = function encode (digest, code, length) { + if (!digest || code === undefined) { + throw new Error('multihash encode requires at least two args: digest, code') + } + + // ensure it's a hashfunction code. + const hashfn = exports.coerceCode(code) + + if (!(digest instanceof Uint8Array)) { + throw new Error('digest should be a Uint8Array') + } + + if (length == null) { + length = digest.length + } + + if (length && digest.length !== length) { + throw new Error('digest length should be equal to specified length.') + } + + const hash = varint.encode(hashfn) + const len = varint.encode(length) + const buffer = Buffer.alloc(hash.length + len.length + digest.length) + buffer.set(hash, 0) + buffer.set(len, hash.length) + buffer.set(digest, hash.length + len.length) + return buffer +} + +/** + * Converts a hash function name into the matching code. + * If passed a number it will return the number if it's a valid code. + * @param {string|number} name + * @returns {number} + */ +exports.coerceCode = function coerceCode (name) { + let code = name + + if (typeof name === 'string') { + if (names[name] === undefined) { + throw new Error(`Unrecognized hash function named: ${name}`) + } + code = names[name] + } + + if (typeof code !== 'number') { + throw new Error(`Hash function code should be a number. Got: ${code}`) + } + + if (codes[code] === undefined && !exports.isAppCode(code)) { + throw new Error(`Unrecognized function code: ${code}`) + } + + return code +} + +/** + * Checks wether a code is part of the app range + * + * @param {number} code + * @returns {boolean} + */ +exports.isAppCode = function appCode (code) { + return code > 0 && code < 0x10 +} + +/** + * Checks whether a multihash code is valid. + * + * @param {number} code + * @returns {boolean} + */ +exports.isValidCode = function validCode (code) { + if (exports.isAppCode(code)) { + return true + } + + if (codes[code]) { + return true + } + + return false +} + +/** + * Check if the given buffer is a valid multihash. Throws an error if it is not valid. + * + * @param {Uint8Array} multihash + * @returns {void} + * @throws {Error} + */ +function validate (multihash) { + exports.decode(multihash) // throws if bad. +} +exports.validate = validate + +/** + * Returns a prefix from a valid multihash. Throws an error if it is not valid. + * + * @param {Uint8Array} multihash + * @returns {Buffer} + * @throws {Error} + */ +exports.prefix = function prefix (multihash) { + validate(multihash) + + return Buffer.from(multihash.buffer, multihash.byteOffset, 2) +} + + /***/ }), /***/ 6889: @@ -45453,6 +48096,2121 @@ function assert (t, m) { } +/***/ }), + +/***/ 2045: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; +var __webpack_unused_export__; +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +/* eslint-disable no-proto */ + + + +const base64 = __webpack_require__(7526) +const ieee754 = __webpack_require__(251) +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.hp = Buffer +__webpack_unused_export__ = SlowBuffer +exports.IS = 50 + +const K_MAX_LENGTH = 0x7fffffff +__webpack_unused_export__ = 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.IS + 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') +} + + /***/ }), /***/ 9211: @@ -45855,62 +50613,6 @@ module.exports = function getPolyfill() { }; -/***/ }), - -/***/ 1072: -/***/ ((__unused_webpack_module, exports) => { - -exports.endianness = function () { return 'LE' }; - -exports.hostname = function () { - if (typeof location !== 'undefined') { - return location.hostname - } - else return ''; -}; - -exports.loadavg = function () { return [] }; - -exports.uptime = function () { return 0 }; - -exports.freemem = function () { - return Number.MAX_VALUE; -}; - -exports.totalmem = function () { - return Number.MAX_VALUE; -}; - -exports.cpus = function () { return [] }; - -exports.type = function () { return 'Browser' }; - -exports.release = function () { - if (typeof navigator !== 'undefined') { - return navigator.appVersion; - } - return ''; -}; - -exports.networkInterfaces -= exports.getNetworkInterfaces -= function () { return {} }; - -exports.arch = function () { return 'javascript' }; - -exports.platform = function () { return 'browser' }; - -exports.tmpdir = exports.tmpDir = function () { - return '/tmp'; -}; - -exports.EOL = '\n'; - -exports.homedir = function () { - return '/' -}; - - /***/ }), /***/ 1137: @@ -46438,7 +51140,6 @@ module.exports = function (password, salt, iterations, keylen, digest, callback) /***/ 2455: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var process = __webpack_require__(5606); var defaultEncoding /* istanbul ignore next */ if (__webpack_require__.g.process && __webpack_require__.g.process.browser) { @@ -46638,10 +51339,9 @@ module.exports = [ /***/ }), /***/ 3225: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ ((module) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(5606); if (typeof process === 'undefined' || @@ -46689,197 +51389,6 @@ function nextTick(fn, arg1, arg2, arg3) { -/***/ }), - -/***/ 5606: -/***/ ((module) => { - -// shim for using process in browser -var process = module.exports = {}; - -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. - -var cachedSetTimeout; -var cachedClearTimeout; - -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); -} -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - - -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - - -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; - -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} - -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; - -process.listeners = function (name) { return [] } - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; - - /***/ }), /***/ 7168: @@ -50624,7 +55133,6 @@ module.exports = function xor (a, b) { /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(5606); // limit of Crypto.getRandomValues() @@ -50683,7 +55191,6 @@ function randomBytes (size, cb) { /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(5606); function oldBrowser () { @@ -50935,7 +55442,6 @@ module.exports.F = codes; /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(5606); // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -51113,7 +55619,6 @@ PassThrough.prototype._transform = function (chunk, encoding, cb) { /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(5606); // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -52345,7 +56850,6 @@ function done(stream, er, data) { /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(5606); // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -52994,7 +57498,6 @@ Writable.prototype._destroy = function (err, cb) { /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(5606); var _Object$setPrototypeO; @@ -53369,10 +57872,9 @@ module.exports = /*#__PURE__*/function () { /***/ }), /***/ 5896: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ ((module) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(5606); // undocumented cb() API, needed for core, not for public API @@ -55409,7 +59911,6 @@ function simpleEnd(buf) { /***/ 4643: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var console = __webpack_require__(6763); /** * Module exports. @@ -55838,8 +60339,6 @@ exports.isAnyArrayBuffer = isAnyArrayBuffer; /***/ 537: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/* provided dependency */ var process = __webpack_require__(5606); -/* provided dependency */ var console = __webpack_require__(6763); // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -56557,6 +61056,119 @@ function callbackify(original) { exports.callbackify = callbackify; +/***/ }), + +/***/ 6797: +/***/ ((module) => { + +module.exports = read + +var MSB = 0x80 + , REST = 0x7F + +function read(buf, offset) { + var res = 0 + , offset = offset || 0 + , shift = 0 + , counter = offset + , b + , l = buf.length + + do { + if (counter >= l) { + read.bytes = 0 + throw new RangeError('Could not decode varint') + } + b = buf[counter++] + res += shift < 28 + ? (b & REST) << shift + : (b & REST) * Math.pow(2, shift) + shift += 7 + } while (b >= MSB) + + read.bytes = counter - offset + + return res +} + + +/***/ }), + +/***/ 1877: +/***/ ((module) => { + +module.exports = encode + +var MSB = 0x80 + , REST = 0x7F + , MSBALL = ~REST + , INT = Math.pow(2, 31) + +function encode(num, out, offset) { + out = out || [] + offset = offset || 0 + var oldOffset = offset + + while(num >= INT) { + out[offset++] = (num & 0xFF) | MSB + num /= 128 + } + while(num & MSBALL) { + out[offset++] = (num & 0xFF) | MSB + num >>>= 7 + } + out[offset] = num | 0 + + encode.bytes = offset - oldOffset + 1 + + return out +} + + +/***/ }), + +/***/ 1203: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +module.exports = { + encode: __webpack_require__(1877) + , decode: __webpack_require__(6797) + , encodingLength: __webpack_require__(7867) +} + + +/***/ }), + +/***/ 7867: +/***/ ((module) => { + + +var N1 = Math.pow(2, 7) +var N2 = Math.pow(2, 14) +var N3 = Math.pow(2, 21) +var N4 = Math.pow(2, 28) +var N5 = Math.pow(2, 35) +var N6 = Math.pow(2, 42) +var N7 = Math.pow(2, 49) +var N8 = Math.pow(2, 56) +var N9 = Math.pow(2, 63) + +module.exports = function (value) { + return ( + value < N1 ? 1 + : value < N2 ? 2 + : value < N3 ? 3 + : value < N4 ? 4 + : value < N5 ? 5 + : value < N6 ? 6 + : value < N7 ? 7 + : value < N8 ? 8 + : value < N9 ? 9 + : 10 + ) +} + + /***/ }), /***/ 8961: @@ -56715,1908 +61327,5658 @@ exports.createContext = Script.createContext = function (context) { /***/ }), -/***/ 4400: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 7019: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/* - Copyright 2019 0KIMS association. +"use strict"; - This file is part of wasmbuilder - wasmbuilder is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. +exports.TextEncoder = + typeof TextEncoder !== "undefined" ? TextEncoder : (__webpack_require__(537).TextEncoder) - wasmbuilder is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmbuilder. If not, see . -*/ - -module.exports.ModuleBuilder = __webpack_require__(442); -/* unused reexport */ __webpack_require__(8269); -/* unused reexport */ __webpack_require__(7831); +exports.TextDecoder = + typeof TextDecoder !== "undefined" ? TextDecoder : (__webpack_require__(537).TextDecoder) /***/ }), -/***/ 5705: +/***/ 5767: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* - Copyright 2019 0KIMS association. - - This file is part of wasmbuilder - - wasmbuilder is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmbuilder is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmbuilder. If not, see . -*/ - -const utils = __webpack_require__(484); - -class CodeBuilder { - constructor(func) { - this.func = func; - this.functionName = func.functionName; - this.module = func.module; - } - - setLocal(localName, valCode) { - const idx = this.func.localIdxByName[localName]; - if (idx === undefined) - throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${localName} `); - return [...valCode, 0x21, ...utils.varuint32( idx )]; - } - - teeLocal(localName, valCode) { - const idx = this.func.localIdxByName[localName]; - if (idx === undefined) - throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${localName} `); - return [...valCode, 0x22, ...utils.varuint32( idx )]; - } - - getLocal(localName) { - const idx = this.func.localIdxByName[localName]; - if (idx === undefined) - throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${localName} `); - return [0x20, ...utils.varuint32( idx )]; - } - - i64_load8_s(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 0 : _align; // 8 bits alignment by default - return [...idxCode, 0x30, align, ...utils.varuint32(offset)]; - } - - i64_load8_u(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 0 : _align; // 8 bits alignment by default - return [...idxCode, 0x31, align, ...utils.varuint32(offset)]; - } - - i64_load16_s(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 1 : _align; // 16 bits alignment by default - return [...idxCode, 0x32, align, ...utils.varuint32(offset)]; - } - - i64_load16_u(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 1 : _align; // 16 bits alignment by default - return [...idxCode, 0x33, align, ...utils.varuint32(offset)]; - } - - i64_load32_s(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 2 : _align; // 32 bits alignment by default - return [...idxCode, 0x34, align, ...utils.varuint32(offset)]; - } - - i64_load32_u(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 2 : _align; // 32 bits alignment by default - return [...idxCode, 0x35, align, ...utils.varuint32(offset)]; - } - - i64_load(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 3 : _align; // 64 bits alignment by default - return [...idxCode, 0x29, align, ...utils.varuint32(offset)]; - } +"use strict"; - i64_store(idxCode, _offset, _align, _codeVal) { - let offset, align, codeVal; - if (Array.isArray(_offset)) { - offset = 0; - align = 3; - codeVal = _offset; - } else if (Array.isArray(_align)) { - offset = _offset; - align = 3; - codeVal = _align; - } else if (Array.isArray(_codeVal)) { - offset = _offset; - align = _align; - codeVal = _codeVal; - } - return [...idxCode, ...codeVal, 0x37, align, ...utils.varuint32(offset)]; - } +var forEach = __webpack_require__(2682); +var availableTypedArrays = __webpack_require__(9209); +var callBind = __webpack_require__(487); +var callBound = __webpack_require__(8075); +var gOPD = __webpack_require__(5795); - i64_store32(idxCode, _offset, _align, _codeVal) { - let offset, align, codeVal; - if (Array.isArray(_offset)) { - offset = 0; - align = 2; - codeVal = _offset; - } else if (Array.isArray(_align)) { - offset = _offset; - align = 2; - codeVal = _align; - } else if (Array.isArray(_codeVal)) { - offset = _offset; - align = _align; - codeVal = _codeVal; - } - return [...idxCode, ...codeVal, 0x3e, align, ...utils.varuint32(offset)]; - } +/** @type {(O: object) => string} */ +var $toString = callBound('Object.prototype.toString'); +var hasToStringTag = __webpack_require__(9092)(); +var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis; +var typedArrays = availableTypedArrays(); - i64_store16(idxCode, _offset, _align, _codeVal) { - let offset, align, codeVal; - if (Array.isArray(_offset)) { - offset = 0; - align = 1; - codeVal = _offset; - } else if (Array.isArray(_align)) { - offset = _offset; - align = 1; - codeVal = _align; - } else if (Array.isArray(_codeVal)) { - offset = _offset; - align = _align; - codeVal = _codeVal; - } - return [...idxCode, ...codeVal, 0x3d, align, ...utils.varuint32(offset)]; - } +var $slice = callBound('String.prototype.slice'); +var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); +/** @type {(array: readonly T[], value: unknown) => number} */ +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; +}; - i64_store8(idxCode, _offset, _align, _codeVal) { - let offset, align, codeVal; - if (Array.isArray(_offset)) { - offset = 0; - align = 0; - codeVal = _offset; - } else if (Array.isArray(_align)) { - offset = _offset; - align = 0; - codeVal = _align; - } else if (Array.isArray(_codeVal)) { - offset = _offset; - align = _align; - codeVal = _codeVal; - } - return [...idxCode, ...codeVal, 0x3c, align, ...utils.varuint32(offset)]; - } - - i32_load8_s(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 0 : _align; // 32 bits alignment by default - return [...idxCode, 0x2c, align, ...utils.varuint32(offset)]; - } - - i32_load8_u(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 0 : _align; // 32 bits alignment by default - return [...idxCode, 0x2d, align, ...utils.varuint32(offset)]; - } - - i32_load16_s(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 1 : _align; // 32 bits alignment by default - return [...idxCode, 0x2e, align, ...utils.varuint32(offset)]; - } - - i32_load16_u(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 1 : _align; // 32 bits alignment by default - return [...idxCode, 0x2f, align, ...utils.varuint32(offset)]; - } - - i32_load(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 2 : _align; // 32 bits alignment by default - return [...idxCode, 0x28, align, ...utils.varuint32(offset)]; - } - - i32_store(idxCode, _offset, _align, _codeVal) { - let offset, align, codeVal; - if (Array.isArray(_offset)) { - offset = 0; - align = 2; - codeVal = _offset; - } else if (Array.isArray(_align)) { - offset = _offset; - align = 2; - codeVal = _align; - } else if (Array.isArray(_codeVal)) { - offset = _offset; - align = _align; - codeVal = _codeVal; - } - return [...idxCode, ...codeVal, 0x36, align, ...utils.varuint32(offset)]; - } - - - i32_store16(idxCode, _offset, _align, _codeVal) { - let offset, align, codeVal; - if (Array.isArray(_offset)) { - offset = 0; - align = 1; - codeVal = _offset; - } else if (Array.isArray(_align)) { - offset = _offset; - align = 1; - codeVal = _align; - } else if (Array.isArray(_codeVal)) { - offset = _offset; - align = _align; - codeVal = _codeVal; - } - return [...idxCode, ...codeVal, 0x3b, align, ...utils.varuint32(offset)]; - } - - i32_store8(idxCode, _offset, _align, _codeVal) { - let offset, align, codeVal; - if (Array.isArray(_offset)) { - offset = 0; - align = 0; - codeVal = _offset; - } else if (Array.isArray(_align)) { - offset = _offset; - align = 0; - codeVal = _align; - } else if (Array.isArray(_codeVal)) { - offset = _offset; - align = _align; - codeVal = _codeVal; - } - return [...idxCode, ...codeVal, 0x3a, align, ...utils.varuint32(offset)]; - } - - call(fnName, ...args) { - const idx = this.module.functionIdxByName[fnName]; - if (idx === undefined) - throw new Error(`Function not defined: Function: ${fnName}`); - return [...[].concat(...args), 0x10, ...utils.varuint32(idx)]; - } - - call_indirect(fnIdx, ...args) { - return [...[].concat(...args), ...fnIdx, 0x11, 0, 0]; - } - - if(condCode, thenCode, elseCode) { - if (elseCode) { - return [...condCode, 0x04, 0x40, ...thenCode, 0x05, ...elseCode, 0x0b]; - } else { - return [...condCode, 0x04, 0x40, ...thenCode, 0x0b]; - } - } - - block(bCode) { return [0x02, 0x40, ...bCode, 0x0b]; } - loop(...args) { - return [0x03, 0x40, ...[].concat(...[...args]), 0x0b]; - } - br_if(relPath, condCode) { return [...condCode, 0x0d, ...utils.varuint32(relPath)]; } - br(relPath) { return [0x0c, ...utils.varuint32(relPath)]; } - ret(rCode) { return [...rCode, 0x0f]; } - drop(dCode) { return [...dCode, 0x1a]; } - - i64_const(num) { return [0x42, ...utils.varint64(num)]; } - i32_const(num) { return [0x41, ...utils.varint32(num)]; } - - - i64_eqz(opcode) { return [...opcode, 0x50]; } - i64_eq(op1code, op2code) { return [...op1code, ...op2code, 0x51]; } - i64_ne(op1code, op2code) { return [...op1code, ...op2code, 0x52]; } - i64_lt_s(op1code, op2code) { return [...op1code, ...op2code, 0x53]; } - i64_lt_u(op1code, op2code) { return [...op1code, ...op2code, 0x54]; } - i64_gt_s(op1code, op2code) { return [...op1code, ...op2code, 0x55]; } - i64_gt_u(op1code, op2code) { return [...op1code, ...op2code, 0x56]; } - i64_le_s(op1code, op2code) { return [...op1code, ...op2code, 0x57]; } - i64_le_u(op1code, op2code) { return [...op1code, ...op2code, 0x58]; } - i64_ge_s(op1code, op2code) { return [...op1code, ...op2code, 0x59]; } - i64_ge_u(op1code, op2code) { return [...op1code, ...op2code, 0x5a]; } - i64_add(op1code, op2code) { return [...op1code, ...op2code, 0x7c]; } - i64_sub(op1code, op2code) { return [...op1code, ...op2code, 0x7d]; } - i64_mul(op1code, op2code) { return [...op1code, ...op2code, 0x7e]; } - i64_div_s(op1code, op2code) { return [...op1code, ...op2code, 0x7f]; } - i64_div_u(op1code, op2code) { return [...op1code, ...op2code, 0x80]; } - i64_rem_s(op1code, op2code) { return [...op1code, ...op2code, 0x81]; } - i64_rem_u(op1code, op2code) { return [...op1code, ...op2code, 0x82]; } - i64_and(op1code, op2code) { return [...op1code, ...op2code, 0x83]; } - i64_or(op1code, op2code) { return [...op1code, ...op2code, 0x84]; } - i64_xor(op1code, op2code) { return [...op1code, ...op2code, 0x85]; } - i64_shl(op1code, op2code) { return [...op1code, ...op2code, 0x86]; } - i64_shr_s(op1code, op2code) { return [...op1code, ...op2code, 0x87]; } - i64_shr_u(op1code, op2code) { return [...op1code, ...op2code, 0x88]; } - i64_extend_i32_s(op1code) { return [...op1code, 0xac]; } - i64_extend_i32_u(op1code) { return [...op1code, 0xad]; } - i64_clz(op1code) { return [...op1code, 0x79]; } - i64_ctz(op1code) { return [...op1code, 0x7a]; } - - i32_eqz(op1code) { return [...op1code, 0x45]; } - i32_eq(op1code, op2code) { return [...op1code, ...op2code, 0x46]; } - i32_ne(op1code, op2code) { return [...op1code, ...op2code, 0x47]; } - i32_lt_s(op1code, op2code) { return [...op1code, ...op2code, 0x48]; } - i32_lt_u(op1code, op2code) { return [...op1code, ...op2code, 0x49]; } - i32_gt_s(op1code, op2code) { return [...op1code, ...op2code, 0x4a]; } - i32_gt_u(op1code, op2code) { return [...op1code, ...op2code, 0x4b]; } - i32_le_s(op1code, op2code) { return [...op1code, ...op2code, 0x4c]; } - i32_le_u(op1code, op2code) { return [...op1code, ...op2code, 0x4d]; } - i32_ge_s(op1code, op2code) { return [...op1code, ...op2code, 0x4e]; } - i32_ge_u(op1code, op2code) { return [...op1code, ...op2code, 0x4f]; } - i32_add(op1code, op2code) { return [...op1code, ...op2code, 0x6a]; } - i32_sub(op1code, op2code) { return [...op1code, ...op2code, 0x6b]; } - i32_mul(op1code, op2code) { return [...op1code, ...op2code, 0x6c]; } - i32_div_s(op1code, op2code) { return [...op1code, ...op2code, 0x6d]; } - i32_div_u(op1code, op2code) { return [...op1code, ...op2code, 0x6e]; } - i32_rem_s(op1code, op2code) { return [...op1code, ...op2code, 0x6f]; } - i32_rem_u(op1code, op2code) { return [...op1code, ...op2code, 0x70]; } - i32_and(op1code, op2code) { return [...op1code, ...op2code, 0x71]; } - i32_or(op1code, op2code) { return [...op1code, ...op2code, 0x72]; } - i32_xor(op1code, op2code) { return [...op1code, ...op2code, 0x73]; } - i32_shl(op1code, op2code) { return [...op1code, ...op2code, 0x74]; } - i32_shr_s(op1code, op2code) { return [...op1code, ...op2code, 0x75]; } - i32_shr_u(op1code, op2code) { return [...op1code, ...op2code, 0x76]; } - i32_rotl(op1code, op2code) { return [...op1code, ...op2code, 0x77]; } - i32_rotr(op1code, op2code) { return [...op1code, ...op2code, 0x78]; } - i32_wrap_i64(op1code) { return [...op1code, 0xa7]; } - i32_clz(op1code) { return [...op1code, 0x67]; } - i32_ctz(op1code) { return [...op1code, 0x68]; } - - unreachable() { return [ 0x0 ]; } - - current_memory() { return [ 0x3f, 0]; } - - comment() { return []; } +/** @typedef {(receiver: import('.').TypedArray) => string | typeof Uint8Array.prototype.slice.call | typeof Uint8Array.prototype.set.call} Getter */ +/** @type {{ [k in `\$${import('.').TypedArrayName}`]?: Getter } & { __proto__: null }} */ +var cache = { __proto__: null }; +if (hasToStringTag && gOPD && getPrototypeOf) { + forEach(typedArrays, function (typedArray) { + var arr = new g[typedArray](); + if (Symbol.toStringTag in arr) { + var proto = getPrototypeOf(arr); + // @ts-expect-error TS won't narrow inside a closure + var descriptor = gOPD(proto, Symbol.toStringTag); + if (!descriptor) { + var superProto = getPrototypeOf(proto); + // @ts-expect-error TS won't narrow inside a closure + descriptor = gOPD(superProto, Symbol.toStringTag); + } + // @ts-expect-error TODO: fix + cache['$' + typedArray] = callBind(descriptor.get); + } + }); +} else { + forEach(typedArrays, function (typedArray) { + var arr = new g[typedArray](); + var fn = arr.slice || arr.set; + if (fn) { + // @ts-expect-error TODO: fix + cache['$' + typedArray] = callBind(fn); + } + }); } -module.exports = CodeBuilder; +/** @type {(value: object) => false | import('.').TypedArrayName} */ +var tryTypedArrays = function tryAllTypedArrays(value) { + /** @type {ReturnType} */ var found = false; + forEach( + // eslint-disable-next-line no-extra-parens + /** @type {Record<`\$${TypedArrayName}`, Getter>} */ /** @type {any} */ (cache), + /** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */ + function (getter, typedArray) { + if (!found) { + try { + // @ts-expect-error TODO: fix + if ('$' + getter(value) === typedArray) { + found = $slice(typedArray, 1); + } + } catch (e) { /**/ } + } + } + ); + return found; +}; +/** @type {(value: object) => false | import('.').TypedArrayName} */ +var trySlices = function tryAllSlices(value) { + /** @type {ReturnType} */ var found = false; + forEach( + // eslint-disable-next-line no-extra-parens + /** @type {Record<`\$${TypedArrayName}`, Getter>} */ /** @type {any} */ (cache), + /** @type {(getter: typeof cache, name: `\$${import('.').TypedArrayName}`) => void} */ function (getter, name) { + if (!found) { + try { + // @ts-expect-error TODO: fix + getter(value); + found = $slice(name, 1); + } catch (e) { /**/ } + } + } + ); + return found; +}; -/***/ }), - -/***/ 4010: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmbuilder - - wasmbuilder is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmbuilder is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmbuilder. If not, see . -*/ - -const utils = __webpack_require__(484); - -class CodeBuilderWat { - constructor(func) { - this.func = func; - this.functionName = func.functionName; - this.module = func.module; - } - - setLocal(localName, valCode) { - const idx = this.func.localIdxByName[localName]; - if (idx === undefined) - throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${localName} `); - return [valCode, `set_local $${localName}`]; - } - - teeLocal(localName, valCode) { - const idx = this.func.localIdxByName[localName]; - if (idx === undefined) - throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${localName} `); - return [valCode, `tee_local $${localName}`]; - } - - getLocal(localName) { - const idx = this.func.localIdxByName[localName]; - if (idx === undefined) - throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${localName} `); - return `get_local $${localName}`; - } - - genLoad(inst, def_align, idxCode, _offset, _align) { - let S = inst; - const offset = _offset || 0; - if (offset>0) S += ` offset=${offset}`; - const align = (_align === undefined) ? def_align : _align; // 8 bits alignment by default - if (align!=def_align) S += ` align=${1 << align}`; - return [idxCode, S]; - } - - - genStore(inst, def_align, idxCode, _offset, _align, _codeVal) { - let offset, align, codeVal; - if (typeof _align === "undefined") { - offset = 0; - align = def_align; - codeVal = _offset; - } else if (typeof _codeVal === "undefined") { - offset = _offset; - align = def_align; - codeVal = _align; - } else { - offset = _offset; - align = _align; - codeVal = _codeVal; - } - let S = inst; - if (offset>0) S += ` offset=${offset}`; - if (align!=def_align) S += ` align=${1 << align}`; - return [idxCode, codeVal, S]; - } - - i64_load8_s(idxCode, _offset, _align) { - return this.genLoad("i64.load8_s", 0, idxCode, _offset, _align); - } - - i64_load8_u(idxCode, _offset, _align) { - return this.genLoad("i64.load8_u", 0, idxCode, _offset, _align); - } - - i64_load16_s(idxCode, _offset, _align) { - return this.genLoad("i64.load16_s", 1,idxCode, _offset, _align); - } - - i64_load16_u(idxCode, _offset, _align) { - return this.genLoad("i64.load16_u", 1, idxCode, _offset, _align); - } - - i64_load32_s(idxCode, _offset, _align) { - return this.genLoad("i64.load32_s", 2, idxCode, _offset, _align); - } - - i64_load32_u(idxCode, _offset, _align) { - return this.genLoad("i64.load32_u", 2, idxCode, _offset, _align); - } - - i64_load(idxCode, _offset, _align) { - return this.genLoad("i64.load", 3, idxCode, _offset, _align); - } - - - i64_store(idxCode, _offset, _align, _codeVal) { - return this.genStore("i64.store", 3, idxCode, _offset, _align, _codeVal); - } - - i64_store32(idxCode, _offset, _align, _codeVal) { - return this.genStore("i64.store32", 2, idxCode, _offset, _align, _codeVal); - } - - i64_store16(idxCode, _offset, _align, _codeVal) { - return this.genStore("i64.store16", 1, idxCode, _offset, _align, _codeVal); - } - - i64_store8(idxCode, _offset, _align, _codeVal) { - return this.genStore("i64.store8", 0, idxCode, _offset, _align, _codeVal); - } - - i32_load8_s(idxCode, _offset, _align) { - return this.genLoad("i32.load8_s", 0, idxCode, _offset, _align); - } - - i32_load8_u(idxCode, _offset, _align) { - return this.genLoad("i32.load8_u", 0, idxCode, _offset, _align); - } - - i32_load16_s(idxCode, _offset, _align) { - return this.genLoad("i32.load16_s", 1, idxCode, _offset, _align); - } - - i32_load16_u(idxCode, _offset, _align) { - return this.genLoad("i32.load16_u", 1, idxCode, _offset, _align); - } - - i32_load(idxCode, _offset, _align) { - return this.genLoad("i32.load", 2, idxCode, _offset, _align); - } - - i32_store(idxCode, _offset, _align, _codeVal) { - return this.genStore("i32.store", 2, idxCode, _offset, _align, _codeVal); - } - - i32_store16(idxCode, _offset, _align, _codeVal) { - return this.genStore("i32.store16", 1, idxCode, _offset, _align, _codeVal); - } - - i32_store8(idxCode, _offset, _align, _codeVal) { - return this.genStore("i32.store8", 0, idxCode, _offset, _align, _codeVal); - } - - call(fnName, ...args) { - const idx = this.module.functionIdxByName[fnName]; - if (idx === undefined) - throw new Error(`Function not defined: Function: ${fnName}`); - return [args, `call $${fnName}`]; - } - - call_indirect(fnIdx, ...args) { - return [args, fnIdx, "call_indirect (type 0)"]; - } - - if(condCode, thenCode, elseCode) { - if (elseCode) { - return [condCode, "if", utils.ident(thenCode), "else", utils.ident(elseCode), "end"]; - } else { - return [condCode, "if", utils.ident(thenCode), "end"]; - } - } - - block(bCode) { return ["block", utils.ident(bCode), "end"]; } - loop(...args) { return ["loop", utils.ident(args), "end"]; } - br_if(relPath, condCode) { return [condCode, `br_if ${relPath}`]; } - br(relPath) { return `br ${relPath}`; } - ret(rCode) { return [rCode, "return"]; } - drop(dCode) { return [dCode, "drop"]; } - - i64_const(num) { return `i64.const ${num}`; } - i32_const(num) { return `i32.const ${num}`; } - - i64_eqz(opcode) { return [opcode, "i64.eqz"]; } - i64_eq(op1code, op2code) { return [op1code, op2code, "i64.eq"]; } - i64_ne(op1code, op2code) { return [op1code, op2code, "i64.ne"]; } - i64_lt_s(op1code, op2code) { return [op1code, op2code, "i64.lt_s"]; } - i64_lt_u(op1code, op2code) { return [op1code, op2code, "i64.lt_u"]; } - i64_gt_s(op1code, op2code) { return [op1code, op2code, "i64.gt_s"]; } - i64_gt_u(op1code, op2code) { return [op1code, op2code, "i64.gt_u"]; } - i64_le_s(op1code, op2code) { return [op1code, op2code, "i64.le_s"]; } - i64_le_u(op1code, op2code) { return [op1code, op2code, "i64.le_u"]; } - i64_ge_s(op1code, op2code) { return [op1code, op2code, "i64.ge_s"]; } - i64_ge_u(op1code, op2code) { return [op1code, op2code, "i64.ge_u"]; } - i64_add(op1code, op2code) { return [op1code, op2code, "i64.add"]; } - i64_sub(op1code, op2code) { return [op1code, op2code, "i64.sub"]; } - i64_mul(op1code, op2code) { return [op1code, op2code, "i64.mul"]; } - i64_div_s(op1code, op2code) { return [op1code, op2code, "i64.div_s"]; } - i64_div_u(op1code, op2code) { return [op1code, op2code, "i64.div_u"]; } - i64_rem_s(op1code, op2code) { return [op1code, op2code, "i64.rem_s"]; } - i64_rem_u(op1code, op2code) { return [op1code, op2code, "i64.rem_u"]; } - i64_and(op1code, op2code) { return [op1code, op2code, "i64.and"]; } - i64_or(op1code, op2code) { return [op1code, op2code, "i64.or"]; } - i64_xor(op1code, op2code) { return [op1code, op2code, "i64.xor"]; } - i64_shl(op1code, op2code) { return [op1code, op2code, "i64.shl"]; } - i64_shr_s(op1code, op2code) { return [op1code, op2code, "i64.shr_s"]; } - i64_shr_u(op1code, op2code) { return [op1code, op2code, "i64.shr_u"]; } - i64_extend_i32_s(op1code) { return [op1code, "i64.extend_s/i32"]; } - i64_extend_i32_u(op1code) { return [op1code, "i64.extend_u/i32"]; } - - - i32_eqz(op1code) { return [op1code, "i32.eqz"]; } - i32_eq(op1code, op2code) { return [op1code, op2code, "i32.eq"]; } - i32_ne(op1code, op2code) { return [op1code, op2code, "i32.ne"]; } - i32_lt_s(op1code, op2code) { return [op1code, op2code, "i32.lt_s"]; } - i32_lt_u(op1code, op2code) { return [op1code, op2code, "i32.lt_u"]; } - i32_gt_s(op1code, op2code) { return [op1code, op2code, "i32.gt_s"]; } - i32_gt_u(op1code, op2code) { return [op1code, op2code, "i32.gt_u"]; } - i32_le_s(op1code, op2code) { return [op1code, op2code, "i32.le_s"]; } - i32_le_u(op1code, op2code) { return [op1code, op2code, "i32.le_u"]; } - i32_ge_s(op1code, op2code) { return [op1code, op2code, "i32.ge_s"]; } - i32_ge_u(op1code, op2code) { return [op1code, op2code, "i32.ge_u"]; } - i32_add(op1code, op2code) { return [op1code, op2code, "i32.add"]; } - i32_sub(op1code, op2code) { return [op1code, op2code, "i32.sub"]; } - i32_mul(op1code, op2code) { return [op1code, op2code, "i32.mul"]; } - i32_div_s(op1code, op2code) { return [op1code, op2code, "i32.div_s"]; } - i32_div_u(op1code, op2code) { return [op1code, op2code, "i32.div_u"]; } - i32_rem_s(op1code, op2code) { return [op1code, op2code, "i32.rem_s"]; } - i32_rem_u(op1code, op2code) { return [op1code, op2code, "i32.rem_u"]; } - i32_and(op1code, op2code) { return [op1code, op2code, "i32.and"]; } - i32_or(op1code, op2code) { return [op1code, op2code, "i32.or"]; } - i32_xor(op1code, op2code) { return [op1code, op2code, "i32.xor"]; } - i32_shl(op1code, op2code) { return [op1code, op2code, "i32.shl"]; } - i32_shr_s(op1code, op2code) { return [op1code, op2code, "i32.shr_s"]; } - i32_shr_u(op1code, op2code) { return [op1code, op2code, "i32.shr_u"]; } - i32_rotl(op1code, op2code) { return [op1code, op2code, "i32.rotl"]; } - i32_rotr(op1code, op2code) { return [op1code, op2code, "i32.rotr"]; } - i32_wrap_i64(op1code) { return [op1code, "i32.wrap/i64"]; } - - ureachable() { return "unreachable"; } - - current_memory() { return "current_memory"; } - - comment(c) { return ";; " + c; } - -} - -module.exports = CodeBuilderWat; - - -/***/ }), - -/***/ 5986: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmbuilder - - wasmbuilder is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmbuilder is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmbuilder. If not, see . -*/ - -const CodeBuilder = __webpack_require__(5705); -const utils = __webpack_require__(484); - -const typeCodes = { - "i32": 0x7f, - "i64": 0x7e, - "f32": 0x7d, - "f64": 0x7c, - "anyfunc": 0x70, - "func": 0x60, - "emptyblock": 0x40 +/** @type {import('.')} */ +module.exports = function whichTypedArray(value) { + if (!value || typeof value !== 'object') { return false; } + if (!hasToStringTag) { + /** @type {string} */ + var tag = $slice($toString(value), 8, -1); + if ($indexOf(typedArrays, tag) > -1) { + return tag; + } + if (tag !== 'Object') { + return false; + } + // node < 0.6 hits here on real Typed Arrays + return trySlices(value); + } + if (!gOPD) { return null; } // unknown engine + return tryTypedArrays(value); }; -class FunctionBuilder { +/***/ }), - constructor (module, fnName, fnType, moduleName, fieldName) { - if (fnType == "import") { - this.fnType = "import"; - this.moduleName = moduleName; - this.fieldName = fieldName; - } else if (fnType == "internal") { - this.fnType = "internal"; - } else { - throw new Error("Invalid function fnType: " + fnType); - } - this.module = module; - this.fnName = fnName; - this.params = []; - this.locals = []; - this.localIdxByName = {}; - this.code = []; - this.returnType = null; - this.nextLocal =0; - } +/***/ 8982: +/***/ (() => { - addParam(paramName, paramType) { - if (this.localIdxByName[paramName]) - throw new Error(`param already exists. Function: ${this.fnName}, Param: ${paramName} `); - const idx = this.nextLocal++; - this.localIdxByName[paramName] = idx; - this.params.push({ - type: paramType - }); - } +/* (ignored) */ - addLocal(localName, localType, _length) { - const length = _length || 1; - if (this.localIdxByName[localName]) - throw new Error(`local already exists. Function: ${this.fnName}, Param: ${localName} `); - const idx = this.nextLocal++; - this.localIdxByName[localName] = idx; - this.locals.push({ - type: localType, - length: length - }); - } +/***/ }), - setReturnType(returnType) { - if (this.returnType) - throw new Error(`returnType already defined. Function: ${this.fnName}`); - this.returnType = returnType; - } +/***/ 7790: +/***/ (() => { - getSignature() { - const params = [...utils.varuint32(this.params.length), ...this.params.map((p) => typeCodes[p.type])]; - const returns = this.returnType ? [0x01, typeCodes[this.returnType]] : [0]; - return [0x60, ...params, ...returns]; - } +/* (ignored) */ - getBody() { - const locals = this.locals.map((l) => [ - ...utils.varuint32(l.length), - typeCodes[l.type] - ]); +/***/ }), - const body = [ - ...utils.varuint32(this.locals.length), - ...[].concat(...locals), - ...this.code, - 0x0b - ]; - return [ - ...utils.varuint32(body.length), - ...body - ]; - } +/***/ 3776: +/***/ (() => { - addCode(...code) { - this.code.push(...[].concat(...[...code])); - } +/* (ignored) */ - getCodeBuilder() { - return new CodeBuilder(this); - } -} +/***/ }), -module.exports = FunctionBuilder; +/***/ 1638: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 2668: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 7965: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 6089: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 9368: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 4688: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 1069: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 5340: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 9838: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 7882: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 9209: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var possibleNames = __webpack_require__(6578); + +var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis; + +/** @type {import('.')} */ +module.exports = function availableTypedArrays() { + var /** @type {ReturnType} */ out = []; + for (var i = 0; i < possibleNames.length; i++) { + if (typeof g[possibleNames[i]] === 'function') { + // @ts-expect-error + out[out.length] = possibleNames[i]; + } + } + return out; +}; /***/ }), -/***/ 2341: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 5238: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { -/* - Copyright 2019 0KIMS association. +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ K: () => (/* binding */ allocUnsafe) +/* harmony export */ }); +/* unused harmony export alloc */ +/* harmony import */ var _util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5930); - This file is part of wasmbuilder - - wasmbuilder is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmbuilder is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmbuilder. If not, see . -*/ - -const CodeBuilderWat = __webpack_require__(4010); -const utils = __webpack_require__(484); - -class FunctionBuilderWat { - - constructor (module, fnName, fnType, moduleName, fieldName) { - if (fnType == "import") { - this.fnType = "import"; - this.moduleName = moduleName; - this.fieldName = fieldName; - } else if (fnType == "internal") { - this.fnType = "internal"; - this.comment = moduleName; - } else { - throw new Error("Invalid function fnType: " + fnType); - } - this.module = module; - this.fnName = fnName; - this.params = []; - this.locals = []; - this.localIdxByName = {}; - this.code = []; - this.returnType = null; - this.nextLocal =0; - } - - addParam(paramName, paramType) { - if (this.localIdxByName[paramName]) - throw new Error(`param already exists. Function: ${this.fnName}, Param: ${paramName} `); - const idx = this.nextLocal++; - this.localIdxByName[paramName] = idx; - this.params.push({ - type: paramType, - name: paramName - }); - } - - addLocal(localName, localType, _length) { - if ((typeof _length != "undefined") && (_length != 1)) { - throw new Error("Locals greater than 1 not implemented"); - } - if (this.localIdxByName[localName]) - throw new Error(`local already exists. Function: ${this.fnName}, Param: ${localName} `); - const idx = this.nextLocal++; - this.localIdxByName[localName] = idx; - this.locals.push({ - type: localType, - name: localName, - }); - } - - setReturnType(returnType) { - if (this.returnType) - throw new Error(`returnType already defined. Function: ${this.fnName}`); - this.returnType = returnType; - } - - getSignature() { - let p = ""; - for (let i=0; i { +/***/ 5007: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { -/* - Copyright 2019 0KIMS association. - - This file is part of wasmbuilder - - wasmbuilder is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmbuilder is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmbuilder. If not, see . -*/ +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ concat: () => (/* binding */ concat) +/* harmony export */ }); +/* harmony import */ var _alloc_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5238); +/* harmony import */ var _util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5930); -const FunctionBuilder = __webpack_require__(5986); -const utils = __webpack_require__(484); - -class ModuleBuilder { - - constructor() { - this.functions = []; - this.functionIdxByName = {}; - this.nImportFunctions = 0; - this.nInternalFunctions =0; - this.memory = { - pagesSize: 1, - moduleName: "env", - fieldName: "memory" - }; - this.free = 8; - this.datas = []; - this.modules = {}; - this.exports = []; - this.functionsTable = []; - } - - build() { - this._setSignatures(); - return new Uint8Array([ - ...utils.u32(0x6d736100), - ...utils.u32(1), - ...this._buildType(), - ...this._buildImport(), - ...this._buildFunctionDeclarations(), - ...this._buildFunctionsTable(), - ...this._buildExports(), - ...this._buildElements(), - ...this._buildCode(), - ...this._buildData() - ]); - } - - addFunction(fnName) { - if (typeof(this.functionIdxByName[fnName]) !== "undefined") - throw new Error(`Function already defined: ${fnName}`); - - const idx = this.functions.length; - this.functionIdxByName[fnName] = idx; - - this.functions.push(new FunctionBuilder(this, fnName, "internal")); - - this.nInternalFunctions++; - return this.functions[idx]; - } - - addIimportFunction(fnName, moduleName, _fieldName) { - if (typeof(this.functionIdxByName[fnName]) !== "undefined") - throw new Error(`Function already defined: ${fnName}`); - - if ( (this.functions.length>0) - &&(this.functions[this.functions.length-1].type == "internal")) - throw new Error(`Import functions must be declared before internal: ${fnName}`); - - let fieldName = _fieldName || fnName; - - const idx = this.functions.length; - this.functionIdxByName[fnName] = idx; - - this.functions.push(new FunctionBuilder(this, fnName, "import", moduleName, fieldName)); - - this.nImportFunctions ++; - return this.functions[idx]; - } - - setMemory(pagesSize, moduleName, fieldName) { - this.memory = { - pagesSize: pagesSize, - moduleName: moduleName || "env", - fieldName: fieldName || "memory" - }; - } - - exportFunction(fnName, _exportName) { - const exportName = _exportName || fnName; - if (typeof(this.functionIdxByName[fnName]) === "undefined") - throw new Error(`Function not defined: ${fnName}`); - const idx = this.functionIdxByName[fnName]; - if (exportName != fnName) { - this.functionIdxByName[exportName] = idx; - } - this.exports.push({ - exportName: exportName, - idx: idx - }); - } - - addFunctionToTable(fnName) { - const idx = this.functionIdxByName[fnName]; - this.functionsTable.push(idx); - } - - addData(offset, bytes) { - this.datas.push({ - offset: offset, - bytes: bytes - }); - } - - alloc(a, b) { - let size; - let bytes; - if ((Array.isArray(a) || ArrayBuffer.isView(a)) && (typeof(b) === "undefined")) { - size = a.length; - bytes = a; - } else { - size = a; - bytes = b; - } - size = (((size-1)>>3) +1)<<3; // Align to 64 bits. - const p = this.free; - this.free += size; - if (bytes) { - this.addData(p, bytes); - } - return p; - } - - allocString(s) { - const encoder = new globalThis.TextEncoder(); - const uint8array = encoder.encode(s); - return this.alloc([...uint8array, 0]); - } - - _setSignatures() { - this.signatures = []; - const signatureIdxByName = {}; - if (this.functionsTable.length>0) { - const signature = this.functions[this.functionsTable[0]].getSignature(); - const signatureName = "s_"+utils.toHexString(signature); - signatureIdxByName[signatureName] = 0; - this.signatures.push(signature); - } - for (let i=0; i acc + curr.length, 0); + } + const output = (0,_alloc_js__WEBPACK_IMPORTED_MODULE_0__/* .allocUnsafe */ .K)(length); + let offset = 0; + for (const arr of arrays) { + output.set(arr, offset); + offset += arr.length; + } + return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__/* .asUint8Array */ .o)(output); } -module.exports = ModuleBuilder; - - /***/ }), -/***/ 8269: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 8402: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ equals: () => (/* binding */ equals) +/* harmony export */ }); +function equals(a, b) { + if (a === b) { + return true; + } + if (a.byteLength !== b.byteLength) { + return false; + } + for (let i = 0; i < a.byteLength; i++) { + if (a[i] !== b[i]) { + return false; + } + } + return true; +} + +/***/ }), + +/***/ 4117: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ fromString: () => (/* binding */ fromString) +/* harmony export */ }); +/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(40); +/* harmony import */ var _util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5930); + + +function fromString(string, encoding = 'utf8') { + const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A[encoding]; + if (!base) { + throw new Error(`Unsupported encoding "${ encoding }"`); + } + if ((encoding === 'utf8' || encoding === 'utf-8') && globalThis.Buffer != null && globalThis.Buffer.from != null) { + return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__/* .asUint8Array */ .o)(globalThis.Buffer.from(string, 'utf-8')); + } + return base.decoder.decode(`${ base.prefix }${ string }`); +} + +/***/ }), + +/***/ 7302: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ toString: () => (/* binding */ toString) +/* harmony export */ }); +/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(40); + +function toString(array, encoding = 'utf8') { + const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A[encoding]; + if (!base) { + throw new Error(`Unsupported encoding "${ encoding }"`); + } + if ((encoding === 'utf8' || encoding === 'utf-8') && globalThis.Buffer != null && globalThis.Buffer.from != null) { + return globalThis.Buffer.from(array.buffer, array.byteOffset, array.byteLength).toString('utf8'); + } + return base.encoder.encode(array).substring(1); +} + +/***/ }), + +/***/ 5930: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ o: () => (/* binding */ asUint8Array) +/* harmony export */ }); +function asUint8Array(buf) { + if (globalThis.Buffer != null) { + return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength); + } + return buf; +} + +/***/ }), + +/***/ 40: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; + +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + A: () => (/* binding */ util_bases) +}); + +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/bases/identity.js +var identity_namespaceObject = {}; +__webpack_require__.r(identity_namespaceObject); +__webpack_require__.d(identity_namespaceObject, { + identity: () => (identity) +}); + +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/bases/base2.js +var base2_namespaceObject = {}; +__webpack_require__.r(base2_namespaceObject); +__webpack_require__.d(base2_namespaceObject, { + base2: () => (base2) +}); + +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/bases/base8.js +var base8_namespaceObject = {}; +__webpack_require__.r(base8_namespaceObject); +__webpack_require__.d(base8_namespaceObject, { + base8: () => (base8) +}); + +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/bases/base10.js +var base10_namespaceObject = {}; +__webpack_require__.r(base10_namespaceObject); +__webpack_require__.d(base10_namespaceObject, { + base10: () => (base10) +}); + +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/bases/base16.js +var base16_namespaceObject = {}; +__webpack_require__.r(base16_namespaceObject); +__webpack_require__.d(base16_namespaceObject, { + base16: () => (base16), + base16upper: () => (base16upper) +}); + +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/bases/base32.js +var base32_namespaceObject = {}; +__webpack_require__.r(base32_namespaceObject); +__webpack_require__.d(base32_namespaceObject, { + base32: () => (base32), + base32hex: () => (base32hex), + base32hexpad: () => (base32hexpad), + base32hexpadupper: () => (base32hexpadupper), + base32hexupper: () => (base32hexupper), + base32pad: () => (base32pad), + base32padupper: () => (base32padupper), + base32upper: () => (base32upper), + base32z: () => (base32z) +}); + +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/bases/base36.js +var base36_namespaceObject = {}; +__webpack_require__.r(base36_namespaceObject); +__webpack_require__.d(base36_namespaceObject, { + base36: () => (base36), + base36upper: () => (base36upper) +}); + +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/bases/base58.js +var base58_namespaceObject = {}; +__webpack_require__.r(base58_namespaceObject); +__webpack_require__.d(base58_namespaceObject, { + base58btc: () => (base58btc), + base58flickr: () => (base58flickr) +}); + +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/bases/base64.js +var base64_namespaceObject = {}; +__webpack_require__.r(base64_namespaceObject); +__webpack_require__.d(base64_namespaceObject, { + base64: () => (base64), + base64pad: () => (base64pad), + base64url: () => (base64url), + base64urlpad: () => (base64urlpad) +}); + +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/bases/base256emoji.js +var base256emoji_namespaceObject = {}; +__webpack_require__.r(base256emoji_namespaceObject); +__webpack_require__.d(base256emoji_namespaceObject, { + base256emoji: () => (base256emoji) +}); + +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/hashes/sha2-browser.js +var sha2_browser_namespaceObject = {}; +__webpack_require__.r(sha2_browser_namespaceObject); +__webpack_require__.d(sha2_browser_namespaceObject, { + sha256: () => (sha256), + sha512: () => (sha512) +}); + +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/hashes/identity.js +var hashes_identity_namespaceObject = {}; +__webpack_require__.r(hashes_identity_namespaceObject); +__webpack_require__.d(hashes_identity_namespaceObject, { + identity: () => (identity_identity) +}); + +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/codecs/raw.js +var raw_namespaceObject = {}; +__webpack_require__.r(raw_namespaceObject); +__webpack_require__.d(raw_namespaceObject, { + code: () => (raw_code), + decode: () => (raw_decode), + encode: () => (raw_encode), + name: () => (raw_name) +}); + +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/codecs/json.js +var json_namespaceObject = {}; +__webpack_require__.r(json_namespaceObject); +__webpack_require__.d(json_namespaceObject, { + code: () => (json_code), + decode: () => (json_decode), + encode: () => (json_encode), + name: () => (json_name) +}); + +;// ./node_modules/multiformats/esm/vendor/base-x.js +function base(ALPHABET, name) { + if (ALPHABET.length >= 255) { + throw new TypeError('Alphabet too long'); + } + var BASE_MAP = new Uint8Array(256); + for (var j = 0; j < BASE_MAP.length; j++) { + BASE_MAP[j] = 255; + } + for (var i = 0; i < ALPHABET.length; i++) { + var x = ALPHABET.charAt(i); + var xc = x.charCodeAt(0); + if (BASE_MAP[xc] !== 255) { + throw new TypeError(x + ' is ambiguous'); + } + BASE_MAP[xc] = i; + } + var BASE = ALPHABET.length; + var LEADER = ALPHABET.charAt(0); + var FACTOR = Math.log(BASE) / Math.log(256); + var iFACTOR = Math.log(256) / Math.log(BASE); + function encode(source) { + if (source instanceof Uint8Array); + else if (ArrayBuffer.isView(source)) { + source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength); + } else if (Array.isArray(source)) { + source = Uint8Array.from(source); + } + if (!(source instanceof Uint8Array)) { + throw new TypeError('Expected Uint8Array'); + } + if (source.length === 0) { + return ''; + } + var zeroes = 0; + var length = 0; + var pbegin = 0; + var pend = source.length; + while (pbegin !== pend && source[pbegin] === 0) { + pbegin++; + zeroes++; + } + var size = (pend - pbegin) * iFACTOR + 1 >>> 0; + var b58 = new Uint8Array(size); + while (pbegin !== pend) { + var carry = source[pbegin]; + var i = 0; + for (var it1 = size - 1; (carry !== 0 || i < length) && it1 !== -1; it1--, i++) { + carry += 256 * b58[it1] >>> 0; + b58[it1] = carry % BASE >>> 0; + carry = carry / BASE >>> 0; + } + if (carry !== 0) { + throw new Error('Non-zero carry'); + } + length = i; + pbegin++; + } + var it2 = size - length; + while (it2 !== size && b58[it2] === 0) { + it2++; + } + var str = LEADER.repeat(zeroes); + for (; it2 < size; ++it2) { + str += ALPHABET.charAt(b58[it2]); + } + return str; + } + function decodeUnsafe(source) { + if (typeof source !== 'string') { + throw new TypeError('Expected String'); + } + if (source.length === 0) { + return new Uint8Array(); + } + var psz = 0; + if (source[psz] === ' ') { + return; + } + var zeroes = 0; + var length = 0; + while (source[psz] === LEADER) { + zeroes++; + psz++; + } + var size = (source.length - psz) * FACTOR + 1 >>> 0; + var b256 = new Uint8Array(size); + while (source[psz]) { + var carry = BASE_MAP[source.charCodeAt(psz)]; + if (carry === 255) { + return; + } + var i = 0; + for (var it3 = size - 1; (carry !== 0 || i < length) && it3 !== -1; it3--, i++) { + carry += BASE * b256[it3] >>> 0; + b256[it3] = carry % 256 >>> 0; + carry = carry / 256 >>> 0; + } + if (carry !== 0) { + throw new Error('Non-zero carry'); + } + length = i; + psz++; + } + if (source[psz] === ' ') { + return; + } + var it4 = size - length; + while (it4 !== size && b256[it4] === 0) { + it4++; + } + var vch = new Uint8Array(zeroes + (size - it4)); + var j = zeroes; + while (it4 !== size) { + vch[j++] = b256[it4++]; + } + return vch; + } + function decode(string) { + var buffer = decodeUnsafe(string); + if (buffer) { + return buffer; + } + throw new Error(`Non-${ name } character`); + } + return { + encode: encode, + decodeUnsafe: decodeUnsafe, + decode: decode + }; +} +var src = base; +var _brrp__multiformats_scope_baseX = src; +/* harmony default export */ const base_x = (_brrp__multiformats_scope_baseX); +;// ./node_modules/multiformats/esm/src/bytes.js +const empty = new Uint8Array(0); +const toHex = d => d.reduce((hex, byte) => hex + byte.toString(16).padStart(2, '0'), ''); +const fromHex = hex => { + const hexes = hex.match(/../g); + return hexes ? new Uint8Array(hexes.map(b => parseInt(b, 16))) : empty; +}; +const equals = (aa, bb) => { + if (aa === bb) + return true; + if (aa.byteLength !== bb.byteLength) { + return false; + } + for (let ii = 0; ii < aa.byteLength; ii++) { + if (aa[ii] !== bb[ii]) { + return false; + } + } + return true; +}; +const coerce = o => { + if (o instanceof Uint8Array && o.constructor.name === 'Uint8Array') + return o; + if (o instanceof ArrayBuffer) + return new Uint8Array(o); + if (ArrayBuffer.isView(o)) { + return new Uint8Array(o.buffer, o.byteOffset, o.byteLength); + } + throw new Error('Unknown type, must be binary type'); +}; +const isBinary = o => o instanceof ArrayBuffer || ArrayBuffer.isView(o); +const fromString = str => new TextEncoder().encode(str); +const bytes_toString = b => new TextDecoder().decode(b); + +;// ./node_modules/multiformats/esm/src/bases/base.js + + +class Encoder { + constructor(name, prefix, baseEncode) { + this.name = name; + this.prefix = prefix; + this.baseEncode = baseEncode; + } + encode(bytes) { + if (bytes instanceof Uint8Array) { + return `${ this.prefix }${ this.baseEncode(bytes) }`; + } else { + throw Error('Unknown type, must be binary type'); + } + } +} +class Decoder { + constructor(name, prefix, baseDecode) { + this.name = name; + this.prefix = prefix; + if (prefix.codePointAt(0) === undefined) { + throw new Error('Invalid prefix character'); + } + this.prefixCodePoint = prefix.codePointAt(0); + this.baseDecode = baseDecode; + } + decode(text) { + if (typeof text === 'string') { + if (text.codePointAt(0) !== this.prefixCodePoint) { + throw Error(`Unable to decode multibase string ${ JSON.stringify(text) }, ${ this.name } decoder only supports inputs prefixed with ${ this.prefix }`); + } + return this.baseDecode(text.slice(this.prefix.length)); + } else { + throw Error('Can only multibase decode strings'); + } + } + or(decoder) { + return or(this, decoder); + } +} +class ComposedDecoder { + constructor(decoders) { + this.decoders = decoders; + } + or(decoder) { + return or(this, decoder); + } + decode(input) { + const prefix = input[0]; + const decoder = this.decoders[prefix]; + if (decoder) { + return decoder.decode(input); + } else { + throw RangeError(`Unable to decode multibase string ${ JSON.stringify(input) }, only inputs prefixed with ${ Object.keys(this.decoders) } are supported`); + } + } +} +const or = (left, right) => new ComposedDecoder({ + ...left.decoders || { [left.prefix]: left }, + ...right.decoders || { [right.prefix]: right } +}); +class Codec { + constructor(name, prefix, baseEncode, baseDecode) { + this.name = name; + this.prefix = prefix; + this.baseEncode = baseEncode; + this.baseDecode = baseDecode; + this.encoder = new Encoder(name, prefix, baseEncode); + this.decoder = new Decoder(name, prefix, baseDecode); + } + encode(input) { + return this.encoder.encode(input); + } + decode(input) { + return this.decoder.decode(input); + } +} +const from = ({name, prefix, encode, decode}) => new Codec(name, prefix, encode, decode); +const baseX = ({prefix, name, alphabet}) => { + const {encode, decode} = base_x(alphabet, name); + return from({ + prefix, + name, + encode, + decode: text => coerce(decode(text)) + }); +}; +const decode = (string, alphabet, bitsPerChar, name) => { + const codes = {}; + for (let i = 0; i < alphabet.length; ++i) { + codes[alphabet[i]] = i; + } + let end = string.length; + while (string[end - 1] === '=') { + --end; + } + const out = new Uint8Array(end * bitsPerChar / 8 | 0); + let bits = 0; + let buffer = 0; + let written = 0; + for (let i = 0; i < end; ++i) { + const value = codes[string[i]]; + if (value === undefined) { + throw new SyntaxError(`Non-${ name } character`); + } + buffer = buffer << bitsPerChar | value; + bits += bitsPerChar; + if (bits >= 8) { + bits -= 8; + out[written++] = 255 & buffer >> bits; + } + } + if (bits >= bitsPerChar || 255 & buffer << 8 - bits) { + throw new SyntaxError('Unexpected end of data'); + } + return out; +}; +const encode = (data, alphabet, bitsPerChar) => { + const pad = alphabet[alphabet.length - 1] === '='; + const mask = (1 << bitsPerChar) - 1; + let out = ''; + let bits = 0; + let buffer = 0; + for (let i = 0; i < data.length; ++i) { + buffer = buffer << 8 | data[i]; + bits += 8; + while (bits > bitsPerChar) { + bits -= bitsPerChar; + out += alphabet[mask & buffer >> bits]; + } + } + if (bits) { + out += alphabet[mask & buffer << bitsPerChar - bits]; + } + if (pad) { + while (out.length * bitsPerChar & 7) { + out += '='; + } + } + return out; +}; +const rfc4648 = ({name, prefix, bitsPerChar, alphabet}) => { + return from({ + prefix, + name, + encode(input) { + return encode(input, alphabet, bitsPerChar); + }, + decode(input) { + return decode(input, alphabet, bitsPerChar, name); + } + }); +}; +;// ./node_modules/multiformats/esm/src/bases/identity.js + + +const identity = from({ + prefix: '\0', + name: 'identity', + encode: buf => bytes_toString(buf), + decode: str => fromString(str) +}); +;// ./node_modules/multiformats/esm/src/bases/base2.js + +const base2 = rfc4648({ + prefix: '0', + name: 'base2', + alphabet: '01', + bitsPerChar: 1 +}); +;// ./node_modules/multiformats/esm/src/bases/base8.js + +const base8 = rfc4648({ + prefix: '7', + name: 'base8', + alphabet: '01234567', + bitsPerChar: 3 +}); +;// ./node_modules/multiformats/esm/src/bases/base10.js + +const base10 = baseX({ + prefix: '9', + name: 'base10', + alphabet: '0123456789' +}); +;// ./node_modules/multiformats/esm/src/bases/base16.js + +const base16 = rfc4648({ + prefix: 'f', + name: 'base16', + alphabet: '0123456789abcdef', + bitsPerChar: 4 +}); +const base16upper = rfc4648({ + prefix: 'F', + name: 'base16upper', + alphabet: '0123456789ABCDEF', + bitsPerChar: 4 +}); +;// ./node_modules/multiformats/esm/src/bases/base32.js + +const base32 = rfc4648({ + prefix: 'b', + name: 'base32', + alphabet: 'abcdefghijklmnopqrstuvwxyz234567', + bitsPerChar: 5 +}); +const base32upper = rfc4648({ + prefix: 'B', + name: 'base32upper', + alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567', + bitsPerChar: 5 +}); +const base32pad = rfc4648({ + prefix: 'c', + name: 'base32pad', + alphabet: 'abcdefghijklmnopqrstuvwxyz234567=', + bitsPerChar: 5 +}); +const base32padupper = rfc4648({ + prefix: 'C', + name: 'base32padupper', + alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=', + bitsPerChar: 5 +}); +const base32hex = rfc4648({ + prefix: 'v', + name: 'base32hex', + alphabet: '0123456789abcdefghijklmnopqrstuv', + bitsPerChar: 5 +}); +const base32hexupper = rfc4648({ + prefix: 'V', + name: 'base32hexupper', + alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUV', + bitsPerChar: 5 +}); +const base32hexpad = rfc4648({ + prefix: 't', + name: 'base32hexpad', + alphabet: '0123456789abcdefghijklmnopqrstuv=', + bitsPerChar: 5 +}); +const base32hexpadupper = rfc4648({ + prefix: 'T', + name: 'base32hexpadupper', + alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUV=', + bitsPerChar: 5 +}); +const base32z = rfc4648({ + prefix: 'h', + name: 'base32z', + alphabet: 'ybndrfg8ejkmcpqxot1uwisza345h769', + bitsPerChar: 5 +}); +;// ./node_modules/multiformats/esm/src/bases/base36.js + +const base36 = baseX({ + prefix: 'k', + name: 'base36', + alphabet: '0123456789abcdefghijklmnopqrstuvwxyz' +}); +const base36upper = baseX({ + prefix: 'K', + name: 'base36upper', + alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' +}); +;// ./node_modules/multiformats/esm/src/bases/base58.js + +const base58btc = baseX({ + name: 'base58btc', + prefix: 'z', + alphabet: '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' +}); +const base58flickr = baseX({ + name: 'base58flickr', + prefix: 'Z', + alphabet: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ' +}); +;// ./node_modules/multiformats/esm/src/bases/base64.js + +const base64 = rfc4648({ + prefix: 'm', + name: 'base64', + alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', + bitsPerChar: 6 +}); +const base64pad = rfc4648({ + prefix: 'M', + name: 'base64pad', + alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=', + bitsPerChar: 6 +}); +const base64url = rfc4648({ + prefix: 'u', + name: 'base64url', + alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_', + bitsPerChar: 6 +}); +const base64urlpad = rfc4648({ + prefix: 'U', + name: 'base64urlpad', + alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=', + bitsPerChar: 6 +}); +;// ./node_modules/multiformats/esm/src/bases/base256emoji.js + +const alphabet = Array.from('\uD83D\uDE80\uD83E\uDE90\u2604\uD83D\uDEF0\uD83C\uDF0C\uD83C\uDF11\uD83C\uDF12\uD83C\uDF13\uD83C\uDF14\uD83C\uDF15\uD83C\uDF16\uD83C\uDF17\uD83C\uDF18\uD83C\uDF0D\uD83C\uDF0F\uD83C\uDF0E\uD83D\uDC09\u2600\uD83D\uDCBB\uD83D\uDDA5\uD83D\uDCBE\uD83D\uDCBF\uD83D\uDE02\u2764\uD83D\uDE0D\uD83E\uDD23\uD83D\uDE0A\uD83D\uDE4F\uD83D\uDC95\uD83D\uDE2D\uD83D\uDE18\uD83D\uDC4D\uD83D\uDE05\uD83D\uDC4F\uD83D\uDE01\uD83D\uDD25\uD83E\uDD70\uD83D\uDC94\uD83D\uDC96\uD83D\uDC99\uD83D\uDE22\uD83E\uDD14\uD83D\uDE06\uD83D\uDE44\uD83D\uDCAA\uD83D\uDE09\u263A\uD83D\uDC4C\uD83E\uDD17\uD83D\uDC9C\uD83D\uDE14\uD83D\uDE0E\uD83D\uDE07\uD83C\uDF39\uD83E\uDD26\uD83C\uDF89\uD83D\uDC9E\u270C\u2728\uD83E\uDD37\uD83D\uDE31\uD83D\uDE0C\uD83C\uDF38\uD83D\uDE4C\uD83D\uDE0B\uD83D\uDC97\uD83D\uDC9A\uD83D\uDE0F\uD83D\uDC9B\uD83D\uDE42\uD83D\uDC93\uD83E\uDD29\uD83D\uDE04\uD83D\uDE00\uD83D\uDDA4\uD83D\uDE03\uD83D\uDCAF\uD83D\uDE48\uD83D\uDC47\uD83C\uDFB6\uD83D\uDE12\uD83E\uDD2D\u2763\uD83D\uDE1C\uD83D\uDC8B\uD83D\uDC40\uD83D\uDE2A\uD83D\uDE11\uD83D\uDCA5\uD83D\uDE4B\uD83D\uDE1E\uD83D\uDE29\uD83D\uDE21\uD83E\uDD2A\uD83D\uDC4A\uD83E\uDD73\uD83D\uDE25\uD83E\uDD24\uD83D\uDC49\uD83D\uDC83\uD83D\uDE33\u270B\uD83D\uDE1A\uD83D\uDE1D\uD83D\uDE34\uD83C\uDF1F\uD83D\uDE2C\uD83D\uDE43\uD83C\uDF40\uD83C\uDF37\uD83D\uDE3B\uD83D\uDE13\u2B50\u2705\uD83E\uDD7A\uD83C\uDF08\uD83D\uDE08\uD83E\uDD18\uD83D\uDCA6\u2714\uD83D\uDE23\uD83C\uDFC3\uD83D\uDC90\u2639\uD83C\uDF8A\uD83D\uDC98\uD83D\uDE20\u261D\uD83D\uDE15\uD83C\uDF3A\uD83C\uDF82\uD83C\uDF3B\uD83D\uDE10\uD83D\uDD95\uD83D\uDC9D\uD83D\uDE4A\uD83D\uDE39\uD83D\uDDE3\uD83D\uDCAB\uD83D\uDC80\uD83D\uDC51\uD83C\uDFB5\uD83E\uDD1E\uD83D\uDE1B\uD83D\uDD34\uD83D\uDE24\uD83C\uDF3C\uD83D\uDE2B\u26BD\uD83E\uDD19\u2615\uD83C\uDFC6\uD83E\uDD2B\uD83D\uDC48\uD83D\uDE2E\uD83D\uDE46\uD83C\uDF7B\uD83C\uDF43\uD83D\uDC36\uD83D\uDC81\uD83D\uDE32\uD83C\uDF3F\uD83E\uDDE1\uD83C\uDF81\u26A1\uD83C\uDF1E\uD83C\uDF88\u274C\u270A\uD83D\uDC4B\uD83D\uDE30\uD83E\uDD28\uD83D\uDE36\uD83E\uDD1D\uD83D\uDEB6\uD83D\uDCB0\uD83C\uDF53\uD83D\uDCA2\uD83E\uDD1F\uD83D\uDE41\uD83D\uDEA8\uD83D\uDCA8\uD83E\uDD2C\u2708\uD83C\uDF80\uD83C\uDF7A\uD83E\uDD13\uD83D\uDE19\uD83D\uDC9F\uD83C\uDF31\uD83D\uDE16\uD83D\uDC76\uD83E\uDD74\u25B6\u27A1\u2753\uD83D\uDC8E\uD83D\uDCB8\u2B07\uD83D\uDE28\uD83C\uDF1A\uD83E\uDD8B\uD83D\uDE37\uD83D\uDD7A\u26A0\uD83D\uDE45\uD83D\uDE1F\uD83D\uDE35\uD83D\uDC4E\uD83E\uDD32\uD83E\uDD20\uD83E\uDD27\uD83D\uDCCC\uD83D\uDD35\uD83D\uDC85\uD83E\uDDD0\uD83D\uDC3E\uD83C\uDF52\uD83D\uDE17\uD83E\uDD11\uD83C\uDF0A\uD83E\uDD2F\uD83D\uDC37\u260E\uD83D\uDCA7\uD83D\uDE2F\uD83D\uDC86\uD83D\uDC46\uD83C\uDFA4\uD83D\uDE47\uD83C\uDF51\u2744\uD83C\uDF34\uD83D\uDCA3\uD83D\uDC38\uD83D\uDC8C\uD83D\uDCCD\uD83E\uDD40\uD83E\uDD22\uD83D\uDC45\uD83D\uDCA1\uD83D\uDCA9\uD83D\uDC50\uD83D\uDCF8\uD83D\uDC7B\uD83E\uDD10\uD83E\uDD2E\uD83C\uDFBC\uD83E\uDD75\uD83D\uDEA9\uD83C\uDF4E\uD83C\uDF4A\uD83D\uDC7C\uD83D\uDC8D\uD83D\uDCE3\uD83E\uDD42'); +const alphabetBytesToChars = alphabet.reduce((p, c, i) => { + p[i] = c; + return p; +}, []); +const alphabetCharsToBytes = alphabet.reduce((p, c, i) => { + p[c.codePointAt(0)] = i; + return p; +}, []); +function base256emoji_encode(data) { + return data.reduce((p, c) => { + p += alphabetBytesToChars[c]; + return p; + }, ''); +} +function base256emoji_decode(str) { + const byts = []; + for (const char of str) { + const byt = alphabetCharsToBytes[char.codePointAt(0)]; + if (byt === undefined) { + throw new Error(`Non-base256emoji character: ${ char }`); + } + byts.push(byt); + } + return new Uint8Array(byts); +} +const base256emoji = from({ + prefix: '\uD83D\uDE80', + name: 'base256emoji', + encode: base256emoji_encode, + decode: base256emoji_decode +}); +;// ./node_modules/multiformats/esm/vendor/varint.js +var encode_1 = varint_encode; +var MSB = 128, REST = 127, MSBALL = ~REST, INT = Math.pow(2, 31); +function varint_encode(num, out, offset) { + out = out || []; + offset = offset || 0; + var oldOffset = offset; + while (num >= INT) { + out[offset++] = num & 255 | MSB; + num /= 128; + } + while (num & MSBALL) { + out[offset++] = num & 255 | MSB; + num >>>= 7; + } + out[offset] = num | 0; + varint_encode.bytes = offset - oldOffset + 1; + return out; +} +var varint_decode = read; +var MSB$1 = 128, REST$1 = 127; +function read(buf, offset) { + var res = 0, offset = offset || 0, shift = 0, counter = offset, b, l = buf.length; + do { + if (counter >= l) { + read.bytes = 0; + throw new RangeError('Could not decode varint'); + } + b = buf[counter++]; + res += shift < 28 ? (b & REST$1) << shift : (b & REST$1) * Math.pow(2, shift); + shift += 7; + } while (b >= MSB$1); + read.bytes = counter - offset; + return res; +} +var N1 = Math.pow(2, 7); +var N2 = Math.pow(2, 14); +var N3 = Math.pow(2, 21); +var N4 = Math.pow(2, 28); +var N5 = Math.pow(2, 35); +var N6 = Math.pow(2, 42); +var N7 = Math.pow(2, 49); +var N8 = Math.pow(2, 56); +var N9 = Math.pow(2, 63); +var varint_length = function (value) { + return value < N1 ? 1 : value < N2 ? 2 : value < N3 ? 3 : value < N4 ? 4 : value < N5 ? 5 : value < N6 ? 6 : value < N7 ? 7 : value < N8 ? 8 : value < N9 ? 9 : 10; +}; +var varint = { + encode: encode_1, + decode: varint_decode, + encodingLength: varint_length +}; +var _brrp_varint = varint; +/* harmony default export */ const vendor_varint = (_brrp_varint); +;// ./node_modules/multiformats/esm/src/varint.js + +const src_varint_decode = (data, offset = 0) => { + const code = vendor_varint.decode(data, offset); + return [ + code, + vendor_varint.decode.bytes + ]; +}; +const encodeTo = (int, target, offset = 0) => { + vendor_varint.encode(int, target, offset); + return target; +}; +const encodingLength = int => { + return vendor_varint.encodingLength(int); +}; +;// ./node_modules/multiformats/esm/src/hashes/digest.js + + +const create = (code, digest) => { + const size = digest.byteLength; + const sizeOffset = encodingLength(code); + const digestOffset = sizeOffset + encodingLength(size); + const bytes = new Uint8Array(digestOffset + size); + encodeTo(code, bytes, 0); + encodeTo(size, bytes, sizeOffset); + bytes.set(digest, digestOffset); + return new Digest(code, size, digest, bytes); +}; +const digest_decode = multihash => { + const bytes = coerce(multihash); + const [code, sizeOffset] = src_varint_decode(bytes); + const [size, digestOffset] = src_varint_decode(bytes.subarray(sizeOffset)); + const digest = bytes.subarray(sizeOffset + digestOffset); + if (digest.byteLength !== size) { + throw new Error('Incorrect length'); + } + return new Digest(code, size, digest, bytes); +}; +const digest_equals = (a, b) => { + if (a === b) { + return true; + } else { + return a.code === b.code && a.size === b.size && equals(a.bytes, b.bytes); + } +}; +class Digest { + constructor(code, size, digest, bytes) { + this.code = code; + this.size = size; + this.digest = digest; + this.bytes = bytes; + } +} +;// ./node_modules/multiformats/esm/src/hashes/hasher.js + +const hasher_from = ({name, code, encode}) => new Hasher(name, code, encode); +class Hasher { + constructor(name, code, encode) { + this.name = name; + this.code = code; + this.encode = encode; + } + digest(input) { + if (input instanceof Uint8Array) { + const result = this.encode(input); + return result instanceof Uint8Array ? create(this.code, result) : result.then(digest => create(this.code, digest)); + } else { + throw Error('Unknown type, must be binary type'); + } + } +} +;// ./node_modules/multiformats/esm/src/hashes/sha2-browser.js + +const sha = name => async data => new Uint8Array(await crypto.subtle.digest(name, data)); +const sha256 = hasher_from({ + name: 'sha2-256', + code: 18, + encode: sha('SHA-256') +}); +const sha512 = hasher_from({ + name: 'sha2-512', + code: 19, + encode: sha('SHA-512') +}); +;// ./node_modules/multiformats/esm/src/hashes/identity.js + + +const code = 0; +const identity_name = 'identity'; +const identity_encode = coerce; +const digest = input => create(code, identity_encode(input)); +const identity_identity = { + code, + name: identity_name, + encode: identity_encode, + digest +}; +;// ./node_modules/multiformats/esm/src/codecs/raw.js + +const raw_name = 'raw'; +const raw_code = 85; +const raw_encode = node => coerce(node); +const raw_decode = data => coerce(data); +;// ./node_modules/multiformats/esm/src/codecs/json.js +const textEncoder = new TextEncoder(); +const textDecoder = new TextDecoder(); +const json_name = 'json'; +const json_code = 512; +const json_encode = node => textEncoder.encode(JSON.stringify(node)); +const json_decode = data => JSON.parse(textDecoder.decode(data)); +;// ./node_modules/multiformats/esm/src/cid.js + + + + + +class CID { + constructor(version, code, multihash, bytes) { + this.code = code; + this.version = version; + this.multihash = multihash; + this.bytes = bytes; + this.byteOffset = bytes.byteOffset; + this.byteLength = bytes.byteLength; + this.asCID = this; + this._baseCache = new Map(); + Object.defineProperties(this, { + byteOffset: cid_hidden, + byteLength: cid_hidden, + code: readonly, + version: readonly, + multihash: readonly, + bytes: readonly, + _baseCache: cid_hidden, + asCID: cid_hidden + }); + } + toV0() { + switch (this.version) { + case 0: { + return this; + } + default: { + const {code, multihash} = this; + if (code !== DAG_PB_CODE) { + throw new Error('Cannot convert a non dag-pb CID to CIDv0'); + } + if (multihash.code !== SHA_256_CODE) { + throw new Error('Cannot convert non sha2-256 multihash CID to CIDv0'); + } + return CID.createV0(multihash); + } + } + } + toV1() { + switch (this.version) { + case 0: { + const {code, digest} = this.multihash; + const multihash = create(code, digest); + return CID.createV1(this.code, multihash); + } + case 1: { + return this; + } + default: { + throw Error(`Can not convert CID version ${ this.version } to version 0. This is a bug please report`); + } + } + } + equals(other) { + return other && this.code === other.code && this.version === other.version && digest_equals(this.multihash, other.multihash); + } + toString(base) { + const {bytes, version, _baseCache} = this; + switch (version) { + case 0: + return toStringV0(bytes, _baseCache, base || base58btc.encoder); + default: + return toStringV1(bytes, _baseCache, base || base32.encoder); + } + } + toJSON() { + return { + code: this.code, + version: this.version, + hash: this.multihash.bytes + }; + } + get [Symbol.toStringTag]() { + return 'CID'; + } + [Symbol.for('nodejs.util.inspect.custom')]() { + return 'CID(' + this.toString() + ')'; + } + static isCID(value) { + deprecate(/^0\.0/, IS_CID_DEPRECATION); + return !!(value && (value[cidSymbol] || value.asCID === value)); + } + get toBaseEncodedString() { + throw new Error('Deprecated, use .toString()'); + } + get codec() { + throw new Error('"codec" property is deprecated, use integer "code" property instead'); + } + get buffer() { + throw new Error('Deprecated .buffer property, use .bytes to get Uint8Array instead'); + } + get multibaseName() { + throw new Error('"multibaseName" property is deprecated'); + } + get prefix() { + throw new Error('"prefix" property is deprecated'); + } + static asCID(value) { + if (value instanceof CID) { + return value; + } else if (value != null && value.asCID === value) { + const {version, code, multihash, bytes} = value; + return new CID(version, code, multihash, bytes || encodeCID(version, code, multihash.bytes)); + } else if (value != null && value[cidSymbol] === true) { + const {version, multihash, code} = value; + const digest = digest_decode(multihash); + return CID.create(version, code, digest); + } else { + return null; + } + } + static create(version, code, digest) { + if (typeof code !== 'number') { + throw new Error('String codecs are no longer supported'); + } + switch (version) { + case 0: { + if (code !== DAG_PB_CODE) { + throw new Error(`Version 0 CID must use dag-pb (code: ${ DAG_PB_CODE }) block encoding`); + } else { + return new CID(version, code, digest, digest.bytes); + } + } + case 1: { + const bytes = encodeCID(version, code, digest.bytes); + return new CID(version, code, digest, bytes); + } + default: { + throw new Error('Invalid version'); + } + } + } + static createV0(digest) { + return CID.create(0, DAG_PB_CODE, digest); + } + static createV1(code, digest) { + return CID.create(1, code, digest); + } + static decode(bytes) { + const [cid, remainder] = CID.decodeFirst(bytes); + if (remainder.length) { + throw new Error('Incorrect length'); + } + return cid; + } + static decodeFirst(bytes) { + const specs = CID.inspectBytes(bytes); + const prefixSize = specs.size - specs.multihashSize; + const multihashBytes = coerce(bytes.subarray(prefixSize, prefixSize + specs.multihashSize)); + if (multihashBytes.byteLength !== specs.multihashSize) { + throw new Error('Incorrect length'); + } + const digestBytes = multihashBytes.subarray(specs.multihashSize - specs.digestSize); + const digest = new Digest(specs.multihashCode, specs.digestSize, digestBytes, multihashBytes); + const cid = specs.version === 0 ? CID.createV0(digest) : CID.createV1(specs.codec, digest); + return [ + cid, + bytes.subarray(specs.size) + ]; + } + static inspectBytes(initialBytes) { + let offset = 0; + const next = () => { + const [i, length] = src_varint_decode(initialBytes.subarray(offset)); + offset += length; + return i; + }; + let version = next(); + let codec = DAG_PB_CODE; + if (version === 18) { + version = 0; + offset = 0; + } else if (version === 1) { + codec = next(); + } + if (version !== 0 && version !== 1) { + throw new RangeError(`Invalid CID version ${ version }`); + } + const prefixSize = offset; + const multihashCode = next(); + const digestSize = next(); + const size = offset + digestSize; + const multihashSize = size - prefixSize; + return { + version, + codec, + multihashCode, + digestSize, + multihashSize, + size + }; + } + static parse(source, base) { + const [prefix, bytes] = parseCIDtoBytes(source, base); + const cid = CID.decode(bytes); + cid._baseCache.set(prefix, source); + return cid; + } +} +const parseCIDtoBytes = (source, base) => { + switch (source[0]) { + case 'Q': { + const decoder = base || base58btc; + return [ + base58btc.prefix, + decoder.decode(`${ base58btc.prefix }${ source }`) + ]; + } + case base58btc.prefix: { + const decoder = base || base58btc; + return [ + base58btc.prefix, + decoder.decode(source) + ]; + } + case base32.prefix: { + const decoder = base || base32; + return [ + base32.prefix, + decoder.decode(source) + ]; + } + default: { + if (base == null) { + throw Error('To parse non base32 or base58btc encoded CID multibase decoder must be provided'); + } + return [ + source[0], + base.decode(source) + ]; + } + } +}; +const toStringV0 = (bytes, cache, base) => { + const {prefix} = base; + if (prefix !== base58btc.prefix) { + throw Error(`Cannot string encode V0 in ${ base.name } encoding`); + } + const cid = cache.get(prefix); + if (cid == null) { + const cid = base.encode(bytes).slice(1); + cache.set(prefix, cid); + return cid; + } else { + return cid; + } +}; +const toStringV1 = (bytes, cache, base) => { + const {prefix} = base; + const cid = cache.get(prefix); + if (cid == null) { + const cid = base.encode(bytes); + cache.set(prefix, cid); + return cid; + } else { + return cid; + } +}; +const DAG_PB_CODE = 112; +const SHA_256_CODE = 18; +const encodeCID = (version, code, multihash) => { + const codeOffset = encodingLength(version); + const hashOffset = codeOffset + encodingLength(code); + const bytes = new Uint8Array(hashOffset + multihash.byteLength); + encodeTo(version, bytes, 0); + encodeTo(code, bytes, codeOffset); + bytes.set(multihash, hashOffset); + return bytes; +}; +const cidSymbol = Symbol.for('@ipld/js-cid/CID'); +const readonly = { + writable: false, + configurable: false, + enumerable: true +}; +const cid_hidden = { + writable: false, + enumerable: false, + configurable: false +}; +const version = '0.0.0-dev'; +const deprecate = (range, message) => { + if (range.test(version)) { + console.warn(message); + } else { + throw new Error(message); + } +}; +const IS_CID_DEPRECATION = `CID.isCID(v) is deprecated and will be removed in the next major release. +Following code pattern: + +if (CID.isCID(value)) { + doSomethingWithCID(value) +} + +Is replaced with: + +const cid = CID.asCID(value) +if (cid) { + // Make sure to use cid instead of value + doSomethingWithCID(cid) +} +`; +;// ./node_modules/multiformats/esm/src/index.js + + + + + + +;// ./node_modules/multiformats/esm/src/basics.js + + + + + + + + + + + + + + + +const bases = { + ...identity_namespaceObject, + ...base2_namespaceObject, + ...base8_namespaceObject, + ...base10_namespaceObject, + ...base16_namespaceObject, + ...base32_namespaceObject, + ...base36_namespaceObject, + ...base58_namespaceObject, + ...base64_namespaceObject, + ...base256emoji_namespaceObject +}; +const hashes = { + ...sha2_browser_namespaceObject, + ...hashes_identity_namespaceObject +}; +const codecs = { + raw: raw_namespaceObject, + json: json_namespaceObject +}; + +// EXTERNAL MODULE: ./node_modules/uint8arrays/esm/src/alloc.js +var alloc = __webpack_require__(5238); +;// ./node_modules/uint8arrays/esm/src/util/bases.js + + +function createCodec(name, prefix, encode, decode) { + return { + name, + prefix, + encoder: { + name, + prefix, + encode + }, + decoder: { decode } + }; +} +const string = createCodec('utf8', 'u', buf => { + const decoder = new TextDecoder('utf8'); + return 'u' + decoder.decode(buf); +}, str => { + const encoder = new TextEncoder(); + return encoder.encode(str.substring(1)); +}); +const ascii = createCodec('ascii', 'a', buf => { + let string = 'a'; + for (let i = 0; i < buf.length; i++) { + string += String.fromCharCode(buf[i]); + } + return string; +}, str => { + str = str.substring(1); + const buf = (0,alloc/* allocUnsafe */.K)(str.length); + for (let i = 0; i < str.length; i++) { + buf[i] = str.charCodeAt(i); + } + return buf; +}); +const BASES = { + utf8: string, + 'utf-8': string, + hex: bases.base16, + latin1: ascii, + ascii: ascii, + binary: ascii, + ...bases +}; +/* harmony default export */ const util_bases = (BASES); + +/***/ }), + +/***/ 3219: +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}'); + +/***/ }), + +/***/ 2951: +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"sha224WithRSAEncryption":{"sign":"rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"RSA-SHA224":{"sign":"ecdsa/rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"sha256WithRSAEncryption":{"sign":"rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"RSA-SHA256":{"sign":"ecdsa/rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"sha384WithRSAEncryption":{"sign":"rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"RSA-SHA384":{"sign":"ecdsa/rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"sha512WithRSAEncryption":{"sign":"rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA512":{"sign":"ecdsa/rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA1":{"sign":"rsa","hash":"sha1","id":"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{"sign":"ecdsa","hash":"sha1","id":""},"sha256":{"sign":"ecdsa","hash":"sha256","id":""},"sha224":{"sign":"ecdsa","hash":"sha224","id":""},"sha384":{"sign":"ecdsa","hash":"sha384","id":""},"sha512":{"sign":"ecdsa","hash":"sha512","id":""},"DSA-SHA":{"sign":"dsa","hash":"sha1","id":""},"DSA-SHA1":{"sign":"dsa","hash":"sha1","id":""},"DSA":{"sign":"dsa","hash":"sha1","id":""},"DSA-WITH-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-WITH-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-WITH-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-WITH-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-RIPEMD160":{"sign":"dsa","hash":"rmd160","id":""},"ripemd160WithRSA":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"RSA-RIPEMD160":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"md5WithRSAEncryption":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"},"RSA-MD5":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"}}'); + +/***/ }), + +/***/ 4589: +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}'); + +/***/ }), + +/***/ 3241: +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}'); + +/***/ }), + +/***/ 1636: +/***/ ((module) => { + +"use strict"; +module.exports = {"rE":"6.5.7"}; + +/***/ }), + +/***/ 5579: +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}'); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ id: moduleId, +/******/ loaded: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/amd options */ +/******/ (() => { +/******/ __webpack_require__.amdO = {}; +/******/ })(); +/******/ +/******/ /* webpack/runtime/compat get default export */ +/******/ (() => { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = (module) => { +/******/ var getter = module && module.__esModule ? +/******/ () => (module['default']) : +/******/ () => (module); +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/global */ +/******/ (() => { +/******/ __webpack_require__.g = (function() { +/******/ if (typeof globalThis === 'object') return globalThis; +/******/ try { +/******/ return this || new Function('return this')(); +/******/ } catch (e) { +/******/ if (typeof window === 'object') return window; +/******/ } +/******/ })(); +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/node module decorator */ +/******/ (() => { +/******/ __webpack_require__.nmd = (module) => { +/******/ module.paths = []; +/******/ if (!module.children) module.children = []; +/******/ return module; +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be in strict mode. +(() => { +"use strict"; + +// EXTERNAL MODULE: worker_threads (ignored) +var worker_threads_ignored_ = __webpack_require__(7882); +var worker_threads_ignored_default = /*#__PURE__*/__webpack_require__.n(worker_threads_ignored_); +// EXTERNAL MODULE: ./node_modules/@tornado/fixed-merkle-tree/lib/index.js +var lib = __webpack_require__(1217); +;// ./node_modules/circomlibjs/node_modules/ffjavascript/build/browser.esm.js +/* global BigInt */ +const hexLen = [ 0, 1, 2, 2, 3, 3, 3, 3, 4 ,4 ,4 ,4 ,4 ,4 ,4 ,4]; + +function fromString(s, radix) { + if ((!radix)||(radix==10)) { + return BigInt(s); + } else if (radix==16) { + if (s.slice(0,2) == "0x") { + return BigInt(s); + } else { + return BigInt("0x"+s); + } + } +} + +const e = fromString; + +function fromArray(a, radix) { + let acc =BigInt(0); + radix = BigInt(radix); + for (let i=0; i> BigInt(n); +} + +const shl = shiftLeft; +const shr = shiftRight; + +function isOdd$5(a) { + return (BigInt(a) & BigInt(1)) == BigInt(1); +} + + +function naf(n) { + let E = BigInt(n); + const res = []; + while (E) { + if (E & BigInt(1)) { + const z = 2 - Number(E % BigInt(4)); + res.push( z ); + E = E - BigInt(z); + } else { + res.push( 0 ); + } + E = E >> BigInt(1); + } + return res; +} + + +function bits(n) { + let E = BigInt(n); + const res = []; + while (E) { + if (E & BigInt(1)) { + res.push(1); + } else { + res.push( 0 ); + } + E = E >> BigInt(1); + } + return res; +} + +function toNumber$1(s) { + if (s>BigInt(Number.MAX_SAFE_INTEGER )) { + throw new Error("Number too big"); + } + return Number(s); +} + +function toArray(s, radix) { + const res = []; + let rem = BigInt(s); + radix = BigInt(radix); + while (rem) { + res.unshift( Number(rem % radix)); + rem = rem / radix; + } + return res; +} + + +function add(a, b) { + return BigInt(a) + BigInt(b); +} + +function sub(a, b) { + return BigInt(a) - BigInt(b); +} + +function neg(a) { + return -BigInt(a); +} + +function mul(a, b) { + return BigInt(a) * BigInt(b); +} + +function square$2(a) { + return BigInt(a) * BigInt(a); +} + +function pow(a, b) { + return BigInt(a) ** BigInt(b); +} + +function exp$1(a, b) { + return BigInt(a) ** BigInt(b); +} + +function abs$1(a) { + return BigInt(a) >= 0 ? BigInt(a) : -BigInt(a); +} + +function div(a, b) { + return BigInt(a) / BigInt(b); +} + +function mod(a, b) { + return BigInt(a) % BigInt(b); +} + +function eq(a, b) { + return BigInt(a) == BigInt(b); +} + +function neq(a, b) { + return BigInt(a) != BigInt(b); +} + +function lt(a, b) { + return BigInt(a) < BigInt(b); +} + +function gt(a, b) { + return BigInt(a) > BigInt(b); +} + +function leq(a, b) { + return BigInt(a) <= BigInt(b); +} + +function geq(a, b) { + return BigInt(a) >= BigInt(b); +} + +function band(a, b) { + return BigInt(a) & BigInt(b); +} + +function bor(a, b) { + return BigInt(a) | BigInt(b); +} + +function bxor(a, b) { + return BigInt(a) ^ BigInt(b); +} + +function land(a, b) { + return BigInt(a) && BigInt(b); +} + +function lor(a, b) { + return BigInt(a) || BigInt(b); +} + +function lnot(a) { + return !BigInt(a); +} + +// Returns a buffer with Little Endian Representation +function toRprLE(buff, o, e, n8) { + const s = "0000000" + e.toString(16); + const v = new Uint32Array(buff.buffer, buff.byteOffset + o, n8/4); + const l = (((s.length-7)*4 - 1) >> 5)+1; // Number of 32bit words; + for (let i=0; i> 5)+1; // Number of 32bit words; + for (let i=0; i a[a.length-i-1] = ch.toString(16).padStart(8,"0") ); + return fromString(a.join(""), 16); +} + +// Pases a buffer with Big Endian Representation +function fromRprBE(buff, o, n8) { + n8 = n8 || buff.byteLength; + o = o || 0; + const v = new DataView(buff.buffer, buff.byteOffset + o, n8); + const a = new Array(n8/4); + for (let i=0; i. + You should have received a copy of the GNU General Public License along with + snarkjs. If not, see . */ +/* + This library does operations on polynomials with coefficients in a field F. -const FunctionBuilderWat = __webpack_require__(2341); -const utils = __webpack_require__(484); + A polynomial P(x) = p0 + p1 * x + p2 * x^2 + ... + pn * x^n is represented + by the array [ p0, p1, p2, ... , pn ]. + */ -class ModuleBuilderWat { +class PolField { + constructor (F) { + this.F = F; - constructor() { - this.functions = []; - this.functionIdxByName = {}; - this.nImportFunctions = 0; - this.nInternalFunctions =0; - this.memory = { - pagesSize: 1, - moduleName: "env", - fieldName: "memory" - }; - this.free = 8; - this.datas = []; - this.modules = {}; - this.exports = []; - this.functionsTable = []; - } + let rem = F.sqrt_t; + let s = F.sqrt_s; - build() { - const src = []; - this._setSignatures(); - src.push(this._buildType()); - src.push(this._buildImport()); - if (this.functionsTable.length>0) { - src.push(this._buildFunctionsTable()); + const five = this.F.add(this.F.add(this.F.two, this.F.two), this.F.one); + + this.w = new Array(s+1); + this.wi = new Array(s+1); + this.w[s] = this.F.pow(five, rem); + this.wi[s] = this.F.inv(this.w[s]); + + let n=s-1; + while (n>=0) { + this.w[n] = this.F.square(this.w[n+1]); + this.wi[n] = this.F.square(this.wi[n+1]); + n--; } - if (this.exports.length > 0) { - src.push(this._buildExports()); - } - if (this.functionsTable.length>0) { - src.push(this._buildElements()); - } - if (this.nInternalFunctions>0) { - src.push(this._buildFunctions()); - } - src.push(this._buildData()); - return [ - "(module", - utils.ident(src), - ")" - ]; - } - addFunction(fnName, comment) { - if (typeof(this.functionIdxByName[fnName]) !== "undefined") - throw new Error(`Function already defined: ${fnName}`); - const idx = this.functions.length; - this.functionIdxByName[fnName] = idx; - - this.functions.push(new FunctionBuilderWat(this, fnName, "internal", comment)); - - this.nInternalFunctions++; - return this.functions[idx]; - } - - addIimportFunction(fnName, moduleName, _fieldName) { - if (typeof(this.functionIdxByName[fnName]) !== "undefined") - throw new Error(`Function already defined: ${fnName}`); - - if ( (this.functions.length>0) - &&(this.functions[this.functions.length-1].type == "internal")) - throw new Error(`Import functions must be declared before internal: ${fnName}`); - - let fieldName = _fieldName || fnName; - - const idx = this.functions.length; - this.functionIdxByName[fnName] = idx; - - this.functions.push(new FunctionBuilderWat(this, fnName, "import", moduleName, fieldName)); - - this.nImportFunctions ++; - return this.functions[idx]; - } - - setMemory(pagesSize, moduleName, fieldName) { - this.memory = { - pagesSize: pagesSize, - moduleName: moduleName || "env", - fieldName: fieldName || "memory" - }; - } - - exportFunction(fnName, _exportName) { - const exportName = _exportName || fnName; - if (typeof(this.functionIdxByName[fnName]) === "undefined") - throw new Error(`Function not defined: ${fnName}`); - const idx = this.functionIdxByName[fnName]; - if (exportName != fnName) { - this.functionIdxByName[exportName] = idx; - } - this.exports.push({ - exportName: exportName, - idx: idx - }); - } - - addFunctionToTable(fnName) { - const idx = this.functionIdxByName[fnName]; - this.functionsTable.push(idx); - } - - addData(offset, bytes) { - this.datas.push({ - offset: offset, - bytes: bytes - }); - } - - alloc(a, b) { - let size; - let bytes; - if ((Array.isArray(a) || ArrayBuffer.isView(a)) && (typeof(b) === "undefined")) { - size = a.length; - bytes = a; - } else { - size = a; - bytes = b; - } - size = (((size-1)>>3) +1)<<3; // Align to 64 bits. - const p = this.free; - this.free += size; - if (bytes) { - this.addData(p, bytes); - } - return p; - } - - allocString(s) { - const encoder = new TextEncoder(); - const uint8array = encoder.encode(s); - return this.alloc([...uint8array, 0]); - } - - _setSignatures() { - this.signatures = []; - const signatureIdxByName = {}; - if (this.functionsTable.length>0) { - const signature = this.functions[this.functionsTable[0]].getSignature(); - const signatureName = this.functions[this.functionsTable[0]].getSignatureName(); - signatureIdxByName[signatureName] = 0; - this.signatures.push(signature); - } - for (let i=0; i this.F.sqrt_s) n = this.s; + for (let i=n; (i>=0) && (!this.roots[i]); i--) { + let r = this.F.one; + const nroots = 1 << i; + const rootsi = new Array(nroots); + for (let j=0; j a.length) { + [b, a] = [a, b]; } - } - - _buildType() { - return this.signatures; - } - - _buildImport() { - const src = []; - src.push(`(import "${this.memory.moduleName}" "${this.memory.fieldName}" (memory ${this.memory.pagesSize}))`); - for (let i=0; i< this.nImportFunctions; i++) { - src.push(`(import "${this.functions[i].moduleName}" "${this.functions[i].fieldName}" (func $${this.functions[i].fnName} (type $${this.functions[i].getSignatureName()})))`); + if ((b.length <= 2) || (b.length < log2$2(a.length))) { + return this.mulNormal(a,b); + } else { + return this.mulFFT(a,b); } - return src; } - _buildFunctionsTable() { - return `(table ${this.functionsTable.length} anyfunc)`; - } - - _buildElements() { - let funcs=""; - for (let i=0; i0) { + const z = new Array(n).fill(this.F.zero); + return z.concat(p); + } else { + if (-n >= p.length) return []; + return p.slice(-n); } - return src; + } - function bytes2string(b) { - let S = "\""; - for (let i=0; i126 || b[i] == 34 || b[i]==92) { - let h=b[i].toString(16); - while (h.length<2) h = "0"+h; - S += "\\" + h; - } else { - S += String.fromCharCode(b[i]); + eval2(p, x) { + let v = this.F.zero; + let ix = this.F.one; + for (let i=0; i> 1), + F.mul( + x, + _eval(p, newX, offset+step , step << 1, n >> 1))); + return res; + } + } + + lagrange(points) { + let roots = [this.F.one]; + for (let i=0; i> 1; + const p1 = this._fft(pall, bits-1, offset, step*2); + const p2 = this._fft(pall, bits-1, offset+step, step*2); + + const out = new Array(n); + + let m= this.F.one; + for (let i=0; i0 && this.F.eq(p[i], this.F.zero) ) i--; + return p.slice(0, i+1); + } + + eq(a, b) { + const pa = this.reduce(a); + const pb = this.reduce(b); + + if (pa.length != pb.length) return false; + for (let i=0; i=0; i--) { + res[i] = this.F.add(this.F.mul(res[i+1], r), p[i+1]); + } + return res; + } + + _next2Power(v) { + v--; + v |= v >> 1; + v |= v >> 2; + v |= v >> 4; + v |= v >> 8; + v |= v >> 16; + v++; + return v; + } + + toString(p) { + const ap = this.normalize(p); + let S = ""; + for (let i=ap.length-1; i>=0; i--) { + if (!this.F.eq(p[i], this.F.zero)) { + if (S!="") S += " + "; + S = S + p[i].toString(10); + if (i>0) { + S = S + "x"; + if (i>1) { + S = S + "^" +i; + } } } - S += "\""; - return S; + } + return S; + } + + normalize(p) { + const res = new Array(p.length); + for (let i=0; i + // rec = x^(k-2-scaleV)/ v + // + // res = x^m/v = x^(m + (2*k-2 - scaleV) - (2*k-2 - scaleV)) /v => + // res = rec * x^(m - (2*k-2 - scaleV)) => + // res = rec * x^(m - 2*k + 2 + scaleV) + + const rec = this._reciprocal(this.scaleX(v, scaleV), kbits); + const res = this.scaleX(rec, m - 2*k + 2 + scaleV); + + return res; + } + + div(_u, _v) { + if (_u.length < _v.length) return []; + const kbits = log2$2(_v.length-1)+1; + const k = 1 << kbits; + + const u = this.scaleX(_u, k-_v.length); + const v = this.scaleX(_v, k-_v.length); + + const n = v.length-1; + let m = u.length-1; + + const s = this._reciprocal(v, kbits); + let t; + if (m>2*n) { + t = this.sub(this.scaleX([this.F.one], 2*n), this.mul(s, v)); + } + + let q = []; + let rem = u; + let us, ut; + let finish = false; + + while (!finish) { + us = this.mul(rem, s); + q = this.add(q, this.scaleX(us, -2*n)); + + if ( m > 2*n ) { + ut = this.mul(rem, t); + rem = this.scaleX(ut, -2*n); + m = rem.length-1; + } else { + finish = true; + } + } + + return q; + } + + + // returns the ith nth-root of one + oneRoot(n, i) { + let nbits = log2$2(n-1)+1; + let res = this.F.one; + let r = i; + + if(i>=n) { + throw new Error("Given 'i' should be lower than 'n'"); + } + else if (1<0) { + if (r & 1 == 1) { + res = this.F.mul(res, this.w[nbits]); + } + r = r >> 1; + nbits --; + } + return res; + } + + computeVanishingPolinomial(bits, t) { + const m = 1 << bits; + return this.F.sub(this.F.pow(t, m), this.F.one); + } + + evaluateLagrangePolynomials(bits, t) { + const m= 1 << bits; + const tm = this.F.pow(t, m); + const u= new Array(m).fill(this.F.zero); + this._setRoots(bits); + const omega = this.w[bits]; + + if (this.F.eq(tm, this.F.one)) { + for (let i = 0; i < m; i++) { + if (this.F.eq(this.roots[bits][0],t)) { // i.e., t equals omega^i + u[i] = this.F.one; + return u; + } + } + } + + const z = this.F.sub(tm, this.F.one); + // let l = this.F.mul(z, this.F.pow(this.F.twoinv, m)); + let l = this.F.mul(z, this.F.inv(this.F.e(m))); + for (let i = 0; i < m; i++) { + u[i] = this.F.mul(l, this.F.inv(this.F.sub(t,this.roots[bits][i]))); + l = this.F.mul(l, omega); + } + + return u; + } + + log2(V) { + return log2$2(V); + } +} + +function log2$2( V ) +{ + return( ( ( V & 0xFFFF0000 ) !== 0 ? ( V &= 0xFFFF0000, 16 ) : 0 ) | ( ( V & 0xFF00FF00 ) !== 0 ? ( V &= 0xFF00FF00, 8 ) : 0 ) | ( ( V & 0xF0F0F0F0 ) !== 0 ? ( V &= 0xF0F0F0F0, 4 ) : 0 ) | ( ( V & 0xCCCCCCCC ) !== 0 ? ( V &= 0xCCCCCCCC, 2 ) : 0 ) | ( ( V & 0xAAAAAAAA ) !== 0 ) ); +} + + +function __fft$1(PF, pall, bits, offset, step) { + + const n = 1 << bits; + if (n==1) { + return [ pall[offset] ]; + } else if (n==2) { + return [ + PF.F.add(pall[offset], pall[offset + step]), + PF.F.sub(pall[offset], pall[offset + step])]; + } + + const ndiv2 = n >> 1; + const p1 = __fft$1(PF, pall, bits-1, offset, step*2); + const p2 = __fft$1(PF, pall, bits-1, offset+step, step*2); + + const out = new Array(n); + + for (let i=0; i> 1; + const p1 = __fft2(PF, pall.slice(0, ndiv2), bits-1); + const p2 = __fft2(PF, pall.slice(ndiv2), bits-1); + + const out = new Array(n); + + for (let i=0; i>=1; + } + return res; +} + +function rev(idx, bits) { + return ( + _revTable$1[idx >>> 24] | + (_revTable$1[(idx >>> 16) & 0xFF] << 8) | + (_revTable$1[(idx >>> 8) & 0xFF] << 16) | + (_revTable$1[idx & 0xFF] << 24) + ) >>> (32-bits); +} + +function __bitReverse(p, bits) { + for (let k=0; kk) { + const tmp= p[k]; + p[k] = p[r]; + p[r] = tmp; } } } -module.exports = ModuleBuilderWat; +/* + Copyright 2018 0kims association. + + This file is part of snarkjs. + + snarkjs is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. + + snarkjs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + snarkjs. If not, see . +*/ -/***/ }), -/***/ 7831: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +function mulScalar(F, base, e) { + let res; + + if (isZero$1(e)) return F.zero; + + const n = naf(e); + + if (n[n.length-1] == 1) { + res = base; + } else if (n[n.length-1] == -1) { + res = F.neg(base); + } else { + throw new Error("invlaud NAF"); + } + + for (let i=n.length-2; i>=0; i--) { + + res = F.double(res); + + if (n[i] == 1) { + res = F.add(res, base); + } else if (n[i] == -1) { + res = F.sub(res, base); + } + } + + return res; +} + + +/* +exports.mulScalar = (F, base, e) =>{ + let res = F.zero; + let rem = bigInt(e); + let exp = base; + + while (! rem.eq(bigInt.zero)) { + if (rem.and(bigInt.one).eq(bigInt.one)) { + res = F.add(res, exp); + } + exp = F.double(exp); + rem = rem.shiftRight(1); + } + + return res; +}; +*/ + + +function exp(F, base, e) { + + if (isZero$1(e)) return F.one; + + const n = bits(e); + + if (n.length==0) return F.one; + + let res = base; + + for (let i=n.length-2; i>=0; i--) { + + res = F.square(res); + + if (n[i]) { + res = F.mul(res, base); + } + } + + return res; +} + +// Check here: https://eprint.iacr.org/2012/685.pdf + +function buildSqrt (F) { + if ((F.m % 2) == 1) { + if (eq(mod(F.p, 4), 1 )) { + if (eq(mod(F.p, 8), 1 )) { + if (eq(mod(F.p, 16), 1 )) { + // alg7_muller(F); + alg5_tonelliShanks(F); + } else if (eq(mod(F.p, 16), 9 )) { + alg4_kong(F); + } else { + throw new Error("Field withot sqrt"); + } + } else if (eq(mod(F.p, 8), 5 )) { + alg3_atkin(F); + } else { + throw new Error("Field withot sqrt"); + } + } else if (eq(mod(F.p, 4), 3 )) { + alg2_shanks(F); + } + } else { + const pm2mod4 = mod(pow(F.p, F.m/2), 4); + if (pm2mod4 == 1) { + alg10_adj(F); + } else if (pm2mod4 == 3) { + alg9_adj(F); + } else { + alg8_complex(F); + } + + } +} + + +function alg5_tonelliShanks(F) { + F.sqrt_q = pow(F.p, F.m); + + F.sqrt_s = 0; + F.sqrt_t = sub(F.sqrt_q, 1); + + while (!isOdd$5(F.sqrt_t)) { + F.sqrt_s = F.sqrt_s + 1; + F.sqrt_t = div(F.sqrt_t, 2); + } + + let c0 = F.one; + + while (F.eq(c0, F.one)) { + const c = F.random(); + F.sqrt_z = F.pow(c, F.sqrt_t); + c0 = F.pow(F.sqrt_z, 2 ** (F.sqrt_s-1) ); + } + + F.sqrt_tm1d2 = div(sub(F.sqrt_t, 1),2); + + F.sqrt = function(a) { + const F=this; + if (F.isZero(a)) return F.zero; + let w = F.pow(a, F.sqrt_tm1d2); + const a0 = F.pow( F.mul(F.square(w), a), 2 ** (F.sqrt_s-1) ); + if (F.eq(a0, F.negone)) return null; + + let v = F.sqrt_s; + let x = F.mul(a, w); + let b = F.mul(x, w); + let z = F.sqrt_z; + while (!F.eq(b, F.one)) { + let b2k = F.square(b); + let k=1; + while (!F.eq(b2k, F.one)) { + b2k = F.square(b2k); + k++; + } + + w = z; + for (let i=0; i>> 0; + st[d] = (st[d] ^ st[a]) >>> 0; + st[d] = ((st[d] << 16) | ((st[d]>>>16) & 0xFFFF)) >>> 0; + + st[c] = (st[c] + st[d]) >>> 0; + st[b] = (st[b] ^ st[c]) >>> 0; + st[b] = ((st[b] << 12) | ((st[b]>>>20) & 0xFFF)) >>> 0; + + st[a] = (st[a] + st[b]) >>> 0; + st[d] = (st[d] ^ st[a]) >>> 0; + st[d] = ((st[d] << 8) | ((st[d]>>>24) & 0xFF)) >>> 0; + + st[c] = (st[c] + st[d]) >>> 0; + st[b] = (st[b] ^ st[c]) >>> 0; + st[b] = ((st[b] << 7) | ((st[b]>>>25) & 0x7F)) >>> 0; +} + +function doubleRound(st) { + quarterRound(st, 0, 4, 8,12); + quarterRound(st, 1, 5, 9,13); + quarterRound(st, 2, 6,10,14); + quarterRound(st, 3, 7,11,15); + + quarterRound(st, 0, 5,10,15); + quarterRound(st, 1, 6,11,12); + quarterRound(st, 2, 7, 8,13); + quarterRound(st, 3, 4, 9,14); +} + +class ChaCha { + + constructor(seed) { + seed = seed || [0,0,0,0,0,0,0,0]; + this.state = [ + 0x61707865, + 0x3320646E, + 0x79622D32, + 0x6B206574, + seed[0], + seed[1], + seed[2], + seed[3], + seed[4], + seed[5], + seed[6], + seed[7], + 0, + 0, + 0, + 0 + ]; + this.idx = 16; + this.buff = new Array(16); + } + + nextU32() { + if (this.idx == 16) this.update(); + return this.buff[this.idx++]; + } + + nextU64() { + return add(mul(this.nextU32(), 0x100000000), this.nextU32()); + } + + nextBool() { + return (this.nextU32() & 1) == 1; + } + + update() { + // Copy the state + for (let i=0; i<16; i++) this.buff[i] = this.state[i]; + + // Apply the rounds + for (let i=0; i<10; i++) doubleRound(this.buff); + + // Add to the initial + for (let i=0; i<16; i++) this.buff[i] = (this.buff[i] + this.state[i]) >>> 0; + + this.idx = 0; + + this.state[12] = (this.state[12] + 1) >>> 0; + if (this.state[12] != 0) return; + this.state[13] = (this.state[13] + 1) >>> 0; + if (this.state[13] != 0) return; + this.state[14] = (this.state[14] + 1) >>> 0; + if (this.state[14] != 0) return; + this.state[15] = (this.state[15] + 1) >>> 0; + } +} + +function getRandomBytes(n) { + let array = new Uint8Array(n); + { // Browser + if (typeof globalThis.crypto !== "undefined") { // Supported + globalThis.crypto.getRandomValues(array); + } else { // fallback + for (let i=0; i>>0; + } + } + } + return array; +} + +function getRandomSeed() { + const arr = getRandomBytes(32); + const arrV = new Uint32Array(arr.buffer); + const seed = []; + for (let i=0; i<8; i++) { + seed.push(arrV[i]); + } + return seed; +} + +let threadRng = null; + +function getThreadRng() { + if (threadRng) return threadRng; + threadRng = new ChaCha(getRandomSeed()); + return threadRng; +} + +/* + Copyright 2018 0kims association. + + This file is part of snarkjs. + + snarkjs is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. + + snarkjs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + snarkjs. If not, see . +*/ + +/* + This library does operations on polynomials with coefficients in a field F. + + A polynomial P(x) = p0 + p1 * x + p2 * x^2 + ... + pn * x^n is represented + by the array [ p0, p1, p2, ... , pn ]. + */ + +class FFT { + constructor (G, F, opMulGF) { + this.F = F; + this.G = G; + this.opMulGF = opMulGF; + + let rem = F.sqrt_t || F.t; + let s = F.sqrt_s || F.s; + + let nqr = F.one; + while (F.eq(F.pow(nqr, F.half), F.one)) nqr = F.add(nqr, F.one); + + this.w = new Array(s+1); + this.wi = new Array(s+1); + this.w[s] = this.F.pow(nqr, rem); + this.wi[s] = this.F.inv(this.w[s]); + + let n=s-1; + while (n>=0) { + this.w[n] = this.F.square(this.w[n+1]); + this.wi[n] = this.F.square(this.wi[n+1]); + n--; + } + + + this.roots = []; + /* + for (let i=0; i<16; i++) { + let r = this.F.one; + n = 1 << i; + const rootsi = new Array(n); + for (let j=0; j=0) && (!this.roots[i]); i--) { + let r = this.F.one; + const nroots = 1 << i; + const rootsi = new Array(nroots); + for (let j=0; j> 1; + const p1 = __fft(PF, pall, bits-1, offset, step*2); + const p2 = __fft(PF, pall, bits-1, offset+step, step*2); + + const out = new Array(n); + + for (let i=0; i> this.one; + this.bitLength = bitLength$6(this.p); + this.mask = (this.one << BigInt(this.bitLength)) - this.one; + + this.n64 = Math.floor((this.bitLength - 1) / 64)+1; + this.n32 = this.n64*2; + this.n8 = this.n64*8; + this.R = this.e(this.one << BigInt(this.n64*64)); + this.Ri = this.inv(this.R); + + const e = this.negone >> this.one; + this.nqr = this.two; + let r = this.pow(this.nqr, e); + while (!this.eq(r, this.negone)) { + this.nqr = this.nqr + this.one; + r = this.pow(this.nqr, e); + } + + + this.s = 0; + this.t = this.negone; + + while ((this.t & this.one) == this.zero) { + this.s = this.s + 1; + this.t = this.t >> this.one; + } + + this.nqr_to_t = this.pow(this.nqr, this.t); + + buildSqrt(this); + + this.FFT = new FFT(this, this, this.mul.bind(this)); + + this.fft = this.FFT.fft.bind(this.FFT); + this.ifft = this.FFT.ifft.bind(this.FFT); + this.w = this.FFT.w; + this.wi = this.FFT.wi; + + this.shift = this.square(this.nqr); + this.k = this.exp(this.nqr, 2**this.s); + } + + e(a,b) { + let res; + if (!b) { + res = BigInt(a); + } else if (b==16) { + res = BigInt("0x"+a); + } + if (res < 0) { + let nres = -res; + if (nres >= this.p) nres = nres % this.p; + return this.p - nres; + } else { + return (res>= this.p) ? res%this.p : res; + } + + } + + add(a, b) { + const res = a + b; + return res >= this.p ? res-this.p : res; + } + + sub(a, b) { + return (a >= b) ? a-b : this.p-b+a; + } + + neg(a) { + return a ? this.p-a : a; + } + + mul(a, b) { + return (a*b)%this.p; + } + + mulScalar(base, s) { + return (base * this.e(s)) % this.p; + } + + square(a) { + return (a*a) % this.p; + } + + eq(a, b) { + return a==b; + } + + neq(a, b) { + return a!=b; + } + + lt(a, b) { + const aa = (a > this.half) ? a - this.p : a; + const bb = (b > this.half) ? b - this.p : b; + return aa < bb; + } + + gt(a, b) { + const aa = (a > this.half) ? a - this.p : a; + const bb = (b > this.half) ? b - this.p : b; + return aa > bb; + } + + leq(a, b) { + const aa = (a > this.half) ? a - this.p : a; + const bb = (b > this.half) ? b - this.p : b; + return aa <= bb; + } + + geq(a, b) { + const aa = (a > this.half) ? a - this.p : a; + const bb = (b > this.half) ? b - this.p : b; + return aa >= bb; + } + + div(a, b) { + return this.mul(a, this.inv(b)); + } + + idiv(a, b) { + if (!b) throw new Error("Division by zero"); + return a / b; + } + + inv(a) { + if (!a) throw new Error("Division by zero"); + + let t = this.zero; + let r = this.p; + let newt = this.one; + let newr = a % this.p; + while (newr) { + let q = r/newr; + [t, newt] = [newt, t-q*newt]; + [r, newr] = [newr, r-q*newr]; + } + if (t= this.p ? res-this.p : res; + } + + bor(a, b) { + const res = ((a | b) & this.mask); + return res >= this.p ? res-this.p : res; + } + + bxor(a, b) { + const res = ((a ^ b) & this.mask); + return res >= this.p ? res-this.p : res; + } + + bnot(a) { + const res = a ^ this.mask; + return res >= this.p ? res-this.p : res; + } + + shl(a, b) { + if (Number(b) < this.bitLength) { + const res = (a << b) & this.mask; + return res >= this.p ? res-this.p : res; + } else { + const nb = this.p - b; + if (Number(nb) < this.bitLength) { + return a >> nb; + } else { + return this.zero; + } + } + } + + shr(a, b) { + if (Number(b) < this.bitLength) { + return a >> b; + } else { + const nb = this.p - b; + if (Number(nb) < this.bitLength) { + const res = (a << nb) & this.mask; + return res >= this.p ? res-this.p : res; + } else { + return 0; + } + } + } + + land(a, b) { + return (a && b) ? this.one : this.zero; + } + + lor(a, b) { + return (a || b) ? this.one : this.zero; + } + + lnot(a) { + return (a) ? this.zero : this.one; + } + + sqrt_old(n) { + + if (n == this.zero) return this.zero; + + // Test that have solution + const res = this.pow(n, this.negone >> this.one); + if ( res != this.one ) return null; + + let m = this.s; + let c = this.nqr_to_t; + let t = this.pow(n, this.t); + let r = this.pow(n, this.add(this.t, this.one) >> this.one ); + + while ( t != this.one ) { + let sq = this.square(t); + let i = 1; + while (sq != this.one ) { + i++; + sq = this.square(sq); + } + + // b = c ^ m-i-1 + let b = c; + for (let j=0; j< m-i-1; j ++) b = this.square(b); + + m = i; + c = this.square(b); + t = this.mul(t, c); + r = this.mul(r, b); + } + + if (r > (this.p >> this.one)) { + r = this.neg(r); + } + + return r; + } + + normalize(a, b) { + a = BigInt(a,b); + if (a < 0) { + let na = -a; + if (na >= this.p) na = na % this.p; + return this.p - na; + } else { + return (a>= this.p) ? a%this.p : a; + } + } + + random() { + const nBytes = (this.bitLength*2 / 8); + let res =this.zero; + for (let i=0; i this.half)&&(base == 10)) { + const v = this.p-a; + vs = "-"+v.toString(base); + } else { + vs = a.toString(base); + } + return vs; + } + + isZero(a) { + return a == this.zero; + } + + fromRng(rng) { + let v; + do { + v=this.zero; + for (let i=0; i= this.p); + v = (v * this.Ri) % this.p; // Convert from montgomery + return v; + } + + fft(a) { + return this.FFT.fft(a); + } + + ifft(a) { + return this.FFT.ifft(a); + } + + // Returns a buffer with Little Endian Representation + toRprLE(buff, o, e) { + toRprLE(buff, o, e, this.n64*8); + } + + // Returns a buffer with Big Endian Representation + toRprBE(buff, o, e) { + toRprBE(buff, o, e, this.n64*8); + } + + // Returns a buffer with Big Endian Montgomery Representation + toRprBEM(buff, o, e) { + return this.toRprBE(buff, o, this.mul(this.R, e)); + } + + toRprLEM(buff, o, e) { + return this.toRprLE(buff, o, this.mul(this.R, e)); + } + + + // Pases a buffer with Little Endian Representation + fromRprLE(buff, o) { + return fromRprLE(buff, o, this.n8); + } + + // Pases a buffer with Big Endian Representation + fromRprBE(buff, o) { + return fromRprBE(buff, o, this.n8); + } + + fromRprLEM(buff, o) { + return this.mul(this.fromRprLE(buff, o), this.Ri); + } + + fromRprBEM(buff, o) { + return this.mul(this.fromRprBE(buff, o), this.Ri); + } + + toObject(a) { + return a; + } +} + +/* + Copyright 2018 0kims association. + + This file is part of snarkjs. + + snarkjs is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. + + snarkjs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + snarkjs. If not, see . +*/ + + +class F2Field { + constructor(F, nonResidue) { + this.type="F2"; + this.F = F; + this.zero = [this.F.zero, this.F.zero]; + this.one = [this.F.one, this.F.zero]; + this.negone = this.neg(this.one); + this.nonResidue = nonResidue; + this.m = F.m*2; + this.p = F.p; + this.n64 = F.n64*2; + this.n32 = this.n64*2; + this.n8 = this.n64*8; + + buildSqrt(this); + } + + _mulByNonResidue(a) { + return this.F.mul(this.nonResidue, a); + } + + copy(a) { + return [this.F.copy(a[0]), this.F.copy(a[1])]; + } + + add(a, b) { + return [ + this.F.add(a[0], b[0]), + this.F.add(a[1], b[1]) + ]; + } + + double(a) { + return this.add(a,a); + } + + sub(a, b) { + return [ + this.F.sub(a[0], b[0]), + this.F.sub(a[1], b[1]) + ]; + } + + neg(a) { + return this.sub(this.zero, a); + } + + conjugate(a) { + return [ + a[0], + this.F.neg(a[1]) + ]; + } + + mul(a, b) { + const aA = this.F.mul(a[0] , b[0]); + const bB = this.F.mul(a[1] , b[1]); + + return [ + this.F.add( aA , this._mulByNonResidue(bB)), + this.F.sub( + this.F.mul( + this.F.add(a[0], a[1]), + this.F.add(b[0], b[1])), + this.F.add(aA, bB))]; + } + + inv(a) { + const t0 = this.F.square(a[0]); + const t1 = this.F.square(a[1]); + const t2 = this.F.sub(t0, this._mulByNonResidue(t1)); + const t3 = this.F.inv(t2); + return [ + this.F.mul(a[0], t3), + this.F.neg(this.F.mul( a[1], t3)) ]; + } + + div(a, b) { + return this.mul(a, this.inv(b)); + } + + square(a) { + const ab = this.F.mul(a[0] , a[1]); + + /* + [ + (a + b) * (a + non_residue * b) - ab - non_residue * ab, + ab + ab + ]; + */ + + return [ + this.F.sub( + this.F.mul( + this.F.add(a[0], a[1]) , + this.F.add( + a[0] , + this._mulByNonResidue(a[1]))), + this.F.add( + ab, + this._mulByNonResidue(ab))), + this.F.add(ab, ab) + ]; + } + + isZero(a) { + return this.F.isZero(a[0]) && this.F.isZero(a[1]); + } + + eq(a, b) { + return this.F.eq(a[0], b[0]) && this.F.eq(a[1], b[1]); + } + + mulScalar(base, e) { + return mulScalar(this, base, e); + } + + pow(base, e) { + return exp(this, base, e); + } + + exp(base, e) { + return exp(this, base, e); + } + + toString(a) { + return `[ ${this.F.toString(a[0])} , ${this.F.toString(a[1])} ]`; + } + + fromRng(rng) { + const c0 = this.F.fromRng(rng); + const c1 = this.F.fromRng(rng); + return [c0, c1]; + } + + gt(a, b) { + if (this.F.gt(a[0], b[0])) return true; + if (this.F.gt(b[0], a[0])) return false; + if (this.F.gt(a[1], b[1])) return true; + return false; + } + + geq(a, b) { + return this.gt(a, b) || this.eq(a, b); + } + + lt(a, b) { + return !this.geq(a,b); + } + + leq(a, b) { + return !this.gt(a,b); + } + + neq(a, b) { + return !this.eq(a,b); + } + + random() { + return [this.F.random(), this.F.random()]; + } + + + toRprLE(buff, o, e) { + this.F.toRprLE(buff, o, e[0]); + this.F.toRprLE(buff, o+this.F.n8, e[1]); + } + + toRprBE(buff, o, e) { + this.F.toRprBE(buff, o, e[1]); + this.F.toRprBE(buff, o+this.F.n8, e[0]); + } + + toRprLEM(buff, o, e) { + this.F.toRprLEM(buff, o, e[0]); + this.F.toRprLEM(buff, o+this.F.n8, e[1]); + } + + + toRprBEM(buff, o, e) { + this.F.toRprBEM(buff, o, e[1]); + this.F.toRprBEM(buff, o+this.F.n8, e[0]); + } + + fromRprLE(buff, o) { + o = o || 0; + const c0 = this.F.fromRprLE(buff, o); + const c1 = this.F.fromRprLE(buff, o+this.F.n8); + return [c0, c1]; + } + + fromRprBE(buff, o) { + o = o || 0; + const c1 = this.F.fromRprBE(buff, o); + const c0 = this.F.fromRprBE(buff, o+this.F.n8); + return [c0, c1]; + } + + fromRprLEM(buff, o) { + o = o || 0; + const c0 = this.F.fromRprLEM(buff, o); + const c1 = this.F.fromRprLEM(buff, o+this.F.n8); + return [c0, c1]; + } + + fromRprBEM(buff, o) { + o = o || 0; + const c1 = this.F.fromRprBEM(buff, o); + const c0 = this.F.fromRprBEM(buff, o+this.F.n8); + return [c0, c1]; + } + + toObject(a) { + return a; + } + +} + +/* + Copyright 2018 0kims association. + + This file is part of snarkjs. + + snarkjs is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. + + snarkjs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + snarkjs. If not, see . +*/ + + +class F3Field { + constructor(F, nonResidue) { + this.type="F3"; + this.F = F; + this.zero = [this.F.zero, this.F.zero, this.F.zero]; + this.one = [this.F.one, this.F.zero, this.F.zero]; + this.negone = this.neg(this.one); + this.nonResidue = nonResidue; + this.m = F.m*3; + this.p = F.p; + this.n64 = F.n64*3; + this.n32 = this.n64*2; + this.n8 = this.n64*8; + } + + _mulByNonResidue(a) { + return this.F.mul(this.nonResidue, a); + } + + copy(a) { + return [this.F.copy(a[0]), this.F.copy(a[1]), this.F.copy(a[2])]; + } + + add(a, b) { + return [ + this.F.add(a[0], b[0]), + this.F.add(a[1], b[1]), + this.F.add(a[2], b[2]) + ]; + } + + double(a) { + return this.add(a,a); + } + + sub(a, b) { + return [ + this.F.sub(a[0], b[0]), + this.F.sub(a[1], b[1]), + this.F.sub(a[2], b[2]) + ]; + } + + neg(a) { + return this.sub(this.zero, a); + } + + mul(a, b) { + + const aA = this.F.mul(a[0] , b[0]); + const bB = this.F.mul(a[1] , b[1]); + const cC = this.F.mul(a[2] , b[2]); + + return [ + this.F.add( + aA, + this._mulByNonResidue( + this.F.sub( + this.F.mul( + this.F.add(a[1], a[2]), + this.F.add(b[1], b[2])), + this.F.add(bB, cC)))), // aA + non_residue*((b+c)*(B+C)-bB-cC), + + this.F.add( + this.F.sub( + this.F.mul( + this.F.add(a[0], a[1]), + this.F.add(b[0], b[1])), + this.F.add(aA, bB)), + this._mulByNonResidue( cC)), // (a+b)*(A+B)-aA-bB+non_residue*cC + + this.F.add( + this.F.sub( + this.F.mul( + this.F.add(a[0], a[2]), + this.F.add(b[0], b[2])), + this.F.add(aA, cC)), + bB)]; // (a+c)*(A+C)-aA+bB-cC) + } + + inv(a) { + const t0 = this.F.square(a[0]); // t0 = a^2 ; + const t1 = this.F.square(a[1]); // t1 = b^2 ; + const t2 = this.F.square(a[2]); // t2 = c^2; + const t3 = this.F.mul(a[0],a[1]); // t3 = ab + const t4 = this.F.mul(a[0],a[2]); // t4 = ac + const t5 = this.F.mul(a[1],a[2]); // t5 = bc; + // c0 = t0 - non_residue * t5; + const c0 = this.F.sub(t0, this._mulByNonResidue(t5)); + // c1 = non_residue * t2 - t3; + const c1 = this.F.sub(this._mulByNonResidue(t2), t3); + const c2 = this.F.sub(t1, t4); // c2 = t1-t4 + + // t6 = (a * c0 + non_residue * (c * c1 + b * c2)).inv(); + const t6 = + this.F.inv( + this.F.add( + this.F.mul(a[0], c0), + this._mulByNonResidue( + this.F.add( + this.F.mul(a[2], c1), + this.F.mul(a[1], c2))))); + + return [ + this.F.mul(t6, c0), // t6*c0 + this.F.mul(t6, c1), // t6*c1 + this.F.mul(t6, c2)]; // t6*c2 + } + + div(a, b) { + return this.mul(a, this.inv(b)); + } + + square(a) { + const s0 = this.F.square(a[0]); // s0 = a^2 + const ab = this.F.mul(a[0], a[1]); // ab = a*b + const s1 = this.F.add(ab, ab); // s1 = 2ab; + const s2 = this.F.square( + this.F.add(this.F.sub(a[0],a[1]), a[2])); // s2 = (a - b + c)^2; + const bc = this.F.mul(a[1],a[2]); // bc = b*c + const s3 = this.F.add(bc, bc); // s3 = 2*bc + const s4 = this.F.square(a[2]); // s4 = c^2 + + + return [ + this.F.add( + s0, + this._mulByNonResidue(s3)), // s0 + non_residue * s3, + this.F.add( + s1, + this._mulByNonResidue(s4)), // s1 + non_residue * s4, + this.F.sub( + this.F.add( this.F.add(s1, s2) , s3 ), + this.F.add(s0, s4))]; // s1 + s2 + s3 - s0 - s4 + } + + isZero(a) { + return this.F.isZero(a[0]) && this.F.isZero(a[1]) && this.F.isZero(a[2]); + } + + eq(a, b) { + return this.F.eq(a[0], b[0]) && this.F.eq(a[1], b[1]) && this.F.eq(a[2], b[2]); + } + + affine(a) { + return [this.F.affine(a[0]), this.F.affine(a[1]), this.F.affine(a[2])]; + } + + mulScalar(base, e) { + return mulScalar(this, base, e); + } + + pow(base, e) { + return exp(this, base, e); + } + + exp(base, e) { + return exp(this, base, e); + } + + toString(a) { + return `[ ${this.F.toString(a[0])} , ${this.F.toString(a[1])}, ${this.F.toString(a[2])} ]`; + } + + fromRng(rng) { + const c0 = this.F.fromRng(rng); + const c1 = this.F.fromRng(rng); + const c2 = this.F.fromRng(rng); + return [c0, c1, c2]; + } + + gt(a, b) { + if (this.F.gt(a[0], b[0])) return true; + if (this.F.gt(b[0], a[0])) return false; + if (this.F.gt(a[1], b[1])) return true; + if (this.F.gt(b[1], a[1])) return false; + if (this.F.gt(a[2], b[2])) return true; + return false; + } + + + geq(a, b) { + return this.gt(a, b) || this.eq(a, b); + } + + lt(a, b) { + return !this.geq(a,b); + } + + leq(a, b) { + return !this.gt(a,b); + } + + neq(a, b) { + return !this.eq(a,b); + } + + random() { + return [this.F.random(), this.F.random(), this.F.random()]; + } + + + toRprLE(buff, o, e) { + this.F.toRprLE(buff, o, e[0]); + this.F.toRprLE(buff, o+this.F.n8, e[1]); + this.F.toRprLE(buff, o+this.F.n8*2, e[2]); + } + + toRprBE(buff, o, e) { + this.F.toRprBE(buff, o, e[2]); + this.F.toRprBE(buff, o+this.F.n8, e[1]); + this.F.toRprBE(buff, o+this.F.n8*2, e[0]); + } + + toRprLEM(buff, o, e) { + this.F.toRprLEM(buff, o, e[0]); + this.F.toRprLEM(buff, o+this.F.n8, e[1]); + this.F.toRprLEM(buff, o+this.F.n8*2, e[2]); + } + + + toRprBEM(buff, o, e) { + this.F.toRprBEM(buff, o, e[2]); + this.F.toRprBEM(buff, o+this.F.n8, e[1]); + this.F.toRprBEM(buff, o+this.F.n8*2, e[0]); + } + + fromRprLE(buff, o) { + o = o || 0; + const c0 = this.F.fromRprLE(buff, o); + const c1 = this.F.fromRprLE(buff, o+this.n8); + const c2 = this.F.fromRprLE(buff, o+this.n8*2); + return [c0, c1, c2]; + } + + fromRprBE(buff, o) { + o = o || 0; + const c2 = this.F.fromRprBE(buff, o); + const c1 = this.F.fromRprBE(buff, o+this.n8); + const c0 = this.F.fromRprBE(buff, o+this.n8*2); + return [c0, c1, c2]; + } + + fromRprLEM(buff, o) { + o = o || 0; + const c0 = this.F.fromRprLEM(buff, o); + const c1 = this.F.fromRprLEM(buff, o+this.n8); + const c2 = this.F.fromRprLEM(buff, o+this.n8*2); + return [c0, c1, c2]; + } + + fromRprBEM(buff, o) { + o = o || 0; + const c2 = this.F.fromRprBEM(buff, o); + const c1 = this.F.fromRprBEM(buff, o+this.n8); + const c0 = this.F.fromRprBEM(buff, o+this.n8*2); + return [c0, c1, c2]; + } + + toObject(a) { + return a; + } +} + +/* + Copyright 2018 0kims association. + + This file is part of snarkjs. + + snarkjs is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. + + snarkjs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + snarkjs. If not, see . +*/ + + + +function isGreatest(F, a) { + if (Array.isArray(a)) { + for (let i=a.length-1; i>=0; i--) { + if (!F.F.isZero(a[i])) { + return isGreatest(F.F, a[i]); + } + } + return 0; + } else { + const na = F.neg(a); + return gt(a, na); + } +} + + +class EC { + + constructor(F, g) { + this.F = F; + this.g = g; + if (this.g.length == 2) this.g[2] = this.F.one; + this.zero = [this.F.zero, this.F.one, this.F.zero]; + } + + add(p1, p2) { + + const F = this.F; + + if (this.eq(p1, this.zero)) return p2; + if (this.eq(p2, this.zero)) return p1; + + const res = new Array(3); + + const Z1Z1 = F.square( p1[2] ); + const Z2Z2 = F.square( p2[2] ); + + const U1 = F.mul( p1[0] , Z2Z2 ); // U1 = X1 * Z2Z2 + const U2 = F.mul( p2[0] , Z1Z1 ); // U2 = X2 * Z1Z1 + + const Z1_cubed = F.mul( p1[2] , Z1Z1); + const Z2_cubed = F.mul( p2[2] , Z2Z2); + + const S1 = F.mul( p1[1] , Z2_cubed); // S1 = Y1 * Z2 * Z2Z2 + const S2 = F.mul( p2[1] , Z1_cubed); // S2 = Y2 * Z1 * Z1Z1 + + if (F.eq(U1,U2) && F.eq(S1,S2)) { + return this.double(p1); + } + + const H = F.sub( U2 , U1 ); // H = U2-U1 + + const S2_minus_S1 = F.sub( S2 , S1 ); + + const I = F.square( F.add(H,H) ); // I = (2 * H)^2 + const J = F.mul( H , I ); // J = H * I + + const r = F.add( S2_minus_S1 , S2_minus_S1 ); // r = 2 * (S2-S1) + const V = F.mul( U1 , I ); // V = U1 * I + + res[0] = + F.sub( + F.sub( F.square(r) , J ), + F.add( V , V )); // X3 = r^2 - J - 2 * V + + const S1_J = F.mul( S1 , J ); + + res[1] = + F.sub( + F.mul( r , F.sub(V,res[0])), + F.add( S1_J,S1_J )); // Y3 = r * (V-X3)-2 S1 J + + res[2] = + F.mul( + H, + F.sub( + F.square( F.add(p1[2],p2[2]) ), + F.add( Z1Z1 , Z2Z2 ))); // Z3 = ((Z1+Z2)^2-Z1Z1-Z2Z2) * H + + return res; + } + + neg(p) { + return [p[0], this.F.neg(p[1]), p[2]]; + } + + sub(a, b) { + return this.add(a, this.neg(b)); + } + + double(p) { + const F = this.F; + + const res = new Array(3); + + if (this.eq(p, this.zero)) return p; + + const A = F.square( p[0] ); // A = X1^2 + const B = F.square( p[1] ); // B = Y1^2 + const C = F.square( B ); // C = B^2 + + let D = + F.sub( + F.square( F.add(p[0] , B )), + F.add( A , C)); + D = F.add(D,D); // D = 2 * ((X1 + B)^2 - A - C) + + const E = F.add( F.add(A,A), A); // E = 3 * A + const FF =F.square( E ); // F = E^2 + + res[0] = F.sub( FF , F.add(D,D) ); // X3 = F - 2 D + + let eightC = F.add( C , C ); + eightC = F.add( eightC , eightC ); + eightC = F.add( eightC , eightC ); + + res[1] = + F.sub( + F.mul( + E, + F.sub( D, res[0] )), + eightC); // Y3 = E * (D - X3) - 8 * C + + const Y1Z1 = F.mul( p[1] , p[2] ); + res[2] = F.add( Y1Z1 , Y1Z1 ); // Z3 = 2 * Y1 * Z1 + + return res; + } + + timesScalar(base, e) { + return mulScalar(this, base, e); + } + + mulScalar(base, e) { + return mulScalar(this, base, e); + } + + affine(p) { + const F = this.F; + if (this.isZero(p)) { + return this.zero; + } else if (F.eq(p[2], F.one)) { + return p; + } else { + const Z_inv = F.inv(p[2]); + const Z2_inv = F.square(Z_inv); + const Z3_inv = F.mul(Z2_inv, Z_inv); + + const res = new Array(3); + res[0] = F.mul(p[0],Z2_inv); + res[1] = F.mul(p[1],Z3_inv); + res[2] = F.one; + + return res; + } + } + + multiAffine(arr) { + const keys = Object.keys(arr); + const F = this.F; + const accMul = new Array(keys.length+1); + accMul[0] = F.one; + for (let i = 0; i< keys.length; i++) { + if (F.eq(arr[keys[i]][2], F.zero)) { + accMul[i+1] = accMul[i]; + } else { + accMul[i+1] = F.mul(accMul[i], arr[keys[i]][2]); + } + } + + accMul[keys.length] = F.inv(accMul[keys.length]); + + for (let i = keys.length-1; i>=0; i--) { + if (F.eq(arr[keys[i]][2], F.zero)) { + accMul[i] = accMul[i+1]; + arr[keys[i]] = this.zero; + } else { + const Z_inv = F.mul(accMul[i], accMul[i+1]); + accMul[i] = F.mul(arr[keys[i]][2], accMul[i+1]); + + const Z2_inv = F.square(Z_inv); + const Z3_inv = F.mul(Z2_inv, Z_inv); + + arr[keys[i]][0] = F.mul(arr[keys[i]][0],Z2_inv); + arr[keys[i]][1] = F.mul(arr[keys[i]][1],Z3_inv); + arr[keys[i]][2] = F.one; + } + } + + } + + eq(p1, p2) { + const F = this.F; + + if (this.F.eq(p1[2], this.F.zero)) return this.F.eq(p2[2], this.F.zero); + if (this.F.eq(p2[2], this.F.zero)) return false; + + const Z1Z1 = F.square( p1[2] ); + const Z2Z2 = F.square( p2[2] ); + + const U1 = F.mul( p1[0] , Z2Z2 ); + const U2 = F.mul( p2[0] , Z1Z1 ); + + const Z1_cubed = F.mul( p1[2] , Z1Z1); + const Z2_cubed = F.mul( p2[2] , Z2Z2); + + const S1 = F.mul( p1[1] , Z2_cubed); + const S2 = F.mul( p2[1] , Z1_cubed); + + return (F.eq(U1,U2) && F.eq(S1,S2)); + } + + isZero(p) { + return this.F.isZero(p[2]); + } + + toString(p) { + const cp = this.affine(p); + return `[ ${this.F.toString(cp[0])} , ${this.F.toString(cp[1])} ]`; + } + + fromRng(rng) { + const F = this.F; + let P = []; + let greatest; + do { + P[0] = F.fromRng(rng); + greatest = rng.nextBool(); + const x3b = F.add(F.mul(F.square(P[0]), P[0]), this.b); + P[1] = F.sqrt(x3b); + } while ((P[1] == null)||(F.isZero[P])); + + const s = isGreatest(F, P[1]); + if (greatest ^ s) P[1] = F.neg(P[1]); + P[2] = F.one; + + if (this.cofactor) { + P = this.mulScalar(P, this.cofactor); + } + + P = this.affine(P); + + return P; + + } + + toRprLE(buff, o, p) { + p = this.affine(p); + if (this.isZero(p)) { + const BuffV = new Uint8Array(buff, o, this.F.n8*2); + BuffV.fill(0); + return; + } + this.F.toRprLE(buff, o, p[0]); + this.F.toRprLE(buff, o+this.F.n8, p[1]); + } + + toRprBE(buff, o, p) { + p = this.affine(p); + if (this.isZero(p)) { + const BuffV = new Uint8Array(buff, o, this.F.n8*2); + BuffV.fill(0); + return; + } + this.F.toRprBE(buff, o, p[0]); + this.F.toRprBE(buff, o+this.F.n8, p[1]); + } + + toRprLEM(buff, o, p) { + p = this.affine(p); + if (this.isZero(p)) { + const BuffV = new Uint8Array(buff, o, this.F.n8*2); + BuffV.fill(0); + return; + } + this.F.toRprLEM(buff, o, p[0]); + this.F.toRprLEM(buff, o+this.F.n8, p[1]); + } + + toRprLEJM(buff, o, p) { + p = this.affine(p); + if (this.isZero(p)) { + const BuffV = new Uint8Array(buff, o, this.F.n8*2); + BuffV.fill(0); + return; + } + this.F.toRprLEM(buff, o, p[0]); + this.F.toRprLEM(buff, o+this.F.n8, p[1]); + this.F.toRprLEM(buff, o+2*this.F.n8, p[2]); + } + + + toRprBEM(buff, o, p) { + p = this.affine(p); + if (this.isZero(p)) { + const BuffV = new Uint8Array(buff, o, this.F.n8*2); + BuffV.fill(0); + return; + } + this.F.toRprBEM(buff, o, p[0]); + this.F.toRprBEM(buff, o+this.F.n8, p[1]); + } + + fromRprLE(buff, o) { + o = o || 0; + const x = this.F.fromRprLE(buff, o); + const y = this.F.fromRprLE(buff, o+this.F.n8); + if (this.F.isZero(x) && this.F.isZero(y)) { + return this.zero; + } + return [x, y, this.F.one]; + } + + fromRprBE(buff, o) { + o = o || 0; + const x = this.F.fromRprBE(buff, o); + const y = this.F.fromRprBE(buff, o+this.F.n8); + if (this.F.isZero(x) && this.F.isZero(y)) { + return this.zero; + } + return [x, y, this.F.one]; + } + + fromRprLEM(buff, o) { + o = o || 0; + const x = this.F.fromRprLEM(buff, o); + const y = this.F.fromRprLEM(buff, o+this.F.n8); + if (this.F.isZero(x) && this.F.isZero(y)) { + return this.zero; + } + return [x, y, this.F.one]; + } + + fromRprLEJM(buff, o) { + o = o || 0; + const x = this.F.fromRprLEM(buff, o); + const y = this.F.fromRprLEM(buff, o+this.F.n8); + const z = this.F.fromRprLEM(buff, o+this.F.n8*2); + if (this.F.isZero(x) && this.F.isZero(y)) { + return this.zero; + } + return [x, y, z]; + } + + fromRprBEM(buff, o) { + o = o || 0; + const x = this.F.fromRprBEM(buff, o); + const y = this.F.fromRprBEM(buff, o+this.F.n8); + if (this.F.isZero(x) && this.F.isZero(y)) { + return this.zero; + } + return [x, y, this.F.one]; + } + + fromRprCompressed(buff, o) { + const F = this.F; + const v = new Uint8Array(buff.buffer, o, F.n8); + if (v[0] & 0x40) return this.zero; + const P = new Array(3); + + const greatest = ((v[0] & 0x80) != 0); + v[0] = v[0] & 0x7F; + P[0] = F.fromRprBE(buff, o); + if (greatest) v[0] = v[0] | 0x80; // set back again the old value + + const x3b = F.add(F.mul(F.square(P[0]), P[0]), this.b); + P[1] = F.sqrt(x3b); + + if (P[1] === null) { + throw new Error("Invalid Point!"); + } + + const s = isGreatest(F, P[1]); + if (greatest ^ s) P[1] = F.neg(P[1]); + P[2] = F.one; + + return P; + } + + toRprCompressed(buff, o, p) { + p = this.affine(p); + const v = new Uint8Array(buff.buffer, o, this.F.n8); + if (this.isZero(p)) { + v.fill(0); + v[0] = 0x40; + return; + } + this.F.toRprBE(buff, o, p[0]); + + if (isGreatest(this.F, p[1])) { + v[0] = v[0] | 0x80; + } + } + + + fromRprUncompressed(buff, o) { + if (buff[0] & 0x40) return this.zero; + + return this.fromRprBE(buff, o); + } + + toRprUncompressed(buff, o, p) { + this.toRprBE(buff, o, p); + + if (this.isZero(p)) { + buff[o] = buff[o] | 0x40; + } + } + + +} + +function getDefaultExportFromCjs (x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; +} + +var utils$6 = {}; -/* provided dependency */ var console = __webpack_require__(6763); /* Copyright 2019 0KIMS association. - This file is part of websnark (Web Assembly zkSnark Prover). + This file is part of wasmsnark (Web Assembly zkSnark Prover). - websnark is a free software: you can redistribute it and/or modify it + wasmsnark is a free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - websnark is distributed in the hope that it will be useful, but WITHOUT + wasmsnark is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with websnark. If not, see . + along with wasmsnark. If not, see . */ -/* globals WebAssembly */ -const bigInt = __webpack_require__(2096); -const ModuleBuilder = __webpack_require__(442); +utils$6.bigInt2BytesLE = function bigInt2BytesLE(_a, len) { + const b = Array(len); + let v = BigInt(_a); + for (let i=0; i> 8n; + } + return b; +}; -function buf2hex(buffer) { // buffer is an ArrayBuffer - return Array.prototype.map.call(new Uint8Array(buffer), x => ("00" + x.toString(16)).slice(-2)).join(""); -} +utils$6.bigInt2U32LE = function bigInt2BytesLE(_a, len) { + const b = Array(len); + let v = BigInt(_a); + for (let i=0; i> 32n; + } + return b; +}; +utils$6.isOcamNum = function(a) { + if (!Array.isArray(a)) return false; + if (a.length != 3) return false; + if (typeof a[0] !== "number") return false; + if (typeof a[1] !== "number") return false; + if (!Array.isArray(a[2])) return false; + return true; +}; -async function buildProtoboard(builder, defBytes, bitsPerBytes) { - const protoboard = new Protoboard(); +/* + Copyright 2019 0KIMS association. - protoboard.defBytes = defBytes; - protoboard.bitsPerBytes = bitsPerBytes || 32; + This file is part of wasmsnark (Web Assembly zkSnark Prover). - protoboard.memory = new WebAssembly.Memory({initial:20000}); - protoboard.i32 = new Uint32Array(protoboard.memory.buffer); - protoboard.i8 = new Uint8Array(protoboard.memory.buffer); + wasmsnark is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - const moduleBuilder = new ModuleBuilder(); + wasmsnark is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. - const fLog32 = moduleBuilder.addIimportFunction("debug_log32", "debug", "log32"); - fLog32.addParam("x", "i32"); - const fLog64 = moduleBuilder.addIimportFunction("debug_log64", "debug", "log64"); - fLog64.addParam("x", "i32"); - fLog64.addParam("y", "i32"); + You should have received a copy of the GNU General Public License + along with wasmsnark. If not, see . +*/ - buildLog32(moduleBuilder); - buildLog64(moduleBuilder); +var build_int = function buildInt(module, n64, _prefix) { - builder(moduleBuilder, protoboard); + const prefix = _prefix || "int"; + if (module.modules[prefix]) return prefix; // already builded + module.modules[prefix] = {}; + const n32 = n64*2; + const n8 = n64*8; - const code = moduleBuilder.build(); - - const wasmModule = await WebAssembly.compile(code); - - protoboard.log = console.log; - - protoboard.instance = await WebAssembly.instantiate(wasmModule, { - env: { - "memory": protoboard.memory - }, - debug: { - log32: function (c1) { - if (c1<0) c1 = 0x100000000+c1; - let s=c1.toString(16); - while (s.length<8) s = "0"+s; - protoboard.log(s + ": " + c1.toString()); - }, - log64: function (c1, c2) { - if (c1<0) c1 = 0x100000000+c1; - if (c2<0) c2 = 0x100000000+c2; - const n = bigInt(c1) + bigInt(c2).shiftLeft(32); - let s=n.toString(16); - while (s.length<16) s = "0"+s; - protoboard.log(s + ": " + n.toString()); - } - } - }); - - Object.assign(protoboard, protoboard.instance.exports); - Object.assign(protoboard, moduleBuilder.modules); - - return protoboard; - - function buildLog32(module) { - - const f = module.addFunction("log32"); - f.addParam("x", "i32"); + function buildCopy() { + const f = module.addFunction(prefix+"_copy"); + f.addParam("px", "i32"); + f.addParam("pr", "i32"); const c = f.getCodeBuilder(); - f.addCode(c.call("debug_log32", c.getLocal("x"))); + + for (let i=0; i>1) )&&(i>1, k>>1) + ) + ) + ); + + f.addCode( + c.setLocal(c1, + c.i64_add( + c.getLocal(c1), + c.i64_shr_u( + c.getLocal(c0), + c.i64_const(32) + ) + ) + ) + ); + } + + // Add the old carry + + if (k>0) { + f.addCode( + c.setLocal(c0, + c.i64_add( + c.i64_and( + c.getLocal(c0), + c.i64_const(0xFFFFFFFF) + ), + c.i64_and( + c.getLocal(c0_old), + c.i64_const(0xFFFFFFFF) + ), + ) + ) + ); + + f.addCode( + c.setLocal(c1, + c.i64_add( + c.i64_add( + c.getLocal(c1), + c.i64_shr_u( + c.getLocal(c0), + c.i64_const(32) + ) + ), + c.getLocal(c1_old) + ) + ) + ); + } + + f.addCode( + c.i64_store32( + c.getLocal("r"), + k*4, + c.getLocal(c0) + ) + ); + + f.addCode( + c.setLocal( + c0_old, + c.getLocal(c1) + ), + c.setLocal( + c1_old, + c.i64_shr_u( + c.getLocal(c0_old), + c.i64_const(32) + ) + ) + ); + + } + f.addCode( + c.i64_store32( + c.getLocal("r"), + n32*4*2-4, + c.getLocal(c0_old) + ) + ); + + } + + + function buildSquareOld() { + const f = module.addFunction(prefix+"_squareOld"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode(c.call(prefix + "_mul", c.getLocal("x"), c.getLocal("x"), c.getLocal("r"))); + } + + function _buildMul1() { + const f = module.addFunction(prefix+"__mul1"); + f.addParam("px", "i32"); + f.addParam("y", "i64"); + f.addParam("pr", "i32"); + f.addLocal("c", "i64"); + + const c = f.getCodeBuilder(); + + f.addCode(c.setLocal( + "c", + c.i64_mul( + c.i64_load32_u(c.getLocal("px"), 0, 0), + c.getLocal("y") + ) + )); + + f.addCode(c.i64_store32( + c.getLocal("pr"), + 0, + 0, + c.getLocal("c"), + )); + + for (let i=1; i3)&&(Y[eY]==0) ey--; + f.addCode(c.block(c.loop( + c.br_if( + 1, + c.i32_or( + c.i32_load8_u( + c.i32_add(Y , c.getLocal("eY")), + 0, + 0 + ), + c.i32_eq( + c.getLocal("eY"), + c.i32_const(3) + ) + ) + ), + c.setLocal("eY", c.i32_sub(c.getLocal("eY"), c.i32_const(1))), + c.br(0) + ))); + + f.addCode( + c.setLocal( + "sy", + c.i64_add( + c.i64_load32_u( + c.i32_sub( + c.i32_add( Y, c.getLocal("eY")), + c.i32_const(3) + ), + 0, + 0 + ), + c.i64_const(1) + ) ) + ); + + // Force a divide by 0 if quotien is 0 + f.addCode( + c.if( + c.i64_eq( + c.getLocal("sy"), + c.i64_const(1) + ), + c.drop(c.i64_div_u(c.i64_const(0), c.i64_const(0))) + ) + ); + + f.addCode(c.block(c.loop( + + // while (eX>7)&&(Y[eX]==0) ex--; + c.block(c.loop( + c.br_if( + 1, + c.i32_or( + c.i32_load8_u( + c.i32_add(R , c.getLocal("eX")), + 0, + 0 + ), + c.i32_eq( + c.getLocal("eX"), + c.i32_const(7) + ) + ) + ), + c.setLocal("eX", c.i32_sub(c.getLocal("eX"), c.i32_const(1))), + c.br(0) + )), + + c.setLocal( + "sx", + c.i64_load( + c.i32_sub( + c.i32_add( R, c.getLocal("eX")), + c.i32_const(7) + ), + 0, + 0 + ) + ), + + c.setLocal( + "sx", + c.i64_div_u( + c.getLocal("sx"), + c.getLocal("sy") + ) + ), + c.setLocal( + "ec", + c.i32_sub( + c.i32_sub( + c.getLocal("eX"), + c.getLocal("eY") + ), + c.i32_const(4) + ) + ), + + // While greater than 32 bits or ec is neg, shr and inc exp + c.block(c.loop( + c.br_if( + 1, + c.i32_and( + c.i64_eqz( + c.i64_and( + c.getLocal("sx"), + c.i64_const("0xFFFFFFFF00000000") + ) + ), + c.i32_ge_s( + c.getLocal("ec"), + c.i32_const(0) + ) + ) + ), + + c.setLocal( + "sx", + c.i64_shr_u( + c.getLocal("sx"), + c.i64_const(8) + ) + ), + + c.setLocal( + "ec", + c.i32_add( + c.getLocal("ec"), + c.i32_const(1) + ) + ), + c.br(0) + )), + + c.if( + c.i64_eqz(c.getLocal("sx")), + [ + ...c.br_if( + 2, + c.i32_eqz(c.call(prefix + "_gte", R, Y)) + ), + ...c.setLocal("sx", c.i64_const(1)), + ...c.setLocal("ec", c.i32_const(0)) + ] + ), + + c.call(prefix + "__mul1", Y, c.getLocal("sx"), R2), + c.drop(c.call( + prefix + "_sub", + R, + c.i32_sub(R2, c.getLocal("ec")), + R + )), + c.call( + prefix + "__add1", + c.i32_add(C, c.getLocal("ec")), + c.getLocal("sx") + ), + c.br(0) + ))); + } + + function buildInverseMod() { + + const f = module.addFunction(prefix+"_inverseMod"); + f.addParam("px", "i32"); + f.addParam("pm", "i32"); + f.addParam("pr", "i32"); + f.addLocal("t", "i32"); + f.addLocal("newt", "i32"); + f.addLocal("r", "i32"); + f.addLocal("qq", "i32"); + f.addLocal("qr", "i32"); + f.addLocal("newr", "i32"); + f.addLocal("swp", "i32"); + f.addLocal("x", "i32"); + f.addLocal("signt", "i32"); + f.addLocal("signnewt", "i32"); + f.addLocal("signx", "i32"); + + const c = f.getCodeBuilder(); + + const aux1 = c.i32_const(module.alloc(n8)); + const aux2 = c.i32_const(module.alloc(n8)); + const aux3 = c.i32_const(module.alloc(n8)); + const aux4 = c.i32_const(module.alloc(n8)); + const aux5 = c.i32_const(module.alloc(n8)); + const aux6 = c.i32_const(module.alloc(n8)); + const mulBuff = c.i32_const(module.alloc(n8*2)); + const aux7 = c.i32_const(module.alloc(n8)); + + f.addCode( + c.setLocal("t", aux1), + c.call(prefix + "_zero", aux1), + c.setLocal("signt", c.i32_const(0)), + ); + + f.addCode( + c.setLocal("r", aux2), + c.call(prefix + "_copy", c.getLocal("pm"), aux2) + ); + + f.addCode( + c.setLocal("newt", aux3), + c.call(prefix + "_one", aux3), + c.setLocal("signnewt", c.i32_const(0)), + ); + + f.addCode( + c.setLocal("newr", aux4), + c.call(prefix + "_copy", c.getLocal("px"), aux4) + ); + + + + + f.addCode(c.setLocal("qq", aux5)); + f.addCode(c.setLocal("qr", aux6)); + f.addCode(c.setLocal("x", aux7)); + + f.addCode(c.block(c.loop( + c.br_if( + 1, + c.call(prefix + "_isZero", c.getLocal("newr") ) + ), + c.call(prefix + "_div", c.getLocal("r"), c.getLocal("newr"), c.getLocal("qq"), c.getLocal("qr")), + + c.call(prefix + "_mul", c.getLocal("qq"), c.getLocal("newt"), mulBuff), + + c.if( + c.getLocal("signt"), + c.if( + c.getLocal("signnewt"), + c.if ( + c.call(prefix + "_gte", mulBuff, c.getLocal("t")), + [ + ...c.drop(c.call(prefix + "_sub", mulBuff, c.getLocal("t"), c.getLocal("x"))), + ...c.setLocal("signx", c.i32_const(0)) + ], + [ + ...c.drop(c.call(prefix + "_sub", c.getLocal("t"), mulBuff, c.getLocal("x"))), + ...c.setLocal("signx", c.i32_const(1)) + ], + ), + [ + ...c.drop(c.call(prefix + "_add", mulBuff, c.getLocal("t"), c.getLocal("x"))), + ...c.setLocal("signx", c.i32_const(1)) + ] + ), + c.if( + c.getLocal("signnewt"), + [ + ...c.drop(c.call(prefix + "_add", mulBuff, c.getLocal("t"), c.getLocal("x"))), + ...c.setLocal("signx", c.i32_const(0)) + ], + c.if ( + c.call(prefix + "_gte", c.getLocal("t"), mulBuff), + [ + ...c.drop(c.call(prefix + "_sub", c.getLocal("t"), mulBuff, c.getLocal("x"))), + ...c.setLocal("signx", c.i32_const(0)) + ], + [ + ...c.drop(c.call(prefix + "_sub", mulBuff, c.getLocal("t"), c.getLocal("x"))), + ...c.setLocal("signx", c.i32_const(1)) + ] + ) + ) + ), + + c.setLocal("swp", c.getLocal("t")), + c.setLocal("t", c.getLocal("newt")), + c.setLocal("newt", c.getLocal("x")), + c.setLocal("x", c.getLocal("swp")), + + c.setLocal("signt", c.getLocal("signnewt")), + c.setLocal("signnewt", c.getLocal("signx")), + + c.setLocal("swp", c.getLocal("r")), + c.setLocal("r", c.getLocal("newr")), + c.setLocal("newr", c.getLocal("qr")), + c.setLocal("qr", c.getLocal("swp")), + + c.br(0) + ))); + + f.addCode(c.if( + c.getLocal("signt"), + c.drop(c.call(prefix + "_sub", c.getLocal("pm"), c.getLocal("t"), c.getLocal("pr"))), + c.call(prefix + "_copy", c.getLocal("t"), c.getLocal("pr")) )); } -} -class Protoboard { + buildCopy(); + buildZero(); + buildIsZero(); + buildOne(); + buildEq(); + buildGte(); + buildAdd(); + buildSub(); + buildMul(); + buildSquare(); + buildSquareOld(); + buildDiv(); + buildInverseMod(); + module.exportFunction(prefix+"_copy"); + module.exportFunction(prefix+"_zero"); + module.exportFunction(prefix+"_one"); + module.exportFunction(prefix+"_isZero"); + module.exportFunction(prefix+"_eq"); + module.exportFunction(prefix+"_gte"); + module.exportFunction(prefix+"_add"); + module.exportFunction(prefix+"_sub"); + module.exportFunction(prefix+"_mul"); + module.exportFunction(prefix+"_square"); + module.exportFunction(prefix+"_squareOld"); + module.exportFunction(prefix+"_div"); + module.exportFunction(prefix+"_inverseMod"); - constructor() { - - } - - alloc(length) { - if (typeof length === "undefined") { - length = this.defBytes; - } - length = (((length-1)>>3) +1)<<3; // Align to 64 bits. - - const res = this.i32[0]; - this.i32[0] += length; - return res; - } - - set(pos, nums, nBytes) { - if (!Array.isArray(nums)) { - nums = [nums]; - } - if (typeof nBytes === "undefined") { - nBytes = this.defBytes; - } - - const words = Math.floor((nBytes -1)/4)+1; - let p = pos; - - const CHUNK = bigInt.one.shiftLeft(this.bitsPerBytes); - - for (let i=0; i>2] = rd.remainder.toJSNumber(); - v = rd.quotient; - p += 4; - } - if (!v.isZero()) { - throw new Error('Expected v to be 0'); - } -/* this.i32[p>>2] = bigInt(nums[i]).shiftRight( (words-1)*this.bitsPerBytes).toJSNumber(); - p += 4; -*/ } - - return pos; - } - - get(pos, nElements, nBytes) { - if (typeof nBytes == "undefined") { - if (typeof nElements == "undefined") { - nElements = 1; - nBytes = this.defBytes; - } else { - nElements = nBytes; - nBytes = this.defBytes; - } - } - - const words = Math.floor((nBytes -1)/4)+1; - - const CHUNK = bigInt.one.shiftLeft(this.bitsPerBytes); - - - const nums = []; - for (let i=0; i=0; j--) { - acc = acc.times(CHUNK); - let v = this.i32[(pos>>2)+j]; - if (this.bitsPerBytes <32) { - if (v&0x80000000) v = v-0x100000000; - } - acc = acc.add(v); - } - nums.push(acc); - pos += words*4; - } - - if (nums.length == 1) return nums[0]; - return nums; - } -} - -module.exports = buildProtoboard; - - -/***/ }), - -/***/ 484: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmbuilder - - wasmbuilder is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmbuilder is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmbuilder. If not, see . -*/ - -const bigInt = __webpack_require__(2096); - -function toNumber(n) { - let v; - if (typeof n=="string") { - if (n.slice(0,2).toLowerCase() == "0x") { - v = bigInt(n.slice(2),16); - } else { - v = bigInt(n); - } - } else { - v = bigInt(n); - } - return v; -} - -function u32(n) { - const b = []; - const v = toNumber(n); - b.push(v.and(0xFF).toJSNumber()); - b.push(v.shiftRight(8).and(0xFF).toJSNumber()); - b.push(v.shiftRight(16).and(0xFF).toJSNumber()); - b.push(v.shiftRight(24).and(0xFF).toJSNumber()); - return b; -} - -function u64(n) { - const b = []; - const v = toNumber(n); - b.push(v.and(0xFF).toJSNumber()); - b.push(v.shiftRight(8).and(0xFF).toJSNumber()); - b.push(v.shiftRight(16).and(0xFF).toJSNumber()); - b.push(v.shiftRight(24).and(0xFF).toJSNumber()); - b.push(v.shiftRight(32).and(0xFF).toJSNumber()); - b.push(v.shiftRight(40).and(0xFF).toJSNumber()); - b.push(v.shiftRight(48).and(0xFF).toJSNumber()); - b.push(v.shiftRight(56).and(0xFF).toJSNumber()); - return b; -} - -function toUTF8Array(str) { - var utf8 = []; - for (var i=0; i < str.length; i++) { - var charcode = str.charCodeAt(i); - if (charcode < 0x80) utf8.push(charcode); - else if (charcode < 0x800) { - utf8.push(0xc0 | (charcode >> 6), - 0x80 | (charcode & 0x3f)); - } - else if (charcode < 0xd800 || charcode >= 0xe000) { - utf8.push(0xe0 | (charcode >> 12), - 0x80 | ((charcode>>6) & 0x3f), - 0x80 | (charcode & 0x3f)); - } - // surrogate pair - else { - i++; - // UTF-16 encodes 0x10000-0x10FFFF by - // subtracting 0x10000 and splitting the - // 20 bits of 0x0-0xFFFFF into two halves - charcode = 0x10000 + (((charcode & 0x3ff)<<10) - | (str.charCodeAt(i) & 0x3ff)); - utf8.push(0xf0 | (charcode >>18), - 0x80 | ((charcode>>12) & 0x3f), - 0x80 | ((charcode>>6) & 0x3f), - 0x80 | (charcode & 0x3f)); - } - } - return utf8; -} - -function string(str) { - const bytes = toUTF8Array(str); - return [ ...varuint32(bytes.length), ...bytes ]; -} - -function varuint(n) { - const code = []; - let v = toNumber(n); - if (v.isNegative()) throw new Error("Number cannot be negative"); - while (!v.isZero()) { - code.push(v.and(0x7F).toJSNumber()); - v = v.shiftRight(7); - } - if (code.length==0) code.push(0); - for (let i=0; i { + return prefix; +}; /* Copyright 2019 0KIMS association. @@ -58637,3285 +66999,78 @@ module.exports.ident = ident; along with wasmsnark. If not, see . */ - -// module.exports.bn128_wasm = require("./build/bn128_wasm.js"); -// module.exports.bls12381_wasm = require("./build/bls12381_wasm.js"); -// module.exports.mnt6753_wasm = require("./build/mnt6753_wasm.js"); - -module.exports.buildBn128 = __webpack_require__(3584); -module.exports.buildBls12381 = __webpack_require__(6920); -// module.exports.buildMnt6753 = require("./src/mnt6753/build_mnt7.js"); - - -/***/ }), - -/***/ 6920: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const bigInt = __webpack_require__(2096); -const utils = __webpack_require__(2333); - -const buildF1m =__webpack_require__(75); -const buildF1 =__webpack_require__(8138); -const buildF2m =__webpack_require__(5420); -const buildF3m =__webpack_require__(7173); -const buildCurve =__webpack_require__(5904); -const buildFFT = __webpack_require__(3911); -const buildPol = __webpack_require__(2896); -const buildQAP = __webpack_require__(637); -const buildApplyKey = __webpack_require__(3320); - -// Definition here: https://electriccoin.co/blog/new-snark-curve/ - -module.exports = function buildBLS12381(module, _prefix) { - - const prefix = _prefix || "bls12381"; - - if (module.modules[prefix]) return prefix; // already builded - - const q = bigInt("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab", 16); - const r = bigInt("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001", 16); - - const n64q = Math.floor((q.minus(1).bitLength() - 1)/64) +1; - const n8q = n64q*8; - const f1size = n8q; - const f2size = f1size * 2; - const f6size = f1size * 6; - const ftsize = f1size * 12; - - const n64r = Math.floor((r.minus(1).bitLength() - 1)/64) +1; - const n8r = n64r*8; - const frsize = n8r; - - - const pr = module.alloc(utils.bigInt2BytesLE( r, frsize )); - - const f1mPrefix = buildF1m(module, q, "f1m", "intq"); - buildF1(module, r, "fr", "frm", "intr"); - const pG1b = module.alloc(utils.bigInt2BytesLE( toMontgomery(bigInt(4)), f1size )); - const g1mPrefix = buildCurve(module, "g1m", "f1m", pG1b); - - buildFFT(module, "frm", "frm", "frm", "frm_mul"); - - buildPol(module, "pol", "frm"); - buildQAP(module, "qap", "frm"); - - const f2mPrefix = buildF2m(module, "f1m_neg", "f2m", "f1m"); - const pG2b = module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery(bigInt("4")), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(bigInt("4")), f1size ) - ]); - const g2mPrefix = buildCurve(module, "g2m", "f2m", pG2b); - - - function buildGTimesFr(fnName, opMul) { - const f = module.addFunction(fnName); - f.addParam("pG", "i32"); - f.addParam("pFr", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - const AUX = c.i32_const(module.alloc(n8r)); - - f.addCode( - c.call("frm_fromMontgomery", c.getLocal("pFr"), AUX), - c.call( - opMul, - c.getLocal("pG"), - AUX, - c.i32_const(n8r), - c.getLocal("pr") - ) - ); - - module.exportFunction(fnName); - } - buildGTimesFr("g1m_timesFr", "g1m_timesScalar"); - buildFFT(module, "g1m", "g1m", "frm", "g1m_timesFr"); - - buildGTimesFr("g2m_timesFr", "g2m_timesScalar"); - buildFFT(module, "g2m", "g2m", "frm", "g2m_timesFr"); - - buildGTimesFr("g1m_timesFrAffine", "g1m_timesScalarAffine"); - buildGTimesFr("g2m_timesFrAffine", "g2m_timesScalarAffine"); - - buildApplyKey(module, "frm_batchApplyKey", "fmr", "frm", n8r, n8r, n8r, "frm_mul"); - buildApplyKey(module, "g1m_batchApplyKey", "g1m", "frm", n8q*3, n8q*3, n8r, "g1m_timesFr"); - buildApplyKey(module, "g1m_batchApplyKeyMixed", "g1m", "frm", n8q*2, n8q*3, n8r, "g1m_timesFrAffine"); - buildApplyKey(module, "g2m_batchApplyKey", "g2m", "frm", n8q*2*3, n8q*3*2, n8r, "g2m_timesFr"); - buildApplyKey(module, "g2m_batchApplyKeyMixed", "g2m", "frm", n8q*2*2, n8q*3*2, n8r, "g2m_timesFrAffine"); - - - function toMontgomery(a) { - return bigInt(a).times( bigInt.one.shiftLeft(f1size*8)).mod(q); - } - - const G1gen = [ - bigInt("3685416753713387016781088315183077757961620795782546409894578378688607592378376318836054947676345821548104185464507"), - bigInt("1339506544944476473020471379941921221584933875938349620426543736416511423956333506472724655353366534992391756441569"), - bigInt.one - ]; - - const pG1gen = module.alloc( - [ - ...utils.bigInt2BytesLE( toMontgomery(G1gen[0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G1gen[1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G1gen[2]), f1size ), - ] - ); - - const G1zero = [ - bigInt.zero, - bigInt.one, - bigInt.zero - ]; - - const pG1zero = module.alloc( - [ - ...utils.bigInt2BytesLE( toMontgomery(G1zero[0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G1zero[1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G1zero[2]), f1size ) - ] - ); - - const G2gen = [ - [ - bigInt("352701069587466618187139116011060144890029952792775240219908644239793785735715026873347600343865175952761926303160"), - bigInt("3059144344244213709971259814753781636986470325476647558659373206291635324768958432433509563104347017837885763365758"), - ],[ - bigInt("1985150602287291935568054521177171638300868978215655730859378665066344726373823718423869104263333984641494340347905"), - bigInt("927553665492332455747201965776037880757740193453592970025027978793976877002675564980949289727957565575433344219582"), - ],[ - bigInt.one, - bigInt.zero, - ] - ]; - - const pG2gen = module.alloc( - [ - ...utils.bigInt2BytesLE( toMontgomery(G2gen[0][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2gen[0][1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2gen[1][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2gen[1][1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2gen[2][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2gen[2][1]), f1size ), - ] - ); - - const G2zero = [ - [ - bigInt.zero, - bigInt.zero, - ],[ - bigInt.one, - bigInt.zero, - ],[ - bigInt.zero, - bigInt.zero, - ] - ]; - - const pG2zero = module.alloc( - [ - ...utils.bigInt2BytesLE( toMontgomery(G2zero[0][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2zero[0][1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2zero[1][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2zero[1][1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2zero[2][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2zero[2][1]), f1size ), - ] - ); - - const pOneT = module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery(1), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ]); - - const pTwoInv = module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery( bigInt(2).modInv(q)), f1size ), - ...utils.bigInt2BytesLE( bigInt(0), f1size ) - ]); - - const pBls12381Twist = module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery(1), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(1), f1size ), - ]); - - const pTwistCoefB = module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery("4"), f1size ), - ...utils.bigInt2BytesLE( toMontgomery("4"), f1size ), - ]); - - function build_mulNR2() { - const f = module.addFunction(f2mPrefix + "_mulNR"); - f.addParam("x", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - const x0c = c.i32_const(module.alloc(f1size)); - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1size)); - const r0 = c.getLocal("pr"); - const r1 = c.i32_add(c.getLocal("pr"), c.i32_const(f1size)); - - f.addCode( - c.call(f1mPrefix+"_copy", x0, x0c), - c.call(f1mPrefix+"_sub", x0, x1, r0), - c.call(f1mPrefix+"_add", x0c, x1, r1), - ); - } - build_mulNR2(); - - const f6mPrefix = buildF3m(module, f2mPrefix+"_mulNR", "f6m", "f2m"); - - function build_mulNR6() { - const f = module.addFunction(f6mPrefix + "_mulNR"); - f.addParam("x", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - const c0copy = c.i32_const(module.alloc(f1size*2)); - - f.addCode( - c.call( - f2mPrefix + "_copy", - c.getLocal("x"), - c0copy - ), - c.call( - f2mPrefix + "_mulNR", - c.i32_add(c.getLocal("x"), c.i32_const(n8q*4)), - c.getLocal("pr") - ), - c.call( - f2mPrefix + "_copy", - c.i32_add(c.getLocal("x"), c.i32_const(n8q*2)), - c.i32_add(c.getLocal("pr"), c.i32_const(n8q*4)), - ), - c.call( - f2mPrefix + "_copy", - c0copy, - c.i32_add(c.getLocal("pr"), c.i32_const(n8q*2)), - ), - ); - } - build_mulNR6(); - - const ftmPrefix = buildF2m(module, f6mPrefix+"_mulNR", "ftm", f6mPrefix); - - const ateLoopCount = bigInt("d201000000010000", 16); - const ateLoopBitBytes = bits(ateLoopCount); - const pAteLoopBitBytes = module.alloc(ateLoopBitBytes); - const isLoopNegative = true; - - const ateCoefSize = 3 * f2size; - const ateNDblCoefs = ateLoopBitBytes.length-1; - const ateNAddCoefs = ateLoopBitBytes.reduce((acc, b) => acc + ( b!=0 ? 1 : 0) ,0); - const ateNCoefs = ateNAddCoefs + ateNDblCoefs + 1; - const prePSize = 3*2*n8q; - const preQSize = 3*n8q*2 + ateNCoefs*ateCoefSize; - const finalExpIsNegative = true; - - const finalExpZ = bigInt("15132376222941642752"); - - - module.modules[prefix] = { - n64q: n64q, - n64r: n64r, - n8q: n8q, - n8r: n8r, - pG1gen: pG1gen, - pG1zero: pG1zero, - pG1b: pG1b, - pG2gen: pG2gen, - pG2zero: pG2zero, - pG2b: pG2b, - pq: module.modules["f1m"].pq, - pr: pr, - pOneT: pOneT, - r: r, - q: q, - prePSize: prePSize, - preQSize: preQSize - }; - - - function naf(n) { - let E = n; - const res = []; - while (E.gt(bigInt.zero)) { - if (E.isOdd()) { - const z = 2 - E.mod(4).toJSNumber(); - res.push( z ); - E = E.minus(z); - } else { - res.push( 0 ); - } - E = E.shiftRight(1); - } - return res; - } - - function bits(n) { - let E = n; - const res = []; - while (E.gt(bigInt.zero)) { - if (E.isOdd()) { - res.push( 1 ); - } else { - res.push( 0 ); - } - E = E.shiftRight(1); - } - return res; - } - - function buildPrepareG1() { - const f = module.addFunction(prefix+ "_prepareG1"); - f.addParam("pP", "i32"); - f.addParam("ppreP", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call(g1mPrefix + "_normalize", c.getLocal("pP"), c.getLocal("ppreP")), // TODO Remove if already in affine - ); - } - - - - function buildPrepDoubleStep() { - const f = module.addFunction(prefix+ "_prepDblStep"); - f.addParam("R", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const Rx = c.getLocal("R"); - const Ry = c.i32_add(c.getLocal("R"), c.i32_const(2*n8q)); - const Rz = c.i32_add(c.getLocal("R"), c.i32_const(4*n8q)); - - const t0 = c.getLocal("r"); - const t3 = c.i32_add(c.getLocal("r"), c.i32_const(2*n8q)); - const t6 = c.i32_add(c.getLocal("r"), c.i32_const(4*n8q)); - - - const zsquared = c.i32_const(module.alloc(f2size)); - const t1 = c.i32_const(module.alloc(f2size)); - const t2 = c.i32_const(module.alloc(f2size)); - const t4 = c.i32_const(module.alloc(f2size)); - const t5 = c.i32_const(module.alloc(f2size)); - - f.addCode( - - // tmp0 = r.x.square(); - c.call(f2mPrefix + "_square", Rx, t0), - - // tmp1 = r.y.square(); - c.call(f2mPrefix + "_square", Ry, t1), - - // tmp2 = tmp1.square(); - c.call(f2mPrefix + "_square", t1, t2), - - // tmp3 = (tmp1 + r.x).square() - tmp0 - tmp2; - c.call(f2mPrefix + "_add", t1, Rx, t3), - c.call(f2mPrefix + "_square", t3, t3), - c.call(f2mPrefix + "_sub", t3, t0, t3), - c.call(f2mPrefix + "_sub", t3, t2, t3), - - // tmp3 = tmp3 + tmp3; - c.call(f2mPrefix + "_add", t3, t3, t3), - - // tmp4 = tmp0 + tmp0 + tmp0; - c.call(f2mPrefix + "_add", t0, t0, t4), - c.call(f2mPrefix + "_add", t4, t0, t4), - - // tmp6 = r.x + tmp4; - c.call(f2mPrefix + "_add", Rx, t4, t6), - - // tmp5 = tmp4.square(); - c.call(f2mPrefix + "_square", t4, t5), - - // zsquared = r.z.square(); - c.call(f2mPrefix + "_square", Rz, zsquared), - - // r.x = tmp5 - tmp3 - tmp3; - c.call(f2mPrefix + "_sub", t5, t3, Rx), - c.call(f2mPrefix + "_sub", Rx, t3, Rx), - - // r.z = (r.z + r.y).square() - tmp1 - zsquared; - c.call(f2mPrefix + "_add", Rz, Ry, Rz), - c.call(f2mPrefix + "_square", Rz, Rz), - c.call(f2mPrefix + "_sub", Rz, t1, Rz), - c.call(f2mPrefix + "_sub", Rz, zsquared, Rz), - - // r.y = (tmp3 - r.x) * tmp4; - c.call(f2mPrefix + "_sub", t3, Rx, Ry), - c.call(f2mPrefix + "_mul", Ry, t4, Ry), - - // tmp2 = tmp2 + tmp2; - c.call(f2mPrefix + "_add", t2, t2, t2), - - // tmp2 = tmp2 + tmp2; - c.call(f2mPrefix + "_add", t2, t2, t2), - - // tmp2 = tmp2 + tmp2; - c.call(f2mPrefix + "_add", t2, t2, t2), - - // r.y -= tmp2; - c.call(f2mPrefix + "_sub", Ry, t2, Ry), - - // tmp3 = tmp4 * zsquared; - c.call(f2mPrefix + "_mul", t4, zsquared, t3), - - // tmp3 = tmp3 + tmp3; - c.call(f2mPrefix + "_add", t3, t3, t3), - - // tmp3 = -tmp3; - c.call(f2mPrefix + "_neg", t3, t3), - - // tmp6 = tmp6.square() - tmp0 - tmp5; - c.call(f2mPrefix + "_square", t6, t6), - c.call(f2mPrefix + "_sub", t6, t0, t6), - c.call(f2mPrefix + "_sub", t6, t5, t6), - - // tmp1 = tmp1 + tmp1; - c.call(f2mPrefix + "_add", t1, t1, t1), - - // tmp1 = tmp1 + tmp1; - c.call(f2mPrefix + "_add", t1, t1, t1), - - // tmp6 = tmp6 - tmp1; - c.call(f2mPrefix + "_sub", t6, t1, t6), - - // tmp0 = r.z * zsquared; - c.call(f2mPrefix + "_mul", Rz, zsquared, t0), - - // tmp0 = tmp0 + tmp0; - c.call(f2mPrefix + "_add", t0, t0, t0), - - ); - } - - function buildPrepAddStep() { - const f = module.addFunction(prefix+ "_prepAddStep"); - f.addParam("R", "i32"); - f.addParam("Q", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const Rx = c.getLocal("R"); - const Ry = c.i32_add(c.getLocal("R"), c.i32_const(2*n8q)); - const Rz = c.i32_add(c.getLocal("R"), c.i32_const(4*n8q)); - - const Qx = c.getLocal("Q"); - const Qy = c.i32_add(c.getLocal("Q"), c.i32_const(2*n8q)); - - const t10 = c.getLocal("r"); - const t1 = c.i32_add(c.getLocal("r"), c.i32_const(2*n8q)); - const t9 = c.i32_add(c.getLocal("r"), c.i32_const(4*n8q)); - - const zsquared = c.i32_const(module.alloc(f2size)); - const ysquared = c.i32_const(module.alloc(f2size)); - const ztsquared = c.i32_const(module.alloc(f2size)); - const t0 = c.i32_const(module.alloc(f2size)); - const t2 = c.i32_const(module.alloc(f2size)); - const t3 = c.i32_const(module.alloc(f2size)); - const t4 = c.i32_const(module.alloc(f2size)); - const t5 = c.i32_const(module.alloc(f2size)); - const t6 = c.i32_const(module.alloc(f2size)); - const t7 = c.i32_const(module.alloc(f2size)); - const t8 = c.i32_const(module.alloc(f2size)); - - f.addCode( - - // zsquared = r.z.square(); - c.call(f2mPrefix + "_square", Rz, zsquared), - - // ysquared = q.y.square(); - c.call(f2mPrefix + "_square", Qy, ysquared), - - // t0 = zsquared * q.x; - c.call(f2mPrefix + "_mul", zsquared, Qx, t0), - - // t1 = ((q.y + r.z).square() - ysquared - zsquared) * zsquared; - c.call(f2mPrefix + "_add", Qy, Rz, t1), - c.call(f2mPrefix + "_square", t1, t1), - c.call(f2mPrefix + "_sub", t1, ysquared, t1), - c.call(f2mPrefix + "_sub", t1, zsquared, t1), - c.call(f2mPrefix + "_mul", t1, zsquared, t1), - - // t2 = t0 - r.x; - c.call(f2mPrefix + "_sub", t0, Rx, t2), - - // t3 = t2.square(); - c.call(f2mPrefix + "_square", t2, t3), - - // t4 = t3 + t3; - c.call(f2mPrefix + "_add", t3, t3, t4), - - // t4 = t4 + t4; - c.call(f2mPrefix + "_add", t4, t4, t4), - - // t5 = t4 * t2; - c.call(f2mPrefix + "_mul", t4, t2, t5), - - // t6 = t1 - r.y - r.y; - c.call(f2mPrefix + "_sub", t1, Ry, t6), - c.call(f2mPrefix + "_sub", t6, Ry, t6), - - // t9 = t6 * q.x; - c.call(f2mPrefix + "_mul", t6, Qx, t9), - - // t7 = t4 * r.x; - c.call(f2mPrefix + "_mul", t4, Rx, t7), - - // r.x = t6.square() - t5 - t7 - t7; - c.call(f2mPrefix + "_square", t6, Rx), - c.call(f2mPrefix + "_sub", Rx, t5, Rx), - c.call(f2mPrefix + "_sub", Rx, t7, Rx), - c.call(f2mPrefix + "_sub", Rx, t7, Rx), - - // r.z = (r.z + t2).square() - zsquared - t3; - c.call(f2mPrefix + "_add", Rz, t2, Rz), - c.call(f2mPrefix + "_square", Rz, Rz), - c.call(f2mPrefix + "_sub", Rz, zsquared, Rz), - c.call(f2mPrefix + "_sub", Rz, t3, Rz), - - // t10 = q.y + r.z; - c.call(f2mPrefix + "_add", Qy, Rz, t10), - - // t8 = (t7 - r.x) * t6; - c.call(f2mPrefix + "_sub", t7, Rx, t8), - c.call(f2mPrefix + "_mul", t8, t6, t8), - - // t0 = r.y * t5; - c.call(f2mPrefix + "_mul", Ry, t5, t0), - - // t0 = t0 + t0; - c.call(f2mPrefix + "_add", t0, t0, t0), - - // r.y = t8 - t0; - c.call(f2mPrefix + "_sub", t8, t0, Ry), - - // t10 = t10.square() - ysquared; - c.call(f2mPrefix + "_square", t10, t10), - c.call(f2mPrefix + "_sub", t10, ysquared, t10), - - // ztsquared = r.z.square(); - c.call(f2mPrefix + "_square", Rz, ztsquared), - - // t10 = t10 - ztsquared; - c.call(f2mPrefix + "_sub", t10, ztsquared, t10), - - // t9 = t9 + t9 - t10; - c.call(f2mPrefix + "_add", t9, t9, t9), - c.call(f2mPrefix + "_sub", t9, t10, t9), - - // t10 = r.z + r.z; - c.call(f2mPrefix + "_add", Rz, Rz, t10), - - // t6 = -t6; - c.call(f2mPrefix + "_neg", t6, t6), - - // t1 = t6 + t6; - c.call(f2mPrefix + "_add", t6, t6, t1), - ); - } - - - function buildPrepareG2() { - const f = module.addFunction(prefix+ "_prepareG2"); - f.addParam("pQ", "i32"); - f.addParam("ppreQ", "i32"); - f.addLocal("pCoef", "i32"); - f.addLocal("i", "i32"); - - const c = f.getCodeBuilder(); - - - const Q = c.getLocal("pQ"); - - const pR = module.alloc(f2size*3); - const R = c.i32_const(pR); - - const base = c.getLocal("ppreQ"); - - f.addCode( - c.call(g2mPrefix + "_normalize", Q, base), - c.if( - c.call(g2mPrefix + "_isZero", base), - c.ret([]) - ), - c.call(g2mPrefix + "_copy", base, R), - c.setLocal("pCoef", c.i32_add(c.getLocal("ppreQ"), c.i32_const(f2size*3))), - ); - - f.addCode( - c.setLocal("i", c.i32_const(ateLoopBitBytes.length-2)), - c.block(c.loop( - - c.call(prefix + "_prepDblStep", R, c.getLocal("pCoef")), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - c.if( - c.i32_load8_s(c.getLocal("i"), pAteLoopBitBytes), - [ - ...c.call(prefix + "_prepAddStep", R, base, c.getLocal("pCoef")), - ...c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - ] - ), - c.br_if(1, c.i32_eqz ( c.getLocal("i") )), - c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - ); - } - - - function buildF6Mul1() { - const f = module.addFunction(f6mPrefix+ "_mul1"); - f.addParam("pA", "i32"); // F6 - f.addParam("pC1", "i32"); // F2 - f.addParam("pR", "i32"); // F6 - - const c = f.getCodeBuilder(); - - const A_c0 = c.getLocal("pA"); - const A_c1 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*2)); - const A_c2 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*4)); - - const c1 = c.getLocal("pC1"); - - const t1 = c.getLocal("pR"); - const t2 = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*2)); - const b_b = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*4)); - - const Ac0_Ac1 = c.i32_const(module.alloc(f1size*2)); - const Ac1_Ac2 = c.i32_const(module.alloc(f1size*2)); - - f.addCode( - - c.call(f2mPrefix + "_add", A_c0, A_c1, Ac0_Ac1), - c.call(f2mPrefix + "_add", A_c1, A_c2, Ac1_Ac2), - - // let b_b = self.c1 * c1; - c.call(f2mPrefix + "_mul", A_c1, c1, b_b), - - // let t1 = (self.c1 + self.c2) * c1 - b_b; - c.call(f2mPrefix + "_mul", Ac1_Ac2, c1, t1), - c.call(f2mPrefix + "_sub", t1, b_b, t1), - - // let t1 = t1.mul_by_nonresidue(); - c.call(f2mPrefix + "_mulNR", t1, t1), - - // let t2 = (self.c0 + self.c1) * c1 - b_b; - c.call(f2mPrefix + "_mul", Ac0_Ac1, c1, t2), - c.call(f2mPrefix + "_sub", t2, b_b, t2), - ); - } - buildF6Mul1(); - - function buildF6Mul01() { - const f = module.addFunction(f6mPrefix+ "_mul01"); - f.addParam("pA", "i32"); // F6 - f.addParam("pC0", "i32"); // F2 - f.addParam("pC1", "i32"); // F2 - f.addParam("pR", "i32"); // F6 - - const c = f.getCodeBuilder(); - - const A_c0 = c.getLocal("pA"); - const A_c1 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*2)); - const A_c2 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*4)); - - const c0 = c.getLocal("pC0"); - const c1 = c.getLocal("pC1"); - - const t1 = c.getLocal("pR"); - const t2 = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*2)); - const t3 = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*4)); - - const a_a = c.i32_const(module.alloc(f1size*2)); - const b_b = c.i32_const(module.alloc(f1size*2)); - const Ac0_Ac1 = c.i32_const(module.alloc(f1size*2)); - const Ac0_Ac2 = c.i32_const(module.alloc(f1size*2)); - - f.addCode( - // let a_a = self.c0 * c0; - c.call(f2mPrefix + "_mul", A_c0, c0, a_a), - - // let b_b = self.c1 * c1; - c.call(f2mPrefix + "_mul", A_c1, c1, b_b), - - - c.call(f2mPrefix + "_add", A_c0, A_c1, Ac0_Ac1), - c.call(f2mPrefix + "_add", A_c0, A_c2, Ac0_Ac2), - - // let t1 = (self.c1 + self.c2) * c1 - b_b; - c.call(f2mPrefix + "_add", A_c1, A_c2, t1), - c.call(f2mPrefix + "_mul", t1, c1, t1), - c.call(f2mPrefix + "_sub", t1, b_b, t1), - - // let t1 = t1.mul_by_nonresidue() + a_a; - c.call(f2mPrefix + "_mulNR", t1, t1), - c.call(f2mPrefix + "_add", t1, a_a, t1), - - // let t2 = (c0 + c1) * (self.c0 + self.c1) - a_a - b_b; - c.call(f2mPrefix + "_add", c0, c1, t2), - c.call(f2mPrefix + "_mul", t2, Ac0_Ac1, t2), - c.call(f2mPrefix + "_sub", t2, a_a, t2), - c.call(f2mPrefix + "_sub", t2, b_b, t2), - - // let t3 = (self.c0 + self.c2) * c0 - a_a + b_b; - c.call(f2mPrefix + "_mul", Ac0_Ac2, c0, t3), - c.call(f2mPrefix + "_sub", t3, a_a, t3), - c.call(f2mPrefix + "_add", t3, b_b, t3), - - - ); - } - buildF6Mul01(); - - - function buildF12Mul014() { - - const f = module.addFunction(ftmPrefix+ "_mul014"); - f.addParam("pA", "i32"); // F12 - f.addParam("pC0", "i32"); // F2 - f.addParam("pC1", "i32"); // F2 - f.addParam("pC4", "i32"); // F2 - f.addParam("pR", "i32"); // F12 - - const c = f.getCodeBuilder(); - - - const A_c0 = c.getLocal("pA"); - const A_c1 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*6)); - - const c0 = c.getLocal("pC0"); - const c1 = c.getLocal("pC1"); - const c4 = c.getLocal("pC4"); - - const aa = c.i32_const(module.alloc(f1size*6)); - const bb = c.i32_const(module.alloc(f1size*6)); - const o = c.i32_const(module.alloc(f1size*2)); - - const R_c0 = c.getLocal("pR"); - const R_c1 = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*6)); - - f.addCode( - // let aa = self.c0.mul_by_01(c0, c1); - c.call(f6mPrefix + "_mul01", A_c0, c0, c1, aa), - - // let bb = self.c1.mul_by_1(c4); - c.call(f6mPrefix + "_mul1", A_c1, c4, bb), - - // let o = c1 + c4; - c.call(f2mPrefix + "_add", c1, c4, o), - - // let c1 = self.c1 + self.c0; - c.call(f6mPrefix + "_add", A_c1, A_c0, R_c1), - - // let c1 = c1.mul_by_01(c0, &o); - c.call(f6mPrefix + "_mul01", R_c1, c0, o, R_c1), - - // let c1 = c1 - aa - bb; - c.call(f6mPrefix + "_sub", R_c1, aa, R_c1), - c.call(f6mPrefix + "_sub", R_c1, bb, R_c1), - - // let c0 = bb; - c.call(f6mPrefix + "_copy", bb, R_c0), - - // let c0 = c0.mul_by_nonresidue(); - c.call(f6mPrefix + "_mulNR", R_c0, R_c0), - - // let c0 = c0 + aa; - c.call(f6mPrefix + "_add", R_c0, aa, R_c0), - ); - } - buildF12Mul014(); - - - function buildELL() { - const f = module.addFunction(prefix+ "_ell"); - f.addParam("pP", "i32"); - f.addParam("pCoefs", "i32"); - f.addParam("pF", "i32"); - - const c = f.getCodeBuilder(); - - const Px = c.getLocal("pP"); - const Py = c.i32_add(c.getLocal("pP"), c.i32_const(n8q)); - - const F = c.getLocal("pF"); - - const coef0_0 = c.getLocal("pCoefs"); - const coef0_1 = c.i32_add(c.getLocal("pCoefs"), c.i32_const(f1size)); - const coef1_0 = c.i32_add(c.getLocal("pCoefs"), c.i32_const(f1size*2)); - const coef1_1 = c.i32_add(c.getLocal("pCoefs"), c.i32_const(f1size*3)); - const coef2 = c.i32_add(c.getLocal("pCoefs"), c.i32_const(f1size*4)); - - const pc0 = module.alloc(f1size*2); - const c0 = c.i32_const(pc0); - const c0_c0 = c.i32_const(pc0); - const c0_c1 = c.i32_const(pc0+f1size); - - const pc1 = module.alloc(f1size*2); - const c1 = c.i32_const(pc1); - const c1_c0 = c.i32_const(pc1); - const c1_c1 = c.i32_const(pc1+f1size); - f.addCode( - // let mut c0 = coeffs.0; - // let mut c1 = coeffs.1; - // - // c0.c0 *= p.y; - // c0.c1 *= p.y; - // - // c1.c0 *= p.x; - // c1.c1 *= p.x; - // - // f.mul_by_014(&coeffs.2, &c1, &c0) - - c.call(f1mPrefix + "_mul", coef0_0, Py, c0_c0), - c.call(f1mPrefix + "_mul", coef0_1, Py, c0_c1), - c.call(f1mPrefix + "_mul", coef1_0, Px, c1_c0), - c.call(f1mPrefix + "_mul", coef1_1, Px, c1_c1), - - c.call(ftmPrefix + "_mul014", F, coef2, c1, c0, F), - - ); - - } - buildELL(); - - function buildMillerLoop() { - const f = module.addFunction(prefix+ "_millerLoop"); - f.addParam("ppreP", "i32"); - f.addParam("ppreQ", "i32"); - f.addParam("r", "i32"); - f.addLocal("pCoef", "i32"); - f.addLocal("i", "i32"); - - const c = f.getCodeBuilder(); - - const preP = c.getLocal("ppreP"); - const preQ = c.getLocal("ppreQ"); - - const coefs = c.getLocal("pCoef"); - - const F = c.getLocal("r"); - - - f.addCode( - c.call(ftmPrefix + "_one", F), - - c.if( - c.call(g1mPrefix + "_isZero", preP), - c.ret([]) - ), - c.if( - c.call(g1mPrefix + "_isZero", c.getLocal("ppreQ")), - c.ret([]) - ), - c.setLocal("pCoef", c.i32_add( c.getLocal("ppreQ"), c.i32_const(f2size*3))), - - c.setLocal("i", c.i32_const(ateLoopBitBytes.length-2)), - c.block(c.loop( - - - c.call(prefix + "_ell", preP, coefs, F), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - c.if( - c.i32_load8_s(c.getLocal("i"), pAteLoopBitBytes), - [ - ...c.call(prefix + "_ell", preP, coefs, F), - ...c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - ] - ), - c.call(ftmPrefix + "_square", F, F), - - c.br_if(1, c.i32_eq ( c.getLocal("i"), c.i32_const(1) )), - c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )), - c.call(prefix + "_ell", preP, coefs, F), - - ); - - - if (isLoopNegative) { - f.addCode( - c.call(ftmPrefix + "_conjugate", F, F), - ); - } - } - - - function buildFrobeniusMap(n) { - const F12 = [ - [ - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - ], - [ - [bigInt("1"), bigInt("0")], - [bigInt("3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760"), bigInt("151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027")], - [bigInt("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351"), bigInt("0")], - [bigInt("2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530"), bigInt("1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257")], - [bigInt("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350"), bigInt("0")], - [bigInt("3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557"), bigInt("877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230")], - [bigInt("4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786"), bigInt("0")], - [bigInt("151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027"), bigInt("3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760")], - [bigInt("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436"), bigInt("0")], - [bigInt("1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257"), bigInt("2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530")], - [bigInt("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437"), bigInt("0")], - [bigInt("877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230"), bigInt("3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557")], - ] - ]; - - const F6 = [ - [ - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - ], - [ - [bigInt("1"), bigInt("0")], - [bigInt("0"), bigInt("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436")], - [bigInt("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350"), bigInt("0")], - [bigInt("0"), bigInt("1")], - [bigInt("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436"), bigInt("0")], - [bigInt("0"), bigInt("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350")], - ], - [ - [bigInt("1"), bigInt("0")], - [bigInt("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437"), bigInt("0")], - [bigInt("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436"), bigInt("0")], - [bigInt("4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786"), bigInt("0")], - [bigInt("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350"), bigInt("0")], - [bigInt("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351"), bigInt("0")], - ] - ]; - - const f = module.addFunction(ftmPrefix + "_frobeniusMap"+n); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - for (let i=0; i<6; i++) { - const X = (i==0) ? c.getLocal("x") : c.i32_add(c.getLocal("x"), c.i32_const(i*f2size)); - const Xc0 = X; - const Xc1 = c.i32_add(c.getLocal("x"), c.i32_const(i*f2size + f1size)); - const R = (i==0) ? c.getLocal("r") : c.i32_add(c.getLocal("r"), c.i32_const(i*f2size)); - const Rc0 = R; - const Rc1 = c.i32_add(c.getLocal("r"), c.i32_const(i*f2size + f1size)); - const coef = mul2(F12[Math.floor(i/3)][n%12] , F6[i%3][n%6]); - const pCoef = module.alloc([ - ...utils.bigInt2BytesLE(toMontgomery(coef[0]), n8q), - ...utils.bigInt2BytesLE(toMontgomery(coef[1]), n8q), - ]); - if (n%2 == 1) { - f.addCode( - c.call(f1mPrefix + "_copy", Xc0, Rc0), - c.call(f1mPrefix + "_neg", Xc1, Rc1), - c.call(f2mPrefix + "_mul", R, c.i32_const(pCoef), R), - ); - } else { - f.addCode(c.call(f2mPrefix + "_mul", X, c.i32_const(pCoef), R)); - } - } - - function mul2(a, b) { - const ac0 = bigInt(a[0]); - const ac1 = bigInt(a[1]); - const bc0 = bigInt(b[0]); - const bc1 = bigInt(b[1]); - const res = [ - ac0.times(bc0).minus( ac1.times(bc1) ).mod(q), - ac0.times(bc1).add( ac1.times(bc0) ).mod(q), - ]; - if (res[0].isNegative()) res[0] = res[0].add(q); - return res; - } - - } - - - function buildCyclotomicSquare() { - const f = module.addFunction(prefix+ "__cyclotomicSquare"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x4 = c.i32_add(c.getLocal("x"), c.i32_const(f2size)); - const x3 = c.i32_add(c.getLocal("x"), c.i32_const(2*f2size)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(3*f2size)); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(4*f2size)); - const x5 = c.i32_add(c.getLocal("x"), c.i32_const(5*f2size)); - - const r0 = c.getLocal("r"); - const r4 = c.i32_add(c.getLocal("r"), c.i32_const(f2size)); - const r3 = c.i32_add(c.getLocal("r"), c.i32_const(2*f2size)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(3*f2size)); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(4*f2size)); - const r5 = c.i32_add(c.getLocal("r"), c.i32_const(5*f2size)); - - const t0 = c.i32_const(module.alloc(f2size)); - const t1 = c.i32_const(module.alloc(f2size)); - const t2 = c.i32_const(module.alloc(f2size)); - const t3 = c.i32_const(module.alloc(f2size)); - const t4 = c.i32_const(module.alloc(f2size)); - const t5 = c.i32_const(module.alloc(f2size)); - const tmp = c.i32_const(module.alloc(f2size)); - const AUX = c.i32_const(module.alloc(f2size)); - - - f.addCode( - -// c.call(ftmPrefix + "_square", x0, r0), - - // // t0 + t1*y = (z0 + z1*y)^2 = a^2 - // tmp = z0 * z1; - // t0 = (z0 + z1) * (z0 + my_Fp6::non_residue * z1) - tmp - my_Fp6::non_residue * tmp; - // t1 = tmp + tmp; - c.call(f2mPrefix + "_mul", x0, x1, tmp), - c.call(f2mPrefix + "_mulNR", x1, t0), - c.call(f2mPrefix + "_add", x0, t0, t0), - c.call(f2mPrefix + "_add", x0, x1, AUX), - c.call(f2mPrefix + "_mul", AUX, t0, t0), - c.call(f2mPrefix + "_mulNR", tmp, AUX), - c.call(f2mPrefix + "_add", tmp, AUX, AUX), - c.call(f2mPrefix + "_sub", t0, AUX, t0), - c.call(f2mPrefix + "_add", tmp, tmp, t1), - - // // t2 + t3*y = (z2 + z3*y)^2 = b^2 - // tmp = z2 * z3; - // t2 = (z2 + z3) * (z2 + my_Fp6::non_residue * z3) - tmp - my_Fp6::non_residue * tmp; - // t3 = tmp + tmp; - c.call(f2mPrefix + "_mul", x2, x3, tmp), - c.call(f2mPrefix + "_mulNR", x3, t2), - c.call(f2mPrefix + "_add", x2, t2, t2), - c.call(f2mPrefix + "_add", x2, x3, AUX), - c.call(f2mPrefix + "_mul", AUX, t2, t2), - c.call(f2mPrefix + "_mulNR", tmp, AUX), - c.call(f2mPrefix + "_add", tmp, AUX, AUX), - c.call(f2mPrefix + "_sub", t2, AUX, t2), - c.call(f2mPrefix + "_add", tmp, tmp, t3), - - // // t4 + t5*y = (z4 + z5*y)^2 = c^2 - // tmp = z4 * z5; - // t4 = (z4 + z5) * (z4 + my_Fp6::non_residue * z5) - tmp - my_Fp6::non_residue * tmp; - // t5 = tmp + tmp; - c.call(f2mPrefix + "_mul", x4, x5, tmp), - c.call(f2mPrefix + "_mulNR", x5, t4), - c.call(f2mPrefix + "_add", x4, t4, t4), - c.call(f2mPrefix + "_add", x4, x5, AUX), - c.call(f2mPrefix + "_mul", AUX, t4, t4), - c.call(f2mPrefix + "_mulNR", tmp, AUX), - c.call(f2mPrefix + "_add", tmp, AUX, AUX), - c.call(f2mPrefix + "_sub", t4, AUX, t4), - c.call(f2mPrefix + "_add", tmp, tmp, t5), - - // For A - // z0 = 3 * t0 - 2 * z0 - c.call(f2mPrefix + "_sub", t0, x0, r0), - c.call(f2mPrefix + "_add", r0, r0, r0), - c.call(f2mPrefix + "_add", t0, r0, r0), - // z1 = 3 * t1 + 2 * z1 - c.call(f2mPrefix + "_add", t1, x1, r1), - c.call(f2mPrefix + "_add", r1, r1, r1), - c.call(f2mPrefix + "_add", t1, r1, r1), - - // For B - // z2 = 3 * (xi * t5) + 2 * z2 - c.call(f2mPrefix + "_mul", t5, c.i32_const(pBls12381Twist), AUX), - c.call(f2mPrefix + "_add", AUX, x2, r2), - c.call(f2mPrefix + "_add", r2, r2, r2), - c.call(f2mPrefix + "_add", AUX, r2, r2), - // z3 = 3 * t4 - 2 * z3 - c.call(f2mPrefix + "_sub", t4, x3, r3), - c.call(f2mPrefix + "_add", r3, r3, r3), - c.call(f2mPrefix + "_add", t4, r3, r3), - - // For C - // z4 = 3 * t2 - 2 * z4 - c.call(f2mPrefix + "_sub", t2, x4, r4), - c.call(f2mPrefix + "_add", r4, r4, r4), - c.call(f2mPrefix + "_add", t2, r4, r4), - // z5 = 3 * t3 + 2 * z5 - c.call(f2mPrefix + "_add", t3, x5, r5), - c.call(f2mPrefix + "_add", r5, r5, r5), - c.call(f2mPrefix + "_add", t3, r5, r5), - - ); - } - - - function buildCyclotomicExp(exponent, isExpNegative, fnName) { - const exponentNafBytes = naf(exponent).map( (b) => (b==-1 ? 0xFF: b) ); - const pExponentNafBytes = module.alloc(exponentNafBytes); - // const pExponent = module.alloc(utils.bigInt2BytesLE(exponent, n8)); - - const f = module.addFunction(prefix+ "__cyclotomicExp_"+fnName); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - f.addLocal("bit", "i32"); - f.addLocal("i", "i32"); - - const c = f.getCodeBuilder(); - - const x = c.getLocal("x"); - - const res = c.getLocal("r"); - - const inverse = c.i32_const(module.alloc(ftsize)); - - - f.addCode( -// c.call(ftmPrefix + "_exp", x, c.i32_const(pExponent), c.i32_const(32), res), - - c.call(ftmPrefix + "_conjugate", x, inverse), - c.call(ftmPrefix + "_one", res), - - c.if( - c.teeLocal("bit", c.i32_load8_s(c.i32_const(exponentNafBytes.length-1), pExponentNafBytes)), - c.if( - c.i32_eq( - c.getLocal("bit"), - c.i32_const(1) - ), - c.call(ftmPrefix + "_mul", res, x, res), - c.call(ftmPrefix + "_mul", res, inverse, res), - ) - ), - - c.setLocal("i", c.i32_const(exponentNafBytes.length-2)), - c.block(c.loop( -// c.call(ftmPrefix + "_square", res, res), - c.call(prefix + "__cyclotomicSquare", res, res), - c.if( - c.teeLocal("bit", c.i32_load8_s(c.getLocal("i"), pExponentNafBytes)), - c.if( - c.i32_eq( - c.getLocal("bit"), - c.i32_const(1) - ), - c.call(ftmPrefix + "_mul", res, x, res), - c.call(ftmPrefix + "_mul", res, inverse, res), - ) - ), - c.br_if(1, c.i32_eqz ( c.getLocal("i") )), - c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - ); - - if (isExpNegative) { - f.addCode( - c.call(ftmPrefix + "_conjugate", res, res), - ); - } - - } - - function buildFinalExponentiation() { - buildCyclotomicSquare(); - buildCyclotomicExp(finalExpZ, finalExpIsNegative, "w0"); - - const f = module.addFunction(prefix+ "_finalExponentiation"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const elt = c.getLocal("x"); - const res = c.getLocal("r"); - const t0 = c.i32_const(module.alloc(ftsize)); - const t1 = c.i32_const(module.alloc(ftsize)); - const t2 = c.i32_const(module.alloc(ftsize)); - const t3 = c.i32_const(module.alloc(ftsize)); - const t4 = c.i32_const(module.alloc(ftsize)); - const t5 = c.i32_const(module.alloc(ftsize)); - const t6 = c.i32_const(module.alloc(ftsize)); - - f.addCode( - - // let mut t0 = f.frobenius_map(6) - c.call(ftmPrefix + "_frobeniusMap6", elt, t0), - - // let t1 = f.invert() - c.call(ftmPrefix + "_inverse", elt, t1), - - // let mut t2 = t0 * t1; - c.call(ftmPrefix + "_mul", t0, t1, t2), - - // t1 = t2.clone(); - c.call(ftmPrefix + "_copy", t2, t1), - - // t2 = t2.frobenius_map().frobenius_map(); - c.call(ftmPrefix + "_frobeniusMap2", t2, t2), - - // t2 *= t1; - c.call(ftmPrefix + "_mul", t2, t1, t2), - - - // t1 = cyclotomic_square(t2).conjugate(); - c.call(prefix + "__cyclotomicSquare", t2, t1), - c.call(ftmPrefix + "_conjugate", t1, t1), - - // let mut t3 = cycolotomic_exp(t2); - c.call(prefix + "__cyclotomicExp_w0", t2, t3), - - // let mut t4 = cyclotomic_square(t3); - c.call(prefix + "__cyclotomicSquare", t3, t4), - - // let mut t5 = t1 * t3; - c.call(ftmPrefix + "_mul", t1, t3, t5), - - // t1 = cycolotomic_exp(t5); - c.call(prefix + "__cyclotomicExp_w0", t5, t1), - - // t0 = cycolotomic_exp(t1); - c.call(prefix + "__cyclotomicExp_w0", t1, t0), - - // let mut t6 = cycolotomic_exp(t0); - c.call(prefix + "__cyclotomicExp_w0", t0, t6), - - // t6 *= t4; - c.call(ftmPrefix + "_mul", t6, t4, t6), - - // t4 = cycolotomic_exp(t6); - c.call(prefix + "__cyclotomicExp_w0", t6, t4), - - // t5 = t5.conjugate(); - c.call(ftmPrefix + "_conjugate", t5, t5), - - // t4 *= t5 * t2; - c.call(ftmPrefix + "_mul", t4, t5, t4), - c.call(ftmPrefix + "_mul", t4, t2, t4), - - // t5 = t2.conjugate(); - c.call(ftmPrefix + "_conjugate", t2, t5), - - // t1 *= t2; - c.call(ftmPrefix + "_mul", t1, t2, t1), - - // t1 = t1.frobenius_map().frobenius_map().frobenius_map(); - c.call(ftmPrefix + "_frobeniusMap3", t1, t1), - - // t6 *= t5; - c.call(ftmPrefix + "_mul", t6, t5, t6), - - // t6 = t6.frobenius_map(); - c.call(ftmPrefix + "_frobeniusMap1", t6, t6), - - // t3 *= t0; - c.call(ftmPrefix + "_mul", t3, t0, t3), - - // t3 = t3.frobenius_map().frobenius_map(); - c.call(ftmPrefix + "_frobeniusMap2", t3, t3), - - // t3 *= t1; - c.call(ftmPrefix + "_mul", t3, t1, t3), - - // t3 *= t6; - c.call(ftmPrefix + "_mul", t3, t6, t3), - - // f = t3 * t4; - c.call(ftmPrefix + "_mul", t3, t4, res), - - ); - } - - - function buildFinalExponentiationOld() { - const f = module.addFunction(prefix+ "_finalExponentiationOld"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const exponent = bigInt("322277361516934140462891564586510139908379969514828494218366688025288661041104682794998680497580008899973249814104447692778988208376779573819485263026159588510513834876303014016798809919343532899164848730280942609956670917565618115867287399623286813270357901731510188149934363360381614501334086825442271920079363289954510565375378443704372994881406797882676971082200626541916413184642520269678897559532260949334760604962086348898118982248842634379637598665468817769075878555493752214492790122785850202957575200176084204422751485957336465472324810982833638490904279282696134323072515220044451592646885410572234451732790590013479358343841220074174848221722017083597872017638514103174122784843925578370430843522959600095676285723737049438346544753168912974976791528535276317256904336520179281145394686565050419250614107803233314658825463117900250701199181529205942363159325765991819433914303908860460720581408201373164047773794825411011922305820065611121544561808414055302212057471395719432072209245600258134364584636810093520285711072578721435517884103526483832733289802426157301542744476740008494780363354305116978805620671467071400711358839553375340724899735460480144599782014906586543813292157922220645089192130209334926661588737007768565838519456601560804957985667880395221049249803753582637708560"); - - const pExponent = module.alloc(utils.bigInt2BytesLE( exponent, 544 )); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call(ftmPrefix + "_exp", c.getLocal("x"), c.i32_const(pExponent), c.i32_const(544), c.getLocal("r")), - ); - } - - - const pPreP = module.alloc(prePSize); - const pPreQ = module.alloc(preQSize); - - function buildPairingEquation(nPairings) { - - const f = module.addFunction(prefix+ "_pairingEq"+nPairings); - for (let i=0; i { - -const bigInt = __webpack_require__(2096); -const utils = __webpack_require__(2333); - -const buildF1m =__webpack_require__(75); -const buildF1 =__webpack_require__(8138); -const buildF2m =__webpack_require__(5420); -const buildF3m =__webpack_require__(7173); -const buildCurve =__webpack_require__(5904); -const buildFFT = __webpack_require__(3911); -const buildPol = __webpack_require__(2896); -const buildQAP = __webpack_require__(637); -const buildApplyKey = __webpack_require__(3320); - -module.exports = function buildBN128(module, _prefix) { - - const prefix = _prefix || "bn128"; - - if (module.modules[prefix]) return prefix; // already builded - - const q = bigInt("21888242871839275222246405745257275088696311157297823662689037894645226208583"); - const r = bigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617"); - - - const n64 = Math.floor((q.minus(1).bitLength() - 1)/64) +1; - const n8 = n64*8; - const frsize = n8; - const f1size = n8; - const f2size = f1size * 2; - const f6size = f1size * 6; - const ftsize = f1size * 12; - - const pr = module.alloc(utils.bigInt2BytesLE( r, frsize )); - - const f1mPrefix = buildF1m(module, q, "f1m"); - buildF1(module, r, "fr", "frm"); - - const pG1b = module.alloc(utils.bigInt2BytesLE( toMontgomery(bigInt(3)), f1size )); - const g1mPrefix = buildCurve(module, "g1m", "f1m", pG1b); - - buildFFT(module, "frm", "frm", "frm", "frm_mul"); - - buildPol(module, "pol", "frm"); - buildQAP(module, "qap", "frm"); - - const f2mPrefix = buildF2m(module, "f1m_neg", "f2m", "f1m"); - const pG2b = module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery(bigInt("19485874751759354771024239261021720505790618469301721065564631296452457478373")), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(bigInt("266929791119991161246907387137283842545076965332900288569378510910307636690")), f1size ) - ]); - const g2mPrefix = buildCurve(module, "g2m", "f2m", pG2b); - - - function buildGTimesFr(fnName, opMul) { - const f = module.addFunction(fnName); - f.addParam("pG", "i32"); - f.addParam("pFr", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - const AUX = c.i32_const(module.alloc(n8)); - - f.addCode( - c.call("frm_fromMontgomery", c.getLocal("pFr"), AUX), - c.call( - opMul, - c.getLocal("pG"), - AUX, - c.i32_const(n8), - c.getLocal("pr") - ) - ); - - module.exportFunction(fnName); - } - buildGTimesFr("g1m_timesFr", "g1m_timesScalar"); - buildFFT(module, "g1m", "g1m", "frm", "g1m_timesFr"); - - buildGTimesFr("g2m_timesFr", "g2m_timesScalar"); - buildFFT(module, "g2m", "g2m", "frm", "g2m_timesFr"); - - buildGTimesFr("g1m_timesFrAffine", "g1m_timesScalarAffine"); - buildGTimesFr("g2m_timesFrAffine", "g2m_timesScalarAffine"); - - buildApplyKey(module, "frm_batchApplyKey", "fmr", "frm", n8, n8, n8, "frm_mul"); - buildApplyKey(module, "g1m_batchApplyKey", "g1m", "frm", n8*3, n8*3, n8, "g1m_timesFr"); - buildApplyKey(module, "g1m_batchApplyKeyMixed", "g1m", "frm", n8*2, n8*3, n8, "g1m_timesFrAffine"); - buildApplyKey(module, "g2m_batchApplyKey", "g2m", "frm", n8*2*3, n8*3*2, n8, "g2m_timesFr"); - buildApplyKey(module, "g2m_batchApplyKeyMixed", "g2m", "frm", n8*2*2, n8*3*2, n8, "g2m_timesFrAffine"); - - function toMontgomery(a) { - return bigInt(a).times( bigInt.one.shiftLeft(f1size*8)).mod(q); - } - - const G1gen = [ - bigInt("1"), - bigInt("2"), - bigInt.one - ]; - - const pG1gen = module.alloc( - [ - ...utils.bigInt2BytesLE( toMontgomery(G1gen[0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G1gen[1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G1gen[2]), f1size ), - ] - ); - - const G1zero = [ - bigInt.zero, - bigInt.one, - bigInt.zero - ]; - - const pG1zero = module.alloc( - [ - ...utils.bigInt2BytesLE( toMontgomery(G1zero[0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G1zero[1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G1zero[2]), f1size ) - ] - ); - - const G2gen = [ - [ - bigInt("10857046999023057135944570762232829481370756359578518086990519993285655852781"), - bigInt("11559732032986387107991004021392285783925812861821192530917403151452391805634"), - ],[ - bigInt("8495653923123431417604973247489272438418190587263600148770280649306958101930"), - bigInt("4082367875863433681332203403145435568316851327593401208105741076214120093531"), - ],[ - bigInt.one, - bigInt.zero, - ] - ]; - - const pG2gen = module.alloc( - [ - ...utils.bigInt2BytesLE( toMontgomery(G2gen[0][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2gen[0][1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2gen[1][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2gen[1][1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2gen[2][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2gen[2][1]), f1size ), - ] - ); - - const G2zero = [ - [ - bigInt.zero, - bigInt.zero, - ],[ - bigInt.one, - bigInt.zero, - ],[ - bigInt.zero, - bigInt.zero, - ] - ]; - - const pG2zero = module.alloc( - [ - ...utils.bigInt2BytesLE( toMontgomery(G2zero[0][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2zero[0][1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2zero[1][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2zero[1][1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2zero[2][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2zero[2][1]), f1size ), - ] - ); - - const pOneT = module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery(1), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ]); - - const pNonResidueF6 = module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery(9), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(1), f1size ), - ]); - - const pTwoInv = module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery( bigInt(2).modInv(q)), f1size ), - ...utils.bigInt2BytesLE( bigInt(0), f1size ) - ]); - - const pAltBn128Twist = pNonResidueF6; - - const pTwistCoefB = module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery("19485874751759354771024239261021720505790618469301721065564631296452457478373"), f1size ), - ...utils.bigInt2BytesLE( toMontgomery("266929791119991161246907387137283842545076965332900288569378510910307636690"), f1size ), - ]); - - function build_mulNR6() { - const f = module.addFunction(prefix + "_mulNR6"); - f.addParam("x", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call( - f2mPrefix + "_mul", - c.i32_const(pNonResidueF6), - c.getLocal("x"), - c.getLocal("pr") - ) - ); - } - build_mulNR6(); - - const f6mPrefix = buildF3m(module, prefix+"_mulNR6", "f6m", "f2m"); - - function build_mulNR12() { - const f = module.addFunction(prefix + "_mulNR12"); - f.addParam("x", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call( - f2mPrefix + "_mul", - c.i32_const(pNonResidueF6), - c.i32_add(c.getLocal("x"), c.i32_const(n8*4)), - c.getLocal("pr") - ), - c.call( - f2mPrefix + "_copy", - c.getLocal("x"), - c.i32_add(c.getLocal("pr"), c.i32_const(n8*2)), - ), - c.call( - f2mPrefix + "_copy", - c.i32_add(c.getLocal("x"), c.i32_const(n8*2)), - c.i32_add(c.getLocal("pr"), c.i32_const(n8*4)), - ) - ); - } - build_mulNR12(); - - const ftmPrefix = buildF2m(module, prefix+"_mulNR12", "ftm", f6mPrefix); - - - const ateLoopCount = bigInt("29793968203157093288"); - const ateLoopBitBytes = bits(ateLoopCount); - const pAteLoopBitBytes = module.alloc(ateLoopBitBytes); - const isLoopNegative = false; - - const ateCoefSize = 3 * f2size; - const ateNDblCoefs = ateLoopBitBytes.length-1; - const ateNAddCoefs = ateLoopBitBytes.reduce((acc, b) => acc + ( b!=0 ? 1 : 0) ,0); - const ateNCoefs = ateNAddCoefs + ateNDblCoefs + 1; - const prePSize = 3*2*n8; - const preQSize = 3*n8*2 + ateNCoefs*ateCoefSize; - const finalExpIsNegative = false; - - - module.modules[prefix] = { - n64: n64, - pG1gen: pG1gen, - pG1zero: pG1zero, - pG1b: pG1b, - pG2gen: pG2gen, - pG2zero: pG2zero, - pG2b: pG2b, - pq: module.modules["f1m"].pq, - pr: pr, - pOneT: pOneT, - prePSize: prePSize, - preQSize: preQSize, - r: r.toString(), - q: q.toString() - }; - - // console.log("PrePSize: " +prePSize); - // console.log("PreQSize: " +preQSize); - - const finalExpZ = bigInt("4965661367192848881"); - - function naf(n) { - let E = n; - const res = []; - while (E.gt(bigInt.zero)) { - if (E.isOdd()) { - const z = 2 - E.mod(4).toJSNumber(); - res.push( z ); - E = E.minus(z); - } else { - res.push( 0 ); - } - E = E.shiftRight(1); - } - return res; - } - - function bits(n) { - let E = n; - const res = []; - while (E.gt(bigInt.zero)) { - if (E.isOdd()) { - res.push( 1 ); - } else { - res.push( 0 ); - } - E = E.shiftRight(1); - } - return res; - } - - function buildPrepareG1() { - const f = module.addFunction(prefix+ "_prepareG1"); - f.addParam("pP", "i32"); - f.addParam("ppreP", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call(g1mPrefix + "_normalize", c.getLocal("pP"), c.getLocal("ppreP")), // TODO Remove if already in affine - ); - } - - function buildPrepAddStep() { - const f = module.addFunction(prefix+ "_prepAddStep"); - f.addParam("pQ", "i32"); - f.addParam("pR", "i32"); - f.addParam("pCoef", "i32"); - - const c = f.getCodeBuilder(); - - const X2 = c.getLocal("pQ"); - const Y2 = c.i32_add(c.getLocal("pQ"), c.i32_const(f2size)); - - const X1 = c.getLocal("pR"); - const Y1 = c.i32_add(c.getLocal("pR"), c.i32_const(f2size)); - const Z1 = c.i32_add(c.getLocal("pR"), c.i32_const(2*f2size)); - - const ELL_0 = c.getLocal("pCoef"); - const ELL_VW = c.i32_add(c.getLocal("pCoef"), c.i32_const(f2size)); - const ELL_VV = c.i32_add(c.getLocal("pCoef"), c.i32_const(2*f2size)); - - const D = ELL_VW; - const E = c.i32_const(module.alloc(f2size)); - const F = c.i32_const(module.alloc(f2size)); - const G = c.i32_const(module.alloc(f2size)); - const H = c.i32_const(module.alloc(f2size)); - const I = c.i32_const(module.alloc(f2size)); - const J = c.i32_const(module.alloc(f2size)); - const AUX = c.i32_const(module.alloc(f2size)); - - f.addCode( - // D = X1 - X2*Z1 - c.call(f2mPrefix + "_mul", X2, Z1, D), - c.call(f2mPrefix + "_sub", X1, D, D), - - // E = Y1 - Y2*Z1 - c.call(f2mPrefix + "_mul", Y2, Z1, E), - c.call(f2mPrefix + "_sub", Y1, E, E), - - // F = D^2 - c.call(f2mPrefix + "_square", D, F), - - // G = E^2 - c.call(f2mPrefix + "_square", E, G), - - // H = D*F - c.call(f2mPrefix + "_mul", D, F, H), - - // I = X1 * F - c.call(f2mPrefix + "_mul", X1, F, I), - - // J = H + Z1*G - (I+I) - c.call(f2mPrefix + "_add", I, I, AUX), - c.call(f2mPrefix + "_mul", Z1, G, J), - c.call(f2mPrefix + "_add", H, J, J), - c.call(f2mPrefix + "_sub", J, AUX, J), - - - // X3 (X1) = D*J - c.call(f2mPrefix + "_mul", D, J, X1), - - // Y3 (Y1) = E*(I-J)-(H*Y1) - c.call(f2mPrefix + "_mul", H, Y1, Y1), - c.call(f2mPrefix + "_sub", I, J, AUX), - c.call(f2mPrefix + "_mul", E, AUX, AUX), - c.call(f2mPrefix + "_sub", AUX, Y1, Y1), - - // Z3 (Z1) = Z1*H - c.call(f2mPrefix + "_mul", Z1, H, Z1), - - // ell_0 = xi * (E * X2 - D * Y2) - c.call(f2mPrefix + "_mul", D, Y2, AUX), - c.call(f2mPrefix + "_mul", E, X2, ELL_0), - c.call(f2mPrefix + "_sub", ELL_0, AUX, ELL_0), - c.call(f2mPrefix + "_mul", ELL_0, c.i32_const(pAltBn128Twist), ELL_0), - - - // ell_VV = - E (later: * xP) - c.call(f2mPrefix + "_neg", E, ELL_VV), - - // ell_VW = D (later: * yP ) - // Already assigned - - ); - } - - - - function buildPrepDoubleStep() { - const f = module.addFunction(prefix+ "_prepDblStep"); - f.addParam("pR", "i32"); - f.addParam("pCoef", "i32"); - - const c = f.getCodeBuilder(); - - const X1 = c.getLocal("pR"); - const Y1 = c.i32_add(c.getLocal("pR"), c.i32_const(f2size)); - const Z1 = c.i32_add(c.getLocal("pR"), c.i32_const(2*f2size)); - - const ELL_0 = c.getLocal("pCoef"); - const ELL_VW = c.i32_add(c.getLocal("pCoef"), c.i32_const(f2size)); - const ELL_VV = c.i32_add(c.getLocal("pCoef"), c.i32_const(2*f2size)); - - const A = c.i32_const(module.alloc(f2size)); - const B = c.i32_const(module.alloc(f2size)); - const C = c.i32_const(module.alloc(f2size)); - const D = c.i32_const(module.alloc(f2size)); - const E = c.i32_const(module.alloc(f2size)); - const F = c.i32_const(module.alloc(f2size)); - const G = c.i32_const(module.alloc(f2size)); - const H = c.i32_const(module.alloc(f2size)); - const I = c.i32_const(module.alloc(f2size)); - const J = c.i32_const(module.alloc(f2size)); - const E2 = c.i32_const(module.alloc(f2size)); - const AUX = c.i32_const(module.alloc(f2size)); - - f.addCode( - - // A = X1 * Y1 / 2 - c.call(f2mPrefix + "_mul", Y1, c.i32_const(pTwoInv), A), - c.call(f2mPrefix + "_mul", X1, A, A), - - // B = Y1^2 - c.call(f2mPrefix + "_square", Y1, B), - - // C = Z1^2 - c.call(f2mPrefix + "_square", Z1, C), - - // D = 3 * C - c.call(f2mPrefix + "_add", C, C, D), - c.call(f2mPrefix + "_add", D, C, D), - - // E = twist_b * D - c.call(f2mPrefix + "_mul", c.i32_const(pTwistCoefB), D, E), - - // F = 3 * E - c.call(f2mPrefix + "_add", E, E, F), - c.call(f2mPrefix + "_add", E, F, F), - - // G = (B+F)/2 - c.call(f2mPrefix + "_add", B, F, G), - c.call(f2mPrefix + "_mul", G, c.i32_const(pTwoInv), G), - - // H = (Y1+Z1)^2-(B+C) - c.call(f2mPrefix + "_add", B, C, AUX), - c.call(f2mPrefix + "_add", Y1, Z1, H), - c.call(f2mPrefix + "_square", H, H), - c.call(f2mPrefix + "_sub", H, AUX, H), - - // I = E-B - c.call(f2mPrefix + "_sub", E, B, I), - - // J = X1^2 - c.call(f2mPrefix + "_square", X1, J), - - // E_squared = E^2 - c.call(f2mPrefix + "_square", E, E2), - - // X3 (X1) = A * (B-F) - c.call(f2mPrefix + "_sub", B, F, AUX), - c.call(f2mPrefix + "_mul", A, AUX, X1), - - // Y3 (Y1) = G^2 - 3*E^2 - c.call(f2mPrefix + "_add", E2, E2, AUX), - c.call(f2mPrefix + "_add", E2, AUX, AUX), - c.call(f2mPrefix + "_square", G, Y1), - c.call(f2mPrefix + "_sub", Y1, AUX, Y1), - - // Z3 (Z1) = B * H - c.call(f2mPrefix + "_mul", B, H, Z1), - - // ell_0 = xi * I - c.call(f2mPrefix + "_mul", c.i32_const(pAltBn128Twist), I, ELL_0), - - // ell_VW = - H (later: * yP) - c.call(f2mPrefix + "_neg", H, ELL_VW), - - // ell_VV = 3*J (later: * xP) - c.call(f2mPrefix + "_add", J, J, ELL_VV), - c.call(f2mPrefix + "_add", J, ELL_VV, ELL_VV), - - ); - } - - function buildMulByQ() { - const f = module.addFunction(prefix + "_mulByQ"); - f.addParam("p1", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - const x = c.getLocal("p1"); - const y = c.i32_add(c.getLocal("p1"), c.i32_const(f2size)); - const z = c.i32_add(c.getLocal("p1"), c.i32_const(f2size*2)); - const x3 = c.getLocal("pr"); - const y3 = c.i32_add(c.getLocal("pr"), c.i32_const(f2size)); - const z3 = c.i32_add(c.getLocal("pr"), c.i32_const(f2size*2)); - - const MulByQX = c.i32_const(module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery("21575463638280843010398324269430826099269044274347216827212613867836435027261"), f1size ), - ...utils.bigInt2BytesLE( toMontgomery("10307601595873709700152284273816112264069230130616436755625194854815875713954"), f1size ), - ])); - - const MulByQY = c.i32_const(module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery("2821565182194536844548159561693502659359617185244120367078079554186484126554"), f1size ), - ...utils.bigInt2BytesLE( toMontgomery("3505843767911556378687030309984248845540243509899259641013678093033130930403"), f1size ), - ])); - - f.addCode( - // The frobeniusMap(1) in this field, is the conjugate - c.call(f2mPrefix + "_conjugate", x, x3), - c.call(f2mPrefix + "_mul", MulByQX, x3, x3), - c.call(f2mPrefix + "_conjugate", y, y3), - c.call(f2mPrefix + "_mul", MulByQY, y3, y3), - c.call(f2mPrefix + "_conjugate", z, z3), - ); - } - - - function buildPrepareG2() { - buildMulByQ(); - const f = module.addFunction(prefix+ "_prepareG2"); - f.addParam("pQ", "i32"); - f.addParam("ppreQ", "i32"); - f.addLocal("pCoef", "i32"); - f.addLocal("i", "i32"); - - const c = f.getCodeBuilder(); - - const QX = c.getLocal("pQ"); - const QY = c.i32_add( c.getLocal("pQ"), c.i32_const(f2size)); - const QZ = c.i32_add( c.getLocal("pQ"), c.i32_const(f2size*2)); - - const pR = module.alloc(f2size*3); - const R = c.i32_const(pR); - const RX = c.i32_const(pR); - const RY = c.i32_const(pR+f2size); - const RZ = c.i32_const(pR+2*f2size); - - const cQX = c.i32_add( c.getLocal("ppreQ"), c.i32_const(0)); - const cQY = c.i32_add( c.getLocal("ppreQ"), c.i32_const(f2size)); - const cQZ = c.i32_add( c.getLocal("ppreQ"), c.i32_const(f2size*2)); - - const pQ1 = module.alloc(f2size*3); - const Q1 = c.i32_const(pQ1); - - const pQ2 = module.alloc(f2size*3); - const Q2 = c.i32_const(pQ2); - const Q2X = c.i32_const(pQ2); - const Q2Y = c.i32_const(pQ2 + f2size); - const Q2Z = c.i32_const(pQ2 + f2size*2); - - f.addCode( - c.call(g2mPrefix + "_normalize", QX, cQX), // TODO Remove if already in affine - c.call(f2mPrefix + "_copy", cQX, RX), - c.call(f2mPrefix + "_copy", cQY, RY), - c.call(f2mPrefix + "_one", RZ), - ); - - f.addCode( - c.setLocal("pCoef", c.i32_add( c.getLocal("ppreQ"), c.i32_const(f2size*3))), - c.setLocal("i", c.i32_const(ateLoopBitBytes.length-2)), - c.block(c.loop( - - c.call(prefix + "_prepDblStep", R, c.getLocal("pCoef")), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - c.if( - c.i32_load8_s(c.getLocal("i"), pAteLoopBitBytes), - [ - ...c.call(prefix + "_prepAddStep", cQX, R, c.getLocal("pCoef")), - ...c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - ] - ), - c.br_if(1, c.i32_eqz ( c.getLocal("i") )), - c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - ); - - f.addCode( - c.call(prefix + "_mulByQ", cQX, Q1), - c.call(prefix + "_mulByQ", Q1, Q2) - ); - - if (isLoopNegative) { - f.addCode( - c.call(f2mPrefix + "_neg", RY, RY), - ); - } - - f.addCode( - c.call(f2mPrefix + "_neg", Q2Y, Q2Y), - - c.call(prefix + "_prepAddStep", Q1, R, c.getLocal("pCoef")), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - c.call(prefix + "_prepAddStep", Q2, R, c.getLocal("pCoef")), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - ); - } - - function buildMulBy024Old() { - const f = module.addFunction(prefix+ "__mulBy024Old"); - f.addParam("pEll0", "i32"); - f.addParam("pEllVW", "i32"); - f.addParam("pEllVV", "i32"); - f.addParam("pR", "i32"); // Result in F12 - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("pEll0"); - const x2 = c.getLocal("pEllVV"); - const x4 = c.getLocal("pEllVW"); - - const z0 = c.getLocal("pR"); - - const pAUX12 = module.alloc(ftsize); - const AUX12 = c.i32_const(pAUX12); - const AUX12_0 = c.i32_const(pAUX12); - const AUX12_2 = c.i32_const(pAUX12+f2size); - const AUX12_4 = c.i32_const(pAUX12+f2size*2); - const AUX12_6 = c.i32_const(pAUX12+f2size*3); - const AUX12_8 = c.i32_const(pAUX12+f2size*4); - const AUX12_10 = c.i32_const(pAUX12+f2size*5); - - f.addCode( - - c.call(f2mPrefix + "_copy", x0, AUX12_0), - c.call(f2mPrefix + "_zero", AUX12_2), - c.call(f2mPrefix + "_copy", x2, AUX12_4), - c.call(f2mPrefix + "_zero", AUX12_6), - c.call(f2mPrefix + "_copy", x4, AUX12_8), - c.call(f2mPrefix + "_zero", AUX12_10), - c.call(ftmPrefix + "_mul", AUX12, z0, z0), - ); - } - - function buildMulBy024() { - const f = module.addFunction(prefix+ "__mulBy024"); - f.addParam("pEll0", "i32"); - f.addParam("pEllVW", "i32"); - f.addParam("pEllVV", "i32"); - f.addParam("pR", "i32"); // Result in F12 - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("pEll0"); - const x2 = c.getLocal("pEllVV"); - const x4 = c.getLocal("pEllVW"); - - const z0 = c.getLocal("pR"); - const z1 = c.i32_add(c.getLocal("pR"), c.i32_const(2*n8)); - const z2 = c.i32_add(c.getLocal("pR"), c.i32_const(4*n8)); - const z3 = c.i32_add(c.getLocal("pR"), c.i32_const(6*n8)); - const z4 = c.i32_add(c.getLocal("pR"), c.i32_const(8*n8)); - const z5 = c.i32_add(c.getLocal("pR"), c.i32_const(10*n8)); - - const t0 = c.i32_const(module.alloc(f2size)); - const t1 = c.i32_const(module.alloc(f2size)); - const t2 = c.i32_const(module.alloc(f2size)); - const s0 = c.i32_const(module.alloc(f2size)); - const T3 = c.i32_const(module.alloc(f2size)); - const T4 = c.i32_const(module.alloc(f2size)); - const D0 = c.i32_const(module.alloc(f2size)); - const D2 = c.i32_const(module.alloc(f2size)); - const D4 = c.i32_const(module.alloc(f2size)); - const S1 = c.i32_const(module.alloc(f2size)); - const AUX = c.i32_const(module.alloc(f2size)); - - f.addCode( - - // D0 = z0 * x0; - c.call(f2mPrefix + "_mul", z0, x0, D0), - // D2 = z2 * x2; - c.call(f2mPrefix + "_mul", z2, x2, D2), - // D4 = z4 * x4; - c.call(f2mPrefix + "_mul", z4, x4, D4), - // t2 = z0 + z4; - c.call(f2mPrefix + "_add", z0, z4, t2), - // t1 = z0 + z2; - c.call(f2mPrefix + "_add", z0, z2, t1), - // s0 = z1 + z3 + z5; - c.call(f2mPrefix + "_add", z1, z3, s0), - c.call(f2mPrefix + "_add", s0, z5, s0), - - - // For z.a_.a_ = z0. - // S1 = z1 * x2; - c.call(f2mPrefix + "_mul", z1, x2, S1), - // T3 = S1 + D4; - c.call(f2mPrefix + "_add", S1, D4, T3), - // T4 = my_Fp6::non_residue * T3 + D0; - c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), T3, T4), - c.call(f2mPrefix + "_add", T4, D0, z0), - // z0 = T4; - - // For z.a_.b_ = z1 - // T3 = z5 * x4; - c.call(f2mPrefix + "_mul", z5, x4, T3), - // S1 = S1 + T3; - c.call(f2mPrefix + "_add", S1, T3, S1), - // T3 = T3 + D2; - c.call(f2mPrefix + "_add", T3, D2, T3), - // T4 = my_Fp6::non_residue * T3; - c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), T3, T4), - // T3 = z1 * x0; - c.call(f2mPrefix + "_mul", z1, x0, T3), - // S1 = S1 + T3; - c.call(f2mPrefix + "_add", S1, T3, S1), - // T4 = T4 + T3; - c.call(f2mPrefix + "_add", T4, T3, z1), - // z1 = T4; - - - - // For z.a_.c_ = z2 - // t0 = x0 + x2; - c.call(f2mPrefix + "_add", x0, x2, t0), - // T3 = t1 * t0 - D0 - D2; - c.call(f2mPrefix + "_mul", t1, t0, T3), - c.call(f2mPrefix + "_add", D0, D2, AUX), - c.call(f2mPrefix + "_sub", T3, AUX, T3), - // T4 = z3 * x4; - c.call(f2mPrefix + "_mul", z3, x4, T4), - // S1 = S1 + T4; - c.call(f2mPrefix + "_add", S1, T4, S1), - - - // For z.b_.a_ = z3 (z3 needs z2) - // t0 = z2 + z4; - c.call(f2mPrefix + "_add", z2, z4, t0), - // T3 = T3 + T4; - // z2 = T3; - c.call(f2mPrefix + "_add", T3, T4, z2), - // t1 = x2 + x4; - c.call(f2mPrefix + "_add", x2, x4, t1), - // T3 = t0 * t1 - D2 - D4; - c.call(f2mPrefix + "_mul", t1, t0, T3), - c.call(f2mPrefix + "_add", D2, D4, AUX), - c.call(f2mPrefix + "_sub", T3, AUX, T3), - // T4 = my_Fp6::non_residue * T3; - c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), T3, T4), - // T3 = z3 * x0; - c.call(f2mPrefix + "_mul", z3, x0, T3), - // S1 = S1 + T3; - c.call(f2mPrefix + "_add", S1, T3, S1), - // T4 = T4 + T3; - c.call(f2mPrefix + "_add", T4, T3, z3), - // z3 = T4; - - // For z.b_.b_ = z4 - // T3 = z5 * x2; - c.call(f2mPrefix + "_mul", z5, x2, T3), - // S1 = S1 + T3; - c.call(f2mPrefix + "_add", S1, T3, S1), - // T4 = my_Fp6::non_residue * T3; - c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), T3, T4), - // t0 = x0 + x4; - c.call(f2mPrefix + "_add", x0, x4, t0), - // T3 = t2 * t0 - D0 - D4; - c.call(f2mPrefix + "_mul", t2, t0, T3), - c.call(f2mPrefix + "_add", D0, D4, AUX), - c.call(f2mPrefix + "_sub", T3, AUX, T3), - // T4 = T4 + T3; - c.call(f2mPrefix + "_add", T4, T3, z4), - // z4 = T4; - - // For z.b_.c_ = z5. - // t0 = x0 + x2 + x4; - c.call(f2mPrefix + "_add", x0, x2, t0), - c.call(f2mPrefix + "_add", t0, x4, t0), - // T3 = s0 * t0 - S1; - c.call(f2mPrefix + "_mul", s0, t0, T3), - c.call(f2mPrefix + "_sub", T3, S1, z5), - // z5 = T3; - - ); - } - - - function buildMillerLoop() { - const f = module.addFunction(prefix+ "_millerLoop"); - f.addParam("ppreP", "i32"); - f.addParam("ppreQ", "i32"); - f.addParam("r", "i32"); - f.addLocal("pCoef", "i32"); - f.addLocal("i", "i32"); - - const c = f.getCodeBuilder(); - - const preP_PX = c.getLocal("ppreP"); - const preP_PY = c.i32_add(c.getLocal("ppreP"), c.i32_const(f1size)); - - const ELL_0 = c.getLocal("pCoef"); - const ELL_VW = c.i32_add(c.getLocal("pCoef"), c.i32_const(f2size)); - const ELL_VV = c.i32_add(c.getLocal("pCoef"), c.i32_const(2*f2size)); - - - const pVW = module.alloc(f2size); - const VW = c.i32_const(pVW); - const pVV = module.alloc(f2size); - const VV = c.i32_const(pVV); - - const F = c.getLocal("r"); - - - f.addCode( - c.call(ftmPrefix + "_one", F), - - c.setLocal("pCoef", c.i32_add( c.getLocal("ppreQ"), c.i32_const(f2size*3))), - - c.setLocal("i", c.i32_const(ateLoopBitBytes.length-2)), - c.block(c.loop( - - - c.call(ftmPrefix + "_square", F, F), - - c.call(f2mPrefix + "_mul1", ELL_VW,preP_PY, VW), - c.call(f2mPrefix + "_mul1", ELL_VV, preP_PX, VV), - c.call(prefix + "__mulBy024", ELL_0, VW, VV, F), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - c.if( - c.i32_load8_s(c.getLocal("i"), pAteLoopBitBytes), - [ - ...c.call(f2mPrefix + "_mul1", ELL_VW, preP_PY, VW), - ...c.call(f2mPrefix + "_mul1", ELL_VV, preP_PX, VV), - - ...c.call(prefix + "__mulBy024", ELL_0, VW, VV, F), - ...c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - ] - ), - c.br_if(1, c.i32_eqz ( c.getLocal("i") )), - c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - - ); - - if (isLoopNegative) { - f.addCode( - c.call(ftmPrefix + "_inverse", F, F), - ); - } - - f.addCode( - c.call(f2mPrefix + "_mul1", ELL_VW, preP_PY, VW), - c.call(f2mPrefix + "_mul1", ELL_VV, preP_PX, VV), - c.call(prefix + "__mulBy024", ELL_0, VW, VV, F), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - c.call(f2mPrefix + "_mul1", ELL_VW, preP_PY, VW), - c.call(f2mPrefix + "_mul1", ELL_VV, preP_PX, VV), - c.call(prefix + "__mulBy024", ELL_0, VW, VV, F), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - ); - - } - - - function buildFrobeniusMap(n) { - const F12 = [ - [ - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - ], - [ - [bigInt("1"), bigInt("0")], - [bigInt("8376118865763821496583973867626364092589906065868298776909617916018768340080"), bigInt("16469823323077808223889137241176536799009286646108169935659301613961712198316")], - [bigInt("21888242871839275220042445260109153167277707414472061641714758635765020556617"), bigInt("0")], - [bigInt("11697423496358154304825782922584725312912383441159505038794027105778954184319"), bigInt("303847389135065887422783454877609941456349188919719272345083954437860409601")], - [bigInt("21888242871839275220042445260109153167277707414472061641714758635765020556616"), bigInt("0")], - [bigInt("3321304630594332808241809054958361220322477375291206261884409189760185844239"), bigInt("5722266937896532885780051958958348231143373700109372999374820235121374419868")], - [bigInt("21888242871839275222246405745257275088696311157297823662689037894645226208582"), bigInt("0")], - [bigInt("13512124006075453725662431877630910996106405091429524885779419978626457868503"), bigInt("5418419548761466998357268504080738289687024511189653727029736280683514010267")], - [bigInt("2203960485148121921418603742825762020974279258880205651966"), bigInt("0")], - [bigInt("10190819375481120917420622822672549775783927716138318623895010788866272024264"), bigInt("21584395482704209334823622290379665147239961968378104390343953940207365798982")], - [bigInt("2203960485148121921418603742825762020974279258880205651967"), bigInt("0")], - [bigInt("18566938241244942414004596690298913868373833782006617400804628704885040364344"), bigInt("16165975933942742336466353786298926857552937457188450663314217659523851788715")], - ] - ]; - - const F6 = [ - [ - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - ], - [ - [bigInt("1"), bigInt("0")], - [bigInt("21575463638280843010398324269430826099269044274347216827212613867836435027261"), bigInt("10307601595873709700152284273816112264069230130616436755625194854815875713954")], - [bigInt("21888242871839275220042445260109153167277707414472061641714758635765020556616"), bigInt("0")], - [bigInt("3772000881919853776433695186713858239009073593817195771773381919316419345261"), bigInt("2236595495967245188281701248203181795121068902605861227855261137820944008926")], - [bigInt("2203960485148121921418603742825762020974279258880205651966"), bigInt("0")], - [bigInt("18429021223477853657660792034369865839114504446431234726392080002137598044644"), bigInt("9344045779998320333812420223237981029506012124075525679208581902008406485703")], - ], - [ - [bigInt("1"), bigInt("0")], - [bigInt("2581911344467009335267311115468803099551665605076196740867805258568234346338"), bigInt("19937756971775647987995932169929341994314640652964949448313374472400716661030")], - [bigInt("2203960485148121921418603742825762020974279258880205651966"), bigInt("0")], - [bigInt("5324479202449903542726783395506214481928257762400643279780343368557297135718"), bigInt("16208900380737693084919495127334387981393726419856888799917914180988844123039")], - [bigInt("21888242871839275220042445260109153167277707414472061641714758635765020556616"), bigInt("0")], - [bigInt("13981852324922362344252311234282257507216387789820983642040889267519694726527"), bigInt("7629828391165209371577384193250820201684255241773809077146787135900891633097")], - ] - ]; - - const f = module.addFunction(prefix+ "__frobeniusMap"+n); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - for (let i=0; i<6; i++) { - const X = (i==0) ? c.getLocal("x") : c.i32_add(c.getLocal("x"), c.i32_const(i*f2size)); - const Xc0 = X; - const Xc1 = c.i32_add(c.getLocal("x"), c.i32_const(i*f2size + f1size)); - const R = (i==0) ? c.getLocal("r") : c.i32_add(c.getLocal("r"), c.i32_const(i*f2size)); - const Rc0 = R; - const Rc1 = c.i32_add(c.getLocal("r"), c.i32_const(i*f2size + f1size)); - const coef = mul2(F12[Math.floor(i/3)][n%12] , F6[i%3][n%6]); - const pCoef = module.alloc([ - ...utils.bigInt2BytesLE(toMontgomery(coef[0]), 32), - ...utils.bigInt2BytesLE(toMontgomery(coef[1]), 32), - ]); - if (n%2 == 1) { - f.addCode( - c.call(f1mPrefix + "_copy", Xc0, Rc0), - c.call(f1mPrefix + "_neg", Xc1, Rc1), - c.call(f2mPrefix + "_mul", R, c.i32_const(pCoef), R), - ); - } else { - f.addCode(c.call(f2mPrefix + "_mul", X, c.i32_const(pCoef), R)); - } - } - - function mul2(a, b) { - const ac0 = bigInt(a[0]); - const ac1 = bigInt(a[1]); - const bc0 = bigInt(b[0]); - const bc1 = bigInt(b[1]); - const res = [ - ac0.times(bc0).minus( ac1.times(bc1) ).mod(q), - ac0.times(bc1).add( ac1.times(bc0) ).mod(q), - ]; - if (res[0].isNegative()) res[0] = res[0].add(q); - return res; - } - - } - - - - function buildFinalExponentiationFirstChunk() { - - const f = module.addFunction(prefix+ "__finalExponentiationFirstChunk"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const elt = c.getLocal("x"); - const eltC0 = elt; - const eltC1 = c.i32_add(elt, c.i32_const(n8*6)); - const r = c.getLocal("r"); - const pA = module.alloc(ftsize); - const A = c.i32_const(pA); - const Ac0 = A; - const Ac1 = c.i32_const(pA + n8*6); - const B = c.i32_const(module.alloc(ftsize)); - const C = c.i32_const(module.alloc(ftsize)); - const D = c.i32_const(module.alloc(ftsize)); - - f.addCode( - // const alt_bn128_Fq12 A = alt_bn128_Fq12(elt.c0,-elt.c1); - c.call(f6mPrefix + "_copy", eltC0, Ac0), - c.call(f6mPrefix + "_neg", eltC1, Ac1), - - // const alt_bn128_Fq12 B = elt.inverse(); - c.call(ftmPrefix + "_inverse", elt, B), - - // const alt_bn128_Fq12 C = A * B; - c.call(ftmPrefix + "_mul", A, B, C), - // const alt_bn128_Fq12 D = C.Frobenius_map(2); - c.call(prefix + "__frobeniusMap2", C, D), - // const alt_bn128_Fq12 result = D * C; - c.call(ftmPrefix + "_mul", C, D, r), - ); - } - - function buildCyclotomicSquare() { - const f = module.addFunction(prefix+ "__cyclotomicSquare"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x4 = c.i32_add(c.getLocal("x"), c.i32_const(f2size)); - const x3 = c.i32_add(c.getLocal("x"), c.i32_const(2*f2size)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(3*f2size)); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(4*f2size)); - const x5 = c.i32_add(c.getLocal("x"), c.i32_const(5*f2size)); - - const r0 = c.getLocal("r"); - const r4 = c.i32_add(c.getLocal("r"), c.i32_const(f2size)); - const r3 = c.i32_add(c.getLocal("r"), c.i32_const(2*f2size)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(3*f2size)); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(4*f2size)); - const r5 = c.i32_add(c.getLocal("r"), c.i32_const(5*f2size)); - - const t0 = c.i32_const(module.alloc(f2size)); - const t1 = c.i32_const(module.alloc(f2size)); - const t2 = c.i32_const(module.alloc(f2size)); - const t3 = c.i32_const(module.alloc(f2size)); - const t4 = c.i32_const(module.alloc(f2size)); - const t5 = c.i32_const(module.alloc(f2size)); - const tmp = c.i32_const(module.alloc(f2size)); - const AUX = c.i32_const(module.alloc(f2size)); - - - f.addCode( - -// c.call(ftmPrefix + "_square", x0, r0), - - // // t0 + t1*y = (z0 + z1*y)^2 = a^2 - // tmp = z0 * z1; - // t0 = (z0 + z1) * (z0 + my_Fp6::non_residue * z1) - tmp - my_Fp6::non_residue * tmp; - // t1 = tmp + tmp; - c.call(f2mPrefix + "_mul", x0, x1, tmp), - c.call(f2mPrefix + "_mul", x1, c.i32_const(pNonResidueF6), t0), - c.call(f2mPrefix + "_add", x0, t0, t0), - c.call(f2mPrefix + "_add", x0, x1, AUX), - c.call(f2mPrefix + "_mul", AUX, t0, t0), - c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), tmp, AUX), - c.call(f2mPrefix + "_add", tmp, AUX, AUX), - c.call(f2mPrefix + "_sub", t0, AUX, t0), - c.call(f2mPrefix + "_add", tmp, tmp, t1), - - // // t2 + t3*y = (z2 + z3*y)^2 = b^2 - // tmp = z2 * z3; - // t2 = (z2 + z3) * (z2 + my_Fp6::non_residue * z3) - tmp - my_Fp6::non_residue * tmp; - // t3 = tmp + tmp; - c.call(f2mPrefix + "_mul", x2, x3, tmp), - c.call(f2mPrefix + "_mul", x3, c.i32_const(pNonResidueF6), t2), - c.call(f2mPrefix + "_add", x2, t2, t2), - c.call(f2mPrefix + "_add", x2, x3, AUX), - c.call(f2mPrefix + "_mul", AUX, t2, t2), - c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), tmp, AUX), - c.call(f2mPrefix + "_add", tmp, AUX, AUX), - c.call(f2mPrefix + "_sub", t2, AUX, t2), - c.call(f2mPrefix + "_add", tmp, tmp, t3), - - // // t4 + t5*y = (z4 + z5*y)^2 = c^2 - // tmp = z4 * z5; - // t4 = (z4 + z5) * (z4 + my_Fp6::non_residue * z5) - tmp - my_Fp6::non_residue * tmp; - // t5 = tmp + tmp; - c.call(f2mPrefix + "_mul", x4, x5, tmp), - c.call(f2mPrefix + "_mul", x5, c.i32_const(pNonResidueF6), t4), - c.call(f2mPrefix + "_add", x4, t4, t4), - c.call(f2mPrefix + "_add", x4, x5, AUX), - c.call(f2mPrefix + "_mul", AUX, t4, t4), - c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), tmp, AUX), - c.call(f2mPrefix + "_add", tmp, AUX, AUX), - c.call(f2mPrefix + "_sub", t4, AUX, t4), - c.call(f2mPrefix + "_add", tmp, tmp, t5), - - // For A - // z0 = 3 * t0 - 2 * z0 - c.call(f2mPrefix + "_sub", t0, x0, r0), - c.call(f2mPrefix + "_add", r0, r0, r0), - c.call(f2mPrefix + "_add", t0, r0, r0), - // z1 = 3 * t1 + 2 * z1 - c.call(f2mPrefix + "_add", t1, x1, r1), - c.call(f2mPrefix + "_add", r1, r1, r1), - c.call(f2mPrefix + "_add", t1, r1, r1), - - // For B - // z2 = 3 * (xi * t5) + 2 * z2 - c.call(f2mPrefix + "_mul", t5, c.i32_const(pAltBn128Twist), AUX), - c.call(f2mPrefix + "_add", AUX, x2, r2), - c.call(f2mPrefix + "_add", r2, r2, r2), - c.call(f2mPrefix + "_add", AUX, r2, r2), - // z3 = 3 * t4 - 2 * z3 - c.call(f2mPrefix + "_sub", t4, x3, r3), - c.call(f2mPrefix + "_add", r3, r3, r3), - c.call(f2mPrefix + "_add", t4, r3, r3), - - // For C - // z4 = 3 * t2 - 2 * z4 - c.call(f2mPrefix + "_sub", t2, x4, r4), - c.call(f2mPrefix + "_add", r4, r4, r4), - c.call(f2mPrefix + "_add", t2, r4, r4), - // z5 = 3 * t3 + 2 * z5 - c.call(f2mPrefix + "_add", t3, x5, r5), - c.call(f2mPrefix + "_add", r5, r5, r5), - c.call(f2mPrefix + "_add", t3, r5, r5), - - ); - } - - - function buildCyclotomicExp(exponent, fnName) { - const exponentNafBytes = naf(exponent).map( (b) => (b==-1 ? 0xFF: b) ); - const pExponentNafBytes = module.alloc(exponentNafBytes); - const pExponent = module.alloc(utils.bigInt2BytesLE(exponent, 32)); - - const f = module.addFunction(prefix+ "__cyclotomicExp_"+fnName); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - f.addLocal("bit", "i32"); - f.addLocal("i", "i32"); - - const c = f.getCodeBuilder(); - - const x = c.getLocal("x"); - - const res = c.getLocal("r"); - - const inverse = c.i32_const(module.alloc(ftsize)); - - - f.addCode( -// c.call(ftmPrefix + "_exp", x, c.i32_const(pExponent), c.i32_const(32), res), - - c.call(ftmPrefix + "_conjugate", x, inverse), - c.call(ftmPrefix + "_one", res), - - c.if( - c.teeLocal("bit", c.i32_load8_s(c.i32_const(exponentNafBytes.length-1), pExponentNafBytes)), - c.if( - c.i32_eq( - c.getLocal("bit"), - c.i32_const(1) - ), - c.call(ftmPrefix + "_mul", res, x, res), - c.call(ftmPrefix + "_mul", res, inverse, res), - ) - ), - - c.setLocal("i", c.i32_const(exponentNafBytes.length-2)), - c.block(c.loop( -// c.call(ftmPrefix + "_square", res, res), - c.call(prefix + "__cyclotomicSquare", res, res), - c.if( - c.teeLocal("bit", c.i32_load8_s(c.getLocal("i"), pExponentNafBytes)), - c.if( - c.i32_eq( - c.getLocal("bit"), - c.i32_const(1) - ), - c.call(ftmPrefix + "_mul", res, x, res), - c.call(ftmPrefix + "_mul", res, inverse, res), - ) - ), - c.br_if(1, c.i32_eqz ( c.getLocal("i") )), - c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - ); - } - - - - function buildFinalExponentiationLastChunk() { - buildCyclotomicSquare(); - buildCyclotomicExp(finalExpZ, "w0"); - - const f = module.addFunction(prefix+ "__finalExponentiationLastChunk"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const elt = c.getLocal("x"); - const result = c.getLocal("r"); - const A = c.i32_const(module.alloc(ftsize)); - const B = c.i32_const(module.alloc(ftsize)); - const C = c.i32_const(module.alloc(ftsize)); - const D = c.i32_const(module.alloc(ftsize)); - const E = c.i32_const(module.alloc(ftsize)); - const F = c.i32_const(module.alloc(ftsize)); - const G = c.i32_const(module.alloc(ftsize)); - const H = c.i32_const(module.alloc(ftsize)); - const I = c.i32_const(module.alloc(ftsize)); - const J = c.i32_const(module.alloc(ftsize)); - const K = c.i32_const(module.alloc(ftsize)); - const L = c.i32_const(module.alloc(ftsize)); - const M = c.i32_const(module.alloc(ftsize)); - const N = c.i32_const(module.alloc(ftsize)); - const O = c.i32_const(module.alloc(ftsize)); - const P = c.i32_const(module.alloc(ftsize)); - const Q = c.i32_const(module.alloc(ftsize)); - const R = c.i32_const(module.alloc(ftsize)); - const S = c.i32_const(module.alloc(ftsize)); - const T = c.i32_const(module.alloc(ftsize)); - const U = c.i32_const(module.alloc(ftsize)); - - f.addCode( - - - // A = exp_by_neg_z(elt) // = elt^(-z) - c.call(prefix + "__cyclotomicExp_w0", elt, A), - finalExpIsNegative ? [] : c.call(ftmPrefix + "_conjugate", A, A), - // B = A^2 // = elt^(-2*z) - c.call(prefix + "__cyclotomicSquare", A, B), - // C = B^2 // = elt^(-4*z) - c.call(prefix + "__cyclotomicSquare", B, C), - // D = C * B // = elt^(-6*z) - c.call(ftmPrefix + "_mul", C, B, D), - // E = exp_by_neg_z(D) // = elt^(6*z^2) - c.call(prefix + "__cyclotomicExp_w0", D, E), - finalExpIsNegative ? [] : c.call(ftmPrefix + "_conjugate", E, E), - // F = E^2 // = elt^(12*z^2) - c.call(prefix + "__cyclotomicSquare", E, F), - // G = epx_by_neg_z(F) // = elt^(-12*z^3) - c.call(prefix + "__cyclotomicExp_w0", F, G), - finalExpIsNegative ? [] : c.call(ftmPrefix + "_conjugate", G, G), - // H = conj(D) // = elt^(6*z) - c.call(ftmPrefix + "_conjugate", D, H), - // I = conj(G) // = elt^(12*z^3) - c.call(ftmPrefix + "_conjugate", G, I), - // J = I * E // = elt^(12*z^3 + 6*z^2) - c.call(ftmPrefix + "_mul", I, E, J), - // K = J * H // = elt^(12*z^3 + 6*z^2 + 6*z) - c.call(ftmPrefix + "_mul", J, H, K), - // L = K * B // = elt^(12*z^3 + 6*z^2 + 4*z) - c.call(ftmPrefix + "_mul", K, B, L), - // M = K * E // = elt^(12*z^3 + 12*z^2 + 6*z) - c.call(ftmPrefix + "_mul", K, E, M), - - // N = M * elt // = elt^(12*z^3 + 12*z^2 + 6*z + 1) - c.call(ftmPrefix + "_mul", M, elt, N), - - // O = L.Frobenius_map(1) // = elt^(q*(12*z^3 + 6*z^2 + 4*z)) - c.call(prefix + "__frobeniusMap1", L, O), - // P = O * N // = elt^(q*(12*z^3 + 6*z^2 + 4*z) * (12*z^3 + 12*z^2 + 6*z + 1)) - c.call(ftmPrefix + "_mul", O, N, P), - // Q = K.Frobenius_map(2) // = elt^(q^2 * (12*z^3 + 6*z^2 + 6*z)) - c.call(prefix + "__frobeniusMap2", K, Q), - // R = Q * P // = elt^(q^2 * (12*z^3 + 6*z^2 + 6*z) + q*(12*z^3 + 6*z^2 + 4*z) * (12*z^3 + 12*z^2 + 6*z + 1)) - c.call(ftmPrefix + "_mul", Q, P, R), - // S = conj(elt) // = elt^(-1) - c.call(ftmPrefix + "_conjugate", elt, S), - // T = S * L // = elt^(12*z^3 + 6*z^2 + 4*z - 1) - c.call(ftmPrefix + "_mul", S, L, T), - // U = T.Frobenius_map(3) // = elt^(q^3(12*z^3 + 6*z^2 + 4*z - 1)) - c.call(prefix + "__frobeniusMap3", T, U), - // V = U * R // = elt^(q^3(12*z^3 + 6*z^2 + 4*z - 1) + q^2 * (12*z^3 + 6*z^2 + 6*z) + q*(12*z^3 + 6*z^2 + 4*z) * (12*z^3 + 12*z^2 + 6*z + 1)) - c.call(ftmPrefix + "_mul", U, R, result), - // result = V - ); - } - - - function buildFinalExponentiation() { - buildFinalExponentiationFirstChunk(); - buildFinalExponentiationLastChunk(); - const f = module.addFunction(prefix+ "_finalExponentiation"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const elt = c.getLocal("x"); - const result = c.getLocal("r"); - const eltToFirstChunk = c.i32_const(module.alloc(ftsize)); - - f.addCode( - c.call(prefix + "__finalExponentiationFirstChunk", elt, eltToFirstChunk ), - c.call(prefix + "__finalExponentiationLastChunk", eltToFirstChunk, result ) - ); - } - - - function buildFinalExponentiationOld() { - const f = module.addFunction(prefix+ "_finalExponentiationOld"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const exponent = bigInt("552484233613224096312617126783173147097382103762957654188882734314196910839907541213974502761540629817009608548654680343627701153829446747810907373256841551006201639677726139946029199968412598804882391702273019083653272047566316584365559776493027495458238373902875937659943504873220554161550525926302303331747463515644711876653177129578303191095900909191624817826566688241804408081892785725967931714097716709526092261278071952560171111444072049229123565057483750161460024353346284167282452756217662335528813519139808291170539072125381230815729071544861602750936964829313608137325426383735122175229541155376346436093930287402089517426973178917569713384748081827255472576937471496195752727188261435633271238710131736096299798168852925540549342330775279877006784354801422249722573783561685179618816480037695005515426162362431072245638324744480"); - - const pExponent = module.alloc(utils.bigInt2BytesLE( exponent, 352 )); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call(ftmPrefix + "_exp", c.getLocal("x"), c.i32_const(pExponent), c.i32_const(352), c.getLocal("r")), - ); - } - - - - - const pPreP = module.alloc(prePSize); - const pPreQ = module.alloc(preQSize); - - function buildPairingEquation(nPairings) { - - const f = module.addFunction(prefix+ "_pairingEq"+nPairings); - for (let i=0; i { - - - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ - -module.exports = function buildApplyKey(module, fnName, gPrefix, frPrefix, sizeGIn, sizeGOut, sizeF, opGtimesF) { +var build_timesscalar = function buildTimesScalar(module, fnName, elementLen, opAB, opAA, opCopy, opInit) { const f = module.addFunction(fnName); - f.addParam("pIn", "i32"); - f.addParam("n", "i32"); - f.addParam("pFirst", "i32"); - f.addParam("pInc", "i32"); - f.addParam("pOut", "i32"); - f.addLocal("pOldFree", "i32"); + f.addParam("base", "i32"); + f.addParam("scalar", "i32"); + f.addParam("scalarLength", "i32"); + f.addParam("r", "i32"); f.addLocal("i", "i32"); - f.addLocal("pFrom", "i32"); - f.addLocal("pTo", "i32"); + f.addLocal("b", "i32"); const c = f.getCodeBuilder(); - const t = c.i32_const(module.alloc(sizeF)); + const aux = c.i32_const(module.alloc(elementLen)); f.addCode( - c.setLocal("pFrom", c.getLocal("pIn")), - c.setLocal("pTo", c.getLocal("pOut")), - ); - - // t = first - f.addCode( - c.call( - frPrefix + "_copy", - c.getLocal("pFirst"), - t + c.if( + c.i32_eqz(c.getLocal("scalarLength")), + [ + ...c.call(opInit, c.getLocal("r")), + ...c.ret([]) + ] ) ); - f.addCode( - c.setLocal("i", c.i32_const(0)), - c.block(c.loop( - c.br_if(1, c.i32_eq ( c.getLocal("i"), c.getLocal("n") )), + f.addCode(c.call(opCopy, c.getLocal("base"), aux)); + f.addCode(c.call(opInit, c.getLocal("r"))); + f.addCode(c.setLocal("i", c.getLocal("scalarLength"))); + f.addCode(c.block(c.loop( + c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), - c.call( - opGtimesF, - c.getLocal("pFrom"), - t, - c.getLocal("pTo") - ), - c.setLocal("pFrom", c.i32_add(c.getLocal("pFrom"), c.i32_const(sizeGIn))), - c.setLocal("pTo", c.i32_add(c.getLocal("pTo"), c.i32_const(sizeGOut))), + c.setLocal( + "b", + c.i32_load8_u( + c.i32_add( + c.getLocal("scalar"), + c.getLocal("i") + ) + ) + ), + ...innerLoop(), + c.br_if(1, c.i32_eqz ( c.getLocal("i") )), + c.br(0) + ))); - // t = t* inc - c.call( - frPrefix + "_mul", - t, - c.getLocal("pInc"), - t - ), - c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - ); - module.exportFunction(fnName); + function innerLoop() { + const code = []; + for (let i=0; i<8; i++) { + code.push( + ...c.call(opAA, c.getLocal("r"), c.getLocal("r")), + ...c.if( + c.i32_ge_u( c.getLocal("b"), c.i32_const(0x80 >> i)), + [ + ...c.setLocal( + "b", + c.i32_sub( + c.getLocal("b"), + c.i32_const(0x80 >> i) + ) + ), + ...c.call(opAB, c.getLocal("r"),aux, c.getLocal("r")) + ] + ) + ); + } + return code; + } }; +var build_batchinverse = buildBatchInverse$3; -/***/ }), - -/***/ 9440: -/***/ ((module) => { - - - -module.exports = buildBatchConvertion; - -function buildBatchConvertion(module, fnName, internalFnName, sizeIn, sizeOut, reverse) { - if (typeof reverse === "undefined") { - // Set the reverse in a way that allows to use the same buffer as in/out. - if (sizeIn < sizeOut) { - reverse = true; - } else { - reverse = false; - } - } - - const f = module.addFunction(fnName); - f.addParam("pIn", "i32"); - f.addParam("n", "i32"); - f.addParam("pOut", "i32"); - f.addLocal("i", "i32"); - f.addLocal("itIn", "i32"); - f.addLocal("itOut", "i32"); - - const c = f.getCodeBuilder(); - - if (reverse) { - f.addCode( - c.setLocal("itIn", - c.i32_add( - c.getLocal("pIn"), - c.i32_mul( - c.i32_sub( - c.getLocal("n"), - c.i32_const(1) - ), - c.i32_const(sizeIn) - ) - ) - ), - c.setLocal("itOut", - c.i32_add( - c.getLocal("pOut"), - c.i32_mul( - c.i32_sub( - c.getLocal("n"), - c.i32_const(1) - ), - c.i32_const(sizeOut) - ) - ) - ), - c.setLocal("i", c.i32_const(0)), - c.block(c.loop( - c.br_if(1, c.i32_eq ( c.getLocal("i"), c.getLocal("n") )), - - c.call(internalFnName, c.getLocal("itIn"), c.getLocal("itOut")), - - c.setLocal("itIn", c.i32_sub(c.getLocal("itIn"), c.i32_const(sizeIn))), - c.setLocal("itOut", c.i32_sub(c.getLocal("itOut"), c.i32_const(sizeOut))), - c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )), - ); - } else { - f.addCode( - c.setLocal("itIn", c.getLocal("pIn")), - c.setLocal("itOut", c.getLocal("pOut")), - c.setLocal("i", c.i32_const(0)), - c.block(c.loop( - c.br_if(1, c.i32_eq ( c.getLocal("i"), c.getLocal("n") )), - - c.call(internalFnName, c.getLocal("itIn"), c.getLocal("itOut")), - - c.setLocal("itIn", c.i32_add(c.getLocal("itIn"), c.i32_const(sizeIn))), - c.setLocal("itOut", c.i32_add(c.getLocal("itOut"), c.i32_const(sizeOut))), - c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )), - ); - } -} - - -/***/ }), - -/***/ 8163: -/***/ ((module) => { - - -module.exports = buildBatchInverse; - -function buildBatchInverse(module, prefix) { +function buildBatchInverse$3(module, prefix) { const n8 = module.modules[prefix].n64*8; @@ -62053,17 +67208,88 @@ function buildBatchInverse(module, prefix) { } +var build_batchconvertion = buildBatchConvertion$3; -/***/ }), +function buildBatchConvertion$3(module, fnName, internalFnName, sizeIn, sizeOut, reverse) { + if (typeof reverse === "undefined") { + // Set the reverse in a way that allows to use the same buffer as in/out. + if (sizeIn < sizeOut) { + reverse = true; + } else { + reverse = false; + } + } -/***/ 4948: -/***/ ((module) => { + const f = module.addFunction(fnName); + f.addParam("pIn", "i32"); + f.addParam("n", "i32"); + f.addParam("pOut", "i32"); + f.addLocal("i", "i32"); + f.addLocal("itIn", "i32"); + f.addLocal("itOut", "i32"); + const c = f.getCodeBuilder(); + if (reverse) { + f.addCode( + c.setLocal("itIn", + c.i32_add( + c.getLocal("pIn"), + c.i32_mul( + c.i32_sub( + c.getLocal("n"), + c.i32_const(1) + ), + c.i32_const(sizeIn) + ) + ) + ), + c.setLocal("itOut", + c.i32_add( + c.getLocal("pOut"), + c.i32_mul( + c.i32_sub( + c.getLocal("n"), + c.i32_const(1) + ), + c.i32_const(sizeOut) + ) + ) + ), + c.setLocal("i", c.i32_const(0)), + c.block(c.loop( + c.br_if(1, c.i32_eq ( c.getLocal("i"), c.getLocal("n") )), -module.exports = buildBatchConvertion; + c.call(internalFnName, c.getLocal("itIn"), c.getLocal("itOut")), -function buildBatchConvertion(module, fnName, internalFnName, sizeIn, sizeOut, reverse) { + c.setLocal("itIn", c.i32_sub(c.getLocal("itIn"), c.i32_const(sizeIn))), + c.setLocal("itOut", c.i32_sub(c.getLocal("itOut"), c.i32_const(sizeOut))), + c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), + c.br(0) + )), + ); + } else { + f.addCode( + c.setLocal("itIn", c.getLocal("pIn")), + c.setLocal("itOut", c.getLocal("pOut")), + c.setLocal("i", c.i32_const(0)), + c.block(c.loop( + c.br_if(1, c.i32_eq ( c.getLocal("i"), c.getLocal("n") )), + + c.call(internalFnName, c.getLocal("itIn"), c.getLocal("itOut")), + + c.setLocal("itIn", c.i32_add(c.getLocal("itIn"), c.i32_const(sizeIn))), + c.setLocal("itOut", c.i32_add(c.getLocal("itOut"), c.i32_const(sizeOut))), + c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), + c.br(0) + )), + ); + } +} + +var build_batchop = buildBatchConvertion$2; + +function buildBatchConvertion$2(module, fnName, internalFnName, sizeIn, sizeOut, reverse) { if (typeof reverse === "undefined") { // Set the reverse in a way that allows to use the same buffer as in/out. if (sizeIn < sizeOut) { @@ -62157,11 +67383,162 @@ function buildBatchConvertion(module, fnName, internalFnName, sizeIn, sizeOut, r } } +var bigint = {}; -/***/ }), +// Many of these utilities are from the `big-integer` library, +// but adjusted to only work with native BigInt type +// Ref https://github.com/peterolson/BigInteger.js/blob/e5d2154d3c417069c51e7116bafc3b91d0b9fe41/BigInteger.js +// Originally licensed The Unlicense -/***/ 5904: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +function compare(a, b) { + return a === b ? 0 : a > b ? 1 : -1; +} + +function square$1(n) { + return n * n; +} + +function isOdd$4(n) { + return n % 2n !== 0n; +} + +function isEven(n) { + return n % 2n === 0n; +} + +function isNegative$3(n) { + return n < 0n; +} + +function isPositive(n) { + return n > 0n; +} + +function bitLength$5(n) { + if (isNegative$3(n)) { + return n.toString(2).length - 1; // discard the - sign + } else { + return n.toString(2).length; + } +} + +function abs(n) { + return n < 0n ? -n : n; +} + +function isUnit(n) { + return abs(n) === 1n; +} + +function modInv$3(a, n) { + var t = 0n, newT = 1n, r = n, newR = abs(a), q, lastT, lastR; + while (newR !== 0n) { + q = r / newR; + lastT = t; + lastR = r; + t = newT; + r = newR; + newT = lastT - (q * newT); + newR = lastR - (q * newR); + } + if (!isUnit(r)) throw new Error(a.toString() + " and " + n.toString() + " are not co-prime"); + if (compare(t, 0n) === -1) { + t = t + n; + } + if (isNegative$3(a)) { + return -t; + } + return t; +} + +function modPow$2(n, exp, mod) { + if (mod === 0n) throw new Error("Cannot take modPow with modulus 0"); + var r = 1n, + base = n % mod; + if (isNegative$3(exp)) { + exp = exp * -1n; + base = modInv$3(base, mod); + } + while (isPositive(exp)) { + if (base === 0n) return 0n; + if (isOdd$4(exp)) r = r * base % mod; + exp = exp / 2n; + base = square$1(base) % mod; + } + return r; +} + +function compareAbs(a, b) { + a = a >= 0n ? a : -a; + b = b >= 0n ? b : -b; + return a === b ? 0 : a > b ? 1 : -1; +} + +function isDivisibleBy(a, n) { + if (n === 0n) return false; + if (isUnit(n)) return true; + if (compareAbs(n, 2n) === 0) return isEven(a); + return a % n === 0n; +} + +function isBasicPrime(v) { + var n = abs(v); + if (isUnit(n)) return false; + if (n === 2n || n === 3n || n === 5n) return true; + if (isEven(n) || isDivisibleBy(n, 3n) || isDivisibleBy(n, 5n)) return false; + if (n < 49n) return true; + // we don't know if it's prime: let the other functions figure it out +} + +function prev(n) { + return n - 1n; +} + +function millerRabinTest(n, a) { + var nPrev = prev(n), + b = nPrev, + r = 0, + d, i, x; + while (isEven(b)) b = b / 2n, r++; + next: for (i = 0; i < a.length; i++) { + if (n < a[i]) continue; + x = modPow$2(BigInt(a[i]), b, n); + if (isUnit(x) || x === nPrev) continue; + for (d = r - 1; d != 0; d--) { + x = square$1(x) % n; + if (isUnit(x)) return false; + if (x === nPrev) continue next; + } + return false; + } + return true; +} + +function isPrime$1(p) { + var isPrime = isBasicPrime(p); + if (isPrime !== undefined) return isPrime; + var n = abs(p); + var bits = bitLength$5(n); + if (bits <= 64) + return millerRabinTest(n, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]); + var logN = Math.log(2) * Number(bits); + var t = Math.ceil(logN); + for (var a = [], i = 0; i < t; i++) { + a.push(BigInt(i + 2)); + } + return millerRabinTest(n, a); +} + +bigint.bitLength = bitLength$5; +bigint.isOdd = isOdd$4; +bigint.isNegative = isNegative$3; +bigint.abs = abs; +bigint.isUnit = isUnit; +bigint.compare = compare; +bigint.modInv = modInv$3; +bigint.modPow = modPow$2; +bigint.isPrime = isPrime$1; +bigint.square = square$1; /* Copyright 2019 0KIMS association. @@ -62182,12 +67559,3098 @@ function buildBatchConvertion(module, fnName, internalFnName, sizeIn, sizeOut, r along with wasmsnark. If not, see . */ -const buildTimesScalarNAF = __webpack_require__(3972); -//const buildTimesScalar = require("./build_timesscalar"); -const buildBatchConvertion = __webpack_require__(9440); -const buildMultiexp = __webpack_require__(4911); +const buildInt = build_int; +const utils$5 = utils$6; +const buildExp$2 = build_timesscalar; +const buildBatchInverse$2 = build_batchinverse; +const buildBatchConvertion$1 = build_batchconvertion; +const buildBatchOp = build_batchop; +const { bitLength: bitLength$4, modInv: modInv$2, modPow: modPow$1, isPrime, isOdd: isOdd$3, square } = bigint; -module.exports = function buildCurve(module, prefix, prefixField, pB) { +var build_f1m = function buildF1m(module, _q, _prefix, _intPrefix) { + const q = BigInt(_q); + const n64 = Math.floor((bitLength$4(q - 1n) - 1)/64) +1; + const n32 = n64*2; + const n8 = n64*8; + + const prefix = _prefix || "f1m"; + if (module.modules[prefix]) return prefix; // already builded + + const intPrefix = buildInt(module, n64, _intPrefix); + const pq = module.alloc(n8, utils$5.bigInt2BytesLE(q, n8)); + + const pR2 = module.alloc(utils$5.bigInt2BytesLE(square(1n << BigInt(n64*64)) % q, n8)); + const pOne = module.alloc(utils$5.bigInt2BytesLE((1n << BigInt(n64*64)) % q, n8)); + const pZero = module.alloc(utils$5.bigInt2BytesLE(0n, n8)); + const _minusOne = q - 1n; + const _e = _minusOne >> 1n; // e = (p-1)/2 + const pe = module.alloc(n8, utils$5.bigInt2BytesLE(_e, n8)); + + const _ePlusOne = _e + 1n; // e = (p-1)/2 + const pePlusOne = module.alloc(n8, utils$5.bigInt2BytesLE(_ePlusOne, n8)); + + module.modules[prefix] = { + pq: pq, + pR2: pR2, + n64: n64, + q: q, + pOne: pOne, + pZero: pZero, + pePlusOne: pePlusOne + }; + + function buildOne() { + const f = module.addFunction(prefix+"_one"); + f.addParam("pr", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode(c.call(intPrefix + "_copy", c.i32_const(pOne), c.getLocal("pr"))); + } + + function buildAdd() { + const f = module.addFunction(prefix+"_add"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode( + c.if( + c.call(intPrefix+"_add", c.getLocal("x"), c.getLocal("y"), c.getLocal("r")), + c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), + c.if( + c.call(intPrefix+"_gte", c.getLocal("r"), c.i32_const(pq) ), + c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), + ) + ) + ); + } + + function buildSub() { + const f = module.addFunction(prefix+"_sub"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode( + c.if( + c.call(intPrefix+"_sub", c.getLocal("x"), c.getLocal("y"), c.getLocal("r")), + c.drop(c.call(intPrefix+"_add", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))) + ) + ); + } + + function buildNeg() { + const f = module.addFunction(prefix+"_neg"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode( + c.call(prefix + "_sub", c.i32_const(pZero), c.getLocal("x"), c.getLocal("r")) + ); + } + + + function buildIsNegative() { + const f = module.addFunction(prefix+"_isNegative"); + f.addParam("x", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const AUX = c.i32_const(module.alloc(n8)); + + f.addCode( + c.call(prefix + "_fromMontgomery", c.getLocal("x"), AUX), + c.call(intPrefix + "_gte", AUX, c.i32_const(pePlusOne) ) + ); + } + + function buildSign() { + const f = module.addFunction(prefix+"_sign"); + f.addParam("x", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const AUX = c.i32_const(module.alloc(n8)); + + f.addCode( + c.if ( + c.call(intPrefix + "_isZero", c.getLocal("x")), + c.ret(c.i32_const(0)) + ), + c.call(prefix + "_fromMontgomery", c.getLocal("x"), AUX), + c.if( + c.call(intPrefix + "_gte", AUX, c.i32_const(pePlusOne)), + c.ret(c.i32_const(-1)) + ), + c.ret(c.i32_const(1)) + ); + } + + + function buildMReduct() { + const carries = module.alloc(n32*n32*8); + + const f = module.addFunction(prefix+"_mReduct"); + f.addParam("t", "i32"); + f.addParam("r", "i32"); + f.addLocal("np32", "i64"); + f.addLocal("c", "i64"); + f.addLocal("m", "i64"); + + const c = f.getCodeBuilder(); + + const np32 = Number(0x100000000n - modInv$2(q, 0x100000000n)); + + f.addCode(c.setLocal("np32", c.i64_const(np32))); + + for (let i=0; i=n32) { + f.addCode( + c.i64_store32( + c.getLocal("r"), + (k-n32)*4, + c.getLocal(c0) + ) + ); + } + [c0, c1] = [c1, c0]; + f.addCode( + c.setLocal(c1, + c.i64_shr_u( + c.getLocal(c0), + c.i64_const(32) + ) + ) + ); + } + f.addCode( + c.i64_store32( + c.getLocal("r"), + n32*4-4, + c.getLocal(c0) + ) + ); + + f.addCode( + c.if( + c.i32_wrap_i64(c.getLocal(c1)), + c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), + c.if( + c.call(intPrefix+"_gte", c.getLocal("r"), c.i32_const(pq) ), + c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), + ) + ) + ); + } + + + function buildSquare() { + + const f = module.addFunction(prefix+"_square"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + f.addLocal("c0", "i64"); + f.addLocal("c1", "i64"); + f.addLocal("c0_old", "i64"); + f.addLocal("c1_old", "i64"); + f.addLocal("np32", "i64"); + + + for (let i=0;i>1) )&&(i>1, k>>1) + ) + ) + ); + + f.addCode( + c.setLocal(c1, + c.i64_add( + c.getLocal(c1), + c.i64_shr_u( + c.getLocal(c0), + c.i64_const(32) + ) + ) + ) + ); + } + + // Add the old carry + + if (k>0) { + f.addCode( + c.setLocal(c0, + c.i64_add( + c.i64_and( + c.getLocal(c0), + c.i64_const(0xFFFFFFFF) + ), + c.i64_and( + c.getLocal(c0_old), + c.i64_const(0xFFFFFFFF) + ), + ) + ) + ); + + f.addCode( + c.setLocal(c1, + c.i64_add( + c.i64_add( + c.getLocal(c1), + c.i64_shr_u( + c.getLocal(c0), + c.i64_const(32) + ) + ), + c.getLocal(c1_old) + ) + ) + ); + } + + + for (let i=Math.max(1, k-n32+1); (i<=k)&&(i=n32) { + f.addCode( + c.i64_store32( + c.getLocal("r"), + (k-n32)*4, + c.getLocal(c0) + ) + ); + } + f.addCode( + c.setLocal( + c0_old, + c.getLocal(c1) + ), + c.setLocal( + c1_old, + c.i64_shr_u( + c.getLocal(c0_old), + c.i64_const(32) + ) + ) + ); + } + f.addCode( + c.i64_store32( + c.getLocal("r"), + n32*4-4, + c.getLocal(c0_old) + ) + ); + + f.addCode( + c.if( + c.i32_wrap_i64(c.getLocal(c1_old)), + c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), + c.if( + c.call(intPrefix+"_gte", c.getLocal("r"), c.i32_const(pq) ), + c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), + ) + ) + ); + } + + + function buildSquareOld() { + const f = module.addFunction(prefix+"_squareOld"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode(c.call(prefix + "_mul", c.getLocal("x"), c.getLocal("x"), c.getLocal("r"))); + } + + function buildToMontgomery() { + const f = module.addFunction(prefix+"_toMontgomery"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + f.addCode(c.call(prefix+"_mul", c.getLocal("x"), c.i32_const(pR2), c.getLocal("r"))); + } + + function buildFromMontgomery() { + + const pAux2 = module.alloc(n8*2); + + const f = module.addFunction(prefix+"_fromMontgomery"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + f.addCode(c.call(intPrefix + "_copy", c.getLocal("x"), c.i32_const(pAux2) )); + f.addCode(c.call(intPrefix + "_zero", c.i32_const(pAux2 + n8) )); + f.addCode(c.call(prefix+"_mReduct", c.i32_const(pAux2), c.getLocal("r"))); + } + + function buildInverse() { + + const f = module.addFunction(prefix+ "_inverse"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + f.addCode(c.call(prefix + "_fromMontgomery", c.getLocal("x"), c.getLocal("r"))); + f.addCode(c.call(intPrefix + "_inverseMod", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))); + f.addCode(c.call(prefix + "_toMontgomery", c.getLocal("r"), c.getLocal("r"))); + } + + // Calculate various valuse needed for sqrt + + + let _nqr = 2n; + if (isPrime(q)) { + while (modPow$1(_nqr, _e, q) !== _minusOne) _nqr = _nqr + 1n; + } + + let s2 = 0; + let _t = _minusOne; + + while ((!isOdd$3(_t))&&(_t !== 0n)) { + s2++; + _t = _t >> 1n; + } + const pt = module.alloc(n8, utils$5.bigInt2BytesLE(_t, n8)); + + const _nqrToT = modPow$1(_nqr, _t, q); + const pNqrToT = module.alloc(utils$5.bigInt2BytesLE((_nqrToT << BigInt(n64*64)) % q, n8)); + + const _tPlusOneOver2 = (_t + 1n) >> 1n; + const ptPlusOneOver2 = module.alloc(n8, utils$5.bigInt2BytesLE(_tPlusOneOver2, n8)); + + function buildSqrt() { + + const f = module.addFunction(prefix+ "_sqrt"); + f.addParam("n", "i32"); + f.addParam("r", "i32"); + f.addLocal("m", "i32"); + f.addLocal("i", "i32"); + f.addLocal("j", "i32"); + + const c = f.getCodeBuilder(); + + const ONE = c.i32_const(pOne); + const C = c.i32_const(module.alloc(n8)); + const T = c.i32_const(module.alloc(n8)); + const R = c.i32_const(module.alloc(n8)); + const SQ = c.i32_const(module.alloc(n8)); + const B = c.i32_const(module.alloc(n8)); + + f.addCode( + + // If (n==0) return 0 + c.if( + c.call(prefix + "_isZero", c.getLocal("n")), + c.ret( + c.call(prefix + "_zero", c.getLocal("r")) + ) + ), + + c.setLocal("m", c.i32_const(s2)), + c.call(prefix + "_copy", c.i32_const(pNqrToT), C), + c.call(prefix + "_exp", c.getLocal("n"), c.i32_const(pt), c.i32_const(n8), T), + c.call(prefix + "_exp", c.getLocal("n"), c.i32_const(ptPlusOneOver2), c.i32_const(n8), R), + + c.block(c.loop( + c.br_if(1, c.call(prefix + "_eq", T, ONE)), + + c.call(prefix + "_square", T, SQ), + c.setLocal("i", c.i32_const(1)), + c.block(c.loop( + c.br_if(1, c.call(prefix + "_eq", SQ, ONE)), + c.call(prefix + "_square", SQ, SQ), + c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), + c.br(0) + )), + + c.call(prefix + "_copy", C, B), + c.setLocal("j", c.i32_sub(c.i32_sub( c.getLocal("m"), c.getLocal("i")), c.i32_const(1)) ), + c.block(c.loop( + c.br_if(1, c.i32_eqz(c.getLocal("j"))), + c.call(prefix + "_square", B, B), + c.setLocal("j", c.i32_sub(c.getLocal("j"), c.i32_const(1))), + c.br(0) + )), + + c.setLocal("m", c.getLocal("i")), + c.call(prefix + "_square", B, C), + c.call(prefix + "_mul", T, C, T), + c.call(prefix + "_mul", R, B, R), + + c.br(0) + )), + + c.if( + c.call(prefix + "_isNegative", R), + c.call(prefix + "_neg", R, c.getLocal("r")), + c.call(prefix + "_copy", R, c.getLocal("r")), + ) + ); + } + + function buildIsSquare() { + const f = module.addFunction(prefix+"_isSquare"); + f.addParam("n", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const ONE = c.i32_const(pOne); + const AUX = c.i32_const(module.alloc(n8)); + + f.addCode( + c.if( + c.call(prefix + "_isZero", c.getLocal("n")), + c.ret(c.i32_const(1)) + ), + c.call(prefix + "_exp", c.getLocal("n"), c.i32_const(pe), c.i32_const(n8), AUX), + c.call(prefix + "_eq", AUX, ONE) + ); + } + + + function buildLoad() { + const f = module.addFunction(prefix+"_load"); + f.addParam("scalar", "i32"); + f.addParam("scalarLen", "i32"); + f.addParam("r", "i32"); + f.addLocal("p", "i32"); + f.addLocal("l", "i32"); + f.addLocal("i", "i32"); + f.addLocal("j", "i32"); + const c = f.getCodeBuilder(); + + const R = c.i32_const(module.alloc(n8)); + const pAux = module.alloc(n8); + const AUX = c.i32_const(pAux); + + f.addCode( + c.call(intPrefix + "_zero", c.getLocal("r")), + c.setLocal("i", c.i32_const(n8)), + c.setLocal("p", c.getLocal("scalar")), + c.block(c.loop( + c.br_if(1, c.i32_gt_u(c.getLocal("i"), c.getLocal("scalarLen"))), + + c.if( + c.i32_eq(c.getLocal("i"), c.i32_const(n8)), + c.call(prefix + "_one", R), + c.call(prefix + "_mul", R, c.i32_const(pR2), R) + ), + c.call(prefix + "_mul", c.getLocal("p"), R, AUX), + c.call(prefix + "_add", c.getLocal("r"), AUX, c.getLocal("r")), + + c.setLocal("p", c.i32_add(c.getLocal("p"), c.i32_const(n8))), + c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(n8))), + c.br(0) + )), + + c.setLocal("l", c.i32_rem_u( c.getLocal("scalarLen"), c.i32_const(n8))), + c.if(c.i32_eqz(c.getLocal("l")), c.ret([])), + c.call(intPrefix + "_zero", AUX), + c.setLocal("j", c.i32_const(0)), + c.block(c.loop( + c.br_if(1, c.i32_eq(c.getLocal("j"), c.getLocal("l"))), + + c.i32_store8( + c.getLocal("j"), + pAux, + c.i32_load8_u(c.getLocal("p")), + ), + c.setLocal("p", c.i32_add(c.getLocal("p"), c.i32_const(1))), + c.setLocal("j", c.i32_add(c.getLocal("j"), c.i32_const(1))), + c.br(0) + )), + + c.if( + c.i32_eq(c.getLocal("i"), c.i32_const(n8)), + c.call(prefix + "_one", R), + c.call(prefix + "_mul", R, c.i32_const(pR2), R) + ), + c.call(prefix + "_mul", AUX, R, AUX), + c.call(prefix + "_add", c.getLocal("r"), AUX, c.getLocal("r")), + ); + } + + function buildTimesScalar() { + const f = module.addFunction(prefix+"_timesScalar"); + f.addParam("x", "i32"); + f.addParam("scalar", "i32"); + f.addParam("scalarLen", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const AUX = c.i32_const(module.alloc(n8)); + + f.addCode( + c.call(prefix + "_load", c.getLocal("scalar"), c.getLocal("scalarLen"), AUX), + c.call(prefix + "_toMontgomery", AUX, AUX), + c.call(prefix + "_mul", c.getLocal("x"), AUX, c.getLocal("r")), + ); + } + + function buildIsOne() { + const f = module.addFunction(prefix+"_isOne"); + f.addParam("x", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + f.addCode( + c.ret(c.call(intPrefix + "_eq", c.getLocal("x"), c.i32_const(pOne))) + ); + } + + + module.exportFunction(intPrefix + "_copy", prefix+"_copy"); + module.exportFunction(intPrefix + "_zero", prefix+"_zero"); + module.exportFunction(intPrefix + "_isZero", prefix+"_isZero"); + module.exportFunction(intPrefix + "_eq", prefix+"_eq"); + + buildIsOne(); + buildAdd(); + buildSub(); + buildNeg(); + buildMReduct(); + buildMul(); + buildSquare(); + buildSquareOld(); + buildToMontgomery(); + buildFromMontgomery(); + buildIsNegative(); + buildSign(); + buildInverse(); + buildOne(); + buildLoad(); + buildTimesScalar(); + buildBatchInverse$2(module, prefix); + buildBatchConvertion$1(module, prefix + "_batchToMontgomery", prefix + "_toMontgomery", n8, n8); + buildBatchConvertion$1(module, prefix + "_batchFromMontgomery", prefix + "_fromMontgomery", n8, n8); + buildBatchConvertion$1(module, prefix + "_batchNeg", prefix + "_neg", n8, n8); + buildBatchOp(module, prefix + "_batchAdd", prefix + "_add", n8, n8); + buildBatchOp(module, prefix + "_batchSub", prefix + "_sub", n8, n8); + buildBatchOp(module, prefix + "_batchMul", prefix + "_mul", n8, n8); + + module.exportFunction(prefix + "_add"); + module.exportFunction(prefix + "_sub"); + module.exportFunction(prefix + "_neg"); + module.exportFunction(prefix + "_isNegative"); + module.exportFunction(prefix + "_isOne"); + module.exportFunction(prefix + "_sign"); + module.exportFunction(prefix + "_mReduct"); + module.exportFunction(prefix + "_mul"); + module.exportFunction(prefix + "_square"); + module.exportFunction(prefix + "_squareOld"); + module.exportFunction(prefix + "_fromMontgomery"); + module.exportFunction(prefix + "_toMontgomery"); + module.exportFunction(prefix + "_inverse"); + module.exportFunction(prefix + "_one"); + module.exportFunction(prefix + "_load"); + module.exportFunction(prefix + "_timesScalar"); + buildExp$2( + module, + prefix + "_exp", + n8, + prefix + "_mul", + prefix + "_square", + intPrefix + "_copy", + prefix + "_one", + ); + module.exportFunction(prefix + "_exp"); + module.exportFunction(prefix + "_batchInverse"); + if (isPrime(q)) { + buildSqrt(); + buildIsSquare(); + module.exportFunction(prefix + "_sqrt"); + module.exportFunction(prefix + "_isSquare"); + } + module.exportFunction(prefix + "_batchToMontgomery"); + module.exportFunction(prefix + "_batchFromMontgomery"); + // console.log(module.functionIdxByName); + + return prefix; +}; + +/* + Copyright 2019 0KIMS association. + + This file is part of wasmsnark (Web Assembly zkSnark Prover). + + wasmsnark is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + wasmsnark is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with wasmsnark. If not, see . +*/ + +const buildF1m$2 =build_f1m; +const { bitLength: bitLength$3 } = bigint; + +var build_f1 = function buildF1(module, _q, _prefix, _f1mPrefix, _intPrefix) { + + const q = BigInt(_q); + const n64 = Math.floor((bitLength$3(q - 1n) - 1)/64) +1; + const n8 = n64*8; + + const prefix = _prefix || "f1"; + if (module.modules[prefix]) return prefix; // already builded + module.modules[prefix] = { + n64: n64 + }; + + const intPrefix = _intPrefix || "int"; + const f1mPrefix = buildF1m$2(module, q, _f1mPrefix, intPrefix); + + + const pR2 = module.modules[f1mPrefix].pR2; + const pq = module.modules[f1mPrefix].pq; + const pePlusOne = module.modules[f1mPrefix].pePlusOne; + + function buildMul() { + const pAux1 = module.alloc(n8); + + const f = module.addFunction(prefix+ "_mul"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + f.addCode(c.call(f1mPrefix + "_mul", c.getLocal("x"), c.getLocal("y"), c.i32_const(pAux1))); + f.addCode(c.call(f1mPrefix + "_mul", c.i32_const(pAux1), c.i32_const(pR2), c.getLocal("r"))); + } + + function buildSquare() { + const f = module.addFunction(prefix+"_square"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode(c.call(prefix + "_mul", c.getLocal("x"), c.getLocal("x"), c.getLocal("r"))); + } + + + function buildInverse() { + + const f = module.addFunction(prefix+ "_inverse"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + f.addCode(c.call(intPrefix + "_inverseMod", c.getLocal("x"), c.i32_const(pq), c.getLocal("r"))); + } + + function buildIsNegative() { + const f = module.addFunction(prefix+"_isNegative"); + f.addParam("x", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + f.addCode( + c.call(intPrefix + "_gte", c.getLocal("x"), c.i32_const(pePlusOne) ) + ); + } + + + buildMul(); + buildSquare(); + buildInverse(); + buildIsNegative(); + module.exportFunction(f1mPrefix + "_add", prefix + "_add"); + module.exportFunction(f1mPrefix + "_sub", prefix + "_sub"); + module.exportFunction(f1mPrefix + "_neg", prefix + "_neg"); + module.exportFunction(prefix + "_mul"); + module.exportFunction(prefix + "_square"); + module.exportFunction(prefix + "_inverse"); + module.exportFunction(prefix + "_isNegative"); + module.exportFunction(f1mPrefix + "_copy", prefix+"_copy"); + module.exportFunction(f1mPrefix + "_zero", prefix+"_zero"); + module.exportFunction(f1mPrefix + "_one", prefix+"_one"); + module.exportFunction(f1mPrefix + "_isZero", prefix+"_isZero"); + module.exportFunction(f1mPrefix + "_eq", prefix+"_eq"); + + return prefix; +}; + +/* + Copyright 2019 0KIMS association. + + This file is part of wasmsnark (Web Assembly zkSnark Prover). + + wasmsnark is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + wasmsnark is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with wasmsnark. If not, see . +*/ + +const buildExp$1 = build_timesscalar; +const buildBatchInverse$1 = build_batchinverse; +const utils$4 = utils$6; + +var build_f2m = function buildF2m(module, mulNonResidueFn, prefix, f1mPrefix) { + + if (module.modules[prefix]) return prefix; // already builded + + const f1n8 = module.modules[f1mPrefix].n64*8; + const q = module.modules[f1mPrefix].q; + + module.modules[prefix] = { + n64: module.modules[f1mPrefix].n64*2 + }; + + function buildAdd() { + const f = module.addFunction(prefix+"_add"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const y0 = c.getLocal("y"); + const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_add", x0, y0, r0), + c.call(f1mPrefix+"_add", x1, y1, r1), + ); + } + + function buildTimesScalar() { + const f = module.addFunction(prefix+"_timesScalar"); + f.addParam("x", "i32"); + f.addParam("scalar", "i32"); + f.addParam("scalarLen", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_timesScalar", x0, c.getLocal("scalar"), c.getLocal("scalarLen"), r0), + c.call(f1mPrefix+"_timesScalar", x1, c.getLocal("scalar"), c.getLocal("scalarLen"), r1), + ); + } + + function buildSub() { + const f = module.addFunction(prefix+"_sub"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const y0 = c.getLocal("y"); + const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_sub", x0, y0, r0), + c.call(f1mPrefix+"_sub", x1, y1, r1), + ); + } + + function buildNeg() { + const f = module.addFunction(prefix+"_neg"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_neg", x0, r0), + c.call(f1mPrefix+"_neg", x1, r1), + ); + } + + function buildConjugate() { + const f = module.addFunction(prefix+"_conjugate"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_copy", x0, r0), + c.call(f1mPrefix+"_neg", x1, r1), + ); + } + + + function buildIsNegative() { + const f = module.addFunction(prefix+"_isNegative"); + f.addParam("x", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + + f.addCode( + c.if( + c.call(f1mPrefix+"_isZero", x1), + c.ret(c.call(f1mPrefix+"_isNegative", x0)) + ), + c.ret(c.call(f1mPrefix+"_isNegative", x1)) + ); + } + + function buildMul() { + const f = module.addFunction(prefix+"_mul"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const y0 = c.getLocal("y"); + const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + const A = c.i32_const(module.alloc(f1n8)); + const B = c.i32_const(module.alloc(f1n8)); + const C = c.i32_const(module.alloc(f1n8)); + const D = c.i32_const(module.alloc(f1n8)); + + + f.addCode( + c.call(f1mPrefix + "_mul", x0, y0, A), // A = x0*y0 + c.call(f1mPrefix + "_mul", x1, y1, B), // B = x1*y1 + + c.call(f1mPrefix + "_add", x0, x1, C), // C = x0 + x1 + c.call(f1mPrefix + "_add", y0, y1, D), // D = y0 + y1 + c.call(f1mPrefix + "_mul", C, D, C), // C = (x0 + x1)*(y0 + y1) = x0*y0+x0*y1+x1*y0+x1*y1 + + // c.call(f1mPrefix + "_mul", B, c.i32_const(pNonResidue), r0), // r0 = nr*(x1*y1) + c.call(mulNonResidueFn, B, r0), // r0 = nr*(x1*y1) + c.call(f1mPrefix + "_add", A, r0, r0), // r0 = x0*y0 + nr*(x1*y1) + c.call(f1mPrefix + "_add", A, B, r1), // r1 = x0*y0+x1*y1 + c.call(f1mPrefix + "_sub", C, r1, r1) // r1 = x0*y0+x0*y1+x1*y0+x1*y1 - x0*y0+x1*y1 = x0*y1+x1*y0 + ); + + } + + function buildMul1() { + const f = module.addFunction(prefix+"_mul1"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const y = c.getLocal("y"); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + + f.addCode( + c.call(f1mPrefix + "_mul", x0, y, r0), // A = x0*y + c.call(f1mPrefix + "_mul", x1, y, r1), // B = x1*y + ); + } + + function buildSquare() { + const f = module.addFunction(prefix+"_square"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + const AB = c.i32_const(module.alloc(f1n8)); + const APB = c.i32_const(module.alloc(f1n8)); + const APNB = c.i32_const(module.alloc(f1n8)); + const ABPNAB = c.i32_const(module.alloc(f1n8)); + + + f.addCode( + // AB = x0*y1 + c.call(f1mPrefix + "_mul", x0, x1, AB), + + // APB = x0+y1 + c.call(f1mPrefix + "_add", x0, x1, APB), + + // APBN0 = x0 + nr*x1 + c.call(mulNonResidueFn, x1, APNB), + c.call(f1mPrefix + "_add", x0, APNB, APNB), + + // ABPNAB = ab + nr*ab + c.call(mulNonResidueFn, AB, ABPNAB), + c.call(f1mPrefix + "_add", ABPNAB, AB, ABPNAB), + + // r0 = APB * APNB - ABPNAB + c.call(f1mPrefix + "_mul", APB, APNB, r0), + c.call(f1mPrefix + "_sub", r0, ABPNAB, r0), + + // r1 = AB + AB + c.call(f1mPrefix + "_add", AB, AB, r1), + ); + + } + + + function buildToMontgomery() { + const f = module.addFunction(prefix+"_toMontgomery"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_toMontgomery", x0, r0), + c.call(f1mPrefix+"_toMontgomery", x1, r1) + ); + } + + function buildFromMontgomery() { + const f = module.addFunction(prefix+"_fromMontgomery"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_fromMontgomery", x0, r0), + c.call(f1mPrefix+"_fromMontgomery", x1, r1) + ); + } + + function buildCopy() { + const f = module.addFunction(prefix+"_copy"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_copy", x0, r0), + c.call(f1mPrefix+"_copy", x1, r1) + ); + } + + function buildZero() { + const f = module.addFunction(prefix+"_zero"); + f.addParam("x", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_zero", x0), + c.call(f1mPrefix+"_zero", x1) + ); + } + + function buildOne() { + const f = module.addFunction(prefix+"_one"); + f.addParam("x", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_one", x0), + c.call(f1mPrefix+"_zero", x1) + ); + } + + function buildEq() { + const f = module.addFunction(prefix+"_eq"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const y0 = c.getLocal("y"); + const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); + + f.addCode( + c.i32_and( + c.call(f1mPrefix+"_eq", x0, y0), + c.call(f1mPrefix+"_eq", x1, y1) + ) + ); + } + + function buildIsZero() { + const f = module.addFunction(prefix+"_isZero"); + f.addParam("x", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + + f.addCode( + c.i32_and( + c.call(f1mPrefix+"_isZero", x0), + c.call(f1mPrefix+"_isZero", x1) + ) + ); + } + + function buildInverse() { + const f = module.addFunction(prefix+"_inverse"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + const t0 = c.i32_const(module.alloc(f1n8)); + const t1 = c.i32_const(module.alloc(f1n8)); + const t2 = c.i32_const(module.alloc(f1n8)); + const t3 = c.i32_const(module.alloc(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_square", x0, t0), + c.call(f1mPrefix+"_square", x1, t1), + // c.call(f1mPrefix+"_mul", t1, c.i32_const(pNonResidue), t2), + c.call(mulNonResidueFn, t1, t2), + + c.call(f1mPrefix+"_sub", t0, t2, t2), + c.call(f1mPrefix+"_inverse", t2, t3), + + c.call(f1mPrefix+"_mul", x0, t3, r0), + c.call(f1mPrefix+"_mul", x1, t3, r1), + c.call(f1mPrefix+"_neg", r1, r1), + ); + } + + + function buildSign() { + const f = module.addFunction(prefix+"_sign"); + f.addParam("x", "i32"); + f.addLocal("s", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + + f.addCode( + c.setLocal("s" , c.call( f1mPrefix + "_sign", x1)), + c.if( + c.getLocal("s"), + c.ret(c.getLocal("s")) + ), + c.ret(c.call( f1mPrefix + "_sign", x0)) + ); + } + + function buildIsOne() { + const f = module.addFunction(prefix+"_isOne"); + f.addParam("x", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + + f.addCode( + c.ret(c.i32_and( + c.call(f1mPrefix + "_isOne", x0), + c.call(f1mPrefix + "_isZero", x1), + )) + ); + } + + + // Check here: https://eprint.iacr.org/2012/685.pdf + // Alg 9adj + function buildSqrt() { + + const f = module.addFunction(prefix+"_sqrt"); + f.addParam("a", "i32"); + f.addParam("pr", "i32"); + + const c = f.getCodeBuilder(); + + // BigInt can't take `undefined` so we use `|| 0` + const e34 = c.i32_const(module.alloc(utils$4.bigInt2BytesLE((BigInt(q || 0) - 3n) / 4n, f1n8 ))); + // BigInt can't take `undefined` so we use `|| 0` + const e12 = c.i32_const(module.alloc(utils$4.bigInt2BytesLE((BigInt(q || 0) - 1n) / 2n, f1n8 ))); + + const a = c.getLocal("a"); + const a1 = c.i32_const(module.alloc(f1n8*2)); + const alpha = c.i32_const(module.alloc(f1n8*2)); + const a0 = c.i32_const(module.alloc(f1n8*2)); + const pn1 = module.alloc(f1n8*2); + const n1 = c.i32_const(pn1); + const n1a = c.i32_const(pn1); + const n1b = c.i32_const(pn1+f1n8); + const x0 = c.i32_const(module.alloc(f1n8*2)); + const b = c.i32_const(module.alloc(f1n8*2)); + + f.addCode( + + c.call(prefix + "_one", n1), + c.call(prefix + "_neg", n1, n1), + + // const a1 = F.pow(a, F.sqrt_e34); + c.call(prefix + "_exp", a, e34, c.i32_const(f1n8), a1), + + // const a1 = F.pow(a, F.sqrt_e34); + c.call(prefix + "_square", a1, alpha), + c.call(prefix + "_mul", a, alpha, alpha), + + // const a0 = F.mul(F.frobenius(1, alfa), alfa); + c.call(prefix + "_conjugate", alpha, a0), + c.call(prefix + "_mul", a0, alpha, a0), + + // if (F.eq(a0, F.negone)) return null; + c.if(c.call(prefix + "_eq",a0,n1), c.unreachable() ), + + // const x0 = F.mul(a1, a); + c.call(prefix + "_mul", a1, a, x0), + + // if (F.eq(alfa, F.negone)) { + c.if( + c.call(prefix + "_eq", alpha, n1), + [ + // x = F.mul(x0, [F.F.zero, F.F.one]); + ...c.call(f1mPrefix + "_zero", n1a), + ...c.call(f1mPrefix + "_one", n1b), + ...c.call(prefix + "_mul", n1, x0, c.getLocal("pr")), + ], + [ + // const b = F.pow(F.add(F.one, alfa), F.sqrt_e12); + ...c.call(prefix + "_one", b), + ...c.call(prefix + "_add", b, alpha, b), + ...c.call(prefix + "_exp", b, e12, c.i32_const(f1n8), b), + + // x = F.mul(b, x0); + ...c.call(prefix + "_mul", b, x0, c.getLocal("pr")), + ] + ) + ); + + } + + + function buildIsSquare() { + + const f = module.addFunction(prefix+"_isSquare"); + f.addParam("a", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + // BigInt can't take `undefined` so we use `|| 0` + const e34 = c.i32_const(module.alloc(utils$4.bigInt2BytesLE((BigInt(q || 0) - 3n) / 4n, f1n8 ))); + + const a = c.getLocal("a"); + const a1 = c.i32_const(module.alloc(f1n8*2)); + const alpha = c.i32_const(module.alloc(f1n8*2)); + const a0 = c.i32_const(module.alloc(f1n8*2)); + const pn1 = module.alloc(f1n8*2); + const n1 = c.i32_const(pn1); + + f.addCode( + + c.call(prefix + "_one", n1), + c.call(prefix + "_neg", n1, n1), + + // const a1 = F.pow(a, F.sqrt_e34); + c.call(prefix + "_exp", a, e34, c.i32_const(f1n8), a1), + + // const a1 = F.pow(a, F.sqrt_e34); + c.call(prefix + "_square", a1, alpha), + c.call(prefix + "_mul", a, alpha, alpha), + + // const a0 = F.mul(F.frobenius(1, alfa), alfa); + c.call(prefix + "_conjugate", alpha, a0), + c.call(prefix + "_mul", a0, alpha, a0), + + // if (F.eq(a0, F.negone)) return null; + c.if( + c.call( + prefix + "_eq", + a0, + n1 + ), + c.ret(c.i32_const(0)) + ), + c.ret(c.i32_const(1)) + ); + + } + + + buildIsZero(); + buildIsOne(); + buildZero(); + buildOne(); + buildCopy(); + buildMul(); + buildMul1(); + buildSquare(); + buildAdd(); + buildSub(); + buildNeg(); + buildConjugate(); + buildToMontgomery(); + buildFromMontgomery(); + buildEq(); + buildInverse(); + buildTimesScalar(); + buildSign(); + buildIsNegative(); + + module.exportFunction(prefix + "_isZero"); + module.exportFunction(prefix + "_isOne"); + module.exportFunction(prefix + "_zero"); + module.exportFunction(prefix + "_one"); + module.exportFunction(prefix + "_copy"); + module.exportFunction(prefix + "_mul"); + module.exportFunction(prefix + "_mul1"); + module.exportFunction(prefix + "_square"); + module.exportFunction(prefix + "_add"); + module.exportFunction(prefix + "_sub"); + module.exportFunction(prefix + "_neg"); + module.exportFunction(prefix + "_sign"); + module.exportFunction(prefix + "_conjugate"); + module.exportFunction(prefix + "_fromMontgomery"); + module.exportFunction(prefix + "_toMontgomery"); + module.exportFunction(prefix + "_eq"); + module.exportFunction(prefix + "_inverse"); + buildBatchInverse$1(module, prefix); + buildExp$1( + module, + prefix + "_exp", + f1n8*2, + prefix + "_mul", + prefix + "_square", + prefix + "_copy", + prefix + "_one", + ); + buildSqrt(); + buildIsSquare(); + + module.exportFunction(prefix + "_exp"); + module.exportFunction(prefix + "_timesScalar"); + module.exportFunction(prefix + "_batchInverse"); + module.exportFunction(prefix + "_sqrt"); + module.exportFunction(prefix + "_isSquare"); + module.exportFunction(prefix + "_isNegative"); + + + return prefix; +}; + +/* + Copyright 2019 0KIMS association. + + This file is part of wasmsnark (Web Assembly zkSnark Prover). + + wasmsnark is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + wasmsnark is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with wasmsnark. If not, see . +*/ + +const buildExp = build_timesscalar; +const buildBatchInverse = build_batchinverse; + +var build_f3m = function buildF3m(module, mulNonResidueFn, prefix, f1mPrefix) { + + if (module.modules[prefix]) return prefix; // already builded + + const f1n8 = module.modules[f1mPrefix].n64*8; + module.modules[prefix] = { + n64: module.modules[f1mPrefix].n64*3 + }; + + function buildAdd() { + const f = module.addFunction(prefix+"_add"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + const y0 = c.getLocal("y"); + const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); + const y2 = c.i32_add(c.getLocal("y"), c.i32_const(2*f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); + + f.addCode( + c.call(f1mPrefix+"_add", x0, y0, r0), + c.call(f1mPrefix+"_add", x1, y1, r1), + c.call(f1mPrefix+"_add", x2, y2, r2), + ); + } + + function buildTimesScalar() { + const f = module.addFunction(prefix+"_timesScalar"); + f.addParam("x", "i32"); + f.addParam("scalar", "i32"); + f.addParam("scalarLen", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); + + f.addCode( + c.call(f1mPrefix+"_timesScalar", x0, c.getLocal("scalar"), c.getLocal("scalarLen"), r0), + c.call(f1mPrefix+"_timesScalar", x1, c.getLocal("scalar"), c.getLocal("scalarLen"), r1), + c.call(f1mPrefix+"_timesScalar", x2, c.getLocal("scalar"), c.getLocal("scalarLen"), r2), + ); + } + + + function buildSub() { + const f = module.addFunction(prefix+"_sub"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + const y0 = c.getLocal("y"); + const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); + const y2 = c.i32_add(c.getLocal("y"), c.i32_const(2*f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); + + f.addCode( + c.call(f1mPrefix+"_sub", x0, y0, r0), + c.call(f1mPrefix+"_sub", x1, y1, r1), + c.call(f1mPrefix+"_sub", x2, y2, r2), + ); + } + + function buildNeg() { + const f = module.addFunction(prefix+"_neg"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); + + f.addCode( + c.call(f1mPrefix+"_neg", x0, r0), + c.call(f1mPrefix+"_neg", x1, r1), + c.call(f1mPrefix+"_neg", x2, r2), + ); + } + + function buildIsNegative() { + const f = module.addFunction(prefix+"_isNegative"); + f.addParam("x", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + + f.addCode( + c.if( + c.call(f1mPrefix+"_isZero", x2), + c.if( + c.call(f1mPrefix+"_isZero", x1), + c.ret(c.call(f1mPrefix+"_isNegative", x0)), + c.ret(c.call(f1mPrefix+"_isNegative", x1)) + ) + ), + c.ret(c.call(f1mPrefix+"_isNegative", x2)) + ); + } + + + function buildMul() { + const f = module.addFunction(prefix+"_mul"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.addParam("r", "i32"); + + const cd = f.getCodeBuilder(); + + const a = cd.getLocal("x"); + const b = cd.i32_add(cd.getLocal("x"), cd.i32_const(f1n8)); + const c = cd.i32_add(cd.getLocal("x"), cd.i32_const(2*f1n8)); + const A = cd.getLocal("y"); + const B = cd.i32_add(cd.getLocal("y"), cd.i32_const(f1n8)); + const C = cd.i32_add(cd.getLocal("y"), cd.i32_const(2*f1n8)); + const r0 = cd.getLocal("r"); + const r1 = cd.i32_add(cd.getLocal("r"), cd.i32_const(f1n8)); + const r2 = cd.i32_add(cd.getLocal("r"), cd.i32_const(2*f1n8)); + + const aA = cd.i32_const(module.alloc(f1n8)); + const bB = cd.i32_const(module.alloc(f1n8)); + const cC = cd.i32_const(module.alloc(f1n8)); + const a_b = cd.i32_const(module.alloc(f1n8)); + const A_B = cd.i32_const(module.alloc(f1n8)); + const a_c = cd.i32_const(module.alloc(f1n8)); + const A_C = cd.i32_const(module.alloc(f1n8)); + const b_c = cd.i32_const(module.alloc(f1n8)); + const B_C = cd.i32_const(module.alloc(f1n8)); + const aA_bB = cd.i32_const(module.alloc(f1n8)); + const aA_cC = cd.i32_const(module.alloc(f1n8)); + const bB_cC = cd.i32_const(module.alloc(f1n8)); + const AUX = cd.i32_const(module.alloc(f1n8)); + + + f.addCode( + cd.call(f1mPrefix + "_mul", a, A, aA), + cd.call(f1mPrefix + "_mul", b, B, bB), + cd.call(f1mPrefix + "_mul", c, C, cC), + + cd.call(f1mPrefix + "_add", a, b, a_b), + cd.call(f1mPrefix + "_add", A, B, A_B), + cd.call(f1mPrefix + "_add", a, c, a_c), + cd.call(f1mPrefix + "_add", A, C, A_C), + cd.call(f1mPrefix + "_add", b, c, b_c), + cd.call(f1mPrefix + "_add", B, C, B_C), + + cd.call(f1mPrefix + "_add", aA, bB, aA_bB), + cd.call(f1mPrefix + "_add", aA, cC, aA_cC), + cd.call(f1mPrefix + "_add", bB, cC, bB_cC), + + cd.call(f1mPrefix + "_mul", b_c, B_C, r0), + cd.call(f1mPrefix + "_sub", r0, bB_cC, r0), + cd.call(mulNonResidueFn, r0, r0), + cd.call(f1mPrefix + "_add", aA, r0, r0), + + cd.call(f1mPrefix + "_mul", a_b, A_B, r1), + cd.call(f1mPrefix + "_sub", r1, aA_bB, r1), + cd.call(mulNonResidueFn, cC, AUX), + cd.call(f1mPrefix + "_add", r1, AUX, r1), + + cd.call(f1mPrefix + "_mul", a_c, A_C, r2), + cd.call(f1mPrefix + "_sub", r2, aA_cC, r2), + cd.call(f1mPrefix + "_add", r2, bB, r2), + ); + + } + + function buildSquare() { + const f = module.addFunction(prefix+"_square"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const A = c.getLocal("x"); + const B = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const C = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); + + const s0 = c.i32_const(module.alloc(f1n8)); + const ab = c.i32_const(module.alloc(f1n8)); + const s1 = c.i32_const(module.alloc(f1n8)); + const s2 = c.i32_const(module.alloc(f1n8)); + const bc = c.i32_const(module.alloc(f1n8)); + const s3 = c.i32_const(module.alloc(f1n8)); + const s4 = c.i32_const(module.alloc(f1n8)); + + + f.addCode( + + c.call(f1mPrefix + "_square", A, s0), + c.call(f1mPrefix + "_mul", A, B, ab), + c.call(f1mPrefix + "_add", ab, ab, s1), + + c.call(f1mPrefix + "_sub", A, B, s2), + c.call(f1mPrefix + "_add", s2, C, s2), + c.call(f1mPrefix + "_square", s2, s2), + + c.call(f1mPrefix + "_mul", B, C, bc), + c.call(f1mPrefix + "_add", bc, bc, s3), + + c.call(f1mPrefix + "_square", C, s4), + + c.call(mulNonResidueFn, s3, r0), + c.call(f1mPrefix + "_add", s0, r0, r0), + + c.call(mulNonResidueFn, s4, r1), + c.call(f1mPrefix + "_add", s1, r1, r1), + + c.call(f1mPrefix + "_add", s0, s4, r2), + c.call(f1mPrefix + "_sub", s3, r2, r2), + c.call(f1mPrefix + "_add", s2, r2, r2), + c.call(f1mPrefix + "_add", s1, r2, r2), + ); + + } + + + function buildToMontgomery() { + const f = module.addFunction(prefix+"_toMontgomery"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); + + f.addCode( + c.call(f1mPrefix+"_toMontgomery", x0, r0), + c.call(f1mPrefix+"_toMontgomery", x1, r1), + c.call(f1mPrefix+"_toMontgomery", x2, r2) + ); + } + + function buildFromMontgomery() { + const f = module.addFunction(prefix+"_fromMontgomery"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); + + f.addCode( + c.call(f1mPrefix+"_fromMontgomery", x0, r0), + c.call(f1mPrefix+"_fromMontgomery", x1, r1), + c.call(f1mPrefix+"_fromMontgomery", x2, r2) + ); + } + + function buildCopy() { + const f = module.addFunction(prefix+"_copy"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); + + f.addCode( + c.call(f1mPrefix+"_copy", x0, r0), + c.call(f1mPrefix+"_copy", x1, r1), + c.call(f1mPrefix+"_copy", x2, r2), + ); + } + + function buildZero() { + const f = module.addFunction(prefix+"_zero"); + f.addParam("x", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + + f.addCode( + c.call(f1mPrefix+"_zero", x0), + c.call(f1mPrefix+"_zero", x1), + c.call(f1mPrefix+"_zero", x2), + ); + } + + function buildOne() { + const f = module.addFunction(prefix+"_one"); + f.addParam("x", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + + f.addCode( + c.call(f1mPrefix+"_one", x0), + c.call(f1mPrefix+"_zero", x1), + c.call(f1mPrefix+"_zero", x2), + ); + } + + function buildEq() { + const f = module.addFunction(prefix+"_eq"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + const y0 = c.getLocal("y"); + const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); + const y2 = c.i32_add(c.getLocal("y"), c.i32_const(2*f1n8)); + + f.addCode( + c.i32_and( + c.i32_and( + c.call(f1mPrefix+"_eq", x0, y0), + c.call(f1mPrefix+"_eq", x1, y1), + ), + c.call(f1mPrefix+"_eq", x2, y2) + ) + ); + } + + function buildIsZero() { + const f = module.addFunction(prefix+"_isZero"); + f.addParam("x", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + + f.addCode( + c.i32_and( + c.i32_and( + c.call(f1mPrefix+"_isZero", x0), + c.call(f1mPrefix+"_isZero", x1) + ), + c.call(f1mPrefix+"_isZero", x2) + ) + ); + } + + function buildInverse() { + const f = module.addFunction(prefix+"_inverse"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); + + const t0 = c.i32_const(module.alloc(f1n8)); + const t1 = c.i32_const(module.alloc(f1n8)); + const t2 = c.i32_const(module.alloc(f1n8)); + const t3 = c.i32_const(module.alloc(f1n8)); + const t4 = c.i32_const(module.alloc(f1n8)); + const t5 = c.i32_const(module.alloc(f1n8)); + const c0 = c.i32_const(module.alloc(f1n8)); + const c1 = c.i32_const(module.alloc(f1n8)); + const c2 = c.i32_const(module.alloc(f1n8)); + const t6 = c.i32_const(module.alloc(f1n8)); + const AUX = c.i32_const(module.alloc(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_square", x0, t0), + c.call(f1mPrefix+"_square", x1, t1), + c.call(f1mPrefix+"_square", x2, t2), + c.call(f1mPrefix+"_mul", x0, x1, t3), + c.call(f1mPrefix+"_mul", x0, x2, t4), + c.call(f1mPrefix+"_mul", x1, x2, t5), + + c.call(mulNonResidueFn, t5, c0), + c.call(f1mPrefix+"_sub", t0, c0, c0), + + c.call(mulNonResidueFn, t2, c1), + c.call(f1mPrefix+"_sub", c1, t3, c1), + + c.call(f1mPrefix+"_sub", t1, t4, c2), + + c.call(f1mPrefix+"_mul", x2, c1, t6), + c.call(f1mPrefix+"_mul", x1, c2, AUX), + c.call(f1mPrefix+"_add", t6, AUX, t6), + c.call(mulNonResidueFn, t6, t6), + c.call(f1mPrefix+"_mul", x0, c0, AUX), + c.call(f1mPrefix+"_add", AUX, t6, t6), + + c.call(f1mPrefix+"_inverse", t6, t6), + + c.call(f1mPrefix+"_mul", t6, c0, r0), + c.call(f1mPrefix+"_mul", t6, c1, r1), + c.call(f1mPrefix+"_mul", t6, c2, r2) + ); + } + + + function buildSign() { + const f = module.addFunction(prefix+"_sign"); + f.addParam("x", "i32"); + f.addLocal("s", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + + f.addCode( + c.setLocal("s" , c.call( f1mPrefix + "_sign", x2)), + c.if( + c.getLocal("s"), + c.ret(c.getLocal("s")) + ), + c.setLocal("s" , c.call( f1mPrefix + "_sign", x1)), + c.if( + c.getLocal("s"), + c.ret(c.getLocal("s")) + ), + c.ret(c.call( f1mPrefix + "_sign", x0)) + ); + } + + function buildIsOne() { + const f = module.addFunction(prefix+"_isOne"); + f.addParam("x", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8*2)); + + f.addCode( + c.ret( + c.i32_and( + c.i32_and( + c.call(f1mPrefix + "_isOne", x0), + c.call(f1mPrefix + "_isZero", x1) + ), + c.call(f1mPrefix + "_isZero", x2) + ) + ) + ); + } + + buildIsZero(); + buildIsOne(); + buildZero(); + buildOne(); + buildCopy(); + buildMul(); + buildSquare(); + buildAdd(); + buildSub(); + buildNeg(); + buildSign(); + buildToMontgomery(); + buildFromMontgomery(); + buildEq(); + buildInverse(); + buildTimesScalar(); + buildIsNegative(); + + module.exportFunction(prefix + "_isZero"); + module.exportFunction(prefix + "_isOne"); + module.exportFunction(prefix + "_zero"); + module.exportFunction(prefix + "_one"); + module.exportFunction(prefix + "_copy"); + module.exportFunction(prefix + "_mul"); + module.exportFunction(prefix + "_square"); + module.exportFunction(prefix + "_add"); + module.exportFunction(prefix + "_sub"); + module.exportFunction(prefix + "_neg"); + module.exportFunction(prefix + "_sign"); + module.exportFunction(prefix + "_fromMontgomery"); + module.exportFunction(prefix + "_toMontgomery"); + module.exportFunction(prefix + "_eq"); + module.exportFunction(prefix + "_inverse"); + buildBatchInverse(module, prefix); + buildExp( + module, + prefix + "_exp", + f1n8*3, + prefix + "_mul", + prefix + "_square", + prefix + "_copy", + prefix + "_one" + ); + module.exportFunction(prefix + "_exp"); + module.exportFunction(prefix + "_timesScalar"); + module.exportFunction(prefix + "_batchInverse"); + module.exportFunction(prefix + "_isNegative"); + + return prefix; +}; + +/* + Copyright 2019 0KIMS association. + + This file is part of wasmsnark (Web Assembly zkSnark Prover). + + wasmsnark is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + wasmsnark is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with wasmsnark. If not, see . +*/ + +var build_timesscalarnaf = function buildTimesScalarNAF(module, fnName, elementLen, opAB, opAA, opAmB, opCopy, opInit) { + + const f = module.addFunction(fnName); + f.addParam("base", "i32"); + f.addParam("scalar", "i32"); + f.addParam("scalarLength", "i32"); + f.addParam("r", "i32"); + f.addLocal("old0", "i32"); + f.addLocal("nbits", "i32"); + f.addLocal("i", "i32"); + f.addLocal("last", "i32"); + f.addLocal("cur", "i32"); + f.addLocal("carry", "i32"); + f.addLocal("p", "i32"); + + const c = f.getCodeBuilder(); + + const aux = c.i32_const(module.alloc(elementLen)); + + function getBit(IDX) { + return c.i32_and( + c.i32_shr_u( + c.i32_load( + c.i32_add( + c.getLocal("scalar"), + c.i32_and( + c.i32_shr_u( + IDX, + c.i32_const(3) + ), + c.i32_const(0xFFFFFFFC) + ) + ) + ), + c.i32_and( + IDX, + c.i32_const(0x1F) + ) + ), + c.i32_const(1) + ); + } + + function pushBit(b) { + return [ + ...c.i32_store8( + c.getLocal("p"), + c.i32_const(b) + ), + ...c.setLocal( + "p", + c.i32_add( + c.getLocal("p"), + c.i32_const(1) + ) + ) + ]; + } + + f.addCode( + c.if( + c.i32_eqz(c.getLocal("scalarLength")), + [ + ...c.call(opInit, c.getLocal("r")), + ...c.ret([]) + ] + ), + c.setLocal("nbits", c.i32_shl(c.getLocal("scalarLength"), c.i32_const(3))), + c.setLocal("old0", c.i32_load(c.i32_const(0))), + c.setLocal("p", c.getLocal("old0")), + c.i32_store( + c.i32_const(0), + c.i32_and( + c.i32_add( + c.i32_add( + c.getLocal("old0"), + c.i32_const(32) + ), + c.getLocal("nbits") + ), + c.i32_const(0xFFFFFFF8) + ) + ), + c.setLocal("i", c.i32_const(1)), + + c.setLocal("last",getBit(c.i32_const(0))), + c.setLocal("carry",c.i32_const(0)), + + c.block(c.loop( + c.br_if(1, c.i32_eq( c.getLocal("i"), c.getLocal("nbits"))), + + c.setLocal("cur", getBit(c.getLocal("i"))), + c.if( c.getLocal("last"), + c.if( c.getLocal("cur"), + c.if(c.getLocal("carry"), + [ + ...c.setLocal("last", c.i32_const(0)), + ...c.setLocal("carry", c.i32_const(1)), + ...pushBit(1) + ] + , + [ + ...c.setLocal("last", c.i32_const(0)), + ...c.setLocal("carry", c.i32_const(1)), + ...pushBit(255) + ], + ), + c.if(c.getLocal("carry"), + [ + ...c.setLocal("last", c.i32_const(0)), + ...c.setLocal("carry", c.i32_const(1)), + ...pushBit(255) + ] + , + [ + ...c.setLocal("last", c.i32_const(0)), + ...c.setLocal("carry", c.i32_const(0)), + ...pushBit(1) + ], + ), + ), + c.if( c.getLocal("cur"), + c.if(c.getLocal("carry"), + [ + ...c.setLocal("last", c.i32_const(0)), + ...c.setLocal("carry", c.i32_const(1)), + ...pushBit(0) + ] + , + [ + ...c.setLocal("last", c.i32_const(1)), + ...c.setLocal("carry", c.i32_const(0)), + ...pushBit(0) + ], + ), + c.if(c.getLocal("carry"), + [ + ...c.setLocal("last", c.i32_const(1)), + ...c.setLocal("carry", c.i32_const(0)), + ...pushBit(0) + ] + , + [ + ...c.setLocal("last", c.i32_const(0)), + ...c.setLocal("carry", c.i32_const(0)), + ...pushBit(0) + ], + ), + ) + ), + c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), + c.br(0) + )), + + c.if( c.getLocal("last"), + c.if(c.getLocal("carry"), + [ + ...pushBit(255), + ...pushBit(0), + ...pushBit(1) + ] + , + [ + ...pushBit(1) + ], + ), + c.if(c.getLocal("carry"), + [ + ...pushBit(0), + ...pushBit(1) + ] + ), + ), + + c.setLocal("p", c.i32_sub(c.getLocal("p"), c.i32_const(1))), + + // p already points to the last bit + + c.call(opCopy, c.getLocal("base"), aux), + + c.call(opInit, c.getLocal("r")), + + c.block(c.loop( + + + c.call(opAA, c.getLocal("r"), c.getLocal("r")), + + + c.setLocal("cur", + c.i32_load8_u( + c.getLocal("p") + ) + ), + + c.if( + c.getLocal("cur"), + c.if( + c.i32_eq(c.getLocal("cur"), c.i32_const(1)), + c.call(opAB, c.getLocal("r"), aux, c.getLocal("r")), + c.call(opAmB, c.getLocal("r"), aux, c.getLocal("r")), + ) + ), + + c.br_if(1, c.i32_eq( c.getLocal("old0"), c.getLocal("p"))), + c.setLocal("p", c.i32_sub(c.getLocal("p"), c.i32_const(1))), + c.br(0) + + )), + + c.i32_store( c.i32_const(0), c.getLocal("old0")) + + ); + +}; + +/* + Copyright 2019 0KIMS association. + + This file is part of wasmsnark (Web Assembly zkSnark Prover). + + wasmsnark is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + wasmsnark is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with wasmsnark. If not, see . +*/ + +var build_multiexp = function buildMultiexp(module, prefix, fnName, opAdd, n8b) { + + const n64g = module.modules[prefix].n64; + const n8g = n64g*8; + + function buildGetChunk() { + const f = module.addFunction(fnName + "_getChunk"); + f.addParam("pScalar", "i32"); + f.addParam("scalarSize", "i32"); // Number of bytes of the scalar + f.addParam("startBit", "i32"); // Bit to start extract + f.addParam("chunkSize", "i32"); // Chunk size in bits + f.addLocal("bitsToEnd", "i32"); + f.addLocal("mask", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + f.addCode( + c.setLocal("bitsToEnd", + c.i32_sub( + c.i32_mul( + c.getLocal("scalarSize"), + c.i32_const(8) + ), + c.getLocal("startBit") + ) + ), + c.if( + c.i32_gt_s( + c.getLocal("chunkSize"), + c.getLocal("bitsToEnd") + ), + c.setLocal( + "mask", + c.i32_sub( + c.i32_shl( + c.i32_const(1), + c.getLocal("bitsToEnd") + ), + c.i32_const(1) + ) + ), + c.setLocal( + "mask", + c.i32_sub( + c.i32_shl( + c.i32_const(1), + c.getLocal("chunkSize") + ), + c.i32_const(1) + ) + ) + ), + c.i32_and( + c.i32_shr_u( + c.i32_load( + c.i32_add( + c.getLocal("pScalar"), + c.i32_shr_u( + c.getLocal("startBit"), + c.i32_const(3) + ) + ), + 0, // offset + 0 // align to byte. + ), + c.i32_and( + c.getLocal("startBit"), + c.i32_const(0x7) + ) + ), + c.getLocal("mask") + ) + ); + } + + function buildMutiexpChunk() { + const f = module.addFunction(fnName + "_chunk"); + f.addParam("pBases", "i32"); + f.addParam("pScalars", "i32"); + f.addParam("scalarSize", "i32"); // Number of points + f.addParam("n", "i32"); // Number of points + f.addParam("startBit", "i32"); // bit where it starts the chunk + f.addParam("chunkSize", "i32"); // bit where it starts the chunk + f.addParam("pr", "i32"); + f.addLocal("nChunks", "i32"); + f.addLocal("itScalar", "i32"); + f.addLocal("endScalar", "i32"); + f.addLocal("itBase", "i32"); + f.addLocal("i", "i32"); + f.addLocal("j", "i32"); + f.addLocal("nTable", "i32"); + f.addLocal("pTable", "i32"); + f.addLocal("idx", "i32"); + f.addLocal("pIdxTable", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode( + c.if( + c.i32_eqz(c.getLocal("n")), + [ + ...c.call(prefix + "_zero", c.getLocal("pr")), + ...c.ret([]) + ] + ), + + // Allocate memory + + c.setLocal( + "nTable", + c.i32_shl( + c.i32_const(1), + c.getLocal("chunkSize") + ) + ), + c.setLocal("pTable", c.i32_load( c.i32_const(0) )), + c.i32_store( + c.i32_const(0), + c.i32_add( + c.getLocal("pTable"), + c.i32_mul( + c.getLocal("nTable"), + c.i32_const(n8g) + ) + ) + ), + + // Reset Table + c.setLocal("j", c.i32_const(0)), + c.block(c.loop( + c.br_if( + 1, + c.i32_eq( + c.getLocal("j"), + c.getLocal("nTable") + ) + ), + + c.call( + prefix + "_zero", + c.i32_add( + c.getLocal("pTable"), + c.i32_mul( + c.getLocal("j"), + c.i32_const(n8g) + ) + ) + ), + + c.setLocal("j", c.i32_add(c.getLocal("j"), c.i32_const(1))), + c.br(0) + )), + + // Distribute elements + c.setLocal("itBase", c.getLocal("pBases")), + c.setLocal("itScalar", c.getLocal("pScalars")), + c.setLocal("endScalar", + c.i32_add( + c.getLocal("pScalars"), + c.i32_mul( + c.getLocal("n"), + c.getLocal("scalarSize") + ) + ) + ), + c.block(c.loop( + c.br_if( + 1, + c.i32_eq( + c.getLocal("itScalar"), + c.getLocal("endScalar") + ) + ), + + c.setLocal( + "idx", + c.call(fnName + "_getChunk", + c.getLocal("itScalar"), + c.getLocal("scalarSize"), + c.getLocal("startBit"), + c.getLocal("chunkSize") + ) + ), + + c.if( + c.getLocal("idx"), + [ + ...c.setLocal( + "pIdxTable", + c.i32_add( + c.getLocal("pTable"), + c.i32_mul( + c.i32_sub( + c.getLocal("idx"), + c.i32_const(1) + ), + c.i32_const(n8g) + ) + ) + ), + ...c.call( + opAdd, + c.getLocal("pIdxTable"), + c.getLocal("itBase"), + c.getLocal("pIdxTable"), + ) + ] + ), + + c.setLocal("itScalar", c.i32_add(c.getLocal("itScalar"), c.getLocal("scalarSize"))), + c.setLocal("itBase", c.i32_add(c.getLocal("itBase"), c.i32_const(n8b))), + c.br(0) + )), + + c.call(fnName + "_reduceTable", c.getLocal("pTable"), c.getLocal("chunkSize")), + c.call( + prefix + "_copy", + c.getLocal("pTable"), + c.getLocal("pr") + ), + + + c.i32_store( + c.i32_const(0), + c.getLocal("pTable") + ) + + ); + } + + function buildMultiexp() { + const f = module.addFunction(fnName); + f.addParam("pBases", "i32"); + f.addParam("pScalars", "i32"); + f.addParam("scalarSize", "i32"); // Number of points + f.addParam("n", "i32"); // Number of points + f.addParam("pr", "i32"); + f.addLocal("chunkSize", "i32"); + f.addLocal("nChunks", "i32"); + f.addLocal("itScalar", "i32"); + f.addLocal("endScalar", "i32"); + f.addLocal("itBase", "i32"); + f.addLocal("itBit", "i32"); + f.addLocal("i", "i32"); + f.addLocal("j", "i32"); + f.addLocal("nTable", "i32"); + f.addLocal("pTable", "i32"); + f.addLocal("idx", "i32"); + f.addLocal("pIdxTable", "i32"); + + const c = f.getCodeBuilder(); + + const aux = c.i32_const(module.alloc(n8g)); + + const pTSizes = module.alloc([ + 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 16, 16, 15, 14, 13, 13, + 12, 11, 10, 9, 8, 7, 7, 6, + 5 , 4, 3, 2, 1, 1, 1, 1 + ]); + + f.addCode( + c.call(prefix + "_zero", c.getLocal("pr")), + c.if( + c.i32_eqz(c.getLocal("n")), + c.ret([]) + ), + c.setLocal("chunkSize", c.i32_load8_u( c.i32_clz(c.getLocal("n")), pTSizes )), + c.setLocal( + "nChunks", + c.i32_add( + c.i32_div_u( + c.i32_sub( + c.i32_shl( + c.getLocal("scalarSize"), + c.i32_const(3) + ), + c.i32_const(1) + ), + c.getLocal("chunkSize") + ), + c.i32_const(1) + ) + ), + + + // Allocate memory + + c.setLocal( + "itBit", + c.i32_mul( + c.i32_sub( + c.getLocal("nChunks"), + c.i32_const(1) + ), + c.getLocal("chunkSize") + ) + ), + c.block(c.loop( + c.br_if( + 1, + c.i32_lt_s( + c.getLocal("itBit"), + c.i32_const(0) + ) + ), + + // Double nChunk times + c.if( + c.i32_eqz(c.call(prefix + "_isZero", c.getLocal("pr"))), + [ + ...c.setLocal("j", c.i32_const(0)), + ...c.block(c.loop( + c.br_if( + 1, + c.i32_eq( + c.getLocal("j"), + c.getLocal("chunkSize") + ) + ), + + c.call(prefix + "_double", c.getLocal("pr"), c.getLocal("pr")), + + c.setLocal("j", c.i32_add(c.getLocal("j"), c.i32_const(1))), + c.br(0) + )) + ] + ), + + c.call( + fnName + "_chunk", + c.getLocal("pBases"), + c.getLocal("pScalars"), + c.getLocal("scalarSize"), + c.getLocal("n"), + c.getLocal("itBit"), + c.getLocal("chunkSize"), + aux + ), + + c.call( + prefix + "_add", + c.getLocal("pr"), + aux, + c.getLocal("pr") + ), + c.setLocal("itBit", c.i32_sub(c.getLocal("itBit"), c.getLocal("chunkSize"))), + c.br(0) + )) + ); + } + + function buildReduceTable() { + const f = module.addFunction(fnName + "_reduceTable"); + f.addParam("pTable", "i32"); + f.addParam("p", "i32"); // Number of bits of the table + f.addLocal("half", "i32"); + f.addLocal("it1", "i32"); + f.addLocal("it2", "i32"); + f.addLocal("pAcc", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode( + c.if( + c.i32_eq(c.getLocal("p"), c.i32_const(1)), + c.ret([]) + ), + c.setLocal( + "half", + c.i32_shl( + c.i32_const(1), + c.i32_sub( + c.getLocal("p"), + c.i32_const(1) + ) + ) + ), + + c.setLocal("it1", c.getLocal("pTable")), + c.setLocal( + "it2", + c.i32_add( + c.getLocal("pTable"), + c.i32_mul( + c.getLocal("half"), + c.i32_const(n8g) + ) + ) + ), + c.setLocal("pAcc", + c.i32_sub( + c.getLocal("it2"), + c.i32_const(n8g) + ) + ), + c.block(c.loop( + c.br_if( + 1, + c.i32_eq( + c.getLocal("it1"), + c.getLocal("pAcc") + ) + ), + c.call( + prefix + "_add", + c.getLocal("it1"), + c.getLocal("it2"), + c.getLocal("it1") + ), + c.call( + prefix + "_add", + c.getLocal("pAcc"), + c.getLocal("it2"), + c.getLocal("pAcc") + ), + c.setLocal("it1", c.i32_add(c.getLocal("it1"), c.i32_const(n8g))), + c.setLocal("it2", c.i32_add(c.getLocal("it2"), c.i32_const(n8g))), + c.br(0) + )), + + c.call( + fnName + "_reduceTable", + c.getLocal("pTable"), + c.i32_sub( + c.getLocal("p"), + c.i32_const(1) + ) + ), + + c.setLocal("p", c.i32_sub(c.getLocal("p"), c.i32_const(1))), + c.block(c.loop( + c.br_if(1, c.i32_eqz(c.getLocal("p"))), + c.call(prefix + "_double", c.getLocal("pAcc"), c.getLocal("pAcc")), + c.setLocal("p", c.i32_sub(c.getLocal("p"), c.i32_const(1))), + c.br(0) + )), + + c.call(prefix + "_add", c.getLocal("pTable"), c.getLocal("pAcc"), c.getLocal("pTable")) + ); + } + + buildGetChunk(); + buildReduceTable(); + buildMutiexpChunk(); + buildMultiexp(); + + module.exportFunction(fnName); + module.exportFunction(fnName +"_chunk"); + + +}; + +/* + Copyright 2019 0KIMS association. + + This file is part of wasmsnark (Web Assembly zkSnark Prover). + + wasmsnark is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + wasmsnark is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with wasmsnark. If not, see . +*/ + +const buildTimesScalarNAF = build_timesscalarnaf; +//const buildTimesScalar = require("./build_timesscalar"); +const buildBatchConvertion = build_batchconvertion; +const buildMultiexp$1 = build_multiexp; + +var build_curve_jacobian_a0 = function buildCurve(module, prefix, prefixField, pB) { const n64 = module.modules[prefixField].n64; @@ -63337,7 +71800,7 @@ module.exports = function buildCurve(module, prefix, prefixField, pB) { f.addCode( c.if( - c.call(prefix + "_isZero", c.getLocal("pIn")), + c.call(prefix + "_isZeroAffine", c.getLocal("pIn")), [ ...c.call(prefixField + "_zero", c.getLocal("pOut")), ...c.i32_store8( @@ -63382,10 +71845,6 @@ module.exports = function buildCurve(module, prefix, prefixField, pB) { c.call(prefix + "_isZeroAffine", c.getLocal("pIn")), [ ...c.call(prefix + "_zeroAffine", c.getLocal("pOut")), - ...c.i32_store8( - c.getLocal("pOut"), - c.i32_const(0x40) - ), ...c.ret([]) ] ), @@ -63488,32 +71947,6 @@ module.exports = function buildCurve(module, prefix, prefixField, pB) { ); } - - function buildInCurveAffine() { - const f = module.addFunction(prefix + "_inCurveAffine"); - f.addParam("pIn", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x = c.getLocal("pIn"); - const y = c.i32_add(c.getLocal("pIn"), n8); - - const y2 = module.alloc(n8*2); - const x3b = module.alloc(n8*2); - - f.addCode( - c.call(prefixField + "_square", y, y2), - c.call(prefixField + "_square", x, x3b), - c.call(prefixField + "_mul", x, x3b, x3b), - c.call(prefixField + "_add", x3b, c.i32_const(pB), x3b), - - c.ret( - c.call(prefixField + "_eq", y2, x3b) - ) - ); - } - function buildInCurveAffine() { const f = module.addFunction(prefix + "_inCurveAffine"); f.addParam("pIn", "i32"); @@ -63604,8 +72037,8 @@ module.exports = function buildCurve(module, prefix, prefixField, pB) { buildBatchConvertion(module, prefix + "_batchToJacobian", prefix + "_toJacobian", n8*2, n8*3, true); - buildMultiexp(module, prefix, prefix + "_multiexp", prefix + "_add", n8*3); - buildMultiexp(module, prefix, prefix + "_multiexpAffine", prefix + "_addMixed", n8*2); + buildMultiexp$1(module, prefix, prefix + "_multiexp", prefix + "_add", n8*3); + buildMultiexp$1(module, prefix, prefix + "_multiexpAffine", prefix + "_addMixed", n8*2); /* buildTimesScalar( @@ -63706,12 +72139,6 @@ module.exports = function buildCurve(module, prefix, prefixField, pB) { return prefix; }; - -/***/ }), - -/***/ 8138: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /* Copyright 2019 0KIMS association. @@ -63731,2434 +72158,10 @@ module.exports = function buildCurve(module, prefix, prefixField, pB) { along with wasmsnark. If not, see . */ -const bigInt = __webpack_require__(2096); +const { isOdd: isOdd$2, modInv: modInv$1, modPow } = bigint; +const utils$3 = utils$6; -const buildF1m =__webpack_require__(75); - -module.exports = function buildF1(module, _q, _prefix, _f1mPrefix, _intPrefix) { - - const q = bigInt(_q); - const n64 = Math.floor((q.minus(1).bitLength() - 1)/64) +1; - const n8 = n64*8; - - const prefix = _prefix || "f1"; - if (module.modules[prefix]) return prefix; // already builded - module.modules[prefix] = { - n64: n64 - }; - - const intPrefix = _intPrefix || "int"; - const f1mPrefix = buildF1m(module, q, _f1mPrefix, intPrefix); - - - const pR2 = module.modules[f1mPrefix].pR2; - const pq = module.modules[f1mPrefix].pq; - const pePlusOne = module.modules[f1mPrefix].pePlusOne; - - function buildMul() { - const pAux1 = module.alloc(n8); - - const f = module.addFunction(prefix+ "_mul"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - f.addCode(c.call(f1mPrefix + "_mul", c.getLocal("x"), c.getLocal("y"), c.i32_const(pAux1))); - f.addCode(c.call(f1mPrefix + "_mul", c.i32_const(pAux1), c.i32_const(pR2), c.getLocal("r"))); - } - - function buildSquare() { - const f = module.addFunction(prefix+"_square"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode(c.call(prefix + "_mul", c.getLocal("x"), c.getLocal("x"), c.getLocal("r"))); - } - - - function buildInverse() { - - const f = module.addFunction(prefix+ "_inverse"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - f.addCode(c.call(intPrefix + "_inverseMod", c.getLocal("x"), c.i32_const(pq), c.getLocal("r"))); - } - - function buildIsNegative() { - const f = module.addFunction(prefix+"_isNegative"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call(intPrefix + "_gte", c.getLocal("x"), c.i32_const(pePlusOne) ) - ); - } - - - buildMul(); - buildSquare(); - buildInverse(); - buildIsNegative(); - module.exportFunction(f1mPrefix + "_add", prefix + "_add"); - module.exportFunction(f1mPrefix + "_sub", prefix + "_sub"); - module.exportFunction(f1mPrefix + "_neg", prefix + "_neg"); - module.exportFunction(prefix + "_mul"); - module.exportFunction(prefix + "_square"); - module.exportFunction(prefix + "_inverse"); - module.exportFunction(prefix + "_isNegative"); - module.exportFunction(f1mPrefix + "_copy", prefix+"_copy"); - module.exportFunction(f1mPrefix + "_zero", prefix+"_zero"); - module.exportFunction(f1mPrefix + "_one", prefix+"_one"); - module.exportFunction(f1mPrefix + "_isZero", prefix+"_isZero"); - module.exportFunction(f1mPrefix + "_eq", prefix+"_eq"); - - return prefix; -}; - - -/***/ }), - -/***/ 75: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ - -const bigInt = __webpack_require__(2096); -const buildInt = __webpack_require__(6754); -const utils = __webpack_require__(2333); -const buildExp = __webpack_require__(5107); -const buildBatchInverse = __webpack_require__(8163); -const buildBatchConvertion = __webpack_require__(9440); -const buildBatchOp = __webpack_require__(4948); - -module.exports = function buildF1m(module, _q, _prefix, _intPrefix) { - const q = bigInt(_q); - const n64 = Math.floor((q.minus(1).bitLength() - 1)/64) +1; - const n32 = n64*2; - const n8 = n64*8; - - const prefix = _prefix || "f1m"; - if (module.modules[prefix]) return prefix; // already builded - - const intPrefix = buildInt(module, n64, _intPrefix); - const pq = module.alloc(n8, utils.bigInt2BytesLE(q, n8)); - - const pR = module.alloc(utils.bigInt2BytesLE(bigInt.one.shiftLeft(n64*64).mod(q), n8)); - const pR2 = module.alloc(utils.bigInt2BytesLE(bigInt.one.shiftLeft(n64*64).square().mod(q), n8)); - const pOne = module.alloc(utils.bigInt2BytesLE(bigInt.one.shiftLeft(n64*64).mod(q), n8)); - const pZero = module.alloc(utils.bigInt2BytesLE(bigInt.zero, n8)); - const _minusOne = q.minus(bigInt.one); - const _e = _minusOne.shiftRight(1); // e = (p-1)/2 - const pe = module.alloc(n8, utils.bigInt2BytesLE(_e, n8)); - - const _ePlusOne = _e.add(bigInt.one); // e = (p-1)/2 - const pePlusOne = module.alloc(n8, utils.bigInt2BytesLE(_ePlusOne, n8)); - - module.modules[prefix] = { - pq: pq, - pR2: pR2, - n64: n64, - q: q, - pOne: pOne, - pZero: pZero, - pePlusOne: pePlusOne - }; - - function buildOne() { - const f = module.addFunction(prefix+"_one"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode(c.call(intPrefix + "_copy", c.i32_const(pOne), c.getLocal("pr"))); - } - - function buildAdd() { - const f = module.addFunction(prefix+"_add"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.if( - c.call(intPrefix+"_add", c.getLocal("x"), c.getLocal("y"), c.getLocal("r")), - c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), - c.if( - c.call(intPrefix+"_gte", c.getLocal("r"), c.i32_const(pq) ), - c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), - ) - ) - ); - } - - function buildSub() { - const f = module.addFunction(prefix+"_sub"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.if( - c.call(intPrefix+"_sub", c.getLocal("x"), c.getLocal("y"), c.getLocal("r")), - c.drop(c.call(intPrefix+"_add", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))) - ) - ); - } - - function buildNeg() { - const f = module.addFunction(prefix+"_neg"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call(prefix + "_sub", c.i32_const(pZero), c.getLocal("x"), c.getLocal("r")) - ); - } - - - function buildIsNegative() { - const f = module.addFunction(prefix+"_isNegative"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const AUX = c.i32_const(module.alloc(n8)); - - f.addCode( - c.call(prefix + "_fromMontgomery", c.getLocal("x"), AUX), - c.call(intPrefix + "_gte", AUX, c.i32_const(pePlusOne) ) - ); - } - - -/* - function buildIsNegative() { - const f = module.addFunction(prefix+"_isNegative"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const AUX = c.i32_const(module.alloc(n8)); - - f.addCode( - c.call(prefix + "_fromMontgomery", c.getLocal("x"), AUX), - c.i32_and( - c.i32_load(AUX), - c.i32_const(1) - ) - ); - } -*/ - - function buildSign() { - const f = module.addFunction(prefix+"_sign"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const AUX = c.i32_const(module.alloc(n8)); - - f.addCode( - c.if ( - c.call(intPrefix + "_isZero", c.getLocal("x")), - c.ret(c.i32_const(0)) - ), - c.call(prefix + "_fromMontgomery", c.getLocal("x"), AUX), - c.if( - c.call(intPrefix + "_gte", AUX, c.i32_const(pePlusOne)), - c.ret(c.i32_const(-1)) - ), - c.ret(c.i32_const(1)) - ); - } - - - function buildMReduct() { - const carries = module.alloc(n32*n32*8); - - const f = module.addFunction(prefix+"_mReduct"); - f.addParam("t", "i32"); - f.addParam("r", "i32"); - f.addLocal("np32", "i64"); - f.addLocal("c", "i64"); - f.addLocal("m", "i64"); - - const c = f.getCodeBuilder(); - - const np32 = bigInt("100000000",16).minus( q.modInv(bigInt("100000000",16))).toJSNumber(); - - f.addCode(c.setLocal("np32", c.i64_const(np32))); - - for (let i=0; i=n32) { - f.addCode( - c.i64_store32( - c.getLocal("r"), - (k-n32)*4, - c.getLocal(c0) - ) - ); - } - [c0, c1] = [c1, c0]; - f.addCode( - c.setLocal(c1, - c.i64_shr_u( - c.getLocal(c0), - c.i64_const(32) - ) - ) - ); - } - f.addCode( - c.i64_store32( - c.getLocal("r"), - n32*4-4, - c.getLocal(c0) - ) - ); - - f.addCode( - c.if( - c.i32_wrap_i64(c.getLocal(c1)), - c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), - c.if( - c.call(intPrefix+"_gte", c.getLocal("r"), c.i32_const(pq) ), - c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), - ) - ) - ); - } - - - function buildSquare() { - - const f = module.addFunction(prefix+"_square"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - f.addLocal("c0", "i64"); - f.addLocal("c1", "i64"); - f.addLocal("c0_old", "i64"); - f.addLocal("c1_old", "i64"); - f.addLocal("np32", "i64"); - - - for (let i=0;i>1) )&&(i>1, k>>1) - ) - ) - ); - - f.addCode( - c.setLocal(c1, - c.i64_add( - c.getLocal(c1), - c.i64_shr_u( - c.getLocal(c0), - c.i64_const(32) - ) - ) - ) - ); - } - - // Add the old carry - - if (k>0) { - f.addCode( - c.setLocal(c0, - c.i64_add( - c.i64_and( - c.getLocal(c0), - c.i64_const(0xFFFFFFFF) - ), - c.i64_and( - c.getLocal(c0_old), - c.i64_const(0xFFFFFFFF) - ), - ) - ) - ); - - f.addCode( - c.setLocal(c1, - c.i64_add( - c.i64_add( - c.getLocal(c1), - c.i64_shr_u( - c.getLocal(c0), - c.i64_const(32) - ) - ), - c.getLocal(c1_old) - ) - ) - ); - } - - - for (let i=Math.max(1, k-n32+1); (i<=k)&&(i=n32) { - f.addCode( - c.i64_store32( - c.getLocal("r"), - (k-n32)*4, - c.getLocal(c0) - ) - ); - } - f.addCode( - c.setLocal( - c0_old, - c.getLocal(c1) - ), - c.setLocal( - c1_old, - c.i64_shr_u( - c.getLocal(c0_old), - c.i64_const(32) - ) - ) - ); - } - f.addCode( - c.i64_store32( - c.getLocal("r"), - n32*4-4, - c.getLocal(c0_old) - ) - ); - - f.addCode( - c.if( - c.i32_wrap_i64(c.getLocal(c1_old)), - c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), - c.if( - c.call(intPrefix+"_gte", c.getLocal("r"), c.i32_const(pq) ), - c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), - ) - ) - ); - } - - - function buildSquareOld() { - const f = module.addFunction(prefix+"_squareOld"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode(c.call(prefix + "_mul", c.getLocal("x"), c.getLocal("x"), c.getLocal("r"))); - } - - function buildToMontgomery() { - const f = module.addFunction(prefix+"_toMontgomery"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - f.addCode(c.call(prefix+"_mul", c.getLocal("x"), c.i32_const(pR2), c.getLocal("r"))); - } - - function buildFromMontgomery() { - - const pAux2 = module.alloc(n8*2); - - const f = module.addFunction(prefix+"_fromMontgomery"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - f.addCode(c.call(intPrefix + "_copy", c.getLocal("x"), c.i32_const(pAux2) )); - f.addCode(c.call(intPrefix + "_zero", c.i32_const(pAux2 + n8) )); - f.addCode(c.call(prefix+"_mReduct", c.i32_const(pAux2), c.getLocal("r"))); - } - - function buildInverse() { - - const f = module.addFunction(prefix+ "_inverse"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - f.addCode(c.call(prefix + "_fromMontgomery", c.getLocal("x"), c.getLocal("r"))); - f.addCode(c.call(intPrefix + "_inverseMod", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))); - f.addCode(c.call(prefix + "_toMontgomery", c.getLocal("r"), c.getLocal("r"))); - } - - // Calculate various valuse needed for sqrt - - - let _nqr = bigInt(2); - if (q.isPrime()) { - while (!_nqr.modPow(_e, q).equals(_minusOne)) _nqr = _nqr.add(bigInt.one); - } - - const pnqr = module.alloc(utils.bigInt2BytesLE(_nqr.shiftLeft(n64*64).mod(q), n8)); - - let s2 = 0; - let _t = _minusOne; - - while ((!_t.isOdd())&&(!_t.isZero())) { - s2++; - _t = _t.shiftRight(1); - } - const pt = module.alloc(n8, utils.bigInt2BytesLE(_t, n8)); - - const _nqrToT = _nqr.modPow(_t, q); - const pNqrToT = module.alloc(utils.bigInt2BytesLE(_nqrToT.shiftLeft(n64*64).mod(q), n8)); - - const _tPlusOneOver2 = _t.add(1).shiftRight(1); - const ptPlusOneOver2 = module.alloc(n8, utils.bigInt2BytesLE(_tPlusOneOver2, n8)); - - function buildSqrt() { - - const f = module.addFunction(prefix+ "_sqrt"); - f.addParam("n", "i32"); - f.addParam("r", "i32"); - f.addLocal("m", "i32"); - f.addLocal("i", "i32"); - f.addLocal("j", "i32"); - - const c = f.getCodeBuilder(); - - const ONE = c.i32_const(pOne); - const C = c.i32_const(module.alloc(n8)); - const T = c.i32_const(module.alloc(n8)); - const R = c.i32_const(module.alloc(n8)); - const SQ = c.i32_const(module.alloc(n8)); - const B = c.i32_const(module.alloc(n8)); - - f.addCode( - - // If (n==0) return 0 - c.if( - c.call(prefix + "_isZero", c.getLocal("n")), - c.ret( - c.call(prefix + "_zero", c.getLocal("r")) - ) - ), - - c.setLocal("m", c.i32_const(s2)), - c.call(prefix + "_copy", c.i32_const(pNqrToT), C), - c.call(prefix + "_exp", c.getLocal("n"), c.i32_const(pt), c.i32_const(n8), T), - c.call(prefix + "_exp", c.getLocal("n"), c.i32_const(ptPlusOneOver2), c.i32_const(n8), R), - - c.block(c.loop( - c.br_if(1, c.call(prefix + "_eq", T, ONE)), - - c.call(prefix + "_square", T, SQ), - c.setLocal("i", c.i32_const(1)), - c.block(c.loop( - c.br_if(1, c.call(prefix + "_eq", SQ, ONE)), - c.call(prefix + "_square", SQ, SQ), - c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )), - - c.call(prefix + "_copy", C, B), - c.setLocal("j", c.i32_sub(c.i32_sub( c.getLocal("m"), c.getLocal("i")), c.i32_const(1)) ), - c.block(c.loop( - c.br_if(1, c.i32_eqz(c.getLocal("j"))), - c.call(prefix + "_square", B, B), - c.setLocal("j", c.i32_sub(c.getLocal("j"), c.i32_const(1))), - c.br(0) - )), - - c.setLocal("m", c.getLocal("i")), - c.call(prefix + "_square", B, C), - c.call(prefix + "_mul", T, C, T), - c.call(prefix + "_mul", R, B, R), - - c.br(0) - )), - - c.if( - c.call(prefix + "_isNegative", R), - c.call(prefix + "_neg", R, c.getLocal("r")), - c.call(prefix + "_copy", R, c.getLocal("r")), - ) - ); - } - - function buildIsSquare() { - const f = module.addFunction(prefix+"_isSquare"); - f.addParam("n", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const ONE = c.i32_const(pOne); - const AUX = c.i32_const(module.alloc(n8)); - - f.addCode( - c.if( - c.call(prefix + "_isZero", c.getLocal("n")), - c.ret(c.i32_const(1)) - ), - c.call(prefix + "_exp", c.getLocal("n"), c.i32_const(pe), c.i32_const(n8), AUX), - c.call(prefix + "_eq", AUX, ONE) - ); - } - - - function buildLoad() { - const f = module.addFunction(prefix+"_load"); - f.addParam("scalar", "i32"); - f.addParam("scalarLen", "i32"); - f.addParam("r", "i32"); - f.addLocal("p", "i32"); - f.addLocal("l", "i32"); - f.addLocal("i", "i32"); - f.addLocal("j", "i32"); - const c = f.getCodeBuilder(); - - const R = c.i32_const(module.alloc(n8)); - const pAux = module.alloc(n8); - const AUX = c.i32_const(pAux); - - f.addCode( - c.call(intPrefix + "_zero", c.getLocal("r")), - c.setLocal("i", c.i32_const(n8)), - c.setLocal("p", c.getLocal("scalar")), - c.block(c.loop( - c.br_if(1, c.i32_gt_u(c.getLocal("i"), c.getLocal("scalarLen"))), - - c.if( - c.i32_eq(c.getLocal("i"), c.i32_const(n8)), - c.call(prefix + "_one", R), - c.call(prefix + "_mul", R, c.i32_const(pR2), R) - ), - c.call(prefix + "_mul", c.getLocal("p"), R, AUX), - c.call(prefix + "_add", c.getLocal("r"), AUX, c.getLocal("r")), - - c.setLocal("p", c.i32_add(c.getLocal("p"), c.i32_const(n8))), - c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(n8))), - c.br(0) - )), - - c.setLocal("l", c.i32_rem_u( c.getLocal("scalarLen"), c.i32_const(n8))), - c.if(c.i32_eqz(c.getLocal("l")), c.ret([])), - c.call(intPrefix + "_zero", AUX), - c.setLocal("j", c.i32_const(0)), - c.block(c.loop( - c.br_if(1, c.i32_eq(c.getLocal("j"), c.getLocal("l"))), - - c.i32_store8( - c.getLocal("j"), - pAux, - c.i32_load8_u(c.getLocal("p")), - ), - c.setLocal("p", c.i32_add(c.getLocal("p"), c.i32_const(1))), - c.setLocal("j", c.i32_add(c.getLocal("j"), c.i32_const(1))), - c.br(0) - )), - - c.if( - c.i32_eq(c.getLocal("i"), c.i32_const(n8)), - c.call(prefix + "_one", R), - c.call(prefix + "_mul", R, c.i32_const(pR2), R) - ), - c.call(prefix + "_mul", AUX, R, AUX), - c.call(prefix + "_add", c.getLocal("r"), AUX, c.getLocal("r")), - ); - } - - function buildTimesScalar() { - const f = module.addFunction(prefix+"_timesScalar"); - f.addParam("x", "i32"); - f.addParam("scalar", "i32"); - f.addParam("scalarLen", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const AUX = c.i32_const(module.alloc(n8)); - - f.addCode( - c.call(prefix + "_load", c.getLocal("scalar"), c.getLocal("scalarLen"), AUX), - c.call(prefix + "_toMontgomery", AUX, AUX), - c.call(prefix + "_mul", c.getLocal("x"), AUX, c.getLocal("r")), - ); - } - - function buildIsOne() { - const f = module.addFunction(prefix+"_isOne"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - f.addCode( - c.ret(c.call(intPrefix + "_eq", c.getLocal("x"), c.i32_const(pOne))) - ); - } - - - module.exportFunction(intPrefix + "_copy", prefix+"_copy"); - module.exportFunction(intPrefix + "_zero", prefix+"_zero"); - module.exportFunction(intPrefix + "_isZero", prefix+"_isZero"); - module.exportFunction(intPrefix + "_eq", prefix+"_eq"); - - buildIsOne(); - buildAdd(); - buildSub(); - buildNeg(); - buildMReduct(); - buildMul(); - buildSquare(); - buildSquareOld(); - buildToMontgomery(); - buildFromMontgomery(); - buildIsNegative(); - buildSign(); - buildInverse(); - buildOne(); - buildLoad(); - buildTimesScalar(); - buildBatchInverse(module, prefix); - buildBatchConvertion(module, prefix + "_batchToMontgomery", prefix + "_toMontgomery", n8, n8); - buildBatchConvertion(module, prefix + "_batchFromMontgomery", prefix + "_fromMontgomery", n8, n8); - buildBatchConvertion(module, prefix + "_batchNeg", prefix + "_neg", n8, n8); - buildBatchOp(module, prefix + "_batchAdd", prefix + "_add", n8, n8); - buildBatchOp(module, prefix + "_batchSub", prefix + "_sub", n8, n8); - buildBatchOp(module, prefix + "_batchMul", prefix + "_mul", n8, n8); - - module.exportFunction(prefix + "_add"); - module.exportFunction(prefix + "_sub"); - module.exportFunction(prefix + "_neg"); - module.exportFunction(prefix + "_isNegative"); - module.exportFunction(prefix + "_isOne"); - module.exportFunction(prefix + "_sign"); - module.exportFunction(prefix + "_mReduct"); - module.exportFunction(prefix + "_mul"); - module.exportFunction(prefix + "_square"); - module.exportFunction(prefix + "_squareOld"); - module.exportFunction(prefix + "_fromMontgomery"); - module.exportFunction(prefix + "_toMontgomery"); - module.exportFunction(prefix + "_inverse"); - module.exportFunction(prefix + "_one"); - module.exportFunction(prefix + "_load"); - module.exportFunction(prefix + "_timesScalar"); - buildExp( - module, - prefix + "_exp", - n8, - prefix + "_mul", - prefix + "_square", - intPrefix + "_copy", - prefix + "_one", - ); - module.exportFunction(prefix + "_exp"); - module.exportFunction(prefix + "_batchInverse"); - if (q.isPrime()) { - buildSqrt(); - buildIsSquare(); - module.exportFunction(prefix + "_sqrt"); - module.exportFunction(prefix + "_isSquare"); - } - module.exportFunction(prefix + "_batchToMontgomery"); - module.exportFunction(prefix + "_batchFromMontgomery"); - // console.log(module.functionIdxByName); - - return prefix; -}; - - -/***/ }), - -/***/ 5420: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ -const buildExp = __webpack_require__(5107); -const buildBatchInverse = __webpack_require__(8163); -const bigInt = __webpack_require__(2096); -const utils = __webpack_require__(2333); - -module.exports = function buildF2m(module, mulNonResidueFn, prefix, f1mPrefix) { - - if (module.modules[prefix]) return prefix; // already builded - - const f1n8 = module.modules[f1mPrefix].n64*8; - const q = module.modules[f1mPrefix].q; - - module.modules[prefix] = { - n64: module.modules[f1mPrefix].n64*2 - }; - - function buildAdd() { - const f = module.addFunction(prefix+"_add"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const y0 = c.getLocal("y"); - const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_add", x0, y0, r0), - c.call(f1mPrefix+"_add", x1, y1, r1), - ); - } - - function buildTimesScalar() { - const f = module.addFunction(prefix+"_timesScalar"); - f.addParam("x", "i32"); - f.addParam("scalar", "i32"); - f.addParam("scalarLen", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_timesScalar", x0, c.getLocal("scalar"), c.getLocal("scalarLen"), r0), - c.call(f1mPrefix+"_timesScalar", x1, c.getLocal("scalar"), c.getLocal("scalarLen"), r1), - ); - } - - function buildSub() { - const f = module.addFunction(prefix+"_sub"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const y0 = c.getLocal("y"); - const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_sub", x0, y0, r0), - c.call(f1mPrefix+"_sub", x1, y1, r1), - ); - } - - function buildNeg() { - const f = module.addFunction(prefix+"_neg"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_neg", x0, r0), - c.call(f1mPrefix+"_neg", x1, r1), - ); - } - - function buildConjugate() { - const f = module.addFunction(prefix+"_conjugate"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_copy", x0, r0), - c.call(f1mPrefix+"_neg", x1, r1), - ); - } - - - function buildIsNegative() { - const f = module.addFunction(prefix+"_isNegative"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - - f.addCode( - c.if( - c.call(f1mPrefix+"_isZero", x1), - c.ret(c.call(f1mPrefix+"_isNegative", x0)) - ), - c.ret(c.call(f1mPrefix+"_isNegative", x1)) - ); - } - - function buildMul() { - const f = module.addFunction(prefix+"_mul"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const y0 = c.getLocal("y"); - const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - const A = c.i32_const(module.alloc(f1n8)); - const B = c.i32_const(module.alloc(f1n8)); - const C = c.i32_const(module.alloc(f1n8)); - const D = c.i32_const(module.alloc(f1n8)); - - - f.addCode( - c.call(f1mPrefix + "_mul", x0, y0, A), // A = x0*y0 - c.call(f1mPrefix + "_mul", x1, y1, B), // B = x1*y1 - - c.call(f1mPrefix + "_add", x0, x1, C), // C = x0 + x1 - c.call(f1mPrefix + "_add", y0, y1, D), // D = y0 + y1 - c.call(f1mPrefix + "_mul", C, D, C), // C = (x0 + x1)*(y0 + y1) = x0*y0+x0*y1+x1*y0+x1*y1 - - // c.call(f1mPrefix + "_mul", B, c.i32_const(pNonResidue), r0), // r0 = nr*(x1*y1) - c.call(mulNonResidueFn, B, r0), // r0 = nr*(x1*y1) - c.call(f1mPrefix + "_add", A, r0, r0), // r0 = x0*y0 + nr*(x1*y1) - c.call(f1mPrefix + "_add", A, B, r1), // r1 = x0*y0+x1*y1 - c.call(f1mPrefix + "_sub", C, r1, r1) // r1 = x0*y0+x0*y1+x1*y0+x1*y1 - x0*y0+x1*y1 = x0*y1+x1*y0 - ); - - } - - function buildMul1() { - const f = module.addFunction(prefix+"_mul1"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const y = c.getLocal("y"); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - - f.addCode( - c.call(f1mPrefix + "_mul", x0, y, r0), // A = x0*y - c.call(f1mPrefix + "_mul", x1, y, r1), // B = x1*y - ); - } - - function buildSquare() { - const f = module.addFunction(prefix+"_square"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - const AB = c.i32_const(module.alloc(f1n8)); - const APB = c.i32_const(module.alloc(f1n8)); - const APNB = c.i32_const(module.alloc(f1n8)); - const ABPNAB = c.i32_const(module.alloc(f1n8)); - - - f.addCode( - // AB = x0*y1 - c.call(f1mPrefix + "_mul", x0, x1, AB), - - // APB = x0+y1 - c.call(f1mPrefix + "_add", x0, x1, APB), - - // APBN0 = x0 + nr*x1 - c.call(mulNonResidueFn, x1, APNB), - c.call(f1mPrefix + "_add", x0, APNB, APNB), - - // ABPNAB = ab + nr*ab - c.call(mulNonResidueFn, AB, ABPNAB), - c.call(f1mPrefix + "_add", ABPNAB, AB, ABPNAB), - - // r0 = APB * APNB - ABPNAB - c.call(f1mPrefix + "_mul", APB, APNB, r0), - c.call(f1mPrefix + "_sub", r0, ABPNAB, r0), - - // r1 = AB + AB - c.call(f1mPrefix + "_add", AB, AB, r1), - ); - - } - - - function buildToMontgomery() { - const f = module.addFunction(prefix+"_toMontgomery"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_toMontgomery", x0, r0), - c.call(f1mPrefix+"_toMontgomery", x1, r1) - ); - } - - function buildFromMontgomery() { - const f = module.addFunction(prefix+"_fromMontgomery"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_fromMontgomery", x0, r0), - c.call(f1mPrefix+"_fromMontgomery", x1, r1) - ); - } - - function buildCopy() { - const f = module.addFunction(prefix+"_copy"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_copy", x0, r0), - c.call(f1mPrefix+"_copy", x1, r1) - ); - } - - function buildZero() { - const f = module.addFunction(prefix+"_zero"); - f.addParam("x", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_zero", x0), - c.call(f1mPrefix+"_zero", x1) - ); - } - - function buildOne() { - const f = module.addFunction(prefix+"_one"); - f.addParam("x", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_one", x0), - c.call(f1mPrefix+"_zero", x1) - ); - } - - function buildEq() { - const f = module.addFunction(prefix+"_eq"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const y0 = c.getLocal("y"); - const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); - - f.addCode( - c.i32_and( - c.call(f1mPrefix+"_eq", x0, y0), - c.call(f1mPrefix+"_eq", x1, y1) - ) - ); - } - - function buildIsZero() { - const f = module.addFunction(prefix+"_isZero"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - - f.addCode( - c.i32_and( - c.call(f1mPrefix+"_isZero", x0), - c.call(f1mPrefix+"_isZero", x1) - ) - ); - } - - function buildInverse() { - const f = module.addFunction(prefix+"_inverse"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - const t0 = c.i32_const(module.alloc(f1n8)); - const t1 = c.i32_const(module.alloc(f1n8)); - const t2 = c.i32_const(module.alloc(f1n8)); - const t3 = c.i32_const(module.alloc(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_square", x0, t0), - c.call(f1mPrefix+"_square", x1, t1), - // c.call(f1mPrefix+"_mul", t1, c.i32_const(pNonResidue), t2), - c.call(mulNonResidueFn, t1, t2), - - c.call(f1mPrefix+"_sub", t0, t2, t2), - c.call(f1mPrefix+"_inverse", t2, t3), - - c.call(f1mPrefix+"_mul", x0, t3, r0), - c.call(f1mPrefix+"_mul", x1, t3, r1), - c.call(f1mPrefix+"_neg", r1, r1), - ); - } - - - function buildSign() { - const f = module.addFunction(prefix+"_sign"); - f.addParam("x", "i32"); - f.addLocal("s", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - - f.addCode( - c.setLocal("s" , c.call( f1mPrefix + "_sign", x1)), - c.if( - c.getLocal("s"), - c.ret(c.getLocal("s")) - ), - c.ret(c.call( f1mPrefix + "_sign", x0)) - ); - } - - function buildIsOne() { - const f = module.addFunction(prefix+"_isOne"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - - f.addCode( - c.ret(c.i32_and( - c.call(f1mPrefix + "_isOne", x0), - c.call(f1mPrefix + "_isZero", x1), - )) - ); - } - - - // Check here: https://eprint.iacr.org/2012/685.pdf - // Alg 9adj - function buildSqrt() { - - const f = module.addFunction(prefix+"_sqrt"); - f.addParam("a", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - const e34 = c.i32_const(module.alloc(utils.bigInt2BytesLE(bigInt(q).minus(bigInt(3)).divide(4), f1n8 ))); - const e12 = c.i32_const(module.alloc(utils.bigInt2BytesLE(bigInt(q).minus(bigInt(1)).divide(2), f1n8 ))); - - const a = c.getLocal("a"); - const a1 = c.i32_const(module.alloc(f1n8*2)); - const alpha = c.i32_const(module.alloc(f1n8*2)); - const a0 = c.i32_const(module.alloc(f1n8*2)); - const pn1 = module.alloc(f1n8*2); - const n1 = c.i32_const(pn1); - const n1a = c.i32_const(pn1); - const n1b = c.i32_const(pn1+f1n8); - const x0 = c.i32_const(module.alloc(f1n8*2)); - const b = c.i32_const(module.alloc(f1n8*2)); - - f.addCode( - - c.call(prefix + "_one", n1), - c.call(prefix + "_neg", n1, n1), - - // const a1 = F.pow(a, F.sqrt_e34); - c.call(prefix + "_exp", a, e34, c.i32_const(f1n8), a1), - - // const a1 = F.pow(a, F.sqrt_e34); - c.call(prefix + "_square", a1, alpha), - c.call(prefix + "_mul", a, alpha, alpha), - - // const a0 = F.mul(F.frobenius(1, alfa), alfa); - c.call(prefix + "_conjugate", alpha, a0), - c.call(prefix + "_mul", a0, alpha, a0), - - // if (F.eq(a0, F.negone)) return null; - c.if(c.call(prefix + "_eq",a0,n1), c.unreachable() ), - - // const x0 = F.mul(a1, a); - c.call(prefix + "_mul", a1, a, x0), - - // if (F.eq(alfa, F.negone)) { - c.if( - c.call(prefix + "_eq", alpha, n1), - [ - // x = F.mul(x0, [F.F.zero, F.F.one]); - ...c.call(f1mPrefix + "_zero", n1a), - ...c.call(f1mPrefix + "_one", n1b), - ...c.call(prefix + "_mul", n1, x0, c.getLocal("pr")), - ], - [ - // const b = F.pow(F.add(F.one, alfa), F.sqrt_e12); - ...c.call(prefix + "_one", b), - ...c.call(prefix + "_add", b, alpha, b), - ...c.call(prefix + "_exp", b, e12, c.i32_const(f1n8), b), - - // x = F.mul(b, x0); - ...c.call(prefix + "_mul", b, x0, c.getLocal("pr")), - ] - ) - ); - - } - - - function buildIsSquare() { - - const f = module.addFunction(prefix+"_isSquare"); - f.addParam("a", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const e34 = c.i32_const(module.alloc(utils.bigInt2BytesLE(bigInt(q).minus(bigInt(3)).divide(4), f1n8 ))); - - const a = c.getLocal("a"); - const a1 = c.i32_const(module.alloc(f1n8*2)); - const alpha = c.i32_const(module.alloc(f1n8*2)); - const a0 = c.i32_const(module.alloc(f1n8*2)); - const pn1 = module.alloc(f1n8*2); - const n1 = c.i32_const(pn1); - - f.addCode( - - c.call(prefix + "_one", n1), - c.call(prefix + "_neg", n1, n1), - - // const a1 = F.pow(a, F.sqrt_e34); - c.call(prefix + "_exp", a, e34, c.i32_const(f1n8), a1), - - // const a1 = F.pow(a, F.sqrt_e34); - c.call(prefix + "_square", a1, alpha), - c.call(prefix + "_mul", a, alpha, alpha), - - // const a0 = F.mul(F.frobenius(1, alfa), alfa); - c.call(prefix + "_conjugate", alpha, a0), - c.call(prefix + "_mul", a0, alpha, a0), - - // if (F.eq(a0, F.negone)) return null; - c.if( - c.call( - prefix + "_eq", - a0, - n1 - ), - c.ret(c.i32_const(0)) - ), - c.ret(c.i32_const(1)) - ); - - } - - - buildIsZero(); - buildIsOne(); - buildZero(); - buildOne(); - buildCopy(); - buildMul(); - buildMul1(); - buildSquare(); - buildAdd(); - buildSub(); - buildNeg(); - buildConjugate(); - buildToMontgomery(); - buildFromMontgomery(); - buildEq(); - buildInverse(); - buildTimesScalar(); - buildSign(); - buildIsNegative(); - - module.exportFunction(prefix + "_isZero"); - module.exportFunction(prefix + "_isOne"); - module.exportFunction(prefix + "_zero"); - module.exportFunction(prefix + "_one"); - module.exportFunction(prefix + "_copy"); - module.exportFunction(prefix + "_mul"); - module.exportFunction(prefix + "_mul1"); - module.exportFunction(prefix + "_square"); - module.exportFunction(prefix + "_add"); - module.exportFunction(prefix + "_sub"); - module.exportFunction(prefix + "_neg"); - module.exportFunction(prefix + "_sign"); - module.exportFunction(prefix + "_conjugate"); - module.exportFunction(prefix + "_fromMontgomery"); - module.exportFunction(prefix + "_toMontgomery"); - module.exportFunction(prefix + "_eq"); - module.exportFunction(prefix + "_inverse"); - buildBatchInverse(module, prefix); - buildExp( - module, - prefix + "_exp", - f1n8*2, - prefix + "_mul", - prefix + "_square", - prefix + "_copy", - prefix + "_one", - ); - buildSqrt(); - buildIsSquare(); - - module.exportFunction(prefix + "_exp"); - module.exportFunction(prefix + "_timesScalar"); - module.exportFunction(prefix + "_batchInverse"); - module.exportFunction(prefix + "_sqrt"); - module.exportFunction(prefix + "_isSquare"); - module.exportFunction(prefix + "_isNegative"); - - - return prefix; -}; - - -/***/ }), - -/***/ 7173: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ -const buildExp = __webpack_require__(5107); -const buildBatchInverse = __webpack_require__(8163); - -module.exports = function buildF3m(module, mulNonResidueFn, prefix, f1mPrefix) { - - if (module.modules[prefix]) return prefix; // already builded - - const f1n8 = module.modules[f1mPrefix].n64*8; - module.modules[prefix] = { - n64: module.modules[f1mPrefix].n64*3 - }; - - function buildAdd() { - const f = module.addFunction(prefix+"_add"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const y0 = c.getLocal("y"); - const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); - const y2 = c.i32_add(c.getLocal("y"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_add", x0, y0, r0), - c.call(f1mPrefix+"_add", x1, y1, r1), - c.call(f1mPrefix+"_add", x2, y2, r2), - ); - } - - function buildTimesScalar() { - const f = module.addFunction(prefix+"_timesScalar"); - f.addParam("x", "i32"); - f.addParam("scalar", "i32"); - f.addParam("scalarLen", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_timesScalar", x0, c.getLocal("scalar"), c.getLocal("scalarLen"), r0), - c.call(f1mPrefix+"_timesScalar", x1, c.getLocal("scalar"), c.getLocal("scalarLen"), r1), - c.call(f1mPrefix+"_timesScalar", x2, c.getLocal("scalar"), c.getLocal("scalarLen"), r2), - ); - } - - - function buildSub() { - const f = module.addFunction(prefix+"_sub"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const y0 = c.getLocal("y"); - const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); - const y2 = c.i32_add(c.getLocal("y"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_sub", x0, y0, r0), - c.call(f1mPrefix+"_sub", x1, y1, r1), - c.call(f1mPrefix+"_sub", x2, y2, r2), - ); - } - - function buildNeg() { - const f = module.addFunction(prefix+"_neg"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_neg", x0, r0), - c.call(f1mPrefix+"_neg", x1, r1), - c.call(f1mPrefix+"_neg", x2, r2), - ); - } - - function buildIsNegative() { - const f = module.addFunction(prefix+"_isNegative"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - - f.addCode( - c.if( - c.call(f1mPrefix+"_isZero", x2), - c.if( - c.call(f1mPrefix+"_isZero", x1), - c.ret(c.call(f1mPrefix+"_isNegative", x0)), - c.ret(c.call(f1mPrefix+"_isNegative", x1)) - ) - ), - c.ret(c.call(f1mPrefix+"_isNegative", x2)) - ); - } - - - function buildMul() { - const f = module.addFunction(prefix+"_mul"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const cd = f.getCodeBuilder(); - - const a = cd.getLocal("x"); - const b = cd.i32_add(cd.getLocal("x"), cd.i32_const(f1n8)); - const c = cd.i32_add(cd.getLocal("x"), cd.i32_const(2*f1n8)); - const A = cd.getLocal("y"); - const B = cd.i32_add(cd.getLocal("y"), cd.i32_const(f1n8)); - const C = cd.i32_add(cd.getLocal("y"), cd.i32_const(2*f1n8)); - const r0 = cd.getLocal("r"); - const r1 = cd.i32_add(cd.getLocal("r"), cd.i32_const(f1n8)); - const r2 = cd.i32_add(cd.getLocal("r"), cd.i32_const(2*f1n8)); - - const aA = cd.i32_const(module.alloc(f1n8)); - const bB = cd.i32_const(module.alloc(f1n8)); - const cC = cd.i32_const(module.alloc(f1n8)); - const a_b = cd.i32_const(module.alloc(f1n8)); - const A_B = cd.i32_const(module.alloc(f1n8)); - const a_c = cd.i32_const(module.alloc(f1n8)); - const A_C = cd.i32_const(module.alloc(f1n8)); - const b_c = cd.i32_const(module.alloc(f1n8)); - const B_C = cd.i32_const(module.alloc(f1n8)); - const aA_bB = cd.i32_const(module.alloc(f1n8)); - const aA_cC = cd.i32_const(module.alloc(f1n8)); - const bB_cC = cd.i32_const(module.alloc(f1n8)); - const AUX = cd.i32_const(module.alloc(f1n8)); - - - f.addCode( - cd.call(f1mPrefix + "_mul", a, A, aA), - cd.call(f1mPrefix + "_mul", b, B, bB), - cd.call(f1mPrefix + "_mul", c, C, cC), - - cd.call(f1mPrefix + "_add", a, b, a_b), - cd.call(f1mPrefix + "_add", A, B, A_B), - cd.call(f1mPrefix + "_add", a, c, a_c), - cd.call(f1mPrefix + "_add", A, C, A_C), - cd.call(f1mPrefix + "_add", b, c, b_c), - cd.call(f1mPrefix + "_add", B, C, B_C), - - cd.call(f1mPrefix + "_add", aA, bB, aA_bB), - cd.call(f1mPrefix + "_add", aA, cC, aA_cC), - cd.call(f1mPrefix + "_add", bB, cC, bB_cC), - - cd.call(f1mPrefix + "_mul", b_c, B_C, r0), - cd.call(f1mPrefix + "_sub", r0, bB_cC, r0), - cd.call(mulNonResidueFn, r0, r0), - cd.call(f1mPrefix + "_add", aA, r0, r0), - - cd.call(f1mPrefix + "_mul", a_b, A_B, r1), - cd.call(f1mPrefix + "_sub", r1, aA_bB, r1), - cd.call(mulNonResidueFn, cC, AUX), - cd.call(f1mPrefix + "_add", r1, AUX, r1), - - cd.call(f1mPrefix + "_mul", a_c, A_C, r2), - cd.call(f1mPrefix + "_sub", r2, aA_cC, r2), - cd.call(f1mPrefix + "_add", r2, bB, r2), - ); - - } - - function buildSquare() { - const f = module.addFunction(prefix+"_square"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const A = c.getLocal("x"); - const B = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const C = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - const s0 = c.i32_const(module.alloc(f1n8)); - const ab = c.i32_const(module.alloc(f1n8)); - const s1 = c.i32_const(module.alloc(f1n8)); - const s2 = c.i32_const(module.alloc(f1n8)); - const bc = c.i32_const(module.alloc(f1n8)); - const s3 = c.i32_const(module.alloc(f1n8)); - const s4 = c.i32_const(module.alloc(f1n8)); - - - f.addCode( - - c.call(f1mPrefix + "_square", A, s0), - c.call(f1mPrefix + "_mul", A, B, ab), - c.call(f1mPrefix + "_add", ab, ab, s1), - - c.call(f1mPrefix + "_sub", A, B, s2), - c.call(f1mPrefix + "_add", s2, C, s2), - c.call(f1mPrefix + "_square", s2, s2), - - c.call(f1mPrefix + "_mul", B, C, bc), - c.call(f1mPrefix + "_add", bc, bc, s3), - - c.call(f1mPrefix + "_square", C, s4), - - c.call(mulNonResidueFn, s3, r0), - c.call(f1mPrefix + "_add", s0, r0, r0), - - c.call(mulNonResidueFn, s4, r1), - c.call(f1mPrefix + "_add", s1, r1, r1), - - c.call(f1mPrefix + "_add", s0, s4, r2), - c.call(f1mPrefix + "_sub", s3, r2, r2), - c.call(f1mPrefix + "_add", s2, r2, r2), - c.call(f1mPrefix + "_add", s1, r2, r2), - ); - - } - - - function buildToMontgomery() { - const f = module.addFunction(prefix+"_toMontgomery"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_toMontgomery", x0, r0), - c.call(f1mPrefix+"_toMontgomery", x1, r1), - c.call(f1mPrefix+"_toMontgomery", x2, r2) - ); - } - - function buildFromMontgomery() { - const f = module.addFunction(prefix+"_fromMontgomery"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_fromMontgomery", x0, r0), - c.call(f1mPrefix+"_fromMontgomery", x1, r1), - c.call(f1mPrefix+"_fromMontgomery", x2, r2) - ); - } - - function buildCopy() { - const f = module.addFunction(prefix+"_copy"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_copy", x0, r0), - c.call(f1mPrefix+"_copy", x1, r1), - c.call(f1mPrefix+"_copy", x2, r2), - ); - } - - function buildZero() { - const f = module.addFunction(prefix+"_zero"); - f.addParam("x", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_zero", x0), - c.call(f1mPrefix+"_zero", x1), - c.call(f1mPrefix+"_zero", x2), - ); - } - - function buildOne() { - const f = module.addFunction(prefix+"_one"); - f.addParam("x", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_one", x0), - c.call(f1mPrefix+"_zero", x1), - c.call(f1mPrefix+"_zero", x2), - ); - } - - function buildEq() { - const f = module.addFunction(prefix+"_eq"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const y0 = c.getLocal("y"); - const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); - const y2 = c.i32_add(c.getLocal("y"), c.i32_const(2*f1n8)); - - f.addCode( - c.i32_and( - c.i32_and( - c.call(f1mPrefix+"_eq", x0, y0), - c.call(f1mPrefix+"_eq", x1, y1), - ), - c.call(f1mPrefix+"_eq", x2, y2) - ) - ); - } - - function buildIsZero() { - const f = module.addFunction(prefix+"_isZero"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - - f.addCode( - c.i32_and( - c.i32_and( - c.call(f1mPrefix+"_isZero", x0), - c.call(f1mPrefix+"_isZero", x1) - ), - c.call(f1mPrefix+"_isZero", x2) - ) - ); - } - - function buildInverse() { - const f = module.addFunction(prefix+"_inverse"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - const t0 = c.i32_const(module.alloc(f1n8)); - const t1 = c.i32_const(module.alloc(f1n8)); - const t2 = c.i32_const(module.alloc(f1n8)); - const t3 = c.i32_const(module.alloc(f1n8)); - const t4 = c.i32_const(module.alloc(f1n8)); - const t5 = c.i32_const(module.alloc(f1n8)); - const c0 = c.i32_const(module.alloc(f1n8)); - const c1 = c.i32_const(module.alloc(f1n8)); - const c2 = c.i32_const(module.alloc(f1n8)); - const t6 = c.i32_const(module.alloc(f1n8)); - const AUX = c.i32_const(module.alloc(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_square", x0, t0), - c.call(f1mPrefix+"_square", x1, t1), - c.call(f1mPrefix+"_square", x2, t2), - c.call(f1mPrefix+"_mul", x0, x1, t3), - c.call(f1mPrefix+"_mul", x0, x2, t4), - c.call(f1mPrefix+"_mul", x1, x2, t5), - - c.call(mulNonResidueFn, t5, c0), - c.call(f1mPrefix+"_sub", t0, c0, c0), - - c.call(mulNonResidueFn, t2, c1), - c.call(f1mPrefix+"_sub", c1, t3, c1), - - c.call(f1mPrefix+"_sub", t1, t4, c2), - - c.call(f1mPrefix+"_mul", x2, c1, t6), - c.call(f1mPrefix+"_mul", x1, c2, AUX), - c.call(f1mPrefix+"_add", t6, AUX, t6), - c.call(mulNonResidueFn, t6, t6), - c.call(f1mPrefix+"_mul", x0, c0, AUX), - c.call(f1mPrefix+"_add", AUX, t6, t6), - - c.call(f1mPrefix+"_inverse", t6, t6), - - c.call(f1mPrefix+"_mul", t6, c0, r0), - c.call(f1mPrefix+"_mul", t6, c1, r1), - c.call(f1mPrefix+"_mul", t6, c2, r2) - ); - } - - - function buildSign() { - const f = module.addFunction(prefix+"_sign"); - f.addParam("x", "i32"); - f.addLocal("s", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - - f.addCode( - c.setLocal("s" , c.call( f1mPrefix + "_sign", x2)), - c.if( - c.getLocal("s"), - c.ret(c.getLocal("s")) - ), - c.setLocal("s" , c.call( f1mPrefix + "_sign", x1)), - c.if( - c.getLocal("s"), - c.ret(c.getLocal("s")) - ), - c.ret(c.call( f1mPrefix + "_sign", x0)) - ); - } - - function buildIsOne() { - const f = module.addFunction(prefix+"_isOne"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8*2)); - - f.addCode( - c.ret( - c.i32_and( - c.i32_and( - c.call(f1mPrefix + "_isOne", x0), - c.call(f1mPrefix + "_isZero", x1) - ), - c.call(f1mPrefix + "_isZero", x2) - ) - ) - ); - } - - buildIsZero(); - buildIsOne(); - buildZero(); - buildOne(); - buildCopy(); - buildMul(); - buildSquare(); - buildAdd(); - buildSub(); - buildNeg(); - buildSign(); - buildToMontgomery(); - buildFromMontgomery(); - buildEq(); - buildInverse(); - buildTimesScalar(); - buildIsNegative(); - - module.exportFunction(prefix + "_isZero"); - module.exportFunction(prefix + "_isOne"); - module.exportFunction(prefix + "_zero"); - module.exportFunction(prefix + "_one"); - module.exportFunction(prefix + "_copy"); - module.exportFunction(prefix + "_mul"); - module.exportFunction(prefix + "_square"); - module.exportFunction(prefix + "_add"); - module.exportFunction(prefix + "_sub"); - module.exportFunction(prefix + "_neg"); - module.exportFunction(prefix + "_sign"); - module.exportFunction(prefix + "_fromMontgomery"); - module.exportFunction(prefix + "_toMontgomery"); - module.exportFunction(prefix + "_eq"); - module.exportFunction(prefix + "_inverse"); - buildBatchInverse(module, prefix); - buildExp( - module, - prefix + "_exp", - f1n8*3, - prefix + "_mul", - prefix + "_square", - prefix + "_copy", - prefix + "_one" - ); - module.exportFunction(prefix + "_exp"); - module.exportFunction(prefix + "_timesScalar"); - module.exportFunction(prefix + "_batchInverse"); - module.exportFunction(prefix + "_isNegative"); - - return prefix; -}; - - -/***/ }), - -/***/ 3911: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ - -const bigInt = __webpack_require__(2096); -const utils = __webpack_require__(2333); - -module.exports = function buildFFT(module, prefix, gPrefix, fPrefix, opGtimesF) { +var build_fft = function buildFFT(module, prefix, gPrefix, fPrefix, opGtimesF) { const n64f = module.modules[fPrefix].n64; const n8f = n64f*8; @@ -66168,61 +72171,61 @@ module.exports = function buildFFT(module, prefix, gPrefix, fPrefix, opGtimesF) const q = module.modules[fPrefix].q; - let rem = q.minus(bigInt(1)); + let rem = q - 1n; let maxBits = 0; - while (!rem.isOdd()) { + while (!isOdd$2(rem)) { maxBits ++; - rem = rem.shiftRight(1); + rem = rem >> 1n; } - let nr = bigInt(2); + let nr = 2n; - while ( nr.modPow(q.shiftRight(1), q).equals(1) ) nr = nr.add(1); + while ( modPow(nr, q >> 1n, q) === 1n ) nr = nr + 1n; // console.log(nr); const w = new Array(maxBits+1); - w[maxBits] = nr.modPow(rem, q); + w[maxBits] = modPow(nr, rem, q); let n=maxBits-1; while (n>=0) { - w[n] = w[n+1].modPow(2, q); + w[n] = modPow(w[n+1], 2n, q); n--; } const bytes = []; - const R = bigInt(1).shiftLeft(n8f*8).mod(q); + const R = (1n << BigInt(n8f*8)) % q; for (let i=0; i { - /* Copyright 2019 0KIMS association. @@ -67528,1581 +73525,7 @@ module.exports = function buildFFT(module, prefix, gPrefix, fPrefix, opGtimesF) along with wasmsnark. If not, see . */ -const utils = __webpack_require__(2333); - -module.exports = function buildInt(module, n64, _prefix) { - - const prefix = _prefix || "int"; - if (module.modules[prefix]) return prefix; // already builded - module.modules[prefix] = {}; - - const n32 = n64*2; - const n8 = n64*8; - - const one = module.alloc(n8, utils.bigInt2BytesLE(1, n8)); - - function buildCopy() { - const f = module.addFunction(prefix+"_copy"); - f.addParam("px", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - for (let i=0; i>1) )&&(i>1, k>>1) - ) - ) - ); - - f.addCode( - c.setLocal(c1, - c.i64_add( - c.getLocal(c1), - c.i64_shr_u( - c.getLocal(c0), - c.i64_const(32) - ) - ) - ) - ); - } - - // Add the old carry - - if (k>0) { - f.addCode( - c.setLocal(c0, - c.i64_add( - c.i64_and( - c.getLocal(c0), - c.i64_const(0xFFFFFFFF) - ), - c.i64_and( - c.getLocal(c0_old), - c.i64_const(0xFFFFFFFF) - ), - ) - ) - ); - - f.addCode( - c.setLocal(c1, - c.i64_add( - c.i64_add( - c.getLocal(c1), - c.i64_shr_u( - c.getLocal(c0), - c.i64_const(32) - ) - ), - c.getLocal(c1_old) - ) - ) - ); - } - - f.addCode( - c.i64_store32( - c.getLocal("r"), - k*4, - c.getLocal(c0) - ) - ); - - f.addCode( - c.setLocal( - c0_old, - c.getLocal(c1) - ), - c.setLocal( - c1_old, - c.i64_shr_u( - c.getLocal(c0_old), - c.i64_const(32) - ) - ) - ); - - } - f.addCode( - c.i64_store32( - c.getLocal("r"), - n32*4*2-4, - c.getLocal(c0_old) - ) - ); - - } - - - function buildSquareOld() { - const f = module.addFunction(prefix+"_squareOld"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode(c.call(prefix + "_mul", c.getLocal("x"), c.getLocal("x"), c.getLocal("r"))); - } - - function _buildMul1() { - const f = module.addFunction(prefix+"__mul1"); - f.addParam("px", "i32"); - f.addParam("y", "i64"); - f.addParam("pr", "i32"); - f.addLocal("c", "i64"); - - const c = f.getCodeBuilder(); - - f.addCode(c.setLocal( - "c", - c.i64_mul( - c.i64_load32_u(c.getLocal("px"), 0, 0), - c.getLocal("y") - ) - )); - - f.addCode(c.i64_store32( - c.getLocal("pr"), - 0, - 0, - c.getLocal("c"), - )); - - for (let i=1; i3)&&(Y[eY]==0) ey--; - f.addCode(c.block(c.loop( - c.br_if( - 1, - c.i32_or( - c.i32_load8_u( - c.i32_add(Y , c.getLocal("eY")), - 0, - 0 - ), - c.i32_eq( - c.getLocal("eY"), - c.i32_const(3) - ) - ) - ), - c.setLocal("eY", c.i32_sub(c.getLocal("eY"), c.i32_const(1))), - c.br(0) - ))); - - f.addCode( - c.setLocal( - "sy", - c.i64_add( - c.i64_load32_u( - c.i32_sub( - c.i32_add( Y, c.getLocal("eY")), - c.i32_const(3) - ), - 0, - 0 - ), - c.i64_const(1) - ) - ) - ); - - // Force a divide by 0 if quotien is 0 - f.addCode( - c.if( - c.i64_eq( - c.getLocal("sy"), - c.i64_const(1) - ), - c.drop(c.i64_div_u(c.i64_const(0), c.i64_const(0))) - ) - ); - - f.addCode(c.block(c.loop( - - // while (eX>7)&&(Y[eX]==0) ex--; - c.block(c.loop( - c.br_if( - 1, - c.i32_or( - c.i32_load8_u( - c.i32_add(R , c.getLocal("eX")), - 0, - 0 - ), - c.i32_eq( - c.getLocal("eX"), - c.i32_const(7) - ) - ) - ), - c.setLocal("eX", c.i32_sub(c.getLocal("eX"), c.i32_const(1))), - c.br(0) - )), - - c.setLocal( - "sx", - c.i64_load( - c.i32_sub( - c.i32_add( R, c.getLocal("eX")), - c.i32_const(7) - ), - 0, - 0 - ) - ), - - c.setLocal( - "sx", - c.i64_div_u( - c.getLocal("sx"), - c.getLocal("sy") - ) - ), - c.setLocal( - "ec", - c.i32_sub( - c.i32_sub( - c.getLocal("eX"), - c.getLocal("eY") - ), - c.i32_const(4) - ) - ), - - // While greater than 32 bits or ec is neg, shr and inc exp - c.block(c.loop( - c.br_if( - 1, - c.i32_and( - c.i64_eqz( - c.i64_and( - c.getLocal("sx"), - c.i64_const("0xFFFFFFFF00000000") - ) - ), - c.i32_ge_s( - c.getLocal("ec"), - c.i32_const(0) - ) - ) - ), - - c.setLocal( - "sx", - c.i64_shr_u( - c.getLocal("sx"), - c.i64_const(8) - ) - ), - - c.setLocal( - "ec", - c.i32_add( - c.getLocal("ec"), - c.i32_const(1) - ) - ), - c.br(0) - )), - - c.if( - c.i64_eqz(c.getLocal("sx")), - [ - ...c.br_if( - 2, - c.i32_eqz(c.call(prefix + "_gte", R, Y)) - ), - ...c.setLocal("sx", c.i64_const(1)), - ...c.setLocal("ec", c.i32_const(0)) - ] - ), - - c.call(prefix + "__mul1", Y, c.getLocal("sx"), R2), - c.drop(c.call( - prefix + "_sub", - R, - c.i32_sub(R2, c.getLocal("ec")), - R - )), - c.call( - prefix + "__add1", - c.i32_add(C, c.getLocal("ec")), - c.getLocal("sx") - ), - c.br(0) - ))); - } - - function buildInverseMod() { - - const f = module.addFunction(prefix+"_inverseMod"); - f.addParam("px", "i32"); - f.addParam("pm", "i32"); - f.addParam("pr", "i32"); - f.addLocal("t", "i32"); - f.addLocal("newt", "i32"); - f.addLocal("r", "i32"); - f.addLocal("qq", "i32"); - f.addLocal("qr", "i32"); - f.addLocal("newr", "i32"); - f.addLocal("swp", "i32"); - f.addLocal("x", "i32"); - f.addLocal("signt", "i32"); - f.addLocal("signnewt", "i32"); - f.addLocal("signx", "i32"); - - const c = f.getCodeBuilder(); - - const aux1 = c.i32_const(module.alloc(n8)); - const aux2 = c.i32_const(module.alloc(n8)); - const aux3 = c.i32_const(module.alloc(n8)); - const aux4 = c.i32_const(module.alloc(n8)); - const aux5 = c.i32_const(module.alloc(n8)); - const aux6 = c.i32_const(module.alloc(n8)); - const mulBuff = c.i32_const(module.alloc(n8*2)); - const aux7 = c.i32_const(module.alloc(n8)); - - f.addCode( - c.setLocal("t", aux1), - c.call(prefix + "_zero", aux1), - c.setLocal("signt", c.i32_const(0)), - ); - - f.addCode( - c.setLocal("r", aux2), - c.call(prefix + "_copy", c.getLocal("pm"), aux2) - ); - - f.addCode( - c.setLocal("newt", aux3), - c.call(prefix + "_one", aux3), - c.setLocal("signnewt", c.i32_const(0)), - ); - - f.addCode( - c.setLocal("newr", aux4), - c.call(prefix + "_copy", c.getLocal("px"), aux4) - ); - - - - - f.addCode(c.setLocal("qq", aux5)); - f.addCode(c.setLocal("qr", aux6)); - f.addCode(c.setLocal("x", aux7)); - - f.addCode(c.block(c.loop( - c.br_if( - 1, - c.call(prefix + "_isZero", c.getLocal("newr") ) - ), - c.call(prefix + "_div", c.getLocal("r"), c.getLocal("newr"), c.getLocal("qq"), c.getLocal("qr")), - - c.call(prefix + "_mul", c.getLocal("qq"), c.getLocal("newt"), mulBuff), - - c.if( - c.getLocal("signt"), - c.if( - c.getLocal("signnewt"), - c.if ( - c.call(prefix + "_gte", mulBuff, c.getLocal("t")), - [ - ...c.drop(c.call(prefix + "_sub", mulBuff, c.getLocal("t"), c.getLocal("x"))), - ...c.setLocal("signx", c.i32_const(0)) - ], - [ - ...c.drop(c.call(prefix + "_sub", c.getLocal("t"), mulBuff, c.getLocal("x"))), - ...c.setLocal("signx", c.i32_const(1)) - ], - ), - [ - ...c.drop(c.call(prefix + "_add", mulBuff, c.getLocal("t"), c.getLocal("x"))), - ...c.setLocal("signx", c.i32_const(1)) - ] - ), - c.if( - c.getLocal("signnewt"), - [ - ...c.drop(c.call(prefix + "_add", mulBuff, c.getLocal("t"), c.getLocal("x"))), - ...c.setLocal("signx", c.i32_const(0)) - ], - c.if ( - c.call(prefix + "_gte", c.getLocal("t"), mulBuff), - [ - ...c.drop(c.call(prefix + "_sub", c.getLocal("t"), mulBuff, c.getLocal("x"))), - ...c.setLocal("signx", c.i32_const(0)) - ], - [ - ...c.drop(c.call(prefix + "_sub", mulBuff, c.getLocal("t"), c.getLocal("x"))), - ...c.setLocal("signx", c.i32_const(1)) - ] - ) - ) - ), - - c.setLocal("swp", c.getLocal("t")), - c.setLocal("t", c.getLocal("newt")), - c.setLocal("newt", c.getLocal("x")), - c.setLocal("x", c.getLocal("swp")), - - c.setLocal("signt", c.getLocal("signnewt")), - c.setLocal("signnewt", c.getLocal("signx")), - - c.setLocal("swp", c.getLocal("r")), - c.setLocal("r", c.getLocal("newr")), - c.setLocal("newr", c.getLocal("qr")), - c.setLocal("qr", c.getLocal("swp")), - - c.br(0) - ))); - - f.addCode(c.if( - c.getLocal("signt"), - c.drop(c.call(prefix + "_sub", c.getLocal("pm"), c.getLocal("t"), c.getLocal("pr"))), - c.call(prefix + "_copy", c.getLocal("t"), c.getLocal("pr")) - )); - } - - - buildCopy(); - buildZero(); - buildIsZero(); - buildOne(); - buildEq(); - buildGte(); - buildAdd(); - buildSub(); - buildMul(); - buildSquare(); - buildSquareOld(); - buildDiv(); - buildInverseMod(); - module.exportFunction(prefix+"_copy"); - module.exportFunction(prefix+"_zero"); - module.exportFunction(prefix+"_one"); - module.exportFunction(prefix+"_isZero"); - module.exportFunction(prefix+"_eq"); - module.exportFunction(prefix+"_gte"); - module.exportFunction(prefix+"_add"); - module.exportFunction(prefix+"_sub"); - module.exportFunction(prefix+"_mul"); - module.exportFunction(prefix+"_square"); - module.exportFunction(prefix+"_squareOld"); - module.exportFunction(prefix+"_div"); - module.exportFunction(prefix+"_inverseMod"); - - return prefix; -}; - - -/***/ }), - -/***/ 4911: -/***/ ((module) => { - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ - -module.exports = function buildMultiexp(module, prefix, fnName, opAdd, n8b) { - - const n64g = module.modules[prefix].n64; - const n8g = n64g*8; - - function buildGetChunk() { - const f = module.addFunction(fnName + "_getChunk"); - f.addParam("pScalar", "i32"); - f.addParam("scalarSize", "i32"); // Number of bytes of the scalar - f.addParam("startBit", "i32"); // Bit to start extract - f.addParam("chunkSize", "i32"); // Chunk size in bits - f.addLocal("bitsToEnd", "i32"); - f.addLocal("mask", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.setLocal("bitsToEnd", - c.i32_sub( - c.i32_mul( - c.getLocal("scalarSize"), - c.i32_const(8) - ), - c.getLocal("startBit") - ) - ), - c.if( - c.i32_gt_s( - c.getLocal("chunkSize"), - c.getLocal("bitsToEnd") - ), - c.setLocal( - "mask", - c.i32_sub( - c.i32_shl( - c.i32_const(1), - c.getLocal("bitsToEnd") - ), - c.i32_const(1) - ) - ), - c.setLocal( - "mask", - c.i32_sub( - c.i32_shl( - c.i32_const(1), - c.getLocal("chunkSize") - ), - c.i32_const(1) - ) - ) - ), - c.i32_and( - c.i32_shr_u( - c.i32_load( - c.i32_add( - c.getLocal("pScalar"), - c.i32_shr_u( - c.getLocal("startBit"), - c.i32_const(3) - ) - ), - 0, // offset - 0 // align to byte. - ), - c.i32_and( - c.getLocal("startBit"), - c.i32_const(0x7) - ) - ), - c.getLocal("mask") - ) - ); - } - - function buildMutiexpChunk() { - const f = module.addFunction(fnName + "_chunk"); - f.addParam("pBases", "i32"); - f.addParam("pScalars", "i32"); - f.addParam("scalarSize", "i32"); // Number of points - f.addParam("n", "i32"); // Number of points - f.addParam("startBit", "i32"); // bit where it starts the chunk - f.addParam("chunkSize", "i32"); // bit where it starts the chunk - f.addParam("pr", "i32"); - f.addLocal("nChunks", "i32"); - f.addLocal("itScalar", "i32"); - f.addLocal("endScalar", "i32"); - f.addLocal("itBase", "i32"); - f.addLocal("i", "i32"); - f.addLocal("j", "i32"); - f.addLocal("nTable", "i32"); - f.addLocal("pTable", "i32"); - f.addLocal("idx", "i32"); - f.addLocal("pIdxTable", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.if( - c.i32_eqz(c.getLocal("n")), - [ - ...c.call(prefix + "_zero", c.getLocal("pr")), - ...c.ret([]) - ] - ), - - // Allocate memory - - c.setLocal( - "nTable", - c.i32_shl( - c.i32_const(1), - c.getLocal("chunkSize") - ) - ), - c.setLocal("pTable", c.i32_load( c.i32_const(0) )), - c.i32_store( - c.i32_const(0), - c.i32_add( - c.getLocal("pTable"), - c.i32_mul( - c.getLocal("nTable"), - c.i32_const(n8g) - ) - ) - ), - - // Reset Table - c.setLocal("j", c.i32_const(0)), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("j"), - c.getLocal("nTable") - ) - ), - - c.call( - prefix + "_zero", - c.i32_add( - c.getLocal("pTable"), - c.i32_mul( - c.getLocal("j"), - c.i32_const(n8g) - ) - ) - ), - - c.setLocal("j", c.i32_add(c.getLocal("j"), c.i32_const(1))), - c.br(0) - )), - - // Distribute elements - c.setLocal("itBase", c.getLocal("pBases")), - c.setLocal("itScalar", c.getLocal("pScalars")), - c.setLocal("endScalar", - c.i32_add( - c.getLocal("pScalars"), - c.i32_mul( - c.getLocal("n"), - c.getLocal("scalarSize") - ) - ) - ), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("itScalar"), - c.getLocal("endScalar") - ) - ), - - c.setLocal( - "idx", - c.call(fnName + "_getChunk", - c.getLocal("itScalar"), - c.getLocal("scalarSize"), - c.getLocal("startBit"), - c.getLocal("chunkSize") - ) - ), - - c.if( - c.getLocal("idx"), - [ - ...c.setLocal( - "pIdxTable", - c.i32_add( - c.getLocal("pTable"), - c.i32_mul( - c.i32_sub( - c.getLocal("idx"), - c.i32_const(1) - ), - c.i32_const(n8g) - ) - ) - ), - ...c.call( - opAdd, - c.getLocal("pIdxTable"), - c.getLocal("itBase"), - c.getLocal("pIdxTable"), - ) - ] - ), - - c.setLocal("itScalar", c.i32_add(c.getLocal("itScalar"), c.getLocal("scalarSize"))), - c.setLocal("itBase", c.i32_add(c.getLocal("itBase"), c.i32_const(n8b))), - c.br(0) - )), - - c.call(fnName + "_reduceTable", c.getLocal("pTable"), c.getLocal("chunkSize")), - c.call( - prefix + "_copy", - c.getLocal("pTable"), - c.getLocal("pr") - ), - - - c.i32_store( - c.i32_const(0), - c.getLocal("pTable") - ) - - ); - } - - function buildMultiexp() { - const f = module.addFunction(fnName); - f.addParam("pBases", "i32"); - f.addParam("pScalars", "i32"); - f.addParam("scalarSize", "i32"); // Number of points - f.addParam("n", "i32"); // Number of points - f.addParam("pr", "i32"); - f.addLocal("chunkSize", "i32"); - f.addLocal("nChunks", "i32"); - f.addLocal("itScalar", "i32"); - f.addLocal("endScalar", "i32"); - f.addLocal("itBase", "i32"); - f.addLocal("itBit", "i32"); - f.addLocal("i", "i32"); - f.addLocal("j", "i32"); - f.addLocal("nTable", "i32"); - f.addLocal("pTable", "i32"); - f.addLocal("idx", "i32"); - f.addLocal("pIdxTable", "i32"); - - const c = f.getCodeBuilder(); - - const aux = c.i32_const(module.alloc(n8g)); - - const pTSizes = module.alloc([ - 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 16, 16, 15, 14, 13, 13, - 12, 11, 10, 9, 8, 7, 7, 6, - 5 , 4, 3, 2, 1, 1, 1, 1 - ]); - - f.addCode( - c.call(prefix + "_zero", c.getLocal("pr")), - c.if( - c.i32_eqz(c.getLocal("n")), - c.ret([]) - ), - c.setLocal("chunkSize", c.i32_load8_u( c.i32_clz(c.getLocal("n")), pTSizes )), - c.setLocal( - "nChunks", - c.i32_add( - c.i32_div_u( - c.i32_sub( - c.i32_shl( - c.getLocal("scalarSize"), - c.i32_const(3) - ), - c.i32_const(1) - ), - c.getLocal("chunkSize") - ), - c.i32_const(1) - ) - ), - - - // Allocate memory - - c.setLocal( - "itBit", - c.i32_mul( - c.i32_sub( - c.getLocal("nChunks"), - c.i32_const(1) - ), - c.getLocal("chunkSize") - ) - ), - c.block(c.loop( - c.br_if( - 1, - c.i32_lt_s( - c.getLocal("itBit"), - c.i32_const(0) - ) - ), - - // Double nChunk times - c.if( - c.i32_eqz(c.call(prefix + "_isZero", c.getLocal("pr"))), - [ - ...c.setLocal("j", c.i32_const(0)), - ...c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("j"), - c.getLocal("chunkSize") - ) - ), - - c.call(prefix + "_double", c.getLocal("pr"), c.getLocal("pr")), - - c.setLocal("j", c.i32_add(c.getLocal("j"), c.i32_const(1))), - c.br(0) - )) - ] - ), - - c.call( - fnName + "_chunk", - c.getLocal("pBases"), - c.getLocal("pScalars"), - c.getLocal("scalarSize"), - c.getLocal("n"), - c.getLocal("itBit"), - c.getLocal("chunkSize"), - aux - ), - - c.call( - prefix + "_add", - c.getLocal("pr"), - aux, - c.getLocal("pr") - ), - c.setLocal("itBit", c.i32_sub(c.getLocal("itBit"), c.getLocal("chunkSize"))), - c.br(0) - )) - ); - } - - function buildReduceTable() { - const f = module.addFunction(fnName + "_reduceTable"); - f.addParam("pTable", "i32"); - f.addParam("p", "i32"); // Number of bits of the table - f.addLocal("half", "i32"); - f.addLocal("it1", "i32"); - f.addLocal("it2", "i32"); - f.addLocal("pAcc", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.if( - c.i32_eq(c.getLocal("p"), c.i32_const(1)), - c.ret([]) - ), - c.setLocal( - "half", - c.i32_shl( - c.i32_const(1), - c.i32_sub( - c.getLocal("p"), - c.i32_const(1) - ) - ) - ), - - c.setLocal("it1", c.getLocal("pTable")), - c.setLocal( - "it2", - c.i32_add( - c.getLocal("pTable"), - c.i32_mul( - c.getLocal("half"), - c.i32_const(n8g) - ) - ) - ), - c.setLocal("pAcc", - c.i32_sub( - c.getLocal("it2"), - c.i32_const(n8g) - ) - ), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("it1"), - c.getLocal("pAcc") - ) - ), - c.call( - prefix + "_add", - c.getLocal("it1"), - c.getLocal("it2"), - c.getLocal("it1") - ), - c.call( - prefix + "_add", - c.getLocal("pAcc"), - c.getLocal("it2"), - c.getLocal("pAcc") - ), - c.setLocal("it1", c.i32_add(c.getLocal("it1"), c.i32_const(n8g))), - c.setLocal("it2", c.i32_add(c.getLocal("it2"), c.i32_const(n8g))), - c.br(0) - )), - - c.call( - fnName + "_reduceTable", - c.getLocal("pTable"), - c.i32_sub( - c.getLocal("p"), - c.i32_const(1) - ) - ), - - c.setLocal("p", c.i32_sub(c.getLocal("p"), c.i32_const(1))), - c.block(c.loop( - c.br_if(1, c.i32_eqz(c.getLocal("p"))), - c.call(prefix + "_double", c.getLocal("pAcc"), c.getLocal("pAcc")), - c.setLocal("p", c.i32_sub(c.getLocal("p"), c.i32_const(1))), - c.br(0) - )), - - c.call(prefix + "_add", c.getLocal("pTable"), c.getLocal("pAcc"), c.getLocal("pTable")) - ); - } - - buildGetChunk(); - buildReduceTable(); - buildMutiexpChunk(); - buildMultiexp(); - - module.exportFunction(fnName); - module.exportFunction(fnName +"_chunk"); - - -}; - - - - - -/***/ }), - -/***/ 2896: -/***/ ((module) => { - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ - -module.exports = function buildPol(module, prefix, prefixField) { +var build_pol = function buildPol(module, prefix, prefixField) { const n64 = module.modules[prefixField].n64; const n8 = n64*8; @@ -69242,14 +73665,7 @@ module.exports = function buildPol(module, prefix, prefixField) { }; - -/***/ }), - -/***/ 637: -/***/ ((module) => { - - -module.exports = function buildQAP(module, prefix, prefixField) { +var build_qap = function buildQAP(module, prefix, prefixField) { const n64 = module.modules[prefixField].n64; const n8 = n64*8; @@ -69586,13 +74002,6 @@ module.exports = function buildQAP(module, prefix, prefixField) { }; - - -/***/ }), - -/***/ 5107: -/***/ ((module) => { - /* Copyright 2019 0KIMS association. @@ -69612,320 +74021,3090 @@ module.exports = function buildQAP(module, prefix, prefixField) { along with wasmsnark. If not, see . */ -module.exports = function buildTimesScalar(module, fnName, elementLen, opAB, opAA, opCopy, opInit) { +var build_applykey = function buildApplyKey(module, fnName, gPrefix, frPrefix, sizeGIn, sizeGOut, sizeF, opGtimesF) { const f = module.addFunction(fnName); - f.addParam("base", "i32"); - f.addParam("scalar", "i32"); - f.addParam("scalarLength", "i32"); - f.addParam("r", "i32"); + f.addParam("pIn", "i32"); + f.addParam("n", "i32"); + f.addParam("pFirst", "i32"); + f.addParam("pInc", "i32"); + f.addParam("pOut", "i32"); + f.addLocal("pOldFree", "i32"); f.addLocal("i", "i32"); - f.addLocal("b", "i32"); + f.addLocal("pFrom", "i32"); + f.addLocal("pTo", "i32"); const c = f.getCodeBuilder(); - const aux = c.i32_const(module.alloc(elementLen)); + const t = c.i32_const(module.alloc(sizeF)); f.addCode( - c.if( - c.i32_eqz(c.getLocal("scalarLength")), - [ - ...c.call(opInit, c.getLocal("r")), - ...c.ret([]) - ] + c.setLocal("pFrom", c.getLocal("pIn")), + c.setLocal("pTo", c.getLocal("pOut")), + ); + + // t = first + f.addCode( + c.call( + frPrefix + "_copy", + c.getLocal("pFirst"), + t ) ); - f.addCode(c.call(opCopy, c.getLocal("base"), aux)); - f.addCode(c.call(opInit, c.getLocal("r"))); - f.addCode(c.setLocal("i", c.getLocal("scalarLength"))); - f.addCode(c.block(c.loop( - c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), - - c.setLocal( - "b", - c.i32_load8_u( - c.i32_add( - c.getLocal("scalar"), - c.getLocal("i") - ) - ) - ), - ...innerLoop(), - c.br_if(1, c.i32_eqz ( c.getLocal("i") )), - c.br(0) - ))); - - - function innerLoop() { - const code = []; - for (let i=0; i<8; i++) { - code.push( - ...c.call(opAA, c.getLocal("r"), c.getLocal("r")), - ...c.if( - c.i32_ge_u( c.getLocal("b"), c.i32_const(0x80 >> i)), - [ - ...c.setLocal( - "b", - c.i32_sub( - c.getLocal("b"), - c.i32_const(0x80 >> i) - ) - ), - ...c.call(opAB, c.getLocal("r"),aux, c.getLocal("r")) - ] - ) - ); - } - return code; - } - -}; - - -/***/ }), - -/***/ 3972: -/***/ ((module) => { - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ - -module.exports = function buildTimesScalarNAF(module, fnName, elementLen, opAB, opAA, opAmB, opCopy, opInit) { - - const f = module.addFunction(fnName); - f.addParam("base", "i32"); - f.addParam("scalar", "i32"); - f.addParam("scalarLength", "i32"); - f.addParam("r", "i32"); - f.addLocal("old0", "i32"); - f.addLocal("nbits", "i32"); - f.addLocal("i", "i32"); - f.addLocal("last", "i32"); - f.addLocal("cur", "i32"); - f.addLocal("carry", "i32"); - f.addLocal("p", "i32"); - - const c = f.getCodeBuilder(); - - const aux = c.i32_const(module.alloc(elementLen)); - - function getBit(IDX) { - return c.i32_and( - c.i32_shr_u( - c.i32_load( - c.i32_add( - c.getLocal("scalar"), - c.i32_and( - c.i32_shr_u( - IDX, - c.i32_const(3) - ), - c.i32_const(0xFFFFFFFC) - ) - ) - ), - c.i32_and( - IDX, - c.i32_const(0x1F) - ) - ), - c.i32_const(1) - ); - } - - function pushBit(b) { - return [ - ...c.i32_store8( - c.getLocal("p"), - c.i32_const(b) - ), - ...c.setLocal( - "p", - c.i32_add( - c.getLocal("p"), - c.i32_const(1) - ) - ) - ]; - } - f.addCode( - c.if( - c.i32_eqz(c.getLocal("scalarLength")), - [ - ...c.call(opInit, c.getLocal("r")), - ...c.ret([]) - ] - ), - c.setLocal("nbits", c.i32_shl(c.getLocal("scalarLength"), c.i32_const(3))), - c.setLocal("old0", c.i32_load(c.i32_const(0))), - c.setLocal("p", c.getLocal("old0")), - c.i32_store( - c.i32_const(0), - c.i32_and( - c.i32_add( - c.i32_add( - c.getLocal("old0"), - c.i32_const(32) - ), - c.getLocal("nbits") - ), - c.i32_const(0xFFFFFFF8) - ) - ), - c.setLocal("i", c.i32_const(1)), - - c.setLocal("last",getBit(c.i32_const(0))), - c.setLocal("carry",c.i32_const(0)), - + c.setLocal("i", c.i32_const(0)), c.block(c.loop( - c.br_if(1, c.i32_eq( c.getLocal("i"), c.getLocal("nbits"))), + c.br_if(1, c.i32_eq ( c.getLocal("i"), c.getLocal("n") )), - c.setLocal("cur", getBit(c.getLocal("i"))), - c.if( c.getLocal("last"), - c.if( c.getLocal("cur"), - c.if(c.getLocal("carry"), - [ - ...c.setLocal("last", c.i32_const(0)), - ...c.setLocal("carry", c.i32_const(1)), - ...pushBit(1) - ] - , - [ - ...c.setLocal("last", c.i32_const(0)), - ...c.setLocal("carry", c.i32_const(1)), - ...pushBit(255) - ], - ), - c.if(c.getLocal("carry"), - [ - ...c.setLocal("last", c.i32_const(0)), - ...c.setLocal("carry", c.i32_const(1)), - ...pushBit(255) - ] - , - [ - ...c.setLocal("last", c.i32_const(0)), - ...c.setLocal("carry", c.i32_const(0)), - ...pushBit(1) - ], - ), - ), - c.if( c.getLocal("cur"), - c.if(c.getLocal("carry"), - [ - ...c.setLocal("last", c.i32_const(0)), - ...c.setLocal("carry", c.i32_const(1)), - ...pushBit(0) - ] - , - [ - ...c.setLocal("last", c.i32_const(1)), - ...c.setLocal("carry", c.i32_const(0)), - ...pushBit(0) - ], - ), - c.if(c.getLocal("carry"), - [ - ...c.setLocal("last", c.i32_const(1)), - ...c.setLocal("carry", c.i32_const(0)), - ...pushBit(0) - ] - , - [ - ...c.setLocal("last", c.i32_const(0)), - ...c.setLocal("carry", c.i32_const(0)), - ...pushBit(0) - ], - ), - ) + c.call( + opGtimesF, + c.getLocal("pFrom"), + t, + c.getLocal("pTo") + ), + c.setLocal("pFrom", c.i32_add(c.getLocal("pFrom"), c.i32_const(sizeGIn))), + c.setLocal("pTo", c.i32_add(c.getLocal("pTo"), c.i32_const(sizeGOut))), + + // t = t* inc + c.call( + frPrefix + "_mul", + t, + c.getLocal("pInc"), + t ), c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), c.br(0) - )), - - c.if( c.getLocal("last"), - c.if(c.getLocal("carry"), - [ - ...pushBit(255), - ...pushBit(0), - ...pushBit(1) - ] - , - [ - ...pushBit(1) - ], - ), - c.if(c.getLocal("carry"), - [ - ...pushBit(0), - ...pushBit(1) - ] - ), - ), - - c.setLocal("p", c.i32_sub(c.getLocal("p"), c.i32_const(1))), - - // p already points to the last bit - - c.call(opCopy, c.getLocal("base"), aux), - - c.call(opInit, c.getLocal("r")), - - c.block(c.loop( - - - c.call(opAA, c.getLocal("r"), c.getLocal("r")), - - - c.setLocal("cur", - c.i32_load8_u( - c.getLocal("p") - ) - ), - - c.if( - c.getLocal("cur"), - c.if( - c.i32_eq(c.getLocal("cur"), c.i32_const(1)), - c.call(opAB, c.getLocal("r"), aux, c.getLocal("r")), - c.call(opAmB, c.getLocal("r"), aux, c.getLocal("r")), - ) - ), - - c.br_if(1, c.i32_eq( c.getLocal("old0"), c.getLocal("p"))), - c.setLocal("p", c.i32_sub(c.getLocal("p"), c.i32_const(1))), - c.br(0) - - )), - - c.i32_store( c.i32_const(0), c.getLocal("old0")) - + )) ); + module.exportFunction(fnName); + }; +const utils$2 = utils$6; -/***/ }), +const buildF1m$1 =build_f1m; +const buildF1$1 =build_f1; +const buildF2m$1 =build_f2m; +const buildF3m$1 =build_f3m; +const buildCurve$1 =build_curve_jacobian_a0; +const buildFFT$2 = build_fft; +const buildPol$1 = build_pol; +const buildQAP$1 = build_qap; +const buildApplyKey$1 = build_applykey; +const { bitLength: bitLength$2, modInv, isOdd: isOdd$1, isNegative: isNegative$2 } = bigint; -/***/ 2333: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +var build_bn128 = function buildBN128(module, _prefix) { + + const prefix = _prefix || "bn128"; + + if (module.modules[prefix]) return prefix; // already builded + + const q = 21888242871839275222246405745257275088696311157297823662689037894645226208583n; + const r = 21888242871839275222246405745257275088548364400416034343698204186575808495617n; + + + const n64 = Math.floor((bitLength$2(q - 1n) - 1)/64) +1; + const n8 = n64*8; + const frsize = n8; + const f1size = n8; + const f2size = f1size * 2; + const ftsize = f1size * 12; + + const pr = module.alloc(utils$2.bigInt2BytesLE( r, frsize )); + + const f1mPrefix = buildF1m$1(module, q, "f1m"); + buildF1$1(module, r, "fr", "frm"); + + const pG1b = module.alloc(utils$2.bigInt2BytesLE( toMontgomery(3n), f1size )); + const g1mPrefix = buildCurve$1(module, "g1m", "f1m", pG1b); + + buildFFT$2(module, "frm", "frm", "frm", "frm_mul"); + + buildPol$1(module, "pol", "frm"); + buildQAP$1(module, "qap", "frm"); + + const f2mPrefix = buildF2m$1(module, "f1m_neg", "f2m", "f1m"); + const pG2b = module.alloc([ + ...utils$2.bigInt2BytesLE( toMontgomery(19485874751759354771024239261021720505790618469301721065564631296452457478373n), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(266929791119991161246907387137283842545076965332900288569378510910307636690n), f1size ) + ]); + const g2mPrefix = buildCurve$1(module, "g2m", "f2m", pG2b); + + + function buildGTimesFr(fnName, opMul) { + const f = module.addFunction(fnName); + f.addParam("pG", "i32"); + f.addParam("pFr", "i32"); + f.addParam("pr", "i32"); + + const c = f.getCodeBuilder(); + + const AUX = c.i32_const(module.alloc(n8)); + + f.addCode( + c.call("frm_fromMontgomery", c.getLocal("pFr"), AUX), + c.call( + opMul, + c.getLocal("pG"), + AUX, + c.i32_const(n8), + c.getLocal("pr") + ) + ); + + module.exportFunction(fnName); + } + buildGTimesFr("g1m_timesFr", "g1m_timesScalar"); + buildFFT$2(module, "g1m", "g1m", "frm", "g1m_timesFr"); + + buildGTimesFr("g2m_timesFr", "g2m_timesScalar"); + buildFFT$2(module, "g2m", "g2m", "frm", "g2m_timesFr"); + + buildGTimesFr("g1m_timesFrAffine", "g1m_timesScalarAffine"); + buildGTimesFr("g2m_timesFrAffine", "g2m_timesScalarAffine"); + + buildApplyKey$1(module, "frm_batchApplyKey", "fmr", "frm", n8, n8, n8, "frm_mul"); + buildApplyKey$1(module, "g1m_batchApplyKey", "g1m", "frm", n8*3, n8*3, n8, "g1m_timesFr"); + buildApplyKey$1(module, "g1m_batchApplyKeyMixed", "g1m", "frm", n8*2, n8*3, n8, "g1m_timesFrAffine"); + buildApplyKey$1(module, "g2m_batchApplyKey", "g2m", "frm", n8*2*3, n8*3*2, n8, "g2m_timesFr"); + buildApplyKey$1(module, "g2m_batchApplyKeyMixed", "g2m", "frm", n8*2*2, n8*3*2, n8, "g2m_timesFrAffine"); + + function toMontgomery(a) { + return BigInt(a) * ( 1n << BigInt(f1size*8)) % q; + } + + const G1gen = [ + 1n, + 2n, + 1n + ]; + + const pG1gen = module.alloc( + [ + ...utils$2.bigInt2BytesLE( toMontgomery(G1gen[0]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G1gen[1]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G1gen[2]), f1size ), + ] + ); + + const G1zero = [ + 0n, + 1n, + 0n + ]; + + const pG1zero = module.alloc( + [ + ...utils$2.bigInt2BytesLE( toMontgomery(G1zero[0]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G1zero[1]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G1zero[2]), f1size ) + ] + ); + + const G2gen = [ + [ + 10857046999023057135944570762232829481370756359578518086990519993285655852781n, + 11559732032986387107991004021392285783925812861821192530917403151452391805634n, + ],[ + 8495653923123431417604973247489272438418190587263600148770280649306958101930n, + 4082367875863433681332203403145435568316851327593401208105741076214120093531n, + ],[ + 1n, + 0n, + ] + ]; + + const pG2gen = module.alloc( + [ + ...utils$2.bigInt2BytesLE( toMontgomery(G2gen[0][0]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G2gen[0][1]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G2gen[1][0]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G2gen[1][1]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G2gen[2][0]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G2gen[2][1]), f1size ), + ] + ); + + const G2zero = [ + [ + 0n, + 0n, + ],[ + 1n, + 0n, + ],[ + 0n, + 0n, + ] + ]; + + const pG2zero = module.alloc( + [ + ...utils$2.bigInt2BytesLE( toMontgomery(G2zero[0][0]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G2zero[0][1]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G2zero[1][0]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G2zero[1][1]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G2zero[2][0]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G2zero[2][1]), f1size ), + ] + ); + + const pOneT = module.alloc([ + ...utils$2.bigInt2BytesLE( toMontgomery(1), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(0), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(0), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(0), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(0), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(0), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(0), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(0), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(0), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(0), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(0), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(0), f1size ), + ]); + + const pNonResidueF6 = module.alloc([ + ...utils$2.bigInt2BytesLE( toMontgomery(9), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(1), f1size ), + ]); + + const pTwoInv = module.alloc([ + ...utils$2.bigInt2BytesLE( toMontgomery( modInv(2n, q)), f1size ), + ...utils$2.bigInt2BytesLE( 0n, f1size ) + ]); + + const pAltBn128Twist = pNonResidueF6; + + const pTwistCoefB = module.alloc([ + ...utils$2.bigInt2BytesLE( toMontgomery(19485874751759354771024239261021720505790618469301721065564631296452457478373n), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(266929791119991161246907387137283842545076965332900288569378510910307636690n), f1size ), + ]); + + function build_mulNR6() { + const f = module.addFunction(prefix + "_mulNR6"); + f.addParam("x", "i32"); + f.addParam("pr", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode( + c.call( + f2mPrefix + "_mul", + c.i32_const(pNonResidueF6), + c.getLocal("x"), + c.getLocal("pr") + ) + ); + } + build_mulNR6(); + + const f6mPrefix = buildF3m$1(module, prefix+"_mulNR6", "f6m", "f2m"); + + function build_mulNR12() { + const f = module.addFunction(prefix + "_mulNR12"); + f.addParam("x", "i32"); + f.addParam("pr", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode( + c.call( + f2mPrefix + "_mul", + c.i32_const(pNonResidueF6), + c.i32_add(c.getLocal("x"), c.i32_const(n8*4)), + c.getLocal("pr") + ), + c.call( + f2mPrefix + "_copy", + c.getLocal("x"), + c.i32_add(c.getLocal("pr"), c.i32_const(n8*2)), + ), + c.call( + f2mPrefix + "_copy", + c.i32_add(c.getLocal("x"), c.i32_const(n8*2)), + c.i32_add(c.getLocal("pr"), c.i32_const(n8*4)), + ) + ); + } + build_mulNR12(); + + const ftmPrefix = buildF2m$1(module, prefix+"_mulNR12", "ftm", f6mPrefix); + + + const ateLoopCount = 29793968203157093288n; + const ateLoopBitBytes = bits(ateLoopCount); + const pAteLoopBitBytes = module.alloc(ateLoopBitBytes); + + const ateCoefSize = 3 * f2size; + const ateNDblCoefs = ateLoopBitBytes.length-1; + const ateNAddCoefs = ateLoopBitBytes.reduce((acc, b) => acc + ( b!=0 ? 1 : 0) ,0); + const ateNCoefs = ateNAddCoefs + ateNDblCoefs + 1; + const prePSize = 3*2*n8; + const preQSize = 3*n8*2 + ateNCoefs*ateCoefSize; + + + module.modules[prefix] = { + n64: n64, + pG1gen: pG1gen, + pG1zero: pG1zero, + pG1b: pG1b, + pG2gen: pG2gen, + pG2zero: pG2zero, + pG2b: pG2b, + pq: module.modules["f1m"].pq, + pr: pr, + pOneT: pOneT, + prePSize: prePSize, + preQSize: preQSize, + r: r.toString(), + q: q.toString() + }; + + // console.log("PrePSize: " +prePSize); + // console.log("PreQSize: " +preQSize); + + const finalExpZ = 4965661367192848881n; + + function naf(n) { + let E = n; + const res = []; + while (E > 0n) { + if (isOdd$1(E)) { + const z = 2 - Number(E % 4n); + res.push( z ); + E = E - BigInt(z); + } else { + res.push( 0 ); + } + E = E >> 1n; + } + return res; + } + + function bits(n) { + let E = n; + const res = []; + while (E > 0n) { + if (isOdd$1(E)) { + res.push( 1 ); + } else { + res.push( 0 ); + } + E = E >> 1n; + } + return res; + } + + function buildPrepareG1() { + const f = module.addFunction(prefix+ "_prepareG1"); + f.addParam("pP", "i32"); + f.addParam("ppreP", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode( + c.call(g1mPrefix + "_normalize", c.getLocal("pP"), c.getLocal("ppreP")), // TODO Remove if already in affine + ); + } + + function buildPrepAddStep() { + const f = module.addFunction(prefix+ "_prepAddStep"); + f.addParam("pQ", "i32"); + f.addParam("pR", "i32"); + f.addParam("pCoef", "i32"); + + const c = f.getCodeBuilder(); + + const X2 = c.getLocal("pQ"); + const Y2 = c.i32_add(c.getLocal("pQ"), c.i32_const(f2size)); + + const X1 = c.getLocal("pR"); + const Y1 = c.i32_add(c.getLocal("pR"), c.i32_const(f2size)); + const Z1 = c.i32_add(c.getLocal("pR"), c.i32_const(2*f2size)); + + const ELL_0 = c.getLocal("pCoef"); + const ELL_VW = c.i32_add(c.getLocal("pCoef"), c.i32_const(f2size)); + const ELL_VV = c.i32_add(c.getLocal("pCoef"), c.i32_const(2*f2size)); + + const D = ELL_VW; + const E = c.i32_const(module.alloc(f2size)); + const F = c.i32_const(module.alloc(f2size)); + const G = c.i32_const(module.alloc(f2size)); + const H = c.i32_const(module.alloc(f2size)); + const I = c.i32_const(module.alloc(f2size)); + const J = c.i32_const(module.alloc(f2size)); + const AUX = c.i32_const(module.alloc(f2size)); + + f.addCode( + // D = X1 - X2*Z1 + c.call(f2mPrefix + "_mul", X2, Z1, D), + c.call(f2mPrefix + "_sub", X1, D, D), + + // E = Y1 - Y2*Z1 + c.call(f2mPrefix + "_mul", Y2, Z1, E), + c.call(f2mPrefix + "_sub", Y1, E, E), + + // F = D^2 + c.call(f2mPrefix + "_square", D, F), + + // G = E^2 + c.call(f2mPrefix + "_square", E, G), + + // H = D*F + c.call(f2mPrefix + "_mul", D, F, H), + + // I = X1 * F + c.call(f2mPrefix + "_mul", X1, F, I), + + // J = H + Z1*G - (I+I) + c.call(f2mPrefix + "_add", I, I, AUX), + c.call(f2mPrefix + "_mul", Z1, G, J), + c.call(f2mPrefix + "_add", H, J, J), + c.call(f2mPrefix + "_sub", J, AUX, J), + + + // X3 (X1) = D*J + c.call(f2mPrefix + "_mul", D, J, X1), + + // Y3 (Y1) = E*(I-J)-(H*Y1) + c.call(f2mPrefix + "_mul", H, Y1, Y1), + c.call(f2mPrefix + "_sub", I, J, AUX), + c.call(f2mPrefix + "_mul", E, AUX, AUX), + c.call(f2mPrefix + "_sub", AUX, Y1, Y1), + + // Z3 (Z1) = Z1*H + c.call(f2mPrefix + "_mul", Z1, H, Z1), + + // ell_0 = xi * (E * X2 - D * Y2) + c.call(f2mPrefix + "_mul", D, Y2, AUX), + c.call(f2mPrefix + "_mul", E, X2, ELL_0), + c.call(f2mPrefix + "_sub", ELL_0, AUX, ELL_0), + c.call(f2mPrefix + "_mul", ELL_0, c.i32_const(pAltBn128Twist), ELL_0), + + + // ell_VV = - E (later: * xP) + c.call(f2mPrefix + "_neg", E, ELL_VV), + + // ell_VW = D (later: * yP ) + // Already assigned + + ); + } + + + + function buildPrepDoubleStep() { + const f = module.addFunction(prefix+ "_prepDblStep"); + f.addParam("pR", "i32"); + f.addParam("pCoef", "i32"); + + const c = f.getCodeBuilder(); + + const X1 = c.getLocal("pR"); + const Y1 = c.i32_add(c.getLocal("pR"), c.i32_const(f2size)); + const Z1 = c.i32_add(c.getLocal("pR"), c.i32_const(2*f2size)); + + const ELL_0 = c.getLocal("pCoef"); + const ELL_VW = c.i32_add(c.getLocal("pCoef"), c.i32_const(f2size)); + const ELL_VV = c.i32_add(c.getLocal("pCoef"), c.i32_const(2*f2size)); + + const A = c.i32_const(module.alloc(f2size)); + const B = c.i32_const(module.alloc(f2size)); + const C = c.i32_const(module.alloc(f2size)); + const D = c.i32_const(module.alloc(f2size)); + const E = c.i32_const(module.alloc(f2size)); + const F = c.i32_const(module.alloc(f2size)); + const G = c.i32_const(module.alloc(f2size)); + const H = c.i32_const(module.alloc(f2size)); + const I = c.i32_const(module.alloc(f2size)); + const J = c.i32_const(module.alloc(f2size)); + const E2 = c.i32_const(module.alloc(f2size)); + const AUX = c.i32_const(module.alloc(f2size)); + + f.addCode( + + // A = X1 * Y1 / 2 + c.call(f2mPrefix + "_mul", Y1, c.i32_const(pTwoInv), A), + c.call(f2mPrefix + "_mul", X1, A, A), + + // B = Y1^2 + c.call(f2mPrefix + "_square", Y1, B), + + // C = Z1^2 + c.call(f2mPrefix + "_square", Z1, C), + + // D = 3 * C + c.call(f2mPrefix + "_add", C, C, D), + c.call(f2mPrefix + "_add", D, C, D), + + // E = twist_b * D + c.call(f2mPrefix + "_mul", c.i32_const(pTwistCoefB), D, E), + + // F = 3 * E + c.call(f2mPrefix + "_add", E, E, F), + c.call(f2mPrefix + "_add", E, F, F), + + // G = (B+F)/2 + c.call(f2mPrefix + "_add", B, F, G), + c.call(f2mPrefix + "_mul", G, c.i32_const(pTwoInv), G), + + // H = (Y1+Z1)^2-(B+C) + c.call(f2mPrefix + "_add", B, C, AUX), + c.call(f2mPrefix + "_add", Y1, Z1, H), + c.call(f2mPrefix + "_square", H, H), + c.call(f2mPrefix + "_sub", H, AUX, H), + + // I = E-B + c.call(f2mPrefix + "_sub", E, B, I), + + // J = X1^2 + c.call(f2mPrefix + "_square", X1, J), + + // E_squared = E^2 + c.call(f2mPrefix + "_square", E, E2), + + // X3 (X1) = A * (B-F) + c.call(f2mPrefix + "_sub", B, F, AUX), + c.call(f2mPrefix + "_mul", A, AUX, X1), + + // Y3 (Y1) = G^2 - 3*E^2 + c.call(f2mPrefix + "_add", E2, E2, AUX), + c.call(f2mPrefix + "_add", E2, AUX, AUX), + c.call(f2mPrefix + "_square", G, Y1), + c.call(f2mPrefix + "_sub", Y1, AUX, Y1), + + // Z3 (Z1) = B * H + c.call(f2mPrefix + "_mul", B, H, Z1), + + // ell_0 = xi * I + c.call(f2mPrefix + "_mul", c.i32_const(pAltBn128Twist), I, ELL_0), + + // ell_VW = - H (later: * yP) + c.call(f2mPrefix + "_neg", H, ELL_VW), + + // ell_VV = 3*J (later: * xP) + c.call(f2mPrefix + "_add", J, J, ELL_VV), + c.call(f2mPrefix + "_add", J, ELL_VV, ELL_VV), + + ); + } + + function buildMulByQ() { + const f = module.addFunction(prefix + "_mulByQ"); + f.addParam("p1", "i32"); + f.addParam("pr", "i32"); + + const c = f.getCodeBuilder(); + + const x = c.getLocal("p1"); + const y = c.i32_add(c.getLocal("p1"), c.i32_const(f2size)); + const z = c.i32_add(c.getLocal("p1"), c.i32_const(f2size*2)); + const x3 = c.getLocal("pr"); + const y3 = c.i32_add(c.getLocal("pr"), c.i32_const(f2size)); + const z3 = c.i32_add(c.getLocal("pr"), c.i32_const(f2size*2)); + + const MulByQX = c.i32_const(module.alloc([ + ...utils$2.bigInt2BytesLE( toMontgomery("21575463638280843010398324269430826099269044274347216827212613867836435027261"), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery("10307601595873709700152284273816112264069230130616436755625194854815875713954"), f1size ), + ])); + + const MulByQY = c.i32_const(module.alloc([ + ...utils$2.bigInt2BytesLE( toMontgomery("2821565182194536844548159561693502659359617185244120367078079554186484126554"), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery("3505843767911556378687030309984248845540243509899259641013678093033130930403"), f1size ), + ])); + + f.addCode( + // The frobeniusMap(1) in this field, is the conjugate + c.call(f2mPrefix + "_conjugate", x, x3), + c.call(f2mPrefix + "_mul", MulByQX, x3, x3), + c.call(f2mPrefix + "_conjugate", y, y3), + c.call(f2mPrefix + "_mul", MulByQY, y3, y3), + c.call(f2mPrefix + "_conjugate", z, z3), + ); + } + + + function buildPrepareG2() { + buildMulByQ(); + const f = module.addFunction(prefix+ "_prepareG2"); + f.addParam("pQ", "i32"); + f.addParam("ppreQ", "i32"); + f.addLocal("pCoef", "i32"); + f.addLocal("i", "i32"); + + const c = f.getCodeBuilder(); + + const QX = c.getLocal("pQ"); + + const pR = module.alloc(f2size*3); + const R = c.i32_const(pR); + const RX = c.i32_const(pR); + const RY = c.i32_const(pR+f2size); + const RZ = c.i32_const(pR+2*f2size); + + const cQX = c.i32_add( c.getLocal("ppreQ"), c.i32_const(0)); + const cQY = c.i32_add( c.getLocal("ppreQ"), c.i32_const(f2size)); + + const pQ1 = module.alloc(f2size*3); + const Q1 = c.i32_const(pQ1); + + const pQ2 = module.alloc(f2size*3); + const Q2 = c.i32_const(pQ2); + const Q2Y = c.i32_const(pQ2 + f2size); + + f.addCode( + c.call(g2mPrefix + "_normalize", QX, cQX), // TODO Remove if already in affine + c.call(f2mPrefix + "_copy", cQX, RX), + c.call(f2mPrefix + "_copy", cQY, RY), + c.call(f2mPrefix + "_one", RZ), + ); + + f.addCode( + c.setLocal("pCoef", c.i32_add( c.getLocal("ppreQ"), c.i32_const(f2size*3))), + c.setLocal("i", c.i32_const(ateLoopBitBytes.length-2)), + c.block(c.loop( + + c.call(prefix + "_prepDblStep", R, c.getLocal("pCoef")), + c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + + c.if( + c.i32_load8_s(c.getLocal("i"), pAteLoopBitBytes), + [ + ...c.call(prefix + "_prepAddStep", cQX, R, c.getLocal("pCoef")), + ...c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + ] + ), + c.br_if(1, c.i32_eqz ( c.getLocal("i") )), + c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), + c.br(0) + )) + ); + + f.addCode( + c.call(prefix + "_mulByQ", cQX, Q1), + c.call(prefix + "_mulByQ", Q1, Q2) + ); + + f.addCode( + c.call(f2mPrefix + "_neg", Q2Y, Q2Y), + + c.call(prefix + "_prepAddStep", Q1, R, c.getLocal("pCoef")), + c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + + c.call(prefix + "_prepAddStep", Q2, R, c.getLocal("pCoef")), + c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + ); + } + + function buildMulBy024Old() { + const f = module.addFunction(prefix+ "__mulBy024Old"); + f.addParam("pEll0", "i32"); + f.addParam("pEllVW", "i32"); + f.addParam("pEllVV", "i32"); + f.addParam("pR", "i32"); // Result in F12 + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("pEll0"); + const x2 = c.getLocal("pEllVV"); + const x4 = c.getLocal("pEllVW"); + + const z0 = c.getLocal("pR"); + + const pAUX12 = module.alloc(ftsize); + const AUX12 = c.i32_const(pAUX12); + const AUX12_0 = c.i32_const(pAUX12); + const AUX12_2 = c.i32_const(pAUX12+f2size); + const AUX12_4 = c.i32_const(pAUX12+f2size*2); + const AUX12_6 = c.i32_const(pAUX12+f2size*3); + const AUX12_8 = c.i32_const(pAUX12+f2size*4); + const AUX12_10 = c.i32_const(pAUX12+f2size*5); + + f.addCode( + + c.call(f2mPrefix + "_copy", x0, AUX12_0), + c.call(f2mPrefix + "_zero", AUX12_2), + c.call(f2mPrefix + "_copy", x2, AUX12_4), + c.call(f2mPrefix + "_zero", AUX12_6), + c.call(f2mPrefix + "_copy", x4, AUX12_8), + c.call(f2mPrefix + "_zero", AUX12_10), + c.call(ftmPrefix + "_mul", AUX12, z0, z0), + ); + } + + function buildMulBy024() { + const f = module.addFunction(prefix+ "__mulBy024"); + f.addParam("pEll0", "i32"); + f.addParam("pEllVW", "i32"); + f.addParam("pEllVV", "i32"); + f.addParam("pR", "i32"); // Result in F12 + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("pEll0"); + const x2 = c.getLocal("pEllVV"); + const x4 = c.getLocal("pEllVW"); + + const z0 = c.getLocal("pR"); + const z1 = c.i32_add(c.getLocal("pR"), c.i32_const(2*n8)); + const z2 = c.i32_add(c.getLocal("pR"), c.i32_const(4*n8)); + const z3 = c.i32_add(c.getLocal("pR"), c.i32_const(6*n8)); + const z4 = c.i32_add(c.getLocal("pR"), c.i32_const(8*n8)); + const z5 = c.i32_add(c.getLocal("pR"), c.i32_const(10*n8)); + + const t0 = c.i32_const(module.alloc(f2size)); + const t1 = c.i32_const(module.alloc(f2size)); + const t2 = c.i32_const(module.alloc(f2size)); + const s0 = c.i32_const(module.alloc(f2size)); + const T3 = c.i32_const(module.alloc(f2size)); + const T4 = c.i32_const(module.alloc(f2size)); + const D0 = c.i32_const(module.alloc(f2size)); + const D2 = c.i32_const(module.alloc(f2size)); + const D4 = c.i32_const(module.alloc(f2size)); + const S1 = c.i32_const(module.alloc(f2size)); + const AUX = c.i32_const(module.alloc(f2size)); + + f.addCode( + + // D0 = z0 * x0; + c.call(f2mPrefix + "_mul", z0, x0, D0), + // D2 = z2 * x2; + c.call(f2mPrefix + "_mul", z2, x2, D2), + // D4 = z4 * x4; + c.call(f2mPrefix + "_mul", z4, x4, D4), + // t2 = z0 + z4; + c.call(f2mPrefix + "_add", z0, z4, t2), + // t1 = z0 + z2; + c.call(f2mPrefix + "_add", z0, z2, t1), + // s0 = z1 + z3 + z5; + c.call(f2mPrefix + "_add", z1, z3, s0), + c.call(f2mPrefix + "_add", s0, z5, s0), + + + // For z.a_.a_ = z0. + // S1 = z1 * x2; + c.call(f2mPrefix + "_mul", z1, x2, S1), + // T3 = S1 + D4; + c.call(f2mPrefix + "_add", S1, D4, T3), + // T4 = my_Fp6::non_residue * T3 + D0; + c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), T3, T4), + c.call(f2mPrefix + "_add", T4, D0, z0), + // z0 = T4; + + // For z.a_.b_ = z1 + // T3 = z5 * x4; + c.call(f2mPrefix + "_mul", z5, x4, T3), + // S1 = S1 + T3; + c.call(f2mPrefix + "_add", S1, T3, S1), + // T3 = T3 + D2; + c.call(f2mPrefix + "_add", T3, D2, T3), + // T4 = my_Fp6::non_residue * T3; + c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), T3, T4), + // T3 = z1 * x0; + c.call(f2mPrefix + "_mul", z1, x0, T3), + // S1 = S1 + T3; + c.call(f2mPrefix + "_add", S1, T3, S1), + // T4 = T4 + T3; + c.call(f2mPrefix + "_add", T4, T3, z1), + // z1 = T4; + + + + // For z.a_.c_ = z2 + // t0 = x0 + x2; + c.call(f2mPrefix + "_add", x0, x2, t0), + // T3 = t1 * t0 - D0 - D2; + c.call(f2mPrefix + "_mul", t1, t0, T3), + c.call(f2mPrefix + "_add", D0, D2, AUX), + c.call(f2mPrefix + "_sub", T3, AUX, T3), + // T4 = z3 * x4; + c.call(f2mPrefix + "_mul", z3, x4, T4), + // S1 = S1 + T4; + c.call(f2mPrefix + "_add", S1, T4, S1), + + + // For z.b_.a_ = z3 (z3 needs z2) + // t0 = z2 + z4; + c.call(f2mPrefix + "_add", z2, z4, t0), + // T3 = T3 + T4; + // z2 = T3; + c.call(f2mPrefix + "_add", T3, T4, z2), + // t1 = x2 + x4; + c.call(f2mPrefix + "_add", x2, x4, t1), + // T3 = t0 * t1 - D2 - D4; + c.call(f2mPrefix + "_mul", t1, t0, T3), + c.call(f2mPrefix + "_add", D2, D4, AUX), + c.call(f2mPrefix + "_sub", T3, AUX, T3), + // T4 = my_Fp6::non_residue * T3; + c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), T3, T4), + // T3 = z3 * x0; + c.call(f2mPrefix + "_mul", z3, x0, T3), + // S1 = S1 + T3; + c.call(f2mPrefix + "_add", S1, T3, S1), + // T4 = T4 + T3; + c.call(f2mPrefix + "_add", T4, T3, z3), + // z3 = T4; + + // For z.b_.b_ = z4 + // T3 = z5 * x2; + c.call(f2mPrefix + "_mul", z5, x2, T3), + // S1 = S1 + T3; + c.call(f2mPrefix + "_add", S1, T3, S1), + // T4 = my_Fp6::non_residue * T3; + c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), T3, T4), + // t0 = x0 + x4; + c.call(f2mPrefix + "_add", x0, x4, t0), + // T3 = t2 * t0 - D0 - D4; + c.call(f2mPrefix + "_mul", t2, t0, T3), + c.call(f2mPrefix + "_add", D0, D4, AUX), + c.call(f2mPrefix + "_sub", T3, AUX, T3), + // T4 = T4 + T3; + c.call(f2mPrefix + "_add", T4, T3, z4), + // z4 = T4; + + // For z.b_.c_ = z5. + // t0 = x0 + x2 + x4; + c.call(f2mPrefix + "_add", x0, x2, t0), + c.call(f2mPrefix + "_add", t0, x4, t0), + // T3 = s0 * t0 - S1; + c.call(f2mPrefix + "_mul", s0, t0, T3), + c.call(f2mPrefix + "_sub", T3, S1, z5), + // z5 = T3; + + ); + } + + + function buildMillerLoop() { + const f = module.addFunction(prefix+ "_millerLoop"); + f.addParam("ppreP", "i32"); + f.addParam("ppreQ", "i32"); + f.addParam("r", "i32"); + f.addLocal("pCoef", "i32"); + f.addLocal("i", "i32"); + + const c = f.getCodeBuilder(); + + const preP_PX = c.getLocal("ppreP"); + const preP_PY = c.i32_add(c.getLocal("ppreP"), c.i32_const(f1size)); + + const ELL_0 = c.getLocal("pCoef"); + const ELL_VW = c.i32_add(c.getLocal("pCoef"), c.i32_const(f2size)); + const ELL_VV = c.i32_add(c.getLocal("pCoef"), c.i32_const(2*f2size)); + + + const pVW = module.alloc(f2size); + const VW = c.i32_const(pVW); + const pVV = module.alloc(f2size); + const VV = c.i32_const(pVV); + + const F = c.getLocal("r"); + + + f.addCode( + c.call(ftmPrefix + "_one", F), + + c.setLocal("pCoef", c.i32_add( c.getLocal("ppreQ"), c.i32_const(f2size*3))), + + c.setLocal("i", c.i32_const(ateLoopBitBytes.length-2)), + c.block(c.loop( + + + c.call(ftmPrefix + "_square", F, F), + + c.call(f2mPrefix + "_mul1", ELL_VW,preP_PY, VW), + c.call(f2mPrefix + "_mul1", ELL_VV, preP_PX, VV), + c.call(prefix + "__mulBy024", ELL_0, VW, VV, F), + c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + + c.if( + c.i32_load8_s(c.getLocal("i"), pAteLoopBitBytes), + [ + ...c.call(f2mPrefix + "_mul1", ELL_VW, preP_PY, VW), + ...c.call(f2mPrefix + "_mul1", ELL_VV, preP_PX, VV), + + ...c.call(prefix + "__mulBy024", ELL_0, VW, VV, F), + ...c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + + ] + ), + c.br_if(1, c.i32_eqz ( c.getLocal("i") )), + c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), + c.br(0) + )) + + ); + + f.addCode( + c.call(f2mPrefix + "_mul1", ELL_VW, preP_PY, VW), + c.call(f2mPrefix + "_mul1", ELL_VV, preP_PX, VV), + c.call(prefix + "__mulBy024", ELL_0, VW, VV, F), + c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + + c.call(f2mPrefix + "_mul1", ELL_VW, preP_PY, VW), + c.call(f2mPrefix + "_mul1", ELL_VV, preP_PX, VV), + c.call(prefix + "__mulBy024", ELL_0, VW, VV, F), + c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + + ); + + } + + + function buildFrobeniusMap(n) { + const F12 = [ + [ + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + ], + [ + [1n, 0n], + [8376118865763821496583973867626364092589906065868298776909617916018768340080n, 16469823323077808223889137241176536799009286646108169935659301613961712198316n], + [21888242871839275220042445260109153167277707414472061641714758635765020556617n, 0n], + [11697423496358154304825782922584725312912383441159505038794027105778954184319n, 303847389135065887422783454877609941456349188919719272345083954437860409601n], + [21888242871839275220042445260109153167277707414472061641714758635765020556616n, 0n], + [3321304630594332808241809054958361220322477375291206261884409189760185844239n, 5722266937896532885780051958958348231143373700109372999374820235121374419868n], + [21888242871839275222246405745257275088696311157297823662689037894645226208582n, 0n], + [13512124006075453725662431877630910996106405091429524885779419978626457868503n, 5418419548761466998357268504080738289687024511189653727029736280683514010267n], + [2203960485148121921418603742825762020974279258880205651966n, 0n], + [10190819375481120917420622822672549775783927716138318623895010788866272024264n, 21584395482704209334823622290379665147239961968378104390343953940207365798982n], + [2203960485148121921418603742825762020974279258880205651967n, 0n], + [18566938241244942414004596690298913868373833782006617400804628704885040364344n, 16165975933942742336466353786298926857552937457188450663314217659523851788715n], + ] + ]; + + const F6 = [ + [ + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + ], + [ + [1n, 0n], + [21575463638280843010398324269430826099269044274347216827212613867836435027261n, 10307601595873709700152284273816112264069230130616436755625194854815875713954n], + [21888242871839275220042445260109153167277707414472061641714758635765020556616n, 0n], + [3772000881919853776433695186713858239009073593817195771773381919316419345261n, 2236595495967245188281701248203181795121068902605861227855261137820944008926n], + [2203960485148121921418603742825762020974279258880205651966n, 0n], + [18429021223477853657660792034369865839114504446431234726392080002137598044644n, 9344045779998320333812420223237981029506012124075525679208581902008406485703n], + ], + [ + [1n, 0n], + [2581911344467009335267311115468803099551665605076196740867805258568234346338n, 19937756971775647987995932169929341994314640652964949448313374472400716661030n], + [2203960485148121921418603742825762020974279258880205651966n, 0n], + [5324479202449903542726783395506214481928257762400643279780343368557297135718n, 16208900380737693084919495127334387981393726419856888799917914180988844123039n], + [21888242871839275220042445260109153167277707414472061641714758635765020556616n, 0n], + [13981852324922362344252311234282257507216387789820983642040889267519694726527n, 7629828391165209371577384193250820201684255241773809077146787135900891633097n], + ] + ]; + + const f = module.addFunction(prefix+ "__frobeniusMap"+n); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + for (let i=0; i<6; i++) { + const X = (i==0) ? c.getLocal("x") : c.i32_add(c.getLocal("x"), c.i32_const(i*f2size)); + const Xc0 = X; + const Xc1 = c.i32_add(c.getLocal("x"), c.i32_const(i*f2size + f1size)); + const R = (i==0) ? c.getLocal("r") : c.i32_add(c.getLocal("r"), c.i32_const(i*f2size)); + const Rc0 = R; + const Rc1 = c.i32_add(c.getLocal("r"), c.i32_const(i*f2size + f1size)); + const coef = mul2(F12[Math.floor(i/3)][n%12] , F6[i%3][n%6]); + const pCoef = module.alloc([ + ...utils$2.bigInt2BytesLE(toMontgomery(coef[0]), 32), + ...utils$2.bigInt2BytesLE(toMontgomery(coef[1]), 32), + ]); + if (n%2 == 1) { + f.addCode( + c.call(f1mPrefix + "_copy", Xc0, Rc0), + c.call(f1mPrefix + "_neg", Xc1, Rc1), + c.call(f2mPrefix + "_mul", R, c.i32_const(pCoef), R), + ); + } else { + f.addCode(c.call(f2mPrefix + "_mul", X, c.i32_const(pCoef), R)); + } + } + + function mul2(a, b) { + const ac0 = BigInt(a[0]); + const ac1 = BigInt(a[1]); + const bc0 = BigInt(b[0]); + const bc1 = BigInt(b[1]); + const res = [ + (ac0 * bc0 - ( ac1 * bc1) ) % q, + (ac0 * bc1 + ( ac1 * bc0) ) % q, + ]; + if (isNegative$2(res[0])) res[0] = res[0] + q; + return res; + } + + } + + + + function buildFinalExponentiationFirstChunk() { + + const f = module.addFunction(prefix+ "__finalExponentiationFirstChunk"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const elt = c.getLocal("x"); + const eltC0 = elt; + const eltC1 = c.i32_add(elt, c.i32_const(n8*6)); + const r = c.getLocal("r"); + const pA = module.alloc(ftsize); + const A = c.i32_const(pA); + const Ac0 = A; + const Ac1 = c.i32_const(pA + n8*6); + const B = c.i32_const(module.alloc(ftsize)); + const C = c.i32_const(module.alloc(ftsize)); + const D = c.i32_const(module.alloc(ftsize)); + + f.addCode( + // const alt_bn128_Fq12 A = alt_bn128_Fq12(elt.c0,-elt.c1); + c.call(f6mPrefix + "_copy", eltC0, Ac0), + c.call(f6mPrefix + "_neg", eltC1, Ac1), + + // const alt_bn128_Fq12 B = elt.inverse(); + c.call(ftmPrefix + "_inverse", elt, B), + + // const alt_bn128_Fq12 C = A * B; + c.call(ftmPrefix + "_mul", A, B, C), + // const alt_bn128_Fq12 D = C.Frobenius_map(2); + c.call(prefix + "__frobeniusMap2", C, D), + // const alt_bn128_Fq12 result = D * C; + c.call(ftmPrefix + "_mul", C, D, r), + ); + } + + function buildCyclotomicSquare() { + const f = module.addFunction(prefix+ "__cyclotomicSquare"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x4 = c.i32_add(c.getLocal("x"), c.i32_const(f2size)); + const x3 = c.i32_add(c.getLocal("x"), c.i32_const(2*f2size)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(3*f2size)); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(4*f2size)); + const x5 = c.i32_add(c.getLocal("x"), c.i32_const(5*f2size)); + + const r0 = c.getLocal("r"); + const r4 = c.i32_add(c.getLocal("r"), c.i32_const(f2size)); + const r3 = c.i32_add(c.getLocal("r"), c.i32_const(2*f2size)); + const r2 = c.i32_add(c.getLocal("r"), c.i32_const(3*f2size)); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(4*f2size)); + const r5 = c.i32_add(c.getLocal("r"), c.i32_const(5*f2size)); + + const t0 = c.i32_const(module.alloc(f2size)); + const t1 = c.i32_const(module.alloc(f2size)); + const t2 = c.i32_const(module.alloc(f2size)); + const t3 = c.i32_const(module.alloc(f2size)); + const t4 = c.i32_const(module.alloc(f2size)); + const t5 = c.i32_const(module.alloc(f2size)); + const tmp = c.i32_const(module.alloc(f2size)); + const AUX = c.i32_const(module.alloc(f2size)); + + + f.addCode( + // // t0 + t1*y = (z0 + z1*y)^2 = a^2 + // tmp = z0 * z1; + // t0 = (z0 + z1) * (z0 + my_Fp6::non_residue * z1) - tmp - my_Fp6::non_residue * tmp; + // t1 = tmp + tmp; + c.call(f2mPrefix + "_mul", x0, x1, tmp), + c.call(f2mPrefix + "_mul", x1, c.i32_const(pNonResidueF6), t0), + c.call(f2mPrefix + "_add", x0, t0, t0), + c.call(f2mPrefix + "_add", x0, x1, AUX), + c.call(f2mPrefix + "_mul", AUX, t0, t0), + c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), tmp, AUX), + c.call(f2mPrefix + "_add", tmp, AUX, AUX), + c.call(f2mPrefix + "_sub", t0, AUX, t0), + c.call(f2mPrefix + "_add", tmp, tmp, t1), + + // // t2 + t3*y = (z2 + z3*y)^2 = b^2 + // tmp = z2 * z3; + // t2 = (z2 + z3) * (z2 + my_Fp6::non_residue * z3) - tmp - my_Fp6::non_residue * tmp; + // t3 = tmp + tmp; + c.call(f2mPrefix + "_mul", x2, x3, tmp), + c.call(f2mPrefix + "_mul", x3, c.i32_const(pNonResidueF6), t2), + c.call(f2mPrefix + "_add", x2, t2, t2), + c.call(f2mPrefix + "_add", x2, x3, AUX), + c.call(f2mPrefix + "_mul", AUX, t2, t2), + c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), tmp, AUX), + c.call(f2mPrefix + "_add", tmp, AUX, AUX), + c.call(f2mPrefix + "_sub", t2, AUX, t2), + c.call(f2mPrefix + "_add", tmp, tmp, t3), + + // // t4 + t5*y = (z4 + z5*y)^2 = c^2 + // tmp = z4 * z5; + // t4 = (z4 + z5) * (z4 + my_Fp6::non_residue * z5) - tmp - my_Fp6::non_residue * tmp; + // t5 = tmp + tmp; + c.call(f2mPrefix + "_mul", x4, x5, tmp), + c.call(f2mPrefix + "_mul", x5, c.i32_const(pNonResidueF6), t4), + c.call(f2mPrefix + "_add", x4, t4, t4), + c.call(f2mPrefix + "_add", x4, x5, AUX), + c.call(f2mPrefix + "_mul", AUX, t4, t4), + c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), tmp, AUX), + c.call(f2mPrefix + "_add", tmp, AUX, AUX), + c.call(f2mPrefix + "_sub", t4, AUX, t4), + c.call(f2mPrefix + "_add", tmp, tmp, t5), + + // For A + // z0 = 3 * t0 - 2 * z0 + c.call(f2mPrefix + "_sub", t0, x0, r0), + c.call(f2mPrefix + "_add", r0, r0, r0), + c.call(f2mPrefix + "_add", t0, r0, r0), + // z1 = 3 * t1 + 2 * z1 + c.call(f2mPrefix + "_add", t1, x1, r1), + c.call(f2mPrefix + "_add", r1, r1, r1), + c.call(f2mPrefix + "_add", t1, r1, r1), + + // For B + // z2 = 3 * (xi * t5) + 2 * z2 + c.call(f2mPrefix + "_mul", t5, c.i32_const(pAltBn128Twist), AUX), + c.call(f2mPrefix + "_add", AUX, x2, r2), + c.call(f2mPrefix + "_add", r2, r2, r2), + c.call(f2mPrefix + "_add", AUX, r2, r2), + // z3 = 3 * t4 - 2 * z3 + c.call(f2mPrefix + "_sub", t4, x3, r3), + c.call(f2mPrefix + "_add", r3, r3, r3), + c.call(f2mPrefix + "_add", t4, r3, r3), + + // For C + // z4 = 3 * t2 - 2 * z4 + c.call(f2mPrefix + "_sub", t2, x4, r4), + c.call(f2mPrefix + "_add", r4, r4, r4), + c.call(f2mPrefix + "_add", t2, r4, r4), + // z5 = 3 * t3 + 2 * z5 + c.call(f2mPrefix + "_add", t3, x5, r5), + c.call(f2mPrefix + "_add", r5, r5, r5), + c.call(f2mPrefix + "_add", t3, r5, r5), + + ); + } + + + function buildCyclotomicExp(exponent, fnName) { + const exponentNafBytes = naf(exponent).map( (b) => (b==-1 ? 0xFF: b) ); + const pExponentNafBytes = module.alloc(exponentNafBytes); + + const f = module.addFunction(prefix+ "__cyclotomicExp_"+fnName); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + f.addLocal("bit", "i32"); + f.addLocal("i", "i32"); + + const c = f.getCodeBuilder(); + + const x = c.getLocal("x"); + + const res = c.getLocal("r"); + + const inverse = c.i32_const(module.alloc(ftsize)); + + + f.addCode( + c.call(ftmPrefix + "_conjugate", x, inverse), + c.call(ftmPrefix + "_one", res), + + c.if( + c.teeLocal("bit", c.i32_load8_s(c.i32_const(exponentNafBytes.length-1), pExponentNafBytes)), + c.if( + c.i32_eq( + c.getLocal("bit"), + c.i32_const(1) + ), + c.call(ftmPrefix + "_mul", res, x, res), + c.call(ftmPrefix + "_mul", res, inverse, res), + ) + ), + + c.setLocal("i", c.i32_const(exponentNafBytes.length-2)), + c.block(c.loop( + c.call(prefix + "__cyclotomicSquare", res, res), + c.if( + c.teeLocal("bit", c.i32_load8_s(c.getLocal("i"), pExponentNafBytes)), + c.if( + c.i32_eq( + c.getLocal("bit"), + c.i32_const(1) + ), + c.call(ftmPrefix + "_mul", res, x, res), + c.call(ftmPrefix + "_mul", res, inverse, res), + ) + ), + c.br_if(1, c.i32_eqz ( c.getLocal("i") )), + c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), + c.br(0) + )) + ); + } + + + + function buildFinalExponentiationLastChunk() { + buildCyclotomicSquare(); + buildCyclotomicExp(finalExpZ, "w0"); + + const f = module.addFunction(prefix+ "__finalExponentiationLastChunk"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const elt = c.getLocal("x"); + const result = c.getLocal("r"); + const A = c.i32_const(module.alloc(ftsize)); + const B = c.i32_const(module.alloc(ftsize)); + const C = c.i32_const(module.alloc(ftsize)); + const D = c.i32_const(module.alloc(ftsize)); + const E = c.i32_const(module.alloc(ftsize)); + const F = c.i32_const(module.alloc(ftsize)); + const G = c.i32_const(module.alloc(ftsize)); + const H = c.i32_const(module.alloc(ftsize)); + const I = c.i32_const(module.alloc(ftsize)); + const J = c.i32_const(module.alloc(ftsize)); + const K = c.i32_const(module.alloc(ftsize)); + const L = c.i32_const(module.alloc(ftsize)); + const M = c.i32_const(module.alloc(ftsize)); + const N = c.i32_const(module.alloc(ftsize)); + const O = c.i32_const(module.alloc(ftsize)); + const P = c.i32_const(module.alloc(ftsize)); + const Q = c.i32_const(module.alloc(ftsize)); + const R = c.i32_const(module.alloc(ftsize)); + const S = c.i32_const(module.alloc(ftsize)); + const T = c.i32_const(module.alloc(ftsize)); + const U = c.i32_const(module.alloc(ftsize)); + + f.addCode( + + + // A = exp_by_neg_z(elt) // = elt^(-z) + c.call(prefix + "__cyclotomicExp_w0", elt, A), + c.call(ftmPrefix + "_conjugate", A, A), + // B = A^2 // = elt^(-2*z) + c.call(prefix + "__cyclotomicSquare", A, B), + // C = B^2 // = elt^(-4*z) + c.call(prefix + "__cyclotomicSquare", B, C), + // D = C * B // = elt^(-6*z) + c.call(ftmPrefix + "_mul", C, B, D), + // E = exp_by_neg_z(D) // = elt^(6*z^2) + c.call(prefix + "__cyclotomicExp_w0", D, E), + c.call(ftmPrefix + "_conjugate", E, E), + // F = E^2 // = elt^(12*z^2) + c.call(prefix + "__cyclotomicSquare", E, F), + // G = epx_by_neg_z(F) // = elt^(-12*z^3) + c.call(prefix + "__cyclotomicExp_w0", F, G), + c.call(ftmPrefix + "_conjugate", G, G), + // H = conj(D) // = elt^(6*z) + c.call(ftmPrefix + "_conjugate", D, H), + // I = conj(G) // = elt^(12*z^3) + c.call(ftmPrefix + "_conjugate", G, I), + // J = I * E // = elt^(12*z^3 + 6*z^2) + c.call(ftmPrefix + "_mul", I, E, J), + // K = J * H // = elt^(12*z^3 + 6*z^2 + 6*z) + c.call(ftmPrefix + "_mul", J, H, K), + // L = K * B // = elt^(12*z^3 + 6*z^2 + 4*z) + c.call(ftmPrefix + "_mul", K, B, L), + // M = K * E // = elt^(12*z^3 + 12*z^2 + 6*z) + c.call(ftmPrefix + "_mul", K, E, M), + + // N = M * elt // = elt^(12*z^3 + 12*z^2 + 6*z + 1) + c.call(ftmPrefix + "_mul", M, elt, N), + + // O = L.Frobenius_map(1) // = elt^(q*(12*z^3 + 6*z^2 + 4*z)) + c.call(prefix + "__frobeniusMap1", L, O), + // P = O * N // = elt^(q*(12*z^3 + 6*z^2 + 4*z) * (12*z^3 + 12*z^2 + 6*z + 1)) + c.call(ftmPrefix + "_mul", O, N, P), + // Q = K.Frobenius_map(2) // = elt^(q^2 * (12*z^3 + 6*z^2 + 6*z)) + c.call(prefix + "__frobeniusMap2", K, Q), + // R = Q * P // = elt^(q^2 * (12*z^3 + 6*z^2 + 6*z) + q*(12*z^3 + 6*z^2 + 4*z) * (12*z^3 + 12*z^2 + 6*z + 1)) + c.call(ftmPrefix + "_mul", Q, P, R), + // S = conj(elt) // = elt^(-1) + c.call(ftmPrefix + "_conjugate", elt, S), + // T = S * L // = elt^(12*z^3 + 6*z^2 + 4*z - 1) + c.call(ftmPrefix + "_mul", S, L, T), + // U = T.Frobenius_map(3) // = elt^(q^3(12*z^3 + 6*z^2 + 4*z - 1)) + c.call(prefix + "__frobeniusMap3", T, U), + // V = U * R // = elt^(q^3(12*z^3 + 6*z^2 + 4*z - 1) + q^2 * (12*z^3 + 6*z^2 + 6*z) + q*(12*z^3 + 6*z^2 + 4*z) * (12*z^3 + 12*z^2 + 6*z + 1)) + c.call(ftmPrefix + "_mul", U, R, result), + // result = V + ); + } + + + function buildFinalExponentiation() { + buildFinalExponentiationFirstChunk(); + buildFinalExponentiationLastChunk(); + const f = module.addFunction(prefix+ "_finalExponentiation"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const elt = c.getLocal("x"); + const result = c.getLocal("r"); + const eltToFirstChunk = c.i32_const(module.alloc(ftsize)); + + f.addCode( + c.call(prefix + "__finalExponentiationFirstChunk", elt, eltToFirstChunk ), + c.call(prefix + "__finalExponentiationLastChunk", eltToFirstChunk, result ) + ); + } + + + function buildFinalExponentiationOld() { + const f = module.addFunction(prefix+ "_finalExponentiationOld"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const exponent = 552484233613224096312617126783173147097382103762957654188882734314196910839907541213974502761540629817009608548654680343627701153829446747810907373256841551006201639677726139946029199968412598804882391702273019083653272047566316584365559776493027495458238373902875937659943504873220554161550525926302303331747463515644711876653177129578303191095900909191624817826566688241804408081892785725967931714097716709526092261278071952560171111444072049229123565057483750161460024353346284167282452756217662335528813519139808291170539072125381230815729071544861602750936964829313608137325426383735122175229541155376346436093930287402089517426973178917569713384748081827255472576937471496195752727188261435633271238710131736096299798168852925540549342330775279877006784354801422249722573783561685179618816480037695005515426162362431072245638324744480n; + + const pExponent = module.alloc(utils$2.bigInt2BytesLE( exponent, 352 )); + + const c = f.getCodeBuilder(); + + f.addCode( + c.call(ftmPrefix + "_exp", c.getLocal("x"), c.i32_const(pExponent), c.i32_const(352), c.getLocal("r")), + ); + } + + + + + const pPreP = module.alloc(prePSize); + const pPreQ = module.alloc(preQSize); + + function buildPairingEquation(nPairings) { + + const f = module.addFunction(prefix+ "_pairingEq"+nPairings); + for (let i=0; i acc + ( b!=0 ? 1 : 0) ,0); + const ateNCoefs = ateNAddCoefs + ateNDblCoefs + 1; + const prePSize = 3*2*n8q; + const preQSize = 3*n8q*2 + ateNCoefs*ateCoefSize; + const finalExpIsNegative = true; + + const finalExpZ = 15132376222941642752n; + + + module.modules[prefix] = { + n64q: n64q, + n64r: n64r, + n8q: n8q, + n8r: n8r, + pG1gen: pG1gen, + pG1zero: pG1zero, + pG1b: pG1b, + pG2gen: pG2gen, + pG2zero: pG2zero, + pG2b: pG2b, + pq: module.modules["f1m"].pq, + pr: pr, + pOneT: pOneT, + r: r, + q: q, + prePSize: prePSize, + preQSize: preQSize + }; + + + function naf(n) { + let E = n; + const res = []; + while (E > 0n) { + if (isOdd(E)) { + const z = 2 - Number(E % 4n); + res.push( z ); + E = E - BigInt(z); + } else { + res.push( 0 ); + } + E = E >> 1n; + } + return res; + } + + function bits(n) { + let E = n; + const res = []; + while (E > 0n) { + if (isOdd(E)) { + res.push( 1 ); + } else { + res.push( 0 ); + } + E = E >> 1n; + } + return res; + } + + function buildPrepareG1() { + const f = module.addFunction(prefix+ "_prepareG1"); + f.addParam("pP", "i32"); + f.addParam("ppreP", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode( + c.call(g1mPrefix + "_normalize", c.getLocal("pP"), c.getLocal("ppreP")), // TODO Remove if already in affine + ); + } + + + + function buildPrepDoubleStep() { + const f = module.addFunction(prefix+ "_prepDblStep"); + f.addParam("R", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const Rx = c.getLocal("R"); + const Ry = c.i32_add(c.getLocal("R"), c.i32_const(2*n8q)); + const Rz = c.i32_add(c.getLocal("R"), c.i32_const(4*n8q)); + + const t0 = c.getLocal("r"); + const t3 = c.i32_add(c.getLocal("r"), c.i32_const(2*n8q)); + const t6 = c.i32_add(c.getLocal("r"), c.i32_const(4*n8q)); + + + const zsquared = c.i32_const(module.alloc(f2size)); + const t1 = c.i32_const(module.alloc(f2size)); + const t2 = c.i32_const(module.alloc(f2size)); + const t4 = c.i32_const(module.alloc(f2size)); + const t5 = c.i32_const(module.alloc(f2size)); + + f.addCode( + + // tmp0 = r.x.square(); + c.call(f2mPrefix + "_square", Rx, t0), + + // tmp1 = r.y.square(); + c.call(f2mPrefix + "_square", Ry, t1), + + // tmp2 = tmp1.square(); + c.call(f2mPrefix + "_square", t1, t2), + + // tmp3 = (tmp1 + r.x).square() - tmp0 - tmp2; + c.call(f2mPrefix + "_add", t1, Rx, t3), + c.call(f2mPrefix + "_square", t3, t3), + c.call(f2mPrefix + "_sub", t3, t0, t3), + c.call(f2mPrefix + "_sub", t3, t2, t3), + + // tmp3 = tmp3 + tmp3; + c.call(f2mPrefix + "_add", t3, t3, t3), + + // tmp4 = tmp0 + tmp0 + tmp0; + c.call(f2mPrefix + "_add", t0, t0, t4), + c.call(f2mPrefix + "_add", t4, t0, t4), + + // tmp6 = r.x + tmp4; + c.call(f2mPrefix + "_add", Rx, t4, t6), + + // tmp5 = tmp4.square(); + c.call(f2mPrefix + "_square", t4, t5), + + // zsquared = r.z.square(); + c.call(f2mPrefix + "_square", Rz, zsquared), + + // r.x = tmp5 - tmp3 - tmp3; + c.call(f2mPrefix + "_sub", t5, t3, Rx), + c.call(f2mPrefix + "_sub", Rx, t3, Rx), + + // r.z = (r.z + r.y).square() - tmp1 - zsquared; + c.call(f2mPrefix + "_add", Rz, Ry, Rz), + c.call(f2mPrefix + "_square", Rz, Rz), + c.call(f2mPrefix + "_sub", Rz, t1, Rz), + c.call(f2mPrefix + "_sub", Rz, zsquared, Rz), + + // r.y = (tmp3 - r.x) * tmp4; + c.call(f2mPrefix + "_sub", t3, Rx, Ry), + c.call(f2mPrefix + "_mul", Ry, t4, Ry), + + // tmp2 = tmp2 + tmp2; + c.call(f2mPrefix + "_add", t2, t2, t2), + + // tmp2 = tmp2 + tmp2; + c.call(f2mPrefix + "_add", t2, t2, t2), + + // tmp2 = tmp2 + tmp2; + c.call(f2mPrefix + "_add", t2, t2, t2), + + // r.y -= tmp2; + c.call(f2mPrefix + "_sub", Ry, t2, Ry), + + // tmp3 = tmp4 * zsquared; + c.call(f2mPrefix + "_mul", t4, zsquared, t3), + + // tmp3 = tmp3 + tmp3; + c.call(f2mPrefix + "_add", t3, t3, t3), + + // tmp3 = -tmp3; + c.call(f2mPrefix + "_neg", t3, t3), + + // tmp6 = tmp6.square() - tmp0 - tmp5; + c.call(f2mPrefix + "_square", t6, t6), + c.call(f2mPrefix + "_sub", t6, t0, t6), + c.call(f2mPrefix + "_sub", t6, t5, t6), + + // tmp1 = tmp1 + tmp1; + c.call(f2mPrefix + "_add", t1, t1, t1), + + // tmp1 = tmp1 + tmp1; + c.call(f2mPrefix + "_add", t1, t1, t1), + + // tmp6 = tmp6 - tmp1; + c.call(f2mPrefix + "_sub", t6, t1, t6), + + // tmp0 = r.z * zsquared; + c.call(f2mPrefix + "_mul", Rz, zsquared, t0), + + // tmp0 = tmp0 + tmp0; + c.call(f2mPrefix + "_add", t0, t0, t0), + + ); + } + + function buildPrepAddStep() { + const f = module.addFunction(prefix+ "_prepAddStep"); + f.addParam("R", "i32"); + f.addParam("Q", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const Rx = c.getLocal("R"); + const Ry = c.i32_add(c.getLocal("R"), c.i32_const(2*n8q)); + const Rz = c.i32_add(c.getLocal("R"), c.i32_const(4*n8q)); + + const Qx = c.getLocal("Q"); + const Qy = c.i32_add(c.getLocal("Q"), c.i32_const(2*n8q)); + + const t10 = c.getLocal("r"); + const t1 = c.i32_add(c.getLocal("r"), c.i32_const(2*n8q)); + const t9 = c.i32_add(c.getLocal("r"), c.i32_const(4*n8q)); + + const zsquared = c.i32_const(module.alloc(f2size)); + const ysquared = c.i32_const(module.alloc(f2size)); + const ztsquared = c.i32_const(module.alloc(f2size)); + const t0 = c.i32_const(module.alloc(f2size)); + const t2 = c.i32_const(module.alloc(f2size)); + const t3 = c.i32_const(module.alloc(f2size)); + const t4 = c.i32_const(module.alloc(f2size)); + const t5 = c.i32_const(module.alloc(f2size)); + const t6 = c.i32_const(module.alloc(f2size)); + const t7 = c.i32_const(module.alloc(f2size)); + const t8 = c.i32_const(module.alloc(f2size)); + + f.addCode( + + // zsquared = r.z.square(); + c.call(f2mPrefix + "_square", Rz, zsquared), + + // ysquared = q.y.square(); + c.call(f2mPrefix + "_square", Qy, ysquared), + + // t0 = zsquared * q.x; + c.call(f2mPrefix + "_mul", zsquared, Qx, t0), + + // t1 = ((q.y + r.z).square() - ysquared - zsquared) * zsquared; + c.call(f2mPrefix + "_add", Qy, Rz, t1), + c.call(f2mPrefix + "_square", t1, t1), + c.call(f2mPrefix + "_sub", t1, ysquared, t1), + c.call(f2mPrefix + "_sub", t1, zsquared, t1), + c.call(f2mPrefix + "_mul", t1, zsquared, t1), + + // t2 = t0 - r.x; + c.call(f2mPrefix + "_sub", t0, Rx, t2), + + // t3 = t2.square(); + c.call(f2mPrefix + "_square", t2, t3), + + // t4 = t3 + t3; + c.call(f2mPrefix + "_add", t3, t3, t4), + + // t4 = t4 + t4; + c.call(f2mPrefix + "_add", t4, t4, t4), + + // t5 = t4 * t2; + c.call(f2mPrefix + "_mul", t4, t2, t5), + + // t6 = t1 - r.y - r.y; + c.call(f2mPrefix + "_sub", t1, Ry, t6), + c.call(f2mPrefix + "_sub", t6, Ry, t6), + + // t9 = t6 * q.x; + c.call(f2mPrefix + "_mul", t6, Qx, t9), + + // t7 = t4 * r.x; + c.call(f2mPrefix + "_mul", t4, Rx, t7), + + // r.x = t6.square() - t5 - t7 - t7; + c.call(f2mPrefix + "_square", t6, Rx), + c.call(f2mPrefix + "_sub", Rx, t5, Rx), + c.call(f2mPrefix + "_sub", Rx, t7, Rx), + c.call(f2mPrefix + "_sub", Rx, t7, Rx), + + // r.z = (r.z + t2).square() - zsquared - t3; + c.call(f2mPrefix + "_add", Rz, t2, Rz), + c.call(f2mPrefix + "_square", Rz, Rz), + c.call(f2mPrefix + "_sub", Rz, zsquared, Rz), + c.call(f2mPrefix + "_sub", Rz, t3, Rz), + + // t10 = q.y + r.z; + c.call(f2mPrefix + "_add", Qy, Rz, t10), + + // t8 = (t7 - r.x) * t6; + c.call(f2mPrefix + "_sub", t7, Rx, t8), + c.call(f2mPrefix + "_mul", t8, t6, t8), + + // t0 = r.y * t5; + c.call(f2mPrefix + "_mul", Ry, t5, t0), + + // t0 = t0 + t0; + c.call(f2mPrefix + "_add", t0, t0, t0), + + // r.y = t8 - t0; + c.call(f2mPrefix + "_sub", t8, t0, Ry), + + // t10 = t10.square() - ysquared; + c.call(f2mPrefix + "_square", t10, t10), + c.call(f2mPrefix + "_sub", t10, ysquared, t10), + + // ztsquared = r.z.square(); + c.call(f2mPrefix + "_square", Rz, ztsquared), + + // t10 = t10 - ztsquared; + c.call(f2mPrefix + "_sub", t10, ztsquared, t10), + + // t9 = t9 + t9 - t10; + c.call(f2mPrefix + "_add", t9, t9, t9), + c.call(f2mPrefix + "_sub", t9, t10, t9), + + // t10 = r.z + r.z; + c.call(f2mPrefix + "_add", Rz, Rz, t10), + + // t6 = -t6; + c.call(f2mPrefix + "_neg", t6, t6), + + // t1 = t6 + t6; + c.call(f2mPrefix + "_add", t6, t6, t1), + ); + } + + + function buildPrepareG2() { + const f = module.addFunction(prefix+ "_prepareG2"); + f.addParam("pQ", "i32"); + f.addParam("ppreQ", "i32"); + f.addLocal("pCoef", "i32"); + f.addLocal("i", "i32"); + + const c = f.getCodeBuilder(); + + + const Q = c.getLocal("pQ"); + + const pR = module.alloc(f2size*3); + const R = c.i32_const(pR); + + const base = c.getLocal("ppreQ"); + + f.addCode( + c.call(g2mPrefix + "_normalize", Q, base), + c.if( + c.call(g2mPrefix + "_isZero", base), + c.ret([]) + ), + c.call(g2mPrefix + "_copy", base, R), + c.setLocal("pCoef", c.i32_add(c.getLocal("ppreQ"), c.i32_const(f2size*3))), + ); + + f.addCode( + c.setLocal("i", c.i32_const(ateLoopBitBytes.length-2)), + c.block(c.loop( + + c.call(prefix + "_prepDblStep", R, c.getLocal("pCoef")), + c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + + c.if( + c.i32_load8_s(c.getLocal("i"), pAteLoopBitBytes), + [ + ...c.call(prefix + "_prepAddStep", R, base, c.getLocal("pCoef")), + ...c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + ] + ), + c.br_if(1, c.i32_eqz ( c.getLocal("i") )), + c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), + c.br(0) + )) + ); + } + + + function buildF6Mul1() { + const f = module.addFunction(f6mPrefix+ "_mul1"); + f.addParam("pA", "i32"); // F6 + f.addParam("pC1", "i32"); // F2 + f.addParam("pR", "i32"); // F6 + + const c = f.getCodeBuilder(); + + const A_c0 = c.getLocal("pA"); + const A_c1 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*2)); + const A_c2 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*4)); + + const c1 = c.getLocal("pC1"); + + const t1 = c.getLocal("pR"); + const t2 = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*2)); + const b_b = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*4)); + + const Ac0_Ac1 = c.i32_const(module.alloc(f1size*2)); + const Ac1_Ac2 = c.i32_const(module.alloc(f1size*2)); + + f.addCode( + + c.call(f2mPrefix + "_add", A_c0, A_c1, Ac0_Ac1), + c.call(f2mPrefix + "_add", A_c1, A_c2, Ac1_Ac2), + + // let b_b = self.c1 * c1; + c.call(f2mPrefix + "_mul", A_c1, c1, b_b), + + // let t1 = (self.c1 + self.c2) * c1 - b_b; + c.call(f2mPrefix + "_mul", Ac1_Ac2, c1, t1), + c.call(f2mPrefix + "_sub", t1, b_b, t1), + + // let t1 = t1.mul_by_nonresidue(); + c.call(f2mPrefix + "_mulNR", t1, t1), + + // let t2 = (self.c0 + self.c1) * c1 - b_b; + c.call(f2mPrefix + "_mul", Ac0_Ac1, c1, t2), + c.call(f2mPrefix + "_sub", t2, b_b, t2), + ); + } + buildF6Mul1(); + + function buildF6Mul01() { + const f = module.addFunction(f6mPrefix+ "_mul01"); + f.addParam("pA", "i32"); // F6 + f.addParam("pC0", "i32"); // F2 + f.addParam("pC1", "i32"); // F2 + f.addParam("pR", "i32"); // F6 + + const c = f.getCodeBuilder(); + + const A_c0 = c.getLocal("pA"); + const A_c1 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*2)); + const A_c2 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*4)); + + const c0 = c.getLocal("pC0"); + const c1 = c.getLocal("pC1"); + + const t1 = c.getLocal("pR"); + const t2 = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*2)); + const t3 = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*4)); + + const a_a = c.i32_const(module.alloc(f1size*2)); + const b_b = c.i32_const(module.alloc(f1size*2)); + const Ac0_Ac1 = c.i32_const(module.alloc(f1size*2)); + const Ac0_Ac2 = c.i32_const(module.alloc(f1size*2)); + + f.addCode( + // let a_a = self.c0 * c0; + c.call(f2mPrefix + "_mul", A_c0, c0, a_a), + + // let b_b = self.c1 * c1; + c.call(f2mPrefix + "_mul", A_c1, c1, b_b), + + + c.call(f2mPrefix + "_add", A_c0, A_c1, Ac0_Ac1), + c.call(f2mPrefix + "_add", A_c0, A_c2, Ac0_Ac2), + + // let t1 = (self.c1 + self.c2) * c1 - b_b; + c.call(f2mPrefix + "_add", A_c1, A_c2, t1), + c.call(f2mPrefix + "_mul", t1, c1, t1), + c.call(f2mPrefix + "_sub", t1, b_b, t1), + + // let t1 = t1.mul_by_nonresidue() + a_a; + c.call(f2mPrefix + "_mulNR", t1, t1), + c.call(f2mPrefix + "_add", t1, a_a, t1), + + // let t2 = (c0 + c1) * (self.c0 + self.c1) - a_a - b_b; + c.call(f2mPrefix + "_add", c0, c1, t2), + c.call(f2mPrefix + "_mul", t2, Ac0_Ac1, t2), + c.call(f2mPrefix + "_sub", t2, a_a, t2), + c.call(f2mPrefix + "_sub", t2, b_b, t2), + + // let t3 = (self.c0 + self.c2) * c0 - a_a + b_b; + c.call(f2mPrefix + "_mul", Ac0_Ac2, c0, t3), + c.call(f2mPrefix + "_sub", t3, a_a, t3), + c.call(f2mPrefix + "_add", t3, b_b, t3), + + + ); + } + buildF6Mul01(); + + + function buildF12Mul014() { + + const f = module.addFunction(ftmPrefix+ "_mul014"); + f.addParam("pA", "i32"); // F12 + f.addParam("pC0", "i32"); // F2 + f.addParam("pC1", "i32"); // F2 + f.addParam("pC4", "i32"); // F2 + f.addParam("pR", "i32"); // F12 + + const c = f.getCodeBuilder(); + + + const A_c0 = c.getLocal("pA"); + const A_c1 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*6)); + + const c0 = c.getLocal("pC0"); + const c1 = c.getLocal("pC1"); + const c4 = c.getLocal("pC4"); + + const aa = c.i32_const(module.alloc(f1size*6)); + const bb = c.i32_const(module.alloc(f1size*6)); + const o = c.i32_const(module.alloc(f1size*2)); + + const R_c0 = c.getLocal("pR"); + const R_c1 = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*6)); + + f.addCode( + // let aa = self.c0.mul_by_01(c0, c1); + c.call(f6mPrefix + "_mul01", A_c0, c0, c1, aa), + + // let bb = self.c1.mul_by_1(c4); + c.call(f6mPrefix + "_mul1", A_c1, c4, bb), + + // let o = c1 + c4; + c.call(f2mPrefix + "_add", c1, c4, o), + + // let c1 = self.c1 + self.c0; + c.call(f6mPrefix + "_add", A_c1, A_c0, R_c1), + + // let c1 = c1.mul_by_01(c0, &o); + c.call(f6mPrefix + "_mul01", R_c1, c0, o, R_c1), + + // let c1 = c1 - aa - bb; + c.call(f6mPrefix + "_sub", R_c1, aa, R_c1), + c.call(f6mPrefix + "_sub", R_c1, bb, R_c1), + + // let c0 = bb; + c.call(f6mPrefix + "_copy", bb, R_c0), + + // let c0 = c0.mul_by_nonresidue(); + c.call(f6mPrefix + "_mulNR", R_c0, R_c0), + + // let c0 = c0 + aa; + c.call(f6mPrefix + "_add", R_c0, aa, R_c0), + ); + } + buildF12Mul014(); + + + function buildELL() { + const f = module.addFunction(prefix+ "_ell"); + f.addParam("pP", "i32"); + f.addParam("pCoefs", "i32"); + f.addParam("pF", "i32"); + + const c = f.getCodeBuilder(); + + const Px = c.getLocal("pP"); + const Py = c.i32_add(c.getLocal("pP"), c.i32_const(n8q)); + + const F = c.getLocal("pF"); + + const coef0_0 = c.getLocal("pCoefs"); + const coef0_1 = c.i32_add(c.getLocal("pCoefs"), c.i32_const(f1size)); + const coef1_0 = c.i32_add(c.getLocal("pCoefs"), c.i32_const(f1size*2)); + const coef1_1 = c.i32_add(c.getLocal("pCoefs"), c.i32_const(f1size*3)); + const coef2 = c.i32_add(c.getLocal("pCoefs"), c.i32_const(f1size*4)); + + const pc0 = module.alloc(f1size*2); + const c0 = c.i32_const(pc0); + const c0_c0 = c.i32_const(pc0); + const c0_c1 = c.i32_const(pc0+f1size); + + const pc1 = module.alloc(f1size*2); + const c1 = c.i32_const(pc1); + const c1_c0 = c.i32_const(pc1); + const c1_c1 = c.i32_const(pc1+f1size); + f.addCode( + // let mut c0 = coeffs.0; + // let mut c1 = coeffs.1; + // + // c0.c0 *= p.y; + // c0.c1 *= p.y; + // + // c1.c0 *= p.x; + // c1.c1 *= p.x; + // + // f.mul_by_014(&coeffs.2, &c1, &c0) + + c.call(f1mPrefix + "_mul", coef0_0, Py, c0_c0), + c.call(f1mPrefix + "_mul", coef0_1, Py, c0_c1), + c.call(f1mPrefix + "_mul", coef1_0, Px, c1_c0), + c.call(f1mPrefix + "_mul", coef1_1, Px, c1_c1), + + c.call(ftmPrefix + "_mul014", F, coef2, c1, c0, F), + + ); + + } + buildELL(); + + function buildMillerLoop() { + const f = module.addFunction(prefix+ "_millerLoop"); + f.addParam("ppreP", "i32"); + f.addParam("ppreQ", "i32"); + f.addParam("r", "i32"); + f.addLocal("pCoef", "i32"); + f.addLocal("i", "i32"); + + const c = f.getCodeBuilder(); + + const preP = c.getLocal("ppreP"); + + const coefs = c.getLocal("pCoef"); + + const F = c.getLocal("r"); + + + f.addCode( + c.call(ftmPrefix + "_one", F), + + c.if( + c.call(g1mPrefix + "_isZero", preP), + c.ret([]) + ), + c.if( + c.call(g1mPrefix + "_isZero", c.getLocal("ppreQ")), + c.ret([]) + ), + c.setLocal("pCoef", c.i32_add( c.getLocal("ppreQ"), c.i32_const(f2size*3))), + + c.setLocal("i", c.i32_const(ateLoopBitBytes.length-2)), + c.block(c.loop( + + + c.call(prefix + "_ell", preP, coefs, F), + c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + + c.if( + c.i32_load8_s(c.getLocal("i"), pAteLoopBitBytes), + [ + ...c.call(prefix + "_ell", preP, coefs, F), + ...c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + ] + ), + c.call(ftmPrefix + "_square", F, F), + + c.br_if(1, c.i32_eq ( c.getLocal("i"), c.i32_const(1) )), + c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), + c.br(0) + )), + c.call(prefix + "_ell", preP, coefs, F), + + ); + + + { + f.addCode( + c.call(ftmPrefix + "_conjugate", F, F), + ); + } + } + + + function buildFrobeniusMap(n) { + const F12 = [ + [ + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + ], + [ + [1n, 0n], + [3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760n, 151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027n], + [793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351n, 0n], + [2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n, 1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257n], + [793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n, 0n], + [3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557n, 877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230n], + [4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786n, 0n], + [151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027n, 3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760n], + [4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n, 0n], + [1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257n, 2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n], + [4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437n, 0n], + [877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230n, 3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557n], + ] + ]; + + const F6 = [ + [ + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + ], + [ + [1n, 0n], + [0n, 4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n], + [793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n, 0n], + [0n, 1n], + [4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n, 0n], + [0n, 793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n], + ], + [ + [1n, 0n], + [4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437n, 0n], + [4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n, 0n], + [4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786n, 0n], + [793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n, 0n], + [793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351n, 0n], + ] + ]; + + const f = module.addFunction(ftmPrefix + "_frobeniusMap"+n); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + for (let i=0; i<6; i++) { + const X = (i==0) ? c.getLocal("x") : c.i32_add(c.getLocal("x"), c.i32_const(i*f2size)); + const Xc0 = X; + const Xc1 = c.i32_add(c.getLocal("x"), c.i32_const(i*f2size + f1size)); + const R = (i==0) ? c.getLocal("r") : c.i32_add(c.getLocal("r"), c.i32_const(i*f2size)); + const Rc0 = R; + const Rc1 = c.i32_add(c.getLocal("r"), c.i32_const(i*f2size + f1size)); + const coef = mul2(F12[Math.floor(i/3)][n%12] , F6[i%3][n%6]); + const pCoef = module.alloc([ + ...utils$1.bigInt2BytesLE(toMontgomery(coef[0]), n8q), + ...utils$1.bigInt2BytesLE(toMontgomery(coef[1]), n8q), + ]); + if (n%2 == 1) { + f.addCode( + c.call(f1mPrefix + "_copy", Xc0, Rc0), + c.call(f1mPrefix + "_neg", Xc1, Rc1), + c.call(f2mPrefix + "_mul", R, c.i32_const(pCoef), R), + ); + } else { + f.addCode(c.call(f2mPrefix + "_mul", X, c.i32_const(pCoef), R)); + } + } + + function mul2(a, b) { + const ac0 = a[0]; + const ac1 = a[1]; + const bc0 = b[0]; + const bc1 = b[1]; + const res = [ + (ac0 * bc0 - (ac1 * bc1)) % q, + (ac0 * bc1 + (ac1 * bc0)) % q, + ]; + if (isNegative$1(res[0])) res[0] = res[0] + q; + return res; + } + + } + + + function buildCyclotomicSquare() { + const f = module.addFunction(prefix+ "__cyclotomicSquare"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x4 = c.i32_add(c.getLocal("x"), c.i32_const(f2size)); + const x3 = c.i32_add(c.getLocal("x"), c.i32_const(2*f2size)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(3*f2size)); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(4*f2size)); + const x5 = c.i32_add(c.getLocal("x"), c.i32_const(5*f2size)); + + const r0 = c.getLocal("r"); + const r4 = c.i32_add(c.getLocal("r"), c.i32_const(f2size)); + const r3 = c.i32_add(c.getLocal("r"), c.i32_const(2*f2size)); + const r2 = c.i32_add(c.getLocal("r"), c.i32_const(3*f2size)); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(4*f2size)); + const r5 = c.i32_add(c.getLocal("r"), c.i32_const(5*f2size)); + + const t0 = c.i32_const(module.alloc(f2size)); + const t1 = c.i32_const(module.alloc(f2size)); + const t2 = c.i32_const(module.alloc(f2size)); + const t3 = c.i32_const(module.alloc(f2size)); + const t4 = c.i32_const(module.alloc(f2size)); + const t5 = c.i32_const(module.alloc(f2size)); + const tmp = c.i32_const(module.alloc(f2size)); + const AUX = c.i32_const(module.alloc(f2size)); + + + f.addCode( + // // t0 + t1*y = (z0 + z1*y)^2 = a^2 + // tmp = z0 * z1; + // t0 = (z0 + z1) * (z0 + my_Fp6::non_residue * z1) - tmp - my_Fp6::non_residue * tmp; + // t1 = tmp + tmp; + c.call(f2mPrefix + "_mul", x0, x1, tmp), + c.call(f2mPrefix + "_mulNR", x1, t0), + c.call(f2mPrefix + "_add", x0, t0, t0), + c.call(f2mPrefix + "_add", x0, x1, AUX), + c.call(f2mPrefix + "_mul", AUX, t0, t0), + c.call(f2mPrefix + "_mulNR", tmp, AUX), + c.call(f2mPrefix + "_add", tmp, AUX, AUX), + c.call(f2mPrefix + "_sub", t0, AUX, t0), + c.call(f2mPrefix + "_add", tmp, tmp, t1), + + // // t2 + t3*y = (z2 + z3*y)^2 = b^2 + // tmp = z2 * z3; + // t2 = (z2 + z3) * (z2 + my_Fp6::non_residue * z3) - tmp - my_Fp6::non_residue * tmp; + // t3 = tmp + tmp; + c.call(f2mPrefix + "_mul", x2, x3, tmp), + c.call(f2mPrefix + "_mulNR", x3, t2), + c.call(f2mPrefix + "_add", x2, t2, t2), + c.call(f2mPrefix + "_add", x2, x3, AUX), + c.call(f2mPrefix + "_mul", AUX, t2, t2), + c.call(f2mPrefix + "_mulNR", tmp, AUX), + c.call(f2mPrefix + "_add", tmp, AUX, AUX), + c.call(f2mPrefix + "_sub", t2, AUX, t2), + c.call(f2mPrefix + "_add", tmp, tmp, t3), + + // // t4 + t5*y = (z4 + z5*y)^2 = c^2 + // tmp = z4 * z5; + // t4 = (z4 + z5) * (z4 + my_Fp6::non_residue * z5) - tmp - my_Fp6::non_residue * tmp; + // t5 = tmp + tmp; + c.call(f2mPrefix + "_mul", x4, x5, tmp), + c.call(f2mPrefix + "_mulNR", x5, t4), + c.call(f2mPrefix + "_add", x4, t4, t4), + c.call(f2mPrefix + "_add", x4, x5, AUX), + c.call(f2mPrefix + "_mul", AUX, t4, t4), + c.call(f2mPrefix + "_mulNR", tmp, AUX), + c.call(f2mPrefix + "_add", tmp, AUX, AUX), + c.call(f2mPrefix + "_sub", t4, AUX, t4), + c.call(f2mPrefix + "_add", tmp, tmp, t5), + + // For A + // z0 = 3 * t0 - 2 * z0 + c.call(f2mPrefix + "_sub", t0, x0, r0), + c.call(f2mPrefix + "_add", r0, r0, r0), + c.call(f2mPrefix + "_add", t0, r0, r0), + // z1 = 3 * t1 + 2 * z1 + c.call(f2mPrefix + "_add", t1, x1, r1), + c.call(f2mPrefix + "_add", r1, r1, r1), + c.call(f2mPrefix + "_add", t1, r1, r1), + + // For B + // z2 = 3 * (xi * t5) + 2 * z2 + c.call(f2mPrefix + "_mul", t5, c.i32_const(pBls12381Twist), AUX), + c.call(f2mPrefix + "_add", AUX, x2, r2), + c.call(f2mPrefix + "_add", r2, r2, r2), + c.call(f2mPrefix + "_add", AUX, r2, r2), + // z3 = 3 * t4 - 2 * z3 + c.call(f2mPrefix + "_sub", t4, x3, r3), + c.call(f2mPrefix + "_add", r3, r3, r3), + c.call(f2mPrefix + "_add", t4, r3, r3), + + // For C + // z4 = 3 * t2 - 2 * z4 + c.call(f2mPrefix + "_sub", t2, x4, r4), + c.call(f2mPrefix + "_add", r4, r4, r4), + c.call(f2mPrefix + "_add", t2, r4, r4), + // z5 = 3 * t3 + 2 * z5 + c.call(f2mPrefix + "_add", t3, x5, r5), + c.call(f2mPrefix + "_add", r5, r5, r5), + c.call(f2mPrefix + "_add", t3, r5, r5), + + ); + } + + + function buildCyclotomicExp(exponent, isExpNegative, fnName) { + const exponentNafBytes = naf(exponent).map( (b) => (b==-1 ? 0xFF: b) ); + const pExponentNafBytes = module.alloc(exponentNafBytes); + // const pExponent = module.alloc(utils.bigInt2BytesLE(exponent, n8)); + + const f = module.addFunction(prefix+ "__cyclotomicExp_"+fnName); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + f.addLocal("bit", "i32"); + f.addLocal("i", "i32"); + + const c = f.getCodeBuilder(); + + const x = c.getLocal("x"); + + const res = c.getLocal("r"); + + const inverse = c.i32_const(module.alloc(ftsize)); + + + f.addCode( + c.call(ftmPrefix + "_conjugate", x, inverse), + c.call(ftmPrefix + "_one", res), + + c.if( + c.teeLocal("bit", c.i32_load8_s(c.i32_const(exponentNafBytes.length-1), pExponentNafBytes)), + c.if( + c.i32_eq( + c.getLocal("bit"), + c.i32_const(1) + ), + c.call(ftmPrefix + "_mul", res, x, res), + c.call(ftmPrefix + "_mul", res, inverse, res), + ) + ), + + c.setLocal("i", c.i32_const(exponentNafBytes.length-2)), + c.block(c.loop( + c.call(prefix + "__cyclotomicSquare", res, res), + c.if( + c.teeLocal("bit", c.i32_load8_s(c.getLocal("i"), pExponentNafBytes)), + c.if( + c.i32_eq( + c.getLocal("bit"), + c.i32_const(1) + ), + c.call(ftmPrefix + "_mul", res, x, res), + c.call(ftmPrefix + "_mul", res, inverse, res), + ) + ), + c.br_if(1, c.i32_eqz ( c.getLocal("i") )), + c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), + c.br(0) + )) + ); + + if (isExpNegative) { + f.addCode( + c.call(ftmPrefix + "_conjugate", res, res), + ); + } + + } + + function buildFinalExponentiation() { + buildCyclotomicSquare(); + buildCyclotomicExp(finalExpZ, finalExpIsNegative, "w0"); + + const f = module.addFunction(prefix+ "_finalExponentiation"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const elt = c.getLocal("x"); + const res = c.getLocal("r"); + const t0 = c.i32_const(module.alloc(ftsize)); + const t1 = c.i32_const(module.alloc(ftsize)); + const t2 = c.i32_const(module.alloc(ftsize)); + const t3 = c.i32_const(module.alloc(ftsize)); + const t4 = c.i32_const(module.alloc(ftsize)); + const t5 = c.i32_const(module.alloc(ftsize)); + const t6 = c.i32_const(module.alloc(ftsize)); + + f.addCode( + + // let mut t0 = f.frobenius_map(6) + c.call(ftmPrefix + "_frobeniusMap6", elt, t0), + + // let t1 = f.invert() + c.call(ftmPrefix + "_inverse", elt, t1), + + // let mut t2 = t0 * t1; + c.call(ftmPrefix + "_mul", t0, t1, t2), + + // t1 = t2.clone(); + c.call(ftmPrefix + "_copy", t2, t1), + + // t2 = t2.frobenius_map().frobenius_map(); + c.call(ftmPrefix + "_frobeniusMap2", t2, t2), + + // t2 *= t1; + c.call(ftmPrefix + "_mul", t2, t1, t2), + + + // t1 = cyclotomic_square(t2).conjugate(); + c.call(prefix + "__cyclotomicSquare", t2, t1), + c.call(ftmPrefix + "_conjugate", t1, t1), + + // let mut t3 = cycolotomic_exp(t2); + c.call(prefix + "__cyclotomicExp_w0", t2, t3), + + // let mut t4 = cyclotomic_square(t3); + c.call(prefix + "__cyclotomicSquare", t3, t4), + + // let mut t5 = t1 * t3; + c.call(ftmPrefix + "_mul", t1, t3, t5), + + // t1 = cycolotomic_exp(t5); + c.call(prefix + "__cyclotomicExp_w0", t5, t1), + + // t0 = cycolotomic_exp(t1); + c.call(prefix + "__cyclotomicExp_w0", t1, t0), + + // let mut t6 = cycolotomic_exp(t0); + c.call(prefix + "__cyclotomicExp_w0", t0, t6), + + // t6 *= t4; + c.call(ftmPrefix + "_mul", t6, t4, t6), + + // t4 = cycolotomic_exp(t6); + c.call(prefix + "__cyclotomicExp_w0", t6, t4), + + // t5 = t5.conjugate(); + c.call(ftmPrefix + "_conjugate", t5, t5), + + // t4 *= t5 * t2; + c.call(ftmPrefix + "_mul", t4, t5, t4), + c.call(ftmPrefix + "_mul", t4, t2, t4), + + // t5 = t2.conjugate(); + c.call(ftmPrefix + "_conjugate", t2, t5), + + // t1 *= t2; + c.call(ftmPrefix + "_mul", t1, t2, t1), + + // t1 = t1.frobenius_map().frobenius_map().frobenius_map(); + c.call(ftmPrefix + "_frobeniusMap3", t1, t1), + + // t6 *= t5; + c.call(ftmPrefix + "_mul", t6, t5, t6), + + // t6 = t6.frobenius_map(); + c.call(ftmPrefix + "_frobeniusMap1", t6, t6), + + // t3 *= t0; + c.call(ftmPrefix + "_mul", t3, t0, t3), + + // t3 = t3.frobenius_map().frobenius_map(); + c.call(ftmPrefix + "_frobeniusMap2", t3, t3), + + // t3 *= t1; + c.call(ftmPrefix + "_mul", t3, t1, t3), + + // t3 *= t6; + c.call(ftmPrefix + "_mul", t3, t6, t3), + + // f = t3 * t4; + c.call(ftmPrefix + "_mul", t3, t4, res), + + ); + } + + + function buildFinalExponentiationOld() { + const f = module.addFunction(prefix+ "_finalExponentiationOld"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const exponent = 322277361516934140462891564586510139908379969514828494218366688025288661041104682794998680497580008899973249814104447692778988208376779573819485263026159588510513834876303014016798809919343532899164848730280942609956670917565618115867287399623286813270357901731510188149934363360381614501334086825442271920079363289954510565375378443704372994881406797882676971082200626541916413184642520269678897559532260949334760604962086348898118982248842634379637598665468817769075878555493752214492790122785850202957575200176084204422751485957336465472324810982833638490904279282696134323072515220044451592646885410572234451732790590013479358343841220074174848221722017083597872017638514103174122784843925578370430843522959600095676285723737049438346544753168912974976791528535276317256904336520179281145394686565050419250614107803233314658825463117900250701199181529205942363159325765991819433914303908860460720581408201373164047773794825411011922305820065611121544561808414055302212057471395719432072209245600258134364584636810093520285711072578721435517884103526483832733289802426157301542744476740008494780363354305116978805620671467071400711358839553375340724899735460480144599782014906586543813292157922220645089192130209334926661588737007768565838519456601560804957985667880395221049249803753582637708560n; + + const pExponent = module.alloc(utils$1.bigInt2BytesLE( exponent, 544 )); + + const c = f.getCodeBuilder(); + + f.addCode( + c.call(ftmPrefix + "_exp", c.getLocal("x"), c.i32_const(pExponent), c.i32_const(544), c.getLocal("r")), + ); + } + + + const pPreP = module.alloc(prePSize); + const pPreQ = module.alloc(preQSize); + + function buildPairingEquation(nPairings) { + + const f = module.addFunction(prefix+ "_pairingEq"+nPairings); + for (let i=0; i. */ -const bigInt = __webpack_require__(2096); +// module.exports.bn128_wasm = require("./build/bn128_wasm.js"); +// module.exports.bls12381_wasm = require("./build/bls12381_wasm.js"); +// module.exports.mnt6753_wasm = require("./build/mnt6753_wasm.js"); -exports.bigInt2BytesLE = function bigInt2BytesLE(_a, len) { - const b = Array(len); - let v = bigInt(_a); - for (let i=0; i { - -"use strict"; - - -var forEach = __webpack_require__(2682); -var availableTypedArrays = __webpack_require__(9209); -var callBind = __webpack_require__(487); -var callBound = __webpack_require__(8075); -var gOPD = __webpack_require__(5795); - -/** @type {(O: object) => string} */ -var $toString = callBound('Object.prototype.toString'); -var hasToStringTag = __webpack_require__(9092)(); - -var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis; -var typedArrays = availableTypedArrays(); - -var $slice = callBound('String.prototype.slice'); -var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); - -/** @type {(array: readonly T[], value: unknown) => number} */ -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; -}; - -/** @typedef {(receiver: import('.').TypedArray) => string | typeof Uint8Array.prototype.slice.call | typeof Uint8Array.prototype.set.call} Getter */ -/** @type {{ [k in `\$${import('.').TypedArrayName}`]?: Getter } & { __proto__: null }} */ -var cache = { __proto__: null }; -if (hasToStringTag && gOPD && getPrototypeOf) { - forEach(typedArrays, function (typedArray) { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - // @ts-expect-error TS won't narrow inside a closure - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - // @ts-expect-error TS won't narrow inside a closure - descriptor = gOPD(superProto, Symbol.toStringTag); - } - // @ts-expect-error TODO: fix - cache['$' + typedArray] = callBind(descriptor.get); - } - }); -} else { - forEach(typedArrays, function (typedArray) { - var arr = new g[typedArray](); - var fn = arr.slice || arr.set; - if (fn) { - // @ts-expect-error TODO: fix - cache['$' + typedArray] = callBind(fn); - } - }); -} - -/** @type {(value: object) => false | import('.').TypedArrayName} */ -var tryTypedArrays = function tryAllTypedArrays(value) { - /** @type {ReturnType} */ var found = false; - forEach( - // eslint-disable-next-line no-extra-parens - /** @type {Record<`\$${TypedArrayName}`, Getter>} */ /** @type {any} */ (cache), - /** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */ - function (getter, typedArray) { - if (!found) { - try { - // @ts-expect-error TODO: fix - if ('$' + getter(value) === typedArray) { - found = $slice(typedArray, 1); - } - } catch (e) { /**/ } - } - } - ); - return found; -}; - -/** @type {(value: object) => false | import('.').TypedArrayName} */ -var trySlices = function tryAllSlices(value) { - /** @type {ReturnType} */ var found = false; - forEach( - // eslint-disable-next-line no-extra-parens - /** @type {Record<`\$${TypedArrayName}`, Getter>} */ /** @type {any} */ (cache), - /** @type {(getter: typeof cache, name: `\$${import('.').TypedArrayName}`) => void} */ function (getter, name) { - if (!found) { - try { - // @ts-expect-error TODO: fix - getter(value); - found = $slice(name, 1); - } catch (e) { /**/ } - } - } - ); - return found; -}; - -/** @type {import('.')} */ -module.exports = function whichTypedArray(value) { - if (!value || typeof value !== 'object') { return false; } - if (!hasToStringTag) { - /** @type {string} */ - var tag = $slice($toString(value), 8, -1); - if ($indexOf(typedArrays, tag) > -1) { - return tag; - } - if (tag !== 'Object') { - return false; - } - // node < 0.6 hits here on real Typed Arrays - return trySlices(value); - } - if (!gOPD) { return null; } // unknown engine - return tryTypedArrays(value); -}; - - -/***/ }), - -/***/ 8982: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 7790: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 3776: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 1638: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 2668: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 7965: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 6089: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 9368: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 4688: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 1069: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 5340: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 9838: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 7882: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 9209: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var possibleNames = __webpack_require__(6578); - -var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis; - -/** @type {import('.')} */ -module.exports = function availableTypedArrays() { - var /** @type {ReturnType} */ out = []; - for (var i = 0; i < possibleNames.length; i++) { - if (typeof g[possibleNames[i]] === 'function') { - // @ts-expect-error - out[out.length] = possibleNames[i]; - } - } - return out; -}; - - -/***/ }), - -/***/ 3219: -/***/ ((module) => { - -"use strict"; -module.exports = /*#__PURE__*/JSON.parse('{"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}'); - -/***/ }), - -/***/ 2951: -/***/ ((module) => { - -"use strict"; -module.exports = /*#__PURE__*/JSON.parse('{"sha224WithRSAEncryption":{"sign":"rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"RSA-SHA224":{"sign":"ecdsa/rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"sha256WithRSAEncryption":{"sign":"rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"RSA-SHA256":{"sign":"ecdsa/rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"sha384WithRSAEncryption":{"sign":"rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"RSA-SHA384":{"sign":"ecdsa/rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"sha512WithRSAEncryption":{"sign":"rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA512":{"sign":"ecdsa/rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA1":{"sign":"rsa","hash":"sha1","id":"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{"sign":"ecdsa","hash":"sha1","id":""},"sha256":{"sign":"ecdsa","hash":"sha256","id":""},"sha224":{"sign":"ecdsa","hash":"sha224","id":""},"sha384":{"sign":"ecdsa","hash":"sha384","id":""},"sha512":{"sign":"ecdsa","hash":"sha512","id":""},"DSA-SHA":{"sign":"dsa","hash":"sha1","id":""},"DSA-SHA1":{"sign":"dsa","hash":"sha1","id":""},"DSA":{"sign":"dsa","hash":"sha1","id":""},"DSA-WITH-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-WITH-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-WITH-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-WITH-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-RIPEMD160":{"sign":"dsa","hash":"rmd160","id":""},"ripemd160WithRSA":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"RSA-RIPEMD160":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"md5WithRSAEncryption":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"},"RSA-MD5":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"}}'); - -/***/ }), - -/***/ 4589: -/***/ ((module) => { - -"use strict"; -module.exports = /*#__PURE__*/JSON.parse('{"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}'); - -/***/ }), - -/***/ 3241: -/***/ ((module) => { - -"use strict"; -module.exports = /*#__PURE__*/JSON.parse('{"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}'); - -/***/ }), - -/***/ 1636: -/***/ ((module) => { - -"use strict"; -module.exports = {"rE":"6.5.5"}; - -/***/ }), - -/***/ 5579: -/***/ ((module) => { - -"use strict"; -module.exports = /*#__PURE__*/JSON.parse('{"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}'); - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ id: moduleId, -/******/ loaded: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.loaded = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/amd options */ -/******/ (() => { -/******/ __webpack_require__.amdO = {}; -/******/ })(); -/******/ -/******/ /* webpack/runtime/compat get default export */ -/******/ (() => { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = (module) => { -/******/ var getter = module && module.__esModule ? -/******/ () => (module['default']) : -/******/ () => (module); -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/global */ -/******/ (() => { -/******/ __webpack_require__.g = (function() { -/******/ if (typeof globalThis === 'object') return globalThis; -/******/ try { -/******/ return this || new Function('return this')(); -/******/ } catch (e) { -/******/ if (typeof window === 'object') return window; -/******/ } -/******/ })(); -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/node module decorator */ -/******/ (() => { -/******/ __webpack_require__.nmd = (module) => { -/******/ module.paths = []; -/******/ if (!module.children) module.children = []; -/******/ return module; -/******/ }; -/******/ })(); -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be in strict mode. -(() => { -"use strict"; -// ESM COMPAT FLAG -__webpack_require__.r(__webpack_exports__); - -// NAMESPACE OBJECT: ./node_modules/ffjavascript/src/scalar_native.js -var scalar_native_namespaceObject = {}; -__webpack_require__.r(scalar_native_namespaceObject); -__webpack_require__.d(scalar_native_namespaceObject, { - abs: () => (abs), - add: () => (add), - band: () => (band), - bitLength: () => (bitLength), - bits: () => (bits), - bor: () => (bor), - bxor: () => (bxor), - div: () => (div), - e: () => (e), - eq: () => (eq), - exp: () => (exp), - fromArray: () => (fromArray), - fromString: () => (fromString), - geq: () => (geq), - gt: () => (gt), - isNegative: () => (isNegative), - isOdd: () => (isOdd), - isZero: () => (isZero), - land: () => (land), - leq: () => (leq), - lnot: () => (lnot), - lor: () => (lor), - lt: () => (lt), - mod: () => (mod), - mul: () => (mul), - naf: () => (naf), - neg: () => (neg), - neq: () => (neq), - pow: () => (pow), - shiftLeft: () => (shiftLeft), - shiftRight: () => (shiftRight), - shl: () => (shl), - shr: () => (shr), - square: () => (square), - sub: () => (sub), - toArray: () => (toArray), - toNumber: () => (toNumber) -}); - -// NAMESPACE OBJECT: ./node_modules/ffjavascript/src/scalar_bigint.js -var scalar_bigint_namespaceObject = {}; -__webpack_require__.r(scalar_bigint_namespaceObject); -__webpack_require__.d(scalar_bigint_namespaceObject, { - abs: () => (scalar_bigint_abs), - add: () => (scalar_bigint_add), - band: () => (scalar_bigint_band), - bitLength: () => (scalar_bigint_bitLength), - bits: () => (scalar_bigint_bits), - bor: () => (scalar_bigint_bor), - bxor: () => (scalar_bigint_bxor), - div: () => (scalar_bigint_div), - e: () => (scalar_bigint_e), - eq: () => (scalar_bigint_eq), - exp: () => (scalar_bigint_exp), - fromArray: () => (scalar_bigint_fromArray), - fromString: () => (scalar_bigint_fromString), - geq: () => (scalar_bigint_geq), - gt: () => (scalar_bigint_gt), - isNegative: () => (scalar_bigint_isNegative), - isOdd: () => (scalar_bigint_isOdd), - isZero: () => (scalar_bigint_isZero), - land: () => (scalar_bigint_land), - leq: () => (scalar_bigint_leq), - lnot: () => (scalar_bigint_lnot), - lor: () => (scalar_bigint_lor), - lt: () => (scalar_bigint_lt), - mod: () => (scalar_bigint_mod), - mul: () => (scalar_bigint_mul), - naf: () => (scalar_bigint_naf), - neg: () => (scalar_bigint_neg), - neq: () => (scalar_bigint_neq), - pow: () => (scalar_bigint_pow), - shiftLeft: () => (scalar_bigint_shiftLeft), - shiftRight: () => (scalar_bigint_shiftRight), - shl: () => (scalar_bigint_shl), - shr: () => (scalar_bigint_shr), - square: () => (scalar_bigint_square), - sub: () => (scalar_bigint_sub), - toArray: () => (scalar_bigint_toArray), - toNumber: () => (scalar_bigint_toNumber) -}); - -// NAMESPACE OBJECT: ./node_modules/ffjavascript/src/scalar.js -var scalar_namespaceObject = {}; -__webpack_require__.r(scalar_namespaceObject); -__webpack_require__.d(scalar_namespaceObject, { - abs: () => (scalar_abs), - add: () => (scalar_add), - band: () => (scalar_band), - bitLength: () => (scalar_bitLength), - bits: () => (scalar_bits), - bor: () => (scalar_bor), - bxor: () => (scalar_bxor), - div: () => (scalar_div), - e: () => (scalar_e), - eq: () => (scalar_eq), - exp: () => (scalar_exp), - fromArray: () => (scalar_fromArray), - fromRprBE: () => (fromRprBE), - fromRprLE: () => (fromRprLE), - fromString: () => (scalar_fromString), - geq: () => (scalar_geq), - gt: () => (scalar_gt), - isNegative: () => (scalar_isNegative), - isOdd: () => (scalar_isOdd), - isZero: () => (scalar_isZero), - land: () => (scalar_land), - leq: () => (scalar_leq), - lnot: () => (scalar_lnot), - lor: () => (scalar_lor), - lt: () => (scalar_lt), - mod: () => (scalar_mod), - mul: () => (scalar_mul), - naf: () => (scalar_naf), - neg: () => (scalar_neg), - neq: () => (scalar_neq), - one: () => (one), - pow: () => (scalar_pow), - shiftLeft: () => (scalar_shiftLeft), - shiftRight: () => (scalar_shiftRight), - shl: () => (scalar_shl), - shr: () => (scalar_shr), - square: () => (scalar_square), - sub: () => (scalar_sub), - toArray: () => (scalar_toArray), - toLEBuff: () => (toLEBuff), - toNumber: () => (scalar_toNumber), - toRprBE: () => (toRprBE), - toRprLE: () => (toRprLE), - toString: () => (scalar_toString), - zero: () => (zero) -}); - -// NAMESPACE OBJECT: ./node_modules/ffjavascript/src/utils_native.js -var utils_native_namespaceObject = {}; -__webpack_require__.r(utils_native_namespaceObject); -__webpack_require__.d(utils_native_namespaceObject, { - beBuff2int: () => (beBuff2int), - beInt2Buff: () => (beInt2Buff), - leBuff2int: () => (leBuff2int), - leInt2Buff: () => (leInt2Buff), - stringifyBigInts: () => (stringifyBigInts), - stringifyFElements: () => (stringifyFElements), - unstringifyBigInts: () => (unstringifyBigInts), - unstringifyFElements: () => (unstringifyFElements) -}); - -// NAMESPACE OBJECT: ./node_modules/ffjavascript/src/utils_bigint.js -var utils_bigint_namespaceObject = {}; -__webpack_require__.r(utils_bigint_namespaceObject); -__webpack_require__.d(utils_bigint_namespaceObject, { - beBuff2int: () => (utils_bigint_beBuff2int), - beInt2Buff: () => (utils_bigint_beInt2Buff), - leBuff2int: () => (utils_bigint_leBuff2int), - leInt2Buff: () => (utils_bigint_leInt2Buff), - stringifyBigInts: () => (utils_bigint_stringifyBigInts), - unstringifyBigInts: () => (utils_bigint_unstringifyBigInts) -}); - -// NAMESPACE OBJECT: ./node_modules/ffjavascript/src/utils.js -var utils_namespaceObject = {}; -__webpack_require__.r(utils_namespaceObject); -__webpack_require__.d(utils_namespaceObject, { - array2buffer: () => (array2buffer), - beBuff2int: () => (utils_beBuff2int), - beInt2Buff: () => (utils_beInt2Buff), - bitReverse: () => (bitReverse), - buffReverseBits: () => (buffReverseBits), - buffer2array: () => (buffer2array), - leBuff2int: () => (utils_leBuff2int), - leInt2Buff: () => (utils_leInt2Buff), - log2: () => (utils_log2), - stringifyBigInts: () => (utils_stringifyBigInts), - stringifyFElements: () => (utils_stringifyFElements), - unstringifyBigInts: () => (utils_unstringifyBigInts), - unstringifyFElements: () => (utils_unstringifyFElements) -}); - -// EXTERNAL MODULE: worker_threads (ignored) -var worker_threads_ignored_ = __webpack_require__(7882); -var worker_threads_ignored_default = /*#__PURE__*/__webpack_require__.n(worker_threads_ignored_); -// EXTERNAL MODULE: ./node_modules/@tornado/fixed-merkle-tree/lib/index.js -var lib = __webpack_require__(1217); -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/scalar_native.js /* global BigInt */ -const hexLen = [ 0, 1, 2, 2, 3, 3, 3, 3, 4 ,4 ,4 ,4 ,4 ,4 ,4 ,4]; - -function fromString(s, radix) { - if ((!radix)||(radix==10)) { - return BigInt(s); - } else if (radix==16) { - if (s.slice(0,2) == "0x") { - return BigInt(s); - } else { - return BigInt("0x"+s); - } - } -} - -const e = fromString; - -function fromArray(a, radix) { - let acc =BigInt(0); - radix = BigInt(radix); - for (let i=0; i> BigInt(n); -} - -const shl = shiftLeft; -const shr = shiftRight; - -function isOdd(a) { - return (BigInt(a) & BigInt(1)) == BigInt(1); -} - - -function naf(n) { - let E = BigInt(n); - const res = []; - while (E) { - if (E & BigInt(1)) { - const z = 2 - Number(E % BigInt(4)); - res.push( z ); - E = E - BigInt(z); - } else { - res.push( 0 ); - } - E = E >> BigInt(1); - } - return res; -} - - -function bits(n) { - let E = BigInt(n); - const res = []; - while (E) { - if (E & BigInt(1)) { - res.push(1); - } else { - res.push( 0 ); - } - E = E >> BigInt(1); - } - return res; -} - -function toNumber(s) { - if (s>BigInt(Number.MAX_SAFE_INTEGER )) { - throw new Error("Number too big"); - } - return Number(s); -} - -function toArray(s, radix) { - const res = []; - let rem = BigInt(s); - radix = BigInt(radix); - while (rem) { - res.unshift( Number(rem % radix)); - rem = rem / radix; - } - return res; -} - - -function add(a, b) { - return BigInt(a) + BigInt(b); -} - -function sub(a, b) { - return BigInt(a) - BigInt(b); -} - -function neg(a) { - return -BigInt(a); -} - -function mul(a, b) { - return BigInt(a) * BigInt(b); -} - -function square(a) { - return BigInt(a) * BigInt(a); -} - -function pow(a, b) { - return BigInt(a) ** BigInt(b); -} - -function exp(a, b) { - return BigInt(a) ** BigInt(b); -} - -function abs(a) { - return BigInt(a) >= 0 ? BigInt(a) : -BigInt(a); -} - -function div(a, b) { - return BigInt(a) / BigInt(b); -} - -function mod(a, b) { - return BigInt(a) % BigInt(b); -} - -function eq(a, b) { - return BigInt(a) == BigInt(b); -} - -function neq(a, b) { - return BigInt(a) != BigInt(b); -} - -function lt(a, b) { - return BigInt(a) < BigInt(b); -} - -function gt(a, b) { - return BigInt(a) > BigInt(b); -} - -function leq(a, b) { - return BigInt(a) <= BigInt(b); -} - -function geq(a, b) { - return BigInt(a) >= BigInt(b); -} - -function band(a, b) { - return BigInt(a) & BigInt(b); -} - -function bor(a, b) { - return BigInt(a) | BigInt(b); -} - -function bxor(a, b) { - return BigInt(a) ^ BigInt(b); -} - -function land(a, b) { - return BigInt(a) && BigInt(b); -} - -function lor(a, b) { - return BigInt(a) || BigInt(b); -} - -function lnot(a) { - return !BigInt(a); -} - - -// EXTERNAL MODULE: ./node_modules/big-integer/BigInteger.js -var BigInteger = __webpack_require__(2096); -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/scalar_bigint.js - - -function scalar_bigint_fromString(s, radix) { - if (typeof s == "string") { - if (s.slice(0,2) == "0x") { - return BigInteger(s.slice(2), 16); - } else { - return BigInteger(s,radix); - } - } else { - return BigInteger(s, radix); - } -} - -const scalar_bigint_e = scalar_bigint_fromString; - -function scalar_bigint_fromArray(a, radix) { - return BigInteger.fromArray(a, radix); -} - -function scalar_bigint_bitLength(a) { - return BigInteger(a).bitLength(); -} - -function scalar_bigint_isNegative(a) { - return BigInteger(a).isNegative(); -} - -function scalar_bigint_isZero(a) { - return BigInteger(a).isZero(); -} - -function scalar_bigint_shiftLeft(a, n) { - return BigInteger(a).shiftLeft(n); -} - -function scalar_bigint_shiftRight(a, n) { - return BigInteger(a).shiftRight(n); -} - -const scalar_bigint_shl = scalar_bigint_shiftLeft; -const scalar_bigint_shr = scalar_bigint_shiftRight; - -function scalar_bigint_isOdd(a) { - return BigInteger(a).isOdd(); -} - - -function scalar_bigint_naf(n) { - let E = BigInteger(n); - const res = []; - while (E.gt(BigInteger.zero)) { - if (E.isOdd()) { - const z = 2 - E.mod(4).toJSNumber(); - res.push( z ); - E = E.minus(z); - } else { - res.push( 0 ); - } - E = E.shiftRight(1); - } - return res; -} - -function scalar_bigint_bits(n) { - let E = BigInteger(n); - const res = []; - while (E.gt(BigInteger.zero)) { - if (E.isOdd()) { - res.push(1); - } else { - res.push( 0 ); - } - E = E.shiftRight(1); - } - return res; -} - -function scalar_bigint_toNumber(s) { - if (!s.lt(BigInteger("9007199254740992", 10))) { - throw new Error("Number too big"); - } - return s.toJSNumber(); -} - -function scalar_bigint_toArray(s, radix) { - return BigInteger(s).toArray(radix); -} - -function scalar_bigint_add(a, b) { - return BigInteger(a).add(BigInteger(b)); -} - -function scalar_bigint_sub(a, b) { - return BigInteger(a).minus(BigInteger(b)); -} - -function scalar_bigint_neg(a) { - return BigInteger.zero.minus(BigInteger(a)); -} - -function scalar_bigint_mul(a, b) { - return BigInteger(a).times(BigInteger(b)); -} - -function scalar_bigint_square(a) { - return BigInteger(a).square(); -} - -function scalar_bigint_pow(a, b) { - return BigInteger(a).pow(BigInteger(b)); -} - -function scalar_bigint_exp(a, b) { - return BigInteger(a).pow(BigInteger(b)); -} - -function scalar_bigint_abs(a) { - return BigInteger(a).abs(); -} - -function scalar_bigint_div(a, b) { - return BigInteger(a).divide(BigInteger(b)); -} - -function scalar_bigint_mod(a, b) { - return BigInteger(a).mod(BigInteger(b)); -} - -function scalar_bigint_eq(a, b) { - return BigInteger(a).eq(BigInteger(b)); -} - -function scalar_bigint_neq(a, b) { - return BigInteger(a).neq(BigInteger(b)); -} - -function scalar_bigint_lt(a, b) { - return BigInteger(a).lt(BigInteger(b)); -} - -function scalar_bigint_gt(a, b) { - return BigInteger(a).gt(BigInteger(b)); -} - -function scalar_bigint_leq(a, b) { - return BigInteger(a).leq(BigInteger(b)); -} - -function scalar_bigint_geq(a, b) { - return BigInteger(a).geq(BigInteger(b)); -} - -function scalar_bigint_band(a, b) { - return BigInteger(a).and(BigInteger(b)); -} - -function scalar_bigint_bor(a, b) { - return BigInteger(a).or(BigInteger(b)); -} - -function scalar_bigint_bxor(a, b) { - return BigInteger(a).xor(BigInteger(b)); -} - -function scalar_bigint_land(a, b) { - return (!BigInteger(a).isZero()) && (!BigInteger(b).isZero()); -} - -function scalar_bigint_lor(a, b) { - return (!BigInteger(a).isZero()) || (!BigInteger(b).isZero()); -} - -function scalar_bigint_lnot(a) { - return BigInteger(a).isZero(); -} - - - -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/scalar.js - - - - -const supportsNativeBigInt = typeof BigInt === "function"; - -let scalar_Scalar = {}; -if (supportsNativeBigInt) { - Object.assign(scalar_Scalar, scalar_native_namespaceObject); -} else { - Object.assign(scalar_Scalar, scalar_bigint_namespaceObject); -} - - -// Returns a buffer with Little Endian Representation -scalar_Scalar.toRprLE = function rprBE(buff, o, e, n8) { - const s = "0000000" + e.toString(16); - const v = new Uint32Array(buff.buffer, o, n8/4); - const l = (((s.length-7)*4 - 1) >> 5)+1; // Number of 32bit words; - for (let i=0; i> 5)+1; // Number of 32bit words; - for (let i=0; i a[a.length-i-1] = ch.toString(16).padStart(8,"0") ); - return scalar_Scalar.fromString(a.join(""), 16); -}; - -// Pases a buffer with Big Endian Representation -scalar_Scalar.fromRprBE = function rprLEM(buff, o, n8) { - n8 = n8 || buff.byteLength; - o = o || 0; - const v = new DataView(buff.buffer, buff.byteOffset + o, n8); - const a = new Array(n8/4); - for (let i=0; i. -*/ - -/* - This library does operations on polynomials with coefficients in a field F. - - A polynomial P(x) = p0 + p1 * x + p2 * x^2 + ... + pn * x^n is represented - by the array [ p0, p1, p2, ... , pn ]. - */ - -class PolField { - constructor (F) { - this.F = F; - - let rem = F.sqrt_t; - let s = F.sqrt_s; - - const five = this.F.add(this.F.add(this.F.two, this.F.two), this.F.one); - - this.w = new Array(s+1); - this.wi = new Array(s+1); - this.w[s] = this.F.pow(five, rem); - this.wi[s] = this.F.inv(this.w[s]); - - let n=s-1; - while (n>=0) { - this.w[n] = this.F.square(this.w[n+1]); - this.wi[n] = this.F.square(this.wi[n+1]); - n--; - } - - - this.roots = []; -/* for (let i=0; i<16; i++) { - let r = this.F.one; - n = 1 << i; - const rootsi = new Array(n); - for (let j=0; j this.F.sqrt_s) n = this.s; - for (let i=n; (i>=0) && (!this.roots[i]); i--) { - let r = this.F.one; - const nroots = 1 << i; - const rootsi = new Array(nroots); - for (let j=0; j a.length) { - [b, a] = [a, b]; - } - - if ((b.length <= 2) || (b.length < log2(a.length))) { - return this.mulNormal(a,b); - } else { - return this.mulFFT(a,b); - } - } - - mulNormal(a, b) { - let res = []; - for (let i=0; i0) { - const z = new Array(n).fill(this.F.zero); - return z.concat(p); - } else { - if (-n >= p.length) return []; - return p.slice(-n); - } - } - - eval2(p, x) { - let v = this.F.zero; - let ix = this.F.one; - for (let i=0; i> 1), - F.mul( - x, - _eval(p, newX, offset+step , step << 1, n >> 1))); - return res; - } - } - - lagrange(points) { - let roots = [this.F.one]; - for (let i=0; i> 1; - const p1 = this._fft(pall, bits-1, offset, step*2); - const p2 = this._fft(pall, bits-1, offset+step, step*2); - - const out = new Array(n); - - let m= this.F.one; - for (let i=0; i0 && this.F.eq(p[i], this.F.zero) ) i--; - return p.slice(0, i+1); - } - - eq(a, b) { - const pa = this.reduce(a); - const pb = this.reduce(b); - - if (pa.length != pb.length) return false; - for (let i=0; i=0; i--) { - res[i] = this.F.add(this.F.mul(res[i+1], r), p[i+1]); - } - return res; - } - - _next2Power(v) { - v--; - v |= v >> 1; - v |= v >> 2; - v |= v >> 4; - v |= v >> 8; - v |= v >> 16; - v++; - return v; - } - - toString(p) { - const ap = this.normalize(p); - let S = ""; - for (let i=ap.length-1; i>=0; i--) { - if (!this.F.eq(p[i], this.F.zero)) { - if (S!="") S += " + "; - S = S + p[i].toString(10); - if (i>0) { - S = S + "x"; - if (i>1) { - S = S + "^" +i; - } - } - } - } - return S; - } - - normalize(p) { - const res = new Array(p.length); - for (let i=0; i - // rec = x^(k-2-scaleV)/ v - // - // res = x^m/v = x^(m + (2*k-2 - scaleV) - (2*k-2 - scaleV)) /v => - // res = rec * x^(m - (2*k-2 - scaleV)) => - // res = rec * x^(m - 2*k + 2 + scaleV) - - const rec = this._reciprocal(this.scaleX(v, scaleV), kbits); - const res = this.scaleX(rec, m - 2*k + 2 + scaleV); - - return res; - } - - div(_u, _v) { - if (_u.length < _v.length) return []; - const kbits = log2(_v.length-1)+1; - const k = 1 << kbits; - - const u = this.scaleX(_u, k-_v.length); - const v = this.scaleX(_v, k-_v.length); - - const n = v.length-1; - let m = u.length-1; - - const s = this._reciprocal(v, kbits); - let t; - if (m>2*n) { - t = this.sub(this.scaleX([this.F.one], 2*n), this.mul(s, v)); - } - - let q = []; - let rem = u; - let us, ut; - let finish = false; - - while (!finish) { - us = this.mul(rem, s); - q = this.add(q, this.scaleX(us, -2*n)); - - if ( m > 2*n ) { - ut = this.mul(rem, t); - rem = this.scaleX(ut, -2*n); - m = rem.length-1; - } else { - finish = true; - } - } - - return q; - } - - - // returns the ith nth-root of one - oneRoot(n, i) { - let nbits = log2(n-1)+1; - let res = this.F.one; - let r = i; - - if(i>=n) { - throw new Error("Given 'i' should be lower than 'n'"); - } - else if (1<0) { - if (r & 1 == 1) { - res = this.F.mul(res, this.w[nbits]); - } - r = r >> 1; - nbits --; - } - return res; - } - - computeVanishingPolinomial(bits, t) { - const m = 1 << bits; - return this.F.sub(this.F.pow(t, m), this.F.one); - } - - evaluateLagrangePolynomials(bits, t) { - const m= 1 << bits; - const tm = this.F.pow(t, m); - const u= new Array(m).fill(this.F.zero); - this._setRoots(bits); - const omega = this.w[bits]; - - if (this.F.eq(tm, this.F.one)) { - for (let i = 0; i < m; i++) { - if (this.F.eq(this.roots[bits][0],t)) { // i.e., t equals omega^i - u[i] = this.F.one; - return u; - } - } - } - - const z = this.F.sub(tm, this.F.one); - // let l = this.F.mul(z, this.F.pow(this.F.twoinv, m)); - let l = this.F.mul(z, this.F.inv(this.F.e(m))); - for (let i = 0; i < m; i++) { - u[i] = this.F.mul(l, this.F.inv(this.F.sub(t,this.roots[bits][i]))); - l = this.F.mul(l, omega); - } - - return u; - } - - log2(V) { - return log2(V); - } -} - -function log2( V ) -{ - return( ( ( V & 0xFFFF0000 ) !== 0 ? ( V &= 0xFFFF0000, 16 ) : 0 ) | ( ( V & 0xFF00FF00 ) !== 0 ? ( V &= 0xFF00FF00, 8 ) : 0 ) | ( ( V & 0xF0F0F0F0 ) !== 0 ? ( V &= 0xF0F0F0F0, 4 ) : 0 ) | ( ( V & 0xCCCCCCCC ) !== 0 ? ( V &= 0xCCCCCCCC, 2 ) : 0 ) | ( ( V & 0xAAAAAAAA ) !== 0 ) ); -} - - -function __fft(PF, pall, bits, offset, step) { - - const n = 1 << bits; - if (n==1) { - return [ pall[offset] ]; - } else if (n==2) { - return [ - PF.F.add(pall[offset], pall[offset + step]), - PF.F.sub(pall[offset], pall[offset + step])]; - } - - const ndiv2 = n >> 1; - const p1 = __fft(PF, pall, bits-1, offset, step*2); - const p2 = __fft(PF, pall, bits-1, offset+step, step*2); - - const out = new Array(n); - - for (let i=0; i> 1; - const p1 = __fft2(PF, pall.slice(0, ndiv2), bits-1); - const p2 = __fft2(PF, pall.slice(ndiv2), bits-1); - - const out = new Array(n); - - for (let i=0; i>=1; - } - return res; -} - -function rev(idx, bits) { - return ( - _revTable[idx >>> 24] | - (_revTable[(idx >>> 16) & 0xFF] << 8) | - (_revTable[(idx >>> 8) & 0xFF] << 16) | - (_revTable[idx & 0xFF] << 24) - ) >>> (32-bits); -} - -function __bitReverse(p, bits) { - for (let k=0; kk) { - const tmp= p[k]; - p[k] = p[r]; - p[r] = tmp; - } - } - -} - - - -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/futils.js -/* - Copyright 2018 0kims association. - - This file is part of snarkjs. - - snarkjs is a free software: you can redistribute it and/or - modify it under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your option) - any later version. - - snarkjs is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - snarkjs. If not, see . -*/ - - - - -function mulScalar(F, base, e) { - let res; - - if (Scalar.isZero(e)) return F.zero; - - const n = Scalar.naf(e); - - if (n[n.length-1] == 1) { - res = base; - } else if (n[n.length-1] == -1) { - res = F.neg(base); - } else { - throw new Error("invlaud NAF"); - } - - for (let i=n.length-2; i>=0; i--) { - - res = F.double(res); - - if (n[i] == 1) { - res = F.add(res, base); - } else if (n[i] == -1) { - res = F.sub(res, base); - } - } - - return res; -} - - -/* -exports.mulScalar = (F, base, e) =>{ - let res = F.zero; - let rem = bigInt(e); - let exp = base; - - while (! rem.eq(bigInt.zero)) { - if (rem.and(bigInt.one).eq(bigInt.one)) { - res = F.add(res, exp); - } - exp = F.double(exp); - rem = rem.shiftRight(1); - } - - return res; -}; -*/ - - -function futils_exp(F, base, e) { - - if (scalar_isZero(e)) return F.one; - - const n = scalar_bits(e); - - if (n.legth==0) return F.one; - - let res = base; - - for (let i=n.length-2; i>=0; i--) { - - res = F.square(res); - - if (n[i]) { - res = F.mul(res, base); - } - } - - return res; -} - - - -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/fsqrt.js - -// Check here: https://eprint.iacr.org/2012/685.pdf - -function fsqrt_buildSqrt (F) { - if ((F.m % 2) == 1) { - if (scalar_eq(scalar_mod(F.p, 4), 1 )) { - if (scalar_eq(scalar_mod(F.p, 8), 1 )) { - if (scalar_eq(scalar_mod(F.p, 16), 1 )) { - // alg7_muller(F); - alg5_tonelliShanks(F); - } else if (scalar_eq(scalar_mod(F.p, 16), 9 )) { - alg4_kong(F); - } else { - throw new Error("Field withot sqrt"); - } - } else if (scalar_eq(scalar_mod(F.p, 8), 5 )) { - alg3_atkin(F); - } else { - throw new Error("Field withot sqrt"); - } - } else if (scalar_eq(scalar_mod(F.p, 4), 3 )) { - alg2_shanks(F); - } - } else { - const pm2mod4 = scalar_mod(scalar_pow(F.p, F.m/2), 4); - if (pm2mod4 == 1) { - alg10_adj(F); - } else if (pm2mod4 == 3) { - alg9_adj(F); - } else { - alg8_complex(F); - } - - } -} - - -function alg5_tonelliShanks(F) { - F.sqrt_q = scalar_pow(F.p, F.m); - - F.sqrt_s = 0; - F.sqrt_t = scalar_sub(F.sqrt_q, 1); - - while (!scalar_isOdd(F.sqrt_t)) { - F.sqrt_s = F.sqrt_s + 1; - F.sqrt_t = scalar_div(F.sqrt_t, 2); - } - - let c0 = F.one; - - while (F.eq(c0, F.one)) { - const c = F.random(); - F.sqrt_z = F.pow(c, F.sqrt_t); - c0 = F.pow(F.sqrt_z, 2 ** (F.sqrt_s-1) ); - } - - F.sqrt_tm1d2 = scalar_div(scalar_sub(F.sqrt_t, 1),2); - - F.sqrt = function(a) { - const F=this; - if (F.isZero(a)) return F.zero; - let w = F.pow(a, F.sqrt_tm1d2); - const a0 = F.pow( F.mul(F.square(w), a), 2 ** (F.sqrt_s-1) ); - if (F.eq(a0, F.negone)) return null; - - let v = F.sqrt_s; - let x = F.mul(a, w); - let b = F.mul(x, w); - let z = F.sqrt_z; - while (!F.eq(b, F.one)) { - let b2k = F.square(b); - let k=1; - while (!F.eq(b2k, F.one)) { - b2k = F.square(b2k); - k++; - } - - w = z; - for (let i=0; i>> 0; - st[d] = (st[d] ^ st[a]) >>> 0; - st[d] = ((st[d] << 16) | ((st[d]>>>16) & 0xFFFF)) >>> 0; - - st[c] = (st[c] + st[d]) >>> 0; - st[b] = (st[b] ^ st[c]) >>> 0; - st[b] = ((st[b] << 12) | ((st[b]>>>20) & 0xFFF)) >>> 0; - - st[a] = (st[a] + st[b]) >>> 0; - st[d] = (st[d] ^ st[a]) >>> 0; - st[d] = ((st[d] << 8) | ((st[d]>>>24) & 0xFF)) >>> 0; - - st[c] = (st[c] + st[d]) >>> 0; - st[b] = (st[b] ^ st[c]) >>> 0; - st[b] = ((st[b] << 7) | ((st[b]>>>25) & 0x7F)) >>> 0; -} - -function doubleRound(st) { - quarterRound(st, 0, 4, 8,12); - quarterRound(st, 1, 5, 9,13); - quarterRound(st, 2, 6,10,14); - quarterRound(st, 3, 7,11,15); - - quarterRound(st, 0, 5,10,15); - quarterRound(st, 1, 6,11,12); - quarterRound(st, 2, 7, 8,13); - quarterRound(st, 3, 4, 9,14); -} - -class ChaCha { - - constructor(seed) { - seed = seed || [0,0,0,0,0,0,0,0]; - this.state = [ - 0x61707865, - 0x3320646E, - 0x79622D32, - 0x6B206574, - seed[0], - seed[1], - seed[2], - seed[3], - seed[4], - seed[5], - seed[6], - seed[7], - 0, - 0, - 0, - 0 - ]; - this.idx = 16; - this.buff = new Array(16); - } - - nextU32() { - if (this.idx == 16) this.update(); - return this.buff[this.idx++]; - } - - nextU64() { - return scalar_add(scalar_mul(this.nextU32(), 0x100000000), this.nextU32()); - } - - nextBool() { - return (this.nextU32() & 1) == 1; - } - - update() { - // Copy the state - for (let i=0; i<16; i++) this.buff[i] = this.state[i]; - - // Apply the rounds - for (let i=0; i<10; i++) doubleRound(this.buff); - - // Add to the initial - for (let i=0; i<16; i++) this.buff[i] = (this.buff[i] + this.state[i]) >>> 0; - - this.idx = 0; - - this.state[12] = (this.state[12] + 1) >>> 0; - if (this.state[12] != 0) return; - this.state[13] = (this.state[13] + 1) >>> 0; - if (this.state[13] != 0) return; - this.state[14] = (this.state[14] + 1) >>> 0; - if (this.state[14] != 0) return; - this.state[15] = (this.state[15] + 1) >>> 0; - } -} - -// EXTERNAL MODULE: ./node_modules/crypto-browserify/index.js -var crypto_browserify = __webpack_require__(1565); -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/random.js -/* provided dependency */ var process = __webpack_require__(5606); - - - -function getRandomBytes(n) { - let array = new Uint8Array(n); - if (process.browser) { // Browser - if (typeof globalThis.crypto !== "undefined") { // Supported - globalThis.crypto.getRandomValues(array); - } else { // fallback - for (let i=0; i>>0; - } - } - } - else { // NodeJS - crypto_browserify.randomFillSync(array); - } - return array; -} - -function getRandomSeed() { - const arr = getRandomBytes(32); - const arrV = new Uint32Array(arr.buffer); - const seed = []; - for (let i=0; i<8; i++) { - seed.push(arrV[i]); - } - return seed; -} - -let threadRng = null; - -function getThreadRng() { - if (threadRng) return threadRng; - threadRng = new ChaCha(getRandomSeed()); - return threadRng; -} - -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/f1field_native.js -/* global BigInt */ - - - - - -class ZqField { - constructor(p) { - this.type="F1"; - this.one = BigInt(1); - this.zero = BigInt(0); - this.p = BigInt(p); - this.m = 1; - this.negone = this.p-this.one; - this.two = BigInt(2); - this.half = this.p >> this.one; - this.bitLength = scalar_bitLength(this.p); - this.mask = (this.one << BigInt(this.bitLength)) - this.one; - - this.n64 = Math.floor((this.bitLength - 1) / 64)+1; - this.n32 = this.n64*2; - this.n8 = this.n64*8; - this.R = this.e(this.one << BigInt(this.n64*64)); - this.Ri = this.inv(this.R); - - const e = this.negone >> this.one; - this.nqr = this.two; - let r = this.pow(this.nqr, e); - while (!this.eq(r, this.negone)) { - this.nqr = this.nqr + this.one; - r = this.pow(this.nqr, e); - } - - - this.s = 0; - this.t = this.negone; - - while ((this.t & this.one) == this.zero) { - this.s = this.s + 1; - this.t = this.t >> this.one; - } - - this.nqr_to_t = this.pow(this.nqr, this.t); - - fsqrt_buildSqrt(this); - } - - e(a,b) { - let res; - if (!b) { - res = BigInt(a); - } else if (b==16) { - res = BigInt("0x"+a); - } - if (res < 0) { - let nres = -res; - if (nres >= this.p) nres = nres % this.p; - return this.p - nres; - } else { - return (res>= this.p) ? res%this.p : res; - } - - } - - add(a, b) { - const res = a + b; - return res >= this.p ? res-this.p : res; - } - - sub(a, b) { - return (a >= b) ? a-b : this.p-b+a; - } - - neg(a) { - return a ? this.p-a : a; - } - - mul(a, b) { - return (a*b)%this.p; - } - - mulScalar(base, s) { - return (base * this.e(s)) % this.p; - } - - square(a) { - return (a*a) % this.p; - } - - eq(a, b) { - return a==b; - } - - neq(a, b) { - return a!=b; - } - - lt(a, b) { - const aa = (a > this.half) ? a - this.p : a; - const bb = (b > this.half) ? b - this.p : b; - return aa < bb; - } - - gt(a, b) { - const aa = (a > this.half) ? a - this.p : a; - const bb = (b > this.half) ? b - this.p : b; - return aa > bb; - } - - leq(a, b) { - const aa = (a > this.half) ? a - this.p : a; - const bb = (b > this.half) ? b - this.p : b; - return aa <= bb; - } - - geq(a, b) { - const aa = (a > this.half) ? a - this.p : a; - const bb = (b > this.half) ? b - this.p : b; - return aa >= bb; - } - - div(a, b) { - return this.mul(a, this.inv(b)); - } - - idiv(a, b) { - if (!b) throw new Error("Division by zero"); - return a / b; - } - - inv(a) { - if (!a) throw new Error("Division by zero"); - - let t = this.zero; - let r = this.p; - let newt = this.one; - let newr = a % this.p; - while (newr) { - let q = r/newr; - [t, newt] = [newt, t-q*newt]; - [r, newr] = [newr, r-q*newr]; - } - if (t= this.p ? res-this.p : res; - } - - bor(a, b) { - const res = ((a | b) & this.mask); - return res >= this.p ? res-this.p : res; - } - - bxor(a, b) { - const res = ((a ^ b) & this.mask); - return res >= this.p ? res-this.p : res; - } - - bnot(a) { - const res = a ^ this.mask; - return res >= this.p ? res-this.p : res; - } - - shl(a, b) { - if (Number(b) < this.bitLength) { - const res = (a << b) & this.mask; - return res >= this.p ? res-this.p : res; - } else { - const nb = this.p - b; - if (Number(nb) < this.bitLength) { - return a >> nb; - } else { - return this.zero; - } - } - } - - shr(a, b) { - if (Number(b) < this.bitLength) { - return a >> b; - } else { - const nb = this.p - b; - if (Number(nb) < this.bitLength) { - const res = (a << nb) & this.mask; - return res >= this.p ? res-this.p : res; - } else { - return 0; - } - } - } - - land(a, b) { - return (a && b) ? this.one : this.zero; - } - - lor(a, b) { - return (a || b) ? this.one : this.zero; - } - - lnot(a) { - return (a) ? this.zero : this.one; - } - - sqrt_old(n) { - - if (n == this.zero) return this.zero; - - // Test that have solution - const res = this.pow(n, this.negone >> this.one); - if ( res != this.one ) return null; - - let m = this.s; - let c = this.nqr_to_t; - let t = this.pow(n, this.t); - let r = this.pow(n, this.add(this.t, this.one) >> this.one ); - - while ( t != this.one ) { - let sq = this.square(t); - let i = 1; - while (sq != this.one ) { - i++; - sq = this.square(sq); - } - - // b = c ^ m-i-1 - let b = c; - for (let j=0; j< m-i-1; j ++) b = this.square(b); - - m = i; - c = this.square(b); - t = this.mul(t, c); - r = this.mul(r, b); - } - - if (r > (this.p >> this.one)) { - r = this.neg(r); - } - - return r; - } - - normalize(a, b) { - a = BigInt(a,b); - if (a < 0) { - let na = -a; - if (na >= this.p) na = na % this.p; - return this.p - na; - } else { - return (a>= this.p) ? a%this.p : a; - } - } - - random() { - const nBytes = (this.bitLength*2 / 8); - let res =this.zero; - for (let i=0; i this.half) { - const v = this.p-a; - vs = "-"+v.toString(base); - } else { - vs = a.toString(base); - } - return vs; - } - - isZero(a) { - return a == this.zero; - } - - fromRng(rng) { - let v; - do { - v=this.zero; - for (let i=0; i= this.p); - v = (v * this.Ri) % this.p; // Convert from montgomery - return v; - } - -} - - -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/f1field_bigint.js - - - - -class f1field_bigint_ZqField { - constructor(p) { - this.type="F1"; - this.one = BigInteger.one; - this.zero = BigInteger.zero; - this.p = BigInteger(p); - this.m = 1; - this.negone = this.p.minus(BigInteger.one); - this.two = BigInteger(2); - this.half = this.p.shiftRight(1); - this.bitLength = this.p.bitLength(); - this.mask = BigInteger.one.shiftLeft(this.bitLength).minus(BigInteger.one); - - this.n64 = Math.floor((this.bitLength - 1) / 64)+1; - this.n32 = this.n64*2; - this.n8 = this.n64*8; - this.R = BigInteger.one.shiftLeft(this.n64*64); - this.Ri = this.inv(this.R); - - const e = this.negone.shiftRight(this.one); - this.nqr = this.two; - let r = this.pow(this.nqr, e); - while (!r.equals(this.negone)) { - this.nqr = this.nqr.add(this.one); - r = this.pow(this.nqr, e); - } - - this.s = this.zero; - this.t = this.negone; - - while (!this.t.isOdd()) { - this.s = this.s.add(this.one); - this.t = this.t.shiftRight(this.one); - } - - this.nqr_to_t = this.pow(this.nqr, this.t); - - fsqrt_buildSqrt(this); - } - - e(a,b) { - - const res = BigInteger(a,b); - - return this.normalize(res); - - } - - add(a, b) { - let res = a.add(b); - if (res.geq(this.p)) { - res = res.minus(this.p); - } - return res; - } - - sub(a, b) { - if (a.geq(b)) { - return a.minus(b); - } else { - return this.p.minus(b.minus(a)); - } - } - - neg(a) { - if (a.isZero()) return a; - return this.p.minus(a); - } - - mul(a, b) { - return a.times(b).mod(this.p); - } - - mulScalar(base, s) { - return base.times(BigInteger(s)).mod(this.p); - } - - square(a) { - return a.square().mod(this.p); - } - - eq(a, b) { - return a.eq(b); - } - - neq(a, b) { - return a.neq(b); - } - - lt(a, b) { - const aa = a.gt(this.half) ? a.minus(this.p) : a; - const bb = b.gt(this.half) ? b.minus(this.p) : b; - return aa.lt(bb); - } - - gt(a, b) { - const aa = a.gt(this.half) ? a.minus(this.p) : a; - const bb = b.gt(this.half) ? b.minus(this.p) : b; - return aa.gt(bb); - } - - leq(a, b) { - const aa = a.gt(this.half) ? a.minus(this.p) : a; - const bb = b.gt(this.half) ? b.minus(this.p) : b; - return aa.leq(bb); - } - - geq(a, b) { - const aa = a.gt(this.half) ? a.minus(this.p) : a; - const bb = b.gt(this.half) ? b.minus(this.p) : b; - return aa.geq(bb); - } - - div(a, b) { - if (b.isZero()) throw new Error("Division by zero"); - return a.times(b.modInv(this.p)).mod(this.p); - } - - idiv(a, b) { - if (b.isZero()) throw new Error("Division by zero"); - return a.divide(b); - } - - inv(a) { - if (a.isZero()) throw new Error("Division by zero"); - return a.modInv(this.p); - } - - mod(a, b) { - return a.mod(b); - } - - pow(a, b) { - return a.modPow(b, this.p); - } - - exp(a, b) { - return a.modPow(b, this.p); - } - - band(a, b) { - return a.and(b).and(this.mask).mod(this.p); - } - - bor(a, b) { - return a.or(b).and(this.mask).mod(this.p); - } - - bxor(a, b) { - return a.xor(b).and(this.mask).mod(this.p); - } - - bnot(a) { - return a.xor(this.mask).mod(this.p); - } - - shl(a, b) { - if (b.lt(this.bitLength)) { - return a.shiftLeft(b).and(this.mask).mod(this.p); - } else { - const nb = this.p.minus(b); - if (nb.lt(this.bitLength)) { - return this.shr(a, nb); - } else { - return BigInteger.zero; - } - } - } - - shr(a, b) { - if (b.lt(this.bitLength)) { - return a.shiftRight(b); - } else { - const nb = this.p.minus(b); - if (nb.lt(this.bitLength)) { - return this.shl(a, nb); - } else { - return BigInteger.zero; - } - } - } - - land(a, b) { - return (a.isZero() || b.isZero()) ? BigInteger.zero : BigInteger.one; - } - - lor(a, b) { - return (a.isZero() && b.isZero()) ? BigInteger.zero : BigInteger.one; - } - - lnot(a) { - return a.isZero() ? BigInteger.one : BigInteger.zero; - } - - sqrt_old(n) { - - if (n.equals(this.zero)) return this.zero; - - // Test that have solution - const res = this.pow(n, this.negone.shiftRight(this.one)); - if (!res.equals(this.one)) return null; - - let m = parseInt(this.s); - let c = this.nqr_to_t; - let t = this.pow(n, this.t); - let r = this.pow(n, this.add(this.t, this.one).shiftRight(this.one) ); - - while (!t.equals(this.one)) { - let sq = this.square(t); - let i = 1; - while (!sq.equals(this.one)) { - i++; - sq = this.square(sq); - } - - // b = c ^ m-i-1 - let b = c; - for (let j=0; j< m-i-1; j ++) b = this.square(b); - - m = i; - c = this.square(b); - t = this.mul(t, c); - r = this.mul(r, b); - } - - if (r.greater(this.p.shiftRight(this.one))) { - r = this.neg(r); - } - - return r; - } - - normalize(a) { - a = BigInteger(a); - if (a.isNegative()) { - return this.p.minus(a.abs().mod(this.p)); - } else { - return a.mod(this.p); - } - } - - random() { - let res = BigInteger(0); - let n = BigInteger(this.p.square()); - while (!n.isZero()) { - res = res.shiftLeft(8).add(BigInteger(getRandomBytes(1)[0])); - n = n.shiftRight(8); - } - return res.mod(this.p); - } - - toString(a, base) { - let vs; - if (!a.lesserOrEquals(this.p.shiftRight(BigInteger(1)))) { - const v = this.p.minus(a); - vs = "-"+v.toString(base); - } else { - vs = a.toString(base); - } - - return vs; - } - - isZero(a) { - return a.isZero(); - } - - fromRng(rng) { - let v; - do { - v = BigInteger(0); - for (let i=0; i. -*/ - - - - -class F2Field { - constructor(F, nonResidue) { - this.type="F2"; - this.F = F; - this.zero = [this.F.zero, this.F.zero]; - this.one = [this.F.one, this.F.zero]; - this.negone = this.neg(this.one); - this.nonResidue = nonResidue; - this.m = F.m*2; - this.p = F.p; - this.n64 = F.n64*2; - this.n32 = this.n64*2; - this.n8 = this.n64*8; - - buildSqrt(this); - } - - _mulByNonResidue(a) { - return this.F.mul(this.nonResidue, a); - } - - copy(a) { - return [this.F.copy(a[0]), this.F.copy(a[1])]; - } - - add(a, b) { - return [ - this.F.add(a[0], b[0]), - this.F.add(a[1], b[1]) - ]; - } - - double(a) { - return this.add(a,a); - } - - sub(a, b) { - return [ - this.F.sub(a[0], b[0]), - this.F.sub(a[1], b[1]) - ]; - } - - neg(a) { - return this.sub(this.zero, a); - } - - conjugate(a) { - return [ - a[0], - this.F.neg(a[1]) - ]; - } - - mul(a, b) { - const aA = this.F.mul(a[0] , b[0]); - const bB = this.F.mul(a[1] , b[1]); - - return [ - this.F.add( aA , this._mulByNonResidue(bB)), - this.F.sub( - this.F.mul( - this.F.add(a[0], a[1]), - this.F.add(b[0], b[1])), - this.F.add(aA, bB))]; - } - - inv(a) { - const t0 = this.F.square(a[0]); - const t1 = this.F.square(a[1]); - const t2 = this.F.sub(t0, this._mulByNonResidue(t1)); - const t3 = this.F.inv(t2); - return [ - this.F.mul(a[0], t3), - this.F.neg(this.F.mul( a[1], t3)) ]; - } - - div(a, b) { - return this.mul(a, this.inv(b)); - } - - square(a) { - const ab = this.F.mul(a[0] , a[1]); - - /* - [ - (a + b) * (a + non_residue * b) - ab - non_residue * ab, - ab + ab - ]; - */ - - return [ - this.F.sub( - this.F.mul( - this.F.add(a[0], a[1]) , - this.F.add( - a[0] , - this._mulByNonResidue(a[1]))), - this.F.add( - ab, - this._mulByNonResidue(ab))), - this.F.add(ab, ab) - ]; - } - - isZero(a) { - return this.F.isZero(a[0]) && this.F.isZero(a[1]); - } - - eq(a, b) { - return this.F.eq(a[0], b[0]) && this.F.eq(a[1], b[1]); - } - - mulScalar(base, e) { - return fUtils.mulScalar(this, base, e); - } - - pow(base, e) { - return fUtils.exp(this, base, e); - } - - exp(base, e) { - return fUtils.exp(this, base, e); - } - - toString(a) { - return `[ ${this.F.toString(a[0])} , ${this.F.toString(a[1])} ]`; - } - - fromRng(rng) { - const c0 = this.F.fromRng(rng); - const c1 = this.F.fromRng(rng); - return [c0, c1]; - } - - gt(a, b) { - if (this.F.gt(a[0], b[0])) return true; - if (this.F.gt(b[0], a[0])) return false; - if (this.F.gt(a[1], b[1])) return true; - return false; - } - - geq(a, b) { - return this.gt(a, b) || this.eq(a, b); - } - - lt(a, b) { - return !this.geq(a,b); - } - - leq(a, b) { - return !this.gt(a,b); - } - - neq(a, b) { - return !this.eq(a,b); - } - - random() { - return [this.F.random(), this.F.random()]; - } - - - toRprLE(buff, o, e) { - this.F.toRprLE(buff, o, e[0]); - this.F.toRprLE(buff, o+this.F.n8, e[1]); - } - - toRprBE(buff, o, e) { - this.F.toRprBE(buff, o, e[1]); - this.F.toRprBE(buff, o+this.F.n8, e[0]); - } - - toRprLEM(buff, o, e) { - this.F.toRprLEM(buff, o, e[0]); - this.F.toRprLEM(buff, o+this.F.n8, e[1]); - } - - - toRprBEM(buff, o, e) { - this.F.toRprBEM(buff, o, e[1]); - this.F.toRprBEM(buff, o+this.F.n8, e[0]); - } - - fromRprLE(buff, o) { - o = o || 0; - const c0 = this.F.fromRprLE(buff, o); - const c1 = this.F.fromRprLE(buff, o+this.F.n8); - return [c0, c1]; - } - - fromRprBE(buff, o) { - o = o || 0; - const c1 = this.F.fromRprBE(buff, o); - const c0 = this.F.fromRprBE(buff, o+this.F.n8); - return [c0, c1]; - } - - fromRprLEM(buff, o) { - o = o || 0; - const c0 = this.F.fromRprLEM(buff, o); - const c1 = this.F.fromRprLEM(buff, o+this.F.n8); - return [c0, c1]; - } - - fromRprBEM(buff, o) { - o = o || 0; - const c1 = this.F.fromRprBEM(buff, o); - const c0 = this.F.fromRprBEM(buff, o+this.F.n8); - return [c0, c1]; - } - -} - - -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/f3field.js -/* - Copyright 2018 0kims association. - - This file is part of snarkjs. - - snarkjs is a free software: you can redistribute it and/or - modify it under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your option) - any later version. - - snarkjs is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - snarkjs. If not, see . -*/ - - - -class F3Field { - constructor(F, nonResidue) { - this.type="F3"; - this.F = F; - this.zero = [this.F.zero, this.F.zero, this.F.zero]; - this.one = [this.F.one, this.F.zero, this.F.zero]; - this.negone = this.neg(this.one); - this.nonResidue = nonResidue; - this.m = F.m*3; - this.p = F.p; - this.n64 = F.n64*3; - this.n32 = this.n64*2; - this.n8 = this.n64*8; - } - - _mulByNonResidue(a) { - return this.F.mul(this.nonResidue, a); - } - - copy(a) { - return [this.F.copy(a[0]), this.F.copy(a[1]), this.F.copy(a[2])]; - } - - add(a, b) { - return [ - this.F.add(a[0], b[0]), - this.F.add(a[1], b[1]), - this.F.add(a[2], b[2]) - ]; - } - - double(a) { - return this.add(a,a); - } - - sub(a, b) { - return [ - this.F.sub(a[0], b[0]), - this.F.sub(a[1], b[1]), - this.F.sub(a[2], b[2]) - ]; - } - - neg(a) { - return this.sub(this.zero, a); - } - - mul(a, b) { - - const aA = this.F.mul(a[0] , b[0]); - const bB = this.F.mul(a[1] , b[1]); - const cC = this.F.mul(a[2] , b[2]); - - return [ - this.F.add( - aA, - this._mulByNonResidue( - this.F.sub( - this.F.mul( - this.F.add(a[1], a[2]), - this.F.add(b[1], b[2])), - this.F.add(bB, cC)))), // aA + non_residue*((b+c)*(B+C)-bB-cC), - - this.F.add( - this.F.sub( - this.F.mul( - this.F.add(a[0], a[1]), - this.F.add(b[0], b[1])), - this.F.add(aA, bB)), - this._mulByNonResidue( cC)), // (a+b)*(A+B)-aA-bB+non_residue*cC - - this.F.add( - this.F.sub( - this.F.mul( - this.F.add(a[0], a[2]), - this.F.add(b[0], b[2])), - this.F.add(aA, cC)), - bB)]; // (a+c)*(A+C)-aA+bB-cC) - } - - inv(a) { - const t0 = this.F.square(a[0]); // t0 = a^2 ; - const t1 = this.F.square(a[1]); // t1 = b^2 ; - const t2 = this.F.square(a[2]); // t2 = c^2; - const t3 = this.F.mul(a[0],a[1]); // t3 = ab - const t4 = this.F.mul(a[0],a[2]); // t4 = ac - const t5 = this.F.mul(a[1],a[2]); // t5 = bc; - // c0 = t0 - non_residue * t5; - const c0 = this.F.sub(t0, this._mulByNonResidue(t5)); - // c1 = non_residue * t2 - t3; - const c1 = this.F.sub(this._mulByNonResidue(t2), t3); - const c2 = this.F.sub(t1, t4); // c2 = t1-t4 - - // t6 = (a * c0 + non_residue * (c * c1 + b * c2)).inv(); - const t6 = - this.F.inv( - this.F.add( - this.F.mul(a[0], c0), - this._mulByNonResidue( - this.F.add( - this.F.mul(a[2], c1), - this.F.mul(a[1], c2))))); - - return [ - this.F.mul(t6, c0), // t6*c0 - this.F.mul(t6, c1), // t6*c1 - this.F.mul(t6, c2)]; // t6*c2 - } - - div(a, b) { - return this.mul(a, this.inv(b)); - } - - square(a) { - const s0 = this.F.square(a[0]); // s0 = a^2 - const ab = this.F.mul(a[0], a[1]); // ab = a*b - const s1 = this.F.add(ab, ab); // s1 = 2ab; - const s2 = this.F.square( - this.F.add(this.F.sub(a[0],a[1]), a[2])); // s2 = (a - b + c)^2; - const bc = this.F.mul(a[1],a[2]); // bc = b*c - const s3 = this.F.add(bc, bc); // s3 = 2*bc - const s4 = this.F.square(a[2]); // s4 = c^2 - - - return [ - this.F.add( - s0, - this._mulByNonResidue(s3)), // s0 + non_residue * s3, - this.F.add( - s1, - this._mulByNonResidue(s4)), // s1 + non_residue * s4, - this.F.sub( - this.F.add( this.F.add(s1, s2) , s3 ), - this.F.add(s0, s4))]; // s1 + s2 + s3 - s0 - s4 - } - - isZero(a) { - return this.F.isZero(a[0]) && this.F.isZero(a[1]) && this.F.isZero(a[2]); - } - - eq(a, b) { - return this.F.eq(a[0], b[0]) && this.F.eq(a[1], b[1]) && this.F.eq(a[2], b[2]); - } - - affine(a) { - return [this.F.affine(a[0]), this.F.affine(a[1]), this.F.affine(a[2])]; - } - - mulScalar(base, e) { - return fUtils.mulScalar(this, base, e); - } - - pow(base, e) { - return fUtils.exp(this, base, e); - } - - exp(base, e) { - return fUtils.exp(this, base, e); - } - - toString(a) { - return `[ ${this.F.toString(a[0])} , ${this.F.toString(a[1])}, ${this.F.toString(a[2])} ]`; - } - - fromRng(rng) { - const c0 = this.F.fromRng(rng); - const c1 = this.F.fromRng(rng); - const c2 = this.F.fromRng(rng); - return [c0, c1, c2]; - } - - gt(a, b) { - if (this.F.gt(a[0], b[0])) return true; - if (this.F.gt(b[0], a[0])) return false; - if (this.F.gt(a[1], b[1])) return true; - if (this.F.gt(b[1], a[1])) return false; - if (this.F.gt(a[2], b[2])) return true; - return false; - } - - - geq(a, b) { - return this.gt(a, b) || this.eq(a, b); - } - - lt(a, b) { - return !this.geq(a,b); - } - - leq(a, b) { - return !this.gt(a,b); - } - - neq(a, b) { - return !this.eq(a,b); - } - - random() { - return [this.F.random(), this.F.random(), this.F.random()]; - } - - - toRprLE(buff, o, e) { - this.F.toRprLE(buff, o, e[0]); - this.F.toRprLE(buff, o+this.F.n8, e[1]); - this.F.toRprLE(buff, o+this.F.n8*2, e[2]); - } - - toRprBE(buff, o, e) { - this.F.toRprBE(buff, o, e[2]); - this.F.toRprBE(buff, o+this.F.n8, e[1]); - this.F.toRprBE(buff, o+this.F.n8*2, e[0]); - } - - toRprLEM(buff, o, e) { - this.F.toRprLEM(buff, o, e[0]); - this.F.toRprLEM(buff, o+this.F.n8, e[1]); - this.F.toRprLEM(buff, o+this.F.n8*2, e[2]); - } - - - toRprBEM(buff, o, e) { - this.F.toRprBEM(buff, o, e[2]); - this.F.toRprBEM(buff, o+this.F.n8, e[1]); - this.F.toRprBEM(buff, o+this.F.n8*2, e[0]); - } - - fromRprLE(buff, o) { - o = o || 0; - const c0 = this.F.fromRprLE(buff, o); - const c1 = this.F.fromRprLE(buff, o+this.n8); - const c2 = this.F.fromRprLE(buff, o+this.n8*2); - return [c0, c1, c2]; - } - - fromRprBE(buff, o) { - o = o || 0; - const c2 = this.F.fromRprBE(buff, o); - const c1 = this.F.fromRprBE(buff, o+this.n8); - const c0 = this.F.fromRprBE(buff, o+this.n8*2); - return [c0, c1, c2]; - } - - fromRprLEM(buff, o) { - o = o || 0; - const c0 = this.F.fromRprLEM(buff, o); - const c1 = this.F.fromRprLEM(buff, o+this.n8); - const c2 = this.F.fromRprLEM(buff, o+this.n8*2); - return [c0, c1, c2]; - } - - fromRprBEM(buff, o) { - o = o || 0; - const c2 = this.F.fromRprBEM(buff, o); - const c1 = this.F.fromRprBEM(buff, o+this.n8); - const c0 = this.F.fromRprBEM(buff, o+this.n8*2); - return [c0, c1, c2]; - } - -} - -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/ec.js -/* - Copyright 2018 0kims association. - - This file is part of snarkjs. - - snarkjs is a free software: you can redistribute it and/or - modify it under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your option) - any later version. - - snarkjs is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - snarkjs. If not, see . -*/ - - - - - - - -function isGreatest(F, a) { - if (Array.isArray(a)) { - for (let i=a.length-1; i>=0; i--) { - if (!F.F.isZero(a[i])) { - return isGreatest(F.F, a[i]); - } - } - return 0; - } else { - const na = F.neg(a); - return Scalar.gt(a, na); - } -} - - -class EC { - - constructor(F, g) { - this.F = F; - this.g = g; - if (this.g.length == 2) this.g[2] = this.F.one; - this.zero = [this.F.zero, this.F.one, this.F.zero]; - } - - add(p1, p2) { - - const F = this.F; - - if (this.eq(p1, this.zero)) return p2; - if (this.eq(p2, this.zero)) return p1; - - const res = new Array(3); - - const Z1Z1 = F.square( p1[2] ); - const Z2Z2 = F.square( p2[2] ); - - const U1 = F.mul( p1[0] , Z2Z2 ); // U1 = X1 * Z2Z2 - const U2 = F.mul( p2[0] , Z1Z1 ); // U2 = X2 * Z1Z1 - - const Z1_cubed = F.mul( p1[2] , Z1Z1); - const Z2_cubed = F.mul( p2[2] , Z2Z2); - - const S1 = F.mul( p1[1] , Z2_cubed); // S1 = Y1 * Z2 * Z2Z2 - const S2 = F.mul( p2[1] , Z1_cubed); // S2 = Y2 * Z1 * Z1Z1 - - if (F.eq(U1,U2) && F.eq(S1,S2)) { - return this.double(p1); - } - - const H = F.sub( U2 , U1 ); // H = U2-U1 - - const S2_minus_S1 = F.sub( S2 , S1 ); - - const I = F.square( F.add(H,H) ); // I = (2 * H)^2 - const J = F.mul( H , I ); // J = H * I - - const r = F.add( S2_minus_S1 , S2_minus_S1 ); // r = 2 * (S2-S1) - const V = F.mul( U1 , I ); // V = U1 * I - - res[0] = - F.sub( - F.sub( F.square(r) , J ), - F.add( V , V )); // X3 = r^2 - J - 2 * V - - const S1_J = F.mul( S1 , J ); - - res[1] = - F.sub( - F.mul( r , F.sub(V,res[0])), - F.add( S1_J,S1_J )); // Y3 = r * (V-X3)-2 S1 J - - res[2] = - F.mul( - H, - F.sub( - F.square( F.add(p1[2],p2[2]) ), - F.add( Z1Z1 , Z2Z2 ))); // Z3 = ((Z1+Z2)^2-Z1Z1-Z2Z2) * H - - return res; - } - - neg(p) { - return [p[0], this.F.neg(p[1]), p[2]]; - } - - sub(a, b) { - return this.add(a, this.neg(b)); - } - - double(p) { - const F = this.F; - - const res = new Array(3); - - if (this.eq(p, this.zero)) return p; - - const A = F.square( p[0] ); // A = X1^2 - const B = F.square( p[1] ); // B = Y1^2 - const C = F.square( B ); // C = B^2 - - let D = - F.sub( - F.square( F.add(p[0] , B )), - F.add( A , C)); - D = F.add(D,D); // D = 2 * ((X1 + B)^2 - A - C) - - const E = F.add( F.add(A,A), A); // E = 3 * A - const FF =F.square( E ); // F = E^2 - - res[0] = F.sub( FF , F.add(D,D) ); // X3 = F - 2 D - - let eightC = F.add( C , C ); - eightC = F.add( eightC , eightC ); - eightC = F.add( eightC , eightC ); - - res[1] = - F.sub( - F.mul( - E, - F.sub( D, res[0] )), - eightC); // Y3 = E * (D - X3) - 8 * C - - const Y1Z1 = F.mul( p[1] , p[2] ); - res[2] = F.add( Y1Z1 , Y1Z1 ); // Z3 = 2 * Y1 * Z1 - - return res; - } - - timesScalar(base, e) { - return fUtils.mulScalar(this, base, e); - } - - mulScalar(base, e) { - return fUtils.mulScalar(this, base, e); - } - - affine(p) { - const F = this.F; - if (this.isZero(p)) { - return this.zero; - } else if (F.eq(p[2], F.one)) { - return p; - } else { - const Z_inv = F.inv(p[2]); - const Z2_inv = F.square(Z_inv); - const Z3_inv = F.mul(Z2_inv, Z_inv); - - const res = new Array(3); - res[0] = F.mul(p[0],Z2_inv); - res[1] = F.mul(p[1],Z3_inv); - res[2] = F.one; - - return res; - } - } - - multiAffine(arr) { - const keys = Object.keys(arr); - const F = this.F; - const accMul = new Array(keys.length+1); - accMul[0] = F.one; - for (let i = 0; i< keys.length; i++) { - if (F.eq(arr[keys[i]][2], F.zero)) { - accMul[i+1] = accMul[i]; - } else { - accMul[i+1] = F.mul(accMul[i], arr[keys[i]][2]); - } - } - - accMul[keys.length] = F.inv(accMul[keys.length]); - - for (let i = keys.length-1; i>=0; i--) { - if (F.eq(arr[keys[i]][2], F.zero)) { - accMul[i] = accMul[i+1]; - arr[keys[i]] = this.zero; - } else { - const Z_inv = F.mul(accMul[i], accMul[i+1]); - accMul[i] = F.mul(arr[keys[i]][2], accMul[i+1]); - - const Z2_inv = F.square(Z_inv); - const Z3_inv = F.mul(Z2_inv, Z_inv); - - arr[keys[i]][0] = F.mul(arr[keys[i]][0],Z2_inv); - arr[keys[i]][1] = F.mul(arr[keys[i]][1],Z3_inv); - arr[keys[i]][2] = F.one; - } - } - - } - - eq(p1, p2) { - const F = this.F; - - if (this.F.eq(p1[2], this.F.zero)) return this.F.eq(p2[2], this.F.zero); - if (this.F.eq(p2[2], this.F.zero)) return false; - - const Z1Z1 = F.square( p1[2] ); - const Z2Z2 = F.square( p2[2] ); - - const U1 = F.mul( p1[0] , Z2Z2 ); - const U2 = F.mul( p2[0] , Z1Z1 ); - - const Z1_cubed = F.mul( p1[2] , Z1Z1); - const Z2_cubed = F.mul( p2[2] , Z2Z2); - - const S1 = F.mul( p1[1] , Z2_cubed); - const S2 = F.mul( p2[1] , Z1_cubed); - - return (F.eq(U1,U2) && F.eq(S1,S2)); - } - - isZero(p) { - return this.F.isZero(p[2]); - } - - toString(p) { - const cp = this.affine(p); - return `[ ${this.F.toString(cp[0])} , ${this.F.toString(cp[1])} ]`; - } - - fromRng(rng) { - const F = this.F; - let P = []; - let greatest; - do { - P[0] = F.fromRng(rng); - greatest = rng.nextBool(); - const x3b = F.add(F.mul(F.square(P[0]), P[0]), this.b); - P[1] = F.sqrt(x3b); - } while ((P[1] == null)||(F.isZero[P])); - - const s = isGreatest(F, P[1]); - if (greatest ^ s) P[1] = F.neg(P[1]); - P[2] = F.one; - - if (this.cofactor) { - P = this.mulScalar(P, this.cofactor); - } - - P = this.affine(P); - - return P; - - } - - toRprLE(buff, o, p) { - p = this.affine(p); - if (this.isZero(p)) { - const BuffV = new Uint8Array(buff, o, this.F.n8*2); - BuffV.fill(0); - return; - } - this.F.toRprLE(buff, o, p[0]); - this.F.toRprLE(buff, o+this.F.n8, p[1]); - } - - toRprBE(buff, o, p) { - p = this.affine(p); - if (this.isZero(p)) { - const BuffV = new Uint8Array(buff, o, this.F.n8*2); - BuffV.fill(0); - return; - } - this.F.toRprBE(buff, o, p[0]); - this.F.toRprBE(buff, o+this.F.n8, p[1]); - } - - toRprLEM(buff, o, p) { - p = this.affine(p); - if (this.isZero(p)) { - const BuffV = new Uint8Array(buff, o, this.F.n8*2); - BuffV.fill(0); - return; - } - this.F.toRprLEM(buff, o, p[0]); - this.F.toRprLEM(buff, o+this.F.n8, p[1]); - } - - toRprLEJM(buff, o, p) { - p = this.affine(p); - if (this.isZero(p)) { - const BuffV = new Uint8Array(buff, o, this.F.n8*2); - BuffV.fill(0); - return; - } - this.F.toRprLEM(buff, o, p[0]); - this.F.toRprLEM(buff, o+this.F.n8, p[1]); - this.F.toRprLEM(buff, o+2*this.F.n8, p[2]); - } - - - toRprBEM(buff, o, p) { - p = this.affine(p); - if (this.isZero(p)) { - const BuffV = new Uint8Array(buff, o, this.F.n8*2); - BuffV.fill(0); - return; - } - this.F.toRprBEM(buff, o, p[0]); - this.F.toRprBEM(buff, o+this.F.n8, p[1]); - } - - fromRprLE(buff, o) { - o = o || 0; - const x = this.F.fromRprLE(buff, o); - const y = this.F.fromRprLE(buff, o+this.F.n8); - if (this.F.isZero(x) && this.F.isZero(y)) { - return this.zero; - } - return [x, y, this.F.one]; - } - - fromRprBE(buff, o) { - o = o || 0; - const x = this.F.fromRprBE(buff, o); - const y = this.F.fromRprBE(buff, o+this.F.n8); - if (this.F.isZero(x) && this.F.isZero(y)) { - return this.zero; - } - return [x, y, this.F.one]; - } - - fromRprLEM(buff, o) { - o = o || 0; - const x = this.F.fromRprLEM(buff, o); - const y = this.F.fromRprLEM(buff, o+this.F.n8); - if (this.F.isZero(x) && this.F.isZero(y)) { - return this.zero; - } - return [x, y, this.F.one]; - } - - fromRprLEJM(buff, o) { - o = o || 0; - const x = this.F.fromRprLEM(buff, o); - const y = this.F.fromRprLEM(buff, o+this.F.n8); - const z = this.F.fromRprLEM(buff, o+this.F.n8*2); - if (this.F.isZero(x) && this.F.isZero(y)) { - return this.zero; - } - return [x, y, z]; - } - - fromRprBEM(buff, o) { - o = o || 0; - const x = this.F.fromRprBEM(buff, o); - const y = this.F.fromRprBEM(buff, o+this.F.n8); - if (this.F.isZero(x) && this.F.isZero(y)) { - return this.zero; - } - return [x, y, this.F.one]; - } - - fromRprCompressed(buff, o) { - const F = this.F; - const v = new Uint8Array(buff.buffer, o, F.n8); - if (v[0] & 0x40) return this.zero; - const P = new Array(3); - - const greatest = ((v[0] & 0x80) != 0); - v[0] = v[0] & 0x7F; - P[0] = F.fromRprBE(buff, o); - if (greatest) v[0] = v[0] | 0x80; // set back again the old value - - const x3b = F.add(F.mul(F.square(P[0]), P[0]), this.b); - P[1] = F.sqrt(x3b); - - if (P[1] === null) { - throw new Error("Invalid Point!"); - } - - const s = isGreatest(F, P[1]); - if (greatest ^ s) P[1] = F.neg(P[1]); - P[2] = F.one; - - return P; - } - - toRprCompressed(buff, o, p) { - p = this.affine(p); - const v = new Uint8Array(buff.buffer, o, this.F.n8); - if (this.isZero(p)) { - v.fill(0); - v[0] = 0x40; - return; - } - this.F.toRprBE(buff, o, p[0]); - - if (isGreatest(this.F, p[1])) { - v[0] = v[0] | 0x80; - } - } - - - fromRprUncompressed(buff, o) { - if (buff[0] & 0x40) return this.zero; - - return this.fromRprBE(buff, o); - } - - toRprUncompressed(buff, o, p) { - this.toRprBE(buff, o, p); - - if (this.isZero(p)) { - buff[o] = buff[o] | 0x40; - } - } - - -} - - - -// EXTERNAL MODULE: ./node_modules/wasmcurves/index.js -var wasmcurves = __webpack_require__(189); -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/utils_native.js -/* global BigInt */ - function stringifyBigInts(o) { - if ((typeof(o) == "bigint") || o.eq !== undefined) { + if (typeof o == "bigint" || o.eq !== undefined) { return o.toString(10); } else if (o instanceof Uint8Array) { return fromRprLE(o, 0); @@ -73715,7 +77144,7 @@ function stringifyBigInts(o) { } else if (typeof o == "object") { const res = {}; const keys = Object.keys(o); - keys.forEach( (k) => { + keys.forEach((k) => { res[k] = stringifyBigInts(o[k]); }); return res; @@ -73725,17 +77154,17 @@ function stringifyBigInts(o) { } function unstringifyBigInts(o) { - if ((typeof(o) == "string") && (/^[0-9]+$/.test(o) )) { + if (typeof o == "string" && /^[0-9]+$/.test(o)) { return BigInt(o); - } else if ((typeof(o) == "string") && (/^0x[0-9a-fA-F]+$/.test(o) )) { + } else if (typeof o == "string" && /^0x[0-9a-fA-F]+$/.test(o)) { return BigInt(o); } else if (Array.isArray(o)) { return o.map(unstringifyBigInts); } else if (typeof o == "object") { - if (o===null) return null; + if (o === null) return null; const res = {}; const keys = Object.keys(o); - keys.forEach( (k) => { + keys.forEach((k) => { res[k] = unstringifyBigInts(o[k]); }); return res; @@ -73749,18 +77178,18 @@ function beBuff2int(buff) { let i = buff.length; let offset = 0; const buffV = new DataView(buff.buffer, buff.byteOffset, buff.byteLength); - while (i>0) { + while (i > 0) { if (i >= 4) { i -= 4; - res += BigInt(buffV.getUint32(i)) << BigInt(offset*8); + res += BigInt(buffV.getUint32(i)) << BigInt(offset * 8); offset += 4; } else if (i >= 2) { i -= 2; - res += BigInt(buffV.getUint16(i)) << BigInt(offset*8); + res += BigInt(buffV.getUint16(i)) << BigInt(offset * 8); offset += 2; } else { i -= 1; - res += BigInt(buffV.getUint8(i)) << BigInt(offset*8); + res += BigInt(buffV.getUint8(i)) << BigInt(offset * 8); offset += 1; } } @@ -73773,17 +77202,17 @@ function beInt2Buff(n, len) { const buffV = new DataView(buff.buffer); let o = len; while (o > 0) { - if (o-4 >= 0) { + if (o - 4 >= 0) { o -= 4; - buffV.setUint32(o, Number(r & BigInt(0xFFFFFFFF))); + buffV.setUint32(o, Number(r & BigInt(0xffffffff))); r = r >> BigInt(32); - } else if (o-2 >= 0) { + } else if (o - 2 >= 0) { o -= 2; - buffV.setUint16(o, Number(r & BigInt(0xFFFF))); + buffV.setUint16(o, Number(r & BigInt(0xffff))); r = r >> BigInt(16); } else { o -= 1; - buffV.setUint8(o, Number(r & BigInt(0xFF))); + buffV.setUint8(o, Number(r & BigInt(0xff))); r = r >> BigInt(8); } } @@ -73793,20 +77222,19 @@ function beInt2Buff(n, len) { return buff; } - function leBuff2int(buff) { let res = BigInt(0); let i = 0; const buffV = new DataView(buff.buffer, buff.byteOffset, buff.byteLength); - while (i> BigInt(32); - } else if (o+2 <= len) { - buffV.setUint16(Number(o, r & BigInt(0xFFFF)), true ); + } else if (o + 2 <= len) { + buffV.setUint16(o, Number(r & BigInt(0xffff)), true); o += 2; r = r >> BigInt(16); } else { - buffV.setUint8(Number(o, r & BigInt(0xFF)), true ); + buffV.setUint8(o, Number(r & BigInt(0xff)), true); o += 1; r = r >> BigInt(8); } @@ -73843,18 +77271,17 @@ function leInt2Buff(n, len) { return buff; } - function stringifyFElements(F, o) { - if ((typeof(o) == "bigint") || o.eq !== undefined) { + if (typeof o == "bigint" || o.eq !== undefined) { return o.toString(10); } else if (o instanceof Uint8Array) { return F.toString(F.e(o)); } else if (Array.isArray(o)) { - return o.map(stringifyFElements.bind(this,F)); + return o.map(stringifyFElements.bind(this, F)); } else if (typeof o == "object") { const res = {}; const keys = Object.keys(o); - keys.forEach( (k) => { + keys.forEach((k) => { res[k] = stringifyFElements(F, o[k]); }); return res; @@ -73863,19 +77290,18 @@ function stringifyFElements(F, o) { } } - function unstringifyFElements(F, o) { - if ((typeof(o) == "string") && (/^[0-9]+$/.test(o) )) { + if (typeof o == "string" && /^[0-9]+$/.test(o)) { return F.e(o); - } else if ((typeof(o) == "string") && (/^0x[0-9a-fA-F]+$/.test(o) )) { + } else if (typeof o == "string" && /^0x[0-9a-fA-F]+$/.test(o)) { return F.e(o); } else if (Array.isArray(o)) { - return o.map(unstringifyFElements.bind(this,F)); + return o.map(unstringifyFElements.bind(this, F)); } else if (typeof o == "object") { - if (o===null) return null; + if (o === null) return null; const res = {}; const keys = Object.keys(o); - keys.forEach( (k) => { + keys.forEach((k) => { res[k] = unstringifyFElements(F, o[k]); }); return res; @@ -73884,195 +77310,93 @@ function unstringifyFElements(F, o) { } } -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/utils_bigint.js - - -function utils_bigint_stringifyBigInts(o) { - if ((typeof(o) == "bigint") || o.eq !== undefined) { - return o.toString(10); - } else if (Array.isArray(o)) { - return o.map(utils_bigint_stringifyBigInts); - } else if (typeof o == "object") { - const res = {}; - const keys = Object.keys(o); - keys.forEach( (k) => { - res[k] = utils_bigint_stringifyBigInts(o[k]); - }); - return res; - } else { - return o; - } +const _revTable = []; +for (let i = 0; i < 256; i++) { + _revTable[i] = _revSlow(i, 8); } -function utils_bigint_unstringifyBigInts(o) { - if ((typeof(o) == "string") && (/^[0-9]+$/.test(o) )) { - return BigInteger(o); - } else if ((typeof(o) == "string") && (/^0x[0-9a-fA-F]+$/.test(o) )) { - return BigInteger(o); - } else if (Array.isArray(o)) { - return o.map(utils_bigint_unstringifyBigInts); - } else if (typeof o == "object") { - const res = {}; - const keys = Object.keys(o); - keys.forEach( (k) => { - res[k] = utils_bigint_unstringifyBigInts(o[k]); - }); - return res; - } else { - return o; - } -} - -function utils_bigint_beBuff2int(buff) { - let res = BigInteger.zero; - for (let i=0; i=0)) { - let c = Number(r.and(BigInteger("255"))); - buff[o] = c; - o--; - r = r.shiftRight(8); - } - if (!r.eq(BigInteger.zero)) { - throw new Error("Number does not fit in this length"); - } - return buff; -} - - -function utils_bigint_leBuff2int (buff) { - let res = BigInteger.zero; - for (let i=0; i>=1; + res = res | (a & 1); + a >>= 1; } return res; } -utils.bitReverse = function bitReverse(idx, bits) { +function bitReverse(idx, bits) { return ( - utils_revTable[idx >>> 24] | - (utils_revTable[(idx >>> 16) & 0xFF] << 8) | - (utils_revTable[(idx >>> 8) & 0xFF] << 16) | - (utils_revTable[idx & 0xFF] << 24) - ) >>> (32-bits); -}; + (_revTable[idx >>> 24] | + (_revTable[(idx >>> 16) & 0xff] << 8) | + (_revTable[(idx >>> 8) & 0xff] << 16) | + (_revTable[idx & 0xff] << 24)) >>> + (32 - bits) + ); +} +function log2(V) { + return ( + ((V & 0xffff0000) !== 0 ? ((V &= 0xffff0000), 16) : 0) | + ((V & 0xff00ff00) !== 0 ? ((V &= 0xff00ff00), 8) : 0) | + ((V & 0xf0f0f0f0) !== 0 ? ((V &= 0xf0f0f0f0), 4) : 0) | + ((V & 0xcccccccc) !== 0 ? ((V &= 0xcccccccc), 2) : 0) | + ((V & 0xaaaaaaaa) !== 0) + ); +} -utils.log2 = function log2( V ) -{ - return( ( ( V & 0xFFFF0000 ) !== 0 ? ( V &= 0xFFFF0000, 16 ) : 0 ) | ( ( V & 0xFF00FF00 ) !== 0 ? ( V &= 0xFF00FF00, 8 ) : 0 ) | ( ( V & 0xF0F0F0F0 ) !== 0 ? ( V &= 0xF0F0F0F0, 4 ) : 0 ) | ( ( V & 0xCCCCCCCC ) !== 0 ? ( V &= 0xCCCCCCCC, 2 ) : 0 ) | ( ( V & 0xAAAAAAAA ) !== 0 ) ); -}; - -utils.buffReverseBits = function buffReverseBits(buff, eSize) { - const n = buff.byteLength /eSize; - const bits = utils.log2(n); - if (n != (1 << bits)) { +function buffReverseBits(buff, eSize) { + const n = buff.byteLength / eSize; + const bits = log2(n); + if (n != 1 << bits) { throw new Error("Invalid number of pointers"); } - for (let i=0; ir) { - const tmp = buff.slice(i*eSize, (i+1)*eSize); - buff.set( buff.slice(r*eSize, (r+1)*eSize), i*eSize); - buff.set(tmp, r*eSize); + for (let i = 0; i < n; i++) { + const r = bitReverse(i, bits); + if (i > r) { + const tmp = buff.slice(i * eSize, (i + 1) * eSize); + buff.set(buff.slice(r * eSize, (r + 1) * eSize), i * eSize); + buff.set(tmp, r * eSize); } } -}; +} +function array2buffer(arr, sG) { + const buff = new Uint8Array(sG * arr.length); -utils.array2buffer = function(arr, sG) { - const buff = new Uint8Array(sG*arr.length); - - for (let i=0; i { @@ -75512,14 +78789,12 @@ function sleep(ms) { } function stringToBase64(str) { - if (threadman_process.browser) { + { return globalThis.btoa(str); - } else { - return Buffer.from(str).toString("base64"); } } -const threadSource = stringToBase64("(" + thread.toString() + ")(self)"); +const threadSource = stringToBase64("(" + "function thread(self) {\n const MAXMEM = 32767;\n let instance;\n let memory;\n\n if (self) {\n self.onmessage = function(e) {\n let data;\n if (e.data) {\n data = e.data;\n } else {\n data = e;\n }\n\n if (data[0].cmd == \"INIT\") {\n init(data[0]).then(function() {\n self.postMessage(data.result);\n });\n } else if (data[0].cmd == \"TERMINATE\") {\n self.close();\n } else {\n const res = runTask(data);\n self.postMessage(res);\n }\n };\n }\n\n async function init(data) {\n const code = new Uint8Array(data.code);\n const wasmModule = await WebAssembly.compile(code);\n memory = new WebAssembly.Memory({initial:data.init, maximum: MAXMEM});\n\n instance = await WebAssembly.instantiate(wasmModule, {\n env: {\n \"memory\": memory\n }\n });\n }\n\n\n\n function alloc(length) {\n const u32 = new Uint32Array(memory.buffer, 0, 1);\n while (u32[0] & 3) u32[0]++; // Return always aligned pointers\n const res = u32[0];\n u32[0] += length;\n if (u32[0] + length > memory.buffer.byteLength) {\n const currentPages = memory.buffer.byteLength / 0x10000;\n let requiredPages = Math.floor((u32[0] + length) / 0x10000)+1;\n if (requiredPages>MAXMEM) requiredPages=MAXMEM;\n memory.grow(requiredPages-currentPages);\n }\n return res;\n }\n\n function allocBuffer(buffer) {\n const p = alloc(buffer.byteLength);\n setBuffer(p, buffer);\n return p;\n }\n\n function getBuffer(pointer, length) {\n const u8 = new Uint8Array(memory.buffer);\n return new Uint8Array(u8.buffer, u8.byteOffset + pointer, length);\n }\n\n function setBuffer(pointer, buffer) {\n const u8 = new Uint8Array(memory.buffer);\n u8.set(new Uint8Array(buffer), pointer);\n }\n\n function runTask(task) {\n if (task[0].cmd == \"INIT\") {\n return init(task[0]);\n }\n const ctx = {\n vars: [],\n out: []\n };\n const u32a = new Uint32Array(memory.buffer, 0, 1);\n const oldAlloc = u32a[0];\n for (let i=0; i. +*/ + +function toNumber(n) { + return BigInt(n); +} + +function isNegative(n) { + return n < 0n; +} + +function isZero(n) { + return n === 0n; +} + +function bitLength(n) { + if (isNegative(n)) { + return n.toString(2).length - 1; // discard the - sign + } else { + return n.toString(2).length; + } +} + +function u32(n) { + const b = []; + const v = toNumber(n); + b.push(Number(v & 0xFFn)); + b.push(Number(v >> 8n & 0xFFn)); + b.push(Number(v >> 16n & 0xFFn)); + b.push(Number(v >> 24n & 0xFFn)); + return b; +} + +function toUTF8Array(str) { + var utf8 = []; + for (var i=0; i < str.length; i++) { + var charcode = str.charCodeAt(i); + if (charcode < 0x80) utf8.push(charcode); + else if (charcode < 0x800) { + utf8.push(0xc0 | (charcode >> 6), + 0x80 | (charcode & 0x3f)); + } + else if (charcode < 0xd800 || charcode >= 0xe000) { + utf8.push(0xe0 | (charcode >> 12), + 0x80 | ((charcode>>6) & 0x3f), + 0x80 | (charcode & 0x3f)); + } + // surrogate pair + else { + i++; + // UTF-16 encodes 0x10000-0x10FFFF by + // subtracting 0x10000 and splitting the + // 20 bits of 0x0-0xFFFFF into two halves + charcode = 0x10000 + (((charcode & 0x3ff)<<10) + | (str.charCodeAt(i) & 0x3ff)); + utf8.push(0xf0 | (charcode >>18), + 0x80 | ((charcode>>12) & 0x3f), + 0x80 | ((charcode>>6) & 0x3f), + 0x80 | (charcode & 0x3f)); + } + } + return utf8; +} + +function string(str) { + const bytes = toUTF8Array(str); + return [ ...varuint32(bytes.length), ...bytes ]; +} + +function varuint(n) { + const code = []; + let v = toNumber(n); + if (isNegative(v)) throw new Error("Number cannot be negative"); + while (!isZero(v)) { + code.push(Number(v & 0x7Fn)); + v = v >> 7n; + } + if (code.length==0) code.push(0); + for (let i=0; i 0xFFFFFFFFn) throw new Error("Number too big"); + if (v > 0x7FFFFFFFn) v = v - 0x100000000n; + // bigInt("-80000000", 16) as base10 + if (v < -2147483648n) throw new Error("Number too small"); + return varint(v); +} + +function varint64(n) { + let v = toNumber(n); + if (v > 0xFFFFFFFFFFFFFFFFn) throw new Error("Number too big"); + if (v > 0x7FFFFFFFFFFFFFFFn) v = v - 0x10000000000000000n; + // bigInt("-8000000000000000", 16) as base10 + if (v < -9223372036854775808n) throw new Error("Number too small"); + return varint(v); +} + +function varuint32(n) { + let v = toNumber(n); + if (v > 0xFFFFFFFFn) throw new Error("Number too big"); + return varuint(v); +} + +function toHexString(byteArray) { + return Array.from(byteArray, function(byte) { + return ("0" + (byte & 0xFF).toString(16)).slice(-2); + }).join(""); +} + +/* + Copyright 2019 0KIMS association. + + This file is part of wasmbuilder + + wasmbuilder is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + wasmbuilder is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with wasmbuilder. If not, see . +*/ -// EXTERNAL MODULE: ./node_modules/wasmbuilder/index.js -var wasmbuilder = __webpack_require__(4400); -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/bn128.js +class CodeBuilder { + constructor(func) { + this.func = func; + this.functionName = func.functionName; + this.module = func.module; + } + + setLocal(localName, valCode) { + const idx = this.func.localIdxByName[localName]; + if (idx === undefined) + throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${localName} `); + return [...valCode, 0x21, ...varuint32( idx )]; + } + + teeLocal(localName, valCode) { + const idx = this.func.localIdxByName[localName]; + if (idx === undefined) + throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${localName} `); + return [...valCode, 0x22, ...varuint32( idx )]; + } + + getLocal(localName) { + const idx = this.func.localIdxByName[localName]; + if (idx === undefined) + throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${localName} `); + return [0x20, ...varuint32( idx )]; + } + + i64_load8_s(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 0 : _align; // 8 bits alignment by default + return [...idxCode, 0x30, align, ...varuint32(offset)]; + } + + i64_load8_u(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 0 : _align; // 8 bits alignment by default + return [...idxCode, 0x31, align, ...varuint32(offset)]; + } + + i64_load16_s(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 1 : _align; // 16 bits alignment by default + return [...idxCode, 0x32, align, ...varuint32(offset)]; + } + + i64_load16_u(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 1 : _align; // 16 bits alignment by default + return [...idxCode, 0x33, align, ...varuint32(offset)]; + } + + i64_load32_s(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 2 : _align; // 32 bits alignment by default + return [...idxCode, 0x34, align, ...varuint32(offset)]; + } + + i64_load32_u(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 2 : _align; // 32 bits alignment by default + return [...idxCode, 0x35, align, ...varuint32(offset)]; + } + + i64_load(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 3 : _align; // 64 bits alignment by default + return [...idxCode, 0x29, align, ...varuint32(offset)]; + } + i64_store(idxCode, _offset, _align, _codeVal) { + let offset, align, codeVal; + if (Array.isArray(_offset)) { + offset = 0; + align = 3; + codeVal = _offset; + } else if (Array.isArray(_align)) { + offset = _offset; + align = 3; + codeVal = _align; + } else if (Array.isArray(_codeVal)) { + offset = _offset; + align = _align; + codeVal = _codeVal; + } + return [...idxCode, ...codeVal, 0x37, align, ...varuint32(offset)]; + } + + i64_store32(idxCode, _offset, _align, _codeVal) { + let offset, align, codeVal; + if (Array.isArray(_offset)) { + offset = 0; + align = 2; + codeVal = _offset; + } else if (Array.isArray(_align)) { + offset = _offset; + align = 2; + codeVal = _align; + } else if (Array.isArray(_codeVal)) { + offset = _offset; + align = _align; + codeVal = _codeVal; + } + return [...idxCode, ...codeVal, 0x3e, align, ...varuint32(offset)]; + } + i64_store16(idxCode, _offset, _align, _codeVal) { + let offset, align, codeVal; + if (Array.isArray(_offset)) { + offset = 0; + align = 1; + codeVal = _offset; + } else if (Array.isArray(_align)) { + offset = _offset; + align = 1; + codeVal = _align; + } else if (Array.isArray(_codeVal)) { + offset = _offset; + align = _align; + codeVal = _codeVal; + } + return [...idxCode, ...codeVal, 0x3d, align, ...varuint32(offset)]; + } + + + i64_store8(idxCode, _offset, _align, _codeVal) { + let offset, align, codeVal; + if (Array.isArray(_offset)) { + offset = 0; + align = 0; + codeVal = _offset; + } else if (Array.isArray(_align)) { + offset = _offset; + align = 0; + codeVal = _align; + } else if (Array.isArray(_codeVal)) { + offset = _offset; + align = _align; + codeVal = _codeVal; + } + return [...idxCode, ...codeVal, 0x3c, align, ...varuint32(offset)]; + } + + i32_load8_s(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 0 : _align; // 32 bits alignment by default + return [...idxCode, 0x2c, align, ...varuint32(offset)]; + } + + i32_load8_u(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 0 : _align; // 32 bits alignment by default + return [...idxCode, 0x2d, align, ...varuint32(offset)]; + } + + i32_load16_s(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 1 : _align; // 32 bits alignment by default + return [...idxCode, 0x2e, align, ...varuint32(offset)]; + } + + i32_load16_u(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 1 : _align; // 32 bits alignment by default + return [...idxCode, 0x2f, align, ...varuint32(offset)]; + } + + i32_load(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 2 : _align; // 32 bits alignment by default + return [...idxCode, 0x28, align, ...varuint32(offset)]; + } + + i32_store(idxCode, _offset, _align, _codeVal) { + let offset, align, codeVal; + if (Array.isArray(_offset)) { + offset = 0; + align = 2; + codeVal = _offset; + } else if (Array.isArray(_align)) { + offset = _offset; + align = 2; + codeVal = _align; + } else if (Array.isArray(_codeVal)) { + offset = _offset; + align = _align; + codeVal = _codeVal; + } + return [...idxCode, ...codeVal, 0x36, align, ...varuint32(offset)]; + } + + + i32_store16(idxCode, _offset, _align, _codeVal) { + let offset, align, codeVal; + if (Array.isArray(_offset)) { + offset = 0; + align = 1; + codeVal = _offset; + } else if (Array.isArray(_align)) { + offset = _offset; + align = 1; + codeVal = _align; + } else if (Array.isArray(_codeVal)) { + offset = _offset; + align = _align; + codeVal = _codeVal; + } + return [...idxCode, ...codeVal, 0x3b, align, ...varuint32(offset)]; + } + + i32_store8(idxCode, _offset, _align, _codeVal) { + let offset, align, codeVal; + if (Array.isArray(_offset)) { + offset = 0; + align = 0; + codeVal = _offset; + } else if (Array.isArray(_align)) { + offset = _offset; + align = 0; + codeVal = _align; + } else if (Array.isArray(_codeVal)) { + offset = _offset; + align = _align; + codeVal = _codeVal; + } + return [...idxCode, ...codeVal, 0x3a, align, ...varuint32(offset)]; + } + + call(fnName, ...args) { + const idx = this.module.functionIdxByName[fnName]; + if (idx === undefined) + throw new Error(`Function not defined: Function: ${fnName}`); + return [...[].concat(...args), 0x10, ...varuint32(idx)]; + } + + call_indirect(fnIdx, ...args) { + return [...[].concat(...args), ...fnIdx, 0x11, 0, 0]; + } + + if(condCode, thenCode, elseCode) { + if (elseCode) { + return [...condCode, 0x04, 0x40, ...thenCode, 0x05, ...elseCode, 0x0b]; + } else { + return [...condCode, 0x04, 0x40, ...thenCode, 0x0b]; + } + } + + block(bCode) { return [0x02, 0x40, ...bCode, 0x0b]; } + loop(...args) { + return [0x03, 0x40, ...[].concat(...[...args]), 0x0b]; + } + br_if(relPath, condCode) { return [...condCode, 0x0d, ...varuint32(relPath)]; } + br(relPath) { return [0x0c, ...varuint32(relPath)]; } + ret(rCode) { return [...rCode, 0x0f]; } + drop(dCode) { return [...dCode, 0x1a]; } + + i64_const(num) { return [0x42, ...varint64(num)]; } + i32_const(num) { return [0x41, ...varint32(num)]; } + + + i64_eqz(opcode) { return [...opcode, 0x50]; } + i64_eq(op1code, op2code) { return [...op1code, ...op2code, 0x51]; } + i64_ne(op1code, op2code) { return [...op1code, ...op2code, 0x52]; } + i64_lt_s(op1code, op2code) { return [...op1code, ...op2code, 0x53]; } + i64_lt_u(op1code, op2code) { return [...op1code, ...op2code, 0x54]; } + i64_gt_s(op1code, op2code) { return [...op1code, ...op2code, 0x55]; } + i64_gt_u(op1code, op2code) { return [...op1code, ...op2code, 0x56]; } + i64_le_s(op1code, op2code) { return [...op1code, ...op2code, 0x57]; } + i64_le_u(op1code, op2code) { return [...op1code, ...op2code, 0x58]; } + i64_ge_s(op1code, op2code) { return [...op1code, ...op2code, 0x59]; } + i64_ge_u(op1code, op2code) { return [...op1code, ...op2code, 0x5a]; } + i64_add(op1code, op2code) { return [...op1code, ...op2code, 0x7c]; } + i64_sub(op1code, op2code) { return [...op1code, ...op2code, 0x7d]; } + i64_mul(op1code, op2code) { return [...op1code, ...op2code, 0x7e]; } + i64_div_s(op1code, op2code) { return [...op1code, ...op2code, 0x7f]; } + i64_div_u(op1code, op2code) { return [...op1code, ...op2code, 0x80]; } + i64_rem_s(op1code, op2code) { return [...op1code, ...op2code, 0x81]; } + i64_rem_u(op1code, op2code) { return [...op1code, ...op2code, 0x82]; } + i64_and(op1code, op2code) { return [...op1code, ...op2code, 0x83]; } + i64_or(op1code, op2code) { return [...op1code, ...op2code, 0x84]; } + i64_xor(op1code, op2code) { return [...op1code, ...op2code, 0x85]; } + i64_shl(op1code, op2code) { return [...op1code, ...op2code, 0x86]; } + i64_shr_s(op1code, op2code) { return [...op1code, ...op2code, 0x87]; } + i64_shr_u(op1code, op2code) { return [...op1code, ...op2code, 0x88]; } + i64_extend_i32_s(op1code) { return [...op1code, 0xac]; } + i64_extend_i32_u(op1code) { return [...op1code, 0xad]; } + i64_clz(op1code) { return [...op1code, 0x79]; } + i64_ctz(op1code) { return [...op1code, 0x7a]; } + + i32_eqz(op1code) { return [...op1code, 0x45]; } + i32_eq(op1code, op2code) { return [...op1code, ...op2code, 0x46]; } + i32_ne(op1code, op2code) { return [...op1code, ...op2code, 0x47]; } + i32_lt_s(op1code, op2code) { return [...op1code, ...op2code, 0x48]; } + i32_lt_u(op1code, op2code) { return [...op1code, ...op2code, 0x49]; } + i32_gt_s(op1code, op2code) { return [...op1code, ...op2code, 0x4a]; } + i32_gt_u(op1code, op2code) { return [...op1code, ...op2code, 0x4b]; } + i32_le_s(op1code, op2code) { return [...op1code, ...op2code, 0x4c]; } + i32_le_u(op1code, op2code) { return [...op1code, ...op2code, 0x4d]; } + i32_ge_s(op1code, op2code) { return [...op1code, ...op2code, 0x4e]; } + i32_ge_u(op1code, op2code) { return [...op1code, ...op2code, 0x4f]; } + i32_add(op1code, op2code) { return [...op1code, ...op2code, 0x6a]; } + i32_sub(op1code, op2code) { return [...op1code, ...op2code, 0x6b]; } + i32_mul(op1code, op2code) { return [...op1code, ...op2code, 0x6c]; } + i32_div_s(op1code, op2code) { return [...op1code, ...op2code, 0x6d]; } + i32_div_u(op1code, op2code) { return [...op1code, ...op2code, 0x6e]; } + i32_rem_s(op1code, op2code) { return [...op1code, ...op2code, 0x6f]; } + i32_rem_u(op1code, op2code) { return [...op1code, ...op2code, 0x70]; } + i32_and(op1code, op2code) { return [...op1code, ...op2code, 0x71]; } + i32_or(op1code, op2code) { return [...op1code, ...op2code, 0x72]; } + i32_xor(op1code, op2code) { return [...op1code, ...op2code, 0x73]; } + i32_shl(op1code, op2code) { return [...op1code, ...op2code, 0x74]; } + i32_shr_s(op1code, op2code) { return [...op1code, ...op2code, 0x75]; } + i32_shr_u(op1code, op2code) { return [...op1code, ...op2code, 0x76]; } + i32_rotl(op1code, op2code) { return [...op1code, ...op2code, 0x77]; } + i32_rotr(op1code, op2code) { return [...op1code, ...op2code, 0x78]; } + i32_wrap_i64(op1code) { return [...op1code, 0xa7]; } + i32_clz(op1code) { return [...op1code, 0x67]; } + i32_ctz(op1code) { return [...op1code, 0x68]; } + + unreachable() { return [ 0x0 ]; } + + current_memory() { return [ 0x3f, 0]; } + + comment() { return []; } +} + +/* + Copyright 2019 0KIMS association. + + This file is part of wasmbuilder + + wasmbuilder is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + wasmbuilder is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with wasmbuilder. If not, see . +*/ + + +const typeCodes = { + "i32": 0x7f, + "i64": 0x7e, + "f32": 0x7d, + "f64": 0x7c, + "anyfunc": 0x70, + "func": 0x60, + "emptyblock": 0x40 +}; + + +class FunctionBuilder { + + constructor (module, fnName, fnType, moduleName, fieldName) { + if (fnType == "import") { + this.fnType = "import"; + this.moduleName = moduleName; + this.fieldName = fieldName; + } else if (fnType == "internal") { + this.fnType = "internal"; + } else { + throw new Error("Invalid function fnType: " + fnType); + } + this.module = module; + this.fnName = fnName; + this.params = []; + this.locals = []; + this.localIdxByName = {}; + this.code = []; + this.returnType = null; + this.nextLocal =0; + } + + addParam(paramName, paramType) { + if (this.localIdxByName[paramName]) + throw new Error(`param already exists. Function: ${this.fnName}, Param: ${paramName} `); + const idx = this.nextLocal++; + this.localIdxByName[paramName] = idx; + this.params.push({ + type: paramType + }); + } + + addLocal(localName, localType, _length) { + const length = _length || 1; + if (this.localIdxByName[localName]) + throw new Error(`local already exists. Function: ${this.fnName}, Param: ${localName} `); + const idx = this.nextLocal++; + this.localIdxByName[localName] = idx; + this.locals.push({ + type: localType, + length: length + }); + } + + setReturnType(returnType) { + if (this.returnType) + throw new Error(`returnType already defined. Function: ${this.fnName}`); + this.returnType = returnType; + } + + getSignature() { + const params = [...varuint32(this.params.length), ...this.params.map((p) => typeCodes[p.type])]; + const returns = this.returnType ? [0x01, typeCodes[this.returnType]] : [0]; + return [0x60, ...params, ...returns]; + } + + getBody() { + const locals = this.locals.map((l) => [ + ...varuint32(l.length), + typeCodes[l.type] + ]); + + const body = [ + ...varuint32(this.locals.length), + ...[].concat(...locals), + ...this.code, + 0x0b + ]; + return [ + ...varuint32(body.length), + ...body + ]; + } + + addCode(...code) { + this.code.push(...[].concat(...[...code])); + } + + getCodeBuilder() { + return new CodeBuilder(this); + } +} + +/* + Copyright 2019 0KIMS association. + + This file is part of wasmbuilder + + wasmbuilder is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + wasmbuilder is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with wasmbuilder. If not, see . +*/ + + +class ModuleBuilder { + + constructor() { + this.functions = []; + this.functionIdxByName = {}; + this.nImportFunctions = 0; + this.nInternalFunctions =0; + this.memory = { + pagesSize: 1, + moduleName: "env", + fieldName: "memory" + }; + this.free = 8; + this.datas = []; + this.modules = {}; + this.exports = []; + this.functionsTable = []; + } + + build() { + this._setSignatures(); + return new Uint8Array([ + ...u32(0x6d736100), + ...u32(1), + ...this._buildType(), + ...this._buildImport(), + ...this._buildFunctionDeclarations(), + ...this._buildFunctionsTable(), + ...this._buildExports(), + ...this._buildElements(), + ...this._buildCode(), + ...this._buildData() + ]); + } + + addFunction(fnName) { + if (typeof(this.functionIdxByName[fnName]) !== "undefined") + throw new Error(`Function already defined: ${fnName}`); + + const idx = this.functions.length; + this.functionIdxByName[fnName] = idx; + + this.functions.push(new FunctionBuilder(this, fnName, "internal")); + + this.nInternalFunctions++; + return this.functions[idx]; + } + + addIimportFunction(fnName, moduleName, _fieldName) { + if (typeof(this.functionIdxByName[fnName]) !== "undefined") + throw new Error(`Function already defined: ${fnName}`); + + if ( (this.functions.length>0) + &&(this.functions[this.functions.length-1].type == "internal")) + throw new Error(`Import functions must be declared before internal: ${fnName}`); + + let fieldName = _fieldName || fnName; + + const idx = this.functions.length; + this.functionIdxByName[fnName] = idx; + + this.functions.push(new FunctionBuilder(this, fnName, "import", moduleName, fieldName)); + + this.nImportFunctions ++; + return this.functions[idx]; + } + + setMemory(pagesSize, moduleName, fieldName) { + this.memory = { + pagesSize: pagesSize, + moduleName: moduleName || "env", + fieldName: fieldName || "memory" + }; + } + + exportFunction(fnName, _exportName) { + const exportName = _exportName || fnName; + if (typeof(this.functionIdxByName[fnName]) === "undefined") + throw new Error(`Function not defined: ${fnName}`); + const idx = this.functionIdxByName[fnName]; + if (exportName != fnName) { + this.functionIdxByName[exportName] = idx; + } + this.exports.push({ + exportName: exportName, + idx: idx + }); + } + + addFunctionToTable(fnName) { + const idx = this.functionIdxByName[fnName]; + this.functionsTable.push(idx); + } + + addData(offset, bytes) { + this.datas.push({ + offset: offset, + bytes: bytes + }); + } + + alloc(a, b) { + let size; + let bytes; + if ((Array.isArray(a) || ArrayBuffer.isView(a)) && (typeof(b) === "undefined")) { + size = a.length; + bytes = a; + } else { + size = a; + bytes = b; + } + size = (((size-1)>>3) +1)<<3; // Align to 64 bits. + const p = this.free; + this.free += size; + if (bytes) { + this.addData(p, bytes); + } + return p; + } + + allocString(s) { + const encoder = new globalThis.TextEncoder(); + const uint8array = encoder.encode(s); + return this.alloc([...uint8array, 0]); + } + + _setSignatures() { + this.signatures = []; + const signatureIdxByName = {}; + if (this.functionsTable.length>0) { + const signature = this.functions[this.functionsTable[0]].getSignature(); + const signatureName = "s_"+toHexString(signature); + signatureIdxByName[signatureName] = 0; + this.signatures.push(signature); + } + for (let i=0; i= 0) { - curve = await bn128_buildBn128(singleThread, plugins); + curve = await buildBn128(singleThread, plugins); } else if (["BLS12381"].indexOf(normName) >= 0) { - curve = await bls12381_buildBls12381(singleThread, plugins); + curve = await buildBls12381(singleThread, plugins); } else { throw new Error(`Curve not supported: ${name}`); } @@ -77145,33 +81291,12 @@ async function curves_getCurveFromName(name, singleThread, plugins) { } -;// CONCATENATED MODULE: ./node_modules/ffjavascript/main.js - - -const main_Scalar=scalar_namespaceObject; +const browser_esm_Scalar=_Scalar; +const utils = _utils; - - - - - - - - - - - -const main_utils = utils_namespaceObject; - - - - - - - -;// CONCATENATED MODULE: ./node_modules/circomlibjs/src/babyjub.js +;// ./node_modules/circomlibjs/src/babyjub.js async function babyjub_buildBabyJub() { @@ -77316,8 +81441,8 @@ class BabyJub { var node_modules_blake2b = __webpack_require__(2206); // EXTERNAL MODULE: ./node_modules/blake-hash/js.js var js = __webpack_require__(654); -;// CONCATENATED MODULE: ./node_modules/circomlibjs/src/pedersen_hash.js -/* provided dependency */ var pedersen_hash_Buffer = __webpack_require__(8287)["Buffer"]; +;// ./node_modules/circomlibjs/src/pedersen_hash.js +/* provided dependency */ var Buffer = __webpack_require__(2045)["hp"]; @@ -77343,7 +81468,7 @@ class PedersenHash { if (type == "blake") { return createBlakeHash("blake256").update(S).digest(); } else if (type == "blake2b") { - return pedersen_hash_Buffer.from(blake2b(32).update(pedersen_hash_Buffer.from(S)).digest()); + return Buffer.from(blake2b(32).update(Buffer.from(S)).digest()); } } @@ -77450,7 +81575,7 @@ class PedersenHash { -;// CONCATENATED MODULE: ./node_modules/circomlibjs/src/mimc7.js +;// ./node_modules/circomlibjs/src/mimc7.js @@ -77530,7 +81655,7 @@ class Mimc7 { } } -;// CONCATENATED MODULE: ./node_modules/circomlibjs/src/poseidon_constants_opt.js +;// ./node_modules/circomlibjs/src/poseidon_constants_opt.js /* harmony default export */ const poseidon_constants_opt = ({ "C": [ [ @@ -102337,7 +106462,7 @@ class Mimc7 { ] ] }); -;// CONCATENATED MODULE: ./node_modules/circomlibjs/src/poseidon_wasm.js +;// ./node_modules/circomlibjs/src/poseidon_wasm.js @@ -102781,11 +106906,10 @@ function buildPoseidonWasm(module) { // EXTERNAL MODULE: ./node_modules/js-sha3/src/sha3.js var sha3 = __webpack_require__(1176); var sha3_default = /*#__PURE__*/__webpack_require__.n(sha3); -;// CONCATENATED MODULE: ./node_modules/@ethersproject/logger/lib.esm/_version.js +;// ./node_modules/@ethersproject/logger/lib.esm/_version.js const version = "logger/5.7.0"; //# sourceMappingURL=_version.js.map -;// CONCATENATED MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js -/* provided dependency */ var console = __webpack_require__(6763); +;// ./node_modules/@ethersproject/logger/lib.esm/index.js let _permanentCensorErrors = false; let _censorErrors = false; @@ -103141,10 +107265,10 @@ class Logger { Logger.errors = ErrorCode; Logger.levels = LogLevel; //# sourceMappingURL=index.js.map -;// CONCATENATED MODULE: ./node_modules/@ethersproject/bytes/lib.esm/_version.js +;// ./node_modules/@ethersproject/bytes/lib.esm/_version.js const _version_version = "bytes/5.7.0"; //# sourceMappingURL=_version.js.map -;// CONCATENATED MODULE: ./node_modules/@ethersproject/bytes/lib.esm/index.js +;// ./node_modules/@ethersproject/bytes/lib.esm/index.js @@ -103554,7 +107678,7 @@ function joinSignature(signature) { ])); } //# sourceMappingURL=index.js.map -;// CONCATENATED MODULE: ./node_modules/@ethersproject/keccak256/lib.esm/index.js +;// ./node_modules/@ethersproject/keccak256/lib.esm/index.js @@ -103562,10 +107686,10 @@ function keccak256(data) { return '0x' + sha3_default().keccak_256(lib_esm_arrayify(data)); } //# sourceMappingURL=index.js.map -;// CONCATENATED MODULE: ./node_modules/@ethersproject/strings/lib.esm/_version.js +;// ./node_modules/@ethersproject/strings/lib.esm/_version.js const lib_esm_version_version = "strings/5.7.0"; //# sourceMappingURL=_version.js.map -;// CONCATENATED MODULE: ./node_modules/@ethersproject/strings/lib.esm/utf8.js +;// ./node_modules/@ethersproject/strings/lib.esm/utf8.js @@ -103814,7 +107938,7 @@ function toUtf8CodePoints(str, form = UnicodeNormalizationForm.current) { return getUtf8CodePoints(toUtf8Bytes(str, form)); } //# sourceMappingURL=utf8.js.map -;// CONCATENATED MODULE: ./node_modules/circomlibjs/src/mimcsponge.js +;// ./node_modules/circomlibjs/src/mimcsponge.js @@ -103822,7 +107946,7 @@ const mimcsponge_SEED = "mimcsponge"; const mimcsponge_NROUNDS = 220; async function mimcsponge_buildMimcSponge() { - const bn128 = await curves_getCurveFromName("bn128", true); + const bn128 = await browser_esm_getCurveFromName("bn128", true); return new MimcSponge(bn128.Fr); } @@ -103836,7 +107960,7 @@ class MimcSponge { const F = this.F; if (typeof seed === "undefined") seed = mimcsponge_SEED; const c = keccak256(toUtf8Bytes(seed+"_iv")); - const cn = main_Scalar.e(c); + const cn = browser_esm_Scalar.e(c); const iv = cn.mod(F.p); return iv; }; @@ -103916,8 +108040,8 @@ class MimcSponge { } } -;// CONCATENATED MODULE: ./node_modules/circomlibjs/src/eddsa.js -/* provided dependency */ var eddsa_Buffer = __webpack_require__(8287)["Buffer"]; +;// ./node_modules/circomlibjs/src/eddsa.js +/* provided dependency */ var eddsa_Buffer = __webpack_require__(2045)["hp"]; @@ -104204,7 +108328,7 @@ class Eddsa { -;// CONCATENATED MODULE: ./node_modules/circomlibjs/src/evmasm.js +;// ./node_modules/circomlibjs/src/evmasm.js // Copyright (c) 2018 Jordi Baylina // License: LGPL-3.0+ // @@ -104415,7 +108539,7 @@ class evmasm_Contract { } -;// CONCATENATED MODULE: ./node_modules/circomlibjs/src/mimc7_gencontract.js +;// ./node_modules/circomlibjs/src/mimc7_gencontract.js // Copyright (c) 2018 Jordi Baylina // License: LGPL-3.0+ // @@ -104530,7 +108654,7 @@ const abi = [ -;// CONCATENATED MODULE: ./node_modules/circomlibjs/src/mimcsponge_gencontract.js +;// ./node_modules/circomlibjs/src/mimcsponge_gencontract.js // Copyright (c) 2018 Jordi Baylina // License: LGPL-3.0+ // @@ -104657,7 +108781,7 @@ const mimcsponge_gencontract_abi = [ ]; -;// CONCATENATED MODULE: ./node_modules/circomlibjs/src/poseidon_constants.js +;// ./node_modules/circomlibjs/src/poseidon_constants.js /* harmony default export */ const poseidon_constants = ({ "C": [ ["0x09c46e9ec68e9bd4fe1faaba294cba38a71aa177534cdd1b6c7dc0dbd0abd7a7", "0x0c0356530896eec42a97ed937f3135cfc5142b3ae405b8343c1d83ffa604cb81", "0x1e28a1d935698ad1142e51182bb54cf4a00ea5aabd6268bd317ea977cc154a30", "0x27af2d831a9d2748080965db30e298e40e5757c3e008db964cf9e2b12b91251f", "0x1e6f11ce60fc8f513a6a3cfe16ae175a41291462f214cd0879aaf43545b74e03", "0x2a67384d3bbd5e438541819cb681f0be04462ed14c3613d8f719206268d142d3", "0x0b66fdf356093a611609f8e12fbfecf0b985e381f025188936408f5d5c9f45d0", "0x012ee3ec1e78d470830c61093c2ade370b26c83cc5cebeeddaa6852dbdb09e21", "0x0252ba5f6760bfbdfd88f67f8175e3fd6cd1c431b099b6bb2d108e7b445bb1b9", "0x179474cceca5ff676c6bec3cef54296354391a8935ff71d6ef5aeaad7ca932f1", "0x2c24261379a51bfa9228ff4a503fd4ed9c1f974a264969b37e1a2589bbed2b91", "0x1cc1d7b62692e63eac2f288bd0695b43c2f63f5001fc0fc553e66c0551801b05", "0x255059301aada98bb2ed55f852979e9600784dbf17fbacd05d9eff5fd9c91b56", "0x28437be3ac1cb2e479e1f5c0eccd32b3aea24234970a8193b11c29ce7e59efd9", "0x28216a442f2e1f711ca4fa6b53766eb118548da8fb4f78d4338762c37f5f2043", "0x2c1f47cd17fa5adf1f39f4e7056dd03feee1efce03094581131f2377323482c9", "0x07abad02b7a5ebc48632bcc9356ceb7dd9dafca276638a63646b8566a621afc9", "0x0230264601ffdf29275b33ffaab51dfe9429f90880a69cd137da0c4d15f96c3c", "0x1bc973054e51d905a0f168656497ca40a864414557ee289e717e5d66899aa0a9", "0x2e1c22f964435008206c3157e86341edd249aff5c2d8421f2a6b22288f0a67fc", "0x1224f38df67c5378121c1d5f461bbc509e8ea1598e46c9f7a70452bc2bba86b8", "0x02e4e69d8ba59e519280b4bd9ed0068fd7bfe8cd9dfeda1969d2989186cde20e", "0x1f1eccc34aaba0137f5df81fc04ff3ee4f19ee364e653f076d47e9735d98018e", "0x1672ad3d709a353974266c3039a9a7311424448032cd1819eacb8a4d4284f582", "0x283e3fdc2c6e420c56f44af5192b4ae9cda6961f284d24991d2ed602df8c8fc7", "0x1c2a3d120c550ecfd0db0957170fa013683751f8fdff59d6614fbd69ff394bcc", "0x216f84877aac6172f7897a7323456efe143a9a43773ea6f296cb6b8177653fbd", "0x2c0d272becf2a75764ba7e8e3e28d12bceaa47ea61ca59a411a1f51552f94788", "0x16e34299865c0e28484ee7a74c454e9f170a5480abe0508fcb4a6c3d89546f43", "0x175ceba599e96f5b375a232a6fb9cc71772047765802290f48cd939755488fc5", "0x0c7594440dc48c16fead9e1758b028066aa410bfbc354f54d8c5ffbb44a1ee32", "0x1a3c29bc39f21bb5c466db7d7eb6fd8f760e20013ccf912c92479882d919fd8d", "0x0ccfdd906f3426e5c0986ea049b253400855d349074f5a6695c8eeabcd22e68f", "0x14f6bc81d9f186f62bdb475ce6c9411866a7a8a3fd065b3ce0e699b67dd9e796", "0x0962b82789fb3d129702ca70b2f6c5aacc099810c9c495c888edeb7386b97052", "0x1a880af7074d18b3bf20c79de25127bc13284ab01ef02575afef0c8f6a31a86d", "0x10cba18419a6a332cd5e77f0211c154b20af2924fc20ff3f4c3012bb7ae9311b", "0x057e62a9a8f89b3ebdc76ba63a9eaca8fa27b7319cae3406756a2849f302f10d", "0x287c971de91dc0abd44adf5384b4988cb961303bbf65cff5afa0413b44280cee", "0x21df3388af1687bbb3bca9da0cca908f1e562bc46d4aba4e6f7f7960e306891d", "0x1be5c887d25bce703e25cc974d0934cd789df8f70b498fd83eff8b560e1682b3", "0x268da36f76e568fb68117175cea2cd0dd2cb5d42fda5acea48d59c2706a0d5c1", "0x0e17ab091f6eae50c609beaf5510ececc5d8bb74135ebd05bd06460cc26a5ed6", "0x04d727e728ffa0a67aee535ab074a43091ef62d8cf83d270040f5caa1f62af40", "0x0ddbd7bf9c29341581b549762bc022ed33702ac10f1bfd862b15417d7e39ca6e", "0x2790eb3351621752768162e82989c6c234f5b0d1d3af9b588a29c49c8789654b", "0x1e457c601a63b73e4471950193d8a570395f3d9ab8b2fd0984b764206142f9e9", "0x21ae64301dca9625638d6ab2bbe7135ffa90ecd0c43ff91fc4c686fc46e091b0", "0x0379f63c8ce3468d4da293166f494928854be9e3432e09555858534eed8d350b", "0x002d56420359d0266a744a080809e054ca0e4921a46686ac8c9f58a324c35049", "0x123158e5965b5d9b1d68b3cd32e10bbeda8d62459e21f4090fc2c5af963515a6", "0x0be29fc40847a941661d14bbf6cbe0420fbb2b6f52836d4e60c80eb49cad9ec1", "0x1ac96991dec2bb0557716142015a453c36db9d859cad5f9a233802f24fdf4c1a", "0x1596443f763dbcc25f4964fc61d23b3e5e12c9fa97f18a9251ca3355bcb0627e", "0x12e0bcd3654bdfa76b2861d4ec3aeae0f1857d9f17e715aed6d049eae3ba3212", "0x0fc92b4f1bbea82b9ea73d4af9af2a50ceabac7f37154b1904e6c76c7cf964ba", "0x1f9c0b1610446442d6f2e592a8013f40b14f7c7722236f4f9c7e965233872762", "0x0ebd74244ae72675f8cde06157a782f4050d914da38b4c058d159f643dbbf4d3", "0x2cb7f0ed39e16e9f69a9fafd4ab951c03b0671e97346ee397a839839dccfc6d1", "0x1a9d6e2ecff022cc5605443ee41bab20ce761d0514ce526690c72bca7352d9bf", "0x2a115439607f335a5ea83c3bc44a9331d0c13326a9a7ba3087da182d648ec72f", "0x23f9b6529b5d040d15b8fa7aee3e3410e738b56305cd44f29535c115c5a4c060", "0x05872c16db0f72a2249ac6ba484bb9c3a3ce97c16d58b68b260eb939f0e6e8a7", "0x1300bdee08bb7824ca20fb80118075f40219b6151d55b5c52b624a7cdeddf6a7", "0x19b9b63d2f108e17e63817863a8f6c288d7ad29916d98cb1072e4e7b7d52b376", "0x015bee1357e3c015b5bda237668522f613d1c88726b5ec4224a20128481b4f7f", "0x2953736e94bb6b9f1b9707a4f1615e4efe1e1ce4bab218cbea92c785b128ffd1", "0x0b069353ba091618862f806180c0385f851b98d372b45f544ce7266ed6608dfc", "0x304f74d461ccc13115e4e0bcfb93817e55aeb7eb9306b64e4f588ac97d81f429", "0x15bbf146ce9bca09e8a33f5e77dfe4f5aad2a164a4617a4cb8ee5415cde913fc", "0x0ab4dfe0c2742cde44901031487964ed9b8f4b850405c10ca9ff23859572c8c6", "0x0e32db320a044e3197f45f7649a19675ef5eedfea546dea9251de39f9639779a", "0x0a1756aa1f378ca4b27635a78b6888e66797733a82774896a3078efa516da016", "0x044c4a33b10f693447fd17177f952ef895e61d328f85efa94254d6a2a25d93ef", "0x2ed3611b725b8a70be655b537f66f700fe0879d79a496891d37b07b5466c4b8b", "0x1f9ba4e8bab7ce42c8ecc3d722aa2e0eadfdeb9cfdd347b5d8339ea7120858aa", "0x1b233043052e8c288f7ee907a84e518aa38e82ac4502066db74056f865c5d3da", "0x2431e1cc164bb8d074031ab72bd55b4c902053bfc0f14db0ca2f97b020875954", "0x082f934c91f5aac330cd6953a0a7db45a13e322097583319a791f273965801fd", "0x2b9a0a223e7538b0a34be074315542a3c77245e2ae7cbe999ad6bb930c48997c", "0x0e1cd91edd2cfa2cceb85483b887a9be8164163e75a8a00eb0b589cc70214e7d", "0x2e1eac0f2bfdfd63c951f61477e3698999774f19854d00f588d324601cebe2f9", "0x0cbfa95f37fb74060c76158e769d6d157345784d8efdb33c23d748115b500b83", "0x08f05b3be923ed44d65ad49d8a61e9a676d991e3a77513d9980c232dfa4a4f84", "0x22719e2a070bcd0852bf8e21984d0443e7284925dc0758a325a2dd510c047ef6", "0x041f596a9ee1cb2bc060f7fcc3a1ab4c7bdbf036119982c0f41f62b2f26830c0", "0x233fd35de1be520a87628eb06f6b1d4c021be1c2d0dc464a19fcdd0986b10f89", "0x0524b46d1aa87a5e4325e0a423ebc810d31e078aa1b4707eefcb453c61c9c267", "0x2c34f424c81e5716ce47fcac894b85824227bb954b0f3199cc4486237c515211", "0x0b5f2a4b63387819207effc2b5541fb72dd2025b5457cc97f33010327de4915e", "0x22207856082ccc54c5b72fe439d2cfd6c17435d2f57af6ceaefac41fe05c659f", "0x24d57a8bf5da63fe4e24159b7f8950b5cdfb210194caf79f27854048ce2c8171", "0x0afab181fdd5e0583b371d75bd693f98374ad7097bb01a8573919bb23b79396e", "0x2dba9b108f208772998a52efac7cbd5676c0057194c16c0bf16290d62b1128ee", "0x26349b66edb8b16f56f881c788f53f83cbb83de0bd592b255aff13e6bce420b3", "0x25af7ce0e5e10357685e95f92339753ad81a56d28ecc193b235288a3e6f137db", "0x25b4ce7bd2294390c094d6a55edd68b970eed7aae88b2bff1f7c0187fe35011f", "0x22c543f10f6c89ec387e53f1908a88e5de9cef28ebdf30b18cb9d54c1e02b631", "0x0236f93e7789c4724fc7908a9f191e1e425e906a919d7a34df668e74882f87a9", "0x29350b401166ca010e7d27e37d05da99652bdae114eb01659cb497af980c4b52", "0x0eed787d65820d3f6bd31bbab547f75a65edb75d844ebb89ee1260916652363f", "0x07cc1170f13b46f2036a753f520b3291fdcd0e99bd94297d1906f656f4de6fad", "0x22b939233b1d7205f49bcf613a3d30b1908786d7f9f5d10c2059435689e8acea", "0x01451762a0aab81c8aad1dc8bc33e870740f083a5aa85438add650ace60ae5a6", "0x23506bb5d8727d4461fabf1025d46d1fe32eaa61dec7da57e704fec0892fce89", "0x2e484c44e838aea0bac06ae3f71bdd092a3709531e1efea97f8bd68907355522", "0x0f4bc7d07ebafd64379e78c50bd2e42baf4a594545cedc2545418da26835b54c", "0x1f4d3c8f6583e9e5fa76637862faaee851582388725df460e620996d50d8e74e", "0x093514e0c70711f82660d07be0e4a988fae02abc7b681d9153eb9bcb48fe7389", "0x1adab0c8e2b3bad346699a2b5f3bc03643ee83ece47228f24a58e0a347e153d8", "0x1672b1726057d99dd14709ebb474641a378c1b94b8072bac1a22dbef9e80dad2", "0x1dfd53d4576af2e38f44f53fdcab468cc5d8e2fae0acc4ee30d47b239b479c14", "0x0c6888a10b75b0f3a70a36263a37e17fe6d77d640f6fc3debc7f207753205c60", "0x1addb933a65be77092b34a7e77d12fe8611a61e00ee6848b85091ecca9d1e508", "0x00d7540dcd268a845c10ae18d1de933cf638ff5425f0afff7935628e299d1791", "0x140c0e42687e9ead01b2827a5664ca9c26fedde4acd99db1d316939d20b82c0e", "0x2f0c3a115d4317d191ba89b8d13d1806c20a0f9b24f8c5edc091e2ae56565984", "0x0c4ee778ff7c14553006ed220cf9c81008a0cff670b22b82d8c538a1dc958c61", "0x1704f2766d46f82c3693f00440ccc3609424ed26c0acc66227c3d7485de74c69", "0x2f2d19cc3ea5d78ea7a02c1b51d244abf0769c9f8544e40239b66fe9009c3cfa", "0x1ae03853b75fcaba5053f112e2a8e8dcdd7ee6cb9cfed9c7d6c766a806fc6629", "0x0971aabf795241df51d131d0fa61aa5f3556921b2d6f014e4e41a86ddaf056d5", "0x1408c316e6014e1a91d4cf6b6e0de73eda624f8380df1c875f5c29f7bfe2f646", "0x1667f3fe2edbe850248abe42b543093b6c89f1f773ef285341691f39822ef5bd", "0x13bf7c5d0d2c4376a48b0a03557cdf915b81718409e5c133424c69576500fe37", "0x07620a6dfb0b6cec3016adf3d3533c24024b95347856b79719bc0ba743a62c2c", "0x1574c7ef0c43545f36a8ca08bdbdd8b075d2959e2f322b731675de3e1982b4d0", "0x269e4b5b7a2eb21afd567970a717ceec5bd4184571c254fdc06e03a7ff8378f0"], @@ -104865,14 +108989,14 @@ const mimcsponge_gencontract_abi = [ ] }); -;// CONCATENATED MODULE: ./node_modules/circomlibjs/src/poseidon_gencontract.js +;// ./node_modules/circomlibjs/src/poseidon_gencontract.js // Copyright (c) 2018 Jordi Baylina // License: LGPL-3.0+ // -const { unstringifyBigInts: poseidon_gencontract_unstringifyBigInts } = main_utils; +const { unstringifyBigInts: poseidon_gencontract_unstringifyBigInts } = utils; @@ -105078,7 +109202,7 @@ function generateABI(nInputs) { // EXTERNAL MODULE: ./node_modules/assert/build/assert.js var build_assert = __webpack_require__(4148); -;// CONCATENATED MODULE: ./node_modules/circomlibjs/src/poseidon_reference.js +;// ./node_modules/circomlibjs/src/poseidon_reference.js @@ -105163,7 +109287,7 @@ async function poseidon_reference_buildPoseidon() { } -;// CONCATENATED MODULE: ./node_modules/circomlibjs/src/poseidon_opt.js +;// ./node_modules/circomlibjs/src/poseidon_opt.js // Parameters are generated by a reference script https://extgit.iaik.tugraz.at/krypto/hadeshash/-/blob/master/code/generate_parameters_grain.sage // Used like so: sage generate_parameters_grain.sage 1 0 254 2 8 56 0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001 @@ -105284,7 +109408,7 @@ async function poseidon_opt_buildPoseidon() { -;// CONCATENATED MODULE: ./node_modules/circomlibjs/src/smt_hashes_poseidon.js +;// ./node_modules/circomlibjs/src/smt_hashes_poseidon.js @@ -105303,7 +109427,7 @@ async function smt_hashes_poseidon_getHashes() { } } -;// CONCATENATED MODULE: ./node_modules/circomlibjs/src/smt.js +;// ./node_modules/circomlibjs/src/smt.js @@ -105614,7 +109738,7 @@ async function newMemEmptyTrie() { return smt; } -;// CONCATENATED MODULE: ./node_modules/circomlibjs/main.js +;// ./node_modules/circomlibjs/main.js @@ -105641,65 +109765,45 @@ const poseidonContract=(/* unused pure expression or super */ null && (_poseidon -;// CONCATENATED MODULE: ./src/mimc.ts +;// ./src/mimc.ts -var __async = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; class Mimc { + sponge; + hash; + mimcPromise; constructor() { this.mimcPromise = this.initMimc(); } - initMimc() { - return __async(this, null, function* () { - this.sponge = yield mimcsponge_buildMimcSponge(); - this.hash = (left, right) => { - var _a, _b; - return (_b = this.sponge) == null ? void 0 : _b.F.toString((_a = this.sponge) == null ? void 0 : _a.multiHash([BigInt(left), BigInt(right)])); - }; - }); + async initMimc() { + this.sponge = await mimcsponge_buildMimcSponge(); + this.hash = (left, right) => this.sponge?.F.toString(this.sponge?.multiHash([BigInt(left), BigInt(right)])); } - getHash() { - return __async(this, null, function* () { - yield this.mimcPromise; - return { - sponge: this.sponge, - hash: this.hash - }; - }); + async getHash() { + await this.mimcPromise; + return { + sponge: this.sponge, + hash: this.hash + }; } } const mimc = new Mimc(); +// EXTERNAL MODULE: ./node_modules/crypto-browserify/index.js +var crypto_browserify = __webpack_require__(1565); // EXTERNAL MODULE: ./node_modules/bn.js/lib/bn.js var bn = __webpack_require__(9404); -;// CONCATENATED MODULE: ./src/utils.ts -/* provided dependency */ var utils_process = __webpack_require__(5606); +// EXTERNAL MODULE: ./node_modules/@ensdomains/content-hash/src/index.js +var src = __webpack_require__(1810); +;// ./src/utils.ts + BigInt.prototype.toJSON = function() { return this.toString(); }; -const isNode = !utils_process.browser && typeof globalThis.window === "undefined"; +const isNode = !process.browser && typeof globalThis.window === "undefined"; const utils_crypto = isNode ? crypto_browserify.webcrypto : globalThis.crypto; const chunk = (arr, size) => [...Array(Math.ceil(arr.length / size))].map((_, i) => arr.slice(size * i, size + size * i)); function utils_sleep(ms) { @@ -105712,7 +109816,7 @@ function validateUrl(url, protocols) { return protocols.map((p) => p.toLowerCase()).includes(parsedUrl.protocol); } return true; - } catch (e) { + } catch { return false; } } @@ -105729,7 +109833,7 @@ function bufferToBytes(b) { return new Uint8Array(b.buffer); } function bytesToBase64(bytes) { - return btoa(String.fromCharCode.apply(null, Array.from(bytes))); + return btoa(bytes.reduce((data, byte) => data + String.fromCharCode(byte), "")); } function base64ToBytes(base64) { return Uint8Array.from(atob(base64), (c) => c.charCodeAt(0)); @@ -105739,7 +109843,7 @@ function bytesToHex(bytes) { } function hexToBytes(hexString) { if (hexString.slice(0, 2) === "0x") { - hexString = hexString.replace("0x", ""); + hexString = hexString.slice(2); } if (hexString.length % 2 !== 0) { hexString = "0" + hexString; @@ -105751,8 +109855,8 @@ function bytesToBN(bytes) { } function bnToBytes(bigint) { let hexString = typeof bigint === "bigint" ? bigint.toString(16) : bigint; - if (hexString.startsWith("0x")) { - hexString = hexString.replace("0x", ""); + if (hexString.slice(0, 2) === "0x") { + hexString = hexString.slice(2); } if (hexString.length % 2 !== 0) { hexString = "0" + hexString; @@ -105762,7 +109866,7 @@ function bnToBytes(bigint) { function leBuff2Int(bytes) { return new BN(bytes, 16, "le"); } -function src_utils_leInt2Buff(bigint) { +function utils_leInt2Buff(bigint) { return Uint8Array.from(new BN(bigint).toArray("le", 31)); } function toFixedHex(numberish, length = 32) { @@ -105775,6 +109879,9 @@ function toFixedLength(string, length = 32) { function rBigInt(nbytes = 31) { return bytesToBN(utils_crypto.getRandomValues(new Uint8Array(nbytes))); } +function rHex(nbytes = 32) { + return bytesToHex(utils_crypto.getRandomValues(new Uint8Array(nbytes))); +} function bigIntReplacer(key, value) { return typeof value === "bigint" ? value.toString() : value; } @@ -105784,63 +109891,67 @@ function substring(str, length = 10) { } return `${str.substring(0, length)}...${str.substring(str.length - length)}`; } +async function digest(bytes, algo = "SHA-384") { + return new Uint8Array(await utils_crypto.subtle.digest(algo, bytes)); +} +function numberFormatter(num, digits = 3) { + const lookup = [ + { value: 1, symbol: "" }, + { value: 1e3, symbol: "K" }, + { value: 1e6, symbol: "M" }, + { value: 1e9, symbol: "G" }, + { value: 1e12, symbol: "T" }, + { value: 1e15, symbol: "P" }, + { value: 1e18, symbol: "E" } + ]; + const regexp = /\.0+$|(?<=\.[0-9]*[1-9])0+$/; + const item = lookup.slice().reverse().find((item2) => Number(num) >= item2.value); + return item ? (Number(num) / item.value).toFixed(digits).replace(regexp, "").concat(item.symbol) : "0"; +} +function isHex(value) { + return /^0x[0-9a-fA-F]*$/.test(value); +} +function toContentHash(ipfsUrl) { + return contentHashUtils.fromIpfs(ipfsUrl); +} +function fromContentHash(contentHash) { + return contentHashUtils.decode(contentHash); +} -;// CONCATENATED MODULE: ./src/merkleTreeWorker.ts - -var merkleTreeWorker_async = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; +;// ./src/merkleTreeWorker.ts -function nodePostWork() { - return merkleTreeWorker_async(this, null, function* () { - const { hash: hashFunction } = yield mimc.getHash(); - const { merkleTreeHeight, edge, elements, zeroElement } = (worker_threads_ignored_default()).workerData; - if (edge) { - const merkleTree2 = new lib.PartialMerkleTree(merkleTreeHeight, edge, elements, { - zeroElement, - hashFunction - }); - worker_threads_ignored_default().parentPort.postMessage(merkleTree2.toString()); - return; - } - const merkleTree = new lib.MerkleTree(merkleTreeHeight, elements, { + +async function nodePostWork() { + const { hash: hashFunction } = await mimc.getHash(); + const { merkleTreeHeight, edge, elements, zeroElement } = (worker_threads_ignored_default()).workerData; + if (edge) { + const merkleTree2 = new lib.PartialMerkleTree(merkleTreeHeight, edge, elements, { zeroElement, hashFunction }); - worker_threads_ignored_default().parentPort.postMessage(merkleTree.toString()); + worker_threads_ignored_default().parentPort.postMessage(merkleTree2.toString()); + return; + } + const merkleTree = new lib.MerkleTree(merkleTreeHeight, elements, { + zeroElement, + hashFunction }); + worker_threads_ignored_default().parentPort.postMessage(merkleTree.toString()); } if (isNode && (worker_threads_ignored_default())) { nodePostWork(); } else if (!isNode && typeof addEventListener === "function" && typeof postMessage === "function") { - addEventListener("message", (e) => merkleTreeWorker_async(undefined, null, function* () { + addEventListener("message", async (e) => { let data; if (e.data) { data = e.data; } else { data = e; } - const { hash: hashFunction } = yield mimc.getHash(); + const { hash: hashFunction } = await mimc.getHash(); const { merkleTreeHeight, edge, elements, zeroElement } = data; if (edge) { const merkleTree2 = new lib.PartialMerkleTree(merkleTreeHeight, edge, elements, { @@ -105855,7 +109966,7 @@ if (isNode && (worker_threads_ignored_default())) { hashFunction }); postMessage(merkleTree.toString()); - })); + }); } else { throw new Error("This browser / environment does not support workers!"); } diff --git a/dist/merkleTreeWorker.umd.min.js b/dist/merkleTreeWorker.umd.min.js new file mode 100644 index 0000000..5d1f756 --- /dev/null +++ b/dist/merkleTreeWorker.umd.min.js @@ -0,0 +1,2 @@ +/*! For license information please see merkleTreeWorker.umd.min.js.LICENSE.txt */ +globalThis.process={browser:!0,env:{}},function(e,a){if("object"==typeof exports&&"object"==typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var c=a();for(var f in c)("object"==typeof exports?exports:e)[f]=c[f]}}(self,(()=>(()=>{var __webpack_modules__={8176:(e,a,c)=>{const f=c(6613);a.cidForWeb=e=>{let a=new f(e);0===a.version&&(a=a.toV1());let c=a.toString("base32");if(c.length>63){const e=a.toString("base36");if(e.length<=63)return e;throw new TypeError("CID is longer than DNS limit of 63 characters and is not compatible with public gateways")}return c},a.cidV0ToV1Base32=e=>{let a=new f(e);return 0===a.version&&(a=a.toV1()),a.toString("base32")}},1810:(e,a,c)=>{const f=c(2021),d=c(4243),{hexStringToBuffer:b,profiles:t}=c(5262),{cidForWeb:i,cidV0ToV1Base32:r}=c(8176);e.exports={helpers:{cidForWeb:i,cidV0ToV1Base32:r},decode:function(e){const a=b(e),c=f.getCodec(a),d=f.rmPrefix(a);let i=t[c];return i||(i=t.default),i.decode(d)},fromIpfs:function(e){return this.encode("ipfs-ns",e)},fromSkylink:function(e){return this.encode("skynet-ns",e)},fromSwarm:function(e){return this.encode("swarm-ns",e)},fromArweave:function(e){return this.encode("arweave-ns",e)},encode:function(e,a){let c=t[e];c||(c=t.default);const b=c.encode(a);return d.toHexString(f.addPrefix(e,b))},getCodec:function(e){let a=b(e);return f.getCodec(a)}}},5262:(e,a,c)=>{var f=c(2045).hp;const d=c(6613),b=c(4243),t=c(8127),i=e=>{let a=e.slice(0,2),c=e.slice(2),f="";return f="0x"===a?c:e,b.fromHexString(f)},r=e=>{try{const{multihash:a}=e;if(a.length<38){const e=b.decode(a);if("identity"===e.name&&e.length<36)return!1}return!0}catch(e){return!1}},n={skynet:e=>t.toUint8Array(e),swarm:e=>{const a=b.encode(i(e),"keccak-256");return new d(1,"swarm-manifest",a).bytes},ipfs:e=>new d(e).toV1().bytes,ipns:e=>{const a=new d(e);if(!r(a))throw Error("ipns-ns allows only valid cryptographic libp2p-key identifiers, try using ED25519 pubkey instead");return new d(1,"libp2p-key",a.multihash).bytes},utf8:e=>f.from(e,"utf8"),arweave:e=>t.toUint8Array(e)},o={hexMultiHash:e=>{const a=new d(e);return b.decode(a.multihash).digest.toString("hex")},ipfs:e=>{const a=new d(e).toV1();return a.toString("libp2p-key"===a.codec?"base36":"base32")},ipns:e=>{const a=new d(e).toV1();return r(a)?a.toString("base36"):(console.warn("[ensdomains/content-hash] use of non-cryptographic identifiers in ipns-ns is deprecated and will be removed, migrate to ED25519 libp2p-key"),String(b.decode(new d(e).multihash).digest))},utf8:e=>e.toString("utf8"),base64:e=>t.fromUint8Array(e,!0)},s={"skynet-ns":{encode:n.skynet,decode:o.base64},"swarm-ns":{encode:n.swarm,decode:o.hexMultiHash},"ipfs-ns":{encode:n.ipfs,decode:o.ipfs},"ipns-ns":{encode:n.ipns,decode:o.ipns},"arweave-ns":{encode:n.arweave,decode:o.base64},default:{encode:n.utf8,decode:o.utf8}};a.hexStringToBuffer=i,a.profiles=s},5084:e=>{"use strict";e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var a=new Uint8Array(256),c=0;c>>0,n=new Uint8Array(b);e[c];){var o=a[e.charCodeAt(c)];if(255===o)return;for(var s=0,l=b-1;(0!==o||s>>0,n[l]=o%256>>>0,o=o/256>>>0;if(0!==o)throw new Error("Non-zero carry");d=s,c++}if(" "!==e[c]){for(var h=b-d;h!==b&&0===n[h];)h++;for(var u=new Uint8Array(f+(b-h)),x=f;h!==b;)u[x++]=n[h++];return u}}}return{encode:function(a){if(a instanceof Uint8Array||(ArrayBuffer.isView(a)?a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength):Array.isArray(a)&&(a=Uint8Array.from(a))),!(a instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===a.length)return"";for(var c=0,f=0,d=0,b=a.length;d!==b&&0===a[d];)d++,c++;for(var r=(b-d)*n+1>>>0,o=new Uint8Array(r);d!==b;){for(var s=a[d],l=0,h=r-1;(0!==s||l>>0,o[h]=s%t>>>0,s=s/t>>>0;if(0!==s)throw new Error("Non-zero carry");f=l,d++}for(var u=r-f;u!==r&&0===o[u];)u++;for(var x=i.repeat(c);u{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.BaseTree=void 0,a.BaseTree=class{get capacity(){return 2**this.levels}get layers(){return this._layers.slice()}get zeros(){return this._zeros.slice()}get elements(){return this._layers[0].slice()}get root(){var e;return null!==(e=this._layers[this.levels][0])&&void 0!==e?e:this._zeros[this.levels]}static indexOf(e,a,c,f){return f?e.findIndex((e=>f(a,e))):e.indexOf(a,c)}insert(e){if(this._layers[0].length>=this.capacity)throw new Error("Tree is full");this.update(this._layers[0].length,e)}bulkInsert(e){if(e.length){if(this._layers[0].length+e.length>this.capacity)throw new Error("Tree is full");for(let a=0;a>=1;const e=this._layers[c-1][2*f],a=this._layers[c-1][2*f+1];this._layers[c][f]=this._hashFn(e,a)}}this.insert(e[e.length-1])}}update(e,a){if(isNaN(Number(e))||e<0||e>this._layers[0].length||e>=this.capacity)throw new Error("Insert index out of bounds: "+e);this._layers[0][e]=a,this._processUpdate(e)}path(e){if(isNaN(Number(e))||e<0||e>=this._layers[0].length)throw new Error("Index out of bounds: "+e);let a=+e;const c=[],f=[],d=[];for(let e=0;e>=1}return{pathElements:c,pathIndices:f,pathPositions:d,pathRoot:this.root}}_buildZeros(){this._zeros=[this.zeroElement];for(let e=1;e<=this.levels;e++)this._zeros[e]=this._hashFn(this._zeros[e-1],this._zeros[e-1])}_processNodes(e,a){const c=e.length;let f=Math.ceil(c/2);const d=new Array(f);f--;const b=c-(c%2^1);let t=0;for(let i=b;i>=0&&void 0!==e[i-1];i-=2){const r=e[i-1],n=i===b&&c%2==1?this._zeros[a-1]:e[i];d[f-t]=this._hashFn(r,n),t++}return d}_processUpdate(e){for(let a=1;a<=this.levels;a++){e>>=1;const c=this._layers[a-1][2*e],f=2*e+1this.capacity)throw new Error("Tree is full");this._hashFn=c,this.zeroElement=f,this._layers=[];const b=a.slice();this._layers=[b],this._buildZeros(),this._buildHashes()}_buildHashes(){for(let e=1;e<=this.levels;e++){const a=this._layers[e-1];this._layers[e]=this._processNodes(a,e)}}bulkInsert(e){if(e.length){if(this._layers[0].length+e.length>this.capacity)throw new Error("Tree is full");for(let a=0;a>=1,this._layers[c][f]=this._hashFn(this._layers[c-1][2*f],this._layers[c-1][2*f+1])}this.insert(e[e.length-1])}}indexOf(e,a){return b.BaseTree.indexOf(this._layers[0],e,0,a)}proof(e){const a=this.indexOf(e);return this.path(a)}getTreeEdge(e){const a=this._layers[0][e];if(void 0===a)throw new Error("Element not found");return{edgePath:this.path(e),edgeElement:a,edgeIndex:e,edgeElementsCount:this._layers[0].length}}getTreeSlices(e=4){const a=this._layers[0].length;let c=Math.ceil(a/e);c%2&&c++;const f=[];for(let e=0;e(e.set(c,[a,this.edgeLeafProof.pathElements[c]]),e)),new Map),this._proofMap.set(this.levels,[0,this.edgeLeafProof.pathRoot])}_buildTree(){const e=this._edgeLeaf.index;if(this._leaves=Array(e).concat(this._leavesAfterEdge),this._proofMap.has(0)){const[e,a]=this._proofMap.get(0);this._leaves[e]=a}this._layers=[this._leaves],this._buildZeros(),this._buildHashes()}_buildHashes(){for(let e=1;e<=this.levels;e++){const a=this._layers[e-1],c=this._processNodes(a,e);if(this._proofMap.has(e)){const[a,f]=this._proofMap.get(e);c[a]||(c[a]=f)}this._layers[e]=c}}update(e,a){if(isNaN(Number(e))||e<0||e>this._layers[0].length||e>=this.capacity)throw new Error("Insert index out of bounds: "+e);if(e=this._layers[0].length)throw new Error("Index out of bounds: "+e);if(e>=1}return{pathElements:f,pathIndices:d,pathPositions:b,pathRoot:this.root}}indexOf(e,a){return b.BaseTree.indexOf(this._layers[0],e,this.edgeIndex,a)}proof(e){const a=this.indexOf(e);return this.path(a)}shiftEdge(e,a){if(this._edgeLeaf.index<=e.edgeIndex)throw new Error(`New edgeIndex should be smaller then ${this._edgeLeaf.index}`);if(a.length!==this._edgeLeaf.index-e.edgeIndex)throw new Error("Elements length should be "+(this._edgeLeaf.index-e.edgeIndex));this._edgeLeafProof=e.edgePath,this._edgeLeaf={index:e.edgeIndex,data:e.edgeElement},this._leavesAfterEdge=[...a,...this._leavesAfterEdge],this._createProofMap(),this._buildTree()}serialize(){return{_edgeLeafProof:this._edgeLeafProof,_edgeLeaf:this._edgeLeaf,_layers:this._layers,_zeros:this._zeros,levels:this.levels}}static deserialize(e,a){const c=Object.assign(Object.create(this.prototype),e);return c._hashFn=a||d.default,c._initialRoot=e._edgeLeafProof.pathRoot,c.zeroElement=c._zeros[0],c._leavesAfterEdge=c._layers[0].slice(e._edgeLeaf.index),c._createProofMap(),c}toString(){return JSON.stringify(this.serialize())}}a.PartialMerkleTree=t},1217:function(e,a,c){"use strict";var f=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(a,"__esModule",{value:!0}),a.MerkleTree=a.simpleHash=a.PartialMerkleTree=void 0;const d=f(c(9093));Object.defineProperty(a,"MerkleTree",{enumerable:!0,get:function(){return d.default}});var b=c(1230);Object.defineProperty(a,"PartialMerkleTree",{enumerable:!0,get:function(){return b.PartialMerkleTree}});var t=c(5319);Object.defineProperty(a,"simpleHash",{enumerable:!0,get:function(){return t.simpleHash}}),a.default=d.default},5319:(e,a)=>{"use strict";function c(e,a,c=40){const f=e.join("");let d,b,t=null!=a?a:34658180293;for(d=0,b=f.length;d>>0).toString(16);return BigInt("0x"+i.padEnd(c-(i.length-1),"0")).toString(10)}Object.defineProperty(a,"__esModule",{value:!0}),a.simpleHash=void 0,a.simpleHash=c,a.default=(e,a)=>c([e,a])},7568:(e,a,c)=>{var f=a;f.bignum=c(2344),f.define=c(7363).define,f.base=c(9673),f.constants=c(2153),f.decoders=c(2853),f.encoders=c(4669)},7363:(e,a,c)=>{var f=c(7568),d=c(6698);function b(e,a){this.name=e,this.body=a,this.decoders={},this.encoders={}}a.define=function(e,a){return new b(e,a)},b.prototype._createNamed=function(e){var a;try{a=c(8961).runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(e){a=function(e){this._initNamed(e)}}return d(a,e),a.prototype._initNamed=function(a){e.call(this,a)},new a(this)},b.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(f.decoders[e])),this.decoders[e]},b.prototype.decode=function(e,a,c){return this._getDecoder(a).decode(e,c)},b.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(f.encoders[e])),this.encoders[e]},b.prototype.encode=function(e,a,c){return this._getEncoder(a).encode(e,c)}},7227:(e,a,c)=>{var f=c(6698),d=c(9673).Reporter,b=c(8287).Buffer;function t(e,a){d.call(this,a),b.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function i(e,a){if(Array.isArray(e))this.length=0,this.value=e.map((function(e){return e instanceof i||(e=new i(e,a)),this.length+=e.length,e}),this);else if("number"==typeof e){if(!(0<=e&&e<=255))return a.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=b.byteLength(e);else{if(!b.isBuffer(e))return a.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}f(t,d),a.t=t,t.prototype.save=function(){return{offset:this.offset,reporter:d.prototype.save.call(this)}},t.prototype.restore=function(e){var a=new t(this.base);return a.offset=e.offset,a.length=this.offset,this.offset=e.offset,d.prototype.restore.call(this,e.reporter),a},t.prototype.isEmpty=function(){return this.offset===this.length},t.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},t.prototype.skip=function(e,a){if(!(this.offset+e<=this.length))return this.error(a||"DecoderBuffer overrun");var c=new t(this.base);return c._reporterState=this._reporterState,c.offset=this.offset,c.length=this.offset+e,this.offset+=e,c},t.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},a.d=i,i.prototype.join=function(e,a){return e||(e=new b(this.length)),a||(a=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(c){c.join(e,a),a+=c.length})):("number"==typeof this.value?e[a]=this.value:"string"==typeof this.value?e.write(this.value,a):b.isBuffer(this.value)&&this.value.copy(e,a),a+=this.length)),e}},9673:(e,a,c)=>{var f=a;f.Reporter=c(9220).a,f.DecoderBuffer=c(7227).t,f.EncoderBuffer=c(7227).d,f.Node=c(993)},993:(e,a,c)=>{var f=c(9673).Reporter,d=c(9673).EncoderBuffer,b=c(9673).DecoderBuffer,t=c(3349),i=["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"],r=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(i);function n(e,a){var c={};this._baseState=c,c.enc=e,c.parent=a||null,c.children=null,c.tag=null,c.args=null,c.reverseArgs=null,c.choice=null,c.optional=!1,c.any=!1,c.obj=!1,c.use=null,c.useDecoder=null,c.key=null,c.default=null,c.explicit=null,c.implicit=null,c.contains=null,c.parent||(c.children=[],this._wrap())}e.exports=n;var o=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];n.prototype.clone=function(){var e=this._baseState,a={};o.forEach((function(c){a[c]=e[c]}));var c=new this.constructor(a.parent);return c._baseState=a,c},n.prototype._wrap=function(){var e=this._baseState;r.forEach((function(a){this[a]=function(){var c=new this.constructor(this);return e.children.push(c),c[a].apply(c,arguments)}}),this)},n.prototype._init=function(e){var a=this._baseState;t(null===a.parent),e.call(this),a.children=a.children.filter((function(e){return e._baseState.parent===this}),this),t.equal(a.children.length,1,"Root node can have only one child")},n.prototype._useArgs=function(e){var a=this._baseState,c=e.filter((function(e){return e instanceof this.constructor}),this);e=e.filter((function(e){return!(e instanceof this.constructor)}),this),0!==c.length&&(t(null===a.children),a.children=c,c.forEach((function(e){e._baseState.parent=this}),this)),0!==e.length&&(t(null===a.args),a.args=e,a.reverseArgs=e.map((function(e){if("object"!=typeof e||e.constructor!==Object)return e;var a={};return Object.keys(e).forEach((function(c){c==(0|c)&&(c|=0);var f=e[c];a[f]=c})),a})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(e){n.prototype[e]=function(){var a=this._baseState;throw new Error(e+" not implemented for encoding: "+a.enc)}})),i.forEach((function(e){n.prototype[e]=function(){var a=this._baseState,c=Array.prototype.slice.call(arguments);return t(null===a.tag),a.tag=e,this._useArgs(c),this}})),n.prototype.use=function(e){t(e);var a=this._baseState;return t(null===a.use),a.use=e,this},n.prototype.optional=function(){return this._baseState.optional=!0,this},n.prototype.def=function(e){var a=this._baseState;return t(null===a.default),a.default=e,a.optional=!0,this},n.prototype.explicit=function(e){var a=this._baseState;return t(null===a.explicit&&null===a.implicit),a.explicit=e,this},n.prototype.implicit=function(e){var a=this._baseState;return t(null===a.explicit&&null===a.implicit),a.implicit=e,this},n.prototype.obj=function(){var e=this._baseState,a=Array.prototype.slice.call(arguments);return e.obj=!0,0!==a.length&&this._useArgs(a),this},n.prototype.key=function(e){var a=this._baseState;return t(null===a.key),a.key=e,this},n.prototype.any=function(){return this._baseState.any=!0,this},n.prototype.choice=function(e){var a=this._baseState;return t(null===a.choice),a.choice=e,this._useArgs(Object.keys(e).map((function(a){return e[a]}))),this},n.prototype.contains=function(e){var a=this._baseState;return t(null===a.use),a.contains=e,this},n.prototype._decode=function(e,a){var c=this._baseState;if(null===c.parent)return e.wrapResult(c.children[0]._decode(e,a));var f,d=c.default,t=!0,i=null;if(null!==c.key&&(i=e.enterKey(c.key)),c.optional){var r=null;if(null!==c.explicit?r=c.explicit:null!==c.implicit?r=c.implicit:null!==c.tag&&(r=c.tag),null!==r||c.any){if(t=this._peekTag(e,r,c.any),e.isError(t))return t}else{var n=e.save();try{null===c.choice?this._decodeGeneric(c.tag,e,a):this._decodeChoice(e,a),t=!0}catch(e){t=!1}e.restore(n)}}if(c.obj&&t&&(f=e.enterObject()),t){if(null!==c.explicit){var o=this._decodeTag(e,c.explicit);if(e.isError(o))return o;e=o}var s=e.offset;if(null===c.use&&null===c.choice){c.any&&(n=e.save());var l=this._decodeTag(e,null!==c.implicit?c.implicit:c.tag,c.any);if(e.isError(l))return l;c.any?d=e.raw(n):e=l}if(a&&a.track&&null!==c.tag&&a.track(e.path(),s,e.length,"tagged"),a&&a.track&&null!==c.tag&&a.track(e.path(),e.offset,e.length,"content"),c.any||(d=null===c.choice?this._decodeGeneric(c.tag,e,a):this._decodeChoice(e,a)),e.isError(d))return d;if(c.any||null!==c.choice||null===c.children||c.children.forEach((function(c){c._decode(e,a)})),c.contains&&("octstr"===c.tag||"bitstr"===c.tag)){var h=new b(d);d=this._getUse(c.contains,e._reporterState.obj)._decode(h,a)}}return c.obj&&t&&(d=e.leaveObject(f)),null===c.key||null===d&&!0!==t?null!==i&&e.exitKey(i):e.leaveKey(i,c.key,d),d},n.prototype._decodeGeneric=function(e,a,c){var f=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(a,e,f.args[0],c):/str$/.test(e)?this._decodeStr(a,e,c):"objid"===e&&f.args?this._decodeObjid(a,f.args[0],f.args[1],c):"objid"===e?this._decodeObjid(a,null,null,c):"gentime"===e||"utctime"===e?this._decodeTime(a,e,c):"null_"===e?this._decodeNull(a,c):"bool"===e?this._decodeBool(a,c):"objDesc"===e?this._decodeStr(a,e,c):"int"===e||"enum"===e?this._decodeInt(a,f.args&&f.args[0],c):null!==f.use?this._getUse(f.use,a._reporterState.obj)._decode(a,c):a.error("unknown tag: "+e)},n.prototype._getUse=function(e,a){var c=this._baseState;return c.useDecoder=this._use(e,a),t(null===c.useDecoder._baseState.parent),c.useDecoder=c.useDecoder._baseState.children[0],c.implicit!==c.useDecoder._baseState.implicit&&(c.useDecoder=c.useDecoder.clone(),c.useDecoder._baseState.implicit=c.implicit),c.useDecoder},n.prototype._decodeChoice=function(e,a){var c=this._baseState,f=null,d=!1;return Object.keys(c.choice).some((function(b){var t=e.save(),i=c.choice[b];try{var r=i._decode(e,a);if(e.isError(r))return!1;f={type:b,value:r},d=!0}catch(a){return e.restore(t),!1}return!0}),this),d?f:e.error("Choice not matched")},n.prototype._createEncoderBuffer=function(e){return new d(e,this.reporter)},n.prototype._encode=function(e,a,c){var f=this._baseState;if(null===f.default||f.default!==e){var d=this._encodeValue(e,a,c);if(void 0!==d&&!this._skipDefault(d,a,c))return d}},n.prototype._encodeValue=function(e,a,c){var d=this._baseState;if(null===d.parent)return d.children[0]._encode(e,a||new f);var b=null;if(this.reporter=a,d.optional&&void 0===e){if(null===d.default)return;e=d.default}var t=null,i=!1;if(d.any)b=this._createEncoderBuffer(e);else if(d.choice)b=this._encodeChoice(e,a);else if(d.contains)t=this._getUse(d.contains,c)._encode(e,a),i=!0;else if(d.children)t=d.children.map((function(c){if("null_"===c._baseState.tag)return c._encode(null,a,e);if(null===c._baseState.key)return a.error("Child should have a key");var f=a.enterKey(c._baseState.key);if("object"!=typeof e)return a.error("Child expected, but input is not object");var d=c._encode(e[c._baseState.key],a,e);return a.leaveKey(f),d}),this).filter((function(e){return e})),t=this._createEncoderBuffer(t);else if("seqof"===d.tag||"setof"===d.tag){if(!d.args||1!==d.args.length)return a.error("Too many args for : "+d.tag);if(!Array.isArray(e))return a.error("seqof/setof, but data is not Array");var r=this.clone();r._baseState.implicit=null,t=this._createEncoderBuffer(e.map((function(c){var f=this._baseState;return this._getUse(f.args[0],e)._encode(c,a)}),r))}else null!==d.use?b=this._getUse(d.use,c)._encode(e,a):(t=this._encodePrimitive(d.tag,e),i=!0);if(!d.any&&null===d.choice){var n=null!==d.implicit?d.implicit:d.tag,o=null===d.implicit?"universal":"context";null===n?null===d.use&&a.error("Tag could be omitted only for .use()"):null===d.use&&(b=this._encodeComposite(n,i,o,t))}return null!==d.explicit&&(b=this._encodeComposite(d.explicit,!1,"context",b)),b},n.prototype._encodeChoice=function(e,a){var c=this._baseState,f=c.choice[e.type];return f||t(!1,e.type+" not found in "+JSON.stringify(Object.keys(c.choice))),f._encode(e.value,a)},n.prototype._encodePrimitive=function(e,a){var c=this._baseState;if(/str$/.test(e))return this._encodeStr(a,e);if("objid"===e&&c.args)return this._encodeObjid(a,c.reverseArgs[0],c.args[1]);if("objid"===e)return this._encodeObjid(a,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(a,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(a,c.args&&c.reverseArgs[0]);if("bool"===e)return this._encodeBool(a);if("objDesc"===e)return this._encodeStr(a,e);throw new Error("Unsupported tag: "+e)},n.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},n.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e)}},9220:(e,a,c)=>{var f=c(6698);function d(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function b(e,a){this.path=e,this.rethrow(a)}a.a=d,d.prototype.isError=function(e){return e instanceof b},d.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},d.prototype.restore=function(e){var a=this._reporterState;a.obj=e.obj,a.path=a.path.slice(0,e.pathLen)},d.prototype.enterKey=function(e){return this._reporterState.path.push(e)},d.prototype.exitKey=function(e){var a=this._reporterState;a.path=a.path.slice(0,e-1)},d.prototype.leaveKey=function(e,a,c){var f=this._reporterState;this.exitKey(e),null!==f.obj&&(f.obj[a]=c)},d.prototype.path=function(){return this._reporterState.path.join("/")},d.prototype.enterObject=function(){var e=this._reporterState,a=e.obj;return e.obj={},a},d.prototype.leaveObject=function(e){var a=this._reporterState,c=a.obj;return a.obj=e,c},d.prototype.error=function(e){var a,c=this._reporterState,f=e instanceof b;if(a=f?e:new b(c.path.map((function(e){return"["+JSON.stringify(e)+"]"})).join(""),e.message||e,e.stack),!c.options.partial)throw a;return f||c.errors.push(a),a},d.prototype.wrapResult=function(e){var a=this._reporterState;return a.options.partial?{result:this.isError(e)?null:e,errors:a.errors}:e},f(b,Error),b.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,b),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},4598:(e,a,c)=>{var f=c(2153);a.tagClass={0:"universal",1:"application",2:"context",3:"private"},a.tagClassByName=f._reverse(a.tagClass),a.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},a.tagByName=f._reverse(a.tag)},2153:(e,a,c)=>{var f=a;f._reverse=function(e){var a={};return Object.keys(e).forEach((function(c){(0|c)==c&&(c|=0);var f=e[c];a[f]=c})),a},f.der=c(4598)},2010:(e,a,c)=>{var f=c(6698),d=c(7568),b=d.base,t=d.bignum,i=d.constants.der;function r(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new n,this.tree._init(e.body)}function n(e){b.Node.call(this,"der",e)}function o(e,a){var c=e.readUInt8(a);if(e.isError(c))return c;var f=i.tagClass[c>>6],d=!(32&c);if(31&~c)c&=31;else{var b=c;for(c=0;!(128&~b);){if(b=e.readUInt8(a),e.isError(b))return b;c<<=7,c|=127&b}}return{cls:f,primitive:d,tag:c,tagStr:i.tag[c]}}function s(e,a,c){var f=e.readUInt8(c);if(e.isError(f))return f;if(!a&&128===f)return null;if(!(128&f))return f;var d=127&f;if(d>4)return e.error("length octect is too long");f=0;for(var b=0;b{var f=a;f.der=c(2010),f.pem=c(8903)},8903:(e,a,c)=>{var f=c(6698),d=c(8287).Buffer,b=c(2010);function t(e){b.call(this,e),this.enc="pem"}f(t,b),e.exports=t,t.prototype.decode=function(e,a){for(var c=e.toString().split(/[\r\n]+/g),f=a.label.toUpperCase(),t=/^-----(BEGIN|END) ([^-]+)-----$/,i=-1,r=-1,n=0;n{var f=c(6698),d=c(8287).Buffer,b=c(7568),t=b.base,i=b.constants.der;function r(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new n,this.tree._init(e.body)}function n(e){t.Node.call(this,"der",e)}function o(e){return e<10?"0"+e:e}e.exports=r,r.prototype.encode=function(e,a){return this.tree._encode(e,a).join()},f(n,t.Node),n.prototype._encodeComposite=function(e,a,c,f){var b,t=function(e,a,c,f){var d;if("seqof"===e?e="seq":"setof"===e&&(e="set"),i.tagByName.hasOwnProperty(e))d=i.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return f.error("Unknown tag: "+e);d=e}return d>=31?f.error("Multi-octet tag encoding unsupported"):(a||(d|=32),d|=i.tagClassByName[c||"universal"]<<6)}(e,a,c,this.reporter);if(f.length<128)return(b=new d(2))[0]=t,b[1]=f.length,this._createEncoderBuffer([b,f]);for(var r=1,n=f.length;n>=256;n>>=8)r++;(b=new d(2+r))[0]=t,b[1]=128|r,n=1+r;for(var o=f.length;o>0;n--,o>>=8)b[n]=255&o;return this._createEncoderBuffer([b,f])},n.prototype._encodeStr=function(e,a){if("bitstr"===a)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===a){for(var c=new d(2*e.length),f=0;f=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}var b=0;for(f=0;f=128;t>>=7)b++}var i=new d(b),r=i.length-1;for(f=e.length-1;f>=0;f--)for(t=e[f],i[r--]=127&t;(t>>=7)>0;)i[r--]=128|127&t;return this._createEncoderBuffer(i)},n.prototype._encodeTime=function(e,a){var c,f=new Date(e);return"gentime"===a?c=[o(f.getFullYear()),o(f.getUTCMonth()+1),o(f.getUTCDate()),o(f.getUTCHours()),o(f.getUTCMinutes()),o(f.getUTCSeconds()),"Z"].join(""):"utctime"===a?c=[o(f.getFullYear()%100),o(f.getUTCMonth()+1),o(f.getUTCDate()),o(f.getUTCHours()),o(f.getUTCMinutes()),o(f.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+a+" time is not supported yet"),this._encodeStr(c,"octstr")},n.prototype._encodeNull=function(){return this._createEncoderBuffer("")},n.prototype._encodeInt=function(e,a){if("string"==typeof e){if(!a)return this.reporter.error("String int or enum given, but no values map");if(!a.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=a[e]}if("number"!=typeof e&&!d.isBuffer(e)){var c=e.toArray();!e.sign&&128&c[0]&&c.unshift(0),e=new d(c)}if(d.isBuffer(e)){var f=e.length;0===e.length&&f++;var b=new d(f);return e.copy(b),0===e.length&&(b[0]=0),this._createEncoderBuffer(b)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);f=1;for(var t=e;t>=256;t>>=8)f++;for(t=(b=new Array(f)).length-1;t>=0;t--)b[t]=255&e,e>>=8;return 128&b[0]&&b.unshift(0),this._createEncoderBuffer(new d(b))},n.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},n.prototype._use=function(e,a){return"function"==typeof e&&(e=e(a)),e._getEncoder("der").tree},n.prototype._skipDefault=function(e,a,c){var f,d=this._baseState;if(null===d.default)return!1;var b=e.join();if(void 0===d.defaultBuffer&&(d.defaultBuffer=this._encodeValue(d.default,a,c).join()),b.length!==d.defaultBuffer.length)return!1;for(f=0;f{var f=a;f.der=c(82),f.pem=c(735)},735:(e,a,c)=>{var f=c(6698),d=c(82);function b(e){d.call(this,e),this.enc="pem"}f(b,d),e.exports=b,b.prototype.encode=function(e,a){for(var c=d.prototype.encode.call(this,e).toString("base64"),f=["-----BEGIN "+a.label+"-----"],b=0;b=65&&c<=70?c-55:c>=97&&c<=102?c-87:c-48&15}function r(e,a,c){var f=i(e,c);return c-1>=a&&(f|=i(e,c-1)<<4),f}function n(e,a,c,f){for(var d=0,b=Math.min(e.length,c),t=a;t=49?i-49+10:i>=17?i-17+10:i}return d}b.isBN=function(e){return e instanceof b||null!==e&&"object"==typeof e&&e.constructor.wordSize===b.wordSize&&Array.isArray(e.words)},b.max=function(e,a){return e.cmp(a)>0?e:a},b.min=function(e,a){return e.cmp(a)<0?e:a},b.prototype._init=function(e,a,c){if("number"==typeof e)return this._initNumber(e,a,c);if("object"==typeof e)return this._initArray(e,a,c);"hex"===a&&(a=16),f(a===(0|a)&&a>=2&&a<=36);var d=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(d++,this.negative=1),d=0;d-=3)t=e[d]|e[d-1]<<8|e[d-2]<<16,this.words[b]|=t<>>26-i&67108863,(i+=24)>=26&&(i-=26,b++);else if("le"===c)for(d=0,b=0;d>>26-i&67108863,(i+=24)>=26&&(i-=26,b++);return this.strip()},b.prototype._parseHex=function(e,a,c){this.length=Math.ceil((e.length-a)/6),this.words=new Array(this.length);for(var f=0;f=a;f-=2)d=r(e,a,f)<=18?(b-=18,t+=1,this.words[t]|=d>>>26):b+=8;else for(f=(e.length-a)%2==0?a+1:a;f=18?(b-=18,t+=1,this.words[t]|=d>>>26):b+=8;this.strip()},b.prototype._parseBase=function(e,a,c){this.words=[0],this.length=1;for(var f=0,d=1;d<=67108863;d*=a)f++;f--,d=d/a|0;for(var b=e.length-c,t=b%f,i=Math.min(b,b-t)+c,r=0,o=c;o1&&0===this.words[this.length-1];)this.length--;return this._normSign()},b.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},b.prototype.inspect=function(){return(this.red?""};var o=["","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"],s=[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],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function h(e,a,c){c.negative=a.negative^e.negative;var f=e.length+a.length|0;c.length=f,f=f-1|0;var d=0|e.words[0],b=0|a.words[0],t=d*b,i=67108863&t,r=t/67108864|0;c.words[0]=i;for(var n=1;n>>26,s=67108863&r,l=Math.min(n,a.length-1),h=Math.max(0,n-e.length+1);h<=l;h++){var u=n-h|0;o+=(t=(d=0|e.words[u])*(b=0|a.words[h])+s)/67108864|0,s=67108863&t}c.words[n]=0|s,r=0|o}return 0!==r?c.words[n]=0|r:c.length--,c.strip()}b.prototype.toString=function(e,a){var c;if(a=0|a||1,16===(e=e||10)||"hex"===e){c="";for(var d=0,b=0,t=0;t>>24-d&16777215)||t!==this.length-1?o[6-r.length]+r+c:r+c,(d+=2)>=26&&(d-=26,t--)}for(0!==b&&(c=b.toString(16)+c);c.length%a!=0;)c="0"+c;return 0!==this.negative&&(c="-"+c),c}if(e===(0|e)&&e>=2&&e<=36){var n=s[e],h=l[e];c="";var u=this.clone();for(u.negative=0;!u.isZero();){var x=u.modn(h).toString(e);c=(u=u.idivn(h)).isZero()?x+c:o[n-x.length]+x+c}for(this.isZero()&&(c="0"+c);c.length%a!=0;)c="0"+c;return 0!==this.negative&&(c="-"+c),c}f(!1,"Base should be between 2 and 36")},b.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&f(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},b.prototype.toJSON=function(){return this.toString(16)},b.prototype.toBuffer=function(e,a){return f(void 0!==t),this.toArrayLike(t,e,a)},b.prototype.toArray=function(e,a){return this.toArrayLike(Array,e,a)},b.prototype.toArrayLike=function(e,a,c){var d=this.byteLength(),b=c||Math.max(1,d);f(d<=b,"byte array longer than desired length"),f(b>0,"Requested array length <= 0"),this.strip();var t,i,r="le"===a,n=new e(b),o=this.clone();if(r){for(i=0;!o.isZero();i++)t=o.andln(255),o.iushrn(8),n[i]=t;for(;i=4096&&(c+=13,a>>>=13),a>=64&&(c+=7,a>>>=7),a>=8&&(c+=4,a>>>=4),a>=2&&(c+=2,a>>>=2),c+a},b.prototype._zeroBits=function(e){if(0===e)return 26;var a=e,c=0;return 8191&a||(c+=13,a>>>=13),127&a||(c+=7,a>>>=7),15&a||(c+=4,a>>>=4),3&a||(c+=2,a>>>=2),1&a||c++,c},b.prototype.bitLength=function(){var e=this.words[this.length-1],a=this._countBits(e);return 26*(this.length-1)+a},b.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,a=0;ae.length?this.clone().ior(e):e.clone().ior(this)},b.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},b.prototype.iuand=function(e){var a;a=this.length>e.length?e:this;for(var c=0;ce.length?this.clone().iand(e):e.clone().iand(this)},b.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},b.prototype.iuxor=function(e){var a,c;this.length>e.length?(a=this,c=e):(a=e,c=this);for(var f=0;fe.length?this.clone().ixor(e):e.clone().ixor(this)},b.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},b.prototype.inotn=function(e){f("number"==typeof e&&e>=0);var a=0|Math.ceil(e/26),c=e%26;this._expand(a),c>0&&a--;for(var d=0;d0&&(this.words[d]=~this.words[d]&67108863>>26-c),this.strip()},b.prototype.notn=function(e){return this.clone().inotn(e)},b.prototype.setn=function(e,a){f("number"==typeof e&&e>=0);var c=e/26|0,d=e%26;return this._expand(c+1),this.words[c]=a?this.words[c]|1<e.length?(c=this,f=e):(c=e,f=this);for(var d=0,b=0;b>>26;for(;0!==d&&b>>26;if(this.length=c.length,0!==d)this.words[this.length]=d,this.length++;else if(c!==this)for(;be.length?this.clone().iadd(e):e.clone().iadd(this)},b.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var a=this.iadd(e);return e.negative=1,a._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var c,f,d=this.cmp(e);if(0===d)return this.negative=0,this.length=1,this.words[0]=0,this;d>0?(c=this,f=e):(c=e,f=this);for(var b=0,t=0;t>26,this.words[t]=67108863&a;for(;0!==b&&t>26,this.words[t]=67108863&a;if(0===b&&t>>13,h=0|t[1],u=8191&h,x=h>>>13,p=0|t[2],g=8191&p,m=p>>>13,y=0|t[3],_=8191&y,v=y>>>13,w=0|t[4],M=8191&w,A=w>>>13,L=0|t[5],I=8191&L,k=L>>>13,E=0|t[6],S=8191&E,C=E>>>13,B=0|t[7],F=8191&B,O=B>>>13,P=0|t[8],R=8191&P,T=P>>>13,U=0|t[9],j=8191&U,N=U>>>13,q=0|i[0],D=8191&q,z=q>>>13,Q=0|i[1],G=8191&Q,K=Q>>>13,H=0|i[2],V=8191&H,Z=H>>>13,W=0|i[3],Y=8191&W,J=W>>>13,$=0|i[4],X=8191&$,ee=$>>>13,ae=0|i[5],ce=8191&ae,fe=ae>>>13,de=0|i[6],be=8191&de,te=de>>>13,ie=0|i[7],re=8191&ie,ne=ie>>>13,oe=0|i[8],se=8191&oe,le=oe>>>13,he=0|i[9],ue=8191&he,xe=he>>>13;c.negative=e.negative^a.negative,c.length=19;var pe=(n+(f=Math.imul(s,D))|0)+((8191&(d=(d=Math.imul(s,z))+Math.imul(l,D)|0))<<13)|0;n=((b=Math.imul(l,z))+(d>>>13)|0)+(pe>>>26)|0,pe&=67108863,f=Math.imul(u,D),d=(d=Math.imul(u,z))+Math.imul(x,D)|0,b=Math.imul(x,z);var ge=(n+(f=f+Math.imul(s,G)|0)|0)+((8191&(d=(d=d+Math.imul(s,K)|0)+Math.imul(l,G)|0))<<13)|0;n=((b=b+Math.imul(l,K)|0)+(d>>>13)|0)+(ge>>>26)|0,ge&=67108863,f=Math.imul(g,D),d=(d=Math.imul(g,z))+Math.imul(m,D)|0,b=Math.imul(m,z),f=f+Math.imul(u,G)|0,d=(d=d+Math.imul(u,K)|0)+Math.imul(x,G)|0,b=b+Math.imul(x,K)|0;var me=(n+(f=f+Math.imul(s,V)|0)|0)+((8191&(d=(d=d+Math.imul(s,Z)|0)+Math.imul(l,V)|0))<<13)|0;n=((b=b+Math.imul(l,Z)|0)+(d>>>13)|0)+(me>>>26)|0,me&=67108863,f=Math.imul(_,D),d=(d=Math.imul(_,z))+Math.imul(v,D)|0,b=Math.imul(v,z),f=f+Math.imul(g,G)|0,d=(d=d+Math.imul(g,K)|0)+Math.imul(m,G)|0,b=b+Math.imul(m,K)|0,f=f+Math.imul(u,V)|0,d=(d=d+Math.imul(u,Z)|0)+Math.imul(x,V)|0,b=b+Math.imul(x,Z)|0;var ye=(n+(f=f+Math.imul(s,Y)|0)|0)+((8191&(d=(d=d+Math.imul(s,J)|0)+Math.imul(l,Y)|0))<<13)|0;n=((b=b+Math.imul(l,J)|0)+(d>>>13)|0)+(ye>>>26)|0,ye&=67108863,f=Math.imul(M,D),d=(d=Math.imul(M,z))+Math.imul(A,D)|0,b=Math.imul(A,z),f=f+Math.imul(_,G)|0,d=(d=d+Math.imul(_,K)|0)+Math.imul(v,G)|0,b=b+Math.imul(v,K)|0,f=f+Math.imul(g,V)|0,d=(d=d+Math.imul(g,Z)|0)+Math.imul(m,V)|0,b=b+Math.imul(m,Z)|0,f=f+Math.imul(u,Y)|0,d=(d=d+Math.imul(u,J)|0)+Math.imul(x,Y)|0,b=b+Math.imul(x,J)|0;var _e=(n+(f=f+Math.imul(s,X)|0)|0)+((8191&(d=(d=d+Math.imul(s,ee)|0)+Math.imul(l,X)|0))<<13)|0;n=((b=b+Math.imul(l,ee)|0)+(d>>>13)|0)+(_e>>>26)|0,_e&=67108863,f=Math.imul(I,D),d=(d=Math.imul(I,z))+Math.imul(k,D)|0,b=Math.imul(k,z),f=f+Math.imul(M,G)|0,d=(d=d+Math.imul(M,K)|0)+Math.imul(A,G)|0,b=b+Math.imul(A,K)|0,f=f+Math.imul(_,V)|0,d=(d=d+Math.imul(_,Z)|0)+Math.imul(v,V)|0,b=b+Math.imul(v,Z)|0,f=f+Math.imul(g,Y)|0,d=(d=d+Math.imul(g,J)|0)+Math.imul(m,Y)|0,b=b+Math.imul(m,J)|0,f=f+Math.imul(u,X)|0,d=(d=d+Math.imul(u,ee)|0)+Math.imul(x,X)|0,b=b+Math.imul(x,ee)|0;var ve=(n+(f=f+Math.imul(s,ce)|0)|0)+((8191&(d=(d=d+Math.imul(s,fe)|0)+Math.imul(l,ce)|0))<<13)|0;n=((b=b+Math.imul(l,fe)|0)+(d>>>13)|0)+(ve>>>26)|0,ve&=67108863,f=Math.imul(S,D),d=(d=Math.imul(S,z))+Math.imul(C,D)|0,b=Math.imul(C,z),f=f+Math.imul(I,G)|0,d=(d=d+Math.imul(I,K)|0)+Math.imul(k,G)|0,b=b+Math.imul(k,K)|0,f=f+Math.imul(M,V)|0,d=(d=d+Math.imul(M,Z)|0)+Math.imul(A,V)|0,b=b+Math.imul(A,Z)|0,f=f+Math.imul(_,Y)|0,d=(d=d+Math.imul(_,J)|0)+Math.imul(v,Y)|0,b=b+Math.imul(v,J)|0,f=f+Math.imul(g,X)|0,d=(d=d+Math.imul(g,ee)|0)+Math.imul(m,X)|0,b=b+Math.imul(m,ee)|0,f=f+Math.imul(u,ce)|0,d=(d=d+Math.imul(u,fe)|0)+Math.imul(x,ce)|0,b=b+Math.imul(x,fe)|0;var we=(n+(f=f+Math.imul(s,be)|0)|0)+((8191&(d=(d=d+Math.imul(s,te)|0)+Math.imul(l,be)|0))<<13)|0;n=((b=b+Math.imul(l,te)|0)+(d>>>13)|0)+(we>>>26)|0,we&=67108863,f=Math.imul(F,D),d=(d=Math.imul(F,z))+Math.imul(O,D)|0,b=Math.imul(O,z),f=f+Math.imul(S,G)|0,d=(d=d+Math.imul(S,K)|0)+Math.imul(C,G)|0,b=b+Math.imul(C,K)|0,f=f+Math.imul(I,V)|0,d=(d=d+Math.imul(I,Z)|0)+Math.imul(k,V)|0,b=b+Math.imul(k,Z)|0,f=f+Math.imul(M,Y)|0,d=(d=d+Math.imul(M,J)|0)+Math.imul(A,Y)|0,b=b+Math.imul(A,J)|0,f=f+Math.imul(_,X)|0,d=(d=d+Math.imul(_,ee)|0)+Math.imul(v,X)|0,b=b+Math.imul(v,ee)|0,f=f+Math.imul(g,ce)|0,d=(d=d+Math.imul(g,fe)|0)+Math.imul(m,ce)|0,b=b+Math.imul(m,fe)|0,f=f+Math.imul(u,be)|0,d=(d=d+Math.imul(u,te)|0)+Math.imul(x,be)|0,b=b+Math.imul(x,te)|0;var Me=(n+(f=f+Math.imul(s,re)|0)|0)+((8191&(d=(d=d+Math.imul(s,ne)|0)+Math.imul(l,re)|0))<<13)|0;n=((b=b+Math.imul(l,ne)|0)+(d>>>13)|0)+(Me>>>26)|0,Me&=67108863,f=Math.imul(R,D),d=(d=Math.imul(R,z))+Math.imul(T,D)|0,b=Math.imul(T,z),f=f+Math.imul(F,G)|0,d=(d=d+Math.imul(F,K)|0)+Math.imul(O,G)|0,b=b+Math.imul(O,K)|0,f=f+Math.imul(S,V)|0,d=(d=d+Math.imul(S,Z)|0)+Math.imul(C,V)|0,b=b+Math.imul(C,Z)|0,f=f+Math.imul(I,Y)|0,d=(d=d+Math.imul(I,J)|0)+Math.imul(k,Y)|0,b=b+Math.imul(k,J)|0,f=f+Math.imul(M,X)|0,d=(d=d+Math.imul(M,ee)|0)+Math.imul(A,X)|0,b=b+Math.imul(A,ee)|0,f=f+Math.imul(_,ce)|0,d=(d=d+Math.imul(_,fe)|0)+Math.imul(v,ce)|0,b=b+Math.imul(v,fe)|0,f=f+Math.imul(g,be)|0,d=(d=d+Math.imul(g,te)|0)+Math.imul(m,be)|0,b=b+Math.imul(m,te)|0,f=f+Math.imul(u,re)|0,d=(d=d+Math.imul(u,ne)|0)+Math.imul(x,re)|0,b=b+Math.imul(x,ne)|0;var Ae=(n+(f=f+Math.imul(s,se)|0)|0)+((8191&(d=(d=d+Math.imul(s,le)|0)+Math.imul(l,se)|0))<<13)|0;n=((b=b+Math.imul(l,le)|0)+(d>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,f=Math.imul(j,D),d=(d=Math.imul(j,z))+Math.imul(N,D)|0,b=Math.imul(N,z),f=f+Math.imul(R,G)|0,d=(d=d+Math.imul(R,K)|0)+Math.imul(T,G)|0,b=b+Math.imul(T,K)|0,f=f+Math.imul(F,V)|0,d=(d=d+Math.imul(F,Z)|0)+Math.imul(O,V)|0,b=b+Math.imul(O,Z)|0,f=f+Math.imul(S,Y)|0,d=(d=d+Math.imul(S,J)|0)+Math.imul(C,Y)|0,b=b+Math.imul(C,J)|0,f=f+Math.imul(I,X)|0,d=(d=d+Math.imul(I,ee)|0)+Math.imul(k,X)|0,b=b+Math.imul(k,ee)|0,f=f+Math.imul(M,ce)|0,d=(d=d+Math.imul(M,fe)|0)+Math.imul(A,ce)|0,b=b+Math.imul(A,fe)|0,f=f+Math.imul(_,be)|0,d=(d=d+Math.imul(_,te)|0)+Math.imul(v,be)|0,b=b+Math.imul(v,te)|0,f=f+Math.imul(g,re)|0,d=(d=d+Math.imul(g,ne)|0)+Math.imul(m,re)|0,b=b+Math.imul(m,ne)|0,f=f+Math.imul(u,se)|0,d=(d=d+Math.imul(u,le)|0)+Math.imul(x,se)|0,b=b+Math.imul(x,le)|0;var Le=(n+(f=f+Math.imul(s,ue)|0)|0)+((8191&(d=(d=d+Math.imul(s,xe)|0)+Math.imul(l,ue)|0))<<13)|0;n=((b=b+Math.imul(l,xe)|0)+(d>>>13)|0)+(Le>>>26)|0,Le&=67108863,f=Math.imul(j,G),d=(d=Math.imul(j,K))+Math.imul(N,G)|0,b=Math.imul(N,K),f=f+Math.imul(R,V)|0,d=(d=d+Math.imul(R,Z)|0)+Math.imul(T,V)|0,b=b+Math.imul(T,Z)|0,f=f+Math.imul(F,Y)|0,d=(d=d+Math.imul(F,J)|0)+Math.imul(O,Y)|0,b=b+Math.imul(O,J)|0,f=f+Math.imul(S,X)|0,d=(d=d+Math.imul(S,ee)|0)+Math.imul(C,X)|0,b=b+Math.imul(C,ee)|0,f=f+Math.imul(I,ce)|0,d=(d=d+Math.imul(I,fe)|0)+Math.imul(k,ce)|0,b=b+Math.imul(k,fe)|0,f=f+Math.imul(M,be)|0,d=(d=d+Math.imul(M,te)|0)+Math.imul(A,be)|0,b=b+Math.imul(A,te)|0,f=f+Math.imul(_,re)|0,d=(d=d+Math.imul(_,ne)|0)+Math.imul(v,re)|0,b=b+Math.imul(v,ne)|0,f=f+Math.imul(g,se)|0,d=(d=d+Math.imul(g,le)|0)+Math.imul(m,se)|0,b=b+Math.imul(m,le)|0;var Ie=(n+(f=f+Math.imul(u,ue)|0)|0)+((8191&(d=(d=d+Math.imul(u,xe)|0)+Math.imul(x,ue)|0))<<13)|0;n=((b=b+Math.imul(x,xe)|0)+(d>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,f=Math.imul(j,V),d=(d=Math.imul(j,Z))+Math.imul(N,V)|0,b=Math.imul(N,Z),f=f+Math.imul(R,Y)|0,d=(d=d+Math.imul(R,J)|0)+Math.imul(T,Y)|0,b=b+Math.imul(T,J)|0,f=f+Math.imul(F,X)|0,d=(d=d+Math.imul(F,ee)|0)+Math.imul(O,X)|0,b=b+Math.imul(O,ee)|0,f=f+Math.imul(S,ce)|0,d=(d=d+Math.imul(S,fe)|0)+Math.imul(C,ce)|0,b=b+Math.imul(C,fe)|0,f=f+Math.imul(I,be)|0,d=(d=d+Math.imul(I,te)|0)+Math.imul(k,be)|0,b=b+Math.imul(k,te)|0,f=f+Math.imul(M,re)|0,d=(d=d+Math.imul(M,ne)|0)+Math.imul(A,re)|0,b=b+Math.imul(A,ne)|0,f=f+Math.imul(_,se)|0,d=(d=d+Math.imul(_,le)|0)+Math.imul(v,se)|0,b=b+Math.imul(v,le)|0;var ke=(n+(f=f+Math.imul(g,ue)|0)|0)+((8191&(d=(d=d+Math.imul(g,xe)|0)+Math.imul(m,ue)|0))<<13)|0;n=((b=b+Math.imul(m,xe)|0)+(d>>>13)|0)+(ke>>>26)|0,ke&=67108863,f=Math.imul(j,Y),d=(d=Math.imul(j,J))+Math.imul(N,Y)|0,b=Math.imul(N,J),f=f+Math.imul(R,X)|0,d=(d=d+Math.imul(R,ee)|0)+Math.imul(T,X)|0,b=b+Math.imul(T,ee)|0,f=f+Math.imul(F,ce)|0,d=(d=d+Math.imul(F,fe)|0)+Math.imul(O,ce)|0,b=b+Math.imul(O,fe)|0,f=f+Math.imul(S,be)|0,d=(d=d+Math.imul(S,te)|0)+Math.imul(C,be)|0,b=b+Math.imul(C,te)|0,f=f+Math.imul(I,re)|0,d=(d=d+Math.imul(I,ne)|0)+Math.imul(k,re)|0,b=b+Math.imul(k,ne)|0,f=f+Math.imul(M,se)|0,d=(d=d+Math.imul(M,le)|0)+Math.imul(A,se)|0,b=b+Math.imul(A,le)|0;var Ee=(n+(f=f+Math.imul(_,ue)|0)|0)+((8191&(d=(d=d+Math.imul(_,xe)|0)+Math.imul(v,ue)|0))<<13)|0;n=((b=b+Math.imul(v,xe)|0)+(d>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,f=Math.imul(j,X),d=(d=Math.imul(j,ee))+Math.imul(N,X)|0,b=Math.imul(N,ee),f=f+Math.imul(R,ce)|0,d=(d=d+Math.imul(R,fe)|0)+Math.imul(T,ce)|0,b=b+Math.imul(T,fe)|0,f=f+Math.imul(F,be)|0,d=(d=d+Math.imul(F,te)|0)+Math.imul(O,be)|0,b=b+Math.imul(O,te)|0,f=f+Math.imul(S,re)|0,d=(d=d+Math.imul(S,ne)|0)+Math.imul(C,re)|0,b=b+Math.imul(C,ne)|0,f=f+Math.imul(I,se)|0,d=(d=d+Math.imul(I,le)|0)+Math.imul(k,se)|0,b=b+Math.imul(k,le)|0;var Se=(n+(f=f+Math.imul(M,ue)|0)|0)+((8191&(d=(d=d+Math.imul(M,xe)|0)+Math.imul(A,ue)|0))<<13)|0;n=((b=b+Math.imul(A,xe)|0)+(d>>>13)|0)+(Se>>>26)|0,Se&=67108863,f=Math.imul(j,ce),d=(d=Math.imul(j,fe))+Math.imul(N,ce)|0,b=Math.imul(N,fe),f=f+Math.imul(R,be)|0,d=(d=d+Math.imul(R,te)|0)+Math.imul(T,be)|0,b=b+Math.imul(T,te)|0,f=f+Math.imul(F,re)|0,d=(d=d+Math.imul(F,ne)|0)+Math.imul(O,re)|0,b=b+Math.imul(O,ne)|0,f=f+Math.imul(S,se)|0,d=(d=d+Math.imul(S,le)|0)+Math.imul(C,se)|0,b=b+Math.imul(C,le)|0;var Ce=(n+(f=f+Math.imul(I,ue)|0)|0)+((8191&(d=(d=d+Math.imul(I,xe)|0)+Math.imul(k,ue)|0))<<13)|0;n=((b=b+Math.imul(k,xe)|0)+(d>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,f=Math.imul(j,be),d=(d=Math.imul(j,te))+Math.imul(N,be)|0,b=Math.imul(N,te),f=f+Math.imul(R,re)|0,d=(d=d+Math.imul(R,ne)|0)+Math.imul(T,re)|0,b=b+Math.imul(T,ne)|0,f=f+Math.imul(F,se)|0,d=(d=d+Math.imul(F,le)|0)+Math.imul(O,se)|0,b=b+Math.imul(O,le)|0;var Be=(n+(f=f+Math.imul(S,ue)|0)|0)+((8191&(d=(d=d+Math.imul(S,xe)|0)+Math.imul(C,ue)|0))<<13)|0;n=((b=b+Math.imul(C,xe)|0)+(d>>>13)|0)+(Be>>>26)|0,Be&=67108863,f=Math.imul(j,re),d=(d=Math.imul(j,ne))+Math.imul(N,re)|0,b=Math.imul(N,ne),f=f+Math.imul(R,se)|0,d=(d=d+Math.imul(R,le)|0)+Math.imul(T,se)|0,b=b+Math.imul(T,le)|0;var Fe=(n+(f=f+Math.imul(F,ue)|0)|0)+((8191&(d=(d=d+Math.imul(F,xe)|0)+Math.imul(O,ue)|0))<<13)|0;n=((b=b+Math.imul(O,xe)|0)+(d>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,f=Math.imul(j,se),d=(d=Math.imul(j,le))+Math.imul(N,se)|0,b=Math.imul(N,le);var Oe=(n+(f=f+Math.imul(R,ue)|0)|0)+((8191&(d=(d=d+Math.imul(R,xe)|0)+Math.imul(T,ue)|0))<<13)|0;n=((b=b+Math.imul(T,xe)|0)+(d>>>13)|0)+(Oe>>>26)|0,Oe&=67108863;var Pe=(n+(f=Math.imul(j,ue))|0)+((8191&(d=(d=Math.imul(j,xe))+Math.imul(N,ue)|0))<<13)|0;return n=((b=Math.imul(N,xe))+(d>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r[0]=pe,r[1]=ge,r[2]=me,r[3]=ye,r[4]=_e,r[5]=ve,r[6]=we,r[7]=Me,r[8]=Ae,r[9]=Le,r[10]=Ie,r[11]=ke,r[12]=Ee,r[13]=Se,r[14]=Ce,r[15]=Be,r[16]=Fe,r[17]=Oe,r[18]=Pe,0!==n&&(r[19]=n,c.length++),c};function x(e,a,c){return(new p).mulp(e,a,c)}function p(e,a){this.x=e,this.y=a}Math.imul||(u=h),b.prototype.mulTo=function(e,a){var c,f=this.length+e.length;return c=10===this.length&&10===e.length?u(this,e,a):f<63?h(this,e,a):f<1024?function(e,a,c){c.negative=a.negative^e.negative,c.length=e.length+a.length;for(var f=0,d=0,b=0;b>>26)|0)>>>26,t&=67108863}c.words[b]=i,f=t,t=d}return 0!==f?c.words[b]=f:c.length--,c.strip()}(this,e,a):x(this,e,a),c},p.prototype.makeRBT=function(e){for(var a=new Array(e),c=b.prototype._countBits(e)-1,f=0;f>=1;return f},p.prototype.permute=function(e,a,c,f,d,b){for(var t=0;t>>=1)d++;return 1<>>=13,c[2*t+1]=8191&b,b>>>=13;for(t=2*a;t>=26,a+=d/67108864|0,a+=b>>>26,this.words[c]=67108863&b}return 0!==a&&(this.words[c]=a,this.length++),this},b.prototype.muln=function(e){return this.clone().imuln(e)},b.prototype.sqr=function(){return this.mul(this)},b.prototype.isqr=function(){return this.imul(this.clone())},b.prototype.pow=function(e){var a=function(e){for(var a=new Array(e.bitLength()),c=0;c>>d}return a}(e);if(0===a.length)return new b(1);for(var c=this,f=0;f=0);var a,c=e%26,d=(e-c)/26,b=67108863>>>26-c<<26-c;if(0!==c){var t=0;for(a=0;a>>26-c}t&&(this.words[a]=t,this.length++)}if(0!==d){for(a=this.length-1;a>=0;a--)this.words[a+d]=this.words[a];for(a=0;a=0),d=a?(a-a%26)/26:0;var b=e%26,t=Math.min((e-b)/26,this.length),i=67108863^67108863>>>b<t)for(this.length-=t,n=0;n=0&&(0!==o||n>=d);n--){var s=0|this.words[n];this.words[n]=o<<26-b|s>>>b,o=s&i}return r&&0!==o&&(r.words[r.length++]=o),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},b.prototype.ishrn=function(e,a,c){return f(0===this.negative),this.iushrn(e,a,c)},b.prototype.shln=function(e){return this.clone().ishln(e)},b.prototype.ushln=function(e){return this.clone().iushln(e)},b.prototype.shrn=function(e){return this.clone().ishrn(e)},b.prototype.ushrn=function(e){return this.clone().iushrn(e)},b.prototype.testn=function(e){f("number"==typeof e&&e>=0);var a=e%26,c=(e-a)/26,d=1<=0);var a=e%26,c=(e-a)/26;if(f(0===this.negative,"imaskn works only with positive numbers"),this.length<=c)return this;if(0!==a&&c++,this.length=Math.min(c,this.length),0!==a){var d=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},b.prototype.isubn=function(e){if(f("number"==typeof e),f(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(r/67108864|0),this.words[d+c]=67108863&b}for(;d>26,this.words[d+c]=67108863&b;if(0===i)return this.strip();for(f(-1===i),i=0,d=0;d>26,this.words[d]=67108863&b;return this.negative=1,this.strip()},b.prototype._wordDiv=function(e,a){var c=(this.length,e.length),f=this.clone(),d=e,t=0|d.words[d.length-1];0!=(c=26-this._countBits(t))&&(d=d.ushln(c),f.iushln(c),t=0|d.words[d.length-1]);var i,r=f.length-d.length;if("mod"!==a){(i=new b(null)).length=r+1,i.words=new Array(i.length);for(var n=0;n=0;s--){var l=67108864*(0|f.words[d.length+s])+(0|f.words[d.length+s-1]);for(l=Math.min(l/t|0,67108863),f._ishlnsubmul(d,l,s);0!==f.negative;)l--,f.negative=0,f._ishlnsubmul(d,1,s),f.isZero()||(f.negative^=1);i&&(i.words[s]=l)}return i&&i.strip(),f.strip(),"div"!==a&&0!==c&&f.iushrn(c),{div:i||null,mod:f}},b.prototype.divmod=function(e,a,c){return f(!e.isZero()),this.isZero()?{div:new b(0),mod:new b(0)}:0!==this.negative&&0===e.negative?(i=this.neg().divmod(e,a),"mod"!==a&&(d=i.div.neg()),"div"!==a&&(t=i.mod.neg(),c&&0!==t.negative&&t.iadd(e)),{div:d,mod:t}):0===this.negative&&0!==e.negative?(i=this.divmod(e.neg(),a),"mod"!==a&&(d=i.div.neg()),{div:d,mod:i.mod}):this.negative&e.negative?(i=this.neg().divmod(e.neg(),a),"div"!==a&&(t=i.mod.neg(),c&&0!==t.negative&&t.isub(e)),{div:i.div,mod:t}):e.length>this.length||this.cmp(e)<0?{div:new b(0),mod:this}:1===e.length?"div"===a?{div:this.divn(e.words[0]),mod:null}:"mod"===a?{div:null,mod:new b(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new b(this.modn(e.words[0]))}:this._wordDiv(e,a);var d,t,i},b.prototype.div=function(e){return this.divmod(e,"div",!1).div},b.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},b.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},b.prototype.divRound=function(e){var a=this.divmod(e);if(a.mod.isZero())return a.div;var c=0!==a.div.negative?a.mod.isub(e):a.mod,f=e.ushrn(1),d=e.andln(1),b=c.cmp(f);return b<0||1===d&&0===b?a.div:0!==a.div.negative?a.div.isubn(1):a.div.iaddn(1)},b.prototype.modn=function(e){f(e<=67108863);for(var a=(1<<26)%e,c=0,d=this.length-1;d>=0;d--)c=(a*c+(0|this.words[d]))%e;return c},b.prototype.idivn=function(e){f(e<=67108863);for(var a=0,c=this.length-1;c>=0;c--){var d=(0|this.words[c])+67108864*a;this.words[c]=d/e|0,a=d%e}return this.strip()},b.prototype.divn=function(e){return this.clone().idivn(e)},b.prototype.egcd=function(e){f(0===e.negative),f(!e.isZero());var a=this,c=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var d=new b(1),t=new b(0),i=new b(0),r=new b(1),n=0;a.isEven()&&c.isEven();)a.iushrn(1),c.iushrn(1),++n;for(var o=c.clone(),s=a.clone();!a.isZero();){for(var l=0,h=1;!(a.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(a.iushrn(l);l-- >0;)(d.isOdd()||t.isOdd())&&(d.iadd(o),t.isub(s)),d.iushrn(1),t.iushrn(1);for(var u=0,x=1;!(c.words[0]&x)&&u<26;++u,x<<=1);if(u>0)for(c.iushrn(u);u-- >0;)(i.isOdd()||r.isOdd())&&(i.iadd(o),r.isub(s)),i.iushrn(1),r.iushrn(1);a.cmp(c)>=0?(a.isub(c),d.isub(i),t.isub(r)):(c.isub(a),i.isub(d),r.isub(t))}return{a:i,b:r,gcd:c.iushln(n)}},b.prototype._invmp=function(e){f(0===e.negative),f(!e.isZero());var a=this,c=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var d,t=new b(1),i=new b(0),r=c.clone();a.cmpn(1)>0&&c.cmpn(1)>0;){for(var n=0,o=1;!(a.words[0]&o)&&n<26;++n,o<<=1);if(n>0)for(a.iushrn(n);n-- >0;)t.isOdd()&&t.iadd(r),t.iushrn(1);for(var s=0,l=1;!(c.words[0]&l)&&s<26;++s,l<<=1);if(s>0)for(c.iushrn(s);s-- >0;)i.isOdd()&&i.iadd(r),i.iushrn(1);a.cmp(c)>=0?(a.isub(c),t.isub(i)):(c.isub(a),i.isub(t))}return(d=0===a.cmpn(1)?t:i).cmpn(0)<0&&d.iadd(e),d},b.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var a=this.clone(),c=e.clone();a.negative=0,c.negative=0;for(var f=0;a.isEven()&&c.isEven();f++)a.iushrn(1),c.iushrn(1);for(;;){for(;a.isEven();)a.iushrn(1);for(;c.isEven();)c.iushrn(1);var d=a.cmp(c);if(d<0){var b=a;a=c,c=b}else if(0===d||0===c.cmpn(1))break;a.isub(c)}return c.iushln(f)},b.prototype.invm=function(e){return this.egcd(e).a.umod(e)},b.prototype.isEven=function(){return!(1&this.words[0])},b.prototype.isOdd=function(){return!(1&~this.words[0])},b.prototype.andln=function(e){return this.words[0]&e},b.prototype.bincn=function(e){f("number"==typeof e);var a=e%26,c=(e-a)/26,d=1<>>26,i&=67108863,this.words[t]=i}return 0!==b&&(this.words[t]=b,this.length++),this},b.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},b.prototype.cmpn=function(e){var a,c=e<0;if(0!==this.negative&&!c)return-1;if(0===this.negative&&c)return 1;if(this.strip(),this.length>1)a=1;else{c&&(e=-e),f(e<=67108863,"Number is too big");var d=0|this.words[0];a=d===e?0:de.length)return 1;if(this.length=0;c--){var f=0|this.words[c],d=0|e.words[c];if(f!==d){fd&&(a=1);break}}return a},b.prototype.gtn=function(e){return 1===this.cmpn(e)},b.prototype.gt=function(e){return 1===this.cmp(e)},b.prototype.gten=function(e){return this.cmpn(e)>=0},b.prototype.gte=function(e){return this.cmp(e)>=0},b.prototype.ltn=function(e){return-1===this.cmpn(e)},b.prototype.lt=function(e){return-1===this.cmp(e)},b.prototype.lten=function(e){return this.cmpn(e)<=0},b.prototype.lte=function(e){return this.cmp(e)<=0},b.prototype.eqn=function(e){return 0===this.cmpn(e)},b.prototype.eq=function(e){return 0===this.cmp(e)},b.red=function(e){return new M(e)},b.prototype.toRed=function(e){return f(!this.red,"Already a number in reduction context"),f(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},b.prototype.fromRed=function(){return f(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},b.prototype._forceRed=function(e){return this.red=e,this},b.prototype.forceRed=function(e){return f(!this.red,"Already a number in reduction context"),this._forceRed(e)},b.prototype.redAdd=function(e){return f(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},b.prototype.redIAdd=function(e){return f(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},b.prototype.redSub=function(e){return f(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},b.prototype.redISub=function(e){return f(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},b.prototype.redShl=function(e){return f(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},b.prototype.redMul=function(e){return f(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},b.prototype.redIMul=function(e){return f(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},b.prototype.redSqr=function(){return f(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},b.prototype.redISqr=function(){return f(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},b.prototype.redSqrt=function(){return f(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},b.prototype.redInvm=function(){return f(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},b.prototype.redNeg=function(){return f(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},b.prototype.redPow=function(e){return f(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function m(e,a){this.name=e,this.p=new b(a,16),this.n=this.p.bitLength(),this.k=new b(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(e){if("string"==typeof e){var a=b._prime(e);this.m=a.p,this.prime=a}else f(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function A(e){M.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new b(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)}m.prototype._tmp=function(){var e=new b(null);return e.words=new Array(Math.ceil(this.n/13)),e},m.prototype.ireduce=function(e){var a,c=e;do{this.split(c,this.tmp),a=(c=(c=this.imulK(c)).iadd(this.tmp)).bitLength()}while(a>this.n);var f=a0?c.isub(this.p):void 0!==c.strip?c.strip():c._strip(),c},m.prototype.split=function(e,a){e.iushrn(this.n,0,a)},m.prototype.imulK=function(e){return e.imul(this.k)},d(y,m),y.prototype.split=function(e,a){for(var c=4194303,f=Math.min(e.length,9),d=0;d>>22,b=t}b>>>=22,e.words[d-10]=b,0===b&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var a=0,c=0;c>>=26,e.words[c]=d,a=f}return 0!==a&&(e.words[e.length++]=a),e},b._prime=function(e){if(g[e])return g[e];var a;if("k256"===e)a=new y;else if("p224"===e)a=new _;else if("p192"===e)a=new v;else{if("p25519"!==e)throw new Error("Unknown prime "+e);a=new w}return g[e]=a,a},M.prototype._verify1=function(e){f(0===e.negative,"red works only with positives"),f(e.red,"red works only with red numbers")},M.prototype._verify2=function(e,a){f(!(e.negative|a.negative),"red works only with positives"),f(e.red&&e.red===a.red,"red works only with red numbers")},M.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},M.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},M.prototype.add=function(e,a){this._verify2(e,a);var c=e.add(a);return c.cmp(this.m)>=0&&c.isub(this.m),c._forceRed(this)},M.prototype.iadd=function(e,a){this._verify2(e,a);var c=e.iadd(a);return c.cmp(this.m)>=0&&c.isub(this.m),c},M.prototype.sub=function(e,a){this._verify2(e,a);var c=e.sub(a);return c.cmpn(0)<0&&c.iadd(this.m),c._forceRed(this)},M.prototype.isub=function(e,a){this._verify2(e,a);var c=e.isub(a);return c.cmpn(0)<0&&c.iadd(this.m),c},M.prototype.shl=function(e,a){return this._verify1(e),this.imod(e.ushln(a))},M.prototype.imul=function(e,a){return this._verify2(e,a),this.imod(e.imul(a))},M.prototype.mul=function(e,a){return this._verify2(e,a),this.imod(e.mul(a))},M.prototype.isqr=function(e){return this.imul(e,e.clone())},M.prototype.sqr=function(e){return this.mul(e,e)},M.prototype.sqrt=function(e){if(e.isZero())return e.clone();var a=this.m.andln(3);if(f(a%2==1),3===a){var c=this.m.add(new b(1)).iushrn(2);return this.pow(e,c)}for(var d=this.m.subn(1),t=0;!d.isZero()&&0===d.andln(1);)t++,d.iushrn(1);f(!d.isZero());var i=new b(1).toRed(this),r=i.redNeg(),n=this.m.subn(1).iushrn(1),o=this.m.bitLength();for(o=new b(2*o*o).toRed(this);0!==this.pow(o,n).cmp(r);)o.redIAdd(r);for(var s=this.pow(o,d),l=this.pow(e,d.addn(1).iushrn(1)),h=this.pow(e,d),u=t;0!==h.cmp(i);){for(var x=h,p=0;0!==x.cmp(i);p++)x=x.redSqr();f(p=0;f--){for(var n=a.words[f],o=r-1;o>=0;o--){var s=n>>o&1;d!==c[0]&&(d=this.sqr(d)),0!==s||0!==t?(t<<=1,t|=s,(4==++i||0===f&&0===o)&&(d=this.mul(d,c[t]),i=0,t=0)):i=0}r=26}return d},M.prototype.convertTo=function(e){var a=e.umod(this.m);return a===e?a.clone():a},M.prototype.convertFrom=function(e){var a=e.clone();return a.red=null,a},b.mont=function(e){return new A(e)},d(A,M),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var a=this.imod(e.mul(this.rinv));return a.red=null,a},A.prototype.imul=function(e,a){if(e.isZero()||a.isZero())return e.words[0]=0,e.length=1,e;var c=e.imul(a),f=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),d=c.isub(f).iushrn(this.shift),b=d;return d.cmp(this.m)>=0?b=d.isub(this.m):d.cmpn(0)<0&&(b=d.iadd(this.m)),b._forceRed(this)},A.prototype.mul=function(e,a){if(e.isZero()||a.isZero())return new b(0)._forceRed(this);var c=e.mul(a),f=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),d=c.isub(f).iushrn(this.shift),t=d;return d.cmp(this.m)>=0?t=d.isub(this.m):d.cmpn(0)<0&&(t=d.iadd(this.m)),t._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=c.nmd(e),this)},4148:(e,a,c)=>{"use strict";function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function d(e,a){for(var c=0;c1?c-1:0),d=1;d1?c-1:0),d=1;d1?c-1:0),d=1;d1?c-1:0),d=1;d{"use strict";function f(e,a){var c=Object.keys(e);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(e);a&&(f=f.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),c.push.apply(c,f)}return c}function d(e){for(var a=1;ae.length)&&(c=e.length),e.substring(c-a.length,c)===a}var m="",y="",_="",v="",w={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:"};function M(e){var a=Object.keys(e),c=Object.create(Object.getPrototypeOf(e));return a.forEach((function(a){c[a]=e[a]})),Object.defineProperty(c,"message",{value:e.message}),c}function A(e){return x(e,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}var L=function(e,a){!function(e,a){if("function"!=typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(a&&a.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),a&&l(e,a)}(L,e);var c,f,t,n,o=(c=L,f=s(),function(){var e,a=h(c);if(f){var d=h(this).constructor;e=Reflect.construct(a,arguments,d)}else e=a.apply(this,arguments);return i(this,e)});function L(e){var a;if(function(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}(this,L),"object"!==u(e)||null===e)throw new p("options","Object",e);var c=e.message,f=e.operator,d=e.stackStartFn,b=e.actual,t=e.expected,n=Error.stackTraceLimit;if(Error.stackTraceLimit=0,null!=c)a=o.call(this,String(c));else if(process.stderr&&process.stderr.isTTY&&(process.stderr&&process.stderr.getColorDepth&&1!==process.stderr.getColorDepth()?(m="",y="",v="",_=""):(m="",y="",v="",_="")),"object"===u(b)&&null!==b&&"object"===u(t)&&null!==t&&"stack"in b&&b instanceof Error&&"stack"in t&&t instanceof Error&&(b=M(b),t=M(t)),"deepStrictEqual"===f||"strictEqual"===f)a=o.call(this,function(e,a,c){var f="",d="",b=0,t="",i=!1,r=A(e),n=r.split("\n"),o=A(a).split("\n"),s=0,l="";if("strictEqual"===c&&"object"===u(e)&&"object"===u(a)&&null!==e&&null!==a&&(c="strictEqualObject"),1===n.length&&1===o.length&&n[0]!==o[0]){var h=n[0].length+o[0].length;if(h<=10){if(!("object"===u(e)&&null!==e||"object"===u(a)&&null!==a||0===e&&0===a))return"".concat(w[c],"\n\n")+"".concat(n[0]," !== ").concat(o[0],"\n")}else if("strictEqualObject"!==c&&h<(process.stderr&&process.stderr.isTTY?process.stderr.columns:80)){for(;n[0][s]===o[0][s];)s++;s>2&&(l="\n ".concat(function(e,a){if(a=Math.floor(a),0==e.length||0==a)return"";var c=e.length*a;for(a=Math.floor(Math.log(a)/Math.log(2));a;)e+=e,a--;return e+e.substring(0,c-e.length)}(" ",s),"^"),s=0)}}for(var x=n[n.length-1],p=o[o.length-1];x===p&&(s++<2?t="\n ".concat(x).concat(t):f=x,n.pop(),o.pop(),0!==n.length&&0!==o.length);)x=n[n.length-1],p=o[o.length-1];var M=Math.max(n.length,o.length);if(0===M){var L=r.split("\n");if(L.length>30)for(L[26]="".concat(m,"...").concat(v);L.length>27;)L.pop();return"".concat(w.notIdentical,"\n\n").concat(L.join("\n"),"\n")}s>3&&(t="\n".concat(m,"...").concat(v).concat(t),i=!0),""!==f&&(t="\n ".concat(f).concat(t),f="");var I=0,k=w[c]+"\n".concat(y,"+ actual").concat(v," ").concat(_,"- expected").concat(v),E=" ".concat(m,"...").concat(v," Lines skipped");for(s=0;s1&&s>2&&(S>4?(d+="\n".concat(m,"...").concat(v),i=!0):S>3&&(d+="\n ".concat(o[s-2]),I++),d+="\n ".concat(o[s-1]),I++),b=s,f+="\n".concat(_,"-").concat(v," ").concat(o[s]),I++;else if(o.length1&&s>2&&(S>4?(d+="\n".concat(m,"...").concat(v),i=!0):S>3&&(d+="\n ".concat(n[s-2]),I++),d+="\n ".concat(n[s-1]),I++),b=s,d+="\n".concat(y,"+").concat(v," ").concat(n[s]),I++;else{var C=o[s],B=n[s],F=B!==C&&(!g(B,",")||B.slice(0,-1)!==C);F&&g(C,",")&&C.slice(0,-1)===B&&(F=!1,B+=","),F?(S>1&&s>2&&(S>4?(d+="\n".concat(m,"...").concat(v),i=!0):S>3&&(d+="\n ".concat(n[s-2]),I++),d+="\n ".concat(n[s-1]),I++),b=s,d+="\n".concat(y,"+").concat(v," ").concat(B),f+="\n".concat(_,"-").concat(v," ").concat(C),I+=2):(d+=f,f="",1!==S&&0!==s||(d+="\n ".concat(B),I++))}if(I>20&&s30)for(l[26]="".concat(m,"...").concat(v);l.length>27;)l.pop();a=1===l.length?o.call(this,"".concat(s," ").concat(l[0])):o.call(this,"".concat(s,"\n\n").concat(l.join("\n"),"\n"))}else{var h=A(b),x="",I=w[f];"notDeepEqual"===f||"notEqual"===f?(h="".concat(w[f],"\n\n").concat(h)).length>1024&&(h="".concat(h.slice(0,1021),"...")):(x="".concat(A(t)),h.length>512&&(h="".concat(h.slice(0,509),"...")),x.length>512&&(x="".concat(x.slice(0,509),"...")),"deepEqual"===f||"equal"===f?h="".concat(I,"\n\n").concat(h,"\n\nshould equal\n\n"):x=" ".concat(f," ").concat(x)),a=o.call(this,"".concat(h).concat(x))}return Error.stackTraceLimit=n,a.generatedMessage=!c,Object.defineProperty(r(a),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),a.code="ERR_ASSERTION",a.actual=b,a.expected=t,a.operator=f,Error.captureStackTrace&&Error.captureStackTrace(r(a),d),a.stack,a.name="AssertionError",i(a)}return t=L,(n=[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:a,value:function(e,a){return x(this,d(d({},a),{},{customInspect:!1,depth:0}))}}])&&b(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),L}(n(Error),x.custom);e.exports=L},9597:(e,a,c)=>{"use strict";function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function d(e,a){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,a){return e.__proto__=a,e},d(e,a)}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}var t,i,r={};function n(e,a,c){c||(c=Error);var t=function(c){!function(e,a){if("function"!=typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(a&&a.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),a&&d(e,a)}(o,c);var t,i,r,n=(i=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=b(i);if(r){var c=b(this).constructor;e=Reflect.construct(a,arguments,c)}else e=a.apply(this,arguments);return function(e,a){if(a&&("object"===f(a)||"function"==typeof a))return a;if(void 0!==a)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function o(c,f,d){var b;return function(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}(this,o),b=n.call(this,function(e,c,f){return"string"==typeof a?a:a(e,c,f)}(c,f,d)),b.code=e,b}return t=o,Object.defineProperty(t,"prototype",{writable:!1}),t}(c);r[e]=t}function o(e,a){if(Array.isArray(e)){var c=e.length;return e=e.map((function(e){return String(e)})),c>2?"one of ".concat(a," ").concat(e.slice(0,c-1).join(", "),", or ")+e[c-1]:2===c?"one of ".concat(a," ").concat(e[0]," or ").concat(e[1]):"of ".concat(a," ").concat(e[0])}return"of ".concat(a," ").concat(String(e))}n("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),n("ERR_INVALID_ARG_TYPE",(function(e,a,d){var b,i,r,n,s;if(void 0===t&&(t=c(4148)),t("string"==typeof e,"'name' must be a string"),"string"==typeof a&&(i="not ",a.substr(0,4)===i)?(b="must not be",a=a.replace(/^not /,"")):b="must be",function(e,a,c){return(void 0===c||c>e.length)&&(c=e.length),e.substring(c-9,c)===a}(e," argument"))r="The ".concat(e," ").concat(b," ").concat(o(a,"type"));else{var l=("number"!=typeof s&&(s=0),s+1>(n=e).length||-1===n.indexOf(".",s)?"argument":"property");r='The "'.concat(e,'" ').concat(l," ").concat(b," ").concat(o(a,"type"))}return r+". Received type ".concat(f(d))}),TypeError),n("ERR_INVALID_ARG_VALUE",(function(e,a){var f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"is invalid";void 0===i&&(i=c(537));var d=i.inspect(a);return d.length>128&&(d="".concat(d.slice(0,128),"...")),"The argument '".concat(e,"' ").concat(f,". Received ").concat(d)}),TypeError,RangeError),n("ERR_INVALID_RETURN_VALUE",(function(e,a,c){var d;return d=c&&c.constructor&&c.constructor.name?"instance of ".concat(c.constructor.name):"type ".concat(f(c)),"Expected ".concat(e,' to be returned from the "').concat(a,'"')+" function but got ".concat(d,".")}),TypeError),n("ERR_MISSING_ARGS",(function(){for(var e=arguments.length,a=new Array(e),f=0;f0,"At least one arg needs to be specified");var d="The ",b=a.length;switch(a=a.map((function(e){return'"'.concat(e,'"')})),b){case 1:d+="".concat(a[0]," argument");break;case 2:d+="".concat(a[0]," and ").concat(a[1]," arguments");break;default:d+=a.slice(0,b-1).join(", "),d+=", and ".concat(a[b-1]," arguments")}return"".concat(d," must be specified")}),TypeError),e.exports.codes=r},2299:(e,a,c)=>{"use strict";function f(e,a){return function(e){if(Array.isArray(e))return e}(e)||function(e,a){var c=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=c){var f,d,b,t,i=[],r=!0,n=!1;try{if(b=(c=c.call(e)).next,0===a){if(Object(c)!==c)return;r=!1}else for(;!(r=(f=b.call(c)).done)&&(i.push(f.value),i.length!==a);r=!0);}catch(e){n=!0,d=e}finally{try{if(!r&&null!=c.return&&(t=c.return(),Object(t)!==t))return}finally{if(n)throw d}}return i}}(e,a)||function(e,a){if(e){if("string"==typeof e)return d(e,a);var c=Object.prototype.toString.call(e).slice(8,-1);return"Object"===c&&e.constructor&&(c=e.constructor.name),"Map"===c||"Set"===c?Array.from(e):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?d(e,a):void 0}}(e,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,a){(null==a||a>e.length)&&(a=e.length);for(var c=0,f=new Array(a);c10)return!0;for(var a=0;a57)return!0}return 10===e.length&&e>=Math.pow(2,32)}function O(e){return Object.keys(e).filter(F).concat(o(e).filter(Object.prototype.propertyIsEnumerable.bind(e)))}function P(e,a){if(e===a)return 0;for(var c=e.length,f=a.length,d=0,b=Math.min(c,f);d{const f=c(6209),d=c(943),b=c(1847),t=c(6679),i=c(5435),r=255===new Uint8Array(Uint16Array.of(255).buffer)[0];function n(e){switch(e){case"ascii":return f;case"base64":return d;case"hex":return b;case"utf8":case"utf-8":case void 0:return t;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return i;default:throw new Error(`Unknown encoding: ${e}`)}}function o(e){return e instanceof Uint8Array}function s(e,a,c){return"string"==typeof e?function(e,a){const c=n(a),f=new Uint8Array(c.byteLength(e));return c.write(f,e,0,f.byteLength),f}(e,a):Array.isArray(e)?function(e){const a=new Uint8Array(e.length);return a.set(e),a}(e):ArrayBuffer.isView(e)?function(e){const a=new Uint8Array(e.byteLength);return a.set(e),a}(e):function(e,a,c){return new Uint8Array(e,a,c)}(e,a,c)}function l(e,a,c,f,d){if(0===e.byteLength)return-1;if("string"==typeof c?(f=c,c=0):void 0===c?c=d?0:e.length-1:c<0&&(c+=e.byteLength),c>=e.byteLength){if(d)return-1;c=e.byteLength-1}else if(c<0){if(!d)return-1;c=0}if("string"==typeof a)a=s(a,f);else if("number"==typeof a)return a&=255,d?e.indexOf(a,c):e.lastIndexOf(a,c);if(0===a.byteLength)return-1;if(d){let f=-1;for(let d=c;de.byteLength&&(c=e.byteLength-a.byteLength);for(let f=c;f>=0;f--){let c=!0;for(let d=0;dd)return 1}return e.byteLength>a.byteLength?1:e.byteLengthe+a.byteLength),0));const c=new Uint8Array(a);let f=0;for(const a of e){if(f+a.byteLength>c.byteLength){const e=a.subarray(0,c.byteLength-f);return c.set(e,f),c}c.set(a,f),f+=a.byteLength}return c},copy:function(e,a,c=0,f=0,d=e.byteLength){if(d>0&&d=e.byteLength)throw new RangeError("sourceStart is out of range");if(d<0)throw new RangeError("sourceEnd is out of range");c>=a.byteLength&&(c=a.byteLength),d>e.byteLength&&(d=e.byteLength),a.byteLength-c=d||f<=c?"":(c<0&&(c=0),f>d&&(f=d),(0!==c||f{function a(e){return e.length}e.exports={byteLength:a,toString:function(e){const a=e.byteLength;let c="";for(let f=0;f{const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=new Uint8Array(256);for(let e=0;e<64;e++)c[a.charCodeAt(e)]=e;function f(e){let a=e.length;return 61===e.charCodeAt(a-1)&&a--,a>1&&61===e.charCodeAt(a-1)&&a--,3*a>>>2}c[45]=62,c[95]=63,e.exports={byteLength:f,toString:function(e){const c=e.byteLength;let f="";for(let d=0;d>2]+a[(3&e[d])<<4|e[d+1]>>4]+a[(15&e[d+1])<<2|e[d+2]>>6]+a[63&e[d+2]];return c%3==2?f=f.substring(0,f.length-1)+"=":c%3==1&&(f=f.substring(0,f.length-2)+"=="),f},write:function(e,a,d=0,b=f(a)){const t=Math.min(b,e.byteLength-d);for(let f=0,d=0;d>4,e[d++]=(15&t)<<4|i>>2,e[d++]=(3&i)<<6|63&r}return t}}},1847:e=>{function a(e){return e.length>>>1}function c(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-65+10:e>=97&&e<=102?e-97+10:void 0}e.exports={byteLength:a,toString:function(e){const a=e.byteLength;e=new DataView(e.buffer,e.byteOffset,a);let c="",f=0;for(let d=a-a%4;f{function a(e){return 2*e.length}e.exports={byteLength:a,toString:function(e){const a=e.byteLength;let c="";for(let f=0;f>8,t=d%256;e[f+2*a]=t,e[f+2*a+1]=b}return b}}},6679:e=>{function a(e){let a=0;for(let c=0,f=e.length;c=55296&&d<=56319&&c+1=56320&&f<=57343){a+=4,c++;continue}}a+=d<=127?1:d<=2047?2:3}return a}let c,f;if("undefined"!=typeof TextDecoder){const e=new TextDecoder;c=function(a){return e.decode(a)}}else c=function(e){const a=e.byteLength;let c="",f=0;for(;f0){let a=0;for(;a>f,f-=6;f>=0;)e[i++]=128|a>>f&63,f-=6;t+=a>=65536?2:1}return b};e.exports={byteLength:a,toString:c,write:f}},5364:(e,a,c)=>{"use strict";var f=c(2861).Buffer;e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var a=new Uint8Array(256),c=0;c>>0,o=new Uint8Array(t);c>>0,o[h]=s%256>>>0,s=s/256>>>0;if(0!==s)throw new Error("Non-zero carry");b=l,c++}for(var u=t-b;u!==t&&0===o[u];)u++;var x=f.allocUnsafe(d+(t-u));x.fill(0,0,d);for(var p=d;u!==t;)x[p++]=o[u++];return x}return{encode:function(a){if((Array.isArray(a)||a instanceof Uint8Array)&&(a=f.from(a)),!f.isBuffer(a))throw new TypeError("Expected Buffer");if(0===a.length)return"";for(var c=0,d=0,b=0,t=a.length;b!==t&&0===a[b];)b++,c++;for(var n=(t-b)*o+1>>>0,s=new Uint8Array(n);b!==t;){for(var l=a[b],h=0,u=n-1;(0!==l||h>>0,s[u]=l%i>>>0,l=l/i>>>0;if(0!==l)throw new Error("Non-zero carry");d=h,b++}for(var x=n-d;x!==n&&0===s[x];)x++;for(var p=r.repeat(c);x{"use strict";a.byteLength=function(e){var a=i(e),c=a[0],f=a[1];return 3*(c+f)/4-f},a.toByteArray=function(e){var a,c,b=i(e),t=b[0],r=b[1],n=new d(function(e,a,c){return 3*(a+c)/4-c}(0,t,r)),o=0,s=r>0?t-4:t;for(c=0;c>16&255,n[o++]=a>>8&255,n[o++]=255&a;return 2===r&&(a=f[e.charCodeAt(c)]<<2|f[e.charCodeAt(c+1)]>>4,n[o++]=255&a),1===r&&(a=f[e.charCodeAt(c)]<<10|f[e.charCodeAt(c+1)]<<4|f[e.charCodeAt(c+2)]>>2,n[o++]=a>>8&255,n[o++]=255&a),n},a.fromByteArray=function(e){for(var a,f=e.length,d=f%3,b=[],t=16383,i=0,n=f-d;in?n:i+t));return 1===d?(a=e[f-1],b.push(c[a>>2]+c[a<<4&63]+"==")):2===d&&(a=(e[f-2]<<8)+e[f-1],b.push(c[a>>10]+c[a>>4&63]+c[a<<2&63]+"=")),b.join("")};for(var c=[],f=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)c[t]=b[t],f[b.charCodeAt(t)]=t;function i(e){var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var c=e.indexOf("=");return-1===c&&(c=a),[c,c===a?0:4-c%4]}function r(e,a,f){for(var d,b,t=[],i=a;i>18&63]+c[b>>12&63]+c[b>>6&63]+c[63&b]);return t.join("")}f["-".charCodeAt(0)]=62,f["_".charCodeAt(0)]=63},654:(e,a,c)=>{e.exports=c(5702)(c(6989))},4315:(e,a,c)=>{var f=c(2045).hp;const d=c(8399).Transform;e.exports=class extends d{constructor(e,a){super(a),this._engine=e,this._finalized=!1}_transform(e,a,c){let f=null;try{this.update(e,a)}catch(e){f=e}c(f)}_flush(e){let a=null;try{this.push(this.digest())}catch(e){a=e}e(a)}update(e,a){if(!f.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return f.isBuffer(e)||(e=f.from(e,a)),this._engine.update(e),this}digest(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;let a=this._engine.digest();return void 0!==e&&(a=a.toString(e)),a}}},5702:(e,a,c)=>{const f=c(4315);e.exports=e=>(a,c)=>{const d=(a=>{switch("string"==typeof a?a.toLowerCase():a){case"blake224":return e.Blake224;case"blake256":return e.Blake256;case"blake384":return e.Blake384;case"blake512":return e.Blake512;default:throw new Error("Invald algorithm: "+a)}})(a);return new f(new d,c)}},4588:(e,a,c)=>{var f=c(2045).hp;class d{_lengthCarry(e){for(let a=0;a=a.length;){for(let f=this._blockOffset;f{var f=c(2045).hp;const d=c(3287),b=f.from([0]),t=f.from([128]);e.exports=class extends d{constructor(){super(),this._h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],this._zo=b,this._oo=t}digest(){this._padding();const e=f.alloc(28);for(let a=0;a<7;++a)e.writeUInt32BE(this._h[a],4*a);return e}}},3287:(e,a,c)=>{var f=c(2045).hp;const d=c(4588),b=f.from([1]),t=f.from([129]),i=(e,a)=>(e<<32-a|e>>>a)>>>0;function r(e,a,c,f,b,t,r,n){const o=d.sigma,s=d.u256;e[f]=e[f]+((a[o[c][n]]^s[o[c][n+1]])>>>0)+e[b]>>>0,e[r]=i(e[r]^e[f],16),e[t]=e[t]+e[r]>>>0,e[b]=i(e[b]^e[t],12),e[f]=e[f]+((a[o[c][n+1]]^s[o[c][n]])>>>0)+e[b]>>>0,e[r]=i(e[r]^e[f],8),e[t]=e[t]+e[r]>>>0,e[b]=i(e[b]^e[t],7)}e.exports=class extends d{constructor(){super(),this._h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this._s=[0,0,0,0],this._block=f.alloc(64),this._blockOffset=0,this._length=[0,0],this._nullt=!1,this._zo=b,this._oo=t}_compress(){const e=d.u256,a=new Array(16),c=new Array(16);let f;for(f=0;f<16;++f)c[f]=this._block.readUInt32BE(4*f);for(f=0;f<8;++f)a[f]=this._h[f]>>>0;for(f=8;f<12;++f)a[f]=(this._s[f-8]^e[f-8])>>>0;for(f=12;f<16;++f)a[f]=e[f-8];for(this._nullt||(a[12]=(a[12]^this._length[0])>>>0,a[13]=(a[13]^this._length[0])>>>0,a[14]=(a[14]^this._length[1])>>>0,a[15]=(a[15]^this._length[1])>>>0),f=0;f<14;++f)r(a,c,f,0,4,8,12,0),r(a,c,f,1,5,9,13,2),r(a,c,f,2,6,10,14,4),r(a,c,f,3,7,11,15,6),r(a,c,f,0,5,10,15,8),r(a,c,f,1,6,11,12,10),r(a,c,f,2,7,8,13,12),r(a,c,f,3,4,9,14,14);for(f=0;f<16;++f)this._h[f%8]=(this._h[f%8]^a[f])>>>0;for(f=0;f<8;++f)this._h[f]=(this._h[f]^this._s[f%4])>>>0}_padding(){let e=this._length[0]+8*this._blockOffset,a=this._length[1];e>=4294967296&&(e-=4294967296,a+=1);const c=f.alloc(8);c.writeUInt32BE(a,0),c.writeUInt32BE(e,4),55===this._blockOffset?(this._length[0]-=8,this.update(this._oo)):(this._blockOffset<55?(0===this._blockOffset&&(this._nullt=!0),this._length[0]-=8*(55-this._blockOffset),this.update(d.padding.slice(0,55-this._blockOffset))):(this._length[0]-=8*(64-this._blockOffset),this.update(d.padding.slice(0,64-this._blockOffset)),this._length[0]-=440,this.update(d.padding.slice(1,56)),this._nullt=!0),this.update(this._zo),this._length[0]-=8),this._length[0]-=64,this.update(c)}digest(){this._padding();const e=f.alloc(32);for(let a=0;a<8;++a)e.writeUInt32BE(this._h[a],4*a);return e}}},399:(e,a,c)=>{var f=c(2045).hp;const d=c(1070),b=f.from([0]),t=f.from([128]);e.exports=class extends d{constructor(){super(),this._h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428],this._zo=b,this._oo=t}digest(){this._padding();const e=f.alloc(48);for(let a=0;a<12;++a)e.writeUInt32BE(this._h[a],4*a);return e}}},1070:(e,a,c)=>{var f=c(2045).hp;const d=c(4588),b=f.from([1]),t=f.from([129]);function i(e,a,c,f){let d=e[2*a]^e[2*c],b=e[2*a+1]^e[2*c+1];f>=32&&(b^=d,d^=b,b^=d,f-=32),0===f?(e[2*a]=d>>>0,e[2*a+1]=b>>>0):(e[2*a]=(d>>>f|b<<32-f)>>>0,e[2*a+1]=(b>>>f|d<<32-f)>>>0)}function r(e,a,c,f,b,t,r,n){const o=d.sigma,s=d.u512;let l;l=e[2*f+1]+((a[2*o[c][n]+1]^s[2*o[c][n+1]+1])>>>0)+e[2*b+1],e[2*f]=e[2*f]+((a[2*o[c][n]]^s[2*o[c][n+1]])>>>0)+e[2*b]+~~(l/4294967296)>>>0,e[2*f+1]=l>>>0,i(e,r,f,32),l=e[2*t+1]+e[2*r+1],e[2*t]=e[2*t]+e[2*r]+~~(l/4294967296)>>>0,e[2*t+1]=l>>>0,i(e,b,t,25),l=e[2*f+1]+((a[2*o[c][n+1]+1]^s[2*o[c][n]+1])>>>0)+e[2*b+1],e[2*f]=e[2*f]+((a[2*o[c][n+1]]^s[2*o[c][n]])>>>0)+e[2*b]+~~(l/4294967296)>>>0,e[2*f+1]=l>>>0,i(e,r,f,16),l=e[2*t+1]+e[2*r+1],e[2*t]=e[2*t]+e[2*r]+~~(l/4294967296)>>>0,e[2*t+1]=l>>>0,i(e,b,t,11)}e.exports=class extends d{constructor(){super(),this._h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this._s=[0,0,0,0,0,0,0,0],this._block=f.alloc(128),this._blockOffset=0,this._length=[0,0,0,0],this._nullt=!1,this._zo=b,this._oo=t}_compress(){const e=d.u512,a=new Array(32),c=new Array(32);let f;for(f=0;f<32;++f)c[f]=this._block.readUInt32BE(4*f);for(f=0;f<16;++f)a[f]=this._h[f]>>>0;for(f=16;f<24;++f)a[f]=(this._s[f-16]^e[f-16])>>>0;for(f=24;f<32;++f)a[f]=e[f-16];for(this._nullt||(a[24]=(a[24]^this._length[1])>>>0,a[25]=(a[25]^this._length[0])>>>0,a[26]=(a[26]^this._length[1])>>>0,a[27]=(a[27]^this._length[0])>>>0,a[28]=(a[28]^this._length[3])>>>0,a[29]=(a[29]^this._length[2])>>>0,a[30]=(a[30]^this._length[3])>>>0,a[31]=(a[31]^this._length[2])>>>0),f=0;f<16;++f)r(a,c,f,0,4,8,12,0),r(a,c,f,1,5,9,13,2),r(a,c,f,2,6,10,14,4),r(a,c,f,3,7,11,15,6),r(a,c,f,0,5,10,15,8),r(a,c,f,1,6,11,12,10),r(a,c,f,2,7,8,13,12),r(a,c,f,3,4,9,14,14);for(f=0;f<16;++f)this._h[f%8*2]=(this._h[f%8*2]^a[2*f])>>>0,this._h[f%8*2+1]=(this._h[f%8*2+1]^a[2*f+1])>>>0;for(f=0;f<8;++f)this._h[2*f]=(this._h[2*f]^this._s[f%4*2])>>>0,this._h[2*f+1]=(this._h[2*f+1]^this._s[f%4*2+1])>>>0}_padding(){const e=this._length.slice();e[0]+=8*this._blockOffset,this._lengthCarry(e);const a=f.alloc(16);for(let c=0;c<4;++c)a.writeUInt32BE(e[3-c],4*c);111===this._blockOffset?(this._length[0]-=8,this.update(this._oo)):(this._blockOffset<111?(0===this._blockOffset&&(this._nullt=!0),this._length[0]-=8*(111-this._blockOffset),this.update(d.padding.slice(0,111-this._blockOffset))):(this._length[0]-=8*(128-this._blockOffset),this.update(d.padding.slice(0,128-this._blockOffset)),this._length[0]-=888,this.update(d.padding.slice(1,112)),this._nullt=!0),this.update(this._zo),this._length[0]-=8),this._length[0]-=128,this.update(a)}digest(){this._padding();const e=f.alloc(64);for(let a=0;a<16;++a)e.writeUInt32BE(this._h[a],4*a);return e}}},6989:(e,a,c)=>{e.exports={Blake224:c(8746),Blake256:c(3287),Blake384:c(399),Blake512:c(1070)}},1892:e=>{var a,c,f=(()=>{for(var e=new Uint8Array(128),a=0;a<64;a++)e[a<26?a+65:a<52?a+71:a<62?a-4:4*a-205]=a;return a=>{for(var c=a.length,f=new Uint8Array(3*(c-("="==a[c-1])-("="==a[c-2]))/4|0),d=0,b=0;d>4,f[b++]=i<<4|r>>2,f[b++]=r<<6|n}return f}})(),d=(a={"wasm-binary:./blake2b.wat"(e,a){a.exports=f("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMKvz8EwAIAIABCADcDACAAQgA3AwggAEIANwMQIABCADcDGCAAQgA3AyAgAEIANwMoIABCADcDMCAAQgA3AzggAEIANwNAIABCADcDSCAAQgA3A1AgAEIANwNYIABCADcDYCAAQgA3A2ggAEIANwNwIABCADcDeCAAQoiS853/zPmE6gBBACkDAIU3A4ABIABCu86qptjQ67O7f0EIKQMAhTcDiAEgAEKr8NP0r+68tzxBECkDAIU3A5ABIABC8e30+KWn/aelf0EYKQMAhTcDmAEgAELRhZrv+s+Uh9EAQSApAwCFNwOgASAAQp/Y+dnCkdqCm39BKCkDAIU3A6gBIABC6/qG2r+19sEfQTApAwCFNwOwASAAQvnC+JuRo7Pw2wBBOCkDAIU3A7gBIABCADcDwAEgAEIANwPIASAAQgA3A9ABC20BA38gAEHAAWohAyAAQcgBaiEEIAQpAwCnIQUCQANAIAEgAkYNASAFQYABRgRAIAMgAykDACAFrXw3AwBBACEFIAAQAwsgACAFaiABLQAAOgAAIAVBAWohBSABQQFqIQEMAAsLIAQgBa03AwALYQEDfyAAQcABaiEBIABByAFqIQIgASABKQMAIAIpAwB8NwMAIABCfzcD0AEgAikDAKchAwJAA0AgA0GAAUYNASAAIANqQQA6AAAgA0EBaiEDDAALCyACIAOtNwMAIAAQAwuqOwIgfgl/IABBgAFqISEgAEGIAWohIiAAQZABaiEjIABBmAFqISQgAEGgAWohJSAAQagBaiEmIABBsAFqIScgAEG4AWohKCAhKQMAIQEgIikDACECICMpAwAhAyAkKQMAIQQgJSkDACEFICYpAwAhBiAnKQMAIQcgKCkDACEIQoiS853/zPmE6gAhCUK7zqqm2NDrs7t/IQpCq/DT9K/uvLc8IQtC8e30+KWn/aelfyEMQtGFmu/6z5SH0QAhDUKf2PnZwpHagpt/IQ5C6/qG2r+19sEfIQ9C+cL4m5Gjs/DbACEQIAApAwAhESAAKQMIIRIgACkDECETIAApAxghFCAAKQMgIRUgACkDKCEWIAApAzAhFyAAKQM4IRggACkDQCEZIAApA0ghGiAAKQNQIRsgACkDWCEcIAApA2AhHSAAKQNoIR4gACkDcCEfIAApA3ghICANIAApA8ABhSENIA8gACkD0AGFIQ8gASAFIBF8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSASfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgE3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBR8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAVfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgFnx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBd8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAYfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgGXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBp8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAbfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgHHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIB18fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAefHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgH3x8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFICB8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAffHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgG3x8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBV8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAZfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgGnx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHICB8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAefHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggF3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBJ8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAdfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgEXx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBN8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAcfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggGHx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBZ8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAUfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgHHx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBl8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAdfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgEXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBZ8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByATfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggIHx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIB58fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAbfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgH3x8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBR8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAXfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggGHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBJ8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAafHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFXx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBh8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAafHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgFHx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBJ8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAefHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHXx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBx8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAffHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgE3x8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBd8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAWfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgG3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBV8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCARfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgIHx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBl8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAafHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEXx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBZ8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAYfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgE3x8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBV8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAbfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggIHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIB98fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiASfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgHHx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIB18fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAXfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggGXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBR8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAefHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgE3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIB18fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAXfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgG3x8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBF8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAcfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggGXx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBR8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAVfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBh8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAWfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggIHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIB98fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSASfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgGnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIB18fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAWfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgEnx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGICB8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAffHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHnx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBV8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAbfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBh8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAXfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgFHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBp8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCATfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgGXx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBx8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAefHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgHHx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBh8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAffHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgHXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBJ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAUfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGnx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBZ8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiARfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgIHx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBV8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAZfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggF3x8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBN8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAbfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgF3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFICB8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAffHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGnx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBx8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAUfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggEXx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBl8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAdfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgE3x8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIB58fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAYfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggEnx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBV8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAbfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBt8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSATfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgGXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBV8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAYfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgF3x8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBJ8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAWfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgIHx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBx8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAafHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgH3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBR8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAdfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgHnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBF8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSARfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBN8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAUfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgFXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBZ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAXfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBl8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAafHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgG3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBx8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAdfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHnx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB98fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAgfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgH3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBt8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAVfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBp8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAgfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggHnx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBd8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiASfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBF8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByATfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBh8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAWfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgISAhKQMAIAEgCYWFNwMAICIgIikDACACIAqFhTcDACAjICMpAwAgAyALhYU3AwAgJCAkKQMAIAQgDIWFNwMAICUgJSkDACAFIA2FhTcDACAmICYpAwAgBiAOhYU3AwAgJyAnKQMAIAcgD4WFNwMAICggKCkDACAIIBCFhTcDAAs=")}},function(){return c||(0,a[Object.keys(a)[0]])((c={exports:{}}).exports,c),c.exports})(),b=WebAssembly.compile(d);e.exports=async e=>(await WebAssembly.instantiate(await b,e)).exports},1685:(e,a,c)=>{var f=c(6889),d=c(5682),b=null,t="undefined"!=typeof WebAssembly&&c(1892)().then((e=>{b=e})),i=64,r=[];e.exports=x;var n=e.exports.BYTES_MIN=16,o=e.exports.BYTES_MAX=64,s=(e.exports.BYTES=32,e.exports.KEYBYTES_MIN=16),l=e.exports.KEYBYTES_MAX=64,h=(e.exports.KEYBYTES=32,e.exports.SALTBYTES=16),u=e.exports.PERSONALBYTES=16;function x(e,a,c,d,t){if(!(this instanceof x))return new x(e,a,c,d,t);if(!b)throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");e||(e=32),!0!==t&&(f(e>=n,"digestLength must be at least "+n+", was given "+e),f(e<=o,"digestLength must be at most "+o+", was given "+e),null!=a&&(f(a instanceof Uint8Array,"key must be Uint8Array or Buffer"),f(a.length>=s,"key must be at least "+s+", was given "+a.length),f(a.length<=l,"key must be at least "+l+", was given "+a.length)),null!=c&&(f(c instanceof Uint8Array,"salt must be Uint8Array or Buffer"),f(c.length===h,"salt must be exactly "+h+", was given "+c.length)),null!=d&&(f(d instanceof Uint8Array,"personal must be Uint8Array or Buffer"),f(d.length===u,"personal must be exactly "+u+", was given "+d.length))),r.length||(r.push(i),i+=216),this.digestLength=e,this.finalized=!1,this.pointer=r.pop(),this._memory=new Uint8Array(b.memory.buffer),this._memory.fill(0,0,64),this._memory[0]=this.digestLength,this._memory[1]=a?a.length:0,this._memory[2]=1,this._memory[3]=1,c&&this._memory.set(c,32),d&&this._memory.set(d,48),this.pointer+216>this._memory.length&&this._realloc(this.pointer+216),b.blake2b_init(this.pointer,this.digestLength),a&&(this.update(a),this._memory.fill(0,i,i+a.length),this._memory[this.pointer+200]=128)}function p(){}x.prototype._realloc=function(e){b.memory.grow(Math.max(0,Math.ceil(Math.abs(e-this._memory.length)/65536))),this._memory=new Uint8Array(b.memory.buffer)},x.prototype.update=function(e){return f(!1===this.finalized,"Hash instance finalized"),f(e instanceof Uint8Array,"input must be Uint8Array or Buffer"),i+e.length>this._memory.length&&this._realloc(i+e.length),this._memory.set(e,i),b.blake2b_update(this.pointer,i,i+e.length),this},x.prototype.digest=function(e){if(f(!1===this.finalized,"Hash instance finalized"),this.finalized=!0,r.push(this.pointer),b.blake2b_final(this.pointer),!e||"binary"===e)return this._memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if("string"==typeof e)return d.toString(this._memory,e,this.pointer+128,this.pointer+128+this.digestLength);f(e instanceof Uint8Array&&e.length>=this.digestLength,"input must be Uint8Array or Buffer");for(var a=0;ae()),e):e(new Error("WebAssembly not supported"))},x.prototype.ready=x.ready,x.prototype.getPartialHash=function(){return this._memory.slice(this.pointer,this.pointer+216)},x.prototype.setPartialHash=function(e){this._memory.set(e,this.pointer)}},2206:(e,a,c)=>{var f=c(6889),d=c(1685);function b(e,a,c){var f=e[a]+e[c],d=e[a+1]+e[c+1];f>=4294967296&&d++,e[a]=f,e[a+1]=d}function t(e,a,c,f){var d=e[a]+c;c<0&&(d+=4294967296);var b=e[a+1]+f;d>=4294967296&&b++,e[a]=d,e[a+1]=b}function i(e,a){return e[a]^e[a+1]<<8^e[a+2]<<16^e[a+3]<<24}function r(e,a,c,f,d,i){var r=l[d],n=l[d+1],o=l[i],h=l[i+1];b(s,e,a),t(s,e,r,n);var u=s[f]^s[e],x=s[f+1]^s[e+1];s[f]=x,s[f+1]=u,b(s,c,f),u=s[a]^s[c],x=s[a+1]^s[c+1],s[a]=u>>>24^x<<8,s[a+1]=x>>>24^u<<8,b(s,e,a),t(s,e,o,h),u=s[f]^s[e],x=s[f+1]^s[e+1],s[f]=u>>>16^x<<16,s[f+1]=x>>>16^u<<16,b(s,c,f),u=s[a]^s[c],x=s[a+1]^s[c+1],s[a]=x>>>31^u<<1,s[a+1]=u>>>31^x<<1}var n=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),o=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map((function(e){return 2*e}))),s=new Uint32Array(32),l=new Uint32Array(32);function h(e,a){var c=0;for(c=0;c<16;c++)s[c]=e.h[c],s[c+16]=n[c];for(s[24]=s[24]^e.t,s[25]=s[25]^e.t/4294967296,a&&(s[28]=~s[28],s[29]=~s[29]),c=0;c<32;c++)l[c]=i(e.b,4*c);for(c=0;c<12;c++)r(0,8,16,24,o[16*c+0],o[16*c+1]),r(2,10,18,26,o[16*c+2],o[16*c+3]),r(4,12,20,28,o[16*c+4],o[16*c+5]),r(6,14,22,30,o[16*c+6],o[16*c+7]),r(0,10,20,30,o[16*c+8],o[16*c+9]),r(2,12,22,24,o[16*c+10],o[16*c+11]),r(4,14,16,26,o[16*c+12],o[16*c+13]),r(6,8,18,28,o[16*c+14],o[16*c+15]);for(c=0;c<16;c++)e.h[c]=e.h[c]^s[c]^s[c+16]}var u=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function x(e,a,c,f){u.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=e,u[0]=e,a&&(u[1]=a.length),u[2]=1,u[3]=1,c&&u.set(c,32),f&&u.set(f,48);for(var d=0;d<16;d++)this.h[d]=n[d]^i(u,4*d);a&&(p(this,a),this.c=128)}function p(e,a){for(var c=0;c=this.outlen,"out must have at least outlen bytes of space"),function(e,a){for(e.t+=e.c;e.c<128;)e.b[e.c++]=0;h(e,!0);for(var c=0;c>2]>>8*(3&c)}(this,a),"hex"===e?function(e){for(var a="",c=0;c=m,"outlen must be at least "+m+", was given "+e),f(e<=y,"outlen must be at most "+y+", was given "+e),null!=a&&(f(a instanceof Uint8Array,"key must be Uint8Array or Buffer"),f(a.length>=_,"key must be at least "+_+", was given "+a.length),f(a.length<=v,"key must be at most "+v+", was given "+a.length)),null!=c&&(f(c instanceof Uint8Array,"salt must be Uint8Array or Buffer"),f(c.length===w,"salt must be exactly "+w+", was given "+c.length)),null!=d&&(f(d instanceof Uint8Array,"personal must be Uint8Array or Buffer"),f(d.length===M,"personal must be exactly "+M+", was given "+d.length))),new g(e,a,c,d)},e.exports.ready=function(e){d.ready((function(){e()}))},e.exports.WASM_SUPPORTED=d.SUPPORTED,e.exports.WASM_LOADED=!1;var m=e.exports.BYTES_MIN=16,y=e.exports.BYTES_MAX=64,_=(e.exports.BYTES=32,e.exports.KEYBYTES_MIN=16),v=e.exports.KEYBYTES_MAX=64,w=(e.exports.KEYBYTES=32,e.exports.SALTBYTES=16),M=e.exports.PERSONALBYTES=16;d.ready((function(a){a||(e.exports.WASM_LOADED=!0,e.exports=d)}))},9404:function(e,a,c){!function(e,a){"use strict";function f(e,a){if(!e)throw new Error(a||"Assertion failed")}function d(e,a){e.super_=a;var c=function(){};c.prototype=a.prototype,e.prototype=new c,e.prototype.constructor=e}function b(e,a,c){if(b.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==a&&"be"!==a||(c=a,a=10),this._init(e||0,a||10,c||"be"))}var t;"object"==typeof e?e.exports=b:a.BN=b,b.BN=b,b.wordSize=26;try{t="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:c(7790).Buffer}catch(e){}function i(e,a){var c=e.charCodeAt(a);return c>=48&&c<=57?c-48:c>=65&&c<=70?c-55:c>=97&&c<=102?c-87:void f(!1,"Invalid character in "+e)}function r(e,a,c){var f=i(e,c);return c-1>=a&&(f|=i(e,c-1)<<4),f}function n(e,a,c,d){for(var b=0,t=0,i=Math.min(e.length,c),r=a;r=49?n-49+10:n>=17?n-17+10:n,f(n>=0&&t0?e:a},b.min=function(e,a){return e.cmp(a)<0?e:a},b.prototype._init=function(e,a,c){if("number"==typeof e)return this._initNumber(e,a,c);if("object"==typeof e)return this._initArray(e,a,c);"hex"===a&&(a=16),f(a===(0|a)&&a>=2&&a<=36);var d=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(d++,this.negative=1),d=0;d-=3)t=e[d]|e[d-1]<<8|e[d-2]<<16,this.words[b]|=t<>>26-i&67108863,(i+=24)>=26&&(i-=26,b++);else if("le"===c)for(d=0,b=0;d>>26-i&67108863,(i+=24)>=26&&(i-=26,b++);return this._strip()},b.prototype._parseHex=function(e,a,c){this.length=Math.ceil((e.length-a)/6),this.words=new Array(this.length);for(var f=0;f=a;f-=2)d=r(e,a,f)<=18?(b-=18,t+=1,this.words[t]|=d>>>26):b+=8;else for(f=(e.length-a)%2==0?a+1:a;f=18?(b-=18,t+=1,this.words[t]|=d>>>26):b+=8;this._strip()},b.prototype._parseBase=function(e,a,c){this.words=[0],this.length=1;for(var f=0,d=1;d<=67108863;d*=a)f++;f--,d=d/a|0;for(var b=e.length-c,t=b%f,i=Math.min(b,b-t)+c,r=0,o=c;o1&&0===this.words[this.length-1];)this.length--;return this._normSign()},b.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{b.prototype[Symbol.for("nodejs.util.inspect.custom")]=s}catch(e){b.prototype.inspect=s}else b.prototype.inspect=s;function s(){return(this.red?""}var l=["","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"],h=[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],u=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function x(e,a,c){c.negative=a.negative^e.negative;var f=e.length+a.length|0;c.length=f,f=f-1|0;var d=0|e.words[0],b=0|a.words[0],t=d*b,i=67108863&t,r=t/67108864|0;c.words[0]=i;for(var n=1;n>>26,s=67108863&r,l=Math.min(n,a.length-1),h=Math.max(0,n-e.length+1);h<=l;h++){var u=n-h|0;o+=(t=(d=0|e.words[u])*(b=0|a.words[h])+s)/67108864|0,s=67108863&t}c.words[n]=0|s,r=0|o}return 0!==r?c.words[n]=0|r:c.length--,c._strip()}b.prototype.toString=function(e,a){var c;if(a=0|a||1,16===(e=e||10)||"hex"===e){c="";for(var d=0,b=0,t=0;t>>24-d&16777215,(d+=2)>=26&&(d-=26,t--),c=0!==b||t!==this.length-1?l[6-r.length]+r+c:r+c}for(0!==b&&(c=b.toString(16)+c);c.length%a!=0;)c="0"+c;return 0!==this.negative&&(c="-"+c),c}if(e===(0|e)&&e>=2&&e<=36){var n=h[e],o=u[e];c="";var s=this.clone();for(s.negative=0;!s.isZero();){var x=s.modrn(o).toString(e);c=(s=s.idivn(o)).isZero()?x+c:l[n-x.length]+x+c}for(this.isZero()&&(c="0"+c);c.length%a!=0;)c="0"+c;return 0!==this.negative&&(c="-"+c),c}f(!1,"Base should be between 2 and 36")},b.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&f(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},b.prototype.toJSON=function(){return this.toString(16,2)},t&&(b.prototype.toBuffer=function(e,a){return this.toArrayLike(t,e,a)}),b.prototype.toArray=function(e,a){return this.toArrayLike(Array,e,a)},b.prototype.toArrayLike=function(e,a,c){this._strip();var d=this.byteLength(),b=c||Math.max(1,d);f(d<=b,"byte array longer than desired length"),f(b>0,"Requested array length <= 0");var t=function(e,a){return e.allocUnsafe?e.allocUnsafe(a):new e(a)}(e,b);return this["_toArrayLike"+("le"===a?"LE":"BE")](t,d),t},b.prototype._toArrayLikeLE=function(e,a){for(var c=0,f=0,d=0,b=0;d>8&255),c>16&255),6===b?(c>24&255),f=0,b=0):(f=t>>>24,b+=2)}if(c=0&&(e[c--]=t>>8&255),c>=0&&(e[c--]=t>>16&255),6===b?(c>=0&&(e[c--]=t>>24&255),f=0,b=0):(f=t>>>24,b+=2)}if(c>=0)for(e[c--]=f;c>=0;)e[c--]=0},Math.clz32?b.prototype._countBits=function(e){return 32-Math.clz32(e)}:b.prototype._countBits=function(e){var a=e,c=0;return a>=4096&&(c+=13,a>>>=13),a>=64&&(c+=7,a>>>=7),a>=8&&(c+=4,a>>>=4),a>=2&&(c+=2,a>>>=2),c+a},b.prototype._zeroBits=function(e){if(0===e)return 26;var a=e,c=0;return 8191&a||(c+=13,a>>>=13),127&a||(c+=7,a>>>=7),15&a||(c+=4,a>>>=4),3&a||(c+=2,a>>>=2),1&a||c++,c},b.prototype.bitLength=function(){var e=this.words[this.length-1],a=this._countBits(e);return 26*(this.length-1)+a},b.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,a=0;ae.length?this.clone().ior(e):e.clone().ior(this)},b.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},b.prototype.iuand=function(e){var a;a=this.length>e.length?e:this;for(var c=0;ce.length?this.clone().iand(e):e.clone().iand(this)},b.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},b.prototype.iuxor=function(e){var a,c;this.length>e.length?(a=this,c=e):(a=e,c=this);for(var f=0;fe.length?this.clone().ixor(e):e.clone().ixor(this)},b.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},b.prototype.inotn=function(e){f("number"==typeof e&&e>=0);var a=0|Math.ceil(e/26),c=e%26;this._expand(a),c>0&&a--;for(var d=0;d0&&(this.words[d]=~this.words[d]&67108863>>26-c),this._strip()},b.prototype.notn=function(e){return this.clone().inotn(e)},b.prototype.setn=function(e,a){f("number"==typeof e&&e>=0);var c=e/26|0,d=e%26;return this._expand(c+1),this.words[c]=a?this.words[c]|1<e.length?(c=this,f=e):(c=e,f=this);for(var d=0,b=0;b>>26;for(;0!==d&&b>>26;if(this.length=c.length,0!==d)this.words[this.length]=d,this.length++;else if(c!==this)for(;be.length?this.clone().iadd(e):e.clone().iadd(this)},b.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var a=this.iadd(e);return e.negative=1,a._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var c,f,d=this.cmp(e);if(0===d)return this.negative=0,this.length=1,this.words[0]=0,this;d>0?(c=this,f=e):(c=e,f=this);for(var b=0,t=0;t>26,this.words[t]=67108863&a;for(;0!==b&&t>26,this.words[t]=67108863&a;if(0===b&&t>>13,h=0|t[1],u=8191&h,x=h>>>13,p=0|t[2],g=8191&p,m=p>>>13,y=0|t[3],_=8191&y,v=y>>>13,w=0|t[4],M=8191&w,A=w>>>13,L=0|t[5],I=8191&L,k=L>>>13,E=0|t[6],S=8191&E,C=E>>>13,B=0|t[7],F=8191&B,O=B>>>13,P=0|t[8],R=8191&P,T=P>>>13,U=0|t[9],j=8191&U,N=U>>>13,q=0|i[0],D=8191&q,z=q>>>13,Q=0|i[1],G=8191&Q,K=Q>>>13,H=0|i[2],V=8191&H,Z=H>>>13,W=0|i[3],Y=8191&W,J=W>>>13,$=0|i[4],X=8191&$,ee=$>>>13,ae=0|i[5],ce=8191&ae,fe=ae>>>13,de=0|i[6],be=8191&de,te=de>>>13,ie=0|i[7],re=8191&ie,ne=ie>>>13,oe=0|i[8],se=8191&oe,le=oe>>>13,he=0|i[9],ue=8191&he,xe=he>>>13;c.negative=e.negative^a.negative,c.length=19;var pe=(n+(f=Math.imul(s,D))|0)+((8191&(d=(d=Math.imul(s,z))+Math.imul(l,D)|0))<<13)|0;n=((b=Math.imul(l,z))+(d>>>13)|0)+(pe>>>26)|0,pe&=67108863,f=Math.imul(u,D),d=(d=Math.imul(u,z))+Math.imul(x,D)|0,b=Math.imul(x,z);var ge=(n+(f=f+Math.imul(s,G)|0)|0)+((8191&(d=(d=d+Math.imul(s,K)|0)+Math.imul(l,G)|0))<<13)|0;n=((b=b+Math.imul(l,K)|0)+(d>>>13)|0)+(ge>>>26)|0,ge&=67108863,f=Math.imul(g,D),d=(d=Math.imul(g,z))+Math.imul(m,D)|0,b=Math.imul(m,z),f=f+Math.imul(u,G)|0,d=(d=d+Math.imul(u,K)|0)+Math.imul(x,G)|0,b=b+Math.imul(x,K)|0;var me=(n+(f=f+Math.imul(s,V)|0)|0)+((8191&(d=(d=d+Math.imul(s,Z)|0)+Math.imul(l,V)|0))<<13)|0;n=((b=b+Math.imul(l,Z)|0)+(d>>>13)|0)+(me>>>26)|0,me&=67108863,f=Math.imul(_,D),d=(d=Math.imul(_,z))+Math.imul(v,D)|0,b=Math.imul(v,z),f=f+Math.imul(g,G)|0,d=(d=d+Math.imul(g,K)|0)+Math.imul(m,G)|0,b=b+Math.imul(m,K)|0,f=f+Math.imul(u,V)|0,d=(d=d+Math.imul(u,Z)|0)+Math.imul(x,V)|0,b=b+Math.imul(x,Z)|0;var ye=(n+(f=f+Math.imul(s,Y)|0)|0)+((8191&(d=(d=d+Math.imul(s,J)|0)+Math.imul(l,Y)|0))<<13)|0;n=((b=b+Math.imul(l,J)|0)+(d>>>13)|0)+(ye>>>26)|0,ye&=67108863,f=Math.imul(M,D),d=(d=Math.imul(M,z))+Math.imul(A,D)|0,b=Math.imul(A,z),f=f+Math.imul(_,G)|0,d=(d=d+Math.imul(_,K)|0)+Math.imul(v,G)|0,b=b+Math.imul(v,K)|0,f=f+Math.imul(g,V)|0,d=(d=d+Math.imul(g,Z)|0)+Math.imul(m,V)|0,b=b+Math.imul(m,Z)|0,f=f+Math.imul(u,Y)|0,d=(d=d+Math.imul(u,J)|0)+Math.imul(x,Y)|0,b=b+Math.imul(x,J)|0;var _e=(n+(f=f+Math.imul(s,X)|0)|0)+((8191&(d=(d=d+Math.imul(s,ee)|0)+Math.imul(l,X)|0))<<13)|0;n=((b=b+Math.imul(l,ee)|0)+(d>>>13)|0)+(_e>>>26)|0,_e&=67108863,f=Math.imul(I,D),d=(d=Math.imul(I,z))+Math.imul(k,D)|0,b=Math.imul(k,z),f=f+Math.imul(M,G)|0,d=(d=d+Math.imul(M,K)|0)+Math.imul(A,G)|0,b=b+Math.imul(A,K)|0,f=f+Math.imul(_,V)|0,d=(d=d+Math.imul(_,Z)|0)+Math.imul(v,V)|0,b=b+Math.imul(v,Z)|0,f=f+Math.imul(g,Y)|0,d=(d=d+Math.imul(g,J)|0)+Math.imul(m,Y)|0,b=b+Math.imul(m,J)|0,f=f+Math.imul(u,X)|0,d=(d=d+Math.imul(u,ee)|0)+Math.imul(x,X)|0,b=b+Math.imul(x,ee)|0;var ve=(n+(f=f+Math.imul(s,ce)|0)|0)+((8191&(d=(d=d+Math.imul(s,fe)|0)+Math.imul(l,ce)|0))<<13)|0;n=((b=b+Math.imul(l,fe)|0)+(d>>>13)|0)+(ve>>>26)|0,ve&=67108863,f=Math.imul(S,D),d=(d=Math.imul(S,z))+Math.imul(C,D)|0,b=Math.imul(C,z),f=f+Math.imul(I,G)|0,d=(d=d+Math.imul(I,K)|0)+Math.imul(k,G)|0,b=b+Math.imul(k,K)|0,f=f+Math.imul(M,V)|0,d=(d=d+Math.imul(M,Z)|0)+Math.imul(A,V)|0,b=b+Math.imul(A,Z)|0,f=f+Math.imul(_,Y)|0,d=(d=d+Math.imul(_,J)|0)+Math.imul(v,Y)|0,b=b+Math.imul(v,J)|0,f=f+Math.imul(g,X)|0,d=(d=d+Math.imul(g,ee)|0)+Math.imul(m,X)|0,b=b+Math.imul(m,ee)|0,f=f+Math.imul(u,ce)|0,d=(d=d+Math.imul(u,fe)|0)+Math.imul(x,ce)|0,b=b+Math.imul(x,fe)|0;var we=(n+(f=f+Math.imul(s,be)|0)|0)+((8191&(d=(d=d+Math.imul(s,te)|0)+Math.imul(l,be)|0))<<13)|0;n=((b=b+Math.imul(l,te)|0)+(d>>>13)|0)+(we>>>26)|0,we&=67108863,f=Math.imul(F,D),d=(d=Math.imul(F,z))+Math.imul(O,D)|0,b=Math.imul(O,z),f=f+Math.imul(S,G)|0,d=(d=d+Math.imul(S,K)|0)+Math.imul(C,G)|0,b=b+Math.imul(C,K)|0,f=f+Math.imul(I,V)|0,d=(d=d+Math.imul(I,Z)|0)+Math.imul(k,V)|0,b=b+Math.imul(k,Z)|0,f=f+Math.imul(M,Y)|0,d=(d=d+Math.imul(M,J)|0)+Math.imul(A,Y)|0,b=b+Math.imul(A,J)|0,f=f+Math.imul(_,X)|0,d=(d=d+Math.imul(_,ee)|0)+Math.imul(v,X)|0,b=b+Math.imul(v,ee)|0,f=f+Math.imul(g,ce)|0,d=(d=d+Math.imul(g,fe)|0)+Math.imul(m,ce)|0,b=b+Math.imul(m,fe)|0,f=f+Math.imul(u,be)|0,d=(d=d+Math.imul(u,te)|0)+Math.imul(x,be)|0,b=b+Math.imul(x,te)|0;var Me=(n+(f=f+Math.imul(s,re)|0)|0)+((8191&(d=(d=d+Math.imul(s,ne)|0)+Math.imul(l,re)|0))<<13)|0;n=((b=b+Math.imul(l,ne)|0)+(d>>>13)|0)+(Me>>>26)|0,Me&=67108863,f=Math.imul(R,D),d=(d=Math.imul(R,z))+Math.imul(T,D)|0,b=Math.imul(T,z),f=f+Math.imul(F,G)|0,d=(d=d+Math.imul(F,K)|0)+Math.imul(O,G)|0,b=b+Math.imul(O,K)|0,f=f+Math.imul(S,V)|0,d=(d=d+Math.imul(S,Z)|0)+Math.imul(C,V)|0,b=b+Math.imul(C,Z)|0,f=f+Math.imul(I,Y)|0,d=(d=d+Math.imul(I,J)|0)+Math.imul(k,Y)|0,b=b+Math.imul(k,J)|0,f=f+Math.imul(M,X)|0,d=(d=d+Math.imul(M,ee)|0)+Math.imul(A,X)|0,b=b+Math.imul(A,ee)|0,f=f+Math.imul(_,ce)|0,d=(d=d+Math.imul(_,fe)|0)+Math.imul(v,ce)|0,b=b+Math.imul(v,fe)|0,f=f+Math.imul(g,be)|0,d=(d=d+Math.imul(g,te)|0)+Math.imul(m,be)|0,b=b+Math.imul(m,te)|0,f=f+Math.imul(u,re)|0,d=(d=d+Math.imul(u,ne)|0)+Math.imul(x,re)|0,b=b+Math.imul(x,ne)|0;var Ae=(n+(f=f+Math.imul(s,se)|0)|0)+((8191&(d=(d=d+Math.imul(s,le)|0)+Math.imul(l,se)|0))<<13)|0;n=((b=b+Math.imul(l,le)|0)+(d>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,f=Math.imul(j,D),d=(d=Math.imul(j,z))+Math.imul(N,D)|0,b=Math.imul(N,z),f=f+Math.imul(R,G)|0,d=(d=d+Math.imul(R,K)|0)+Math.imul(T,G)|0,b=b+Math.imul(T,K)|0,f=f+Math.imul(F,V)|0,d=(d=d+Math.imul(F,Z)|0)+Math.imul(O,V)|0,b=b+Math.imul(O,Z)|0,f=f+Math.imul(S,Y)|0,d=(d=d+Math.imul(S,J)|0)+Math.imul(C,Y)|0,b=b+Math.imul(C,J)|0,f=f+Math.imul(I,X)|0,d=(d=d+Math.imul(I,ee)|0)+Math.imul(k,X)|0,b=b+Math.imul(k,ee)|0,f=f+Math.imul(M,ce)|0,d=(d=d+Math.imul(M,fe)|0)+Math.imul(A,ce)|0,b=b+Math.imul(A,fe)|0,f=f+Math.imul(_,be)|0,d=(d=d+Math.imul(_,te)|0)+Math.imul(v,be)|0,b=b+Math.imul(v,te)|0,f=f+Math.imul(g,re)|0,d=(d=d+Math.imul(g,ne)|0)+Math.imul(m,re)|0,b=b+Math.imul(m,ne)|0,f=f+Math.imul(u,se)|0,d=(d=d+Math.imul(u,le)|0)+Math.imul(x,se)|0,b=b+Math.imul(x,le)|0;var Le=(n+(f=f+Math.imul(s,ue)|0)|0)+((8191&(d=(d=d+Math.imul(s,xe)|0)+Math.imul(l,ue)|0))<<13)|0;n=((b=b+Math.imul(l,xe)|0)+(d>>>13)|0)+(Le>>>26)|0,Le&=67108863,f=Math.imul(j,G),d=(d=Math.imul(j,K))+Math.imul(N,G)|0,b=Math.imul(N,K),f=f+Math.imul(R,V)|0,d=(d=d+Math.imul(R,Z)|0)+Math.imul(T,V)|0,b=b+Math.imul(T,Z)|0,f=f+Math.imul(F,Y)|0,d=(d=d+Math.imul(F,J)|0)+Math.imul(O,Y)|0,b=b+Math.imul(O,J)|0,f=f+Math.imul(S,X)|0,d=(d=d+Math.imul(S,ee)|0)+Math.imul(C,X)|0,b=b+Math.imul(C,ee)|0,f=f+Math.imul(I,ce)|0,d=(d=d+Math.imul(I,fe)|0)+Math.imul(k,ce)|0,b=b+Math.imul(k,fe)|0,f=f+Math.imul(M,be)|0,d=(d=d+Math.imul(M,te)|0)+Math.imul(A,be)|0,b=b+Math.imul(A,te)|0,f=f+Math.imul(_,re)|0,d=(d=d+Math.imul(_,ne)|0)+Math.imul(v,re)|0,b=b+Math.imul(v,ne)|0,f=f+Math.imul(g,se)|0,d=(d=d+Math.imul(g,le)|0)+Math.imul(m,se)|0,b=b+Math.imul(m,le)|0;var Ie=(n+(f=f+Math.imul(u,ue)|0)|0)+((8191&(d=(d=d+Math.imul(u,xe)|0)+Math.imul(x,ue)|0))<<13)|0;n=((b=b+Math.imul(x,xe)|0)+(d>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,f=Math.imul(j,V),d=(d=Math.imul(j,Z))+Math.imul(N,V)|0,b=Math.imul(N,Z),f=f+Math.imul(R,Y)|0,d=(d=d+Math.imul(R,J)|0)+Math.imul(T,Y)|0,b=b+Math.imul(T,J)|0,f=f+Math.imul(F,X)|0,d=(d=d+Math.imul(F,ee)|0)+Math.imul(O,X)|0,b=b+Math.imul(O,ee)|0,f=f+Math.imul(S,ce)|0,d=(d=d+Math.imul(S,fe)|0)+Math.imul(C,ce)|0,b=b+Math.imul(C,fe)|0,f=f+Math.imul(I,be)|0,d=(d=d+Math.imul(I,te)|0)+Math.imul(k,be)|0,b=b+Math.imul(k,te)|0,f=f+Math.imul(M,re)|0,d=(d=d+Math.imul(M,ne)|0)+Math.imul(A,re)|0,b=b+Math.imul(A,ne)|0,f=f+Math.imul(_,se)|0,d=(d=d+Math.imul(_,le)|0)+Math.imul(v,se)|0,b=b+Math.imul(v,le)|0;var ke=(n+(f=f+Math.imul(g,ue)|0)|0)+((8191&(d=(d=d+Math.imul(g,xe)|0)+Math.imul(m,ue)|0))<<13)|0;n=((b=b+Math.imul(m,xe)|0)+(d>>>13)|0)+(ke>>>26)|0,ke&=67108863,f=Math.imul(j,Y),d=(d=Math.imul(j,J))+Math.imul(N,Y)|0,b=Math.imul(N,J),f=f+Math.imul(R,X)|0,d=(d=d+Math.imul(R,ee)|0)+Math.imul(T,X)|0,b=b+Math.imul(T,ee)|0,f=f+Math.imul(F,ce)|0,d=(d=d+Math.imul(F,fe)|0)+Math.imul(O,ce)|0,b=b+Math.imul(O,fe)|0,f=f+Math.imul(S,be)|0,d=(d=d+Math.imul(S,te)|0)+Math.imul(C,be)|0,b=b+Math.imul(C,te)|0,f=f+Math.imul(I,re)|0,d=(d=d+Math.imul(I,ne)|0)+Math.imul(k,re)|0,b=b+Math.imul(k,ne)|0,f=f+Math.imul(M,se)|0,d=(d=d+Math.imul(M,le)|0)+Math.imul(A,se)|0,b=b+Math.imul(A,le)|0;var Ee=(n+(f=f+Math.imul(_,ue)|0)|0)+((8191&(d=(d=d+Math.imul(_,xe)|0)+Math.imul(v,ue)|0))<<13)|0;n=((b=b+Math.imul(v,xe)|0)+(d>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,f=Math.imul(j,X),d=(d=Math.imul(j,ee))+Math.imul(N,X)|0,b=Math.imul(N,ee),f=f+Math.imul(R,ce)|0,d=(d=d+Math.imul(R,fe)|0)+Math.imul(T,ce)|0,b=b+Math.imul(T,fe)|0,f=f+Math.imul(F,be)|0,d=(d=d+Math.imul(F,te)|0)+Math.imul(O,be)|0,b=b+Math.imul(O,te)|0,f=f+Math.imul(S,re)|0,d=(d=d+Math.imul(S,ne)|0)+Math.imul(C,re)|0,b=b+Math.imul(C,ne)|0,f=f+Math.imul(I,se)|0,d=(d=d+Math.imul(I,le)|0)+Math.imul(k,se)|0,b=b+Math.imul(k,le)|0;var Se=(n+(f=f+Math.imul(M,ue)|0)|0)+((8191&(d=(d=d+Math.imul(M,xe)|0)+Math.imul(A,ue)|0))<<13)|0;n=((b=b+Math.imul(A,xe)|0)+(d>>>13)|0)+(Se>>>26)|0,Se&=67108863,f=Math.imul(j,ce),d=(d=Math.imul(j,fe))+Math.imul(N,ce)|0,b=Math.imul(N,fe),f=f+Math.imul(R,be)|0,d=(d=d+Math.imul(R,te)|0)+Math.imul(T,be)|0,b=b+Math.imul(T,te)|0,f=f+Math.imul(F,re)|0,d=(d=d+Math.imul(F,ne)|0)+Math.imul(O,re)|0,b=b+Math.imul(O,ne)|0,f=f+Math.imul(S,se)|0,d=(d=d+Math.imul(S,le)|0)+Math.imul(C,se)|0,b=b+Math.imul(C,le)|0;var Ce=(n+(f=f+Math.imul(I,ue)|0)|0)+((8191&(d=(d=d+Math.imul(I,xe)|0)+Math.imul(k,ue)|0))<<13)|0;n=((b=b+Math.imul(k,xe)|0)+(d>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,f=Math.imul(j,be),d=(d=Math.imul(j,te))+Math.imul(N,be)|0,b=Math.imul(N,te),f=f+Math.imul(R,re)|0,d=(d=d+Math.imul(R,ne)|0)+Math.imul(T,re)|0,b=b+Math.imul(T,ne)|0,f=f+Math.imul(F,se)|0,d=(d=d+Math.imul(F,le)|0)+Math.imul(O,se)|0,b=b+Math.imul(O,le)|0;var Be=(n+(f=f+Math.imul(S,ue)|0)|0)+((8191&(d=(d=d+Math.imul(S,xe)|0)+Math.imul(C,ue)|0))<<13)|0;n=((b=b+Math.imul(C,xe)|0)+(d>>>13)|0)+(Be>>>26)|0,Be&=67108863,f=Math.imul(j,re),d=(d=Math.imul(j,ne))+Math.imul(N,re)|0,b=Math.imul(N,ne),f=f+Math.imul(R,se)|0,d=(d=d+Math.imul(R,le)|0)+Math.imul(T,se)|0,b=b+Math.imul(T,le)|0;var Fe=(n+(f=f+Math.imul(F,ue)|0)|0)+((8191&(d=(d=d+Math.imul(F,xe)|0)+Math.imul(O,ue)|0))<<13)|0;n=((b=b+Math.imul(O,xe)|0)+(d>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,f=Math.imul(j,se),d=(d=Math.imul(j,le))+Math.imul(N,se)|0,b=Math.imul(N,le);var Oe=(n+(f=f+Math.imul(R,ue)|0)|0)+((8191&(d=(d=d+Math.imul(R,xe)|0)+Math.imul(T,ue)|0))<<13)|0;n=((b=b+Math.imul(T,xe)|0)+(d>>>13)|0)+(Oe>>>26)|0,Oe&=67108863;var Pe=(n+(f=Math.imul(j,ue))|0)+((8191&(d=(d=Math.imul(j,xe))+Math.imul(N,ue)|0))<<13)|0;return n=((b=Math.imul(N,xe))+(d>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r[0]=pe,r[1]=ge,r[2]=me,r[3]=ye,r[4]=_e,r[5]=ve,r[6]=we,r[7]=Me,r[8]=Ae,r[9]=Le,r[10]=Ie,r[11]=ke,r[12]=Ee,r[13]=Se,r[14]=Ce,r[15]=Be,r[16]=Fe,r[17]=Oe,r[18]=Pe,0!==n&&(r[19]=n,c.length++),c};function g(e,a,c){c.negative=a.negative^e.negative,c.length=e.length+a.length;for(var f=0,d=0,b=0;b>>26)|0)>>>26,t&=67108863}c.words[b]=i,f=t,t=d}return 0!==f?c.words[b]=f:c.length--,c._strip()}function m(e,a,c){return g(e,a,c)}function y(e,a){this.x=e,this.y=a}Math.imul||(p=x),b.prototype.mulTo=function(e,a){var c=this.length+e.length;return 10===this.length&&10===e.length?p(this,e,a):c<63?x(this,e,a):c<1024?g(this,e,a):m(this,e,a)},y.prototype.makeRBT=function(e){for(var a=new Array(e),c=b.prototype._countBits(e)-1,f=0;f>=1;return f},y.prototype.permute=function(e,a,c,f,d,b){for(var t=0;t>>=1)d++;return 1<>>=13,c[2*t+1]=8191&b,b>>>=13;for(t=2*a;t>=26,c+=b/67108864|0,c+=t>>>26,this.words[d]=67108863&t}return 0!==c&&(this.words[d]=c,this.length++),a?this.ineg():this},b.prototype.muln=function(e){return this.clone().imuln(e)},b.prototype.sqr=function(){return this.mul(this)},b.prototype.isqr=function(){return this.imul(this.clone())},b.prototype.pow=function(e){var a=function(e){for(var a=new Array(e.bitLength()),c=0;c>>d&1}return a}(e);if(0===a.length)return new b(1);for(var c=this,f=0;f=0);var a,c=e%26,d=(e-c)/26,b=67108863>>>26-c<<26-c;if(0!==c){var t=0;for(a=0;a>>26-c}t&&(this.words[a]=t,this.length++)}if(0!==d){for(a=this.length-1;a>=0;a--)this.words[a+d]=this.words[a];for(a=0;a=0),d=a?(a-a%26)/26:0;var b=e%26,t=Math.min((e-b)/26,this.length),i=67108863^67108863>>>b<t)for(this.length-=t,n=0;n=0&&(0!==o||n>=d);n--){var s=0|this.words[n];this.words[n]=o<<26-b|s>>>b,o=s&i}return r&&0!==o&&(r.words[r.length++]=o),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},b.prototype.ishrn=function(e,a,c){return f(0===this.negative),this.iushrn(e,a,c)},b.prototype.shln=function(e){return this.clone().ishln(e)},b.prototype.ushln=function(e){return this.clone().iushln(e)},b.prototype.shrn=function(e){return this.clone().ishrn(e)},b.prototype.ushrn=function(e){return this.clone().iushrn(e)},b.prototype.testn=function(e){f("number"==typeof e&&e>=0);var a=e%26,c=(e-a)/26,d=1<=0);var a=e%26,c=(e-a)/26;if(f(0===this.negative,"imaskn works only with positive numbers"),this.length<=c)return this;if(0!==a&&c++,this.length=Math.min(c,this.length),0!==a){var d=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},b.prototype.isubn=function(e){if(f("number"==typeof e),f(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(r/67108864|0),this.words[d+c]=67108863&b}for(;d>26,this.words[d+c]=67108863&b;if(0===i)return this._strip();for(f(-1===i),i=0,d=0;d>26,this.words[d]=67108863&b;return this.negative=1,this._strip()},b.prototype._wordDiv=function(e,a){var c=(this.length,e.length),f=this.clone(),d=e,t=0|d.words[d.length-1];0!=(c=26-this._countBits(t))&&(d=d.ushln(c),f.iushln(c),t=0|d.words[d.length-1]);var i,r=f.length-d.length;if("mod"!==a){(i=new b(null)).length=r+1,i.words=new Array(i.length);for(var n=0;n=0;s--){var l=67108864*(0|f.words[d.length+s])+(0|f.words[d.length+s-1]);for(l=Math.min(l/t|0,67108863),f._ishlnsubmul(d,l,s);0!==f.negative;)l--,f.negative=0,f._ishlnsubmul(d,1,s),f.isZero()||(f.negative^=1);i&&(i.words[s]=l)}return i&&i._strip(),f._strip(),"div"!==a&&0!==c&&f.iushrn(c),{div:i||null,mod:f}},b.prototype.divmod=function(e,a,c){return f(!e.isZero()),this.isZero()?{div:new b(0),mod:new b(0)}:0!==this.negative&&0===e.negative?(i=this.neg().divmod(e,a),"mod"!==a&&(d=i.div.neg()),"div"!==a&&(t=i.mod.neg(),c&&0!==t.negative&&t.iadd(e)),{div:d,mod:t}):0===this.negative&&0!==e.negative?(i=this.divmod(e.neg(),a),"mod"!==a&&(d=i.div.neg()),{div:d,mod:i.mod}):this.negative&e.negative?(i=this.neg().divmod(e.neg(),a),"div"!==a&&(t=i.mod.neg(),c&&0!==t.negative&&t.isub(e)),{div:i.div,mod:t}):e.length>this.length||this.cmp(e)<0?{div:new b(0),mod:this}:1===e.length?"div"===a?{div:this.divn(e.words[0]),mod:null}:"mod"===a?{div:null,mod:new b(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new b(this.modrn(e.words[0]))}:this._wordDiv(e,a);var d,t,i},b.prototype.div=function(e){return this.divmod(e,"div",!1).div},b.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},b.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},b.prototype.divRound=function(e){var a=this.divmod(e);if(a.mod.isZero())return a.div;var c=0!==a.div.negative?a.mod.isub(e):a.mod,f=e.ushrn(1),d=e.andln(1),b=c.cmp(f);return b<0||1===d&&0===b?a.div:0!==a.div.negative?a.div.isubn(1):a.div.iaddn(1)},b.prototype.modrn=function(e){var a=e<0;a&&(e=-e),f(e<=67108863);for(var c=(1<<26)%e,d=0,b=this.length-1;b>=0;b--)d=(c*d+(0|this.words[b]))%e;return a?-d:d},b.prototype.modn=function(e){return this.modrn(e)},b.prototype.idivn=function(e){var a=e<0;a&&(e=-e),f(e<=67108863);for(var c=0,d=this.length-1;d>=0;d--){var b=(0|this.words[d])+67108864*c;this.words[d]=b/e|0,c=b%e}return this._strip(),a?this.ineg():this},b.prototype.divn=function(e){return this.clone().idivn(e)},b.prototype.egcd=function(e){f(0===e.negative),f(!e.isZero());var a=this,c=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var d=new b(1),t=new b(0),i=new b(0),r=new b(1),n=0;a.isEven()&&c.isEven();)a.iushrn(1),c.iushrn(1),++n;for(var o=c.clone(),s=a.clone();!a.isZero();){for(var l=0,h=1;!(a.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(a.iushrn(l);l-- >0;)(d.isOdd()||t.isOdd())&&(d.iadd(o),t.isub(s)),d.iushrn(1),t.iushrn(1);for(var u=0,x=1;!(c.words[0]&x)&&u<26;++u,x<<=1);if(u>0)for(c.iushrn(u);u-- >0;)(i.isOdd()||r.isOdd())&&(i.iadd(o),r.isub(s)),i.iushrn(1),r.iushrn(1);a.cmp(c)>=0?(a.isub(c),d.isub(i),t.isub(r)):(c.isub(a),i.isub(d),r.isub(t))}return{a:i,b:r,gcd:c.iushln(n)}},b.prototype._invmp=function(e){f(0===e.negative),f(!e.isZero());var a=this,c=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var d,t=new b(1),i=new b(0),r=c.clone();a.cmpn(1)>0&&c.cmpn(1)>0;){for(var n=0,o=1;!(a.words[0]&o)&&n<26;++n,o<<=1);if(n>0)for(a.iushrn(n);n-- >0;)t.isOdd()&&t.iadd(r),t.iushrn(1);for(var s=0,l=1;!(c.words[0]&l)&&s<26;++s,l<<=1);if(s>0)for(c.iushrn(s);s-- >0;)i.isOdd()&&i.iadd(r),i.iushrn(1);a.cmp(c)>=0?(a.isub(c),t.isub(i)):(c.isub(a),i.isub(t))}return(d=0===a.cmpn(1)?t:i).cmpn(0)<0&&d.iadd(e),d},b.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var a=this.clone(),c=e.clone();a.negative=0,c.negative=0;for(var f=0;a.isEven()&&c.isEven();f++)a.iushrn(1),c.iushrn(1);for(;;){for(;a.isEven();)a.iushrn(1);for(;c.isEven();)c.iushrn(1);var d=a.cmp(c);if(d<0){var b=a;a=c,c=b}else if(0===d||0===c.cmpn(1))break;a.isub(c)}return c.iushln(f)},b.prototype.invm=function(e){return this.egcd(e).a.umod(e)},b.prototype.isEven=function(){return!(1&this.words[0])},b.prototype.isOdd=function(){return!(1&~this.words[0])},b.prototype.andln=function(e){return this.words[0]&e},b.prototype.bincn=function(e){f("number"==typeof e);var a=e%26,c=(e-a)/26,d=1<>>26,i&=67108863,this.words[t]=i}return 0!==b&&(this.words[t]=b,this.length++),this},b.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},b.prototype.cmpn=function(e){var a,c=e<0;if(0!==this.negative&&!c)return-1;if(0===this.negative&&c)return 1;if(this._strip(),this.length>1)a=1;else{c&&(e=-e),f(e<=67108863,"Number is too big");var d=0|this.words[0];a=d===e?0:de.length)return 1;if(this.length=0;c--){var f=0|this.words[c],d=0|e.words[c];if(f!==d){fd&&(a=1);break}}return a},b.prototype.gtn=function(e){return 1===this.cmpn(e)},b.prototype.gt=function(e){return 1===this.cmp(e)},b.prototype.gten=function(e){return this.cmpn(e)>=0},b.prototype.gte=function(e){return this.cmp(e)>=0},b.prototype.ltn=function(e){return-1===this.cmpn(e)},b.prototype.lt=function(e){return-1===this.cmp(e)},b.prototype.lten=function(e){return this.cmpn(e)<=0},b.prototype.lte=function(e){return this.cmp(e)<=0},b.prototype.eqn=function(e){return 0===this.cmpn(e)},b.prototype.eq=function(e){return 0===this.cmp(e)},b.red=function(e){return new I(e)},b.prototype.toRed=function(e){return f(!this.red,"Already a number in reduction context"),f(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},b.prototype.fromRed=function(){return f(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},b.prototype._forceRed=function(e){return this.red=e,this},b.prototype.forceRed=function(e){return f(!this.red,"Already a number in reduction context"),this._forceRed(e)},b.prototype.redAdd=function(e){return f(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},b.prototype.redIAdd=function(e){return f(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},b.prototype.redSub=function(e){return f(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},b.prototype.redISub=function(e){return f(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},b.prototype.redShl=function(e){return f(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},b.prototype.redMul=function(e){return f(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},b.prototype.redIMul=function(e){return f(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},b.prototype.redSqr=function(){return f(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},b.prototype.redISqr=function(){return f(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},b.prototype.redSqrt=function(){return f(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},b.prototype.redInvm=function(){return f(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},b.prototype.redNeg=function(){return f(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},b.prototype.redPow=function(e){return f(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var _={k256:null,p224:null,p192:null,p25519:null};function v(e,a){this.name=e,this.p=new b(a,16),this.n=this.p.bitLength(),this.k=new b(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function L(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(e){if("string"==typeof e){var a=b._prime(e);this.m=a.p,this.prime=a}else f(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function k(e){I.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new b(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)}v.prototype._tmp=function(){var e=new b(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var a,c=e;do{this.split(c,this.tmp),a=(c=(c=this.imulK(c)).iadd(this.tmp)).bitLength()}while(a>this.n);var f=a0?c.isub(this.p):void 0!==c.strip?c.strip():c._strip(),c},v.prototype.split=function(e,a){e.iushrn(this.n,0,a)},v.prototype.imulK=function(e){return e.imul(this.k)},d(w,v),w.prototype.split=function(e,a){for(var c=4194303,f=Math.min(e.length,9),d=0;d>>22,b=t}b>>>=22,e.words[d-10]=b,0===b&&e.length>10?e.length-=10:e.length-=9},w.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var a=0,c=0;c>>=26,e.words[c]=d,a=f}return 0!==a&&(e.words[e.length++]=a),e},b._prime=function(e){if(_[e])return _[e];var a;if("k256"===e)a=new w;else if("p224"===e)a=new M;else if("p192"===e)a=new A;else{if("p25519"!==e)throw new Error("Unknown prime "+e);a=new L}return _[e]=a,a},I.prototype._verify1=function(e){f(0===e.negative,"red works only with positives"),f(e.red,"red works only with red numbers")},I.prototype._verify2=function(e,a){f(!(e.negative|a.negative),"red works only with positives"),f(e.red&&e.red===a.red,"red works only with red numbers")},I.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(o(e,e.umod(this.m)._forceRed(this)),e)},I.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},I.prototype.add=function(e,a){this._verify2(e,a);var c=e.add(a);return c.cmp(this.m)>=0&&c.isub(this.m),c._forceRed(this)},I.prototype.iadd=function(e,a){this._verify2(e,a);var c=e.iadd(a);return c.cmp(this.m)>=0&&c.isub(this.m),c},I.prototype.sub=function(e,a){this._verify2(e,a);var c=e.sub(a);return c.cmpn(0)<0&&c.iadd(this.m),c._forceRed(this)},I.prototype.isub=function(e,a){this._verify2(e,a);var c=e.isub(a);return c.cmpn(0)<0&&c.iadd(this.m),c},I.prototype.shl=function(e,a){return this._verify1(e),this.imod(e.ushln(a))},I.prototype.imul=function(e,a){return this._verify2(e,a),this.imod(e.imul(a))},I.prototype.mul=function(e,a){return this._verify2(e,a),this.imod(e.mul(a))},I.prototype.isqr=function(e){return this.imul(e,e.clone())},I.prototype.sqr=function(e){return this.mul(e,e)},I.prototype.sqrt=function(e){if(e.isZero())return e.clone();var a=this.m.andln(3);if(f(a%2==1),3===a){var c=this.m.add(new b(1)).iushrn(2);return this.pow(e,c)}for(var d=this.m.subn(1),t=0;!d.isZero()&&0===d.andln(1);)t++,d.iushrn(1);f(!d.isZero());var i=new b(1).toRed(this),r=i.redNeg(),n=this.m.subn(1).iushrn(1),o=this.m.bitLength();for(o=new b(2*o*o).toRed(this);0!==this.pow(o,n).cmp(r);)o.redIAdd(r);for(var s=this.pow(o,d),l=this.pow(e,d.addn(1).iushrn(1)),h=this.pow(e,d),u=t;0!==h.cmp(i);){for(var x=h,p=0;0!==x.cmp(i);p++)x=x.redSqr();f(p=0;f--){for(var n=a.words[f],o=r-1;o>=0;o--){var s=n>>o&1;d!==c[0]&&(d=this.sqr(d)),0!==s||0!==t?(t<<=1,t|=s,(4==++i||0===f&&0===o)&&(d=this.mul(d,c[t]),i=0,t=0)):i=0}r=26}return d},I.prototype.convertTo=function(e){var a=e.umod(this.m);return a===e?a.clone():a},I.prototype.convertFrom=function(e){var a=e.clone();return a.red=null,a},b.mont=function(e){return new k(e)},d(k,I),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){var a=this.imod(e.mul(this.rinv));return a.red=null,a},k.prototype.imul=function(e,a){if(e.isZero()||a.isZero())return e.words[0]=0,e.length=1,e;var c=e.imul(a),f=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),d=c.isub(f).iushrn(this.shift),b=d;return d.cmp(this.m)>=0?b=d.isub(this.m):d.cmpn(0)<0&&(b=d.iadd(this.m)),b._forceRed(this)},k.prototype.mul=function(e,a){if(e.isZero()||a.isZero())return new b(0)._forceRed(this);var c=e.mul(a),f=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),d=c.isub(f).iushrn(this.shift),t=d;return d.cmp(this.m)>=0?t=d.isub(this.m):d.cmpn(0)<0&&(t=d.iadd(this.m)),t._forceRed(this)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=c.nmd(e),this)},5037:(e,a,c)=>{var f;function d(e){this.rand=e}if(e.exports=function(e){return f||(f=new d(null)),f.generate(e)},e.exports.Rand=d,d.prototype.generate=function(e){return this._rand(e)},d.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var a=new Uint8Array(e),c=0;c{var f=c(2861).Buffer;function d(e){f.isBuffer(e)||(e=f.from(e));for(var a=e.length/4|0,c=new Array(a),d=0;d>>24]^o[u>>>16&255]^s[x>>>8&255]^l[255&p]^a[g++],t=n[u>>>24]^o[x>>>16&255]^s[p>>>8&255]^l[255&h]^a[g++],i=n[x>>>24]^o[p>>>16&255]^s[h>>>8&255]^l[255&u]^a[g++],r=n[p>>>24]^o[h>>>16&255]^s[u>>>8&255]^l[255&x]^a[g++],h=b,u=t,x=i,p=r;return b=(f[h>>>24]<<24|f[u>>>16&255]<<16|f[x>>>8&255]<<8|f[255&p])^a[g++],t=(f[u>>>24]<<24|f[x>>>16&255]<<16|f[p>>>8&255]<<8|f[255&h])^a[g++],i=(f[x>>>24]<<24|f[p>>>16&255]<<16|f[h>>>8&255]<<8|f[255&u])^a[g++],r=(f[p>>>24]<<24|f[h>>>16&255]<<16|f[u>>>8&255]<<8|f[255&x])^a[g++],[b>>>=0,t>>>=0,i>>>=0,r>>>=0]}var i=[0,1,2,4,8,16,32,64,128,27,54],r=function(){for(var e=new Array(256),a=0;a<256;a++)e[a]=a<128?a<<1:a<<1^283;for(var c=[],f=[],d=[[],[],[],[]],b=[[],[],[],[]],t=0,i=0,r=0;r<256;++r){var n=i^i<<1^i<<2^i<<3^i<<4;n=n>>>8^255&n^99,c[t]=n,f[n]=t;var o=e[t],s=e[o],l=e[s],h=257*e[n]^16843008*n;d[0][t]=h<<24|h>>>8,d[1][t]=h<<16|h>>>16,d[2][t]=h<<8|h>>>24,d[3][t]=h,h=16843009*l^65537*s^257*o^16843008*t,b[0][n]=h<<24|h>>>8,b[1][n]=h<<16|h>>>16,b[2][n]=h<<8|h>>>24,b[3][n]=h,0===t?t=i=1:(t=o^e[e[e[l^o]]],i^=e[e[i]])}return{SBOX:c,INV_SBOX:f,SUB_MIX:d,INV_SUB_MIX:b}}();function n(e){this._key=d(e),this._reset()}n.blockSize=16,n.keySize=32,n.prototype.blockSize=n.blockSize,n.prototype.keySize=n.keySize,n.prototype._reset=function(){for(var e=this._key,a=e.length,c=a+6,f=4*(c+1),d=[],b=0;b>>24,t=r.SBOX[t>>>24]<<24|r.SBOX[t>>>16&255]<<16|r.SBOX[t>>>8&255]<<8|r.SBOX[255&t],t^=i[b/a|0]<<24):a>6&&b%a==4&&(t=r.SBOX[t>>>24]<<24|r.SBOX[t>>>16&255]<<16|r.SBOX[t>>>8&255]<<8|r.SBOX[255&t]),d[b]=d[b-a]^t}for(var n=[],o=0;o>>24]]^r.INV_SUB_MIX[1][r.SBOX[l>>>16&255]]^r.INV_SUB_MIX[2][r.SBOX[l>>>8&255]]^r.INV_SUB_MIX[3][r.SBOX[255&l]]}this._nRounds=c,this._keySchedule=d,this._invKeySchedule=n},n.prototype.encryptBlockRaw=function(e){return t(e=d(e),this._keySchedule,r.SUB_MIX,r.SBOX,this._nRounds)},n.prototype.encryptBlock=function(e){var a=this.encryptBlockRaw(e),c=f.allocUnsafe(16);return c.writeUInt32BE(a[0],0),c.writeUInt32BE(a[1],4),c.writeUInt32BE(a[2],8),c.writeUInt32BE(a[3],12),c},n.prototype.decryptBlock=function(e){var a=(e=d(e))[1];e[1]=e[3],e[3]=a;var c=t(e,this._invKeySchedule,r.INV_SUB_MIX,r.INV_SBOX,this._nRounds),b=f.allocUnsafe(16);return b.writeUInt32BE(c[0],0),b.writeUInt32BE(c[3],4),b.writeUInt32BE(c[2],8),b.writeUInt32BE(c[1],12),b},n.prototype.scrub=function(){b(this._keySchedule),b(this._invKeySchedule),b(this._key)},e.exports.AES=n},2356:(e,a,c)=>{var f=c(462),d=c(2861).Buffer,b=c(6168),t=c(6698),i=c(5892),r=c(295),n=c(5122);function o(e,a,c,t){b.call(this);var r=d.alloc(4,0);this._cipher=new f.AES(a);var o=this._cipher.encryptBlock(r);this._ghash=new i(o),c=function(e,a,c){if(12===a.length)return e._finID=d.concat([a,d.from([0,0,0,1])]),d.concat([a,d.from([0,0,0,2])]);var f=new i(c),b=a.length,t=b%16;f.update(a),t&&(t=16-t,f.update(d.alloc(t,0))),f.update(d.alloc(8,0));var r=8*b,o=d.alloc(8);o.writeUIntBE(r,0,8),f.update(o),e._finID=f.state;var s=d.from(e._finID);return n(s),s}(this,c,o),this._prev=d.from(c),this._cache=d.allocUnsafe(0),this._secCache=d.allocUnsafe(0),this._decrypt=t,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}t(o,b),o.prototype._update=function(e){if(!this._called&&this._alen){var a=16-this._alen%16;a<16&&(a=d.alloc(a,0),this._ghash.update(a))}this._called=!0;var c=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(c),this._len+=e.length,c},o.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=r(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,a){var c=0;e.length!==a.length&&c++;for(var f=Math.min(e.length,a.length),d=0;d{var f=c(5799),d=c(6171),b=c(3219);a.createCipher=a.Cipher=f.createCipher,a.createCipheriv=a.Cipheriv=f.createCipheriv,a.createDecipher=a.Decipher=d.createDecipher,a.createDecipheriv=a.Decipheriv=d.createDecipheriv,a.listCiphers=a.getCiphers=function(){return Object.keys(b)}},6171:(e,a,c)=>{var f=c(2356),d=c(2861).Buffer,b=c(530),t=c(650),i=c(6168),r=c(462),n=c(8078);function o(e,a,c){i.call(this),this._cache=new s,this._last=void 0,this._cipher=new r.AES(a),this._prev=d.from(c),this._mode=e,this._autopadding=!0}function s(){this.cache=d.allocUnsafe(0)}function l(e,a,c){var i=b[e.toLowerCase()];if(!i)throw new TypeError("invalid suite type");if("string"==typeof c&&(c=d.from(c)),"GCM"!==i.mode&&c.length!==i.iv)throw new TypeError("invalid iv length "+c.length);if("string"==typeof a&&(a=d.from(a)),a.length!==i.key/8)throw new TypeError("invalid key length "+a.length);return"stream"===i.type?new t(i.module,a,c,!0):"auth"===i.type?new f(i.module,a,c,!0):new o(i.module,a,c)}c(6698)(o,i),o.prototype._update=function(e){var a,c;this._cache.add(e);for(var f=[];a=this._cache.get(this._autopadding);)c=this._mode.decrypt(this,a),f.push(c);return d.concat(f)},o.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return function(e){var a=e[15];if(a<1||a>16)throw new Error("unable to decrypt data");for(var c=-1;++c16)return a=this.cache.slice(0,16),this.cache=this.cache.slice(16),a}else if(this.cache.length>=16)return a=this.cache.slice(0,16),this.cache=this.cache.slice(16),a;return null},s.prototype.flush=function(){if(this.cache.length)return this.cache},a.createDecipher=function(e,a){var c=b[e.toLowerCase()];if(!c)throw new TypeError("invalid suite type");var f=n(a,!1,c.key,c.iv);return l(e,f.key,f.iv)},a.createDecipheriv=l},5799:(e,a,c)=>{var f=c(530),d=c(2356),b=c(2861).Buffer,t=c(650),i=c(6168),r=c(462),n=c(8078);function o(e,a,c){i.call(this),this._cache=new l,this._cipher=new r.AES(a),this._prev=b.from(c),this._mode=e,this._autopadding=!0}c(6698)(o,i),o.prototype._update=function(e){var a,c;this._cache.add(e);for(var f=[];a=this._cache.get();)c=this._mode.encrypt(this,a),f.push(c);return b.concat(f)};var s=b.alloc(16,16);function l(){this.cache=b.allocUnsafe(0)}function h(e,a,c){var i=f[e.toLowerCase()];if(!i)throw new TypeError("invalid suite type");if("string"==typeof a&&(a=b.from(a)),a.length!==i.key/8)throw new TypeError("invalid key length "+a.length);if("string"==typeof c&&(c=b.from(c)),"GCM"!==i.mode&&c.length!==i.iv)throw new TypeError("invalid iv length "+c.length);return"stream"===i.type?new t(i.module,a,c):"auth"===i.type?new d(i.module,a,c):new o(i.module,a,c)}o.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(s))throw this._cipher.scrub(),new Error("data not multiple of block length")},o.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},l.prototype.add=function(e){this.cache=b.concat([this.cache,e])},l.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},l.prototype.flush=function(){for(var e=16-this.cache.length,a=b.allocUnsafe(e),c=-1;++c{var f=c(2861).Buffer,d=f.alloc(16,0);function b(e){var a=f.allocUnsafe(16);return a.writeUInt32BE(e[0]>>>0,0),a.writeUInt32BE(e[1]>>>0,4),a.writeUInt32BE(e[2]>>>0,8),a.writeUInt32BE(e[3]>>>0,12),a}function t(e){this.h=e,this.state=f.alloc(16,0),this.cache=f.allocUnsafe(0)}t.prototype.ghash=function(e){for(var a=-1;++a0;a--)f[a]=f[a]>>>1|(1&f[a-1])<<31;f[0]=f[0]>>>1,c&&(f[0]=f[0]^225<<24)}this.state=b(d)},t.prototype.update=function(e){var a;for(this.cache=f.concat([this.cache,e]);this.cache.length>=16;)a=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(a)},t.prototype.final=function(e,a){return this.cache.length&&this.ghash(f.concat([this.cache,d],16)),this.ghash(b([0,e,0,a])),this.state},e.exports=t},5122:e=>{e.exports=function(e){for(var a,c=e.length;c--;){if(255!==(a=e.readUInt8(c))){a++,e.writeUInt8(a,c);break}e.writeUInt8(0,c)}}},2884:(e,a,c)=>{var f=c(295);a.encrypt=function(e,a){var c=f(a,e._prev);return e._prev=e._cipher.encryptBlock(c),e._prev},a.decrypt=function(e,a){var c=e._prev;e._prev=a;var d=e._cipher.decryptBlock(a);return f(d,c)}},6383:(e,a,c)=>{var f=c(2861).Buffer,d=c(295);function b(e,a,c){var b=a.length,t=d(a,e._cache);return e._cache=e._cache.slice(b),e._prev=f.concat([e._prev,c?a:t]),t}a.encrypt=function(e,a,c){for(var d,t=f.allocUnsafe(0);a.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=f.allocUnsafe(0)),!(e._cache.length<=a.length)){t=f.concat([t,b(e,a,c)]);break}d=e._cache.length,t=f.concat([t,b(e,a.slice(0,d),c)]),a=a.slice(d)}return t}},5264:(e,a,c)=>{var f=c(2861).Buffer;function d(e,a,c){for(var f,d,t=-1,i=0;++t<8;)f=a&1<<7-t?128:0,i+=(128&(d=e._cipher.encryptBlock(e._prev)[0]^f))>>t%8,e._prev=b(e._prev,c?f:d);return i}function b(e,a){var c=e.length,d=-1,b=f.allocUnsafe(e.length);for(e=f.concat([e,f.from([a])]);++d>7;return b}a.encrypt=function(e,a,c){for(var b=a.length,t=f.allocUnsafe(b),i=-1;++i{var f=c(2861).Buffer;function d(e,a,c){var d=e._cipher.encryptBlock(e._prev)[0]^a;return e._prev=f.concat([e._prev.slice(1),f.from([c?a:d])]),d}a.encrypt=function(e,a,c){for(var b=a.length,t=f.allocUnsafe(b),i=-1;++i{var f=c(295),d=c(2861).Buffer,b=c(5122);function t(e){var a=e._cipher.encryptBlockRaw(e._prev);return b(e._prev),a}a.encrypt=function(e,a){var c=Math.ceil(a.length/16),b=e._cache.length;e._cache=d.concat([e._cache,d.allocUnsafe(16*c)]);for(var i=0;i{a.encrypt=function(e,a){return e._cipher.encryptBlock(a)},a.decrypt=function(e,a){return e._cipher.decryptBlock(a)}},530:(e,a,c)=>{var f={ECB:c(2632),CBC:c(2884),CFB:c(6383),CFB8:c(6975),CFB1:c(5264),OFB:c(6843),CTR:c(3053),GCM:c(3053)},d=c(3219);for(var b in d)d[b].module=f[d[b].mode];e.exports=d},6843:(e,a,c)=>{var f=c(2045).hp,d=c(295);function b(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}a.encrypt=function(e,a){for(;e._cache.length{var f=c(462),d=c(2861).Buffer,b=c(6168);function t(e,a,c,t){b.call(this),this._cipher=new f.AES(a),this._prev=d.from(c),this._cache=d.allocUnsafe(0),this._secCache=d.allocUnsafe(0),this._decrypt=t,this._mode=e}c(6698)(t,b),t.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},t.prototype._final=function(){this._cipher.scrub()},e.exports=t},125:(e,a,c)=>{var f=c(4050),d=c(1241),b=c(530),t=c(2438),i=c(8078);function r(e,a,c){if(e=e.toLowerCase(),b[e])return d.createCipheriv(e,a,c);if(t[e])return new f({key:a,iv:c,mode:e});throw new TypeError("invalid suite type")}function n(e,a,c){if(e=e.toLowerCase(),b[e])return d.createDecipheriv(e,a,c);if(t[e])return new f({key:a,iv:c,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}a.createCipher=a.Cipher=function(e,a){var c,f;if(e=e.toLowerCase(),b[e])c=b[e].key,f=b[e].iv;else{if(!t[e])throw new TypeError("invalid suite type");c=8*t[e].key,f=t[e].iv}var d=i(a,!1,c,f);return r(e,d.key,d.iv)},a.createCipheriv=a.Cipheriv=r,a.createDecipher=a.Decipher=function(e,a){var c,f;if(e=e.toLowerCase(),b[e])c=b[e].key,f=b[e].iv;else{if(!t[e])throw new TypeError("invalid suite type");c=8*t[e].key,f=t[e].iv}var d=i(a,!1,c,f);return n(e,d.key,d.iv)},a.createDecipheriv=a.Decipheriv=n,a.listCiphers=a.getCiphers=function(){return Object.keys(t).concat(d.getCiphers())}},4050:(e,a,c)=>{var f=c(6168),d=c(9560),b=c(6698),t=c(2861).Buffer,i={"des-ede3-cbc":d.CBC.instantiate(d.EDE),"des-ede3":d.EDE,"des-ede-cbc":d.CBC.instantiate(d.EDE),"des-ede":d.EDE,"des-cbc":d.CBC.instantiate(d.DES),"des-ecb":d.DES};function r(e){f.call(this);var a,c=e.mode.toLowerCase(),d=i[c];a=e.decrypt?"decrypt":"encrypt";var b=e.key;t.isBuffer(b)||(b=t.from(b)),"des-ede"!==c&&"des-ede-cbc"!==c||(b=t.concat([b,b.slice(0,8)]));var r=e.iv;t.isBuffer(r)||(r=t.from(r)),this._des=d.create({key:b,iv:r,type:a})}i.des=i["des-cbc"],i.des3=i["des-ede3-cbc"],e.exports=r,b(r,f),r.prototype._update=function(e){return t.from(this._des.update(e))},r.prototype._final=function(){return t.from(this._des.final())}},2438:(e,a)=>{a["des-ecb"]={key:8,iv:0},a["des-cbc"]=a.des={key:8,iv:8},a["des-ede3-cbc"]=a.des3={key:24,iv:8},a["des-ede3"]={key:24,iv:0},a["des-ede-cbc"]={key:16,iv:8},a["des-ede"]={key:16,iv:0}},7332:(e,a,c)=>{var f=c(2045).hp,d=c(9404),b=c(3209);function t(e){var a,c=e.modulus.byteLength();do{a=new d(b(c))}while(a.cmp(e.modulus)>=0||!a.umod(e.prime1)||!a.umod(e.prime2));return a}function i(e,a){var c=function(e){var a=t(e);return{blinder:a.toRed(d.mont(e.modulus)).redPow(new d(e.publicExponent)).fromRed(),unblinder:a.invm(e.modulus)}}(a),b=a.modulus.byteLength(),i=new d(e).mul(c.blinder).umod(a.modulus),r=i.toRed(d.mont(a.prime1)),n=i.toRed(d.mont(a.prime2)),o=a.coefficient,s=a.prime1,l=a.prime2,h=r.redPow(a.exponent1).fromRed(),u=n.redPow(a.exponent2).fromRed(),x=h.isub(u).imul(o).umod(s).imul(l);return u.iadd(x).imul(c.unblinder).umod(a.modulus).toArrayLike(f,"be",b)}i.getr=t,e.exports=i},5715:(e,a,c)=>{"use strict";e.exports=c(2951)},20:(e,a,c)=>{"use strict";var f=c(2861).Buffer,d=c(7108),b=c(6737),t=c(6698),i=c(5359),r=c(4847),n=c(2951);function o(e){b.Writable.call(this);var a=n[e];if(!a)throw new Error("Unknown message digest");this._hashType=a.hash,this._hash=d(a.hash),this._tag=a.id,this._signType=a.sign}function s(e){b.Writable.call(this);var a=n[e];if(!a)throw new Error("Unknown message digest");this._hash=d(a.hash),this._tag=a.id,this._signType=a.sign}function l(e){return new o(e)}function h(e){return new s(e)}Object.keys(n).forEach((function(e){n[e].id=f.from(n[e].id,"hex"),n[e.toLowerCase()]=n[e]})),t(o,b.Writable),o.prototype._write=function(e,a,c){this._hash.update(e),c()},o.prototype.update=function(e,a){return this._hash.update("string"==typeof e?f.from(e,a):e),this},o.prototype.sign=function(e,a){this.end();var c=this._hash.digest(),f=i(c,e,this._hashType,this._signType,this._tag);return a?f.toString(a):f},t(s,b.Writable),s.prototype._write=function(e,a,c){this._hash.update(e),c()},s.prototype.update=function(e,a){return this._hash.update("string"==typeof e?f.from(e,a):e),this},s.prototype.verify=function(e,a,c){var d="string"==typeof a?f.from(a,c):a;this.end();var b=this._hash.digest();return r(d,b,e,this._signType,this._tag)},e.exports={Sign:l,Verify:h,createSign:l,createVerify:h}},5359:(e,a,c)=>{"use strict";var f=c(2861).Buffer,d=c(3507),b=c(7332),t=c(6729).ec,i=c(9404),r=c(8170),n=c(4589);function o(e,a,c,b){if((e=f.from(e.toArray())).length0&&c.ishrn(f),c}function l(e,a,c){var b,t;do{for(b=f.alloc(0);8*b.length{"use strict";var f=c(2861).Buffer,d=c(9404),b=c(6729).ec,t=c(8170),i=c(4589);function r(e,a){if(e.cmpn(0)<=0)throw new Error("invalid sig");if(e.cmp(a)>=0)throw new Error("invalid sig")}e.exports=function(e,a,c,n,o){var s=t(c);if("ec"===s.type){if("ecdsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong public key type");return function(e,a,c){var f=i[c.data.algorithm.curve.join(".")];if(!f)throw new Error("unknown curve "+c.data.algorithm.curve.join("."));var d=new b(f),t=c.data.subjectPrivateKey.data;return d.verify(a,e,t)}(e,a,s)}if("dsa"===s.type){if("dsa"!==n)throw new Error("wrong public key type");return function(e,a,c){var f=c.data.p,b=c.data.q,i=c.data.g,n=c.data.pub_key,o=t.signature.decode(e,"der"),s=o.s,l=o.r;r(s,b),r(l,b);var h=d.mont(f),u=s.invm(b);return 0===i.toRed(h).redPow(new d(a).mul(u).mod(b)).fromRed().mul(n.toRed(h).redPow(l.mul(u).mod(b)).fromRed()).mod(f).mod(b).cmp(l)}(e,a,s)}if("rsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong public key type");a=f.concat([o,a]);for(var l=s.modulus.byteLength(),h=[1],u=0;a.length+h.length+2{var a={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==a.call(e)}},6248:(e,a,c)=>{"use strict";var f=c(3225),d=Object.keys||function(e){var a=[];for(var c in e)a.push(c);return a};e.exports=s;var b=Object.create(c(5622));b.inherits=c(6698);var t=c(206),i=c(7314);b.inherits(s,t);for(var r=d(i.prototype),n=0;n{"use strict";e.exports=b;var f=c(1816),d=Object.create(c(5622));function b(e){if(!(this instanceof b))return new b(e);f.call(this,e)}d.inherits=c(6698),d.inherits(b,f),b.prototype._transform=function(e,a,c){c(null,e)}},206:(e,a,c)=>{"use strict";var f=c(3225);e.exports=m;var d,b=c(2240);m.ReadableState=g,c(7007).EventEmitter;var t=function(e,a){return e.listeners(a).length},i=c(5567),r=c(4116).Buffer,n=(void 0!==c.g?c.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},o=Object.create(c(5622));o.inherits=c(6698);var s=c(2668),l=void 0;l=s&&s.debuglog?s.debuglog("stream"):function(){};var h,u=c(672),x=c(6278);o.inherits(m,i);var p=["error","close","destroy","pause","resume"];function g(e,a){e=e||{};var f=a instanceof(d=d||c(6248));this.objectMode=!!e.objectMode,f&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var b=e.highWaterMark,t=e.readableHighWaterMark,i=this.objectMode?16:16384;this.highWaterMark=b||0===b?b:f&&(t||0===t)?t:i,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new u,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(h||(h=c(6427).I),this.decoder=new h(e.encoding),this.encoding=e.encoding)}function m(e){if(d=d||c(6248),!(this instanceof m))return new m(e);this._readableState=new g(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),i.call(this)}function y(e,a,c,f,d){var b,t=e._readableState;return null===a?(t.reading=!1,function(e,a){if(!a.ended){if(a.decoder){var c=a.decoder.end();c&&c.length&&(a.buffer.push(c),a.length+=a.objectMode?1:c.length)}a.ended=!0,M(e)}}(e,t)):(d||(b=function(e,a){var c,f;return f=a,r.isBuffer(f)||f instanceof n||"string"==typeof a||void 0===a||e.objectMode||(c=new TypeError("Invalid non-string/buffer chunk")),c}(t,a)),b?e.emit("error",b):t.objectMode||a&&a.length>0?("string"==typeof a||t.objectMode||Object.getPrototypeOf(a)===r.prototype||(a=function(e){return r.from(e)}(a)),f?t.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):_(e,t,a,!0):t.ended?e.emit("error",new Error("stream.push() after EOF")):(t.reading=!1,t.decoder&&!c?(a=t.decoder.write(a),t.objectMode||0!==a.length?_(e,t,a,!1):L(e,t)):_(e,t,a,!1))):f||(t.reading=!1)),function(e){return!e.ended&&(e.needReadable||e.lengtha.highWaterMark&&(a.highWaterMark=function(e){return e>=v?e=v:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=a.length?e:a.ended?a.length:(a.needReadable=!0,0))}function M(e){var a=e._readableState;a.needReadable=!1,a.emittedReadable||(l("emitReadable",a.flowing),a.emittedReadable=!0,a.sync?f.nextTick(A,e):A(e))}function A(e){l("emit readable"),e.emit("readable"),S(e)}function L(e,a){a.readingMore||(a.readingMore=!0,f.nextTick(I,e,a))}function I(e,a){for(var c=a.length;!a.reading&&!a.flowing&&!a.ended&&a.length=a.length?(c=a.decoder?a.buffer.join(""):1===a.buffer.length?a.buffer.head.data:a.buffer.concat(a.length),a.buffer.clear()):c=function(e,a,c){var f;return eb.length?b.length:e;if(t===b.length?d+=b:d+=b.slice(0,e),0==(e-=t)){t===b.length?(++f,c.next?a.head=c.next:a.head=a.tail=null):(a.head=c,c.data=b.slice(t));break}++f}return a.length-=f,d}(e,a):function(e,a){var c=r.allocUnsafe(e),f=a.head,d=1;for(f.data.copy(c),e-=f.data.length;f=f.next;){var b=f.data,t=e>b.length?b.length:e;if(b.copy(c,c.length-e,0,t),0==(e-=t)){t===b.length?(++d,f.next?a.head=f.next:a.head=a.tail=null):(a.head=f,f.data=b.slice(t));break}++d}return a.length-=d,c}(e,a),f}(e,a.buffer,a.decoder),c);var c}function B(e){var a=e._readableState;if(a.length>0)throw new Error('"endReadable()" called on non-empty stream');a.endEmitted||(a.ended=!0,f.nextTick(F,a,e))}function F(e,a){e.endEmitted||0!==e.length||(e.endEmitted=!0,a.readable=!1,a.emit("end"))}function O(e,a){for(var c=0,f=e.length;c=a.highWaterMark||a.ended))return l("read: emitReadable",a.length,a.ended),0===a.length&&a.ended?B(this):M(this),null;if(0===(e=w(e,a))&&a.ended)return 0===a.length&&B(this),null;var f,d=a.needReadable;return l("need readable",d),(0===a.length||a.length-e0?C(e,a):null)?(a.needReadable=!0,e=0):a.length-=e,0===a.length&&(a.ended||(a.needReadable=!0),c!==e&&a.ended&&B(this)),null!==f&&this.emit("data",f),f},m.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},m.prototype.pipe=function(e,a){var c=this,d=this._readableState;switch(d.pipesCount){case 0:d.pipes=e;break;case 1:d.pipes=[d.pipes,e];break;default:d.pipes.push(e)}d.pipesCount+=1,l("pipe count=%d opts=%j",d.pipesCount,a);var i=a&&!1===a.end||e===process.stdout||e===process.stderr?g:r;function r(){l("onend"),e.end()}d.endEmitted?f.nextTick(i):c.once("end",i),e.on("unpipe",(function a(f,b){l("onunpipe"),f===c&&b&&!1===b.hasUnpiped&&(b.hasUnpiped=!0,l("cleanup"),e.removeListener("close",x),e.removeListener("finish",p),e.removeListener("drain",n),e.removeListener("error",u),e.removeListener("unpipe",a),c.removeListener("end",r),c.removeListener("end",g),c.removeListener("data",h),o=!0,!d.awaitDrain||e._writableState&&!e._writableState.needDrain||n())}));var n=function(e){return function(){var a=e._readableState;l("pipeOnDrain",a.awaitDrain),a.awaitDrain&&a.awaitDrain--,0===a.awaitDrain&&t(e,"data")&&(a.flowing=!0,S(e))}}(c);e.on("drain",n);var o=!1,s=!1;function h(a){l("ondata"),s=!1,!1!==e.write(a)||s||((1===d.pipesCount&&d.pipes===e||d.pipesCount>1&&-1!==O(d.pipes,e))&&!o&&(l("false write response, pause",d.awaitDrain),d.awaitDrain++,s=!0),c.pause())}function u(a){l("onerror",a),g(),e.removeListener("error",u),0===t(e,"error")&&e.emit("error",a)}function x(){e.removeListener("finish",p),g()}function p(){l("onfinish"),e.removeListener("close",x),g()}function g(){l("unpipe"),c.unpipe(e)}return c.on("data",h),function(e,a,c){if("function"==typeof e.prependListener)return e.prependListener(a,c);e._events&&e._events[a]?b(e._events[a])?e._events[a].unshift(c):e._events[a]=[c,e._events[a]]:e.on(a,c)}(e,"error",u),e.once("close",x),e.once("finish",p),e.emit("pipe",c),d.flowing||(l("pipe resume"),c.resume()),e},m.prototype.unpipe=function(e){var a=this._readableState,c={hasUnpiped:!1};if(0===a.pipesCount)return this;if(1===a.pipesCount)return e&&e!==a.pipes||(e||(e=a.pipes),a.pipes=null,a.pipesCount=0,a.flowing=!1,e&&e.emit("unpipe",this,c)),this;if(!e){var f=a.pipes,d=a.pipesCount;a.pipes=null,a.pipesCount=0,a.flowing=!1;for(var b=0;b{"use strict";e.exports=t;var f=c(6248),d=Object.create(c(5622));function b(e,a){var c=this._transformState;c.transforming=!1;var f=c.writecb;if(!f)return this.emit("error",new Error("write callback called multiple times"));c.writechunk=null,c.writecb=null,null!=a&&this.push(a),f(e);var d=this._readableState;d.reading=!1,(d.needReadable||d.length{"use strict";var f=c(3225);function d(e){var a=this;this.next=null,this.entry=null,this.finish=function(){!function(e,a){var c=e.entry;for(e.entry=null;c;){var f=c.callback;a.pendingcb--,f(undefined),c=c.next}a.corkedRequestsFree.next=e}(a,e)}}e.exports=p;var b,t=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:f.nextTick;p.WritableState=x;var i=Object.create(c(5622));i.inherits=c(6698);var r,n={deprecate:c(4643)},o=c(5567),s=c(4116).Buffer,l=(void 0!==c.g?c.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},h=c(6278);function u(){}function x(e,a){b=b||c(6248),e=e||{};var i=a instanceof b;this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var r=e.highWaterMark,n=e.writableHighWaterMark,o=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i&&(n||0===n)?n:o,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,a){var c=e._writableState,d=c.sync,b=c.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(c),a)!function(e,a,c,d,b){--a.pendingcb,c?(f.nextTick(b,d),f.nextTick(w,e,a),e._writableState.errorEmitted=!0,e.emit("error",d)):(b(d),e._writableState.errorEmitted=!0,e.emit("error",d),w(e,a))}(e,c,d,a,b);else{var i=_(c);i||c.corked||c.bufferProcessing||!c.bufferedRequest||y(e,c),d?t(m,e,c,i,b):m(e,c,i,b)}}(a,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new d(this)}function p(e){if(b=b||c(6248),!(r.call(p,this)||this instanceof b))return new p(e);this._writableState=new x(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),o.call(this)}function g(e,a,c,f,d,b,t){a.writelen=f,a.writecb=t,a.writing=!0,a.sync=!0,c?e._writev(d,a.onwrite):e._write(d,b,a.onwrite),a.sync=!1}function m(e,a,c,f){c||function(e,a){0===a.length&&a.needDrain&&(a.needDrain=!1,e.emit("drain"))}(e,a),a.pendingcb--,f(),w(e,a)}function y(e,a){a.bufferProcessing=!0;var c=a.bufferedRequest;if(e._writev&&c&&c.next){var f=a.bufferedRequestCount,b=new Array(f),t=a.corkedRequestsFree;t.entry=c;for(var i=0,r=!0;c;)b[i]=c,c.isBuf||(r=!1),c=c.next,i+=1;b.allBuffers=r,g(e,a,!0,a.length,b,"",t.finish),a.pendingcb++,a.lastBufferedRequest=null,t.next?(a.corkedRequestsFree=t.next,t.next=null):a.corkedRequestsFree=new d(a),a.bufferedRequestCount=0}else{for(;c;){var n=c.chunk,o=c.encoding,s=c.callback;if(g(e,a,!1,a.objectMode?1:n.length,n,o,s),c=c.next,a.bufferedRequestCount--,a.writing)break}null===c&&(a.lastBufferedRequest=null)}a.bufferedRequest=c,a.bufferProcessing=!1}function _(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function v(e,a){e._final((function(c){a.pendingcb--,c&&e.emit("error",c),a.prefinished=!0,e.emit("prefinish"),w(e,a)}))}function w(e,a){var c=_(a);return c&&(function(e,a){a.prefinished||a.finalCalled||("function"==typeof e._final?(a.pendingcb++,a.finalCalled=!0,f.nextTick(v,e,a)):(a.prefinished=!0,e.emit("prefinish")))}(e,a),0===a.pendingcb&&(a.finished=!0,e.emit("finish"))),c}i.inherits(p,o),x.prototype.getBuffer=function(){for(var e=this.bufferedRequest,a=[];e;)a.push(e),e=e.next;return a},function(){try{Object.defineProperty(x.prototype,"buffer",{get:n.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(r=Function.prototype[Symbol.hasInstance],Object.defineProperty(p,Symbol.hasInstance,{value:function(e){return!!r.call(this,e)||this===p&&e&&e._writableState instanceof x}})):r=function(e){return e instanceof this},p.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},p.prototype.write=function(e,a,c){var d,b=this._writableState,t=!1,i=!b.objectMode&&(d=e,s.isBuffer(d)||d instanceof l);return i&&!s.isBuffer(e)&&(e=function(e){return s.from(e)}(e)),"function"==typeof a&&(c=a,a=null),i?a="buffer":a||(a=b.defaultEncoding),"function"!=typeof c&&(c=u),b.ended?function(e,a){var c=new Error("write after end");e.emit("error",c),f.nextTick(a,c)}(this,c):(i||function(e,a,c,d){var b=!0,t=!1;return null===c?t=new TypeError("May not write null values to stream"):"string"==typeof c||void 0===c||a.objectMode||(t=new TypeError("Invalid non-string/buffer chunk")),t&&(e.emit("error",t),f.nextTick(d,t),b=!1),b}(this,b,e,c))&&(b.pendingcb++,t=function(e,a,c,f,d,b){if(!c){var t=function(e,a,c){return e.objectMode||!1===e.decodeStrings||"string"!=typeof a||(a=s.from(a,c)),a}(a,f,d);f!==t&&(c=!0,d="buffer",f=t)}var i=a.objectMode?1:f.length;a.length+=i;var r=a.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(p.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),p.prototype._write=function(e,a,c){c(new Error("_write() is not implemented"))},p.prototype._writev=null,p.prototype.end=function(e,a,c){var d=this._writableState;"function"==typeof e?(c=e,e=null,a=null):"function"==typeof a&&(c=a,a=null),null!=e&&this.write(e,a),d.corked&&(d.corked=1,this.uncork()),d.ending||function(e,a,c){a.ending=!0,w(e,a),c&&(a.finished?f.nextTick(c):e.once("finish",c)),a.ended=!0,e.writable=!1}(this,d,c)},Object.defineProperty(p.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),p.prototype.destroy=h.destroy,p.prototype._undestroy=h.undestroy,p.prototype._destroy=function(e,a){this.end(),a(e)}},672:(e,a,c)=>{"use strict";var f=c(4116).Buffer,d=c(1638);e.exports=function(){function e(){!function(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var a={data:e,next:null};this.length>0?this.tail.next=a:this.head=a,this.tail=a,++this.length},e.prototype.unshift=function(e){var a={data:e,next:this.head};0===this.length&&(this.tail=a),this.head=a,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var a=this.head,c=""+a.data;a=a.next;)c+=e+a.data;return c},e.prototype.concat=function(e){if(0===this.length)return f.alloc(0);for(var a,c,d=f.allocUnsafe(e>>>0),b=this.head,t=0;b;)a=d,c=t,b.data.copy(a,c),t+=b.data.length,b=b.next;return d},e}(),d&&d.inspect&&d.inspect.custom&&(e.exports.prototype[d.inspect.custom]=function(){var e=d.inspect({length:this.length});return this.constructor.name+" "+e})},6278:(e,a,c)=>{"use strict";var f=c(3225);function d(e,a){e.emit("error",a)}e.exports={destroy:function(e,a){var c=this,b=this._readableState&&this._readableState.destroyed,t=this._writableState&&this._writableState.destroyed;return b||t?(a?a(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,f.nextTick(d,this,e)):f.nextTick(d,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!a&&e?c._writableState?c._writableState.errorEmitted||(c._writableState.errorEmitted=!0,f.nextTick(d,c,e)):f.nextTick(d,c,e):a&&a(e)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},5567:(e,a,c)=>{e.exports=c(7007).EventEmitter},4116:(e,a,c)=>{var f=c(8287),d=f.Buffer;function b(e,a){for(var c in e)a[c]=e[c]}function t(e,a,c){return d(e,a,c)}d.from&&d.alloc&&d.allocUnsafe&&d.allocUnsafeSlow?e.exports=f:(b(f,a),a.Buffer=t),b(d,t),t.from=function(e,a,c){if("number"==typeof e)throw new TypeError("Argument must not be a number");return d(e,a,c)},t.alloc=function(e,a,c){if("number"!=typeof e)throw new TypeError("Argument must be a number");var f=d(e);return void 0!==a?"string"==typeof c?f.fill(a,c):f.fill(a):f.fill(0),f},t.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return d(e)},t.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return f.SlowBuffer(e)}},6737:(e,a,c)=>{(a=e.exports=c(206)).Stream=a,a.Readable=a,a.Writable=c(7314),a.Duplex=c(6248),a.Transform=c(1816),a.PassThrough=c(5242)},6427:(e,a,c)=>{"use strict";var f=c(8393).Buffer,d=f.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function b(e){var a;switch(this.encoding=function(e){var a=function(e){if(!e)return"utf8";for(var a;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(a)return;e=(""+e).toLowerCase(),a=!0}}(e);if("string"!=typeof a&&(f.isEncoding===d||!d(e)))throw new Error("Unknown encoding: "+e);return a||e}(e),this.encoding){case"utf16le":this.text=r,this.end=n,a=4;break;case"utf8":this.fillLast=i,a=4;break;case"base64":this.text=o,this.end=s,a=3;break;default:return this.write=l,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=f.allocUnsafe(a)}function t(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function i(e){var a=this.lastTotal-this.lastNeed,c=function(e,a){if(128!=(192&a[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&a.length>1){if(128!=(192&a[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&a.length>2&&128!=(192&a[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==c?c:this.lastNeed<=e.length?(e.copy(this.lastChar,a,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,a,0,e.length),void(this.lastNeed-=e.length))}function r(e,a){if((e.length-a)%2==0){var c=e.toString("utf16le",a);if(c){var f=c.charCodeAt(c.length-1);if(f>=55296&&f<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],c.slice(0,-1)}return c}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",a,e.length-1)}function n(e){var a=e&&e.length?this.write(e):"";if(this.lastNeed){var c=this.lastTotal-this.lastNeed;return a+this.lastChar.toString("utf16le",0,c)}return a}function o(e,a){var c=(e.length-a)%3;return 0===c?e.toString("base64",a):(this.lastNeed=3-c,this.lastTotal=3,1===c?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",a,e.length-c))}function s(e){var a=e&&e.length?this.write(e):"";return this.lastNeed?a+this.lastChar.toString("base64",0,3-this.lastNeed):a}function l(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}a.I=b,b.prototype.write=function(e){if(0===e.length)return"";var a,c;if(this.lastNeed){if(void 0===(a=this.fillLast(e)))return"";c=this.lastNeed,this.lastNeed=0}else c=0;return c=0?(d>0&&(e.lastNeed=d-1),d):--f=0?(d>0&&(e.lastNeed=d-2),d):--f=0?(d>0&&(2===d?d=0:e.lastNeed=d-3),d):0}(this,e,a);if(!this.lastNeed)return e.toString("utf8",a);this.lastTotal=c;var f=e.length-(c-this.lastNeed);return e.copy(this.lastChar,0,f),e.toString("utf8",a,f)},b.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},8393:(e,a,c)=>{var f=c(8287),d=f.Buffer;function b(e,a){for(var c in e)a[c]=e[c]}function t(e,a,c){return d(e,a,c)}d.from&&d.alloc&&d.allocUnsafe&&d.allocUnsafeSlow?e.exports=f:(b(f,a),a.Buffer=t),b(d,t),t.from=function(e,a,c){if("number"==typeof e)throw new TypeError("Argument must not be a number");return d(e,a,c)},t.alloc=function(e,a,c){if("number"!=typeof e)throw new TypeError("Argument must be a number");var f=d(e);return void 0!==a?"string"==typeof c?f.fill(a,c):f.fill(a):f.fill(0),f},t.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return d(e)},t.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return f.SlowBuffer(e)}},295:(e,a,c)=>{var f=c(2045).hp;e.exports=function(e,a){for(var c=Math.min(e.length,a.length),d=new f(c),b=0;b{"use strict";var f=c(7526),d=c(251),b="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;a.Buffer=r,a.SlowBuffer=function(e){return+e!=e&&(e=0),r.alloc(+e)},a.INSPECT_MAX_BYTES=50;var t=2147483647;function i(e){if(e>t)throw new RangeError('The value "'+e+'" is invalid for option "size"');var a=new Uint8Array(e);return Object.setPrototypeOf(a,r.prototype),a}function r(e,a,c){if("number"==typeof e){if("string"==typeof a)throw new TypeError('The "string" argument must be of type string. Received type number');return s(e)}return n(e,a,c)}function n(e,a,c){if("string"==typeof e)return function(e,a){if("string"==typeof a&&""!==a||(a="utf8"),!r.isEncoding(a))throw new TypeError("Unknown encoding: "+a);var c=0|x(e,a),f=i(c),d=f.write(e,a);return d!==c&&(f=f.slice(0,d)),f}(e,a);if(ArrayBuffer.isView(e))return function(e){if(D(e,Uint8Array)){var a=new Uint8Array(e);return h(a.buffer,a.byteOffset,a.byteLength)}return l(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(D(e,ArrayBuffer)||e&&D(e.buffer,ArrayBuffer))return h(e,a,c);if("undefined"!=typeof SharedArrayBuffer&&(D(e,SharedArrayBuffer)||e&&D(e.buffer,SharedArrayBuffer)))return h(e,a,c);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var f=e.valueOf&&e.valueOf();if(null!=f&&f!==e)return r.from(f,a,c);var d=function(e){if(r.isBuffer(e)){var a=0|u(e.length),c=i(a);return 0===c.length||e.copy(c,0,0,a),c}return void 0!==e.length?"number"!=typeof e.length||z(e.length)?i(0):l(e):"Buffer"===e.type&&Array.isArray(e.data)?l(e.data):void 0}(e);if(d)return d;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return r.from(e[Symbol.toPrimitive]("string"),a,c);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function o(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function s(e){return o(e),i(e<0?0:0|u(e))}function l(e){for(var a=e.length<0?0:0|u(e.length),c=i(a),f=0;f=t)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+t.toString(16)+" bytes");return 0|e}function x(e,a){if(r.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||D(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var c=e.length,f=arguments.length>2&&!0===arguments[2];if(!f&&0===c)return 0;for(var d=!1;;)switch(a){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":return j(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*c;case"hex":return c>>>1;case"base64":return N(e).length;default:if(d)return f?-1:j(e).length;a=(""+a).toLowerCase(),d=!0}}function p(e,a,c){var f=!1;if((void 0===a||a<0)&&(a=0),a>this.length)return"";if((void 0===c||c>this.length)&&(c=this.length),c<=0)return"";if((c>>>=0)<=(a>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,a,c);case"utf8":case"utf-8":return I(this,a,c);case"ascii":return E(this,a,c);case"latin1":case"binary":return S(this,a,c);case"base64":return L(this,a,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,a,c);default:if(f)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),f=!0}}function g(e,a,c){var f=e[a];e[a]=e[c],e[c]=f}function m(e,a,c,f,d){if(0===e.length)return-1;if("string"==typeof c?(f=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),z(c=+c)&&(c=d?0:e.length-1),c<0&&(c=e.length+c),c>=e.length){if(d)return-1;c=e.length-1}else if(c<0){if(!d)return-1;c=0}if("string"==typeof a&&(a=r.from(a,f)),r.isBuffer(a))return 0===a.length?-1:y(e,a,c,f,d);if("number"==typeof a)return a&=255,"function"==typeof Uint8Array.prototype.indexOf?d?Uint8Array.prototype.indexOf.call(e,a,c):Uint8Array.prototype.lastIndexOf.call(e,a,c):y(e,[a],c,f,d);throw new TypeError("val must be string, number or Buffer")}function y(e,a,c,f,d){var b,t=1,i=e.length,r=a.length;if(void 0!==f&&("ucs2"===(f=String(f).toLowerCase())||"ucs-2"===f||"utf16le"===f||"utf-16le"===f)){if(e.length<2||a.length<2)return-1;t=2,i/=2,r/=2,c/=2}function n(e,a){return 1===t?e[a]:e.readUInt16BE(a*t)}if(d){var o=-1;for(b=c;bi&&(c=i-r),b=c;b>=0;b--){for(var s=!0,l=0;ld&&(f=d):f=d;var b=a.length;f>b/2&&(f=b/2);for(var t=0;t>8,d=c%256,b.push(d),b.push(f);return b}(a,e.length-c),e,c,f)}function L(e,a,c){return 0===a&&c===e.length?f.fromByteArray(e):f.fromByteArray(e.slice(a,c))}function I(e,a,c){c=Math.min(e.length,c);for(var f=[],d=a;d239?4:n>223?3:n>191?2:1;if(d+s<=c)switch(s){case 1:n<128&&(o=n);break;case 2:128==(192&(b=e[d+1]))&&(r=(31&n)<<6|63&b)>127&&(o=r);break;case 3:b=e[d+1],t=e[d+2],128==(192&b)&&128==(192&t)&&(r=(15&n)<<12|(63&b)<<6|63&t)>2047&&(r<55296||r>57343)&&(o=r);break;case 4:b=e[d+1],t=e[d+2],i=e[d+3],128==(192&b)&&128==(192&t)&&128==(192&i)&&(r=(15&n)<<18|(63&b)<<12|(63&t)<<6|63&i)>65535&&r<1114112&&(o=r)}null===o?(o=65533,s=1):o>65535&&(o-=65536,f.push(o>>>10&1023|55296),o=56320|1023&o),f.push(o),d+=s}return function(e){var a=e.length;if(a<=k)return String.fromCharCode.apply(String,e);for(var c="",f=0;ff.length?r.from(b).copy(f,d):Uint8Array.prototype.set.call(f,b,d);else{if(!r.isBuffer(b))throw new TypeError('"list" argument must be an Array of Buffers');b.copy(f,d)}d+=b.length}return f},r.byteLength=x,r.prototype._isBuffer=!0,r.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var a=0;ac&&(e+=" ... "),""},b&&(r.prototype[b]=r.prototype.inspect),r.prototype.compare=function(e,a,c,f,d){if(D(e,Uint8Array)&&(e=r.from(e,e.offset,e.byteLength)),!r.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===a&&(a=0),void 0===c&&(c=e?e.length:0),void 0===f&&(f=0),void 0===d&&(d=this.length),a<0||c>e.length||f<0||d>this.length)throw new RangeError("out of range index");if(f>=d&&a>=c)return 0;if(f>=d)return-1;if(a>=c)return 1;if(this===e)return 0;for(var b=(d>>>=0)-(f>>>=0),t=(c>>>=0)-(a>>>=0),i=Math.min(b,t),n=this.slice(f,d),o=e.slice(a,c),s=0;s>>=0,isFinite(c)?(c>>>=0,void 0===f&&(f="utf8")):(f=c,c=void 0)}var d=this.length-a;if((void 0===c||c>d)&&(c=d),e.length>0&&(c<0||a<0)||a>this.length)throw new RangeError("Attempt to write outside buffer bounds");f||(f="utf8");for(var b=!1;;)switch(f){case"hex":return _(this,e,a,c);case"utf8":case"utf-8":return v(this,e,a,c);case"ascii":case"latin1":case"binary":return w(this,e,a,c);case"base64":return M(this,e,a,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,a,c);default:if(b)throw new TypeError("Unknown encoding: "+f);f=(""+f).toLowerCase(),b=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function E(e,a,c){var f="";c=Math.min(e.length,c);for(var d=a;df)&&(c=f);for(var d="",b=a;bc)throw new RangeError("Trying to access beyond buffer length")}function O(e,a,c,f,d,b){if(!r.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(a>d||ae.length)throw new RangeError("Index out of range")}function P(e,a,c,f,d,b){if(c+f>e.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function R(e,a,c,f,b){return a=+a,c>>>=0,b||P(e,0,c,4),d.write(e,a,c,f,23,4),c+4}function T(e,a,c,f,b){return a=+a,c>>>=0,b||P(e,0,c,8),d.write(e,a,c,f,52,8),c+8}r.prototype.slice=function(e,a){var c=this.length;(e=~~e)<0?(e+=c)<0&&(e=0):e>c&&(e=c),(a=void 0===a?c:~~a)<0?(a+=c)<0&&(a=0):a>c&&(a=c),a>>=0,a>>>=0,c||F(e,a,this.length);for(var f=this[e],d=1,b=0;++b>>=0,a>>>=0,c||F(e,a,this.length);for(var f=this[e+--a],d=1;a>0&&(d*=256);)f+=this[e+--a]*d;return f},r.prototype.readUint8=r.prototype.readUInt8=function(e,a){return e>>>=0,a||F(e,1,this.length),this[e]},r.prototype.readUint16LE=r.prototype.readUInt16LE=function(e,a){return e>>>=0,a||F(e,2,this.length),this[e]|this[e+1]<<8},r.prototype.readUint16BE=r.prototype.readUInt16BE=function(e,a){return e>>>=0,a||F(e,2,this.length),this[e]<<8|this[e+1]},r.prototype.readUint32LE=r.prototype.readUInt32LE=function(e,a){return e>>>=0,a||F(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},r.prototype.readUint32BE=r.prototype.readUInt32BE=function(e,a){return e>>>=0,a||F(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},r.prototype.readIntLE=function(e,a,c){e>>>=0,a>>>=0,c||F(e,a,this.length);for(var f=this[e],d=1,b=0;++b=(d*=128)&&(f-=Math.pow(2,8*a)),f},r.prototype.readIntBE=function(e,a,c){e>>>=0,a>>>=0,c||F(e,a,this.length);for(var f=a,d=1,b=this[e+--f];f>0&&(d*=256);)b+=this[e+--f]*d;return b>=(d*=128)&&(b-=Math.pow(2,8*a)),b},r.prototype.readInt8=function(e,a){return e>>>=0,a||F(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},r.prototype.readInt16LE=function(e,a){e>>>=0,a||F(e,2,this.length);var c=this[e]|this[e+1]<<8;return 32768&c?4294901760|c:c},r.prototype.readInt16BE=function(e,a){e>>>=0,a||F(e,2,this.length);var c=this[e+1]|this[e]<<8;return 32768&c?4294901760|c:c},r.prototype.readInt32LE=function(e,a){return e>>>=0,a||F(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},r.prototype.readInt32BE=function(e,a){return e>>>=0,a||F(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},r.prototype.readFloatLE=function(e,a){return e>>>=0,a||F(e,4,this.length),d.read(this,e,!0,23,4)},r.prototype.readFloatBE=function(e,a){return e>>>=0,a||F(e,4,this.length),d.read(this,e,!1,23,4)},r.prototype.readDoubleLE=function(e,a){return e>>>=0,a||F(e,8,this.length),d.read(this,e,!0,52,8)},r.prototype.readDoubleBE=function(e,a){return e>>>=0,a||F(e,8,this.length),d.read(this,e,!1,52,8)},r.prototype.writeUintLE=r.prototype.writeUIntLE=function(e,a,c,f){e=+e,a>>>=0,c>>>=0,f||O(this,e,a,c,Math.pow(2,8*c)-1,0);var d=1,b=0;for(this[a]=255&e;++b>>=0,c>>>=0,f||O(this,e,a,c,Math.pow(2,8*c)-1,0);var d=c-1,b=1;for(this[a+d]=255&e;--d>=0&&(b*=256);)this[a+d]=e/b&255;return a+c},r.prototype.writeUint8=r.prototype.writeUInt8=function(e,a,c){return e=+e,a>>>=0,c||O(this,e,a,1,255,0),this[a]=255&e,a+1},r.prototype.writeUint16LE=r.prototype.writeUInt16LE=function(e,a,c){return e=+e,a>>>=0,c||O(this,e,a,2,65535,0),this[a]=255&e,this[a+1]=e>>>8,a+2},r.prototype.writeUint16BE=r.prototype.writeUInt16BE=function(e,a,c){return e=+e,a>>>=0,c||O(this,e,a,2,65535,0),this[a]=e>>>8,this[a+1]=255&e,a+2},r.prototype.writeUint32LE=r.prototype.writeUInt32LE=function(e,a,c){return e=+e,a>>>=0,c||O(this,e,a,4,4294967295,0),this[a+3]=e>>>24,this[a+2]=e>>>16,this[a+1]=e>>>8,this[a]=255&e,a+4},r.prototype.writeUint32BE=r.prototype.writeUInt32BE=function(e,a,c){return e=+e,a>>>=0,c||O(this,e,a,4,4294967295,0),this[a]=e>>>24,this[a+1]=e>>>16,this[a+2]=e>>>8,this[a+3]=255&e,a+4},r.prototype.writeIntLE=function(e,a,c,f){if(e=+e,a>>>=0,!f){var d=Math.pow(2,8*c-1);O(this,e,a,c,d-1,-d)}var b=0,t=1,i=0;for(this[a]=255&e;++b>>=0,!f){var d=Math.pow(2,8*c-1);O(this,e,a,c,d-1,-d)}var b=c-1,t=1,i=0;for(this[a+b]=255&e;--b>=0&&(t*=256);)e<0&&0===i&&0!==this[a+b+1]&&(i=1),this[a+b]=(e/t|0)-i&255;return a+c},r.prototype.writeInt8=function(e,a,c){return e=+e,a>>>=0,c||O(this,e,a,1,127,-128),e<0&&(e=255+e+1),this[a]=255&e,a+1},r.prototype.writeInt16LE=function(e,a,c){return e=+e,a>>>=0,c||O(this,e,a,2,32767,-32768),this[a]=255&e,this[a+1]=e>>>8,a+2},r.prototype.writeInt16BE=function(e,a,c){return e=+e,a>>>=0,c||O(this,e,a,2,32767,-32768),this[a]=e>>>8,this[a+1]=255&e,a+2},r.prototype.writeInt32LE=function(e,a,c){return e=+e,a>>>=0,c||O(this,e,a,4,2147483647,-2147483648),this[a]=255&e,this[a+1]=e>>>8,this[a+2]=e>>>16,this[a+3]=e>>>24,a+4},r.prototype.writeInt32BE=function(e,a,c){return e=+e,a>>>=0,c||O(this,e,a,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[a]=e>>>24,this[a+1]=e>>>16,this[a+2]=e>>>8,this[a+3]=255&e,a+4},r.prototype.writeFloatLE=function(e,a,c){return R(this,e,a,!0,c)},r.prototype.writeFloatBE=function(e,a,c){return R(this,e,a,!1,c)},r.prototype.writeDoubleLE=function(e,a,c){return T(this,e,a,!0,c)},r.prototype.writeDoubleBE=function(e,a,c){return T(this,e,a,!1,c)},r.prototype.copy=function(e,a,c,f){if(!r.isBuffer(e))throw new TypeError("argument should be a Buffer");if(c||(c=0),f||0===f||(f=this.length),a>=e.length&&(a=e.length),a||(a=0),f>0&&f=this.length)throw new RangeError("Index out of range");if(f<0)throw new RangeError("sourceEnd out of bounds");f>this.length&&(f=this.length),e.length-a>>=0,c=void 0===c?this.length:c>>>0,e||(e=0),"number"==typeof e)for(b=a;b55295&&c<57344){if(!d){if(c>56319){(a-=3)>-1&&b.push(239,191,189);continue}if(t+1===f){(a-=3)>-1&&b.push(239,191,189);continue}d=c;continue}if(c<56320){(a-=3)>-1&&b.push(239,191,189),d=c;continue}c=65536+(d-55296<<10|c-56320)}else d&&(a-=3)>-1&&b.push(239,191,189);if(d=null,c<128){if((a-=1)<0)break;b.push(c)}else if(c<2048){if((a-=2)<0)break;b.push(c>>6|192,63&c|128)}else if(c<65536){if((a-=3)<0)break;b.push(c>>12|224,c>>6&63|128,63&c|128)}else{if(!(c<1114112))throw new Error("Invalid code point");if((a-=4)<0)break;b.push(c>>18|240,c>>12&63|128,c>>6&63|128,63&c|128)}}return b}function N(e){return f.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(U,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(e,a,c,f){for(var d=0;d=a.length||d>=e.length);++d)a[d+c]=e[d];return d}function D(e,a){return e instanceof a||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===a.name}function z(e){return e!=e}var Q=function(){for(var e="0123456789abcdef",a=new Array(256),c=0;c<16;++c)for(var f=16*c,d=0;d<16;++d)a[f+d]=e[c]+e[d];return a}()},8075:(e,a,c)=>{"use strict";var f=c(453),d=c(487),b=d(f("String.prototype.indexOf"));e.exports=function(e,a){var c=f(e,!!a);return"function"==typeof c&&b(e,".prototype.")>-1?d(c):c}},487:(e,a,c)=>{"use strict";var f=c(6743),d=c(453),b=c(6897),t=c(9675),i=d("%Function.prototype.apply%"),r=d("%Function.prototype.call%"),n=d("%Reflect.apply%",!0)||f.call(r,i),o=c(655),s=d("%Math.max%");e.exports=function(e){if("function"!=typeof e)throw new t("a function is required");var a=n(f,r,arguments);return b(a,1+s(0,e.length-(arguments.length-1)),!0)};var l=function(){return n(f,i,arguments)};o?o(e.exports,"apply",{value:l}):e.exports.apply=l},297:e=>{"use strict";const a=Object.freeze({identity:0,sha1:17,"sha2-256":18,"sha2-512":19,"sha3-512":20,"sha3-384":21,"sha3-256":22,"sha3-224":23,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,blake3:30,"murmur3-128":34,"murmur3-32":35,"dbl-sha2-256":86,md4:212,md5:213,bmt:214,"sha2-256-trunc254-padded":4114,"ripemd-128":4178,"ripemd-160":4179,"ripemd-256":4180,"ripemd-320":4181,x11:4352,kangarootwelve:7425,"sm3-256":21325,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"skein256-8":45825,"skein256-16":45826,"skein256-24":45827,"skein256-32":45828,"skein256-40":45829,"skein256-48":45830,"skein256-56":45831,"skein256-64":45832,"skein256-72":45833,"skein256-80":45834,"skein256-88":45835,"skein256-96":45836,"skein256-104":45837,"skein256-112":45838,"skein256-120":45839,"skein256-128":45840,"skein256-136":45841,"skein256-144":45842,"skein256-152":45843,"skein256-160":45844,"skein256-168":45845,"skein256-176":45846,"skein256-184":45847,"skein256-192":45848,"skein256-200":45849,"skein256-208":45850,"skein256-216":45851,"skein256-224":45852,"skein256-232":45853,"skein256-240":45854,"skein256-248":45855,"skein256-256":45856,"skein512-8":45857,"skein512-16":45858,"skein512-24":45859,"skein512-32":45860,"skein512-40":45861,"skein512-48":45862,"skein512-56":45863,"skein512-64":45864,"skein512-72":45865,"skein512-80":45866,"skein512-88":45867,"skein512-96":45868,"skein512-104":45869,"skein512-112":45870,"skein512-120":45871,"skein512-128":45872,"skein512-136":45873,"skein512-144":45874,"skein512-152":45875,"skein512-160":45876,"skein512-168":45877,"skein512-176":45878,"skein512-184":45879,"skein512-192":45880,"skein512-200":45881,"skein512-208":45882,"skein512-216":45883,"skein512-224":45884,"skein512-232":45885,"skein512-240":45886,"skein512-248":45887,"skein512-256":45888,"skein512-264":45889,"skein512-272":45890,"skein512-280":45891,"skein512-288":45892,"skein512-296":45893,"skein512-304":45894,"skein512-312":45895,"skein512-320":45896,"skein512-328":45897,"skein512-336":45898,"skein512-344":45899,"skein512-352":45900,"skein512-360":45901,"skein512-368":45902,"skein512-376":45903,"skein512-384":45904,"skein512-392":45905,"skein512-400":45906,"skein512-408":45907,"skein512-416":45908,"skein512-424":45909,"skein512-432":45910,"skein512-440":45911,"skein512-448":45912,"skein512-456":45913,"skein512-464":45914,"skein512-472":45915,"skein512-480":45916,"skein512-488":45917,"skein512-496":45918,"skein512-504":45919,"skein512-512":45920,"skein1024-8":45921,"skein1024-16":45922,"skein1024-24":45923,"skein1024-32":45924,"skein1024-40":45925,"skein1024-48":45926,"skein1024-56":45927,"skein1024-64":45928,"skein1024-72":45929,"skein1024-80":45930,"skein1024-88":45931,"skein1024-96":45932,"skein1024-104":45933,"skein1024-112":45934,"skein1024-120":45935,"skein1024-128":45936,"skein1024-136":45937,"skein1024-144":45938,"skein1024-152":45939,"skein1024-160":45940,"skein1024-168":45941,"skein1024-176":45942,"skein1024-184":45943,"skein1024-192":45944,"skein1024-200":45945,"skein1024-208":45946,"skein1024-216":45947,"skein1024-224":45948,"skein1024-232":45949,"skein1024-240":45950,"skein1024-248":45951,"skein1024-256":45952,"skein1024-264":45953,"skein1024-272":45954,"skein1024-280":45955,"skein1024-288":45956,"skein1024-296":45957,"skein1024-304":45958,"skein1024-312":45959,"skein1024-320":45960,"skein1024-328":45961,"skein1024-336":45962,"skein1024-344":45963,"skein1024-352":45964,"skein1024-360":45965,"skein1024-368":45966,"skein1024-376":45967,"skein1024-384":45968,"skein1024-392":45969,"skein1024-400":45970,"skein1024-408":45971,"skein1024-416":45972,"skein1024-424":45973,"skein1024-432":45974,"skein1024-440":45975,"skein1024-448":45976,"skein1024-456":45977,"skein1024-464":45978,"skein1024-472":45979,"skein1024-480":45980,"skein1024-488":45981,"skein1024-496":45982,"skein1024-504":45983,"skein1024-512":45984,"skein1024-520":45985,"skein1024-528":45986,"skein1024-536":45987,"skein1024-544":45988,"skein1024-552":45989,"skein1024-560":45990,"skein1024-568":45991,"skein1024-576":45992,"skein1024-584":45993,"skein1024-592":45994,"skein1024-600":45995,"skein1024-608":45996,"skein1024-616":45997,"skein1024-624":45998,"skein1024-632":45999,"skein1024-640":46e3,"skein1024-648":46001,"skein1024-656":46002,"skein1024-664":46003,"skein1024-672":46004,"skein1024-680":46005,"skein1024-688":46006,"skein1024-696":46007,"skein1024-704":46008,"skein1024-712":46009,"skein1024-720":46010,"skein1024-728":46011,"skein1024-736":46012,"skein1024-744":46013,"skein1024-752":46014,"skein1024-760":46015,"skein1024-768":46016,"skein1024-776":46017,"skein1024-784":46018,"skein1024-792":46019,"skein1024-800":46020,"skein1024-808":46021,"skein1024-816":46022,"skein1024-824":46023,"skein1024-832":46024,"skein1024-840":46025,"skein1024-848":46026,"skein1024-856":46027,"skein1024-864":46028,"skein1024-872":46029,"skein1024-880":46030,"skein1024-888":46031,"skein1024-896":46032,"skein1024-904":46033,"skein1024-912":46034,"skein1024-920":46035,"skein1024-928":46036,"skein1024-936":46037,"skein1024-944":46038,"skein1024-952":46039,"skein1024-960":46040,"skein1024-968":46041,"skein1024-976":46042,"skein1024-984":46043,"skein1024-992":46044,"skein1024-1000":46045,"skein1024-1008":46046,"skein1024-1016":46047,"skein1024-1024":46048,"poseidon-bls12_381-a2-fc1":46081,"poseidon-bls12_381-a2-fc1-sc":46082});e.exports={names:a}},7684:(e,a,c)=>{"use strict";const f=c(1466),d=c(1203),{names:b}=c(297),{toString:t}=c(7302),{fromString:i}=c(4117),{concat:r}=c(5007),n={};for(const e in b){const a=e;n[b[a]]=a}function o(e){if(!(e instanceof Uint8Array))throw new Error("multihash must be a Uint8Array");if(e.length<2)throw new Error("multihash too short. must be > 2 bytes.");const a=d.decode(e);if(!h(a))throw new Error(`multihash unknown function code: 0x${a.toString(16)}`);e=e.slice(d.decode.bytes);const c=d.decode(e);if(c<0)throw new Error(`multihash invalid length: ${c}`);if((e=e.slice(d.decode.bytes)).length!==c)throw new Error(`multihash length inconsistent: 0x${t(e,"base16")}`);return{code:a,name:n[a],length:c,digest:e}}function s(e){let a=e;if("string"==typeof e){if(void 0===b[e])throw new Error(`Unrecognized hash function named: ${e}`);a=b[e]}if("number"!=typeof a)throw new Error(`Hash function code should be a number. Got: ${a}`);if(void 0===n[a]&&!l(a))throw new Error(`Unrecognized function code: ${a}`);return a}function l(e){return e>0&&e<16}function h(e){return!!l(e)||!!n[e]}function u(e){o(e)}Object.freeze(n),e.exports={names:b,codes:n,toHexString:function(e){if(!(e instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return t(e,"base16")},fromHexString:function(e){return i(e,"base16")},toB58String:function(e){if(!(e instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return t(f.encode("base58btc",e)).slice(1)},fromB58String:function(e){const a=e instanceof Uint8Array?t(e):e;return f.decode("z"+a)},decode:o,encode:function(e,a,c){if(!e||void 0===a)throw new Error("multihash encode requires at least two args: digest, code");const f=s(a);if(!(e instanceof Uint8Array))throw new Error("digest should be a Uint8Array");if(null==c&&(c=e.length),c&&e.length!==c)throw new Error("digest length should be equal to specified length.");const b=d.encode(f),t=d.encode(c);return r([b,t,e],b.length+t.length+e.length)},coerceCode:s,isAppCode:l,validate:u,prefix:function(e){return u(e),e.subarray(0,2)},isValidCode:h}},4378:(e,a,c)=>{"use strict";const f=c(7684),d={checkCIDComponents:function(e){if(null==e)return"null values are not valid CIDs";if(0!==e.version&&1!==e.version)return"Invalid version, must be a number equal to 1 or 0";if("string"!=typeof e.codec)return"codec must be string";if(0===e.version){if("dag-pb"!==e.codec)return"codec must be 'dag-pb' for CIDv0";if("base58btc"!==e.multibaseName)return"multibaseName must be 'base58btc' for CIDv0"}if(!(e.multihash instanceof Uint8Array))return"multihash must be a Uint8Array";try{f.validate(e.multihash)}catch(e){let a=e.message;return a||(a="Multihash validation failed"),a}}};e.exports=d},6613:(e,a,c)=>{"use strict";const f=c(7684),d=c(1466),b=c(2021),t=c(4378),{concat:i}=c(5007),{toString:r}=c(7302),{equals:n}=c(8402),o=b.nameToCode,s=Object.keys(o).reduce(((e,a)=>(e[o[a]]=a,e)),{}),l=Symbol.for("@ipld/js-cid/CID");class h{constructor(e,a,c,t){if(this.version,this.codec,this.multihash,Object.defineProperty(this,l,{value:!0}),h.isCID(e)){const a=e;return this.version=a.version,this.codec=a.codec,this.multihash=a.multihash,void(this.multibaseName=a.multibaseName||(0===a.version?"base58btc":"base32"))}if("string"==typeof e){const a=d.isEncoded(e);if(a){const c=d.decode(e);this.version=parseInt(c[0].toString(),16),this.codec=b.getCodec(c.slice(1)),this.multihash=b.rmPrefix(c.slice(1)),this.multibaseName=a}else this.version=0,this.codec="dag-pb",this.multihash=f.fromB58String(e),this.multibaseName="base58btc";return h.validateCID(this),void Object.defineProperty(this,"string",{value:e})}if(e instanceof Uint8Array){const a=parseInt(e[0].toString(),16);if(1===a){const c=e;this.version=a,this.codec=b.getCodec(c.slice(1)),this.multihash=b.rmPrefix(c.slice(1)),this.multibaseName="base32"}else this.version=0,this.codec="dag-pb",this.multihash=e,this.multibaseName="base58btc";h.validateCID(this)}else this.version=e,"number"==typeof a&&(a=s[a]),this.codec=a,this.multihash=c,this.multibaseName=t||(0===e?"base58btc":"base32"),h.validateCID(this)}get bytes(){let e=this._bytes;if(!e){if(0===this.version)e=this.multihash;else{if(1!==this.version)throw new Error("unsupported version");{const a=b.getCodeVarint(this.codec);e=i([[1],a,this.multihash],1+a.byteLength+this.multihash.byteLength)}}Object.defineProperty(this,"_bytes",{value:e})}return e}get prefix(){const e=b.getCodeVarint(this.codec),a=f.prefix(this.multihash);return i([[this.version],e,a],1+e.byteLength+a.byteLength)}get code(){return o[this.codec]}toV0(){if("dag-pb"!==this.codec)throw new Error("Cannot convert a non dag-pb CID to CIDv0");const{name:e,length:a}=f.decode(this.multihash);if("sha2-256"!==e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(32!==a)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new h(0,this.codec,this.multihash)}toV1(){return new h(1,this.codec,this.multihash,this.multibaseName)}toBaseEncodedString(e=this.multibaseName){if(this.string&&0!==this.string.length&&e===this.multibaseName)return this.string;let a;if(0===this.version){if("base58btc"!==e)throw new Error("not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()");a=f.toB58String(this.multihash)}else{if(1!==this.version)throw new Error("unsupported version");a=r(d.encode(e,this.bytes))}return e===this.multibaseName&&Object.defineProperty(this,"string",{value:a}),a}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}toString(e){return this.toBaseEncodedString(e)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(e){return this.codec===e.codec&&this.version===e.version&&n(this.multihash,e.multihash)}static validateCID(e){const a=t.checkCIDComponents(e);if(a)throw new Error(a)}static isCID(e){return e instanceof h||Boolean(e&&e[l])}}h.codecs=o,e.exports=h},6168:(e,a,c)=>{var f=c(2861).Buffer,d=c(8310).Transform,b=c(3141).I;function t(e){d.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}c(6698)(t,d),t.prototype.update=function(e,a,c){"string"==typeof e&&(e=f.from(e,a));var d=this._update(e);return this.hashMode?this:(c&&(d=this._toString(d,c)),d)},t.prototype.setAutoPadding=function(){},t.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},t.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},t.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},t.prototype._transform=function(e,a,c){var f;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){f=e}finally{c(f)}},t.prototype._flush=function(e){var a;try{this.push(this.__final())}catch(e){a=e}e(a)},t.prototype._finalOrDigest=function(e){var a=this.__final()||f.alloc(0);return e&&(a=this._toString(a,e,!0)),a},t.prototype._toString=function(e,a,c){if(this._decoder||(this._decoder=new b(a),this._encoding=a),this._encoding!==a)throw new Error("can't switch encodings");var f=this._decoder.write(e);return c&&(f+=this._decoder.end()),f},e.exports=t},5622:(e,a,c)=>{function f(e){return Object.prototype.toString.call(e)}a.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===f(e)},a.isBoolean=function(e){return"boolean"==typeof e},a.isNull=function(e){return null===e},a.isNullOrUndefined=function(e){return null==e},a.isNumber=function(e){return"number"==typeof e},a.isString=function(e){return"string"==typeof e},a.isSymbol=function(e){return"symbol"==typeof e},a.isUndefined=function(e){return void 0===e},a.isRegExp=function(e){return"[object RegExp]"===f(e)},a.isObject=function(e){return"object"==typeof e&&null!==e},a.isDate=function(e){return"[object Date]"===f(e)},a.isError=function(e){return"[object Error]"===f(e)||e instanceof Error},a.isFunction=function(e){return"function"==typeof e},a.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},a.isBuffer=c(8287).Buffer.isBuffer},1324:(e,a,c)=>{var f=c(2045).hp,d=c(6729),b=c(2801);e.exports=function(e){return new i(e)};var t={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function i(e){this.curveType=t[e],this.curveType||(this.curveType={name:e}),this.curve=new d.ec(this.curveType.name),this.keys=void 0}function r(e,a,c){Array.isArray(e)||(e=e.toArray());var d=new f(e);if(c&&d.length=65&&c<=70?c-55:c>=97&&c<=102?c-87:c-48&15}function r(e,a,c){var f=i(e,c);return c-1>=a&&(f|=i(e,c-1)<<4),f}function n(e,a,c,f){for(var d=0,b=Math.min(e.length,c),t=a;t=49?i-49+10:i>=17?i-17+10:i}return d}b.isBN=function(e){return e instanceof b||null!==e&&"object"==typeof e&&e.constructor.wordSize===b.wordSize&&Array.isArray(e.words)},b.max=function(e,a){return e.cmp(a)>0?e:a},b.min=function(e,a){return e.cmp(a)<0?e:a},b.prototype._init=function(e,a,c){if("number"==typeof e)return this._initNumber(e,a,c);if("object"==typeof e)return this._initArray(e,a,c);"hex"===a&&(a=16),f(a===(0|a)&&a>=2&&a<=36);var d=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(d++,this.negative=1),d=0;d-=3)t=e[d]|e[d-1]<<8|e[d-2]<<16,this.words[b]|=t<>>26-i&67108863,(i+=24)>=26&&(i-=26,b++);else if("le"===c)for(d=0,b=0;d>>26-i&67108863,(i+=24)>=26&&(i-=26,b++);return this.strip()},b.prototype._parseHex=function(e,a,c){this.length=Math.ceil((e.length-a)/6),this.words=new Array(this.length);for(var f=0;f=a;f-=2)d=r(e,a,f)<=18?(b-=18,t+=1,this.words[t]|=d>>>26):b+=8;else for(f=(e.length-a)%2==0?a+1:a;f=18?(b-=18,t+=1,this.words[t]|=d>>>26):b+=8;this.strip()},b.prototype._parseBase=function(e,a,c){this.words=[0],this.length=1;for(var f=0,d=1;d<=67108863;d*=a)f++;f--,d=d/a|0;for(var b=e.length-c,t=b%f,i=Math.min(b,b-t)+c,r=0,o=c;o1&&0===this.words[this.length-1];)this.length--;return this._normSign()},b.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},b.prototype.inspect=function(){return(this.red?""};var o=["","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"],s=[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],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function h(e,a,c){c.negative=a.negative^e.negative;var f=e.length+a.length|0;c.length=f,f=f-1|0;var d=0|e.words[0],b=0|a.words[0],t=d*b,i=67108863&t,r=t/67108864|0;c.words[0]=i;for(var n=1;n>>26,s=67108863&r,l=Math.min(n,a.length-1),h=Math.max(0,n-e.length+1);h<=l;h++){var u=n-h|0;o+=(t=(d=0|e.words[u])*(b=0|a.words[h])+s)/67108864|0,s=67108863&t}c.words[n]=0|s,r=0|o}return 0!==r?c.words[n]=0|r:c.length--,c.strip()}b.prototype.toString=function(e,a){var c;if(a=0|a||1,16===(e=e||10)||"hex"===e){c="";for(var d=0,b=0,t=0;t>>24-d&16777215)||t!==this.length-1?o[6-r.length]+r+c:r+c,(d+=2)>=26&&(d-=26,t--)}for(0!==b&&(c=b.toString(16)+c);c.length%a!=0;)c="0"+c;return 0!==this.negative&&(c="-"+c),c}if(e===(0|e)&&e>=2&&e<=36){var n=s[e],h=l[e];c="";var u=this.clone();for(u.negative=0;!u.isZero();){var x=u.modn(h).toString(e);c=(u=u.idivn(h)).isZero()?x+c:o[n-x.length]+x+c}for(this.isZero()&&(c="0"+c);c.length%a!=0;)c="0"+c;return 0!==this.negative&&(c="-"+c),c}f(!1,"Base should be between 2 and 36")},b.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&f(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},b.prototype.toJSON=function(){return this.toString(16)},b.prototype.toBuffer=function(e,a){return f(void 0!==t),this.toArrayLike(t,e,a)},b.prototype.toArray=function(e,a){return this.toArrayLike(Array,e,a)},b.prototype.toArrayLike=function(e,a,c){var d=this.byteLength(),b=c||Math.max(1,d);f(d<=b,"byte array longer than desired length"),f(b>0,"Requested array length <= 0"),this.strip();var t,i,r="le"===a,n=new e(b),o=this.clone();if(r){for(i=0;!o.isZero();i++)t=o.andln(255),o.iushrn(8),n[i]=t;for(;i=4096&&(c+=13,a>>>=13),a>=64&&(c+=7,a>>>=7),a>=8&&(c+=4,a>>>=4),a>=2&&(c+=2,a>>>=2),c+a},b.prototype._zeroBits=function(e){if(0===e)return 26;var a=e,c=0;return 8191&a||(c+=13,a>>>=13),127&a||(c+=7,a>>>=7),15&a||(c+=4,a>>>=4),3&a||(c+=2,a>>>=2),1&a||c++,c},b.prototype.bitLength=function(){var e=this.words[this.length-1],a=this._countBits(e);return 26*(this.length-1)+a},b.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,a=0;ae.length?this.clone().ior(e):e.clone().ior(this)},b.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},b.prototype.iuand=function(e){var a;a=this.length>e.length?e:this;for(var c=0;ce.length?this.clone().iand(e):e.clone().iand(this)},b.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},b.prototype.iuxor=function(e){var a,c;this.length>e.length?(a=this,c=e):(a=e,c=this);for(var f=0;fe.length?this.clone().ixor(e):e.clone().ixor(this)},b.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},b.prototype.inotn=function(e){f("number"==typeof e&&e>=0);var a=0|Math.ceil(e/26),c=e%26;this._expand(a),c>0&&a--;for(var d=0;d0&&(this.words[d]=~this.words[d]&67108863>>26-c),this.strip()},b.prototype.notn=function(e){return this.clone().inotn(e)},b.prototype.setn=function(e,a){f("number"==typeof e&&e>=0);var c=e/26|0,d=e%26;return this._expand(c+1),this.words[c]=a?this.words[c]|1<e.length?(c=this,f=e):(c=e,f=this);for(var d=0,b=0;b>>26;for(;0!==d&&b>>26;if(this.length=c.length,0!==d)this.words[this.length]=d,this.length++;else if(c!==this)for(;be.length?this.clone().iadd(e):e.clone().iadd(this)},b.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var a=this.iadd(e);return e.negative=1,a._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var c,f,d=this.cmp(e);if(0===d)return this.negative=0,this.length=1,this.words[0]=0,this;d>0?(c=this,f=e):(c=e,f=this);for(var b=0,t=0;t>26,this.words[t]=67108863&a;for(;0!==b&&t>26,this.words[t]=67108863&a;if(0===b&&t>>13,h=0|t[1],u=8191&h,x=h>>>13,p=0|t[2],g=8191&p,m=p>>>13,y=0|t[3],_=8191&y,v=y>>>13,w=0|t[4],M=8191&w,A=w>>>13,L=0|t[5],I=8191&L,k=L>>>13,E=0|t[6],S=8191&E,C=E>>>13,B=0|t[7],F=8191&B,O=B>>>13,P=0|t[8],R=8191&P,T=P>>>13,U=0|t[9],j=8191&U,N=U>>>13,q=0|i[0],D=8191&q,z=q>>>13,Q=0|i[1],G=8191&Q,K=Q>>>13,H=0|i[2],V=8191&H,Z=H>>>13,W=0|i[3],Y=8191&W,J=W>>>13,$=0|i[4],X=8191&$,ee=$>>>13,ae=0|i[5],ce=8191&ae,fe=ae>>>13,de=0|i[6],be=8191&de,te=de>>>13,ie=0|i[7],re=8191&ie,ne=ie>>>13,oe=0|i[8],se=8191&oe,le=oe>>>13,he=0|i[9],ue=8191&he,xe=he>>>13;c.negative=e.negative^a.negative,c.length=19;var pe=(n+(f=Math.imul(s,D))|0)+((8191&(d=(d=Math.imul(s,z))+Math.imul(l,D)|0))<<13)|0;n=((b=Math.imul(l,z))+(d>>>13)|0)+(pe>>>26)|0,pe&=67108863,f=Math.imul(u,D),d=(d=Math.imul(u,z))+Math.imul(x,D)|0,b=Math.imul(x,z);var ge=(n+(f=f+Math.imul(s,G)|0)|0)+((8191&(d=(d=d+Math.imul(s,K)|0)+Math.imul(l,G)|0))<<13)|0;n=((b=b+Math.imul(l,K)|0)+(d>>>13)|0)+(ge>>>26)|0,ge&=67108863,f=Math.imul(g,D),d=(d=Math.imul(g,z))+Math.imul(m,D)|0,b=Math.imul(m,z),f=f+Math.imul(u,G)|0,d=(d=d+Math.imul(u,K)|0)+Math.imul(x,G)|0,b=b+Math.imul(x,K)|0;var me=(n+(f=f+Math.imul(s,V)|0)|0)+((8191&(d=(d=d+Math.imul(s,Z)|0)+Math.imul(l,V)|0))<<13)|0;n=((b=b+Math.imul(l,Z)|0)+(d>>>13)|0)+(me>>>26)|0,me&=67108863,f=Math.imul(_,D),d=(d=Math.imul(_,z))+Math.imul(v,D)|0,b=Math.imul(v,z),f=f+Math.imul(g,G)|0,d=(d=d+Math.imul(g,K)|0)+Math.imul(m,G)|0,b=b+Math.imul(m,K)|0,f=f+Math.imul(u,V)|0,d=(d=d+Math.imul(u,Z)|0)+Math.imul(x,V)|0,b=b+Math.imul(x,Z)|0;var ye=(n+(f=f+Math.imul(s,Y)|0)|0)+((8191&(d=(d=d+Math.imul(s,J)|0)+Math.imul(l,Y)|0))<<13)|0;n=((b=b+Math.imul(l,J)|0)+(d>>>13)|0)+(ye>>>26)|0,ye&=67108863,f=Math.imul(M,D),d=(d=Math.imul(M,z))+Math.imul(A,D)|0,b=Math.imul(A,z),f=f+Math.imul(_,G)|0,d=(d=d+Math.imul(_,K)|0)+Math.imul(v,G)|0,b=b+Math.imul(v,K)|0,f=f+Math.imul(g,V)|0,d=(d=d+Math.imul(g,Z)|0)+Math.imul(m,V)|0,b=b+Math.imul(m,Z)|0,f=f+Math.imul(u,Y)|0,d=(d=d+Math.imul(u,J)|0)+Math.imul(x,Y)|0,b=b+Math.imul(x,J)|0;var _e=(n+(f=f+Math.imul(s,X)|0)|0)+((8191&(d=(d=d+Math.imul(s,ee)|0)+Math.imul(l,X)|0))<<13)|0;n=((b=b+Math.imul(l,ee)|0)+(d>>>13)|0)+(_e>>>26)|0,_e&=67108863,f=Math.imul(I,D),d=(d=Math.imul(I,z))+Math.imul(k,D)|0,b=Math.imul(k,z),f=f+Math.imul(M,G)|0,d=(d=d+Math.imul(M,K)|0)+Math.imul(A,G)|0,b=b+Math.imul(A,K)|0,f=f+Math.imul(_,V)|0,d=(d=d+Math.imul(_,Z)|0)+Math.imul(v,V)|0,b=b+Math.imul(v,Z)|0,f=f+Math.imul(g,Y)|0,d=(d=d+Math.imul(g,J)|0)+Math.imul(m,Y)|0,b=b+Math.imul(m,J)|0,f=f+Math.imul(u,X)|0,d=(d=d+Math.imul(u,ee)|0)+Math.imul(x,X)|0,b=b+Math.imul(x,ee)|0;var ve=(n+(f=f+Math.imul(s,ce)|0)|0)+((8191&(d=(d=d+Math.imul(s,fe)|0)+Math.imul(l,ce)|0))<<13)|0;n=((b=b+Math.imul(l,fe)|0)+(d>>>13)|0)+(ve>>>26)|0,ve&=67108863,f=Math.imul(S,D),d=(d=Math.imul(S,z))+Math.imul(C,D)|0,b=Math.imul(C,z),f=f+Math.imul(I,G)|0,d=(d=d+Math.imul(I,K)|0)+Math.imul(k,G)|0,b=b+Math.imul(k,K)|0,f=f+Math.imul(M,V)|0,d=(d=d+Math.imul(M,Z)|0)+Math.imul(A,V)|0,b=b+Math.imul(A,Z)|0,f=f+Math.imul(_,Y)|0,d=(d=d+Math.imul(_,J)|0)+Math.imul(v,Y)|0,b=b+Math.imul(v,J)|0,f=f+Math.imul(g,X)|0,d=(d=d+Math.imul(g,ee)|0)+Math.imul(m,X)|0,b=b+Math.imul(m,ee)|0,f=f+Math.imul(u,ce)|0,d=(d=d+Math.imul(u,fe)|0)+Math.imul(x,ce)|0,b=b+Math.imul(x,fe)|0;var we=(n+(f=f+Math.imul(s,be)|0)|0)+((8191&(d=(d=d+Math.imul(s,te)|0)+Math.imul(l,be)|0))<<13)|0;n=((b=b+Math.imul(l,te)|0)+(d>>>13)|0)+(we>>>26)|0,we&=67108863,f=Math.imul(F,D),d=(d=Math.imul(F,z))+Math.imul(O,D)|0,b=Math.imul(O,z),f=f+Math.imul(S,G)|0,d=(d=d+Math.imul(S,K)|0)+Math.imul(C,G)|0,b=b+Math.imul(C,K)|0,f=f+Math.imul(I,V)|0,d=(d=d+Math.imul(I,Z)|0)+Math.imul(k,V)|0,b=b+Math.imul(k,Z)|0,f=f+Math.imul(M,Y)|0,d=(d=d+Math.imul(M,J)|0)+Math.imul(A,Y)|0,b=b+Math.imul(A,J)|0,f=f+Math.imul(_,X)|0,d=(d=d+Math.imul(_,ee)|0)+Math.imul(v,X)|0,b=b+Math.imul(v,ee)|0,f=f+Math.imul(g,ce)|0,d=(d=d+Math.imul(g,fe)|0)+Math.imul(m,ce)|0,b=b+Math.imul(m,fe)|0,f=f+Math.imul(u,be)|0,d=(d=d+Math.imul(u,te)|0)+Math.imul(x,be)|0,b=b+Math.imul(x,te)|0;var Me=(n+(f=f+Math.imul(s,re)|0)|0)+((8191&(d=(d=d+Math.imul(s,ne)|0)+Math.imul(l,re)|0))<<13)|0;n=((b=b+Math.imul(l,ne)|0)+(d>>>13)|0)+(Me>>>26)|0,Me&=67108863,f=Math.imul(R,D),d=(d=Math.imul(R,z))+Math.imul(T,D)|0,b=Math.imul(T,z),f=f+Math.imul(F,G)|0,d=(d=d+Math.imul(F,K)|0)+Math.imul(O,G)|0,b=b+Math.imul(O,K)|0,f=f+Math.imul(S,V)|0,d=(d=d+Math.imul(S,Z)|0)+Math.imul(C,V)|0,b=b+Math.imul(C,Z)|0,f=f+Math.imul(I,Y)|0,d=(d=d+Math.imul(I,J)|0)+Math.imul(k,Y)|0,b=b+Math.imul(k,J)|0,f=f+Math.imul(M,X)|0,d=(d=d+Math.imul(M,ee)|0)+Math.imul(A,X)|0,b=b+Math.imul(A,ee)|0,f=f+Math.imul(_,ce)|0,d=(d=d+Math.imul(_,fe)|0)+Math.imul(v,ce)|0,b=b+Math.imul(v,fe)|0,f=f+Math.imul(g,be)|0,d=(d=d+Math.imul(g,te)|0)+Math.imul(m,be)|0,b=b+Math.imul(m,te)|0,f=f+Math.imul(u,re)|0,d=(d=d+Math.imul(u,ne)|0)+Math.imul(x,re)|0,b=b+Math.imul(x,ne)|0;var Ae=(n+(f=f+Math.imul(s,se)|0)|0)+((8191&(d=(d=d+Math.imul(s,le)|0)+Math.imul(l,se)|0))<<13)|0;n=((b=b+Math.imul(l,le)|0)+(d>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,f=Math.imul(j,D),d=(d=Math.imul(j,z))+Math.imul(N,D)|0,b=Math.imul(N,z),f=f+Math.imul(R,G)|0,d=(d=d+Math.imul(R,K)|0)+Math.imul(T,G)|0,b=b+Math.imul(T,K)|0,f=f+Math.imul(F,V)|0,d=(d=d+Math.imul(F,Z)|0)+Math.imul(O,V)|0,b=b+Math.imul(O,Z)|0,f=f+Math.imul(S,Y)|0,d=(d=d+Math.imul(S,J)|0)+Math.imul(C,Y)|0,b=b+Math.imul(C,J)|0,f=f+Math.imul(I,X)|0,d=(d=d+Math.imul(I,ee)|0)+Math.imul(k,X)|0,b=b+Math.imul(k,ee)|0,f=f+Math.imul(M,ce)|0,d=(d=d+Math.imul(M,fe)|0)+Math.imul(A,ce)|0,b=b+Math.imul(A,fe)|0,f=f+Math.imul(_,be)|0,d=(d=d+Math.imul(_,te)|0)+Math.imul(v,be)|0,b=b+Math.imul(v,te)|0,f=f+Math.imul(g,re)|0,d=(d=d+Math.imul(g,ne)|0)+Math.imul(m,re)|0,b=b+Math.imul(m,ne)|0,f=f+Math.imul(u,se)|0,d=(d=d+Math.imul(u,le)|0)+Math.imul(x,se)|0,b=b+Math.imul(x,le)|0;var Le=(n+(f=f+Math.imul(s,ue)|0)|0)+((8191&(d=(d=d+Math.imul(s,xe)|0)+Math.imul(l,ue)|0))<<13)|0;n=((b=b+Math.imul(l,xe)|0)+(d>>>13)|0)+(Le>>>26)|0,Le&=67108863,f=Math.imul(j,G),d=(d=Math.imul(j,K))+Math.imul(N,G)|0,b=Math.imul(N,K),f=f+Math.imul(R,V)|0,d=(d=d+Math.imul(R,Z)|0)+Math.imul(T,V)|0,b=b+Math.imul(T,Z)|0,f=f+Math.imul(F,Y)|0,d=(d=d+Math.imul(F,J)|0)+Math.imul(O,Y)|0,b=b+Math.imul(O,J)|0,f=f+Math.imul(S,X)|0,d=(d=d+Math.imul(S,ee)|0)+Math.imul(C,X)|0,b=b+Math.imul(C,ee)|0,f=f+Math.imul(I,ce)|0,d=(d=d+Math.imul(I,fe)|0)+Math.imul(k,ce)|0,b=b+Math.imul(k,fe)|0,f=f+Math.imul(M,be)|0,d=(d=d+Math.imul(M,te)|0)+Math.imul(A,be)|0,b=b+Math.imul(A,te)|0,f=f+Math.imul(_,re)|0,d=(d=d+Math.imul(_,ne)|0)+Math.imul(v,re)|0,b=b+Math.imul(v,ne)|0,f=f+Math.imul(g,se)|0,d=(d=d+Math.imul(g,le)|0)+Math.imul(m,se)|0,b=b+Math.imul(m,le)|0;var Ie=(n+(f=f+Math.imul(u,ue)|0)|0)+((8191&(d=(d=d+Math.imul(u,xe)|0)+Math.imul(x,ue)|0))<<13)|0;n=((b=b+Math.imul(x,xe)|0)+(d>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,f=Math.imul(j,V),d=(d=Math.imul(j,Z))+Math.imul(N,V)|0,b=Math.imul(N,Z),f=f+Math.imul(R,Y)|0,d=(d=d+Math.imul(R,J)|0)+Math.imul(T,Y)|0,b=b+Math.imul(T,J)|0,f=f+Math.imul(F,X)|0,d=(d=d+Math.imul(F,ee)|0)+Math.imul(O,X)|0,b=b+Math.imul(O,ee)|0,f=f+Math.imul(S,ce)|0,d=(d=d+Math.imul(S,fe)|0)+Math.imul(C,ce)|0,b=b+Math.imul(C,fe)|0,f=f+Math.imul(I,be)|0,d=(d=d+Math.imul(I,te)|0)+Math.imul(k,be)|0,b=b+Math.imul(k,te)|0,f=f+Math.imul(M,re)|0,d=(d=d+Math.imul(M,ne)|0)+Math.imul(A,re)|0,b=b+Math.imul(A,ne)|0,f=f+Math.imul(_,se)|0,d=(d=d+Math.imul(_,le)|0)+Math.imul(v,se)|0,b=b+Math.imul(v,le)|0;var ke=(n+(f=f+Math.imul(g,ue)|0)|0)+((8191&(d=(d=d+Math.imul(g,xe)|0)+Math.imul(m,ue)|0))<<13)|0;n=((b=b+Math.imul(m,xe)|0)+(d>>>13)|0)+(ke>>>26)|0,ke&=67108863,f=Math.imul(j,Y),d=(d=Math.imul(j,J))+Math.imul(N,Y)|0,b=Math.imul(N,J),f=f+Math.imul(R,X)|0,d=(d=d+Math.imul(R,ee)|0)+Math.imul(T,X)|0,b=b+Math.imul(T,ee)|0,f=f+Math.imul(F,ce)|0,d=(d=d+Math.imul(F,fe)|0)+Math.imul(O,ce)|0,b=b+Math.imul(O,fe)|0,f=f+Math.imul(S,be)|0,d=(d=d+Math.imul(S,te)|0)+Math.imul(C,be)|0,b=b+Math.imul(C,te)|0,f=f+Math.imul(I,re)|0,d=(d=d+Math.imul(I,ne)|0)+Math.imul(k,re)|0,b=b+Math.imul(k,ne)|0,f=f+Math.imul(M,se)|0,d=(d=d+Math.imul(M,le)|0)+Math.imul(A,se)|0,b=b+Math.imul(A,le)|0;var Ee=(n+(f=f+Math.imul(_,ue)|0)|0)+((8191&(d=(d=d+Math.imul(_,xe)|0)+Math.imul(v,ue)|0))<<13)|0;n=((b=b+Math.imul(v,xe)|0)+(d>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,f=Math.imul(j,X),d=(d=Math.imul(j,ee))+Math.imul(N,X)|0,b=Math.imul(N,ee),f=f+Math.imul(R,ce)|0,d=(d=d+Math.imul(R,fe)|0)+Math.imul(T,ce)|0,b=b+Math.imul(T,fe)|0,f=f+Math.imul(F,be)|0,d=(d=d+Math.imul(F,te)|0)+Math.imul(O,be)|0,b=b+Math.imul(O,te)|0,f=f+Math.imul(S,re)|0,d=(d=d+Math.imul(S,ne)|0)+Math.imul(C,re)|0,b=b+Math.imul(C,ne)|0,f=f+Math.imul(I,se)|0,d=(d=d+Math.imul(I,le)|0)+Math.imul(k,se)|0,b=b+Math.imul(k,le)|0;var Se=(n+(f=f+Math.imul(M,ue)|0)|0)+((8191&(d=(d=d+Math.imul(M,xe)|0)+Math.imul(A,ue)|0))<<13)|0;n=((b=b+Math.imul(A,xe)|0)+(d>>>13)|0)+(Se>>>26)|0,Se&=67108863,f=Math.imul(j,ce),d=(d=Math.imul(j,fe))+Math.imul(N,ce)|0,b=Math.imul(N,fe),f=f+Math.imul(R,be)|0,d=(d=d+Math.imul(R,te)|0)+Math.imul(T,be)|0,b=b+Math.imul(T,te)|0,f=f+Math.imul(F,re)|0,d=(d=d+Math.imul(F,ne)|0)+Math.imul(O,re)|0,b=b+Math.imul(O,ne)|0,f=f+Math.imul(S,se)|0,d=(d=d+Math.imul(S,le)|0)+Math.imul(C,se)|0,b=b+Math.imul(C,le)|0;var Ce=(n+(f=f+Math.imul(I,ue)|0)|0)+((8191&(d=(d=d+Math.imul(I,xe)|0)+Math.imul(k,ue)|0))<<13)|0;n=((b=b+Math.imul(k,xe)|0)+(d>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,f=Math.imul(j,be),d=(d=Math.imul(j,te))+Math.imul(N,be)|0,b=Math.imul(N,te),f=f+Math.imul(R,re)|0,d=(d=d+Math.imul(R,ne)|0)+Math.imul(T,re)|0,b=b+Math.imul(T,ne)|0,f=f+Math.imul(F,se)|0,d=(d=d+Math.imul(F,le)|0)+Math.imul(O,se)|0,b=b+Math.imul(O,le)|0;var Be=(n+(f=f+Math.imul(S,ue)|0)|0)+((8191&(d=(d=d+Math.imul(S,xe)|0)+Math.imul(C,ue)|0))<<13)|0;n=((b=b+Math.imul(C,xe)|0)+(d>>>13)|0)+(Be>>>26)|0,Be&=67108863,f=Math.imul(j,re),d=(d=Math.imul(j,ne))+Math.imul(N,re)|0,b=Math.imul(N,ne),f=f+Math.imul(R,se)|0,d=(d=d+Math.imul(R,le)|0)+Math.imul(T,se)|0,b=b+Math.imul(T,le)|0;var Fe=(n+(f=f+Math.imul(F,ue)|0)|0)+((8191&(d=(d=d+Math.imul(F,xe)|0)+Math.imul(O,ue)|0))<<13)|0;n=((b=b+Math.imul(O,xe)|0)+(d>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,f=Math.imul(j,se),d=(d=Math.imul(j,le))+Math.imul(N,se)|0,b=Math.imul(N,le);var Oe=(n+(f=f+Math.imul(R,ue)|0)|0)+((8191&(d=(d=d+Math.imul(R,xe)|0)+Math.imul(T,ue)|0))<<13)|0;n=((b=b+Math.imul(T,xe)|0)+(d>>>13)|0)+(Oe>>>26)|0,Oe&=67108863;var Pe=(n+(f=Math.imul(j,ue))|0)+((8191&(d=(d=Math.imul(j,xe))+Math.imul(N,ue)|0))<<13)|0;return n=((b=Math.imul(N,xe))+(d>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r[0]=pe,r[1]=ge,r[2]=me,r[3]=ye,r[4]=_e,r[5]=ve,r[6]=we,r[7]=Me,r[8]=Ae,r[9]=Le,r[10]=Ie,r[11]=ke,r[12]=Ee,r[13]=Se,r[14]=Ce,r[15]=Be,r[16]=Fe,r[17]=Oe,r[18]=Pe,0!==n&&(r[19]=n,c.length++),c};function x(e,a,c){return(new p).mulp(e,a,c)}function p(e,a){this.x=e,this.y=a}Math.imul||(u=h),b.prototype.mulTo=function(e,a){var c,f=this.length+e.length;return c=10===this.length&&10===e.length?u(this,e,a):f<63?h(this,e,a):f<1024?function(e,a,c){c.negative=a.negative^e.negative,c.length=e.length+a.length;for(var f=0,d=0,b=0;b>>26)|0)>>>26,t&=67108863}c.words[b]=i,f=t,t=d}return 0!==f?c.words[b]=f:c.length--,c.strip()}(this,e,a):x(this,e,a),c},p.prototype.makeRBT=function(e){for(var a=new Array(e),c=b.prototype._countBits(e)-1,f=0;f>=1;return f},p.prototype.permute=function(e,a,c,f,d,b){for(var t=0;t>>=1)d++;return 1<>>=13,c[2*t+1]=8191&b,b>>>=13;for(t=2*a;t>=26,a+=d/67108864|0,a+=b>>>26,this.words[c]=67108863&b}return 0!==a&&(this.words[c]=a,this.length++),this},b.prototype.muln=function(e){return this.clone().imuln(e)},b.prototype.sqr=function(){return this.mul(this)},b.prototype.isqr=function(){return this.imul(this.clone())},b.prototype.pow=function(e){var a=function(e){for(var a=new Array(e.bitLength()),c=0;c>>d}return a}(e);if(0===a.length)return new b(1);for(var c=this,f=0;f=0);var a,c=e%26,d=(e-c)/26,b=67108863>>>26-c<<26-c;if(0!==c){var t=0;for(a=0;a>>26-c}t&&(this.words[a]=t,this.length++)}if(0!==d){for(a=this.length-1;a>=0;a--)this.words[a+d]=this.words[a];for(a=0;a=0),d=a?(a-a%26)/26:0;var b=e%26,t=Math.min((e-b)/26,this.length),i=67108863^67108863>>>b<t)for(this.length-=t,n=0;n=0&&(0!==o||n>=d);n--){var s=0|this.words[n];this.words[n]=o<<26-b|s>>>b,o=s&i}return r&&0!==o&&(r.words[r.length++]=o),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},b.prototype.ishrn=function(e,a,c){return f(0===this.negative),this.iushrn(e,a,c)},b.prototype.shln=function(e){return this.clone().ishln(e)},b.prototype.ushln=function(e){return this.clone().iushln(e)},b.prototype.shrn=function(e){return this.clone().ishrn(e)},b.prototype.ushrn=function(e){return this.clone().iushrn(e)},b.prototype.testn=function(e){f("number"==typeof e&&e>=0);var a=e%26,c=(e-a)/26,d=1<=0);var a=e%26,c=(e-a)/26;if(f(0===this.negative,"imaskn works only with positive numbers"),this.length<=c)return this;if(0!==a&&c++,this.length=Math.min(c,this.length),0!==a){var d=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},b.prototype.isubn=function(e){if(f("number"==typeof e),f(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(r/67108864|0),this.words[d+c]=67108863&b}for(;d>26,this.words[d+c]=67108863&b;if(0===i)return this.strip();for(f(-1===i),i=0,d=0;d>26,this.words[d]=67108863&b;return this.negative=1,this.strip()},b.prototype._wordDiv=function(e,a){var c=(this.length,e.length),f=this.clone(),d=e,t=0|d.words[d.length-1];0!=(c=26-this._countBits(t))&&(d=d.ushln(c),f.iushln(c),t=0|d.words[d.length-1]);var i,r=f.length-d.length;if("mod"!==a){(i=new b(null)).length=r+1,i.words=new Array(i.length);for(var n=0;n=0;s--){var l=67108864*(0|f.words[d.length+s])+(0|f.words[d.length+s-1]);for(l=Math.min(l/t|0,67108863),f._ishlnsubmul(d,l,s);0!==f.negative;)l--,f.negative=0,f._ishlnsubmul(d,1,s),f.isZero()||(f.negative^=1);i&&(i.words[s]=l)}return i&&i.strip(),f.strip(),"div"!==a&&0!==c&&f.iushrn(c),{div:i||null,mod:f}},b.prototype.divmod=function(e,a,c){return f(!e.isZero()),this.isZero()?{div:new b(0),mod:new b(0)}:0!==this.negative&&0===e.negative?(i=this.neg().divmod(e,a),"mod"!==a&&(d=i.div.neg()),"div"!==a&&(t=i.mod.neg(),c&&0!==t.negative&&t.iadd(e)),{div:d,mod:t}):0===this.negative&&0!==e.negative?(i=this.divmod(e.neg(),a),"mod"!==a&&(d=i.div.neg()),{div:d,mod:i.mod}):this.negative&e.negative?(i=this.neg().divmod(e.neg(),a),"div"!==a&&(t=i.mod.neg(),c&&0!==t.negative&&t.isub(e)),{div:i.div,mod:t}):e.length>this.length||this.cmp(e)<0?{div:new b(0),mod:this}:1===e.length?"div"===a?{div:this.divn(e.words[0]),mod:null}:"mod"===a?{div:null,mod:new b(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new b(this.modn(e.words[0]))}:this._wordDiv(e,a);var d,t,i},b.prototype.div=function(e){return this.divmod(e,"div",!1).div},b.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},b.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},b.prototype.divRound=function(e){var a=this.divmod(e);if(a.mod.isZero())return a.div;var c=0!==a.div.negative?a.mod.isub(e):a.mod,f=e.ushrn(1),d=e.andln(1),b=c.cmp(f);return b<0||1===d&&0===b?a.div:0!==a.div.negative?a.div.isubn(1):a.div.iaddn(1)},b.prototype.modn=function(e){f(e<=67108863);for(var a=(1<<26)%e,c=0,d=this.length-1;d>=0;d--)c=(a*c+(0|this.words[d]))%e;return c},b.prototype.idivn=function(e){f(e<=67108863);for(var a=0,c=this.length-1;c>=0;c--){var d=(0|this.words[c])+67108864*a;this.words[c]=d/e|0,a=d%e}return this.strip()},b.prototype.divn=function(e){return this.clone().idivn(e)},b.prototype.egcd=function(e){f(0===e.negative),f(!e.isZero());var a=this,c=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var d=new b(1),t=new b(0),i=new b(0),r=new b(1),n=0;a.isEven()&&c.isEven();)a.iushrn(1),c.iushrn(1),++n;for(var o=c.clone(),s=a.clone();!a.isZero();){for(var l=0,h=1;!(a.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(a.iushrn(l);l-- >0;)(d.isOdd()||t.isOdd())&&(d.iadd(o),t.isub(s)),d.iushrn(1),t.iushrn(1);for(var u=0,x=1;!(c.words[0]&x)&&u<26;++u,x<<=1);if(u>0)for(c.iushrn(u);u-- >0;)(i.isOdd()||r.isOdd())&&(i.iadd(o),r.isub(s)),i.iushrn(1),r.iushrn(1);a.cmp(c)>=0?(a.isub(c),d.isub(i),t.isub(r)):(c.isub(a),i.isub(d),r.isub(t))}return{a:i,b:r,gcd:c.iushln(n)}},b.prototype._invmp=function(e){f(0===e.negative),f(!e.isZero());var a=this,c=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var d,t=new b(1),i=new b(0),r=c.clone();a.cmpn(1)>0&&c.cmpn(1)>0;){for(var n=0,o=1;!(a.words[0]&o)&&n<26;++n,o<<=1);if(n>0)for(a.iushrn(n);n-- >0;)t.isOdd()&&t.iadd(r),t.iushrn(1);for(var s=0,l=1;!(c.words[0]&l)&&s<26;++s,l<<=1);if(s>0)for(c.iushrn(s);s-- >0;)i.isOdd()&&i.iadd(r),i.iushrn(1);a.cmp(c)>=0?(a.isub(c),t.isub(i)):(c.isub(a),i.isub(t))}return(d=0===a.cmpn(1)?t:i).cmpn(0)<0&&d.iadd(e),d},b.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var a=this.clone(),c=e.clone();a.negative=0,c.negative=0;for(var f=0;a.isEven()&&c.isEven();f++)a.iushrn(1),c.iushrn(1);for(;;){for(;a.isEven();)a.iushrn(1);for(;c.isEven();)c.iushrn(1);var d=a.cmp(c);if(d<0){var b=a;a=c,c=b}else if(0===d||0===c.cmpn(1))break;a.isub(c)}return c.iushln(f)},b.prototype.invm=function(e){return this.egcd(e).a.umod(e)},b.prototype.isEven=function(){return!(1&this.words[0])},b.prototype.isOdd=function(){return!(1&~this.words[0])},b.prototype.andln=function(e){return this.words[0]&e},b.prototype.bincn=function(e){f("number"==typeof e);var a=e%26,c=(e-a)/26,d=1<>>26,i&=67108863,this.words[t]=i}return 0!==b&&(this.words[t]=b,this.length++),this},b.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},b.prototype.cmpn=function(e){var a,c=e<0;if(0!==this.negative&&!c)return-1;if(0===this.negative&&c)return 1;if(this.strip(),this.length>1)a=1;else{c&&(e=-e),f(e<=67108863,"Number is too big");var d=0|this.words[0];a=d===e?0:de.length)return 1;if(this.length=0;c--){var f=0|this.words[c],d=0|e.words[c];if(f!==d){fd&&(a=1);break}}return a},b.prototype.gtn=function(e){return 1===this.cmpn(e)},b.prototype.gt=function(e){return 1===this.cmp(e)},b.prototype.gten=function(e){return this.cmpn(e)>=0},b.prototype.gte=function(e){return this.cmp(e)>=0},b.prototype.ltn=function(e){return-1===this.cmpn(e)},b.prototype.lt=function(e){return-1===this.cmp(e)},b.prototype.lten=function(e){return this.cmpn(e)<=0},b.prototype.lte=function(e){return this.cmp(e)<=0},b.prototype.eqn=function(e){return 0===this.cmpn(e)},b.prototype.eq=function(e){return 0===this.cmp(e)},b.red=function(e){return new M(e)},b.prototype.toRed=function(e){return f(!this.red,"Already a number in reduction context"),f(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},b.prototype.fromRed=function(){return f(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},b.prototype._forceRed=function(e){return this.red=e,this},b.prototype.forceRed=function(e){return f(!this.red,"Already a number in reduction context"),this._forceRed(e)},b.prototype.redAdd=function(e){return f(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},b.prototype.redIAdd=function(e){return f(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},b.prototype.redSub=function(e){return f(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},b.prototype.redISub=function(e){return f(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},b.prototype.redShl=function(e){return f(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},b.prototype.redMul=function(e){return f(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},b.prototype.redIMul=function(e){return f(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},b.prototype.redSqr=function(){return f(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},b.prototype.redISqr=function(){return f(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},b.prototype.redSqrt=function(){return f(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},b.prototype.redInvm=function(){return f(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},b.prototype.redNeg=function(){return f(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},b.prototype.redPow=function(e){return f(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function m(e,a){this.name=e,this.p=new b(a,16),this.n=this.p.bitLength(),this.k=new b(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(e){if("string"==typeof e){var a=b._prime(e);this.m=a.p,this.prime=a}else f(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function A(e){M.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new b(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)}m.prototype._tmp=function(){var e=new b(null);return e.words=new Array(Math.ceil(this.n/13)),e},m.prototype.ireduce=function(e){var a,c=e;do{this.split(c,this.tmp),a=(c=(c=this.imulK(c)).iadd(this.tmp)).bitLength()}while(a>this.n);var f=a0?c.isub(this.p):void 0!==c.strip?c.strip():c._strip(),c},m.prototype.split=function(e,a){e.iushrn(this.n,0,a)},m.prototype.imulK=function(e){return e.imul(this.k)},d(y,m),y.prototype.split=function(e,a){for(var c=4194303,f=Math.min(e.length,9),d=0;d>>22,b=t}b>>>=22,e.words[d-10]=b,0===b&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var a=0,c=0;c>>=26,e.words[c]=d,a=f}return 0!==a&&(e.words[e.length++]=a),e},b._prime=function(e){if(g[e])return g[e];var a;if("k256"===e)a=new y;else if("p224"===e)a=new _;else if("p192"===e)a=new v;else{if("p25519"!==e)throw new Error("Unknown prime "+e);a=new w}return g[e]=a,a},M.prototype._verify1=function(e){f(0===e.negative,"red works only with positives"),f(e.red,"red works only with red numbers")},M.prototype._verify2=function(e,a){f(!(e.negative|a.negative),"red works only with positives"),f(e.red&&e.red===a.red,"red works only with red numbers")},M.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},M.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},M.prototype.add=function(e,a){this._verify2(e,a);var c=e.add(a);return c.cmp(this.m)>=0&&c.isub(this.m),c._forceRed(this)},M.prototype.iadd=function(e,a){this._verify2(e,a);var c=e.iadd(a);return c.cmp(this.m)>=0&&c.isub(this.m),c},M.prototype.sub=function(e,a){this._verify2(e,a);var c=e.sub(a);return c.cmpn(0)<0&&c.iadd(this.m),c._forceRed(this)},M.prototype.isub=function(e,a){this._verify2(e,a);var c=e.isub(a);return c.cmpn(0)<0&&c.iadd(this.m),c},M.prototype.shl=function(e,a){return this._verify1(e),this.imod(e.ushln(a))},M.prototype.imul=function(e,a){return this._verify2(e,a),this.imod(e.imul(a))},M.prototype.mul=function(e,a){return this._verify2(e,a),this.imod(e.mul(a))},M.prototype.isqr=function(e){return this.imul(e,e.clone())},M.prototype.sqr=function(e){return this.mul(e,e)},M.prototype.sqrt=function(e){if(e.isZero())return e.clone();var a=this.m.andln(3);if(f(a%2==1),3===a){var c=this.m.add(new b(1)).iushrn(2);return this.pow(e,c)}for(var d=this.m.subn(1),t=0;!d.isZero()&&0===d.andln(1);)t++,d.iushrn(1);f(!d.isZero());var i=new b(1).toRed(this),r=i.redNeg(),n=this.m.subn(1).iushrn(1),o=this.m.bitLength();for(o=new b(2*o*o).toRed(this);0!==this.pow(o,n).cmp(r);)o.redIAdd(r);for(var s=this.pow(o,d),l=this.pow(e,d.addn(1).iushrn(1)),h=this.pow(e,d),u=t;0!==h.cmp(i);){for(var x=h,p=0;0!==x.cmp(i);p++)x=x.redSqr();f(p=0;f--){for(var n=a.words[f],o=r-1;o>=0;o--){var s=n>>o&1;d!==c[0]&&(d=this.sqr(d)),0!==s||0!==t?(t<<=1,t|=s,(4==++i||0===f&&0===o)&&(d=this.mul(d,c[t]),i=0,t=0)):i=0}r=26}return d},M.prototype.convertTo=function(e){var a=e.umod(this.m);return a===e?a.clone():a},M.prototype.convertFrom=function(e){var a=e.clone();return a.red=null,a},b.mont=function(e){return new A(e)},d(A,M),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var a=this.imod(e.mul(this.rinv));return a.red=null,a},A.prototype.imul=function(e,a){if(e.isZero()||a.isZero())return e.words[0]=0,e.length=1,e;var c=e.imul(a),f=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),d=c.isub(f).iushrn(this.shift),b=d;return d.cmp(this.m)>=0?b=d.isub(this.m):d.cmpn(0)<0&&(b=d.iadd(this.m)),b._forceRed(this)},A.prototype.mul=function(e,a){if(e.isZero()||a.isZero())return new b(0)._forceRed(this);var c=e.mul(a),f=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),d=c.isub(f).iushrn(this.shift),t=d;return d.cmp(this.m)>=0?t=d.isub(this.m):d.cmpn(0)<0&&(t=d.iadd(this.m)),t._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=c.nmd(e),this)},7108:(e,a,c)=>{"use strict";var f=c(6698),d=c(8276),b=c(6011),t=c(2802),i=c(6168);function r(e){i.call(this,"digest"),this._hash=e}f(r,i),r.prototype._update=function(e){this._hash.update(e)},r.prototype._final=function(){return this._hash.digest()},e.exports=function(e){return"md5"===(e=e.toLowerCase())?new d:"rmd160"===e||"ripemd160"===e?new b:new r(t(e))}},320:(e,a,c)=>{var f=c(8276);e.exports=function(e){return(new f).update(e).digest()}},3507:(e,a,c)=>{"use strict";var f=c(6698),d=c(1800),b=c(6168),t=c(2861).Buffer,i=c(320),r=c(6011),n=c(2802),o=t.alloc(128);function s(e,a){b.call(this,"digest"),"string"==typeof a&&(a=t.from(a));var c="sha512"===e||"sha384"===e?128:64;this._alg=e,this._key=a,a.length>c?a=("rmd160"===e?new r:n(e)).update(a).digest():a.length{"use strict";var f=c(6698),d=c(2861).Buffer,b=c(6168),t=d.alloc(128),i=64;function r(e,a){b.call(this,"digest"),"string"==typeof a&&(a=d.from(a)),this._alg=e,this._key=a,a.length>i?a=e(a):a.length{"use strict";c(3209),c(7108),c(3507);var f=c(5715),d=Object.keys(f),b=(["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(d),c(8396));b.pbkdf2,b.pbkdf2Sync;var t=c(125);t.Cipher,t.createCipher,t.Cipheriv,t.createCipheriv,t.Decipher,t.createDecipher,t.Decipheriv,t.createDecipheriv,t.getCiphers,t.listCiphers;var i=c(5380);i.DiffieHellmanGroup,i.createDiffieHellmanGroup,i.getDiffieHellman,i.createDiffieHellman,i.DiffieHellman;var r=c(20);r.createSign,r.Sign,r.createVerify,r.Verify,c(1324);var n=c(7168);n.publicEncrypt,n.privateEncrypt,n.publicDecrypt,n.privateDecrypt;var o=c(6983);o.randomFill,o.randomFillSync},41:(e,a,c)=>{"use strict";var f=c(655),d=c(8068),b=c(9675),t=c(5795);e.exports=function(e,a,c){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new b("`obj` must be an object or a function`");if("string"!=typeof a&&"symbol"!=typeof a)throw new b("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new b("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new b("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new b("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new b("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,r=arguments.length>4?arguments[4]:null,n=arguments.length>5?arguments[5]:null,o=arguments.length>6&&arguments[6],s=!!t&&t(e,a);if(f)f(e,a,{configurable:null===n&&s?s.configurable:!n,enumerable:null===i&&s?s.enumerable:!i,value:c,writable:null===r&&s?s.writable:!r});else{if(!o&&(i||r||n))throw new d("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[a]=c}}},8452:(e,a,c)=>{"use strict";var f=c(1189),d="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),b=Object.prototype.toString,t=Array.prototype.concat,i=c(41),r=c(592)(),n=function(e,a,c,f){if(a in e)if(!0===f){if(e[a]===c)return}else if("function"!=typeof(d=f)||"[object Function]"!==b.call(d)||!f())return;var d;r?i(e,a,c,!0):i(e,a,c)},o=function(e,a){var c=arguments.length>2?arguments[2]:{},b=f(a);d&&(b=t.call(b,Object.getOwnPropertySymbols(a)));for(var i=0;i{"use strict";a.utils=c(7626),a.Cipher=c(2808),a.DES=c(2211),a.CBC=c(3389),a.EDE=c(5279)},3389:(e,a,c)=>{"use strict";var f=c(3349),d=c(6698),b={};function t(e){f.equal(e.length,8,"Invalid IV length"),this.iv=new Array(8);for(var a=0;a{"use strict";var f=c(3349);function d(e){this.options=e,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=!1!==e.padding}e.exports=d,d.prototype._init=function(){},d.prototype.update=function(e){return 0===e.length?[]:"decrypt"===this.type?this._updateDecrypt(e):this._updateEncrypt(e)},d.prototype._buffer=function(e,a){for(var c=Math.min(this.buffer.length-this.bufferOff,e.length-a),f=0;f0;f--)a+=this._buffer(e,a),c+=this._flushBuffer(d,c);return a+=this._buffer(e,a),d},d.prototype.final=function(e){var a,c;return e&&(a=this.update(e)),c="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),a?a.concat(c):c},d.prototype._pad=function(e,a){if(0===a)return!1;for(;a{"use strict";var f=c(3349),d=c(6698),b=c(7626),t=c(2808);function i(){this.tmp=new Array(2),this.keys=null}function r(e){t.call(this,e);var a=new i;this._desState=a,this.deriveKeys(a,e.key)}d(r,t),e.exports=r,r.create=function(e){return new r(e)};var n=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];r.prototype.deriveKeys=function(e,a){e.keys=new Array(32),f.equal(a.length,this.blockSize,"Invalid key length");var c=b.readUInt32BE(a,0),d=b.readUInt32BE(a,4);b.pc1(c,d,e.tmp,0),c=e.tmp[0],d=e.tmp[1];for(var t=0;t>>1];c=b.r28shl(c,i),d=b.r28shl(d,i),b.pc2(c,d,e.keys,t)}},r.prototype._update=function(e,a,c,f){var d=this._desState,t=b.readUInt32BE(e,a),i=b.readUInt32BE(e,a+4);b.ip(t,i,d.tmp,0),t=d.tmp[0],i=d.tmp[1],"encrypt"===this.type?this._encrypt(d,t,i,d.tmp,0):this._decrypt(d,t,i,d.tmp,0),t=d.tmp[0],i=d.tmp[1],b.writeUInt32BE(c,t,f),b.writeUInt32BE(c,i,f+4)},r.prototype._pad=function(e,a){if(!1===this.padding)return!1;for(var c=e.length-a,f=a;f>>0,t=l}b.rip(i,t,f,d)},r.prototype._decrypt=function(e,a,c,f,d){for(var t=c,i=a,r=e.keys.length-2;r>=0;r-=2){var n=e.keys[r],o=e.keys[r+1];b.expand(t,e.tmp,0),n^=e.tmp[0],o^=e.tmp[1];var s=b.substitute(n,o),l=t;t=(i^b.permute(s))>>>0,i=l}b.rip(t,i,f,d)}},5279:(e,a,c)=>{"use strict";var f=c(3349),d=c(6698),b=c(2808),t=c(2211);function i(e,a){f.equal(a.length,24,"Invalid key length");var c=a.slice(0,8),d=a.slice(8,16),b=a.slice(16,24);this.ciphers="encrypt"===e?[t.create({type:"encrypt",key:c}),t.create({type:"decrypt",key:d}),t.create({type:"encrypt",key:b})]:[t.create({type:"decrypt",key:b}),t.create({type:"encrypt",key:d}),t.create({type:"decrypt",key:c})]}function r(e){b.call(this,e);var a=new i(this.type,this.options.key);this._edeState=a}d(r,b),e.exports=r,r.create=function(e){return new r(e)},r.prototype._update=function(e,a,c,f){var d=this._edeState;d.ciphers[0]._update(e,a,c,f),d.ciphers[1]._update(c,f,c,f),d.ciphers[2]._update(c,f,c,f)},r.prototype._pad=t.prototype._pad,r.prototype._unpad=t.prototype._unpad},7626:(e,a)=>{"use strict";a.readUInt32BE=function(e,a){return(e[0+a]<<24|e[1+a]<<16|e[2+a]<<8|e[3+a])>>>0},a.writeUInt32BE=function(e,a,c){e[0+c]=a>>>24,e[1+c]=a>>>16&255,e[2+c]=a>>>8&255,e[3+c]=255&a},a.ip=function(e,a,c,f){for(var d=0,b=0,t=6;t>=0;t-=2){for(var i=0;i<=24;i+=8)d<<=1,d|=a>>>i+t&1;for(i=0;i<=24;i+=8)d<<=1,d|=e>>>i+t&1}for(t=6;t>=0;t-=2){for(i=1;i<=25;i+=8)b<<=1,b|=a>>>i+t&1;for(i=1;i<=25;i+=8)b<<=1,b|=e>>>i+t&1}c[f+0]=d>>>0,c[f+1]=b>>>0},a.rip=function(e,a,c,f){for(var d=0,b=0,t=0;t<4;t++)for(var i=24;i>=0;i-=8)d<<=1,d|=a>>>i+t&1,d<<=1,d|=e>>>i+t&1;for(t=4;t<8;t++)for(i=24;i>=0;i-=8)b<<=1,b|=a>>>i+t&1,b<<=1,b|=e>>>i+t&1;c[f+0]=d>>>0,c[f+1]=b>>>0},a.pc1=function(e,a,c,f){for(var d=0,b=0,t=7;t>=5;t--){for(var i=0;i<=24;i+=8)d<<=1,d|=a>>i+t&1;for(i=0;i<=24;i+=8)d<<=1,d|=e>>i+t&1}for(i=0;i<=24;i+=8)d<<=1,d|=a>>i+t&1;for(t=1;t<=3;t++){for(i=0;i<=24;i+=8)b<<=1,b|=a>>i+t&1;for(i=0;i<=24;i+=8)b<<=1,b|=e>>i+t&1}for(i=0;i<=24;i+=8)b<<=1,b|=e>>i+t&1;c[f+0]=d>>>0,c[f+1]=b>>>0},a.r28shl=function(e,a){return e<>>28-a};var c=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];a.pc2=function(e,a,f,d){for(var b=0,t=0,i=c.length>>>1,r=0;r>>c[r]&1;for(r=i;r>>c[r]&1;f[d+0]=b>>>0,f[d+1]=t>>>0},a.expand=function(e,a,c){var f=0,d=0;f=(1&e)<<5|e>>>27;for(var b=23;b>=15;b-=4)f<<=6,f|=e>>>b&63;for(b=11;b>=3;b-=4)d|=e>>>b&63,d<<=6;d|=(31&e)<<1|e>>>31,a[c+0]=f>>>0,a[c+1]=d>>>0};var f=[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];a.substitute=function(e,a){for(var c=0,d=0;d<4;d++)c<<=4,c|=f[64*d+(e>>>18-6*d&63)];for(d=0;d<4;d++)c<<=4,c|=f[256+64*d+(a>>>18-6*d&63)];return c>>>0};var d=[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];a.permute=function(e){for(var a=0,c=0;c>>d[c]&1;return a>>>0},a.padSplit=function(e,a,c){for(var f=e.toString(2);f.length{var f=c(2045).hp,d=c(4934),b=c(3241),t=c(4910),i={binary:!0,hex:!0,base64:!0};a.DiffieHellmanGroup=a.createDiffieHellmanGroup=a.getDiffieHellman=function(e){var a=new f(b[e].prime,"hex"),c=new f(b[e].gen,"hex");return new t(a,c)},a.createDiffieHellman=a.DiffieHellman=function e(a,c,b,r){return f.isBuffer(c)||void 0===i[c]?e(a,"binary",c,b):(c=c||"binary",r=r||"binary",b=b||new f([2]),f.isBuffer(b)||(b=new f(b,r)),"number"==typeof a?new t(d(a,b),b,!0):(f.isBuffer(a)||(a=new f(a,c)),new t(a,b,!0)))}},4910:(e,a,c)=>{var f=c(2045).hp,d=c(6473),b=new(c(2244)),t=new d(24),i=new d(11),r=new d(10),n=new d(3),o=new d(7),s=c(4934),l=c(3209);function h(e,a){return a=a||"utf8",f.isBuffer(e)||(e=new f(e,a)),this._pub=new d(e),this}function u(e,a){return a=a||"utf8",f.isBuffer(e)||(e=new f(e,a)),this._priv=new d(e),this}e.exports=p;var x={};function p(e,a,c){this.setGenerator(a),this.__prime=new d(e),this._prime=d.mont(this.__prime),this._primeLen=e.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,c?(this.setPublicKey=h,this.setPrivateKey=u):this._primeCode=8}function g(e,a){var c=new f(e.toArray());return a?c.toString(a):c}Object.defineProperty(p.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(e,a){var c=a.toString("hex"),f=[c,e.toString(16)].join("_");if(f in x)return x[f];var d,l=0;if(e.isEven()||!s.simpleSieve||!s.fermatTest(e)||!b.test(e))return l+=1,l+="02"===c||"05"===c?8:4,x[f]=l,l;switch(b.test(e.shrn(1))||(l+=2),c){case"02":e.mod(t).cmp(i)&&(l+=8);break;case"05":(d=e.mod(r)).cmp(n)&&d.cmp(o)&&(l+=8);break;default:l+=4}return x[f]=l,l}(this.__prime,this.__gen)),this._primeCode}}),p.prototype.generateKeys=function(){return this._priv||(this._priv=new d(l(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},p.prototype.computeSecret=function(e){var a=(e=(e=new d(e)).toRed(this._prime)).redPow(this._priv).fromRed(),c=new f(a.toArray()),b=this.getPrime();if(c.length{var f=c(3209);e.exports=m,m.simpleSieve=p,m.fermatTest=g;var d=c(6473),b=new d(24),t=new(c(2244)),i=new d(1),r=new d(2),n=new d(5),o=(new d(16),new d(8),new d(10)),s=new d(3),l=(new d(7),new d(11)),h=new d(4),u=(new d(12),null);function x(){if(null!==u)return u;var e=[];e[0]=2;for(var a=1,c=3;c<1048576;c+=2){for(var f=Math.ceil(Math.sqrt(c)),d=0;de;)c.ishrn(1);if(c.isEven()&&c.iadd(i),c.testn(1)||c.iadd(r),a.cmp(r)){if(!a.cmp(n))for(;c.mod(o).cmp(s);)c.iadd(h)}else for(;c.mod(b).cmp(l);)c.iadd(h);if(p(u=c.shrn(1))&&p(c)&&g(u)&&g(c)&&t.test(u)&&t.test(c))return c}}},6473:function(e,a,c){!function(e,a){"use strict";function f(e,a){if(!e)throw new Error(a||"Assertion failed")}function d(e,a){e.super_=a;var c=function(){};c.prototype=a.prototype,e.prototype=new c,e.prototype.constructor=e}function b(e,a,c){if(b.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==a&&"be"!==a||(c=a,a=10),this._init(e||0,a||10,c||"be"))}var t;"object"==typeof e?e.exports=b:a.BN=b,b.BN=b,b.wordSize=26;try{t="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:c(6089).Buffer}catch(e){}function i(e,a){var c=e.charCodeAt(a);return c>=65&&c<=70?c-55:c>=97&&c<=102?c-87:c-48&15}function r(e,a,c){var f=i(e,c);return c-1>=a&&(f|=i(e,c-1)<<4),f}function n(e,a,c,f){for(var d=0,b=Math.min(e.length,c),t=a;t=49?i-49+10:i>=17?i-17+10:i}return d}b.isBN=function(e){return e instanceof b||null!==e&&"object"==typeof e&&e.constructor.wordSize===b.wordSize&&Array.isArray(e.words)},b.max=function(e,a){return e.cmp(a)>0?e:a},b.min=function(e,a){return e.cmp(a)<0?e:a},b.prototype._init=function(e,a,c){if("number"==typeof e)return this._initNumber(e,a,c);if("object"==typeof e)return this._initArray(e,a,c);"hex"===a&&(a=16),f(a===(0|a)&&a>=2&&a<=36);var d=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(d++,this.negative=1),d=0;d-=3)t=e[d]|e[d-1]<<8|e[d-2]<<16,this.words[b]|=t<>>26-i&67108863,(i+=24)>=26&&(i-=26,b++);else if("le"===c)for(d=0,b=0;d>>26-i&67108863,(i+=24)>=26&&(i-=26,b++);return this.strip()},b.prototype._parseHex=function(e,a,c){this.length=Math.ceil((e.length-a)/6),this.words=new Array(this.length);for(var f=0;f=a;f-=2)d=r(e,a,f)<=18?(b-=18,t+=1,this.words[t]|=d>>>26):b+=8;else for(f=(e.length-a)%2==0?a+1:a;f=18?(b-=18,t+=1,this.words[t]|=d>>>26):b+=8;this.strip()},b.prototype._parseBase=function(e,a,c){this.words=[0],this.length=1;for(var f=0,d=1;d<=67108863;d*=a)f++;f--,d=d/a|0;for(var b=e.length-c,t=b%f,i=Math.min(b,b-t)+c,r=0,o=c;o1&&0===this.words[this.length-1];)this.length--;return this._normSign()},b.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},b.prototype.inspect=function(){return(this.red?""};var o=["","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"],s=[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],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function h(e,a,c){c.negative=a.negative^e.negative;var f=e.length+a.length|0;c.length=f,f=f-1|0;var d=0|e.words[0],b=0|a.words[0],t=d*b,i=67108863&t,r=t/67108864|0;c.words[0]=i;for(var n=1;n>>26,s=67108863&r,l=Math.min(n,a.length-1),h=Math.max(0,n-e.length+1);h<=l;h++){var u=n-h|0;o+=(t=(d=0|e.words[u])*(b=0|a.words[h])+s)/67108864|0,s=67108863&t}c.words[n]=0|s,r=0|o}return 0!==r?c.words[n]=0|r:c.length--,c.strip()}b.prototype.toString=function(e,a){var c;if(a=0|a||1,16===(e=e||10)||"hex"===e){c="";for(var d=0,b=0,t=0;t>>24-d&16777215)||t!==this.length-1?o[6-r.length]+r+c:r+c,(d+=2)>=26&&(d-=26,t--)}for(0!==b&&(c=b.toString(16)+c);c.length%a!=0;)c="0"+c;return 0!==this.negative&&(c="-"+c),c}if(e===(0|e)&&e>=2&&e<=36){var n=s[e],h=l[e];c="";var u=this.clone();for(u.negative=0;!u.isZero();){var x=u.modn(h).toString(e);c=(u=u.idivn(h)).isZero()?x+c:o[n-x.length]+x+c}for(this.isZero()&&(c="0"+c);c.length%a!=0;)c="0"+c;return 0!==this.negative&&(c="-"+c),c}f(!1,"Base should be between 2 and 36")},b.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&f(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},b.prototype.toJSON=function(){return this.toString(16)},b.prototype.toBuffer=function(e,a){return f(void 0!==t),this.toArrayLike(t,e,a)},b.prototype.toArray=function(e,a){return this.toArrayLike(Array,e,a)},b.prototype.toArrayLike=function(e,a,c){var d=this.byteLength(),b=c||Math.max(1,d);f(d<=b,"byte array longer than desired length"),f(b>0,"Requested array length <= 0"),this.strip();var t,i,r="le"===a,n=new e(b),o=this.clone();if(r){for(i=0;!o.isZero();i++)t=o.andln(255),o.iushrn(8),n[i]=t;for(;i=4096&&(c+=13,a>>>=13),a>=64&&(c+=7,a>>>=7),a>=8&&(c+=4,a>>>=4),a>=2&&(c+=2,a>>>=2),c+a},b.prototype._zeroBits=function(e){if(0===e)return 26;var a=e,c=0;return 8191&a||(c+=13,a>>>=13),127&a||(c+=7,a>>>=7),15&a||(c+=4,a>>>=4),3&a||(c+=2,a>>>=2),1&a||c++,c},b.prototype.bitLength=function(){var e=this.words[this.length-1],a=this._countBits(e);return 26*(this.length-1)+a},b.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,a=0;ae.length?this.clone().ior(e):e.clone().ior(this)},b.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},b.prototype.iuand=function(e){var a;a=this.length>e.length?e:this;for(var c=0;ce.length?this.clone().iand(e):e.clone().iand(this)},b.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},b.prototype.iuxor=function(e){var a,c;this.length>e.length?(a=this,c=e):(a=e,c=this);for(var f=0;fe.length?this.clone().ixor(e):e.clone().ixor(this)},b.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},b.prototype.inotn=function(e){f("number"==typeof e&&e>=0);var a=0|Math.ceil(e/26),c=e%26;this._expand(a),c>0&&a--;for(var d=0;d0&&(this.words[d]=~this.words[d]&67108863>>26-c),this.strip()},b.prototype.notn=function(e){return this.clone().inotn(e)},b.prototype.setn=function(e,a){f("number"==typeof e&&e>=0);var c=e/26|0,d=e%26;return this._expand(c+1),this.words[c]=a?this.words[c]|1<e.length?(c=this,f=e):(c=e,f=this);for(var d=0,b=0;b>>26;for(;0!==d&&b>>26;if(this.length=c.length,0!==d)this.words[this.length]=d,this.length++;else if(c!==this)for(;be.length?this.clone().iadd(e):e.clone().iadd(this)},b.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var a=this.iadd(e);return e.negative=1,a._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var c,f,d=this.cmp(e);if(0===d)return this.negative=0,this.length=1,this.words[0]=0,this;d>0?(c=this,f=e):(c=e,f=this);for(var b=0,t=0;t>26,this.words[t]=67108863&a;for(;0!==b&&t>26,this.words[t]=67108863&a;if(0===b&&t>>13,h=0|t[1],u=8191&h,x=h>>>13,p=0|t[2],g=8191&p,m=p>>>13,y=0|t[3],_=8191&y,v=y>>>13,w=0|t[4],M=8191&w,A=w>>>13,L=0|t[5],I=8191&L,k=L>>>13,E=0|t[6],S=8191&E,C=E>>>13,B=0|t[7],F=8191&B,O=B>>>13,P=0|t[8],R=8191&P,T=P>>>13,U=0|t[9],j=8191&U,N=U>>>13,q=0|i[0],D=8191&q,z=q>>>13,Q=0|i[1],G=8191&Q,K=Q>>>13,H=0|i[2],V=8191&H,Z=H>>>13,W=0|i[3],Y=8191&W,J=W>>>13,$=0|i[4],X=8191&$,ee=$>>>13,ae=0|i[5],ce=8191&ae,fe=ae>>>13,de=0|i[6],be=8191&de,te=de>>>13,ie=0|i[7],re=8191&ie,ne=ie>>>13,oe=0|i[8],se=8191&oe,le=oe>>>13,he=0|i[9],ue=8191&he,xe=he>>>13;c.negative=e.negative^a.negative,c.length=19;var pe=(n+(f=Math.imul(s,D))|0)+((8191&(d=(d=Math.imul(s,z))+Math.imul(l,D)|0))<<13)|0;n=((b=Math.imul(l,z))+(d>>>13)|0)+(pe>>>26)|0,pe&=67108863,f=Math.imul(u,D),d=(d=Math.imul(u,z))+Math.imul(x,D)|0,b=Math.imul(x,z);var ge=(n+(f=f+Math.imul(s,G)|0)|0)+((8191&(d=(d=d+Math.imul(s,K)|0)+Math.imul(l,G)|0))<<13)|0;n=((b=b+Math.imul(l,K)|0)+(d>>>13)|0)+(ge>>>26)|0,ge&=67108863,f=Math.imul(g,D),d=(d=Math.imul(g,z))+Math.imul(m,D)|0,b=Math.imul(m,z),f=f+Math.imul(u,G)|0,d=(d=d+Math.imul(u,K)|0)+Math.imul(x,G)|0,b=b+Math.imul(x,K)|0;var me=(n+(f=f+Math.imul(s,V)|0)|0)+((8191&(d=(d=d+Math.imul(s,Z)|0)+Math.imul(l,V)|0))<<13)|0;n=((b=b+Math.imul(l,Z)|0)+(d>>>13)|0)+(me>>>26)|0,me&=67108863,f=Math.imul(_,D),d=(d=Math.imul(_,z))+Math.imul(v,D)|0,b=Math.imul(v,z),f=f+Math.imul(g,G)|0,d=(d=d+Math.imul(g,K)|0)+Math.imul(m,G)|0,b=b+Math.imul(m,K)|0,f=f+Math.imul(u,V)|0,d=(d=d+Math.imul(u,Z)|0)+Math.imul(x,V)|0,b=b+Math.imul(x,Z)|0;var ye=(n+(f=f+Math.imul(s,Y)|0)|0)+((8191&(d=(d=d+Math.imul(s,J)|0)+Math.imul(l,Y)|0))<<13)|0;n=((b=b+Math.imul(l,J)|0)+(d>>>13)|0)+(ye>>>26)|0,ye&=67108863,f=Math.imul(M,D),d=(d=Math.imul(M,z))+Math.imul(A,D)|0,b=Math.imul(A,z),f=f+Math.imul(_,G)|0,d=(d=d+Math.imul(_,K)|0)+Math.imul(v,G)|0,b=b+Math.imul(v,K)|0,f=f+Math.imul(g,V)|0,d=(d=d+Math.imul(g,Z)|0)+Math.imul(m,V)|0,b=b+Math.imul(m,Z)|0,f=f+Math.imul(u,Y)|0,d=(d=d+Math.imul(u,J)|0)+Math.imul(x,Y)|0,b=b+Math.imul(x,J)|0;var _e=(n+(f=f+Math.imul(s,X)|0)|0)+((8191&(d=(d=d+Math.imul(s,ee)|0)+Math.imul(l,X)|0))<<13)|0;n=((b=b+Math.imul(l,ee)|0)+(d>>>13)|0)+(_e>>>26)|0,_e&=67108863,f=Math.imul(I,D),d=(d=Math.imul(I,z))+Math.imul(k,D)|0,b=Math.imul(k,z),f=f+Math.imul(M,G)|0,d=(d=d+Math.imul(M,K)|0)+Math.imul(A,G)|0,b=b+Math.imul(A,K)|0,f=f+Math.imul(_,V)|0,d=(d=d+Math.imul(_,Z)|0)+Math.imul(v,V)|0,b=b+Math.imul(v,Z)|0,f=f+Math.imul(g,Y)|0,d=(d=d+Math.imul(g,J)|0)+Math.imul(m,Y)|0,b=b+Math.imul(m,J)|0,f=f+Math.imul(u,X)|0,d=(d=d+Math.imul(u,ee)|0)+Math.imul(x,X)|0,b=b+Math.imul(x,ee)|0;var ve=(n+(f=f+Math.imul(s,ce)|0)|0)+((8191&(d=(d=d+Math.imul(s,fe)|0)+Math.imul(l,ce)|0))<<13)|0;n=((b=b+Math.imul(l,fe)|0)+(d>>>13)|0)+(ve>>>26)|0,ve&=67108863,f=Math.imul(S,D),d=(d=Math.imul(S,z))+Math.imul(C,D)|0,b=Math.imul(C,z),f=f+Math.imul(I,G)|0,d=(d=d+Math.imul(I,K)|0)+Math.imul(k,G)|0,b=b+Math.imul(k,K)|0,f=f+Math.imul(M,V)|0,d=(d=d+Math.imul(M,Z)|0)+Math.imul(A,V)|0,b=b+Math.imul(A,Z)|0,f=f+Math.imul(_,Y)|0,d=(d=d+Math.imul(_,J)|0)+Math.imul(v,Y)|0,b=b+Math.imul(v,J)|0,f=f+Math.imul(g,X)|0,d=(d=d+Math.imul(g,ee)|0)+Math.imul(m,X)|0,b=b+Math.imul(m,ee)|0,f=f+Math.imul(u,ce)|0,d=(d=d+Math.imul(u,fe)|0)+Math.imul(x,ce)|0,b=b+Math.imul(x,fe)|0;var we=(n+(f=f+Math.imul(s,be)|0)|0)+((8191&(d=(d=d+Math.imul(s,te)|0)+Math.imul(l,be)|0))<<13)|0;n=((b=b+Math.imul(l,te)|0)+(d>>>13)|0)+(we>>>26)|0,we&=67108863,f=Math.imul(F,D),d=(d=Math.imul(F,z))+Math.imul(O,D)|0,b=Math.imul(O,z),f=f+Math.imul(S,G)|0,d=(d=d+Math.imul(S,K)|0)+Math.imul(C,G)|0,b=b+Math.imul(C,K)|0,f=f+Math.imul(I,V)|0,d=(d=d+Math.imul(I,Z)|0)+Math.imul(k,V)|0,b=b+Math.imul(k,Z)|0,f=f+Math.imul(M,Y)|0,d=(d=d+Math.imul(M,J)|0)+Math.imul(A,Y)|0,b=b+Math.imul(A,J)|0,f=f+Math.imul(_,X)|0,d=(d=d+Math.imul(_,ee)|0)+Math.imul(v,X)|0,b=b+Math.imul(v,ee)|0,f=f+Math.imul(g,ce)|0,d=(d=d+Math.imul(g,fe)|0)+Math.imul(m,ce)|0,b=b+Math.imul(m,fe)|0,f=f+Math.imul(u,be)|0,d=(d=d+Math.imul(u,te)|0)+Math.imul(x,be)|0,b=b+Math.imul(x,te)|0;var Me=(n+(f=f+Math.imul(s,re)|0)|0)+((8191&(d=(d=d+Math.imul(s,ne)|0)+Math.imul(l,re)|0))<<13)|0;n=((b=b+Math.imul(l,ne)|0)+(d>>>13)|0)+(Me>>>26)|0,Me&=67108863,f=Math.imul(R,D),d=(d=Math.imul(R,z))+Math.imul(T,D)|0,b=Math.imul(T,z),f=f+Math.imul(F,G)|0,d=(d=d+Math.imul(F,K)|0)+Math.imul(O,G)|0,b=b+Math.imul(O,K)|0,f=f+Math.imul(S,V)|0,d=(d=d+Math.imul(S,Z)|0)+Math.imul(C,V)|0,b=b+Math.imul(C,Z)|0,f=f+Math.imul(I,Y)|0,d=(d=d+Math.imul(I,J)|0)+Math.imul(k,Y)|0,b=b+Math.imul(k,J)|0,f=f+Math.imul(M,X)|0,d=(d=d+Math.imul(M,ee)|0)+Math.imul(A,X)|0,b=b+Math.imul(A,ee)|0,f=f+Math.imul(_,ce)|0,d=(d=d+Math.imul(_,fe)|0)+Math.imul(v,ce)|0,b=b+Math.imul(v,fe)|0,f=f+Math.imul(g,be)|0,d=(d=d+Math.imul(g,te)|0)+Math.imul(m,be)|0,b=b+Math.imul(m,te)|0,f=f+Math.imul(u,re)|0,d=(d=d+Math.imul(u,ne)|0)+Math.imul(x,re)|0,b=b+Math.imul(x,ne)|0;var Ae=(n+(f=f+Math.imul(s,se)|0)|0)+((8191&(d=(d=d+Math.imul(s,le)|0)+Math.imul(l,se)|0))<<13)|0;n=((b=b+Math.imul(l,le)|0)+(d>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,f=Math.imul(j,D),d=(d=Math.imul(j,z))+Math.imul(N,D)|0,b=Math.imul(N,z),f=f+Math.imul(R,G)|0,d=(d=d+Math.imul(R,K)|0)+Math.imul(T,G)|0,b=b+Math.imul(T,K)|0,f=f+Math.imul(F,V)|0,d=(d=d+Math.imul(F,Z)|0)+Math.imul(O,V)|0,b=b+Math.imul(O,Z)|0,f=f+Math.imul(S,Y)|0,d=(d=d+Math.imul(S,J)|0)+Math.imul(C,Y)|0,b=b+Math.imul(C,J)|0,f=f+Math.imul(I,X)|0,d=(d=d+Math.imul(I,ee)|0)+Math.imul(k,X)|0,b=b+Math.imul(k,ee)|0,f=f+Math.imul(M,ce)|0,d=(d=d+Math.imul(M,fe)|0)+Math.imul(A,ce)|0,b=b+Math.imul(A,fe)|0,f=f+Math.imul(_,be)|0,d=(d=d+Math.imul(_,te)|0)+Math.imul(v,be)|0,b=b+Math.imul(v,te)|0,f=f+Math.imul(g,re)|0,d=(d=d+Math.imul(g,ne)|0)+Math.imul(m,re)|0,b=b+Math.imul(m,ne)|0,f=f+Math.imul(u,se)|0,d=(d=d+Math.imul(u,le)|0)+Math.imul(x,se)|0,b=b+Math.imul(x,le)|0;var Le=(n+(f=f+Math.imul(s,ue)|0)|0)+((8191&(d=(d=d+Math.imul(s,xe)|0)+Math.imul(l,ue)|0))<<13)|0;n=((b=b+Math.imul(l,xe)|0)+(d>>>13)|0)+(Le>>>26)|0,Le&=67108863,f=Math.imul(j,G),d=(d=Math.imul(j,K))+Math.imul(N,G)|0,b=Math.imul(N,K),f=f+Math.imul(R,V)|0,d=(d=d+Math.imul(R,Z)|0)+Math.imul(T,V)|0,b=b+Math.imul(T,Z)|0,f=f+Math.imul(F,Y)|0,d=(d=d+Math.imul(F,J)|0)+Math.imul(O,Y)|0,b=b+Math.imul(O,J)|0,f=f+Math.imul(S,X)|0,d=(d=d+Math.imul(S,ee)|0)+Math.imul(C,X)|0,b=b+Math.imul(C,ee)|0,f=f+Math.imul(I,ce)|0,d=(d=d+Math.imul(I,fe)|0)+Math.imul(k,ce)|0,b=b+Math.imul(k,fe)|0,f=f+Math.imul(M,be)|0,d=(d=d+Math.imul(M,te)|0)+Math.imul(A,be)|0,b=b+Math.imul(A,te)|0,f=f+Math.imul(_,re)|0,d=(d=d+Math.imul(_,ne)|0)+Math.imul(v,re)|0,b=b+Math.imul(v,ne)|0,f=f+Math.imul(g,se)|0,d=(d=d+Math.imul(g,le)|0)+Math.imul(m,se)|0,b=b+Math.imul(m,le)|0;var Ie=(n+(f=f+Math.imul(u,ue)|0)|0)+((8191&(d=(d=d+Math.imul(u,xe)|0)+Math.imul(x,ue)|0))<<13)|0;n=((b=b+Math.imul(x,xe)|0)+(d>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,f=Math.imul(j,V),d=(d=Math.imul(j,Z))+Math.imul(N,V)|0,b=Math.imul(N,Z),f=f+Math.imul(R,Y)|0,d=(d=d+Math.imul(R,J)|0)+Math.imul(T,Y)|0,b=b+Math.imul(T,J)|0,f=f+Math.imul(F,X)|0,d=(d=d+Math.imul(F,ee)|0)+Math.imul(O,X)|0,b=b+Math.imul(O,ee)|0,f=f+Math.imul(S,ce)|0,d=(d=d+Math.imul(S,fe)|0)+Math.imul(C,ce)|0,b=b+Math.imul(C,fe)|0,f=f+Math.imul(I,be)|0,d=(d=d+Math.imul(I,te)|0)+Math.imul(k,be)|0,b=b+Math.imul(k,te)|0,f=f+Math.imul(M,re)|0,d=(d=d+Math.imul(M,ne)|0)+Math.imul(A,re)|0,b=b+Math.imul(A,ne)|0,f=f+Math.imul(_,se)|0,d=(d=d+Math.imul(_,le)|0)+Math.imul(v,se)|0,b=b+Math.imul(v,le)|0;var ke=(n+(f=f+Math.imul(g,ue)|0)|0)+((8191&(d=(d=d+Math.imul(g,xe)|0)+Math.imul(m,ue)|0))<<13)|0;n=((b=b+Math.imul(m,xe)|0)+(d>>>13)|0)+(ke>>>26)|0,ke&=67108863,f=Math.imul(j,Y),d=(d=Math.imul(j,J))+Math.imul(N,Y)|0,b=Math.imul(N,J),f=f+Math.imul(R,X)|0,d=(d=d+Math.imul(R,ee)|0)+Math.imul(T,X)|0,b=b+Math.imul(T,ee)|0,f=f+Math.imul(F,ce)|0,d=(d=d+Math.imul(F,fe)|0)+Math.imul(O,ce)|0,b=b+Math.imul(O,fe)|0,f=f+Math.imul(S,be)|0,d=(d=d+Math.imul(S,te)|0)+Math.imul(C,be)|0,b=b+Math.imul(C,te)|0,f=f+Math.imul(I,re)|0,d=(d=d+Math.imul(I,ne)|0)+Math.imul(k,re)|0,b=b+Math.imul(k,ne)|0,f=f+Math.imul(M,se)|0,d=(d=d+Math.imul(M,le)|0)+Math.imul(A,se)|0,b=b+Math.imul(A,le)|0;var Ee=(n+(f=f+Math.imul(_,ue)|0)|0)+((8191&(d=(d=d+Math.imul(_,xe)|0)+Math.imul(v,ue)|0))<<13)|0;n=((b=b+Math.imul(v,xe)|0)+(d>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,f=Math.imul(j,X),d=(d=Math.imul(j,ee))+Math.imul(N,X)|0,b=Math.imul(N,ee),f=f+Math.imul(R,ce)|0,d=(d=d+Math.imul(R,fe)|0)+Math.imul(T,ce)|0,b=b+Math.imul(T,fe)|0,f=f+Math.imul(F,be)|0,d=(d=d+Math.imul(F,te)|0)+Math.imul(O,be)|0,b=b+Math.imul(O,te)|0,f=f+Math.imul(S,re)|0,d=(d=d+Math.imul(S,ne)|0)+Math.imul(C,re)|0,b=b+Math.imul(C,ne)|0,f=f+Math.imul(I,se)|0,d=(d=d+Math.imul(I,le)|0)+Math.imul(k,se)|0,b=b+Math.imul(k,le)|0;var Se=(n+(f=f+Math.imul(M,ue)|0)|0)+((8191&(d=(d=d+Math.imul(M,xe)|0)+Math.imul(A,ue)|0))<<13)|0;n=((b=b+Math.imul(A,xe)|0)+(d>>>13)|0)+(Se>>>26)|0,Se&=67108863,f=Math.imul(j,ce),d=(d=Math.imul(j,fe))+Math.imul(N,ce)|0,b=Math.imul(N,fe),f=f+Math.imul(R,be)|0,d=(d=d+Math.imul(R,te)|0)+Math.imul(T,be)|0,b=b+Math.imul(T,te)|0,f=f+Math.imul(F,re)|0,d=(d=d+Math.imul(F,ne)|0)+Math.imul(O,re)|0,b=b+Math.imul(O,ne)|0,f=f+Math.imul(S,se)|0,d=(d=d+Math.imul(S,le)|0)+Math.imul(C,se)|0,b=b+Math.imul(C,le)|0;var Ce=(n+(f=f+Math.imul(I,ue)|0)|0)+((8191&(d=(d=d+Math.imul(I,xe)|0)+Math.imul(k,ue)|0))<<13)|0;n=((b=b+Math.imul(k,xe)|0)+(d>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,f=Math.imul(j,be),d=(d=Math.imul(j,te))+Math.imul(N,be)|0,b=Math.imul(N,te),f=f+Math.imul(R,re)|0,d=(d=d+Math.imul(R,ne)|0)+Math.imul(T,re)|0,b=b+Math.imul(T,ne)|0,f=f+Math.imul(F,se)|0,d=(d=d+Math.imul(F,le)|0)+Math.imul(O,se)|0,b=b+Math.imul(O,le)|0;var Be=(n+(f=f+Math.imul(S,ue)|0)|0)+((8191&(d=(d=d+Math.imul(S,xe)|0)+Math.imul(C,ue)|0))<<13)|0;n=((b=b+Math.imul(C,xe)|0)+(d>>>13)|0)+(Be>>>26)|0,Be&=67108863,f=Math.imul(j,re),d=(d=Math.imul(j,ne))+Math.imul(N,re)|0,b=Math.imul(N,ne),f=f+Math.imul(R,se)|0,d=(d=d+Math.imul(R,le)|0)+Math.imul(T,se)|0,b=b+Math.imul(T,le)|0;var Fe=(n+(f=f+Math.imul(F,ue)|0)|0)+((8191&(d=(d=d+Math.imul(F,xe)|0)+Math.imul(O,ue)|0))<<13)|0;n=((b=b+Math.imul(O,xe)|0)+(d>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,f=Math.imul(j,se),d=(d=Math.imul(j,le))+Math.imul(N,se)|0,b=Math.imul(N,le);var Oe=(n+(f=f+Math.imul(R,ue)|0)|0)+((8191&(d=(d=d+Math.imul(R,xe)|0)+Math.imul(T,ue)|0))<<13)|0;n=((b=b+Math.imul(T,xe)|0)+(d>>>13)|0)+(Oe>>>26)|0,Oe&=67108863;var Pe=(n+(f=Math.imul(j,ue))|0)+((8191&(d=(d=Math.imul(j,xe))+Math.imul(N,ue)|0))<<13)|0;return n=((b=Math.imul(N,xe))+(d>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r[0]=pe,r[1]=ge,r[2]=me,r[3]=ye,r[4]=_e,r[5]=ve,r[6]=we,r[7]=Me,r[8]=Ae,r[9]=Le,r[10]=Ie,r[11]=ke,r[12]=Ee,r[13]=Se,r[14]=Ce,r[15]=Be,r[16]=Fe,r[17]=Oe,r[18]=Pe,0!==n&&(r[19]=n,c.length++),c};function x(e,a,c){return(new p).mulp(e,a,c)}function p(e,a){this.x=e,this.y=a}Math.imul||(u=h),b.prototype.mulTo=function(e,a){var c,f=this.length+e.length;return c=10===this.length&&10===e.length?u(this,e,a):f<63?h(this,e,a):f<1024?function(e,a,c){c.negative=a.negative^e.negative,c.length=e.length+a.length;for(var f=0,d=0,b=0;b>>26)|0)>>>26,t&=67108863}c.words[b]=i,f=t,t=d}return 0!==f?c.words[b]=f:c.length--,c.strip()}(this,e,a):x(this,e,a),c},p.prototype.makeRBT=function(e){for(var a=new Array(e),c=b.prototype._countBits(e)-1,f=0;f>=1;return f},p.prototype.permute=function(e,a,c,f,d,b){for(var t=0;t>>=1)d++;return 1<>>=13,c[2*t+1]=8191&b,b>>>=13;for(t=2*a;t>=26,a+=d/67108864|0,a+=b>>>26,this.words[c]=67108863&b}return 0!==a&&(this.words[c]=a,this.length++),this},b.prototype.muln=function(e){return this.clone().imuln(e)},b.prototype.sqr=function(){return this.mul(this)},b.prototype.isqr=function(){return this.imul(this.clone())},b.prototype.pow=function(e){var a=function(e){for(var a=new Array(e.bitLength()),c=0;c>>d}return a}(e);if(0===a.length)return new b(1);for(var c=this,f=0;f=0);var a,c=e%26,d=(e-c)/26,b=67108863>>>26-c<<26-c;if(0!==c){var t=0;for(a=0;a>>26-c}t&&(this.words[a]=t,this.length++)}if(0!==d){for(a=this.length-1;a>=0;a--)this.words[a+d]=this.words[a];for(a=0;a=0),d=a?(a-a%26)/26:0;var b=e%26,t=Math.min((e-b)/26,this.length),i=67108863^67108863>>>b<t)for(this.length-=t,n=0;n=0&&(0!==o||n>=d);n--){var s=0|this.words[n];this.words[n]=o<<26-b|s>>>b,o=s&i}return r&&0!==o&&(r.words[r.length++]=o),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},b.prototype.ishrn=function(e,a,c){return f(0===this.negative),this.iushrn(e,a,c)},b.prototype.shln=function(e){return this.clone().ishln(e)},b.prototype.ushln=function(e){return this.clone().iushln(e)},b.prototype.shrn=function(e){return this.clone().ishrn(e)},b.prototype.ushrn=function(e){return this.clone().iushrn(e)},b.prototype.testn=function(e){f("number"==typeof e&&e>=0);var a=e%26,c=(e-a)/26,d=1<=0);var a=e%26,c=(e-a)/26;if(f(0===this.negative,"imaskn works only with positive numbers"),this.length<=c)return this;if(0!==a&&c++,this.length=Math.min(c,this.length),0!==a){var d=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},b.prototype.isubn=function(e){if(f("number"==typeof e),f(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(r/67108864|0),this.words[d+c]=67108863&b}for(;d>26,this.words[d+c]=67108863&b;if(0===i)return this.strip();for(f(-1===i),i=0,d=0;d>26,this.words[d]=67108863&b;return this.negative=1,this.strip()},b.prototype._wordDiv=function(e,a){var c=(this.length,e.length),f=this.clone(),d=e,t=0|d.words[d.length-1];0!=(c=26-this._countBits(t))&&(d=d.ushln(c),f.iushln(c),t=0|d.words[d.length-1]);var i,r=f.length-d.length;if("mod"!==a){(i=new b(null)).length=r+1,i.words=new Array(i.length);for(var n=0;n=0;s--){var l=67108864*(0|f.words[d.length+s])+(0|f.words[d.length+s-1]);for(l=Math.min(l/t|0,67108863),f._ishlnsubmul(d,l,s);0!==f.negative;)l--,f.negative=0,f._ishlnsubmul(d,1,s),f.isZero()||(f.negative^=1);i&&(i.words[s]=l)}return i&&i.strip(),f.strip(),"div"!==a&&0!==c&&f.iushrn(c),{div:i||null,mod:f}},b.prototype.divmod=function(e,a,c){return f(!e.isZero()),this.isZero()?{div:new b(0),mod:new b(0)}:0!==this.negative&&0===e.negative?(i=this.neg().divmod(e,a),"mod"!==a&&(d=i.div.neg()),"div"!==a&&(t=i.mod.neg(),c&&0!==t.negative&&t.iadd(e)),{div:d,mod:t}):0===this.negative&&0!==e.negative?(i=this.divmod(e.neg(),a),"mod"!==a&&(d=i.div.neg()),{div:d,mod:i.mod}):this.negative&e.negative?(i=this.neg().divmod(e.neg(),a),"div"!==a&&(t=i.mod.neg(),c&&0!==t.negative&&t.isub(e)),{div:i.div,mod:t}):e.length>this.length||this.cmp(e)<0?{div:new b(0),mod:this}:1===e.length?"div"===a?{div:this.divn(e.words[0]),mod:null}:"mod"===a?{div:null,mod:new b(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new b(this.modn(e.words[0]))}:this._wordDiv(e,a);var d,t,i},b.prototype.div=function(e){return this.divmod(e,"div",!1).div},b.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},b.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},b.prototype.divRound=function(e){var a=this.divmod(e);if(a.mod.isZero())return a.div;var c=0!==a.div.negative?a.mod.isub(e):a.mod,f=e.ushrn(1),d=e.andln(1),b=c.cmp(f);return b<0||1===d&&0===b?a.div:0!==a.div.negative?a.div.isubn(1):a.div.iaddn(1)},b.prototype.modn=function(e){f(e<=67108863);for(var a=(1<<26)%e,c=0,d=this.length-1;d>=0;d--)c=(a*c+(0|this.words[d]))%e;return c},b.prototype.idivn=function(e){f(e<=67108863);for(var a=0,c=this.length-1;c>=0;c--){var d=(0|this.words[c])+67108864*a;this.words[c]=d/e|0,a=d%e}return this.strip()},b.prototype.divn=function(e){return this.clone().idivn(e)},b.prototype.egcd=function(e){f(0===e.negative),f(!e.isZero());var a=this,c=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var d=new b(1),t=new b(0),i=new b(0),r=new b(1),n=0;a.isEven()&&c.isEven();)a.iushrn(1),c.iushrn(1),++n;for(var o=c.clone(),s=a.clone();!a.isZero();){for(var l=0,h=1;!(a.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(a.iushrn(l);l-- >0;)(d.isOdd()||t.isOdd())&&(d.iadd(o),t.isub(s)),d.iushrn(1),t.iushrn(1);for(var u=0,x=1;!(c.words[0]&x)&&u<26;++u,x<<=1);if(u>0)for(c.iushrn(u);u-- >0;)(i.isOdd()||r.isOdd())&&(i.iadd(o),r.isub(s)),i.iushrn(1),r.iushrn(1);a.cmp(c)>=0?(a.isub(c),d.isub(i),t.isub(r)):(c.isub(a),i.isub(d),r.isub(t))}return{a:i,b:r,gcd:c.iushln(n)}},b.prototype._invmp=function(e){f(0===e.negative),f(!e.isZero());var a=this,c=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var d,t=new b(1),i=new b(0),r=c.clone();a.cmpn(1)>0&&c.cmpn(1)>0;){for(var n=0,o=1;!(a.words[0]&o)&&n<26;++n,o<<=1);if(n>0)for(a.iushrn(n);n-- >0;)t.isOdd()&&t.iadd(r),t.iushrn(1);for(var s=0,l=1;!(c.words[0]&l)&&s<26;++s,l<<=1);if(s>0)for(c.iushrn(s);s-- >0;)i.isOdd()&&i.iadd(r),i.iushrn(1);a.cmp(c)>=0?(a.isub(c),t.isub(i)):(c.isub(a),i.isub(t))}return(d=0===a.cmpn(1)?t:i).cmpn(0)<0&&d.iadd(e),d},b.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var a=this.clone(),c=e.clone();a.negative=0,c.negative=0;for(var f=0;a.isEven()&&c.isEven();f++)a.iushrn(1),c.iushrn(1);for(;;){for(;a.isEven();)a.iushrn(1);for(;c.isEven();)c.iushrn(1);var d=a.cmp(c);if(d<0){var b=a;a=c,c=b}else if(0===d||0===c.cmpn(1))break;a.isub(c)}return c.iushln(f)},b.prototype.invm=function(e){return this.egcd(e).a.umod(e)},b.prototype.isEven=function(){return!(1&this.words[0])},b.prototype.isOdd=function(){return!(1&~this.words[0])},b.prototype.andln=function(e){return this.words[0]&e},b.prototype.bincn=function(e){f("number"==typeof e);var a=e%26,c=(e-a)/26,d=1<>>26,i&=67108863,this.words[t]=i}return 0!==b&&(this.words[t]=b,this.length++),this},b.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},b.prototype.cmpn=function(e){var a,c=e<0;if(0!==this.negative&&!c)return-1;if(0===this.negative&&c)return 1;if(this.strip(),this.length>1)a=1;else{c&&(e=-e),f(e<=67108863,"Number is too big");var d=0|this.words[0];a=d===e?0:de.length)return 1;if(this.length=0;c--){var f=0|this.words[c],d=0|e.words[c];if(f!==d){fd&&(a=1);break}}return a},b.prototype.gtn=function(e){return 1===this.cmpn(e)},b.prototype.gt=function(e){return 1===this.cmp(e)},b.prototype.gten=function(e){return this.cmpn(e)>=0},b.prototype.gte=function(e){return this.cmp(e)>=0},b.prototype.ltn=function(e){return-1===this.cmpn(e)},b.prototype.lt=function(e){return-1===this.cmp(e)},b.prototype.lten=function(e){return this.cmpn(e)<=0},b.prototype.lte=function(e){return this.cmp(e)<=0},b.prototype.eqn=function(e){return 0===this.cmpn(e)},b.prototype.eq=function(e){return 0===this.cmp(e)},b.red=function(e){return new M(e)},b.prototype.toRed=function(e){return f(!this.red,"Already a number in reduction context"),f(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},b.prototype.fromRed=function(){return f(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},b.prototype._forceRed=function(e){return this.red=e,this},b.prototype.forceRed=function(e){return f(!this.red,"Already a number in reduction context"),this._forceRed(e)},b.prototype.redAdd=function(e){return f(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},b.prototype.redIAdd=function(e){return f(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},b.prototype.redSub=function(e){return f(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},b.prototype.redISub=function(e){return f(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},b.prototype.redShl=function(e){return f(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},b.prototype.redMul=function(e){return f(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},b.prototype.redIMul=function(e){return f(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},b.prototype.redSqr=function(){return f(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},b.prototype.redISqr=function(){return f(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},b.prototype.redSqrt=function(){return f(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},b.prototype.redInvm=function(){return f(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},b.prototype.redNeg=function(){return f(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},b.prototype.redPow=function(e){return f(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function m(e,a){this.name=e,this.p=new b(a,16),this.n=this.p.bitLength(),this.k=new b(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(e){if("string"==typeof e){var a=b._prime(e);this.m=a.p,this.prime=a}else f(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function A(e){M.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new b(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)}m.prototype._tmp=function(){var e=new b(null);return e.words=new Array(Math.ceil(this.n/13)),e},m.prototype.ireduce=function(e){var a,c=e;do{this.split(c,this.tmp),a=(c=(c=this.imulK(c)).iadd(this.tmp)).bitLength()}while(a>this.n);var f=a0?c.isub(this.p):void 0!==c.strip?c.strip():c._strip(),c},m.prototype.split=function(e,a){e.iushrn(this.n,0,a)},m.prototype.imulK=function(e){return e.imul(this.k)},d(y,m),y.prototype.split=function(e,a){for(var c=4194303,f=Math.min(e.length,9),d=0;d>>22,b=t}b>>>=22,e.words[d-10]=b,0===b&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var a=0,c=0;c>>=26,e.words[c]=d,a=f}return 0!==a&&(e.words[e.length++]=a),e},b._prime=function(e){if(g[e])return g[e];var a;if("k256"===e)a=new y;else if("p224"===e)a=new _;else if("p192"===e)a=new v;else{if("p25519"!==e)throw new Error("Unknown prime "+e);a=new w}return g[e]=a,a},M.prototype._verify1=function(e){f(0===e.negative,"red works only with positives"),f(e.red,"red works only with red numbers")},M.prototype._verify2=function(e,a){f(!(e.negative|a.negative),"red works only with positives"),f(e.red&&e.red===a.red,"red works only with red numbers")},M.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},M.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},M.prototype.add=function(e,a){this._verify2(e,a);var c=e.add(a);return c.cmp(this.m)>=0&&c.isub(this.m),c._forceRed(this)},M.prototype.iadd=function(e,a){this._verify2(e,a);var c=e.iadd(a);return c.cmp(this.m)>=0&&c.isub(this.m),c},M.prototype.sub=function(e,a){this._verify2(e,a);var c=e.sub(a);return c.cmpn(0)<0&&c.iadd(this.m),c._forceRed(this)},M.prototype.isub=function(e,a){this._verify2(e,a);var c=e.isub(a);return c.cmpn(0)<0&&c.iadd(this.m),c},M.prototype.shl=function(e,a){return this._verify1(e),this.imod(e.ushln(a))},M.prototype.imul=function(e,a){return this._verify2(e,a),this.imod(e.imul(a))},M.prototype.mul=function(e,a){return this._verify2(e,a),this.imod(e.mul(a))},M.prototype.isqr=function(e){return this.imul(e,e.clone())},M.prototype.sqr=function(e){return this.mul(e,e)},M.prototype.sqrt=function(e){if(e.isZero())return e.clone();var a=this.m.andln(3);if(f(a%2==1),3===a){var c=this.m.add(new b(1)).iushrn(2);return this.pow(e,c)}for(var d=this.m.subn(1),t=0;!d.isZero()&&0===d.andln(1);)t++,d.iushrn(1);f(!d.isZero());var i=new b(1).toRed(this),r=i.redNeg(),n=this.m.subn(1).iushrn(1),o=this.m.bitLength();for(o=new b(2*o*o).toRed(this);0!==this.pow(o,n).cmp(r);)o.redIAdd(r);for(var s=this.pow(o,d),l=this.pow(e,d.addn(1).iushrn(1)),h=this.pow(e,d),u=t;0!==h.cmp(i);){for(var x=h,p=0;0!==x.cmp(i);p++)x=x.redSqr();f(p=0;f--){for(var n=a.words[f],o=r-1;o>=0;o--){var s=n>>o&1;d!==c[0]&&(d=this.sqr(d)),0!==s||0!==t?(t<<=1,t|=s,(4==++i||0===f&&0===o)&&(d=this.mul(d,c[t]),i=0,t=0)):i=0}r=26}return d},M.prototype.convertTo=function(e){var a=e.umod(this.m);return a===e?a.clone():a},M.prototype.convertFrom=function(e){var a=e.clone();return a.red=null,a},b.mont=function(e){return new A(e)},d(A,M),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var a=this.imod(e.mul(this.rinv));return a.red=null,a},A.prototype.imul=function(e,a){if(e.isZero()||a.isZero())return e.words[0]=0,e.length=1,e;var c=e.imul(a),f=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),d=c.isub(f).iushrn(this.shift),b=d;return d.cmp(this.m)>=0?b=d.isub(this.m):d.cmpn(0)<0&&(b=d.iadd(this.m)),b._forceRed(this)},A.prototype.mul=function(e,a){if(e.isZero()||a.isZero())return new b(0)._forceRed(this);var c=e.mul(a),f=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),d=c.isub(f).iushrn(this.shift),t=d;return d.cmp(this.m)>=0?t=d.isub(this.m):d.cmpn(0)<0&&(t=d.iadd(this.m)),t._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=c.nmd(e),this)},6729:(e,a,c)=>{"use strict";var f=a;f.version=c(1636).rE,f.utils=c(7011),f.rand=c(5037),f.curve=c(894),f.curves=c(480),f.ec=c(7447),f.eddsa=c(8650)},6677:(e,a,c)=>{"use strict";var f=c(8490),d=c(7011),b=d.getNAF,t=d.getJSF,i=d.assert;function r(e,a){this.type=e,this.p=new f(a.p,16),this.red=a.prime?f.red(a.prime):f.mont(this.p),this.zero=new f(0).toRed(this.red),this.one=new f(1).toRed(this.red),this.two=new f(2).toRed(this.red),this.n=a.n&&new f(a.n,16),this.g=a.g&&this.pointFromJSON(a.g,a.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var c=this.n&&this.p.div(this.n);!c||c.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function n(e,a){this.curve=e,this.type=a,this.precomputed=null}e.exports=r,r.prototype.point=function(){throw new Error("Not implemented")},r.prototype.validate=function(){throw new Error("Not implemented")},r.prototype._fixedNafMul=function(e,a){i(e.precomputed);var c=e._getDoubles(),f=b(a,1,this._bitLength),d=(1<=t;o--)r=(r<<1)+f[o];n.push(r)}for(var s=this.jpoint(null,null,null),l=this.jpoint(null,null,null),h=d;h>0;h--){for(t=0;t=0;n--){for(var o=0;n>=0&&0===t[n];n--)o++;if(n>=0&&o++,r=r.dblp(o),n<0)break;var s=t[n];i(0!==s),r="affine"===e.type?s>0?r.mixedAdd(d[s-1>>1]):r.mixedAdd(d[-s-1>>1].neg()):s>0?r.add(d[s-1>>1]):r.add(d[-s-1>>1].neg())}return"affine"===e.type?r.toP():r},r.prototype._wnafMulAdd=function(e,a,c,f,d){var i,r,n,o=this._wnafT1,s=this._wnafT2,l=this._wnafT3,h=0;for(i=0;i=1;i-=2){var x=i-1,p=i;if(1===o[x]&&1===o[p]){var g=[a[x],null,null,a[p]];0===a[x].y.cmp(a[p].y)?(g[1]=a[x].add(a[p]),g[2]=a[x].toJ().mixedAdd(a[p].neg())):0===a[x].y.cmp(a[p].y.redNeg())?(g[1]=a[x].toJ().mixedAdd(a[p]),g[2]=a[x].add(a[p].neg())):(g[1]=a[x].toJ().mixedAdd(a[p]),g[2]=a[x].toJ().mixedAdd(a[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],y=t(c[x],c[p]);for(h=Math.max(y[0].length,h),l[x]=new Array(h),l[p]=new Array(h),r=0;r=0;i--){for(var A=0;i>=0;){var L=!0;for(r=0;r=0&&A++,w=w.dblp(A),i<0)break;for(r=0;r0?n=s[r][I-1>>1]:I<0&&(n=s[r][-I-1>>1].neg()),w="affine"===n.type?w.mixedAdd(n):w.add(n))}}for(i=0;i=Math.ceil((e.bitLength()+1)/a.step)},n.prototype._getDoubles=function(e,a){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var c=[this],f=this,d=0;d{"use strict";var f=c(7011),d=c(8490),b=c(6698),t=c(6677),i=f.assert;function r(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,t.call(this,"edwards",e),this.a=new d(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new d(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new d(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),i(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function n(e,a,c,f,b){t.BasePoint.call(this,e,"projective"),null===a&&null===c&&null===f?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new d(a,16),this.y=new d(c,16),this.z=f?new d(f,16):this.curve.one,this.t=b&&new d(b,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}b(r,t),e.exports=r,r.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},r.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},r.prototype.jpoint=function(e,a,c,f){return this.point(e,a,c,f)},r.prototype.pointFromX=function(e,a){(e=new d(e,16)).red||(e=e.toRed(this.red));var c=e.redSqr(),f=this.c2.redSub(this.a.redMul(c)),b=this.one.redSub(this.c2.redMul(this.d).redMul(c)),t=f.redMul(b.redInvm()),i=t.redSqrt();if(0!==i.redSqr().redSub(t).cmp(this.zero))throw new Error("invalid point");var r=i.fromRed().isOdd();return(a&&!r||!a&&r)&&(i=i.redNeg()),this.point(e,i)},r.prototype.pointFromY=function(e,a){(e=new d(e,16)).red||(e=e.toRed(this.red));var c=e.redSqr(),f=c.redSub(this.c2),b=c.redMul(this.d).redMul(this.c2).redSub(this.a),t=f.redMul(b.redInvm());if(0===t.cmp(this.zero)){if(a)throw new Error("invalid point");return this.point(this.zero,e)}var i=t.redSqrt();if(0!==i.redSqr().redSub(t).cmp(this.zero))throw new Error("invalid point");return i.fromRed().isOdd()!==a&&(i=i.redNeg()),this.point(i,e)},r.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var a=e.x.redSqr(),c=e.y.redSqr(),f=a.redMul(this.a).redAdd(c),d=this.c2.redMul(this.one.redAdd(this.d.redMul(a).redMul(c)));return 0===f.cmp(d)},b(n,t.BasePoint),r.prototype.pointFromJSON=function(e){return n.fromJSON(this,e)},r.prototype.point=function(e,a,c,f){return new n(this,e,a,c,f)},n.fromJSON=function(e,a){return new n(e,a[0],a[1],a[2])},n.prototype.inspect=function(){return this.isInfinity()?"":""},n.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},n.prototype._extDbl=function(){var e=this.x.redSqr(),a=this.y.redSqr(),c=this.z.redSqr();c=c.redIAdd(c);var f=this.curve._mulA(e),d=this.x.redAdd(this.y).redSqr().redISub(e).redISub(a),b=f.redAdd(a),t=b.redSub(c),i=f.redSub(a),r=d.redMul(t),n=b.redMul(i),o=d.redMul(i),s=t.redMul(b);return this.curve.point(r,n,s,o)},n.prototype._projDbl=function(){var e,a,c,f,d,b,t=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),r=this.y.redSqr();if(this.curve.twisted){var n=(f=this.curve._mulA(i)).redAdd(r);this.zOne?(e=t.redSub(i).redSub(r).redMul(n.redSub(this.curve.two)),a=n.redMul(f.redSub(r)),c=n.redSqr().redSub(n).redSub(n)):(d=this.z.redSqr(),b=n.redSub(d).redISub(d),e=t.redSub(i).redISub(r).redMul(b),a=n.redMul(f.redSub(r)),c=n.redMul(b))}else f=i.redAdd(r),d=this.curve._mulC(this.z).redSqr(),b=f.redSub(d).redSub(d),e=this.curve._mulC(t.redISub(f)).redMul(b),a=this.curve._mulC(f).redMul(i.redISub(r)),c=f.redMul(b);return this.curve.point(e,a,c)},n.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},n.prototype._extAdd=function(e){var a=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),c=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),f=this.t.redMul(this.curve.dd).redMul(e.t),d=this.z.redMul(e.z.redAdd(e.z)),b=c.redSub(a),t=d.redSub(f),i=d.redAdd(f),r=c.redAdd(a),n=b.redMul(t),o=i.redMul(r),s=b.redMul(r),l=t.redMul(i);return this.curve.point(n,o,l,s)},n.prototype._projAdd=function(e){var a,c,f=this.z.redMul(e.z),d=f.redSqr(),b=this.x.redMul(e.x),t=this.y.redMul(e.y),i=this.curve.d.redMul(b).redMul(t),r=d.redSub(i),n=d.redAdd(i),o=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(b).redISub(t),s=f.redMul(r).redMul(o);return this.curve.twisted?(a=f.redMul(n).redMul(t.redSub(this.curve._mulA(b))),c=r.redMul(n)):(a=f.redMul(n).redMul(t.redSub(b)),c=this.curve._mulC(r).redMul(n)),this.curve.point(s,a,c)},n.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},n.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},n.prototype.mulAdd=function(e,a,c){return this.curve._wnafMulAdd(1,[this,a],[e,c],2,!1)},n.prototype.jmulAdd=function(e,a,c){return this.curve._wnafMulAdd(1,[this,a],[e,c],2,!0)},n.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},n.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},n.prototype.getX=function(){return this.normalize(),this.x.fromRed()},n.prototype.getY=function(){return this.normalize(),this.y.fromRed()},n.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},n.prototype.eqXToP=function(e){var a=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(a))return!0;for(var c=e.clone(),f=this.curve.redN.redMul(this.z);;){if(c.iadd(this.curve.n),c.cmp(this.curve.p)>=0)return!1;if(a.redIAdd(f),0===this.x.cmp(a))return!0}},n.prototype.toP=n.prototype.normalize,n.prototype.mixedAdd=n.prototype.add},894:(e,a,c)=>{"use strict";var f=a;f.base=c(6677),f.short=c(9188),f.mont=c(370),f.edwards=c(1298)},370:(e,a,c)=>{"use strict";var f=c(8490),d=c(6698),b=c(6677),t=c(7011);function i(e){b.call(this,"mont",e),this.a=new f(e.a,16).toRed(this.red),this.b=new f(e.b,16).toRed(this.red),this.i4=new f(4).toRed(this.red).redInvm(),this.two=new f(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function r(e,a,c){b.BasePoint.call(this,e,"projective"),null===a&&null===c?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new f(a,16),this.z=new f(c,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}d(i,b),e.exports=i,i.prototype.validate=function(e){var a=e.normalize().x,c=a.redSqr(),f=c.redMul(a).redAdd(c.redMul(this.a)).redAdd(a);return 0===f.redSqrt().redSqr().cmp(f)},d(r,b.BasePoint),i.prototype.decodePoint=function(e,a){return this.point(t.toArray(e,a),1)},i.prototype.point=function(e,a){return new r(this,e,a)},i.prototype.pointFromJSON=function(e){return r.fromJSON(this,e)},r.prototype.precompute=function(){},r.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},r.fromJSON=function(e,a){return new r(e,a[0],a[1]||e.one)},r.prototype.inspect=function(){return this.isInfinity()?"":""},r.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},r.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),a=this.x.redSub(this.z).redSqr(),c=e.redSub(a),f=e.redMul(a),d=c.redMul(a.redAdd(this.curve.a24.redMul(c)));return this.curve.point(f,d)},r.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},r.prototype.diffAdd=function(e,a){var c=this.x.redAdd(this.z),f=this.x.redSub(this.z),d=e.x.redAdd(e.z),b=e.x.redSub(e.z).redMul(c),t=d.redMul(f),i=a.z.redMul(b.redAdd(t).redSqr()),r=a.x.redMul(b.redISub(t).redSqr());return this.curve.point(i,r)},r.prototype.mul=function(e){for(var a=e.clone(),c=this,f=this.curve.point(null,null),d=[];0!==a.cmpn(0);a.iushrn(1))d.push(a.andln(1));for(var b=d.length-1;b>=0;b--)0===d[b]?(c=c.diffAdd(f,this),f=f.dbl()):(f=c.diffAdd(f,this),c=c.dbl());return f},r.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},r.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},r.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},r.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},r.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},9188:(e,a,c)=>{"use strict";var f=c(7011),d=c(8490),b=c(6698),t=c(6677),i=f.assert;function r(e){t.call(this,"short",e),this.a=new d(e.a,16).toRed(this.red),this.b=new d(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function n(e,a,c,f){t.BasePoint.call(this,e,"affine"),null===a&&null===c?(this.x=null,this.y=null,this.inf=!0):(this.x=new d(a,16),this.y=new d(c,16),f&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function o(e,a,c,f){t.BasePoint.call(this,e,"jacobian"),null===a&&null===c&&null===f?(this.x=this.curve.one,this.y=this.curve.one,this.z=new d(0)):(this.x=new d(a,16),this.y=new d(c,16),this.z=new d(f,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}b(r,t),e.exports=r,r.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var a,c;if(e.beta)a=new d(e.beta,16).toRed(this.red);else{var f=this._getEndoRoots(this.p);a=(a=f[0].cmp(f[1])<0?f[0]:f[1]).toRed(this.red)}if(e.lambda)c=new d(e.lambda,16);else{var b=this._getEndoRoots(this.n);0===this.g.mul(b[0]).x.cmp(this.g.x.redMul(a))?c=b[0]:(c=b[1],i(0===this.g.mul(c).x.cmp(this.g.x.redMul(a))))}return{beta:a,lambda:c,basis:e.basis?e.basis.map((function(e){return{a:new d(e.a,16),b:new d(e.b,16)}})):this._getEndoBasis(c)}}},r.prototype._getEndoRoots=function(e){var a=e===this.p?this.red:d.mont(e),c=new d(2).toRed(a).redInvm(),f=c.redNeg(),b=new d(3).toRed(a).redNeg().redSqrt().redMul(c);return[f.redAdd(b).fromRed(),f.redSub(b).fromRed()]},r.prototype._getEndoBasis=function(e){for(var a,c,f,b,t,i,r,n,o,s=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=e,h=this.n.clone(),u=new d(1),x=new d(0),p=new d(0),g=new d(1),m=0;0!==l.cmpn(0);){var y=h.div(l);n=h.sub(y.mul(l)),o=p.sub(y.mul(u));var _=g.sub(y.mul(x));if(!f&&n.cmp(s)<0)a=r.neg(),c=u,f=n.neg(),b=o;else if(f&&2==++m)break;r=n,h=l,l=n,p=u,u=o,g=x,x=_}t=n.neg(),i=o;var v=f.sqr().add(b.sqr());return t.sqr().add(i.sqr()).cmp(v)>=0&&(t=a,i=c),f.negative&&(f=f.neg(),b=b.neg()),t.negative&&(t=t.neg(),i=i.neg()),[{a:f,b},{a:t,b:i}]},r.prototype._endoSplit=function(e){var a=this.endo.basis,c=a[0],f=a[1],d=f.b.mul(e).divRound(this.n),b=c.b.neg().mul(e).divRound(this.n),t=d.mul(c.a),i=b.mul(f.a),r=d.mul(c.b),n=b.mul(f.b);return{k1:e.sub(t).sub(i),k2:r.add(n).neg()}},r.prototype.pointFromX=function(e,a){(e=new d(e,16)).red||(e=e.toRed(this.red));var c=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),f=c.redSqrt();if(0!==f.redSqr().redSub(c).cmp(this.zero))throw new Error("invalid point");var b=f.fromRed().isOdd();return(a&&!b||!a&&b)&&(f=f.redNeg()),this.point(e,f)},r.prototype.validate=function(e){if(e.inf)return!0;var a=e.x,c=e.y,f=this.a.redMul(a),d=a.redSqr().redMul(a).redIAdd(f).redIAdd(this.b);return 0===c.redSqr().redISub(d).cmpn(0)},r.prototype._endoWnafMulAdd=function(e,a,c){for(var f=this._endoWnafT1,d=this._endoWnafT2,b=0;b":""},n.prototype.isInfinity=function(){return this.inf},n.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var a=this.y.redSub(e.y);0!==a.cmpn(0)&&(a=a.redMul(this.x.redSub(e.x).redInvm()));var c=a.redSqr().redISub(this.x).redISub(e.x),f=a.redMul(this.x.redSub(c)).redISub(this.y);return this.curve.point(c,f)},n.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var a=this.curve.a,c=this.x.redSqr(),f=e.redInvm(),d=c.redAdd(c).redIAdd(c).redIAdd(a).redMul(f),b=d.redSqr().redISub(this.x.redAdd(this.x)),t=d.redMul(this.x.redSub(b)).redISub(this.y);return this.curve.point(b,t)},n.prototype.getX=function(){return this.x.fromRed()},n.prototype.getY=function(){return this.y.fromRed()},n.prototype.mul=function(e){return e=new d(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},n.prototype.mulAdd=function(e,a,c){var f=[this,a],d=[e,c];return this.curve.endo?this.curve._endoWnafMulAdd(f,d):this.curve._wnafMulAdd(1,f,d,2)},n.prototype.jmulAdd=function(e,a,c){var f=[this,a],d=[e,c];return this.curve.endo?this.curve._endoWnafMulAdd(f,d,!0):this.curve._wnafMulAdd(1,f,d,2,!0)},n.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},n.prototype.neg=function(e){if(this.inf)return this;var a=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var c=this.precomputed,f=function(e){return e.neg()};a.precomputed={naf:c.naf&&{wnd:c.naf.wnd,points:c.naf.points.map(f)},doubles:c.doubles&&{step:c.doubles.step,points:c.doubles.points.map(f)}}}return a},n.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},b(o,t.BasePoint),r.prototype.jpoint=function(e,a,c){return new o(this,e,a,c)},o.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),a=e.redSqr(),c=this.x.redMul(a),f=this.y.redMul(a).redMul(e);return this.curve.point(c,f)},o.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},o.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var a=e.z.redSqr(),c=this.z.redSqr(),f=this.x.redMul(a),d=e.x.redMul(c),b=this.y.redMul(a.redMul(e.z)),t=e.y.redMul(c.redMul(this.z)),i=f.redSub(d),r=b.redSub(t);if(0===i.cmpn(0))return 0!==r.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var n=i.redSqr(),o=n.redMul(i),s=f.redMul(n),l=r.redSqr().redIAdd(o).redISub(s).redISub(s),h=r.redMul(s.redISub(l)).redISub(b.redMul(o)),u=this.z.redMul(e.z).redMul(i);return this.curve.jpoint(l,h,u)},o.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var a=this.z.redSqr(),c=this.x,f=e.x.redMul(a),d=this.y,b=e.y.redMul(a).redMul(this.z),t=c.redSub(f),i=d.redSub(b);if(0===t.cmpn(0))return 0!==i.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var r=t.redSqr(),n=r.redMul(t),o=c.redMul(r),s=i.redSqr().redIAdd(n).redISub(o).redISub(o),l=i.redMul(o.redISub(s)).redISub(d.redMul(n)),h=this.z.redMul(t);return this.curve.jpoint(s,l,h)},o.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var a;if(this.curve.zeroA||this.curve.threeA){var c=this;for(a=0;a=0)return!1;if(c.redIAdd(d),0===this.x.cmp(c))return!0}},o.prototype.inspect=function(){return this.isInfinity()?"":""},o.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},480:(e,a,c)=>{"use strict";var f,d=a,b=c(7952),t=c(894),i=c(7011).assert;function r(e){"short"===e.type?this.curve=new t.short(e):"edwards"===e.type?this.curve=new t.edwards(e):this.curve=new t.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function n(e,a){Object.defineProperty(d,e,{configurable:!0,enumerable:!0,get:function(){var c=new r(a);return Object.defineProperty(d,e,{configurable:!0,enumerable:!0,value:c}),c}})}d.PresetCurve=r,n("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:b.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),n("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:b.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),n("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:b.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),n("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:b.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),n("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:b.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),n("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:b.sha256,gRed:!1,g:["9"]}),n("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:b.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{f=c(4011)}catch(e){f=void 0}n("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:b.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",f]})},7447:(e,a,c)=>{"use strict";var f=c(8490),d=c(2723),b=c(7011),t=c(480),i=c(5037),r=b.assert,n=c(1200),o=c(8545);function s(e){if(!(this instanceof s))return new s(e);"string"==typeof e&&(r(Object.prototype.hasOwnProperty.call(t,e),"Unknown curve "+e),e=t[e]),e instanceof t.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=s,s.prototype.keyPair=function(e){return new n(this,e)},s.prototype.keyFromPrivate=function(e,a){return n.fromPrivate(this,e,a)},s.prototype.keyFromPublic=function(e,a){return n.fromPublic(this,e,a)},s.prototype.genKeyPair=function(e){e||(e={});for(var a=new d({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||i(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),c=this.n.byteLength(),b=this.n.sub(new f(2));;){var t=new f(a.generate(c));if(!(t.cmp(b)>0))return t.iaddn(1),this.keyFromPrivate(t)}},s.prototype._truncateToN=function(e,a){var c=8*e.byteLength()-this.n.bitLength();return c>0&&(e=e.ushrn(c)),!a&&e.cmp(this.n)>=0?e.sub(this.n):e},s.prototype.sign=function(e,a,c,b){"object"==typeof c&&(b=c,c=null),b||(b={}),a=this.keyFromPrivate(a,c),e=this._truncateToN(new f(e,16));for(var t=this.n.byteLength(),i=a.getPrivate().toArray("be",t),r=e.toArray("be",t),n=new d({hash:this.hash,entropy:i,nonce:r,pers:b.pers,persEnc:b.persEnc||"utf8"}),s=this.n.sub(new f(1)),l=0;;l++){var h=b.k?b.k(l):new f(n.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(s)>=0)){var u=this.g.mul(h);if(!u.isInfinity()){var x=u.getX(),p=x.umod(this.n);if(0!==p.cmpn(0)){var g=h.invm(this.n).mul(p.mul(a.getPrivate()).iadd(e));if(0!==(g=g.umod(this.n)).cmpn(0)){var m=(u.getY().isOdd()?1:0)|(0!==x.cmp(p)?2:0);return b.canonical&&g.cmp(this.nh)>0&&(g=this.n.sub(g),m^=1),new o({r:p,s:g,recoveryParam:m})}}}}}},s.prototype.verify=function(e,a,c,d){e=this._truncateToN(new f(e,16)),c=this.keyFromPublic(c,d);var b=(a=new o(a,"hex")).r,t=a.s;if(b.cmpn(1)<0||b.cmp(this.n)>=0)return!1;if(t.cmpn(1)<0||t.cmp(this.n)>=0)return!1;var i,r=t.invm(this.n),n=r.mul(e).umod(this.n),s=r.mul(b).umod(this.n);return this.curve._maxwellTrick?!(i=this.g.jmulAdd(n,c.getPublic(),s)).isInfinity()&&i.eqXToP(b):!(i=this.g.mulAdd(n,c.getPublic(),s)).isInfinity()&&0===i.getX().umod(this.n).cmp(b)},s.prototype.recoverPubKey=function(e,a,c,d){r((3&c)===c,"The recovery param is more than two bits"),a=new o(a,d);var b=this.n,t=new f(e),i=a.r,n=a.s,s=1&c,l=c>>1;if(i.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");i=l?this.curve.pointFromX(i.add(this.curve.n),s):this.curve.pointFromX(i,s);var h=a.r.invm(b),u=b.sub(t).mul(h).umod(b),x=n.mul(h).umod(b);return this.g.mulAdd(u,i,x)},s.prototype.getKeyRecoveryParam=function(e,a,c,f){if(null!==(a=new o(a,f)).recoveryParam)return a.recoveryParam;for(var d=0;d<4;d++){var b;try{b=this.recoverPubKey(e,a,d)}catch(e){continue}if(b.eq(c))return d}throw new Error("Unable to find valid recovery factor")}},1200:(e,a,c)=>{"use strict";var f=c(8490),d=c(7011).assert;function b(e,a){this.ec=e,this.priv=null,this.pub=null,a.priv&&this._importPrivate(a.priv,a.privEnc),a.pub&&this._importPublic(a.pub,a.pubEnc)}e.exports=b,b.fromPublic=function(e,a,c){return a instanceof b?a:new b(e,{pub:a,pubEnc:c})},b.fromPrivate=function(e,a,c){return a instanceof b?a:new b(e,{priv:a,privEnc:c})},b.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},b.prototype.getPublic=function(e,a){return"string"==typeof e&&(a=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),a?this.pub.encode(a,e):this.pub},b.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},b.prototype._importPrivate=function(e,a){this.priv=new f(e,a||16),this.priv=this.priv.umod(this.ec.curve.n)},b.prototype._importPublic=function(e,a){if(e.x||e.y)return"mont"===this.ec.curve.type?d(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||d(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,a)},b.prototype.derive=function(e){return e.validate()||d(e.validate(),"public point not validated"),e.mul(this.priv).getX()},b.prototype.sign=function(e,a,c){return this.ec.sign(e,this,a,c)},b.prototype.verify=function(e,a){return this.ec.verify(e,a,this)},b.prototype.inspect=function(){return""}},8545:(e,a,c)=>{"use strict";var f=c(8490),d=c(7011),b=d.assert;function t(e,a){if(e instanceof t)return e;this._importDER(e,a)||(b(e.r&&e.s,"Signature without r or s"),this.r=new f(e.r,16),this.s=new f(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function i(){this.place=0}function r(e,a){var c=e[a.place++];if(!(128&c))return c;var f=15&c;if(0===f||f>4)return!1;if(0===e[a.place])return!1;for(var d=0,b=0,t=a.place;b>>=0;return!(d<=127)&&(a.place=t,d)}function n(e){for(var a=0,c=e.length-1;!e[a]&&!(128&e[a+1])&&a>>3);for(e.push(128|c);--c;)e.push(a>>>(c<<3)&255);e.push(a)}}e.exports=t,t.prototype._importDER=function(e,a){e=d.toArray(e,a);var c=new i;if(48!==e[c.place++])return!1;var b=r(e,c);if(!1===b)return!1;if(b+c.place!==e.length)return!1;if(2!==e[c.place++])return!1;var t=r(e,c);if(!1===t)return!1;if(128&e[c.place])return!1;var n=e.slice(c.place,t+c.place);if(c.place+=t,2!==e[c.place++])return!1;var o=r(e,c);if(!1===o)return!1;if(e.length!==o+c.place)return!1;if(128&e[c.place])return!1;var s=e.slice(c.place,o+c.place);if(0===n[0]){if(!(128&n[1]))return!1;n=n.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new f(n),this.s=new f(s),this.recoveryParam=null,!0},t.prototype.toDER=function(e){var a=this.r.toArray(),c=this.s.toArray();for(128&a[0]&&(a=[0].concat(a)),128&c[0]&&(c=[0].concat(c)),a=n(a),c=n(c);!(c[0]||128&c[1]);)c=c.slice(1);var f=[2];o(f,a.length),(f=f.concat(a)).push(2),o(f,c.length);var b=f.concat(c),t=[48];return o(t,b.length),t=t.concat(b),d.encode(t,e)}},8650:(e,a,c)=>{"use strict";var f=c(7952),d=c(480),b=c(7011),t=b.assert,i=b.parseBytes,r=c(6661),n=c(220);function o(e){if(t("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof o))return new o(e);e=d[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=f.sha512}e.exports=o,o.prototype.sign=function(e,a){e=i(e);var c=this.keyFromSecret(a),f=this.hashInt(c.messagePrefix(),e),d=this.g.mul(f),b=this.encodePoint(d),t=this.hashInt(b,c.pubBytes(),e).mul(c.priv()),r=f.add(t).umod(this.curve.n);return this.makeSignature({R:d,S:r,Rencoded:b})},o.prototype.verify=function(e,a,c){if(e=i(e),(a=this.makeSignature(a)).S().gte(a.eddsa.curve.n)||a.S().isNeg())return!1;var f=this.keyFromPublic(c),d=this.hashInt(a.Rencoded(),f.pubBytes(),e),b=this.g.mul(a.S());return a.R().add(f.pub().mul(d)).eq(b)},o.prototype.hashInt=function(){for(var e=this.hash(),a=0;a{"use strict";var f=c(7011),d=f.assert,b=f.parseBytes,t=f.cachedProperty;function i(e,a){this.eddsa=e,this._secret=b(a.secret),e.isPoint(a.pub)?this._pub=a.pub:this._pubBytes=b(a.pub)}i.fromPublic=function(e,a){return a instanceof i?a:new i(e,{pub:a})},i.fromSecret=function(e,a){return a instanceof i?a:new i(e,{secret:a})},i.prototype.secret=function(){return this._secret},t(i,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),t(i,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),t(i,"privBytes",(function(){var e=this.eddsa,a=this.hash(),c=e.encodingLength-1,f=a.slice(0,e.encodingLength);return f[0]&=248,f[c]&=127,f[c]|=64,f})),t(i,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),t(i,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),t(i,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),i.prototype.sign=function(e){return d(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},i.prototype.verify=function(e,a){return this.eddsa.verify(e,a,this)},i.prototype.getSecret=function(e){return d(this._secret,"KeyPair is public only"),f.encode(this.secret(),e)},i.prototype.getPublic=function(e){return f.encode(this.pubBytes(),e)},e.exports=i},220:(e,a,c)=>{"use strict";var f=c(8490),d=c(7011),b=d.assert,t=d.cachedProperty,i=d.parseBytes;function r(e,a){this.eddsa=e,"object"!=typeof a&&(a=i(a)),Array.isArray(a)&&(b(a.length===2*e.encodingLength,"Signature has invalid size"),a={R:a.slice(0,e.encodingLength),S:a.slice(e.encodingLength)}),b(a.R&&a.S,"Signature without R or S"),e.isPoint(a.R)&&(this._R=a.R),a.S instanceof f&&(this._S=a.S),this._Rencoded=Array.isArray(a.R)?a.R:a.Rencoded,this._Sencoded=Array.isArray(a.S)?a.S:a.Sencoded}t(r,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),t(r,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),t(r,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),t(r,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),r.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},r.prototype.toHex=function(){return d.encode(this.toBytes(),"hex").toUpperCase()},e.exports=r},4011:e=>{e.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"]]}}},7011:(e,a,c)=>{"use strict";var f=a,d=c(8490),b=c(3349),t=c(4367);f.assert=b,f.toArray=t.toArray,f.zero2=t.zero2,f.toHex=t.toHex,f.encode=t.encode,f.getNAF=function(e,a,c){var f,d=new Array(Math.max(e.bitLength(),c)+1);for(f=0;f(b>>1)-1?(b>>1)-r:r,t.isubn(i)):i=0,d[f]=i,t.iushrn(1)}return d},f.getJSF=function(e,a){var c=[[],[]];e=e.clone(),a=a.clone();for(var f,d=0,b=0;e.cmpn(-d)>0||a.cmpn(-b)>0;){var t,i,r=e.andln(3)+d&3,n=a.andln(3)+b&3;3===r&&(r=-1),3===n&&(n=-1),t=1&r?3!=(f=e.andln(7)+d&7)&&5!==f||2!==n?r:-r:0,c[0].push(t),i=1&n?3!=(f=a.andln(7)+b&7)&&5!==f||2!==r?n:-n:0,c[1].push(i),2*d===t+1&&(d=1-d),2*b===i+1&&(b=1-b),e.iushrn(1),a.iushrn(1)}return c},f.cachedProperty=function(e,a,c){var f="_"+a;e.prototype[a]=function(){return void 0!==this[f]?this[f]:this[f]=c.call(this)}},f.parseBytes=function(e){return"string"==typeof e?f.toArray(e,"hex"):e},f.intFromLE=function(e){return new d(e,"hex","le")}},8490:function(e,a,c){!function(e,a){"use strict";function f(e,a){if(!e)throw new Error(a||"Assertion failed")}function d(e,a){e.super_=a;var c=function(){};c.prototype=a.prototype,e.prototype=new c,e.prototype.constructor=e}function b(e,a,c){if(b.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==a&&"be"!==a||(c=a,a=10),this._init(e||0,a||10,c||"be"))}var t;"object"==typeof e?e.exports=b:a.BN=b,b.BN=b,b.wordSize=26;try{t="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:c(9368).Buffer}catch(e){}function i(e,a){var c=e.charCodeAt(a);return c>=65&&c<=70?c-55:c>=97&&c<=102?c-87:c-48&15}function r(e,a,c){var f=i(e,c);return c-1>=a&&(f|=i(e,c-1)<<4),f}function n(e,a,c,f){for(var d=0,b=Math.min(e.length,c),t=a;t=49?i-49+10:i>=17?i-17+10:i}return d}b.isBN=function(e){return e instanceof b||null!==e&&"object"==typeof e&&e.constructor.wordSize===b.wordSize&&Array.isArray(e.words)},b.max=function(e,a){return e.cmp(a)>0?e:a},b.min=function(e,a){return e.cmp(a)<0?e:a},b.prototype._init=function(e,a,c){if("number"==typeof e)return this._initNumber(e,a,c);if("object"==typeof e)return this._initArray(e,a,c);"hex"===a&&(a=16),f(a===(0|a)&&a>=2&&a<=36);var d=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(d++,this.negative=1),d=0;d-=3)t=e[d]|e[d-1]<<8|e[d-2]<<16,this.words[b]|=t<>>26-i&67108863,(i+=24)>=26&&(i-=26,b++);else if("le"===c)for(d=0,b=0;d>>26-i&67108863,(i+=24)>=26&&(i-=26,b++);return this.strip()},b.prototype._parseHex=function(e,a,c){this.length=Math.ceil((e.length-a)/6),this.words=new Array(this.length);for(var f=0;f=a;f-=2)d=r(e,a,f)<=18?(b-=18,t+=1,this.words[t]|=d>>>26):b+=8;else for(f=(e.length-a)%2==0?a+1:a;f=18?(b-=18,t+=1,this.words[t]|=d>>>26):b+=8;this.strip()},b.prototype._parseBase=function(e,a,c){this.words=[0],this.length=1;for(var f=0,d=1;d<=67108863;d*=a)f++;f--,d=d/a|0;for(var b=e.length-c,t=b%f,i=Math.min(b,b-t)+c,r=0,o=c;o1&&0===this.words[this.length-1];)this.length--;return this._normSign()},b.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},b.prototype.inspect=function(){return(this.red?""};var o=["","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"],s=[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],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function h(e,a,c){c.negative=a.negative^e.negative;var f=e.length+a.length|0;c.length=f,f=f-1|0;var d=0|e.words[0],b=0|a.words[0],t=d*b,i=67108863&t,r=t/67108864|0;c.words[0]=i;for(var n=1;n>>26,s=67108863&r,l=Math.min(n,a.length-1),h=Math.max(0,n-e.length+1);h<=l;h++){var u=n-h|0;o+=(t=(d=0|e.words[u])*(b=0|a.words[h])+s)/67108864|0,s=67108863&t}c.words[n]=0|s,r=0|o}return 0!==r?c.words[n]=0|r:c.length--,c.strip()}b.prototype.toString=function(e,a){var c;if(a=0|a||1,16===(e=e||10)||"hex"===e){c="";for(var d=0,b=0,t=0;t>>24-d&16777215)||t!==this.length-1?o[6-r.length]+r+c:r+c,(d+=2)>=26&&(d-=26,t--)}for(0!==b&&(c=b.toString(16)+c);c.length%a!=0;)c="0"+c;return 0!==this.negative&&(c="-"+c),c}if(e===(0|e)&&e>=2&&e<=36){var n=s[e],h=l[e];c="";var u=this.clone();for(u.negative=0;!u.isZero();){var x=u.modn(h).toString(e);c=(u=u.idivn(h)).isZero()?x+c:o[n-x.length]+x+c}for(this.isZero()&&(c="0"+c);c.length%a!=0;)c="0"+c;return 0!==this.negative&&(c="-"+c),c}f(!1,"Base should be between 2 and 36")},b.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&f(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},b.prototype.toJSON=function(){return this.toString(16)},b.prototype.toBuffer=function(e,a){return f(void 0!==t),this.toArrayLike(t,e,a)},b.prototype.toArray=function(e,a){return this.toArrayLike(Array,e,a)},b.prototype.toArrayLike=function(e,a,c){var d=this.byteLength(),b=c||Math.max(1,d);f(d<=b,"byte array longer than desired length"),f(b>0,"Requested array length <= 0"),this.strip();var t,i,r="le"===a,n=new e(b),o=this.clone();if(r){for(i=0;!o.isZero();i++)t=o.andln(255),o.iushrn(8),n[i]=t;for(;i=4096&&(c+=13,a>>>=13),a>=64&&(c+=7,a>>>=7),a>=8&&(c+=4,a>>>=4),a>=2&&(c+=2,a>>>=2),c+a},b.prototype._zeroBits=function(e){if(0===e)return 26;var a=e,c=0;return 8191&a||(c+=13,a>>>=13),127&a||(c+=7,a>>>=7),15&a||(c+=4,a>>>=4),3&a||(c+=2,a>>>=2),1&a||c++,c},b.prototype.bitLength=function(){var e=this.words[this.length-1],a=this._countBits(e);return 26*(this.length-1)+a},b.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,a=0;ae.length?this.clone().ior(e):e.clone().ior(this)},b.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},b.prototype.iuand=function(e){var a;a=this.length>e.length?e:this;for(var c=0;ce.length?this.clone().iand(e):e.clone().iand(this)},b.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},b.prototype.iuxor=function(e){var a,c;this.length>e.length?(a=this,c=e):(a=e,c=this);for(var f=0;fe.length?this.clone().ixor(e):e.clone().ixor(this)},b.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},b.prototype.inotn=function(e){f("number"==typeof e&&e>=0);var a=0|Math.ceil(e/26),c=e%26;this._expand(a),c>0&&a--;for(var d=0;d0&&(this.words[d]=~this.words[d]&67108863>>26-c),this.strip()},b.prototype.notn=function(e){return this.clone().inotn(e)},b.prototype.setn=function(e,a){f("number"==typeof e&&e>=0);var c=e/26|0,d=e%26;return this._expand(c+1),this.words[c]=a?this.words[c]|1<e.length?(c=this,f=e):(c=e,f=this);for(var d=0,b=0;b>>26;for(;0!==d&&b>>26;if(this.length=c.length,0!==d)this.words[this.length]=d,this.length++;else if(c!==this)for(;be.length?this.clone().iadd(e):e.clone().iadd(this)},b.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var a=this.iadd(e);return e.negative=1,a._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var c,f,d=this.cmp(e);if(0===d)return this.negative=0,this.length=1,this.words[0]=0,this;d>0?(c=this,f=e):(c=e,f=this);for(var b=0,t=0;t>26,this.words[t]=67108863&a;for(;0!==b&&t>26,this.words[t]=67108863&a;if(0===b&&t>>13,h=0|t[1],u=8191&h,x=h>>>13,p=0|t[2],g=8191&p,m=p>>>13,y=0|t[3],_=8191&y,v=y>>>13,w=0|t[4],M=8191&w,A=w>>>13,L=0|t[5],I=8191&L,k=L>>>13,E=0|t[6],S=8191&E,C=E>>>13,B=0|t[7],F=8191&B,O=B>>>13,P=0|t[8],R=8191&P,T=P>>>13,U=0|t[9],j=8191&U,N=U>>>13,q=0|i[0],D=8191&q,z=q>>>13,Q=0|i[1],G=8191&Q,K=Q>>>13,H=0|i[2],V=8191&H,Z=H>>>13,W=0|i[3],Y=8191&W,J=W>>>13,$=0|i[4],X=8191&$,ee=$>>>13,ae=0|i[5],ce=8191&ae,fe=ae>>>13,de=0|i[6],be=8191&de,te=de>>>13,ie=0|i[7],re=8191&ie,ne=ie>>>13,oe=0|i[8],se=8191&oe,le=oe>>>13,he=0|i[9],ue=8191&he,xe=he>>>13;c.negative=e.negative^a.negative,c.length=19;var pe=(n+(f=Math.imul(s,D))|0)+((8191&(d=(d=Math.imul(s,z))+Math.imul(l,D)|0))<<13)|0;n=((b=Math.imul(l,z))+(d>>>13)|0)+(pe>>>26)|0,pe&=67108863,f=Math.imul(u,D),d=(d=Math.imul(u,z))+Math.imul(x,D)|0,b=Math.imul(x,z);var ge=(n+(f=f+Math.imul(s,G)|0)|0)+((8191&(d=(d=d+Math.imul(s,K)|0)+Math.imul(l,G)|0))<<13)|0;n=((b=b+Math.imul(l,K)|0)+(d>>>13)|0)+(ge>>>26)|0,ge&=67108863,f=Math.imul(g,D),d=(d=Math.imul(g,z))+Math.imul(m,D)|0,b=Math.imul(m,z),f=f+Math.imul(u,G)|0,d=(d=d+Math.imul(u,K)|0)+Math.imul(x,G)|0,b=b+Math.imul(x,K)|0;var me=(n+(f=f+Math.imul(s,V)|0)|0)+((8191&(d=(d=d+Math.imul(s,Z)|0)+Math.imul(l,V)|0))<<13)|0;n=((b=b+Math.imul(l,Z)|0)+(d>>>13)|0)+(me>>>26)|0,me&=67108863,f=Math.imul(_,D),d=(d=Math.imul(_,z))+Math.imul(v,D)|0,b=Math.imul(v,z),f=f+Math.imul(g,G)|0,d=(d=d+Math.imul(g,K)|0)+Math.imul(m,G)|0,b=b+Math.imul(m,K)|0,f=f+Math.imul(u,V)|0,d=(d=d+Math.imul(u,Z)|0)+Math.imul(x,V)|0,b=b+Math.imul(x,Z)|0;var ye=(n+(f=f+Math.imul(s,Y)|0)|0)+((8191&(d=(d=d+Math.imul(s,J)|0)+Math.imul(l,Y)|0))<<13)|0;n=((b=b+Math.imul(l,J)|0)+(d>>>13)|0)+(ye>>>26)|0,ye&=67108863,f=Math.imul(M,D),d=(d=Math.imul(M,z))+Math.imul(A,D)|0,b=Math.imul(A,z),f=f+Math.imul(_,G)|0,d=(d=d+Math.imul(_,K)|0)+Math.imul(v,G)|0,b=b+Math.imul(v,K)|0,f=f+Math.imul(g,V)|0,d=(d=d+Math.imul(g,Z)|0)+Math.imul(m,V)|0,b=b+Math.imul(m,Z)|0,f=f+Math.imul(u,Y)|0,d=(d=d+Math.imul(u,J)|0)+Math.imul(x,Y)|0,b=b+Math.imul(x,J)|0;var _e=(n+(f=f+Math.imul(s,X)|0)|0)+((8191&(d=(d=d+Math.imul(s,ee)|0)+Math.imul(l,X)|0))<<13)|0;n=((b=b+Math.imul(l,ee)|0)+(d>>>13)|0)+(_e>>>26)|0,_e&=67108863,f=Math.imul(I,D),d=(d=Math.imul(I,z))+Math.imul(k,D)|0,b=Math.imul(k,z),f=f+Math.imul(M,G)|0,d=(d=d+Math.imul(M,K)|0)+Math.imul(A,G)|0,b=b+Math.imul(A,K)|0,f=f+Math.imul(_,V)|0,d=(d=d+Math.imul(_,Z)|0)+Math.imul(v,V)|0,b=b+Math.imul(v,Z)|0,f=f+Math.imul(g,Y)|0,d=(d=d+Math.imul(g,J)|0)+Math.imul(m,Y)|0,b=b+Math.imul(m,J)|0,f=f+Math.imul(u,X)|0,d=(d=d+Math.imul(u,ee)|0)+Math.imul(x,X)|0,b=b+Math.imul(x,ee)|0;var ve=(n+(f=f+Math.imul(s,ce)|0)|0)+((8191&(d=(d=d+Math.imul(s,fe)|0)+Math.imul(l,ce)|0))<<13)|0;n=((b=b+Math.imul(l,fe)|0)+(d>>>13)|0)+(ve>>>26)|0,ve&=67108863,f=Math.imul(S,D),d=(d=Math.imul(S,z))+Math.imul(C,D)|0,b=Math.imul(C,z),f=f+Math.imul(I,G)|0,d=(d=d+Math.imul(I,K)|0)+Math.imul(k,G)|0,b=b+Math.imul(k,K)|0,f=f+Math.imul(M,V)|0,d=(d=d+Math.imul(M,Z)|0)+Math.imul(A,V)|0,b=b+Math.imul(A,Z)|0,f=f+Math.imul(_,Y)|0,d=(d=d+Math.imul(_,J)|0)+Math.imul(v,Y)|0,b=b+Math.imul(v,J)|0,f=f+Math.imul(g,X)|0,d=(d=d+Math.imul(g,ee)|0)+Math.imul(m,X)|0,b=b+Math.imul(m,ee)|0,f=f+Math.imul(u,ce)|0,d=(d=d+Math.imul(u,fe)|0)+Math.imul(x,ce)|0,b=b+Math.imul(x,fe)|0;var we=(n+(f=f+Math.imul(s,be)|0)|0)+((8191&(d=(d=d+Math.imul(s,te)|0)+Math.imul(l,be)|0))<<13)|0;n=((b=b+Math.imul(l,te)|0)+(d>>>13)|0)+(we>>>26)|0,we&=67108863,f=Math.imul(F,D),d=(d=Math.imul(F,z))+Math.imul(O,D)|0,b=Math.imul(O,z),f=f+Math.imul(S,G)|0,d=(d=d+Math.imul(S,K)|0)+Math.imul(C,G)|0,b=b+Math.imul(C,K)|0,f=f+Math.imul(I,V)|0,d=(d=d+Math.imul(I,Z)|0)+Math.imul(k,V)|0,b=b+Math.imul(k,Z)|0,f=f+Math.imul(M,Y)|0,d=(d=d+Math.imul(M,J)|0)+Math.imul(A,Y)|0,b=b+Math.imul(A,J)|0,f=f+Math.imul(_,X)|0,d=(d=d+Math.imul(_,ee)|0)+Math.imul(v,X)|0,b=b+Math.imul(v,ee)|0,f=f+Math.imul(g,ce)|0,d=(d=d+Math.imul(g,fe)|0)+Math.imul(m,ce)|0,b=b+Math.imul(m,fe)|0,f=f+Math.imul(u,be)|0,d=(d=d+Math.imul(u,te)|0)+Math.imul(x,be)|0,b=b+Math.imul(x,te)|0;var Me=(n+(f=f+Math.imul(s,re)|0)|0)+((8191&(d=(d=d+Math.imul(s,ne)|0)+Math.imul(l,re)|0))<<13)|0;n=((b=b+Math.imul(l,ne)|0)+(d>>>13)|0)+(Me>>>26)|0,Me&=67108863,f=Math.imul(R,D),d=(d=Math.imul(R,z))+Math.imul(T,D)|0,b=Math.imul(T,z),f=f+Math.imul(F,G)|0,d=(d=d+Math.imul(F,K)|0)+Math.imul(O,G)|0,b=b+Math.imul(O,K)|0,f=f+Math.imul(S,V)|0,d=(d=d+Math.imul(S,Z)|0)+Math.imul(C,V)|0,b=b+Math.imul(C,Z)|0,f=f+Math.imul(I,Y)|0,d=(d=d+Math.imul(I,J)|0)+Math.imul(k,Y)|0,b=b+Math.imul(k,J)|0,f=f+Math.imul(M,X)|0,d=(d=d+Math.imul(M,ee)|0)+Math.imul(A,X)|0,b=b+Math.imul(A,ee)|0,f=f+Math.imul(_,ce)|0,d=(d=d+Math.imul(_,fe)|0)+Math.imul(v,ce)|0,b=b+Math.imul(v,fe)|0,f=f+Math.imul(g,be)|0,d=(d=d+Math.imul(g,te)|0)+Math.imul(m,be)|0,b=b+Math.imul(m,te)|0,f=f+Math.imul(u,re)|0,d=(d=d+Math.imul(u,ne)|0)+Math.imul(x,re)|0,b=b+Math.imul(x,ne)|0;var Ae=(n+(f=f+Math.imul(s,se)|0)|0)+((8191&(d=(d=d+Math.imul(s,le)|0)+Math.imul(l,se)|0))<<13)|0;n=((b=b+Math.imul(l,le)|0)+(d>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,f=Math.imul(j,D),d=(d=Math.imul(j,z))+Math.imul(N,D)|0,b=Math.imul(N,z),f=f+Math.imul(R,G)|0,d=(d=d+Math.imul(R,K)|0)+Math.imul(T,G)|0,b=b+Math.imul(T,K)|0,f=f+Math.imul(F,V)|0,d=(d=d+Math.imul(F,Z)|0)+Math.imul(O,V)|0,b=b+Math.imul(O,Z)|0,f=f+Math.imul(S,Y)|0,d=(d=d+Math.imul(S,J)|0)+Math.imul(C,Y)|0,b=b+Math.imul(C,J)|0,f=f+Math.imul(I,X)|0,d=(d=d+Math.imul(I,ee)|0)+Math.imul(k,X)|0,b=b+Math.imul(k,ee)|0,f=f+Math.imul(M,ce)|0,d=(d=d+Math.imul(M,fe)|0)+Math.imul(A,ce)|0,b=b+Math.imul(A,fe)|0,f=f+Math.imul(_,be)|0,d=(d=d+Math.imul(_,te)|0)+Math.imul(v,be)|0,b=b+Math.imul(v,te)|0,f=f+Math.imul(g,re)|0,d=(d=d+Math.imul(g,ne)|0)+Math.imul(m,re)|0,b=b+Math.imul(m,ne)|0,f=f+Math.imul(u,se)|0,d=(d=d+Math.imul(u,le)|0)+Math.imul(x,se)|0,b=b+Math.imul(x,le)|0;var Le=(n+(f=f+Math.imul(s,ue)|0)|0)+((8191&(d=(d=d+Math.imul(s,xe)|0)+Math.imul(l,ue)|0))<<13)|0;n=((b=b+Math.imul(l,xe)|0)+(d>>>13)|0)+(Le>>>26)|0,Le&=67108863,f=Math.imul(j,G),d=(d=Math.imul(j,K))+Math.imul(N,G)|0,b=Math.imul(N,K),f=f+Math.imul(R,V)|0,d=(d=d+Math.imul(R,Z)|0)+Math.imul(T,V)|0,b=b+Math.imul(T,Z)|0,f=f+Math.imul(F,Y)|0,d=(d=d+Math.imul(F,J)|0)+Math.imul(O,Y)|0,b=b+Math.imul(O,J)|0,f=f+Math.imul(S,X)|0,d=(d=d+Math.imul(S,ee)|0)+Math.imul(C,X)|0,b=b+Math.imul(C,ee)|0,f=f+Math.imul(I,ce)|0,d=(d=d+Math.imul(I,fe)|0)+Math.imul(k,ce)|0,b=b+Math.imul(k,fe)|0,f=f+Math.imul(M,be)|0,d=(d=d+Math.imul(M,te)|0)+Math.imul(A,be)|0,b=b+Math.imul(A,te)|0,f=f+Math.imul(_,re)|0,d=(d=d+Math.imul(_,ne)|0)+Math.imul(v,re)|0,b=b+Math.imul(v,ne)|0,f=f+Math.imul(g,se)|0,d=(d=d+Math.imul(g,le)|0)+Math.imul(m,se)|0,b=b+Math.imul(m,le)|0;var Ie=(n+(f=f+Math.imul(u,ue)|0)|0)+((8191&(d=(d=d+Math.imul(u,xe)|0)+Math.imul(x,ue)|0))<<13)|0;n=((b=b+Math.imul(x,xe)|0)+(d>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,f=Math.imul(j,V),d=(d=Math.imul(j,Z))+Math.imul(N,V)|0,b=Math.imul(N,Z),f=f+Math.imul(R,Y)|0,d=(d=d+Math.imul(R,J)|0)+Math.imul(T,Y)|0,b=b+Math.imul(T,J)|0,f=f+Math.imul(F,X)|0,d=(d=d+Math.imul(F,ee)|0)+Math.imul(O,X)|0,b=b+Math.imul(O,ee)|0,f=f+Math.imul(S,ce)|0,d=(d=d+Math.imul(S,fe)|0)+Math.imul(C,ce)|0,b=b+Math.imul(C,fe)|0,f=f+Math.imul(I,be)|0,d=(d=d+Math.imul(I,te)|0)+Math.imul(k,be)|0,b=b+Math.imul(k,te)|0,f=f+Math.imul(M,re)|0,d=(d=d+Math.imul(M,ne)|0)+Math.imul(A,re)|0,b=b+Math.imul(A,ne)|0,f=f+Math.imul(_,se)|0,d=(d=d+Math.imul(_,le)|0)+Math.imul(v,se)|0,b=b+Math.imul(v,le)|0;var ke=(n+(f=f+Math.imul(g,ue)|0)|0)+((8191&(d=(d=d+Math.imul(g,xe)|0)+Math.imul(m,ue)|0))<<13)|0;n=((b=b+Math.imul(m,xe)|0)+(d>>>13)|0)+(ke>>>26)|0,ke&=67108863,f=Math.imul(j,Y),d=(d=Math.imul(j,J))+Math.imul(N,Y)|0,b=Math.imul(N,J),f=f+Math.imul(R,X)|0,d=(d=d+Math.imul(R,ee)|0)+Math.imul(T,X)|0,b=b+Math.imul(T,ee)|0,f=f+Math.imul(F,ce)|0,d=(d=d+Math.imul(F,fe)|0)+Math.imul(O,ce)|0,b=b+Math.imul(O,fe)|0,f=f+Math.imul(S,be)|0,d=(d=d+Math.imul(S,te)|0)+Math.imul(C,be)|0,b=b+Math.imul(C,te)|0,f=f+Math.imul(I,re)|0,d=(d=d+Math.imul(I,ne)|0)+Math.imul(k,re)|0,b=b+Math.imul(k,ne)|0,f=f+Math.imul(M,se)|0,d=(d=d+Math.imul(M,le)|0)+Math.imul(A,se)|0,b=b+Math.imul(A,le)|0;var Ee=(n+(f=f+Math.imul(_,ue)|0)|0)+((8191&(d=(d=d+Math.imul(_,xe)|0)+Math.imul(v,ue)|0))<<13)|0;n=((b=b+Math.imul(v,xe)|0)+(d>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,f=Math.imul(j,X),d=(d=Math.imul(j,ee))+Math.imul(N,X)|0,b=Math.imul(N,ee),f=f+Math.imul(R,ce)|0,d=(d=d+Math.imul(R,fe)|0)+Math.imul(T,ce)|0,b=b+Math.imul(T,fe)|0,f=f+Math.imul(F,be)|0,d=(d=d+Math.imul(F,te)|0)+Math.imul(O,be)|0,b=b+Math.imul(O,te)|0,f=f+Math.imul(S,re)|0,d=(d=d+Math.imul(S,ne)|0)+Math.imul(C,re)|0,b=b+Math.imul(C,ne)|0,f=f+Math.imul(I,se)|0,d=(d=d+Math.imul(I,le)|0)+Math.imul(k,se)|0,b=b+Math.imul(k,le)|0;var Se=(n+(f=f+Math.imul(M,ue)|0)|0)+((8191&(d=(d=d+Math.imul(M,xe)|0)+Math.imul(A,ue)|0))<<13)|0;n=((b=b+Math.imul(A,xe)|0)+(d>>>13)|0)+(Se>>>26)|0,Se&=67108863,f=Math.imul(j,ce),d=(d=Math.imul(j,fe))+Math.imul(N,ce)|0,b=Math.imul(N,fe),f=f+Math.imul(R,be)|0,d=(d=d+Math.imul(R,te)|0)+Math.imul(T,be)|0,b=b+Math.imul(T,te)|0,f=f+Math.imul(F,re)|0,d=(d=d+Math.imul(F,ne)|0)+Math.imul(O,re)|0,b=b+Math.imul(O,ne)|0,f=f+Math.imul(S,se)|0,d=(d=d+Math.imul(S,le)|0)+Math.imul(C,se)|0,b=b+Math.imul(C,le)|0;var Ce=(n+(f=f+Math.imul(I,ue)|0)|0)+((8191&(d=(d=d+Math.imul(I,xe)|0)+Math.imul(k,ue)|0))<<13)|0;n=((b=b+Math.imul(k,xe)|0)+(d>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,f=Math.imul(j,be),d=(d=Math.imul(j,te))+Math.imul(N,be)|0,b=Math.imul(N,te),f=f+Math.imul(R,re)|0,d=(d=d+Math.imul(R,ne)|0)+Math.imul(T,re)|0,b=b+Math.imul(T,ne)|0,f=f+Math.imul(F,se)|0,d=(d=d+Math.imul(F,le)|0)+Math.imul(O,se)|0,b=b+Math.imul(O,le)|0;var Be=(n+(f=f+Math.imul(S,ue)|0)|0)+((8191&(d=(d=d+Math.imul(S,xe)|0)+Math.imul(C,ue)|0))<<13)|0;n=((b=b+Math.imul(C,xe)|0)+(d>>>13)|0)+(Be>>>26)|0,Be&=67108863,f=Math.imul(j,re),d=(d=Math.imul(j,ne))+Math.imul(N,re)|0,b=Math.imul(N,ne),f=f+Math.imul(R,se)|0,d=(d=d+Math.imul(R,le)|0)+Math.imul(T,se)|0,b=b+Math.imul(T,le)|0;var Fe=(n+(f=f+Math.imul(F,ue)|0)|0)+((8191&(d=(d=d+Math.imul(F,xe)|0)+Math.imul(O,ue)|0))<<13)|0;n=((b=b+Math.imul(O,xe)|0)+(d>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,f=Math.imul(j,se),d=(d=Math.imul(j,le))+Math.imul(N,se)|0,b=Math.imul(N,le);var Oe=(n+(f=f+Math.imul(R,ue)|0)|0)+((8191&(d=(d=d+Math.imul(R,xe)|0)+Math.imul(T,ue)|0))<<13)|0;n=((b=b+Math.imul(T,xe)|0)+(d>>>13)|0)+(Oe>>>26)|0,Oe&=67108863;var Pe=(n+(f=Math.imul(j,ue))|0)+((8191&(d=(d=Math.imul(j,xe))+Math.imul(N,ue)|0))<<13)|0;return n=((b=Math.imul(N,xe))+(d>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r[0]=pe,r[1]=ge,r[2]=me,r[3]=ye,r[4]=_e,r[5]=ve,r[6]=we,r[7]=Me,r[8]=Ae,r[9]=Le,r[10]=Ie,r[11]=ke,r[12]=Ee,r[13]=Se,r[14]=Ce,r[15]=Be,r[16]=Fe,r[17]=Oe,r[18]=Pe,0!==n&&(r[19]=n,c.length++),c};function x(e,a,c){return(new p).mulp(e,a,c)}function p(e,a){this.x=e,this.y=a}Math.imul||(u=h),b.prototype.mulTo=function(e,a){var c,f=this.length+e.length;return c=10===this.length&&10===e.length?u(this,e,a):f<63?h(this,e,a):f<1024?function(e,a,c){c.negative=a.negative^e.negative,c.length=e.length+a.length;for(var f=0,d=0,b=0;b>>26)|0)>>>26,t&=67108863}c.words[b]=i,f=t,t=d}return 0!==f?c.words[b]=f:c.length--,c.strip()}(this,e,a):x(this,e,a),c},p.prototype.makeRBT=function(e){for(var a=new Array(e),c=b.prototype._countBits(e)-1,f=0;f>=1;return f},p.prototype.permute=function(e,a,c,f,d,b){for(var t=0;t>>=1)d++;return 1<>>=13,c[2*t+1]=8191&b,b>>>=13;for(t=2*a;t>=26,a+=d/67108864|0,a+=b>>>26,this.words[c]=67108863&b}return 0!==a&&(this.words[c]=a,this.length++),this},b.prototype.muln=function(e){return this.clone().imuln(e)},b.prototype.sqr=function(){return this.mul(this)},b.prototype.isqr=function(){return this.imul(this.clone())},b.prototype.pow=function(e){var a=function(e){for(var a=new Array(e.bitLength()),c=0;c>>d}return a}(e);if(0===a.length)return new b(1);for(var c=this,f=0;f=0);var a,c=e%26,d=(e-c)/26,b=67108863>>>26-c<<26-c;if(0!==c){var t=0;for(a=0;a>>26-c}t&&(this.words[a]=t,this.length++)}if(0!==d){for(a=this.length-1;a>=0;a--)this.words[a+d]=this.words[a];for(a=0;a=0),d=a?(a-a%26)/26:0;var b=e%26,t=Math.min((e-b)/26,this.length),i=67108863^67108863>>>b<t)for(this.length-=t,n=0;n=0&&(0!==o||n>=d);n--){var s=0|this.words[n];this.words[n]=o<<26-b|s>>>b,o=s&i}return r&&0!==o&&(r.words[r.length++]=o),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},b.prototype.ishrn=function(e,a,c){return f(0===this.negative),this.iushrn(e,a,c)},b.prototype.shln=function(e){return this.clone().ishln(e)},b.prototype.ushln=function(e){return this.clone().iushln(e)},b.prototype.shrn=function(e){return this.clone().ishrn(e)},b.prototype.ushrn=function(e){return this.clone().iushrn(e)},b.prototype.testn=function(e){f("number"==typeof e&&e>=0);var a=e%26,c=(e-a)/26,d=1<=0);var a=e%26,c=(e-a)/26;if(f(0===this.negative,"imaskn works only with positive numbers"),this.length<=c)return this;if(0!==a&&c++,this.length=Math.min(c,this.length),0!==a){var d=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},b.prototype.isubn=function(e){if(f("number"==typeof e),f(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(r/67108864|0),this.words[d+c]=67108863&b}for(;d>26,this.words[d+c]=67108863&b;if(0===i)return this.strip();for(f(-1===i),i=0,d=0;d>26,this.words[d]=67108863&b;return this.negative=1,this.strip()},b.prototype._wordDiv=function(e,a){var c=(this.length,e.length),f=this.clone(),d=e,t=0|d.words[d.length-1];0!=(c=26-this._countBits(t))&&(d=d.ushln(c),f.iushln(c),t=0|d.words[d.length-1]);var i,r=f.length-d.length;if("mod"!==a){(i=new b(null)).length=r+1,i.words=new Array(i.length);for(var n=0;n=0;s--){var l=67108864*(0|f.words[d.length+s])+(0|f.words[d.length+s-1]);for(l=Math.min(l/t|0,67108863),f._ishlnsubmul(d,l,s);0!==f.negative;)l--,f.negative=0,f._ishlnsubmul(d,1,s),f.isZero()||(f.negative^=1);i&&(i.words[s]=l)}return i&&i.strip(),f.strip(),"div"!==a&&0!==c&&f.iushrn(c),{div:i||null,mod:f}},b.prototype.divmod=function(e,a,c){return f(!e.isZero()),this.isZero()?{div:new b(0),mod:new b(0)}:0!==this.negative&&0===e.negative?(i=this.neg().divmod(e,a),"mod"!==a&&(d=i.div.neg()),"div"!==a&&(t=i.mod.neg(),c&&0!==t.negative&&t.iadd(e)),{div:d,mod:t}):0===this.negative&&0!==e.negative?(i=this.divmod(e.neg(),a),"mod"!==a&&(d=i.div.neg()),{div:d,mod:i.mod}):this.negative&e.negative?(i=this.neg().divmod(e.neg(),a),"div"!==a&&(t=i.mod.neg(),c&&0!==t.negative&&t.isub(e)),{div:i.div,mod:t}):e.length>this.length||this.cmp(e)<0?{div:new b(0),mod:this}:1===e.length?"div"===a?{div:this.divn(e.words[0]),mod:null}:"mod"===a?{div:null,mod:new b(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new b(this.modn(e.words[0]))}:this._wordDiv(e,a);var d,t,i},b.prototype.div=function(e){return this.divmod(e,"div",!1).div},b.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},b.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},b.prototype.divRound=function(e){var a=this.divmod(e);if(a.mod.isZero())return a.div;var c=0!==a.div.negative?a.mod.isub(e):a.mod,f=e.ushrn(1),d=e.andln(1),b=c.cmp(f);return b<0||1===d&&0===b?a.div:0!==a.div.negative?a.div.isubn(1):a.div.iaddn(1)},b.prototype.modn=function(e){f(e<=67108863);for(var a=(1<<26)%e,c=0,d=this.length-1;d>=0;d--)c=(a*c+(0|this.words[d]))%e;return c},b.prototype.idivn=function(e){f(e<=67108863);for(var a=0,c=this.length-1;c>=0;c--){var d=(0|this.words[c])+67108864*a;this.words[c]=d/e|0,a=d%e}return this.strip()},b.prototype.divn=function(e){return this.clone().idivn(e)},b.prototype.egcd=function(e){f(0===e.negative),f(!e.isZero());var a=this,c=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var d=new b(1),t=new b(0),i=new b(0),r=new b(1),n=0;a.isEven()&&c.isEven();)a.iushrn(1),c.iushrn(1),++n;for(var o=c.clone(),s=a.clone();!a.isZero();){for(var l=0,h=1;!(a.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(a.iushrn(l);l-- >0;)(d.isOdd()||t.isOdd())&&(d.iadd(o),t.isub(s)),d.iushrn(1),t.iushrn(1);for(var u=0,x=1;!(c.words[0]&x)&&u<26;++u,x<<=1);if(u>0)for(c.iushrn(u);u-- >0;)(i.isOdd()||r.isOdd())&&(i.iadd(o),r.isub(s)),i.iushrn(1),r.iushrn(1);a.cmp(c)>=0?(a.isub(c),d.isub(i),t.isub(r)):(c.isub(a),i.isub(d),r.isub(t))}return{a:i,b:r,gcd:c.iushln(n)}},b.prototype._invmp=function(e){f(0===e.negative),f(!e.isZero());var a=this,c=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var d,t=new b(1),i=new b(0),r=c.clone();a.cmpn(1)>0&&c.cmpn(1)>0;){for(var n=0,o=1;!(a.words[0]&o)&&n<26;++n,o<<=1);if(n>0)for(a.iushrn(n);n-- >0;)t.isOdd()&&t.iadd(r),t.iushrn(1);for(var s=0,l=1;!(c.words[0]&l)&&s<26;++s,l<<=1);if(s>0)for(c.iushrn(s);s-- >0;)i.isOdd()&&i.iadd(r),i.iushrn(1);a.cmp(c)>=0?(a.isub(c),t.isub(i)):(c.isub(a),i.isub(t))}return(d=0===a.cmpn(1)?t:i).cmpn(0)<0&&d.iadd(e),d},b.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var a=this.clone(),c=e.clone();a.negative=0,c.negative=0;for(var f=0;a.isEven()&&c.isEven();f++)a.iushrn(1),c.iushrn(1);for(;;){for(;a.isEven();)a.iushrn(1);for(;c.isEven();)c.iushrn(1);var d=a.cmp(c);if(d<0){var b=a;a=c,c=b}else if(0===d||0===c.cmpn(1))break;a.isub(c)}return c.iushln(f)},b.prototype.invm=function(e){return this.egcd(e).a.umod(e)},b.prototype.isEven=function(){return!(1&this.words[0])},b.prototype.isOdd=function(){return!(1&~this.words[0])},b.prototype.andln=function(e){return this.words[0]&e},b.prototype.bincn=function(e){f("number"==typeof e);var a=e%26,c=(e-a)/26,d=1<>>26,i&=67108863,this.words[t]=i}return 0!==b&&(this.words[t]=b,this.length++),this},b.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},b.prototype.cmpn=function(e){var a,c=e<0;if(0!==this.negative&&!c)return-1;if(0===this.negative&&c)return 1;if(this.strip(),this.length>1)a=1;else{c&&(e=-e),f(e<=67108863,"Number is too big");var d=0|this.words[0];a=d===e?0:de.length)return 1;if(this.length=0;c--){var f=0|this.words[c],d=0|e.words[c];if(f!==d){fd&&(a=1);break}}return a},b.prototype.gtn=function(e){return 1===this.cmpn(e)},b.prototype.gt=function(e){return 1===this.cmp(e)},b.prototype.gten=function(e){return this.cmpn(e)>=0},b.prototype.gte=function(e){return this.cmp(e)>=0},b.prototype.ltn=function(e){return-1===this.cmpn(e)},b.prototype.lt=function(e){return-1===this.cmp(e)},b.prototype.lten=function(e){return this.cmpn(e)<=0},b.prototype.lte=function(e){return this.cmp(e)<=0},b.prototype.eqn=function(e){return 0===this.cmpn(e)},b.prototype.eq=function(e){return 0===this.cmp(e)},b.red=function(e){return new M(e)},b.prototype.toRed=function(e){return f(!this.red,"Already a number in reduction context"),f(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},b.prototype.fromRed=function(){return f(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},b.prototype._forceRed=function(e){return this.red=e,this},b.prototype.forceRed=function(e){return f(!this.red,"Already a number in reduction context"),this._forceRed(e)},b.prototype.redAdd=function(e){return f(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},b.prototype.redIAdd=function(e){return f(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},b.prototype.redSub=function(e){return f(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},b.prototype.redISub=function(e){return f(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},b.prototype.redShl=function(e){return f(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},b.prototype.redMul=function(e){return f(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},b.prototype.redIMul=function(e){return f(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},b.prototype.redSqr=function(){return f(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},b.prototype.redISqr=function(){return f(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},b.prototype.redSqrt=function(){return f(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},b.prototype.redInvm=function(){return f(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},b.prototype.redNeg=function(){return f(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},b.prototype.redPow=function(e){return f(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function m(e,a){this.name=e,this.p=new b(a,16),this.n=this.p.bitLength(),this.k=new b(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(e){if("string"==typeof e){var a=b._prime(e);this.m=a.p,this.prime=a}else f(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function A(e){M.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new b(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)}m.prototype._tmp=function(){var e=new b(null);return e.words=new Array(Math.ceil(this.n/13)),e},m.prototype.ireduce=function(e){var a,c=e;do{this.split(c,this.tmp),a=(c=(c=this.imulK(c)).iadd(this.tmp)).bitLength()}while(a>this.n);var f=a0?c.isub(this.p):void 0!==c.strip?c.strip():c._strip(),c},m.prototype.split=function(e,a){e.iushrn(this.n,0,a)},m.prototype.imulK=function(e){return e.imul(this.k)},d(y,m),y.prototype.split=function(e,a){for(var c=4194303,f=Math.min(e.length,9),d=0;d>>22,b=t}b>>>=22,e.words[d-10]=b,0===b&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var a=0,c=0;c>>=26,e.words[c]=d,a=f}return 0!==a&&(e.words[e.length++]=a),e},b._prime=function(e){if(g[e])return g[e];var a;if("k256"===e)a=new y;else if("p224"===e)a=new _;else if("p192"===e)a=new v;else{if("p25519"!==e)throw new Error("Unknown prime "+e);a=new w}return g[e]=a,a},M.prototype._verify1=function(e){f(0===e.negative,"red works only with positives"),f(e.red,"red works only with red numbers")},M.prototype._verify2=function(e,a){f(!(e.negative|a.negative),"red works only with positives"),f(e.red&&e.red===a.red,"red works only with red numbers")},M.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},M.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},M.prototype.add=function(e,a){this._verify2(e,a);var c=e.add(a);return c.cmp(this.m)>=0&&c.isub(this.m),c._forceRed(this)},M.prototype.iadd=function(e,a){this._verify2(e,a);var c=e.iadd(a);return c.cmp(this.m)>=0&&c.isub(this.m),c},M.prototype.sub=function(e,a){this._verify2(e,a);var c=e.sub(a);return c.cmpn(0)<0&&c.iadd(this.m),c._forceRed(this)},M.prototype.isub=function(e,a){this._verify2(e,a);var c=e.isub(a);return c.cmpn(0)<0&&c.iadd(this.m),c},M.prototype.shl=function(e,a){return this._verify1(e),this.imod(e.ushln(a))},M.prototype.imul=function(e,a){return this._verify2(e,a),this.imod(e.imul(a))},M.prototype.mul=function(e,a){return this._verify2(e,a),this.imod(e.mul(a))},M.prototype.isqr=function(e){return this.imul(e,e.clone())},M.prototype.sqr=function(e){return this.mul(e,e)},M.prototype.sqrt=function(e){if(e.isZero())return e.clone();var a=this.m.andln(3);if(f(a%2==1),3===a){var c=this.m.add(new b(1)).iushrn(2);return this.pow(e,c)}for(var d=this.m.subn(1),t=0;!d.isZero()&&0===d.andln(1);)t++,d.iushrn(1);f(!d.isZero());var i=new b(1).toRed(this),r=i.redNeg(),n=this.m.subn(1).iushrn(1),o=this.m.bitLength();for(o=new b(2*o*o).toRed(this);0!==this.pow(o,n).cmp(r);)o.redIAdd(r);for(var s=this.pow(o,d),l=this.pow(e,d.addn(1).iushrn(1)),h=this.pow(e,d),u=t;0!==h.cmp(i);){for(var x=h,p=0;0!==x.cmp(i);p++)x=x.redSqr();f(p=0;f--){for(var n=a.words[f],o=r-1;o>=0;o--){var s=n>>o&1;d!==c[0]&&(d=this.sqr(d)),0!==s||0!==t?(t<<=1,t|=s,(4==++i||0===f&&0===o)&&(d=this.mul(d,c[t]),i=0,t=0)):i=0}r=26}return d},M.prototype.convertTo=function(e){var a=e.umod(this.m);return a===e?a.clone():a},M.prototype.convertFrom=function(e){var a=e.clone();return a.red=null,a},b.mont=function(e){return new A(e)},d(A,M),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var a=this.imod(e.mul(this.rinv));return a.red=null,a},A.prototype.imul=function(e,a){if(e.isZero()||a.isZero())return e.words[0]=0,e.length=1,e;var c=e.imul(a),f=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),d=c.isub(f).iushrn(this.shift),b=d;return d.cmp(this.m)>=0?b=d.isub(this.m):d.cmpn(0)<0&&(b=d.iadd(this.m)),b._forceRed(this)},A.prototype.mul=function(e,a){if(e.isZero()||a.isZero())return new b(0)._forceRed(this);var c=e.mul(a),f=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),d=c.isub(f).iushrn(this.shift),t=d;return d.cmp(this.m)>=0?t=d.isub(this.m):d.cmpn(0)<0&&(t=d.iadd(this.m)),t._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=c.nmd(e),this)},655:(e,a,c)=>{"use strict";var f=c(453)("%Object.defineProperty%",!0)||!1;if(f)try{f({},"a",{value:1})}catch(e){f=!1}e.exports=f},1237:e=>{"use strict";e.exports=EvalError},9383:e=>{"use strict";e.exports=Error},9290:e=>{"use strict";e.exports=RangeError},9538:e=>{"use strict";e.exports=ReferenceError},8068:e=>{"use strict";e.exports=SyntaxError},9675:e=>{"use strict";e.exports=TypeError},5345:e=>{"use strict";e.exports=URIError},7007:e=>{"use strict";var a,c="object"==typeof Reflect?Reflect:null,f=c&&"function"==typeof c.apply?c.apply:function(e,a,c){return Function.prototype.apply.call(e,a,c)};a=c&&"function"==typeof c.ownKeys?c.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var d=Number.isNaN||function(e){return e!=e};function b(){b.init.call(this)}e.exports=b,e.exports.once=function(e,a){return new Promise((function(c,f){function d(c){e.removeListener(a,b),f(c)}function b(){"function"==typeof e.removeListener&&e.removeListener("error",d),c([].slice.call(arguments))}x(e,a,b,{once:!0}),"error"!==a&&function(e,a){"function"==typeof e.on&&x(e,"error",a,{once:!0})}(e,d)}))},b.EventEmitter=b,b.prototype._events=void 0,b.prototype._eventsCount=0,b.prototype._maxListeners=void 0;var t=10;function i(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function r(e){return void 0===e._maxListeners?b.defaultMaxListeners:e._maxListeners}function n(e,a,c,f){var d,b,t,n;if(i(c),void 0===(b=e._events)?(b=e._events=Object.create(null),e._eventsCount=0):(void 0!==b.newListener&&(e.emit("newListener",a,c.listener?c.listener:c),b=e._events),t=b[a]),void 0===t)t=b[a]=c,++e._eventsCount;else if("function"==typeof t?t=b[a]=f?[c,t]:[t,c]:f?t.unshift(c):t.push(c),(d=r(e))>0&&t.length>d&&!t.warned){t.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+t.length+" "+String(a)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=e,o.type=a,o.count=t.length,n=o,console&&console.warn&&console.warn(n)}return e}function o(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function s(e,a,c){var f={fired:!1,wrapFn:void 0,target:e,type:a,listener:c},d=o.bind(f);return d.listener=c,f.wrapFn=d,d}function l(e,a,c){var f=e._events;if(void 0===f)return[];var d=f[a];return void 0===d?[]:"function"==typeof d?c?[d.listener||d]:[d]:c?function(e){for(var a=new Array(e.length),c=0;c0&&(t=a[0]),t instanceof Error)throw t;var i=new Error("Unhandled error."+(t?" ("+t.message+")":""));throw i.context=t,i}var r=b[e];if(void 0===r)return!1;if("function"==typeof r)f(r,this,a);else{var n=r.length,o=u(r,n);for(c=0;c=0;b--)if(c[b]===a||c[b].listener===a){t=c[b].listener,d=b;break}if(d<0)return this;0===d?c.shift():function(e,a){for(;a+1=0;f--)this.removeListener(e,a[f]);return this},b.prototype.listeners=function(e){return l(this,e,!0)},b.prototype.rawListeners=function(e){return l(this,e,!1)},b.listenerCount=function(e,a){return"function"==typeof e.listenerCount?e.listenerCount(a):h.call(e,a)},b.prototype.listenerCount=h,b.prototype.eventNames=function(){return this._eventsCount>0?a(this._events):[]}},8078:(e,a,c)=>{var f=c(2861).Buffer,d=c(8276);e.exports=function(e,a,c,b){if(f.isBuffer(e)||(e=f.from(e,"binary")),a&&(f.isBuffer(a)||(a=f.from(a,"binary")),8!==a.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var t=c/8,i=f.alloc(t),r=f.alloc(b||0),n=f.alloc(0);t>0||b>0;){var o=new d;o.update(n),o.update(e),a&&o.update(a),n=o.digest();var s=0;if(t>0){var l=i.length-t;s=Math.min(t,n.length),n.copy(i,l,0,s),t-=s}if(s0){var h=r.length-b,u=Math.min(b,n.length-s);n.copy(r,h,s,s+u),b-=u}}return n.fill(0),{key:i,iv:r}}},2682:(e,a,c)=>{"use strict";var f=c(9600),d=Object.prototype.toString,b=Object.prototype.hasOwnProperty;e.exports=function(e,a,c){if(!f(a))throw new TypeError("iterator must be a function");var t;arguments.length>=3&&(t=c),"[object Array]"===d.call(e)?function(e,a,c){for(var f=0,d=e.length;f{"use strict";var a=Object.prototype.toString,c=Math.max,f=function(e,a){for(var c=[],f=0;f{"use strict";var f=c(9353);e.exports=Function.prototype.bind||f},453:(e,a,c)=>{"use strict";var f,d=c(9383),b=c(1237),t=c(9290),i=c(9538),r=c(8068),n=c(9675),o=c(5345),s=Function,l=function(e){try{return s('"use strict"; return ('+e+").constructor;")()}catch(e){}},h=Object.getOwnPropertyDescriptor;if(h)try{h({},"")}catch(e){h=null}var u=function(){throw new n},x=h?function(){try{return u}catch(e){try{return h(arguments,"callee").get}catch(e){return u}}}():u,p=c(4039)(),g=c(24)(),m=Object.getPrototypeOf||(g?function(e){return e.__proto__}:null),y={},_="undefined"!=typeof Uint8Array&&m?m(Uint8Array):f,v={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?f:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?f:ArrayBuffer,"%ArrayIteratorPrototype%":p&&m?m([][Symbol.iterator]()):f,"%AsyncFromSyncIteratorPrototype%":f,"%AsyncFunction%":y,"%AsyncGenerator%":y,"%AsyncGeneratorFunction%":y,"%AsyncIteratorPrototype%":y,"%Atomics%":"undefined"==typeof Atomics?f:Atomics,"%BigInt%":"undefined"==typeof BigInt?f:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?f:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?f:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?f:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":d,"%eval%":eval,"%EvalError%":b,"%Float32Array%":"undefined"==typeof Float32Array?f:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?f:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?f:FinalizationRegistry,"%Function%":s,"%GeneratorFunction%":y,"%Int8Array%":"undefined"==typeof Int8Array?f:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?f:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?f:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":p&&m?m(m([][Symbol.iterator]())):f,"%JSON%":"object"==typeof JSON?JSON:f,"%Map%":"undefined"==typeof Map?f:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&p&&m?m((new Map)[Symbol.iterator]()):f,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?f:Promise,"%Proxy%":"undefined"==typeof Proxy?f:Proxy,"%RangeError%":t,"%ReferenceError%":i,"%Reflect%":"undefined"==typeof Reflect?f:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?f:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&p&&m?m((new Set)[Symbol.iterator]()):f,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?f:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":p&&m?m(""[Symbol.iterator]()):f,"%Symbol%":p?Symbol:f,"%SyntaxError%":r,"%ThrowTypeError%":x,"%TypedArray%":_,"%TypeError%":n,"%Uint8Array%":"undefined"==typeof Uint8Array?f:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?f:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?f:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?f:Uint32Array,"%URIError%":o,"%WeakMap%":"undefined"==typeof WeakMap?f:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?f:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?f:WeakSet};if(m)try{null.error}catch(e){var w=m(m(e));v["%Error.prototype%"]=w}var M=function e(a){var c;if("%AsyncFunction%"===a)c=l("async function () {}");else if("%GeneratorFunction%"===a)c=l("function* () {}");else if("%AsyncGeneratorFunction%"===a)c=l("async function* () {}");else if("%AsyncGenerator%"===a){var f=e("%AsyncGeneratorFunction%");f&&(c=f.prototype)}else if("%AsyncIteratorPrototype%"===a){var d=e("%AsyncGenerator%");d&&m&&(c=m(d.prototype))}return v[a]=c,c},A={__proto__:null,"%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"]},L=c(6743),I=c(9957),k=L.call(Function.call,Array.prototype.concat),E=L.call(Function.apply,Array.prototype.splice),S=L.call(Function.call,String.prototype.replace),C=L.call(Function.call,String.prototype.slice),B=L.call(Function.call,RegExp.prototype.exec),F=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,O=/\\(\\)?/g,P=function(e,a){var c,f=e;if(I(A,f)&&(f="%"+(c=A[f])[0]+"%"),I(v,f)){var d=v[f];if(d===y&&(d=M(f)),void 0===d&&!a)throw new n("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:c,name:f,value:d}}throw new r("intrinsic "+e+" does not exist!")};e.exports=function(e,a){if("string"!=typeof e||0===e.length)throw new n("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof a)throw new n('"allowMissing" argument must be a boolean');if(null===B(/^%?[^%]*%?$/,e))throw new r("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var c=function(e){var a=C(e,0,1),c=C(e,-1);if("%"===a&&"%"!==c)throw new r("invalid intrinsic syntax, expected closing `%`");if("%"===c&&"%"!==a)throw new r("invalid intrinsic syntax, expected opening `%`");var f=[];return S(e,F,(function(e,a,c,d){f[f.length]=c?S(d,O,"$1"):a||e})),f}(e),f=c.length>0?c[0]:"",d=P("%"+f+"%",a),b=d.name,t=d.value,i=!1,o=d.alias;o&&(f=o[0],E(c,k([0,1],o)));for(var s=1,l=!0;s=c.length){var g=h(t,u);t=(l=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:t[u]}else l=I(t,u),t=t[u];l&&!i&&(v[b]=t)}}return t}},5795:(e,a,c)=>{"use strict";var f=c(453)("%Object.getOwnPropertyDescriptor%",!0);if(f)try{f([],"length")}catch(e){f=null}e.exports=f},592:(e,a,c)=>{"use strict";var f=c(655),d=function(){return!!f};d.hasArrayLengthDefineBug=function(){if(!f)return null;try{return 1!==f([],"length",{value:1}).length}catch(e){return!0}},e.exports=d},24:e=>{"use strict";var a={__proto__:null,foo:{}},c=Object;e.exports=function(){return{__proto__:a}.foo===a.foo&&!(a instanceof c)}},4039:(e,a,c)=>{"use strict";var f="undefined"!=typeof Symbol&&Symbol,d=c(1333);e.exports=function(){return"function"==typeof f&&"function"==typeof Symbol&&"symbol"==typeof f("foo")&&"symbol"==typeof Symbol("bar")&&d()}},1333:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},a=Symbol("test"),c=Object(a);if("string"==typeof a)return!1;if("[object Symbol]"!==Object.prototype.toString.call(a))return!1;if("[object Symbol]"!==Object.prototype.toString.call(c))return!1;for(a in e[a]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var f=Object.getOwnPropertySymbols(e);if(1!==f.length||f[0]!==a)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,a))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var d=Object.getOwnPropertyDescriptor(e,a);if(42!==d.value||!0!==d.enumerable)return!1}return!0}},9092:(e,a,c)=>{"use strict";var f=c(1333);e.exports=function(){return f()&&!!Symbol.toStringTag}},7952:(e,a,c)=>{var f=a;f.utils=c(7426),f.common=c(6166),f.sha=c(6229),f.ripemd=c(6784),f.hmac=c(8948),f.sha1=f.sha.sha1,f.sha256=f.sha.sha256,f.sha224=f.sha.sha224,f.sha384=f.sha.sha384,f.sha512=f.sha.sha512,f.ripemd160=f.ripemd.ripemd160},6166:(e,a,c)=>{"use strict";var f=c(7426),d=c(3349);function b(){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}a.BlockHash=b,b.prototype.update=function(e,a){if(e=f.toArray(e,a),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var c=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-c,e.length),0===this.pending.length&&(this.pending=null),e=f.join32(e,0,e.length-c,this.endian);for(var d=0;d>>24&255,f[d++]=e>>>16&255,f[d++]=e>>>8&255,f[d++]=255&e}else for(f[d++]=255&e,f[d++]=e>>>8&255,f[d++]=e>>>16&255,f[d++]=e>>>24&255,f[d++]=0,f[d++]=0,f[d++]=0,f[d++]=0,b=8;b{"use strict";var f=c(7426),d=c(3349);function b(e,a,c){if(!(this instanceof b))return new b(e,a,c);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(f.toArray(a,c))}e.exports=b,b.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),d(e.length<=this.blockSize);for(var a=e.length;a{"use strict";var f=c(7426),d=c(6166),b=f.rotl32,t=f.sum32,i=f.sum32_3,r=f.sum32_4,n=d.BlockHash;function o(){if(!(this instanceof o))return new o;n.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function s(e,a,c,f){return e<=15?a^c^f:e<=31?a&c|~a&f:e<=47?(a|~c)^f:e<=63?a&f|c&~f:a^(c|~f)}function l(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function h(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}f.inherits(o,n),a.ripemd160=o,o.blockSize=512,o.outSize=160,o.hmacStrength=192,o.padLength=64,o.prototype._update=function(e,a){for(var c=this.h[0],f=this.h[1],d=this.h[2],n=this.h[3],o=this.h[4],m=c,y=f,_=d,v=n,w=o,M=0;M<80;M++){var A=t(b(r(c,s(M,f,d,n),e[u[M]+a],l(M)),p[M]),o);c=o,o=n,n=b(d,10),d=f,f=A,A=t(b(r(m,s(79-M,y,_,v),e[x[M]+a],h(M)),g[M]),w),m=w,w=v,v=b(_,10),_=y,y=A}A=i(this.h[1],d,v),this.h[1]=i(this.h[2],n,w),this.h[2]=i(this.h[3],o,m),this.h[3]=i(this.h[4],c,y),this.h[4]=i(this.h[0],f,_),this.h[0]=A},o.prototype._digest=function(e){return"hex"===e?f.toHex32(this.h,"little"):f.split32(this.h,"little")};var u=[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],x=[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],p=[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],g=[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]},6229:(e,a,c)=>{"use strict";a.sha1=c(3917),a.sha224=c(7714),a.sha256=c(2287),a.sha384=c(1911),a.sha512=c(7766)},3917:(e,a,c)=>{"use strict";var f=c(7426),d=c(6166),b=c(6225),t=f.rotl32,i=f.sum32,r=f.sum32_5,n=b.ft_1,o=d.BlockHash,s=[1518500249,1859775393,2400959708,3395469782];function l(){if(!(this instanceof l))return new l;o.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}f.inherits(l,o),e.exports=l,l.blockSize=512,l.outSize=160,l.hmacStrength=80,l.padLength=64,l.prototype._update=function(e,a){for(var c=this.W,f=0;f<16;f++)c[f]=e[a+f];for(;f{"use strict";var f=c(7426),d=c(2287);function b(){if(!(this instanceof b))return new b;d.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}f.inherits(b,d),e.exports=b,b.blockSize=512,b.outSize=224,b.hmacStrength=192,b.padLength=64,b.prototype._digest=function(e){return"hex"===e?f.toHex32(this.h.slice(0,7),"big"):f.split32(this.h.slice(0,7),"big")}},2287:(e,a,c)=>{"use strict";var f=c(7426),d=c(6166),b=c(6225),t=c(3349),i=f.sum32,r=f.sum32_4,n=f.sum32_5,o=b.ch32,s=b.maj32,l=b.s0_256,h=b.s1_256,u=b.g0_256,x=b.g1_256,p=d.BlockHash,g=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function m(){if(!(this instanceof m))return new m;p.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=g,this.W=new Array(64)}f.inherits(m,p),e.exports=m,m.blockSize=512,m.outSize=256,m.hmacStrength=192,m.padLength=64,m.prototype._update=function(e,a){for(var c=this.W,f=0;f<16;f++)c[f]=e[a+f];for(;f{"use strict";var f=c(7426),d=c(7766);function b(){if(!(this instanceof b))return new b;d.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}f.inherits(b,d),e.exports=b,b.blockSize=1024,b.outSize=384,b.hmacStrength=192,b.padLength=128,b.prototype._digest=function(e){return"hex"===e?f.toHex32(this.h.slice(0,12),"big"):f.split32(this.h.slice(0,12),"big")}},7766:(e,a,c)=>{"use strict";var f=c(7426),d=c(6166),b=c(3349),t=f.rotr64_hi,i=f.rotr64_lo,r=f.shr64_hi,n=f.shr64_lo,o=f.sum64,s=f.sum64_hi,l=f.sum64_lo,h=f.sum64_4_hi,u=f.sum64_4_lo,x=f.sum64_5_hi,p=f.sum64_5_lo,g=d.BlockHash,m=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function y(){if(!(this instanceof y))return new y;g.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=m,this.W=new Array(160)}function _(e,a,c,f,d){var b=e&c^~e&d;return b<0&&(b+=4294967296),b}function v(e,a,c,f,d,b){var t=a&f^~a&b;return t<0&&(t+=4294967296),t}function w(e,a,c,f,d){var b=e&c^e&d^c&d;return b<0&&(b+=4294967296),b}function M(e,a,c,f,d,b){var t=a&f^a&b^f&b;return t<0&&(t+=4294967296),t}function A(e,a){var c=t(e,a,28)^t(a,e,2)^t(a,e,7);return c<0&&(c+=4294967296),c}function L(e,a){var c=i(e,a,28)^i(a,e,2)^i(a,e,7);return c<0&&(c+=4294967296),c}function I(e,a){var c=i(e,a,14)^i(e,a,18)^i(a,e,9);return c<0&&(c+=4294967296),c}function k(e,a){var c=t(e,a,1)^t(e,a,8)^r(e,a,7);return c<0&&(c+=4294967296),c}function E(e,a){var c=i(e,a,1)^i(e,a,8)^n(e,a,7);return c<0&&(c+=4294967296),c}function S(e,a){var c=i(e,a,19)^i(a,e,29)^n(e,a,6);return c<0&&(c+=4294967296),c}f.inherits(y,g),e.exports=y,y.blockSize=1024,y.outSize=512,y.hmacStrength=192,y.padLength=128,y.prototype._prepareBlock=function(e,a){for(var c=this.W,f=0;f<32;f++)c[f]=e[a+f];for(;f{"use strict";var f=c(7426).rotr32;function d(e,a,c){return e&a^~e&c}function b(e,a,c){return e&a^e&c^a&c}function t(e,a,c){return e^a^c}a.ft_1=function(e,a,c,f){return 0===e?d(a,c,f):1===e||3===e?t(a,c,f):2===e?b(a,c,f):void 0},a.ch32=d,a.maj32=b,a.p32=t,a.s0_256=function(e){return f(e,2)^f(e,13)^f(e,22)},a.s1_256=function(e){return f(e,6)^f(e,11)^f(e,25)},a.g0_256=function(e){return f(e,7)^f(e,18)^e>>>3},a.g1_256=function(e){return f(e,17)^f(e,19)^e>>>10}},7426:(e,a,c)=>{"use strict";var f=c(3349),d=c(6698);function b(e,a){return 55296==(64512&e.charCodeAt(a))&&!(a<0||a+1>=e.length)&&56320==(64512&e.charCodeAt(a+1))}function t(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function i(e){return 1===e.length?"0"+e:e}function r(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}a.inherits=d,a.toArray=function(e,a){if(Array.isArray(e))return e.slice();if(!e)return[];var c=[];if("string"==typeof e)if(a){if("hex"===a)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),d=0;d>6|192,c[f++]=63&t|128):b(e,d)?(t=65536+((1023&t)<<10)+(1023&e.charCodeAt(++d)),c[f++]=t>>18|240,c[f++]=t>>12&63|128,c[f++]=t>>6&63|128,c[f++]=63&t|128):(c[f++]=t>>12|224,c[f++]=t>>6&63|128,c[f++]=63&t|128)}else for(d=0;d>>0}return t},a.split32=function(e,a){for(var c=new Array(4*e.length),f=0,d=0;f>>24,c[d+1]=b>>>16&255,c[d+2]=b>>>8&255,c[d+3]=255&b):(c[d+3]=b>>>24,c[d+2]=b>>>16&255,c[d+1]=b>>>8&255,c[d]=255&b)}return c},a.rotr32=function(e,a){return e>>>a|e<<32-a},a.rotl32=function(e,a){return e<>>32-a},a.sum32=function(e,a){return e+a>>>0},a.sum32_3=function(e,a,c){return e+a+c>>>0},a.sum32_4=function(e,a,c,f){return e+a+c+f>>>0},a.sum32_5=function(e,a,c,f,d){return e+a+c+f+d>>>0},a.sum64=function(e,a,c,f){var d=e[a],b=f+e[a+1]>>>0,t=(b>>0,e[a+1]=b},a.sum64_hi=function(e,a,c,f){return(a+f>>>0>>0},a.sum64_lo=function(e,a,c,f){return a+f>>>0},a.sum64_4_hi=function(e,a,c,f,d,b,t,i){var r=0,n=a;return r+=(n=n+f>>>0)>>0)>>0)>>0},a.sum64_4_lo=function(e,a,c,f,d,b,t,i){return a+f+b+i>>>0},a.sum64_5_hi=function(e,a,c,f,d,b,t,i,r,n){var o=0,s=a;return o+=(s=s+f>>>0)>>0)>>0)>>0)>>0},a.sum64_5_lo=function(e,a,c,f,d,b,t,i,r,n){return a+f+b+i+n>>>0},a.rotr64_hi=function(e,a,c){return(a<<32-c|e>>>c)>>>0},a.rotr64_lo=function(e,a,c){return(e<<32-c|a>>>c)>>>0},a.shr64_hi=function(e,a,c){return e>>>c},a.shr64_lo=function(e,a,c){return(e<<32-c|a>>>c)>>>0}},9957:(e,a,c)=>{"use strict";var f=Function.prototype.call,d=Object.prototype.hasOwnProperty,b=c(6743);e.exports=b.call(f,d)},2723:(e,a,c)=>{"use strict";var f=c(7952),d=c(4367),b=c(3349);function t(e){if(!(this instanceof t))return new t(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var a=d.toArray(e.entropy,e.entropyEnc||"hex"),c=d.toArray(e.nonce,e.nonceEnc||"hex"),f=d.toArray(e.pers,e.persEnc||"hex");b(a.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(a,c,f)}e.exports=t,t.prototype._init=function(e,a,c){var f=e.concat(a).concat(c);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var d=0;d=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(c||[])),this._reseed=1},t.prototype.generate=function(e,a,c,f){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof a&&(f=c,c=a,a=null),c&&(c=d.toArray(c,f||"hex"),this._update(c));for(var b=[];b.length{a.read=function(e,a,c,f,d){var b,t,i=8*d-f-1,r=(1<>1,o=-7,s=c?d-1:0,l=c?-1:1,h=e[a+s];for(s+=l,b=h&(1<<-o)-1,h>>=-o,o+=i;o>0;b=256*b+e[a+s],s+=l,o-=8);for(t=b&(1<<-o)-1,b>>=-o,o+=f;o>0;t=256*t+e[a+s],s+=l,o-=8);if(0===b)b=1-n;else{if(b===r)return t?NaN:1/0*(h?-1:1);t+=Math.pow(2,f),b-=n}return(h?-1:1)*t*Math.pow(2,b-f)},a.write=function(e,a,c,f,d,b){var t,i,r,n=8*b-d-1,o=(1<>1,l=23===d?Math.pow(2,-24)-Math.pow(2,-77):0,h=f?0:b-1,u=f?1:-1,x=a<0||0===a&&1/a<0?1:0;for(a=Math.abs(a),isNaN(a)||a===1/0?(i=isNaN(a)?1:0,t=o):(t=Math.floor(Math.log(a)/Math.LN2),a*(r=Math.pow(2,-t))<1&&(t--,r*=2),(a+=t+s>=1?l/r:l*Math.pow(2,1-s))*r>=2&&(t++,r/=2),t+s>=o?(i=0,t=o):t+s>=1?(i=(a*r-1)*Math.pow(2,d),t+=s):(i=a*Math.pow(2,s-1)*Math.pow(2,d),t=0));d>=8;e[c+h]=255&i,h+=u,i/=256,d-=8);for(t=t<0;e[c+h]=255&t,h+=u,t/=256,n-=8);e[c+h-u]|=128*x}},6698:e=>{"function"==typeof Object.create?e.exports=function(e,a){a&&(e.super_=a,e.prototype=Object.create(a.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,a){if(a){e.super_=a;var c=function(){};c.prototype=a.prototype,e.prototype=new c,e.prototype.constructor=e}}},7244:(e,a,c)=>{"use strict";var f=c(9092)(),d=c(8075)("Object.prototype.toString"),b=function(e){return!(f&&e&&"object"==typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===d(e)},t=function(e){return!!b(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==d(e)&&"[object Function]"===d(e.callee)},i=function(){return b(arguments)}();b.isLegacyArguments=t,e.exports=i?b:t},9600:e=>{"use strict";var a,c,f=Function.prototype.toString,d="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof d&&"function"==typeof Object.defineProperty)try{a=Object.defineProperty({},"length",{get:function(){throw c}}),c={},d((function(){throw 42}),null,a)}catch(e){e!==c&&(d=null)}else d=null;var b=/^\s*class\b/,t=function(e){try{var a=f.call(e);return b.test(a)}catch(e){return!1}},i=function(e){try{return!t(e)&&(f.call(e),!0)}catch(e){return!1}},r=Object.prototype.toString,n="function"==typeof Symbol&&!!Symbol.toStringTag,o=!(0 in[,]),s=function(){return!1};if("object"==typeof document){var l=document.all;r.call(l)===r.call(document.all)&&(s=function(e){if((o||!e)&&(void 0===e||"object"==typeof e))try{var a=r.call(e);return("[object HTMLAllCollection]"===a||"[object HTML document.all class]"===a||"[object HTMLCollection]"===a||"[object Object]"===a)&&null==e("")}catch(e){}return!1})}e.exports=d?function(e){if(s(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;try{d(e,null,a)}catch(e){if(e!==c)return!1}return!t(e)&&i(e)}:function(e){if(s(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(n)return i(e);if(t(e))return!1;var a=r.call(e);return!("[object Function]"!==a&&"[object GeneratorFunction]"!==a&&!/^\[object HTML/.test(a))&&i(e)}},8184:(e,a,c)=>{"use strict";var f,d=Object.prototype.toString,b=Function.prototype.toString,t=/^\s*(?:function)?\*/,i=c(9092)(),r=Object.getPrototypeOf;e.exports=function(e){if("function"!=typeof e)return!1;if(t.test(b.call(e)))return!0;if(!i)return"[object GeneratorFunction]"===d.call(e);if(!r)return!1;if(void 0===f){var a=function(){if(!i)return!1;try{return Function("return function*() {}")()}catch(e){}}();f=!!a&&r(a)}return r(e)===f}},3003:e=>{"use strict";e.exports=function(e){return e!=e}},4133:(e,a,c)=>{"use strict";var f=c(487),d=c(8452),b=c(3003),t=c(6642),i=c(2464),r=f(t(),Number);d(r,{getPolyfill:t,implementation:b,shim:i}),e.exports=r},6642:(e,a,c)=>{"use strict";var f=c(3003);e.exports=function(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:f}},2464:(e,a,c)=>{"use strict";var f=c(8452),d=c(6642);e.exports=function(){var e=d();return f(Number,{isNaN:e},{isNaN:function(){return Number.isNaN!==e}}),e}},5680:(e,a,c)=>{"use strict";var f=c(5767);e.exports=function(e){return!!f(e)}},8127:function(e,a,c){var f=c(2045).hp;"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==c.g&&c.g,e.exports=function(){"use strict";var e,a="3.7.7",c=a,d="function"==typeof f,b="function"==typeof TextDecoder?new TextDecoder:void 0,t="function"==typeof TextEncoder?new TextEncoder:void 0,i=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),r=(e={},i.forEach((function(a,c){return e[a]=c})),e),n=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,o=String.fromCharCode.bind(String),s="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):function(e){return new Uint8Array(Array.prototype.slice.call(e,0))},l=function(e){return e.replace(/=/g,"").replace(/[+\/]/g,(function(e){return"+"==e?"-":"_"}))},h=function(e){return e.replace(/[^A-Za-z0-9\+\/]/g,"")},u=function(e){for(var a,c,f,d,b="",t=e.length%3,r=0;r255||(f=e.charCodeAt(r++))>255||(d=e.charCodeAt(r++))>255)throw new TypeError("invalid character found");b+=i[(a=c<<16|f<<8|d)>>18&63]+i[a>>12&63]+i[a>>6&63]+i[63&a]}return t?b.slice(0,t-3)+"===".substring(t):b},x="function"==typeof btoa?function(e){return btoa(e)}:d?function(e){return f.from(e,"binary").toString("base64")}:u,p=d?function(e){return f.from(e).toString("base64")}:function(e){for(var a=[],c=0,f=e.length;c>>6)+o(128|63&a):o(224|a>>>12&15)+o(128|a>>>6&63)+o(128|63&a);var a=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return o(240|a>>>18&7)+o(128|a>>>12&63)+o(128|a>>>6&63)+o(128|63&a)},y=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,_=function(e){return e.replace(y,m)},v=d?function(e){return f.from(e,"utf8").toString("base64")}:t?function(e){return p(t.encode(e))}:function(e){return x(_(e))},w=function(e,a){return void 0===a&&(a=!1),a?l(v(e)):v(e)},M=function(e){return w(e,!0)},A=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,L=function(e){switch(e.length){case 4:var a=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return o(55296+(a>>>10))+o(56320+(1023&a));case 3:return o((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return o((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},I=function(e){return e.replace(A,L)},k=function(e){if(e=e.replace(/\s+/g,""),!n.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));for(var a,c,f,d="",b=0;b>16&255):64===f?o(a>>16&255,a>>8&255):o(a>>16&255,a>>8&255,255&a);return d},E="function"==typeof atob?function(e){return atob(h(e))}:d?function(e){return f.from(e,"base64").toString("binary")}:k,S=d?function(e){return s(f.from(e,"base64"))}:function(e){return s(E(e).split("").map((function(e){return e.charCodeAt(0)})))},C=function(e){return S(F(e))},B=d?function(e){return f.from(e,"base64").toString("utf8")}:b?function(e){return b.decode(S(e))}:function(e){return I(E(e))},F=function(e){return h(e.replace(/[-_]/g,(function(e){return"-"==e?"+":"/"})))},O=function(e){return B(F(e))},P=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}},R=function(){var e=function(e,a){return Object.defineProperty(String.prototype,e,P(a))};e("fromBase64",(function(){return O(this)})),e("toBase64",(function(e){return w(this,e)})),e("toBase64URI",(function(){return w(this,!0)})),e("toBase64URL",(function(){return w(this,!0)})),e("toUint8Array",(function(){return C(this)}))},T=function(){var e=function(e,a){return Object.defineProperty(Uint8Array.prototype,e,P(a))};e("toBase64",(function(e){return g(this,e)})),e("toBase64URI",(function(){return g(this,!0)})),e("toBase64URL",(function(){return g(this,!0)}))},U={version:a,VERSION:c,atob:E,atobPolyfill:k,btoa:x,btoaPolyfill:u,fromBase64:O,toBase64:w,encode:w,encodeURI:M,encodeURL:M,utob:_,btou:I,decode:O,isValid:function(e){if("string"!=typeof e)return!1;var a=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(a)||!/[^\s0-9a-zA-Z\-_]/.test(a)},fromUint8Array:g,toUint8Array:C,extendString:R,extendUint8Array:T,extendBuiltins:function(){R(),T()},Base64:{}};return Object.keys(U).forEach((function(e){return U.Base64[e]=U[e]})),U}()},1176:(e,a,c)=>{var f;!function(){"use strict";var d="input is invalid type",b="object"==typeof window,t=b?window:{};t.JS_SHA3_NO_WINDOW&&(b=!1);var i=!b&&"object"==typeof self;!t.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?t=c.g:i&&(t=self);var r=!t.JS_SHA3_NO_COMMON_JS&&e.exports,n=c.amdO,o=!t.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,s="0123456789abcdef".split(""),l=[4,1024,262144,67108864],h=[0,8,16,24],u=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],x=[224,256,384,512],p=[128,256],g=["hex","buffer","arrayBuffer","array","digest"],m={128:168,256:136};!t.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!o||!t.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var y=function(e,a,c){return function(f){return new P(e,a,e).update(f)[c]()}},_=function(e,a,c){return function(f,d){return new P(e,a,d).update(f)[c]()}},v=function(e,a,c){return function(a,f,d,b){return I["cshake"+e].update(a,f,d,b)[c]()}},w=function(e,a,c){return function(a,f,d,b){return I["kmac"+e].update(a,f,d,b)[c]()}},M=function(e,a,c,f){for(var d=0;d>5,this.byteCount=this.blockCount<<2,this.outputBlocks=c>>5,this.extraBytes=(31&c)>>3;for(var f=0;f<50;++f)this.s[f]=0}function R(e,a,c){P.call(this,e,a,c)}P.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var a,c=typeof e;if("string"!==c){if("object"!==c)throw new Error(d);if(null===e)throw new Error(d);if(o&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||o&&ArrayBuffer.isView(e)))throw new Error(d);a=!0}for(var f,b,t=this.blocks,i=this.byteCount,r=e.length,n=this.blockCount,s=0,l=this.s;s>2]|=e[s]<>2]|=b<>2]|=(192|b>>6)<>2]|=(128|63&b)<=57344?(t[f>>2]|=(224|b>>12)<>2]|=(128|b>>6&63)<>2]|=(128|63&b)<>2]|=(240|b>>18)<>2]|=(128|b>>12&63)<>2]|=(128|b>>6&63)<>2]|=(128|63&b)<=i){for(this.start=f-i,this.block=t[n],f=0;f>=8);c>0;)d.unshift(c),c=255&(e>>=8),++f;return a?d.push(f):d.unshift(f),this.update(d),d.length},P.prototype.encodeString=function(e){var a,c=typeof e;if("string"!==c){if("object"!==c)throw new Error(d);if(null===e)throw new Error(d);if(o&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||o&&ArrayBuffer.isView(e)))throw new Error(d);a=!0}var f=0,b=e.length;if(a)f=b;else for(var t=0;t=57344?f+=3:(i=65536+((1023&i)<<10|1023&e.charCodeAt(++t)),f+=4)}return f+=this.encode(8*f),this.update(e),f},P.prototype.bytepad=function(e,a){for(var c=this.encode(a),f=0;f>2]|=this.padding[3&a],this.lastByteIndex===this.byteCount)for(e[0]=e[c],a=1;a>4&15]+s[15&e]+s[e>>12&15]+s[e>>8&15]+s[e>>20&15]+s[e>>16&15]+s[e>>28&15]+s[e>>24&15];t%a==0&&(T(c),b=0)}return d&&(e=c[b],i+=s[e>>4&15]+s[15&e],d>1&&(i+=s[e>>12&15]+s[e>>8&15]),d>2&&(i+=s[e>>20&15]+s[e>>16&15])),i},P.prototype.arrayBuffer=function(){this.finalize();var e,a=this.blockCount,c=this.s,f=this.outputBlocks,d=this.extraBytes,b=0,t=0,i=this.outputBits>>3;e=d?new ArrayBuffer(f+1<<2):new ArrayBuffer(i);for(var r=new Uint32Array(e);t>8&255,r[e+2]=a>>16&255,r[e+3]=a>>24&255;i%c==0&&T(f)}return b&&(e=i<<2,a=f[t],r[e]=255&a,b>1&&(r[e+1]=a>>8&255),b>2&&(r[e+2]=a>>16&255)),r},R.prototype=new P,R.prototype.finalize=function(){return this.encode(this.outputBits,!0),P.prototype.finalize.call(this)};var T=function(e){var a,c,f,d,b,t,i,r,n,o,s,l,h,x,p,g,m,y,_,v,w,M,A,L,I,k,E,S,C,B,F,O,P,R,T,U,j,N,q,D,z,Q,G,K,H,V,Z,W,Y,J,$,X,ee,ae,ce,fe,de,be,te,ie,re,ne,oe;for(f=0;f<48;f+=2)d=e[0]^e[10]^e[20]^e[30]^e[40],b=e[1]^e[11]^e[21]^e[31]^e[41],t=e[2]^e[12]^e[22]^e[32]^e[42],i=e[3]^e[13]^e[23]^e[33]^e[43],r=e[4]^e[14]^e[24]^e[34]^e[44],n=e[5]^e[15]^e[25]^e[35]^e[45],o=e[6]^e[16]^e[26]^e[36]^e[46],s=e[7]^e[17]^e[27]^e[37]^e[47],a=(l=e[8]^e[18]^e[28]^e[38]^e[48])^(t<<1|i>>>31),c=(h=e[9]^e[19]^e[29]^e[39]^e[49])^(i<<1|t>>>31),e[0]^=a,e[1]^=c,e[10]^=a,e[11]^=c,e[20]^=a,e[21]^=c,e[30]^=a,e[31]^=c,e[40]^=a,e[41]^=c,a=d^(r<<1|n>>>31),c=b^(n<<1|r>>>31),e[2]^=a,e[3]^=c,e[12]^=a,e[13]^=c,e[22]^=a,e[23]^=c,e[32]^=a,e[33]^=c,e[42]^=a,e[43]^=c,a=t^(o<<1|s>>>31),c=i^(s<<1|o>>>31),e[4]^=a,e[5]^=c,e[14]^=a,e[15]^=c,e[24]^=a,e[25]^=c,e[34]^=a,e[35]^=c,e[44]^=a,e[45]^=c,a=r^(l<<1|h>>>31),c=n^(h<<1|l>>>31),e[6]^=a,e[7]^=c,e[16]^=a,e[17]^=c,e[26]^=a,e[27]^=c,e[36]^=a,e[37]^=c,e[46]^=a,e[47]^=c,a=o^(d<<1|b>>>31),c=s^(b<<1|d>>>31),e[8]^=a,e[9]^=c,e[18]^=a,e[19]^=c,e[28]^=a,e[29]^=c,e[38]^=a,e[39]^=c,e[48]^=a,e[49]^=c,x=e[0],p=e[1],V=e[11]<<4|e[10]>>>28,Z=e[10]<<4|e[11]>>>28,S=e[20]<<3|e[21]>>>29,C=e[21]<<3|e[20]>>>29,ie=e[31]<<9|e[30]>>>23,re=e[30]<<9|e[31]>>>23,Q=e[40]<<18|e[41]>>>14,G=e[41]<<18|e[40]>>>14,R=e[2]<<1|e[3]>>>31,T=e[3]<<1|e[2]>>>31,g=e[13]<<12|e[12]>>>20,m=e[12]<<12|e[13]>>>20,W=e[22]<<10|e[23]>>>22,Y=e[23]<<10|e[22]>>>22,B=e[33]<<13|e[32]>>>19,F=e[32]<<13|e[33]>>>19,ne=e[42]<<2|e[43]>>>30,oe=e[43]<<2|e[42]>>>30,ae=e[5]<<30|e[4]>>>2,ce=e[4]<<30|e[5]>>>2,U=e[14]<<6|e[15]>>>26,j=e[15]<<6|e[14]>>>26,y=e[25]<<11|e[24]>>>21,_=e[24]<<11|e[25]>>>21,J=e[34]<<15|e[35]>>>17,$=e[35]<<15|e[34]>>>17,O=e[45]<<29|e[44]>>>3,P=e[44]<<29|e[45]>>>3,L=e[6]<<28|e[7]>>>4,I=e[7]<<28|e[6]>>>4,fe=e[17]<<23|e[16]>>>9,de=e[16]<<23|e[17]>>>9,N=e[26]<<25|e[27]>>>7,q=e[27]<<25|e[26]>>>7,v=e[36]<<21|e[37]>>>11,w=e[37]<<21|e[36]>>>11,X=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,K=e[8]<<27|e[9]>>>5,H=e[9]<<27|e[8]>>>5,k=e[18]<<20|e[19]>>>12,E=e[19]<<20|e[18]>>>12,be=e[29]<<7|e[28]>>>25,te=e[28]<<7|e[29]>>>25,D=e[38]<<8|e[39]>>>24,z=e[39]<<8|e[38]>>>24,M=e[48]<<14|e[49]>>>18,A=e[49]<<14|e[48]>>>18,e[0]=x^~g&y,e[1]=p^~m&_,e[10]=L^~k&S,e[11]=I^~E&C,e[20]=R^~U&N,e[21]=T^~j&q,e[30]=K^~V&W,e[31]=H^~Z&Y,e[40]=ae^~fe&be,e[41]=ce^~de&te,e[2]=g^~y&v,e[3]=m^~_&w,e[12]=k^~S&B,e[13]=E^~C&F,e[22]=U^~N&D,e[23]=j^~q&z,e[32]=V^~W&J,e[33]=Z^~Y&$,e[42]=fe^~be&ie,e[43]=de^~te&re,e[4]=y^~v&M,e[5]=_^~w&A,e[14]=S^~B&O,e[15]=C^~F&P,e[24]=N^~D&Q,e[25]=q^~z&G,e[34]=W^~J&X,e[35]=Y^~$&ee,e[44]=be^~ie&ne,e[45]=te^~re&oe,e[6]=v^~M&x,e[7]=w^~A&p,e[16]=B^~O&L,e[17]=F^~P&I,e[26]=D^~Q&R,e[27]=z^~G&T,e[36]=J^~X&K,e[37]=$^~ee&H,e[46]=ie^~ne&ae,e[47]=re^~oe&ce,e[8]=M^~x&g,e[9]=A^~p&m,e[18]=O^~L&k,e[19]=P^~I&E,e[28]=Q^~R&U,e[29]=G^~T&j,e[38]=X^~K&V,e[39]=ee^~H&Z,e[48]=ne^~ae&fe,e[49]=oe^~ce&de,e[0]^=u[f],e[1]^=u[f+1]};if(r)e.exports=I;else{for(E=0;E{"use strict";var f=c(6698),d=c(3726),b=c(2861).Buffer,t=new Array(16);function i(){d.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function r(e,a){return e<>>32-a}function n(e,a,c,f,d,b,t){return r(e+(a&c|~a&f)+d+b|0,t)+a|0}function o(e,a,c,f,d,b,t){return r(e+(a&f|c&~f)+d+b|0,t)+a|0}function s(e,a,c,f,d,b,t){return r(e+(a^c^f)+d+b|0,t)+a|0}function l(e,a,c,f,d,b,t){return r(e+(c^(a|~f))+d+b|0,t)+a|0}f(i,d),i.prototype._update=function(){for(var e=t,a=0;a<16;++a)e[a]=this._block.readInt32LE(4*a);var c=this._a,f=this._b,d=this._c,b=this._d;c=n(c,f,d,b,e[0],3614090360,7),b=n(b,c,f,d,e[1],3905402710,12),d=n(d,b,c,f,e[2],606105819,17),f=n(f,d,b,c,e[3],3250441966,22),c=n(c,f,d,b,e[4],4118548399,7),b=n(b,c,f,d,e[5],1200080426,12),d=n(d,b,c,f,e[6],2821735955,17),f=n(f,d,b,c,e[7],4249261313,22),c=n(c,f,d,b,e[8],1770035416,7),b=n(b,c,f,d,e[9],2336552879,12),d=n(d,b,c,f,e[10],4294925233,17),f=n(f,d,b,c,e[11],2304563134,22),c=n(c,f,d,b,e[12],1804603682,7),b=n(b,c,f,d,e[13],4254626195,12),d=n(d,b,c,f,e[14],2792965006,17),c=o(c,f=n(f,d,b,c,e[15],1236535329,22),d,b,e[1],4129170786,5),b=o(b,c,f,d,e[6],3225465664,9),d=o(d,b,c,f,e[11],643717713,14),f=o(f,d,b,c,e[0],3921069994,20),c=o(c,f,d,b,e[5],3593408605,5),b=o(b,c,f,d,e[10],38016083,9),d=o(d,b,c,f,e[15],3634488961,14),f=o(f,d,b,c,e[4],3889429448,20),c=o(c,f,d,b,e[9],568446438,5),b=o(b,c,f,d,e[14],3275163606,9),d=o(d,b,c,f,e[3],4107603335,14),f=o(f,d,b,c,e[8],1163531501,20),c=o(c,f,d,b,e[13],2850285829,5),b=o(b,c,f,d,e[2],4243563512,9),d=o(d,b,c,f,e[7],1735328473,14),c=s(c,f=o(f,d,b,c,e[12],2368359562,20),d,b,e[5],4294588738,4),b=s(b,c,f,d,e[8],2272392833,11),d=s(d,b,c,f,e[11],1839030562,16),f=s(f,d,b,c,e[14],4259657740,23),c=s(c,f,d,b,e[1],2763975236,4),b=s(b,c,f,d,e[4],1272893353,11),d=s(d,b,c,f,e[7],4139469664,16),f=s(f,d,b,c,e[10],3200236656,23),c=s(c,f,d,b,e[13],681279174,4),b=s(b,c,f,d,e[0],3936430074,11),d=s(d,b,c,f,e[3],3572445317,16),f=s(f,d,b,c,e[6],76029189,23),c=s(c,f,d,b,e[9],3654602809,4),b=s(b,c,f,d,e[12],3873151461,11),d=s(d,b,c,f,e[15],530742520,16),c=l(c,f=s(f,d,b,c,e[2],3299628645,23),d,b,e[0],4096336452,6),b=l(b,c,f,d,e[7],1126891415,10),d=l(d,b,c,f,e[14],2878612391,15),f=l(f,d,b,c,e[5],4237533241,21),c=l(c,f,d,b,e[12],1700485571,6),b=l(b,c,f,d,e[3],2399980690,10),d=l(d,b,c,f,e[10],4293915773,15),f=l(f,d,b,c,e[1],2240044497,21),c=l(c,f,d,b,e[8],1873313359,6),b=l(b,c,f,d,e[15],4264355552,10),d=l(d,b,c,f,e[6],2734768916,15),f=l(f,d,b,c,e[13],1309151649,21),c=l(c,f,d,b,e[4],4149444226,6),b=l(b,c,f,d,e[11],3174756917,10),d=l(d,b,c,f,e[2],718787259,15),f=l(f,d,b,c,e[9],3951481745,21),this._a=this._a+c|0,this._b=this._b+f|0,this._c=this._c+d|0,this._d=this._d+b|0},i.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=b.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=i},3726:(e,a,c)=>{"use strict";var f=c(2861).Buffer,d=c(8399).Transform;function b(e){d.call(this),this._block=f.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}c(6698)(b,d),b.prototype._transform=function(e,a,c){var f=null;try{this.update(e,a)}catch(e){f=e}c(f)},b.prototype._flush=function(e){var a=null;try{this.push(this.digest())}catch(e){a=e}e(a)},b.prototype.update=function(e,a){if(function(e){if(!f.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer")}(e),this._finalized)throw new Error("Digest already called");f.isBuffer(e)||(e=f.from(e,a));for(var c=this._block,d=0;this._blockOffset+e.length-d>=this._blockSize;){for(var b=this._blockOffset;b0;++t)this._length[t]+=i,(i=this._length[t]/4294967296|0)>0&&(this._length[t]-=4294967296*i);return this},b.prototype._update=function(){throw new Error("_update is not implemented")},b.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var a=this._digest();void 0!==e&&(a=a.toString(e)),this._block.fill(0),this._blockOffset=0;for(var c=0;c<4;++c)this._length[c]=0;return a},b.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=b},2244:(e,a,c)=>{var f=c(1158),d=c(5037);function b(e){this.rand=e||new d.Rand}e.exports=b,b.create=function(e){return new b(e)},b.prototype._randbelow=function(e){var a=e.bitLength(),c=Math.ceil(a/8);do{var d=new f(this.rand.generate(c))}while(d.cmp(e)>=0);return d},b.prototype._randrange=function(e,a){var c=a.sub(e);return e.add(this._randbelow(c))},b.prototype.test=function(e,a,c){var d=e.bitLength(),b=f.mont(e),t=new f(1).toRed(b);a||(a=Math.max(1,d/48|0));for(var i=e.subn(1),r=0;!i.testn(r);r++);for(var n=e.shrn(r),o=i.toRed(b);a>0;a--){var s=this._randrange(new f(2),i);c&&c(s);var l=s.toRed(b).redPow(n);if(0!==l.cmp(t)&&0!==l.cmp(o)){for(var h=1;h0;a--){var o=this._randrange(new f(2),t),s=e.gcd(o);if(0!==s.cmpn(1))return s;var l=o.toRed(d).redPow(r);if(0!==l.cmp(b)&&0!==l.cmp(n)){for(var h=1;h=65&&c<=70?c-55:c>=97&&c<=102?c-87:c-48&15}function r(e,a,c){var f=i(e,c);return c-1>=a&&(f|=i(e,c-1)<<4),f}function n(e,a,c,f){for(var d=0,b=Math.min(e.length,c),t=a;t=49?i-49+10:i>=17?i-17+10:i}return d}b.isBN=function(e){return e instanceof b||null!==e&&"object"==typeof e&&e.constructor.wordSize===b.wordSize&&Array.isArray(e.words)},b.max=function(e,a){return e.cmp(a)>0?e:a},b.min=function(e,a){return e.cmp(a)<0?e:a},b.prototype._init=function(e,a,c){if("number"==typeof e)return this._initNumber(e,a,c);if("object"==typeof e)return this._initArray(e,a,c);"hex"===a&&(a=16),f(a===(0|a)&&a>=2&&a<=36);var d=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(d++,this.negative=1),d=0;d-=3)t=e[d]|e[d-1]<<8|e[d-2]<<16,this.words[b]|=t<>>26-i&67108863,(i+=24)>=26&&(i-=26,b++);else if("le"===c)for(d=0,b=0;d>>26-i&67108863,(i+=24)>=26&&(i-=26,b++);return this.strip()},b.prototype._parseHex=function(e,a,c){this.length=Math.ceil((e.length-a)/6),this.words=new Array(this.length);for(var f=0;f=a;f-=2)d=r(e,a,f)<=18?(b-=18,t+=1,this.words[t]|=d>>>26):b+=8;else for(f=(e.length-a)%2==0?a+1:a;f=18?(b-=18,t+=1,this.words[t]|=d>>>26):b+=8;this.strip()},b.prototype._parseBase=function(e,a,c){this.words=[0],this.length=1;for(var f=0,d=1;d<=67108863;d*=a)f++;f--,d=d/a|0;for(var b=e.length-c,t=b%f,i=Math.min(b,b-t)+c,r=0,o=c;o1&&0===this.words[this.length-1];)this.length--;return this._normSign()},b.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},b.prototype.inspect=function(){return(this.red?""};var o=["","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"],s=[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],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function h(e,a,c){c.negative=a.negative^e.negative;var f=e.length+a.length|0;c.length=f,f=f-1|0;var d=0|e.words[0],b=0|a.words[0],t=d*b,i=67108863&t,r=t/67108864|0;c.words[0]=i;for(var n=1;n>>26,s=67108863&r,l=Math.min(n,a.length-1),h=Math.max(0,n-e.length+1);h<=l;h++){var u=n-h|0;o+=(t=(d=0|e.words[u])*(b=0|a.words[h])+s)/67108864|0,s=67108863&t}c.words[n]=0|s,r=0|o}return 0!==r?c.words[n]=0|r:c.length--,c.strip()}b.prototype.toString=function(e,a){var c;if(a=0|a||1,16===(e=e||10)||"hex"===e){c="";for(var d=0,b=0,t=0;t>>24-d&16777215)||t!==this.length-1?o[6-r.length]+r+c:r+c,(d+=2)>=26&&(d-=26,t--)}for(0!==b&&(c=b.toString(16)+c);c.length%a!=0;)c="0"+c;return 0!==this.negative&&(c="-"+c),c}if(e===(0|e)&&e>=2&&e<=36){var n=s[e],h=l[e];c="";var u=this.clone();for(u.negative=0;!u.isZero();){var x=u.modn(h).toString(e);c=(u=u.idivn(h)).isZero()?x+c:o[n-x.length]+x+c}for(this.isZero()&&(c="0"+c);c.length%a!=0;)c="0"+c;return 0!==this.negative&&(c="-"+c),c}f(!1,"Base should be between 2 and 36")},b.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&f(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},b.prototype.toJSON=function(){return this.toString(16)},b.prototype.toBuffer=function(e,a){return f(void 0!==t),this.toArrayLike(t,e,a)},b.prototype.toArray=function(e,a){return this.toArrayLike(Array,e,a)},b.prototype.toArrayLike=function(e,a,c){var d=this.byteLength(),b=c||Math.max(1,d);f(d<=b,"byte array longer than desired length"),f(b>0,"Requested array length <= 0"),this.strip();var t,i,r="le"===a,n=new e(b),o=this.clone();if(r){for(i=0;!o.isZero();i++)t=o.andln(255),o.iushrn(8),n[i]=t;for(;i=4096&&(c+=13,a>>>=13),a>=64&&(c+=7,a>>>=7),a>=8&&(c+=4,a>>>=4),a>=2&&(c+=2,a>>>=2),c+a},b.prototype._zeroBits=function(e){if(0===e)return 26;var a=e,c=0;return 8191&a||(c+=13,a>>>=13),127&a||(c+=7,a>>>=7),15&a||(c+=4,a>>>=4),3&a||(c+=2,a>>>=2),1&a||c++,c},b.prototype.bitLength=function(){var e=this.words[this.length-1],a=this._countBits(e);return 26*(this.length-1)+a},b.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,a=0;ae.length?this.clone().ior(e):e.clone().ior(this)},b.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},b.prototype.iuand=function(e){var a;a=this.length>e.length?e:this;for(var c=0;ce.length?this.clone().iand(e):e.clone().iand(this)},b.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},b.prototype.iuxor=function(e){var a,c;this.length>e.length?(a=this,c=e):(a=e,c=this);for(var f=0;fe.length?this.clone().ixor(e):e.clone().ixor(this)},b.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},b.prototype.inotn=function(e){f("number"==typeof e&&e>=0);var a=0|Math.ceil(e/26),c=e%26;this._expand(a),c>0&&a--;for(var d=0;d0&&(this.words[d]=~this.words[d]&67108863>>26-c),this.strip()},b.prototype.notn=function(e){return this.clone().inotn(e)},b.prototype.setn=function(e,a){f("number"==typeof e&&e>=0);var c=e/26|0,d=e%26;return this._expand(c+1),this.words[c]=a?this.words[c]|1<e.length?(c=this,f=e):(c=e,f=this);for(var d=0,b=0;b>>26;for(;0!==d&&b>>26;if(this.length=c.length,0!==d)this.words[this.length]=d,this.length++;else if(c!==this)for(;be.length?this.clone().iadd(e):e.clone().iadd(this)},b.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var a=this.iadd(e);return e.negative=1,a._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var c,f,d=this.cmp(e);if(0===d)return this.negative=0,this.length=1,this.words[0]=0,this;d>0?(c=this,f=e):(c=e,f=this);for(var b=0,t=0;t>26,this.words[t]=67108863&a;for(;0!==b&&t>26,this.words[t]=67108863&a;if(0===b&&t>>13,h=0|t[1],u=8191&h,x=h>>>13,p=0|t[2],g=8191&p,m=p>>>13,y=0|t[3],_=8191&y,v=y>>>13,w=0|t[4],M=8191&w,A=w>>>13,L=0|t[5],I=8191&L,k=L>>>13,E=0|t[6],S=8191&E,C=E>>>13,B=0|t[7],F=8191&B,O=B>>>13,P=0|t[8],R=8191&P,T=P>>>13,U=0|t[9],j=8191&U,N=U>>>13,q=0|i[0],D=8191&q,z=q>>>13,Q=0|i[1],G=8191&Q,K=Q>>>13,H=0|i[2],V=8191&H,Z=H>>>13,W=0|i[3],Y=8191&W,J=W>>>13,$=0|i[4],X=8191&$,ee=$>>>13,ae=0|i[5],ce=8191&ae,fe=ae>>>13,de=0|i[6],be=8191&de,te=de>>>13,ie=0|i[7],re=8191&ie,ne=ie>>>13,oe=0|i[8],se=8191&oe,le=oe>>>13,he=0|i[9],ue=8191&he,xe=he>>>13;c.negative=e.negative^a.negative,c.length=19;var pe=(n+(f=Math.imul(s,D))|0)+((8191&(d=(d=Math.imul(s,z))+Math.imul(l,D)|0))<<13)|0;n=((b=Math.imul(l,z))+(d>>>13)|0)+(pe>>>26)|0,pe&=67108863,f=Math.imul(u,D),d=(d=Math.imul(u,z))+Math.imul(x,D)|0,b=Math.imul(x,z);var ge=(n+(f=f+Math.imul(s,G)|0)|0)+((8191&(d=(d=d+Math.imul(s,K)|0)+Math.imul(l,G)|0))<<13)|0;n=((b=b+Math.imul(l,K)|0)+(d>>>13)|0)+(ge>>>26)|0,ge&=67108863,f=Math.imul(g,D),d=(d=Math.imul(g,z))+Math.imul(m,D)|0,b=Math.imul(m,z),f=f+Math.imul(u,G)|0,d=(d=d+Math.imul(u,K)|0)+Math.imul(x,G)|0,b=b+Math.imul(x,K)|0;var me=(n+(f=f+Math.imul(s,V)|0)|0)+((8191&(d=(d=d+Math.imul(s,Z)|0)+Math.imul(l,V)|0))<<13)|0;n=((b=b+Math.imul(l,Z)|0)+(d>>>13)|0)+(me>>>26)|0,me&=67108863,f=Math.imul(_,D),d=(d=Math.imul(_,z))+Math.imul(v,D)|0,b=Math.imul(v,z),f=f+Math.imul(g,G)|0,d=(d=d+Math.imul(g,K)|0)+Math.imul(m,G)|0,b=b+Math.imul(m,K)|0,f=f+Math.imul(u,V)|0,d=(d=d+Math.imul(u,Z)|0)+Math.imul(x,V)|0,b=b+Math.imul(x,Z)|0;var ye=(n+(f=f+Math.imul(s,Y)|0)|0)+((8191&(d=(d=d+Math.imul(s,J)|0)+Math.imul(l,Y)|0))<<13)|0;n=((b=b+Math.imul(l,J)|0)+(d>>>13)|0)+(ye>>>26)|0,ye&=67108863,f=Math.imul(M,D),d=(d=Math.imul(M,z))+Math.imul(A,D)|0,b=Math.imul(A,z),f=f+Math.imul(_,G)|0,d=(d=d+Math.imul(_,K)|0)+Math.imul(v,G)|0,b=b+Math.imul(v,K)|0,f=f+Math.imul(g,V)|0,d=(d=d+Math.imul(g,Z)|0)+Math.imul(m,V)|0,b=b+Math.imul(m,Z)|0,f=f+Math.imul(u,Y)|0,d=(d=d+Math.imul(u,J)|0)+Math.imul(x,Y)|0,b=b+Math.imul(x,J)|0;var _e=(n+(f=f+Math.imul(s,X)|0)|0)+((8191&(d=(d=d+Math.imul(s,ee)|0)+Math.imul(l,X)|0))<<13)|0;n=((b=b+Math.imul(l,ee)|0)+(d>>>13)|0)+(_e>>>26)|0,_e&=67108863,f=Math.imul(I,D),d=(d=Math.imul(I,z))+Math.imul(k,D)|0,b=Math.imul(k,z),f=f+Math.imul(M,G)|0,d=(d=d+Math.imul(M,K)|0)+Math.imul(A,G)|0,b=b+Math.imul(A,K)|0,f=f+Math.imul(_,V)|0,d=(d=d+Math.imul(_,Z)|0)+Math.imul(v,V)|0,b=b+Math.imul(v,Z)|0,f=f+Math.imul(g,Y)|0,d=(d=d+Math.imul(g,J)|0)+Math.imul(m,Y)|0,b=b+Math.imul(m,J)|0,f=f+Math.imul(u,X)|0,d=(d=d+Math.imul(u,ee)|0)+Math.imul(x,X)|0,b=b+Math.imul(x,ee)|0;var ve=(n+(f=f+Math.imul(s,ce)|0)|0)+((8191&(d=(d=d+Math.imul(s,fe)|0)+Math.imul(l,ce)|0))<<13)|0;n=((b=b+Math.imul(l,fe)|0)+(d>>>13)|0)+(ve>>>26)|0,ve&=67108863,f=Math.imul(S,D),d=(d=Math.imul(S,z))+Math.imul(C,D)|0,b=Math.imul(C,z),f=f+Math.imul(I,G)|0,d=(d=d+Math.imul(I,K)|0)+Math.imul(k,G)|0,b=b+Math.imul(k,K)|0,f=f+Math.imul(M,V)|0,d=(d=d+Math.imul(M,Z)|0)+Math.imul(A,V)|0,b=b+Math.imul(A,Z)|0,f=f+Math.imul(_,Y)|0,d=(d=d+Math.imul(_,J)|0)+Math.imul(v,Y)|0,b=b+Math.imul(v,J)|0,f=f+Math.imul(g,X)|0,d=(d=d+Math.imul(g,ee)|0)+Math.imul(m,X)|0,b=b+Math.imul(m,ee)|0,f=f+Math.imul(u,ce)|0,d=(d=d+Math.imul(u,fe)|0)+Math.imul(x,ce)|0,b=b+Math.imul(x,fe)|0;var we=(n+(f=f+Math.imul(s,be)|0)|0)+((8191&(d=(d=d+Math.imul(s,te)|0)+Math.imul(l,be)|0))<<13)|0;n=((b=b+Math.imul(l,te)|0)+(d>>>13)|0)+(we>>>26)|0,we&=67108863,f=Math.imul(F,D),d=(d=Math.imul(F,z))+Math.imul(O,D)|0,b=Math.imul(O,z),f=f+Math.imul(S,G)|0,d=(d=d+Math.imul(S,K)|0)+Math.imul(C,G)|0,b=b+Math.imul(C,K)|0,f=f+Math.imul(I,V)|0,d=(d=d+Math.imul(I,Z)|0)+Math.imul(k,V)|0,b=b+Math.imul(k,Z)|0,f=f+Math.imul(M,Y)|0,d=(d=d+Math.imul(M,J)|0)+Math.imul(A,Y)|0,b=b+Math.imul(A,J)|0,f=f+Math.imul(_,X)|0,d=(d=d+Math.imul(_,ee)|0)+Math.imul(v,X)|0,b=b+Math.imul(v,ee)|0,f=f+Math.imul(g,ce)|0,d=(d=d+Math.imul(g,fe)|0)+Math.imul(m,ce)|0,b=b+Math.imul(m,fe)|0,f=f+Math.imul(u,be)|0,d=(d=d+Math.imul(u,te)|0)+Math.imul(x,be)|0,b=b+Math.imul(x,te)|0;var Me=(n+(f=f+Math.imul(s,re)|0)|0)+((8191&(d=(d=d+Math.imul(s,ne)|0)+Math.imul(l,re)|0))<<13)|0;n=((b=b+Math.imul(l,ne)|0)+(d>>>13)|0)+(Me>>>26)|0,Me&=67108863,f=Math.imul(R,D),d=(d=Math.imul(R,z))+Math.imul(T,D)|0,b=Math.imul(T,z),f=f+Math.imul(F,G)|0,d=(d=d+Math.imul(F,K)|0)+Math.imul(O,G)|0,b=b+Math.imul(O,K)|0,f=f+Math.imul(S,V)|0,d=(d=d+Math.imul(S,Z)|0)+Math.imul(C,V)|0,b=b+Math.imul(C,Z)|0,f=f+Math.imul(I,Y)|0,d=(d=d+Math.imul(I,J)|0)+Math.imul(k,Y)|0,b=b+Math.imul(k,J)|0,f=f+Math.imul(M,X)|0,d=(d=d+Math.imul(M,ee)|0)+Math.imul(A,X)|0,b=b+Math.imul(A,ee)|0,f=f+Math.imul(_,ce)|0,d=(d=d+Math.imul(_,fe)|0)+Math.imul(v,ce)|0,b=b+Math.imul(v,fe)|0,f=f+Math.imul(g,be)|0,d=(d=d+Math.imul(g,te)|0)+Math.imul(m,be)|0,b=b+Math.imul(m,te)|0,f=f+Math.imul(u,re)|0,d=(d=d+Math.imul(u,ne)|0)+Math.imul(x,re)|0,b=b+Math.imul(x,ne)|0;var Ae=(n+(f=f+Math.imul(s,se)|0)|0)+((8191&(d=(d=d+Math.imul(s,le)|0)+Math.imul(l,se)|0))<<13)|0;n=((b=b+Math.imul(l,le)|0)+(d>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,f=Math.imul(j,D),d=(d=Math.imul(j,z))+Math.imul(N,D)|0,b=Math.imul(N,z),f=f+Math.imul(R,G)|0,d=(d=d+Math.imul(R,K)|0)+Math.imul(T,G)|0,b=b+Math.imul(T,K)|0,f=f+Math.imul(F,V)|0,d=(d=d+Math.imul(F,Z)|0)+Math.imul(O,V)|0,b=b+Math.imul(O,Z)|0,f=f+Math.imul(S,Y)|0,d=(d=d+Math.imul(S,J)|0)+Math.imul(C,Y)|0,b=b+Math.imul(C,J)|0,f=f+Math.imul(I,X)|0,d=(d=d+Math.imul(I,ee)|0)+Math.imul(k,X)|0,b=b+Math.imul(k,ee)|0,f=f+Math.imul(M,ce)|0,d=(d=d+Math.imul(M,fe)|0)+Math.imul(A,ce)|0,b=b+Math.imul(A,fe)|0,f=f+Math.imul(_,be)|0,d=(d=d+Math.imul(_,te)|0)+Math.imul(v,be)|0,b=b+Math.imul(v,te)|0,f=f+Math.imul(g,re)|0,d=(d=d+Math.imul(g,ne)|0)+Math.imul(m,re)|0,b=b+Math.imul(m,ne)|0,f=f+Math.imul(u,se)|0,d=(d=d+Math.imul(u,le)|0)+Math.imul(x,se)|0,b=b+Math.imul(x,le)|0;var Le=(n+(f=f+Math.imul(s,ue)|0)|0)+((8191&(d=(d=d+Math.imul(s,xe)|0)+Math.imul(l,ue)|0))<<13)|0;n=((b=b+Math.imul(l,xe)|0)+(d>>>13)|0)+(Le>>>26)|0,Le&=67108863,f=Math.imul(j,G),d=(d=Math.imul(j,K))+Math.imul(N,G)|0,b=Math.imul(N,K),f=f+Math.imul(R,V)|0,d=(d=d+Math.imul(R,Z)|0)+Math.imul(T,V)|0,b=b+Math.imul(T,Z)|0,f=f+Math.imul(F,Y)|0,d=(d=d+Math.imul(F,J)|0)+Math.imul(O,Y)|0,b=b+Math.imul(O,J)|0,f=f+Math.imul(S,X)|0,d=(d=d+Math.imul(S,ee)|0)+Math.imul(C,X)|0,b=b+Math.imul(C,ee)|0,f=f+Math.imul(I,ce)|0,d=(d=d+Math.imul(I,fe)|0)+Math.imul(k,ce)|0,b=b+Math.imul(k,fe)|0,f=f+Math.imul(M,be)|0,d=(d=d+Math.imul(M,te)|0)+Math.imul(A,be)|0,b=b+Math.imul(A,te)|0,f=f+Math.imul(_,re)|0,d=(d=d+Math.imul(_,ne)|0)+Math.imul(v,re)|0,b=b+Math.imul(v,ne)|0,f=f+Math.imul(g,se)|0,d=(d=d+Math.imul(g,le)|0)+Math.imul(m,se)|0,b=b+Math.imul(m,le)|0;var Ie=(n+(f=f+Math.imul(u,ue)|0)|0)+((8191&(d=(d=d+Math.imul(u,xe)|0)+Math.imul(x,ue)|0))<<13)|0;n=((b=b+Math.imul(x,xe)|0)+(d>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,f=Math.imul(j,V),d=(d=Math.imul(j,Z))+Math.imul(N,V)|0,b=Math.imul(N,Z),f=f+Math.imul(R,Y)|0,d=(d=d+Math.imul(R,J)|0)+Math.imul(T,Y)|0,b=b+Math.imul(T,J)|0,f=f+Math.imul(F,X)|0,d=(d=d+Math.imul(F,ee)|0)+Math.imul(O,X)|0,b=b+Math.imul(O,ee)|0,f=f+Math.imul(S,ce)|0,d=(d=d+Math.imul(S,fe)|0)+Math.imul(C,ce)|0,b=b+Math.imul(C,fe)|0,f=f+Math.imul(I,be)|0,d=(d=d+Math.imul(I,te)|0)+Math.imul(k,be)|0,b=b+Math.imul(k,te)|0,f=f+Math.imul(M,re)|0,d=(d=d+Math.imul(M,ne)|0)+Math.imul(A,re)|0,b=b+Math.imul(A,ne)|0,f=f+Math.imul(_,se)|0,d=(d=d+Math.imul(_,le)|0)+Math.imul(v,se)|0,b=b+Math.imul(v,le)|0;var ke=(n+(f=f+Math.imul(g,ue)|0)|0)+((8191&(d=(d=d+Math.imul(g,xe)|0)+Math.imul(m,ue)|0))<<13)|0;n=((b=b+Math.imul(m,xe)|0)+(d>>>13)|0)+(ke>>>26)|0,ke&=67108863,f=Math.imul(j,Y),d=(d=Math.imul(j,J))+Math.imul(N,Y)|0,b=Math.imul(N,J),f=f+Math.imul(R,X)|0,d=(d=d+Math.imul(R,ee)|0)+Math.imul(T,X)|0,b=b+Math.imul(T,ee)|0,f=f+Math.imul(F,ce)|0,d=(d=d+Math.imul(F,fe)|0)+Math.imul(O,ce)|0,b=b+Math.imul(O,fe)|0,f=f+Math.imul(S,be)|0,d=(d=d+Math.imul(S,te)|0)+Math.imul(C,be)|0,b=b+Math.imul(C,te)|0,f=f+Math.imul(I,re)|0,d=(d=d+Math.imul(I,ne)|0)+Math.imul(k,re)|0,b=b+Math.imul(k,ne)|0,f=f+Math.imul(M,se)|0,d=(d=d+Math.imul(M,le)|0)+Math.imul(A,se)|0,b=b+Math.imul(A,le)|0;var Ee=(n+(f=f+Math.imul(_,ue)|0)|0)+((8191&(d=(d=d+Math.imul(_,xe)|0)+Math.imul(v,ue)|0))<<13)|0;n=((b=b+Math.imul(v,xe)|0)+(d>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,f=Math.imul(j,X),d=(d=Math.imul(j,ee))+Math.imul(N,X)|0,b=Math.imul(N,ee),f=f+Math.imul(R,ce)|0,d=(d=d+Math.imul(R,fe)|0)+Math.imul(T,ce)|0,b=b+Math.imul(T,fe)|0,f=f+Math.imul(F,be)|0,d=(d=d+Math.imul(F,te)|0)+Math.imul(O,be)|0,b=b+Math.imul(O,te)|0,f=f+Math.imul(S,re)|0,d=(d=d+Math.imul(S,ne)|0)+Math.imul(C,re)|0,b=b+Math.imul(C,ne)|0,f=f+Math.imul(I,se)|0,d=(d=d+Math.imul(I,le)|0)+Math.imul(k,se)|0,b=b+Math.imul(k,le)|0;var Se=(n+(f=f+Math.imul(M,ue)|0)|0)+((8191&(d=(d=d+Math.imul(M,xe)|0)+Math.imul(A,ue)|0))<<13)|0;n=((b=b+Math.imul(A,xe)|0)+(d>>>13)|0)+(Se>>>26)|0,Se&=67108863,f=Math.imul(j,ce),d=(d=Math.imul(j,fe))+Math.imul(N,ce)|0,b=Math.imul(N,fe),f=f+Math.imul(R,be)|0,d=(d=d+Math.imul(R,te)|0)+Math.imul(T,be)|0,b=b+Math.imul(T,te)|0,f=f+Math.imul(F,re)|0,d=(d=d+Math.imul(F,ne)|0)+Math.imul(O,re)|0,b=b+Math.imul(O,ne)|0,f=f+Math.imul(S,se)|0,d=(d=d+Math.imul(S,le)|0)+Math.imul(C,se)|0,b=b+Math.imul(C,le)|0;var Ce=(n+(f=f+Math.imul(I,ue)|0)|0)+((8191&(d=(d=d+Math.imul(I,xe)|0)+Math.imul(k,ue)|0))<<13)|0;n=((b=b+Math.imul(k,xe)|0)+(d>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,f=Math.imul(j,be),d=(d=Math.imul(j,te))+Math.imul(N,be)|0,b=Math.imul(N,te),f=f+Math.imul(R,re)|0,d=(d=d+Math.imul(R,ne)|0)+Math.imul(T,re)|0,b=b+Math.imul(T,ne)|0,f=f+Math.imul(F,se)|0,d=(d=d+Math.imul(F,le)|0)+Math.imul(O,se)|0,b=b+Math.imul(O,le)|0;var Be=(n+(f=f+Math.imul(S,ue)|0)|0)+((8191&(d=(d=d+Math.imul(S,xe)|0)+Math.imul(C,ue)|0))<<13)|0;n=((b=b+Math.imul(C,xe)|0)+(d>>>13)|0)+(Be>>>26)|0,Be&=67108863,f=Math.imul(j,re),d=(d=Math.imul(j,ne))+Math.imul(N,re)|0,b=Math.imul(N,ne),f=f+Math.imul(R,se)|0,d=(d=d+Math.imul(R,le)|0)+Math.imul(T,se)|0,b=b+Math.imul(T,le)|0;var Fe=(n+(f=f+Math.imul(F,ue)|0)|0)+((8191&(d=(d=d+Math.imul(F,xe)|0)+Math.imul(O,ue)|0))<<13)|0;n=((b=b+Math.imul(O,xe)|0)+(d>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,f=Math.imul(j,se),d=(d=Math.imul(j,le))+Math.imul(N,se)|0,b=Math.imul(N,le);var Oe=(n+(f=f+Math.imul(R,ue)|0)|0)+((8191&(d=(d=d+Math.imul(R,xe)|0)+Math.imul(T,ue)|0))<<13)|0;n=((b=b+Math.imul(T,xe)|0)+(d>>>13)|0)+(Oe>>>26)|0,Oe&=67108863;var Pe=(n+(f=Math.imul(j,ue))|0)+((8191&(d=(d=Math.imul(j,xe))+Math.imul(N,ue)|0))<<13)|0;return n=((b=Math.imul(N,xe))+(d>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r[0]=pe,r[1]=ge,r[2]=me,r[3]=ye,r[4]=_e,r[5]=ve,r[6]=we,r[7]=Me,r[8]=Ae,r[9]=Le,r[10]=Ie,r[11]=ke,r[12]=Ee,r[13]=Se,r[14]=Ce,r[15]=Be,r[16]=Fe,r[17]=Oe,r[18]=Pe,0!==n&&(r[19]=n,c.length++),c};function x(e,a,c){return(new p).mulp(e,a,c)}function p(e,a){this.x=e,this.y=a}Math.imul||(u=h),b.prototype.mulTo=function(e,a){var c,f=this.length+e.length;return c=10===this.length&&10===e.length?u(this,e,a):f<63?h(this,e,a):f<1024?function(e,a,c){c.negative=a.negative^e.negative,c.length=e.length+a.length;for(var f=0,d=0,b=0;b>>26)|0)>>>26,t&=67108863}c.words[b]=i,f=t,t=d}return 0!==f?c.words[b]=f:c.length--,c.strip()}(this,e,a):x(this,e,a),c},p.prototype.makeRBT=function(e){for(var a=new Array(e),c=b.prototype._countBits(e)-1,f=0;f>=1;return f},p.prototype.permute=function(e,a,c,f,d,b){for(var t=0;t>>=1)d++;return 1<>>=13,c[2*t+1]=8191&b,b>>>=13;for(t=2*a;t>=26,a+=d/67108864|0,a+=b>>>26,this.words[c]=67108863&b}return 0!==a&&(this.words[c]=a,this.length++),this},b.prototype.muln=function(e){return this.clone().imuln(e)},b.prototype.sqr=function(){return this.mul(this)},b.prototype.isqr=function(){return this.imul(this.clone())},b.prototype.pow=function(e){var a=function(e){for(var a=new Array(e.bitLength()),c=0;c>>d}return a}(e);if(0===a.length)return new b(1);for(var c=this,f=0;f=0);var a,c=e%26,d=(e-c)/26,b=67108863>>>26-c<<26-c;if(0!==c){var t=0;for(a=0;a>>26-c}t&&(this.words[a]=t,this.length++)}if(0!==d){for(a=this.length-1;a>=0;a--)this.words[a+d]=this.words[a];for(a=0;a=0),d=a?(a-a%26)/26:0;var b=e%26,t=Math.min((e-b)/26,this.length),i=67108863^67108863>>>b<t)for(this.length-=t,n=0;n=0&&(0!==o||n>=d);n--){var s=0|this.words[n];this.words[n]=o<<26-b|s>>>b,o=s&i}return r&&0!==o&&(r.words[r.length++]=o),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},b.prototype.ishrn=function(e,a,c){return f(0===this.negative),this.iushrn(e,a,c)},b.prototype.shln=function(e){return this.clone().ishln(e)},b.prototype.ushln=function(e){return this.clone().iushln(e)},b.prototype.shrn=function(e){return this.clone().ishrn(e)},b.prototype.ushrn=function(e){return this.clone().iushrn(e)},b.prototype.testn=function(e){f("number"==typeof e&&e>=0);var a=e%26,c=(e-a)/26,d=1<=0);var a=e%26,c=(e-a)/26;if(f(0===this.negative,"imaskn works only with positive numbers"),this.length<=c)return this;if(0!==a&&c++,this.length=Math.min(c,this.length),0!==a){var d=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},b.prototype.isubn=function(e){if(f("number"==typeof e),f(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(r/67108864|0),this.words[d+c]=67108863&b}for(;d>26,this.words[d+c]=67108863&b;if(0===i)return this.strip();for(f(-1===i),i=0,d=0;d>26,this.words[d]=67108863&b;return this.negative=1,this.strip()},b.prototype._wordDiv=function(e,a){var c=(this.length,e.length),f=this.clone(),d=e,t=0|d.words[d.length-1];0!=(c=26-this._countBits(t))&&(d=d.ushln(c),f.iushln(c),t=0|d.words[d.length-1]);var i,r=f.length-d.length;if("mod"!==a){(i=new b(null)).length=r+1,i.words=new Array(i.length);for(var n=0;n=0;s--){var l=67108864*(0|f.words[d.length+s])+(0|f.words[d.length+s-1]);for(l=Math.min(l/t|0,67108863),f._ishlnsubmul(d,l,s);0!==f.negative;)l--,f.negative=0,f._ishlnsubmul(d,1,s),f.isZero()||(f.negative^=1);i&&(i.words[s]=l)}return i&&i.strip(),f.strip(),"div"!==a&&0!==c&&f.iushrn(c),{div:i||null,mod:f}},b.prototype.divmod=function(e,a,c){return f(!e.isZero()),this.isZero()?{div:new b(0),mod:new b(0)}:0!==this.negative&&0===e.negative?(i=this.neg().divmod(e,a),"mod"!==a&&(d=i.div.neg()),"div"!==a&&(t=i.mod.neg(),c&&0!==t.negative&&t.iadd(e)),{div:d,mod:t}):0===this.negative&&0!==e.negative?(i=this.divmod(e.neg(),a),"mod"!==a&&(d=i.div.neg()),{div:d,mod:i.mod}):this.negative&e.negative?(i=this.neg().divmod(e.neg(),a),"div"!==a&&(t=i.mod.neg(),c&&0!==t.negative&&t.isub(e)),{div:i.div,mod:t}):e.length>this.length||this.cmp(e)<0?{div:new b(0),mod:this}:1===e.length?"div"===a?{div:this.divn(e.words[0]),mod:null}:"mod"===a?{div:null,mod:new b(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new b(this.modn(e.words[0]))}:this._wordDiv(e,a);var d,t,i},b.prototype.div=function(e){return this.divmod(e,"div",!1).div},b.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},b.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},b.prototype.divRound=function(e){var a=this.divmod(e);if(a.mod.isZero())return a.div;var c=0!==a.div.negative?a.mod.isub(e):a.mod,f=e.ushrn(1),d=e.andln(1),b=c.cmp(f);return b<0||1===d&&0===b?a.div:0!==a.div.negative?a.div.isubn(1):a.div.iaddn(1)},b.prototype.modn=function(e){f(e<=67108863);for(var a=(1<<26)%e,c=0,d=this.length-1;d>=0;d--)c=(a*c+(0|this.words[d]))%e;return c},b.prototype.idivn=function(e){f(e<=67108863);for(var a=0,c=this.length-1;c>=0;c--){var d=(0|this.words[c])+67108864*a;this.words[c]=d/e|0,a=d%e}return this.strip()},b.prototype.divn=function(e){return this.clone().idivn(e)},b.prototype.egcd=function(e){f(0===e.negative),f(!e.isZero());var a=this,c=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var d=new b(1),t=new b(0),i=new b(0),r=new b(1),n=0;a.isEven()&&c.isEven();)a.iushrn(1),c.iushrn(1),++n;for(var o=c.clone(),s=a.clone();!a.isZero();){for(var l=0,h=1;!(a.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(a.iushrn(l);l-- >0;)(d.isOdd()||t.isOdd())&&(d.iadd(o),t.isub(s)),d.iushrn(1),t.iushrn(1);for(var u=0,x=1;!(c.words[0]&x)&&u<26;++u,x<<=1);if(u>0)for(c.iushrn(u);u-- >0;)(i.isOdd()||r.isOdd())&&(i.iadd(o),r.isub(s)),i.iushrn(1),r.iushrn(1);a.cmp(c)>=0?(a.isub(c),d.isub(i),t.isub(r)):(c.isub(a),i.isub(d),r.isub(t))}return{a:i,b:r,gcd:c.iushln(n)}},b.prototype._invmp=function(e){f(0===e.negative),f(!e.isZero());var a=this,c=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var d,t=new b(1),i=new b(0),r=c.clone();a.cmpn(1)>0&&c.cmpn(1)>0;){for(var n=0,o=1;!(a.words[0]&o)&&n<26;++n,o<<=1);if(n>0)for(a.iushrn(n);n-- >0;)t.isOdd()&&t.iadd(r),t.iushrn(1);for(var s=0,l=1;!(c.words[0]&l)&&s<26;++s,l<<=1);if(s>0)for(c.iushrn(s);s-- >0;)i.isOdd()&&i.iadd(r),i.iushrn(1);a.cmp(c)>=0?(a.isub(c),t.isub(i)):(c.isub(a),i.isub(t))}return(d=0===a.cmpn(1)?t:i).cmpn(0)<0&&d.iadd(e),d},b.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var a=this.clone(),c=e.clone();a.negative=0,c.negative=0;for(var f=0;a.isEven()&&c.isEven();f++)a.iushrn(1),c.iushrn(1);for(;;){for(;a.isEven();)a.iushrn(1);for(;c.isEven();)c.iushrn(1);var d=a.cmp(c);if(d<0){var b=a;a=c,c=b}else if(0===d||0===c.cmpn(1))break;a.isub(c)}return c.iushln(f)},b.prototype.invm=function(e){return this.egcd(e).a.umod(e)},b.prototype.isEven=function(){return!(1&this.words[0])},b.prototype.isOdd=function(){return!(1&~this.words[0])},b.prototype.andln=function(e){return this.words[0]&e},b.prototype.bincn=function(e){f("number"==typeof e);var a=e%26,c=(e-a)/26,d=1<>>26,i&=67108863,this.words[t]=i}return 0!==b&&(this.words[t]=b,this.length++),this},b.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},b.prototype.cmpn=function(e){var a,c=e<0;if(0!==this.negative&&!c)return-1;if(0===this.negative&&c)return 1;if(this.strip(),this.length>1)a=1;else{c&&(e=-e),f(e<=67108863,"Number is too big");var d=0|this.words[0];a=d===e?0:de.length)return 1;if(this.length=0;c--){var f=0|this.words[c],d=0|e.words[c];if(f!==d){fd&&(a=1);break}}return a},b.prototype.gtn=function(e){return 1===this.cmpn(e)},b.prototype.gt=function(e){return 1===this.cmp(e)},b.prototype.gten=function(e){return this.cmpn(e)>=0},b.prototype.gte=function(e){return this.cmp(e)>=0},b.prototype.ltn=function(e){return-1===this.cmpn(e)},b.prototype.lt=function(e){return-1===this.cmp(e)},b.prototype.lten=function(e){return this.cmpn(e)<=0},b.prototype.lte=function(e){return this.cmp(e)<=0},b.prototype.eqn=function(e){return 0===this.cmpn(e)},b.prototype.eq=function(e){return 0===this.cmp(e)},b.red=function(e){return new M(e)},b.prototype.toRed=function(e){return f(!this.red,"Already a number in reduction context"),f(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},b.prototype.fromRed=function(){return f(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},b.prototype._forceRed=function(e){return this.red=e,this},b.prototype.forceRed=function(e){return f(!this.red,"Already a number in reduction context"),this._forceRed(e)},b.prototype.redAdd=function(e){return f(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},b.prototype.redIAdd=function(e){return f(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},b.prototype.redSub=function(e){return f(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},b.prototype.redISub=function(e){return f(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},b.prototype.redShl=function(e){return f(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},b.prototype.redMul=function(e){return f(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},b.prototype.redIMul=function(e){return f(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},b.prototype.redSqr=function(){return f(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},b.prototype.redISqr=function(){return f(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},b.prototype.redSqrt=function(){return f(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},b.prototype.redInvm=function(){return f(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},b.prototype.redNeg=function(){return f(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},b.prototype.redPow=function(e){return f(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function m(e,a){this.name=e,this.p=new b(a,16),this.n=this.p.bitLength(),this.k=new b(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(e){if("string"==typeof e){var a=b._prime(e);this.m=a.p,this.prime=a}else f(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function A(e){M.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new b(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)}m.prototype._tmp=function(){var e=new b(null);return e.words=new Array(Math.ceil(this.n/13)),e},m.prototype.ireduce=function(e){var a,c=e;do{this.split(c,this.tmp),a=(c=(c=this.imulK(c)).iadd(this.tmp)).bitLength()}while(a>this.n);var f=a0?c.isub(this.p):void 0!==c.strip?c.strip():c._strip(),c},m.prototype.split=function(e,a){e.iushrn(this.n,0,a)},m.prototype.imulK=function(e){return e.imul(this.k)},d(y,m),y.prototype.split=function(e,a){for(var c=4194303,f=Math.min(e.length,9),d=0;d>>22,b=t}b>>>=22,e.words[d-10]=b,0===b&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var a=0,c=0;c>>=26,e.words[c]=d,a=f}return 0!==a&&(e.words[e.length++]=a),e},b._prime=function(e){if(g[e])return g[e];var a;if("k256"===e)a=new y;else if("p224"===e)a=new _;else if("p192"===e)a=new v;else{if("p25519"!==e)throw new Error("Unknown prime "+e);a=new w}return g[e]=a,a},M.prototype._verify1=function(e){f(0===e.negative,"red works only with positives"),f(e.red,"red works only with red numbers")},M.prototype._verify2=function(e,a){f(!(e.negative|a.negative),"red works only with positives"),f(e.red&&e.red===a.red,"red works only with red numbers")},M.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},M.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},M.prototype.add=function(e,a){this._verify2(e,a);var c=e.add(a);return c.cmp(this.m)>=0&&c.isub(this.m),c._forceRed(this)},M.prototype.iadd=function(e,a){this._verify2(e,a);var c=e.iadd(a);return c.cmp(this.m)>=0&&c.isub(this.m),c},M.prototype.sub=function(e,a){this._verify2(e,a);var c=e.sub(a);return c.cmpn(0)<0&&c.iadd(this.m),c._forceRed(this)},M.prototype.isub=function(e,a){this._verify2(e,a);var c=e.isub(a);return c.cmpn(0)<0&&c.iadd(this.m),c},M.prototype.shl=function(e,a){return this._verify1(e),this.imod(e.ushln(a))},M.prototype.imul=function(e,a){return this._verify2(e,a),this.imod(e.imul(a))},M.prototype.mul=function(e,a){return this._verify2(e,a),this.imod(e.mul(a))},M.prototype.isqr=function(e){return this.imul(e,e.clone())},M.prototype.sqr=function(e){return this.mul(e,e)},M.prototype.sqrt=function(e){if(e.isZero())return e.clone();var a=this.m.andln(3);if(f(a%2==1),3===a){var c=this.m.add(new b(1)).iushrn(2);return this.pow(e,c)}for(var d=this.m.subn(1),t=0;!d.isZero()&&0===d.andln(1);)t++,d.iushrn(1);f(!d.isZero());var i=new b(1).toRed(this),r=i.redNeg(),n=this.m.subn(1).iushrn(1),o=this.m.bitLength();for(o=new b(2*o*o).toRed(this);0!==this.pow(o,n).cmp(r);)o.redIAdd(r);for(var s=this.pow(o,d),l=this.pow(e,d.addn(1).iushrn(1)),h=this.pow(e,d),u=t;0!==h.cmp(i);){for(var x=h,p=0;0!==x.cmp(i);p++)x=x.redSqr();f(p=0;f--){for(var n=a.words[f],o=r-1;o>=0;o--){var s=n>>o&1;d!==c[0]&&(d=this.sqr(d)),0!==s||0!==t?(t<<=1,t|=s,(4==++i||0===f&&0===o)&&(d=this.mul(d,c[t]),i=0,t=0)):i=0}r=26}return d},M.prototype.convertTo=function(e){var a=e.umod(this.m);return a===e?a.clone():a},M.prototype.convertFrom=function(e){var a=e.clone();return a.red=null,a},b.mont=function(e){return new A(e)},d(A,M),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var a=this.imod(e.mul(this.rinv));return a.red=null,a},A.prototype.imul=function(e,a){if(e.isZero()||a.isZero())return e.words[0]=0,e.length=1,e;var c=e.imul(a),f=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),d=c.isub(f).iushrn(this.shift),b=d;return d.cmp(this.m)>=0?b=d.isub(this.m):d.cmpn(0)<0&&(b=d.iadd(this.m)),b._forceRed(this)},A.prototype.mul=function(e,a){if(e.isZero()||a.isZero())return new b(0)._forceRed(this);var c=e.mul(a),f=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),d=c.isub(f).iushrn(this.shift),t=d;return d.cmp(this.m)>=0?t=d.isub(this.m):d.cmpn(0)<0&&(t=d.iadd(this.m)),t._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=c.nmd(e),this)},3349:e=>{function a(e,a){if(!e)throw new Error(a||"Assertion failed")}e.exports=a,a.equal=function(e,a,c){if(e!=a)throw new Error(c||"Assertion failed: "+e+" != "+a)}},4367:(e,a)=>{"use strict";var c=a;function f(e){return 1===e.length?"0"+e:e}function d(e){for(var a="",c=0;c>8,t=255&d;b?c.push(b,t):c.push(t)}return c},c.zero2=f,c.toHex=d,c.encode=function(e,a){return"hex"===a?d(e):e}},8633:(e,a,c)=>{"use strict";const{encodeText:f}=c(4084);e.exports=class{constructor(e,a,c,d){this.name=e,this.code=a,this.codeBuf=f(this.code),this.alphabet=d,this.codec=c(d)}encode(e){return this.codec.encode(e)}decode(e){for(const a of e)if(this.alphabet&&this.alphabet.indexOf(a)<0)throw new Error(`invalid character '${a}' in '${e}'`);return this.codec.decode(e)}}},7579:(e,a,c)=>{"use strict";const f=c(5084),d=c(8633),{rfc4648:b}=c(9417),{decodeText:t,encodeText:i}=c(4084),r=[["identity","\0",()=>({encode:t,decode:i}),""],["base2","0",b(1),"01"],["base8","7",b(3),"01234567"],["base10","9",f,"0123456789"],["base16","f",b(4),"0123456789abcdef"],["base16upper","F",b(4),"0123456789ABCDEF"],["base32hex","v",b(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",b(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",b(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",b(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",b(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",b(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",b(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",b(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",b(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",f,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",f,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",f,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",f,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",b(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",b(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",b(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",b(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],n=r.reduce(((e,a)=>(e[a[0]]=new d(a[0],a[1],a[2],a[3]),e)),{}),o=r.reduce(((e,a)=>(e[a[1]]=n[a[0]],e)),{});e.exports={names:n,codes:o}},1466:(e,a,c)=>{"use strict";const f=c(7579),{encodeText:d,decodeText:b,concat:t}=c(4084);function i(e){if(Object.prototype.hasOwnProperty.call(f.names,e))return f.names[e];if(Object.prototype.hasOwnProperty.call(f.codes,e))return f.codes[e];throw new Error(`Unsupported encoding: ${e}`)}(a=e.exports=function(e,a){if(!a)throw new Error("requires an encoded Uint8Array");const{name:c,codeBuf:f}=i(e);return function(e,a){i(e).decode(b(a))}(c,a),t([f,a],f.length+a.length)}).encode=function(e,a){const c=i(e),f=d(c.encode(a));return t([c.codeBuf,f],c.codeBuf.length+f.length)},a.decode=function(e){e instanceof Uint8Array&&(e=b(e));const a=e[0];return["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(a)&&(e=e.toLowerCase()),i(e[0]).decode(e.substring(1))},a.isEncoded=function(e){if(e instanceof Uint8Array&&(e=b(e)),"[object String]"!==Object.prototype.toString.call(e))return!1;try{return i(e[0]).name}catch(e){return!1}},a.encoding=i,a.encodingFromData=function(e){return e instanceof Uint8Array&&(e=b(e)),i(e[0])};const r=Object.freeze(f.names),n=Object.freeze(f.codes);a.names=r,a.codes=n},9417:e=>{"use strict";e.exports={rfc4648:e=>a=>({encode:c=>((e,a,c)=>{const f="="===a[a.length-1],d=(1<c;)t-=c,b+=a[d&i>>t];if(t&&(b+=a[d&i<((e,a,c)=>{const f={};for(let e=0;e=8&&(t-=8,b[r++]=255&i>>t)}if(t>=c||255&i<<8-t)throw new SyntaxError("Unexpected end of data");return b})(c,a,e)})}},4084:e=>{"use strict";const a=new TextDecoder,c=new TextEncoder;e.exports={decodeText:e=>a.decode(e),encodeText:e=>c.encode(e),concat:function(e,a){const c=new Uint8Array(a);let f=0;for(const a of e)c.set(a,f),f+=a.length;return c}}},5194:e=>{e.exports=function e(f,d){var b,t=0,i=0,r=d=d||0,n=f.length;do{if(r>=n||i>49)throw e.bytes=0,new RangeError("Could not decode varint");b=f[r++],t+=i<28?(b&c)<=a);return e.bytes=r-d,t};var a=128,c=127},5134:e=>{e.exports=function e(d,b,t){if(Number.MAX_SAFE_INTEGER&&d>Number.MAX_SAFE_INTEGER)throw e.bytes=0,new RangeError("Could not encode varint");b=b||[];for(var i=t=t||0;d>=f;)b[t++]=255&d|a,d/=128;for(;d&c;)b[t++]=255&d|a,d>>>=7;return b[t]=0|d,e.bytes=t-i+1,b};var a=128,c=-128,f=Math.pow(2,31)},38:(e,a,c)=>{e.exports={encode:c(5134),decode:c(5194),encodingLength:c(6516)}},6516:e=>{var a=Math.pow(2,7),c=Math.pow(2,14),f=Math.pow(2,21),d=Math.pow(2,28),b=Math.pow(2,35),t=Math.pow(2,42),i=Math.pow(2,49),r=Math.pow(2,56),n=Math.pow(2,63);e.exports=function(e){return e{"use strict";const a=Object.freeze({identity:0,cidv1:1,cidv2:2,cidv3:3,ip4:4,tcp:6,sha1:17,"sha2-256":18,"sha2-512":19,"sha3-512":20,"sha3-384":21,"sha3-256":22,"sha3-224":23,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,blake3:30,dccp:33,"murmur3-128":34,"murmur3-32":35,ip6:41,ip6zone:42,path:47,multicodec:48,multihash:49,multiaddr:50,multibase:51,dns:53,dns4:54,dns6:55,dnsaddr:56,protobuf:80,cbor:81,raw:85,"dbl-sha2-256":86,rlp:96,bencode:99,"dag-pb":112,"dag-cbor":113,"libp2p-key":114,"git-raw":120,"torrent-info":123,"torrent-file":124,"leofcoin-block":129,"leofcoin-tx":130,"leofcoin-pr":131,sctp:132,"dag-jose":133,"dag-cose":134,"eth-block":144,"eth-block-list":145,"eth-tx-trie":146,"eth-tx":147,"eth-tx-receipt-trie":148,"eth-tx-receipt":149,"eth-state-trie":150,"eth-account-snapshot":151,"eth-storage-trie":152,"eth-receipt-log-trie":153,"eth-reciept-log":154,"bitcoin-block":176,"bitcoin-tx":177,"bitcoin-witness-commitment":178,"zcash-block":192,"zcash-tx":193,"caip-50":202,streamid:206,"stellar-block":208,"stellar-tx":209,md4:212,md5:213,bmt:214,"decred-block":224,"decred-tx":225,"ipld-ns":226,"ipfs-ns":227,"swarm-ns":228,"ipns-ns":229,zeronet:230,"secp256k1-pub":231,"bls12_381-g1-pub":234,"bls12_381-g2-pub":235,"x25519-pub":236,"ed25519-pub":237,"bls12_381-g1g2-pub":238,"dash-block":240,"dash-tx":241,"swarm-manifest":250,"swarm-feed":251,udp:273,"p2p-webrtc-star":275,"p2p-webrtc-direct":276,"p2p-stardust":277,"p2p-circuit":290,"dag-json":297,udt:301,utp:302,unix:400,thread:406,p2p:421,ipfs:421,https:443,onion:444,onion3:445,garlic64:446,garlic32:447,tls:448,noise:454,quic:460,ws:477,wss:478,"p2p-websocket-star":479,http:480,"swhid-1-snp":496,json:512,messagepack:513,"libp2p-peer-record":769,"libp2p-relay-rsvp":770,"car-index-sorted":1024,"sha2-256-trunc254-padded":4114,"ripemd-128":4178,"ripemd-160":4179,"ripemd-256":4180,"ripemd-320":4181,x11:4352,"p256-pub":4608,"p384-pub":4609,"p521-pub":4610,"ed448-pub":4611,"x448-pub":4612,"ed25519-priv":4864,"secp256k1-priv":4865,"x25519-priv":4866,kangarootwelve:7425,"sm3-256":21325,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"skein256-8":45825,"skein256-16":45826,"skein256-24":45827,"skein256-32":45828,"skein256-40":45829,"skein256-48":45830,"skein256-56":45831,"skein256-64":45832,"skein256-72":45833,"skein256-80":45834,"skein256-88":45835,"skein256-96":45836,"skein256-104":45837,"skein256-112":45838,"skein256-120":45839,"skein256-128":45840,"skein256-136":45841,"skein256-144":45842,"skein256-152":45843,"skein256-160":45844,"skein256-168":45845,"skein256-176":45846,"skein256-184":45847,"skein256-192":45848,"skein256-200":45849,"skein256-208":45850,"skein256-216":45851,"skein256-224":45852,"skein256-232":45853,"skein256-240":45854,"skein256-248":45855,"skein256-256":45856,"skein512-8":45857,"skein512-16":45858,"skein512-24":45859,"skein512-32":45860,"skein512-40":45861,"skein512-48":45862,"skein512-56":45863,"skein512-64":45864,"skein512-72":45865,"skein512-80":45866,"skein512-88":45867,"skein512-96":45868,"skein512-104":45869,"skein512-112":45870,"skein512-120":45871,"skein512-128":45872,"skein512-136":45873,"skein512-144":45874,"skein512-152":45875,"skein512-160":45876,"skein512-168":45877,"skein512-176":45878,"skein512-184":45879,"skein512-192":45880,"skein512-200":45881,"skein512-208":45882,"skein512-216":45883,"skein512-224":45884,"skein512-232":45885,"skein512-240":45886,"skein512-248":45887,"skein512-256":45888,"skein512-264":45889,"skein512-272":45890,"skein512-280":45891,"skein512-288":45892,"skein512-296":45893,"skein512-304":45894,"skein512-312":45895,"skein512-320":45896,"skein512-328":45897,"skein512-336":45898,"skein512-344":45899,"skein512-352":45900,"skein512-360":45901,"skein512-368":45902,"skein512-376":45903,"skein512-384":45904,"skein512-392":45905,"skein512-400":45906,"skein512-408":45907,"skein512-416":45908,"skein512-424":45909,"skein512-432":45910,"skein512-440":45911,"skein512-448":45912,"skein512-456":45913,"skein512-464":45914,"skein512-472":45915,"skein512-480":45916,"skein512-488":45917,"skein512-496":45918,"skein512-504":45919,"skein512-512":45920,"skein1024-8":45921,"skein1024-16":45922,"skein1024-24":45923,"skein1024-32":45924,"skein1024-40":45925,"skein1024-48":45926,"skein1024-56":45927,"skein1024-64":45928,"skein1024-72":45929,"skein1024-80":45930,"skein1024-88":45931,"skein1024-96":45932,"skein1024-104":45933,"skein1024-112":45934,"skein1024-120":45935,"skein1024-128":45936,"skein1024-136":45937,"skein1024-144":45938,"skein1024-152":45939,"skein1024-160":45940,"skein1024-168":45941,"skein1024-176":45942,"skein1024-184":45943,"skein1024-192":45944,"skein1024-200":45945,"skein1024-208":45946,"skein1024-216":45947,"skein1024-224":45948,"skein1024-232":45949,"skein1024-240":45950,"skein1024-248":45951,"skein1024-256":45952,"skein1024-264":45953,"skein1024-272":45954,"skein1024-280":45955,"skein1024-288":45956,"skein1024-296":45957,"skein1024-304":45958,"skein1024-312":45959,"skein1024-320":45960,"skein1024-328":45961,"skein1024-336":45962,"skein1024-344":45963,"skein1024-352":45964,"skein1024-360":45965,"skein1024-368":45966,"skein1024-376":45967,"skein1024-384":45968,"skein1024-392":45969,"skein1024-400":45970,"skein1024-408":45971,"skein1024-416":45972,"skein1024-424":45973,"skein1024-432":45974,"skein1024-440":45975,"skein1024-448":45976,"skein1024-456":45977,"skein1024-464":45978,"skein1024-472":45979,"skein1024-480":45980,"skein1024-488":45981,"skein1024-496":45982,"skein1024-504":45983,"skein1024-512":45984,"skein1024-520":45985,"skein1024-528":45986,"skein1024-536":45987,"skein1024-544":45988,"skein1024-552":45989,"skein1024-560":45990,"skein1024-568":45991,"skein1024-576":45992,"skein1024-584":45993,"skein1024-592":45994,"skein1024-600":45995,"skein1024-608":45996,"skein1024-616":45997,"skein1024-624":45998,"skein1024-632":45999,"skein1024-640":46e3,"skein1024-648":46001,"skein1024-656":46002,"skein1024-664":46003,"skein1024-672":46004,"skein1024-680":46005,"skein1024-688":46006,"skein1024-696":46007,"skein1024-704":46008,"skein1024-712":46009,"skein1024-720":46010,"skein1024-728":46011,"skein1024-736":46012,"skein1024-744":46013,"skein1024-752":46014,"skein1024-760":46015,"skein1024-768":46016,"skein1024-776":46017,"skein1024-784":46018,"skein1024-792":46019,"skein1024-800":46020,"skein1024-808":46021,"skein1024-816":46022,"skein1024-824":46023,"skein1024-832":46024,"skein1024-840":46025,"skein1024-848":46026,"skein1024-856":46027,"skein1024-864":46028,"skein1024-872":46029,"skein1024-880":46030,"skein1024-888":46031,"skein1024-896":46032,"skein1024-904":46033,"skein1024-912":46034,"skein1024-920":46035,"skein1024-928":46036,"skein1024-936":46037,"skein1024-944":46038,"skein1024-952":46039,"skein1024-960":46040,"skein1024-968":46041,"skein1024-976":46042,"skein1024-984":46043,"skein1024-992":46044,"skein1024-1000":46045,"skein1024-1008":46046,"skein1024-1016":46047,"skein1024-1024":46048,"poseidon-bls12_381-a2-fc1":46081,"poseidon-bls12_381-a2-fc1-sc":46082,"zeroxcert-imprint-256":52753,"fil-commitment-unsealed":61697,"fil-commitment-sealed":61698,"holochain-adr-v0":8417572,"holochain-adr-v1":8483108,"holochain-key-v0":9728292,"holochain-key-v1":9793828,"holochain-sig-v0":10645796,"holochain-sig-v1":10711332,"skynet-ns":11639056,"arweave-ns":11704592});e.exports={baseTable:a}},2021:(e,a,c)=>{"use strict";const f=c(38),{concat:d}=c(5007),b=c(2693),{nameToVarint:t,constantToCode:i,nameToCode:r,codeToName:n}=c(482);function o(e){const a=f.decode(e),c=n[a];if(void 0===c)throw new Error(`Code "${a}" not found`);return c}function s(e){return n[e]}function l(e){const a=r[e];if(void 0===a)throw new Error(`Codec "${e}" not found`);return a}function h(e){return f.decode(e)}function u(e){const a=t[e];if(void 0===a)throw new Error(`Codec "${e}" not found`);return a}function x(e){return b.varintEncode(e)}e.exports={addPrefix:function(e,a){let c;if(e instanceof Uint8Array)c=b.varintUint8ArrayEncode(e);else{if(!t[e])throw new Error("multicodec not recognized");c=t[e]}return d([c,a],c.length+a.length)},rmPrefix:function(e){return f.decode(e),e.slice(f.decode.bytes)},getNameFromData:o,getNameFromCode:s,getCodeFromName:l,getCodeFromData:h,getVarintFromName:u,getVarintFromCode:x,getCodec:function(e){return o(e)},getName:function(e){return s(e)},getNumber:function(e){return l(e)},getCode:function(e){return h(e)},getCodeVarint:function(e){return u(e)},getVarint:function(e){return Array.from(x(e))},...i,nameToVarint:t,nameToCode:r,codeToName:n}},482:(e,a,c)=>{"use strict";const{baseTable:f}=c(5661),d=c(2693).varintEncode,b={},t={},i={};for(const e in f){const a=e,c=f[a];b[a]=d(c),t[a.toUpperCase().replace(/-/g,"_")]=c,i[c]||(i[c]=a)}Object.freeze(b),Object.freeze(t),Object.freeze(i);const r=Object.freeze(f);e.exports={nameToVarint:b,constantToCode:t,nameToCode:r,codeToName:i}},2693:(e,a,c)=>{"use strict";const f=c(38),{toString:d}=c(7302),{fromString:b}=c(4117);function t(e){return parseInt(d(e,"base16"),16)}e.exports={numberToUint8Array:function(e){let a=e.toString(16);return a.length%2==1&&(a="0"+a),b(a,"base16")},uint8ArrayToNumber:t,varintUint8ArrayEncode:function(e){return Uint8Array.from(f.encode(t(e)))},varintEncode:function(e){return Uint8Array.from(f.encode(e))}}},6994:(e,a,c)=>{"use strict";const{Buffer:f}=c(8287);e.exports=class{constructor(e,a,c,d){this.name=e,this.code=a,this.codeBuf=f.from(this.code),this.alphabet=d,this.engine=c(d)}encode(e){return this.engine.encode(e)}decode(e){for(const a of e)if(this.alphabet&&this.alphabet.indexOf(a)<0)throw new Error(`invalid character '${a}' in '${e}'`);return this.engine.decode(e)}}},6082:(e,a,c)=>{"use strict";const f=c(5364),d=c(6994),b=c(5920),{decodeText:t,encodeText:i}=c(639),r=[["identity","\0",()=>({encode:t,decode:i}),""],["base2","0",b(1),"01"],["base8","7",b(3),"01234567"],["base10","9",f,"0123456789"],["base16","f",b(4),"0123456789abcdef"],["base16upper","F",b(4),"0123456789ABCDEF"],["base32hex","v",b(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",b(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",b(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",b(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",b(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",b(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",b(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",b(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",b(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",f,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",f,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",f,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",f,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",b(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",b(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",b(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",b(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],n=r.reduce(((e,a)=>(e[a[0]]=new d(a[0],a[1],a[2],a[3]),e)),{}),o=r.reduce(((e,a)=>(e[a[1]]=n[a[0]],e)),{});e.exports={names:n,codes:o}},2879:(e,a,c)=>{"use strict";const{Buffer:f}=c(8287),d=c(6082),{decodeText:b,asBuffer:t}=c(639);function i(e){if(d.names[e])return d.names[e];if(d.codes[e])return d.codes[e];throw new Error(`Unsupported encoding: ${e}`)}(a=e.exports=function(e,a){if(!a)throw new Error("requires an encoded buffer");const{name:c,codeBuf:d}=i(e);!function(e,a){i(e).decode(b(a))}(c,a);const t=f.alloc(d.length+a.length);return t.set(d,0),t.set(a,d.length),t}).encode=function(e,a){const c=i(e);return f.concat([c.codeBuf,f.from(c.encode(a))])},a.decode=function(e){ArrayBuffer.isView(e)&&(e=b(e));const a=e[0];["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(a)&&(e=e.toLowerCase());const c=i(e[0]);return t(c.decode(e.substring(1)))},a.isEncoded=function(e){if(e instanceof Uint8Array&&(e=b(e)),"[object String]"!==Object.prototype.toString.call(e))return!1;try{return i(e[0]).name}catch(e){return!1}},a.encoding=i,a.encodingFromData=function(e){return e instanceof Uint8Array&&(e=b(e)),i(e[0])},a.names=Object.freeze(d.names),a.codes=Object.freeze(d.codes)},5920:e=>{"use strict";e.exports=e=>a=>({encode:c=>((e,a,c)=>{const f="="===a[a.length-1],d=(1<c;)t-=c,b+=a[d&i>>t];if(t&&(b+=a[d&i<((e,a,c)=>{const f={};for(let e=0;e=8&&(t-=8,b[r++]=255&i>>t)}if(t>=c||255&i<<8-t)throw new SyntaxError("Unexpected end of data");return b})(c,a,e)})},639:(e,a,c)=>{"use strict";const{Buffer:f}=c(8287),{TextEncoder:d,TextDecoder:b}=c(7019),t=new b,i=new d;e.exports={decodeText:e=>t.decode(e),encodeText:e=>i.encode(e),asBuffer:({buffer:e,byteLength:a,byteOffset:c})=>f.from(e,c,a)}},3702:e=>{"use strict";const a=Object.freeze({identity:0,sha1:17,"sha2-256":18,"sha2-512":19,"sha3-512":20,"sha3-384":21,"sha3-256":22,"sha3-224":23,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,blake3:30,"murmur3-128":34,"murmur3-32":35,"dbl-sha2-256":86,md4:212,md5:213,bmt:214,"sha2-256-trunc254-padded":4114,"ripemd-128":4178,"ripemd-160":4179,"ripemd-256":4180,"ripemd-320":4181,x11:4352,"sm3-256":21325,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"skein256-8":45825,"skein256-16":45826,"skein256-24":45827,"skein256-32":45828,"skein256-40":45829,"skein256-48":45830,"skein256-56":45831,"skein256-64":45832,"skein256-72":45833,"skein256-80":45834,"skein256-88":45835,"skein256-96":45836,"skein256-104":45837,"skein256-112":45838,"skein256-120":45839,"skein256-128":45840,"skein256-136":45841,"skein256-144":45842,"skein256-152":45843,"skein256-160":45844,"skein256-168":45845,"skein256-176":45846,"skein256-184":45847,"skein256-192":45848,"skein256-200":45849,"skein256-208":45850,"skein256-216":45851,"skein256-224":45852,"skein256-232":45853,"skein256-240":45854,"skein256-248":45855,"skein256-256":45856,"skein512-8":45857,"skein512-16":45858,"skein512-24":45859,"skein512-32":45860,"skein512-40":45861,"skein512-48":45862,"skein512-56":45863,"skein512-64":45864,"skein512-72":45865,"skein512-80":45866,"skein512-88":45867,"skein512-96":45868,"skein512-104":45869,"skein512-112":45870,"skein512-120":45871,"skein512-128":45872,"skein512-136":45873,"skein512-144":45874,"skein512-152":45875,"skein512-160":45876,"skein512-168":45877,"skein512-176":45878,"skein512-184":45879,"skein512-192":45880,"skein512-200":45881,"skein512-208":45882,"skein512-216":45883,"skein512-224":45884,"skein512-232":45885,"skein512-240":45886,"skein512-248":45887,"skein512-256":45888,"skein512-264":45889,"skein512-272":45890,"skein512-280":45891,"skein512-288":45892,"skein512-296":45893,"skein512-304":45894,"skein512-312":45895,"skein512-320":45896,"skein512-328":45897,"skein512-336":45898,"skein512-344":45899,"skein512-352":45900,"skein512-360":45901,"skein512-368":45902,"skein512-376":45903,"skein512-384":45904,"skein512-392":45905,"skein512-400":45906,"skein512-408":45907,"skein512-416":45908,"skein512-424":45909,"skein512-432":45910,"skein512-440":45911,"skein512-448":45912,"skein512-456":45913,"skein512-464":45914,"skein512-472":45915,"skein512-480":45916,"skein512-488":45917,"skein512-496":45918,"skein512-504":45919,"skein512-512":45920,"skein1024-8":45921,"skein1024-16":45922,"skein1024-24":45923,"skein1024-32":45924,"skein1024-40":45925,"skein1024-48":45926,"skein1024-56":45927,"skein1024-64":45928,"skein1024-72":45929,"skein1024-80":45930,"skein1024-88":45931,"skein1024-96":45932,"skein1024-104":45933,"skein1024-112":45934,"skein1024-120":45935,"skein1024-128":45936,"skein1024-136":45937,"skein1024-144":45938,"skein1024-152":45939,"skein1024-160":45940,"skein1024-168":45941,"skein1024-176":45942,"skein1024-184":45943,"skein1024-192":45944,"skein1024-200":45945,"skein1024-208":45946,"skein1024-216":45947,"skein1024-224":45948,"skein1024-232":45949,"skein1024-240":45950,"skein1024-248":45951,"skein1024-256":45952,"skein1024-264":45953,"skein1024-272":45954,"skein1024-280":45955,"skein1024-288":45956,"skein1024-296":45957,"skein1024-304":45958,"skein1024-312":45959,"skein1024-320":45960,"skein1024-328":45961,"skein1024-336":45962,"skein1024-344":45963,"skein1024-352":45964,"skein1024-360":45965,"skein1024-368":45966,"skein1024-376":45967,"skein1024-384":45968,"skein1024-392":45969,"skein1024-400":45970,"skein1024-408":45971,"skein1024-416":45972,"skein1024-424":45973,"skein1024-432":45974,"skein1024-440":45975,"skein1024-448":45976,"skein1024-456":45977,"skein1024-464":45978,"skein1024-472":45979,"skein1024-480":45980,"skein1024-488":45981,"skein1024-496":45982,"skein1024-504":45983,"skein1024-512":45984,"skein1024-520":45985,"skein1024-528":45986,"skein1024-536":45987,"skein1024-544":45988,"skein1024-552":45989,"skein1024-560":45990,"skein1024-568":45991,"skein1024-576":45992,"skein1024-584":45993,"skein1024-592":45994,"skein1024-600":45995,"skein1024-608":45996,"skein1024-616":45997,"skein1024-624":45998,"skein1024-632":45999,"skein1024-640":46e3,"skein1024-648":46001,"skein1024-656":46002,"skein1024-664":46003,"skein1024-672":46004,"skein1024-680":46005,"skein1024-688":46006,"skein1024-696":46007,"skein1024-704":46008,"skein1024-712":46009,"skein1024-720":46010,"skein1024-728":46011,"skein1024-736":46012,"skein1024-744":46013,"skein1024-752":46014,"skein1024-760":46015,"skein1024-768":46016,"skein1024-776":46017,"skein1024-784":46018,"skein1024-792":46019,"skein1024-800":46020,"skein1024-808":46021,"skein1024-816":46022,"skein1024-824":46023,"skein1024-832":46024,"skein1024-840":46025,"skein1024-848":46026,"skein1024-856":46027,"skein1024-864":46028,"skein1024-872":46029,"skein1024-880":46030,"skein1024-888":46031,"skein1024-896":46032,"skein1024-904":46033,"skein1024-912":46034,"skein1024-920":46035,"skein1024-928":46036,"skein1024-936":46037,"skein1024-944":46038,"skein1024-952":46039,"skein1024-960":46040,"skein1024-968":46041,"skein1024-976":46042,"skein1024-984":46043,"skein1024-992":46044,"skein1024-1000":46045,"skein1024-1008":46046,"skein1024-1016":46047,"skein1024-1024":46048,"poseidon-bls12_381-a2-fc1":46081,"poseidon-bls12_381-a2-fc1-sc":46082});e.exports={names:a}},4243:(e,a,c)=>{"use strict";const{Buffer:f}=c(8287),d=c(2879),b=c(1203),{names:t}=c(3702),{TextDecoder:i}=c(7019),r=new i,n={};for(const e in t)n[t[e]]=e;function o(e){a.decode(e)}a.names=t,a.codes=Object.freeze(n),a.toHexString=function(e){if(!(e instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return(f.isBuffer(e)?e:f.from(e.buffer,e.byteOffset,e.byteLength)).toString("hex")},a.fromHexString=function(e){return f.from(e,"hex")},a.toB58String=function(e){if(!(e instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return r.decode(d.encode("base58btc",e)).slice(1)},a.fromB58String=function(e){const a=e instanceof Uint8Array?r.decode(e):e;return d.decode("z"+a)},a.decode=function(e){if(!(e instanceof Uint8Array))throw new Error("multihash must be a Uint8Array");let c=f.isBuffer(e)?e:f.from(e.buffer,e.byteOffset,e.byteLength);if(c.length<2)throw new Error("multihash too short. must be > 2 bytes.");const d=b.decode(c);if(!a.isValidCode(d))throw new Error(`multihash unknown function code: 0x${d.toString(16)}`);c=c.slice(b.decode.bytes);const t=b.decode(c);if(t<0)throw new Error(`multihash invalid length: ${t}`);if(c=c.slice(b.decode.bytes),c.length!==t)throw new Error(`multihash length inconsistent: 0x${c.toString("hex")}`);return{code:d,name:n[d],length:t,digest:c}},a.encode=function(e,c,d){if(!e||void 0===c)throw new Error("multihash encode requires at least two args: digest, code");const t=a.coerceCode(c);if(!(e instanceof Uint8Array))throw new Error("digest should be a Uint8Array");if(null==d&&(d=e.length),d&&e.length!==d)throw new Error("digest length should be equal to specified length.");const i=b.encode(t),r=b.encode(d),n=f.alloc(i.length+r.length+e.length);return n.set(i,0),n.set(r,i.length),n.set(e,i.length+r.length),n},a.coerceCode=function(e){let c=e;if("string"==typeof e){if(void 0===t[e])throw new Error(`Unrecognized hash function named: ${e}`);c=t[e]}if("number"!=typeof c)throw new Error(`Hash function code should be a number. Got: ${c}`);if(void 0===n[c]&&!a.isAppCode(c))throw new Error(`Unrecognized function code: ${c}`);return c},a.isAppCode=function(e){return e>0&&e<16},a.isValidCode=function(e){return!!a.isAppCode(e)||!!n[e]},a.validate=o,a.prefix=function(e){return o(e),f.from(e.buffer,e.byteOffset,2)}},6889:e=>{e.exports=function e(c,f){if(!c){var d=new a(f);throw Error.captureStackTrace&&Error.captureStackTrace(d,e),d}};class a extends Error{}a.prototype.name="AssertionError"},2045:(e,a,c)=>{"use strict";const f=c(7526),d=c(251),b="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;a.hp=r,a.IS=50;const t=2147483647;function i(e){if(e>t)throw new RangeError('The value "'+e+'" is invalid for option "size"');const a=new Uint8Array(e);return Object.setPrototypeOf(a,r.prototype),a}function r(e,a,c){if("number"==typeof e){if("string"==typeof a)throw new TypeError('The "string" argument must be of type string. Received type number');return s(e)}return n(e,a,c)}function n(e,a,c){if("string"==typeof e)return function(e,a){if("string"==typeof a&&""!==a||(a="utf8"),!r.isEncoding(a))throw new TypeError("Unknown encoding: "+a);const c=0|x(e,a);let f=i(c);const d=f.write(e,a);return d!==c&&(f=f.slice(0,d)),f}(e,a);if(ArrayBuffer.isView(e))return function(e){if(W(e,Uint8Array)){const a=new Uint8Array(e);return h(a.buffer,a.byteOffset,a.byteLength)}return l(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(W(e,ArrayBuffer)||e&&W(e.buffer,ArrayBuffer))return h(e,a,c);if("undefined"!=typeof SharedArrayBuffer&&(W(e,SharedArrayBuffer)||e&&W(e.buffer,SharedArrayBuffer)))return h(e,a,c);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const f=e.valueOf&&e.valueOf();if(null!=f&&f!==e)return r.from(f,a,c);const d=function(e){if(r.isBuffer(e)){const a=0|u(e.length),c=i(a);return 0===c.length||e.copy(c,0,0,a),c}return void 0!==e.length?"number"!=typeof e.length||Y(e.length)?i(0):l(e):"Buffer"===e.type&&Array.isArray(e.data)?l(e.data):void 0}(e);if(d)return d;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return r.from(e[Symbol.toPrimitive]("string"),a,c);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function o(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function s(e){return o(e),i(e<0?0:0|u(e))}function l(e){const a=e.length<0?0:0|u(e.length),c=i(a);for(let f=0;f=t)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+t.toString(16)+" bytes");return 0|e}function x(e,a){if(r.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||W(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const c=e.length,f=arguments.length>2&&!0===arguments[2];if(!f&&0===c)return 0;let d=!1;for(;;)switch(a){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*c;case"hex":return c>>>1;case"base64":return V(e).length;default:if(d)return f?-1:H(e).length;a=(""+a).toLowerCase(),d=!0}}function p(e,a,c){let f=!1;if((void 0===a||a<0)&&(a=0),a>this.length)return"";if((void 0===c||c>this.length)&&(c=this.length),c<=0)return"";if((c>>>=0)<=(a>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,a,c);case"utf8":case"utf-8":return I(this,a,c);case"ascii":return E(this,a,c);case"latin1":case"binary":return S(this,a,c);case"base64":return L(this,a,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,a,c);default:if(f)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),f=!0}}function g(e,a,c){const f=e[a];e[a]=e[c],e[c]=f}function m(e,a,c,f,d){if(0===e.length)return-1;if("string"==typeof c?(f=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),Y(c=+c)&&(c=d?0:e.length-1),c<0&&(c=e.length+c),c>=e.length){if(d)return-1;c=e.length-1}else if(c<0){if(!d)return-1;c=0}if("string"==typeof a&&(a=r.from(a,f)),r.isBuffer(a))return 0===a.length?-1:y(e,a,c,f,d);if("number"==typeof a)return a&=255,"function"==typeof Uint8Array.prototype.indexOf?d?Uint8Array.prototype.indexOf.call(e,a,c):Uint8Array.prototype.lastIndexOf.call(e,a,c):y(e,[a],c,f,d);throw new TypeError("val must be string, number or Buffer")}function y(e,a,c,f,d){let b,t=1,i=e.length,r=a.length;if(void 0!==f&&("ucs2"===(f=String(f).toLowerCase())||"ucs-2"===f||"utf16le"===f||"utf-16le"===f)){if(e.length<2||a.length<2)return-1;t=2,i/=2,r/=2,c/=2}function n(e,a){return 1===t?e[a]:e.readUInt16BE(a*t)}if(d){let f=-1;for(b=c;bi&&(c=i-r),b=c;b>=0;b--){let c=!0;for(let f=0;fd&&(f=d):f=d;const b=a.length;let t;for(f>b/2&&(f=b/2),t=0;t>8,d=c%256,b.push(d),b.push(f);return b}(a,e.length-c),e,c,f)}function L(e,a,c){return 0===a&&c===e.length?f.fromByteArray(e):f.fromByteArray(e.slice(a,c))}function I(e,a,c){c=Math.min(e.length,c);const f=[];let d=a;for(;d239?4:a>223?3:a>191?2:1;if(d+t<=c){let c,f,i,r;switch(t){case 1:a<128&&(b=a);break;case 2:c=e[d+1],128==(192&c)&&(r=(31&a)<<6|63&c,r>127&&(b=r));break;case 3:c=e[d+1],f=e[d+2],128==(192&c)&&128==(192&f)&&(r=(15&a)<<12|(63&c)<<6|63&f,r>2047&&(r<55296||r>57343)&&(b=r));break;case 4:c=e[d+1],f=e[d+2],i=e[d+3],128==(192&c)&&128==(192&f)&&128==(192&i)&&(r=(15&a)<<18|(63&c)<<12|(63&f)<<6|63&i,r>65535&&r<1114112&&(b=r))}}null===b?(b=65533,t=1):b>65535&&(b-=65536,f.push(b>>>10&1023|55296),b=56320|1023&b),f.push(b),d+=t}return function(e){const a=e.length;if(a<=k)return String.fromCharCode.apply(String,e);let c="",f=0;for(;ff.length?(r.isBuffer(a)||(a=r.from(a)),a.copy(f,d)):Uint8Array.prototype.set.call(f,a,d);else{if(!r.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(f,d)}d+=a.length}return f},r.byteLength=x,r.prototype._isBuffer=!0,r.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let a=0;ac&&(e+=" ... "),""},b&&(r.prototype[b]=r.prototype.inspect),r.prototype.compare=function(e,a,c,f,d){if(W(e,Uint8Array)&&(e=r.from(e,e.offset,e.byteLength)),!r.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===a&&(a=0),void 0===c&&(c=e?e.length:0),void 0===f&&(f=0),void 0===d&&(d=this.length),a<0||c>e.length||f<0||d>this.length)throw new RangeError("out of range index");if(f>=d&&a>=c)return 0;if(f>=d)return-1;if(a>=c)return 1;if(this===e)return 0;let b=(d>>>=0)-(f>>>=0),t=(c>>>=0)-(a>>>=0);const i=Math.min(b,t),n=this.slice(f,d),o=e.slice(a,c);for(let e=0;e>>=0,isFinite(c)?(c>>>=0,void 0===f&&(f="utf8")):(f=c,c=void 0)}const d=this.length-a;if((void 0===c||c>d)&&(c=d),e.length>0&&(c<0||a<0)||a>this.length)throw new RangeError("Attempt to write outside buffer bounds");f||(f="utf8");let b=!1;for(;;)switch(f){case"hex":return _(this,e,a,c);case"utf8":case"utf-8":return v(this,e,a,c);case"ascii":case"latin1":case"binary":return w(this,e,a,c);case"base64":return M(this,e,a,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,a,c);default:if(b)throw new TypeError("Unknown encoding: "+f);f=(""+f).toLowerCase(),b=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const k=4096;function E(e,a,c){let f="";c=Math.min(e.length,c);for(let d=a;df)&&(c=f);let d="";for(let f=a;fc)throw new RangeError("Trying to access beyond buffer length")}function O(e,a,c,f,d,b){if(!r.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(a>d||ae.length)throw new RangeError("Index out of range")}function P(e,a,c,f,d){z(a,f,d,e,c,7);let b=Number(a&BigInt(4294967295));e[c++]=b,b>>=8,e[c++]=b,b>>=8,e[c++]=b,b>>=8,e[c++]=b;let t=Number(a>>BigInt(32)&BigInt(4294967295));return e[c++]=t,t>>=8,e[c++]=t,t>>=8,e[c++]=t,t>>=8,e[c++]=t,c}function R(e,a,c,f,d){z(a,f,d,e,c,7);let b=Number(a&BigInt(4294967295));e[c+7]=b,b>>=8,e[c+6]=b,b>>=8,e[c+5]=b,b>>=8,e[c+4]=b;let t=Number(a>>BigInt(32)&BigInt(4294967295));return e[c+3]=t,t>>=8,e[c+2]=t,t>>=8,e[c+1]=t,t>>=8,e[c]=t,c+8}function T(e,a,c,f,d,b){if(c+f>e.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function U(e,a,c,f,b){return a=+a,c>>>=0,b||T(e,0,c,4),d.write(e,a,c,f,23,4),c+4}function j(e,a,c,f,b){return a=+a,c>>>=0,b||T(e,0,c,8),d.write(e,a,c,f,52,8),c+8}r.prototype.slice=function(e,a){const c=this.length;(e=~~e)<0?(e+=c)<0&&(e=0):e>c&&(e=c),(a=void 0===a?c:~~a)<0?(a+=c)<0&&(a=0):a>c&&(a=c),a>>=0,a>>>=0,c||F(e,a,this.length);let f=this[e],d=1,b=0;for(;++b>>=0,a>>>=0,c||F(e,a,this.length);let f=this[e+--a],d=1;for(;a>0&&(d*=256);)f+=this[e+--a]*d;return f},r.prototype.readUint8=r.prototype.readUInt8=function(e,a){return e>>>=0,a||F(e,1,this.length),this[e]},r.prototype.readUint16LE=r.prototype.readUInt16LE=function(e,a){return e>>>=0,a||F(e,2,this.length),this[e]|this[e+1]<<8},r.prototype.readUint16BE=r.prototype.readUInt16BE=function(e,a){return e>>>=0,a||F(e,2,this.length),this[e]<<8|this[e+1]},r.prototype.readUint32LE=r.prototype.readUInt32LE=function(e,a){return e>>>=0,a||F(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},r.prototype.readUint32BE=r.prototype.readUInt32BE=function(e,a){return e>>>=0,a||F(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},r.prototype.readBigUInt64LE=$((function(e){Q(e>>>=0,"offset");const a=this[e],c=this[e+7];void 0!==a&&void 0!==c||G(e,this.length-8);const f=a+256*this[++e]+65536*this[++e]+this[++e]*2**24,d=this[++e]+256*this[++e]+65536*this[++e]+c*2**24;return BigInt(f)+(BigInt(d)<>>=0,"offset");const a=this[e],c=this[e+7];void 0!==a&&void 0!==c||G(e,this.length-8);const f=a*2**24+65536*this[++e]+256*this[++e]+this[++e],d=this[++e]*2**24+65536*this[++e]+256*this[++e]+c;return(BigInt(f)<>>=0,a>>>=0,c||F(e,a,this.length);let f=this[e],d=1,b=0;for(;++b=d&&(f-=Math.pow(2,8*a)),f},r.prototype.readIntBE=function(e,a,c){e>>>=0,a>>>=0,c||F(e,a,this.length);let f=a,d=1,b=this[e+--f];for(;f>0&&(d*=256);)b+=this[e+--f]*d;return d*=128,b>=d&&(b-=Math.pow(2,8*a)),b},r.prototype.readInt8=function(e,a){return e>>>=0,a||F(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},r.prototype.readInt16LE=function(e,a){e>>>=0,a||F(e,2,this.length);const c=this[e]|this[e+1]<<8;return 32768&c?4294901760|c:c},r.prototype.readInt16BE=function(e,a){e>>>=0,a||F(e,2,this.length);const c=this[e+1]|this[e]<<8;return 32768&c?4294901760|c:c},r.prototype.readInt32LE=function(e,a){return e>>>=0,a||F(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},r.prototype.readInt32BE=function(e,a){return e>>>=0,a||F(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},r.prototype.readBigInt64LE=$((function(e){Q(e>>>=0,"offset");const a=this[e],c=this[e+7];void 0!==a&&void 0!==c||G(e,this.length-8);const f=this[e+4]+256*this[e+5]+65536*this[e+6]+(c<<24);return(BigInt(f)<>>=0,"offset");const a=this[e],c=this[e+7];void 0!==a&&void 0!==c||G(e,this.length-8);const f=(a<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(f)<>>=0,a||F(e,4,this.length),d.read(this,e,!0,23,4)},r.prototype.readFloatBE=function(e,a){return e>>>=0,a||F(e,4,this.length),d.read(this,e,!1,23,4)},r.prototype.readDoubleLE=function(e,a){return e>>>=0,a||F(e,8,this.length),d.read(this,e,!0,52,8)},r.prototype.readDoubleBE=function(e,a){return e>>>=0,a||F(e,8,this.length),d.read(this,e,!1,52,8)},r.prototype.writeUintLE=r.prototype.writeUIntLE=function(e,a,c,f){e=+e,a>>>=0,c>>>=0,f||O(this,e,a,c,Math.pow(2,8*c)-1,0);let d=1,b=0;for(this[a]=255&e;++b>>=0,c>>>=0,f||O(this,e,a,c,Math.pow(2,8*c)-1,0);let d=c-1,b=1;for(this[a+d]=255&e;--d>=0&&(b*=256);)this[a+d]=e/b&255;return a+c},r.prototype.writeUint8=r.prototype.writeUInt8=function(e,a,c){return e=+e,a>>>=0,c||O(this,e,a,1,255,0),this[a]=255&e,a+1},r.prototype.writeUint16LE=r.prototype.writeUInt16LE=function(e,a,c){return e=+e,a>>>=0,c||O(this,e,a,2,65535,0),this[a]=255&e,this[a+1]=e>>>8,a+2},r.prototype.writeUint16BE=r.prototype.writeUInt16BE=function(e,a,c){return e=+e,a>>>=0,c||O(this,e,a,2,65535,0),this[a]=e>>>8,this[a+1]=255&e,a+2},r.prototype.writeUint32LE=r.prototype.writeUInt32LE=function(e,a,c){return e=+e,a>>>=0,c||O(this,e,a,4,4294967295,0),this[a+3]=e>>>24,this[a+2]=e>>>16,this[a+1]=e>>>8,this[a]=255&e,a+4},r.prototype.writeUint32BE=r.prototype.writeUInt32BE=function(e,a,c){return e=+e,a>>>=0,c||O(this,e,a,4,4294967295,0),this[a]=e>>>24,this[a+1]=e>>>16,this[a+2]=e>>>8,this[a+3]=255&e,a+4},r.prototype.writeBigUInt64LE=$((function(e,a=0){return P(this,e,a,BigInt(0),BigInt("0xffffffffffffffff"))})),r.prototype.writeBigUInt64BE=$((function(e,a=0){return R(this,e,a,BigInt(0),BigInt("0xffffffffffffffff"))})),r.prototype.writeIntLE=function(e,a,c,f){if(e=+e,a>>>=0,!f){const f=Math.pow(2,8*c-1);O(this,e,a,c,f-1,-f)}let d=0,b=1,t=0;for(this[a]=255&e;++d>>=0,!f){const f=Math.pow(2,8*c-1);O(this,e,a,c,f-1,-f)}let d=c-1,b=1,t=0;for(this[a+d]=255&e;--d>=0&&(b*=256);)e<0&&0===t&&0!==this[a+d+1]&&(t=1),this[a+d]=(e/b|0)-t&255;return a+c},r.prototype.writeInt8=function(e,a,c){return e=+e,a>>>=0,c||O(this,e,a,1,127,-128),e<0&&(e=255+e+1),this[a]=255&e,a+1},r.prototype.writeInt16LE=function(e,a,c){return e=+e,a>>>=0,c||O(this,e,a,2,32767,-32768),this[a]=255&e,this[a+1]=e>>>8,a+2},r.prototype.writeInt16BE=function(e,a,c){return e=+e,a>>>=0,c||O(this,e,a,2,32767,-32768),this[a]=e>>>8,this[a+1]=255&e,a+2},r.prototype.writeInt32LE=function(e,a,c){return e=+e,a>>>=0,c||O(this,e,a,4,2147483647,-2147483648),this[a]=255&e,this[a+1]=e>>>8,this[a+2]=e>>>16,this[a+3]=e>>>24,a+4},r.prototype.writeInt32BE=function(e,a,c){return e=+e,a>>>=0,c||O(this,e,a,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[a]=e>>>24,this[a+1]=e>>>16,this[a+2]=e>>>8,this[a+3]=255&e,a+4},r.prototype.writeBigInt64LE=$((function(e,a=0){return P(this,e,a,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),r.prototype.writeBigInt64BE=$((function(e,a=0){return R(this,e,a,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),r.prototype.writeFloatLE=function(e,a,c){return U(this,e,a,!0,c)},r.prototype.writeFloatBE=function(e,a,c){return U(this,e,a,!1,c)},r.prototype.writeDoubleLE=function(e,a,c){return j(this,e,a,!0,c)},r.prototype.writeDoubleBE=function(e,a,c){return j(this,e,a,!1,c)},r.prototype.copy=function(e,a,c,f){if(!r.isBuffer(e))throw new TypeError("argument should be a Buffer");if(c||(c=0),f||0===f||(f=this.length),a>=e.length&&(a=e.length),a||(a=0),f>0&&f=this.length)throw new RangeError("Index out of range");if(f<0)throw new RangeError("sourceEnd out of bounds");f>this.length&&(f=this.length),e.length-a>>=0,c=void 0===c?this.length:c>>>0,e||(e=0),"number"==typeof e)for(d=a;d=f+4;c-=3)a=`_${e.slice(c-3,c)}${a}`;return`${e.slice(0,c)}${a}`}function z(e,a,c,f,d,b){if(e>c||e3?0===a||a===BigInt(0)?`>= 0${f} and < 2${f} ** ${8*(b+1)}${f}`:`>= -(2${f} ** ${8*(b+1)-1}${f}) and < 2 ** ${8*(b+1)-1}${f}`:`>= ${a}${f} and <= ${c}${f}`,new N.ERR_OUT_OF_RANGE("value",d,e)}!function(e,a,c){Q(a,"offset"),void 0!==e[a]&&void 0!==e[a+c]||G(a,e.length-(c+1))}(f,d,b)}function Q(e,a){if("number"!=typeof e)throw new N.ERR_INVALID_ARG_TYPE(a,"number",e)}function G(e,a,c){if(Math.floor(e)!==e)throw Q(e,c),new N.ERR_OUT_OF_RANGE(c||"offset","an integer",e);if(a<0)throw new N.ERR_BUFFER_OUT_OF_BOUNDS;throw new N.ERR_OUT_OF_RANGE(c||"offset",`>= ${c?1:0} and <= ${a}`,e)}q("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),q("ERR_INVALID_ARG_TYPE",(function(e,a){return`The "${e}" argument must be of type number. Received type ${typeof a}`}),TypeError),q("ERR_OUT_OF_RANGE",(function(e,a,c){let f=`The value of "${e}" is out of range.`,d=c;return Number.isInteger(c)&&Math.abs(c)>2**32?d=D(String(c)):"bigint"==typeof c&&(d=String(c),(c>BigInt(2)**BigInt(32)||c<-(BigInt(2)**BigInt(32)))&&(d=D(d)),d+="n"),f+=` It must be ${a}. Received ${d}`,f}),RangeError);const K=/[^+/0-9A-Za-z-_]/g;function H(e,a){let c;a=a||1/0;const f=e.length;let d=null;const b=[];for(let t=0;t55295&&c<57344){if(!d){if(c>56319){(a-=3)>-1&&b.push(239,191,189);continue}if(t+1===f){(a-=3)>-1&&b.push(239,191,189);continue}d=c;continue}if(c<56320){(a-=3)>-1&&b.push(239,191,189),d=c;continue}c=65536+(d-55296<<10|c-56320)}else d&&(a-=3)>-1&&b.push(239,191,189);if(d=null,c<128){if((a-=1)<0)break;b.push(c)}else if(c<2048){if((a-=2)<0)break;b.push(c>>6|192,63&c|128)}else if(c<65536){if((a-=3)<0)break;b.push(c>>12|224,c>>6&63|128,63&c|128)}else{if(!(c<1114112))throw new Error("Invalid code point");if((a-=4)<0)break;b.push(c>>18|240,c>>12&63|128,c>>6&63|128,63&c|128)}}return b}function V(e){return f.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(K,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Z(e,a,c,f){let d;for(d=0;d=a.length||d>=e.length);++d)a[d+c]=e[d];return d}function W(e,a){return e instanceof a||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===a.name}function Y(e){return e!=e}const J=function(){const e="0123456789abcdef",a=new Array(256);for(let c=0;c<16;++c){const f=16*c;for(let d=0;d<16;++d)a[f+d]=e[c]+e[d]}return a}();function $(e){return"undefined"==typeof BigInt?X:e}function X(){throw new Error("BigInt not supported")}},9211:e=>{"use strict";var a=function(e){return e!=e};e.exports=function(e,c){return 0===e&&0===c?1/e==1/c:e===c||!(!a(e)||!a(c))}},7653:(e,a,c)=>{"use strict";var f=c(8452),d=c(487),b=c(9211),t=c(9394),i=c(6576),r=d(t(),Object);f(r,{getPolyfill:t,implementation:b,shim:i}),e.exports=r},9394:(e,a,c)=>{"use strict";var f=c(9211);e.exports=function(){return"function"==typeof Object.is?Object.is:f}},6576:(e,a,c)=>{"use strict";var f=c(9394),d=c(8452);e.exports=function(){var e=f();return d(Object,{is:e},{is:function(){return Object.is!==e}}),e}},8875:(e,a,c)=>{"use strict";var f;if(!Object.keys){var d=Object.prototype.hasOwnProperty,b=Object.prototype.toString,t=c(1093),i=Object.prototype.propertyIsEnumerable,r=!i.call({toString:null},"toString"),n=i.call((function(){}),"prototype"),o=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],s=function(e){var a=e.constructor;return a&&a.prototype===e},l={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},h=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!l["$"+e]&&d.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{s(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();f=function(e){var a=null!==e&&"object"==typeof e,c="[object Function]"===b.call(e),f=t(e),i=a&&"[object String]"===b.call(e),l=[];if(!a&&!c&&!f)throw new TypeError("Object.keys called on a non-object");var u=n&&c;if(i&&e.length>0&&!d.call(e,0))for(var x=0;x0)for(var p=0;p{"use strict";var f=Array.prototype.slice,d=c(1093),b=Object.keys,t=b?function(e){return b(e)}:c(8875),i=Object.keys;t.shim=function(){if(Object.keys){var e=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);e||(Object.keys=function(e){return d(e)?i(f.call(e)):i(e)})}else Object.keys=t;return Object.keys||t},e.exports=t},1093:e=>{"use strict";var a=Object.prototype.toString;e.exports=function(e){var c=a.call(e),f="[object Arguments]"===c;return f||(f="[object Array]"!==c&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===a.call(e.callee)),f}},8403:(e,a,c)=>{"use strict";var f=c(1189),d=c(1333)(),b=c(8075),t=Object,i=b("Array.prototype.push"),r=b("Object.prototype.propertyIsEnumerable"),n=d?Object.getOwnPropertySymbols:null;e.exports=function(e,a){if(null==e)throw new TypeError("target must be an object");var c=t(e);if(1===arguments.length)return c;for(var b=1;b{"use strict";var f=c(8403);e.exports=function(){return Object.assign?function(){if(!Object.assign)return!1;for(var e="abcdefghijklmnopqrst",a=e.split(""),c={},f=0;f{"use strict";var f=c(7568);a.certificate=c(6413);var d=f.define("RSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}));a.RSAPrivateKey=d;var b=f.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));a.RSAPublicKey=b;var t=f.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())})),i=f.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(t),this.key("subjectPublicKey").bitstr())}));a.PublicKey=i;var r=f.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(t),this.key("subjectPrivateKey").octstr())}));a.PrivateKey=r;var n=f.define("EncryptedPrivateKeyInfo",(function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())}));a.EncryptedPrivateKey=n;var o=f.define("DSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())}));a.DSAPrivateKey=o,a.DSAparam=f.define("DSAparam",(function(){this.int()}));var s=f.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})})),l=f.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(s),this.key("publicKey").optional().explicit(1).bitstr())}));a.ECPrivateKey=l,a.signature=f.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())}))},6413:(e,a,c)=>{"use strict";var f=c(7568),d=f.define("Time",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),b=f.define("AttributeTypeValue",(function(){this.seq().obj(this.key("type").objid(),this.key("value").any())})),t=f.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())})),i=f.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(t),this.key("subjectPublicKey").bitstr())})),r=f.define("RelativeDistinguishedName",(function(){this.setof(b)})),n=f.define("RDNSequence",(function(){this.seqof(r)})),o=f.define("Name",(function(){this.choice({rdnSequence:this.use(n)})})),s=f.define("Validity",(function(){this.seq().obj(this.key("notBefore").use(d),this.key("notAfter").use(d))})),l=f.define("Extension",(function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())})),h=f.define("TBSCertificate",(function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(t),this.key("issuer").use(o),this.key("validity").use(s),this.key("subject").use(o),this.key("subjectPublicKeyInfo").use(i),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(l).optional())})),u=f.define("X509Certificate",(function(){this.seq().obj(this.key("tbsCertificate").use(h),this.key("signatureAlgorithm").use(t),this.key("signatureValue").bitstr())}));e.exports=u},4101:(e,a,c)=>{"use strict";var f=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,d=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,b=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,t=c(8078),i=c(1241),r=c(2861).Buffer;e.exports=function(e,a){var c,n=e.toString(),o=n.match(f);if(o){var s="aes"+o[1],l=r.from(o[2],"hex"),h=r.from(o[3].replace(/[\r\n]/g,""),"base64"),u=t(a,l.slice(0,8),parseInt(o[1],10)).key,x=[],p=i.createDecipheriv(s,u,l);x.push(p.update(h)),x.push(p.final()),c=r.concat(x)}else{var g=n.match(b);c=r.from(g[2].replace(/[\r\n]/g,""),"base64")}return{tag:n.match(d)[1],data:c}}},8170:(e,a,c)=>{"use strict";var f=c(1137),d=c(5579),b=c(4101),t=c(1241),i=c(8396),r=c(2861).Buffer;function n(e){var a;"object"!=typeof e||r.isBuffer(e)||(a=e.passphrase,e=e.key),"string"==typeof e&&(e=r.from(e));var c,n,o=b(e,a),s=o.tag,l=o.data;switch(s){case"CERTIFICATE":n=f.certificate.decode(l,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(n||(n=f.PublicKey.decode(l,"der")),c=n.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return f.RSAPublicKey.decode(n.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return n.subjectPrivateKey=n.subjectPublicKey,{type:"ec",data:n};case"1.2.840.10040.4.1":return n.algorithm.params.pub_key=f.DSAparam.decode(n.subjectPublicKey.data,"der"),{type:"dsa",data:n.algorithm.params};default:throw new Error("unknown key id "+c)}case"ENCRYPTED PRIVATE KEY":l=function(e,a){var c=e.algorithm.decrypt.kde.kdeparams.salt,f=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),b=d[e.algorithm.decrypt.cipher.algo.join(".")],n=e.algorithm.decrypt.cipher.iv,o=e.subjectPrivateKey,s=parseInt(b.split("-")[1],10)/8,l=i.pbkdf2Sync(a,c,f,s,"sha1"),h=t.createDecipheriv(b,l,n),u=[];return u.push(h.update(o)),u.push(h.final()),r.concat(u)}(l=f.EncryptedPrivateKey.decode(l,"der"),a);case"PRIVATE KEY":switch(c=(n=f.PrivateKey.decode(l,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return f.RSAPrivateKey.decode(n.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:n.algorithm.curve,privateKey:f.ECPrivateKey.decode(n.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return n.algorithm.params.priv_key=f.DSAparam.decode(n.subjectPrivateKey,"der"),{type:"dsa",params:n.algorithm.params};default:throw new Error("unknown key id "+c)}case"RSA PUBLIC KEY":return f.RSAPublicKey.decode(l,"der");case"RSA PRIVATE KEY":return f.RSAPrivateKey.decode(l,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:f.DSAPrivateKey.decode(l,"der")};case"EC PRIVATE KEY":return{curve:(l=f.ECPrivateKey.decode(l,"der")).parameters.value,privateKey:l.privateKey};default:throw new Error("unknown key type "+s)}}n.signature=f.signature,e.exports=n},8396:(e,a,c)=>{a.pbkdf2=c(3832),a.pbkdf2Sync=c(1352)},3832:(e,a,c)=>{var f,d,b=c(2861).Buffer,t=c(4196),i=c(2455),r=c(1352),n=c(3382),o=c.g.crypto&&c.g.crypto.subtle,s={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},l=[];function h(){return d||(d=c.g.process&&c.g.process.nextTick?c.g.process.nextTick:c.g.queueMicrotask?c.g.queueMicrotask:c.g.setImmediate?c.g.setImmediate:c.g.setTimeout)}function u(e,a,c,f,d){return o.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]).then((function(e){return o.deriveBits({name:"PBKDF2",salt:a,iterations:c,hash:{name:d}},e,f<<3)})).then((function(e){return b.from(e)}))}e.exports=function(e,a,d,x,p,g){"function"==typeof p&&(g=p,p=void 0);var m=s[(p=p||"sha1").toLowerCase()];if(m&&"function"==typeof c.g.Promise){if(t(d,x),e=n(e,i,"Password"),a=n(a,i,"Salt"),"function"!=typeof g)throw new Error("No callback provided to pbkdf2");!function(e,a){e.then((function(e){h()((function(){a(null,e)}))}),(function(e){h()((function(){a(e)}))}))}(function(e){if(c.g.process&&!c.g.process.browser)return Promise.resolve(!1);if(!o||!o.importKey||!o.deriveBits)return Promise.resolve(!1);if(void 0!==l[e])return l[e];var a=u(f=f||b.alloc(8),f,10,128,e).then((function(){return!0})).catch((function(){return!1}));return l[e]=a,a}(m).then((function(c){return c?u(e,a,d,x,m):r(e,a,d,x,p)})),g)}else h()((function(){var c;try{c=r(e,a,d,x,p)}catch(e){return g(e)}g(null,c)}))}},2455:(e,a,c)=>{var f;f=c.g.process&&c.g.process.browser?"utf-8":c.g.process&&c.g.process.version?parseInt(process.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary":"utf-8",e.exports=f},4196:e=>{var a=Math.pow(2,30)-1;e.exports=function(e,c){if("number"!=typeof e)throw new TypeError("Iterations not a number");if(e<0)throw new TypeError("Bad iterations");if("number"!=typeof c)throw new TypeError("Key length not a number");if(c<0||c>a||c!=c)throw new TypeError("Bad key length")}},1352:(e,a,c)=>{var f=c(320),d=c(6011),b=c(2802),t=c(2861).Buffer,i=c(4196),r=c(2455),n=c(3382),o=t.alloc(128),s={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function l(e,a,c){var i=function(e){return"rmd160"===e||"ripemd160"===e?function(e){return(new d).update(e).digest()}:"md5"===e?f:function(a){return b(e).update(a).digest()}}(e),r="sha512"===e||"sha384"===e?128:64;a.length>r?a=i(a):a.length{var f=c(2861).Buffer;e.exports=function(e,a,c){if(f.isBuffer(e))return e;if("string"==typeof e)return f.from(e,a);if(ArrayBuffer.isView(e))return f.from(e.buffer);throw new TypeError(c+" must be a string, a Buffer, a typed array or a DataView")}},6578:e=>{"use strict";e.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]},3225:e=>{"use strict";"undefined"==typeof process||!process.version||0===process.version.indexOf("v0.")||0===process.version.indexOf("v1.")&&0!==process.version.indexOf("v1.8.")?e.exports={nextTick:function(e,a,c,f){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var d,b,t=arguments.length;switch(t){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick((function(){e.call(null,a)}));case 3:return process.nextTick((function(){e.call(null,a,c)}));case 4:return process.nextTick((function(){e.call(null,a,c,f)}));default:for(d=new Array(t-1),b=0;b{a.publicEncrypt=c(8902),a.privateDecrypt=c(7362),a.privateEncrypt=function(e,c){return a.publicEncrypt(e,c,!0)},a.publicDecrypt=function(e,c){return a.privateDecrypt(e,c,!0)}},8206:(e,a,c)=>{var f=c(7108),d=c(2861).Buffer;function b(e){var a=d.allocUnsafe(4);return a.writeUInt32BE(e,0),a}e.exports=function(e,a){for(var c,t=d.alloc(0),i=0;t.length=65&&c<=70?c-55:c>=97&&c<=102?c-87:c-48&15}function r(e,a,c){var f=i(e,c);return c-1>=a&&(f|=i(e,c-1)<<4),f}function n(e,a,c,f){for(var d=0,b=Math.min(e.length,c),t=a;t=49?i-49+10:i>=17?i-17+10:i}return d}b.isBN=function(e){return e instanceof b||null!==e&&"object"==typeof e&&e.constructor.wordSize===b.wordSize&&Array.isArray(e.words)},b.max=function(e,a){return e.cmp(a)>0?e:a},b.min=function(e,a){return e.cmp(a)<0?e:a},b.prototype._init=function(e,a,c){if("number"==typeof e)return this._initNumber(e,a,c);if("object"==typeof e)return this._initArray(e,a,c);"hex"===a&&(a=16),f(a===(0|a)&&a>=2&&a<=36);var d=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(d++,this.negative=1),d=0;d-=3)t=e[d]|e[d-1]<<8|e[d-2]<<16,this.words[b]|=t<>>26-i&67108863,(i+=24)>=26&&(i-=26,b++);else if("le"===c)for(d=0,b=0;d>>26-i&67108863,(i+=24)>=26&&(i-=26,b++);return this.strip()},b.prototype._parseHex=function(e,a,c){this.length=Math.ceil((e.length-a)/6),this.words=new Array(this.length);for(var f=0;f=a;f-=2)d=r(e,a,f)<=18?(b-=18,t+=1,this.words[t]|=d>>>26):b+=8;else for(f=(e.length-a)%2==0?a+1:a;f=18?(b-=18,t+=1,this.words[t]|=d>>>26):b+=8;this.strip()},b.prototype._parseBase=function(e,a,c){this.words=[0],this.length=1;for(var f=0,d=1;d<=67108863;d*=a)f++;f--,d=d/a|0;for(var b=e.length-c,t=b%f,i=Math.min(b,b-t)+c,r=0,o=c;o1&&0===this.words[this.length-1];)this.length--;return this._normSign()},b.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},b.prototype.inspect=function(){return(this.red?""};var o=["","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"],s=[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],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function h(e,a,c){c.negative=a.negative^e.negative;var f=e.length+a.length|0;c.length=f,f=f-1|0;var d=0|e.words[0],b=0|a.words[0],t=d*b,i=67108863&t,r=t/67108864|0;c.words[0]=i;for(var n=1;n>>26,s=67108863&r,l=Math.min(n,a.length-1),h=Math.max(0,n-e.length+1);h<=l;h++){var u=n-h|0;o+=(t=(d=0|e.words[u])*(b=0|a.words[h])+s)/67108864|0,s=67108863&t}c.words[n]=0|s,r=0|o}return 0!==r?c.words[n]=0|r:c.length--,c.strip()}b.prototype.toString=function(e,a){var c;if(a=0|a||1,16===(e=e||10)||"hex"===e){c="";for(var d=0,b=0,t=0;t>>24-d&16777215)||t!==this.length-1?o[6-r.length]+r+c:r+c,(d+=2)>=26&&(d-=26,t--)}for(0!==b&&(c=b.toString(16)+c);c.length%a!=0;)c="0"+c;return 0!==this.negative&&(c="-"+c),c}if(e===(0|e)&&e>=2&&e<=36){var n=s[e],h=l[e];c="";var u=this.clone();for(u.negative=0;!u.isZero();){var x=u.modn(h).toString(e);c=(u=u.idivn(h)).isZero()?x+c:o[n-x.length]+x+c}for(this.isZero()&&(c="0"+c);c.length%a!=0;)c="0"+c;return 0!==this.negative&&(c="-"+c),c}f(!1,"Base should be between 2 and 36")},b.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&f(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},b.prototype.toJSON=function(){return this.toString(16)},b.prototype.toBuffer=function(e,a){return f(void 0!==t),this.toArrayLike(t,e,a)},b.prototype.toArray=function(e,a){return this.toArrayLike(Array,e,a)},b.prototype.toArrayLike=function(e,a,c){var d=this.byteLength(),b=c||Math.max(1,d);f(d<=b,"byte array longer than desired length"),f(b>0,"Requested array length <= 0"),this.strip();var t,i,r="le"===a,n=new e(b),o=this.clone();if(r){for(i=0;!o.isZero();i++)t=o.andln(255),o.iushrn(8),n[i]=t;for(;i=4096&&(c+=13,a>>>=13),a>=64&&(c+=7,a>>>=7),a>=8&&(c+=4,a>>>=4),a>=2&&(c+=2,a>>>=2),c+a},b.prototype._zeroBits=function(e){if(0===e)return 26;var a=e,c=0;return 8191&a||(c+=13,a>>>=13),127&a||(c+=7,a>>>=7),15&a||(c+=4,a>>>=4),3&a||(c+=2,a>>>=2),1&a||c++,c},b.prototype.bitLength=function(){var e=this.words[this.length-1],a=this._countBits(e);return 26*(this.length-1)+a},b.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,a=0;ae.length?this.clone().ior(e):e.clone().ior(this)},b.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},b.prototype.iuand=function(e){var a;a=this.length>e.length?e:this;for(var c=0;ce.length?this.clone().iand(e):e.clone().iand(this)},b.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},b.prototype.iuxor=function(e){var a,c;this.length>e.length?(a=this,c=e):(a=e,c=this);for(var f=0;fe.length?this.clone().ixor(e):e.clone().ixor(this)},b.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},b.prototype.inotn=function(e){f("number"==typeof e&&e>=0);var a=0|Math.ceil(e/26),c=e%26;this._expand(a),c>0&&a--;for(var d=0;d0&&(this.words[d]=~this.words[d]&67108863>>26-c),this.strip()},b.prototype.notn=function(e){return this.clone().inotn(e)},b.prototype.setn=function(e,a){f("number"==typeof e&&e>=0);var c=e/26|0,d=e%26;return this._expand(c+1),this.words[c]=a?this.words[c]|1<e.length?(c=this,f=e):(c=e,f=this);for(var d=0,b=0;b>>26;for(;0!==d&&b>>26;if(this.length=c.length,0!==d)this.words[this.length]=d,this.length++;else if(c!==this)for(;be.length?this.clone().iadd(e):e.clone().iadd(this)},b.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var a=this.iadd(e);return e.negative=1,a._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var c,f,d=this.cmp(e);if(0===d)return this.negative=0,this.length=1,this.words[0]=0,this;d>0?(c=this,f=e):(c=e,f=this);for(var b=0,t=0;t>26,this.words[t]=67108863&a;for(;0!==b&&t>26,this.words[t]=67108863&a;if(0===b&&t>>13,h=0|t[1],u=8191&h,x=h>>>13,p=0|t[2],g=8191&p,m=p>>>13,y=0|t[3],_=8191&y,v=y>>>13,w=0|t[4],M=8191&w,A=w>>>13,L=0|t[5],I=8191&L,k=L>>>13,E=0|t[6],S=8191&E,C=E>>>13,B=0|t[7],F=8191&B,O=B>>>13,P=0|t[8],R=8191&P,T=P>>>13,U=0|t[9],j=8191&U,N=U>>>13,q=0|i[0],D=8191&q,z=q>>>13,Q=0|i[1],G=8191&Q,K=Q>>>13,H=0|i[2],V=8191&H,Z=H>>>13,W=0|i[3],Y=8191&W,J=W>>>13,$=0|i[4],X=8191&$,ee=$>>>13,ae=0|i[5],ce=8191&ae,fe=ae>>>13,de=0|i[6],be=8191&de,te=de>>>13,ie=0|i[7],re=8191&ie,ne=ie>>>13,oe=0|i[8],se=8191&oe,le=oe>>>13,he=0|i[9],ue=8191&he,xe=he>>>13;c.negative=e.negative^a.negative,c.length=19;var pe=(n+(f=Math.imul(s,D))|0)+((8191&(d=(d=Math.imul(s,z))+Math.imul(l,D)|0))<<13)|0;n=((b=Math.imul(l,z))+(d>>>13)|0)+(pe>>>26)|0,pe&=67108863,f=Math.imul(u,D),d=(d=Math.imul(u,z))+Math.imul(x,D)|0,b=Math.imul(x,z);var ge=(n+(f=f+Math.imul(s,G)|0)|0)+((8191&(d=(d=d+Math.imul(s,K)|0)+Math.imul(l,G)|0))<<13)|0;n=((b=b+Math.imul(l,K)|0)+(d>>>13)|0)+(ge>>>26)|0,ge&=67108863,f=Math.imul(g,D),d=(d=Math.imul(g,z))+Math.imul(m,D)|0,b=Math.imul(m,z),f=f+Math.imul(u,G)|0,d=(d=d+Math.imul(u,K)|0)+Math.imul(x,G)|0,b=b+Math.imul(x,K)|0;var me=(n+(f=f+Math.imul(s,V)|0)|0)+((8191&(d=(d=d+Math.imul(s,Z)|0)+Math.imul(l,V)|0))<<13)|0;n=((b=b+Math.imul(l,Z)|0)+(d>>>13)|0)+(me>>>26)|0,me&=67108863,f=Math.imul(_,D),d=(d=Math.imul(_,z))+Math.imul(v,D)|0,b=Math.imul(v,z),f=f+Math.imul(g,G)|0,d=(d=d+Math.imul(g,K)|0)+Math.imul(m,G)|0,b=b+Math.imul(m,K)|0,f=f+Math.imul(u,V)|0,d=(d=d+Math.imul(u,Z)|0)+Math.imul(x,V)|0,b=b+Math.imul(x,Z)|0;var ye=(n+(f=f+Math.imul(s,Y)|0)|0)+((8191&(d=(d=d+Math.imul(s,J)|0)+Math.imul(l,Y)|0))<<13)|0;n=((b=b+Math.imul(l,J)|0)+(d>>>13)|0)+(ye>>>26)|0,ye&=67108863,f=Math.imul(M,D),d=(d=Math.imul(M,z))+Math.imul(A,D)|0,b=Math.imul(A,z),f=f+Math.imul(_,G)|0,d=(d=d+Math.imul(_,K)|0)+Math.imul(v,G)|0,b=b+Math.imul(v,K)|0,f=f+Math.imul(g,V)|0,d=(d=d+Math.imul(g,Z)|0)+Math.imul(m,V)|0,b=b+Math.imul(m,Z)|0,f=f+Math.imul(u,Y)|0,d=(d=d+Math.imul(u,J)|0)+Math.imul(x,Y)|0,b=b+Math.imul(x,J)|0;var _e=(n+(f=f+Math.imul(s,X)|0)|0)+((8191&(d=(d=d+Math.imul(s,ee)|0)+Math.imul(l,X)|0))<<13)|0;n=((b=b+Math.imul(l,ee)|0)+(d>>>13)|0)+(_e>>>26)|0,_e&=67108863,f=Math.imul(I,D),d=(d=Math.imul(I,z))+Math.imul(k,D)|0,b=Math.imul(k,z),f=f+Math.imul(M,G)|0,d=(d=d+Math.imul(M,K)|0)+Math.imul(A,G)|0,b=b+Math.imul(A,K)|0,f=f+Math.imul(_,V)|0,d=(d=d+Math.imul(_,Z)|0)+Math.imul(v,V)|0,b=b+Math.imul(v,Z)|0,f=f+Math.imul(g,Y)|0,d=(d=d+Math.imul(g,J)|0)+Math.imul(m,Y)|0,b=b+Math.imul(m,J)|0,f=f+Math.imul(u,X)|0,d=(d=d+Math.imul(u,ee)|0)+Math.imul(x,X)|0,b=b+Math.imul(x,ee)|0;var ve=(n+(f=f+Math.imul(s,ce)|0)|0)+((8191&(d=(d=d+Math.imul(s,fe)|0)+Math.imul(l,ce)|0))<<13)|0;n=((b=b+Math.imul(l,fe)|0)+(d>>>13)|0)+(ve>>>26)|0,ve&=67108863,f=Math.imul(S,D),d=(d=Math.imul(S,z))+Math.imul(C,D)|0,b=Math.imul(C,z),f=f+Math.imul(I,G)|0,d=(d=d+Math.imul(I,K)|0)+Math.imul(k,G)|0,b=b+Math.imul(k,K)|0,f=f+Math.imul(M,V)|0,d=(d=d+Math.imul(M,Z)|0)+Math.imul(A,V)|0,b=b+Math.imul(A,Z)|0,f=f+Math.imul(_,Y)|0,d=(d=d+Math.imul(_,J)|0)+Math.imul(v,Y)|0,b=b+Math.imul(v,J)|0,f=f+Math.imul(g,X)|0,d=(d=d+Math.imul(g,ee)|0)+Math.imul(m,X)|0,b=b+Math.imul(m,ee)|0,f=f+Math.imul(u,ce)|0,d=(d=d+Math.imul(u,fe)|0)+Math.imul(x,ce)|0,b=b+Math.imul(x,fe)|0;var we=(n+(f=f+Math.imul(s,be)|0)|0)+((8191&(d=(d=d+Math.imul(s,te)|0)+Math.imul(l,be)|0))<<13)|0;n=((b=b+Math.imul(l,te)|0)+(d>>>13)|0)+(we>>>26)|0,we&=67108863,f=Math.imul(F,D),d=(d=Math.imul(F,z))+Math.imul(O,D)|0,b=Math.imul(O,z),f=f+Math.imul(S,G)|0,d=(d=d+Math.imul(S,K)|0)+Math.imul(C,G)|0,b=b+Math.imul(C,K)|0,f=f+Math.imul(I,V)|0,d=(d=d+Math.imul(I,Z)|0)+Math.imul(k,V)|0,b=b+Math.imul(k,Z)|0,f=f+Math.imul(M,Y)|0,d=(d=d+Math.imul(M,J)|0)+Math.imul(A,Y)|0,b=b+Math.imul(A,J)|0,f=f+Math.imul(_,X)|0,d=(d=d+Math.imul(_,ee)|0)+Math.imul(v,X)|0,b=b+Math.imul(v,ee)|0,f=f+Math.imul(g,ce)|0,d=(d=d+Math.imul(g,fe)|0)+Math.imul(m,ce)|0,b=b+Math.imul(m,fe)|0,f=f+Math.imul(u,be)|0,d=(d=d+Math.imul(u,te)|0)+Math.imul(x,be)|0,b=b+Math.imul(x,te)|0;var Me=(n+(f=f+Math.imul(s,re)|0)|0)+((8191&(d=(d=d+Math.imul(s,ne)|0)+Math.imul(l,re)|0))<<13)|0;n=((b=b+Math.imul(l,ne)|0)+(d>>>13)|0)+(Me>>>26)|0,Me&=67108863,f=Math.imul(R,D),d=(d=Math.imul(R,z))+Math.imul(T,D)|0,b=Math.imul(T,z),f=f+Math.imul(F,G)|0,d=(d=d+Math.imul(F,K)|0)+Math.imul(O,G)|0,b=b+Math.imul(O,K)|0,f=f+Math.imul(S,V)|0,d=(d=d+Math.imul(S,Z)|0)+Math.imul(C,V)|0,b=b+Math.imul(C,Z)|0,f=f+Math.imul(I,Y)|0,d=(d=d+Math.imul(I,J)|0)+Math.imul(k,Y)|0,b=b+Math.imul(k,J)|0,f=f+Math.imul(M,X)|0,d=(d=d+Math.imul(M,ee)|0)+Math.imul(A,X)|0,b=b+Math.imul(A,ee)|0,f=f+Math.imul(_,ce)|0,d=(d=d+Math.imul(_,fe)|0)+Math.imul(v,ce)|0,b=b+Math.imul(v,fe)|0,f=f+Math.imul(g,be)|0,d=(d=d+Math.imul(g,te)|0)+Math.imul(m,be)|0,b=b+Math.imul(m,te)|0,f=f+Math.imul(u,re)|0,d=(d=d+Math.imul(u,ne)|0)+Math.imul(x,re)|0,b=b+Math.imul(x,ne)|0;var Ae=(n+(f=f+Math.imul(s,se)|0)|0)+((8191&(d=(d=d+Math.imul(s,le)|0)+Math.imul(l,se)|0))<<13)|0;n=((b=b+Math.imul(l,le)|0)+(d>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,f=Math.imul(j,D),d=(d=Math.imul(j,z))+Math.imul(N,D)|0,b=Math.imul(N,z),f=f+Math.imul(R,G)|0,d=(d=d+Math.imul(R,K)|0)+Math.imul(T,G)|0,b=b+Math.imul(T,K)|0,f=f+Math.imul(F,V)|0,d=(d=d+Math.imul(F,Z)|0)+Math.imul(O,V)|0,b=b+Math.imul(O,Z)|0,f=f+Math.imul(S,Y)|0,d=(d=d+Math.imul(S,J)|0)+Math.imul(C,Y)|0,b=b+Math.imul(C,J)|0,f=f+Math.imul(I,X)|0,d=(d=d+Math.imul(I,ee)|0)+Math.imul(k,X)|0,b=b+Math.imul(k,ee)|0,f=f+Math.imul(M,ce)|0,d=(d=d+Math.imul(M,fe)|0)+Math.imul(A,ce)|0,b=b+Math.imul(A,fe)|0,f=f+Math.imul(_,be)|0,d=(d=d+Math.imul(_,te)|0)+Math.imul(v,be)|0,b=b+Math.imul(v,te)|0,f=f+Math.imul(g,re)|0,d=(d=d+Math.imul(g,ne)|0)+Math.imul(m,re)|0,b=b+Math.imul(m,ne)|0,f=f+Math.imul(u,se)|0,d=(d=d+Math.imul(u,le)|0)+Math.imul(x,se)|0,b=b+Math.imul(x,le)|0;var Le=(n+(f=f+Math.imul(s,ue)|0)|0)+((8191&(d=(d=d+Math.imul(s,xe)|0)+Math.imul(l,ue)|0))<<13)|0;n=((b=b+Math.imul(l,xe)|0)+(d>>>13)|0)+(Le>>>26)|0,Le&=67108863,f=Math.imul(j,G),d=(d=Math.imul(j,K))+Math.imul(N,G)|0,b=Math.imul(N,K),f=f+Math.imul(R,V)|0,d=(d=d+Math.imul(R,Z)|0)+Math.imul(T,V)|0,b=b+Math.imul(T,Z)|0,f=f+Math.imul(F,Y)|0,d=(d=d+Math.imul(F,J)|0)+Math.imul(O,Y)|0,b=b+Math.imul(O,J)|0,f=f+Math.imul(S,X)|0,d=(d=d+Math.imul(S,ee)|0)+Math.imul(C,X)|0,b=b+Math.imul(C,ee)|0,f=f+Math.imul(I,ce)|0,d=(d=d+Math.imul(I,fe)|0)+Math.imul(k,ce)|0,b=b+Math.imul(k,fe)|0,f=f+Math.imul(M,be)|0,d=(d=d+Math.imul(M,te)|0)+Math.imul(A,be)|0,b=b+Math.imul(A,te)|0,f=f+Math.imul(_,re)|0,d=(d=d+Math.imul(_,ne)|0)+Math.imul(v,re)|0,b=b+Math.imul(v,ne)|0,f=f+Math.imul(g,se)|0,d=(d=d+Math.imul(g,le)|0)+Math.imul(m,se)|0,b=b+Math.imul(m,le)|0;var Ie=(n+(f=f+Math.imul(u,ue)|0)|0)+((8191&(d=(d=d+Math.imul(u,xe)|0)+Math.imul(x,ue)|0))<<13)|0;n=((b=b+Math.imul(x,xe)|0)+(d>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,f=Math.imul(j,V),d=(d=Math.imul(j,Z))+Math.imul(N,V)|0,b=Math.imul(N,Z),f=f+Math.imul(R,Y)|0,d=(d=d+Math.imul(R,J)|0)+Math.imul(T,Y)|0,b=b+Math.imul(T,J)|0,f=f+Math.imul(F,X)|0,d=(d=d+Math.imul(F,ee)|0)+Math.imul(O,X)|0,b=b+Math.imul(O,ee)|0,f=f+Math.imul(S,ce)|0,d=(d=d+Math.imul(S,fe)|0)+Math.imul(C,ce)|0,b=b+Math.imul(C,fe)|0,f=f+Math.imul(I,be)|0,d=(d=d+Math.imul(I,te)|0)+Math.imul(k,be)|0,b=b+Math.imul(k,te)|0,f=f+Math.imul(M,re)|0,d=(d=d+Math.imul(M,ne)|0)+Math.imul(A,re)|0,b=b+Math.imul(A,ne)|0,f=f+Math.imul(_,se)|0,d=(d=d+Math.imul(_,le)|0)+Math.imul(v,se)|0,b=b+Math.imul(v,le)|0;var ke=(n+(f=f+Math.imul(g,ue)|0)|0)+((8191&(d=(d=d+Math.imul(g,xe)|0)+Math.imul(m,ue)|0))<<13)|0;n=((b=b+Math.imul(m,xe)|0)+(d>>>13)|0)+(ke>>>26)|0,ke&=67108863,f=Math.imul(j,Y),d=(d=Math.imul(j,J))+Math.imul(N,Y)|0,b=Math.imul(N,J),f=f+Math.imul(R,X)|0,d=(d=d+Math.imul(R,ee)|0)+Math.imul(T,X)|0,b=b+Math.imul(T,ee)|0,f=f+Math.imul(F,ce)|0,d=(d=d+Math.imul(F,fe)|0)+Math.imul(O,ce)|0,b=b+Math.imul(O,fe)|0,f=f+Math.imul(S,be)|0,d=(d=d+Math.imul(S,te)|0)+Math.imul(C,be)|0,b=b+Math.imul(C,te)|0,f=f+Math.imul(I,re)|0,d=(d=d+Math.imul(I,ne)|0)+Math.imul(k,re)|0,b=b+Math.imul(k,ne)|0,f=f+Math.imul(M,se)|0,d=(d=d+Math.imul(M,le)|0)+Math.imul(A,se)|0,b=b+Math.imul(A,le)|0;var Ee=(n+(f=f+Math.imul(_,ue)|0)|0)+((8191&(d=(d=d+Math.imul(_,xe)|0)+Math.imul(v,ue)|0))<<13)|0;n=((b=b+Math.imul(v,xe)|0)+(d>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,f=Math.imul(j,X),d=(d=Math.imul(j,ee))+Math.imul(N,X)|0,b=Math.imul(N,ee),f=f+Math.imul(R,ce)|0,d=(d=d+Math.imul(R,fe)|0)+Math.imul(T,ce)|0,b=b+Math.imul(T,fe)|0,f=f+Math.imul(F,be)|0,d=(d=d+Math.imul(F,te)|0)+Math.imul(O,be)|0,b=b+Math.imul(O,te)|0,f=f+Math.imul(S,re)|0,d=(d=d+Math.imul(S,ne)|0)+Math.imul(C,re)|0,b=b+Math.imul(C,ne)|0,f=f+Math.imul(I,se)|0,d=(d=d+Math.imul(I,le)|0)+Math.imul(k,se)|0,b=b+Math.imul(k,le)|0;var Se=(n+(f=f+Math.imul(M,ue)|0)|0)+((8191&(d=(d=d+Math.imul(M,xe)|0)+Math.imul(A,ue)|0))<<13)|0;n=((b=b+Math.imul(A,xe)|0)+(d>>>13)|0)+(Se>>>26)|0,Se&=67108863,f=Math.imul(j,ce),d=(d=Math.imul(j,fe))+Math.imul(N,ce)|0,b=Math.imul(N,fe),f=f+Math.imul(R,be)|0,d=(d=d+Math.imul(R,te)|0)+Math.imul(T,be)|0,b=b+Math.imul(T,te)|0,f=f+Math.imul(F,re)|0,d=(d=d+Math.imul(F,ne)|0)+Math.imul(O,re)|0,b=b+Math.imul(O,ne)|0,f=f+Math.imul(S,se)|0,d=(d=d+Math.imul(S,le)|0)+Math.imul(C,se)|0,b=b+Math.imul(C,le)|0;var Ce=(n+(f=f+Math.imul(I,ue)|0)|0)+((8191&(d=(d=d+Math.imul(I,xe)|0)+Math.imul(k,ue)|0))<<13)|0;n=((b=b+Math.imul(k,xe)|0)+(d>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,f=Math.imul(j,be),d=(d=Math.imul(j,te))+Math.imul(N,be)|0,b=Math.imul(N,te),f=f+Math.imul(R,re)|0,d=(d=d+Math.imul(R,ne)|0)+Math.imul(T,re)|0,b=b+Math.imul(T,ne)|0,f=f+Math.imul(F,se)|0,d=(d=d+Math.imul(F,le)|0)+Math.imul(O,se)|0,b=b+Math.imul(O,le)|0;var Be=(n+(f=f+Math.imul(S,ue)|0)|0)+((8191&(d=(d=d+Math.imul(S,xe)|0)+Math.imul(C,ue)|0))<<13)|0;n=((b=b+Math.imul(C,xe)|0)+(d>>>13)|0)+(Be>>>26)|0,Be&=67108863,f=Math.imul(j,re),d=(d=Math.imul(j,ne))+Math.imul(N,re)|0,b=Math.imul(N,ne),f=f+Math.imul(R,se)|0,d=(d=d+Math.imul(R,le)|0)+Math.imul(T,se)|0,b=b+Math.imul(T,le)|0;var Fe=(n+(f=f+Math.imul(F,ue)|0)|0)+((8191&(d=(d=d+Math.imul(F,xe)|0)+Math.imul(O,ue)|0))<<13)|0;n=((b=b+Math.imul(O,xe)|0)+(d>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,f=Math.imul(j,se),d=(d=Math.imul(j,le))+Math.imul(N,se)|0,b=Math.imul(N,le);var Oe=(n+(f=f+Math.imul(R,ue)|0)|0)+((8191&(d=(d=d+Math.imul(R,xe)|0)+Math.imul(T,ue)|0))<<13)|0;n=((b=b+Math.imul(T,xe)|0)+(d>>>13)|0)+(Oe>>>26)|0,Oe&=67108863;var Pe=(n+(f=Math.imul(j,ue))|0)+((8191&(d=(d=Math.imul(j,xe))+Math.imul(N,ue)|0))<<13)|0;return n=((b=Math.imul(N,xe))+(d>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r[0]=pe,r[1]=ge,r[2]=me,r[3]=ye,r[4]=_e,r[5]=ve,r[6]=we,r[7]=Me,r[8]=Ae,r[9]=Le,r[10]=Ie,r[11]=ke,r[12]=Ee,r[13]=Se,r[14]=Ce,r[15]=Be,r[16]=Fe,r[17]=Oe,r[18]=Pe,0!==n&&(r[19]=n,c.length++),c};function x(e,a,c){return(new p).mulp(e,a,c)}function p(e,a){this.x=e,this.y=a}Math.imul||(u=h),b.prototype.mulTo=function(e,a){var c,f=this.length+e.length;return c=10===this.length&&10===e.length?u(this,e,a):f<63?h(this,e,a):f<1024?function(e,a,c){c.negative=a.negative^e.negative,c.length=e.length+a.length;for(var f=0,d=0,b=0;b>>26)|0)>>>26,t&=67108863}c.words[b]=i,f=t,t=d}return 0!==f?c.words[b]=f:c.length--,c.strip()}(this,e,a):x(this,e,a),c},p.prototype.makeRBT=function(e){for(var a=new Array(e),c=b.prototype._countBits(e)-1,f=0;f>=1;return f},p.prototype.permute=function(e,a,c,f,d,b){for(var t=0;t>>=1)d++;return 1<>>=13,c[2*t+1]=8191&b,b>>>=13;for(t=2*a;t>=26,a+=d/67108864|0,a+=b>>>26,this.words[c]=67108863&b}return 0!==a&&(this.words[c]=a,this.length++),this},b.prototype.muln=function(e){return this.clone().imuln(e)},b.prototype.sqr=function(){return this.mul(this)},b.prototype.isqr=function(){return this.imul(this.clone())},b.prototype.pow=function(e){var a=function(e){for(var a=new Array(e.bitLength()),c=0;c>>d}return a}(e);if(0===a.length)return new b(1);for(var c=this,f=0;f=0);var a,c=e%26,d=(e-c)/26,b=67108863>>>26-c<<26-c;if(0!==c){var t=0;for(a=0;a>>26-c}t&&(this.words[a]=t,this.length++)}if(0!==d){for(a=this.length-1;a>=0;a--)this.words[a+d]=this.words[a];for(a=0;a=0),d=a?(a-a%26)/26:0;var b=e%26,t=Math.min((e-b)/26,this.length),i=67108863^67108863>>>b<t)for(this.length-=t,n=0;n=0&&(0!==o||n>=d);n--){var s=0|this.words[n];this.words[n]=o<<26-b|s>>>b,o=s&i}return r&&0!==o&&(r.words[r.length++]=o),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},b.prototype.ishrn=function(e,a,c){return f(0===this.negative),this.iushrn(e,a,c)},b.prototype.shln=function(e){return this.clone().ishln(e)},b.prototype.ushln=function(e){return this.clone().iushln(e)},b.prototype.shrn=function(e){return this.clone().ishrn(e)},b.prototype.ushrn=function(e){return this.clone().iushrn(e)},b.prototype.testn=function(e){f("number"==typeof e&&e>=0);var a=e%26,c=(e-a)/26,d=1<=0);var a=e%26,c=(e-a)/26;if(f(0===this.negative,"imaskn works only with positive numbers"),this.length<=c)return this;if(0!==a&&c++,this.length=Math.min(c,this.length),0!==a){var d=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},b.prototype.isubn=function(e){if(f("number"==typeof e),f(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(r/67108864|0),this.words[d+c]=67108863&b}for(;d>26,this.words[d+c]=67108863&b;if(0===i)return this.strip();for(f(-1===i),i=0,d=0;d>26,this.words[d]=67108863&b;return this.negative=1,this.strip()},b.prototype._wordDiv=function(e,a){var c=(this.length,e.length),f=this.clone(),d=e,t=0|d.words[d.length-1];0!=(c=26-this._countBits(t))&&(d=d.ushln(c),f.iushln(c),t=0|d.words[d.length-1]);var i,r=f.length-d.length;if("mod"!==a){(i=new b(null)).length=r+1,i.words=new Array(i.length);for(var n=0;n=0;s--){var l=67108864*(0|f.words[d.length+s])+(0|f.words[d.length+s-1]);for(l=Math.min(l/t|0,67108863),f._ishlnsubmul(d,l,s);0!==f.negative;)l--,f.negative=0,f._ishlnsubmul(d,1,s),f.isZero()||(f.negative^=1);i&&(i.words[s]=l)}return i&&i.strip(),f.strip(),"div"!==a&&0!==c&&f.iushrn(c),{div:i||null,mod:f}},b.prototype.divmod=function(e,a,c){return f(!e.isZero()),this.isZero()?{div:new b(0),mod:new b(0)}:0!==this.negative&&0===e.negative?(i=this.neg().divmod(e,a),"mod"!==a&&(d=i.div.neg()),"div"!==a&&(t=i.mod.neg(),c&&0!==t.negative&&t.iadd(e)),{div:d,mod:t}):0===this.negative&&0!==e.negative?(i=this.divmod(e.neg(),a),"mod"!==a&&(d=i.div.neg()),{div:d,mod:i.mod}):this.negative&e.negative?(i=this.neg().divmod(e.neg(),a),"div"!==a&&(t=i.mod.neg(),c&&0!==t.negative&&t.isub(e)),{div:i.div,mod:t}):e.length>this.length||this.cmp(e)<0?{div:new b(0),mod:this}:1===e.length?"div"===a?{div:this.divn(e.words[0]),mod:null}:"mod"===a?{div:null,mod:new b(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new b(this.modn(e.words[0]))}:this._wordDiv(e,a);var d,t,i},b.prototype.div=function(e){return this.divmod(e,"div",!1).div},b.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},b.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},b.prototype.divRound=function(e){var a=this.divmod(e);if(a.mod.isZero())return a.div;var c=0!==a.div.negative?a.mod.isub(e):a.mod,f=e.ushrn(1),d=e.andln(1),b=c.cmp(f);return b<0||1===d&&0===b?a.div:0!==a.div.negative?a.div.isubn(1):a.div.iaddn(1)},b.prototype.modn=function(e){f(e<=67108863);for(var a=(1<<26)%e,c=0,d=this.length-1;d>=0;d--)c=(a*c+(0|this.words[d]))%e;return c},b.prototype.idivn=function(e){f(e<=67108863);for(var a=0,c=this.length-1;c>=0;c--){var d=(0|this.words[c])+67108864*a;this.words[c]=d/e|0,a=d%e}return this.strip()},b.prototype.divn=function(e){return this.clone().idivn(e)},b.prototype.egcd=function(e){f(0===e.negative),f(!e.isZero());var a=this,c=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var d=new b(1),t=new b(0),i=new b(0),r=new b(1),n=0;a.isEven()&&c.isEven();)a.iushrn(1),c.iushrn(1),++n;for(var o=c.clone(),s=a.clone();!a.isZero();){for(var l=0,h=1;!(a.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(a.iushrn(l);l-- >0;)(d.isOdd()||t.isOdd())&&(d.iadd(o),t.isub(s)),d.iushrn(1),t.iushrn(1);for(var u=0,x=1;!(c.words[0]&x)&&u<26;++u,x<<=1);if(u>0)for(c.iushrn(u);u-- >0;)(i.isOdd()||r.isOdd())&&(i.iadd(o),r.isub(s)),i.iushrn(1),r.iushrn(1);a.cmp(c)>=0?(a.isub(c),d.isub(i),t.isub(r)):(c.isub(a),i.isub(d),r.isub(t))}return{a:i,b:r,gcd:c.iushln(n)}},b.prototype._invmp=function(e){f(0===e.negative),f(!e.isZero());var a=this,c=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var d,t=new b(1),i=new b(0),r=c.clone();a.cmpn(1)>0&&c.cmpn(1)>0;){for(var n=0,o=1;!(a.words[0]&o)&&n<26;++n,o<<=1);if(n>0)for(a.iushrn(n);n-- >0;)t.isOdd()&&t.iadd(r),t.iushrn(1);for(var s=0,l=1;!(c.words[0]&l)&&s<26;++s,l<<=1);if(s>0)for(c.iushrn(s);s-- >0;)i.isOdd()&&i.iadd(r),i.iushrn(1);a.cmp(c)>=0?(a.isub(c),t.isub(i)):(c.isub(a),i.isub(t))}return(d=0===a.cmpn(1)?t:i).cmpn(0)<0&&d.iadd(e),d},b.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var a=this.clone(),c=e.clone();a.negative=0,c.negative=0;for(var f=0;a.isEven()&&c.isEven();f++)a.iushrn(1),c.iushrn(1);for(;;){for(;a.isEven();)a.iushrn(1);for(;c.isEven();)c.iushrn(1);var d=a.cmp(c);if(d<0){var b=a;a=c,c=b}else if(0===d||0===c.cmpn(1))break;a.isub(c)}return c.iushln(f)},b.prototype.invm=function(e){return this.egcd(e).a.umod(e)},b.prototype.isEven=function(){return!(1&this.words[0])},b.prototype.isOdd=function(){return!(1&~this.words[0])},b.prototype.andln=function(e){return this.words[0]&e},b.prototype.bincn=function(e){f("number"==typeof e);var a=e%26,c=(e-a)/26,d=1<>>26,i&=67108863,this.words[t]=i}return 0!==b&&(this.words[t]=b,this.length++),this},b.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},b.prototype.cmpn=function(e){var a,c=e<0;if(0!==this.negative&&!c)return-1;if(0===this.negative&&c)return 1;if(this.strip(),this.length>1)a=1;else{c&&(e=-e),f(e<=67108863,"Number is too big");var d=0|this.words[0];a=d===e?0:de.length)return 1;if(this.length=0;c--){var f=0|this.words[c],d=0|e.words[c];if(f!==d){fd&&(a=1);break}}return a},b.prototype.gtn=function(e){return 1===this.cmpn(e)},b.prototype.gt=function(e){return 1===this.cmp(e)},b.prototype.gten=function(e){return this.cmpn(e)>=0},b.prototype.gte=function(e){return this.cmp(e)>=0},b.prototype.ltn=function(e){return-1===this.cmpn(e)},b.prototype.lt=function(e){return-1===this.cmp(e)},b.prototype.lten=function(e){return this.cmpn(e)<=0},b.prototype.lte=function(e){return this.cmp(e)<=0},b.prototype.eqn=function(e){return 0===this.cmpn(e)},b.prototype.eq=function(e){return 0===this.cmp(e)},b.red=function(e){return new M(e)},b.prototype.toRed=function(e){return f(!this.red,"Already a number in reduction context"),f(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},b.prototype.fromRed=function(){return f(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},b.prototype._forceRed=function(e){return this.red=e,this},b.prototype.forceRed=function(e){return f(!this.red,"Already a number in reduction context"),this._forceRed(e)},b.prototype.redAdd=function(e){return f(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},b.prototype.redIAdd=function(e){return f(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},b.prototype.redSub=function(e){return f(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},b.prototype.redISub=function(e){return f(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},b.prototype.redShl=function(e){return f(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},b.prototype.redMul=function(e){return f(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},b.prototype.redIMul=function(e){return f(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},b.prototype.redSqr=function(){return f(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},b.prototype.redISqr=function(){return f(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},b.prototype.redSqrt=function(){return f(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},b.prototype.redInvm=function(){return f(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},b.prototype.redNeg=function(){return f(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},b.prototype.redPow=function(e){return f(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function m(e,a){this.name=e,this.p=new b(a,16),this.n=this.p.bitLength(),this.k=new b(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(e){if("string"==typeof e){var a=b._prime(e);this.m=a.p,this.prime=a}else f(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function A(e){M.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new b(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)}m.prototype._tmp=function(){var e=new b(null);return e.words=new Array(Math.ceil(this.n/13)),e},m.prototype.ireduce=function(e){var a,c=e;do{this.split(c,this.tmp),a=(c=(c=this.imulK(c)).iadd(this.tmp)).bitLength()}while(a>this.n);var f=a0?c.isub(this.p):void 0!==c.strip?c.strip():c._strip(),c},m.prototype.split=function(e,a){e.iushrn(this.n,0,a)},m.prototype.imulK=function(e){return e.imul(this.k)},d(y,m),y.prototype.split=function(e,a){for(var c=4194303,f=Math.min(e.length,9),d=0;d>>22,b=t}b>>>=22,e.words[d-10]=b,0===b&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var a=0,c=0;c>>=26,e.words[c]=d,a=f}return 0!==a&&(e.words[e.length++]=a),e},b._prime=function(e){if(g[e])return g[e];var a;if("k256"===e)a=new y;else if("p224"===e)a=new _;else if("p192"===e)a=new v;else{if("p25519"!==e)throw new Error("Unknown prime "+e);a=new w}return g[e]=a,a},M.prototype._verify1=function(e){f(0===e.negative,"red works only with positives"),f(e.red,"red works only with red numbers")},M.prototype._verify2=function(e,a){f(!(e.negative|a.negative),"red works only with positives"),f(e.red&&e.red===a.red,"red works only with red numbers")},M.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},M.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},M.prototype.add=function(e,a){this._verify2(e,a);var c=e.add(a);return c.cmp(this.m)>=0&&c.isub(this.m),c._forceRed(this)},M.prototype.iadd=function(e,a){this._verify2(e,a);var c=e.iadd(a);return c.cmp(this.m)>=0&&c.isub(this.m),c},M.prototype.sub=function(e,a){this._verify2(e,a);var c=e.sub(a);return c.cmpn(0)<0&&c.iadd(this.m),c._forceRed(this)},M.prototype.isub=function(e,a){this._verify2(e,a);var c=e.isub(a);return c.cmpn(0)<0&&c.iadd(this.m),c},M.prototype.shl=function(e,a){return this._verify1(e),this.imod(e.ushln(a))},M.prototype.imul=function(e,a){return this._verify2(e,a),this.imod(e.imul(a))},M.prototype.mul=function(e,a){return this._verify2(e,a),this.imod(e.mul(a))},M.prototype.isqr=function(e){return this.imul(e,e.clone())},M.prototype.sqr=function(e){return this.mul(e,e)},M.prototype.sqrt=function(e){if(e.isZero())return e.clone();var a=this.m.andln(3);if(f(a%2==1),3===a){var c=this.m.add(new b(1)).iushrn(2);return this.pow(e,c)}for(var d=this.m.subn(1),t=0;!d.isZero()&&0===d.andln(1);)t++,d.iushrn(1);f(!d.isZero());var i=new b(1).toRed(this),r=i.redNeg(),n=this.m.subn(1).iushrn(1),o=this.m.bitLength();for(o=new b(2*o*o).toRed(this);0!==this.pow(o,n).cmp(r);)o.redIAdd(r);for(var s=this.pow(o,d),l=this.pow(e,d.addn(1).iushrn(1)),h=this.pow(e,d),u=t;0!==h.cmp(i);){for(var x=h,p=0;0!==x.cmp(i);p++)x=x.redSqr();f(p=0;f--){for(var n=a.words[f],o=r-1;o>=0;o--){var s=n>>o&1;d!==c[0]&&(d=this.sqr(d)),0!==s||0!==t?(t<<=1,t|=s,(4==++i||0===f&&0===o)&&(d=this.mul(d,c[t]),i=0,t=0)):i=0}r=26}return d},M.prototype.convertTo=function(e){var a=e.umod(this.m);return a===e?a.clone():a},M.prototype.convertFrom=function(e){var a=e.clone();return a.red=null,a},b.mont=function(e){return new A(e)},d(A,M),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var a=this.imod(e.mul(this.rinv));return a.red=null,a},A.prototype.imul=function(e,a){if(e.isZero()||a.isZero())return e.words[0]=0,e.length=1,e;var c=e.imul(a),f=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),d=c.isub(f).iushrn(this.shift),b=d;return d.cmp(this.m)>=0?b=d.isub(this.m):d.cmpn(0)<0&&(b=d.iadd(this.m)),b._forceRed(this)},A.prototype.mul=function(e,a){if(e.isZero()||a.isZero())return new b(0)._forceRed(this);var c=e.mul(a),f=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),d=c.isub(f).iushrn(this.shift),t=d;return d.cmp(this.m)>=0?t=d.isub(this.m):d.cmpn(0)<0&&(t=d.iadd(this.m)),t._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=c.nmd(e),this)},7362:(e,a,c)=>{var f=c(8170),d=c(8206),b=c(2061),t=c(2509),i=c(7332),r=c(7108),n=c(9247),o=c(2861).Buffer;e.exports=function(e,a,c){var s;s=e.padding?e.padding:c?1:4;var l,h=f(e),u=h.modulus.byteLength();if(a.length>u||new t(a).cmp(h.modulus)>=0)throw new Error("decryption error");l=c?n(new t(a),h):i(a,h);var x=o.alloc(u-l.length);if(l=o.concat([x,l],u),4===s)return function(e,a){var c=e.modulus.byteLength(),f=r("sha1").update(o.alloc(0)).digest(),t=f.length;if(0!==a[0])throw new Error("decryption error");var i=a.slice(1,t+1),n=a.slice(t+1),s=b(i,d(n,t)),l=b(n,d(s,c-t-1));if(function(e,a){e=o.from(e),a=o.from(a);var c=0,f=e.length;e.length!==a.length&&(c++,f=Math.min(e.length,a.length));for(var d=-1;++d=a.length){b++;break}var t=a.slice(2,d-1);if(("0002"!==f.toString("hex")&&!c||"0001"!==f.toString("hex")&&c)&&b++,t.length<8&&b++,b)throw new Error("decryption error");return a.slice(d)}(0,l,c);if(3===s)return l;throw new Error("unknown padding")}},8902:(e,a,c)=>{var f=c(8170),d=c(3209),b=c(7108),t=c(8206),i=c(2061),r=c(2509),n=c(9247),o=c(7332),s=c(2861).Buffer;e.exports=function(e,a,c){var l;l=e.padding?e.padding:c?1:4;var h,u=f(e);if(4===l)h=function(e,a){var c=e.modulus.byteLength(),f=a.length,n=b("sha1").update(s.alloc(0)).digest(),o=n.length,l=2*o;if(f>c-l-2)throw new Error("message too long");var h=s.alloc(c-f-l-2),u=c-o-1,x=d(o),p=i(s.concat([n,h,s.alloc(1,1),a],u),t(x,u)),g=i(x,t(p,o));return new r(s.concat([s.alloc(1),g,p],c))}(u,a);else if(1===l)h=function(e,a,c){var f,b=a.length,t=e.modulus.byteLength();if(b>t-11)throw new Error("message too long");return f=c?s.alloc(t-b-3,255):function(e){for(var a,c=s.allocUnsafe(e),f=0,b=d(2*e),t=0;f=0)throw new Error("data too long for modulus")}return c?o(h,u):n(h,u)}},9247:(e,a,c)=>{var f=c(2509),d=c(2861).Buffer;e.exports=function(e,a){return d.from(e.toRed(f.mont(a.modulus)).redPow(new f(a.publicExponent)).fromRed().toArray())}},2061:e=>{e.exports=function(e,a){for(var c=e.length,f=-1;++f{"use strict";var f=65536,d=c(2861).Buffer,b=c.g.crypto||c.g.msCrypto;b&&b.getRandomValues?e.exports=function(e,a){if(e>4294967295)throw new RangeError("requested too many random bytes");var c=d.allocUnsafe(e);if(e>0)if(e>f)for(var t=0;t{"use strict";function f(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var d=c(2861),b=c(3209),t=d.Buffer,i=d.kMaxLength,r=c.g.crypto||c.g.msCrypto,n=Math.pow(2,32)-1;function o(e,a){if("number"!=typeof e||e!=e)throw new TypeError("offset must be a number");if(e>n||e<0)throw new TypeError("offset must be a uint32");if(e>i||e>a)throw new RangeError("offset out of range")}function s(e,a,c){if("number"!=typeof e||e!=e)throw new TypeError("size must be a number");if(e>n||e<0)throw new TypeError("size must be a uint32");if(e+a>c||e>i)throw new RangeError("buffer too small")}function l(e,a,c,f){if(process.browser){var d=e.buffer,t=new Uint8Array(d,a,c);return r.getRandomValues(t),f?void process.nextTick((function(){f(null,e)})):e}if(!f)return b(c).copy(e,a),e;b(c,(function(c,d){if(c)return f(c);d.copy(e,a),f(null,e)}))}r&&r.getRandomValues||!process.browser?(a.randomFill=function(e,a,f,d){if(!(t.isBuffer(e)||e instanceof c.g.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof a)d=a,a=0,f=e.length;else if("function"==typeof f)d=f,f=e.length-a;else if("function"!=typeof d)throw new TypeError('"cb" argument must be a function');return o(a,e.length),s(f,a,e.length),l(e,a,f,d)},a.randomFillSync=function(e,a,f){if(void 0===a&&(a=0),!(t.isBuffer(e)||e instanceof c.g.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return o(a,e.length),void 0===f&&(f=e.length-a),s(f,a,e.length),l(e,a,f)}):(a.randomFill=f,a.randomFillSync=f)},6048:e=>{"use strict";var a={};function c(e,c,f){f||(f=Error);var d=function(e){var a,f;function d(a,f,d){return e.call(this,function(e,a,f){return"string"==typeof c?c:c(e,a,f)}(a,f,d))||this}return f=e,(a=d).prototype=Object.create(f.prototype),a.prototype.constructor=a,a.__proto__=f,d}(f);d.prototype.name=f.name,d.prototype.code=e,a[e]=d}function f(e,a){if(Array.isArray(e)){var c=e.length;return e=e.map((function(e){return String(e)})),c>2?"one of ".concat(a," ").concat(e.slice(0,c-1).join(", "),", or ")+e[c-1]:2===c?"one of ".concat(a," ").concat(e[0]," or ").concat(e[1]):"of ".concat(a," ").concat(e[0])}return"of ".concat(a," ").concat(String(e))}c("ERR_INVALID_OPT_VALUE",(function(e,a){return'The value "'+a+'" is invalid for option "'+e+'"'}),TypeError),c("ERR_INVALID_ARG_TYPE",(function(e,a,c){var d,b,t,i,r;if("string"==typeof a&&(b="not ",a.substr(0,4)===b)?(d="must not be",a=a.replace(/^not /,"")):d="must be",function(e,a,c){return(void 0===c||c>e.length)&&(c=e.length),e.substring(c-9,c)===a}(e," argument"))t="The ".concat(e," ").concat(d," ").concat(f(a,"type"));else{var n=("number"!=typeof r&&(r=0),r+1>(i=e).length||-1===i.indexOf(".",r)?"argument":"property");t='The "'.concat(e,'" ').concat(n," ").concat(d," ").concat(f(a,"type"))}return t+". Received type ".concat(typeof c)}),TypeError),c("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),c("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),c("ERR_STREAM_PREMATURE_CLOSE","Premature close"),c("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),c("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),c("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),c("ERR_STREAM_WRITE_AFTER_END","write after end"),c("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),c("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),c("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.F=a},5382:(e,a,c)=>{"use strict";var f=Object.keys||function(e){var a=[];for(var c in e)a.push(c);return a};e.exports=n;var d=c(5412),b=c(6708);c(6698)(n,d);for(var t=f(b.prototype),i=0;i{"use strict";e.exports=d;var f=c(4610);function d(e){if(!(this instanceof d))return new d(e);f.call(this,e)}c(6698)(d,f),d.prototype._transform=function(e,a,c){c(null,e)}},5412:(e,a,c)=>{"use strict";var f;e.exports=A,A.ReadableState=M,c(7007).EventEmitter;var d,b=function(e,a){return e.listeners(a).length},t=c(345),i=c(8287).Buffer,r=(void 0!==c.g?c.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},n=c(9838);d=n&&n.debuglog?n.debuglog("stream"):function(){};var o,s,l,h=c(2726),u=c(5896),x=c(5291).getHighWaterMark,p=c(6048).F,g=p.ERR_INVALID_ARG_TYPE,m=p.ERR_STREAM_PUSH_AFTER_EOF,y=p.ERR_METHOD_NOT_IMPLEMENTED,_=p.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;c(6698)(A,t);var v=u.errorOrDestroy,w=["error","close","destroy","pause","resume"];function M(e,a,d){f=f||c(5382),e=e||{},"boolean"!=typeof d&&(d=a instanceof f),this.objectMode=!!e.objectMode,d&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=x(this,e,"readableHighWaterMark",d),this.buffer=new h,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(o||(o=c(3141).I),this.decoder=new o(e.encoding),this.encoding=e.encoding)}function A(e){if(f=f||c(5382),!(this instanceof A))return new A(e);var a=this instanceof f;this._readableState=new M(e,this,a),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),t.call(this)}function L(e,a,c,f,b){d("readableAddChunk",a);var t,n=e._readableState;if(null===a)n.reading=!1,function(e,a){if(d("onEofChunk"),!a.ended){if(a.decoder){var c=a.decoder.end();c&&c.length&&(a.buffer.push(c),a.length+=a.objectMode?1:c.length)}a.ended=!0,a.sync?S(e):(a.needReadable=!1,a.emittedReadable||(a.emittedReadable=!0,C(e)))}}(e,n);else if(b||(t=function(e,a){var c,f;return f=a,i.isBuffer(f)||f instanceof r||"string"==typeof a||void 0===a||e.objectMode||(c=new g("chunk",["string","Buffer","Uint8Array"],a)),c}(n,a)),t)v(e,t);else if(n.objectMode||a&&a.length>0)if("string"==typeof a||n.objectMode||Object.getPrototypeOf(a)===i.prototype||(a=function(e){return i.from(e)}(a)),f)n.endEmitted?v(e,new _):I(e,n,a,!0);else if(n.ended)v(e,new m);else{if(n.destroyed)return!1;n.reading=!1,n.decoder&&!c?(a=n.decoder.write(a),n.objectMode||0!==a.length?I(e,n,a,!1):B(e,n)):I(e,n,a,!1)}else f||(n.reading=!1,B(e,n));return!n.ended&&(n.lengtha.highWaterMark&&(a.highWaterMark=function(e){return e>=k?e=k:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=a.length?e:a.ended?a.length:(a.needReadable=!0,0))}function S(e){var a=e._readableState;d("emitReadable",a.needReadable,a.emittedReadable),a.needReadable=!1,a.emittedReadable||(d("emitReadable",a.flowing),a.emittedReadable=!0,process.nextTick(C,e))}function C(e){var a=e._readableState;d("emitReadable_",a.destroyed,a.length,a.ended),a.destroyed||!a.length&&!a.ended||(e.emit("readable"),a.emittedReadable=!1),a.needReadable=!a.flowing&&!a.ended&&a.length<=a.highWaterMark,T(e)}function B(e,a){a.readingMore||(a.readingMore=!0,process.nextTick(F,e,a))}function F(e,a){for(;!a.reading&&!a.ended&&(a.length0,a.resumeScheduled&&!a.paused?a.flowing=!0:e.listenerCount("data")>0&&e.resume()}function P(e){d("readable nexttick read 0"),e.read(0)}function R(e,a){d("resume",a.reading),a.reading||e.read(0),a.resumeScheduled=!1,e.emit("resume"),T(e),a.flowing&&!a.reading&&e.read(0)}function T(e){var a=e._readableState;for(d("flow",a.flowing);a.flowing&&null!==e.read(););}function U(e,a){return 0===a.length?null:(a.objectMode?c=a.buffer.shift():!e||e>=a.length?(c=a.decoder?a.buffer.join(""):1===a.buffer.length?a.buffer.first():a.buffer.concat(a.length),a.buffer.clear()):c=a.buffer.consume(e,a.decoder),c);var c}function j(e){var a=e._readableState;d("endReadable",a.endEmitted),a.endEmitted||(a.ended=!0,process.nextTick(N,a,e))}function N(e,a){if(d("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,a.readable=!1,a.emit("end"),e.autoDestroy)){var c=a._writableState;(!c||c.autoDestroy&&c.finished)&&a.destroy()}}function q(e,a){for(var c=0,f=e.length;c=a.highWaterMark:a.length>0)||a.ended))return d("read: emitReadable",a.length,a.ended),0===a.length&&a.ended?j(this):S(this),null;if(0===(e=E(e,a))&&a.ended)return 0===a.length&&j(this),null;var f,b=a.needReadable;return d("need readable",b),(0===a.length||a.length-e0?U(e,a):null)?(a.needReadable=a.length<=a.highWaterMark,e=0):(a.length-=e,a.awaitDrain=0),0===a.length&&(a.ended||(a.needReadable=!0),c!==e&&a.ended&&j(this)),null!==f&&this.emit("data",f),f},A.prototype._read=function(e){v(this,new y("_read()"))},A.prototype.pipe=function(e,a){var c=this,f=this._readableState;switch(f.pipesCount){case 0:f.pipes=e;break;case 1:f.pipes=[f.pipes,e];break;default:f.pipes.push(e)}f.pipesCount+=1,d("pipe count=%d opts=%j",f.pipesCount,a);var t=a&&!1===a.end||e===process.stdout||e===process.stderr?u:i;function i(){d("onend"),e.end()}f.endEmitted?process.nextTick(t):c.once("end",t),e.on("unpipe",(function a(b,t){d("onunpipe"),b===c&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,d("cleanup"),e.removeListener("close",l),e.removeListener("finish",h),e.removeListener("drain",r),e.removeListener("error",s),e.removeListener("unpipe",a),c.removeListener("end",i),c.removeListener("end",u),c.removeListener("data",o),n=!0,!f.awaitDrain||e._writableState&&!e._writableState.needDrain||r())}));var r=function(e){return function(){var a=e._readableState;d("pipeOnDrain",a.awaitDrain),a.awaitDrain&&a.awaitDrain--,0===a.awaitDrain&&b(e,"data")&&(a.flowing=!0,T(e))}}(c);e.on("drain",r);var n=!1;function o(a){d("ondata");var b=e.write(a);d("dest.write",b),!1===b&&((1===f.pipesCount&&f.pipes===e||f.pipesCount>1&&-1!==q(f.pipes,e))&&!n&&(d("false write response, pause",f.awaitDrain),f.awaitDrain++),c.pause())}function s(a){d("onerror",a),u(),e.removeListener("error",s),0===b(e,"error")&&v(e,a)}function l(){e.removeListener("finish",h),u()}function h(){d("onfinish"),e.removeListener("close",l),u()}function u(){d("unpipe"),c.unpipe(e)}return c.on("data",o),function(e,a,c){if("function"==typeof e.prependListener)return e.prependListener(a,c);e._events&&e._events[a]?Array.isArray(e._events[a])?e._events[a].unshift(c):e._events[a]=[c,e._events[a]]:e.on(a,c)}(e,"error",s),e.once("close",l),e.once("finish",h),e.emit("pipe",c),f.flowing||(d("pipe resume"),c.resume()),e},A.prototype.unpipe=function(e){var a=this._readableState,c={hasUnpiped:!1};if(0===a.pipesCount)return this;if(1===a.pipesCount)return e&&e!==a.pipes||(e||(e=a.pipes),a.pipes=null,a.pipesCount=0,a.flowing=!1,e&&e.emit("unpipe",this,c)),this;if(!e){var f=a.pipes,d=a.pipesCount;a.pipes=null,a.pipesCount=0,a.flowing=!1;for(var b=0;b0,!1!==f.flowing&&this.resume()):"readable"===e&&(f.endEmitted||f.readableListening||(f.readableListening=f.needReadable=!0,f.flowing=!1,f.emittedReadable=!1,d("on readable",f.length,f.reading),f.length?S(this):f.reading||process.nextTick(P,this))),c},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(e,a){var c=t.prototype.removeListener.call(this,e,a);return"readable"===e&&process.nextTick(O,this),c},A.prototype.removeAllListeners=function(e){var a=t.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(O,this),a},A.prototype.resume=function(){var e=this._readableState;return e.flowing||(d("resume"),e.flowing=!e.readableListening,function(e,a){a.resumeScheduled||(a.resumeScheduled=!0,process.nextTick(R,e,a))}(this,e)),e.paused=!1,this},A.prototype.pause=function(){return d("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(d("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},A.prototype.wrap=function(e){var a=this,c=this._readableState,f=!1;for(var b in e.on("end",(function(){if(d("wrapped end"),c.decoder&&!c.ended){var e=c.decoder.end();e&&e.length&&a.push(e)}a.push(null)})),e.on("data",(function(b){d("wrapped data"),c.decoder&&(b=c.decoder.write(b)),c.objectMode&&null==b||(c.objectMode||b&&b.length)&&(a.push(b)||(f=!0,e.pause()))})),e)void 0===this[b]&&"function"==typeof e[b]&&(this[b]=function(a){return function(){return e[a].apply(e,arguments)}}(b));for(var t=0;t{"use strict";e.exports=o;var f=c(6048).F,d=f.ERR_METHOD_NOT_IMPLEMENTED,b=f.ERR_MULTIPLE_CALLBACK,t=f.ERR_TRANSFORM_ALREADY_TRANSFORMING,i=f.ERR_TRANSFORM_WITH_LENGTH_0,r=c(5382);function n(e,a){var c=this._transformState;c.transforming=!1;var f=c.writecb;if(null===f)return this.emit("error",new b);c.writechunk=null,c.writecb=null,null!=a&&this.push(a),f(e);var d=this._readableState;d.reading=!1,(d.needReadable||d.length{"use strict";function f(e){var a=this;this.next=null,this.entry=null,this.finish=function(){!function(e,a){var c=e.entry;for(e.entry=null;c;){var f=c.callback;a.pendingcb--,f(undefined),c=c.next}a.corkedRequestsFree.next=e}(a,e)}}var d;e.exports=A,A.WritableState=M;var b,t={deprecate:c(4643)},i=c(345),r=c(8287).Buffer,n=(void 0!==c.g?c.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},o=c(5896),s=c(5291).getHighWaterMark,l=c(6048).F,h=l.ERR_INVALID_ARG_TYPE,u=l.ERR_METHOD_NOT_IMPLEMENTED,x=l.ERR_MULTIPLE_CALLBACK,p=l.ERR_STREAM_CANNOT_PIPE,g=l.ERR_STREAM_DESTROYED,m=l.ERR_STREAM_NULL_VALUES,y=l.ERR_STREAM_WRITE_AFTER_END,_=l.ERR_UNKNOWN_ENCODING,v=o.errorOrDestroy;function w(){}function M(e,a,b){d=d||c(5382),e=e||{},"boolean"!=typeof b&&(b=a instanceof d),this.objectMode=!!e.objectMode,b&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=s(this,e,"writableHighWaterMark",b),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var t=!1===e.decodeStrings;this.decodeStrings=!t,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,a){var c=e._writableState,f=c.sync,d=c.writecb;if("function"!=typeof d)throw new x;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(c),a)!function(e,a,c,f,d){--a.pendingcb,c?(process.nextTick(d,f),process.nextTick(C,e,a),e._writableState.errorEmitted=!0,v(e,f)):(d(f),e._writableState.errorEmitted=!0,v(e,f),C(e,a))}(e,c,f,a,d);else{var b=E(c)||e.destroyed;b||c.corked||c.bufferProcessing||!c.bufferedRequest||k(e,c),f?process.nextTick(I,e,c,b,d):I(e,c,b,d)}}(a,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new f(this)}function A(e){var a=this instanceof(d=d||c(5382));if(!a&&!b.call(A,this))return new A(e);this._writableState=new M(e,this,a),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),i.call(this)}function L(e,a,c,f,d,b,t){a.writelen=f,a.writecb=t,a.writing=!0,a.sync=!0,a.destroyed?a.onwrite(new g("write")):c?e._writev(d,a.onwrite):e._write(d,b,a.onwrite),a.sync=!1}function I(e,a,c,f){c||function(e,a){0===a.length&&a.needDrain&&(a.needDrain=!1,e.emit("drain"))}(e,a),a.pendingcb--,f(),C(e,a)}function k(e,a){a.bufferProcessing=!0;var c=a.bufferedRequest;if(e._writev&&c&&c.next){var d=a.bufferedRequestCount,b=new Array(d),t=a.corkedRequestsFree;t.entry=c;for(var i=0,r=!0;c;)b[i]=c,c.isBuf||(r=!1),c=c.next,i+=1;b.allBuffers=r,L(e,a,!0,a.length,b,"",t.finish),a.pendingcb++,a.lastBufferedRequest=null,t.next?(a.corkedRequestsFree=t.next,t.next=null):a.corkedRequestsFree=new f(a),a.bufferedRequestCount=0}else{for(;c;){var n=c.chunk,o=c.encoding,s=c.callback;if(L(e,a,!1,a.objectMode?1:n.length,n,o,s),c=c.next,a.bufferedRequestCount--,a.writing)break}null===c&&(a.lastBufferedRequest=null)}a.bufferedRequest=c,a.bufferProcessing=!1}function E(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function S(e,a){e._final((function(c){a.pendingcb--,c&&v(e,c),a.prefinished=!0,e.emit("prefinish"),C(e,a)}))}function C(e,a){var c=E(a);if(c&&(function(e,a){a.prefinished||a.finalCalled||("function"!=typeof e._final||a.destroyed?(a.prefinished=!0,e.emit("prefinish")):(a.pendingcb++,a.finalCalled=!0,process.nextTick(S,e,a)))}(e,a),0===a.pendingcb&&(a.finished=!0,e.emit("finish"),a.autoDestroy))){var f=e._readableState;(!f||f.autoDestroy&&f.endEmitted)&&e.destroy()}return c}c(6698)(A,i),M.prototype.getBuffer=function(){for(var e=this.bufferedRequest,a=[];e;)a.push(e),e=e.next;return a},function(){try{Object.defineProperty(M.prototype,"buffer",{get:t.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(b=Function.prototype[Symbol.hasInstance],Object.defineProperty(A,Symbol.hasInstance,{value:function(e){return!!b.call(this,e)||this===A&&e&&e._writableState instanceof M}})):b=function(e){return e instanceof this},A.prototype.pipe=function(){v(this,new p)},A.prototype.write=function(e,a,c){var f,d=this._writableState,b=!1,t=!d.objectMode&&(f=e,r.isBuffer(f)||f instanceof n);return t&&!r.isBuffer(e)&&(e=function(e){return r.from(e)}(e)),"function"==typeof a&&(c=a,a=null),t?a="buffer":a||(a=d.defaultEncoding),"function"!=typeof c&&(c=w),d.ending?function(e,a){var c=new y;v(e,c),process.nextTick(a,c)}(this,c):(t||function(e,a,c,f){var d;return null===c?d=new m:"string"==typeof c||a.objectMode||(d=new h("chunk",["string","Buffer"],c)),!d||(v(e,d),process.nextTick(f,d),!1)}(this,d,e,c))&&(d.pendingcb++,b=function(e,a,c,f,d,b){if(!c){var t=function(e,a,c){return e.objectMode||!1===e.decodeStrings||"string"!=typeof a||(a=r.from(a,c)),a}(a,f,d);f!==t&&(c=!0,d="buffer",f=t)}var i=a.objectMode?1:f.length;a.length+=i;var n=a.length-1))throw new _(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(e,a,c){c(new u("_write()"))},A.prototype._writev=null,A.prototype.end=function(e,a,c){var f=this._writableState;return"function"==typeof e?(c=e,e=null,a=null):"function"==typeof a&&(c=a,a=null),null!=e&&this.write(e,a),f.corked&&(f.corked=1,this.uncork()),f.ending||function(e,a,c){a.ending=!0,C(e,a),c&&(a.finished?process.nextTick(c):e.once("finish",c)),a.ended=!0,e.writable=!1}(this,f,c),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),A.prototype.destroy=o.destroy,A.prototype._undestroy=o.undestroy,A.prototype._destroy=function(e,a){a(e)}},2955:(e,a,c)=>{"use strict";var f;function d(e,a,c){return(a=function(e){var a=function(e){if("object"!=typeof e||null===e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var c=a.call(e,"string");if("object"!=typeof c)return c;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof a?a:String(a)}(a))in e?Object.defineProperty(e,a,{value:c,enumerable:!0,configurable:!0,writable:!0}):e[a]=c,e}var b=c(6238),t=Symbol("lastResolve"),i=Symbol("lastReject"),r=Symbol("error"),n=Symbol("ended"),o=Symbol("lastPromise"),s=Symbol("handlePromise"),l=Symbol("stream");function h(e,a){return{value:e,done:a}}function u(e){var a=e[t];if(null!==a){var c=e[l].read();null!==c&&(e[o]=null,e[t]=null,e[i]=null,a(h(c,!1)))}}function x(e){process.nextTick(u,e)}var p=Object.getPrototypeOf((function(){})),g=Object.setPrototypeOf((d(f={get stream(){return this[l]},next:function(){var e=this,a=this[r];if(null!==a)return Promise.reject(a);if(this[n])return Promise.resolve(h(void 0,!0));if(this[l].destroyed)return new Promise((function(a,c){process.nextTick((function(){e[r]?c(e[r]):a(h(void 0,!0))}))}));var c,f=this[o];if(f)c=new Promise(function(e,a){return function(c,f){e.then((function(){a[n]?c(h(void 0,!0)):a[s](c,f)}),f)}}(f,this));else{var d=this[l].read();if(null!==d)return Promise.resolve(h(d,!1));c=new Promise(this[s])}return this[o]=c,c}},Symbol.asyncIterator,(function(){return this})),d(f,"return",(function(){var e=this;return new Promise((function(a,c){e[l].destroy(null,(function(e){e?c(e):a(h(void 0,!0))}))}))})),f),p);e.exports=function(e){var a,c=Object.create(g,(d(a={},l,{value:e,writable:!0}),d(a,t,{value:null,writable:!0}),d(a,i,{value:null,writable:!0}),d(a,r,{value:null,writable:!0}),d(a,n,{value:e._readableState.endEmitted,writable:!0}),d(a,s,{value:function(e,a){var f=c[l].read();f?(c[o]=null,c[t]=null,c[i]=null,e(h(f,!1))):(c[t]=e,c[i]=a)},writable:!0}),a));return c[o]=null,b(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var a=c[i];return null!==a&&(c[o]=null,c[t]=null,c[i]=null,a(e)),void(c[r]=e)}var f=c[t];null!==f&&(c[o]=null,c[t]=null,c[i]=null,f(h(void 0,!0))),c[n]=!0})),e.on("readable",x.bind(null,c)),c}},2726:(e,a,c)=>{"use strict";function f(e,a){var c=Object.keys(e);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(e);a&&(f=f.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),c.push.apply(c,f)}return c}function d(e){for(var a=1;a0?this.tail.next=a:this.head=a,this.tail=a,++this.length}},{key:"unshift",value:function(e){var a={data:e,next:this.head};0===this.length&&(this.tail=a),this.head=a,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var a=this.head,c=""+a.data;a=a.next;)c+=e+a.data;return c}},{key:"concat",value:function(e){if(0===this.length)return r.alloc(0);for(var a,c,f,d=r.allocUnsafe(e>>>0),b=this.head,t=0;b;)a=b.data,c=d,f=t,r.prototype.copy.call(a,c,f),t+=b.data.length,b=b.next;return d}},{key:"consume",value:function(e,a){var c;return ed.length?d.length:e;if(b===d.length?f+=d:f+=d.slice(0,e),0==(e-=b)){b===d.length?(++c,a.next?this.head=a.next:this.head=this.tail=null):(this.head=a,a.data=d.slice(b));break}++c}return this.length-=c,f}},{key:"_getBuffer",value:function(e){var a=r.allocUnsafe(e),c=this.head,f=1;for(c.data.copy(a),e-=c.data.length;c=c.next;){var d=c.data,b=e>d.length?d.length:e;if(d.copy(a,a.length-e,0,b),0==(e-=b)){b===d.length?(++f,c.next?this.head=c.next:this.head=this.tail=null):(this.head=c,c.data=d.slice(b));break}++f}return this.length-=f,a}},{key:o,value:function(e,a){return n(this,d(d({},a),{},{depth:0,customInspect:!1}))}}])&&t(a.prototype,c),Object.defineProperty(a,"prototype",{writable:!1}),e}()},5896:e=>{"use strict";function a(e,a){f(e,a),c(e)}function c(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function f(e,a){e.emit("error",a)}e.exports={destroy:function(e,d){var b=this,t=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return t||i?(d?d(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(f,this,e)):process.nextTick(f,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!d&&e?b._writableState?b._writableState.errorEmitted?process.nextTick(c,b):(b._writableState.errorEmitted=!0,process.nextTick(a,b,e)):process.nextTick(a,b,e):d?(process.nextTick(c,b),d(e)):process.nextTick(c,b)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,a){var c=e._readableState,f=e._writableState;c&&c.autoDestroy||f&&f.autoDestroy?e.destroy(a):e.emit("error",a)}}},6238:(e,a,c)=>{"use strict";var f=c(6048).F.ERR_STREAM_PREMATURE_CLOSE;function d(){}e.exports=function e(a,c,b){if("function"==typeof c)return e(a,null,c);c||(c={}),b=function(e){var a=!1;return function(){if(!a){a=!0;for(var c=arguments.length,f=new Array(c),d=0;d{e.exports=function(){throw new Error("Readable.from is not available in the browser")}},7758:(e,a,c)=>{"use strict";var f,d=c(6048).F,b=d.ERR_MISSING_ARGS,t=d.ERR_STREAM_DESTROYED;function i(e){if(e)throw e}function r(e){e()}function n(e,a){return e.pipe(a)}e.exports=function(){for(var e=arguments.length,a=new Array(e),d=0;d0,(function(e){o||(o=e),e&&l.forEach(r),b||(l.forEach(r),s(o))}))}));return a.reduce(n)}},5291:(e,a,c)=>{"use strict";var f=c(6048).F.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,a,c,d){var b=function(e,a,c){return null!=e.highWaterMark?e.highWaterMark:a?e[c]:null}(a,d,c);if(null!=b){if(!isFinite(b)||Math.floor(b)!==b||b<0)throw new f(d?c:"highWaterMark",b);return Math.floor(b)}return e.objectMode?16:16384}}},345:(e,a,c)=>{e.exports=c(7007).EventEmitter},8399:(e,a,c)=>{(a=e.exports=c(5412)).Stream=a,a.Readable=a,a.Writable=c(6708),a.Duplex=c(5382),a.Transform=c(4610),a.PassThrough=c(3600),a.finished=c(6238),a.pipeline=c(7758)},6011:(e,a,c)=>{"use strict";var f=c(8287).Buffer,d=c(6698),b=c(1147),t=new Array(16),i=[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],r=[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],n=[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],o=[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],s=[0,1518500249,1859775393,2400959708,2840853838],l=[1352829926,1548603684,1836072691,2053994217,0];function h(){b.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function u(e,a){return e<>>32-a}function x(e,a,c,f,d,b,t,i){return u(e+(a^c^f)+b+t|0,i)+d|0}function p(e,a,c,f,d,b,t,i){return u(e+(a&c|~a&f)+b+t|0,i)+d|0}function g(e,a,c,f,d,b,t,i){return u(e+((a|~c)^f)+b+t|0,i)+d|0}function m(e,a,c,f,d,b,t,i){return u(e+(a&f|c&~f)+b+t|0,i)+d|0}function y(e,a,c,f,d,b,t,i){return u(e+(a^(c|~f))+b+t|0,i)+d|0}d(h,b),h.prototype._update=function(){for(var e=t,a=0;a<16;++a)e[a]=this._block.readInt32LE(4*a);for(var c=0|this._a,f=0|this._b,d=0|this._c,b=0|this._d,h=0|this._e,_=0|this._a,v=0|this._b,w=0|this._c,M=0|this._d,A=0|this._e,L=0;L<80;L+=1){var I,k;L<16?(I=x(c,f,d,b,h,e[i[L]],s[0],n[L]),k=y(_,v,w,M,A,e[r[L]],l[0],o[L])):L<32?(I=p(c,f,d,b,h,e[i[L]],s[1],n[L]),k=m(_,v,w,M,A,e[r[L]],l[1],o[L])):L<48?(I=g(c,f,d,b,h,e[i[L]],s[2],n[L]),k=g(_,v,w,M,A,e[r[L]],l[2],o[L])):L<64?(I=m(c,f,d,b,h,e[i[L]],s[3],n[L]),k=p(_,v,w,M,A,e[r[L]],l[3],o[L])):(I=y(c,f,d,b,h,e[i[L]],s[4],n[L]),k=x(_,v,w,M,A,e[r[L]],l[4],o[L])),c=h,h=b,b=u(d,10),d=f,f=I,_=A,A=M,M=u(w,10),w=v,v=k}var E=this._b+d+M|0;this._b=this._c+b+A|0,this._c=this._d+h+_|0,this._d=this._e+c+v|0,this._e=this._a+f+w|0,this._a=E},h.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=f.alloc?f.alloc(20):new f(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},e.exports=h},1147:(e,a,c)=>{"use strict";var f=c(2861).Buffer,d=c(8399).Transform;function b(e){d.call(this),this._block=f.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}c(6698)(b,d),b.prototype._transform=function(e,a,c){var f=null;try{this.update(e,a)}catch(e){f=e}c(f)},b.prototype._flush=function(e){var a=null;try{this.push(this.digest())}catch(e){a=e}e(a)},b.prototype.update=function(e,a){if(function(e){if(!f.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer")}(e),this._finalized)throw new Error("Digest already called");f.isBuffer(e)||(e=f.from(e,a));for(var c=this._block,d=0;this._blockOffset+e.length-d>=this._blockSize;){for(var b=this._blockOffset;b0;++t)this._length[t]+=i,(i=this._length[t]/4294967296|0)>0&&(this._length[t]-=4294967296*i);return this},b.prototype._update=function(){throw new Error("_update is not implemented")},b.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var a=this._digest();void 0!==e&&(a=a.toString(e)),this._block.fill(0),this._blockOffset=0;for(var c=0;c<4;++c)this._length[c]=0;return a},b.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=b},2861:(e,a,c)=>{var f=c(8287),d=f.Buffer;function b(e,a){for(var c in e)a[c]=e[c]}function t(e,a,c){return d(e,a,c)}d.from&&d.alloc&&d.allocUnsafe&&d.allocUnsafeSlow?e.exports=f:(b(f,a),a.Buffer=t),t.prototype=Object.create(d.prototype),b(d,t),t.from=function(e,a,c){if("number"==typeof e)throw new TypeError("Argument must not be a number");return d(e,a,c)},t.alloc=function(e,a,c){if("number"!=typeof e)throw new TypeError("Argument must be a number");var f=d(e);return void 0!==a?"string"==typeof c?f.fill(a,c):f.fill(a):f.fill(0),f},t.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return d(e)},t.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return f.SlowBuffer(e)}},6897:(e,a,c)=>{"use strict";var f=c(453),d=c(41),b=c(592)(),t=c(5795),i=c(9675),r=f("%Math.floor%");e.exports=function(e,a){if("function"!=typeof e)throw new i("`fn` is not a function");if("number"!=typeof a||a<0||a>4294967295||r(a)!==a)throw new i("`length` must be a positive 32-bit integer");var c=arguments.length>2&&!!arguments[2],f=!0,n=!0;if("length"in e&&t){var o=t(e,"length");o&&!o.configurable&&(f=!1),o&&!o.writable&&(n=!1)}return(f||n||!c)&&(b?d(e,"length",a,!0,!0):d(e,"length",a)),e}},392:(e,a,c)=>{var f=c(2861).Buffer;function d(e,a){this._block=f.alloc(e),this._finalSize=a,this._blockSize=e,this._len=0}d.prototype.update=function(e,a){"string"==typeof e&&(a=a||"utf8",e=f.from(e,a));for(var c=this._block,d=this._blockSize,b=e.length,t=this._len,i=0;i=this._finalSize&&(this._update(this._block),this._block.fill(0));var c=8*this._len;if(c<=4294967295)this._block.writeUInt32BE(c,this._blockSize-4);else{var f=(4294967295&c)>>>0,d=(c-f)/4294967296;this._block.writeUInt32BE(d,this._blockSize-8),this._block.writeUInt32BE(f,this._blockSize-4)}this._update(this._block);var b=this._hash();return e?b.toString(e):b},d.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=d},2802:(e,a,c)=>{var f=e.exports=function(e){e=e.toLowerCase();var a=f[e];if(!a)throw new Error(e+" is not supported (we accept pull requests)");return new a};f.sha=c(7816),f.sha1=c(3737),f.sha224=c(6710),f.sha256=c(4107),f.sha384=c(2827),f.sha512=c(2890)},7816:(e,a,c)=>{var f=c(6698),d=c(392),b=c(2861).Buffer,t=[1518500249,1859775393,-1894007588,-899497514],i=new Array(80);function r(){this.init(),this._w=i,d.call(this,64,56)}function n(e){return e<<30|e>>>2}function o(e,a,c,f){return 0===e?a&c|~a&f:2===e?a&c|a&f|c&f:a^c^f}f(r,d),r.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},r.prototype._update=function(e){for(var a,c=this._w,f=0|this._a,d=0|this._b,b=0|this._c,i=0|this._d,r=0|this._e,s=0;s<16;++s)c[s]=e.readInt32BE(4*s);for(;s<80;++s)c[s]=c[s-3]^c[s-8]^c[s-14]^c[s-16];for(var l=0;l<80;++l){var h=~~(l/20),u=0|((a=f)<<5|a>>>27)+o(h,d,b,i)+r+c[l]+t[h];r=i,i=b,b=n(d),d=f,f=u}this._a=f+this._a|0,this._b=d+this._b|0,this._c=b+this._c|0,this._d=i+this._d|0,this._e=r+this._e|0},r.prototype._hash=function(){var e=b.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=r},3737:(e,a,c)=>{var f=c(6698),d=c(392),b=c(2861).Buffer,t=[1518500249,1859775393,-1894007588,-899497514],i=new Array(80);function r(){this.init(),this._w=i,d.call(this,64,56)}function n(e){return e<<5|e>>>27}function o(e){return e<<30|e>>>2}function s(e,a,c,f){return 0===e?a&c|~a&f:2===e?a&c|a&f|c&f:a^c^f}f(r,d),r.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},r.prototype._update=function(e){for(var a,c=this._w,f=0|this._a,d=0|this._b,b=0|this._c,i=0|this._d,r=0|this._e,l=0;l<16;++l)c[l]=e.readInt32BE(4*l);for(;l<80;++l)c[l]=(a=c[l-3]^c[l-8]^c[l-14]^c[l-16])<<1|a>>>31;for(var h=0;h<80;++h){var u=~~(h/20),x=n(f)+s(u,d,b,i)+r+c[h]+t[u]|0;r=i,i=b,b=o(d),d=f,f=x}this._a=f+this._a|0,this._b=d+this._b|0,this._c=b+this._c|0,this._d=i+this._d|0,this._e=r+this._e|0},r.prototype._hash=function(){var e=b.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=r},6710:(e,a,c)=>{var f=c(6698),d=c(4107),b=c(392),t=c(2861).Buffer,i=new Array(64);function r(){this.init(),this._w=i,b.call(this,64,56)}f(r,d),r.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},r.prototype._hash=function(){var e=t.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},e.exports=r},4107:(e,a,c)=>{var f=c(6698),d=c(392),b=c(2861).Buffer,t=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],i=new Array(64);function r(){this.init(),this._w=i,d.call(this,64,56)}function n(e,a,c){return c^e&(a^c)}function o(e,a,c){return e&a|c&(e|a)}function s(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function l(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function h(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}f(r,d),r.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},r.prototype._update=function(e){for(var a,c=this._w,f=0|this._a,d=0|this._b,b=0|this._c,i=0|this._d,r=0|this._e,u=0|this._f,x=0|this._g,p=0|this._h,g=0;g<16;++g)c[g]=e.readInt32BE(4*g);for(;g<64;++g)c[g]=0|(((a=c[g-2])>>>17|a<<15)^(a>>>19|a<<13)^a>>>10)+c[g-7]+h(c[g-15])+c[g-16];for(var m=0;m<64;++m){var y=p+l(r)+n(r,u,x)+t[m]+c[m]|0,_=s(f)+o(f,d,b)|0;p=x,x=u,u=r,r=i+y|0,i=b,b=d,d=f,f=y+_|0}this._a=f+this._a|0,this._b=d+this._b|0,this._c=b+this._c|0,this._d=i+this._d|0,this._e=r+this._e|0,this._f=u+this._f|0,this._g=x+this._g|0,this._h=p+this._h|0},r.prototype._hash=function(){var e=b.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=r},2827:(e,a,c)=>{var f=c(6698),d=c(2890),b=c(392),t=c(2861).Buffer,i=new Array(160);function r(){this.init(),this._w=i,b.call(this,128,112)}f(r,d),r.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},r.prototype._hash=function(){var e=t.allocUnsafe(48);function a(a,c,f){e.writeInt32BE(a,f),e.writeInt32BE(c,f+4)}return a(this._ah,this._al,0),a(this._bh,this._bl,8),a(this._ch,this._cl,16),a(this._dh,this._dl,24),a(this._eh,this._el,32),a(this._fh,this._fl,40),e},e.exports=r},2890:(e,a,c)=>{var f=c(6698),d=c(392),b=c(2861).Buffer,t=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],i=new Array(160);function r(){this.init(),this._w=i,d.call(this,128,112)}function n(e,a,c){return c^e&(a^c)}function o(e,a,c){return e&a|c&(e|a)}function s(e,a){return(e>>>28|a<<4)^(a>>>2|e<<30)^(a>>>7|e<<25)}function l(e,a){return(e>>>14|a<<18)^(e>>>18|a<<14)^(a>>>9|e<<23)}function h(e,a){return(e>>>1|a<<31)^(e>>>8|a<<24)^e>>>7}function u(e,a){return(e>>>1|a<<31)^(e>>>8|a<<24)^(e>>>7|a<<25)}function x(e,a){return(e>>>19|a<<13)^(a>>>29|e<<3)^e>>>6}function p(e,a){return(e>>>19|a<<13)^(a>>>29|e<<3)^(e>>>6|a<<26)}function g(e,a){return e>>>0>>0?1:0}f(r,d),r.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},r.prototype._update=function(e){for(var a=this._w,c=0|this._ah,f=0|this._bh,d=0|this._ch,b=0|this._dh,i=0|this._eh,r=0|this._fh,m=0|this._gh,y=0|this._hh,_=0|this._al,v=0|this._bl,w=0|this._cl,M=0|this._dl,A=0|this._el,L=0|this._fl,I=0|this._gl,k=0|this._hl,E=0;E<32;E+=2)a[E]=e.readInt32BE(4*E),a[E+1]=e.readInt32BE(4*E+4);for(;E<160;E+=2){var S=a[E-30],C=a[E-30+1],B=h(S,C),F=u(C,S),O=x(S=a[E-4],C=a[E-4+1]),P=p(C,S),R=a[E-14],T=a[E-14+1],U=a[E-32],j=a[E-32+1],N=F+T|0,q=B+R+g(N,F)|0;q=(q=q+O+g(N=N+P|0,P)|0)+U+g(N=N+j|0,j)|0,a[E]=q,a[E+1]=N}for(var D=0;D<160;D+=2){q=a[D],N=a[D+1];var z=o(c,f,d),Q=o(_,v,w),G=s(c,_),K=s(_,c),H=l(i,A),V=l(A,i),Z=t[D],W=t[D+1],Y=n(i,r,m),J=n(A,L,I),$=k+V|0,X=y+H+g($,k)|0;X=(X=(X=X+Y+g($=$+J|0,J)|0)+Z+g($=$+W|0,W)|0)+q+g($=$+N|0,N)|0;var ee=K+Q|0,ae=G+z+g(ee,K)|0;y=m,k=I,m=r,I=L,r=i,L=A,i=b+X+g(A=M+$|0,M)|0,b=d,M=w,d=f,w=v,f=c,v=_,c=X+ae+g(_=$+ee|0,$)|0}this._al=this._al+_|0,this._bl=this._bl+v|0,this._cl=this._cl+w|0,this._dl=this._dl+M|0,this._el=this._el+A|0,this._fl=this._fl+L|0,this._gl=this._gl+I|0,this._hl=this._hl+k|0,this._ah=this._ah+c+g(this._al,_)|0,this._bh=this._bh+f+g(this._bl,v)|0,this._ch=this._ch+d+g(this._cl,w)|0,this._dh=this._dh+b+g(this._dl,M)|0,this._eh=this._eh+i+g(this._el,A)|0,this._fh=this._fh+r+g(this._fl,L)|0,this._gh=this._gh+m+g(this._gl,I)|0,this._hh=this._hh+y+g(this._hl,k)|0},r.prototype._hash=function(){var e=b.allocUnsafe(64);function a(a,c,f){e.writeInt32BE(a,f),e.writeInt32BE(c,f+4)}return a(this._ah,this._al,0),a(this._bh,this._bl,8),a(this._ch,this._cl,16),a(this._dh,this._dl,24),a(this._eh,this._el,32),a(this._fh,this._fl,40),a(this._gh,this._gl,48),a(this._hh,this._hl,56),e},e.exports=r},8310:(e,a,c)=>{e.exports=d;var f=c(7007).EventEmitter;function d(){f.call(this)}c(6698)(d,f),d.Readable=c(5412),d.Writable=c(6708),d.Duplex=c(5382),d.Transform=c(4610),d.PassThrough=c(3600),d.finished=c(6238),d.pipeline=c(7758),d.Stream=d,d.prototype.pipe=function(e,a){var c=this;function d(a){e.writable&&!1===e.write(a)&&c.pause&&c.pause()}function b(){c.readable&&c.resume&&c.resume()}c.on("data",d),e.on("drain",b),e._isStdio||a&&!1===a.end||(c.on("end",i),c.on("close",r));var t=!1;function i(){t||(t=!0,e.end())}function r(){t||(t=!0,"function"==typeof e.destroy&&e.destroy())}function n(e){if(o(),0===f.listenerCount(this,"error"))throw e}function o(){c.removeListener("data",d),e.removeListener("drain",b),c.removeListener("end",i),c.removeListener("close",r),c.removeListener("error",n),e.removeListener("error",n),c.removeListener("end",o),c.removeListener("close",o),e.removeListener("close",o)}return c.on("error",n),e.on("error",n),c.on("end",o),c.on("close",o),e.on("close",o),e.emit("pipe",c),e}},3141:(e,a,c)=>{"use strict";var f=c(2861).Buffer,d=f.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function b(e){var a;switch(this.encoding=function(e){var a=function(e){if(!e)return"utf8";for(var a;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(a)return;e=(""+e).toLowerCase(),a=!0}}(e);if("string"!=typeof a&&(f.isEncoding===d||!d(e)))throw new Error("Unknown encoding: "+e);return a||e}(e),this.encoding){case"utf16le":this.text=r,this.end=n,a=4;break;case"utf8":this.fillLast=i,a=4;break;case"base64":this.text=o,this.end=s,a=3;break;default:return this.write=l,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=f.allocUnsafe(a)}function t(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function i(e){var a=this.lastTotal-this.lastNeed,c=function(e,a){if(128!=(192&a[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&a.length>1){if(128!=(192&a[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&a.length>2&&128!=(192&a[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==c?c:this.lastNeed<=e.length?(e.copy(this.lastChar,a,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,a,0,e.length),void(this.lastNeed-=e.length))}function r(e,a){if((e.length-a)%2==0){var c=e.toString("utf16le",a);if(c){var f=c.charCodeAt(c.length-1);if(f>=55296&&f<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],c.slice(0,-1)}return c}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",a,e.length-1)}function n(e){var a=e&&e.length?this.write(e):"";if(this.lastNeed){var c=this.lastTotal-this.lastNeed;return a+this.lastChar.toString("utf16le",0,c)}return a}function o(e,a){var c=(e.length-a)%3;return 0===c?e.toString("base64",a):(this.lastNeed=3-c,this.lastTotal=3,1===c?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",a,e.length-c))}function s(e){var a=e&&e.length?this.write(e):"";return this.lastNeed?a+this.lastChar.toString("base64",0,3-this.lastNeed):a}function l(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}a.I=b,b.prototype.write=function(e){if(0===e.length)return"";var a,c;if(this.lastNeed){if(void 0===(a=this.fillLast(e)))return"";c=this.lastNeed,this.lastNeed=0}else c=0;return c=0?(d>0&&(e.lastNeed=d-1),d):--f=0?(d>0&&(e.lastNeed=d-2),d):--f=0?(d>0&&(2===d?d=0:e.lastNeed=d-3),d):0}(this,e,a);if(!this.lastNeed)return e.toString("utf8",a);this.lastTotal=c;var f=e.length-(c-this.lastNeed);return e.copy(this.lastChar,0,f),e.toString("utf8",a,f)},b.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},4643:(e,a,c)=>{function f(e){try{if(!c.g.localStorage)return!1}catch(e){return!1}var a=c.g.localStorage[e];return null!=a&&"true"===String(a).toLowerCase()}e.exports=function(e,a){if(f("noDeprecation"))return e;var c=!1;return function(){if(!c){if(f("throwDeprecation"))throw new Error(a);f("traceDeprecation")?console.trace(a):console.warn(a),c=!0}return e.apply(this,arguments)}}},1135:e=>{e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},9032:(e,a,c)=>{"use strict";var f=c(7244),d=c(8184),b=c(5767),t=c(5680);function i(e){return e.call.bind(e)}var r="undefined"!=typeof BigInt,n="undefined"!=typeof Symbol,o=i(Object.prototype.toString),s=i(Number.prototype.valueOf),l=i(String.prototype.valueOf),h=i(Boolean.prototype.valueOf);if(r)var u=i(BigInt.prototype.valueOf);if(n)var x=i(Symbol.prototype.valueOf);function p(e,a){if("object"!=typeof e)return!1;try{return a(e),!0}catch(e){return!1}}function g(e){return"[object Map]"===o(e)}function m(e){return"[object Set]"===o(e)}function y(e){return"[object WeakMap]"===o(e)}function _(e){return"[object WeakSet]"===o(e)}function v(e){return"[object ArrayBuffer]"===o(e)}function w(e){return"undefined"!=typeof ArrayBuffer&&(v.working?v(e):e instanceof ArrayBuffer)}function M(e){return"[object DataView]"===o(e)}function A(e){return"undefined"!=typeof DataView&&(M.working?M(e):e instanceof DataView)}a.isArgumentsObject=f,a.isGeneratorFunction=d,a.isTypedArray=t,a.isPromise=function(e){return"undefined"!=typeof Promise&&e instanceof Promise||null!==e&&"object"==typeof e&&"function"==typeof e.then&&"function"==typeof e.catch},a.isArrayBufferView=function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):t(e)||A(e)},a.isUint8Array=function(e){return"Uint8Array"===b(e)},a.isUint8ClampedArray=function(e){return"Uint8ClampedArray"===b(e)},a.isUint16Array=function(e){return"Uint16Array"===b(e)},a.isUint32Array=function(e){return"Uint32Array"===b(e)},a.isInt8Array=function(e){return"Int8Array"===b(e)},a.isInt16Array=function(e){return"Int16Array"===b(e)},a.isInt32Array=function(e){return"Int32Array"===b(e)},a.isFloat32Array=function(e){return"Float32Array"===b(e)},a.isFloat64Array=function(e){return"Float64Array"===b(e)},a.isBigInt64Array=function(e){return"BigInt64Array"===b(e)},a.isBigUint64Array=function(e){return"BigUint64Array"===b(e)},g.working="undefined"!=typeof Map&&g(new Map),a.isMap=function(e){return"undefined"!=typeof Map&&(g.working?g(e):e instanceof Map)},m.working="undefined"!=typeof Set&&m(new Set),a.isSet=function(e){return"undefined"!=typeof Set&&(m.working?m(e):e instanceof Set)},y.working="undefined"!=typeof WeakMap&&y(new WeakMap),a.isWeakMap=function(e){return"undefined"!=typeof WeakMap&&(y.working?y(e):e instanceof WeakMap)},_.working="undefined"!=typeof WeakSet&&_(new WeakSet),a.isWeakSet=function(e){return _(e)},v.working="undefined"!=typeof ArrayBuffer&&v(new ArrayBuffer),a.isArrayBuffer=w,M.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&M(new DataView(new ArrayBuffer(1),0,1)),a.isDataView=A;var L="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function I(e){return"[object SharedArrayBuffer]"===o(e)}function k(e){return void 0!==L&&(void 0===I.working&&(I.working=I(new L)),I.working?I(e):e instanceof L)}function E(e){return p(e,s)}function S(e){return p(e,l)}function C(e){return p(e,h)}function B(e){return r&&p(e,u)}function F(e){return n&&p(e,x)}a.isSharedArrayBuffer=k,a.isAsyncFunction=function(e){return"[object AsyncFunction]"===o(e)},a.isMapIterator=function(e){return"[object Map Iterator]"===o(e)},a.isSetIterator=function(e){return"[object Set Iterator]"===o(e)},a.isGeneratorObject=function(e){return"[object Generator]"===o(e)},a.isWebAssemblyCompiledModule=function(e){return"[object WebAssembly.Module]"===o(e)},a.isNumberObject=E,a.isStringObject=S,a.isBooleanObject=C,a.isBigIntObject=B,a.isSymbolObject=F,a.isBoxedPrimitive=function(e){return E(e)||S(e)||C(e)||B(e)||F(e)},a.isAnyArrayBuffer=function(e){return"undefined"!=typeof Uint8Array&&(w(e)||k(e))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(e){Object.defineProperty(a,e,{enumerable:!1,value:function(){throw new Error(e+" is not supported in userland")}})}))},537:(e,a,c)=>{var f=Object.getOwnPropertyDescriptors||function(e){for(var a=Object.keys(e),c={},f=0;f=b)return e;switch(e){case"%s":return String(f[c++]);case"%d":return Number(f[c++]);case"%j":try{return JSON.stringify(f[c++])}catch(e){return"[Circular]"}default:return e}})),i=f[c];c=3&&(f.depth=arguments[2]),arguments.length>=4&&(f.colors=arguments[3]),x(c)?f.showHidden=c:c&&a._extend(f,c),y(f.showHidden)&&(f.showHidden=!1),y(f.depth)&&(f.depth=2),y(f.colors)&&(f.colors=!1),y(f.customInspect)&&(f.customInspect=!0),f.colors&&(f.stylize=n),s(f,e,f.depth)}function n(e,a){var c=r.styles[a];return c?"["+r.colors[c][0]+"m"+e+"["+r.colors[c][1]+"m":e}function o(e,a){return e}function s(e,c,f){if(e.customInspect&&c&&A(c.inspect)&&c.inspect!==a.inspect&&(!c.constructor||c.constructor.prototype!==c)){var d=c.inspect(f,e);return m(d)||(d=s(e,d,f)),d}var b=function(e,a){if(y(a))return e.stylize("undefined","undefined");if(m(a)){var c="'"+JSON.stringify(a).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(c,"string")}return g(a)?e.stylize(""+a,"number"):x(a)?e.stylize(""+a,"boolean"):p(a)?e.stylize("null","null"):void 0}(e,c);if(b)return b;var t=Object.keys(c),i=function(e){var a={};return e.forEach((function(e,c){a[e]=!0})),a}(t);if(e.showHidden&&(t=Object.getOwnPropertyNames(c)),M(c)&&(t.indexOf("message")>=0||t.indexOf("description")>=0))return l(c);if(0===t.length){if(A(c)){var r=c.name?": "+c.name:"";return e.stylize("[Function"+r+"]","special")}if(_(c))return e.stylize(RegExp.prototype.toString.call(c),"regexp");if(w(c))return e.stylize(Date.prototype.toString.call(c),"date");if(M(c))return l(c)}var n,o="",v=!1,L=["{","}"];return u(c)&&(v=!0,L=["[","]"]),A(c)&&(o=" [Function"+(c.name?": "+c.name:"")+"]"),_(c)&&(o=" "+RegExp.prototype.toString.call(c)),w(c)&&(o=" "+Date.prototype.toUTCString.call(c)),M(c)&&(o=" "+l(c)),0!==t.length||v&&0!=c.length?f<0?_(c)?e.stylize(RegExp.prototype.toString.call(c),"regexp"):e.stylize("[Object]","special"):(e.seen.push(c),n=v?function(e,a,c,f,d){for(var b=[],t=0,i=a.length;t60?c[0]+(""===a?"":a+"\n ")+" "+e.join(",\n ")+" "+c[1]:c[0]+a+" "+e.join(", ")+" "+c[1]}(n,o,L)):L[0]+o+L[1]}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,a,c,f,d,b){var t,i,r;if((r=Object.getOwnPropertyDescriptor(a,d)||{value:a[d]}).get?i=r.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):r.set&&(i=e.stylize("[Setter]","special")),E(f,d)||(t="["+d+"]"),i||(e.seen.indexOf(r.value)<0?(i=p(c)?s(e,r.value,null):s(e,r.value,c-1)).indexOf("\n")>-1&&(i=b?i.split("\n").map((function(e){return" "+e})).join("\n").slice(2):"\n"+i.split("\n").map((function(e){return" "+e})).join("\n")):i=e.stylize("[Circular]","special")),y(t)){if(b&&d.match(/^\d+$/))return i;(t=JSON.stringify(""+d)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(t=t.slice(1,-1),t=e.stylize(t,"name")):(t=t.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),t=e.stylize(t,"string"))}return t+": "+i}function u(e){return Array.isArray(e)}function x(e){return"boolean"==typeof e}function p(e){return null===e}function g(e){return"number"==typeof e}function m(e){return"string"==typeof e}function y(e){return void 0===e}function _(e){return v(e)&&"[object RegExp]"===L(e)}function v(e){return"object"==typeof e&&null!==e}function w(e){return v(e)&&"[object Date]"===L(e)}function M(e){return v(e)&&("[object Error]"===L(e)||e instanceof Error)}function A(e){return"function"==typeof e}function L(e){return Object.prototype.toString.call(e)}function I(e){return e<10?"0"+e.toString(10):e.toString(10)}a.debuglog=function(e){if(e=e.toUpperCase(),!b[e])if(t.test(e)){var c=process.pid;b[e]=function(){var f=a.format.apply(a,arguments);console.error("%s %d: %s",e,c,f)}}else b[e]=function(){};return b[e]},a.inspect=r,r.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]},r.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},a.types=c(9032),a.isArray=u,a.isBoolean=x,a.isNull=p,a.isNullOrUndefined=function(e){return null==e},a.isNumber=g,a.isString=m,a.isSymbol=function(e){return"symbol"==typeof e},a.isUndefined=y,a.isRegExp=_,a.types.isRegExp=_,a.isObject=v,a.isDate=w,a.types.isDate=w,a.isError=M,a.types.isNativeError=M,a.isFunction=A,a.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},a.isBuffer=c(1135);var k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function E(e,a){return Object.prototype.hasOwnProperty.call(e,a)}a.log=function(){var e,c;console.log("%s - %s",(c=[I((e=new Date).getHours()),I(e.getMinutes()),I(e.getSeconds())].join(":"),[e.getDate(),k[e.getMonth()],c].join(" ")),a.format.apply(a,arguments))},a.inherits=c(6698),a._extend=function(e,a){if(!a||!v(a))return e;for(var c=Object.keys(a),f=c.length;f--;)e[c[f]]=a[c[f]];return e};var S="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function C(e,a){if(!e){var c=new Error("Promise was rejected with a falsy value");c.reason=e,e=c}return a(e)}a.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(S&&e[S]){var a;if("function"!=typeof(a=e[S]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(a,S,{value:a,enumerable:!1,writable:!1,configurable:!0}),a}function a(){for(var a,c,f=new Promise((function(e,f){a=e,c=f})),d=[],b=0;b{e.exports=function e(f,d){var b,t=0,i=0,r=d=d||0,n=f.length;do{if(r>=n)throw e.bytes=0,new RangeError("Could not decode varint");b=f[r++],t+=i<28?(b&c)<=a);return e.bytes=r-d,t};var a=128,c=127},1877:e=>{e.exports=function e(d,b,t){b=b||[];for(var i=t=t||0;d>=f;)b[t++]=255&d|a,d/=128;for(;d&c;)b[t++]=255&d|a,d>>>=7;return b[t]=0|d,e.bytes=t-i+1,b};var a=128,c=-128,f=Math.pow(2,31)},1203:(e,a,c)=>{e.exports={encode:c(1877),decode:c(6797),encodingLength:c(7867)}},7867:e=>{var a=Math.pow(2,7),c=Math.pow(2,14),f=Math.pow(2,21),d=Math.pow(2,28),b=Math.pow(2,35),t=Math.pow(2,42),i=Math.pow(2,49),r=Math.pow(2,56),n=Math.pow(2,63);e.exports=function(e){return e{var indexOf=function(e,a){if(e.indexOf)return e.indexOf(a);for(var c=0;c{"use strict";a.TextEncoder="undefined"!=typeof TextEncoder?TextEncoder:c(537).TextEncoder,a.TextDecoder="undefined"!=typeof TextDecoder?TextDecoder:c(537).TextDecoder},5767:(e,a,c)=>{"use strict";var f=c(2682),d=c(9209),b=c(487),t=c(8075),i=c(5795),r=t("Object.prototype.toString"),n=c(9092)(),o="undefined"==typeof globalThis?c.g:globalThis,s=d(),l=t("String.prototype.slice"),h=Object.getPrototypeOf,u=t("Array.prototype.indexOf",!0)||function(e,a){for(var c=0;c-1?a:"Object"===a&&function(e){var a=!1;return f(x,(function(c,f){if(!a)try{c(e),a=l(f,1)}catch(e){}})),a}(e)}return i?function(e){var a=!1;return f(x,(function(c,f){if(!a)try{"$"+c(e)===f&&(a=l(f,1))}catch(e){}})),a}(e):null}},8982:()=>{},7790:()=>{},3776:()=>{},1638:()=>{},2668:()=>{},7965:()=>{},6089:()=>{},9368:()=>{},4688:()=>{},1069:()=>{},5340:()=>{},9838:()=>{},7882:()=>{},9209:(e,a,c)=>{"use strict";var f=c(6578),d="undefined"==typeof globalThis?c.g:globalThis;e.exports=function(){for(var e=[],a=0;a{"use strict";c.d(a,{K:()=>d});var f=c(5930);function d(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?(0,f.o)(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}},5007:(e,a,c)=>{"use strict";c.r(a),c.d(a,{concat:()=>b});var f=c(5238),d=c(5930);function b(e,a){a||(a=e.reduce(((e,a)=>e+a.length),0));const c=(0,f.K)(a);let b=0;for(const a of e)c.set(a,b),b+=a.length;return(0,d.o)(c)}},8402:(e,a,c)=>{"use strict";function f(e,a){if(e===a)return!0;if(e.byteLength!==a.byteLength)return!1;for(let c=0;cf})},4117:(e,a,c)=>{"use strict";c.r(a),c.d(a,{fromString:()=>b});var f=c(40),d=c(5930);function b(e,a="utf8"){const c=f.A[a];if(!c)throw new Error(`Unsupported encoding "${a}"`);return"utf8"!==a&&"utf-8"!==a||null==globalThis.Buffer||null==globalThis.Buffer.from?c.decoder.decode(`${c.prefix}${e}`):(0,d.o)(globalThis.Buffer.from(e,"utf-8"))}},7302:(e,a,c)=>{"use strict";c.r(a),c.d(a,{toString:()=>d});var f=c(40);function d(e,a="utf8"){const c=f.A[a];if(!c)throw new Error(`Unsupported encoding "${a}"`);return"utf8"!==a&&"utf-8"!==a||null==globalThis.Buffer||null==globalThis.Buffer.from?c.encoder.encode(e).substring(1):globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8")}},5930:(e,a,c)=>{"use strict";function f(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}c.d(a,{o:()=>f})},40:(e,a,c)=>{"use strict";c.d(a,{A:()=>qe});var f={};c.r(f),c.d(f,{identity:()=>k});var d={};c.r(d),c.d(d,{base2:()=>E});var b={};c.r(b),c.d(b,{base8:()=>S});var t={};c.r(t),c.d(t,{base10:()=>C});var i={};c.r(i),c.d(i,{base16:()=>B,base16upper:()=>F});var r={};c.r(r),c.d(r,{base32:()=>O,base32hex:()=>U,base32hexpad:()=>N,base32hexpadupper:()=>q,base32hexupper:()=>j,base32pad:()=>R,base32padupper:()=>T,base32upper:()=>P,base32z:()=>D});var n={};c.r(n),c.d(n,{base36:()=>z,base36upper:()=>Q});var o={};c.r(o),c.d(o,{base58btc:()=>G,base58flickr:()=>K});var s={};c.r(s),c.d(s,{base64:()=>H,base64pad:()=>V,base64url:()=>Z,base64urlpad:()=>W});var l={};c.r(l),c.d(l,{base256emoji:()=>X});var h={};c.r(h),c.d(h,{sha256:()=>ve,sha512:()=>we});var u={};c.r(u),c.d(u,{identity:()=>Ae});var x={};c.r(x),c.d(x,{code:()=>Ie,decode:()=>Ee,encode:()=>ke,name:()=>Le});var p={};c.r(p),c.d(p,{code:()=>Fe,decode:()=>Pe,encode:()=>Oe,name:()=>Be});const g=function(e,a){if(e.length>=255)throw new TypeError("Alphabet too long");for(var c=new Uint8Array(256),f=0;f>>0,t=new Uint8Array(b);e[a];){var o=c[e.charCodeAt(a)];if(255===o)return;for(var s=0,l=b-1;(0!==o||s>>0,t[l]=o%256>>>0,o=o/256>>>0;if(0!==o)throw new Error("Non-zero carry");d=s,a++}if(" "!==e[a]){for(var h=b-d;h!==b&&0===t[h];)h++;for(var u=new Uint8Array(f+(b-h)),x=f;h!==b;)u[x++]=t[h++];return u}}}return{encode:function(a){if(a instanceof Uint8Array||(ArrayBuffer.isView(a)?a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength):Array.isArray(a)&&(a=Uint8Array.from(a))),!(a instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===a.length)return"";for(var c=0,f=0,d=0,b=a.length;d!==b&&0===a[d];)d++,c++;for(var t=(b-d)*o+1>>>0,n=new Uint8Array(t);d!==b;){for(var s=a[d],l=0,h=t-1;(0!==s||l>>0,n[h]=s%i>>>0,s=s/i>>>0;if(0!==s)throw new Error("Non-zero carry");f=l,d++}for(var u=t-f;u!==t&&0===n[u];)u++;for(var x=r.repeat(c);u{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")});class y{constructor(e,a,c){this.name=e,this.prefix=a,this.baseEncode=c}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class _{constructor(e,a,c){if(this.name=e,this.prefix=a,void 0===a.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=a.codePointAt(0),this.baseDecode=c}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return w(this,e)}}class v{constructor(e){this.decoders=e}or(e){return w(this,e)}decode(e){const a=e[0],c=this.decoders[a];if(c)return c.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const w=(e,a)=>new v({...e.decoders||{[e.prefix]:e},...a.decoders||{[a.prefix]:a}});class M{constructor(e,a,c,f){this.name=e,this.prefix=a,this.baseEncode=c,this.baseDecode=f,this.encoder=new y(e,a,c),this.decoder=new _(e,a,f)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const A=({name:e,prefix:a,encode:c,decode:f})=>new M(e,a,c,f),L=({prefix:e,name:a,alphabet:c})=>{const{encode:f,decode:d}=g(c,a);return A({prefix:e,name:a,encode:f,decode:e=>m(d(e))})},I=({name:e,prefix:a,bitsPerChar:c,alphabet:f})=>A({prefix:a,name:e,encode:e=>((e,a,c)=>{const f="="===a[a.length-1],d=(1<c;)t-=c,b+=a[d&i>>t];if(t&&(b+=a[d&i<((e,a,c,f)=>{const d={};for(let e=0;e=8&&(i-=8,t[n++]=255&r>>i)}if(i>=c||255&r<<8-i)throw new SyntaxError("Unexpected end of data");return t})(a,f,c,e)}),k=A({prefix:"\0",name:"identity",encode:e=>{return a=e,(new TextDecoder).decode(a);var a},decode:e=>(e=>(new TextEncoder).encode(e))(e)}),E=I({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),S=I({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),C=L({prefix:"9",name:"base10",alphabet:"0123456789"}),B=I({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),F=I({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),O=I({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),P=I({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),R=I({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),T=I({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),U=I({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),j=I({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),N=I({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),q=I({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),D=I({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),z=L({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Q=L({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),G=L({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),K=L({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),H=I({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),V=I({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Z=I({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),W=I({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),Y=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),J=Y.reduce(((e,a,c)=>(e[c]=a,e)),[]),$=Y.reduce(((e,a,c)=>(e[a.codePointAt(0)]=c,e)),[]),X=A({prefix:"🚀",name:"base256emoji",encode:function(e){return e.reduce(((e,a)=>e+J[a]),"")},decode:function(e){const a=[];for(const c of e){const e=$[c.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${c}`);a.push(e)}return new Uint8Array(a)}});var ee=128,ae=-128,ce=Math.pow(2,31),fe=Math.pow(2,7),de=Math.pow(2,14),be=Math.pow(2,21),te=Math.pow(2,28),ie=Math.pow(2,35),re=Math.pow(2,42),ne=Math.pow(2,49),oe=Math.pow(2,56),se=Math.pow(2,63);const le=function e(a,c,f){c=c||[];for(var d=f=f||0;a>=ce;)c[f++]=255&a|ee,a/=128;for(;a&ae;)c[f++]=255&a|ee,a>>>=7;return c[f]=0|a,e.bytes=f-d+1,c},he=function(e){return e(le(e,a,c),a),xe=e=>he(e),pe=(e,a)=>{const c=a.byteLength,f=xe(e),d=f+xe(c),b=new Uint8Array(d+c);return ue(e,b,0),ue(c,b,f),b.set(a,d),new ge(e,c,a,b)};class ge{constructor(e,a,c,f){this.code=e,this.size=a,this.digest=c,this.bytes=f}}const me=({name:e,code:a,encode:c})=>new ye(e,a,c);class ye{constructor(e,a,c){this.name=e,this.code=a,this.encode=c}digest(e){if(e instanceof Uint8Array){const a=this.encode(e);return a instanceof Uint8Array?pe(this.code,a):a.then((e=>pe(this.code,e)))}throw Error("Unknown type, must be binary type")}}const _e=e=>async a=>new Uint8Array(await crypto.subtle.digest(e,a)),ve=me({name:"sha2-256",code:18,encode:_e("SHA-256")}),we=me({name:"sha2-512",code:19,encode:_e("SHA-512")}),Me=m,Ae={code:0,name:"identity",encode:Me,digest:e=>pe(0,Me(e))},Le="raw",Ie=85,ke=e=>m(e),Ee=e=>m(e),Se=new TextEncoder,Ce=new TextDecoder,Be="json",Fe=512,Oe=e=>Se.encode(JSON.stringify(e)),Pe=e=>JSON.parse(Ce.decode(e));Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom"),Symbol.for("@ipld/js-cid/CID");const Re={...f,...d,...b,...t,...i,...r,...n,...o,...s,...l};var Te=c(5238);function Ue(e,a,c,f){return{name:e,prefix:a,encoder:{name:e,prefix:a,encode:c},decoder:{decode:f}}}const je=Ue("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),Ne=Ue("ascii","a",(e=>{let a="a";for(let c=0;c{e=e.substring(1);const a=(0,Te.K)(e.length);for(let c=0;c{"use strict";e.exports=JSON.parse('{"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}')},2951:e=>{"use strict";e.exports=JSON.parse('{"sha224WithRSAEncryption":{"sign":"rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"RSA-SHA224":{"sign":"ecdsa/rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"sha256WithRSAEncryption":{"sign":"rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"RSA-SHA256":{"sign":"ecdsa/rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"sha384WithRSAEncryption":{"sign":"rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"RSA-SHA384":{"sign":"ecdsa/rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"sha512WithRSAEncryption":{"sign":"rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA512":{"sign":"ecdsa/rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA1":{"sign":"rsa","hash":"sha1","id":"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{"sign":"ecdsa","hash":"sha1","id":""},"sha256":{"sign":"ecdsa","hash":"sha256","id":""},"sha224":{"sign":"ecdsa","hash":"sha224","id":""},"sha384":{"sign":"ecdsa","hash":"sha384","id":""},"sha512":{"sign":"ecdsa","hash":"sha512","id":""},"DSA-SHA":{"sign":"dsa","hash":"sha1","id":""},"DSA-SHA1":{"sign":"dsa","hash":"sha1","id":""},"DSA":{"sign":"dsa","hash":"sha1","id":""},"DSA-WITH-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-WITH-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-WITH-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-WITH-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-RIPEMD160":{"sign":"dsa","hash":"rmd160","id":""},"ripemd160WithRSA":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"RSA-RIPEMD160":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"md5WithRSAEncryption":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"},"RSA-MD5":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"}}')},4589:e=>{"use strict";e.exports=JSON.parse('{"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}')},3241:e=>{"use strict";e.exports=JSON.parse('{"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}')},1636:e=>{"use strict";e.exports={rE:"6.5.7"}},5579:e=>{"use strict";e.exports=JSON.parse('{"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}')}},__webpack_module_cache__={};function __webpack_require__(e){var a=__webpack_module_cache__[e];if(void 0!==a)return a.exports;var c=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e].call(c.exports,c,c.exports,__webpack_require__),c.loaded=!0,c.exports}__webpack_require__.amdO={},__webpack_require__.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(a,{a}),a},__webpack_require__.d=(e,a)=>{for(var c in a)__webpack_require__.o(a,c)&&!__webpack_require__.o(e,c)&&Object.defineProperty(e,c,{enumerable:!0,get:a[c]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var __webpack_exports__={};return(()=>{"use strict";var e=__webpack_require__(7882),a=__webpack_require__.n(e),c=__webpack_require__(1217);const f=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4];function d(e,a){return a&&10!=a?16==a?"0x"==e.slice(0,2)?BigInt(e):BigInt("0x"+e):void 0:BigInt(e)}const b=d;function t(e){const a=e.toString(16);return 4*(a.length-1)+f[parseInt(a[0],16)]}function i(e){return BigInt(e)>BigInt(a)}const o=r,s=n;function l(e){return(BigInt(e)&BigInt(1))==BigInt(1)}function h(e){if(e>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("Number too big");return Number(e)}function u(e,a){return BigInt(e)+BigInt(a)}function x(e,a){return BigInt(e)-BigInt(a)}function p(e){return-BigInt(e)}function g(e,a){return BigInt(e)*BigInt(a)}function m(e,a){return BigInt(e)%BigInt(a)}function y(e,a){return BigInt(e)>BigInt(a)}function _(e,a){return BigInt(e)>=BigInt(a)}function v(e,a){return BigInt(e)&BigInt(a)}function w(e,a,c,f){const d="0000000"+c.toString(16),b=new Uint32Array(e.buffer,e.byteOffset+a,f/4),t=1+(4*(d.length-7)-1>>5);for(let e=0;eb[b.length-a-1]=e.toString(16).padStart(8,"0"))),d(b.join(""),16)}function A(e,a){return e.toString(a)}function L(e){const a=new Uint8Array(Math.floor((t(e)-1)/8)+1);return w(a,0,e,a.byteLength),a}const I=b(0),k=b(1);var E=Object.freeze({__proto__:null,abs:function(e){return BigInt(e)>=0?BigInt(e):-BigInt(e)},add:u,band:v,bitLength:t,bits:function(e){let a=BigInt(e);const c=[];for(;a;)a&BigInt(1)?c.push(1):c.push(0),a>>=BigInt(1);return c},bor:function(e,a){return BigInt(e)|BigInt(a)},bxor:function(e,a){return BigInt(e)^BigInt(a)},div:function(e,a){return BigInt(e)/BigInt(a)},e:b,eq:function(e,a){return BigInt(e)==BigInt(a)},exp:function(e,a){return BigInt(e)**BigInt(a)},fromArray:function(e,a){let c=BigInt(0);a=BigInt(a);for(let f=0;f>=BigInt(1)}return c},neg:p,neq:function(e,a){return BigInt(e)!=BigInt(a)},one:k,pow:function(e,a){return BigInt(e)**BigInt(a)},shiftLeft:r,shiftRight:n,shl:o,shr:s,square:function(e){return BigInt(e)*BigInt(e)},sub:x,toArray:function(e,a){const c=[];let f=BigInt(e);for(a=BigInt(a);f;)c.unshift(Number(f%a)),f/=a;return c},toLEBuff:L,toNumber:h,toRprBE:function(e,a,c,f){const d="0000000"+c.toString(16),b=new DataView(e.buffer,e.byteOffset+a,f),t=1+(4*(d.length-7)-1>>5);for(let e=0;e>=1;return c}function B(e,a,c,f,d){e[a]=e[a]+e[c]>>>0,e[d]=(e[d]^e[a])>>>0,e[d]=(e[d]<<16|e[d]>>>16&65535)>>>0,e[f]=e[f]+e[d]>>>0,e[c]=(e[c]^e[f])>>>0,e[c]=(e[c]<<12|e[c]>>>20&4095)>>>0,e[a]=e[a]+e[c]>>>0,e[d]=(e[d]^e[a])>>>0,e[d]=(e[d]<<8|e[d]>>>24&255)>>>0,e[f]=e[f]+e[d]>>>0,e[c]=(e[c]^e[f])>>>0,e[c]=(e[c]<<7|e[c]>>>25&127)>>>0}class F{constructor(e){e=e||[0,0,0,0,0,0,0,0],this.state=[1634760805,857760878,2036477234,1797285236,e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],0,0,0,0],this.idx=16,this.buff=new Array(16)}nextU32(){return 16==this.idx&&this.update(),this.buff[this.idx++]}nextU64(){return u(g(this.nextU32(),4294967296),this.nextU32())}nextBool(){return!(1&~this.nextU32())}update(){for(let e=0;e<16;e++)this.buff[e]=this.state[e];for(let a=0;a<10;a++)B(e=this.buff,0,4,8,12),B(e,1,5,9,13),B(e,2,6,10,14),B(e,3,7,11,15),B(e,0,5,10,15),B(e,1,6,11,12),B(e,2,7,8,13),B(e,3,4,9,14);var e;for(let e=0;e<16;e++)this.buff[e]=this.buff[e]+this.state[e]>>>0;this.idx=0,this.state[12]=this.state[12]+1>>>0,0==this.state[12]&&(this.state[13]=this.state[13]+1>>>0,0==this.state[13]&&(this.state[14]=this.state[14]+1>>>0,0==this.state[14]&&(this.state[15]=this.state[15]+1>>>0)))}}let O=null;function P(){return O||(O=new F(function(){const e=function(e){let a=new Uint8Array(e);if(void 0!==globalThis.crypto)globalThis.crypto.getRandomValues(a);else for(let c=0;c>>0;return a}(32),a=new Uint32Array(e.buffer),c=[];for(let e=0;e<8;e++)c.push(a[e]);return c}()),O)}function R(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var T={bigInt2BytesLE:function(e,a){const c=Array(a);let f=BigInt(e);for(let e=0;e>=8n;return c},bigInt2U32LE:function(e,a){const c=Array(a);let f=BigInt(e);for(let e=0;e>=32n;return c},isOcamNum:function(e){return!!Array.isArray(e)&&3==e.length&&"number"==typeof e[0]&&"number"==typeof e[1]&&!!Array.isArray(e[2])}},U=function(e,a,c,f,d,b,t){const i=e.addFunction(a);i.addParam("base","i32"),i.addParam("scalar","i32"),i.addParam("scalarLength","i32"),i.addParam("r","i32"),i.addLocal("i","i32"),i.addLocal("b","i32");const r=i.getCodeBuilder(),n=r.i32_const(e.alloc(c));i.addCode(r.if(r.i32_eqz(r.getLocal("scalarLength")),[...r.call(t,r.getLocal("r")),...r.ret([])])),i.addCode(r.call(b,r.getLocal("base"),n)),i.addCode(r.call(t,r.getLocal("r"))),i.addCode(r.setLocal("i",r.getLocal("scalarLength"))),i.addCode(r.block(r.loop(r.setLocal("i",r.i32_sub(r.getLocal("i"),r.i32_const(1))),r.setLocal("b",r.i32_load8_u(r.i32_add(r.getLocal("scalar"),r.getLocal("i")))),...function(){const e=[];for(let a=0;a<8;a++)e.push(...r.call(d,r.getLocal("r"),r.getLocal("r")),...r.if(r.i32_ge_u(r.getLocal("b"),r.i32_const(128>>a)),[...r.setLocal("b",r.i32_sub(r.getLocal("b"),r.i32_const(128>>a))),...r.call(f,r.getLocal("r"),n,r.getLocal("r"))]));return e}(),r.br_if(1,r.i32_eqz(r.getLocal("i"))),r.br(0))))},j=function(e,a){const c=8*e.modules[a].n64,f=e.addFunction(a+"_batchInverse");f.addParam("pIn","i32"),f.addParam("inStep","i32"),f.addParam("n","i32"),f.addParam("pOut","i32"),f.addParam("outStep","i32"),f.addLocal("itAux","i32"),f.addLocal("itIn","i32"),f.addLocal("itOut","i32"),f.addLocal("i","i32");const d=f.getCodeBuilder(),b=d.i32_const(e.alloc(c));f.addCode(d.setLocal("itAux",d.i32_load(d.i32_const(0))),d.i32_store(d.i32_const(0),d.i32_add(d.getLocal("itAux"),d.i32_mul(d.i32_add(d.getLocal("n"),d.i32_const(1)),d.i32_const(c))))),f.addCode(d.call(a+"_one",d.getLocal("itAux")),d.setLocal("itIn",d.getLocal("pIn")),d.setLocal("itAux",d.i32_add(d.getLocal("itAux"),d.i32_const(c))),d.setLocal("i",d.i32_const(0)),d.block(d.loop(d.br_if(1,d.i32_eq(d.getLocal("i"),d.getLocal("n"))),d.if(d.call(a+"_isZero",d.getLocal("itIn")),d.call(a+"_copy",d.i32_sub(d.getLocal("itAux"),d.i32_const(c)),d.getLocal("itAux")),d.call(a+"_mul",d.getLocal("itIn"),d.i32_sub(d.getLocal("itAux"),d.i32_const(c)),d.getLocal("itAux"))),d.setLocal("itIn",d.i32_add(d.getLocal("itIn"),d.getLocal("inStep"))),d.setLocal("itAux",d.i32_add(d.getLocal("itAux"),d.i32_const(c))),d.setLocal("i",d.i32_add(d.getLocal("i"),d.i32_const(1))),d.br(0))),d.setLocal("itIn",d.i32_sub(d.getLocal("itIn"),d.getLocal("inStep"))),d.setLocal("itAux",d.i32_sub(d.getLocal("itAux"),d.i32_const(c))),d.setLocal("itOut",d.i32_add(d.getLocal("pOut"),d.i32_mul(d.i32_sub(d.getLocal("n"),d.i32_const(1)),d.getLocal("outStep")))),d.call(a+"_inverse",d.getLocal("itAux"),d.getLocal("itAux")),d.block(d.loop(d.br_if(1,d.i32_eqz(d.getLocal("i"))),d.if(d.call(a+"_isZero",d.getLocal("itIn")),[...d.call(a+"_copy",d.getLocal("itAux"),d.i32_sub(d.getLocal("itAux"),d.i32_const(c))),...d.call(a+"_zero",d.getLocal("itOut"))],[...d.call(a+"_copy",d.i32_sub(d.getLocal("itAux"),d.i32_const(c)),b),...d.call(a+"_mul",d.getLocal("itAux"),d.getLocal("itIn"),d.i32_sub(d.getLocal("itAux"),d.i32_const(c))),...d.call(a+"_mul",d.getLocal("itAux"),b,d.getLocal("itOut"))]),d.setLocal("itIn",d.i32_sub(d.getLocal("itIn"),d.getLocal("inStep"))),d.setLocal("itOut",d.i32_sub(d.getLocal("itOut"),d.getLocal("outStep"))),d.setLocal("itAux",d.i32_sub(d.getLocal("itAux"),d.i32_const(c))),d.setLocal("i",d.i32_sub(d.getLocal("i"),d.i32_const(1))),d.br(0)))),f.addCode(d.i32_store(d.i32_const(0),d.getLocal("itAux")))},N=function(e,a,c,f,d,b){void 0===b&&(b=fa?1:-1}function z(e){return e*e}function Q(e){return e%2n!==0n}function G(e){return e%2n===0n}function K(e){return e<0n}function H(e){return e>0n}function V(e){return K(e)?e.toString(2).length-1:e.toString(2).length}function Z(e){return e<0n?-e:e}function W(e){return 1n===Z(e)}function Y(e,a){for(var c,f,d,b=0n,t=1n,i=a,r=Z(e);0n!==r;)c=i/r,f=b,d=i,b=t,i=r,t=f-c*t,r=d-c*r;if(!W(i))throw new Error(e.toString()+" and "+a.toString()+" are not co-prime");return-1===D(b,0n)&&(b+=a),K(e)?-b:b}function J(e,a,c){if(0n===c)throw new Error("Cannot take modPow with modulus 0");var f=1n,d=e%c;for(K(a)&&(a*=-1n,d=Y(d,c));H(a);){if(0n===d)return 0n;Q(a)&&(f=f*d%c),a/=2n,d=z(d)%c}return f}function $(e,a){return 0n!==a&&(!!W(a)||(0===function(e,a){return(e=e>=0n?e:-e)===(a=a>=0n?a:-a)?0:e>a?1:-1}(a,2n)?G(e):e%a===0n))}function X(e,a){for(var c,f,d,b=function(e){return e-1n}(e),t=b,i=0;G(t);)t/=2n,i++;e:for(f=0;f>1&&f>1,e>>1)))),a.addCode(c.setLocal(r,c.i64_add(c.getLocal(r),c.i64_shr_u(c.getLocal(i),c.i64_const(32)))))),e>0&&(a.addCode(c.setLocal(i,c.i64_add(c.i64_and(c.getLocal(i),c.i64_const(4294967295)),c.i64_and(c.getLocal(n),c.i64_const(4294967295))))),a.addCode(c.setLocal(r,c.i64_add(c.i64_add(c.getLocal(r),c.i64_shr_u(c.getLocal(i),c.i64_const(32))),c.getLocal(o))))),a.addCode(c.i64_store32(c.getLocal("r"),4*e,c.getLocal(i))),a.addCode(c.setLocal(n,c.getLocal(r)),c.setLocal(o,c.i64_shr_u(c.getLocal(n),c.i64_const(32))))}a.addCode(c.i64_store32(c.getLocal("r"),4*d*2-4,c.getLocal(n)))}(),function(){const a=e.addFunction(f+"_squareOld");a.addParam("x","i32"),a.addParam("r","i32");const c=a.getCodeBuilder();a.addCode(c.call(f+"_mul",c.getLocal("x"),c.getLocal("x"),c.getLocal("r")))}(),function(){!function(){const a=e.addFunction(f+"__mul1");a.addParam("px","i32"),a.addParam("y","i64"),a.addParam("pr","i32"),a.addLocal("c","i64");const c=a.getCodeBuilder();a.addCode(c.setLocal("c",c.i64_mul(c.i64_load32_u(c.getLocal("px"),0,0),c.getLocal("y")))),a.addCode(c.i64_store32(c.getLocal("pr"),0,0,c.getLocal("c")));for(let e=1;e>1n,p=e.alloc(i,ee.bigInt2BytesLE(x,i)),g=x+1n,m=e.alloc(i,ee.bigInt2BytesLE(g,i));e.modules[r]={pq:o,pR2:s,n64:b,q:d,pOne:l,pZero:h,pePlusOne:m};let y=2n;if(re(d))for(;ie(y,x,d)!==u;)y+=1n;let _=0,v=u;for(;!ne(v)&&0n!==v;)_++,v>>=1n;const w=e.alloc(i,ee.bigInt2BytesLE(v,i)),M=ie(y,v,d),A=e.alloc(ee.bigInt2BytesLE((M<>1n,I=e.alloc(i,ee.bigInt2BytesLE(L,i));return e.exportFunction(n+"_copy",r+"_copy"),e.exportFunction(n+"_zero",r+"_zero"),e.exportFunction(n+"_isZero",r+"_isZero"),e.exportFunction(n+"_eq",r+"_eq"),function(){const a=e.addFunction(r+"_isOne");a.addParam("x","i32"),a.setReturnType("i32");const c=a.getCodeBuilder();a.addCode(c.ret(c.call(n+"_eq",c.getLocal("x"),c.i32_const(l))))}(),function(){const a=e.addFunction(r+"_add");a.addParam("x","i32"),a.addParam("y","i32"),a.addParam("r","i32");const c=a.getCodeBuilder();a.addCode(c.if(c.call(n+"_add",c.getLocal("x"),c.getLocal("y"),c.getLocal("r")),c.drop(c.call(n+"_sub",c.getLocal("r"),c.i32_const(o),c.getLocal("r"))),c.if(c.call(n+"_gte",c.getLocal("r"),c.i32_const(o)),c.drop(c.call(n+"_sub",c.getLocal("r"),c.i32_const(o),c.getLocal("r"))))))}(),function(){const a=e.addFunction(r+"_sub");a.addParam("x","i32"),a.addParam("y","i32"),a.addParam("r","i32");const c=a.getCodeBuilder();a.addCode(c.if(c.call(n+"_sub",c.getLocal("x"),c.getLocal("y"),c.getLocal("r")),c.drop(c.call(n+"_add",c.getLocal("r"),c.i32_const(o),c.getLocal("r")))))}(),function(){const a=e.addFunction(r+"_neg");a.addParam("x","i32"),a.addParam("r","i32");const c=a.getCodeBuilder();a.addCode(c.call(r+"_sub",c.i32_const(h),c.getLocal("x"),c.getLocal("r")))}(),function(){const a=e.alloc(t*t*8),c=e.addFunction(r+"_mReduct");c.addParam("t","i32"),c.addParam("r","i32"),c.addLocal("np32","i64"),c.addLocal("c","i64"),c.addLocal("m","i64");const f=c.getCodeBuilder(),b=Number(0x100000000n-te(d,0x100000000n));c.addCode(f.setLocal("np32",f.i64_const(b)));for(let e=0;e=t&&a.addCode(c.i64_store32(c.getLocal("r"),4*(e-t),c.getLocal(u))),[u,x]=[x,u],a.addCode(c.setLocal(x,c.i64_shr_u(c.getLocal(u),c.i64_const(32))))}a.addCode(c.i64_store32(c.getLocal("r"),4*t-4,c.getLocal(u))),a.addCode(c.if(c.i32_wrap_i64(c.getLocal(x)),c.drop(c.call(n+"_sub",c.getLocal("r"),c.i32_const(o),c.getLocal("r"))),c.if(c.call(n+"_gte",c.getLocal("r"),c.i32_const(o)),c.drop(c.call(n+"_sub",c.getLocal("r"),c.i32_const(o),c.getLocal("r"))))))}(),function(){const a=e.addFunction(r+"_square");a.addParam("x","i32"),a.addParam("r","i32"),a.addLocal("c0","i64"),a.addLocal("c1","i64"),a.addLocal("c0_old","i64"),a.addLocal("c1_old","i64"),a.addLocal("np32","i64");for(let e=0;e>1&&f>1,e>>1)))),a.addCode(c.setLocal(u,c.i64_add(c.getLocal(u),c.i64_shr_u(c.getLocal(h),c.i64_const(32)))))),e>0&&(a.addCode(c.setLocal(h,c.i64_add(c.i64_and(c.getLocal(h),c.i64_const(4294967295)),c.i64_and(c.getLocal(x),c.i64_const(4294967295))))),a.addCode(c.setLocal(u,c.i64_add(c.i64_add(c.getLocal(u),c.i64_shr_u(c.getLocal(h),c.i64_const(32))),c.getLocal(p)))));for(let f=Math.max(1,e-t+1);f<=e&&f=t&&a.addCode(c.i64_store32(c.getLocal("r"),4*(e-t),c.getLocal(h))),a.addCode(c.setLocal(x,c.getLocal(u)),c.setLocal(p,c.i64_shr_u(c.getLocal(x),c.i64_const(32))))}a.addCode(c.i64_store32(c.getLocal("r"),4*t-4,c.getLocal(x))),a.addCode(c.if(c.i32_wrap_i64(c.getLocal(p)),c.drop(c.call(n+"_sub",c.getLocal("r"),c.i32_const(o),c.getLocal("r"))),c.if(c.call(n+"_gte",c.getLocal("r"),c.i32_const(o)),c.drop(c.call(n+"_sub",c.getLocal("r"),c.i32_const(o),c.getLocal("r"))))))}(),function(){const a=e.addFunction(r+"_squareOld");a.addParam("x","i32"),a.addParam("r","i32");const c=a.getCodeBuilder();a.addCode(c.call(r+"_mul",c.getLocal("x"),c.getLocal("x"),c.getLocal("r")))}(),function(){const a=e.addFunction(r+"_toMontgomery");a.addParam("x","i32"),a.addParam("r","i32");const c=a.getCodeBuilder();a.addCode(c.call(r+"_mul",c.getLocal("x"),c.i32_const(s),c.getLocal("r")))}(),function(){const a=e.alloc(2*i),c=e.addFunction(r+"_fromMontgomery");c.addParam("x","i32"),c.addParam("r","i32");const f=c.getCodeBuilder();c.addCode(f.call(n+"_copy",f.getLocal("x"),f.i32_const(a))),c.addCode(f.call(n+"_zero",f.i32_const(a+i))),c.addCode(f.call(r+"_mReduct",f.i32_const(a),f.getLocal("r")))}(),function(){const a=e.addFunction(r+"_isNegative");a.addParam("x","i32"),a.setReturnType("i32");const c=a.getCodeBuilder(),f=c.i32_const(e.alloc(i));a.addCode(c.call(r+"_fromMontgomery",c.getLocal("x"),f),c.call(n+"_gte",f,c.i32_const(m)))}(),function(){const a=e.addFunction(r+"_sign");a.addParam("x","i32"),a.setReturnType("i32");const c=a.getCodeBuilder(),f=c.i32_const(e.alloc(i));a.addCode(c.if(c.call(n+"_isZero",c.getLocal("x")),c.ret(c.i32_const(0))),c.call(r+"_fromMontgomery",c.getLocal("x"),f),c.if(c.call(n+"_gte",f,c.i32_const(m)),c.ret(c.i32_const(-1))),c.ret(c.i32_const(1)))}(),function(){const a=e.addFunction(r+"_inverse");a.addParam("x","i32"),a.addParam("r","i32");const c=a.getCodeBuilder();a.addCode(c.call(r+"_fromMontgomery",c.getLocal("x"),c.getLocal("r"))),a.addCode(c.call(n+"_inverseMod",c.getLocal("r"),c.i32_const(o),c.getLocal("r"))),a.addCode(c.call(r+"_toMontgomery",c.getLocal("r"),c.getLocal("r")))}(),function(){const a=e.addFunction(r+"_one");a.addParam("pr","i32");const c=a.getCodeBuilder();a.addCode(c.call(n+"_copy",c.i32_const(l),c.getLocal("pr")))}(),function(){const a=e.addFunction(r+"_load");a.addParam("scalar","i32"),a.addParam("scalarLen","i32"),a.addParam("r","i32"),a.addLocal("p","i32"),a.addLocal("l","i32"),a.addLocal("i","i32"),a.addLocal("j","i32");const c=a.getCodeBuilder(),f=c.i32_const(e.alloc(i)),d=e.alloc(i),b=c.i32_const(d);a.addCode(c.call(n+"_zero",c.getLocal("r")),c.setLocal("i",c.i32_const(i)),c.setLocal("p",c.getLocal("scalar")),c.block(c.loop(c.br_if(1,c.i32_gt_u(c.getLocal("i"),c.getLocal("scalarLen"))),c.if(c.i32_eq(c.getLocal("i"),c.i32_const(i)),c.call(r+"_one",f),c.call(r+"_mul",f,c.i32_const(s),f)),c.call(r+"_mul",c.getLocal("p"),f,b),c.call(r+"_add",c.getLocal("r"),b,c.getLocal("r")),c.setLocal("p",c.i32_add(c.getLocal("p"),c.i32_const(i))),c.setLocal("i",c.i32_add(c.getLocal("i"),c.i32_const(i))),c.br(0))),c.setLocal("l",c.i32_rem_u(c.getLocal("scalarLen"),c.i32_const(i))),c.if(c.i32_eqz(c.getLocal("l")),c.ret([])),c.call(n+"_zero",b),c.setLocal("j",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal("j"),c.getLocal("l"))),c.i32_store8(c.getLocal("j"),d,c.i32_load8_u(c.getLocal("p"))),c.setLocal("p",c.i32_add(c.getLocal("p"),c.i32_const(1))),c.setLocal("j",c.i32_add(c.getLocal("j"),c.i32_const(1))),c.br(0))),c.if(c.i32_eq(c.getLocal("i"),c.i32_const(i)),c.call(r+"_one",f),c.call(r+"_mul",f,c.i32_const(s),f)),c.call(r+"_mul",b,f,b),c.call(r+"_add",c.getLocal("r"),b,c.getLocal("r")))}(),function(){const a=e.addFunction(r+"_timesScalar");a.addParam("x","i32"),a.addParam("scalar","i32"),a.addParam("scalarLen","i32"),a.addParam("r","i32");const c=a.getCodeBuilder(),f=c.i32_const(e.alloc(i));a.addCode(c.call(r+"_load",c.getLocal("scalar"),c.getLocal("scalarLen"),f),c.call(r+"_toMontgomery",f,f),c.call(r+"_mul",c.getLocal("x"),f,c.getLocal("r")))}(),ce(e,r),fe(e,r+"_batchToMontgomery",r+"_toMontgomery",i,i),fe(e,r+"_batchFromMontgomery",r+"_fromMontgomery",i,i),fe(e,r+"_batchNeg",r+"_neg",i,i),de(e,r+"_batchAdd",r+"_add",i,i),de(e,r+"_batchSub",r+"_sub",i,i),de(e,r+"_batchMul",r+"_mul",i,i),e.exportFunction(r+"_add"),e.exportFunction(r+"_sub"),e.exportFunction(r+"_neg"),e.exportFunction(r+"_isNegative"),e.exportFunction(r+"_isOne"),e.exportFunction(r+"_sign"),e.exportFunction(r+"_mReduct"),e.exportFunction(r+"_mul"),e.exportFunction(r+"_square"),e.exportFunction(r+"_squareOld"),e.exportFunction(r+"_fromMontgomery"),e.exportFunction(r+"_toMontgomery"),e.exportFunction(r+"_inverse"),e.exportFunction(r+"_one"),e.exportFunction(r+"_load"),e.exportFunction(r+"_timesScalar"),ae(e,r+"_exp",i,r+"_mul",r+"_square",n+"_copy",r+"_one"),e.exportFunction(r+"_exp"),e.exportFunction(r+"_batchInverse"),re(d)&&(function(){const a=e.addFunction(r+"_sqrt");a.addParam("n","i32"),a.addParam("r","i32"),a.addLocal("m","i32"),a.addLocal("i","i32"),a.addLocal("j","i32");const c=a.getCodeBuilder(),f=c.i32_const(l),d=c.i32_const(e.alloc(i)),b=c.i32_const(e.alloc(i)),t=c.i32_const(e.alloc(i)),n=c.i32_const(e.alloc(i)),o=c.i32_const(e.alloc(i));a.addCode(c.if(c.call(r+"_isZero",c.getLocal("n")),c.ret(c.call(r+"_zero",c.getLocal("r")))),c.setLocal("m",c.i32_const(_)),c.call(r+"_copy",c.i32_const(A),d),c.call(r+"_exp",c.getLocal("n"),c.i32_const(w),c.i32_const(i),b),c.call(r+"_exp",c.getLocal("n"),c.i32_const(I),c.i32_const(i),t),c.block(c.loop(c.br_if(1,c.call(r+"_eq",b,f)),c.call(r+"_square",b,n),c.setLocal("i",c.i32_const(1)),c.block(c.loop(c.br_if(1,c.call(r+"_eq",n,f)),c.call(r+"_square",n,n),c.setLocal("i",c.i32_add(c.getLocal("i"),c.i32_const(1))),c.br(0))),c.call(r+"_copy",d,o),c.setLocal("j",c.i32_sub(c.i32_sub(c.getLocal("m"),c.getLocal("i")),c.i32_const(1))),c.block(c.loop(c.br_if(1,c.i32_eqz(c.getLocal("j"))),c.call(r+"_square",o,o),c.setLocal("j",c.i32_sub(c.getLocal("j"),c.i32_const(1))),c.br(0))),c.setLocal("m",c.getLocal("i")),c.call(r+"_square",o,d),c.call(r+"_mul",b,d,b),c.call(r+"_mul",t,o,t),c.br(0))),c.if(c.call(r+"_isNegative",t),c.call(r+"_neg",t,c.getLocal("r")),c.call(r+"_copy",t,c.getLocal("r"))))}(),function(){const a=e.addFunction(r+"_isSquare");a.addParam("n","i32"),a.setReturnType("i32");const c=a.getCodeBuilder(),f=c.i32_const(l),d=c.i32_const(e.alloc(i));a.addCode(c.if(c.call(r+"_isZero",c.getLocal("n")),c.ret(c.i32_const(1))),c.call(r+"_exp",c.getLocal("n"),c.i32_const(p),c.i32_const(i),d),c.call(r+"_eq",d,f))}(),e.exportFunction(r+"_sqrt"),e.exportFunction(r+"_isSquare")),e.exportFunction(r+"_batchToMontgomery"),e.exportFunction(r+"_batchFromMontgomery"),r};const le=se,{bitLength:he}=q;var ue=function(e,a,c,f,d){const b=BigInt(a),t=Math.floor((he(b-1n)-1)/64)+1,i=8*t,r=c||"f1";if(e.modules[r])return r;e.modules[r]={n64:t};const n=d||"int",o=le(e,b,f,n),s=e.modules[o].pR2,l=e.modules[o].pq,h=e.modules[o].pePlusOne;return function(){const a=e.alloc(i),c=e.addFunction(r+"_mul");c.addParam("x","i32"),c.addParam("y","i32"),c.addParam("r","i32");const f=c.getCodeBuilder();c.addCode(f.call(o+"_mul",f.getLocal("x"),f.getLocal("y"),f.i32_const(a))),c.addCode(f.call(o+"_mul",f.i32_const(a),f.i32_const(s),f.getLocal("r")))}(),function(){const a=e.addFunction(r+"_square");a.addParam("x","i32"),a.addParam("r","i32");const c=a.getCodeBuilder();a.addCode(c.call(r+"_mul",c.getLocal("x"),c.getLocal("x"),c.getLocal("r")))}(),function(){const a=e.addFunction(r+"_inverse");a.addParam("x","i32"),a.addParam("r","i32");const c=a.getCodeBuilder();a.addCode(c.call(n+"_inverseMod",c.getLocal("x"),c.i32_const(l),c.getLocal("r")))}(),function(){const a=e.addFunction(r+"_isNegative");a.addParam("x","i32"),a.setReturnType("i32");const c=a.getCodeBuilder();a.addCode(c.call(n+"_gte",c.getLocal("x"),c.i32_const(h)))}(),e.exportFunction(o+"_add",r+"_add"),e.exportFunction(o+"_sub",r+"_sub"),e.exportFunction(o+"_neg",r+"_neg"),e.exportFunction(r+"_mul"),e.exportFunction(r+"_square"),e.exportFunction(r+"_inverse"),e.exportFunction(r+"_isNegative"),e.exportFunction(o+"_copy",r+"_copy"),e.exportFunction(o+"_zero",r+"_zero"),e.exportFunction(o+"_one",r+"_one"),e.exportFunction(o+"_isZero",r+"_isZero"),e.exportFunction(o+"_eq",r+"_eq"),r};const xe=U,pe=j,ge=T;var me=function(e,a,c,f){if(e.modules[c])return c;const d=8*e.modules[f].n64,b=e.modules[f].q;return e.modules[c]={n64:2*e.modules[f].n64},function(){const a=e.addFunction(c+"_isZero");a.addParam("x","i32"),a.setReturnType("i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d));a.addCode(b.i32_and(b.call(f+"_isZero",t),b.call(f+"_isZero",i)))}(),function(){const a=e.addFunction(c+"_isOne");a.addParam("x","i32"),a.setReturnType("i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d));a.addCode(b.ret(b.i32_and(b.call(f+"_isOne",t),b.call(f+"_isZero",i))))}(),function(){const a=e.addFunction(c+"_zero");a.addParam("x","i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d));a.addCode(b.call(f+"_zero",t),b.call(f+"_zero",i))}(),function(){const a=e.addFunction(c+"_one");a.addParam("x","i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d));a.addCode(b.call(f+"_one",t),b.call(f+"_zero",i))}(),function(){const a=e.addFunction(c+"_copy");a.addParam("x","i32"),a.addParam("r","i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.getLocal("r"),n=b.i32_add(b.getLocal("r"),b.i32_const(d));a.addCode(b.call(f+"_copy",t,r),b.call(f+"_copy",i,n))}(),function(){const b=e.addFunction(c+"_mul");b.addParam("x","i32"),b.addParam("y","i32"),b.addParam("r","i32");const t=b.getCodeBuilder(),i=t.getLocal("x"),r=t.i32_add(t.getLocal("x"),t.i32_const(d)),n=t.getLocal("y"),o=t.i32_add(t.getLocal("y"),t.i32_const(d)),s=t.getLocal("r"),l=t.i32_add(t.getLocal("r"),t.i32_const(d)),h=t.i32_const(e.alloc(d)),u=t.i32_const(e.alloc(d)),x=t.i32_const(e.alloc(d)),p=t.i32_const(e.alloc(d));b.addCode(t.call(f+"_mul",i,n,h),t.call(f+"_mul",r,o,u),t.call(f+"_add",i,r,x),t.call(f+"_add",n,o,p),t.call(f+"_mul",x,p,x),t.call(a,u,s),t.call(f+"_add",h,s,s),t.call(f+"_add",h,u,l),t.call(f+"_sub",x,l,l))}(),function(){const a=e.addFunction(c+"_mul1");a.addParam("x","i32"),a.addParam("y","i32"),a.addParam("r","i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.getLocal("y"),n=b.getLocal("r"),o=b.i32_add(b.getLocal("r"),b.i32_const(d));a.addCode(b.call(f+"_mul",t,r,n),b.call(f+"_mul",i,r,o))}(),function(){const b=e.addFunction(c+"_square");b.addParam("x","i32"),b.addParam("r","i32");const t=b.getCodeBuilder(),i=t.getLocal("x"),r=t.i32_add(t.getLocal("x"),t.i32_const(d)),n=t.getLocal("r"),o=t.i32_add(t.getLocal("r"),t.i32_const(d)),s=t.i32_const(e.alloc(d)),l=t.i32_const(e.alloc(d)),h=t.i32_const(e.alloc(d)),u=t.i32_const(e.alloc(d));b.addCode(t.call(f+"_mul",i,r,s),t.call(f+"_add",i,r,l),t.call(a,r,h),t.call(f+"_add",i,h,h),t.call(a,s,u),t.call(f+"_add",u,s,u),t.call(f+"_mul",l,h,n),t.call(f+"_sub",n,u,n),t.call(f+"_add",s,s,o))}(),function(){const a=e.addFunction(c+"_add");a.addParam("x","i32"),a.addParam("y","i32"),a.addParam("r","i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.getLocal("y"),n=b.i32_add(b.getLocal("y"),b.i32_const(d)),o=b.getLocal("r"),s=b.i32_add(b.getLocal("r"),b.i32_const(d));a.addCode(b.call(f+"_add",t,r,o),b.call(f+"_add",i,n,s))}(),function(){const a=e.addFunction(c+"_sub");a.addParam("x","i32"),a.addParam("y","i32"),a.addParam("r","i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.getLocal("y"),n=b.i32_add(b.getLocal("y"),b.i32_const(d)),o=b.getLocal("r"),s=b.i32_add(b.getLocal("r"),b.i32_const(d));a.addCode(b.call(f+"_sub",t,r,o),b.call(f+"_sub",i,n,s))}(),function(){const a=e.addFunction(c+"_neg");a.addParam("x","i32"),a.addParam("r","i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.getLocal("r"),n=b.i32_add(b.getLocal("r"),b.i32_const(d));a.addCode(b.call(f+"_neg",t,r),b.call(f+"_neg",i,n))}(),function(){const a=e.addFunction(c+"_conjugate");a.addParam("x","i32"),a.addParam("r","i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.getLocal("r"),n=b.i32_add(b.getLocal("r"),b.i32_const(d));a.addCode(b.call(f+"_copy",t,r),b.call(f+"_neg",i,n))}(),function(){const a=e.addFunction(c+"_toMontgomery");a.addParam("x","i32"),a.addParam("r","i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.getLocal("r"),n=b.i32_add(b.getLocal("r"),b.i32_const(d));a.addCode(b.call(f+"_toMontgomery",t,r),b.call(f+"_toMontgomery",i,n))}(),function(){const a=e.addFunction(c+"_fromMontgomery");a.addParam("x","i32"),a.addParam("r","i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.getLocal("r"),n=b.i32_add(b.getLocal("r"),b.i32_const(d));a.addCode(b.call(f+"_fromMontgomery",t,r),b.call(f+"_fromMontgomery",i,n))}(),function(){const a=e.addFunction(c+"_eq");a.addParam("x","i32"),a.addParam("y","i32"),a.setReturnType("i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.getLocal("y"),n=b.i32_add(b.getLocal("y"),b.i32_const(d));a.addCode(b.i32_and(b.call(f+"_eq",t,r),b.call(f+"_eq",i,n)))}(),function(){const b=e.addFunction(c+"_inverse");b.addParam("x","i32"),b.addParam("r","i32");const t=b.getCodeBuilder(),i=t.getLocal("x"),r=t.i32_add(t.getLocal("x"),t.i32_const(d)),n=t.getLocal("r"),o=t.i32_add(t.getLocal("r"),t.i32_const(d)),s=t.i32_const(e.alloc(d)),l=t.i32_const(e.alloc(d)),h=t.i32_const(e.alloc(d)),u=t.i32_const(e.alloc(d));b.addCode(t.call(f+"_square",i,s),t.call(f+"_square",r,l),t.call(a,l,h),t.call(f+"_sub",s,h,h),t.call(f+"_inverse",h,u),t.call(f+"_mul",i,u,n),t.call(f+"_mul",r,u,o),t.call(f+"_neg",o,o))}(),function(){const a=e.addFunction(c+"_timesScalar");a.addParam("x","i32"),a.addParam("scalar","i32"),a.addParam("scalarLen","i32"),a.addParam("r","i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.getLocal("r"),n=b.i32_add(b.getLocal("r"),b.i32_const(d));a.addCode(b.call(f+"_timesScalar",t,b.getLocal("scalar"),b.getLocal("scalarLen"),r),b.call(f+"_timesScalar",i,b.getLocal("scalar"),b.getLocal("scalarLen"),n))}(),function(){const a=e.addFunction(c+"_sign");a.addParam("x","i32"),a.addLocal("s","i32"),a.setReturnType("i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d));a.addCode(b.setLocal("s",b.call(f+"_sign",i)),b.if(b.getLocal("s"),b.ret(b.getLocal("s"))),b.ret(b.call(f+"_sign",t)))}(),function(){const a=e.addFunction(c+"_isNegative");a.addParam("x","i32"),a.setReturnType("i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d));a.addCode(b.if(b.call(f+"_isZero",i),b.ret(b.call(f+"_isNegative",t))),b.ret(b.call(f+"_isNegative",i)))}(),e.exportFunction(c+"_isZero"),e.exportFunction(c+"_isOne"),e.exportFunction(c+"_zero"),e.exportFunction(c+"_one"),e.exportFunction(c+"_copy"),e.exportFunction(c+"_mul"),e.exportFunction(c+"_mul1"),e.exportFunction(c+"_square"),e.exportFunction(c+"_add"),e.exportFunction(c+"_sub"),e.exportFunction(c+"_neg"),e.exportFunction(c+"_sign"),e.exportFunction(c+"_conjugate"),e.exportFunction(c+"_fromMontgomery"),e.exportFunction(c+"_toMontgomery"),e.exportFunction(c+"_eq"),e.exportFunction(c+"_inverse"),pe(e,c),xe(e,c+"_exp",2*d,c+"_mul",c+"_square",c+"_copy",c+"_one"),function(){const a=e.addFunction(c+"_sqrt");a.addParam("a","i32"),a.addParam("pr","i32");const t=a.getCodeBuilder(),i=t.i32_const(e.alloc(ge.bigInt2BytesLE((BigInt(b||0)-3n)/4n,d))),r=t.i32_const(e.alloc(ge.bigInt2BytesLE((BigInt(b||0)-1n)/2n,d))),n=t.getLocal("a"),o=t.i32_const(e.alloc(2*d)),s=t.i32_const(e.alloc(2*d)),l=t.i32_const(e.alloc(2*d)),h=e.alloc(2*d),u=t.i32_const(h),x=t.i32_const(h),p=t.i32_const(h+d),g=t.i32_const(e.alloc(2*d)),m=t.i32_const(e.alloc(2*d));a.addCode(t.call(c+"_one",u),t.call(c+"_neg",u,u),t.call(c+"_exp",n,i,t.i32_const(d),o),t.call(c+"_square",o,s),t.call(c+"_mul",n,s,s),t.call(c+"_conjugate",s,l),t.call(c+"_mul",l,s,l),t.if(t.call(c+"_eq",l,u),t.unreachable()),t.call(c+"_mul",o,n,g),t.if(t.call(c+"_eq",s,u),[...t.call(f+"_zero",x),...t.call(f+"_one",p),...t.call(c+"_mul",u,g,t.getLocal("pr"))],[...t.call(c+"_one",m),...t.call(c+"_add",m,s,m),...t.call(c+"_exp",m,r,t.i32_const(d),m),...t.call(c+"_mul",m,g,t.getLocal("pr"))]))}(),function(){const a=e.addFunction(c+"_isSquare");a.addParam("a","i32"),a.setReturnType("i32");const f=a.getCodeBuilder(),t=f.i32_const(e.alloc(ge.bigInt2BytesLE((BigInt(b||0)-3n)/4n,d))),i=f.getLocal("a"),r=f.i32_const(e.alloc(2*d)),n=f.i32_const(e.alloc(2*d)),o=f.i32_const(e.alloc(2*d)),s=e.alloc(2*d),l=f.i32_const(s);a.addCode(f.call(c+"_one",l),f.call(c+"_neg",l,l),f.call(c+"_exp",i,t,f.i32_const(d),r),f.call(c+"_square",r,n),f.call(c+"_mul",i,n,n),f.call(c+"_conjugate",n,o),f.call(c+"_mul",o,n,o),f.if(f.call(c+"_eq",o,l),f.ret(f.i32_const(0))),f.ret(f.i32_const(1)))}(),e.exportFunction(c+"_exp"),e.exportFunction(c+"_timesScalar"),e.exportFunction(c+"_batchInverse"),e.exportFunction(c+"_sqrt"),e.exportFunction(c+"_isSquare"),e.exportFunction(c+"_isNegative"),c};const ye=U,_e=j;var ve=function(e,a,c,f){if(e.modules[c])return c;const d=8*e.modules[f].n64;return e.modules[c]={n64:3*e.modules[f].n64},function(){const a=e.addFunction(c+"_isZero");a.addParam("x","i32"),a.setReturnType("i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.i32_add(b.getLocal("x"),b.i32_const(2*d));a.addCode(b.i32_and(b.i32_and(b.call(f+"_isZero",t),b.call(f+"_isZero",i)),b.call(f+"_isZero",r)))}(),function(){const a=e.addFunction(c+"_isOne");a.addParam("x","i32"),a.setReturnType("i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.i32_add(b.getLocal("x"),b.i32_const(2*d));a.addCode(b.ret(b.i32_and(b.i32_and(b.call(f+"_isOne",t),b.call(f+"_isZero",i)),b.call(f+"_isZero",r))))}(),function(){const a=e.addFunction(c+"_zero");a.addParam("x","i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.i32_add(b.getLocal("x"),b.i32_const(2*d));a.addCode(b.call(f+"_zero",t),b.call(f+"_zero",i),b.call(f+"_zero",r))}(),function(){const a=e.addFunction(c+"_one");a.addParam("x","i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.i32_add(b.getLocal("x"),b.i32_const(2*d));a.addCode(b.call(f+"_one",t),b.call(f+"_zero",i),b.call(f+"_zero",r))}(),function(){const a=e.addFunction(c+"_copy");a.addParam("x","i32"),a.addParam("r","i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.i32_add(b.getLocal("x"),b.i32_const(2*d)),n=b.getLocal("r"),o=b.i32_add(b.getLocal("r"),b.i32_const(d)),s=b.i32_add(b.getLocal("r"),b.i32_const(2*d));a.addCode(b.call(f+"_copy",t,n),b.call(f+"_copy",i,o),b.call(f+"_copy",r,s))}(),function(){const b=e.addFunction(c+"_mul");b.addParam("x","i32"),b.addParam("y","i32"),b.addParam("r","i32");const t=b.getCodeBuilder(),i=t.getLocal("x"),r=t.i32_add(t.getLocal("x"),t.i32_const(d)),n=t.i32_add(t.getLocal("x"),t.i32_const(2*d)),o=t.getLocal("y"),s=t.i32_add(t.getLocal("y"),t.i32_const(d)),l=t.i32_add(t.getLocal("y"),t.i32_const(2*d)),h=t.getLocal("r"),u=t.i32_add(t.getLocal("r"),t.i32_const(d)),x=t.i32_add(t.getLocal("r"),t.i32_const(2*d)),p=t.i32_const(e.alloc(d)),g=t.i32_const(e.alloc(d)),m=t.i32_const(e.alloc(d)),y=t.i32_const(e.alloc(d)),_=t.i32_const(e.alloc(d)),v=t.i32_const(e.alloc(d)),w=t.i32_const(e.alloc(d)),M=t.i32_const(e.alloc(d)),A=t.i32_const(e.alloc(d)),L=t.i32_const(e.alloc(d)),I=t.i32_const(e.alloc(d)),k=t.i32_const(e.alloc(d)),E=t.i32_const(e.alloc(d));b.addCode(t.call(f+"_mul",i,o,p),t.call(f+"_mul",r,s,g),t.call(f+"_mul",n,l,m),t.call(f+"_add",i,r,y),t.call(f+"_add",o,s,_),t.call(f+"_add",i,n,v),t.call(f+"_add",o,l,w),t.call(f+"_add",r,n,M),t.call(f+"_add",s,l,A),t.call(f+"_add",p,g,L),t.call(f+"_add",p,m,I),t.call(f+"_add",g,m,k),t.call(f+"_mul",M,A,h),t.call(f+"_sub",h,k,h),t.call(a,h,h),t.call(f+"_add",p,h,h),t.call(f+"_mul",y,_,u),t.call(f+"_sub",u,L,u),t.call(a,m,E),t.call(f+"_add",u,E,u),t.call(f+"_mul",v,w,x),t.call(f+"_sub",x,I,x),t.call(f+"_add",x,g,x))}(),function(){const b=e.addFunction(c+"_square");b.addParam("x","i32"),b.addParam("r","i32");const t=b.getCodeBuilder(),i=t.getLocal("x"),r=t.i32_add(t.getLocal("x"),t.i32_const(d)),n=t.i32_add(t.getLocal("x"),t.i32_const(2*d)),o=t.getLocal("r"),s=t.i32_add(t.getLocal("r"),t.i32_const(d)),l=t.i32_add(t.getLocal("r"),t.i32_const(2*d)),h=t.i32_const(e.alloc(d)),u=t.i32_const(e.alloc(d)),x=t.i32_const(e.alloc(d)),p=t.i32_const(e.alloc(d)),g=t.i32_const(e.alloc(d)),m=t.i32_const(e.alloc(d)),y=t.i32_const(e.alloc(d));b.addCode(t.call(f+"_square",i,h),t.call(f+"_mul",i,r,u),t.call(f+"_add",u,u,x),t.call(f+"_sub",i,r,p),t.call(f+"_add",p,n,p),t.call(f+"_square",p,p),t.call(f+"_mul",r,n,g),t.call(f+"_add",g,g,m),t.call(f+"_square",n,y),t.call(a,m,o),t.call(f+"_add",h,o,o),t.call(a,y,s),t.call(f+"_add",x,s,s),t.call(f+"_add",h,y,l),t.call(f+"_sub",m,l,l),t.call(f+"_add",p,l,l),t.call(f+"_add",x,l,l))}(),function(){const a=e.addFunction(c+"_add");a.addParam("x","i32"),a.addParam("y","i32"),a.addParam("r","i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.i32_add(b.getLocal("x"),b.i32_const(2*d)),n=b.getLocal("y"),o=b.i32_add(b.getLocal("y"),b.i32_const(d)),s=b.i32_add(b.getLocal("y"),b.i32_const(2*d)),l=b.getLocal("r"),h=b.i32_add(b.getLocal("r"),b.i32_const(d)),u=b.i32_add(b.getLocal("r"),b.i32_const(2*d));a.addCode(b.call(f+"_add",t,n,l),b.call(f+"_add",i,o,h),b.call(f+"_add",r,s,u))}(),function(){const a=e.addFunction(c+"_sub");a.addParam("x","i32"),a.addParam("y","i32"),a.addParam("r","i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.i32_add(b.getLocal("x"),b.i32_const(2*d)),n=b.getLocal("y"),o=b.i32_add(b.getLocal("y"),b.i32_const(d)),s=b.i32_add(b.getLocal("y"),b.i32_const(2*d)),l=b.getLocal("r"),h=b.i32_add(b.getLocal("r"),b.i32_const(d)),u=b.i32_add(b.getLocal("r"),b.i32_const(2*d));a.addCode(b.call(f+"_sub",t,n,l),b.call(f+"_sub",i,o,h),b.call(f+"_sub",r,s,u))}(),function(){const a=e.addFunction(c+"_neg");a.addParam("x","i32"),a.addParam("r","i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.i32_add(b.getLocal("x"),b.i32_const(2*d)),n=b.getLocal("r"),o=b.i32_add(b.getLocal("r"),b.i32_const(d)),s=b.i32_add(b.getLocal("r"),b.i32_const(2*d));a.addCode(b.call(f+"_neg",t,n),b.call(f+"_neg",i,o),b.call(f+"_neg",r,s))}(),function(){const a=e.addFunction(c+"_sign");a.addParam("x","i32"),a.addLocal("s","i32"),a.setReturnType("i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.i32_add(b.getLocal("x"),b.i32_const(2*d));a.addCode(b.setLocal("s",b.call(f+"_sign",r)),b.if(b.getLocal("s"),b.ret(b.getLocal("s"))),b.setLocal("s",b.call(f+"_sign",i)),b.if(b.getLocal("s"),b.ret(b.getLocal("s"))),b.ret(b.call(f+"_sign",t)))}(),function(){const a=e.addFunction(c+"_toMontgomery");a.addParam("x","i32"),a.addParam("r","i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.i32_add(b.getLocal("x"),b.i32_const(2*d)),n=b.getLocal("r"),o=b.i32_add(b.getLocal("r"),b.i32_const(d)),s=b.i32_add(b.getLocal("r"),b.i32_const(2*d));a.addCode(b.call(f+"_toMontgomery",t,n),b.call(f+"_toMontgomery",i,o),b.call(f+"_toMontgomery",r,s))}(),function(){const a=e.addFunction(c+"_fromMontgomery");a.addParam("x","i32"),a.addParam("r","i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.i32_add(b.getLocal("x"),b.i32_const(2*d)),n=b.getLocal("r"),o=b.i32_add(b.getLocal("r"),b.i32_const(d)),s=b.i32_add(b.getLocal("r"),b.i32_const(2*d));a.addCode(b.call(f+"_fromMontgomery",t,n),b.call(f+"_fromMontgomery",i,o),b.call(f+"_fromMontgomery",r,s))}(),function(){const a=e.addFunction(c+"_eq");a.addParam("x","i32"),a.addParam("y","i32"),a.setReturnType("i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.i32_add(b.getLocal("x"),b.i32_const(2*d)),n=b.getLocal("y"),o=b.i32_add(b.getLocal("y"),b.i32_const(d)),s=b.i32_add(b.getLocal("y"),b.i32_const(2*d));a.addCode(b.i32_and(b.i32_and(b.call(f+"_eq",t,n),b.call(f+"_eq",i,o)),b.call(f+"_eq",r,s)))}(),function(){const b=e.addFunction(c+"_inverse");b.addParam("x","i32"),b.addParam("r","i32");const t=b.getCodeBuilder(),i=t.getLocal("x"),r=t.i32_add(t.getLocal("x"),t.i32_const(d)),n=t.i32_add(t.getLocal("x"),t.i32_const(2*d)),o=t.getLocal("r"),s=t.i32_add(t.getLocal("r"),t.i32_const(d)),l=t.i32_add(t.getLocal("r"),t.i32_const(2*d)),h=t.i32_const(e.alloc(d)),u=t.i32_const(e.alloc(d)),x=t.i32_const(e.alloc(d)),p=t.i32_const(e.alloc(d)),g=t.i32_const(e.alloc(d)),m=t.i32_const(e.alloc(d)),y=t.i32_const(e.alloc(d)),_=t.i32_const(e.alloc(d)),v=t.i32_const(e.alloc(d)),w=t.i32_const(e.alloc(d)),M=t.i32_const(e.alloc(d));b.addCode(t.call(f+"_square",i,h),t.call(f+"_square",r,u),t.call(f+"_square",n,x),t.call(f+"_mul",i,r,p),t.call(f+"_mul",i,n,g),t.call(f+"_mul",r,n,m),t.call(a,m,y),t.call(f+"_sub",h,y,y),t.call(a,x,_),t.call(f+"_sub",_,p,_),t.call(f+"_sub",u,g,v),t.call(f+"_mul",n,_,w),t.call(f+"_mul",r,v,M),t.call(f+"_add",w,M,w),t.call(a,w,w),t.call(f+"_mul",i,y,M),t.call(f+"_add",M,w,w),t.call(f+"_inverse",w,w),t.call(f+"_mul",w,y,o),t.call(f+"_mul",w,_,s),t.call(f+"_mul",w,v,l))}(),function(){const a=e.addFunction(c+"_timesScalar");a.addParam("x","i32"),a.addParam("scalar","i32"),a.addParam("scalarLen","i32"),a.addParam("r","i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.i32_add(b.getLocal("x"),b.i32_const(2*d)),n=b.getLocal("r"),o=b.i32_add(b.getLocal("r"),b.i32_const(d)),s=b.i32_add(b.getLocal("r"),b.i32_const(2*d));a.addCode(b.call(f+"_timesScalar",t,b.getLocal("scalar"),b.getLocal("scalarLen"),n),b.call(f+"_timesScalar",i,b.getLocal("scalar"),b.getLocal("scalarLen"),o),b.call(f+"_timesScalar",r,b.getLocal("scalar"),b.getLocal("scalarLen"),s))}(),function(){const a=e.addFunction(c+"_isNegative");a.addParam("x","i32"),a.setReturnType("i32");const b=a.getCodeBuilder(),t=b.getLocal("x"),i=b.i32_add(b.getLocal("x"),b.i32_const(d)),r=b.i32_add(b.getLocal("x"),b.i32_const(2*d));a.addCode(b.if(b.call(f+"_isZero",r),b.if(b.call(f+"_isZero",i),b.ret(b.call(f+"_isNegative",t)),b.ret(b.call(f+"_isNegative",i)))),b.ret(b.call(f+"_isNegative",r)))}(),e.exportFunction(c+"_isZero"),e.exportFunction(c+"_isOne"),e.exportFunction(c+"_zero"),e.exportFunction(c+"_one"),e.exportFunction(c+"_copy"),e.exportFunction(c+"_mul"),e.exportFunction(c+"_square"),e.exportFunction(c+"_add"),e.exportFunction(c+"_sub"),e.exportFunction(c+"_neg"),e.exportFunction(c+"_sign"),e.exportFunction(c+"_fromMontgomery"),e.exportFunction(c+"_toMontgomery"),e.exportFunction(c+"_eq"),e.exportFunction(c+"_inverse"),_e(e,c),ye(e,c+"_exp",3*d,c+"_mul",c+"_square",c+"_copy",c+"_one"),e.exportFunction(c+"_exp"),e.exportFunction(c+"_timesScalar"),e.exportFunction(c+"_batchInverse"),e.exportFunction(c+"_isNegative"),c};const we=function(e,a,c,f,d,b,t,i){const r=e.addFunction(a);r.addParam("base","i32"),r.addParam("scalar","i32"),r.addParam("scalarLength","i32"),r.addParam("r","i32"),r.addLocal("old0","i32"),r.addLocal("nbits","i32"),r.addLocal("i","i32"),r.addLocal("last","i32"),r.addLocal("cur","i32"),r.addLocal("carry","i32"),r.addLocal("p","i32");const n=r.getCodeBuilder(),o=n.i32_const(e.alloc(c));function s(e){return n.i32_and(n.i32_shr_u(n.i32_load(n.i32_add(n.getLocal("scalar"),n.i32_and(n.i32_shr_u(e,n.i32_const(3)),n.i32_const(4294967292)))),n.i32_and(e,n.i32_const(31))),n.i32_const(1))}function l(e){return[...n.i32_store8(n.getLocal("p"),n.i32_const(e)),...n.setLocal("p",n.i32_add(n.getLocal("p"),n.i32_const(1)))]}r.addCode(n.if(n.i32_eqz(n.getLocal("scalarLength")),[...n.call(i,n.getLocal("r")),...n.ret([])]),n.setLocal("nbits",n.i32_shl(n.getLocal("scalarLength"),n.i32_const(3))),n.setLocal("old0",n.i32_load(n.i32_const(0))),n.setLocal("p",n.getLocal("old0")),n.i32_store(n.i32_const(0),n.i32_and(n.i32_add(n.i32_add(n.getLocal("old0"),n.i32_const(32)),n.getLocal("nbits")),n.i32_const(4294967288))),n.setLocal("i",n.i32_const(1)),n.setLocal("last",s(n.i32_const(0))),n.setLocal("carry",n.i32_const(0)),n.block(n.loop(n.br_if(1,n.i32_eq(n.getLocal("i"),n.getLocal("nbits"))),n.setLocal("cur",s(n.getLocal("i"))),n.if(n.getLocal("last"),n.if(n.getLocal("cur"),n.if(n.getLocal("carry"),[...n.setLocal("last",n.i32_const(0)),...n.setLocal("carry",n.i32_const(1)),...l(1)],[...n.setLocal("last",n.i32_const(0)),...n.setLocal("carry",n.i32_const(1)),...l(255)]),n.if(n.getLocal("carry"),[...n.setLocal("last",n.i32_const(0)),...n.setLocal("carry",n.i32_const(1)),...l(255)],[...n.setLocal("last",n.i32_const(0)),...n.setLocal("carry",n.i32_const(0)),...l(1)])),n.if(n.getLocal("cur"),n.if(n.getLocal("carry"),[...n.setLocal("last",n.i32_const(0)),...n.setLocal("carry",n.i32_const(1)),...l(0)],[...n.setLocal("last",n.i32_const(1)),...n.setLocal("carry",n.i32_const(0)),...l(0)]),n.if(n.getLocal("carry"),[...n.setLocal("last",n.i32_const(1)),...n.setLocal("carry",n.i32_const(0)),...l(0)],[...n.setLocal("last",n.i32_const(0)),...n.setLocal("carry",n.i32_const(0)),...l(0)]))),n.setLocal("i",n.i32_add(n.getLocal("i"),n.i32_const(1))),n.br(0))),n.if(n.getLocal("last"),n.if(n.getLocal("carry"),[...l(255),...l(0),...l(1)],[...l(1)]),n.if(n.getLocal("carry"),[...l(0),...l(1)])),n.setLocal("p",n.i32_sub(n.getLocal("p"),n.i32_const(1))),n.call(t,n.getLocal("base"),o),n.call(i,n.getLocal("r")),n.block(n.loop(n.call(d,n.getLocal("r"),n.getLocal("r")),n.setLocal("cur",n.i32_load8_u(n.getLocal("p"))),n.if(n.getLocal("cur"),n.if(n.i32_eq(n.getLocal("cur"),n.i32_const(1)),n.call(f,n.getLocal("r"),o,n.getLocal("r")),n.call(b,n.getLocal("r"),o,n.getLocal("r")))),n.br_if(1,n.i32_eq(n.getLocal("old0"),n.getLocal("p"))),n.setLocal("p",n.i32_sub(n.getLocal("p"),n.i32_const(1))),n.br(0))),n.i32_store(n.i32_const(0),n.getLocal("old0")))},Me=N,Ae=function(e,a,c,f,d){const b=8*e.modules[a].n64;!function(){const a=e.addFunction(c+"_getChunk");a.addParam("pScalar","i32"),a.addParam("scalarSize","i32"),a.addParam("startBit","i32"),a.addParam("chunkSize","i32"),a.addLocal("bitsToEnd","i32"),a.addLocal("mask","i32"),a.setReturnType("i32");const f=a.getCodeBuilder();a.addCode(f.setLocal("bitsToEnd",f.i32_sub(f.i32_mul(f.getLocal("scalarSize"),f.i32_const(8)),f.getLocal("startBit"))),f.if(f.i32_gt_s(f.getLocal("chunkSize"),f.getLocal("bitsToEnd")),f.setLocal("mask",f.i32_sub(f.i32_shl(f.i32_const(1),f.getLocal("bitsToEnd")),f.i32_const(1))),f.setLocal("mask",f.i32_sub(f.i32_shl(f.i32_const(1),f.getLocal("chunkSize")),f.i32_const(1)))),f.i32_and(f.i32_shr_u(f.i32_load(f.i32_add(f.getLocal("pScalar"),f.i32_shr_u(f.getLocal("startBit"),f.i32_const(3))),0,0),f.i32_and(f.getLocal("startBit"),f.i32_const(7))),f.getLocal("mask")))}(),function(){const f=e.addFunction(c+"_reduceTable");f.addParam("pTable","i32"),f.addParam("p","i32"),f.addLocal("half","i32"),f.addLocal("it1","i32"),f.addLocal("it2","i32"),f.addLocal("pAcc","i32");const d=f.getCodeBuilder();f.addCode(d.if(d.i32_eq(d.getLocal("p"),d.i32_const(1)),d.ret([])),d.setLocal("half",d.i32_shl(d.i32_const(1),d.i32_sub(d.getLocal("p"),d.i32_const(1)))),d.setLocal("it1",d.getLocal("pTable")),d.setLocal("it2",d.i32_add(d.getLocal("pTable"),d.i32_mul(d.getLocal("half"),d.i32_const(b)))),d.setLocal("pAcc",d.i32_sub(d.getLocal("it2"),d.i32_const(b))),d.block(d.loop(d.br_if(1,d.i32_eq(d.getLocal("it1"),d.getLocal("pAcc"))),d.call(a+"_add",d.getLocal("it1"),d.getLocal("it2"),d.getLocal("it1")),d.call(a+"_add",d.getLocal("pAcc"),d.getLocal("it2"),d.getLocal("pAcc")),d.setLocal("it1",d.i32_add(d.getLocal("it1"),d.i32_const(b))),d.setLocal("it2",d.i32_add(d.getLocal("it2"),d.i32_const(b))),d.br(0))),d.call(c+"_reduceTable",d.getLocal("pTable"),d.i32_sub(d.getLocal("p"),d.i32_const(1))),d.setLocal("p",d.i32_sub(d.getLocal("p"),d.i32_const(1))),d.block(d.loop(d.br_if(1,d.i32_eqz(d.getLocal("p"))),d.call(a+"_double",d.getLocal("pAcc"),d.getLocal("pAcc")),d.setLocal("p",d.i32_sub(d.getLocal("p"),d.i32_const(1))),d.br(0))),d.call(a+"_add",d.getLocal("pTable"),d.getLocal("pAcc"),d.getLocal("pTable")))}(),function(){const t=e.addFunction(c+"_chunk");t.addParam("pBases","i32"),t.addParam("pScalars","i32"),t.addParam("scalarSize","i32"),t.addParam("n","i32"),t.addParam("startBit","i32"),t.addParam("chunkSize","i32"),t.addParam("pr","i32"),t.addLocal("nChunks","i32"),t.addLocal("itScalar","i32"),t.addLocal("endScalar","i32"),t.addLocal("itBase","i32"),t.addLocal("i","i32"),t.addLocal("j","i32"),t.addLocal("nTable","i32"),t.addLocal("pTable","i32"),t.addLocal("idx","i32"),t.addLocal("pIdxTable","i32");const i=t.getCodeBuilder();t.addCode(i.if(i.i32_eqz(i.getLocal("n")),[...i.call(a+"_zero",i.getLocal("pr")),...i.ret([])]),i.setLocal("nTable",i.i32_shl(i.i32_const(1),i.getLocal("chunkSize"))),i.setLocal("pTable",i.i32_load(i.i32_const(0))),i.i32_store(i.i32_const(0),i.i32_add(i.getLocal("pTable"),i.i32_mul(i.getLocal("nTable"),i.i32_const(b)))),i.setLocal("j",i.i32_const(0)),i.block(i.loop(i.br_if(1,i.i32_eq(i.getLocal("j"),i.getLocal("nTable"))),i.call(a+"_zero",i.i32_add(i.getLocal("pTable"),i.i32_mul(i.getLocal("j"),i.i32_const(b)))),i.setLocal("j",i.i32_add(i.getLocal("j"),i.i32_const(1))),i.br(0))),i.setLocal("itBase",i.getLocal("pBases")),i.setLocal("itScalar",i.getLocal("pScalars")),i.setLocal("endScalar",i.i32_add(i.getLocal("pScalars"),i.i32_mul(i.getLocal("n"),i.getLocal("scalarSize")))),i.block(i.loop(i.br_if(1,i.i32_eq(i.getLocal("itScalar"),i.getLocal("endScalar"))),i.setLocal("idx",i.call(c+"_getChunk",i.getLocal("itScalar"),i.getLocal("scalarSize"),i.getLocal("startBit"),i.getLocal("chunkSize"))),i.if(i.getLocal("idx"),[...i.setLocal("pIdxTable",i.i32_add(i.getLocal("pTable"),i.i32_mul(i.i32_sub(i.getLocal("idx"),i.i32_const(1)),i.i32_const(b)))),...i.call(f,i.getLocal("pIdxTable"),i.getLocal("itBase"),i.getLocal("pIdxTable"))]),i.setLocal("itScalar",i.i32_add(i.getLocal("itScalar"),i.getLocal("scalarSize"))),i.setLocal("itBase",i.i32_add(i.getLocal("itBase"),i.i32_const(d))),i.br(0))),i.call(c+"_reduceTable",i.getLocal("pTable"),i.getLocal("chunkSize")),i.call(a+"_copy",i.getLocal("pTable"),i.getLocal("pr")),i.i32_store(i.i32_const(0),i.getLocal("pTable")))}(),function(){const f=e.addFunction(c);f.addParam("pBases","i32"),f.addParam("pScalars","i32"),f.addParam("scalarSize","i32"),f.addParam("n","i32"),f.addParam("pr","i32"),f.addLocal("chunkSize","i32"),f.addLocal("nChunks","i32"),f.addLocal("itScalar","i32"),f.addLocal("endScalar","i32"),f.addLocal("itBase","i32"),f.addLocal("itBit","i32"),f.addLocal("i","i32"),f.addLocal("j","i32"),f.addLocal("nTable","i32"),f.addLocal("pTable","i32"),f.addLocal("idx","i32"),f.addLocal("pIdxTable","i32");const d=f.getCodeBuilder(),t=d.i32_const(e.alloc(b)),i=e.alloc([17,17,17,17,17,17,17,17,17,17,16,16,15,14,13,13,12,11,10,9,8,7,7,6,5,4,3,2,1,1,1,1]);f.addCode(d.call(a+"_zero",d.getLocal("pr")),d.if(d.i32_eqz(d.getLocal("n")),d.ret([])),d.setLocal("chunkSize",d.i32_load8_u(d.i32_clz(d.getLocal("n")),i)),d.setLocal("nChunks",d.i32_add(d.i32_div_u(d.i32_sub(d.i32_shl(d.getLocal("scalarSize"),d.i32_const(3)),d.i32_const(1)),d.getLocal("chunkSize")),d.i32_const(1))),d.setLocal("itBit",d.i32_mul(d.i32_sub(d.getLocal("nChunks"),d.i32_const(1)),d.getLocal("chunkSize"))),d.block(d.loop(d.br_if(1,d.i32_lt_s(d.getLocal("itBit"),d.i32_const(0))),d.if(d.i32_eqz(d.call(a+"_isZero",d.getLocal("pr"))),[...d.setLocal("j",d.i32_const(0)),...d.block(d.loop(d.br_if(1,d.i32_eq(d.getLocal("j"),d.getLocal("chunkSize"))),d.call(a+"_double",d.getLocal("pr"),d.getLocal("pr")),d.setLocal("j",d.i32_add(d.getLocal("j"),d.i32_const(1))),d.br(0)))]),d.call(c+"_chunk",d.getLocal("pBases"),d.getLocal("pScalars"),d.getLocal("scalarSize"),d.getLocal("n"),d.getLocal("itBit"),d.getLocal("chunkSize"),t),d.call(a+"_add",d.getLocal("pr"),t,d.getLocal("pr")),d.setLocal("itBit",d.i32_sub(d.getLocal("itBit"),d.getLocal("chunkSize"))),d.br(0))))}(),e.exportFunction(c),e.exportFunction(c+"_chunk")};var Le=function(e,a,c,f){const d=e.modules[c].n64,b=8*d;return e.modules[a]||(e.modules[a]={n64:3*d},function(){const f=e.addFunction(a+"_isZeroAffine");f.addParam("p1","i32"),f.setReturnType("i32");const d=f.getCodeBuilder();f.addCode(d.i32_and(d.call(c+"_isZero",d.getLocal("p1")),d.call(c+"_isZero",d.i32_add(d.getLocal("p1"),d.i32_const(b)))))}(),function(){const f=e.addFunction(a+"_isZero");f.addParam("p1","i32"),f.setReturnType("i32");const d=f.getCodeBuilder();f.addCode(d.call(c+"_isZero",d.i32_add(d.getLocal("p1"),d.i32_const(2*b))))}(),function(){const f=e.addFunction(a+"_zeroAffine");f.addParam("pr","i32");const d=f.getCodeBuilder();f.addCode(d.call(c+"_zero",d.getLocal("pr"))),f.addCode(d.call(c+"_zero",d.i32_add(d.getLocal("pr"),d.i32_const(b))))}(),function(){const f=e.addFunction(a+"_zero");f.addParam("pr","i32");const d=f.getCodeBuilder();f.addCode(d.call(c+"_zero",d.getLocal("pr"))),f.addCode(d.call(c+"_one",d.i32_add(d.getLocal("pr"),d.i32_const(b)))),f.addCode(d.call(c+"_zero",d.i32_add(d.getLocal("pr"),d.i32_const(2*b))))}(),function(){const c=e.addFunction(a+"_copyAffine");c.addParam("ps","i32"),c.addParam("pd","i32");const f=c.getCodeBuilder();for(let e=0;e<2*d;e++)c.addCode(f.i64_store(f.getLocal("pd"),8*e,f.i64_load(f.getLocal("ps"),8*e)))}(),function(){const c=e.addFunction(a+"_copy");c.addParam("ps","i32"),c.addParam("pd","i32");const f=c.getCodeBuilder();for(let e=0;e<3*d;e++)c.addCode(f.i64_store(f.getLocal("pd"),8*e,f.i64_load(f.getLocal("ps"),8*e)))}(),function(){const f=e.addFunction(a+"_toJacobian");f.addParam("p1","i32"),f.addParam("pr","i32");const d=f.getCodeBuilder(),t=d.getLocal("p1"),i=d.i32_add(d.getLocal("p1"),d.i32_const(b)),r=d.getLocal("pr"),n=d.i32_add(d.getLocal("pr"),d.i32_const(b)),o=d.i32_add(d.getLocal("pr"),d.i32_const(2*b));f.addCode(d.if(d.call(a+"_isZeroAffine",d.getLocal("p1")),d.call(a+"_zero",d.getLocal("pr")),[...d.call(c+"_one",o),...d.call(c+"_copy",i,n),...d.call(c+"_copy",t,r)]))}(),function(){const f=e.addFunction(a+"_eqAffine");f.addParam("p1","i32"),f.addParam("p2","i32"),f.setReturnType("i32"),f.addLocal("z1","i32");const d=f.getCodeBuilder();f.addCode(d.ret(d.i32_and(d.call(c+"_eq",d.getLocal("p1"),d.getLocal("p2")),d.call(c+"_eq",d.i32_add(d.getLocal("p1"),d.i32_const(b)),d.i32_add(d.getLocal("p2"),d.i32_const(b))))))}(),function(){const f=e.addFunction(a+"_eqMixed");f.addParam("p1","i32"),f.addParam("p2","i32"),f.setReturnType("i32"),f.addLocal("z1","i32");const d=f.getCodeBuilder(),t=d.getLocal("p1"),i=d.i32_add(d.getLocal("p1"),d.i32_const(b));f.addCode(d.setLocal("z1",d.i32_add(d.getLocal("p1"),d.i32_const(2*b))));const r=d.getLocal("z1"),n=d.getLocal("p2"),o=d.i32_add(d.getLocal("p2"),d.i32_const(b)),s=d.i32_const(e.alloc(b)),l=d.i32_const(e.alloc(b)),h=d.i32_const(e.alloc(b)),u=d.i32_const(e.alloc(b));f.addCode(d.if(d.call(a+"_isZero",d.getLocal("p1")),d.ret(d.call(a+"_isZeroAffine",d.getLocal("p2")))),d.if(d.call(a+"_isZeroAffine",d.getLocal("p2")),d.ret(d.i32_const(0))),d.if(d.call(c+"_isOne",r),d.ret(d.call(a+"_eqAffine",d.getLocal("p1"),d.getLocal("p2")))),d.call(c+"_square",r,s),d.call(c+"_mul",n,s,l),d.call(c+"_mul",r,s,h),d.call(c+"_mul",o,h,u),d.if(d.call(c+"_eq",t,l),d.if(d.call(c+"_eq",i,u),d.ret(d.i32_const(1)))),d.ret(d.i32_const(0)))}(),function(){const f=e.addFunction(a+"_eq");f.addParam("p1","i32"),f.addParam("p2","i32"),f.setReturnType("i32"),f.addLocal("z1","i32"),f.addLocal("z2","i32");const d=f.getCodeBuilder(),t=d.getLocal("p1"),i=d.i32_add(d.getLocal("p1"),d.i32_const(b));f.addCode(d.setLocal("z1",d.i32_add(d.getLocal("p1"),d.i32_const(2*b))));const r=d.getLocal("z1"),n=d.getLocal("p2"),o=d.i32_add(d.getLocal("p2"),d.i32_const(b));f.addCode(d.setLocal("z2",d.i32_add(d.getLocal("p2"),d.i32_const(2*b))));const s=d.getLocal("z2"),l=d.i32_const(e.alloc(b)),h=d.i32_const(e.alloc(b)),u=d.i32_const(e.alloc(b)),x=d.i32_const(e.alloc(b)),p=d.i32_const(e.alloc(b)),g=d.i32_const(e.alloc(b)),m=d.i32_const(e.alloc(b)),y=d.i32_const(e.alloc(b));f.addCode(d.if(d.call(a+"_isZero",d.getLocal("p1")),d.ret(d.call(a+"_isZero",d.getLocal("p2")))),d.if(d.call(a+"_isZero",d.getLocal("p2")),d.ret(d.i32_const(0))),d.if(d.call(c+"_isOne",r),d.ret(d.call(a+"_eqMixed",d.getLocal("p2"),d.getLocal("p1")))),d.if(d.call(c+"_isOne",s),d.ret(d.call(a+"_eqMixed",d.getLocal("p1"),d.getLocal("p2")))),d.call(c+"_square",r,l),d.call(c+"_square",s,h),d.call(c+"_mul",t,h,u),d.call(c+"_mul",n,l,x),d.call(c+"_mul",r,l,p),d.call(c+"_mul",s,h,g),d.call(c+"_mul",i,g,m),d.call(c+"_mul",o,p,y),d.if(d.call(c+"_eq",u,x),d.if(d.call(c+"_eq",m,y),d.ret(d.i32_const(1)))),d.ret(d.i32_const(0)))}(),function(){const f=e.addFunction(a+"_doubleAffine");f.addParam("p1","i32"),f.addParam("pr","i32");const d=f.getCodeBuilder(),t=d.getLocal("p1"),i=d.i32_add(d.getLocal("p1"),d.i32_const(b)),r=d.getLocal("pr"),n=d.i32_add(d.getLocal("pr"),d.i32_const(b)),o=d.i32_add(d.getLocal("pr"),d.i32_const(2*b)),s=d.i32_const(e.alloc(b)),l=d.i32_const(e.alloc(b)),h=d.i32_const(e.alloc(b)),u=d.i32_const(e.alloc(b)),x=d.i32_const(e.alloc(b)),p=d.i32_const(e.alloc(b));f.addCode(d.if(d.call(a+"_isZeroAffine",d.getLocal("p1")),[...d.call(a+"_toJacobian",d.getLocal("p1"),d.getLocal("pr")),...d.ret([])]),d.call(c+"_square",t,s),d.call(c+"_square",i,l),d.call(c+"_square",l,h),d.call(c+"_add",t,l,u),d.call(c+"_square",u,u),d.call(c+"_sub",u,s,u),d.call(c+"_sub",u,h,u),d.call(c+"_add",u,u,u),d.call(c+"_add",s,s,x),d.call(c+"_add",x,s,x),d.call(c+"_add",i,i,o),d.call(c+"_square",x,r),d.call(c+"_sub",r,u,r),d.call(c+"_sub",r,u,r),d.call(c+"_add",h,h,p),d.call(c+"_add",p,p,p),d.call(c+"_add",p,p,p),d.call(c+"_sub",u,r,n),d.call(c+"_mul",n,x,n),d.call(c+"_sub",n,p,n))}(),function(){const f=e.addFunction(a+"_double");f.addParam("p1","i32"),f.addParam("pr","i32");const d=f.getCodeBuilder(),t=d.getLocal("p1"),i=d.i32_add(d.getLocal("p1"),d.i32_const(b)),r=d.i32_add(d.getLocal("p1"),d.i32_const(2*b)),n=d.getLocal("pr"),o=d.i32_add(d.getLocal("pr"),d.i32_const(b)),s=d.i32_add(d.getLocal("pr"),d.i32_const(2*b)),l=d.i32_const(e.alloc(b)),h=d.i32_const(e.alloc(b)),u=d.i32_const(e.alloc(b)),x=d.i32_const(e.alloc(b)),p=d.i32_const(e.alloc(b)),g=d.i32_const(e.alloc(b)),m=d.i32_const(e.alloc(b)),y=d.i32_const(e.alloc(b));f.addCode(d.if(d.call(a+"_isZero",d.getLocal("p1")),[...d.call(a+"_copy",d.getLocal("p1"),d.getLocal("pr")),...d.ret([])]),d.if(d.call(c+"_isOne",r),[...d.ret(d.call(a+"_doubleAffine",d.getLocal("p1"),d.getLocal("pr"))),...d.ret([])]),d.call(c+"_square",t,l),d.call(c+"_square",i,h),d.call(c+"_square",h,u),d.call(c+"_add",t,h,x),d.call(c+"_square",x,x),d.call(c+"_sub",x,l,x),d.call(c+"_sub",x,u,x),d.call(c+"_add",x,x,x),d.call(c+"_add",l,l,p),d.call(c+"_add",p,l,p),d.call(c+"_square",p,g),d.call(c+"_mul",i,r,m),d.call(c+"_add",x,x,n),d.call(c+"_sub",g,n,n),d.call(c+"_add",u,u,y),d.call(c+"_add",y,y,y),d.call(c+"_add",y,y,y),d.call(c+"_sub",x,n,o),d.call(c+"_mul",o,p,o),d.call(c+"_sub",o,y,o),d.call(c+"_add",m,m,s))}(),function(){const f=e.addFunction(a+"_addAffine");f.addParam("p1","i32"),f.addParam("p2","i32"),f.addParam("pr","i32"),f.addLocal("z1","i32");const d=f.getCodeBuilder(),t=d.getLocal("p1"),i=d.i32_add(d.getLocal("p1"),d.i32_const(b));f.addCode(d.setLocal("z1",d.i32_add(d.getLocal("p1"),d.i32_const(2*b))));const r=d.getLocal("p2"),n=d.i32_add(d.getLocal("p2"),d.i32_const(b)),o=d.getLocal("pr"),s=d.i32_add(d.getLocal("pr"),d.i32_const(b)),l=d.i32_add(d.getLocal("pr"),d.i32_const(2*b)),h=d.i32_const(e.alloc(b)),u=d.i32_const(e.alloc(b)),x=d.i32_const(e.alloc(b)),p=d.i32_const(e.alloc(b)),g=d.i32_const(e.alloc(b)),m=d.i32_const(e.alloc(b)),y=d.i32_const(e.alloc(b)),_=d.i32_const(e.alloc(b)),v=d.i32_const(e.alloc(b)),w=d.i32_const(e.alloc(b));f.addCode(d.if(d.call(a+"_isZeroAffine",d.getLocal("p1")),[...d.call(a+"_copyAffine",d.getLocal("p2"),d.getLocal("pr")),...d.call(c+"_one",d.i32_add(d.getLocal("pr"),d.i32_const(2*b))),...d.ret([])]),d.if(d.call(a+"_isZeroAffine",d.getLocal("p2")),[...d.call(a+"_copyAffine",d.getLocal("p1"),d.getLocal("pr")),...d.call(c+"_one",d.i32_add(d.getLocal("pr"),d.i32_const(2*b))),...d.ret([])]),d.if(d.call(c+"_eq",t,r),d.if(d.call(c+"_eq",i,n),[...d.call(a+"_doubleAffine",d.getLocal("p2"),d.getLocal("pr")),...d.ret([])])),d.call(c+"_sub",r,t,h),d.call(c+"_sub",n,i,x),d.call(c+"_square",h,u),d.call(c+"_add",u,u,p),d.call(c+"_add",p,p,p),d.call(c+"_mul",h,p,g),d.call(c+"_add",x,x,m),d.call(c+"_mul",t,p,_),d.call(c+"_square",m,y),d.call(c+"_add",_,_,v),d.call(c+"_sub",y,g,o),d.call(c+"_sub",o,v,o),d.call(c+"_mul",i,g,w),d.call(c+"_add",w,w,w),d.call(c+"_sub",_,o,s),d.call(c+"_mul",s,m,s),d.call(c+"_sub",s,w,s),d.call(c+"_add",h,h,l))}(),function(){const f=e.addFunction(a+"_addMixed");f.addParam("p1","i32"),f.addParam("p2","i32"),f.addParam("pr","i32"),f.addLocal("z1","i32");const d=f.getCodeBuilder(),t=d.getLocal("p1"),i=d.i32_add(d.getLocal("p1"),d.i32_const(b));f.addCode(d.setLocal("z1",d.i32_add(d.getLocal("p1"),d.i32_const(2*b))));const r=d.getLocal("z1"),n=d.getLocal("p2"),o=d.i32_add(d.getLocal("p2"),d.i32_const(b)),s=d.getLocal("pr"),l=d.i32_add(d.getLocal("pr"),d.i32_const(b)),h=d.i32_add(d.getLocal("pr"),d.i32_const(2*b)),u=d.i32_const(e.alloc(b)),x=d.i32_const(e.alloc(b)),p=d.i32_const(e.alloc(b)),g=d.i32_const(e.alloc(b)),m=d.i32_const(e.alloc(b)),y=d.i32_const(e.alloc(b)),_=d.i32_const(e.alloc(b)),v=d.i32_const(e.alloc(b)),w=d.i32_const(e.alloc(b)),M=d.i32_const(e.alloc(b)),A=d.i32_const(e.alloc(b)),L=d.i32_const(e.alloc(b)),I=d.i32_const(e.alloc(b)),k=d.i32_const(e.alloc(b));f.addCode(d.if(d.call(a+"_isZero",d.getLocal("p1")),[...d.call(a+"_copyAffine",d.getLocal("p2"),d.getLocal("pr")),...d.call(c+"_one",d.i32_add(d.getLocal("pr"),d.i32_const(2*b))),...d.ret([])]),d.if(d.call(a+"_isZeroAffine",d.getLocal("p2")),[...d.call(a+"_copy",d.getLocal("p1"),d.getLocal("pr")),...d.ret([])]),d.if(d.call(c+"_isOne",r),[...d.call(a+"_addAffine",t,n,s),...d.ret([])]),d.call(c+"_square",r,u),d.call(c+"_mul",n,u,x),d.call(c+"_mul",r,u,p),d.call(c+"_mul",o,p,g),d.if(d.call(c+"_eq",t,x),d.if(d.call(c+"_eq",i,g),[...d.call(a+"_doubleAffine",d.getLocal("p2"),d.getLocal("pr")),...d.ret([])])),d.call(c+"_sub",x,t,m),d.call(c+"_sub",g,i,_),d.call(c+"_square",m,y),d.call(c+"_add",y,y,v),d.call(c+"_add",v,v,v),d.call(c+"_mul",m,v,w),d.call(c+"_add",_,_,M),d.call(c+"_mul",t,v,L),d.call(c+"_square",M,A),d.call(c+"_add",L,L,I),d.call(c+"_sub",A,w,s),d.call(c+"_sub",s,I,s),d.call(c+"_mul",i,w,k),d.call(c+"_add",k,k,k),d.call(c+"_sub",L,s,l),d.call(c+"_mul",l,M,l),d.call(c+"_sub",l,k,l),d.call(c+"_add",r,m,h),d.call(c+"_square",h,h),d.call(c+"_sub",h,u,h),d.call(c+"_sub",h,y,h))}(),function(){const f=e.addFunction(a+"_add");f.addParam("p1","i32"),f.addParam("p2","i32"),f.addParam("pr","i32"),f.addLocal("z1","i32"),f.addLocal("z2","i32");const d=f.getCodeBuilder(),t=d.getLocal("p1"),i=d.i32_add(d.getLocal("p1"),d.i32_const(b));f.addCode(d.setLocal("z1",d.i32_add(d.getLocal("p1"),d.i32_const(2*b))));const r=d.getLocal("z1"),n=d.getLocal("p2"),o=d.i32_add(d.getLocal("p2"),d.i32_const(b));f.addCode(d.setLocal("z2",d.i32_add(d.getLocal("p2"),d.i32_const(2*b))));const s=d.getLocal("z2"),l=d.getLocal("pr"),h=d.i32_add(d.getLocal("pr"),d.i32_const(b)),u=d.i32_add(d.getLocal("pr"),d.i32_const(2*b)),x=d.i32_const(e.alloc(b)),p=d.i32_const(e.alloc(b)),g=d.i32_const(e.alloc(b)),m=d.i32_const(e.alloc(b)),y=d.i32_const(e.alloc(b)),_=d.i32_const(e.alloc(b)),v=d.i32_const(e.alloc(b)),w=d.i32_const(e.alloc(b)),M=d.i32_const(e.alloc(b)),A=d.i32_const(e.alloc(b)),L=d.i32_const(e.alloc(b)),I=d.i32_const(e.alloc(b)),k=d.i32_const(e.alloc(b)),E=d.i32_const(e.alloc(b)),S=d.i32_const(e.alloc(b)),C=d.i32_const(e.alloc(b)),B=d.i32_const(e.alloc(b));f.addCode(d.if(d.call(a+"_isZero",d.getLocal("p1")),[...d.call(a+"_copy",d.getLocal("p2"),d.getLocal("pr")),...d.ret([])]),d.if(d.call(a+"_isZero",d.getLocal("p2")),[...d.call(a+"_copy",d.getLocal("p1"),d.getLocal("pr")),...d.ret([])]),d.if(d.call(c+"_isOne",r),[...d.call(a+"_addMixed",n,t,l),...d.ret([])]),d.if(d.call(c+"_isOne",s),[...d.call(a+"_addMixed",t,n,l),...d.ret([])]),d.call(c+"_square",r,x),d.call(c+"_square",s,p),d.call(c+"_mul",t,p,g),d.call(c+"_mul",n,x,m),d.call(c+"_mul",r,x,y),d.call(c+"_mul",s,p,_),d.call(c+"_mul",i,_,v),d.call(c+"_mul",o,y,w),d.if(d.call(c+"_eq",g,m),d.if(d.call(c+"_eq",v,w),[...d.call(a+"_double",d.getLocal("p1"),d.getLocal("pr")),...d.ret([])])),d.call(c+"_sub",m,g,M),d.call(c+"_sub",w,v,A),d.call(c+"_add",M,M,L),d.call(c+"_square",L,L),d.call(c+"_mul",M,L,I),d.call(c+"_add",A,A,k),d.call(c+"_mul",g,L,S),d.call(c+"_square",k,E),d.call(c+"_add",S,S,C),d.call(c+"_sub",E,I,l),d.call(c+"_sub",l,C,l),d.call(c+"_mul",v,I,B),d.call(c+"_add",B,B,B),d.call(c+"_sub",S,l,h),d.call(c+"_mul",h,k,h),d.call(c+"_sub",h,B,h),d.call(c+"_add",r,s,u),d.call(c+"_square",u,u),d.call(c+"_sub",u,x,u),d.call(c+"_sub",u,p,u),d.call(c+"_mul",u,M,u))}(),function(){const f=e.addFunction(a+"_negAffine");f.addParam("p1","i32"),f.addParam("pr","i32");const d=f.getCodeBuilder(),t=d.getLocal("p1"),i=d.i32_add(d.getLocal("p1"),d.i32_const(b)),r=d.getLocal("pr"),n=d.i32_add(d.getLocal("pr"),d.i32_const(b));f.addCode(d.call(c+"_copy",t,r),d.call(c+"_neg",i,n))}(),function(){const f=e.addFunction(a+"_neg");f.addParam("p1","i32"),f.addParam("pr","i32");const d=f.getCodeBuilder(),t=d.getLocal("p1"),i=d.i32_add(d.getLocal("p1"),d.i32_const(b)),r=d.i32_add(d.getLocal("p1"),d.i32_const(2*b)),n=d.getLocal("pr"),o=d.i32_add(d.getLocal("pr"),d.i32_const(b)),s=d.i32_add(d.getLocal("pr"),d.i32_const(2*b));f.addCode(d.call(c+"_copy",t,n),d.call(c+"_neg",i,o),d.call(c+"_copy",r,s))}(),function(){const c=e.addFunction(a+"_subAffine");c.addParam("p1","i32"),c.addParam("p2","i32"),c.addParam("pr","i32");const f=c.getCodeBuilder(),d=f.i32_const(e.alloc(3*b));c.addCode(f.call(a+"_negAffine",f.getLocal("p2"),d),f.call(a+"_addAffine",f.getLocal("p1"),d,f.getLocal("pr")))}(),function(){const c=e.addFunction(a+"_subMixed");c.addParam("p1","i32"),c.addParam("p2","i32"),c.addParam("pr","i32");const f=c.getCodeBuilder(),d=f.i32_const(e.alloc(3*b));c.addCode(f.call(a+"_negAffine",f.getLocal("p2"),d),f.call(a+"_addMixed",f.getLocal("p1"),d,f.getLocal("pr")))}(),function(){const c=e.addFunction(a+"_sub");c.addParam("p1","i32"),c.addParam("p2","i32"),c.addParam("pr","i32");const f=c.getCodeBuilder(),d=f.i32_const(e.alloc(3*b));c.addCode(f.call(a+"_neg",f.getLocal("p2"),d),f.call(a+"_add",f.getLocal("p1"),d,f.getLocal("pr")))}(),function(){const f=e.addFunction(a+"_fromMontgomeryAffine");f.addParam("p1","i32"),f.addParam("pr","i32");const d=f.getCodeBuilder();f.addCode(d.call(c+"_fromMontgomery",d.getLocal("p1"),d.getLocal("pr")));for(let e=1;e<2;e++)f.addCode(d.call(c+"_fromMontgomery",d.i32_add(d.getLocal("p1"),d.i32_const(e*b)),d.i32_add(d.getLocal("pr"),d.i32_const(e*b))))}(),function(){const f=e.addFunction(a+"_fromMontgomery");f.addParam("p1","i32"),f.addParam("pr","i32");const d=f.getCodeBuilder();f.addCode(d.call(c+"_fromMontgomery",d.getLocal("p1"),d.getLocal("pr")));for(let e=1;e<3;e++)f.addCode(d.call(c+"_fromMontgomery",d.i32_add(d.getLocal("p1"),d.i32_const(e*b)),d.i32_add(d.getLocal("pr"),d.i32_const(e*b))))}(),function(){const f=e.addFunction(a+"_toMontgomeryAffine");f.addParam("p1","i32"),f.addParam("pr","i32");const d=f.getCodeBuilder();f.addCode(d.call(c+"_toMontgomery",d.getLocal("p1"),d.getLocal("pr")));for(let e=1;e<2;e++)f.addCode(d.call(c+"_toMontgomery",d.i32_add(d.getLocal("p1"),d.i32_const(e*b)),d.i32_add(d.getLocal("pr"),d.i32_const(e*b))))}(),function(){const f=e.addFunction(a+"_toMontgomery");f.addParam("p1","i32"),f.addParam("pr","i32");const d=f.getCodeBuilder();f.addCode(d.call(c+"_toMontgomery",d.getLocal("p1"),d.getLocal("pr")));for(let e=1;e<3;e++)f.addCode(d.call(c+"_toMontgomery",d.i32_add(d.getLocal("p1"),d.i32_const(e*b)),d.i32_add(d.getLocal("pr"),d.i32_const(e*b))))}(),function(){const f=e.addFunction(a+"_toAffine");f.addParam("p1","i32"),f.addParam("pr","i32");const d=f.getCodeBuilder(),t=d.getLocal("p1"),i=d.i32_add(d.getLocal("p1"),d.i32_const(b)),r=d.i32_add(d.getLocal("p1"),d.i32_const(2*b)),n=d.getLocal("pr"),o=d.i32_add(d.getLocal("pr"),d.i32_const(b)),s=d.i32_const(e.alloc(b)),l=d.i32_const(e.alloc(b)),h=d.i32_const(e.alloc(b));f.addCode(d.if(d.call(a+"_isZero",d.getLocal("p1")),[...d.call(c+"_zero",n),...d.call(c+"_zero",o)],[...d.call(c+"_inverse",r,s),...d.call(c+"_square",s,l),...d.call(c+"_mul",s,l,h),...d.call(c+"_mul",t,l,n),...d.call(c+"_mul",i,h,o)]))}(),function(){const d=e.addFunction(a+"_inCurveAffine");d.addParam("pIn","i32"),d.setReturnType("i32");const t=d.getCodeBuilder(),i=t.getLocal("pIn"),r=t.i32_add(t.getLocal("pIn"),t.i32_const(b)),n=t.i32_const(e.alloc(b)),o=t.i32_const(e.alloc(b));d.addCode(t.call(c+"_square",r,n),t.call(c+"_square",i,o),t.call(c+"_mul",i,o,o),t.call(c+"_add",o,t.i32_const(f),o),t.ret(t.call(c+"_eq",n,o)))}(),function(){const c=e.addFunction(a+"_inCurve");c.addParam("pIn","i32"),c.setReturnType("i32");const f=c.getCodeBuilder(),d=f.i32_const(e.alloc(2*b));c.addCode(f.call(a+"_toAffine",f.getLocal("pIn"),d),f.ret(f.call(a+"_inCurveAffine",d)))}(),function(){const f=e.addFunction(a+"_batchToAffine");f.addParam("pIn","i32"),f.addParam("n","i32"),f.addParam("pOut","i32"),f.addLocal("pAux","i32"),f.addLocal("itIn","i32"),f.addLocal("itAux","i32"),f.addLocal("itOut","i32"),f.addLocal("i","i32");const d=f.getCodeBuilder(),t=d.i32_const(e.alloc(b));f.addCode(d.setLocal("pAux",d.i32_load(d.i32_const(0))),d.i32_store(d.i32_const(0),d.i32_add(d.getLocal("pAux"),d.i32_mul(d.getLocal("n"),d.i32_const(b)))),d.call(c+"_batchInverse",d.i32_add(d.getLocal("pIn"),d.i32_const(2*b)),d.i32_const(3*b),d.getLocal("n"),d.getLocal("pAux"),d.i32_const(b)),d.setLocal("itIn",d.getLocal("pIn")),d.setLocal("itAux",d.getLocal("pAux")),d.setLocal("itOut",d.getLocal("pOut")),d.setLocal("i",d.i32_const(0)),d.block(d.loop(d.br_if(1,d.i32_eq(d.getLocal("i"),d.getLocal("n"))),d.if(d.call(c+"_isZero",d.getLocal("itAux")),[...d.call(c+"_zero",d.getLocal("itOut")),...d.call(c+"_zero",d.i32_add(d.getLocal("itOut"),d.i32_const(b)))],[...d.call(c+"_mul",d.getLocal("itAux"),d.i32_add(d.getLocal("itIn"),d.i32_const(b)),t),...d.call(c+"_square",d.getLocal("itAux"),d.getLocal("itAux")),...d.call(c+"_mul",d.getLocal("itAux"),d.getLocal("itIn"),d.getLocal("itOut")),...d.call(c+"_mul",d.getLocal("itAux"),t,d.i32_add(d.getLocal("itOut"),d.i32_const(b)))]),d.setLocal("itIn",d.i32_add(d.getLocal("itIn"),d.i32_const(3*b))),d.setLocal("itOut",d.i32_add(d.getLocal("itOut"),d.i32_const(2*b))),d.setLocal("itAux",d.i32_add(d.getLocal("itAux"),d.i32_const(b))),d.setLocal("i",d.i32_add(d.getLocal("i"),d.i32_const(1))),d.br(0))),d.i32_store(d.i32_const(0),d.getLocal("pAux")))}(),function(){const f=e.addFunction(a+"_normalize");f.addParam("p1","i32"),f.addParam("pr","i32");const d=f.getCodeBuilder(),t=d.getLocal("p1"),i=d.i32_add(d.getLocal("p1"),d.i32_const(b)),r=d.i32_add(d.getLocal("p1"),d.i32_const(2*b)),n=d.getLocal("pr"),o=d.i32_add(d.getLocal("pr"),d.i32_const(b)),s=d.i32_add(d.getLocal("pr"),d.i32_const(2*b)),l=d.i32_const(e.alloc(b)),h=d.i32_const(e.alloc(b)),u=d.i32_const(e.alloc(b));f.addCode(d.if(d.call(a+"_isZero",d.getLocal("p1")),d.call(a+"_zero",d.getLocal("pr")),[...d.call(c+"_inverse",r,l),...d.call(c+"_square",l,h),...d.call(c+"_mul",l,h,u),...d.call(c+"_mul",t,h,n),...d.call(c+"_mul",i,u,o),...d.call(c+"_one",s)]))}(),function(){const c=e.addFunction(a+"__reverseBytes");c.addParam("pIn","i32"),c.addParam("n","i32"),c.addParam("pOut","i32"),c.addLocal("itOut","i32"),c.addLocal("itIn","i32");const f=c.getCodeBuilder();c.addCode(f.setLocal("itOut",f.i32_sub(f.i32_add(f.getLocal("pOut"),f.getLocal("n")),f.i32_const(1))),f.setLocal("itIn",f.getLocal("pIn")),f.block(f.loop(f.br_if(1,f.i32_lt_s(f.getLocal("itOut"),f.getLocal("pOut"))),f.i32_store8(f.getLocal("itOut"),f.i32_load8_u(f.getLocal("itIn"))),f.setLocal("itOut",f.i32_sub(f.getLocal("itOut"),f.i32_const(1))),f.setLocal("itIn",f.i32_add(f.getLocal("itIn"),f.i32_const(1))),f.br(0))))}(),function(){const c=e.addFunction(a+"_LEMtoU");c.addParam("pIn","i32"),c.addParam("pOut","i32");const f=c.getCodeBuilder(),d=e.alloc(2*b),t=f.i32_const(d),i=f.i32_const(d),r=f.i32_const(d+b);c.addCode(f.if(f.call(a+"_isZeroAffine",f.getLocal("pIn")),[...f.call(a+"_zeroAffine",f.getLocal("pOut")),...f.ret([])]),f.call(a+"_fromMontgomeryAffine",f.getLocal("pIn"),t),f.call(a+"__reverseBytes",i,f.i32_const(b),f.getLocal("pOut")),f.call(a+"__reverseBytes",r,f.i32_const(b),f.i32_add(f.getLocal("pOut"),f.i32_const(b))))}(),function(){const f=e.addFunction(a+"_LEMtoC");f.addParam("pIn","i32"),f.addParam("pOut","i32");const d=f.getCodeBuilder(),t=d.i32_const(e.alloc(b));f.addCode(d.if(d.call(a+"_isZeroAffine",d.getLocal("pIn")),[...d.call(c+"_zero",d.getLocal("pOut")),...d.i32_store8(d.getLocal("pOut"),d.i32_const(64)),...d.ret([])]),d.call(c+"_fromMontgomery",d.getLocal("pIn"),t),d.call(a+"__reverseBytes",t,d.i32_const(b),d.getLocal("pOut")),d.if(d.i32_eq(d.call(c+"_sign",d.i32_add(d.getLocal("pIn"),d.i32_const(b))),d.i32_const(-1)),d.i32_store8(d.getLocal("pOut"),d.i32_or(d.i32_load8_u(d.getLocal("pOut")),d.i32_const(128)))))}(),function(){const c=e.addFunction(a+"_UtoLEM");c.addParam("pIn","i32"),c.addParam("pOut","i32");const f=c.getCodeBuilder(),d=e.alloc(2*b),t=f.i32_const(d),i=f.i32_const(d),r=f.i32_const(d+b);c.addCode(f.if(f.i32_and(f.i32_load8_u(f.getLocal("pIn")),f.i32_const(64)),[...f.call(a+"_zeroAffine",f.getLocal("pOut")),...f.ret([])]),f.call(a+"__reverseBytes",f.getLocal("pIn"),f.i32_const(b),i),f.call(a+"__reverseBytes",f.i32_add(f.getLocal("pIn"),f.i32_const(b)),f.i32_const(b),r),f.call(a+"_toMontgomeryAffine",t,f.getLocal("pOut")))}(),function(){const d=e.addFunction(a+"_CtoLEM");d.addParam("pIn","i32"),d.addParam("pOut","i32"),d.addLocal("firstByte","i32"),d.addLocal("greatest","i32");const t=d.getCodeBuilder(),i=e.alloc(2*b),r=t.i32_const(i),n=t.i32_const(i+b);d.addCode(t.setLocal("firstByte",t.i32_load8_u(t.getLocal("pIn"))),t.if(t.i32_and(t.getLocal("firstByte"),t.i32_const(64)),[...t.call(a+"_zeroAffine",t.getLocal("pOut")),...t.ret([])]),t.setLocal("greatest",t.i32_and(t.getLocal("firstByte"),t.i32_const(128))),t.call(c+"_copy",t.getLocal("pIn"),n),t.i32_store8(n,t.i32_and(t.getLocal("firstByte"),t.i32_const(63))),t.call(a+"__reverseBytes",n,t.i32_const(b),r),t.call(c+"_toMontgomery",r,t.getLocal("pOut")),t.call(c+"_square",t.getLocal("pOut"),n),t.call(c+"_mul",t.getLocal("pOut"),n,n),t.call(c+"_add",n,t.i32_const(f),n),t.call(c+"_sqrt",n,n),t.call(c+"_neg",n,r),t.if(t.i32_eq(t.call(c+"_sign",n),t.i32_const(-1)),t.if(t.getLocal("greatest"),t.call(c+"_copy",n,t.i32_add(t.getLocal("pOut"),t.i32_const(b))),t.call(c+"_neg",n,t.i32_add(t.getLocal("pOut"),t.i32_const(b)))),t.if(t.getLocal("greatest"),t.call(c+"_neg",n,t.i32_add(t.getLocal("pOut"),t.i32_const(b))),t.call(c+"_copy",n,t.i32_add(t.getLocal("pOut"),t.i32_const(b))))))}(),Me(e,a+"_batchLEMtoU",a+"_LEMtoU",2*b,2*b),Me(e,a+"_batchLEMtoC",a+"_LEMtoC",2*b,b),Me(e,a+"_batchUtoLEM",a+"_UtoLEM",2*b,2*b),Me(e,a+"_batchCtoLEM",a+"_CtoLEM",b,2*b,!0),Me(e,a+"_batchToJacobian",a+"_toJacobian",2*b,3*b,!0),Ae(e,a,a+"_multiexp",a+"_add",3*b),Ae(e,a,a+"_multiexpAffine",a+"_addMixed",2*b),we(e,a+"_timesScalar",3*b,a+"_add",a+"_double",a+"_sub",a+"_copy",a+"_zero"),we(e,a+"_timesScalarAffine",2*b,a+"_addMixed",a+"_double",a+"_subMixed",a+"_copyAffine",a+"_zero"),e.exportFunction(a+"_isZero"),e.exportFunction(a+"_isZeroAffine"),e.exportFunction(a+"_eq"),e.exportFunction(a+"_eqMixed"),e.exportFunction(a+"_eqAffine"),e.exportFunction(a+"_copy"),e.exportFunction(a+"_copyAffine"),e.exportFunction(a+"_zero"),e.exportFunction(a+"_zeroAffine"),e.exportFunction(a+"_double"),e.exportFunction(a+"_doubleAffine"),e.exportFunction(a+"_add"),e.exportFunction(a+"_addMixed"),e.exportFunction(a+"_addAffine"),e.exportFunction(a+"_neg"),e.exportFunction(a+"_negAffine"),e.exportFunction(a+"_sub"),e.exportFunction(a+"_subMixed"),e.exportFunction(a+"_subAffine"),e.exportFunction(a+"_fromMontgomery"),e.exportFunction(a+"_fromMontgomeryAffine"),e.exportFunction(a+"_toMontgomery"),e.exportFunction(a+"_toMontgomeryAffine"),e.exportFunction(a+"_timesScalar"),e.exportFunction(a+"_timesScalarAffine"),e.exportFunction(a+"_normalize"),e.exportFunction(a+"_LEMtoU"),e.exportFunction(a+"_LEMtoC"),e.exportFunction(a+"_UtoLEM"),e.exportFunction(a+"_CtoLEM"),e.exportFunction(a+"_batchLEMtoU"),e.exportFunction(a+"_batchLEMtoC"),e.exportFunction(a+"_batchUtoLEM"),e.exportFunction(a+"_batchCtoLEM"),e.exportFunction(a+"_toAffine"),e.exportFunction(a+"_toJacobian"),e.exportFunction(a+"_batchToAffine"),e.exportFunction(a+"_batchToJacobian"),e.exportFunction(a+"_inCurve"),e.exportFunction(a+"_inCurveAffine")),a};const{isOdd:Ie,modInv:ke,modPow:Ee}=q,Se=T;var Ce=function(e,a,c,f,d){const b=8*e.modules[f].n64,t=8*e.modules[c].n64,i=e.modules[f].q;let r=i-1n,n=0;for(;!Ie(r);)n++,r>>=1n;let o=2n;for(;1n===Ee(o,i>>1n,i);)o+=1n;const s=new Array(n+1);s[n]=Ee(o,r,i);let l=n-1;for(;l>=0;)s[l]=Ee(s[l+1],2n,i),l--;const h=[],u=(1n<>c);return a}const L=Array(256);for(let e=0;e<256;e++)L[e]=A(e);const I=e.alloc(L);!function(){const c=e.addFunction(a+"__rev");c.addParam("x","i32"),c.addParam("bits","i32"),c.setReturnType("i32");const f=c.getCodeBuilder();c.addCode(f.i32_rotl(f.i32_add(f.i32_add(f.i32_shl(f.i32_load8_u(f.i32_and(f.getLocal("x"),f.i32_const(255)),I,0),f.i32_const(24)),f.i32_shl(f.i32_load8_u(f.i32_and(f.i32_shr_u(f.getLocal("x"),f.i32_const(8)),f.i32_const(255)),I,0),f.i32_const(16))),f.i32_add(f.i32_shl(f.i32_load8_u(f.i32_and(f.i32_shr_u(f.getLocal("x"),f.i32_const(16)),f.i32_const(255)),I,0),f.i32_const(8)),f.i32_load8_u(f.i32_and(f.i32_shr_u(f.getLocal("x"),f.i32_const(24)),f.i32_const(255)),I,0))),f.getLocal("bits")))}(),function(){const f=e.addFunction(a+"__reversePermutation");f.addParam("px","i32"),f.addParam("bits","i32"),f.addLocal("n","i32"),f.addLocal("i","i32"),f.addLocal("ri","i32"),f.addLocal("idx1","i32"),f.addLocal("idx2","i32");const d=f.getCodeBuilder(),b=d.i32_const(e.alloc(t));f.addCode(d.setLocal("n",d.i32_shl(d.i32_const(1),d.getLocal("bits"))),d.setLocal("i",d.i32_const(0)),d.block(d.loop(d.br_if(1,d.i32_eq(d.getLocal("i"),d.getLocal("n"))),d.setLocal("idx1",d.i32_add(d.getLocal("px"),d.i32_mul(d.getLocal("i"),d.i32_const(t)))),d.setLocal("ri",d.call(a+"__rev",d.getLocal("i"),d.getLocal("bits"))),d.setLocal("idx2",d.i32_add(d.getLocal("px"),d.i32_mul(d.getLocal("ri"),d.i32_const(t)))),d.if(d.i32_lt_u(d.getLocal("i"),d.getLocal("ri")),[...d.call(c+"_copy",d.getLocal("idx1"),b),...d.call(c+"_copy",d.getLocal("idx2"),d.getLocal("idx1")),...d.call(c+"_copy",b,d.getLocal("idx2"))]),d.setLocal("i",d.i32_add(d.getLocal("i"),d.i32_const(1))),d.br(0))))}(),function(){const b=e.addFunction(a+"__fftFinal");b.addParam("px","i32"),b.addParam("bits","i32"),b.addParam("reverse","i32"),b.addParam("mulFactor","i32"),b.addLocal("n","i32"),b.addLocal("ndiv2","i32"),b.addLocal("pInv2","i32"),b.addLocal("i","i32"),b.addLocal("mask","i32"),b.addLocal("idx1","i32"),b.addLocal("idx2","i32");const i=b.getCodeBuilder(),r=i.i32_const(e.alloc(t));b.addCode(i.if(i.i32_and(i.i32_eqz(i.getLocal("reverse")),i.call(f+"_isOne",i.getLocal("mulFactor"))),i.ret([])),i.setLocal("n",i.i32_shl(i.i32_const(1),i.getLocal("bits"))),i.setLocal("mask",i.i32_sub(i.getLocal("n"),i.i32_const(1))),i.setLocal("i",i.i32_const(1)),i.setLocal("ndiv2",i.i32_shr_u(i.getLocal("n"),i.i32_const(1))),i.block(i.loop(i.br_if(1,i.i32_ge_u(i.getLocal("i"),i.getLocal("ndiv2"))),i.setLocal("idx1",i.i32_add(i.getLocal("px"),i.i32_mul(i.getLocal("i"),i.i32_const(t)))),i.setLocal("idx2",i.i32_add(i.getLocal("px"),i.i32_mul(i.i32_sub(i.getLocal("n"),i.getLocal("i")),i.i32_const(t)))),i.if(i.getLocal("reverse"),i.if(i.call(f+"_isOne",i.getLocal("mulFactor")),[...i.call(c+"_copy",i.getLocal("idx1"),r),...i.call(c+"_copy",i.getLocal("idx2"),i.getLocal("idx1")),...i.call(c+"_copy",r,i.getLocal("idx2"))],[...i.call(c+"_copy",i.getLocal("idx1"),r),...i.call(d,i.getLocal("idx2"),i.getLocal("mulFactor"),i.getLocal("idx1")),...i.call(d,r,i.getLocal("mulFactor"),i.getLocal("idx2"))]),i.if(i.call(f+"_isOne",i.getLocal("mulFactor")),[],[...i.call(d,i.getLocal("idx1"),i.getLocal("mulFactor"),i.getLocal("idx1")),...i.call(d,i.getLocal("idx2"),i.getLocal("mulFactor"),i.getLocal("idx2"))])),i.setLocal("i",i.i32_add(i.getLocal("i"),i.i32_const(1))),i.br(0))),i.if(i.call(f+"_isOne",i.getLocal("mulFactor")),[],[...i.call(d,i.getLocal("px"),i.getLocal("mulFactor"),i.getLocal("px")),...i.setLocal("idx2",i.i32_add(i.getLocal("px"),i.i32_mul(i.getLocal("ndiv2"),i.i32_const(t)))),...i.call(d,i.getLocal("idx2"),i.getLocal("mulFactor"),i.getLocal("idx2"))]))}(),function(){const i=e.addFunction(a+"_rawfft");i.addParam("px","i32"),i.addParam("bits","i32"),i.addParam("reverse","i32"),i.addParam("mulFactor","i32"),i.addLocal("s","i32"),i.addLocal("k","i32"),i.addLocal("j","i32"),i.addLocal("m","i32"),i.addLocal("mdiv2","i32"),i.addLocal("n","i32"),i.addLocal("pwm","i32"),i.addLocal("idx1","i32"),i.addLocal("idx2","i32");const r=i.getCodeBuilder(),n=r.i32_const(e.alloc(b)),o=r.i32_const(e.alloc(t)),s=r.i32_const(e.alloc(t));i.addCode(r.call(a+"__reversePermutation",r.getLocal("px"),r.getLocal("bits")),r.setLocal("n",r.i32_shl(r.i32_const(1),r.getLocal("bits"))),r.setLocal("s",r.i32_const(1)),r.block(r.loop(r.br_if(1,r.i32_gt_u(r.getLocal("s"),r.getLocal("bits"))),r.setLocal("m",r.i32_shl(r.i32_const(1),r.getLocal("s"))),r.setLocal("pwm",r.i32_add(r.i32_const(x),r.i32_mul(r.getLocal("s"),r.i32_const(b)))),r.setLocal("k",r.i32_const(0)),r.block(r.loop(r.br_if(1,r.i32_ge_u(r.getLocal("k"),r.getLocal("n"))),r.call(f+"_one",n),r.setLocal("mdiv2",r.i32_shr_u(r.getLocal("m"),r.i32_const(1))),r.setLocal("j",r.i32_const(0)),r.block(r.loop(r.br_if(1,r.i32_ge_u(r.getLocal("j"),r.getLocal("mdiv2"))),r.setLocal("idx1",r.i32_add(r.getLocal("px"),r.i32_mul(r.i32_add(r.getLocal("k"),r.getLocal("j")),r.i32_const(t)))),r.setLocal("idx2",r.i32_add(r.getLocal("idx1"),r.i32_mul(r.getLocal("mdiv2"),r.i32_const(t)))),r.call(d,r.getLocal("idx2"),n,o),r.call(c+"_copy",r.getLocal("idx1"),s),r.call(c+"_add",s,o,r.getLocal("idx1")),r.call(c+"_sub",s,o,r.getLocal("idx2")),r.call(f+"_mul",n,r.getLocal("pwm"),n),r.setLocal("j",r.i32_add(r.getLocal("j"),r.i32_const(1))),r.br(0))),r.setLocal("k",r.i32_add(r.getLocal("k"),r.getLocal("m"))),r.br(0))),r.setLocal("s",r.i32_add(r.getLocal("s"),r.i32_const(1))),r.br(0))),r.call(a+"__fftFinal",r.getLocal("px"),r.getLocal("bits"),r.getLocal("reverse"),r.getLocal("mulFactor")))}(),function(){const c=e.addFunction(a+"__log2");c.addParam("n","i32"),c.setReturnType("i32"),c.addLocal("bits","i32"),c.addLocal("aux","i32");const f=c.getCodeBuilder();c.addCode(f.setLocal("aux",f.i32_shr_u(f.getLocal("n"),f.i32_const(1)))),c.addCode(f.setLocal("bits",f.i32_const(0))),c.addCode(f.block(f.loop(f.br_if(1,f.i32_eqz(f.getLocal("aux"))),f.setLocal("aux",f.i32_shr_u(f.getLocal("aux"),f.i32_const(1))),f.setLocal("bits",f.i32_add(f.getLocal("bits"),f.i32_const(1))),f.br(0)))),c.addCode(f.if(f.i32_ne(f.getLocal("n"),f.i32_shl(f.i32_const(1),f.getLocal("bits"))),f.unreachable())),c.addCode(f.if(f.i32_gt_u(f.getLocal("bits"),f.i32_const(n)),f.unreachable())),c.addCode(f.getLocal("bits"))}(),function(){const c=e.addFunction(a+"_fft");c.addParam("px","i32"),c.addParam("n","i32"),c.addLocal("bits","i32");const d=c.getCodeBuilder(),t=d.i32_const(e.alloc(b));c.addCode(d.setLocal("bits",d.call(a+"__log2",d.getLocal("n"))),d.call(f+"_one",t),d.call(a+"_rawfft",d.getLocal("px"),d.getLocal("bits"),d.i32_const(0),t))}(),function(){const c=e.addFunction(a+"_ifft");c.addParam("px","i32"),c.addParam("n","i32"),c.addLocal("bits","i32"),c.addLocal("pInv2","i32");const f=c.getCodeBuilder();c.addCode(f.setLocal("bits",f.call(a+"__log2",f.getLocal("n"))),f.setLocal("pInv2",f.i32_add(f.i32_const(m),f.i32_mul(f.getLocal("bits"),f.i32_const(b)))),f.call(a+"_rawfft",f.getLocal("px"),f.getLocal("bits"),f.i32_const(1),f.getLocal("pInv2")))}(),function(){const i=e.addFunction(a+"_fftJoin");i.addParam("pBuff1","i32"),i.addParam("pBuff2","i32"),i.addParam("n","i32"),i.addParam("first","i32"),i.addParam("inc","i32"),i.addLocal("idx1","i32"),i.addLocal("idx2","i32"),i.addLocal("i","i32");const r=i.getCodeBuilder(),n=r.i32_const(e.alloc(b)),o=r.i32_const(e.alloc(t)),s=r.i32_const(e.alloc(t));i.addCode(r.call(f+"_copy",r.getLocal("first"),n),r.setLocal("i",r.i32_const(0)),r.block(r.loop(r.br_if(1,r.i32_eq(r.getLocal("i"),r.getLocal("n"))),r.setLocal("idx1",r.i32_add(r.getLocal("pBuff1"),r.i32_mul(r.getLocal("i"),r.i32_const(t)))),r.setLocal("idx2",r.i32_add(r.getLocal("pBuff2"),r.i32_mul(r.getLocal("i"),r.i32_const(t)))),r.call(d,r.getLocal("idx2"),n,o),r.call(c+"_copy",r.getLocal("idx1"),s),r.call(c+"_add",s,o,r.getLocal("idx1")),r.call(c+"_sub",s,o,r.getLocal("idx2")),r.call(f+"_mul",n,r.getLocal("inc"),n),r.setLocal("i",r.i32_add(r.getLocal("i"),r.i32_const(1))),r.br(0))))}(),function(){const i=e.addFunction(a+"_fftJoinExt");i.addParam("pBuff1","i32"),i.addParam("pBuff2","i32"),i.addParam("n","i32"),i.addParam("first","i32"),i.addParam("inc","i32"),i.addParam("totalBits","i32"),i.addLocal("idx1","i32"),i.addLocal("idx2","i32"),i.addLocal("i","i32"),i.addLocal("pShiftToM","i32");const r=i.getCodeBuilder(),n=r.i32_const(e.alloc(b)),o=r.i32_const(e.alloc(t));i.addCode(r.setLocal("pShiftToM",r.i32_add(r.i32_const(w),r.i32_mul(r.getLocal("totalBits"),r.i32_const(b)))),r.call(f+"_copy",r.getLocal("first"),n),r.setLocal("i",r.i32_const(0)),r.block(r.loop(r.br_if(1,r.i32_eq(r.getLocal("i"),r.getLocal("n"))),r.setLocal("idx1",r.i32_add(r.getLocal("pBuff1"),r.i32_mul(r.getLocal("i"),r.i32_const(t)))),r.setLocal("idx2",r.i32_add(r.getLocal("pBuff2"),r.i32_mul(r.getLocal("i"),r.i32_const(t)))),r.call(c+"_add",r.getLocal("idx1"),r.getLocal("idx2"),o),r.call(d,r.getLocal("idx2"),r.getLocal("pShiftToM"),r.getLocal("idx2")),r.call(c+"_add",r.getLocal("idx1"),r.getLocal("idx2"),r.getLocal("idx2")),r.call(d,r.getLocal("idx2"),n,r.getLocal("idx2")),r.call(c+"_copy",o,r.getLocal("idx1")),r.call(f+"_mul",n,r.getLocal("inc"),n),r.setLocal("i",r.i32_add(r.getLocal("i"),r.i32_const(1))),r.br(0))))}(),function(){const i=e.addFunction(a+"_fftJoinExtInv");i.addParam("pBuff1","i32"),i.addParam("pBuff2","i32"),i.addParam("n","i32"),i.addParam("first","i32"),i.addParam("inc","i32"),i.addParam("totalBits","i32"),i.addLocal("idx1","i32"),i.addLocal("idx2","i32"),i.addLocal("i","i32"),i.addLocal("pShiftToM","i32"),i.addLocal("pSConst","i32");const r=i.getCodeBuilder(),n=r.i32_const(e.alloc(b)),o=r.i32_const(e.alloc(t));i.addCode(r.setLocal("pShiftToM",r.i32_add(r.i32_const(w),r.i32_mul(r.getLocal("totalBits"),r.i32_const(b)))),r.setLocal("pSConst",r.i32_add(r.i32_const(M),r.i32_mul(r.getLocal("totalBits"),r.i32_const(b)))),r.call(f+"_copy",r.getLocal("first"),n),r.setLocal("i",r.i32_const(0)),r.block(r.loop(r.br_if(1,r.i32_eq(r.getLocal("i"),r.getLocal("n"))),r.setLocal("idx1",r.i32_add(r.getLocal("pBuff1"),r.i32_mul(r.getLocal("i"),r.i32_const(t)))),r.setLocal("idx2",r.i32_add(r.getLocal("pBuff2"),r.i32_mul(r.getLocal("i"),r.i32_const(t)))),r.call(d,r.getLocal("idx2"),n,o),r.call(c+"_sub",r.getLocal("idx1"),o,r.getLocal("idx2")),r.call(d,r.getLocal("idx2"),r.getLocal("pSConst"),r.getLocal("idx2")),r.call(d,r.getLocal("idx1"),r.getLocal("pShiftToM"),r.getLocal("idx1")),r.call(c+"_sub",o,r.getLocal("idx1"),r.getLocal("idx1")),r.call(d,r.getLocal("idx1"),r.getLocal("pSConst"),r.getLocal("idx1")),r.call(f+"_mul",n,r.getLocal("inc"),n),r.setLocal("i",r.i32_add(r.getLocal("i"),r.i32_const(1))),r.br(0))))}(),function(){const i=e.addFunction(a+"_fftMix");i.addParam("pBuff","i32"),i.addParam("n","i32"),i.addParam("exp","i32"),i.addLocal("nGroups","i32"),i.addLocal("nPerGroup","i32"),i.addLocal("nPerGroupDiv2","i32"),i.addLocal("pairOffset","i32"),i.addLocal("idx1","i32"),i.addLocal("idx2","i32"),i.addLocal("i","i32"),i.addLocal("j","i32"),i.addLocal("pwm","i32");const r=i.getCodeBuilder(),n=r.i32_const(e.alloc(b)),o=r.i32_const(e.alloc(t)),s=r.i32_const(e.alloc(t));i.addCode(r.setLocal("nPerGroup",r.i32_shl(r.i32_const(1),r.getLocal("exp"))),r.setLocal("nPerGroupDiv2",r.i32_shr_u(r.getLocal("nPerGroup"),r.i32_const(1))),r.setLocal("nGroups",r.i32_shr_u(r.getLocal("n"),r.getLocal("exp"))),r.setLocal("pairOffset",r.i32_mul(r.getLocal("nPerGroupDiv2"),r.i32_const(t))),r.setLocal("pwm",r.i32_add(r.i32_const(x),r.i32_mul(r.getLocal("exp"),r.i32_const(b)))),r.setLocal("i",r.i32_const(0)),r.block(r.loop(r.br_if(1,r.i32_eq(r.getLocal("i"),r.getLocal("nGroups"))),r.call(f+"_one",n),r.setLocal("j",r.i32_const(0)),r.block(r.loop(r.br_if(1,r.i32_eq(r.getLocal("j"),r.getLocal("nPerGroupDiv2"))),r.setLocal("idx1",r.i32_add(r.getLocal("pBuff"),r.i32_mul(r.i32_add(r.i32_mul(r.getLocal("i"),r.getLocal("nPerGroup")),r.getLocal("j")),r.i32_const(t)))),r.setLocal("idx2",r.i32_add(r.getLocal("idx1"),r.getLocal("pairOffset"))),r.call(d,r.getLocal("idx2"),n,o),r.call(c+"_copy",r.getLocal("idx1"),s),r.call(c+"_add",s,o,r.getLocal("idx1")),r.call(c+"_sub",s,o,r.getLocal("idx2")),r.call(f+"_mul",n,r.getLocal("pwm"),n),r.setLocal("j",r.i32_add(r.getLocal("j"),r.i32_const(1))),r.br(0))),r.setLocal("i",r.i32_add(r.getLocal("i"),r.i32_const(1))),r.br(0))))}(),function(){const f=e.addFunction(a+"_fftFinal");f.addParam("pBuff","i32"),f.addParam("n","i32"),f.addParam("factor","i32"),f.addLocal("idx1","i32"),f.addLocal("idx2","i32"),f.addLocal("i","i32"),f.addLocal("ndiv2","i32");const b=f.getCodeBuilder(),i=b.i32_const(e.alloc(t));f.addCode(b.setLocal("ndiv2",b.i32_shr_u(b.getLocal("n"),b.i32_const(1))),b.if(b.i32_and(b.getLocal("n"),b.i32_const(1)),b.call(d,b.i32_add(b.getLocal("pBuff"),b.i32_mul(b.getLocal("ndiv2"),b.i32_const(t))),b.getLocal("factor"),b.i32_add(b.getLocal("pBuff"),b.i32_mul(b.getLocal("ndiv2"),b.i32_const(t))))),b.setLocal("i",b.i32_const(0)),b.block(b.loop(b.br_if(1,b.i32_ge_u(b.getLocal("i"),b.getLocal("ndiv2"))),b.setLocal("idx1",b.i32_add(b.getLocal("pBuff"),b.i32_mul(b.getLocal("i"),b.i32_const(t)))),b.setLocal("idx2",b.i32_add(b.getLocal("pBuff"),b.i32_mul(b.i32_sub(b.i32_sub(b.getLocal("n"),b.i32_const(1)),b.getLocal("i")),b.i32_const(t)))),b.call(d,b.getLocal("idx2"),b.getLocal("factor"),i),b.call(d,b.getLocal("idx1"),b.getLocal("factor"),b.getLocal("idx2")),b.call(c+"_copy",i,b.getLocal("idx1")),b.setLocal("i",b.i32_add(b.getLocal("i"),b.i32_const(1))),b.br(0))))}(),function(){const i=e.addFunction(a+"_prepareLagrangeEvaluation");i.addParam("pBuff1","i32"),i.addParam("pBuff2","i32"),i.addParam("n","i32"),i.addParam("first","i32"),i.addParam("inc","i32"),i.addParam("totalBits","i32"),i.addLocal("idx1","i32"),i.addLocal("idx2","i32"),i.addLocal("i","i32"),i.addLocal("pShiftToM","i32"),i.addLocal("pSConst","i32");const r=i.getCodeBuilder(),n=r.i32_const(e.alloc(b)),o=r.i32_const(e.alloc(t));i.addCode(r.setLocal("pShiftToM",r.i32_add(r.i32_const(w),r.i32_mul(r.getLocal("totalBits"),r.i32_const(b)))),r.setLocal("pSConst",r.i32_add(r.i32_const(M),r.i32_mul(r.getLocal("totalBits"),r.i32_const(b)))),r.call(f+"_copy",r.getLocal("first"),n),r.setLocal("i",r.i32_const(0)),r.block(r.loop(r.br_if(1,r.i32_eq(r.getLocal("i"),r.getLocal("n"))),r.setLocal("idx1",r.i32_add(r.getLocal("pBuff1"),r.i32_mul(r.getLocal("i"),r.i32_const(t)))),r.setLocal("idx2",r.i32_add(r.getLocal("pBuff2"),r.i32_mul(r.getLocal("i"),r.i32_const(t)))),r.call(d,r.getLocal("idx1"),r.getLocal("pShiftToM"),o),r.call(c+"_sub",r.getLocal("idx2"),o,o),r.call(c+"_sub",r.getLocal("idx1"),r.getLocal("idx2"),r.getLocal("idx2")),r.call(d,o,r.getLocal("pSConst"),r.getLocal("idx1")),r.call(d,r.getLocal("idx2"),n,r.getLocal("idx2")),r.call(f+"_mul",n,r.getLocal("inc"),n),r.setLocal("i",r.i32_add(r.getLocal("i"),r.i32_const(1))),r.br(0))))}(),e.exportFunction(a+"_fft"),e.exportFunction(a+"_ifft"),e.exportFunction(a+"_rawfft"),e.exportFunction(a+"_fftJoin"),e.exportFunction(a+"_fftJoinExt"),e.exportFunction(a+"_fftJoinExtInv"),e.exportFunction(a+"_fftMix"),e.exportFunction(a+"_fftFinal"),e.exportFunction(a+"_prepareLagrangeEvaluation")},Be=function(e,a,c){const f=8*e.modules[c].n64;return function(){const d=e.addFunction(a+"_zero");d.addParam("px","i32"),d.addParam("n","i32"),d.addLocal("lastp","i32"),d.addLocal("p","i32");const b=d.getCodeBuilder();d.addCode(b.setLocal("p",b.getLocal("px")),b.setLocal("lastp",b.i32_add(b.getLocal("px"),b.i32_mul(b.getLocal("n"),b.i32_const(f)))),b.block(b.loop(b.br_if(1,b.i32_eq(b.getLocal("p"),b.getLocal("lastp"))),b.call(c+"_zero",b.getLocal("p")),b.setLocal("p",b.i32_add(b.getLocal("p"),b.i32_const(f))),b.br(0))))}(),function(){const d=e.addFunction(a+"_constructLC");d.addParam("ppolynomials","i32"),d.addParam("psignals","i32"),d.addParam("nSignals","i32"),d.addParam("pres","i32"),d.addLocal("i","i32"),d.addLocal("j","i32"),d.addLocal("pp","i32"),d.addLocal("ps","i32"),d.addLocal("pd","i32"),d.addLocal("ncoefs","i32");const b=d.getCodeBuilder(),t=b.i32_const(e.alloc(f));d.addCode(b.setLocal("i",b.i32_const(0)),b.setLocal("pp",b.getLocal("ppolynomials")),b.setLocal("ps",b.getLocal("psignals")),b.block(b.loop(b.br_if(1,b.i32_eq(b.getLocal("i"),b.getLocal("nSignals"))),b.setLocal("ncoefs",b.i32_load(b.getLocal("pp"))),b.setLocal("pp",b.i32_add(b.getLocal("pp"),b.i32_const(4))),b.setLocal("j",b.i32_const(0)),b.block(b.loop(b.br_if(1,b.i32_eq(b.getLocal("j"),b.getLocal("ncoefs"))),b.setLocal("pd",b.i32_add(b.getLocal("pres"),b.i32_mul(b.i32_load(b.getLocal("pp")),b.i32_const(f)))),b.setLocal("pp",b.i32_add(b.getLocal("pp"),b.i32_const(4))),b.call(c+"_mul",b.getLocal("ps"),b.getLocal("pp"),t),b.call(c+"_add",t,b.getLocal("pd"),b.getLocal("pd")),b.setLocal("pp",b.i32_add(b.getLocal("pp"),b.i32_const(f))),b.setLocal("j",b.i32_add(b.getLocal("j"),b.i32_const(1))),b.br(0))),b.setLocal("ps",b.i32_add(b.getLocal("ps"),b.i32_const(f))),b.setLocal("i",b.i32_add(b.getLocal("i"),b.i32_const(1))),b.br(0))))}(),e.exportFunction(a+"_zero"),e.exportFunction(a+"_constructLC"),a},Fe=function(e,a,c){const f=8*e.modules[c].n64;return function(){const d=e.addFunction(a+"_buildABC");d.addParam("pCoefs","i32"),d.addParam("nCoefs","i32"),d.addParam("pWitness","i32"),d.addParam("pA","i32"),d.addParam("pB","i32"),d.addParam("pC","i32"),d.addParam("offsetOut","i32"),d.addParam("nOut","i32"),d.addParam("offsetWitness","i32"),d.addParam("nWitness","i32"),d.addLocal("it","i32"),d.addLocal("ita","i32"),d.addLocal("itb","i32"),d.addLocal("last","i32"),d.addLocal("m","i32"),d.addLocal("c","i32"),d.addLocal("s","i32"),d.addLocal("pOut","i32");const b=d.getCodeBuilder(),t=b.i32_const(e.alloc(f));d.addCode(b.setLocal("ita",b.getLocal("pA")),b.setLocal("itb",b.getLocal("pB")),b.setLocal("last",b.i32_add(b.getLocal("pA"),b.i32_mul(b.getLocal("nOut"),b.i32_const(f)))),b.block(b.loop(b.br_if(1,b.i32_eq(b.getLocal("ita"),b.getLocal("last"))),b.call(c+"_zero",b.getLocal("ita")),b.call(c+"_zero",b.getLocal("itb")),b.setLocal("ita",b.i32_add(b.getLocal("ita"),b.i32_const(f))),b.setLocal("itb",b.i32_add(b.getLocal("itb"),b.i32_const(f))),b.br(0))),b.setLocal("it",b.getLocal("pCoefs")),b.setLocal("last",b.i32_add(b.getLocal("pCoefs"),b.i32_mul(b.getLocal("nCoefs"),b.i32_const(f+12)))),b.block(b.loop(b.br_if(1,b.i32_eq(b.getLocal("it"),b.getLocal("last"))),b.setLocal("s",b.i32_load(b.getLocal("it"),8)),b.if(b.i32_or(b.i32_lt_u(b.getLocal("s"),b.getLocal("offsetWitness")),b.i32_ge_u(b.getLocal("s"),b.i32_add(b.getLocal("offsetWitness"),b.getLocal("nWitness")))),[...b.setLocal("it",b.i32_add(b.getLocal("it"),b.i32_const(f+12))),...b.br(1)]),b.setLocal("m",b.i32_load(b.getLocal("it"))),b.if(b.i32_eq(b.getLocal("m"),b.i32_const(0)),b.setLocal("pOut",b.getLocal("pA")),b.if(b.i32_eq(b.getLocal("m"),b.i32_const(1)),b.setLocal("pOut",b.getLocal("pB")),[...b.setLocal("it",b.i32_add(b.getLocal("it"),b.i32_const(f+12))),...b.br(1)])),b.setLocal("c",b.i32_load(b.getLocal("it"),4)),b.if(b.i32_or(b.i32_lt_u(b.getLocal("c"),b.getLocal("offsetOut")),b.i32_ge_u(b.getLocal("c"),b.i32_add(b.getLocal("offsetOut"),b.getLocal("nOut")))),[...b.setLocal("it",b.i32_add(b.getLocal("it"),b.i32_const(f+12))),...b.br(1)]),b.setLocal("pOut",b.i32_add(b.getLocal("pOut"),b.i32_mul(b.i32_sub(b.getLocal("c"),b.getLocal("offsetOut")),b.i32_const(f)))),b.call(c+"_mul",b.i32_add(b.getLocal("pWitness"),b.i32_mul(b.i32_sub(b.getLocal("s"),b.getLocal("offsetWitness")),b.i32_const(f))),b.i32_add(b.getLocal("it"),b.i32_const(12)),t),b.call(c+"_add",b.getLocal("pOut"),t,b.getLocal("pOut")),b.setLocal("it",b.i32_add(b.getLocal("it"),b.i32_const(f+12))),b.br(0))),b.setLocal("ita",b.getLocal("pA")),b.setLocal("itb",b.getLocal("pB")),b.setLocal("it",b.getLocal("pC")),b.setLocal("last",b.i32_add(b.getLocal("pA"),b.i32_mul(b.getLocal("nOut"),b.i32_const(f)))),b.block(b.loop(b.br_if(1,b.i32_eq(b.getLocal("ita"),b.getLocal("last"))),b.call(c+"_mul",b.getLocal("ita"),b.getLocal("itb"),b.getLocal("it")),b.setLocal("ita",b.i32_add(b.getLocal("ita"),b.i32_const(f))),b.setLocal("itb",b.i32_add(b.getLocal("itb"),b.i32_const(f))),b.setLocal("it",b.i32_add(b.getLocal("it"),b.i32_const(f))),b.br(0))))}(),function(){const d=e.addFunction(a+"_joinABC");d.addParam("pA","i32"),d.addParam("pB","i32"),d.addParam("pC","i32"),d.addParam("n","i32"),d.addParam("pP","i32"),d.addLocal("ita","i32"),d.addLocal("itb","i32"),d.addLocal("itc","i32"),d.addLocal("itp","i32"),d.addLocal("last","i32");const b=d.getCodeBuilder(),t=b.i32_const(e.alloc(f));d.addCode(b.setLocal("ita",b.getLocal("pA")),b.setLocal("itb",b.getLocal("pB")),b.setLocal("itc",b.getLocal("pC")),b.setLocal("itp",b.getLocal("pP")),b.setLocal("last",b.i32_add(b.getLocal("pA"),b.i32_mul(b.getLocal("n"),b.i32_const(f)))),b.block(b.loop(b.br_if(1,b.i32_eq(b.getLocal("ita"),b.getLocal("last"))),b.call(c+"_mul",b.getLocal("ita"),b.getLocal("itb"),t),b.call(c+"_sub",t,b.getLocal("itc"),b.getLocal("itp")),b.setLocal("ita",b.i32_add(b.getLocal("ita"),b.i32_const(f))),b.setLocal("itb",b.i32_add(b.getLocal("itb"),b.i32_const(f))),b.setLocal("itc",b.i32_add(b.getLocal("itc"),b.i32_const(f))),b.setLocal("itp",b.i32_add(b.getLocal("itp"),b.i32_const(f))),b.br(0))))}(),function(){const d=e.addFunction(a+"_batchAdd");d.addParam("pa","i32"),d.addParam("pb","i32"),d.addParam("n","i32"),d.addParam("pr","i32"),d.addLocal("ita","i32"),d.addLocal("itb","i32"),d.addLocal("itr","i32"),d.addLocal("last","i32");const b=d.getCodeBuilder();d.addCode(b.setLocal("ita",b.getLocal("pa")),b.setLocal("itb",b.getLocal("pb")),b.setLocal("itr",b.getLocal("pr")),b.setLocal("last",b.i32_add(b.getLocal("pa"),b.i32_mul(b.getLocal("n"),b.i32_const(f)))),b.block(b.loop(b.br_if(1,b.i32_eq(b.getLocal("ita"),b.getLocal("last"))),b.call(c+"_add",b.getLocal("ita"),b.getLocal("itb"),b.getLocal("itr")),b.setLocal("ita",b.i32_add(b.getLocal("ita"),b.i32_const(f))),b.setLocal("itb",b.i32_add(b.getLocal("itb"),b.i32_const(f))),b.setLocal("itr",b.i32_add(b.getLocal("itr"),b.i32_const(f))),b.br(0))))}(),e.exportFunction(a+"_buildABC"),e.exportFunction(a+"_joinABC"),e.exportFunction(a+"_batchAdd"),a},Oe=function(e,a,c,f,d,b,t,i){const r=e.addFunction(a);r.addParam("pIn","i32"),r.addParam("n","i32"),r.addParam("pFirst","i32"),r.addParam("pInc","i32"),r.addParam("pOut","i32"),r.addLocal("pOldFree","i32"),r.addLocal("i","i32"),r.addLocal("pFrom","i32"),r.addLocal("pTo","i32");const n=r.getCodeBuilder(),o=n.i32_const(e.alloc(t));r.addCode(n.setLocal("pFrom",n.getLocal("pIn")),n.setLocal("pTo",n.getLocal("pOut"))),r.addCode(n.call(f+"_copy",n.getLocal("pFirst"),o)),r.addCode(n.setLocal("i",n.i32_const(0)),n.block(n.loop(n.br_if(1,n.i32_eq(n.getLocal("i"),n.getLocal("n"))),n.call(i,n.getLocal("pFrom"),o,n.getLocal("pTo")),n.setLocal("pFrom",n.i32_add(n.getLocal("pFrom"),n.i32_const(d))),n.setLocal("pTo",n.i32_add(n.getLocal("pTo"),n.i32_const(b))),n.call(f+"_mul",o,n.getLocal("pInc"),o),n.setLocal("i",n.i32_add(n.getLocal("i"),n.i32_const(1))),n.br(0)))),e.exportFunction(a)};const Pe=T,Re=se,Te=ue,Ue=me,je=ve,Ne=Le,qe=Ce,De=Be,ze=Fe,Qe=Oe,{bitLength:Ge,modInv:Ke,isOdd:He,isNegative:Ve}=q,Ze=T,We=se,Ye=ue,Je=me,$e=ve,Xe=Le,ea=Ce,aa=Be,ca=Fe,fa=Oe,{bitLength:da,isOdd:ba,isNegative:ta}=q;var ia=function(e,a){const c=a||"bn128";if(e.modules[c])return c;const f=21888242871839275222246405745257275088696311157297823662689037894645226208583n,d=21888242871839275222246405745257275088548364400416034343698204186575808495617n,b=Math.floor((Ge(f-1n)-1)/64)+1,t=8*b,i=t,r=t,n=2*r,o=12*r,s=e.alloc(Pe.bigInt2BytesLE(d,i)),l=Re(e,f,"f1m");Te(e,d,"fr","frm");const h=e.alloc(Pe.bigInt2BytesLE(y(3n),r)),u=Ne(e,"g1m","f1m",h);qe(e,"frm","frm","frm","frm_mul"),De(e,"pol","frm"),ze(e,"qap","frm");const x=Ue(e,"f1m_neg","f2m","f1m"),p=e.alloc([...Pe.bigInt2BytesLE(y(19485874751759354771024239261021720505790618469301721065564631296452457478373n),r),...Pe.bigInt2BytesLE(y(266929791119991161246907387137283842545076965332900288569378510910307636690n),r)]),g=Ne(e,"g2m","f2m",p);function m(a,c){const f=e.addFunction(a);f.addParam("pG","i32"),f.addParam("pFr","i32"),f.addParam("pr","i32");const d=f.getCodeBuilder(),b=d.i32_const(e.alloc(t));f.addCode(d.call("frm_fromMontgomery",d.getLocal("pFr"),b),d.call(c,d.getLocal("pG"),b,d.i32_const(t),d.getLocal("pr"))),e.exportFunction(a)}function y(e){return BigInt(e)*(1n<0n;)He(e)?a.push(1):a.push(0),e>>=1n;return a}(),T=e.alloc(R),U=3*n,j=R.length-1,N=R.reduce(((e,a)=>e+(0!=a?1:0)),0),q=6*t,D=3*t*2+(N+j+1)*U;function z(a){const d=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[8376118865763821496583973867626364092589906065868298776909617916018768340080n,16469823323077808223889137241176536799009286646108169935659301613961712198316n],[21888242871839275220042445260109153167277707414472061641714758635765020556617n,0n],[11697423496358154304825782922584725312912383441159505038794027105778954184319n,303847389135065887422783454877609941456349188919719272345083954437860409601n],[21888242871839275220042445260109153167277707414472061641714758635765020556616n,0n],[3321304630594332808241809054958361220322477375291206261884409189760185844239n,5722266937896532885780051958958348231143373700109372999374820235121374419868n],[21888242871839275222246405745257275088696311157297823662689037894645226208582n,0n],[13512124006075453725662431877630910996106405091429524885779419978626457868503n,5418419548761466998357268504080738289687024511189653727029736280683514010267n],[2203960485148121921418603742825762020974279258880205651966n,0n],[10190819375481120917420622822672549775783927716138318623895010788866272024264n,21584395482704209334823622290379665147239961968378104390343953940207365798982n],[2203960485148121921418603742825762020974279258880205651967n,0n],[18566938241244942414004596690298913868373833782006617400804628704885040364344n,16165975933942742336466353786298926857552937457188450663314217659523851788715n]]],b=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[21575463638280843010398324269430826099269044274347216827212613867836435027261n,10307601595873709700152284273816112264069230130616436755625194854815875713954n],[21888242871839275220042445260109153167277707414472061641714758635765020556616n,0n],[3772000881919853776433695186713858239009073593817195771773381919316419345261n,2236595495967245188281701248203181795121068902605861227855261137820944008926n],[2203960485148121921418603742825762020974279258880205651966n,0n],[18429021223477853657660792034369865839114504446431234726392080002137598044644n,9344045779998320333812420223237981029506012124075525679208581902008406485703n]],[[1n,0n],[2581911344467009335267311115468803099551665605076196740867805258568234346338n,19937756971775647987995932169929341994314640652964949448313374472400716661030n],[2203960485148121921418603742825762020974279258880205651966n,0n],[5324479202449903542726783395506214481928257762400643279780343368557297135718n,16208900380737693084919495127334387981393726419856888799917914180988844123039n],[21888242871839275220042445260109153167277707414472061641714758635765020556616n,0n],[13981852324922362344252311234282257507216387789820983642040889267519694726527n,7629828391165209371577384193250820201684255241773809077146787135900891633097n]]],t=e.addFunction(c+"__frobeniusMap"+a);t.addParam("x","i32"),t.addParam("r","i32");const i=t.getCodeBuilder();for(let c=0;c<6;c++){const f=0==c?i.getLocal("x"):i.i32_add(i.getLocal("x"),i.i32_const(c*n)),s=f,h=i.i32_add(i.getLocal("x"),i.i32_const(c*n+r)),u=0==c?i.getLocal("r"):i.i32_add(i.getLocal("r"),i.i32_const(c*n)),p=u,g=i.i32_add(i.getLocal("r"),i.i32_const(c*n+r)),m=o(d[Math.floor(c/3)][a%12],b[c%3][a%6]),_=e.alloc([...Pe.bigInt2BytesLE(y(m[0]),32),...Pe.bigInt2BytesLE(y(m[1]),32)]);a%2==1?t.addCode(i.call(l+"_copy",s,p),i.call(l+"_neg",h,g),i.call(x+"_mul",u,i.i32_const(_),u)):t.addCode(i.call(x+"_mul",f,i.i32_const(_),u))}function o(e,a){const c=BigInt(e[0]),d=BigInt(e[1]),b=BigInt(a[0]),t=BigInt(a[1]),i=[(c*b-d*t)%f,(c*t+d*b)%f];return Ve(i[0])&&(i[0]=i[0]+f),i}}function Q(){!function(){const a=e.addFunction(c+"__cyclotomicSquare");a.addParam("x","i32"),a.addParam("r","i32");const f=a.getCodeBuilder(),d=f.getLocal("x"),b=f.i32_add(f.getLocal("x"),f.i32_const(n)),t=f.i32_add(f.getLocal("x"),f.i32_const(2*n)),i=f.i32_add(f.getLocal("x"),f.i32_const(3*n)),r=f.i32_add(f.getLocal("x"),f.i32_const(4*n)),o=f.i32_add(f.getLocal("x"),f.i32_const(5*n)),s=f.getLocal("r"),l=f.i32_add(f.getLocal("r"),f.i32_const(n)),h=f.i32_add(f.getLocal("r"),f.i32_const(2*n)),u=f.i32_add(f.getLocal("r"),f.i32_const(3*n)),p=f.i32_add(f.getLocal("r"),f.i32_const(4*n)),g=f.i32_add(f.getLocal("r"),f.i32_const(5*n)),m=f.i32_const(e.alloc(n)),y=f.i32_const(e.alloc(n)),_=f.i32_const(e.alloc(n)),v=f.i32_const(e.alloc(n)),w=f.i32_const(e.alloc(n)),M=f.i32_const(e.alloc(n)),A=f.i32_const(e.alloc(n)),L=f.i32_const(e.alloc(n));a.addCode(f.call(x+"_mul",d,r,A),f.call(x+"_mul",r,f.i32_const(S),m),f.call(x+"_add",d,m,m),f.call(x+"_add",d,r,L),f.call(x+"_mul",L,m,m),f.call(x+"_mul",f.i32_const(S),A,L),f.call(x+"_add",A,L,L),f.call(x+"_sub",m,L,m),f.call(x+"_add",A,A,y),f.call(x+"_mul",i,t,A),f.call(x+"_mul",t,f.i32_const(S),_),f.call(x+"_add",i,_,_),f.call(x+"_add",i,t,L),f.call(x+"_mul",L,_,_),f.call(x+"_mul",f.i32_const(S),A,L),f.call(x+"_add",A,L,L),f.call(x+"_sub",_,L,_),f.call(x+"_add",A,A,v),f.call(x+"_mul",b,o,A),f.call(x+"_mul",o,f.i32_const(S),w),f.call(x+"_add",b,w,w),f.call(x+"_add",b,o,L),f.call(x+"_mul",L,w,w),f.call(x+"_mul",f.i32_const(S),A,L),f.call(x+"_add",A,L,L),f.call(x+"_sub",w,L,w),f.call(x+"_add",A,A,M),f.call(x+"_sub",m,d,s),f.call(x+"_add",s,s,s),f.call(x+"_add",m,s,s),f.call(x+"_add",y,r,p),f.call(x+"_add",p,p,p),f.call(x+"_add",y,p,p),f.call(x+"_mul",M,f.i32_const(B),L),f.call(x+"_add",L,i,u),f.call(x+"_add",u,u,u),f.call(x+"_add",L,u,u),f.call(x+"_sub",w,t,h),f.call(x+"_add",h,h,h),f.call(x+"_add",w,h,h),f.call(x+"_sub",_,b,l),f.call(x+"_add",l,l,l),f.call(x+"_add",_,l,l),f.call(x+"_add",v,o,g),f.call(x+"_add",g,g,g),f.call(x+"_add",v,g,g))}(),function(a,f){const d=function(e){let a=e;const c=[];for(;a>0n;){if(He(a)){const e=2-Number(a%4n);c.push(e),a-=BigInt(e)}else c.push(0);a>>=1n}return c}(a).map((e=>-1==e?255:e)),b=e.alloc(d),t=e.addFunction(c+"__cyclotomicExp_"+f);t.addParam("x","i32"),t.addParam("r","i32"),t.addLocal("bit","i32"),t.addLocal("i","i32");const i=t.getCodeBuilder(),r=i.getLocal("x"),n=i.getLocal("r"),s=i.i32_const(e.alloc(o));t.addCode(i.call(P+"_conjugate",r,s),i.call(P+"_one",n),i.if(i.teeLocal("bit",i.i32_load8_s(i.i32_const(d.length-1),b)),i.if(i.i32_eq(i.getLocal("bit"),i.i32_const(1)),i.call(P+"_mul",n,r,n),i.call(P+"_mul",n,s,n))),i.setLocal("i",i.i32_const(d.length-2)),i.block(i.loop(i.call(c+"__cyclotomicSquare",n,n),i.if(i.teeLocal("bit",i.i32_load8_s(i.getLocal("i"),b)),i.if(i.i32_eq(i.getLocal("bit"),i.i32_const(1)),i.call(P+"_mul",n,r,n),i.call(P+"_mul",n,s,n))),i.br_if(1,i.i32_eqz(i.getLocal("i"))),i.setLocal("i",i.i32_sub(i.getLocal("i"),i.i32_const(1))),i.br(0))))}(4965661367192848881n,"w0");const a=e.addFunction(c+"__finalExponentiationLastChunk");a.addParam("x","i32"),a.addParam("r","i32");const f=a.getCodeBuilder(),d=f.getLocal("x"),b=f.getLocal("r"),t=f.i32_const(e.alloc(o)),i=f.i32_const(e.alloc(o)),r=f.i32_const(e.alloc(o)),s=f.i32_const(e.alloc(o)),l=f.i32_const(e.alloc(o)),h=f.i32_const(e.alloc(o)),u=f.i32_const(e.alloc(o)),p=f.i32_const(e.alloc(o)),g=f.i32_const(e.alloc(o)),m=f.i32_const(e.alloc(o)),y=f.i32_const(e.alloc(o)),_=f.i32_const(e.alloc(o)),v=f.i32_const(e.alloc(o)),w=f.i32_const(e.alloc(o)),M=f.i32_const(e.alloc(o)),A=f.i32_const(e.alloc(o)),L=f.i32_const(e.alloc(o)),I=f.i32_const(e.alloc(o)),k=f.i32_const(e.alloc(o)),E=f.i32_const(e.alloc(o)),C=f.i32_const(e.alloc(o));a.addCode(f.call(c+"__cyclotomicExp_w0",d,t),f.call(P+"_conjugate",t,t),f.call(c+"__cyclotomicSquare",t,i),f.call(c+"__cyclotomicSquare",i,r),f.call(P+"_mul",r,i,s),f.call(c+"__cyclotomicExp_w0",s,l),f.call(P+"_conjugate",l,l),f.call(c+"__cyclotomicSquare",l,h),f.call(c+"__cyclotomicExp_w0",h,u),f.call(P+"_conjugate",u,u),f.call(P+"_conjugate",s,p),f.call(P+"_conjugate",u,g),f.call(P+"_mul",g,l,m),f.call(P+"_mul",m,p,y),f.call(P+"_mul",y,i,_),f.call(P+"_mul",y,l,v),f.call(P+"_mul",v,d,w),f.call(c+"__frobeniusMap1",_,M),f.call(P+"_mul",M,w,A),f.call(c+"__frobeniusMap2",y,L),f.call(P+"_mul",L,A,I),f.call(P+"_conjugate",d,k),f.call(P+"_mul",k,_,E),f.call(c+"__frobeniusMap3",E,C),f.call(P+"_mul",C,I,b))}e.modules[c]={n64:b,pG1gen:v,pG1zero:M,pG1b:h,pG2gen:L,pG2zero:k,pG2b:p,pq:e.modules.f1m.pq,pr:s,pOneT:E,prePSize:q,preQSize:D,r:d.toString(),q:f.toString()};const G=e.alloc(q),K=e.alloc(D);function H(a){const f=e.addFunction(c+"_pairingEq"+a);for(let e=0;e0n;)ba(e)?a.push(1):a.push(0),e>>=1n;return a}(),R=e.alloc(P),T=3*r,U=P.length-1,j=P.reduce(((e,a)=>e+(0!=a?1:0)),0),N=6*t,q=3*t*2+(j+U+1)*T,D=15132376222941642752n;function z(a){const c=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760n,151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351n,0n],[2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n,1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n,0n],[3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557n,877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230n],[4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786n,0n],[151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027n,3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,0n],[1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257n,2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437n,0n],[877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230n,3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557n]]],d=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[0n,4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n,0n],[0n,1n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,0n],[0n,793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n]],[[1n,0n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437n,0n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,0n],[4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786n,0n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n,0n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351n,0n]]],b=e.addFunction(O+"_frobeniusMap"+a);b.addParam("x","i32"),b.addParam("r","i32");const n=b.getCodeBuilder();for(let f=0;f<6;f++){const s=0==f?n.getLocal("x"):n.i32_add(n.getLocal("x"),n.i32_const(f*r)),l=s,h=n.i32_add(n.getLocal("x"),n.i32_const(f*r+i)),x=0==f?n.getLocal("r"):n.i32_add(n.getLocal("r"),n.i32_const(f*r)),p=x,m=n.i32_add(n.getLocal("r"),n.i32_const(f*r+i)),y=o(c[Math.floor(f/3)][a%12],d[f%3][a%6]),_=e.alloc([...Ze.bigInt2BytesLE(v(y[0]),t),...Ze.bigInt2BytesLE(v(y[1]),t)]);a%2==1?b.addCode(n.call(u+"_copy",l,p),n.call(u+"_neg",h,m),n.call(g+"_mul",x,n.i32_const(_),x)):b.addCode(n.call(g+"_mul",s,n.i32_const(_),x))}function o(e,a){const c=e[0],d=e[1],b=a[0],t=a[1],i=[(c*b-d*t)%f,(c*t+d*b)%f];return ta(i[0])&&(i[0]=i[0]+f),i}}e.modules[c]={n64q:b,n64r:o,n8q:t,n8r:s,pG1gen:M,pG1zero:L,pG1b:x,pG2gen:k,pG2zero:S,pG2b:m,pq:e.modules.f1m.pq,pr:h,pOneT:C,r:d,q:f,prePSize:N,preQSize:q},function(){const a=e.addFunction(F+"_mul1");a.addParam("pA","i32"),a.addParam("pC1","i32"),a.addParam("pR","i32");const c=a.getCodeBuilder(),f=c.getLocal("pA"),d=c.i32_add(c.getLocal("pA"),c.i32_const(2*i)),b=c.i32_add(c.getLocal("pA"),c.i32_const(4*i)),t=c.getLocal("pC1"),r=c.getLocal("pR"),n=c.i32_add(c.getLocal("pR"),c.i32_const(2*i)),o=c.i32_add(c.getLocal("pR"),c.i32_const(4*i)),s=c.i32_const(e.alloc(2*i)),l=c.i32_const(e.alloc(2*i));a.addCode(c.call(g+"_add",f,d,s),c.call(g+"_add",d,b,l),c.call(g+"_mul",d,t,o),c.call(g+"_mul",l,t,r),c.call(g+"_sub",r,o,r),c.call(g+"_mulNR",r,r),c.call(g+"_mul",s,t,n),c.call(g+"_sub",n,o,n))}(),function(){const a=e.addFunction(F+"_mul01");a.addParam("pA","i32"),a.addParam("pC0","i32"),a.addParam("pC1","i32"),a.addParam("pR","i32");const c=a.getCodeBuilder(),f=c.getLocal("pA"),d=c.i32_add(c.getLocal("pA"),c.i32_const(2*i)),b=c.i32_add(c.getLocal("pA"),c.i32_const(4*i)),t=c.getLocal("pC0"),r=c.getLocal("pC1"),n=c.getLocal("pR"),o=c.i32_add(c.getLocal("pR"),c.i32_const(2*i)),s=c.i32_add(c.getLocal("pR"),c.i32_const(4*i)),l=c.i32_const(e.alloc(2*i)),h=c.i32_const(e.alloc(2*i)),u=c.i32_const(e.alloc(2*i)),x=c.i32_const(e.alloc(2*i));a.addCode(c.call(g+"_mul",f,t,l),c.call(g+"_mul",d,r,h),c.call(g+"_add",f,d,u),c.call(g+"_add",f,b,x),c.call(g+"_add",d,b,n),c.call(g+"_mul",n,r,n),c.call(g+"_sub",n,h,n),c.call(g+"_mulNR",n,n),c.call(g+"_add",n,l,n),c.call(g+"_add",t,r,o),c.call(g+"_mul",o,u,o),c.call(g+"_sub",o,l,o),c.call(g+"_sub",o,h,o),c.call(g+"_mul",x,t,s),c.call(g+"_sub",s,l,s),c.call(g+"_add",s,h,s))}(),function(){const a=e.addFunction(O+"_mul014");a.addParam("pA","i32"),a.addParam("pC0","i32"),a.addParam("pC1","i32"),a.addParam("pC4","i32"),a.addParam("pR","i32");const c=a.getCodeBuilder(),f=c.getLocal("pA"),d=c.i32_add(c.getLocal("pA"),c.i32_const(6*i)),b=c.getLocal("pC0"),t=c.getLocal("pC1"),r=c.getLocal("pC4"),n=c.i32_const(e.alloc(6*i)),o=c.i32_const(e.alloc(6*i)),s=c.i32_const(e.alloc(2*i)),l=c.getLocal("pR"),h=c.i32_add(c.getLocal("pR"),c.i32_const(6*i));a.addCode(c.call(F+"_mul01",f,b,t,n),c.call(F+"_mul1",d,r,o),c.call(g+"_add",t,r,s),c.call(F+"_add",d,f,h),c.call(F+"_mul01",h,b,s,h),c.call(F+"_sub",h,n,h),c.call(F+"_sub",h,o,h),c.call(F+"_copy",o,l),c.call(F+"_mulNR",l,l),c.call(F+"_add",l,n,l))}(),function(){const a=e.addFunction(c+"_ell");a.addParam("pP","i32"),a.addParam("pCoefs","i32"),a.addParam("pF","i32");const f=a.getCodeBuilder(),d=f.getLocal("pP"),b=f.i32_add(f.getLocal("pP"),f.i32_const(t)),r=f.getLocal("pF"),n=f.getLocal("pCoefs"),o=f.i32_add(f.getLocal("pCoefs"),f.i32_const(i)),s=f.i32_add(f.getLocal("pCoefs"),f.i32_const(2*i)),l=f.i32_add(f.getLocal("pCoefs"),f.i32_const(3*i)),h=f.i32_add(f.getLocal("pCoefs"),f.i32_const(4*i)),x=e.alloc(2*i),p=f.i32_const(x),g=f.i32_const(x),m=f.i32_const(x+i),y=e.alloc(2*i),_=f.i32_const(y),v=f.i32_const(y),w=f.i32_const(y+i);a.addCode(f.call(u+"_mul",n,b,g),f.call(u+"_mul",o,b,m),f.call(u+"_mul",s,d,v),f.call(u+"_mul",l,d,w),f.call(O+"_mul014",r,h,_,p,r))}();const Q=e.alloc(N),G=e.alloc(q);function K(a){const f=e.addFunction(c+"_pairingEq"+a);for(let e=0;e0n;){if(ba(a)){const e=2-Number(a%4n);c.push(e),a-=BigInt(e)}else c.push(0);a>>=1n}return c}(a).map((e=>-1==e?255:e)),t=e.alloc(b),i=e.addFunction(c+"__cyclotomicExp_"+d);i.addParam("x","i32"),i.addParam("r","i32"),i.addLocal("bit","i32"),i.addLocal("i","i32");const r=i.getCodeBuilder(),o=r.getLocal("x"),s=r.getLocal("r"),l=r.i32_const(e.alloc(n));i.addCode(r.call(O+"_conjugate",o,l),r.call(O+"_one",s),r.if(r.teeLocal("bit",r.i32_load8_s(r.i32_const(b.length-1),t)),r.if(r.i32_eq(r.getLocal("bit"),r.i32_const(1)),r.call(O+"_mul",s,o,s),r.call(O+"_mul",s,l,s))),r.setLocal("i",r.i32_const(b.length-2)),r.block(r.loop(r.call(c+"__cyclotomicSquare",s,s),r.if(r.teeLocal("bit",r.i32_load8_s(r.getLocal("i"),t)),r.if(r.i32_eq(r.getLocal("bit"),r.i32_const(1)),r.call(O+"_mul",s,o,s),r.call(O+"_mul",s,l,s))),r.br_if(1,r.i32_eqz(r.getLocal("i"))),r.setLocal("i",r.i32_sub(r.getLocal("i"),r.i32_const(1))),r.br(0)))),f&&i.addCode(r.call(O+"_conjugate",s,s))}(D,!0,"w0");const a=e.addFunction(c+"_finalExponentiation");a.addParam("x","i32"),a.addParam("r","i32");const f=a.getCodeBuilder(),d=f.getLocal("x"),b=f.getLocal("r"),t=f.i32_const(e.alloc(n)),i=f.i32_const(e.alloc(n)),o=f.i32_const(e.alloc(n)),s=f.i32_const(e.alloc(n)),l=f.i32_const(e.alloc(n)),h=f.i32_const(e.alloc(n)),u=f.i32_const(e.alloc(n));a.addCode(f.call(O+"_frobeniusMap6",d,t),f.call(O+"_inverse",d,i),f.call(O+"_mul",t,i,o),f.call(O+"_copy",o,i),f.call(O+"_frobeniusMap2",o,o),f.call(O+"_mul",o,i,o),f.call(c+"__cyclotomicSquare",o,i),f.call(O+"_conjugate",i,i),f.call(c+"__cyclotomicExp_w0",o,s),f.call(c+"__cyclotomicSquare",s,l),f.call(O+"_mul",i,s,h),f.call(c+"__cyclotomicExp_w0",h,i),f.call(c+"__cyclotomicExp_w0",i,t),f.call(c+"__cyclotomicExp_w0",t,u),f.call(O+"_mul",u,l,u),f.call(c+"__cyclotomicExp_w0",u,l),f.call(O+"_conjugate",h,h),f.call(O+"_mul",l,h,l),f.call(O+"_mul",l,o,l),f.call(O+"_conjugate",o,h),f.call(O+"_mul",i,o,i),f.call(O+"_frobeniusMap3",i,i),f.call(O+"_mul",u,h,u),f.call(O+"_frobeniusMap1",u,u),f.call(O+"_mul",s,t,s),f.call(O+"_frobeniusMap2",s,s),f.call(O+"_mul",s,i,s),f.call(O+"_mul",s,u,s),f.call(O+"_mul",s,l,b))}();for(let a=1;a<=5;a++)K(a),e.exportFunction(c+"_pairingEq"+a);!function(){const a=e.addFunction(c+"_pairing");a.addParam("p","i32"),a.addParam("q","i32"),a.addParam("r","i32");const f=a.getCodeBuilder(),d=f.i32_const(e.alloc(n));a.addCode(f.call(c+"_prepareG1",f.getLocal("p"),f.i32_const(Q))),a.addCode(f.call(c+"_prepareG2",f.getLocal("q"),f.i32_const(G))),a.addCode(f.call(c+"_millerLoop",f.i32_const(Q),f.i32_const(G),d)),a.addCode(f.call(c+"_finalExponentiation",d,f.getLocal("r")))}(),e.exportFunction(c+"_pairing"),e.exportFunction(c+"_prepareG1"),e.exportFunction(c+"_prepareG2"),e.exportFunction(c+"_millerLoop"),e.exportFunction(c+"_finalExponentiation"),e.exportFunction(c+"_finalExponentiationOld"),e.exportFunction(c+"__cyclotomicSquare"),e.exportFunction(c+"__cyclotomicExp_w0"),e.exportFunction(F+"_mul1"),e.exportFunction(F+"_mul01"),e.exportFunction(O+"_mul014"),e.exportFunction(p+"_inGroupAffine"),e.exportFunction(p+"_inGroup"),e.exportFunction(y+"_inGroupAffine"),e.exportFunction(y+"_inGroup")};function na(e,a){let c=e;void 0===a&&0==(a=Math.floor((t(e)-1)/8)+1)&&(a=1);const f=new Uint8Array(a),d=new DataView(f.buffer);let b=0;for(;b>=BigInt(32)):b+2<=a?(d.setUint16(b,Number(c&BigInt(65535)),!0),b+=2,c>>=BigInt(16)):(d.setUint8(b,Number(c&BigInt(255)),!0),b+=1,c>>=BigInt(8));if(c)throw new Error("Number does not fit in this length");return f}const oa=[];for(let e=0;e<256;e++)oa[e]=sa(e,8);function sa(e,a){let c=0,f=e;for(let e=0;e>=1;return c}function la(e,a){return(oa[e>>>24]|oa[e>>>16&255]<<8|oa[e>>>8&255]<<16|oa[255&e]<<24)>>>32-a}function ha(e){return(4294901760&e?(e&=4294901760,16):0)|(4278255360&e?(e&=4278255360,8):0)|(4042322160&e?(e&=4042322160,4):0)|(3435973836&e?(e&=3435973836,2):0)|!!(2863311530&e)}function ua(e,a){const c=e.byteLength/a,f=ha(c);if(c!=1<c){const f=e.slice(d*a,(d+1)*a);e.set(e.slice(c*a,(c+1)*a),d*a),e.set(f,c*a)}}}function xa(e,a){const c=new Uint8Array(a*e.length);for(let f=0;f0;)c>=4?(c-=4,a+=BigInt(d.getUint32(c))<=2?(c-=2,a+=BigInt(d.getUint16(c))<0;)b-4>=0?(b-=4,d.setUint32(b,Number(c&BigInt(4294967295))),c>>=BigInt(32)):b-2>=0?(b-=2,d.setUint16(b,Number(c&BigInt(65535))),c>>=BigInt(16)):(b-=1,d.setUint8(b,Number(c&BigInt(255))),c>>=BigInt(8));if(c)throw new Error("Number does not fit in this length");return f},bitReverse:la,buffReverseBits:ua,buffer2array:pa,leBuff2int:function(e){let a=BigInt(0),c=0;const f=new DataView(e.buffer,e.byteOffset,e.byteLength);for(;c{c[f]=e(a[f])})),c}return a},stringifyFElements:function e(a,c){if("bigint"==typeof c||void 0!==c.eq)return c.toString(10);if(c instanceof Uint8Array)return a.toString(a.e(c));if(Array.isArray(c))return c.map(e.bind(this,a));if("object"==typeof c){const f={};return Object.keys(c).forEach((d=>{f[d]=e(a,c[d])})),f}return c},unstringifyBigInts:function e(a){if("string"==typeof a&&/^[0-9]+$/.test(a))return BigInt(a);if("string"==typeof a&&/^0x[0-9a-fA-F]+$/.test(a))return BigInt(a);if(Array.isArray(a))return a.map(e);if("object"==typeof a){if(null===a)return null;const c={};return Object.keys(a).forEach((f=>{c[f]=e(a[f])})),c}return a},unstringifyFElements:function e(a,c){if("string"==typeof c&&/^[0-9]+$/.test(c))return a.e(c);if("string"==typeof c&&/^0x[0-9a-fA-F]+$/.test(c))return a.e(c);if(Array.isArray(c))return c.map(e.bind(this,a));if("object"==typeof c){if(null===c)return null;const f={};return Object.keys(c).forEach((d=>{f[d]=e(a,c[d])})),f}return c}});const ma=1<<30;class ya{constructor(e){this.buffers=[],this.byteLength=e;for(let a=0;a0;){const e=t+i>ma?ma-t:i,a=new Uint8Array(this.buffers[b].buffer,this.buffers[b].byteOffset+t,e);if(e==c)return a.slice();d||(d=c<=ma?new Uint8Array(c):new ya(c)),d.set(a,c-i),i-=e,b++,t=0}return d}set(e,a){void 0===a&&(a=0);const c=e.byteLength;if(0==c)return;const f=Math.floor(a/ma);if(f==Math.floor((a+c-1)/ma))return e instanceof ya&&1==e.buffers.length?this.buffers[f].set(e.buffers[0],a%ma):this.buffers[f].set(e,a%ma);let d=f,b=a%ma,t=c;for(;t>0;){const a=b+t>ma?ma-b:t,f=e.slice(c-t,c-t+a);new Uint8Array(this.buffers[d].buffer,this.buffers[d].byteOffset+b,a).set(f),t-=a,d++,b=0}}}function _a(e,a,c,f){return async function(d){const b=Math.floor(d.byteLength/c);if(b*c!==d.byteLength)throw new Error("Invalid buffer size");const t=Math.floor(b/e.concurrency),i=[];for(let r=0;r=0;e--)this.w[e]=this.square(this.w[e+1]);if(!this.eq(this.w[0],this.one))throw new Error("Error calculating roots of unity");this.batchToMontgomery=_a(e,a+"_batchToMontgomery",this.n8,this.n8),this.batchFromMontgomery=_a(e,a+"_batchFromMontgomery",this.n8,this.n8)}op2(e,a,c){return this.tm.setBuff(this.pOp1,a),this.tm.setBuff(this.pOp2,c),this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op2Bool(e,a,c){return this.tm.setBuff(this.pOp1,a),this.tm.setBuff(this.pOp2,c),!!this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp2)}op1(e,a){return this.tm.setBuff(this.pOp1,a),this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op1Bool(e,a){return this.tm.setBuff(this.pOp1,a),!!this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp3)}add(e,a){return this.op2("_add",e,a)}eq(e,a){return this.op2Bool("_eq",e,a)}isZero(e){return this.op1Bool("_isZero",e)}sub(e,a){return this.op2("_sub",e,a)}neg(e){return this.op1("_neg",e)}inv(e){return this.op1("_inverse",e)}toMontgomery(e){return this.op1("_toMontgomery",e)}fromMontgomery(e){return this.op1("_fromMontgomery",e)}mul(e,a){return this.op2("_mul",e,a)}div(e,a){return this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,a),this.tm.instance.exports[this.prefix+"_inverse"](this.pOp2,this.pOp2),this.tm.instance.exports[this.prefix+"_mul"](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}square(e){return this.op1("_square",e)}isSquare(e){return this.op1Bool("_isSquare",e)}sqrt(e){return this.op1("_sqrt",e)}exp(e,a){return a instanceof Uint8Array||(a=L(b(a))),this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,a),this.tm.instance.exports[this.prefix+"_exp"](this.pOp1,this.pOp2,a.byteLength,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}isNegative(e){return this.op1Bool("_isNegative",e)}e(e,a){if(e instanceof Uint8Array)return e;let c=b(e,a);i(c)?(c=p(c),y(c,this.p)&&(c=m(c,this.p)),c=x(this.p,c)):y(c,this.p)&&(c=m(c,this.p));const f=na(c,this.n8);return this.toMontgomery(f)}toString(e,a){return A(M(this.fromMontgomery(e),0),a)}fromRng(e){let a;const c=new Uint8Array(this.n8);do{a=I;for(let c=0;c{this.reject=a,this.resolve=e}))}}const ka="data:application/javascript;base64,"+globalThis.btoa('(function thread(self) {\n const MAXMEM = 32767;\n let instance;\n let memory;\n\n if (self) {\n self.onmessage = function(e) {\n let data;\n if (e.data) {\n data = e.data;\n } else {\n data = e;\n }\n\n if (data[0].cmd == "INIT") {\n init(data[0]).then(function() {\n self.postMessage(data.result);\n });\n } else if (data[0].cmd == "TERMINATE") {\n self.close();\n } else {\n const res = runTask(data);\n self.postMessage(res);\n }\n };\n }\n\n async function init(data) {\n const code = new Uint8Array(data.code);\n const wasmModule = await WebAssembly.compile(code);\n memory = new WebAssembly.Memory({initial:data.init, maximum: MAXMEM});\n\n instance = await WebAssembly.instantiate(wasmModule, {\n env: {\n "memory": memory\n }\n });\n }\n\n\n\n function alloc(length) {\n const u32 = new Uint32Array(memory.buffer, 0, 1);\n while (u32[0] & 3) u32[0]++; // Return always aligned pointers\n const res = u32[0];\n u32[0] += length;\n if (u32[0] + length > memory.buffer.byteLength) {\n const currentPages = memory.buffer.byteLength / 0x10000;\n let requiredPages = Math.floor((u32[0] + length) / 0x10000)+1;\n if (requiredPages>MAXMEM) requiredPages=MAXMEM;\n memory.grow(requiredPages-currentPages);\n }\n return res;\n }\n\n function allocBuffer(buffer) {\n const p = alloc(buffer.byteLength);\n setBuffer(p, buffer);\n return p;\n }\n\n function getBuffer(pointer, length) {\n const u8 = new Uint8Array(memory.buffer);\n return new Uint8Array(u8.buffer, u8.byteOffset + pointer, length);\n }\n\n function setBuffer(pointer, buffer) {\n const u8 = new Uint8Array(memory.buffer);\n u8.set(new Uint8Array(buffer), pointer);\n }\n\n function runTask(task) {\n if (task[0].cmd == "INIT") {\n return init(task[0]);\n }\n const ctx = {\n vars: [],\n out: []\n };\n const u32a = new Uint32Array(memory.buffer, 0, 1);\n const oldAlloc = u32a[0];\n for (let i=0; i0;e++)if(0==this.working[e]){const a=this.actionQueue.shift();this.postAction(e,a.data,a.transfers,a.deferred)}}queueAction(e,a){const c=new Ia;if(this.singleThread){const a=this.taskManager(e);c.resolve(a)}else this.actionQueue.push({data:e,transfers:a,deferred:c}),this.processWorks();return c.promise}resetMemory(){this.u32[0]=this.initalPFree}allocBuff(e){const a=this.alloc(e.byteLength);return this.setBuff(a,e),a}getBuff(e,a){return this.u8.slice(e,e+a)}setBuff(e,a){this.u8.set(new Uint8Array(a),e)}alloc(e){for(;3&this.u32[0];)this.u32[0]++;const a=this.u32[0];return this.u32[0]+=e,a}async terminate(){for(let e=0;esetTimeout(e,200)))}}function Sa(e,a){const c=e[a],f=e.Fr,d=e.tm;e[a].batchApplyKey=async function(e,b,t,i,r){let n,o,s,l,h;if(i=i||"affine",r=r||"affine","G1"==a)"jacobian"==i?(s=3*c.F.n8,n="g1m_batchApplyKey"):(s=2*c.F.n8,n="g1m_batchApplyKeyMixed"),l=3*c.F.n8,"jacobian"==r?h=3*c.F.n8:(o="g1m_batchToAffine",h=2*c.F.n8);else if("G2"==a)"jacobian"==i?(s=3*c.F.n8,n="g2m_batchApplyKey"):(s=2*c.F.n8,n="g2m_batchApplyKeyMixed"),l=3*c.F.n8,"jacobian"==r?h=3*c.F.n8:(o="g2m_batchToAffine",h=2*c.F.n8);else{if("Fr"!=a)throw new Error("Invalid group: "+a);n="frm_batchApplyKey",s=c.n8,l=c.n8,h=c.n8}const u=Math.floor(e.byteLength/s),x=Math.floor(u/d.concurrency),p=[];t=f.e(t);let g=f.e(b);for(let a=0;a=0;e--){if(!c.isZero(x))for(let e=0;en&&(x=n),x<1024&&(x=1024);const p=[];for(let a=0;a(i&&i.debug(`Multiexp end: ${r}: ${a}/${s}`),e))))}const g=await Promise.all(p);let m=c.zero;for(let e=g.length-1;e>=0;e--)m=c.add(m,g[e]);return m}c.multiExp=async function(e,a,c,f){return await b(e,a,"jacobian",c,f)},c.multiExpAffine=async function(e,a,c,f){return await b(e,a,"affine",c,f)}}function Fa(e,a){const c=e[a],f=e.Fr,d=c.tm;async function b(e,i,r,n,o,s){let l,h,u,x,p,g,m,y;r=r||"affine",n=n||"affine","G1"==a?("affine"==r?(l=2*c.F.n8,x="g1m_batchToJacobian"):l=3*c.F.n8,h=3*c.F.n8,i&&(y="g1m_fftFinal"),m="g1m_fftJoin",g="g1m_fftMix","affine"==n?(u=2*c.F.n8,p="g1m_batchToAffine"):u=3*c.F.n8):"G2"==a?("affine"==r?(l=2*c.F.n8,x="g2m_batchToJacobian"):l=3*c.F.n8,h=3*c.F.n8,i&&(y="g2m_fftFinal"),m="g2m_fftJoin",g="g2m_fftMix","affine"==n?(u=2*c.F.n8,p="g2m_batchToAffine"):u=3*c.F.n8):"Fr"==a&&(l=c.n8,h=c.n8,u=c.n8,i&&(y="frm_fftFinal"),g="frm_fftMix",m="frm_fftJoin");let _=!1;Array.isArray(e)?(e=xa(e,l),_=!0):e=e.slice(0,e.byteLength);const v=e.byteLength/l,w=ha(v);if(1<1<<28?new ya(2*s[0].byteLength):new Uint8Array(2*s[0].byteLength),l.set(s[0]),l.set(s[1],s[0].byteLength),l}(e,r,n,o,s):await async function(e,a,c,d,i){let r,n;r=e.slice(0,e.byteLength/2),n=e.slice(e.byteLength/2,e.byteLength);const o=[];[r,n]=await t(r,n,"fftJoinExt",f.one,f.shift,a,"jacobian",d,i),o.push(b(r,!1,"jacobian",c,d,i)),o.push(b(n,!1,"jacobian",c,d,i));const s=await Promise.all(o);let l;return l=s[0].byteLength>1<<28?new ya(2*s[0].byteLength):new Uint8Array(2*s[0].byteLength),l.set(s[0]),l.set(s[1],s[0].byteLength),l}(e,r,n,o,s),_?pa(a,u):a}let M,A,L;i&&(M=f.inv(f.e(v))),ua(e,l);let I=Math.min(16384,v),k=v/I;for(;k=16;)k*=2,I/=2;const E=ha(I),S=[];for(let a=0;a(o&&o.debug(`${s}: fft ${w} mix end: ${a}/${k}`),e))))}L=await Promise.all(S);for(let e=0;e(o&&o.debug(`${s}: fft ${w} join ${e}/${w} ${t+1}/${a} ${i}/${c/2}`),f))))}const t=await Promise.all(b);for(let e=0;e0;a--)A.set(L[a],e),e+=I*u,delete L[a];A.set(L[0].slice(0,(I-1)*u),e),delete L[0]}else for(let e=0;e65536&&(_=65536);const v=[];for(let a=0;a(s&&s.debug(`${l}: fftJoinExt End: ${a}/${y}`),e))))}const w=await Promise.all(v);let M,A;y*p>1<<28?(M=new ya(y*p),A=new ya(y*p)):(M=new Uint8Array(y*p),A=new Uint8Array(y*p));let L=0;for(let e=0;ef.s+1)throw r&&r.error("lagrangeEvaluations input too big"),new Error("lagrangeEvaluations input too big");let h=e.slice(0,e.byteLength/2),u=e.slice(e.byteLength/2,e.byteLength);const x=f.exp(f.shift,s/2),p=f.inv(f.sub(f.one,x));[h,u]=await t(h,u,"prepareLagrangeEvaluation",p,f.shiftInv,d,"jacobian",r,n+" prep");const g=[];let m;return g.push(b(h,!0,"jacobian",i,r,n+" t0")),g.push(b(u,!0,"jacobian",i,r,n+" t1")),[h,u]=await Promise.all(g),m=h.byteLength>1<<28?new ya(2*h.byteLength):new Uint8Array(2*h.byteLength),m.set(h),m.set(u,h.byteLength),m},c.fftMix=async function(e){const b=3*c.F.n8;let t,i;if("G1"==a)t="g1m_fftMix",i="g1m_fftJoin";else if("G2"==a)t="g2m_fftMix",i="g2m_fftJoin";else{if("Fr"!=a)throw new Error("Invalid group");t="frm_fftMix",i="frm_fftJoin"}const r=Math.floor(e.byteLength/b),n=ha(r);let o=1<=0;e--)h.set(l[e][0],u),u+=l[e][0].byteLength;return h}}async function Oa(e){const a=await async function(e,a){const c=new Ea;c.memory=new WebAssembly.Memory({initial:25}),c.u8=new Uint8Array(c.memory.buffer),c.u32=new Uint32Array(c.memory.buffer);const f=await WebAssembly.compile(e.code);if(c.instance=await WebAssembly.instantiate(f,{env:{memory:c.memory}}),c.singleThread=a,c.initalPFree=c.u32[0],c.pq=e.pq,c.pr=e.pr,c.pG1gen=e.pG1gen,c.pG1zero=e.pG1zero,c.pG2gen=e.pG2gen,c.pG2zero=e.pG2zero,c.pOneT=e.pOneT,a)c.code=e.code,c.taskManager=function(){const e=32767;let a,c;async function f(f){const d=new Uint8Array(f.code),b=await WebAssembly.compile(d);c=new WebAssembly.Memory({initial:f.init,maximum:e}),a=await WebAssembly.instantiate(b,{env:{memory:c}})}function d(a){const f=new Uint32Array(c.buffer,0,1);for(;3&f[0];)f[0]++;const d=f[0];if(f[0]+=a,f[0]+a>c.buffer.byteLength){const d=c.buffer.byteLength/65536;let b=Math.floor((f[0]+a)/65536)+1;b>e&&(b=e),c.grow(b-d)}return d}function b(e){const a=d(e.byteLength);return i(a,e),a}function t(e,a){const f=new Uint8Array(c.buffer);return new Uint8Array(f.buffer,f.byteOffset+e,a)}function i(e,a){new Uint8Array(c.buffer).set(new Uint8Array(a),e)}function r(e){if("INIT"==e[0].cmd)return f(e[0]);const r={vars:[],out:[]},n=new Uint32Array(c.buffer,0,1)[0];for(let c=0;c64&&(a=64),c.concurrency=a;for(let e=0;e>8n&0xFFn)),a.push(Number(c>>16n&0xFFn)),a.push(Number(c>>24n&0xFFn)),a}function ja(e){const a=function(e){for(var a=[],c=0;c>6,128|63&f):f<55296||f>=57344?a.push(224|f>>12,128|f>>6&63,128|63&f):(c++,f=65536+((1023&f)<<10|1023&e.charCodeAt(c)),a.push(240|f>>18,128|f>>12&63,128|f>>6&63,128|63&f))}return a}(e);return[...Qa(a.length),...a]}function Na(e){const a=[];let c=Pa(e);if(Ra(c))throw new Error("Number cannot be negative");for(;!Ta(c);)a.push(Number(0x7Fn&c)),c>>=7n;0==a.length&&a.push(0);for(let e=0;e0xFFFFFFFFn)throw new Error("Number too big");if(a>0x7FFFFFFFn&&(a-=0x100000000n),a<-2147483648n)throw new Error("Number too small");return qa(a)}function za(e){let a=Pa(e);if(a>0xFFFFFFFFFFFFFFFFn)throw new Error("Number too big");if(a>0x7FFFFFFFFFFFFFFFn&&(a-=0x10000000000000000n),a<-9223372036854775808n)throw new Error("Number too small");return qa(a)}function Qa(e){let a=Pa(e);if(a>0xFFFFFFFFn)throw new Error("Number too big");return Na(a)}function Ga(e){return Array.from(e,(function(e){return("0"+(255&e).toString(16)).slice(-2)})).join("")}class Ka{constructor(e){this.func=e,this.functionName=e.functionName,this.module=e.module}setLocal(e,a){const c=this.func.localIdxByName[e];if(void 0===c)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${e} `);return[...a,33,...Qa(c)]}teeLocal(e,a){const c=this.func.localIdxByName[e];if(void 0===c)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${e} `);return[...a,34,...Qa(c)]}getLocal(e){const a=this.func.localIdxByName[e];if(void 0===a)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${e} `);return[32,...Qa(a)]}i64_load8_s(e,a,c){return[...e,48,void 0===c?0:c,...Qa(a||0)]}i64_load8_u(e,a,c){return[...e,49,void 0===c?0:c,...Qa(a||0)]}i64_load16_s(e,a,c){return[...e,50,void 0===c?1:c,...Qa(a||0)]}i64_load16_u(e,a,c){return[...e,51,void 0===c?1:c,...Qa(a||0)]}i64_load32_s(e,a,c){return[...e,52,void 0===c?2:c,...Qa(a||0)]}i64_load32_u(e,a,c){return[...e,53,void 0===c?2:c,...Qa(a||0)]}i64_load(e,a,c){return[...e,41,void 0===c?3:c,...Qa(a||0)]}i64_store(e,a,c,f){let d,b,t;return Array.isArray(a)?(d=0,b=3,t=a):Array.isArray(c)?(d=a,b=3,t=c):Array.isArray(f)&&(d=a,b=c,t=f),[...e,...t,55,b,...Qa(d)]}i64_store32(e,a,c,f){let d,b,t;return Array.isArray(a)?(d=0,b=2,t=a):Array.isArray(c)?(d=a,b=2,t=c):Array.isArray(f)&&(d=a,b=c,t=f),[...e,...t,62,b,...Qa(d)]}i64_store16(e,a,c,f){let d,b,t;return Array.isArray(a)?(d=0,b=1,t=a):Array.isArray(c)?(d=a,b=1,t=c):Array.isArray(f)&&(d=a,b=c,t=f),[...e,...t,61,b,...Qa(d)]}i64_store8(e,a,c,f){let d,b,t;return Array.isArray(a)?(d=0,b=0,t=a):Array.isArray(c)?(d=a,b=0,t=c):Array.isArray(f)&&(d=a,b=c,t=f),[...e,...t,60,b,...Qa(d)]}i32_load8_s(e,a,c){return[...e,44,void 0===c?0:c,...Qa(a||0)]}i32_load8_u(e,a,c){return[...e,45,void 0===c?0:c,...Qa(a||0)]}i32_load16_s(e,a,c){return[...e,46,void 0===c?1:c,...Qa(a||0)]}i32_load16_u(e,a,c){return[...e,47,void 0===c?1:c,...Qa(a||0)]}i32_load(e,a,c){return[...e,40,void 0===c?2:c,...Qa(a||0)]}i32_store(e,a,c,f){let d,b,t;return Array.isArray(a)?(d=0,b=2,t=a):Array.isArray(c)?(d=a,b=2,t=c):Array.isArray(f)&&(d=a,b=c,t=f),[...e,...t,54,b,...Qa(d)]}i32_store16(e,a,c,f){let d,b,t;return Array.isArray(a)?(d=0,b=1,t=a):Array.isArray(c)?(d=a,b=1,t=c):Array.isArray(f)&&(d=a,b=c,t=f),[...e,...t,59,b,...Qa(d)]}i32_store8(e,a,c,f){let d,b,t;return Array.isArray(a)?(d=0,b=0,t=a):Array.isArray(c)?(d=a,b=0,t=c):Array.isArray(f)&&(d=a,b=c,t=f),[...e,...t,58,b,...Qa(d)]}call(e,...a){const c=this.module.functionIdxByName[e];if(void 0===c)throw new Error(`Function not defined: Function: ${e}`);return[...[].concat(...a),16,...Qa(c)]}call_indirect(e,...a){return[...[].concat(...a),...e,17,0,0]}if(e,a,c){return c?[...e,4,64,...a,5,...c,11]:[...e,4,64,...a,11]}block(e){return[2,64,...e,11]}loop(...e){return[3,64,...[].concat(...e),11]}br_if(e,a){return[...a,13,...Qa(e)]}br(e){return[12,...Qa(e)]}ret(e){return[...e,15]}drop(e){return[...e,26]}i64_const(e){return[66,...za(e)]}i32_const(e){return[65,...Da(e)]}i64_eqz(e){return[...e,80]}i64_eq(e,a){return[...e,...a,81]}i64_ne(e,a){return[...e,...a,82]}i64_lt_s(e,a){return[...e,...a,83]}i64_lt_u(e,a){return[...e,...a,84]}i64_gt_s(e,a){return[...e,...a,85]}i64_gt_u(e,a){return[...e,...a,86]}i64_le_s(e,a){return[...e,...a,87]}i64_le_u(e,a){return[...e,...a,88]}i64_ge_s(e,a){return[...e,...a,89]}i64_ge_u(e,a){return[...e,...a,90]}i64_add(e,a){return[...e,...a,124]}i64_sub(e,a){return[...e,...a,125]}i64_mul(e,a){return[...e,...a,126]}i64_div_s(e,a){return[...e,...a,127]}i64_div_u(e,a){return[...e,...a,128]}i64_rem_s(e,a){return[...e,...a,129]}i64_rem_u(e,a){return[...e,...a,130]}i64_and(e,a){return[...e,...a,131]}i64_or(e,a){return[...e,...a,132]}i64_xor(e,a){return[...e,...a,133]}i64_shl(e,a){return[...e,...a,134]}i64_shr_s(e,a){return[...e,...a,135]}i64_shr_u(e,a){return[...e,...a,136]}i64_extend_i32_s(e){return[...e,172]}i64_extend_i32_u(e){return[...e,173]}i64_clz(e){return[...e,121]}i64_ctz(e){return[...e,122]}i32_eqz(e){return[...e,69]}i32_eq(e,a){return[...e,...a,70]}i32_ne(e,a){return[...e,...a,71]}i32_lt_s(e,a){return[...e,...a,72]}i32_lt_u(e,a){return[...e,...a,73]}i32_gt_s(e,a){return[...e,...a,74]}i32_gt_u(e,a){return[...e,...a,75]}i32_le_s(e,a){return[...e,...a,76]}i32_le_u(e,a){return[...e,...a,77]}i32_ge_s(e,a){return[...e,...a,78]}i32_ge_u(e,a){return[...e,...a,79]}i32_add(e,a){return[...e,...a,106]}i32_sub(e,a){return[...e,...a,107]}i32_mul(e,a){return[...e,...a,108]}i32_div_s(e,a){return[...e,...a,109]}i32_div_u(e,a){return[...e,...a,110]}i32_rem_s(e,a){return[...e,...a,111]}i32_rem_u(e,a){return[...e,...a,112]}i32_and(e,a){return[...e,...a,113]}i32_or(e,a){return[...e,...a,114]}i32_xor(e,a){return[...e,...a,115]}i32_shl(e,a){return[...e,...a,116]}i32_shr_s(e,a){return[...e,...a,117]}i32_shr_u(e,a){return[...e,...a,118]}i32_rotl(e,a){return[...e,...a,119]}i32_rotr(e,a){return[...e,...a,120]}i32_wrap_i64(e){return[...e,167]}i32_clz(e){return[...e,103]}i32_ctz(e){return[...e,104]}unreachable(){return[0]}current_memory(){return[63,0]}comment(){return[]}}const Ha={i32:127,i64:126,f32:125,f64:124,anyfunc:112,func:96,emptyblock:64};class Va{constructor(e,a,c,f,d){if("import"==c)this.fnType="import",this.moduleName=f,this.fieldName=d;else{if("internal"!=c)throw new Error("Invalid function fnType: "+c);this.fnType="internal"}this.module=e,this.fnName=a,this.params=[],this.locals=[],this.localIdxByName={},this.code=[],this.returnType=null,this.nextLocal=0}addParam(e,a){if(this.localIdxByName[e])throw new Error(`param already exists. Function: ${this.fnName}, Param: ${e} `);const c=this.nextLocal++;this.localIdxByName[e]=c,this.params.push({type:a})}addLocal(e,a,c){const f=c||1;if(this.localIdxByName[e])throw new Error(`local already exists. Function: ${this.fnName}, Param: ${e} `);const d=this.nextLocal++;this.localIdxByName[e]=d,this.locals.push({type:a,length:f})}setReturnType(e){if(this.returnType)throw new Error(`returnType already defined. Function: ${this.fnName}`);this.returnType=e}getSignature(){return[96,...Qa(this.params.length),...this.params.map((e=>Ha[e.type])),...this.returnType?[1,Ha[this.returnType]]:[0]]}getBody(){const e=this.locals.map((e=>[...Qa(e.length),Ha[e.type]])),a=[...Qa(this.locals.length),...[].concat(...e),...this.code,11];return[...Qa(a.length),...a]}addCode(...e){this.code.push(...[].concat(...e))}getCodeBuilder(){return new Ka(this)}}class Za{constructor(){this.functions=[],this.functionIdxByName={},this.nImportFunctions=0,this.nInternalFunctions=0,this.memory={pagesSize:1,moduleName:"env",fieldName:"memory"},this.free=8,this.datas=[],this.modules={},this.exports=[],this.functionsTable=[]}build(){return this._setSignatures(),new Uint8Array([...Ua(1836278016),...Ua(1),...this._buildType(),...this._buildImport(),...this._buildFunctionDeclarations(),...this._buildFunctionsTable(),...this._buildExports(),...this._buildElements(),...this._buildCode(),...this._buildData()])}addFunction(e){if(void 0!==this.functionIdxByName[e])throw new Error(`Function already defined: ${e}`);const a=this.functions.length;return this.functionIdxByName[e]=a,this.functions.push(new Va(this,e,"internal")),this.nInternalFunctions++,this.functions[a]}addIimportFunction(e,a,c){if(void 0!==this.functionIdxByName[e])throw new Error(`Function already defined: ${e}`);if(this.functions.length>0&&"internal"==this.functions[this.functions.length-1].type)throw new Error(`Import functions must be declared before internal: ${e}`);let f=c||e;const d=this.functions.length;return this.functionIdxByName[e]=d,this.functions.push(new Va(this,e,"import",a,f)),this.nImportFunctions++,this.functions[d]}setMemory(e,a,c){this.memory={pagesSize:e,moduleName:a||"env",fieldName:c||"memory"}}exportFunction(e,a){const c=a||e;if(void 0===this.functionIdxByName[e])throw new Error(`Function not defined: ${e}`);const f=this.functionIdxByName[e];c!=e&&(this.functionIdxByName[c]=f),this.exports.push({exportName:c,idx:f})}addFunctionToTable(e){const a=this.functionIdxByName[e];this.functionsTable.push(a)}addData(e,a){this.datas.push({offset:e,bytes:a})}alloc(e,a){let c,f;(Array.isArray(e)||ArrayBuffer.isView(e))&&void 0===a?(c=e.length,f=e):(c=e,f=a),c=1+(c-1>>3)<<3;const d=this.free;return this.free+=c,f&&this.addData(d,f),d}allocString(e){const a=(new globalThis.TextEncoder).encode(e);return this.alloc([...a,0])}_setSignatures(){this.signatures=[];const e={};if(this.functionsTable.length>0){const a=this.functions[this.functionsTable[0]].getSignature();e["s_"+Ga(a)]=0,this.signatures.push(a)}for(let a=0;a{try{if("test"!=="test".normalize(a))throw new Error("bad normalize")}catch(c){e.push(a)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var bc,tc;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(bc||(bc={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(tc||(tc={}));const ic="0123456789abcdef";class rc{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,a){const c=e.toLowerCase();null==ac[c]&&this.throwArgumentError("invalid log level name","logLevel",e),cc>ac[c]||console.log.apply(console,a)}debug(...e){this._log(rc.levels.DEBUG,e)}info(...e){this._log(rc.levels.INFO,e)}warn(...e){this._log(rc.levels.WARNING,e)}makeError(e,a,c){if(ec)return this.makeError("censored error",a,{});a||(a=rc.errors.UNKNOWN_ERROR),c||(c={});const f=[];Object.keys(c).forEach((e=>{const a=c[e];try{if(a instanceof Uint8Array){let c="";for(let e=0;e>4],c+=ic[15&a[e]];f.push(e+"=Uint8Array(0x"+c+")")}else f.push(e+"="+JSON.stringify(a))}catch(a){f.push(e+"="+JSON.stringify(c[e].toString()))}})),f.push(`code=${a}`),f.push(`version=${this.version}`);const d=e;let b="";switch(a){case tc.NUMERIC_FAULT:{b="NUMERIC_FAULT";const a=e;switch(a){case"overflow":case"underflow":case"division-by-zero":b+="-"+a;break;case"negative-power":case"negative-width":b+="-unsupported";break;case"unbound-bitwise-result":b+="-unbound-result"}break}case tc.CALL_EXCEPTION:case tc.INSUFFICIENT_FUNDS:case tc.MISSING_NEW:case tc.NONCE_EXPIRED:case tc.REPLACEMENT_UNDERPRICED:case tc.TRANSACTION_REPLACED:case tc.UNPREDICTABLE_GAS_LIMIT:b=a}b&&(e+=" [ See: https://links.ethers.org/v5-errors-"+b+" ]"),f.length&&(e+=" ("+f.join(", ")+")");const t=new Error(e);return t.reason=d,t.code=a,Object.keys(c).forEach((function(e){t[e]=c[e]})),t}throwError(e,a,c){throw this.makeError(e,a,c)}throwArgumentError(e,a,c){return this.throwError(e,rc.errors.INVALID_ARGUMENT,{argument:a,value:c})}assert(e,a,c,f){e||this.throwError(a,c,f)}assertArgument(e,a,c,f){e||this.throwArgumentError(a,c,f)}checkNormalize(e){null==e&&(e="platform missing String.prototype.normalize"),dc&&this.throwError("platform missing String.prototype.normalize",rc.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:dc})}checkSafeUint53(e,a){"number"==typeof e&&(null==a&&(a="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(a,rc.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(a,rc.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,a,c){c=c?": "+c:"",ea&&this.throwError("too many arguments"+c,rc.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:a})}checkNew(e,a){e!==Object&&null!=e||this.throwError("missing new",rc.errors.MISSING_NEW,{name:a.name})}checkAbstract(e,a){e===a?this.throwError("cannot instantiate abstract class "+JSON.stringify(a.name)+" directly; use a sub-class",rc.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",rc.errors.MISSING_NEW,{name:a.name})}static globalLogger(){return fc||(fc=new rc("logger/5.7.0")),fc}static setCensorship(e,a){if(!e&&a&&this.globalLogger().throwError("cannot permanently disable censorship",rc.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Xa){if(!e)return;this.globalLogger().throwError("error censorship permanent",rc.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ec=!!e,Xa=!!a}static setLogLevel(e){const a=ac[e.toLowerCase()];null!=a?cc=a:rc.globalLogger().warn("invalid log level - "+e)}static from(e){return new rc(e)}}rc.errors=tc,rc.levels=bc;const nc=new rc("bytes/5.7.0");function oc(e){return e.slice||(e.slice=function(){const a=Array.prototype.slice.call(arguments);return oc(new Uint8Array(Array.prototype.slice.apply(e,a)))}),e}function sc(e){return"number"==typeof e&&e==e&&e%1==0}function lc(e,a){if(a||(a={}),"number"==typeof e){nc.checkSafeUint53(e,"invalid arrayify value");const a=[];for(;e;)a.unshift(255&e),e=parseInt(String(e/256));return 0===a.length&&a.push(0),oc(new Uint8Array(a))}if(a.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),function(e){return!!e.toHexString}(e)&&(e=e.toHexString()),function(e,a){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/)||a&&e.length!==2+2*a)}(e)){let c=e.substring(2);c.length%2&&("left"===a.hexPad?c="0"+c:"right"===a.hexPad?c+="0":nc.throwArgumentError("hex data is odd-length","value",e));const f=[];for(let e=0;e=256)return!1}return!0}(e)?oc(new Uint8Array(e)):nc.throwArgumentError("invalid arrayify value","value",e)}function hc(e){return"0x"+$a().keccak_256(lc(e))}const uc=new rc("strings/5.7.0");var xc,pc;function gc(e,a,c,f,d){if(e===pc.BAD_PREFIX||e===pc.UNEXPECTED_CONTINUE){let e=0;for(let f=a+1;f>6==2;f++)e++;return e}return e===pc.OVERRUN?c.length-a-1:0}function mc(e,a=xc.current){a!=xc.current&&(uc.checkNormalize(),e=e.normalize(a));let c=[];for(let a=0;a>6|192),c.push(63&f|128);else if(55296==(64512&f)){a++;const d=e.charCodeAt(a);if(a>=e.length||56320!=(64512&d))throw new Error("invalid utf-8 string");const b=65536+((1023&f)<<10)+(1023&d);c.push(b>>18|240),c.push(b>>12&63|128),c.push(b>>6&63|128),c.push(63&b|128)}else c.push(f>>12|224),c.push(f>>6&63|128),c.push(63&f|128)}return lc(c)}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(xc||(xc={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(pc||(pc={})),Object.freeze({error:function(e,a,c,f,d){return uc.throwArgumentError(`invalid codepoint at offset ${a}; ${e}`,"bytes",c)},ignore:gc,replace:function(e,a,c,f,d){return e===pc.OVERLONG?(f.push(d),0):(f.push(65533),gc(e,a,c))}});const yc="mimcsponge";async function _c(){const e=await async function(e,a,c){let f;const d=e.toUpperCase().match(/[A-Za-z0-9]+/g).join("");if(["BN128","BN254","ALTBN128"].indexOf(d)>=0)f=await async function(e,a){if(!e&&globalThis.curve_bn128)return globalThis.curve_bn128;const c=new Za;c.setMemory(25),ia(c),a&&a(c);const f={};f.code=c.build(),f.pq=c.modules.f1m.pq,f.pr=c.modules.frm.pq,f.pG1gen=c.modules.bn128.pG1gen,f.pG1zero=c.modules.bn128.pG1zero,f.pG1b=c.modules.bn128.pG1b,f.pG2gen=c.modules.bn128.pG2gen,f.pG2zero=c.modules.bn128.pG2zero,f.pG2b=c.modules.bn128.pG2b,f.pOneT=c.modules.bn128.pOneT,f.prePSize=c.modules.bn128.prePSize,f.preQSize=c.modules.bn128.preQSize,f.n8q=32,f.n8r=32,f.q=c.modules.bn128.q,f.r=c.modules.bn128.r;const d={name:"bn128",wasm:f,q:b("21888242871839275222246405745257275088696311157297823662689037894645226208583"),r:b("21888242871839275222246405745257275088548364400416034343698204186575808495617"),n8q:32,n8r:32,cofactorG2:b("30644e72e131a029b85045b68181585e06ceecda572a2489345f2299c0f9fa8d",16),singleThread:!!e},t=await Oa(d);return t.terminate=async function(){d.singleThread||(globalThis.curve_bn128=null,await this.tm.terminate())},e||(globalThis.curve_bn128=t),t}(a,c);else{if(!(["BLS12381"].indexOf(d)>=0))throw new Error(`Curve not supported: ${e}`);f=await async function(e,a){if(!e&&globalThis.curve_bls12381)return globalThis.curve_bls12381;const c=new Za;c.setMemory(25),ra(c),a&&a(c);const f={};f.code=c.build(),f.pq=c.modules.f1m.pq,f.pr=c.modules.frm.pq,f.pG1gen=c.modules.bls12381.pG1gen,f.pG1zero=c.modules.bls12381.pG1zero,f.pG1b=c.modules.bls12381.pG1b,f.pG2gen=c.modules.bls12381.pG2gen,f.pG2zero=c.modules.bls12381.pG2zero,f.pG2b=c.modules.bls12381.pG2b,f.pOneT=c.modules.bls12381.pOneT,f.prePSize=c.modules.bls12381.prePSize,f.preQSize=c.modules.bls12381.preQSize,f.n8q=48,f.n8r=32,f.q=c.modules.bls12381.q,f.r=c.modules.bls12381.r;const d={name:"bls12381",wasm:f,q:b("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab",16),r:b("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001",16),n8q:48,n8r:32,cofactorG1:b("0x396c8c005555e1568c00aaab0000aaab",16),cofactorG2:b("0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5",16),singleThread:!!e},t=await Oa(d);return t.terminate=async function(){d.singleThread||(globalThis.curve_bls12381=null,await this.tm.terminate())},e||(globalThis.curve_bls12381=t),t}(a,c)}return f}("bn128",!0);return new vc(e.Fr)}class vc{constructor(e){this.F=e,this.cts=this.getConstants(yc,220)}getIV(e){const a=this.F;void 0===e&&(e=yc);const c=hc(mc(e+"_iv"));return Wa.e(c).mod(a.p)}getConstants(e,a){const c=this.F;void 0===e&&(e=yc),void 0===a&&(a=220);const f=new Array(a);let d=hc(mc(yc));for(let e=1;ethis.sponge?.F.toString(this.sponge?.multiHash([BigInt(e),BigInt(a)]))}async getHash(){return await this.mimcPromise,{sponge:this.sponge,hash:this.hash}}};var Ic=__webpack_require__(1565);__webpack_require__(9404),__webpack_require__(1810),BigInt.prototype.toJSON=function(){return this.toString()};const kc=!process.browser&&void 0===globalThis.window;if(kc?Ic.webcrypto:globalThis.crypto,kc&&a())!async function(){const{hash:e}=await Lc.getHash(),{merkleTreeHeight:f,edge:d,elements:b,zeroElement:t}=a().workerData;if(d){const i=new c.PartialMerkleTree(f,d,b,{zeroElement:t,hashFunction:e});return void a().parentPort.postMessage(i.toString())}const i=new c.MerkleTree(f,b,{zeroElement:t,hashFunction:e});a().parentPort.postMessage(i.toString())}();else{if(kc||"function"!=typeof addEventListener||"function"!=typeof postMessage)throw new Error("This browser / environment does not support workers!");addEventListener("message",(async e=>{let a;a=e.data?e.data:e;const{hash:f}=await Lc.getHash(),{merkleTreeHeight:d,edge:b,elements:t,zeroElement:i}=a;if(b){const e=new c.PartialMerkleTree(d,b,t,{zeroElement:i,hashFunction:f});return void postMessage(e.toString())}const r=new c.MerkleTree(d,t,{zeroElement:i,hashFunction:f});postMessage(r.toString())}))}})(),__webpack_exports__})())); \ No newline at end of file diff --git a/dist/merkleTreeWorker.umd.min.js.LICENSE.txt b/dist/merkleTreeWorker.umd.min.js.LICENSE.txt new file mode 100644 index 0000000..0db3006 --- /dev/null +++ b/dist/merkleTreeWorker.umd.min.js.LICENSE.txt @@ -0,0 +1,26 @@ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ + +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ + +/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ + +/*! safe-buffer. MIT License. Feross Aboukhadijeh */ + +/** + * [js-sha3]{@link https://github.com/emn178/js-sha3} + * + * @version 0.8.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2015-2018 + * @license MIT + */ diff --git a/dist/networkConfig.d.ts b/dist/networkConfig.d.ts index 51b4503..2f8b990 100644 --- a/dist/networkConfig.d.ts +++ b/dist/networkConfig.d.ts @@ -1,3 +1,4 @@ +import type { DepositType } from './deposits'; /** * Type of default supported networks */ @@ -16,19 +17,19 @@ export interface RpcUrl { name: string; url: string; } -export type RpcUrls = { - [key in string]: RpcUrl; -}; +export interface RpcUrls { + [key: string]: RpcUrl; +} export interface SubgraphUrl { name: string; url: string; } -export type SubgraphUrls = { - [key in string]: SubgraphUrl; -}; -export type TornadoInstance = { +export interface SubgraphUrls { + [key: string]: SubgraphUrl; +} +export interface TornadoInstance { instanceAddress: { - [key in string]: string; + [key: string]: string; }; optionalInstances?: string[]; tokenAddress?: string; @@ -36,11 +37,11 @@ export type TornadoInstance = { symbol: string; decimals: number; gasLimit?: number; -}; -export type TokenInstances = { - [key in string]: TornadoInstance; -}; -export type Config = { +} +export interface TokenInstances { + [key: string]: TornadoInstance; +} +export interface Config { rpcCallRetryAttempt?: number; gasPrices: { instant: number; @@ -57,6 +58,7 @@ export type Config = { networkName: string; deployedBlock: number; rpcUrls: RpcUrls; + stablecoin: string; multicallContract: string; routerContract: string; echoContract: string; @@ -67,8 +69,6 @@ export type Config = { registryContract?: string; aggregatorContract?: string; reverseRecordsContract?: string; - gasPriceOracleContract?: string; - gasStationApi?: string; ovmGasPriceOracleContract?: string; tornadoSubgraph: string; registrySubgraph?: string; @@ -76,6 +76,7 @@ export type Config = { subgraphs: SubgraphUrls; tokens: TokenInstances; optionalTokens?: string[]; + disabledTokens?: string[]; relayerEnsSubdomain: string; pollInterval: number; constants: { @@ -85,12 +86,15 @@ export type Config = { REGISTRY_BLOCK?: number; MINING_BLOCK_TIME?: number; }; -}; -export type networkConfig = { - [key in NetIdType]: Config; -}; +} +export interface networkConfig { + [key: NetIdType]: Config; +} +export interface SubdomainMap { + [key: NetIdType]: string; +} export declare const defaultConfig: networkConfig; -export declare const enabledChains: number[]; +export declare const enabledChains: NetIdType[]; /** * Custom config object to extend default config * @@ -106,11 +110,16 @@ export declare let customConfig: networkConfig; export declare function addNetwork(newConfig: networkConfig): void; export declare function getNetworkConfig(): networkConfig; export declare function getConfig(netId: NetIdType): Config; -export declare function getInstanceByAddress({ netId, address }: { - netId: NetIdType; - address: string; -}): { +export declare function getActiveTokens(config: Config): string[]; +export declare function getActiveTokenInstances(config: Config): TokenInstances; +export declare function getInstanceByAddress(config: Config, address: string): { amount: string; currency: string; + symbol: string; + decimals: number; + tokenAddress: string | undefined; } | undefined; -export declare function getSubdomains(): string[]; +export declare function getRelayerEnsSubdomains(): SubdomainMap; +export declare function getMultiInstances(netId: NetIdType, config: Config): { + [key in string]: DepositType; +}; diff --git a/dist/permit.d.ts b/dist/permit.d.ts new file mode 100644 index 0000000..cf54165 --- /dev/null +++ b/dist/permit.d.ts @@ -0,0 +1,86 @@ +import { ERC20Permit, ERC20Mock, TORN, PermitTornado } from '@tornado/contracts'; +import { BaseContract, Signature, Signer, TypedDataField } from 'ethers'; +export interface PermitValue { + spender: string; + value: bigint; + nonce?: bigint; + deadline?: bigint; +} +export interface PermitCommitments { + denomination: bigint; + commitments: string[]; + nonce?: bigint; + deadline?: bigint; +} +export declare const permit2Address = "0x000000000022D473030F116dDEE9F6B43aC78BA3"; +/** + * From @uniswap/permit2-sdk ported for ethers.js v6 + */ +export interface Witness { + witnessTypeName: string; + witnessType: { + [key: string]: TypedDataField[]; + }; + witness: any; +} +export declare function getPermitSignature({ Token, signer, spender, value, nonce, deadline, }: PermitValue & { + Token: ERC20Permit | ERC20Mock | TORN; + signer?: Signer; +}): Promise; +export declare function getPermitCommitmentsSignature({ PermitTornado, Token, signer, denomination, commitments, nonce, }: PermitCommitments & { + PermitTornado: PermitTornado; + Token: ERC20Permit | ERC20Mock | TORN; + signer?: Signer; +}): Promise; +export declare function getPermit2Signature({ Token, signer, spender, value: amount, nonce, deadline, witness, }: PermitValue & { + Token: BaseContract; + signer?: Signer; + witness?: Witness; +}): Promise<{ + domain: { + name: string; + chainId: bigint; + verifyingContract: string; + }; + types: { + [key: string]: TypedDataField[]; + }; + values: { + permitted: { + token: string; + amount: bigint; + }; + spender: string; + nonce: bigint; + deadline: bigint; + witness?: any; + }; + hash: string; + signature: Signature; +}>; +export declare function getPermit2CommitmentsSignature({ PermitTornado, Token, signer, denomination, commitments, nonce, deadline, }: PermitCommitments & { + PermitTornado: PermitTornado; + Token: BaseContract; + signer?: Signer; +}): Promise<{ + domain: { + name: string; + chainId: bigint; + verifyingContract: string; + }; + types: { + [key: string]: TypedDataField[]; + }; + values: { + permitted: { + token: string; + amount: bigint; + }; + spender: string; + nonce: bigint; + deadline: bigint; + witness?: any; + }; + hash: string; + signature: Signature; +}>; diff --git a/dist/prices.d.ts b/dist/prices.d.ts index 021a3aa..a3fbe2a 100644 --- a/dist/prices.d.ts +++ b/dist/prices.d.ts @@ -1,12 +1,21 @@ import { type Provider } from 'ethers'; -import type { OffchainOracle, Multicall } from './typechain'; +import { OffchainOracle, Multicall } from './typechain'; +import { Call3 } from './multicall'; export declare class TokenPriceOracle { oracle?: OffchainOracle; multicall: Multicall; provider: Provider; + fallbackPrice: bigint; constructor(provider: Provider, multicall: Multicall, oracle?: OffchainOracle); + buildCalls(tokens: { + tokenAddress: string; + decimals: number; + }[]): Call3[]; + buildStable(stablecoinAddress: string): Call3[]; + fetchPrice(tokenAddress: string, decimals: number): Promise; fetchPrices(tokens: { tokenAddress: string; decimals: number; }[]): Promise; + fetchEthUSD(stablecoinAddress: string): Promise; } diff --git a/dist/providers.d.ts b/dist/providers.d.ts index d85ddd1..97d645b 100644 --- a/dist/providers.d.ts +++ b/dist/providers.d.ts @@ -1,9 +1,6 @@ -/// -/// -/// import type { EventEmitter } from 'stream'; import type { RequestOptions } from 'http'; -import { JsonRpcApiProvider, JsonRpcProvider, Wallet, FetchGetUrlFunc, Provider, SigningKey, TransactionRequest, JsonRpcSigner, BrowserProvider, Networkish, Eip1193Provider, VoidSigner, FetchUrlFeeDataNetworkPlugin } from 'ethers'; +import { JsonRpcApiProvider, JsonRpcProvider, Wallet, FetchGetUrlFunc, Provider, SigningKey, TransactionRequest, JsonRpcSigner, BrowserProvider, Networkish, Eip1193Provider, VoidSigner, FetchCancelSignal } from 'ethers'; import type { RequestInfo, RequestInit, Response, HeadersInit } from 'node-fetch'; import type { Config, NetIdType } from './networkConfig'; declare global { @@ -11,8 +8,7 @@ declare global { ethereum?: Eip1193Provider & EventEmitter; } } -export declare const defaultUserAgent = "Mozilla/5.0 (Windows NT 10.0; rv:109.0) Gecko/20100101 Firefox/115.0"; -export declare const fetch: nodeFetch; +export declare const defaultUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0"; export type nodeFetch = (url: RequestInfo, init?: RequestInit) => Promise; export type fetchDataOptions = RequestInit & { headers?: HeadersInit | any; @@ -24,6 +20,7 @@ export type fetchDataOptions = RequestInit & { torPort?: number; debug?: Function; returnResponse?: boolean; + cancelSignal?: FetchCancelSignal; }; export type NodeAgent = RequestOptions['agent'] | ((parsedUrl: URL) => RequestOptions['agent']); export declare function getHttpAgent({ fetchUrl, proxyUrl, torPort, retry, }: { @@ -35,41 +32,39 @@ export declare function getHttpAgent({ fetchUrl, proxyUrl, torPort, retry, }: { export declare function fetchData(url: string, options?: fetchDataOptions): Promise; export declare const fetchGetUrlFunc: (options?: fetchDataOptions) => FetchGetUrlFunc; export type getProviderOptions = fetchDataOptions & { + netId?: NetIdType; pollingInterval?: number; - gasPriceOracle?: string; - gasStationApi?: string; }; -export declare function getGasOraclePlugin(networkKey: string, fetchOptions?: getProviderOptions): FetchUrlFeeDataNetworkPlugin; export declare function getProvider(rpcUrl: string, fetchOptions?: getProviderOptions): Promise; export declare function getProviderWithNetId(netId: NetIdType, rpcUrl: string, config: Config, fetchOptions?: getProviderOptions): JsonRpcProvider; export declare const populateTransaction: (signer: TornadoWallet | TornadoVoidSigner | TornadoRpcSigner, tx: TransactionRequest) => Promise; -export type TornadoWalletOptions = { +export interface TornadoWalletOptions { gasPriceBump?: number; gasLimitBump?: number; gasFailover?: boolean; bumpNonce?: boolean; -}; +} export declare class TornadoWallet extends Wallet { - nonce?: number | null; + nonce?: number; gasPriceBump: number; gasLimitBump: number; gasFailover: boolean; bumpNonce: boolean; - constructor(key: string | SigningKey, provider?: null | Provider, { gasPriceBump, gasLimitBump, gasFailover, bumpNonce }?: TornadoWalletOptions); + constructor(key: string | SigningKey, provider?: Provider, { gasPriceBump, gasLimitBump, gasFailover, bumpNonce }?: TornadoWalletOptions); static fromMnemonic(mneomnic: string, provider: Provider, index?: number, options?: TornadoWalletOptions): TornadoWallet; populateTransaction(tx: TransactionRequest): Promise>; } export declare class TornadoVoidSigner extends VoidSigner { - nonce?: number | null; + nonce?: number; gasPriceBump: number; gasLimitBump: number; gasFailover: boolean; bumpNonce: boolean; - constructor(address: string, provider?: null | Provider, { gasPriceBump, gasLimitBump, gasFailover, bumpNonce }?: TornadoWalletOptions); + constructor(address: string, provider?: Provider, { gasPriceBump, gasLimitBump, gasFailover, bumpNonce }?: TornadoWalletOptions); populateTransaction(tx: TransactionRequest): Promise>; } export declare class TornadoRpcSigner extends JsonRpcSigner { - nonce?: number | null; + nonce?: number; gasPriceBump: number; gasLimitBump: number; gasFailover: boolean; @@ -79,13 +74,13 @@ export declare class TornadoRpcSigner extends JsonRpcSigner { } export type connectWalletFunc = (...args: any[]) => Promise; export type handleWalletFunc = (...args: any[]) => void; -export type TornadoBrowserProviderOptions = TornadoWalletOptions & { - webChainId?: NetIdType; +export interface TornadoBrowserProviderOptions extends TornadoWalletOptions { + netId?: NetIdType; connectWallet?: connectWalletFunc; handleNetworkChanges?: handleWalletFunc; handleAccountChanges?: handleWalletFunc; handleAccountDisconnect?: handleWalletFunc; -}; +} export declare class TornadoBrowserProvider extends BrowserProvider { options?: TornadoBrowserProviderOptions; constructor(ethereum: Eip1193Provider, network?: Networkish, options?: TornadoBrowserProviderOptions); diff --git a/dist/relayerClient.d.ts b/dist/relayerClient.d.ts index 351ff41..3d6741a 100644 --- a/dist/relayerClient.d.ts +++ b/dist/relayerClient.d.ts @@ -1,19 +1,24 @@ -import type { Aggregator } from '@tornado/contracts'; -import type { RelayerStructOutput } from '@tornado/contracts/dist/contracts/Governance/Aggregator/Aggregator'; import { NetIdType, Config } from './networkConfig'; import { fetchDataOptions } from './providers'; import type { snarkProofs } from './websnark'; +import type { CachedRelayerInfo } from './events'; +export declare const MIN_FEE = 0.1; +export declare const MAX_FEE = 0.9; export declare const MIN_STAKE_BALANCE: bigint; export interface RelayerParams { ensName: string; - relayerAddress?: string; + relayerAddress: string; } -export interface Relayer { +/** + * Info from relayer status + */ +export interface RelayerInfo extends RelayerParams { netId: NetIdType; url: string; hostname: string; rewardAccount: string; instances: string[]; + stakeBalance?: string; gasPrice?: number; ethPrices?: { [key in string]: string; @@ -21,16 +26,12 @@ export interface Relayer { currentQueue: number; tornadoServiceFee: number; } -export type RelayerInfo = Relayer & { - ensName: string; - stakeBalance: bigint; - relayerAddress: string; -}; -export type RelayerError = { +export interface RelayerError { hostname: string; relayerAddress?: string; errorMessage?: string; -}; + hasError: boolean; +} export interface RelayerStatus { url: string; rewardAccount: string; @@ -62,6 +63,9 @@ export interface RelayerStatus { }; currentQueue: number; } +export interface TornadoWithdrawParams extends snarkProofs { + contract: string; +} export interface RelayerTornadoWithdraw { id?: string; error?: string; @@ -78,51 +82,66 @@ export interface RelayerTornadoJobs { confirmations?: number; failedReason?: string; } +/** +const semVerRegex = + /^(?0|[1-9]\d*)\.(?0|[1-9]\d*)\.(?0|[1-9]\d*)(?:-(?(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/; + export interface semanticVersion { - major: string; - minor: string; - patch: string; - prerelease?: string; - buildmetadata?: string; + major: string; + minor: string; + patch: string; + prerelease?: string; + buildmetadata?: string; } -export declare function parseSemanticVersion(version: string): semanticVersion; -export declare function isRelayerUpdated(relayerVersion: string, netId: NetIdType): boolean; -export declare function calculateScore({ stakeBalance, tornadoServiceFee }: RelayerInfo, minFee?: number, maxFee?: number): bigint; + +export function parseSemanticVersion(version: string) { + const { groups } = semVerRegex.exec(version) as RegExpExecArray; + return groups as unknown as semanticVersion; +} + +export function isRelayerUpdated(relayerVersion: string, netId: NetIdType) { + const { major, patch, prerelease } = parseSemanticVersion(relayerVersion); + // Save backwards compatibility with V4 relayers for Ethereum Mainnet + const requiredMajor = netId === NetId.MAINNET ? '4' : '5'; + const isUpdatedMajor = major === requiredMajor; + + if (prerelease) return false; + return isUpdatedMajor && (Number(patch) >= 5 || netId !== NetId.MAINNET); // Patch checking - also backwards compatibility for Mainnet +} +**/ +export declare function calculateScore({ stakeBalance, tornadoServiceFee }: RelayerInfo): bigint; export declare function getWeightRandom(weightsScores: bigint[], random: bigint): number; -export type RelayerInstanceList = { - [key in string]: { +export interface RelayerInstanceList { + [key: string]: { instanceAddress: { - [key in string]: string; + [key: string]: string; }; }; -}; +} export declare function getSupportedInstances(instanceList: RelayerInstanceList): string[]; -export declare function pickWeightedRandomRelayer(relayers: RelayerInfo[], netId: NetIdType): RelayerInfo; +export declare function pickWeightedRandomRelayer(relayers: RelayerInfo[]): RelayerInfo; export interface RelayerClientConstructor { netId: NetIdType; config: Config; - Aggregator: Aggregator; fetchDataOptions?: fetchDataOptions; } -export type RelayerClientWithdraw = snarkProofs & { - contract: string; -}; export declare class RelayerClient { netId: NetIdType; config: Config; - Aggregator: Aggregator; - selectedRelayer?: Relayer; + selectedRelayer?: RelayerInfo; fetchDataOptions?: fetchDataOptions; - constructor({ netId, config, Aggregator, fetchDataOptions }: RelayerClientConstructor); - askRelayerStatus({ hostname, relayerAddress, }: { - hostname: string; + tovarish: boolean; + constructor({ netId, config, fetchDataOptions }: RelayerClientConstructor); + askRelayerStatus({ hostname, url, relayerAddress, }: { + hostname?: string; + url?: string; relayerAddress?: string; }): Promise; - filterRelayer(curr: RelayerStructOutput, relayer: RelayerParams, subdomains: string[], debugRelayer?: boolean): Promise; - getValidRelayers(relayers: RelayerParams[], subdomains: string[], debugRelayer?: boolean): Promise<{ + filterRelayer(relayer: CachedRelayerInfo): Promise; + getValidRelayers(relayers: CachedRelayerInfo[]): Promise<{ validRelayers: RelayerInfo[]; invalidRelayers: RelayerError[]; }>; pickWeightedRandomRelayer(relayers: RelayerInfo[]): RelayerInfo; - tornadoWithdraw({ contract, proof, args }: RelayerClientWithdraw): Promise; + tornadoWithdraw({ contract, proof, args }: TornadoWithdrawParams, callback?: (jobResp: RelayerTornadoWithdraw | RelayerTornadoJobs) => void): Promise; } diff --git a/dist/schemas/ajv.d.ts b/dist/schemas/ajv.d.ts new file mode 100644 index 0000000..fb7b27d --- /dev/null +++ b/dist/schemas/ajv.d.ts @@ -0,0 +1,2 @@ +import Ajv from 'ajv'; +export declare const ajv: Ajv; diff --git a/dist/schemas/events.d.ts b/dist/schemas/events.d.ts new file mode 100644 index 0000000..846a748 --- /dev/null +++ b/dist/schemas/events.d.ts @@ -0,0 +1,492 @@ +export declare const governanceEventsSchema: { + readonly type: "array"; + readonly items: { + readonly anyOf: readonly [{ + readonly type: "object"; + readonly properties: { + readonly event: { + readonly type: "string"; + }; + readonly id: { + readonly type: "number"; + }; + readonly proposer: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{40}$"; + readonly isAddress: true; + }; + readonly target: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{40}$"; + readonly isAddress: true; + }; + readonly startTime: { + readonly type: "number"; + }; + readonly endTime: { + readonly type: "number"; + }; + readonly description: { + readonly type: "string"; + }; + readonly blockNumber: { + readonly type: "number"; + }; + readonly logIndex: { + readonly type: "number"; + }; + readonly transactionHash: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{64}$"; + }; + }; + readonly required: readonly [...string[], "event", "id", "proposer", "target", "startTime", "endTime", "description"]; + readonly additionalProperties: false; + }, { + readonly type: "object"; + readonly properties: { + readonly event: { + readonly type: "string"; + }; + readonly proposalId: { + readonly type: "number"; + }; + readonly voter: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{40}$"; + readonly isAddress: true; + }; + readonly support: { + readonly type: "boolean"; + }; + readonly votes: { + readonly type: "string"; + }; + readonly from: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{40}$"; + readonly isAddress: true; + }; + readonly input: { + readonly type: "string"; + }; + readonly blockNumber: { + readonly type: "number"; + }; + readonly logIndex: { + readonly type: "number"; + }; + readonly transactionHash: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{64}$"; + }; + }; + readonly required: readonly [...string[], "event", "proposalId", "voter", "support", "votes", "from", "input"]; + readonly additionalProperties: false; + }, { + readonly type: "object"; + readonly properties: { + readonly event: { + readonly type: "string"; + }; + readonly account: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{40}$"; + readonly isAddress: true; + }; + readonly delegateTo: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{40}$"; + readonly isAddress: true; + }; + readonly blockNumber: { + readonly type: "number"; + }; + readonly logIndex: { + readonly type: "number"; + }; + readonly transactionHash: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{64}$"; + }; + }; + readonly required: readonly [...string[], "account", "delegateTo"]; + readonly additionalProperties: false; + }, { + readonly type: "object"; + readonly properties: { + readonly event: { + readonly type: "string"; + }; + readonly account: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{40}$"; + readonly isAddress: true; + }; + readonly delegateFrom: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{40}$"; + readonly isAddress: true; + }; + readonly blockNumber: { + readonly type: "number"; + }; + readonly logIndex: { + readonly type: "number"; + }; + readonly transactionHash: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{64}$"; + }; + }; + readonly required: readonly [...string[], "account", "delegateFrom"]; + readonly additionalProperties: false; + }]; + }; +}; +export declare const relayerRegistryEventsSchema: { + readonly type: "array"; + readonly items: { + readonly anyOf: readonly [{ + readonly type: "object"; + readonly properties: { + readonly event: { + readonly type: "string"; + }; + readonly ensName: { + readonly type: "string"; + }; + readonly relayerAddress: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{40}$"; + readonly isAddress: true; + }; + readonly ensHash: { + readonly type: "string"; + }; + readonly stakedAmount: { + readonly type: "string"; + }; + readonly blockNumber: { + readonly type: "number"; + }; + readonly logIndex: { + readonly type: "number"; + }; + readonly transactionHash: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{64}$"; + }; + }; + readonly required: readonly [...string[], "event", "ensName", "relayerAddress", "ensHash", "stakedAmount"]; + readonly additionalProperties: false; + }, { + readonly type: "object"; + readonly properties: { + readonly event: { + readonly type: "string"; + }; + readonly relayerAddress: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{40}$"; + readonly isAddress: true; + }; + readonly blockNumber: { + readonly type: "number"; + }; + readonly logIndex: { + readonly type: "number"; + }; + readonly transactionHash: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{64}$"; + }; + }; + readonly required: readonly [...string[], "event", "relayerAddress"]; + readonly additionalProperties: false; + }, { + readonly type: "object"; + readonly properties: { + readonly event: { + readonly type: "string"; + }; + readonly relayerAddress: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{40}$"; + readonly isAddress: true; + }; + readonly workerAddress: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{40}$"; + readonly isAddress: true; + }; + readonly blockNumber: { + readonly type: "number"; + }; + readonly logIndex: { + readonly type: "number"; + }; + readonly transactionHash: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{64}$"; + }; + }; + readonly required: readonly [...string[], "event", "relayerAddress", "workerAddress"]; + readonly additionalProperties: false; + }]; + }; +}; +export declare const stakeBurnedEventsSchema: { + readonly type: "array"; + readonly items: { + readonly type: "object"; + readonly properties: { + readonly relayerAddress: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{40}$"; + readonly isAddress: true; + }; + readonly amountBurned: { + readonly type: "string"; + readonly BN: true; + }; + readonly instanceAddress: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{40}$"; + readonly isAddress: true; + }; + readonly gasFee: { + readonly type: "string"; + readonly BN: true; + }; + readonly relayerFee: { + readonly type: "string"; + readonly BN: true; + }; + readonly timestamp: { + readonly type: "number"; + }; + readonly blockNumber: { + readonly type: "number"; + }; + readonly logIndex: { + readonly type: "number"; + }; + readonly transactionHash: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{64}$"; + }; + }; + readonly required: readonly [...string[], "relayerAddress", "amountBurned", "instanceAddress", "gasFee", "relayerFee", "timestamp"]; + readonly additionalProperties: false; + }; +}; +export declare const depositsEventsSchema: { + readonly type: "array"; + readonly items: { + readonly type: "object"; + readonly properties: { + readonly commitment: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{64}$"; + }; + readonly leafIndex: { + readonly type: "number"; + }; + readonly timestamp: { + readonly type: "number"; + }; + readonly from: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{40}$"; + readonly isAddress: true; + }; + readonly blockNumber: { + readonly type: "number"; + }; + readonly logIndex: { + readonly type: "number"; + }; + readonly transactionHash: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{64}$"; + }; + }; + readonly required: readonly [...string[], "commitment", "leafIndex", "timestamp", "from"]; + readonly additionalProperties: false; + }; +}; +export declare const withdrawalsEventsSchema: { + readonly type: "array"; + readonly items: { + readonly type: "object"; + readonly properties: { + readonly nullifierHash: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{64}$"; + }; + readonly to: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{40}$"; + readonly isAddress: true; + }; + readonly fee: { + readonly type: "string"; + readonly BN: true; + }; + readonly timestamp: { + readonly type: "number"; + }; + readonly blockNumber: { + readonly type: "number"; + }; + readonly logIndex: { + readonly type: "number"; + }; + readonly transactionHash: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{64}$"; + }; + }; + readonly required: readonly [...string[], "nullifierHash", "to", "fee", "timestamp"]; + readonly additionalProperties: false; + }; +}; +export declare const tornadoEventsSchema: { + readonly type: "array"; + readonly items: { + readonly anyOf: readonly [{ + readonly type: "object"; + readonly properties: { + readonly event: { + readonly type: "string"; + }; + readonly instanceAddress: { + readonly type: "string"; + }; + readonly commitment: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{64}$"; + }; + readonly leafIndex: { + readonly type: "number"; + }; + readonly timestamp: { + readonly type: "number"; + }; + readonly from: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{40}$"; + readonly isAddress: true; + }; + readonly blockNumber: { + readonly type: "number"; + }; + readonly logIndex: { + readonly type: "number"; + }; + readonly transactionHash: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{64}$"; + }; + }; + readonly required: readonly [...string[], "event", "instanceAddress", "commitment", "leafIndex", "timestamp", "from"]; + readonly additionalProperties: false; + }, { + readonly type: "object"; + readonly properties: { + readonly event: { + readonly type: "string"; + }; + readonly instanceAddress: { + readonly type: "string"; + }; + readonly nullifierHash: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{64}$"; + }; + readonly to: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{40}$"; + readonly isAddress: true; + }; + readonly relayerAddress: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{40}$"; + readonly isAddress: true; + }; + readonly fee: { + readonly type: "string"; + readonly BN: true; + }; + readonly timestamp: { + readonly type: "number"; + }; + readonly blockNumber: { + readonly type: "number"; + }; + readonly logIndex: { + readonly type: "number"; + }; + readonly transactionHash: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{64}$"; + }; + }; + readonly required: readonly [...string[], "event", "instanceAddress", "nullifierHash", "to", "relayerAddress", "fee", "timestamp"]; + readonly additionalProperties: false; + }]; + }; +}; +export declare const echoEventsSchema: { + readonly type: "array"; + readonly items: { + readonly type: "object"; + readonly properties: { + readonly address: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{40}$"; + readonly isAddress: true; + }; + readonly encryptedAccount: { + readonly type: "string"; + }; + readonly blockNumber: { + readonly type: "number"; + }; + readonly logIndex: { + readonly type: "number"; + }; + readonly transactionHash: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{64}$"; + }; + }; + readonly required: readonly [...string[], "address", "encryptedAccount"]; + readonly additionalProperties: false; + }; +}; +export declare const encryptedNotesSchema: { + readonly type: "array"; + readonly items: { + readonly type: "object"; + readonly properties: { + readonly encryptedNote: { + readonly type: "string"; + }; + readonly blockNumber: { + readonly type: "number"; + }; + readonly logIndex: { + readonly type: "number"; + }; + readonly transactionHash: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{64}$"; + }; + }; + readonly required: readonly [...string[], "encryptedNote"]; + readonly additionalProperties: false; + }; +}; +export declare function getEventsSchemaValidator(type: string): import("ajv").ValidateFunction; diff --git a/dist/schemas/index.d.ts b/dist/schemas/index.d.ts index b3c1810..f01c441 100644 --- a/dist/schemas/index.d.ts +++ b/dist/schemas/index.d.ts @@ -1,4 +1,5 @@ -import Ajv from 'ajv'; -export declare const ajv: Ajv; +export * from './ajv'; +export * from './events'; export * from './status'; export * from './jobs'; +export * from './types'; diff --git a/dist/schemas/jobs.d.ts b/dist/schemas/jobs.d.ts index 15a2220..3039685 100644 --- a/dist/schemas/jobs.d.ts +++ b/dist/schemas/jobs.d.ts @@ -1,4 +1,4 @@ -export type jobsSchema = { +export interface jobsSchema { type: string; properties: { error: { @@ -36,5 +36,6 @@ export type jobsSchema = { }; }; required: string[]; -}; +} export declare const jobsSchema: jobsSchema; +export declare const jobRequestSchema: jobsSchema; diff --git a/dist/schemas/status.d.ts b/dist/schemas/status.d.ts index f5e3b4e..f5ef69b 100644 --- a/dist/schemas/status.d.ts +++ b/dist/schemas/status.d.ts @@ -1,15 +1,16 @@ import { Config, NetIdType } from '../networkConfig'; -export type statusInstanceType = { +import { addressSchemaType, bnSchemaType } from '.'; +export interface statusInstanceType { type: string; properties: { instanceAddress: { type: string; properties: { - [key in string]: typeof addressType; + [key in string]: typeof addressSchemaType; }; required: string[]; }; - tokenAddress?: typeof addressType; + tokenAddress?: typeof addressSchemaType; symbol?: { enum: string[]; }; @@ -18,25 +19,25 @@ export type statusInstanceType = { }; }; required: string[]; -}; -export type statusInstancesType = { +} +export interface statusInstancesType { type: string; properties: { [key in string]: statusInstanceType; }; required: string[]; -}; -export type statusEthPricesType = { +} +export interface statusEthPricesType { type: string; properties: { - [key in string]: typeof bnType; + [key in string]: typeof bnSchemaType; }; required?: string[]; -}; -export type statusSchema = { +} +export interface statusSchema { type: string; properties: { - rewardAccount: typeof addressType; + rewardAccount: typeof addressSchemaType; instances?: statusInstancesType; gasPrices: { type: string; @@ -56,9 +57,13 @@ export type statusSchema = { maximum: number; minimum: number; }; - latestBlock?: { + latestBlock: { type: string; }; + latestBalance: { + type: string; + BN: boolean; + }; version: { type: string; }; @@ -74,19 +79,28 @@ export type statusSchema = { }; required: string[]; }; + syncStatus: { + type: string; + properties: { + events: { + type: string; + }; + tokenPrice: { + type: string; + }; + gasPrice: { + type: string; + }; + }; + required: string[]; + }; + onSyncEvents: { + type: string; + }; currentQueue: { type: string; }; }; required: string[]; -}; -declare const addressType: { - type: string; - pattern: string; -}; -declare const bnType: { - type: string; - BN: boolean; -}; -export declare function getStatusSchema(netId: NetIdType, config: Config): statusSchema; -export {}; +} +export declare function getStatusSchema(netId: NetIdType, config: Config, tovarish: boolean): statusSchema; diff --git a/dist/schemas/types.d.ts b/dist/schemas/types.d.ts new file mode 100644 index 0000000..d373cf4 --- /dev/null +++ b/dist/schemas/types.d.ts @@ -0,0 +1,22 @@ +export declare const addressSchemaType: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{40}$"; + readonly isAddress: true; +}; +export declare const bnSchemaType: { + readonly type: "string"; + readonly BN: true; +}; +export declare const proofSchemaType: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{512}$"; +}; +export declare const bytes32SchemaType: { + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{64}$"; +}; +export declare const bytes32BNSchemaType: { + readonly BN: true; + readonly type: "string"; + readonly pattern: "^0x[a-fA-F0-9]{64}$"; +}; diff --git a/dist/index.umd.js b/dist/tornado.umd.js similarity index 79% rename from dist/index.umd.js rename to dist/tornado.umd.js index d372672..0d4e415 100644 --- a/dist/index.umd.js +++ b/dist/tornado.umd.js @@ -11,6 +11,392 @@ return /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ +/***/ 15795: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +/* + ISC License + + Copyright (c) 2019, Pierre-Louis Despaigne + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +const CID = __webpack_require__(26613); + +// Label's max length in DNS (https://tools.ietf.org/html/rfc1034#page-7) +const dnsLabelMaxLength = 63; + +/** + * Take any ipfsHash and convert it to DNS-compatible CID + * @param {string} ipfsHash a regular ipfs hash either a cid v0 or v1 + * @return {string} the resulting ipfs hash as a cid v1 + */ +const cidForWeb = (ipfsHash) => { + let cid = new CID(ipfsHash); + if (cid.version === 0) { + cid = cid.toV1(); + } + let dnsLabel = cid.toString('base32'); + if (dnsLabel.length > dnsLabelMaxLength) { + const b36 = cid.toString('base36'); + if (b36.length <= dnsLabelMaxLength) { + return b36; + } + throw new TypeError ('CID is longer than DNS limit of 63 characters and is not compatible with public gateways'); + } + return dnsLabel; +} + +exports.cidForWeb = cidForWeb; + + +/** + * Take any ipfsHash and convert it to a CID v1 encoded in base32. + * @param {string} ipfsHash a regular ipfs hash either a cid v0 or v1 (v1 will remain unchanged) + * @return {string} the resulting ipfs hash as a cid v1 + */ +const cidV0ToV1Base32 = (ipfsHash) => { + let cid = new CID(ipfsHash); + if (cid.version === 0) { + cid = cid.toV1(); + } + return cid.toString('base32'); +} + +exports.cidV0ToV1Base32 = cidV0ToV1Base32; + + +/***/ }), + +/***/ 81810: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/* + ISC License + + Copyright (c) 2019, Pierre-Louis Despaigne + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +const multiC = __webpack_require__(52021); +const multiH = __webpack_require__(14243); + +const { hexStringToBuffer, profiles } = __webpack_require__(55262); +const { cidForWeb, cidV0ToV1Base32 } = __webpack_require__(15795); + +module.exports = { + + //export some helpers functions + helpers: { + cidForWeb, + cidV0ToV1Base32, + }, + + /** + * Decode a Content Hash. + * @param {string} hash an hex string containing a content hash + * @return {string} the decoded content + */ + decode: function (contentHash) { + const buffer = hexStringToBuffer(contentHash); + const codec = multiC.getCodec(buffer); + const value = multiC.rmPrefix(buffer); + let profile = profiles[codec]; + if (!profile) profile = profiles['default']; + return profile.decode(value); + }, + + /** + * Encode an IPFS address into a content hash + * @param {string} ipfsHash string containing an IPFS address + * @return {string} the resulting content hash + */ + fromIpfs: function (ipfsHash) { + return this.encode('ipfs-ns', ipfsHash); + }, + + /** + * Encode a Skylink into a content hash + * @param {string} skylink string containing a Skylink + * @return {string} the resulting content hash + */ + fromSkylink: function (skylink) { + return this.encode('skynet-ns', skylink); + }, + + /** + * Encode a Swarm address into a content hash + * @param {string} swarmHash string containing a Swarm address + * @return {string} the resulting content hash + */ + fromSwarm: function (swarmHash) { + return this.encode('swarm-ns', swarmHash); + }, + + /** + * Encode a arweave address into a content hash + * @param {string} swarmHash string containing a arweave address + * @return {string} the resulting content hash + */ + fromArweave: function(arweave) { + return this.encode('arweave-ns', arweave); + }, + + /** + * General purpose encoding function + * @param {string} codec + * @param {string} value + */ + encode: function (codec, value) { + let profile = profiles[codec]; + if (!profile) profile = profiles['default']; + const encodedValue = profile.encode(value); + return multiH.toHexString(multiC.addPrefix(codec, encodedValue)) + }, + + /** + * Extract the codec of a content hash + * @param {string} hash hex string containing a content hash + * @return {string} the extracted codec + */ + getCodec: function (hash) { + let buffer = hexStringToBuffer(hash); + return multiC.getCodec(buffer); + }, +} + + +/***/ }), + +/***/ 55262: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; +/* + ISC License + + Copyright (c) 2019, Pierre-Louis Despaigne + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +const CID = __webpack_require__(26613); +const multiH = __webpack_require__(14243); +const base64 = __webpack_require__(8127) + +/** + * Convert an hexadecimal string to a Buffer, the string can start with or without '0x' + * @param {string} hex an hexadecimal value + * @return {Buffer} the resulting Buffer + */ +const hexStringToBuffer = (hex) => { + let prefix = hex.slice(0, 2); + let value = hex.slice(2); + let res = ''; + if (prefix === '0x') res = value; + else res = hex; + return multiH.fromHexString(res); +} + +/** + * Validates IPNS identifier to safeguard against insecure names. + * @param {CID} name ised in ipns-ns + * @return {bool} + */ +const isCryptographicIPNS = (cid) => { + try { + const { multihash } = cid + // Additional check for identifiers shorter + // than what inlined ED25519 pubkey would be + // https://github.com/ensdomains/ens-app/issues/849#issuecomment-777088950 + if (multihash.length < 38) { + const mh = multiH.decode(multihash) + // ED25519 pubkeys are inlined using identity hash function + // and we should not see anything shorter than that + if (mh.name === 'identity' && mh.length < 36) { + // One can read inlined string value via: + // console.log('ipns-ns id:', String(multiH.decode(new CID(value).multihash).digest)) + return false + } + } + // ok, CID looks fine + return true + } catch (_) { return false } +} + +/** +* list of known encoding, +* encoding should be a function that takes a `string` input, +* and return a `Buffer` result +*/ +const encodes = { + /** + * @param {string} value + * @return {Buffer} + */ + skynet: (value) => { + return base64.toUint8Array(value) + }, + /** + * @param {string} value + * @return {Buffer} + */ + swarm: (value) => { + const multihash = multiH.encode(hexStringToBuffer(value), 'keccak-256'); + return new CID(1, 'swarm-manifest', multihash).bytes; + }, + /** + * @param {string} value + * @return {Buffer} + */ + ipfs: (value) => { + return new CID(value).toV1().bytes; + }, + /** + * @param {string} value + * @return {Buffer} + */ + ipns: (value) => { + const cid = new CID(value) + if (!isCryptographicIPNS(cid)) { + throw Error('ipns-ns allows only valid cryptographic libp2p-key identifiers, try using ED25519 pubkey instead') + } + // Represent IPNS name as a CID with libp2p-key codec + // https://github.com/libp2p/specs/blob/master/RFC/0001-text-peerid-cid.md + return new CID(1, 'libp2p-key', cid.multihash).bytes + }, + /** + * @param {string} value + * @return {Buffer} + */ + utf8: (value) => { + return Buffer.from(value, 'utf8'); + }, + /** + * @param {string} value + * @return {Buffer} + */ + arweave: (value) => { + return base64.toUint8Array(value) + }, +}; + +/** +* list of known decoding, +* decoding should be a function that takes a `Buffer` input, +* and return a `string` result +*/ +const decodes = { + /** + * @param {Buffer} value + */ + hexMultiHash: (value) => { + const cid = new CID(value); + return multiH.decode(cid.multihash).digest.toString('hex'); + }, + /** + * @param {Buffer} value + */ + ipfs: (value) => { + const cid = new CID(value).toV1(); + return cid.toString(cid.codec === 'libp2p-key' ? 'base36' : 'base32') + }, + /** + * @param {Buffer} value + */ + ipns: (value) => { + const cid = new CID(value).toV1() + if (!isCryptographicIPNS(cid)) { + // Value is not a libp2p-key, return original string + console.warn('[ensdomains/content-hash] use of non-cryptographic identifiers in ipns-ns is deprecated and will be removed, migrate to ED25519 libp2p-key') + return String(multiH.decode(new CID(value).multihash).digest) + // TODO: start throwing an error (after some deprecation period) + // throw Error('ipns-ns allows only valid cryptographic libp2p-key identifiers, try using ED25519 pubkey instead') + } + return cid.toString('base36') + }, + /** + * @param {Buffer} value + */ + utf8: (value) => { + return value.toString('utf8'); + }, + base64: (value) => { + // `true` option makes it URL safe (replaces / and + with - and _ ) + return base64.fromUint8Array(value, true) + } +}; + +/** +* list of known encoding/decoding for a given codec, +* `encode` should be chosen among the `encodes` functions +* `decode` should be chosen among the `decodes` functions +*/ +const profiles = { + 'skynet-ns': { + encode: encodes.skynet, + decode: decodes.base64, + }, + 'swarm-ns': { + encode: encodes.swarm, + decode: decodes.hexMultiHash, + }, + 'ipfs-ns': { + encode: encodes.ipfs, + decode: decodes.ipfs, + }, + 'ipns-ns': { + encode: encodes.ipns, + decode: decodes.ipns, + }, + 'arweave-ns': { + encode: encodes.arweave, + decode: decodes.base64, + }, + 'default': { + encode: encodes.utf8, + decode: decodes.utf8, + }, +}; + +exports.hexStringToBuffer = hexStringToBuffer; +exports.profiles = profiles; + + +/***/ }), + /***/ 66289: /***/ ((__unused_webpack_module, exports) => { @@ -280,7 +666,7 @@ exports.RLP = { encode, decode }; /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.accountBodyToRLP = exports.accountBodyToSlim = exports.accountBodyFromSlim = exports.isZeroAddress = exports.zeroAddress = exports.importPublic = exports.privateToAddress = exports.privateToPublic = exports.publicToAddress = exports.pubToAddress = exports.isValidPublic = exports.isValidPrivate = exports.generateAddress2 = exports.generateAddress = exports.isValidChecksumAddress = exports.toChecksumAddress = exports.isValidAddress = exports.Account = void 0; @@ -608,7 +994,7 @@ exports.accountBodyToRLP = accountBodyToRLP; /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Address = void 0; @@ -908,7 +1294,7 @@ exports.AsyncEventEmitter = AsyncEventEmitter; /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.intToUnpaddedBuffer = exports.bigIntToUnpaddedBuffer = exports.bigIntToHex = exports.bufArrToArr = exports.arrToBufArr = exports.validateNoLeadingZeroes = exports.baToJSON = exports.toUtf8 = exports.short = exports.addHexPrefix = exports.toUnsigned = exports.fromSigned = exports.bufferToInt = exports.bigIntToBuffer = exports.bufferToBigInt = exports.bufferToHex = exports.toBuffer = exports.unpadHexString = exports.unpadArray = exports.unpadBuffer = exports.setLengthRight = exports.setLengthLeft = exports.zeros = exports.intToBuffer = exports.intToHex = void 0; @@ -1428,7 +1814,7 @@ exports.compactBytesToNibbles = compactBytesToNibbles; /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.assertIsString = exports.assertIsArray = exports.assertIsBuffer = exports.assertIsHexString = void 0; @@ -1563,7 +1949,7 @@ __exportStar(__webpack_require__(81862), exports); /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; /* The MIT License @@ -1759,10 +2145,9 @@ exports.isHexString = isHexString; /***/ }), /***/ 31708: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ ((__unused_webpack_module, exports) => { "use strict"; -/* provided dependency */ var console = __webpack_require__(96763); Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Lock = void 0; @@ -1855,7 +2240,7 @@ exports.getProvider = getProvider; /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.hashPersonalMessage = exports.isValidSignature = exports.fromRpcSig = exports.toCompactSig = exports.toRpcSig = exports.ecrecover = exports.ecsign = void 0; @@ -2094,7 +2479,7 @@ exports.GWEI_TO_WEI = BigInt(1000000000); /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Withdrawal = void 0; @@ -2195,7 +2580,7 @@ exports.Withdrawal = Withdrawal; /* eslint-disable jsdoc/check-indentation, jsdoc/match-description */ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.decodeSingle = exports.decode = exports.encodePacked = exports.encodeSingle = exports.encode = void 0; -const utils_1 = __webpack_require__(22049); +const utils_1 = __webpack_require__(52367); const errors_1 = __webpack_require__(5961); const packer_1 = __webpack_require__(37700); /** @@ -2431,7 +2816,7 @@ exports.decodeSingle = decodeSingle; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ParserError = exports.getErrorStack = exports.getErrorMessage = void 0; -const utils_1 = __webpack_require__(22049); +const utils_1 = __webpack_require__(52367); /** * Attempt to get an error message from a value. * @@ -2528,7 +2913,7 @@ __exportStar(__webpack_require__(11126), exports); Object.defineProperty(exports, "__esModule", ({ value: true })); exports.iterate = void 0; -const utils_1 = __webpack_require__(22049); +const utils_1 = __webpack_require__(52367); /** * Iterate over a buffer with the specified size. This will yield a part of the * buffer starting at an increment of the specified size, until the end of the @@ -2568,7 +2953,7 @@ exports.iterate = iterate; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.unpack = exports.pack = exports.isDynamicParser = exports.getParser = void 0; -const utils_1 = __webpack_require__(22049); +const utils_1 = __webpack_require__(52367); const errors_1 = __webpack_require__(5961); const iterator_1 = __webpack_require__(57924); const parsers_1 = __webpack_require__(46207); @@ -2719,7 +3104,7 @@ exports.unpack = unpack; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.address = exports.getAddress = void 0; -const utils_1 = __webpack_require__(22049); +const utils_1 = __webpack_require__(52367); const errors_1 = __webpack_require__(5961); const utils_2 = __webpack_require__(26365); /** @@ -2803,7 +3188,7 @@ exports.address = { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.array = exports.getTupleType = exports.getArrayType = exports.isArrayType = void 0; -const utils_1 = __webpack_require__(22049); +const utils_1 = __webpack_require__(52367); const errors_1 = __webpack_require__(5961); const packer_1 = __webpack_require__(37700); const utils_2 = __webpack_require__(26365); @@ -2982,8 +3367,8 @@ exports.array = { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.bool = exports.getBooleanValue = void 0; -const utils_1 = __webpack_require__(22049); -const superstruct_1 = __webpack_require__(2150); +const superstruct_1 = __webpack_require__(35620); +const utils_1 = __webpack_require__(52367); const errors_1 = __webpack_require__(5961); const number_1 = __webpack_require__(6150); const BooleanCoercer = (0, superstruct_1.coerce)((0, superstruct_1.boolean)(), (0, superstruct_1.union)([(0, superstruct_1.literal)('true'), (0, superstruct_1.literal)('false')]), (value) => value === 'true'); @@ -3082,7 +3467,7 @@ exports.bool = { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.bytes = void 0; -const utils_1 = __webpack_require__(22049); +const utils_1 = __webpack_require__(52367); const utils_2 = __webpack_require__(26365); exports.bytes = { isDynamic: true, @@ -3157,7 +3542,7 @@ exports.bytes = { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.fixedBytes = exports.getByteLength = void 0; -const utils_1 = __webpack_require__(22049); +const utils_1 = __webpack_require__(52367); const errors_1 = __webpack_require__(5961); const utils_2 = __webpack_require__(26365); const BYTES_REGEX = /^bytes([0-9]{1,2})$/u; @@ -3242,8 +3627,8 @@ exports.fixedBytes = { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.fn = exports.getFunction = void 0; -const utils_1 = __webpack_require__(22049); -const superstruct_1 = __webpack_require__(2150); +const superstruct_1 = __webpack_require__(35620); +const utils_1 = __webpack_require__(52367); const errors_1 = __webpack_require__(5961); const fixed_bytes_1 = __webpack_require__(83415); /** @@ -3380,7 +3765,7 @@ __exportStar(__webpack_require__(30717), exports); Object.defineProperty(exports, "__esModule", ({ value: true })); exports.number = exports.getBigInt = exports.assertNumberLength = exports.getLength = exports.isSigned = void 0; -const utils_1 = __webpack_require__(22049); +const utils_1 = __webpack_require__(52367); const errors_1 = __webpack_require__(5961); const utils_2 = __webpack_require__(26365); const NUMBER_REGEX = /^u?int(?[0-9]*)?$/u; @@ -3552,7 +3937,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true })); exports.string = void 0; -const utils_1 = __webpack_require__(22049); +const utils_1 = __webpack_require__(52367); const bytes_1 = __webpack_require__(99356); exports.string = { isDynamic: true, @@ -3620,7 +4005,7 @@ exports.string = { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.tuple = exports.getTupleElements = void 0; -const utils_1 = __webpack_require__(22049); +const utils_1 = __webpack_require__(52367); const errors_1 = __webpack_require__(5961); const packer_1 = __webpack_require__(37700); const TUPLE_REGEX = /^\((.+)\)$/u; @@ -3782,7 +4167,7 @@ __exportStar(__webpack_require__(15744), exports); Object.defineProperty(exports, "__esModule", ({ value: true })); exports.padEnd = exports.padStart = exports.set = void 0; -const utils_1 = __webpack_require__(22049); +const utils_1 = __webpack_require__(52367); const BUFFER_WIDTH = 32; /** * Set `buffer` in `target` at the specified position. @@ -3859,7 +4244,7 @@ __exportStar(__webpack_require__(59194), exports); /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; @@ -3886,8 +4271,8 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getEncryptionPublicKey = exports.decryptSafely = exports.decrypt = exports.encryptSafely = exports.encrypt = void 0; +const base_1 = __webpack_require__(63203); const nacl = __importStar(__webpack_require__(88947)); -const naclUtil = __importStar(__webpack_require__(76386)); const utils_1 = __webpack_require__(54907); /** * Encrypt a message. @@ -3918,21 +4303,21 @@ function encrypt({ publicKey, data, version, }) { // assemble encryption parameters - from string to UInt8 let pubKeyUInt8Array; try { - pubKeyUInt8Array = naclUtil.decodeBase64(publicKey); + pubKeyUInt8Array = base_1.base64.decode(publicKey); } catch (err) { throw new Error('Bad public key'); } - const msgParamsUInt8Array = naclUtil.decodeUTF8(data); + const msgParamsUInt8Array = base_1.utf8.decode(data); const nonce = nacl.randomBytes(nacl.box.nonceLength); // encrypt const encryptedMessage = nacl.box(msgParamsUInt8Array, nonce, pubKeyUInt8Array, ephemeralKeyPair.secretKey); // handle encrypted data const output = { version: 'x25519-xsalsa20-poly1305', - nonce: naclUtil.encodeBase64(nonce), - ephemPublicKey: naclUtil.encodeBase64(ephemeralKeyPair.publicKey), - ciphertext: naclUtil.encodeBase64(encryptedMessage), + nonce: base_1.base64.encode(nonce), + ephemPublicKey: base_1.base64.encode(ephemeralKeyPair.publicKey), + ciphertext: base_1.base64.encode(encryptedMessage), }; // return encrypted msg data return output; @@ -4006,13 +4391,12 @@ function decrypt({ encryptedData, privateKey, }) { } switch (encryptedData.version) { case 'x25519-xsalsa20-poly1305': { - // string to buffer to UInt8Array - const receiverPrivateKeyUint8Array = naclDecodeHex(privateKey); + const receiverPrivateKeyUint8Array = Buffer.from(privateKey, 'hex'); const receiverEncryptionPrivateKey = nacl.box.keyPair.fromSecretKey(receiverPrivateKeyUint8Array).secretKey; // assemble decryption parameters - const nonce = naclUtil.decodeBase64(encryptedData.nonce); - const ciphertext = naclUtil.decodeBase64(encryptedData.ciphertext); - const ephemPublicKey = naclUtil.decodeBase64(encryptedData.ephemPublicKey); + const nonce = base_1.base64.decode(encryptedData.nonce); + const ciphertext = base_1.base64.decode(encryptedData.ciphertext); + const ephemPublicKey = base_1.base64.decode(encryptedData.ephemPublicKey); // decrypt const decryptedMessage = nacl.box.open(ciphertext, nonce, ephemPublicKey, receiverEncryptionPrivateKey); // return decrypted msg data @@ -4020,7 +4404,7 @@ function decrypt({ encryptedData, privateKey, }) { if (!decryptedMessage) { throw new Error(); } - const output = naclUtil.encodeUTF8(decryptedMessage); + const output = base_1.utf8.encode(decryptedMessage); // TODO: This is probably extraneous but was kept to minimize changes during refactor if (!output) { throw new Error(); @@ -4065,21 +4449,11 @@ exports.decryptSafely = decryptSafely; * @returns The encryption public key. */ function getEncryptionPublicKey(privateKey) { - const privateKeyUint8Array = naclDecodeHex(privateKey); + const privateKeyUint8Array = Buffer.from(privateKey, 'hex'); const encryptionPublicKey = nacl.box.keyPair.fromSecretKey(privateKeyUint8Array).publicKey; - return naclUtil.encodeBase64(encryptionPublicKey); + return base_1.base64.encode(encryptionPublicKey); } exports.getEncryptionPublicKey = getEncryptionPublicKey; -/** - * Convert a hex string to the UInt8Array format used by nacl. - * - * @param msgHex - The string to convert. - * @returns The converted string. - */ -function naclDecodeHex(msgHex) { - const msgBase64 = Buffer.from(msgHex, 'hex').toString('base64'); - return naclUtil.decodeBase64(msgBase64); -} //# sourceMappingURL=encryption.js.map /***/ }), @@ -4217,7 +4591,7 @@ const util_1 = __webpack_require__(68683); const abi_utils_1 = __webpack_require__(93256); const parsers_1 = __webpack_require__(46207); const utils_1 = __webpack_require__(26365); -const utils_2 = __webpack_require__(22049); +const utils_2 = __webpack_require__(52367); const keccak_1 = __webpack_require__(32019); const utils_3 = __webpack_require__(54907); /** @@ -4625,9 +4999,6 @@ function normalizeValue(type, value) { return value.map((item) => normalizeValue(innerType, item)); } if (type === 'address') { - if (typeof value === 'number') { - return (0, utils_1.padStart)((0, utils_2.numberToBytes)(value), 20); - } if ((0, utils_2.isStrictHexString)(value)) { return (0, utils_1.padStart)((0, utils_2.hexToBytes)(value).subarray(0, 20), 20); } @@ -4845,12 +5216,12 @@ exports.recoverTypedSignature = recoverTypedSignature; /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.normalize = exports.recoverPublicKey = exports.concatSig = exports.legacyToBuffer = exports.isNullish = exports.padWithZeroes = void 0; const util_1 = __webpack_require__(68683); -const utils_1 = __webpack_require__(22049); +const utils_1 = __webpack_require__(52367); /** * Pads the front of the given hex string with zeroes until it reaches the * target length. If the input string is already longer than or equal to the @@ -4956,2321 +5327,2686 @@ exports.normalize = normalize; /***/ }), -/***/ 61275: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ 52139: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -"use strict"; -Object.defineProperty(exports, "__esModule", ({value: true})); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/logging.ts -var _debug = __webpack_require__(17833); var _debug2 = _interopRequireDefault(_debug); -var globalLogger = _debug2.default.call(void 0, "metamask"); -function createProjectLogger(projectName) { - return globalLogger.extend(projectName); -} -function createModuleLogger(projectLogger, moduleName) { - return projectLogger.extend(moduleName); -} +const ANY = Symbol('SemVer ANY') +// hoisted class for cyclic dependency +class Comparator { + static get ANY () { + return ANY + } + constructor (comp, options) { + options = parseOptions(options) - - -exports.createProjectLogger = createProjectLogger; exports.createModuleLogger = createModuleLogger; -//# sourceMappingURL=chunk-2LBGT4GH.js.map - -/***/ }), - -/***/ 85244: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; -Object.defineProperty(exports, "__esModule", ({value: true}));var __accessCheck = (obj, member, msg) => { - if (!member.has(obj)) - throw TypeError("Cannot " + msg); -}; -var __privateGet = (obj, member, getter) => { - __accessCheck(obj, member, "read from private field"); - return getter ? getter.call(obj) : member.get(obj); -}; -var __privateAdd = (obj, member, value) => { - if (member.has(obj)) - throw TypeError("Cannot add the same private member more than once"); - member instanceof WeakSet ? member.add(obj) : member.set(obj, value); -}; -var __privateSet = (obj, member, value, setter) => { - __accessCheck(obj, member, "write to private field"); - setter ? setter.call(obj, value) : member.set(obj, value); - return value; -}; - - - - - -exports.__privateGet = __privateGet; exports.__privateAdd = __privateAdd; exports.__privateSet = __privateSet; -//# sourceMappingURL=chunk-3W5G4CYI.js.map - -/***/ }), - -/***/ 73631: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; -Object.defineProperty(exports, "__esModule", ({value: true})); - -var _chunk6ZDHSOUVjs = __webpack_require__(40932); - -// src/versions.ts - - - - - - -var _semver = __webpack_require__(99589); -var _superstruct = __webpack_require__(2150); -var VersionStruct = _superstruct.refine.call(void 0, - _superstruct.string.call(void 0, ), - "Version", - (value) => { - if (_semver.valid.call(void 0, value) === null) { - return `Expected SemVer version, got "${value}"`; + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp + } else { + comp = comp.value + } } - return true; - } -); -var VersionRangeStruct = _superstruct.refine.call(void 0, - _superstruct.string.call(void 0, ), - "Version range", - (value) => { - if (_semver.validRange.call(void 0, value) === null) { - return `Expected SemVer range, got "${value}"`; - } - return true; - } -); -function isValidSemVerVersion(version) { - return _superstruct.is.call(void 0, version, VersionStruct); -} -function isValidSemVerRange(versionRange) { - return _superstruct.is.call(void 0, versionRange, VersionRangeStruct); -} -function assertIsSemVerVersion(version) { - _chunk6ZDHSOUVjs.assertStruct.call(void 0, version, VersionStruct); -} -function assertIsSemVerRange(range) { - _chunk6ZDHSOUVjs.assertStruct.call(void 0, range, VersionRangeStruct); -} -function gtVersion(version1, version2) { - return _semver.gt.call(void 0, version1, version2); -} -function gtRange(version, range) { - return _semver.gtr.call(void 0, version, range); -} -function satisfiesVersionRange(version, versionRange) { - return _semver.satisfies.call(void 0, version, versionRange, { - includePrerelease: true - }); -} + comp = comp.trim().split(/\s+/).join(' ') + debug('comparator', comp, options) + this.options = options + this.loose = !!options.loose + this.parse(comp) - - - - - - - - - -exports.VersionStruct = VersionStruct; exports.VersionRangeStruct = VersionRangeStruct; exports.isValidSemVerVersion = isValidSemVerVersion; exports.isValidSemVerRange = isValidSemVerRange; exports.assertIsSemVerVersion = assertIsSemVerVersion; exports.assertIsSemVerRange = assertIsSemVerRange; exports.gtVersion = gtVersion; exports.gtRange = gtRange; exports.satisfiesVersionRange = satisfiesVersionRange; -//# sourceMappingURL=chunk-4D6XQBHA.js.map - -/***/ }), - -/***/ 69116: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; -Object.defineProperty(exports, "__esModule", ({value: true}));// src/time.ts -var Duration = /* @__PURE__ */ ((Duration2) => { - Duration2[Duration2["Millisecond"] = 1] = "Millisecond"; - Duration2[Duration2["Second"] = 1e3] = "Second"; - Duration2[Duration2["Minute"] = 6e4] = "Minute"; - Duration2[Duration2["Hour"] = 36e5] = "Hour"; - Duration2[Duration2["Day"] = 864e5] = "Day"; - Duration2[Duration2["Week"] = 6048e5] = "Week"; - Duration2[Duration2["Year"] = 31536e6] = "Year"; - return Duration2; -})(Duration || {}); -var isNonNegativeInteger = (number) => Number.isInteger(number) && number >= 0; -var assertIsNonNegativeInteger = (number, name) => { - if (!isNonNegativeInteger(number)) { - throw new Error( - `"${name}" must be a non-negative integer. Received: "${number}".` - ); - } -}; -function inMilliseconds(count, duration) { - assertIsNonNegativeInteger(count, "count"); - return count * duration; -} -function timeSince(timestamp) { - assertIsNonNegativeInteger(timestamp, "timestamp"); - return Date.now() - timestamp; -} - - - - - -exports.Duration = Duration; exports.inMilliseconds = inMilliseconds; exports.timeSince = timeSince; -//# sourceMappingURL=chunk-4RMX5YWE.js.map - -/***/ }), - -/***/ 87982: -/***/ (() => { - -"use strict"; -//# sourceMappingURL=chunk-5AVWINSB.js.map - -/***/ }), - -/***/ 21848: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; -Object.defineProperty(exports, "__esModule", ({value: true})); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } - -var _chunk6ZDHSOUVjs = __webpack_require__(40932); - -// src/base64.ts -var _superstruct = __webpack_require__(2150); -var base64 = (struct, options = {}) => { - const paddingRequired = _nullishCoalesce(options.paddingRequired, () => ( false)); - const characterSet = _nullishCoalesce(options.characterSet, () => ( "base64")); - let letters; - if (characterSet === "base64") { - letters = String.raw`[A-Za-z0-9+\/]`; - } else { - _chunk6ZDHSOUVjs.assert.call(void 0, characterSet === "base64url"); - letters = String.raw`[-_A-Za-z0-9]`; - } - let re; - if (paddingRequired) { - re = new RegExp( - `^(?:${letters}{4})*(?:${letters}{3}=|${letters}{2}==)?$`, - "u" - ); - } else { - re = new RegExp( - `^(?:${letters}{4})*(?:${letters}{2,3}|${letters}{3}=|${letters}{2}==)?$`, - "u" - ); - } - return _superstruct.pattern.call(void 0, struct, re); -}; - - - -exports.base64 = base64; -//# sourceMappingURL=chunk-6NZW4WK4.js.map - -/***/ }), - -/***/ 40932: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; -Object.defineProperty(exports, "__esModule", ({value: true})); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } - -var _chunkIZC266HSjs = __webpack_require__(1486); - -// src/assert.ts -var _superstruct = __webpack_require__(2150); -function isConstructable(fn) { - return Boolean(typeof _optionalChain([fn, 'optionalAccess', _ => _.prototype, 'optionalAccess', _2 => _2.constructor, 'optionalAccess', _3 => _3.name]) === "string"); -} -function getErrorMessageWithoutTrailingPeriod(error) { - return _chunkIZC266HSjs.getErrorMessage.call(void 0, error).replace(/\.$/u, ""); -} -function getError(ErrorWrapper, message) { - if (isConstructable(ErrorWrapper)) { - return new ErrorWrapper({ - message - }); - } - return ErrorWrapper({ - message - }); -} -var AssertionError = class extends Error { - constructor(options) { - super(options.message); - this.code = "ERR_ASSERTION"; - } -}; -function assert(value, message = "Assertion failed.", ErrorWrapper = AssertionError) { - if (!value) { - if (message instanceof Error) { - throw message; - } - throw getError(ErrorWrapper, message); - } -} -function assertStruct(value, struct, errorPrefix = "Assertion failed", ErrorWrapper = AssertionError) { - try { - _superstruct.assert.call(void 0, value, struct); - } catch (error) { - throw getError( - ErrorWrapper, - `${errorPrefix}: ${getErrorMessageWithoutTrailingPeriod(error)}.` - ); - } -} -function assertExhaustive(_object) { - throw new Error( - "Invalid branch reached. Should be detected during compilation." - ); -} - - - - - - -exports.AssertionError = AssertionError; exports.assert = assert; exports.assertStruct = assertStruct; exports.assertExhaustive = assertExhaustive; -//# sourceMappingURL=chunk-6ZDHSOUV.js.map - -/***/ }), - -/***/ 39705: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; -Object.defineProperty(exports, "__esModule", ({value: true}));// src/promise.ts -function createDeferredPromise({ - suppressUnhandledRejection = false -} = {}) { - let resolve; - let reject; - const promise = new Promise( - (innerResolve, innerReject) => { - resolve = innerResolve; - reject = innerReject; - } - ); - if (suppressUnhandledRejection) { - promise.catch((_error) => { - }); - } - return { promise, resolve, reject }; -} - - - -exports.createDeferredPromise = createDeferredPromise; -//# sourceMappingURL=chunk-C6HGFEYL.js.map - -/***/ }), - -/***/ 1203: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; -Object.defineProperty(exports, "__esModule", ({value: true})); - - - -var _chunkQEPVHEP7js = __webpack_require__(75363); - - -var _chunk6ZDHSOUVjs = __webpack_require__(40932); - -// src/coercers.ts - - - - - - - - - -var _superstruct = __webpack_require__(2150); -var NumberLikeStruct = _superstruct.union.call(void 0, [_superstruct.number.call(void 0, ), _superstruct.bigint.call(void 0, ), _superstruct.string.call(void 0, ), _chunkQEPVHEP7js.StrictHexStruct]); -var NumberCoercer = _superstruct.coerce.call(void 0, _superstruct.number.call(void 0, ), NumberLikeStruct, Number); -var BigIntCoercer = _superstruct.coerce.call(void 0, _superstruct.bigint.call(void 0, ), NumberLikeStruct, BigInt); -var BytesLikeStruct = _superstruct.union.call(void 0, [_chunkQEPVHEP7js.StrictHexStruct, _superstruct.instance.call(void 0, Uint8Array)]); -var BytesCoercer = _superstruct.coerce.call(void 0, - _superstruct.instance.call(void 0, Uint8Array), - _superstruct.union.call(void 0, [_chunkQEPVHEP7js.StrictHexStruct]), - _chunkQEPVHEP7js.hexToBytes -); -var HexCoercer = _superstruct.coerce.call(void 0, _chunkQEPVHEP7js.StrictHexStruct, _superstruct.instance.call(void 0, Uint8Array), _chunkQEPVHEP7js.bytesToHex); -function createNumber(value) { - try { - const result = _superstruct.create.call(void 0, value, NumberCoercer); - _chunk6ZDHSOUVjs.assert.call(void 0, - Number.isFinite(result), - `Expected a number-like value, got "${value}".` - ); - return result; - } catch (error) { - if (error instanceof _superstruct.StructError) { - throw new Error(`Expected a number-like value, got "${value}".`); - } - throw error; - } -} -function createBigInt(value) { - try { - return _superstruct.create.call(void 0, value, BigIntCoercer); - } catch (error) { - if (error instanceof _superstruct.StructError) { - throw new Error( - `Expected a number-like value, got "${String(error.value)}".` - ); - } - throw error; - } -} -function createBytes(value) { - if (typeof value === "string" && value.toLowerCase() === "0x") { - return new Uint8Array(); - } - try { - return _superstruct.create.call(void 0, value, BytesCoercer); - } catch (error) { - if (error instanceof _superstruct.StructError) { - throw new Error( - `Expected a bytes-like value, got "${String(error.value)}".` - ); - } - throw error; - } -} -function createHex(value) { - if (value instanceof Uint8Array && value.length === 0 || typeof value === "string" && value.toLowerCase() === "0x") { - return "0x"; - } - try { - return _superstruct.create.call(void 0, value, HexCoercer); - } catch (error) { - if (error instanceof _superstruct.StructError) { - throw new Error( - `Expected a bytes-like value, got "${String(error.value)}".` - ); - } - throw error; - } -} - - - - - - -exports.createNumber = createNumber; exports.createBigInt = createBigInt; exports.createBytes = createBytes; exports.createHex = createHex; -//# sourceMappingURL=chunk-DHVKFDHQ.js.map - -/***/ }), - -/***/ 1508: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; -Object.defineProperty(exports, "__esModule", ({value: true})); - -var _chunk6NZW4WK4js = __webpack_require__(21848); - -// src/checksum.ts -var _superstruct = __webpack_require__(2150); -var ChecksumStruct = _superstruct.size.call(void 0, - _chunk6NZW4WK4js.base64.call(void 0, _superstruct.string.call(void 0, ), { paddingRequired: true }), - 44, - 44 -); - - - -exports.ChecksumStruct = ChecksumStruct; -//# sourceMappingURL=chunk-E4C7EW4R.js.map - -/***/ }), - -/***/ 51423: -/***/ (() => { - -"use strict"; -//# sourceMappingURL=chunk-EQMZL4XU.js.map - -/***/ }), - -/***/ 1486: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; -Object.defineProperty(exports, "__esModule", ({value: true})); - - -var _chunkQVEKZRZ2js = __webpack_require__(96526); - -// src/errors.ts -var _ponycause = __webpack_require__(71843); -function isError(error) { - return error instanceof Error || _chunkQVEKZRZ2js.isObject.call(void 0, error) && error.constructor.name === "Error"; -} -function isErrorWithCode(error) { - return typeof error === "object" && error !== null && "code" in error; -} -function isErrorWithMessage(error) { - return typeof error === "object" && error !== null && "message" in error; -} -function isErrorWithStack(error) { - return typeof error === "object" && error !== null && "stack" in error; -} -function getErrorMessage(error) { - if (isErrorWithMessage(error) && typeof error.message === "string") { - return error.message; - } - if (_chunkQVEKZRZ2js.isNullOrUndefined.call(void 0, error)) { - return ""; - } - return String(error); -} -function wrapError(originalError, message) { - if (isError(originalError)) { - let error; - if (Error.length === 2) { - error = new Error(message, { cause: originalError }); + if (this.semver === ANY) { + this.value = '' } else { - error = new (0, _ponycause.ErrorWithCause)(message, { cause: originalError }); + this.value = this.operator + this.semver.version } - if (isErrorWithCode(originalError)) { - error.code = originalError.code; + + debug('comp', this) + } + + parse (comp) { + const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + const m = comp.match(r) + + if (!m) { + throw new TypeError(`Invalid comparator: ${comp}`) + } + + this.operator = m[1] !== undefined ? m[1] : '' + if (this.operator === '=') { + this.operator = '' + } + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) { + this.semver = ANY + } else { + this.semver = new SemVer(m[2], this.options.loose) } - return error; } - if (message.length > 0) { - return new Error(`${String(originalError)}: ${message}`); + + toString () { + return this.value } - return new Error(String(originalError)); -} + test (version) { + debug('Comparator.test', version, this.options.loose) + if (this.semver === ANY || version === ANY) { + return true + } - - - - -exports.isErrorWithCode = isErrorWithCode; exports.isErrorWithMessage = isErrorWithMessage; exports.isErrorWithStack = isErrorWithStack; exports.getErrorMessage = getErrorMessage; exports.wrapError = wrapError; -//# sourceMappingURL=chunk-IZC266HS.js.map - -/***/ }), - -/***/ 58383: -/***/ (() => { - -"use strict"; -//# sourceMappingURL=chunk-LC2CRSWD.js.map - -/***/ }), - -/***/ 87427: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; -Object.defineProperty(exports, "__esModule", ({value: true})); - -var _chunk6ZDHSOUVjs = __webpack_require__(40932); - - -var _chunkQVEKZRZ2js = __webpack_require__(96526); - -// src/json.ts - - - - - - - - - - - - - - - - - - - - -var _superstruct = __webpack_require__(2150); -var object = (schema) => ( - // The type is slightly different from a regular object struct, because we - // want to make properties with `undefined` in their type optional, but not - // `undefined` itself. This means that we need a type cast. - _superstruct.object.call(void 0, schema) -); -function hasOptional({ path, branch }) { - const field = path[path.length - 1]; - return _chunkQVEKZRZ2js.hasProperty.call(void 0, branch[branch.length - 2], field); -} -function exactOptional(struct) { - return new (0, _superstruct.Struct)({ - ...struct, - type: `optional ${struct.type}`, - validator: (value, context) => !hasOptional(context) || struct.validator(value, context), - refiner: (value, context) => !hasOptional(context) || struct.refiner(value, context) - }); -} -var finiteNumber = () => _superstruct.define.call(void 0, "finite number", (value) => { - return _superstruct.is.call(void 0, value, _superstruct.number.call(void 0, )) && Number.isFinite(value); -}); -var UnsafeJsonStruct = _superstruct.union.call(void 0, [ - _superstruct.literal.call(void 0, null), - _superstruct.boolean.call(void 0, ), - finiteNumber(), - _superstruct.string.call(void 0, ), - _superstruct.array.call(void 0, _superstruct.lazy.call(void 0, () => UnsafeJsonStruct)), - _superstruct.record.call(void 0, - _superstruct.string.call(void 0, ), - _superstruct.lazy.call(void 0, () => UnsafeJsonStruct) - ) -]); -var JsonStruct = _superstruct.coerce.call(void 0, UnsafeJsonStruct, _superstruct.any.call(void 0, ), (value) => { - _chunk6ZDHSOUVjs.assertStruct.call(void 0, value, UnsafeJsonStruct); - return JSON.parse( - JSON.stringify(value, (propKey, propValue) => { - if (propKey === "__proto__" || propKey === "constructor") { - return void 0; + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false } - return propValue; + } + + return cmp(version, this.operator, this.semver, this.options) + } + + intersects (comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required') + } + + if (this.operator === '') { + if (this.value === '') { + return true + } + return new Range(comp.value, options).test(this.value) + } else if (comp.operator === '') { + if (comp.value === '') { + return true + } + return new Range(this.value, options).test(comp.semver) + } + + options = parseOptions(options) + + // Special cases where nothing can possibly be lower + if (options.includePrerelease && + (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) { + return false + } + if (!options.includePrerelease && + (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) { + return false + } + + // Same direction increasing (> or >=) + if (this.operator.startsWith('>') && comp.operator.startsWith('>')) { + return true + } + // Same direction decreasing (< or <=) + if (this.operator.startsWith('<') && comp.operator.startsWith('<')) { + return true + } + // same SemVer and both sides are inclusive (<= or >=) + if ( + (this.semver.version === comp.semver.version) && + this.operator.includes('=') && comp.operator.includes('=')) { + return true + } + // opposite directions less than + if (cmp(this.semver, '<', comp.semver, options) && + this.operator.startsWith('>') && comp.operator.startsWith('<')) { + return true + } + // opposite directions greater than + if (cmp(this.semver, '>', comp.semver, options) && + this.operator.startsWith('<') && comp.operator.startsWith('>')) { + return true + } + return false + } +} + +module.exports = Comparator + +const parseOptions = __webpack_require__(69932) +const { safeRe: re, t } = __webpack_require__(34567) +const cmp = __webpack_require__(73646) +const debug = __webpack_require__(52207) +const SemVer = __webpack_require__(64739) +const Range = __webpack_require__(25926) + + +/***/ }), + +/***/ 25926: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SPACE_CHARACTERS = /\s+/g + +// hoisted class for cyclic dependency +class Range { + constructor (range, options) { + options = parseOptions(options) + + if (range instanceof Range) { + if ( + range.loose === !!options.loose && + range.includePrerelease === !!options.includePrerelease + ) { + return range + } else { + return new Range(range.raw, options) + } + } + + if (range instanceof Comparator) { + // just put it in the set and return + this.raw = range.value + this.set = [[range]] + this.formatted = undefined + return this + } + + this.options = options + this.loose = !!options.loose + this.includePrerelease = !!options.includePrerelease + + // First reduce all whitespace as much as possible so we do not have to rely + // on potentially slow regexes like \s*. This is then stored and used for + // future error messages as well. + this.raw = range.trim().replace(SPACE_CHARACTERS, ' ') + + // First, split on || + this.set = this.raw + .split('||') + // map the range to a 2d array of comparators + .map(r => this.parseRange(r.trim())) + // throw out any comparator lists that are empty + // this generally means that it was not a valid range, which is allowed + // in loose mode, but will still throw if the WHOLE range is invalid. + .filter(c => c.length) + + if (!this.set.length) { + throw new TypeError(`Invalid SemVer Range: ${this.raw}`) + } + + // if we have any that are not the null set, throw out null sets. + if (this.set.length > 1) { + // keep the first one, in case they're all null sets + const first = this.set[0] + this.set = this.set.filter(c => !isNullSet(c[0])) + if (this.set.length === 0) { + this.set = [first] + } else if (this.set.length > 1) { + // if we have any that are *, then the range is just * + for (const c of this.set) { + if (c.length === 1 && isAny(c[0])) { + this.set = [c] + break + } + } + } + } + + this.formatted = undefined + } + + get range () { + if (this.formatted === undefined) { + this.formatted = '' + for (let i = 0; i < this.set.length; i++) { + if (i > 0) { + this.formatted += '||' + } + const comps = this.set[i] + for (let k = 0; k < comps.length; k++) { + if (k > 0) { + this.formatted += ' ' + } + this.formatted += comps[k].toString().trim() + } + } + } + return this.formatted + } + + format () { + return this.range + } + + toString () { + return this.range + } + + parseRange (range) { + // memoize range parsing for performance. + // this is a very hot path, and fully deterministic. + const memoOpts = + (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | + (this.options.loose && FLAG_LOOSE) + const memoKey = memoOpts + ':' + range + const cached = cache.get(memoKey) + if (cached) { + return cached + } + + const loose = this.options.loose + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] + range = range.replace(hr, hyphenReplace(this.options.includePrerelease)) + debug('hyphen replace', range) + + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range) + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(re[t.TILDETRIM], tildeTrimReplace) + debug('tilde trim', range) + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(re[t.CARETTRIM], caretTrimReplace) + debug('caret trim', range) + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + let rangeList = range + .split(' ') + .map(comp => parseComparator(comp, this.options)) + .join(' ') + .split(/\s+/) + // >=0.0.0 is equivalent to * + .map(comp => replaceGTE0(comp, this.options)) + + if (loose) { + // in loose mode, throw out any that are not valid comparators + rangeList = rangeList.filter(comp => { + debug('loose invalid filter', comp, this.options) + return !!comp.match(re[t.COMPARATORLOOSE]) + }) + } + debug('range list', rangeList) + + // if any comparators are the null set, then replace with JUST null set + // if more than one comparator, remove any * comparators + // also, don't include the same comparator more than once + const rangeMap = new Map() + const comparators = rangeList.map(comp => new Comparator(comp, this.options)) + for (const comp of comparators) { + if (isNullSet(comp)) { + return [comp] + } + rangeMap.set(comp.value, comp) + } + if (rangeMap.size > 1 && rangeMap.has('')) { + rangeMap.delete('') + } + + const result = [...rangeMap.values()] + cache.set(memoKey, result) + return result + } + + intersects (range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required') + } + + return this.set.some((thisComparators) => { + return ( + isSatisfiable(thisComparators, options) && + range.set.some((rangeComparators) => { + return ( + isSatisfiable(rangeComparators, options) && + thisComparators.every((thisComparator) => { + return rangeComparators.every((rangeComparator) => { + return thisComparator.intersects(rangeComparator, options) + }) + }) + ) + }) + ) }) - ); -}); -function isValidJson(value) { - try { - getSafeJson(value); - return true; - } catch (e) { - return false; } -} -function getSafeJson(value) { - return _superstruct.create.call(void 0, value, JsonStruct); -} -function getJsonSize(value) { - _chunk6ZDHSOUVjs.assertStruct.call(void 0, value, JsonStruct, "Invalid JSON value"); - const json = JSON.stringify(value); - return new TextEncoder().encode(json).byteLength; -} -var jsonrpc2 = "2.0"; -var JsonRpcVersionStruct = _superstruct.literal.call(void 0, jsonrpc2); -var JsonRpcIdStruct = _superstruct.nullable.call(void 0, _superstruct.union.call(void 0, [_superstruct.number.call(void 0, ), _superstruct.string.call(void 0, )])); -var JsonRpcErrorStruct = object({ - code: _superstruct.integer.call(void 0, ), - message: _superstruct.string.call(void 0, ), - data: exactOptional(JsonStruct), - stack: exactOptional(_superstruct.string.call(void 0, )) -}); -var JsonRpcParamsStruct = _superstruct.union.call(void 0, [_superstruct.record.call(void 0, _superstruct.string.call(void 0, ), JsonStruct), _superstruct.array.call(void 0, JsonStruct)]); -var JsonRpcRequestStruct = object({ - id: JsonRpcIdStruct, - jsonrpc: JsonRpcVersionStruct, - method: _superstruct.string.call(void 0, ), - params: exactOptional(JsonRpcParamsStruct) -}); -var JsonRpcNotificationStruct = object({ - jsonrpc: JsonRpcVersionStruct, - method: _superstruct.string.call(void 0, ), - params: exactOptional(JsonRpcParamsStruct) -}); -function isJsonRpcNotification(value) { - return _superstruct.is.call(void 0, value, JsonRpcNotificationStruct); -} -function assertIsJsonRpcNotification(value, ErrorWrapper) { - _chunk6ZDHSOUVjs.assertStruct.call(void 0, - value, - JsonRpcNotificationStruct, - "Invalid JSON-RPC notification", - ErrorWrapper - ); -} -function isJsonRpcRequest(value) { - return _superstruct.is.call(void 0, value, JsonRpcRequestStruct); -} -function assertIsJsonRpcRequest(value, ErrorWrapper) { - _chunk6ZDHSOUVjs.assertStruct.call(void 0, - value, - JsonRpcRequestStruct, - "Invalid JSON-RPC request", - ErrorWrapper - ); -} -var PendingJsonRpcResponseStruct = _superstruct.object.call(void 0, { - id: JsonRpcIdStruct, - jsonrpc: JsonRpcVersionStruct, - result: _superstruct.optional.call(void 0, _superstruct.unknown.call(void 0, )), - error: _superstruct.optional.call(void 0, JsonRpcErrorStruct) -}); -var JsonRpcSuccessStruct = object({ - id: JsonRpcIdStruct, - jsonrpc: JsonRpcVersionStruct, - result: JsonStruct -}); -var JsonRpcFailureStruct = object({ - id: JsonRpcIdStruct, - jsonrpc: JsonRpcVersionStruct, - error: JsonRpcErrorStruct -}); -var JsonRpcResponseStruct = _superstruct.union.call(void 0, [ - JsonRpcSuccessStruct, - JsonRpcFailureStruct -]); -function isPendingJsonRpcResponse(response) { - return _superstruct.is.call(void 0, response, PendingJsonRpcResponseStruct); -} -function assertIsPendingJsonRpcResponse(response, ErrorWrapper) { - _chunk6ZDHSOUVjs.assertStruct.call(void 0, - response, - PendingJsonRpcResponseStruct, - "Invalid pending JSON-RPC response", - ErrorWrapper - ); -} -function isJsonRpcResponse(response) { - return _superstruct.is.call(void 0, response, JsonRpcResponseStruct); -} -function assertIsJsonRpcResponse(value, ErrorWrapper) { - _chunk6ZDHSOUVjs.assertStruct.call(void 0, - value, - JsonRpcResponseStruct, - "Invalid JSON-RPC response", - ErrorWrapper - ); -} -function isJsonRpcSuccess(value) { - return _superstruct.is.call(void 0, value, JsonRpcSuccessStruct); -} -function assertIsJsonRpcSuccess(value, ErrorWrapper) { - _chunk6ZDHSOUVjs.assertStruct.call(void 0, - value, - JsonRpcSuccessStruct, - "Invalid JSON-RPC success response", - ErrorWrapper - ); -} -function isJsonRpcFailure(value) { - return _superstruct.is.call(void 0, value, JsonRpcFailureStruct); -} -function assertIsJsonRpcFailure(value, ErrorWrapper) { - _chunk6ZDHSOUVjs.assertStruct.call(void 0, - value, - JsonRpcFailureStruct, - "Invalid JSON-RPC failure response", - ErrorWrapper - ); -} -function isJsonRpcError(value) { - return _superstruct.is.call(void 0, value, JsonRpcErrorStruct); -} -function assertIsJsonRpcError(value, ErrorWrapper) { - _chunk6ZDHSOUVjs.assertStruct.call(void 0, - value, - JsonRpcErrorStruct, - "Invalid JSON-RPC error", - ErrorWrapper - ); -} -function getJsonRpcIdValidator(options) { - const { permitEmptyString, permitFractions, permitNull } = { - permitEmptyString: true, - permitFractions: false, - permitNull: true, - ...options - }; - const isValidJsonRpcId = (id) => { - return Boolean( - typeof id === "number" && (permitFractions || Number.isInteger(id)) || typeof id === "string" && (permitEmptyString || id.length > 0) || permitNull && id === null - ); - }; - return isValidJsonRpcId; -} + // if ANY of the sets match ALL of its comparators, then pass + test (version) { + if (!version) { + return false + } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -exports.object = object; exports.exactOptional = exactOptional; exports.UnsafeJsonStruct = UnsafeJsonStruct; exports.JsonStruct = JsonStruct; exports.isValidJson = isValidJson; exports.getSafeJson = getSafeJson; exports.getJsonSize = getJsonSize; exports.jsonrpc2 = jsonrpc2; exports.JsonRpcVersionStruct = JsonRpcVersionStruct; exports.JsonRpcIdStruct = JsonRpcIdStruct; exports.JsonRpcErrorStruct = JsonRpcErrorStruct; exports.JsonRpcParamsStruct = JsonRpcParamsStruct; exports.JsonRpcRequestStruct = JsonRpcRequestStruct; exports.JsonRpcNotificationStruct = JsonRpcNotificationStruct; exports.isJsonRpcNotification = isJsonRpcNotification; exports.assertIsJsonRpcNotification = assertIsJsonRpcNotification; exports.isJsonRpcRequest = isJsonRpcRequest; exports.assertIsJsonRpcRequest = assertIsJsonRpcRequest; exports.PendingJsonRpcResponseStruct = PendingJsonRpcResponseStruct; exports.JsonRpcSuccessStruct = JsonRpcSuccessStruct; exports.JsonRpcFailureStruct = JsonRpcFailureStruct; exports.JsonRpcResponseStruct = JsonRpcResponseStruct; exports.isPendingJsonRpcResponse = isPendingJsonRpcResponse; exports.assertIsPendingJsonRpcResponse = assertIsPendingJsonRpcResponse; exports.isJsonRpcResponse = isJsonRpcResponse; exports.assertIsJsonRpcResponse = assertIsJsonRpcResponse; exports.isJsonRpcSuccess = isJsonRpcSuccess; exports.assertIsJsonRpcSuccess = assertIsJsonRpcSuccess; exports.isJsonRpcFailure = isJsonRpcFailure; exports.assertIsJsonRpcFailure = assertIsJsonRpcFailure; exports.isJsonRpcError = isJsonRpcError; exports.assertIsJsonRpcError = assertIsJsonRpcError; exports.getJsonRpcIdValidator = getJsonRpcIdValidator; -//# sourceMappingURL=chunk-OLLG4H35.js.map - -/***/ }), - -/***/ 75363: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; -Object.defineProperty(exports, "__esModule", ({value: true})); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } - -var _chunk6ZDHSOUVjs = __webpack_require__(40932); - -// src/hex.ts -var _sha3 = __webpack_require__(2214); -var _superstruct = __webpack_require__(2150); - -// src/bytes.ts -var _base = __webpack_require__(63203); -var HEX_MINIMUM_NUMBER_CHARACTER = 48; -var HEX_MAXIMUM_NUMBER_CHARACTER = 58; -var HEX_CHARACTER_OFFSET = 87; -function getPrecomputedHexValuesBuilder() { - const lookupTable = []; - return () => { - if (lookupTable.length === 0) { - for (let i = 0; i < 256; i++) { - lookupTable.push(i.toString(16).padStart(2, "0")); + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false } } - return lookupTable; - }; -} -var getPrecomputedHexValues = getPrecomputedHexValuesBuilder(); -function isBytes(value) { - return value instanceof Uint8Array; -} -function assertIsBytes(value) { - _chunk6ZDHSOUVjs.assert.call(void 0, isBytes(value), "Value must be a Uint8Array."); -} -function bytesToHex(bytes) { - assertIsBytes(bytes); - if (bytes.length === 0) { - return "0x"; - } - const lookupTable = getPrecomputedHexValues(); - const hexadecimal = new Array(bytes.length); - for (let i = 0; i < bytes.length; i++) { - hexadecimal[i] = lookupTable[bytes[i]]; - } - return add0x(hexadecimal.join("")); -} -function bytesToBigInt(bytes) { - assertIsBytes(bytes); - const hexadecimal = bytesToHex(bytes); - return BigInt(hexadecimal); -} -function bytesToSignedBigInt(bytes) { - assertIsBytes(bytes); - let value = BigInt(0); - for (const byte of bytes) { - value = (value << BigInt(8)) + BigInt(byte); - } - return BigInt.asIntN(bytes.length * 8, value); -} -function bytesToNumber(bytes) { - assertIsBytes(bytes); - const bigint = bytesToBigInt(bytes); - _chunk6ZDHSOUVjs.assert.call(void 0, - bigint <= BigInt(Number.MAX_SAFE_INTEGER), - "Number is not a safe integer. Use `bytesToBigInt` instead." - ); - return Number(bigint); -} -function bytesToString(bytes) { - assertIsBytes(bytes); - return new TextDecoder().decode(bytes); -} -function bytesToBase64(bytes) { - assertIsBytes(bytes); - return _base.base64.encode(bytes); -} -function hexToBytes(value) { - if (_optionalChain([value, 'optionalAccess', _ => _.toLowerCase, 'optionalCall', _2 => _2()]) === "0x") { - return new Uint8Array(); - } - assertIsHexString(value); - const strippedValue = remove0x(value).toLowerCase(); - const normalizedValue = strippedValue.length % 2 === 0 ? strippedValue : `0${strippedValue}`; - const bytes = new Uint8Array(normalizedValue.length / 2); - for (let i = 0; i < bytes.length; i++) { - const c1 = normalizedValue.charCodeAt(i * 2); - const c2 = normalizedValue.charCodeAt(i * 2 + 1); - const n1 = c1 - (c1 < HEX_MAXIMUM_NUMBER_CHARACTER ? HEX_MINIMUM_NUMBER_CHARACTER : HEX_CHARACTER_OFFSET); - const n2 = c2 - (c2 < HEX_MAXIMUM_NUMBER_CHARACTER ? HEX_MINIMUM_NUMBER_CHARACTER : HEX_CHARACTER_OFFSET); - bytes[i] = n1 * 16 + n2; - } - return bytes; -} -function bigIntToBytes(value) { - _chunk6ZDHSOUVjs.assert.call(void 0, typeof value === "bigint", "Value must be a bigint."); - _chunk6ZDHSOUVjs.assert.call(void 0, value >= BigInt(0), "Value must be a non-negative bigint."); - const hexadecimal = value.toString(16); - return hexToBytes(hexadecimal); -} -function bigIntFits(value, bytes) { - _chunk6ZDHSOUVjs.assert.call(void 0, bytes > 0); - const mask = value >> BigInt(31); - return !((~value & mask) + (value & ~mask) >> BigInt(bytes * 8 + ~0)); -} -function signedBigIntToBytes(value, byteLength) { - _chunk6ZDHSOUVjs.assert.call(void 0, typeof value === "bigint", "Value must be a bigint."); - _chunk6ZDHSOUVjs.assert.call(void 0, typeof byteLength === "number", "Byte length must be a number."); - _chunk6ZDHSOUVjs.assert.call(void 0, byteLength > 0, "Byte length must be greater than 0."); - _chunk6ZDHSOUVjs.assert.call(void 0, - bigIntFits(value, byteLength), - "Byte length is too small to represent the given value." - ); - let numberValue = value; - const bytes = new Uint8Array(byteLength); - for (let i = 0; i < bytes.length; i++) { - bytes[i] = Number(BigInt.asUintN(8, numberValue)); - numberValue >>= BigInt(8); - } - return bytes.reverse(); -} -function numberToBytes(value) { - _chunk6ZDHSOUVjs.assert.call(void 0, typeof value === "number", "Value must be a number."); - _chunk6ZDHSOUVjs.assert.call(void 0, value >= 0, "Value must be a non-negative number."); - _chunk6ZDHSOUVjs.assert.call(void 0, - Number.isSafeInteger(value), - "Value is not a safe integer. Use `bigIntToBytes` instead." - ); - const hexadecimal = value.toString(16); - return hexToBytes(hexadecimal); -} -function stringToBytes(value) { - _chunk6ZDHSOUVjs.assert.call(void 0, typeof value === "string", "Value must be a string."); - return new TextEncoder().encode(value); -} -function base64ToBytes(value) { - _chunk6ZDHSOUVjs.assert.call(void 0, typeof value === "string", "Value must be a string."); - return _base.base64.decode(value); -} -function valueToBytes(value) { - if (typeof value === "bigint") { - return bigIntToBytes(value); - } - if (typeof value === "number") { - return numberToBytes(value); - } - if (typeof value === "string") { - if (value.startsWith("0x")) { - return hexToBytes(value); + + for (let i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true + } } - return stringToBytes(value); + return false } - if (isBytes(value)) { - return value; +} + +module.exports = Range + +const LRU = __webpack_require__(97228) +const cache = new LRU() + +const parseOptions = __webpack_require__(69932) +const Comparator = __webpack_require__(52139) +const debug = __webpack_require__(52207) +const SemVer = __webpack_require__(64739) +const { + safeRe: re, + t, + comparatorTrimReplace, + tildeTrimReplace, + caretTrimReplace, +} = __webpack_require__(34567) +const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = __webpack_require__(35237) + +const isNullSet = c => c.value === '<0.0.0-0' +const isAny = c => c.value === '' + +// take a set of comparators and determine whether there +// exists a version which can satisfy it +const isSatisfiable = (comparators, options) => { + let result = true + const remainingComparators = comparators.slice() + let testComparator = remainingComparators.pop() + + while (result && remainingComparators.length) { + result = remainingComparators.every((otherComparator) => { + return testComparator.intersects(otherComparator, options) + }) + + testComparator = remainingComparators.pop() } - throw new TypeError(`Unsupported value type: "${typeof value}".`); + + return result } -function concatBytes(values) { - const normalizedValues = new Array(values.length); - let byteLength = 0; - for (let i = 0; i < values.length; i++) { - const value = valueToBytes(values[i]); - normalizedValues[i] = value; - byteLength += value.length; + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +const parseComparator = (comp, options) => { + debug('comp', comp, options) + comp = replaceCarets(comp, options) + debug('caret', comp) + comp = replaceTildes(comp, options) + debug('tildes', comp) + comp = replaceXRanges(comp, options) + debug('xrange', comp) + comp = replaceStars(comp, options) + debug('stars', comp) + return comp +} + +const isX = id => !id || id.toLowerCase() === 'x' || id === '*' + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0 +// ~0.0.1 --> >=0.0.1 <0.1.0-0 +const replaceTildes = (comp, options) => { + return comp + .trim() + .split(/\s+/) + .map((c) => replaceTilde(c, options)) + .join(' ') +} + +const replaceTilde = (comp, options) => { + const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE] + return comp.replace(r, (_, M, m, p, pr) => { + debug('tilde', comp, _, M, m, p, pr) + let ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = `>=${M}.0.0 <${+M + 1}.0.0-0` + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0-0 + ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0` + } else if (pr) { + debug('replaceTilde pr', pr) + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${+m + 1}.0-0` + } else { + // ~1.2.3 == >=1.2.3 <1.3.0-0 + ret = `>=${M}.${m}.${p + } <${M}.${+m + 1}.0-0` + } + + debug('tilde return', ret) + return ret + }) +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0 +// ^1.2.3 --> >=1.2.3 <2.0.0-0 +// ^1.2.0 --> >=1.2.0 <2.0.0-0 +// ^0.0.1 --> >=0.0.1 <0.0.2-0 +// ^0.1.0 --> >=0.1.0 <0.2.0-0 +const replaceCarets = (comp, options) => { + return comp + .trim() + .split(/\s+/) + .map((c) => replaceCaret(c, options)) + .join(' ') +} + +const replaceCaret = (comp, options) => { + debug('caret', comp, options) + const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET] + const z = options.includePrerelease ? '-0' : '' + return comp.replace(r, (_, M, m, p, pr) => { + debug('caret', comp, _, M, m, p, pr) + let ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0` + } else if (isX(p)) { + if (M === '0') { + ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0` + } else { + ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0` + } + } else if (pr) { + debug('replaceCaret pr', pr) + if (M === '0') { + if (m === '0') { + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${m}.${+p + 1}-0` + } else { + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${+m + 1}.0-0` + } + } else { + ret = `>=${M}.${m}.${p}-${pr + } <${+M + 1}.0.0-0` + } + } else { + debug('no pr') + if (M === '0') { + if (m === '0') { + ret = `>=${M}.${m}.${p + }${z} <${M}.${m}.${+p + 1}-0` + } else { + ret = `>=${M}.${m}.${p + }${z} <${M}.${+m + 1}.0-0` + } + } else { + ret = `>=${M}.${m}.${p + } <${+M + 1}.0.0-0` + } + } + + debug('caret return', ret) + return ret + }) +} + +const replaceXRanges = (comp, options) => { + debug('replaceXRanges', comp, options) + return comp + .split(/\s+/) + .map((c) => replaceXRange(c, options)) + .join(' ') +} + +const replaceXRange = (comp, options) => { + comp = comp.trim() + const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE] + return comp.replace(r, (ret, gtlt, M, m, p, pr) => { + debug('xRange', comp, ret, gtlt, M, m, p, pr) + const xM = isX(M) + const xm = xM || isX(m) + const xp = xm || isX(p) + const anyX = xp + + if (gtlt === '=' && anyX) { + gtlt = '' + } + + // if we're including prereleases in the match, then we need + // to fix this to -0, the lowest possible prerelease value + pr = options.includePrerelease ? '-0' : '' + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0-0' + } else { + // nothing is forbidden + ret = '*' + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0 + } + p = 0 + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + gtlt = '>=' + if (xm) { + M = +M + 1 + m = 0 + p = 0 + } else { + m = +m + 1 + p = 0 + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<' + if (xm) { + M = +M + 1 + } else { + m = +m + 1 + } + } + + if (gtlt === '<') { + pr = '-0' + } + + ret = `${gtlt + M}.${m}.${p}${pr}` + } else if (xm) { + ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0` + } else if (xp) { + ret = `>=${M}.${m}.0${pr + } <${M}.${+m + 1}.0-0` + } + + debug('xRange return', ret) + + return ret + }) +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +const replaceStars = (comp, options) => { + debug('replaceStars', comp, options) + // Looseness is ignored here. star is always as loose as it gets! + return comp + .trim() + .replace(re[t.STAR], '') +} + +const replaceGTE0 = (comp, options) => { + debug('replaceGTE0', comp, options) + return comp + .trim() + .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '') +} + +// This function is passed to string.replace(re[t.HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0-0 +// TODO build? +const hyphenReplace = incPr => ($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr) => { + if (isX(fM)) { + from = '' + } else if (isX(fm)) { + from = `>=${fM}.0.0${incPr ? '-0' : ''}` + } else if (isX(fp)) { + from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}` + } else if (fpr) { + from = `>=${from}` + } else { + from = `>=${from}${incPr ? '-0' : ''}` } - const bytes = new Uint8Array(byteLength); - for (let i = 0, offset = 0; i < normalizedValues.length; i++) { - bytes.set(normalizedValues[i], offset); - offset += normalizedValues[i].length; + + if (isX(tM)) { + to = '' + } else if (isX(tm)) { + to = `<${+tM + 1}.0.0-0` + } else if (isX(tp)) { + to = `<${tM}.${+tm + 1}.0-0` + } else if (tpr) { + to = `<=${tM}.${tm}.${tp}-${tpr}` + } else if (incPr) { + to = `<${tM}.${tm}.${+tp + 1}-0` + } else { + to = `<=${to}` } - return bytes; + + return `${from} ${to}`.trim() } -function createDataView(bytes) { - if (typeof Buffer !== "undefined" && bytes instanceof Buffer) { - const buffer = bytes.buffer.slice( - bytes.byteOffset, - bytes.byteOffset + bytes.byteLength - ); - return new DataView(buffer); + +const testSet = (set, version, options) => { + for (let i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false + } } - return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength); -} -// src/hex.ts -var HexStruct = _superstruct.pattern.call(void 0, _superstruct.string.call(void 0, ), /^(?:0x)?[0-9a-f]+$/iu); -var StrictHexStruct = _superstruct.pattern.call(void 0, _superstruct.string.call(void 0, ), /^0x[0-9a-f]+$/iu); -var HexAddressStruct = _superstruct.pattern.call(void 0, - _superstruct.string.call(void 0, ), - /^0x[0-9a-f]{40}$/u -); -var HexChecksumAddressStruct = _superstruct.pattern.call(void 0, - _superstruct.string.call(void 0, ), - /^0x[0-9a-fA-F]{40}$/u -); -function isHexString(value) { - return _superstruct.is.call(void 0, value, HexStruct); -} -function isStrictHexString(value) { - return _superstruct.is.call(void 0, value, StrictHexStruct); -} -function assertIsHexString(value) { - _chunk6ZDHSOUVjs.assert.call(void 0, isHexString(value), "Value must be a hexadecimal string."); -} -function assertIsStrictHexString(value) { - _chunk6ZDHSOUVjs.assert.call(void 0, - isStrictHexString(value), - 'Value must be a hexadecimal string, starting with "0x".' - ); -} -function isValidHexAddress(possibleAddress) { - return _superstruct.is.call(void 0, possibleAddress, HexAddressStruct) || isValidChecksumAddress(possibleAddress); -} -function getChecksumAddress(address) { - _chunk6ZDHSOUVjs.assert.call(void 0, _superstruct.is.call(void 0, address, HexChecksumAddressStruct), "Invalid hex address."); - const unPrefixed = remove0x(address.toLowerCase()); - const unPrefixedHash = remove0x(bytesToHex(_sha3.keccak_256.call(void 0, unPrefixed))); - return `0x${unPrefixed.split("").map((character, nibbleIndex) => { - const hashCharacter = unPrefixedHash[nibbleIndex]; - _chunk6ZDHSOUVjs.assert.call(void 0, _superstruct.is.call(void 0, hashCharacter, _superstruct.string.call(void 0, )), "Hash shorter than address."); - return parseInt(hashCharacter, 16) > 7 ? character.toUpperCase() : character; - }).join("")}`; -} -function isValidChecksumAddress(possibleChecksum) { - if (!_superstruct.is.call(void 0, possibleChecksum, HexChecksumAddressStruct)) { - return false; + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (let i = 0; i < set.length; i++) { + debug(set[i].semver) + if (set[i].semver === Comparator.ANY) { + continue + } + + if (set[i].semver.prerelease.length > 0) { + const allowed = set[i].semver + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) { + return true + } + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false } - return getChecksumAddress(possibleChecksum) === possibleChecksum; -} -function add0x(hexadecimal) { - if (hexadecimal.startsWith("0x")) { - return hexadecimal; - } - if (hexadecimal.startsWith("0X")) { - return `0x${hexadecimal.substring(2)}`; - } - return `0x${hexadecimal}`; -} -function remove0x(hexadecimal) { - if (hexadecimal.startsWith("0x") || hexadecimal.startsWith("0X")) { - return hexadecimal.substring(2); - } - return hexadecimal; + + return true } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -exports.HexStruct = HexStruct; exports.StrictHexStruct = StrictHexStruct; exports.HexAddressStruct = HexAddressStruct; exports.HexChecksumAddressStruct = HexChecksumAddressStruct; exports.isHexString = isHexString; exports.isStrictHexString = isStrictHexString; exports.assertIsHexString = assertIsHexString; exports.assertIsStrictHexString = assertIsStrictHexString; exports.isValidHexAddress = isValidHexAddress; exports.getChecksumAddress = getChecksumAddress; exports.isValidChecksumAddress = isValidChecksumAddress; exports.add0x = add0x; exports.remove0x = remove0x; exports.isBytes = isBytes; exports.assertIsBytes = assertIsBytes; exports.bytesToHex = bytesToHex; exports.bytesToBigInt = bytesToBigInt; exports.bytesToSignedBigInt = bytesToSignedBigInt; exports.bytesToNumber = bytesToNumber; exports.bytesToString = bytesToString; exports.bytesToBase64 = bytesToBase64; exports.hexToBytes = hexToBytes; exports.bigIntToBytes = bigIntToBytes; exports.signedBigIntToBytes = signedBigIntToBytes; exports.numberToBytes = numberToBytes; exports.stringToBytes = stringToBytes; exports.base64ToBytes = base64ToBytes; exports.valueToBytes = valueToBytes; exports.concatBytes = concatBytes; exports.createDataView = createDataView; -//# sourceMappingURL=chunk-QEPVHEP7.js.map - /***/ }), -/***/ 96526: -/***/ ((__unused_webpack_module, exports) => { +/***/ 64739: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -"use strict"; -Object.defineProperty(exports, "__esModule", ({value: true})); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/misc.ts -function isNonEmptyArray(value) { - return Array.isArray(value) && value.length > 0; +const debug = __webpack_require__(52207) +const { MAX_LENGTH, MAX_SAFE_INTEGER } = __webpack_require__(35237) +const { safeRe: re, t } = __webpack_require__(34567) + +const parseOptions = __webpack_require__(69932) +const { compareIdentifiers } = __webpack_require__(27660) +class SemVer { + constructor (version, options) { + options = parseOptions(options) + + if (version instanceof SemVer) { + if (version.loose === !!options.loose && + version.includePrerelease === !!options.includePrerelease) { + return version + } else { + version = version.version + } + } else if (typeof version !== 'string') { + throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`) + } + + if (version.length > MAX_LENGTH) { + throw new TypeError( + `version is longer than ${MAX_LENGTH} characters` + ) + } + + debug('SemVer', version, options) + this.options = options + this.loose = !!options.loose + // this isn't actually relevant for versions, but keep it so that we + // don't run into trouble passing this.options around. + this.includePrerelease = !!options.includePrerelease + + const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]) + + if (!m) { + throw new TypeError(`Invalid Version: ${version}`) + } + + this.raw = version + + // these are actually numbers + this.major = +m[1] + this.minor = +m[2] + this.patch = +m[3] + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version') + } + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version') + } + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version') + } + + // numberify any prerelease numeric ids + if (!m[4]) { + this.prerelease = [] + } else { + this.prerelease = m[4].split('.').map((id) => { + if (/^[0-9]+$/.test(id)) { + const num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num + } + } + return id + }) + } + + this.build = m[5] ? m[5].split('.') : [] + this.format() + } + + format () { + this.version = `${this.major}.${this.minor}.${this.patch}` + if (this.prerelease.length) { + this.version += `-${this.prerelease.join('.')}` + } + return this.version + } + + toString () { + return this.version + } + + compare (other) { + debug('SemVer.compare', this.version, this.options, other) + if (!(other instanceof SemVer)) { + if (typeof other === 'string' && other === this.version) { + return 0 + } + other = new SemVer(other, this.options) + } + + if (other.version === this.version) { + return 0 + } + + return this.compareMain(other) || this.comparePre(other) + } + + compareMain (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return ( + compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch) + ) + } + + comparePre (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) { + return -1 + } else if (!this.prerelease.length && other.prerelease.length) { + return 1 + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0 + } + + let i = 0 + do { + const a = this.prerelease[i] + const b = other.prerelease[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) + } + + compareBuild (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + let i = 0 + do { + const a = this.build[i] + const b = other.build[i] + debug('build compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) + } + + // preminor will bump the version up to the next minor release, and immediately + // down to pre-release. premajor and prepatch work the same way. + inc (release, identifier, identifierBase) { + switch (release) { + case 'premajor': + this.prerelease.length = 0 + this.patch = 0 + this.minor = 0 + this.major++ + this.inc('pre', identifier, identifierBase) + break + case 'preminor': + this.prerelease.length = 0 + this.patch = 0 + this.minor++ + this.inc('pre', identifier, identifierBase) + break + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0 + this.inc('patch', identifier, identifierBase) + this.inc('pre', identifier, identifierBase) + break + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier, identifierBase) + } + this.inc('pre', identifier, identifierBase) + break + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if ( + this.minor !== 0 || + this.patch !== 0 || + this.prerelease.length === 0 + ) { + this.major++ + } + this.minor = 0 + this.patch = 0 + this.prerelease = [] + break + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++ + } + this.patch = 0 + this.prerelease = [] + break + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++ + } + this.prerelease = [] + break + // This probably shouldn't be used publicly. + // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. + case 'pre': { + const base = Number(identifierBase) ? 1 : 0 + + if (!identifier && identifierBase === false) { + throw new Error('invalid increment argument: identifier is empty') + } + + if (this.prerelease.length === 0) { + this.prerelease = [base] + } else { + let i = this.prerelease.length + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++ + i = -2 + } + } + if (i === -1) { + // didn't increment anything + if (identifier === this.prerelease.join('.') && identifierBase === false) { + throw new Error('invalid increment argument: identifier already exists') + } + this.prerelease.push(base) + } + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + let prerelease = [identifier, base] + if (identifierBase === false) { + prerelease = [identifier] + } + if (compareIdentifiers(this.prerelease[0], identifier) === 0) { + if (isNaN(this.prerelease[1])) { + this.prerelease = prerelease + } + } else { + this.prerelease = prerelease + } + } + break + } + default: + throw new Error(`invalid increment argument: ${release}`) + } + this.raw = this.format() + if (this.build.length) { + this.raw += `+${this.build.join('.')}` + } + return this + } } -function isNullOrUndefined(value) { - return value === null || value === void 0; + +module.exports = SemVer + + +/***/ }), + +/***/ 30911: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const parse = __webpack_require__(83321) +const clean = (version, options) => { + const s = parse(version.trim().replace(/^[=v]+/, ''), options) + return s ? s.version : null } -function isObject(value) { - return Boolean(value) && typeof value === "object" && !Array.isArray(value); +module.exports = clean + + +/***/ }), + +/***/ 73646: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const eq = __webpack_require__(5778) +const neq = __webpack_require__(10710) +const gt = __webpack_require__(90047) +const gte = __webpack_require__(70668) +const lt = __webpack_require__(15960) +const lte = __webpack_require__(99925) + +const cmp = (a, op, b, loose) => { + switch (op) { + case '===': + if (typeof a === 'object') { + a = a.version + } + if (typeof b === 'object') { + b = b.version + } + return a === b + + case '!==': + if (typeof a === 'object') { + a = a.version + } + if (typeof b === 'object') { + b = b.version + } + return a !== b + + case '': + case '=': + case '==': + return eq(a, b, loose) + + case '!=': + return neq(a, b, loose) + + case '>': + return gt(a, b, loose) + + case '>=': + return gte(a, b, loose) + + case '<': + return lt(a, b, loose) + + case '<=': + return lte(a, b, loose) + + default: + throw new TypeError(`Invalid operator: ${op}`) + } } -var hasProperty = (objectToCheck, name) => Object.hasOwnProperty.call(objectToCheck, name); -function getKnownPropertyNames(object) { - return Object.getOwnPropertyNames(object); +module.exports = cmp + + +/***/ }), + +/***/ 17425: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(64739) +const parse = __webpack_require__(83321) +const { safeRe: re, t } = __webpack_require__(34567) + +const coerce = (version, options) => { + if (version instanceof SemVer) { + return version + } + + if (typeof version === 'number') { + version = String(version) + } + + if (typeof version !== 'string') { + return null + } + + options = options || {} + + let match = null + if (!options.rtl) { + match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]) + } else { + // Find the right-most coercible string that does not share + // a terminus with a more left-ward coercible string. + // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' + // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4' + // + // Walk through the string checking with a /g regexp + // Manually set the index so as to pick up overlapping matches. + // Stop when we get a match that ends at the string end, since no + // coercible string can be more right-ward without the same terminus. + const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL] + let next + while ((next = coerceRtlRegex.exec(version)) && + (!match || match.index + match[0].length !== version.length) + ) { + if (!match || + next.index + next[0].length !== match.index + match[0].length) { + match = next + } + coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length + } + // leave it in a clean state + coerceRtlRegex.lastIndex = -1 + } + + if (match === null) { + return null + } + + const major = match[2] + const minor = match[3] || '0' + const patch = match[4] || '0' + const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : '' + const build = options.includePrerelease && match[6] ? `+${match[6]}` : '' + + return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options) } -var JsonSize = /* @__PURE__ */ ((JsonSize2) => { - JsonSize2[JsonSize2["Null"] = 4] = "Null"; - JsonSize2[JsonSize2["Comma"] = 1] = "Comma"; - JsonSize2[JsonSize2["Wrapper"] = 1] = "Wrapper"; - JsonSize2[JsonSize2["True"] = 4] = "True"; - JsonSize2[JsonSize2["False"] = 5] = "False"; - JsonSize2[JsonSize2["Quote"] = 1] = "Quote"; - JsonSize2[JsonSize2["Colon"] = 1] = "Colon"; - JsonSize2[JsonSize2["Date"] = 24] = "Date"; - return JsonSize2; -})(JsonSize || {}); -var ESCAPE_CHARACTERS_REGEXP = /"|\\|\n|\r|\t/gu; -function isPlainObject(value) { - if (typeof value !== "object" || value === null) { - return false; +module.exports = coerce + + +/***/ }), + +/***/ 67544: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(64739) +const compareBuild = (a, b, loose) => { + const versionA = new SemVer(a, loose) + const versionB = new SemVer(b, loose) + return versionA.compare(versionB) || versionA.compareBuild(versionB) +} +module.exports = compareBuild + + +/***/ }), + +/***/ 91554: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const compare = __webpack_require__(8317) +const compareLoose = (a, b) => compare(a, b, true) +module.exports = compareLoose + + +/***/ }), + +/***/ 8317: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(64739) +const compare = (a, b, loose) => + new SemVer(a, loose).compare(new SemVer(b, loose)) + +module.exports = compare + + +/***/ }), + +/***/ 45007: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const parse = __webpack_require__(83321) + +const diff = (version1, version2) => { + const v1 = parse(version1, null, true) + const v2 = parse(version2, null, true) + const comparison = v1.compare(v2) + + if (comparison === 0) { + return null + } + + const v1Higher = comparison > 0 + const highVersion = v1Higher ? v1 : v2 + const lowVersion = v1Higher ? v2 : v1 + const highHasPre = !!highVersion.prerelease.length + const lowHasPre = !!lowVersion.prerelease.length + + if (lowHasPre && !highHasPre) { + // Going from prerelease -> no prerelease requires some special casing + + // If the low version has only a major, then it will always be a major + // Some examples: + // 1.0.0-1 -> 1.0.0 + // 1.0.0-1 -> 1.1.1 + // 1.0.0-1 -> 2.0.0 + if (!lowVersion.patch && !lowVersion.minor) { + return 'major' + } + + // Otherwise it can be determined by checking the high version + + if (highVersion.patch) { + // anything higher than a patch bump would result in the wrong version + return 'patch' + } + + if (highVersion.minor) { + // anything higher than a minor bump would result in the wrong version + return 'minor' + } + + // bumping major/minor/patch all have same result + return 'major' + } + + // add the `pre` prefix if we are going to a prerelease version + const prefix = highHasPre ? 'pre' : '' + + if (v1.major !== v2.major) { + return prefix + 'major' + } + + if (v1.minor !== v2.minor) { + return prefix + 'minor' + } + + if (v1.patch !== v2.patch) { + return prefix + 'patch' + } + + // high and low are preleases + return 'prerelease' +} + +module.exports = diff + + +/***/ }), + +/***/ 5778: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const compare = __webpack_require__(8317) +const eq = (a, b, loose) => compare(a, b, loose) === 0 +module.exports = eq + + +/***/ }), + +/***/ 90047: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const compare = __webpack_require__(8317) +const gt = (a, b, loose) => compare(a, b, loose) > 0 +module.exports = gt + + +/***/ }), + +/***/ 70668: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const compare = __webpack_require__(8317) +const gte = (a, b, loose) => compare(a, b, loose) >= 0 +module.exports = gte + + +/***/ }), + +/***/ 94586: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(64739) + +const inc = (version, release, options, identifier, identifierBase) => { + if (typeof (options) === 'string') { + identifierBase = identifier + identifier = options + options = undefined + } + + try { + return new SemVer( + version instanceof SemVer ? version.version : version, + options + ).inc(release, identifier, identifierBase).version + } catch (er) { + return null + } +} +module.exports = inc + + +/***/ }), + +/***/ 15960: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const compare = __webpack_require__(8317) +const lt = (a, b, loose) => compare(a, b, loose) < 0 +module.exports = lt + + +/***/ }), + +/***/ 99925: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const compare = __webpack_require__(8317) +const lte = (a, b, loose) => compare(a, b, loose) <= 0 +module.exports = lte + + +/***/ }), + +/***/ 95207: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(64739) +const major = (a, loose) => new SemVer(a, loose).major +module.exports = major + + +/***/ }), + +/***/ 70547: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(64739) +const minor = (a, loose) => new SemVer(a, loose).minor +module.exports = minor + + +/***/ }), + +/***/ 10710: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const compare = __webpack_require__(8317) +const neq = (a, b, loose) => compare(a, b, loose) !== 0 +module.exports = neq + + +/***/ }), + +/***/ 83321: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(64739) +const parse = (version, options, throwErrors = false) => { + if (version instanceof SemVer) { + return version } try { - let proto = value; - while (Object.getPrototypeOf(proto) !== null) { - proto = Object.getPrototypeOf(proto); + return new SemVer(version, options) + } catch (er) { + if (!throwErrors) { + return null } - return Object.getPrototypeOf(value) === proto; - } catch (_) { - return false; + throw er } } -function isASCII(character) { - return character.charCodeAt(0) <= 127; + +module.exports = parse + + +/***/ }), + +/***/ 5852: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(64739) +const patch = (a, loose) => new SemVer(a, loose).patch +module.exports = patch + + +/***/ }), + +/***/ 84058: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const parse = __webpack_require__(83321) +const prerelease = (version, options) => { + const parsed = parse(version, options) + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null } -function calculateStringSize(value) { - const size = value.split("").reduce((total, character) => { - if (isASCII(character)) { - return total + 1; +module.exports = prerelease + + +/***/ }), + +/***/ 69173: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const compare = __webpack_require__(8317) +const rcompare = (a, b, loose) => compare(b, a, loose) +module.exports = rcompare + + +/***/ }), + +/***/ 51200: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const compareBuild = __webpack_require__(67544) +const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)) +module.exports = rsort + + +/***/ }), + +/***/ 52643: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const Range = __webpack_require__(25926) +const satisfies = (version, range, options) => { + try { + range = new Range(range, options) + } catch (er) { + return false + } + return range.test(version) +} +module.exports = satisfies + + +/***/ }), + +/***/ 63400: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const compareBuild = __webpack_require__(67544) +const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)) +module.exports = sort + + +/***/ }), + +/***/ 79572: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const parse = __webpack_require__(83321) +const valid = (version, options) => { + const v = parse(version, options) + return v ? v.version : null +} +module.exports = valid + + +/***/ }), + +/***/ 56864: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +// just pre-load all the stuff that index.js lazily exports +const internalRe = __webpack_require__(34567) +const constants = __webpack_require__(35237) +const SemVer = __webpack_require__(64739) +const identifiers = __webpack_require__(27660) +const parse = __webpack_require__(83321) +const valid = __webpack_require__(79572) +const clean = __webpack_require__(30911) +const inc = __webpack_require__(94586) +const diff = __webpack_require__(45007) +const major = __webpack_require__(95207) +const minor = __webpack_require__(70547) +const patch = __webpack_require__(5852) +const prerelease = __webpack_require__(84058) +const compare = __webpack_require__(8317) +const rcompare = __webpack_require__(69173) +const compareLoose = __webpack_require__(91554) +const compareBuild = __webpack_require__(67544) +const sort = __webpack_require__(63400) +const rsort = __webpack_require__(51200) +const gt = __webpack_require__(90047) +const lt = __webpack_require__(15960) +const eq = __webpack_require__(5778) +const neq = __webpack_require__(10710) +const gte = __webpack_require__(70668) +const lte = __webpack_require__(99925) +const cmp = __webpack_require__(73646) +const coerce = __webpack_require__(17425) +const Comparator = __webpack_require__(52139) +const Range = __webpack_require__(25926) +const satisfies = __webpack_require__(52643) +const toComparators = __webpack_require__(24054) +const maxSatisfying = __webpack_require__(83777) +const minSatisfying = __webpack_require__(63099) +const minVersion = __webpack_require__(36258) +const validRange = __webpack_require__(77529) +const outside = __webpack_require__(22944) +const gtr = __webpack_require__(14316) +const ltr = __webpack_require__(12373) +const intersects = __webpack_require__(48337) +const simplifyRange = __webpack_require__(72196) +const subset = __webpack_require__(72505) +module.exports = { + parse, + valid, + clean, + inc, + diff, + major, + minor, + patch, + prerelease, + compare, + rcompare, + compareLoose, + compareBuild, + sort, + rsort, + gt, + lt, + eq, + neq, + gte, + lte, + cmp, + coerce, + Comparator, + Range, + satisfies, + toComparators, + maxSatisfying, + minSatisfying, + minVersion, + validRange, + outside, + gtr, + ltr, + intersects, + simplifyRange, + subset, + SemVer, + re: internalRe.re, + src: internalRe.src, + tokens: internalRe.t, + SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION, + RELEASE_TYPES: constants.RELEASE_TYPES, + compareIdentifiers: identifiers.compareIdentifiers, + rcompareIdentifiers: identifiers.rcompareIdentifiers, +} + + +/***/ }), + +/***/ 35237: +/***/ ((module) => { + +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +const SEMVER_SPEC_VERSION = '2.0.0' + +const MAX_LENGTH = 256 +const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || +/* istanbul ignore next */ 9007199254740991 + +// Max safe segment length for coercion. +const MAX_SAFE_COMPONENT_LENGTH = 16 + +// Max safe length for a build identifier. The max length minus 6 characters for +// the shortest version with a build 0.0.0+BUILD. +const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6 + +const RELEASE_TYPES = [ + 'major', + 'premajor', + 'minor', + 'preminor', + 'patch', + 'prepatch', + 'prerelease', +] + +module.exports = { + MAX_LENGTH, + MAX_SAFE_COMPONENT_LENGTH, + MAX_SAFE_BUILD_LENGTH, + MAX_SAFE_INTEGER, + RELEASE_TYPES, + SEMVER_SPEC_VERSION, + FLAG_INCLUDE_PRERELEASE: 0b001, + FLAG_LOOSE: 0b010, +} + + +/***/ }), + +/***/ 52207: +/***/ ((module) => { + +const debug = ( + typeof process === 'object' && + process.env && + process.env.NODE_DEBUG && + /\bsemver\b/i.test(process.env.NODE_DEBUG) +) ? (...args) => console.error('SEMVER', ...args) + : () => {} + +module.exports = debug + + +/***/ }), + +/***/ 27660: +/***/ ((module) => { + +const numeric = /^[0-9]+$/ +const compareIdentifiers = (a, b) => { + const anum = numeric.test(a) + const bnum = numeric.test(b) + + if (anum && bnum) { + a = +a + b = +b + } + + return a === b ? 0 + : (anum && !bnum) ? -1 + : (bnum && !anum) ? 1 + : a < b ? -1 + : 1 +} + +const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a) + +module.exports = { + compareIdentifiers, + rcompareIdentifiers, +} + + +/***/ }), + +/***/ 97228: +/***/ ((module) => { + +class LRUCache { + constructor () { + this.max = 1000 + this.map = new Map() + } + + get (key) { + const value = this.map.get(key) + if (value === undefined) { + return undefined + } else { + // Remove the key from the map and add it to the end + this.map.delete(key) + this.map.set(key, value) + return value } - return total + 2; - }, 0); - return size + (_nullishCoalesce(value.match(ESCAPE_CHARACTERS_REGEXP), () => ( []))).length; -} -function calculateNumberSize(value) { - return value.toString().length; + } + + delete (key) { + return this.map.delete(key) + } + + set (key, value) { + const deleted = this.delete(key) + + if (!deleted && value !== undefined) { + // If cache is full, delete the least recently used item + if (this.map.size >= this.max) { + const firstKey = this.map.keys().next().value + this.delete(firstKey) + } + + this.map.set(key, value) + } + + return this + } } +module.exports = LRUCache - - - - - - - - - - -exports.isNonEmptyArray = isNonEmptyArray; exports.isNullOrUndefined = isNullOrUndefined; exports.isObject = isObject; exports.hasProperty = hasProperty; exports.getKnownPropertyNames = getKnownPropertyNames; exports.JsonSize = JsonSize; exports.ESCAPE_CHARACTERS_REGEXP = ESCAPE_CHARACTERS_REGEXP; exports.isPlainObject = isPlainObject; exports.isASCII = isASCII; exports.calculateStringSize = calculateStringSize; exports.calculateNumberSize = calculateNumberSize; -//# sourceMappingURL=chunk-QVEKZRZ2.js.map - /***/ }), -/***/ 61305: -/***/ (() => { +/***/ 69932: +/***/ ((module) => { + +// parse out just the options we care about +const looseOption = Object.freeze({ loose: true }) +const emptyOpts = Object.freeze({ }) +const parseOptions = options => { + if (!options) { + return emptyOpts + } + + if (typeof options !== 'object') { + return looseOption + } + + return options +} +module.exports = parseOptions -"use strict"; -//# sourceMappingURL=chunk-RKRGAFXY.js.map /***/ }), -/***/ 43207: -/***/ (() => { +/***/ 34567: +/***/ ((module, exports, __webpack_require__) => { + +const { + MAX_SAFE_COMPONENT_LENGTH, + MAX_SAFE_BUILD_LENGTH, + MAX_LENGTH, +} = __webpack_require__(35237) +const debug = __webpack_require__(52207) +exports = module.exports = {} + +// The actual regexps go on exports.re +const re = exports.re = [] +const safeRe = exports.safeRe = [] +const src = exports.src = [] +const t = exports.t = {} +let R = 0 + +const LETTERDASHNUMBER = '[a-zA-Z0-9-]' + +// Replace some greedy regex tokens to prevent regex dos issues. These regex are +// used internally via the safeRe object since all inputs in this library get +// normalized first to trim and collapse all extra whitespace. The original +// regexes are exported for userland consumption and lower level usage. A +// future breaking change could export the safer regex only with a note that +// all input should have extra whitespace removed. +const safeRegexReplacements = [ + ['\\s', 1], + ['\\d', MAX_LENGTH], + [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH], +] + +const makeSafeRegex = (value) => { + for (const [token, max] of safeRegexReplacements) { + value = value + .split(`${token}*`).join(`${token}{0,${max}}`) + .split(`${token}+`).join(`${token}{1,${max}}`) + } + return value +} + +const createToken = (name, value, isGlobal) => { + const safe = makeSafeRegex(value) + const index = R++ + debug(name, index, value) + t[name] = index + src[index] = value + re[index] = new RegExp(value, isGlobal ? 'g' : undefined) + safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined) +} + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*') +createToken('NUMERICIDENTIFIERLOOSE', '\\d+') + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`) + +// ## Main Version +// Three dot-separated numeric identifiers. + +createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})`) + +createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})`) + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER] +}|${src[t.NONNUMERICIDENTIFIER]})`) + +createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE] +}|${src[t.NONNUMERICIDENTIFIER]})`) + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER] +}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`) + +createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE] +}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`) + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`) + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER] +}(?:\\.${src[t.BUILDIDENTIFIER]})*))`) + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +createToken('FULLPLAIN', `v?${src[t.MAINVERSION] +}${src[t.PRERELEASE]}?${ + src[t.BUILD]}?`) + +createToken('FULL', `^${src[t.FULLPLAIN]}$`) + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] +}${src[t.PRERELEASELOOSE]}?${ + src[t.BUILD]}?`) + +createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`) + +createToken('GTLT', '((?:<|>)?=?)') + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`) +createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`) + +createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:${src[t.PRERELEASE]})?${ + src[t.BUILD]}?` + + `)?)?`) + +createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:${src[t.PRERELEASELOOSE]})?${ + src[t.BUILD]}?` + + `)?)?`) + +createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`) +createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`) + +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +createToken('COERCEPLAIN', `${'(^|[^\\d])' + + '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`) +createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`) +createToken('COERCEFULL', src[t.COERCEPLAIN] + + `(?:${src[t.PRERELEASE]})?` + + `(?:${src[t.BUILD]})?` + + `(?:$|[^\\d])`) +createToken('COERCERTL', src[t.COERCE], true) +createToken('COERCERTLFULL', src[t.COERCEFULL], true) + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +createToken('LONETILDE', '(?:~>?)') + +createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true) +exports.tildeTrimReplace = '$1~' + +createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`) +createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`) + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +createToken('LONECARET', '(?:\\^)') + +createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true) +exports.caretTrimReplace = '$1^' + +createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`) +createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`) + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`) +createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`) + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT] +}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true) +exports.comparatorTrimReplace = '$1$2$3' + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAIN]})` + + `\\s*$`) + +createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAINLOOSE]})` + + `\\s*$`) + +// Star ranges basically just allow anything at all. +createToken('STAR', '(<|>)?=?\\s*\\*') +// >=0.0.0 is like a star +createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$') +createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$') -"use strict"; -//# sourceMappingURL=chunk-UOTVU7OQ.js.map /***/ }), -/***/ 41535: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ 14316: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -"use strict"; -Object.defineProperty(exports, "__esModule", ({value: true})); +// Determine if version is greater than all the versions possible in the range. +const outside = __webpack_require__(22944) +const gtr = (version, range, options) => outside(version, range, '>', options) +module.exports = gtr -var _chunkQEPVHEP7js = __webpack_require__(75363); - - -var _chunk6ZDHSOUVjs = __webpack_require__(40932); - -// src/number.ts -var numberToHex = (value) => { - _chunk6ZDHSOUVjs.assert.call(void 0, typeof value === "number", "Value must be a number."); - _chunk6ZDHSOUVjs.assert.call(void 0, value >= 0, "Value must be a non-negative number."); - _chunk6ZDHSOUVjs.assert.call(void 0, - Number.isSafeInteger(value), - "Value is not a safe integer. Use `bigIntToHex` instead." - ); - return _chunkQEPVHEP7js.add0x.call(void 0, value.toString(16)); -}; -var bigIntToHex = (value) => { - _chunk6ZDHSOUVjs.assert.call(void 0, typeof value === "bigint", "Value must be a bigint."); - _chunk6ZDHSOUVjs.assert.call(void 0, value >= 0, "Value must be a non-negative bigint."); - return _chunkQEPVHEP7js.add0x.call(void 0, value.toString(16)); -}; -var hexToNumber = (value) => { - _chunkQEPVHEP7js.assertIsHexString.call(void 0, value); - const numberValue = parseInt(value, 16); - _chunk6ZDHSOUVjs.assert.call(void 0, - Number.isSafeInteger(numberValue), - "Value is not a safe integer. Use `hexToBigInt` instead." - ); - return numberValue; -}; -var hexToBigInt = (value) => { - _chunkQEPVHEP7js.assertIsHexString.call(void 0, value); - return BigInt(_chunkQEPVHEP7js.add0x.call(void 0, value)); -}; - - - - - - -exports.numberToHex = numberToHex; exports.bigIntToHex = bigIntToHex; exports.hexToNumber = hexToNumber; exports.hexToBigInt = hexToBigInt; -//# sourceMappingURL=chunk-VFXTVNXN.js.map - /***/ }), -/***/ 2489: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ 48337: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const Range = __webpack_require__(25926) +const intersects = (r1, r2, options) => { + r1 = new Range(r1, options) + r2 = new Range(r2, options) + return r1.intersects(r2, options) +} +module.exports = intersects + + +/***/ }), + +/***/ 12373: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const outside = __webpack_require__(22944) +// Determine if version is less than all the versions possible in the range +const ltr = (version, range, options) => outside(version, range, '<', options) +module.exports = ltr + + +/***/ }), + +/***/ 83777: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(64739) +const Range = __webpack_require__(25926) + +const maxSatisfying = (versions, range, options) => { + let max = null + let maxSV = null + let rangeObj = null + try { + rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v + maxSV = new SemVer(max, options) + } + } + }) + return max +} +module.exports = maxSatisfying + + +/***/ }), + +/***/ 63099: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(64739) +const Range = __webpack_require__(25926) +const minSatisfying = (versions, range, options) => { + let min = null + let minSV = null + let rangeObj = null + try { + rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v + minSV = new SemVer(min, options) + } + } + }) + return min +} +module.exports = minSatisfying + + +/***/ }), + +/***/ 36258: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(64739) +const Range = __webpack_require__(25926) +const gt = __webpack_require__(90047) + +const minVersion = (range, loose) => { + range = new Range(range, loose) + + let minver = new SemVer('0.0.0') + if (range.test(minver)) { + return minver + } + + minver = new SemVer('0.0.0-0') + if (range.test(minver)) { + return minver + } + + minver = null + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i] + + let setMin = null + comparators.forEach((comparator) => { + // Clone to avoid manipulating the comparator's semver object. + const compver = new SemVer(comparator.semver.version) + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++ + } else { + compver.prerelease.push(0) + } + compver.raw = compver.format() + /* fallthrough */ + case '': + case '>=': + if (!setMin || gt(compver, setMin)) { + setMin = compver + } + break + case '<': + case '<=': + /* Ignore maximum versions */ + break + /* istanbul ignore next */ + default: + throw new Error(`Unexpected operation: ${comparator.operator}`) + } + }) + if (setMin && (!minver || gt(minver, setMin))) { + minver = setMin + } + } + + if (minver && range.test(minver)) { + return minver + } + + return null +} +module.exports = minVersion + + +/***/ }), + +/***/ 22944: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(64739) +const Comparator = __webpack_require__(52139) +const { ANY } = Comparator +const Range = __webpack_require__(25926) +const satisfies = __webpack_require__(52643) +const gt = __webpack_require__(90047) +const lt = __webpack_require__(15960) +const lte = __webpack_require__(99925) +const gte = __webpack_require__(70668) + +const outside = (version, range, hilo, options) => { + version = new SemVer(version, options) + range = new Range(range, options) + + let gtfn, ltefn, ltfn, comp, ecomp + switch (hilo) { + case '>': + gtfn = gt + ltefn = lte + ltfn = lt + comp = '>' + ecomp = '>=' + break + case '<': + gtfn = lt + ltefn = gte + ltfn = gt + comp = '<' + ecomp = '<=' + break + default: + throw new TypeError('Must provide a hilo val of "<" or ">"') + } + + // If it satisfies the range it is not outside + if (satisfies(version, range, options)) { + return false + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i] + + let high = null + let low = null + + comparators.forEach((comparator) => { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') + } + high = high || comparator + low = low || comparator + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator + } + }) + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false + } + } + return true +} + +module.exports = outside + + +/***/ }), + +/***/ 72196: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +// given a set of versions and a range, create a "simplified" range +// that includes the same versions that the original range does +// If the original range is shorter than the simplified one, return that. +const satisfies = __webpack_require__(52643) +const compare = __webpack_require__(8317) +module.exports = (versions, range, options) => { + const set = [] + let first = null + let prev = null + const v = versions.sort((a, b) => compare(a, b, options)) + for (const version of v) { + const included = satisfies(version, range, options) + if (included) { + prev = version + if (!first) { + first = version + } + } else { + if (prev) { + set.push([first, prev]) + } + prev = null + first = null + } + } + if (first) { + set.push([first, null]) + } + + const ranges = [] + for (const [min, max] of set) { + if (min === max) { + ranges.push(min) + } else if (!max && min === v[0]) { + ranges.push('*') + } else if (!max) { + ranges.push(`>=${min}`) + } else if (min === v[0]) { + ranges.push(`<=${max}`) + } else { + ranges.push(`${min} - ${max}`) + } + } + const simplified = ranges.join(' || ') + const original = typeof range.raw === 'string' ? range.raw : String(range) + return simplified.length < original.length ? simplified : range +} + + +/***/ }), + +/***/ 72505: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const Range = __webpack_require__(25926) +const Comparator = __webpack_require__(52139) +const { ANY } = Comparator +const satisfies = __webpack_require__(52643) +const compare = __webpack_require__(8317) + +// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff: +// - Every simple range `r1, r2, ...` is a null set, OR +// - Every simple range `r1, r2, ...` which is not a null set is a subset of +// some `R1, R2, ...` +// +// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff: +// - If c is only the ANY comparator +// - If C is only the ANY comparator, return true +// - Else if in prerelease mode, return false +// - else replace c with `[>=0.0.0]` +// - If C is only the ANY comparator +// - if in prerelease mode, return true +// - else replace C with `[>=0.0.0]` +// - Let EQ be the set of = comparators in c +// - If EQ is more than one, return true (null set) +// - Let GT be the highest > or >= comparator in c +// - Let LT be the lowest < or <= comparator in c +// - If GT and LT, and GT.semver > LT.semver, return true (null set) +// - If any C is a = range, and GT or LT are set, return false +// - If EQ +// - If GT, and EQ does not satisfy GT, return true (null set) +// - If LT, and EQ does not satisfy LT, return true (null set) +// - If EQ satisfies every C, return true +// - Else return false +// - If GT +// - If GT.semver is lower than any > or >= comp in C, return false +// - If GT is >=, and GT.semver does not satisfy every C, return false +// - If GT.semver has a prerelease, and not in prerelease mode +// - If no C has a prerelease and the GT.semver tuple, return false +// - If LT +// - If LT.semver is greater than any < or <= comp in C, return false +// - If LT is <=, and LT.semver does not satisfy every C, return false +// - If GT.semver has a prerelease, and not in prerelease mode +// - If no C has a prerelease and the LT.semver tuple, return false +// - Else return true + +const subset = (sub, dom, options = {}) => { + if (sub === dom) { + return true + } + + sub = new Range(sub, options) + dom = new Range(dom, options) + let sawNonNull = false + + OUTER: for (const simpleSub of sub.set) { + for (const simpleDom of dom.set) { + const isSub = simpleSubset(simpleSub, simpleDom, options) + sawNonNull = sawNonNull || isSub !== null + if (isSub) { + continue OUTER + } + } + // the null set is a subset of everything, but null simple ranges in + // a complex range should be ignored. so if we saw a non-null range, + // then we know this isn't a subset, but if EVERY simple range was null, + // then it is a subset. + if (sawNonNull) { + return false + } + } + return true +} + +const minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')] +const minimumVersion = [new Comparator('>=0.0.0')] + +const simpleSubset = (sub, dom, options) => { + if (sub === dom) { + return true + } + + if (sub.length === 1 && sub[0].semver === ANY) { + if (dom.length === 1 && dom[0].semver === ANY) { + return true + } else if (options.includePrerelease) { + sub = minimumVersionWithPreRelease + } else { + sub = minimumVersion + } + } + + if (dom.length === 1 && dom[0].semver === ANY) { + if (options.includePrerelease) { + return true + } else { + dom = minimumVersion + } + } + + const eqSet = new Set() + let gt, lt + for (const c of sub) { + if (c.operator === '>' || c.operator === '>=') { + gt = higherGT(gt, c, options) + } else if (c.operator === '<' || c.operator === '<=') { + lt = lowerLT(lt, c, options) + } else { + eqSet.add(c.semver) + } + } + + if (eqSet.size > 1) { + return null + } + + let gtltComp + if (gt && lt) { + gtltComp = compare(gt.semver, lt.semver, options) + if (gtltComp > 0) { + return null + } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) { + return null + } + } + + // will iterate one or zero times + for (const eq of eqSet) { + if (gt && !satisfies(eq, String(gt), options)) { + return null + } + + if (lt && !satisfies(eq, String(lt), options)) { + return null + } + + for (const c of dom) { + if (!satisfies(eq, String(c), options)) { + return false + } + } + + return true + } + + let higher, lower + let hasDomLT, hasDomGT + // if the subset has a prerelease, we need a comparator in the superset + // with the same tuple and a prerelease, or it's not a subset + let needDomLTPre = lt && + !options.includePrerelease && + lt.semver.prerelease.length ? lt.semver : false + let needDomGTPre = gt && + !options.includePrerelease && + gt.semver.prerelease.length ? gt.semver : false + // exception: <1.2.3-0 is the same as <1.2.3 + if (needDomLTPre && needDomLTPre.prerelease.length === 1 && + lt.operator === '<' && needDomLTPre.prerelease[0] === 0) { + needDomLTPre = false + } + + for (const c of dom) { + hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=' + hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=' + if (gt) { + if (needDomGTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && + c.semver.major === needDomGTPre.major && + c.semver.minor === needDomGTPre.minor && + c.semver.patch === needDomGTPre.patch) { + needDomGTPre = false + } + } + if (c.operator === '>' || c.operator === '>=') { + higher = higherGT(gt, c, options) + if (higher === c && higher !== gt) { + return false + } + } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) { + return false + } + } + if (lt) { + if (needDomLTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && + c.semver.major === needDomLTPre.major && + c.semver.minor === needDomLTPre.minor && + c.semver.patch === needDomLTPre.patch) { + needDomLTPre = false + } + } + if (c.operator === '<' || c.operator === '<=') { + lower = lowerLT(lt, c, options) + if (lower === c && lower !== lt) { + return false + } + } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) { + return false + } + } + if (!c.operator && (lt || gt) && gtltComp !== 0) { + return false + } + } + + // if there was a < or >, and nothing in the dom, then must be false + // UNLESS it was limited by another range in the other direction. + // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0 + if (gt && hasDomLT && !lt && gtltComp !== 0) { + return false + } + + if (lt && hasDomGT && !gt && gtltComp !== 0) { + return false + } + + // we needed a prerelease range in a specific tuple, but didn't get one + // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0, + // because it includes prereleases in the 1.2.3 tuple + if (needDomGTPre || needDomLTPre) { + return false + } + + return true +} + +// >=1.2.3 is lower than >1.2.3 +const higherGT = (a, b, options) => { + if (!a) { + return b + } + const comp = compare(a.semver, b.semver, options) + return comp > 0 ? a + : comp < 0 ? b + : b.operator === '>' && a.operator === '>=' ? b + : a +} + +// <=1.2.3 is higher than <1.2.3 +const lowerLT = (a, b, options) => { + if (!a) { + return b + } + const comp = compare(a.semver, b.semver, options) + return comp < 0 ? a + : comp > 0 ? b + : b.operator === '<' && a.operator === '<=' ? b + : a +} + +module.exports = subset + + +/***/ }), + +/***/ 24054: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const Range = __webpack_require__(25926) + +// Mostly just for testing and legacy API reasons +const toComparators = (range, options) => + new Range(range, options).set + .map(comp => comp.map(c => c.value).join(' ').trim().split(' ')) + +module.exports = toComparators + + +/***/ }), + +/***/ 77529: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const Range = __webpack_require__(25926) +const validRange = (range, options) => { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*' + } catch (er) { + return null + } +} +module.exports = validRange + + +/***/ }), + +/***/ 25084: +/***/ ((module) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({value: true})); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/caip-types.ts -var _superstruct = __webpack_require__(2150); -var CAIP_CHAIN_ID_REGEX = /^(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})$/u; -var CAIP_NAMESPACE_REGEX = /^[-a-z0-9]{3,8}$/u; -var CAIP_REFERENCE_REGEX = /^[-_a-zA-Z0-9]{1,32}$/u; -var CAIP_ACCOUNT_ID_REGEX = /^(?(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})):(?[-.%a-zA-Z0-9]{1,128})$/u; -var CAIP_ACCOUNT_ADDRESS_REGEX = /^[-.%a-zA-Z0-9]{1,128}$/u; -var CaipChainIdStruct = _superstruct.pattern.call(void 0, _superstruct.string.call(void 0, ), CAIP_CHAIN_ID_REGEX); -var CaipNamespaceStruct = _superstruct.pattern.call(void 0, _superstruct.string.call(void 0, ), CAIP_NAMESPACE_REGEX); -var CaipReferenceStruct = _superstruct.pattern.call(void 0, _superstruct.string.call(void 0, ), CAIP_REFERENCE_REGEX); -var CaipAccountIdStruct = _superstruct.pattern.call(void 0, _superstruct.string.call(void 0, ), CAIP_ACCOUNT_ID_REGEX); -var CaipAccountAddressStruct = _superstruct.pattern.call(void 0, - _superstruct.string.call(void 0, ), - CAIP_ACCOUNT_ADDRESS_REGEX -); -var KnownCaipNamespace = /* @__PURE__ */ ((KnownCaipNamespace2) => { - KnownCaipNamespace2["Eip155"] = "eip155"; - return KnownCaipNamespace2; -})(KnownCaipNamespace || {}); -function isCaipChainId(value) { - return _superstruct.is.call(void 0, value, CaipChainIdStruct); -} -function isCaipNamespace(value) { - return _superstruct.is.call(void 0, value, CaipNamespaceStruct); -} -function isCaipReference(value) { - return _superstruct.is.call(void 0, value, CaipReferenceStruct); -} -function isCaipAccountId(value) { - return _superstruct.is.call(void 0, value, CaipAccountIdStruct); -} -function isCaipAccountAddress(value) { - return _superstruct.is.call(void 0, value, CaipAccountAddressStruct); -} -function parseCaipChainId(caipChainId) { - const match = CAIP_CHAIN_ID_REGEX.exec(caipChainId); - if (!_optionalChain([match, 'optionalAccess', _ => _.groups])) { - throw new Error("Invalid CAIP chain ID."); + +// base-x encoding / decoding +// Copyright (c) 2018 base-x contributors +// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp) +// Distributed under the MIT software license, see the accompanying +// file LICENSE or http://www.opensource.org/licenses/mit-license.php. +function base (ALPHABET) { + if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') } + var BASE_MAP = new Uint8Array(256) + for (var j = 0; j < BASE_MAP.length; j++) { + BASE_MAP[j] = 255 + } + for (var i = 0; i < ALPHABET.length; i++) { + var x = ALPHABET.charAt(i) + var xc = x.charCodeAt(0) + if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') } + BASE_MAP[xc] = i + } + var BASE = ALPHABET.length + var LEADER = ALPHABET.charAt(0) + var FACTOR = Math.log(BASE) / Math.log(256) // log(BASE) / log(256), rounded up + var iFACTOR = Math.log(256) / Math.log(BASE) // log(256) / log(BASE), rounded up + function encode (source) { + if (source instanceof Uint8Array) { + } else if (ArrayBuffer.isView(source)) { + source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength) + } else if (Array.isArray(source)) { + source = Uint8Array.from(source) + } + if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') } + if (source.length === 0) { return '' } + // Skip & count leading zeroes. + var zeroes = 0 + var length = 0 + var pbegin = 0 + var pend = source.length + while (pbegin !== pend && source[pbegin] === 0) { + pbegin++ + zeroes++ + } + // Allocate enough space in big-endian base58 representation. + var size = ((pend - pbegin) * iFACTOR + 1) >>> 0 + var b58 = new Uint8Array(size) + // Process the bytes. + while (pbegin !== pend) { + var carry = source[pbegin] + // Apply "b58 = b58 * 256 + ch". + var i = 0 + for (var it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) { + carry += (256 * b58[it1]) >>> 0 + b58[it1] = (carry % BASE) >>> 0 + carry = (carry / BASE) >>> 0 + } + if (carry !== 0) { throw new Error('Non-zero carry') } + length = i + pbegin++ + } + // Skip leading zeroes in base58 result. + var it2 = size - length + while (it2 !== size && b58[it2] === 0) { + it2++ + } + // Translate the result into a string. + var str = LEADER.repeat(zeroes) + for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]) } + return str + } + function decodeUnsafe (source) { + if (typeof source !== 'string') { throw new TypeError('Expected String') } + if (source.length === 0) { return new Uint8Array() } + var psz = 0 + // Skip leading spaces. + if (source[psz] === ' ') { return } + // Skip and count leading '1's. + var zeroes = 0 + var length = 0 + while (source[psz] === LEADER) { + zeroes++ + psz++ + } + // Allocate enough space in big-endian base256 representation. + var size = (((source.length - psz) * FACTOR) + 1) >>> 0 // log(58) / log(256), rounded up. + var b256 = new Uint8Array(size) + // Process the characters. + while (source[psz]) { + // Decode character + var carry = BASE_MAP[source.charCodeAt(psz)] + // Invalid character + if (carry === 255) { return } + var i = 0 + for (var it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) { + carry += (BASE * b256[it3]) >>> 0 + b256[it3] = (carry % 256) >>> 0 + carry = (carry / 256) >>> 0 + } + if (carry !== 0) { throw new Error('Non-zero carry') } + length = i + psz++ + } + // Skip trailing spaces. + if (source[psz] === ' ') { return } + // Skip leading zeroes in b256. + var it4 = size - length + while (it4 !== size && b256[it4] === 0) { + it4++ + } + var vch = new Uint8Array(zeroes + (size - it4)) + var j = zeroes + while (it4 !== size) { + vch[j++] = b256[it4++] + } + return vch + } + function decode (string) { + var buffer = decodeUnsafe(string) + if (buffer) { return buffer } + throw new Error('Non-base' + BASE + ' character') } return { - namespace: match.groups.namespace, - reference: match.groups.reference - }; -} -function parseCaipAccountId(caipAccountId) { - const match = CAIP_ACCOUNT_ID_REGEX.exec(caipAccountId); - if (!_optionalChain([match, 'optionalAccess', _2 => _2.groups])) { - throw new Error("Invalid CAIP account ID."); + encode: encode, + decodeUnsafe: decodeUnsafe, + decode: decode } - return { - address: match.groups.accountAddress, - chainId: match.groups.chainId, - chain: { - namespace: match.groups.namespace, - reference: match.groups.reference - } - }; -} -function toCaipChainId(namespace, reference) { - if (!isCaipNamespace(namespace)) { - throw new Error( - `Invalid "namespace", must match: ${CAIP_NAMESPACE_REGEX.toString()}` - ); - } - if (!isCaipReference(reference)) { - throw new Error( - `Invalid "reference", must match: ${CAIP_REFERENCE_REGEX.toString()}` - ); - } - return `${namespace}:${reference}`; } +module.exports = base - - - - - - - - - - - - - - - - - - - -exports.CAIP_CHAIN_ID_REGEX = CAIP_CHAIN_ID_REGEX; exports.CAIP_NAMESPACE_REGEX = CAIP_NAMESPACE_REGEX; exports.CAIP_REFERENCE_REGEX = CAIP_REFERENCE_REGEX; exports.CAIP_ACCOUNT_ID_REGEX = CAIP_ACCOUNT_ID_REGEX; exports.CAIP_ACCOUNT_ADDRESS_REGEX = CAIP_ACCOUNT_ADDRESS_REGEX; exports.CaipChainIdStruct = CaipChainIdStruct; exports.CaipNamespaceStruct = CaipNamespaceStruct; exports.CaipReferenceStruct = CaipReferenceStruct; exports.CaipAccountIdStruct = CaipAccountIdStruct; exports.CaipAccountAddressStruct = CaipAccountAddressStruct; exports.KnownCaipNamespace = KnownCaipNamespace; exports.isCaipChainId = isCaipChainId; exports.isCaipNamespace = isCaipNamespace; exports.isCaipReference = isCaipReference; exports.isCaipAccountId = isCaipAccountId; exports.isCaipAccountAddress = isCaipAccountAddress; exports.parseCaipChainId = parseCaipChainId; exports.parseCaipAccountId = parseCaipAccountId; exports.toCaipChainId = toCaipChainId; -//# sourceMappingURL=chunk-YWAID473.js.map - -/***/ }), - -/***/ 51584: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; -Object.defineProperty(exports, "__esModule", ({value: true})); - - - -var _chunk3W5G4CYIjs = __webpack_require__(85244); - -// src/collections.ts -var _map; -var FrozenMap = class { - constructor(entries) { - _chunk3W5G4CYIjs.__privateAdd.call(void 0, this, _map, void 0); - _chunk3W5G4CYIjs.__privateSet.call(void 0, this, _map, new Map(entries)); - Object.freeze(this); - } - get size() { - return _chunk3W5G4CYIjs.__privateGet.call(void 0, this, _map).size; - } - [Symbol.iterator]() { - return _chunk3W5G4CYIjs.__privateGet.call(void 0, this, _map)[Symbol.iterator](); - } - entries() { - return _chunk3W5G4CYIjs.__privateGet.call(void 0, this, _map).entries(); - } - forEach(callbackfn, thisArg) { - return _chunk3W5G4CYIjs.__privateGet.call(void 0, this, _map).forEach( - (value, key, _map2) => callbackfn.call(thisArg, value, key, this) - ); - } - get(key) { - return _chunk3W5G4CYIjs.__privateGet.call(void 0, this, _map).get(key); - } - has(key) { - return _chunk3W5G4CYIjs.__privateGet.call(void 0, this, _map).has(key); - } - keys() { - return _chunk3W5G4CYIjs.__privateGet.call(void 0, this, _map).keys(); - } - values() { - return _chunk3W5G4CYIjs.__privateGet.call(void 0, this, _map).values(); - } - toString() { - return `FrozenMap(${this.size}) {${this.size > 0 ? ` ${[...this.entries()].map(([key, value]) => `${String(key)} => ${String(value)}`).join(", ")} ` : ""}}`; - } -}; -_map = new WeakMap(); -var _set; -var FrozenSet = class { - constructor(values) { - _chunk3W5G4CYIjs.__privateAdd.call(void 0, this, _set, void 0); - _chunk3W5G4CYIjs.__privateSet.call(void 0, this, _set, new Set(values)); - Object.freeze(this); - } - get size() { - return _chunk3W5G4CYIjs.__privateGet.call(void 0, this, _set).size; - } - [Symbol.iterator]() { - return _chunk3W5G4CYIjs.__privateGet.call(void 0, this, _set)[Symbol.iterator](); - } - entries() { - return _chunk3W5G4CYIjs.__privateGet.call(void 0, this, _set).entries(); - } - forEach(callbackfn, thisArg) { - return _chunk3W5G4CYIjs.__privateGet.call(void 0, this, _set).forEach( - (value, value2, _set2) => callbackfn.call(thisArg, value, value2, this) - ); - } - has(value) { - return _chunk3W5G4CYIjs.__privateGet.call(void 0, this, _set).has(value); - } - keys() { - return _chunk3W5G4CYIjs.__privateGet.call(void 0, this, _set).keys(); - } - values() { - return _chunk3W5G4CYIjs.__privateGet.call(void 0, this, _set).values(); - } - toString() { - return `FrozenSet(${this.size}) {${this.size > 0 ? ` ${[...this.values()].map((member) => String(member)).join(", ")} ` : ""}}`; - } -}; -_set = new WeakMap(); -Object.freeze(FrozenMap); -Object.freeze(FrozenMap.prototype); -Object.freeze(FrozenSet); -Object.freeze(FrozenSet.prototype); - - - - -exports.FrozenMap = FrozenMap; exports.FrozenSet = FrozenSet; -//# sourceMappingURL=chunk-Z2RGWDD7.js.map - -/***/ }), - -/***/ 22049: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; -Object.defineProperty(exports, "__esModule", ({value: true}));__webpack_require__(87982); - - - - - -var _chunkVFXTVNXNjs = __webpack_require__(41535); -__webpack_require__(58383); - - -var _chunkC6HGFEYLjs = __webpack_require__(39705); - - - - -var _chunk4RMX5YWEjs = __webpack_require__(69116); -__webpack_require__(43207); - - - - - - - - - - -var _chunk4D6XQBHAjs = __webpack_require__(73631); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -var _chunkOLLG4H35js = __webpack_require__(87427); -__webpack_require__(61305); - - - -var _chunk2LBGT4GHjs = __webpack_require__(61275); - - - - - - - - - - - - - - - - - - - - -var _chunkYWAID473js = __webpack_require__(2489); - - -var _chunkE4C7EW4Rjs = __webpack_require__(1508); - - -var _chunk6NZW4WK4js = __webpack_require__(21848); - - - - - -var _chunkDHVKFDHQjs = __webpack_require__(1203); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -var _chunkQEPVHEP7js = __webpack_require__(75363); - - - - - -var _chunk6ZDHSOUVjs = __webpack_require__(40932); - - - - - - -var _chunkIZC266HSjs = __webpack_require__(1486); - - - - - - - - - - - - -var _chunkQVEKZRZ2js = __webpack_require__(96526); - - - -var _chunkZ2RGWDD7js = __webpack_require__(51584); -__webpack_require__(85244); -__webpack_require__(51423); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -exports.AssertionError = _chunk6ZDHSOUVjs.AssertionError; exports.CAIP_ACCOUNT_ADDRESS_REGEX = _chunkYWAID473js.CAIP_ACCOUNT_ADDRESS_REGEX; exports.CAIP_ACCOUNT_ID_REGEX = _chunkYWAID473js.CAIP_ACCOUNT_ID_REGEX; exports.CAIP_CHAIN_ID_REGEX = _chunkYWAID473js.CAIP_CHAIN_ID_REGEX; exports.CAIP_NAMESPACE_REGEX = _chunkYWAID473js.CAIP_NAMESPACE_REGEX; exports.CAIP_REFERENCE_REGEX = _chunkYWAID473js.CAIP_REFERENCE_REGEX; exports.CaipAccountAddressStruct = _chunkYWAID473js.CaipAccountAddressStruct; exports.CaipAccountIdStruct = _chunkYWAID473js.CaipAccountIdStruct; exports.CaipChainIdStruct = _chunkYWAID473js.CaipChainIdStruct; exports.CaipNamespaceStruct = _chunkYWAID473js.CaipNamespaceStruct; exports.CaipReferenceStruct = _chunkYWAID473js.CaipReferenceStruct; exports.ChecksumStruct = _chunkE4C7EW4Rjs.ChecksumStruct; exports.Duration = _chunk4RMX5YWEjs.Duration; exports.ESCAPE_CHARACTERS_REGEXP = _chunkQVEKZRZ2js.ESCAPE_CHARACTERS_REGEXP; exports.FrozenMap = _chunkZ2RGWDD7js.FrozenMap; exports.FrozenSet = _chunkZ2RGWDD7js.FrozenSet; exports.HexAddressStruct = _chunkQEPVHEP7js.HexAddressStruct; exports.HexChecksumAddressStruct = _chunkQEPVHEP7js.HexChecksumAddressStruct; exports.HexStruct = _chunkQEPVHEP7js.HexStruct; exports.JsonRpcErrorStruct = _chunkOLLG4H35js.JsonRpcErrorStruct; exports.JsonRpcFailureStruct = _chunkOLLG4H35js.JsonRpcFailureStruct; exports.JsonRpcIdStruct = _chunkOLLG4H35js.JsonRpcIdStruct; exports.JsonRpcNotificationStruct = _chunkOLLG4H35js.JsonRpcNotificationStruct; exports.JsonRpcParamsStruct = _chunkOLLG4H35js.JsonRpcParamsStruct; exports.JsonRpcRequestStruct = _chunkOLLG4H35js.JsonRpcRequestStruct; exports.JsonRpcResponseStruct = _chunkOLLG4H35js.JsonRpcResponseStruct; exports.JsonRpcSuccessStruct = _chunkOLLG4H35js.JsonRpcSuccessStruct; exports.JsonRpcVersionStruct = _chunkOLLG4H35js.JsonRpcVersionStruct; exports.JsonSize = _chunkQVEKZRZ2js.JsonSize; exports.JsonStruct = _chunkOLLG4H35js.JsonStruct; exports.KnownCaipNamespace = _chunkYWAID473js.KnownCaipNamespace; exports.PendingJsonRpcResponseStruct = _chunkOLLG4H35js.PendingJsonRpcResponseStruct; exports.StrictHexStruct = _chunkQEPVHEP7js.StrictHexStruct; exports.UnsafeJsonStruct = _chunkOLLG4H35js.UnsafeJsonStruct; exports.VersionRangeStruct = _chunk4D6XQBHAjs.VersionRangeStruct; exports.VersionStruct = _chunk4D6XQBHAjs.VersionStruct; exports.add0x = _chunkQEPVHEP7js.add0x; exports.assert = _chunk6ZDHSOUVjs.assert; exports.assertExhaustive = _chunk6ZDHSOUVjs.assertExhaustive; exports.assertIsBytes = _chunkQEPVHEP7js.assertIsBytes; exports.assertIsHexString = _chunkQEPVHEP7js.assertIsHexString; exports.assertIsJsonRpcError = _chunkOLLG4H35js.assertIsJsonRpcError; exports.assertIsJsonRpcFailure = _chunkOLLG4H35js.assertIsJsonRpcFailure; exports.assertIsJsonRpcNotification = _chunkOLLG4H35js.assertIsJsonRpcNotification; exports.assertIsJsonRpcRequest = _chunkOLLG4H35js.assertIsJsonRpcRequest; exports.assertIsJsonRpcResponse = _chunkOLLG4H35js.assertIsJsonRpcResponse; exports.assertIsJsonRpcSuccess = _chunkOLLG4H35js.assertIsJsonRpcSuccess; exports.assertIsPendingJsonRpcResponse = _chunkOLLG4H35js.assertIsPendingJsonRpcResponse; exports.assertIsSemVerRange = _chunk4D6XQBHAjs.assertIsSemVerRange; exports.assertIsSemVerVersion = _chunk4D6XQBHAjs.assertIsSemVerVersion; exports.assertIsStrictHexString = _chunkQEPVHEP7js.assertIsStrictHexString; exports.assertStruct = _chunk6ZDHSOUVjs.assertStruct; exports.base64 = _chunk6NZW4WK4js.base64; exports.base64ToBytes = _chunkQEPVHEP7js.base64ToBytes; exports.bigIntToBytes = _chunkQEPVHEP7js.bigIntToBytes; exports.bigIntToHex = _chunkVFXTVNXNjs.bigIntToHex; exports.bytesToBase64 = _chunkQEPVHEP7js.bytesToBase64; exports.bytesToBigInt = _chunkQEPVHEP7js.bytesToBigInt; exports.bytesToHex = _chunkQEPVHEP7js.bytesToHex; exports.bytesToNumber = _chunkQEPVHEP7js.bytesToNumber; exports.bytesToSignedBigInt = _chunkQEPVHEP7js.bytesToSignedBigInt; exports.bytesToString = _chunkQEPVHEP7js.bytesToString; exports.calculateNumberSize = _chunkQVEKZRZ2js.calculateNumberSize; exports.calculateStringSize = _chunkQVEKZRZ2js.calculateStringSize; exports.concatBytes = _chunkQEPVHEP7js.concatBytes; exports.createBigInt = _chunkDHVKFDHQjs.createBigInt; exports.createBytes = _chunkDHVKFDHQjs.createBytes; exports.createDataView = _chunkQEPVHEP7js.createDataView; exports.createDeferredPromise = _chunkC6HGFEYLjs.createDeferredPromise; exports.createHex = _chunkDHVKFDHQjs.createHex; exports.createModuleLogger = _chunk2LBGT4GHjs.createModuleLogger; exports.createNumber = _chunkDHVKFDHQjs.createNumber; exports.createProjectLogger = _chunk2LBGT4GHjs.createProjectLogger; exports.exactOptional = _chunkOLLG4H35js.exactOptional; exports.getChecksumAddress = _chunkQEPVHEP7js.getChecksumAddress; exports.getErrorMessage = _chunkIZC266HSjs.getErrorMessage; exports.getJsonRpcIdValidator = _chunkOLLG4H35js.getJsonRpcIdValidator; exports.getJsonSize = _chunkOLLG4H35js.getJsonSize; exports.getKnownPropertyNames = _chunkQVEKZRZ2js.getKnownPropertyNames; exports.getSafeJson = _chunkOLLG4H35js.getSafeJson; exports.gtRange = _chunk4D6XQBHAjs.gtRange; exports.gtVersion = _chunk4D6XQBHAjs.gtVersion; exports.hasProperty = _chunkQVEKZRZ2js.hasProperty; exports.hexToBigInt = _chunkVFXTVNXNjs.hexToBigInt; exports.hexToBytes = _chunkQEPVHEP7js.hexToBytes; exports.hexToNumber = _chunkVFXTVNXNjs.hexToNumber; exports.inMilliseconds = _chunk4RMX5YWEjs.inMilliseconds; exports.isASCII = _chunkQVEKZRZ2js.isASCII; exports.isBytes = _chunkQEPVHEP7js.isBytes; exports.isCaipAccountAddress = _chunkYWAID473js.isCaipAccountAddress; exports.isCaipAccountId = _chunkYWAID473js.isCaipAccountId; exports.isCaipChainId = _chunkYWAID473js.isCaipChainId; exports.isCaipNamespace = _chunkYWAID473js.isCaipNamespace; exports.isCaipReference = _chunkYWAID473js.isCaipReference; exports.isErrorWithCode = _chunkIZC266HSjs.isErrorWithCode; exports.isErrorWithMessage = _chunkIZC266HSjs.isErrorWithMessage; exports.isErrorWithStack = _chunkIZC266HSjs.isErrorWithStack; exports.isHexString = _chunkQEPVHEP7js.isHexString; exports.isJsonRpcError = _chunkOLLG4H35js.isJsonRpcError; exports.isJsonRpcFailure = _chunkOLLG4H35js.isJsonRpcFailure; exports.isJsonRpcNotification = _chunkOLLG4H35js.isJsonRpcNotification; exports.isJsonRpcRequest = _chunkOLLG4H35js.isJsonRpcRequest; exports.isJsonRpcResponse = _chunkOLLG4H35js.isJsonRpcResponse; exports.isJsonRpcSuccess = _chunkOLLG4H35js.isJsonRpcSuccess; exports.isNonEmptyArray = _chunkQVEKZRZ2js.isNonEmptyArray; exports.isNullOrUndefined = _chunkQVEKZRZ2js.isNullOrUndefined; exports.isObject = _chunkQVEKZRZ2js.isObject; exports.isPendingJsonRpcResponse = _chunkOLLG4H35js.isPendingJsonRpcResponse; exports.isPlainObject = _chunkQVEKZRZ2js.isPlainObject; exports.isStrictHexString = _chunkQEPVHEP7js.isStrictHexString; exports.isValidChecksumAddress = _chunkQEPVHEP7js.isValidChecksumAddress; exports.isValidHexAddress = _chunkQEPVHEP7js.isValidHexAddress; exports.isValidJson = _chunkOLLG4H35js.isValidJson; exports.isValidSemVerRange = _chunk4D6XQBHAjs.isValidSemVerRange; exports.isValidSemVerVersion = _chunk4D6XQBHAjs.isValidSemVerVersion; exports.jsonrpc2 = _chunkOLLG4H35js.jsonrpc2; exports.numberToBytes = _chunkQEPVHEP7js.numberToBytes; exports.numberToHex = _chunkVFXTVNXNjs.numberToHex; exports.object = _chunkOLLG4H35js.object; exports.parseCaipAccountId = _chunkYWAID473js.parseCaipAccountId; exports.parseCaipChainId = _chunkYWAID473js.parseCaipChainId; exports.remove0x = _chunkQEPVHEP7js.remove0x; exports.satisfiesVersionRange = _chunk4D6XQBHAjs.satisfiesVersionRange; exports.signedBigIntToBytes = _chunkQEPVHEP7js.signedBigIntToBytes; exports.stringToBytes = _chunkQEPVHEP7js.stringToBytes; exports.timeSince = _chunk4RMX5YWEjs.timeSince; exports.toCaipChainId = _chunkYWAID473js.toCaipChainId; exports.valueToBytes = _chunkQEPVHEP7js.valueToBytes; exports.wrapError = _chunkIZC266HSjs.wrapError; -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ 82102: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.output = exports.exists = exports.hash = exports.bytes = exports.bool = exports.number = exports.isBytes = void 0; -function number(n) { - if (!Number.isSafeInteger(n) || n < 0) - throw new Error(`positive integer expected, not ${n}`); -} -exports.number = number; -function bool(b) { - if (typeof b !== 'boolean') - throw new Error(`boolean expected, not ${b}`); -} -exports.bool = bool; -// copied from utils -function isBytes(a) { - return (a instanceof Uint8Array || - (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array')); -} -exports.isBytes = isBytes; -function bytes(b, ...lengths) { - if (!isBytes(b)) - throw new Error('Uint8Array expected'); - if (lengths.length > 0 && !lengths.includes(b.length)) - throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`); -} -exports.bytes = bytes; -function hash(h) { - if (typeof h !== 'function' || typeof h.create !== 'function') - throw new Error('Hash should be wrapped by utils.wrapConstructor'); - number(h.outputLen); - number(h.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 - -/***/ }), - -/***/ 17335: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.add5L = exports.add5H = exports.add4H = exports.add4L = exports.add3H = exports.add3L = exports.add = exports.rotlBL = exports.rotlBH = exports.rotlSL = exports.rotlSH = exports.rotr32L = exports.rotr32H = exports.rotrBL = exports.rotrBH = exports.rotrSL = exports.rotrSH = exports.shrSL = exports.shrSH = exports.toBig = exports.split = exports.fromBig = void 0; -const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1); -const _32n = /* @__PURE__ */ 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; -exports.shrSH = shrSH; -const shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s); -exports.shrSL = shrSL; -// Right rotate for Shift in [1, 32) -const rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s)); -exports.rotrSH = rotrSH; -const rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s); -exports.rotrSL = rotrSL; -// Right rotate for Shift in (32, 64), NOTE: 32 is special case. -const rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32)); -exports.rotrBH = rotrBH; -const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s)); -exports.rotrBL = rotrBL; -// Right rotate for shift===32 (just swaps l&h) -const rotr32H = (_h, l) => l; -exports.rotr32H = rotr32H; -const rotr32L = (h, _l) => h; -exports.rotr32L = rotr32L; -// Left rotate for Shift in [1, 32) -const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s)); -exports.rotlSH = rotlSH; -const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s)); -exports.rotlSL = rotlSL; -// Left rotate for Shift in (32, 64), NOTE: 32 is special case. -const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s)); -exports.rotlBH = rotlBH; -const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s)); -exports.rotlBL = rotlBL; -// 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. -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); -exports.add3L = add3L; -const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0; -exports.add3H = add3H; -const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0); -exports.add4L = add4L; -const add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0; -exports.add4H = add4H; -const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0); -exports.add5L = add5L; -const add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0; -exports.add5H = add5H; -// prettier-ignore -const u64 = { - fromBig, split, 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 - -/***/ }), - -/***/ 6256: -/***/ ((__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 - -/***/ }), - -/***/ 2214: -/***/ ((__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__(82102); -const _u64_js_1 = __webpack_require__(17335); -const utils_js_1 = __webpack_require__(79520); -// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size. -// It's called a sponge function. -// Various per round constants calculations -const SHA3_PI = []; -const SHA3_ROTL = []; -const _SHA3_IOTA = []; -const _0n = /* @__PURE__ */ BigInt(0); -const _1n = /* @__PURE__ */ BigInt(1); -const _2n = /* @__PURE__ */ BigInt(2); -const _7n = /* @__PURE__ */ BigInt(7); -const _256n = /* @__PURE__ */ BigInt(256); -const _0x71n = /* @__PURE__ */ 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 << /* @__PURE__ */ BigInt(j)) - _1n); - } - _SHA3_IOTA.push(t); -} -const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ (0, _u64_js_1.split)(_SHA3_IOTA, true); -// Left rotation (without 0, 32, 64) -const rotlH = (h, l, s) => (s > 32 ? (0, _u64_js_1.rotlBH)(h, l, s) : (0, _u64_js_1.rotlSH)(h, l, s)); -const rotlL = (h, l, s) => (s > 32 ? (0, _u64_js_1.rotlBL)(h, l, s) : (0, _u64_js_1.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 - (0, _assert_js_1.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() { - if (!utils_js_1.isLE) - (0, utils_js_1.byteSwap32)(this.state32); - keccakP(this.state32, this.rounds); - if (!utils_js_1.isLE) - (0, utils_js_1.byteSwap32)(this.state32); - this.posOut = 0; - this.pos = 0; - } - update(data) { - (0, _assert_js_1.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) { - (0, _assert_js_1.exists)(this, false); - (0, _assert_js_1.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) { - (0, _assert_js_1.number)(bytes); - return this.xofInto(new Uint8Array(bytes)); - } - digestInto(out) { - (0, _assert_js_1.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.wrapXOFConstructorWithOpts)((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 - -/***/ }), - -/***/ 79520: -/***/ ((__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.wrapXOFConstructorWithOpts = exports.wrapConstructorWithOpts = exports.wrapConstructor = exports.checkOpts = exports.Hash = exports.concatBytes = exports.toBytes = exports.utf8ToBytes = exports.asyncLoop = exports.nextTick = exports.hexToBytes = exports.bytesToHex = exports.byteSwap32 = exports.byteSwapIfBE = exports.byteSwap = exports.isLE = exports.rotl = exports.rotr = exports.createView = exports.u32 = exports.u8 = exports.isBytes = void 0; -// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+. -// 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 (2025-04-30), we can just drop the import. -const crypto_1 = __webpack_require__(6256); -const _assert_js_1 = __webpack_require__(82102); -// export { isBytes } from './_assert.js'; -// We can't reuse isBytes from _assert, because somehow this causes huge perf issues -function isBytes(a) { - return (a instanceof Uint8Array || - (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array')); -} -exports.isBytes = isBytes; -// 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; -// The rotate left (circular left shift) operation for uint32 -const rotl = (word, shift) => (word << shift) | ((word >>> (32 - shift)) >>> 0); -exports.rotl = rotl; -exports.isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44; -// The byte swap operation for uint32 -const byteSwap = (word) => ((word << 24) & 0xff000000) | - ((word << 8) & 0xff0000) | - ((word >>> 8) & 0xff00) | - ((word >>> 24) & 0xff); -exports.byteSwap = byteSwap; -// Conditionally byte swap if on a big-endian platform -exports.byteSwapIfBE = exports.isLE ? (n) => n : (n) => (0, exports.byteSwap)(n); -// In place byte swap for Uint32Array -function byteSwap32(arr) { - for (let i = 0; i < arr.length; i++) { - arr[i] = (0, exports.byteSwap)(arr[i]); - } -} -exports.byteSwap32 = byteSwap32; -// Array where index 0xf0 (240) is mapped to string 'f0' -const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0')); -/** - * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123' - */ -function bytesToHex(bytes) { - (0, _assert_js_1.bytes)(bytes); - // 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; -// We use optimized technique to convert hex string to byte array -const asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 }; -function asciiToBase16(char) { - if (char >= asciis._0 && char <= asciis._9) - return char - asciis._0; - if (char >= asciis._A && char <= asciis._F) - return char - (asciis._A - 10); - if (char >= asciis._a && char <= asciis._f) - return char - (asciis._a - 10); - return; -} -/** - * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23]) - */ -function hexToBytes(hex) { - if (typeof hex !== 'string') - throw new Error('hex string expected, got ' + typeof hex); - const hl = hex.length; - const al = hl / 2; - if (hl % 2) - throw new Error('padded hex string expected, got unpadded hex of length ' + hl); - const array = new Uint8Array(al); - for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) { - const n1 = asciiToBase16(hex.charCodeAt(hi)); - const n2 = asciiToBase16(hex.charCodeAt(hi + 1)); - if (n1 === undefined || n2 === undefined) { - const char = hex[hi] + hex[hi + 1]; - throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi); - } - array[ai] = n1 * 16 + n2; - } - 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; -/** - * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) - */ -function utf8ToBytes(str) { - if (typeof str !== 'string') - throw new Error(`utf8ToBytes expected string, got ${typeof str}`); - return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809 -} -exports.utf8ToBytes = utf8ToBytes; -/** - * Normalizes (non-hex) string or Uint8Array to Uint8Array. - * Warning: when Uint8Array is passed, it would NOT get copied. - * Keep in mind for future mutable operations. - */ -function toBytes(data) { - if (typeof data === 'string') - data = utf8ToBytes(data); - (0, _assert_js_1.bytes)(data); - return data; -} -exports.toBytes = toBytes; -/** - * Copies several Uint8Arrays into one. - */ -function concatBytes(...arrays) { - let sum = 0; - for (let i = 0; i < arrays.length; i++) { - const a = arrays[i]; - (0, _assert_js_1.bytes)(a); - sum += a.length; - } - const res = new Uint8Array(sum); - for (let i = 0, pad = 0; i < arrays.length; i++) { - const a = arrays[i]; - res.set(a, pad); - pad += a.length; - } - return res; -} -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; -const toStr = {}.toString; -function checkOpts(defaults, opts) { - if (opts !== undefined && toStr.call(opts) !== '[object Object]') - throw new Error('Options should be object or undefined'); - const merged = Object.assign(defaults, opts); - return merged; -} -exports.checkOpts = checkOpts; -function wrapConstructor(hashCons) { - const hashC = (msg) => hashCons().update(toBytes(msg)).digest(); - const tmp = hashCons(); - hashC.outputLen = tmp.outputLen; - hashC.blockLen = tmp.blockLen; - hashC.create = () => hashCons(); - 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; -function wrapXOFConstructorWithOpts(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.wrapXOFConstructorWithOpts = wrapXOFConstructorWithOpts; -/** - * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS. - */ -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 - /***/ }), /***/ 73562: @@ -7480,7 +8216,7 @@ exports.createHasher = exports.isogenyMap = exports.hash_to_field = exports.expa const modular_js_1 = __webpack_require__(24967); const utils_js_1 = __webpack_require__(91484); function validateDST(dst) { - if ((0, utils_js_1.isBytes)(dst)) + if (dst instanceof Uint8Array) return dst; if (typeof dst === 'string') return (0, utils_js_1.utf8ToBytes)(dst); @@ -7507,8 +8243,8 @@ function strxor(a, b) { } return arr; } -function abytes(item) { - if (!(0, utils_js_1.isBytes)(item)) +function isBytes(item) { + if (!(item instanceof Uint8Array)) throw new Error('Uint8Array expected'); } function isNum(item) { @@ -7518,8 +8254,8 @@ function isNum(item) { // Produces a uniformly random byte string using a cryptographic hash function H that outputs b bits // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.1 function expand_message_xmd(msg, DST, lenInBytes, H) { - abytes(msg); - abytes(DST); + isBytes(msg); + isBytes(DST); isNum(lenInBytes); // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3 if (DST.length > 255) @@ -7548,8 +8284,8 @@ exports.expand_message_xmd = expand_message_xmd; // a random oracle under a reasonable cryptographic assumption. // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.2 function expand_message_xof(msg, DST, lenInBytes, k, H) { - abytes(msg); - abytes(DST); + isBytes(msg); + isBytes(DST); isNum(lenInBytes); // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3 // DST = H('H2C-OVERSIZE-DST-' || a_very_long_DST, Math.ceil((lenInBytes * k) / 8)); @@ -7585,7 +8321,7 @@ function hash_to_field(msg, count, options) { hash: 'hash', }); const { p, k, m, hash, expand, DST: _DST } = options; - abytes(msg); + isBytes(msg); isNum(count); const DST = validateDST(_DST); const log2p = p.toString(2).length; @@ -8110,7 +8846,7 @@ exports.mapHashToField = mapHashToField; "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 = exports.isBytes = void 0; +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) */ // 100 lines of code in the file are duplicated from noble-hashes (utils). // This is OK: `abstract` directory does not use noble-hashes. @@ -8119,18 +8855,13 @@ exports.validateObject = exports.createHmacDrbg = exports.bitMask = exports.bitS const _0n = BigInt(0); const _1n = BigInt(1); const _2n = BigInt(2); -function isBytes(a) { - return (a instanceof Uint8Array || - (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array')); -} -exports.isBytes = isBytes; -// Array where index 0xf0 (240) is mapped to string 'f0' +const u8a = (a) => a instanceof Uint8Array; const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0')); /** * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123' */ function bytesToHex(bytes) { - if (!isBytes(bytes)) + if (!u8a(bytes)) throw new Error('Uint8Array expected'); // pre-caching improves the speed 6x let hex = ''; @@ -8152,36 +8883,23 @@ function hexToNumber(hex) { return BigInt(hex === '' ? '0' : `0x${hex}`); } exports.hexToNumber = hexToNumber; -// We use optimized technique to convert hex string to byte array -const asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 }; -function asciiToBase16(char) { - if (char >= asciis._0 && char <= asciis._9) - return char - asciis._0; - if (char >= asciis._A && char <= asciis._F) - return char - (asciis._A - 10); - if (char >= asciis._a && char <= asciis._f) - return char - (asciis._a - 10); - return; -} /** * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23]) */ function hexToBytes(hex) { if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex); - const hl = hex.length; - const al = hl / 2; - if (hl % 2) - throw new Error('padded hex string expected, got unpadded hex of length ' + hl); - const array = new Uint8Array(al); - for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) { - const n1 = asciiToBase16(hex.charCodeAt(hi)); - const n2 = asciiToBase16(hex.charCodeAt(hi + 1)); - if (n1 === undefined || n2 === undefined) { - const char = hex[hi] + hex[hi + 1]; - throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi); - } - array[ai] = n1 * 16 + n2; + const len = hex.length; + if (len % 2) + throw new Error('padded hex string expected, got unpadded hex of length ' + len); + const array = new Uint8Array(len / 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; } @@ -8192,7 +8910,7 @@ function bytesToNumberBE(bytes) { } exports.bytesToNumberBE = bytesToNumberBE; function bytesToNumberLE(bytes) { - if (!isBytes(bytes)) + if (!u8a(bytes)) throw new Error('Uint8Array expected'); return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse())); } @@ -8229,7 +8947,7 @@ function ensureBytes(title, hex, expectedLength) { throw new Error(`${title} must be valid hex string, got "${hex}". Cause: ${e}`); } } - else if (isBytes(hex)) { + 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); @@ -8247,31 +8965,25 @@ exports.ensureBytes = ensureBytes; * Copies several Uint8Arrays into one. */ function concatBytes(...arrays) { - let sum = 0; - for (let i = 0; i < arrays.length; i++) { - const a = arrays[i]; - if (!isBytes(a)) + const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0)); + let pad = 0; // walk through each item, ensure they have proper type + arrays.forEach((a) => { + if (!u8a(a)) throw new Error('Uint8Array expected'); - sum += a.length; - } - let res = new Uint8Array(sum); - let pad = 0; - for (let i = 0; i < arrays.length; i++) { - const a = arrays[i]; - res.set(a, pad); + r.set(a, pad); pad += a.length; - } - return res; + }); + return r; } exports.concatBytes = concatBytes; -// Compares 2 u8a-s in kinda constant time -function equalBytes(a, b) { - if (a.length !== b.length) +function equalBytes(b1, b2) { + // We don't care about timing attacks here + if (b1.length !== b2.length) return false; - let diff = 0; - for (let i = 0; i < a.length; i++) - diff |= a[i] ^ b[i]; - return diff === 0; + for (let i = 0; i < b1.length; i++) + if (b1[i] !== b2[i]) + return false; + return true; } exports.equalBytes = equalBytes; /** @@ -8385,7 +9097,7 @@ const validatorFns = { function: (val) => typeof val === 'function', boolean: (val) => typeof val === 'boolean', string: (val) => typeof val === 'string', - stringOrUint8Array: (val) => typeof val === 'string' || isBytes(val), + stringOrUint8Array: (val) => typeof val === 'string' || val instanceof Uint8Array, isSafeInteger: (val) => Number.isSafeInteger(val), array: (val) => Array.isArray(val), field: (val, object) => object.Fp.isValid(val), @@ -8494,7 +9206,7 @@ exports.DER = { // parse DER signature const { Err: E } = exports.DER; const data = typeof hex === 'string' ? h2b(hex) : hex; - if (!ut.isBytes(data)) + if (!(data instanceof Uint8Array)) throw new Error('ui8a expected'); let l = data.length; if (l < 2 || data[0] != 0x30) @@ -8572,7 +9284,7 @@ function weierstrassPoints(opts) { function normPrivateKeyToScalar(key) { const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE; if (lengths && typeof key !== 'bigint') { - if (ut.isBytes(key)) + 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)) @@ -9151,7 +9863,7 @@ function weierstrass(curveDef) { * Quick and dirty check for item being public key. Does not validate hex, or being on-curve. */ function isProbPub(item) { - const arr = ut.isBytes(item); + const arr = item instanceof Uint8Array; const str = typeof item === 'string'; const len = (arr || str) && item.length; if (arr) @@ -9312,7 +10024,7 @@ function weierstrass(curveDef) { let _sig = undefined; let P; try { - if (typeof sg === 'string' || ut.isBytes(sg)) { + 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 { @@ -9543,15 +10255,15 @@ function sqrtMod(y) { } const Fp = (0, modular_js_1.Field)(secp256k1P, undefined, undefined, { sqrt: sqrtMod }); exports.secp256k1 = (0, _shortw_utils_js_1.createCurve)({ - a: BigInt(0), // equation params: a, b - b: BigInt(7), // Seem to be rigid: bitcointalk.org/index.php?topic=289795.msg3183975#msg3183975 - Fp, // Field's prime: 2n**256n - 2n**32n - 2n**9n - 2n**8n - 2n**7n - 2n**6n - 2n**4n - 1n - n: secp256k1N, // Curve order, total count of valid points in the field + 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), // Cofactor - lowS: true, // Allow only low-S signatures by default in sign() and verify() + 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%. @@ -9774,13 +10486,8 @@ function bool(b) { throw new Error(`Expected boolean, not ${b}`); } exports.bool = bool; -// copied from utils -function isBytes(a) { - return (a instanceof Uint8Array || - (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array')); -} function bytes(b, ...lengths) { - if (!isBytes(b)) + if (!(b instanceof Uint8Array)) throw new Error('Expected Uint8Array'); if (lengths.length > 0 && !lengths.includes(b.length)) throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`); @@ -10501,17 +11208,14 @@ exports.randomBytes = exports.wrapXOFConstructorWithOpts = exports.wrapConstruct // 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 (2025-04-30), we can just drop the import. +// Once node.js 18 is deprecated, we can just drop the import. const crypto_1 = __webpack_require__(25145); +const u8a = (a) => a instanceof Uint8Array; // 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; -function isBytes(a) { - return (a instanceof Uint8Array || - (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array')); -} // Cast array to view const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength); exports.createView = createView; @@ -10520,18 +11224,15 @@ 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. -// Other libraries would silently corrupt the data instead of throwing an error, -// when they don't support it. exports.isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44; if (!exports.isLE) throw new Error('Non little-endian hardware is not supported'); -// Array where index 0xf0 (240) is mapped to string 'f0' const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0')); /** * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123' */ function bytesToHex(bytes) { - if (!isBytes(bytes)) + if (!u8a(bytes)) throw new Error('Uint8Array expected'); // pre-caching improves the speed 6x let hex = ''; @@ -10541,36 +11242,23 @@ function bytesToHex(bytes) { return hex; } exports.bytesToHex = bytesToHex; -// We use optimized technique to convert hex string to byte array -const asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 }; -function asciiToBase16(char) { - if (char >= asciis._0 && char <= asciis._9) - return char - asciis._0; - if (char >= asciis._A && char <= asciis._F) - return char - (asciis._A - 10); - if (char >= asciis._a && char <= asciis._f) - return char - (asciis._a - 10); - return; -} /** * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23]) */ function hexToBytes(hex) { if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex); - const hl = hex.length; - const al = hl / 2; - if (hl % 2) - throw new Error('padded hex string expected, got unpadded hex of length ' + hl); - const array = new Uint8Array(al); - for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) { - const n1 = asciiToBase16(hex.charCodeAt(hi)); - const n2 = asciiToBase16(hex.charCodeAt(hi + 1)); - if (n1 === undefined || n2 === undefined) { - const char = hex[hi] + hex[hi + 1]; - throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi); - } - array[ai] = n1 * 16 + n2; + const len = hex.length; + if (len % 2) + throw new Error('padded hex string expected, got unpadded hex of length ' + len); + const array = new Uint8Array(len / 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; } @@ -10611,7 +11299,7 @@ exports.utf8ToBytes = utf8ToBytes; function toBytes(data) { if (typeof data === 'string') data = utf8ToBytes(data); - if (!isBytes(data)) + if (!u8a(data)) throw new Error(`expected Uint8Array, got ${typeof data}`); return data; } @@ -10620,20 +11308,15 @@ exports.toBytes = toBytes; * Copies several Uint8Arrays into one. */ function concatBytes(...arrays) { - let sum = 0; - for (let i = 0; i < arrays.length; i++) { - const a = arrays[i]; - if (!isBytes(a)) + const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0)); + let pad = 0; // walk through each item, ensure they have proper type + arrays.forEach((a) => { + if (!u8a(a)) throw new Error('Uint8Array expected'); - sum += a.length; - } - const res = new Uint8Array(sum); - for (let i = 0, pad = 0; i < arrays.length; i++) { - const a = arrays[i]; - res.set(a, pad); + r.set(a, pad); pad += a.length; - } - return res; + }); + return r; } exports.concatBytes = concatBytes; // For runtime check if class implements interface @@ -10700,7 +11383,8 @@ exports.randomBytes = randomBytes; /*! 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.createBase58check = exports.base58xmr = exports.base58xrp = exports.base58flickr = exports.base58 = exports.base64urlnopad = exports.base64url = exports.base64nopad = exports.base64 = exports.base32crockford = exports.base32hex = exports.base32 = exports.base16 = exports.utils = exports.assertNumber = void 0; +exports.bytes = exports.stringToBytes = exports.str = exports.bytesToString = exports.hex = exports.utf8 = exports.bech32m = exports.bech32 = exports.base58check = exports.createBase58check = exports.base58xmr = exports.base58xrp = exports.base58flickr = exports.base58 = exports.base64urlnopad = exports.base64url = exports.base64nopad = exports.base64 = exports.base32crockford = exports.base32hexnopad = exports.base32hex = exports.base32nopad = exports.base32 = exports.base16 = exports.utils = void 0; +exports.assertNumber = assertNumber; // Utilities /** * @__NO_SIDE_EFFECTS__ @@ -10709,7 +11393,6 @@ function assertNumber(n) { if (!Number.isSafeInteger(n)) throw new Error(`Wrong integer: ${n}`); } -exports.assertNumber = assertNumber; function isBytes(a) { return (a instanceof Uint8Array || (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array')); @@ -11010,7 +11693,9 @@ exports.utils = { // --------------------- exports.base16 = chain(radix2(4), alphabet('0123456789ABCDEF'), join('')); exports.base32 = chain(radix2(5), alphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'), padding(5), join('')); +exports.base32nopad = chain(radix2(5), alphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'), join('')); exports.base32hex = chain(radix2(5), alphabet('0123456789ABCDEFGHIJKLMNOPQRSTUV'), padding(5), join('')); +exports.base32hexnopad = chain(radix2(5), alphabet('0123456789ABCDEFGHIJKLMNOPQRSTUV'), 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.base64nopad = chain(radix2(6), alphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'), join('')); @@ -11102,6 +11787,8 @@ function genBech32(encoding) { function encode(prefix, words, limit = 90) { if (typeof prefix !== 'string') throw new Error(`bech32.encode prefix should be string, not ${typeof prefix}`); + if (words instanceof Uint8Array) + words = Array.from(words); if (!Array.isArray(words) || (words.length && typeof words[0] !== 'number')) throw new Error(`bech32.encode words should be array of numbers, not ${typeof words}`); if (prefix.length === 0) @@ -11140,7 +11827,19 @@ function genBech32(encoding) { const { prefix, words } = decode(str, false); return { prefix, words, bytes: fromWords(words) }; } - return { encode, decode, decodeToBytes, decodeUnsafe, fromWords, fromWordsUnsafe, toWords }; + function encodeFromBytes(prefix, bytes) { + return encode(prefix, toWords(bytes)); + } + return { + encode, + decode, + encodeFromBytes, + decodeToBytes, + decodeUnsafe, + fromWords, + fromWordsUnsafe, + toWords, + }; } exports.bech32 = genBech32('bech32'); exports.bech32m = genBech32('bech32m'); @@ -11684,7 +12383,7 @@ exports["default"] = (left, right) => simpleHash([left, right]); /***/ 27351: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; /* Copyright 2018 0kims association. @@ -12214,7 +12913,6 @@ module.exports = wBigInt; /***/ 28803: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var console = __webpack_require__(96763); /* Copyright 2018 0kims association. @@ -12455,7 +13153,6 @@ class RTCtx { /***/ 98665: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var console = __webpack_require__(96763); /* Copyright 2018 0kims association. @@ -12716,7 +13413,7 @@ function unstringifyBigInts(o) { /***/ 71293: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; exports.code = new Buffer("AGFzbQEAAAABPApgAn9/AGABfwBgAX8Bf2ACf38Bf2ADf39/AX9gA39/fwBgA39+fwBgAn9+AGAEf39/fwBgBX9/f39/AAIQAQNlbnYGbWVtb3J5AgDoBwNsawABAgEDAwQEBQUGBwgFBQUAAAUFAAAAAQUFAAAFBQAAAAEFAAIBAAAFAAUAAAAIAQIAAgUICQgABQkDAAUFBQUAAgUFCAAIAgEBAAUFBQAAAAMAAgEAAAUABQAAAAgBAgACBQgJCAAFCQgIB8gJYghpbnRfY29weQAACGludF96ZXJvAAEHaW50X29uZQADCmludF9pc1plcm8AAgZpbnRfZXEABAdpbnRfZ3RlAAUHaW50X2FkZAAGB2ludF9zdWIABwppbnRfbXVsT2xkAAkHaW50X211bAAIB2ludF9kaXYADA5pbnRfaW52ZXJzZU1vZAANB2YxbV9hZGQADgdmMW1fc3ViAA8HZjFtX25lZwAQC2YxbV9tUmVkdWN0ABEHZjFtX211bAASCmYxbV9tdWxPbGQAExJmMW1fZnJvbU1vbnRnb21lcnkAFRBmMW1fdG9Nb250Z29tZXJ5ABQLZjFtX2ludmVyc2UAFghmMW1fY29weQAACGYxbV96ZXJvAAEKZjFtX2lzWmVybwACBmYxbV9lcQAEB2YxbV9vbmUAFwdmcm1fYWRkABgHZnJtX3N1YgAZB2ZybV9uZWcAGgtmcm1fbVJlZHVjdAAbB2ZybV9tdWwAHApmcm1fbXVsT2xkAB0SZnJtX2Zyb21Nb250Z29tZXJ5AB8QZnJtX3RvTW9udGdvbWVyeQAeC2ZybV9pbnZlcnNlACAIZnJtX2NvcHkAAAhmcm1femVybwABCmZybV9pc1plcm8AAgZmcm1fZXEABAdmcm1fb25lACEGZnJfYWRkABgGZnJfc3ViABkGZnJfbmVnABoGZnJfbXVsACIKZnJfaW52ZXJzZQAjB2ZyX2NvcHkAAAdmcl96ZXJvAAEGZnJfb25lACEJZnJfaXNaZXJvAAIFZnJfZXEABAlnMV9pc1plcm8AJAdnMV9jb3B5ACYHZzFfemVybwAlCWcxX2RvdWJsZQAnBmcxX2FkZAAoBmcxX25lZwApBmcxX3N1YgAqEWcxX2Zyb21Nb250Z29tZXJ5ACsPZzFfdG9Nb250Z29tZXJ5ACwJZzFfYWZmaW5lAC0OZzFfdGltZXNTY2FsYXIALgtnMV9tdWx0aWV4cAA1DGcxX211bHRpZXhwMgA5B2ZmdF9mZnQAQghmZnRfaWZmdABDEWZmdF90b01vbnRnb21lcnlOAD8TZmZ0X2Zyb21Nb250Z29tZXJ5TgA+FGZmdF9jb3B5TkludGVybGVhdmVkAD0IZmZ0X211bE4ARAhwb2xfemVybwBFD3BvbF9jb25zdHJ1Y3RMQwBGCmYybV9pc1plcm8ARwhmMm1femVybwBIB2YybV9vbmUASQhmMm1fY29weQBKB2YybV9tdWwASwdmMm1fYWRkAEwHZjJtX3N1YgBNB2YybV9uZWcAThJmMm1fZnJvbU1vbnRnb21lcnkAUBBmMm1fdG9Nb250Z29tZXJ5AE8GZjJtX2VxAFELZjJtX2ludmVyc2UAUglnMl9pc1plcm8AUwdnMl9jb3B5AFUHZzJfemVybwBUCWcyX2RvdWJsZQBWBmcyX2FkZABXBmcyX25lZwBYBmcyX3N1YgBZEWcyX2Zyb21Nb250Z29tZXJ5AFoPZzJfdG9Nb250Z29tZXJ5AFsJZzJfYWZmaW5lAFwOZzJfdGltZXNTY2FsYXIAXQtnMl9tdWx0aWV4cABkDGcyX211bHRpZXhwMgBoDHRlc3RfZjFtX211bABpD3Rlc3RfZjFtX211bE9sZABqCsfEAWsqACABIAApAwA3AwAgASAAKQMINwMIIAEgACkDEDcDECABIAApAxg3AxgLHgAgAEIANwMAIABCADcDCCAAQgA3AxAgAEIANwMYCzMAIAApAxhQBEAgACkDEFAEQCAAKQMIUARAIAApAwBQDwVBAA8LBUEADwsFQQAPC0EADwseACAAQgE3AwAgAEIANwMIIABCADcDECAAQgA3AxgLRwAgACkDGCABKQMYUQRAIAApAxAgASkDEFEEQCAAKQMIIAEpAwhRBEAgACkDACABKQMAUQ8FQQAPCwVBAA8LBUEADwtBAA8LfQAgACkDGCABKQMYVARAQQAPBSAAKQMYIAEpAxhWBEBBAQ8FIAApAxAgASkDEFQEQEEADwUgACkDECABKQMQVgRAQQEPBSAAKQMIIAEpAwhUBEBBAA8FIAApAwggASkDCFYEQEEBDwUgACkDACABKQMAWg8LCwsLCwtBAA8L1AEBAX4gADUCACABNQIAfCEDIAIgAz4CACAANQIEIAE1AgR8IANCIIh8IQMgAiADPgIEIAA1AgggATUCCHwgA0IgiHwhAyACIAM+AgggADUCDCABNQIMfCADQiCIfCEDIAIgAz4CDCAANQIQIAE1AhB8IANCIIh8IQMgAiADPgIQIAA1AhQgATUCFHwgA0IgiHwhAyACIAM+AhQgADUCGCABNQIYfCADQiCIfCEDIAIgAz4CGCAANQIcIAE1Ahx8IANCIIh8IQMgAiADPgIcIANCIIinC4wCAQF+IAA1AgAgATUCAH0hAyACIANC/////w+DPgIAIAA1AgQgATUCBH0gA0Igh3whAyACIANC/////w+DPgIEIAA1AgggATUCCH0gA0Igh3whAyACIANC/////w+DPgIIIAA1AgwgATUCDH0gA0Igh3whAyACIANC/////w+DPgIMIAA1AhAgATUCEH0gA0Igh3whAyACIANC/////w+DPgIQIAA1AhQgATUCFH0gA0Igh3whAyACIANC/////w+DPgIUIAA1AhggATUCGH0gA0Igh3whAyACIANC/////w+DPgIYIAA1AhwgATUCHH0gA0Igh3whAyACIANC/////w+DPgIcIANCIIenC48QEgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfiADQv////8PgyAANQIAIgUgATUCACIGfnwhAyAEIANCIIh8IQQgAiADPgIAIARCIIghAyAEQv////8PgyAFIAE1AgQiCH58IQQgAyAEQiCIfCEDIARC/////w+DIAA1AgQiByAGfnwhBCADIARCIIh8IQMgAiAEPgIEIANCIIghBCADQv////8PgyAFIAE1AggiCn58IQMgBCADQiCIfCEEIANC/////w+DIAcgCH58IQMgBCADQiCIfCEEIANC/////w+DIAA1AggiCSAGfnwhAyAEIANCIIh8IQQgAiADPgIIIARCIIghAyAEQv////8PgyAFIAE1AgwiDH58IQQgAyAEQiCIfCEDIARC/////w+DIAcgCn58IQQgAyAEQiCIfCEDIARC/////w+DIAkgCH58IQQgAyAEQiCIfCEDIARC/////w+DIAA1AgwiCyAGfnwhBCADIARCIIh8IQMgAiAEPgIMIANCIIghBCADQv////8PgyAFIAE1AhAiDn58IQMgBCADQiCIfCEEIANC/////w+DIAcgDH58IQMgBCADQiCIfCEEIANC/////w+DIAkgCn58IQMgBCADQiCIfCEEIANC/////w+DIAsgCH58IQMgBCADQiCIfCEEIANC/////w+DIAA1AhAiDSAGfnwhAyAEIANCIIh8IQQgAiADPgIQIARCIIghAyAEQv////8PgyAFIAE1AhQiEH58IQQgAyAEQiCIfCEDIARC/////w+DIAcgDn58IQQgAyAEQiCIfCEDIARC/////w+DIAkgDH58IQQgAyAEQiCIfCEDIARC/////w+DIAsgCn58IQQgAyAEQiCIfCEDIARC/////w+DIA0gCH58IQQgAyAEQiCIfCEDIARC/////w+DIAA1AhQiDyAGfnwhBCADIARCIIh8IQMgAiAEPgIUIANCIIghBCADQv////8PgyAFIAE1AhgiEn58IQMgBCADQiCIfCEEIANC/////w+DIAcgEH58IQMgBCADQiCIfCEEIANC/////w+DIAkgDn58IQMgBCADQiCIfCEEIANC/////w+DIAsgDH58IQMgBCADQiCIfCEEIANC/////w+DIA0gCn58IQMgBCADQiCIfCEEIANC/////w+DIA8gCH58IQMgBCADQiCIfCEEIANC/////w+DIAA1AhgiESAGfnwhAyAEIANCIIh8IQQgAiADPgIYIARCIIghAyAEQv////8PgyAFIAE1AhwiFH58IQQgAyAEQiCIfCEDIARC/////w+DIAcgEn58IQQgAyAEQiCIfCEDIARC/////w+DIAkgEH58IQQgAyAEQiCIfCEDIARC/////w+DIAsgDn58IQQgAyAEQiCIfCEDIARC/////w+DIA0gDH58IQQgAyAEQiCIfCEDIARC/////w+DIA8gCn58IQQgAyAEQiCIfCEDIARC/////w+DIBEgCH58IQQgAyAEQiCIfCEDIARC/////w+DIAA1AhwiEyAGfnwhBCADIARCIIh8IQMgAiAEPgIcIANCIIghBCADQv////8PgyAHIBR+fCEDIAQgA0IgiHwhBCADQv////8PgyAJIBJ+fCEDIAQgA0IgiHwhBCADQv////8PgyALIBB+fCEDIAQgA0IgiHwhBCADQv////8PgyANIA5+fCEDIAQgA0IgiHwhBCADQv////8PgyAPIAx+fCEDIAQgA0IgiHwhBCADQv////8PgyARIAp+fCEDIAQgA0IgiHwhBCADQv////8PgyATIAh+fCEDIAQgA0IgiHwhBCACIAM+AiAgBEIgiCEDIARC/////w+DIAkgFH58IQQgAyAEQiCIfCEDIARC/////w+DIAsgEn58IQQgAyAEQiCIfCEDIARC/////w+DIA0gEH58IQQgAyAEQiCIfCEDIARC/////w+DIA8gDn58IQQgAyAEQiCIfCEDIARC/////w+DIBEgDH58IQQgAyAEQiCIfCEDIARC/////w+DIBMgCn58IQQgAyAEQiCIfCEDIAIgBD4CJCADQiCIIQQgA0L/////D4MgCyAUfnwhAyAEIANCIIh8IQQgA0L/////D4MgDSASfnwhAyAEIANCIIh8IQQgA0L/////D4MgDyAQfnwhAyAEIANCIIh8IQQgA0L/////D4MgESAOfnwhAyAEIANCIIh8IQQgA0L/////D4MgEyAMfnwhAyAEIANCIIh8IQQgAiADPgIoIARCIIghAyAEQv////8PgyANIBR+fCEEIAMgBEIgiHwhAyAEQv////8PgyAPIBJ+fCEEIAMgBEIgiHwhAyAEQv////8PgyARIBB+fCEEIAMgBEIgiHwhAyAEQv////8PgyATIA5+fCEEIAMgBEIgiHwhAyACIAQ+AiwgA0IgiCEEIANC/////w+DIA8gFH58IQMgBCADQiCIfCEEIANC/////w+DIBEgEn58IQMgBCADQiCIfCEEIANC/////w+DIBMgEH58IQMgBCADQiCIfCEEIAIgAz4CMCAEQiCIIQMgBEL/////D4MgESAUfnwhBCADIARCIIh8IQMgBEL/////D4MgEyASfnwhBCADIARCIIh8IQMgAiAEPgI0IANCIIghBCADQv////8PgyATIBR+fCEDIAQgA0IgiHwhBCACIAM+AjggBEIgiCEDIAIgBD4CPAv0EAEBfkEoIAA1AgAgATUCAH43AwBBKCAANQIAIAE1AgR+NwMIQSggADUCACABNQIIfjcDEEEoIAA1AgAgATUCDH43AxhBKCAANQIAIAE1AhB+NwMgQSggADUCACABNQIUfjcDKEEoIAA1AgAgATUCGH43AzBBKCAANQIAIAE1Ahx+NwM4QSggADUCBCABNQIAfjcDQEEoIAA1AgQgATUCBH43A0hBKCAANQIEIAE1Agh+NwNQQSggADUCBCABNQIMfjcDWEEoIAA1AgQgATUCEH43A2BBKCAANQIEIAE1AhR+NwNoQSggADUCBCABNQIYfjcDcEEoIAA1AgQgATUCHH43A3hBKCAANQIIIAE1AgB+NwOAAUEoIAA1AgggATUCBH43A4gBQSggADUCCCABNQIIfjcDkAFBKCAANQIIIAE1Agx+NwOYAUEoIAA1AgggATUCEH43A6ABQSggADUCCCABNQIUfjcDqAFBKCAANQIIIAE1Ahh+NwOwAUEoIAA1AgggATUCHH43A7gBQSggADUCDCABNQIAfjcDwAFBKCAANQIMIAE1AgR+NwPIAUEoIAA1AgwgATUCCH43A9ABQSggADUCDCABNQIMfjcD2AFBKCAANQIMIAE1AhB+NwPgAUEoIAA1AgwgATUCFH43A+gBQSggADUCDCABNQIYfjcD8AFBKCAANQIMIAE1Ahx+NwP4AUEoIAA1AhAgATUCAH43A4ACQSggADUCECABNQIEfjcDiAJBKCAANQIQIAE1Agh+NwOQAkEoIAA1AhAgATUCDH43A5gCQSggADUCECABNQIQfjcDoAJBKCAANQIQIAE1AhR+NwOoAkEoIAA1AhAgATUCGH43A7ACQSggADUCECABNQIcfjcDuAJBKCAANQIUIAE1AgB+NwPAAkEoIAA1AhQgATUCBH43A8gCQSggADUCFCABNQIIfjcD0AJBKCAANQIUIAE1Agx+NwPYAkEoIAA1AhQgATUCEH43A+ACQSggADUCFCABNQIUfjcD6AJBKCAANQIUIAE1Ahh+NwPwAkEoIAA1AhQgATUCHH43A/gCQSggADUCGCABNQIAfjcDgANBKCAANQIYIAE1AgR+NwOIA0EoIAA1AhggATUCCH43A5ADQSggADUCGCABNQIMfjcDmANBKCAANQIYIAE1AhB+NwOgA0EoIAA1AhggATUCFH43A6gDQSggADUCGCABNQIYfjcDsANBKCAANQIYIAE1Ahx+NwO4A0EoIAA1AhwgATUCAH43A8ADQSggADUCHCABNQIEfjcDyANBKCAANQIcIAE1Agh+NwPQA0EoIAA1AhwgATUCDH43A9gDQSggADUCHCABNQIQfjcD4ANBKCAANQIcIAE1AhR+NwPoA0EoIAA1AhwgATUCGH43A/ADQSggADUCHCABNQIcfjcD+AMgA0IgiEEoNQIAfCEDIAIgAz4CACADQiCIQSg1AgR8QSg1Agh8QSg1AkB8IQMgAiADPgIEIANCIIhBKDUCDHxBKDUCRHxBKDUCEHxBKDUCSHxBKDUCgAF8IQMgAiADPgIIIANCIIhBKDUCFHxBKDUCTHxBKDUChAF8QSg1Ahh8QSg1AlB8QSg1AogBfEEoNQLAAXwhAyACIAM+AgwgA0IgiEEoNQIcfEEoNQJUfEEoNQKMAXxBKDUCxAF8QSg1AiB8QSg1Alh8QSg1ApABfEEoNQLIAXxBKDUCgAJ8IQMgAiADPgIQIANCIIhBKDUCJHxBKDUCXHxBKDUClAF8QSg1AswBfEEoNQKEAnxBKDUCKHxBKDUCYHxBKDUCmAF8QSg1AtABfEEoNQKIAnxBKDUCwAJ8IQMgAiADPgIUIANCIIhBKDUCLHxBKDUCZHxBKDUCnAF8QSg1AtQBfEEoNQKMAnxBKDUCxAJ8QSg1AjB8QSg1Amh8QSg1AqABfEEoNQLYAXxBKDUCkAJ8QSg1AsgCfEEoNQKAA3whAyACIAM+AhggA0IgiEEoNQI0fEEoNQJsfEEoNQKkAXxBKDUC3AF8QSg1ApQCfEEoNQLMAnxBKDUChAN8QSg1Ajh8QSg1AnB8QSg1AqgBfEEoNQLgAXxBKDUCmAJ8QSg1AtACfEEoNQKIA3xBKDUCwAN8IQMgAiADPgIcIANCIIhBKDUCPHxBKDUCdHxBKDUCrAF8QSg1AuQBfEEoNQKcAnxBKDUC1AJ8QSg1AowDfEEoNQLEA3xBKDUCeHxBKDUCsAF8QSg1AugBfEEoNQKgAnxBKDUC2AJ8QSg1ApADfEEoNQLIA3whAyACIAM+AiAgA0IgiEEoNQJ8fEEoNQK0AXxBKDUC7AF8QSg1AqQCfEEoNQLcAnxBKDUClAN8QSg1AswDfEEoNQK4AXxBKDUC8AF8QSg1AqgCfEEoNQLgAnxBKDUCmAN8QSg1AtADfCEDIAIgAz4CJCADQiCIQSg1ArwBfEEoNQL0AXxBKDUCrAJ8QSg1AuQCfEEoNQKcA3xBKDUC1AN8QSg1AvgBfEEoNQKwAnxBKDUC6AJ8QSg1AqADfEEoNQLYA3whAyACIAM+AiggA0IgiEEoNQL8AXxBKDUCtAJ8QSg1AuwCfEEoNQKkA3xBKDUC3AN8QSg1ArgCfEEoNQLwAnxBKDUCqAN8QSg1AuADfCEDIAIgAz4CLCADQiCIQSg1ArwCfEEoNQL0AnxBKDUCrAN8QSg1AuQDfEEoNQL4AnxBKDUCsAN8QSg1AugDfCEDIAIgAz4CMCADQiCIQSg1AvwCfEEoNQK0A3xBKDUC7AN8QSg1ArgDfEEoNQLwA3whAyACIAM+AjQgA0IgiEEoNQK8A3xBKDUC9AN8QSg1AvgDfCEDIAIgAz4COCADQiCIQSg1AvwDfCEDIAIgAz4CPAu2AQEBfiAANQAAIAF+IQMgAiADPgAAIAA1AAQgAX4gA0IgiHwhAyACIAM+AAQgADUACCABfiADQiCIfCEDIAIgAz4ACCAANQAMIAF+IANCIIh8IQMgAiADPgAMIAA1ABAgAX4gA0IgiHwhAyACIAM+ABAgADUAFCABfiADQiCIfCEDIAIgAz4AFCAANQAYIAF+IANCIIh8IQMgAiADPgAYIAA1ABwgAX4gA0IgiHwhAyACIAM+ABwLTgIBfgF/IAAhAyADNQAAIAF8IQIgAyACPgAAIAJCIIghAgJAA0AgAlANASADQQRqIQMgAzUAACACfCECIAMgAj4AACACQiCIIQIMAAsLC7ACBwF/AX8BfwF/AX4BfgF/IAIEQCACIQUFQcgEIQULIAMEQCADIQQFQegEIQQLIAAgBBAAIAFBqAQQACAFEAFBiAUQAUEfIQZBHyEHAkADQEGoBCAHai0AACAHQQNGcg0BIAdBAWshBwwACwtBqAQgB2pBA2s1AABCAXwhCCAIQgFRBEBCAEIAgBoLAkADQAJAA0AgBCAGai0AACAGQQdGcg0BIAZBAWshBgwACwsgBCAGakEHaykAACEJIAkgCIAhCSAGIAdrQQRrIQoCQANAIAlCgICAgHCDUCAKQQBOcQ0BIAlCCIghCSAKQQFqIQoMAAsLIAlQBEAgBEGoBBAFRQ0CQgEhCUEAIQoLQagEIAlBqAUQCiAEQagFIAprIAQQBxogBSAKaiAJEAsMAAsLC7UCCwF/AX8BfwF/AX8BfwF/AX8BfwF/AX9ByAUhA0HIBRABQQAhC0HoBSEFIAFB6AUQAEGIBiEEQYgGEANBACEMQagGIQggAEGoBhAAQcgGIQZB6AYhB0HIByEKAkADQCAIEAINASAFIAggBiAHEAwgBiAEQYgHEAggCwRAIAwEQEGIByADEAUEQEGIByADIAoQBxpBACENBSADQYgHIAoQBxpBASENCwVBiAcgAyAKEAYaQQEhDQsFIAwEQEGIByADIAoQBhpBACENBSADQYgHEAUEQCADQYgHIAoQBxpBACENBUGIByADIAoQBxpBASENCwsLIAMhCSAEIQMgCiEEIAkhCiAMIQsgDSEMIAUhCSAIIQUgByEIIAkhBwwACwsgCwRAIAEgAyACEAcaBSADIAIQAAsLLAAgACABIAIQBgRAIAJB6AcgAhAHGgUgAkHoBxAFBEAgAkHoByACEAcaCwsLFwAgACABIAIQBwRAIAJB6AcgAhAGGgsLFAAgABACRQRAQegHIAAgARAHGgsLnBEDAX4BfgF+QonHmaQOIQJCACEDIAA1AgAgAn5C/////w+DIQQgADUCACADQiCIfEHoBzUCACAEfnwhAyAAIAM+AgAgADUCBCADQiCIfEHoBzUCBCAEfnwhAyAAIAM+AgQgADUCCCADQiCIfEHoBzUCCCAEfnwhAyAAIAM+AgggADUCDCADQiCIfEHoBzUCDCAEfnwhAyAAIAM+AgwgADUCECADQiCIfEHoBzUCECAEfnwhAyAAIAM+AhAgADUCFCADQiCIfEHoBzUCFCAEfnwhAyAAIAM+AhQgADUCGCADQiCIfEHoBzUCGCAEfnwhAyAAIAM+AhggADUCHCADQiCIfEHoBzUCHCAEfnwhAyAAIAM+AhxB6AggA0IgiD4CAEIAIQMgADUCBCACfkL/////D4MhBCAANQIEIANCIIh8QegHNQIAIAR+fCEDIAAgAz4CBCAANQIIIANCIIh8QegHNQIEIAR+fCEDIAAgAz4CCCAANQIMIANCIIh8QegHNQIIIAR+fCEDIAAgAz4CDCAANQIQIANCIIh8QegHNQIMIAR+fCEDIAAgAz4CECAANQIUIANCIIh8QegHNQIQIAR+fCEDIAAgAz4CFCAANQIYIANCIIh8QegHNQIUIAR+fCEDIAAgAz4CGCAANQIcIANCIIh8QegHNQIYIAR+fCEDIAAgAz4CHCAANQIgIANCIIh8QegHNQIcIAR+fCEDIAAgAz4CIEHoCCADQiCIPgIEQgAhAyAANQIIIAJ+Qv////8PgyEEIAA1AgggA0IgiHxB6Ac1AgAgBH58IQMgACADPgIIIAA1AgwgA0IgiHxB6Ac1AgQgBH58IQMgACADPgIMIAA1AhAgA0IgiHxB6Ac1AgggBH58IQMgACADPgIQIAA1AhQgA0IgiHxB6Ac1AgwgBH58IQMgACADPgIUIAA1AhggA0IgiHxB6Ac1AhAgBH58IQMgACADPgIYIAA1AhwgA0IgiHxB6Ac1AhQgBH58IQMgACADPgIcIAA1AiAgA0IgiHxB6Ac1AhggBH58IQMgACADPgIgIAA1AiQgA0IgiHxB6Ac1AhwgBH58IQMgACADPgIkQegIIANCIIg+AghCACEDIAA1AgwgAn5C/////w+DIQQgADUCDCADQiCIfEHoBzUCACAEfnwhAyAAIAM+AgwgADUCECADQiCIfEHoBzUCBCAEfnwhAyAAIAM+AhAgADUCFCADQiCIfEHoBzUCCCAEfnwhAyAAIAM+AhQgADUCGCADQiCIfEHoBzUCDCAEfnwhAyAAIAM+AhggADUCHCADQiCIfEHoBzUCECAEfnwhAyAAIAM+AhwgADUCICADQiCIfEHoBzUCFCAEfnwhAyAAIAM+AiAgADUCJCADQiCIfEHoBzUCGCAEfnwhAyAAIAM+AiQgADUCKCADQiCIfEHoBzUCHCAEfnwhAyAAIAM+AihB6AggA0IgiD4CDEIAIQMgADUCECACfkL/////D4MhBCAANQIQIANCIIh8QegHNQIAIAR+fCEDIAAgAz4CECAANQIUIANCIIh8QegHNQIEIAR+fCEDIAAgAz4CFCAANQIYIANCIIh8QegHNQIIIAR+fCEDIAAgAz4CGCAANQIcIANCIIh8QegHNQIMIAR+fCEDIAAgAz4CHCAANQIgIANCIIh8QegHNQIQIAR+fCEDIAAgAz4CICAANQIkIANCIIh8QegHNQIUIAR+fCEDIAAgAz4CJCAANQIoIANCIIh8QegHNQIYIAR+fCEDIAAgAz4CKCAANQIsIANCIIh8QegHNQIcIAR+fCEDIAAgAz4CLEHoCCADQiCIPgIQQgAhAyAANQIUIAJ+Qv////8PgyEEIAA1AhQgA0IgiHxB6Ac1AgAgBH58IQMgACADPgIUIAA1AhggA0IgiHxB6Ac1AgQgBH58IQMgACADPgIYIAA1AhwgA0IgiHxB6Ac1AgggBH58IQMgACADPgIcIAA1AiAgA0IgiHxB6Ac1AgwgBH58IQMgACADPgIgIAA1AiQgA0IgiHxB6Ac1AhAgBH58IQMgACADPgIkIAA1AiggA0IgiHxB6Ac1AhQgBH58IQMgACADPgIoIAA1AiwgA0IgiHxB6Ac1AhggBH58IQMgACADPgIsIAA1AjAgA0IgiHxB6Ac1AhwgBH58IQMgACADPgIwQegIIANCIIg+AhRCACEDIAA1AhggAn5C/////w+DIQQgADUCGCADQiCIfEHoBzUCACAEfnwhAyAAIAM+AhggADUCHCADQiCIfEHoBzUCBCAEfnwhAyAAIAM+AhwgADUCICADQiCIfEHoBzUCCCAEfnwhAyAAIAM+AiAgADUCJCADQiCIfEHoBzUCDCAEfnwhAyAAIAM+AiQgADUCKCADQiCIfEHoBzUCECAEfnwhAyAAIAM+AiggADUCLCADQiCIfEHoBzUCFCAEfnwhAyAAIAM+AiwgADUCMCADQiCIfEHoBzUCGCAEfnwhAyAAIAM+AjAgADUCNCADQiCIfEHoBzUCHCAEfnwhAyAAIAM+AjRB6AggA0IgiD4CGEIAIQMgADUCHCACfkL/////D4MhBCAANQIcIANCIIh8QegHNQIAIAR+fCEDIAAgAz4CHCAANQIgIANCIIh8QegHNQIEIAR+fCEDIAAgAz4CICAANQIkIANCIIh8QegHNQIIIAR+fCEDIAAgAz4CJCAANQIoIANCIIh8QegHNQIMIAR+fCEDIAAgAz4CKCAANQIsIANCIIh8QegHNQIQIAR+fCEDIAAgAz4CLCAANQIwIANCIIh8QegHNQIUIAR+fCEDIAAgAz4CMCAANQI0IANCIIh8QegHNQIYIAR+fCEDIAAgAz4CNCAANQI4IANCIIh8QegHNQIcIAR+fCEDIAAgAz4COEHoCCADQiCIPgIcQegIIABBIGogARAOC74fIwF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX5CiceZpA4hBSADQv////8PgyAANQIAIgYgATUCACIHfnwhAyAEIANCIIh8IQQgA0L/////D4MgBX5C/////w+DIQggA0L/////D4NBADUC6AciCSAIfnwhAyAEIANCIIh8IQQgBEIgiCEDIARC/////w+DIAYgATUCBCILfnwhBCADIARCIIh8IQMgBEL/////D4MgADUCBCIKIAd+fCEEIAMgBEIgiHwhAyAEQv////8Pg0EANQLsByINIAh+fCEEIAMgBEIgiHwhAyAEQv////8PgyAFfkL/////D4MhDCAEQv////8PgyAJIAx+fCEEIAMgBEIgiHwhAyADQiCIIQQgA0L/////D4MgBiABNQIIIg9+fCEDIAQgA0IgiHwhBCADQv////8PgyAKIAt+fCEDIAQgA0IgiHwhBCADQv////8PgyAANQIIIg4gB358IQMgBCADQiCIfCEEIANC/////w+DIA0gDH58IQMgBCADQiCIfCEEIANC/////w+DQQA1AvAHIhEgCH58IQMgBCADQiCIfCEEIANC/////w+DIAV+Qv////8PgyEQIANC/////w+DIAkgEH58IQMgBCADQiCIfCEEIARCIIghAyAEQv////8PgyAGIAE1AgwiE358IQQgAyAEQiCIfCEDIARC/////w+DIAogD358IQQgAyAEQiCIfCEDIARC/////w+DIA4gC358IQQgAyAEQiCIfCEDIARC/////w+DIAA1AgwiEiAHfnwhBCADIARCIIh8IQMgBEL/////D4MgDSAQfnwhBCADIARCIIh8IQMgBEL/////D4MgESAMfnwhBCADIARCIIh8IQMgBEL/////D4NBADUC9AciFSAIfnwhBCADIARCIIh8IQMgBEL/////D4MgBX5C/////w+DIRQgBEL/////D4MgCSAUfnwhBCADIARCIIh8IQMgA0IgiCEEIANC/////w+DIAYgATUCECIXfnwhAyAEIANCIIh8IQQgA0L/////D4MgCiATfnwhAyAEIANCIIh8IQQgA0L/////D4MgDiAPfnwhAyAEIANCIIh8IQQgA0L/////D4MgEiALfnwhAyAEIANCIIh8IQQgA0L/////D4MgADUCECIWIAd+fCEDIAQgA0IgiHwhBCADQv////8PgyANIBR+fCEDIAQgA0IgiHwhBCADQv////8PgyARIBB+fCEDIAQgA0IgiHwhBCADQv////8PgyAVIAx+fCEDIAQgA0IgiHwhBCADQv////8Pg0EANQL4ByIZIAh+fCEDIAQgA0IgiHwhBCADQv////8PgyAFfkL/////D4MhGCADQv////8PgyAJIBh+fCEDIAQgA0IgiHwhBCAEQiCIIQMgBEL/////D4MgBiABNQIUIht+fCEEIAMgBEIgiHwhAyAEQv////8PgyAKIBd+fCEEIAMgBEIgiHwhAyAEQv////8PgyAOIBN+fCEEIAMgBEIgiHwhAyAEQv////8PgyASIA9+fCEEIAMgBEIgiHwhAyAEQv////8PgyAWIAt+fCEEIAMgBEIgiHwhAyAEQv////8PgyAANQIUIhogB358IQQgAyAEQiCIfCEDIARC/////w+DIA0gGH58IQQgAyAEQiCIfCEDIARC/////w+DIBEgFH58IQQgAyAEQiCIfCEDIARC/////w+DIBUgEH58IQQgAyAEQiCIfCEDIARC/////w+DIBkgDH58IQQgAyAEQiCIfCEDIARC/////w+DQQA1AvwHIh0gCH58IQQgAyAEQiCIfCEDIARC/////w+DIAV+Qv////8PgyEcIARC/////w+DIAkgHH58IQQgAyAEQiCIfCEDIANCIIghBCADQv////8PgyAGIAE1AhgiH358IQMgBCADQiCIfCEEIANC/////w+DIAogG358IQMgBCADQiCIfCEEIANC/////w+DIA4gF358IQMgBCADQiCIfCEEIANC/////w+DIBIgE358IQMgBCADQiCIfCEEIANC/////w+DIBYgD358IQMgBCADQiCIfCEEIANC/////w+DIBogC358IQMgBCADQiCIfCEEIANC/////w+DIAA1AhgiHiAHfnwhAyAEIANCIIh8IQQgA0L/////D4MgDSAcfnwhAyAEIANCIIh8IQQgA0L/////D4MgESAYfnwhAyAEIANCIIh8IQQgA0L/////D4MgFSAUfnwhAyAEIANCIIh8IQQgA0L/////D4MgGSAQfnwhAyAEIANCIIh8IQQgA0L/////D4MgHSAMfnwhAyAEIANCIIh8IQQgA0L/////D4NBADUCgAgiISAIfnwhAyAEIANCIIh8IQQgA0L/////D4MgBX5C/////w+DISAgA0L/////D4MgCSAgfnwhAyAEIANCIIh8IQQgBEIgiCEDIARC/////w+DIAYgATUCHCIjfnwhBCADIARCIIh8IQMgBEL/////D4MgCiAffnwhBCADIARCIIh8IQMgBEL/////D4MgDiAbfnwhBCADIARCIIh8IQMgBEL/////D4MgEiAXfnwhBCADIARCIIh8IQMgBEL/////D4MgFiATfnwhBCADIARCIIh8IQMgBEL/////D4MgGiAPfnwhBCADIARCIIh8IQMgBEL/////D4MgHiALfnwhBCADIARCIIh8IQMgBEL/////D4MgADUCHCIiIAd+fCEEIAMgBEIgiHwhAyAEQv////8PgyANICB+fCEEIAMgBEIgiHwhAyAEQv////8PgyARIBx+fCEEIAMgBEIgiHwhAyAEQv////8PgyAVIBh+fCEEIAMgBEIgiHwhAyAEQv////8PgyAZIBR+fCEEIAMgBEIgiHwhAyAEQv////8PgyAdIBB+fCEEIAMgBEIgiHwhAyAEQv////8PgyAhIAx+fCEEIAMgBEIgiHwhAyAEQv////8Pg0EANQKECCIlIAh+fCEEIAMgBEIgiHwhAyAEQv////8PgyAFfkL/////D4MhJCAEQv////8PgyAJICR+fCEEIAMgBEIgiHwhAyADQiCIIQQgA0L/////D4MgCiAjfnwhAyAEIANCIIh8IQQgA0L/////D4MgDiAffnwhAyAEIANCIIh8IQQgA0L/////D4MgEiAbfnwhAyAEIANCIIh8IQQgA0L/////D4MgFiAXfnwhAyAEIANCIIh8IQQgA0L/////D4MgGiATfnwhAyAEIANCIIh8IQQgA0L/////D4MgHiAPfnwhAyAEIANCIIh8IQQgA0L/////D4MgIiALfnwhAyAEIANCIIh8IQQgA0L/////D4MgDSAkfnwhAyAEIANCIIh8IQQgA0L/////D4MgESAgfnwhAyAEIANCIIh8IQQgA0L/////D4MgFSAcfnwhAyAEIANCIIh8IQQgA0L/////D4MgGSAYfnwhAyAEIANCIIh8IQQgA0L/////D4MgHSAUfnwhAyAEIANCIIh8IQQgA0L/////D4MgISAQfnwhAyAEIANCIIh8IQQgA0L/////D4MgJSAMfnwhAyAEIANCIIh8IQQgAiADPgIAIARCIIghAyAEQv////8PgyAOICN+fCEEIAMgBEIgiHwhAyAEQv////8PgyASIB9+fCEEIAMgBEIgiHwhAyAEQv////8PgyAWIBt+fCEEIAMgBEIgiHwhAyAEQv////8PgyAaIBd+fCEEIAMgBEIgiHwhAyAEQv////8PgyAeIBN+fCEEIAMgBEIgiHwhAyAEQv////8PgyAiIA9+fCEEIAMgBEIgiHwhAyAEQv////8PgyARICR+fCEEIAMgBEIgiHwhAyAEQv////8PgyAVICB+fCEEIAMgBEIgiHwhAyAEQv////8PgyAZIBx+fCEEIAMgBEIgiHwhAyAEQv////8PgyAdIBh+fCEEIAMgBEIgiHwhAyAEQv////8PgyAhIBR+fCEEIAMgBEIgiHwhAyAEQv////8PgyAlIBB+fCEEIAMgBEIgiHwhAyACIAQ+AgQgA0IgiCEEIANC/////w+DIBIgI358IQMgBCADQiCIfCEEIANC/////w+DIBYgH358IQMgBCADQiCIfCEEIANC/////w+DIBogG358IQMgBCADQiCIfCEEIANC/////w+DIB4gF358IQMgBCADQiCIfCEEIANC/////w+DICIgE358IQMgBCADQiCIfCEEIANC/////w+DIBUgJH58IQMgBCADQiCIfCEEIANC/////w+DIBkgIH58IQMgBCADQiCIfCEEIANC/////w+DIB0gHH58IQMgBCADQiCIfCEEIANC/////w+DICEgGH58IQMgBCADQiCIfCEEIANC/////w+DICUgFH58IQMgBCADQiCIfCEEIAIgAz4CCCAEQiCIIQMgBEL/////D4MgFiAjfnwhBCADIARCIIh8IQMgBEL/////D4MgGiAffnwhBCADIARCIIh8IQMgBEL/////D4MgHiAbfnwhBCADIARCIIh8IQMgBEL/////D4MgIiAXfnwhBCADIARCIIh8IQMgBEL/////D4MgGSAkfnwhBCADIARCIIh8IQMgBEL/////D4MgHSAgfnwhBCADIARCIIh8IQMgBEL/////D4MgISAcfnwhBCADIARCIIh8IQMgBEL/////D4MgJSAYfnwhBCADIARCIIh8IQMgAiAEPgIMIANCIIghBCADQv////8PgyAaICN+fCEDIAQgA0IgiHwhBCADQv////8PgyAeIB9+fCEDIAQgA0IgiHwhBCADQv////8PgyAiIBt+fCEDIAQgA0IgiHwhBCADQv////8PgyAdICR+fCEDIAQgA0IgiHwhBCADQv////8PgyAhICB+fCEDIAQgA0IgiHwhBCADQv////8PgyAlIBx+fCEDIAQgA0IgiHwhBCACIAM+AhAgBEIgiCEDIARC/////w+DIB4gI358IQQgAyAEQiCIfCEDIARC/////w+DICIgH358IQQgAyAEQiCIfCEDIARC/////w+DICEgJH58IQQgAyAEQiCIfCEDIARC/////w+DICUgIH58IQQgAyAEQiCIfCEDIAIgBD4CFCADQiCIIQQgA0L/////D4MgIiAjfnwhAyAEIANCIIh8IQQgA0L/////D4MgJSAkfnwhAyAEIANCIIh8IQQgAiADPgIYIARCIIghAyACIAQ+AhwgA6cEQCACQegHIAIQBxoFIAJB6AcQBQRAIAJB6AcgAhAHGgsLCxIAIAAgAUHoDBAJQegMIAIQEQsLACAAQYgIIAEQEgsVACAAQagNEABByA0QAUGoDSABEBELFwAgACABEBUgAUHoByABEA0gASABEBQLCQBBqAggABAACywAIAAgASACEAYEQCACQegNIAIQBxoFIAJB6A0QBQRAIAJB6A0gAhAHGgsLCxcAIAAgASACEAcEQCACQegNIAIQBhoLCxQAIAAQAkUEQEHoDSAAIAEQBxoLC5wRAwF+AX4BfkL/////DiECQgAhAyAANQIAIAJ+Qv////8PgyEEIAA1AgAgA0IgiHxB6A01AgAgBH58IQMgACADPgIAIAA1AgQgA0IgiHxB6A01AgQgBH58IQMgACADPgIEIAA1AgggA0IgiHxB6A01AgggBH58IQMgACADPgIIIAA1AgwgA0IgiHxB6A01AgwgBH58IQMgACADPgIMIAA1AhAgA0IgiHxB6A01AhAgBH58IQMgACADPgIQIAA1AhQgA0IgiHxB6A01AhQgBH58IQMgACADPgIUIAA1AhggA0IgiHxB6A01AhggBH58IQMgACADPgIYIAA1AhwgA0IgiHxB6A01AhwgBH58IQMgACADPgIcQegOIANCIIg+AgBCACEDIAA1AgQgAn5C/////w+DIQQgADUCBCADQiCIfEHoDTUCACAEfnwhAyAAIAM+AgQgADUCCCADQiCIfEHoDTUCBCAEfnwhAyAAIAM+AgggADUCDCADQiCIfEHoDTUCCCAEfnwhAyAAIAM+AgwgADUCECADQiCIfEHoDTUCDCAEfnwhAyAAIAM+AhAgADUCFCADQiCIfEHoDTUCECAEfnwhAyAAIAM+AhQgADUCGCADQiCIfEHoDTUCFCAEfnwhAyAAIAM+AhggADUCHCADQiCIfEHoDTUCGCAEfnwhAyAAIAM+AhwgADUCICADQiCIfEHoDTUCHCAEfnwhAyAAIAM+AiBB6A4gA0IgiD4CBEIAIQMgADUCCCACfkL/////D4MhBCAANQIIIANCIIh8QegNNQIAIAR+fCEDIAAgAz4CCCAANQIMIANCIIh8QegNNQIEIAR+fCEDIAAgAz4CDCAANQIQIANCIIh8QegNNQIIIAR+fCEDIAAgAz4CECAANQIUIANCIIh8QegNNQIMIAR+fCEDIAAgAz4CFCAANQIYIANCIIh8QegNNQIQIAR+fCEDIAAgAz4CGCAANQIcIANCIIh8QegNNQIUIAR+fCEDIAAgAz4CHCAANQIgIANCIIh8QegNNQIYIAR+fCEDIAAgAz4CICAANQIkIANCIIh8QegNNQIcIAR+fCEDIAAgAz4CJEHoDiADQiCIPgIIQgAhAyAANQIMIAJ+Qv////8PgyEEIAA1AgwgA0IgiHxB6A01AgAgBH58IQMgACADPgIMIAA1AhAgA0IgiHxB6A01AgQgBH58IQMgACADPgIQIAA1AhQgA0IgiHxB6A01AgggBH58IQMgACADPgIUIAA1AhggA0IgiHxB6A01AgwgBH58IQMgACADPgIYIAA1AhwgA0IgiHxB6A01AhAgBH58IQMgACADPgIcIAA1AiAgA0IgiHxB6A01AhQgBH58IQMgACADPgIgIAA1AiQgA0IgiHxB6A01AhggBH58IQMgACADPgIkIAA1AiggA0IgiHxB6A01AhwgBH58IQMgACADPgIoQegOIANCIIg+AgxCACEDIAA1AhAgAn5C/////w+DIQQgADUCECADQiCIfEHoDTUCACAEfnwhAyAAIAM+AhAgADUCFCADQiCIfEHoDTUCBCAEfnwhAyAAIAM+AhQgADUCGCADQiCIfEHoDTUCCCAEfnwhAyAAIAM+AhggADUCHCADQiCIfEHoDTUCDCAEfnwhAyAAIAM+AhwgADUCICADQiCIfEHoDTUCECAEfnwhAyAAIAM+AiAgADUCJCADQiCIfEHoDTUCFCAEfnwhAyAAIAM+AiQgADUCKCADQiCIfEHoDTUCGCAEfnwhAyAAIAM+AiggADUCLCADQiCIfEHoDTUCHCAEfnwhAyAAIAM+AixB6A4gA0IgiD4CEEIAIQMgADUCFCACfkL/////D4MhBCAANQIUIANCIIh8QegNNQIAIAR+fCEDIAAgAz4CFCAANQIYIANCIIh8QegNNQIEIAR+fCEDIAAgAz4CGCAANQIcIANCIIh8QegNNQIIIAR+fCEDIAAgAz4CHCAANQIgIANCIIh8QegNNQIMIAR+fCEDIAAgAz4CICAANQIkIANCIIh8QegNNQIQIAR+fCEDIAAgAz4CJCAANQIoIANCIIh8QegNNQIUIAR+fCEDIAAgAz4CKCAANQIsIANCIIh8QegNNQIYIAR+fCEDIAAgAz4CLCAANQIwIANCIIh8QegNNQIcIAR+fCEDIAAgAz4CMEHoDiADQiCIPgIUQgAhAyAANQIYIAJ+Qv////8PgyEEIAA1AhggA0IgiHxB6A01AgAgBH58IQMgACADPgIYIAA1AhwgA0IgiHxB6A01AgQgBH58IQMgACADPgIcIAA1AiAgA0IgiHxB6A01AgggBH58IQMgACADPgIgIAA1AiQgA0IgiHxB6A01AgwgBH58IQMgACADPgIkIAA1AiggA0IgiHxB6A01AhAgBH58IQMgACADPgIoIAA1AiwgA0IgiHxB6A01AhQgBH58IQMgACADPgIsIAA1AjAgA0IgiHxB6A01AhggBH58IQMgACADPgIwIAA1AjQgA0IgiHxB6A01AhwgBH58IQMgACADPgI0QegOIANCIIg+AhhCACEDIAA1AhwgAn5C/////w+DIQQgADUCHCADQiCIfEHoDTUCACAEfnwhAyAAIAM+AhwgADUCICADQiCIfEHoDTUCBCAEfnwhAyAAIAM+AiAgADUCJCADQiCIfEHoDTUCCCAEfnwhAyAAIAM+AiQgADUCKCADQiCIfEHoDTUCDCAEfnwhAyAAIAM+AiggADUCLCADQiCIfEHoDTUCECAEfnwhAyAAIAM+AiwgADUCMCADQiCIfEHoDTUCFCAEfnwhAyAAIAM+AjAgADUCNCADQiCIfEHoDTUCGCAEfnwhAyAAIAM+AjQgADUCOCADQiCIfEHoDTUCHCAEfnwhAyAAIAM+AjhB6A4gA0IgiD4CHEHoDiAAQSBqIAEQGAu+HyMBfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+Qv////8OIQUgA0L/////D4MgADUCACIGIAE1AgAiB358IQMgBCADQiCIfCEEIANC/////w+DIAV+Qv////8PgyEIIANC/////w+DQQA1AugNIgkgCH58IQMgBCADQiCIfCEEIARCIIghAyAEQv////8PgyAGIAE1AgQiC358IQQgAyAEQiCIfCEDIARC/////w+DIAA1AgQiCiAHfnwhBCADIARCIIh8IQMgBEL/////D4NBADUC7A0iDSAIfnwhBCADIARCIIh8IQMgBEL/////D4MgBX5C/////w+DIQwgBEL/////D4MgCSAMfnwhBCADIARCIIh8IQMgA0IgiCEEIANC/////w+DIAYgATUCCCIPfnwhAyAEIANCIIh8IQQgA0L/////D4MgCiALfnwhAyAEIANCIIh8IQQgA0L/////D4MgADUCCCIOIAd+fCEDIAQgA0IgiHwhBCADQv////8PgyANIAx+fCEDIAQgA0IgiHwhBCADQv////8Pg0EANQLwDSIRIAh+fCEDIAQgA0IgiHwhBCADQv////8PgyAFfkL/////D4MhECADQv////8PgyAJIBB+fCEDIAQgA0IgiHwhBCAEQiCIIQMgBEL/////D4MgBiABNQIMIhN+fCEEIAMgBEIgiHwhAyAEQv////8PgyAKIA9+fCEEIAMgBEIgiHwhAyAEQv////8PgyAOIAt+fCEEIAMgBEIgiHwhAyAEQv////8PgyAANQIMIhIgB358IQQgAyAEQiCIfCEDIARC/////w+DIA0gEH58IQQgAyAEQiCIfCEDIARC/////w+DIBEgDH58IQQgAyAEQiCIfCEDIARC/////w+DQQA1AvQNIhUgCH58IQQgAyAEQiCIfCEDIARC/////w+DIAV+Qv////8PgyEUIARC/////w+DIAkgFH58IQQgAyAEQiCIfCEDIANCIIghBCADQv////8PgyAGIAE1AhAiF358IQMgBCADQiCIfCEEIANC/////w+DIAogE358IQMgBCADQiCIfCEEIANC/////w+DIA4gD358IQMgBCADQiCIfCEEIANC/////w+DIBIgC358IQMgBCADQiCIfCEEIANC/////w+DIAA1AhAiFiAHfnwhAyAEIANCIIh8IQQgA0L/////D4MgDSAUfnwhAyAEIANCIIh8IQQgA0L/////D4MgESAQfnwhAyAEIANCIIh8IQQgA0L/////D4MgFSAMfnwhAyAEIANCIIh8IQQgA0L/////D4NBADUC+A0iGSAIfnwhAyAEIANCIIh8IQQgA0L/////D4MgBX5C/////w+DIRggA0L/////D4MgCSAYfnwhAyAEIANCIIh8IQQgBEIgiCEDIARC/////w+DIAYgATUCFCIbfnwhBCADIARCIIh8IQMgBEL/////D4MgCiAXfnwhBCADIARCIIh8IQMgBEL/////D4MgDiATfnwhBCADIARCIIh8IQMgBEL/////D4MgEiAPfnwhBCADIARCIIh8IQMgBEL/////D4MgFiALfnwhBCADIARCIIh8IQMgBEL/////D4MgADUCFCIaIAd+fCEEIAMgBEIgiHwhAyAEQv////8PgyANIBh+fCEEIAMgBEIgiHwhAyAEQv////8PgyARIBR+fCEEIAMgBEIgiHwhAyAEQv////8PgyAVIBB+fCEEIAMgBEIgiHwhAyAEQv////8PgyAZIAx+fCEEIAMgBEIgiHwhAyAEQv////8Pg0EANQL8DSIdIAh+fCEEIAMgBEIgiHwhAyAEQv////8PgyAFfkL/////D4MhHCAEQv////8PgyAJIBx+fCEEIAMgBEIgiHwhAyADQiCIIQQgA0L/////D4MgBiABNQIYIh9+fCEDIAQgA0IgiHwhBCADQv////8PgyAKIBt+fCEDIAQgA0IgiHwhBCADQv////8PgyAOIBd+fCEDIAQgA0IgiHwhBCADQv////8PgyASIBN+fCEDIAQgA0IgiHwhBCADQv////8PgyAWIA9+fCEDIAQgA0IgiHwhBCADQv////8PgyAaIAt+fCEDIAQgA0IgiHwhBCADQv////8PgyAANQIYIh4gB358IQMgBCADQiCIfCEEIANC/////w+DIA0gHH58IQMgBCADQiCIfCEEIANC/////w+DIBEgGH58IQMgBCADQiCIfCEEIANC/////w+DIBUgFH58IQMgBCADQiCIfCEEIANC/////w+DIBkgEH58IQMgBCADQiCIfCEEIANC/////w+DIB0gDH58IQMgBCADQiCIfCEEIANC/////w+DQQA1AoAOIiEgCH58IQMgBCADQiCIfCEEIANC/////w+DIAV+Qv////8PgyEgIANC/////w+DIAkgIH58IQMgBCADQiCIfCEEIARCIIghAyAEQv////8PgyAGIAE1AhwiI358IQQgAyAEQiCIfCEDIARC/////w+DIAogH358IQQgAyAEQiCIfCEDIARC/////w+DIA4gG358IQQgAyAEQiCIfCEDIARC/////w+DIBIgF358IQQgAyAEQiCIfCEDIARC/////w+DIBYgE358IQQgAyAEQiCIfCEDIARC/////w+DIBogD358IQQgAyAEQiCIfCEDIARC/////w+DIB4gC358IQQgAyAEQiCIfCEDIARC/////w+DIAA1AhwiIiAHfnwhBCADIARCIIh8IQMgBEL/////D4MgDSAgfnwhBCADIARCIIh8IQMgBEL/////D4MgESAcfnwhBCADIARCIIh8IQMgBEL/////D4MgFSAYfnwhBCADIARCIIh8IQMgBEL/////D4MgGSAUfnwhBCADIARCIIh8IQMgBEL/////D4MgHSAQfnwhBCADIARCIIh8IQMgBEL/////D4MgISAMfnwhBCADIARCIIh8IQMgBEL/////D4NBADUChA4iJSAIfnwhBCADIARCIIh8IQMgBEL/////D4MgBX5C/////w+DISQgBEL/////D4MgCSAkfnwhBCADIARCIIh8IQMgA0IgiCEEIANC/////w+DIAogI358IQMgBCADQiCIfCEEIANC/////w+DIA4gH358IQMgBCADQiCIfCEEIANC/////w+DIBIgG358IQMgBCADQiCIfCEEIANC/////w+DIBYgF358IQMgBCADQiCIfCEEIANC/////w+DIBogE358IQMgBCADQiCIfCEEIANC/////w+DIB4gD358IQMgBCADQiCIfCEEIANC/////w+DICIgC358IQMgBCADQiCIfCEEIANC/////w+DIA0gJH58IQMgBCADQiCIfCEEIANC/////w+DIBEgIH58IQMgBCADQiCIfCEEIANC/////w+DIBUgHH58IQMgBCADQiCIfCEEIANC/////w+DIBkgGH58IQMgBCADQiCIfCEEIANC/////w+DIB0gFH58IQMgBCADQiCIfCEEIANC/////w+DICEgEH58IQMgBCADQiCIfCEEIANC/////w+DICUgDH58IQMgBCADQiCIfCEEIAIgAz4CACAEQiCIIQMgBEL/////D4MgDiAjfnwhBCADIARCIIh8IQMgBEL/////D4MgEiAffnwhBCADIARCIIh8IQMgBEL/////D4MgFiAbfnwhBCADIARCIIh8IQMgBEL/////D4MgGiAXfnwhBCADIARCIIh8IQMgBEL/////D4MgHiATfnwhBCADIARCIIh8IQMgBEL/////D4MgIiAPfnwhBCADIARCIIh8IQMgBEL/////D4MgESAkfnwhBCADIARCIIh8IQMgBEL/////D4MgFSAgfnwhBCADIARCIIh8IQMgBEL/////D4MgGSAcfnwhBCADIARCIIh8IQMgBEL/////D4MgHSAYfnwhBCADIARCIIh8IQMgBEL/////D4MgISAUfnwhBCADIARCIIh8IQMgBEL/////D4MgJSAQfnwhBCADIARCIIh8IQMgAiAEPgIEIANCIIghBCADQv////8PgyASICN+fCEDIAQgA0IgiHwhBCADQv////8PgyAWIB9+fCEDIAQgA0IgiHwhBCADQv////8PgyAaIBt+fCEDIAQgA0IgiHwhBCADQv////8PgyAeIBd+fCEDIAQgA0IgiHwhBCADQv////8PgyAiIBN+fCEDIAQgA0IgiHwhBCADQv////8PgyAVICR+fCEDIAQgA0IgiHwhBCADQv////8PgyAZICB+fCEDIAQgA0IgiHwhBCADQv////8PgyAdIBx+fCEDIAQgA0IgiHwhBCADQv////8PgyAhIBh+fCEDIAQgA0IgiHwhBCADQv////8PgyAlIBR+fCEDIAQgA0IgiHwhBCACIAM+AgggBEIgiCEDIARC/////w+DIBYgI358IQQgAyAEQiCIfCEDIARC/////w+DIBogH358IQQgAyAEQiCIfCEDIARC/////w+DIB4gG358IQQgAyAEQiCIfCEDIARC/////w+DICIgF358IQQgAyAEQiCIfCEDIARC/////w+DIBkgJH58IQQgAyAEQiCIfCEDIARC/////w+DIB0gIH58IQQgAyAEQiCIfCEDIARC/////w+DICEgHH58IQQgAyAEQiCIfCEDIARC/////w+DICUgGH58IQQgAyAEQiCIfCEDIAIgBD4CDCADQiCIIQQgA0L/////D4MgGiAjfnwhAyAEIANCIIh8IQQgA0L/////D4MgHiAffnwhAyAEIANCIIh8IQQgA0L/////D4MgIiAbfnwhAyAEIANCIIh8IQQgA0L/////D4MgHSAkfnwhAyAEIANCIIh8IQQgA0L/////D4MgISAgfnwhAyAEIANCIIh8IQQgA0L/////D4MgJSAcfnwhAyAEIANCIIh8IQQgAiADPgIQIARCIIghAyAEQv////8PgyAeICN+fCEEIAMgBEIgiHwhAyAEQv////8PgyAiIB9+fCEEIAMgBEIgiHwhAyAEQv////8PgyAhICR+fCEEIAMgBEIgiHwhAyAEQv////8PgyAlICB+fCEEIAMgBEIgiHwhAyACIAQ+AhQgA0IgiCEEIANC/////w+DICIgI358IQMgBCADQiCIfCEEIANC/////w+DICUgJH58IQMgBCADQiCIfCEEIAIgAz4CGCAEQiCIIQMgAiAEPgIcIAOnBEAgAkHoDSACEAcaBSACQegNEAUEQCACQegNIAIQBxoLCwsSACAAIAFB6BIQCUHoEiACEBsLCwAgAEGIDiABEBwLFQAgAEGoExAAQcgTEAFBqBMgARAbCxcAIAAgARAfIAFB6A0gARANIAEgARAeCwkAQagOIAAQAAsVACAAIAFB6BMQHEHoE0GIDiACEBwLCwAgAEHoDSABEA0LCgAgAEHAAGoQAgsVACAAEAEgAEEgahAXIABBwABqEAELIgAgACABEAAgAEEgaiABQSBqEAAgAEHAAGogAUHAAGoQAAuGAgAgABAkBEAgACABECYPCyAAIABBiBQQEiAAQSBqIABBIGpBqBQQEkGoFEGoFEHIFBASIABBqBRB6BQQDkHoFEHoFEHoFBASQegUQYgUQegUEA9B6BRByBRB6BQQD0HoFEHoFEHoFBAOQYgUQYgUQYgVEA5BiBVBiBRBiBUQDkGIFUGIFUGoFRASIABBIGogAEHAAGpByBUQEkHoFEHoFCABEA5BqBUgASABEA9ByBRByBRB6BUQDkHoFUHoFUHoFRAOQegVQegVQegVEA5B6BQgASABQSBqEA8gAUEgakGIFSABQSBqEBIgAUEgakHoFSABQSBqEA9ByBVByBUgAUHAAGoQDgusAwIBfwF/IABBwABqIQMgAUHAAGohBCAAECQEQCABIAIQJg8LIAEQJARAIAAgAhAmDwsgAyADQYgWEBIgBCAEQagWEBIgAEGoFkHIFhASIAFBiBZB6BYQEiADQYgWQYgXEBIgBEGoFkGoFxASIABBIGpBqBdByBcQEiABQSBqQYgXQegXEBJByBZB6BYQBARAQcgXQegXEAQEQCAAIAIQJw8LC0HoFkHIFkGIGBAPQegXQcgXQagYEA9BiBhBiBhByBgQDkHIGEHIGEHIGBASQYgYQcgYQegYEBJBqBhBqBhBiBkQDkHIFkHIGEHIGRASQYgZQYgZQagZEBJByBlByBlB6BkQDkGoGUHoGCACEA8gAkHoGSACEA9ByBdB6BhBiBoQEkGIGkGIGkGIGhAOQcgZIAIgAkEgahAPIAJBIGpBiBkgAkEgahASIAJBIGpBiBogAkEgahAPIAMgBCACQcAAahAOIAJBwABqIAJBwABqIAJBwABqEBIgAkHAAGpBiBYgAkHAAGoQDyACQcAAakGoFiACQcAAahAPIAJBwABqQYgYIAJBwABqEBILIgAgACABEAAgAEEgaiABQSBqEBAgAEHAAGogAUHAAGoQAAsQACABIAIQKSAAIAIgAhAoCyIAIAAgARAVIABBIGogAUEgahAVIABBwABqIAFBwABqEBULIgAgACABEBQgAEEgaiABQSBqEBQgAEHAAGogAUHAAGoQFAtPACAAECQEQCABECUFIABBwABqQagaEBZBqBpBqBpByBoQEkGoGkHIGkHoGhASIABByBogARASIABBIGpB6BogAUEgahASIAFBwABqEBcLC6cCAgF/AX8gAEGIGxAmIAMQJSACIQQCQANAIARBAWshBCABIARqLQAAIQUgAyADECcgBUGAAU8EQCAFQYABayEFQYgbIAMgAxAoCyADIAMQJyAFQcAATwRAIAVBwABrIQVBiBsgAyADECgLIAMgAxAnIAVBIE8EQCAFQSBrIQVBiBsgAyADECgLIAMgAxAnIAVBEE8EQCAFQRBrIQVBiBsgAyADECgLIAMgAxAnIAVBCE8EQCAFQQhrIQVBiBsgAyADECgLIAMgAxAnIAVBBE8EQCAFQQRrIQVBiBsgAyADECgLIAMgAxAnIAVBAk8EQCAFQQJrIQVBiBsgAyADECgLIAMgAxAnIAVBAU8EQCAFQQFrIQVBiBsgAyADECgLIARFDQEMAAsLCysCAX8BfyAAQQV2QQJ0IQFBASAAQR9xdCECIAEgASgC6NsBIAJyNgLo2wELJAIBfwF/IABBBXZBAnQhAUEBIABBH3F0IQIgASgC6NsBIAJxC6ABBAF/AX8BfwF/IAAhAkHoGxAlQQAhBAJAA0AgBCABRg0BQegbQQEgBHRB4ABsaiEDIAIQAiEFIAIgAxAAIAJBIGohAiADQSBqIQMgAiADEAAgAkEgaiECIANBIGohAyAFBEAgAxABBSADEBcLIARBAWohBAwACwtB6NsBQpeChIAQNwMAQfDbAUIBNwMAQfjbAUIBNwMAQYDcAUIANwMAC0ADAX8BfwF/QegbIABB4ABsaiEBIAAQMEUEQCAALQCI3AEQMiECIAAtAIjeARAyIQMgAiADIAEQKCAAEC8LIAELpQEEAX8BfwF+AX5BACEDAkADQCADQSBGDQFCACEGQQAhBAJAA0AgBCABRg0BIAAgBEEgbCADamoxAAAhBSAFIAVCHIaEQo+AgIDwAYMhBSAFIAVCDoaEQoOAjICwgMABgyEFIAUgBUIHhoRCgYKEiJCgwIABgyEFIAYgBSAErYaEIQYgBEEBaiEEDAALCyACIANBCGxqIAY3AwAgA0EBaiEDDAALCwtLAQF/IAAgAkGI4AEQMyADECUgASACEDFBACEEAkADQCAEQYACRg0BIAMgAxAnIANBh+IBIARrLQAAEDIgAxAoIARBAWohBAwACwsLfgQBfwF/AX8BfyAAIQUgASEGIAUgAiADbiADbEEgbGohCAJAA0AgBSAIRg0BIAUgBiADQYjiARA0QYjiASAEIAQQKCAFQSAgA2xqIQUgBkHAACADbGohBgwACwsgAiADcCEHIAcEQCAFIAYgB0GI4gEQNEGI4gEgBCAEECgLC04CAX8BfyAAIAJB6OIBEDMgASACEDFBACEEAkADQCAEQYACRg0BIAMgBEHgAGxqIQUgBUHn5AEgBGstAAAQMiAFECggBEEBaiEEDAALCwspAQF/QQAhAgJAA0AgAiABRg0BIAAgAkHgAGxqECUgAkEBaiECDAALCwtIAgF/AX8gACEEIAQgAhAmIARB4ABqIQRBASEDAkADQCADIAFGDQEgAiACECcgBCACIAIQKCAEQeAAaiEEIANBAWohAwwACwsLigEEAX8BfwF/AX9B6OQBQYACEDcgACEFIAEhBiAFIAIgA24gA2xBIGxqIQgCQANAIAUgCEYNASAFIAYgA0Ho5AEQNiAFQSAgA2xqIQUgBkHAACADbGohBgwACwsgAiADcCEHIAcEQCAFIAYgB0Ho5AEQNgtB6OQBQYACQeikAxA4QeikAyAEIAQQKAtGACAAQf8BcS0AiLQDQRh0IABBCHZB/wFxLQCItANBEHRqIABBEHZB/wFxLQCItANBCHQgAEEYdkH/AXEtAIi0A2pqIAF3C2cFAX8BfwF/AX8Bf0EBIAF0IQJBACEDAkADQCADIAJGDQEgACADQSBsaiEFIAMgARA6IQQgACAEQSBsaiEGIAMgBEkEQCAFQYi2AxAAIAYgBRAAQYi2AyAGEAALIANBAWohAwwACwsL7wEJAX8BfwF/AX8BfwF/AX8BfwF/IAAgARA7QQEgAXQhCEEBIQMCQANAIAMgAUsNAUEBIAN0IQZByKUDIANBIGxqIQlBACEEAkADQCAEIAhPDQEgAgRAIAlBIGpBqLYDEAAFQai2AxAhCyAGQQF2IQdBACEFAkADQCAFIAdPDQEgACAEIAVqQSBsaiEKIAogB0EgbGohC0GotgMgC0HItgMQHCAKQei2AxAAQei2A0HItgMgChAYQei2A0HItgMgCxAZQai2AyAJQai2AxAcIAVBAWohBQwACwsgBCAGaiEEDAALCyADQQFqIQMMAAsLCz4DAX8BfwF/IAAhAyABIQQgACACQSBsaiEFAkADQCADIAVGDQEgAyAEEAAgA0EgaiEDIARBwABqIQQMAAsLCz0DAX8BfwF/IAAhAyABIQQgACACQSBsaiEFAkADQCADIAVGDQEgAyAEEB8gA0EgaiEDIARBIGohBAwACwsLPQMBfwF/AX8gACEDIAEhBCAAIAJBIGxqIQUCQANAIAMgBUYNASADIAQQHiADQSBqIQMgBEEgaiEEDAALCwuWAQcBfwF/AX8BfwF/AX8Bf0EBIAF0IQJB6KwDIAFBIGxqIQQgAkEBayEGQQEhBSACQQF2IQMCQANAIAUgA0YNASAAIAVBIGxqIQcgACACIAVrQSBsaiEIIAdBiLcDEAAgCCAEIAcQHEGItwMgBCAIEBwgBUEBaiEFDAALCyAAIAQgABAcIAAgA0EgbGohCCAIIAQgCBAcC0MCAX8BfyAAQQF2IQJBACEBAkADQCACRQ0BIAJBAXYhAiABQQFqIQEMAAsLIABBASABdEcEQAALIAFBHEsEQAALIAELEgEBfyABEEEhAyAAIAMgAhA8CxgBAX8gARBBIQMgACADIAIQPCAAIAMQQAtMBAF/AX8BfwF/IAAhBCABIQUgAyEGIAAgAkEgbGohBwJAA0AgBCAHRg0BIAQgBSAGEBwgBEEgaiEEIAVBIGohBSAGQSBqIQYMAAsLCy4CAX8BfyAAIQMgACABQSBsaiECAkADQCADIAJGDQEgAxABIANBIGohAwwACwsLjgEGAX8BfwF/AX8BfwF/QQAhBCAAIQYgASEHAkADQCAEIAJGDQEgBigCACEJIAZBBGohBkEAIQUCQANAIAUgCUYNASADIAYoAgBBIGxqIQggBkEEaiEGIAcgBkGotwMQHEGotwMgCCAIEBggBkEgaiEGIAVBAWohBQwACwsgB0EgaiEHIARBAWohBAwACwsLDgAgABACIABBIGoQAnELDQAgABABIABBIGoQAQsNACAAEBcgAEEgahABCxQAIAAgARAAIABBIGogAUEgahAAC3kAIAAgAUHotwMQEiAAQSBqIAFBIGpBiLgDEBIgACAAQSBqQai4AxAOIAEgAUEgakHIuAMQDkGouANByLgDQai4AxASQYi4A0HItwMgAhASQei3AyACIAIQDkHotwNBiLgDIAJBIGoQDkGouAMgAkEgaiACQSBqEA8LGwAgACABIAIQDiAAQSBqIAFBIGogAkEgahAOCxsAIAAgASACEA8gAEEgaiABQSBqIAJBIGoQDwsUACAAIAEQECAAQSBqIAFBIGoQEAsUACAAIAEQFCAAQSBqIAFBIGoQFAsUACAAIAEQFSAAQSBqIAFBIGoQFQsVACAAIAEQBCAAQSBqIAFBIGoQBHELaAAgACAAQei4AxASIABBIGogAEEgakGIuQMQEkGIuQNByLcDQai5AxASQei4A0GouQNBqLkDEA9BqLkDQci5AxAWIABByLkDIAEQEiAAQSBqQci5AyABQSBqEBIgAUEgaiABQSBqEBALCgAgAEGAAWoQRwsWACAAEEggAEHAAGoQSSAAQYABahBICyQAIAAgARBKIABBwABqIAFBwABqEEogAEGAAWogAUGAAWoQSgu8AgAgABBTBEAgACABEFUPCyAAIABB6LkDEEsgAEHAAGogAEHAAGpBqLoDEEtBqLoDQai6A0HougMQSyAAQai6A0GouwMQTEGouwNBqLsDQai7AxBLQai7A0HouQNBqLsDEE1BqLsDQei6A0GouwMQTUGouwNBqLsDQai7AxBMQei5A0HouQNB6LsDEExB6LsDQei5A0HouwMQTEHouwNB6LsDQai8AxBLIABBwABqIABBgAFqQei8AxBLQai7A0GouwMgARBMQai8AyABIAEQTUHougNB6LoDQai9AxBMQai9A0GovQNBqL0DEExBqL0DQai9A0GovQMQTEGouwMgASABQcAAahBNIAFBwABqQei7AyABQcAAahBLIAFBwABqQai9AyABQcAAahBNQei8A0HovAMgAUGAAWoQTAvvAwIBfwF/IABBgAFqIQMgAUGAAWohBCAAEFMEQCABIAIQVQ8LIAEQUwRAIAAgAhBVDwsgAyADQei9AxBLIAQgBEGovgMQSyAAQai+A0HovgMQSyABQei9A0GovwMQSyADQei9A0HovwMQSyAEQai+A0GowAMQSyAAQcAAakGowANB6MADEEsgAUHAAGpB6L8DQajBAxBLQei+A0GovwMQUQRAQejAA0GowQMQUQRAIAAgAhBWDwsLQai/A0HovgNB6MEDEE1BqMEDQejAA0GowgMQTUHowQNB6MEDQejCAxBMQejCA0HowgNB6MIDEEtB6MEDQejCA0GowwMQS0GowgNBqMIDQejDAxBMQei+A0HowgNB6MQDEEtB6MMDQejDA0GoxAMQS0HoxANB6MQDQajFAxBMQajEA0GowwMgAhBNIAJBqMUDIAIQTUHowANBqMMDQejFAxBLQejFA0HoxQNB6MUDEExB6MQDIAIgAkHAAGoQTSACQcAAakHowwMgAkHAAGoQSyACQcAAakHoxQMgAkHAAGoQTSADIAQgAkGAAWoQTCACQYABaiACQYABaiACQYABahBLIAJBgAFqQei9AyACQYABahBNIAJBgAFqQai+AyACQYABahBNIAJBgAFqQejBAyACQYABahBLCyQAIAAgARBKIABBwABqIAFBwABqEE4gAEGAAWogAUGAAWoQSgsQACABIAIQWCAAIAIgAhBXCyQAIAAgARBQIABBwABqIAFBwABqEFAgAEGAAWogAUGAAWoQUAskACAAIAEQTyAAQcAAaiABQcAAahBPIABBgAFqIAFBgAFqEE8LWgAgABBTBEAgARBUBSAAQYABakGoxgMQUkGoxgNBqMYDQejGAxBLQajGA0HoxgNBqMcDEEsgAEHoxgMgARBLIABBwABqQajHAyABQcAAahBLIAFBgAFqEEkLC7ACAgF/AX8gAEHoxwMQVSADEFQgAiEEAkADQCAEQQFrIQQgASAEai0AACEFIAMgAxBWIAVBgAFPBEAgBUGAAWshBUHoxwMgAyADEFcLIAMgAxBWIAVBwABPBEAgBUHAAGshBUHoxwMgAyADEFcLIAMgAxBWIAVBIE8EQCAFQSBrIQVB6McDIAMgAxBXCyADIAMQViAFQRBPBEAgBUEQayEFQejHAyADIAMQVwsgAyADEFYgBUEITwRAIAVBCGshBUHoxwMgAyADEFcLIAMgAxBWIAVBBE8EQCAFQQRrIQVB6McDIAMgAxBXCyADIAMQViAFQQJPBEAgBUECayEFQejHAyADIAMQVwsgAyADEFYgBUEBTwRAIAVBAWshBUHoxwMgAyADEFcLIARFDQEMAAsLCysCAX8BfyAAQQV2QQJ0IQFBASAAQR9xdCECIAEgASgCqMkGIAJyNgKoyQYLJAIBfwF/IABBBXZBAnQhAUEBIABBH3F0IQIgASgCqMkGIAJxC6YBBAF/AX8BfwF/IAAhAkGoyQMQVEEAIQQCQANAIAQgAUYNAUGoyQNBASAEdEHAAWxqIQMgAhBHIQUgAiADEEogAkHAAGohAiADQcAAaiEDIAIgAxBKIAJBwABqIQIgA0HAAGohAyAFBEAgAxBIBSADEEkLIARBAWohBAwACwtBqMkGQpeChIAQNwMAQbDJBkIBNwMAQbjJBkIBNwMAQcDJBkIANwMAC0EDAX8BfwF/QajJAyAAQcABbGohASAAEF9FBEAgAC0AyMkGEGEhAiAALQDIywYQYSEDIAIgAyABEFcgABBeCyABC6UBBAF/AX8BfgF+QQAhAwJAA0AgA0EgRg0BQgAhBkEAIQQCQANAIAQgAUYNASAAIARBIGwgA2pqMQAAIQUgBSAFQhyGhEKPgICA8AGDIQUgBSAFQg6GhEKDgIyAsIDAAYMhBSAFIAVCB4aEQoGChIiQoMCAAYMhBSAGIAUgBK2GhCEGIARBAWohBAwACwsgAiADQQhsaiAGNwMAIANBAWohAwwACwsLSwEBfyAAIAJByM0GEGIgAxBUIAEgAhBgQQAhBAJAA0AgBEGAAkYNASADIAMQViADQcfPBiAEay0AABBhIAMQVyAEQQFqIQQMAAsLC34EAX8BfwF/AX8gACEFIAEhBiAFIAIgA24gA2xBIGxqIQgCQANAIAUgCEYNASAFIAYgA0HIzwYQY0HIzwYgBCAEEFcgBUEgIANsaiEFIAZBgAEgA2xqIQYMAAsLIAIgA3AhByAHBEAgBSAGIAdByM8GEGNByM8GIAQgBBBXCwtOAgF/AX8gACACQYjRBhBiIAEgAhBgQQAhBAJAA0AgBEGAAkYNASADIARBwAFsaiEFIAVBh9MGIARrLQAAEGEgBRBXIARBAWohBAwACwsLKQEBf0EAIQICQANAIAIgAUYNASAAIAJBwAFsahBUIAJBAWohAgwACwsLSAIBfwF/IAAhBCAEIAIQVSAEQcABaiEEQQEhAwJAA0AgAyABRg0BIAIgAhBWIAQgAiACEFcgBEHAAWohBCADQQFqIQMMAAsLC4oBBAF/AX8BfwF/QYjTBkGAAhBmIAAhBSABIQYgBSACIANuIANsQSBsaiEIAkADQCAFIAhGDQEgBSAGIANBiNMGEGUgBUEgIANsaiEFIAZBgAEgA2xqIQYMAAsLIAIgA3AhByAHBEAgBSAGIAdBiNMGEGULQYjTBkGAAkGI0wkQZ0GI0wkgBCAEEFcLJAEBfyADIQQCQANAIAAgASACEBIgBEEBayEEIARFDQEMAAsLCyQBAX8gAyEEAkADQCAAIAEgAhATIARBAWshBCAERQ0BDAALCwsL/hsSAEEACwRIagIAAEEICyABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABB6AcLIEf9fNgWjCA8jcpxaJFqgZddWIGBtkVQuCmgMeFyTmQwAEGICAsgifqKU1v8LPP7AUXUERnntfZ/QQr/HqtHHzW4ynGf2AYAQagICyCdDY/FjUNd0z0Lx/Uo63gKLEZ5eG+jbmYv3weawXcKDgBByAgLIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEHoDQsgAQAA8JP14UORcLl5SOgzKF1YgYG2RVC4KaAx4XJOZDAAQYgOCyCnbSGuRea4G+NZXOOxOv5ThYC7Uz2DSYylRE5/sdAWAgBBqA4LIPv//08cNJasKc1gn5V2/DYuRnl4b6NuZi/fB5rBdwoOAEHIDgsgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQYjcAQuAAgAAAAIABAQGAAgICggMDAwAEBASEBQUFBAYGBgYGBgcACAgIiAkJCQgKCgoKCgoLCAwMDAwMDA0MDAwODA4ODgAQEBCQEREREBISEhISEhMQFBQUFBQUFRQUFBYUFhYWEBgYGBgYGBkYGBgaGBoaGhgYGBwYHBwcGBwcHBwcHB4AICAgoCEhISAiIiIiIiIjICQkJCQkJCUkJCQmJCYmJiAoKCgoKCgpKCgoKigqKiooKCgsKCwsLCgsLCwsLCwuIDAwMDAwMDEwMDAyMDIyMjAwMDQwNDQ0MDQ0NDQ0NDYwMDA4MDg4ODA4ODg4ODg6MDg4ODg4ODw4ODg8ODw8PAAQYjeAQuAAgAAAAEAAQIBAAECAQQBAgMAAQIBBAECAwgBAgMEBQYDAAECAQQBAgMIAQIDBAUGAxABAgMEBQYDCAkKAwwFBgcAAQIBBAECAwgBAgMEBQYDEAECAwQFBgMICQoDDAUGByABAgMEBQYDCAkKAwwFBgcQERIDFAUGBxgJCgsMDQ4HAAECAQQBAgMIAQIDBAUGAxABAgMEBQYDCAkKAwwFBgcgAQIDBAUGAwgJCgMMBQYHEBESAxQFBgcYCQoLDA0OB0ABAgMEBQYDCAkKAwwFBgcQERIDFAUGBxgJCgsMDQ4HICEiAyQFBgcoCQoLDA0OBzAREhMUFRYHGBkaCxwNDg8AQcilAwugB/v//08cNJasKc1gn5V2/DYuRnl4b6NuZi/fB5rBdwoOBgAAoHfBS5dno1jasnE38S4SCAlHouFR+sApR7HWWSKL79yelz11fyCRR7EsFz9fbmwJdHlisY3PCME5NXs3Kz98rbXiSq34voXLg//GYC33KZRdK/122anZmj/nfEAkA48vdHx9tvTMaNBj3C0baGpX+xvvvOWM/jy20lEpfBZkTFe/sfcUIvJ9MfcvI/kozXWtsKiEdeUDbRfcWfuBK0KecG6u8VG1znHA3RMpmJsOBYBC6VZzZO31B/wGuNMJgFNdsQYNFKuXWzG8zDovjE+ZBJIlN1l4NCbiWfDzshwAnKOeMZOPf4JXzPlZECV7fFP7zWe9g1asm6gYrsbsFzMECZKPksjJo/TZf6YBR9mLJ4/9+1Xmzt4OLRdwRY4VE6UgZnX5WZ2ZVwHqo0XnM2zdv2C/4paJx+I1twLvpiIudgBd/OlRSeWuZMGCrX128iJOQvGv4V+XE7D47etlI9kBPlZnQaSjJboMUrpemCwhbXCfkuALYy7ljTRjrYwPGmYZCIlu6JiUND20wnGJpQyvbkFNfcvYJ1nvfCLUBAERlgf+kG8TKjJxjFo7lZGQN1CWNzfy380mlBQCXqEpDNRyDoJMZGltDMJyc8g9YzCdm1pCQQw7VxcnCqB/QlgeELjTUZK0AZScwI809Zg83oOT1AeLGbXPYwx/RlvO7CngQ+GA5vdXj3vbSsX5Loork99rO4/jEMoAAl1nXrctKecj6qy4yOYv8R6NjwW1zvfwzRJ8H4QnUTCoubd9byIhzi1+AHOxdSTqeQVkX6otYtxn8e7Xdq71fylqiLEQ7iUzR54WRLPrASD4tYlq3XaJ3TQOTAP7n6IA4mGcFayzGX0R+krdZAdiV5Mti3GsHJG6+FYYISp3CMFg9aFV9WgXZIs6zEmo7UWQbqVH9LpafStbw6/v4Ua/Pkg47qP9/RfvaMRqvM7HsG9Jryf2s34eEapUzcyjkkpfuMOubR1HFMwGf4lFmV7tafi5x3bRxWN5uYLSR51EFtxVzV1/hyoj2h08y2o/HLkYoHNUZKTEngzfD2tkXfnp9i7EyNy6ei9uxcz31cVAdqfy89gf8xbnR/8w9Pae3HbbOE42ZfQcIrN9xQ6tQO/ha7dA7s7CGs1m0ftNi8+MHDB7M+wTiPEQuP45tsXHMpaZ8g8NQONcmNjssAEAiN2yKc6YbQ0HaR0AQeisAwugB/v//08cNJasKc1gn5V2/DYuRnl4b6NuZi/fB5rBdwoO/v//H9gUPHjdHo0Mby+Yr0VP/fySdF+PrL+cPRpjNx////8PbAoevG6PRoa3F8zXoqd+fkm6r0fWX84ejbGbDwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAQYi0AwuAAgCAQMAgoGDgEJBQ0DCwcPAIiEjIKKho6BiYWNg4uHj4BIRExCSkZOQUlFTUNLR09AyMTMwsrGzsHJxc3Dy8fPwCgkLCIqJi4hKSUtIysnLyCopKyiqqauoamlraOrp6+gaGRsYmpmbmFpZW1ja2dvYOjk7OLq5u7h6eXt4+vn7+AYFBwSGhYeERkVHRMbFx8QmJSckpqWnpGZlZ2Tm5efkFhUXFJaVl5RWVVdU1tXX1DY1NzS2tbe0dnV3dPb19/QODQ8Mjo2PjE5NT0zOzc/MLi0vLK6tr6xubW9s7u3v7B4dHxyenZ+cXl1fXN7d39w+PT88vr2/vH59f3z+/f/8AQci3Awsgqu/tEolIw2hPv6pyaH8IjTESCAlHouFR+sApR7HWWSIAQcjJBguAAgAAAAIABAQGAAgICggMDAwAEBASEBQUFBAYGBgYGBgcACAgIiAkJCQgKCgoKCgoLCAwMDAwMDA0MDAwODA4ODgAQEBCQEREREBISEhISEhMQFBQUFBQUFRQUFBYUFhYWEBgYGBgYGBkYGBgaGBoaGhgYGBwYHBwcGBwcHBwcHB4AICAgoCEhISAiIiIiIiIjICQkJCQkJCUkJCQmJCYmJiAoKCgoKCgpKCgoKigqKiooKCgsKCwsLCgsLCwsLCwuIDAwMDAwMDEwMDAyMDIyMjAwMDQwNDQ0MDQ0NDQ0NDYwMDA4MDg4ODA4ODg4ODg6MDg4ODg4ODw4ODg8ODw8PAAQcjLBguAAgAAAAEAAQIBAAECAQQBAgMAAQIBBAECAwgBAgMEBQYDAAECAQQBAgMIAQIDBAUGAxABAgMEBQYDCAkKAwwFBgcAAQIBBAECAwgBAgMEBQYDEAECAwQFBgMICQoDDAUGByABAgMEBQYDCAkKAwwFBgcQERIDFAUGBxgJCgsMDQ4HAAECAQQBAgMIAQIDBAUGAxABAgMEBQYDCAkKAwwFBgcgAQIDBAUGAwgJCgMMBQYHEBESAxQFBgcYCQoLDA0OB0ABAgMEBQYDCAkKAwwFBgcQERIDFAUGBxgJCgsMDQ4HICEiAyQFBgcoCQoLDA0OBzAREhMUFRYHGBkaCxwNDg8=", "base64"); exports.pq = 1000; @@ -14185,7 +14882,6 @@ if (true) { /***/ 36336: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var process = __webpack_require__(65606); /* Copyright 2019 0KIMS association. @@ -15022,7 +15718,7 @@ function unhexifyBigInts(o) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0; +exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv = void 0; const core_1 = __webpack_require__(4042); const draft7_1 = __webpack_require__(86144); const discriminator_1 = __webpack_require__(36653); @@ -15051,7 +15747,9 @@ class Ajv extends core_1.default { super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)); } } +exports.Ajv = Ajv; module.exports = exports = Ajv; +module.exports.Ajv = Ajv; Object.defineProperty(exports, "__esModule", ({ value: true })); exports["default"] = Ajv; var validate_1 = __webpack_require__(62586); @@ -15078,6 +15776,7 @@ Object.defineProperty(exports, "MissingRefError", ({ enumerable: true, get: func Object.defineProperty(exports, "__esModule", ({ value: true })); exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0; +// eslint-disable-next-line @typescript-eslint/no-extraneous-class class _CodeOrName { } exports._CodeOrName = _CodeOrName; @@ -15955,7 +16654,7 @@ var UsedValueState; (function (UsedValueState) { UsedValueState[UsedValueState["Started"] = 0] = "Started"; UsedValueState[UsedValueState["Completed"] = 1] = "Completed"; -})(UsedValueState = exports.UsedValueState || (exports.UsedValueState = {})); +})(UsedValueState || (exports.UsedValueState = UsedValueState = {})); exports.varKinds = { const: new code_1.Name("const"), let: new code_1.Name("let"), @@ -16165,7 +16864,7 @@ function returnErrors(it, errs) { } const E = { keyword: new codegen_1.Name("keyword"), - schemaPath: new codegen_1.Name("schemaPath"), + schemaPath: new codegen_1.Name("schemaPath"), // also used in JTD errors params: new codegen_1.Name("params"), propertyName: new codegen_1.Name("propertyName"), message: new codegen_1.Name("message"), @@ -16278,7 +16977,7 @@ function compileSchema(sch) { parentData: names_1.default.parentData, parentDataProperty: names_1.default.parentDataProperty, dataNames: [names_1.default.data], - dataPathArr: [codegen_1.nil], + dataPathArr: [codegen_1.nil], // TODO can its length be used as dataLevel if nil is removed? dataLevel: 0, dataTypes: [], definedProperties: new Set(), @@ -16475,17 +17174,17 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); const codegen_1 = __webpack_require__(99029); const names = { // validation function arguments - data: new codegen_1.Name("data"), + data: new codegen_1.Name("data"), // data passed to validation function // args passed from referencing schema - valCxt: new codegen_1.Name("valCxt"), + valCxt: new codegen_1.Name("valCxt"), // validation/data context - should not be used directly, it is destructured to the names below instancePath: new codegen_1.Name("instancePath"), parentData: new codegen_1.Name("parentData"), parentDataProperty: new codegen_1.Name("parentDataProperty"), - rootData: new codegen_1.Name("rootData"), - dynamicAnchors: new codegen_1.Name("dynamicAnchors"), + rootData: new codegen_1.Name("rootData"), // root data - same as the data passed to the first/top validation function + dynamicAnchors: new codegen_1.Name("dynamicAnchors"), // used to support recursiveRef and dynamicRef // function scoped variables - vErrors: new codegen_1.Name("vErrors"), - errors: new codegen_1.Name("errors"), + vErrors: new codegen_1.Name("vErrors"), // null or array of validation errors + errors: new codegen_1.Name("errors"), // counter of validation errors this: new codegen_1.Name("this"), // "globals" self: new codegen_1.Name("self"), @@ -16630,16 +17329,16 @@ function getSchemaRefs(schema, baseId) { if (parentJsonPtr === undefined) return; const fullPath = pathPrefix + jsonPtr; - let baseId = baseIds[parentJsonPtr]; + let innerBaseId = baseIds[parentJsonPtr]; if (typeof sch[schemaId] == "string") - baseId = addRef.call(this, sch[schemaId]); + innerBaseId = addRef.call(this, sch[schemaId]); addAnchor.call(this, sch.$anchor); addAnchor.call(this, sch.$dynamicAnchor); - baseIds[jsonPtr] = baseId; + baseIds[jsonPtr] = innerBaseId; function addRef(ref) { // eslint-disable-next-line @typescript-eslint/unbound-method const _resolve = this.opts.uriResolver.resolve; - ref = normalizeId(baseId ? _resolve(baseId, ref) : ref); + ref = normalizeId(innerBaseId ? _resolve(innerBaseId, ref) : ref); if (schemaRefs.has(ref)) throw ambiguos(ref); schemaRefs.add(ref); @@ -16871,7 +17570,7 @@ var Type; (function (Type) { Type[Type["Num"] = 0] = "Num"; Type[Type["Str"] = 1] = "Str"; -})(Type = exports.Type || (exports.Type = {})); +})(Type || (exports.Type = Type = {})); function getErrorPath(dataProp, dataPropType, jsPropertySyntax) { // let path if (dataProp instanceof codegen_1.Name) { @@ -16999,7 +17698,7 @@ var DataType; (function (DataType) { DataType[DataType["Correct"] = 0] = "Correct"; DataType[DataType["Wrong"] = 1] = "Wrong"; -})(DataType = exports.DataType || (exports.DataType = {})); +})(DataType || (exports.DataType = DataType = {})); function getSchemaTypes(schema) { const types = getJSONTypes(schema.type); const hasNull = types.includes("null"); @@ -17017,6 +17716,7 @@ function getSchemaTypes(schema) { return types; } exports.getSchemaTypes = getSchemaTypes; +// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents function getJSONTypes(ts) { const types = Array.isArray(ts) ? ts : ts ? [ts] : []; if (types.every(rules_1.isJSONType)) @@ -17984,7 +18684,6 @@ exports.extendSubschemaMode = extendSubschemaMode; /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var console = __webpack_require__(96763); Object.defineProperty(exports, "__esModule", ({ value: true })); exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0; @@ -18125,6 +18824,7 @@ class Ajv { return (this.opts.defaultMeta = typeof meta == "object" ? meta[schemaId] || meta : undefined); } validate(schemaKeyRef, // key, ref or schema object + // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents data // to be validated ) { let v; @@ -18473,9 +19173,9 @@ class Ajv { } } } -exports["default"] = Ajv; Ajv.ValidationError = validation_error_1.default; Ajv.MissingRefError = ref_error_1.default; +exports["default"] = Ajv; function checkOptions(checkOpts, options, msg, log = "error") { for (const key in checkOpts) { const opt = key; @@ -18656,7 +19356,7 @@ ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default'; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -const uri = __webpack_require__(46579); +const uri = __webpack_require__(48343); uri.code = 'require("ajv/dist/runtime/uri").default'; exports["default"] = uri; //# sourceMappingURL=uri.js.map @@ -19956,6 +20656,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); const codegen_1 = __webpack_require__(99029); const types_1 = __webpack_require__(97652); const compile_1 = __webpack_require__(73835); +const ref_error_1 = __webpack_require__(34551); const util_1 = __webpack_require__(94227); const error = { message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag @@ -20010,9 +20711,12 @@ const def = { for (let i = 0; i < oneOf.length; i++) { let sch = oneOf[i]; if ((sch === null || sch === void 0 ? void 0 : sch.$ref) && !(0, util_1.schemaHasRulesButRef)(sch, it.self.RULES)) { - sch = compile_1.resolveRef.call(it.self, it.schemaEnv.root, it.baseId, sch === null || sch === void 0 ? void 0 : sch.$ref); + const ref = sch.$ref; + sch = compile_1.resolveRef.call(it.self, it.schemaEnv.root, it.baseId, ref); if (sch instanceof compile_1.SchemaEnv) sch = sch.schema; + if (sch === undefined) + throw new ref_error_1.default(it.opts.uriResolver, it.baseId, ref); } const propSch = (_a = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a === void 0 ? void 0 : _a[tagName]; if (typeof propSch != "object") { @@ -20065,7 +20769,7 @@ var DiscrError; (function (DiscrError) { DiscrError["Tag"] = "tag"; DiscrError["Mapping"] = "mapping"; -})(DiscrError = exports.DiscrError || (exports.DiscrError = {})); +})(DiscrError || (exports.DiscrError = DiscrError = {})); //# sourceMappingURL=types.js.map /***/ }), @@ -25970,8 +26674,6 @@ PEMEncoder.prototype.encode = function encode(data, options) { /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(65606); -/* provided dependency */ var console = __webpack_require__(96763); // Currently in sync with Node.js lib/assert.js // https://github.com/nodejs/node/commit/2a51ae424a513ec9a6aa3466baa0cc1d55dd4f3b @@ -26569,7 +27271,6 @@ assert.strict.strict = assert.strict; /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(65606); // Currently in sync with Node.js lib/internal/assert/assertion_error.js // https://github.com/nodejs/node/commit/0817840f775032169ddd70c85ac059f18ffcc81c @@ -28649,6 +29350,133 @@ module.exports = { } +/***/ }), + +/***/ 95364: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +// base-x encoding / decoding +// Copyright (c) 2018 base-x contributors +// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp) +// Distributed under the MIT software license, see the accompanying +// file LICENSE or http://www.opensource.org/licenses/mit-license.php. +// @ts-ignore +var _Buffer = (__webpack_require__(92861).Buffer) +function base (ALPHABET) { + if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') } + var BASE_MAP = new Uint8Array(256) + for (var j = 0; j < BASE_MAP.length; j++) { + BASE_MAP[j] = 255 + } + for (var i = 0; i < ALPHABET.length; i++) { + var x = ALPHABET.charAt(i) + var xc = x.charCodeAt(0) + if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') } + BASE_MAP[xc] = i + } + var BASE = ALPHABET.length + var LEADER = ALPHABET.charAt(0) + var FACTOR = Math.log(BASE) / Math.log(256) // log(BASE) / log(256), rounded up + var iFACTOR = Math.log(256) / Math.log(BASE) // log(256) / log(BASE), rounded up + function encode (source) { + if (Array.isArray(source) || source instanceof Uint8Array) { source = _Buffer.from(source) } + if (!_Buffer.isBuffer(source)) { throw new TypeError('Expected Buffer') } + if (source.length === 0) { return '' } + // Skip & count leading zeroes. + var zeroes = 0 + var length = 0 + var pbegin = 0 + var pend = source.length + while (pbegin !== pend && source[pbegin] === 0) { + pbegin++ + zeroes++ + } + // Allocate enough space in big-endian base58 representation. + var size = ((pend - pbegin) * iFACTOR + 1) >>> 0 + var b58 = new Uint8Array(size) + // Process the bytes. + while (pbegin !== pend) { + var carry = source[pbegin] + // Apply "b58 = b58 * 256 + ch". + var i = 0 + for (var it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) { + carry += (256 * b58[it1]) >>> 0 + b58[it1] = (carry % BASE) >>> 0 + carry = (carry / BASE) >>> 0 + } + if (carry !== 0) { throw new Error('Non-zero carry') } + length = i + pbegin++ + } + // Skip leading zeroes in base58 result. + var it2 = size - length + while (it2 !== size && b58[it2] === 0) { + it2++ + } + // Translate the result into a string. + var str = LEADER.repeat(zeroes) + for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]) } + return str + } + function decodeUnsafe (source) { + if (typeof source !== 'string') { throw new TypeError('Expected String') } + if (source.length === 0) { return _Buffer.alloc(0) } + var psz = 0 + // Skip and count leading '1's. + var zeroes = 0 + var length = 0 + while (source[psz] === LEADER) { + zeroes++ + psz++ + } + // Allocate enough space in big-endian base256 representation. + var size = (((source.length - psz) * FACTOR) + 1) >>> 0 // log(58) / log(256), rounded up. + var b256 = new Uint8Array(size) + // Process the characters. + while (psz < source.length) { + // Decode character + var carry = BASE_MAP[source.charCodeAt(psz)] + // Invalid character + if (carry === 255) { return } + var i = 0 + for (var it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) { + carry += (BASE * b256[it3]) >>> 0 + b256[it3] = (carry % 256) >>> 0 + carry = (carry / 256) >>> 0 + } + if (carry !== 0) { throw new Error('Non-zero carry') } + length = i + psz++ + } + // Skip leading zeroes in b256. + var it4 = size - length + while (it4 !== size && b256[it4] === 0) { + it4++ + } + var vch = _Buffer.allocUnsafe(zeroes + (size - it4)) + vch.fill(0x00, 0, zeroes) + var j = zeroes + while (it4 !== size) { + vch[j++] = b256[it4++] + } + return vch + } + function decode (string) { + var buffer = decodeUnsafe(string) + if (buffer) { return buffer } + throw new Error('Non-base' + BASE + ' character') + } + return { + encode: encode, + decodeUnsafe: decodeUnsafe, + decode: decode + } +} +module.exports = base + + /***/ }), /***/ 67526: @@ -30282,7 +31110,7 @@ module.exports = __webpack_require__(85702)(__webpack_require__(86989)) /***/ 4315: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; const Transform = (__webpack_require__(28399).Transform) module.exports = class Blake extends Transform { @@ -30369,7 +31197,7 @@ module.exports = (engines) => { /***/ 34588: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; class Blake { _lengthCarry (arr) { for (let j = 0; j < arr.length; ++j) { @@ -30453,7 +31281,7 @@ module.exports = Blake /***/ 48746: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; const Blake256 = __webpack_require__(23287) const zo = Buffer.from([0x00]) @@ -30487,7 +31315,7 @@ module.exports = class Blake224 extends Blake256 { /***/ 23287: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; const Blake = __webpack_require__(34588) const zo = Buffer.from([0x01]) @@ -30616,7 +31444,7 @@ module.exports = class Blake256 extends Blake { /***/ 399: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; const Blake512 = __webpack_require__(61070) const zo = Buffer.from([0x00]) @@ -30652,7 +31480,7 @@ module.exports = class Blake384 extends Blake512 { /***/ 61070: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; const Blake = __webpack_require__(34588) const zo = Buffer.from([0x01]) @@ -35954,7 +36782,7 @@ module.exports = modes /***/ 46843: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; var xor = __webpack_require__(30295) function getBlock (self) { @@ -36174,7 +37002,7 @@ exports["des-ede"] = { /***/ 67332: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; var BN = __webpack_require__(39404) var randomBytes = __webpack_require__(53209) @@ -36785,7 +37613,6 @@ PassThrough.prototype._transform = function (chunk, encoding, cb) { /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(65606); // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -38033,7 +38860,6 @@ function done(stream, er, data) { /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(65606); // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -39365,8 +40191,7 @@ SafeBuffer.allocUnsafeSlow = function (size) { /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; -/* provided dependency */ var process = __webpack_require__(65606); +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; /* eslint camelcase: "off" */ @@ -39783,7 +40608,6 @@ exports.Zlib = Zlib; /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(65606); var Buffer = (__webpack_require__(48287).Buffer); @@ -40399,7 +41223,7 @@ util.inherits(Unzip, Zlib); /***/ 30295: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; module.exports = function xor (a, b) { var length = Math.min(a.length, b.length) var buffer = new Buffer(length) @@ -40418,7 +41242,6 @@ module.exports = function xor (a, b) { /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var console = __webpack_require__(96763); /*! * The buffer module from node.js, for the browser. * @@ -40429,9 +41252,9 @@ module.exports = function xor (a, b) { -const base64 = __webpack_require__(67526) -const ieee754 = __webpack_require__(251) -const customInspectSymbol = +var base64 = __webpack_require__(67526) +var ieee754 = __webpack_require__(251) +var 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 @@ -40440,7 +41263,7 @@ exports.Buffer = Buffer exports.SlowBuffer = SlowBuffer exports.INSPECT_MAX_BYTES = 50 -const K_MAX_LENGTH = 0x7fffffff +var K_MAX_LENGTH = 0x7fffffff exports.kMaxLength = K_MAX_LENGTH /** @@ -40470,8 +41293,8 @@ if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && function typedArraySupport () { // Can typed array instances can be augmented? try { - const arr = new Uint8Array(1) - const proto = { foo: function () { return 42 } } + var arr = new Uint8Array(1) + var proto = { foo: function () { return 42 } } Object.setPrototypeOf(proto, Uint8Array.prototype) Object.setPrototypeOf(arr, proto) return arr.foo() === 42 @@ -40501,7 +41324,7 @@ function createBuffer (length) { throw new RangeError('The value "' + length + '" is invalid for option "size"') } // Return an augmented `Uint8Array` instance - const buf = new Uint8Array(length) + var buf = new Uint8Array(length) Object.setPrototypeOf(buf, Buffer.prototype) return buf } @@ -40564,17 +41387,19 @@ function from (value, encodingOrOffset, length) { ) } - const valueOf = value.valueOf && value.valueOf() + var valueOf = value.valueOf && value.valueOf() if (valueOf != null && valueOf !== value) { return Buffer.from(valueOf, encodingOrOffset, length) } - const b = fromObject(value) + var 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) + return Buffer.from( + value[Symbol.toPrimitive]('string'), encodingOrOffset, length + ) } throw new TypeError( @@ -40659,10 +41484,10 @@ function fromString (string, encoding) { throw new TypeError('Unknown encoding: ' + encoding) } - const length = byteLength(string, encoding) | 0 - let buf = createBuffer(length) + var length = byteLength(string, encoding) | 0 + var buf = createBuffer(length) - const actual = buf.write(string, encoding) + var actual = buf.write(string, encoding) if (actual !== length) { // Writing a hex string, for example, that contains invalid characters will @@ -40675,9 +41500,9 @@ function fromString (string, encoding) { } 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) { + var length = array.length < 0 ? 0 : checked(array.length) | 0 + var buf = createBuffer(length) + for (var i = 0; i < length; i += 1) { buf[i] = array[i] & 255 } return buf @@ -40685,7 +41510,7 @@ function fromArrayLike (array) { function fromArrayView (arrayView) { if (isInstance(arrayView, Uint8Array)) { - const copy = new Uint8Array(arrayView) + var copy = new Uint8Array(arrayView) return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength) } return fromArrayLike(arrayView) @@ -40700,7 +41525,7 @@ function fromArrayBuffer (array, byteOffset, length) { throw new RangeError('"length" is outside of buffer bounds') } - let buf + var buf if (byteOffset === undefined && length === undefined) { buf = new Uint8Array(array) } else if (length === undefined) { @@ -40717,8 +41542,8 @@ function fromArrayBuffer (array, byteOffset, length) { function fromObject (obj) { if (Buffer.isBuffer(obj)) { - const len = checked(obj.length) | 0 - const buf = createBuffer(len) + var len = checked(obj.length) | 0 + var buf = createBuffer(len) if (buf.length === 0) { return buf @@ -40773,10 +41598,10 @@ Buffer.compare = function compare (a, b) { if (a === b) return 0 - let x = a.length - let y = b.length + var x = a.length + var y = b.length - for (let i = 0, len = Math.min(x, y); i < len; ++i) { + for (var i = 0, len = Math.min(x, y); i < len; ++i) { if (a[i] !== b[i]) { x = a[i] y = b[i] @@ -40817,7 +41642,7 @@ Buffer.concat = function concat (list, length) { return Buffer.alloc(0) } - let i + var i if (length === undefined) { length = 0 for (i = 0; i < list.length; ++i) { @@ -40825,14 +41650,13 @@ Buffer.concat = function concat (list, length) { } } - const buffer = Buffer.allocUnsafe(length) - let pos = 0 + var buffer = Buffer.allocUnsafe(length) + var pos = 0 for (i = 0; i < list.length; ++i) { - let buf = list[i] + var 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) + Buffer.from(buf).copy(buffer, pos) } else { Uint8Array.prototype.set.call( buffer, @@ -40864,12 +41688,12 @@ function byteLength (string, encoding) { ) } - const len = string.length - const mustMatch = (arguments.length > 2 && arguments[2] === true) + var len = string.length + var mustMatch = (arguments.length > 2 && arguments[2] === true) if (!mustMatch && len === 0) return 0 // Use a for loop to avoid recursion - let loweredCase = false + var loweredCase = false for (;;) { switch (encoding) { case 'ascii': @@ -40900,7 +41724,7 @@ function byteLength (string, encoding) { Buffer.byteLength = byteLength function slowToString (encoding, start, end) { - let loweredCase = false + var loweredCase = false // No need to verify that "this.length <= MAX_UINT32" since it's a read-only // property of a typed array. @@ -40978,28 +41802,28 @@ function slowToString (encoding, start, end) { Buffer.prototype._isBuffer = true function swap (b, n, m) { - const i = b[n] + var i = b[n] b[n] = b[m] b[m] = i } Buffer.prototype.swap16 = function swap16 () { - const len = this.length + var 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) { + for (var i = 0; i < len; i += 2) { swap(this, i, i + 1) } return this } Buffer.prototype.swap32 = function swap32 () { - const len = this.length + var 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) { + for (var i = 0; i < len; i += 4) { swap(this, i, i + 3) swap(this, i + 1, i + 2) } @@ -41007,11 +41831,11 @@ Buffer.prototype.swap32 = function swap32 () { } Buffer.prototype.swap64 = function swap64 () { - const len = this.length + var 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) { + for (var i = 0; i < len; i += 8) { swap(this, i, i + 7) swap(this, i + 1, i + 6) swap(this, i + 2, i + 5) @@ -41021,7 +41845,7 @@ Buffer.prototype.swap64 = function swap64 () { } Buffer.prototype.toString = function toString () { - const length = this.length + var length = this.length if (length === 0) return '' if (arguments.length === 0) return utf8Slice(this, 0, length) return slowToString.apply(this, arguments) @@ -41036,8 +41860,8 @@ Buffer.prototype.equals = function equals (b) { } Buffer.prototype.inspect = function inspect () { - let str = '' - const max = exports.INSPECT_MAX_BYTES + var str = '' + var max = exports.INSPECT_MAX_BYTES str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() if (this.length > max) str += ' ... ' return '' @@ -41091,14 +41915,14 @@ Buffer.prototype.compare = function compare (target, start, end, thisStart, this if (this === target) return 0 - let x = thisEnd - thisStart - let y = end - start - const len = Math.min(x, y) + var x = thisEnd - thisStart + var y = end - start + var len = Math.min(x, y) - const thisCopy = this.slice(thisStart, thisEnd) - const targetCopy = target.slice(start, end) + var thisCopy = this.slice(thisStart, thisEnd) + var targetCopy = target.slice(start, end) - for (let i = 0; i < len; ++i) { + for (var i = 0; i < len; ++i) { if (thisCopy[i] !== targetCopy[i]) { x = thisCopy[i] y = targetCopy[i] @@ -41177,9 +42001,9 @@ function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { } function arrayIndexOf (arr, val, byteOffset, encoding, dir) { - let indexSize = 1 - let arrLength = arr.length - let valLength = val.length + var indexSize = 1 + var arrLength = arr.length + var valLength = val.length if (encoding !== undefined) { encoding = String(encoding).toLowerCase() @@ -41203,9 +42027,9 @@ function arrayIndexOf (arr, val, byteOffset, encoding, dir) { } } - let i + var i if (dir) { - let foundIndex = -1 + var foundIndex = -1 for (i = byteOffset; i < arrLength; i++) { if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { if (foundIndex === -1) foundIndex = i @@ -41218,8 +42042,8 @@ function arrayIndexOf (arr, val, byteOffset, encoding, dir) { } else { if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength for (i = byteOffset; i >= 0; i--) { - let found = true - for (let j = 0; j < valLength; j++) { + var found = true + for (var j = 0; j < valLength; j++) { if (read(arr, i + j) !== read(val, j)) { found = false break @@ -41246,7 +42070,7 @@ Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) function hexWrite (buf, string, offset, length) { offset = Number(offset) || 0 - const remaining = buf.length - offset + var remaining = buf.length - offset if (!length) { length = remaining } else { @@ -41256,14 +42080,13 @@ function hexWrite (buf, string, offset, length) { } } - const strLen = string.length + var 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) + for (var i = 0; i < length; ++i) { + var parsed = parseInt(string.substr(i * 2, 2), 16) if (numberIsNaN(parsed)) return i buf[offset + i] = parsed } @@ -41313,7 +42136,7 @@ Buffer.prototype.write = function write (string, offset, length, encoding) { ) } - const remaining = this.length - offset + var remaining = this.length - offset if (length === undefined || length > remaining) length = remaining if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { @@ -41322,7 +42145,7 @@ Buffer.prototype.write = function write (string, offset, length, encoding) { if (!encoding) encoding = 'utf8' - let loweredCase = false + var loweredCase = false for (;;) { switch (encoding) { case 'hex': @@ -41372,13 +42195,13 @@ function base64Slice (buf, start, end) { function utf8Slice (buf, start, end) { end = Math.min(buf.length, end) - const res = [] + var res = [] - let i = start + var i = start while (i < end) { - const firstByte = buf[i] - let codePoint = null - let bytesPerSequence = (firstByte > 0xEF) + var firstByte = buf[i] + var codePoint = null + var bytesPerSequence = (firstByte > 0xEF) ? 4 : (firstByte > 0xDF) ? 3 @@ -41387,7 +42210,7 @@ function utf8Slice (buf, start, end) { : 1 if (i + bytesPerSequence <= end) { - let secondByte, thirdByte, fourthByte, tempCodePoint + var secondByte, thirdByte, fourthByte, tempCodePoint switch (bytesPerSequence) { case 1: @@ -41449,17 +42272,17 @@ function utf8Slice (buf, start, end) { // 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 +var MAX_ARGUMENTS_LENGTH = 0x1000 function decodeCodePointsArray (codePoints) { - const len = codePoints.length + var len = codePoints.length if (len <= MAX_ARGUMENTS_LENGTH) { return String.fromCharCode.apply(String, codePoints) // avoid extra slice() } // Decode in chunks to avoid "call stack size exceeded". - let res = '' - let i = 0 + var res = '' + var i = 0 while (i < len) { res += String.fromCharCode.apply( String, @@ -41470,50 +42293,50 @@ function decodeCodePointsArray (codePoints) { } function asciiSlice (buf, start, end) { - let ret = '' + var ret = '' end = Math.min(buf.length, end) - for (let i = start; i < end; ++i) { + for (var i = start; i < end; ++i) { ret += String.fromCharCode(buf[i] & 0x7F) } return ret } function latin1Slice (buf, start, end) { - let ret = '' + var ret = '' end = Math.min(buf.length, end) - for (let i = start; i < end; ++i) { + for (var i = start; i < end; ++i) { ret += String.fromCharCode(buf[i]) } return ret } function hexSlice (buf, start, end) { - const len = buf.length + var 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) { + var out = '' + for (var i = start; i < end; ++i) { out += hexSliceLookupTable[buf[i]] } return out } function utf16leSlice (buf, start, end) { - const bytes = buf.slice(start, end) - let res = '' + var bytes = buf.slice(start, end) + var 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) { + for (var 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 + var len = this.length start = ~~start end = end === undefined ? len : ~~end @@ -41533,7 +42356,7 @@ Buffer.prototype.slice = function slice (start, end) { if (end < start) end = start - const newBuf = this.subarray(start, end) + var newBuf = this.subarray(start, end) // Return an augmented `Uint8Array` instance Object.setPrototypeOf(newBuf, Buffer.prototype) @@ -41554,9 +42377,9 @@ Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) byteLength = byteLength >>> 0 if (!noAssert) checkOffset(offset, byteLength, this.length) - let val = this[offset] - let mul = 1 - let i = 0 + var val = this[offset] + var mul = 1 + var i = 0 while (++i < byteLength && (mul *= 0x100)) { val += this[offset + i] * mul } @@ -41572,8 +42395,8 @@ Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) checkOffset(offset, byteLength, this.length) } - let val = this[offset + --byteLength] - let mul = 1 + var val = this[offset + --byteLength] + var mul = 1 while (byteLength > 0 && (mul *= 0x100)) { val += this[offset + --byteLength] * mul } @@ -41624,58 +42447,14 @@ Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { 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 + var val = this[offset] + var mul = 1 + var i = 0 while (++i < byteLength && (mul *= 0x100)) { val += this[offset + i] * mul } @@ -41691,9 +42470,9 @@ Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { byteLength = byteLength >>> 0 if (!noAssert) checkOffset(offset, byteLength, this.length) - let i = byteLength - let mul = 1 - let val = this[offset + --i] + var i = byteLength + var mul = 1 + var val = this[offset + --i] while (i > 0 && (mul *= 0x100)) { val += this[offset + --i] * mul } @@ -41714,14 +42493,14 @@ Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { 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) + var 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) + var val = this[offset + 1] | (this[offset] << 8) return (val & 0x8000) ? val | 0xFFFF0000 : val } @@ -41745,48 +42524,6 @@ Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { (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) @@ -41823,12 +42560,12 @@ Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, offset = offset >>> 0 byteLength = byteLength >>> 0 if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength) - 1 + var maxBytes = Math.pow(2, 8 * byteLength) - 1 checkInt(this, value, offset, byteLength, maxBytes, 0) } - let mul = 1 - let i = 0 + var mul = 1 + var i = 0 this[offset] = value & 0xFF while (++i < byteLength && (mul *= 0x100)) { this[offset + i] = (value / mul) & 0xFF @@ -41843,12 +42580,12 @@ Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, offset = offset >>> 0 byteLength = byteLength >>> 0 if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength) - 1 + var maxBytes = Math.pow(2, 8 * byteLength) - 1 checkInt(this, value, offset, byteLength, maxBytes, 0) } - let i = byteLength - 1 - let mul = 1 + var i = byteLength - 1 + var mul = 1 this[offset + i] = value & 0xFF while (--i >= 0 && (mul *= 0x100)) { this[offset + i] = (value / mul) & 0xFF @@ -41910,70 +42647,18 @@ Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert 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) + var limit = Math.pow(2, (8 * byteLength) - 1) checkInt(this, value, offset, byteLength, limit - 1, -limit) } - let i = 0 - let mul = 1 - let sub = 0 + var i = 0 + var mul = 1 + var sub = 0 this[offset] = value & 0xFF while (++i < byteLength && (mul *= 0x100)) { if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { @@ -41989,14 +42674,14 @@ Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, no value = +value offset = offset >>> 0 if (!noAssert) { - const limit = Math.pow(2, (8 * byteLength) - 1) + var 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 + var i = byteLength - 1 + var mul = 1 + var sub = 0 this[offset + i] = value & 0xFF while (--i >= 0 && (mul *= 0x100)) { if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { @@ -42058,14 +42743,6 @@ Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) 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') @@ -42133,7 +42810,7 @@ Buffer.prototype.copy = function copy (target, targetStart, start, end) { end = target.length - targetStart + start } - const len = end - start + var len = end - start if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { // Use built-in when available, missing from IE11 @@ -42171,7 +42848,7 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) { throw new TypeError('Unknown encoding: ' + encoding) } if (val.length === 1) { - const code = val.charCodeAt(0) + var code = val.charCodeAt(0) if ((encoding === 'utf8' && code < 128) || encoding === 'latin1') { // Fast path: If `val` fits into a single byte, use that numeric value. @@ -42198,16 +42875,16 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) { if (!val) val = 0 - let i + var i if (typeof val === 'number') { for (i = start; i < end; ++i) { this[i] = val } } else { - const bytes = Buffer.isBuffer(val) + var bytes = Buffer.isBuffer(val) ? val : Buffer.from(val, encoding) - const len = bytes.length + var len = bytes.length if (len === 0) { throw new TypeError('The value "' + val + '" is invalid for argument "value"') @@ -42220,143 +42897,10 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) { 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 +var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g function base64clean (str) { // Node takes equal signs as end of the Base64 encoding @@ -42374,12 +42918,12 @@ function base64clean (str) { function utf8ToBytes (string, units) { units = units || Infinity - let codePoint - const length = string.length - let leadSurrogate = null - const bytes = [] + var codePoint + var length = string.length + var leadSurrogate = null + var bytes = [] - for (let i = 0; i < length; ++i) { + for (var i = 0; i < length; ++i) { codePoint = string.charCodeAt(i) // is surrogate component @@ -42453,8 +42997,8 @@ function utf8ToBytes (string, units) { } function asciiToBytes (str) { - const byteArray = [] - for (let i = 0; i < str.length; ++i) { + var byteArray = [] + for (var i = 0; i < str.length; ++i) { // Node's code seems to be doing this and not & 0x7F.. byteArray.push(str.charCodeAt(i) & 0xFF) } @@ -42462,9 +43006,9 @@ function asciiToBytes (str) { } function utf16leToBytes (str, units) { - let c, hi, lo - const byteArray = [] - for (let i = 0; i < str.length; ++i) { + var c, hi, lo + var byteArray = [] + for (var i = 0; i < str.length; ++i) { if ((units -= 2) < 0) break c = str.charCodeAt(i) @@ -42482,8 +43026,7 @@ function base64ToBytes (str) { } function blitBuffer (src, dst, offset, length) { - let i - for (i = 0; i < length; ++i) { + for (var i = 0; i < length; ++i) { if ((i + offset >= dst.length) || (i >= src.length)) break dst[i + offset] = src[i] } @@ -42505,27 +43048,18 @@ function numberIsNaN (obj) { // 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) { +var hexSliceLookupTable = (function () { + var alphabet = '0123456789abcdef' + var table = new Array(256) + for (var i = 0; i < 16; ++i) { + var i16 = i * 16 + for (var 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') -} - /***/ }), @@ -42664,6 +43198,1073 @@ if ($defineProperty) { } +/***/ }), + +/***/ 90297: +/***/ ((module) => { + +"use strict"; +/* eslint quote-props: off */ + + +/** + * Names for all available hashes + * + * @typedef { "identity" | "sha1" | "sha2-256" | "sha2-512" | "sha3-512" | "sha3-384" | "sha3-256" | "sha3-224" | "shake-128" | "shake-256" | "keccak-224" | "keccak-256" | "keccak-384" | "keccak-512" | "blake3" | "murmur3-128" | "murmur3-32" | "dbl-sha2-256" | "md4" | "md5" | "bmt" | "sha2-256-trunc254-padded" | "ripemd-128" | "ripemd-160" | "ripemd-256" | "ripemd-320" | "x11" | "kangarootwelve" | "sm3-256" | "blake2b-8" | "blake2b-16" | "blake2b-24" | "blake2b-32" | "blake2b-40" | "blake2b-48" | "blake2b-56" | "blake2b-64" | "blake2b-72" | "blake2b-80" | "blake2b-88" | "blake2b-96" | "blake2b-104" | "blake2b-112" | "blake2b-120" | "blake2b-128" | "blake2b-136" | "blake2b-144" | "blake2b-152" | "blake2b-160" | "blake2b-168" | "blake2b-176" | "blake2b-184" | "blake2b-192" | "blake2b-200" | "blake2b-208" | "blake2b-216" | "blake2b-224" | "blake2b-232" | "blake2b-240" | "blake2b-248" | "blake2b-256" | "blake2b-264" | "blake2b-272" | "blake2b-280" | "blake2b-288" | "blake2b-296" | "blake2b-304" | "blake2b-312" | "blake2b-320" | "blake2b-328" | "blake2b-336" | "blake2b-344" | "blake2b-352" | "blake2b-360" | "blake2b-368" | "blake2b-376" | "blake2b-384" | "blake2b-392" | "blake2b-400" | "blake2b-408" | "blake2b-416" | "blake2b-424" | "blake2b-432" | "blake2b-440" | "blake2b-448" | "blake2b-456" | "blake2b-464" | "blake2b-472" | "blake2b-480" | "blake2b-488" | "blake2b-496" | "blake2b-504" | "blake2b-512" | "blake2s-8" | "blake2s-16" | "blake2s-24" | "blake2s-32" | "blake2s-40" | "blake2s-48" | "blake2s-56" | "blake2s-64" | "blake2s-72" | "blake2s-80" | "blake2s-88" | "blake2s-96" | "blake2s-104" | "blake2s-112" | "blake2s-120" | "blake2s-128" | "blake2s-136" | "blake2s-144" | "blake2s-152" | "blake2s-160" | "blake2s-168" | "blake2s-176" | "blake2s-184" | "blake2s-192" | "blake2s-200" | "blake2s-208" | "blake2s-216" | "blake2s-224" | "blake2s-232" | "blake2s-240" | "blake2s-248" | "blake2s-256" | "skein256-8" | "skein256-16" | "skein256-24" | "skein256-32" | "skein256-40" | "skein256-48" | "skein256-56" | "skein256-64" | "skein256-72" | "skein256-80" | "skein256-88" | "skein256-96" | "skein256-104" | "skein256-112" | "skein256-120" | "skein256-128" | "skein256-136" | "skein256-144" | "skein256-152" | "skein256-160" | "skein256-168" | "skein256-176" | "skein256-184" | "skein256-192" | "skein256-200" | "skein256-208" | "skein256-216" | "skein256-224" | "skein256-232" | "skein256-240" | "skein256-248" | "skein256-256" | "skein512-8" | "skein512-16" | "skein512-24" | "skein512-32" | "skein512-40" | "skein512-48" | "skein512-56" | "skein512-64" | "skein512-72" | "skein512-80" | "skein512-88" | "skein512-96" | "skein512-104" | "skein512-112" | "skein512-120" | "skein512-128" | "skein512-136" | "skein512-144" | "skein512-152" | "skein512-160" | "skein512-168" | "skein512-176" | "skein512-184" | "skein512-192" | "skein512-200" | "skein512-208" | "skein512-216" | "skein512-224" | "skein512-232" | "skein512-240" | "skein512-248" | "skein512-256" | "skein512-264" | "skein512-272" | "skein512-280" | "skein512-288" | "skein512-296" | "skein512-304" | "skein512-312" | "skein512-320" | "skein512-328" | "skein512-336" | "skein512-344" | "skein512-352" | "skein512-360" | "skein512-368" | "skein512-376" | "skein512-384" | "skein512-392" | "skein512-400" | "skein512-408" | "skein512-416" | "skein512-424" | "skein512-432" | "skein512-440" | "skein512-448" | "skein512-456" | "skein512-464" | "skein512-472" | "skein512-480" | "skein512-488" | "skein512-496" | "skein512-504" | "skein512-512" | "skein1024-8" | "skein1024-16" | "skein1024-24" | "skein1024-32" | "skein1024-40" | "skein1024-48" | "skein1024-56" | "skein1024-64" | "skein1024-72" | "skein1024-80" | "skein1024-88" | "skein1024-96" | "skein1024-104" | "skein1024-112" | "skein1024-120" | "skein1024-128" | "skein1024-136" | "skein1024-144" | "skein1024-152" | "skein1024-160" | "skein1024-168" | "skein1024-176" | "skein1024-184" | "skein1024-192" | "skein1024-200" | "skein1024-208" | "skein1024-216" | "skein1024-224" | "skein1024-232" | "skein1024-240" | "skein1024-248" | "skein1024-256" | "skein1024-264" | "skein1024-272" | "skein1024-280" | "skein1024-288" | "skein1024-296" | "skein1024-304" | "skein1024-312" | "skein1024-320" | "skein1024-328" | "skein1024-336" | "skein1024-344" | "skein1024-352" | "skein1024-360" | "skein1024-368" | "skein1024-376" | "skein1024-384" | "skein1024-392" | "skein1024-400" | "skein1024-408" | "skein1024-416" | "skein1024-424" | "skein1024-432" | "skein1024-440" | "skein1024-448" | "skein1024-456" | "skein1024-464" | "skein1024-472" | "skein1024-480" | "skein1024-488" | "skein1024-496" | "skein1024-504" | "skein1024-512" | "skein1024-520" | "skein1024-528" | "skein1024-536" | "skein1024-544" | "skein1024-552" | "skein1024-560" | "skein1024-568" | "skein1024-576" | "skein1024-584" | "skein1024-592" | "skein1024-600" | "skein1024-608" | "skein1024-616" | "skein1024-624" | "skein1024-632" | "skein1024-640" | "skein1024-648" | "skein1024-656" | "skein1024-664" | "skein1024-672" | "skein1024-680" | "skein1024-688" | "skein1024-696" | "skein1024-704" | "skein1024-712" | "skein1024-720" | "skein1024-728" | "skein1024-736" | "skein1024-744" | "skein1024-752" | "skein1024-760" | "skein1024-768" | "skein1024-776" | "skein1024-784" | "skein1024-792" | "skein1024-800" | "skein1024-808" | "skein1024-816" | "skein1024-824" | "skein1024-832" | "skein1024-840" | "skein1024-848" | "skein1024-856" | "skein1024-864" | "skein1024-872" | "skein1024-880" | "skein1024-888" | "skein1024-896" | "skein1024-904" | "skein1024-912" | "skein1024-920" | "skein1024-928" | "skein1024-936" | "skein1024-944" | "skein1024-952" | "skein1024-960" | "skein1024-968" | "skein1024-976" | "skein1024-984" | "skein1024-992" | "skein1024-1000" | "skein1024-1008" | "skein1024-1016" | "skein1024-1024" | "poseidon-bls12_381-a2-fc1" | "poseidon-bls12_381-a2-fc1-sc" } HashName + */ +/** + * Codes for all available hashes + * + * @typedef { 0x00 | 0x11 | 0x12 | 0x13 | 0x14 | 0x15 | 0x16 | 0x17 | 0x18 | 0x19 | 0x1a | 0x1b | 0x1c | 0x1d | 0x1e | 0x22 | 0x23 | 0x56 | 0xd4 | 0xd5 | 0xd6 | 0x1012 | 0x1052 | 0x1053 | 0x1054 | 0x1055 | 0x1100 | 0x1d01 | 0x534d | 0xb201 | 0xb202 | 0xb203 | 0xb204 | 0xb205 | 0xb206 | 0xb207 | 0xb208 | 0xb209 | 0xb20a | 0xb20b | 0xb20c | 0xb20d | 0xb20e | 0xb20f | 0xb210 | 0xb211 | 0xb212 | 0xb213 | 0xb214 | 0xb215 | 0xb216 | 0xb217 | 0xb218 | 0xb219 | 0xb21a | 0xb21b | 0xb21c | 0xb21d | 0xb21e | 0xb21f | 0xb220 | 0xb221 | 0xb222 | 0xb223 | 0xb224 | 0xb225 | 0xb226 | 0xb227 | 0xb228 | 0xb229 | 0xb22a | 0xb22b | 0xb22c | 0xb22d | 0xb22e | 0xb22f | 0xb230 | 0xb231 | 0xb232 | 0xb233 | 0xb234 | 0xb235 | 0xb236 | 0xb237 | 0xb238 | 0xb239 | 0xb23a | 0xb23b | 0xb23c | 0xb23d | 0xb23e | 0xb23f | 0xb240 | 0xb241 | 0xb242 | 0xb243 | 0xb244 | 0xb245 | 0xb246 | 0xb247 | 0xb248 | 0xb249 | 0xb24a | 0xb24b | 0xb24c | 0xb24d | 0xb24e | 0xb24f | 0xb250 | 0xb251 | 0xb252 | 0xb253 | 0xb254 | 0xb255 | 0xb256 | 0xb257 | 0xb258 | 0xb259 | 0xb25a | 0xb25b | 0xb25c | 0xb25d | 0xb25e | 0xb25f | 0xb260 | 0xb301 | 0xb302 | 0xb303 | 0xb304 | 0xb305 | 0xb306 | 0xb307 | 0xb308 | 0xb309 | 0xb30a | 0xb30b | 0xb30c | 0xb30d | 0xb30e | 0xb30f | 0xb310 | 0xb311 | 0xb312 | 0xb313 | 0xb314 | 0xb315 | 0xb316 | 0xb317 | 0xb318 | 0xb319 | 0xb31a | 0xb31b | 0xb31c | 0xb31d | 0xb31e | 0xb31f | 0xb320 | 0xb321 | 0xb322 | 0xb323 | 0xb324 | 0xb325 | 0xb326 | 0xb327 | 0xb328 | 0xb329 | 0xb32a | 0xb32b | 0xb32c | 0xb32d | 0xb32e | 0xb32f | 0xb330 | 0xb331 | 0xb332 | 0xb333 | 0xb334 | 0xb335 | 0xb336 | 0xb337 | 0xb338 | 0xb339 | 0xb33a | 0xb33b | 0xb33c | 0xb33d | 0xb33e | 0xb33f | 0xb340 | 0xb341 | 0xb342 | 0xb343 | 0xb344 | 0xb345 | 0xb346 | 0xb347 | 0xb348 | 0xb349 | 0xb34a | 0xb34b | 0xb34c | 0xb34d | 0xb34e | 0xb34f | 0xb350 | 0xb351 | 0xb352 | 0xb353 | 0xb354 | 0xb355 | 0xb356 | 0xb357 | 0xb358 | 0xb359 | 0xb35a | 0xb35b | 0xb35c | 0xb35d | 0xb35e | 0xb35f | 0xb360 | 0xb361 | 0xb362 | 0xb363 | 0xb364 | 0xb365 | 0xb366 | 0xb367 | 0xb368 | 0xb369 | 0xb36a | 0xb36b | 0xb36c | 0xb36d | 0xb36e | 0xb36f | 0xb370 | 0xb371 | 0xb372 | 0xb373 | 0xb374 | 0xb375 | 0xb376 | 0xb377 | 0xb378 | 0xb379 | 0xb37a | 0xb37b | 0xb37c | 0xb37d | 0xb37e | 0xb37f | 0xb380 | 0xb381 | 0xb382 | 0xb383 | 0xb384 | 0xb385 | 0xb386 | 0xb387 | 0xb388 | 0xb389 | 0xb38a | 0xb38b | 0xb38c | 0xb38d | 0xb38e | 0xb38f | 0xb390 | 0xb391 | 0xb392 | 0xb393 | 0xb394 | 0xb395 | 0xb396 | 0xb397 | 0xb398 | 0xb399 | 0xb39a | 0xb39b | 0xb39c | 0xb39d | 0xb39e | 0xb39f | 0xb3a0 | 0xb3a1 | 0xb3a2 | 0xb3a3 | 0xb3a4 | 0xb3a5 | 0xb3a6 | 0xb3a7 | 0xb3a8 | 0xb3a9 | 0xb3aa | 0xb3ab | 0xb3ac | 0xb3ad | 0xb3ae | 0xb3af | 0xb3b0 | 0xb3b1 | 0xb3b2 | 0xb3b3 | 0xb3b4 | 0xb3b5 | 0xb3b6 | 0xb3b7 | 0xb3b8 | 0xb3b9 | 0xb3ba | 0xb3bb | 0xb3bc | 0xb3bd | 0xb3be | 0xb3bf | 0xb3c0 | 0xb3c1 | 0xb3c2 | 0xb3c3 | 0xb3c4 | 0xb3c5 | 0xb3c6 | 0xb3c7 | 0xb3c8 | 0xb3c9 | 0xb3ca | 0xb3cb | 0xb3cc | 0xb3cd | 0xb3ce | 0xb3cf | 0xb3d0 | 0xb3d1 | 0xb3d2 | 0xb3d3 | 0xb3d4 | 0xb3d5 | 0xb3d6 | 0xb3d7 | 0xb3d8 | 0xb3d9 | 0xb3da | 0xb3db | 0xb3dc | 0xb3dd | 0xb3de | 0xb3df | 0xb3e0 | 0xb401 | 0xb402 } HashCode + */ + +/** + * @type { Record } + */ +const names = Object.freeze({ + 'identity': 0x00, + 'sha1': 0x11, + 'sha2-256': 0x12, + 'sha2-512': 0x13, + 'sha3-512': 0x14, + 'sha3-384': 0x15, + 'sha3-256': 0x16, + 'sha3-224': 0x17, + 'shake-128': 0x18, + 'shake-256': 0x19, + 'keccak-224': 0x1a, + 'keccak-256': 0x1b, + 'keccak-384': 0x1c, + 'keccak-512': 0x1d, + 'blake3': 0x1e, + 'murmur3-128': 0x22, + 'murmur3-32': 0x23, + 'dbl-sha2-256': 0x56, + 'md4': 0xd4, + 'md5': 0xd5, + 'bmt': 0xd6, + 'sha2-256-trunc254-padded': 0x1012, + 'ripemd-128': 0x1052, + 'ripemd-160': 0x1053, + 'ripemd-256': 0x1054, + 'ripemd-320': 0x1055, + 'x11': 0x1100, + 'kangarootwelve': 0x1d01, + 'sm3-256': 0x534d, + 'blake2b-8': 0xb201, + 'blake2b-16': 0xb202, + 'blake2b-24': 0xb203, + 'blake2b-32': 0xb204, + 'blake2b-40': 0xb205, + 'blake2b-48': 0xb206, + 'blake2b-56': 0xb207, + 'blake2b-64': 0xb208, + 'blake2b-72': 0xb209, + 'blake2b-80': 0xb20a, + 'blake2b-88': 0xb20b, + 'blake2b-96': 0xb20c, + 'blake2b-104': 0xb20d, + 'blake2b-112': 0xb20e, + 'blake2b-120': 0xb20f, + 'blake2b-128': 0xb210, + 'blake2b-136': 0xb211, + 'blake2b-144': 0xb212, + 'blake2b-152': 0xb213, + 'blake2b-160': 0xb214, + 'blake2b-168': 0xb215, + 'blake2b-176': 0xb216, + 'blake2b-184': 0xb217, + 'blake2b-192': 0xb218, + 'blake2b-200': 0xb219, + 'blake2b-208': 0xb21a, + 'blake2b-216': 0xb21b, + 'blake2b-224': 0xb21c, + 'blake2b-232': 0xb21d, + 'blake2b-240': 0xb21e, + 'blake2b-248': 0xb21f, + 'blake2b-256': 0xb220, + 'blake2b-264': 0xb221, + 'blake2b-272': 0xb222, + 'blake2b-280': 0xb223, + 'blake2b-288': 0xb224, + 'blake2b-296': 0xb225, + 'blake2b-304': 0xb226, + 'blake2b-312': 0xb227, + 'blake2b-320': 0xb228, + 'blake2b-328': 0xb229, + 'blake2b-336': 0xb22a, + 'blake2b-344': 0xb22b, + 'blake2b-352': 0xb22c, + 'blake2b-360': 0xb22d, + 'blake2b-368': 0xb22e, + 'blake2b-376': 0xb22f, + 'blake2b-384': 0xb230, + 'blake2b-392': 0xb231, + 'blake2b-400': 0xb232, + 'blake2b-408': 0xb233, + 'blake2b-416': 0xb234, + 'blake2b-424': 0xb235, + 'blake2b-432': 0xb236, + 'blake2b-440': 0xb237, + 'blake2b-448': 0xb238, + 'blake2b-456': 0xb239, + 'blake2b-464': 0xb23a, + 'blake2b-472': 0xb23b, + 'blake2b-480': 0xb23c, + 'blake2b-488': 0xb23d, + 'blake2b-496': 0xb23e, + 'blake2b-504': 0xb23f, + 'blake2b-512': 0xb240, + 'blake2s-8': 0xb241, + 'blake2s-16': 0xb242, + 'blake2s-24': 0xb243, + 'blake2s-32': 0xb244, + 'blake2s-40': 0xb245, + 'blake2s-48': 0xb246, + 'blake2s-56': 0xb247, + 'blake2s-64': 0xb248, + 'blake2s-72': 0xb249, + 'blake2s-80': 0xb24a, + 'blake2s-88': 0xb24b, + 'blake2s-96': 0xb24c, + 'blake2s-104': 0xb24d, + 'blake2s-112': 0xb24e, + 'blake2s-120': 0xb24f, + 'blake2s-128': 0xb250, + 'blake2s-136': 0xb251, + 'blake2s-144': 0xb252, + 'blake2s-152': 0xb253, + 'blake2s-160': 0xb254, + 'blake2s-168': 0xb255, + 'blake2s-176': 0xb256, + 'blake2s-184': 0xb257, + 'blake2s-192': 0xb258, + 'blake2s-200': 0xb259, + 'blake2s-208': 0xb25a, + 'blake2s-216': 0xb25b, + 'blake2s-224': 0xb25c, + 'blake2s-232': 0xb25d, + 'blake2s-240': 0xb25e, + 'blake2s-248': 0xb25f, + 'blake2s-256': 0xb260, + 'skein256-8': 0xb301, + 'skein256-16': 0xb302, + 'skein256-24': 0xb303, + 'skein256-32': 0xb304, + 'skein256-40': 0xb305, + 'skein256-48': 0xb306, + 'skein256-56': 0xb307, + 'skein256-64': 0xb308, + 'skein256-72': 0xb309, + 'skein256-80': 0xb30a, + 'skein256-88': 0xb30b, + 'skein256-96': 0xb30c, + 'skein256-104': 0xb30d, + 'skein256-112': 0xb30e, + 'skein256-120': 0xb30f, + 'skein256-128': 0xb310, + 'skein256-136': 0xb311, + 'skein256-144': 0xb312, + 'skein256-152': 0xb313, + 'skein256-160': 0xb314, + 'skein256-168': 0xb315, + 'skein256-176': 0xb316, + 'skein256-184': 0xb317, + 'skein256-192': 0xb318, + 'skein256-200': 0xb319, + 'skein256-208': 0xb31a, + 'skein256-216': 0xb31b, + 'skein256-224': 0xb31c, + 'skein256-232': 0xb31d, + 'skein256-240': 0xb31e, + 'skein256-248': 0xb31f, + 'skein256-256': 0xb320, + 'skein512-8': 0xb321, + 'skein512-16': 0xb322, + 'skein512-24': 0xb323, + 'skein512-32': 0xb324, + 'skein512-40': 0xb325, + 'skein512-48': 0xb326, + 'skein512-56': 0xb327, + 'skein512-64': 0xb328, + 'skein512-72': 0xb329, + 'skein512-80': 0xb32a, + 'skein512-88': 0xb32b, + 'skein512-96': 0xb32c, + 'skein512-104': 0xb32d, + 'skein512-112': 0xb32e, + 'skein512-120': 0xb32f, + 'skein512-128': 0xb330, + 'skein512-136': 0xb331, + 'skein512-144': 0xb332, + 'skein512-152': 0xb333, + 'skein512-160': 0xb334, + 'skein512-168': 0xb335, + 'skein512-176': 0xb336, + 'skein512-184': 0xb337, + 'skein512-192': 0xb338, + 'skein512-200': 0xb339, + 'skein512-208': 0xb33a, + 'skein512-216': 0xb33b, + 'skein512-224': 0xb33c, + 'skein512-232': 0xb33d, + 'skein512-240': 0xb33e, + 'skein512-248': 0xb33f, + 'skein512-256': 0xb340, + 'skein512-264': 0xb341, + 'skein512-272': 0xb342, + 'skein512-280': 0xb343, + 'skein512-288': 0xb344, + 'skein512-296': 0xb345, + 'skein512-304': 0xb346, + 'skein512-312': 0xb347, + 'skein512-320': 0xb348, + 'skein512-328': 0xb349, + 'skein512-336': 0xb34a, + 'skein512-344': 0xb34b, + 'skein512-352': 0xb34c, + 'skein512-360': 0xb34d, + 'skein512-368': 0xb34e, + 'skein512-376': 0xb34f, + 'skein512-384': 0xb350, + 'skein512-392': 0xb351, + 'skein512-400': 0xb352, + 'skein512-408': 0xb353, + 'skein512-416': 0xb354, + 'skein512-424': 0xb355, + 'skein512-432': 0xb356, + 'skein512-440': 0xb357, + 'skein512-448': 0xb358, + 'skein512-456': 0xb359, + 'skein512-464': 0xb35a, + 'skein512-472': 0xb35b, + 'skein512-480': 0xb35c, + 'skein512-488': 0xb35d, + 'skein512-496': 0xb35e, + 'skein512-504': 0xb35f, + 'skein512-512': 0xb360, + 'skein1024-8': 0xb361, + 'skein1024-16': 0xb362, + 'skein1024-24': 0xb363, + 'skein1024-32': 0xb364, + 'skein1024-40': 0xb365, + 'skein1024-48': 0xb366, + 'skein1024-56': 0xb367, + 'skein1024-64': 0xb368, + 'skein1024-72': 0xb369, + 'skein1024-80': 0xb36a, + 'skein1024-88': 0xb36b, + 'skein1024-96': 0xb36c, + 'skein1024-104': 0xb36d, + 'skein1024-112': 0xb36e, + 'skein1024-120': 0xb36f, + 'skein1024-128': 0xb370, + 'skein1024-136': 0xb371, + 'skein1024-144': 0xb372, + 'skein1024-152': 0xb373, + 'skein1024-160': 0xb374, + 'skein1024-168': 0xb375, + 'skein1024-176': 0xb376, + 'skein1024-184': 0xb377, + 'skein1024-192': 0xb378, + 'skein1024-200': 0xb379, + 'skein1024-208': 0xb37a, + 'skein1024-216': 0xb37b, + 'skein1024-224': 0xb37c, + 'skein1024-232': 0xb37d, + 'skein1024-240': 0xb37e, + 'skein1024-248': 0xb37f, + 'skein1024-256': 0xb380, + 'skein1024-264': 0xb381, + 'skein1024-272': 0xb382, + 'skein1024-280': 0xb383, + 'skein1024-288': 0xb384, + 'skein1024-296': 0xb385, + 'skein1024-304': 0xb386, + 'skein1024-312': 0xb387, + 'skein1024-320': 0xb388, + 'skein1024-328': 0xb389, + 'skein1024-336': 0xb38a, + 'skein1024-344': 0xb38b, + 'skein1024-352': 0xb38c, + 'skein1024-360': 0xb38d, + 'skein1024-368': 0xb38e, + 'skein1024-376': 0xb38f, + 'skein1024-384': 0xb390, + 'skein1024-392': 0xb391, + 'skein1024-400': 0xb392, + 'skein1024-408': 0xb393, + 'skein1024-416': 0xb394, + 'skein1024-424': 0xb395, + 'skein1024-432': 0xb396, + 'skein1024-440': 0xb397, + 'skein1024-448': 0xb398, + 'skein1024-456': 0xb399, + 'skein1024-464': 0xb39a, + 'skein1024-472': 0xb39b, + 'skein1024-480': 0xb39c, + 'skein1024-488': 0xb39d, + 'skein1024-496': 0xb39e, + 'skein1024-504': 0xb39f, + 'skein1024-512': 0xb3a0, + 'skein1024-520': 0xb3a1, + 'skein1024-528': 0xb3a2, + 'skein1024-536': 0xb3a3, + 'skein1024-544': 0xb3a4, + 'skein1024-552': 0xb3a5, + 'skein1024-560': 0xb3a6, + 'skein1024-568': 0xb3a7, + 'skein1024-576': 0xb3a8, + 'skein1024-584': 0xb3a9, + 'skein1024-592': 0xb3aa, + 'skein1024-600': 0xb3ab, + 'skein1024-608': 0xb3ac, + 'skein1024-616': 0xb3ad, + 'skein1024-624': 0xb3ae, + 'skein1024-632': 0xb3af, + 'skein1024-640': 0xb3b0, + 'skein1024-648': 0xb3b1, + 'skein1024-656': 0xb3b2, + 'skein1024-664': 0xb3b3, + 'skein1024-672': 0xb3b4, + 'skein1024-680': 0xb3b5, + 'skein1024-688': 0xb3b6, + 'skein1024-696': 0xb3b7, + 'skein1024-704': 0xb3b8, + 'skein1024-712': 0xb3b9, + 'skein1024-720': 0xb3ba, + 'skein1024-728': 0xb3bb, + 'skein1024-736': 0xb3bc, + 'skein1024-744': 0xb3bd, + 'skein1024-752': 0xb3be, + 'skein1024-760': 0xb3bf, + 'skein1024-768': 0xb3c0, + 'skein1024-776': 0xb3c1, + 'skein1024-784': 0xb3c2, + 'skein1024-792': 0xb3c3, + 'skein1024-800': 0xb3c4, + 'skein1024-808': 0xb3c5, + 'skein1024-816': 0xb3c6, + 'skein1024-824': 0xb3c7, + 'skein1024-832': 0xb3c8, + 'skein1024-840': 0xb3c9, + 'skein1024-848': 0xb3ca, + 'skein1024-856': 0xb3cb, + 'skein1024-864': 0xb3cc, + 'skein1024-872': 0xb3cd, + 'skein1024-880': 0xb3ce, + 'skein1024-888': 0xb3cf, + 'skein1024-896': 0xb3d0, + 'skein1024-904': 0xb3d1, + 'skein1024-912': 0xb3d2, + 'skein1024-920': 0xb3d3, + 'skein1024-928': 0xb3d4, + 'skein1024-936': 0xb3d5, + 'skein1024-944': 0xb3d6, + 'skein1024-952': 0xb3d7, + 'skein1024-960': 0xb3d8, + 'skein1024-968': 0xb3d9, + 'skein1024-976': 0xb3da, + 'skein1024-984': 0xb3db, + 'skein1024-992': 0xb3dc, + 'skein1024-1000': 0xb3dd, + 'skein1024-1008': 0xb3de, + 'skein1024-1016': 0xb3df, + 'skein1024-1024': 0xb3e0, + 'poseidon-bls12_381-a2-fc1': 0xb401, + 'poseidon-bls12_381-a2-fc1-sc': 0xb402 +}) + +module.exports = { names } + + +/***/ }), + +/***/ 17684: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/** + * Multihash implementation in JavaScript. + */ + + +const multibase = __webpack_require__(91466) +const varint = __webpack_require__(61203) +const { names } = __webpack_require__(90297) +const { toString: uint8ArrayToString } = __webpack_require__(27302) +const { fromString: uint8ArrayFromString } = __webpack_require__(44117) +const { concat: uint8ArrayConcat } = __webpack_require__(75007) + +const codes = /** @type {import('./types').CodeNameMap} */({}) + +// eslint-disable-next-line guard-for-in +for (const key in names) { + const name = /** @type {HashName} */(key) + codes[names[name]] = name +} +Object.freeze(codes) + +/** + * Convert the given multihash to a hex encoded string. + * + * @param {Uint8Array} hash + * @returns {string} + */ +function toHexString (hash) { + if (!(hash instanceof Uint8Array)) { + throw new Error('must be passed a Uint8Array') + } + + return uint8ArrayToString(hash, 'base16') +} + +/** + * Convert the given hex encoded string to a multihash. + * + * @param {string} hash + * @returns {Uint8Array} + */ +function fromHexString (hash) { + return uint8ArrayFromString(hash, 'base16') +} + +/** + * Convert the given multihash to a base58 encoded string. + * + * @param {Uint8Array} hash + * @returns {string} + */ +function toB58String (hash) { + if (!(hash instanceof Uint8Array)) { + throw new Error('must be passed a Uint8Array') + } + + return uint8ArrayToString(multibase.encode('base58btc', hash)).slice(1) +} + +/** + * Convert the given base58 encoded string to a multihash. + * + * @param {string|Uint8Array} hash + * @returns {Uint8Array} + */ +function fromB58String (hash) { + const encoded = hash instanceof Uint8Array + ? uint8ArrayToString(hash) + : hash + + return multibase.decode('z' + encoded) +} + +/** + * Decode a hash from the given multihash. + * + * @param {Uint8Array} bytes + * @returns {{code: HashCode, name: HashName, length: number, digest: Uint8Array}} result + */ +function decode (bytes) { + if (!(bytes instanceof Uint8Array)) { + throw new Error('multihash must be a Uint8Array') + } + + if (bytes.length < 2) { + throw new Error('multihash too short. must be > 2 bytes.') + } + + const code = /** @type {HashCode} */(varint.decode(bytes)) + if (!isValidCode(code)) { + throw new Error(`multihash unknown function code: 0x${code.toString(16)}`) + } + bytes = bytes.slice(varint.decode.bytes) + + const len = varint.decode(bytes) + if (len < 0) { + throw new Error(`multihash invalid length: ${len}`) + } + bytes = bytes.slice(varint.decode.bytes) + + if (bytes.length !== len) { + throw new Error(`multihash length inconsistent: 0x${uint8ArrayToString(bytes, 'base16')}`) + } + + return { + code, + name: codes[code], + length: len, + digest: bytes + } +} + +/** + * Encode a hash digest along with the specified function code. + * + * > **Note:** the length is derived from the length of the digest itself. + * + * @param {Uint8Array} digest + * @param {HashName | HashCode} code + * @param {number} [length] + * @returns {Uint8Array} + */ +function encode (digest, code, length) { + if (!digest || code === undefined) { + throw new Error('multihash encode requires at least two args: digest, code') + } + + // ensure it's a hashfunction code. + const hashfn = coerceCode(code) + + if (!(digest instanceof Uint8Array)) { + throw new Error('digest should be a Uint8Array') + } + + if (length == null) { + length = digest.length + } + + if (length && digest.length !== length) { + throw new Error('digest length should be equal to specified length.') + } + + const hash = varint.encode(hashfn) + const len = varint.encode(length) + return uint8ArrayConcat([hash, len, digest], hash.length + len.length + digest.length) +} + +/** + * Converts a hash function name into the matching code. + * If passed a number it will return the number if it's a valid code. + * + * @param {HashName | number} name + * @returns {number} + */ +function coerceCode (name) { + let code = name + + if (typeof name === 'string') { + if (names[name] === undefined) { + throw new Error(`Unrecognized hash function named: ${name}`) + } + code = names[name] + } + + if (typeof code !== 'number') { + throw new Error(`Hash function code should be a number. Got: ${code}`) + } + + // @ts-ignore + if (codes[code] === undefined && !isAppCode(code)) { + throw new Error(`Unrecognized function code: ${code}`) + } + + return code +} + +/** + * Checks if a code is part of the app range + * + * @param {number} code + * @returns {boolean} + */ +function isAppCode (code) { + return code > 0 && code < 0x10 +} + +/** + * Checks whether a multihash code is valid. + * + * @param {HashCode} code + * @returns {boolean} + */ +function isValidCode (code) { + if (isAppCode(code)) { + return true + } + + if (codes[code]) { + return true + } + + return false +} + +/** + * Check if the given buffer is a valid multihash. Throws an error if it is not valid. + * + * @param {Uint8Array} multihash + * @returns {void} + * @throws {Error} + */ +function validate (multihash) { + decode(multihash) // throws if bad. +} + +/** + * Returns a prefix from a valid multihash. Throws an error if it is not valid. + * + * @param {Uint8Array} multihash + * @returns {Uint8Array} + * @throws {Error} + */ +function prefix (multihash) { + validate(multihash) + + return multihash.subarray(0, 2) +} + +module.exports = { + names, + codes, + toHexString, + fromHexString, + toB58String, + fromB58String, + decode, + encode, + coerceCode, + isAppCode, + validate, + prefix, + isValidCode +} + +/** + * @typedef { import("./constants").HashCode } HashCode + * @typedef { import("./constants").HashName } HashName + */ + + +/***/ }), + +/***/ 64378: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const mh = __webpack_require__(17684) + +const CIDUtil = { + /** + * Test if the given input is a valid CID object. + * Returns an error message if it is not. + * Returns undefined if it is a valid CID. + * + * @param {any} other + * @returns {string|undefined} + */ + checkCIDComponents: function (other) { + if (other == null) { + return 'null values are not valid CIDs' + } + + if (!(other.version === 0 || other.version === 1)) { + return 'Invalid version, must be a number equal to 1 or 0' + } + + if (typeof other.codec !== 'string') { + return 'codec must be string' + } + + if (other.version === 0) { + if (other.codec !== 'dag-pb') { + return "codec must be 'dag-pb' for CIDv0" + } + if (other.multibaseName !== 'base58btc') { + return "multibaseName must be 'base58btc' for CIDv0" + } + } + + if (!(other.multihash instanceof Uint8Array)) { + return 'multihash must be a Uint8Array' + } + + try { + mh.validate(other.multihash) + } catch (err) { + let errorMsg = err.message + if (!errorMsg) { // Just in case mh.validate() throws an error with empty error message + errorMsg = 'Multihash validation failed' + } + return errorMsg + } + } +} + +module.exports = CIDUtil + + +/***/ }), + +/***/ 26613: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const mh = __webpack_require__(17684) +const multibase = __webpack_require__(91466) +const multicodec = __webpack_require__(52021) +const CIDUtil = __webpack_require__(64378) +const { concat: uint8ArrayConcat } = __webpack_require__(75007) +const { toString: uint8ArrayToString } = __webpack_require__(27302) +const { equals: uint8ArrayEquals } = __webpack_require__(18402) + +const codecs = multicodec.nameToCode +const codecInts = /** @type {CodecName[]} */(Object.keys(codecs)).reduce((p, name) => { + p[codecs[name]] = name + return p +}, /** @type {Record} */({})) + +const symbol = Symbol.for('@ipld/js-cid/CID') + +/** + * @typedef {Object} SerializedCID + * @property {string} codec + * @property {number} version + * @property {Uint8Array} hash + */ +/** + * @typedef {0|1} CIDVersion + * @typedef {import('multibase').BaseNameOrCode} BaseNameOrCode + * @typedef {import('multicodec').CodecName} CodecName + * @typedef {import('multicodec').CodecCode} CodecCode + */ + +/** + * Class representing a CID `` + * , as defined in [ipld/cid](https://github.com/multiformats/cid). + * + * @class CID + */ +class CID { + /** + * Create a new CID. + * + * The algorithm for argument input is roughly: + * ``` + * if (cid) + * -> create a copy + * else if (str) + * if (1st char is on multibase table) -> CID String + * else -> bs58 encoded multihash + * else if (Uint8Array) + * if (1st byte is 0 or 1) -> CID + * else -> multihash + * else if (Number) + * -> construct CID by parts + * ``` + * + * @param {CIDVersion | string | Uint8Array | CID} version + * @param {string|number} [codec] + * @param {Uint8Array} [multihash] + * @param {string} [multibaseName] + * + * @example + * new CID(, , , ) + * new CID() + * new CID() + * new CID() + * new CID() + * new CID() + */ + constructor (version, codec, multihash, multibaseName) { + // We have below three blank field accessors only because + // otherwise TS will not pick them up if done after assignemnts + + /** + * The version of the CID. + * + * @type {CIDVersion} + */ + // eslint-disable-next-line no-unused-expressions + this.version + + /** + * The codec of the CID. + * + * @deprecated + * @type {CodecName} + */ + // eslint-disable-next-line no-unused-expressions + this.codec + + /** + * The multihash of the CID. + * + * @type {Uint8Array} + */ + // eslint-disable-next-line no-unused-expressions + this.multihash + + Object.defineProperty(this, symbol, { value: true }) + if (CID.isCID(version)) { + // version is an exising CID instance + const cid = /** @type {CID} */(version) + this.version = cid.version + this.codec = cid.codec + this.multihash = cid.multihash + // Default guard for when a CID < 0.7 is passed with no multibaseName + // @ts-ignore + this.multibaseName = cid.multibaseName || (cid.version === 0 ? 'base58btc' : 'base32') + return + } + + if (typeof version === 'string') { + // e.g. 'base32' or false + const baseName = multibase.isEncoded(version) + if (baseName) { + // version is a CID String encoded with multibase, so v1 + const cid = multibase.decode(version) + this.version = /** @type {CIDVersion} */(parseInt(cid[0].toString(), 16)) + this.codec = multicodec.getCodec(cid.slice(1)) + this.multihash = multicodec.rmPrefix(cid.slice(1)) + this.multibaseName = baseName + } else { + // version is a base58btc string multihash, so v0 + this.version = 0 + this.codec = 'dag-pb' + this.multihash = mh.fromB58String(version) + this.multibaseName = 'base58btc' + } + CID.validateCID(this) + Object.defineProperty(this, 'string', { value: version }) + return + } + + if (version instanceof Uint8Array) { + const v = parseInt(version[0].toString(), 16) + if (v === 1) { + // version is a CID Uint8Array + const cid = version + this.version = v + this.codec = multicodec.getCodec(cid.slice(1)) + this.multihash = multicodec.rmPrefix(cid.slice(1)) + this.multibaseName = 'base32' + } else { + // version is a raw multihash Uint8Array, so v0 + this.version = 0 + this.codec = 'dag-pb' + this.multihash = version + this.multibaseName = 'base58btc' + } + CID.validateCID(this) + return + } + + // otherwise, assemble the CID from the parameters + + this.version = version + + if (typeof codec === 'number') { + // @ts-ignore + codec = codecInts[codec] + } + + this.codec = /** @type {CodecName} */ (codec) + + this.multihash = /** @type {Uint8Array} */ (multihash) + + /** + * Multibase name as string. + * + * @deprecated + * @type {string} + */ + this.multibaseName = multibaseName || (version === 0 ? 'base58btc' : 'base32') + + CID.validateCID(this) + } + + /** + * The CID as a `Uint8Array` + * + * @returns {Uint8Array} + * + */ + get bytes () { + // @ts-ignore + let bytes = this._bytes + + if (!bytes) { + if (this.version === 0) { + bytes = this.multihash + } else if (this.version === 1) { + const codec = multicodec.getCodeVarint(this.codec) + bytes = uint8ArrayConcat([ + [1], codec, this.multihash + ], 1 + codec.byteLength + this.multihash.byteLength) + } else { + throw new Error('unsupported version') + } + + // Cache this Uint8Array so it doesn't have to be recreated + Object.defineProperty(this, '_bytes', { value: bytes }) + } + + return bytes + } + + /** + * The prefix of the CID. + * + * @returns {Uint8Array} + */ + get prefix () { + const codec = multicodec.getCodeVarint(this.codec) + const multihash = mh.prefix(this.multihash) + const prefix = uint8ArrayConcat([ + [this.version], codec, multihash + ], 1 + codec.byteLength + multihash.byteLength) + + return prefix + } + + /** + * The codec of the CID in its number form. + * + * @returns {CodecCode} + */ + get code () { + return codecs[this.codec] + } + + /** + * Convert to a CID of version `0`. + * + * @returns {CID} + */ + toV0 () { + if (this.codec !== 'dag-pb') { + throw new Error('Cannot convert a non dag-pb CID to CIDv0') + } + + const { name, length } = mh.decode(this.multihash) + + if (name !== 'sha2-256') { + throw new Error('Cannot convert non sha2-256 multihash CID to CIDv0') + } + + if (length !== 32) { + throw new Error('Cannot convert non 32 byte multihash CID to CIDv0') + } + + return new CID(0, this.codec, this.multihash) + } + + /** + * Convert to a CID of version `1`. + * + * @returns {CID} + */ + toV1 () { + return new CID(1, this.codec, this.multihash, this.multibaseName) + } + + /** + * Encode the CID into a string. + * + * @param {BaseNameOrCode} [base=this.multibaseName] - Base encoding to use. + * @returns {string} + */ + toBaseEncodedString (base = this.multibaseName) { + // @ts-ignore non enumerable cache property + if (this.string && this.string.length !== 0 && base === this.multibaseName) { + // @ts-ignore non enumerable cache property + return this.string + } + let str + if (this.version === 0) { + if (base !== 'base58btc') { + throw new Error('not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()') + } + str = mh.toB58String(this.multihash) + } else if (this.version === 1) { + str = uint8ArrayToString(multibase.encode(base, this.bytes)) + } else { + throw new Error('unsupported version') + } + if (base === this.multibaseName) { + // cache the string value + Object.defineProperty(this, 'string', { value: str }) + } + return str + } + + /** + * CID(QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n) + * + * @returns {string} + */ + [Symbol.for('nodejs.util.inspect.custom')] () { + return 'CID(' + this.toString() + ')' + } + + /** + * Encode the CID into a string. + * + * @param {BaseNameOrCode} [base=this.multibaseName] - Base encoding to use. + * @returns {string} + */ + toString (base) { + return this.toBaseEncodedString(base) + } + + /** + * Serialize to a plain object. + * + * @returns {SerializedCID} + */ + toJSON () { + return { + codec: this.codec, + version: this.version, + hash: this.multihash + } + } + + /** + * Compare equality with another CID. + * + * @param {CID} other + * @returns {boolean} + */ + equals (other) { + return this.codec === other.codec && + this.version === other.version && + uint8ArrayEquals(this.multihash, other.multihash) + } + + /** + * Test if the given input is a valid CID object. + * Throws if it is not. + * + * @param {any} other - The other CID. + * @returns {void} + */ + static validateCID (other) { + const errorMsg = CIDUtil.checkCIDComponents(other) + if (errorMsg) { + throw new Error(errorMsg) + } + } + + /** + * Check if object is a CID instance + * + * @param {any} value + * @returns {value is CID} + */ + static isCID (value) { + return value instanceof CID || Boolean(value && value[symbol]) + } +} + +CID.codecs = codecs + +module.exports = CID + + /***/ }), /***/ 56168: @@ -42770,100 +44371,6 @@ CipherBase.prototype._toString = function (value, enc, fin) { module.exports = CipherBase -/***/ }), - -/***/ 96763: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/*global window, global*/ -var util = __webpack_require__(40537) -var assert = __webpack_require__(94148) -function now() { return new Date().getTime() } - -var slice = Array.prototype.slice -var console -var times = {} - -if (typeof __webpack_require__.g !== "undefined" && __webpack_require__.g.console) { - console = __webpack_require__.g.console -} else if (typeof window !== "undefined" && window.console) { - console = window.console -} else { - console = {} -} - -var functions = [ - [log, "log"], - [info, "info"], - [warn, "warn"], - [error, "error"], - [time, "time"], - [timeEnd, "timeEnd"], - [trace, "trace"], - [dir, "dir"], - [consoleAssert, "assert"] -] - -for (var i = 0; i < functions.length; i++) { - var tuple = functions[i] - var f = tuple[0] - var name = tuple[1] - - if (!console[name]) { - console[name] = f - } -} - -module.exports = console - -function log() {} - -function info() { - console.log.apply(console, arguments) -} - -function warn() { - console.log.apply(console, arguments) -} - -function error() { - console.warn.apply(console, arguments) -} - -function time(label) { - times[label] = now() -} - -function timeEnd(label) { - var time = times[label] - if (!time) { - throw new Error("No such label: " + label) - } - - delete times[label] - var duration = now() - time - console.log(label + ": " + duration + "ms") -} - -function trace() { - var err = new Error() - err.name = "Trace" - err.message = util.format.apply(null, arguments) - console.error(err.stack) -} - -function dir(object) { - console.log(util.inspect(object) + "\n") -} - -function consoleAssert(expression) { - if (!expression) { - var arr = slice.call(arguments, 1) - assert.ok(false, util.format.apply(null, arr)) - } -} - - /***/ }), /***/ 15622: @@ -42983,7 +44490,7 @@ function objectToString(o) { /***/ 61324: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; var elliptic = __webpack_require__(86729) var BN = __webpack_require__(92801) @@ -47502,8 +49009,6 @@ exports.constants = { /***/ 17833: /***/ ((module, exports, __webpack_require__) => { -/* provided dependency */ var console = __webpack_require__(96763); -/* provided dependency */ var process = __webpack_require__(65606); /* eslint-env browser */ /** @@ -47631,6 +49136,8 @@ function useColors() { return false; } + let m; + // 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) || @@ -47638,7 +49145,7 @@ function useColors() { (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) || + (typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[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+)/)); } @@ -47780,7 +49287,6 @@ formatters.j = function (v) { /***/ 40736: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var console = __webpack_require__(96763); /** * This is the common logic for both the Node.js and web browser @@ -48903,7 +50409,7 @@ exports.padSplit = function padSplit(num, size, group) { /***/ 15380: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; var generatePrime = __webpack_require__(4934) var primes = __webpack_require__(23241) @@ -48953,7 +50459,7 @@ exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman /***/ 14910: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; var BN = __webpack_require__(66473); var MillerRabin = __webpack_require__(52244); var millerRabin = new MillerRabin(); @@ -55327,6 +56833,10 @@ function getLength(buf, p) { return false; } + if(buf[p.place] === 0x00) { + return false; + } + var val = 0; for (var i = 0, off = p.place; i < octetLen; i++, off++) { val <<= 8; @@ -55375,6 +56885,9 @@ Signature.prototype._importDER = function _importDER(data, enc) { if (rlen === false) { return false; } + if ((data[p.place] & 128) !== 0) { + return false; + } var r = data.slice(p.place, rlen + p.place); p.place += rlen; if (data[p.place++] !== 0x02) { @@ -55387,6 +56900,9 @@ Signature.prototype._importDER = function _importDER(data, enc) { if (data.length !== slen + p.place) { return false; } + if ((data[p.place] & 128) !== 0) { + return false; + } var s = data.slice(p.place, slen + p.place); if (r[0] === 0) { if (r[1] & 0x80) { @@ -55515,6 +57031,9 @@ EDDSA.prototype.sign = function sign(message, secret) { EDDSA.prototype.verify = function verify(message, sig, pub) { message = parseBytes(message); sig = this.makeSignature(sig); + if (sig.S().gte(sig.eddsa.curve.n) || sig.S().isNeg()) { + return false; + } var key = this.keyFromPublic(pub); var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message); var SG = this.g.mul(sig.S()); @@ -55713,6 +57232,7 @@ function Signature(eddsa, sig) { sig = parseBytes(sig); if (Array.isArray(sig)) { + assert(sig.length === eddsa.encodingLength * 2, 'Signature has invalid size'); sig = { R: sig.slice(0, eddsa.encodingLength), S: sig.slice(eddsa.encodingLength), @@ -60245,32 +61765,127 @@ module.exports = URIError; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ AF: () => (/* binding */ BatchTransactionService), /* harmony export */ B3: () => (/* binding */ BatchBlockService), -/* harmony export */ JY: () => (/* binding */ BatchEventsService) +/* harmony export */ JY: () => (/* binding */ BatchEventsService), +/* harmony export */ QL: () => (/* binding */ multiQueryFilter), +/* harmony export */ vS: () => (/* binding */ getSubInfo) /* harmony export */ }); +/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(36212); +/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(57339); +/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(24359); +/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(43948); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67418); -var __async = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; + +function isDeferred(value) { + return value && typeof value === "object" && "getTopicFilter" in value && typeof value.getTopicFilter === "function" && value.fragment; +} +async function getSubInfo(abiInterface, event) { + let topics; + let fragment = null; + if (Array.isArray(event)) { + const topicHashify = function(name) { + if ((0,ethers__WEBPACK_IMPORTED_MODULE_1__/* .isHexString */ .Lo)(name, 32)) { + return name; + } + const fragment2 = abiInterface.getEvent(name); + (0,ethers__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(fragment2, "unknown fragment", "name", name); + return fragment2.topicHash; + }; + topics = event.map((e) => { + if (e == null) { + return null; + } + if (Array.isArray(e)) { + return e.map(topicHashify); + } + return topicHashify(e); + }); + } else if (event === "*") { + topics = [null]; + } else if (typeof event === "string") { + if ((0,ethers__WEBPACK_IMPORTED_MODULE_1__/* .isHexString */ .Lo)(event, 32)) { + topics = [event]; + } else { + fragment = abiInterface.getEvent(event); + (0,ethers__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(fragment, "unknown fragment", "event", event); + topics = [fragment.topicHash]; + } + } else if (isDeferred(event)) { + topics = await event.getTopicFilter(); + } else if ("fragment" in event) { + fragment = event.fragment; + topics = [fragment.topicHash]; + } else { + (0,ethers__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(false, "unknown event name", "event", event); + } + topics = topics.map((t) => { + if (t == null) { + return null; + } + if (Array.isArray(t)) { + const items = Array.from(new Set(t.map((t2) => t2.toLowerCase())).values()); + if (items.length === 1) { + return items[0]; + } + items.sort(); + return items; + } + return t.toLowerCase(); + }); + const tag = topics.map((t) => { + if (t == null) { + return "null"; + } + if (Array.isArray(t)) { + return t.join("|"); + } + return t; + }).join("&"); + return { fragment, tag, topics }; +} +async function multiQueryFilter(address, contract, event, fromBlock, toBlock) { + if (fromBlock == null) { + fromBlock = 0; + } + if (toBlock == null) { + toBlock = "latest"; + } + const { fragment, topics } = await getSubInfo(contract.interface, event); + const filter = { + address: address === "*" ? void 0 : address, + topics, + fromBlock, + toBlock + }; + const provider = contract.runner; + (0,ethers__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .vA)(provider, "contract runner does not have a provider", "UNSUPPORTED_OPERATION", { operation: "queryFilter" }); + return (await provider.getLogs(filter)).map((log) => { + let foundFragment = fragment; + if (foundFragment == null) { + try { + foundFragment = contract.interface.getEvent(log.topics[0]); + } catch { + } + } + if (foundFragment) { + try { + return new ethers__WEBPACK_IMPORTED_MODULE_3__/* .EventLog */ .vu(log, contract.interface, foundFragment); + } catch (error) { + return new ethers__WEBPACK_IMPORTED_MODULE_3__/* .UndecodedEventLog */ .AA(log, error); + } + } + return new ethers__WEBPACK_IMPORTED_MODULE_4__/* .Log */ .tG(log, provider); + }); +} class BatchBlockService { + provider; + onProgress; + concurrencySize; + batchSize; + shouldRetry; + retryMax; + retryOn; constructor({ provider, onProgress, @@ -60288,56 +61903,59 @@ class BatchBlockService { this.retryMax = retryMax; this.retryOn = retryOn; } - getBlock(blockTag) { - return __async(this, null, function* () { - const blockObject = yield this.provider.getBlock(blockTag); - if (!blockObject) { - const errMsg = `No block for ${blockTag}`; - throw new Error(errMsg); - } - return blockObject; - }); + async getBlock(blockTag) { + const blockObject = await this.provider.getBlock(blockTag); + if (!blockObject) { + const errMsg = `No block for ${blockTag}`; + throw new Error(errMsg); + } + return blockObject; } createBatchRequest(batchArray) { - return batchArray.map((blocks, index) => __async(this, null, function* () { - yield (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .sleep */ .yy)(20 * index); - return (() => __async(this, null, function* () { + return batchArray.map(async (blocks, index) => { + await (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .sleep */ .yy)(40 * index); + return (async () => { let retries = 0; let err; while (!this.shouldRetry && retries === 0 || this.shouldRetry && retries < this.retryMax) { try { - return yield Promise.all(blocks.map((b) => this.getBlock(b))); + return await Promise.all(blocks.map((b) => this.getBlock(b))); } catch (e) { retries++; err = e; - yield (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .sleep */ .yy)(this.retryOn); + await (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .sleep */ .yy)(this.retryOn); } } throw err; - }))(); - })); - } - getBatchBlocks(blocks) { - return __async(this, null, function* () { - let blockCount = 0; - const results = []; - for (const chunks of (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .chunk */ .iv)(blocks, this.concurrencySize * this.batchSize)) { - const chunksResult = (yield Promise.all(this.createBatchRequest((0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .chunk */ .iv)(chunks, this.batchSize)))).flat(); - results.push(...chunksResult); - blockCount += chunks.length; - if (typeof this.onProgress === "function") { - this.onProgress({ - percentage: blockCount / blocks.length, - currentIndex: blockCount, - totalIndex: blocks.length - }); - } - } - return results; + })(); }); } + async getBatchBlocks(blocks) { + let blockCount = 0; + const results = []; + for (const chunks of (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .chunk */ .iv)(blocks, this.concurrencySize * this.batchSize)) { + const chunksResult = (await Promise.all(this.createBatchRequest((0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .chunk */ .iv)(chunks, this.batchSize)))).flat(); + results.push(...chunksResult); + blockCount += chunks.length; + if (typeof this.onProgress === "function") { + this.onProgress({ + percentage: blockCount / blocks.length, + currentIndex: blockCount, + totalIndex: blocks.length + }); + } + } + return results; + } } class BatchTransactionService { + provider; + onProgress; + concurrencySize; + batchSize; + shouldRetry; + retryMax; + retryOn; constructor({ provider, onProgress, @@ -60355,64 +61973,104 @@ class BatchTransactionService { this.retryMax = retryMax; this.retryOn = retryOn; } - getTransaction(txHash) { - return __async(this, null, function* () { - const txObject = yield this.provider.getTransaction(txHash); - if (!txObject) { - const errMsg = `No transaction for ${txHash}`; - throw new Error(errMsg); - } - return txObject; - }); + async getTransaction(txHash) { + const txObject = await this.provider.getTransaction(txHash); + if (!txObject) { + const errMsg = `No transaction for ${txHash}`; + throw new Error(errMsg); + } + return txObject; } - createBatchRequest(batchArray) { - return batchArray.map((txs, index) => __async(this, null, function* () { - yield (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .sleep */ .yy)(20 * index); - return (() => __async(this, null, function* () { + async getTransactionReceipt(txHash) { + const txObject = await this.provider.getTransactionReceipt(txHash); + if (!txObject) { + const errMsg = `No transaction receipt for ${txHash}`; + throw new Error(errMsg); + } + return txObject; + } + createBatchRequest(batchArray, receipt) { + return batchArray.map(async (txs, index) => { + await (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .sleep */ .yy)(40 * index); + return (async () => { let retries = 0; let err; while (!this.shouldRetry && retries === 0 || this.shouldRetry && retries < this.retryMax) { try { - return yield Promise.all(txs.map((tx) => this.getTransaction(tx))); + if (!receipt) { + return await Promise.all(txs.map((tx) => this.getTransaction(tx))); + } else { + return await Promise.all(txs.map((tx) => this.getTransactionReceipt(tx))); + } } catch (e) { retries++; err = e; - yield (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .sleep */ .yy)(this.retryOn); + await (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .sleep */ .yy)(this.retryOn); } } throw err; - }))(); - })); - } - getBatchTransactions(txs) { - return __async(this, null, function* () { - let txCount = 0; - const results = []; - for (const chunks of (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .chunk */ .iv)(txs, this.concurrencySize * this.batchSize)) { - const chunksResult = (yield Promise.all(this.createBatchRequest((0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .chunk */ .iv)(chunks, this.batchSize)))).flat(); - results.push(...chunksResult); - txCount += chunks.length; - if (typeof this.onProgress === "function") { - this.onProgress({ percentage: txCount / txs.length, currentIndex: txCount, totalIndex: txs.length }); - } - } - return results; + })(); }); } + async getBatchTransactions(txs) { + let txCount = 0; + const results = []; + for (const chunks of (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .chunk */ .iv)(txs, this.concurrencySize * this.batchSize)) { + const chunksResult = (await Promise.all(this.createBatchRequest((0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .chunk */ .iv)(chunks, this.batchSize)))).flat(); + results.push(...chunksResult); + txCount += chunks.length; + if (typeof this.onProgress === "function") { + this.onProgress({ + percentage: txCount / txs.length, + currentIndex: txCount, + totalIndex: txs.length + }); + } + } + return results; + } + async getBatchReceipt(txs) { + let txCount = 0; + const results = []; + for (const chunks of (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .chunk */ .iv)(txs, this.concurrencySize * this.batchSize)) { + const chunksResult = (await Promise.all(this.createBatchRequest((0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .chunk */ .iv)(chunks, this.batchSize), true))).flat(); + results.push(...chunksResult); + txCount += chunks.length; + if (typeof this.onProgress === "function") { + this.onProgress({ + percentage: txCount / txs.length, + currentIndex: txCount, + totalIndex: txs.length + }); + } + } + return results; + } } class BatchEventsService { + provider; + contract; + address; + onProgress; + concurrencySize; + blocksPerRequest; + shouldRetry; + retryMax; + retryOn; constructor({ provider, contract, + address, onProgress, concurrencySize = 10, - blocksPerRequest = 2e3, + blocksPerRequest = 5e3, shouldRetry = true, retryMax = 5, retryOn = 500 }) { this.provider = provider; this.contract = contract; + this.address = address; this.onProgress = onProgress; this.concurrencySize = concurrencySize; this.blocksPerRequest = blocksPerRequest; @@ -60420,62 +62078,67 @@ class BatchEventsService { this.retryMax = retryMax; this.retryOn = retryOn; } - getPastEvents(_0) { - return __async(this, arguments, function* ({ fromBlock, toBlock, type }) { - let err; - let retries = 0; - while (!this.shouldRetry && retries === 0 || this.shouldRetry && retries < this.retryMax) { - try { - return yield this.contract.queryFilter(type, fromBlock, toBlock); - } catch (e) { - err = e; - retries++; - if (e.message.includes("after last accepted block")) { - const acceptedBlock = parseInt(e.message.split("after last accepted block ")[1]); - toBlock = acceptedBlock; - } - yield (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .sleep */ .yy)(this.retryOn); + async getPastEvents({ fromBlock, toBlock, type }) { + let err; + let retries = 0; + while (!this.shouldRetry && retries === 0 || this.shouldRetry && retries < this.retryMax) { + try { + if (this.address) { + return await multiQueryFilter( + this.address, + this.contract, + type, + fromBlock, + toBlock + ); } + return await this.contract.queryFilter(type, fromBlock, toBlock); + } catch (e) { + err = e; + retries++; + if (e.message.includes("after last accepted block")) { + const acceptedBlock = parseInt(e.message.split("after last accepted block ")[1]); + toBlock = acceptedBlock; + } + await (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .sleep */ .yy)(this.retryOn); } - throw err; - }); + } + throw err; } createBatchRequest(batchArray) { - return batchArray.map((event, index) => __async(this, null, function* () { - yield (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .sleep */ .yy)(20 * index); + return batchArray.map(async (event, index) => { + await (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .sleep */ .yy)(10 * index); return this.getPastEvents(event); - })); - } - getBatchEvents(_0) { - return __async(this, arguments, function* ({ fromBlock, toBlock, type = "*" }) { - if (!toBlock) { - toBlock = yield this.provider.getBlockNumber(); - } - const eventsToSync = []; - for (let i = fromBlock; i < toBlock; i += this.blocksPerRequest) { - const j = i + this.blocksPerRequest - 1 > toBlock ? toBlock : i + this.blocksPerRequest - 1; - eventsToSync.push({ fromBlock: i, toBlock: j, type }); - } - const events = []; - const eventChunk = (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .chunk */ .iv)(eventsToSync, this.concurrencySize); - let chunkCount = 0; - for (const chunk2 of eventChunk) { - chunkCount++; - const fetchedEvents = (yield Promise.all(this.createBatchRequest(chunk2))).flat(); - events.push(...fetchedEvents); - if (typeof this.onProgress === "function") { - this.onProgress({ - percentage: chunkCount / eventChunk.length, - type, - fromBlock: chunk2[0].fromBlock, - toBlock: chunk2[chunk2.length - 1].toBlock, - count: fetchedEvents.length - }); - } - } - return events; }); } + async getBatchEvents({ fromBlock, toBlock, type = "*" }) { + if (!toBlock) { + toBlock = await this.provider.getBlockNumber(); + } + const eventsToSync = []; + for (let i = fromBlock; i < toBlock; i += this.blocksPerRequest) { + const j = i + this.blocksPerRequest - 1 > toBlock ? toBlock : i + this.blocksPerRequest - 1; + eventsToSync.push({ fromBlock: i, toBlock: j, type }); + } + const events = []; + const eventChunk = (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .chunk */ .iv)(eventsToSync, this.concurrencySize); + let chunkCount = 0; + for (const chunk2 of eventChunk) { + chunkCount++; + const fetchedEvents = (await Promise.all(this.createBatchRequest(chunk2))).flat(); + events.push(...fetchedEvents); + if (typeof this.onProgress === "function") { + this.onProgress({ + percentage: chunkCount / eventChunk.length, + type, + fromBlock: chunk2[0].fromBlock, + toBlock: chunk2[chunk2.length - 1].toBlock, + count: fetchedEvents.length + }); + } + } + return events; + } } @@ -60487,53 +62150,73 @@ class BatchEventsService { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ Hr: () => (/* binding */ createDeposit), +/* harmony export */ Ps: () => (/* binding */ parseInvoice), /* harmony export */ dA: () => (/* binding */ Deposit), -/* harmony export */ qO: () => (/* binding */ Invoice) +/* harmony export */ qO: () => (/* binding */ Invoice), +/* harmony export */ wd: () => (/* binding */ parseNote) /* harmony export */ }); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67418); /* harmony import */ var _pedersen__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(85111); -var __async = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; -function createDeposit(_0) { - return __async(this, arguments, function* ({ nullifier, secret }) { - const preimage = new Uint8Array([...(0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .leInt2Buff */ .EI)(nullifier), ...(0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .leInt2Buff */ .EI)(secret)]); - const noteHex = (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .toFixedHex */ .$W)((0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .bytesToBN */ .Ju)(preimage), 62); - const commitment = BigInt(yield (0,_pedersen__WEBPACK_IMPORTED_MODULE_1__/* .buffPedersenHash */ .UB)(preimage)); - const commitmentHex = (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .toFixedHex */ .$W)(commitment); - const nullifierHash = BigInt(yield (0,_pedersen__WEBPACK_IMPORTED_MODULE_1__/* .buffPedersenHash */ .UB)((0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .leInt2Buff */ .EI)(nullifier))); - const nullifierHex = (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .toFixedHex */ .$W)(nullifierHash); - return { - preimage, - noteHex, - commitment, - commitmentHex, - nullifierHash, - nullifierHex - }; - }); +function parseNote(noteString) { + const noteRegex = /tornado-(?\w+)-(?[\d.]+)-(?\d+)-0x(?[0-9a-fA-F]{124})/g; + const match = noteRegex.exec(noteString); + if (!match) { + return; + } + const { currency, amount, netId, noteHex } = match.groups; + return { + currency: currency.toLowerCase(), + amount, + netId: Number(netId), + noteHex: "0x" + noteHex, + note: noteString + }; +} +function parseInvoice(invoiceString) { + const invoiceRegex = /tornadoInvoice-(?\w+)-(?[\d.]+)-(?\d+)-0x(?[0-9a-fA-F]{64})/g; + const match = invoiceRegex.exec(invoiceString); + if (!match) { + return; + } + const { currency, amount, netId, commitmentHex } = match.groups; + return { + currency: currency.toLowerCase(), + amount, + netId: Number(netId), + commitmentHex: "0x" + commitmentHex, + invoice: invoiceString + }; +} +async function createDeposit({ nullifier, secret }) { + const preimage = new Uint8Array([...(0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .leInt2Buff */ .EI)(nullifier), ...(0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .leInt2Buff */ .EI)(secret)]); + const noteHex = (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .toFixedHex */ .$W)((0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .bytesToBN */ .Ju)(preimage), 62); + const commitment = BigInt(await (0,_pedersen__WEBPACK_IMPORTED_MODULE_1__/* .buffPedersenHash */ .UB)(preimage)); + const commitmentHex = (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .toFixedHex */ .$W)(commitment); + const nullifierHash = BigInt(await (0,_pedersen__WEBPACK_IMPORTED_MODULE_1__/* .buffPedersenHash */ .UB)((0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .leInt2Buff */ .EI)(nullifier))); + const nullifierHex = (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .toFixedHex */ .$W)(nullifierHash); + return { + preimage, + noteHex, + commitment, + commitmentHex, + nullifierHash, + nullifierHex + }; } class Deposit { + currency; + amount; + netId; + nullifier; + secret; + note; + noteHex; + invoice; + commitmentHex; + nullifierHex; constructor({ currency, amount, @@ -60575,81 +62258,77 @@ class Deposit { 2 ); } - static createNote(_0) { - return __async(this, arguments, function* ({ currency, amount, netId, nullifier, secret }) { - if (!nullifier) { - nullifier = (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .rBigInt */ .ib)(31); - } - if (!secret) { - secret = (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .rBigInt */ .ib)(31); - } - const depositObject = yield createDeposit({ - nullifier, - secret - }); - const newDeposit = new Deposit({ - currency: currency.toLowerCase(), - amount, - netId, - note: `tornado-${currency.toLowerCase()}-${amount}-${netId}-${depositObject.noteHex}`, - noteHex: depositObject.noteHex, - invoice: `tornadoInvoice-${currency.toLowerCase()}-${amount}-${netId}-${depositObject.commitmentHex}`, - nullifier, - secret, - commitmentHex: depositObject.commitmentHex, - nullifierHex: depositObject.nullifierHex - }); - return newDeposit; + static async createNote({ currency, amount, netId, nullifier, secret }) { + if (!nullifier) { + nullifier = (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .rBigInt */ .ib)(31); + } + if (!secret) { + secret = (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .rBigInt */ .ib)(31); + } + const depositObject = await createDeposit({ + nullifier, + secret }); + const newDeposit = new Deposit({ + currency: currency.toLowerCase(), + amount, + netId, + note: `tornado-${currency.toLowerCase()}-${amount}-${netId}-${depositObject.noteHex}`, + noteHex: depositObject.noteHex, + invoice: `tornadoInvoice-${currency.toLowerCase()}-${amount}-${netId}-${depositObject.commitmentHex}`, + nullifier, + secret, + commitmentHex: depositObject.commitmentHex, + nullifierHex: depositObject.nullifierHex + }); + return newDeposit; } - static parseNote(noteString) { - return __async(this, null, function* () { - const noteRegex = new RegExp("tornado-(?\\w+)-(?[\\d.]+)-(?\\d+)-0x(?[0-9a-fA-F]{124})", "g"); - const match = noteRegex.exec(noteString); - if (!match) { - throw new Error("The note has invalid format"); - } - const matchGroup = match == null ? void 0 : match.groups; - const currency = matchGroup.currency.toLowerCase(); - const amount = matchGroup.amount; - const netId = Number(matchGroup.netId); - const bytes = (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .bnToBytes */ .jm)("0x" + matchGroup.note); - const nullifier = BigInt((0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .leBuff2Int */ .ae)(bytes.slice(0, 31)).toString()); - const secret = BigInt((0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .leBuff2Int */ .ae)(bytes.slice(31, 62)).toString()); - const depositObject = yield createDeposit({ nullifier, secret }); - const invoice = `tornadoInvoice-${currency}-${amount}-${netId}-${depositObject.commitmentHex}`; - const newDeposit = new Deposit({ - currency, - amount, - netId, - note: noteString, - noteHex: depositObject.noteHex, - invoice, - nullifier, - secret, - commitmentHex: depositObject.commitmentHex, - nullifierHex: depositObject.nullifierHex - }); - return newDeposit; + static async parseNote(noteString) { + const parsedNote = parseNote(noteString); + if (!parsedNote) { + throw new Error("The note has invalid format"); + } + const { currency, amount, netId, note, noteHex: parsedNoteHex } = parsedNote; + const bytes = (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .bnToBytes */ .jm)(parsedNoteHex); + const nullifier = BigInt((0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .leBuff2Int */ .ae)(bytes.slice(0, 31)).toString()); + const secret = BigInt((0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .leBuff2Int */ .ae)(bytes.slice(31, 62)).toString()); + const { noteHex, commitmentHex, nullifierHex } = await createDeposit({ + nullifier, + secret }); + const invoice = `tornadoInvoice-${currency}-${amount}-${netId}-${commitmentHex}`; + const newDeposit = new Deposit({ + currency, + amount, + netId, + note, + noteHex, + invoice, + nullifier, + secret, + commitmentHex, + nullifierHex + }); + return newDeposit; } } class Invoice { + currency; + amount; + netId; + commitmentHex; + invoice; constructor(invoiceString) { - const invoiceRegex = new RegExp("tornadoInvoice-(?\\w+)-(?[\\d.]+)-(?\\d+)-0x(?[0-9a-fA-F]{64})", "g"); - const match = invoiceRegex.exec(invoiceString); - if (!match) { - throw new Error("The note has invalid format"); + const parsedInvoice = parseInvoice(invoiceString); + if (!parsedInvoice) { + throw new Error("The invoice has invalid format"); } - const matchGroup = match == null ? void 0 : match.groups; - const currency = matchGroup.currency.toLowerCase(); - const amount = matchGroup.amount; - const netId = Number(matchGroup.netId); + const { currency, amount, netId, invoice, commitmentHex } = parsedInvoice; this.currency = currency; this.amount = amount; this.netId = netId; - this.commitment = "0x" + matchGroup.commitment; - this.invoice = invoiceString; + this.commitmentHex = commitmentHex; + this.invoice = invoice; } toString() { return JSON.stringify( @@ -60657,7 +62336,7 @@ class Invoice { currency: this.currency, amount: this.amount, netId: this.netId, - commitment: this.commitment, + commitmentHex: this.commitmentHex, invoice: this.invoice }, null, @@ -60708,27 +62387,37 @@ function unpackEncryptedMessage(encryptedMessage) { }; } class NoteAccount { - constructor({ netId, blockNumber, recoveryKey, Echoer: Echoer2 }) { + blockNumber; + // Dedicated 32 bytes private key only used for note encryption, backed up to an Echoer and local for future derivation + // Note that unlike the private key it shouldn't have the 0x prefix + recoveryKey; + // Address derived from recoveryKey, only used for frontend UI + recoveryAddress; + // Note encryption public key derived from recoveryKey + recoveryPublicKey; + constructor({ blockNumber, recoveryKey }) { if (!recoveryKey) { - recoveryKey = (0,_utils__WEBPACK_IMPORTED_MODULE_1__/* .bytesToHex */ .My)(_utils__WEBPACK_IMPORTED_MODULE_1__/* .crypto */ .Et.getRandomValues(new Uint8Array(32))).slice(2); + recoveryKey = (0,_utils__WEBPACK_IMPORTED_MODULE_1__/* .rHex */ .G9)(32).slice(2); } - this.netId = Math.floor(Number(netId)); this.blockNumber = blockNumber; this.recoveryKey = recoveryKey; this.recoveryAddress = (0,ethers__WEBPACK_IMPORTED_MODULE_2__/* .computeAddress */ .K)("0x" + recoveryKey); this.recoveryPublicKey = (0,_metamask_eth_sig_util__WEBPACK_IMPORTED_MODULE_0__.getEncryptionPublicKey)(recoveryKey); - this.Echoer = Echoer2; } /** * Intends to mock eth_getEncryptionPublicKey behavior from MetaMask * In order to make the recoveryKey retrival from Echoer possible from the bare private key */ - static getWalletPublicKey(wallet) { - let { privateKey } = wallet; - if (privateKey.startsWith("0x")) { - privateKey = privateKey.replace("0x", ""); + static async getSignerPublicKey(signer) { + if (signer.privateKey) { + const wallet = signer; + const privateKey = wallet.privateKey.slice(0, 2) === "0x" ? wallet.privateKey.slice(2) : wallet.privateKey; + return (0,_metamask_eth_sig_util__WEBPACK_IMPORTED_MODULE_0__.getEncryptionPublicKey)(privateKey); } - return (0,_metamask_eth_sig_util__WEBPACK_IMPORTED_MODULE_0__.getEncryptionPublicKey)(privateKey); + const provider = signer.provider; + return await provider.send("eth_getEncryptionPublicKey", [ + signer.address + ]); } // This function intends to provide an encrypted value of recoveryKey for an on-chain Echoer backup purpose // Thus, the pubKey should be derived by a Wallet instance or from Web3 wallets @@ -60752,28 +62441,45 @@ class NoteAccount { /** * Decrypt Echoer backuped note encryption account with private keys */ - decryptAccountsWithWallet(wallet, events) { - let { privateKey } = wallet; - if (privateKey.startsWith("0x")) { - privateKey = privateKey.replace("0x", ""); - } + static async decryptSignerNoteAccounts(signer, events) { + const signerAddress = signer.address; const decryptedEvents = []; for (const event of events) { + if (event.address !== signerAddress) { + continue; + } try { const unpackedMessage = unpackEncryptedMessage(event.encryptedAccount); - const recoveryKey = (0,_metamask_eth_sig_util__WEBPACK_IMPORTED_MODULE_0__.decrypt)({ - encryptedData: unpackedMessage, - privateKey - }); + let recoveryKey; + if (signer.privateKey) { + const wallet = signer; + const privateKey = wallet.privateKey.slice(0, 2) === "0x" ? wallet.privateKey.slice(2) : wallet.privateKey; + recoveryKey = (0,_metamask_eth_sig_util__WEBPACK_IMPORTED_MODULE_0__.decrypt)({ + encryptedData: unpackedMessage, + privateKey + }); + } else { + const { version, nonce, ephemPublicKey, ciphertext } = unpackedMessage; + const unpackedBuffer = (0,_utils__WEBPACK_IMPORTED_MODULE_1__/* .bytesToHex */ .My)( + new TextEncoder().encode( + JSON.stringify({ + version, + nonce, + ephemPublicKey, + ciphertext + }) + ) + ); + const provider = signer.provider; + recoveryKey = await provider.send("eth_decrypt", [unpackedBuffer, signerAddress]); + } decryptedEvents.push( new NoteAccount({ - netId: this.netId, blockNumber: event.blockNumber, - recoveryKey, - Echoer: this.Echoer + recoveryKey }) ); - } catch (e) { + } catch { continue; } } @@ -60793,7 +62499,7 @@ class NoteAccount { address: (0,ethers__WEBPACK_IMPORTED_MODULE_3__/* .getAddress */ .b)(address), noteHex }); - } catch (e) { + } catch { continue; } } @@ -60812,96 +62518,29688 @@ class NoteAccount { /***/ }), -/***/ 71304: +/***/ 16795: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ GS: () => (/* binding */ BaseEchoService), -/* harmony export */ JJ: () => (/* binding */ BaseGovernanceService), -/* harmony export */ Lx: () => (/* binding */ DEPOSIT), -/* harmony export */ O_: () => (/* binding */ BaseEncryptedNotesService), -/* harmony export */ cE: () => (/* binding */ BaseRegistryService), -/* harmony export */ e0: () => (/* binding */ BaseTornadoService), -/* harmony export */ oW: () => (/* binding */ WITHDRAWAL), -/* harmony export */ uw: () => (/* binding */ BaseEventsService) +/* harmony export */ A6: () => (/* binding */ EnsContracts), +/* harmony export */ Lr: () => (/* binding */ labelhash), +/* harmony export */ QP: () => (/* binding */ makeLabelNodeAndParent), +/* harmony export */ gH: () => (/* binding */ ENSUtils), +/* harmony export */ qX: () => (/* binding */ encodedLabelToLabelhash) /* harmony export */ }); -/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(30031); -/* harmony import */ var _graphql__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52049); -/* harmony import */ var _batch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9723); -/* provided dependency */ var console = __webpack_require__(96763); +/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2011); +/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(64563); +/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(97876); +/* harmony import */ var _typechain__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(62463); +/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67418); +/* harmony import */ var _networkConfig__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(59499); -var __defProp = Object.defineProperty; -var __defProps = Object.defineProperties; -var __getOwnPropDescs = Object.getOwnPropertyDescriptors; -var __getOwnPropSymbols = Object.getOwnPropertySymbols; -var __getProtoOf = Object.getPrototypeOf; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __propIsEnum = Object.prototype.propertyIsEnumerable; -var __reflectGet = Reflect.get; -var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __spreadValues = (a, b) => { - for (var prop in b || (b = {})) - if (__hasOwnProp.call(b, prop)) - __defNormalProp(a, prop, b[prop]); - if (__getOwnPropSymbols) - for (var prop of __getOwnPropSymbols(b)) { - if (__propIsEnum.call(b, prop)) - __defNormalProp(a, prop, b[prop]); + + + + +function encodedLabelToLabelhash(label) { + if (label.length !== 66) return null; + if (label.indexOf("[") !== 0) return null; + if (label.indexOf("]") !== 65) return null; + const hash = `0x${label.slice(1, 65)}`; + if (!(0,_utils__WEBPACK_IMPORTED_MODULE_1__/* .isHex */ .qv)(hash)) return null; + return hash; +} +function labelhash(label) { + if (!label) { + return (0,_utils__WEBPACK_IMPORTED_MODULE_1__/* .bytesToHex */ .My)(new Uint8Array(32).fill(0)); + } + return encodedLabelToLabelhash(label) || (0,ethers__WEBPACK_IMPORTED_MODULE_3__/* .keccak256 */ .S)(new TextEncoder().encode(label)); +} +function makeLabelNodeAndParent(name) { + const labels = name.split("."); + const label = labels.shift(); + const parentNode = (0,ethers__WEBPACK_IMPORTED_MODULE_4__/* .namehash */ .kM)(labels.join(".")); + return { + label, + labelhash: labelhash(label), + parentNode + }; +} +const EnsContracts = { + [_networkConfig__WEBPACK_IMPORTED_MODULE_2__/* .NetId */ .zr.MAINNET]: { + ensRegistry: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + ensPublicResolver: "0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63", + ensNameWrapper: "0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401" + }, + [_networkConfig__WEBPACK_IMPORTED_MODULE_2__/* .NetId */ .zr.SEPOLIA]: { + ensRegistry: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + ensPublicResolver: "0x8FADE66B79cC9f707aB26799354482EB93a5B7dD", + ensNameWrapper: "0x0635513f179D50A207757E05759CbD106d7dFcE8" + } +}; +class ENSUtils { + ENSRegistry; + ENSResolver; + ENSNameWrapper; + provider; + constructor(provider) { + this.provider = provider; + } + async getContracts() { + const { chainId } = await this.provider.getNetwork(); + const { ensRegistry, ensPublicResolver, ensNameWrapper } = EnsContracts[Number(chainId)]; + this.ENSRegistry = _typechain__WEBPACK_IMPORTED_MODULE_0__/* .ENSRegistry__factory */ .S4.connect(ensRegistry, this.provider); + this.ENSResolver = _typechain__WEBPACK_IMPORTED_MODULE_0__/* .ENSResolver__factory */ .BB.connect(ensPublicResolver, this.provider); + this.ENSNameWrapper = _typechain__WEBPACK_IMPORTED_MODULE_0__/* .ENSNameWrapper__factory */ .rZ.connect(ensNameWrapper, this.provider); + } + async getOwner(name) { + if (!this.ENSRegistry) { + await this.getContracts(); } - return a; -}; -var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); -var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj); -var __async = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); + return this.ENSRegistry.owner((0,ethers__WEBPACK_IMPORTED_MODULE_4__/* .namehash */ .kM)(name)); + } + // nameWrapper connected with wallet signer + async unwrap(signer, name) { + if (!this.ENSNameWrapper) { + await this.getContracts(); + } + const owner = signer.address; + const nameWrapper = this.ENSNameWrapper.connect(signer); + const { labelhash: labelhash2 } = makeLabelNodeAndParent(name); + return nameWrapper.unwrapETH2LD(labelhash2, owner, owner); + } + // https://github.com/ensdomains/ensjs/blob/main/packages/ensjs/src/functions/wallet/createSubname.ts + async setSubnodeRecord(signer, name) { + if (!this.ENSResolver) { + await this.getContracts(); + } + const resolver = this.ENSResolver; + const registry = this.ENSRegistry.connect(signer); + const owner = signer.address; + const { labelhash: labelhash2, parentNode } = makeLabelNodeAndParent(name); + return registry.setSubnodeRecord(parentNode, labelhash2, owner, resolver.target, BigInt(0)); + } + getResolver(name) { + return ethers__WEBPACK_IMPORTED_MODULE_5__/* .EnsResolver */ .Pz.fromName(this.provider, name); + } + async getText(name, key) { + const resolver = await this.getResolver(name); + if (!resolver) { + return resolver; + } + return await resolver.getText(key) || ""; + } + // https://github.com/ensdomains/ensjs/blob/main/packages/ensjs/src/functions/wallet/setTextRecord.ts + async setText(signer, name, key, value) { + const resolver = _typechain__WEBPACK_IMPORTED_MODULE_0__/* .ENSResolver__factory */ .BB.connect((await this.getResolver(name))?.address, signer); + return resolver.setText((0,ethers__WEBPACK_IMPORTED_MODULE_4__/* .namehash */ .kM)(name), key, value); + } +} + + +/***/ }), + +/***/ 96221: +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; + +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + GS: () => (/* binding */ BaseEchoService), + O_: () => (/* binding */ BaseEncryptedNotesService), + uw: () => (/* binding */ BaseEventsService), + JJ: () => (/* binding */ BaseGovernanceService), + lG: () => (/* binding */ BaseMultiTornadoService), + cE: () => (/* binding */ BaseRegistryService), + Do: () => (/* binding */ BaseRevenueService), + e0: () => (/* binding */ BaseTornadoService), + EU: () => (/* binding */ getTovarishNetworks), + sf: () => (/* binding */ proposalState) +}); + +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/address/address.js +var address = __webpack_require__(30031); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/abi/abi-coder.js + 10 modules +var abi_coder = __webpack_require__(35273); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/data.js +var utils_data = __webpack_require__(36212); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/units.js + 1 modules +var units = __webpack_require__(99770); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/hash/namehash.js + 1 modules +var namehash = __webpack_require__(64563); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/abi/interface.js +var abi_interface = __webpack_require__(73622); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/contract/contract.js +var contract = __webpack_require__(13269); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/address/contract-address.js +var contract_address = __webpack_require__(7040); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/properties.js +var properties = __webpack_require__(88081); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/errors.js +var errors = __webpack_require__(57339); +;// ./node_modules/ethers/lib.esm/contract/factory.js + + + + +// A = Arguments to the constructor +// I = Interface of deployed contracts +/** + * A **ContractFactory** is used to deploy a Contract to the blockchain. + */ +class ContractFactory { + /** + * The Contract Interface. + */ + interface; + /** + * The Contract deployment bytecode. Often called the initcode. + */ + bytecode; + /** + * The ContractRunner to deploy the Contract as. + */ + runner; + /** + * Create a new **ContractFactory** with %%abi%% and %%bytecode%%, + * optionally connected to %%runner%%. + * + * The %%bytecode%% may be the ``bytecode`` property within the + * standard Solidity JSON output. + */ + constructor(abi, bytecode, runner) { + const iface = abi_interface/* Interface */.KA.from(abi); + // Dereference Solidity bytecode objects and allow a missing `0x`-prefix + if (bytecode instanceof Uint8Array) { + bytecode = (0,utils_data/* hexlify */.c$)((0,utils_data/* getBytes */.q5)(bytecode)); + } + else { + if (typeof (bytecode) === "object") { + bytecode = bytecode.object; + } + if (!bytecode.startsWith("0x")) { + bytecode = "0x" + bytecode; + } + bytecode = (0,utils_data/* hexlify */.c$)((0,utils_data/* getBytes */.q5)(bytecode)); + } + (0,properties/* defineProperties */.n)(this, { + bytecode, interface: iface, runner: (runner || null) + }); + } + attach(target) { + return new contract/* BaseContract */.Uq(target, this.interface, this.runner); + } + /** + * Resolves to the transaction to deploy the contract, passing %%args%% + * into the constructor. + */ + async getDeployTransaction(...args) { + let overrides = {}; + const fragment = this.interface.deploy; + if (fragment.inputs.length + 1 === args.length) { + overrides = await (0,contract/* copyOverrides */.FC)(args.pop()); + } + if (fragment.inputs.length !== args.length) { + throw new Error("incorrect number of arguments to constructor"); + } + const resolvedArgs = await (0,contract/* resolveArgs */.yN)(this.runner, fragment.inputs, args); + const data = (0,utils_data/* concat */.xW)([this.bytecode, this.interface.encodeDeploy(resolvedArgs)]); + return Object.assign({}, overrides, { data }); + } + /** + * Resolves to the Contract deployed by passing %%args%% into the + * constructor. + * + * This will resolve to the Contract before it has been deployed to the + * network, so the [[BaseContract-waitForDeployment]] should be used before + * sending any transactions to it. + */ + async deploy(...args) { + const tx = await this.getDeployTransaction(...args); + (0,errors/* assert */.vA)(this.runner && typeof (this.runner.sendTransaction) === "function", "factory runner does not support sending transactions", "UNSUPPORTED_OPERATION", { + operation: "sendTransaction" + }); + const sentTx = await this.runner.sendTransaction(tx); + const address = (0,contract_address/* getCreateAddress */.t)(sentTx); + return new contract/* BaseContract */.Uq(address, this.interface, this.runner, sentTx); + } + /** + * Return a new **ContractFactory** with the same ABI and bytecode, + * but connected to %%runner%%. + */ + connect(runner) { + return new ContractFactory(this.interface, this.bytecode, runner); + } + /** + * Create a new **ContractFactory** from the standard Solidity JSON output. + */ + static fromSolidity(output, runner) { + (0,errors/* assertArgument */.MR)(output != null, "bad compiler output", "output", output); + if (typeof (output) === "string") { + output = JSON.parse(output); + } + const abi = output.abi; + let bytecode = ""; + if (output.bytecode) { + bytecode = output.bytecode; + } + else if (output.evm && output.evm.bytecode) { + bytecode = output.evm.bytecode; + } + return new this(abi, bytecode, runner); + } +} +//# sourceMappingURL=factory.js.map +;// ./node_modules/@tornado/contracts/dist/index.mjs + + +const _abi$1Y = [ + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "uint256", + name: "needed", + type: "uint256" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); + ], + name: "ERC1155InsufficientBalance", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "approver", + type: "address" } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); + ], + name: "ERC1155InvalidApprover", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "idsLength", + type: "uint256" + }, + { + internalType: "uint256", + name: "valuesLength", + type: "uint256" + } + ], + name: "ERC1155InvalidArrayLength", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + } + ], + name: "ERC1155InvalidOperator", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "receiver", + type: "address" + } + ], + name: "ERC1155InvalidReceiver", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "ERC1155InvalidSender", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "ERC1155MissingApprovalForAll", + type: "error" + } +]; +class IERC1155Errors__factory { + static abi = _abi$1Y; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1Y); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1Y, runner); + } +} + +const _abi$1X = [ + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "allowance", + type: "uint256" + }, + { + internalType: "uint256", + name: "needed", + type: "uint256" + } + ], + name: "ERC20InsufficientAllowance", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "uint256", + name: "needed", + type: "uint256" + } + ], + name: "ERC20InsufficientBalance", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "approver", + type: "address" + } + ], + name: "ERC20InvalidApprover", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "receiver", + type: "address" + } + ], + name: "ERC20InvalidReceiver", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "ERC20InvalidSender", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "ERC20InvalidSpender", + type: "error" + } +]; +class IERC20Errors__factory { + static abi = _abi$1X; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1X); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1X, runner); + } +} + +const _abi$1W = [ + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "ERC721IncorrectOwner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "ERC721InsufficientApproval", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "approver", + type: "address" + } + ], + name: "ERC721InvalidApprover", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + } + ], + name: "ERC721InvalidOperator", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "ERC721InvalidOwner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "receiver", + type: "address" + } + ], + name: "ERC721InvalidReceiver", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "ERC721InvalidSender", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "ERC721NonexistentToken", + type: "error" + } +]; +class IERC721Errors__factory { + static abi = _abi$1W; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1W); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1W, runner); + } +} + +var index$X = /*#__PURE__*/Object.freeze({ + __proto__: null, + IERC1155Errors__factory: IERC1155Errors__factory, + IERC20Errors__factory: IERC20Errors__factory, + IERC721Errors__factory: IERC721Errors__factory +}); + +const _abi$1V = [ + { + anonymous: false, + inputs: [], + name: "EIP712DomainChanged", + type: "event" + }, + { + inputs: [], + name: "eip712Domain", + outputs: [ + { + internalType: "bytes1", + name: "fields", + type: "bytes1" + }, + { + internalType: "string", + name: "name", + type: "string" + }, + { + internalType: "string", + name: "version", + type: "string" + }, + { + internalType: "uint256", + name: "chainId", + type: "uint256" + }, + { + internalType: "address", + name: "verifyingContract", + type: "address" + }, + { + internalType: "bytes32", + name: "salt", + type: "bytes32" + }, + { + internalType: "uint256[]", + name: "extensions", + type: "uint256[]" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IERC5267__factory { + static abi = _abi$1V; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1V); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1V, runner); + } +} + +var index$W = /*#__PURE__*/Object.freeze({ + __proto__: null, + IERC5267__factory: IERC5267__factory, + draftIerc6093Sol: index$X +}); + +const _abi$1U = [ + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "allowance", + type: "uint256" + }, + { + internalType: "uint256", + name: "needed", + type: "uint256" + } + ], + name: "ERC20InsufficientAllowance", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "uint256", + name: "needed", + type: "uint256" + } + ], + name: "ERC20InsufficientBalance", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "approver", + type: "address" + } + ], + name: "ERC20InvalidApprover", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "receiver", + type: "address" + } + ], + name: "ERC20InvalidReceiver", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "ERC20InvalidSender", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "ERC20InvalidSpender", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "burn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "burnFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +let ERC20Burnable__factory$1 = class ERC20Burnable__factory { + static abi = _abi$1U; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1U); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1U, runner); + } }; +const _abi$1T = [ + { + inputs: [], + name: "ECDSAInvalidSignature", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "length", + type: "uint256" + } + ], + name: "ECDSAInvalidSignatureLength", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "ECDSAInvalidSignatureS", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "allowance", + type: "uint256" + }, + { + internalType: "uint256", + name: "needed", + type: "uint256" + } + ], + name: "ERC20InsufficientAllowance", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "uint256", + name: "needed", + type: "uint256" + } + ], + name: "ERC20InsufficientBalance", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "approver", + type: "address" + } + ], + name: "ERC20InvalidApprover", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "receiver", + type: "address" + } + ], + name: "ERC20InvalidReceiver", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "ERC20InvalidSender", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "ERC20InvalidSpender", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "deadline", + type: "uint256" + } + ], + name: "ERC2612ExpiredSignature", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "signer", + type: "address" + }, + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "ERC2612InvalidSigner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "currentNonce", + type: "uint256" + } + ], + name: "InvalidAccountNonce", + type: "error" + }, + { + inputs: [], + name: "InvalidShortString", + type: "error" + }, + { + inputs: [ + { + internalType: "string", + name: "str", + type: "string" + } + ], + name: "StringTooLong", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [], + name: "EIP712DomainChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [], + name: "DOMAIN_SEPARATOR", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "eip712Domain", + outputs: [ + { + internalType: "bytes1", + name: "fields", + type: "bytes1" + }, + { + internalType: "string", + name: "name", + type: "string" + }, + { + internalType: "string", + name: "version", + type: "string" + }, + { + internalType: "uint256", + name: "chainId", + type: "uint256" + }, + { + internalType: "address", + name: "verifyingContract", + type: "address" + }, + { + internalType: "bytes32", + name: "salt", + type: "bytes32" + }, + { + internalType: "uint256[]", + name: "extensions", + type: "uint256[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "nonces", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "permit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +let ERC20Permit__factory$1 = class ERC20Permit__factory { + static abi = _abi$1T; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1T); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1T, runner); + } +}; + +const _abi$1S = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +class IERC20Metadata__factory { + static abi = _abi$1S; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1S); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1S, runner); + } +} + +const _abi$1R = [ + { + inputs: [], + name: "DOMAIN_SEPARATOR", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "nonces", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "permit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class IERC20Permit__factory { + static abi = _abi$1R; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1R); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1R, runner); + } +} + +var index$V = /*#__PURE__*/Object.freeze({ + __proto__: null, + ERC20Burnable__factory: ERC20Burnable__factory$1, + ERC20Permit__factory: ERC20Permit__factory$1, + IERC20Metadata__factory: IERC20Metadata__factory, + IERC20Permit__factory: IERC20Permit__factory +}); + +const _abi$1Q = [ + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "allowance", + type: "uint256" + }, + { + internalType: "uint256", + name: "needed", + type: "uint256" + } + ], + name: "ERC20InsufficientAllowance", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "uint256", + name: "needed", + type: "uint256" + } + ], + name: "ERC20InsufficientBalance", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "approver", + type: "address" + } + ], + name: "ERC20InvalidApprover", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "receiver", + type: "address" + } + ], + name: "ERC20InvalidReceiver", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "ERC20InvalidSender", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "ERC20InvalidSpender", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +let ERC20__factory$1 = class ERC20__factory { + static abi = _abi$1Q; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1Q); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1Q, runner); + } +}; + +const _abi$1P = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +let IERC20__factory$2 = class IERC20__factory { + static abi = _abi$1P; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1P); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1P, runner); + } +}; + +var index$U = /*#__PURE__*/Object.freeze({ + __proto__: null, + ERC20__factory: ERC20__factory$1, + IERC20__factory: IERC20__factory$2, + extensions: index$V +}); + +var index$T = /*#__PURE__*/Object.freeze({ + __proto__: null, + erc20: index$U +}); + +const _abi$1O = [ + { + inputs: [], + name: "ECDSAInvalidSignature", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "length", + type: "uint256" + } + ], + name: "ECDSAInvalidSignatureLength", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "ECDSAInvalidSignatureS", + type: "error" + } +]; +const _bytecode$11 = "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122045318690f3888125255e48382b32b90ae3da72675cabe3bcd6e9478e8383086264736f6c634300081c0033"; +const isSuperArgs$11 = (xs) => xs.length > 1; +class ECDSA__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$11(args)) { + super(...args); + } else { + super(_abi$1O, _bytecode$11, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$11; + static abi = _abi$1O; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1O); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1O, runner); + } +} + +const _abi$1N = [ + { + inputs: [], + name: "InvalidShortString", + type: "error" + }, + { + inputs: [ + { + internalType: "string", + name: "str", + type: "string" + } + ], + name: "StringTooLong", + type: "error" + }, + { + anonymous: false, + inputs: [], + name: "EIP712DomainChanged", + type: "event" + }, + { + inputs: [], + name: "eip712Domain", + outputs: [ + { + internalType: "bytes1", + name: "fields", + type: "bytes1" + }, + { + internalType: "string", + name: "name", + type: "string" + }, + { + internalType: "string", + name: "version", + type: "string" + }, + { + internalType: "uint256", + name: "chainId", + type: "uint256" + }, + { + internalType: "address", + name: "verifyingContract", + type: "address" + }, + { + internalType: "bytes32", + name: "salt", + type: "bytes32" + }, + { + internalType: "uint256[]", + name: "extensions", + type: "uint256[]" + } + ], + stateMutability: "view", + type: "function" + } +]; +class EIP712__factory { + static abi = _abi$1N; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1N); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1N, runner); + } +} + +var index$S = /*#__PURE__*/Object.freeze({ + __proto__: null, + ECDSA__factory: ECDSA__factory, + EIP712__factory: EIP712__factory +}); + +const _abi$1M = [ + { + inputs: [], + name: "MathOverflowedMulDiv", + type: "error" + } +]; +const _bytecode$10 = "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122054710e438b4d818c9886821c7249e64e03942ccb6f261579743c3dd2da7d85c964736f6c634300081c0033"; +const isSuperArgs$10 = (xs) => xs.length > 1; +class Math__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$10(args)) { + super(...args); + } else { + super(_abi$1M, _bytecode$10, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$10; + static abi = _abi$1M; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1M); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1M, runner); + } +} + +var index$R = /*#__PURE__*/Object.freeze({ + __proto__: null, + Math__factory: Math__factory +}); + +const _abi$1L = [ + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "currentNonce", + type: "uint256" + } + ], + name: "InvalidAccountNonce", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "nonces", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + } +]; +class Nonces__factory { + static abi = _abi$1L; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1L); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1L, runner); + } +} + +const _abi$1K = [ + { + inputs: [], + name: "InvalidShortString", + type: "error" + }, + { + inputs: [ + { + internalType: "string", + name: "str", + type: "string" + } + ], + name: "StringTooLong", + type: "error" + } +]; +const _bytecode$$ = "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212206a078d04f950e0ca410dd1769613f6ca85ff5970fa2ea088000c56fd336fbcaf64736f6c634300081c0033"; +const isSuperArgs$$ = (xs) => xs.length > 1; +class ShortStrings__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$$(args)) { + super(...args); + } else { + super(_abi$1K, _bytecode$$, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$$; + static abi = _abi$1K; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1K); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1K, runner); + } +} + +const _abi$1J = [ + { + inputs: [ + { + internalType: "uint256", + name: "value", + type: "uint256" + }, + { + internalType: "uint256", + name: "length", + type: "uint256" + } + ], + name: "StringsInsufficientHexLength", + type: "error" + } +]; +const _bytecode$_ = "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220cdd8289a2d34ad06cf0635eabbcac19a2c578b590d1b046b83c091f968f77dd664736f6c634300081c0033"; +const isSuperArgs$_ = (xs) => xs.length > 1; +class Strings__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$_(args)) { + super(...args); + } else { + super(_abi$1J, _bytecode$_, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$_; + static abi = _abi$1J; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1J); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1J, runner); + } +} + +var index$Q = /*#__PURE__*/Object.freeze({ + __proto__: null, + Nonces__factory: Nonces__factory, + ShortStrings__factory: ShortStrings__factory, + Strings__factory: Strings__factory, + cryptography: index$S, + math: index$R +}); + +var index$P = /*#__PURE__*/Object.freeze({ + __proto__: null, + interfaces: index$W, + token: index$T, + utils: index$Q +}); + +const _abi$1I = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class Ownable__factory { + static abi = _abi$1I; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1I); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1I, runner); + } +} + +var index$O = /*#__PURE__*/Object.freeze({ + __proto__: null, + Ownable__factory: Ownable__factory +}); + +const _abi$1H = [ + { + stateMutability: "payable", + type: "fallback" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +class Proxy__factory { + static abi = _abi$1H; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1H); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1H, runner); + } +} + +const _abi$1G = [ + { + inputs: [ + { + internalType: "address", + name: "_logic", + type: "address" + }, + { + internalType: "address", + name: "_admin", + type: "address" + }, + { + internalType: "bytes", + name: "_data", + type: "bytes" + } + ], + stateMutability: "payable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "previousAdmin", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "AdminChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "implementation", + type: "address" + } + ], + name: "Upgraded", + type: "event" + }, + { + stateMutability: "payable", + type: "fallback" + }, + { + inputs: [], + name: "admin", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "changeAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "implementation", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + } + ], + name: "upgradeTo", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "upgradeToAndCall", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$Z = "0x60806040526040516108dc3803806108dc8339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508290506100ee826101bf565b8051156101a6576000826001600160a01b0316826040518082805190602001908083835b602083106101315780518252601f199092019160209182019101610112565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610191576040519150601f19603f3d011682016040523d82523d6000602084013e610196565b606091505b50509050806101a457600080fd5b505b506101ae9050565b6101b782610231565b50505061025b565b6101d28161025560201b6103b41760201c565b61020d5760405162461bcd60e51b81526004018080602001828103825260368152602001806108a66036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3b151590565b61063c8061026a6000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b815260040180806020018281038252603a815260200180610555603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260428152602001806105c56042913960600191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603681526020018061058f6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a26469706673582212200bf5c74f32000c92994fb0de053047d19f9c526eb1b1953df8bcb7d7e0df8d2864736f6c634300060c00335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374"; +const isSuperArgs$Z = (xs) => xs.length > 1; +class TransparentUpgradeableProxy__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$Z(args)) { + super(...args); + } else { + super(_abi$1G, _bytecode$Z, args[0]); + } + } + getDeployTransaction(_logic, _admin, _data, overrides) { + return super.getDeployTransaction(_logic, _admin, _data, overrides || {}); + } + deploy(_logic, _admin, _data, overrides) { + return super.deploy(_logic, _admin, _data, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$Z; + static abi = _abi$1G; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1G); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$1G, + runner + ); + } +} + +const _abi$1F = [ + { + inputs: [ + { + internalType: "address", + name: "_logic", + type: "address" + }, + { + internalType: "bytes", + name: "_data", + type: "bytes" + } + ], + stateMutability: "payable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "implementation", + type: "address" + } + ], + name: "Upgraded", + type: "event" + }, + { + stateMutability: "payable", + type: "fallback" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$Y = "0x60806040526040516103123803806103128339818101604052604081101561002657600080fd5b81516020830180516040519294929383019291908464010000000082111561004d57600080fd5b90830190602082018581111561006257600080fd5b825164010000000081118282018810171561007c57600080fd5b82525081516020918201929091019080838360005b838110156100a9578181015183820152602001610091565b50505050905090810190601f1680156100d65780820380516001836020036101000a031916815260200191505b50604052506100e3915050565b6100ec826101ab565b8051156101a4576000826001600160a01b0316826040518082805190602001908083835b6020831061012f5780518252601f199092019160209182019101610110565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d806000811461018f576040519150601f19603f3d011682016040523d82523d6000602084013e610194565b606091505b50509050806101a257600080fd5b505b5050610223565b6101be8161021d60201b6100271760201c565b6101f95760405162461bcd60e51b81526004018080602001828103825260368152602001806102dc6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b3b151590565b60ab806102316000396000f3fe608060405236601057600e6013565b005b600e5b60196025565b60256021602d565b6052565b565b3b151590565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156070573d6000f35b3d6000fdfea2646970667358221220621b7042bfb847b4073a3c58bdbea5295ce2e761b4e2307ca010caaac996d80c64736f6c634300060c00335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374"; +const isSuperArgs$Y = (xs) => xs.length > 1; +class UpgradeableProxy__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$Y(args)) { + super(...args); + } else { + super(_abi$1F, _bytecode$Y, args[0]); + } + } + getDeployTransaction(_logic, _data, overrides) { + return super.getDeployTransaction(_logic, _data, overrides || {}); + } + deploy(_logic, _data, overrides) { + return super.deploy(_logic, _data, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$Y; + static abi = _abi$1F; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1F); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1F, runner); + } +} + +var index$N = /*#__PURE__*/Object.freeze({ + __proto__: null, + Proxy__factory: Proxy__factory, + TransparentUpgradeableProxy__factory: TransparentUpgradeableProxy__factory, + UpgradeableProxy__factory: UpgradeableProxy__factory +}); + +const _abi$1E = [ + { + inputs: [ + { + internalType: "string", + name: "name", + type: "string" + }, + { + internalType: "string", + name: "symbol", + type: "string" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "subtractedValue", + type: "uint256" + } + ], + name: "decreaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "addedValue", + type: "uint256" + } + ], + name: "increaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$X = "0x608060405234801561001057600080fd5b5060405162000c6238038062000c628339818101604052604081101561003557600080fd5b810190808051604051939291908464010000000082111561005557600080fd5b90830190602082018581111561006a57600080fd5b825164010000000081118282018810171561008457600080fd5b82525081516020918201929091019080838360005b838110156100b1578181015183820152602001610099565b50505050905090810190601f1680156100de5780820380516001836020036101000a031916815260200191505b506040526020018051604051939291908464010000000082111561010157600080fd5b90830190602082018581111561011657600080fd5b825164010000000081118282018810171561013057600080fd5b82525081516020918201929091019080838360005b8381101561015d578181015183820152602001610145565b50505050905090810190601f16801561018a5780820380516001836020036101000a031916815260200191505b50604052505082516101a4915060039060208501906101cd565b5080516101b89060049060208401906101cd565b50506005805460ff1916601217905550610260565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061020e57805160ff191683800117855561023b565b8280016001018555821561023b579182015b8281111561023b578251825591602001919060010190610220565b5061024792915061024b565b5090565b5b80821115610247576000815560010161024c565b6109f280620002706000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c8063395093511161007157806339509351146101d957806370a082311461020557806395d89b411461022b578063a457c2d714610233578063a9059cbb1461025f578063dd62ed3e1461028b576100a9565b806306fdde03146100ae578063095ea7b31461012b57806318160ddd1461016b57806323b872dd14610185578063313ce567146101bb575b600080fd5b6100b66102b9565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f05781810151838201526020016100d8565b50505050905090810190601f16801561011d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101576004803603604081101561014157600080fd5b506001600160a01b03813516906020013561034f565b604080519115158252519081900360200190f35b61017361036c565b60408051918252519081900360200190f35b6101576004803603606081101561019b57600080fd5b506001600160a01b03813581169160208101359091169060400135610372565b6101c36103f9565b6040805160ff9092168252519081900360200190f35b610157600480360360408110156101ef57600080fd5b506001600160a01b038135169060200135610402565b6101736004803603602081101561021b57600080fd5b50356001600160a01b0316610450565b6100b661046b565b6101576004803603604081101561024957600080fd5b506001600160a01b0381351690602001356104cc565b6101576004803603604081101561027557600080fd5b506001600160a01b038135169060200135610534565b610173600480360360408110156102a157600080fd5b506001600160a01b0381358116916020013516610548565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103455780601f1061031a57610100808354040283529160200191610345565b820191906000526020600020905b81548152906001019060200180831161032857829003601f168201915b5050505050905090565b600061036361035c610573565b8484610577565b50600192915050565b60025490565b600061037f848484610663565b6103ef8461038b610573565b6103ea85604051806060016040528060288152602001610927602891396001600160a01b038a166000908152600160205260408120906103c9610573565b6001600160a01b0316815260208101919091526040016000205491906107be565b610577565b5060019392505050565b60055460ff1690565b600061036361040f610573565b846103ea8560016000610420610573565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610855565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103455780601f1061031a57610100808354040283529160200191610345565b60006103636104d9610573565b846103ea856040518060600160405280602581526020016109986025913960016000610503610573565b6001600160a01b03908116825260208083019390935260409182016000908120918d168152925290205491906107be565b6000610363610541610573565b8484610663565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166105bc5760405162461bcd60e51b81526004018080602001828103825260248152602001806109746024913960400191505060405180910390fd5b6001600160a01b0382166106015760405162461bcd60e51b81526004018080602001828103825260228152602001806108df6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166106a85760405162461bcd60e51b815260040180806020018281038252602581526020018061094f6025913960400191505060405180910390fd5b6001600160a01b0382166106ed5760405162461bcd60e51b81526004018080602001828103825260238152602001806108bc6023913960400191505060405180910390fd5b6106f88383836108b6565b61073581604051806060016040528060268152602001610901602691396001600160a01b03861660009081526020819052604090205491906107be565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546107649082610855565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6000818484111561084d5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156108125781810151838201526020016107fa565b50505050905090810190601f16801561083f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000828201838110156108af576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220347718b9db0288208ab5957df73278c6f781963df0e13918151971217fc2827964736f6c634300060c0033"; +const isSuperArgs$X = (xs) => xs.length > 1; +class ERC20__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$X(args)) { + super(...args); + } else { + super(_abi$1E, _bytecode$X, args[0]); + } + } + getDeployTransaction(name, symbol, overrides) { + return super.getDeployTransaction(name, symbol, overrides || {}); + } + deploy(name, symbol, overrides) { + return super.deploy(name, symbol, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$X; + static abi = _abi$1E; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1E); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1E, runner); + } +} + +const _abi$1D = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "burn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "burnFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "subtractedValue", + type: "uint256" + } + ], + name: "decreaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "addedValue", + type: "uint256" + } + ], + name: "increaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +class ERC20Burnable__factory { + static abi = _abi$1D; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1D); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1D, runner); + } +} + +const _abi$1C = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +let IERC20__factory$1 = class IERC20__factory { + static abi = _abi$1C; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1C); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1C, runner); + } +}; + +var index$M = /*#__PURE__*/Object.freeze({ + __proto__: null, + ERC20Burnable__factory: ERC20Burnable__factory, + ERC20__factory: ERC20__factory, + IERC20__factory: IERC20__factory$1 +}); + +var index$L = /*#__PURE__*/Object.freeze({ + __proto__: null, + erc20: index$M +}); + +const _abi$1B = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address" + } + ], + name: "Paused", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address" + } + ], + name: "Unpaused", + type: "event" + }, + { + inputs: [], + name: "paused", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + } +]; +class Pausable__factory { + static abi = _abi$1B; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1B); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1B, runner); + } +} + +var index$K = /*#__PURE__*/Object.freeze({ + __proto__: null, + Pausable__factory: Pausable__factory +}); + +var index$J = /*#__PURE__*/Object.freeze({ + __proto__: null, + access: index$O, + proxy: index$N, + token: index$L, + utils: index$K +}); + +var index$I = /*#__PURE__*/Object.freeze({ + __proto__: null, + contracts: index$P, + contractsV3: index$J +}); + +const _abi$1A = [ + { + inputs: [ + { + internalType: "uint256", + name: "in_xL", + type: "uint256" + }, + { + internalType: "uint256", + name: "in_xR", + type: "uint256" + } + ], + name: "MiMCSponge", + outputs: [ + { + internalType: "uint256", + name: "xL", + type: "uint256" + }, + { + internalType: "uint256", + name: "xR", + type: "uint256" + } + ], + stateMutability: "pure", + type: "function" + } +]; +class IHasher__factory { + static abi = _abi$1A; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1A); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1A, runner); + } +} + +const _abi$1z = [ + { + inputs: [ + { + internalType: "uint32", + name: "_levels", + type: "uint32" + }, + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "FIELD_SIZE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ROOT_HISTORY_SIZE", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ZERO_VALUE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "currentRootIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "filledSubtrees", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getLastRoot", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + }, + { + internalType: "bytes32", + name: "_left", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_right", + type: "bytes32" + } + ], + name: "hashLeftRight", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [], + name: "hasher", + outputs: [ + { + internalType: "contract IHasher", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + } + ], + name: "isKnownRoot", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "levels", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "nextIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "roots", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "zeros", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$W = "0x60c0604052600380546001600160401b031916905534801561002057600080fd5b50604051610a10380380610a1083398101604081905261003f91610385565b60008263ffffffff16116100a65760405162461bcd60e51b815260206004820152602360248201527f5f6c6576656c732073686f756c642062652067726561746572207468616e207a60448201526265726f60e81b60648201526084015b60405180910390fd5b60208263ffffffff16106100fc5760405162461bcd60e51b815260206004820152601e60248201527f5f6c6576656c732073686f756c64206265206c657373207468616e2033320000604482015260640161009d565b63ffffffff821660a0526001600160a01b0381166080527f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c60005b8363ffffffff168163ffffffff1610156101845763ffffffff8116600090815260016020908152604080832085905590829052902082905561017a8383806101b8565b9150600101610137565b506000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b55506103f89050565b60006000805160206109f083398151915283106102175760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c64604482015260640161009d565b6000805160206109f0833981519152821061027e5760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b606482015260840161009d565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156102cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f191906103d4565b90925090506000805160206109f083398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610356573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061037a91906103d4565b509695505050505050565b6000806040838503121561039857600080fd5b825163ffffffff811681146103ac57600080fd5b60208401519092506001600160a01b03811681146103c957600080fd5b809150509250929050565b600080604083850312156103e757600080fd5b505080516020909101519092909150565b60805160a0516105d361041d60003960006101010152600061020f01526105d36000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063c2b40ae41161008c578063ec73295911610066578063ec732959146101e3578063ed33639f1461020a578063f178e47c14610249578063fc7e9c6f1461026957600080fd5b8063c2b40ae41461019b578063cd87a3b4146101bb578063e8295588146101c357600080fd5b8063414a37ba146100d45780634ecf518b146100fc5780636d9833e3146101385780638ea3099e1461015b57806390eeb02b1461016e578063ba70f7571461017e575b600080fd5b6100e960008051602061057e83398151915281565b6040519081526020015b60405180910390f35b6101237f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff90911681526020016100f3565b61014b6101463660046104d1565b610281565b60405190151581526020016100f3565b6100e96101693660046104ea565b6102ff565b6003546101239063ffffffff1681565b60035463ffffffff166000908152600260205260409020546100e9565b6100e96101a93660046104d1565b60026020526000908152604090205481565b610123601e81565b6100e96101d13660046104d1565b60016020526000908152604090205481565b6100e97f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c81565b6102317f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100f3565b6100e96102573660046104d1565b60006020819052908152604090205481565b60035461012390640100000000900463ffffffff1681565b600081810361029257506000919050565b60035463ffffffff16805b63ffffffff811660009081526002602052604090205484036102c3575060019392505050565b8063ffffffff166000036102d55750601e5b806102df8161052b565b9150508163ffffffff168163ffffffff160361029d575060009392505050565b600060008051602061057e83398151915283106103635760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c6460448201526064015b60405180910390fd5b60008051602061057e83398151915282106103ca5760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b606482015260840161035a565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610419573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061043d9190610559565b909250905060008051602061057e83398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156104a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c69190610559565b509695505050505050565b6000602082840312156104e357600080fd5b5035919050565b6000806000606084860312156104ff57600080fd5b83356001600160a01b038116811461051657600080fd5b95602085013595506040909401359392505050565b600063ffffffff82168061054f57634e487b7160e01b600052601160045260246000fd5b6000190192915050565b6000806040838503121561056c57600080fd5b50508051602090910151909290915056fe30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001a2646970667358221220f11e23d9109ed5a17bac47fbd258c25bee376ed054e1d1f4c83e9dd46ebf2e1264736f6c634300081c003330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001"; +const isSuperArgs$W = (xs) => xs.length > 1; +class MerkleTreeWithHistory__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$W(args)) { + super(...args); + } else { + super(_abi$1z, _bytecode$W, args[0]); + } + } + getDeployTransaction(_levels, _hasher, overrides) { + return super.getDeployTransaction(_levels, _hasher, overrides || {}); + } + deploy(_levels, _hasher, overrides) { + return super.deploy(_levels, _hasher, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$W; + static abi = _abi$1z; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1z); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$1z, + runner + ); + } +} + +var index$H = /*#__PURE__*/Object.freeze({ + __proto__: null, + IHasher__factory: IHasher__factory, + MerkleTreeWithHistory__factory: MerkleTreeWithHistory__factory +}); + +const _abi$1y = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [], + name: "_totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "who", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transfer", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class ERC20Basic__factory { + static abi = _abi$1y; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1y); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1y, runner); + } +} + +const _abi$1x = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [], + name: "_totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "approve", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "who", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transfer", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class IUSDT__factory { + static abi = _abi$1x; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1x); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1x, runner); + } +} + +var index$G = /*#__PURE__*/Object.freeze({ + __proto__: null, + ERC20Basic__factory: ERC20Basic__factory, + IUSDT__factory: IUSDT__factory +}); + +const _abi$1w = [ + { + stateMutability: "nonpayable", + type: "fallback" + } +]; +const _bytecode$V = "0x6080604052348015600f57600080fd5b50609c80601d6000396000f3fe6080604052348015600f57600080fd5b5060405162461bcd60e51b815260206004820152602160248201527f7468697320636f6e747261637420646f6573206e6f74206163636570742045546044820152600960fb1b606482015260840160405180910390fdfea2646970667358221220e3ea6c7cc6115518097ca37048fbc2dbf908554443ac49cb9f0f128dbca7c44e64736f6c634300081c0033"; +const isSuperArgs$V = (xs) => xs.length > 1; +class BadRecipient__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$V(args)) { + super(...args); + } else { + super(_abi$1w, _bytecode$V, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$V; + static abi = _abi$1w; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1w); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1w, runner); + } +} + +const _abi$1v = [ + { + inputs: [], + name: "ECDSAInvalidSignature", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "length", + type: "uint256" + } + ], + name: "ECDSAInvalidSignatureLength", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "ECDSAInvalidSignatureS", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "allowance", + type: "uint256" + }, + { + internalType: "uint256", + name: "needed", + type: "uint256" + } + ], + name: "ERC20InsufficientAllowance", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "uint256", + name: "needed", + type: "uint256" + } + ], + name: "ERC20InsufficientBalance", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "approver", + type: "address" + } + ], + name: "ERC20InvalidApprover", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "receiver", + type: "address" + } + ], + name: "ERC20InvalidReceiver", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "ERC20InvalidSender", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "ERC20InvalidSpender", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "deadline", + type: "uint256" + } + ], + name: "ERC2612ExpiredSignature", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "signer", + type: "address" + }, + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "ERC2612InvalidSigner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "currentNonce", + type: "uint256" + } + ], + name: "InvalidAccountNonce", + type: "error" + }, + { + inputs: [], + name: "InvalidShortString", + type: "error" + }, + { + inputs: [ + { + internalType: "string", + name: "str", + type: "string" + } + ], + name: "StringTooLong", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [], + name: "EIP712DomainChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [], + name: "DOMAIN_SEPARATOR", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "burn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "burnFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "eip712Domain", + outputs: [ + { + internalType: "bytes1", + name: "fields", + type: "bytes1" + }, + { + internalType: "string", + name: "name", + type: "string" + }, + { + internalType: "string", + name: "version", + type: "string" + }, + { + internalType: "uint256", + name: "chainId", + type: "uint256" + }, + { + internalType: "address", + name: "verifyingContract", + type: "address" + }, + { + internalType: "bytes32", + name: "salt", + type: "bytes32" + }, + { + internalType: "uint256[]", + name: "extensions", + type: "uint256[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "mint", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "nonces", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "permit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$U = "0x61016060405234801561001157600080fd5b50604051806040016040528060078152602001664441494d6f636b60c81b81525080604051806040016040528060018152602001603160f81b815250604051806040016040528060078152602001664441494d6f636b60c81b815250604051806040016040528060048152602001634441494d60e01b8152508160039081610099919061027a565b5060046100a6828261027a565b506100b691508390506005610161565b610120526100c5816006610161565b61014052815160208084019190912060e052815190820120610100524660a05261015260e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60805250503060c052506103aa565b600060208351101561017d5761017683610194565b905061018e565b81610188848261027a565b5060ff90505b92915050565b600080829050601f815111156101c8578260405163305a27a960e01b81526004016101bf9190610338565b60405180910390fd5b80516101d382610386565b179392505050565b634e487b7160e01b600052604160045260246000fd5b600181811c9082168061020557607f821691505b60208210810361022557634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561027557806000526020600020601f840160051c810160208510156102525750805b601f840160051c820191505b81811015610272576000815560010161025e565b50505b505050565b81516001600160401b03811115610293576102936101db565b6102a7816102a184546101f1565b8461022b565b6020601f8211600181146102db57600083156102c35750848201515b600019600385901b1c1916600184901b178455610272565b600084815260208120601f198516915b8281101561030b57878501518255602094850194600190920191016102eb565b50848210156103295786840151600019600387901b60f8161c191681555b50505050600190811b01905550565b602081526000825180602084015260005b818110156103665760208186018101516040868401015201610349565b506000604082850101526040601f19601f83011684010191505092915050565b805160208083015191908110156102255760001960209190910360031b1b16919050565b60805160a05160c05160e05161010051610120516101405161101a6104046000396000610804015260006107d701526000610713015260006106eb01526000610646015260006106700152600061069a015261101a6000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c806370a082311161009757806395d89b411161006657806395d89b4114610214578063a9059cbb1461021c578063d505accf1461022f578063dd62ed3e1461024257600080fd5b806370a08231146101aa57806379cc6790146101d35780637ecebe00146101e657806384b0196e146101f957600080fd5b8063313ce567116100d3578063313ce5671461016b5780633644e5151461017a57806340c10f191461018257806342966c681461019757600080fd5b806306fdde0314610105578063095ea7b31461012357806318160ddd1461014657806323b872dd14610158575b600080fd5b61010d61027b565b60405161011a9190610d64565b60405180910390f35b610136610131366004610d9a565b61030d565b604051901515815260200161011a565b6002545b60405190815260200161011a565b610136610166366004610dc4565b610327565b6040516012815260200161011a565b61014a61034b565b610195610190366004610d9a565b61035a565b005b6101956101a5366004610e01565b610368565b61014a6101b8366004610e1a565b6001600160a01b031660009081526020819052604090205490565b6101956101e1366004610d9a565b610375565b61014a6101f4366004610e1a565b61038a565b6102016103a8565b60405161011a9796959493929190610e35565b61010d6103ee565b61013661022a366004610d9a565b6103fd565b61019561023d366004610ecd565b61040b565b61014a610250366004610f40565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60606003805461028a90610f73565b80601f01602080910402602001604051908101604052809291908181526020018280546102b690610f73565b80156103035780601f106102d857610100808354040283529160200191610303565b820191906000526020600020905b8154815290600101906020018083116102e657829003601f168201915b5050505050905090565b60003361031b81858561054a565b60019150505b92915050565b60003361033585828561055c565b6103408585856105da565b506001949350505050565b6000610355610639565b905090565b6103648282610764565b5050565b610372338261079a565b50565b61038082338361055c565b610364828261079a565b6001600160a01b038116600090815260076020526040812054610321565b6000606080600080600060606103bc6107d0565b6103c46107fd565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b60606004805461028a90610f73565b60003361031b8185856105da565b834211156104345760405163313c898160e11b8152600481018590526024015b60405180910390fd5b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886104818c6001600160a01b0316600090815260076020526040902080546001810190915590565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e00160405160208183030381529060405280519060200120905060006104dc8261082a565b905060006104ec82878787610857565b9050896001600160a01b0316816001600160a01b031614610533576040516325c0072360e11b81526001600160a01b0380831660048301528b16602482015260440161042b565b61053e8a8a8a61054a565b50505050505050505050565b6105578383836001610885565b505050565b6001600160a01b0383811660009081526001602090815260408083209386168352929052205460001981146105d457818110156105c557604051637dc7a0d960e11b81526001600160a01b0384166004820152602481018290526044810183905260640161042b565b6105d484848484036000610885565b50505050565b6001600160a01b03831661060457604051634b637e8f60e11b81526000600482015260240161042b565b6001600160a01b03821661062e5760405163ec442f0560e01b81526000600482015260240161042b565b61055783838361095a565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561069257507f000000000000000000000000000000000000000000000000000000000000000046145b156106bc57507f000000000000000000000000000000000000000000000000000000000000000090565b610355604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b6001600160a01b03821661078e5760405163ec442f0560e01b81526000600482015260240161042b565b6103646000838361095a565b6001600160a01b0382166107c457604051634b637e8f60e11b81526000600482015260240161042b565b6103648260008361095a565b60606103557f00000000000000000000000000000000000000000000000000000000000000006005610a84565b60606103557f00000000000000000000000000000000000000000000000000000000000000006006610a84565b6000610321610837610639565b8360405161190160f01b8152600281019290925260228201526042902090565b60008060008061086988888888610b2f565b9250925092506108798282610bfe565b50909695505050505050565b6001600160a01b0384166108af5760405163e602df0560e01b81526000600482015260240161042b565b6001600160a01b0383166108d957604051634a1406b160e11b81526000600482015260240161042b565b6001600160a01b03808516600090815260016020908152604080832093871683529290522082905580156105d457826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161094c91815260200190565b60405180910390a350505050565b6001600160a01b03831661098557806002600082825461097a9190610fad565b909155506109f79050565b6001600160a01b038316600090815260208190526040902054818110156109d85760405163391434e360e21b81526001600160a01b0385166004820152602481018290526044810183905260640161042b565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b038216610a1357600280548290039055610a32565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610a7791815260200190565b60405180910390a3505050565b606060ff8314610a9e57610a9783610cb7565b9050610321565b818054610aaa90610f73565b80601f0160208091040260200160405190810160405280929190818152602001828054610ad690610f73565b8015610b235780601f10610af857610100808354040283529160200191610b23565b820191906000526020600020905b815481529060010190602001808311610b0657829003601f168201915b50505050509050610321565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610b6a5750600091506003905082610bf4565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610bbe573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610bea57506000925060019150829050610bf4565b9250600091508190505b9450945094915050565b6000826003811115610c1257610c12610fce565b03610c1b575050565b6001826003811115610c2f57610c2f610fce565b03610c4d5760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115610c6157610c61610fce565b03610c825760405163fce698f760e01b81526004810182905260240161042b565b6003826003811115610c9657610c96610fce565b03610364576040516335e2f38360e21b81526004810182905260240161042b565b60606000610cc483610cf6565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b600060ff8216601f81111561032157604051632cd44ac360e21b815260040160405180910390fd5b6000815180845260005b81811015610d4457602081850181015186830182015201610d28565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000610d776020830184610d1e565b9392505050565b80356001600160a01b0381168114610d9557600080fd5b919050565b60008060408385031215610dad57600080fd5b610db683610d7e565b946020939093013593505050565b600080600060608486031215610dd957600080fd5b610de284610d7e565b9250610df060208501610d7e565b929592945050506040919091013590565b600060208284031215610e1357600080fd5b5035919050565b600060208284031215610e2c57600080fd5b610d7782610d7e565b60ff60f81b8816815260e060208201526000610e5460e0830189610d1e565b8281036040840152610e668189610d1e565b606084018890526001600160a01b038716608085015260a0840186905283810360c08501528451808252602080870193509091019060005b81811015610ebc578351835260209384019390920191600101610e9e565b50909b9a5050505050505050505050565b600080600080600080600060e0888a031215610ee857600080fd5b610ef188610d7e565b9650610eff60208901610d7e565b95506040880135945060608801359350608088013560ff81168114610f2357600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215610f5357600080fd5b610f5c83610d7e565b9150610f6a60208401610d7e565b90509250929050565b600181811c90821680610f8757607f821691505b602082108103610fa757634e487b7160e01b600052602260045260246000fd5b50919050565b8082018082111561032157634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fdfea2646970667358221220e576ea72175cad97303c16106a449691832d2c19ed98a87d7dad19549b0d754564736f6c634300081c0033"; +const isSuperArgs$U = (xs) => xs.length > 1; +class ERC20Mock__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$U(args)) { + super(...args); + } else { + super(_abi$1v, _bytecode$U, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$U; + static abi = _abi$1v; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1v); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1v, runner); + } +} + +const _abi$1u = [ + { + inputs: [ + { + internalType: "bytes", + name: "_initCode", + type: "bytes" + }, + { + internalType: "bytes32", + name: "_salt", + type: "bytes32" + } + ], + name: "deploy", + outputs: [ + { + internalType: "address payable", + name: "createdContract", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +let IDeployer__factory$1 = class IDeployer__factory { + static abi = _abi$1u; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1u); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1u, runner); + } +}; + +const _abi$1t = [ + { + inputs: [ + { + internalType: "uint32", + name: "_treeLevels", + type: "uint32" + }, + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "FIELD_SIZE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ROOT_HISTORY_SIZE", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ZERO_VALUE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "currentRootIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "filledSubtrees", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getLastRoot", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + }, + { + internalType: "bytes32", + name: "_left", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_right", + type: "bytes32" + } + ], + name: "hashLeftRight", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [], + name: "hasher", + outputs: [ + { + internalType: "contract IHasher", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_leaf", + type: "bytes32" + } + ], + name: "insert", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + } + ], + name: "isKnownRoot", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "levels", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "nextIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "roots", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "zeros", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$T = "0x60c0604052600380546001600160401b031916905534801561002057600080fd5b50604051610e43380380610e4383398101604081905261003f91610389565b818160008263ffffffff16116100a85760405162461bcd60e51b815260206004820152602360248201527f5f6c6576656c732073686f756c642062652067726561746572207468616e207a60448201526265726f60e81b60648201526084015b60405180910390fd5b60208263ffffffff16106100fe5760405162461bcd60e51b815260206004820152601e60248201527f5f6c6576656c732073686f756c64206265206c657373207468616e2033320000604482015260640161009f565b63ffffffff821660a0526001600160a01b0381166080527f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c60005b8363ffffffff168163ffffffff1610156101865763ffffffff8116600090815260016020908152604080832085905590829052902082905561017c8383806101bc565b9150600101610139565b506000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b55506103fc92505050565b6000600080516020610e23833981519152831061021b5760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c64604482015260640161009f565b600080516020610e2383398151915282106102825760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b606482015260840161009f565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156102d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f591906103d8565b9092509050600080516020610e2383398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa15801561035a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061037e91906103d8565b509695505050505050565b6000806040838503121561039c57600080fd5b825163ffffffff811681146103b057600080fd5b60208401519092506001600160a01b03811681146103cd57600080fd5b809150509250929050565b600080604083850312156103eb57600080fd5b505080516020909101519092909150565b60805160a0516109ed610436600039600081816101310152818161052701526105c901526000818161023f015261066101526109ed6000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063c2b40ae41161008c578063ec73295911610066578063ec73295914610213578063ed33639f1461023a578063f178e47c14610279578063fc7e9c6f1461029957600080fd5b8063c2b40ae4146101cb578063cd87a3b4146101eb578063e8295588146101f357600080fd5b80636d9833e3116100c85780636d9833e3146101685780638ea3099e1461018b57806390eeb02b1461019e578063ba70f757146101ae57600080fd5b80632d287e43146100ef578063414a37ba146101045780634ecf518b1461012c575b600080fd5b6101026100fd36600461072c565b6102b1565b005b61011960008051602061099883398151915281565b6040519081526020015b60405180910390f35b6101537f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff9091168152602001610123565b61017b61017636600461072c565b6102be565b6040519015158152602001610123565b610119610199366004610745565b61033c565b6003546101539063ffffffff1681565b60035463ffffffff16600090815260026020526040902054610119565b6101196101d936600461072c565b60026020526000908152604090205481565b610153601e81565b61011961020136600461072c565b60016020526000908152604090205481565b6101197f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c81565b6102617f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610123565b61011961028736600461072c565b60006020819052908152604090205481565b60035461015390640100000000900463ffffffff1681565b6102ba8161050e565b5050565b60008181036102cf57506000919050565b60035463ffffffff16805b63ffffffff81166000908152600260205260409020548403610300575060019392505050565b8063ffffffff166000036103125750601e5b8061031c8161079c565b9150508163ffffffff168163ffffffff16036102da575060009392505050565b600060008051602061099883398151915283106103a05760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c6460448201526064015b60405180910390fd5b60008051602061099883398151915282106104075760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b6064820152608401610397565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610456573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047a91906107bc565b909250905060008051602061099883398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156104df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050391906107bc565b509695505050505050565b600354600090640100000000900463ffffffff1661054d7f0000000000000000000000000000000000000000000000000000000000000000600261090c565b63ffffffff168163ffffffff16036105c05760405162461bcd60e51b815260206004820152603060248201527f4d65726b6c6520747265652069732066756c6c2e204e6f206d6f7265206c656160448201526f1d995cc818d85b88189948185919195960821b6064820152608401610397565b8083600080805b7f000000000000000000000000000000000000000000000000000000000000000063ffffffff168163ffffffff16101561069e5761060660028661092b565b63ffffffff166000036106405763ffffffff811660009081526001602090815260408083205491839052909120859055849350915061065c565b63ffffffff811660009081526020819052604090205492508391505b6106877f0000000000000000000000000000000000000000000000000000000000000000848461033c565b9350610694600286610953565b94506001016105c7565b50600354600090601e906106b99063ffffffff16600161097b565b6106c3919061092b565b6003805463ffffffff191663ffffffff8316908117909155600090815260026020526040902085905590506106f986600161097b565b6003805463ffffffff929092166401000000000267ffffffff000000001990921691909117905550939695505050505050565b60006020828403121561073e57600080fd5b5035919050565b60008060006060848603121561075a57600080fd5b83356001600160a01b038116811461077157600080fd5b95602085013595506040909401359392505050565b634e487b7160e01b600052601160045260246000fd5b600063ffffffff8216806107b2576107b2610786565b6000190192915050565b600080604083850312156107cf57600080fd5b505080516020909101519092909150565b634e487b7160e01b600052601260045260246000fd5b6001815b60018411156108315780850481111561081557610815610786565b600184161561082357908102905b60019390931c9280026107fa565b935093915050565b60008261084857506001610906565b8161085557506000610906565b816001811461086b5760028114610875576108a6565b6001915050610906565b60ff84111561088657610886610786565b6001841b915063ffffffff8211156108a0576108a0610786565b50610906565b5060208310610133831016604e8410600b84101617156108dd575081810a63ffffffff8111156108d8576108d8610786565b610906565b6108ec63ffffffff84846107f6565b8063ffffffff0482111561090257610902610786565b0290505b92915050565b600061092463ffffffff841663ffffffff8416610839565b9392505050565b600063ffffffff831680610941576109416107e0565b8063ffffffff84160691505092915050565b600063ffffffff831680610969576109696107e0565b8063ffffffff84160491505092915050565b63ffffffff81811683821601908111156109065761090661078656fe30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001a2646970667358221220d4af2da17834eee5c4dc18614acb3b0fdfdd29ac766eb65a8d0826d4773a4afb64736f6c634300081c003330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001"; +const isSuperArgs$T = (xs) => xs.length > 1; +class MerkleTreeWithHistoryMock__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$T(args)) { + super(...args); + } else { + super(_abi$1t, _bytecode$T, args[0]); + } + } + getDeployTransaction(_treeLevels, _hasher, overrides) { + return super.getDeployTransaction(_treeLevels, _hasher, overrides || {}); + } + deploy(_treeLevels, _hasher, overrides) { + return super.deploy(_treeLevels, _hasher, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$T; + static abi = _abi$1t; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1t); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$1t, + runner + ); + } +} + +const _abi$1s = [ + { + inputs: [ + { + internalType: "uint256", + name: "_denomination", + type: "uint256" + }, + { + internalType: "address", + name: "_token", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "commitment", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "VerifiedCommitment", + type: "event" + }, + { + inputs: [], + name: "COMMITMENT_TYPE", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "COMMITMENT_TYPEHASH", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "WITNESS_TYPE_STRING", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "denomination", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "permit2", + outputs: [ + { + internalType: "contract ISignatureTransfer", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "bytes32[]", + name: "_commitments", + type: "bytes32[]" + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "bytes", + name: "_signature", + type: "bytes" + } + ], + name: "permit2Commitments", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "bytes", + name: "_signature", + type: "bytes" + } + ], + name: "permit2Test", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "token", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "verifiedCommitments", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "instance", + type: "address" + }, + { + internalType: "bytes32", + name: "commitmentsHash", + type: "bytes32" + } + ], + internalType: "struct Permit2Mock.PermitCommitments", + name: "permitData", + type: "tuple" + } + ], + name: "witness", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "pure", + type: "function" + } +]; +const _bytecode$S = "0x6080604052348015600f57600080fd5b50604051610bb1380380610bb1833981016040819052602c916055565b600091909155600180546001600160a01b0319166001600160a01b039092169190911790556090565b60008060408385031215606757600080fd5b825160208401519092506001600160a01b0381168114608557600080fd5b809150509250929050565b610b128061009f6000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c80638bca6d16116100665780638bca6d161461011e5780639e67ab1e14610127578063c58b4c4914610150578063f15ea35914610163578063fc0c546a1461017657600080fd5b806303ac0673146100a357806304f03273146100b857806312261ee7146100d3578063156e2152146101015780637e89f31f14610116575b600080fd5b6100b66100b13660046105ec565b610189565b005b6100c0610243565b6040519081526020015b60405180910390f35b6100e96e22d473030f116ddee9f6b43ac78ba381565b6040516001600160a01b0390911681526020016100ca565b610109610266565b6040516100ca91906106a4565b6101096102a1565b6100c060005481565b6100e96101353660046106be565b6002602052600090815260409020546001600160a01b031681565b6100c061015e36600461071e565b6102bd565b6100b6610171366004610776565b61032a565b6001546100e9906001600160a01b031681565b6040805160a0810182526001546001600160a01b0316606082019081526000546080830181905290825260208083018890528284018790528351808501855230815290810191909152915163187945bd60e11b81526e22d473030f116ddee9f6b43ac78ba3926330f28b7a9261020a929091908a90889088906004016108dc565b600060405180830381600087803b15801561022457600080fd5b505af1158015610238573d6000803e3d6000fd5b505050505050505050565b6040518060600160405280603b8152602001610aa2603b91398051906020012081565b6040518060600160405280603b8152602001610aa2603b913960405160200161028f9190610934565b60405160208183030381529060405281565b6040518060600160405280603b8152602001610aa2603b913981565b60006040518060600160405280603b8152602001610aa2603b9139805160209182012083518483015160405161030d94019283526001600160a01b03919091166020830152604082015260600190565b604051602081830303815290604052805190602001209050919050565b6000855160005461033b91906109b7565b905060008660405160200161035091906109e2565b60408051601f19818403018152828252805160209182012060a0840183526001546001600160a01b0316606085019081526080850187905284528382018a905283830189905282518084018452308082528184018890528451808601909552845291830181905293506e22d473030f116ddee9f6b43ac78ba39263137c29fe929091908c906103de906102bd565b6040518060600160405280603b8152602001610aa2603b91396040516020016104079190610934565b6040516020818303038152906040528a8a6040518863ffffffff1660e01b815260040161043a9796959493929190610a18565b600060405180830381600087803b15801561045457600080fd5b505af1158015610468573d6000803e3d6000fd5b505050506104768789610480565b5050505050505050565b60005b82518110156105825760008382815181106104a0576104a0610a8b565b602090810291909101810151600081815260029092526040909120549091506001600160a01b0316156105195760405162461bcd60e51b815260206004820181905260248201527f54686520636f6d6d69746d656e7420686173206265656e207665726966696564604482015260640160405180910390fd5b60008181526002602090815260409182902080546001600160a01b0319166001600160a01b038716908117909155915191825282917fa9b0993cd360203065cdbc30dd334b2a3eb63115cbb64d73246109d8af75a5f9910160405180910390a250600101610483565b505050565b80356001600160a01b038116811461059e57600080fd5b919050565b60008083601f8401126105b557600080fd5b50813567ffffffffffffffff8111156105cd57600080fd5b6020830191508360208285010111156105e557600080fd5b9250929050565b60008060008060006080868803121561060457600080fd5b61060d86610587565b94506020860135935060408601359250606086013567ffffffffffffffff81111561063757600080fd5b610643888289016105a3565b969995985093965092949392505050565b60005b8381101561066f578181015183820152602001610657565b50506000910152565b60008151808452610690816020860160208601610654565b601f01601f19169290920160200192915050565b6020815260006106b76020830184610678565b9392505050565b6000602082840312156106d057600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610716576107166106d7565b604052919050565b6000604082840312801561073157600080fd5b506040805190810167ffffffffffffffff81118282101715610755576107556106d7565b60405261076183610587565b81526020928301359281019290925250919050565b60008060008060008060a0878903121561078f57600080fd5b61079887610587565b9550602087013567ffffffffffffffff8111156107b457600080fd5b8701601f810189136107c557600080fd5b803567ffffffffffffffff8111156107df576107df6106d7565b8060051b6107ef602082016106ed565b9182526020818401810192908101908c84111561080b57600080fd5b6020850194505b8385101561083157843580835260209586019590935090910190610812565b9850505050604088013594505060608701359250608087013567ffffffffffffffff81111561085f57600080fd5b61086b89828a016105a3565b979a9699509497509295939492505050565b61089b82825180516001600160a01b03168252602090810151910152565b60208101516040830152604081015160608301525050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6108e6818761087d565b84516001600160a01b03166080820152602085015160a08201526001600160a01b03841660c082015261010060e0820181905260009061092990830184866108b3565b979650505050505050565b7f5065726d6974436f6d6d69746d656e7473207769746e6573732900000000000081526000825161096c81601a850160208701610654565b7f546f6b656e5065726d697373696f6e73286164647265737320746f6b656e2c75601a9390910192830152506d696e7432353620616d6f756e742960901b603a820152604801919050565b80820281158282048414176109dc57634e487b7160e01b600052601160045260246000fd5b92915050565b8151600090829060208501835b82811015610a0d5781518452602093840193909101906001016109ef565b509195945050505050565b610a22818961087d565b86516001600160a01b03166080820152602087015160a082015260018060a01b03861660c08201528460e08201526101406101008201526000610a69610140830186610678565b828103610120840152610a7d8185876108b3565b9a9950505050505050505050565b634e487b7160e01b600052603260045260246000fdfe5065726d6974436f6d6d69746d656e7473286164647265737320696e7374616e63652c6279746573333220636f6d6d69746d656e74734861736829a26469706673582212206a6ecdc893f53628220fd48e8b32741c8e8a1c0862bc81e1d55feb14bef95f1764736f6c634300081c0033"; +const isSuperArgs$S = (xs) => xs.length > 1; +class Permit2Mock__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$S(args)) { + super(...args); + } else { + super(_abi$1s, _bytecode$S, args[0]); + } + } + getDeployTransaction(_denomination, _token, overrides) { + return super.getDeployTransaction(_denomination, _token, overrides || {}); + } + deploy(_denomination, _token, overrides) { + return super.deploy(_denomination, _token, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$S; + static abi = _abi$1s; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1s); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1s, runner); + } +} + +var index$F = /*#__PURE__*/Object.freeze({ + __proto__: null, + BadRecipient__factory: BadRecipient__factory, + ERC20Mock__factory: ERC20Mock__factory, + IDeployer__factory: IDeployer__factory$1, + MerkleTreeWithHistoryMock__factory: MerkleTreeWithHistoryMock__factory, + Permit2Mock__factory: Permit2Mock__factory, + iusdtSol: index$G +}); + +const _abi$1r = [ + { + inputs: [ + { + internalType: "bytes", + name: "_proof", + type: "bytes" + }, + { + internalType: "uint256[6]", + name: "_input", + type: "uint256[6]" + } + ], + name: "verifyProof", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +class IVerifier__factory { + static abi = _abi$1r; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1r); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1r, runner); + } +} + +const _abi$1q = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "commitment", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint32", + name: "leafIndex", + type: "uint32" + }, + { + indexed: false, + internalType: "uint256", + name: "timestamp", + type: "uint256" + } + ], + name: "Deposit", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "bytes32", + name: "nullifierHash", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "relayer", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "fee", + type: "uint256" + } + ], + name: "Withdrawal", + type: "event" + }, + { + inputs: [], + name: "FIELD_SIZE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ROOT_HISTORY_SIZE", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ZERO_VALUE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "commitments", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "currentRootIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "denomination", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_commitment", + type: "bytes32" + } + ], + name: "deposit", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "filledSubtrees", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getLastRoot", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + }, + { + internalType: "bytes32", + name: "_left", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_right", + type: "bytes32" + } + ], + name: "hashLeftRight", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [], + name: "hasher", + outputs: [ + { + internalType: "contract IHasher", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + } + ], + name: "isKnownRoot", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + } + ], + name: "isSpent", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "_nullifierHashes", + type: "bytes32[]" + } + ], + name: "isSpentArray", + outputs: [ + { + internalType: "bool[]", + name: "spent", + type: "bool[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "levels", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "nextIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "nullifierHashes", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "roots", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "verifier", + outputs: [ + { + internalType: "contract IVerifier", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "_proof", + type: "bytes" + }, + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + }, + { + internalType: "address payable", + name: "_recipient", + type: "address" + }, + { + internalType: "address payable", + name: "_relayer", + type: "address" + }, + { + internalType: "uint256", + name: "_fee", + type: "uint256" + }, + { + internalType: "uint256", + name: "_refund", + type: "uint256" + } + ], + name: "withdraw", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "zeros", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + } +]; +class Tornado__factory { + static abi = _abi$1q; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1q); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1q, runner); + } +} + +var index$E = /*#__PURE__*/Object.freeze({ + __proto__: null, + IVerifier__factory: IVerifier__factory, + Tornado__factory: Tornado__factory +}); + +const _abi$1p = [ + { + inputs: [], + name: "denomination", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "commitment", + type: "bytes32" + } + ], + name: "deposit", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "token", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "proof", + type: "bytes" + }, + { + internalType: "bytes32", + name: "root", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "nullifierHash", + type: "bytes32" + }, + { + internalType: "address payable", + name: "recipient", + type: "address" + }, + { + internalType: "address payable", + name: "relayer", + type: "address" + }, + { + internalType: "uint256", + name: "fee", + type: "uint256" + }, + { + internalType: "uint256", + name: "refund", + type: "uint256" + } + ], + name: "withdraw", + outputs: [], + stateMutability: "payable", + type: "function" + } +]; +let ITornadoInstance__factory$1 = class ITornadoInstance__factory { + static abi = _abi$1p; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1p); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1p, runner); + } +}; + +const _abi$1o = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + }, + { + indexed: false, + internalType: "bytes", + name: "encryptedNote", + type: "bytes" + } + ], + name: "EncryptedNote", + type: "event" + }, + { + inputs: [ + { + internalType: "bytes[]", + name: "_encryptedNotes", + type: "bytes[]" + } + ], + name: "backupNotes", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "_tornado", + type: "address" + }, + { + internalType: "bytes32", + name: "_commitment", + type: "bytes32" + }, + { + internalType: "bytes", + name: "_encryptedNote", + type: "bytes" + } + ], + name: "deposit", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "_tornado", + type: "address" + }, + { + internalType: "bytes", + name: "_proof", + type: "bytes" + }, + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + }, + { + internalType: "address payable", + name: "_recipient", + type: "address" + }, + { + internalType: "address payable", + name: "_relayer", + type: "address" + }, + { + internalType: "uint256", + name: "_fee", + type: "uint256" + }, + { + internalType: "uint256", + name: "_refund", + type: "uint256" + } + ], + name: "withdraw", + outputs: [], + stateMutability: "payable", + type: "function" + } +]; +const _bytecode$R = "0x608060405234801561001057600080fd5b506104f6806100206000396000f3fe6080604052600436106100345760003560e01c806313d98d13146100395780636485ba2a1461004e578063b438689f1461006e575b600080fd5b61004c6100473660046102c7565b610081565b005b34801561005a57600080fd5b5061004c610069366004610258565b61012a565b61004c61007c366004610321565b610198565b60405163b214faa560e01b81526001600160a01b0385169063b214faa59034906100af9087906004016103ec565b6000604051808303818588803b1580156100c857600080fd5b505af11580156100dc573d6000803e3d6000fd5b5050505050336001600160a01b03167ffa28df43db3553771f7209dcef046f3bdfea15870ab625dcda30ac58b82b4008838360405161011c9291906103f5565b60405180910390a250505050565b60005b8181101561019357337ffa28df43db3553771f7209dcef046f3bdfea15870ab625dcda30ac58b82b400884848481811061016357fe5b90506020028101906101759190610463565b6040516101839291906103f5565b60405180910390a260010161012d565b505050565b6040516310d056db60e11b81526001600160a01b038a16906321a0adb69034906101d4908c908c908c908c908c908c908c908c90600401610411565b6000604051808303818588803b1580156101ed57600080fd5b505af1158015610201573d6000803e3d6000fd5b5050505050505050505050505050565b60008083601f840112610222578182fd5b50813567ffffffffffffffff811115610239578182fd5b60208301915083602082850101111561025157600080fd5b9250929050565b6000806020838503121561026a578182fd5b823567ffffffffffffffff80821115610281578384fd5b818501915085601f830112610294578384fd5b8135818111156102a2578485fd5b86602080830285010111156102b5578485fd5b60209290920196919550909350505050565b600080600080606085870312156102dc578182fd5b84356102e7816104a8565b935060208501359250604085013567ffffffffffffffff811115610309578283fd5b61031587828801610211565b95989497509550505050565b60008060008060008060008060006101008a8c03121561033f578485fd5b893561034a816104a8565b985060208a013567ffffffffffffffff811115610365578586fd5b6103718c828d01610211565b90995097505060408a0135955060608a0135945060808a0135610393816104a8565b935060a08a01356103a3816104a8565b8093505060c08a0135915060e08a013590509295985092959850929598565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b90815260200190565b6000602082526104096020830184866103c2565b949350505050565b600060e0825261042560e083018a8c6103c2565b60208301989098525060408101959095526001600160a01b03938416606086015291909216608084015260a083019190915260c09091015292915050565b6000808335601e19843603018112610479578283fd5b83018035915067ffffffffffffffff821115610493578283fd5b60200191503681900382131561025157600080fd5b6001600160a01b03811681146104bd57600080fd5b5056fea2646970667358221220a833625c5e7cc02dff95b380fd1e6d47b08cffea90c70cfe6739960deee47b8364736f6c634300060c0033"; +const isSuperArgs$R = (xs) => xs.length > 1; +class TornadoProxyLight__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$R(args)) { + super(...args); + } else { + super(_abi$1o, _bytecode$R, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$R; + static abi = _abi$1o; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1o); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1o, runner); + } +} + +var index$D = /*#__PURE__*/Object.freeze({ + __proto__: null, + ITornadoInstance__factory: ITornadoInstance__factory$1, + TornadoProxyLight__factory: TornadoProxyLight__factory +}); + +const _abi$1n = [ + { + inputs: [], + name: "DOMAIN_SEPARATOR", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "nonces", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "permit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +class IERC20__factory { + static abi = _abi$1n; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1n); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1n, runner); + } +} + +const _abi$1m = [ + { + inputs: [ + { + internalType: "uint256", + name: "maxAmount", + type: "uint256" + } + ], + name: "InvalidAmount", + type: "error" + }, + { + inputs: [], + name: "LengthMismatch", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "word", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "mask", + type: "uint256" + } + ], + name: "UnorderedNonceInvalidation", + type: "event" + }, + { + inputs: [], + name: "DOMAIN_SEPARATOR", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "wordPos", + type: "uint256" + }, + { + internalType: "uint256", + name: "mask", + type: "uint256" + } + ], + name: "invalidateUnorderedNonces", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + }, + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "nonceBitmap", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + components: [ + { + components: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.TokenPermissions", + name: "permitted", + type: "tuple" + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.PermitTransferFrom", + name: "permit", + type: "tuple" + }, + { + components: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "requestedAmount", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.SignatureTransferDetails", + name: "transferDetails", + type: "tuple" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "bytes", + name: "signature", + type: "bytes" + } + ], + name: "permitTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + components: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.TokenPermissions[]", + name: "permitted", + type: "tuple[]" + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.PermitBatchTransferFrom", + name: "permit", + type: "tuple" + }, + { + components: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "requestedAmount", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.SignatureTransferDetails[]", + name: "transferDetails", + type: "tuple[]" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "bytes", + name: "signature", + type: "bytes" + } + ], + name: "permitTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + components: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.TokenPermissions", + name: "permitted", + type: "tuple" + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.PermitTransferFrom", + name: "permit", + type: "tuple" + }, + { + components: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "requestedAmount", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.SignatureTransferDetails", + name: "transferDetails", + type: "tuple" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "bytes32", + name: "witness", + type: "bytes32" + }, + { + internalType: "string", + name: "witnessTypeString", + type: "string" + }, + { + internalType: "bytes", + name: "signature", + type: "bytes" + } + ], + name: "permitWitnessTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + components: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.TokenPermissions[]", + name: "permitted", + type: "tuple[]" + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.PermitBatchTransferFrom", + name: "permit", + type: "tuple" + }, + { + components: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "requestedAmount", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.SignatureTransferDetails[]", + name: "transferDetails", + type: "tuple[]" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "bytes32", + name: "witness", + type: "bytes32" + }, + { + internalType: "string", + name: "witnessTypeString", + type: "string" + }, + { + internalType: "bytes", + name: "signature", + type: "bytes" + } + ], + name: "permitWitnessTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class ISignatureTransfer__factory { + static abi = _abi$1m; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1m); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1m, runner); + } +} + +var index$C = /*#__PURE__*/Object.freeze({ + __proto__: null, + IERC20__factory: IERC20__factory, + ISignatureTransfer__factory: ISignatureTransfer__factory +}); + +const _abi$1l = [ + { + inputs: [ + { + internalType: "contract IVerifier", + name: "_verifier", + type: "address" + }, + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + }, + { + internalType: "uint256", + name: "_denomination", + type: "uint256" + }, + { + internalType: "uint32", + name: "_merkleTreeHeight", + type: "uint32" + }, + { + internalType: "contract IERC20", + name: "_token", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "commitment", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint32", + name: "leafIndex", + type: "uint32" + }, + { + indexed: false, + internalType: "uint256", + name: "timestamp", + type: "uint256" + } + ], + name: "Deposit", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "bytes32", + name: "nullifierHash", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "relayer", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "fee", + type: "uint256" + } + ], + name: "Withdrawal", + type: "event" + }, + { + inputs: [], + name: "FIELD_SIZE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ROOT_HISTORY_SIZE", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ZERO_VALUE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "commitments", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "currentRootIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "denomination", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_commitment", + type: "bytes32" + } + ], + name: "deposit", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "filledSubtrees", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getLastRoot", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + }, + { + internalType: "bytes32", + name: "_left", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_right", + type: "bytes32" + } + ], + name: "hashLeftRight", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [], + name: "hasher", + outputs: [ + { + internalType: "contract IHasher", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + } + ], + name: "isKnownRoot", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + } + ], + name: "isSpent", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "_nullifierHashes", + type: "bytes32[]" + } + ], + name: "isSpentArray", + outputs: [ + { + internalType: "bool[]", + name: "spent", + type: "bool[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "levels", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "nextIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "nullifierHashes", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "roots", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "token", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "verifier", + outputs: [ + { + internalType: "contract IVerifier", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "_proof", + type: "bytes" + }, + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + }, + { + internalType: "address payable", + name: "_recipient", + type: "address" + }, + { + internalType: "address payable", + name: "_relayer", + type: "address" + }, + { + internalType: "uint256", + name: "_fee", + type: "uint256" + }, + { + internalType: "uint256", + name: "_refund", + type: "uint256" + } + ], + name: "withdraw", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "zeros", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$Q = "0x610120604052600380546001600160401b031916905534801561002157600080fd5b50604051611dc5380380611dc583398101604081905261004091610420565b84848484808360008263ffffffff16116100ad5760405162461bcd60e51b815260206004820152602360248201527f5f6c6576656c732073686f756c642062652067726561746572207468616e207a60448201526265726f60e81b60648201526084015b60405180910390fd5b60208263ffffffff16106101035760405162461bcd60e51b815260206004820152601e60248201527f5f6c6576656c732073686f756c64206265206c657373207468616e203332000060448201526064016100a4565b63ffffffff821660a0526001600160a01b0381166080527f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c60005b8363ffffffff168163ffffffff16101561018b5763ffffffff8116600090815260016020908152604080832085905590829052902082905561018183838061023b565b915060010161013e565b506000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b5550506001600455816102195760405162461bcd60e51b815260206004820152602560248201527f64656e6f6d696e6174696f6e2073686f756c6420626520677265617465722074604482015264068616e20360dc1b60648201526084016100a4565b506001600160a01b0392831660c05260e052501661010052506104b892505050565b6000600080516020611da5833981519152831061029a5760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c6460448201526064016100a4565b600080516020611da583398151915282106103015760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b60648201526084016100a4565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610350573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103749190610494565b9092509050600080516020611da583398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156103d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103fd9190610494565b509695505050505050565b6001600160a01b038116811461041d57600080fd5b50565b600080600080600060a0868803121561043857600080fd5b855161044381610408565b602087015190955061045481610408565b60408701516060880151919550935063ffffffff8116811461047557600080fd5b608087015190925061048681610408565b809150509295509295909350565b600080604083850312156104a757600080fd5b505080516020909101519092909150565b60805160a05160c05160e05161010051611863610542600039600081816104ca01528181610cfa01528181610d34015261108e0152600081816102bb0152818161056f01528181610ccc01526110b20152600081816101a601526106d801526000818161022201528181610e150152610eb70152600081816104690152610f4f01526118636000f3fe6080604052600436106101355760003560e01c8063b214faa5116100ab578063e82955881161006f578063e8295588146103f6578063ec73295914610423578063ed33639f14610457578063f178e47c1461048b578063fc0c546a146104b8578063fc7e9c6f146104ec57600080fd5b8063b214faa514610347578063ba70f7571461035a578063c2b40ae414610384578063cd87a3b4146103b1578063e5285dcc146103c657600080fd5b80636d9833e3116100fd5780636d9833e314610259578063839df945146102795780638bca6d16146102a95780638ea3099e146102dd57806390eeb02b146102fd5780639fa12d0b1461031a57600080fd5b806317cc915c1461013a57806321a0adb61461017f5780632b7ac3f314610194578063414a37ba146101e05780634ecf518b14610210575b600080fd5b34801561014657600080fd5b5061016a61015536600461131d565b60056020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b61019261018d36600461135e565b610511565b005b3480156101a057600080fd5b506101c87f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610176565b3480156101ec57600080fd5b5061020260008051602061180e83398151915281565b604051908152602001610176565b34801561021c57600080fd5b506102447f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff9091168152602001610176565b34801561026557600080fd5b5061016a61027436600461131d565b61081c565b34801561028557600080fd5b5061016a61029436600461131d565b60066020526000908152604090205460ff1681565b3480156102b557600080fd5b506102027f000000000000000000000000000000000000000000000000000000000000000081565b3480156102e957600080fd5b506102026102f8366004611417565b61089a565b34801561030957600080fd5b506003546102449063ffffffff1681565b34801561032657600080fd5b5061033a61033536600461144c565b610a67565b60405161017691906114c3565b61019261035536600461131d565b610b23565b34801561036657600080fd5b5060035463ffffffff16600090815260026020526040902054610202565b34801561039057600080fd5b5061020261039f36600461131d565b60026020526000908152604090205481565b3480156103bd57600080fd5b50610244601e81565b3480156103d257600080fd5b5061016a6103e136600461131d565b60009081526005602052604090205460ff1690565b34801561040257600080fd5b5061020261041136600461131d565b60016020526000908152604090205481565b34801561042f57600080fd5b506102027f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c81565b34801561046357600080fd5b506101c87f000000000000000000000000000000000000000000000000000000000000000081565b34801561049757600080fd5b506102026104a636600461131d565b60006020819052908152604090205481565b3480156104c457600080fd5b506101c87f000000000000000000000000000000000000000000000000000000000000000081565b3480156104f857600080fd5b5060035461024490640100000000900463ffffffff1681565b6002600454036105685760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60026004557f00000000000000000000000000000000000000000000000000000000000000008211156105dd5760405162461bcd60e51b815260206004820152601a60248201527f4665652065786365656473207472616e736665722076616c7565000000000000604482015260640161055f565b60008581526005602052604090205460ff161561063c5760405162461bcd60e51b815260206004820152601f60248201527f546865206e6f746520686173206265656e20616c7265616479207370656e7400604482015260640161055f565b6106458661081c565b6106915760405162461bcd60e51b815260206004820152601c60248201527f43616e6e6f742066696e6420796f7572206d65726b6c6520726f6f7400000000604482015260640161055f565b6040805160c081018252878152602081018790526001600160a01b038681168284015285811660608301526080820185905260a08201849052915163695ef6f960e01b81527f00000000000000000000000000000000000000000000000000000000000000009092169163695ef6f991610711918c918c91600401611508565b6020604051808303816000875af1158015610730573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107549190611568565b6107995760405162461bcd60e51b815260206004820152601660248201527524b73b30b634b2103bb4ba34323930bb90383937b7b360511b604482015260640161055f565b6000858152600560205260409020805460ff191660011790556107be84848484610c5a565b604080516001600160a01b03868116825260208201889052918101849052908416907fe9e508bad6d4c3227e881ca19068f099da81b5164dd6d62b2eaf1e8bc6c349319060600160405180910390a250506001600455505050505050565b600081810361082d57506000919050565b60035463ffffffff16805b63ffffffff8116600090815260026020526040902054840361085e575060019392505050565b8063ffffffff166000036108705750601e5b8061087a816115a7565b9150508163ffffffff168163ffffffff1603610838575060009392505050565b600060008051602061180e83398151915283106108f95760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c64604482015260640161055f565b60008051602061180e83398151915282106109605760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b606482015260840161055f565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156109af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d391906115c7565b909250905060008051602061180e83398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610a38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5c91906115c7565b509695505050505050565b60608167ffffffffffffffff811115610a8257610a82611601565b604051908082528060200260200182016040528015610aab578160200160208202803683370190505b50905060005b82811015610b1c57610aea848483818110610ace57610ace611617565b9050602002013560009081526005602052604090205460ff1690565b15610b14576001828281518110610b0357610b03611617565b911515602092830291909101909101525b600101610ab1565b5092915050565b600260045403610b755760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161055f565b600260045560008181526006602052604090205460ff1615610be35760405162461bcd60e51b815260206004820152602160248201527f54686520636f6d6d69746d656e7420686173206265656e207375626d697474656044820152601960fa1b606482015260840161055f565b6000610bee82610dfc565b6000838152600660205260409020805460ff191660011790559050610c1161101a565b6040805163ffffffff8316815242602082015283917fa945e51eec50ab98c161376f0db4cf2aeba3ec92755fe2fcd388bdbbb80ff196910160405180910390a250506001600455565b803414610cc25760405162461bcd60e51b815260206004820152603060248201527f496e636f727265637420726566756e6420616d6f756e7420726563656976656460448201526f08189e481d1a194818dbdb9d1c9858dd60821b606482015260840161055f565b610d2184610cf0847f000000000000000000000000000000000000000000000000000000000000000061162d565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691906110d8565b8115610d5b57610d5b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001684846110d8565b8015610df6576000846001600160a01b03168260405160006040518083038185875af1925050503d8060008114610dae576040519150601f19603f3d011682016040523d82523d6000602084013e610db3565b606091505b5050905080610df4576040516001600160a01b0385169083156108fc029084906000818181858888f19350505050158015610df2573d6000803e3d6000fd5b505b505b50505050565b600354600090640100000000900463ffffffff16610e3b7f0000000000000000000000000000000000000000000000000000000000000000600261175a565b63ffffffff168163ffffffff1603610eae5760405162461bcd60e51b815260206004820152603060248201527f4d65726b6c6520747265652069732066756c6c2e204e6f206d6f7265206c656160448201526f1d995cc818d85b88189948185919195960821b606482015260840161055f565b8083600080805b7f000000000000000000000000000000000000000000000000000000000000000063ffffffff168163ffffffff161015610f8c57610ef4600286611772565b63ffffffff16600003610f2e5763ffffffff8116600090815260016020908152604080832054918390529091208590558493509150610f4a565b63ffffffff811660009081526020819052604090205492508391505b610f757f0000000000000000000000000000000000000000000000000000000000000000848461089a565b9350610f8260028661179a565b9450600101610eb5565b50600354600090601e90610fa79063ffffffff1660016117c2565b610fb19190611772565b6003805463ffffffff191663ffffffff831690811790915560009081526002602052604090208590559050610fe78660016117c2565b6003805463ffffffff929092166401000000000267ffffffff000000001990921691909117905550939695505050505050565b34156110815760405162461bcd60e51b815260206004820152603060248201527f4554482076616c756520697320737570706f73656420746f206265203020666f60448201526f7220455243323020696e7374616e636560801b606482015260840161055f565b6110d66001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633307f00000000000000000000000000000000000000000000000000000000000000006111f1565b565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b179052915160009283929087169161113491906117de565b6000604051808303816000865af19150503d8060008114611171576040519150601f19603f3d011682016040523d82523d6000602084013e611176565b606091505b50915091508161118857805181602001fd5b805115806111a55750808060200190518101906111a59190611568565b610df45760405162461bcd60e51b815260206004820152601e60248201527f5361666545524332303a20736166655472616e73666572206661696c65640000604482015260640161055f565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b179052915160009283929088169161125591906117de565b6000604051808303816000865af19150503d8060008114611292576040519150601f19603f3d011682016040523d82523d6000602084013e611297565b606091505b5091509150816112a957805181602001fd5b805115806112c65750808060200190518101906112c69190611568565b610df25760405162461bcd60e51b815260206004820152602260248201527f5361666545524332303a20736166655472616e7366657246726f6d206661696c604482015261195960f21b606482015260840161055f565b60006020828403121561132f57600080fd5b5035919050565b6001600160a01b038116811461134b57600080fd5b50565b803561135981611336565b919050565b60008060008060008060008060e0898b03121561137a57600080fd5b883567ffffffffffffffff81111561139157600080fd5b8901601f81018b136113a257600080fd5b803567ffffffffffffffff8111156113b957600080fd5b8b60208284010111156113cb57600080fd5b6020918201995097508901359550604089013594506113ec60608a0161134e565b93506113fa60808a0161134e565b979a969950949793969295929450505060a08201359160c0013590565b60008060006060848603121561142c57600080fd5b833561143781611336565b95602085013595506040909401359392505050565b6000806020838503121561145f57600080fd5b823567ffffffffffffffff81111561147657600080fd5b8301601f8101851361148757600080fd5b803567ffffffffffffffff81111561149e57600080fd5b8560208260051b84010111156114b357600080fd5b6020919091019590945092505050565b602080825282518282018190526000918401906040840190835b818110156114fd57835115158352602093840193909201916001016114dd565b509095945050505050565b60e081528260e08201528284610100830137600061010084830101526000610100601f19601f8601168301019050602082018360005b600681101561155d57815183526020928301929091019060010161153e565b505050949350505050565b60006020828403121561157a57600080fd5b8151801515811461158a57600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b600063ffffffff8216806115bd576115bd611591565b6000190192915050565b600080604083850312156115da57600080fd5b505080516020909101519092909150565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b8181038181111561164057611640611591565b92915050565b6001815b60018411156116815780850481111561166557611665611591565b600184161561167357908102905b60019390931c92800261164a565b935093915050565b60008261169857506001611640565b816116a557506000611640565b81600181146116bb57600281146116c5576116f6565b6001915050611640565b60ff8411156116d6576116d6611591565b6001841b915063ffffffff8211156116f0576116f0611591565b50611640565b5060208310610133831016604e8410600b841016171561172d575081810a63ffffffff81111561172857611728611591565b611640565b61173c63ffffffff8484611646565b8063ffffffff0482111561175257611752611591565b029392505050565b600061158a63ffffffff841663ffffffff8416611689565b600063ffffffff831680611788576117886115eb565b8063ffffffff84160691505092915050565b600063ffffffff8316806117b0576117b06115eb565b8063ffffffff84160491505092915050565b63ffffffff818116838216019081111561164057611640611591565b6000825160005b818110156117ff57602081860181015185830152016117e5565b50600092019182525091905056fe30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001a2646970667358221220b02ff0aa2482e2d5c96dc808653f03833fb36ec1e6b15aae7d79ca885ffda98164736f6c634300081c003330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001"; +const isSuperArgs$Q = (xs) => xs.length > 1; +class ERC20Tornado__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$Q(args)) { + super(...args); + } else { + super(_abi$1l, _bytecode$Q, args[0]); + } + } + getDeployTransaction(_verifier, _hasher, _denomination, _merkleTreeHeight, _token, overrides) { + return super.getDeployTransaction( + _verifier, + _hasher, + _denomination, + _merkleTreeHeight, + _token, + overrides || {} + ); + } + deploy(_verifier, _hasher, _denomination, _merkleTreeHeight, _token, overrides) { + return super.deploy( + _verifier, + _hasher, + _denomination, + _merkleTreeHeight, + _token, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$Q; + static abi = _abi$1l; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1l); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1l, runner); + } +} + +const _abi$1k = [ + { + inputs: [ + { + internalType: "contract IVerifier", + name: "_verifier", + type: "address" + }, + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + }, + { + internalType: "uint256", + name: "_denomination", + type: "uint256" + }, + { + internalType: "uint32", + name: "_merkleTreeHeight", + type: "uint32" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "commitment", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint32", + name: "leafIndex", + type: "uint32" + }, + { + indexed: false, + internalType: "uint256", + name: "timestamp", + type: "uint256" + } + ], + name: "Deposit", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "bytes32", + name: "nullifierHash", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "relayer", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "fee", + type: "uint256" + } + ], + name: "Withdrawal", + type: "event" + }, + { + inputs: [], + name: "FIELD_SIZE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ROOT_HISTORY_SIZE", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ZERO_VALUE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "commitments", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "currentRootIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "denomination", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_commitment", + type: "bytes32" + } + ], + name: "deposit", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "filledSubtrees", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getLastRoot", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + }, + { + internalType: "bytes32", + name: "_left", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_right", + type: "bytes32" + } + ], + name: "hashLeftRight", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [], + name: "hasher", + outputs: [ + { + internalType: "contract IHasher", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + } + ], + name: "isKnownRoot", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + } + ], + name: "isSpent", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "_nullifierHashes", + type: "bytes32[]" + } + ], + name: "isSpentArray", + outputs: [ + { + internalType: "bool[]", + name: "spent", + type: "bool[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "levels", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "nextIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "nullifierHashes", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "roots", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "verifier", + outputs: [ + { + internalType: "contract IVerifier", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "_proof", + type: "bytes" + }, + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + }, + { + internalType: "address payable", + name: "_recipient", + type: "address" + }, + { + internalType: "address payable", + name: "_relayer", + type: "address" + }, + { + internalType: "uint256", + name: "_fee", + type: "uint256" + }, + { + internalType: "uint256", + name: "_refund", + type: "uint256" + } + ], + name: "withdraw", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "zeros", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$P = "0x610100604052600380546001600160401b031916905534801561002157600080fd5b50604051611b75380380611b758339810160408190526100409161041b565b83838383808360008263ffffffff16116100ad5760405162461bcd60e51b815260206004820152602360248201527f5f6c6576656c732073686f756c642062652067726561746572207468616e207a60448201526265726f60e81b60648201526084015b60405180910390fd5b60208263ffffffff16106101035760405162461bcd60e51b815260206004820152601e60248201527f5f6c6576656c732073686f756c64206265206c657373207468616e203332000060448201526064016100a4565b63ffffffff821660a0526001600160a01b0381166080527f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c60005b8363ffffffff168163ffffffff16101561018b5763ffffffff81166000908152600160209081526040808320859055908290529020829055610181838380610236565b915060010161013e565b506000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b5550506001600455816102195760405162461bcd60e51b815260206004820152602560248201527f64656e6f6d696e6174696f6e2073686f756c6420626520677265617465722074604482015264068616e20360dc1b60648201526084016100a4565b506001600160a01b0390921660c0525060e0525061049d92505050565b6000600080516020611b5583398151915283106102955760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c6460448201526064016100a4565b600080516020611b5583398151915282106102fc5760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b60648201526084016100a4565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa15801561034b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036f9190610479565b9092509050600080516020611b5583398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156103d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f89190610479565b509695505050505050565b6001600160a01b038116811461041857600080fd5b50565b6000806000806080858703121561043157600080fd5b845161043c81610403565b602086015190945061044d81610403565b60408601516060870151919450925063ffffffff8116811461046e57600080fd5b939692955090935050565b6000806040838503121561048c57600080fd5b505080516020909101519092909150565b60805160a05160c05160e05161164e610507600039600081816102b00152818161053001528181610d0401526110a201526000818161019b015261069901526000818161021701528181610e9b0152610f3d01526000818161045e0152610fd5015261164e6000f3fe60806040526004361061012a5760003560e01c80639fa12d0b116100ab578063e5285dcc1161006f578063e5285dcc146103bb578063e8295588146103eb578063ec73295914610418578063ed33639f1461044c578063f178e47c14610480578063fc7e9c6f146104ad57600080fd5b80639fa12d0b1461030f578063b214faa51461033c578063ba70f7571461034f578063c2b40ae414610379578063cd87a3b4146103a657600080fd5b80636d9833e3116100f25780636d9833e31461024e578063839df9451461026e5780638bca6d161461029e5780638ea3099e146102d257806390eeb02b146102f257600080fd5b806317cc915c1461012f57806321a0adb6146101745780632b7ac3f314610189578063414a37ba146101d55780634ecf518b14610205575b600080fd5b34801561013b57600080fd5b5061015f61014a366004611137565b60056020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b610187610182366004611178565b6104d2565b005b34801561019557600080fd5b506101bd7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161016b565b3480156101e157600080fd5b506101f76000805160206115f983398151915281565b60405190815260200161016b565b34801561021157600080fd5b506102397f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff909116815260200161016b565b34801561025a57600080fd5b5061015f610269366004611137565b6107dd565b34801561027a57600080fd5b5061015f610289366004611137565b60066020526000908152604090205460ff1681565b3480156102aa57600080fd5b506101f77f000000000000000000000000000000000000000000000000000000000000000081565b3480156102de57600080fd5b506101f76102ed366004611231565b61085b565b3480156102fe57600080fd5b506003546102399063ffffffff1681565b34801561031b57600080fd5b5061032f61032a366004611266565b610a28565b60405161016b91906112dd565b61018761034a366004611137565b610ae4565b34801561035b57600080fd5b5060035463ffffffff166000908152600260205260409020546101f7565b34801561038557600080fd5b506101f7610394366004611137565b60026020526000908152604090205481565b3480156103b257600080fd5b50610239601e81565b3480156103c757600080fd5b5061015f6103d6366004611137565b60009081526005602052604090205460ff1690565b3480156103f757600080fd5b506101f7610406366004611137565b60016020526000908152604090205481565b34801561042457600080fd5b506101f77f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c81565b34801561045857600080fd5b506101bd7f000000000000000000000000000000000000000000000000000000000000000081565b34801561048c57600080fd5b506101f761049b366004611137565b60006020819052908152604090205481565b3480156104b957600080fd5b5060035461023990640100000000900463ffffffff1681565b6002600454036105295760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60026004557f000000000000000000000000000000000000000000000000000000000000000082111561059e5760405162461bcd60e51b815260206004820152601a60248201527f4665652065786365656473207472616e736665722076616c75650000000000006044820152606401610520565b60008581526005602052604090205460ff16156105fd5760405162461bcd60e51b815260206004820152601f60248201527f546865206e6f746520686173206265656e20616c7265616479207370656e74006044820152606401610520565b610606866107dd565b6106525760405162461bcd60e51b815260206004820152601c60248201527f43616e6e6f742066696e6420796f7572206d65726b6c6520726f6f74000000006044820152606401610520565b6040805160c081018252878152602081018790526001600160a01b038681168284015285811660608301526080820185905260a08201849052915163695ef6f960e01b81527f00000000000000000000000000000000000000000000000000000000000000009092169163695ef6f9916106d2918c918c91600401611322565b6020604051808303816000875af11580156106f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107159190611382565b61075a5760405162461bcd60e51b815260206004820152601660248201527524b73b30b634b2103bb4ba34323930bb90383937b7b360511b6044820152606401610520565b6000858152600560205260409020805460ff1916600117905561077f84848484610c1b565b604080516001600160a01b03868116825260208201889052918101849052908416907fe9e508bad6d4c3227e881ca19068f099da81b5164dd6d62b2eaf1e8bc6c349319060600160405180910390a250506001600455505050505050565b60008181036107ee57506000919050565b60035463ffffffff16805b63ffffffff8116600090815260026020526040902054840361081f575060019392505050565b8063ffffffff166000036108315750601e5b8061083b816113c1565b9150508163ffffffff168163ffffffff16036107f9575060009392505050565b60006000805160206115f983398151915283106108ba5760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c646044820152606401610520565b6000805160206115f983398151915282106109215760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b6064820152608401610520565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610970573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099491906113e1565b90925090506000805160206115f983398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156109f9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a1d91906113e1565b509695505050505050565b60608167ffffffffffffffff811115610a4357610a4361141b565b604051908082528060200260200182016040528015610a6c578160200160208202803683370190505b50905060005b82811015610add57610aab848483818110610a8f57610a8f611431565b9050602002013560009081526005602052604090205460ff1690565b15610ad5576001828281518110610ac457610ac4611431565b911515602092830291909101909101525b600101610a72565b5092915050565b600260045403610b365760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610520565b600260045560008181526006602052604090205460ff1615610ba45760405162461bcd60e51b815260206004820152602160248201527f54686520636f6d6d69746d656e7420686173206265656e207375626d697474656044820152601960fa1b6064820152608401610520565b6000610baf82610e82565b6000838152600660205260409020805460ff191660011790559050610bd26110a0565b6040805163ffffffff8316815242602082015283917fa945e51eec50ab98c161376f0db4cf2aeba3ec92755fe2fcd388bdbbb80ff196910160405180910390a250506001600455565b3415610c875760405162461bcd60e51b815260206004820152603560248201527f4d6573736167652076616c756520697320737570706f73656420746f206265206044820152747a65726f20666f722045544820696e7374616e636560581b6064820152608401610520565b8015610cf25760405162461bcd60e51b815260206004820152603460248201527f526566756e642076616c756520697320737570706f73656420746f206265207a60448201527365726f20666f722045544820696e7374616e636560601b6064820152608401610520565b60006001600160a01b038516610d28847f0000000000000000000000000000000000000000000000000000000000000000611447565b604051600081818185875af1925050503d8060008114610d64576040519150601f19603f3d011682016040523d82523d6000602084013e610d69565b606091505b5050905080610dc85760405162461bcd60e51b815260206004820152602560248201527f7061796d656e7420746f205f726563697069656e7420646964206e6f7420676f604482015264207468727560d81b6064820152608401610520565b8215610e7b576040516001600160a01b038516908490600081818185875af1925050503d8060008114610e17576040519150601f19603f3d011682016040523d82523d6000602084013e610e1c565b606091505b50508091505080610e7b5760405162461bcd60e51b815260206004820152602360248201527f7061796d656e7420746f205f72656c6179657220646964206e6f7420676f207460448201526268727560e81b6064820152608401610520565b5050505050565b600354600090640100000000900463ffffffff16610ec17f00000000000000000000000000000000000000000000000000000000000000006002611574565b63ffffffff168163ffffffff1603610f345760405162461bcd60e51b815260206004820152603060248201527f4d65726b6c6520747265652069732066756c6c2e204e6f206d6f7265206c656160448201526f1d995cc818d85b88189948185919195960821b6064820152608401610520565b8083600080805b7f000000000000000000000000000000000000000000000000000000000000000063ffffffff168163ffffffff16101561101257610f7a60028661158c565b63ffffffff16600003610fb45763ffffffff8116600090815260016020908152604080832054918390529091208590558493509150610fd0565b63ffffffff811660009081526020819052604090205492508391505b610ffb7f0000000000000000000000000000000000000000000000000000000000000000848461085b565b93506110086002866115b4565b9450600101610f3b565b50600354600090601e9061102d9063ffffffff1660016115dc565b611037919061158c565b6003805463ffffffff191663ffffffff83169081179091556000908152600260205260409020859055905061106d8660016115dc565b6003805463ffffffff929092166401000000000267ffffffff000000001990921691909117905550939695505050505050565b7f000000000000000000000000000000000000000000000000000000000000000034146111355760405162461bcd60e51b815260206004820152603860248201527f506c656173652073656e6420606d697844656e6f6d696e6174696f6e6020455460448201527f4820616c6f6e672077697468207472616e73616374696f6e00000000000000006064820152608401610520565b565b60006020828403121561114957600080fd5b5035919050565b6001600160a01b038116811461116557600080fd5b50565b803561117381611150565b919050565b60008060008060008060008060e0898b03121561119457600080fd5b883567ffffffffffffffff8111156111ab57600080fd5b8901601f81018b136111bc57600080fd5b803567ffffffffffffffff8111156111d357600080fd5b8b60208284010111156111e557600080fd5b60209182019950975089013595506040890135945061120660608a01611168565b935061121460808a01611168565b979a969950949793969295929450505060a08201359160c0013590565b60008060006060848603121561124657600080fd5b833561125181611150565b95602085013595506040909401359392505050565b6000806020838503121561127957600080fd5b823567ffffffffffffffff81111561129057600080fd5b8301601f810185136112a157600080fd5b803567ffffffffffffffff8111156112b857600080fd5b8560208260051b84010111156112cd57600080fd5b6020919091019590945092505050565b602080825282518282018190526000918401906040840190835b8181101561131757835115158352602093840193909201916001016112f7565b509095945050505050565b60e081528260e08201528284610100830137600061010084830101526000610100601f19601f8601168301019050602082018360005b6006811015611377578151835260209283019290910190600101611358565b505050949350505050565b60006020828403121561139457600080fd5b815180151581146113a457600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b600063ffffffff8216806113d7576113d76113ab565b6000190192915050565b600080604083850312156113f457600080fd5b505080516020909101519092909150565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b8181038181111561145a5761145a6113ab565b92915050565b6001815b600184111561149b5780850481111561147f5761147f6113ab565b600184161561148d57908102905b60019390931c928002611464565b935093915050565b6000826114b25750600161145a565b816114bf5750600061145a565b81600181146114d557600281146114df57611510565b600191505061145a565b60ff8411156114f0576114f06113ab565b6001841b915063ffffffff82111561150a5761150a6113ab565b5061145a565b5060208310610133831016604e8410600b8410161715611547575081810a63ffffffff811115611542576115426113ab565b61145a565b61155663ffffffff8484611460565b8063ffffffff0482111561156c5761156c6113ab565b029392505050565b60006113a463ffffffff841663ffffffff84166114a3565b600063ffffffff8316806115a2576115a2611405565b8063ffffffff84160691505092915050565b600063ffffffff8316806115ca576115ca611405565b8063ffffffff84160491505092915050565b63ffffffff818116838216019081111561145a5761145a6113ab56fe30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001a264697066735822122030cdb3d931ce1408ab144147edd7c76e28173ecad063b971dad09ea221811b3c64736f6c634300081c003330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001"; +const isSuperArgs$P = (xs) => xs.length > 1; +class ETHTornado__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$P(args)) { + super(...args); + } else { + super(_abi$1k, _bytecode$P, args[0]); + } + } + getDeployTransaction(_verifier, _hasher, _denomination, _merkleTreeHeight, overrides) { + return super.getDeployTransaction( + _verifier, + _hasher, + _denomination, + _merkleTreeHeight, + overrides || {} + ); + } + deploy(_verifier, _hasher, _denomination, _merkleTreeHeight, overrides) { + return super.deploy( + _verifier, + _hasher, + _denomination, + _merkleTreeHeight, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$P; + static abi = _abi$1k; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1k); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1k, runner); + } +} + +const _abi$1j = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "who", + type: "address" + }, + { + indexed: false, + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "Echo", + type: "event" + }, + { + inputs: [ + { + internalType: "bytes", + name: "_data", + type: "bytes" + } + ], + name: "echo", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$O = "0x6080604052348015600f57600080fd5b506101658061001f6000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063624fbfdc14610030575b600080fd5b61004361003e36600461008c565b610045565b005b336001600160a01b03167f50d6f3fc915efd1695d8a4cb50da185984f50d256834b9cb308295eb3c872c9c8383604051610080929190610100565b60405180910390a25050565b6000806020838503121561009f57600080fd5b823567ffffffffffffffff8111156100b657600080fd5b8301601f810185136100c757600080fd5b803567ffffffffffffffff8111156100de57600080fd5b8560208284010111156100f057600080fd5b6020919091019590945092505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f1916010191905056fea264697066735822122050c4191eadbd3981b9be4954b8abbadae91d7cfb743a47cc6930c8fe566e1c6e64736f6c634300081c0033"; +const isSuperArgs$O = (xs) => xs.length > 1; +class Echoer__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$O(args)) { + super(...args); + } else { + super(_abi$1j, _bytecode$O, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$O; + static abi = _abi$1j; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1j); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1j, runner); + } +} + +const _abi$1i = [ + { + inputs: [ + { + internalType: "contract IVerifier", + name: "_verifier", + type: "address" + }, + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + }, + { + internalType: "uint256", + name: "_denomination", + type: "uint256" + }, + { + internalType: "uint32", + name: "_merkleTreeHeight", + type: "uint32" + }, + { + internalType: "contract IERC20", + name: "_token", + type: "address" + }, + { + internalType: "address", + name: "_tornadoProxyLight", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "commitment", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint32", + name: "leafIndex", + type: "uint32" + }, + { + indexed: false, + internalType: "uint256", + name: "timestamp", + type: "uint256" + } + ], + name: "Deposit", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "commitment", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "VerifiedCommitment", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "bytes32", + name: "nullifierHash", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "relayer", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "fee", + type: "uint256" + } + ], + name: "Withdrawal", + type: "event" + }, + { + inputs: [], + name: "COMMITMENT_TYPE", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "COMMITMENT_TYPEHASH", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "FIELD_SIZE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ROOT_HISTORY_SIZE", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "WITNESS_TYPE_STRING", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ZERO_VALUE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "commitments", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "currentRootIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "denomination", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_commitment", + type: "bytes32" + } + ], + name: "deposit", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_commitment", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "depositCommitment", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "filledSubtrees", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getLastRoot", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + }, + { + internalType: "bytes32", + name: "_left", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_right", + type: "bytes32" + } + ], + name: "hashLeftRight", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [], + name: "hasher", + outputs: [ + { + internalType: "contract IHasher", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + } + ], + name: "isKnownRoot", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + } + ], + name: "isSpent", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "_nullifierHashes", + type: "bytes32[]" + } + ], + name: "isSpentArray", + outputs: [ + { + internalType: "bool[]", + name: "spent", + type: "bool[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "levels", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "nextIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "nullifierHashes", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "permit2", + outputs: [ + { + internalType: "contract ISignatureTransfer", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "bytes32[]", + name: "_commitments", + type: "bytes32[]" + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "bytes", + name: "_signature", + type: "bytes" + } + ], + name: "permit2Commitments", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "bytes32[]", + name: "_commitments", + type: "bytes32[]" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "permitCommitments", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "roots", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "token", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "tornadoProxyLight", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "verifiedCommitments", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "verifier", + outputs: [ + { + internalType: "contract IVerifier", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "_proof", + type: "bytes" + }, + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + }, + { + internalType: "address payable", + name: "_recipient", + type: "address" + }, + { + internalType: "address payable", + name: "_relayer", + type: "address" + }, + { + internalType: "uint256", + name: "_fee", + type: "uint256" + }, + { + internalType: "uint256", + name: "_refund", + type: "uint256" + } + ], + name: "withdraw", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "instance", + type: "address" + }, + { + internalType: "bytes32", + name: "commitmentsHash", + type: "bytes32" + } + ], + internalType: "struct PermitTornado.PermitCommitments", + name: "permitData", + type: "tuple" + } + ], + name: "witness", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "zeros", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$N = "0x610140604052600380546001600160401b031916905534801561002157600080fd5b50604051612b91380380612b9183398101604081905261004091610434565b858585858584848484808360008263ffffffff16116100b25760405162461bcd60e51b815260206004820152602360248201527f5f6c6576656c732073686f756c642062652067726561746572207468616e207a60448201526265726f60e81b60648201526084015b60405180910390fd5b60208263ffffffff16106101085760405162461bcd60e51b815260206004820152601e60248201527f5f6c6576656c732073686f756c64206265206c657373207468616e203332000060448201526064016100a9565b63ffffffff821660a0526001600160a01b0381166080527f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c60005b8363ffffffff168163ffffffff1610156101905763ffffffff8116600090815260016020908152604080832085905590829052902082905561018683838061024f565b9150600101610143565b506000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b55505060016004558161021e5760405162461bcd60e51b815260206004820152602560248201527f64656e6f6d696e6174696f6e2073686f756c6420626520677265617465722074604482015264068616e20360dc1b60648201526084016100a9565b506001600160a01b0392831660c05260e05250908116610100529490941661012052506104de975050505050505050565b6000600080516020612b7183398151915283106102ae5760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c6460448201526064016100a9565b600080516020612b7183398151915282106103155760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b60648201526084016100a9565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610364573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038891906104ba565b9092509050600080516020612b7183398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156103ed573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041191906104ba565b509695505050505050565b6001600160a01b038116811461043157600080fd5b50565b60008060008060008060c0878903121561044d57600080fd5b86516104588161041c565b60208801519096506104698161041c565b60408801516060890151919650945063ffffffff8116811461048a57600080fd5b608088015190935061049b8161041c565b60a08801519092506104ac8161041c565b809150509295509295509295565b600080604083850312156104cd57600080fd5b505080516020909101519092909150565b60805160a05160c05160e05161010051610120516125c66105ab600039600081816103b301526119460152600081816106d101528181610ba101528181610c0a015281816111eb015281816113be015281816113f8015281816119790152611b5801526000818161042c015281816107a801528181610b0501528181611192015281816113900152818161199d0152611b7c0152600081816102d4015261091101526000818161032a0152818161173701526117d9015260008181610650015261187101526125c66000f3fe6080604052600436106101e35760003560e01c80639e67ab1e11610102578063e5285dcc11610095578063f15ea35911610064578063f15ea35914610672578063f178e47c14610692578063fc0c546a146106bf578063fc7e9c6f146106f357600080fd5b8063e5285dcc146105ad578063e8295588146105dd578063ec7329591461060a578063ed33639f1461063e57600080fd5b8063ba70f757116100d1578063ba70f75714610521578063c2b40ae41461054b578063c58b4c4914610578578063cd87a3b41461059857600080fd5b80639e67ab1e1461048b5780639fa12d0b146104c1578063a9f6f2b7146104ee578063b214faa51461050e57600080fd5b80636d9833e31161017a578063839df94511610149578063839df945146103ea5780638bca6d161461041a5780638ea3099e1461044e57806390eeb02b1461046e57600080fd5b80636d9833e31461036157806372286fcb14610381578063761f894e146103a15780637e89f31f146103d557600080fd5b806321a0adb6116101b657806321a0adb6146102ad5780632b7ac3f3146102c2578063414a37ba146102f65780634ecf518b1461031857600080fd5b806304f03273146101e857806312261ee714610210578063156e21521461024b57806317cc915c1461026d575b600080fd5b3480156101f457600080fd5b506101fd610718565b6040519081526020015b60405180910390f35b34801561021c57600080fd5b506102336e22d473030f116ddee9f6b43ac78ba381565b6040516001600160a01b039091168152602001610207565b34801561025757600080fd5b5061026061073b565b6040516102079190611bf0565b34801561027957600080fd5b5061029d610288366004611c0a565b60056020526000908152604090205460ff1681565b6040519015158152602001610207565b6102c06102bb366004611c84565b610776565b005b3480156102ce57600080fd5b506102337f000000000000000000000000000000000000000000000000000000000000000081565b34801561030257600080fd5b506101fd60008051602061253683398151915281565b34801561032457600080fd5b5061034c7f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff9091168152602001610207565b34801561036d57600080fd5b5061029d61037c366004611c0a565b610a55565b34801561038d57600080fd5b506102c061039c366004611ddc565b610ad3565b3480156103ad57600080fd5b506102337f000000000000000000000000000000000000000000000000000000000000000081565b3480156103e157600080fd5b50610260610c4c565b3480156103f657600080fd5b5061029d610405366004611c0a565b60066020526000908152604090205460ff1681565b34801561042657600080fd5b506101fd7f000000000000000000000000000000000000000000000000000000000000000081565b34801561045a57600080fd5b506101fd610469366004611e56565b610c68565b34801561047a57600080fd5b5060035461034c9063ffffffff1681565b34801561049757600080fd5b506102336104a6366004611c0a565b6007602052600090815260409020546001600160a01b031681565b3480156104cd57600080fd5b506104e16104dc366004611e8b565b610e35565b6040516102079190611f02565b3480156104fa57600080fd5b506102c0610509366004611f47565b610ef1565b6102c061051c366004611c0a565b611026565b34801561052d57600080fd5b5060035463ffffffff166000908152600260205260409020546101fd565b34801561055757600080fd5b506101fd610566366004611c0a565b60026020526000908152604090205481565b34801561058457600080fd5b506101fd610593366004611f77565b6110f3565b3480156105a457600080fd5b5061034c601e81565b3480156105b957600080fd5b5061029d6105c8366004611c0a565b60009081526005602052604090205460ff1690565b3480156105e957600080fd5b506101fd6105f8366004611c0a565b60016020526000908152604090205481565b34801561061657600080fd5b506101fd7f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c81565b34801561064a57600080fd5b506102337f000000000000000000000000000000000000000000000000000000000000000081565b34801561067e57600080fd5b506102c061068d366004611fd1565b611160565b34801561069e57600080fd5b506101fd6106ad366004611c0a565b60006020819052908152604090205481565b3480156106cb57600080fd5b506102337f000000000000000000000000000000000000000000000000000000000000000081565b3480156106ff57600080fd5b5060035461034c90640100000000900463ffffffff1681565b6040518060600160405280603b8152602001612556603b91398051906020012081565b6040518060600160405280603b8152602001612556603b91396040516020016107649190612066565b60405160208183030381529060405281565b6002600454036107a15760405162461bcd60e51b8152600401610798906120e9565b60405180910390fd5b60026004557f00000000000000000000000000000000000000000000000000000000000000008211156108165760405162461bcd60e51b815260206004820152601a60248201527f4665652065786365656473207472616e736665722076616c75650000000000006044820152606401610798565b60008581526005602052604090205460ff16156108755760405162461bcd60e51b815260206004820152601f60248201527f546865206e6f746520686173206265656e20616c7265616479207370656e74006044820152606401610798565b61087e86610a55565b6108ca5760405162461bcd60e51b815260206004820152601c60248201527f43616e6e6f742066696e6420796f7572206d65726b6c6520726f6f74000000006044820152606401610798565b6040805160c081018252878152602081018790526001600160a01b038681168284015285811660608301526080820185905260a08201849052915163695ef6f960e01b81527f00000000000000000000000000000000000000000000000000000000000000009092169163695ef6f99161094a918c918c91600401612149565b6020604051808303816000875af1158015610969573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098d9190612191565b6109d25760405162461bcd60e51b815260206004820152601660248201527524b73b30b634b2103bb4ba34323930bb90383937b7b360511b6044820152606401610798565b6000858152600560205260409020805460ff191660011790556109f78484848461131e565b604080516001600160a01b03868116825260208201889052918101849052908416907fe9e508bad6d4c3227e881ca19068f099da81b5164dd6d62b2eaf1e8bc6c349319060600160405180910390a250506001600455505050505050565b6000818103610a6657506000919050565b60035463ffffffff16805b63ffffffff81166000908152600260205260409020548403610a97575060019392505050565b8063ffffffff16600003610aa95750601e5b80610ab3816121c9565b9150508163ffffffff168163ffffffff1603610a71575060009392505050565b600260045403610af55760405162461bcd60e51b8152600401610798906120e9565b60026004558351600090610b29907f00000000000000000000000000000000000000000000000000000000000000006121e9565b9050600085604051602001610b3e9190612206565b60408051808303601f1901815290829052805160209091012063d505accf60e01b82526001600160a01b038981166004840152306024840152604483018590526064830182905260ff8816608484015260a4830187905260c483018690529092507f0000000000000000000000000000000000000000000000000000000000000000169063d505accf9060e401600060405180830381600087803b158015610be557600080fd5b505af1158015610bf9573d6000803e3d6000fd5b50610c349250506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690508830856114c0565b610c3e86886115ec565b505060016004555050505050565b6040518060600160405280603b8152602001612556603b913981565b60006000805160206125368339815191528310610cc75760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c646044820152606401610798565b6000805160206125368339815191528210610d2e5760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b6064820152608401610798565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610d7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da1919061223c565b909250905060008051602061253683398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610e06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2a919061223c565b509695505050505050565b60608167ffffffffffffffff811115610e5057610e50611d12565b604051908082528060200260200182016040528015610e79578160200160208202803683370190505b50905060005b82811015610eea57610eb8848483818110610e9c57610e9c612276565b9050602002013560009081526005602052604090205460ff1690565b15610ee2576001828281518110610ed157610ed1612276565b911515602092830291909101909101525b600101610e7f565b5092915050565b600260045403610f135760405162461bcd60e51b8152600401610798906120e9565b60026004556000828152600760205260409020546001600160a01b03828116911614610f795760405162461bcd60e51b8152602060048201526015602482015274155b985c1c1c9bdd99590818dbdb5b5a5d1b595b9d605a1b6044820152606401610798565b60008281526006602052604090205460ff1615610fa85760405162461bcd60e51b81526004016107989061228c565b6000610fb38361171e565b60008481526006602052604090819020805460ff191660011790555190915083907fa945e51eec50ab98c161376f0db4cf2aeba3ec92755fe2fcd388bdbbb80ff19690611014908490429063ffffffff929092168252602082015260400190565b60405180910390a25050600160045550565b6002600454036110485760405162461bcd60e51b8152600401610798906120e9565b600260045560008181526006602052604090205460ff161561107c5760405162461bcd60e51b81526004016107989061228c565b60006110878261171e565b6000838152600660205260409020805460ff1916600117905590506110aa61193c565b6040805163ffffffff8316815242602082015283917fa945e51eec50ab98c161376f0db4cf2aeba3ec92755fe2fcd388bdbbb80ff196910160405180910390a250506001600455565b60006040518060600160405280603b8152602001612556603b9139805160209182012083518483015160405161114394019283526001600160a01b03919091166020830152604082015260600190565b604051602081830303815290604052805190602001209050919050565b6002600454036111825760405162461bcd60e51b8152600401610798906120e9565b600260045584516000906111b6907f00000000000000000000000000000000000000000000000000000000000000006121e9565b90506000866040516020016111cb9190612206565b60408051601f19818403018152828252805160209182012060a0840183527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316606085019081526080850187905284528382018a905283830189905282518084018452308082528184018890528451808601909552845291830181905293506e22d473030f116ddee9f6b43ac78ba39263137c29fe929091908c90611277906110f3565b6040518060600160405280603b8152602001612556603b91396040516020016112a09190612066565b6040516020818303038152906040528a8a6040518863ffffffff1660e01b81526004016112d397969594939291906122cd565b600060405180830381600087803b1580156112ed57600080fd5b505af1158015611301573d6000803e3d6000fd5b5050505061130f87896115ec565b50506001600455505050505050565b8034146113865760405162461bcd60e51b815260206004820152603060248201527f496e636f727265637420726566756e6420616d6f756e7420726563656976656460448201526f08189e481d1a194818dbdb9d1c9858dd60821b6064820152608401610798565b6113e5846113b4847f000000000000000000000000000000000000000000000000000000000000000061236e565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691906119cb565b811561141f5761141f6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001684846119cb565b80156114ba576000846001600160a01b03168260405160006040518083038185875af1925050503d8060008114611472576040519150601f19603f3d011682016040523d82523d6000602084013e611477565b606091505b50509050806114b8576040516001600160a01b0385169083156108fc029084906000818181858888f193505050501580156114b6573d6000803e3d6000fd5b505b505b50505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291516000928392908816916115249190612381565b6000604051808303816000865af19150503d8060008114611561576040519150601f19603f3d011682016040523d82523d6000602084013e611566565b606091505b50915091508161157857805181602001fd5b805115806115955750808060200190518101906115959190612191565b6114b65760405162461bcd60e51b815260206004820152602260248201527f5361666545524332303a20736166655472616e7366657246726f6d206661696c604482015261195960f21b6064820152608401610798565b60005b825181101561171957600083828151811061160c5761160c612276565b602090810291909101810151600081815260079092526040909120549091506001600160a01b0316156116815760405162461bcd60e51b815260206004820181905260248201527f54686520636f6d6d69746d656e7420686173206265656e2076657269666965646044820152606401610798565b60008181526006602052604090205460ff16156116b05760405162461bcd60e51b81526004016107989061228c565b60008181526007602090815260409182902080546001600160a01b0319166001600160a01b038716908117909155915191825282917fa9b0993cd360203065cdbc30dd334b2a3eb63115cbb64d73246109d8af75a5f9910160405180910390a2506001016115ef565b505050565b600354600090640100000000900463ffffffff1661175d7f000000000000000000000000000000000000000000000000000000000000000060026124b1565b63ffffffff168163ffffffff16036117d05760405162461bcd60e51b815260206004820152603060248201527f4d65726b6c6520747265652069732066756c6c2e204e6f206d6f7265206c656160448201526f1d995cc818d85b88189948185919195960821b6064820152608401610798565b8083600080805b7f000000000000000000000000000000000000000000000000000000000000000063ffffffff168163ffffffff1610156118ae576118166002866124c9565b63ffffffff166000036118505763ffffffff811660009081526001602090815260408083205491839052909120859055849350915061186c565b63ffffffff811660009081526020819052604090205492508391505b6118977f00000000000000000000000000000000000000000000000000000000000000008484610c68565b93506118a46002866124f1565b94506001016117d7565b50600354600090601e906118c99063ffffffff166001612519565b6118d391906124c9565b6003805463ffffffff191663ffffffff831690811790915560009081526002602052604090208590559050611909866001612519565b6003805463ffffffff929092166401000000000267ffffffff000000001990921691909117905550939695505050505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633036119c3576119c16001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001632307f00000000000000000000000000000000000000000000000000000000000000006114c0565b565b6119c1611ae4565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600092839290871691611a279190612381565b6000604051808303816000865af19150503d8060008114611a64576040519150601f19603f3d011682016040523d82523d6000602084013e611a69565b606091505b509150915081611a7b57805181602001fd5b80511580611a98575080806020019051810190611a989190612191565b6114b85760405162461bcd60e51b815260206004820152601e60248201527f5361666545524332303a20736166655472616e73666572206661696c656400006044820152606401610798565b3415611b4b5760405162461bcd60e51b815260206004820152603060248201527f4554482076616c756520697320737570706f73656420746f206265203020666f60448201526f7220455243323020696e7374616e636560801b6064820152608401610798565b6119c16001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633307f00000000000000000000000000000000000000000000000000000000000000006114c0565b60005b83811015611bbb578181015183820152602001611ba3565b50506000910152565b60008151808452611bdc816020860160208601611ba0565b601f01601f19169290920160200192915050565b602081526000611c036020830184611bc4565b9392505050565b600060208284031215611c1c57600080fd5b5035919050565b60008083601f840112611c3557600080fd5b50813567ffffffffffffffff811115611c4d57600080fd5b602083019150836020828501011115611c6557600080fd5b9250929050565b6001600160a01b0381168114611c8157600080fd5b50565b60008060008060008060008060e0898b031215611ca057600080fd5b883567ffffffffffffffff811115611cb757600080fd5b611cc38b828c01611c23565b90995097505060208901359550604089013594506060890135611ce581611c6c565b93506080890135611cf581611c6c565b979a969950949793969295929450505060a08201359160c0013590565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611d5157611d51611d12565b604052919050565b600082601f830112611d6a57600080fd5b813567ffffffffffffffff811115611d8457611d84611d12565b8060051b611d9460208201611d28565b91825260208185018101929081019086841115611db057600080fd5b6020860192505b83831015611dd2578235825260209283019290910190611db7565b9695505050505050565b600080600080600060a08688031215611df457600080fd5b8535611dff81611c6c565b9450602086013567ffffffffffffffff811115611e1b57600080fd5b611e2788828901611d59565b945050604086013560ff81168114611e3e57600080fd5b94979396509394606081013594506080013592915050565b600080600060608486031215611e6b57600080fd5b8335611e7681611c6c565b95602085013595506040909401359392505050565b60008060208385031215611e9e57600080fd5b823567ffffffffffffffff811115611eb557600080fd5b8301601f81018513611ec657600080fd5b803567ffffffffffffffff811115611edd57600080fd5b8560208260051b8401011115611ef257600080fd5b6020919091019590945092505050565b602080825282518282018190526000918401906040840190835b81811015611f3c5783511515835260209384019390920191600101611f1c565b509095945050505050565b60008060408385031215611f5a57600080fd5b823591506020830135611f6c81611c6c565b809150509250929050565b60006040828403128015611f8a57600080fd5b506040805190810167ffffffffffffffff81118282101715611fae57611fae611d12565b6040528235611fbc81611c6c565b81526020928301359281019290925250919050565b60008060008060008060a08789031215611fea57600080fd5b8635611ff581611c6c565b9550602087013567ffffffffffffffff81111561201157600080fd5b61201d89828a01611d59565b9550506040870135935060608701359250608087013567ffffffffffffffff81111561204857600080fd5b61205489828a01611c23565b979a9699509497509295939492505050565b7f5065726d6974436f6d6d69746d656e7473207769746e6573732900000000000081526000825161209e81601a850160208701611ba0565b7f546f6b656e5065726d697373696f6e73286164647265737320746f6b656e2c75601a9390910192830152506d696e7432353620616d6f756e742960901b603a820152604801919050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60e08152600061215d60e083018587612120565b9050602082018360005b6006811015612186578151835260209283019290910190600101612167565b505050949350505050565b6000602082840312156121a357600080fd5b81518015158114611c0357600080fd5b634e487b7160e01b600052601160045260246000fd5b600063ffffffff8216806121df576121df6121b3565b6000190192915050565b8082028115828204841417612200576122006121b3565b92915050565b8151600090829060208501835b82811015612231578151845260209384019390910190600101612213565b509195945050505050565b6000806040838503121561224f57600080fd5b505080516020909101519092909150565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60208082526021908201527f54686520636f6d6d69746d656e7420686173206265656e207375626d697474656040820152601960fa1b606082015260800190565b6122eb81895180516001600160a01b03168252602090810151910152565b602088015160408201526040880151606082015261231f608082018880516001600160a01b03168252602090810151910152565b60018060a01b03861660c08201528460e0820152610140610100820152600061234c610140830186611bc4565b828103610120840152612360818587612120565b9a9950505050505050505050565b81810381811115612200576122006121b3565b60008251612393818460208701611ba0565b9190910192915050565b6001815b60018411156123d8578085048111156123bc576123bc6121b3565b60018416156123ca57908102905b60019390931c9280026123a1565b935093915050565b6000826123ef57506001612200565b816123fc57506000612200565b8160018114612412576002811461241c5761244d565b6001915050612200565b60ff84111561242d5761242d6121b3565b6001841b915063ffffffff821115612447576124476121b3565b50612200565b5060208310610133831016604e8410600b8410161715612484575081810a63ffffffff81111561247f5761247f6121b3565b612200565b61249363ffffffff848461239d565b8063ffffffff048211156124a9576124a96121b3565b029392505050565b6000611c0363ffffffff841663ffffffff84166123e0565b600063ffffffff8316806124df576124df612260565b8063ffffffff84160691505092915050565b600063ffffffff83168061250757612507612260565b8063ffffffff84160491505092915050565b63ffffffff8181168382160190811115612200576122006121b356fe30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000015065726d6974436f6d6d69746d656e7473286164647265737320696e7374616e63652c6279746573333220636f6d6d69746d656e74734861736829a2646970667358221220154929f9a41ef21e6f1ac58d55712a26e4fe53fb384431d666fe2d06cdf5aaa864736f6c634300081c003330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001"; +const isSuperArgs$N = (xs) => xs.length > 1; +class PermitTornado__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$N(args)) { + super(...args); + } else { + super(_abi$1i, _bytecode$N, args[0]); + } + } + getDeployTransaction(_verifier, _hasher, _denomination, _merkleTreeHeight, _token, _tornadoProxyLight, overrides) { + return super.getDeployTransaction( + _verifier, + _hasher, + _denomination, + _merkleTreeHeight, + _token, + _tornadoProxyLight, + overrides || {} + ); + } + deploy(_verifier, _hasher, _denomination, _merkleTreeHeight, _token, _tornadoProxyLight, overrides) { + return super.deploy( + _verifier, + _hasher, + _denomination, + _merkleTreeHeight, + _token, + _tornadoProxyLight, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$N; + static abi = _abi$1i; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1i); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1i, runner); + } +} + +const _abi$1h = [ + { + inputs: [ + { + internalType: "bytes", + name: "proof", + type: "bytes" + }, + { + internalType: "uint256[6]", + name: "input", + type: "uint256[6]" + } + ], + name: "verifyProof", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$M = "0x6080604052348015600f57600080fd5b5061109e8061001f6000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063695ef6f914610030575b600080fd5b61004361003e366004610eae565b610057565b604051901515815260200160405180910390f35b6000808380602001905181019061006e9190610f5a565b905060005b60088160ff161015610129577f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47828260ff16600881106100b5576100b5610fbe565b6020020151106101175760405162461bcd60e51b815260206004820152602260248201527f76657269666965722d70726f6f662d656c656d656e742d6774652d7072696d656044820152612d7160f01b60648201526084015b60405180910390fd5b8061012181610fea565b915050610073565b50610132610ca2565b6040805180820182528351815260208085015181830152908352815160808082018452858401518285019081526060808801519084015282528351808501855290860151815260a08601518184015281830152838201528151808301835260c0850151815260e0850151918101919091529082015260006101b1610321565b90506000604051806040016040528060008152602001600081525090506101f38183608001516000600781106101e9576101e9610fbe565b60200201516107ec565b905060005b60068110156102df577f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000187826006811061023457610234610fbe565b6020020151106102865760405162461bcd60e51b815260206004820152601f60248201527f76657269666965722d6774652d736e61726b2d7363616c61722d6669656c6400604482015260640161010e565b6102d5826102d0856080015184600161029f9190611009565b600781106102af576102af610fbe565b60200201518a85600681106102c6576102c6610fbe565b602002015161088d565b6107ec565b91506001016101f8565b506103146102f0846000015161091b565b846020015184600001518560200151858760400151896040015189606001516109d5565b9450505050505b92915050565b610329610cf3565b6040805180820182527f2dbfc3ec62a3eee5a3b4b464bcf1f8527bbca12adea0f1f12033cd4f61b0e09181527f19e55bd0b72c126da18665039556776642ff82e2f347f24fcea2475f4db087df6020808301919091529083528151608080820184527f1ae724ab134e5a7c6bd8a116fa5505b259522c0f164a5e8126e3ec7d34465f6e8285019081527e9f1bcdc853f8e3531756bb625b0d1dc014f4ab57c3f79f4f4e2e7ef7e0ead6606080850191909152908352845180860186527f23a8ca5760457e726365b92fd0ceb486665797cd68c35dcffd8e4ae8066691e981527f13ec7182c9fd68331a10f8be0fe885d730de5c7f89aa7d0b7bafaa009bbc9e3e818601528385015285840192909252835180820185527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c28186019081527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed828501528152845180860186527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b81527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa818601528185015285850152835180820185527f2f0c63d0c53b3dfbca27b6b43ae7fbf55a38d78a21470996485b03128accc2088186019081527e556502356e37ed150db2e36531b0f275fd6835c0fc1945922e270b48c48a86828501528152845180860186527f02644c27b5dbd793592a70b735e22c798a5e309fa17a992a7dc2a050e01b298f81527f194776b6a53439d7336f389d2a8f6651e40885f5ca2538b0dc9cb534fb23f7fa818601528185015282860152835180850185527f23df1bc9165e9c1c9b2bc036d8ebdd10e7aeae7e5e8019fde68aec7c818bb23e81527f0b6c92080d37c5fb2ddf30892a33665e5478432ef3f71ac8768ecbbe62c7789281850152818601805191909152845180860186527f1c7b2adf45e046caea000956b2ecb2d8617e710d2a7bb201a95ea276f92307b481527f2b15f07536f45948cf4abe6596637d902ffabb18c8c2f5c151544c294ce4a672818601528151850152845180860186527f1cecfe92882a8c835a47bf01bfa655cf628cbba7f81cf4042179fd13edcd6a3981527f0154bfbb2cb786ca247d4b69183d1751f267bbc7656be8d0f0e7a5a47e2c1101818601528151860152845180860186527f1584616a7423efcc72f69ea84fa0b2bc01433677297f4e8351bebfc15bcd0cda81527f0623755b1488526daa9fecf0e11b110dd6df12c461579d792e1db65af523c8be81860152815190930192909252835180850185527f12fbb5bfca9d61357ba2d641604cf4852e21ef54faa180fe539c18994dc1da5a81527f2f09dd9972a1af5f7bcfccf3d7ab600c9d898ea6d6933150ba0ae228ece17e5f81850152825190910152825180840184527f0adb513796fdf2103022c64151ce05f7c7a6d9200e8d819fa59e654fc4bfe83c81527f2d64f72ef4eddf9ca032058ed2bf691758387e913a77cf99d6a3cfb37c8ba7ee81840152815160a0015282518084019093527f21e7c9bffda74bfd2c4393b6803d775545de6fa89145f4a23476241d9881b66183527f0bbe41e52237ac13eb7b01f3cb999b7394d08734e71b1c3ada62713e17eb560c918301919091525160c0015290565b6040805180820190915260008082526020820152610808610d44565b8351815260208085015181830152835160408301528301516060808301919091526000908360c08460066107d05a03fa9050808061084257fe5b50806108855760405162461bcd60e51b81526020600482015260126024820152711c185a5c9a5b99cb5859190b59985a5b195960721b604482015260640161010e565b505092915050565b60408051808201909152600080825260208201526108a9610d62565b835181526020808501519082015260408101839052600060608360808460076107d05a03fa905080806108d857fe5b50806108855760405162461bcd60e51b81526020600482015260126024820152711c185a5c9a5b99cb5b5d5b0b59985a5b195960721b604482015260640161010e565b6040805180820190915260008082526020820152815115801561094057506020820151155b1561095e575050604080518082019091526000808252602082015290565b6040518060400160405280836000015181526020017f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4784602001516109a3919061101c565b6109cd907f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4761103e565b905292915050565b60408051608080820183528a825260208083018a90528284018890526060808401879052845192830185528b83528282018a9052828501889052820185905283516018808252610320820190955260009491859190839082016103008036833701905050905060005b6004811015610c1f576000610a54826006611051565b9050858260048110610a6857610a68610fbe565b60200201515183610a7a836000611009565b81518110610a8a57610a8a610fbe565b602002602001018181525050858260048110610aa857610aa8610fbe565b60200201516020015183826001610abf9190611009565b81518110610acf57610acf610fbe565b602002602001018181525050848260048110610aed57610aed610fbe565b6020020151515183610b00836002611009565b81518110610b1057610b10610fbe565b602002602001018181525050848260048110610b2e57610b2e610fbe565b6020020151516001602002015183610b47836003611009565b81518110610b5757610b57610fbe565b602002602001018181525050848260048110610b7557610b75610fbe565b602002015160200151600060028110610b9057610b90610fbe565b602002015183610ba1836004611009565b81518110610bb157610bb1610fbe565b602002602001018181525050848260048110610bcf57610bcf610fbe565b602002015160200151600160028110610bea57610bea610fbe565b602002015183610bfb836005611009565b81518110610c0b57610c0b610fbe565b602090810291909101015250600101610a3e565b50610c28610d80565b6000602082602086026020860160086107d05a03fa90508080610c4757fe5b5080610c8d5760405162461bcd60e51b81526020600482015260156024820152741c185a5c9a5b99cb5bdc18dbd9194b59985a5b1959605a1b604482015260640161010e565b505115159d9c50505050505050505050505050565b6040805160a081019091526000606082018181526080830191909152815260208101610ccc610d9e565b8152602001610cee604051806040016040528060008152602001600081525090565b905290565b6040805160e08101909152600060a0820181815260c0830191909152815260208101610d1d610d9e565b8152602001610d2a610d9e565b8152602001610d37610d9e565b8152602001610cee610dbe565b60405180608001604052806004906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b60405180602001604052806001906020820280368337509192915050565b6040518060400160405280610db1610df7565b8152602001610cee610df7565b6040518060e001604052806007905b6040805180820190915260008082526020820152815260200190600190039081610dcd5790505090565b60405180604001604052806002906020820280368337509192915050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610e5457610e54610e15565b604052919050565b600082601f830112610e6d57600080fd5b610e7760c0610e2b565b8060c0840185811115610e8957600080fd5b845b81811015610ea3578035845260209384019301610e8b565b509095945050505050565b60008060e08385031215610ec157600080fd5b823567ffffffffffffffff811115610ed857600080fd5b8301601f81018513610ee957600080fd5b803567ffffffffffffffff811115610f0357610f03610e15565b610f16601f8201601f1916602001610e2b565b818152866020838501011115610f2b57600080fd5b81602084016020830137600060208383010152809450505050610f518460208501610e5c565b90509250929050565b60006101008284031215610f6d57600080fd5b82601f830112610f7c57600080fd5b610100610f8881610e2b565b908301908085831115610f9a57600080fd5b845b83811015610fb4578051835260209283019201610f9c565b5095945050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060ff821660ff810361100057611000610fd4565b60010192915050565b8082018082111561031b5761031b610fd4565b60008261103957634e487b7160e01b600052601260045260246000fd5b500690565b8181038181111561031b5761031b610fd4565b808202811582820484141761031b5761031b610fd456fea2646970667358221220582b0c53304fb81b34031d12ae65a2c10ae44c3d4f7d6f3dffa078ee96b6cf3164736f6c634300081c0033"; +const isSuperArgs$M = (xs) => xs.length > 1; +class Verifier__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$M(args)) { + super(...args); + } else { + super(_abi$1h, _bytecode$M, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$M; + static abi = _abi$1h; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1h); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1h, runner); + } +} + +const _abi$1g = [ + { + inputs: [ + { + internalType: "address", + name: "_governance", + type: "address" + }, + { + internalType: "contract IERC20", + name: "_comp", + type: "address" + }, + { + internalType: "contract IVerifier", + name: "_verifier", + type: "address" + }, + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + }, + { + internalType: "uint256", + name: "_denomination", + type: "uint256" + }, + { + internalType: "uint32", + name: "_merkleTreeHeight", + type: "uint32" + }, + { + internalType: "contract IERC20", + name: "_token", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "commitment", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint32", + name: "leafIndex", + type: "uint32" + }, + { + indexed: false, + internalType: "uint256", + name: "timestamp", + type: "uint256" + } + ], + name: "Deposit", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "bytes32", + name: "nullifierHash", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "relayer", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "fee", + type: "uint256" + } + ], + name: "Withdrawal", + type: "event" + }, + { + inputs: [], + name: "FIELD_SIZE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ROOT_HISTORY_SIZE", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ZERO_VALUE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "claimComp", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "commitments", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "comp", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "currentRootIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "denomination", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_commitment", + type: "bytes32" + } + ], + name: "deposit", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "filledSubtrees", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getLastRoot", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "governance", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + }, + { + internalType: "bytes32", + name: "_left", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_right", + type: "bytes32" + } + ], + name: "hashLeftRight", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [], + name: "hasher", + outputs: [ + { + internalType: "contract IHasher", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + } + ], + name: "isKnownRoot", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + } + ], + name: "isSpent", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "_nullifierHashes", + type: "bytes32[]" + } + ], + name: "isSpentArray", + outputs: [ + { + internalType: "bool[]", + name: "spent", + type: "bool[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "levels", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "nextIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "nullifierHashes", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "roots", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "token", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "verifier", + outputs: [ + { + internalType: "contract IVerifier", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "_proof", + type: "bytes" + }, + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + }, + { + internalType: "address payable", + name: "_recipient", + type: "address" + }, + { + internalType: "address payable", + name: "_relayer", + type: "address" + }, + { + internalType: "uint256", + name: "_fee", + type: "uint256" + }, + { + internalType: "uint256", + name: "_refund", + type: "uint256" + } + ], + name: "withdraw", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "zeros", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$L = "0x610160604052600380546001600160401b031916905534801561002157600080fd5b506040516120673803806120678339810160408190526100409161048f565b848484848484848484808360008263ffffffff16116100b25760405162461bcd60e51b815260206004820152602360248201527f5f6c6576656c732073686f756c642062652067726561746572207468616e207a60448201526265726f60e81b60648201526084015b60405180910390fd5b60208263ffffffff16106101085760405162461bcd60e51b815260206004820152601e60248201527f5f6c6576656c732073686f756c64206265206c657373207468616e203332000060448201526064016100a9565b63ffffffff821660a0526001600160a01b0381166080527f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c60005b8363ffffffff168163ffffffff1610156101905763ffffffff811660009081526001602090815260408083208590559082905290208290556101868383806102aa565b9150600101610143565b506000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b55505060016004558161021e5760405162461bcd60e51b815260206004820152602560248201527f64656e6f6d696e6174696f6e2073686f756c6420626520677265617465722074604482015264068616e20360dc1b60648201526084016100a9565b506001600160a01b0392831660c05260e05250908116610100528a16935061028c925050505760405162461bcd60e51b815260206004820152601a60248201527f496e76616c696420434f4d5020746f6b656e206164647265737300000000000060448201526064016100a9565b5050506001600160a01b03938416610120525050166101405261054e565b600060008051602061204783398151915283106103095760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c6460448201526064016100a9565b60008051602061204783398151915282106103705760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b60648201526084016100a9565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156103bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103e3919061052a565b909250905060008051602061204783398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610448573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061046c919061052a565b509695505050505050565b6001600160a01b038116811461048c57600080fd5b50565b600080600080600080600060e0888a0312156104aa57600080fd5b87516104b581610477565b60208901519097506104c681610477565b60408901519096506104d781610477565b60608901519095506104e881610477565b608089015160a08a0151919550935063ffffffff8116811461050957600080fd5b60c089015190925061051a81610477565b8091505092959891949750929550565b6000806040838503121561053d57600080fd5b505080516020909101519092909150565b60805160a05160c05160e051610100516101205161014051611a4b6105fc6000396000818161017d01526105d40152600081816102e5015261060501526000818161057801528181610ecc01528181610f0601526112600152600081816103690152818161074101528181610e9e015261128401526000818161023801526108aa01526000818161029c01528181610fe7015261108901526000818161051701526111210152611a4b6000f3fe6080604052600436106101665760003560e01c806390eeb02b116100d1578063e5285dcc1161008a578063ed33639f11610064578063ed33639f14610505578063f178e47c14610539578063fc0c546a14610566578063fc7e9c6f1461059a57600080fd5b8063e5285dcc14610474578063e8295588146104a4578063ec732959146104d157600080fd5b806390eeb02b146103ab5780639fa12d0b146103c8578063b214faa5146103f5578063ba70f75714610408578063c2b40ae414610432578063cd87a3b41461045f57600080fd5b80634ecf518b116101235780634ecf518b1461028a5780635aa6e675146102d35780636d9833e314610307578063839df945146103275780638bca6d16146103575780638ea3099e1461038b57600080fd5b8063109d0af81461016b57806317cc915c146101bc5780631bd85bdb146101fc57806321a0adb6146102135780632b7ac3f314610226578063414a37ba1461025a575b600080fd5b34801561017757600080fd5b5061019f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156101c857600080fd5b506101ec6101d73660046114ef565b60056020526000908152604090205460ff1681565b60405190151581526020016101b3565b34801561020857600080fd5b506102116105bf565b005b61021161022136600461152d565b6106e3565b34801561023257600080fd5b5061019f7f000000000000000000000000000000000000000000000000000000000000000081565b34801561026657600080fd5b5061027c6000805160206119f683398151915281565b6040519081526020016101b3565b34801561029657600080fd5b506102be7f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff90911681526020016101b3565b3480156102df57600080fd5b5061019f7f000000000000000000000000000000000000000000000000000000000000000081565b34801561031357600080fd5b506101ec6103223660046114ef565b6109ee565b34801561033357600080fd5b506101ec6103423660046114ef565b60066020526000908152604090205460ff1681565b34801561036357600080fd5b5061027c7f000000000000000000000000000000000000000000000000000000000000000081565b34801561039757600080fd5b5061027c6103a63660046115e6565b610a6c565b3480156103b757600080fd5b506003546102be9063ffffffff1681565b3480156103d457600080fd5b506103e86103e336600461161b565b610c39565b6040516101b39190611692565b6102116104033660046114ef565b610cf5565b34801561041457600080fd5b5060035463ffffffff1660009081526002602052604090205461027c565b34801561043e57600080fd5b5061027c61044d3660046114ef565b60026020526000908152604090205481565b34801561046b57600080fd5b506102be601e81565b34801561048057600080fd5b506101ec61048f3660046114ef565b60009081526005602052604090205460ff1690565b3480156104b057600080fd5b5061027c6104bf3660046114ef565b60016020526000908152604090205481565b3480156104dd57600080fd5b5061027c7f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c81565b34801561051157600080fd5b5061019f7f000000000000000000000000000000000000000000000000000000000000000081565b34801561054557600080fd5b5061027c6105543660046114ef565b60006020819052908152604090205481565b34801561057257600080fd5b5061019f7f000000000000000000000000000000000000000000000000000000000000000081565b3480156105a657600080fd5b506003546102be90640100000000900463ffffffff1681565b6040516370a0823160e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a9059cbb907f00000000000000000000000000000000000000000000000000000000000000009083906370a0823190602401602060405180830381865afa15801561064d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067191906116d7565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156106bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e091906116f0565b50565b60026004540361073a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60026004557f00000000000000000000000000000000000000000000000000000000000000008211156107af5760405162461bcd60e51b815260206004820152601a60248201527f4665652065786365656473207472616e736665722076616c75650000000000006044820152606401610731565b60008581526005602052604090205460ff161561080e5760405162461bcd60e51b815260206004820152601f60248201527f546865206e6f746520686173206265656e20616c7265616479207370656e74006044820152606401610731565b610817866109ee565b6108635760405162461bcd60e51b815260206004820152601c60248201527f43616e6e6f742066696e6420796f7572206d65726b6c6520726f6f74000000006044820152606401610731565b6040805160c081018252878152602081018790526001600160a01b038681168284015285811660608301526080820185905260a08201849052915163695ef6f960e01b81527f00000000000000000000000000000000000000000000000000000000000000009092169163695ef6f9916108e3918c918c91600401611719565b6020604051808303816000875af1158015610902573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092691906116f0565b61096b5760405162461bcd60e51b815260206004820152601660248201527524b73b30b634b2103bb4ba34323930bb90383937b7b360511b6044820152606401610731565b6000858152600560205260409020805460ff1916600117905561099084848484610e2c565b604080516001600160a01b03868116825260208201889052918101849052908416907fe9e508bad6d4c3227e881ca19068f099da81b5164dd6d62b2eaf1e8bc6c349319060600160405180910390a250506001600455505050505050565b60008181036109ff57506000919050565b60035463ffffffff16805b63ffffffff81166000908152600260205260409020548403610a30575060019392505050565b8063ffffffff16600003610a425750601e5b80610a4c8161178f565b9150508163ffffffff168163ffffffff1603610a0a575060009392505050565b60006000805160206119f68339815191528310610acb5760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c646044820152606401610731565b6000805160206119f68339815191528210610b325760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b6064820152608401610731565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610b81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba591906117af565b90925090506000805160206119f683398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610c0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2e91906117af565b509695505050505050565b60608167ffffffffffffffff811115610c5457610c546117e9565b604051908082528060200260200182016040528015610c7d578160200160208202803683370190505b50905060005b82811015610cee57610cbc848483818110610ca057610ca06117ff565b9050602002013560009081526005602052604090205460ff1690565b15610ce6576001828281518110610cd557610cd56117ff565b911515602092830291909101909101525b600101610c83565b5092915050565b600260045403610d475760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610731565b600260045560008181526006602052604090205460ff1615610db55760405162461bcd60e51b815260206004820152602160248201527f54686520636f6d6d69746d656e7420686173206265656e207375626d697474656044820152601960fa1b6064820152608401610731565b6000610dc082610fce565b6000838152600660205260409020805460ff191660011790559050610de36111ec565b6040805163ffffffff8316815242602082015283917fa945e51eec50ab98c161376f0db4cf2aeba3ec92755fe2fcd388bdbbb80ff196910160405180910390a250506001600455565b803414610e945760405162461bcd60e51b815260206004820152603060248201527f496e636f727265637420726566756e6420616d6f756e7420726563656976656460448201526f08189e481d1a194818dbdb9d1c9858dd60821b6064820152608401610731565b610ef384610ec2847f0000000000000000000000000000000000000000000000000000000000000000611815565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691906112aa565b8115610f2d57610f2d6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001684846112aa565b8015610fc8576000846001600160a01b03168260405160006040518083038185875af1925050503d8060008114610f80576040519150601f19603f3d011682016040523d82523d6000602084013e610f85565b606091505b5050905080610fc6576040516001600160a01b0385169083156108fc029084906000818181858888f19350505050158015610fc4573d6000803e3d6000fd5b505b505b50505050565b600354600090640100000000900463ffffffff1661100d7f00000000000000000000000000000000000000000000000000000000000000006002611942565b63ffffffff168163ffffffff16036110805760405162461bcd60e51b815260206004820152603060248201527f4d65726b6c6520747265652069732066756c6c2e204e6f206d6f7265206c656160448201526f1d995cc818d85b88189948185919195960821b6064820152608401610731565b8083600080805b7f000000000000000000000000000000000000000000000000000000000000000063ffffffff168163ffffffff16101561115e576110c660028661195a565b63ffffffff166000036111005763ffffffff811660009081526001602090815260408083205491839052909120859055849350915061111c565b63ffffffff811660009081526020819052604090205492508391505b6111477f00000000000000000000000000000000000000000000000000000000000000008484610a6c565b9350611154600286611982565b9450600101611087565b50600354600090601e906111799063ffffffff1660016119aa565b611183919061195a565b6003805463ffffffff191663ffffffff8316908117909155600090815260026020526040902085905590506111b98660016119aa565b6003805463ffffffff929092166401000000000267ffffffff000000001990921691909117905550939695505050505050565b34156112535760405162461bcd60e51b815260206004820152603060248201527f4554482076616c756520697320737570706f73656420746f206265203020666f60448201526f7220455243323020696e7374616e636560801b6064820152608401610731565b6112a86001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633307f00000000000000000000000000000000000000000000000000000000000000006113c3565b565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b179052915160009283929087169161130691906119c6565b6000604051808303816000865af19150503d8060008114611343576040519150601f19603f3d011682016040523d82523d6000602084013e611348565b606091505b50915091508161135a57805181602001fd5b8051158061137757508080602001905181019061137791906116f0565b610fc65760405162461bcd60e51b815260206004820152601e60248201527f5361666545524332303a20736166655472616e73666572206661696c656400006044820152606401610731565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b179052915160009283929088169161142791906119c6565b6000604051808303816000865af19150503d8060008114611464576040519150601f19603f3d011682016040523d82523d6000602084013e611469565b606091505b50915091508161147b57805181602001fd5b8051158061149857508080602001905181019061149891906116f0565b610fc45760405162461bcd60e51b815260206004820152602260248201527f5361666545524332303a20736166655472616e7366657246726f6d206661696c604482015261195960f21b6064820152608401610731565b60006020828403121561150157600080fd5b5035919050565b6001600160a01b03811681146106e057600080fd5b803561152881611508565b919050565b60008060008060008060008060e0898b03121561154957600080fd5b883567ffffffffffffffff81111561156057600080fd5b8901601f81018b1361157157600080fd5b803567ffffffffffffffff81111561158857600080fd5b8b602082840101111561159a57600080fd5b6020918201995097508901359550604089013594506115bb60608a0161151d565b93506115c960808a0161151d565b979a969950949793969295929450505060a08201359160c0013590565b6000806000606084860312156115fb57600080fd5b833561160681611508565b95602085013595506040909401359392505050565b6000806020838503121561162e57600080fd5b823567ffffffffffffffff81111561164557600080fd5b8301601f8101851361165657600080fd5b803567ffffffffffffffff81111561166d57600080fd5b8560208260051b840101111561168257600080fd5b6020919091019590945092505050565b602080825282518282018190526000918401906040840190835b818110156116cc57835115158352602093840193909201916001016116ac565b509095945050505050565b6000602082840312156116e957600080fd5b5051919050565b60006020828403121561170257600080fd5b8151801515811461171257600080fd5b9392505050565b60e081528260e08201528284610100830137600061010084830101526000610100601f19601f8601168301019050602082018360005b600681101561176e57815183526020928301929091019060010161174f565b505050949350505050565b634e487b7160e01b600052601160045260246000fd5b600063ffffffff8216806117a5576117a5611779565b6000190192915050565b600080604083850312156117c257600080fd5b505080516020909101519092909150565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b8181038181111561182857611828611779565b92915050565b6001815b60018411156118695780850481111561184d5761184d611779565b600184161561185b57908102905b60019390931c928002611832565b935093915050565b60008261188057506001611828565b8161188d57506000611828565b81600181146118a357600281146118ad576118de565b6001915050611828565b60ff8411156118be576118be611779565b6001841b915063ffffffff8211156118d8576118d8611779565b50611828565b5060208310610133831016604e8410600b8410161715611915575081810a63ffffffff81111561191057611910611779565b611828565b61192463ffffffff848461182e565b8063ffffffff0482111561193a5761193a611779565b029392505050565b600061171263ffffffff841663ffffffff8416611871565b600063ffffffff831680611970576119706117d3565b8063ffffffff84160691505092915050565b600063ffffffff831680611998576119986117d3565b8063ffffffff84160491505092915050565b63ffffffff818116838216019081111561182857611828611779565b6000825160005b818110156119e757602081860181015185830152016119cd565b50600092019182525091905056fe30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001a26469706673582212207ba9bd4e8d26bbfcb07faf36daf24a1575b7c43d30b2842a5b2498dac1615c5d64736f6c634300081c003330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001"; +const isSuperArgs$L = (xs) => xs.length > 1; +class CTornado__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$L(args)) { + super(...args); + } else { + super(_abi$1g, _bytecode$L, args[0]); + } + } + getDeployTransaction(_governance, _comp, _verifier, _hasher, _denomination, _merkleTreeHeight, _token, overrides) { + return super.getDeployTransaction( + _governance, + _comp, + _verifier, + _hasher, + _denomination, + _merkleTreeHeight, + _token, + overrides || {} + ); + } + deploy(_governance, _comp, _verifier, _hasher, _denomination, _merkleTreeHeight, _token, overrides) { + return super.deploy( + _governance, + _comp, + _verifier, + _hasher, + _denomination, + _merkleTreeHeight, + _token, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$L; + static abi = _abi$1g; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1g); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1g, runner); + } +} + +var index$B = /*#__PURE__*/Object.freeze({ + __proto__: null, + CTornado__factory: CTornado__factory, + ERC20Tornado__factory: ERC20Tornado__factory, + ETHTornado__factory: ETHTornado__factory, + Echoer__factory: Echoer__factory, + PermitTornado__factory: PermitTornado__factory, + Verifier__factory: Verifier__factory, + interfaces: index$C, + merkleTreeWithHistorySol: index$H, + mocks: index$F, + tornadoProxyLightSol: index$D, + tornadoSol: index$E +}); + +const _abi$1f = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "ApprovalForAll", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "bytes32", + name: "label", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "NewOwner", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "NewResolver", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "NewTTL", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "operator", + type: "address" + } + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "recordExists", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "resolver", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "setApprovalForAll", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "setOwner", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setRecord", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "setResolver", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "label", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "setSubnodeOwner", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "label", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setSubnodeRecord", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setTTL", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "ttl", + outputs: [ + { + internalType: "uint64", + name: "", + type: "uint64" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IENSRegistry__factory { + static abi = _abi$1f; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1f); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1f, runner); + } +} + +const _abi$1e = [ + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "addr", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "string", + name: "key", + type: "string" + } + ], + name: "text", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IENSResolver__factory { + static abi = _abi$1e; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1e); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1e, runner); + } +} + +const _abi$1d = [ + { + inputs: [ + { + internalType: "address", + name: "relayer", + type: "address" + } + ], + name: "getRelayerBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "relayer", + type: "address" + }, + { + internalType: "address", + name: "toResolve", + type: "address" + } + ], + name: "isRelayerRegistered", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IRelayerRegistry__factory { + static abi = _abi$1d; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1d); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1d, runner); + } +} + +const _abi$1c = [ + { + inputs: [ + { + internalType: "address", + name: "_IENSRegistry", + type: "address" + }, + { + internalType: "address", + name: "_IRelayerRegistry", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "ENSRegistry", + outputs: [ + { + internalType: "contract IENSRegistry", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "RelayerRegistry", + outputs: [ + { + internalType: "contract IRelayerRegistry", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "_relayers", + type: "bytes32[]" + }, + { + internalType: "string[]", + name: "_subdomains", + type: "string[]" + } + ], + name: "relayersData", + outputs: [ + { + components: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "bool", + name: "isRegistered", + type: "bool" + }, + { + internalType: "string[20]", + name: "records", + type: "string[20]" + } + ], + internalType: "struct Relayer[]", + name: "", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$K = "0x60c060405234801561001057600080fd5b50604051610b74380380610b7483398101604081905261002f9161004d565b6001600160601b0319606092831b8116608052911b1660a05261009e565b6000806040838503121561005f578182fd5b825161006a81610086565b602084015190925061007b81610086565b809150509250929050565b6001600160a01b038116811461009b57600080fd5b50565b60805160601c60a05160601c610a9b6100d96000398060b2528061040352806104f1525080608e528061013a528061021b5250610a9b6000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631cb120d61461004657806339c16356146100645780634d47d7751461006c575b600080fd5b61004e61008c565b60405161005b9190610891565b60405180910390f35b61004e6100b0565b61007f61007a366004610702565b6100d4565b60405161005b91906108bf565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b606080835167ffffffffffffffff811180156100ef57600080fd5b5060405190808252806020026020018201604052801561012957816020015b6101166105cd565b81526020019060019003908161010e5790505b50905060005b84518110156105c5577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166302571be386838151811061017357fe5b60200260200101516040518263ffffffff1660e01b8152600401610197919061099d565b60206040518083038186803b1580156101af57600080fd5b505afa1580156101c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101e791906106d4565b8282815181106101f357fe5b6020026020010151600001906001600160a01b031690816001600160a01b03168152505060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630178b8bf87848151811061025457fe5b60200260200101516040518263ffffffff1660e01b8152600401610278919061099d565b60206040518083038186803b15801561029057600080fd5b505afa1580156102a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c891906106d4565b905060005b85518110156104005760008784815181106102e457fe5b60200260200101518783815181106102f857fe5b60200260200101516040516020016103109190610875565b60405160208183030381529060405280519060200120604051602001610337929190610867565b60408051601f19818403018152908290528051602090910120631674750f60e21b825291506001600160a01b038416906359d1d43c9061037b9084906004016109a6565b60006040518083038186803b15801561039357600080fd5b505afa1580156103a7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103cf91908101906107dc565b8585815181106103db57fe5b60200260200101516060015183601481106103f257fe5b6020020152506001016102cd565b507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b69fd4ab84848151811061043c57fe5b60200260200101516000015185858151811061045457fe5b6020026020010151600001516040518363ffffffff1660e01b815260040161047d9291906108a5565b60206040518083038186803b15801561049557600080fd5b505afa1580156104a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104cd91906107bc565b8383815181106104d957fe5b602002602001015160400190151590811515815250507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b971a6bf84848151811061052a57fe5b6020026020010151600001516040518263ffffffff1660e01b81526004016105529190610891565b60206040518083038186803b15801561056a57600080fd5b505afa15801561057e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a2919061084f565b8383815181106105ae57fe5b60209081029190910181015101525060010161012f565b509392505050565b604051806080016040528060006001600160a01b0316815260200160008152602001600015158152602001610600610605565b905290565b6040518061028001604052806014905b60608152602001906001900390816106155790505090565b600082601f83011261063d578081fd5b813561065061064b826109f1565b6109ca565b818152915060208083019084810160005b848110156106c9578135870188603f82011261067c57600080fd5b8381013561068c61064b82610a11565b81815260408b818486010111156106a257600080fd5b82818501888401375060009181018601919091528552509282019290820190600101610661565b505050505092915050565b6000602082840312156106e5578081fd5b81516001600160a01b03811681146106fb578182fd5b9392505050565b60008060408385031215610714578081fd5b823567ffffffffffffffff8082111561072b578283fd5b818501915085601f83011261073e578283fd5b813561074c61064b826109f1565b80828252602080830192508086018a82838702890101111561076c578788fd5b8796505b8487101561078e578035845260019690960195928101928101610770565b5090965087013593505050808211156107a5578283fd5b506107b28582860161062d565b9150509250929050565b6000602082840312156107cd578081fd5b815180151581146106fb578182fd5b6000602082840312156107ed578081fd5b815167ffffffffffffffff811115610803578182fd5b8201601f81018413610813578182fd5b805161082161064b82610a11565b818152856020838501011115610835578384fd5b610846826020830160208601610a35565b95945050505050565b600060208284031215610860578081fd5b5051919050565b918252602082015260400190565b60008251610887818460208701610a35565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6000602080830181845280855180835260408601915060408482028701019250838701855b8281101561099057878503603f19018452815180516001600160a01b03168652868101518787015260408082015115159087015260609081015160809187018290529086016103008701895b601481101561097b57888203607f1901835283518051610950818561099d565b61095d82828f8601610a35565b958c0195948c0194601f91909101601f191601925050600101610930565b509650505092850192908501906001016108e4565b5092979650505050505050565b90815260200190565b908152604060208201819052600390820152621d5c9b60ea1b606082015260800190565b60405181810167ffffffffffffffff811182821017156109e957600080fd5b604052919050565b600067ffffffffffffffff821115610a07578081fd5b5060209081020190565b600067ffffffffffffffff821115610a27578081fd5b50601f01601f191660200190565b60005b83811015610a50578181015183820152602001610a38565b83811115610a5f576000848401525b5050505056fea2646970667358221220628a366714cdda82fe91d785ad928e44e4b9f7976ed987e5fef72d207582dbaf64736f6c634300060c0033"; +const isSuperArgs$K = (xs) => xs.length > 1; +class RelayerAggregator__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$K(args)) { + super(...args); + } else { + super(_abi$1c, _bytecode$K, args[0]); + } + } + getDeployTransaction(_IENSRegistry, _IRelayerRegistry, overrides) { + return super.getDeployTransaction( + _IENSRegistry, + _IRelayerRegistry, + overrides || {} + ); + } + deploy(_IENSRegistry, _IRelayerRegistry, overrides) { + return super.deploy( + _IENSRegistry, + _IRelayerRegistry, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$K; + static abi = _abi$1c; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1c); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1c, runner); + } +} + +var index$A = /*#__PURE__*/Object.freeze({ + __proto__: null, + IENSRegistry__factory: IENSRegistry__factory, + IENSResolver__factory: IENSResolver__factory, + IRelayerRegistry__factory: IRelayerRegistry__factory, + RelayerAggregator__factory: RelayerAggregator__factory +}); + +const _abi$1b = [ + { + inputs: [ + { + internalType: "address", + name: "_ensRegistry", + type: "address" + }, + { + internalType: "address", + name: "_relayerRegistry", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "ENSRegistry", + outputs: [ + { + internalType: "contract IENSRegistry", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "RelayerRegistry", + outputs: [ + { + internalType: "contract IRelayerRegistry", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract Governance", + name: "governance", + type: "address" + } + ], + name: "getAllProposals", + outputs: [ + { + components: [ + { + internalType: "address", + name: "proposer", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "forVotes", + type: "uint256" + }, + { + internalType: "uint256", + name: "againstVotes", + type: "uint256" + }, + { + internalType: "bool", + name: "executed", + type: "bool" + }, + { + internalType: "bool", + name: "extended", + type: "bool" + }, + { + internalType: "enum Governance.ProposalState", + name: "state", + type: "uint8" + } + ], + internalType: "struct GovernanceAggregator.Proposal[]", + name: "proposals", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract Governance", + name: "governance", + type: "address" + }, + { + internalType: "address[]", + name: "accs", + type: "address[]" + } + ], + name: "getGovernanceBalances", + outputs: [ + { + internalType: "uint256[]", + name: "amounts", + type: "uint256[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract Governance", + name: "governance", + type: "address" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "getUserData", + outputs: [ + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "uint256", + name: "latestProposalId", + type: "uint256" + }, + { + internalType: "uint256", + name: "latestProposalIdState", + type: "uint256" + }, + { + internalType: "uint256", + name: "timelock", + type: "uint256" + }, + { + internalType: "address", + name: "delegatee", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "_relayers", + type: "bytes32[]" + }, + { + internalType: "string[]", + name: "_subdomains", + type: "string[]" + } + ], + name: "relayersData", + outputs: [ + { + components: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "bool", + name: "isRegistered", + type: "bool" + }, + { + internalType: "string[20]", + name: "records", + type: "string[20]" + } + ], + internalType: "struct Relayer[]", + name: "", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$J = "0x60c060405234801561001057600080fd5b5060405161155d38038061155d83398101604081905261002f9161004d565b6001600160601b0319606092831b8116608052911b1660a05261009e565b6000806040838503121561005f578182fd5b825161006a81610086565b602084015190925061007b81610086565b809150509250929050565b6001600160a01b038116811461009b57600080fd5b50565b60805160601c60a05160601c6114826100db6000398061024b528061059c528061068a52508061022752806102d352806103b452506114826000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063029fcae7146100675780631cb120d61461009057806339c16356146100a55780634d47d775146100ad5780639853d922146100cd578063f4eeefe9146100ed575b600080fd5b61007a610075366004610fa1565b610111565b60405161008791906112ee565b60405180910390f35b610098610225565b6040516100879190611118565b610098610249565b6100c06100bb366004610e93565b61026d565b6040516100879190611210565b6100e06100db366004610dcc565b61075e565b6040516100879190611146565b6101006100fb366004610f69565b6109dd565b60405161008795949392919061135f565b60608167ffffffffffffffff8111801561012a57600080fd5b50604051908082528060200260200182016040528015610154578160200160208202803683370190505b50905060005b8281101561021d57846001600160a01b0316639ae697bf85858481811061017d57fe5b90506020020160208101906101929190610dcc565b6040518263ffffffff1660e01b81526004016101ae9190611118565b60206040518083038186803b1580156101c657600080fd5b505afa1580156101da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fe91906110b5565b82828151811061020a57fe5b602090810291909101015260010161015a565b509392505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b606080835167ffffffffffffffff8111801561028857600080fd5b506040519080825280602002602001820160405280156102c257816020015b6102af610c79565b8152602001906001900390816102a75790505b50905060005b845181101561021d577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166302571be386838151811061030c57fe5b60200260200101516040518263ffffffff1660e01b81526004016103309190611332565b60206040518083038186803b15801561034857600080fd5b505afa15801561035c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103809190610def565b82828151811061038c57fe5b6020026020010151600001906001600160a01b031690816001600160a01b03168152505060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630178b8bf8784815181106103ed57fe5b60200260200101516040518263ffffffff1660e01b81526004016104119190611332565b60206040518083038186803b15801561042957600080fd5b505afa15801561043d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104619190610def565b905060005b855181101561059957600087848151811061047d57fe5b602002602001015187838151811061049157fe5b60200260200101516040516020016104a991906110fc565b604051602081830303815290604052805190602001206040516020016104d09291906110ee565b60408051601f19818403018152908290528051602090910120631674750f60e21b825291506001600160a01b038416906359d1d43c9061051490849060040161133b565b60006040518083038186803b15801561052c57600080fd5b505afa158015610540573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526105689190810190611042565b85858151811061057457fe5b602002602001015160600151836014811061058b57fe5b602002015250600101610466565b507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b69fd4ab8484815181106105d557fe5b6020026020010151600001518585815181106105ed57fe5b6020026020010151600001516040518363ffffffff1660e01b815260040161061692919061112c565b60206040518083038186803b15801561062e57600080fd5b505afa158015610642573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106669190610f4d565b83838151811061067257fe5b602002602001015160400190151590811515815250507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b971a6bf8484815181106106c357fe5b6020026020010151600001516040518263ffffffff1660e01b81526004016106eb9190611118565b60206040518083038186803b15801561070357600080fd5b505afa158015610717573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073b91906110b5565b83838151811061074757fe5b6020908102919091018101510152506001016102c8565b6060816001600160a01b031663da35c6646040518163ffffffff1660e01b815260040160206040518083038186803b15801561079957600080fd5b505afa1580156107ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d191906110b5565b67ffffffffffffffff811180156107e757600080fd5b5060405190808252806020026020018201604052801561082157816020015b61080e610cb1565b8152602001906001900390816108065790505b50905060005b81518110156109d7576000806000806000806000808a6001600160a01b031663013cf08b8a6001016040518263ffffffff1660e01b815260040161086b9190611332565b6101006040518083038186803b15801561088457600080fd5b505afa158015610898573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108bc9190610e0b565b97509750975097509750975097509750604051806101200160405280896001600160a01b03168152602001886001600160a01b03168152602001878152602001868152602001858152602001848152602001831515815260200182151581526020018c6001600160a01b0316633e4f49e68c6001016040518263ffffffff1660e01b815260040161094d9190611332565b60206040518083038186803b15801561096557600080fd5b505afa158015610979573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099d9190611023565b60068111156109a857fe5b8152508a8a815181106109b757fe5b602002602001018190525050505050505050508080600101915050610827565b50919050565b6000806000806000866001600160a01b0316639ae697bf876040518263ffffffff1660e01b8152600401610a119190611118565b60206040518083038186803b158015610a2957600080fd5b505afa158015610a3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6191906110b5565b6040516317977c6160e01b81529095506001600160a01b038816906317977c6190610a90908990600401611118565b60206040518083038186803b158015610aa857600080fd5b505afa158015610abc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae091906110b5565b93508315610b7257604051631f27a4f360e11b81526001600160a01b03881690633e4f49e690610b14908790600401611332565b60206040518083038186803b158015610b2c57600080fd5b505afa158015610b40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b649190611023565b6006811115610b6f57fe5b92505b60405163a72edda360e01b81526001600160a01b0388169063a72edda390610b9e908990600401611118565b60206040518083038186803b158015610bb657600080fd5b505afa158015610bca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bee91906110b5565b604051631976849960e21b81529092506001600160a01b038816906365da126490610c1d908990600401611118565b60206040518083038186803b158015610c3557600080fd5b505afa158015610c49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6d9190610def565b90509295509295909350565b604051806080016040528060006001600160a01b0316815260200160008152602001600015158152602001610cac610cfd565b905290565b6040805161012081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905290610100820190610cac565b6040518061028001604052806014905b6060815260200190600190039081610d0d5790505090565b600082601f830112610d35578081fd5b8135610d48610d43826113b2565b61138b565b818152915060208083019084810160005b84811015610dc1578135870188603f820112610d7457600080fd5b83810135610d84610d43826113d2565b81815260408b81848601011115610d9a57600080fd5b82818501888401375060009181018601919091528552509282019290820190600101610d59565b505050505092915050565b600060208284031215610ddd578081fd5b8135610de881611426565b9392505050565b600060208284031215610e00578081fd5b8151610de881611426565b600080600080600080600080610100898b031215610e27578384fd5b8851610e3281611426565b60208a0151909850610e4381611426565b8097505060408901519550606089015194506080890151935060a0890151925060c0890151610e718161143e565b60e08a0151909250610e828161143e565b809150509295985092959890939650565b60008060408385031215610ea5578182fd5b823567ffffffffffffffff80821115610ebc578384fd5b818501915085601f830112610ecf578384fd5b8135610edd610d43826113b2565b80828252602080830192508086018a828387028901011115610efd578889fd5b8896505b84871015610f1f578035845260019690960195928101928101610f01565b509096508701359350505080821115610f36578283fd5b50610f4385828601610d25565b9150509250929050565b600060208284031215610f5e578081fd5b8151610de88161143e565b60008060408385031215610f7b578182fd5b8235610f8681611426565b91506020830135610f9681611426565b809150509250929050565b600080600060408486031215610fb5578283fd5b8335610fc081611426565b9250602084013567ffffffffffffffff80821115610fdc578384fd5b818601915086601f830112610fef578384fd5b813581811115610ffd578485fd5b8760208083028501011115611010578485fd5b6020830194508093505050509250925092565b600060208284031215611034578081fd5b815160078110610de8578182fd5b600060208284031215611053578081fd5b815167ffffffffffffffff811115611069578182fd5b8201601f81018413611079578182fd5b8051611087610d43826113d2565b81815285602083850101111561109b578384fd5b6110ac8260208301602086016113f6565b95945050505050565b6000602082840312156110c6578081fd5b5051919050565b6001600160a01b03169052565b15159052565b600781106110ea57fe5b9052565b918252602082015260400190565b6000825161110e8184602087016113f6565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b602080825282518282018190526000919060409081850190868401855b8281101561120357815180516001600160a01b031685528681015161118a888701826110cd565b508086015185870152606080820151908601526080808201519086015260a0808201519086015260c0808201516111c3828801826110da565b505060e0808201516111d7828801826110da565b505061010090810151906111ed868201836110e0565b5050610120939093019290850190600101611163565b5091979650505050505050565b6000602080830181845280855180835260408601915060408482028701019250838701855b828110156112e157878503603f19018452815180516001600160a01b03168652868101518787015260408082015115159087015260609081015160809187018290529086016103008701895b60148110156112cc57888203607f19018352835180516112a18185611332565b6112ae82828f86016113f6565b958c0195948c0194601f91909101601f191601925050600101611281565b50965050509285019290850190600101611235565b5092979650505050505050565b6020808252825182820181905260009190848201906040850190845b818110156113265783518352928401929184019160010161130a565b50909695505050505050565b90815260200190565b908152604060208201819052600390820152621d5c9b60ea1b606082015260800190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b60405181810167ffffffffffffffff811182821017156113aa57600080fd5b604052919050565b600067ffffffffffffffff8211156113c8578081fd5b5060209081020190565b600067ffffffffffffffff8211156113e8578081fd5b50601f01601f191660200190565b60005b838110156114115781810151838201526020016113f9565b83811115611420576000848401525b50505050565b6001600160a01b038116811461143b57600080fd5b50565b801515811461143b57600080fdfea26469706673582212209edead2cf5d16a9f09d7d75c5aa042cb00130c9febd0bf0e908fbf9c3f34f1a164736f6c634300060c0033"; +const isSuperArgs$J = (xs) => xs.length > 1; +class Aggregator__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$J(args)) { + super(...args); + } else { + super(_abi$1b, _bytecode$J, args[0]); + } + } + getDeployTransaction(_ensRegistry, _relayerRegistry, overrides) { + return super.getDeployTransaction( + _ensRegistry, + _relayerRegistry, + overrides || {} + ); + } + deploy(_ensRegistry, _relayerRegistry, overrides) { + return super.deploy( + _ensRegistry, + _relayerRegistry, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$J; + static abi = _abi$1b; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1b); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1b, runner); + } +} + +const _abi$1a = [ + { + inputs: [ + { + internalType: "contract Governance", + name: "governance", + type: "address" + } + ], + name: "getAllProposals", + outputs: [ + { + components: [ + { + internalType: "address", + name: "proposer", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "forVotes", + type: "uint256" + }, + { + internalType: "uint256", + name: "againstVotes", + type: "uint256" + }, + { + internalType: "bool", + name: "executed", + type: "bool" + }, + { + internalType: "bool", + name: "extended", + type: "bool" + }, + { + internalType: "enum Governance.ProposalState", + name: "state", + type: "uint8" + } + ], + internalType: "struct GovernanceAggregator.Proposal[]", + name: "proposals", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract Governance", + name: "governance", + type: "address" + }, + { + internalType: "address[]", + name: "accs", + type: "address[]" + } + ], + name: "getGovernanceBalances", + outputs: [ + { + internalType: "uint256[]", + name: "amounts", + type: "uint256[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract Governance", + name: "governance", + type: "address" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "getUserData", + outputs: [ + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "uint256", + name: "latestProposalId", + type: "uint256" + }, + { + internalType: "uint256", + name: "latestProposalIdState", + type: "uint256" + }, + { + internalType: "uint256", + name: "timelock", + type: "uint256" + }, + { + internalType: "address", + name: "delegatee", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$I = "0x608060405234801561001057600080fd5b50610ab8806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063029fcae7146100465780639853d9221461006f578063f4eeefe91461008f575b600080fd5b61005961005436600461082b565b6100b3565b60405161006691906109e3565b60405180910390f35b61008261007d36600461072c565b6101c7565b6040516100669190610919565b6100a261009d3660046107f3565b610446565b604051610066959493929190610a30565b60608167ffffffffffffffff811180156100cc57600080fd5b506040519080825280602002602001820160405280156100f6578160200160208202803683370190505b50905060005b828110156101bf57846001600160a01b0316639ae697bf85858481811061011f57fe5b9050602002016020810190610134919061072c565b6040518263ffffffff1660e01b81526004016101509190610905565b60206040518083038186803b15801561016857600080fd5b505afa15801561017c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a091906108cc565b8282815181106101ac57fe5b60209081029190910101526001016100fc565b509392505050565b6060816001600160a01b031663da35c6646040518163ffffffff1660e01b815260040160206040518083038186803b15801561020257600080fd5b505afa158015610216573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061023a91906108cc565b67ffffffffffffffff8111801561025057600080fd5b5060405190808252806020026020018201604052801561028a57816020015b6102776106e2565b81526020019060019003908161026f5790505b50905060005b8151811015610440576000806000806000806000808a6001600160a01b031663013cf08b8a6001016040518263ffffffff1660e01b81526004016102d49190610a27565b6101006040518083038186803b1580156102ed57600080fd5b505afa158015610301573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610325919061076b565b97509750975097509750975097509750604051806101200160405280896001600160a01b03168152602001886001600160a01b03168152602001878152602001868152602001858152602001848152602001831515815260200182151581526020018c6001600160a01b0316633e4f49e68c6001016040518263ffffffff1660e01b81526004016103b69190610a27565b60206040518083038186803b1580156103ce57600080fd5b505afa1580156103e2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061040691906108ad565b600681111561041157fe5b8152508a8a8151811061042057fe5b602002602001018190525050505050505050508080600101915050610290565b50919050565b6000806000806000866001600160a01b0316639ae697bf876040518263ffffffff1660e01b815260040161047a9190610905565b60206040518083038186803b15801561049257600080fd5b505afa1580156104a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ca91906108cc565b6040516317977c6160e01b81529095506001600160a01b038816906317977c61906104f9908990600401610905565b60206040518083038186803b15801561051157600080fd5b505afa158015610525573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054991906108cc565b935083156105db57604051631f27a4f360e11b81526001600160a01b03881690633e4f49e69061057d908790600401610a27565b60206040518083038186803b15801561059557600080fd5b505afa1580156105a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105cd91906108ad565b60068111156105d857fe5b92505b60405163a72edda360e01b81526001600160a01b0388169063a72edda390610607908990600401610905565b60206040518083038186803b15801561061f57600080fd5b505afa158015610633573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065791906108cc565b604051631976849960e21b81529092506001600160a01b038816906365da126490610686908990600401610905565b60206040518083038186803b15801561069e57600080fd5b505afa1580156106b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d6919061074f565b90509295509295909350565b6040805161012081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290529061010082015290565b60006020828403121561073d578081fd5b813561074881610a5c565b9392505050565b600060208284031215610760578081fd5b815161074881610a5c565b600080600080600080600080610100898b031215610787578384fd5b885161079281610a5c565b60208a01519098506107a381610a5c565b8097505060408901519550606089015194506080890151935060a0890151925060c08901516107d181610a74565b60e08a01519092506107e281610a74565b809150509295985092959890939650565b60008060408385031215610805578182fd5b823561081081610a5c565b9150602083013561082081610a5c565b809150509250929050565b60008060006040848603121561083f578283fd5b833561084a81610a5c565b9250602084013567ffffffffffffffff80821115610866578384fd5b818601915086601f830112610879578384fd5b813581811115610887578485fd5b876020808302850101111561089a578485fd5b6020830194508093505050509250925092565b6000602082840312156108be578081fd5b815160078110610748578182fd5b6000602082840312156108dd578081fd5b5051919050565b6001600160a01b03169052565b15159052565b6007811061090157fe5b9052565b6001600160a01b0391909116815260200190565b602080825282518282018190526000919060409081850190868401855b828110156109d657815180516001600160a01b031685528681015161095d888701826108e4565b508086015185870152606080820151908601526080808201519086015260a0808201519086015260c080820151610996828801826108f1565b505060e0808201516109aa828801826108f1565b505061010090810151906109c0868201836108f7565b5050610120939093019290850190600101610936565b5091979650505050505050565b6020808252825182820181905260009190848201906040850190845b81811015610a1b578351835292840192918401916001016109ff565b50909695505050505050565b90815260200190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b6001600160a01b0381168114610a7157600080fd5b50565b8015158114610a7157600080fdfea2646970667358221220c68e065ff95a2c91c1e5904ff4ba8c709291d5227b10049b437e89d35c33af4d64736f6c634300060c0033"; +const isSuperArgs$I = (xs) => xs.length > 1; +class GovernanceAggregator__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$I(args)) { + super(...args); + } else { + super(_abi$1a, _bytecode$I, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$I; + static abi = _abi$1a; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1a); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$1a, + runner + ); + } +} + +var index$z = /*#__PURE__*/Object.freeze({ + __proto__: null, + Aggregator__factory: Aggregator__factory, + GovernanceAggregator__factory: GovernanceAggregator__factory, + relayerAggregatorSol: index$A +}); + +const _abi$19 = [ + { + inputs: [ + { + internalType: "contract IDeployer", + name: "_deployer", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "addr", + type: "address" + } + ], + name: "Deployed", + type: "event" + }, + { + inputs: [ + { + internalType: "bytes", + name: "_initCode", + type: "bytes" + }, + { + internalType: "bytes32", + name: "_salt", + type: "bytes32" + } + ], + name: "deploy", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "deployer", + outputs: [ + { + internalType: "contract IDeployer", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$H = "0x60a060405234801561001057600080fd5b506040516103a93803806103a98339818101604052602081101561003357600080fd5b50516001600160a01b0381161561004a5780610060565b73ce0042b868300000d44a59004da54a005ffdcf9f5b60601b6001600160601b031916608052604051309032907f09e48df7857bd0c1e0d31bb8a85d42cf1874817895f171c917f6ee2cea73ec2090600090a35060805160601c6102e96100c06000398061010d528061029152506102e96000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80634af63f021461003b578063d5f39488146100e5575b600080fd5b6100e36004803603604081101561005157600080fd5b81019060208101813564010000000081111561006c57600080fd5b82018360208201111561007e57600080fd5b803590602001918460018302840111640100000000831117156100a057600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610109915050565b005b6100ed61028f565b604080516001600160a01b039092168252519081900360200190f35b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634af63f0284846040518363ffffffff1660e01b81526004018080602001838152602001828103825284818151815260200191508051906020019080838360005b8381101561018e578181015183820152602001610176565b50505050905090810190601f1680156101bb5780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b1580156101db57600080fd5b505af11580156101ef573d6000803e3d6000fd5b505050506040513d602081101561020557600080fd5b505190506001600160a01b038116610254576040805162461bcd60e51b815260206004820152600d60248201526c11195c1b1bde4819985a5b1959609a1b604482015290519081900360640190fd5b6040516001600160a01b0382169033907f09e48df7857bd0c1e0d31bb8a85d42cf1874817895f171c917f6ee2cea73ec2090600090a3505050565b7f00000000000000000000000000000000000000000000000000000000000000008156fea26469706673582212209824ac82969e56106968b899123a2ecac48f942b4ed3dcae2ced58022879d32364736f6c634300060c0033"; +const isSuperArgs$H = (xs) => xs.length > 1; +class Deployer__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$H(args)) { + super(...args); + } else { + super(_abi$19, _bytecode$H, args[0]); + } + } + getDeployTransaction(_deployer, overrides) { + return super.getDeployTransaction(_deployer, overrides || {}); + } + deploy(_deployer, overrides) { + return super.deploy(_deployer, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$H; + static abi = _abi$19; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$19); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$19, runner); + } +} + +const _abi$18 = [ + { + inputs: [ + { + internalType: "bytes", + name: "_initCode", + type: "bytes" + }, + { + internalType: "bytes32", + name: "_salt", + type: "bytes32" + } + ], + name: "deploy", + outputs: [ + { + internalType: "address payable", + name: "createdContract", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +class IDeployer__factory { + static abi = _abi$18; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$18); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$18, runner); + } +} + +var index$y = /*#__PURE__*/Object.freeze({ + __proto__: null, + Deployer__factory: Deployer__factory, + IDeployer__factory: IDeployer__factory +}); + +const _abi$17 = [ + { + inputs: [ + { + internalType: "contract IERC20", + name: "_token", + type: "address" + }, + { + internalType: "address", + name: "_spender", + type: "address" + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256" + } + ], + name: "approveExactToken", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class ITornadoRouter__factory { + static abi = _abi$17; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$17); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$17, runner); + } +} + +const _abi$16 = [ + { + inputs: [ + { + internalType: "address", + name: "_governance", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "contract ITornadoInstance", + name: "instance", + type: "address" + }, + { + indexed: false, + internalType: "enum InstanceRegistry.InstanceState", + name: "state", + type: "uint8" + } + ], + name: "InstanceStateUpdated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "tornadoRouter", + type: "address" + } + ], + name: "RouterRegistered", + type: "event" + }, + { + inputs: [], + name: "getAllInstanceAddresses", + outputs: [ + { + internalType: "contract ITornadoInstance[]", + name: "result", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getAllInstances", + outputs: [ + { + components: [ + { + internalType: "contract ITornadoInstance", + name: "addr", + type: "address" + }, + { + components: [ + { + internalType: "bool", + name: "isERC20", + type: "bool" + }, + { + internalType: "contract IERC20", + name: "token", + type: "address" + }, + { + internalType: "enum InstanceRegistry.InstanceState", + name: "state", + type: "uint8" + }, + { + internalType: "uint24", + name: "uniswapPoolSwappingFee", + type: "uint24" + }, + { + internalType: "uint32", + name: "protocolFeePercentage", + type: "uint32" + } + ], + internalType: "struct InstanceRegistry.Instance", + name: "instance", + type: "tuple" + } + ], + internalType: "struct InstanceRegistry.Tornado[]", + name: "result", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "instance", + type: "address" + } + ], + name: "getPoolToken", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "governance", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "contract ITornadoInstance", + name: "addr", + type: "address" + }, + { + components: [ + { + internalType: "bool", + name: "isERC20", + type: "bool" + }, + { + internalType: "contract IERC20", + name: "token", + type: "address" + }, + { + internalType: "enum InstanceRegistry.InstanceState", + name: "state", + type: "uint8" + }, + { + internalType: "uint24", + name: "uniswapPoolSwappingFee", + type: "uint24" + }, + { + internalType: "uint32", + name: "protocolFeePercentage", + type: "uint32" + } + ], + internalType: "struct InstanceRegistry.Instance", + name: "instance", + type: "tuple" + } + ], + internalType: "struct InstanceRegistry.Tornado[]", + name: "_instances", + type: "tuple[]" + }, + { + internalType: "address", + name: "_router", + type: "address" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "instanceIds", + outputs: [ + { + internalType: "contract ITornadoInstance", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "", + type: "address" + } + ], + name: "instances", + outputs: [ + { + internalType: "bool", + name: "isERC20", + type: "bool" + }, + { + internalType: "contract IERC20", + name: "token", + type: "address" + }, + { + internalType: "enum InstanceRegistry.InstanceState", + name: "state", + type: "uint8" + }, + { + internalType: "uint24", + name: "uniswapPoolSwappingFee", + type: "uint24" + }, + { + internalType: "uint32", + name: "protocolFeePercentage", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "_instanceId", + type: "uint256" + } + ], + name: "removeInstance", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "router", + outputs: [ + { + internalType: "contract ITornadoRouter", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "instance", + type: "address" + }, + { + internalType: "uint32", + name: "newFee", + type: "uint32" + } + ], + name: "setProtocolFee", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "routerAddress", + type: "address" + } + ], + name: "setTornadoRouter", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "contract ITornadoInstance", + name: "addr", + type: "address" + }, + { + components: [ + { + internalType: "bool", + name: "isERC20", + type: "bool" + }, + { + internalType: "contract IERC20", + name: "token", + type: "address" + }, + { + internalType: "enum InstanceRegistry.InstanceState", + name: "state", + type: "uint8" + }, + { + internalType: "uint24", + name: "uniswapPoolSwappingFee", + type: "uint24" + }, + { + internalType: "uint32", + name: "protocolFeePercentage", + type: "uint32" + } + ], + internalType: "struct InstanceRegistry.Instance", + name: "instance", + type: "tuple" + } + ], + internalType: "struct InstanceRegistry.Tornado", + name: "_tornado", + type: "tuple" + } + ], + name: "updateInstance", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$G = "0x60a060405234801561001057600080fd5b5060405161146738038061146783398101604081905261002f91610044565b60601b6001600160601b031916608052610072565b600060208284031215610055578081fd5b81516001600160a01b038116811461006b578182fd5b9392505050565b60805160601c6113c46100a3600039806103e552806105c052806105ed528061073a52806107e652506113c46000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80636c9be937116100715780636c9be9371461014d578063908e3b371461016057806392b65a4114610173578063b5b899b714610186578063cf552c8914610199578063f887ea40146101ac576100b4565b8063032bb443146100b957806310c13ac3146100e65780631ad058a9146100fb5780634ba16d9d1461011057806352c228e3146101235780635aa6e67514610138575b600080fd5b6100cc6100c7366004610e89565b6101b4565b6040516100dd959493929190611194565b60405180910390f35b6100ee6101fe565b6040516100dd9190611097565b61010e610109366004610ec8565b6102af565b005b61010e61011e366004610e89565b6103da565b61012b61047f565b6040516100dd91906110e4565b6101406105be565b6040516100dd9190611069565b61010e61015b366004610fd3565b6105e2565b61014061016e366004610e89565b610709565b61010e610181366004610f80565b61072f565b610140610194366004611005565b6107b4565b61010e6101a7366004611005565b6107db565b610140610a77565b60016020526000908152604090205460ff8082169161010081046001600160a01b031691600160a81b82041690600160b01b810462ffffff1690600160c81b900463ffffffff1685565b60025460609067ffffffffffffffff8111801561021a57600080fd5b50604051908082528060200260200182016040528015610244578160200160208202803683370190505b50905060005b6002548110156102ab576002818154811061026157fe5b9060005260206000200160009054906101000a90046001600160a01b031682828151811061028b57fe5b6001600160a01b039092166020928302919091019091015260010161024a565b5090565b600054610100900460ff16806102c857506102c8610a8c565b806102d6575060005460ff16155b6102fb5760405162461bcd60e51b81526004016102f290611214565b60405180910390fd5b600054610100900460ff16158015610326576000805460ff1961ff0019909116610100171660011790555b6000805462010000600160b01b031916620100006001600160a01b038516021781555b83518110156103c25761036e84828151811061036157fe5b6020026020010151610a92565b600284828151811061037c57fe5b6020908102919091018101515182546001808201855560009485529290932090920180546001600160a01b0319166001600160a01b039093169290921790915501610349565b5080156103d5576000805461ff00191690555b505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104225760405162461bcd60e51b81526004016102f2906112c2565b6000805462010000600160b01b031916620100006001600160a01b038416021790556040517f94df8c3a8087dce110e5fbc5acf380c83c94bbd31b2c8ed4c08e1396a696e1a890610474908390611069565b60405180910390a150565b60025460609067ffffffffffffffff8111801561049b57600080fd5b506040519080825280602002602001820160405280156104d557816020015b6104c2610d64565b8152602001906001900390816104ba5790505b50905060005b6002548110156102ab576000600282815481106104f457fe5b60009182526020808320909101546040805180820182526001600160a01b03928316808252808652600180865295839020835160a081018552815460ff8082161515835261010082049097168289015292985092969587019592949093850192600160a81b909204169081111561056757fe5b600181111561057257fe5b81529054600160b01b810462ffffff166020830152600160c81b900463ffffffff16604090910152905283518490849081106105aa57fe5b6020908102919091010152506001016104db565b7f000000000000000000000000000000000000000000000000000000000000000081565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461062a5760405162461bcd60e51b81526004016102f2906112c2565b600061063c6080830160608401610fb8565b600181111561064757fe5b14156106655760405162461bcd60e51b81526004016102f29061128b565b6000600160006106786020850185610e89565b6001600160a01b03168152602081019190915260400160002054600160a81b900460ff1660018111156106a757fe5b14156106ef5760026106bc6020830183610e89565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b039092169190911790555b61070661070136839003830183610fea565b610a92565b50565b6001600160a01b038082166000908152600160205260409020546101009004165b919050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146107775760405162461bcd60e51b81526004016102f2906112c2565b6001600160a01b039091166000908152600160205260409020805463ffffffff909216600160c81b0263ffffffff60c81b19909216919091179055565b600281815481106107c157fe5b6000918252602090912001546001600160a01b0316905081565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108235760405162461bcd60e51b81526004016102f2906112c2565b60006002828154811061083257fe5b60009182526020808320909101546001600160a01b03908116808452600190925260409092205490925060ff8116916101009091041681156109705760008054604051636eb1769f60e11b81526001600160a01b038085169263dd62ed3e926108aa926201000090920490911690889060040161107d565b60206040518083038186803b1580156108c257600080fd5b505afa1580156108d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108fa919061101d565b9050801561096e5760008054604051633ef1078360e01b8152620100009091046001600160a01b031691633ef107839161093b9186918991906004016111db565b600060405180830381600087803b15801561095557600080fd5b505af1158015610969573d6000803e3d6000fd5b505050505b505b6001600160a01b038316600090815260016020526040902080546001600160e81b03191690556002805460001981019081106109a857fe5b600091825260209091200154600280546001600160a01b0390921691869081106109ce57fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506002805480610a0757fe5b6001900381819060005260206000200160006101000a8154906001600160a01b0302191690559055826001600160a01b03167f02826f62d88a4d9f1978eb9c06f8663f642d032908e65a915d5898f3585421c06000604051610a6991906111ff565b60405180910390a250505050565b6000546201000090046001600160a01b031681565b303b1590565b60208181015182516001600160a01b0390811660009081526001808552604091829020845181549686015160ff1990971690151517610100600160a81b0319166101009690941695909502929092178085559083015192939291839160ff60a81b191690600160a81b908490811115610b0757fe5b02179055506060820151815460809093015163ffffffff16600160c81b0263ffffffff60c81b1962ffffff909216600160b01b0262ffffff60b01b19909416939093171691909117905560208101515115610d1457600081600001516001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b158015610b9b57600080fd5b505afa158015610baf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd39190610eac565b90508160200151602001516001600160a01b0316816001600160a01b031614610c0e5760405162461bcd60e51b81526004016102f290611262565b600080548351604051636eb1769f60e11b81526001600160a01b038086169363dd62ed3e93610c4b9362010000909204909216919060040161107d565b60206040518083038186803b158015610c6357600080fd5b505afa158015610c77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9b919061101d565b905080610d11576000548351604051633ef1078360e01b8152620100009092046001600160a01b031691633ef1078391610cde91869190600019906004016111db565b600060405180830381600087803b158015610cf857600080fd5b505af1158015610d0c573d6000803e3d6000fd5b505050505b50505b80600001516001600160a01b03167f02826f62d88a4d9f1978eb9c06f8663f642d032908e65a915d5898f3585421c0826020015160400151604051610d5991906111ff565b60405180910390a250565b604051806040016040528060006001600160a01b03168152602001610d87610d8c565b905290565b6040805160a0810182526000808252602082018190529091820190815260006020820181905260409091015290565b8035610dc681611348565b92915050565b803560028110610dc657600080fd5b600081830360c0811215610ded578182fd5b610df760406112ea565b91508235610e0481611348565b825260a0601f1982011215610e1857600080fd5b50610e2360a06112ea565b6020830135610e318161135d565b81526040830135610e4181611348565b6020820152610e538460608501610dcc565b60408201526080830135610e668161136b565b606082015260a0830135610e798161137c565b6080820152602082015292915050565b600060208284031215610e9a578081fd5b8135610ea581611348565b9392505050565b600060208284031215610ebd578081fd5b8151610ea581611348565b60008060408385031215610eda578081fd5b823567ffffffffffffffff811115610ef0578182fd5b8301601f81018513610f00578182fd5b8035610f13610f0e82611311565b6112ea565b808282526020808301925080850160c08a838288028901011115610f35578788fd5b8796505b85871015610f6157610f4b8b83610ddb565b8552600196909601959382019390810190610f39565b5050819650610f7289828a01610dbb565b955050505050509250929050565b60008060408385031215610f92578182fd5b8235610f9d81611348565b91506020830135610fad8161137c565b809150509250929050565b600060208284031215610fc9578081fd5b610ea58383610dcc565b600060c08284031215610fe4578081fd5b50919050565b600060c08284031215610ffb578081fd5b610ea58383610ddb565b600060208284031215611016578081fd5b5035919050565b60006020828403121561102e578081fd5b5051919050565b15159052565b6001600160a01b03169052565b6002811061105257fe5b9052565b62ffffff169052565b63ffffffff169052565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6020808252825182820181905260009190848201906040850190845b818110156110d85783516001600160a01b0316835292840192918401916001016110b3565b50909695505050505050565b602080825282518282018190526000919060409081850190868401855b828110156111875781516111158151611331565b855286015180516111299088870190611035565b868101516111398787018261103b565b5085810151606061114c81880183611048565b8201519050608061115f87820183611056565b9190910151905061117360a086018261105f565b5060c0939093019290850190600101611101565b5091979650505050505050565b85151581526001600160a01b038516602082015260a081016111b58561133d565b604083015262ffffff8416606083015263ffffffff831660808301529695505050505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6020810161120c8361133d565b825292915050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252600f908201526e24b731b7b93932b1ba103a37b5b2b760891b604082015260600190565b6020808252601f908201527f5573652072656d6f7665496e7374616e6365282920666f722072656d6f766500604082015260600190565b6020808252600e908201526d139bdd08185d5d1a1bdc9a5e995960921b604082015260600190565b60405181810167ffffffffffffffff8111828210171561130957600080fd5b604052919050565b600067ffffffffffffffff821115611327578081fd5b5060209081020190565b6001600160a01b031690565b806002811061072a57fe5b6001600160a01b038116811461070657600080fd5b801515811461070657600080fd5b62ffffff8116811461070657600080fd5b63ffffffff8116811461070657600080fdfea26469706673582212207c46c875176b62100d16a46c273e615cd9eb5336dbcd238b33b227f39ff9106564736f6c634300060c0033"; +const isSuperArgs$G = (xs) => xs.length > 1; +class InstanceRegistry__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$G(args)) { + super(...args); + } else { + super(_abi$16, _bytecode$G, args[0]); + } + } + getDeployTransaction(_governance, overrides) { + return super.getDeployTransaction(_governance, overrides || {}); + } + deploy(_governance, overrides) { + return super.deploy(_governance, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$G; + static abi = _abi$16; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$16); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$16, runner); + } +} + +var index$x = /*#__PURE__*/Object.freeze({ + __proto__: null, + ITornadoRouter__factory: ITornadoRouter__factory, + InstanceRegistry__factory: InstanceRegistry__factory +}); + +const _abi$15 = [ + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IENS__factory { + static abi = _abi$15; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$15); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$15, runner); + } +} + +const _abi$14 = [ + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "_instance", + type: "address" + } + ], + name: "instanceFeeWithUpdate", + outputs: [ + { + internalType: "uint160", + name: "", + type: "uint160" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +class IFeeManager__factory { + static abi = _abi$14; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$14); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$14, runner); + } +} + +const _abi$13 = [ + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + }, + { + internalType: "address", + name: "_governance", + type: "address" + }, + { + internalType: "address", + name: "_ens", + type: "address" + }, + { + internalType: "address", + name: "_staking", + type: "address" + }, + { + internalType: "address", + name: "_feeManager", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "minStakeAmount", + type: "uint256" + } + ], + name: "MinimumStakeAmount", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "relayer", + type: "address" + } + ], + name: "RelayerBalanceNullified", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "bytes32", + name: "relayer", + type: "bytes32" + }, + { + indexed: false, + internalType: "string", + name: "ensName", + type: "string" + }, + { + indexed: false, + internalType: "address", + name: "relayerAddress", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "stakedAmount", + type: "uint256" + } + ], + name: "RelayerRegistered", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "relayer", + type: "address" + } + ], + name: "RelayerUnregistered", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "tornadoRouter", + type: "address" + } + ], + name: "RouterRegistered", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "relayer", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "amountStakeAdded", + type: "uint256" + } + ], + name: "StakeAddedToRelayer", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "relayer", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "amountBurned", + type: "uint256" + } + ], + name: "StakeBurned", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "relayer", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "worker", + type: "address" + } + ], + name: "WorkerRegistered", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "relayer", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "worker", + type: "address" + } + ], + name: "WorkerUnregistered", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "address", + name: "relayer", + type: "address" + }, + { + internalType: "contract ITornadoInstance", + name: "pool", + type: "address" + } + ], + name: "burn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "ens", + outputs: [ + { + internalType: "contract IENS", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "feeManager", + outputs: [ + { + internalType: "contract IFeeManager", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "relayer", + type: "address" + } + ], + name: "getRelayerBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "relayer", + type: "address" + } + ], + name: "getRelayerEnsHash", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "governance", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_tornadoRouter", + type: "address" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "toResolve", + type: "address" + } + ], + name: "isRelayer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "relayer", + type: "address" + }, + { + internalType: "address", + name: "toResolve", + type: "address" + } + ], + name: "isRelayerRegistered", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "minStakeAmount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "relayer", + type: "address" + } + ], + name: "nullifyBalance", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "string", + name: "ensName", + type: "string" + }, + { + internalType: "uint256", + name: "stake", + type: "uint256" + }, + { + internalType: "address[]", + name: "workersToRegister", + type: "address[]" + } + ], + name: "register", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "string", + name: "ensName", + type: "string" + }, + { + internalType: "uint256", + name: "stake", + type: "uint256" + }, + { + internalType: "address[]", + name: "workersToRegister", + type: "address[]" + }, + { + internalType: "address", + name: "relayer", + type: "address" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "registerPermit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "relayer", + type: "address" + }, + { + internalType: "address", + name: "worker", + type: "address" + } + ], + name: "registerWorker", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "relayers", + outputs: [ + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "bytes32", + name: "ensHash", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "minAmount", + type: "uint256" + } + ], + name: "setMinStakeAmount", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "tornadoRouterAddress", + type: "address" + } + ], + name: "setTornadoRouter", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "relayer", + type: "address" + }, + { + internalType: "uint256", + name: "stake", + type: "uint256" + } + ], + name: "stakeToRelayer", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "relayer", + type: "address" + }, + { + internalType: "uint256", + name: "stake", + type: "uint256" + }, + { + internalType: "address", + name: "staker", + type: "address" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "stakeToRelayerPermit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "staking", + outputs: [ + { + internalType: "contract TornadoStakingRewards", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract TORN", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "tornadoRouter", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "relayer", + type: "address" + } + ], + name: "unregisterRelayer", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "worker", + type: "address" + } + ], + name: "unregisterWorker", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "workers", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$F = "0x6101206040523480156200001257600080fd5b5060405162001fab38038062001fab83398101604081905262000035916200006d565b6001600160601b0319606095861b811660805293851b841660a05291841b831660c052831b821660e05290911b166101005262000105565b600080600080600060a0868803121562000085578081fd5b85516200009281620000ec565b6020870151909550620000a581620000ec565b6040870151909450620000b881620000ec565b6060870151909350620000cb81620000ec565b6080870151909250620000de81620000ec565b809150509295509295909350565b6001600160a01b03811681146200010257600080fd5b50565b60805160601c60a05160601c60c05160601c60e05160601c6101005160601c611e1662000195600039806106785280610bf352508061075452806108af5280610ea852806111685250806105625280610f99525080610351528061080952806108dc52806109e75280610ce4525080610a205280610aa95280610c375280610e8552806111455250611e166000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c80635aa6e675116100de578063c4d66de811610097578063e37e8bcc11610071578063e37e8bcc14610305578063e43fdb3c14610318578063eb4af0451461032b578063f18876841461033e57610173565b8063c4d66de8146102d7578063d0fb0203146102ea578063d990231d146102f257610173565b80635aa6e6751461026e57806385a2968314610276578063adf898a414610289578063ae53941c14610291578063b69fd4ab146102b1578063b971a6bf146102c457610173565b80634ba16d9d116101305780634ba16d9d146101f75780634cb16c2e1461020a5780634cf088d9146102125780634d4efd041461021a5780635300f8411461022d578063541d55481461024e57610173565b806314d92307146101785780632e6506491461018d5780633523dc85146101a05780633f15457f146101b35780634048a257146101d157806345a11cec146101e4575b600080fd5b61018b610186366004611612565b610346565b005b61018b61019b36600461164a565b610414565b61018b6101ae366004611612565b610460565b6101bb610560565b6040516101c891906118f5565b60405180910390f35b6101bb6101df366004611612565b610584565b61018b6101f2366004611682565b61059f565b61018b610205366004611612565b6107fe565b6101bb610898565b6101bb6108ad565b61018b610228366004611612565b6108d1565b61024061023b366004611612565b6109ac565b6040516101c89291906118cb565b61026161025c366004611612565b6109c5565b6040516101c891906119a1565b6101bb6109e5565b61018b6102843660046116f7565b610a09565b6101bb610aa7565b6102a461029f366004611612565b610acb565b6040516101c891906119ac565b6102616102bf36600461164a565b610af9565b6102a46102d2366004611612565b610b20565b61018b6102e5366004611612565b610b4b565b6101bb610bf1565b61018b6103003660046116cc565b610c15565b61018b6103133660046117fc565b610c20565b61018b610326366004611785565b610cc4565b61018b6103393660046118b3565b610cd9565b6102a4610d56565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146103975760405162461bcd60e51b815260040161038e90611ae4565b60405180910390fd5b6103a0816108d1565b6001600160a01b038116600090815260026020908152604080832083815560010183905560039091529081902080546001600160a01b0319169055517f490a66cc56c789979052c7052fc0c10a6c4627d8e6165caec80db97a4c383521906104099083906118f5565b60405180910390a150565b3360008181526003602052604090205483906001600160a01b038083169116146104505760405162461bcd60e51b815260040161038e90611c83565b61045a8484610d5c565b50505050565b6001600160a01b03811633146104a9576001600160a01b038181166000908152600360205260409020541633146104a95760405162461bcd60e51b815260040161038e90611cd8565b6001600160a01b0380821660008181526003602052604090205490911614156104e45760405162461bcd60e51b815260040161038e90611b8b565b6001600160a01b03808216600090815260036020526040908190205490517fb2a8e18b9e887f502d65c1683e60b723fa582a6903ea4e8eb23907a19c1ce8a0926105319216908490611909565b60405180910390a16001600160a01b0316600090815260036020526040902080546001600160a01b0319169055565b7f000000000000000000000000000000000000000000000000000000000000000081565b6003602052600090815260409020546001600160a01b031681565b6000546201000090046001600160a01b031633146105cf5760405162461bcd60e51b815260040161038e90611a64565b6001600160a01b03808416600090815260036020526040902054168061062d576001600160a01b0383811660009081526003602052604090205416156106275760405162461bcd60e51b815260040161038e90611be8565b506107f9565b826001600160a01b0316816001600160a01b03161461065e5760405162461bcd60e51b815260040161038e90611c83565b604051630bbefce160e21b81526000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690632efbf384906106ad9086906004016118f5565b602060405180830381600087803b1580156106c757600080fd5b505af11580156106db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ff919061162e565b6001600160a01b03858116600090815260026020526040902054911691506107279082610df5565b6001600160a01b038086166000908152600260205260409081902092909255905163338610af60e01b81527f00000000000000000000000000000000000000000000000000000000000000009091169063338610af9061078b9084906004016119ac565b600060405180830381600087803b1580156107a557600080fd5b505af11580156107b9573d6000803e3d6000fd5b505050507f659f33fc6677bebf3a9bf3101092792e31f35766d0358e54577bdd91a655f6a084826040516107ee929190611988565b60405180910390a150505b505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108465760405162461bcd60e51b815260040161038e90611ae4565b6000805462010000600160b01b031916620100006001600160a01b038416021790556040517f94df8c3a8087dce110e5fbc5acf380c83c94bbd31b2c8ed4c08e1396a696e1a8906104099083906118f5565b6000546201000090046001600160a01b031681565b7f000000000000000000000000000000000000000000000000000000000000000081565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109195760405162461bcd60e51b815260040161038e90611ae4565b6001600160a01b038082166000818152600360205260409020549091169081146109555760405162461bcd60e51b815260040161038e90611d74565b6001600160a01b03811660009081526002602052604080822091909155517fafa759fb3c68e89eaaba359f0930ab40c24875b73cc9e2f6a38b0180019eb8f3906109a09084906118f5565b60405180910390a15050565b6002602052600090815260409020805460019091015482565b6001600160a01b0390811660009081526003602052604090205416151590565b7f000000000000000000000000000000000000000000000000000000000000000081565b60405163d505accf60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d505accf90610a6190889030908b908a908a908a908a90600401611947565b600060405180830381600087803b158015610a7b57600080fd5b505af1158015610a8f573d6000803e3d6000fd5b50505050610a9e858888610e3e565b50505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001600160a01b03908116600090815260036020908152604080832054909316825260029052206001015490565b6001600160a01b038181166000908152600360205260409020548116908316145b92915050565b6001600160a01b03908116600090815260036020908152604080832054909316825260029052205490565b600054610100900460ff1680610b645750610b64610f4c565b80610b72575060005460ff16155b610b8e5760405162461bcd60e51b815260040161038e90611b3d565b600054610100900460ff16158015610bb9576000805460ff1961ff0019909116610100171660011790555b6000805462010000600160b01b031916620100006001600160a01b038516021790558015610bed576000805461ff00191690555b5050565b7f000000000000000000000000000000000000000000000000000000000000000081565b610bed338383610e3e565b60405163d505accf60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d505accf90610c7890889030908d908a908a908a908a90600401611947565b600060405180830381600087803b158015610c9257600080fd5b505af1158015610ca6573d6000803e3d6000fd5b50505050610cb8858b8b8b8b8b610f52565b50505050505050505050565b610cd2338686868686610f52565b5050505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610d215760405162461bcd60e51b815260040161038e90611ae4565b60018190556040517f404663163d528ec45288abc4389b81bd96fabf858ff57577ebd4ee7f15d7b0a6906104099083906119ac565b60015481565b6001600160a01b038181166000908152600360205260409020541615610d945760405162461bcd60e51b815260040161038e90611b0d565b6001600160a01b038181166000908152600360205260409081902080546001600160a01b03191692851692909217909155517fcde75bd02c5f739608c891bcd9aa6809e6c4a7035ac7b9f3fd5fea756db74724906109a09084908490611909565b6000610e3783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611287565b9392505050565b6001600160a01b0380831660008181526003602052604090205490911614610e785760405162461bcd60e51b815260040161038e90611abf565b610ecd6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016847f0000000000000000000000000000000000000000000000000000000000000000846112b3565b6001600160a01b038216600090815260026020526040902054610ef190829061130b565b6001600160a01b0383166000908152600260205260409081902091909155517f1275dbe2a271b2b822e60f1d44894fa5fb337e7e2dc6a200205b1a5b17c07d6490610f3f9084908490611988565b60405180910390a1505050565b303b1590565b6000610f9386868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061133092505050565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166302571be3836040518263ffffffff1660e01b8152600401610fe391906119ac565b60206040518083038186803b158015610ffb57600080fd5b505afa15801561100f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611033919061162e565b905073d4416b13d2b3a9abae7acd5d6c2bbdbe256864016001600160a01b0382168114156110735760405162461bcd60e51b815260040161038e90611c15565b816001600160a01b0316896001600160a01b0316146110a45760405162461bcd60e51b815260040161038e90611ca9565b6001600160a01b0389811660009081526003602052604090205416156110dc5760405162461bcd60e51b815260040161038e90611bbb565b6001600160a01b03891660009081526002602052604090206001810154156111165760405162461bcd60e51b815260040161038e90611a38565b6001548710156111385760405162461bcd60e51b815260040161038e90611d50565b61118d6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168b7f00000000000000000000000000000000000000000000000000000000000000008a6112b3565b7f1275dbe2a271b2b822e60f1d44894fa5fb337e7e2dc6a200205b1a5b17c07d648a886040516111be929190611988565b60405180910390a1868155600181018490556001600160a01b038a16600081815260036020526040812080546001600160a01b0319169092179091555b8581101561123b57600087878381811061121157fe5b90506020020160208101906112269190611612565b90506112328c82610d5c565b506001016111fb565b507f9ca7c9c762eff27b021608f232b4c4b8f9b8bf9a3d322297e47cc4209a67d5e2848a8a8d8b6040516112739594939291906119b5565b60405180910390a150505050505050505050565b600081848411156112ab5760405162461bcd60e51b815260040161038e9190611a05565b505050900390565b61045a846323b872dd60e01b8585856040516024016112d493929190611923565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261133d565b600082820183811015610e375760405162461bcd60e51b815260040161038e90611a88565b6000610b1a8260006113cc565b6060611392826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166114369092919063ffffffff16565b8051909150156107f957808060200190518101906113b09190611765565b6107f95760405162461bcd60e51b815260040161038e90611d06565b6000818351116113de57506000610b1a565b60006113ea848461144d565b90506113fb848285016001016113cc565b611406858584611492565b6040516020016114179291906118cb565b6040516020818303038152906040528051906020012091505092915050565b606061144584846000856114ae565b949350505050565b6000805b8351818401141580156114855750838184018151811061146d57fe5b6020910101516001600160f81b031916601760f91b14155b15610e3757600101611451565b6000835182840111156114a457600080fd5b5091016020012090565b60606114b985611572565b6114d55760405162461bcd60e51b815260040161038e90611c4c565b60006060866001600160a01b031685876040516114f291906118d9565b60006040518083038185875af1925050503d806000811461152f576040519150601f19603f3d011682016040523d82523d6000602084013e611534565b606091505b509150915081156115485791506114459050565b8051156115585780518082602001fd5b8360405162461bcd60e51b815260040161038e9190611a05565b3b151590565b60008083601f840112611589578182fd5b50813567ffffffffffffffff8111156115a0578182fd5b60208301915083602080830285010111156115ba57600080fd5b9250929050565b60008083601f8401126115d2578182fd5b50813567ffffffffffffffff8111156115e9578182fd5b6020830191508360208285010111156115ba57600080fd5b803560ff81168114610b1a57600080fd5b600060208284031215611623578081fd5b8135610e3781611dc8565b60006020828403121561163f578081fd5b8151610e3781611dc8565b6000806040838503121561165c578081fd5b823561166781611dc8565b9150602083013561167781611dc8565b809150509250929050565b600080600060608486031215611696578081fd5b83356116a181611dc8565b925060208401356116b181611dc8565b915060408401356116c181611dc8565b809150509250925092565b600080604083850312156116de578182fd5b82356116e981611dc8565b946020939093013593505050565b600080600080600080600060e0888a031215611711578283fd5b873561171c81611dc8565b965060208801359550604088013561173381611dc8565b9450606088013593506117498960808a01611601565b925060a0880135915060c0880135905092959891949750929550565b600060208284031215611776578081fd5b81518015158114610e37578182fd5b60008060008060006060868803121561179c578081fd5b853567ffffffffffffffff808211156117b3578283fd5b6117bf89838a016115c1565b90975095506020880135945060408801359150808211156117de578283fd5b506117eb88828901611578565b969995985093965092949392505050565b6000806000806000806000806000806101008b8d03121561181b578283fd5b8a3567ffffffffffffffff80821115611832578485fd5b61183e8e838f016115c1565b909c509a5060208d0135995060408d013591508082111561185d578485fd5b5061186a8d828e01611578565b90985096505060608b013561187e81611dc8565b945060808b013593506118948c60a08d01611601565b925060c08b0135915060e08b013590509295989b9194979a5092959850565b6000602082840312156118c4578081fd5b5035919050565b918252602082015260400190565b600082516118eb818460208701611d9c565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b90815260200190565b600086825260806020830152846080830152848660a084013760a08583018101919091526001600160a01b039390931660408201526060810191909152601f909201601f19169091010192915050565b6000602082528251806020840152611a24816040850160208701611d9c565b601f01601f19169190910160400192915050565b6020808252601290820152717265676973746572656420616c726561647960701b604082015260600190565b6020808252600a90820152696f6e6c792070726f787960b01b604082015260600190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252600b908201526a085c9959da5cdd195c995960aa1b604082015260600190565b6020808252600f908201526e6f6e6c7920676f7665726e616e636560881b604082015260600190565b60208082526016908201527563616e277420737465616c20616e206164647265737360501b604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526016908201527531b0b73a103ab73932b3b4b9ba32b91036b0b9ba32b960511b604082015260600190565b60208082526013908201527231b0b73a103932b3b4b9ba32b91030b3b0b4b760691b604082015260600190565b60208082526013908201527227b7363c9031bab9ba37b6903932b630bcb2b960691b604082015260600190565b6020808252601a908201527f6f6e6c7920756e7772617070656420656e7320646f6d61696e73000000000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252600c908201526b37b7363c903932b630bcb2b960a11b604082015260600190565b60208082526015908201527437b7363c9032b739903237b6b0b4b71037bbb732b960591b604082015260600190565b60208082526014908201527337b7363c9037bbb732b91037b3103bb7b935b2b960611b604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252600a9082015269216d696e5f7374616b6560b01b604082015260600190565b6020808252600e908201526d36bab9ba1031329036b0b9ba32b960911b604082015260600190565b60005b83811015611db7578181015183820152602001611d9f565b8381111561045a5750506000910152565b6001600160a01b0381168114611ddd57600080fd5b5056fea26469706673582212206f4cc4f67dba9ba55aab193d3511cc31e3b32c37cef7bd7df74b3ebff2b3ca5b64736f6c634300060c0033"; +const isSuperArgs$F = (xs) => xs.length > 1; +class RelayerRegistry__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$F(args)) { + super(...args); + } else { + super(_abi$13, _bytecode$F, args[0]); + } + } + getDeployTransaction(_torn, _governance, _ens, _staking, _feeManager, overrides) { + return super.getDeployTransaction( + _torn, + _governance, + _ens, + _staking, + _feeManager, + overrides || {} + ); + } + deploy(_torn, _governance, _ens, _staking, _feeManager, overrides) { + return super.deploy( + _torn, + _governance, + _ens, + _staking, + _feeManager, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$F; + static abi = _abi$13; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$13); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$13, runner); + } +} + +var index$w = /*#__PURE__*/Object.freeze({ + __proto__: null, + IENS__factory: IENS__factory, + IFeeManager__factory: IFeeManager__factory, + RelayerRegistry__factory: RelayerRegistry__factory +}); + +const _abi$12 = [ + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "resolver", + outputs: [ + { + internalType: "contract Resolver", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +class ENS__factory { + static abi = _abi$12; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$12); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$12, runner); + } +} + +const _abi$11 = [ + { + inputs: [ + { + internalType: "bytes32[]", + name: "domains", + type: "bytes32[]" + } + ], + name: "bulkResolve", + outputs: [ + { + internalType: "address[]", + name: "result", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "resolve", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$E = "0x608060405234801561001057600080fd5b5061036d806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80635c23bdf51461003b578063f9e5423414610074575b600080fd5b6100586004803603602081101561005157600080fd5b5035610167565b604080516001600160a01b039092168252519081900360200190f35b6101176004803603602081101561008a57600080fd5b8101906020810181356401000000008111156100a557600080fd5b8201836020820111156100b757600080fd5b803590602001918460208302840111640100000000831117156100d957600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610292945050505050565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561015357818101518382015260200161013b565b505050509050019250505060405180910390f35b600080610172610333565b60011461019357738595bfb0d940dfedc98943fa8a907091203f25ee6101a4565b6e0c2e074ec69a0dfb2997ba6c7d2e1e5b9050806001600160a01b0316630178b8bf846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156101ea57600080fd5b505afa1580156101fe573d6000803e3d6000fd5b505050506040513d602081101561021457600080fd5b505160408051631d9dabef60e11b81526004810186905290516001600160a01b0390921691633b3b57de91602480820192602092909190829003018186803b15801561025f57600080fd5b505afa158015610273573d6000803e3d6000fd5b505050506040513d602081101561028957600080fd5b50519392505050565b6060815167ffffffffffffffff811180156102ac57600080fd5b506040519080825280602002602001820160405280156102d6578160200160208202803683370190505b50905060005b825181101561032d576103018382815181106102f457fe5b6020026020010151610167565b82828151811061030d57fe5b6001600160a01b03909216602092830291909101909101526001016102dc565b50919050565b469056fea26469706673582212201849a5e31df8347ec61f3d54e8cef603101becea24443df7d4e43cc42ff12a7564736f6c634300060c0033"; +const isSuperArgs$E = (xs) => xs.length > 1; +class EnsResolve__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$E(args)) { + super(...args); + } else { + super(_abi$11, _bytecode$E, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$E; + static abi = _abi$11; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$11); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$11, runner); + } +} + +const _abi$10 = [ + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "addr", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +class Resolver__factory { + static abi = _abi$10; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$10); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$10, runner); + } +} + +var index$v = /*#__PURE__*/Object.freeze({ + __proto__: null, + ENS__factory: ENS__factory, + EnsResolve__factory: EnsResolve__factory, + Resolver__factory: Resolver__factory +}); + +const _abi$$ = [ + { + inputs: [ + { + internalType: "bytes32", + name: "tokenAddress", + type: "bytes32" + }, + { + components: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + internalType: "struct Airdrop.Recipient[]", + name: "targets", + type: "tuple[]" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "domains", + type: "bytes32[]" + } + ], + name: "bulkResolve", + outputs: [ + { + internalType: "address[]", + name: "result", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "addr", + type: "bytes32" + } + ], + name: "resolve", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$D = "0x608060405234801561001057600080fd5b5060405161039938038061039983398101604081905261002f91610220565b8181600061003c836101aa565b90506000816001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161006c91906102e4565b60206040518083038186803b15801561008457600080fd5b505afa158015610098573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100bc91906102cc565b116100e25760405162461bcd60e51b81526004016100d990610311565b60405180910390fd5b60005b82518110156101a557816001600160a01b031663a9059cbb84838151811061010957fe5b60200260200101516000015185848151811061012157fe5b6020026020010151602001516040518363ffffffff1660e01b815260040161014a9291906102f8565b602060405180830381600087803b15801561016457600080fd5b505af1158015610178573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019c91906101f9565b506001016100e5565b506000ff5b60601c90565b6000604082840312156101c1578081fd5b6101cb6040610353565b82519091506001600160a01b03811681146101e557600080fd5b808252506020820151602082015292915050565b60006020828403121561020a578081fd5b81518015158114610219578182fd5b9392505050565b6000806040808486031215610233578182fd5b8351602080860151919450906001600160401b03811115610252578384fd5b8501601f81018713610262578384fd5b805161027561027082610379565b610353565b81815283810190838501868402850186018b1015610291578788fd5b8794505b838510156102bb576102a78b826101b0565b835260019490940193918501918601610295565b508096505050505050509250929050565b6000602082840312156102dd578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b60208082526022908201527f42616c616e636520697320302c2061697264726f7020616c726561647920646f6040820152616e6560f01b606082015260800190565b6040518181016001600160401b038111828210171561037157600080fd5b604052919050565b60006001600160401b0382111561038e578081fd5b506020908102019056fe"; +const isSuperArgs$D = (xs) => xs.length > 1; +class AirdropMock__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$D(args)) { + super(...args); + } else { + super(_abi$$, _bytecode$D, args[0]); + } + } + getDeployTransaction(tokenAddress, targets, overrides) { + return super.getDeployTransaction(tokenAddress, targets, overrides || {}); + } + deploy(tokenAddress, targets, overrides) { + return super.deploy(tokenAddress, targets, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$D; + static abi = _abi$$; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$$); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$$, runner); + } +} + +const _abi$_ = [ + { + inputs: [ + { + internalType: "bytes32", + name: "_node", + type: "bytes32" + } + ], + name: "addr", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes[]", + name: "data", + type: "bytes[]" + } + ], + name: "multicall", + outputs: [ + { + internalType: "bytes[]", + name: "results", + type: "bytes[]" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "registry", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "resolver", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_node", + type: "bytes32" + }, + { + internalType: "address", + name: "_addr", + type: "address" + } + ], + name: "setAddr", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$C = "0x608060405234801561001057600080fd5b5061044b806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80630178b8bf1461005c5780633b3b57de146100855780637ef5029814610098578063ac9650d8146100ab578063d5fa2b00146100cb575b600080fd5b61006f61006a3660046102bc565b6100e0565b60405161007c919061031e565b60405180910390f35b61006f6100933660046102bc565b6100e5565b61006f6100a63660046102bc565b610100565b6100be6100b936600461024d565b61011b565b60405161007c9190610332565b6100de6100d93660046102d4565b61021f565b005b503090565b6000908152602081905260409020546001600160a01b031690565b6000602081905290815260409020546001600160a01b031681565b60608167ffffffffffffffff8111801561013457600080fd5b5060405190808252806020026020018201604052801561016857816020015b60608152602001906001900390816101535790505b50905060005b8281101561021857600060603086868581811061018757fe5b905060200281019061019991906103c9565b6040516101a792919061030e565b600060405180830381855af49150503d80600081146101e2576040519150601f19603f3d011682016040523d82523d6000602084013e6101e7565b606091505b5091509150816101f657600080fd5b8084848151811061020357fe5b6020908102919091010152505060010161016e565b5092915050565b60009182526020829052604090912080546001600160a01b0319166001600160a01b03909216919091179055565b6000806020838503121561025f578182fd5b823567ffffffffffffffff80821115610276578384fd5b818501915085601f830112610289578384fd5b813581811115610297578485fd5b86602080830285010111156102aa578485fd5b60209290920196919550909350505050565b6000602082840312156102cd578081fd5b5035919050565b600080604083850312156102e6578182fd5b8235915060208301356001600160a01b0381168114610303578182fd5b809150509250929050565b6000828483379101908152919050565b6001600160a01b0391909116815260200190565b6000602080830181845280855180835260408601915060408482028701019250838701855b828110156103bc57878503603f1901845281518051808752885b8181101561038c578281018901518882018a01528801610371565b8181111561039c578989838a0101525b50601f01601f191695909501860194509285019290850190600101610357565b5092979650505050505050565b6000808335601e198436030181126103df578283fd5b83018035915067ffffffffffffffff8211156103f9578283fd5b60200191503681900382131561040e57600080fd5b925092905056fea26469706673582212202e44de42b72aec6265acc191876b290bc887c846ffca216ac5d28a16fd49092564736f6c634300060c0033"; +const isSuperArgs$C = (xs) => xs.length > 1; +class ENSMock__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$C(args)) { + super(...args); + } else { + super(_abi$_, _bytecode$C, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$C; + static abi = _abi$_; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$_); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$_, runner); + } +} + +const _abi$Z = [ + { + inputs: [ + { + internalType: "address", + name: "_governance", + type: "address" + }, + { + internalType: "uint256", + name: "_pausePeriod", + type: "uint256" + }, + { + components: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + internalType: "struct TORN.Recipient[]", + name: "_vesting", + type: "tuple[]" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + } + ], + name: "Allowed", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + } + ], + name: "Disallowed", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address" + } + ], + name: "Paused", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address" + } + ], + name: "Unpaused", + type: "event" + }, + { + inputs: [ + { + internalType: "address[]", + name: "target", + type: "address[]" + } + ], + name: "addToAllowedList", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "allowedTransferee", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "blockTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "burn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "burnFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "canUnpauseAfter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "chainID", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "chainId", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bool", + name: "decision", + type: "bool" + } + ], + name: "changeTransferability", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "subtractedValue", + type: "uint256" + } + ], + name: "decreaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "fakeTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "governance", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "addedValue", + type: "uint256" + } + ], + name: "increaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "nonces", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "paused", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "permit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "target", + type: "address[]" + } + ], + name: "removeFromAllowedList", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "_token", + type: "address" + }, + { + internalType: "address payable", + name: "_to", + type: "address" + }, + { + internalType: "uint256", + name: "_balance", + type: "uint256" + } + ], + name: "rescueTokens", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "_chainId", + type: "uint256" + } + ], + name: "setChainId", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "_fakeTimestamp", + type: "uint256" + } + ], + name: "setFakeTimestamp", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$B = "0x60c06040523480156200001157600080fd5b506040516200298e3803806200298e8339810160408190526200003491620006d6565b604080518082018252600b81526a0a8dee4dcc2c8de86c2e6d60ab1b6020808301918252835180850190945260048452632a27a92760e11b90840152815186938693869390926200008891600391620005e4565b5080516200009e906004906020840190620005e4565b50506005805460ff1916601217905550620000b8620001f8565b506008805460ff199081169091556001600160601b0319606085901b1660a0526001600160a01b0384166000908152600960205260408120805490921660011790915583905b82518110156200017b5760008382815181106200011757fe5b60200260200101516000015190506200014f818584815181106200013757fe5b602002602001015160200151620002b460201b60201c565b6001600160a01b03166000908152600960205260409020805460ff1916600190811790915501620000fe565b506200019f836200018b62000397565b620003b360201b62000d721790919060201c565b608052620001ac620003e4565b620001b66200045b565b6a084595161401484a00000014620001eb5760405162461bcd60e51b8152600401620001e290620008a8565b60405180910390fd5b5050505050505062000946565b6000806200020562000461565b905060007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6200023462000467565b805160209182012060408051808201825260018152603160f81b90840152516200028693927fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6918791309101620007be565b60408051601f1981840301815291815281516020928301206000948552600790925290922082905550905090565b6001600160a01b038216620002dd5760405162461bcd60e51b8152600401620001e290620008df565b620002eb6000838362000501565b6200030781600254620003b360201b62000d721790919060201c565b6002556001600160a01b038216600090815260208181526040909120546200033a91839062000d72620003b3821b17901c565b6001600160a01b0383166000818152602081905260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906200038b90859062000916565b60405180910390a35050565b6000620003ae620005bc60201b62000d9e1760201c565b905090565b600082820183811015620003db5760405162461bcd60e51b8152600401620001e290620007ea565b90505b92915050565b60085460ff16156200040a5760405162461bcd60e51b8152600401620001e2906200087e565b6008805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25862000442620005d7565b604051620004519190620007aa565b60405180910390a1565b60025490565b600b5490565b60038054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015620004f75780601f10620004cb57610100808354040283529160200191620004f7565b820191906000526020600020905b815481529060010190602001808311620004d957829003601f168201915b5050505050905090565b62000519838383620005b760201b620007421760201c565b62000523620005db565b15806200054857506001600160a01b03831660009081526009602052604090205460ff165b806200056c57506001600160a01b03821660009081526009602052604090205460ff165b6200058b5760405162461bcd60e51b8152600401620001e29062000858565b6001600160a01b038216301415620005b75760405162461bcd60e51b8152600401620001e29062000821565b505050565b6000600a54600014620005d257600a54620003ae565b504290565b3390565b60085460ff1690565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200062757805160ff191683800117855562000657565b8280016001018555821562000657579182015b82811115620006575782518255916020019190600101906200063a565b506200066592915062000669565b5090565b5b808211156200066557600081556001016200066a565b80516001600160a01b0381168114620003de57600080fd5b600060408284031215620006aa578081fd5b620006b660406200091f565b9050620006c4838362000680565b81526020820151602082015292915050565b600080600060608486031215620006eb578283fd5b620006f7858562000680565b9250602080850151925060408086015160018060401b03808211156200071b578485fd5b818801915088601f8301126200072f578485fd5b8151818111156200073e578586fd5b6200074d85868302016200091f565b8181528581019250838601858302850187018c10156200076b578788fd5b8794505b828510156200079957620007848c8262000698565b8452600194909401939286019285016200076f565b508096505050505050509250925092565b6001600160a01b0391909116815260200190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526017908201527f544f524e3a20696e76616c696420726563697069656e74000000000000000000604082015260600190565b6020808252600c908201526b1513d4938e881c185d5cd95960a21b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252601c908201527f544f524e3a20696e636f727265637420646973747269627574696f6e00000000604082015260600190565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b90815260200190565b6040518181016001600160401b03811182821017156200093e57600080fd5b604052919050565b60805160a05160601c612008620009866000398061056f52806106975280610764528061081d5280610a215250806107bc5280610d2052506120086000f3fe608060405234801561001057600080fd5b50600436106101cf5760003560e01c80637ecebe0011610104578063adb61832116100a2578063d505accf11610071578063d505accf1461038d578063dc0f0d12146103a0578063dd62ed3e146103a8578063ef0e2ff4146103bb576101cf565b8063adb6183214610357578063adc879e91461035f578063c565882714610367578063cea9d26f1461037a576101cf565b806395d89b41116100de57806395d89b41146103215780639a8a059214610329578063a457c2d714610331578063a9059cbb14610344576101cf565b80637ecebe00146102e857806381893c7c146102fb578063885ad0cf1461030e576101cf565b80633c8d76d1116101715780635c975abb1161014b5780635c975abb146102a75780635d4545a0146102af57806370a08231146102c257806379cc6790146102d5576101cf565b80633c8d76d11461026a57806342966c681461027f5780635aa6e67514610292576101cf565b806318160ddd116101ad57806318160ddd1461022757806323b872dd1461022f578063313ce567146102425780633950935114610257576101cf565b806301ec0fab146101d457806306fdde03146101f2578063095ea7b314610207575b600080fd5b6101dc6103ce565b6040516101e99190611e68565b60405180910390f35b6101fa6103d4565b6040516101e99190611943565b61021a610215366004611708565b61046b565b6040516101e991906118ba565b6101dc610489565b61021a61023d366004611653565b61048f565b61024a610516565b6040516101e99190611e71565b61021a610265366004611708565b61051f565b61027d610278366004611733565b61056d565b005b61027d61028d36600461181c565b610681565b61029a610695565b6040516101e9919061188d565b61021a6106b9565b61021a6102bd3660046115ff565b6106c2565b6101dc6102d03660046115ff565b6106d7565b61027d6102e3366004611708565b6106f2565b6101dc6102f63660046115ff565b610747565b61027d6103093660046117d0565b610762565b61027d61031c366004611733565b61081b565b6101fa610922565b6101dc610983565b61021a61033f366004611708565b610989565b61021a610352366004611708565b6109f1565b6101dc610a05565b6101dc610a14565b61027d61037536600461181c565b610a1a565b61027d610388366004611808565b610a1f565b61027d61039b366004611693565b610bdd565b6101dc610d1e565b6101dc6103b636600461161b565b610d42565b61027d6103c936600461181c565b610d6d565b600a5481565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104605780601f1061043557610100808354040283529160200191610460565b820191906000526020600020905b81548152906001019060200180831161044357829003601f168201915b505050505090505b90565b600061047f610478610db7565b8484610dbb565b5060015b92915050565b60025490565b600061049c848484610e6f565b61050c846104a8610db7565b61050785604051806060016040528060288152602001611f62602891396001600160a01b038a166000908152600160205260408120906104e6610db7565b6001600160a01b031681526020810191909152604001600020549190610f84565b610dbb565b5060019392505050565b60055460ff1690565b600061047f61052c610db7565b84610507856001600061053d610db7565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610d72565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661059f610db7565b6001600160a01b0316146105ce5760405162461bcd60e51b81526004016105c590611de4565b60405180910390fd5b60005b815181101561067d576000600960008484815181106105ec57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055507f9ef90a89b00db1a1891a357dc96b2a273add9d883e378c350d22bad87a9d7d3082828151811061065857fe5b602002602001015160405161066d919061188d565b60405180910390a16001016105d1565b5050565b61069261068c610db7565b82610fb0565b50565b7f000000000000000000000000000000000000000000000000000000000000000081565b60085460ff1690565b60096020526000908152604090205460ff1681565b6001600160a01b031660009081526020819052604090205490565b600061072482604051806060016040528060248152602001611f8a6024913961071d866103b6610db7565b9190610f84565b905061073883610732610db7565b83610dbb565b6107428383610fb0565b505050565b6001600160a01b031660009081526006602052604090205490565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610794610db7565b6001600160a01b0316146107ba5760405162461bcd60e51b81526004016105c590611de4565b7f00000000000000000000000000000000000000000000000000000000000000006107e3610a05565b116108005760405162461bcd60e51b81526004016105c590611bd9565b80156108135761080e611092565b610692565b6106926110fe565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661084d610db7565b6001600160a01b0316146108735760405162461bcd60e51b81526004016105c590611de4565b60005b815181101561067d5760016009600084848151811061089157fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055507f77a7dbc6ad97703ad411a8d5edfcd1df382fb34b076a90898b11884f7ebdcc058282815181106108fd57fe5b6020026020010151604051610912919061188d565b60405180910390a1600101610876565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104605780601f1061043557610100808354040283529160200191610460565b600b5481565b600061047f610996610db7565b8461050785604051806060016040528060258152602001611fae60259139600160006109c0610db7565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610f84565b600061047f6109fe610db7565b8484610e6f565b6000610a0f610d9e565b905090565b600b5490565b600a55565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610a51610db7565b6001600160a01b031614610a775760405162461bcd60e51b81526004016105c590611de4565b6001600160a01b038216610a9d5760405162461bcd60e51b81526004016105c590611d58565b6001600160a01b038316610b06574760008215610ac357610abe8284611157565b610ac5565b815b6040519091506001600160a01b0385169082156108fc029083906000818181858888f19350505050158015610afe573d6000803e3d6000fd5b505050610742565b6040516370a0823160e01b81526000906001600160a01b038516906370a0823190610b3590309060040161188d565b60206040518083038186803b158015610b4d57600080fd5b505afa158015610b61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b859190611834565b905060008215610b9e57610b998284611157565b610ba0565b815b905060008111610bc25760405162461bcd60e51b81526004016105c590611e31565b610bd66001600160a01b038616858361116d565b5050505050565b83610be6610a05565b1115610c045760405162461bcd60e51b81526004016105c590611ace565b6001600160a01b0387166000908152600660209081526040808320549051610c57927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9928c928c928c92918c91016118c5565b6040516020818303038152906040528051906020012090506000611901610c7c6111c3565b83604051602001610c8f93929190611868565b6040516020818303038152906040528051906020012090506000610cb582878787611202565b9050896001600160a01b0316816001600160a01b031614610ce85760405162461bcd60e51b81526004016105c590611c20565b6001600160a01b038a16600090815260066020526040902080546001019055610d128a8a8a610dbb565b50505050505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b600b55565b600082820183811015610d975760405162461bcd60e51b81526004016105c590611a60565b9392505050565b6000600a54600014610db257600a54610a0f565b504290565b3390565b6001600160a01b038316610de15760405162461bcd60e51b81526004016105c590611cdd565b6001600160a01b038216610e075760405162461bcd60e51b81526004016105c590611a1e565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610e62908590611e68565b60405180910390a3505050565b6001600160a01b038316610e955760405162461bcd60e51b81526004016105c590611c98565b6001600160a01b038216610ebb5760405162461bcd60e51b81526004016105c5906119ad565b610ec68383836112fa565b610f0381604051806060016040528060268152602001611f3c602691396001600160a01b0386166000908152602081905260409020549190610f84565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610f329082610d72565b6001600160a01b0380841660008181526020819052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610e62908590611e68565b60008184841115610fa85760405162461bcd60e51b81526004016105c59190611943565b505050900390565b6001600160a01b038216610fd65760405162461bcd60e51b81526004016105c590611c57565b610fe2826000836112fa565b61101f81604051806060016040528060228152602001611f1a602291396001600160a01b0385166000908152602081905260409020549190610f84565b6001600160a01b0383166000908152602081905260409020556002546110459082611399565b6002556040516000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611086908590611e68565b60405180910390a35050565b60085460ff166110b45760405162461bcd60e51b81526004016105c5906119f0565b6008805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6110e7610db7565b6040516110f4919061188d565b60405180910390a1565b60085460ff16156111215760405162461bcd60e51b81526004016105c590611b6d565b6008805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586110e7610db7565b60008183106111665781610d97565b5090919050565b6107428363a9059cbb60e01b848460405160240161118c9291906118a1565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526113db565b600080600760006111d2610a14565b8152602081019190915260400160002054905080156111f2579050610468565b6111fa61146a565b915050610468565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08211156112445760405162461bcd60e51b81526004016105c590611b2b565b8360ff16601b148061125957508360ff16601c145b6112755760405162461bcd60e51b81526004016105c590611b97565b60006001868686866040516000815260200160405260405161129a9493929190611925565b6020604051602081039080840390855afa1580156112bc573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166112ef5760405162461bcd60e51b81526004016105c590611976565b90505b949350505050565b611305838383610742565b61130d6106b9565b158061133157506001600160a01b03831660009081526009602052604090205460ff165b8061135457506001600160a01b03821660009081526009602052604090205460ff165b6113705760405162461bcd60e51b81526004016105c590611b05565b6001600160a01b0382163014156107425760405162461bcd60e51b81526004016105c590611a97565b6000610d9783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f84565b6060611430826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166115209092919063ffffffff16565b805190915015610742578080602001905181019061144e91906117ec565b6107425760405162461bcd60e51b81526004016105c590611d9a565b600080611475610a14565b905060007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6114a26103d4565b805160209182012060408051808201825260018152603160f81b90840152516114f293927fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc69187913091016118f9565b60408051601f1981840301815291815281516020928301206000948552600790925290922082905550905090565b60606112f284846000856060611535856115ee565b6115515760405162461bcd60e51b81526004016105c590611d21565b60006060866001600160a01b0316858760405161156e919061184c565b60006040518083038185875af1925050503d80600081146115ab576040519150601f19603f3d011682016040523d82523d6000602084013e6115b0565b606091505b509150915081156115c45791506112f29050565b8051156115d45780518082602001fd5b8360405162461bcd60e51b81526004016105c59190611943565b3b151590565b803561048381611ef6565b600060208284031215611610578081fd5b8135610d9781611ef6565b6000806040838503121561162d578081fd5b823561163881611ef6565b9150602083013561164881611ef6565b809150509250929050565b600080600060608486031215611667578081fd5b833561167281611ef6565b9250602084013561168281611ef6565b929592945050506040919091013590565b600080600080600080600060e0888a0312156116ad578283fd5b87356116b881611ef6565b965060208801356116c881611ef6565b95506040880135945060608801359350608088013560ff811681146116eb578384fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561171a578182fd5b823561172581611ef6565b946020939093013593505050565b60006020808385031215611745578182fd5b823567ffffffffffffffff81111561175b578283fd5b8301601f8101851361176b578283fd5b803561177e61177982611ea6565b611e7f565b818152838101908385018584028501860189101561179a578687fd5b8694505b838510156117c4576117b089826115f4565b83526001949094019391850191850161179e565b50979650505050505050565b6000602082840312156117e1578081fd5b8135610d9781611f0b565b6000602082840312156117fd578081fd5b8151610d9781611f0b565b600080600060608486031215611667578283fd5b60006020828403121561182d578081fd5b5035919050565b600060208284031215611845578081fd5b5051919050565b6000825161185e818460208701611ec6565b9190910192915050565b60f09390931b6001600160f01b03191683526002830191909152602282015260420190565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b9586526001600160a01b0394851660208701529290931660408501526060840152608083019190915260a082015260c00190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b93845260ff9290921660208401526040830152606082015260800190565b6000602082528251806020840152611962816040850160208701611ec6565b601f01601f19169190910160400192915050565b60208082526018908201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604082015260600190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526014908201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604082015260600190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526017908201527f544f524e3a20696e76616c696420726563697069656e74000000000000000000604082015260600190565b6020808252601d908201527f45524332305065726d69743a206578706972656420646561646c696e65000000604082015260600190565b6020808252600c908201526b1513d4938e881c185d5cd95960a21b604082015260600190565b60208082526022908201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604082015261756560f01b606082015260800190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526022908201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604082015261756560f01b606082015260800190565b60208082526027908201527f544f524e3a2063616e6e6f74206368616e6765207472616e736665726162696c6040820152661a5d1e481e595d60ca1b606082015260800190565b6020808252601e908201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604082015260600190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526022908201527f544f524e3a2063616e206e6f742073656e6420746f207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252602d908201527f544f524e3a206f6e6c7920676f7665726e616e63652063616e20706572666f7260408201526c36903a3434b99030b1ba34b7b760991b606082015260800190565b6020808252601e908201527f544f524e3a20747279696e6720746f2073656e6420302062616c616e63650000604082015260600190565b90815260200190565b60ff91909116815260200190565b60405181810167ffffffffffffffff81118282101715611e9e57600080fd5b604052919050565b600067ffffffffffffffff821115611ebc578081fd5b5060209081020190565b60005b83811015611ee1578181015183820152602001611ec9565b83811115611ef0576000848401525b50505050565b6001600160a01b038116811461069257600080fd5b801515811461069257600080fdfe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e20616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220c25cb2cef98080abbebec9b5719a4f46d638fbe559a3ab7a9de64272855c3c1064736f6c634300060c0033"; +const isSuperArgs$B = (xs) => xs.length > 1; +class TORNMock__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$B(args)) { + super(...args); + } else { + super(_abi$Z, _bytecode$B, args[0]); + } + } + getDeployTransaction(_governance, _pausePeriod, _vesting, overrides) { + return super.getDeployTransaction( + _governance, + _pausePeriod, + _vesting, + overrides || {} + ); + } + deploy(_governance, _pausePeriod, _vesting, overrides) { + return super.deploy( + _governance, + _pausePeriod, + _vesting, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$B; + static abi = _abi$Z; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$Z); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$Z, runner); + } +} + +const _abi$Y = [ + { + inputs: [], + name: "blockTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "fakeTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "_fakeTimestamp", + type: "uint256" + } + ], + name: "setFakeTimestamp", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$A = "0x608060405234801561001057600080fd5b5060d28061001f6000396000f3fe6080604052348015600f57600080fd5b5060043610603c5760003560e01c806301ec0fab146041578063adb61832146059578063c565882714605f575b600080fd5b6047607b565b60408051918252519081900360200190f35b60476081565b607960048036036020811015607357600080fd5b50356097565b005b60005481565b60008054156090576000546092565b425b905090565b60005556fea2646970667358221220b2410460a5b24aec9983bcf8349aa3b589a0dff9120af5b704feae536a65813064736f6c634300060c0033"; +const isSuperArgs$A = (xs) => xs.length > 1; +class Timestamp__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$A(args)) { + super(...args); + } else { + super(_abi$Y, _bytecode$A, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$A; + static abi = _abi$Y; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$Y); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$Y, runner); + } +} + +const _abi$X = [ + { + inputs: [ + { + internalType: "address", + name: "_token", + type: "address" + }, + { + internalType: "address", + name: "_beneficiary", + type: "address" + }, + { + internalType: "uint256", + name: "_startTimestamp", + type: "uint256" + }, + { + internalType: "uint256", + name: "_cliffInMonths", + type: "uint256" + }, + { + internalType: "uint256", + name: "_durationInMonths", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "Released", + type: "event" + }, + { + inputs: [], + name: "SECONDS_PER_MONTH", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "beneficiary", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "blockTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "cliffInMonths", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "durationInMonths", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "fakeTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "release", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "released", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "_fakeTimestamp", + type: "uint256" + } + ], + name: "setFakeTimestamp", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "startTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "token", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "vestedAmount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$z = "0x61012060405234801561001157600080fd5b50604051610d2e380380610d2e833981810160405260a081101561003457600080fd5b5080516020820151604083015160608401516080909401519293919290919084848484846001600160a01b0384166100b3576040805162461bcd60e51b815260206004820152601b60248201527f42656e65666963696172792063616e6e6f7420626520656d7074790000000000604482015290519081900360640190fd5b80821115610108576040805162461bcd60e51b815260206004820152601e60248201527f436c6966662069732067726561746572207468616e206475726174696f6e0000604482015290519081900360640190fd5b6001600160601b0319606086811b821660a05285901b1660805261010081905260c082905282156101395782610141565b610141610154565b60e0525061018698505050505050505050565b600061016861016d60201b6105b81760201c565b905090565b600060015460001461018157600154610168565b504290565b60805160601c60a05160601c60c05160e05161010051610b366101f86000398061024452806103bc528061041e52508061019352806101cf52806105725250806102115280610534525080610289528061030952806104b5528061059652508061016d52806104d75250610b366000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c8063928d89ae11610071578063928d89ae146101195780639613252114610121578063adb6183214610129578063c565882714610131578063e6fd48bc1461014e578063fc0c546a14610156576100b4565b806301ec0fab146100b957806310786deb146100d357806338af3eed146100db57806344b1231f146100ff57806367097a4b1461010757806386d1a69f1461010f575b600080fd5b6100c161015e565b60408051918252519081900360200190f35b6100c1610164565b6100e361016b565b604080516001600160a01b039092168252519081900360200190f35b6100c161018f565b6100c161041c565b610117610440565b005b6100c1610532565b6100c1610556565b6100c161055c565b6101176004803603602081101561014757600080fd5b503561056b565b6100c1610570565b6100e3610594565b60015481565b62278d0081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60007f00000000000000000000000000000000000000000000000000000000000000006101ba61055c565b10156101c857506000610419565b60006101fc7f00000000000000000000000000000000000000000000000000000000000000006101f661055c565b906105d1565b9050600061020d8262278d0061061c565b90507f000000000000000000000000000000000000000000000000000000000000000081101561024257600092505050610419565b7f0000000000000000000000000000000000000000000000000000000000000000811061030557604080516370a0823160e01b815230600482015290516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916370a08231916024808301926020929190829003018186803b1580156102cf57600080fd5b505afa1580156102e3573d6000803e3d6000fd5b505050506040513d60208110156102f957600080fd5b50519250610419915050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561037457600080fd5b505afa158015610388573d6000803e3d6000fd5b505050506040513d602081101561039e57600080fd5b505160008054919250906103b390839061065e565b905060006103eb7f00000000000000000000000000000000000000000000000000000000000000006103e584876106b8565b9061061c565b90506000610404600054836105d190919063ffffffff16565b90506104108482610711565b96505050505050505b90565b7f000000000000000000000000000000000000000000000000000000000000000081565b600061044a61018f565b905060008111610498576040805162461bcd60e51b81526020600482015260146024820152734e6f20746f6b656e7320746f2072656c6561736560601b604482015290519081900360640190fd5b6000546104a5908261065e565b6000556104fc6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f000000000000000000000000000000000000000000000000000000000000000083610727565b6040805182815290517ffb81f9b30d73d830c3544b34d827c08142579ee75710b490bab0b3995468c5659181900360200190a150565b7f000000000000000000000000000000000000000000000000000000000000000081565b60005481565b60006105666105b8565b905090565b600155565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60006001546000146105cc57600154610566565b504290565b600061061383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061077e565b90505b92915050565b600061061383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610815565b600082820183811015610613576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000826106c757506000610616565b828202828482816106d457fe5b04146106135760405162461bcd60e51b8152600401808060200182810382526021815260200180610ab66021913960400191505060405180910390fd5b60008183106107205781610613565b5090919050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261077990849061087a565b505050565b6000818484111561080d5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156107d25781810151838201526020016107ba565b50505050905090810190601f1680156107ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836108645760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156107d25781810151838201526020016107ba565b50600083858161087057fe5b0495945050505050565b60606108cf826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661092b9092919063ffffffff16565b805190915015610779578080602001905160208110156108ee57600080fd5b50516107795760405162461bcd60e51b815260040180806020018281038252602a815260200180610ad7602a913960400191505060405180910390fd5b606061093a8484600085610942565b949350505050565b606061094d85610aaf565b61099e576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106109dd5780518252601f1990920191602091820191016109be565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610a3f576040519150601f19603f3d011682016040523d82523d6000602084013e610a44565b606091505b50915091508115610a5857915061093a9050565b805115610a685780518082602001fd5b60405162461bcd60e51b81526020600482018181528651602484015286518793919283926044019190850190808383600083156107d25781810151838201526020016107ba565b3b15159056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220852e02606e74d747094138d7e10fc9f005278a953559d85ca961b67f95c9fa8f64736f6c634300060c0033"; +const isSuperArgs$z = (xs) => xs.length > 1; +class VestingMock__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$z(args)) { + super(...args); + } else { + super(_abi$X, _bytecode$z, args[0]); + } + } + getDeployTransaction(_token, _beneficiary, _startTimestamp, _cliffInMonths, _durationInMonths, overrides) { + return super.getDeployTransaction( + _token, + _beneficiary, + _startTimestamp, + _cliffInMonths, + _durationInMonths, + overrides || {} + ); + } + deploy(_token, _beneficiary, _startTimestamp, _cliffInMonths, _durationInMonths, overrides) { + return super.deploy( + _token, + _beneficiary, + _startTimestamp, + _cliffInMonths, + _durationInMonths, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$z; + static abi = _abi$X; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$X); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$X, runner); + } +} + +const _abi$W = [ + { + inputs: [ + { + internalType: "bytes32", + name: "_torn", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_governance", + type: "bytes32" + }, + { + internalType: "uint256", + name: "_duration", + type: "uint256" + }, + { + components: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + internalType: "struct Voucher.Recipient[]", + name: "_airdrops", + type: "tuple[]" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "allowedTransferee", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "blockTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "domains", + type: "bytes32[]" + } + ], + name: "bulkResolve", + outputs: [ + { + internalType: "address[]", + name: "result", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "subtractedValue", + type: "uint256" + } + ], + name: "decreaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "expiresAt", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "fakeTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "governance", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "addedValue", + type: "uint256" + } + ], + name: "increaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "redeem", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "rescueExpiredTokens", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "addr", + type: "bytes32" + } + ], + name: "resolve", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "_fakeTimestamp", + type: "uint256" + } + ], + name: "setFakeTimestamp", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$y = "0x60e06040523480156200001157600080fd5b5060405162001b7838038062001b78833981016040819052620000349162000476565b8383838360405180606001604052806026815260200162001b5260269139604051806040016040528060058152602001643b2a27a92760d91b8152508160039080519060200190620000889291906200038d565b5080516200009e9060049060208401906200038d565b50506005805460ff1916601217905550620000b984620001b7565b60601b6001600160601b031916608052620000d483620001b7565b60601b6001600160601b03191660c0526200010782620000f3620001bd565b620001d960201b6200089d1790919060201c565b60a05260005b8151811015620001a857620001598282815181106200012857fe5b6020026020010151600001518383815181106200014157fe5b6020026020010151602001516200021160201b60201c565b6001600660008484815181106200016c57fe5b602090810291909101810151516001600160a01b03168252810191909152604001600020805460ff19169115159190911790556001016200010d565b5050505050505050506200061d565b60601c90565b6000620001d4620002f460201b620008c91760201c565b905090565b6000828201838110156200020a5760405162461bcd60e51b8152600401620002019062000548565b60405180910390fd5b9392505050565b6001600160a01b0382166200023a5760405162461bcd60e51b81526004016200020190620005b6565b62000248600083836200030f565b6200026481600254620001d960201b6200089d1790919060201c565b6002556001600160a01b03821660009081526020818152604090912054620002979183906200089d620001d9821b17901c565b6001600160a01b0383166000818152602081905260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90620002e8908590620005ed565b60405180910390a35050565b60006007546000146200030a57600754620001d4565b504290565b620003278383836200038860201b620008e21760201c565b6001600160a01b03821615806200034557506001600160a01b038316155b806200036957506001600160a01b03831660009081526006602052604090205460ff165b620003885760405162461bcd60e51b815260040162000201906200057f565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620003d057805160ff191683800117855562000400565b8280016001018555821562000400579182015b8281111562000400578251825591602001919060010190620003e3565b506200040e92915062000412565b5090565b5b808211156200040e576000815560010162000413565b6000604082840312156200043b578081fd5b620004476040620005f6565b82519091506001600160a01b03811681146200046257600080fd5b808252506020820151602082015292915050565b600080600080608085870312156200048c578384fd5b8451935060208086015193506040808701519350606087015160018060401b0380821115620004b9578485fd5b818901915089601f830112620004cd578485fd5b815181811115620004dc578586fd5b620004eb8586830201620005f6565b8181528581019250838601858302850187018d101562000509578788fd5b8794505b828510156200053757620005228d8262000429565b8452600194909401939286019285016200050d565b50989b979a50959850505050505050565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601e908201527f45524332303a207472616e73666572206973206e6f7420616c6c6f7765640000604082015260600190565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b90815260200190565b6040518181016001600160401b03811182821017156200061557600080fd5b604052919050565b60805160601c60a05160c05160601c6114e46200066e6000398061046952806106de5250806104c352806105f752806106945250806105d3528061066852806106ff52806107a352506114e46000f3fe608060405234801561001057600080fd5b50600436106101425760003560e01c80638622a689116100b8578063adf898a41161007c578063adf898a414610269578063be040fb014610271578063c39ef8551461027b578063c565882714610283578063dd62ed3e14610296578063f9e54234146102a957610142565b80638622a6891461022b57806395d89b4114610233578063a457c2d71461023b578063a9059cbb1461024e578063adb618321461026157610142565b8063313ce5671161010a578063313ce567146101b557806339509351146101ca5780635aa6e675146101dd5780635c23bdf5146101f25780635d4545a01461020557806370a082311461021857610142565b806301ec0fab1461014757806306fdde0314610165578063095ea7b31461017a57806318160ddd1461019a57806323b872dd146101a2575b600080fd5b61014f6102c9565b60405161015c9190611376565b60405180910390f35b61016d6102cf565b60405161015c9190611087565b61018d610188366004610ed7565b610365565b60405161015c919061107c565b61014f610383565b61018d6101b0366004610e97565b610389565b6101bd610410565b60405161015c919061137f565b61018d6101d8366004610ed7565b610419565b6101e5610467565b60405161015c9190611002565b6101e5610200366004610fb6565b61048b565b61018d610213366004610e48565b610491565b61014f610226366004610e48565b6104a6565b61014f6104c1565b61016d6104e5565b61018d610249366004610ed7565b610546565b61018d61025c366004610ed7565b6105ae565b61014f6105c2565b6101e56105d1565b6102796105f5565b005b610279610692565b610279610291366004610fb6565b6107cc565b61014f6102a4366004610e63565b6107d1565b6102bc6102b7366004610f01565b6107fc565b60405161015c919061102f565b60075481565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561035b5780601f106103305761010080835404028352916020019161035b565b820191906000526020600020905b81548152906001019060200180831161033e57829003601f168201915b5050505050905090565b60006103796103726108e7565b84846108eb565b5060015b92915050565b60025490565b600061039684848461099f565b610406846103a26108e7565b61040185604051806060016040528060288152602001611462602891396001600160a01b038a166000908152600160205260408120906103e06108e7565b6001600160a01b031681526020810191909152604001600020549190610ab4565b6108eb565b5060019392505050565b60055460ff1690565b60006103796104266108e7565b8461040185600160006104376108e7565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549061089d565b7f000000000000000000000000000000000000000000000000000000000000000081565b60601c90565b60066020526000908152604090205460ff1681565b6001600160a01b031660009081526020819052604090205490565b7f000000000000000000000000000000000000000000000000000000000000000081565b60048054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561035b5780601f106103305761010080835404028352916020019161035b565b60006103796105536108e7565b846104018560405180606001604052806025815260200161148a602591396001600061057d6108e7565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610ab4565b60006103796105bb6108e7565b848461099f565b60006105cc6108c9565b905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000061061e6105c2565b106106445760405162461bcd60e51b815260040161063b90611176565b60405180910390fd5b600061064f336104a6565b905061065b3382610ae0565b61068f6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163383610bc2565b50565b7f00000000000000000000000000000000000000000000000000000000000000006106bb6105c2565b10156106d95760405162461bcd60e51b815260040161063b906111ad565b6107ca7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016107499190611002565b60206040518083038186803b15801561076157600080fd5b505afa158015610775573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107999190610fce565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169190610bc2565b565b600755565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060815167ffffffffffffffff8111801561081657600080fd5b50604051908082528060200260200182016040528015610840578160200160208202803683370190505b50905060005b82518110156108975761086b83828151811061085e57fe5b602002602001015161048b565b82828151811061087757fe5b6001600160a01b0390921660209283029190910190910152600101610846565b50919050565b6000828201838110156108c25760405162461bcd60e51b815260040161063b9061113f565b9392505050565b60006007546000146108dd576007546105cc565b504290565b505050565b3390565b6001600160a01b0383166109115760405162461bcd60e51b815260040161063b906112b1565b6001600160a01b0382166109375760405162461bcd60e51b815260040161063b906110fd565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610992908590611376565b60405180910390a3505050565b6001600160a01b0383166109c55760405162461bcd60e51b815260040161063b9061126c565b6001600160a01b0382166109eb5760405162461bcd60e51b815260040161063b906110ba565b6109f6838383610c18565b610a338160405180606001604052806026815260200161143c602691396001600160a01b0386166000908152602081905260409020549190610ab4565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610a62908261089d565b6001600160a01b0380841660008181526020819052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610992908590611376565b60008184841115610ad85760405162461bcd60e51b815260040161063b9190611087565b505050900390565b6001600160a01b038216610b065760405162461bcd60e51b815260040161063b9061122b565b610b1282600083610c18565b610b4f8160405180606001604052806022815260200161141a602291396001600160a01b0385166000908152602081905260409020549190610ab4565b6001600160a01b038316600090815260208190526040902055600254610b759082610c7f565b6002556040516000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610bb6908590611376565b60405180910390a35050565b6108e28363a9059cbb60e01b8484604051602401610be1929190611016565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610cc1565b610c238383836108e2565b6001600160a01b0382161580610c4057506001600160a01b038316155b80610c6357506001600160a01b03831660009081526006602052604090205460ff165b6108e25760405162461bcd60e51b815260040161063b906111f4565b60006108c283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ab4565b6060610d16826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610d509092919063ffffffff16565b8051909150156108e25780806020019051810190610d349190610f96565b6108e25760405162461bcd60e51b815260040161063b9061132c565b6060610d5f8484600085610d67565b949350505050565b6060610d7285610e2b565b610d8e5760405162461bcd60e51b815260040161063b906112f5565b60006060866001600160a01b03168587604051610dab9190610fe6565b60006040518083038185875af1925050503d8060008114610de8576040519150601f19603f3d011682016040523d82523d6000602084013e610ded565b606091505b50915091508115610e01579150610d5f9050565b805115610e115780518082602001fd5b8360405162461bcd60e51b815260040161063b9190611087565b3b151590565b80356001600160a01b038116811461037d57600080fd5b600060208284031215610e59578081fd5b6108c28383610e31565b60008060408385031215610e75578081fd5b610e7f8484610e31565b9150610e8e8460208501610e31565b90509250929050565b600080600060608486031215610eab578081fd5b8335610eb681611404565b92506020840135610ec681611404565b929592945050506040919091013590565b60008060408385031215610ee9578182fd5b610ef38484610e31565b946020939093013593505050565b60006020808385031215610f13578182fd5b823567ffffffffffffffff811115610f29578283fd5b8301601f81018513610f39578283fd5b8035610f4c610f47826113b4565b61138d565b8181528381019083850185840285018601891015610f68578687fd5b8694505b83851015610f8a578035835260019490940193918501918501610f6c565b50979650505050505050565b600060208284031215610fa7578081fd5b815180151581146108c2578182fd5b600060208284031215610fc7578081fd5b5035919050565b600060208284031215610fdf578081fd5b5051919050565b60008251610ff88184602087016113d4565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b818110156110705783516001600160a01b03168352928401929184019160010161104b565b50909695505050505050565b901515815260200190565b60006020825282518060208401526110a68160408501602087016113d4565b601f01601f19169190910160400192915050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601f908201527f41697264726f702072656465656d20706572696f642068617320656e64656400604082015260600190565b60208082526027908201527f41697264726f702072656465656d20706572696f6420686173206e6f7420656e604082015266191959081e595d60ca1b606082015260800190565b6020808252601e908201527f45524332303a207472616e73666572206973206e6f7420616c6c6f7765640000604082015260600190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b90815260200190565b60ff91909116815260200190565b60405181810167ffffffffffffffff811182821017156113ac57600080fd5b604052919050565b600067ffffffffffffffff8211156113ca578081fd5b5060209081020190565b60005b838110156113ef5781810151838201526020016113d7565b838111156113fe576000848401525b50505050565b6001600160a01b038116811461068f57600080fdfe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220794126baf4ea3c44b9afb84b4d8a20535aca899e75471e5d9bb4c8e671aabde664736f6c634300060c0033546f726e61646f4361736820766f756368657220666f72206561726c792061646f7074657273"; +const isSuperArgs$y = (xs) => xs.length > 1; +class VoucherMock__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$y(args)) { + super(...args); + } else { + super(_abi$W, _bytecode$y, args[0]); + } + } + getDeployTransaction(_torn, _governance, _duration, _airdrops, overrides) { + return super.getDeployTransaction( + _torn, + _governance, + _duration, + _airdrops, + overrides || {} + ); + } + deploy(_torn, _governance, _duration, _airdrops, overrides) { + return super.deploy( + _torn, + _governance, + _duration, + _airdrops, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$y; + static abi = _abi$W; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$W); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$W, runner); + } +} + +var index$u = /*#__PURE__*/Object.freeze({ + __proto__: null, + AirdropMock__factory: AirdropMock__factory, + ENSMock__factory: ENSMock__factory, + TORNMock__factory: TORNMock__factory, + Timestamp__factory: Timestamp__factory, + VestingMock__factory: VestingMock__factory, + VoucherMock__factory: VoucherMock__factory +}); + +const _abi$V = [ + { + inputs: [ + { + internalType: "bytes32", + name: "tokenAddress", + type: "bytes32" + }, + { + components: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + internalType: "struct Airdrop.Recipient[]", + name: "targets", + type: "tuple[]" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "domains", + type: "bytes32[]" + } + ], + name: "bulkResolve", + outputs: [ + { + internalType: "address[]", + name: "result", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "resolve", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$x = "0x60806040523480156200001157600080fd5b506040516200054038038062000540833981016040819052620000349162000396565b60006200004183620001c2565b90506000816001600160a01b03166370a08231306040518263ffffffff1660e01b815260040162000073919062000467565b60206040518083038186803b1580156200008c57600080fd5b505afa158015620000a1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000c791906200044e565b11620000f05760405162461bcd60e51b8152600401620000e7906200049d565b60405180910390fd5b60005b8251811015620001bd57816001600160a01b031663a9059cbb8483815181106200011957fe5b6020026020010151600001518584815181106200013257fe5b6020026020010151602001516040518363ffffffff1660e01b81526004016200015d9291906200047b565b602060405180830381600087803b1580156200017857600080fd5b505af11580156200018d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b3919062000374565b50600101620000f3565b506000ff5b600080620001cf62000310565b600114620001f257738595bfb0d940dfedc98943fa8a907091203f25ee62000203565b6e0c2e074ec69a0dfb2997ba6c7d2e1e5b604051630178b8bf60e01b81529091506001600160a01b03821690630178b8bf906200023490869060040162000494565b60206040518083038186803b1580156200024d57600080fd5b505afa15801562000262573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000288919062000355565b6001600160a01b0316633b3b57de846040518263ffffffff1660e01b8152600401620002b5919062000494565b60206040518083038186803b158015620002ce57600080fd5b505afa158015620002e3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000309919062000355565b9392505050565b4690565b60006040828403121562000326578081fd5b620003326040620004df565b90508151620003418162000526565b808252506020820151602082015292915050565b60006020828403121562000367578081fd5b8151620003098162000526565b60006020828403121562000386578081fd5b8151801515811462000309578182fd5b6000806040808486031215620003aa578182fd5b8351602080860151919450906001600160401b03811115620003ca578384fd5b8501601f81018713620003db578384fd5b8051620003f2620003ec8262000506565b620004df565b81815283810190838501868402850186018b10156200040f578788fd5b8794505b838510156200043d57620004288b8262000314565b83526001949094019391850191860162000413565b508096505050505050509250929050565b60006020828403121562000460578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b90815260200190565b60208082526022908201527f42616c616e636520697320302c2061697264726f7020616c726561647920646f6040820152616e6560f01b606082015260800190565b6040518181016001600160401b0381118282101715620004fe57600080fd5b604052919050565b60006001600160401b038211156200051c578081fd5b5060209081020190565b6001600160a01b03811681146200053c57600080fd5b5056fe"; +const isSuperArgs$x = (xs) => xs.length > 1; +class Airdrop__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$x(args)) { + super(...args); + } else { + super(_abi$V, _bytecode$x, args[0]); + } + } + getDeployTransaction(tokenAddress, targets, overrides) { + return super.getDeployTransaction(tokenAddress, targets, overrides || {}); + } + deploy(tokenAddress, targets, overrides) { + return super.deploy(tokenAddress, targets, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$x; + static abi = _abi$V; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$V); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$V, runner); + } +} + +const _abi$U = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "blockTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "chainID", + outputs: [ + { + internalType: "uint256", + name: "_chainID", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "subtractedValue", + type: "uint256" + } + ], + name: "decreaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "addedValue", + type: "uint256" + } + ], + name: "increaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "nonces", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "permit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +class ERC20Permit__factory { + static abi = _abi$U; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$U); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$U, runner); + } +} + +const _abi$T = [ + { + inputs: [ + { + internalType: "address", + name: "_governance", + type: "address" + }, + { + internalType: "uint256", + name: "_pausePeriod", + type: "uint256" + }, + { + components: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + internalType: "struct TORN.Recipient[]", + name: "_vestings", + type: "tuple[]" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + } + ], + name: "Allowed", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + } + ], + name: "Disallowed", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address" + } + ], + name: "Paused", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address" + } + ], + name: "Unpaused", + type: "event" + }, + { + inputs: [ + { + internalType: "address[]", + name: "target", + type: "address[]" + } + ], + name: "addToAllowedList", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "allowedTransferee", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "blockTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "burn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "burnFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "canUnpauseAfter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "chainID", + outputs: [ + { + internalType: "uint256", + name: "_chainID", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bool", + name: "decision", + type: "bool" + } + ], + name: "changeTransferability", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "subtractedValue", + type: "uint256" + } + ], + name: "decreaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "governance", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "addedValue", + type: "uint256" + } + ], + name: "increaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "nonces", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "paused", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "permit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "target", + type: "address[]" + } + ], + name: "removeFromAllowedList", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "_token", + type: "address" + }, + { + internalType: "address payable", + name: "_to", + type: "address" + }, + { + internalType: "uint256", + name: "_balance", + type: "uint256" + } + ], + name: "rescueTokens", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$w = "0x60c06040523480156200001157600080fd5b506040516200288338038062002883833981016040819052620000349162000699565b604080518082018252600b81526a0a8dee4dcc2c8de86c2e6d60ab1b6020808301918252835180850190945260048452632a27a92760e11b9084015281519192916200008391600391620005a7565b50805162000099906004906020840190620005a7565b50506005805460ff1916601217905550620000b3620001f0565b506008805460ff199081169091556001600160601b0319606085901b1660a0526001600160a01b0384166000908152600960205260408120805490921660011790915583905b8251811015620001765760008382815181106200011257fe5b60200260200101516000015190506200014a818584815181106200013257fe5b602002602001015160200151620002ac60201b60201c565b6001600160a01b03166000908152600960205260409020805460ff1916600190811790915501620000f9565b506200019a83620001866200038f565b6200039360201b62000cbd1790919060201c565b608052620001a7620003c4565b620001b16200043b565b6a084595161401484a00000014620001e65760405162461bcd60e51b8152600401620001dd906200086b565b60405180910390fd5b5050505062000909565b600080620001fd62000441565b905060007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6200022c62000445565b805160209182012060408051808201825260018152603160f81b90840152516200027e93927fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc691879130910162000781565b60408051601f1981840301815291815281516020928301206000948552600790925290922082905550905090565b6001600160a01b038216620002d55760405162461bcd60e51b8152600401620001dd90620008a2565b620002e360008383620004df565b620002ff816002546200039360201b62000cbd1790919060201c565b6002556001600160a01b038216600090815260208181526040909120546200033291839062000cbd62000393821b17901c565b6001600160a01b0383166000818152602081905260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9062000383908590620008d9565b60405180910390a35050565b4290565b600082820183811015620003bb5760405162461bcd60e51b8152600401620001dd90620007ad565b90505b92915050565b60085460ff1615620003ea5760405162461bcd60e51b8152600401620001dd9062000841565b6008805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258620004226200059a565b6040516200043191906200076d565b60405180910390a1565b60025490565b4690565b60038054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015620004d55780601f10620004a957610100808354040283529160200191620004d5565b820191906000526020600020905b815481529060010190602001808311620004b757829003601f168201915b5050505050905090565b620004f78383836200059560201b620006aa1760201c565b620005016200059e565b15806200052657506001600160a01b03831660009081526009602052604090205460ff165b806200054a57506001600160a01b03821660009081526009602052604090205460ff165b620005695760405162461bcd60e51b8152600401620001dd906200081b565b6001600160a01b038216301415620005955760405162461bcd60e51b8152600401620001dd90620007e4565b505050565b3390565b60085460ff1690565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620005ea57805160ff19168380011785556200061a565b828001600101855582156200061a579182015b828111156200061a578251825591602001919060010190620005fd565b50620006289291506200062c565b5090565b5b808211156200062857600081556001016200062d565b80516001600160a01b0381168114620003be57600080fd5b6000604082840312156200066d578081fd5b620006796040620008e2565b905062000687838362000643565b81526020820151602082015292915050565b600080600060608486031215620006ae578283fd5b620006ba858562000643565b9250602080850151925060408086015160018060401b0380821115620006de578485fd5b818801915088601f830112620006f2578485fd5b81518181111562000701578586fd5b620007108586830201620008e2565b8181528581019250838601858302850187018c10156200072e578788fd5b8794505b828510156200075c57620007478c826200065b565b84526001949094019392860192850162000732565b508096505050505050509250925092565b6001600160a01b0391909116815260200190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526017908201527f544f524e3a20696e76616c696420726563697069656e74000000000000000000604082015260600190565b6020808252600c908201526b1513d4938e881c185d5cd95960a21b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252601c908201527f544f524e3a20696e636f727265637420646973747269627574696f6e00000000604082015260600190565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b90815260200190565b6040518181016001600160401b03811182821017156200090157600080fd5b604052919050565b60805160a05160601c611f3a62000949600039806104d752806105ff52806106cc528061078552806109715250806107245280610c705250611f3a6000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c806379cc6790116100de578063a9059cbb11610097578063cea9d26f11610071578063cea9d26f146102fb578063d505accf1461030e578063dc0f0d1214610321578063dd62ed3e1461032957610173565b8063a9059cbb146102d8578063adb61832146102eb578063adc879e9146102f357610173565b806379cc6790146102715780637ecebe001461028457806381893c7c14610297578063885ad0cf146102aa57806395d89b41146102bd578063a457c2d7146102c557610173565b80633c8d76d1116101305780633c8d76d11461020657806342966c681461021b5780635aa6e6751461022e5780635c975abb146102435780635d4545a01461024b57806370a082311461025e57610173565b806306fdde0314610178578063095ea7b31461019657806318160ddd146101b657806323b872dd146101cb578063313ce567146101de57806339509351146101f3575b600080fd5b61018061033c565b60405161018d9190611875565b60405180910390f35b6101a96101a436600461163a565b6103d3565b60405161018d91906117ec565b6101be6103f1565b60405161018d9190611d9a565b6101a96101d9366004611585565b6103f7565b6101e661047e565b60405161018d9190611da3565b6101a961020136600461163a565b610487565b610219610214366004611665565b6104d5565b005b61021961022936600461174e565b6105e9565b6102366105fd565b60405161018d91906117bf565b6101a9610621565b6101a9610259366004611531565b61062a565b6101be61026c366004611531565b61063f565b61021961027f36600461163a565b61065a565b6101be610292366004611531565b6106af565b6102196102a5366004611702565b6106ca565b6102196102b8366004611665565b610783565b61018061088a565b6101a96102d336600461163a565b6108eb565b6101a96102e636600461163a565b610953565b6101be610967565b6101be61096b565b61021961030936600461173a565b61096f565b61021961031c3660046115c5565b610b2d565b6101be610c6e565b6101be61033736600461154d565b610c92565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103c85780601f1061039d576101008083540402835291602001916103c8565b820191906000526020600020905b8154815290600101906020018083116103ab57829003601f168201915b505050505090505b90565b60006103e76103e0610ce9565b8484610ced565b5060015b92915050565b60025490565b6000610404848484610da1565b61047484610410610ce9565b61046f85604051806060016040528060288152602001611e94602891396001600160a01b038a1660009081526001602052604081209061044e610ce9565b6001600160a01b031681526020810191909152604001600020549190610eb6565b610ced565b5060019392505050565b60055460ff1690565b60006103e7610494610ce9565b8461046f85600160006104a5610ce9565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610cbd565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610507610ce9565b6001600160a01b0316146105365760405162461bcd60e51b815260040161052d90611d16565b60405180910390fd5b60005b81518110156105e55760006009600084848151811061055457fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055507f9ef90a89b00db1a1891a357dc96b2a273add9d883e378c350d22bad87a9d7d308282815181106105c057fe5b60200260200101516040516105d591906117bf565b60405180910390a1600101610539565b5050565b6105fa6105f4610ce9565b82610ee2565b50565b7f000000000000000000000000000000000000000000000000000000000000000081565b60085460ff1690565b60096020526000908152604090205460ff1681565b6001600160a01b031660009081526020819052604090205490565b600061068c82604051806060016040528060248152602001611ebc6024913961068586610337610ce9565b9190610eb6565b90506106a08361069a610ce9565b83610ced565b6106aa8383610ee2565b505050565b6001600160a01b031660009081526006602052604090205490565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166106fc610ce9565b6001600160a01b0316146107225760405162461bcd60e51b815260040161052d90611d16565b7f000000000000000000000000000000000000000000000000000000000000000061074b610967565b116107685760405162461bcd60e51b815260040161052d90611b0b565b801561077b57610776610fc4565b6105fa565b6105fa611030565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166107b5610ce9565b6001600160a01b0316146107db5760405162461bcd60e51b815260040161052d90611d16565b60005b81518110156105e5576001600960008484815181106107f957fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055507f77a7dbc6ad97703ad411a8d5edfcd1df382fb34b076a90898b11884f7ebdcc0582828151811061086557fe5b602002602001015160405161087a91906117bf565b60405180910390a16001016107de565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103c85780601f1061039d576101008083540402835291602001916103c8565b60006103e76108f8610ce9565b8461046f85604051806060016040528060258152602001611ee06025913960016000610922610ce9565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610eb6565b60006103e7610960610ce9565b8484610da1565b4290565b4690565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166109a1610ce9565b6001600160a01b0316146109c75760405162461bcd60e51b815260040161052d90611d16565b6001600160a01b0382166109ed5760405162461bcd60e51b815260040161052d90611c8a565b6001600160a01b038316610a56574760008215610a1357610a0e8284611089565b610a15565b815b6040519091506001600160a01b0385169082156108fc029083906000818181858888f19350505050158015610a4e573d6000803e3d6000fd5b5050506106aa565b6040516370a0823160e01b81526000906001600160a01b038516906370a0823190610a859030906004016117bf565b60206040518083038186803b158015610a9d57600080fd5b505afa158015610ab1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad59190611766565b905060008215610aee57610ae98284611089565b610af0565b815b905060008111610b125760405162461bcd60e51b815260040161052d90611d63565b610b266001600160a01b038616858361109f565b5050505050565b83610b36610967565b1115610b545760405162461bcd60e51b815260040161052d90611a00565b6001600160a01b0387166000908152600660209081526040808320549051610ba7927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9928c928c928c92918c91016117f7565b6040516020818303038152906040528051906020012090506000611901610bcc6110f5565b83604051602001610bdf9392919061179a565b6040516020818303038152906040528051906020012090506000610c0582878787611134565b9050896001600160a01b0316816001600160a01b031614610c385760405162461bcd60e51b815260040161052d90611b52565b6001600160a01b038a16600090815260066020526040902080546001019055610c628a8a8a610ced565b50505050505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b600082820183811015610ce25760405162461bcd60e51b815260040161052d90611992565b9392505050565b3390565b6001600160a01b038316610d135760405162461bcd60e51b815260040161052d90611c0f565b6001600160a01b038216610d395760405162461bcd60e51b815260040161052d90611950565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610d94908590611d9a565b60405180910390a3505050565b6001600160a01b038316610dc75760405162461bcd60e51b815260040161052d90611bca565b6001600160a01b038216610ded5760405162461bcd60e51b815260040161052d906118df565b610df883838361122c565b610e3581604051806060016040528060268152602001611e6e602691396001600160a01b0386166000908152602081905260409020549190610eb6565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610e649082610cbd565b6001600160a01b0380841660008181526020819052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610d94908590611d9a565b60008184841115610eda5760405162461bcd60e51b815260040161052d9190611875565b505050900390565b6001600160a01b038216610f085760405162461bcd60e51b815260040161052d90611b89565b610f148260008361122c565b610f5181604051806060016040528060228152602001611e4c602291396001600160a01b0385166000908152602081905260409020549190610eb6565b6001600160a01b038316600090815260208190526040902055600254610f7790826112cb565b6002556040516000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610fb8908590611d9a565b60405180910390a35050565b60085460ff16610fe65760405162461bcd60e51b815260040161052d90611922565b6008805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa611019610ce9565b60405161102691906117bf565b60405180910390a1565b60085460ff16156110535760405162461bcd60e51b815260040161052d90611a9f565b6008805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611019610ce9565b60008183106110985781610ce2565b5090919050565b6106aa8363a9059cbb60e01b84846040516024016110be9291906117d3565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261130d565b6000806007600061110461096b565b8152602081019190915260400160002054905080156111245790506103d0565b61112c61139c565b9150506103d0565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08211156111765760405162461bcd60e51b815260040161052d90611a5d565b8360ff16601b148061118b57508360ff16601c145b6111a75760405162461bcd60e51b815260040161052d90611ac9565b6000600186868686604051600081526020016040526040516111cc9493929190611857565b6020604051602081039080840390855afa1580156111ee573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166112215760405162461bcd60e51b815260040161052d906118a8565b90505b949350505050565b6112378383836106aa565b61123f610621565b158061126357506001600160a01b03831660009081526009602052604090205460ff165b8061128657506001600160a01b03821660009081526009602052604090205460ff165b6112a25760405162461bcd60e51b815260040161052d90611a37565b6001600160a01b0382163014156106aa5760405162461bcd60e51b815260040161052d906119c9565b6000610ce283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610eb6565b6060611362826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166114529092919063ffffffff16565b8051909150156106aa5780806020019051810190611380919061171e565b6106aa5760405162461bcd60e51b815260040161052d90611ccc565b6000806113a761096b565b905060007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6113d461033c565b805160209182012060408051808201825260018152603160f81b908401525161142493927fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc691879130910161182b565b60408051601f1981840301815291815281516020928301206000948552600790925290922082905550905090565b60606112248484600085606061146785611520565b6114835760405162461bcd60e51b815260040161052d90611c53565b60006060866001600160a01b031685876040516114a0919061177e565b60006040518083038185875af1925050503d80600081146114dd576040519150601f19603f3d011682016040523d82523d6000602084013e6114e2565b606091505b509150915081156114f65791506112249050565b8051156115065780518082602001fd5b8360405162461bcd60e51b815260040161052d9190611875565b3b151590565b80356103eb81611e28565b600060208284031215611542578081fd5b8135610ce281611e28565b6000806040838503121561155f578081fd5b823561156a81611e28565b9150602083013561157a81611e28565b809150509250929050565b600080600060608486031215611599578081fd5b83356115a481611e28565b925060208401356115b481611e28565b929592945050506040919091013590565b600080600080600080600060e0888a0312156115df578283fd5b87356115ea81611e28565b965060208801356115fa81611e28565b95506040880135945060608801359350608088013560ff8116811461161d578384fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561164c578182fd5b823561165781611e28565b946020939093013593505050565b60006020808385031215611677578182fd5b823567ffffffffffffffff81111561168d578283fd5b8301601f8101851361169d578283fd5b80356116b06116ab82611dd8565b611db1565b81815283810190838501858402850186018910156116cc578687fd5b8694505b838510156116f6576116e28982611526565b8352600194909401939185019185016116d0565b50979650505050505050565b600060208284031215611713578081fd5b8135610ce281611e3d565b60006020828403121561172f578081fd5b8151610ce281611e3d565b600080600060608486031215611599578283fd5b60006020828403121561175f578081fd5b5035919050565b600060208284031215611777578081fd5b5051919050565b60008251611790818460208701611df8565b9190910192915050565b60f09390931b6001600160f01b03191683526002830191909152602282015260420190565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b9586526001600160a01b0394851660208701529290931660408501526060840152608083019190915260a082015260c00190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b93845260ff9290921660208401526040830152606082015260800190565b6000602082528251806020840152611894816040850160208701611df8565b601f01601f19169190910160400192915050565b60208082526018908201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604082015260600190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526014908201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604082015260600190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526017908201527f544f524e3a20696e76616c696420726563697069656e74000000000000000000604082015260600190565b6020808252601d908201527f45524332305065726d69743a206578706972656420646561646c696e65000000604082015260600190565b6020808252600c908201526b1513d4938e881c185d5cd95960a21b604082015260600190565b60208082526022908201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604082015261756560f01b606082015260800190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526022908201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604082015261756560f01b606082015260800190565b60208082526027908201527f544f524e3a2063616e6e6f74206368616e6765207472616e736665726162696c6040820152661a5d1e481e595d60ca1b606082015260800190565b6020808252601e908201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604082015260600190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526022908201527f544f524e3a2063616e206e6f742073656e6420746f207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252602d908201527f544f524e3a206f6e6c7920676f7665726e616e63652063616e20706572666f7260408201526c36903a3434b99030b1ba34b7b760991b606082015260800190565b6020808252601e908201527f544f524e3a20747279696e6720746f2073656e6420302062616c616e63650000604082015260600190565b90815260200190565b60ff91909116815260200190565b60405181810167ffffffffffffffff81118282101715611dd057600080fd5b604052919050565b600067ffffffffffffffff821115611dee578081fd5b5060209081020190565b60005b83811015611e13578181015183820152602001611dfb565b83811115611e22576000848401525b50505050565b6001600160a01b03811681146105fa57600080fd5b80151581146105fa57600080fdfe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e20616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220fd515804eca384cb14c99861e60dc5364ae65ba9ddfdfe00d195788ee631d01064736f6c634300060c0033"; +const isSuperArgs$w = (xs) => xs.length > 1; +class TORN__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$w(args)) { + super(...args); + } else { + super(_abi$T, _bytecode$w, args[0]); + } + } + getDeployTransaction(_governance, _pausePeriod, _vestings, overrides) { + return super.getDeployTransaction( + _governance, + _pausePeriod, + _vestings, + overrides || {} + ); + } + deploy(_governance, _pausePeriod, _vestings, overrides) { + return super.deploy( + _governance, + _pausePeriod, + _vestings, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$w; + static abi = _abi$T; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$T); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$T, runner); + } +} + +const _abi$S = [ + { + inputs: [ + { + internalType: "address", + name: "_token", + type: "address" + }, + { + internalType: "address", + name: "_beneficiary", + type: "address" + }, + { + internalType: "uint256", + name: "_startTimestamp", + type: "uint256" + }, + { + internalType: "uint256", + name: "_cliffInMonths", + type: "uint256" + }, + { + internalType: "uint256", + name: "_durationInMonths", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "Released", + type: "event" + }, + { + inputs: [], + name: "SECONDS_PER_MONTH", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "beneficiary", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "blockTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "cliffInMonths", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "durationInMonths", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "release", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "released", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "startTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "token", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "vestedAmount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$v = "0x61012060405234801561001157600080fd5b50604051610c8c380380610c8c833981810160405260a081101561003457600080fd5b508051602082015160408301516060840151608090940151929391929091906001600160a01b0384166100ae576040805162461bcd60e51b815260206004820152601b60248201527f42656e65666963696172792063616e6e6f7420626520656d7074790000000000604482015290519081900360640190fd5b80821115610103576040805162461bcd60e51b815260206004820152601e60248201527f436c6966662069732067726561746572207468616e206475726174696f6e0000604482015290519081900360640190fd5b6001600160601b0319606086811b821660a05285901b1660805261010081905260c08290528215610134578261013c565b61013c61014a565b60e0525061014e9350505050565b4290565b60805160601c60a05160601c60c05160e05161010051610acc6101c060003980610203528061037b52806103dd525080610152528061018e52806105215250806101d052806104f352508061024852806102c85280610474528061054552508061012c52806104965250610acc6000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063928d89ae11610066578063928d89ae146100fb5780639613252114610103578063adb618321461010b578063e6fd48bc14610113578063fc0c546a1461011b5761009e565b806310786deb146100a357806338af3eed146100bd57806344b1231f146100e157806367097a4b146100e957806386d1a69f146100f1575b600080fd5b6100ab610123565b60408051918252519081900360200190f35b6100c561012a565b604080516001600160a01b039092168252519081900360200190f35b6100ab61014e565b6100ab6103db565b6100f96103ff565b005b6100ab6104f1565b6100ab610515565b6100ab61051b565b6100ab61051f565b6100c5610543565b62278d0081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60007f000000000000000000000000000000000000000000000000000000000000000061017961051b565b1015610187575060006103d8565b60006101bb7f00000000000000000000000000000000000000000000000000000000000000006101b561051b565b90610567565b905060006101cc8262278d006105b2565b90507f0000000000000000000000000000000000000000000000000000000000000000811015610201576000925050506103d8565b7f000000000000000000000000000000000000000000000000000000000000000081106102c457604080516370a0823160e01b815230600482015290516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916370a08231916024808301926020929190829003018186803b15801561028e57600080fd5b505afa1580156102a2573d6000803e3d6000fd5b505050506040513d60208110156102b857600080fd5b505192506103d8915050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561033357600080fd5b505afa158015610347573d6000803e3d6000fd5b505050506040513d602081101561035d57600080fd5b505160008054919250906103729083906105f4565b905060006103aa7f00000000000000000000000000000000000000000000000000000000000000006103a4848761064e565b906105b2565b905060006103c36000548361056790919063ffffffff16565b90506103cf84826106a7565b96505050505050505b90565b7f000000000000000000000000000000000000000000000000000000000000000081565b600061040961014e565b905060008111610457576040805162461bcd60e51b81526020600482015260146024820152734e6f20746f6b656e7320746f2072656c6561736560601b604482015290519081900360640190fd5b60005461046490826105f4565b6000556104bb6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f0000000000000000000000000000000000000000000000000000000000000000836106bd565b6040805182815290517ffb81f9b30d73d830c3544b34d827c08142579ee75710b490bab0b3995468c5659181900360200190a150565b7f000000000000000000000000000000000000000000000000000000000000000081565b60005481565b4290565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60006105a983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610714565b90505b92915050565b60006105a983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506107ab565b6000828201838110156105a9576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008261065d575060006105ac565b8282028284828161066a57fe5b04146105a95760405162461bcd60e51b8152600401808060200182810382526021815260200180610a4c6021913960400191505060405180910390fd5b60008183106106b657816105a9565b5090919050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261070f908490610810565b505050565b600081848411156107a35760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610768578181015183820152602001610750565b50505050905090810190601f1680156107955780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836107fa5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610768578181015183820152602001610750565b50600083858161080657fe5b0495945050505050565b6060610865826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166108c19092919063ffffffff16565b80519091501561070f5780806020019051602081101561088457600080fd5b505161070f5760405162461bcd60e51b815260040180806020018281038252602a815260200180610a6d602a913960400191505060405180910390fd5b60606108d084846000856108d8565b949350505050565b60606108e385610a45565b610934576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106109735780518252601f199092019160209182019101610954565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146109d5576040519150601f19603f3d011682016040523d82523d6000602084013e6109da565b606091505b509150915081156109ee5791506108d09050565b8051156109fe5780518082602001fd5b60405162461bcd60e51b8152602060048201818152865160248401528651879391928392604401919085019080838360008315610768578181015183820152602001610750565b3b15159056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a26469706673582212203b3e8370e345374172efb9e3693b20807c318ecfcc569df94f28df8a94f2727a64736f6c634300060c0033"; +const isSuperArgs$v = (xs) => xs.length > 1; +class Vesting__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$v(args)) { + super(...args); + } else { + super(_abi$S, _bytecode$v, args[0]); + } + } + getDeployTransaction(_token, _beneficiary, _startTimestamp, _cliffInMonths, _durationInMonths, overrides) { + return super.getDeployTransaction( + _token, + _beneficiary, + _startTimestamp, + _cliffInMonths, + _durationInMonths, + overrides || {} + ); + } + deploy(_token, _beneficiary, _startTimestamp, _cliffInMonths, _durationInMonths, overrides) { + return super.deploy( + _token, + _beneficiary, + _startTimestamp, + _cliffInMonths, + _durationInMonths, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$v; + static abi = _abi$S; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$S); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$S, runner); + } +} + +const _abi$R = [ + { + inputs: [ + { + internalType: "bytes32", + name: "_torn", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_governance", + type: "bytes32" + }, + { + internalType: "uint256", + name: "_duration", + type: "uint256" + }, + { + components: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + internalType: "struct Voucher.Recipient[]", + name: "_airdrops", + type: "tuple[]" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "allowedTransferee", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "blockTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "domains", + type: "bytes32[]" + } + ], + name: "bulkResolve", + outputs: [ + { + internalType: "address[]", + name: "result", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "subtractedValue", + type: "uint256" + } + ], + name: "decreaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "expiresAt", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "governance", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "addedValue", + type: "uint256" + } + ], + name: "increaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "redeem", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "rescueExpiredTokens", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "resolve", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$u = "0x60e06040523480156200001157600080fd5b5060405162001d8d38038062001d8d833981016040819052620000349162000593565b60405180606001604052806026815260200162001d6760269139604051806040016040528060058152602001643b2a27a92760d91b81525081600390805190602001906200008492919062000497565b5080516200009a90600490602084019062000497565b50506005805460ff1916601217905550620000b584620001af565b60601b6001600160601b031916608052620000d083620001af565b60601b6001600160601b03191660c0526200010382620000ef620002fd565b6200030160201b6200098d1790919060201c565b60a05260005b8151811015620001a457620001558282815181106200012457fe5b6020026020010151600001518383815181106200013d57fe5b6020026020010151602001516200033260201b60201c565b6001600660008484815181106200016857fe5b602090810291909101810151516001600160a01b03168252810191909152604001600020805460ff191691151591909117905560010162000109565b505050505062000753565b600080620001bc62000415565b600114620001df57738595bfb0d940dfedc98943fa8a907091203f25ee620001f0565b6e0c2e074ec69a0dfb2997ba6c7d2e1e5b604051630178b8bf60e01b81529091506001600160a01b03821690630178b8bf906200022190869060040162000665565b60206040518083038186803b1580156200023a57600080fd5b505afa1580156200024f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000275919062000574565b6001600160a01b0316633b3b57de846040518263ffffffff1660e01b8152600401620002a2919062000665565b60206040518083038186803b158015620002bb57600080fd5b505afa158015620002d0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002f6919062000574565b9392505050565b4290565b600082820183811015620002f65760405162461bcd60e51b815260040162000329906200066e565b60405180910390fd5b6001600160a01b0382166200035b5760405162461bcd60e51b81526004016200032990620006dc565b620003696000838362000419565b62000385816002546200030160201b6200098d1790919060201c565b6002556001600160a01b03821660009081526020818152604090912054620003b89183906200098d62000301821b17901c565b6001600160a01b0383166000818152602081905260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906200040990859062000665565b60405180910390a35050565b4690565b620004318383836200049260201b620009b21760201c565b6001600160a01b03821615806200044f57506001600160a01b038316155b806200047357506001600160a01b03831660009081526006602052604090205460ff165b620004925760405162461bcd60e51b81526004016200032990620006a5565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620004da57805160ff19168380011785556200050a565b828001600101855582156200050a579182015b828111156200050a578251825591602001919060010190620004ed565b50620005189291506200051c565b5090565b5b808211156200051857600081556001016200051d565b60006040828403121562000545578081fd5b62000551604062000713565b9050815162000560816200073a565b808252506020820151602082015292915050565b60006020828403121562000586578081fd5b8151620002f6816200073a565b60008060008060808587031215620005a9578283fd5b8451935060208086015193506040808701519350606087015160018060401b0380821115620005d6578485fd5b818901915089601f830112620005ea578485fd5b815181811115620005f9578586fd5b62000608858683020162000713565b8181528581019250838601858302850187018d101562000626578788fd5b8794505b8285101562000654576200063f8d8262000533565b8452600194909401939286019285016200062a565b50989b979a50959850505050505050565b90815260200190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601e908201527f45524332303a207472616e73666572206973206e6f7420616c6c6f7765640000604082015260600190565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b6040518181016001600160401b03811182821017156200073257600080fd5b604052919050565b6001600160a01b03811681146200075057600080fd5b50565b60805160601c60a05160c05160601c6115c3620007a46000398061043152806107d35250806105c352806106ec52806107895250806106c8528061075d52806107f4528061089852506115c36000f3fe608060405234801561001057600080fd5b506004361061012c5760003560e01c80638622a689116100ad578063adf898a411610071578063adf898a41461024b578063be040fb014610253578063c39ef8551461025d578063dd62ed3e14610265578063f9e54234146102785761012c565b80638622a6891461020d57806395d89b4114610215578063a457c2d71461021d578063a9059cbb14610230578063adb61832146102435761012c565b806339509351116100f457806339509351146101ac5780635aa6e675146101bf5780635c23bdf5146101d45780635d4545a0146101e757806370a08231146101fa5761012c565b806306fdde0314610131578063095ea7b31461014f57806318160ddd1461016f57806323b872dd14610184578063313ce56714610197575b600080fd5b610139610298565b604051610146919061116f565b60405180910390f35b61016261015d366004610fb5565b61032e565b604051610146919061115b565b61017761034b565b6040516101469190611166565b610162610192366004610f75565b610351565b61019f6103d8565b604051610146919061145e565b6101626101ba366004610fb5565b6103e1565b6101c761042f565b60405161014691906110e1565b6101c76101e2366004611095565b610453565b6101626101f5366004610f05565b610591565b610177610208366004610f05565b6105a6565b6101776105c1565b6101396105e5565b61016261022b366004610fb5565b610646565b61016261023e366004610fb5565b6106ae565b6101776106c2565b6101c76106c6565b61025b6106ea565b005b61025b610787565b610177610273366004610f3d565b6108c1565b61028b610286366004610fe0565b6108ec565b604051610146919061110e565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103245780601f106102f957610100808354040283529160200191610324565b820191906000526020600020905b81548152906001019060200180831161030757829003601f168201915b5050505050905090565b600061034261033b6109b7565b84846109bb565b50600192915050565b60025490565b600061035e848484610a6f565b6103ce8461036a6109b7565b6103c985604051806060016040528060288152602001611541602891396001600160a01b038a166000908152600160205260408120906103a86109b7565b6001600160a01b031681526020810191909152604001600020549190610b84565b6109bb565b5060019392505050565b60055460ff1690565b60006103426103ee6109b7565b846103c985600160006103ff6109b7565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549061098d565b7f000000000000000000000000000000000000000000000000000000000000000081565b60008061045e610bb0565b60011461047f57738595bfb0d940dfedc98943fa8a907091203f25ee610490565b6e0c2e074ec69a0dfb2997ba6c7d2e1e5b604051630178b8bf60e01b81529091506001600160a01b03821690630178b8bf906104bf908690600401611166565b60206040518083038186803b1580156104d757600080fd5b505afa1580156104eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050f9190610f21565b6001600160a01b0316633b3b57de846040518263ffffffff1660e01b815260040161053a9190611166565b60206040518083038186803b15801561055257600080fd5b505afa158015610566573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058a9190610f21565b9392505050565b60066020526000908152604090205460ff1681565b6001600160a01b031660009081526020819052604090205490565b7f000000000000000000000000000000000000000000000000000000000000000081565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103245780601f106102f957610100808354040283529160200191610324565b60006103426106536109b7565b846103c985604051806060016040528060258152602001611569602591396001600061067d6109b7565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610b84565b60006103426106bb6109b7565b8484610a6f565b4290565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f00000000000000000000000000000000000000000000000000000000000000006107136106c2565b106107395760405162461bcd60e51b81526004016107309061125e565b60405180910390fd5b6000610744336105a6565b90506107503382610bb4565b6107846001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163383610c96565b50565b7f00000000000000000000000000000000000000000000000000000000000000006107b06106c2565b10156107ce5760405162461bcd60e51b815260040161073090611295565b6108bf7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161083e91906110e1565b60206040518083038186803b15801561085657600080fd5b505afa15801561086a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088e91906110ad565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169190610c96565b565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060815167ffffffffffffffff8111801561090657600080fd5b50604051908082528060200260200182016040528015610930578160200160208202803683370190505b50905060005b82518110156109875761095b83828151811061094e57fe5b6020026020010151610453565b82828151811061096757fe5b6001600160a01b0390921660209283029190910190910152600101610936565b50919050565b60008282018381101561058a5760405162461bcd60e51b815260040161073090611227565b505050565b3390565b6001600160a01b0383166109e15760405162461bcd60e51b815260040161073090611399565b6001600160a01b038216610a075760405162461bcd60e51b8152600401610730906111e5565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610a62908590611166565b60405180910390a3505050565b6001600160a01b038316610a955760405162461bcd60e51b815260040161073090611354565b6001600160a01b038216610abb5760405162461bcd60e51b8152600401610730906111a2565b610ac6838383610cec565b610b038160405180606001604052806026815260200161151b602691396001600160a01b0386166000908152602081905260409020549190610b84565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610b32908261098d565b6001600160a01b0380841660008181526020819052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610a62908590611166565b60008184841115610ba85760405162461bcd60e51b8152600401610730919061116f565b505050900390565b4690565b6001600160a01b038216610bda5760405162461bcd60e51b815260040161073090611313565b610be682600083610cec565b610c23816040518060600160405280602281526020016114f9602291396001600160a01b0385166000908152602081905260409020549190610b84565b6001600160a01b038316600090815260208190526040902055600254610c499082610d53565b6002556040516000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610c8a908590611166565b60405180910390a35050565b6109b28363a9059cbb60e01b8484604051602401610cb59291906110f5565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610d95565b610cf78383836109b2565b6001600160a01b0382161580610d1457506001600160a01b038316155b80610d3757506001600160a01b03831660009081526006602052604090205460ff165b6109b25760405162461bcd60e51b8152600401610730906112dc565b600061058a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610b84565b6060610dea826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610e249092919063ffffffff16565b8051909150156109b25780806020019051810190610e089190611075565b6109b25760405162461bcd60e51b815260040161073090611414565b6060610e338484600085610e3b565b949350505050565b6060610e4685610eff565b610e625760405162461bcd60e51b8152600401610730906113dd565b60006060866001600160a01b03168587604051610e7f91906110c5565b60006040518083038185875af1925050503d8060008114610ebc576040519150601f19603f3d011682016040523d82523d6000602084013e610ec1565b606091505b50915091508115610ed5579150610e339050565b805115610ee55780518082602001fd5b8360405162461bcd60e51b8152600401610730919061116f565b3b151590565b600060208284031215610f16578081fd5b813561058a816114e3565b600060208284031215610f32578081fd5b815161058a816114e3565b60008060408385031215610f4f578081fd5b8235610f5a816114e3565b91506020830135610f6a816114e3565b809150509250929050565b600080600060608486031215610f89578081fd5b8335610f94816114e3565b92506020840135610fa4816114e3565b929592945050506040919091013590565b60008060408385031215610fc7578182fd5b8235610fd2816114e3565b946020939093013593505050565b60006020808385031215610ff2578182fd5b823567ffffffffffffffff811115611008578283fd5b8301601f81018513611018578283fd5b803561102b61102682611493565b61146c565b8181528381019083850185840285018601891015611047578687fd5b8694505b8385101561106957803583526001949094019391850191850161104b565b50979650505050505050565b600060208284031215611086578081fd5b8151801515811461058a578182fd5b6000602082840312156110a6578081fd5b5035919050565b6000602082840312156110be578081fd5b5051919050565b600082516110d78184602087016114b3565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b8181101561114f5783516001600160a01b03168352928401929184019160010161112a565b50909695505050505050565b901515815260200190565b90815260200190565b600060208252825180602084015261118e8160408501602087016114b3565b601f01601f19169190910160400192915050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601f908201527f41697264726f702072656465656d20706572696f642068617320656e64656400604082015260600190565b60208082526027908201527f41697264726f702072656465656d20706572696f6420686173206e6f7420656e604082015266191959081e595d60ca1b606082015260800190565b6020808252601e908201527f45524332303a207472616e73666572206973206e6f7420616c6c6f7765640000604082015260600190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b60ff91909116815260200190565b60405181810167ffffffffffffffff8111828210171561148b57600080fd5b604052919050565b600067ffffffffffffffff8211156114a9578081fd5b5060209081020190565b60005b838110156114ce5781810151838201526020016114b6565b838111156114dd576000848401525b50505050565b6001600160a01b038116811461078457600080fdfe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212209b2d6f14167bc062b61418b8fca6b7946d243420e3df874c9632acb30079c69b64736f6c634300060c0033546f726e61646f4361736820766f756368657220666f72206561726c792061646f7074657273"; +const isSuperArgs$u = (xs) => xs.length > 1; +class Voucher__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$u(args)) { + super(...args); + } else { + super(_abi$R, _bytecode$u, args[0]); + } + } + getDeployTransaction(_torn, _governance, _duration, _airdrops, overrides) { + return super.getDeployTransaction( + _torn, + _governance, + _duration, + _airdrops, + overrides || {} + ); + } + deploy(_torn, _governance, _duration, _airdrops, overrides) { + return super.deploy( + _torn, + _governance, + _duration, + _airdrops, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$u; + static abi = _abi$R; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$R); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$R, runner); + } +} + +var index$t = /*#__PURE__*/Object.freeze({ + __proto__: null, + Airdrop__factory: Airdrop__factory, + ERC20Permit__factory: ERC20Permit__factory, + TORN__factory: TORN__factory, + Vesting__factory: Vesting__factory, + Voucher__factory: Voucher__factory, + ensSol: index$v, + mocks: index$u +}); + +const _abi$Q = [ + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "decimal", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "latestAnswer", + outputs: [ + { + internalType: "int256", + name: "answer", + type: "int256" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IChainlinkOracle__factory { + static abi = _abi$Q; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$Q); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$Q, runner); + } +} + +const _abi$P = [ + { + inputs: [ + { + internalType: "address", + name: "srcToken", + type: "address" + }, + { + internalType: "bool", + name: "useSrcWrappers", + type: "bool" + } + ], + name: "getRateToEth", + outputs: [ + { + internalType: "uint256", + name: "weightedRate", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IOffchainOracle__factory { + static abi = _abi$P; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$P); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$P, runner); + } +} + +const _abi$O = [ + { + inputs: [ + { + internalType: "address", + name: "_stablecoin", + type: "address" + }, + { + internalType: "address", + name: "_stablecoinOracle", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "NotOwner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "arbitraryPrice", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "chainlinkOracles", + outputs: [ + { + internalType: "contract IChainlinkOracle", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "price", + type: "uint256" + } + ], + name: "changeArbitraryPrice", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "changeOwner", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address" + } + ], + name: "getOracleUSD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "srcToken", + type: "address" + }, + { + internalType: "bool", + name: "useSrcWrappers", + type: "bool" + } + ], + name: "getRateToEth", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "isStablecoin", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "address", + name: "oracle", + type: "address" + }, + { + internalType: "bool", + name: "_isStablecoin", + type: "bool" + } + ], + name: "setOracle", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "stablecoin", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$t = "0x6080604052348015600f57600080fd5b50604051610905380380610905833981016040819052602c9160a7565b600080546001600160a01b039384166001600160a01b0319918216811783558252600260209081526040808420805460ff1916600190811790915590915290912080549290931691811691909117909155600480549091163317905560d5565b80516001600160a01b038116811460a257600080fd5b919050565b6000806040838503121560b957600080fd5b60c083608c565b915060cc60208401608c565b90509250929050565b610821806100e46000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063d16c130711610066578063d16c130714610165578063dd01555214610178578063dd3a825a1461018b578063df60d05a1461019e578063e9cbd822146101be57600080fd5b80631a650cc7146100a35780636a75aa66146100db5780637de4fd101461011c5780638da5cb5b1461013d578063a6f9dae114610150575b600080fd5b6100c66100b1366004610566565b60026020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b6101046100e9366004610566565b6001602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020016100d2565b61012f61012a366004610598565b6101d1565b6040519081526020016100d2565b600454610104906001600160a01b031681565b61016361015e366004610566565b610320565b005b6101636101733660046105cb565b61036d565b61012f610186366004610566565b6103f1565b61016361019936600461060e565b610503565b61012f6101ac366004610566565b60036020526000908152604090205481565b600054610104906001600160a01b031681565b6001600160a01b0382811660009081526001602052604081205490911661021157506001600160a01b03821660009081526003602052604090205461031a565b6000836001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610251573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102759190610638565b6001600160a01b03851660009081526002602052604090205490915060ff16156102ca576102a4816012610671565b6102af90600a610771565b6102b8856103f1565b6102c29190610780565b91505061031a565b600080546102e0906001600160a01b03166103f1565b90506102eb856103f1565b6102f6836024610671565b61030190600a610771565b61030b9083610780565b6103159190610797565b925050505b92915050565b6004546001600160a01b0316331461034b576040516330cd747160e01b815260040160405180910390fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6004546001600160a01b03163314610398576040516330cd747160e01b815260040160405180910390fd5b80156103c2576001600160a01b0383166000908152600260205260409020805460ff191660011790555b506001600160a01b03918216600090815260016020526040902080546001600160a01b03191691909216179055565b6001600160a01b03808216600090815260016020908152604080832054815163313ce56760e01b815291519394169284928392859263313ce567926004808401939192918290030181865afa15801561044e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104729190610638565b836001600160a01b03166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d491906107b9565b9092509050806104e58360126107d2565b6104f090600a610771565b6104fa9190610797565b95945050505050565b6004546001600160a01b0316331461052e576040516330cd747160e01b815260040160405180910390fd5b6001600160a01b03909116600090815260036020526040902055565b80356001600160a01b038116811461056157600080fd5b919050565b60006020828403121561057857600080fd5b6105818261054a565b9392505050565b8035801515811461056157600080fd5b600080604083850312156105ab57600080fd5b6105b48361054a565b91506105c260208401610588565b90509250929050565b6000806000606084860312156105e057600080fd5b6105e98461054a565b92506105f76020850161054a565b915061060560408501610588565b90509250925092565b6000806040838503121561062157600080fd5b61062a8361054a565b946020939093013593505050565b60006020828403121561064a57600080fd5b815160ff8116811461058157600080fd5b634e487b7160e01b600052601160045260246000fd5b60ff828116828216039081111561031a5761031a61065b565b6001815b60018411156106c5578085048111156106a9576106a961065b565b60018416156106b757908102905b60019390931c92800261068e565b935093915050565b6000826106dc5750600161031a565b816106e95750600061031a565b81600181146106ff576002811461070957610725565b600191505061031a565b60ff84111561071a5761071a61065b565b50506001821b61031a565b5060208310610133831016604e8410600b8410161715610748575081810a61031a565b610755600019848461068a565b80600019048211156107695761076961065b565b029392505050565b600061058160ff8416836106cd565b808202811582820484141761031a5761031a61065b565b6000826107b457634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156107cb57600080fd5b5051919050565b60ff818116838216019081111561031a5761031a61065b56fea264697066735822122014c0c48f05ab025151413c0ef2c884b3844e6a66084576e34b8337df8af8cf4564736f6c634300081c0033"; +const isSuperArgs$t = (xs) => xs.length > 1; +class TestnetOracle__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$t(args)) { + super(...args); + } else { + super(_abi$O, _bytecode$t, args[0]); + } + } + getDeployTransaction(_stablecoin, _stablecoinOracle, overrides) { + return super.getDeployTransaction( + _stablecoin, + _stablecoinOracle, + overrides || {} + ); + } + deploy(_stablecoin, _stablecoinOracle, overrides) { + return super.deploy( + _stablecoin, + _stablecoinOracle, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$t; + static abi = _abi$O; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$O); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$O, runner); + } +} + +var index$s = /*#__PURE__*/Object.freeze({ + __proto__: null, + IChainlinkOracle__factory: IChainlinkOracle__factory, + IOffchainOracle__factory: IOffchainOracle__factory, + TestnetOracle__factory: TestnetOracle__factory +}); + +const _abi$N = [ + { + inputs: [ + { + internalType: "address", + name: "_logic", + type: "address" + }, + { + internalType: "address", + name: "_admin", + type: "address" + }, + { + internalType: "bytes", + name: "_data", + type: "bytes" + } + ], + stateMutability: "payable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "previousAdmin", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "AdminChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "implementation", + type: "address" + } + ], + name: "Upgraded", + type: "event" + }, + { + stateMutability: "payable", + type: "fallback" + }, + { + inputs: [], + name: "admin", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "callToOwner", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "changeAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "changeOwner", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "delegateToOwner", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "getCurrentOwner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "implementation", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + } + ], + name: "upgradeTo", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "upgradeToAndCall", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + } + ], + name: "upgradeToOwner", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$s = "0x608060405260405162000e6738038062000e67833981810160405260608110156200002957600080fd5b815160208301516040808501805191519395929483019291846401000000008211156200005557600080fd5b9083019060208201858111156200006b57600080fd5b82516401000000008111828201881017156200008657600080fd5b82525081516020918201929091019080838360005b83811015620000b55781810151838201526020016200009b565b50505050905090810190601f168015620000e35780820380516001836020036101000a031916815260200191505b5060405250849150839050828282828281620000ff82620001f6565b805115620001bd576000826001600160a01b0316826040518082805190602001908083835b60208310620001455780518252601f19909201916020918201910162000124565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114620001a7576040519150601f19603f3d011682016040523d82523d6000602084013e620001ac565b606091505b5050905080620001bb57600080fd5b505b50620001c69050565b620001d1826200026d565b505050505050620001ed336200029160201b620008ab1760201c565b50505062000308565b6200020c81620002bd60201b620008d51760201c565b620002495760405162461bcd60e51b815260040180806020018281038252603681526020018062000e316036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b806200029c620002c3565b80546001600160a01b0319166001600160a01b039290921691909117905550565b3b151590565b604080517fb4d03667d60278cc15e9a68fa7679dc39ebe71350c4566a2c23c26580da4e0b3602080830191909152825180830382018152918301909252805191012090565b610b1980620003186000396000f3fe6080604052600436106100955760003560e01c80635c60da1b116100595780635c60da1b146102fe5780638f2839701461032f578063a18a186b14610362578063a6f9dae114610377578063f851a440146103aa576100a4565b806323711ab1146100ac57806323c735f1146101625780632e44e0e0146101955780633659cfe61461024b5780634f1ef2861461027e576100a4565b366100a4576100a26103bf565b005b6100a26103bf565b6100a2600480360360408110156100c257600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100ed57600080fd5b8201836020820111156100ff57600080fd5b8035906020019184600183028401116401000000008311171561012157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506103d9945050505050565b34801561016e57600080fd5b506100a26004803603602081101561018557600080fd5b50356001600160a01b03166104e7565b6100a2600480360360408110156101ab57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156101d657600080fd5b8201836020820111156101e857600080fd5b8035906020019184600183028401116401000000008311171561020a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610546945050505050565b34801561025757600080fd5b506100a26004803603602081101561026e57600080fd5b50356001600160a01b031661063a565b6100a26004803603604081101561029457600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156102bf57600080fd5b8201836020820111156102d157600080fd5b803590602001918460018302840111640100000000831117156102f357600080fd5b509092509050610671565b34801561030a57600080fd5b5061031361071e565b604080516001600160a01b039092168252519081900360200190f35b34801561033b57600080fd5b506100a26004803603602081101561035257600080fd5b50356001600160a01b031661075b565b34801561036e57600080fd5b50610313610815565b34801561038357600080fd5b506100a26004803603602081101561039a57600080fd5b50356001600160a01b0316610824565b3480156103b657600080fd5b50610313610880565b6103c76103d7565b6103d76103d26108db565b610900565b565b336103e2610924565b6001600160a01b03161461042c576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b6020831061046a5780518252601f19909201916020918201910161044b565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146104ca576040519150601f19603f3d011682016040523d82523d6000602084013e6104cf565b606091505b5091509150816104e157805181602001fd5b50505050565b336104f0610924565b6001600160a01b03161461053a576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b6105438161093d565b50565b3361054f610924565b6001600160a01b031614610599576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b60006060836001600160a01b031634846040518082805190602001908083835b602083106105d85780518252601f1990920191602091820191016105b9565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146104ca576040519150601f19603f3d011682016040523d82523d6000602084013e6104cf565b61064261097d565b6001600160a01b0316336001600160a01b03161415610669576106648161093d565b610543565b6105436103bf565b61067961097d565b6001600160a01b0316336001600160a01b031614156107115761069b8361093d565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146106f8576040519150601f19603f3d011682016040523d82523d6000602084013e6106fd565b606091505b505090508061070b57600080fd5b50610719565b6107196103bf565b505050565b600061072861097d565b6001600160a01b0316336001600160a01b03161415610750576107496108db565b9050610758565b6107586103bf565b90565b61076361097d565b6001600160a01b0316336001600160a01b03161415610669576001600160a01b0381166107c15760405162461bcd60e51b815260040180806020018281038252603a815260200180610a74603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6107ea61097d565b604080516001600160a01b03928316815291841660208301528051918290030190a1610664816109a2565b600061081f610924565b905090565b3361082d610924565b6001600160a01b031614610877576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b610543816108ab565b600061088a61097d565b6001600160a01b0316336001600160a01b031614156107505761074961097d565b806108b46109c6565b80546001600160a01b0319166001600160a01b039290921691909117905550565b3b151590565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561091f573d6000f35b3d6000fd5b600061092e6109c6565b546001600160a01b0316919050565b61094681610a0b565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b604080517fb4d03667d60278cc15e9a68fa7679dc39ebe71350c4566a2c23c26580da4e0b3602080830191909152825180830382018152918301909252805191012090565b610a14816108d5565b610a4f5760405162461bcd60e51b8152600401808060200182810382526036815260200180610aae6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374a264697066735822122001f07e10d1eeadbd61da070e50227b529a3ec4b8f2e780a0e6bc1dc6028ba95764736f6c634300060c00335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374"; +const isSuperArgs$s = (xs) => xs.length > 1; +class TestnetAdminProxy__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$s(args)) { + super(...args); + } else { + super(_abi$N, _bytecode$s, args[0]); + } + } + getDeployTransaction(_logic, _admin, _data, overrides) { + return super.getDeployTransaction(_logic, _admin, _data, overrides || {}); + } + deploy(_logic, _admin, _data, overrides) { + return super.deploy(_logic, _admin, _data, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$s; + static abi = _abi$N; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$N); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$N, runner); + } +} + +const _abi$M = [ + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + }, + { + internalType: "address", + name: "_governance", + type: "address" + }, + { + internalType: "address", + name: "_registry", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "instance", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "newFee", + type: "uint256" + } + ], + name: "FeeUpdated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint24", + name: "newFee", + type: "uint24" + } + ], + name: "UniswapTornPoolSwappingFeeChanged", + type: "event" + }, + { + inputs: [], + name: "PROTOCOL_FEE_DIVIDER", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "_instance", + type: "address" + } + ], + name: "calculatePoolFee", + outputs: [ + { + internalType: "uint160", + name: "", + type: "uint160" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "feeDeviations", + outputs: [ + { + components: [ + { + internalType: "address", + name: "instance", + type: "address" + }, + { + internalType: "int256", + name: "deviation", + type: "int256" + } + ], + internalType: "struct FeeManager.Deviation[]", + name: "results", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_token", + type: "address" + }, + { + internalType: "uint24", + name: "_uniswapPoolSwappingFee", + type: "uint24" + } + ], + name: "getTokenPriceRatio", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "governance", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "", + type: "address" + } + ], + name: "instanceFee", + outputs: [ + { + internalType: "uint160", + name: "", + type: "uint160" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "", + type: "address" + } + ], + name: "instanceFeeUpdated", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "_instance", + type: "address" + } + ], + name: "instanceFeeWithUpdate", + outputs: [ + { + internalType: "uint160", + name: "", + type: "uint160" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "registry", + outputs: [ + { + internalType: "contract InstanceRegistry", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint32", + name: "newPeriod", + type: "uint32" + } + ], + name: "setPeriodForTWAPOracle", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_token", + type: "address" + }, + { + internalType: "uint256", + name: "_price", + type: "uint256" + } + ], + name: "setTokenPrice", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint24", + name: "_uniswapTornPoolSwappingFee", + type: "uint24" + } + ], + name: "setUniswapTornPoolSwappingFee", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint24", + name: "newLimit", + type: "uint24" + } + ], + name: "setUpdateFeeTimeLimit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "uniswapTimePeriod", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "uniswapTornPoolSwappingFee", + outputs: [ + { + internalType: "uint24", + name: "", + type: "uint24" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "updateAllFees", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "_instance", + type: "address" + } + ], + name: "updateFee", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "updateFeeTimeLimit", + outputs: [ + { + internalType: "uint24", + name: "", + type: "uint24" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance[]", + name: "_instances", + type: "address[]" + } + ], + name: "updateFees", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$r = "0x60e06040523480156200001157600080fd5b5060405162001ca738038062001ca783398101604081905262000034916200005c565b6001600160601b0319606093841b811660805291831b821660a05290911b1660c052620000c8565b60008060006060848603121562000071578283fd5b83516200007e81620000af565b60208501519093506200009181620000af565b6040850151909250620000a481620000af565b809150509250925092565b6001600160a01b0381168114620000c557600080fd5b50565b60805160601c60a05160601c60c05160601c611b866200012160003980610350528061061452806108915280610a42525080610539528061064c528061072d528061082252508061059852806107ad5250611b866000f3fe608060405234801561001057600080fd5b506004361061012c5760003560e01c806380eb7bf0116100ad578063bcc5ee6411610071578063bcc5ee641461024b578063c51c229714610253578063d8718fb114610266578063e1f121561461027b578063f522d6d61461028e5761012c565b806380eb7bf014610202578063a028752014610215578063adf898a414610228578063aeb3077a14610230578063b19a2972146102385761012c565b8063603a54fe116100f4578063603a54fe146101ac57806369574fef146101bf5780637b103999146101d25780637ccd2f48146101da57806380679eb3146101ef5761012c565b806305e34364146101315780632efbf3841461015a578063431f63c91461017a5780634bf0a5421461018f5780635aa6e675146101a4575b600080fd5b61014461013f366004611848565b610296565b6040516101519190611ab4565b60405180910390f35b61016d610168366004611848565b6102a8565b60405161015191906118d5565b61018d6101883660046115bc565b610305565b005b61019761034b565b6040516101519190611911565b61016d610537565b61016d6101ba366004611848565b61055b565b6101446101cd366004611584565b610576565b61016d610612565b6101e2610636565b6040516101519190611aa4565b61018d6101fd366004611898565b610641565b61018d610210366004611848565b61069c565b61018d610223366004611864565b610722565b61016d6107ab565b6101446107cf565b61018d6102463660046115e7565b6107d5565b6101e2610805565b61018d610261366004611864565b610817565b61026e610874565b6040516101519190611abd565b61016d610289366004611848565b610887565b61018d610a3d565b60026020526000908152604090205481565b600080546001600160a01b038316825260026020526040822054600160381b90910462ffffff16429190910311156102e3576102e38261069c565b506001600160a01b03808216600090815260016020526040902054165b919050565b3361030e610ad7565b6001600160a01b03161461033d5760405162461bcd60e51b815260040161033490611a06565b60405180910390fd5b6103478282610af0565b5050565b6060807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166310c13ac36040518163ffffffff1660e01b815260040160006040518083038186803b1580156103a757600080fd5b505afa1580156103bb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103e3919081019061167f565b9050805167ffffffffffffffff811180156103fd57600080fd5b5060405190808252806020026020018201604052801561043757816020015b6104246114b2565b81526020019060019003908161041c5790505b50915060005b815181101561053257600061046483838151811061045757fe5b6020026020010151610887565b6001600160a01b03169050600081156104e0576103e8826001600087878151811061048b57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060009054906101000a90046001600160a01b03166103e8026001600160a01b0316816104db57fe5b040390505b60405180604001604052808585815181106104f757fe5b60200260200101516001600160a01b031681526020018281525085848151811061051d57fe5b6020908102919091010152505060010161043d565b505090565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001602052600090815260409020546001600160a01b031681565b600061058183610b19565b610600576040805180820182526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811682528516602080830191909152825180840190935260005462ffffff80821685528616918401919091526105fb929063ffffffff630100000090910416610b44565b610609565b61060983610b19565b90505b92915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60005462ffffff1681565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461067657600080fd5b6000805463ffffffff90921663010000000266ffffffff00000019909216919091179055565b60006106a782610887565b6001600160a01b03838116600081815260016020908152604080832080546001600160a01b03191695871695909517909455600290528290204290559051919250907f6f0eaf2c2f89fb4cfe96a1dee5e764d60b52c7f48aaa590f0850e308aa1b953a906107169084906118d5565b60405180910390a25050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461075757600080fd5b6000805462ffffff191662ffffff83811691909117918290556040517fbfe65cfc2359076c4468c9b895156c309c78f94fb09f6d2fc0463c4ca9a71ac2926107a0921690611aa4565b60405180910390a150565b7f000000000000000000000000000000000000000000000000000000000000000081565b61271081565b60005b8151811015610347576107fd8282815181106107f057fe5b602002602001015161069c565b6001016107d8565b600054600160381b900462ffffff1681565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461084c57600080fd5b6000805462ffffff909216600160381b0269ffffff0000000000000019909216919091179055565b6000546301000000900463ffffffff1681565b60008060008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663032bb443876040518263ffffffff1660e01b81526004016108db91906118d5565b60a06040518083038186803b1580156108f357600080fd5b505afa158015610907573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092b91906117cd565b9450945050935093508063ffffffff1660001415610950576000945050505050610300565b6001600160a01b038316158015610965575083155b61096f5782610985565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25b925060006109938484610576565b9050610a32612710610a2c8463ffffffff16610a2685610a2c670de0b6b3a76400008e6001600160a01b0316638bca6d166040518163ffffffff1660e01b815260040160206040518083038186803b1580156109ee57600080fd5b505afa158015610a02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a269190611880565b90610b90565b90610bca565b979650505050505050565b610ad57f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166310c13ac36040518163ffffffff1660e01b815260040160006040518083038186803b158015610a9957600080fd5b505afa158015610aad573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610246919081019061167f565b565b6000610ae1610c0c565b546001600160a01b0316919050565b6000610afa610c61565b6001600160a01b03909316600090815260209390935250604090912055565b600080610b24610c61565b6001600160a01b0390931660009081526020939093525050604090205490565b60208084015190830151600091610b5b9184610c98565b84518451610b7e91670de0b6b3a764000091610b78919087610c98565b90610cc2565b81610b8557fe5b0490505b9392505050565b600082610b9f5750600061060c565b82820282848281610bac57fe5b04146106095760405162461bcd60e51b815260040161033490611a63565b600061060983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610ce6565b6000807fb4d03667d60278cc15e9a68fa7679dc39ebe71350c4566a2c23c26580da4e0b360001c604051602001610c439190611ab4565b60408051601f19818403018152919052805160209091012092915050565b6000807f6521c13ddfc30471ec629848a30b01f73c36737d417c11843e7a9afa6985e84860001c604051602001610c439190611ab4565b6000610cba8473c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28585610d1d565b949350505050565b6000821580610cdd57505081810281838281610cda57fe5b04145b61060c57600080fd5b60008183610d075760405162461bcd60e51b815260040161033491906119b3565b506000838581610d1357fe5b0495945050505050565b600080846001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610d5957600080fd5b505afa158015610d6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9191906118b4565b60ff16600a0a90506001600160a01b038681169086161415610dbd576001600160801b03169050610cba565b604051630b4c774160e11b8152610e5e90610e5690731f98431c8ad98523631ae4a59f267346ea31f98490631698ee8290610e00908b908b908b906004016118e9565b60206040518083038186803b158015610e1857600080fd5b505afa158015610e2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e509190611568565b85610e6f565b828888611004565b915050610cba565b50949350505050565b600063ffffffff8216610e945760405162461bcd60e51b815260040161033490611a2c565b60408051600280825260608083018452926020830190803683370190505090508281600081518110610ec257fe5b602002602001019063ffffffff16908163ffffffff1681525050600081600181518110610eeb57fe5b63ffffffff9092166020928302919091019091015260405163883bdbfd60e01b81526060906001600160a01b0386169063883bdbfd90610f2f908590600401611969565b60006040518083038186803b158015610f4757600080fd5b505afa158015610f5b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f83919081019061170b565b509050600081600081518110610f9557fe5b602002602001015182600181518110610faa57fe5b60200260200101510390508463ffffffff168160060b81610fc757fe5b05935060008160060b128015610fee57508463ffffffff168160060b81610fea57fe5b0715155b15610ffb57600019909301925b50505092915050565b600080611010866110ee565b90506001600160801b036001600160a01b0382161161107f576001600160a01b038082168002908481169086161061105f5761105a600160c01b876001600160801b031683611407565b611077565b61107781876001600160801b0316600160c01b611407565b925050610e66565b600061109e6001600160a01b0383168068010000000000000000611407565b9050836001600160a01b0316856001600160a01b0316106110d6576110d1600160801b876001600160801b031683611407565b610a32565b610a3281876001600160801b0316600160801b611407565b60008060008360020b12611105578260020b61110d565b8260020b6000035b9050620d89e88111156111325760405162461bcd60e51b815260040161033490611a48565b60006001821661114657600160801b611158565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff169050600282161561118c576ffff97272373d413259a46990580e213a0260801c5b60048216156111ab576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b60088216156111ca576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b60108216156111e9576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615611208576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615611227576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615611246576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615611266576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615611286576ff987a7253ac413176f2b074cf7815e540260801c5b6104008216156112a6576ff3392b0822b70005940c7a398e4b70f30260801c5b6108008216156112c6576fe7159475a2c29b7443b29c7fa6e889d90260801c5b6110008216156112e6576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615611306576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615611326576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615611346576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615611367576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b62020000821615611387576e5d6af8dedb81196699c329225ee6040260801c5b620400008216156113a6576d2216e584f5fa1ea926041bedfe980260801c5b620800008216156113c3576b048a170391f7dc42444e8fa20260801c5b60008460020b13156113de5780600019816113da57fe5b0490505b6401000000008106156113f25760016113f5565b60005b60ff16602082901c0192505050919050565b600080806000198587098686029250828110908390030390508061143d576000841161143257600080fd5b508290049050610b89565b80841161144957600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b604080518082019091526000808252602082015290565b600082601f8301126114d9578081fd5b81516114ec6114e782611af5565b611ace565b81815291506020808301908481018184028601820187101561150d57600080fd5b60005b8481101561153557815161152381611b15565b84529282019290820190600101611510565b505050505092915050565b803561060c81611b15565b805161060c81611b15565b8051600681900b811461060c57600080fd5b600060208284031215611579578081fd5b815161060981611b15565b60008060408385031215611596578081fd5b82356115a181611b15565b915060208301356115b181611b2d565b809150509250929050565b600080604083850312156115ce578182fd5b82356115d981611b15565b946020939093013593505050565b600060208083850312156115f9578182fd5b823567ffffffffffffffff81111561160f578283fd5b8301601f8101851361161f578283fd5b803561162d6114e782611af5565b8181528381019083850185840285018601891015611649578687fd5b8694505b838510156116735761165f8982611540565b83526001949094019391850191850161164d565b50979650505050505050565b60006020808385031215611691578182fd5b825167ffffffffffffffff8111156116a7578283fd5b8301601f810185136116b7578283fd5b80516116c56114e782611af5565b81815283810190838501858402850186018910156116e1578687fd5b8694505b83851015611673576116f7898261154b565b8352600194909401939185019185016116e5565b6000806040838503121561171d578182fd5b825167ffffffffffffffff80821115611734578384fd5b818501915085601f830112611747578384fd5b81516117556114e782611af5565b80828252602080830192508086018a828387028901011115611775578889fd5b8896505b8487101561179f5761178b8b82611556565b845260019690960195928101928101611779565b5088015190965093505050808211156117b6578283fd5b506117c3858286016114c9565b9150509250929050565b600080600080600060a086880312156117e4578081fd5b855180151581146117f3578182fd5b602087015190955061180481611b15565b604087015190945060028110611818578182fd5b606087015190935061182981611b2d565b608087015190925061183a81611b3e565b809150509295509295909350565b600060208284031215611859578081fd5b813561060981611b15565b600060208284031215611875578081fd5b813561060981611b2d565b600060208284031215611891578081fd5b5051919050565b6000602082840312156118a9578081fd5b813561060981611b3e565b6000602082840312156118c5578081fd5b815160ff81168114610609578182fd5b6001600160a01b0391909116815260200190565b6001600160a01b03938416815291909216602082015262ffffff909116604082015260600190565b602080825282518282018190526000919060409081850190868401855b8281101561195c57815180516001600160a01b0316855286015186850152928401929085019060010161192e565b5091979650505050505050565b6020808252825182820181905260009190848201906040850190845b818110156119a757835163ffffffff1683529284019291840191600101611985565b50909695505050505050565b6000602080835283518082850152825b818110156119df578581018301518582016040015282016119c3565b818111156119f05783604083870101525b50601f01601f1916929092016040019392505050565b6020808252600c908201526b2737ba1030b71037bbb732b960a11b604082015260600190565b602080825260029082015261042560f41b604082015260600190565b6020808252600190820152601560fa1b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b62ffffff91909116815260200190565b90815260200190565b63ffffffff91909116815260200190565b60405181810167ffffffffffffffff81118282101715611aed57600080fd5b604052919050565b600067ffffffffffffffff821115611b0b578081fd5b5060209081020190565b6001600160a01b0381168114611b2a57600080fd5b50565b62ffffff81168114611b2a57600080fd5b63ffffffff81168114611b2a57600080fdfea2646970667358221220e716ce7751ca9331e897d31f3744c6916e2f742be6df42551b069b566751df4c64736f6c634300060c0033"; +const isSuperArgs$r = (xs) => xs.length > 1; +class TestnetFeeManager__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$r(args)) { + super(...args); + } else { + super(_abi$M, _bytecode$r, args[0]); + } + } + getDeployTransaction(_torn, _governance, _registry, overrides) { + return super.getDeployTransaction( + _torn, + _governance, + _registry, + overrides || {} + ); + } + deploy(_torn, _governance, _registry, overrides) { + return super.deploy( + _torn, + _governance, + _registry, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$r; + static abi = _abi$M; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$M); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$M, runner); + } +} + +const _abi$L = [ + { + inputs: [ + { + internalType: "address", + name: "_logic", + type: "address" + }, + { + internalType: "bytes", + name: "_data", + type: "bytes" + } + ], + stateMutability: "payable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "previousAdmin", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "AdminChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "implementation", + type: "address" + } + ], + name: "Upgraded", + type: "event" + }, + { + stateMutability: "payable", + type: "fallback" + }, + { + inputs: [], + name: "admin", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "callToOwner", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "changeAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "changeOwner", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "delegateToOwner", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "getCurrentOwner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "implementation", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + } + ], + name: "upgradeTo", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "upgradeToAndCall", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + } + ], + name: "upgradeToOwner", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$q = "0x608060405260405162000e6038038062000e60833981810160405260408110156200002957600080fd5b8151602083018051604051929492938301929190846401000000008211156200005157600080fd5b9083019060208201858111156200006757600080fd5b82516401000000008111828201881017156200008257600080fd5b82525081516020918201929091019080838360005b83811015620000b157818101518382015260200162000097565b50505050905090810190601f168015620000df5780820380516001836020036101000a031916815260200191505b50604052508391508290508130828281620000fa82620001ef565b805115620001b8576000826001600160a01b0316826040518082805190602001908083835b60208310620001405780518252601f1990920191602091820191016200011f565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114620001a2576040519150601f19603f3d011682016040523d82523d6000602084013e620001a7565b606091505b5050905080620001b657600080fd5b505b50620001c19050565b620001cc8262000266565b5050505050620001e7336200028a60201b620008ab1760201c565b505062000301565b6200020581620002b660201b620008d51760201c565b620002425760405162461bcd60e51b815260040180806020018281038252603681526020018062000e2a6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b8062000295620002bc565b80546001600160a01b0319166001600160a01b039290921691909117905550565b3b151590565b604080517fb4d03667d60278cc15e9a68fa7679dc39ebe71350c4566a2c23c26580da4e0b3602080830191909152825180830382018152918301909252805191012090565b610b1980620003116000396000f3fe6080604052600436106100955760003560e01c80635c60da1b116100595780635c60da1b146102fe5780638f2839701461032f578063a18a186b14610362578063a6f9dae114610377578063f851a440146103aa576100a4565b806323711ab1146100ac57806323c735f1146101625780632e44e0e0146101955780633659cfe61461024b5780634f1ef2861461027e576100a4565b366100a4576100a26103bf565b005b6100a26103bf565b6100a2600480360360408110156100c257600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100ed57600080fd5b8201836020820111156100ff57600080fd5b8035906020019184600183028401116401000000008311171561012157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506103d9945050505050565b34801561016e57600080fd5b506100a26004803603602081101561018557600080fd5b50356001600160a01b03166104e7565b6100a2600480360360408110156101ab57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156101d657600080fd5b8201836020820111156101e857600080fd5b8035906020019184600183028401116401000000008311171561020a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610546945050505050565b34801561025757600080fd5b506100a26004803603602081101561026e57600080fd5b50356001600160a01b031661063a565b6100a26004803603604081101561029457600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156102bf57600080fd5b8201836020820111156102d157600080fd5b803590602001918460018302840111640100000000831117156102f357600080fd5b509092509050610671565b34801561030a57600080fd5b5061031361071e565b604080516001600160a01b039092168252519081900360200190f35b34801561033b57600080fd5b506100a26004803603602081101561035257600080fd5b50356001600160a01b031661075b565b34801561036e57600080fd5b50610313610815565b34801561038357600080fd5b506100a26004803603602081101561039a57600080fd5b50356001600160a01b0316610824565b3480156103b657600080fd5b50610313610880565b6103c76103d7565b6103d76103d26108db565b610900565b565b336103e2610924565b6001600160a01b03161461042c576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b6020831061046a5780518252601f19909201916020918201910161044b565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146104ca576040519150601f19603f3d011682016040523d82523d6000602084013e6104cf565b606091505b5091509150816104e157805181602001fd5b50505050565b336104f0610924565b6001600160a01b03161461053a576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b6105438161093d565b50565b3361054f610924565b6001600160a01b031614610599576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b60006060836001600160a01b031634846040518082805190602001908083835b602083106105d85780518252601f1990920191602091820191016105b9565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146104ca576040519150601f19603f3d011682016040523d82523d6000602084013e6104cf565b61064261097d565b6001600160a01b0316336001600160a01b03161415610669576106648161093d565b610543565b6105436103bf565b61067961097d565b6001600160a01b0316336001600160a01b031614156107115761069b8361093d565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146106f8576040519150601f19603f3d011682016040523d82523d6000602084013e6106fd565b606091505b505090508061070b57600080fd5b50610719565b6107196103bf565b505050565b600061072861097d565b6001600160a01b0316336001600160a01b03161415610750576107496108db565b9050610758565b6107586103bf565b90565b61076361097d565b6001600160a01b0316336001600160a01b03161415610669576001600160a01b0381166107c15760405162461bcd60e51b815260040180806020018281038252603a815260200180610a74603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6107ea61097d565b604080516001600160a01b03928316815291841660208301528051918290030190a1610664816109a2565b600061081f610924565b905090565b3361082d610924565b6001600160a01b031614610877576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b610543816108ab565b600061088a61097d565b6001600160a01b0316336001600160a01b031614156107505761074961097d565b806108b46109c6565b80546001600160a01b0319166001600160a01b039290921691909117905550565b3b151590565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561091f573d6000f35b3d6000fd5b600061092e6109c6565b546001600160a01b0316919050565b61094681610a0b565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b604080517fb4d03667d60278cc15e9a68fa7679dc39ebe71350c4566a2c23c26580da4e0b3602080830191909152825180830382018152918301909252805191012090565b610a14816108d5565b610a4f5760405162461bcd60e51b8152600401808060200182810382526036815260200180610aae6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374a2646970667358221220486b8f46c84e133fdcdf09d6e85ae28603a923477471dc965d4d7f5f3634234c64736f6c634300060c00335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374"; +const isSuperArgs$q = (xs) => xs.length > 1; +class TestnetGovernanceProxy__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$q(args)) { + super(...args); + } else { + super(_abi$L, _bytecode$q, args[0]); + } + } + getDeployTransaction(_logic, _data, overrides) { + return super.getDeployTransaction(_logic, _data, overrides || {}); + } + deploy(_logic, _data, overrides) { + return super.deploy(_logic, _data, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$q; + static abi = _abi$L; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$L); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$L, + runner + ); + } +} + +var index$r = /*#__PURE__*/Object.freeze({ + __proto__: null, + TestnetAdminProxy__factory: TestnetAdminProxy__factory, + TestnetFeeManager__factory: TestnetFeeManager__factory, + TestnetGovernanceProxy__factory: TestnetGovernanceProxy__factory, + testnetOracleSol: index$s +}); + +const _abi$K = [ + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "lockedBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "userVault", + outputs: [ + { + internalType: "contract ITornadoVault", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +class ITornadoGovernance__factory { + static abi = _abi$K; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$K); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$K, runner); + } +} + +const _abi$J = [ + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdrawTorn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +let ITornadoVault__factory$1 = class ITornadoVault__factory { + static abi = _abi$J; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$J); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$J, runner); + } +}; + +const _abi$I = [ + { + inputs: [ + { + internalType: "address", + name: "governanceAddress", + type: "address" + }, + { + internalType: "address", + name: "tornAddress", + type: "address" + }, + { + internalType: "address", + name: "_relayerRegistry", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "rewardsClaimed", + type: "uint256" + } + ], + name: "RewardsClaimed", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "rewards", + type: "uint256" + } + ], + name: "RewardsUpdated", + type: "event" + }, + { + inputs: [], + name: "Governance", + outputs: [ + { + internalType: "contract ITornadoGovernance", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "accumulatedRewardPerTorn", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "accumulatedRewardRateOnLastUpdate", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "accumulatedRewards", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "addBurnRewards", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "checkReward", + outputs: [ + { + internalType: "uint256", + name: "rewards", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getReward", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "ratioConstant", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "relayerRegistry", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "setReward", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "amountLockedBeforehand", + type: "uint256" + } + ], + name: "updateRewardsOnLockedBalanceChange", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdrawTorn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$p = "0x6101006040523480156200001257600080fd5b50604051620011e4380380620011e48339810160408190526200003591620000e0565b6001600160601b0319606084811b821660a05283811b821660c05282901b1660e052604080516318160ddd60e01b815290516001600160a01b038416916318160ddd916004808301926020929190829003018186803b1580156200009857600080fd5b505afa158015620000ad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000d3919062000133565b6080525062000165915050565b600080600060608486031215620000f5578283fd5b835162000102816200014c565b602085015190935062000115816200014c565b604085015190925062000128816200014c565b809150509250925092565b60006020828403121562000145578081fd5b5051919050565b6001600160a01b03811681146200016257600080fd5b50565b60805160a05160601c60c05160601c60e05160601c610ff0620001f4600039806101eb52806104f652508061023a52806104815280610574528061084252806108d75250806101b9528061026952806103ab5280610550528061059b52806106e5528061078052806107e452806108f952508061036a528061052c528061065f52806109f55250610ff06000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063adf898a41161008c578063e0d3265211610066578063e0d326521461016d578063e113335f14610175578063eacccaf014610188578063f58073b11461019b576100cf565b8063adf898a41461013f578063c3c90e6414610147578063d7ada20d1461015a576100cf565b8063338610af146100d45780633d18b912146100e957806347ff589d146100f157806373f273fc1461010f57806380a120411461012f5780639453911214610137575b600080fd5b6100e76100e2366004610d78565b6101ae565b005b6100e76103a3565b6100f96104f4565b6040516101069190610dc4565b60405180910390f35b61012261011d366004610cf5565b610518565b6040516101069190610f6c565b61012261052a565b6100f961054e565b6100f9610572565b610122610155366004610cf5565b610596565b610122610168366004610cf5565b6106c2565b6101226106d4565b6100e7610183366004610d11565b6106da565b6100e7610196366004610d11565b610775565b6100e76101a9366004610d78565b6107d9565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061020d5750336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016145b6102325760405162461bcd60e51b815260040161022990610ec5565b60405180910390fd5b61039d6103947f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a082317f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639daafec76040518163ffffffff1660e01b815260040160206040518083038186803b1580156102c057600080fd5b505afa1580156102d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f89190610d5c565b6040518263ffffffff1660e01b81526004016103149190610dc4565b60206040518083038186803b15801561032c57600080fd5b505afa158015610340573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103649190610d90565b61038e847f0000000000000000000000000000000000000000000000000000000000000000610921565b90610964565b600154906109a6565b60015550565b600061044a337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639ae697bf336040518263ffffffff1660e01b81526004016103f59190610dc4565b60206040518083038186803b15801561040d57600080fd5b505afa158015610421573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104459190610d90565b6109cb565b336000908152600360205260409020549091506104689082906109a6565b336000818152600360205260408120559091506104b0907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169083610a85565b336001600160a01b03167ffc30cddea38e2bf4d6ea7d3f9ed3b6ad7f176419f4963bd81318067a4aee73fe826040516104e99190610f6c565b60405180910390a250565b7f000000000000000000000000000000000000000000000000000000000000000081565b60036020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639ae697bf846040518263ffffffff1660e01b81526004016105e59190610dc4565b60206040518083038186803b1580156105fd57600080fd5b505afa158015610611573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106359190610d90565b90508015610697576001600160a01b038316600090815260026020526040902054600154610694917f00000000000000000000000000000000000000000000000000000000000000009161038e91859161068e91610ae0565b90610921565b91505b6001600160a01b0383166000908152600360205260409020546106bb9083906109a6565b9392505050565b60026020526000908152604090205481565b60015481565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146107225760405162461bcd60e51b815260040161022990610e5b565b600061072e83836109cb565b6001600160a01b03841660009081526003602052604090205490915061075490826109a6565b6001600160a01b039093166000908152600360205260409020929092555050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146107bd5760405162461bcd60e51b815260040161022990610e5b565b6001600160a01b03909116600090815260036020526040902055565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108215760405162461bcd60e51b815260040161022990610e5b565b6000198114156108ca576040516370a0823160e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190610877903090600401610dc4565b60206040518083038186803b15801561088f57600080fd5b505afa1580156108a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c79190610d90565b90505b61091e6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f000000000000000000000000000000000000000000000000000000000000000083610a85565b50565b6000826109305750600061095e565b8282028284828161093d57fe5b041461095b5760405162461bcd60e51b815260040161022990610e84565b90505b92915050565b600061095b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610b22565b60008282018381101561095b5760405162461bcd60e51b815260040161022990610e24565b60008115610a27576001600160a01b038316600090815260026020526040902054600154610a24917f00000000000000000000000000000000000000000000000000000000000000009161038e91869161068e91610ae0565b90505b6001546001600160a01b038416600081815260026020526040908190209290925590517f39fe62076cf7adf3c60e355a2da5a4f17a958ca319e8eba385a6c09a8b64901690610a77908490610f6c565b60405180910390a292915050565b610adb8363a9059cbb60e01b8484604051602401610aa4929190610dd8565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b59565b505050565b600061095b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610be8565b60008183610b435760405162461bcd60e51b81526004016102299190610df1565b506000838581610b4f57fe5b0495945050505050565b6060610bae826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c149092919063ffffffff16565b805190915015610adb5780806020019051810190610bcc9190610d3c565b610adb5760405162461bcd60e51b815260040161022990610f22565b60008184841115610c0c5760405162461bcd60e51b81526004016102299190610df1565b505050900390565b6060610c238484600085610c2b565b949350505050565b6060610c3685610cef565b610c525760405162461bcd60e51b815260040161022990610eeb565b60006060866001600160a01b03168587604051610c6f9190610da8565b60006040518083038185875af1925050503d8060008114610cac576040519150601f19603f3d011682016040523d82523d6000602084013e610cb1565b606091505b50915091508115610cc5579150610c239050565b805115610cd55780518082602001fd5b8360405162461bcd60e51b81526004016102299190610df1565b3b151590565b600060208284031215610d06578081fd5b813561095b81610fa5565b60008060408385031215610d23578081fd5b8235610d2e81610fa5565b946020939093013593505050565b600060208284031215610d4d578081fd5b8151801515811461095b578182fd5b600060208284031215610d6d578081fd5b815161095b81610fa5565b600060208284031215610d89578081fd5b5035919050565b600060208284031215610da1578081fd5b5051919050565b60008251610dba818460208701610f75565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6000602082528251806020840152610e10816040850160208701610f75565b601f01601f19169190910160400192915050565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252600f908201526e6f6e6c7920676f7665726e616e636560881b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252600c908201526b1d5b985d5d1a1bdc9a5e995960a21b604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b90815260200190565b60005b83811015610f90578181015183820152602001610f78565b83811115610f9f576000848401525b50505050565b6001600160a01b038116811461091e57600080fdfea2646970667358221220007ef4aab133b842800388614e081de933a2da981d94088bca1e1a924db5174764736f6c634300060c0033"; +const isSuperArgs$p = (xs) => xs.length > 1; +class TornadoStakingRewards__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$p(args)) { + super(...args); + } else { + super(_abi$I, _bytecode$p, args[0]); + } + } + getDeployTransaction(governanceAddress, tornAddress, _relayerRegistry, overrides) { + return super.getDeployTransaction( + governanceAddress, + tornAddress, + _relayerRegistry, + overrides || {} + ); + } + deploy(governanceAddress, tornAddress, _relayerRegistry, overrides) { + return super.deploy( + governanceAddress, + tornAddress, + _relayerRegistry, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$p; + static abi = _abi$I; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$I); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$I, + runner + ); + } +} + +var index$q = /*#__PURE__*/Object.freeze({ + __proto__: null, + ITornadoGovernance__factory: ITornadoGovernance__factory, + ITornadoVault__factory: ITornadoVault__factory$1, + TornadoStakingRewards__factory: TornadoStakingRewards__factory +}); + +const _abi$H = [ + { + inputs: [ + { + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + internalType: "uint128", + name: "amount", + type: "uint128" + } + ], + name: "burn", + outputs: [ + { + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount1", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + internalType: "uint128", + name: "amount0Requested", + type: "uint128" + }, + { + internalType: "uint128", + name: "amount1Requested", + type: "uint128" + } + ], + name: "collect", + outputs: [ + { + internalType: "uint128", + name: "amount0", + type: "uint128" + }, + { + internalType: "uint128", + name: "amount1", + type: "uint128" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount1", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "flash", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint16", + name: "observationCardinalityNext", + type: "uint16" + } + ], + name: "increaseObservationCardinalityNext", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint160", + name: "sqrtPriceX96", + type: "uint160" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + internalType: "uint128", + name: "amount", + type: "uint128" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "mint", + outputs: [ + { + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount1", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "bool", + name: "zeroForOne", + type: "bool" + }, + { + internalType: "int256", + name: "amountSpecified", + type: "int256" + }, + { + internalType: "uint160", + name: "sqrtPriceLimitX96", + type: "uint160" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "swap", + outputs: [ + { + internalType: "int256", + name: "amount0", + type: "int256" + }, + { + internalType: "int256", + name: "amount1", + type: "int256" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +class IUniswapV3PoolActions__factory { + static abi = _abi$H; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$H); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$H, + runner + ); + } +} + +const _abi$G = [ + { + inputs: [ + { + internalType: "uint32[]", + name: "secondsAgos", + type: "uint32[]" + } + ], + name: "observe", + outputs: [ + { + internalType: "int56[]", + name: "tickCumulatives", + type: "int56[]" + }, + { + internalType: "uint160[]", + name: "secondsPerLiquidityCumulativeX128s", + type: "uint160[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24" + } + ], + name: "snapshotCumulativesInside", + outputs: [ + { + internalType: "int56", + name: "tickCumulativeInside", + type: "int56" + }, + { + internalType: "uint160", + name: "secondsPerLiquidityInsideX128", + type: "uint160" + }, + { + internalType: "uint32", + name: "secondsInside", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IUniswapV3PoolDerivedState__factory { + static abi = _abi$G; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$G); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$G, + runner + ); + } +} + +const _abi$F = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + indexed: true, + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + indexed: false, + internalType: "uint128", + name: "amount", + type: "uint128" + }, + { + indexed: false, + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "amount1", + type: "uint256" + } + ], + name: "Burn", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "recipient", + type: "address" + }, + { + indexed: true, + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + indexed: true, + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + indexed: false, + internalType: "uint128", + name: "amount0", + type: "uint128" + }, + { + indexed: false, + internalType: "uint128", + name: "amount1", + type: "uint128" + } + ], + name: "Collect", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "recipient", + type: "address" + }, + { + indexed: false, + internalType: "uint128", + name: "amount0", + type: "uint128" + }, + { + indexed: false, + internalType: "uint128", + name: "amount1", + type: "uint128" + } + ], + name: "CollectProtocol", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "recipient", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "amount1", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "paid0", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "paid1", + type: "uint256" + } + ], + name: "Flash", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint16", + name: "observationCardinalityNextOld", + type: "uint16" + }, + { + indexed: false, + internalType: "uint16", + name: "observationCardinalityNextNew", + type: "uint16" + } + ], + name: "IncreaseObservationCardinalityNext", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint160", + name: "sqrtPriceX96", + type: "uint160" + }, + { + indexed: false, + internalType: "int24", + name: "tick", + type: "int24" + } + ], + name: "Initialize", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "sender", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + indexed: true, + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + indexed: false, + internalType: "uint128", + name: "amount", + type: "uint128" + }, + { + indexed: false, + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "amount1", + type: "uint256" + } + ], + name: "Mint", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint8", + name: "feeProtocol0Old", + type: "uint8" + }, + { + indexed: false, + internalType: "uint8", + name: "feeProtocol1Old", + type: "uint8" + }, + { + indexed: false, + internalType: "uint8", + name: "feeProtocol0New", + type: "uint8" + }, + { + indexed: false, + internalType: "uint8", + name: "feeProtocol1New", + type: "uint8" + } + ], + name: "SetFeeProtocol", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "recipient", + type: "address" + }, + { + indexed: false, + internalType: "int256", + name: "amount0", + type: "int256" + }, + { + indexed: false, + internalType: "int256", + name: "amount1", + type: "int256" + }, + { + indexed: false, + internalType: "uint160", + name: "sqrtPriceX96", + type: "uint160" + }, + { + indexed: false, + internalType: "uint128", + name: "liquidity", + type: "uint128" + }, + { + indexed: false, + internalType: "int24", + name: "tick", + type: "int24" + } + ], + name: "Swap", + type: "event" + } +]; +class IUniswapV3PoolEvents__factory { + static abi = _abi$F; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$F); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$F, + runner + ); + } +} + +const _abi$E = [ + { + inputs: [], + name: "factory", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "fee", + outputs: [ + { + internalType: "uint24", + name: "", + type: "uint24" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "maxLiquidityPerTick", + outputs: [ + { + internalType: "uint128", + name: "", + type: "uint128" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "tickSpacing", + outputs: [ + { + internalType: "int24", + name: "", + type: "int24" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "token0", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "token1", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IUniswapV3PoolImmutables__factory { + static abi = _abi$E; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$E); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$E, + runner + ); + } +} + +const _abi$D = [ + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint128", + name: "amount0Requested", + type: "uint128" + }, + { + internalType: "uint128", + name: "amount1Requested", + type: "uint128" + } + ], + name: "collectProtocol", + outputs: [ + { + internalType: "uint128", + name: "amount0", + type: "uint128" + }, + { + internalType: "uint128", + name: "amount1", + type: "uint128" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint8", + name: "feeProtocol0", + type: "uint8" + }, + { + internalType: "uint8", + name: "feeProtocol1", + type: "uint8" + } + ], + name: "setFeeProtocol", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class IUniswapV3PoolOwnerActions__factory { + static abi = _abi$D; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$D); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$D, + runner + ); + } +} + +const _abi$C = [ + { + inputs: [], + name: "feeGrowthGlobal0X128", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "feeGrowthGlobal1X128", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "liquidity", + outputs: [ + { + internalType: "uint128", + name: "", + type: "uint128" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "index", + type: "uint256" + } + ], + name: "observations", + outputs: [ + { + internalType: "uint32", + name: "blockTimestamp", + type: "uint32" + }, + { + internalType: "int56", + name: "tickCumulative", + type: "int56" + }, + { + internalType: "uint160", + name: "secondsPerLiquidityCumulativeX128", + type: "uint160" + }, + { + internalType: "bool", + name: "initialized", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "key", + type: "bytes32" + } + ], + name: "positions", + outputs: [ + { + internalType: "uint128", + name: "_liquidity", + type: "uint128" + }, + { + internalType: "uint256", + name: "feeGrowthInside0LastX128", + type: "uint256" + }, + { + internalType: "uint256", + name: "feeGrowthInside1LastX128", + type: "uint256" + }, + { + internalType: "uint128", + name: "tokensOwed0", + type: "uint128" + }, + { + internalType: "uint128", + name: "tokensOwed1", + type: "uint128" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "protocolFees", + outputs: [ + { + internalType: "uint128", + name: "token0", + type: "uint128" + }, + { + internalType: "uint128", + name: "token1", + type: "uint128" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "slot0", + outputs: [ + { + internalType: "uint160", + name: "sqrtPriceX96", + type: "uint160" + }, + { + internalType: "int24", + name: "tick", + type: "int24" + }, + { + internalType: "uint16", + name: "observationIndex", + type: "uint16" + }, + { + internalType: "uint16", + name: "observationCardinality", + type: "uint16" + }, + { + internalType: "uint16", + name: "observationCardinalityNext", + type: "uint16" + }, + { + internalType: "uint8", + name: "feeProtocol", + type: "uint8" + }, + { + internalType: "bool", + name: "unlocked", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "int16", + name: "wordPosition", + type: "int16" + } + ], + name: "tickBitmap", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "int24", + name: "tick", + type: "int24" + } + ], + name: "ticks", + outputs: [ + { + internalType: "uint128", + name: "liquidityGross", + type: "uint128" + }, + { + internalType: "int128", + name: "liquidityNet", + type: "int128" + }, + { + internalType: "uint256", + name: "feeGrowthOutside0X128", + type: "uint256" + }, + { + internalType: "uint256", + name: "feeGrowthOutside1X128", + type: "uint256" + }, + { + internalType: "int56", + name: "tickCumulativeOutside", + type: "int56" + }, + { + internalType: "uint160", + name: "secondsPerLiquidityOutsideX128", + type: "uint160" + }, + { + internalType: "uint32", + name: "secondsOutside", + type: "uint32" + }, + { + internalType: "bool", + name: "initialized", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IUniswapV3PoolState__factory { + static abi = _abi$C; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$C); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$C, + runner + ); + } +} + +var index$p = /*#__PURE__*/Object.freeze({ + __proto__: null, + IUniswapV3PoolActions__factory: IUniswapV3PoolActions__factory, + IUniswapV3PoolDerivedState__factory: IUniswapV3PoolDerivedState__factory, + IUniswapV3PoolEvents__factory: IUniswapV3PoolEvents__factory, + IUniswapV3PoolImmutables__factory: IUniswapV3PoolImmutables__factory, + IUniswapV3PoolOwnerActions__factory: IUniswapV3PoolOwnerActions__factory, + IUniswapV3PoolState__factory: IUniswapV3PoolState__factory +}); + +const _abi$B = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint24", + name: "fee", + type: "uint24" + }, + { + indexed: true, + internalType: "int24", + name: "tickSpacing", + type: "int24" + } + ], + name: "FeeAmountEnabled", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "oldOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnerChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "token0", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "token1", + type: "address" + }, + { + indexed: true, + internalType: "uint24", + name: "fee", + type: "uint24" + }, + { + indexed: false, + internalType: "int24", + name: "tickSpacing", + type: "int24" + }, + { + indexed: false, + internalType: "address", + name: "pool", + type: "address" + } + ], + name: "PoolCreated", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "tokenA", + type: "address" + }, + { + internalType: "address", + name: "tokenB", + type: "address" + }, + { + internalType: "uint24", + name: "fee", + type: "uint24" + } + ], + name: "createPool", + outputs: [ + { + internalType: "address", + name: "pool", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint24", + name: "fee", + type: "uint24" + }, + { + internalType: "int24", + name: "tickSpacing", + type: "int24" + } + ], + name: "enableFeeAmount", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint24", + name: "fee", + type: "uint24" + } + ], + name: "feeAmountTickSpacing", + outputs: [ + { + internalType: "int24", + name: "", + type: "int24" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "tokenA", + type: "address" + }, + { + internalType: "address", + name: "tokenB", + type: "address" + }, + { + internalType: "uint24", + name: "fee", + type: "uint24" + } + ], + name: "getPool", + outputs: [ + { + internalType: "address", + name: "pool", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_owner", + type: "address" + } + ], + name: "setOwner", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class IUniswapV3Factory__factory { + static abi = _abi$B; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$B); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$B, runner); + } +} + +const _abi$A = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + indexed: true, + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + indexed: false, + internalType: "uint128", + name: "amount", + type: "uint128" + }, + { + indexed: false, + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "amount1", + type: "uint256" + } + ], + name: "Burn", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "recipient", + type: "address" + }, + { + indexed: true, + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + indexed: true, + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + indexed: false, + internalType: "uint128", + name: "amount0", + type: "uint128" + }, + { + indexed: false, + internalType: "uint128", + name: "amount1", + type: "uint128" + } + ], + name: "Collect", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "recipient", + type: "address" + }, + { + indexed: false, + internalType: "uint128", + name: "amount0", + type: "uint128" + }, + { + indexed: false, + internalType: "uint128", + name: "amount1", + type: "uint128" + } + ], + name: "CollectProtocol", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "recipient", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "amount1", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "paid0", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "paid1", + type: "uint256" + } + ], + name: "Flash", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint16", + name: "observationCardinalityNextOld", + type: "uint16" + }, + { + indexed: false, + internalType: "uint16", + name: "observationCardinalityNextNew", + type: "uint16" + } + ], + name: "IncreaseObservationCardinalityNext", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint160", + name: "sqrtPriceX96", + type: "uint160" + }, + { + indexed: false, + internalType: "int24", + name: "tick", + type: "int24" + } + ], + name: "Initialize", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "sender", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + indexed: true, + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + indexed: false, + internalType: "uint128", + name: "amount", + type: "uint128" + }, + { + indexed: false, + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "amount1", + type: "uint256" + } + ], + name: "Mint", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint8", + name: "feeProtocol0Old", + type: "uint8" + }, + { + indexed: false, + internalType: "uint8", + name: "feeProtocol1Old", + type: "uint8" + }, + { + indexed: false, + internalType: "uint8", + name: "feeProtocol0New", + type: "uint8" + }, + { + indexed: false, + internalType: "uint8", + name: "feeProtocol1New", + type: "uint8" + } + ], + name: "SetFeeProtocol", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "recipient", + type: "address" + }, + { + indexed: false, + internalType: "int256", + name: "amount0", + type: "int256" + }, + { + indexed: false, + internalType: "int256", + name: "amount1", + type: "int256" + }, + { + indexed: false, + internalType: "uint160", + name: "sqrtPriceX96", + type: "uint160" + }, + { + indexed: false, + internalType: "uint128", + name: "liquidity", + type: "uint128" + }, + { + indexed: false, + internalType: "int24", + name: "tick", + type: "int24" + } + ], + name: "Swap", + type: "event" + }, + { + inputs: [ + { + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + internalType: "uint128", + name: "amount", + type: "uint128" + } + ], + name: "burn", + outputs: [ + { + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount1", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + internalType: "uint128", + name: "amount0Requested", + type: "uint128" + }, + { + internalType: "uint128", + name: "amount1Requested", + type: "uint128" + } + ], + name: "collect", + outputs: [ + { + internalType: "uint128", + name: "amount0", + type: "uint128" + }, + { + internalType: "uint128", + name: "amount1", + type: "uint128" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint128", + name: "amount0Requested", + type: "uint128" + }, + { + internalType: "uint128", + name: "amount1Requested", + type: "uint128" + } + ], + name: "collectProtocol", + outputs: [ + { + internalType: "uint128", + name: "amount0", + type: "uint128" + }, + { + internalType: "uint128", + name: "amount1", + type: "uint128" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "factory", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "fee", + outputs: [ + { + internalType: "uint24", + name: "", + type: "uint24" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "feeGrowthGlobal0X128", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "feeGrowthGlobal1X128", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount1", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "flash", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint16", + name: "observationCardinalityNext", + type: "uint16" + } + ], + name: "increaseObservationCardinalityNext", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint160", + name: "sqrtPriceX96", + type: "uint160" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "liquidity", + outputs: [ + { + internalType: "uint128", + name: "", + type: "uint128" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "maxLiquidityPerTick", + outputs: [ + { + internalType: "uint128", + name: "", + type: "uint128" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + internalType: "uint128", + name: "amount", + type: "uint128" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "mint", + outputs: [ + { + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount1", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "index", + type: "uint256" + } + ], + name: "observations", + outputs: [ + { + internalType: "uint32", + name: "blockTimestamp", + type: "uint32" + }, + { + internalType: "int56", + name: "tickCumulative", + type: "int56" + }, + { + internalType: "uint160", + name: "secondsPerLiquidityCumulativeX128", + type: "uint160" + }, + { + internalType: "bool", + name: "initialized", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint32[]", + name: "secondsAgos", + type: "uint32[]" + } + ], + name: "observe", + outputs: [ + { + internalType: "int56[]", + name: "tickCumulatives", + type: "int56[]" + }, + { + internalType: "uint160[]", + name: "secondsPerLiquidityCumulativeX128s", + type: "uint160[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "key", + type: "bytes32" + } + ], + name: "positions", + outputs: [ + { + internalType: "uint128", + name: "_liquidity", + type: "uint128" + }, + { + internalType: "uint256", + name: "feeGrowthInside0LastX128", + type: "uint256" + }, + { + internalType: "uint256", + name: "feeGrowthInside1LastX128", + type: "uint256" + }, + { + internalType: "uint128", + name: "tokensOwed0", + type: "uint128" + }, + { + internalType: "uint128", + name: "tokensOwed1", + type: "uint128" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "protocolFees", + outputs: [ + { + internalType: "uint128", + name: "token0", + type: "uint128" + }, + { + internalType: "uint128", + name: "token1", + type: "uint128" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint8", + name: "feeProtocol0", + type: "uint8" + }, + { + internalType: "uint8", + name: "feeProtocol1", + type: "uint8" + } + ], + name: "setFeeProtocol", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "slot0", + outputs: [ + { + internalType: "uint160", + name: "sqrtPriceX96", + type: "uint160" + }, + { + internalType: "int24", + name: "tick", + type: "int24" + }, + { + internalType: "uint16", + name: "observationIndex", + type: "uint16" + }, + { + internalType: "uint16", + name: "observationCardinality", + type: "uint16" + }, + { + internalType: "uint16", + name: "observationCardinalityNext", + type: "uint16" + }, + { + internalType: "uint8", + name: "feeProtocol", + type: "uint8" + }, + { + internalType: "bool", + name: "unlocked", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24" + } + ], + name: "snapshotCumulativesInside", + outputs: [ + { + internalType: "int56", + name: "tickCumulativeInside", + type: "int56" + }, + { + internalType: "uint160", + name: "secondsPerLiquidityInsideX128", + type: "uint160" + }, + { + internalType: "uint32", + name: "secondsInside", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "bool", + name: "zeroForOne", + type: "bool" + }, + { + internalType: "int256", + name: "amountSpecified", + type: "int256" + }, + { + internalType: "uint160", + name: "sqrtPriceLimitX96", + type: "uint160" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "swap", + outputs: [ + { + internalType: "int256", + name: "amount0", + type: "int256" + }, + { + internalType: "int256", + name: "amount1", + type: "int256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "int16", + name: "wordPosition", + type: "int16" + } + ], + name: "tickBitmap", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "tickSpacing", + outputs: [ + { + internalType: "int24", + name: "", + type: "int24" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "int24", + name: "tick", + type: "int24" + } + ], + name: "ticks", + outputs: [ + { + internalType: "uint128", + name: "liquidityGross", + type: "uint128" + }, + { + internalType: "int128", + name: "liquidityNet", + type: "int128" + }, + { + internalType: "uint256", + name: "feeGrowthOutside0X128", + type: "uint256" + }, + { + internalType: "uint256", + name: "feeGrowthOutside1X128", + type: "uint256" + }, + { + internalType: "int56", + name: "tickCumulativeOutside", + type: "int56" + }, + { + internalType: "uint160", + name: "secondsPerLiquidityOutsideX128", + type: "uint160" + }, + { + internalType: "uint32", + name: "secondsOutside", + type: "uint32" + }, + { + internalType: "bool", + name: "initialized", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "token0", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "token1", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IUniswapV3Pool__factory { + static abi = _abi$A; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$A); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$A, runner); + } +} + +var index$o = /*#__PURE__*/Object.freeze({ + __proto__: null, + IUniswapV3Factory__factory: IUniswapV3Factory__factory, + IUniswapV3Pool__factory: IUniswapV3Pool__factory, + pool: index$p +}); + +var index$n = /*#__PURE__*/Object.freeze({ + __proto__: null, + interfaces: index$o +}); + +var index$m = /*#__PURE__*/Object.freeze({ + __proto__: null, + contracts: index$n +}); + +var index$l = /*#__PURE__*/Object.freeze({ + __proto__: null, + v3Core: index$m +}); + +const _abi$z = [ + { + inputs: [], + name: "denomination", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "commitment", + type: "bytes32" + } + ], + name: "deposit", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "token", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "proof", + type: "bytes" + }, + { + internalType: "bytes32", + name: "root", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "nullifierHash", + type: "bytes32" + }, + { + internalType: "address payable", + name: "recipient", + type: "address" + }, + { + internalType: "address payable", + name: "relayer", + type: "address" + }, + { + internalType: "uint256", + name: "fee", + type: "uint256" + }, + { + internalType: "uint256", + name: "refund", + type: "uint256" + } + ], + name: "withdraw", + outputs: [], + stateMutability: "payable", + type: "function" + } +]; +class ITornadoInstance__factory { + static abi = _abi$z; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$z); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$z, runner); + } +} + +var index$k = /*#__PURE__*/Object.freeze({ + __proto__: null, + ITornadoInstance__factory: ITornadoInstance__factory +}); + +const _abi$y = [ + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IERC20Decimals__factory { + static abi = _abi$y; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$y); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$y, runner); + } +} + +var index$j = /*#__PURE__*/Object.freeze({ + __proto__: null, + IERC20Decimals__factory: IERC20Decimals__factory +}); + +var index$i = /*#__PURE__*/Object.freeze({ + __proto__: null, + uniswapV3OracleHelperSol: index$j +}); + +const _abi$x = [ + { + inputs: [], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "text", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "value", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$o = "0x608060405234801561001057600080fd5b50610278806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631f1bd692146100465780633fa4f245146100c35780638129fc1c146100dd575b600080fd5b61004e6100e7565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610088578181015183820152602001610070565b50505050905090810190601f1680156100b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100cb610174565b60408051918252519081900360200190f35b6100e561017a565b005b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561016c5780601f106101415761010080835404028352916020019161016c565b820191906000526020600020905b81548152906001019060200180831161014f57829003601f168201915b505050505081565b60005481565b600160008190556040805180820190915260058082526464756d6d7960d81b60209092019182526101ac9291906101af565b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106101f057805160ff191683800117855561021d565b8280016001018555821561021d579182015b8281111561021d578251825591602001919060010190610202565b5061022992915061022d565b5090565b5b80821115610229576000815560010161022e56fea26469706673582212204b4d54284aeff9c7c570415da4a9efb9bf7115fe94a322210f9981c1c7ae107a64736f6c634300060c0033"; +const isSuperArgs$o = (xs) => xs.length > 1; +class Dummy__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$o(args)) { + super(...args); + } else { + super(_abi$x, _bytecode$o, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$o; + static abi = _abi$x; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$x); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$x, runner); + } +} + +const _abi$w = [ + { + inputs: [], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "text", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "value", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$n = "0x608060405234801561001057600080fd5b50610278806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631f1bd692146100465780633fa4f245146100c35780638129fc1c146100dd575b600080fd5b61004e6100e7565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610088578181015183820152602001610070565b50505050905090810190601f1680156100b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100cb610174565b60408051918252519081900360200190f35b6100e561017a565b005b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561016c5780601f106101415761010080835404028352916020019161016c565b820191906000526020600020905b81548152906001019060200180831161014f57829003601f168201915b505050505081565b60005481565b600260005560408051808201909152600680825265323ab6b6bc9960d11b60209092019182526101ac916001916101af565b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106101f057805160ff191683800117855561021d565b8280016001018555821561021d579182015b8281111561021d578251825591602001919060010190610202565b5061022992915061022d565b5090565b5b80821115610229576000815560010161022e56fea2646970667358221220056d994e19772e421a19f4bcf8cb09061d5645867c4c352106bf6b809fb5de3664736f6c634300060c0033"; +const isSuperArgs$n = (xs) => xs.length > 1; +class DummySecond__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$n(args)) { + super(...args); + } else { + super(_abi$w, _bytecode$n, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$n; + static abi = _abi$w; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$w); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$w, runner); + } +} + +var index$h = /*#__PURE__*/Object.freeze({ + __proto__: null, + DummySecond__factory: DummySecond__factory, + Dummy__factory: Dummy__factory +}); + +const _abi$v = [ + { + inputs: [ + { + internalType: "uint256", + name: "delay", + type: "uint256" + } + ], + name: "setExecutionDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class IGovernance__factory { + static abi = _abi$v; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$v); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$v, runner); + } +} + +const _abi$u = [ + { + inputs: [], + name: "executeProposal", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$m = "0x608060405234801561001057600080fd5b5060c48061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063373058b814602d575b600080fd5b60336035565b005b6040805163e4917d9f60e01b81526203f48060048201529051309163e4917d9f91602480830192600092919082900301818387803b158015607557600080fd5b505af11580156088573d6000803e3d6000fd5b5050505056fea264697066735822122080cc4a797d58ff69ba6d6a0d2a3849574ef67da2d75c41e66a86d3f6e162209d64736f6c634300060c0033"; +const isSuperArgs$m = (xs) => xs.length > 1; +class ProposalStateChangeGovernance__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$m(args)) { + super(...args); + } else { + super(_abi$u, _bytecode$m, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$m; + static abi = _abi$u; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$u); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$u, + runner + ); + } +} + +var index$g = /*#__PURE__*/Object.freeze({ + __proto__: null, + IGovernance__factory: IGovernance__factory, + ProposalStateChangeGovernance__factory: ProposalStateChangeGovernance__factory +}); + +const _abi$t = [ + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + } + ], + name: "upgradeTo", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class IProxy__factory { + static abi = _abi$t; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$t); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$t, runner); + } +} + +const _abi$s = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + } + ], + name: "Delegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "x", + type: "uint256" + } + ], + name: "Overriden", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "proposer", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + indexed: false, + internalType: "string", + name: "description", + type: "string" + } + ], + name: "ProposalCreated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "ProposalExecuted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + } + ], + name: "Undelegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "voter", + type: "address" + }, + { + indexed: true, + internalType: "bool", + name: "support", + type: "bool" + }, + { + indexed: false, + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + name: "Voted", + type: "event" + }, + { + inputs: [], + name: "CLOSING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_EXPIRATION", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PROPOSAL_THRESHOLD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "QUORUM_VOTES", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTE_EXTEND_TIME", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "canWithdrawAfter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "from", + type: "address[]" + }, + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castDelegatedVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + } + ], + name: "delegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "delegatedTo", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "execute", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "voter", + type: "address" + } + ], + name: "getReceipt", + outputs: [ + { + components: [ + { + internalType: "bool", + name: "hasVoted", + type: "bool" + }, + { + internalType: "bool", + name: "support", + type: "bool" + }, + { + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + internalType: "struct Governance.Receipt", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "latestProposalIds", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "lock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "lockWithApproval", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "lockedBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "newVariable", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "proposalCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "proposals", + outputs: [ + { + internalType: "address", + name: "proposer", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "forVotes", + type: "uint256" + }, + { + internalType: "uint256", + name: "againstVotes", + type: "uint256" + }, + { + internalType: "bool", + name: "executed", + type: "bool" + }, + { + internalType: "bool", + name: "extended", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "propose", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "proposeByDelegate", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "closingPeriod", + type: "uint256" + } + ], + name: "setClosingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionDelay", + type: "uint256" + } + ], + name: "setExecutionDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionExpiration", + type: "uint256" + } + ], + name: "setExecutionExpiration", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalThreshold", + type: "uint256" + } + ], + name: "setProposalThreshold", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "quorumVotes", + type: "uint256" + } + ], + name: "setQuorumVotes", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "time_", + type: "uint256" + } + ], + name: "setTimestamp", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "torna", + type: "address" + } + ], + name: "setTorn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "voteExtendTime", + type: "uint256" + } + ], + name: "setVoteExtendTime", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingDelay", + type: "uint256" + } + ], + name: "setVotingDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingPeriod", + type: "uint256" + } + ], + name: "setVotingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "state", + outputs: [ + { + internalType: "enum Governance.ProposalState", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "time", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract TORN", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "undelegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "unlock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$l = "0x6080604052426041553480156200001557600080fd5b50600054610100900460ff168062000032575062000032620000cd565b8062000041575060005460ff16155b620000695760405162461bcd60e51b8152600401620000609062000114565b60405180910390fd5b600054610100900460ff1615801562000095576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000b3620000d3565b8015620000c6576000805461ff00191690555b5062000162565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6123ac80620001726000396000f3fe60806040526004361061023b5760003560e01c8063a0a2b5731161012e578063ce25d71c116100ab578063e4917d9f1161006f578063e4917d9f14610664578063ea0217cf14610684578063ece40cc1146106a4578063f0b76892146106c4578063fe0d94c1146106e45761023b565b8063ce25d71c146105d8578063d6159fe5146105ed578063d6f0948c14610602578063da35c66414610622578063e23a9a52146106375761023b565b8063b54426c8116100f2578063b54426c814610538578063b5f6a74314610558578063b859f11b14610578578063c0c0e82014610598578063c4d66de8146105b85761023b565b8063a0a2b573146104b9578063a6c26603146104d9578063a72edda3146104ee578063adf898a41461050e578063b1610d7e146105235761023b565b80636198e339116101bc57806370b0f6601161018057806370b0f6601461042f5780638d7a72f31461044f57806392ab89bb146104645780639a9e3b6e146104795780639ae697bf146104995761023b565b80636198e3391461039857806365da1264146103b8578063671dd275146103e55780636a661755146103fa5780636dc2dc6c1461040f5761023b565b806337f135d71161020357806337f135d7146103015780633e4f49e614610316578063587a6ecb1461034357806358e9fff0146103585780635c19a95c146103785761023b565b8063013cf08b1461024057806302ec8f9e1461027d57806315373e3d1461029f57806316ada547146102bf57806317977c61146102e1575b600080fd5b34801561024c57600080fd5b5061026061025b366004611cd6565b6106f7565b604051610274989796959493929190611de5565b60405180910390f35b34801561028957600080fd5b5061029d610298366004611cd6565b61075c565b005b3480156102ab57600080fd5b5061029d6102ba366004611d1a565b610789565b3480156102cb57600080fd5b506102d4610798565b6040516102749190612323565b3480156102ed57600080fd5b506102d46102fc366004611acd565b61079e565b34801561030d57600080fd5b506102d46107b0565b34801561032257600080fd5b50610336610331366004611cd6565b6107b6565b6040516102749190611ea3565b34801561034f57600080fd5b506102d46108f9565b34801561036457600080fd5b506102d4610373366004611ae8565b6108ff565b34801561038457600080fd5b5061029d610393366004611acd565b61094d565b3480156103a457600080fd5b5061029d6103b3366004611cd6565b610a6f565b3480156103c457600080fd5b506103d86103d3366004611acd565b610ba6565b6040516102749190611d94565b3480156103f157600080fd5b506102d4610bc1565b34801561040657600080fd5b506102d4610bc7565b34801561041b57600080fd5b5061029d61042a366004611cd6565b610bcd565b34801561043b57600080fd5b5061029d61044a366004611cd6565b610c12565b34801561045b57600080fd5b506102d4610c36565b34801561047057600080fd5b5061029d610c3c565b34801561048557600080fd5b5061029d610494366004611cd6565b610cc3565b3480156104a557600080fd5b506102d46104b4366004611acd565b610ce7565b3480156104c557600080fd5b5061029d6104d4366004611cd6565b610cf9565b3480156104e557600080fd5b506102d4610cfe565b3480156104fa57600080fd5b506102d4610509366004611acd565b610d04565b34801561051a57600080fd5b506103d8610d16565b34801561052f57600080fd5b506102d4610d25565b34801561054457600080fd5b5061029d610553366004611cd6565b610d2b565b34801561056457600080fd5b5061029d610573366004611acd565b610d35565b34801561058457600080fd5b5061029d610593366004611bf5565b610d57565b3480156105a457600080fd5b5061029d6105b3366004611cd6565b610e0e565b3480156105c457600080fd5b5061029d6105d3366004611acd565b610e32565b3480156105e457600080fd5b506102d4611075565b3480156105f957600080fd5b506102d461107b565b34801561060e57600080fd5b506102d461061d366004611b48565b611081565b34801561062e57600080fd5b506102d4611097565b34801561064357600080fd5b50610657610652366004611cee565b6110a1565b60405161027491906122fe565b34801561067057600080fd5b5061029d61067f366004611cd6565b611113565b34801561069057600080fd5b5061029d61069f366004611cd6565b611137565b3480156106b057600080fd5b5061029d6106bf366004611cd6565b61115b565b3480156106d057600080fd5b5061029d6106df366004611b96565b61117f565b61029d6106f2366004611cd6565b6111ff565b603d818154811061070457fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b3330146107845760405162461bcd60e51b815260040161077b90612101565b60405180910390fd5b603555565b610794338383611240565b5050565b60415481565b603e6020526000908152604090205481565b60335481565b60006107c0611097565b82111580156107cf5750600082115b6107eb5760405162461bcd60e51b815260040161077b90612237565b6000603d83815481106107fa57fe5b906000526020600020906008020190508060020154610817611471565b116108265760009150506108f4565b8060030154610833611471565b116108425760019150506108f4565b8060050154816004015411158061086457506035548160050154826004015401105b156108735760029150506108f4565b600681015460ff161561088a5760059150506108f4565b6108af6034546108a9603354846003015461147790919063ffffffff16565b90611477565b6108b7611471565b106108c65760069150506108f4565b60335460038201546108d791611477565b6108df611471565b106108ee5760049150506108f4565b60039150505b919050565b603a5481565b6001600160a01b038381166000908152603c6020526040812054909116331461093a5760405162461bcd60e51b815260040161077b906122c7565b61094584848461149c565b949350505050565b336000818152603c60205260409020546001600160a01b03908116919083161480159061098357506001600160a01b0382163014155b801561099757506001600160a01b03821615155b80156109b55750806001600160a01b0316826001600160a01b031614155b6109d15760405162461bcd60e51b815260040161077b90612138565b6001600160a01b03811615610a17576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000908152603f6020526040902054610a87611471565b11610aa45760405162461bcd60e51b815260040161077b90612064565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054610af29183906117ea565b336000818152603b602052604090819020929092558154915163a9059cbb60e01b81526001600160a01b039092169163a9059cbb91610b35918590600401611da8565b602060405180830381600087803b158015610b4f57600080fd5b505af1158015610b63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b879190611cba565b610ba35760405162461bcd60e51b815260040161077b9061209b565b50565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610bec5760405162461bcd60e51b815260040161077b90612101565b6033548110610c0d5760405162461bcd60e51b815260040161077b90612020565b603a55565b333014610c315760405162461bcd60e51b815260040161077b90612101565b603755565b60425481565b336000908152603c60205260409020546001600160a01b031680610c725760405162461bcd60e51b815260040161077b9061227d565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b333014610ce25760405162461bcd60e51b815260040161077b90612101565b603455565b603b6020526000908152604090205481565b604155565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b610ba33382611816565b604080546001600160a01b0319166001600160a01b0392909216919091179055565b60005b8351811015610de857336001600160a01b0316603c6000868481518110610d7d57fe5b6020908102919091018101516001600160a01b03908116835290820192909252604001600020541614610dc25760405162461bcd60e51b815260040161077b906122c7565b610de0848281518110610dd157fe5b60200260200101518484611240565b600101610d5a565b50336000908152603b602052604090205415610e0957610e09338383611240565b505050565b333014610e2d5760405162461bcd60e51b815260040161077b90612101565b603955565b600054610100900460ff1680610e4b5750610e4b6118fb565b80610e59575060005460ff16155b610e755760405162461bcd60e51b815260040161077b906121e9565b600054610100900460ff16158015610ea0576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff199094169390931716919091179055611060611901565b8015610794576000805461ff00191690555050565b60395481565b60375481565b600061108e33848461149c565b90505b92915050565b603d546000190190565b6110a96119c7565b603d83815481106110b657fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b3330146111325760405162461bcd60e51b815260040161077b90612101565b603355565b3330146111565760405162461bcd60e51b815260040161077b90612101565b603855565b33301461117a5760405162461bcd60e51b815260040161077b90612101565b603655565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf906111bb90899030908a908a908a908a908a90600401611e2b565b600060405180830381600087803b1580156111d557600080fd5b505af11580156111e9573d6000803e3d6000fd5b505050506111f78686611816565b505050505050565b6103e76042556040517fc22c84ebcf25b30190d2b53474def7b552efd2018ef8acaf6bed1b67e8d2be7c90611235908390612323565b60405180910390a150565b600161124b836107b6565b600681111561125657fe5b146112735760405162461bcd60e51b815260040161077b90611f45565b6000603d838154811061128257fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b9094529190942054929450101590806112e15760405162461bcd60e51b815260040161077b9061216f565b825460ff1615611330578254610100900460ff1615611317576001830154600485015461130d91611942565b6004850155611330565b6001830154600585015461132a91611942565b60058501555b841561134f5760048401546113459082611477565b6004850155611364565b600584015461135e9082611477565b60058501555b6006840154610100900460ff161580156113945750603954611392611387611471565b600387015490611942565b105b156113d85760058401546004850154111582151581146113d65760068501805461ff001916610100179055603a5460038601546113d091611477565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a546003870154611423938b9361141e9391926108a992839190611477565b611984565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b5846040516114609190612323565b60405180910390a450505050505050565b60415490565b60008282018381101561108e5760405162461bcd60e51b815260040161077b90611fe9565b6001600160a01b0383166000908152603b60205260408120546036548110156114d75760405162461bcd60e51b815260040161077b90611f8c565b6114e0846119c1565b6114fc5760405162461bcd60e51b815260040161077b906121a6565b6001600160a01b0385166000908152603e6020526040902054801561156e576000611526826107b6565b9050600181600681111561153657fe5b141580156115505750600081600681111561154d57fe5b14155b61156c5760405162461bcd60e51b815260040161077b90611eca565b505b600061157e6037546108a9611471565b905060006115976038548361147790919063ffffffff16565b90506115a16119e7565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff19909316929092179490941617905590611753611097565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a54929350611795928d9261141e9290916108a9919082908a90611477565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d6040516117d59493929190611e6c565b60405180910390a39998505050505050505050565b6000818484111561180e5760405162461bcd60e51b815260040161077b9190611eb7565b505050900390565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd9061184a90859030908690600401611dc1565b602060405180830381600087803b15801561186457600080fd5b505af1158015611878573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061189c9190611cba565b6118b85760405162461bcd60e51b815260040161077b906120ca565b6001600160a01b0382166000908152603b60205260409020546118db9082611477565b6001600160a01b039092166000908152603b602052604090209190915550565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b600061108e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506117ea565b6001600160a01b0382166000908152603f6020526040902054811115610794576001600160a01b03919091166000908152603f6020526040902055565b3b151590565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b038116811461109157600080fd5b803561109181612368565b600082601f830112611a74578081fd5b813567ffffffffffffffff811115611a8a578182fd5b611a9d601f8201601f191660200161232c565b9150808252836020828501011115611ab457600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215611ade578081fd5b61108e8383611a42565b600080600060608486031215611afc578182fd5b8335611b0781612353565b92506020840135611b1781612353565b9150604084013567ffffffffffffffff811115611b32578182fd5b611b3e86828701611a64565b9150509250925092565b60008060408385031215611b5a578182fd5b8235611b6581612353565b9150602083013567ffffffffffffffff811115611b80578182fd5b611b8c85828601611a64565b9150509250929050565b60008060008060008060c08789031215611bae578182fd5b611bb88888611a42565b95506020870135945060408701359350606087013560ff81168114611bdb578283fd5b9598949750929560808101359460a0909101359350915050565b600080600060608486031215611c09578283fd5b833567ffffffffffffffff80821115611c20578485fd5b818601915086601f830112611c33578485fd5b813581811115611c41578586fd5b60209150818102611c5383820161232c565b8281528381019085850183870186018c1015611c6d57898afd5b8996505b84871015611c9757611c838c82611a42565b835260019690960195918501918501611c71565b5097505050508501359250611cb190508560408601611a59565b90509250925092565b600060208284031215611ccb578081fd5b815161108e81612368565b600060208284031215611ce7578081fd5b5035919050565b60008060408385031215611d00578182fd5b82359150611d118460208501611a42565b90509250929050565b60008060408385031215611d2c578182fd5b823591506020830135611d3e81612368565b809150509250929050565b60008151808452815b81811015611d6e57602081850181015186830182015201611d52565b81811115611d7f5782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b038616825284602083015283604083015260806060830152611e996080830184611d49565b9695505050505050565b6020810160078310611eb157fe5b91905290565b60006020825261108e6020830184611d49565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b6020808252601590820152741513d4938e881d1c985b9cd9995c8819985a5b1959605a1b604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b90815260200190565b60405181810167ffffffffffffffff8111828210171561234b57600080fd5b604052919050565b6001600160a01b0381168114610ba357600080fd5b8015158114610ba357600080fdfea264697066735822122077147b2d24ffd383c4a2d0eb254eb72ba4274421278e284354c4848ff7c9df0164736f6c634300060c0033"; +const isSuperArgs$l = (xs) => xs.length > 1; +class NewImplementation__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$l(args)) { + super(...args); + } else { + super(_abi$s, _bytecode$l, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$l; + static abi = _abi$s; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$s); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$s, runner); + } +} + +const _abi$r = [ + { + inputs: [ + { + internalType: "address", + name: "_newLogic", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "executeProposal", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "newLogic", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$k = "0x60a060405234801561001057600080fd5b506040516101da3803806101da83398101604081905261002f91610044565b60601b6001600160601b031916608052610072565b600060208284031215610055578081fd5b81516001600160a01b038116811461006b578182fd5b9392505050565b60805160601c610148610092600039806065528060a252506101486000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806305ccb23e1461003b578063373058b814610059575b600080fd5b610043610063565b60405161005091906100fe565b60405180910390f35b610061610087565b005b7f000000000000000000000000000000000000000000000000000000000000000081565b604051631b2ce7f360e11b81523090633659cfe6906100ca907f0000000000000000000000000000000000000000000000000000000000000000906004016100fe565b600060405180830381600087803b1580156100e457600080fd5b505af11580156100f8573d6000803e3d6000fd5b50505050565b6001600160a01b039190911681526020019056fea26469706673582212207d2c2c988cd8f64fa7efb7ef33cfeee3b01f81a501e4a71ae8a63d6a5e269eb664736f6c634300060c0033"; +const isSuperArgs$k = (xs) => xs.length > 1; +class ProposalUpgrade__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$k(args)) { + super(...args); + } else { + super(_abi$r, _bytecode$k, args[0]); + } + } + getDeployTransaction(_newLogic, overrides) { + return super.getDeployTransaction(_newLogic, overrides || {}); + } + deploy(_newLogic, overrides) { + return super.deploy(_newLogic, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$k; + static abi = _abi$r; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$r); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$r, runner); + } +} + +var index$f = /*#__PURE__*/Object.freeze({ + __proto__: null, + IProxy__factory: IProxy__factory, + NewImplementation__factory: NewImplementation__factory, + ProposalUpgrade__factory: ProposalUpgrade__factory +}); + +const _abi$q = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + } + ], + name: "Delegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "proposer", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + indexed: false, + internalType: "string", + name: "description", + type: "string" + } + ], + name: "ProposalCreated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "ProposalExecuted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + } + ], + name: "Undelegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "voter", + type: "address" + }, + { + indexed: true, + internalType: "bool", + name: "support", + type: "bool" + }, + { + indexed: false, + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + name: "Voted", + type: "event" + }, + { + inputs: [], + name: "CLOSING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_EXPIRATION", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PROPOSAL_THRESHOLD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "QUORUM_VOTES", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTE_EXTEND_TIME", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "canWithdrawAfter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "from", + type: "address[]" + }, + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castDelegatedVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + } + ], + name: "delegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "delegatedTo", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "execute", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "voter", + type: "address" + } + ], + name: "getReceipt", + outputs: [ + { + components: [ + { + internalType: "bool", + name: "hasVoted", + type: "bool" + }, + { + internalType: "bool", + name: "support", + type: "bool" + }, + { + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + internalType: "struct Governance.Receipt", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "latestProposalIds", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "lock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "lockWithApproval", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "lockedBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "proposalCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "proposals", + outputs: [ + { + internalType: "address", + name: "proposer", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "forVotes", + type: "uint256" + }, + { + internalType: "uint256", + name: "againstVotes", + type: "uint256" + }, + { + internalType: "bool", + name: "executed", + type: "bool" + }, + { + internalType: "bool", + name: "extended", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "propose", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "proposeByDelegate", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "closingPeriod", + type: "uint256" + } + ], + name: "setClosingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionDelay", + type: "uint256" + } + ], + name: "setExecutionDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionExpiration", + type: "uint256" + } + ], + name: "setExecutionExpiration", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalThreshold", + type: "uint256" + } + ], + name: "setProposalThreshold", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "quorumVotes", + type: "uint256" + } + ], + name: "setQuorumVotes", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "time_", + type: "uint256" + } + ], + name: "setTimestamp", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "torna", + type: "address" + } + ], + name: "setTorn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "voteExtendTime", + type: "uint256" + } + ], + name: "setVoteExtendTime", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingDelay", + type: "uint256" + } + ], + name: "setVotingDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingPeriod", + type: "uint256" + } + ], + name: "setVotingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "state", + outputs: [ + { + internalType: "enum Governance.ProposalState", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "time", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract TORN", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "undelegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "unlock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$j = "0x6080604052426041553480156200001557600080fd5b50600054610100900460ff168062000032575062000032620000cd565b8062000041575060005460ff16155b620000695760405162461bcd60e51b8152600401620000609062000114565b60405180910390fd5b600054610100900460ff1615801562000095576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000b3620000d3565b8015620000c6576000805461ff00191690555b5062000162565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6125c980620001726000396000f3fe6080604052600436106102305760003560e01c8063a0a2b5731161012e578063ce25d71c116100ab578063e4917d9f1161006f578063e4917d9f14610644578063ea0217cf14610664578063ece40cc114610684578063f0b76892146106a4578063fe0d94c1146106c457610230565b8063ce25d71c146105b8578063d6159fe5146105cd578063d6f0948c146105e2578063da35c66414610602578063e23a9a521461061757610230565b8063b54426c8116100f2578063b54426c814610518578063b5f6a74314610538578063b859f11b14610558578063c0c0e82014610578578063c4d66de81461059857610230565b8063a0a2b57314610499578063a6c26603146104b9578063a72edda3146104ce578063adf898a4146104ee578063b1610d7e1461050357610230565b80635c19a95c116101bc5780636dc2dc6c116101805780636dc2dc6c1461040457806370b0f6601461042457806392ab89bb146104445780639a9e3b6e146104595780639ae697bf1461047957610230565b80635c19a95c1461036d5780636198e3391461038d57806365da1264146103ad578063671dd275146103da5780636a661755146103ef57610230565b806317977c611161020357806317977c61146102d657806337f135d7146102f65780633e4f49e61461030b578063587a6ecb1461033857806358e9fff01461034d57610230565b8063013cf08b1461023557806302ec8f9e1461027257806315373e3d1461029457806316ada547146102b4575b600080fd5b34801561024157600080fd5b50610255610250366004611e01565b6106d7565b604051610269989796959493929190611f0d565b60405180910390f35b34801561027e57600080fd5b5061029261028d366004611e01565b61073c565b005b3480156102a057600080fd5b506102926102af366004611e45565b610769565b3480156102c057600080fd5b506102c9610778565b6040516102699190612510565b3480156102e257600080fd5b506102c96102f1366004611bf8565b61077e565b34801561030257600080fd5b506102c9610790565b34801561031757600080fd5b5061032b610326366004611e01565b610796565b6040516102699190611fcb565b34801561034457600080fd5b506102c96108d9565b34801561035957600080fd5b506102c9610368366004611c13565b6108df565b34801561037957600080fd5b50610292610388366004611bf8565b61092d565b34801561039957600080fd5b506102926103a8366004611e01565b610a4f565b3480156103b957600080fd5b506103cd6103c8366004611bf8565b610b86565b6040516102699190611ebc565b3480156103e657600080fd5b506102c9610ba1565b3480156103fb57600080fd5b506102c9610ba7565b34801561041057600080fd5b5061029261041f366004611e01565b610bad565b34801561043057600080fd5b5061029261043f366004611e01565b610bf2565b34801561045057600080fd5b50610292610c16565b34801561046557600080fd5b50610292610474366004611e01565b610c9d565b34801561048557600080fd5b506102c9610494366004611bf8565b610cc1565b3480156104a557600080fd5b506102926104b4366004611e01565b610cd3565b3480156104c557600080fd5b506102c9610cd8565b3480156104da57600080fd5b506102c96104e9366004611bf8565b610cde565b3480156104fa57600080fd5b506103cd610cf0565b34801561050f57600080fd5b506102c9610cff565b34801561052457600080fd5b50610292610533366004611e01565b610d05565b34801561054457600080fd5b50610292610553366004611bf8565b610d0f565b34801561056457600080fd5b50610292610573366004611d20565b610d31565b34801561058457600080fd5b50610292610593366004611e01565b610de8565b3480156105a457600080fd5b506102926105b3366004611bf8565b610e0c565b3480156105c457600080fd5b506102c961104f565b3480156105d957600080fd5b506102c9611055565b3480156105ee57600080fd5b506102c96105fd366004611c73565b61105b565b34801561060e57600080fd5b506102c9611071565b34801561062357600080fd5b50610637610632366004611e19565b61107b565b60405161026991906124eb565b34801561065057600080fd5b5061029261065f366004611e01565b6110ed565b34801561067057600080fd5b5061029261067f366004611e01565b611111565b34801561069057600080fd5b5061029261069f366004611e01565b611135565b3480156106b057600080fd5b506102926106bf366004611cc1565b611159565b6102926106d2366004611e01565b6111d9565b603d81815481106106e457fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b3330146107645760405162461bcd60e51b815260040161075b906122b7565b60405180910390fd5b603555565b61077433838361136b565b5050565b60415481565b603e6020526000908152604090205481565b60335481565b60006107a0611071565b82111580156107af5750600082115b6107cb5760405162461bcd60e51b815260040161075b906123ed565b6000603d83815481106107da57fe5b9060005260206000209060080201905080600201546107f761159c565b116108065760009150506108d4565b806003015461081361159c565b116108225760019150506108d4565b8060050154816004015411158061084457506035548160050154826004015401105b156108535760029150506108d4565b600681015460ff161561086a5760059150506108d4565b61088f60345461088960335484600301546115a290919063ffffffff16565b906115a2565b61089761159c565b106108a65760069150506108d4565b60335460038201546108b7916115a2565b6108bf61159c565b106108ce5760049150506108d4565b60039150505b919050565b603a5481565b6001600160a01b038381166000908152603c6020526040812054909116331461091a5760405162461bcd60e51b815260040161075b9061247d565b6109258484846115c7565b949350505050565b336000818152603c60205260409020546001600160a01b03908116919083161480159061096357506001600160a01b0382163014155b801561097757506001600160a01b03821615155b80156109955750806001600160a01b0316826001600160a01b031614155b6109b15760405162461bcd60e51b815260040161075b906122ee565b6001600160a01b038116156109f7576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000908152603f6020526040902054610a6761159c565b11610a845760405162461bcd60e51b815260040161075b9061221a565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054610ad2918390611915565b336000818152603b602052604090819020929092558154915163a9059cbb60e01b81526001600160a01b039092169163a9059cbb91610b15918590600401611ed0565b602060405180830381600087803b158015610b2f57600080fd5b505af1158015610b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b679190611de5565b610b835760405162461bcd60e51b815260040161075b90612251565b50565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610bcc5760405162461bcd60e51b815260040161075b906122b7565b6033548110610bed5760405162461bcd60e51b815260040161075b906121d6565b603a55565b333014610c115760405162461bcd60e51b815260040161075b906122b7565b603755565b336000908152603c60205260409020546001600160a01b031680610c4c5760405162461bcd60e51b815260040161075b90612433565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b333014610cbc5760405162461bcd60e51b815260040161075b906122b7565b603455565b603b6020526000908152604090205481565b604155565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b610b833382611941565b604080546001600160a01b0319166001600160a01b0392909216919091179055565b60005b8351811015610dc257336001600160a01b0316603c6000868481518110610d5757fe5b6020908102919091018101516001600160a01b03908116835290820192909252604001600020541614610d9c5760405162461bcd60e51b815260040161075b9061247d565b610dba848281518110610dab57fe5b6020026020010151848461136b565b600101610d34565b50336000908152603b602052604090205415610de357610de333838361136b565b505050565b333014610e075760405162461bcd60e51b815260040161075b906122b7565b603955565b600054610100900460ff1680610e255750610e25611a26565b80610e33575060005460ff16155b610e4f5760405162461bcd60e51b815260040161075b9061239f565b600054610100900460ff16158015610e7a576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff19909416939093171691909117905561103a611a2c565b8015610774576000805461ff00191690555050565b60395481565b60375481565b60006110683384846115c7565b90505b92915050565b603d546000190190565b611083611af2565b603d838154811061109057fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b33301461110c5760405162461bcd60e51b815260040161075b906122b7565b603355565b3330146111305760405162461bcd60e51b815260040161075b906122b7565b603855565b3330146111545760405162461bcd60e51b815260040161075b906122b7565b603655565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf9061119590899030908a908a908a908a908a90600401611f53565b600060405180830381600087803b1580156111af57600080fd5b505af11580156111c3573d6000803e3d6000fd5b505050506111d18686611941565b505050505050565b60046111e482610796565b60068111156111ef57fe5b1461120c5760405162461bcd60e51b815260040161075b90612035565b6000603d828154811061121b57fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b031661125681611a6d565b6112725760405162461bcd60e51b815260040161075b90611ff2565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b038516916112b691611ea0565b600060405180830381855af49150503d80600081146112f1576040519150601f19603f3d011682016040523d82523d6000602084013e6112f6565b606091505b50915091508161133957805115611321578060405162461bcd60e51b815260040161075b9190611fdf565b60405162461bcd60e51b815260040161075b906124b4565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b600161137683610796565b600681111561138157fe5b1461139e5760405162461bcd60e51b815260040161075b906120fb565b6000603d83815481106113ad57fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b90945291909420549294501015908061140c5760405162461bcd60e51b815260040161075b90612325565b825460ff161561145b578254610100900460ff1615611442576001830154600485015461143891611a73565b600485015561145b565b6001830154600585015461145591611a73565b60058501555b841561147a57600484015461147090826115a2565b600485015561148f565b600584015461148990826115a2565b60058501555b6006840154610100900460ff161580156114bf57506039546114bd6114b261159c565b600387015490611a73565b105b156115035760058401546004850154111582151581146115015760068501805461ff001916610100179055603a5460038601546114fb916115a2565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a54600387015461154e938b93611549939192610889928391906115a2565b611ab5565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b58460405161158b9190612510565b60405180910390a450505050505050565b60415490565b6000828201838110156110685760405162461bcd60e51b815260040161075b9061219f565b6001600160a01b0383166000908152603b60205260408120546036548110156116025760405162461bcd60e51b815260040161075b90612142565b61160b84611a6d565b6116275760405162461bcd60e51b815260040161075b9061235c565b6001600160a01b0385166000908152603e6020526040902054801561169957600061165182610796565b9050600181600681111561166157fe5b1415801561167b5750600081600681111561167857fe5b14155b6116975760405162461bcd60e51b815260040161075b90612080565b505b60006116a960375461088961159c565b905060006116c2603854836115a290919063ffffffff16565b90506116cc611b12565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff1990931692909217949094161790559061187e611071565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a549293506118c0928d92611549929091610889919082908a906115a2565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d6040516119009493929190611f94565b60405180910390a39998505050505050505050565b600081848411156119395760405162461bcd60e51b815260040161075b9190611fdf565b505050900390565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd9061197590859030908690600401611ee9565b602060405180830381600087803b15801561198f57600080fd5b505af11580156119a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c79190611de5565b6119e35760405162461bcd60e51b815260040161075b90612280565b6001600160a01b0382166000908152603b6020526040902054611a0690826115a2565b6001600160a01b039092166000908152603b602052604090209190915550565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b3b151590565b600061106883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611915565b6001600160a01b0382166000908152603f6020526040902054811115610774576001600160a01b03919091166000908152603f6020526040902055565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b038116811461106b57600080fd5b803561106b81612585565b600082601f830112611b9f578081fd5b813567ffffffffffffffff811115611bb5578182fd5b611bc8601f8201601f1916602001612519565b9150808252836020828501011115611bdf57600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215611c09578081fd5b6110688383611b6d565b600080600060608486031215611c27578182fd5b8335611c3281612570565b92506020840135611c4281612570565b9150604084013567ffffffffffffffff811115611c5d578182fd5b611c6986828701611b8f565b9150509250925092565b60008060408385031215611c85578182fd5b8235611c9081612570565b9150602083013567ffffffffffffffff811115611cab578182fd5b611cb785828601611b8f565b9150509250929050565b60008060008060008060c08789031215611cd9578182fd5b611ce38888611b6d565b95506020870135945060408701359350606087013560ff81168114611d06578283fd5b9598949750929560808101359460a0909101359350915050565b600080600060608486031215611d34578283fd5b833567ffffffffffffffff80821115611d4b578485fd5b818601915086601f830112611d5e578485fd5b813581811115611d6c578586fd5b60209150818102611d7e838201612519565b8281528381019085850183870186018c1015611d9857898afd5b8996505b84871015611dc257611dae8c82611b6d565b835260019690960195918501918501611d9c565b5097505050508501359250611ddc90508560408601611b84565b90509250925092565b600060208284031215611df6578081fd5b815161106881612585565b600060208284031215611e12578081fd5b5035919050565b60008060408385031215611e2b578182fd5b82359150611e3c8460208501611b6d565b90509250929050565b60008060408385031215611e57578182fd5b823591506020830135611e6981612585565b809150509250929050565b60008151808452611e8c816020860160208601612540565b601f01601f19169290920160200192915050565b60008251611eb2818460208701612540565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b038616825284602083015283604083015260806060830152611fc16080830184611e74565b9695505050505050565b6020810160078310611fd957fe5b91905290565b6000602082526110686020830184611e74565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b6020808252601590820152741513d4938e881d1c985b9cd9995c8819985a5b1959605a1b604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b90815260200190565b60405181810167ffffffffffffffff8111828210171561253857600080fd5b604052919050565b60005b8381101561255b578181015183820152602001612543565b8381111561256a576000848401525b50505050565b6001600160a01b0381168114610b8357600080fd5b8015158114610b8357600080fdfea264697066735822122079a24ea0dc3d5ef34041a37a137cef69305763e031faa841e2db8f078345f2af64736f6c634300060c0033"; +const isSuperArgs$j = (xs) => xs.length > 1; +class MockGovernance__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$j(args)) { + super(...args); + } else { + super(_abi$q, _bytecode$j, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$j; + static abi = _abi$q; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$q); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$q, runner); + } +} + +const _abi$p = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "output", + type: "address" + } + ], + name: "Debug", + type: "event" + }, + { + inputs: [], + name: "executeProposal", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$i = "0x608060405234801561001057600080fd5b506103d5806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063373058b814610030575b600080fd5b61003861003a565b005b6000604051610048906100fa565b604051809103906000f080158015610064573d6000803e3d6000fd5b509050806001600160a01b0316638129fc1c6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156100a257600080fd5b505af11580156100b6573d6000803e3d6000fd5b5050604080516001600160a01b038516815290517f330da4cde831ccab151372275307c2f0cce2bcce846635cd66e6908f10d203639350908190036020019150a150565b610298806101088339019056fe608060405234801561001057600080fd5b50610278806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631f1bd692146100465780633fa4f245146100c35780638129fc1c146100dd575b600080fd5b61004e6100e7565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610088578181015183820152602001610070565b50505050905090810190601f1680156100b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100cb610174565b60408051918252519081900360200190f35b6100e561017a565b005b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561016c5780601f106101415761010080835404028352916020019161016c565b820191906000526020600020905b81548152906001019060200180831161014f57829003601f168201915b505050505081565b60005481565b600160008190556040805180820190915260058082526464756d6d7960d81b60209092019182526101ac9291906101af565b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106101f057805160ff191683800117855561021d565b8280016001018555821561021d579182015b8281111561021d578251825591602001919060010190610202565b5061022992915061022d565b5090565b5b80821115610229576000815560010161022e56fea26469706673582212204b4d54284aeff9c7c570415da4a9efb9bf7115fe94a322210f9981c1c7ae107a64736f6c634300060c0033a26469706673582212205967b156db23a5fd2372953049f5c366f68a9f95cfa116f9fbd6d0c8e7bdaa6364736f6c634300060c0033"; +const isSuperArgs$i = (xs) => xs.length > 1; +class Proposal__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$i(args)) { + super(...args); + } else { + super(_abi$p, _bytecode$i, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$i; + static abi = _abi$p; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$p); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$p, runner); + } +} + +var index$e = /*#__PURE__*/Object.freeze({ + __proto__: null, + MockGovernance__factory: MockGovernance__factory, + Proposal__factory: Proposal__factory, + dummySol: index$h, + proposalStateChangeGovernanceSol: index$g, + proposalUpgradeSol: index$f +}); + +const _abi$o = [ + { + inputs: [], + name: "CLOSING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_EXPIRATION", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PROPOSAL_THRESHOLD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "QUORUM_VOTES", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTE_EXTEND_TIME", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "closingPeriod", + type: "uint256" + } + ], + name: "setClosingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionDelay", + type: "uint256" + } + ], + name: "setExecutionDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionExpiration", + type: "uint256" + } + ], + name: "setExecutionExpiration", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalThreshold", + type: "uint256" + } + ], + name: "setProposalThreshold", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "quorumVotes", + type: "uint256" + } + ], + name: "setQuorumVotes", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "voteExtendTime", + type: "uint256" + } + ], + name: "setVoteExtendTime", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingDelay", + type: "uint256" + } + ], + name: "setVotingDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingPeriod", + type: "uint256" + } + ], + name: "setVotingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$h = "0x608060405234801561001057600080fd5b50610563806100206000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c8063a6c2660311610097578063d6159fe511610066578063d6159fe5146101e2578063e4917d9f146101ea578063ea0217cf14610207578063ece40cc11461022457610100565b8063a6c26603146101ad578063b1610d7e146101b5578063c0c0e820146101bd578063ce25d71c146101da57610100565b80636a661755116100d35780636a6617551461014e5780636dc2dc6c1461015657806370b0f660146101735780639a9e3b6e1461019057610100565b806302ec8f9e1461010557806337f135d714610124578063587a6ecb1461013e578063671dd27514610146575b600080fd5b6101226004803603602081101561011b57600080fd5b5035610241565b005b61012c610288565b60408051918252519081900360200190f35b61012c61028e565b61012c610294565b61012c61029a565b6101226004803603602081101561016c57600080fd5b50356102a0565b6101226004803603602081101561018957600080fd5b5035610327565b610122600480360360208110156101a657600080fd5b503561036e565b61012c6103b5565b61012c6103bb565b610122600480360360208110156101d357600080fd5b50356103c1565b61012c610408565b61012c61040e565b6101226004803603602081101561020057600080fd5b5035610414565b6101226004803603602081101561021d57600080fd5b503561045b565b6101226004803603602081101561023a57600080fd5b50356104a2565b333014610283576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b600255565b60005481565b60075481565b60025481565b60015481565b3330146102e2576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b60005481106103225760405162461bcd60e51b81526004018080602001828103825260248152602001806104ea6024913960400191505060405180910390fd5b600755565b333014610369576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b600455565b3330146103b0576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b600155565b60035481565b60055481565b333014610403576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b600655565b60065481565b60045481565b333014610456576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b600055565b33301461049d576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b600555565b3330146104e4576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b60035556fe476f7665726e616e63653a20696e636f727265637420766f7465457874656e6454696d65476f7665726e616e63653a20756e617574686f72697a65640000000000000000a26469706673582212208fff4d62d622acc801ece8b6a7cc281f67f5959bf09e0ca68afde2a0ab0bc83164736f6c634300060c0033"; +const isSuperArgs$h = (xs) => xs.length > 1; +class Configuration__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$h(args)) { + super(...args); + } else { + super(_abi$o, _bytecode$h, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$h; + static abi = _abi$o; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$o); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$o, runner); + } +} + +const _abi$n = [ + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "lockedBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + } +]; +class Core__factory { + static abi = _abi$n; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$n); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$n, runner); + } +} + +const _abi$m = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + } + ], + name: "Delegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + } + ], + name: "Undelegated", + type: "event" + }, + { + inputs: [ + { + internalType: "address[]", + name: "from", + type: "address[]" + }, + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castDelegatedVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + } + ], + name: "delegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "delegatedTo", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "lockedBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "proposeByDelegate", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "undelegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class Delegation__factory { + static abi = _abi$m; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$m); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$m, runner); + } +} + +const _abi$l = [ + { + inputs: [], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + } + ], + name: "Delegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "proposer", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + indexed: false, + internalType: "string", + name: "description", + type: "string" + } + ], + name: "ProposalCreated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "ProposalExecuted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + } + ], + name: "Undelegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "voter", + type: "address" + }, + { + indexed: true, + internalType: "bool", + name: "support", + type: "bool" + }, + { + indexed: false, + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + name: "Voted", + type: "event" + }, + { + inputs: [], + name: "CLOSING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_EXPIRATION", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PROPOSAL_THRESHOLD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "QUORUM_VOTES", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTE_EXTEND_TIME", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "canWithdrawAfter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "from", + type: "address[]" + }, + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castDelegatedVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + } + ], + name: "delegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "delegatedTo", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "execute", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "voter", + type: "address" + } + ], + name: "getReceipt", + outputs: [ + { + components: [ + { + internalType: "bool", + name: "hasVoted", + type: "bool" + }, + { + internalType: "bool", + name: "support", + type: "bool" + }, + { + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + internalType: "struct Governance.Receipt", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "latestProposalIds", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "lock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "lockWithApproval", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "lockedBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "proposalCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "proposals", + outputs: [ + { + internalType: "address", + name: "proposer", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "forVotes", + type: "uint256" + }, + { + internalType: "uint256", + name: "againstVotes", + type: "uint256" + }, + { + internalType: "bool", + name: "executed", + type: "bool" + }, + { + internalType: "bool", + name: "extended", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "propose", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "proposeByDelegate", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "closingPeriod", + type: "uint256" + } + ], + name: "setClosingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionDelay", + type: "uint256" + } + ], + name: "setExecutionDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionExpiration", + type: "uint256" + } + ], + name: "setExecutionExpiration", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalThreshold", + type: "uint256" + } + ], + name: "setProposalThreshold", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "quorumVotes", + type: "uint256" + } + ], + name: "setQuorumVotes", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "voteExtendTime", + type: "uint256" + } + ], + name: "setVoteExtendTime", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingDelay", + type: "uint256" + } + ], + name: "setVotingDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingPeriod", + type: "uint256" + } + ], + name: "setVotingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "state", + outputs: [ + { + internalType: "enum Governance.ProposalState", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract TORN", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "undelegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "unlock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$g = "0x60806040523480156200001157600080fd5b50600054610100900460ff16806200002e57506200002e620000c9565b806200003d575060005460ff16155b620000655760405162461bcd60e51b81526004016200005c9062000110565b60405180910390fd5b600054610100900460ff1615801562000091576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000af620000cf565b8015620000c2576000805461ff00191690555b506200015e565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b612524806200016e6000396000f3fe60806040526004361061020f5760003560e01c8063a6c2660311610118578063d6159fe5116100a0578063e4917d9f1161006f578063e4917d9f146105ce578063ea0217cf146105ee578063ece40cc11461060e578063f0b768921461062e578063fe0d94c11461064e5761020f565b8063d6159fe514610557578063d6f0948c1461056c578063da35c6641461058c578063e23a9a52146105a15761020f565b8063b54426c8116100e7578063b54426c8146104c2578063b859f11b146104e2578063c0c0e82014610502578063c4d66de814610522578063ce25d71c146105425761020f565b8063a6c2660314610463578063a72edda314610478578063adf898a414610498578063b1610d7e146104ad5761020f565b80636198e3391161019b5780636dc2dc6c1161016a5780636dc2dc6c146103ce57806370b0f660146103ee57806392ab89bb1461040e5780639a9e3b6e146104235780639ae697bf146104435761020f565b80636198e3391461035757806365da126414610377578063671dd275146103a45780636a661755146103b95761020f565b806337f135d7116101e257806337f135d7146102c05780633e4f49e6146102d5578063587a6ecb1461030257806358e9fff0146103175780635c19a95c146103375761020f565b8063013cf08b1461021457806302ec8f9e1461025157806315373e3d1461027357806317977c6114610293575b600080fd5b34801561022057600080fd5b5061023461022f366004611d5c565b610661565b604051610248989796959493929190611e68565b60405180910390f35b34801561025d57600080fd5b5061027161026c366004611d5c565b6106c6565b005b34801561027f57600080fd5b5061027161028e366004611da0565b6106f3565b34801561029f57600080fd5b506102b36102ae366004611b53565b610702565b604051610248919061246b565b3480156102cc57600080fd5b506102b3610714565b3480156102e157600080fd5b506102f56102f0366004611d5c565b61071a565b6040516102489190611f26565b34801561030e57600080fd5b506102b361085d565b34801561032357600080fd5b506102b3610332366004611b6e565b610863565b34801561034357600080fd5b50610271610352366004611b53565b6108b1565b34801561036357600080fd5b50610271610372366004611d5c565b6109d3565b34801561038357600080fd5b50610397610392366004611b53565b610b0a565b6040516102489190611e17565b3480156103b057600080fd5b506102b3610b25565b3480156103c557600080fd5b506102b3610b2b565b3480156103da57600080fd5b506102716103e9366004611d5c565b610b31565b3480156103fa57600080fd5b50610271610409366004611d5c565b610b76565b34801561041a57600080fd5b50610271610b9a565b34801561042f57600080fd5b5061027161043e366004611d5c565b610c21565b34801561044f57600080fd5b506102b361045e366004611b53565b610c45565b34801561046f57600080fd5b506102b3610c57565b34801561048457600080fd5b506102b3610493366004611b53565b610c5d565b3480156104a457600080fd5b50610397610c6f565b3480156104b957600080fd5b506102b3610c7e565b3480156104ce57600080fd5b506102716104dd366004611d5c565b610c84565b3480156104ee57600080fd5b506102716104fd366004611c7b565b610c8e565b34801561050e57600080fd5b5061027161051d366004611d5c565b610d45565b34801561052e57600080fd5b5061027161053d366004611b53565b610d69565b34801561054e57600080fd5b506102b3610fac565b34801561056357600080fd5b506102b3610fb2565b34801561057857600080fd5b506102b3610587366004611bce565b610fb8565b34801561059857600080fd5b506102b3610fce565b3480156105ad57600080fd5b506105c16105bc366004611d74565b610fd8565b6040516102489190612446565b3480156105da57600080fd5b506102716105e9366004611d5c565b61104a565b3480156105fa57600080fd5b50610271610609366004611d5c565b61106e565b34801561061a57600080fd5b50610271610629366004611d5c565b611092565b34801561063a57600080fd5b50610271610649366004611c1c565b6110b6565b61027161065c366004611d5c565b611136565b603d818154811061066e57fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b3330146106ee5760405162461bcd60e51b81526004016106e590612212565b60405180910390fd5b603555565b6106fe3383836112c8565b5050565b603e6020526000908152604090205481565b60335481565b6000610724610fce565b82111580156107335750600082115b61074f5760405162461bcd60e51b81526004016106e590612348565b6000603d838154811061075e57fe5b90600052602060002090600802019050806002015461077b6114f9565b1161078a576000915050610858565b80600301546107976114f9565b116107a6576001915050610858565b806005015481600401541115806107c857506035548160050154826004015401105b156107d7576002915050610858565b600681015460ff16156107ee576005915050610858565b61081360345461080d60335484600301546114fd90919063ffffffff16565b906114fd565b61081b6114f9565b1061082a576006915050610858565b603354600382015461083b916114fd565b6108436114f9565b10610852576004915050610858565b60039150505b919050565b603a5481565b6001600160a01b038381166000908152603c6020526040812054909116331461089e5760405162461bcd60e51b81526004016106e5906123d8565b6108a9848484611522565b949350505050565b336000818152603c60205260409020546001600160a01b0390811691908316148015906108e757506001600160a01b0382163014155b80156108fb57506001600160a01b03821615155b80156109195750806001600160a01b0316826001600160a01b031614155b6109355760405162461bcd60e51b81526004016106e590612249565b6001600160a01b0381161561097b576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000908152603f60205260409020546109eb6114f9565b11610a085760405162461bcd60e51b81526004016106e590612175565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054610a56918390611870565b336000818152603b602052604090819020929092558154915163a9059cbb60e01b81526001600160a01b039092169163a9059cbb91610a99918590600401611e2b565b602060405180830381600087803b158015610ab357600080fd5b505af1158015610ac7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aeb9190611d40565b610b075760405162461bcd60e51b81526004016106e5906121ac565b50565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610b505760405162461bcd60e51b81526004016106e590612212565b6033548110610b715760405162461bcd60e51b81526004016106e590612131565b603a55565b333014610b955760405162461bcd60e51b81526004016106e590612212565b603755565b336000908152603c60205260409020546001600160a01b031680610bd05760405162461bcd60e51b81526004016106e59061238e565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b333014610c405760405162461bcd60e51b81526004016106e590612212565b603455565b603b6020526000908152604090205481565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b610b07338261189c565b60005b8351811015610d1f57336001600160a01b0316603c6000868481518110610cb457fe5b6020908102919091018101516001600160a01b03908116835290820192909252604001600020541614610cf95760405162461bcd60e51b81526004016106e5906123d8565b610d17848281518110610d0857fe5b602002602001015184846112c8565b600101610c91565b50336000908152603b602052604090205415610d4057610d403383836112c8565b505050565b333014610d645760405162461bcd60e51b81526004016106e590612212565b603955565b600054610100900460ff1680610d825750610d82611981565b80610d90575060005460ff16155b610dac5760405162461bcd60e51b81526004016106e5906122fa565b600054610100900460ff16158015610dd7576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff199094169390931716919091179055610f97611987565b80156106fe576000805461ff00191690555050565b60395481565b60375481565b6000610fc5338484611522565b90505b92915050565b603d546000190190565b610fe0611a4d565b603d8381548110610fed57fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b3330146110695760405162461bcd60e51b81526004016106e590612212565b603355565b33301461108d5760405162461bcd60e51b81526004016106e590612212565b603855565b3330146110b15760405162461bcd60e51b81526004016106e590612212565b603655565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf906110f290899030908a908a908a908a908a90600401611eae565b600060405180830381600087803b15801561110c57600080fd5b505af1158015611120573d6000803e3d6000fd5b5050505061112e868661189c565b505050505050565b60046111418261071a565b600681111561114c57fe5b146111695760405162461bcd60e51b81526004016106e590611f90565b6000603d828154811061117857fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b03166111b3816119c8565b6111cf5760405162461bcd60e51b81526004016106e590611f4d565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b0385169161121391611dfb565b600060405180830381855af49150503d806000811461124e576040519150601f19603f3d011682016040523d82523d6000602084013e611253565b606091505b5091509150816112965780511561127e578060405162461bcd60e51b81526004016106e59190611f3a565b60405162461bcd60e51b81526004016106e59061240f565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b60016112d38361071a565b60068111156112de57fe5b146112fb5760405162461bcd60e51b81526004016106e590612056565b6000603d838154811061130a57fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b9094529190942054929450101590806113695760405162461bcd60e51b81526004016106e590612280565b825460ff16156113b8578254610100900460ff161561139f5760018301546004850154611395916119ce565b60048501556113b8565b600183015460058501546113b2916119ce565b60058501555b84156113d75760048401546113cd90826114fd565b60048501556113ec565b60058401546113e690826114fd565b60058501555b6006840154610100900460ff1615801561141c575060395461141a61140f6114f9565b6003870154906119ce565b105b1561146057600584015460048501541115821515811461145e5760068501805461ff001916610100179055603a546003860154611458916114fd565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a5460038701546114ab938b936114a693919261080d928391906114fd565b611a10565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b5846040516114e8919061246b565b60405180910390a450505050505050565b4290565b600082820183811015610fc55760405162461bcd60e51b81526004016106e5906120fa565b6001600160a01b0383166000908152603b602052604081205460365481101561155d5760405162461bcd60e51b81526004016106e59061209d565b611566846119c8565b6115825760405162461bcd60e51b81526004016106e5906122b7565b6001600160a01b0385166000908152603e602052604090205480156115f45760006115ac8261071a565b905060018160068111156115bc57fe5b141580156115d6575060008160068111156115d357fe5b14155b6115f25760405162461bcd60e51b81526004016106e590611fdb565b505b600061160460375461080d6114f9565b9050600061161d603854836114fd90919063ffffffff16565b9050611627611a6d565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff199093169290921794909416179055906117d9610fce565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a5492935061181b928d926114a692909161080d919082908a906114fd565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d60405161185b9493929190611eef565b60405180910390a39998505050505050505050565b600081848411156118945760405162461bcd60e51b81526004016106e59190611f3a565b505050900390565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd906118d090859030908690600401611e44565b602060405180830381600087803b1580156118ea57600080fd5b505af11580156118fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119229190611d40565b61193e5760405162461bcd60e51b81526004016106e5906121db565b6001600160a01b0382166000908152603b602052604090205461196190826114fd565b6001600160a01b039092166000908152603b602052604090209190915550565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b3b151590565b6000610fc583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611870565b6001600160a01b0382166000908152603f60205260409020548111156106fe576001600160a01b03919091166000908152603f6020526040902055565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b0381168114610fc857600080fd5b8035610fc8816124e0565b600082601f830112611afa578081fd5b813567ffffffffffffffff811115611b10578182fd5b611b23601f8201601f1916602001612474565b9150808252836020828501011115611b3a57600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215611b64578081fd5b610fc58383611ac8565b600080600060608486031215611b82578182fd5b8335611b8d816124cb565b92506020840135611b9d816124cb565b9150604084013567ffffffffffffffff811115611bb8578182fd5b611bc486828701611aea565b9150509250925092565b60008060408385031215611be0578182fd5b8235611beb816124cb565b9150602083013567ffffffffffffffff811115611c06578182fd5b611c1285828601611aea565b9150509250929050565b60008060008060008060c08789031215611c34578182fd5b611c3e8888611ac8565b95506020870135945060408701359350606087013560ff81168114611c61578283fd5b9598949750929560808101359460a0909101359350915050565b600080600060608486031215611c8f578283fd5b833567ffffffffffffffff80821115611ca6578485fd5b818601915086601f830112611cb9578485fd5b813581811115611cc7578586fd5b60209150818102611cd9838201612474565b8281528381019085850183870186018c1015611cf357898afd5b8996505b84871015611d1d57611d098c82611ac8565b835260019690960195918501918501611cf7565b5097505050508501359250611d3790508560408601611adf565b90509250925092565b600060208284031215611d51578081fd5b8151610fc5816124e0565b600060208284031215611d6d578081fd5b5035919050565b60008060408385031215611d86578182fd5b82359150611d978460208501611ac8565b90509250929050565b60008060408385031215611db2578182fd5b823591506020830135611dc4816124e0565b809150509250929050565b60008151808452611de781602086016020860161249b565b601f01601f19169290920160200192915050565b60008251611e0d81846020870161249b565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b038616825284602083015283604083015260806060830152611f1c6080830184611dcf565b9695505050505050565b6020810160078310611f3457fe5b91905290565b600060208252610fc56020830184611dcf565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b6020808252601590820152741513d4938e881d1c985b9cd9995c8819985a5b1959605a1b604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b90815260200190565b60405181810167ffffffffffffffff8111828210171561249357600080fd5b604052919050565b60005b838110156124b657818101518382015260200161249e565b838111156124c5576000848401525b50505050565b6001600160a01b0381168114610b0757600080fd5b8015158114610b0757600080fdfea26469706673582212208c8a57d0dd9da76417112ba79eab1d38dbdf5e0a8bc014651f10bebe82ce8f9b64736f6c634300060c0033"; +const isSuperArgs$g = (xs) => xs.length > 1; +class Governance__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$g(args)) { + super(...args); + } else { + super(_abi$l, _bytecode$g, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$g; + static abi = _abi$l; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$l); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$l, runner); + } +} + +var index$d = /*#__PURE__*/Object.freeze({ + __proto__: null, + Configuration__factory: Configuration__factory, + Core__factory: Core__factory, + Delegation__factory: Delegation__factory, + Governance__factory: Governance__factory, + mocks: index$e +}); + +const _abi$k = [ + { + inputs: [ + { + internalType: "address", + name: "_gasCompensationVault", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "gasCompensationVault", + outputs: [ + { + internalType: "contract IGasCompensationVault", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "_gasCompensationsLimit", + type: "uint256" + } + ], + name: "setGasCompensations", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdrawFromHelper", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class GasCompensator__factory { + static abi = _abi$k; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$k); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$k, runner); + } +} + +const _abi$j = [ + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "gasAmount", + type: "uint256" + } + ], + name: "compensateGas", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdrawToGovernance", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class IGasCompensationVault__factory { + static abi = _abi$j; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$j); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$j, + runner + ); + } +} + +var index$c = /*#__PURE__*/Object.freeze({ + __proto__: null, + GasCompensator__factory: GasCompensator__factory, + IGasCompensationVault__factory: IGasCompensationVault__factory +}); + +const _abi$i = [ + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdrawTorn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class ITornadoVault__factory { + static abi = _abi$i; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$i); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$i, runner); + } +} + +var index$b = /*#__PURE__*/Object.freeze({ + __proto__: null, + ITornadoVault__factory: ITornadoVault__factory +}); + +const _abi$h = [ + { + inputs: [ + { + internalType: "address", + name: "_gasCompLogic", + type: "address" + }, + { + internalType: "address", + name: "_userVault", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + } + ], + name: "Delegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "proposer", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + indexed: false, + internalType: "string", + name: "description", + type: "string" + } + ], + name: "ProposalCreated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "ProposalExecuted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + } + ], + name: "Undelegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "voter", + type: "address" + }, + { + indexed: true, + internalType: "bool", + name: "support", + type: "bool" + }, + { + indexed: false, + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + name: "Voted", + type: "event" + }, + { + inputs: [], + name: "CLOSING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_EXPIRATION", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PROPOSAL_THRESHOLD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "QUORUM_VOTES", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTE_EXTEND_TIME", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "canWithdrawAfter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "from", + type: "address[]" + }, + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castDelegatedVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "checkIfQuorumReached", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + } + ], + name: "delegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "delegatedTo", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "execute", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "gasCompensationVault", + outputs: [ + { + internalType: "contract IGasCompensationVault", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "voter", + type: "address" + } + ], + name: "getReceipt", + outputs: [ + { + components: [ + { + internalType: "bool", + name: "hasVoted", + type: "bool" + }, + { + internalType: "bool", + name: "support", + type: "bool" + }, + { + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + internalType: "struct Governance.Receipt", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "hasAccountVoted", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "latestProposalIds", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "lock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "lockWithApproval", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "lockedBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "proposalCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "proposals", + outputs: [ + { + internalType: "address", + name: "proposer", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "forVotes", + type: "uint256" + }, + { + internalType: "uint256", + name: "againstVotes", + type: "uint256" + }, + { + internalType: "bool", + name: "executed", + type: "bool" + }, + { + internalType: "bool", + name: "extended", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "propose", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "proposeByDelegate", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "returnMultisigAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "closingPeriod", + type: "uint256" + } + ], + name: "setClosingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionDelay", + type: "uint256" + } + ], + name: "setExecutionDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionExpiration", + type: "uint256" + } + ], + name: "setExecutionExpiration", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "gasCompensationsLimit", + type: "uint256" + } + ], + name: "setGasCompensations", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalThreshold", + type: "uint256" + } + ], + name: "setProposalThreshold", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "quorumVotes", + type: "uint256" + } + ], + name: "setQuorumVotes", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "voteExtendTime", + type: "uint256" + } + ], + name: "setVoteExtendTime", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingDelay", + type: "uint256" + } + ], + name: "setVotingDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingPeriod", + type: "uint256" + } + ], + name: "setVotingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "state", + outputs: [ + { + internalType: "enum Governance.ProposalState", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract TORN", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "undelegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "unlock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "userVault", + outputs: [ + { + internalType: "contract ITornadoVault", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "version", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdrawFromHelper", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$f = "0x60c06040523480156200001157600080fd5b5060405162002e3138038062002e31833981016040819052620000349162000153565b60005482908290610100900460ff1680620000545750620000546200010c565b8062000063575060005460ff16155b6200008b5760405162461bcd60e51b8152600401620000829062000191565b60405180910390fd5b600054610100900460ff16158015620000b7576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000d562000112565b8015620000e8576000805461ff00191690555b506001600160601b0319606091821b811660805291901b1660a05250620001f89050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6000806040838503121562000166578182fd5b82516200017381620001df565b60208401519092506200018681620001df565b809150509250929050565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6001600160a01b0381168114620001f557600080fd5b50565b60805160601c60a05160601c612bf162000240600039806108c55280610e525280610f4a52806114505280611ee1525080610d545280610fb75280611cf75250612bf16000f3fe60806040526004361061026b5760003560e01c80639ae697bf11610144578063d6159fe5116100b6578063e525aa081161007a578063e525aa08146106ff578063ea0217cf1461071f578063ece40cc11461073f578063ef3f8bb11461075f578063f0b768921461077f578063fe0d94c11461079f57610272565b8063d6159fe514610668578063d6f0948c1461067d578063da35c6641461069d578063e23a9a52146106b2578063e4917d9f146106df57610272565b8063b1610d7e11610108578063b1610d7e146105be578063b54426c8146105d3578063b859f11b146105f3578063c0c0e82014610613578063c4d66de814610633578063ce25d71c1461065357610272565b80639ae697bf1461053f5780639daafec71461055f578063a6c2660314610574578063a72edda314610589578063adf898a4146105a957610272565b80635c19a95c116101dd5780636dc2dc6c116101a15780636dc2dc6c1461049557806370b0f660146104b55780638b34a960146104d557806392ab89bb146104ea578063932d5157146104ff5780639a9e3b6e1461051f57610272565b80635c19a95c1461040b5780636198e3391461042b57806365da12641461044b578063671dd2751461046b5780636a6617551461048057610272565b806332687ec11161022f57806332687ec11461034557806337f135d7146103725780633e4f49e61461038757806354fd4d50146103b4578063587a6ecb146103d657806358e9fff0146103eb57610272565b8063013cf08b1461027757806302ec8f9e146102b457806315373e3d146102d657806317977c61146102f657806324b0435f1461032357610272565b3661027257005b600080fd5b34801561028357600080fd5b506102976102923660046123c5565b6107b2565b6040516102ab9897969594939291906124d1565b60405180910390f35b3480156102c057600080fd5b506102d46102cf3660046123c5565b610817565b005b3480156102e257600080fd5b506102d46102f1366004612409565b610844565b34801561030257600080fd5b506103166103113660046121bc565b610947565b6040516102ab9190612b38565b34801561032f57600080fd5b50610338610959565b6040516102ab9190612480565b34801561035157600080fd5b506103656103603660046123c5565b610971565b6040516102ab919061258f565b34801561037e57600080fd5b506103166109bf565b34801561039357600080fd5b506103a76103a23660046123c5565b6109c5565b6040516102ab919061259a565b3480156103c057600080fd5b506103c9610b01565b6040516102ab91906125ae565b3480156103e257600080fd5b50610316610b38565b3480156103f757600080fd5b506103166104063660046121d7565b610b3e565b34801561041757600080fd5b506102d46104263660046121bc565b610b8c565b34801561043757600080fd5b506102d46104463660046123c5565b610cae565b34801561045757600080fd5b506103386104663660046121bc565b610dc0565b34801561047757600080fd5b50610316610ddb565b34801561048c57600080fd5b50610316610de1565b3480156104a157600080fd5b506102d46104b03660046123c5565b610de7565b3480156104c157600080fd5b506102d46104d03660046123c5565b610e2c565b3480156104e157600080fd5b50610338610e50565b3480156104f657600080fd5b506102d4610e74565b34801561050b57600080fd5b506102d461051a3660046123c5565b610efb565b34801561052b57600080fd5b506102d461053a3660046123c5565b610f7f565b34801561054b57600080fd5b5061031661055a3660046121bc565b610fa3565b34801561056b57600080fd5b50610338610fb5565b34801561058057600080fd5b50610316610fd9565b34801561059557600080fd5b506103166105a43660046121bc565b610fdf565b3480156105b557600080fd5b50610338610ff1565b3480156105ca57600080fd5b50610316611000565b3480156105df57600080fd5b506102d46105ee3660046123c5565b611006565b3480156105ff57600080fd5b506102d461060e3660046122e4565b611013565b34801561061f57600080fd5b506102d461062e3660046123c5565b611061565b34801561063f57600080fd5b506102d461064e3660046121bc565b611085565b34801561065f57600080fd5b506103166112c9565b34801561067457600080fd5b506103166112cf565b34801561068957600080fd5b50610316610698366004612237565b6112d5565b3480156106a957600080fd5b506103166112eb565b3480156106be57600080fd5b506106d26106cd3660046123dd565b6112f5565b6040516102ab9190612b13565b3480156106eb57600080fd5b506102d46106fa3660046123c5565b611367565b34801561070b57600080fd5b5061036561071a3660046123dd565b61138b565b34801561072b57600080fd5b506102d461073a3660046123c5565b6113ce565b34801561074b57600080fd5b506102d461075a3660046123c5565b6113f2565b34801561076b57600080fd5b506102d461077a3660046123c5565b611416565b34801561078b57600080fd5b506102d461079a366004612285565b6114a5565b6102d46107ad3660046123c5565b611525565b603d81815481106107bf57fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b33301461083f5760405162461bcd60e51b815260040161083690612881565b60405180910390fd5b603555565b3361084f833361138b565b158015610862575061086083610971565b155b333214610870576000610874565b6152085b61ffff1681156109355760005a905061088e3387876116b7565b60006108ab6127106108a5856108a55a87906118e8565b9061192a565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce807906108fc9088908590600401612494565b600060405180830381600087803b15801561091657600080fd5b505af115801561092a573d6000803e3d6000fd5b505050505050610940565b6109403386866116b7565b5050505050565b603e6020526000908152604090205481565b73b04e030140b30c27bcdfaafffa98c57d80eda7b490565b6000603554603d838154811061098357fe5b906000526020600020906008020160050154603d84815481106109a257fe5b90600052602060002090600802016004015401101590505b919050565b60335481565b60006109cf6112eb565b82111580156109de5750600082115b6109fa5760405162461bcd60e51b8152600401610836906129de565b6000603d8381548110610a0957fe5b906000526020600020906008020190508060020154610a2661194f565b11610a355760009150506109ba565b8060030154610a4261194f565b11610a515760019150506109ba565b80600501548160040154111580610a7357506035548160050154826004015401105b15610a825760029150506109ba565b600681015460ff1615610a995760059150506109ba565b610ab86034546108a5603354846003015461192a90919063ffffffff16565b610ac061194f565b10610acf5760069150506109ba565b6033546003820154610ae09161192a565b610ae861194f565b10610af75760049150506109ba565b60039150506109ba565b60408051808201909152601981527f322e6c6f74746572792d616e642d6761732d7570677261646500000000000000602082015290565b603a5481565b6001600160a01b038381166000908152603c60205260408120549091163314610b795760405162461bcd60e51b815260040161083690612a6e565b610b84848484611953565b949350505050565b336000818152603c60205260409020546001600160a01b039081169190831614801590610bc257506001600160a01b0382163014155b8015610bd657506001600160a01b03821615155b8015610bf45750806001600160a01b0316826001600160a01b031614155b610c105760405162461bcd60e51b8152600401610836906128b8565b6001600160a01b03811615610c56576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000908152603f6020526040902054610cc661194f565b11610ce35760405162461bcd60e51b8152600401610836906127e9565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054610d31918390611ca1565b336000818152603b6020526040908190209290925590516391fe357360e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316916391fe357391610d9291908590600401612494565b600060405180830381600087803b158015610dac57600080fd5b505af1158015610940573d6000803e3d6000fd5b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610e065760405162461bcd60e51b815260040161083690612881565b6033548110610e275760405162461bcd60e51b8152600401610836906127a5565b603a55565b333014610e4b5760405162461bcd60e51b815260040161083690612881565b603755565b7f000000000000000000000000000000000000000000000000000000000000000081565b336000908152603c60205260409020546001600160a01b031680610eaa5760405162461bcd60e51b815260040161083690612a24565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b610f03610959565b6001600160a01b0316336001600160a01b031614610f335760405162461bcd60e51b8152600401610836906129b7565b604051633a08bde160e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e822f78490610d92908490600401612b38565b333014610f9e5760405162461bcd60e51b815260040161083690612881565b603455565b603b6020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b6110103382611ccd565b50565b60008351116110345760405162461bcd60e51b815260040161083690612857565b61105c838383611044863361138b565b158015611057575061105586610971565b155b611dd2565b505050565b3330146110805760405162461bcd60e51b815260040161083690612881565b603955565b600054610100900460ff168061109e575061109e612016565b806110ac575060005460ff16155b6110c85760405162461bcd60e51b815260040161083690612969565b600054610100900460ff161580156110f3576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff1990941693909317169190911790556112b361201c565b80156112c5576000805461ff00191690555b5050565b60395481565b60375481565b60006112e2338484611953565b90505b92915050565b603d546000190190565b6112fd6120b6565b603d838154811061130a57fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b3330146113865760405162461bcd60e51b815260040161083690612881565b603355565b6000603d838154811061139a57fe5b600091825260208083206001600160a01b03861684526007600890930201919091019052604090205460ff16905092915050565b3330146113ed5760405162461bcd60e51b815260040161083690612881565b603855565b3330146114115760405162461bcd60e51b815260040161083690612881565b603655565b61141e610959565b6001600160a01b0316336001600160a01b03161461144e5760405162461bcd60e51b8152600401610836906129b7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166108fc611485834761205d565b6040518115909202916000818181858888f1935050505061101057600080fd5b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf906114e190899030908a908a908a908a908a90600401612517565b600060405180830381600087803b1580156114fb57600080fd5b505af115801561150f573d6000803e3d6000fd5b5050505061151d8686611ccd565b505050505050565b6004611530826109c5565b600681111561153b57fe5b146115585760405162461bcd60e51b815260040161083690612604565b6000603d828154811061156757fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b03166115a281612073565b6115be5760405162461bcd60e51b8152600401610836906125c1565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b0385169161160291612464565b600060405180830381855af49150503d806000811461163d576040519150601f19603f3d011682016040523d82523d6000602084013e611642565b606091505b5091509150816116855780511561166d578060405162461bcd60e51b815260040161083691906125ae565b60405162461bcd60e51b815260040161083690612aa5565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b60016116c2836109c5565b60068111156116cd57fe5b146116ea5760405162461bcd60e51b8152600401610836906126ca565b6000603d83815481106116f957fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b9094529190942054929450101590806117585760405162461bcd60e51b8152600401610836906128ef565b825460ff16156117a7578254610100900460ff161561178e5760018301546004850154611784916118e8565b60048501556117a7565b600183015460058501546117a1916118e8565b60058501555b84156117c65760048401546117bc908261192a565b60048501556117db565b60058401546117d5908261192a565b60058501555b6006840154610100900460ff1615801561180b57506039546118096117fe61194f565b6003870154906118e8565b105b1561184f57600584015460048501541115821515811461184d5760068501805461ff001916610100179055603a5460038601546118479161192a565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a54600387015461189a938b936118959391926108a59283919061192a565b612079565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b5846040516118d79190612b38565b60405180910390a450505050505050565b60006112e283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ca1565b6000828201838110156112e25760405162461bcd60e51b81526004016108369061276e565b4290565b6001600160a01b0383166000908152603b602052604081205460365481101561198e5760405162461bcd60e51b815260040161083690612711565b61199784612073565b6119b35760405162461bcd60e51b815260040161083690612926565b6001600160a01b0385166000908152603e60205260409020548015611a255760006119dd826109c5565b905060018160068111156119ed57fe5b14158015611a0757506000816006811115611a0457fe5b14155b611a235760405162461bcd60e51b81526004016108369061264f565b505b6000611a356037546108a561194f565b90506000611a4e6038548361192a90919063ffffffff16565b9050611a586120d6565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff19909316929092179490941617905590611c0a6112eb565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a54929350611c4c928d926118959290916108a5919082908a9061192a565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d604051611c8c9493929190612558565b60405180910390a39998505050505050505050565b60008184841115611cc55760405162461bcd60e51b815260040161083691906125ae565b505050900390565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd90611d219085907f00000000000000000000000000000000000000000000000000000000000000009086906004016124ad565b602060405180830381600087803b158015611d3b57600080fd5b505af1158015611d4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d7391906123a9565b611d8f5760405162461bcd60e51b815260040161083690612820565b6001600160a01b0382166000908152603b6020526040902054611db2908261192a565b6001600160a01b039092166000908152603b602052604090209190915550565b3381328214611de2576000611de6565b6152085b61ffff168115611f515760005a905060005b8851811015611eaf576000898281518110611e0f57fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611e4f57506001600160a01b03811633145b611e6b5760405162461bcd60e51b815260040161083690612a6e565b861580611e7f5750611e7d898261138b565b155b611e9b5760405162461bcd60e51b815260040161083690612adc565b611ea6818a8a6116b7565b50600101611df8565b506000611ec76127106108a5856108a55a87906118e8565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce80790611f189088908590600401612494565b600060405180830381600087803b158015611f3257600080fd5b505af1158015611f46573d6000803e3d6000fd5b50505050505061200d565b60005b875181101561200b576000888281518110611f6b57fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611fab57506001600160a01b03811633145b611fc75760405162461bcd60e51b815260040161083690612a6e565b851580611fdb5750611fd9888261138b565b155b611ff75760405162461bcd60e51b815260040161083690612adc565b6120028189896116b7565b50600101611f54565b505b50505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b600081831061206c57816112e2565b5090919050565b3b151590565b6001600160a01b0382166000908152603f60205260409020548111156112c5576001600160a01b03919091166000908152603f6020526040902055565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b03811681146112e557600080fd5b80356112e581612bad565b600082601f830112612163578081fd5b813567ffffffffffffffff811115612179578182fd5b61218c601f8201601f1916602001612b41565b91508082528360208285010111156121a357600080fd5b8060208401602084013760009082016020015292915050565b6000602082840312156121cd578081fd5b6112e28383612131565b6000806000606084860312156121eb578182fd5b83356121f681612b98565b9250602084013561220681612b98565b9150604084013567ffffffffffffffff811115612221578182fd5b61222d86828701612153565b9150509250925092565b60008060408385031215612249578182fd5b823561225481612b98565b9150602083013567ffffffffffffffff81111561226f578182fd5b61227b85828601612153565b9150509250929050565b60008060008060008060c0878903121561229d578182fd5b6122a78888612131565b95506020870135945060408701359350606087013560ff811681146122ca578283fd5b9598949750929560808101359460a0909101359350915050565b6000806000606084860312156122f8578283fd5b833567ffffffffffffffff8082111561230f578485fd5b818601915086601f830112612322578485fd5b813581811115612330578586fd5b60209150818102612342838201612b41565b8281528381019085850183870186018c101561235c57898afd5b8996505b84871015612386576123728c82612131565b835260019690960195918501918501612360565b50975050505085013592506123a090508560408601612148565b90509250925092565b6000602082840312156123ba578081fd5b81516112e281612bad565b6000602082840312156123d6578081fd5b5035919050565b600080604083850312156123ef578182fd5b823591506124008460208501612131565b90509250929050565b6000806040838503121561241b578182fd5b82359150602083013561242d81612bad565b809150509250929050565b60008151808452612450816020860160208601612b68565b601f01601f19169290920160200192915050565b60008251612476818460208701612b68565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b0386168252846020830152836040830152608060608301526125856080830184612438565b9695505050505050565b901515815260200190565b60208101600783106125a857fe5b91905290565b6000602082526112e26020830184612438565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526010908201526f43616e206e6f7420626520656d70747960801b604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252600d908201526c6f6e6c79206d756c746973696760981b604082015260600190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b60208082526019908201527f476f7665726e616e63653a20766f74656420616c726561647900000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b90815260200190565b60405181810167ffffffffffffffff81118282101715612b6057600080fd5b604052919050565b60005b83811015612b83578181015183820152602001612b6b565b83811115612b92576000848401525b50505050565b6001600160a01b038116811461101057600080fd5b801515811461101057600080fdfea2646970667358221220a9ae24380315e86f1632949f167f44c17322fe48a1385357edbfdf8bc543469764736f6c634300060c0033"; +const isSuperArgs$f = (xs) => xs.length > 1; +class GovernanceGasUpgrade__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$f(args)) { + super(...args); + } else { + super(_abi$h, _bytecode$f, args[0]); + } + } + getDeployTransaction(_gasCompLogic, _userVault, overrides) { + return super.getDeployTransaction( + _gasCompLogic, + _userVault, + overrides || {} + ); + } + deploy(_gasCompLogic, _userVault, overrides) { + return super.deploy(_gasCompLogic, _userVault, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$f; + static abi = _abi$h; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$h); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$h, + runner + ); + } +} + +const _abi$g = [ + { + inputs: [ + { + internalType: "address", + name: "_userVault", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + } + ], + name: "Delegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "proposer", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + indexed: false, + internalType: "string", + name: "description", + type: "string" + } + ], + name: "ProposalCreated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "ProposalExecuted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + } + ], + name: "Undelegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "voter", + type: "address" + }, + { + indexed: true, + internalType: "bool", + name: "support", + type: "bool" + }, + { + indexed: false, + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + name: "Voted", + type: "event" + }, + { + inputs: [], + name: "CLOSING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_EXPIRATION", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PROPOSAL_THRESHOLD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "QUORUM_VOTES", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTE_EXTEND_TIME", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "canWithdrawAfter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "from", + type: "address[]" + }, + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castDelegatedVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + } + ], + name: "delegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "delegatedTo", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "execute", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "voter", + type: "address" + } + ], + name: "getReceipt", + outputs: [ + { + components: [ + { + internalType: "bool", + name: "hasVoted", + type: "bool" + }, + { + internalType: "bool", + name: "support", + type: "bool" + }, + { + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + internalType: "struct Governance.Receipt", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "latestProposalIds", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "lock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "lockWithApproval", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "lockedBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "proposalCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "proposals", + outputs: [ + { + internalType: "address", + name: "proposer", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "forVotes", + type: "uint256" + }, + { + internalType: "uint256", + name: "againstVotes", + type: "uint256" + }, + { + internalType: "bool", + name: "executed", + type: "bool" + }, + { + internalType: "bool", + name: "extended", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "propose", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "proposeByDelegate", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "closingPeriod", + type: "uint256" + } + ], + name: "setClosingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionDelay", + type: "uint256" + } + ], + name: "setExecutionDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionExpiration", + type: "uint256" + } + ], + name: "setExecutionExpiration", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalThreshold", + type: "uint256" + } + ], + name: "setProposalThreshold", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "quorumVotes", + type: "uint256" + } + ], + name: "setQuorumVotes", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "voteExtendTime", + type: "uint256" + } + ], + name: "setVoteExtendTime", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingDelay", + type: "uint256" + } + ], + name: "setVotingDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingPeriod", + type: "uint256" + } + ], + name: "setVotingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "state", + outputs: [ + { + internalType: "enum Governance.ProposalState", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract TORN", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "undelegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "unlock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "userVault", + outputs: [ + { + internalType: "contract ITornadoVault", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "version", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "pure", + type: "function" + } +]; +const _bytecode$e = "0x60a06040523480156200001157600080fd5b506040516200277e3803806200277e833981016040819052620000349162000142565b600054610100900460ff168062000050575062000050620000fb565b806200005f575060005460ff16155b620000875760405162461bcd60e51b81526004016200007e9062000172565b60405180910390fd5b600054610100900460ff16158015620000b3576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000d162000101565b8015620000e4576000805461ff00191690555b5060601b6001600160601b031916608052620001c0565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b60006020828403121562000154578081fd5b81516001600160a01b03811681146200016b578182fd5b9392505050565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b60805160601c612596620001e860003980610af15280610cb3528061194752506125966000f3fe6080604052600436106102255760003560e01c80639daafec711610123578063ce25d71c116100ab578063e4917d9f1161006f578063e4917d9f1461061b578063ea0217cf1461063b578063ece40cc11461065b578063f0b768921461067b578063fe0d94c11461069b57610225565b8063ce25d71c1461058f578063d6159fe5146105a4578063d6f0948c146105b9578063da35c664146105d9578063e23a9a52146105ee57610225565b8063b1610d7e116100f2578063b1610d7e146104fa578063b54426c81461050f578063b859f11b1461052f578063c0c0e8201461054f578063c4d66de81461056f57610225565b80639daafec71461049b578063a6c26603146104b0578063a72edda3146104c5578063adf898a4146104e557610225565b80635c19a95c116101b15780636dc2dc6c116101755780636dc2dc6c1461040657806370b0f6601461042657806392ab89bb146104465780639a9e3b6e1461045b5780639ae697bf1461047b57610225565b80635c19a95c1461036f5780636198e3391461038f57806365da1264146103af578063671dd275146103dc5780636a661755146103f157610225565b806337f135d7116101f857806337f135d7146102d65780633e4f49e6146102eb57806354fd4d5014610318578063587a6ecb1461033a57806358e9fff01461034f57610225565b8063013cf08b1461022a57806302ec8f9e1461026757806315373e3d1461028957806317977c61146102a9575b600080fd5b34801561023657600080fd5b5061024a610245366004611dfd565b6106ae565b60405161025e989796959493929190611f09565b60405180910390f35b34801561027357600080fd5b50610287610282366004611dfd565b610713565b005b34801561029557600080fd5b506102876102a4366004611e41565b610740565b3480156102b557600080fd5b506102c96102c4366004611bf4565b61074f565b60405161025e91906124dd565b3480156102e257600080fd5b506102c9610761565b3480156102f757600080fd5b5061030b610306366004611dfd565b610767565b60405161025e9190611fc7565b34801561032457600080fd5b5061032d6108aa565b60405161025e9190611fdb565b34801561034657600080fd5b506102c96108d5565b34801561035b57600080fd5b506102c961036a366004611c0f565b6108db565b34801561037b57600080fd5b5061028761038a366004611bf4565b610929565b34801561039b57600080fd5b506102876103aa366004611dfd565b610a4b565b3480156103bb57600080fd5b506103cf6103ca366004611bf4565b610b64565b60405161025e9190611eb8565b3480156103e857600080fd5b506102c9610b7f565b3480156103fd57600080fd5b506102c9610b85565b34801561041257600080fd5b50610287610421366004611dfd565b610b8b565b34801561043257600080fd5b50610287610441366004611dfd565b610bd0565b34801561045257600080fd5b50610287610bf4565b34801561046757600080fd5b50610287610476366004611dfd565b610c7b565b34801561048757600080fd5b506102c9610496366004611bf4565b610c9f565b3480156104a757600080fd5b506103cf610cb1565b3480156104bc57600080fd5b506102c9610cd5565b3480156104d157600080fd5b506102c96104e0366004611bf4565b610cdb565b3480156104f157600080fd5b506103cf610ced565b34801561050657600080fd5b506102c9610cfc565b34801561051b57600080fd5b5061028761052a366004611dfd565b610d02565b34801561053b57600080fd5b5061028761054a366004611d1c565b610d0f565b34801561055b57600080fd5b5061028761056a366004611dfd565b610dc6565b34801561057b57600080fd5b5061028761058a366004611bf4565b610dea565b34801561059b57600080fd5b506102c961102d565b3480156105b057600080fd5b506102c9611033565b3480156105c557600080fd5b506102c96105d4366004611c6f565b611039565b3480156105e557600080fd5b506102c961104f565b3480156105fa57600080fd5b5061060e610609366004611e15565b611059565b60405161025e91906124b8565b34801561062757600080fd5b50610287610636366004611dfd565b6110cb565b34801561064757600080fd5b50610287610656366004611dfd565b6110ef565b34801561066757600080fd5b50610287610676366004611dfd565b611113565b34801561068757600080fd5b50610287610696366004611cbd565b611137565b6102876106a9366004611dfd565b6111b7565b603d81815481106106bb57fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b33301461073b5760405162461bcd60e51b815260040161073290612284565b60405180910390fd5b603555565b61074b338383611349565b5050565b603e6020526000908152604090205481565b60335481565b600061077161104f565b82111580156107805750600082115b61079c5760405162461bcd60e51b8152600401610732906123ba565b6000603d83815481106107ab57fe5b9060005260206000209060080201905080600201546107c861157a565b116107d75760009150506108a5565b80600301546107e461157a565b116107f35760019150506108a5565b8060050154816004015411158061081557506035548160050154826004015401105b156108245760029150506108a5565b600681015460ff161561083b5760059150506108a5565b61086060345461085a603354846003015461157e90919063ffffffff16565b9061157e565b61086861157a565b106108775760069150506108a5565b60335460038201546108889161157e565b61089061157a565b1061089f5760049150506108a5565b60039150505b919050565b60408051808201909152601181527019173b30bab63a16b6b4b3b930ba34b7b760791b602082015290565b603a5481565b6001600160a01b038381166000908152603c602052604081205490911633146109165760405162461bcd60e51b81526004016107329061244a565b6109218484846115a3565b949350505050565b336000818152603c60205260409020546001600160a01b03908116919083161480159061095f57506001600160a01b0382163014155b801561097357506001600160a01b03821615155b80156109915750806001600160a01b0316826001600160a01b031614155b6109ad5760405162461bcd60e51b8152600401610732906122bb565b6001600160a01b038116156109f3576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000908152603f6020526040902054610a6361157a565b11610a805760405162461bcd60e51b815260040161073290612216565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054610ace9183906118f1565b336000818152603b6020526040908190209290925590516391fe357360e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316916391fe357391610b2f91908590600401611ecc565b600060405180830381600087803b158015610b4957600080fd5b505af1158015610b5d573d6000803e3d6000fd5b5050505050565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610baa5760405162461bcd60e51b815260040161073290612284565b6033548110610bcb5760405162461bcd60e51b8152600401610732906121d2565b603a55565b333014610bef5760405162461bcd60e51b815260040161073290612284565b603755565b336000908152603c60205260409020546001600160a01b031680610c2a5760405162461bcd60e51b815260040161073290612400565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b333014610c9a5760405162461bcd60e51b815260040161073290612284565b603455565b603b6020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b610d0c338261191d565b50565b60005b8351811015610da057336001600160a01b0316603c6000868481518110610d3557fe5b6020908102919091018101516001600160a01b03908116835290820192909252604001600020541614610d7a5760405162461bcd60e51b81526004016107329061244a565b610d98848281518110610d8957fe5b60200260200101518484611349565b600101610d12565b50336000908152603b602052604090205415610dc157610dc1338383611349565b505050565b333014610de55760405162461bcd60e51b815260040161073290612284565b603955565b600054610100900460ff1680610e035750610e03611a22565b80610e11575060005460ff16155b610e2d5760405162461bcd60e51b81526004016107329061236c565b600054610100900460ff16158015610e58576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff199094169390931716919091179055611018611a28565b801561074b576000805461ff00191690555050565b60395481565b60375481565b60006110463384846115a3565b90505b92915050565b603d546000190190565b611061611aee565b603d838154811061106e57fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b3330146110ea5760405162461bcd60e51b815260040161073290612284565b603355565b33301461110e5760405162461bcd60e51b815260040161073290612284565b603855565b3330146111325760405162461bcd60e51b815260040161073290612284565b603655565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf9061117390899030908a908a908a908a908a90600401611f4f565b600060405180830381600087803b15801561118d57600080fd5b505af11580156111a1573d6000803e3d6000fd5b505050506111af868661191d565b505050505050565b60046111c282610767565b60068111156111cd57fe5b146111ea5760405162461bcd60e51b815260040161073290612031565b6000603d82815481106111f957fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b031661123481611a69565b6112505760405162461bcd60e51b815260040161073290611fee565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b0385169161129491611e9c565b600060405180830381855af49150503d80600081146112cf576040519150601f19603f3d011682016040523d82523d6000602084013e6112d4565b606091505b509150915081611317578051156112ff578060405162461bcd60e51b81526004016107329190611fdb565b60405162461bcd60e51b815260040161073290612481565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b600161135483610767565b600681111561135f57fe5b1461137c5760405162461bcd60e51b8152600401610732906120f7565b6000603d838154811061138b57fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b9094529190942054929450101590806113ea5760405162461bcd60e51b8152600401610732906122f2565b825460ff1615611439578254610100900460ff1615611420576001830154600485015461141691611a6f565b6004850155611439565b6001830154600585015461143391611a6f565b60058501555b841561145857600484015461144e908261157e565b600485015561146d565b6005840154611467908261157e565b60058501555b6006840154610100900460ff1615801561149d575060395461149b61149061157a565b600387015490611a6f565b105b156114e15760058401546004850154111582151581146114df5760068501805461ff001916610100179055603a5460038601546114d99161157e565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a54600387015461152c938b9361152793919261085a9283919061157e565b611ab1565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b58460405161156991906124dd565b60405180910390a450505050505050565b4290565b6000828201838110156110465760405162461bcd60e51b81526004016107329061219b565b6001600160a01b0383166000908152603b60205260408120546036548110156115de5760405162461bcd60e51b81526004016107329061213e565b6115e784611a69565b6116035760405162461bcd60e51b815260040161073290612329565b6001600160a01b0385166000908152603e6020526040902054801561167557600061162d82610767565b9050600181600681111561163d57fe5b141580156116575750600081600681111561165457fe5b14155b6116735760405162461bcd60e51b81526004016107329061207c565b505b600061168560375461085a61157a565b9050600061169e6038548361157e90919063ffffffff16565b90506116a8611b0e565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff1990931692909217949094161790559061185a61104f565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a5492935061189c928d9261152792909161085a919082908a9061157e565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d6040516118dc9493929190611f90565b60405180910390a39998505050505050505050565b600081848411156119155760405162461bcd60e51b81526004016107329190611fdb565b505050900390565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd906119719085907f0000000000000000000000000000000000000000000000000000000000000000908690600401611ee5565b602060405180830381600087803b15801561198b57600080fd5b505af115801561199f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c39190611de1565b6119df5760405162461bcd60e51b81526004016107329061224d565b6001600160a01b0382166000908152603b6020526040902054611a02908261157e565b6001600160a01b039092166000908152603b602052604090209190915550565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b3b151590565b600061104683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506118f1565b6001600160a01b0382166000908152603f602052604090205481111561074b576001600160a01b03919091166000908152603f6020526040902055565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b038116811461104957600080fd5b803561104981612552565b600082601f830112611b9b578081fd5b813567ffffffffffffffff811115611bb1578182fd5b611bc4601f8201601f19166020016124e6565b9150808252836020828501011115611bdb57600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215611c05578081fd5b6110468383611b69565b600080600060608486031215611c23578182fd5b8335611c2e8161253d565b92506020840135611c3e8161253d565b9150604084013567ffffffffffffffff811115611c59578182fd5b611c6586828701611b8b565b9150509250925092565b60008060408385031215611c81578182fd5b8235611c8c8161253d565b9150602083013567ffffffffffffffff811115611ca7578182fd5b611cb385828601611b8b565b9150509250929050565b60008060008060008060c08789031215611cd5578182fd5b611cdf8888611b69565b95506020870135945060408701359350606087013560ff81168114611d02578283fd5b9598949750929560808101359460a0909101359350915050565b600080600060608486031215611d30578283fd5b833567ffffffffffffffff80821115611d47578485fd5b818601915086601f830112611d5a578485fd5b813581811115611d68578586fd5b60209150818102611d7a8382016124e6565b8281528381019085850183870186018c1015611d9457898afd5b8996505b84871015611dbe57611daa8c82611b69565b835260019690960195918501918501611d98565b5097505050508501359250611dd890508560408601611b80565b90509250925092565b600060208284031215611df2578081fd5b815161104681612552565b600060208284031215611e0e578081fd5b5035919050565b60008060408385031215611e27578182fd5b82359150611e388460208501611b69565b90509250929050565b60008060408385031215611e53578182fd5b823591506020830135611e6581612552565b809150509250929050565b60008151808452611e8881602086016020860161250d565b601f01601f19169290920160200192915050565b60008251611eae81846020870161250d565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b038616825284602083015283604083015260806060830152611fbd6080830184611e70565b9695505050505050565b6020810160078310611fd557fe5b91905290565b6000602082526110466020830184611e70565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b90815260200190565b60405181810167ffffffffffffffff8111828210171561250557600080fd5b604052919050565b60005b83811015612528578181015183820152602001612510565b83811115612537576000848401525b50505050565b6001600160a01b0381168114610d0c57600080fd5b8015158114610d0c57600080fdfea26469706673582212204b0042571b6576e17c0708c8f251958898bb0e0a9f340387b1eed439d732af7264736f6c634300060c0033"; +const isSuperArgs$e = (xs) => xs.length > 1; +class GovernanceVaultUpgrade__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$e(args)) { + super(...args); + } else { + super(_abi$g, _bytecode$e, args[0]); + } + } + getDeployTransaction(_userVault, overrides) { + return super.getDeployTransaction(_userVault, overrides || {}); + } + deploy(_userVault, overrides) { + return super.deploy(_userVault, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$e; + static abi = _abi$g; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$g); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$g, + runner + ); + } +} + +var index$a = /*#__PURE__*/Object.freeze({ + __proto__: null, + GovernanceGasUpgrade__factory: GovernanceGasUpgrade__factory, + GovernanceVaultUpgrade__factory: GovernanceVaultUpgrade__factory, + gasCompensatorSol: index$c, + interfaces: index$b +}); + +const _abi$f = [ + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "amountLockedBeforehand", + type: "uint256" + } + ], + name: "updateRewardsOnLockedBalanceChange", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class ITornadoStakingRewards__factory { + static abi = _abi$f; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$f); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$f, + runner + ); + } +} + +var index$9 = /*#__PURE__*/Object.freeze({ + __proto__: null, + ITornadoStakingRewards__factory: ITornadoStakingRewards__factory +}); + +const _abi$e = [ + { + inputs: [ + { + internalType: "address", + name: "stakingRewardsAddress", + type: "address" + }, + { + internalType: "address", + name: "gasCompLogic", + type: "address" + }, + { + internalType: "address", + name: "userVaultAddress", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + } + ], + name: "Delegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "proposer", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + indexed: false, + internalType: "string", + name: "description", + type: "string" + } + ], + name: "ProposalCreated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "ProposalExecuted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "bytes", + name: "errorData", + type: "bytes" + } + ], + name: "RewardUpdateFailed", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + } + ], + name: "RewardUpdateSuccessful", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + } + ], + name: "Undelegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "voter", + type: "address" + }, + { + indexed: true, + internalType: "bool", + name: "support", + type: "bool" + }, + { + indexed: false, + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + name: "Voted", + type: "event" + }, + { + inputs: [], + name: "CLOSING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_EXPIRATION", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PROPOSAL_THRESHOLD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "QUORUM_VOTES", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "Staking", + outputs: [ + { + internalType: "contract ITornadoStakingRewards", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTE_EXTEND_TIME", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "canWithdrawAfter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "from", + type: "address[]" + }, + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castDelegatedVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "checkIfQuorumReached", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + } + ], + name: "delegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "delegatedTo", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "execute", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "gasCompensationVault", + outputs: [ + { + internalType: "contract IGasCompensationVault", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "voter", + type: "address" + } + ], + name: "getReceipt", + outputs: [ + { + components: [ + { + internalType: "bool", + name: "hasVoted", + type: "bool" + }, + { + internalType: "bool", + name: "support", + type: "bool" + }, + { + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + internalType: "struct Governance.Receipt", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "hasAccountVoted", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "latestProposalIds", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "lock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "lockWithApproval", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "lockedBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "proposalCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "proposals", + outputs: [ + { + internalType: "address", + name: "proposer", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "forVotes", + type: "uint256" + }, + { + internalType: "uint256", + name: "againstVotes", + type: "uint256" + }, + { + internalType: "bool", + name: "executed", + type: "bool" + }, + { + internalType: "bool", + name: "extended", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "propose", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "proposeByDelegate", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "returnMultisigAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "closingPeriod", + type: "uint256" + } + ], + name: "setClosingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionDelay", + type: "uint256" + } + ], + name: "setExecutionDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionExpiration", + type: "uint256" + } + ], + name: "setExecutionExpiration", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "gasCompensationsLimit", + type: "uint256" + } + ], + name: "setGasCompensations", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalThreshold", + type: "uint256" + } + ], + name: "setProposalThreshold", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "quorumVotes", + type: "uint256" + } + ], + name: "setQuorumVotes", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "voteExtendTime", + type: "uint256" + } + ], + name: "setVoteExtendTime", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingDelay", + type: "uint256" + } + ], + name: "setVotingDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingPeriod", + type: "uint256" + } + ], + name: "setVotingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "state", + outputs: [ + { + internalType: "enum Governance.ProposalState", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract TORN", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "undelegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "unlock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "userVault", + outputs: [ + { + internalType: "contract ITornadoVault", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "version", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdrawFromHelper", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$d = "0x60e06040523480156200001157600080fd5b50604051620032a6380380620032a6833981016040819052620000349162000165565b81818181600060019054906101000a900460ff1680620000595750620000596200011e565b8062000068575060005460ff16155b620000905760405162461bcd60e51b81526004016200008790620001b8565b60405180910390fd5b600054610100900460ff16158015620000bc576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000da62000124565b8015620000ed576000805461ff00191690555b506001600160601b0319606091821b811660805291811b821660a0529590951b90941660c052506200021f92505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6000806000606084860312156200017a578283fd5b8351620001878162000206565b60208501519093506200019a8162000206565b6040850151909250620001ad8162000206565b809150509250925092565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6001600160a01b03811681146200021c57600080fd5b50565b60805160601c60a05160601c60c05160601c6130246200028260003980610cf652806110b7528061169852806117c95250806108e55280610ead5280610fa552806116145280612164525080611040528061200d528061240e52506130246000f3fe6080604052600436106102765760003560e01c80639ae697bf1161014f578063d6159fe5116100c1578063ea0217cf1161007a578063ea0217cf1461072a578063ece40cc11461074a578063ef3f8bb11461076a578063f0b768921461078a578063f57df22e146107aa578063fe0d94c1146107bf5761027d565b8063d6159fe514610673578063d6f0948c14610688578063da35c664146106a8578063e23a9a52146106bd578063e4917d9f146106ea578063e525aa081461070a5761027d565b8063b1610d7e11610113578063b1610d7e146105c9578063b54426c8146105de578063b859f11b146105fe578063c0c0e8201461061e578063c4d66de81461063e578063ce25d71c1461065e5761027d565b80639ae697bf1461054a5780639daafec71461056a578063a6c266031461057f578063a72edda314610594578063adf898a4146105b45761027d565b80635c19a95c116101e85780636dc2dc6c116101ac5780636dc2dc6c146104a057806370b0f660146104c05780638b34a960146104e057806392ab89bb146104f5578063932d51571461050a5780639a9e3b6e1461052a5761027d565b80635c19a95c146104165780636198e3391461043657806365da126414610456578063671dd275146104765780636a6617551461048b5761027d565b806332687ec11161023a57806332687ec11461035057806337f135d71461037d5780633e4f49e61461039257806354fd4d50146103bf578063587a6ecb146103e157806358e9fff0146103f65761027d565b8063013cf08b1461028257806302ec8f9e146102bf57806315373e3d146102e157806317977c611461030157806324b0435f1461032e5761027d565b3661027d57005b600080fd5b34801561028e57600080fd5b506102a261029d3660046127f8565b6107d2565b6040516102b6989796959493929190612904565b60405180910390f35b3480156102cb57600080fd5b506102df6102da3660046127f8565b610837565b005b3480156102ed57600080fd5b506102df6102fc36600461283c565b610864565b34801561030d57600080fd5b5061032161031c3660046125ef565b610967565b6040516102b69190612f6b565b34801561033a57600080fd5b50610343610979565b6040516102b691906128b3565b34801561035c57600080fd5b5061037061036b3660046127f8565b610991565b6040516102b691906129c2565b34801561038957600080fd5b506103216109df565b34801561039e57600080fd5b506103b26103ad3660046127f8565b6109e5565b6040516102b691906129cd565b3480156103cb57600080fd5b506103d4610b21565b6040516102b691906129e1565b3480156103ed57600080fd5b50610321610b58565b34801561040257600080fd5b5061032161041136600461260a565b610b5e565b34801561042257600080fd5b506102df6104313660046125ef565b610bac565b34801561044257600080fd5b506102df6104513660046127f8565b610cce565b34801561046257600080fd5b506103436104713660046125ef565b610e1b565b34801561048257600080fd5b50610321610e36565b34801561049757600080fd5b50610321610e3c565b3480156104ac57600080fd5b506102df6104bb3660046127f8565b610e42565b3480156104cc57600080fd5b506102df6104db3660046127f8565b610e87565b3480156104ec57600080fd5b50610343610eab565b34801561050157600080fd5b506102df610ecf565b34801561051657600080fd5b506102df6105253660046127f8565b610f56565b34801561053657600080fd5b506102df6105453660046127f8565b611008565b34801561055657600080fd5b506103216105653660046125ef565b61102c565b34801561057657600080fd5b5061034361103e565b34801561058b57600080fd5b50610321611062565b3480156105a057600080fd5b506103216105af3660046125ef565b611068565b3480156105c057600080fd5b5061034361107a565b3480156105d557600080fd5b50610321611089565b3480156105ea57600080fd5b506102df6105f93660046127f8565b61108f565b34801561060a57600080fd5b506102df610619366004612717565b6111d8565b34801561062a57600080fd5b506102df6106393660046127f8565b611226565b34801561064a57600080fd5b506102df6106593660046125ef565b61124a565b34801561066a57600080fd5b5061032161148d565b34801561067f57600080fd5b50610321611493565b34801561069457600080fd5b506103216106a336600461266a565b611499565b3480156106b457600080fd5b506103216114af565b3480156106c957600080fd5b506106dd6106d8366004612810565b6114b9565b6040516102b69190612f46565b3480156106f657600080fd5b506102df6107053660046127f8565b61152b565b34801561071657600080fd5b50610370610725366004612810565b61154f565b34801561073657600080fd5b506102df6107453660046127f8565b611592565b34801561075657600080fd5b506102df6107653660046127f8565b6115b6565b34801561077657600080fd5b506102df6107853660046127f8565b6115da565b34801561079657600080fd5b506102df6107a53660046126b8565b61166c565b3480156107b657600080fd5b506103436117c7565b6102df6107cd3660046127f8565b6117eb565b603d81815481106107df57fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b33301461085f5760405162461bcd60e51b815260040161085690612cb4565b60405180910390fd5b603555565b3361086f833361154f565b158015610882575061088083610991565b155b333214610890576000610894565b6152085b61ffff1681156109555760005a90506108ae33878761197d565b60006108cb6127106108c5856108c55a8790611bae565b90611bf0565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce8079061091c90889085906004016128c7565b600060405180830381600087803b15801561093657600080fd5b505af115801561094a573d6000803e3d6000fd5b505050505050610960565b61096033868661197d565b5050505050565b603e6020526000908152604090205481565b73b04e030140b30c27bcdfaafffa98c57d80eda7b490565b6000603554603d83815481106109a357fe5b906000526020600020906008020160050154603d84815481106109c257fe5b90600052602060002090600802016004015401101590505b919050565b60335481565b60006109ef6114af565b82111580156109fe5750600082115b610a1a5760405162461bcd60e51b815260040161085690612e11565b6000603d8381548110610a2957fe5b906000526020600020906008020190508060020154610a46611c15565b11610a555760009150506109da565b8060030154610a62611c15565b11610a715760019150506109da565b80600501548160040154111580610a9357506035548160050154826004015401105b15610aa25760029150506109da565b600681015460ff1615610ab95760059150506109da565b610ad86034546108c56033548460030154611bf090919063ffffffff16565b610ae0611c15565b10610aef5760069150506109da565b6033546003820154610b0091611bf0565b610b08611c15565b10610b175760049150506109da565b60039150506109da565b60408051808201909152601981527f322e6c6f74746572792d616e642d6761732d7570677261646500000000000000602082015290565b603a5481565b6001600160a01b038381166000908152603c60205260408120549091163314610b995760405162461bcd60e51b815260040161085690612ea1565b610ba4848484611c19565b949350505050565b336000818152603c60205260409020546001600160a01b039081169190831614801590610be257506001600160a01b0382163014155b8015610bf657506001600160a01b03821615155b8015610c145750806001600160a01b0316826001600160a01b031614155b610c305760405162461bcd60e51b815260040161085690612ceb565b6001600160a01b03811615610c76576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f91610d2b9185916004016128c7565b600060405180830381600087803b158015610d4557600080fd5b505af1925050508015610d56575060015b610dd9573d808015610d84576040519150601f19603f3d011682016040523d82523d6000602084013e610d89565b606091505b5080604051610d989190612897565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a350610e0e565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e1782611f67565b5050565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610e615760405162461bcd60e51b815260040161085690612cb4565b6033548110610e825760405162461bcd60e51b815260040161085690612bd8565b603a55565b333014610ea65760405162461bcd60e51b815260040161085690612cb4565b603755565b7f000000000000000000000000000000000000000000000000000000000000000081565b336000908152603c60205260409020546001600160a01b031680610f055760405162461bcd60e51b815260040161085690612e57565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b610f5e610979565b6001600160a01b0316336001600160a01b031614610f8e5760405162461bcd60e51b815260040161085690612dea565b604051633a08bde160e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e822f78490610fda908490600401612f6b565b600060405180830381600087803b158015610ff457600080fd5b505af1158015610960573d6000803e3d6000fd5b3330146110275760405162461bcd60e51b815260040161085690612cb4565b603455565b603b6020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916110ec9185916004016128c7565b600060405180830381600087803b15801561110657600080fd5b505af1925050508015611117575060015b61119a573d808015611145576040519150601f19603f3d011682016040523d82523d6000602084013e61114a565b606091505b50806040516111599190612897565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506111cf565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e178261204b565b60008351116111f95760405162461bcd60e51b815260040161085690612c8a565b611221838383611209863361154f565b15801561121c575061121a86610991565b155b612055565b505050565b3330146112455760405162461bcd60e51b815260040161085690612cb4565b603955565b600054610100900460ff16806112635750611263612298565b80611271575060005460ff16155b61128d5760405162461bcd60e51b815260040161085690612d9c565b600054610100900460ff161580156112b8576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff19909416939093171691909117905561147861229e565b8015610e17576000805461ff00191690555050565b60395481565b60375481565b60006114a6338484611c19565b90505b92915050565b603d546000190190565b6114c16124e9565b603d83815481106114ce57fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b33301461154a5760405162461bcd60e51b815260040161085690612cb4565b603355565b6000603d838154811061155e57fe5b600091825260208083206001600160a01b03861684526007600890930201919091019052604090205460ff16905092915050565b3330146115b15760405162461bcd60e51b815260040161085690612cb4565b603855565b3330146115d55760405162461bcd60e51b815260040161085690612cb4565b603655565b6115e2610979565b6001600160a01b0316336001600160a01b0316146116125760405162461bcd60e51b815260040161085690612dea565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166108fc61164983476122df565b6040518115909202916000818181858888f1935050505061166957600080fd5b50565b6001600160a01b038087166000908152603b60205260409081902054905163e113335f60e01b815288927f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916116cd9185916004016128c7565b600060405180830381600087803b1580156116e757600080fd5b505af19250505080156116f8575060015b61177b573d808015611726576040519150601f19603f3d011682016040523d82523d6000602084013e61172b565b606091505b508060405161173a9190612897565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506117b0565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b6117be8787878787876122f5565b50505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60046117f6826109e5565b600681111561180157fe5b1461181e5760405162461bcd60e51b815260040161085690612a37565b6000603d828154811061182d57fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b031661186881612375565b6118845760405162461bcd60e51b8152600401610856906129f4565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b038516916118c891612897565b600060405180830381855af49150503d8060008114611903576040519150601f19603f3d011682016040523d82523d6000602084013e611908565b606091505b50915091508161194b57805115611933578060405162461bcd60e51b815260040161085691906129e1565b60405162461bcd60e51b815260040161085690612ed8565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b6001611988836109e5565b600681111561199357fe5b146119b05760405162461bcd60e51b815260040161085690612afd565b6000603d83815481106119bf57fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b909452919094205492945010159080611a1e5760405162461bcd60e51b815260040161085690612d22565b825460ff1615611a6d578254610100900460ff1615611a545760018301546004850154611a4a91611bae565b6004850155611a6d565b60018301546005850154611a6791611bae565b60058501555b8415611a8c576004840154611a829082611bf0565b6004850155611aa1565b6005840154611a9b9082611bf0565b60058501555b6006840154610100900460ff16158015611ad15750603954611acf611ac4611c15565b600387015490611bae565b105b15611b15576005840154600485015411158215158114611b135760068501805461ff001916610100179055603a546003860154611b0d91611bf0565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a546003870154611b60938b93611b5b9391926108c592839190611bf0565b61237b565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b584604051611b9d9190612f6b565b60405180910390a450505050505050565b60006114a683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506123b8565b6000828201838110156114a65760405162461bcd60e51b815260040161085690612ba1565b4290565b6001600160a01b0383166000908152603b6020526040812054603654811015611c545760405162461bcd60e51b815260040161085690612b44565b611c5d84612375565b611c795760405162461bcd60e51b815260040161085690612d59565b6001600160a01b0385166000908152603e60205260409020548015611ceb576000611ca3826109e5565b90506001816006811115611cb357fe5b14158015611ccd57506000816006811115611cca57fe5b14155b611ce95760405162461bcd60e51b815260040161085690612a82565b505b6000611cfb6037546108c5611c15565b90506000611d1460385483611bf090919063ffffffff16565b9050611d1e612509565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff19909316929092179490941617905590611ed06114af565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a54929350611f12928d92611b5b9290916108c5919082908a90611bf0565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d604051611f52949392919061298b565b60405180910390a39998505050505050505050565b336000908152603f6020526040902054611f7f611c15565b11611f9c5760405162461bcd60e51b815260040161085690612c1c565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054611fea9183906123b8565b336000818152603b6020526040908190209290925590516391fe357360e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316916391fe357391610fda919085906004016128c7565b61166933826123e4565b3381328214612065576000612069565b6152085b61ffff1681156121d45760005a905060005b885181101561213257600089828151811061209257fe5b6020908102919091018101516001600160a01b038082166000908152603c909352604090922054909250163314806120d257506001600160a01b03811633145b6120ee5760405162461bcd60e51b815260040161085690612ea1565b8615806121025750612100898261154f565b155b61211e5760405162461bcd60e51b815260040161085690612f0f565b612129818a8a61197d565b5060010161207b565b50600061214a6127106108c5856108c55a8790611bae565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce8079061219b90889085906004016128c7565b600060405180830381600087803b1580156121b557600080fd5b505af11580156121c9573d6000803e3d6000fd5b5050505050506117be565b60005b875181101561228e5760008882815181106121ee57fe5b6020908102919091018101516001600160a01b038082166000908152603c9093526040909220549092501633148061222e57506001600160a01b03811633145b61224a5760405162461bcd60e51b815260040161085690612ea1565b85158061225e575061225c888261154f565b155b61227a5760405162461bcd60e51b815260040161085690612f0f565b61228581898961197d565b506001016121d7565b5050505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b60008183106122ee57816114a6565b5090919050565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf9061233190899030908a908a908a908a908a9060040161294a565b600060405180830381600087803b15801561234b57600080fd5b505af115801561235f573d6000803e3d6000fd5b5050505061236d86866123e4565b505050505050565b3b151590565b6001600160a01b0382166000908152603f6020526040902054811115610e17576001600160a01b03919091166000908152603f6020526040902055565b600081848411156123dc5760405162461bcd60e51b815260040161085691906129e1565b505050900390565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd906124389085907f00000000000000000000000000000000000000000000000000000000000000009086906004016128e0565b602060405180830381600087803b15801561245257600080fd5b505af1158015612466573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061248a91906127dc565b6124a65760405162461bcd60e51b815260040161085690612c53565b6001600160a01b0382166000908152603b60205260409020546124c99082611bf0565b6001600160a01b039092166000908152603b602052604090209190915550565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b03811681146114a957600080fd5b80356114a981612fe0565b600082601f830112612596578081fd5b813567ffffffffffffffff8111156125ac578182fd5b6125bf601f8201601f1916602001612f74565b91508082528360208285010111156125d657600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215612600578081fd5b6114a68383612564565b60008060006060848603121561261e578182fd5b833561262981612fcb565b9250602084013561263981612fcb565b9150604084013567ffffffffffffffff811115612654578182fd5b61266086828701612586565b9150509250925092565b6000806040838503121561267c578182fd5b823561268781612fcb565b9150602083013567ffffffffffffffff8111156126a2578182fd5b6126ae85828601612586565b9150509250929050565b60008060008060008060c087890312156126d0578182fd5b6126da8888612564565b95506020870135945060408701359350606087013560ff811681146126fd578283fd5b9598949750929560808101359460a0909101359350915050565b60008060006060848603121561272b578283fd5b833567ffffffffffffffff80821115612742578485fd5b818601915086601f830112612755578485fd5b813581811115612763578586fd5b60209150818102612775838201612f74565b8281528381019085850183870186018c101561278f57898afd5b8996505b848710156127b9576127a58c82612564565b835260019690960195918501918501612793565b50975050505085013592506127d39050856040860161257b565b90509250925092565b6000602082840312156127ed578081fd5b81516114a681612fe0565b600060208284031215612809578081fd5b5035919050565b60008060408385031215612822578182fd5b823591506128338460208501612564565b90509250929050565b6000806040838503121561284e578182fd5b82359150602083013561286081612fe0565b809150509250929050565b60008151808452612883816020860160208601612f9b565b601f01601f19169290920160200192915050565b600082516128a9818460208701612f9b565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b0386168252846020830152836040830152608060608301526129b8608083018461286b565b9695505050505050565b901515815260200190565b60208101600783106129db57fe5b91905290565b6000602082526114a6602083018461286b565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526010908201526f43616e206e6f7420626520656d70747960801b604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252600d908201526c6f6e6c79206d756c746973696760981b604082015260600190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b60208082526019908201527f476f7665726e616e63653a20766f74656420616c726561647900000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b90815260200190565b60405181810167ffffffffffffffff81118282101715612f9357600080fd5b604052919050565b60005b83811015612fb6578181015183820152602001612f9e565b83811115612fc5576000848401525b50505050565b6001600160a01b038116811461166957600080fd5b801515811461166957600080fdfea2646970667358221220e1f35bea256ff1c0e43f98312094903f31941303df43a2edbe8b9bd0fa323c8864736f6c634300060c0033"; +const isSuperArgs$d = (xs) => xs.length > 1; +class GovernanceStakingUpgrade__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$d(args)) { + super(...args); + } else { + super(_abi$e, _bytecode$d, args[0]); + } + } + getDeployTransaction(stakingRewardsAddress, gasCompLogic, userVaultAddress, overrides) { + return super.getDeployTransaction( + stakingRewardsAddress, + gasCompLogic, + userVaultAddress, + overrides || {} + ); + } + deploy(stakingRewardsAddress, gasCompLogic, userVaultAddress, overrides) { + return super.deploy( + stakingRewardsAddress, + gasCompLogic, + userVaultAddress, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$d; + static abi = _abi$e; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$e); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$e, + runner + ); + } +} + +var index$8 = /*#__PURE__*/Object.freeze({ + __proto__: null, + GovernanceStakingUpgrade__factory: GovernanceStakingUpgrade__factory, + interfaces: index$9 +}); + +const _abi$d = [ + { + inputs: [ + { + internalType: "bytes32", + name: "salt", + type: "bytes32" + }, + { + internalType: "address", + name: "implementationContract", + type: "address" + }, + { + internalType: "bytes", + name: "metamorphicContractInitializationCalldata", + type: "bytes" + } + ], + name: "deployMetamorphicContractFromExistingImplementation", + outputs: [ + { + internalType: "address", + name: "metamorphicContractAddress", + type: "address" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "salt", + type: "bytes32" + } + ], + name: "findMetamorphicContractAddress", + outputs: [ + { + internalType: "address", + name: "metamorphicContractAddress", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IMetamorphicContractFactory__factory { + static abi = _abi$d; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$d); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$d, + runner + ); + } +} + +var index$7 = /*#__PURE__*/Object.freeze({ + __proto__: null, + IMetamorphicContractFactory__factory: IMetamorphicContractFactory__factory +}); + +const _abi$c = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "num", + type: "uint256" + } + ], + name: "MockExecuted", + type: "event" + }, + { + inputs: [], + name: "emergencyStop", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "executeProposal", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$c = "0x608060405234801561001057600080fd5b5060c08061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c8063373058b814603757806363a599a414603f575b600080fd5b603d6045565b005b603d607d565b7f2ff532ec74fd1130db9b7b6800e0992b2363095b00331a891a27edfab97c45406001604051607391906081565b60405180910390a1565b6000ff5b9081526020019056fea264697066735822122018779fa63005d6573862657b4a5cd55f75b705b28a7ff69222461665b78f408a64736f6c634300060c0033"; +const isSuperArgs$c = (xs) => xs.length > 1; +class InitialProposal__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$c(args)) { + super(...args); + } else { + super(_abi$c, _bytecode$c, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$c; + static abi = _abi$c; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$c); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$c, runner); + } +} + +const _abi$b = [ + { + inputs: [], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "num", + type: "uint256" + } + ], + name: "MockExecuted", + type: "event" + }, + { + inputs: [], + name: "deployer", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "emergencyStop", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "executeProposal", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$b = "0x60a060405234801561001057600080fd5b5033606081901b6080526102746100366000398061012952806101b052506102746000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063373058b81461004657806363a599a414610050578063d5f3948814610058575b600080fd5b61004e610076565b005b61004e6101aa565b6100606101ae565b60405161006d9190610211565b60405180910390f35b6040516370a0823160e01b81527377777feddddffc19ff86db637967013e6c6a116c9060009082906370a08231906100b2903090600401610211565b60206040518083038186803b1580156100ca57600080fd5b505afa1580156100de573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010291906101f9565b60405163a9059cbb60e01b81529091506001600160a01b0383169063a9059cbb90610153907f0000000000000000000000000000000000000000000000000000000000000000908590600401610225565b602060405180830381600087803b15801561016d57600080fd5b505af1158015610181573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a591906101d2565b505050565b6000ff5b7f000000000000000000000000000000000000000000000000000000000000000081565b6000602082840312156101e3578081fd5b815180151581146101f2578182fd5b9392505050565b60006020828403121561020a578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b0392909216825260208201526040019056fea2646970667358221220c120adf2a3856eb39e4d2305abf19175fb5f11d87cd96e5c70ce2a9f702ba53664736f6c634300060c0033"; +const isSuperArgs$b = (xs) => xs.length > 1; +class MaliciousProposal__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$b(args)) { + super(...args); + } else { + super(_abi$b, _bytecode$b, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$b; + static abi = _abi$b; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$b); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$b, runner); + } +} + +var index$6 = /*#__PURE__*/Object.freeze({ + __proto__: null, + InitialProposal__factory: InitialProposal__factory, + MaliciousProposal__factory: MaliciousProposal__factory +}); + +var index$5 = /*#__PURE__*/Object.freeze({ + __proto__: null, + mockProposalsSol: index$6 +}); + +const _abi$a = [ + { + inputs: [ + { + internalType: "address", + name: "_logic", + type: "address" + }, + { + internalType: "address", + name: "_admin", + type: "address" + }, + { + internalType: "bytes", + name: "_data", + type: "bytes" + } + ], + stateMutability: "payable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "previousAdmin", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "AdminChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "implementation", + type: "address" + } + ], + name: "Upgraded", + type: "event" + }, + { + stateMutability: "payable", + type: "fallback" + }, + { + inputs: [], + name: "admin", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "changeAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "implementation", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + } + ], + name: "upgradeTo", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "upgradeToAndCall", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$a = "0x60806040526040516108403803806108408339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508390508282816100f1826101c5565b8051156101a9576000826001600160a01b0316826040518082805190602001908083835b602083106101345780518252601f199092019160209182019101610115565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610194576040519150601f19603f3d011682016040523d82523d6000602084013e610199565b606091505b50509050806101a757600080fd5b505b506101b19050565b6101ba82610237565b505050505050610261565b6101d88161025b60201b6103b41760201c565b6102135760405162461bcd60e51b815260040180806020018281038252603681526020018061080a6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3b151590565b61059a806102706000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996101a9565b6101a96101a46103ba565b6103df565b565b6101b3610403565b6001600160a01b0316336001600160a01b031614156101da576101d581610428565b6101e2565b6101e2610191565b50565b6101ed610403565b6001600160a01b0316336001600160a01b031614156102855761020f83610428565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610403565b6001600160a01b0316336001600160a01b031614156102c4576102bd6103ba565b90506102cc565b6102cc610191565b90565b6102d7610403565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b815260040180806020018281038252603a8152602001806104f5603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610403565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d581610468565b6000610393610403565b6001600160a01b0316336001600160a01b031614156102c4576102bd610403565b3b151590565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156103fe573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6104318161048c565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610495816103b4565b6104d05760405162461bcd60e51b815260040180806020018281038252603681526020018061052f6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374a26469706673582212203c0c6456361fbff816ff53c5547d39ad0e807130f877d2661772f7bffc95b82764736f6c634300060c00335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374"; +const isSuperArgs$a = (xs) => xs.length > 1; +let AdminUpgradeableProxy__factory$1 = class AdminUpgradeableProxy__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$a(args)) { + super(...args); + } else { + super(_abi$a, _bytecode$a, args[0]); + } + } + getDeployTransaction(_logic, _admin, _data, overrides) { + return super.getDeployTransaction(_logic, _admin, _data, overrides || {}); + } + deploy(_logic, _admin, _data, overrides) { + return super.deploy(_logic, _admin, _data, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$a; + static abi = _abi$a; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$a); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$a, + runner + ); + } +}; + +const _abi$9 = [ + { + inputs: [ + { + internalType: "address", + name: "stakingRewardsAddress", + type: "address" + }, + { + internalType: "address", + name: "gasCompLogic", + type: "address" + }, + { + internalType: "address", + name: "userVaultAddress", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + } + ], + name: "Delegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "proposer", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + indexed: false, + internalType: "string", + name: "description", + type: "string" + } + ], + name: "ProposalCreated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "ProposalExecuted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "bytes", + name: "errorData", + type: "bytes" + } + ], + name: "RewardUpdateFailed", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + } + ], + name: "RewardUpdateSuccessful", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + } + ], + name: "Undelegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "voter", + type: "address" + }, + { + indexed: true, + internalType: "bool", + name: "support", + type: "bool" + }, + { + indexed: false, + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + name: "Voted", + type: "event" + }, + { + inputs: [], + name: "CLOSING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_EXPIRATION", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PROPOSAL_THRESHOLD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "QUORUM_VOTES", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "Staking", + outputs: [ + { + internalType: "contract ITornadoStakingRewards", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTE_EXTEND_TIME", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "canWithdrawAfter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "from", + type: "address[]" + }, + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castDelegatedVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "checkIfQuorumReached", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + } + ], + name: "delegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "delegatedTo", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "execute", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "gasCompensationVault", + outputs: [ + { + internalType: "contract IGasCompensationVault", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "voter", + type: "address" + } + ], + name: "getReceipt", + outputs: [ + { + components: [ + { + internalType: "bool", + name: "hasVoted", + type: "bool" + }, + { + internalType: "bool", + name: "support", + type: "bool" + }, + { + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + internalType: "struct Governance.Receipt", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "hasAccountVoted", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "latestProposalIds", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "lock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "lockWithApproval", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "lockedBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "proposalCodehashes", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "proposalCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "proposals", + outputs: [ + { + internalType: "address", + name: "proposer", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "forVotes", + type: "uint256" + }, + { + internalType: "uint256", + name: "againstVotes", + type: "uint256" + }, + { + internalType: "bool", + name: "executed", + type: "bool" + }, + { + internalType: "bool", + name: "extended", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "propose", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "proposeByDelegate", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "returnMultisigAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "closingPeriod", + type: "uint256" + } + ], + name: "setClosingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionDelay", + type: "uint256" + } + ], + name: "setExecutionDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionExpiration", + type: "uint256" + } + ], + name: "setExecutionExpiration", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "gasCompensationsLimit", + type: "uint256" + } + ], + name: "setGasCompensations", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalThreshold", + type: "uint256" + } + ], + name: "setProposalThreshold", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "quorumVotes", + type: "uint256" + } + ], + name: "setQuorumVotes", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "voteExtendTime", + type: "uint256" + } + ], + name: "setVoteExtendTime", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingDelay", + type: "uint256" + } + ], + name: "setVotingDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingPeriod", + type: "uint256" + } + ], + name: "setVotingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "state", + outputs: [ + { + internalType: "enum Governance.ProposalState", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract TORN", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "undelegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "unlock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "userVault", + outputs: [ + { + internalType: "contract ITornadoVault", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "version", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdrawFromHelper", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$9 = "0x60e06040523480156200001157600080fd5b50604051620034343803806200343483398101604081905262000034916200016b565b82828281818181600060019054906101000a900460ff16806200005c57506200005c62000124565b806200006b575060005460ff16155b620000935760405162461bcd60e51b81526004016200008a90620001be565b60405180910390fd5b600054610100900460ff16158015620000bf576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000dd6200012a565b8015620000f0576000805461ff00191690555b506001600160601b0319606091821b811660805291811b821660a0529590951b90941660c052506200022595505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b60008060006060848603121562000180578283fd5b83516200018d816200020c565b6020850151909350620001a0816200020c565b6040850151909250620001b3816200020c565b809150509250925092565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6001600160a01b03811681146200022257600080fd5b50565b60805160601c60a05160601c60c05160601c6131ac6200028860003980610d1352806110d452806116c752806117f85250806109105280610eca5280610fc252806116435280611d6d52508061105d5280611c1652806124f152506131ac6000f3fe6080604052600436106102815760003560e01c80639daafec71161014f578063d6f0948c116100c1578063ea0217cf1161007a578063ea0217cf14610755578063ece40cc114610775578063ef3f8bb114610795578063f0b76892146107b5578063f57df22e146107d5578063fe0d94c1146107ea57610288565b8063d6f0948c14610693578063da35c664146106b3578063e01f5237146106c8578063e23a9a52146106e8578063e4917d9f14610715578063e525aa081461073557610288565b8063b54426c811610113578063b54426c8146105e9578063b859f11b14610609578063c0c0e82014610629578063c4d66de814610649578063ce25d71c14610669578063d6159fe51461067e57610288565b80639daafec714610575578063a6c266031461058a578063a72edda31461059f578063adf898a4146105bf578063b1610d7e146105d457610288565b80635c19a95c116101f357806370b0f660116101ac57806370b0f660146104cb5780638b34a960146104eb57806392ab89bb14610500578063932d5157146105155780639a9e3b6e146105355780639ae697bf1461055557610288565b80635c19a95c146104215780636198e3391461044157806365da126414610461578063671dd275146104815780636a661755146104965780636dc2dc6c146104ab57610288565b806332687ec11161024557806332687ec11461035b57806337f135d7146103885780633e4f49e61461039d57806354fd4d50146103ca578063587a6ecb146103ec57806358e9fff01461040157610288565b8063013cf08b1461028d57806302ec8f9e146102ca57806315373e3d146102ec57806317977c611461030c57806324b0435f1461033957610288565b3661028857005b600080fd5b34801561029957600080fd5b506102ad6102a83660046128e1565b6107fd565b6040516102c19897969594939291906129ed565b60405180910390f35b3480156102d657600080fd5b506102ea6102e53660046128e1565b610862565b005b3480156102f857600080fd5b506102ea610307366004612925565b61088f565b34801561031857600080fd5b5061032c6103273660046126d8565b610992565b6040516102c19190612ab6565b34801561034557600080fd5b5061034e6109a4565b6040516102c1919061299c565b34801561036757600080fd5b5061037b6103763660046128e1565b6109bc565b6040516102c19190612aab565b34801561039457600080fd5b5061032c610a0a565b3480156103a957600080fd5b506103bd6103b83660046128e1565b610a10565b6040516102c19190612abf565b3480156103d657600080fd5b506103df610b4c565b6040516102c19190612ad3565b3480156103f857600080fd5b5061032c610b75565b34801561040d57600080fd5b5061032c61041c3660046126f3565b610b7b565b34801561042d57600080fd5b506102ea61043c3660046126d8565b610bc9565b34801561044d57600080fd5b506102ea61045c3660046128e1565b610ceb565b34801561046d57600080fd5b5061034e61047c3660046126d8565b610e38565b34801561048d57600080fd5b5061032c610e53565b3480156104a257600080fd5b5061032c610e59565b3480156104b757600080fd5b506102ea6104c63660046128e1565b610e5f565b3480156104d757600080fd5b506102ea6104e63660046128e1565b610ea4565b3480156104f757600080fd5b5061034e610ec8565b34801561050c57600080fd5b506102ea610eec565b34801561052157600080fd5b506102ea6105303660046128e1565b610f73565b34801561054157600080fd5b506102ea6105503660046128e1565b611025565b34801561056157600080fd5b5061032c6105703660046126d8565b611049565b34801561058157600080fd5b5061034e61105b565b34801561059657600080fd5b5061032c61107f565b3480156105ab57600080fd5b5061032c6105ba3660046126d8565b611085565b3480156105cb57600080fd5b5061034e611097565b3480156105e057600080fd5b5061032c6110a6565b3480156105f557600080fd5b506102ea6106043660046128e1565b6110ac565b34801561061557600080fd5b506102ea610624366004612800565b6111f5565b34801561063557600080fd5b506102ea6106443660046128e1565b611243565b34801561065557600080fd5b506102ea6106643660046126d8565b611267565b34801561067557600080fd5b5061032c6114aa565b34801561068a57600080fd5b5061032c6114b0565b34801561069f57600080fd5b5061032c6106ae366004612753565b6114b6565b3480156106bf57600080fd5b5061032c6114cc565b3480156106d457600080fd5b5061032c6106e33660046128e1565b6114d6565b3480156106f457600080fd5b506107086107033660046128f9565b6114e8565b6040516102c191906130db565b34801561072157600080fd5b506102ea6107303660046128e1565b61155a565b34801561074157600080fd5b5061037b6107503660046128f9565b61157e565b34801561076157600080fd5b506102ea6107703660046128e1565b6115c1565b34801561078157600080fd5b506102ea6107903660046128e1565b6115e5565b3480156107a157600080fd5b506102ea6107b03660046128e1565b611609565b3480156107c157600080fd5b506102ea6107d03660046127a1565b61169b565b3480156107e157600080fd5b5061034e6117f6565b6102ea6107f83660046128e1565b61181a565b603d818154811061080a57fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b33301461088a5760405162461bcd60e51b815260040161088190612e49565b60405180910390fd5b603555565b3361089a833361157e565b1580156108ad57506108ab836109bc565b155b3332146108bb5760006108bf565b6152085b61ffff1681156109805760005a90506108d93387876118ac565b60006108f66127106108f0856108f05a8790611add565b90611b1f565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce8079061094790889085906004016129b0565b600060405180830381600087803b15801561096157600080fd5b505af1158015610975573d6000803e3d6000fd5b50505050505061098b565b61098b3386866118ac565b5050505050565b603e6020526000908152604090205481565b73b04e030140b30c27bcdfaafffa98c57d80eda7b490565b6000603554603d83815481106109ce57fe5b906000526020600020906008020160050154603d84815481106109ed57fe5b90600052602060002090600802016004015401101590505b919050565b60335481565b6000610a1a6114cc565b8211158015610a295750600082115b610a455760405162461bcd60e51b815260040161088190612fa6565b6000603d8381548110610a5457fe5b906000526020600020906008020190508060020154610a71611b44565b11610a80576000915050610a05565b8060030154610a8d611b44565b11610a9c576001915050610a05565b80600501548160040154111580610abe57506035548160050154826004015401105b15610acd576002915050610a05565b600681015460ff1615610ae4576005915050610a05565b610b036034546108f06033548460030154611b1f90919063ffffffff16565b610b0b611b44565b10610b1a576006915050610a05565b6033546003820154610b2b91611b1f565b610b33611b44565b10610b42576004915050610a05565b6003915050610a05565b60408051808201909152600f81526e0d0b9c185d18da0b595e1c1b1bda5d608a1b602082015290565b603a5481565b6001600160a01b038381166000908152603c60205260408120549091163314610bb65760405162461bcd60e51b815260040161088190613036565b610bc1848484611b48565b949350505050565b336000818152603c60205260409020546001600160a01b039081169190831614801590610bff57506001600160a01b0382163014155b8015610c1357506001600160a01b03821615155b8015610c315750806001600160a01b0316826001600160a01b031614155b610c4d5760405162461bcd60e51b815260040161088190612e80565b6001600160a01b03811615610c93576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f91610d489185916004016129b0565b600060405180830381600087803b158015610d6257600080fd5b505af1925050508015610d73575060015b610df6573d808015610da1576040519150601f19603f3d011682016040523d82523d6000602084013e610da6565b606091505b5080604051610db59190612980565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a350610e2b565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e3482611b70565b5050565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610e7e5760405162461bcd60e51b815260040161088190612e49565b6033548110610e9f5760405162461bcd60e51b815260040161088190612d6d565b603a55565b333014610ec35760405162461bcd60e51b815260040161088190612e49565b603755565b7f000000000000000000000000000000000000000000000000000000000000000081565b336000908152603c60205260409020546001600160a01b031680610f225760405162461bcd60e51b815260040161088190612fec565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b610f7b6109a4565b6001600160a01b0316336001600160a01b031614610fab5760405162461bcd60e51b815260040161088190612f7f565b604051633a08bde160e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e822f78490610ff7908490600401612ab6565b600060405180830381600087803b15801561101157600080fd5b505af115801561098b573d6000803e3d6000fd5b3330146110445760405162461bcd60e51b815260040161088190612e49565b603455565b603b6020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916111099185916004016129b0565b600060405180830381600087803b15801561112357600080fd5b505af1925050508015611134575060015b6111b7573d808015611162576040519150601f19603f3d011682016040523d82523d6000602084013e611167565b606091505b50806040516111769190612980565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506111ec565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e3482611c54565b60008351116112165760405162461bcd60e51b815260040161088190612e1f565b61123e838383611226863361157e565b1580156112395750611237866109bc565b155b611c5e565b505050565b3330146112625760405162461bcd60e51b815260040161088190612e49565b603955565b600054610100900460ff16806112805750611280611ea1565b8061128e575060005460ff16155b6112aa5760405162461bcd60e51b815260040161088190612f31565b600054610100900460ff161580156112d5576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff199094169390931716919091179055611495611ea7565b8015610e34576000805461ff00191690555050565b60395481565b60375481565b60006114c3338484611b48565b90505b92915050565b603d546000190190565b60416020526000908152604090205481565b6114f06125d2565b603d83815481106114fd57fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b3330146115795760405162461bcd60e51b815260040161088190612e49565b603355565b6000603d838154811061158d57fe5b600091825260208083206001600160a01b03861684526007600890930201919091019052604090205460ff16905092915050565b3330146115e05760405162461bcd60e51b815260040161088190612e49565b603855565b3330146116045760405162461bcd60e51b815260040161088190612e49565b603655565b6116116109a4565b6001600160a01b0316336001600160a01b0316146116415760405162461bcd60e51b815260040161088190612f7f565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166108fc6116788347611ee8565b6040518115909202916000818181858888f1935050505061169857600080fd5b50565b6001600160a01b038087166000908152603b60205260409081902054905163e113335f60e01b815288927f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916116fc9185916004016129b0565b600060405180830381600087803b15801561171657600080fd5b505af1925050508015611727575060015b6117aa573d808015611755576040519150601f19603f3d011682016040523d82523d6000602084013e61175a565b606091505b50806040516117699190612980565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506117df565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b6117ed878787878787611efe565b50505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b3330141561183a5760405162461bcd60e51b815260040161088190612c36565b6000603d828154811061184957fe5b6000918252602080832060016008909302019182015485845260419091526040909220549092506001600160a01b0390911690813f90811461189d5760405162461bcd60e51b815260040161088190612d17565b6118a684611f7e565b50505050565b60016118b783610a10565b60068111156118c257fe5b146118df5760405162461bcd60e51b815260040161088190612bef565b6000603d83815481106118ee57fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b90945291909420549294501015908061194d5760405162461bcd60e51b815260040161088190612eb7565b825460ff161561199c578254610100900460ff1615611983576001830154600485015461197991611add565b600485015561199c565b6001830154600585015461199691611add565b60058501555b84156119bb5760048401546119b19082611b1f565b60048501556119d0565b60058401546119ca9082611b1f565b60058501555b6006840154610100900460ff16158015611a0057506039546119fe6119f3611b44565b600387015490611add565b105b15611a44576005840154600485015411158215158114611a425760068501805461ff001916610100179055603a546003860154611a3c91611b1f565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a546003870154611a8f938b93611a8a9391926108f092839190611b1f565b612110565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b584604051611acc9190612ab6565b60405180910390a450505050505050565b60006114c383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061214d565b6000828201838110156114c35760405162461bcd60e51b815260040161088190612ce0565b4290565b6000611b55848484612179565b6000818152604160205260409020933f909355509092915050565b336000908152603f6020526040902054611b88611b44565b11611ba55760405162461bcd60e51b815260040161088190612db1565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054611bf391839061214d565b336000818152603b6020526040908190209290925590516391fe357360e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316916391fe357391610ff7919085906004016129b0565b61169833826124c7565b3381328214611c6e576000611c72565b6152085b61ffff168115611ddd5760005a905060005b8851811015611d3b576000898281518110611c9b57fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611cdb57506001600160a01b03811633145b611cf75760405162461bcd60e51b815260040161088190613036565b861580611d0b5750611d09898261157e565b155b611d275760405162461bcd60e51b8152600401610881906130a4565b611d32818a8a6118ac565b50600101611c84565b506000611d536127106108f0856108f05a8790611add565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce80790611da490889085906004016129b0565b600060405180830381600087803b158015611dbe57600080fd5b505af1158015611dd2573d6000803e3d6000fd5b5050505050506117ed565b60005b8751811015611e97576000888281518110611df757fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611e3757506001600160a01b03811633145b611e535760405162461bcd60e51b815260040161088190613036565b851580611e675750611e65888261157e565b155b611e835760405162461bcd60e51b8152600401610881906130a4565b611e8e8189896118ac565b50600101611de0565b5050505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6000818310611ef757816114c3565b5090919050565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf90611f3a90899030908a908a908a908a908a90600401612a33565b600060405180830381600087803b158015611f5457600080fd5b505af1158015611f68573d6000803e3d6000fd5b50505050611f7686866124c7565b505050505050565b6004611f8982610a10565b6006811115611f9457fe5b14611fb15760405162461bcd60e51b815260040161088190612b29565b6000603d8281548110611fc057fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b0316611ffb816125cc565b6120175760405162461bcd60e51b815260040161088190612ae6565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b0385169161205b91612980565b600060405180830381855af49150503d8060008114612096576040519150601f19603f3d011682016040523d82523d6000602084013e61209b565b606091505b5091509150816120de578051156120c6578060405162461bcd60e51b81526004016108819190612ad3565b60405162461bcd60e51b81526004016108819061306d565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b6001600160a01b0382166000908152603f6020526040902054811115610e34576001600160a01b03919091166000908152603f6020526040902055565b600081848411156121715760405162461bcd60e51b81526004016108819190612ad3565b505050900390565b6001600160a01b0383166000908152603b60205260408120546036548110156121b45760405162461bcd60e51b815260040161088190612c83565b6121bd846125cc565b6121d95760405162461bcd60e51b815260040161088190612eee565b6001600160a01b0385166000908152603e6020526040902054801561224b57600061220382610a10565b9050600181600681111561221357fe5b1415801561222d5750600081600681111561222a57fe5b14155b6122495760405162461bcd60e51b815260040161088190612b74565b505b600061225b6037546108f0611b44565b9050600061227460385483611b1f90919063ffffffff16565b905061227e6125f2565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff199093169290921794909416179055906124306114cc565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a54929350612472928d92611a8a9290916108f0919082908a90611b1f565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d6040516124b29493929190612a74565b60405180910390a39998505050505050505050565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd9061251b9085907f00000000000000000000000000000000000000000000000000000000000000009086906004016129c9565b602060405180830381600087803b15801561253557600080fd5b505af1158015612549573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061256d91906128c5565b6125895760405162461bcd60e51b815260040161088190612de8565b6001600160a01b0382166000908152603b60205260409020546125ac9082611b1f565b6001600160a01b039092166000908152603b602052604090209190915550565b3b151590565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b03811681146114c657600080fd5b80356114c681613168565b600082601f83011261267f578081fd5b813567ffffffffffffffff811115612695578182fd5b6126a8601f8201601f1916602001613100565b91508082528360208285010111156126bf57600080fd5b8060208401602084013760009082016020015292915050565b6000602082840312156126e9578081fd5b6114c3838361264d565b600080600060608486031215612707578182fd5b833561271281613153565b9250602084013561272281613153565b9150604084013567ffffffffffffffff81111561273d578182fd5b6127498682870161266f565b9150509250925092565b60008060408385031215612765578182fd5b823561277081613153565b9150602083013567ffffffffffffffff81111561278b578182fd5b6127978582860161266f565b9150509250929050565b60008060008060008060c087890312156127b9578182fd5b6127c3888861264d565b95506020870135945060408701359350606087013560ff811681146127e6578283fd5b9598949750929560808101359460a0909101359350915050565b600080600060608486031215612814578283fd5b833567ffffffffffffffff8082111561282b578485fd5b818601915086601f83011261283e578485fd5b81358181111561284c578586fd5b6020915081810261285e838201613100565b8281528381019085850183870186018c101561287857898afd5b8996505b848710156128a25761288e8c8261264d565b83526001969096019591850191850161287c565b50975050505085013592506128bc90508560408601612664565b90509250925092565b6000602082840312156128d6578081fd5b81516114c381613168565b6000602082840312156128f2578081fd5b5035919050565b6000806040838503121561290b578182fd5b8235915061291c846020850161264d565b90509250929050565b60008060408385031215612937578182fd5b82359150602083013561294981613168565b809150509250929050565b6000815180845261296c816020860160208601613127565b601f01601f19169290920160200192915050565b60008251612992818460208701613127565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b038616825284602083015283604083015260806060830152612aa16080830184612954565b9695505050505050565b901515815260200190565b90815260200190565b6020810160078310612acd57fe5b91905290565b6000602082526114c36020830184612954565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252602d908201527f476f7665726e616e63653a3a70726f706f73653a2070736575646f2d6578746560408201526c393730b610333ab731ba34b7b760991b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526036908201527f476f7665726e616e63653a3a70726f706f73653a206d6574616d6f72706869636040820152750818dbdb9d1c9858dd1cc81b9bdd08185b1b1bddd95960521b606082015260800190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526010908201526f43616e206e6f7420626520656d70747960801b604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252600d908201526c6f6e6c79206d756c746973696760981b604082015260600190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b60208082526019908201527f476f7665726e616e63653a20766f74656420616c726561647900000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b60405181810167ffffffffffffffff8111828210171561311f57600080fd5b604052919050565b60005b8381101561314257818101518382015260200161312a565b838111156118a65750506000910152565b6001600160a01b038116811461169857600080fd5b801515811461169857600080fdfea2646970667358221220b75004153b6c8b4905c018daca78cb0fa6d3859298be55252bcf6ba75ea68d0e64736f6c634300060c0033"; +const isSuperArgs$9 = (xs) => xs.length > 1; +class GovernanceExploitPatchUpgrade__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$9(args)) { + super(...args); + } else { + super(_abi$9, _bytecode$9, args[0]); + } + } + getDeployTransaction(stakingRewardsAddress, gasCompLogic, userVaultAddress, overrides) { + return super.getDeployTransaction( + stakingRewardsAddress, + gasCompLogic, + userVaultAddress, + overrides || {} + ); + } + deploy(stakingRewardsAddress, gasCompLogic, userVaultAddress, overrides) { + return super.deploy( + stakingRewardsAddress, + gasCompLogic, + userVaultAddress, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$9; + static abi = _abi$9; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$9); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$9, + runner + ); + } +} + +const _abi$8 = [ + { + inputs: [ + { + internalType: "address", + name: "_deployedStakingProxyContractAddress", + type: "address" + }, + { + internalType: "address", + name: "_deployedRelayerRegistryImplementationAddress", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "TORN", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "deployedRelayerRegistryImplementationAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "deployedStakingProxyContractAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "executeProposal", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "gasCompensationVaultAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "governanceProxyAddress", + outputs: [ + { + internalType: "address payable", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "oldStakingProxyAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "registryProxyAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "userVaultAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$8 = "0x60c060405234801561001057600080fd5b50604051613adb380380613adb83398101604081905261002f9161004d565b6001600160601b0319606092831b8116608052911b1660a05261009e565b6000806040838503121561005f578182fd5b825161006a81610086565b602084015190925061007b81610086565b809150509250929050565b6001600160a01b038116811461009b57600080fd5b50565b60805160601c60a05160601c613a056100d66000398061027a52806104985250806102f952806103f452806104bc5250613a056000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063373058b811610066578063373058b8146100ce5780634655478f146100d857806361697d64146100e05780636fc6091d146100e85780639b49989a146100f057610093565b80630cc784761461009857806313f32237146100b657806324044543146100be57806332bf1039146100c6575b600080fd5b6100a06100f8565b6040516100ad9190610542565b60405180910390f35b6100a0610110565b6100a0610128565b6100a0610140565b6100d6610158565b005b6100a061047e565b6100a0610496565b6100a06104ba565b6100a06104de565b7358e8dcc13be9780fc42e8723d8ead4cf46943df281565b732fc93484614a34f26f7970cbb94615ba109bb4bf81565b73fa4c1f3f7d5dd7c12a9adb82cd7dda542e3d59ef81565b7377777feddddffc19ff86db637967013e6c6a116c81565b6040516370a0823160e01b8152732fc93484614a34f26f7970cbb94615ba109bb4bf90819063f58073b1907377777feddddffc19ff86db637967013e6c6a116c906370a08231906101ad908590600401610542565b60206040518083038186803b1580156101c557600080fd5b505afa1580156101d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fd919061052a565b6040518263ffffffff1660e01b81526004016102199190610592565b600060405180830381600087803b15801561023357600080fd5b505af1158015610247573d6000803e3d6000fd5b5050604051631b2ce7f360e11b81527358e8dcc13be9780fc42e8723d8ead4cf46943df29250633659cfe691506102a2907f000000000000000000000000000000000000000000000000000000000000000090600401610542565b600060405180830381600087803b1580156102bc57600080fd5b505af11580156102d0573d6000803e3d6000fd5b50505050735efda50f22d34f262c29268506c5fa42cb56a1ce6001600160a01b0316633659cfe67f000000000000000000000000000000000000000000000000000000000000000073fa4c1f3f7d5dd7c12a9adb82cd7dda542e3d59ef732f50508a8a3d323b91336fa3ea6ae50e55f3218560405161034e906104f6565b61035a93929190610556565b604051809103906000f080158015610376573d6000803e3d6000fd5b506040518263ffffffff1660e01b81526004016103939190610542565b600060405180830381600087803b1580156103ad57600080fd5b505af11580156103c1573d6000803e3d6000fd5b505060405163a9059cbb60e01b81527377777feddddffc19ff86db637967013e6c6a116c925063a9059cbb9150610428907f0000000000000000000000000000000000000000000000000000000000000000906913ecbccf7737e6b0000090600401610579565b602060405180830381600087803b15801561044257600080fd5b505af1158015610456573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047a9190610503565b5050565b735efda50f22d34f262c29268506c5fa42cb56a1ce81565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b732f50508a8a3d323b91336fa3ea6ae50e55f3218581565b6134348061059c83390190565b600060208284031215610514578081fd5b81518015158114610523578182fd5b9392505050565b60006020828403121561053b578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b0393841681529183166020830152909116604082015260600190565b6001600160a01b03929092168252602082015260400190565b9081526020019056fe60e06040523480156200001157600080fd5b50604051620034343803806200343483398101604081905262000034916200016b565b82828281818181600060019054906101000a900460ff16806200005c57506200005c62000124565b806200006b575060005460ff16155b620000935760405162461bcd60e51b81526004016200008a90620001be565b60405180910390fd5b600054610100900460ff16158015620000bf576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000dd6200012a565b8015620000f0576000805461ff00191690555b506001600160601b0319606091821b811660805291811b821660a0529590951b90941660c052506200022595505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b60008060006060848603121562000180578283fd5b83516200018d816200020c565b6020850151909350620001a0816200020c565b6040850151909250620001b3816200020c565b809150509250925092565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6001600160a01b03811681146200022257600080fd5b50565b60805160601c60a05160601c60c05160601c6131ac6200028860003980610d1352806110d452806116c752806117f85250806109105280610eca5280610fc252806116435280611d6d52508061105d5280611c1652806124f152506131ac6000f3fe6080604052600436106102815760003560e01c80639daafec71161014f578063d6f0948c116100c1578063ea0217cf1161007a578063ea0217cf14610755578063ece40cc114610775578063ef3f8bb114610795578063f0b76892146107b5578063f57df22e146107d5578063fe0d94c1146107ea57610288565b8063d6f0948c14610693578063da35c664146106b3578063e01f5237146106c8578063e23a9a52146106e8578063e4917d9f14610715578063e525aa081461073557610288565b8063b54426c811610113578063b54426c8146105e9578063b859f11b14610609578063c0c0e82014610629578063c4d66de814610649578063ce25d71c14610669578063d6159fe51461067e57610288565b80639daafec714610575578063a6c266031461058a578063a72edda31461059f578063adf898a4146105bf578063b1610d7e146105d457610288565b80635c19a95c116101f357806370b0f660116101ac57806370b0f660146104cb5780638b34a960146104eb57806392ab89bb14610500578063932d5157146105155780639a9e3b6e146105355780639ae697bf1461055557610288565b80635c19a95c146104215780636198e3391461044157806365da126414610461578063671dd275146104815780636a661755146104965780636dc2dc6c146104ab57610288565b806332687ec11161024557806332687ec11461035b57806337f135d7146103885780633e4f49e61461039d57806354fd4d50146103ca578063587a6ecb146103ec57806358e9fff01461040157610288565b8063013cf08b1461028d57806302ec8f9e146102ca57806315373e3d146102ec57806317977c611461030c57806324b0435f1461033957610288565b3661028857005b600080fd5b34801561029957600080fd5b506102ad6102a83660046128e1565b6107fd565b6040516102c19897969594939291906129ed565b60405180910390f35b3480156102d657600080fd5b506102ea6102e53660046128e1565b610862565b005b3480156102f857600080fd5b506102ea610307366004612925565b61088f565b34801561031857600080fd5b5061032c6103273660046126d8565b610992565b6040516102c19190612ab6565b34801561034557600080fd5b5061034e6109a4565b6040516102c1919061299c565b34801561036757600080fd5b5061037b6103763660046128e1565b6109bc565b6040516102c19190612aab565b34801561039457600080fd5b5061032c610a0a565b3480156103a957600080fd5b506103bd6103b83660046128e1565b610a10565b6040516102c19190612abf565b3480156103d657600080fd5b506103df610b4c565b6040516102c19190612ad3565b3480156103f857600080fd5b5061032c610b75565b34801561040d57600080fd5b5061032c61041c3660046126f3565b610b7b565b34801561042d57600080fd5b506102ea61043c3660046126d8565b610bc9565b34801561044d57600080fd5b506102ea61045c3660046128e1565b610ceb565b34801561046d57600080fd5b5061034e61047c3660046126d8565b610e38565b34801561048d57600080fd5b5061032c610e53565b3480156104a257600080fd5b5061032c610e59565b3480156104b757600080fd5b506102ea6104c63660046128e1565b610e5f565b3480156104d757600080fd5b506102ea6104e63660046128e1565b610ea4565b3480156104f757600080fd5b5061034e610ec8565b34801561050c57600080fd5b506102ea610eec565b34801561052157600080fd5b506102ea6105303660046128e1565b610f73565b34801561054157600080fd5b506102ea6105503660046128e1565b611025565b34801561056157600080fd5b5061032c6105703660046126d8565b611049565b34801561058157600080fd5b5061034e61105b565b34801561059657600080fd5b5061032c61107f565b3480156105ab57600080fd5b5061032c6105ba3660046126d8565b611085565b3480156105cb57600080fd5b5061034e611097565b3480156105e057600080fd5b5061032c6110a6565b3480156105f557600080fd5b506102ea6106043660046128e1565b6110ac565b34801561061557600080fd5b506102ea610624366004612800565b6111f5565b34801561063557600080fd5b506102ea6106443660046128e1565b611243565b34801561065557600080fd5b506102ea6106643660046126d8565b611267565b34801561067557600080fd5b5061032c6114aa565b34801561068a57600080fd5b5061032c6114b0565b34801561069f57600080fd5b5061032c6106ae366004612753565b6114b6565b3480156106bf57600080fd5b5061032c6114cc565b3480156106d457600080fd5b5061032c6106e33660046128e1565b6114d6565b3480156106f457600080fd5b506107086107033660046128f9565b6114e8565b6040516102c191906130db565b34801561072157600080fd5b506102ea6107303660046128e1565b61155a565b34801561074157600080fd5b5061037b6107503660046128f9565b61157e565b34801561076157600080fd5b506102ea6107703660046128e1565b6115c1565b34801561078157600080fd5b506102ea6107903660046128e1565b6115e5565b3480156107a157600080fd5b506102ea6107b03660046128e1565b611609565b3480156107c157600080fd5b506102ea6107d03660046127a1565b61169b565b3480156107e157600080fd5b5061034e6117f6565b6102ea6107f83660046128e1565b61181a565b603d818154811061080a57fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b33301461088a5760405162461bcd60e51b815260040161088190612e49565b60405180910390fd5b603555565b3361089a833361157e565b1580156108ad57506108ab836109bc565b155b3332146108bb5760006108bf565b6152085b61ffff1681156109805760005a90506108d93387876118ac565b60006108f66127106108f0856108f05a8790611add565b90611b1f565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce8079061094790889085906004016129b0565b600060405180830381600087803b15801561096157600080fd5b505af1158015610975573d6000803e3d6000fd5b50505050505061098b565b61098b3386866118ac565b5050505050565b603e6020526000908152604090205481565b73b04e030140b30c27bcdfaafffa98c57d80eda7b490565b6000603554603d83815481106109ce57fe5b906000526020600020906008020160050154603d84815481106109ed57fe5b90600052602060002090600802016004015401101590505b919050565b60335481565b6000610a1a6114cc565b8211158015610a295750600082115b610a455760405162461bcd60e51b815260040161088190612fa6565b6000603d8381548110610a5457fe5b906000526020600020906008020190508060020154610a71611b44565b11610a80576000915050610a05565b8060030154610a8d611b44565b11610a9c576001915050610a05565b80600501548160040154111580610abe57506035548160050154826004015401105b15610acd576002915050610a05565b600681015460ff1615610ae4576005915050610a05565b610b036034546108f06033548460030154611b1f90919063ffffffff16565b610b0b611b44565b10610b1a576006915050610a05565b6033546003820154610b2b91611b1f565b610b33611b44565b10610b42576004915050610a05565b6003915050610a05565b60408051808201909152600f81526e0d0b9c185d18da0b595e1c1b1bda5d608a1b602082015290565b603a5481565b6001600160a01b038381166000908152603c60205260408120549091163314610bb65760405162461bcd60e51b815260040161088190613036565b610bc1848484611b48565b949350505050565b336000818152603c60205260409020546001600160a01b039081169190831614801590610bff57506001600160a01b0382163014155b8015610c1357506001600160a01b03821615155b8015610c315750806001600160a01b0316826001600160a01b031614155b610c4d5760405162461bcd60e51b815260040161088190612e80565b6001600160a01b03811615610c93576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f91610d489185916004016129b0565b600060405180830381600087803b158015610d6257600080fd5b505af1925050508015610d73575060015b610df6573d808015610da1576040519150601f19603f3d011682016040523d82523d6000602084013e610da6565b606091505b5080604051610db59190612980565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a350610e2b565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e3482611b70565b5050565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610e7e5760405162461bcd60e51b815260040161088190612e49565b6033548110610e9f5760405162461bcd60e51b815260040161088190612d6d565b603a55565b333014610ec35760405162461bcd60e51b815260040161088190612e49565b603755565b7f000000000000000000000000000000000000000000000000000000000000000081565b336000908152603c60205260409020546001600160a01b031680610f225760405162461bcd60e51b815260040161088190612fec565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b610f7b6109a4565b6001600160a01b0316336001600160a01b031614610fab5760405162461bcd60e51b815260040161088190612f7f565b604051633a08bde160e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e822f78490610ff7908490600401612ab6565b600060405180830381600087803b15801561101157600080fd5b505af115801561098b573d6000803e3d6000fd5b3330146110445760405162461bcd60e51b815260040161088190612e49565b603455565b603b6020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916111099185916004016129b0565b600060405180830381600087803b15801561112357600080fd5b505af1925050508015611134575060015b6111b7573d808015611162576040519150601f19603f3d011682016040523d82523d6000602084013e611167565b606091505b50806040516111769190612980565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506111ec565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e3482611c54565b60008351116112165760405162461bcd60e51b815260040161088190612e1f565b61123e838383611226863361157e565b1580156112395750611237866109bc565b155b611c5e565b505050565b3330146112625760405162461bcd60e51b815260040161088190612e49565b603955565b600054610100900460ff16806112805750611280611ea1565b8061128e575060005460ff16155b6112aa5760405162461bcd60e51b815260040161088190612f31565b600054610100900460ff161580156112d5576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff199094169390931716919091179055611495611ea7565b8015610e34576000805461ff00191690555050565b60395481565b60375481565b60006114c3338484611b48565b90505b92915050565b603d546000190190565b60416020526000908152604090205481565b6114f06125d2565b603d83815481106114fd57fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b3330146115795760405162461bcd60e51b815260040161088190612e49565b603355565b6000603d838154811061158d57fe5b600091825260208083206001600160a01b03861684526007600890930201919091019052604090205460ff16905092915050565b3330146115e05760405162461bcd60e51b815260040161088190612e49565b603855565b3330146116045760405162461bcd60e51b815260040161088190612e49565b603655565b6116116109a4565b6001600160a01b0316336001600160a01b0316146116415760405162461bcd60e51b815260040161088190612f7f565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166108fc6116788347611ee8565b6040518115909202916000818181858888f1935050505061169857600080fd5b50565b6001600160a01b038087166000908152603b60205260409081902054905163e113335f60e01b815288927f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916116fc9185916004016129b0565b600060405180830381600087803b15801561171657600080fd5b505af1925050508015611727575060015b6117aa573d808015611755576040519150601f19603f3d011682016040523d82523d6000602084013e61175a565b606091505b50806040516117699190612980565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506117df565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b6117ed878787878787611efe565b50505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b3330141561183a5760405162461bcd60e51b815260040161088190612c36565b6000603d828154811061184957fe5b6000918252602080832060016008909302019182015485845260419091526040909220549092506001600160a01b0390911690813f90811461189d5760405162461bcd60e51b815260040161088190612d17565b6118a684611f7e565b50505050565b60016118b783610a10565b60068111156118c257fe5b146118df5760405162461bcd60e51b815260040161088190612bef565b6000603d83815481106118ee57fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b90945291909420549294501015908061194d5760405162461bcd60e51b815260040161088190612eb7565b825460ff161561199c578254610100900460ff1615611983576001830154600485015461197991611add565b600485015561199c565b6001830154600585015461199691611add565b60058501555b84156119bb5760048401546119b19082611b1f565b60048501556119d0565b60058401546119ca9082611b1f565b60058501555b6006840154610100900460ff16158015611a0057506039546119fe6119f3611b44565b600387015490611add565b105b15611a44576005840154600485015411158215158114611a425760068501805461ff001916610100179055603a546003860154611a3c91611b1f565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a546003870154611a8f938b93611a8a9391926108f092839190611b1f565b612110565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b584604051611acc9190612ab6565b60405180910390a450505050505050565b60006114c383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061214d565b6000828201838110156114c35760405162461bcd60e51b815260040161088190612ce0565b4290565b6000611b55848484612179565b6000818152604160205260409020933f909355509092915050565b336000908152603f6020526040902054611b88611b44565b11611ba55760405162461bcd60e51b815260040161088190612db1565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054611bf391839061214d565b336000818152603b6020526040908190209290925590516391fe357360e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316916391fe357391610ff7919085906004016129b0565b61169833826124c7565b3381328214611c6e576000611c72565b6152085b61ffff168115611ddd5760005a905060005b8851811015611d3b576000898281518110611c9b57fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611cdb57506001600160a01b03811633145b611cf75760405162461bcd60e51b815260040161088190613036565b861580611d0b5750611d09898261157e565b155b611d275760405162461bcd60e51b8152600401610881906130a4565b611d32818a8a6118ac565b50600101611c84565b506000611d536127106108f0856108f05a8790611add565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce80790611da490889085906004016129b0565b600060405180830381600087803b158015611dbe57600080fd5b505af1158015611dd2573d6000803e3d6000fd5b5050505050506117ed565b60005b8751811015611e97576000888281518110611df757fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611e3757506001600160a01b03811633145b611e535760405162461bcd60e51b815260040161088190613036565b851580611e675750611e65888261157e565b155b611e835760405162461bcd60e51b8152600401610881906130a4565b611e8e8189896118ac565b50600101611de0565b5050505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6000818310611ef757816114c3565b5090919050565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf90611f3a90899030908a908a908a908a908a90600401612a33565b600060405180830381600087803b158015611f5457600080fd5b505af1158015611f68573d6000803e3d6000fd5b50505050611f7686866124c7565b505050505050565b6004611f8982610a10565b6006811115611f9457fe5b14611fb15760405162461bcd60e51b815260040161088190612b29565b6000603d8281548110611fc057fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b0316611ffb816125cc565b6120175760405162461bcd60e51b815260040161088190612ae6565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b0385169161205b91612980565b600060405180830381855af49150503d8060008114612096576040519150601f19603f3d011682016040523d82523d6000602084013e61209b565b606091505b5091509150816120de578051156120c6578060405162461bcd60e51b81526004016108819190612ad3565b60405162461bcd60e51b81526004016108819061306d565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b6001600160a01b0382166000908152603f6020526040902054811115610e34576001600160a01b03919091166000908152603f6020526040902055565b600081848411156121715760405162461bcd60e51b81526004016108819190612ad3565b505050900390565b6001600160a01b0383166000908152603b60205260408120546036548110156121b45760405162461bcd60e51b815260040161088190612c83565b6121bd846125cc565b6121d95760405162461bcd60e51b815260040161088190612eee565b6001600160a01b0385166000908152603e6020526040902054801561224b57600061220382610a10565b9050600181600681111561221357fe5b1415801561222d5750600081600681111561222a57fe5b14155b6122495760405162461bcd60e51b815260040161088190612b74565b505b600061225b6037546108f0611b44565b9050600061227460385483611b1f90919063ffffffff16565b905061227e6125f2565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff199093169290921794909416179055906124306114cc565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a54929350612472928d92611a8a9290916108f0919082908a90611b1f565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d6040516124b29493929190612a74565b60405180910390a39998505050505050505050565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd9061251b9085907f00000000000000000000000000000000000000000000000000000000000000009086906004016129c9565b602060405180830381600087803b15801561253557600080fd5b505af1158015612549573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061256d91906128c5565b6125895760405162461bcd60e51b815260040161088190612de8565b6001600160a01b0382166000908152603b60205260409020546125ac9082611b1f565b6001600160a01b039092166000908152603b602052604090209190915550565b3b151590565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b03811681146114c657600080fd5b80356114c681613168565b600082601f83011261267f578081fd5b813567ffffffffffffffff811115612695578182fd5b6126a8601f8201601f1916602001613100565b91508082528360208285010111156126bf57600080fd5b8060208401602084013760009082016020015292915050565b6000602082840312156126e9578081fd5b6114c3838361264d565b600080600060608486031215612707578182fd5b833561271281613153565b9250602084013561272281613153565b9150604084013567ffffffffffffffff81111561273d578182fd5b6127498682870161266f565b9150509250925092565b60008060408385031215612765578182fd5b823561277081613153565b9150602083013567ffffffffffffffff81111561278b578182fd5b6127978582860161266f565b9150509250929050565b60008060008060008060c087890312156127b9578182fd5b6127c3888861264d565b95506020870135945060408701359350606087013560ff811681146127e6578283fd5b9598949750929560808101359460a0909101359350915050565b600080600060608486031215612814578283fd5b833567ffffffffffffffff8082111561282b578485fd5b818601915086601f83011261283e578485fd5b81358181111561284c578586fd5b6020915081810261285e838201613100565b8281528381019085850183870186018c101561287857898afd5b8996505b848710156128a25761288e8c8261264d565b83526001969096019591850191850161287c565b50975050505085013592506128bc90508560408601612664565b90509250925092565b6000602082840312156128d6578081fd5b81516114c381613168565b6000602082840312156128f2578081fd5b5035919050565b6000806040838503121561290b578182fd5b8235915061291c846020850161264d565b90509250929050565b60008060408385031215612937578182fd5b82359150602083013561294981613168565b809150509250929050565b6000815180845261296c816020860160208601613127565b601f01601f19169290920160200192915050565b60008251612992818460208701613127565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b038616825284602083015283604083015260806060830152612aa16080830184612954565b9695505050505050565b901515815260200190565b90815260200190565b6020810160078310612acd57fe5b91905290565b6000602082526114c36020830184612954565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252602d908201527f476f7665726e616e63653a3a70726f706f73653a2070736575646f2d6578746560408201526c393730b610333ab731ba34b7b760991b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526036908201527f476f7665726e616e63653a3a70726f706f73653a206d6574616d6f72706869636040820152750818dbdb9d1c9858dd1cc81b9bdd08185b1b1bddd95960521b606082015260800190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526010908201526f43616e206e6f7420626520656d70747960801b604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252600d908201526c6f6e6c79206d756c746973696760981b604082015260600190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b60208082526019908201527f476f7665726e616e63653a20766f74656420616c726561647900000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b60405181810167ffffffffffffffff8111828210171561311f57600080fd5b604052919050565b60005b8381101561314257818101518382015260200161312a565b838111156118a65750506000910152565b6001600160a01b038116811461169857600080fd5b801515811461169857600080fdfea2646970667358221220b75004153b6c8b4905c018daca78cb0fa6d3859298be55252bcf6ba75ea68d0e64736f6c634300060c0033a26469706673582212205ce84e9446fce11b2c9c1572684a150170d4bffa09fb4c56f9926d2efe573f6b64736f6c634300060c0033"; +const isSuperArgs$8 = (xs) => xs.length > 1; +class PatchProposal__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$8(args)) { + super(...args); + } else { + super(_abi$8, _bytecode$8, args[0]); + } + } + getDeployTransaction(_deployedStakingProxyContractAddress, _deployedRelayerRegistryImplementationAddress, overrides) { + return super.getDeployTransaction( + _deployedStakingProxyContractAddress, + _deployedRelayerRegistryImplementationAddress, + overrides || {} + ); + } + deploy(_deployedStakingProxyContractAddress, _deployedRelayerRegistryImplementationAddress, overrides) { + return super.deploy( + _deployedStakingProxyContractAddress, + _deployedRelayerRegistryImplementationAddress, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$8; + static abi = _abi$8; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$8); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$8, runner); + } +} + +var index$4 = /*#__PURE__*/Object.freeze({ + __proto__: null, + AdminUpgradeableProxy__factory: AdminUpgradeableProxy__factory$1, + GovernanceExploitPatchUpgrade__factory: GovernanceExploitPatchUpgrade__factory, + PatchProposal__factory: PatchProposal__factory, + metamorphic: index$7, + mock: index$5 +}); + +const _abi$7 = [ + { + inputs: [ + { + internalType: "address", + name: "stakingRewardsAddress", + type: "address" + }, + { + internalType: "address", + name: "gasCompLogic", + type: "address" + }, + { + internalType: "address", + name: "userVaultAddress", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + } + ], + name: "Delegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "proposer", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + indexed: false, + internalType: "string", + name: "description", + type: "string" + } + ], + name: "ProposalCreated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "ProposalExecuted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "bytes", + name: "errorData", + type: "bytes" + } + ], + name: "RewardUpdateFailed", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + } + ], + name: "RewardUpdateSuccessful", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + } + ], + name: "Undelegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "voter", + type: "address" + }, + { + indexed: true, + internalType: "bool", + name: "support", + type: "bool" + }, + { + indexed: false, + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + name: "Voted", + type: "event" + }, + { + inputs: [], + name: "CLOSING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_EXPIRATION", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PROPOSAL_THRESHOLD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "QUORUM_VOTES", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "Staking", + outputs: [ + { + internalType: "contract ITornadoStakingRewards", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTE_EXTEND_TIME", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "canWithdrawAfter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "from", + type: "address[]" + }, + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castDelegatedVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "checkIfQuorumReached", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + } + ], + name: "delegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "delegatedTo", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "execute", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "gasCompensationVault", + outputs: [ + { + internalType: "contract IGasCompensationVault", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "voter", + type: "address" + } + ], + name: "getReceipt", + outputs: [ + { + components: [ + { + internalType: "bool", + name: "hasVoted", + type: "bool" + }, + { + internalType: "bool", + name: "support", + type: "bool" + }, + { + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + internalType: "struct Governance.Receipt", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "hasAccountVoted", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "latestProposalIds", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "lock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "lockWithApproval", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "lockedBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "proposalCodehashes", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "proposalCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "proposals", + outputs: [ + { + internalType: "address", + name: "proposer", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "forVotes", + type: "uint256" + }, + { + internalType: "uint256", + name: "againstVotes", + type: "uint256" + }, + { + internalType: "bool", + name: "executed", + type: "bool" + }, + { + internalType: "bool", + name: "extended", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "propose", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "proposeByDelegate", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "returnMultisigAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "closingPeriod", + type: "uint256" + } + ], + name: "setClosingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionDelay", + type: "uint256" + } + ], + name: "setExecutionDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionExpiration", + type: "uint256" + } + ], + name: "setExecutionExpiration", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "gasCompensationsLimit", + type: "uint256" + } + ], + name: "setGasCompensations", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalThreshold", + type: "uint256" + } + ], + name: "setProposalThreshold", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "quorumVotes", + type: "uint256" + } + ], + name: "setQuorumVotes", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "voteExtendTime", + type: "uint256" + } + ], + name: "setVoteExtendTime", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingDelay", + type: "uint256" + } + ], + name: "setVotingDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingPeriod", + type: "uint256" + } + ], + name: "setVotingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "state", + outputs: [ + { + internalType: "enum Governance.ProposalState", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract TORN", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "undelegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "unlock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "userVault", + outputs: [ + { + internalType: "contract ITornadoVault", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "version", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdrawFromHelper", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$7 = "0x60e06040523480156200001157600080fd5b506040516200344138038062003441833981016040819052620000349162000171565b82828282828281818181600060019054906101000a900460ff16806200005f57506200005f6200012a565b806200006e575060005460ff16155b620000965760405162461bcd60e51b81526004016200008d90620001c4565b60405180910390fd5b600054610100900460ff16158015620000c2576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000e062000130565b8015620000f3576000805461ff00191690555b506001600160601b0319606091821b811660805291811b821660a0529590951b90941660c052506200022b98505050505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b60008060006060848603121562000186578283fd5b8351620001938162000212565b6020850151909350620001a68162000212565b6040850151909250620001b98162000212565b809150509250925092565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6001600160a01b03811681146200022857600080fd5b50565b60805160601c60a05160601c60c05160601c6131b36200028e60003980610d1a52806110db52806116ce52806117ff5250806109105280610ed15280610fc9528061164a5280611d745250806110645280611c1d52806124f852506131b36000f3fe6080604052600436106102815760003560e01c80639daafec71161014f578063d6f0948c116100c1578063ea0217cf1161007a578063ea0217cf14610755578063ece40cc114610775578063ef3f8bb114610795578063f0b76892146107b5578063f57df22e146107d5578063fe0d94c1146107ea57610288565b8063d6f0948c14610693578063da35c664146106b3578063e01f5237146106c8578063e23a9a52146106e8578063e4917d9f14610715578063e525aa081461073557610288565b8063b54426c811610113578063b54426c8146105e9578063b859f11b14610609578063c0c0e82014610629578063c4d66de814610649578063ce25d71c14610669578063d6159fe51461067e57610288565b80639daafec714610575578063a6c266031461058a578063a72edda31461059f578063adf898a4146105bf578063b1610d7e146105d457610288565b80635c19a95c116101f357806370b0f660116101ac57806370b0f660146104cb5780638b34a960146104eb57806392ab89bb14610500578063932d5157146105155780639a9e3b6e146105355780639ae697bf1461055557610288565b80635c19a95c146104215780636198e3391461044157806365da126414610461578063671dd275146104815780636a661755146104965780636dc2dc6c146104ab57610288565b806332687ec11161024557806332687ec11461035b57806337f135d7146103885780633e4f49e61461039d57806354fd4d50146103ca578063587a6ecb146103ec57806358e9fff01461040157610288565b8063013cf08b1461028d57806302ec8f9e146102ca57806315373e3d146102ec57806317977c611461030c57806324b0435f1461033957610288565b3661028857005b600080fd5b34801561029957600080fd5b506102ad6102a83660046128e8565b6107fd565b6040516102c19897969594939291906129f4565b60405180910390f35b3480156102d657600080fd5b506102ea6102e53660046128e8565b610862565b005b3480156102f857600080fd5b506102ea61030736600461292c565b61088f565b34801561031857600080fd5b5061032c6103273660046126df565b610992565b6040516102c19190612abd565b34801561034557600080fd5b5061034e6109a4565b6040516102c191906129a3565b34801561036757600080fd5b5061037b6103763660046128e8565b6109bc565b6040516102c19190612ab2565b34801561039457600080fd5b5061032c610a0a565b3480156103a957600080fd5b506103bd6103b83660046128e8565b610a10565b6040516102c19190612ac6565b3480156103d657600080fd5b506103df610b4c565b6040516102c19190612ada565b3480156103f857600080fd5b5061032c610b7c565b34801561040d57600080fd5b5061032c61041c3660046126fa565b610b82565b34801561042d57600080fd5b506102ea61043c3660046126df565b610bd0565b34801561044d57600080fd5b506102ea61045c3660046128e8565b610cf2565b34801561046d57600080fd5b5061034e61047c3660046126df565b610e3f565b34801561048d57600080fd5b5061032c610e5a565b3480156104a257600080fd5b5061032c610e60565b3480156104b757600080fd5b506102ea6104c63660046128e8565b610e66565b3480156104d757600080fd5b506102ea6104e63660046128e8565b610eab565b3480156104f757600080fd5b5061034e610ecf565b34801561050c57600080fd5b506102ea610ef3565b34801561052157600080fd5b506102ea6105303660046128e8565b610f7a565b34801561054157600080fd5b506102ea6105503660046128e8565b61102c565b34801561056157600080fd5b5061032c6105703660046126df565b611050565b34801561058157600080fd5b5061034e611062565b34801561059657600080fd5b5061032c611086565b3480156105ab57600080fd5b5061032c6105ba3660046126df565b61108c565b3480156105cb57600080fd5b5061034e61109e565b3480156105e057600080fd5b5061032c6110ad565b3480156105f557600080fd5b506102ea6106043660046128e8565b6110b3565b34801561061557600080fd5b506102ea610624366004612807565b6111fc565b34801561063557600080fd5b506102ea6106443660046128e8565b61124a565b34801561065557600080fd5b506102ea6106643660046126df565b61126e565b34801561067557600080fd5b5061032c6114b1565b34801561068a57600080fd5b5061032c6114b7565b34801561069f57600080fd5b5061032c6106ae36600461275a565b6114bd565b3480156106bf57600080fd5b5061032c6114d3565b3480156106d457600080fd5b5061032c6106e33660046128e8565b6114dd565b3480156106f457600080fd5b50610708610703366004612900565b6114ef565b6040516102c191906130e2565b34801561072157600080fd5b506102ea6107303660046128e8565b611561565b34801561074157600080fd5b5061037b610750366004612900565b611585565b34801561076157600080fd5b506102ea6107703660046128e8565b6115c8565b34801561078157600080fd5b506102ea6107903660046128e8565b6115ec565b3480156107a157600080fd5b506102ea6107b03660046128e8565b611610565b3480156107c157600080fd5b506102ea6107d03660046127a8565b6116a2565b3480156107e157600080fd5b5061034e6117fd565b6102ea6107f83660046128e8565b611821565b603d818154811061080a57fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b33301461088a5760405162461bcd60e51b815260040161088190612e50565b60405180910390fd5b603555565b3361089a8333611585565b1580156108ad57506108ab836109bc565b155b3332146108bb5760006108bf565b6152085b61ffff1681156109805760005a90506108d93387876118b3565b60006108f66127106108f0856108f05a8790611ae4565b90611b26565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce8079061094790889085906004016129b7565b600060405180830381600087803b15801561096157600080fd5b505af1158015610975573d6000803e3d6000fd5b50505050505061098b565b61098b3386866118b3565b5050505050565b603e6020526000908152604090205481565b73b04e030140b30c27bcdfaafffa98c57d80eda7b490565b6000603554603d83815481106109ce57fe5b906000526020600020906008020160050154603d84815481106109ed57fe5b90600052602060002090600802016004015401101590505b919050565b60335481565b6000610a1a6114d3565b8211158015610a295750600082115b610a455760405162461bcd60e51b815260040161088190612fad565b6000603d8381548110610a5457fe5b906000526020600020906008020190508060020154610a71611b4b565b11610a80576000915050610a05565b8060030154610a8d611b4b565b11610a9c576001915050610a05565b600681015460ff1615610ab3576005915050610a05565b80600501548160040154111580610ad557506035548160050154826004015401105b15610ae4576002915050610a05565b610b036034546108f06033548460030154611b2690919063ffffffff16565b610b0b611b4b565b10610b1a576006915050610a05565b6033546003820154610b2b91611b26565b610b33611b4b565b10610b42576004915050610a05565b6003915050610a05565b60408051808201909152601681527506a5ce0e4dee0dee6c2d85ae6e8c2e8ca5ae0c2e8c6d60531b602082015290565b603a5481565b6001600160a01b038381166000908152603c60205260408120549091163314610bbd5760405162461bcd60e51b81526004016108819061303d565b610bc8848484611b4f565b949350505050565b336000818152603c60205260409020546001600160a01b039081169190831614801590610c0657506001600160a01b0382163014155b8015610c1a57506001600160a01b03821615155b8015610c385750806001600160a01b0316826001600160a01b031614155b610c545760405162461bcd60e51b815260040161088190612e87565b6001600160a01b03811615610c9a576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f91610d4f9185916004016129b7565b600060405180830381600087803b158015610d6957600080fd5b505af1925050508015610d7a575060015b610dfd573d808015610da8576040519150601f19603f3d011682016040523d82523d6000602084013e610dad565b606091505b5080604051610dbc9190612987565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a350610e32565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e3b82611b77565b5050565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610e855760405162461bcd60e51b815260040161088190612e50565b6033548110610ea65760405162461bcd60e51b815260040161088190612d74565b603a55565b333014610eca5760405162461bcd60e51b815260040161088190612e50565b603755565b7f000000000000000000000000000000000000000000000000000000000000000081565b336000908152603c60205260409020546001600160a01b031680610f295760405162461bcd60e51b815260040161088190612ff3565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b610f826109a4565b6001600160a01b0316336001600160a01b031614610fb25760405162461bcd60e51b815260040161088190612f86565b604051633a08bde160e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e822f78490610ffe908490600401612abd565b600060405180830381600087803b15801561101857600080fd5b505af115801561098b573d6000803e3d6000fd5b33301461104b5760405162461bcd60e51b815260040161088190612e50565b603455565b603b6020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916111109185916004016129b7565b600060405180830381600087803b15801561112a57600080fd5b505af192505050801561113b575060015b6111be573d808015611169576040519150601f19603f3d011682016040523d82523d6000602084013e61116e565b606091505b508060405161117d9190612987565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506111f3565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e3b82611c5b565b600083511161121d5760405162461bcd60e51b815260040161088190612e26565b61124583838361122d8633611585565b158015611240575061123e866109bc565b155b611c65565b505050565b3330146112695760405162461bcd60e51b815260040161088190612e50565b603955565b600054610100900460ff16806112875750611287611ea8565b80611295575060005460ff16155b6112b15760405162461bcd60e51b815260040161088190612f38565b600054610100900460ff161580156112dc576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff19909416939093171691909117905561149c611eae565b8015610e3b576000805461ff00191690555050565b60395481565b60375481565b60006114ca338484611b4f565b90505b92915050565b603d546000190190565b60416020526000908152604090205481565b6114f76125d9565b603d838154811061150457fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b3330146115805760405162461bcd60e51b815260040161088190612e50565b603355565b6000603d838154811061159457fe5b600091825260208083206001600160a01b03861684526007600890930201919091019052604090205460ff16905092915050565b3330146115e75760405162461bcd60e51b815260040161088190612e50565b603855565b33301461160b5760405162461bcd60e51b815260040161088190612e50565b603655565b6116186109a4565b6001600160a01b0316336001600160a01b0316146116485760405162461bcd60e51b815260040161088190612f86565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166108fc61167f8347611eef565b6040518115909202916000818181858888f1935050505061169f57600080fd5b50565b6001600160a01b038087166000908152603b60205260409081902054905163e113335f60e01b815288927f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916117039185916004016129b7565b600060405180830381600087803b15801561171d57600080fd5b505af192505050801561172e575060015b6117b1573d80801561175c576040519150601f19603f3d011682016040523d82523d6000602084013e611761565b606091505b50806040516117709190612987565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506117e6565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b6117f4878787878787611f05565b50505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b333014156118415760405162461bcd60e51b815260040161088190612c3d565b6000603d828154811061185057fe5b6000918252602080832060016008909302019182015485845260419091526040909220549092506001600160a01b0390911690813f9081146118a45760405162461bcd60e51b815260040161088190612d1e565b6118ad84611f85565b50505050565b60016118be83610a10565b60068111156118c957fe5b146118e65760405162461bcd60e51b815260040161088190612bf6565b6000603d83815481106118f557fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b9094529190942054929450101590806119545760405162461bcd60e51b815260040161088190612ebe565b825460ff16156119a3578254610100900460ff161561198a576001830154600485015461198091611ae4565b60048501556119a3565b6001830154600585015461199d91611ae4565b60058501555b84156119c25760048401546119b89082611b26565b60048501556119d7565b60058401546119d19082611b26565b60058501555b6006840154610100900460ff16158015611a075750603954611a056119fa611b4b565b600387015490611ae4565b105b15611a4b576005840154600485015411158215158114611a495760068501805461ff001916610100179055603a546003860154611a4391611b26565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a546003870154611a96938b93611a919391926108f092839190611b26565b612117565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b584604051611ad39190612abd565b60405180910390a450505050505050565b60006114ca83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612154565b6000828201838110156114ca5760405162461bcd60e51b815260040161088190612ce7565b4290565b6000611b5c848484612180565b6000818152604160205260409020933f909355509092915050565b336000908152603f6020526040902054611b8f611b4b565b11611bac5760405162461bcd60e51b815260040161088190612db8565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054611bfa918390612154565b336000818152603b6020526040908190209290925590516391fe357360e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316916391fe357391610ffe919085906004016129b7565b61169f33826124ce565b3381328214611c75576000611c79565b6152085b61ffff168115611de45760005a905060005b8851811015611d42576000898281518110611ca257fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611ce257506001600160a01b03811633145b611cfe5760405162461bcd60e51b81526004016108819061303d565b861580611d125750611d108982611585565b155b611d2e5760405162461bcd60e51b8152600401610881906130ab565b611d39818a8a6118b3565b50600101611c8b565b506000611d5a6127106108f0856108f05a8790611ae4565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce80790611dab90889085906004016129b7565b600060405180830381600087803b158015611dc557600080fd5b505af1158015611dd9573d6000803e3d6000fd5b5050505050506117f4565b60005b8751811015611e9e576000888281518110611dfe57fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611e3e57506001600160a01b03811633145b611e5a5760405162461bcd60e51b81526004016108819061303d565b851580611e6e5750611e6c8882611585565b155b611e8a5760405162461bcd60e51b8152600401610881906130ab565b611e958189896118b3565b50600101611de7565b5050505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6000818310611efe57816114ca565b5090919050565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf90611f4190899030908a908a908a908a908a90600401612a3a565b600060405180830381600087803b158015611f5b57600080fd5b505af1158015611f6f573d6000803e3d6000fd5b50505050611f7d86866124ce565b505050505050565b6004611f9082610a10565b6006811115611f9b57fe5b14611fb85760405162461bcd60e51b815260040161088190612b30565b6000603d8281548110611fc757fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b0316612002816125d3565b61201e5760405162461bcd60e51b815260040161088190612aed565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b0385169161206291612987565b600060405180830381855af49150503d806000811461209d576040519150601f19603f3d011682016040523d82523d6000602084013e6120a2565b606091505b5091509150816120e5578051156120cd578060405162461bcd60e51b81526004016108819190612ada565b60405162461bcd60e51b815260040161088190613074565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b6001600160a01b0382166000908152603f6020526040902054811115610e3b576001600160a01b03919091166000908152603f6020526040902055565b600081848411156121785760405162461bcd60e51b81526004016108819190612ada565b505050900390565b6001600160a01b0383166000908152603b60205260408120546036548110156121bb5760405162461bcd60e51b815260040161088190612c8a565b6121c4846125d3565b6121e05760405162461bcd60e51b815260040161088190612ef5565b6001600160a01b0385166000908152603e6020526040902054801561225257600061220a82610a10565b9050600181600681111561221a57fe5b141580156122345750600081600681111561223157fe5b14155b6122505760405162461bcd60e51b815260040161088190612b7b565b505b60006122626037546108f0611b4b565b9050600061227b60385483611b2690919063ffffffff16565b90506122856125f9565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff199093169290921794909416179055906124376114d3565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a54929350612479928d92611a919290916108f0919082908a90611b26565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d6040516124b99493929190612a7b565b60405180910390a39998505050505050505050565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd906125229085907f00000000000000000000000000000000000000000000000000000000000000009086906004016129d0565b602060405180830381600087803b15801561253c57600080fd5b505af1158015612550573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061257491906128cc565b6125905760405162461bcd60e51b815260040161088190612def565b6001600160a01b0382166000908152603b60205260409020546125b39082611b26565b6001600160a01b039092166000908152603b602052604090209190915550565b3b151590565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b03811681146114cd57600080fd5b80356114cd8161316f565b600082601f830112612686578081fd5b813567ffffffffffffffff81111561269c578182fd5b6126af601f8201601f1916602001613107565b91508082528360208285010111156126c657600080fd5b8060208401602084013760009082016020015292915050565b6000602082840312156126f0578081fd5b6114ca8383612654565b60008060006060848603121561270e578182fd5b83356127198161315a565b925060208401356127298161315a565b9150604084013567ffffffffffffffff811115612744578182fd5b61275086828701612676565b9150509250925092565b6000806040838503121561276c578182fd5b82356127778161315a565b9150602083013567ffffffffffffffff811115612792578182fd5b61279e85828601612676565b9150509250929050565b60008060008060008060c087890312156127c0578182fd5b6127ca8888612654565b95506020870135945060408701359350606087013560ff811681146127ed578283fd5b9598949750929560808101359460a0909101359350915050565b60008060006060848603121561281b578283fd5b833567ffffffffffffffff80821115612832578485fd5b818601915086601f830112612845578485fd5b813581811115612853578586fd5b60209150818102612865838201613107565b8281528381019085850183870186018c101561287f57898afd5b8996505b848710156128a9576128958c82612654565b835260019690960195918501918501612883565b50975050505085013592506128c39050856040860161266b565b90509250925092565b6000602082840312156128dd578081fd5b81516114ca8161316f565b6000602082840312156128f9578081fd5b5035919050565b60008060408385031215612912578182fd5b823591506129238460208501612654565b90509250929050565b6000806040838503121561293e578182fd5b8235915060208301356129508161316f565b809150509250929050565b6000815180845261297381602086016020860161312e565b601f01601f19169290920160200192915050565b6000825161299981846020870161312e565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b038616825284602083015283604083015260806060830152612aa8608083018461295b565b9695505050505050565b901515815260200190565b90815260200190565b6020810160078310612ad457fe5b91905290565b6000602082526114ca602083018461295b565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252602d908201527f476f7665726e616e63653a3a70726f706f73653a2070736575646f2d6578746560408201526c393730b610333ab731ba34b7b760991b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526036908201527f476f7665726e616e63653a3a70726f706f73653a206d6574616d6f72706869636040820152750818dbdb9d1c9858dd1cc81b9bdd08185b1b1bddd95960521b606082015260800190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526010908201526f43616e206e6f7420626520656d70747960801b604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252600d908201526c6f6e6c79206d756c746973696760981b604082015260600190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b60208082526019908201527f476f7665726e616e63653a20766f74656420616c726561647900000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b60405181810167ffffffffffffffff8111828210171561312657600080fd5b604052919050565b60005b83811015613149578181015183820152602001613131565b838111156118ad5750506000910152565b6001600160a01b038116811461169f57600080fd5b801515811461169f57600080fdfea26469706673582212209ae80078297b488112cf4c0eaef3af85f34156332aa7d60065ce1ebb90ab93c264736f6c634300060c0033"; +const isSuperArgs$7 = (xs) => xs.length > 1; +class GovernanceProposalStateUpgrade__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$7(args)) { + super(...args); + } else { + super(_abi$7, _bytecode$7, args[0]); + } + } + getDeployTransaction(stakingRewardsAddress, gasCompLogic, userVaultAddress, overrides) { + return super.getDeployTransaction( + stakingRewardsAddress, + gasCompLogic, + userVaultAddress, + overrides || {} + ); + } + deploy(stakingRewardsAddress, gasCompLogic, userVaultAddress, overrides) { + return super.deploy( + stakingRewardsAddress, + gasCompLogic, + userVaultAddress, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$7; + static abi = _abi$7; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$7); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$7, + runner + ); + } +} + +var index$3 = /*#__PURE__*/Object.freeze({ + __proto__: null, + GovernanceProposalStateUpgrade__factory: GovernanceProposalStateUpgrade__factory +}); + +const _abi$6 = [ + { + inputs: [ + { + internalType: "address", + name: "_logic", + type: "address" + }, + { + internalType: "address", + name: "_admin", + type: "address" + }, + { + internalType: "bytes", + name: "_data", + type: "bytes" + } + ], + stateMutability: "payable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "previousAdmin", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "AdminChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "implementation", + type: "address" + } + ], + name: "Upgraded", + type: "event" + }, + { + stateMutability: "payable", + type: "fallback" + }, + { + inputs: [], + name: "admin", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "changeAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "implementation", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + } + ], + name: "upgradeTo", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "upgradeToAndCall", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$6 = "0x60806040526040516108403803806108408339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508390508282816100f1826101c5565b8051156101a9576000826001600160a01b0316826040518082805190602001908083835b602083106101345780518252601f199092019160209182019101610115565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610194576040519150601f19603f3d011682016040523d82523d6000602084013e610199565b606091505b50509050806101a757600080fd5b505b506101b19050565b6101ba82610237565b505050505050610261565b6101d88161025b60201b6103b41760201c565b6102135760405162461bcd60e51b815260040180806020018281038252603681526020018061080a6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3b151590565b61059a806102706000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996101a9565b6101a96101a46103ba565b6103df565b565b6101b3610403565b6001600160a01b0316336001600160a01b031614156101da576101d581610428565b6101e2565b6101e2610191565b50565b6101ed610403565b6001600160a01b0316336001600160a01b031614156102855761020f83610428565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610403565b6001600160a01b0316336001600160a01b031614156102c4576102bd6103ba565b90506102cc565b6102cc610191565b90565b6102d7610403565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b815260040180806020018281038252603a8152602001806104f5603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610403565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d581610468565b6000610393610403565b6001600160a01b0316336001600160a01b031614156102c4576102bd610403565b3b151590565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156103fe573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6104318161048c565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610495816103b4565b6104d05760405162461bcd60e51b815260040180806020018281038252603681526020018061052f6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374a2646970667358221220f9da162f8a2d779a4f5f08577ac886bc4694791f749bd6ecc5d270427405583364736f6c634300060c00335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374"; +const isSuperArgs$6 = (xs) => xs.length > 1; +class AdminUpgradeableProxy__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$6(args)) { + super(...args); + } else { + super(_abi$6, _bytecode$6, args[0]); + } + } + getDeployTransaction(_logic, _admin, _data, overrides) { + return super.getDeployTransaction(_logic, _admin, _data, overrides || {}); + } + deploy(_logic, _admin, _data, overrides) { + return super.deploy(_logic, _admin, _data, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$6; + static abi = _abi$6; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$6); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$6, + runner + ); + } +} + +const _abi$5 = [ + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + }, + { + internalType: "address", + name: "_governance", + type: "address" + }, + { + internalType: "address", + name: "_registry", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "instance", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "newFee", + type: "uint256" + } + ], + name: "FeeUpdated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint24", + name: "newFee", + type: "uint24" + } + ], + name: "UniswapTornPoolSwappingFeeChanged", + type: "event" + }, + { + inputs: [], + name: "PROTOCOL_FEE_DIVIDER", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "_instance", + type: "address" + } + ], + name: "calculatePoolFee", + outputs: [ + { + internalType: "uint160", + name: "", + type: "uint160" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "feeDeviations", + outputs: [ + { + components: [ + { + internalType: "address", + name: "instance", + type: "address" + }, + { + internalType: "int256", + name: "deviation", + type: "int256" + } + ], + internalType: "struct FeeManager.Deviation[]", + name: "results", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "governance", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "", + type: "address" + } + ], + name: "instanceFee", + outputs: [ + { + internalType: "uint160", + name: "", + type: "uint160" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "", + type: "address" + } + ], + name: "instanceFeeUpdated", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "_instance", + type: "address" + } + ], + name: "instanceFeeWithUpdate", + outputs: [ + { + internalType: "uint160", + name: "", + type: "uint160" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "registry", + outputs: [ + { + internalType: "contract InstanceRegistry", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint32", + name: "newPeriod", + type: "uint32" + } + ], + name: "setPeriodForTWAPOracle", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint24", + name: "_uniswapTornPoolSwappingFee", + type: "uint24" + } + ], + name: "setUniswapTornPoolSwappingFee", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint24", + name: "newLimit", + type: "uint24" + } + ], + name: "setUpdateFeeTimeLimit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "uniswapTimePeriod", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "uniswapTornPoolSwappingFee", + outputs: [ + { + internalType: "uint24", + name: "", + type: "uint24" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "updateAllFees", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "_instance", + type: "address" + } + ], + name: "updateFee", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "updateFeeTimeLimit", + outputs: [ + { + internalType: "uint24", + name: "", + type: "uint24" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance[]", + name: "_instances", + type: "address[]" + } + ], + name: "updateFees", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$5 = "0x60e06040523480156200001157600080fd5b5060405162001a8938038062001a8983398101604081905262000034916200005c565b6001600160601b0319606093841b811660805291831b821660a05290911b1660c052620000c8565b60008060006060848603121562000071578283fd5b83516200007e81620000af565b60208501519093506200009181620000af565b6040850151909250620000a481620000af565b809150509250925092565b6001600160a01b0381168114620000c557600080fd5b50565b60805160601c60a05160601c60c05160601c61196862000121600039806102ce52806104f6528061077752806109945250806104b7528061052e528061060f528061070852508061068f528061087e52506119686000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c8063a0287520116100a2578063bcc5ee6411610071578063bcc5ee641461020f578063c51c229714610217578063d8718fb11461022a578063e1f121561461023f578063f522d6d61461025257610116565b8063a0287520146101d9578063adf898a4146101ec578063aeb3077a146101f4578063b19a2972146101fc57610116565b8063603a54fe116100e9578063603a54fe146101815780637b103999146101945780637ccd2f481461019c57806380679eb3146101b157806380eb7bf0146101c657610116565b806305e343641461011b5780632efbf384146101445780634bf0a542146101645780635aa6e67514610179575b600080fd5b61012e610129366004611650565b61025a565b60405161013b9190611896565b60405180910390f35b610157610152366004611650565b61026c565b60405161013b91906116dd565b61016c6102c9565b60405161013b9190611719565b6101576104b5565b61015761018f366004611650565b6104d9565b6101576104f4565b6101a4610518565b60405161013b9190611886565b6101c46101bf3660046116a0565b610523565b005b6101c46101d4366004611650565b61057e565b6101c46101e736600461166c565b610604565b61015761068d565b61012e6106b1565b6101c461020a3660046113ef565b6106b7565b6101a46106eb565b6101c461022536600461166c565b6106fd565b61023261075a565b60405161013b919061189f565b61015761024d366004611650565b61076d565b6101c461098f565b60026020526000908152604090205481565b600080546001600160a01b038316825260026020526040822054600160381b90910462ffffff16429190910311156102a7576102a78261057e565b506001600160a01b03808216600090815260016020526040902054165b919050565b6060807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166310c13ac36040518163ffffffff1660e01b815260040160006040518083038186803b15801561032557600080fd5b505afa158015610339573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103619190810190611487565b9050805167ffffffffffffffff8111801561037b57600080fd5b506040519080825280602002602001820160405280156103b557816020015b6103a261131d565b81526020019060019003908161039a5790505b50915060005b81518110156104b05760006103e28383815181106103d557fe5b602002602001015161076d565b6001600160a01b031690506000811561045e576103e8826001600087878151811061040957fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060009054906101000a90046001600160a01b03166103e8026001600160a01b03168161045957fe5b040390505b604051806040016040528085858151811061047557fe5b60200260200101516001600160a01b031681526020018281525085848151811061049b57fe5b602090810291909101015250506001016103bb565b505090565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001602052600090815260409020546001600160a01b031681565b7f000000000000000000000000000000000000000000000000000000000000000081565b60005462ffffff1681565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461055857600080fd5b6000805463ffffffff90921663010000000266ffffffff00000019909216919091179055565b60006105898261076d565b6001600160a01b03838116600081815260016020908152604080832080546001600160a01b03191695871695909517909455600290528290204290559051919250907f6f0eaf2c2f89fb4cfe96a1dee5e764d60b52c7f48aaa590f0850e308aa1b953a906105f89084906116dd565b60405180910390a25050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461063957600080fd5b6000805462ffffff191662ffffff83811691909117918290556040517fbfe65cfc2359076c4468c9b895156c309c78f94fb09f6d2fc0463c4ca9a71ac292610682921690611886565b60405180910390a150565b7f000000000000000000000000000000000000000000000000000000000000000081565b61271081565b60005b81518110156106e7576106df8282815181106106d257fe5b602002602001015161057e565b6001016106ba565b5050565b600054600160381b900462ffffff1681565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461073257600080fd5b6000805462ffffff909216600160381b0269ffffff0000000000000019909216919091179055565b6000546301000000900463ffffffff1681565b60008060008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663032bb443876040518263ffffffff1660e01b81526004016107c191906116dd565b60a06040518083038186803b1580156107d957600080fd5b505afa1580156107ed573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081191906115d5565b9450945050935093508063ffffffff16600014156108365760009450505050506102c4565b6001600160a01b03831615801561084b575083155b610855578261086b565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25b6040805180820182526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081168252831660208083019190915282518084019093526000805462ffffff80821686528816928501929092529396506108e5929063ffffffff630100000090910416610a29565b905061098461271061097e8463ffffffff166109788561097e670de0b6b3a76400008e6001600160a01b0316638bca6d166040518163ffffffff1660e01b815260040160206040518083038186803b15801561094057600080fd5b505afa158015610954573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109789190611688565b90610a75565b90610ac1565b979650505050505050565b610a277f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166310c13ac36040518163ffffffff1660e01b815260040160006040518083038186803b1580156109eb57600080fd5b505afa1580156109ff573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261020a9190810190611487565b565b60208084015190830151600091610a409184610b03565b84518451610a6391670de0b6b3a764000091610a5d919087610b03565b90610b2d565b81610a6a57fe5b0490505b9392505050565b600082610a8457506000610abb565b82820282848281610a9157fe5b0414610ab85760405162461bcd60e51b8152600401610aaf90611845565b60405180910390fd5b90505b92915050565b6000610ab883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610b51565b6000610b258473c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28585610b88565b949350505050565b6000821580610b4857505081810281838281610b4557fe5b04145b610abb57600080fd5b60008183610b725760405162461bcd60e51b8152600401610aaf91906117bb565b506000838581610b7e57fe5b0495945050505050565b600080846001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610bc457600080fd5b505afa158015610bd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfc91906116bc565b60ff16600a0a90506001600160a01b038681169086161415610c28576001600160801b03169050610b25565b604051630b4c774160e11b8152610cc990610cc190731f98431c8ad98523631ae4a59f267346ea31f98490631698ee8290610c6b908b908b908b906004016116f1565b60206040518083038186803b158015610c8357600080fd5b505afa158015610c97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cbb91906113d3565b85610cda565b828888610e6f565b915050610b25565b50949350505050565b600063ffffffff8216610cff5760405162461bcd60e51b8152600401610aaf9061180e565b60408051600280825260608083018452926020830190803683370190505090508281600081518110610d2d57fe5b602002602001019063ffffffff16908163ffffffff1681525050600081600181518110610d5657fe5b63ffffffff9092166020928302919091019091015260405163883bdbfd60e01b81526060906001600160a01b0386169063883bdbfd90610d9a908590600401611771565b60006040518083038186803b158015610db257600080fd5b505afa158015610dc6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610dee9190810190611513565b509050600081600081518110610e0057fe5b602002602001015182600181518110610e1557fe5b60200260200101510390508463ffffffff168160060b81610e3257fe5b05935060008160060b128015610e5957508463ffffffff168160060b81610e5557fe5b0715155b15610e6657600019909301925b50505092915050565b600080610e7b86610f59565b90506001600160801b036001600160a01b03821611610eea576001600160a01b0380821680029084811690861610610eca57610ec5600160c01b876001600160801b031683611272565b610ee2565b610ee281876001600160801b0316600160c01b611272565b925050610cd1565b6000610f096001600160a01b0383168068010000000000000000611272565b9050836001600160a01b0316856001600160a01b031610610f4157610f3c600160801b876001600160801b031683611272565b610984565b61098481876001600160801b0316600160801b611272565b60008060008360020b12610f70578260020b610f78565b8260020b6000035b9050620d89e8811115610f9d5760405162461bcd60e51b8152600401610aaf9061182a565b600060018216610fb157600160801b610fc3565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615610ff7576ffff97272373d413259a46990580e213a0260801c5b6004821615611016576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615611035576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615611054576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615611073576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615611092576fff2ea16466c96a3843ec78b326b528610260801c5b60808216156110b1576ffe5dee046a99a2a811c461f1969c30530260801c5b6101008216156110d1576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b6102008216156110f1576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615611111576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615611131576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615611151576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615611171576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615611191576f70d869a156d2a1b890bb3df62baf32f70260801c5b6180008216156111b1576f31be135f97d08fd981231505542fcfa60260801c5b620100008216156111d2576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b620200008216156111f2576e5d6af8dedb81196699c329225ee6040260801c5b62040000821615611211576d2216e584f5fa1ea926041bedfe980260801c5b6208000082161561122e576b048a170391f7dc42444e8fa20260801c5b60008460020b131561124957806000198161124557fe5b0490505b64010000000081061561125d576001611260565b60005b60ff16602082901c0192505050919050565b60008080600019858709868602925082811090839003039050806112a8576000841161129d57600080fd5b508290049050610a6e565b8084116112b457600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b604080518082019091526000808252602082015290565b600082601f830112611344578081fd5b8151611357611352826118d7565b6118b0565b81815291506020808301908481018184028601820187101561137857600080fd5b60005b848110156113a057815161138e816118f7565b8452928201929082019060010161137b565b505050505092915050565b8035610abb816118f7565b8051610abb816118f7565b8051600681900b8114610abb57600080fd5b6000602082840312156113e4578081fd5b8151610ab8816118f7565b60006020808385031215611401578182fd5b823567ffffffffffffffff811115611417578283fd5b8301601f81018513611427578283fd5b8035611435611352826118d7565b8181528381019083850185840285018601891015611451578687fd5b8694505b8385101561147b5761146789826113ab565b835260019490940193918501918501611455565b50979650505050505050565b60006020808385031215611499578182fd5b825167ffffffffffffffff8111156114af578283fd5b8301601f810185136114bf578283fd5b80516114cd611352826118d7565b81815283810190838501858402850186018910156114e9578687fd5b8694505b8385101561147b576114ff89826113b6565b8352600194909401939185019185016114ed565b60008060408385031215611525578081fd5b825167ffffffffffffffff8082111561153c578283fd5b818501915085601f83011261154f578283fd5b815161155d611352826118d7565b80828252602080830192508086018a82838702890101111561157d578788fd5b8796505b848710156115a7576115938b826113c1565b845260019690960195928101928101611581565b5088015190965093505050808211156115be578283fd5b506115cb85828601611334565b9150509250929050565b600080600080600060a086880312156115ec578081fd5b855180151581146115fb578182fd5b602087015190955061160c816118f7565b604087015190945060028110611620578182fd5b60608701519093506116318161190f565b608087015190925061164281611920565b809150509295509295909350565b600060208284031215611661578081fd5b8135610ab8816118f7565b60006020828403121561167d578081fd5b8135610ab88161190f565b600060208284031215611699578081fd5b5051919050565b6000602082840312156116b1578081fd5b8135610ab881611920565b6000602082840312156116cd578081fd5b815160ff81168114610ab8578182fd5b6001600160a01b0391909116815260200190565b6001600160a01b03938416815291909216602082015262ffffff909116604082015260600190565b602080825282518282018190526000919060409081850190868401855b8281101561176457815180516001600160a01b03168552860151868501529284019290850190600101611736565b5091979650505050505050565b6020808252825182820181905260009190848201906040850190845b818110156117af57835163ffffffff168352928401929184019160010161178d565b50909695505050505050565b6000602080835283518082850152825b818110156117e7578581018301518582016040015282016117cb565b818111156117f85783604083870101525b50601f01601f1916929092016040019392505050565b602080825260029082015261042560f41b604082015260600190565b6020808252600190820152601560fa1b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b62ffffff91909116815260200190565b90815260200190565b63ffffffff91909116815260200190565b60405181810167ffffffffffffffff811182821017156118cf57600080fd5b604052919050565b600067ffffffffffffffff8211156118ed578081fd5b5060209081020190565b6001600160a01b038116811461190c57600080fd5b50565b62ffffff8116811461190c57600080fd5b63ffffffff8116811461190c57600080fdfea26469706673582212205690be246e00d9bf30da35441a160026439ececfa962348f01e498d25f89f5d164736f6c634300060c0033"; +const isSuperArgs$5 = (xs) => xs.length > 1; +class FeeManager__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$5(args)) { + super(...args); + } else { + super(_abi$5, _bytecode$5, args[0]); + } + } + getDeployTransaction(_torn, _governance, _registry, overrides) { + return super.getDeployTransaction( + _torn, + _governance, + _registry, + overrides || {} + ); + } + deploy(_torn, _governance, _registry, overrides) { + return super.deploy( + _torn, + _governance, + _registry, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$5; + static abi = _abi$5; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$5); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$5, runner); + } +} + +const _abi$4 = [ + { + inputs: [ + { + internalType: "address", + name: "_governance", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "GovernanceAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "gasAmount", + type: "uint256" + } + ], + name: "compensateGas", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdrawToGovernance", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$4 = "0x60a060405234801561001057600080fd5b5060405161047838038061047883398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516103da61009e6000396000818160560152818160e101528181610212015261027701526103da6000f3fe6080604052600436106100385760003560e01c8063a3221c2e14610044578063a99ce80714610094578063e822f784146100b657600080fd5b3661003f57005b600080fd5b34801561005057600080fd5b506100787f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200160405180910390f35b3480156100a057600080fd5b506100b46100af366004610328565b6100d6565b005b3480156100c257600080fd5b506100b46100d1366004610360565b610207565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461013e5760405162461bcd60e51b815260206004820152600860248201526737b7363c9033b7bb60c11b60448201526064015b60405180910390fd5b47600061014b4884610379565b90508160000361015b5750505050565b6000846001600160a01b03168383116101745782610176565b835b604051600081818185875af1925050503d80600081146101b2576040519150601f19603f3d011682016040523d82523d6000602084013e6101b7565b606091505b50509050806102005760405162461bcd60e51b815260206004820152601560248201527418dbdb5c195b9cd85d194819d85cc819985a5b1959605a1b6044820152606401610135565b5050505050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461026a5760405162461bcd60e51b815260206004820152600860248201526737b7363c9033b7bb60c11b6044820152606401610135565b4760006001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168284116102a457836102a6565b825b604051600081818185875af1925050503d80600081146102e2576040519150601f19603f3d011682016040523d82523d6000602084013e6102e7565b606091505b50509050806103235760405162461bcd60e51b81526020600482015260086024820152671c185e4819985a5b60c21b6044820152606401610135565b505050565b6000806040838503121561033b57600080fd5b82356001600160a01b038116811461035257600080fd5b946020939093013593505050565b60006020828403121561037257600080fd5b5035919050565b808202811582820484141761039e57634e487b7160e01b600052601160045260246000fd5b9291505056fea2646970667358221220fbe5a836dfa015bd3b2b1ffb61149001940255ee2f1f9b05c13681937e89ff9264736f6c634300081c0033"; +const isSuperArgs$4 = (xs) => xs.length > 1; +class GasCompensationVault__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$4(args)) { + super(...args); + } else { + super(_abi$4, _bytecode$4, args[0]); + } + } + getDeployTransaction(_governance, overrides) { + return super.getDeployTransaction(_governance, overrides || {}); + } + deploy(_governance, overrides) { + return super.deploy(_governance, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$4; + static abi = _abi$4; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$4); + } + static connect(address, runner) { + return new contract/* Contract */.NZ( + address, + _abi$4, + runner + ); + } +} + +const _abi$3 = [ + { + inputs: [ + { + internalType: "address", + name: "_logic", + type: "address" + }, + { + internalType: "bytes", + name: "_data", + type: "bytes" + } + ], + stateMutability: "payable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "previousAdmin", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "AdminChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "implementation", + type: "address" + } + ], + name: "Upgraded", + type: "event" + }, + { + stateMutability: "payable", + type: "fallback" + }, + { + inputs: [], + name: "admin", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "changeAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "implementation", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + } + ], + name: "upgradeTo", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "upgradeToAndCall", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$3 = "0x608060405260405161083b38038061083b8339818101604052604081101561002657600080fd5b81516020830180516040519294929383019291908464010000000082111561004d57600080fd5b90830190602082018581111561006257600080fd5b825164010000000081118282018810171561007c57600080fd5b82525081516020918201929091019080838360005b838110156100a9578181015183820152602001610091565b50505050905090810190601f1680156100d65780820380516001836020036101000a031916815260200191505b50604052508391503090508282816100ed826101c0565b8051156101a5576000826001600160a01b0316826040518082805190602001908083835b602083106101305780518252601f199092019160209182019101610111565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610190576040519150601f19603f3d011682016040523d82523d6000602084013e610195565b606091505b50509050806101a357600080fd5b505b506101ad9050565b6101b682610232565b505050505061025c565b6101d38161025660201b6103b41760201c565b61020e5760405162461bcd60e51b81526004018080602001828103825260368152602001806108056036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3b151590565b61059a8061026b6000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996101a9565b6101a96101a46103ba565b6103df565b565b6101b3610403565b6001600160a01b0316336001600160a01b031614156101da576101d581610428565b6101e2565b6101e2610191565b50565b6101ed610403565b6001600160a01b0316336001600160a01b031614156102855761020f83610428565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610403565b6001600160a01b0316336001600160a01b031614156102c4576102bd6103ba565b90506102cc565b6102cc610191565b90565b6102d7610403565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b815260040180806020018281038252603a8152602001806104f5603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610403565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d581610468565b6000610393610403565b6001600160a01b0316336001600160a01b031614156102c4576102bd610403565b3b151590565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156103fe573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6104318161048c565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610495816103b4565b6104d05760405162461bcd60e51b815260040180806020018281038252603681526020018061052f6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374a264697066735822122014d721b179bdff3154685a6f1f0fecdd0d99b7cfc61b3f1a2f7a95c6f6d2c2ae64736f6c634300060c00335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374"; +const isSuperArgs$3 = (xs) => xs.length > 1; +class LoopbackProxy__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$3(args)) { + super(...args); + } else { + super(_abi$3, _bytecode$3, args[0]); + } + } + getDeployTransaction(_logic, _data, overrides) { + return super.getDeployTransaction(_logic, _data, overrides || {}); + } + deploy(_logic, _data, overrides) { + return super.deploy(_logic, _data, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$3; + static abi = _abi$3; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$3); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$3, runner); + } +} + +const _abi$2 = [ + { + inputs: [ + { + internalType: "bytes", + name: "_initCode", + type: "bytes" + }, + { + internalType: "bytes32", + name: "_salt", + type: "bytes32" + } + ], + name: "deploy", + outputs: [ + { + internalType: "address payable", + name: "createdContract", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$2 = "0x608060405234801561001057600080fd5b50610134806100206000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80634af63f0214602d575b600080fd5b60cf60048036036040811015604157600080fd5b810190602081018135640100000000811115605b57600080fd5b820183602082011115606c57600080fd5b80359060200191846001830284011164010000000083111715608d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550509135925060eb915050565b604080516001600160a01b039092168252519081900360200190f35b6000818351602085016000f5939250505056fea26469706673582212208761ae5cfc40689ce98cd25a56b929c259b167501a941e4f0164890ebab1c0bb64736f6c634300060c0033"; +const isSuperArgs$2 = (xs) => xs.length > 1; +class SingletonFactory__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$2(args)) { + super(...args); + } else { + super(_abi$2, _bytecode$2, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$2; + static abi = _abi$2; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$2); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$2, runner); + } +} + +const _abi$1 = [ + { + inputs: [ + { + internalType: "address", + name: "_governance", + type: "address" + }, + { + internalType: "address", + name: "_instanceRegistry", + type: "address" + }, + { + internalType: "address", + name: "_relayerRegistry", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + }, + { + indexed: false, + internalType: "bytes", + name: "encryptedNote", + type: "bytes" + } + ], + name: "EncryptedNote", + type: "event" + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "_token", + type: "address" + }, + { + internalType: "address", + name: "_spender", + type: "address" + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256" + } + ], + name: "approveExactToken", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes[]", + name: "_encryptedNotes", + type: "bytes[]" + } + ], + name: "backupNotes", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "_tornado", + type: "address" + }, + { + internalType: "bytes32", + name: "_commitment", + type: "bytes32" + }, + { + internalType: "bytes", + name: "_encryptedNote", + type: "bytes" + } + ], + name: "deposit", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "governance", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "instanceRegistry", + outputs: [ + { + internalType: "contract InstanceRegistry", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "relayerRegistry", + outputs: [ + { + internalType: "contract RelayerRegistry", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "_token", + type: "address" + }, + { + internalType: "address payable", + name: "_to", + type: "address" + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256" + } + ], + name: "rescueTokens", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "_tornado", + type: "address" + }, + { + internalType: "bytes", + name: "_proof", + type: "bytes" + }, + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + }, + { + internalType: "address payable", + name: "_recipient", + type: "address" + }, + { + internalType: "address payable", + name: "_relayer", + type: "address" + }, + { + internalType: "uint256", + name: "_fee", + type: "uint256" + }, + { + internalType: "uint256", + name: "_refund", + type: "uint256" + } + ], + name: "withdraw", + outputs: [], + stateMutability: "payable", + type: "function" + } +]; +const _bytecode$1 = "0x60e060405234801561001057600080fd5b5060405161128438038061128483398101604081905261002f91610056565b6001600160601b0319606093841b811660805291831b821660a05290911b1660c0526100ba565b60008060006060848603121561006a578283fd5b8351610075816100a2565b6020850151909350610086816100a2565b6040850151909250610097816100a2565b809150509250925092565b6001600160a01b03811681146100b757600080fd5b50565b60805160601c60a05160601c60c05160601c61117c610108600039806103ff528061059e525080610164528061037a52806103a752806104c8525080610423528061068e525061117c6000f3fe60806040526004361061007b5760003560e01c80635aa6e6751161004e5780635aa6e675146100f55780636485ba2a1461010a578063b438689f1461012a578063cea9d26f1461013d5761007b565b806313d98d131461008057806336a3874b146100955780633ef10783146100c057806347ff589d146100e0575b600080fd5b61009361008e366004610c77565b61015d565b005b3480156100a157600080fd5b506100aa610378565b6040516100b79190610dd0565b60405180910390f35b3480156100cc57600080fd5b506100936100db366004610c37565b61039c565b3480156100ec57600080fd5b506100aa6103fd565b34801561010157600080fd5b506100aa610421565b34801561011657600080fd5b50610093610125366004610b26565b610445565b610093610138366004610cd1565b6104ae565b34801561014957600080fd5b50610093610158366004610c37565b610683565b60008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663032bb443886040518263ffffffff1660e01b81526004016101ae9190610dd0565b60a06040518083038186803b1580156101c657600080fd5b505afa1580156101da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fe9190610bb1565b5092955090935091506000905081600181111561021757fe5b141561023e5760405162461bcd60e51b815260040161023590610f00565b60405180910390fd5b82156102cc576102cc3330896001600160a01b0316638bca6d166040518163ffffffff1660e01b815260040160206040518083038186803b15801561028257600080fd5b505afa158015610296573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ba9190610d72565b6001600160a01b038616929190610817565b60405163b214faa560e01b81526001600160a01b0388169063b214faa59034906102fa908a90600401610e5e565b6000604051808303818588803b15801561031357600080fd5b505af1158015610327573d6000803e3d6000fd5b5050505050336001600160a01b03167ffa28df43db3553771f7209dcef046f3bdfea15870ab625dcda30ac58b82b40088686604051610367929190610e67565b60405180910390a250505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146103e45760405162461bcd60e51b815260040161023590611087565b6103f86001600160a01b0384168383610875565b505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60005b818110156103f857337ffa28df43db3553771f7209dcef046f3bdfea15870ab625dcda30ac58b82b400884848481811061047e57fe5b905060200281019061049091906110af565b60405161049e929190610e67565b60405180910390a2600101610448565b60405163032bb44360e01b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063032bb443906104fd908d90600401610dd0565b60a06040518083038186803b15801561051557600080fd5b505afa158015610529573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054d9190610bb1565b509093506000925061055d915050565b81600181111561056957fe5b14156105875760405162461bcd60e51b815260040161023590610f00565b604051631168473b60e21b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906345a11cec906105d790339088908f90600401610de4565b600060405180830381600087803b1580156105f157600080fd5b505af1158015610605573d6000803e3d6000fd5b50506040516310d056db60e11b81526001600160a01b038d1692506321a0adb691503490610645908d908d908d908d908d908d908d908d90600401610e7b565b6000604051808303818588803b15801561065e57600080fd5b505af1158015610672573d6000803e3d6000fd5b505050505050505050505050505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146106cb5760405162461bcd60e51b815260040161023590611087565b6001600160a01b0382166106f15760405162461bcd60e51b815260040161023590610f6e565b6001600160a01b03831661074d5747600061070c8284610938565b6040519091506001600160a01b0385169082156108fc029083906000818181858888f19350505050158015610745573d6000803e3d6000fd5b5050506103f8565b6040516370a0823160e01b81526000906001600160a01b038516906370a082319061077c903090600401610dd0565b60206040518083038186803b15801561079457600080fd5b505afa1580156107a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107cc9190610d72565b905060006107da8284610938565b9050600081116107fc5760405162461bcd60e51b815260040161023590610ffa565b6108106001600160a01b0386168583610950565b5050505050565b61086f846323b872dd60e01b85858560405160240161083893929190610e21565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261096f565b50505050565b8015806108fd5750604051636eb1769f60e11b81526001600160a01b0384169063dd62ed3e906108ab9030908690600401610e07565b60206040518083038186803b1580156108c357600080fd5b505afa1580156108d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108fb9190610d72565b155b6109195760405162461bcd60e51b815260040161023590611031565b6103f88363095ea7b360e01b8484604051602401610838929190610e45565b60008183106109475781610949565b825b9392505050565b6103f88363a9059cbb60e01b8484604051602401610838929190610e45565b60606109c4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166109fe9092919063ffffffff16565b8051909150156103f857808060200190518101906109e29190610b95565b6103f85760405162461bcd60e51b815260040161023590610fb0565b6060610a0d8484600085610a15565b949350505050565b6060610a2085610ad9565b610a3c5760405162461bcd60e51b815260040161023590610f37565b60006060866001600160a01b03168587604051610a599190610db4565b60006040518083038185875af1925050503d8060008114610a96576040519150601f19603f3d011682016040523d82523d6000602084013e610a9b565b606091505b50915091508115610aaf579150610a0d9050565b805115610abf5780518082602001fd5b8360405162461bcd60e51b81526004016102359190610ecd565b3b151590565b60008083601f840112610af0578182fd5b50813567ffffffffffffffff811115610b07578182fd5b602083019150836020828501011115610b1f57600080fd5b9250929050565b60008060208385031215610b38578182fd5b823567ffffffffffffffff80821115610b4f578384fd5b818501915085601f830112610b62578384fd5b813581811115610b70578485fd5b8660208083028501011115610b83578485fd5b60209290920196919550909350505050565b600060208284031215610ba6578081fd5b815161094981611138565b600080600080600060a08688031215610bc8578081fd5b8551610bd381611138565b6020870151909550610be481611120565b604087015190945060028110610bf8578182fd5b606087015190935062ffffff81168114610c10578182fd5b608087015190925063ffffffff81168114610c29578182fd5b809150509295509295909350565b600080600060608486031215610c4b578283fd5b8335610c5681611120565b92506020840135610c6681611120565b929592945050506040919091013590565b60008060008060608587031215610c8c578384fd5b8435610c9781611120565b935060208501359250604085013567ffffffffffffffff811115610cb9578283fd5b610cc587828801610adf565b95989497509550505050565b60008060008060008060008060006101008a8c031215610cef578384fd5b8935610cfa81611120565b985060208a013567ffffffffffffffff811115610d15578485fd5b610d218c828d01610adf565b90995097505060408a0135955060608a0135945060808a0135610d4381611120565b935060a08a0135610d5381611120565b8093505060c08a0135915060e08a013590509295985092959850929598565b600060208284031215610d83578081fd5b5051919050565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b60008251610dc68184602087016110f4565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0393841681529183166020830152909116604082015260600190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b90815260200190565b600060208252610a0d602083018486610d8a565b600060e08252610e8f60e083018a8c610d8a565b60208301989098525060408101959095526001600160a01b03938416606086015291909216608084015260a083019190915260c09091015292915050565b6000602082528251806020840152610eec8160408501602087016110f4565b601f01601f19169190910160400192915050565b6020808252601d908201527f54686520696e7374616e6365206973206e6f7420737570706f72746564000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526022908201527f544f524e3a2063616e206e6f742073656e6420746f207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252601e908201527f544f524e3a20747279696e6720746f2073656e6420302062616c616e63650000604082015260600190565b60208082526036908201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60408201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606082015260800190565b6020808252600e908201526d139bdd08185d5d1a1bdc9a5e995960921b604082015260600190565b6000808335601e198436030181126110c5578283fd5b83018035915067ffffffffffffffff8211156110df578283fd5b602001915036819003821315610b1f57600080fd5b60005b8381101561110f5781810151838201526020016110f7565b8381111561086f5750506000910152565b6001600160a01b038116811461113557600080fd5b50565b801515811461113557600080fdfea264697066735822122004c0e245ab0b87d2916977a9650f299de2e526143487c917a63e4b88e54387e364736f6c634300060c0033"; +const isSuperArgs$1 = (xs) => xs.length > 1; +class TornadoRouter__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$1(args)) { + super(...args); + } else { + super(_abi$1, _bytecode$1, args[0]); + } + } + getDeployTransaction(_governance, _instanceRegistry, _relayerRegistry, overrides) { + return super.getDeployTransaction( + _governance, + _instanceRegistry, + _relayerRegistry, + overrides || {} + ); + } + deploy(_governance, _instanceRegistry, _relayerRegistry, overrides) { + return super.deploy( + _governance, + _instanceRegistry, + _relayerRegistry, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$1; + static abi = _abi$1; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi$1); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi$1, runner); + } +} + +const _abi = [ + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + }, + { + internalType: "address", + name: "_governance", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdrawTorn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode = "0x60c060405234801561001057600080fd5b506040516104aa3803806104aa8339818101604052604081101561003357600080fd5b5080516020909101516001600160601b0319606092831b8116608052911b1660a05260805160601c60a05160601c61042e61007c60003980606952508060d3525061042e6000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806391fe357314610030575b600080fd5b61005c6004803603604081101561004657600080fd5b506001600160a01b03813516906020013561005e565b005b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146100c6576040805162461bcd60e51b815260206004820152600860248201526737b7363c9033b7bb60c11b604482015290519081900360640190fd5b6100fa6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001683836100fe565b5050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610150908490610155565b505050565b60606101aa826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166102069092919063ffffffff16565b805190915015610150578080602001905160208110156101c957600080fd5b50516101505760405162461bcd60e51b815260040180806020018281038252602a8152602001806103cf602a913960400191505060405180910390fd5b6060610215848460008561021d565b949350505050565b6060610228856103c8565b610279576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106102b85780518252601f199092019160209182019101610299565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461031a576040519150601f19603f3d011682016040523d82523d6000602084013e61031f565b606091505b509150915081156103335791506102159050565b8051156103435780518082602001fd5b8360405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561038d578181015183820152602001610375565b50505050905090810190601f1680156103ba5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b3b15159056fe5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a26469706673582212208fc65ae8299d617f6cff836a2822363849c7fb35b0b27a6f0aebfa62084005c764736f6c634300060c0033"; +const isSuperArgs = (xs) => xs.length > 1; +class TornadoVault__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs(args)) { + super(...args); + } else { + super(_abi, _bytecode, args[0]); + } + } + getDeployTransaction(_torn, _governance, overrides) { + return super.getDeployTransaction(_torn, _governance, overrides || {}); + } + deploy(_torn, _governance, overrides) { + return super.deploy(_torn, _governance, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode; + static abi = _abi; + static createInterface() { + return new abi_interface/* Interface */.KA(_abi); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, _abi, runner); + } +} + +var index$2 = /*#__PURE__*/Object.freeze({ + __proto__: null, + AdminUpgradeableProxy__factory: AdminUpgradeableProxy__factory, + FeeManager__factory: FeeManager__factory, + GasCompensationVault__factory: GasCompensationVault__factory, + LoopbackProxy__factory: LoopbackProxy__factory, + SingletonFactory__factory: SingletonFactory__factory, + TornadoRouter__factory: TornadoRouter__factory, + TornadoVault__factory: TornadoVault__factory, + aggregator: index$z, + deployerSol: index$y, + instanceRegistrySol: index$x, + interfaces: index$k, + libraries: index$i, + relayerRegistrySol: index$w, + testnet: index$r, + torn: index$t, + tornadoStakingRewardsSol: index$q, + uniswap: index$l, + v1: index$d, + v2VaultAndGas: index$a, + v3RelayerRegistry: index$8, + v4ExploitPatch: index$4, + v5ProposalStatePatch: index$3 +}); + +var index$1 = /*#__PURE__*/Object.freeze({ + __proto__: null, + classic: index$B, + governance: index$2 +}); + +var index = /*#__PURE__*/Object.freeze({ + __proto__: null, + contracts: index$1, + openzeppelin: index$I +}); + + + +// EXTERNAL MODULE: ./src/batch.ts +var batch = __webpack_require__(9723); +// EXTERNAL MODULE: ./src/providers.ts + 39 modules +var providers = __webpack_require__(46170); +// EXTERNAL MODULE: ./src/networkConfig.ts +var networkConfig = __webpack_require__(59499); +// EXTERNAL MODULE: ./src/relayerClient.ts +var relayerClient = __webpack_require__(57194); +;// ./src/events/base.ts + + + + + -const DEPOSIT = "deposit"; -const WITHDRAWAL = "withdrawal"; class BaseEventsService { + netId; + provider; + contract; + type; + deployedBlock; + batchEventsService; + fetchDataOptions; + tovarishClient; constructor({ netId, provider, - graphApi, - subgraphName, contract, type = "", deployedBlock = 0, - fetchDataOptions: fetchDataOptions2 + fetchDataOptions: fetchDataOptions2, + tovarishClient }) { this.netId = netId; this.provider = provider; - this.graphApi = graphApi; - this.subgraphName = subgraphName; this.fetchDataOptions = fetchDataOptions2; this.contract = contract; this.type = type; this.deployedBlock = deployedBlock; - this.batchEventsService = new _batch__WEBPACK_IMPORTED_MODULE_1__/* .BatchEventsService */ .JY({ + this.batchEventsService = new batch/* BatchEventsService */.JY({ provider, contract, onProgress: this.updateEventProgress }); + this.tovarishClient = tovarishClient; } getInstanceName() { return ""; @@ -60909,16 +92207,8 @@ class BaseEventsService { getType() { return this.type || ""; } - getGraphMethod() { - return ""; - } - getGraphParams() { - return { - graphApi: this.graphApi || "", - subgraphName: this.subgraphName || "", - fetchDataOptions: this.fetchDataOptions, - onProgress: this.updateGraphProgress - }; + getTovarishType() { + return String(this.getType() || "").toLowerCase(); } /* eslint-disable @typescript-eslint/no-unused-vars */ updateEventProgress({ percentage, type, fromBlock, toBlock, count }) { @@ -60927,186 +92217,160 @@ class BaseEventsService { } updateTransactionProgress({ percentage, currentIndex, totalIndex }) { } - updateGraphProgress({ type, fromBlock, toBlock, count }) { - } /* eslint-enable @typescript-eslint/no-unused-vars */ - formatEvents(events) { - return __async(this, null, function* () { - return yield new Promise((resolve) => resolve(events)); - }); + async formatEvents(events) { + return await new Promise((resolve) => resolve(events)); } /** * Get saved or cached events */ - getEventsFromDB() { - return __async(this, null, function* () { - return { - events: [], - lastBlock: null - }; - }); - } - getEventsFromCache() { - return __async(this, null, function* () { - return { - events: [], - lastBlock: null - }; - }); - } - getSavedEvents() { - return __async(this, null, function* () { - let cachedEvents = yield this.getEventsFromDB(); - if (!cachedEvents || !cachedEvents.events.length) { - cachedEvents = yield this.getEventsFromCache(); - } - return cachedEvents; - }); + async getEventsFromDB() { + return { + events: [], + lastBlock: 0 + }; } /** - * Get latest events + * Events from remote cache (Either from local cache, CDN, or from IPFS) */ - getEventsFromGraph(_0) { - return __async(this, arguments, function* ({ - fromBlock, - methodName = "" - }) { - if (!this.graphApi || !this.subgraphName) { + async getEventsFromCache() { + return { + events: [], + lastBlock: 0, + fromCache: true + }; + } + async getSavedEvents() { + let dbEvents = await this.getEventsFromDB(); + if (!dbEvents.lastBlock) { + dbEvents = await this.getEventsFromCache(); + } + return dbEvents; + } + async getEventsFromRpc({ + fromBlock, + toBlock + }) { + try { + if (!toBlock) { + toBlock = await this.provider.getBlockNumber(); + } + if (fromBlock >= toBlock) { return { events: [], - lastBlock: fromBlock - }; - } - const { events, lastSyncBlock } = yield _graphql__WEBPACK_IMPORTED_MODULE_0__[methodName || this.getGraphMethod()](__spreadValues({ - fromBlock - }, this.getGraphParams())); - return { - events, - lastBlock: lastSyncBlock - }; - }); - } - getEventsFromRpc(_0) { - return __async(this, arguments, function* ({ - fromBlock, - toBlock - }) { - try { - if (!toBlock) { - toBlock = yield this.provider.getBlockNumber(); - } - if (fromBlock >= toBlock) { - return { - events: [], - lastBlock: toBlock - }; - } - this.updateEventProgress({ percentage: 0, type: this.getType() }); - const events = yield this.formatEvents( - yield this.batchEventsService.getBatchEvents({ fromBlock, toBlock, type: this.getType() }) - ); - if (!events.length) { - return { - events, - lastBlock: toBlock - }; - } - return { - events, lastBlock: toBlock }; - } catch (err) { - console.log(err); - return { - events: [], - lastBlock: fromBlock - }; } - }); - } - getLatestEvents(_0) { - return __async(this, arguments, function* ({ fromBlock }) { - const allEvents = []; - const graphEvents = yield this.getEventsFromGraph({ fromBlock }); - const lastSyncBlock = graphEvents.lastBlock && graphEvents.lastBlock >= fromBlock ? graphEvents.lastBlock : fromBlock; - const rpcEvents = yield this.getEventsFromRpc({ fromBlock: lastSyncBlock }); - allEvents.push(...graphEvents.events); - allEvents.push(...rpcEvents.events); - const lastBlock = rpcEvents ? rpcEvents.lastBlock : allEvents[allEvents.length - 1] ? allEvents[allEvents.length - 1].blockNumber : fromBlock; + this.updateEventProgress({ percentage: 0, type: this.getType() }); + const events = await this.formatEvents( + await this.batchEventsService.getBatchEvents({ + fromBlock, + toBlock, + type: this.getType() + }) + ); return { - events: allEvents, + events, + lastBlock: toBlock + }; + } catch (err) { + console.log(err); + return { + events: [], + lastBlock: fromBlock + }; + } + } + async getLatestEvents({ fromBlock }) { + if (this.tovarishClient?.selectedRelayer) { + const { events, lastSyncBlock: lastBlock } = await this.tovarishClient.getEvents({ + type: this.getTovarishType(), + fromBlock + }); + return { + events, lastBlock }; + } + return await this.getEventsFromRpc({ + fromBlock }); } - // eslint-disable-next-line @typescript-eslint/no-unused-vars - validateEvents({ events, lastBlock }) { + /* eslint-disable @typescript-eslint/no-unused-vars */ + async validateEvents({ + events, + newEvents, + lastBlock + }) { + return void 0; } + /* eslint-enable @typescript-eslint/no-unused-vars */ /** * Handle saving events */ // eslint-disable-next-line @typescript-eslint/no-unused-vars - saveEvents(_0) { - return __async(this, arguments, function* ({ events, lastBlock }) { - }); + async saveEvents({ events, newEvents, lastBlock }) { } /** * Trigger saving and receiving latest events */ - updateEvents() { - return __async(this, null, function* () { - const savedEvents = yield this.getSavedEvents(); - let fromBlock = this.deployedBlock; - if (savedEvents && savedEvents.lastBlock) { - fromBlock = savedEvents.lastBlock + 1; + async updateEvents() { + const savedEvents = await this.getSavedEvents(); + let fromBlock = this.deployedBlock; + if (savedEvents && savedEvents.lastBlock) { + fromBlock = savedEvents.lastBlock + 1; + } + const newEvents = await this.getLatestEvents({ fromBlock }); + const eventSet = /* @__PURE__ */ new Set(); + const allEvents = [...savedEvents.events, ...newEvents.events].sort((a, b) => { + if (a.blockNumber === b.blockNumber) { + return a.logIndex - b.logIndex; } - const newEvents = yield this.getLatestEvents({ fromBlock }); - const eventSet = /* @__PURE__ */ new Set(); - let allEvents = []; - allEvents.push(...savedEvents.events); - allEvents.push(...newEvents.events); - allEvents = allEvents.sort((a, b) => { - if (a.blockNumber === b.blockNumber) { - return a.logIndex - b.logIndex; - } - return a.blockNumber - b.blockNumber; - }).filter(({ transactionHash, logIndex }) => { - const eventKey = `${transactionHash}_${logIndex}`; - const hasEvent = eventSet.has(eventKey); - eventSet.add(eventKey); - return !hasEvent; - }); - const lastBlock = newEvents ? newEvents.lastBlock : allEvents[allEvents.length - 1] ? allEvents[allEvents.length - 1].blockNumber : null; - this.validateEvents({ events: allEvents, lastBlock }); - this.saveEventsPromise = this.saveEvents({ events: allEvents, lastBlock }); - return { - events: allEvents, - lastBlock - }; + return a.blockNumber - b.blockNumber; + }).filter(({ transactionHash, logIndex }) => { + const eventKey = `${transactionHash}_${logIndex}`; + const hasEvent = eventSet.has(eventKey); + eventSet.add(eventKey); + return !hasEvent; }); + const lastBlock = newEvents.lastBlock || allEvents[allEvents.length - 1]?.blockNumber; + const validateResult = await this.validateEvents({ + events: allEvents, + newEvents: newEvents.events, + lastBlock + }); + if (savedEvents.fromCache || newEvents.events.length) { + await this.saveEvents({ events: allEvents, newEvents: newEvents.events, lastBlock }); + } + return { + events: allEvents, + lastBlock, + validateResult + }; } } class BaseTornadoService extends BaseEventsService { - constructor({ - netId, - provider, - graphApi, - subgraphName, - Tornado, - type, - amount, - currency, - deployedBlock, - fetchDataOptions: fetchDataOptions2 - }) { - super({ netId, provider, graphApi, subgraphName, contract: Tornado, type, deployedBlock, fetchDataOptions: fetchDataOptions2 }); + amount; + currency; + optionalTree; + merkleTreeService; + batchTransactionService; + batchBlockService; + constructor(serviceConstructor) { + const { Tornado: contract, amount, currency, provider, optionalTree, merkleTreeService } = serviceConstructor; + super({ + ...serviceConstructor, + contract + }); this.amount = amount; this.currency = currency; - this.batchTransactionService = new _batch__WEBPACK_IMPORTED_MODULE_1__/* .BatchTransactionService */ .AF({ + this.optionalTree = optionalTree; + this.merkleTreeService = merkleTreeService; + this.batchTransactionService = new batch/* BatchTransactionService */.AF({ provider, onProgress: this.updateTransactionProgress }); - this.batchBlockService = new _batch__WEBPACK_IMPORTED_MODULE_1__/* .BatchBlockService */ .B3({ + this.batchBlockService = new batch/* BatchBlockService */.B3({ provider, onProgress: this.updateBlockProgress }); @@ -61114,179 +92378,372 @@ class BaseTornadoService extends BaseEventsService { getInstanceName() { return `${this.getType().toLowerCase()}s_${this.netId}_${this.currency}_${this.amount}`; } - getGraphMethod() { - return `getAll${this.getType()}s`; + async formatEvents(events) { + const type = this.getType(); + if (type === "Deposit") { + const txs = await this.batchTransactionService.getBatchTransactions([ + ...new Set(events.map(({ transactionHash }) => transactionHash)) + ]); + return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { + const { commitment, leafIndex, timestamp } = args; + return { + blockNumber, + logIndex, + transactionHash, + commitment, + leafIndex: Number(leafIndex), + timestamp: Number(timestamp), + from: txs.find(({ hash }) => hash === transactionHash)?.from || "" + }; + }); + } else { + const blocks = await this.batchBlockService.getBatchBlocks([ + ...new Set(events.map(({ blockNumber }) => blockNumber)) + ]); + return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { + const { nullifierHash, to, fee } = args; + return { + blockNumber, + logIndex, + transactionHash, + nullifierHash: String(nullifierHash), + to: (0,address/* getAddress */.b)(to), + fee: String(fee), + timestamp: blocks.find(({ number }) => number === blockNumber)?.timestamp || 0 + }; + }); + } } - getGraphParams() { - return { - graphApi: this.graphApi || "", - subgraphName: this.subgraphName || "", - amount: this.amount, - currency: this.currency, - fetchDataOptions: this.fetchDataOptions, - onProgress: this.updateGraphProgress - }; + async validateEvents({ + events, + newEvents + }) { + if (events.length && this.getType() === "Deposit") { + const depositEvents = events; + const lastEvent = depositEvents[depositEvents.length - 1]; + if (lastEvent.leafIndex !== depositEvents.length - 1) { + const errMsg = `Deposit events invalid wants ${depositEvents.length - 1} leafIndex have ${lastEvent.leafIndex}`; + throw new Error(errMsg); + } + if (this.merkleTreeService && (!this.optionalTree || newEvents.length)) { + return await this.merkleTreeService.verifyTree(depositEvents); + } + } + return void 0; } - formatEvents(events) { - return __async(this, null, function* () { - const type = this.getType().toLowerCase(); - if (type === DEPOSIT) { - const formattedEvents = events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { + async getLatestEvents({ + fromBlock + }) { + if (this.tovarishClient?.selectedRelayer) { + const { events, lastSyncBlock: lastBlock } = await this.tovarishClient.getEvents({ + type: this.getTovarishType(), + currency: this.currency, + amount: this.amount, + fromBlock + }); + return { + events, + lastBlock + }; + } + return await this.getEventsFromRpc({ + fromBlock + }); + } +} +class BaseMultiTornadoService extends BaseEventsService { + instances; + optionalTree; + merkleTreeService; + batchTransactionService; + batchBlockService; + constructor(serviceConstructor) { + const { instances, provider, optionalTree, merkleTreeService } = serviceConstructor; + const contract = merkleTreeService?.Tornado || Tornado__factory.connect(Object.keys(instances)[0], provider); + super({ + ...serviceConstructor, + contract, + type: "*" + }); + this.batchEventsService = new batch/* BatchEventsService */.JY({ + provider, + contract, + address: Object.keys(instances), + onProgress: this.updateEventProgress + }); + this.instances = instances; + this.optionalTree = optionalTree; + this.merkleTreeService = merkleTreeService; + this.batchTransactionService = new batch/* BatchTransactionService */.AF({ + provider, + onProgress: this.updateTransactionProgress + }); + this.batchBlockService = new batch/* BatchBlockService */.B3({ + provider, + onProgress: this.updateBlockProgress + }); + } + getInstanceName() { + return `tornado_${this.netId}`; + } + getTovarishType() { + return "tornado"; + } + async formatEvents(events) { + const txs = await this.batchTransactionService.getBatchTransactions([ + ...new Set( + events.filter(({ eventName }) => eventName === "Deposit").map(({ transactionHash }) => transactionHash) + ) + ]); + const blocks = await this.batchBlockService.getBatchBlocks([ + ...new Set( + events.filter(({ eventName }) => eventName === "Withdrawal").map(({ blockNumber }) => blockNumber) + ) + ]); + return events.map( + ({ + address: instanceAddress, + blockNumber, + index: logIndex, + transactionHash, + args, + eventName: event + }) => { + const eventObjects = { + blockNumber, + logIndex, + transactionHash, + event, + instanceAddress + }; + if (event === "Deposit") { const { commitment, leafIndex, timestamp } = args; return { - blockNumber, - logIndex, - transactionHash, + ...eventObjects, commitment, leafIndex: Number(leafIndex), - timestamp: Number(timestamp) + timestamp: Number(timestamp), + from: txs.find(({ hash }) => hash === transactionHash)?.from || "" }; - }); - const txs = yield this.batchTransactionService.getBatchTransactions([ - ...new Set(formattedEvents.map(({ transactionHash }) => transactionHash)) - ]); - return formattedEvents.map((event) => { - const { from } = txs.find(({ hash }) => hash === event.transactionHash); - return __spreadProps(__spreadValues({}, event), { - from - }); - }); - } else { - const formattedEvents = events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { - const { nullifierHash, to, fee } = args; + } + if (event === "Withdrawal") { + const { nullifierHash, to, relayer: relayerAddress, fee } = args; return { - blockNumber, + ...eventObjects, logIndex, transactionHash, nullifierHash: String(nullifierHash), - to: (0,ethers__WEBPACK_IMPORTED_MODULE_2__/* .getAddress */ .b)(to), - fee: String(fee) + to, + relayerAddress, + fee: String(fee), + timestamp: blocks.find(({ number }) => number === blockNumber)?.timestamp || 0 }; - }); - const blocks = yield this.batchBlockService.getBatchBlocks([ - ...new Set(formattedEvents.map(({ blockNumber }) => blockNumber)) - ]); - return formattedEvents.map((event) => { - const { timestamp } = blocks.find(({ number }) => number === event.blockNumber); - return __spreadProps(__spreadValues({}, event), { - timestamp - }); - }); + } } - }); + ).filter((e) => e); } - validateEvents({ events }) { - if (events.length && this.getType().toLowerCase() === DEPOSIT) { - const lastEvent = events[events.length - 1]; - if (lastEvent.leafIndex !== events.length - 1) { - const errMsg = `Deposit events invalid wants ${events.length - 1} leafIndex have ${lastEvent.leafIndex}`; + async validateEvents({ + events, + newEvents + }) { + const instancesWithNewEvents = [ + ...new Set( + newEvents.filter(({ event }) => event === "Deposit").map(({ instanceAddress }) => instanceAddress) + ) + ]; + let tree; + const requiredTree = this.merkleTreeService?.Tornado?.target; + if (requiredTree && !instancesWithNewEvents.includes(requiredTree)) { + instancesWithNewEvents.push(requiredTree); + } + for (const instance of instancesWithNewEvents) { + const depositEvents = events.filter( + ({ instanceAddress, event }) => instanceAddress === instance && event === "Deposit" + ); + const lastEvent = depositEvents[depositEvents.length - 1]; + if (lastEvent.leafIndex !== depositEvents.length - 1) { + const errMsg = `Invalid deposit events for ${instance} wants ${depositEvents.length - 1} leafIndex have ${lastEvent.leafIndex}`; throw new Error(errMsg); } + if (requiredTree === instance && !this.optionalTree) { + tree = await this.merkleTreeService?.verifyTree(depositEvents); + } } + return tree; + } + async getEvents(instanceAddress) { + const { events, validateResult: tree, lastBlock } = await this.updateEvents(); + const { depositEvents, withdrawalEvents } = events.reduce( + (acc, curr) => { + if (curr.instanceAddress === instanceAddress) { + if (curr.event === "Deposit") { + acc.depositEvents.push(curr); + } else if (curr.event === "Withdrawal") { + acc.withdrawalEvents.push(curr); + } + } + return acc; + }, + {} + ); + return { + depositEvents, + withdrawalEvents, + tree, + lastBlock + }; } } class BaseEchoService extends BaseEventsService { - constructor({ - netId, - provider, - graphApi, - subgraphName, - Echoer, - deployedBlock, - fetchDataOptions: fetchDataOptions2 - }) { - super({ netId, provider, graphApi, subgraphName, contract: Echoer, deployedBlock, fetchDataOptions: fetchDataOptions2 }); + constructor(serviceConstructor) { + super({ + ...serviceConstructor, + contract: serviceConstructor.Echoer, + type: "Echo" + }); } getInstanceName() { return `echo_${this.netId}`; } - getType() { - return "Echo"; - } - getGraphMethod() { - return "getAllGraphEchoEvents"; - } - formatEvents(events) { - return __async(this, null, function* () { - return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { - const { who, data } = args; - if (who && data) { - const eventObjects = { - blockNumber, - logIndex, - transactionHash - }; - return __spreadProps(__spreadValues({}, eventObjects), { - address: who, - encryptedAccount: data - }); - } - }).filter((e) => e); - }); - } - getEventsFromGraph(_0) { - return __async(this, arguments, function* ({ fromBlock }) { - if (!this.graphApi || this.graphApi.includes("api.thegraph.com")) { + async formatEvents(events) { + return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { + const { who, data } = args; + if (who && data) { + const eventObjects = { + blockNumber, + logIndex, + transactionHash + }; return { - events: [], - lastBlock: fromBlock + ...eventObjects, + address: who, + encryptedAccount: data }; } - return __superGet(BaseEchoService.prototype, this, "getEventsFromGraph").call(this, { fromBlock }); - }); + }).filter((e) => e); } } class BaseEncryptedNotesService extends BaseEventsService { - constructor({ - netId, - provider, - graphApi, - subgraphName, - Router, - deployedBlock, - fetchDataOptions: fetchDataOptions2 - }) { - super({ netId, provider, graphApi, subgraphName, contract: Router, deployedBlock, fetchDataOptions: fetchDataOptions2 }); + constructor(serviceConstructor) { + super({ + ...serviceConstructor, + contract: serviceConstructor.Router, + type: "EncryptedNote" + }); } getInstanceName() { return `encrypted_notes_${this.netId}`; } - getType() { - return "EncryptedNote"; + getTovarishType() { + return "encrypted_notes"; } - getGraphMethod() { - return "getAllEncryptedNotes"; + async formatEvents(events) { + return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { + const { encryptedNote } = args; + if (encryptedNote && encryptedNote !== "0x") { + const eventObjects = { + blockNumber, + logIndex, + transactionHash + }; + return { + ...eventObjects, + encryptedNote + }; + } + }).filter((e) => e); } - formatEvents(events) { - return __async(this, null, function* () { - return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { - const { encryptedNote } = args; - if (encryptedNote) { - const eventObjects = { - blockNumber, - logIndex, - transactionHash - }; - return __spreadProps(__spreadValues({}, eventObjects), { - encryptedNote - }); - } - }).filter((e) => e); - }); +} +const abiCoder = abi_coder/* AbiCoder */.y.defaultAbiCoder(); +const proposalState = { + 0: "Pending", + 1: "Active", + 2: "Defeated", + 3: "Timelocked", + 4: "AwaitingExecution", + 5: "Executed", + 6: "Expired" +}; +function parseDescription(id, text) { + switch (id) { + case 1: + return { + title: text, + description: "See: https://torn.community/t/proposal-1-enable-torn-transfers/38" + }; + case 10: + text = text.replace("\n", "\\n\\n"); + break; + case 11: + text = text.replace('"description"', ',"description"'); + break; + case 13: + text = text.replace(/\\\\n\\\\n(\s)?(\\n)?/g, "\\n"); + break; + case 15: + text = text.replaceAll("'", '"'); + text = text.replace('"description"', ',"description"'); + break; + case 16: + text = text.replace("#16: ", ""); + break; + case 21: + return { + title: "Proposal #21: Restore Governance", + description: "" + }; + } + let title, description, rest; + try { + ({ title, description } = JSON.parse(text)); + } catch { + [title, ...rest] = text.split("\n", 2); + description = rest.join("\n"); + } + return { + title, + description + }; +} +function parseComment(Governance2, calldata) { + try { + const methodLength = 4; + const result = abiCoder.decode(["address[]", "uint256", "bool"], (0,utils_data/* dataSlice */.ZG)(calldata, methodLength)); + const data = Governance2.interface.encodeFunctionData( + // @ts-expect-error encodeFunctionData is broken lol + "castDelegatedVote", + result + ); + const length = (0,utils_data/* dataLength */.pO)(data); + const str = abiCoder.decode(["string"], (0,utils_data/* dataSlice */.ZG)(calldata, length))[0]; + const [contact, message] = JSON.parse(str); + return { + contact, + message + }; + } catch { + return { + contact: "", + message: "" + }; } } class BaseGovernanceService extends BaseEventsService { - constructor({ - netId, - provider, - graphApi, - subgraphName, - Governance, - deployedBlock, - fetchDataOptions: fetchDataOptions2 - }) { - super({ netId, provider, graphApi, subgraphName, contract: Governance, deployedBlock, fetchDataOptions: fetchDataOptions2 }); - this.batchTransactionService = new _batch__WEBPACK_IMPORTED_MODULE_1__/* .BatchTransactionService */ .AF({ + Governance; + Aggregator; + ReverseRecords; + batchTransactionService; + constructor(serviceConstructor) { + const { Governance: Governance2, Aggregator: Aggregator2, ReverseRecords, provider } = serviceConstructor; + super({ + ...serviceConstructor, + contract: Governance2, + type: "*" + }); + this.Governance = Governance2; + this.Aggregator = Aggregator2; + this.ReverseRecords = ReverseRecords; + this.batchTransactionService = new batch/* BatchTransactionService */.AF({ provider, onProgress: this.updateTransactionProgress }); @@ -61294,132 +92751,839 @@ class BaseGovernanceService extends BaseEventsService { getInstanceName() { return `governance_${this.netId}`; } - getType() { - return "*"; + getTovarishType() { + return "governance"; } - getGraphMethod() { - return "getAllGovernanceEvents"; - } - formatEvents(events) { - return __async(this, null, function* () { - const proposalEvents = []; - const votedEvents = []; - const delegatedEvents = []; - const undelegatedEvents = []; - events.forEach(({ blockNumber, index: logIndex, transactionHash, args, eventName: event }) => { - const eventObjects = { - blockNumber, - logIndex, - transactionHash, - event - }; - if (event === "ProposalCreated") { - const { id, proposer, target, startTime, endTime, description } = args; - proposalEvents.push(__spreadProps(__spreadValues({}, eventObjects), { - id: Number(id), - proposer, - target, - startTime: Number(startTime), - endTime: Number(endTime), - description - })); - } - if (event === "Voted") { - const { proposalId, voter, support, votes } = args; - votedEvents.push(__spreadProps(__spreadValues({}, eventObjects), { - proposalId: Number(proposalId), - voter, - support, - votes, - from: "", - input: "" - })); - } - if (event === "Delegated") { - const { account, to: delegateTo } = args; - delegatedEvents.push(__spreadProps(__spreadValues({}, eventObjects), { - account, - delegateTo - })); - } - if (event === "Undelegated") { - const { account, from: delegateFrom } = args; - undelegatedEvents.push(__spreadProps(__spreadValues({}, eventObjects), { - account, - delegateFrom - })); - } - }); - if (votedEvents.length) { - this.updateTransactionProgress({ percentage: 0 }); - const txs = yield this.batchTransactionService.getBatchTransactions([ - ...new Set(votedEvents.map(({ transactionHash }) => transactionHash)) - ]); - votedEvents.forEach((event, index) => { - let { data: input, from } = txs.find((t) => t.hash === event.transactionHash); - if (!input || input.length > 2048) { - input = ""; - } - votedEvents[index].from = from; - votedEvents[index].input = input; + async formatEvents(events) { + const proposalEvents = []; + const votedEvents = []; + const delegatedEvents = []; + const undelegatedEvents = []; + events.forEach(({ blockNumber, index: logIndex, transactionHash, args, eventName: event }) => { + const eventObjects = { + blockNumber, + logIndex, + transactionHash, + event + }; + if (event === "ProposalCreated") { + const { id, proposer, target, startTime, endTime, description } = args; + proposalEvents.push({ + ...eventObjects, + id: Number(id), + proposer, + target, + startTime: Number(startTime), + endTime: Number(endTime), + description }); } - return [...proposalEvents, ...votedEvents, ...delegatedEvents, ...undelegatedEvents]; + if (event === "Voted") { + const { proposalId, voter, support, votes } = args; + votedEvents.push({ + ...eventObjects, + proposalId: Number(proposalId), + voter, + support, + votes, + from: "", + input: "" + }); + } + if (event === "Delegated") { + const { account, to: delegateTo } = args; + delegatedEvents.push({ + ...eventObjects, + account, + delegateTo + }); + } + if (event === "Undelegated") { + const { account, from: delegateFrom } = args; + undelegatedEvents.push({ + ...eventObjects, + account, + delegateFrom + }); + } + }); + if (votedEvents.length) { + this.updateTransactionProgress({ percentage: 0 }); + const txs = await this.batchTransactionService.getBatchTransactions([ + ...new Set(votedEvents.map(({ transactionHash }) => transactionHash)) + ]); + votedEvents.forEach((event, index) => { + let { data: input, from } = txs.find((t) => t.hash === event.transactionHash); + if (!input || input.length > 2048) { + input = ""; + } + votedEvents[index].from = from; + votedEvents[index].input = input; + }); + } + return [...proposalEvents, ...votedEvents, ...delegatedEvents, ...undelegatedEvents]; + } + async getAllProposals() { + const { events } = await this.updateEvents(); + const proposalEvents = events.filter((e) => e.event === "ProposalCreated"); + const allProposers = [...new Set(proposalEvents.map((e) => [e.proposer]).flat())]; + const [QUORUM_VOTES, proposalStatus, proposerNameRecords] = await Promise.all([ + this.Governance.QUORUM_VOTES(), + this.Aggregator.getAllProposals(this.Governance.target), + this.ReverseRecords.getNames(allProposers) + ]); + const proposerNames = allProposers.reduce( + (acc, address, index) => { + if (proposerNameRecords[index]) { + acc[address] = proposerNameRecords[index]; + } + return acc; + }, + {} + ); + return proposalEvents.map((event, index) => { + const { id, proposer, description: text } = event; + const status = proposalStatus[index]; + const { forVotes, againstVotes, executed, extended, state } = status; + const { title, description } = parseDescription(id, text); + const quorum = (Number(forVotes + againstVotes) / Number(QUORUM_VOTES) * 100).toFixed(0) + "%"; + return { + ...event, + title, + proposerName: proposerNames[proposer] || void 0, + description, + forVotes, + againstVotes, + executed, + extended, + quorum, + state: proposalState[String(state)] + }; }); } - getEventsFromGraph(_0) { - return __async(this, arguments, function* ({ fromBlock }) { - if (!this.graphApi || !this.subgraphName || this.graphApi.includes("api.thegraph.com")) { + async getVotes(proposalId) { + const { events } = await this.getSavedEvents(); + const votedEvents = events.filter( + (e) => e.event === "Voted" && e.proposalId === proposalId + ); + const allVoters = [...new Set(votedEvents.map((e) => [e.from, e.voter]).flat())]; + const names = await this.ReverseRecords.getNames(allVoters); + const ensNames = allVoters.reduce( + (acc, address, index) => { + if (names[index]) { + acc[address] = names[index]; + } + return acc; + }, + {} + ); + const votes = votedEvents.map((event) => { + const { from, voter } = event; + const { contact, message } = parseComment(this.Governance, event.input); + return { + ...event, + contact, + message, + fromName: ensNames[from] || void 0, + voterName: ensNames[voter] || void 0 + }; + }); + return votes; + } + async getDelegatedBalance(ethAccount) { + const { events } = await this.getSavedEvents(); + const delegatedAccs = events.filter((e) => e.event === "Delegated" && e.delegateTo === ethAccount).map((e) => e.account); + const undelegatedAccs = events.filter((e) => e.event === "Undelegated" && e.delegateFrom === ethAccount).map((e) => e.account); + const undel = [...undelegatedAccs]; + const uniq = delegatedAccs.filter((acc) => { + const indexUndelegated = undel.indexOf(acc); + if (indexUndelegated !== -1) { + undel.splice(indexUndelegated, 1); + return false; + } + return true; + }); + const [balances, uniqNameRecords] = await Promise.all([ + this.Aggregator.getGovernanceBalances(this.Governance.target, uniq), + this.ReverseRecords.getNames(uniq) + ]); + const uniqNames = uniq.reduce( + (acc, address, index) => { + if (uniqNameRecords[index]) { + acc[address] = uniqNameRecords[index]; + } + return acc; + }, + {} + ); + return { + delegatedAccs, + undelegatedAccs, + uniq, + uniqNames, + balances, + balance: balances.reduce((acc, curr) => acc + curr, BigInt(0)) + }; + } +} +async function getTovarishNetworks(registryService, relayers) { + await Promise.all( + relayers.filter((r) => r.tovarishHost).map(async (relayer) => { + try { + relayer.tovarishNetworks = await (0,providers/* fetchData */.Fd)(relayer.tovarishHost, { + ...registryService.fetchDataOptions, + headers: { + "Content-Type": "application/json" + }, + timeout: 3e4, + maxRetry: registryService.fetchDataOptions?.torPort ? 2 : 0 + }); + } catch { + relayer.tovarishNetworks = []; + } + }) + ); +} +const staticRelayers = [ + { + ensName: "tornadowithdraw.eth", + relayerAddress: "0x40c3d1656a26C9266f4A10fed0D87EFf79F54E64", + hostnames: {}, + tovarishHost: "tornadowithdraw.com", + tovarishNetworks: networkConfig/* enabledChains */.Af + } +]; +class BaseRegistryService extends BaseEventsService { + Aggregator; + relayerEnsSubdomains; + updateInterval; + constructor(serviceConstructor) { + const { RelayerRegistry: contract, Aggregator: Aggregator2, relayerEnsSubdomains } = serviceConstructor; + super({ + ...serviceConstructor, + contract, + type: "*" + }); + this.Aggregator = Aggregator2; + this.relayerEnsSubdomains = relayerEnsSubdomains; + this.updateInterval = 86400; + } + getInstanceName() { + return `registry_${this.netId}`; + } + getTovarishType() { + return "registry"; + } + async formatEvents(events) { + const relayerRegisteredEvents = []; + const relayerUnregisteredEvents = []; + const workerRegisteredEvents = []; + const workerUnregisteredEvents = []; + events.forEach(({ blockNumber, index: logIndex, transactionHash, args, eventName: event }) => { + const eventObjects = { + blockNumber, + logIndex, + transactionHash, + event + }; + if (event === "RelayerRegistered") { + const { relayer: ensHash, ensName, relayerAddress, stakedAmount } = args; + relayerRegisteredEvents.push({ + ...eventObjects, + ensName, + relayerAddress, + ensHash, + stakedAmount: (0,units/* formatEther */.ck)(stakedAmount) + }); + } + if (event === "RelayerUnregistered") { + const { relayer: relayerAddress } = args; + relayerUnregisteredEvents.push({ + ...eventObjects, + relayerAddress + }); + } + if (event === "WorkerRegistered") { + const { relayer: relayerAddress, worker: workerAddress } = args; + workerRegisteredEvents.push({ + ...eventObjects, + relayerAddress, + workerAddress + }); + } + if (event === "WorkerUnregistered") { + const { relayer: relayerAddress, worker: workerAddress } = args; + workerUnregisteredEvents.push({ + ...eventObjects, + relayerAddress, + workerAddress + }); + } + }); + return [ + ...relayerRegisteredEvents, + ...relayerUnregisteredEvents, + ...workerRegisteredEvents, + ...workerUnregisteredEvents + ]; + } + /** + * Get saved or cached relayers + */ + async getRelayersFromDB() { + return { + lastBlock: 0, + timestamp: 0, + relayers: [] + }; + } + /** + * Relayers from remote cache (Either from local cache, CDN, or from IPFS) + */ + async getRelayersFromCache() { + return { + lastBlock: 0, + timestamp: 0, + relayers: [], + fromCache: true + }; + } + async getSavedRelayers() { + let cachedRelayers = await this.getRelayersFromDB(); + if (!cachedRelayers || !cachedRelayers.relayers.length) { + cachedRelayers = await this.getRelayersFromCache(); + } + return cachedRelayers; + } + async getLatestRelayers() { + const { events: allEvents, lastBlock } = await this.updateEvents(); + const events = allEvents.filter((e) => e.event === "RelayerRegistered"); + const subdomains = Object.values(this.relayerEnsSubdomains); + const registerSet = /* @__PURE__ */ new Set(); + const uniqueRegisters = events.filter(({ ensName }) => { + if (!registerSet.has(ensName)) { + registerSet.add(ensName); + return true; + } + return false; + }); + const relayerNameHashes = uniqueRegisters.map((r) => (0,namehash/* namehash */.kM)(r.ensName)); + const [relayersData, timestamp] = await Promise.all([ + this.Aggregator.relayersData.staticCall(relayerNameHashes, subdomains.concat("tovarish-relayer")), + this.provider.getBlock(lastBlock).then((b) => Number(b?.timestamp)) + ]); + const relayers = relayersData.map(({ owner, balance: stakeBalance, records, isRegistered }, index) => { + const { ensName, relayerAddress } = uniqueRegisters[index]; + let tovarishHost = void 0; + const hostnames = records.reduce((acc, record, recordIndex) => { + if (record) { + if (recordIndex === records.length - 1) { + tovarishHost = record; + return acc; + } + acc[Number(Object.keys(this.relayerEnsSubdomains)[recordIndex])] = record; + } + return acc; + }, {}); + const hasMinBalance = stakeBalance >= relayerClient/* MIN_STAKE_BALANCE */.pO; + const preCondition = Object.keys(hostnames).length && isRegistered && hasMinBalance; + if (preCondition) { return { - events: [], - lastBlock: fromBlock + ensName, + relayerAddress: owner, + registeredAddress: owner !== relayerAddress ? relayerAddress : void 0, + isRegistered, + stakeBalance: (0,units/* formatEther */.ck)(stakeBalance), + hostnames, + tovarishHost }; } - return __superGet(BaseGovernanceService.prototype, this, "getEventsFromGraph").call(this, { fromBlock }); + }).filter((r) => r); + await getTovarishNetworks(this, relayers); + const allRelayers = [...staticRelayers, ...relayers]; + const tovarishRelayers = allRelayers.filter((r) => r.tovarishHost); + const classicRelayers = allRelayers.filter((r) => !r.tovarishHost); + return { + lastBlock, + timestamp, + relayers: [...tovarishRelayers, ...classicRelayers] + }; + } + /** + * Handle saving relayers + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + async saveRelayers({ lastBlock, timestamp, relayers }) { + } + /** + * Get cached or latest relayer and save to local + */ + async updateRelayers() { + let { lastBlock, timestamp, relayers, fromCache } = await this.getSavedRelayers(); + let shouldSave = fromCache ?? false; + if (!relayers.length || timestamp + this.updateInterval < Math.floor(Date.now() / 1e3)) { + console.log("\nUpdating relayers from registry\n"); + ({ lastBlock, timestamp, relayers } = await this.getLatestRelayers()); + shouldSave = true; + } + if (shouldSave) { + await this.saveRelayers({ lastBlock, timestamp, relayers }); + } + return { lastBlock, timestamp, relayers }; + } +} +class BaseRevenueService extends BaseEventsService { + batchTransactionService; + batchBlockService; + constructor(serviceConstructor) { + const { RelayerRegistry: contract, provider } = serviceConstructor; + super({ + ...serviceConstructor, + contract, + type: "StakeBurned" + }); + this.batchTransactionService = new batch/* BatchTransactionService */.AF({ + provider, + onProgress: this.updateTransactionProgress + }); + this.batchBlockService = new batch/* BatchBlockService */.B3({ + provider, + onProgress: this.updateBlockProgress + }); + } + getInstanceName() { + return `revenue_${this.netId}`; + } + getTovarishType() { + return "revenue"; + } + async formatEvents(events) { + const blocks = await this.batchBlockService.getBatchBlocks([ + ...new Set(events.map(({ blockNumber }) => blockNumber)) + ]); + const receipts = await this.batchTransactionService.getBatchReceipt([ + ...new Set(events.map(({ transactionHash }) => transactionHash)) + ]); + const registeredRelayers = new Set(events.map(({ args }) => args.relayer)); + const tornadoInterface = Tornado__factory.createInterface(); + const withdrawHash = tornadoInterface.getEvent("Withdrawal").topicHash; + const withdrawalLogs = receipts.map( + (receipt) => receipt.logs.map((log) => { + if (log.topics[0] === withdrawHash) { + const block = blocks.find((b) => b.number === log.blockNumber); + const parsedLog = tornadoInterface.parseLog(log); + if (parsedLog && registeredRelayers.has(parsedLog.args.relayer)) { + return { + instanceAddress: log.address, + gasFee: (receipt.cumulativeGasUsed * receipt.gasPrice).toString(), + relayerFee: parsedLog.args.fee.toString(), + timestamp: block?.timestamp || 0 + }; + } + } + }).filter((l) => l) + ).flat(); + if (withdrawalLogs.length !== events.length) { + console.log( + ` +RevenueService: Mismatch on withdrawal logs (${withdrawalLogs.length} ) and events logs (${events.length}) +` + ); + } + return events.map(({ blockNumber, index: logIndex, transactionHash, args }, index) => { + const eventObjects = { + blockNumber, + logIndex, + transactionHash + }; + const { relayer: relayerAddress, amountBurned } = args; + const { instanceAddress, gasFee, relayerFee, timestamp } = withdrawalLogs[index]; + return { + ...eventObjects, + relayerAddress, + amountBurned: amountBurned.toString(), + instanceAddress, + gasFee, + relayerFee, + timestamp + }; }); } } -class BaseRegistryService extends BaseEventsService { - constructor({ - netId, - provider, - graphApi, - subgraphName, - RelayerRegistry, - deployedBlock, - fetchDataOptions: fetchDataOptions2 - }) { - super({ netId, provider, graphApi, subgraphName, contract: RelayerRegistry, deployedBlock, fetchDataOptions: fetchDataOptions2 }); + + +/***/ }), + +/***/ 12591: +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ $B: () => (/* binding */ DBEncryptedNotesService), +/* harmony export */ Aq: () => (/* binding */ DBGovernanceService), +/* harmony export */ Fb: () => (/* binding */ saveDBEvents), +/* harmony export */ Oz: () => (/* binding */ loadRemoteEvents), +/* harmony export */ f8: () => (/* binding */ DBTornadoService), +/* harmony export */ hD: () => (/* binding */ DBRegistryService), +/* harmony export */ w8: () => (/* binding */ loadDBEvents), +/* harmony export */ wV: () => (/* binding */ DBRevenueService), +/* harmony export */ xc: () => (/* binding */ DBEchoService) +/* harmony export */ }); +/* harmony import */ var _zip__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(18995); +/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67418); +/* harmony import */ var _providers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(46170); +/* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(96221); + + + + + +async function saveDBEvents({ + idb, + instanceName, + events, + lastBlock +}) { + try { + const formattedEvents = events.map((e) => { + return { + eid: `${e.transactionHash}_${e.logIndex}`, + ...e + }; + }); + await idb.createMultipleTransactions({ + data: formattedEvents, + storeName: instanceName + }); + await idb.putItem({ + data: { + blockNumber: lastBlock, + name: instanceName + }, + storeName: "lastEvents" + }); + } catch (err) { + console.log("Method saveDBEvents has error"); + console.log(err); } - getInstanceName() { - return `registered_${this.netId}`; +} +async function loadDBEvents({ + idb, + instanceName +}) { + try { + const lastBlockStore = await idb.getItem({ + storeName: "lastEvents", + key: instanceName + }); + if (!lastBlockStore?.blockNumber) { + return { + events: [], + lastBlock: 0 + }; + } + const events = (await idb.getAll({ + storeName: instanceName + })).map((e) => { + delete e.eid; + return e; + }); + return { + events, + lastBlock: lastBlockStore.blockNumber + }; + } catch (err) { + console.log("Method loadDBEvents has error"); + console.log(err); + return { + events: [], + lastBlock: 0 + }; } - // Name of type used for events - getType() { - return "RelayerRegistered"; +} +async function loadRemoteEvents({ + staticUrl, + instanceName, + deployedBlock, + zipDigest +}) { + try { + const zipName = `${instanceName}.json`.toLowerCase(); + const events = await (0,_zip__WEBPACK_IMPORTED_MODULE_0__/* .downloadZip */ ._6)({ + staticUrl, + zipName, + zipDigest + }); + if (!Array.isArray(events)) { + const errStr = `Invalid events from ${staticUrl}/${zipName}`; + throw new Error(errStr); + } + return { + events, + lastBlock: events[events.length - 1]?.blockNumber || deployedBlock, + fromCache: true + }; + } catch (err) { + console.log("Method loadRemoteEvents has error"); + console.log(err); + return { + events: [], + lastBlock: deployedBlock, + fromCache: true + }; } - // Name of method used for graph - getGraphMethod() { - return "getAllRegisters"; +} +class DBTornadoService extends _base__WEBPACK_IMPORTED_MODULE_3__/* .BaseTornadoService */ .e0 { + staticUrl; + idb; + zipDigest; + constructor(params) { + super(params); + this.staticUrl = params.staticUrl; + this.idb = params.idb; } - formatEvents(events) { - return __async(this, null, function* () { - return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { - const eventObjects = { - blockNumber, - logIndex, - transactionHash - }; - return __spreadProps(__spreadValues({}, eventObjects), { - ensName: args.ensName, - relayerAddress: args.relayerAddress - }); - }); + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName() }); } - fetchRelayers() { - return __async(this, null, function* () { - return (yield this.updateEvents()).events; + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest + }); + } + async saveEvents({ events, lastBlock }) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock + }); + } +} +class DBEchoService extends _base__WEBPACK_IMPORTED_MODULE_3__/* .BaseEchoService */ .GS { + staticUrl; + idb; + zipDigest; + constructor(params) { + super(params); + this.staticUrl = params.staticUrl; + this.idb = params.idb; + } + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName() + }); + } + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest + }); + } + async saveEvents({ events, lastBlock }) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock + }); + } +} +class DBEncryptedNotesService extends _base__WEBPACK_IMPORTED_MODULE_3__/* .BaseEncryptedNotesService */ .O_ { + staticUrl; + idb; + zipDigest; + constructor(params) { + super(params); + this.staticUrl = params.staticUrl; + this.idb = params.idb; + } + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName() + }); + } + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest + }); + } + async saveEvents({ events, lastBlock }) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock + }); + } +} +class DBGovernanceService extends _base__WEBPACK_IMPORTED_MODULE_3__/* .BaseGovernanceService */ .JJ { + staticUrl; + idb; + zipDigest; + constructor(params) { + super(params); + this.staticUrl = params.staticUrl; + this.idb = params.idb; + } + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName() + }); + } + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest + }); + } + async saveEvents({ events, lastBlock }) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock + }); + } +} +class DBRegistryService extends _base__WEBPACK_IMPORTED_MODULE_3__/* .BaseRegistryService */ .cE { + staticUrl; + idb; + zipDigest; + relayerJsonDigest; + constructor(params) { + super(params); + this.staticUrl = params.staticUrl; + this.idb = params.idb; + } + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName() + }); + } + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest + }); + } + async saveEvents({ events, lastBlock }) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock + }); + } + async getRelayersFromDB() { + try { + const allCachedRelayers = await this.idb.getAll({ + storeName: `relayers_${this.netId}` + }); + if (!allCachedRelayers?.length) { + return { + lastBlock: 0, + timestamp: 0, + relayers: [] + }; + } + return allCachedRelayers.slice(-1)[0]; + } catch (err) { + console.log("Method getRelayersFromDB has error"); + console.log(err); + return { + lastBlock: 0, + timestamp: 0, + relayers: [] + }; + } + } + async getRelayersFromCache() { + const url = `${this.staticUrl}/relayers.json`; + try { + const resp = await (0,_providers__WEBPACK_IMPORTED_MODULE_2__/* .fetchData */ .Fd)(url, { + method: "GET", + returnResponse: true + }); + const data = new Uint8Array(await resp.arrayBuffer()); + if (this.relayerJsonDigest) { + const hash = "sha384-" + (0,_utils__WEBPACK_IMPORTED_MODULE_1__/* .bytesToBase64 */ ["if"])(await (0,_utils__WEBPACK_IMPORTED_MODULE_1__/* .digest */ .br)(data)); + if (hash !== this.relayerJsonDigest) { + const errMsg = `Invalid digest hash for ${url}, wants ${this.relayerJsonDigest} has ${hash}`; + throw new Error(errMsg); + } + } + return JSON.parse(new TextDecoder().decode(data)); + } catch (err) { + console.log("Method getRelayersFromCache has error"); + console.log(err); + return { + lastBlock: 0, + timestamp: 0, + relayers: [] + }; + } + } + async saveRelayers(cachedRelayers) { + try { + await this.idb.putItem({ + data: cachedRelayers, + storeName: `relayers_${this.netId}` + }); + } catch (err) { + console.log("Method saveRelayers has error"); + console.log(err); + } + } +} +class DBRevenueService extends _base__WEBPACK_IMPORTED_MODULE_3__/* .BaseRevenueService */ .Do { + staticUrl; + idb; + zipDigest; + relayerJsonDigest; + constructor(params) { + super(params); + this.staticUrl = params.staticUrl; + this.idb = params.idb; + } + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName() + }); + } + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest + }); + } + async saveEvents({ events, lastBlock }) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock }); } } @@ -61437,17 +93601,30 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ BaseEncryptedNotesService: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_1__.O_), /* harmony export */ BaseEventsService: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_1__.uw), /* harmony export */ BaseGovernanceService: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_1__.JJ), +/* harmony export */ BaseMultiTornadoService: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_1__.lG), /* harmony export */ BaseRegistryService: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_1__.cE), +/* harmony export */ BaseRevenueService: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_1__.Do), /* harmony export */ BaseTornadoService: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_1__.e0), -/* harmony export */ DEPOSIT: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_1__.Lx), -/* harmony export */ WITHDRAWAL: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_1__.oW) +/* harmony export */ DBEchoService: () => (/* reexport safe */ _db__WEBPACK_IMPORTED_MODULE_2__.xc), +/* harmony export */ DBEncryptedNotesService: () => (/* reexport safe */ _db__WEBPACK_IMPORTED_MODULE_2__.$B), +/* harmony export */ DBGovernanceService: () => (/* reexport safe */ _db__WEBPACK_IMPORTED_MODULE_2__.Aq), +/* harmony export */ DBRegistryService: () => (/* reexport safe */ _db__WEBPACK_IMPORTED_MODULE_2__.hD), +/* harmony export */ DBRevenueService: () => (/* reexport safe */ _db__WEBPACK_IMPORTED_MODULE_2__.wV), +/* harmony export */ DBTornadoService: () => (/* reexport safe */ _db__WEBPACK_IMPORTED_MODULE_2__.f8), +/* harmony export */ getTovarishNetworks: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_1__.EU), +/* harmony export */ loadDBEvents: () => (/* reexport safe */ _db__WEBPACK_IMPORTED_MODULE_2__.w8), +/* harmony export */ loadRemoteEvents: () => (/* reexport safe */ _db__WEBPACK_IMPORTED_MODULE_2__.Oz), +/* harmony export */ proposalState: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_1__.sf), +/* harmony export */ saveDBEvents: () => (/* reexport safe */ _db__WEBPACK_IMPORTED_MODULE_2__.Fb) /* harmony export */ }); /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(61060); /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_types__WEBPACK_IMPORTED_MODULE_0__); /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; /* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _types__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _types__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); -/* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71304); +/* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(96221); +/* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(12591); + @@ -61477,18 +93654,48 @@ __webpack_require__.r(__webpack_exports__); const DUMMY_ADDRESS = "0x1111111111111111111111111111111111111111"; -const DUMMY_NONCE = "0x1111111111111111111111111111111111111111111111111111111111111111"; +const DUMMY_NONCE = 1024; const DUMMY_WITHDRAW_DATA = "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"; function convertETHToTokenAmount(amountInWei, tokenPriceInWei, tokenDecimals = 18) { const tokenDecimalsMultiplier = BigInt(10 ** Number(tokenDecimals)); return BigInt(amountInWei) * tokenDecimalsMultiplier / BigInt(tokenPriceInWei); } class TornadoFeeOracle { - constructor(ovmGasPriceOracle) { + provider; + ovmGasPriceOracle; + constructor(provider, ovmGasPriceOracle) { + this.provider = provider; if (ovmGasPriceOracle) { this.ovmGasPriceOracle = ovmGasPriceOracle; } } + /** + * Calculates Gas Price + * We apply 50% premium of EIP-1559 network fees instead of 100% from ethers.js + * (This should cover up to 4 full blocks which is equivalent of minute) + * (A single block can bump 12.5% of fees, see the methodology https://hackmd.io/@tvanepps/1559-wallets) + * (Still it is recommended to use 100% premium for sending transactions to prevent stucking it) + */ + async gasPrice() { + const [block, getGasPrice, getPriorityFee] = await Promise.all([ + this.provider.getBlock("latest"), + (async () => { + try { + return BigInt(await this.provider.send("eth_gasPrice", [])); + } catch { + return (0,ethers__WEBPACK_IMPORTED_MODULE_0__/* .parseUnits */ .XS)("1", "gwei"); + } + })(), + (async () => { + try { + return BigInt(await this.provider.send("eth_maxPriorityFeePerGas", [])); + } catch { + return BigInt(0); + } + })() + ]); + return block?.baseFeePerGas ? block.baseFeePerGas * BigInt(15) / BigInt(10) + getPriorityFee : getGasPrice; + } /** * Calculate L1 fee for op-stack chains * @@ -61502,10 +93709,9 @@ class TornadoFeeOracle { tx = { type: 0, gasLimit: 1e6, - nonce: Number(DUMMY_NONCE), + nonce: DUMMY_NONCE, data: DUMMY_WITHDRAW_DATA, gasPrice: (0,ethers__WEBPACK_IMPORTED_MODULE_0__/* .parseUnits */ .XS)("1", "gwei"), - from: DUMMY_ADDRESS, to: DUMMY_ADDRESS }; } @@ -61554,1023 +93760,791 @@ class TornadoFeeOracle { /***/ }), -/***/ 52049: +/***/ 56079: +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Qx: () => (/* binding */ gasZipID), +/* harmony export */ X: () => (/* binding */ gasZipMinMax), +/* harmony export */ dT: () => (/* binding */ gasZipInbounds), +/* harmony export */ x5: () => (/* binding */ gasZipInput) +/* harmony export */ }); +/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(41442); +/* harmony import */ var _networkConfig__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(59499); + + + +const gasZipInbounds = { + [_networkConfig__WEBPACK_IMPORTED_MODULE_0__/* .NetId */ .zr.MAINNET]: "0x391E7C679d29bD940d63be94AD22A25d25b5A604", + [_networkConfig__WEBPACK_IMPORTED_MODULE_0__/* .NetId */ .zr.BSC]: "0x391E7C679d29bD940d63be94AD22A25d25b5A604", + [_networkConfig__WEBPACK_IMPORTED_MODULE_0__/* .NetId */ .zr.POLYGON]: "0x391E7C679d29bD940d63be94AD22A25d25b5A604", + [_networkConfig__WEBPACK_IMPORTED_MODULE_0__/* .NetId */ .zr.OPTIMISM]: "0x391E7C679d29bD940d63be94AD22A25d25b5A604", + [_networkConfig__WEBPACK_IMPORTED_MODULE_0__/* .NetId */ .zr.ARBITRUM]: "0x391E7C679d29bD940d63be94AD22A25d25b5A604", + [_networkConfig__WEBPACK_IMPORTED_MODULE_0__/* .NetId */ .zr.GNOSIS]: "0x391E7C679d29bD940d63be94AD22A25d25b5A604", + [_networkConfig__WEBPACK_IMPORTED_MODULE_0__/* .NetId */ .zr.AVALANCHE]: "0x391E7C679d29bD940d63be94AD22A25d25b5A604" +}; +const gasZipID = { + [_networkConfig__WEBPACK_IMPORTED_MODULE_0__/* .NetId */ .zr.MAINNET]: 255, + [_networkConfig__WEBPACK_IMPORTED_MODULE_0__/* .NetId */ .zr.BSC]: 14, + [_networkConfig__WEBPACK_IMPORTED_MODULE_0__/* .NetId */ .zr.POLYGON]: 17, + [_networkConfig__WEBPACK_IMPORTED_MODULE_0__/* .NetId */ .zr.OPTIMISM]: 55, + [_networkConfig__WEBPACK_IMPORTED_MODULE_0__/* .NetId */ .zr.ARBITRUM]: 57, + [_networkConfig__WEBPACK_IMPORTED_MODULE_0__/* .NetId */ .zr.GNOSIS]: 16, + [_networkConfig__WEBPACK_IMPORTED_MODULE_0__/* .NetId */ .zr.AVALANCHE]: 15, + [_networkConfig__WEBPACK_IMPORTED_MODULE_0__/* .NetId */ .zr.SEPOLIA]: 102 +}; +function gasZipInput(to, shorts) { + let data = "0x"; + if ((0,ethers__WEBPACK_IMPORTED_MODULE_1__/* .isAddress */ .PW)(to)) { + if (to.length === 42) { + data += "02"; + data += to.slice(2); + } else { + return null; + } + } else { + data += "01"; + } + for (const i in shorts) { + data += Number(shorts[i]).toString(16).padStart(4, "0"); + } + return data; +} +function gasZipMinMax(ethUsd) { + return { + min: 1 / ethUsd, + max: 50 / ethUsd, + ethUsd + }; +} + + +/***/ }), + +/***/ 49540: +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ B: () => (/* binding */ hasherBytecode), +/* harmony export */ l: () => (/* binding */ deployHasher) +/* harmony export */ }); + +const hasherBytecode = "0x38600c600039612b1b6000f3606460006000377c01000000000000000000000000000000000000000000000000000000006000510463f47d33b5146200003557fe5b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000016004518160245181838180828009800909089082827f0fbe43c36a80e36d7c7c584d4f8f3759fb51f0d66065d8a227b688d12488c5d408839081808280098009098391089082827f9c48cd3e00a6195a253fc009e60f249456f802ff9baf6549210d201321efc1cc08839081808280098009098391089082827f27c0849dba2643077c13eb42ffb97663cdcecd669bf10f756be30bab71b86cf808839081808280098009098391089082827f2bf76744736132e5c68f7dfdd5b792681d415098554fd8280f00d11b172b80d208839081808280098009098391089082827f33133eb4a1a1ab45037c8bdf9adbb2999baf06f20a9c95180dc4ccdcbec5856808839081808280098009098391089082827f588bb66012356dbc9b059ef1d792b563d6c18624dddecc3fe4583fd3551e9b3008839081808280098009098391089082827f71bc3e244e1b92911fe7f53cf523e491fd6ff487d59337a1d92f92668c4f4c3608839081808280098009098391089082827fd1808e2b039fd010c489768f78d7499938ccc0858f3295151787cfe8b7e40be108839081808280098009098391089082827f76978af3ded437cf41b3faa40cd6bcfce94f27f4abcc3ed34be19abd2c4537d008839081808280098009098391089082827f0a9baee798a320b0ca5b1cf888386d1dc12c13b38e10225aa4e9f03069a099f508839081808280098009098391089082827fb79dbf6050a03b16c3ade8d77e11c767d2251af9cdbd6cdf9a8a0ee921b32c7908839081808280098009098391089082827fa74bbcf5067f067faec2cce4b98d130d7927456f5c5f6c00e0f5406a24eb8b1908839081808280098009098391089082827fab7ab080d4c4018bda6ecc8bd67468bc4619ba12f25b0da879a639c758c8855d08839081808280098009098391089082827fe6a5b797c2bba7e9a873b37f5c41adc47765e9be4a1f0e0650e6a24ad226876308839081808280098009098391089082827f6270ae87cf3d82cf9c0b5f428466c429d7b7cbe234cecff39969171af006016c08839081808280098009098391089082827f9951c9f6e76d636b52f7600d979ca9f3b643dfbe9551c83b31542830321b2a6608839081808280098009098391089082827f4119469e44229cc40c4ff555a2b6f6b39961088e741e3c20a3c9b47f130c555008839081808280098009098391089082827f5d795e02bbaf90ff1f384741e5f18f8b644a0080441315d0e5b3c8123452a0b008839081808280098009098391089082827f281e90a515e6409e9177b4f297f8049ce3d4c3659423c48b3fd64e83596ff10108839081808280098009098391089082827f424185c60a21e84970f7d32cacaa2725aa8a844caea7ed760d2b965af1bf3e7d08839081808280098009098391089082827fd96fcbc3960614ea887da609187a5dada2e1b829f23309a6375212cea1f25c0908839081808280098009098391089082827ffde84026d7c294300af18f7712fc3662f43387ae8cf7fdda1f9a810f4b24bcf208839081808280098009098391089082827f3a9d568575846aa6b8a890b3c237fd0447426db878e6e25333b8eb9b386195c108839081808280098009098391089082827f55a2aa32c84a4cae196dd4094b685dd11757470a3be094d98eea73f02452aa3608839081808280098009098391089082827fcbc9481380978d29ebc5b0a8d4481cd2ef654ee800907adb3d38dc2fd9265fab08839081808280098009098391089082827f24e53af71ef06bacb76d3294c11223911e9d177ff09b7009febc484add0beb7408839081808280098009098391089082827fdbd44e16108225766dac3e5fe7acbe9df519bbba97380e5e9437a90658f2139308839081808280098009098391089082827fc6f434863c79013bb2c202331e04bccea2251c1ff6f191dc2afa23e6f6d28e4e08839081808280098009098391089082827f3490eeb39a733c0e8062d87f981ae65a8fccf25c448f4455d27db3915351b06608839081808280098009098391089082827f30b89830ff7ade3558a5361a24869130ce1fcce97211602962e34859525dac4f08839081808280098009098391089082827f29bae21b579d080a75c1694da628d0ecfd83efc9c8468704f410300062f64ca908839081808280098009098391089082827fe326499de0476e719915dd1c661ef4550723d4aee9ee9af224edd208790fce4408839081808280098009098391089082827f8c45208b8baa6f473821415957088c0b7e72a465f460b09ece2d270aee2f184108839081808280098009098391089082827ffe2ad454f451348f26ce2cc7e7914aef3eb96e8f89a4619a1dc7d11f8401c35208839081808280098009098391089082827f0929db368ef2af2d29bca38845325b0b7a820a4889e44b5829bbe1ed47fd4d5208839081808280098009098391089082827f16531d424b0cbaf9abbf2d2acde698462ea4555bf32ccf1bbd26697e905066f608839081808280098009098391089082827ff5c30d247f045ff6d05cf0dd0a49c9823e7a24b0d751d3c721353b96f29d76f608839081808280098009098391089082827f6eb7a3614056c230c6f171370fdd9d1048bb00b2cdd1b2721d11bdda5023f48608839081808280098009098391089082827f0ee9c4621642a272f710908707557498d25a6fdd51866da5d9f0d205355a618908839081808280098009098391089082827f78ca1cb1c7f6c6894d1cf94f327b8763be173151b6b06f99dfc6a944bb5a72f008839081808280098009098391089082827f5d24d0b1b304d05311ce0f274b0d93746a4860ed5cdd8d4348de557ea7a5ee7a08839081808280098009098391089082827f77423dabd1a3cddc8691438fc5891e3fd49ac0f3e21aaf249791bfde1303d2f308839081808280098009098391089082827f0642e8800a48cc04c0168232c6f542396597a67cf395ad622d947e98bb68697a08839081808280098009098391089082827fc1e7d3cbbc4c35b7490647d8402e56d334336943bda91fe2d34ca9727c0e3df508839081808280098009098391089082827f8d6fb1730335204f38f85e408ac861e76f24349ab6ee0469c22e19350bb24fe108839081808280098009098391089082827f67d0faf5f0db32a1b60e13dc4914246b9edac7990fb4990b19aa86815586441a08839081808280098009098391089082827f2605b9b909ded1b04971eae979027c4e0de57f3b6a60d5ed58aba619c34749ce08839081808280098009098391089082827fd276890b2c205db85f000d1f5111ed8f177e279cae3e52862780f04e846228d008839081808280098009098391089082827f2ac5905f9450a21ef6905ed5951a91b3730e3a2e2d62b50bdeb810015d50376b08839081808280098009098391089082827f7a366839f0291ca54da674ac3f0e1e9aa8b687ba533926cb40268039e57b967a08839081808280098009098391089082827f67ab0f3466989c3dbbe209c37ec272ba83984ba6e445be6d472b63e3ca7270e308839081808280098009098391089082827f0e786007d0ce7e28a90e31d3263887d40c556dec88fcb8b56bc9e9c05ecc0c2908839081808280098009098391089082827f0b814ed99bd00eca389b0022663dbfddfbfa15e321c19abcf1eaf9556075fb6808839081808280098009098391089082827f65c0321ba26fcee4fdc35b4999b78ceb54dcaf9fec2e3bdea98e9f82925c093208839081808280098009098391089082827fab2d2a929601f9c3520e0b14aaa6ba9f1e79821a5b768919670a4ea970722bf408839081808280098009098391089082827fcdd2e0744d4af1a81918de69ec12128a5871367303ff83ed764771cbbdf6502308839081808280098009098391089082827f74527d0c0868f2ec628086b874fa66a7347d3d3b918d2e07a5f33e1067e8ac5808839081808280098009098391089082827f1c6bf6ac0314caead23e357bfcbbaa17d670672ae3a475f80934c716f10aca2508839081808280098009098391089082827f3c4007e286f8dc7efd5d0eeb0e95d7aa6589361d128a0cccb17b554c851a643208839081808280098009098391089082827fae468a86a5a7db7c763a053eb09ac1a02809ce095258c88101ee319e12b0697e08839081808280098009098391089082827f9333e3d052b7c77fcac1eb366f610f6f97852242b1317a87b80f3bbc5c8c2d1d08839081808280098009098391089082827f52ec1d675cf5353153f6b628414783ca6b7fc0fe01948ca206daad712296e39508839081808280098009098391089082827f13ceeeb301572b4991076750e11ea7e7fcbfee454d90dc1763989004a1894f9308839081808280098009098391089082827f8505737e7e94939a08d8cda10b6fbbbf879b2141ae7eabc30fcd22405135fe6408839081808280098009098391089082827f6127db7ac5200a212092b66ec2bfc63653f4dc8ac66c76008fef885258a258b508839081808280098009098391089082827f12692a7d808f44e31d628dbcfea377eb073fb918d7beb8136ea47f8cf094c88c08839081808280098009098391089082827f260e384b1268e3a347c91d6987fd280fa0a275541a7c5be34bf126af35c962e008839081808280098009098391089082827fd88c3b01966d90e713aee8d482ceaa6925311d2342e1a5aca4fcd2f44b6daddc08839081808280098009098391089082827fb87e868affd91b078a87fa75ac9332a6cf23587d94e20c3262db5e91f30bf04b08839081808280098009098391089082827fb5ba5f8acad1a950a3bbf2201055cd3ea27056c0c53f0c4c97f33cda8dbfe90908839081808280098009098391089082827f59ca814b49e00d7b3118c53a2986ded128584acd7428735e08ade6661c457f7508839081808280098009098391089082827f0fc4c0bea813a223fd510c07f7bbe337badd4bcf28649a0d378970c2a15b3aa508839081808280098009098391089082827f0053f1ea6dd60e7a6db09a00be77549ff3d4ee3737be7fb42052ae1321f667c308839081808280098009098391089082827feb937077bb10c8fe38716d4e38edc1f9e7b18c6414fef85fe7e9c5567baa4a0408839081808280098009098391089082827fbacb14c0f1508d828f7fd048d716b8044aec7f0fb48e85e717bf532db972520708839081808280098009098391089082827f4ca0abb8beb7cff572a0c1e6f58e080e1bb243d497a3e74538442a4555ad40be08839081808280098009098391089082827fda9eefd411e590d7e44592cce298af87b2c62aa3cc8bb137aa99ca8d4aa551b508839081808280098009098391089082827f153dae43cef763e7a2fc9846f09a2973b0ad9c35894c220699bcc2954501c6bd08839081808280098009098391089082827fd4ed2a09375813b4fb504c7a9ba13110bdd8549a47349db82c15a434c090e87b08839081808280098009098391089082827f0063a5c4c9c12dcf4bae72c69f3a225664469503d61d9eae5d9553bfb006095b08839081808280098009098391089082827fdc8a4d35ad28e59dd3713b45985cd3b70e37ccc2be42086f1ea078fe2dc9d82d08839081808280098009098391089082827f486ba219308f0c847b22fcb4449f8855192536c01b8057904e81c1c7814f483b08839081808280098009098391089082827f34d9604140a1ac9fdb204285b9fe1b303c281af2fc5fb362f6577282b423bcf308839081808280098009098391089082827fc1681959ec4bc3656911db2b2f56aa4db709c26f1a0a25c879286e37f437465d08839081808280098009098391089082827ffcd849f3b5f9e4368af75619fb27f2e335adbb9b44988f17c4d389fa751ad47a08839081808280098009098391089082827ff5f7fc22ad64c8e7c1e005110e13f4f1c6b1f8f8cc59000db0e3bb38f99554a508839081808280098009098391089082827fa9133b8a20fbae4633ec5f82cb47a38ae1877d12d1febb23982c7c808aa5317508839081808280098009098391089082827ff4827c5c7b61141cc31b75984bb3ed16ed579e5b72e32a1289b63ab55eaf8c1208839081808280098009098391089082827fcca361819ffefe3e50fe34c91a322c9405f4e5a168c1fc0a0a1883993e32c9f408839081808280098009098391089082827f6656088842bfc9e325a532784d3362cecfa86f9c7b208a6b499836ebe48ff15708839081808280098009098391089082827f00129c7cd00e42ed05a37dbceb80d47b65e1d750ef2148278a54723fdf42c4cc08839081808280098009098391089082827fa85b235631b786f85cd46f7768f6c71ae004ad267ae59bdf929ada149b19588808839081808280098009098391089082827f34df65a82686be09c5b237911abf237a9887c1a418f279ac79b446d7d311f5ea08839081808280098009098391089082827f815a850c3989df9ca6231e0bdd9916fc0e076f2c6c7f0f260a846d0179f9c32d08839081808280098009098391089082827f50fb0940848a67aee83d348421fadd79aefc7a2adabeec6e64904ebe1bf63e7d08839081808280098009098391089082827fbab63a16273599f8b66895461e62a19ff0d103693be771d93e3691bba89cdd8d08839081808280098009098391089082827f6931a091756e0bc709ebecfffba5038634c5b3d5d0c5876dd72aac67452db8a208839081808280098009098391089082827f55559b8bb79db8809c46ee627f1b5ce1d8e6d89bf94a9987a1407759d1ba896308839081808280098009098391089082827fa9a1a11b2979018cb155914d09f1df19b7ffec241e8b2487b6f6272a56a44a0a08839081808280098009098391089082827ff83293400e7bccea4bb86dcb0d5ca57fa2466e13a572d7d3531c6fa491cb0f1b08839081808280098009098391089082827fb7cb5742b6bc5339624d3568a33c21f31b877f8396972582028da999abf249f208839081808280098009098391089082827ff56efb400f8500b5c5bf811c65c86c7ed2e965f14f1a69bca436c0c60b79f46508839081808280098009098391089082827fd7c4427998d9c440f849dcd75b7157996eaad1b9a1d58cc2441931300e26eb2208839081808280098009098391089082827fca5ed18ad53e33fdc3ae8cf353ff3f6dd315f60060442b74f6b614b24ebd4cc308839081808280098009098391089082827f9ad3e9376c97b194a0fbf43e22a3616981d777365c765ead09a1d033fdf536b708839081808280098009098391089082827fc6daeff5769a06b26fe3b8fef30df07b1387373a7814cef364fe1d6059eaf54a08839081808280098009098391089082827fc20a78398345c6b8cf439643dab96223bf879c302648293eaf496fee5c978c6608839081808280098009098391089082827f589ca65b6cf0e90653c06dddc057dc61ba2839974569051c98b43e8618716efb08839081808280098009098391089082827f83064161f127d8c59fc73625957e21630dc6dc99e5443f6ce37ecd6bf28e69b708839081808280098009098391089082827f46d0ba662b50100b9a3af52052f68932feec1d12290b2033c4f49148893d8ba308839081808280098009098391089082827f18dd55b4a83a53f2ee578eb3e6d26f594824d44670fc3f4de80642344d15c09a08839081808280098009098391089082827f9fb5b594f48bc58b345ab90ded705920a7274b8e070eee8ce8cf90c72c3604b608839081808280098009098391089082827f1901d8f4f2c8449128e00663978f2050f2eb1cd6acb60d9d09c57c5d46ee54fe08839081808280098009098391089082827f5ec56789beab24ef7ee32f594d5fc561ec59dfeb93606dc7dcc6fe65133a7db408839081808280098009098391089082827f01c0b2cbe4fa9877a3d08eb67c510e8630da0a8beda94a6d9283e6f70d268bc508839081808280098009098391089082827f0b1d85acd9031a9107350eed946a25734e974799c5ba7cff13b15a5a623a25f008839081808280098009098391089082827f204497d1d359552905a2fe655f3d6f94926ea92d12cdaa6556ec26362f239f6408839081808280098009098391089082827fe075f7edc6631a8d7ffe33019f44fc91f286236d5a5f90f16de4791b72a2a5f008839081808280098009098391089082827f243f46e353354256ab8fe0ca4e9230dfc330bc163e602dfeaf307c1d1a7264b908839081808280098009098391089082827fd448ae5e09625fa1fcfd732fc9cd8f06e4c33b81f0a9240c83da56f41e9ecceb08839081808280098009098391089082827f2f312eef69a33d9fa753c08840275692a03432b3e6da67f9c59b9f9f4971cd5608839081808280098009098391089082827f5f333996af231bd5a293137da91801e191a6f24eb532ad1a7e6e9a2ad0efbc0008839081808280098009098391089082827fa8f771e0383a832dc8e2eaa8efabda300947acaf0684fabddf8b4abb0abd8a6208839081808280098009098391089082827f9ff0b3d7a4643596f651b70c1963cc4fa6c46018d78f05cb2c5f187e25df83a908839081808280098009098391089082827f9c373b704838325648273734dcdf962d7c156f431f70380ba4855832c4a238b808839081808280098009098391089082827fea2afa02604b8afeeb570f48a0e97a5e6bfe9613394b9a6b0026ecd6cec8c33a08839081808280098009098391089082827f68892258cd8eb43b71caa6d6837ec9959bfdfd72f25c9005ebaffc4011f8a7bf08839081808280098009098391089082827ff2824f561f6f82e3c1232836b0d268fa3b1b5489edd39a5fe1503bfc7ca91f4908839081808280098009098391089082827f164eda75fda2861f9d812f24e37ac938844fbe383c243b32b9f66ae2e76be71908839081808280098009098391089082827ff0a6fc431f5bf0dd1cca93b8b65b3f72c91f0693e2c74be9243b15abb31afcc008839081808280098009098391089082827fe68db66ba891ef0cd527f09ec6fff3ec0a269cf3d891a35ec13c902f70334b4f08839081808280098009098391089082827f3a44a5b102f7883a2b8630a3cae6e6db2e6e483bb7cfeb3492cbd91793ef598e08839081808280098009098391089082827f43939fe8ef789acb33cbf129ba8a3aa1bd61510a178022a05177c9c5a1c59bf108839081808280098009098391089082827f936fe3b66dfda1bc5a7aae241b4db442858bd720c1d579c0c869f273cd55d77408839081808280098009098391089082827f3490fcaa8ffa37f35dc67ae006e81352c7103945417b8e4b142afcaefa344b8508839081808280098009098391089082827fcae66096cff344caca53ffe0e58aafeb468bd174f00d8abc425b2099c088187408839081808280098009098391089082827fc7d05783a41bc14f3c9a45384b6d5e2547c5b6a224c8316910b208f2718a70ab08839081808280098009098391089082827f5ac6b9ba94040d5692b865b6677b60ef3201b5c2121699f70beb9f9b2528a02608839081808280098009098391089082827fa902a3d4d9ecbfb9b2c76fddf780554bf93cad97b244e805d3adb94e1816290008839081808280098009098391089082827fe9df91ffeeb086a4d26041c29dac6fca1d56a4d022fe34b38831267395b98d2708839081808280098009098391089082827f862646f851d91a8840ad9ee711f12ec13b3e8f980ff5ef5ee43ca4520d57def708839081808280098009098391089082827f30b7381c9725b9db07816baf8524943a79cea135807c84cce0833485c11e0c2e08839081808280098009098391089082827f96afc10c5cedaddbda99df79387397c9be74a5b50f3a0c04ccb68d4e0f3a989f08839081808280098009098391089082827f3543da80d10da251c548776fe907c4ef89993d62e0062ae5c0496fcb851c366108839081808280098009098391089082827fe5140fe26d8b008430fccd50a68e3e11c1163d63b6d8b7cc40bc6f3c1d0b1b0608839081808280098009098391089082827ffefdf1872e4475e8bbb0ef6fab7f561bff121314695c433bd4c29ec118060c9608839081808280098009098391089082827f6bb8c9f3d57b18e002df059db1e6a5d42ad566f153f18460774f68ac2650940008839081808280098009098391089082827f5415122d50b26f4fab5784004c56cf03f128f825ad2236f4b3d51f74737bd97308839081808280098009098391089082827f00e115c4a98efae6a3a5ecc873b0cef63ccd5b515710a3ab03ec52218f784dc908839081808280098009098391089082827fda7d525427bad87b88238657c21331245578bc76aa6240b7f972382537a202ab08839081808280098009098391089082827f83332e8b34505b83010270dc795290a2f515b8f89c163acecdf4799df04c62f808839081808280098009098391089082827fb09ecb6033d1a065f17a61066cd737d0c3c5873b51c3ab0a285e26939e62aa1808839081808280098009098391089082827f24e65c718938c2b937378e7435332174329730bde85a4185e37875824eb4985908839081808280098009098391089082827f68e41430ccd41cc5e92a9f9acd2e955c1385b9f5ed8d3f133d767429484a8eba08839081808280098009098391089082827fc038fe9d0125ab8be54545276f841274e414c596ed4c9eaa6919604603d1ffa908839081808280098009098391089082827f23248698612cd8e83234fcf5db9b6b225f4b0ba78d72ef13ea1edff5f0fb029808839081808280098009098391089082827fd2a9fa3d39c1ba91eefa666a1db71c6e0e4e3b707626b0197a4e59e7110cf0d408839081808280098009098391089082827fc28931ee7dfa02b62872e0d937ba3dc5c637118273a1f1f0c4fc880905c82efc08839081808280098009098391089082827f01cd399556445e3d7b201d6c5e56a5794e60be2cfd9a4643e7ead79bb4f60f7908839081808280098009098391089082827fac855cc58d5fbb0dff91a79683eb0e914c1b7d8d0a540d416838a89f83a8312f08839081808280098009098391089082827ff7798af7ccf36b836705849f7dd40328bf9346657255b431446ec75a6817181608839081808280098009098391089082827fe52a24c92d3f067bf551eeaf98c62ba525e84882d7adad835fad8de72986b2b108839081808280098009098391089082827fffc8682759a2bf1dd67c87a77c285467801f1c44fd78fa4eb5957a4832c9d72d08839081808280098009098391089082827f1482ac3e7e4f321627850d95a13942aea6d2923402b913046856ff7e8aaf9aff08839081808280098009098391089082827f17332b4c7aac2a07ccfe954de7ad22ccf6fcb4c5fa15c130ed22a40ae9398f4708839081808280098009098391089082827fd4be0546013f84a0d1e118b37589723b58e323983263616d1b036f8b3fdd858308839081808280098009098391089082827fa64ec737d31dddf939b184438ccdd3e1d3e667572857cd6c9c31a0d1d9b7b08508839081808280098009098391089082827f8ad12fbc74117cff4743d674539c86548c6758710a07a6abe3715e4b53526d3408839081808280098009098391089082827f15a16435a2300b27a337561401f06682ba85019aa0af61b264a1177d38b5c13c08839081808280098009098391089082827f22616f306e76352293a22ab6ee15509d9b108d4136b32fa7f9ed259793f392a108839081808280098009098391089082827f519727b25560caf00ce0d3f911bd4356f907160ab5186da10a629c7ccae1851e08839081808280098009098391089082827fcff39e77928ce9310118d50e29bc87e7f78b53ad51366359aa17f07902ae639208839081808280098009098391089082827f17dead3bfa1968c744118023dead77cdbee22c5b7c2414f5a6bdf82fd94cf3ad08839081808280098009098391089082827f2bef0f8b22a1cfb90100f4a552a9d02b772130123de8144a00c4d57497e1d7f408839081808280098009098391089082827fbf5188713fef90b31c35243f92cfa4331ab076e30e24b355c79b01f41d152a1108839081808280098009098391089082827f3baadd2fd92e3e12fb371be0578941dc0a108fbca0a7d81b88316fb94d6b4dfe08839081808280098009098391089082827fd4f955742e20a28d38611bf9fc4a478c97b673a7cd40d0113a58a1efe338d9aa08839081808280098009098391089082827f3c1c3fe9a5f7ccd54ad5a51a224b3f94775266d19c3733017e4920d7391ad64508839081808280098009098391089082827f6372df6148abeed66fda5461779a9651130c6c525df733852bcd929016768a7a08839081808280098009098391089082827f6d098e848fb853f95adb5a6364b5ab33c79fb08877f2cf3e0e160d9fcb3ebcc508839081808280098009098391089082827f48c5fc90f27431fabfe496dfba14bb0dba71141eb5472a365fd13023f4fe629608839081808280098009098391089082827fbb988dfc0c4dfe53999bd34840adcb63fdbf501ccd622ca2ddf5064ad8cdebf408839081808280098009098391089082827f25b068c942724c424ed5851c9575c22752c9bd25f91ebfa589de3d88ee7627f908839081808280098009098391089082827fed98a1931e361add218de11ff7879bd7114cda19c24ddbe15b3b0190ce01e1aa08839081808280098009098391089082827fc80b5a7d63f6c43542ad612023d3ffd6c684ce2eab837180addcb4decf51854408839081808280098009098391089082827fe2ef24bf47c5203118c6ff96657dd3c6fdff7212d5c798d826455de77b4b70cd08839081808280098009098391089082827f907da812fd5a8375587e4860f87691d0a8d61d454c507d09e5562e1a5d0fcc7608839081808280098009098391089082827fc459abbc62bc6070cacdff597e97990de56edc51cc6643afb0f6789fef1bad6308839081808280098009098391089082827f38d61f5e566855d70d36ef0f0f1fefcd7c829bdd60d95e0ef1fb5b98856280a408839081808280098009098391089082827f13218626665c420d3aa2b0fa49224a3dce8e08b8b56f8851bd9cb5e25cb3042d08839081808280098009098391089082827f6f685fb152dba21b4d02422e237e246df73d7d711ae6d7d33983bae0f873e31008839081808280098009098391089082827f5ade34719e2498dde70e4571c40474475a4af706a3cb82ac18a7fa44c22d1c4708839081808280098009098391089082827f8a0c3dc7a496adca059cb95d9b173812a00f3c4d435e0b9e8116e0c4b5f56acb08839081808280098009098391089082827f196bc98252f63169ed79073ee091a0e8ed0b5af51017da143940c00bdb86370908839081808280098009098391089082827fd979bf70695d93f8efb552a413701918afec9e12dfe213f4d0c27cfa68fad6c208839081808280098009098391089082827fb803072d02f54d237a3c6c4cc18eda6dce87a03c6819df54e4ed8aed6dc56d4608839081808280098009098391089082827f1efcda9d986cddcf431af4d59c6a7709d650885b7886cba70f0e7cd92b331cdc08839081808280098009098391089082827fd3ca5f7859b82ac50b63da06d43aa68a6b685f0a60397638bbea173b3f60419208839081808280098009098391089082827fa59d392c0667316ad37a06be2d51aabe9e79bdef0013bc109985648a14c7e41f08839081808280098009098391089082827fac2f5f0d2146791b396e2bed6cf15a20bc22cc4c8cf7dd4b3514ac00148dd0a708839081808280098009098391089082827f17a993a6af068d72bc36f0e814d29fef3f97d7a72aa963889b16a8457409861a08839081808280098009098391089082827f6f1bf99686550e0396f7f4e2df6fdaa090fbc272c8c76eb32a3c6791de5a07b508839081808280098009098391089082827f8234d705e1ecdc59cc6ed40749069d4b45e63deb49b5b7d7f527abd31c072b1b08839081808280098009098391089082827f6fe929a1fd6aacba5c4012c45dd727d2c816119567450003913d882cb97bc47e08839081808280098009098391089082827fad5371215f2aba49026b2e48739c11b4d8ffbb24dd4a6e41b9763862af96787a08839081808280098009098391089082827fd0e704566c49e1a11edc2c128b2e07f36dc0c755468268f8fe4c4859b9fa595b08839081808280098009098391089082827f263e1195090d00be1d8fb37de17ccf3b66d180645efa0d831865cfaa8797769e08839081808280098009098391089082827fe65c090eebde2cfa7f9c92cf75641c7683fb8e81f4a48f5b7a9c7eb26a85029f08839081808280098009098391089082827fa18971781c6855f6a9752912780bb9b719c14a677a4c6393d62d6e046b97a2ac08839081808280098009098391089082827ff6fc1ef1bca8bec055cc66edecc5dc99030fe78311a3f21d8cd624df4f89e62508839081808280098009098391089082827f824e4e2838501516d3296542cb47a59a1ca4326e947c9c874d88dccc8e37b99a08839081808280098009098391089082827f3cd5a9e7353a50e454c9c1381b556b543897cc89153c3e3749f2021d8237226308839081808280098009098391089082827fb4bcedbd54d0c917a315cc7ca785e3c5995abbeeb3deb3ebaf02c7a9bf6cc83f08839081808280098009098391089082827f1f7476211105b3039cef009c51155ae93526c53a74973ecfce40754b3df1052108839081808280098009098391089082827f58aefbd978440c94b4b9fbd36e00e6e36caeacf82b0da0a6161d34c541a5a6e308839081808280098009098391089082827fc22cd6d61be780a33c77677bc6ba40307b597ed981db57cb485313eec2a5a49708839081808280098009098391089082827fd9ffc4fe0dc5f835c8dcdc1e60b8f0b1637f32a809175371b94a057272b0748d08839081808280098009098391089082827ff6a5268541bc4c64ad0ade8f55dda3492604857a71c923662a214dd7e9c20c1008839081808280098009098391089082826000088390818082800980090983910860205260005260406000f3"; +function deployHasher(signer) { + return signer.sendTransaction({ data: hasherBytecode }); +} + + +/***/ }), + +/***/ 83968: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -// ESM COMPAT FLAG -__webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { - GET_DEPOSITS: () => (/* reexport */ GET_DEPOSITS), - GET_ECHO_EVENTS: () => (/* reexport */ GET_ECHO_EVENTS), - GET_ENCRYPTED_NOTES: () => (/* reexport */ GET_ENCRYPTED_NOTES), - GET_GOVERNANCE_APY: () => (/* reexport */ GET_GOVERNANCE_APY), - GET_GOVERNANCE_EVENTS: () => (/* reexport */ GET_GOVERNANCE_EVENTS), - GET_NOTE_ACCOUNTS: () => (/* reexport */ GET_NOTE_ACCOUNTS), - GET_REGISTERED: () => (/* reexport */ GET_REGISTERED), - GET_STATISTIC: () => (/* reexport */ GET_STATISTIC), - GET_WITHDRAWALS: () => (/* reexport */ GET_WITHDRAWALS), - _META: () => (/* reexport */ _META), - getAllDeposits: () => (/* binding */ getAllDeposits), - getAllEncryptedNotes: () => (/* binding */ getAllEncryptedNotes), - getAllGovernanceEvents: () => (/* binding */ getAllGovernanceEvents), - getAllGraphEchoEvents: () => (/* binding */ getAllGraphEchoEvents), - getAllRegisters: () => (/* binding */ getAllRegisters), - getAllWithdrawals: () => (/* binding */ getAllWithdrawals), - getDeposits: () => (/* binding */ getDeposits), - getEncryptedNotes: () => (/* binding */ getEncryptedNotes), - getGovernanceEvents: () => (/* binding */ getGovernanceEvents), - getGraphEchoEvents: () => (/* binding */ getGraphEchoEvents), - getMeta: () => (/* binding */ getMeta), - getNoteAccounts: () => (/* binding */ getNoteAccounts), - getRegisters: () => (/* binding */ getRegisters), - getStatistic: () => (/* binding */ getStatistic), - getWithdrawals: () => (/* binding */ getWithdrawals), - queryGraph: () => (/* binding */ queryGraph) + Fl: () => (/* binding */ INDEX_DB_ERROR), + mc: () => (/* binding */ IndexedDB), + W7: () => (/* binding */ getIndexedDB) }); -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/address/address.js -var address_address = __webpack_require__(30031); -// EXTERNAL MODULE: ./src/providers.ts + 46 modules -var providers = __webpack_require__(68434); -;// CONCATENATED MODULE: ./src/graphql/queries.ts +;// ./node_modules/idb/build/index.js +const instanceOfAny = (object, constructors) => constructors.some((c) => object instanceof c); -const GET_STATISTIC = ` - query getStatistic($currency: String!, $amount: String!, $first: Int, $orderBy: BigInt, $orderDirection: String) { - deposits(first: $first, orderBy: $orderBy, orderDirection: $orderDirection, where: { currency: $currency, amount: $amount }) { - index - timestamp - blockNumber - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const _META = ` - query getMeta { - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_REGISTERED = ` - query getRegistered($first: Int, $fromBlock: Int) { - relayers(first: $first, orderBy: blockRegistration, orderDirection: asc, where: { - blockRegistration_gte: $fromBlock - }) { - id - address - ensName - blockRegistration - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_DEPOSITS = ` - query getDeposits($currency: String!, $amount: String!, $first: Int, $fromBlock: Int) { - deposits(first: $first, orderBy: index, orderDirection: asc, where: { - amount: $amount, - currency: $currency, - blockNumber_gte: $fromBlock - }) { - id - blockNumber - commitment - index - timestamp - from - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_WITHDRAWALS = ` - query getWithdrawals($currency: String!, $amount: String!, $first: Int, $fromBlock: Int!) { - withdrawals(first: $first, orderBy: blockNumber, orderDirection: asc, where: { - currency: $currency, - amount: $amount, - blockNumber_gte: $fromBlock - }) { - id - blockNumber - nullifier - to - fee - timestamp - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_NOTE_ACCOUNTS = ` - query getNoteAccount($address: String!) { - noteAccounts(where: { address: $address }) { - id - index - address - encryptedAccount - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_ECHO_EVENTS = ` - query getNoteAccounts($first: Int, $fromBlock: Int) { - noteAccounts(first: $first, orderBy: blockNumber, orderDirection: asc, where: { blockNumber_gte: $fromBlock }) { - id - blockNumber - address - encryptedAccount - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_ENCRYPTED_NOTES = ` - query getEncryptedNotes($first: Int, $fromBlock: Int) { - encryptedNotes(first: $first, orderBy: blockNumber, orderDirection: asc, where: { blockNumber_gte: $fromBlock }) { - blockNumber - index - transactionHash - encryptedNote - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_GOVERNANCE_EVENTS = ` - query getGovernanceEvents($first: Int, $fromBlock: Int) { - proposals(first: $first, orderBy: blockNumber, orderDirection: asc, where: { blockNumber_gte: $fromBlock }) { - blockNumber - logIndex - transactionHash - proposalId - proposer - target - startTime - endTime - description - } - votes(first: $first, orderBy: blockNumber, orderDirection: asc, where: { blockNumber_gte: $fromBlock }) { - blockNumber - logIndex - transactionHash - proposalId - voter - support - votes - from - input - } - delegates(first: $first, orderBy: blockNumber, orderDirection: asc, where: { blockNumber_gte: $fromBlock }) { - blockNumber - logIndex - transactionHash - account - delegateTo - } - undelegates(first: $first, orderBy: blockNumber, orderDirection: asc, where: { blockNumber_gte: $fromBlock }) { - blockNumber - logIndex - transactionHash - account - delegateFrom - } - _meta { - block { - number - } - hasIndexingErrors - } - } -`; -const GET_GOVERNANCE_APY = ` - stakeDailyBurns(first: 30, orderBy: date, orderDirection: desc) { - id - date - dailyAmountBurned - } -`; - -;// CONCATENATED MODULE: ./src/graphql/index.ts -/* provided dependency */ var console = __webpack_require__(96763); - -var __defProp = Object.defineProperty; -var __defProps = Object.defineProperties; -var __getOwnPropDescs = Object.getOwnPropertyDescriptors; -var __getOwnPropSymbols = Object.getOwnPropertySymbols; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __propIsEnum = Object.prototype.propertyIsEnumerable; -var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __spreadValues = (a, b) => { - for (var prop in b || (b = {})) - if (__hasOwnProp.call(b, prop)) - __defNormalProp(a, prop, b[prop]); - if (__getOwnPropSymbols) - for (var prop of __getOwnPropSymbols(b)) { - if (__propIsEnum.call(b, prop)) - __defNormalProp(a, prop, b[prop]); - } - return a; -}; -var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); -var __async = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; - - - - -const isEmptyArray = (arr) => !Array.isArray(arr) || !arr.length; -const GRAPHQL_LIMIT = 1e3; -function queryGraph(_0) { - return __async(this, arguments, function* ({ - graphApi, - subgraphName, - query, - variables, - fetchDataOptions: fetchDataOptions2 - }) { - var _a; - const graphUrl = `${graphApi}/subgraphs/name/${subgraphName}`; - const { data, errors } = yield (0,providers/* fetchData */.Fd)(graphUrl, __spreadProps(__spreadValues({}, fetchDataOptions2), { - method: "POST", - headers: { - "Content-Type": "application/json" - }, - body: JSON.stringify({ - query, - variables - }) - })); - if (errors) { - throw new Error(JSON.stringify(errors)); - } - if ((_a = data == null ? void 0 : data._meta) == null ? void 0 : _a.hasIndexingErrors) { - throw new Error("Subgraph has indexing errors"); - } - return data; - }); +let idbProxyableTypes; +let cursorAdvanceMethods; +// This is a function to prevent it throwing up in node environments. +function getIdbProxyableTypes() { + return (idbProxyableTypes || + (idbProxyableTypes = [ + IDBDatabase, + IDBObjectStore, + IDBIndex, + IDBCursor, + IDBTransaction, + ])); } -function getStatistic(_0) { - return __async(this, arguments, function* ({ - graphApi, - subgraphName, - currency, - amount, - fetchDataOptions: fetchDataOptions2 - }) { - try { - const { - deposits, - _meta: { - block: { number: lastSyncBlock } - } - } = yield queryGraph({ - graphApi, - subgraphName, - query: GET_STATISTIC, - variables: { - currency, - first: 10, - orderBy: "index", - orderDirection: "desc", - amount - }, - fetchDataOptions: fetchDataOptions2 - }); - const events = deposits.map((e) => ({ - timestamp: Number(e.timestamp), - leafIndex: Number(e.index), - blockNumber: Number(e.blockNumber) - })).reverse(); - const [lastEvent] = events.slice(-1); - return { - events, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock - }; - } catch (err) { - console.log("Error from getStatistic query"); - console.log(err); - return { - events: [], - lastSyncBlock: null - }; - } - }); +// This is a function to prevent it throwing up in node environments. +function getCursorAdvanceMethods() { + return (cursorAdvanceMethods || + (cursorAdvanceMethods = [ + IDBCursor.prototype.advance, + IDBCursor.prototype.continue, + IDBCursor.prototype.continuePrimaryKey, + ])); } -function getMeta(_0) { - return __async(this, arguments, function* ({ graphApi, subgraphName, fetchDataOptions: fetchDataOptions2 }) { - try { - const { - _meta: { - block: { number: lastSyncBlock }, - hasIndexingErrors - } - } = yield queryGraph({ - graphApi, - subgraphName, - query: _META, - fetchDataOptions: fetchDataOptions2 - }); - return { - lastSyncBlock, - hasIndexingErrors - }; - } catch (err) { - console.log("Error from getMeta query"); - console.log(err); - return { - lastSyncBlock: null, - hasIndexingErrors: null - }; - } - }); -} -function getRegisters({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2 -}) { - return queryGraph({ - graphApi, - subgraphName, - query: GET_REGISTERED, - variables: { - first: GRAPHQL_LIMIT, - fromBlock - }, - fetchDataOptions: fetchDataOptions2 - }); -} -function getAllRegisters(_0) { - return __async(this, arguments, function* ({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2, - onProgress - }) { - try { - const events = []; - let lastSyncBlock = fromBlock; - while (true) { - let { - relayers: result2, - _meta: { - // eslint-disable-next-line prefer-const - block: { number: currentBlock } - } - } = yield getRegisters({ graphApi, subgraphName, fromBlock, fetchDataOptions: fetchDataOptions2 }); - lastSyncBlock = currentBlock; - if (isEmptyArray(result2)) { - break; - } - const [firstEvent] = result2; - const [lastEvent] = result2.slice(-1); - if (typeof onProgress === "function") { - onProgress({ - type: "Registers", - fromBlock: Number(firstEvent.blockRegistration), - toBlock: Number(lastEvent.blockRegistration), - count: result2.length - }); - } - if (result2.length < 900) { - events.push(...result2); - break; - } - result2 = result2.filter(({ blockRegistration }) => blockRegistration !== lastEvent.blockRegistration); - fromBlock = Number(lastEvent.blockRegistration); - events.push(...result2); - } - if (!events.length) { - return { - events: [], - lastSyncBlock +const transactionDoneMap = new WeakMap(); +const transformCache = new WeakMap(); +const reverseTransformCache = new WeakMap(); +function promisifyRequest(request) { + const promise = new Promise((resolve, reject) => { + const unlisten = () => { + request.removeEventListener('success', success); + request.removeEventListener('error', error); }; - } - const result = events.map(({ id, address, ensName, blockRegistration }) => { - const [transactionHash, logIndex] = id.split("-"); - return { - blockNumber: Number(blockRegistration), - logIndex: Number(logIndex), - transactionHash, - ensName, - relayerAddress: (0,address_address/* getAddress */.b)(address) + const success = () => { + resolve(wrap(request.result)); + unlisten(); }; - }); - return { - events: result, - lastSyncBlock - }; - } catch (err) { - console.log("Error from getAllRegisters query"); - console.log(err); - return { events: [], lastSyncBlock: fromBlock }; - } - }); -} -function getDeposits({ - graphApi, - subgraphName, - currency, - amount, - fromBlock, - fetchDataOptions: fetchDataOptions2 -}) { - return queryGraph({ - graphApi, - subgraphName, - query: GET_DEPOSITS, - variables: { - currency, - amount, - first: GRAPHQL_LIMIT, - fromBlock - }, - fetchDataOptions: fetchDataOptions2 - }); -} -function getAllDeposits(_0) { - return __async(this, arguments, function* ({ - graphApi, - subgraphName, - currency, - amount, - fromBlock, - fetchDataOptions: fetchDataOptions2, - onProgress - }) { - try { - const events = []; - let lastSyncBlock = fromBlock; - while (true) { - let { - deposits: result2, - _meta: { - // eslint-disable-next-line prefer-const - block: { number: currentBlock } - } - } = yield getDeposits({ graphApi, subgraphName, currency, amount, fromBlock, fetchDataOptions: fetchDataOptions2 }); - lastSyncBlock = currentBlock; - if (isEmptyArray(result2)) { - break; - } - const [firstEvent] = result2; - const [lastEvent2] = result2.slice(-1); - if (typeof onProgress === "function") { - onProgress({ - type: "Deposits", - fromBlock: Number(firstEvent.blockNumber), - toBlock: Number(lastEvent2.blockNumber), - count: result2.length - }); - } - if (result2.length < 900) { - events.push(...result2); - break; - } - result2 = result2.filter(({ blockNumber }) => blockNumber !== lastEvent2.blockNumber); - fromBlock = Number(lastEvent2.blockNumber); - events.push(...result2); - } - if (!events.length) { - return { - events: [], - lastSyncBlock + const error = () => { + reject(request.error); + unlisten(); }; - } - const result = events.map(({ id, blockNumber, commitment, index, timestamp, from }) => { - const [transactionHash, logIndex] = id.split("-"); - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - commitment, - leafIndex: Number(index), - timestamp: Number(timestamp), - from: (0,address_address/* getAddress */.b)(from) + request.addEventListener('success', success); + request.addEventListener('error', error); + }); + // This mapping exists in reverseTransformCache but doesn't doesn't exist in transformCache. This + // is because we create many promises from a single IDBRequest. + reverseTransformCache.set(promise, request); + return promise; +} +function cacheDonePromiseForTransaction(tx) { + // Early bail if we've already created a done promise for this transaction. + if (transactionDoneMap.has(tx)) + return; + const done = new Promise((resolve, reject) => { + const unlisten = () => { + tx.removeEventListener('complete', complete); + tx.removeEventListener('error', error); + tx.removeEventListener('abort', error); }; - }); - const [lastEvent] = result.slice(-1); - return { - events: result, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock - }; - } catch (err) { - console.log("Error from getAllDeposits query"); - console.log(err); - return { - events: [], - lastSyncBlock: fromBlock - }; - } - }); -} -function getWithdrawals({ - graphApi, - subgraphName, - currency, - amount, - fromBlock, - fetchDataOptions: fetchDataOptions2 -}) { - return queryGraph({ - graphApi, - subgraphName, - query: GET_WITHDRAWALS, - variables: { - currency, - amount, - first: GRAPHQL_LIMIT, - fromBlock - }, - fetchDataOptions: fetchDataOptions2 - }); -} -function getAllWithdrawals(_0) { - return __async(this, arguments, function* ({ - graphApi, - subgraphName, - currency, - amount, - fromBlock, - fetchDataOptions: fetchDataOptions2, - onProgress - }) { - try { - const events = []; - let lastSyncBlock = fromBlock; - while (true) { - let { - withdrawals: result2, - _meta: { - // eslint-disable-next-line prefer-const - block: { number: currentBlock } - } - } = yield getWithdrawals({ graphApi, subgraphName, currency, amount, fromBlock, fetchDataOptions: fetchDataOptions2 }); - lastSyncBlock = currentBlock; - if (isEmptyArray(result2)) { - break; - } - const [firstEvent] = result2; - const [lastEvent2] = result2.slice(-1); - if (typeof onProgress === "function") { - onProgress({ - type: "Withdrawals", - fromBlock: Number(firstEvent.blockNumber), - toBlock: Number(lastEvent2.blockNumber), - count: result2.length - }); - } - if (result2.length < 900) { - events.push(...result2); - break; - } - result2 = result2.filter(({ blockNumber }) => blockNumber !== lastEvent2.blockNumber); - fromBlock = Number(lastEvent2.blockNumber); - events.push(...result2); - } - if (!events.length) { - return { - events: [], - lastSyncBlock + const complete = () => { + resolve(); + unlisten(); }; - } - const result = events.map(({ id, blockNumber, nullifier, to, fee, timestamp }) => { - const [transactionHash, logIndex] = id.split("-"); - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - nullifierHash: nullifier, - to: (0,address_address/* getAddress */.b)(to), - fee, - timestamp: Number(timestamp) + const error = () => { + reject(tx.error || new DOMException('AbortError', 'AbortError')); + unlisten(); }; - }); - const [lastEvent] = result.slice(-1); - return { - events: result, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock - }; - } catch (err) { - console.log("Error from getAllWithdrawals query"); - console.log(err); - return { - events: [], - lastSyncBlock: fromBlock - }; - } - }); + tx.addEventListener('complete', complete); + tx.addEventListener('error', error); + tx.addEventListener('abort', error); + }); + // Cache it for later retrieval. + transactionDoneMap.set(tx, done); } -function getNoteAccounts(_0) { - return __async(this, arguments, function* ({ - graphApi, - subgraphName, - address, - fetchDataOptions: fetchDataOptions2 - }) { - try { - const { - noteAccounts: events, - _meta: { - block: { number: lastSyncBlock } - } - } = yield queryGraph({ - graphApi, - subgraphName, - query: GET_NOTE_ACCOUNTS, - variables: { - address: address.toLowerCase() - }, - fetchDataOptions: fetchDataOptions2 - }); - return { - events, - lastSyncBlock - }; - } catch (err) { - console.log("Error from getNoteAccounts query"); - console.log(err); - return { - events: [], - lastSyncBlock: null - }; - } - }); -} -function getGraphEchoEvents({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2 -}) { - return queryGraph({ - graphApi, - subgraphName, - query: GET_ECHO_EVENTS, - variables: { - first: GRAPHQL_LIMIT, - fromBlock - }, - fetchDataOptions: fetchDataOptions2 - }); -} -function getAllGraphEchoEvents(_0) { - return __async(this, arguments, function* ({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2, - onProgress - }) { - try { - const events = []; - let lastSyncBlock = fromBlock; - while (true) { - let { - noteAccounts: result2, - _meta: { - // eslint-disable-next-line prefer-const - block: { number: currentBlock } - } - } = yield getGraphEchoEvents({ graphApi, subgraphName, fromBlock, fetchDataOptions: fetchDataOptions2 }); - lastSyncBlock = currentBlock; - if (isEmptyArray(result2)) { - break; - } - const [firstEvent] = result2; - const [lastEvent2] = result2.slice(-1); - if (typeof onProgress === "function") { - onProgress({ - type: "EchoEvents", - fromBlock: Number(firstEvent.blockNumber), - toBlock: Number(lastEvent2.blockNumber), - count: result2.length - }); - } - if (result2.length < 900) { - events.push(...result2); - break; - } - result2 = result2.filter(({ blockNumber }) => blockNumber !== lastEvent2.blockNumber); - fromBlock = Number(lastEvent2.blockNumber); - events.push(...result2); - } - if (!events.length) { - return { - events: [], - lastSyncBlock - }; - } - const result = events.map((e) => { - const [transactionHash, logIndex] = e.id.split("-"); - return { - blockNumber: Number(e.blockNumber), - logIndex: Number(logIndex), - transactionHash, - address: (0,address_address/* getAddress */.b)(e.address), - encryptedAccount: e.encryptedAccount - }; - }); - const [lastEvent] = result.slice(-1); - return { - events: result, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock - }; - } catch (err) { - console.log("Error from getAllGraphEchoEvents query"); - console.log(err); - return { - events: [], - lastSyncBlock: fromBlock - }; - } - }); -} -function getEncryptedNotes({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2 -}) { - return queryGraph({ - graphApi, - subgraphName, - query: GET_ENCRYPTED_NOTES, - variables: { - first: GRAPHQL_LIMIT, - fromBlock - }, - fetchDataOptions: fetchDataOptions2 - }); -} -function getAllEncryptedNotes(_0) { - return __async(this, arguments, function* ({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2, - onProgress - }) { - try { - const events = []; - let lastSyncBlock = fromBlock; - while (true) { - let { - encryptedNotes: result2, - _meta: { - // eslint-disable-next-line prefer-const - block: { number: currentBlock } - } - } = yield getEncryptedNotes({ graphApi, subgraphName, fromBlock, fetchDataOptions: fetchDataOptions2 }); - lastSyncBlock = currentBlock; - if (isEmptyArray(result2)) { - break; - } - const [firstEvent] = result2; - const [lastEvent2] = result2.slice(-1); - if (typeof onProgress === "function") { - onProgress({ - type: "EncryptedNotes", - fromBlock: Number(firstEvent.blockNumber), - toBlock: Number(lastEvent2.blockNumber), - count: result2.length - }); - } - if (result2.length < 900) { - events.push(...result2); - break; - } - result2 = result2.filter(({ blockNumber }) => blockNumber !== lastEvent2.blockNumber); - fromBlock = Number(lastEvent2.blockNumber); - events.push(...result2); - } - if (!events.length) { - return { - events: [], - lastSyncBlock - }; - } - const result = events.map((e) => ({ - blockNumber: Number(e.blockNumber), - logIndex: Number(e.index), - transactionHash: e.transactionHash, - encryptedNote: e.encryptedNote - })); - const [lastEvent] = result.slice(-1); - return { - events: result, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock - }; - } catch (err) { - console.log("Error from getAllEncryptedNotes query"); - console.log(err); - return { - events: [], - lastSyncBlock: fromBlock - }; - } - }); -} -function getGovernanceEvents({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2 -}) { - return queryGraph({ - graphApi, - subgraphName, - query: GET_GOVERNANCE_EVENTS, - variables: { - first: GRAPHQL_LIMIT, - fromBlock - }, - fetchDataOptions: fetchDataOptions2 - }); -} -function getAllGovernanceEvents(_0) { - return __async(this, arguments, function* ({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions: fetchDataOptions2, - onProgress - }) { - try { - const result = []; - let lastSyncBlock = fromBlock; - while (true) { - const { - proposals, - votes, - delegates, - undelegates, - _meta: { - block: { number: currentBlock } - } - } = yield getGovernanceEvents({ graphApi, subgraphName, fromBlock, fetchDataOptions: fetchDataOptions2 }); - lastSyncBlock = currentBlock; - const eventsLength = proposals.length + votes.length + delegates.length + undelegates.length; - if (eventsLength === 0) { - break; - } - const formattedProposals = proposals.map( - ({ blockNumber, logIndex, transactionHash, proposalId, proposer, target, startTime, endTime, description }) => { - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - event: "ProposalCreated", - id: Number(proposalId), - proposer: (0,address_address/* getAddress */.b)(proposer), - target: (0,address_address/* getAddress */.b)(target), - startTime: Number(startTime), - endTime: Number(endTime), - description - }; - } - ); - const formattedVotes = votes.map( - ({ blockNumber, logIndex, transactionHash, proposalId, voter, support, votes: votes2, from, input }) => { - if (!input || input.length > 2048) { - input = ""; +let idbProxyTraps = { + get(target, prop, receiver) { + if (target instanceof IDBTransaction) { + // Special handling for transaction.done. + if (prop === 'done') + return transactionDoneMap.get(target); + // Make tx.store return the only store in the transaction, or undefined if there are many. + if (prop === 'store') { + return receiver.objectStoreNames[1] + ? undefined + : receiver.objectStore(receiver.objectStoreNames[0]); } - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - event: "Voted", - proposalId: Number(proposalId), - voter: (0,address_address/* getAddress */.b)(voter), - support, - votes: votes2, - from: (0,address_address/* getAddress */.b)(from), - input - }; - } - ); - const formattedDelegates = delegates.map( - ({ blockNumber, logIndex, transactionHash, account, delegateTo }) => { - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - event: "Delegated", - account: (0,address_address/* getAddress */.b)(account), - delegateTo: (0,address_address/* getAddress */.b)(delegateTo) - }; - } - ); - const formattedUndelegates = undelegates.map( - ({ blockNumber, logIndex, transactionHash, account, delegateFrom }) => { - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - event: "Undelegated", - account: (0,address_address/* getAddress */.b)(account), - delegateFrom: (0,address_address/* getAddress */.b)(delegateFrom) - }; - } - ); - let formattedEvents = [ - ...formattedProposals, - ...formattedVotes, - ...formattedDelegates, - ...formattedUndelegates - ].sort((a, b) => { - if (a.blockNumber === b.blockNumber) { - return a.logIndex - b.logIndex; - } - return a.blockNumber - b.blockNumber; - }); - if (eventsLength < 900) { - result.push(...formattedEvents); - break; } - const [firstEvent] = formattedEvents; - const [lastEvent2] = formattedEvents.slice(-1); - if (typeof onProgress === "function") { - onProgress({ - type: "Governance Events", - fromBlock: Number(firstEvent.blockNumber), - toBlock: Number(lastEvent2.blockNumber), - count: eventsLength - }); + // Else transform whatever we get back. + return wrap(target[prop]); + }, + set(target, prop, value) { + target[prop] = value; + return true; + }, + has(target, prop) { + if (target instanceof IDBTransaction && + (prop === 'done' || prop === 'store')) { + return true; } - formattedEvents = formattedEvents.filter(({ blockNumber }) => blockNumber !== lastEvent2.blockNumber); - fromBlock = Number(lastEvent2.blockNumber); - result.push(...formattedEvents); - } - const [lastEvent] = result.slice(-1); - return { - events: result, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock - }; - } catch (err) { - console.log("Error from getAllGovernance query"); - console.log(err); - return { - events: [], - lastSyncBlock: fromBlock - }; + return prop in target; + }, +}; +function replaceTraps(callback) { + idbProxyTraps = callback(idbProxyTraps); +} +function wrapFunction(func) { + // Due to expected object equality (which is enforced by the caching in `wrap`), we + // only create one new func per func. + // Cursor methods are special, as the behaviour is a little more different to standard IDB. In + // IDB, you advance the cursor and wait for a new 'success' on the IDBRequest that gave you the + // cursor. It's kinda like a promise that can resolve with many values. That doesn't make sense + // with real promises, so each advance methods returns a new promise for the cursor object, or + // undefined if the end of the cursor has been reached. + if (getCursorAdvanceMethods().includes(func)) { + return function (...args) { + // Calling the original function with the proxy as 'this' causes ILLEGAL INVOCATION, so we use + // the original object. + func.apply(unwrap(this), args); + return wrap(this.request); + }; } + return function (...args) { + // Calling the original function with the proxy as 'this' causes ILLEGAL INVOCATION, so we use + // the original object. + return wrap(func.apply(unwrap(this), args)); + }; +} +function transformCachableValue(value) { + if (typeof value === 'function') + return wrapFunction(value); + // This doesn't return, it just creates a 'done' promise for the transaction, + // which is later returned for transaction.done (see idbObjectHandler). + if (value instanceof IDBTransaction) + cacheDonePromiseForTransaction(value); + if (instanceOfAny(value, getIdbProxyableTypes())) + return new Proxy(value, idbProxyTraps); + // Return the same value back if we're not going to transform it. + return value; +} +function wrap(value) { + // We sometimes generate multiple promises from a single IDBRequest (eg when cursoring), because + // IDB is weird and a single IDBRequest can yield many responses, so these can't be cached. + if (value instanceof IDBRequest) + return promisifyRequest(value); + // If we've already transformed this value before, reuse the transformed value. + // This is faster, but it also provides object equality. + if (transformCache.has(value)) + return transformCache.get(value); + const newValue = transformCachableValue(value); + // Not all types are transformed. + // These may be primitive types, so they can't be WeakMap keys. + if (newValue !== value) { + transformCache.set(value, newValue); + reverseTransformCache.set(newValue, value); + } + return newValue; +} +const unwrap = (value) => reverseTransformCache.get(value); + +/** + * Open a database. + * + * @param name Name of the database. + * @param version Schema version. + * @param callbacks Additional callbacks. + */ +function openDB(name, version, { blocked, upgrade, blocking, terminated } = {}) { + const request = indexedDB.open(name, version); + const openPromise = wrap(request); + if (upgrade) { + request.addEventListener('upgradeneeded', (event) => { + upgrade(wrap(request.result), event.oldVersion, event.newVersion, wrap(request.transaction), event); + }); + } + if (blocked) { + request.addEventListener('blocked', (event) => blocked( + // Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405 + event.oldVersion, event.newVersion, event)); + } + openPromise + .then((db) => { + if (terminated) + db.addEventListener('close', () => terminated()); + if (blocking) { + db.addEventListener('versionchange', (event) => blocking(event.oldVersion, event.newVersion, event)); + } + }) + .catch(() => { }); + return openPromise; +} +/** + * Delete a database. + * + * @param name Name of the database. + */ +function deleteDB(name, { blocked } = {}) { + const request = indexedDB.deleteDatabase(name); + if (blocked) { + request.addEventListener('blocked', (event) => blocked( + // Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405 + event.oldVersion, event)); + } + return wrap(request).then(() => undefined); +} + +const readMethods = ['get', 'getKey', 'getAll', 'getAllKeys', 'count']; +const writeMethods = ['put', 'add', 'delete', 'clear']; +const cachedMethods = new Map(); +function getMethod(target, prop) { + if (!(target instanceof IDBDatabase && + !(prop in target) && + typeof prop === 'string')) { + return; + } + if (cachedMethods.get(prop)) + return cachedMethods.get(prop); + const targetFuncName = prop.replace(/FromIndex$/, ''); + const useIndex = prop !== targetFuncName; + const isWrite = writeMethods.includes(targetFuncName); + if ( + // Bail if the target doesn't exist on the target. Eg, getAll isn't in Edge. + !(targetFuncName in (useIndex ? IDBIndex : IDBObjectStore).prototype) || + !(isWrite || readMethods.includes(targetFuncName))) { + return; + } + const method = async function (storeName, ...args) { + // isWrite ? 'readwrite' : undefined gzipps better, but fails in Edge :( + const tx = this.transaction(storeName, isWrite ? 'readwrite' : 'readonly'); + let target = tx.store; + if (useIndex) + target = target.index(args.shift()); + // Must reject if op rejects. + // If it's a write operation, must reject if tx.done rejects. + // Must reject with op rejection first. + // Must resolve with op value. + // Must handle both promises (no unhandled rejections) + return (await Promise.all([ + target[targetFuncName](...args), + isWrite && tx.done, + ]))[0]; + }; + cachedMethods.set(prop, method); + return method; +} +replaceTraps((oldTraps) => ({ + ...oldTraps, + get: (target, prop, receiver) => getMethod(target, prop) || oldTraps.get(target, prop, receiver), + has: (target, prop) => !!getMethod(target, prop) || oldTraps.has(target, prop), +})); + +const advanceMethodProps = ['continue', 'continuePrimaryKey', 'advance']; +const methodMap = {}; +const advanceResults = new WeakMap(); +const ittrProxiedCursorToOriginalProxy = new WeakMap(); +const cursorIteratorTraps = { + get(target, prop) { + if (!advanceMethodProps.includes(prop)) + return target[prop]; + let cachedFunc = methodMap[prop]; + if (!cachedFunc) { + cachedFunc = methodMap[prop] = function (...args) { + advanceResults.set(this, ittrProxiedCursorToOriginalProxy.get(this)[prop](...args)); + }; + } + return cachedFunc; + }, +}; +async function* iterate(...args) { + // tslint:disable-next-line:no-this-assignment + let cursor = this; + if (!(cursor instanceof IDBCursor)) { + cursor = await cursor.openCursor(...args); + } + if (!cursor) + return; + cursor = cursor; + const proxiedCursor = new Proxy(cursor, cursorIteratorTraps); + ittrProxiedCursorToOriginalProxy.set(proxiedCursor, cursor); + // Map this double-proxy back to the original, so other cursor methods work. + reverseTransformCache.set(proxiedCursor, unwrap(cursor)); + while (cursor) { + yield proxiedCursor; + // If one of the advancing methods was not called, call continue(). + cursor = await (advanceResults.get(proxiedCursor) || cursor.continue()); + advanceResults.delete(proxiedCursor); + } +} +function isIteratorProp(target, prop) { + return ((prop === Symbol.asyncIterator && + instanceOfAny(target, [IDBIndex, IDBObjectStore, IDBCursor])) || + (prop === 'iterate' && instanceOfAny(target, [IDBIndex, IDBObjectStore]))); +} +replaceTraps((oldTraps) => ({ + ...oldTraps, + get(target, prop, receiver) { + if (isIteratorProp(target, prop)) + return iterate; + return oldTraps.get(target, prop, receiver); + }, + has(target, prop) { + return isIteratorProp(target, prop) || oldTraps.has(target, prop); + }, +})); + + + +// EXTERNAL MODULE: ./src/networkConfig.ts +var networkConfig = __webpack_require__(59499); +;// ./src/idb.ts + + + +const INDEX_DB_ERROR = "A mutation operation was attempted on a database that did not allow mutations."; +class IndexedDB { + dbExists; + isBlocked; + // todo: TestDBSchema on any + options; + dbName; + dbVersion; + db; + constructor({ dbName, stores }) { + this.dbExists = false; + this.isBlocked = false; + this.options = { + upgrade(db) { + Object.values(db.objectStoreNames).forEach((value) => { + db.deleteObjectStore(value); + }); + [{ name: "keyval" }, ...stores || []].forEach(({ name, keyPath, indexes }) => { + const store = db.createObjectStore(name, { + keyPath, + autoIncrement: true + }); + if (Array.isArray(indexes)) { + indexes.forEach(({ name: name2, unique = false }) => { + store.createIndex(name2, name2, { unique }); + }); + } + }); + } + }; + this.dbName = dbName; + this.dbVersion = 35; + } + async initDB() { + try { + if (this.dbExists || this.isBlocked) { + return; + } + this.db = await openDB(this.dbName, this.dbVersion, this.options); + this.db.addEventListener("onupgradeneeded", async () => { + await this._removeExist(); + }); + this.dbExists = true; + } catch (err) { + if (err.message.includes(INDEX_DB_ERROR)) { + console.log("This browser does not support IndexedDB!"); + this.isBlocked = true; + return; + } + if (err.message.includes("less than the existing version")) { + console.log(`Upgrading DB ${this.dbName} to ${this.dbVersion}`); + await this._removeExist(); + return; + } + console.error(`Method initDB has error: ${err.message}`); + } + } + async _removeExist() { + await deleteDB(this.dbName); + this.dbExists = false; + await this.initDB(); + } + async getFromIndex({ + storeName, + indexName, + key + }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + return await this.db.getFromIndex(storeName, indexName, key); + } catch (err) { + throw new Error(`Method getFromIndex has error: ${err.message}`); + } + } + async getAllFromIndex({ + storeName, + indexName, + key, + count + }) { + await this.initDB(); + if (!this.db) { + return []; + } + try { + return await this.db.getAllFromIndex(storeName, indexName, key, count); + } catch (err) { + throw new Error(`Method getAllFromIndex has error: ${err.message}`); + } + } + async getItem({ storeName, key }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + const store = this.db.transaction(storeName).objectStore(storeName); + return await store.get(key); + } catch (err) { + throw new Error(`Method getItem has error: ${err.message}`); + } + } + async addItem({ storeName, data, key = "" }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + const tx = this.db.transaction(storeName, "readwrite"); + const isExist = await tx.objectStore(storeName).get(key); + if (!isExist) { + await tx.objectStore(storeName).add(data); + } + } catch (err) { + throw new Error(`Method addItem has error: ${err.message}`); + } + } + async putItem({ storeName, data, key }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + const tx = this.db.transaction(storeName, "readwrite"); + await tx.objectStore(storeName).put(data, key); + } catch (err) { + throw new Error(`Method putItem has error: ${err.message}`); + } + } + async deleteItem({ storeName, key }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + const tx = this.db.transaction(storeName, "readwrite"); + await tx.objectStore(storeName).delete(key); + } catch (err) { + throw new Error(`Method deleteItem has error: ${err.message}`); + } + } + async getAll({ storeName }) { + await this.initDB(); + if (!this.db) { + return []; + } + try { + const tx = this.db.transaction(storeName, "readonly"); + return await tx.objectStore(storeName).getAll(); + } catch (err) { + throw new Error(`Method getAll has error: ${err.message}`); + } + } + /** + * Simple key-value store inspired by idb-keyval package + */ + getValue(key) { + return this.getItem({ storeName: "keyval", key }); + } + setValue(key, data) { + return this.putItem({ storeName: "keyval", key, data }); + } + delValue(key) { + return this.deleteItem({ storeName: "keyval", key }); + } + async clearStore({ storeName, mode = "readwrite" }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + const tx = this.db.transaction(storeName, mode); + await tx.objectStore(storeName).clear(); + } catch (err) { + throw new Error(`Method clearStore has error: ${err.message}`); + } + } + async createTransactions({ + storeName, + data, + mode = "readwrite" + }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + const tx = this.db.transaction(storeName, mode); + await tx.objectStore(storeName).add(data); + await tx.done; + } catch (err) { + throw new Error(`Method createTransactions has error: ${err.message}`); + } + } + async createMultipleTransactions({ + storeName, + data, + index, + mode = "readwrite" + }) { + await this.initDB(); + if (!this.db) { + return; + } + try { + const tx = this.db.transaction(storeName, mode); + for (const item of data) { + if (item) { + await tx.store.put({ ...item, ...index }); + } + } + } catch (err) { + throw new Error(`Method createMultipleTransactions has error: ${err.message}`); + } + } +} +async function getIndexedDB(netId) { + if (!netId) { + const idb2 = new IndexedDB({ dbName: "tornado-core" }); + await idb2.initDB(); + return idb2; + } + const minimalIndexes = [ + { + name: "blockNumber", + unique: false + }, + { + name: "transactionHash", + unique: false + } + ]; + const defaultState = [ + { + name: `echo_${netId}`, + keyPath: "eid", + indexes: [ + ...minimalIndexes, + { + name: "address", + unique: false + } + ] + }, + { + name: `encrypted_notes_${netId}`, + keyPath: "eid", + indexes: minimalIndexes + }, + { + name: "lastEvents", + keyPath: "name", + indexes: [ + { + name: "name", + unique: false + } + ] + } + ]; + const config = (0,networkConfig/* getConfig */.zj)(netId); + const { tokens, nativeCurrency, registryContract, governanceContract } = config; + const stores = [...defaultState]; + if (registryContract) { + stores.push({ + name: `registry_${netId}`, + keyPath: "ensName", + indexes: [ + ...minimalIndexes, + { + name: "event", + unique: false + } + ] + }); + stores.push({ + name: `relayers_${netId}`, + keyPath: "timestamp", + indexes: [ + { + name: "timestamp", + unique: true + } + ] + }); + stores.push({ + name: `revenue_${netId}`, + keyPath: "timestamp", + indexes: [ + { + name: "timestamp", + unique: true + } + ] + }); + } + if (governanceContract) { + stores.push({ + name: `governance_${netId}`, + keyPath: "eid", + indexes: [ + ...minimalIndexes, + { + name: "event", + unique: false + } + ] + }); + } + Object.entries(tokens).forEach(([token, { instanceAddress }]) => { + Object.keys(instanceAddress).forEach((amount) => { + if (nativeCurrency === token) { + stores.push( + { + name: `stringify_bloom_${netId}_${token}_${amount}`, + keyPath: "hashBloom", + indexes: [] + }, + { + name: `stringify_tree_${netId}_${token}_${amount}`, + keyPath: "hashTree", + indexes: [] + } + ); + } + stores.push( + { + name: `deposits_${netId}_${token}_${amount}`, + keyPath: "leafIndex", + // the key by which it refers to the object must be in all instances of the storage + indexes: [ + ...minimalIndexes, + { + name: "commitment", + unique: true + } + ] + }, + { + name: `withdrawals_${netId}_${token}_${amount}`, + keyPath: "eid", + indexes: [ + ...minimalIndexes, + { + name: "nullifierHash", + unique: true + } + // keys on which the index is created + ] + } + ); + }); + }); + const idb = new IndexedDB({ + dbName: `tornado_core_${netId}`, + stores + }); + await idb.initDB(); + return idb; +} + + +/***/ }), + +/***/ 57390: +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ W: () => (/* binding */ fetchIp) +/* harmony export */ }); +/* harmony import */ var _providers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(46170); + + +async function fetchIp(ipEcho) { + return await (0,_providers__WEBPACK_IMPORTED_MODULE_0__/* .fetchData */ .Fd)(ipEcho, { + method: "GET", + timeout: 3e4 }); } @@ -62590,33 +94564,21 @@ function getAllGovernanceEvents(_0) { /* harmony import */ var _tornado_fixed_merkle_tree__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_tornado_fixed_merkle_tree__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(67418); /* harmony import */ var _mimc__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(22901); -/* provided dependency */ var console = __webpack_require__(96763); -var __async = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; class MerkleTreeService { + currency; + amount; + netId; + Tornado; + commitmentHex; + instanceName; + merkleTreeHeight; + emptyElement; + merkleWorkerPath; constructor({ netId, amount, @@ -62638,130 +94600,127 @@ class MerkleTreeService { this.emptyElement = emptyElement; this.merkleWorkerPath = merkleWorkerPath; } - createTree(events) { - return __async(this, null, function* () { - const { hash: hashFunction } = yield _mimc__WEBPACK_IMPORTED_MODULE_3__/* .mimc */ .f.getHash(); - if (this.merkleWorkerPath) { - console.log("Using merkleWorker\n"); - try { - if (_utils__WEBPACK_IMPORTED_MODULE_2__/* .isNode */ .Ll) { - const merkleWorkerPromise = new Promise((resolve, reject) => { - const worker = new worker_threads__WEBPACK_IMPORTED_MODULE_0__.Worker(this.merkleWorkerPath, { - workerData: { - merkleTreeHeight: this.merkleTreeHeight, - elements: events, - zeroElement: this.emptyElement - } - }); - worker.on("message", resolve); - worker.on("error", reject); - worker.on("exit", (code) => { - if (code !== 0) { - reject(new Error(`Worker stopped with exit code ${code}`)); - } - }); - }); - return _tornado_fixed_merkle_tree__WEBPACK_IMPORTED_MODULE_1__.MerkleTree.deserialize(JSON.parse(yield merkleWorkerPromise), hashFunction); - } else { - const merkleWorkerPromise = new Promise((resolve, reject) => { - const worker = new Worker(this.merkleWorkerPath); - worker.onmessage = (e) => { - resolve(e.data); - }; - worker.onerror = (e) => { - reject(e); - }; - worker.postMessage({ + async createTree(events) { + const { hash: hashFunction } = await _mimc__WEBPACK_IMPORTED_MODULE_3__/* .mimc */ .f.getHash(); + if (this.merkleWorkerPath) { + console.log("Using merkleWorker\n"); + try { + if (_utils__WEBPACK_IMPORTED_MODULE_2__/* .isNode */ .Ll) { + const merkleWorkerPromise = new Promise((resolve, reject) => { + const worker = new worker_threads__WEBPACK_IMPORTED_MODULE_0__.Worker(this.merkleWorkerPath, { + workerData: { merkleTreeHeight: this.merkleTreeHeight, elements: events, zeroElement: this.emptyElement - }); + } }); - return _tornado_fixed_merkle_tree__WEBPACK_IMPORTED_MODULE_1__.MerkleTree.deserialize(JSON.parse(yield merkleWorkerPromise), hashFunction); - } - } catch (err) { - console.log("merkleWorker failed, falling back to synchronous merkle tree"); - console.log(err); + worker.on("message", resolve); + worker.on("error", reject); + worker.on("exit", (code) => { + if (code !== 0) { + reject(new Error(`Worker stopped with exit code ${code}`)); + } + }); + }); + return _tornado_fixed_merkle_tree__WEBPACK_IMPORTED_MODULE_1__.MerkleTree.deserialize(JSON.parse(await merkleWorkerPromise), hashFunction); + } else { + const merkleWorkerPromise = new Promise((resolve, reject) => { + const worker = new Worker(this.merkleWorkerPath); + worker.onmessage = (e) => { + resolve(e.data); + }; + worker.onerror = (e) => { + reject(e); + }; + worker.postMessage({ + merkleTreeHeight: this.merkleTreeHeight, + elements: events, + zeroElement: this.emptyElement + }); + }); + return _tornado_fixed_merkle_tree__WEBPACK_IMPORTED_MODULE_1__.MerkleTree.deserialize(JSON.parse(await merkleWorkerPromise), hashFunction); } + } catch (err) { + console.log("merkleWorker failed, falling back to synchronous merkle tree"); + console.log(err); } - return new _tornado_fixed_merkle_tree__WEBPACK_IMPORTED_MODULE_1__.MerkleTree(this.merkleTreeHeight, events, { - zeroElement: this.emptyElement, - hashFunction - }); + } + return new _tornado_fixed_merkle_tree__WEBPACK_IMPORTED_MODULE_1__.MerkleTree(this.merkleTreeHeight, events, { + zeroElement: this.emptyElement, + hashFunction }); } - createPartialTree(_0) { - return __async(this, arguments, function* ({ edge, elements }) { - const { hash: hashFunction } = yield _mimc__WEBPACK_IMPORTED_MODULE_3__/* .mimc */ .f.getHash(); - if (this.merkleWorkerPath) { - console.log("Using merkleWorker\n"); - try { - if (_utils__WEBPACK_IMPORTED_MODULE_2__/* .isNode */ .Ll) { - const merkleWorkerPromise = new Promise((resolve, reject) => { - const worker = new worker_threads__WEBPACK_IMPORTED_MODULE_0__.Worker(this.merkleWorkerPath, { - workerData: { - merkleTreeHeight: this.merkleTreeHeight, - edge, - elements, - zeroElement: this.emptyElement - } - }); - worker.on("message", resolve); - worker.on("error", reject); - worker.on("exit", (code) => { - if (code !== 0) { - reject(new Error(`Worker stopped with exit code ${code}`)); - } - }); - }); - return _tornado_fixed_merkle_tree__WEBPACK_IMPORTED_MODULE_1__.PartialMerkleTree.deserialize(JSON.parse(yield merkleWorkerPromise), hashFunction); - } else { - const merkleWorkerPromise = new Promise((resolve, reject) => { - const worker = new Worker(this.merkleWorkerPath); - worker.onmessage = (e) => { - resolve(e.data); - }; - worker.onerror = (e) => { - reject(e); - }; - worker.postMessage({ + async createPartialTree({ edge, elements }) { + const { hash: hashFunction } = await _mimc__WEBPACK_IMPORTED_MODULE_3__/* .mimc */ .f.getHash(); + if (this.merkleWorkerPath) { + console.log("Using merkleWorker\n"); + try { + if (_utils__WEBPACK_IMPORTED_MODULE_2__/* .isNode */ .Ll) { + const merkleWorkerPromise = new Promise((resolve, reject) => { + const worker = new worker_threads__WEBPACK_IMPORTED_MODULE_0__.Worker(this.merkleWorkerPath, { + workerData: { merkleTreeHeight: this.merkleTreeHeight, edge, elements, zeroElement: this.emptyElement - }); + } }); - return _tornado_fixed_merkle_tree__WEBPACK_IMPORTED_MODULE_1__.PartialMerkleTree.deserialize(JSON.parse(yield merkleWorkerPromise), hashFunction); - } - } catch (err) { - console.log("merkleWorker failed, falling back to synchronous merkle tree"); - console.log(err); + worker.on("message", resolve); + worker.on("error", reject); + worker.on("exit", (code) => { + if (code !== 0) { + reject(new Error(`Worker stopped with exit code ${code}`)); + } + }); + }); + return _tornado_fixed_merkle_tree__WEBPACK_IMPORTED_MODULE_1__.PartialMerkleTree.deserialize(JSON.parse(await merkleWorkerPromise), hashFunction); + } else { + const merkleWorkerPromise = new Promise((resolve, reject) => { + const worker = new Worker(this.merkleWorkerPath); + worker.onmessage = (e) => { + resolve(e.data); + }; + worker.onerror = (e) => { + reject(e); + }; + worker.postMessage({ + merkleTreeHeight: this.merkleTreeHeight, + edge, + elements, + zeroElement: this.emptyElement + }); + }); + return _tornado_fixed_merkle_tree__WEBPACK_IMPORTED_MODULE_1__.PartialMerkleTree.deserialize(JSON.parse(await merkleWorkerPromise), hashFunction); } + } catch (err) { + console.log("merkleWorker failed, falling back to synchronous merkle tree"); + console.log(err); } - return new _tornado_fixed_merkle_tree__WEBPACK_IMPORTED_MODULE_1__.PartialMerkleTree(this.merkleTreeHeight, edge, elements, { - zeroElement: this.emptyElement, - hashFunction - }); + } + return new _tornado_fixed_merkle_tree__WEBPACK_IMPORTED_MODULE_1__.PartialMerkleTree(this.merkleTreeHeight, edge, elements, { + zeroElement: this.emptyElement, + hashFunction }); } - verifyTree(events) { - return __async(this, null, function* () { - console.log( - ` + async verifyTree(events) { + console.log( + ` Creating deposit tree for ${this.netId} ${this.amount} ${this.currency.toUpperCase()} would take a while ` - ); - console.time("Created tree in"); - const tree = yield this.createTree(events.map(({ commitment }) => commitment)); - console.timeEnd("Created tree in"); - console.log(""); - const isKnownRoot = yield this.Tornado.isKnownRoot((0,_utils__WEBPACK_IMPORTED_MODULE_2__/* .toFixedHex */ .$W)(BigInt(tree.root))); - if (!isKnownRoot) { - const errMsg = `Deposit Event ${this.netId} ${this.amount} ${this.currency} is invalid`; - throw new Error(errMsg); - } - return tree; - }); + ); + const timeStart = Date.now(); + const tree = await this.createTree(events.map(({ commitment }) => commitment)); + const isKnownRoot = await this.Tornado.isKnownRoot((0,_utils__WEBPACK_IMPORTED_MODULE_2__/* .toFixedHex */ .$W)(BigInt(tree.root))); + if (!isKnownRoot) { + const errMsg = `Deposit Event ${this.netId} ${this.amount} ${this.currency} is invalid`; + throw new Error(errMsg); + } + console.log( + ` +Created ${this.netId} ${this.amount} ${this.currency.toUpperCase()} tree in ${Date.now() - timeStart}ms +` + ); + return tree; } } @@ -62776,50 +94735,26 @@ Creating deposit tree for ${this.netId} ${this.amount} ${this.currency.toUpperCa /* harmony export */ f: () => (/* binding */ mimc), /* harmony export */ p: () => (/* binding */ Mimc) /* harmony export */ }); -/* harmony import */ var circomlibjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(89082); +/* harmony import */ var circomlibjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(90294); -var __async = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; class Mimc { + sponge; + hash; + mimcPromise; constructor() { this.mimcPromise = this.initMimc(); } - initMimc() { - return __async(this, null, function* () { - this.sponge = yield (0,circomlibjs__WEBPACK_IMPORTED_MODULE_0__/* .buildMimcSponge */ .HI)(); - this.hash = (left, right) => { - var _a, _b; - return (_b = this.sponge) == null ? void 0 : _b.F.toString((_a = this.sponge) == null ? void 0 : _a.multiHash([BigInt(left), BigInt(right)])); - }; - }); + async initMimc() { + this.sponge = await (0,circomlibjs__WEBPACK_IMPORTED_MODULE_0__/* .buildMimcSponge */ .HI)(); + this.hash = (left, right) => this.sponge?.F.toString(this.sponge?.multiHash([BigInt(left), BigInt(right)])); } - getHash() { - return __async(this, null, function* () { - yield this.mimcPromise; - return { - sponge: this.sponge, - hash: this.hash - }; - }); + async getHash() { + await this.mimcPromise; + return { + sponge: this.sponge, + hash: this.hash + }; } } const mimc = new Mimc(); @@ -62835,48 +94770,24 @@ const mimc = new Mimc(); /* harmony export */ C: () => (/* binding */ multicall) /* harmony export */ }); -var __async = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } +async function multicall(Multicall2, calls) { + const calldata = calls.map((call) => { + const target = call.contract?.target || call.address; + const callInterface = call.contract?.interface || call.interface; + return { + target, + callData: callInterface.encodeFunctionData(call.name, call.params), + allowFailure: call.allowFailure ?? false }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); }); -}; -function multicall(Multicall2, calls) { - return __async(this, null, function* () { - const calldata = calls.map((call) => { - var _a, _b, _c; - const target = ((_a = call.contract) == null ? void 0 : _a.target) || call.address; - const callInterface = ((_b = call.contract) == null ? void 0 : _b.interface) || call.interface; - return { - target, - callData: callInterface.encodeFunctionData(call.name, call.params), - allowFailure: (_c = call.allowFailure) != null ? _c : false - }; - }); - const returnData = yield Multicall2.aggregate3.staticCall(calldata); - const res = returnData.map((call, i) => { - var _a; - const callInterface = ((_a = calls[i].contract) == null ? void 0 : _a.interface) || calls[i].interface; - const [result, data] = call; - const decodeResult = result && data && data !== "0x" ? callInterface.decodeFunctionResult(calls[i].name, data) : null; - return !decodeResult ? null : decodeResult.length === 1 ? decodeResult[0] : decodeResult; - }); - return res; + const returnData = await Multicall2.aggregate3.staticCall(calldata); + const res = returnData.map((call, i) => { + const callInterface = calls[i].contract?.interface || calls[i].interface; + const [result, data] = call; + const decodeResult = result && data && data !== "0x" ? callInterface.decodeFunctionResult(calls[i].name, data) : null; + return !decodeResult ? null : decodeResult.length === 1 ? decodeResult[0] : decodeResult; }); + return res; } @@ -62891,29 +94802,16 @@ function multicall(Multicall2, calls) { /* harmony export */ Af: () => (/* binding */ enabledChains), /* harmony export */ RY: () => (/* binding */ getNetworkConfig), /* harmony export */ Zh: () => (/* binding */ getInstanceByAddress), -/* harmony export */ cF: () => (/* binding */ getSubdomains), /* harmony export */ cX: () => (/* binding */ customConfig), +/* harmony export */ h9: () => (/* binding */ getActiveTokens), +/* harmony export */ o2: () => (/* binding */ getRelayerEnsSubdomains), +/* harmony export */ oY: () => (/* binding */ getActiveTokenInstances), +/* harmony export */ sX: () => (/* binding */ getMultiInstances), /* harmony export */ sb: () => (/* binding */ defaultConfig), /* harmony export */ zj: () => (/* binding */ getConfig), /* harmony export */ zr: () => (/* binding */ NetId) /* harmony export */ }); -var __defProp = Object.defineProperty; -var __getOwnPropSymbols = Object.getOwnPropertySymbols; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __propIsEnum = Object.prototype.propertyIsEnumerable; -var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __spreadValues = (a, b) => { - for (var prop in b || (b = {})) - if (__hasOwnProp.call(b, prop)) - __defNormalProp(a, prop, b[prop]); - if (__getOwnPropSymbols) - for (var prop of __getOwnPropSymbols(b)) { - if (__propIsEnum.call(b, prop)) - __defNormalProp(a, prop, b[prop]); - } - return a; -}; var NetId = /* @__PURE__ */ ((NetId2) => { NetId2[NetId2["MAINNET"] = 1] = "MAINNET"; NetId2[NetId2["BSC"] = 56] = "BSC"; @@ -62925,14 +94823,6 @@ var NetId = /* @__PURE__ */ ((NetId2) => { NetId2[NetId2["SEPOLIA"] = 11155111] = "SEPOLIA"; return NetId2; })(NetId || {}); -const theGraph = { - name: "Hosted Graph", - url: "https://api.thegraph.com" -}; -const tornado = { - name: "Tornado Subgraphs", - url: "https://tornadocash-rpc.com" -}; const defaultConfig = { [1 /* MAINNET */]: { rpcCallRetryAttempt: 15, @@ -62950,27 +94840,32 @@ const defaultConfig = { networkName: "Ethereum Mainnet", deployedBlock: 9116966, rpcUrls: { - tornadoRPC: { - name: "Tornado RPC", - url: "https://tornadocash-rpc.com/mainnet" - }, - chainnodes: { - name: "Chainnodes RPC", - url: "https://mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607" - }, mevblockerRPC: { - name: "MevblockerRPC", + name: "MEV Blocker", url: "https://rpc.mevblocker.io" }, - oneRPC: { + keydonix: { + name: "Horswap ( Keydonix )", + url: "https://ethereum.keydonix.com/v1/mainnet" + }, + SecureRpc: { + name: "SecureRpc", + url: "https://api.securerpc.com/v1" + }, + stackup: { + name: "Stackup", + url: "https://public.stackup.sh/api/v1/node/ethereum-mainnet" + }, + oneRpc: { name: "1RPC", url: "https://1rpc.io/eth" } }, + stablecoin: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", routerContract: "0xd90e2f925DA726b50C4Ed8D0Fb90Ad053324F31b", echoContract: "0x9B27DD5Bb15d42DC224FCD0B7caEbBe16161Df42", - offchainOracleContract: "0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8", + offchainOracleContract: "0x00000000000D6FFc74A8feb35aF5827bf57f6786", tornContract: "0x77777FeDdddFfC19Ff86DB637967013e6C6A116C", governanceContract: "0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce", stakingRewardsContract: "0x5B3f656C80E8ddb9ec01Dd9018815576E9238c29", @@ -62980,10 +94875,7 @@ const defaultConfig = { tornadoSubgraph: "tornadocash/mainnet-tornado-subgraph", registrySubgraph: "tornadocash/tornado-relayer-registry", governanceSubgraph: "tornadocash/tornado-governance", - subgraphs: { - tornado, - theGraph - }, + subgraphs: {}, tokens: { eth: { instanceAddress: { @@ -63056,6 +94948,8 @@ const defaultConfig = { gasLimit: 7e5 } }, + // Inactive tokens to filter from schema verification and syncing events + disabledTokens: ["cdai", "usdt", "usdc"], relayerEnsSubdomain: "mainnet-tornado", pollInterval: 15, constants: { @@ -63081,25 +94975,31 @@ const defaultConfig = { emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", networkName: "Binance Smart Chain", deployedBlock: 8158799, + stablecoin: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", - offchainOracleContract: "0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8", + offchainOracleContract: "0x00000000000D6FFc74A8feb35aF5827bf57f6786", tornadoSubgraph: "tornadocash/bsc-tornado-subgraph", - subgraphs: { - tornado, - theGraph - }, + subgraphs: {}, rpcUrls: { - tornadoRPC: { - name: "Tornado RPC", - url: "https://tornadocash-rpc.com/bsc" + bnbchain: { + name: "BNB Chain", + url: "https://bsc-dataseed.bnbchain.org" }, - chainnodes: { - name: "Chainnodes RPC", - url: "https://bsc-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607" + ninicoin: { + name: "BNB Chain 2", + url: "https://bsc-dataseed1.ninicoin.io" }, - oneRPC: { + nodereal: { + name: "NodeReal", + url: "https://binance.nodereal.io" + }, + stackup: { + name: "Stackup", + url: "https://public.stackup.sh/api/v1/node/bsc-mainnet" + }, + oneRpc: { name: "1RPC", url: "https://1rpc.io/bnb" } @@ -63138,24 +95038,21 @@ const defaultConfig = { emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", networkName: "Polygon (Matic) Network", deployedBlock: 16257962, + stablecoin: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", - offchainOracleContract: "0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8", - gasPriceOracleContract: "0xF81A8D8D3581985D3969fe53bFA67074aDFa8F3C", + offchainOracleContract: "0x00000000000D6FFc74A8feb35aF5827bf57f6786", tornadoSubgraph: "tornadocash/matic-tornado-subgraph", - subgraphs: { - tornado, - theGraph - }, + subgraphs: {}, rpcUrls: { - chainnodes: { - name: "Chainnodes RPC", - url: "https://polygon-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607" - }, oneRpc: { name: "1RPC", url: "https://1rpc.io/matic" + }, + stackup: { + name: "Stackup", + url: "https://public.stackup.sh/api/v1/node/polygon-mainnet" } }, tokens: { @@ -63192,28 +95089,22 @@ const defaultConfig = { emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", networkName: "Optimism", deployedBlock: 2243689, + stablecoin: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85", multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", - offchainOracleContract: "0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8", + offchainOracleContract: "0x00000000000D6FFc74A8feb35aF5827bf57f6786", ovmGasPriceOracleContract: "0x420000000000000000000000000000000000000F", tornadoSubgraph: "tornadocash/optimism-tornado-subgraph", - subgraphs: { - tornado, - theGraph - }, + subgraphs: {}, rpcUrls: { - tornadoRPC: { - name: "Tornado RPC", - url: "https://tornadocash-rpc.com/op" - }, - chainnodes: { - name: "Chainnodes RPC", - url: "https://optimism-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607" - }, oneRpc: { name: "1RPC", url: "https://1rpc.io/op" + }, + stackup: { + name: "Stackup", + url: "https://public.stackup.sh/api/v1/node/optimism-mainnet" } }, tokens: { @@ -63250,31 +95141,25 @@ const defaultConfig = { emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", networkName: "Arbitrum One", deployedBlock: 3430648, + stablecoin: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", - offchainOracleContract: "0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8", + offchainOracleContract: "0x00000000000D6FFc74A8feb35aF5827bf57f6786", tornadoSubgraph: "tornadocash/arbitrum-tornado-subgraph", - subgraphs: { - tornado, - theGraph - }, + subgraphs: {}, rpcUrls: { - tornadoRPC: { - name: "Tornado RPC", - url: "https://tornadocash-rpc.com/arbitrum" + Arbitrum: { + name: "Arbitrum", + url: "https://arb1.arbitrum.io/rpc" }, - chainnodes: { - name: "Chainnodes RPC", - url: "https://arbitrum-one.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607" + stackup: { + name: "Stackup", + url: "https://public.stackup.sh/api/v1/node/arbitrum-one" }, oneRpc: { - name: "1rpc", + name: "1RPC", url: "https://1rpc.io/arb" - }, - Arbitrum: { - name: "Arbitrum RPC", - url: "https://arb1.arbitrum.io/rpc" } }, tokens: { @@ -63311,27 +95196,21 @@ const defaultConfig = { emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", networkName: "Gnosis Chain", deployedBlock: 17754561, + stablecoin: "0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83", multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", - offchainOracleContract: "0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8", + offchainOracleContract: "0x00000000000D6FFc74A8feb35aF5827bf57f6786", tornadoSubgraph: "tornadocash/xdai-tornado-subgraph", - subgraphs: { - tornado, - theGraph - }, + subgraphs: {}, rpcUrls: { - tornadoRPC: { - name: "Tornado RPC", - url: "https://tornadocash-rpc.com/gnosis" + gnosis: { + name: "Gnosis", + url: "https://rpc.gnosischain.com" }, - chainnodes: { - name: "Chainnodes RPC", - url: "https://gnosis-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607" - }, - blockPi: { - name: "BlockPi", - url: "https://gnosis.blockpi.network/v1/rpc/public" + oneRpc: { + name: "1RPC", + url: "https://1rpc.io/gnosis" } }, tokens: { @@ -63368,26 +95247,21 @@ const defaultConfig = { emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", networkName: "Avalanche Mainnet", deployedBlock: 4429818, + stablecoin: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", routerContract: "0x0D5550d52428E7e3175bfc9550207e4ad3859b17", echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", - offchainOracleContract: "0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8", + offchainOracleContract: "0x00000000000D6FFc74A8feb35aF5827bf57f6786", tornadoSubgraph: "tornadocash/avalanche-tornado-subgraph", - subgraphs: { - theGraph - }, + subgraphs: {}, rpcUrls: { - publicRpc: { - name: "Avalanche RPC", - url: "https://api.avax.network/ext/bc/C/rpc" - }, - meowRPC: { - name: "Meow RPC", - url: "https://avax.meowrpc.com" - }, - oneRPC: { - name: "OneRPC", + oneRpc: { + name: "1RPC", url: "https://1rpc.io/avax/c" + }, + stackup: { + name: "Stackup", + url: "https://public.stackup.sh/api/v1/node/avalanche-mainnet" } }, tokens: { @@ -63423,9 +95297,11 @@ const defaultConfig = { emptyElement: "21663839004416932945382355908790599225266501822907911457504978515578255421292", networkName: "Ethereum Sepolia", deployedBlock: 5594395, + stablecoin: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238", multicallContract: "0xcA11bde05977b3631167028862bE2a173976CA11", routerContract: "0x1572AFE6949fdF51Cb3E0856216670ae9Ee160Ee", - echoContract: "0xa75BF2815618872f155b7C4B0C81bF990f5245E4", + echoContract: "0xcDD1fc3F5ac2782D83449d3AbE80D6b7B273B0e5", + offchainOracleContract: "0x1f89EAF03E5b260Bc6D4Ae3c3334b1B750F3e127", tornContract: "0x3AE6667167C0f44394106E197904519D808323cA", governanceContract: "0xe5324cD7602eeb387418e594B87aCADee08aeCAD", stakingRewardsContract: "0x6d0018890751Efd31feb8166711B16732E2b496b", @@ -63433,21 +95309,23 @@ const defaultConfig = { aggregatorContract: "0x4088712AC9fad39ea133cdb9130E465d235e9642", reverseRecordsContract: "0xEc29700C0283e5Be64AcdFe8077d6cC95dE23C23", tornadoSubgraph: "tornadocash/sepolia-tornado-subgraph", - subgraphs: { - tornado - }, + subgraphs: {}, rpcUrls: { - tornadoRPC: { - name: "Tornado RPC", - url: "https://tornadocash-rpc.com/sepolia" - }, sepolia: { name: "Sepolia RPC", url: "https://rpc.sepolia.org" }, - chainnodes: { - name: "Chainnodes RPC", - url: "https://sepolia.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607" + stackup: { + name: "Stackup", + url: "https://public.stackup.sh/api/v1/node/ethereum-sepolia" + }, + oneRpc: { + name: "1RPC", + url: "https://1rpc.io/sepolia" + }, + ethpandaops: { + name: "ethpandaops", + url: "https://rpc.sepolia.ethpandaops.io" } }, tokens: { @@ -63481,6 +95359,7 @@ const defaultConfig = { GOVERNANCE_BLOCK: 5594395, NOTE_ACCOUNT_BLOCK: 5594395, ENCRYPTED_NOTES_BLOCK: 5594395, + REGISTRY_BLOCK: 5594395, MINING_BLOCK_TIME: 15 } } @@ -63491,10 +95370,16 @@ function addNetwork(newConfig) { enabledChains.push( ...Object.keys(newConfig).map((netId) => Number(netId)).filter((netId) => !enabledChains.includes(netId)) ); - customConfig = __spreadValues(__spreadValues({}, customConfig), newConfig); + customConfig = { + ...customConfig, + ...newConfig + }; } function getNetworkConfig() { - const allConfig = __spreadValues(__spreadValues({}, defaultConfig), customConfig); + const allConfig = { + ...defaultConfig, + ...customConfig + }; return enabledChains.reduce((acc, curr) => { acc[curr] = allConfig[curr]; return acc; @@ -63509,22 +95394,59 @@ function getConfig(netId) { } return chainConfig; } -function getInstanceByAddress({ netId, address }) { - const { tokens } = getConfig(netId); - for (const [currency, { instanceAddress }] of Object.entries(tokens)) { +function getActiveTokens(config) { + const { tokens, disabledTokens } = config; + return Object.keys(tokens).filter((t) => !disabledTokens?.includes(t)); +} +function getActiveTokenInstances(config) { + const { tokens, disabledTokens } = config; + return Object.entries(tokens).reduce((acc, [token, instances]) => { + if (!disabledTokens?.includes(token)) { + acc[token] = instances; + } + return acc; + }, {}); +} +function getInstanceByAddress(config, address) { + const { tokens, disabledTokens } = config; + for (const [currency, { instanceAddress, tokenAddress, symbol, decimals }] of Object.entries(tokens)) { + if (disabledTokens?.includes(currency)) { + continue; + } for (const [amount, instance] of Object.entries(instanceAddress)) { if (instance === address) { return { amount, - currency + currency, + symbol, + decimals, + tokenAddress }; } } } } -function getSubdomains() { +function getRelayerEnsSubdomains() { const allConfig = getNetworkConfig(); - return enabledChains.map((chain) => allConfig[chain].relayerEnsSubdomain); + return enabledChains.reduce((acc, chain) => { + acc[chain] = allConfig[chain].relayerEnsSubdomain; + return acc; + }, {}); +} +function getMultiInstances(netId, config) { + return Object.entries(config.tokens).reduce( + (acc, [currency, { instanceAddress }]) => { + Object.entries(instanceAddress).forEach(([amount, contractAddress]) => { + acc[contractAddress] = { + currency, + amount, + netId + }; + }); + return acc; + }, + {} + ); } @@ -63539,56 +95461,364 @@ function getSubdomains() { /* harmony export */ NO: () => (/* binding */ pedersen), /* harmony export */ UB: () => (/* binding */ buffPedersenHash) /* harmony export */ }); -/* harmony import */ var circomlibjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(89082); +/* harmony import */ var circomlibjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(90294); -var __async = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; class Pedersen { + pedersenHash; + babyJub; + pedersenPromise; constructor() { this.pedersenPromise = this.initPedersen(); } - initPedersen() { - return __async(this, null, function* () { - this.pedersenHash = yield (0,circomlibjs__WEBPACK_IMPORTED_MODULE_0__/* .buildPedersenHash */ .vu)(); - this.babyJub = this.pedersenHash.babyJub; - }); + async initPedersen() { + this.pedersenHash = await (0,circomlibjs__WEBPACK_IMPORTED_MODULE_0__/* .buildPedersenHash */ .vu)(); + this.babyJub = this.pedersenHash.babyJub; } - unpackPoint(buffer) { - return __async(this, null, function* () { - var _a, _b; - yield this.pedersenPromise; - return (_b = this.babyJub) == null ? void 0 : _b.unpackPoint((_a = this.pedersenHash) == null ? void 0 : _a.hash(buffer)); - }); + async unpackPoint(buffer) { + await this.pedersenPromise; + return this.babyJub?.unpackPoint(this.pedersenHash?.hash(buffer)); } toStringBuffer(buffer) { - var _a; - return (_a = this.babyJub) == null ? void 0 : _a.F.toString(buffer); + return this.babyJub?.F.toString(buffer); } } const pedersen = new Pedersen(); -function buffPedersenHash(buffer) { - return __async(this, null, function* () { - const [hash] = yield pedersen.unpackPoint(buffer); - return pedersen.toStringBuffer(hash); +async function buffPedersenHash(buffer) { + const [hash] = await pedersen.unpackPoint(buffer); + return pedersen.toStringBuffer(hash); +} + + +/***/ }), + +/***/ 1180: +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; + +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + Sl: () => (/* binding */ getPermit2CommitmentsSignature), + KM: () => (/* binding */ getPermit2Signature), + sx: () => (/* binding */ getPermitCommitmentsSignature), + id: () => (/* binding */ getPermitSignature), + CS: () => (/* binding */ permit2Address) +}); + +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/crypto/signature.js + 1 modules +var crypto_signature = __webpack_require__(20260); +;// ./node_modules/ethers/lib.esm/constants/numbers.js +/** + * A constant for the order N for the secp256k1 curve. + * + * (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``) + */ +const N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); +/** + * A constant for the number of wei in a single ether. + * + * (**i.e.** ``1000000000000000000n``) + */ +const WeiPerEther = BigInt("1000000000000000000"); +/** + * A constant for the maximum value for a ``uint256``. + * + * (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) + */ +const MaxUint256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +/** + * A constant for the minimum value for an ``int256``. + * + * (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``) + */ +const MinInt256 = BigInt("0x8000000000000000000000000000000000000000000000000000000000000000") * BigInt(-1); +/** + * A constant for the maximum value for an ``int256``. + * + * (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) + */ +const MaxInt256 = BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +//# sourceMappingURL=numbers.js.map +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/address/address.js +var address = __webpack_require__(30031); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/crypto/keccak.js + 1 modules +var keccak = __webpack_require__(2011); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/data.js +var data = __webpack_require__(36212); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/utf8.js +var utf8 = __webpack_require__(87303); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/errors.js +var errors = __webpack_require__(57339); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/maths.js +var maths = __webpack_require__(27033); +;// ./node_modules/ethers/lib.esm/hash/solidity.js + + + +const regexBytes = new RegExp("^bytes([0-9]+)$"); +const regexNumber = new RegExp("^(u?int)([0-9]*)$"); +const regexArray = new RegExp("^(.*)\\[([0-9]*)\\]$"); +function _pack(type, value, isArray) { + switch (type) { + case "address": + if (isArray) { + return (0,data/* getBytes */.q5)((0,data/* zeroPadValue */.nx)(value, 32)); + } + return (0,data/* getBytes */.q5)((0,address/* getAddress */.b)(value)); + case "string": + return (0,utf8/* toUtf8Bytes */.YW)(value); + case "bytes": + return (0,data/* getBytes */.q5)(value); + case "bool": + value = (!!value ? "0x01" : "0x00"); + if (isArray) { + return (0,data/* getBytes */.q5)((0,data/* zeroPadValue */.nx)(value, 32)); + } + return (0,data/* getBytes */.q5)(value); + } + let match = type.match(regexNumber); + if (match) { + let signed = (match[1] === "int"); + let size = parseInt(match[2] || "256"); + (0,errors/* assertArgument */.MR)((!match[2] || match[2] === String(size)) && (size % 8 === 0) && size !== 0 && size <= 256, "invalid number type", "type", type); + if (isArray) { + size = 256; + } + if (signed) { + value = (0,maths/* toTwos */.JJ)(value, size); + } + return (0,data/* getBytes */.q5)((0,data/* zeroPadValue */.nx)((0,maths/* toBeArray */.c4)(value), size / 8)); + } + match = type.match(regexBytes); + if (match) { + const size = parseInt(match[1]); + (0,errors/* assertArgument */.MR)(String(size) === match[1] && size !== 0 && size <= 32, "invalid bytes type", "type", type); + (0,errors/* assertArgument */.MR)((0,data/* dataLength */.pO)(value) === size, `invalid value for ${type}`, "value", value); + if (isArray) { + return (0,data/* getBytes */.q5)((0,data/* zeroPadBytes */.X_)(value, 32)); + } + return value; + } + match = type.match(regexArray); + if (match && Array.isArray(value)) { + const baseType = match[1]; + const count = parseInt(match[2] || String(value.length)); + (0,errors/* assertArgument */.MR)(count === value.length, `invalid array length for ${type}`, "value", value); + const result = []; + value.forEach(function (value) { + result.push(_pack(baseType, value, true)); + }); + return (0,data/* getBytes */.q5)((0,data/* concat */.xW)(result)); + } + (0,errors/* assertArgument */.MR)(false, "invalid type", "type", type); +} +// @TODO: Array Enum +/** + * Computes the [[link-solc-packed]] representation of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPacked([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +function solidityPacked(types, values) { + (0,errors/* assertArgument */.MR)(types.length === values.length, "wrong number of values; expected ${ types.length }", "values", values); + const tight = []; + types.forEach(function (type, index) { + tight.push(_pack(type, values[index])); + }); + return (0,data/* hexlify */.c$)((0,data/* concat */.xW)(tight)); +} +/** + * Computes the [[link-solc-packed]] [[keccak256]] hash of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPackedKeccak256([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +function solidityPackedKeccak256(types, values) { + return (0,keccak/* keccak256 */.S)(solidityPacked(types, values)); +} +/** + * Computes the [[link-solc-packed]] [[sha256]] hash of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPackedSha256([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +function solidityPackedSha256(types, values) { + return _sha256(solidityPacked(types, values)); +} +//# sourceMappingURL=solidity.js.map +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/hash/typed-data.js +var typed_data = __webpack_require__(82314); +// EXTERNAL MODULE: ./src/utils.ts +var utils = __webpack_require__(67418); +;// ./src/permit.ts + + + +const permit2Address = "0x000000000022D473030F116dDEE9F6B43aC78BA3"; +async function getPermitSignature({ + Token, + signer, + spender, + value, + nonce, + deadline +}) { + const sigSigner = signer || Token.runner; + const provider = sigSigner.provider; + const [name, lastNonce, { chainId }] = await Promise.all([ + Token.name(), + Token.nonces(sigSigner.address), + provider.getNetwork() + ]); + const DOMAIN_SEPARATOR = { + name, + version: "1", + chainId, + verifyingContract: Token.target + }; + const PERMIT_TYPE = { + Permit: [ + { name: "owner", type: "address" }, + { name: "spender", type: "address" }, + { name: "value", type: "uint256" }, + { name: "nonce", type: "uint256" }, + { name: "deadline", type: "uint256" } + ] + }; + return crypto_signature/* Signature */.t.from( + await sigSigner.signTypedData(DOMAIN_SEPARATOR, PERMIT_TYPE, { + owner: sigSigner.address, + spender, + value, + nonce: nonce || lastNonce, + deadline: deadline || MaxUint256 + }) + ); +} +async function getPermitCommitmentsSignature({ + PermitTornado: PermitTornado2, + Token, + signer, + denomination, + commitments, + nonce +}) { + const value = BigInt(commitments.length) * denomination; + const commitmentsHash = solidityPackedKeccak256(["bytes32[]"], [commitments]); + return await getPermitSignature({ + Token, + signer, + spender: PermitTornado2.target, + value, + nonce, + deadline: BigInt(commitmentsHash) + }); +} +async function getPermit2Signature({ + Token, + signer, + spender, + value: amount, + nonce, + deadline, + witness +}) { + const sigSigner = signer || Token.runner; + const provider = sigSigner.provider; + const domain = { + name: "Permit2", + chainId: (await provider.getNetwork()).chainId, + verifyingContract: permit2Address + }; + const types = !witness ? { + PermitTransferFrom: [ + { name: "permitted", type: "TokenPermissions" }, + { name: "spender", type: "address" }, + { name: "nonce", type: "uint256" }, + { name: "deadline", type: "uint256" } + ], + TokenPermissions: [ + { name: "token", type: "address" }, + { name: "amount", type: "uint256" } + ] + } : { + PermitWitnessTransferFrom: [ + { name: "permitted", type: "TokenPermissions" }, + { name: "spender", type: "address" }, + { name: "nonce", type: "uint256" }, + { name: "deadline", type: "uint256" }, + { name: "witness", type: witness.witnessTypeName } + ], + TokenPermissions: [ + { name: "token", type: "address" }, + { name: "amount", type: "uint256" } + ], + ...witness.witnessType + }; + const values = { + permitted: { + token: Token.target, + amount + }, + spender, + // Sorted nonce are not required for Permit2 + nonce: nonce || (0,utils/* rBigInt */.ib)(16), + deadline: deadline || MaxUint256 + }; + if (witness) { + values.witness = witness.witness; + } + const hash = new typed_data/* TypedDataEncoder */.z(types).hash(values); + const signature = crypto_signature/* Signature */.t.from(await sigSigner.signTypedData(domain, types, values)); + return { + domain, + types, + values, + hash, + signature + }; +} +async function getPermit2CommitmentsSignature({ + PermitTornado: PermitTornado2, + Token, + signer, + denomination, + commitments, + nonce, + deadline +}) { + const value = BigInt(commitments.length) * denomination; + const commitmentsHash = solidityPackedKeccak256(["bytes32[]"], [commitments]); + return await getPermit2Signature({ + Token, + signer, + spender: PermitTornado2.target, + value, + nonce, + deadline, + witness: { + witnessTypeName: "PermitCommitments", + witnessType: { + PermitCommitments: [ + { name: "instance", type: "address" }, + { name: "commitmentsHash", type: "bytes32" } + ] + }, + witness: { + instance: PermitTornado2.target, + commitmentsHash + } + } }); } @@ -63602,61 +95832,88 @@ function buffPedersenHash(buffer) { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ T: () => (/* binding */ TokenPriceOracle) /* harmony export */ }); -/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(99770); -/* harmony import */ var _multicall__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(48486); +/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(99770); +/* harmony import */ var _typechain__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(62463); +/* harmony import */ var _multicall__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(48486); + -var __async = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; class TokenPriceOracle { + oracle; + multicall; + provider; + fallbackPrice; constructor(provider, multicall2, oracle) { this.provider = provider; this.multicall = multicall2; this.oracle = oracle; + this.fallbackPrice = (0,ethers__WEBPACK_IMPORTED_MODULE_1__/* .parseEther */ .g5)("0.0001"); } - fetchPrices(tokens) { - return __async(this, null, function* () { - if (!this.oracle) { - return new Promise((resolve) => resolve(tokens.map(() => (0,ethers__WEBPACK_IMPORTED_MODULE_0__/* .parseEther */ .g5)("0.0001")))); + buildCalls(tokens) { + return tokens.map(({ tokenAddress }) => ({ + contract: this.oracle, + name: "getRateToEth", + params: [tokenAddress, true], + allowFailure: true + })); + } + buildStable(stablecoinAddress) { + const stablecoin = _typechain__WEBPACK_IMPORTED_MODULE_0__/* .ERC20__factory */ .Xc.connect(stablecoinAddress, this.provider); + return [ + { + contract: stablecoin, + name: "decimals" + }, + { + contract: this.oracle, + name: "getRateToEth", + params: [stablecoin.target, true], + allowFailure: true } - const prices = yield (0,_multicall__WEBPACK_IMPORTED_MODULE_1__/* .multicall */ .C)( - this.multicall, - tokens.map(({ tokenAddress }) => ({ - contract: this.oracle, - name: "getRateToEth", - params: [tokenAddress, true] - })) + ]; + } + async fetchPrice(tokenAddress, decimals) { + if (!this.oracle) { + return new Promise((resolve) => resolve(this.fallbackPrice)); + } + try { + const price = await this.oracle.getRateToEth(tokenAddress, true); + return price * BigInt(10 ** decimals) / BigInt(10 ** 18); + } catch (err) { + console.log( + `Failed to fetch oracle price for ${tokenAddress}, will use fallback price ${this.fallbackPrice}` ); - return prices.map((price, index) => { - return price * BigInt(10 ** tokens[index].decimals) / BigInt(10 ** 18); - }); + console.log(err); + return this.fallbackPrice; + } + } + async fetchPrices(tokens) { + if (!this.oracle) { + return new Promise((resolve) => resolve(tokens.map(() => this.fallbackPrice))); + } + const prices = await (0,_multicall__WEBPACK_IMPORTED_MODULE_2__/* .multicall */ .C)(this.multicall, this.buildCalls(tokens)); + return prices.map((price, index) => { + if (!price) { + price = this.fallbackPrice; + } + return price * BigInt(10 ** tokens[index].decimals) / BigInt(10 ** 18); }); } + async fetchEthUSD(stablecoinAddress) { + if (!this.oracle) { + return new Promise((resolve) => resolve(10 ** 18 / Number(this.fallbackPrice))); + } + const [decimals, price] = await (0,_multicall__WEBPACK_IMPORTED_MODULE_2__/* .multicall */ .C)(this.multicall, this.buildStable(stablecoinAddress)); + const ethPrice = (price || this.fallbackPrice) * BigInt(10n ** decimals) / BigInt(10 ** 18); + return 1 / Number((0,ethers__WEBPACK_IMPORTED_MODULE_1__/* .formatEther */ .ck)(ethPrice)); + } } /***/ }), -/***/ 68434: +/***/ 46170: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; @@ -63668,10 +95925,8 @@ __webpack_require__.d(__webpack_exports__, { Gd: () => (/* binding */ TornadoVoidSigner), nA: () => (/* binding */ TornadoWallet), mJ: () => (/* binding */ defaultUserAgent), - hd: () => (/* binding */ providers_fetch), Fd: () => (/* binding */ fetchData), uY: () => (/* binding */ fetchGetUrlFunc), - bD: () => (/* binding */ getGasOraclePlugin), WU: () => (/* binding */ getHttpAgent), sO: () => (/* binding */ getProvider), MF: () => (/* binding */ getProviderWithNetId), @@ -63681,11 +95936,321 @@ __webpack_require__.d(__webpack_exports__, { // EXTERNAL MODULE: ./node_modules/cross-fetch/dist/browser-ponyfill.js var browser_ponyfill = __webpack_require__(74945); var browser_ponyfill_default = /*#__PURE__*/__webpack_require__.n(browser_ponyfill); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/fetch.js + 2 modules +var fetch = __webpack_require__(26976); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/abi/abi-coder.js + 10 modules +var abi_coder = __webpack_require__(35273); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/address/address.js +var address_address = __webpack_require__(30031); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/address/checks.js +var checks = __webpack_require__(41442); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/hash/typed-data.js +var typed_data = __webpack_require__(82314); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/transaction/accesslist.js +var accesslist = __webpack_require__(8177); // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/properties.js var properties = __webpack_require__(88081); // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/errors.js var errors = __webpack_require__(57339); -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/providers/plugins-network.js +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/utf8.js +var utf8 = __webpack_require__(87303); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/data.js +var utils_data = __webpack_require__(36212); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/maths.js +var maths = __webpack_require__(27033); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/constants/addresses.js +var addresses = __webpack_require__(98982); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/contract/contract.js +var contract = __webpack_require__(13269); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/hash/namehash.js + 1 modules +var namehash = __webpack_require__(64563); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/transaction/transaction.js + 1 modules +var transaction = __webpack_require__(79453); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/events.js +var events = __webpack_require__(99381); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/providers/ens-resolver.js +var ens_resolver = __webpack_require__(97876); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/address/contract-address.js +var contract_address = __webpack_require__(7040); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/crypto/signature.js + 1 modules +var signature = __webpack_require__(20260); +;// ./node_modules/ethers/lib.esm/providers/format.js +/** + * @_ignore + */ + + + + +const BN_0 = BigInt(0); +function allowNull(format, nullValue) { + return (function (value) { + if (value == null) { + return nullValue; + } + return format(value); + }); +} +function arrayOf(format, allowNull) { + return ((array) => { + if (allowNull && array == null) { + return null; + } + if (!Array.isArray(array)) { + throw new Error("not an array"); + } + return array.map((i) => format(i)); + }); +} +// Requires an object which matches a fleet of other formatters +// Any FormatFunc may return `undefined` to have the value omitted +// from the result object. Calls preserve `this`. +function object(format, altNames) { + return ((value) => { + const result = {}; + for (const key in format) { + let srcKey = key; + if (altNames && key in altNames && !(srcKey in value)) { + for (const altKey of altNames[key]) { + if (altKey in value) { + srcKey = altKey; + break; + } + } + } + try { + const nv = format[key](value[srcKey]); + if (nv !== undefined) { + result[key] = nv; + } + } + catch (error) { + const message = (error instanceof Error) ? error.message : "not-an-error"; + (0,errors/* assert */.vA)(false, `invalid value for value.${key} (${message})`, "BAD_DATA", { value }); + } + } + return result; + }); +} +function formatBoolean(value) { + switch (value) { + case true: + case "true": + return true; + case false: + case "false": + return false; + } + (0,errors/* assertArgument */.MR)(false, `invalid boolean; ${JSON.stringify(value)}`, "value", value); +} +function formatData(value) { + (0,errors/* assertArgument */.MR)((0,utils_data/* isHexString */.Lo)(value, true), "invalid data", "value", value); + return value; +} +function formatHash(value) { + (0,errors/* assertArgument */.MR)((0,utils_data/* isHexString */.Lo)(value, 32), "invalid hash", "value", value); + return value; +} +function formatUint256(value) { + if (!isHexString(value)) { + throw new Error("invalid uint256"); + } + return zeroPadValue(value, 32); +} +const _formatLog = object({ + address: address_address/* getAddress */.b, + blockHash: formatHash, + blockNumber: maths/* getNumber */.WZ, + data: formatData, + index: maths/* getNumber */.WZ, + removed: allowNull(formatBoolean, false), + topics: arrayOf(formatHash), + transactionHash: formatHash, + transactionIndex: maths/* getNumber */.WZ, +}, { + index: ["logIndex"] +}); +function formatLog(value) { + return _formatLog(value); +} +const _formatBlock = object({ + hash: allowNull(formatHash), + parentHash: formatHash, + parentBeaconBlockRoot: allowNull(formatHash, null), + number: maths/* getNumber */.WZ, + timestamp: maths/* getNumber */.WZ, + nonce: allowNull(formatData), + difficulty: maths/* getBigInt */.Ab, + gasLimit: maths/* getBigInt */.Ab, + gasUsed: maths/* getBigInt */.Ab, + stateRoot: allowNull(formatHash, null), + receiptsRoot: allowNull(formatHash, null), + blobGasUsed: allowNull(maths/* getBigInt */.Ab, null), + excessBlobGas: allowNull(maths/* getBigInt */.Ab, null), + miner: allowNull(address_address/* getAddress */.b), + prevRandao: allowNull(formatHash, null), + extraData: formatData, + baseFeePerGas: allowNull(maths/* getBigInt */.Ab) +}, { + prevRandao: ["mixHash"] +}); +function formatBlock(value) { + const result = _formatBlock(value); + result.transactions = value.transactions.map((tx) => { + if (typeof (tx) === "string") { + return tx; + } + return formatTransactionResponse(tx); + }); + return result; +} +const _formatReceiptLog = object({ + transactionIndex: maths/* getNumber */.WZ, + blockNumber: maths/* getNumber */.WZ, + transactionHash: formatHash, + address: address_address/* getAddress */.b, + topics: arrayOf(formatHash), + data: formatData, + index: maths/* getNumber */.WZ, + blockHash: formatHash, +}, { + index: ["logIndex"] +}); +function formatReceiptLog(value) { + return _formatReceiptLog(value); +} +const _formatTransactionReceipt = object({ + to: allowNull(address_address/* getAddress */.b, null), + from: allowNull(address_address/* getAddress */.b, null), + contractAddress: allowNull(address_address/* getAddress */.b, null), + // should be allowNull(hash), but broken-EIP-658 support is handled in receipt + index: maths/* getNumber */.WZ, + root: allowNull(utils_data/* hexlify */.c$), + gasUsed: maths/* getBigInt */.Ab, + blobGasUsed: allowNull(maths/* getBigInt */.Ab, null), + logsBloom: allowNull(formatData), + blockHash: formatHash, + hash: formatHash, + logs: arrayOf(formatReceiptLog), + blockNumber: maths/* getNumber */.WZ, + //confirmations: allowNull(getNumber, null), + cumulativeGasUsed: maths/* getBigInt */.Ab, + effectiveGasPrice: allowNull(maths/* getBigInt */.Ab), + blobGasPrice: allowNull(maths/* getBigInt */.Ab, null), + status: allowNull(maths/* getNumber */.WZ), + type: allowNull(maths/* getNumber */.WZ, 0) +}, { + effectiveGasPrice: ["gasPrice"], + hash: ["transactionHash"], + index: ["transactionIndex"], +}); +function formatTransactionReceipt(value) { + return _formatTransactionReceipt(value); +} +function formatTransactionResponse(value) { + // Some clients (TestRPC) do strange things like return 0x0 for the + // 0 address; correct this to be a real address + if (value.to && (0,maths/* getBigInt */.Ab)(value.to) === BN_0) { + value.to = "0x0000000000000000000000000000000000000000"; + } + const result = object({ + hash: formatHash, + // Some nodes do not return this, usually test nodes (like Ganache) + index: allowNull(maths/* getNumber */.WZ, undefined), + type: (value) => { + if (value === "0x" || value == null) { + return 0; + } + return (0,maths/* getNumber */.WZ)(value); + }, + accessList: allowNull(accesslist/* accessListify */.$, null), + blobVersionedHashes: allowNull(arrayOf(formatHash, true), null), + blockHash: allowNull(formatHash, null), + blockNumber: allowNull(maths/* getNumber */.WZ, null), + transactionIndex: allowNull(maths/* getNumber */.WZ, null), + from: address_address/* getAddress */.b, + // either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) must be set + gasPrice: allowNull(maths/* getBigInt */.Ab), + maxPriorityFeePerGas: allowNull(maths/* getBigInt */.Ab), + maxFeePerGas: allowNull(maths/* getBigInt */.Ab), + maxFeePerBlobGas: allowNull(maths/* getBigInt */.Ab, null), + gasLimit: maths/* getBigInt */.Ab, + to: allowNull(address_address/* getAddress */.b, null), + value: maths/* getBigInt */.Ab, + nonce: maths/* getNumber */.WZ, + data: formatData, + creates: allowNull(address_address/* getAddress */.b, null), + chainId: allowNull(maths/* getBigInt */.Ab, null) + }, { + data: ["input"], + gasLimit: ["gas"], + index: ["transactionIndex"] + })(value); + // If to and creates are empty, populate the creates from the value + if (result.to == null && result.creates == null) { + result.creates = (0,contract_address/* getCreateAddress */.t)(result); + } + // @TODO: Check fee data + // Add an access list to supported transaction types + if ((value.type === 1 || value.type === 2) && value.accessList == null) { + result.accessList = []; + } + // Compute the signature + if (value.signature) { + result.signature = signature/* Signature */.t.from(value.signature); + } + else { + result.signature = signature/* Signature */.t.from(value); + } + // Some backends omit ChainId on legacy transactions, but we can compute it + if (result.chainId == null) { + const chainId = result.signature.legacyChainId; + if (chainId != null) { + result.chainId = chainId; + } + } + // @TODO: check chainID + /* + if (value.chainId != null) { + let chainId = value.chainId; + + if (isHexString(chainId)) { + chainId = BigNumber.from(chainId).toNumber(); + } + + result.chainId = chainId; + + } else { + let chainId = value.networkId; + + // geth-etc returns chainId + if (chainId == null && result.v == null) { + chainId = value.chainId; + } + + if (isHexString(chainId)) { + chainId = BigNumber.from(chainId).toNumber(); + } + + if (typeof(chainId) !== "number" && result.v != null) { + chainId = (result.v - 35) / 2; + if (chainId < 0) { chainId = 0; } + chainId = parseInt(chainId); + } + + if (typeof(chainId) !== "number") { chainId = 0; } + + result.chainId = chainId; + } + */ + // 0x0000... should actually be null + if (result.blockHash && (0,maths/* getBigInt */.Ab)(result.blockHash) === BN_0) { + result.blockHash = null; + } + return result; +} +//# sourceMappingURL=format.js.map +;// ./node_modules/ethers/lib.esm/providers/plugins-network.js const EnsAddress = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"; @@ -63894,2387 +96459,7 @@ export class CustomBlockNetworkPlugin extends NetworkPlugin { } */ //# sourceMappingURL=plugins-network.js.map -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/data.js -var utils_data = __webpack_require__(36212); -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/utils/base64-browser.js -// utils/base64-browser - -function decodeBase64(textData) { - textData = atob(textData); - const data = new Uint8Array(textData.length); - for (let i = 0; i < textData.length; i++) { - data[i] = textData.charCodeAt(i); - } - return (0,utils_data/* getBytes */.q5)(data); -} -function encodeBase64(_data) { - const data = (0,utils_data/* getBytes */.q5)(_data); - let textData = ""; - for (let i = 0; i < data.length; i++) { - textData += String.fromCharCode(data[i]); - } - return btoa(textData); -} -//# sourceMappingURL=base64-browser.js.map -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/utf8.js -var utf8 = __webpack_require__(87303); -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/utils/geturl-browser.js - -// @TODO: timeout is completely ignored; start a Promise.any with a reject? -function createGetUrl(options) { - async function getUrl(req, _signal) { - const protocol = req.url.split(":")[0].toLowerCase(); - (0,errors/* assert */.vA)(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", { - info: { protocol }, - operation: "request" - }); - (0,errors/* assert */.vA)(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { - operation: "request" - }); - let signal = undefined; - if (_signal) { - const controller = new AbortController(); - signal = controller.signal; - _signal.addListener(() => { controller.abort(); }); - } - const init = { - method: req.method, - headers: new Headers(Array.from(req)), - body: req.body || undefined, - signal - }; - const resp = await fetch(req.url, init); - const headers = {}; - resp.headers.forEach((value, key) => { - headers[key.toLowerCase()] = value; - }); - const respBody = await resp.arrayBuffer(); - const body = (respBody == null) ? null : new Uint8Array(respBody); - return { - statusCode: resp.status, - statusMessage: resp.statusText, - headers, body - }; - } - return getUrl; -} -// @TODO: remove in v7; provided for backwards compat -const defaultGetUrl = createGetUrl({}); -async function getUrl(req, _signal) { - return defaultGetUrl(req, _signal); -} -//# sourceMappingURL=geturl-browser.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/utils/fetch.js -/** - * Fetching content from the web is environment-specific, so Ethers - * provides an abstraction that each environment can implement to provide - * this service. - * - * On [Node.js](link-node), the ``http`` and ``https`` libs are used to - * create a request object, register event listeners and process data - * and populate the [[FetchResponse]]. - * - * In a browser, the [DOM fetch](link-js-fetch) is used, and the resulting - * ``Promise`` is waited on to retrieve the payload. - * - * The [[FetchRequest]] is responsible for handling many common situations, - * such as redirects, server throttling, authentication, etc. - * - * It also handles common gateways, such as IPFS and data URIs. - * - * @_section api/utils/fetching:Fetching Web Content [about-fetch] - */ - - - - - - -const MAX_ATTEMPTS = 12; -const SLOT_INTERVAL = 250; -// The global FetchGetUrlFunc implementation. -let defaultGetUrlFunc = createGetUrl(); -const reData = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i"); -const reIpfs = new RegExp("^ipfs:/\/(ipfs/)?(.*)$", "i"); -// If locked, new Gateways cannot be added -let locked = false; -// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs -async function dataGatewayFunc(url, signal) { - try { - const match = url.match(reData); - if (!match) { - throw new Error("invalid data"); - } - return new FetchResponse(200, "OK", { - "content-type": (match[1] || "text/plain"), - }, (match[2] ? decodeBase64(match[3]) : unpercent(match[3]))); - } - catch (error) { - return new FetchResponse(599, "BAD REQUEST (invalid data: URI)", {}, null, new FetchRequest(url)); - } -} -/** - * Returns a [[FetchGatewayFunc]] for fetching content from a standard - * IPFS gateway hosted at %%baseUrl%%. - */ -function getIpfsGatewayFunc(baseUrl) { - async function gatewayIpfs(url, signal) { - try { - const match = url.match(reIpfs); - if (!match) { - throw new Error("invalid link"); - } - return new FetchRequest(`${baseUrl}${match[2]}`); - } - catch (error) { - return new FetchResponse(599, "BAD REQUEST (invalid IPFS URI)", {}, null, new FetchRequest(url)); - } - } - return gatewayIpfs; -} -const Gateways = { - "data": dataGatewayFunc, - "ipfs": getIpfsGatewayFunc("https:/\/gateway.ipfs.io/ipfs/") -}; -const fetchSignals = new WeakMap(); -/** - * @_ignore - */ -class FetchCancelSignal { - #listeners; - #cancelled; - constructor(request) { - this.#listeners = []; - this.#cancelled = false; - fetchSignals.set(request, () => { - if (this.#cancelled) { - return; - } - this.#cancelled = true; - for (const listener of this.#listeners) { - setTimeout(() => { listener(); }, 0); - } - this.#listeners = []; - }); - } - addListener(listener) { - (0,errors/* assert */.vA)(!this.#cancelled, "singal already cancelled", "UNSUPPORTED_OPERATION", { - operation: "fetchCancelSignal.addCancelListener" - }); - this.#listeners.push(listener); - } - get cancelled() { return this.#cancelled; } - checkSignal() { - (0,errors/* assert */.vA)(!this.cancelled, "cancelled", "CANCELLED", {}); - } -} -// Check the signal, throwing if it is cancelled -function checkSignal(signal) { - if (signal == null) { - throw new Error("missing signal; should not happen"); - } - signal.checkSignal(); - return signal; -} -/** - * Represents a request for a resource using a URI. - * - * By default, the supported schemes are ``HTTP``, ``HTTPS``, ``data:``, - * and ``IPFS:``. - * - * Additional schemes can be added globally using [[registerGateway]]. - * - * @example: - * req = new FetchRequest("https://www.ricmoo.com") - * resp = await req.send() - * resp.body.length - * //_result: - */ -class FetchRequest { - #allowInsecure; - #gzip; - #headers; - #method; - #timeout; - #url; - #body; - #bodyType; - #creds; - // Hooks - #preflight; - #process; - #retry; - #signal; - #throttle; - #getUrlFunc; - /** - * The fetch URL to request. - */ - get url() { return this.#url; } - set url(url) { - this.#url = String(url); - } - /** - * The fetch body, if any, to send as the request body. //(default: null)// - * - * When setting a body, the intrinsic ``Content-Type`` is automatically - * set and will be used if **not overridden** by setting a custom - * header. - * - * If %%body%% is null, the body is cleared (along with the - * intrinsic ``Content-Type``). - * - * If %%body%% is a string, the intrinsic ``Content-Type`` is set to - * ``text/plain``. - * - * If %%body%% is a Uint8Array, the intrinsic ``Content-Type`` is set to - * ``application/octet-stream``. - * - * If %%body%% is any other object, the intrinsic ``Content-Type`` is - * set to ``application/json``. - */ - get body() { - if (this.#body == null) { - return null; - } - return new Uint8Array(this.#body); - } - set body(body) { - if (body == null) { - this.#body = undefined; - this.#bodyType = undefined; - } - else if (typeof (body) === "string") { - this.#body = (0,utf8/* toUtf8Bytes */.YW)(body); - this.#bodyType = "text/plain"; - } - else if (body instanceof Uint8Array) { - this.#body = body; - this.#bodyType = "application/octet-stream"; - } - else if (typeof (body) === "object") { - this.#body = (0,utf8/* toUtf8Bytes */.YW)(JSON.stringify(body)); - this.#bodyType = "application/json"; - } - else { - throw new Error("invalid body"); - } - } - /** - * Returns true if the request has a body. - */ - hasBody() { - return (this.#body != null); - } - /** - * The HTTP method to use when requesting the URI. If no method - * has been explicitly set, then ``GET`` is used if the body is - * null and ``POST`` otherwise. - */ - get method() { - if (this.#method) { - return this.#method; - } - if (this.hasBody()) { - return "POST"; - } - return "GET"; - } - set method(method) { - if (method == null) { - method = ""; - } - this.#method = String(method).toUpperCase(); - } - /** - * The headers that will be used when requesting the URI. All - * keys are lower-case. - * - * This object is a copy, so any changes will **NOT** be reflected - * in the ``FetchRequest``. - * - * To set a header entry, use the ``setHeader`` method. - */ - get headers() { - const headers = Object.assign({}, this.#headers); - if (this.#creds) { - headers["authorization"] = `Basic ${encodeBase64((0,utf8/* toUtf8Bytes */.YW)(this.#creds))}`; - } - ; - if (this.allowGzip) { - headers["accept-encoding"] = "gzip"; - } - if (headers["content-type"] == null && this.#bodyType) { - headers["content-type"] = this.#bodyType; - } - if (this.body) { - headers["content-length"] = String(this.body.length); - } - return headers; - } - /** - * Get the header for %%key%%, ignoring case. - */ - getHeader(key) { - return this.headers[key.toLowerCase()]; - } - /** - * Set the header for %%key%% to %%value%%. All values are coerced - * to a string. - */ - setHeader(key, value) { - this.#headers[String(key).toLowerCase()] = String(value); - } - /** - * Clear all headers, resetting all intrinsic headers. - */ - clearHeaders() { - this.#headers = {}; - } - [Symbol.iterator]() { - const headers = this.headers; - const keys = Object.keys(headers); - let index = 0; - return { - next: () => { - if (index < keys.length) { - const key = keys[index++]; - return { - value: [key, headers[key]], done: false - }; - } - return { value: undefined, done: true }; - } - }; - } - /** - * The value that will be sent for the ``Authorization`` header. - * - * To set the credentials, use the ``setCredentials`` method. - */ - get credentials() { - return this.#creds || null; - } - /** - * Sets an ``Authorization`` for %%username%% with %%password%%. - */ - setCredentials(username, password) { - (0,errors/* assertArgument */.MR)(!username.match(/:/), "invalid basic authentication username", "username", "[REDACTED]"); - this.#creds = `${username}:${password}`; - } - /** - * Enable and request gzip-encoded responses. The response will - * automatically be decompressed. //(default: true)// - */ - get allowGzip() { - return this.#gzip; - } - set allowGzip(value) { - this.#gzip = !!value; - } - /** - * Allow ``Authentication`` credentials to be sent over insecure - * channels. //(default: false)// - */ - get allowInsecureAuthentication() { - return !!this.#allowInsecure; - } - set allowInsecureAuthentication(value) { - this.#allowInsecure = !!value; - } - /** - * The timeout (in milliseconds) to wait for a complete response. - * //(default: 5 minutes)// - */ - get timeout() { return this.#timeout; } - set timeout(timeout) { - (0,errors/* assertArgument */.MR)(timeout >= 0, "timeout must be non-zero", "timeout", timeout); - this.#timeout = timeout; - } - /** - * This function is called prior to each request, for example - * during a redirection or retry in case of server throttling. - * - * This offers an opportunity to populate headers or update - * content before sending a request. - */ - get preflightFunc() { - return this.#preflight || null; - } - set preflightFunc(preflight) { - this.#preflight = preflight; - } - /** - * This function is called after each response, offering an - * opportunity to provide client-level throttling or updating - * response data. - * - * Any error thrown in this causes the ``send()`` to throw. - * - * To schedule a retry attempt (assuming the maximum retry limit - * has not been reached), use [[response.throwThrottleError]]. - */ - get processFunc() { - return this.#process || null; - } - set processFunc(process) { - this.#process = process; - } - /** - * This function is called on each retry attempt. - */ - get retryFunc() { - return this.#retry || null; - } - set retryFunc(retry) { - this.#retry = retry; - } - /** - * This function is called to fetch content from HTTP and - * HTTPS URLs and is platform specific (e.g. nodejs vs - * browsers). - * - * This is by default the currently registered global getUrl - * function, which can be changed using [[registerGetUrl]]. - * If this has been set, setting is to ``null`` will cause - * this FetchRequest (and any future clones) to revert back to - * using the currently registered global getUrl function. - * - * Setting this is generally not necessary, but may be useful - * for developers that wish to intercept requests or to - * configurege a proxy or other agent. - */ - get getUrlFunc() { - return this.#getUrlFunc || defaultGetUrlFunc; - } - set getUrlFunc(value) { - this.#getUrlFunc = value; - } - /** - * Create a new FetchRequest instance with default values. - * - * Once created, each property may be set before issuing a - * ``.send()`` to make the request. - */ - constructor(url) { - this.#url = String(url); - this.#allowInsecure = false; - this.#gzip = true; - this.#headers = {}; - this.#method = ""; - this.#timeout = 300000; - this.#throttle = { - slotInterval: SLOT_INTERVAL, - maxAttempts: MAX_ATTEMPTS - }; - this.#getUrlFunc = null; - } - toString() { - return ``; - } - /** - * Update the throttle parameters used to determine maximum - * attempts and exponential-backoff properties. - */ - setThrottleParams(params) { - if (params.slotInterval != null) { - this.#throttle.slotInterval = params.slotInterval; - } - if (params.maxAttempts != null) { - this.#throttle.maxAttempts = params.maxAttempts; - } - } - async #send(attempt, expires, delay, _request, _response) { - if (attempt >= this.#throttle.maxAttempts) { - return _response.makeServerError("exceeded maximum retry limit"); - } - (0,errors/* assert */.vA)(getTime() <= expires, "timeout", "TIMEOUT", { - operation: "request.send", reason: "timeout", request: _request - }); - if (delay > 0) { - await wait(delay); - } - let req = this.clone(); - const scheme = (req.url.split(":")[0] || "").toLowerCase(); - // Process any Gateways - if (scheme in Gateways) { - const result = await Gateways[scheme](req.url, checkSignal(_request.#signal)); - if (result instanceof FetchResponse) { - let response = result; - if (this.processFunc) { - checkSignal(_request.#signal); - try { - response = await this.processFunc(req, response); - } - catch (error) { - // Something went wrong during processing; throw a 5xx server error - if (error.throttle == null || typeof (error.stall) !== "number") { - response.makeServerError("error in post-processing function", error).assertOk(); - } - // Ignore throttling - } - } - return response; - } - req = result; - } - // We have a preflight function; update the request - if (this.preflightFunc) { - req = await this.preflightFunc(req); - } - const resp = await this.getUrlFunc(req, checkSignal(_request.#signal)); - let response = new FetchResponse(resp.statusCode, resp.statusMessage, resp.headers, resp.body, _request); - if (response.statusCode === 301 || response.statusCode === 302) { - // Redirect - try { - const location = response.headers.location || ""; - return req.redirect(location).#send(attempt + 1, expires, 0, _request, response); - } - catch (error) { } - // Things won't get any better on another attempt; abort - return response; - } - else if (response.statusCode === 429) { - // Throttle - if (this.retryFunc == null || (await this.retryFunc(req, response, attempt))) { - const retryAfter = response.headers["retry-after"]; - let delay = this.#throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt)); - if (typeof (retryAfter) === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { - delay = parseInt(retryAfter); - } - return req.clone().#send(attempt + 1, expires, delay, _request, response); - } - } - if (this.processFunc) { - checkSignal(_request.#signal); - try { - response = await this.processFunc(req, response); - } - catch (error) { - // Something went wrong during processing; throw a 5xx server error - if (error.throttle == null || typeof (error.stall) !== "number") { - response.makeServerError("error in post-processing function", error).assertOk(); - } - // Throttle - let delay = this.#throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt)); - ; - if (error.stall >= 0) { - delay = error.stall; - } - return req.clone().#send(attempt + 1, expires, delay, _request, response); - } - } - return response; - } - /** - * Resolves to the response by sending the request. - */ - send() { - (0,errors/* assert */.vA)(this.#signal == null, "request already sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.send" }); - this.#signal = new FetchCancelSignal(this); - return this.#send(0, getTime() + this.timeout, 0, this, new FetchResponse(0, "", {}, null, this)); - } - /** - * Cancels the inflight response, causing a ``CANCELLED`` - * error to be rejected from the [[send]]. - */ - cancel() { - (0,errors/* assert */.vA)(this.#signal != null, "request has not been sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.cancel" }); - const signal = fetchSignals.get(this); - if (!signal) { - throw new Error("missing signal; should not happen"); - } - signal(); - } - /** - * Returns a new [[FetchRequest]] that represents the redirection - * to %%location%%. - */ - redirect(location) { - // Redirection; for now we only support absolute locations - const current = this.url.split(":")[0].toLowerCase(); - const target = location.split(":")[0].toLowerCase(); - // Don't allow redirecting: - // - non-GET requests - // - downgrading the security (e.g. https => http) - // - to non-HTTP (or non-HTTPS) protocols [this could be relaxed?] - (0,errors/* assert */.vA)(this.method === "GET" && (current !== "https" || target !== "http") && location.match(/^https?:/), `unsupported redirect`, "UNSUPPORTED_OPERATION", { - operation: `redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(location)})` - }); - // Create a copy of this request, with a new URL - const req = new FetchRequest(location); - req.method = "GET"; - req.allowGzip = this.allowGzip; - req.timeout = this.timeout; - req.#headers = Object.assign({}, this.#headers); - if (this.#body) { - req.#body = new Uint8Array(this.#body); - } - req.#bodyType = this.#bodyType; - // Do not forward credentials unless on the same domain; only absolute - //req.allowInsecure = false; - // paths are currently supported; may want a way to specify to forward? - //setStore(req.#props, "creds", getStore(this.#pros, "creds")); - return req; - } - /** - * Create a new copy of this request. - */ - clone() { - const clone = new FetchRequest(this.url); - // Preserve "default method" (i.e. null) - clone.#method = this.#method; - // Preserve "default body" with type, copying the Uint8Array is present - if (this.#body) { - clone.#body = this.#body; - } - clone.#bodyType = this.#bodyType; - // Preserve "default headers" - clone.#headers = Object.assign({}, this.#headers); - // Credentials is readonly, so we copy internally - clone.#creds = this.#creds; - if (this.allowGzip) { - clone.allowGzip = true; - } - clone.timeout = this.timeout; - if (this.allowInsecureAuthentication) { - clone.allowInsecureAuthentication = true; - } - clone.#preflight = this.#preflight; - clone.#process = this.#process; - clone.#retry = this.#retry; - clone.#throttle = Object.assign({}, this.#throttle); - clone.#getUrlFunc = this.#getUrlFunc; - return clone; - } - /** - * Locks all static configuration for gateways and FetchGetUrlFunc - * registration. - */ - static lockConfig() { - locked = true; - } - /** - * Get the current Gateway function for %%scheme%%. - */ - static getGateway(scheme) { - return Gateways[scheme.toLowerCase()] || null; - } - /** - * Use the %%func%% when fetching URIs using %%scheme%%. - * - * This method affects all requests globally. - * - * If [[lockConfig]] has been called, no change is made and this - * throws. - */ - static registerGateway(scheme, func) { - scheme = scheme.toLowerCase(); - if (scheme === "http" || scheme === "https") { - throw new Error(`cannot intercept ${scheme}; use registerGetUrl`); - } - if (locked) { - throw new Error("gateways locked"); - } - Gateways[scheme] = func; - } - /** - * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests. - * - * This method affects all requests globally. - * - * If [[lockConfig]] has been called, no change is made and this - * throws. - */ - static registerGetUrl(getUrl) { - if (locked) { - throw new Error("gateways locked"); - } - defaultGetUrlFunc = getUrl; - } - /** - * Creates a getUrl function that fetches content from HTTP and - * HTTPS URLs. - * - * The available %%options%% are dependent on the platform - * implementation of the default getUrl function. - * - * This is not generally something that is needed, but is useful - * when trying to customize simple behaviour when fetching HTTP - * content. - */ - static createGetUrlFunc(options) { - return createGetUrl(options); - } - /** - * Creates a function that can "fetch" data URIs. - * - * Note that this is automatically done internally to support - * data URIs, so it is not necessary to register it. - * - * This is not generally something that is needed, but may - * be useful in a wrapper to perfom custom data URI functionality. - */ - static createDataGateway() { - return dataGatewayFunc; - } - /** - * Creates a function that will fetch IPFS (unvalidated) from - * a custom gateway baseUrl. - * - * The default IPFS gateway used internally is - * ``"https:/\/gateway.ipfs.io/ipfs/"``. - */ - static createIpfsGatewayFunc(baseUrl) { - return getIpfsGatewayFunc(baseUrl); - } -} -; -/** - * The response for a FetchRequest. - */ -class FetchResponse { - #statusCode; - #statusMessage; - #headers; - #body; - #request; - #error; - toString() { - return ``; - } - /** - * The response status code. - */ - get statusCode() { return this.#statusCode; } - /** - * The response status message. - */ - get statusMessage() { return this.#statusMessage; } - /** - * The response headers. All keys are lower-case. - */ - get headers() { return Object.assign({}, this.#headers); } - /** - * The response body, or ``null`` if there was no body. - */ - get body() { - return (this.#body == null) ? null : new Uint8Array(this.#body); - } - /** - * The response body as a UTF-8 encoded string, or the empty - * string (i.e. ``""``) if there was no body. - * - * An error is thrown if the body is invalid UTF-8 data. - */ - get bodyText() { - try { - return (this.#body == null) ? "" : (0,utf8/* toUtf8String */._v)(this.#body); - } - catch (error) { - (0,errors/* assert */.vA)(false, "response body is not valid UTF-8 data", "UNSUPPORTED_OPERATION", { - operation: "bodyText", info: { response: this } - }); - } - } - /** - * The response body, decoded as JSON. - * - * An error is thrown if the body is invalid JSON-encoded data - * or if there was no body. - */ - get bodyJson() { - try { - return JSON.parse(this.bodyText); - } - catch (error) { - (0,errors/* assert */.vA)(false, "response body is not valid JSON", "UNSUPPORTED_OPERATION", { - operation: "bodyJson", info: { response: this } - }); - } - } - [Symbol.iterator]() { - const headers = this.headers; - const keys = Object.keys(headers); - let index = 0; - return { - next: () => { - if (index < keys.length) { - const key = keys[index++]; - return { - value: [key, headers[key]], done: false - }; - } - return { value: undefined, done: true }; - } - }; - } - constructor(statusCode, statusMessage, headers, body, request) { - this.#statusCode = statusCode; - this.#statusMessage = statusMessage; - this.#headers = Object.keys(headers).reduce((accum, k) => { - accum[k.toLowerCase()] = String(headers[k]); - return accum; - }, {}); - this.#body = ((body == null) ? null : new Uint8Array(body)); - this.#request = (request || null); - this.#error = { message: "" }; - } - /** - * Return a Response with matching headers and body, but with - * an error status code (i.e. 599) and %%message%% with an - * optional %%error%%. - */ - makeServerError(message, error) { - let statusMessage; - if (!message) { - message = `${this.statusCode} ${this.statusMessage}`; - statusMessage = `CLIENT ESCALATED SERVER ERROR (${message})`; - } - else { - statusMessage = `CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`; - } - const response = new FetchResponse(599, statusMessage, this.headers, this.body, this.#request || undefined); - response.#error = { message, error }; - return response; - } - /** - * If called within a [request.processFunc](FetchRequest-processFunc) - * call, causes the request to retry as if throttled for %%stall%% - * milliseconds. - */ - throwThrottleError(message, stall) { - if (stall == null) { - stall = -1; - } - else { - (0,errors/* assertArgument */.MR)(Number.isInteger(stall) && stall >= 0, "invalid stall timeout", "stall", stall); - } - const error = new Error(message || "throttling requests"); - (0,properties/* defineProperties */.n)(error, { stall, throttle: true }); - throw error; - } - /** - * Get the header value for %%key%%, ignoring case. - */ - getHeader(key) { - return this.headers[key.toLowerCase()]; - } - /** - * Returns true if the response has a body. - */ - hasBody() { - return (this.#body != null); - } - /** - * The request made for this response. - */ - get request() { return this.#request; } - /** - * Returns true if this response was a success statusCode. - */ - ok() { - return (this.#error.message === "" && this.statusCode >= 200 && this.statusCode < 300); - } - /** - * Throws a ``SERVER_ERROR`` if this response is not ok. - */ - assertOk() { - if (this.ok()) { - return; - } - let { message, error } = this.#error; - if (message === "") { - message = `server response ${this.statusCode} ${this.statusMessage}`; - } - let requestUrl = null; - if (this.request) { - requestUrl = this.request.url; - } - let responseBody = null; - try { - if (this.#body) { - responseBody = (0,utf8/* toUtf8String */._v)(this.#body); - } - } - catch (e) { } - (0,errors/* assert */.vA)(false, message, "SERVER_ERROR", { - request: (this.request || "unknown request"), response: this, error, - info: { - requestUrl, responseBody, - responseStatus: `${this.statusCode} ${this.statusMessage}` - } - }); - } -} -function getTime() { return (new Date()).getTime(); } -function unpercent(value) { - return (0,utf8/* toUtf8Bytes */.YW)(value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => { - return String.fromCharCode(parseInt(code, 16)); - })); -} -function wait(delay) { - return new Promise((resolve) => setTimeout(resolve, delay)); -} -//# sourceMappingURL=fetch.js.map -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/units.js + 1 modules -var units = __webpack_require__(99770); -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/abi/abi-coder.js + 10 modules -var abi_coder = __webpack_require__(35273); -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/address/address.js -var address_address = __webpack_require__(30031); -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/address/checks.js -var checks = __webpack_require__(41442); -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/crypto/keccak.js + 1 modules -var keccak = __webpack_require__(15539); -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/maths.js -var maths = __webpack_require__(27033); -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/hash/id.js -var id = __webpack_require__(38264); -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/hash/typed-data.js -//import { TypedDataDomain, TypedDataField } from "@ethersproject/providerabstract-signer"; - - - - - -const padding = new Uint8Array(32); -padding.fill(0); -const BN__1 = BigInt(-1); -const BN_0 = BigInt(0); -const BN_1 = BigInt(1); -const BN_MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); -; -; -function hexPadRight(value) { - const bytes = (0,utils_data/* getBytes */.q5)(value); - const padOffset = bytes.length % 32; - if (padOffset) { - return (0,utils_data/* concat */.xW)([bytes, padding.slice(padOffset)]); - } - return (0,utils_data/* hexlify */.c$)(bytes); -} -const hexTrue = (0,maths/* toBeHex */.up)(BN_1, 32); -const hexFalse = (0,maths/* toBeHex */.up)(BN_0, 32); -const domainFieldTypes = { - name: "string", - version: "string", - chainId: "uint256", - verifyingContract: "address", - salt: "bytes32" -}; -const domainFieldNames = [ - "name", "version", "chainId", "verifyingContract", "salt" -]; -function checkString(key) { - return function (value) { - (0,errors/* assertArgument */.MR)(typeof (value) === "string", `invalid domain value for ${JSON.stringify(key)}`, `domain.${key}`, value); - return value; - }; -} -const domainChecks = { - name: checkString("name"), - version: checkString("version"), - chainId: function (_value) { - const value = (0,maths/* getBigInt */.Ab)(_value, "domain.chainId"); - (0,errors/* assertArgument */.MR)(value >= 0, "invalid chain ID", "domain.chainId", _value); - if (Number.isSafeInteger(value)) { - return Number(value); - } - return (0,maths/* toQuantity */.nD)(value); - }, - verifyingContract: function (value) { - try { - return (0,address_address/* getAddress */.b)(value).toLowerCase(); - } - catch (error) { } - (0,errors/* assertArgument */.MR)(false, `invalid domain value "verifyingContract"`, "domain.verifyingContract", value); - }, - salt: function (value) { - const bytes = (0,utils_data/* getBytes */.q5)(value, "domain.salt"); - (0,errors/* assertArgument */.MR)(bytes.length === 32, `invalid domain value "salt"`, "domain.salt", value); - return (0,utils_data/* hexlify */.c$)(bytes); - } -}; -function getBaseEncoder(type) { - // intXX and uintXX - { - const match = type.match(/^(u?)int(\d+)$/); - if (match) { - const signed = (match[1] === ""); - const width = parseInt(match[2]); - (0,errors/* assertArgument */.MR)(width % 8 === 0 && width !== 0 && width <= 256 && match[2] === String(width), "invalid numeric width", "type", type); - const boundsUpper = (0,maths/* mask */.dK)(BN_MAX_UINT256, signed ? (width - 1) : width); - const boundsLower = signed ? ((boundsUpper + BN_1) * BN__1) : BN_0; - return function (_value) { - const value = (0,maths/* getBigInt */.Ab)(_value, "value"); - (0,errors/* assertArgument */.MR)(value >= boundsLower && value <= boundsUpper, `value out-of-bounds for ${type}`, "value", value); - return (0,maths/* toBeHex */.up)(signed ? (0,maths/* toTwos */.JJ)(value, 256) : value, 32); - }; - } - } - // bytesXX - { - const match = type.match(/^bytes(\d+)$/); - if (match) { - const width = parseInt(match[1]); - (0,errors/* assertArgument */.MR)(width !== 0 && width <= 32 && match[1] === String(width), "invalid bytes width", "type", type); - return function (value) { - const bytes = (0,utils_data/* getBytes */.q5)(value); - (0,errors/* assertArgument */.MR)(bytes.length === width, `invalid length for ${type}`, "value", value); - return hexPadRight(value); - }; - } - } - switch (type) { - case "address": return function (value) { - return (0,utils_data/* zeroPadValue */.nx)((0,address_address/* getAddress */.b)(value), 32); - }; - case "bool": return function (value) { - return ((!value) ? hexFalse : hexTrue); - }; - case "bytes": return function (value) { - return (0,keccak/* keccak256 */.S)(value); - }; - case "string": return function (value) { - return (0,id.id)(value); - }; - } - return null; -} -function encodeType(name, fields) { - return `${name}(${fields.map(({ name, type }) => (type + " " + name)).join(",")})`; -} -// foo[][3] => { base: "foo", index: "[][3]", array: { -// base: "foo", prefix: "foo[]", count: 3 } } -function splitArray(type) { - const match = type.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/); - if (match) { - return { - base: match[1], - index: (match[2] + match[4]), - array: { - base: match[1], - prefix: (match[1] + match[2]), - count: (match[5] ? parseInt(match[5]) : -1), - } - }; - } - return { base: type }; -} -/** - * A **TypedDataEncode** prepares and encodes [[link-eip-712]] payloads - * for signed typed data. - * - * This is useful for those that wish to compute various components of a - * typed data hash, primary types, or sub-components, but generally the - * higher level [[Signer-signTypedData]] is more useful. - */ -class TypedDataEncoder { - /** - * The primary type for the structured [[types]]. - * - * This is derived automatically from the [[types]], since no - * recursion is possible, once the DAG for the types is consturcted - * internally, the primary type must be the only remaining type with - * no parent nodes. - */ - primaryType; - #types; - /** - * The types. - */ - get types() { - return JSON.parse(this.#types); - } - #fullTypes; - #encoderCache; - /** - * Create a new **TypedDataEncoder** for %%types%%. - * - * This performs all necessary checking that types are valid and - * do not violate the [[link-eip-712]] structural constraints as - * well as computes the [[primaryType]]. - */ - constructor(_types) { - this.#fullTypes = new Map(); - this.#encoderCache = new Map(); - // Link struct types to their direct child structs - const links = new Map(); - // Link structs to structs which contain them as a child - const parents = new Map(); - // Link all subtypes within a given struct - const subtypes = new Map(); - const types = {}; - Object.keys(_types).forEach((type) => { - types[type] = _types[type].map(({ name, type }) => { - // Normalize the base type (unless name conflict) - let { base, index } = splitArray(type); - if (base === "int" && !_types["int"]) { - base = "int256"; - } - if (base === "uint" && !_types["uint"]) { - base = "uint256"; - } - return { name, type: (base + (index || "")) }; - }); - links.set(type, new Set()); - parents.set(type, []); - subtypes.set(type, new Set()); - }); - this.#types = JSON.stringify(types); - for (const name in types) { - const uniqueNames = new Set(); - for (const field of types[name]) { - // Check each field has a unique name - (0,errors/* assertArgument */.MR)(!uniqueNames.has(field.name), `duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", _types); - uniqueNames.add(field.name); - // Get the base type (drop any array specifiers) - const baseType = splitArray(field.type).base; - (0,errors/* assertArgument */.MR)(baseType !== name, `circular type reference to ${JSON.stringify(baseType)}`, "types", _types); - // Is this a base encoding type? - const encoder = getBaseEncoder(baseType); - if (encoder) { - continue; - } - (0,errors/* assertArgument */.MR)(parents.has(baseType), `unknown type ${JSON.stringify(baseType)}`, "types", _types); - // Add linkage - parents.get(baseType).push(name); - links.get(name).add(baseType); - } - } - // Deduce the primary type - const primaryTypes = Array.from(parents.keys()).filter((n) => (parents.get(n).length === 0)); - (0,errors/* assertArgument */.MR)(primaryTypes.length !== 0, "missing primary type", "types", _types); - (0,errors/* assertArgument */.MR)(primaryTypes.length === 1, `ambiguous primary types or unused types: ${primaryTypes.map((t) => (JSON.stringify(t))).join(", ")}`, "types", _types); - (0,properties/* defineProperties */.n)(this, { primaryType: primaryTypes[0] }); - // Check for circular type references - function checkCircular(type, found) { - (0,errors/* assertArgument */.MR)(!found.has(type), `circular type reference to ${JSON.stringify(type)}`, "types", _types); - found.add(type); - for (const child of links.get(type)) { - if (!parents.has(child)) { - continue; - } - // Recursively check children - checkCircular(child, found); - // Mark all ancestors as having this decendant - for (const subtype of found) { - subtypes.get(subtype).add(child); - } - } - found.delete(type); - } - checkCircular(this.primaryType, new Set()); - // Compute each fully describe type - for (const [name, set] of subtypes) { - const st = Array.from(set); - st.sort(); - this.#fullTypes.set(name, encodeType(name, types[name]) + st.map((t) => encodeType(t, types[t])).join("")); - } - } - /** - * Returnthe encoder for the specific %%type%%. - */ - getEncoder(type) { - let encoder = this.#encoderCache.get(type); - if (!encoder) { - encoder = this.#getEncoder(type); - this.#encoderCache.set(type, encoder); - } - return encoder; - } - #getEncoder(type) { - // Basic encoder type (address, bool, uint256, etc) - { - const encoder = getBaseEncoder(type); - if (encoder) { - return encoder; - } - } - // Array - const array = splitArray(type).array; - if (array) { - const subtype = array.prefix; - const subEncoder = this.getEncoder(subtype); - return (value) => { - (0,errors/* assertArgument */.MR)(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${array.count}`, "value", value); - let result = value.map(subEncoder); - if (this.#fullTypes.has(subtype)) { - result = result.map(keccak/* keccak256 */.S); - } - return (0,keccak/* keccak256 */.S)((0,utils_data/* concat */.xW)(result)); - }; - } - // Struct - const fields = this.types[type]; - if (fields) { - const encodedType = (0,id.id)(this.#fullTypes.get(type)); - return (value) => { - const values = fields.map(({ name, type }) => { - const result = this.getEncoder(type)(value[name]); - if (this.#fullTypes.has(type)) { - return (0,keccak/* keccak256 */.S)(result); - } - return result; - }); - values.unshift(encodedType); - return (0,utils_data/* concat */.xW)(values); - }; - } - (0,errors/* assertArgument */.MR)(false, `unknown type: ${type}`, "type", type); - } - /** - * Return the full type for %%name%%. - */ - encodeType(name) { - const result = this.#fullTypes.get(name); - (0,errors/* assertArgument */.MR)(result, `unknown type: ${JSON.stringify(name)}`, "name", name); - return result; - } - /** - * Return the encoded %%value%% for the %%type%%. - */ - encodeData(type, value) { - return this.getEncoder(type)(value); - } - /** - * Returns the hash of %%value%% for the type of %%name%%. - */ - hashStruct(name, value) { - return (0,keccak/* keccak256 */.S)(this.encodeData(name, value)); - } - /** - * Return the fulled encoded %%value%% for the [[types]]. - */ - encode(value) { - return this.encodeData(this.primaryType, value); - } - /** - * Return the hash of the fully encoded %%value%% for the [[types]]. - */ - hash(value) { - return this.hashStruct(this.primaryType, value); - } - /** - * @_ignore: - */ - _visit(type, value, callback) { - // Basic encoder type (address, bool, uint256, etc) - { - const encoder = getBaseEncoder(type); - if (encoder) { - return callback(type, value); - } - } - // Array - const array = splitArray(type).array; - if (array) { - (0,errors/* assertArgument */.MR)(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${array.count}`, "value", value); - return value.map((v) => this._visit(array.prefix, v, callback)); - } - // Struct - const fields = this.types[type]; - if (fields) { - return fields.reduce((accum, { name, type }) => { - accum[name] = this._visit(type, value[name], callback); - return accum; - }, {}); - } - (0,errors/* assertArgument */.MR)(false, `unknown type: ${type}`, "type", type); - } - /** - * Call %%calback%% for each value in %%value%%, passing the type and - * component within %%value%%. - * - * This is useful for replacing addresses or other transformation that - * may be desired on each component, based on its type. - */ - visit(value, callback) { - return this._visit(this.primaryType, value, callback); - } - /** - * Create a new **TypedDataEncoder** for %%types%%. - */ - static from(types) { - return new TypedDataEncoder(types); - } - /** - * Return the primary type for %%types%%. - */ - static getPrimaryType(types) { - return TypedDataEncoder.from(types).primaryType; - } - /** - * Return the hashed struct for %%value%% using %%types%% and %%name%%. - */ - static hashStruct(name, types, value) { - return TypedDataEncoder.from(types).hashStruct(name, value); - } - /** - * Return the domain hash for %%domain%%. - */ - static hashDomain(domain) { - const domainFields = []; - for (const name in domain) { - if (domain[name] == null) { - continue; - } - const type = domainFieldTypes[name]; - (0,errors/* assertArgument */.MR)(type, `invalid typed-data domain key: ${JSON.stringify(name)}`, "domain", domain); - domainFields.push({ name, type }); - } - domainFields.sort((a, b) => { - return domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name); - }); - return TypedDataEncoder.hashStruct("EIP712Domain", { EIP712Domain: domainFields }, domain); - } - /** - * Return the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. - */ - static encode(domain, types, value) { - return (0,utils_data/* concat */.xW)([ - "0x1901", - TypedDataEncoder.hashDomain(domain), - TypedDataEncoder.from(types).hash(value) - ]); - } - /** - * Return the hash of the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. - */ - static hash(domain, types, value) { - return (0,keccak/* keccak256 */.S)(TypedDataEncoder.encode(domain, types, value)); - } - // Replaces all address types with ENS names with their looked up address - /** - * Resolves to the value from resolving all addresses in %%value%% for - * %%types%% and the %%domain%%. - */ - static async resolveNames(domain, types, value, resolveName) { - // Make a copy to isolate it from the object passed in - domain = Object.assign({}, domain); - // Allow passing null to ignore value - for (const key in domain) { - if (domain[key] == null) { - delete domain[key]; - } - } - // Look up all ENS names - const ensCache = {}; - // Do we need to look up the domain's verifyingContract? - if (domain.verifyingContract && !(0,utils_data/* isHexString */.Lo)(domain.verifyingContract, 20)) { - ensCache[domain.verifyingContract] = "0x"; - } - // We are going to use the encoder to visit all the base values - const encoder = TypedDataEncoder.from(types); - // Get a list of all the addresses - encoder.visit(value, (type, value) => { - if (type === "address" && !(0,utils_data/* isHexString */.Lo)(value, 20)) { - ensCache[value] = "0x"; - } - return value; - }); - // Lookup each name - for (const name in ensCache) { - ensCache[name] = await resolveName(name); - } - // Replace the domain verifyingContract if needed - if (domain.verifyingContract && ensCache[domain.verifyingContract]) { - domain.verifyingContract = ensCache[domain.verifyingContract]; - } - // Replace all ENS names with their address - value = encoder.visit(value, (type, value) => { - if (type === "address" && ensCache[value]) { - return ensCache[value]; - } - return value; - }); - return { domain, value }; - } - /** - * Returns the JSON-encoded payload expected by nodes which implement - * the JSON-RPC [[link-eip-712]] method. - */ - static getPayload(domain, types, value) { - // Validate the domain fields - TypedDataEncoder.hashDomain(domain); - // Derive the EIP712Domain Struct reference type - const domainValues = {}; - const domainTypes = []; - domainFieldNames.forEach((name) => { - const value = domain[name]; - if (value == null) { - return; - } - domainValues[name] = domainChecks[name](value); - domainTypes.push({ name, type: domainFieldTypes[name] }); - }); - const encoder = TypedDataEncoder.from(types); - // Get the normalized types - types = encoder.types; - const typesWithDomain = Object.assign({}, types); - (0,errors/* assertArgument */.MR)(typesWithDomain.EIP712Domain == null, "types must not contain EIP712Domain type", "types.EIP712Domain", types); - typesWithDomain.EIP712Domain = domainTypes; - // Validate the data structures and types - encoder.encode(value); - return { - types: typesWithDomain, - domain: domainValues, - primaryType: encoder.primaryType, - message: encoder.visit(value, (type, value) => { - // bytes - if (type.match(/^bytes(\d*)/)) { - return (0,utils_data/* hexlify */.c$)((0,utils_data/* getBytes */.q5)(value)); - } - // uint or int - if (type.match(/^u?int/)) { - return (0,maths/* getBigInt */.Ab)(value).toString(); - } - switch (type) { - case "address": - return value.toLowerCase(); - case "bool": - return !!value; - case "string": - (0,errors/* assertArgument */.MR)(typeof (value) === "string", "invalid string", "value", value); - return value; - } - (0,errors/* assertArgument */.MR)(false, "unsupported type", "type", type); - }) - }; - } -} -/** - * Compute the address used to sign the typed data for the %%signature%%. - */ -function verifyTypedData(domain, types, value, signature) { - return recoverAddress(TypedDataEncoder.hash(domain, types, value), signature); -} -//# sourceMappingURL=typed-data.js.map -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/transaction/accesslist.js -var accesslist = __webpack_require__(8177); -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/constants/addresses.js -var addresses = __webpack_require__(98982); -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/contract/contract.js + 1 modules -var contract_contract = __webpack_require__(24391); -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/hash/namehash.js + 1 modules -var namehash = __webpack_require__(64563); -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/transaction/transaction.js + 1 modules -var transaction = __webpack_require__(79453); -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/events.js -var events = __webpack_require__(99381); -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/utils/base58.js -/** - * The [Base58 Encoding](link-base58) scheme allows a **numeric** value - * to be encoded as a compact string using a radix of 58 using only - * alpha-numeric characters. Confusingly similar characters are omitted - * (i.e. ``"l0O"``). - * - * Note that Base58 encodes a **numeric** value, not arbitrary bytes, - * since any zero-bytes on the left would get removed. To mitigate this - * issue most schemes that use Base58 choose specific high-order values - * to ensure non-zero prefixes. - * - * @_subsection: api/utils:Base58 Encoding [about-base58] - */ - - - -const Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; -let Lookup = null; -function getAlpha(letter) { - if (Lookup == null) { - Lookup = {}; - for (let i = 0; i < Alphabet.length; i++) { - Lookup[Alphabet[i]] = BigInt(i); - } - } - const result = Lookup[letter]; - (0,errors/* assertArgument */.MR)(result != null, `invalid base58 value`, "letter", letter); - return result; -} -const base58_BN_0 = BigInt(0); -const BN_58 = BigInt(58); -/** - * Encode %%value%% as a Base58-encoded string. - */ -function encodeBase58(_value) { - const bytes = (0,utils_data/* getBytes */.q5)(_value); - let value = (0,maths/* toBigInt */.Dg)(bytes); - let result = ""; - while (value) { - result = Alphabet[Number(value % BN_58)] + result; - value /= BN_58; - } - // Account for leading padding zeros - for (let i = 0; i < bytes.length; i++) { - if (bytes[i]) { - break; - } - result = Alphabet[0] + result; - } - return result; -} -/** - * Decode the Base58-encoded %%value%%. - */ -function decodeBase58(value) { - let result = base58_BN_0; - for (let i = 0; i < value.length; i++) { - result *= BN_58; - result += getAlpha(value[i]); - } - return result; -} -//# sourceMappingURL=base58.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/providers/ens-resolver.js -/** - * ENS is a service which allows easy-to-remember names to map to - * network addresses. - * - * @_section: api/providers/ens-resolver:ENS Resolver [about-ens-rsolver] - */ - - - - - -// @TODO: This should use the fetch-data:ipfs gateway -// Trim off the ipfs:// prefix and return the default gateway URL -function getIpfsLink(link) { - if (link.match(/^ipfs:\/\/ipfs\//i)) { - link = link.substring(12); - } - else if (link.match(/^ipfs:\/\//i)) { - link = link.substring(7); - } - else { - (0,errors/* assertArgument */.MR)(false, "unsupported IPFS format", "link", link); - } - return `https:/\/gateway.ipfs.io/ipfs/${link}`; -} -; -; -/** - * A provider plugin super-class for processing multicoin address types. - */ -class MulticoinProviderPlugin { - /** - * The name. - */ - name; - /** - * Creates a new **MulticoinProviderPluing** for %%name%%. - */ - constructor(name) { - (0,properties/* defineProperties */.n)(this, { name }); - } - connect(proivder) { - return this; - } - /** - * Returns ``true`` if %%coinType%% is supported by this plugin. - */ - supportsCoinType(coinType) { - return false; - } - /** - * Resovles to the encoded %%address%% for %%coinType%%. - */ - async encodeAddress(coinType, address) { - throw new Error("unsupported coin"); - } - /** - * Resovles to the decoded %%data%% for %%coinType%%. - */ - async decodeAddress(coinType, data) { - throw new Error("unsupported coin"); - } -} -const BasicMulticoinPluginId = "org.ethers.plugins.provider.BasicMulticoin"; -/** - * A **BasicMulticoinProviderPlugin** provides service for common - * coin types, which do not require additional libraries to encode or - * decode. - */ -class BasicMulticoinProviderPlugin extends MulticoinProviderPlugin { - /** - * Creates a new **BasicMulticoinProviderPlugin**. - */ - constructor() { - super(BasicMulticoinPluginId); - } -} -const matcherIpfs = new RegExp("^(ipfs):/\/(.*)$", "i"); -const matchers = [ - new RegExp("^(https):/\/(.*)$", "i"), - new RegExp("^(data):(.*)$", "i"), - matcherIpfs, - new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i"), -]; -/** - * A connected object to a resolved ENS name resolver, which can be - * used to query additional details. - */ -class EnsResolver { - /** - * The connected provider. - */ - provider; - /** - * The address of the resolver. - */ - address; - /** - * The name this resolver was resolved against. - */ - name; - // For EIP-2544 names, the ancestor that provided the resolver - #supports2544; - #resolver; - constructor(provider, address, name) { - (0,properties/* defineProperties */.n)(this, { provider, address, name }); - this.#supports2544 = null; - this.#resolver = new contract_contract/* Contract */.NZ(address, [ - "function supportsInterface(bytes4) view returns (bool)", - "function resolve(bytes, bytes) view returns (bytes)", - "function addr(bytes32) view returns (address)", - "function addr(bytes32, uint) view returns (bytes)", - "function text(bytes32, string) view returns (string)", - "function contenthash(bytes32) view returns (bytes)", - ], provider); - } - /** - * Resolves to true if the resolver supports wildcard resolution. - */ - async supportsWildcard() { - if (this.#supports2544 == null) { - this.#supports2544 = (async () => { - try { - return await this.#resolver.supportsInterface("0x9061b923"); - } - catch (error) { - // Wildcard resolvers must understand supportsInterface - // and return true. - if ((0,errors/* isError */.bJ)(error, "CALL_EXCEPTION")) { - return false; - } - // Let future attempts try again... - this.#supports2544 = null; - throw error; - } - })(); - } - return await this.#supports2544; - } - async #fetch(funcName, params) { - params = (params || []).slice(); - const iface = this.#resolver.interface; - // The first parameters is always the nodehash - params.unshift((0,namehash/* namehash */.kM)(this.name)); - let fragment = null; - if (await this.supportsWildcard()) { - fragment = iface.getFunction(funcName); - (0,errors/* assert */.vA)(fragment, "missing fragment", "UNKNOWN_ERROR", { - info: { funcName } - }); - params = [ - (0,namehash/* dnsEncode */.Wh)(this.name, 255), - iface.encodeFunctionData(fragment, params) - ]; - funcName = "resolve(bytes,bytes)"; - } - params.push({ - enableCcipRead: true - }); - try { - const result = await this.#resolver[funcName](...params); - if (fragment) { - return iface.decodeFunctionResult(fragment, result)[0]; - } - return result; - } - catch (error) { - if (!(0,errors/* isError */.bJ)(error, "CALL_EXCEPTION")) { - throw error; - } - } - return null; - } - /** - * Resolves to the address for %%coinType%% or null if the - * provided %%coinType%% has not been configured. - */ - async getAddress(coinType) { - if (coinType == null) { - coinType = 60; - } - if (coinType === 60) { - try { - const result = await this.#fetch("addr(bytes32)"); - // No address - if (result == null || result === addresses/* ZeroAddress */.j) { - return null; - } - return result; - } - catch (error) { - if ((0,errors/* isError */.bJ)(error, "CALL_EXCEPTION")) { - return null; - } - throw error; - } - } - // Try decoding its EVM canonical chain as an EVM chain address first - if (coinType >= 0 && coinType < 0x80000000) { - let ethCoinType = coinType + 0x80000000; - const data = await this.#fetch("addr(bytes32,uint)", [ethCoinType]); - if ((0,utils_data/* isHexString */.Lo)(data, 20)) { - return (0,address_address/* getAddress */.b)(data); - } - } - let coinPlugin = null; - for (const plugin of this.provider.plugins) { - if (!(plugin instanceof MulticoinProviderPlugin)) { - continue; - } - if (plugin.supportsCoinType(coinType)) { - coinPlugin = plugin; - break; - } - } - if (coinPlugin == null) { - return null; - } - // keccak256("addr(bytes32,uint256") - const data = await this.#fetch("addr(bytes32,uint)", [coinType]); - // No address - if (data == null || data === "0x") { - return null; - } - // Compute the address - const address = await coinPlugin.decodeAddress(coinType, data); - if (address != null) { - return address; - } - (0,errors/* assert */.vA)(false, `invalid coin data`, "UNSUPPORTED_OPERATION", { - operation: `getAddress(${coinType})`, - info: { coinType, data } - }); - } - /** - * Resolves to the EIP-634 text record for %%key%%, or ``null`` - * if unconfigured. - */ - async getText(key) { - const data = await this.#fetch("text(bytes32,string)", [key]); - if (data == null || data === "0x") { - return null; - } - return data; - } - /** - * Rsolves to the content-hash or ``null`` if unconfigured. - */ - async getContentHash() { - // keccak256("contenthash()") - const data = await this.#fetch("contenthash(bytes32)"); - // No contenthash - if (data == null || data === "0x") { - return null; - } - // IPFS (CID: 1, Type: 70=DAG-PB, 72=libp2p-key) - const ipfs = data.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/); - if (ipfs) { - const scheme = (ipfs[1] === "e3010170") ? "ipfs" : "ipns"; - const length = parseInt(ipfs[4], 16); - if (ipfs[5].length === length * 2) { - return `${scheme}:/\/${encodeBase58("0x" + ipfs[2])}`; - } - } - // Swarm (CID: 1, Type: swarm-manifest; hash/length hard-coded to keccak256/32) - const swarm = data.match(/^0xe40101fa011b20([0-9a-f]*)$/); - if (swarm && swarm[1].length === 64) { - return `bzz:/\/${swarm[1]}`; - } - (0,errors/* assert */.vA)(false, `invalid or unsupported content hash data`, "UNSUPPORTED_OPERATION", { - operation: "getContentHash()", - info: { data } - }); - } - /** - * Resolves to the avatar url or ``null`` if the avatar is either - * unconfigured or incorrectly configured (e.g. references an NFT - * not owned by the address). - * - * If diagnosing issues with configurations, the [[_getAvatar]] - * method may be useful. - */ - async getAvatar() { - const avatar = await this._getAvatar(); - return avatar.url; - } - /** - * When resolving an avatar, there are many steps involved, such - * fetching metadata and possibly validating ownership of an - * NFT. - * - * This method can be used to examine each step and the value it - * was working from. - */ - async _getAvatar() { - const linkage = [{ type: "name", value: this.name }]; - try { - // test data for ricmoo.eth - //const avatar = "eip155:1/erc721:0x265385c7f4132228A0d54EB1A9e7460b91c0cC68/29233"; - const avatar = await this.getText("avatar"); - if (avatar == null) { - linkage.push({ type: "!avatar", value: "" }); - return { url: null, linkage }; - } - linkage.push({ type: "avatar", value: avatar }); - for (let i = 0; i < matchers.length; i++) { - const match = avatar.match(matchers[i]); - if (match == null) { - continue; - } - const scheme = match[1].toLowerCase(); - switch (scheme) { - case "https": - case "data": - linkage.push({ type: "url", value: avatar }); - return { linkage, url: avatar }; - case "ipfs": { - const url = getIpfsLink(avatar); - linkage.push({ type: "ipfs", value: avatar }); - linkage.push({ type: "url", value: url }); - return { linkage, url }; - } - case "erc721": - case "erc1155": { - // Depending on the ERC type, use tokenURI(uint256) or url(uint256) - const selector = (scheme === "erc721") ? "tokenURI(uint256)" : "uri(uint256)"; - linkage.push({ type: scheme, value: avatar }); - // The owner of this name - const owner = await this.getAddress(); - if (owner == null) { - linkage.push({ type: "!owner", value: "" }); - return { url: null, linkage }; - } - const comps = (match[2] || "").split("/"); - if (comps.length !== 2) { - linkage.push({ type: `!${scheme}caip`, value: (match[2] || "") }); - return { url: null, linkage }; - } - const tokenId = comps[1]; - const contract = new contract_contract/* Contract */.NZ(comps[0], [ - // ERC-721 - "function tokenURI(uint) view returns (string)", - "function ownerOf(uint) view returns (address)", - // ERC-1155 - "function uri(uint) view returns (string)", - "function balanceOf(address, uint256) view returns (uint)" - ], this.provider); - // Check that this account owns the token - if (scheme === "erc721") { - const tokenOwner = await contract.ownerOf(tokenId); - if (owner !== tokenOwner) { - linkage.push({ type: "!owner", value: tokenOwner }); - return { url: null, linkage }; - } - linkage.push({ type: "owner", value: tokenOwner }); - } - else if (scheme === "erc1155") { - const balance = await contract.balanceOf(owner, tokenId); - if (!balance) { - linkage.push({ type: "!balance", value: "0" }); - return { url: null, linkage }; - } - linkage.push({ type: "balance", value: balance.toString() }); - } - // Call the token contract for the metadata URL - let metadataUrl = await contract[selector](tokenId); - if (metadataUrl == null || metadataUrl === "0x") { - linkage.push({ type: "!metadata-url", value: "" }); - return { url: null, linkage }; - } - linkage.push({ type: "metadata-url-base", value: metadataUrl }); - // ERC-1155 allows a generic {id} in the URL - if (scheme === "erc1155") { - metadataUrl = metadataUrl.replace("{id}", (0,maths/* toBeHex */.up)(tokenId, 32).substring(2)); - linkage.push({ type: "metadata-url-expanded", value: metadataUrl }); - } - // Transform IPFS metadata links - if (metadataUrl.match(/^ipfs:/i)) { - metadataUrl = getIpfsLink(metadataUrl); - } - linkage.push({ type: "metadata-url", value: metadataUrl }); - // Get the token metadata - let metadata = {}; - const response = await (new FetchRequest(metadataUrl)).send(); - response.assertOk(); - try { - metadata = response.bodyJson; - } - catch (error) { - try { - linkage.push({ type: "!metadata", value: response.bodyText }); - } - catch (error) { - const bytes = response.body; - if (bytes) { - linkage.push({ type: "!metadata", value: (0,utils_data/* hexlify */.c$)(bytes) }); - } - return { url: null, linkage }; - } - return { url: null, linkage }; - } - if (!metadata) { - linkage.push({ type: "!metadata", value: "" }); - return { url: null, linkage }; - } - linkage.push({ type: "metadata", value: JSON.stringify(metadata) }); - // Pull the image URL out - let imageUrl = metadata.image; - if (typeof (imageUrl) !== "string") { - linkage.push({ type: "!imageUrl", value: "" }); - return { url: null, linkage }; - } - if (imageUrl.match(/^(https:\/\/|data:)/i)) { - // Allow - } - else { - // Transform IPFS link to gateway - const ipfs = imageUrl.match(matcherIpfs); - if (ipfs == null) { - linkage.push({ type: "!imageUrl-ipfs", value: imageUrl }); - return { url: null, linkage }; - } - linkage.push({ type: "imageUrl-ipfs", value: imageUrl }); - imageUrl = getIpfsLink(imageUrl); - } - linkage.push({ type: "url", value: imageUrl }); - return { linkage, url: imageUrl }; - } - } - } - } - catch (error) { } - return { linkage, url: null }; - } - static async getEnsAddress(provider) { - const network = await provider.getNetwork(); - const ensPlugin = network.getPlugin("org.ethers.plugins.network.Ens"); - // No ENS... - (0,errors/* assert */.vA)(ensPlugin, "network does not support ENS", "UNSUPPORTED_OPERATION", { - operation: "getEnsAddress", info: { network } - }); - return ensPlugin.address; - } - static async #getResolver(provider, name) { - const ensAddr = await EnsResolver.getEnsAddress(provider); - try { - const contract = new contract_contract/* Contract */.NZ(ensAddr, [ - "function resolver(bytes32) view returns (address)" - ], provider); - const addr = await contract.resolver((0,namehash/* namehash */.kM)(name), { - enableCcipRead: true - }); - if (addr === addresses/* ZeroAddress */.j) { - return null; - } - return addr; - } - catch (error) { - // ENS registry cannot throw errors on resolver(bytes32), - // so probably a link error - throw error; - } - return null; - } - /** - * Resolve to the ENS resolver for %%name%% using %%provider%% or - * ``null`` if unconfigured. - */ - static async fromName(provider, name) { - let currentName = name; - while (true) { - if (currentName === "" || currentName === ".") { - return null; - } - // Optimization since the eth node cannot change and does - // not have a wildcard resolver - if (name !== "eth" && currentName === "eth") { - return null; - } - // Check the current node for a resolver - const addr = await EnsResolver.#getResolver(provider, currentName); - // Found a resolver! - if (addr != null) { - const resolver = new EnsResolver(provider, addr, name); - // Legacy resolver found, using EIP-2544 so it isn't safe to use - if (currentName !== name && !(await resolver.supportsWildcard())) { - return null; - } - return resolver; - } - // Get the parent node - currentName = currentName.split(".").slice(1).join("."); - } - } -} -//# sourceMappingURL=ens-resolver.js.map -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/rlp-encode.js -var rlp_encode = __webpack_require__(65735); -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/address/contract-address.js - - - -// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed -/** - * Returns the address that would result from a ``CREATE`` for %%tx%%. - * - * This can be used to compute the address a contract will be - * deployed to by an EOA when sending a deployment transaction (i.e. - * when the ``to`` address is ``null``). - * - * This can also be used to compute the address a contract will be - * deployed to by a contract, by using the contract's address as the - * ``to`` and the contract's nonce. - * - * @example - * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; - * nonce = 5; - * - * getCreateAddress({ from, nonce }); - * //_result: - */ -function getCreateAddress(tx) { - const from = (0,address_address/* getAddress */.b)(tx.from); - const nonce = (0,maths/* getBigInt */.Ab)(tx.nonce, "tx.nonce"); - let nonceHex = nonce.toString(16); - if (nonceHex === "0") { - nonceHex = "0x"; - } - else if (nonceHex.length % 2) { - nonceHex = "0x0" + nonceHex; - } - else { - nonceHex = "0x" + nonceHex; - } - return (0,address_address/* getAddress */.b)((0,utils_data/* dataSlice */.ZG)((0,keccak/* keccak256 */.S)((0,rlp_encode/* encodeRlp */.R)([from, nonceHex])), 12)); -} -/** - * Returns the address that would result from a ``CREATE2`` operation - * with the given %%from%%, %%salt%% and %%initCodeHash%%. - * - * To compute the %%initCodeHash%% from a contract's init code, use - * the [[keccak256]] function. - * - * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]]. - * - * @example - * // The address of the contract - * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72" - * - * // The salt - * salt = id("HelloWorld") - * - * // The hash of the initCode - * initCode = "0x6394198df16000526103ff60206004601c335afa6040516060f3"; - * initCodeHash = keccak256(initCode) - * - * getCreate2Address(from, salt, initCodeHash) - * //_result: - */ -function getCreate2Address(_from, _salt, _initCodeHash) { - const from = getAddress(_from); - const salt = getBytes(_salt, "salt"); - const initCodeHash = getBytes(_initCodeHash, "initCodeHash"); - assertArgument(salt.length === 32, "salt must be 32 bytes", "salt", _salt); - assertArgument(initCodeHash.length === 32, "initCodeHash must be 32 bytes", "initCodeHash", _initCodeHash); - return getAddress(dataSlice(keccak256(concat(["0xff", from, salt, initCodeHash])), 12)); -} -//# sourceMappingURL=contract-address.js.map -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/crypto/signature.js + 1 modules -var signature = __webpack_require__(20260); -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/providers/format.js -/** - * @_ignore - */ - - - - -const format_BN_0 = BigInt(0); -function allowNull(format, nullValue) { - return (function (value) { - if (value == null) { - return nullValue; - } - return format(value); - }); -} -function arrayOf(format, allowNull) { - return ((array) => { - if (allowNull && array == null) { - return null; - } - if (!Array.isArray(array)) { - throw new Error("not an array"); - } - return array.map((i) => format(i)); - }); -} -// Requires an object which matches a fleet of other formatters -// Any FormatFunc may return `undefined` to have the value omitted -// from the result object. Calls preserve `this`. -function object(format, altNames) { - return ((value) => { - const result = {}; - for (const key in format) { - let srcKey = key; - if (altNames && key in altNames && !(srcKey in value)) { - for (const altKey of altNames[key]) { - if (altKey in value) { - srcKey = altKey; - break; - } - } - } - try { - const nv = format[key](value[srcKey]); - if (nv !== undefined) { - result[key] = nv; - } - } - catch (error) { - const message = (error instanceof Error) ? error.message : "not-an-error"; - (0,errors/* assert */.vA)(false, `invalid value for value.${key} (${message})`, "BAD_DATA", { value }); - } - } - return result; - }); -} -function formatBoolean(value) { - switch (value) { - case true: - case "true": - return true; - case false: - case "false": - return false; - } - (0,errors/* assertArgument */.MR)(false, `invalid boolean; ${JSON.stringify(value)}`, "value", value); -} -function formatData(value) { - (0,errors/* assertArgument */.MR)((0,utils_data/* isHexString */.Lo)(value, true), "invalid data", "value", value); - return value; -} -function formatHash(value) { - (0,errors/* assertArgument */.MR)((0,utils_data/* isHexString */.Lo)(value, 32), "invalid hash", "value", value); - return value; -} -function formatUint256(value) { - if (!isHexString(value)) { - throw new Error("invalid uint256"); - } - return zeroPadValue(value, 32); -} -const _formatLog = object({ - address: address_address/* getAddress */.b, - blockHash: formatHash, - blockNumber: maths/* getNumber */.WZ, - data: formatData, - index: maths/* getNumber */.WZ, - removed: allowNull(formatBoolean, false), - topics: arrayOf(formatHash), - transactionHash: formatHash, - transactionIndex: maths/* getNumber */.WZ, -}, { - index: ["logIndex"] -}); -function formatLog(value) { - return _formatLog(value); -} -const _formatBlock = object({ - hash: allowNull(formatHash), - parentHash: formatHash, - parentBeaconBlockRoot: allowNull(formatHash, null), - number: maths/* getNumber */.WZ, - timestamp: maths/* getNumber */.WZ, - nonce: allowNull(formatData), - difficulty: maths/* getBigInt */.Ab, - gasLimit: maths/* getBigInt */.Ab, - gasUsed: maths/* getBigInt */.Ab, - stateRoot: allowNull(formatHash, null), - receiptsRoot: allowNull(formatHash, null), - blobGasUsed: allowNull(maths/* getBigInt */.Ab, null), - excessBlobGas: allowNull(maths/* getBigInt */.Ab, null), - miner: allowNull(address_address/* getAddress */.b), - prevRandao: allowNull(formatHash, null), - extraData: formatData, - baseFeePerGas: allowNull(maths/* getBigInt */.Ab) -}, { - prevRandao: ["mixHash"] -}); -function formatBlock(value) { - const result = _formatBlock(value); - result.transactions = value.transactions.map((tx) => { - if (typeof (tx) === "string") { - return tx; - } - return formatTransactionResponse(tx); - }); - return result; -} -const _formatReceiptLog = object({ - transactionIndex: maths/* getNumber */.WZ, - blockNumber: maths/* getNumber */.WZ, - transactionHash: formatHash, - address: address_address/* getAddress */.b, - topics: arrayOf(formatHash), - data: formatData, - index: maths/* getNumber */.WZ, - blockHash: formatHash, -}, { - index: ["logIndex"] -}); -function formatReceiptLog(value) { - return _formatReceiptLog(value); -} -const _formatTransactionReceipt = object({ - to: allowNull(address_address/* getAddress */.b, null), - from: allowNull(address_address/* getAddress */.b, null), - contractAddress: allowNull(address_address/* getAddress */.b, null), - // should be allowNull(hash), but broken-EIP-658 support is handled in receipt - index: maths/* getNumber */.WZ, - root: allowNull(utils_data/* hexlify */.c$), - gasUsed: maths/* getBigInt */.Ab, - blobGasUsed: allowNull(maths/* getBigInt */.Ab, null), - logsBloom: allowNull(formatData), - blockHash: formatHash, - hash: formatHash, - logs: arrayOf(formatReceiptLog), - blockNumber: maths/* getNumber */.WZ, - //confirmations: allowNull(getNumber, null), - cumulativeGasUsed: maths/* getBigInt */.Ab, - effectiveGasPrice: allowNull(maths/* getBigInt */.Ab), - blobGasPrice: allowNull(maths/* getBigInt */.Ab, null), - status: allowNull(maths/* getNumber */.WZ), - type: allowNull(maths/* getNumber */.WZ, 0) -}, { - effectiveGasPrice: ["gasPrice"], - hash: ["transactionHash"], - index: ["transactionIndex"], -}); -function formatTransactionReceipt(value) { - return _formatTransactionReceipt(value); -} -function formatTransactionResponse(value) { - // Some clients (TestRPC) do strange things like return 0x0 for the - // 0 address; correct this to be a real address - if (value.to && (0,maths/* getBigInt */.Ab)(value.to) === format_BN_0) { - value.to = "0x0000000000000000000000000000000000000000"; - } - const result = object({ - hash: formatHash, - // Some nodes do not return this, usually test nodes (like Ganache) - index: allowNull(maths/* getNumber */.WZ, undefined), - type: (value) => { - if (value === "0x" || value == null) { - return 0; - } - return (0,maths/* getNumber */.WZ)(value); - }, - accessList: allowNull(accesslist/* accessListify */.$, null), - blobVersionedHashes: allowNull(arrayOf(formatHash, true), null), - blockHash: allowNull(formatHash, null), - blockNumber: allowNull(maths/* getNumber */.WZ, null), - transactionIndex: allowNull(maths/* getNumber */.WZ, null), - from: address_address/* getAddress */.b, - // either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) must be set - gasPrice: allowNull(maths/* getBigInt */.Ab), - maxPriorityFeePerGas: allowNull(maths/* getBigInt */.Ab), - maxFeePerGas: allowNull(maths/* getBigInt */.Ab), - maxFeePerBlobGas: allowNull(maths/* getBigInt */.Ab, null), - gasLimit: maths/* getBigInt */.Ab, - to: allowNull(address_address/* getAddress */.b, null), - value: maths/* getBigInt */.Ab, - nonce: maths/* getNumber */.WZ, - data: formatData, - creates: allowNull(address_address/* getAddress */.b, null), - chainId: allowNull(maths/* getBigInt */.Ab, null) - }, { - data: ["input"], - gasLimit: ["gas"], - index: ["transactionIndex"] - })(value); - // If to and creates are empty, populate the creates from the value - if (result.to == null && result.creates == null) { - result.creates = getCreateAddress(result); - } - // @TODO: Check fee data - // Add an access list to supported transaction types - if ((value.type === 1 || value.type === 2) && value.accessList == null) { - result.accessList = []; - } - // Compute the signature - if (value.signature) { - result.signature = signature/* Signature */.t.from(value.signature); - } - else { - result.signature = signature/* Signature */.t.from(value); - } - // Some backends omit ChainId on legacy transactions, but we can compute it - if (result.chainId == null) { - const chainId = result.signature.legacyChainId; - if (chainId != null) { - result.chainId = chainId; - } - } - // @TODO: check chainID - /* - if (value.chainId != null) { - let chainId = value.chainId; - - if (isHexString(chainId)) { - chainId = BigNumber.from(chainId).toNumber(); - } - - result.chainId = chainId; - - } else { - let chainId = value.networkId; - - // geth-etc returns chainId - if (chainId == null && result.v == null) { - chainId = value.chainId; - } - - if (isHexString(chainId)) { - chainId = BigNumber.from(chainId).toNumber(); - } - - if (typeof(chainId) !== "number" && result.v != null) { - chainId = (result.v - 35) / 2; - if (chainId < 0) { chainId = 0; } - chainId = parseInt(chainId); - } - - if (typeof(chainId) !== "number") { chainId = 0; } - - result.chainId = chainId; - } - */ - // 0x0000... should actually be null - if (result.blockHash && (0,maths/* getBigInt */.Ab)(result.blockHash) === format_BN_0) { - result.blockHash = null; - } - return result; -} -//# sourceMappingURL=format.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/providers/network.js +;// ./node_modules/ethers/lib.esm/providers/network.js /** * A **Network** encapsulates the various properties required to * interact with a specific chain. @@ -66639,9 +96824,8 @@ function injectCommonNetworks() { } //# sourceMappingURL=network.js.map // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/providers/provider.js -var providers_provider = __webpack_require__(43948); -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/providers/subscriber-polling.js -/* provided dependency */ var console = __webpack_require__(96763); +var provider = __webpack_require__(43948); +;// ./node_modules/ethers/lib.esm/providers/subscriber-polling.js function copy(obj) { return JSON.parse(JSON.stringify(obj)); @@ -66935,8 +97119,7 @@ class PollingEventSubscriber { } } //# sourceMappingURL=subscriber-polling.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/providers/abstract-provider.js -/* provided dependency */ var abstract_provider_console = __webpack_require__(96763); +;// ./node_modules/ethers/lib.esm/providers/abstract-provider.js /** * The available providers should suffice for most developers purposes, * but the [[AbstractProvider]] class has many features which enable @@ -67089,7 +97272,7 @@ async function getSubscription(_event, provider) { } (0,errors/* assertArgument */.MR)(false, "unknown ProviderEvent", "event", _event); } -function abstract_provider_getTime() { return (new Date()).getTime(); } +function getTime() { return (new Date()).getTime(); } const defaultOptions = { cacheTimeout: 250, pollingInterval: 4000 @@ -67221,13 +97404,24 @@ class AbstractProvider { // value.status = response.statusCode; // return value; //}); - const request = new FetchRequest(href); + const request = new fetch/* FetchRequest */.ui(href); if (url.indexOf("{data}") === -1) { request.body = { data, sender }; } this.emit("debug", { action: "sendCcipReadFetchRequest", request, index: i, urls }); let errorMessage = "unknown error"; - const resp = await request.send(); + // Fetch the resource... + let resp; + try { + resp = await request.send(); + } + catch (error) { + // ...low-level fetch error (missing host, bad SSL, etc.), + // so try next URL + errorMessages.push(error.message); + this.emit("debug", { action: "receiveCcipReadFetchError", request, result: { error } }); + continue; + } try { const result = resp.bodyJson; if (result.data) { @@ -67256,7 +97450,7 @@ class AbstractProvider { * sub-class of [[Block]]. */ _wrapBlock(value, network) { - return new providers_provider/* Block */.eB(formatBlock(value), this); + return new provider/* Block */.eB(formatBlock(value), this); } /** * Provides the opportunity for a sub-class to wrap a log before @@ -67264,7 +97458,7 @@ class AbstractProvider { * sub-class of [[Log]]. */ _wrapLog(value, network) { - return new providers_provider/* Log */.tG(formatLog(value), this); + return new provider/* Log */.tG(formatLog(value), this); } /** * Provides the opportunity for a sub-class to wrap a transaction @@ -67272,7 +97466,7 @@ class AbstractProvider { * alternate sub-class of [[TransactionReceipt]]. */ _wrapTransactionReceipt(value, network) { - return new providers_provider/* TransactionReceipt */.z5(formatTransactionReceipt(value), this); + return new provider/* TransactionReceipt */.z5(formatTransactionReceipt(value), this); } /** * Provides the opportunity for a sub-class to wrap a transaction @@ -67280,7 +97474,7 @@ class AbstractProvider { * alternate sub-class of [[TransactionResponse]]. */ _wrapTransactionResponse(tx, network) { - return new providers_provider/* TransactionResponse */.uI(formatTransactionResponse(tx), this); + return new provider/* TransactionResponse */.uI(formatTransactionResponse(tx), this); } /** * Resolves to the Network, forcing a network detection using whatever @@ -67439,12 +97633,12 @@ class AbstractProvider { return resolve(address, fromBlock, toBlock); } /** - * Returns or resovles to a transaction for %%request%%, resolving + * Returns or resolves to a transaction for %%request%%, resolving * any ENS names or [[Addressable]] and returning if already a valid * transaction. */ _getTransactionRequest(_request) { - const request = (0,providers_provider/* copyRequest */.VS)(_request); + const request = (0,provider/* copyRequest */.VS)(_request); const promises = []; ["to", "from"].forEach((key) => { if (request[key] == null) { @@ -67548,14 +97742,14 @@ class AbstractProvider { maxPriorityFeePerGas = (priorityFee != null) ? priorityFee : BigInt("1000000000"); maxFeePerGas = (block.baseFeePerGas * BN_2) + maxPriorityFeePerGas; } - return new providers_provider/* FeeData */.J9(gasPrice, maxFeePerGas, maxPriorityFeePerGas); + return new provider/* FeeData */.J9(gasPrice, maxFeePerGas, maxPriorityFeePerGas); }; // Check for a FeeDataNetWorkPlugin const plugin = network.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin"); if (plugin) { - const req = new FetchRequest(plugin.url); + const req = new fetch/* FetchRequest */.ui(plugin.url); const feeData = await plugin.processFunc(getFeeDataFunc, this, req); - return new providers_provider/* FeeData */.J9(feeData.gasPrice, feeData.maxFeePerGas, feeData.maxPriorityFeePerGas); + return new provider/* FeeData */.J9(feeData.gasPrice, feeData.maxFeePerGas, feeData.maxPriorityFeePerGas); } return await getFeeDataFunc(); } @@ -67574,7 +97768,7 @@ class AbstractProvider { transaction: Object.assign({}, tx, { blockTag, enableCcipRead: true }) }); // This came in as a PerformActionTransaction, so to/from are safe; we can cast - const transaction = (0,providers_provider/* copyRequest */.VS)(tx); + const transaction = (0,provider/* copyRequest */.VS)(tx); try { return (0,utils_data/* hexlify */.c$)(await this._perform({ method: "call", transaction, blockTag })); } @@ -67764,7 +97958,7 @@ class AbstractProvider { }); } async getResolver(name) { - return await EnsResolver.fromName(this, name); + return await ens_resolver/* EnsResolver */.Pz.fromName(this, name); } async getAvatar(name) { const resolver = await this.getResolver(name); @@ -67784,15 +97978,15 @@ class AbstractProvider { address = (0,address_address/* getAddress */.b)(address); const node = (0,namehash/* namehash */.kM)(address.substring(2).toLowerCase() + ".addr.reverse"); try { - const ensAddr = await EnsResolver.getEnsAddress(this); - const ensContract = new contract_contract/* Contract */.NZ(ensAddr, [ + const ensAddr = await ens_resolver/* EnsResolver */.Pz.getEnsAddress(this); + const ensContract = new contract/* Contract */.NZ(ensAddr, [ "function resolver(bytes32) view returns (address)" ], this); const resolver = await ensContract.resolver(node); if (resolver == null || resolver === addresses/* ZeroAddress */.j) { return null; } - const resolverContract = new contract_contract/* Contract */.NZ(resolver, [ + const resolverContract = new contract/* Contract */.NZ(resolver, [ "function name(bytes32) view returns (string)" ], this); const name = await resolverContract.name(node); @@ -67839,7 +98033,7 @@ class AbstractProvider { } } catch (error) { - abstract_provider_console.log("EEE", error); + console.log("EEE", error); } this.once("block", listener); }); @@ -67896,7 +98090,7 @@ class AbstractProvider { } else { const timer = setTimeout(func, timeout); - this.#timers.set(timerId, { timer, func, time: abstract_provider_getTime() }); + this.#timers.set(timerId, { timer, func, time: getTime() }); } return timerId; } @@ -68177,7 +98371,7 @@ class AbstractProvider { clearTimeout(timer.timer); } // Remaining time needed for when we become unpaused - timer.time = abstract_provider_getTime() - timer.time; + timer.time = getTime() - timer.time; } } /** @@ -68196,7 +98390,7 @@ class AbstractProvider { timeout = 0; } // Start time (in cause paused, so we con compute remaininf time) - timer.time = abstract_provider_getTime(); + timer.time = getTime(); // Start the timer setTimeout(timer.func, timeout); } @@ -68330,7 +98524,7 @@ function parseOffchainLookup(data) { return result; } //# sourceMappingURL=abstract-provider.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/providers/abstract-signer.js +;// ./node_modules/ethers/lib.esm/providers/abstract-signer.js /** * Generally the [[Wallet]] and [[JsonRpcSigner]] and their sub-classes * are sufficent for most developers, but this is provided to @@ -68349,7 +98543,7 @@ function checkProvider(signer, operation) { (0,errors/* assert */.vA)(false, "missing provider", "UNSUPPORTED_OPERATION", { operation }); } async function populate(signer, tx) { - let pop = (0,providers_provider/* copyRequest */.VS)(tx); + let pop = (0,provider/* copyRequest */.VS)(tx); if (pop.to != null) { pop.to = (0,checks/* resolveAddress */.tG)(pop.to, signer); } @@ -68554,8 +98748,7 @@ class VoidSigner extends AbstractSigner { } } //# sourceMappingURL=abstract-signer.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/providers/subscriber-filterid.js -/* provided dependency */ var subscriber_filterid_console = __webpack_require__(96763); +;// ./node_modules/ethers/lib.esm/providers/subscriber-filterid.js function subscriber_filterid_copy(obj) { @@ -68646,7 +98839,7 @@ class FilterIdSubscriber { await this._emitResults(this.#provider, result); } catch (error) { - subscriber_filterid_console.log("@TODO", error); + console.log("@TODO", error); } this.#provider.once("block", this.#poller); } @@ -68730,8 +98923,7 @@ class FilterIdPendingSubscriber extends FilterIdSubscriber { } } //# sourceMappingURL=subscriber-filterid.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/providers/provider-jsonrpc.js -/* provided dependency */ var provider_jsonrpc_console = __webpack_require__(96763); +;// ./node_modules/ethers/lib.esm/providers/provider-jsonrpc.js /** * One of the most common ways to interact with the blockchain is * by a node running a JSON-RPC interface which can be connected to, @@ -68883,7 +99075,7 @@ class JsonRpcSigner extends AbstractSigner { // If the network changed: calling again will also fail // If unsupported: likely destroyed if ((0,errors/* isError */.bJ)(error, "CANCELLED") || (0,errors/* isError */.bJ)(error, "BAD_DATA") || - (0,errors/* isError */.bJ)(error, "NETWORK_ERROR" || 0)) { + (0,errors/* isError */.bJ)(error, "NETWORK_ERROR") || (0,errors/* isError */.bJ)(error, "UNSUPPORTED_OPERATION")) { if (error.info == null) { error.info = {}; } @@ -68936,14 +99128,14 @@ class JsonRpcSigner extends AbstractSigner { async signTypedData(domain, types, _value) { const value = deepCopy(_value); // Populate any ENS names (in-place) - const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (value) => { + const populated = await typed_data/* TypedDataEncoder */.z.resolveNames(domain, types, value, async (value) => { const address = await (0,checks/* resolveAddress */.tG)(value); (0,errors/* assertArgument */.MR)(address != null, "TypedData does not support null address", "value", value); return address; }); return await this.provider.send("eth_signTypedData_v4", [ this.address.toLowerCase(), - JSON.stringify(TypedDataEncoder.getPayload(populated.domain, types, populated.value)) + JSON.stringify(typed_data/* TypedDataEncoder */.z.getPayload(populated.domain, types, populated.value)) ]); } async unlock(password) { @@ -69103,7 +99295,7 @@ class JsonRpcApiProvider extends AbstractProvider { if (req.method === "call" || req.method === "estimateGas") { let tx = req.transaction; if (tx && tx.type != null && (0,maths/* getBigInt */.Ab)(tx.type)) { - // If there are no EIP-1559 properties, it might be non-EIP-a559 + // If there are no EIP-1559 or newer properties, it might be pre-EIP-1559 if (tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null) { const feeData = await this.getFeeData(); if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) { @@ -69205,7 +99397,7 @@ class JsonRpcApiProvider extends AbstractProvider { if (this.destroyed) { break; } - provider_jsonrpc_console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"); + console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"); this.emit("error", (0,errors/* makeError */.xz)("failed to bootstrap network detection", "NETWORK_ERROR", { event: "initial-network-discovery", info: { error } })); await stall(1000); } @@ -69282,6 +99474,14 @@ class JsonRpcApiProvider extends AbstractProvider { if (tx.accessList) { result["accessList"] = (0,accesslist/* accessListify */.$)(tx.accessList); } + if (tx.blobVersionedHashes) { + // @TODO: Remove this case once EIP-4844 added to prepared tx + result["blobVersionedHashes"] = tx.blobVersionedHashes.map(h => h.toLowerCase()); + } + // @TODO: blobs should probably also be copied over, optionally + // accounting for the kzg property to backfill blobVersionedHashes + // using the commitment. Or should that be left as an exercise to + // the caller? return result; } /** @@ -69548,7 +99748,11 @@ class JsonRpcApiPollingProvider extends JsonRpcApiProvider { #pollingInterval; constructor(network, options) { super(network, options); - this.#pollingInterval = 4000; + let pollingInterval = this._getOption("pollingInterval"); + if (pollingInterval == null) { + pollingInterval = provider_jsonrpc_defaultOptions.pollingInterval; + } + this.#pollingInterval = pollingInterval; } _getSubscriber(sub) { const subscriber = super._getSubscriber(sub); @@ -69589,7 +99793,7 @@ class JsonRpcProvider extends JsonRpcApiPollingProvider { } super(network, options); if (typeof (url) === "string") { - this.#connect = new FetchRequest(url); + this.#connect = new fetch/* FetchRequest */.ui(url); } else { this.#connect = url.clone(); @@ -69675,8 +99879,10 @@ function spelunkMessage(value) { } //# sourceMappingURL=provider-jsonrpc.js.map // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/crypto/signing-key.js + 6 modules -var signing_key = __webpack_require__(15496); -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/constants/strings.js +var signing_key = __webpack_require__(72588); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/crypto/keccak.js + 1 modules +var keccak = __webpack_require__(2011); +;// ./node_modules/ethers/lib.esm/constants/strings.js // NFKC (composed) // (decomposed) /** * A constant for the ether symbol (normalized using NFKC). @@ -69691,7 +99897,7 @@ const EtherSymbol = "\u039e"; // "\uD835\uDF63"; */ const MessagePrefix = "\x19Ethereum Signed Message:\n"; //# sourceMappingURL=strings.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/hash/message.js +;// ./node_modules/ethers/lib.esm/hash/message.js @@ -69745,7 +99951,7 @@ function verifyMessage(message, sig) { //# sourceMappingURL=message.js.map // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/transaction/address.js var transaction_address = __webpack_require__(20415); -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/wallet/base-wallet.js +;// ./node_modules/ethers/lib.esm/wallet/base-wallet.js @@ -69797,6 +100003,7 @@ class BaseWallet extends AbstractSigner { return new BaseWallet(this.#signingKey, provider); } async signTransaction(tx) { + tx = (0,provider/* copyRequest */.VS)(tx); // Replace any Addressable or ENS name with an address const { to, from } = await (0,properties/* resolveProperties */.k)({ to: (tx.to ? (0,checks/* resolveAddress */.tG)(tx.to, this.provider) : undefined), @@ -69830,7 +100037,7 @@ class BaseWallet extends AbstractSigner { } async signTypedData(domain, types, value) { // Populate any ENS names - const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (name) => { + const populated = await typed_data/* TypedDataEncoder */.z.resolveNames(domain, types, value, async (name) => { // @TODO: this should use resolveName; addresses don't // need a provider (0,errors/* assert */.vA)(this.provider != null, "cannot resolve ENS names without a provider", "UNSUPPORTED_OPERATION", { @@ -69843,15 +100050,15 @@ class BaseWallet extends AbstractSigner { }); return address; }); - return this.signingKey.sign(TypedDataEncoder.hash(populated.domain, types, populated.value)).serialized; + return this.signingKey.sign(typed_data/* TypedDataEncoder */.z.hash(populated.domain, types, populated.value)).serialized; } } //# sourceMappingURL=base-wallet.js.map // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/crypto/sha2.js var sha2 = __webpack_require__(68650); // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/crypto/crypto-browser.js + 1 modules -var crypto_browser = __webpack_require__(8180); -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/crypto/hmac.js +var crypto_browser = __webpack_require__(68682); +;// ./node_modules/ethers/lib.esm/crypto/hmac.js /** * An **HMAC** enables verification that a given key was used * to authenticate a payload. @@ -69862,7 +100069,7 @@ var crypto_browser = __webpack_require__(8180); */ -let hmac_locked = false; +let locked = false; const _computeHmac = function (algorithm, key, data) { return (0,crypto_browser/* createHmac */.Gz)(algorithm, key).update(data).digest(); }; @@ -69890,20 +100097,20 @@ function computeHmac(algorithm, _key, _data) { return (0,utils_data/* hexlify */.c$)(__computeHmac(algorithm, key, data)); } computeHmac._ = _computeHmac; -computeHmac.lock = function () { hmac_locked = true; }; +computeHmac.lock = function () { locked = true; }; computeHmac.register = function (func) { - if (hmac_locked) { + if (locked) { throw new Error("computeHmac is locked"); } __computeHmac = func; }; Object.freeze(computeHmac); //# sourceMappingURL=hmac.js.map -// EXTERNAL MODULE: ./node_modules/ethers/node_modules/@noble/hashes/esm/_sha2.js -var _sha2 = __webpack_require__(37171); -// EXTERNAL MODULE: ./node_modules/ethers/node_modules/@noble/hashes/esm/utils.js + 1 modules -var utils = __webpack_require__(10750); -;// CONCATENATED MODULE: ./node_modules/ethers/node_modules/@noble/hashes/esm/ripemd160.js +// EXTERNAL MODULE: ./node_modules/@noble/hashes/esm/_sha2.js +var _sha2 = __webpack_require__(6800); +// EXTERNAL MODULE: ./node_modules/@noble/hashes/esm/utils.js + 1 modules +var utils = __webpack_require__(32531); +;// ./node_modules/@noble/hashes/esm/ripemd160.js // https://homes.esat.kuleuven.be/~bosselae/ripemd160.html @@ -70008,7 +100215,7 @@ class RIPEMD160 extends _sha2/* SHA2 */.D { */ const ripemd160 = /* @__PURE__ */ (0,utils/* wrapConstructor */.ld)(() => new RIPEMD160()); //# sourceMappingURL=ripemd160.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/crypto/ripemd160.js +;// ./node_modules/ethers/lib.esm/crypto/ripemd160.js let ripemd160_locked = false; @@ -70047,7 +100254,7 @@ ripemd160_ripemd160.register = function (func) { }; Object.freeze(ripemd160_ripemd160); //# sourceMappingURL=ripemd160.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/crypto/random.js +;// ./node_modules/ethers/lib.esm/crypto/random.js /** * A **Cryptographically Secure Random Value** is one that has been * generated with additional care take to prevent side-channels @@ -70082,7 +100289,11 @@ randomBytes.register = function (func) { }; Object.freeze(randomBytes); //# sourceMappingURL=random.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/wordlists/decode-owl.js +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/base58.js +var base58 = __webpack_require__(14132); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/hash/id.js +var id = __webpack_require__(38264); +;// ./node_modules/ethers/lib.esm/wordlists/decode-owl.js const subsChrs = " !#$%&'()*+,-./<=>?@[]^_`{|}~"; const Word = /^[a-z]*$/i; @@ -70138,7 +100349,7 @@ function decodeOwl(data) { return decode(data.substring(1 + 2 * subsChrs.length), data.substring(1, 1 + 2 * subsChrs.length)); } //# sourceMappingURL=decode-owl.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/wordlists/wordlist.js +;// ./node_modules/ethers/lib.esm/wordlists/wordlist.js /** * A Wordlist represents a collection of language-specific @@ -70181,7 +100392,7 @@ class Wordlist { } } //# sourceMappingURL=wordlist.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/wordlists/wordlist-owl.js +;// ./node_modules/ethers/lib.esm/wordlists/wordlist-owl.js // Use the encode-latin.js script to create the necessary // data files to be consumed by this class @@ -70248,7 +100459,7 @@ class WordlistOwl extends Wordlist { } } //# sourceMappingURL=wordlist-owl.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/wordlists/lang-en.js +;// ./node_modules/ethers/lib.esm/wordlists/lang-en.js const words = "0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEwI{etImeIspIt-OpO[Ou^OwdUci$UelUi'Umb!Un^UshYY,$2BeLtu*PPbo?dRiousRr|Rta(R=Sh]/omTe3C!:DMa+MpN)Ng R(gShUght WnY3AlBa>BrisCadeCemb CideCl(eC%a>C*a'ErF&'F(eFyG*eLayLiv M3AgramAlAm#dAryCeE'lEtFf G.$Gn.yLemmaNn NosaurRe@RtSag*eScov Sea'ShSmi[S%d Splay/<)V tVideV%)Zzy5Ct%Cum|G~Lph(Ma(Na>NkeyN%OrSeUb!Ve_ftAg#AmaA,-AwEamE[IftIllInkIpI=OpUmY2CkMbNeR(g/T^Ty1Arf1Nam-:G G!RlyRnR`Sily/Sy1HoOlogyOnomy0GeItUca>1F%t0G1GhtTh 2BowD E@r-EgSe0B?kBodyBra)Er+Ot]PloyPow Pty0Ab!A@DD![D%'EmyErgyF%)Ga+G(eH<)JoyLi,OughR-hRollSu*T Ti*TryVelope1Isode0U$Uip0AA'OdeOs]R%Upt0CapeSayS&)Ta>0Ern$H-s1Id&)IlOkeOl=1A@Amp!Ce[Ch<+C.eCludeCu'Ecu>Erci'Hau,Hib.I!I,ItOt-PM&'Mu}Pa@Po'Pro=Pul'0ChCludeComeC*a'DexD-a>Do%Du,ryFN Noc|PutQuirySSue0Em1Ory:CketGu?RZz3AlousAns~yWel9BInKeUr}yY5D+I)MpNg!Ni%Nk/:Ng?oo3EnEpT^upY3CkDD}yNdNgdomSsTT^&TeTt&Wi4EeIfeO{Ow:BBelB%Dd DyKeMpNgua+PtopR+T T(UghUndryVaWWnWsu.Y Zy3Ad AfArnA=Ctu*FtGG$G&dIsu*M#NdNg`NsOp?dSs#Tt Vel3ArB tyBr?yC&'FeFtGhtKeMbM.NkOnQuid/Tt!VeZ?d5AdAnB, C$CkG-NelyNgOpTt yUdUn+VeY$5CkyGga+Mb N?N^Xury3R-s:Ch(eDG-G}tIdIlInJ%KeMm$NNa+Nda>NgoNs]Nu$P!Rb!R^Rg(R(eRketRria+SkSs/ T^T i$ThTrixTt XimumZe3AdowAnAsu*AtCh<-D$DiaLodyLtMb M%yNt]NuRcyR+R.RryShSsa+T$Thod3Dd!DnightLk~]M-NdNimumN%Nu>Rac!Rr%S ySs/akeXXedXtu*5Bi!DelDifyMM|N.%NkeyN, N`OnR$ReRn(gSqu.oTh T]T%Unta(U'VeVie5ChFf(LeLtiplySc!SeumShroomS-/Tu$3Self/ yTh:I=MePk(Rrow/yT]Tu*3ArCkEdGati=G!@I` PhewR=/TTw%kUtr$V WsXt3CeGht5B!I'M(eeOd!Rm$R`SeTab!TeTh(gTi)VelW5C!?Mb R'T:K0EyJe@Li+Scu*S =Ta(Vious0CurEAyEa'Ed+U{UgUn+2EmEtIntL?LeLi)NdNyOlPul?Rt]S.]Ssib!/TatoTt yV tyWd W _@i)Ai'Ed-tEf Epa*Es|EttyEv|I)IdeIm?yIntI%.yIs#Iva>IzeOb!mO)[Odu)Of.OgramOje@Omo>OofOp tyOsp O>@OudOvide2Bl-Dd(g~LpL'Mpk(N^PilPpyR^a'R.yRpo'R'ShTZz!3Ramid:99Al.yAntumArt E,]I{ItIzO>:Bb.Cco#CeCkD?DioIlInI'~yMpN^NdomN+PidReTeTh V&WZ%3AdyAlAs#BelBuildC$lCei=CipeC%dCyc!Du)F!@F%mFu'G]G*tGul?Je@LaxLea'LiefLyMa(Memb M(dMo=Nd NewNtOp&PairPeatPla)P%tQui*ScueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOgAyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NNGradeHoldOnP Set1BOng::Rd3Ar~ow9UUngU`:3BraRo9NeO"; const checksum = "0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"; @@ -70280,7 +100491,7 @@ class LangEn extends WordlistOwl { } } //# sourceMappingURL=lang-en.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/crypto/pbkdf2.js +;// ./node_modules/ethers/lib.esm/crypto/pbkdf2.js /** * A **Password-Based Key-Derivation Function** is designed to create * a sequence of bytes suitible as a **key** from a human-rememberable @@ -70330,7 +100541,7 @@ pbkdf2.register = function (func) { }; Object.freeze(pbkdf2); //# sourceMappingURL=pbkdf2.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/wallet/mnemonic.js +;// ./node_modules/ethers/lib.esm/wallet/mnemonic.js @@ -70496,7 +100707,7 @@ class Mnemonic { } } //# sourceMappingURL=mnemonic.js.map -;// CONCATENATED MODULE: ./node_modules/aes-js/lib.esm/aes.js +;// ./node_modules/aes-js/lib.esm/aes.js /*! MIT License. Copyright 2015-2022 Richard Moore . See LICENSE.txt. */ var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); @@ -70695,7 +100906,7 @@ class AES { } _AES_key = new WeakMap(), _AES_Kd = new WeakMap(), _AES_Ke = new WeakMap(); //# sourceMappingURL=aes.js.map -;// CONCATENATED MODULE: ./node_modules/aes-js/lib.esm/mode.js +;// ./node_modules/aes-js/lib.esm/mode.js class ModeOfOperation { constructor(name, key, cls) { @@ -70709,7 +100920,7 @@ class ModeOfOperation { } } //# sourceMappingURL=mode.js.map -;// CONCATENATED MODULE: ./node_modules/aes-js/lib.esm/mode-cbc.js +;// ./node_modules/aes-js/lib.esm/mode-cbc.js // Cipher Block Chaining var mode_cbc_classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); @@ -70772,7 +100983,7 @@ class CBC extends ModeOfOperation { } _CBC_iv = new WeakMap(), _CBC_lastBlock = new WeakMap(); //# sourceMappingURL=mode-cbc.js.map -;// CONCATENATED MODULE: ./node_modules/aes-js/lib.esm/mode-cfb.js +;// ./node_modules/aes-js/lib.esm/mode-cfb.js // Cipher Feedback var mode_cfb_classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); @@ -70850,7 +101061,7 @@ _CFB_iv = new WeakMap(), _CFB_shiftRegister = new WeakMap(), _CFB_instances = ne mode_cfb_classPrivateFieldGet(this, _CFB_shiftRegister, "f").set(data.subarray(0, segmentSize), 16 - segmentSize); }; //# sourceMappingURL=mode-cfb.js.map -;// CONCATENATED MODULE: ./node_modules/aes-js/lib.esm/mode-ctr.js +;// ./node_modules/aes-js/lib.esm/mode-ctr.js // Counter Mode var mode_ctr_classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); @@ -70933,7 +101144,7 @@ class CTR extends ModeOfOperation { } _CTR_remaining = new WeakMap(), _CTR_remainingIndex = new WeakMap(), _CTR_counter = new WeakMap(); //# sourceMappingURL=mode-ctr.js.map -;// CONCATENATED MODULE: ./node_modules/aes-js/lib.esm/mode-ecb.js +;// ./node_modules/aes-js/lib.esm/mode-ecb.js // Electronic Code Book class ECB extends ModeOfOperation { @@ -70962,7 +101173,7 @@ class ECB extends ModeOfOperation { } } //# sourceMappingURL=mode-ecb.js.map -;// CONCATENATED MODULE: ./node_modules/aes-js/lib.esm/mode-ofb.js +;// ./node_modules/aes-js/lib.esm/mode-ofb.js // Output Feedback var mode_ofb_classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); @@ -71020,7 +101231,7 @@ class OFB extends ModeOfOperation { } _OFB_iv = new WeakMap(), _OFB_lastPrecipher = new WeakMap(), _OFB_lastPrecipherIndex = new WeakMap(); //# sourceMappingURL=mode-ofb.js.map -;// CONCATENATED MODULE: ./node_modules/aes-js/lib.esm/padding.js +;// ./node_modules/aes-js/lib.esm/padding.js function pkcs7Pad(data) { const padder = 16 - (data.length % 16); const result = new Uint8Array(data.length + padder); @@ -71047,7 +101258,7 @@ function pkcs7Strip(data) { return new Uint8Array(data.subarray(0, length)); } //# sourceMappingURL=padding.js.map -;// CONCATENATED MODULE: ./node_modules/aes-js/lib.esm/index.js +;// ./node_modules/aes-js/lib.esm/index.js @@ -71057,13 +101268,13 @@ function pkcs7Strip(data) { //# sourceMappingURL=index.js.map -// EXTERNAL MODULE: ./node_modules/ethers/node_modules/@noble/hashes/esm/_assert.js -var _assert = __webpack_require__(27125); -// EXTERNAL MODULE: ./node_modules/ethers/node_modules/@noble/hashes/esm/sha256.js -var sha256 = __webpack_require__(3439); -// EXTERNAL MODULE: ./node_modules/ethers/node_modules/@noble/hashes/esm/pbkdf2.js -var esm_pbkdf2 = __webpack_require__(84877); -;// CONCATENATED MODULE: ./node_modules/ethers/node_modules/@noble/hashes/esm/scrypt.js +// EXTERNAL MODULE: ./node_modules/@noble/hashes/esm/_assert.js +var _assert = __webpack_require__(89190); +// EXTERNAL MODULE: ./node_modules/@noble/hashes/esm/sha256.js +var sha256 = __webpack_require__(78226); +// EXTERNAL MODULE: ./node_modules/@noble/hashes/esm/pbkdf2.js +var esm_pbkdf2 = __webpack_require__(2200); +;// ./node_modules/@noble/hashes/esm/scrypt.js @@ -71282,7 +101493,7 @@ async function scryptAsync(password, salt, opts) { return scryptOutput(password, dkLen, B, V, tmp); } //# sourceMappingURL=scrypt.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/crypto/scrypt.js +;// ./node_modules/ethers/lib.esm/crypto/scrypt.js let lockedSync = false, lockedAsync = false; @@ -71382,7 +101593,7 @@ scryptSync.register = function (func) { }; Object.freeze(scryptSync); //# sourceMappingURL=scrypt.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/utils/uuid.js +;// ./node_modules/ethers/lib.esm/utils/uuid.js /** * Explain UUID and link to RFC here. * @@ -71413,7 +101624,7 @@ function uuidV4(randomBytes) { ].join("-"); } //# sourceMappingURL=uuid.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/wallet/utils.js +;// ./node_modules/ethers/lib.esm/wallet/utils.js /** * @_ignore */ @@ -71558,7 +101769,7 @@ export function uuidV4(randomBytes: BytesLike): string { //# sourceMappingURL=utils.js.map // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/_version.js var _version = __webpack_require__(99529); -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/wallet/json-keystore.js +;// ./node_modules/ethers/lib.esm/wallet/json-keystore.js /** * The JSON Wallet formats allow a simple way to store the private * keys needed in Ethereum along with related information and allows @@ -71846,7 +102057,7 @@ async function encryptKeystoreJson(account, password, options) { return _encryptKeystore((0,utils_data/* getBytes */.q5)(key), kdf, account, options); } //# sourceMappingURL=json-keystore.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/wallet/hdwallet.js +;// ./node_modules/ethers/lib.esm/wallet/hdwallet.js /** * Explain HD Wallets.. * @@ -71884,7 +102095,7 @@ function encodeBase58Check(_value) { const value = (0,utils_data/* getBytes */.q5)(_value); const check = (0,utils_data/* dataSlice */.ZG)((0,sha2/* sha256 */.s)((0,sha2/* sha256 */.s)(value)), 0, 4); const bytes = (0,utils_data/* concat */.xW)([value, check]); - return encodeBase58(bytes); + return (0,base58/* encodeBase58 */.R)(bytes); } const hdwallet_guard = {}; function ser_I(index, chainCode, publicKey, privateKey) { @@ -71973,9 +102184,9 @@ class HDNodeWallet extends BaseWallet { /** * The derivation path of this wallet. * - * Since extended keys do not provider full path details, this + * Since extended keys do not provide full path details, this * may be ``null``, if instantiated from a source that does not - * enocde it. + * encode it. */ path; /** @@ -72114,7 +102325,7 @@ class HDNodeWallet extends BaseWallet { * or full HD Node ([[HDNodeWallet) respectively. */ static fromExtendedKey(extendedKey) { - const bytes = (0,maths/* toBeArray */.c4)(decodeBase58(extendedKey)); // @TODO: redact + const bytes = (0,maths/* toBeArray */.c4)((0,base58/* decodeBase58 */.H)(extendedKey)); // @TODO: redact (0,errors/* assertArgument */.MR)(bytes.length === 82 || encodeBase58Check(bytes.slice(0, 78)) === extendedKey, "invalid extended key", "extendedKey", "[ REDACTED ]"); const depth = bytes[4]; const parentFingerprint = (0,utils_data/* hexlify */.c$)(bytes.slice(5, 9)); @@ -72346,7 +102557,7 @@ function getIndexedAccountPath(_index) { return `m/44'/60'/0'/0/${index}`; } //# sourceMappingURL=hdwallet.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/wallet/json-crowdsale.js +;// ./node_modules/ethers/lib.esm/wallet/json-crowdsale.js /** * @_subsection: api/wallet:JSON Wallets [json-wallets] */ @@ -72402,8 +102613,7 @@ function decryptCrowdsaleJson(json, _password) { return { address, privateKey: (0,id.id)(seedHex) }; } //# sourceMappingURL=json-crowdsale.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/wallet/wallet.js -/* provided dependency */ var wallet_console = __webpack_require__(96763); +;// ./node_modules/ethers/lib.esm/wallet/wallet.js @@ -72472,7 +102682,7 @@ class Wallet extends BaseWallet { if (wallet.address === account.address && wallet.privateKey === account.privateKey) { return wallet; } - wallet_console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key"); + console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key"); } const wallet = new Wallet(account.privateKey); (0,errors/* assertArgument */.MR)(wallet.address === account.address, "address/privateKey mismatch", "json", "[ REDACTED ]"); @@ -72548,7 +102758,7 @@ class Wallet extends BaseWallet { } } //# sourceMappingURL=wallet.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/providers/provider-browser.js +;// ./node_modules/ethers/lib.esm/providers/provider-browser.js ; @@ -72563,9 +102773,11 @@ class BrowserProvider extends JsonRpcApiPollingProvider { * Connnect to the %%ethereum%% provider, optionally forcing the * %%network%%. */ - constructor(ethereum, network) { + constructor(ethereum, network, _options) { + // Copy the options + const options = Object.assign({}, ((_options != null) ? _options : {}), { batchMaxCount: 1 }); (0,errors/* assertArgument */.MR)(ethereum && ethereum.request, "invalid EIP-1193 provider", "ethereum", ethereum); - super(network, { batchMaxCount: 1 }); + super(network, options); this.#request = async (method, params) => { const payload = { method, params }; this.emit("debug", { action: "sendEip1193Request", payload }); @@ -72648,64 +102860,14 @@ class BrowserProvider extends JsonRpcApiPollingProvider { } } //# sourceMappingURL=provider-browser.js.map -// EXTERNAL MODULE: ./src/typechain/index.ts + 8 modules -var typechain = __webpack_require__(67276); // EXTERNAL MODULE: ./src/utils.ts var src_utils = __webpack_require__(67418); -// EXTERNAL MODULE: ./src/multicall.ts -var multicall = __webpack_require__(48486); -;// CONCATENATED MODULE: ./src/providers.ts -/* provided dependency */ var providers_console = __webpack_require__(96763); - -var __defProp = Object.defineProperty; -var __defProps = Object.defineProperties; -var __getOwnPropDescs = Object.getOwnPropertyDescriptors; -var __getOwnPropSymbols = Object.getOwnPropertySymbols; -var __getProtoOf = Object.getPrototypeOf; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __propIsEnum = Object.prototype.propertyIsEnumerable; -var __reflectGet = Reflect.get; -var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __spreadValues = (a, b) => { - for (var prop in b || (b = {})) - if (__hasOwnProp.call(b, prop)) - __defNormalProp(a, prop, b[prop]); - if (__getOwnPropSymbols) - for (var prop of __getOwnPropSymbols(b)) { - if (__propIsEnum.call(b, prop)) - __defNormalProp(a, prop, b[prop]); - } - return a; -}; -var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); -var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj); -var __async = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; +;// ./src/providers.ts - -const defaultUserAgent = "Mozilla/5.0 (Windows NT 10.0; rv:109.0) Gecko/20100101 Firefox/115.0"; -const providers_fetch = (browser_ponyfill_default()); +const defaultUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0"; function getHttpAgent({ fetchUrl, proxyUrl, @@ -72732,121 +102894,121 @@ function getHttpAgent({ return new HttpProxyAgent(proxyUrl); } } -function fetchData(_0) { - return __async(this, arguments, function* (url, options = {}) { - var _a, _b, _c; - const MAX_RETRY = (_a = options.maxRetry) != null ? _a : 3; - const RETRY_ON = (_b = options.retryOn) != null ? _b : 500; - const userAgent = (_c = options.userAgent) != null ? _c : defaultUserAgent; - let retry = 0; - let errorObject; - if (!options.method) { - if (!options.body) { - options.method = "GET"; - } else { - options.method = "POST"; - } +async function fetchData(url, options = {}) { + const MAX_RETRY = options.maxRetry ?? 3; + const RETRY_ON = options.retryOn ?? 500; + const userAgent = options.userAgent ?? defaultUserAgent; + const fetch = globalThis.useGlobalFetch ? globalThis.fetch : (browser_ponyfill_default()); + let retry = 0; + let errorObject; + if (!options.method) { + if (!options.body) { + options.method = "GET"; + } else { + options.method = "POST"; } - if (!options.headers) { - options.headers = {}; - } - if (src_utils/* isNode */.Ll && !options.headers["User-Agent"]) { - options.headers["User-Agent"] = userAgent; - } - while (retry < MAX_RETRY + 1) { - let timeout; - if (!options.signal && options.timeout) { - const controller = new AbortController(); - options.signal = controller.signal; - timeout = setTimeout(() => { + } + if (!options.headers) { + options.headers = {}; + } + if (src_utils/* isNode */.Ll && !options.headers["User-Agent"]) { + options.headers["User-Agent"] = userAgent; + } + while (retry < MAX_RETRY + 1) { + let timeout; + if (!options.signal && options.timeout) { + const controller = new AbortController(); + options.signal = controller.signal; + timeout = setTimeout(() => { + controller.abort(); + }, options.timeout); + if (options.cancelSignal) { + if (options.cancelSignal.cancelled) { + throw new Error("request cancelled before sending"); + } + options.cancelSignal.addListener(() => { controller.abort(); - }, options.timeout); - } - if (!options.agent && src_utils/* isNode */.Ll && (options.proxy || options.torPort)) { - options.agent = getHttpAgent({ - fetchUrl: url, - proxyUrl: options.proxy, - torPort: options.torPort, - retry }); } - if (options.debug && typeof options.debug === "function") { - options.debug("request", { - url, - retry, - errorObject, - options - }); - } - try { - const resp = yield providers_fetch(url, { - method: options.method, - headers: options.headers, - body: options.body, - redirect: options.redirect, - signal: options.signal, - agent: options.agent - }); - if (options.debug && typeof options.debug === "function") { - options.debug("response", resp); - } - if (!resp.ok) { - const errMsg = `Request to ${url} failed with error code ${resp.status}: -` + (yield resp.text()); - throw new Error(errMsg); - } - if (options.returnResponse) { - return resp; - } - const contentType = resp.headers.get("content-type"); - if (contentType == null ? void 0 : contentType.includes("application/json")) { - return yield resp.json(); - } - if (contentType == null ? void 0 : contentType.includes("text")) { - return yield resp.text(); - } - return resp; - } catch (error) { - if (timeout) { - clearTimeout(timeout); - } - errorObject = error; - retry++; - yield (0,src_utils/* sleep */.yy)(RETRY_ON); - } finally { - if (timeout) { - clearTimeout(timeout); - } - } + } + if (!options.agent && src_utils/* isNode */.Ll && (options.proxy || options.torPort)) { + options.agent = getHttpAgent({ + fetchUrl: url, + proxyUrl: options.proxy, + torPort: options.torPort, + retry + }); } if (options.debug && typeof options.debug === "function") { - options.debug("error", errorObject); + options.debug("request", { + url, + retry, + errorObject, + options + }); + } + try { + const resp = await fetch(url, { + method: options.method, + headers: options.headers, + body: options.body, + redirect: options.redirect, + signal: options.signal, + agent: options.agent + }); + if (options.debug && typeof options.debug === "function") { + options.debug("response", resp); + } + if (!resp.ok) { + const errMsg = `Request to ${url} failed with error code ${resp.status}: +` + await resp.text(); + throw new Error(errMsg); + } + if (options.returnResponse) { + return resp; + } + const contentType = resp.headers.get("content-type"); + if (contentType?.includes("application/json")) { + return await resp.json(); + } + if (contentType?.includes("text")) { + return await resp.text(); + } + return resp; + } catch (error) { + if (timeout) { + clearTimeout(timeout); + } + errorObject = error; + retry++; + await (0,src_utils/* sleep */.yy)(RETRY_ON); + } finally { + if (timeout) { + clearTimeout(timeout); + } } - throw errorObject; - }); -} -const fetchGetUrlFunc = (options = {}) => (req, _signal) => __async(void 0, null, function* () { - let signal; - if (_signal) { - const controller = new AbortController(); - signal = controller.signal; - _signal.addListener(() => { - controller.abort(); - }); } - const init = __spreadProps(__spreadValues({}, options), { + if (options.debug && typeof options.debug === "function") { + options.debug("error", errorObject); + } + throw errorObject; +} +const fetchGetUrlFunc = (options = {}) => async (req, _signal) => { + const init = { + ...options, method: req.method || "POST", headers: req.headers, body: req.body || void 0, - signal, + timeout: options.timeout || req.timeout, + cancelSignal: _signal, returnResponse: true - }); - const resp = yield fetchData(req.url, init); + }; + const resp = await fetchData(req.url, init); const headers = {}; resp.headers.forEach((value, key) => { headers[key.toLowerCase()] = value; }); - const respBody = yield resp.arrayBuffer(); + const respBody = await resp.arrayBuffer(); const body = respBody == null ? null : new Uint8Array(respBody); return { statusCode: resp.status, @@ -72854,121 +103016,38 @@ const fetchGetUrlFunc = (options = {}) => (req, _signal) => __async(void 0, null headers, body }; -}); -const oracleMapper = /* @__PURE__ */ new Map(); -const multicallMapper = /* @__PURE__ */ new Map(); -function getGasOraclePlugin(networkKey, fetchOptions) { - const gasStationApi = (fetchOptions == null ? void 0 : fetchOptions.gasStationApi) || "https://gasstation.polygon.technology/v2"; - return new FetchUrlFeeDataNetworkPlugin(gasStationApi, (fetchFeeData, provider, request) => __async(this, null, function* () { - if (!oracleMapper.has(networkKey)) { - oracleMapper.set(networkKey, typechain/* GasPriceOracle__factory */.Hu.connect(fetchOptions == null ? void 0 : fetchOptions.gasPriceOracle, provider)); - } - if (!multicallMapper.has(networkKey)) { - multicallMapper.set( - networkKey, - typechain/* Multicall__factory */.Q2.connect("0xcA11bde05977b3631167028862bE2a173976CA11", provider) - ); - } - const Oracle = oracleMapper.get(networkKey); - const Multicall2 = multicallMapper.get(networkKey); - const [timestamp, heartbeat, feePerGas, priorityFeePerGas] = yield (0,multicall/* multicall */.C)(Multicall2, [ - { - contract: Oracle, - name: "timestamp" - }, - { - contract: Oracle, - name: "heartbeat" - }, - { - contract: Oracle, - name: "maxFeePerGas" - }, - { - contract: Oracle, - name: "maxPriorityFeePerGas" - } - ]); - const isOutdated = Number(timestamp) <= Date.now() / 1e3 - Number(heartbeat); - if (!isOutdated) { - const maxPriorityFeePerGas = priorityFeePerGas * BigInt(13) / BigInt(10); - const maxFeePerGas = feePerGas * BigInt(2) + maxPriorityFeePerGas; - return { - gasPrice: maxFeePerGas, - maxFeePerGas, - maxPriorityFeePerGas - }; - } - const fetchReq = new FetchRequest(gasStationApi); - fetchReq.getUrlFunc = fetchGetUrlFunc(fetchOptions); - if (src_utils/* isNode */.Ll) { - fetchReq.setHeader("User-Agent", "ethers"); - } - const [ - { - bodyJson: { fast } - }, - { gasPrice } - ] = yield Promise.all([fetchReq.send(), fetchFeeData()]); - return { - gasPrice, - maxFeePerGas: (0,units/* parseUnits */.XS)(`${fast.maxFee}`, 9), - maxPriorityFeePerGas: (0,units/* parseUnits */.XS)(`${fast.maxPriorityFee}`, 9) - }; - })); -} -function getProvider(rpcUrl, fetchOptions) { - return __async(this, null, function* () { - const fetchReq = new FetchRequest(rpcUrl); - fetchReq.getUrlFunc = fetchGetUrlFunc(fetchOptions); - const _staticNetwork = yield new JsonRpcProvider(fetchReq).getNetwork(); - const ensPlugin = _staticNetwork.getPlugin("org.ethers.plugins.network.Ens"); - const gasCostPlugin = _staticNetwork.getPlugin("org.ethers.plugins.network.GasCost"); - const gasStationPlugin = _staticNetwork.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin"); - const staticNetwork = new Network(_staticNetwork.name, _staticNetwork.chainId); - if (ensPlugin) { - staticNetwork.attachPlugin(ensPlugin); - } - if (gasCostPlugin) { - staticNetwork.attachPlugin(gasCostPlugin); - } - if (fetchOptions == null ? void 0 : fetchOptions.gasPriceOracle) { - staticNetwork.attachPlugin(getGasOraclePlugin(`${_staticNetwork.chainId}_${rpcUrl}`, fetchOptions)); - } else if (gasStationPlugin) { - staticNetwork.attachPlugin(gasStationPlugin); - } - const provider = new JsonRpcProvider(fetchReq, staticNetwork, { - staticNetwork - }); - provider.pollingInterval = (fetchOptions == null ? void 0 : fetchOptions.pollingInterval) || 1e3; - return provider; +}; +async function getProvider(rpcUrl, fetchOptions) { + const fetchReq = new fetch/* FetchRequest */.ui(rpcUrl); + fetchReq.getUrlFunc = fetchGetUrlFunc(fetchOptions); + const staticNetwork = await new JsonRpcProvider(fetchReq).getNetwork(); + const chainId = Number(staticNetwork.chainId); + if (fetchOptions?.netId && fetchOptions.netId !== chainId) { + const errMsg = `Wrong network for ${rpcUrl}, wants ${fetchOptions.netId} got ${chainId}`; + throw new Error(errMsg); + } + return new JsonRpcProvider(fetchReq, staticNetwork, { + staticNetwork, + pollingInterval: fetchOptions?.pollingInterval || 1e3 }); } function getProviderWithNetId(netId, rpcUrl, config, fetchOptions) { - const { networkName, reverseRecordsContract, gasPriceOracleContract, gasStationApi, pollInterval } = config; + const { networkName, reverseRecordsContract, pollInterval } = config; const hasEns = Boolean(reverseRecordsContract); - const fetchReq = new FetchRequest(rpcUrl); + const fetchReq = new fetch/* FetchRequest */.ui(rpcUrl); fetchReq.getUrlFunc = fetchGetUrlFunc(fetchOptions); const staticNetwork = new Network(networkName, netId); if (hasEns) { staticNetwork.attachPlugin(new EnsPlugin(null, Number(netId))); } staticNetwork.attachPlugin(new GasCostPlugin()); - if (gasPriceOracleContract) { - staticNetwork.attachPlugin( - getGasOraclePlugin(`${netId}_${rpcUrl}`, { - gasPriceOracle: gasPriceOracleContract, - gasStationApi - }) - ); - } const provider = new JsonRpcProvider(fetchReq, staticNetwork, { - staticNetwork + staticNetwork, + pollingInterval: fetchOptions?.pollingInterval || pollInterval * 1e3 }); - provider.pollingInterval = (fetchOptions == null ? void 0 : fetchOptions.pollingInterval) || pollInterval * 1e3; return provider; } -const populateTransaction = (signer, tx) => __async(void 0, null, function* () { +const populateTransaction = async (signer, tx) => { const provider = signer.provider; if (!tx.from) { tx.from = signer.address; @@ -72976,147 +103055,126 @@ const populateTransaction = (signer, tx) => __async(void 0, null, function* () { const errMsg = `populateTransaction: signer mismatch for tx, wants ${tx.from} have ${signer.address}`; throw new Error(errMsg); } - const [feeData, nonce] = yield Promise.all([ - (() => __async(void 0, null, function* () { - if (tx.maxFeePerGas && tx.maxPriorityFeePerGas) { - return new providers_provider/* FeeData */.J9(null, BigInt(tx.maxFeePerGas), BigInt(tx.maxPriorityFeePerGas)); - } - if (tx.gasPrice) { - return new providers_provider/* FeeData */.J9(BigInt(tx.gasPrice), null, null); - } - const fetchedFeeData = yield provider.getFeeData(); - if (fetchedFeeData.maxFeePerGas && fetchedFeeData.maxPriorityFeePerGas) { - return new providers_provider/* FeeData */.J9( - null, - fetchedFeeData.maxFeePerGas * (BigInt(1e4) + BigInt(signer.gasPriceBump)) / BigInt(1e4), - fetchedFeeData.maxPriorityFeePerGas - ); - } else { - return new providers_provider/* FeeData */.J9( - fetchedFeeData.gasPrice * (BigInt(1e4) + BigInt(signer.gasPriceBump)) / BigInt(1e4), - null, - null - ); - } - }))(), - (() => __async(void 0, null, function* () { - if (tx.nonce) { - return tx.nonce; - } - let fetchedNonce = yield provider.getTransactionCount(signer.address, "pending"); - if (signer.bumpNonce && signer.nonce && signer.nonce >= fetchedNonce) { - providers_console.log( - `populateTransaction: bumping nonce from ${fetchedNonce} to ${fetchedNonce + 1} for ${signer.address}` - ); - fetchedNonce++; - } - return fetchedNonce; - }))() + const [feeData, nonce] = await Promise.all([ + tx.maxFeePerGas || tx.gasPrice ? void 0 : provider.getFeeData(), + tx.nonce ? void 0 : provider.getTransactionCount(signer.address, "pending") ]); - tx.nonce = nonce; - if (feeData.maxFeePerGas && feeData.maxPriorityFeePerGas) { - tx.maxFeePerGas = feeData.maxFeePerGas; - tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; - if (!tx.type) { - tx.type = 2; - } - delete tx.gasPrice; - } else if (feeData.gasPrice) { - tx.gasPrice = feeData.gasPrice; - if (!tx.type) { - tx.type = 0; - } - delete tx.maxFeePerGas; - delete tx.maxPriorityFeePerGas; - } - tx.gasLimit = tx.gasLimit || (yield (() => __async(void 0, null, function* () { - try { - const gasLimit = yield provider.estimateGas(tx); - return gasLimit === BigInt(21e3) ? gasLimit : gasLimit * (BigInt(1e4) + BigInt(signer.gasLimitBump)) / BigInt(1e4); - } catch (err) { - if (signer.gasFailover) { - providers_console.log("populateTransaction: warning gas estimation failed falling back to 3M gas"); - return BigInt("3000000"); + if (feeData) { + if (feeData.maxFeePerGas) { + if (!tx.type) { + tx.type = 2; } - throw err; + tx.maxFeePerGas = feeData.maxFeePerGas * (BigInt(1e4) + BigInt(signer.gasPriceBump)) / BigInt(1e4); + tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + delete tx.gasPrice; + } else if (feeData.gasPrice) { + if (!tx.type) { + tx.type = 0; + } + tx.gasPrice = feeData.gasPrice; + delete tx.maxFeePerGas; + delete tx.maxPriorityFeePerGas; } - }))()); + } + if (nonce) { + tx.nonce = nonce; + } + if (!tx.gasLimit) { + try { + const gasLimit = await provider.estimateGas(tx); + tx.gasLimit = gasLimit === BigInt(21e3) ? gasLimit : gasLimit * (BigInt(1e4) + BigInt(signer.gasLimitBump)) / BigInt(1e4); + } catch (error) { + if (signer.gasFailover) { + console.log("populateTransaction: warning gas estimation failed falling back to 3M gas"); + tx.gasLimit = BigInt("3000000"); + } else { + throw error; + } + } + } return tx; -}); +}; class TornadoWallet extends Wallet { + nonce; + gasPriceBump; + gasLimitBump; + gasFailover; + bumpNonce; constructor(key, provider, { gasPriceBump, gasLimitBump, gasFailover, bumpNonce } = {}) { super(key, provider); - this.gasPriceBump = gasPriceBump != null ? gasPriceBump : 1e3; - this.gasLimitBump = gasLimitBump != null ? gasLimitBump : 3e3; - this.gasFailover = gasFailover != null ? gasFailover : false; - this.bumpNonce = bumpNonce != null ? bumpNonce : false; + this.gasPriceBump = gasPriceBump ?? 0; + this.gasLimitBump = gasLimitBump ?? 3e3; + this.gasFailover = gasFailover ?? false; + this.bumpNonce = bumpNonce ?? false; } static fromMnemonic(mneomnic, provider, index = 0, options) { const defaultPath = `m/44'/60'/0'/0/${index}`; const { privateKey } = HDNodeWallet.fromPhrase(mneomnic, void 0, defaultPath); return new TornadoWallet(privateKey, provider, options); } - populateTransaction(tx) { - return __async(this, null, function* () { - const txObject = yield populateTransaction(this, tx); - this.nonce = txObject.nonce; - return __superGet(TornadoWallet.prototype, this, "populateTransaction").call(this, txObject); - }); + async populateTransaction(tx) { + const txObject = await populateTransaction(this, tx); + this.nonce = Number(txObject.nonce); + return super.populateTransaction(txObject); } } class TornadoVoidSigner extends VoidSigner { + nonce; + gasPriceBump; + gasLimitBump; + gasFailover; + bumpNonce; constructor(address, provider, { gasPriceBump, gasLimitBump, gasFailover, bumpNonce } = {}) { super(address, provider); - this.gasPriceBump = gasPriceBump != null ? gasPriceBump : 1e3; - this.gasLimitBump = gasLimitBump != null ? gasLimitBump : 3e3; - this.gasFailover = gasFailover != null ? gasFailover : false; - this.bumpNonce = bumpNonce != null ? bumpNonce : false; + this.gasPriceBump = gasPriceBump ?? 0; + this.gasLimitBump = gasLimitBump ?? 3e3; + this.gasFailover = gasFailover ?? false; + this.bumpNonce = bumpNonce ?? false; } - populateTransaction(tx) { - return __async(this, null, function* () { - const txObject = yield populateTransaction(this, tx); - this.nonce = txObject.nonce; - return __superGet(TornadoVoidSigner.prototype, this, "populateTransaction").call(this, txObject); - }); + async populateTransaction(tx) { + const txObject = await populateTransaction(this, tx); + this.nonce = Number(txObject.nonce); + return super.populateTransaction(txObject); } } class TornadoRpcSigner extends JsonRpcSigner { + nonce; + gasPriceBump; + gasLimitBump; + gasFailover; + bumpNonce; constructor(provider, address, { gasPriceBump, gasLimitBump, gasFailover, bumpNonce } = {}) { super(provider, address); - this.gasPriceBump = gasPriceBump != null ? gasPriceBump : 1e3; - this.gasLimitBump = gasLimitBump != null ? gasLimitBump : 3e3; - this.gasFailover = gasFailover != null ? gasFailover : false; - this.bumpNonce = bumpNonce != null ? bumpNonce : false; + this.gasPriceBump = gasPriceBump ?? 0; + this.gasLimitBump = gasLimitBump ?? 3e3; + this.gasFailover = gasFailover ?? false; + this.bumpNonce = bumpNonce ?? false; } - sendUncheckedTransaction(tx) { - return __async(this, null, function* () { - return __superGet(TornadoRpcSigner.prototype, this, "sendUncheckedTransaction").call(this, yield populateTransaction(this, tx)); - }); + async sendUncheckedTransaction(tx) { + return super.sendUncheckedTransaction(await populateTransaction(this, tx)); } } class TornadoBrowserProvider extends BrowserProvider { + options; constructor(ethereum, network, options) { super(ethereum, network); this.options = options; } - getSigner(address) { - return __async(this, null, function* () { - var _a, _b, _c, _d, _e, _f, _g, _h, _i; - const signerAddress = (yield __superGet(TornadoBrowserProvider.prototype, this, "getSigner").call(this, address)).address; - if (((_a = this.options) == null ? void 0 : _a.webChainId) && ((_b = this.options) == null ? void 0 : _b.connectWallet) && Number(yield __superGet(TornadoBrowserProvider.prototype, this, "send").call(this, "eth_chainId", [])) !== Number((_c = this.options) == null ? void 0 : _c.webChainId)) { - yield this.options.connectWallet(); - } - if ((_d = this.options) == null ? void 0 : _d.handleNetworkChanges) { - (_e = window == null ? void 0 : window.ethereum) == null ? void 0 : _e.on("chainChanged", this.options.handleNetworkChanges); - } - if ((_f = this.options) == null ? void 0 : _f.handleAccountChanges) { - (_g = window == null ? void 0 : window.ethereum) == null ? void 0 : _g.on("accountsChanged", this.options.handleAccountChanges); - } - if ((_h = this.options) == null ? void 0 : _h.handleAccountDisconnect) { - (_i = window == null ? void 0 : window.ethereum) == null ? void 0 : _i.on("disconnect", this.options.handleAccountDisconnect); - } - return new TornadoRpcSigner(this, signerAddress, this.options); - }); + async getSigner(address) { + const signerAddress = (await super.getSigner(address)).address; + if (this.options?.netId && this.options?.connectWallet && Number(await super.send("net_version", [])) !== this.options?.netId) { + await this.options.connectWallet(this.options?.netId); + } + if (this.options?.handleNetworkChanges) { + window?.ethereum?.on("chainChanged", this.options.handleNetworkChanges); + } + if (this.options?.handleAccountChanges) { + window?.ethereum?.on("accountsChanged", this.options.handleAccountChanges); + } + if (this.options?.handleAccountDisconnect) { + window?.ethereum?.on("disconnect", this.options.handleAccountDisconnect); + } + return new TornadoRpcSigner(this, signerAddress, this.options); } } @@ -73128,92 +103186,40 @@ class TornadoBrowserProvider extends BrowserProvider { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ KN: () => (/* binding */ MAX_FEE), /* harmony export */ OR: () => (/* binding */ RelayerClient), +/* harmony export */ Ss: () => (/* binding */ MIN_FEE), /* harmony export */ XF: () => (/* binding */ getSupportedInstances), /* harmony export */ c$: () => (/* binding */ getWeightRandom), -/* harmony export */ mU: () => (/* binding */ isRelayerUpdated), /* harmony export */ pO: () => (/* binding */ MIN_STAKE_BALANCE), -/* harmony export */ qo: () => (/* binding */ parseSemanticVersion), /* harmony export */ sN: () => (/* binding */ pickWeightedRandomRelayer), /* harmony export */ zy: () => (/* binding */ calculateScore) /* harmony export */ }); /* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(99770); /* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(30031); -/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(64563); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67418); /* harmony import */ var _networkConfig__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(59499); -/* harmony import */ var _providers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(68434); -/* harmony import */ var _schemas__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7613); -/* provided dependency */ var console = __webpack_require__(96763); - -var __defProp = Object.defineProperty; -var __defProps = Object.defineProperties; -var __getOwnPropDescs = Object.getOwnPropertyDescriptors; -var __getOwnPropSymbols = Object.getOwnPropertySymbols; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __propIsEnum = Object.prototype.propertyIsEnumerable; -var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __spreadValues = (a, b) => { - for (var prop in b || (b = {})) - if (__hasOwnProp.call(b, prop)) - __defNormalProp(a, prop, b[prop]); - if (__getOwnPropSymbols) - for (var prop of __getOwnPropSymbols(b)) { - if (__propIsEnum.call(b, prop)) - __defNormalProp(a, prop, b[prop]); - } - return a; -}; -var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); -var __async = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; +/* harmony import */ var _providers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(46170); +/* harmony import */ var _schemas__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(59511); + +const MIN_FEE = 0.1; +const MAX_FEE = 0.9; const MIN_STAKE_BALANCE = (0,ethers__WEBPACK_IMPORTED_MODULE_4__/* .parseEther */ .g5)("500"); -const semVerRegex = new RegExp("^(?0|[1-9]\\d*)\\.(?0|[1-9]\\d*)\\.(?0|[1-9]\\d*)(?:-(?(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+(?[0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"); -function parseSemanticVersion(version) { - const { groups } = semVerRegex.exec(version); - return groups; -} -function isRelayerUpdated(relayerVersion, netId) { - const { major, patch, prerelease } = parseSemanticVersion(relayerVersion); - const requiredMajor = netId === _networkConfig__WEBPACK_IMPORTED_MODULE_1__/* .NetId */ .zr.MAINNET ? "4" : "5"; - const isUpdatedMajor = major === requiredMajor; - if (prerelease) - return false; - return isUpdatedMajor && (Number(patch) >= 5 || netId !== _networkConfig__WEBPACK_IMPORTED_MODULE_1__/* .NetId */ .zr.MAINNET); -} -function calculateScore({ stakeBalance, tornadoServiceFee }, minFee = 0.33, maxFee = 0.53) { - if (tornadoServiceFee < minFee) { - tornadoServiceFee = minFee; - } else if (tornadoServiceFee >= maxFee) { +function calculateScore({ stakeBalance, tornadoServiceFee }) { + if (tornadoServiceFee < MIN_FEE) { + tornadoServiceFee = MIN_FEE; + } else if (tornadoServiceFee >= MAX_FEE) { return BigInt(0); } - const serviceFeeCoefficient = (tornadoServiceFee - minFee) ** 2; - const feeDiffCoefficient = 1 / (maxFee - minFee) ** 2; + const serviceFeeCoefficient = (tornadoServiceFee - MIN_FEE) ** 2; + const feeDiffCoefficient = 1 / (MAX_FEE - MIN_FEE) ** 2; const coefficientsMultiplier = 1 - feeDiffCoefficient * serviceFeeCoefficient; - return BigInt(Math.floor(Number(stakeBalance) * coefficientsMultiplier)); + return BigInt(Math.floor(Number(stakeBalance || "0") * coefficientsMultiplier)); } function getWeightRandom(weightsScores, random) { for (let i = 0; i < weightsScores.length; i++) { @@ -73230,239 +103236,595 @@ function getSupportedInstances(instanceList) { }).flat(); return rawList.map((l) => (0,ethers__WEBPACK_IMPORTED_MODULE_5__/* .getAddress */ .b)(l)); } -function pickWeightedRandomRelayer(relayers, netId) { - let minFee, maxFee; - if (netId !== _networkConfig__WEBPACK_IMPORTED_MODULE_1__/* .NetId */ .zr.MAINNET) { - minFee = 0.01; - maxFee = 0.3; - } - const weightsScores = relayers.map((el) => calculateScore(el, minFee, maxFee)); +function pickWeightedRandomRelayer(relayers) { + const weightsScores = relayers.map((el) => calculateScore(el)); const totalWeight = weightsScores.reduce((acc, curr) => { return acc = acc + curr; }, BigInt("0")); - const random = BigInt(Number(totalWeight) * Math.random()); + const random = BigInt(Math.floor(Number(totalWeight) * Math.random())); const weightRandomIndex = getWeightRandom(weightsScores, random); return relayers[weightRandomIndex]; } class RelayerClient { - constructor({ netId, config, Aggregator, fetchDataOptions: fetchDataOptions2 }) { + netId; + config; + selectedRelayer; + fetchDataOptions; + tovarish; + constructor({ netId, config, fetchDataOptions: fetchDataOptions2 }) { this.netId = netId; this.config = config; - this.Aggregator = Aggregator; this.fetchDataOptions = fetchDataOptions2; + this.tovarish = false; } - askRelayerStatus(_0) { - return __async(this, arguments, function* ({ - hostname, - relayerAddress - }) { - var _a, _b; - const url = `https://${!hostname.endsWith("/") ? hostname + "/" : hostname}`; - const rawStatus = yield (0,_providers__WEBPACK_IMPORTED_MODULE_2__/* .fetchData */ .Fd)(`${url}status`, __spreadProps(__spreadValues({}, this.fetchDataOptions), { - headers: { - "Content-Type": "application/json, application/x-www-form-urlencoded" - }, - timeout: ((_a = this.fetchDataOptions) == null ? void 0 : _a.torPort) ? 1e4 : 3e3, - maxRetry: ((_b = this.fetchDataOptions) == null ? void 0 : _b.torPort) ? 2 : 0 - })); - const statusValidator = _schemas__WEBPACK_IMPORTED_MODULE_3__/* .ajv */ .SS.compile((0,_schemas__WEBPACK_IMPORTED_MODULE_3__/* .getStatusSchema */ .c_)(this.netId, this.config)); - if (!statusValidator(rawStatus)) { - throw new Error("Invalid status schema"); - } - const status = __spreadProps(__spreadValues({}, rawStatus), { - url - }); - if (status.currentQueue > 5) { - throw new Error("Withdrawal queue is overloaded"); - } - if (status.netId !== this.netId) { - throw new Error("This relayer serves a different network"); - } - if (relayerAddress && this.netId === _networkConfig__WEBPACK_IMPORTED_MODULE_1__/* .NetId */ .zr.MAINNET && status.rewardAccount !== relayerAddress) { - throw new Error("The Relayer reward address must match registered address"); - } - if (!isRelayerUpdated(status.version, this.netId)) { - throw new Error("Outdated version."); - } - return status; + async askRelayerStatus({ + hostname, + url, + relayerAddress + }) { + if (!url && hostname) { + url = `https://${!hostname.endsWith("/") ? hostname + "/" : hostname}`; + } else if (url && !url.endsWith("/")) { + url += "/"; + } else { + url = ""; + } + const rawStatus = await (0,_providers__WEBPACK_IMPORTED_MODULE_2__/* .fetchData */ .Fd)(`${url}status`, { + ...this.fetchDataOptions, + headers: { + "Content-Type": "application/json, application/x-www-form-urlencoded" + }, + timeout: 3e4, + maxRetry: this.fetchDataOptions?.torPort ? 2 : 0 }); + const statusValidator = _schemas__WEBPACK_IMPORTED_MODULE_3__/* .ajv */ .SS.compile((0,_schemas__WEBPACK_IMPORTED_MODULE_3__/* .getStatusSchema */ .c_)(this.netId, this.config, this.tovarish)); + if (!statusValidator(rawStatus)) { + throw new Error("Invalid status schema"); + } + const status = { + ...rawStatus, + url + }; + if (status.currentQueue > 5) { + throw new Error("Withdrawal queue is overloaded"); + } + if (status.netId !== this.netId) { + throw new Error("This relayer serves a different network"); + } + if (relayerAddress && this.netId === _networkConfig__WEBPACK_IMPORTED_MODULE_1__/* .NetId */ .zr.MAINNET && status.rewardAccount !== relayerAddress) { + throw new Error("The Relayer reward address must match registered address"); + } + return status; } - filterRelayer(curr, relayer, subdomains, debugRelayer = false) { - return __async(this, null, function* () { - var _a; - const { relayerEnsSubdomain } = this.config; - const subdomainIndex = subdomains.indexOf(relayerEnsSubdomain); - const mainnetSubdomain = curr.records[0]; - const hostname = curr.records[subdomainIndex]; - const isHostWithProtocol = hostname.includes("http"); - const { owner, balance: stakeBalance, isRegistered } = curr; - const { ensName, relayerAddress } = relayer; - const isOwner = !relayerAddress || relayerAddress === owner; - const hasMinBalance = stakeBalance >= MIN_STAKE_BALANCE; - const preCondition = hostname && isOwner && mainnetSubdomain && isRegistered && hasMinBalance && !isHostWithProtocol; - if (preCondition || debugRelayer) { - try { - const status = yield this.askRelayerStatus({ hostname, relayerAddress }); - return { - netId: status.netId, - url: status.url, - hostname, - ensName, - stakeBalance, - relayerAddress, - rewardAccount: (0,ethers__WEBPACK_IMPORTED_MODULE_5__/* .getAddress */ .b)(status.rewardAccount), - instances: getSupportedInstances(status.instances), - gasPrice: (_a = status.gasPrices) == null ? void 0 : _a.fast, - ethPrices: status.ethPrices, - currentQueue: status.currentQueue, - tornadoServiceFee: status.tornadoServiceFee - }; - } catch (err) { - if (debugRelayer) { - throw err; - } - return { - hostname, - relayerAddress, - errorMessage: err.message - }; - } - } else { - if (debugRelayer) { - const errMsg = `Relayer ${hostname} condition not met`; - throw new Error(errMsg); - } - return { - hostname, - relayerAddress, - errorMessage: `Relayer ${hostname} condition not met` - }; - } - }); - } - getValidRelayers(relayers, subdomains, debugRelayer = false) { - return __async(this, null, function* () { - const relayersSet = /* @__PURE__ */ new Set(); - const uniqueRelayers = relayers.reverse().filter(({ ensName }) => { - if (!relayersSet.has(ensName)) { - relayersSet.add(ensName); - return true; - } - return false; + async filterRelayer(relayer) { + const hostname = relayer.hostnames[this.netId]; + const { ensName, relayerAddress } = relayer; + if (!hostname) { + return; + } + try { + const status = await this.askRelayerStatus({ + hostname, + relayerAddress }); - const relayerNameHashes = uniqueRelayers.map((r) => (0,ethers__WEBPACK_IMPORTED_MODULE_6__/* .namehash */ .kM)(r.ensName)); - const relayersData = yield this.Aggregator.relayersData.staticCall(relayerNameHashes, subdomains); - const invalidRelayers = []; - const validRelayers = (yield Promise.all( - relayersData.map((curr, index) => this.filterRelayer(curr, uniqueRelayers[index], subdomains, debugRelayer)) - )).filter((r) => { - if (r.errorMessage) { + return { + netId: status.netId, + url: status.url, + hostname, + ensName, + relayerAddress, + rewardAccount: (0,ethers__WEBPACK_IMPORTED_MODULE_5__/* .getAddress */ .b)(status.rewardAccount), + instances: getSupportedInstances(status.instances), + stakeBalance: relayer.stakeBalance, + gasPrice: status.gasPrices?.fast, + ethPrices: status.ethPrices, + currentQueue: status.currentQueue, + tornadoServiceFee: status.tornadoServiceFee + }; + } catch (err) { + return { + hostname, + relayerAddress, + errorMessage: err.message, + hasError: true + }; + } + } + async getValidRelayers(relayers) { + const invalidRelayers = []; + const validRelayers = (await Promise.all(relayers.map((relayer) => this.filterRelayer(relayer)))).filter( + (r) => { + if (!r) { + return false; + } + if (r.hasError) { invalidRelayers.push(r); return false; } return true; - }); - return { - validRelayers, - invalidRelayers - }; - }); + } + ); + return { + validRelayers, + invalidRelayers + }; } pickWeightedRandomRelayer(relayers) { - return pickWeightedRandomRelayer(relayers, this.netId); + return pickWeightedRandomRelayer(relayers); } - tornadoWithdraw(_0) { - return __async(this, arguments, function* ({ contract, proof, args }) { - const { url } = this.selectedRelayer; - const withdrawResponse = yield (0,_providers__WEBPACK_IMPORTED_MODULE_2__/* .fetchData */ .Fd)(`${url}v1/tornadoWithdraw`, __spreadProps(__spreadValues({}, this.fetchDataOptions), { - method: "POST", + async tornadoWithdraw({ contract, proof, args }, callback) { + const { url } = this.selectedRelayer; + const withdrawResponse = await (0,_providers__WEBPACK_IMPORTED_MODULE_2__/* .fetchData */ .Fd)(`${url}v1/tornadoWithdraw`, { + ...this.fetchDataOptions, + method: "POST", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify({ + contract, + proof, + args + }) + }); + const { id, error } = withdrawResponse; + if (error) { + throw new Error(error); + } + const jobValidator = _schemas__WEBPACK_IMPORTED_MODULE_3__/* .ajv */ .SS.compile(_schemas__WEBPACK_IMPORTED_MODULE_3__/* .jobRequestSchema */ .Yq); + if (!jobValidator(withdrawResponse)) { + const errMsg = `${url}v1/tornadoWithdraw has an invalid job response`; + throw new Error(errMsg); + } + if (typeof callback === "function") { + callback(withdrawResponse); + } + let relayerStatus; + const jobUrl = `${url}v1/jobs/${id}`; + console.log(`Job submitted: ${jobUrl} +`); + while (!relayerStatus || !["FAILED", "CONFIRMED"].includes(relayerStatus)) { + const jobResponse = await (0,_providers__WEBPACK_IMPORTED_MODULE_2__/* .fetchData */ .Fd)(jobUrl, { + ...this.fetchDataOptions, + method: "GET", headers: { "Content-Type": "application/json" - }, - body: JSON.stringify({ - contract, - proof, - args - }) - })); - const { id, error } = withdrawResponse; - if (error) { + } + }); + if (jobResponse.error) { throw new Error(error); } - let relayerStatus; - const jobUrl = `${url}v1/jobs/${id}`; - console.log(`Job submitted: ${jobUrl} -`); - while (!relayerStatus || !["FAILED", "CONFIRMED"].includes(relayerStatus)) { - const jobResponse = yield (0,_providers__WEBPACK_IMPORTED_MODULE_2__/* .fetchData */ .Fd)(jobUrl, __spreadProps(__spreadValues({}, this.fetchDataOptions), { - method: "GET", - headers: { - "Content-Type": "application/json" - } - })); - if (jobResponse.error) { - throw new Error(error); - } - const jobValidator = _schemas__WEBPACK_IMPORTED_MODULE_3__/* .ajv */ .SS.compile(_schemas__WEBPACK_IMPORTED_MODULE_3__/* .jobsSchema */ .Us); - if (!jobValidator(jobResponse)) { - const errMsg = `${jobUrl} has an invalid job response`; - throw new Error(errMsg); - } - const { status, txHash, confirmations, failedReason } = jobResponse; - if (relayerStatus !== status) { - if (status === "FAILED") { - const errMsg = `Job ${status}: ${jobUrl} failed reason: ${failedReason}`; - throw new Error(errMsg); - } else if (status === "SENT") { - console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash} -`); - } else if (status === "MINED") { - console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash}, confirmations: ${confirmations} -`); - } else if (status === "CONFIRMED") { - console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash}, confirmations: ${confirmations} -`); - } else { - console.log(`Job ${status}: ${jobUrl} -`); - } - relayerStatus = status; - } - yield (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .sleep */ .yy)(3e3); + const jobValidator2 = _schemas__WEBPACK_IMPORTED_MODULE_3__/* .ajv */ .SS.compile(_schemas__WEBPACK_IMPORTED_MODULE_3__/* .jobsSchema */ .Us); + if (!jobValidator2(jobResponse)) { + const errMsg = `${jobUrl} has an invalid job response`; + throw new Error(errMsg); } - }); + const { status, txHash, confirmations, failedReason } = jobResponse; + if (relayerStatus !== status) { + if (status === "FAILED") { + const errMsg = `Job ${status}: ${jobUrl} failed reason: ${failedReason}`; + throw new Error(errMsg); + } else if (status === "SENT") { + console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash} +`); + } else if (status === "MINED") { + console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash}, confirmations: ${confirmations} +`); + } else if (status === "CONFIRMED") { + console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash}, confirmations: ${confirmations} +`); + } else { + console.log(`Job ${status}: ${jobUrl} +`); + } + relayerStatus = status; + if (typeof callback === "function") { + callback(jobResponse); + } + } + await (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .sleep */ .yy)(3e3); + } } } /***/ }), -/***/ 7613: +/***/ 59511: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { - SS: () => (/* binding */ schemas_ajv), + SC: () => (/* reexport */ addressSchemaType), + SS: () => (/* reexport */ ajv_ajv), + iL: () => (/* reexport */ bnSchemaType), + i1: () => (/* reexport */ bytes32BNSchemaType), + yF: () => (/* reexport */ bytes32SchemaType), + CI: () => (/* reexport */ depositsEventsSchema), + ME: () => (/* reexport */ echoEventsSchema), + XW: () => (/* reexport */ encryptedNotesSchema), + ZC: () => (/* reexport */ getEventsSchemaValidator), c_: () => (/* reexport */ getStatusSchema), - Us: () => (/* reexport */ jobsSchema) + FR: () => (/* reexport */ governanceEventsSchema), + Yq: () => (/* reexport */ jobRequestSchema), + Us: () => (/* reexport */ jobsSchema), + Y6: () => (/* reexport */ proofSchemaType), + cl: () => (/* reexport */ relayerRegistryEventsSchema), + Fz: () => (/* reexport */ stakeBurnedEventsSchema), + U7: () => (/* reexport */ tornadoEventsSchema), + $j: () => (/* reexport */ withdrawalsEventsSchema) }); // EXTERNAL MODULE: ./node_modules/ajv/dist/ajv.js var ajv = __webpack_require__(63282); var ajv_default = /*#__PURE__*/__webpack_require__.n(ajv); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/address/checks.js +var checks = __webpack_require__(41442); +;// ./src/schemas/ajv.ts + + + +const ajv_ajv = new (ajv_default())({ allErrors: true }); +ajv_ajv.addKeyword({ + keyword: "BN", + // eslint-disable-next-line @typescript-eslint/no-explicit-any + validate: (schema, data) => { + try { + BigInt(data); + return true; + } catch { + return false; + } + }, + errors: true +}); +ajv_ajv.addKeyword({ + keyword: "isAddress", + // eslint-disable-next-line @typescript-eslint/no-explicit-any + validate: (schema, data) => { + try { + return (0,checks/* isAddress */.PW)(data); + } catch { + return false; + } + }, + errors: true +}); + +;// ./src/schemas/types.ts + +const addressSchemaType = { + type: "string", + pattern: "^0x[a-fA-F0-9]{40}$", + isAddress: true +}; +const bnSchemaType = { type: "string", BN: true }; +const proofSchemaType = { + type: "string", + pattern: "^0x[a-fA-F0-9]{512}$" +}; +const bytes32SchemaType = { + type: "string", + pattern: "^0x[a-fA-F0-9]{64}$" +}; +const bytes32BNSchemaType = { ...bytes32SchemaType, BN: true }; + +;// ./src/schemas/events.ts + + + +const baseEventsSchemaProperty = { + blockNumber: { + type: "number" + }, + logIndex: { + type: "number" + }, + transactionHash: bytes32SchemaType +}; +const baseEventsSchemaRequired = Object.keys(baseEventsSchemaProperty); +const governanceEventsSchema = { + type: "array", + items: { + anyOf: [ + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + id: { type: "number" }, + proposer: addressSchemaType, + target: addressSchemaType, + startTime: { type: "number" }, + endTime: { type: "number" }, + description: { type: "string" } + }, + required: [ + ...baseEventsSchemaRequired, + "event", + "id", + "proposer", + "target", + "startTime", + "endTime", + "description" + ], + additionalProperties: false + }, + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + proposalId: { type: "number" }, + voter: addressSchemaType, + support: { type: "boolean" }, + votes: { type: "string" }, + from: addressSchemaType, + input: { type: "string" } + }, + required: [ + ...baseEventsSchemaRequired, + "event", + "proposalId", + "voter", + "support", + "votes", + "from", + "input" + ], + additionalProperties: false + }, + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + account: addressSchemaType, + delegateTo: addressSchemaType + }, + required: [...baseEventsSchemaRequired, "account", "delegateTo"], + additionalProperties: false + }, + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + account: addressSchemaType, + delegateFrom: addressSchemaType + }, + required: [...baseEventsSchemaRequired, "account", "delegateFrom"], + additionalProperties: false + } + ] + } +}; +const relayerRegistryEventsSchema = { + type: "array", + items: { + anyOf: [ + // RelayerRegisteredEvents + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + ensName: { type: "string" }, + relayerAddress: addressSchemaType, + ensHash: { type: "string" }, + stakedAmount: { type: "string" } + }, + required: [ + ...baseEventsSchemaRequired, + "event", + "ensName", + "relayerAddress", + "ensHash", + "stakedAmount" + ], + additionalProperties: false + }, + // RelayerUnregisteredEvents + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + relayerAddress: addressSchemaType + }, + required: [...baseEventsSchemaRequired, "event", "relayerAddress"], + additionalProperties: false + }, + // WorkerRegisteredEvents & WorkerUnregisteredEvents + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + relayerAddress: addressSchemaType, + workerAddress: addressSchemaType + }, + required: [...baseEventsSchemaRequired, "event", "relayerAddress", "workerAddress"], + additionalProperties: false + } + ] + } +}; +const stakeBurnedEventsSchema = { + type: "array", + items: { + type: "object", + properties: { + ...baseEventsSchemaProperty, + relayerAddress: addressSchemaType, + amountBurned: bnSchemaType, + instanceAddress: addressSchemaType, + gasFee: bnSchemaType, + relayerFee: bnSchemaType, + timestamp: { type: "number" } + }, + required: [ + ...baseEventsSchemaRequired, + "relayerAddress", + "amountBurned", + "instanceAddress", + "gasFee", + "relayerFee", + "timestamp" + ], + additionalProperties: false + } +}; +const depositsEventsSchema = { + type: "array", + items: { + type: "object", + properties: { + ...baseEventsSchemaProperty, + commitment: bytes32SchemaType, + leafIndex: { type: "number" }, + timestamp: { type: "number" }, + from: addressSchemaType + }, + required: [...baseEventsSchemaRequired, "commitment", "leafIndex", "timestamp", "from"], + additionalProperties: false + } +}; +const withdrawalsEventsSchema = { + type: "array", + items: { + type: "object", + properties: { + ...baseEventsSchemaProperty, + nullifierHash: bytes32SchemaType, + to: addressSchemaType, + fee: bnSchemaType, + timestamp: { type: "number" } + }, + required: [...baseEventsSchemaRequired, "nullifierHash", "to", "fee", "timestamp"], + additionalProperties: false + } +}; +const tornadoEventsSchema = { + type: "array", + items: { + anyOf: [ + // depositsEvents + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + instanceAddress: { type: "string" }, + commitment: bytes32SchemaType, + leafIndex: { type: "number" }, + timestamp: { type: "number" }, + from: addressSchemaType + }, + required: [ + ...baseEventsSchemaRequired, + "event", + "instanceAddress", + "commitment", + "leafIndex", + "timestamp", + "from" + ], + additionalProperties: false + }, + // withdrawalEvents + { + type: "object", + properties: { + ...baseEventsSchemaProperty, + event: { type: "string" }, + instanceAddress: { type: "string" }, + nullifierHash: bytes32SchemaType, + to: addressSchemaType, + relayerAddress: addressSchemaType, + fee: bnSchemaType, + timestamp: { type: "number" } + }, + required: [ + ...baseEventsSchemaRequired, + "event", + "instanceAddress", + "nullifierHash", + "to", + "relayerAddress", + "fee", + "timestamp" + ], + additionalProperties: false + } + ] + } +}; +const echoEventsSchema = { + type: "array", + items: { + type: "object", + properties: { + ...baseEventsSchemaProperty, + address: addressSchemaType, + encryptedAccount: { type: "string" } + }, + required: [...baseEventsSchemaRequired, "address", "encryptedAccount"], + additionalProperties: false + } +}; +const encryptedNotesSchema = { + type: "array", + items: { + type: "object", + properties: { + ...baseEventsSchemaProperty, + encryptedNote: { type: "string" } + }, + required: [...baseEventsSchemaRequired, "encryptedNote"], + additionalProperties: false + } +}; +function getEventsSchemaValidator(type) { + if (type === "tornado") { + return ajv_ajv.compile(tornadoEventsSchema); + } + if (type === "deposit") { + return ajv_ajv.compile(depositsEventsSchema); + } + if (type === "withdrawal") { + return ajv_ajv.compile(withdrawalsEventsSchema); + } + if (type === "governance") { + return ajv_ajv.compile(governanceEventsSchema); + } + if (type === "registry") { + return ajv_ajv.compile(relayerRegistryEventsSchema); + } + if (type === "revenue") { + return ajv_ajv.compile(stakeBurnedEventsSchema); + } + if (type === "echo") { + return ajv_ajv.compile(echoEventsSchema); + } + if (type === "encrypted_notes") { + return ajv_ajv.compile(encryptedNotesSchema); + } + throw new Error("Unsupported event type for schema validation"); +} + // EXTERNAL MODULE: ./src/networkConfig.ts var networkConfig = __webpack_require__(59499); -;// CONCATENATED MODULE: ./src/schemas/status.ts +;// ./src/schemas/status.ts + -const addressType = { type: "string", pattern: "^0x[a-fA-F0-9]{40}$" }; -const bnType = { type: "string", BN: true }; const statusSchema = { type: "object", properties: { - rewardAccount: addressType, + rewardAccount: addressSchemaType, gasPrices: { type: "object", properties: { @@ -73474,6 +103836,7 @@ const statusSchema = { netId: { type: "integer" }, tornadoServiceFee: { type: "number", maximum: 20, minimum: 0 }, latestBlock: { type: "number" }, + latestBalance: bnSchemaType, version: { type: "string" }, health: { type: "object", @@ -73483,12 +103846,22 @@ const statusSchema = { }, required: ["status"] }, + syncStatus: { + type: "object", + properties: { + events: { type: "boolean" }, + tokenPrice: { type: "boolean" }, + gasPrice: { type: "boolean" } + }, + required: ["events", "tokenPrice", "gasPrice"] + }, + onSyncEvents: { type: "boolean" }, currentQueue: { type: "number" } }, - required: ["rewardAccount", "instances", "netId", "tornadoServiceFee", "version", "health"] + required: ["rewardAccount", "instances", "netId", "tornadoServiceFee", "version", "health", "currentQueue"] }; -function getStatusSchema(netId, config) { - const { tokens, optionalTokens = [], nativeCurrency } = config; +function getStatusSchema(netId, config, tovarish) { + const { tokens, optionalTokens, disabledTokens, nativeCurrency } = config; const schema = JSON.parse(JSON.stringify(statusSchema)); const instances = Object.keys(tokens).reduce( (acc, token) => { @@ -73499,10 +103872,13 @@ function getStatusSchema(netId, config) { properties: { instanceAddress: { type: "object", - properties: amounts.reduce((acc2, cur) => { - acc2[cur] = addressType; - return acc2; - }, {}), + properties: amounts.reduce( + (acc2, cur) => { + acc2[cur] = addressSchemaType; + return acc2; + }, + {} + ), required: amounts.filter((amount) => !optionalInstances.includes(amount)) }, decimals: { enum: [decimals] } @@ -73513,13 +103889,13 @@ function getStatusSchema(netId, config) { ) }; if (tokenAddress) { - instanceProperties.properties.tokenAddress = addressType; + instanceProperties.properties.tokenAddress = addressSchemaType; } if (symbol) { instanceProperties.properties.symbol = { enum: [symbol] }; } acc.properties[token] = instanceProperties; - if (!optionalTokens.includes(token)) { + if (!optionalTokens?.includes(token) && !disabledTokens?.includes(token)) { acc.required.push(token); } return acc; @@ -73531,22 +103907,31 @@ function getStatusSchema(netId, config) { } ); schema.properties.instances = instances; + const _tokens = Object.keys(tokens).filter( + (t) => t !== nativeCurrency && !config.optionalTokens?.includes(t) && !config.disabledTokens?.includes(t) + ); if (netId === networkConfig/* NetId */.zr.MAINNET) { - const _tokens = Object.keys(tokens).filter((t) => t !== nativeCurrency); + _tokens.push("torn"); + } + if (_tokens.length) { const ethPrices = { type: "object", properties: _tokens.reduce((acc, token) => { - acc[token] = bnType; + acc[token] = bnSchemaType; return acc; - }, {}) - // required: _tokens + }, {}), + required: _tokens }; schema.properties.ethPrices = ethPrices; + schema.required.push("ethPrices"); + } + if (tovarish) { + schema.required.push("gasPrices", "latestBlock", "latestBalance", "syncStatus", "onSyncEvents"); } return schema; } -;// CONCATENATED MODULE: ./src/schemas/jobs.ts +;// ./src/schemas/jobs.ts const jobsSchema = { type: "object", @@ -73567,24 +103952,16 @@ const jobsSchema = { }, required: ["id", "status"] }; +const jobRequestSchema = { + ...jobsSchema, + required: ["id"] +}; + +;// ./src/schemas/index.ts + -;// CONCATENATED MODULE: ./src/schemas/index.ts -const schemas_ajv = new (ajv_default())({ allErrors: true }); -schemas_ajv.addKeyword({ - keyword: "BN", - // eslint-disable-next-line @typescript-eslint/no-explicit-any - validate: (schema, data) => { - try { - BigInt(data); - return true; - } catch (e) { - return false; - } - }, - errors: true -}); @@ -73599,111 +103976,373 @@ schemas_ajv.addKeyword({ /* harmony export */ H: () => (/* binding */ getTokenBalances) /* harmony export */ }); /* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(98982); -/* harmony import */ var _typechain__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67276); +/* harmony import */ var _typechain__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(62463); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67418); /* harmony import */ var _multicall__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(48486); -var __async = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; -function getTokenBalances(_0) { - return __async(this, arguments, function* ({ - provider, - Multicall: Multicall2, - currencyName, - userAddress, - tokenAddresses = [] - }) { - const tokenCalls = tokenAddresses.map((tokenAddress) => { - const Token = _typechain__WEBPACK_IMPORTED_MODULE_0__/* .ERC20__factory */ .Xc.connect(tokenAddress, provider); - return [ - { - contract: Token, - name: "balanceOf", - params: [userAddress] - }, - { - contract: Token, - name: "name" - }, - { - contract: Token, - name: "symbol" - }, - { - contract: Token, - name: "decimals" - } - ]; - }).flat(); - const multicallResults = yield (0,_multicall__WEBPACK_IMPORTED_MODULE_2__/* .multicall */ .C)(Multicall2, [ - { - contract: Multicall2, - name: "getEthBalance", - params: [userAddress] - }, - ...tokenCalls.length ? tokenCalls : [] - ]); - const ethResults = multicallResults[0]; - const tokenResults = multicallResults.slice(1).length ? (0,_utils__WEBPACK_IMPORTED_MODULE_1__/* .chunk */ .iv)(multicallResults.slice(1), tokenCalls.length / tokenAddresses.length) : []; - const tokenBalances = tokenResults.map((tokenResult, index) => { - const [tokenBalance, tokenName, tokenSymbol, tokenDecimals] = tokenResult; - const tokenAddress = tokenAddresses[index]; - return { - address: tokenAddress, - name: tokenName, - symbol: tokenSymbol, - decimals: Number(tokenDecimals), - balance: tokenBalance - }; - }); +async function getTokenBalances({ + provider, + Multicall: Multicall2, + currencyName, + userAddress, + tokenAddresses = [] +}) { + const tokenCalls = tokenAddresses.map((tokenAddress) => { + const Token = _typechain__WEBPACK_IMPORTED_MODULE_0__/* .ERC20__factory */ .Xc.connect(tokenAddress, provider); return [ { - address: ethers__WEBPACK_IMPORTED_MODULE_3__/* .ZeroAddress */ .j, - name: currencyName, - symbol: currencyName, - decimals: 18, - balance: ethResults + contract: Token, + name: "balanceOf", + params: [userAddress] }, - ...tokenBalances + { + contract: Token, + name: "name" + }, + { + contract: Token, + name: "symbol" + }, + { + contract: Token, + name: "decimals" + } ]; + }).flat(); + const multicallResults = await (0,_multicall__WEBPACK_IMPORTED_MODULE_2__/* .multicall */ .C)(Multicall2, [ + { + contract: Multicall2, + name: "getEthBalance", + params: [userAddress] + }, + ...tokenCalls.length ? tokenCalls : [] + ]); + const ethResults = multicallResults[0]; + const tokenResults = multicallResults.slice(1).length ? (0,_utils__WEBPACK_IMPORTED_MODULE_1__/* .chunk */ .iv)(multicallResults.slice(1), tokenCalls.length / tokenAddresses.length) : []; + const tokenBalances = tokenResults.map((tokenResult, index) => { + const [tokenBalance, tokenName, tokenSymbol, tokenDecimals] = tokenResult; + const tokenAddress = tokenAddresses[index]; + return { + address: tokenAddress, + name: tokenName, + symbol: tokenSymbol, + decimals: Number(tokenDecimals), + balance: tokenBalance + }; }); + return [ + { + address: ethers__WEBPACK_IMPORTED_MODULE_3__/* .ZeroAddress */ .j, + name: currencyName, + symbol: currencyName, + decimals: 18, + balance: ethResults + }, + ...tokenBalances + ]; } /***/ }), -/***/ 67276: +/***/ 96838: +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ E: () => (/* binding */ TovarishClient), +/* harmony export */ o: () => (/* binding */ MAX_TOVARISH_EVENTS) +/* harmony export */ }); +/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(30031); +/* harmony import */ var _relayerClient__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57194); +/* harmony import */ var _providers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(46170); +/* harmony import */ var _schemas__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(59511); +/* harmony import */ var _networkConfig__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(59499); + + + + + + +const MAX_TOVARISH_EVENTS = 5e3; +class TovarishClient extends _relayerClient__WEBPACK_IMPORTED_MODULE_0__/* .RelayerClient */ .OR { + constructor(clientConstructor) { + super(clientConstructor); + this.tovarish = true; + } + async askRelayerStatus({ + hostname, + url, + relayerAddress + }) { + const status = await super.askRelayerStatus({ + hostname, + url, + relayerAddress + }); + if (!status.version.includes("tovarish")) { + throw new Error("Not a tovarish relayer!"); + } + return status; + } + /** + * Ask status for all enabled chains for tovarish relayer + */ + async askAllStatus({ + hostname, + url, + relayerAddress + }) { + if (!url && hostname) { + url = `https://${!hostname.endsWith("/") ? hostname + "/" : hostname}`; + } else if (url && !url.endsWith("/")) { + url += "/"; + } else { + url = ""; + } + const statusArray = await (0,_providers__WEBPACK_IMPORTED_MODULE_1__/* .fetchData */ .Fd)(`${url}status`, { + ...this.fetchDataOptions, + headers: { + "Content-Type": "application/json, application/x-www-form-urlencoded" + }, + timeout: 3e4, + maxRetry: this.fetchDataOptions?.torPort ? 2 : 0 + }); + if (!Array.isArray(statusArray)) { + return []; + } + const tovarishStatus = []; + for (const rawStatus of statusArray) { + const netId = rawStatus.netId; + const config = (0,_networkConfig__WEBPACK_IMPORTED_MODULE_3__/* .getConfig */ .zj)(netId); + const statusValidator = _schemas__WEBPACK_IMPORTED_MODULE_2__/* .ajv */ .SS.compile( + (0,_schemas__WEBPACK_IMPORTED_MODULE_2__/* .getStatusSchema */ .c_)( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + rawStatus.netId, + config, + this.tovarish + ) + ); + if (!statusValidator) { + continue; + } + const status = { + ...rawStatus, + url: `${url}${netId}/` + }; + if (status.currentQueue > 5) { + throw new Error("Withdrawal queue is overloaded"); + } + if (!_networkConfig__WEBPACK_IMPORTED_MODULE_3__/* .enabledChains */ .Af.includes(status.netId)) { + throw new Error("This relayer serves a different network"); + } + if (relayerAddress && status.netId === _networkConfig__WEBPACK_IMPORTED_MODULE_3__/* .NetId */ .zr.MAINNET && status.rewardAccount !== relayerAddress) { + throw new Error("The Relayer reward address must match registered address"); + } + if (!status.version.includes("tovarish")) { + throw new Error("Not a tovarish relayer!"); + } + tovarishStatus.push(status); + } + return tovarishStatus; + } + async filterRelayer(relayer) { + const { ensName, relayerAddress, tovarishHost, tovarishNetworks } = relayer; + if (!tovarishHost || !tovarishNetworks?.includes(this.netId)) { + return; + } + const hostname = `${tovarishHost}/${this.netId}`; + try { + const status = await this.askRelayerStatus({ + hostname, + relayerAddress + }); + return { + netId: status.netId, + url: status.url, + hostname, + ensName, + relayerAddress, + rewardAccount: (0,ethers__WEBPACK_IMPORTED_MODULE_4__/* .getAddress */ .b)(status.rewardAccount), + instances: (0,_relayerClient__WEBPACK_IMPORTED_MODULE_0__/* .getSupportedInstances */ .XF)(status.instances), + stakeBalance: relayer.stakeBalance, + gasPrice: status.gasPrices?.fast, + ethPrices: status.ethPrices, + currentQueue: status.currentQueue, + tornadoServiceFee: status.tornadoServiceFee, + // Additional fields for tovarish relayer + latestBlock: Number(status.latestBlock), + latestBalance: status.latestBalance, + version: status.version, + events: status.events, + syncStatus: status.syncStatus + }; + } catch (err) { + return { + hostname, + relayerAddress, + errorMessage: err.message, + hasError: true + }; + } + } + async getValidRelayers(relayers) { + const invalidRelayers = []; + const validRelayers = (await Promise.all(relayers.map((relayer) => this.filterRelayer(relayer)))).filter( + (r) => { + if (!r) { + return false; + } + if (r.hasError) { + invalidRelayers.push(r); + return false; + } + return true; + } + ); + return { + validRelayers, + invalidRelayers + }; + } + async getTovarishRelayers(relayers) { + const validRelayers = []; + const invalidRelayers = []; + await Promise.all( + relayers.filter((r) => r.tovarishHost && r.tovarishNetworks?.length).map(async (relayer) => { + const { ensName, relayerAddress, tovarishHost } = relayer; + try { + const statusArray = await this.askAllStatus({ + hostname: tovarishHost, + relayerAddress + }); + for (const status of statusArray) { + validRelayers.push({ + netId: status.netId, + url: status.url, + hostname: tovarishHost, + ensName, + relayerAddress, + rewardAccount: (0,ethers__WEBPACK_IMPORTED_MODULE_4__/* .getAddress */ .b)(status.rewardAccount), + instances: (0,_relayerClient__WEBPACK_IMPORTED_MODULE_0__/* .getSupportedInstances */ .XF)(status.instances), + stakeBalance: relayer.stakeBalance, + gasPrice: status.gasPrices?.fast, + ethPrices: status.ethPrices, + currentQueue: status.currentQueue, + tornadoServiceFee: status.tornadoServiceFee, + // Additional fields for tovarish relayer + latestBlock: Number(status.latestBlock), + latestBalance: status.latestBalance, + version: status.version, + events: status.events, + syncStatus: status.syncStatus + }); + } + } catch (err) { + invalidRelayers.push({ + hostname: tovarishHost, + relayerAddress, + errorMessage: err.message, + hasError: true + }); + } + }) + ); + return { + validRelayers, + invalidRelayers + }; + } + async getEvents({ + type, + currency, + amount, + fromBlock, + recent + }) { + const url = `${this.selectedRelayer?.url}events`; + const schemaValidator = (0,_schemas__WEBPACK_IMPORTED_MODULE_2__/* .getEventsSchemaValidator */ .ZC)(type); + try { + const events = []; + let lastSyncBlock = fromBlock; + while (true) { + let { events: fetchedEvents, lastSyncBlock: currentBlock } = await (0,_providers__WEBPACK_IMPORTED_MODULE_1__/* .fetchData */ .Fd)(url, { + ...this.fetchDataOptions, + method: "POST", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify({ + type, + currency, + amount, + fromBlock, + recent + }) + }); + if (!schemaValidator(fetchedEvents)) { + const errMsg = `Schema validation failed for ${type} events`; + throw new Error(errMsg); + } + if (recent) { + return { + events: fetchedEvents, + lastSyncBlock: currentBlock + }; + } + lastSyncBlock = currentBlock; + if (!Array.isArray(fetchedEvents) || !fetchedEvents.length) { + break; + } + fetchedEvents = fetchedEvents.sort((a, b) => { + if (a.blockNumber === b.blockNumber) { + return a.logIndex - b.logIndex; + } + return a.blockNumber - b.blockNumber; + }); + const [lastEvent] = fetchedEvents.slice(-1); + if (fetchedEvents.length < MAX_TOVARISH_EVENTS - 100) { + events.push(...fetchedEvents); + break; + } + fetchedEvents = fetchedEvents.filter((e) => e.blockNumber !== lastEvent.blockNumber); + fromBlock = Number(lastEvent.blockNumber); + events.push(...fetchedEvents); + } + return { + events, + lastSyncBlock + }; + } catch (err) { + console.log("Error from TovarishClient events endpoint"); + console.log(err); + return { + events: [], + lastSyncBlock: fromBlock + }; + } + } +} + + +/***/ }), + +/***/ 62463: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { + rZ: () => (/* reexport */ ENSNameWrapper__factory), + S4: () => (/* reexport */ ENSRegistry__factory), + BB: () => (/* reexport */ ENSResolver__factory), p2: () => (/* reexport */ ENS__factory), Xc: () => (/* reexport */ ERC20__factory), - Hu: () => (/* reexport */ GasPriceOracle__factory), Q2: () => (/* reexport */ Multicall__factory), Hk: () => (/* reexport */ OffchainOracle__factory), Ld: () => (/* reexport */ OvmGasPriceOracle__factory), @@ -73715,9 +104354,11 @@ __webpack_require__.d(__webpack_exports__, { var factories_namespaceObject = {}; __webpack_require__.r(factories_namespaceObject); __webpack_require__.d(factories_namespaceObject, { + ENSNameWrapper__factory: () => (ENSNameWrapper__factory), + ENSRegistry__factory: () => (ENSRegistry__factory), + ENSResolver__factory: () => (ENSResolver__factory), ENS__factory: () => (ENS__factory), ERC20__factory: () => (ERC20__factory), - GasPriceOracle__factory: () => (GasPriceOracle__factory), Multicall__factory: () => (Multicall__factory), OffchainOracle__factory: () => (OffchainOracle__factory), OvmGasPriceOracle__factory: () => (OvmGasPriceOracle__factory), @@ -73726,9 +104367,9 @@ __webpack_require__.d(factories_namespaceObject, { // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/abi/interface.js var abi_interface = __webpack_require__(73622); -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/contract/contract.js + 1 modules -var contract = __webpack_require__(24391); -;// CONCATENATED MODULE: ./src/typechain/factories/ENS__factory.ts +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/contract/contract.js +var contract = __webpack_require__(13269); +;// ./src/typechain/factories/ENS__factory.ts const _abi = [ @@ -74413,6 +105054,7 @@ const _abi = [ } ]; class ENS__factory { + static abi = _abi; static createInterface() { return new abi_interface/* Interface */.KA(_abi); } @@ -74420,9 +105062,2937 @@ class ENS__factory { return new contract/* Contract */.NZ(address, _abi, runner); } } -ENS__factory.abi = _abi; -;// CONCATENATED MODULE: ./src/typechain/factories/ERC20__factory.ts +;// ./src/typechain/factories/ENSNameWrapper__factory.ts + + +const ENSNameWrapper_factory_abi = [ + { + inputs: [ + { + internalType: "contract ENS", + name: "_ens", + type: "address" + }, + { + internalType: "contract IBaseRegistrar", + name: "_registrar", + type: "address" + }, + { + internalType: "contract IMetadataService", + name: "_metadataService", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "CannotUpgrade", + type: "error" + }, + { + inputs: [], + name: "IncompatibleParent", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "IncorrectTargetOwner", + type: "error" + }, + { + inputs: [], + name: "IncorrectTokenType", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "labelHash", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "expectedLabelhash", + type: "bytes32" + } + ], + name: "LabelMismatch", + type: "error" + }, + { + inputs: [ + { + internalType: "string", + name: "label", + type: "string" + } + ], + name: "LabelTooLong", + type: "error" + }, + { + inputs: [], + name: "LabelTooShort", + type: "error" + }, + { + inputs: [], + name: "NameIsNotWrapped", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "OperationProhibited", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "addr", + type: "address" + } + ], + name: "Unauthorised", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "approved", + type: "address" + }, + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "ApprovalForAll", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "controller", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "active", + type: "bool" + } + ], + name: "ControllerChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "ExpiryExtended", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint32", + name: "fuses", + type: "uint32" + } + ], + name: "FusesSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "NameUnwrapped", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes", + name: "name", + type: "bytes" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: false, + internalType: "uint32", + name: "fuses", + type: "uint32" + }, + { + indexed: false, + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "NameWrapped", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256[]", + name: "ids", + type: "uint256[]" + }, + { + indexed: false, + internalType: "uint256[]", + name: "values", + type: "uint256[]" + } + ], + name: "TransferBatch", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "TransferSingle", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "string", + name: "value", + type: "string" + }, + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256" + } + ], + name: "URI", + type: "event" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "_tokens", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint32", + name: "fuseMask", + type: "uint32" + } + ], + name: "allFusesBurned", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "approve", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "id", + type: "uint256" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "accounts", + type: "address[]" + }, + { + internalType: "uint256[]", + name: "ids", + type: "uint256[]" + } + ], + name: "balanceOfBatch", + outputs: [ + { + internalType: "uint256[]", + name: "", + type: "uint256[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "addr", + type: "address" + } + ], + name: "canExtendSubnames", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "addr", + type: "address" + } + ], + name: "canModifyName", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "controllers", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ens", + outputs: [ + { + internalType: "contract ENS", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32" + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "extendExpiry", + outputs: [ + { + internalType: "uint64", + name: "", + type: "uint64" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "id", + type: "uint256" + } + ], + name: "getApproved", + outputs: [ + { + internalType: "address", + name: "operator", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "id", + type: "uint256" + } + ], + name: "getData", + outputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint32", + name: "fuses", + type: "uint32" + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "address", + name: "operator", + type: "address" + } + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32" + } + ], + name: "isWrapped", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "isWrapped", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "metadataService", + outputs: [ + { + internalType: "contract IMetadataService", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "names", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "address", + name: "", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "onERC721Received", + outputs: [ + { + internalType: "bytes4", + name: "", + type: "bytes4" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "id", + type: "uint256" + } + ], + name: "ownerOf", + outputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_token", + type: "address" + }, + { + internalType: "address", + name: "_to", + type: "address" + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256" + } + ], + name: "recoverFunds", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "string", + name: "label", + type: "string" + }, + { + internalType: "address", + name: "wrappedOwner", + type: "address" + }, + { + internalType: "uint256", + name: "duration", + type: "uint256" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint16", + name: "ownerControlledFuses", + type: "uint16" + } + ], + name: "registerAndWrapETH2LD", + outputs: [ + { + internalType: "uint256", + name: "registrarExpiry", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "registrar", + outputs: [ + { + internalType: "contract IBaseRegistrar", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "duration", + type: "uint256" + } + ], + name: "renew", + outputs: [ + { + internalType: "uint256", + name: "expires", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256[]", + name: "ids", + type: "uint256[]" + }, + { + internalType: "uint256[]", + name: "amounts", + type: "uint256[]" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "safeBatchTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "setApprovalForAll", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32" + }, + { + internalType: "uint32", + name: "fuses", + type: "uint32" + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "setChildFuses", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "controller", + type: "address" + }, + { + internalType: "bool", + name: "active", + type: "bool" + } + ], + name: "setController", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint16", + name: "ownerControlledFuses", + type: "uint16" + } + ], + name: "setFuses", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IMetadataService", + name: "_metadataService", + type: "address" + } + ], + name: "setMetadataService", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setRecord", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "setResolver", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "string", + name: "label", + type: "string" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint32", + name: "fuses", + type: "uint32" + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "setSubnodeOwner", + outputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "string", + name: "label", + type: "string" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + }, + { + internalType: "uint32", + name: "fuses", + type: "uint32" + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "setSubnodeRecord", + outputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setTTL", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract INameWrapperUpgrade", + name: "_upgradeAddress", + type: "address" + } + ], + name: "setUpgradeContract", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32" + }, + { + internalType: "address", + name: "controller", + type: "address" + } + ], + name: "unwrap", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32" + }, + { + internalType: "address", + name: "registrant", + type: "address" + }, + { + internalType: "address", + name: "controller", + type: "address" + } + ], + name: "unwrapETH2LD", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "name", + type: "bytes" + }, + { + internalType: "bytes", + name: "extraData", + type: "bytes" + } + ], + name: "upgrade", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "upgradeContract", + outputs: [ + { + internalType: "contract INameWrapperUpgrade", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "uri", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "name", + type: "bytes" + }, + { + internalType: "address", + name: "wrappedOwner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "wrap", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "string", + name: "label", + type: "string" + }, + { + internalType: "address", + name: "wrappedOwner", + type: "address" + }, + { + internalType: "uint16", + name: "ownerControlledFuses", + type: "uint16" + }, + { + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "wrapETH2LD", + outputs: [ + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +class ENSNameWrapper__factory { + static abi = ENSNameWrapper_factory_abi; + static createInterface() { + return new abi_interface/* Interface */.KA(ENSNameWrapper_factory_abi); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, ENSNameWrapper_factory_abi, runner); + } +} + +;// ./src/typechain/factories/ENSRegistry__factory.ts + + +const ENSRegistry_factory_abi = [ + { + inputs: [ + { + internalType: "contract ENS", + name: "_old", + type: "address" + } + ], + payable: false, + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "ApprovalForAll", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "bytes32", + name: "label", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "NewOwner", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "NewResolver", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "NewTTL", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "Transfer", + type: "event" + }, + { + constant: true, + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "operator", + type: "address" + } + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [], + name: "old", + outputs: [ + { + internalType: "contract ENS", + name: "", + type: "address" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "recordExists", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "resolver", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "setApprovalForAll", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "setOwner", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setRecord", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "setResolver", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "label", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "setSubnodeOwner", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "label", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setSubnodeRecord", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setTTL", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "ttl", + outputs: [ + { + internalType: "uint64", + name: "", + type: "uint64" + } + ], + payable: false, + stateMutability: "view", + type: "function" + } +]; +class ENSRegistry__factory { + static abi = ENSRegistry_factory_abi; + static createInterface() { + return new abi_interface/* Interface */.KA(ENSRegistry_factory_abi); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, ENSRegistry_factory_abi, runner); + } +} + +;// ./src/typechain/factories/ENSResolver__factory.ts + + +const ENSResolver_factory_abi = [ + { + inputs: [ + { + internalType: "contract ENS", + name: "_ens", + type: "address" + }, + { + internalType: "contract INameWrapper", + name: "wrapperAddress", + type: "address" + }, + { + internalType: "address", + name: "_trustedETHController", + type: "address" + }, + { + internalType: "address", + name: "_trustedReverseRegistrar", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "uint256", + name: "contentType", + type: "uint256" + } + ], + name: "ABIChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "a", + type: "address" + } + ], + name: "AddrChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint256", + name: "coinType", + type: "uint256" + }, + { + indexed: false, + internalType: "bytes", + name: "newAddress", + type: "bytes" + } + ], + name: "AddressChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "ApprovalForAll", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "delegate", + type: "address" + }, + { + indexed: true, + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "Approved", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes", + name: "hash", + type: "bytes" + } + ], + name: "ContenthashChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes", + name: "name", + type: "bytes" + }, + { + indexed: false, + internalType: "uint16", + name: "resource", + type: "uint16" + }, + { + indexed: false, + internalType: "bytes", + name: "record", + type: "bytes" + } + ], + name: "DNSRecordChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes", + name: "name", + type: "bytes" + }, + { + indexed: false, + internalType: "uint16", + name: "resource", + type: "uint16" + } + ], + name: "DNSRecordDeleted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes", + name: "lastzonehash", + type: "bytes" + }, + { + indexed: false, + internalType: "bytes", + name: "zonehash", + type: "bytes" + } + ], + name: "DNSZonehashChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "bytes4", + name: "interfaceID", + type: "bytes4" + }, + { + indexed: false, + internalType: "address", + name: "implementer", + type: "address" + } + ], + name: "InterfaceChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "string", + name: "name", + type: "string" + } + ], + name: "NameChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes32", + name: "x", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes32", + name: "y", + type: "bytes32" + } + ], + name: "PubkeyChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "string", + name: "indexedKey", + type: "string" + }, + { + indexed: false, + internalType: "string", + name: "key", + type: "string" + }, + { + indexed: false, + internalType: "string", + name: "value", + type: "string" + } + ], + name: "TextChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint64", + name: "newVersion", + type: "uint64" + } + ], + name: "VersionChanged", + type: "event" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint256", + name: "contentTypes", + type: "uint256" + } + ], + name: "ABI", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + }, + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "addr", + outputs: [ + { + internalType: "address payable", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint256", + name: "coinType", + type: "uint256" + } + ], + name: "addr", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "delegate", + type: "address" + }, + { + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "approve", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "clearRecords", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "contenthash", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "name", + type: "bytes32" + }, + { + internalType: "uint16", + name: "resource", + type: "uint16" + } + ], + name: "dnsRecord", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "name", + type: "bytes32" + } + ], + name: "hasDNSRecords", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes4", + name: "interfaceID", + type: "bytes4" + } + ], + name: "interfaceImplementer", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "delegate", + type: "address" + } + ], + name: "isApprovedFor", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "address", + name: "operator", + type: "address" + } + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes[]", + name: "data", + type: "bytes[]" + } + ], + name: "multicall", + outputs: [ + { + internalType: "bytes[]", + name: "results", + type: "bytes[]" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "nodehash", + type: "bytes32" + }, + { + internalType: "bytes[]", + name: "data", + type: "bytes[]" + } + ], + name: "multicallWithNodeCheck", + outputs: [ + { + internalType: "bytes[]", + name: "results", + type: "bytes[]" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "pubkey", + outputs: [ + { + internalType: "bytes32", + name: "x", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "y", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "recordVersions", + outputs: [ + { + internalType: "uint64", + name: "", + type: "uint64" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint256", + name: "contentType", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "setABI", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint256", + name: "coinType", + type: "uint256" + }, + { + internalType: "bytes", + name: "a", + type: "bytes" + } + ], + name: "setAddr", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "a", + type: "address" + } + ], + name: "setAddr", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "setApprovalForAll", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes", + name: "hash", + type: "bytes" + } + ], + name: "setContenthash", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "setDNSRecords", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes4", + name: "interfaceID", + type: "bytes4" + }, + { + internalType: "address", + name: "implementer", + type: "address" + } + ], + name: "setInterface", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "string", + name: "newName", + type: "string" + } + ], + name: "setName", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "x", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "y", + type: "bytes32" + } + ], + name: "setPubkey", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "string", + name: "key", + type: "string" + }, + { + internalType: "string", + name: "value", + type: "string" + } + ], + name: "setText", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes", + name: "hash", + type: "bytes" + } + ], + name: "setZonehash", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceID", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "string", + name: "key", + type: "string" + } + ], + name: "text", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "zonehash", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + } +]; +class ENSResolver__factory { + static abi = ENSResolver_factory_abi; + static createInterface() { + return new abi_interface/* Interface */.KA(ENSResolver_factory_abi); + } + static connect(address, runner) { + return new contract/* Contract */.NZ(address, ENSResolver_factory_abi, runner); + } +} + +;// ./src/typechain/factories/ERC20__factory.ts const ERC20_factory_abi = [ @@ -74727,6 +108297,7 @@ const ERC20_factory_abi = [ } ]; class ERC20__factory { + static abi = ERC20_factory_abi; static createInterface() { return new abi_interface/* Interface */.KA(ERC20_factory_abi); } @@ -74734,211 +108305,8 @@ class ERC20__factory { return new contract/* Contract */.NZ(address, ERC20_factory_abi, runner); } } -ERC20__factory.abi = ERC20_factory_abi; -;// CONCATENATED MODULE: ./src/typechain/factories/GasPriceOracle__factory.ts - - -const GasPriceOracle_factory_abi = [ - { - inputs: [], - stateMutability: "nonpayable", - type: "constructor" - }, - { - inputs: [], - name: "GAS_UNIT", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [ - { - internalType: "uint32", - name: "_derivationThresold", - type: "uint32" - } - ], - name: "changeDerivationThresold", - outputs: [], - stateMutability: "nonpayable", - type: "function" - }, - { - inputs: [ - { - internalType: "uint32", - name: "_gasUnit", - type: "uint32" - } - ], - name: "changeGasUnit", - outputs: [], - stateMutability: "nonpayable", - type: "function" - }, - { - inputs: [ - { - internalType: "uint32", - name: "_heartbeat", - type: "uint32" - } - ], - name: "changeHeartbeat", - outputs: [], - stateMutability: "nonpayable", - type: "function" - }, - { - inputs: [ - { - internalType: "address", - name: "_owner", - type: "address" - } - ], - name: "changeOwnership", - outputs: [], - stateMutability: "nonpayable", - type: "function" - }, - { - inputs: [], - name: "derivationThresold", - outputs: [ - { - internalType: "uint32", - name: "", - type: "uint32" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [], - name: "gasPrice", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [], - name: "heartbeat", - outputs: [ - { - internalType: "uint32", - name: "", - type: "uint32" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [], - name: "maxFeePerGas", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [], - name: "maxPriorityFeePerGas", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [], - name: "owner", - outputs: [ - { - internalType: "address", - name: "", - type: "address" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [], - name: "pastGasPrice", - outputs: [ - { - internalType: "uint32", - name: "", - type: "uint32" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [ - { - internalType: "uint32", - name: "_gasPrice", - type: "uint32" - } - ], - name: "setGasPrice", - outputs: [], - stateMutability: "nonpayable", - type: "function" - }, - { - inputs: [], - name: "timestamp", - outputs: [ - { - internalType: "uint32", - name: "", - type: "uint32" - } - ], - stateMutability: "view", - type: "function" - } -]; -class GasPriceOracle__factory { - static createInterface() { - return new abi_interface/* Interface */.KA(GasPriceOracle_factory_abi); - } - static connect(address, runner) { - return new contract/* Contract */.NZ(address, GasPriceOracle_factory_abi, runner); - } -} -GasPriceOracle__factory.abi = GasPriceOracle_factory_abi; - -;// CONCATENATED MODULE: ./src/typechain/factories/Multicall__factory.ts +;// ./src/typechain/factories/Multicall__factory.ts const Multicall_factory_abi = [ @@ -75382,6 +108750,7 @@ const Multicall_factory_abi = [ } ]; class Multicall__factory { + static abi = Multicall_factory_abi; static createInterface() { return new abi_interface/* Interface */.KA(Multicall_factory_abi); } @@ -75389,9 +108758,8 @@ class Multicall__factory { return new contract/* Contract */.NZ(address, Multicall_factory_abi, runner); } } -Multicall__factory.abi = Multicall_factory_abi; -;// CONCATENATED MODULE: ./src/typechain/factories/OffchainOracle__factory.ts +;// ./src/typechain/factories/OffchainOracle__factory.ts const OffchainOracle_factory_abi = [ @@ -75910,6 +109278,7 @@ const OffchainOracle_factory_abi = [ } ]; class OffchainOracle__factory { + static abi = OffchainOracle_factory_abi; static createInterface() { return new abi_interface/* Interface */.KA(OffchainOracle_factory_abi); } @@ -75917,9 +109286,8 @@ class OffchainOracle__factory { return new contract/* Contract */.NZ(address, OffchainOracle_factory_abi, runner); } } -OffchainOracle__factory.abi = OffchainOracle_factory_abi; -;// CONCATENATED MODULE: ./src/typechain/factories/OvmGasPriceOracle__factory.ts +;// ./src/typechain/factories/OvmGasPriceOracle__factory.ts const OvmGasPriceOracle_factory_abi = [ @@ -76221,6 +109589,7 @@ const OvmGasPriceOracle_factory_abi = [ } ]; class OvmGasPriceOracle__factory { + static abi = OvmGasPriceOracle_factory_abi; static createInterface() { return new abi_interface/* Interface */.KA(OvmGasPriceOracle_factory_abi); } @@ -76228,9 +109597,8 @@ class OvmGasPriceOracle__factory { return new contract/* Contract */.NZ(address, OvmGasPriceOracle_factory_abi, runner); } } -OvmGasPriceOracle__factory.abi = OvmGasPriceOracle_factory_abi; -;// CONCATENATED MODULE: ./src/typechain/factories/ReverseRecords__factory.ts +;// ./src/typechain/factories/ReverseRecords__factory.ts const ReverseRecords_factory_abi = [ @@ -76266,6 +109634,7 @@ const ReverseRecords_factory_abi = [ } ]; class ReverseRecords__factory { + static abi = ReverseRecords_factory_abi; static createInterface() { return new abi_interface/* Interface */.KA(ReverseRecords_factory_abi); } @@ -76273,9 +109642,8 @@ class ReverseRecords__factory { return new contract/* Contract */.NZ(address, ReverseRecords_factory_abi, runner); } } -ReverseRecords__factory.abi = ReverseRecords_factory_abi; -;// CONCATENATED MODULE: ./src/typechain/factories/index.ts +;// ./src/typechain/factories/index.ts @@ -76285,7 +109653,10 @@ ReverseRecords__factory.abi = ReverseRecords_factory_abi; -;// CONCATENATED MODULE: ./src/typechain/index.ts + + +;// ./src/typechain/index.ts + @@ -76307,7 +109678,9 @@ ReverseRecords__factory.abi = ReverseRecords_factory_abi; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ $W: () => (/* binding */ toFixedHex), /* harmony export */ EI: () => (/* binding */ leInt2Buff), +/* harmony export */ Eg: () => (/* binding */ numberFormatter), /* harmony export */ Et: () => (/* binding */ crypto), +/* harmony export */ G9: () => (/* binding */ rHex), /* harmony export */ Id: () => (/* binding */ concatBytes), /* harmony export */ Ju: () => (/* binding */ bytesToBN), /* harmony export */ Kp: () => (/* binding */ base64ToBytes), @@ -76315,21 +109688,27 @@ ReverseRecords__factory.abi = ReverseRecords_factory_abi; /* harmony export */ My: () => (/* binding */ bytesToHex), /* harmony export */ aT: () => (/* binding */ hexToBytes), /* harmony export */ ae: () => (/* binding */ leBuff2Int), +/* harmony export */ br: () => (/* binding */ digest), /* harmony export */ gn: () => (/* binding */ bigIntReplacer), /* harmony export */ ib: () => (/* binding */ rBigInt), /* harmony export */ "if": () => (/* binding */ bytesToBase64), /* harmony export */ iv: () => (/* binding */ chunk), /* harmony export */ jm: () => (/* binding */ bnToBytes), /* harmony export */ lY: () => (/* binding */ bufferToBytes), +/* harmony export */ qv: () => (/* binding */ isHex), /* harmony export */ sY: () => (/* binding */ toFixedLength), /* harmony export */ uU: () => (/* binding */ substring), +/* harmony export */ vd: () => (/* binding */ toContentHash), /* harmony export */ wv: () => (/* binding */ validateUrl), +/* harmony export */ yp: () => (/* binding */ fromContentHash), /* harmony export */ yy: () => (/* binding */ sleep) /* harmony export */ }); /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(91565); /* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(39404); /* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(bn_js__WEBPACK_IMPORTED_MODULE_1__); -/* provided dependency */ var process = __webpack_require__(65606); +/* harmony import */ var _ensdomains_content_hash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81810); +/* harmony import */ var _ensdomains_content_hash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_ensdomains_content_hash__WEBPACK_IMPORTED_MODULE_2__); + @@ -76349,7 +109728,7 @@ function validateUrl(url, protocols) { return protocols.map((p) => p.toLowerCase()).includes(parsedUrl.protocol); } return true; - } catch (e) { + } catch { return false; } } @@ -76366,7 +109745,7 @@ function bufferToBytes(b) { return new Uint8Array(b.buffer); } function bytesToBase64(bytes) { - return btoa(String.fromCharCode.apply(null, Array.from(bytes))); + return btoa(bytes.reduce((data, byte) => data + String.fromCharCode(byte), "")); } function base64ToBytes(base64) { return Uint8Array.from(atob(base64), (c) => c.charCodeAt(0)); @@ -76376,7 +109755,7 @@ function bytesToHex(bytes) { } function hexToBytes(hexString) { if (hexString.slice(0, 2) === "0x") { - hexString = hexString.replace("0x", ""); + hexString = hexString.slice(2); } if (hexString.length % 2 !== 0) { hexString = "0" + hexString; @@ -76388,8 +109767,8 @@ function bytesToBN(bytes) { } function bnToBytes(bigint) { let hexString = typeof bigint === "bigint" ? bigint.toString(16) : bigint; - if (hexString.startsWith("0x")) { - hexString = hexString.replace("0x", ""); + if (hexString.slice(0, 2) === "0x") { + hexString = hexString.slice(2); } if (hexString.length % 2 !== 0) { hexString = "0" + hexString; @@ -76412,6 +109791,9 @@ function toFixedLength(string, length = 32) { function rBigInt(nbytes = 31) { return bytesToBN(crypto.getRandomValues(new Uint8Array(nbytes))); } +function rHex(nbytes = 32) { + return bytesToHex(crypto.getRandomValues(new Uint8Array(nbytes))); +} function bigIntReplacer(key, value) { return typeof value === "bigint" ? value.toString() : value; } @@ -76421,6 +109803,32 @@ function substring(str, length = 10) { } return `${str.substring(0, length)}...${str.substring(str.length - length)}`; } +async function digest(bytes, algo = "SHA-384") { + return new Uint8Array(await crypto.subtle.digest(algo, bytes)); +} +function numberFormatter(num, digits = 3) { + const lookup = [ + { value: 1, symbol: "" }, + { value: 1e3, symbol: "K" }, + { value: 1e6, symbol: "M" }, + { value: 1e9, symbol: "G" }, + { value: 1e12, symbol: "T" }, + { value: 1e15, symbol: "P" }, + { value: 1e18, symbol: "E" } + ]; + const regexp = /\.0+$|(?<=\.[0-9]*[1-9])0+$/; + const item = lookup.slice().reverse().find((item2) => Number(num) >= item2.value); + return item ? (Number(num) / item.value).toFixed(digits).replace(regexp, "").concat(item.symbol) : "0"; +} +function isHex(value) { + return /^0x[0-9a-fA-F]*$/.test(value); +} +function toContentHash(ipfsUrl) { + return _ensdomains_content_hash__WEBPACK_IMPORTED_MODULE_2__.fromIpfs(ipfsUrl); +} +function fromContentHash(contentHash) { + return _ensdomains_content_hash__WEBPACK_IMPORTED_MODULE_2__.decode(contentHash); +} /***/ }), @@ -76438,72 +109846,2787 @@ function substring(str, length = 10) { /* harmony import */ var _tornado_websnark_src_groth16__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(36336); /* harmony import */ var _tornado_websnark_src_groth16__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_tornado_websnark_src_groth16__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(67418); -/* provided dependency */ var console = __webpack_require__(96763); -var __async = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; let groth16; -function initGroth16() { - return __async(this, null, function* () { - if (!groth16) { - groth16 = yield _tornado_websnark_src_groth16__WEBPACK_IMPORTED_MODULE_1___default()({ wasmInitialMemory: 2e3 }); +async function initGroth16() { + if (!groth16) { + groth16 = await _tornado_websnark_src_groth16__WEBPACK_IMPORTED_MODULE_1___default()({ wasmInitialMemory: 2e3 }); + } +} +async function calculateSnarkProof(input, circuit, provingKey) { + if (!groth16) { + await initGroth16(); + } + const snarkInput = { + root: input.root, + nullifierHash: BigInt(input.nullifierHex).toString(), + recipient: BigInt(input.recipient), + relayer: BigInt(input.relayer), + fee: input.fee, + refund: input.refund, + nullifier: input.nullifier, + secret: input.secret, + pathElements: input.pathElements, + pathIndices: input.pathIndices + }; + console.log("Start generating SNARK proof", snarkInput); + console.time("SNARK proof time"); + const proofData = await _tornado_websnark_src_utils__WEBPACK_IMPORTED_MODULE_0__.genWitnessAndProve(await groth16, snarkInput, circuit, provingKey); + const proof = _tornado_websnark_src_utils__WEBPACK_IMPORTED_MODULE_0__.toSolidityInput(proofData).proof; + console.timeEnd("SNARK proof time"); + const args = [ + (0,_utils__WEBPACK_IMPORTED_MODULE_2__/* .toFixedHex */ .$W)(input.root, 32), + (0,_utils__WEBPACK_IMPORTED_MODULE_2__/* .toFixedHex */ .$W)(input.nullifierHex, 32), + input.recipient, + input.relayer, + (0,_utils__WEBPACK_IMPORTED_MODULE_2__/* .toFixedHex */ .$W)(input.fee, 32), + (0,_utils__WEBPACK_IMPORTED_MODULE_2__/* .toFixedHex */ .$W)(input.refund, 32) + ]; + return { proof, args }; +} + + +/***/ }), + +/***/ 18995: +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; + +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + _6: () => (/* binding */ downloadZip), + fY: () => (/* binding */ unzipAsync), + a8: () => (/* binding */ zipAsync) +}); + +;// ./node_modules/fflate/esm/browser.js +// DEFLATE is a complex format; to read this code, you should probably check the RFC first: +// https://tools.ietf.org/html/rfc1951 +// You may also wish to take a look at the guide I made about this program: +// https://gist.github.com/101arrowz/253f31eb5abc3d9275ab943003ffecad +// Some of the following code is similar to that of UZIP.js: +// https://github.com/photopea/UZIP.js +// However, the vast majority of the codebase has diverged from UZIP.js to increase performance and reduce bundle size. +// Sometimes 0 will appear where -1 would be more appropriate. This is because using a uint +// is better for memory in most engines (I *think*). +var ch2 = {}; +var wk = (function (c, id, msg, transfer, cb) { + var w = new Worker(ch2[id] || (ch2[id] = URL.createObjectURL(new Blob([ + c + ';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})' + ], { type: 'text/javascript' })))); + w.onmessage = function (e) { + var d = e.data, ed = d.$e$; + if (ed) { + var err = new Error(ed[0]); + err['code'] = ed[1]; + err.stack = ed[2]; + cb(err, null); + } + else + cb(null, d); + }; + w.postMessage(msg, transfer); + return w; +}); + +// aliases for shorter compressed code (most minifers don't do this) +var u8 = Uint8Array, u16 = Uint16Array, i32 = Int32Array; +// fixed length extra bits +var fleb = new u8([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, /* unused */ 0, 0, /* impossible */ 0]); +// fixed distance extra bits +var fdeb = new u8([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, /* unused */ 0, 0]); +// code length index map +var clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]); +// get base, reverse index map from extra bits +var freb = function (eb, start) { + var b = new u16(31); + for (var i = 0; i < 31; ++i) { + b[i] = start += 1 << eb[i - 1]; } + // numbers here are at max 18 bits + var r = new i32(b[30]); + for (var i = 1; i < 30; ++i) { + for (var j = b[i]; j < b[i + 1]; ++j) { + r[j] = ((j - b[i]) << 5) | i; + } + } + return { b: b, r: r }; +}; +var _a = freb(fleb, 2), fl = _a.b, revfl = _a.r; +// we can ignore the fact that the other numbers are wrong; they never happen anyway +fl[28] = 258, revfl[258] = 28; +var _b = freb(fdeb, 0), fd = _b.b, revfd = _b.r; +// map of value to reverse (assuming 16 bits) +var rev = new u16(32768); +for (var i = 0; i < 32768; ++i) { + // reverse table algorithm from SO + var x = ((i & 0xAAAA) >> 1) | ((i & 0x5555) << 1); + x = ((x & 0xCCCC) >> 2) | ((x & 0x3333) << 2); + x = ((x & 0xF0F0) >> 4) | ((x & 0x0F0F) << 4); + rev[i] = (((x & 0xFF00) >> 8) | ((x & 0x00FF) << 8)) >> 1; +} +// create huffman tree from u8 "map": index -> code length for code index +// mb (max bits) must be at most 15 +// TODO: optimize/split up? +var hMap = (function (cd, mb, r) { + var s = cd.length; + // index + var i = 0; + // u16 "map": index -> # of codes with bit length = index + var l = new u16(mb); + // length of cd must be 288 (total # of codes) + for (; i < s; ++i) { + if (cd[i]) + ++l[cd[i] - 1]; + } + // u16 "map": index -> minimum code for bit length = index + var le = new u16(mb); + for (i = 1; i < mb; ++i) { + le[i] = (le[i - 1] + l[i - 1]) << 1; + } + var co; + if (r) { + // u16 "map": index -> number of actual bits, symbol for code + co = new u16(1 << mb); + // bits to remove for reverser + var rvb = 15 - mb; + for (i = 0; i < s; ++i) { + // ignore 0 lengths + if (cd[i]) { + // num encoding both symbol and bits read + var sv = (i << 4) | cd[i]; + // free bits + var r_1 = mb - cd[i]; + // start value + var v = le[cd[i] - 1]++ << r_1; + // m is end value + for (var m = v | ((1 << r_1) - 1); v <= m; ++v) { + // every 16 bit value starting with the code yields the same result + co[rev[v] >> rvb] = sv; + } + } + } + } + else { + co = new u16(s); + for (i = 0; i < s; ++i) { + if (cd[i]) { + co[i] = rev[le[cd[i] - 1]++] >> (15 - cd[i]); + } + } + } + return co; +}); +// fixed length tree +var flt = new u8(288); +for (var i = 0; i < 144; ++i) + flt[i] = 8; +for (var i = 144; i < 256; ++i) + flt[i] = 9; +for (var i = 256; i < 280; ++i) + flt[i] = 7; +for (var i = 280; i < 288; ++i) + flt[i] = 8; +// fixed distance tree +var fdt = new u8(32); +for (var i = 0; i < 32; ++i) + fdt[i] = 5; +// fixed length map +var flm = /*#__PURE__*/ hMap(flt, 9, 0), flrm = /*#__PURE__*/ hMap(flt, 9, 1); +// fixed distance map +var fdm = /*#__PURE__*/ hMap(fdt, 5, 0), fdrm = /*#__PURE__*/ hMap(fdt, 5, 1); +// find max of array +var max = function (a) { + var m = a[0]; + for (var i = 1; i < a.length; ++i) { + if (a[i] > m) + m = a[i]; + } + return m; +}; +// read d, starting at bit p and mask with m +var bits = function (d, p, m) { + var o = (p / 8) | 0; + return ((d[o] | (d[o + 1] << 8)) >> (p & 7)) & m; +}; +// read d, starting at bit p continuing for at least 16 bits +var bits16 = function (d, p) { + var o = (p / 8) | 0; + return ((d[o] | (d[o + 1] << 8) | (d[o + 2] << 16)) >> (p & 7)); +}; +// get end of byte +var shft = function (p) { return ((p + 7) / 8) | 0; }; +// typed array slice - allows garbage collector to free original reference, +// while being more compatible than .slice +var slc = function (v, s, e) { + if (s == null || s < 0) + s = 0; + if (e == null || e > v.length) + e = v.length; + // can't use .constructor in case user-supplied + return new u8(v.subarray(s, e)); +}; +/** + * Codes for errors generated within this library + */ +var FlateErrorCode = { + UnexpectedEOF: 0, + InvalidBlockType: 1, + InvalidLengthLiteral: 2, + InvalidDistance: 3, + StreamFinished: 4, + NoStreamHandler: 5, + InvalidHeader: 6, + NoCallback: 7, + InvalidUTF8: 8, + ExtraFieldTooLong: 9, + InvalidDate: 10, + FilenameTooLong: 11, + StreamFinishing: 12, + InvalidZipData: 13, + UnknownCompressionMethod: 14 +}; +// error codes +var ec = [ + 'unexpected EOF', + 'invalid block type', + 'invalid length/literal', + 'invalid distance', + 'stream finished', + 'no stream handler', + , + 'no callback', + 'invalid UTF-8 data', + 'extra field too long', + 'date not in range 1980-2099', + 'filename too long', + 'stream finishing', + 'invalid zip data' + // determined by unknown compression method +]; +; +var err = function (ind, msg, nt) { + var e = new Error(msg || ec[ind]); + e.code = ind; + if (Error.captureStackTrace) + Error.captureStackTrace(e, err); + if (!nt) + throw e; + return e; +}; +// expands raw DEFLATE data +var inflt = function (dat, st, buf, dict) { + // source length dict length + var sl = dat.length, dl = dict ? dict.length : 0; + if (!sl || st.f && !st.l) + return buf || new u8(0); + var noBuf = !buf; + // have to estimate size + var resize = noBuf || st.i != 2; + // no state + var noSt = st.i; + // Assumes roughly 33% compression ratio average + if (noBuf) + buf = new u8(sl * 3); + // ensure buffer can fit at least l elements + var cbuf = function (l) { + var bl = buf.length; + // need to increase size to fit + if (l > bl) { + // Double or set to necessary, whichever is greater + var nbuf = new u8(Math.max(bl * 2, l)); + nbuf.set(buf); + buf = nbuf; + } + }; + // last chunk bitpos bytes + var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n; + // total bits + var tbts = sl * 8; + do { + if (!lm) { + // BFINAL - this is only 1 when last chunk is next + final = bits(dat, pos, 1); + // type: 0 = no compression, 1 = fixed huffman, 2 = dynamic huffman + var type = bits(dat, pos + 1, 3); + pos += 3; + if (!type) { + // go to end of byte boundary + var s = shft(pos) + 4, l = dat[s - 4] | (dat[s - 3] << 8), t = s + l; + if (t > sl) { + if (noSt) + err(0); + break; + } + // ensure size + if (resize) + cbuf(bt + l); + // Copy over uncompressed data + buf.set(dat.subarray(s, t), bt); + // Get new bitpos, update byte count + st.b = bt += l, st.p = pos = t * 8, st.f = final; + continue; + } + else if (type == 1) + lm = flrm, dm = fdrm, lbt = 9, dbt = 5; + else if (type == 2) { + // literal lengths + var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4; + var tl = hLit + bits(dat, pos + 5, 31) + 1; + pos += 14; + // length+distance tree + var ldt = new u8(tl); + // code length tree + var clt = new u8(19); + for (var i = 0; i < hcLen; ++i) { + // use index map to get real code + clt[clim[i]] = bits(dat, pos + i * 3, 7); + } + pos += hcLen * 3; + // code lengths bits + var clb = max(clt), clbmsk = (1 << clb) - 1; + // code lengths map + var clm = hMap(clt, clb, 1); + for (var i = 0; i < tl;) { + var r = clm[bits(dat, pos, clbmsk)]; + // bits read + pos += r & 15; + // symbol + var s = r >> 4; + // code length to copy + if (s < 16) { + ldt[i++] = s; + } + else { + // copy count + var c = 0, n = 0; + if (s == 16) + n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1]; + else if (s == 17) + n = 3 + bits(dat, pos, 7), pos += 3; + else if (s == 18) + n = 11 + bits(dat, pos, 127), pos += 7; + while (n--) + ldt[i++] = c; + } + } + // length tree distance tree + var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit); + // max length bits + lbt = max(lt); + // max dist bits + dbt = max(dt); + lm = hMap(lt, lbt, 1); + dm = hMap(dt, dbt, 1); + } + else + err(1); + if (pos > tbts) { + if (noSt) + err(0); + break; + } + } + // Make sure the buffer can hold this + the largest possible addition + // Maximum chunk size (practically, theoretically infinite) is 2^17 + if (resize) + cbuf(bt + 131072); + var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1; + var lpos = pos; + for (;; lpos = pos) { + // bits read, code + var c = lm[bits16(dat, pos) & lms], sym = c >> 4; + pos += c & 15; + if (pos > tbts) { + if (noSt) + err(0); + break; + } + if (!c) + err(2); + if (sym < 256) + buf[bt++] = sym; + else if (sym == 256) { + lpos = pos, lm = null; + break; + } + else { + var add = sym - 254; + // no extra bits needed if less + if (sym > 264) { + // index + var i = sym - 257, b = fleb[i]; + add = bits(dat, pos, (1 << b) - 1) + fl[i]; + pos += b; + } + // dist + var d = dm[bits16(dat, pos) & dms], dsym = d >> 4; + if (!d) + err(3); + pos += d & 15; + var dt = fd[dsym]; + if (dsym > 3) { + var b = fdeb[dsym]; + dt += bits16(dat, pos) & (1 << b) - 1, pos += b; + } + if (pos > tbts) { + if (noSt) + err(0); + break; + } + if (resize) + cbuf(bt + 131072); + var end = bt + add; + if (bt < dt) { + var shift = dl - dt, dend = Math.min(dt, end); + if (shift + bt < 0) + err(3); + for (; bt < dend; ++bt) + buf[bt] = dict[shift + bt]; + } + for (; bt < end; ++bt) + buf[bt] = buf[bt - dt]; + } + } + st.l = lm, st.p = lpos, st.b = bt, st.f = final; + if (lm) + final = 1, st.m = lbt, st.d = dm, st.n = dbt; + } while (!final); + // don't reallocate for streams or user buffers + return bt != buf.length && noBuf ? slc(buf, 0, bt) : buf.subarray(0, bt); +}; +// starting at p, write the minimum number of bits that can hold v to d +var wbits = function (d, p, v) { + v <<= p & 7; + var o = (p / 8) | 0; + d[o] |= v; + d[o + 1] |= v >> 8; +}; +// starting at p, write the minimum number of bits (>8) that can hold v to d +var wbits16 = function (d, p, v) { + v <<= p & 7; + var o = (p / 8) | 0; + d[o] |= v; + d[o + 1] |= v >> 8; + d[o + 2] |= v >> 16; +}; +// creates code lengths from a frequency table +var hTree = function (d, mb) { + // Need extra info to make a tree + var t = []; + for (var i = 0; i < d.length; ++i) { + if (d[i]) + t.push({ s: i, f: d[i] }); + } + var s = t.length; + var t2 = t.slice(); + if (!s) + return { t: et, l: 0 }; + if (s == 1) { + var v = new u8(t[0].s + 1); + v[t[0].s] = 1; + return { t: v, l: 1 }; + } + t.sort(function (a, b) { return a.f - b.f; }); + // after i2 reaches last ind, will be stopped + // freq must be greater than largest possible number of symbols + t.push({ s: -1, f: 25001 }); + var l = t[0], r = t[1], i0 = 0, i1 = 1, i2 = 2; + t[0] = { s: -1, f: l.f + r.f, l: l, r: r }; + // efficient algorithm from UZIP.js + // i0 is lookbehind, i2 is lookahead - after processing two low-freq + // symbols that combined have high freq, will start processing i2 (high-freq, + // non-composite) symbols instead + // see https://reddit.com/r/photopea/comments/ikekht/uzipjs_questions/ + while (i1 != s - 1) { + l = t[t[i0].f < t[i2].f ? i0++ : i2++]; + r = t[i0 != i1 && t[i0].f < t[i2].f ? i0++ : i2++]; + t[i1++] = { s: -1, f: l.f + r.f, l: l, r: r }; + } + var maxSym = t2[0].s; + for (var i = 1; i < s; ++i) { + if (t2[i].s > maxSym) + maxSym = t2[i].s; + } + // code lengths + var tr = new u16(maxSym + 1); + // max bits in tree + var mbt = ln(t[i1 - 1], tr, 0); + if (mbt > mb) { + // more algorithms from UZIP.js + // TODO: find out how this code works (debt) + // ind debt + var i = 0, dt = 0; + // left cost + var lft = mbt - mb, cst = 1 << lft; + t2.sort(function (a, b) { return tr[b.s] - tr[a.s] || a.f - b.f; }); + for (; i < s; ++i) { + var i2_1 = t2[i].s; + if (tr[i2_1] > mb) { + dt += cst - (1 << (mbt - tr[i2_1])); + tr[i2_1] = mb; + } + else + break; + } + dt >>= lft; + while (dt > 0) { + var i2_2 = t2[i].s; + if (tr[i2_2] < mb) + dt -= 1 << (mb - tr[i2_2]++ - 1); + else + ++i; + } + for (; i >= 0 && dt; --i) { + var i2_3 = t2[i].s; + if (tr[i2_3] == mb) { + --tr[i2_3]; + ++dt; + } + } + mbt = mb; + } + return { t: new u8(tr), l: mbt }; +}; +// get the max length and assign length codes +var ln = function (n, l, d) { + return n.s == -1 + ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1)) + : (l[n.s] = d); +}; +// length codes generation +var lc = function (c) { + var s = c.length; + // Note that the semicolon was intentional + while (s && !c[--s]) + ; + var cl = new u16(++s); + // ind num streak + var cli = 0, cln = c[0], cls = 1; + var w = function (v) { cl[cli++] = v; }; + for (var i = 1; i <= s; ++i) { + if (c[i] == cln && i != s) + ++cls; + else { + if (!cln && cls > 2) { + for (; cls > 138; cls -= 138) + w(32754); + if (cls > 2) { + w(cls > 10 ? ((cls - 11) << 5) | 28690 : ((cls - 3) << 5) | 12305); + cls = 0; + } + } + else if (cls > 3) { + w(cln), --cls; + for (; cls > 6; cls -= 6) + w(8304); + if (cls > 2) + w(((cls - 3) << 5) | 8208), cls = 0; + } + while (cls--) + w(cln); + cls = 1; + cln = c[i]; + } + } + return { c: cl.subarray(0, cli), n: s }; +}; +// calculate the length of output from tree, code lengths +var clen = function (cf, cl) { + var l = 0; + for (var i = 0; i < cl.length; ++i) + l += cf[i] * cl[i]; + return l; +}; +// writes a fixed block +// returns the new bit pos +var wfblk = function (out, pos, dat) { + // no need to write 00 as type: TypedArray defaults to 0 + var s = dat.length; + var o = shft(pos + 2); + out[o] = s & 255; + out[o + 1] = s >> 8; + out[o + 2] = out[o] ^ 255; + out[o + 3] = out[o + 1] ^ 255; + for (var i = 0; i < s; ++i) + out[o + i + 4] = dat[i]; + return (o + 4 + s) * 8; +}; +// writes a block +var wblk = function (dat, out, final, syms, lf, df, eb, li, bs, bl, p) { + wbits(out, p++, final); + ++lf[256]; + var _a = hTree(lf, 15), dlt = _a.t, mlb = _a.l; + var _b = hTree(df, 15), ddt = _b.t, mdb = _b.l; + var _c = lc(dlt), lclt = _c.c, nlc = _c.n; + var _d = lc(ddt), lcdt = _d.c, ndc = _d.n; + var lcfreq = new u16(19); + for (var i = 0; i < lclt.length; ++i) + ++lcfreq[lclt[i] & 31]; + for (var i = 0; i < lcdt.length; ++i) + ++lcfreq[lcdt[i] & 31]; + var _e = hTree(lcfreq, 7), lct = _e.t, mlcb = _e.l; + var nlcc = 19; + for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc) + ; + var flen = (bl + 5) << 3; + var ftlen = clen(lf, flt) + clen(df, fdt) + eb; + var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + 2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18]; + if (bs >= 0 && flen <= ftlen && flen <= dtlen) + return wfblk(out, p, dat.subarray(bs, bs + bl)); + var lm, ll, dm, dl; + wbits(out, p, 1 + (dtlen < ftlen)), p += 2; + if (dtlen < ftlen) { + lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt; + var llm = hMap(lct, mlcb, 0); + wbits(out, p, nlc - 257); + wbits(out, p + 5, ndc - 1); + wbits(out, p + 10, nlcc - 4); + p += 14; + for (var i = 0; i < nlcc; ++i) + wbits(out, p + 3 * i, lct[clim[i]]); + p += 3 * nlcc; + var lcts = [lclt, lcdt]; + for (var it = 0; it < 2; ++it) { + var clct = lcts[it]; + for (var i = 0; i < clct.length; ++i) { + var len = clct[i] & 31; + wbits(out, p, llm[len]), p += lct[len]; + if (len > 15) + wbits(out, p, (clct[i] >> 5) & 127), p += clct[i] >> 12; + } + } + } + else { + lm = flm, ll = flt, dm = fdm, dl = fdt; + } + for (var i = 0; i < li; ++i) { + var sym = syms[i]; + if (sym > 255) { + var len = (sym >> 18) & 31; + wbits16(out, p, lm[len + 257]), p += ll[len + 257]; + if (len > 7) + wbits(out, p, (sym >> 23) & 31), p += fleb[len]; + var dst = sym & 31; + wbits16(out, p, dm[dst]), p += dl[dst]; + if (dst > 3) + wbits16(out, p, (sym >> 5) & 8191), p += fdeb[dst]; + } + else { + wbits16(out, p, lm[sym]), p += ll[sym]; + } + } + wbits16(out, p, lm[256]); + return p + ll[256]; +}; +// deflate options (nice << 13) | chain +var deo = /*#__PURE__*/ new i32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]); +// empty +var et = /*#__PURE__*/ new u8(0); +// compresses data into a raw DEFLATE buffer +var dflt = function (dat, lvl, plvl, pre, post, st) { + var s = st.z || dat.length; + var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7000)) + post); + // writing to this writes to the output buffer + var w = o.subarray(pre, o.length - post); + var lst = st.l; + var pos = (st.r || 0) & 7; + if (lvl) { + if (pos) + w[0] = st.r >> 3; + var opt = deo[lvl - 1]; + var n = opt >> 13, c = opt & 8191; + var msk_1 = (1 << plvl) - 1; + // prev 2-byte val map curr 2-byte val map + var prev = st.p || new u16(32768), head = st.h || new u16(msk_1 + 1); + var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1; + var hsh = function (i) { return (dat[i] ^ (dat[i + 1] << bs1_1) ^ (dat[i + 2] << bs2_1)) & msk_1; }; + // 24576 is an arbitrary number of maximum symbols per block + // 424 buffer for last block + var syms = new i32(25000); + // length/literal freq distance freq + var lf = new u16(288), df = new u16(32); + // l/lcnt exbits index l/lind waitdx blkpos + var lc_1 = 0, eb = 0, i = st.i || 0, li = 0, wi = st.w || 0, bs = 0; + for (; i + 2 < s; ++i) { + // hash value + var hv = hsh(i); + // index mod 32768 previous index mod + var imod = i & 32767, pimod = head[hv]; + prev[imod] = pimod; + head[hv] = imod; + // We always should modify head and prev, but only add symbols if + // this data is not yet processed ("wait" for wait index) + if (wi <= i) { + // bytes remaining + var rem = s - i; + if ((lc_1 > 7000 || li > 24576) && (rem > 423 || !lst)) { + pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i - bs, pos); + li = lc_1 = eb = 0, bs = i; + for (var j = 0; j < 286; ++j) + lf[j] = 0; + for (var j = 0; j < 30; ++j) + df[j] = 0; + } + // len dist chain + var l = 2, d = 0, ch_1 = c, dif = imod - pimod & 32767; + if (rem > 2 && hv == hsh(i - dif)) { + var maxn = Math.min(n, rem) - 1; + var maxd = Math.min(32767, i); + // max possible length + // not capped at dif because decompressors implement "rolling" index population + var ml = Math.min(258, rem); + while (dif <= maxd && --ch_1 && imod != pimod) { + if (dat[i + l] == dat[i + l - dif]) { + var nl = 0; + for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl) + ; + if (nl > l) { + l = nl, d = dif; + // break out early when we reach "nice" (we are satisfied enough) + if (nl > maxn) + break; + // now, find the rarest 2-byte sequence within this + // length of literals and search for that instead. + // Much faster than just using the start + var mmd = Math.min(dif, nl - 2); + var md = 0; + for (var j = 0; j < mmd; ++j) { + var ti = i - dif + j & 32767; + var pti = prev[ti]; + var cd = ti - pti & 32767; + if (cd > md) + md = cd, pimod = ti; + } + } + } + // check the previous match + imod = pimod, pimod = prev[imod]; + dif += imod - pimod & 32767; + } + } + // d will be nonzero only when a match was found + if (d) { + // store both dist and len data in one int32 + // Make sure this is recognized as a len/dist with 28th bit (2^28) + syms[li++] = 268435456 | (revfl[l] << 18) | revfd[d]; + var lin = revfl[l] & 31, din = revfd[d] & 31; + eb += fleb[lin] + fdeb[din]; + ++lf[257 + lin]; + ++df[din]; + wi = i + l; + ++lc_1; + } + else { + syms[li++] = dat[i]; + ++lf[dat[i]]; + } + } + } + for (i = Math.max(i, wi); i < s; ++i) { + syms[li++] = dat[i]; + ++lf[dat[i]]; + } + pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i - bs, pos); + if (!lst) { + st.r = (pos & 7) | w[(pos / 8) | 0] << 3; + // shft(pos) now 1 less if pos & 7 != 0 + pos -= 7; + st.h = head, st.p = prev, st.i = i, st.w = wi; + } + } + else { + for (var i = st.w || 0; i < s + lst; i += 65535) { + // end + var e = i + 65535; + if (e >= s) { + // write final block + w[(pos / 8) | 0] = lst; + e = s; + } + pos = wfblk(w, pos + 1, dat.subarray(i, e)); + } + st.i = s; + } + return slc(o, 0, pre + shft(pos) + post); +}; +// CRC32 table +var crct = /*#__PURE__*/ (function () { + var t = new Int32Array(256); + for (var i = 0; i < 256; ++i) { + var c = i, k = 9; + while (--k) + c = ((c & 1) && -306674912) ^ (c >>> 1); + t[i] = c; + } + return t; +})(); +// CRC32 +var crc = function () { + var c = -1; + return { + p: function (d) { + // closures have awful performance + var cr = c; + for (var i = 0; i < d.length; ++i) + cr = crct[(cr & 255) ^ d[i]] ^ (cr >>> 8); + c = cr; + }, + d: function () { return ~c; } + }; +}; +// Adler32 +var adler = function () { + var a = 1, b = 0; + return { + p: function (d) { + // closures have awful performance + var n = a, m = b; + var l = d.length | 0; + for (var i = 0; i != l;) { + var e = Math.min(i + 2655, l); + for (; i < e; ++i) + m += n += d[i]; + n = (n & 65535) + 15 * (n >> 16), m = (m & 65535) + 15 * (m >> 16); + } + a = n, b = m; + }, + d: function () { + a %= 65521, b %= 65521; + return (a & 255) << 24 | (a & 0xFF00) << 8 | (b & 255) << 8 | (b >> 8); + } + }; +}; +; +// deflate with opts +var dopt = function (dat, opt, pre, post, st) { + if (!st) { + st = { l: 1 }; + if (opt.dictionary) { + var dict = opt.dictionary.subarray(-32768); + var newDat = new u8(dict.length + dat.length); + newDat.set(dict); + newDat.set(dat, dict.length); + dat = newDat; + st.w = dict.length; + } + } + return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? (st.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 20) : (12 + opt.mem), pre, post, st); +}; +// Walmart object spread +var mrg = function (a, b) { + var o = {}; + for (var k in a) + o[k] = a[k]; + for (var k in b) + o[k] = b[k]; + return o; +}; +// worker clone +// This is possibly the craziest part of the entire codebase, despite how simple it may seem. +// The only parameter to this function is a closure that returns an array of variables outside of the function scope. +// We're going to try to figure out the variable names used in the closure as strings because that is crucial for workerization. +// We will return an object mapping of true variable name to value (basically, the current scope as a JS object). +// The reason we can't just use the original variable names is minifiers mangling the toplevel scope. +// This took me three weeks to figure out how to do. +var wcln = function (fn, fnStr, td) { + var dt = fn(); + var st = fn.toString(); + var ks = st.slice(st.indexOf('[') + 1, st.lastIndexOf(']')).replace(/\s+/g, '').split(','); + for (var i = 0; i < dt.length; ++i) { + var v = dt[i], k = ks[i]; + if (typeof v == 'function') { + fnStr += ';' + k + '='; + var st_1 = v.toString(); + if (v.prototype) { + // for global objects + if (st_1.indexOf('[native code]') != -1) { + var spInd = st_1.indexOf(' ', 8) + 1; + fnStr += st_1.slice(spInd, st_1.indexOf('(', spInd)); + } + else { + fnStr += st_1; + for (var t in v.prototype) + fnStr += ';' + k + '.prototype.' + t + '=' + v.prototype[t].toString(); + } + } + else + fnStr += st_1; + } + else + td[k] = v; + } + return fnStr; +}; +var ch = []; +// clone bufs +var cbfs = function (v) { + var tl = []; + for (var k in v) { + if (v[k].buffer) { + tl.push((v[k] = new v[k].constructor(v[k])).buffer); + } + } + return tl; +}; +// use a worker to execute code +var wrkr = function (fns, init, id, cb) { + if (!ch[id]) { + var fnStr = '', td_1 = {}, m = fns.length - 1; + for (var i = 0; i < m; ++i) + fnStr = wcln(fns[i], fnStr, td_1); + ch[id] = { c: wcln(fns[m], fnStr, td_1), e: td_1 }; + } + var td = mrg({}, ch[id].e); + return wk(ch[id].c + ';onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=' + init.toString() + '}', id, td, cbfs(td), cb); +}; +// base async inflate fn +var bInflt = function () { return [u8, u16, i32, fleb, fdeb, clim, fl, fd, flrm, fdrm, rev, ec, hMap, max, bits, bits16, shft, slc, err, inflt, inflateSync, pbf, gopt]; }; +var bDflt = function () { return [u8, u16, i32, fleb, fdeb, clim, revfl, revfd, flm, flt, fdm, fdt, rev, deo, et, hMap, wbits, wbits16, hTree, ln, lc, clen, wfblk, wblk, shft, slc, dflt, dopt, deflateSync, pbf]; }; +// gzip extra +var gze = function () { return [gzh, gzhl, wbytes, crc, crct]; }; +// gunzip extra +var guze = function () { return [gzs, gzl]; }; +// zlib extra +var zle = function () { return [zlh, wbytes, adler]; }; +// unzlib extra +var zule = function () { return [zls]; }; +// post buf +var pbf = function (msg) { return postMessage(msg, [msg.buffer]); }; +// get opts +var gopt = function (o) { return o && { + out: o.size && new u8(o.size), + dictionary: o.dictionary +}; }; +// async helper +var cbify = function (dat, opts, fns, init, id, cb) { + var w = wrkr(fns, init, id, function (err, dat) { + w.terminate(); + cb(err, dat); + }); + w.postMessage([dat, opts], opts.consume ? [dat.buffer] : []); + return function () { w.terminate(); }; +}; +// auto stream +var astrm = function (strm) { + strm.ondata = function (dat, final) { return postMessage([dat, final], [dat.buffer]); }; + return function (ev) { + if (ev.data.length) { + strm.push(ev.data[0], ev.data[1]); + postMessage([ev.data[0].length]); + } + else + strm.flush(); + }; +}; +// async stream attach +var astrmify = function (fns, strm, opts, init, id, flush, ext) { + var t; + var w = wrkr(fns, init, id, function (err, dat) { + if (err) + w.terminate(), strm.ondata.call(strm, err); + else if (!Array.isArray(dat)) + ext(dat); + else if (dat.length == 1) { + strm.queuedSize -= dat[0]; + if (strm.ondrain) + strm.ondrain(dat[0]); + } + else { + if (dat[1]) + w.terminate(); + strm.ondata.call(strm, err, dat[0], dat[1]); + } + }); + w.postMessage(opts); + strm.queuedSize = 0; + strm.push = function (d, f) { + if (!strm.ondata) + err(5); + if (t) + strm.ondata(err(4, 0, 1), null, !!f); + strm.queuedSize += d.length; + w.postMessage([d, t = f], [d.buffer]); + }; + strm.terminate = function () { w.terminate(); }; + if (flush) { + strm.flush = function () { w.postMessage([]); }; + } +}; +// read 2 bytes +var b2 = function (d, b) { return d[b] | (d[b + 1] << 8); }; +// read 4 bytes +var b4 = function (d, b) { return (d[b] | (d[b + 1] << 8) | (d[b + 2] << 16) | (d[b + 3] << 24)) >>> 0; }; +var b8 = function (d, b) { return b4(d, b) + (b4(d, b + 4) * 4294967296); }; +// write bytes +var wbytes = function (d, b, v) { + for (; v; ++b) + d[b] = v, v >>>= 8; +}; +// gzip header +var gzh = function (c, o) { + var fn = o.filename; + c[0] = 31, c[1] = 139, c[2] = 8, c[8] = o.level < 2 ? 4 : o.level == 9 ? 2 : 0, c[9] = 3; // assume Unix + if (o.mtime != 0) + wbytes(c, 4, Math.floor(new Date(o.mtime || Date.now()) / 1000)); + if (fn) { + c[3] = 8; + for (var i = 0; i <= fn.length; ++i) + c[i + 10] = fn.charCodeAt(i); + } +}; +// gzip footer: -8 to -4 = CRC, -4 to -0 is length +// gzip start +var gzs = function (d) { + if (d[0] != 31 || d[1] != 139 || d[2] != 8) + err(6, 'invalid gzip data'); + var flg = d[3]; + var st = 10; + if (flg & 4) + st += (d[10] | d[11] << 8) + 2; + for (var zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++]) + ; + return st + (flg & 2); +}; +// gzip length +var gzl = function (d) { + var l = d.length; + return (d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16 | d[l - 1] << 24) >>> 0; +}; +// gzip header length +var gzhl = function (o) { return 10 + (o.filename ? o.filename.length + 1 : 0); }; +// zlib header +var zlh = function (c, o) { + var lv = o.level, fl = lv == 0 ? 0 : lv < 6 ? 1 : lv == 9 ? 3 : 2; + c[0] = 120, c[1] = (fl << 6) | (o.dictionary && 32); + c[1] |= 31 - ((c[0] << 8) | c[1]) % 31; + if (o.dictionary) { + var h = adler(); + h.p(o.dictionary); + wbytes(c, 2, h.d()); + } +}; +// zlib start +var zls = function (d, dict) { + if ((d[0] & 15) != 8 || (d[0] >> 4) > 7 || ((d[0] << 8 | d[1]) % 31)) + err(6, 'invalid zlib data'); + if ((d[1] >> 5 & 1) == +!dict) + err(6, 'invalid zlib data: ' + (d[1] & 32 ? 'need' : 'unexpected') + ' dictionary'); + return (d[1] >> 3 & 4) + 2; +}; +function StrmOpt(opts, cb) { + if (typeof opts == 'function') + cb = opts, opts = {}; + this.ondata = cb; + return opts; +} +/** + * Streaming DEFLATE compression + */ +var Deflate = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + function Deflate(opts, cb) { + if (typeof opts == 'function') + cb = opts, opts = {}; + this.ondata = cb; + this.o = opts || {}; + this.s = { l: 0, i: 32768, w: 32768, z: 32768 }; + // Buffer length must always be 0 mod 32768 for index calculations to be correct when modifying head and prev + // 98304 = 32768 (lookback) + 65536 (common chunk size) + this.b = new u8(98304); + if (this.o.dictionary) { + var dict = this.o.dictionary.subarray(-32768); + this.b.set(dict, 32768 - dict.length); + this.s.i = 32768 - dict.length; + } + } + Deflate.prototype.p = function (c, f) { + this.ondata(dopt(c, this.o, 0, 0, this.s), f); + }; + /** + * Pushes a chunk to be deflated + * @param chunk The chunk to push + * @param final Whether this is the last chunk + */ + Deflate.prototype.push = function (chunk, final) { + if (!this.ondata) + err(5); + if (this.s.l) + err(4); + var endLen = chunk.length + this.s.z; + if (endLen > this.b.length) { + if (endLen > 2 * this.b.length - 32768) { + var newBuf = new u8(endLen & -32768); + newBuf.set(this.b.subarray(0, this.s.z)); + this.b = newBuf; + } + var split = this.b.length - this.s.z; + this.b.set(chunk.subarray(0, split), this.s.z); + this.s.z = this.b.length; + this.p(this.b, false); + this.b.set(this.b.subarray(-32768)); + this.b.set(chunk.subarray(split), 32768); + this.s.z = chunk.length - split + 32768; + this.s.i = 32766, this.s.w = 32768; + } + else { + this.b.set(chunk, this.s.z); + this.s.z += chunk.length; + } + this.s.l = final & 1; + if (this.s.z > this.s.w + 8191 || final) { + this.p(this.b, final || false); + this.s.w = this.s.i, this.s.i -= 2; + } + }; + /** + * Flushes buffered uncompressed data. Useful to immediately retrieve the + * deflated output for small inputs. + */ + Deflate.prototype.flush = function () { + if (!this.ondata) + err(5); + if (this.s.l) + err(4); + this.p(this.b, false); + this.s.w = this.s.i, this.s.i -= 2; + }; + return Deflate; +}()))); + +/** + * Asynchronous streaming DEFLATE compression + */ +var AsyncDeflate = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + function AsyncDeflate(opts, cb) { + astrmify([ + bDflt, + function () { return [astrm, Deflate]; } + ], this, StrmOpt.call(this, opts, cb), function (ev) { + var strm = new Deflate(ev.data); + onmessage = astrm(strm); + }, 6, 1); + } + return AsyncDeflate; +}()))); + +function deflate(data, opts, cb) { + if (!cb) + cb = opts, opts = {}; + if (typeof cb != 'function') + err(7); + return cbify(data, opts, [ + bDflt, + ], function (ev) { return pbf(deflateSync(ev.data[0], ev.data[1])); }, 0, cb); +} +/** + * Compresses data with DEFLATE without any wrapper + * @param data The data to compress + * @param opts The compression options + * @returns The deflated version of the data + */ +function deflateSync(data, opts) { + return dopt(data, opts || {}, 0, 0); +} +/** + * Streaming DEFLATE decompression + */ +var Inflate = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + function Inflate(opts, cb) { + // no StrmOpt here to avoid adding to workerizer + if (typeof opts == 'function') + cb = opts, opts = {}; + this.ondata = cb; + var dict = opts && opts.dictionary && opts.dictionary.subarray(-32768); + this.s = { i: 0, b: dict ? dict.length : 0 }; + this.o = new u8(32768); + this.p = new u8(0); + if (dict) + this.o.set(dict); + } + Inflate.prototype.e = function (c) { + if (!this.ondata) + err(5); + if (this.d) + err(4); + if (!this.p.length) + this.p = c; + else if (c.length) { + var n = new u8(this.p.length + c.length); + n.set(this.p), n.set(c, this.p.length), this.p = n; + } + }; + Inflate.prototype.c = function (final) { + this.s.i = +(this.d = final || false); + var bts = this.s.b; + var dt = inflt(this.p, this.s, this.o); + this.ondata(slc(dt, bts, this.s.b), this.d); + this.o = slc(dt, this.s.b - 32768), this.s.b = this.o.length; + this.p = slc(this.p, (this.s.p / 8) | 0), this.s.p &= 7; + }; + /** + * Pushes a chunk to be inflated + * @param chunk The chunk to push + * @param final Whether this is the final chunk + */ + Inflate.prototype.push = function (chunk, final) { + this.e(chunk), this.c(final); + }; + return Inflate; +}()))); + +/** + * Asynchronous streaming DEFLATE decompression + */ +var AsyncInflate = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + function AsyncInflate(opts, cb) { + astrmify([ + bInflt, + function () { return [astrm, Inflate]; } + ], this, StrmOpt.call(this, opts, cb), function (ev) { + var strm = new Inflate(ev.data); + onmessage = astrm(strm); + }, 7, 0); + } + return AsyncInflate; +}()))); + +function inflate(data, opts, cb) { + if (!cb) + cb = opts, opts = {}; + if (typeof cb != 'function') + err(7); + return cbify(data, opts, [ + bInflt + ], function (ev) { return pbf(inflateSync(ev.data[0], gopt(ev.data[1]))); }, 1, cb); +} +/** + * Expands DEFLATE data with no wrapper + * @param data The data to decompress + * @param opts The decompression options + * @returns The decompressed version of the data + */ +function inflateSync(data, opts) { + return inflt(data, { i: 2 }, opts && opts.out, opts && opts.dictionary); +} +// before you yell at me for not just using extends, my reason is that TS inheritance is hard to workerize. +/** + * Streaming GZIP compression + */ +var Gzip = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + function Gzip(opts, cb) { + this.c = crc(); + this.l = 0; + this.v = 1; + Deflate.call(this, opts, cb); + } + /** + * Pushes a chunk to be GZIPped + * @param chunk The chunk to push + * @param final Whether this is the last chunk + */ + Gzip.prototype.push = function (chunk, final) { + this.c.p(chunk); + this.l += chunk.length; + Deflate.prototype.push.call(this, chunk, final); + }; + Gzip.prototype.p = function (c, f) { + var raw = dopt(c, this.o, this.v && gzhl(this.o), f && 8, this.s); + if (this.v) + gzh(raw, this.o), this.v = 0; + if (f) + wbytes(raw, raw.length - 8, this.c.d()), wbytes(raw, raw.length - 4, this.l); + this.ondata(raw, f); + }; + /** + * Flushes buffered uncompressed data. Useful to immediately retrieve the + * GZIPped output for small inputs. + */ + Gzip.prototype.flush = function () { + Deflate.prototype.flush.call(this); + }; + return Gzip; +}()))); + +/** + * Asynchronous streaming GZIP compression + */ +var AsyncGzip = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + function AsyncGzip(opts, cb) { + astrmify([ + bDflt, + gze, + function () { return [astrm, Deflate, Gzip]; } + ], this, StrmOpt.call(this, opts, cb), function (ev) { + var strm = new Gzip(ev.data); + onmessage = astrm(strm); + }, 8, 1); + } + return AsyncGzip; +}()))); + +function gzip(data, opts, cb) { + if (!cb) + cb = opts, opts = {}; + if (typeof cb != 'function') + err(7); + return cbify(data, opts, [ + bDflt, + gze, + function () { return [gzipSync]; } + ], function (ev) { return pbf(gzipSync(ev.data[0], ev.data[1])); }, 2, cb); +} +/** + * Compresses data with GZIP + * @param data The data to compress + * @param opts The compression options + * @returns The gzipped version of the data + */ +function gzipSync(data, opts) { + if (!opts) + opts = {}; + var c = crc(), l = data.length; + c.p(data); + var d = dopt(data, opts, gzhl(opts), 8), s = d.length; + return gzh(d, opts), wbytes(d, s - 8, c.d()), wbytes(d, s - 4, l), d; +} +/** + * Streaming single or multi-member GZIP decompression + */ +var Gunzip = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + function Gunzip(opts, cb) { + this.v = 1; + this.r = 0; + Inflate.call(this, opts, cb); + } + /** + * Pushes a chunk to be GUNZIPped + * @param chunk The chunk to push + * @param final Whether this is the last chunk + */ + Gunzip.prototype.push = function (chunk, final) { + Inflate.prototype.e.call(this, chunk); + this.r += chunk.length; + if (this.v) { + var p = this.p.subarray(this.v - 1); + var s = p.length > 3 ? gzs(p) : 4; + if (s > p.length) { + if (!final) + return; + } + else if (this.v > 1 && this.onmember) { + this.onmember(this.r - p.length); + } + this.p = p.subarray(s), this.v = 0; + } + // necessary to prevent TS from using the closure value + // This allows for workerization to function correctly + Inflate.prototype.c.call(this, final); + // process concatenated GZIP + if (this.s.f && !this.s.l && !final) { + this.v = shft(this.s.p) + 9; + this.s = { i: 0 }; + this.o = new u8(0); + this.push(new u8(0), final); + } + }; + return Gunzip; +}()))); + +/** + * Asynchronous streaming single or multi-member GZIP decompression + */ +var AsyncGunzip = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + function AsyncGunzip(opts, cb) { + var _this = this; + astrmify([ + bInflt, + guze, + function () { return [astrm, Inflate, Gunzip]; } + ], this, StrmOpt.call(this, opts, cb), function (ev) { + var strm = new Gunzip(ev.data); + strm.onmember = function (offset) { return postMessage(offset); }; + onmessage = astrm(strm); + }, 9, 0, function (offset) { return _this.onmember && _this.onmember(offset); }); + } + return AsyncGunzip; +}()))); + +function gunzip(data, opts, cb) { + if (!cb) + cb = opts, opts = {}; + if (typeof cb != 'function') + err(7); + return cbify(data, opts, [ + bInflt, + guze, + function () { return [gunzipSync]; } + ], function (ev) { return pbf(gunzipSync(ev.data[0], ev.data[1])); }, 3, cb); +} +/** + * Expands GZIP data + * @param data The data to decompress + * @param opts The decompression options + * @returns The decompressed version of the data + */ +function gunzipSync(data, opts) { + var st = gzs(data); + if (st + 8 > data.length) + err(6, 'invalid gzip data'); + return inflt(data.subarray(st, -8), { i: 2 }, opts && opts.out || new u8(gzl(data)), opts && opts.dictionary); +} +/** + * Streaming Zlib compression + */ +var Zlib = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + function Zlib(opts, cb) { + this.c = adler(); + this.v = 1; + Deflate.call(this, opts, cb); + } + /** + * Pushes a chunk to be zlibbed + * @param chunk The chunk to push + * @param final Whether this is the last chunk + */ + Zlib.prototype.push = function (chunk, final) { + this.c.p(chunk); + Deflate.prototype.push.call(this, chunk, final); + }; + Zlib.prototype.p = function (c, f) { + var raw = dopt(c, this.o, this.v && (this.o.dictionary ? 6 : 2), f && 4, this.s); + if (this.v) + zlh(raw, this.o), this.v = 0; + if (f) + wbytes(raw, raw.length - 4, this.c.d()); + this.ondata(raw, f); + }; + /** + * Flushes buffered uncompressed data. Useful to immediately retrieve the + * zlibbed output for small inputs. + */ + Zlib.prototype.flush = function () { + Deflate.prototype.flush.call(this); + }; + return Zlib; +}()))); + +/** + * Asynchronous streaming Zlib compression + */ +var AsyncZlib = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + function AsyncZlib(opts, cb) { + astrmify([ + bDflt, + zle, + function () { return [astrm, Deflate, Zlib]; } + ], this, StrmOpt.call(this, opts, cb), function (ev) { + var strm = new Zlib(ev.data); + onmessage = astrm(strm); + }, 10, 1); + } + return AsyncZlib; +}()))); + +function zlib(data, opts, cb) { + if (!cb) + cb = opts, opts = {}; + if (typeof cb != 'function') + err(7); + return cbify(data, opts, [ + bDflt, + zle, + function () { return [zlibSync]; } + ], function (ev) { return pbf(zlibSync(ev.data[0], ev.data[1])); }, 4, cb); +} +/** + * Compress data with Zlib + * @param data The data to compress + * @param opts The compression options + * @returns The zlib-compressed version of the data + */ +function zlibSync(data, opts) { + if (!opts) + opts = {}; + var a = adler(); + a.p(data); + var d = dopt(data, opts, opts.dictionary ? 6 : 2, 4); + return zlh(d, opts), wbytes(d, d.length - 4, a.d()), d; +} +/** + * Streaming Zlib decompression + */ +var Unzlib = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + function Unzlib(opts, cb) { + Inflate.call(this, opts, cb); + this.v = opts && opts.dictionary ? 2 : 1; + } + /** + * Pushes a chunk to be unzlibbed + * @param chunk The chunk to push + * @param final Whether this is the last chunk + */ + Unzlib.prototype.push = function (chunk, final) { + Inflate.prototype.e.call(this, chunk); + if (this.v) { + if (this.p.length < 6 && !final) + return; + this.p = this.p.subarray(zls(this.p, this.v - 1)), this.v = 0; + } + if (final) { + if (this.p.length < 4) + err(6, 'invalid zlib data'); + this.p = this.p.subarray(0, -4); + } + // necessary to prevent TS from using the closure value + // This allows for workerization to function correctly + Inflate.prototype.c.call(this, final); + }; + return Unzlib; +}()))); + +/** + * Asynchronous streaming Zlib decompression + */ +var AsyncUnzlib = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + function AsyncUnzlib(opts, cb) { + astrmify([ + bInflt, + zule, + function () { return [astrm, Inflate, Unzlib]; } + ], this, StrmOpt.call(this, opts, cb), function (ev) { + var strm = new Unzlib(ev.data); + onmessage = astrm(strm); + }, 11, 0); + } + return AsyncUnzlib; +}()))); + +function unzlib(data, opts, cb) { + if (!cb) + cb = opts, opts = {}; + if (typeof cb != 'function') + err(7); + return cbify(data, opts, [ + bInflt, + zule, + function () { return [unzlibSync]; } + ], function (ev) { return pbf(unzlibSync(ev.data[0], gopt(ev.data[1]))); }, 5, cb); +} +/** + * Expands Zlib data + * @param data The data to decompress + * @param opts The decompression options + * @returns The decompressed version of the data + */ +function unzlibSync(data, opts) { + return inflt(data.subarray(zls(data, opts && opts.dictionary), -4), { i: 2 }, opts && opts.out, opts && opts.dictionary); +} +// Default algorithm for compression (used because having a known output size allows faster decompression) + + +/** + * Streaming GZIP, Zlib, or raw DEFLATE decompression + */ +var Decompress = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + function Decompress(opts, cb) { + this.o = StrmOpt.call(this, opts, cb) || {}; + this.G = Gunzip; + this.I = Inflate; + this.Z = Unzlib; + } + // init substream + // overriden by AsyncDecompress + Decompress.prototype.i = function () { + var _this = this; + this.s.ondata = function (dat, final) { + _this.ondata(dat, final); + }; + }; + /** + * Pushes a chunk to be decompressed + * @param chunk The chunk to push + * @param final Whether this is the last chunk + */ + Decompress.prototype.push = function (chunk, final) { + if (!this.ondata) + err(5); + if (!this.s) { + if (this.p && this.p.length) { + var n = new u8(this.p.length + chunk.length); + n.set(this.p), n.set(chunk, this.p.length); + } + else + this.p = chunk; + if (this.p.length > 2) { + this.s = (this.p[0] == 31 && this.p[1] == 139 && this.p[2] == 8) + ? new this.G(this.o) + : ((this.p[0] & 15) != 8 || (this.p[0] >> 4) > 7 || ((this.p[0] << 8 | this.p[1]) % 31)) + ? new this.I(this.o) + : new this.Z(this.o); + this.i(); + this.s.push(this.p, final); + this.p = null; + } + } + else + this.s.push(chunk, final); + }; + return Decompress; +}()))); + +/** + * Asynchronous streaming GZIP, Zlib, or raw DEFLATE decompression + */ +var AsyncDecompress = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + function AsyncDecompress(opts, cb) { + Decompress.call(this, opts, cb); + this.queuedSize = 0; + this.G = AsyncGunzip; + this.I = AsyncInflate; + this.Z = AsyncUnzlib; + } + AsyncDecompress.prototype.i = function () { + var _this = this; + this.s.ondata = function (err, dat, final) { + _this.ondata(err, dat, final); + }; + this.s.ondrain = function (size) { + _this.queuedSize -= size; + if (_this.ondrain) + _this.ondrain(size); + }; + }; + /** + * Pushes a chunk to be decompressed + * @param chunk The chunk to push + * @param final Whether this is the last chunk + */ + AsyncDecompress.prototype.push = function (chunk, final) { + this.queuedSize += chunk.length; + Decompress.prototype.push.call(this, chunk, final); + }; + return AsyncDecompress; +}()))); + +function decompress(data, opts, cb) { + if (!cb) + cb = opts, opts = {}; + if (typeof cb != 'function') + err(7); + return (data[0] == 31 && data[1] == 139 && data[2] == 8) + ? gunzip(data, opts, cb) + : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31)) + ? inflate(data, opts, cb) + : unzlib(data, opts, cb); +} +/** + * Expands compressed GZIP, Zlib, or raw DEFLATE data, automatically detecting the format + * @param data The data to decompress + * @param opts The decompression options + * @returns The decompressed version of the data + */ +function decompressSync(data, opts) { + return (data[0] == 31 && data[1] == 139 && data[2] == 8) + ? gunzipSync(data, opts) + : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31)) + ? inflateSync(data, opts) + : unzlibSync(data, opts); +} +// flatten a directory structure +var fltn = function (d, p, t, o) { + for (var k in d) { + var val = d[k], n = p + k, op = o; + if (Array.isArray(val)) + op = mrg(o, val[1]), val = val[0]; + if (val instanceof u8) + t[n] = [val, op]; + else { + t[n += '/'] = [new u8(0), op]; + fltn(val, n, t, o); + } + } +}; +// text encoder +var te = typeof TextEncoder != 'undefined' && /*#__PURE__*/ new TextEncoder(); +// text decoder +var td = typeof TextDecoder != 'undefined' && /*#__PURE__*/ new TextDecoder(); +// text decoder stream +var tds = 0; +try { + td.decode(et, { stream: true }); + tds = 1; +} +catch (e) { } +// decode UTF8 +var dutf8 = function (d) { + for (var r = '', i = 0;;) { + var c = d[i++]; + var eb = (c > 127) + (c > 223) + (c > 239); + if (i + eb > d.length) + return { s: r, r: slc(d, i - 1) }; + if (!eb) + r += String.fromCharCode(c); + else if (eb == 3) { + c = ((c & 15) << 18 | (d[i++] & 63) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63)) - 65536, + r += String.fromCharCode(55296 | (c >> 10), 56320 | (c & 1023)); + } + else if (eb & 1) + r += String.fromCharCode((c & 31) << 6 | (d[i++] & 63)); + else + r += String.fromCharCode((c & 15) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63)); + } +}; +/** + * Streaming UTF-8 decoding + */ +var DecodeUTF8 = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + /** + * Creates a UTF-8 decoding stream + * @param cb The callback to call whenever data is decoded + */ + function DecodeUTF8(cb) { + this.ondata = cb; + if (tds) + this.t = new TextDecoder(); + else + this.p = et; + } + /** + * Pushes a chunk to be decoded from UTF-8 binary + * @param chunk The chunk to push + * @param final Whether this is the last chunk + */ + DecodeUTF8.prototype.push = function (chunk, final) { + if (!this.ondata) + err(5); + final = !!final; + if (this.t) { + this.ondata(this.t.decode(chunk, { stream: true }), final); + if (final) { + if (this.t.decode().length) + err(8); + this.t = null; + } + return; + } + if (!this.p) + err(4); + var dat = new u8(this.p.length + chunk.length); + dat.set(this.p); + dat.set(chunk, this.p.length); + var _a = dutf8(dat), s = _a.s, r = _a.r; + if (final) { + if (r.length) + err(8); + this.p = null; + } + else + this.p = r; + this.ondata(s, final); + }; + return DecodeUTF8; +}()))); + +/** + * Streaming UTF-8 encoding + */ +var EncodeUTF8 = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + /** + * Creates a UTF-8 decoding stream + * @param cb The callback to call whenever data is encoded + */ + function EncodeUTF8(cb) { + this.ondata = cb; + } + /** + * Pushes a chunk to be encoded to UTF-8 + * @param chunk The string data to push + * @param final Whether this is the last chunk + */ + EncodeUTF8.prototype.push = function (chunk, final) { + if (!this.ondata) + err(5); + if (this.d) + err(4); + this.ondata(strToU8(chunk), this.d = final || false); + }; + return EncodeUTF8; +}()))); + +/** + * Converts a string into a Uint8Array for use with compression/decompression methods + * @param str The string to encode + * @param latin1 Whether or not to interpret the data as Latin-1. This should + * not need to be true unless decoding a binary string. + * @returns The string encoded in UTF-8/Latin-1 binary + */ +function strToU8(str, latin1) { + if (latin1) { + var ar_1 = new u8(str.length); + for (var i = 0; i < str.length; ++i) + ar_1[i] = str.charCodeAt(i); + return ar_1; + } + if (te) + return te.encode(str); + var l = str.length; + var ar = new u8(str.length + (str.length >> 1)); + var ai = 0; + var w = function (v) { ar[ai++] = v; }; + for (var i = 0; i < l; ++i) { + if (ai + 5 > ar.length) { + var n = new u8(ai + 8 + ((l - i) << 1)); + n.set(ar); + ar = n; + } + var c = str.charCodeAt(i); + if (c < 128 || latin1) + w(c); + else if (c < 2048) + w(192 | (c >> 6)), w(128 | (c & 63)); + else if (c > 55295 && c < 57344) + c = 65536 + (c & 1023 << 10) | (str.charCodeAt(++i) & 1023), + w(240 | (c >> 18)), w(128 | ((c >> 12) & 63)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63)); + else + w(224 | (c >> 12)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63)); + } + return slc(ar, 0, ai); +} +/** + * Converts a Uint8Array to a string + * @param dat The data to decode to string + * @param latin1 Whether or not to interpret the data as Latin-1. This should + * not need to be true unless encoding to binary string. + * @returns The original UTF-8/Latin-1 string + */ +function strFromU8(dat, latin1) { + if (latin1) { + var r = ''; + for (var i = 0; i < dat.length; i += 16384) + r += String.fromCharCode.apply(null, dat.subarray(i, i + 16384)); + return r; + } + else if (td) { + return td.decode(dat); + } + else { + var _a = dutf8(dat), s = _a.s, r = _a.r; + if (r.length) + err(8); + return s; + } +} +; +// deflate bit flag +var dbf = function (l) { return l == 1 ? 3 : l < 6 ? 2 : l == 9 ? 1 : 0; }; +// skip local zip header +var slzh = function (d, b) { return b + 30 + b2(d, b + 26) + b2(d, b + 28); }; +// read zip header +var zh = function (d, b, z) { + var fnl = b2(d, b + 28), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl, bs = b4(d, b + 20); + var _a = z && bs == 4294967295 ? z64e(d, es) : [bs, b4(d, b + 24), b4(d, b + 42)], sc = _a[0], su = _a[1], off = _a[2]; + return [b2(d, b + 10), sc, su, fn, es + b2(d, b + 30) + b2(d, b + 32), off]; +}; +// read zip64 extra field +var z64e = function (d, b) { + for (; b2(d, b) != 1; b += 4 + b2(d, b + 2)) + ; + return [b8(d, b + 12), b8(d, b + 4), b8(d, b + 20)]; +}; +// extra field length +var exfl = function (ex) { + var le = 0; + if (ex) { + for (var k in ex) { + var l = ex[k].length; + if (l > 65535) + err(9); + le += l + 4; + } + } + return le; +}; +// write zip header +var wzh = function (d, b, f, fn, u, c, ce, co) { + var fl = fn.length, ex = f.extra, col = co && co.length; + var exl = exfl(ex); + wbytes(d, b, ce != null ? 0x2014B50 : 0x4034B50), b += 4; + if (ce != null) + d[b++] = 20, d[b++] = f.os; + d[b] = 20, b += 2; // spec compliance? what's that? + d[b++] = (f.flag << 1) | (c < 0 && 8), d[b++] = u && 8; + d[b++] = f.compression & 255, d[b++] = f.compression >> 8; + var dt = new Date(f.mtime == null ? Date.now() : f.mtime), y = dt.getFullYear() - 1980; + if (y < 0 || y > 119) + err(10); + wbytes(d, b, (y << 25) | ((dt.getMonth() + 1) << 21) | (dt.getDate() << 16) | (dt.getHours() << 11) | (dt.getMinutes() << 5) | (dt.getSeconds() >> 1)), b += 4; + if (c != -1) { + wbytes(d, b, f.crc); + wbytes(d, b + 4, c < 0 ? -c - 2 : c); + wbytes(d, b + 8, f.size); + } + wbytes(d, b + 12, fl); + wbytes(d, b + 14, exl), b += 16; + if (ce != null) { + wbytes(d, b, col); + wbytes(d, b + 6, f.attrs); + wbytes(d, b + 10, ce), b += 14; + } + d.set(fn, b); + b += fl; + if (exl) { + for (var k in ex) { + var exf = ex[k], l = exf.length; + wbytes(d, b, +k); + wbytes(d, b + 2, l); + d.set(exf, b + 4), b += 4 + l; + } + } + if (col) + d.set(co, b), b += col; + return b; +}; +// write zip footer (end of central directory) +var wzf = function (o, b, c, d, e) { + wbytes(o, b, 0x6054B50); // skip disk + wbytes(o, b + 8, c); + wbytes(o, b + 10, c); + wbytes(o, b + 12, d); + wbytes(o, b + 16, e); +}; +/** + * A pass-through stream to keep data uncompressed in a ZIP archive. + */ +var ZipPassThrough = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + /** + * Creates a pass-through stream that can be added to ZIP archives + * @param filename The filename to associate with this data stream + */ + function ZipPassThrough(filename) { + this.filename = filename; + this.c = crc(); + this.size = 0; + this.compression = 0; + } + /** + * Processes a chunk and pushes to the output stream. You can override this + * method in a subclass for custom behavior, but by default this passes + * the data through. You must call this.ondata(err, chunk, final) at some + * point in this method. + * @param chunk The chunk to process + * @param final Whether this is the last chunk + */ + ZipPassThrough.prototype.process = function (chunk, final) { + this.ondata(null, chunk, final); + }; + /** + * Pushes a chunk to be added. If you are subclassing this with a custom + * compression algorithm, note that you must push data from the source + * file only, pre-compression. + * @param chunk The chunk to push + * @param final Whether this is the last chunk + */ + ZipPassThrough.prototype.push = function (chunk, final) { + if (!this.ondata) + err(5); + this.c.p(chunk); + this.size += chunk.length; + if (final) + this.crc = this.c.d(); + this.process(chunk, final || false); + }; + return ZipPassThrough; +}()))); + +// I don't extend because TypeScript extension adds 1kB of runtime bloat +/** + * Streaming DEFLATE compression for ZIP archives. Prefer using AsyncZipDeflate + * for better performance + */ +var ZipDeflate = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + /** + * Creates a DEFLATE stream that can be added to ZIP archives + * @param filename The filename to associate with this data stream + * @param opts The compression options + */ + function ZipDeflate(filename, opts) { + var _this = this; + if (!opts) + opts = {}; + ZipPassThrough.call(this, filename); + this.d = new Deflate(opts, function (dat, final) { + _this.ondata(null, dat, final); + }); + this.compression = 8; + this.flag = dbf(opts.level); + } + ZipDeflate.prototype.process = function (chunk, final) { + try { + this.d.push(chunk, final); + } + catch (e) { + this.ondata(e, null, final); + } + }; + /** + * Pushes a chunk to be deflated + * @param chunk The chunk to push + * @param final Whether this is the last chunk + */ + ZipDeflate.prototype.push = function (chunk, final) { + ZipPassThrough.prototype.push.call(this, chunk, final); + }; + return ZipDeflate; +}()))); + +/** + * Asynchronous streaming DEFLATE compression for ZIP archives + */ +var AsyncZipDeflate = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + /** + * Creates an asynchronous DEFLATE stream that can be added to ZIP archives + * @param filename The filename to associate with this data stream + * @param opts The compression options + */ + function AsyncZipDeflate(filename, opts) { + var _this = this; + if (!opts) + opts = {}; + ZipPassThrough.call(this, filename); + this.d = new AsyncDeflate(opts, function (err, dat, final) { + _this.ondata(err, dat, final); + }); + this.compression = 8; + this.flag = dbf(opts.level); + this.terminate = this.d.terminate; + } + AsyncZipDeflate.prototype.process = function (chunk, final) { + this.d.push(chunk, final); + }; + /** + * Pushes a chunk to be deflated + * @param chunk The chunk to push + * @param final Whether this is the last chunk + */ + AsyncZipDeflate.prototype.push = function (chunk, final) { + ZipPassThrough.prototype.push.call(this, chunk, final); + }; + return AsyncZipDeflate; +}()))); + +// TODO: Better tree shaking +/** + * A zippable archive to which files can incrementally be added + */ +var Zip = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + /** + * Creates an empty ZIP archive to which files can be added + * @param cb The callback to call whenever data for the generated ZIP archive + * is available + */ + function Zip(cb) { + this.ondata = cb; + this.u = []; + this.d = 1; + } + /** + * Adds a file to the ZIP archive + * @param file The file stream to add + */ + Zip.prototype.add = function (file) { + var _this = this; + if (!this.ondata) + err(5); + // finishing or finished + if (this.d & 2) + this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, false); + else { + var f = strToU8(file.filename), fl_1 = f.length; + var com = file.comment, o = com && strToU8(com); + var u = fl_1 != file.filename.length || (o && (com.length != o.length)); + var hl_1 = fl_1 + exfl(file.extra) + 30; + if (fl_1 > 65535) + this.ondata(err(11, 0, 1), null, false); + var header = new u8(hl_1); + wzh(header, 0, file, f, u, -1); + var chks_1 = [header]; + var pAll_1 = function () { + for (var _i = 0, chks_2 = chks_1; _i < chks_2.length; _i++) { + var chk = chks_2[_i]; + _this.ondata(null, chk, false); + } + chks_1 = []; + }; + var tr_1 = this.d; + this.d = 0; + var ind_1 = this.u.length; + var uf_1 = mrg(file, { + f: f, + u: u, + o: o, + t: function () { + if (file.terminate) + file.terminate(); + }, + r: function () { + pAll_1(); + if (tr_1) { + var nxt = _this.u[ind_1 + 1]; + if (nxt) + nxt.r(); + else + _this.d = 1; + } + tr_1 = 1; + } + }); + var cl_1 = 0; + file.ondata = function (err, dat, final) { + if (err) { + _this.ondata(err, dat, final); + _this.terminate(); + } + else { + cl_1 += dat.length; + chks_1.push(dat); + if (final) { + var dd = new u8(16); + wbytes(dd, 0, 0x8074B50); + wbytes(dd, 4, file.crc); + wbytes(dd, 8, cl_1); + wbytes(dd, 12, file.size); + chks_1.push(dd); + uf_1.c = cl_1, uf_1.b = hl_1 + cl_1 + 16, uf_1.crc = file.crc, uf_1.size = file.size; + if (tr_1) + uf_1.r(); + tr_1 = 1; + } + else if (tr_1) + pAll_1(); + } + }; + this.u.push(uf_1); + } + }; + /** + * Ends the process of adding files and prepares to emit the final chunks. + * This *must* be called after adding all desired files for the resulting + * ZIP file to work properly. + */ + Zip.prototype.end = function () { + var _this = this; + if (this.d & 2) { + this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, true); + return; + } + if (this.d) + this.e(); + else + this.u.push({ + r: function () { + if (!(_this.d & 1)) + return; + _this.u.splice(-1, 1); + _this.e(); + }, + t: function () { } + }); + this.d = 3; + }; + Zip.prototype.e = function () { + var bt = 0, l = 0, tl = 0; + for (var _i = 0, _a = this.u; _i < _a.length; _i++) { + var f = _a[_i]; + tl += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0); + } + var out = new u8(tl + 22); + for (var _b = 0, _c = this.u; _b < _c.length; _b++) { + var f = _c[_b]; + wzh(out, bt, f, f.f, f.u, -f.c - 2, l, f.o); + bt += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0), l += f.b; + } + wzf(out, bt, this.u.length, tl, l); + this.ondata(null, out, true); + this.d = 2; + }; + /** + * A method to terminate any internal workers used by the stream. Subsequent + * calls to add() will fail. + */ + Zip.prototype.terminate = function () { + for (var _i = 0, _a = this.u; _i < _a.length; _i++) { + var f = _a[_i]; + f.t(); + } + this.d = 2; + }; + return Zip; +}()))); + +function zip(data, opts, cb) { + if (!cb) + cb = opts, opts = {}; + if (typeof cb != 'function') + err(7); + var r = {}; + fltn(data, '', r, opts); + var k = Object.keys(r); + var lft = k.length, o = 0, tot = 0; + var slft = lft, files = new Array(lft); + var term = []; + var tAll = function () { + for (var i = 0; i < term.length; ++i) + term[i](); + }; + var cbd = function (a, b) { + mt(function () { cb(a, b); }); + }; + mt(function () { cbd = cb; }); + var cbf = function () { + var out = new u8(tot + 22), oe = o, cdl = tot - o; + tot = 0; + for (var i = 0; i < slft; ++i) { + var f = files[i]; + try { + var l = f.c.length; + wzh(out, tot, f, f.f, f.u, l); + var badd = 30 + f.f.length + exfl(f.extra); + var loc = tot + badd; + out.set(f.c, loc); + wzh(out, o, f, f.f, f.u, l, tot, f.m), o += 16 + badd + (f.m ? f.m.length : 0), tot = loc + l; + } + catch (e) { + return cbd(e, null); + } + } + wzf(out, o, files.length, cdl, oe); + cbd(null, out); + }; + if (!lft) + cbf(); + var _loop_1 = function (i) { + var fn = k[i]; + var _a = r[fn], file = _a[0], p = _a[1]; + var c = crc(), size = file.length; + c.p(file); + var f = strToU8(fn), s = f.length; + var com = p.comment, m = com && strToU8(com), ms = m && m.length; + var exl = exfl(p.extra); + var compression = p.level == 0 ? 0 : 8; + var cbl = function (e, d) { + if (e) { + tAll(); + cbd(e, null); + } + else { + var l = d.length; + files[i] = mrg(p, { + size: size, + crc: c.d(), + c: d, + f: f, + m: m, + u: s != fn.length || (m && (com.length != ms)), + compression: compression + }); + o += 30 + s + exl + l; + tot += 76 + 2 * (s + exl) + (ms || 0) + l; + if (!--lft) + cbf(); + } + }; + if (s > 65535) + cbl(err(11, 0, 1), null); + if (!compression) + cbl(null, file); + else if (size < 160000) { + try { + cbl(null, deflateSync(file, p)); + } + catch (e) { + cbl(e, null); + } + } + else + term.push(deflate(file, p, cbl)); + }; + // Cannot use lft because it can decrease + for (var i = 0; i < slft; ++i) { + _loop_1(i); + } + return tAll; +} +/** + * Synchronously creates a ZIP file. Prefer using `zip` for better performance + * with more than one file. + * @param data The directory structure for the ZIP archive + * @param opts The main options, merged with per-file options + * @returns The generated ZIP archive + */ +function zipSync(data, opts) { + if (!opts) + opts = {}; + var r = {}; + var files = []; + fltn(data, '', r, opts); + var o = 0; + var tot = 0; + for (var fn in r) { + var _a = r[fn], file = _a[0], p = _a[1]; + var compression = p.level == 0 ? 0 : 8; + var f = strToU8(fn), s = f.length; + var com = p.comment, m = com && strToU8(com), ms = m && m.length; + var exl = exfl(p.extra); + if (s > 65535) + err(11); + var d = compression ? deflateSync(file, p) : file, l = d.length; + var c = crc(); + c.p(file); + files.push(mrg(p, { + size: file.length, + crc: c.d(), + c: d, + f: f, + m: m, + u: s != fn.length || (m && (com.length != ms)), + o: o, + compression: compression + })); + o += 30 + s + exl + l; + tot += 76 + 2 * (s + exl) + (ms || 0) + l; + } + var out = new u8(tot + 22), oe = o, cdl = tot - o; + for (var i = 0; i < files.length; ++i) { + var f = files[i]; + wzh(out, f.o, f, f.f, f.u, f.c.length); + var badd = 30 + f.f.length + exfl(f.extra); + out.set(f.c, f.o + badd); + wzh(out, o, f, f.f, f.u, f.c.length, f.o, f.m), o += 16 + badd + (f.m ? f.m.length : 0); + } + wzf(out, o, files.length, cdl, oe); + return out; +} +/** + * Streaming pass-through decompression for ZIP archives + */ +var UnzipPassThrough = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + function UnzipPassThrough() { + } + UnzipPassThrough.prototype.push = function (data, final) { + this.ondata(null, data, final); + }; + UnzipPassThrough.compression = 0; + return UnzipPassThrough; +}()))); + +/** + * Streaming DEFLATE decompression for ZIP archives. Prefer AsyncZipInflate for + * better performance. + */ +var UnzipInflate = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + /** + * Creates a DEFLATE decompression that can be used in ZIP archives + */ + function UnzipInflate() { + var _this = this; + this.i = new Inflate(function (dat, final) { + _this.ondata(null, dat, final); + }); + } + UnzipInflate.prototype.push = function (data, final) { + try { + this.i.push(data, final); + } + catch (e) { + this.ondata(e, null, final); + } + }; + UnzipInflate.compression = 8; + return UnzipInflate; +}()))); + +/** + * Asynchronous streaming DEFLATE decompression for ZIP archives + */ +var AsyncUnzipInflate = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + /** + * Creates a DEFLATE decompression that can be used in ZIP archives + */ + function AsyncUnzipInflate(_, sz) { + var _this = this; + if (sz < 320000) { + this.i = new Inflate(function (dat, final) { + _this.ondata(null, dat, final); + }); + } + else { + this.i = new AsyncInflate(function (err, dat, final) { + _this.ondata(err, dat, final); + }); + this.terminate = this.i.terminate; + } + } + AsyncUnzipInflate.prototype.push = function (data, final) { + if (this.i.terminate) + data = slc(data, 0); + this.i.push(data, final); + }; + AsyncUnzipInflate.compression = 8; + return AsyncUnzipInflate; +}()))); + +/** + * A ZIP archive decompression stream that emits files as they are discovered + */ +var Unzip = /*#__PURE__*/ ((/* unused pure expression or super */ null && (function () { + /** + * Creates a ZIP decompression stream + * @param cb The callback to call whenever a file in the ZIP archive is found + */ + function Unzip(cb) { + this.onfile = cb; + this.k = []; + this.o = { + 0: UnzipPassThrough + }; + this.p = et; + } + /** + * Pushes a chunk to be unzipped + * @param chunk The chunk to push + * @param final Whether this is the last chunk + */ + Unzip.prototype.push = function (chunk, final) { + var _this = this; + if (!this.onfile) + err(5); + if (!this.p) + err(4); + if (this.c > 0) { + var len = Math.min(this.c, chunk.length); + var toAdd = chunk.subarray(0, len); + this.c -= len; + if (this.d) + this.d.push(toAdd, !this.c); + else + this.k[0].push(toAdd); + chunk = chunk.subarray(len); + if (chunk.length) + return this.push(chunk, final); + } + else { + var f = 0, i = 0, is = void 0, buf = void 0; + if (!this.p.length) + buf = chunk; + else if (!chunk.length) + buf = this.p; + else { + buf = new u8(this.p.length + chunk.length); + buf.set(this.p), buf.set(chunk, this.p.length); + } + var l = buf.length, oc = this.c, add = oc && this.d; + var _loop_2 = function () { + var _a; + var sig = b4(buf, i); + if (sig == 0x4034B50) { + f = 1, is = i; + this_1.d = null; + this_1.c = 0; + var bf = b2(buf, i + 6), cmp_1 = b2(buf, i + 8), u = bf & 2048, dd = bf & 8, fnl = b2(buf, i + 26), es = b2(buf, i + 28); + if (l > i + 30 + fnl + es) { + var chks_3 = []; + this_1.k.unshift(chks_3); + f = 2; + var sc_1 = b4(buf, i + 18), su_1 = b4(buf, i + 22); + var fn_1 = strFromU8(buf.subarray(i + 30, i += 30 + fnl), !u); + if (sc_1 == 4294967295) { + _a = dd ? [-2] : z64e(buf, i), sc_1 = _a[0], su_1 = _a[1]; + } + else if (dd) + sc_1 = -1; + i += es; + this_1.c = sc_1; + var d_1; + var file_1 = { + name: fn_1, + compression: cmp_1, + start: function () { + if (!file_1.ondata) + err(5); + if (!sc_1) + file_1.ondata(null, et, true); + else { + var ctr = _this.o[cmp_1]; + if (!ctr) + file_1.ondata(err(14, 'unknown compression type ' + cmp_1, 1), null, false); + d_1 = sc_1 < 0 ? new ctr(fn_1) : new ctr(fn_1, sc_1, su_1); + d_1.ondata = function (err, dat, final) { file_1.ondata(err, dat, final); }; + for (var _i = 0, chks_4 = chks_3; _i < chks_4.length; _i++) { + var dat = chks_4[_i]; + d_1.push(dat, false); + } + if (_this.k[0] == chks_3 && _this.c) + _this.d = d_1; + else + d_1.push(et, true); + } + }, + terminate: function () { + if (d_1 && d_1.terminate) + d_1.terminate(); + } + }; + if (sc_1 >= 0) + file_1.size = sc_1, file_1.originalSize = su_1; + this_1.onfile(file_1); + } + return "break"; + } + else if (oc) { + if (sig == 0x8074B50) { + is = i += 12 + (oc == -2 && 8), f = 3, this_1.c = 0; + return "break"; + } + else if (sig == 0x2014B50) { + is = i -= 4, f = 3, this_1.c = 0; + return "break"; + } + } + }; + var this_1 = this; + for (; i < l - 4; ++i) { + var state_1 = _loop_2(); + if (state_1 === "break") + break; + } + this.p = et; + if (oc < 0) { + var dat = f ? buf.subarray(0, is - 12 - (oc == -2 && 8) - (b4(buf, is - 16) == 0x8074B50 && 4)) : buf.subarray(0, i); + if (add) + add.push(dat, !!f); + else + this.k[+(f == 2)].push(dat); + } + if (f & 2) + return this.push(buf.subarray(i), final); + this.p = buf.subarray(i); + } + if (final) { + if (this.c) + err(13); + this.p = null; + } + }; + /** + * Registers a decoder with the stream, allowing for files compressed with + * the compression type provided to be expanded correctly + * @param decoder The decoder constructor + */ + Unzip.prototype.register = function (decoder) { + this.o[decoder.compression] = decoder; + }; + return Unzip; +}()))); + +var mt = typeof queueMicrotask == 'function' ? queueMicrotask : typeof setTimeout == 'function' ? setTimeout : function (fn) { fn(); }; +function unzip(data, opts, cb) { + if (!cb) + cb = opts, opts = {}; + if (typeof cb != 'function') + err(7); + var term = []; + var tAll = function () { + for (var i = 0; i < term.length; ++i) + term[i](); + }; + var files = {}; + var cbd = function (a, b) { + mt(function () { cb(a, b); }); + }; + mt(function () { cbd = cb; }); + var e = data.length - 22; + for (; b4(data, e) != 0x6054B50; --e) { + if (!e || data.length - e > 65558) { + cbd(err(13, 0, 1), null); + return tAll; + } + } + ; + var lft = b2(data, e + 8); + if (lft) { + var c = lft; + var o = b4(data, e + 16); + var z = o == 4294967295 || c == 65535; + if (z) { + var ze = b4(data, e - 12); + z = b4(data, ze) == 0x6064B50; + if (z) { + c = lft = b4(data, ze + 32); + o = b4(data, ze + 48); + } + } + var fltr = opts && opts.filter; + var _loop_3 = function (i) { + var _a = zh(data, o, z), c_1 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off); + o = no; + var cbl = function (e, d) { + if (e) { + tAll(); + cbd(e, null); + } + else { + if (d) + files[fn] = d; + if (!--lft) + cbd(null, files); + } + }; + if (!fltr || fltr({ + name: fn, + size: sc, + originalSize: su, + compression: c_1 + })) { + if (!c_1) + cbl(null, slc(data, b, b + sc)); + else if (c_1 == 8) { + var infl = data.subarray(b, b + sc); + // Synchronously decompress under 512KB, or barely-compressed data + if (su < 524288 || sc > 0.8 * su) { + try { + cbl(null, inflateSync(infl, { out: new u8(su) })); + } + catch (e) { + cbl(e, null); + } + } + else + term.push(inflate(infl, { size: su }, cbl)); + } + else + cbl(err(14, 'unknown compression type ' + c_1, 1), null); + } + else + cbl(null, null); + }; + for (var i = 0; i < c; ++i) { + _loop_3(i); + } + } + else + cbd(null, {}); + return tAll; +} +/** + * Synchronously decompresses a ZIP archive. Prefer using `unzip` for better + * performance with more than one file. + * @param data The raw compressed ZIP file + * @param opts The ZIP extraction options + * @returns The decompressed files + */ +function unzipSync(data, opts) { + var files = {}; + var e = data.length - 22; + for (; b4(data, e) != 0x6054B50; --e) { + if (!e || data.length - e > 65558) + err(13); + } + ; + var c = b2(data, e + 8); + if (!c) + return {}; + var o = b4(data, e + 16); + var z = o == 4294967295 || c == 65535; + if (z) { + var ze = b4(data, e - 12); + z = b4(data, ze) == 0x6064B50; + if (z) { + c = b4(data, ze + 32); + o = b4(data, ze + 48); + } + } + var fltr = opts && opts.filter; + for (var i = 0; i < c; ++i) { + var _a = zh(data, o, z), c_2 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off); + o = no; + if (!fltr || fltr({ + name: fn, + size: sc, + originalSize: su, + compression: c_2 + })) { + if (!c_2) + files[fn] = slc(data, b, b + sc); + else if (c_2 == 8) + files[fn] = inflateSync(data.subarray(b, b + sc), { out: new u8(su) }); + else + err(14, 'unknown compression type ' + c_2); + } + } + return files; +} + +// EXTERNAL MODULE: ./src/providers.ts + 39 modules +var providers = __webpack_require__(46170); +// EXTERNAL MODULE: ./src/utils.ts +var utils = __webpack_require__(67418); +;// ./src/zip.ts + + + + +function zipAsync(file, options) { + return new Promise((res, rej) => { + zip(file, { ...options || {}, mtime: /* @__PURE__ */ new Date("1/1/1980") }, (err, data) => { + if (err) { + rej(err); + return; + } + res(data); + }); }); } -function calculateSnarkProof(input, circuit, provingKey) { - return __async(this, null, function* () { - if (!groth16) { - yield initGroth16(); - } - const snarkInput = { - root: input.root, - nullifierHash: BigInt(input.nullifierHex).toString(), - recipient: BigInt(input.recipient), - relayer: BigInt(input.relayer), - fee: input.fee, - refund: input.refund, - nullifier: input.nullifier, - secret: input.secret, - pathElements: input.pathElements, - pathIndices: input.pathIndices - }; - console.log("Start generating SNARK proof", snarkInput); - console.time("SNARK proof time"); - const proofData = yield _tornado_websnark_src_utils__WEBPACK_IMPORTED_MODULE_0__.genWitnessAndProve(yield groth16, snarkInput, circuit, provingKey); - const proof = _tornado_websnark_src_utils__WEBPACK_IMPORTED_MODULE_0__.toSolidityInput(proofData).proof; - console.timeEnd("SNARK proof time"); - const args = [ - (0,_utils__WEBPACK_IMPORTED_MODULE_2__/* .toFixedHex */ .$W)(input.root, 32), - (0,_utils__WEBPACK_IMPORTED_MODULE_2__/* .toFixedHex */ .$W)(input.nullifierHex, 32), - input.recipient, - input.relayer, - (0,_utils__WEBPACK_IMPORTED_MODULE_2__/* .toFixedHex */ .$W)(input.fee, 32), - (0,_utils__WEBPACK_IMPORTED_MODULE_2__/* .toFixedHex */ .$W)(input.refund, 32) - ]; - return { proof, args }; +function unzipAsync(data) { + return new Promise((res, rej) => { + unzip(data, {}, (err, data2) => { + if (err) { + rej(err); + return; + } + res(data2); + }); }); } +async function downloadZip({ + staticUrl = "", + zipName, + zipDigest, + parseJson = true +}) { + const url = `${staticUrl}/${zipName}.zip`; + const resp = await (0,providers/* fetchData */.Fd)(url, { + method: "GET", + returnResponse: true + }); + const data = new Uint8Array(await resp.arrayBuffer()); + if (zipDigest) { + const hash = "sha384-" + (0,utils/* bytesToBase64 */["if"])(await (0,utils/* digest */.br)(data)); + if (zipDigest !== hash) { + const errMsg = `Invalid digest hash for file ${url}, wants ${zipDigest} has ${hash}`; + throw new Error(errMsg); + } + } + const { [zipName]: content } = await unzipAsync(data); + console.log(`Downloaded ${url}${zipDigest ? ` ( Digest: ${zipDigest} )` : ""}`); + if (parseJson) { + return JSON.parse(new TextDecoder().decode(content)); + } + return content; +} /***/ }), @@ -76552,7 +112675,11 @@ 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; +exports.crypto = exports.utf8ToBytes = exports.createView = exports.concatBytes = exports.toHex = exports.bytesToHex = exports.assertBytes = exports.assertBool = void 0; +exports.bytesToUtf8 = bytesToUtf8; +exports.hexToBytes = hexToBytes; +exports.equalsBytes = equalsBytes; +exports.wrapHash = wrapHash; const _assert_1 = __importDefault(__webpack_require__(67557)); const utils_1 = __webpack_require__(99175); const assertBool = _assert_1.default.bool; @@ -76572,12 +112699,10 @@ function bytesToUtf8(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) { @@ -76590,7 +112715,6 @@ function equalsBytes(a, b) { } return true; } -exports.equalsBytes = equalsBytes; // Internal utils function wrapHash(hash) { return (msg) => { @@ -76598,7 +112722,6 @@ function wrapHash(hash) { return hash(msg); }; } -exports.wrapHash = wrapHash; // TODO(v3): switch away from node crypto, remove this unnecessary variable. exports.crypto = (() => { const webCrypto = typeof globalThis === "object" && "crypto" in globalThis ? globalThis.crypto : undefined; @@ -76615,10 +112738,9 @@ exports.crypto = (() => { /***/ }), /***/ 37007: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ ((module) => { "use strict"; -/* provided dependency */ var console = __webpack_require__(96763); // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -79831,12 +115953,318 @@ module.exports = function isTypedArray(value) { }; +/***/ }), + +/***/ 8127: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; +// +// THIS FILE IS AUTOMATICALLY GENERATED! DO NOT EDIT BY HAND! +// +; +(function (global, factory) { + true + ? module.exports = factory() + : 0; +}((typeof self !== 'undefined' ? self + : typeof window !== 'undefined' ? window + : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g + : this), function () { + 'use strict'; + /** + * base64.ts + * + * Licensed under the BSD 3-Clause License. + * http://opensource.org/licenses/BSD-3-Clause + * + * References: + * http://en.wikipedia.org/wiki/Base64 + * + * @author Dan Kogai (https://github.com/dankogai) + */ + var version = '3.7.7'; + /** + * @deprecated use lowercase `version`. + */ + var VERSION = version; + var _hasBuffer = typeof Buffer === 'function'; + var _TD = typeof TextDecoder === 'function' ? new TextDecoder() : undefined; + var _TE = typeof TextEncoder === 'function' ? new TextEncoder() : undefined; + var b64ch = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; + var b64chs = Array.prototype.slice.call(b64ch); + var b64tab = (function (a) { + var tab = {}; + a.forEach(function (c, i) { return tab[c] = i; }); + return tab; + })(b64chs); + var b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/; + var _fromCC = String.fromCharCode.bind(String); + var _U8Afrom = typeof Uint8Array.from === 'function' + ? Uint8Array.from.bind(Uint8Array) + : function (it) { return new Uint8Array(Array.prototype.slice.call(it, 0)); }; + var _mkUriSafe = function (src) { return src + .replace(/=/g, '').replace(/[+\/]/g, function (m0) { return m0 == '+' ? '-' : '_'; }); }; + var _tidyB64 = function (s) { return s.replace(/[^A-Za-z0-9\+\/]/g, ''); }; + /** + * polyfill version of `btoa` + */ + var btoaPolyfill = function (bin) { + // console.log('polyfilled'); + var u32, c0, c1, c2, asc = ''; + var pad = bin.length % 3; + for (var i = 0; i < bin.length;) { + if ((c0 = bin.charCodeAt(i++)) > 255 || + (c1 = bin.charCodeAt(i++)) > 255 || + (c2 = bin.charCodeAt(i++)) > 255) + throw new TypeError('invalid character found'); + u32 = (c0 << 16) | (c1 << 8) | c2; + asc += b64chs[u32 >> 18 & 63] + + b64chs[u32 >> 12 & 63] + + b64chs[u32 >> 6 & 63] + + b64chs[u32 & 63]; + } + return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc; + }; + /** + * does what `window.btoa` of web browsers do. + * @param {String} bin binary string + * @returns {string} Base64-encoded string + */ + var _btoa = typeof btoa === 'function' ? function (bin) { return btoa(bin); } + : _hasBuffer ? function (bin) { return Buffer.from(bin, 'binary').toString('base64'); } + : btoaPolyfill; + var _fromUint8Array = _hasBuffer + ? function (u8a) { return Buffer.from(u8a).toString('base64'); } + : function (u8a) { + // cf. https://stackoverflow.com/questions/12710001/how-to-convert-uint8-array-to-base64-encoded-string/12713326#12713326 + var maxargs = 0x1000; + var strs = []; + for (var i = 0, l = u8a.length; i < l; i += maxargs) { + strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs))); + } + return _btoa(strs.join('')); + }; + /** + * converts a Uint8Array to a Base64 string. + * @param {boolean} [urlsafe] URL-and-filename-safe a la RFC4648 §5 + * @returns {string} Base64 string + */ + var fromUint8Array = function (u8a, urlsafe) { + if (urlsafe === void 0) { urlsafe = false; } + return urlsafe ? _mkUriSafe(_fromUint8Array(u8a)) : _fromUint8Array(u8a); + }; + // This trick is found broken https://github.com/dankogai/js-base64/issues/130 + // const utob = (src: string) => unescape(encodeURIComponent(src)); + // reverting good old fationed regexp + var cb_utob = function (c) { + if (c.length < 2) { + var cc = c.charCodeAt(0); + return cc < 0x80 ? c + : cc < 0x800 ? (_fromCC(0xc0 | (cc >>> 6)) + + _fromCC(0x80 | (cc & 0x3f))) + : (_fromCC(0xe0 | ((cc >>> 12) & 0x0f)) + + _fromCC(0x80 | ((cc >>> 6) & 0x3f)) + + _fromCC(0x80 | (cc & 0x3f))); + } + else { + var cc = 0x10000 + + (c.charCodeAt(0) - 0xD800) * 0x400 + + (c.charCodeAt(1) - 0xDC00); + return (_fromCC(0xf0 | ((cc >>> 18) & 0x07)) + + _fromCC(0x80 | ((cc >>> 12) & 0x3f)) + + _fromCC(0x80 | ((cc >>> 6) & 0x3f)) + + _fromCC(0x80 | (cc & 0x3f))); + } + }; + var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g; + /** + * @deprecated should have been internal use only. + * @param {string} src UTF-8 string + * @returns {string} UTF-16 string + */ + var utob = function (u) { return u.replace(re_utob, cb_utob); }; + // + var _encode = _hasBuffer + ? function (s) { return Buffer.from(s, 'utf8').toString('base64'); } + : _TE + ? function (s) { return _fromUint8Array(_TE.encode(s)); } + : function (s) { return _btoa(utob(s)); }; + /** + * converts a UTF-8-encoded string to a Base64 string. + * @param {boolean} [urlsafe] if `true` make the result URL-safe + * @returns {string} Base64 string + */ + var encode = function (src, urlsafe) { + if (urlsafe === void 0) { urlsafe = false; } + return urlsafe + ? _mkUriSafe(_encode(src)) + : _encode(src); + }; + /** + * converts a UTF-8-encoded string to URL-safe Base64 RFC4648 §5. + * @returns {string} Base64 string + */ + var encodeURI = function (src) { return encode(src, true); }; + // This trick is found broken https://github.com/dankogai/js-base64/issues/130 + // const btou = (src: string) => decodeURIComponent(escape(src)); + // reverting good old fationed regexp + var re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g; + var cb_btou = function (cccc) { + switch (cccc.length) { + case 4: + var cp = ((0x07 & cccc.charCodeAt(0)) << 18) + | ((0x3f & cccc.charCodeAt(1)) << 12) + | ((0x3f & cccc.charCodeAt(2)) << 6) + | (0x3f & cccc.charCodeAt(3)), offset = cp - 0x10000; + return (_fromCC((offset >>> 10) + 0xD800) + + _fromCC((offset & 0x3FF) + 0xDC00)); + case 3: + return _fromCC(((0x0f & cccc.charCodeAt(0)) << 12) + | ((0x3f & cccc.charCodeAt(1)) << 6) + | (0x3f & cccc.charCodeAt(2))); + default: + return _fromCC(((0x1f & cccc.charCodeAt(0)) << 6) + | (0x3f & cccc.charCodeAt(1))); + } + }; + /** + * @deprecated should have been internal use only. + * @param {string} src UTF-16 string + * @returns {string} UTF-8 string + */ + var btou = function (b) { return b.replace(re_btou, cb_btou); }; + /** + * polyfill version of `atob` + */ + var atobPolyfill = function (asc) { + // console.log('polyfilled'); + asc = asc.replace(/\s+/g, ''); + if (!b64re.test(asc)) + throw new TypeError('malformed base64.'); + asc += '=='.slice(2 - (asc.length & 3)); + var u24, bin = '', r1, r2; + for (var i = 0; i < asc.length;) { + u24 = b64tab[asc.charAt(i++)] << 18 + | b64tab[asc.charAt(i++)] << 12 + | (r1 = b64tab[asc.charAt(i++)]) << 6 + | (r2 = b64tab[asc.charAt(i++)]); + bin += r1 === 64 ? _fromCC(u24 >> 16 & 255) + : r2 === 64 ? _fromCC(u24 >> 16 & 255, u24 >> 8 & 255) + : _fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255); + } + return bin; + }; + /** + * does what `window.atob` of web browsers do. + * @param {String} asc Base64-encoded string + * @returns {string} binary string + */ + var _atob = typeof atob === 'function' ? function (asc) { return atob(_tidyB64(asc)); } + : _hasBuffer ? function (asc) { return Buffer.from(asc, 'base64').toString('binary'); } + : atobPolyfill; + // + var _toUint8Array = _hasBuffer + ? function (a) { return _U8Afrom(Buffer.from(a, 'base64')); } + : function (a) { return _U8Afrom(_atob(a).split('').map(function (c) { return c.charCodeAt(0); })); }; + /** + * converts a Base64 string to a Uint8Array. + */ + var toUint8Array = function (a) { return _toUint8Array(_unURI(a)); }; + // + var _decode = _hasBuffer + ? function (a) { return Buffer.from(a, 'base64').toString('utf8'); } + : _TD + ? function (a) { return _TD.decode(_toUint8Array(a)); } + : function (a) { return btou(_atob(a)); }; + var _unURI = function (a) { return _tidyB64(a.replace(/[-_]/g, function (m0) { return m0 == '-' ? '+' : '/'; })); }; + /** + * converts a Base64 string to a UTF-8 string. + * @param {String} src Base64 string. Both normal and URL-safe are supported + * @returns {string} UTF-8 string + */ + var decode = function (src) { return _decode(_unURI(src)); }; + /** + * check if a value is a valid Base64 string + * @param {String} src a value to check + */ + var isValid = function (src) { + if (typeof src !== 'string') + return false; + var s = src.replace(/\s+/g, '').replace(/={0,2}$/, ''); + return !/[^\s0-9a-zA-Z\+/]/.test(s) || !/[^\s0-9a-zA-Z\-_]/.test(s); + }; + // + var _noEnum = function (v) { + return { + value: v, enumerable: false, writable: true, configurable: true + }; + }; + /** + * extend String.prototype with relevant methods + */ + var extendString = function () { + var _add = function (name, body) { return Object.defineProperty(String.prototype, name, _noEnum(body)); }; + _add('fromBase64', function () { return decode(this); }); + _add('toBase64', function (urlsafe) { return encode(this, urlsafe); }); + _add('toBase64URI', function () { return encode(this, true); }); + _add('toBase64URL', function () { return encode(this, true); }); + _add('toUint8Array', function () { return toUint8Array(this); }); + }; + /** + * extend Uint8Array.prototype with relevant methods + */ + var extendUint8Array = function () { + var _add = function (name, body) { return Object.defineProperty(Uint8Array.prototype, name, _noEnum(body)); }; + _add('toBase64', function (urlsafe) { return fromUint8Array(this, urlsafe); }); + _add('toBase64URI', function () { return fromUint8Array(this, true); }); + _add('toBase64URL', function () { return fromUint8Array(this, true); }); + }; + /** + * extend Builtin prototypes with relevant methods + */ + var extendBuiltins = function () { + extendString(); + extendUint8Array(); + }; + var gBase64 = { + version: version, + VERSION: VERSION, + atob: _atob, + atobPolyfill: atobPolyfill, + btoa: _btoa, + btoaPolyfill: btoaPolyfill, + fromBase64: decode, + toBase64: encode, + encode: encode, + encodeURI: encodeURI, + encodeURL: encodeURI, + utob: utob, + btou: btou, + decode: decode, + isValid: isValid, + fromUint8Array: fromUint8Array, + toUint8Array: toUint8Array, + extendString: extendString, + extendUint8Array: extendUint8Array, + extendBuiltins: extendBuiltins + }; + // + // export Base64 to the namespace + // + // ES5 is yet to have Object.assign() that may make transpilers unhappy. + // gBase64.Base64 = Object.assign({}, gBase64); + gBase64.Base64 = {}; + Object.keys(gBase64).forEach(function (k) { return gBase64.Base64[k] = gBase64[k]; }); + return gBase64; +})); + + /***/ }), /***/ 31176: /***/ ((module, exports, __webpack_require__) => { -/* provided dependency */ var process = __webpack_require__(65606); var __WEBPACK_AMD_DEFINE_RESULT__;/** * [js-sha3]{@link https://github.com/emn178/js-sha3} * @@ -80597,348 +117025,6 @@ function escapeJsonPtr(str) { } -/***/ }), - -/***/ 69749: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -// A linked list to keep track of recently-used-ness -const Yallist = __webpack_require__(28799) - -const MAX = Symbol('max') -const LENGTH = Symbol('length') -const LENGTH_CALCULATOR = Symbol('lengthCalculator') -const ALLOW_STALE = Symbol('allowStale') -const MAX_AGE = Symbol('maxAge') -const DISPOSE = Symbol('dispose') -const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet') -const LRU_LIST = Symbol('lruList') -const CACHE = Symbol('cache') -const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet') - -const naiveLength = () => 1 - -// lruList is a yallist where the head is the youngest -// item, and the tail is the oldest. the list contains the Hit -// objects as the entries. -// Each Hit object has a reference to its Yallist.Node. This -// never changes. -// -// cache is a Map (or PseudoMap) that matches the keys to -// the Yallist.Node object. -class LRUCache { - constructor (options) { - if (typeof options === 'number') - options = { max: options } - - if (!options) - options = {} - - if (options.max && (typeof options.max !== 'number' || options.max < 0)) - throw new TypeError('max must be a non-negative number') - // Kind of weird to have a default max of Infinity, but oh well. - const max = this[MAX] = options.max || Infinity - - const lc = options.length || naiveLength - this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc - this[ALLOW_STALE] = options.stale || false - if (options.maxAge && typeof options.maxAge !== 'number') - throw new TypeError('maxAge must be a number') - this[MAX_AGE] = options.maxAge || 0 - this[DISPOSE] = options.dispose - this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false - this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false - this.reset() - } - - // resize the cache when the max changes. - set max (mL) { - if (typeof mL !== 'number' || mL < 0) - throw new TypeError('max must be a non-negative number') - - this[MAX] = mL || Infinity - trim(this) - } - get max () { - return this[MAX] - } - - set allowStale (allowStale) { - this[ALLOW_STALE] = !!allowStale - } - get allowStale () { - return this[ALLOW_STALE] - } - - set maxAge (mA) { - if (typeof mA !== 'number') - throw new TypeError('maxAge must be a non-negative number') - - this[MAX_AGE] = mA - trim(this) - } - get maxAge () { - return this[MAX_AGE] - } - - // resize the cache when the lengthCalculator changes. - set lengthCalculator (lC) { - if (typeof lC !== 'function') - lC = naiveLength - - if (lC !== this[LENGTH_CALCULATOR]) { - this[LENGTH_CALCULATOR] = lC - this[LENGTH] = 0 - this[LRU_LIST].forEach(hit => { - hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key) - this[LENGTH] += hit.length - }) - } - trim(this) - } - get lengthCalculator () { return this[LENGTH_CALCULATOR] } - - get length () { return this[LENGTH] } - get itemCount () { return this[LRU_LIST].length } - - rforEach (fn, thisp) { - thisp = thisp || this - for (let walker = this[LRU_LIST].tail; walker !== null;) { - const prev = walker.prev - forEachStep(this, fn, walker, thisp) - walker = prev - } - } - - forEach (fn, thisp) { - thisp = thisp || this - for (let walker = this[LRU_LIST].head; walker !== null;) { - const next = walker.next - forEachStep(this, fn, walker, thisp) - walker = next - } - } - - keys () { - return this[LRU_LIST].toArray().map(k => k.key) - } - - values () { - return this[LRU_LIST].toArray().map(k => k.value) - } - - reset () { - if (this[DISPOSE] && - this[LRU_LIST] && - this[LRU_LIST].length) { - this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value)) - } - - this[CACHE] = new Map() // hash of items by key - this[LRU_LIST] = new Yallist() // list of items in order of use recency - this[LENGTH] = 0 // length of items in the list - } - - dump () { - return this[LRU_LIST].map(hit => - isStale(this, hit) ? false : { - k: hit.key, - v: hit.value, - e: hit.now + (hit.maxAge || 0) - }).toArray().filter(h => h) - } - - dumpLru () { - return this[LRU_LIST] - } - - set (key, value, maxAge) { - maxAge = maxAge || this[MAX_AGE] - - if (maxAge && typeof maxAge !== 'number') - throw new TypeError('maxAge must be a number') - - const now = maxAge ? Date.now() : 0 - const len = this[LENGTH_CALCULATOR](value, key) - - if (this[CACHE].has(key)) { - if (len > this[MAX]) { - del(this, this[CACHE].get(key)) - return false - } - - const node = this[CACHE].get(key) - const item = node.value - - // dispose of the old one before overwriting - // split out into 2 ifs for better coverage tracking - if (this[DISPOSE]) { - if (!this[NO_DISPOSE_ON_SET]) - this[DISPOSE](key, item.value) - } - - item.now = now - item.maxAge = maxAge - item.value = value - this[LENGTH] += len - item.length - item.length = len - this.get(key) - trim(this) - return true - } - - const hit = new Entry(key, value, len, now, maxAge) - - // oversized objects fall out of cache automatically. - if (hit.length > this[MAX]) { - if (this[DISPOSE]) - this[DISPOSE](key, value) - - return false - } - - this[LENGTH] += hit.length - this[LRU_LIST].unshift(hit) - this[CACHE].set(key, this[LRU_LIST].head) - trim(this) - return true - } - - has (key) { - if (!this[CACHE].has(key)) return false - const hit = this[CACHE].get(key).value - return !isStale(this, hit) - } - - get (key) { - return get(this, key, true) - } - - peek (key) { - return get(this, key, false) - } - - pop () { - const node = this[LRU_LIST].tail - if (!node) - return null - - del(this, node) - return node.value - } - - del (key) { - del(this, this[CACHE].get(key)) - } - - load (arr) { - // reset the cache - this.reset() - - const now = Date.now() - // A previous serialized cache has the most recent items first - for (let l = arr.length - 1; l >= 0; l--) { - const hit = arr[l] - const expiresAt = hit.e || 0 - if (expiresAt === 0) - // the item was created without expiration in a non aged cache - this.set(hit.k, hit.v) - else { - const maxAge = expiresAt - now - // dont add already expired items - if (maxAge > 0) { - this.set(hit.k, hit.v, maxAge) - } - } - } - } - - prune () { - this[CACHE].forEach((value, key) => get(this, key, false)) - } -} - -const get = (self, key, doUse) => { - const node = self[CACHE].get(key) - if (node) { - const hit = node.value - if (isStale(self, hit)) { - del(self, node) - if (!self[ALLOW_STALE]) - return undefined - } else { - if (doUse) { - if (self[UPDATE_AGE_ON_GET]) - node.value.now = Date.now() - self[LRU_LIST].unshiftNode(node) - } - } - return hit.value - } -} - -const isStale = (self, hit) => { - if (!hit || (!hit.maxAge && !self[MAX_AGE])) - return false - - const diff = Date.now() - hit.now - return hit.maxAge ? diff > hit.maxAge - : self[MAX_AGE] && (diff > self[MAX_AGE]) -} - -const trim = self => { - if (self[LENGTH] > self[MAX]) { - for (let walker = self[LRU_LIST].tail; - self[LENGTH] > self[MAX] && walker !== null;) { - // We know that we're about to delete this one, and also - // what the next least recently used key will be, so just - // go ahead and set it now. - const prev = walker.prev - del(self, walker) - walker = prev - } - } -} - -const del = (self, node) => { - if (node) { - const hit = node.value - if (self[DISPOSE]) - self[DISPOSE](hit.key, hit.value) - - self[LENGTH] -= hit.length - self[CACHE].delete(hit.key) - self[LRU_LIST].removeNode(node) - } -} - -class Entry { - constructor (key, value, length, now, maxAge) { - this.key = key - this.value = value - this.length = length - this.now = now - this.maxAge = maxAge || 0 - } -} - -const forEachStep = (self, fn, node, thisp) => { - let hit = node.value - if (isStale(self, hit)) { - del(self, node) - if (!self[ALLOW_STALE]) - hit = undefined - } - if (hit) - fn.call(thisp, hit.value, hit.key, self) -} - -module.exports = LRUCache - - /***/ }), /***/ 88276: @@ -81202,8 +117288,7 @@ module.exports = HashBase /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; -/* provided dependency */ var process = __webpack_require__(65606); +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.InvalidStatusCodeError = exports.InvalidCertError = void 0; @@ -85113,7 +121198,7 @@ var y = d * 365.25; * @api public */ -module.exports = function(val, options) { +module.exports = function (val, options) { options = options || {}; var type = typeof val; if (type === 'string' && val.length > 0) { @@ -85252,6 +121337,2465 @@ function plural(ms, msAbs, n, name) { } +/***/ }), + +/***/ 18633: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { encodeText } = __webpack_require__(24084) + +/** @typedef {import('./types').CodecFactory} CodecFactory */ +/** @typedef {import("./types").BaseName} BaseName */ +/** @typedef {import("./types").BaseCode} BaseCode */ + +/** + * Class to encode/decode in the supported Bases + * + */ +class Base { + /** + * @param {BaseName} name + * @param {BaseCode} code + * @param {CodecFactory} factory + * @param {string} alphabet + */ + constructor (name, code, factory, alphabet) { + this.name = name + this.code = code + this.codeBuf = encodeText(this.code) + this.alphabet = alphabet + this.codec = factory(alphabet) + } + + /** + * @param {Uint8Array} buf + * @returns {string} + */ + encode (buf) { + return this.codec.encode(buf) + } + + /** + * @param {string} string + * @returns {Uint8Array} + */ + decode (string) { + for (const char of string) { + if (this.alphabet && this.alphabet.indexOf(char) < 0) { + throw new Error(`invalid character '${char}' in '${string}'`) + } + } + return this.codec.decode(string) + } +} + +module.exports = Base + + +/***/ }), + +/***/ 67579: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const baseX = __webpack_require__(25084) +const Base = __webpack_require__(18633) +const { rfc4648 } = __webpack_require__(99417) +const { decodeText, encodeText } = __webpack_require__(24084) + +/** @typedef {import('./types').CodecFactory} CodecFactory */ +/** @typedef {import('./types').Codec} Codec */ +/** @typedef {import('./types').BaseName} BaseName */ +/** @typedef {import('./types').BaseCode} BaseCode */ + +/** @type {CodecFactory} */ +const identity = () => { + return { + encode: decodeText, + decode: encodeText + } +} + +/** + * + * name, code, implementation, alphabet + * + * @type {Array<[BaseName, BaseCode, CodecFactory, string]>} + */ +const constants = [ + ['identity', '\x00', identity, ''], + ['base2', '0', rfc4648(1), '01'], + ['base8', '7', rfc4648(3), '01234567'], + ['base10', '9', baseX, '0123456789'], + ['base16', 'f', rfc4648(4), '0123456789abcdef'], + ['base16upper', 'F', rfc4648(4), '0123456789ABCDEF'], + ['base32hex', 'v', rfc4648(5), '0123456789abcdefghijklmnopqrstuv'], + ['base32hexupper', 'V', rfc4648(5), '0123456789ABCDEFGHIJKLMNOPQRSTUV'], + ['base32hexpad', 't', rfc4648(5), '0123456789abcdefghijklmnopqrstuv='], + ['base32hexpadupper', 'T', rfc4648(5), '0123456789ABCDEFGHIJKLMNOPQRSTUV='], + ['base32', 'b', rfc4648(5), 'abcdefghijklmnopqrstuvwxyz234567'], + ['base32upper', 'B', rfc4648(5), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'], + ['base32pad', 'c', rfc4648(5), 'abcdefghijklmnopqrstuvwxyz234567='], + ['base32padupper', 'C', rfc4648(5), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567='], + ['base32z', 'h', rfc4648(5), 'ybndrfg8ejkmcpqxot1uwisza345h769'], + ['base36', 'k', baseX, '0123456789abcdefghijklmnopqrstuvwxyz'], + ['base36upper', 'K', baseX, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'], + ['base58btc', 'z', baseX, '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'], + ['base58flickr', 'Z', baseX, '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'], + ['base64', 'm', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'], + ['base64pad', 'M', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='], + ['base64url', 'u', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'], + ['base64urlpad', 'U', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_='] +] + +/** @type {Record} */ +const names = constants.reduce((prev, tupple) => { + prev[tupple[0]] = new Base(tupple[0], tupple[1], tupple[2], tupple[3]) + return prev +}, /** @type {Record} */({})) + +/** @type {Record} */ +const codes = constants.reduce((prev, tupple) => { + prev[tupple[1]] = names[tupple[0]] + return prev +}, /** @type {Record} */({})) + +module.exports = { + names, + codes +} + + +/***/ }), + +/***/ 91466: +/***/ ((module, exports, __webpack_require__) => { + +"use strict"; +/** + * Implementation of the [multibase](https://github.com/multiformats/multibase) specification. + * + */ + + +const constants = __webpack_require__(67579) +const { encodeText, decodeText, concat } = __webpack_require__(24084) + +/** @typedef {import('./base')} Base */ +/** @typedef {import("./types").BaseNameOrCode} BaseNameOrCode */ +/** @typedef {import("./types").BaseCode} BaseCode */ +/** @typedef {import("./types").BaseName} BaseName */ + +/** + * Create a new Uint8Array with the multibase varint+code. + * + * @param {BaseNameOrCode} nameOrCode - The multibase name or code number. + * @param {Uint8Array} buf - The data to be prefixed with multibase. + * @returns {Uint8Array} + * @throws {Error} Will throw if the encoding is not supported + */ +function multibase (nameOrCode, buf) { + if (!buf) { + throw new Error('requires an encoded Uint8Array') + } + const { name, codeBuf } = encoding(nameOrCode) + validEncode(name, buf) + + return concat([codeBuf, buf], codeBuf.length + buf.length) +} + +/** + * Encode data with the specified base and add the multibase prefix. + * + * @param {BaseNameOrCode} nameOrCode - The multibase name or code number. + * @param {Uint8Array} buf - The data to be encoded. + * @returns {Uint8Array} + * @throws {Error} Will throw if the encoding is not supported + * + */ +function encode (nameOrCode, buf) { + const enc = encoding(nameOrCode) + const data = encodeText(enc.encode(buf)) + + return concat([enc.codeBuf, data], enc.codeBuf.length + data.length) +} + +/** + * Takes a Uint8Array or string encoded with multibase header, decodes it and + * returns the decoded buffer + * + * @param {Uint8Array|string} data + * @returns {Uint8Array} + * @throws {Error} Will throw if the encoding is not supported + * + */ +function decode (data) { + if (data instanceof Uint8Array) { + data = decodeText(data) + } + const prefix = data[0] + + // Make all encodings case-insensitive except the ones that include upper and lower chars in the alphabet + if (['f', 'F', 'v', 'V', 't', 'T', 'b', 'B', 'c', 'C', 'h', 'k', 'K'].includes(prefix)) { + data = data.toLowerCase() + } + const enc = encoding(/** @type {BaseCode} */(data[0])) + return enc.decode(data.substring(1)) +} + +/** + * Is the given data multibase encoded? + * + * @param {Uint8Array|string} data + */ +function isEncoded (data) { + if (data instanceof Uint8Array) { + data = decodeText(data) + } + + // Ensure bufOrString is a string + if (Object.prototype.toString.call(data) !== '[object String]') { + return false + } + + try { + const enc = encoding(/** @type {BaseCode} */(data[0])) + return enc.name + } catch (err) { + return false + } +} + +/** + * Validate encoded data + * + * @param {BaseNameOrCode} name + * @param {Uint8Array} buf + * @returns {void} + * @throws {Error} Will throw if the encoding is not supported + */ +function validEncode (name, buf) { + const enc = encoding(name) + enc.decode(decodeText(buf)) +} + +/** + * Get the encoding by name or code + * + * @param {BaseNameOrCode} nameOrCode + * @returns {Base} + * @throws {Error} Will throw if the encoding is not supported + */ +function encoding (nameOrCode) { + if (Object.prototype.hasOwnProperty.call(constants.names, /** @type {BaseName} */(nameOrCode))) { + return constants.names[/** @type {BaseName} */(nameOrCode)] + } else if (Object.prototype.hasOwnProperty.call(constants.codes, /** @type {BaseCode} */(nameOrCode))) { + return constants.codes[/** @type {BaseCode} */(nameOrCode)] + } else { + throw new Error(`Unsupported encoding: ${nameOrCode}`) + } +} + +/** + * Get encoding from data + * + * @param {string|Uint8Array} data + * @returns {Base} + * @throws {Error} Will throw if the encoding is not supported + */ +function encodingFromData (data) { + if (data instanceof Uint8Array) { + data = decodeText(data) + } + + return encoding(/** @type {BaseCode} */(data[0])) +} + +exports = module.exports = multibase +exports.encode = encode +exports.decode = decode +exports.isEncoded = isEncoded +exports.encoding = encoding +exports.encodingFromData = encodingFromData +const names = Object.freeze(constants.names) +const codes = Object.freeze(constants.codes) +exports.names = names +exports.codes = codes + + +/***/ }), + +/***/ 99417: +/***/ ((module) => { + +"use strict"; + + +/** @typedef {import('./types').CodecFactory} CodecFactory */ + +/** + * @param {string} string + * @param {string} alphabet + * @param {number} bitsPerChar + * @returns {Uint8Array} + */ +const decode = (string, alphabet, bitsPerChar) => { + // Build the character lookup table: + /** @type {Record} */ + const codes = {} + for (let i = 0; i < alphabet.length; ++i) { + codes[alphabet[i]] = i + } + + // Count the padding bytes: + let end = string.length + while (string[end - 1] === '=') { + --end + } + + // Allocate the output: + const out = new Uint8Array((end * bitsPerChar / 8) | 0) + + // Parse the data: + let bits = 0 // Number of bits currently in the buffer + let buffer = 0 // Bits waiting to be written out, MSB first + let written = 0 // Next byte to write + for (let i = 0; i < end; ++i) { + // Read one character from the string: + const value = codes[string[i]] + if (value === undefined) { + throw new SyntaxError('Invalid character ' + string[i]) + } + + // Append the bits to the buffer: + buffer = (buffer << bitsPerChar) | value + bits += bitsPerChar + + // Write out some bits if the buffer has a byte's worth: + if (bits >= 8) { + bits -= 8 + out[written++] = 0xff & (buffer >> bits) + } + } + + // Verify that we have received just enough bits: + if (bits >= bitsPerChar || 0xff & (buffer << (8 - bits))) { + throw new SyntaxError('Unexpected end of data') + } + + return out +} + +/** + * @param {Uint8Array} data + * @param {string} alphabet + * @param {number} bitsPerChar + * @returns {string} + */ +const encode = (data, alphabet, bitsPerChar) => { + const pad = alphabet[alphabet.length - 1] === '=' + const mask = (1 << bitsPerChar) - 1 + let out = '' + + let bits = 0 // Number of bits currently in the buffer + let buffer = 0 // Bits waiting to be written out, MSB first + for (let i = 0; i < data.length; ++i) { + // Slurp data into the buffer: + buffer = (buffer << 8) | data[i] + bits += 8 + + // Write out as much as we can: + while (bits > bitsPerChar) { + bits -= bitsPerChar + out += alphabet[mask & (buffer >> bits)] + } + } + + // Partial character: + if (bits) { + out += alphabet[mask & (buffer << (bitsPerChar - bits))] + } + + // Add padding characters until we hit a byte boundary: + if (pad) { + while ((out.length * bitsPerChar) & 7) { + out += '=' + } + } + + return out +} + +/** + * RFC4648 Factory + * + * @param {number} bitsPerChar + * @returns {CodecFactory} + */ +const rfc4648 = (bitsPerChar) => (alphabet) => { + return { + /** + * @param {Uint8Array} input + * @returns {string} + */ + encode (input) { + return encode(input, alphabet, bitsPerChar) + }, + /** + * @param {string} input + * @returns {Uint8Array} + */ + decode (input) { + return decode(input, alphabet, bitsPerChar) + } + } +} + +module.exports = { rfc4648 } + + +/***/ }), + +/***/ 24084: +/***/ ((module) => { + +"use strict"; + + +const textDecoder = new TextDecoder() +/** + * @param {ArrayBufferView|ArrayBuffer} bytes + * @returns {string} + */ +const decodeText = (bytes) => textDecoder.decode(bytes) + +const textEncoder = new TextEncoder() +/** + * @param {string} text + * @returns {Uint8Array} + */ +const encodeText = (text) => textEncoder.encode(text) + +/** + * Returns a new Uint8Array created by concatenating the passed Arrays + * + * @param {Array>} arrs + * @param {number} length + * @returns {Uint8Array} + */ +function concat (arrs, length) { + const output = new Uint8Array(length) + let offset = 0 + + for (const arr of arrs) { + output.set(arr, offset) + offset += arr.length + } + + return output +} + +module.exports = { decodeText, encodeText, concat } + + +/***/ }), + +/***/ 35194: +/***/ ((module) => { + +module.exports = read + +var MSB = 0x80 + , REST = 0x7F + +function read(buf, offset) { + var res = 0 + , offset = offset || 0 + , shift = 0 + , counter = offset + , b + , l = buf.length + + do { + if (counter >= l || shift > 49) { + read.bytes = 0 + throw new RangeError('Could not decode varint') + } + b = buf[counter++] + res += shift < 28 + ? (b & REST) << shift + : (b & REST) * Math.pow(2, shift) + shift += 7 + } while (b >= MSB) + + read.bytes = counter - offset + + return res +} + + +/***/ }), + +/***/ 25134: +/***/ ((module) => { + +module.exports = encode + +var MSB = 0x80 + , REST = 0x7F + , MSBALL = ~REST + , INT = Math.pow(2, 31) + +function encode(num, out, offset) { + if (Number.MAX_SAFE_INTEGER && num > Number.MAX_SAFE_INTEGER) { + encode.bytes = 0 + throw new RangeError('Could not encode varint') + } + out = out || [] + offset = offset || 0 + var oldOffset = offset + + while(num >= INT) { + out[offset++] = (num & 0xFF) | MSB + num /= 128 + } + while(num & MSBALL) { + out[offset++] = (num & 0xFF) | MSB + num >>>= 7 + } + out[offset] = num | 0 + + encode.bytes = offset - oldOffset + 1 + + return out +} + + +/***/ }), + +/***/ 20038: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +module.exports = { + encode: __webpack_require__(25134) + , decode: __webpack_require__(35194) + , encodingLength: __webpack_require__(36516) +} + + +/***/ }), + +/***/ 36516: +/***/ ((module) => { + + +var N1 = Math.pow(2, 7) +var N2 = Math.pow(2, 14) +var N3 = Math.pow(2, 21) +var N4 = Math.pow(2, 28) +var N5 = Math.pow(2, 35) +var N6 = Math.pow(2, 42) +var N7 = Math.pow(2, 49) +var N8 = Math.pow(2, 56) +var N9 = Math.pow(2, 63) + +module.exports = function (value) { + return ( + value < N1 ? 1 + : value < N2 ? 2 + : value < N3 ? 3 + : value < N4 ? 4 + : value < N5 ? 5 + : value < N6 ? 6 + : value < N7 ? 7 + : value < N8 ? 8 + : value < N9 ? 9 + : 10 + ) +} + + +/***/ }), + +/***/ 15661: +/***/ ((module) => { + +"use strict"; +// DO NOT CHANGE THIS FILE. IT IS GENERATED BY tools/update-table.js +/* eslint quote-props: off */ + + +/** + * @type {import('./generated-types').NameCodeMap} + */ +const baseTable = Object.freeze({ + 'identity': 0x00, + 'cidv1': 0x01, + 'cidv2': 0x02, + 'cidv3': 0x03, + 'ip4': 0x04, + 'tcp': 0x06, + 'sha1': 0x11, + 'sha2-256': 0x12, + 'sha2-512': 0x13, + 'sha3-512': 0x14, + 'sha3-384': 0x15, + 'sha3-256': 0x16, + 'sha3-224': 0x17, + 'shake-128': 0x18, + 'shake-256': 0x19, + 'keccak-224': 0x1a, + 'keccak-256': 0x1b, + 'keccak-384': 0x1c, + 'keccak-512': 0x1d, + 'blake3': 0x1e, + 'dccp': 0x21, + 'murmur3-128': 0x22, + 'murmur3-32': 0x23, + 'ip6': 0x29, + 'ip6zone': 0x2a, + 'path': 0x2f, + 'multicodec': 0x30, + 'multihash': 0x31, + 'multiaddr': 0x32, + 'multibase': 0x33, + 'dns': 0x35, + 'dns4': 0x36, + 'dns6': 0x37, + 'dnsaddr': 0x38, + 'protobuf': 0x50, + 'cbor': 0x51, + 'raw': 0x55, + 'dbl-sha2-256': 0x56, + 'rlp': 0x60, + 'bencode': 0x63, + 'dag-pb': 0x70, + 'dag-cbor': 0x71, + 'libp2p-key': 0x72, + 'git-raw': 0x78, + 'torrent-info': 0x7b, + 'torrent-file': 0x7c, + 'leofcoin-block': 0x81, + 'leofcoin-tx': 0x82, + 'leofcoin-pr': 0x83, + 'sctp': 0x84, + 'dag-jose': 0x85, + 'dag-cose': 0x86, + 'eth-block': 0x90, + 'eth-block-list': 0x91, + 'eth-tx-trie': 0x92, + 'eth-tx': 0x93, + 'eth-tx-receipt-trie': 0x94, + 'eth-tx-receipt': 0x95, + 'eth-state-trie': 0x96, + 'eth-account-snapshot': 0x97, + 'eth-storage-trie': 0x98, + 'eth-receipt-log-trie': 0x99, + 'eth-reciept-log': 0x9a, + 'bitcoin-block': 0xb0, + 'bitcoin-tx': 0xb1, + 'bitcoin-witness-commitment': 0xb2, + 'zcash-block': 0xc0, + 'zcash-tx': 0xc1, + 'caip-50': 0xca, + 'streamid': 0xce, + 'stellar-block': 0xd0, + 'stellar-tx': 0xd1, + 'md4': 0xd4, + 'md5': 0xd5, + 'bmt': 0xd6, + 'decred-block': 0xe0, + 'decred-tx': 0xe1, + 'ipld-ns': 0xe2, + 'ipfs-ns': 0xe3, + 'swarm-ns': 0xe4, + 'ipns-ns': 0xe5, + 'zeronet': 0xe6, + 'secp256k1-pub': 0xe7, + 'bls12_381-g1-pub': 0xea, + 'bls12_381-g2-pub': 0xeb, + 'x25519-pub': 0xec, + 'ed25519-pub': 0xed, + 'bls12_381-g1g2-pub': 0xee, + 'dash-block': 0xf0, + 'dash-tx': 0xf1, + 'swarm-manifest': 0xfa, + 'swarm-feed': 0xfb, + 'udp': 0x0111, + 'p2p-webrtc-star': 0x0113, + 'p2p-webrtc-direct': 0x0114, + 'p2p-stardust': 0x0115, + 'p2p-circuit': 0x0122, + 'dag-json': 0x0129, + 'udt': 0x012d, + 'utp': 0x012e, + 'unix': 0x0190, + 'thread': 0x0196, + 'p2p': 0x01a5, + 'ipfs': 0x01a5, + 'https': 0x01bb, + 'onion': 0x01bc, + 'onion3': 0x01bd, + 'garlic64': 0x01be, + 'garlic32': 0x01bf, + 'tls': 0x01c0, + 'noise': 0x01c6, + 'quic': 0x01cc, + 'ws': 0x01dd, + 'wss': 0x01de, + 'p2p-websocket-star': 0x01df, + 'http': 0x01e0, + 'swhid-1-snp': 0x01f0, + 'json': 0x0200, + 'messagepack': 0x0201, + 'libp2p-peer-record': 0x0301, + 'libp2p-relay-rsvp': 0x0302, + 'car-index-sorted': 0x0400, + 'sha2-256-trunc254-padded': 0x1012, + 'ripemd-128': 0x1052, + 'ripemd-160': 0x1053, + 'ripemd-256': 0x1054, + 'ripemd-320': 0x1055, + 'x11': 0x1100, + 'p256-pub': 0x1200, + 'p384-pub': 0x1201, + 'p521-pub': 0x1202, + 'ed448-pub': 0x1203, + 'x448-pub': 0x1204, + 'ed25519-priv': 0x1300, + 'secp256k1-priv': 0x1301, + 'x25519-priv': 0x1302, + 'kangarootwelve': 0x1d01, + 'sm3-256': 0x534d, + 'blake2b-8': 0xb201, + 'blake2b-16': 0xb202, + 'blake2b-24': 0xb203, + 'blake2b-32': 0xb204, + 'blake2b-40': 0xb205, + 'blake2b-48': 0xb206, + 'blake2b-56': 0xb207, + 'blake2b-64': 0xb208, + 'blake2b-72': 0xb209, + 'blake2b-80': 0xb20a, + 'blake2b-88': 0xb20b, + 'blake2b-96': 0xb20c, + 'blake2b-104': 0xb20d, + 'blake2b-112': 0xb20e, + 'blake2b-120': 0xb20f, + 'blake2b-128': 0xb210, + 'blake2b-136': 0xb211, + 'blake2b-144': 0xb212, + 'blake2b-152': 0xb213, + 'blake2b-160': 0xb214, + 'blake2b-168': 0xb215, + 'blake2b-176': 0xb216, + 'blake2b-184': 0xb217, + 'blake2b-192': 0xb218, + 'blake2b-200': 0xb219, + 'blake2b-208': 0xb21a, + 'blake2b-216': 0xb21b, + 'blake2b-224': 0xb21c, + 'blake2b-232': 0xb21d, + 'blake2b-240': 0xb21e, + 'blake2b-248': 0xb21f, + 'blake2b-256': 0xb220, + 'blake2b-264': 0xb221, + 'blake2b-272': 0xb222, + 'blake2b-280': 0xb223, + 'blake2b-288': 0xb224, + 'blake2b-296': 0xb225, + 'blake2b-304': 0xb226, + 'blake2b-312': 0xb227, + 'blake2b-320': 0xb228, + 'blake2b-328': 0xb229, + 'blake2b-336': 0xb22a, + 'blake2b-344': 0xb22b, + 'blake2b-352': 0xb22c, + 'blake2b-360': 0xb22d, + 'blake2b-368': 0xb22e, + 'blake2b-376': 0xb22f, + 'blake2b-384': 0xb230, + 'blake2b-392': 0xb231, + 'blake2b-400': 0xb232, + 'blake2b-408': 0xb233, + 'blake2b-416': 0xb234, + 'blake2b-424': 0xb235, + 'blake2b-432': 0xb236, + 'blake2b-440': 0xb237, + 'blake2b-448': 0xb238, + 'blake2b-456': 0xb239, + 'blake2b-464': 0xb23a, + 'blake2b-472': 0xb23b, + 'blake2b-480': 0xb23c, + 'blake2b-488': 0xb23d, + 'blake2b-496': 0xb23e, + 'blake2b-504': 0xb23f, + 'blake2b-512': 0xb240, + 'blake2s-8': 0xb241, + 'blake2s-16': 0xb242, + 'blake2s-24': 0xb243, + 'blake2s-32': 0xb244, + 'blake2s-40': 0xb245, + 'blake2s-48': 0xb246, + 'blake2s-56': 0xb247, + 'blake2s-64': 0xb248, + 'blake2s-72': 0xb249, + 'blake2s-80': 0xb24a, + 'blake2s-88': 0xb24b, + 'blake2s-96': 0xb24c, + 'blake2s-104': 0xb24d, + 'blake2s-112': 0xb24e, + 'blake2s-120': 0xb24f, + 'blake2s-128': 0xb250, + 'blake2s-136': 0xb251, + 'blake2s-144': 0xb252, + 'blake2s-152': 0xb253, + 'blake2s-160': 0xb254, + 'blake2s-168': 0xb255, + 'blake2s-176': 0xb256, + 'blake2s-184': 0xb257, + 'blake2s-192': 0xb258, + 'blake2s-200': 0xb259, + 'blake2s-208': 0xb25a, + 'blake2s-216': 0xb25b, + 'blake2s-224': 0xb25c, + 'blake2s-232': 0xb25d, + 'blake2s-240': 0xb25e, + 'blake2s-248': 0xb25f, + 'blake2s-256': 0xb260, + 'skein256-8': 0xb301, + 'skein256-16': 0xb302, + 'skein256-24': 0xb303, + 'skein256-32': 0xb304, + 'skein256-40': 0xb305, + 'skein256-48': 0xb306, + 'skein256-56': 0xb307, + 'skein256-64': 0xb308, + 'skein256-72': 0xb309, + 'skein256-80': 0xb30a, + 'skein256-88': 0xb30b, + 'skein256-96': 0xb30c, + 'skein256-104': 0xb30d, + 'skein256-112': 0xb30e, + 'skein256-120': 0xb30f, + 'skein256-128': 0xb310, + 'skein256-136': 0xb311, + 'skein256-144': 0xb312, + 'skein256-152': 0xb313, + 'skein256-160': 0xb314, + 'skein256-168': 0xb315, + 'skein256-176': 0xb316, + 'skein256-184': 0xb317, + 'skein256-192': 0xb318, + 'skein256-200': 0xb319, + 'skein256-208': 0xb31a, + 'skein256-216': 0xb31b, + 'skein256-224': 0xb31c, + 'skein256-232': 0xb31d, + 'skein256-240': 0xb31e, + 'skein256-248': 0xb31f, + 'skein256-256': 0xb320, + 'skein512-8': 0xb321, + 'skein512-16': 0xb322, + 'skein512-24': 0xb323, + 'skein512-32': 0xb324, + 'skein512-40': 0xb325, + 'skein512-48': 0xb326, + 'skein512-56': 0xb327, + 'skein512-64': 0xb328, + 'skein512-72': 0xb329, + 'skein512-80': 0xb32a, + 'skein512-88': 0xb32b, + 'skein512-96': 0xb32c, + 'skein512-104': 0xb32d, + 'skein512-112': 0xb32e, + 'skein512-120': 0xb32f, + 'skein512-128': 0xb330, + 'skein512-136': 0xb331, + 'skein512-144': 0xb332, + 'skein512-152': 0xb333, + 'skein512-160': 0xb334, + 'skein512-168': 0xb335, + 'skein512-176': 0xb336, + 'skein512-184': 0xb337, + 'skein512-192': 0xb338, + 'skein512-200': 0xb339, + 'skein512-208': 0xb33a, + 'skein512-216': 0xb33b, + 'skein512-224': 0xb33c, + 'skein512-232': 0xb33d, + 'skein512-240': 0xb33e, + 'skein512-248': 0xb33f, + 'skein512-256': 0xb340, + 'skein512-264': 0xb341, + 'skein512-272': 0xb342, + 'skein512-280': 0xb343, + 'skein512-288': 0xb344, + 'skein512-296': 0xb345, + 'skein512-304': 0xb346, + 'skein512-312': 0xb347, + 'skein512-320': 0xb348, + 'skein512-328': 0xb349, + 'skein512-336': 0xb34a, + 'skein512-344': 0xb34b, + 'skein512-352': 0xb34c, + 'skein512-360': 0xb34d, + 'skein512-368': 0xb34e, + 'skein512-376': 0xb34f, + 'skein512-384': 0xb350, + 'skein512-392': 0xb351, + 'skein512-400': 0xb352, + 'skein512-408': 0xb353, + 'skein512-416': 0xb354, + 'skein512-424': 0xb355, + 'skein512-432': 0xb356, + 'skein512-440': 0xb357, + 'skein512-448': 0xb358, + 'skein512-456': 0xb359, + 'skein512-464': 0xb35a, + 'skein512-472': 0xb35b, + 'skein512-480': 0xb35c, + 'skein512-488': 0xb35d, + 'skein512-496': 0xb35e, + 'skein512-504': 0xb35f, + 'skein512-512': 0xb360, + 'skein1024-8': 0xb361, + 'skein1024-16': 0xb362, + 'skein1024-24': 0xb363, + 'skein1024-32': 0xb364, + 'skein1024-40': 0xb365, + 'skein1024-48': 0xb366, + 'skein1024-56': 0xb367, + 'skein1024-64': 0xb368, + 'skein1024-72': 0xb369, + 'skein1024-80': 0xb36a, + 'skein1024-88': 0xb36b, + 'skein1024-96': 0xb36c, + 'skein1024-104': 0xb36d, + 'skein1024-112': 0xb36e, + 'skein1024-120': 0xb36f, + 'skein1024-128': 0xb370, + 'skein1024-136': 0xb371, + 'skein1024-144': 0xb372, + 'skein1024-152': 0xb373, + 'skein1024-160': 0xb374, + 'skein1024-168': 0xb375, + 'skein1024-176': 0xb376, + 'skein1024-184': 0xb377, + 'skein1024-192': 0xb378, + 'skein1024-200': 0xb379, + 'skein1024-208': 0xb37a, + 'skein1024-216': 0xb37b, + 'skein1024-224': 0xb37c, + 'skein1024-232': 0xb37d, + 'skein1024-240': 0xb37e, + 'skein1024-248': 0xb37f, + 'skein1024-256': 0xb380, + 'skein1024-264': 0xb381, + 'skein1024-272': 0xb382, + 'skein1024-280': 0xb383, + 'skein1024-288': 0xb384, + 'skein1024-296': 0xb385, + 'skein1024-304': 0xb386, + 'skein1024-312': 0xb387, + 'skein1024-320': 0xb388, + 'skein1024-328': 0xb389, + 'skein1024-336': 0xb38a, + 'skein1024-344': 0xb38b, + 'skein1024-352': 0xb38c, + 'skein1024-360': 0xb38d, + 'skein1024-368': 0xb38e, + 'skein1024-376': 0xb38f, + 'skein1024-384': 0xb390, + 'skein1024-392': 0xb391, + 'skein1024-400': 0xb392, + 'skein1024-408': 0xb393, + 'skein1024-416': 0xb394, + 'skein1024-424': 0xb395, + 'skein1024-432': 0xb396, + 'skein1024-440': 0xb397, + 'skein1024-448': 0xb398, + 'skein1024-456': 0xb399, + 'skein1024-464': 0xb39a, + 'skein1024-472': 0xb39b, + 'skein1024-480': 0xb39c, + 'skein1024-488': 0xb39d, + 'skein1024-496': 0xb39e, + 'skein1024-504': 0xb39f, + 'skein1024-512': 0xb3a0, + 'skein1024-520': 0xb3a1, + 'skein1024-528': 0xb3a2, + 'skein1024-536': 0xb3a3, + 'skein1024-544': 0xb3a4, + 'skein1024-552': 0xb3a5, + 'skein1024-560': 0xb3a6, + 'skein1024-568': 0xb3a7, + 'skein1024-576': 0xb3a8, + 'skein1024-584': 0xb3a9, + 'skein1024-592': 0xb3aa, + 'skein1024-600': 0xb3ab, + 'skein1024-608': 0xb3ac, + 'skein1024-616': 0xb3ad, + 'skein1024-624': 0xb3ae, + 'skein1024-632': 0xb3af, + 'skein1024-640': 0xb3b0, + 'skein1024-648': 0xb3b1, + 'skein1024-656': 0xb3b2, + 'skein1024-664': 0xb3b3, + 'skein1024-672': 0xb3b4, + 'skein1024-680': 0xb3b5, + 'skein1024-688': 0xb3b6, + 'skein1024-696': 0xb3b7, + 'skein1024-704': 0xb3b8, + 'skein1024-712': 0xb3b9, + 'skein1024-720': 0xb3ba, + 'skein1024-728': 0xb3bb, + 'skein1024-736': 0xb3bc, + 'skein1024-744': 0xb3bd, + 'skein1024-752': 0xb3be, + 'skein1024-760': 0xb3bf, + 'skein1024-768': 0xb3c0, + 'skein1024-776': 0xb3c1, + 'skein1024-784': 0xb3c2, + 'skein1024-792': 0xb3c3, + 'skein1024-800': 0xb3c4, + 'skein1024-808': 0xb3c5, + 'skein1024-816': 0xb3c6, + 'skein1024-824': 0xb3c7, + 'skein1024-832': 0xb3c8, + 'skein1024-840': 0xb3c9, + 'skein1024-848': 0xb3ca, + 'skein1024-856': 0xb3cb, + 'skein1024-864': 0xb3cc, + 'skein1024-872': 0xb3cd, + 'skein1024-880': 0xb3ce, + 'skein1024-888': 0xb3cf, + 'skein1024-896': 0xb3d0, + 'skein1024-904': 0xb3d1, + 'skein1024-912': 0xb3d2, + 'skein1024-920': 0xb3d3, + 'skein1024-928': 0xb3d4, + 'skein1024-936': 0xb3d5, + 'skein1024-944': 0xb3d6, + 'skein1024-952': 0xb3d7, + 'skein1024-960': 0xb3d8, + 'skein1024-968': 0xb3d9, + 'skein1024-976': 0xb3da, + 'skein1024-984': 0xb3db, + 'skein1024-992': 0xb3dc, + 'skein1024-1000': 0xb3dd, + 'skein1024-1008': 0xb3de, + 'skein1024-1016': 0xb3df, + 'skein1024-1024': 0xb3e0, + 'poseidon-bls12_381-a2-fc1': 0xb401, + 'poseidon-bls12_381-a2-fc1-sc': 0xb402, + 'zeroxcert-imprint-256': 0xce11, + 'fil-commitment-unsealed': 0xf101, + 'fil-commitment-sealed': 0xf102, + 'holochain-adr-v0': 0x807124, + 'holochain-adr-v1': 0x817124, + 'holochain-key-v0': 0x947124, + 'holochain-key-v1': 0x957124, + 'holochain-sig-v0': 0xa27124, + 'holochain-sig-v1': 0xa37124, + 'skynet-ns': 0xb19910, + 'arweave-ns': 0xb29910 +}) + +module.exports = { baseTable } + + +/***/ }), + +/***/ 52021: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/** + * Implementation of the multicodec specification. + * + * @module multicodec + * @example + * const multicodec = require('multicodec') + * + * const prefixedProtobuf = multicodec.addPrefix('protobuf', protobufBuffer) + * // prefixedProtobuf 0x50... + * + */ + + +/** @typedef {import('./generated-types').CodecName} CodecName */ +/** @typedef {import('./generated-types').CodecCode} CodecCode */ + +const varint = __webpack_require__(20038) +const { concat: uint8ArrayConcat } = __webpack_require__(75007) +const util = __webpack_require__(82693) +const { nameToVarint, constantToCode, nameToCode, codeToName } = __webpack_require__(90482) + +/** + * Prefix a buffer with a multicodec-packed. + * + * @param {CodecName|Uint8Array} multicodecStrOrCode + * @param {Uint8Array} data + * @returns {Uint8Array} + */ +function addPrefix (multicodecStrOrCode, data) { + let prefix + + if (multicodecStrOrCode instanceof Uint8Array) { + prefix = util.varintUint8ArrayEncode(multicodecStrOrCode) + } else { + if (nameToVarint[multicodecStrOrCode]) { + prefix = nameToVarint[multicodecStrOrCode] + } else { + throw new Error('multicodec not recognized') + } + } + + return uint8ArrayConcat([prefix, data], prefix.length + data.length) +} + +/** + * Decapsulate the multicodec-packed prefix from the data. + * + * @param {Uint8Array} data + * @returns {Uint8Array} + */ +function rmPrefix (data) { + varint.decode(/** @type {Buffer} */(data)) + return data.slice(varint.decode.bytes) +} + +/** + * Get the codec name of the prefixed data. + * + * @param {Uint8Array} prefixedData + * @returns {CodecName} + */ +function getNameFromData (prefixedData) { + const code = /** @type {CodecCode} */(varint.decode(/** @type {Buffer} */(prefixedData))) + const name = codeToName[code] + if (name === undefined) { + throw new Error(`Code "${code}" not found`) + } + return name +} + +/** + * Get the codec name from a code. + * + * @param {CodecCode} codec + * @returns {CodecName} + */ +function getNameFromCode (codec) { + return codeToName[codec] +} + +/** + * Get the code of the codec + * + * @param {CodecName} name + * @returns {CodecCode} + */ +function getCodeFromName (name) { + const code = nameToCode[name] + if (code === undefined) { + throw new Error(`Codec "${name}" not found`) + } + return code +} + +/** + * Get the code of the prefixed data. + * + * @param {Uint8Array} prefixedData + * @returns {CodecCode} + */ +function getCodeFromData (prefixedData) { + return /** @type {CodecCode} */(varint.decode(/** @type {Buffer} */(prefixedData))) +} + +/** + * Get the code as varint of a codec name. + * + * @param {CodecName} name + * @returns {Uint8Array} + */ +function getVarintFromName (name) { + const code = nameToVarint[name] + if (code === undefined) { + throw new Error(`Codec "${name}" not found`) + } + return code +} + +/** + * Get the varint of a code. + * + * @param {CodecCode} code + * @returns {Uint8Array} + */ +function getVarintFromCode (code) { + return util.varintEncode(code) +} + +/** + * Get the codec name of the prefixed data. + * + * @deprecated use getNameFromData instead. + * @param {Uint8Array} prefixedData + * @returns {CodecName} + */ +function getCodec (prefixedData) { + return getNameFromData(prefixedData) +} + +/** + * Get the codec name from a code. + * + * @deprecated use getNameFromCode instead. + * @param {CodecCode} codec + * @returns {CodecName} + */ +function getName (codec) { + return getNameFromCode(codec) +} + +/** + * Get the code of the codec + * + * @deprecated use getCodeFromName instead. + * @param {CodecName} name + * @returns {CodecCode} + */ +function getNumber (name) { + return getCodeFromName(name) +} + +/** + * Get the code of the prefixed data. + * + * @deprecated use getCodeFromData instead. + * @param {Uint8Array} prefixedData + * @returns {CodecCode} + */ +function getCode (prefixedData) { + return getCodeFromData(prefixedData) +} + +/** + * Get the code as varint of a codec name. + * + * @deprecated use getVarintFromName instead. + * @param {CodecName} name + * @returns {Uint8Array} + */ +function getCodeVarint (name) { + return getVarintFromName(name) +} + +/** + * Get the varint of a code. + * + * @deprecated use getVarintFromCode instead. + * @param {CodecCode} code + * @returns {Array.} + */ +function getVarint (code) { + return Array.from(getVarintFromCode(code)) +} + +module.exports = { + addPrefix, + rmPrefix, + getNameFromData, + getNameFromCode, + getCodeFromName, + getCodeFromData, + getVarintFromName, + getVarintFromCode, + // Deprecated + getCodec, + getName, + getNumber, + getCode, + getCodeVarint, + getVarint, + // Make the constants top-level constants + ...constantToCode, + // Export the maps + nameToVarint, + nameToCode, + codeToName +} + + +/***/ }), + +/***/ 90482: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +/** @typedef {import('./generated-types').ConstantCodeMap} ConstantCodeMap */ +/** @typedef {import('./generated-types').NameUint8ArrayMap} NameUint8ArrayMap */ +/** @typedef {import('./generated-types').CodeNameMap} CodeNameMap */ +/** @typedef {import('./generated-types').CodecName} CodecName */ +/** @typedef {import('./generated-types').CodecConstant} CodecConstant */ + +const { baseTable } = __webpack_require__(15661) +const varintEncode = (__webpack_require__(82693).varintEncode) + +const nameToVarint = /** @type {NameUint8ArrayMap} */ ({}) +const constantToCode = /** @type {ConstantCodeMap} */({}) +const codeToName = /** @type {CodeNameMap} */({}) + +// eslint-disable-next-line guard-for-in +for (const name in baseTable) { + const codecName = /** @type {CodecName} */(name) + const code = baseTable[codecName] + nameToVarint[codecName] = varintEncode(code) + + const constant = /** @type {CodecConstant} */(codecName.toUpperCase().replace(/-/g, '_')) + constantToCode[constant] = code + + if (!codeToName[code]) { + codeToName[code] = codecName + } +} + +Object.freeze(nameToVarint) +Object.freeze(constantToCode) +Object.freeze(codeToName) +const nameToCode = Object.freeze(baseTable) +module.exports = { + nameToVarint, + constantToCode, + nameToCode, + codeToName +} + + +/***/ }), + +/***/ 82693: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const varint = __webpack_require__(20038) +const { toString: uint8ArrayToString } = __webpack_require__(27302) +const { fromString: uint8ArrayFromString } = __webpack_require__(44117) + +module.exports = { + numberToUint8Array, + uint8ArrayToNumber, + varintUint8ArrayEncode, + varintEncode +} + +/** + * @param {Uint8Array} buf + */ +function uint8ArrayToNumber (buf) { + return parseInt(uint8ArrayToString(buf, 'base16'), 16) +} + +/** + * @param {number} num + */ +function numberToUint8Array (num) { + let hexString = num.toString(16) + if (hexString.length % 2 === 1) { + hexString = '0' + hexString + } + return uint8ArrayFromString(hexString, 'base16') +} + +/** + * @param {Uint8Array} input + */ +function varintUint8ArrayEncode (input) { + return Uint8Array.from(varint.encode(uint8ArrayToNumber(input))) +} + +/** + * @param {number} num + */ +function varintEncode (num) { + return Uint8Array.from(varint.encode(num)) +} + + +/***/ }), + +/***/ 76994: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// @ts-check + +const { Buffer } = __webpack_require__(48287) + +/** + * @typedef {Object} Codec + * @property {function(Uint8Array):string} encode + * @property {function(string):Uint8Array} decode + * + * @typedef {function(string):Codec} CodecFactory + */ + +class Base { + /** + * @param {string} name + * @param {string} code + * @param {CodecFactory} implementation + * @param {string} alphabet + */ + constructor (name, code, implementation, alphabet) { + this.name = name + this.code = code + this.codeBuf = Buffer.from(this.code) + this.alphabet = alphabet + this.engine = implementation(alphabet) + } + + /** + * @param {Uint8Array} buf + * @returns {string} + */ + encode (buf) { + return this.engine.encode(buf) + } + + /** + * @param {string} string + * @returns {Uint8Array} + */ + decode (string) { + for (const char of string) { + if (this.alphabet && this.alphabet.indexOf(char) < 0) { + throw new Error(`invalid character '${char}' in '${string}'`) + } + } + return this.engine.decode(string) + } +} + +module.exports = Base + + +/***/ }), + +/***/ 46082: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// @ts-check + + +const baseX = __webpack_require__(95364) +const Base = __webpack_require__(76994) +const rfc4648 = __webpack_require__(15920) +const { decodeText, encodeText } = __webpack_require__(40639) + +const identity = () => { + return { + encode: decodeText, + decode: encodeText + } +} + +/** + * @typedef {import('./base').CodecFactory} CodecFactory + * + * name, code, implementation, alphabet + * @type {Array<[string, string, CodecFactory, string]>} + */ +const constants = [ + ['identity', '\x00', identity, ''], + ['base2', '0', rfc4648(1), '01'], + ['base8', '7', rfc4648(3), '01234567'], + ['base10', '9', baseX, '0123456789'], + ['base16', 'f', rfc4648(4), '0123456789abcdef'], + ['base16upper', 'F', rfc4648(4), '0123456789ABCDEF'], + ['base32hex', 'v', rfc4648(5), '0123456789abcdefghijklmnopqrstuv'], + ['base32hexupper', 'V', rfc4648(5), '0123456789ABCDEFGHIJKLMNOPQRSTUV'], + ['base32hexpad', 't', rfc4648(5), '0123456789abcdefghijklmnopqrstuv='], + ['base32hexpadupper', 'T', rfc4648(5), '0123456789ABCDEFGHIJKLMNOPQRSTUV='], + ['base32', 'b', rfc4648(5), 'abcdefghijklmnopqrstuvwxyz234567'], + ['base32upper', 'B', rfc4648(5), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'], + ['base32pad', 'c', rfc4648(5), 'abcdefghijklmnopqrstuvwxyz234567='], + ['base32padupper', 'C', rfc4648(5), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567='], + ['base32z', 'h', rfc4648(5), 'ybndrfg8ejkmcpqxot1uwisza345h769'], + ['base36', 'k', baseX, '0123456789abcdefghijklmnopqrstuvwxyz'], + ['base36upper', 'K', baseX, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'], + ['base58btc', 'z', baseX, '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'], + ['base58flickr', 'Z', baseX, '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'], + ['base64', 'm', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'], + ['base64pad', 'M', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='], + ['base64url', 'u', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'], + ['base64urlpad', 'U', rfc4648(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_='] +] + +const names = constants.reduce((prev, tupple) => { + prev[tupple[0]] = new Base(tupple[0], tupple[1], tupple[2], tupple[3]) + return prev +}, {}) + +const codes = constants.reduce((prev, tupple) => { + prev[tupple[1]] = names[tupple[0]] + return prev +}, {}) + +module.exports = { + names, + codes +} + + +/***/ }), + +/***/ 42879: +/***/ ((module, exports, __webpack_require__) => { + +"use strict"; +// @ts-check +/** + * Implementation of the [multibase](https://github.com/multiformats/multibase) specification. + * + * @module Multibase + */ + + +const { Buffer } = __webpack_require__(48287) +const constants = __webpack_require__(46082) +const { decodeText, asBuffer } = __webpack_require__(40639) + +/** @typedef {import("./base")} Base */ + +/** + * Create a new buffer with the multibase varint+code. + * + * @param {string|number} nameOrCode - The multibase name or code number. + * @param {Uint8Array} buf - The data to be prefixed with multibase. + * @returns {Buffer} + * @throws {Error} Will throw if the encoding is not supported + */ +function multibase (nameOrCode, buf) { + if (!buf) { + throw new Error('requires an encoded buffer') + } + const { name, codeBuf } = encoding(nameOrCode) + validEncode(name, buf) + + const buffer = Buffer.alloc(codeBuf.length + buf.length) + buffer.set(codeBuf, 0) + buffer.set(buf, codeBuf.length) + + return buffer +} + +/** + * Encode data with the specified base and add the multibase prefix. + * + * @param {string|number} nameOrCode - The multibase name or code number. + * @param {Uint8Array} buf - The data to be encoded. + * @returns {Buffer} + * @throws {Error} Will throw if the encoding is not supported + * + */ +function encode (nameOrCode, buf) { + const enc = encoding(nameOrCode) + + return Buffer.concat([enc.codeBuf, Buffer.from(enc.encode(buf))]) +} + +/** + * Takes a Uint8Array or string encoded with multibase header, decodes it and + * returns the decoded buffer + * + * @param {Uint8Array|string} data + * @returns {Buffer} + * @throws {Error} Will throw if the encoding is not supported + * + */ +function decode (data) { + if (ArrayBuffer.isView(data)) { + data = decodeText(data) + } + const prefix = data[0] + + // Make all encodings case-insensitive except the ones that include upper and lower chars in the alphabet + if (['f', 'F', 'v', 'V', 't', 'T', 'b', 'B', 'c', 'C', 'h', 'k', 'K'].includes(prefix)) { + data = data.toLowerCase() + } + const enc = encoding(data[0]) + return asBuffer(enc.decode(data.substring(1))) +} + +/** + * Is the given data multibase encoded? + * + * @param {Uint8Array|string} data + * @returns {false|string} + */ +function isEncoded (data) { + if (data instanceof Uint8Array) { + data = decodeText(data) + } + + // Ensure bufOrString is a string + if (Object.prototype.toString.call(data) !== '[object String]') { + return false + } + + try { + const enc = encoding(data[0]) + return enc.name + } catch (err) { + return false + } +} + +/** + * Validate encoded data + * + * @param {string} name + * @param {Uint8Array} buf + * @returns {void} + * @throws {Error} Will throw if the encoding is not supported + */ +function validEncode (name, buf) { + const enc = encoding(name) + enc.decode(decodeText(buf)) +} + +/** + * Get the encoding by name or code + * + * @param {string|number} nameOrCode + * @returns {Base} + * @throws {Error} Will throw if the encoding is not supported + */ +function encoding (nameOrCode) { + if (constants.names[nameOrCode]) { + return constants.names[nameOrCode] + } else if (constants.codes[nameOrCode]) { + return constants.codes[nameOrCode] + } else { + throw new Error(`Unsupported encoding: ${nameOrCode}`) + } +} + +/** + * Get encoding from data + * + * @param {string|Uint8Array} data + * @returns {Base} + * @throws {Error} Will throw if the encoding is not supported + */ +function encodingFromData (data) { + if (data instanceof Uint8Array) { + data = decodeText(data) + } + + return encoding(data[0]) +} + +exports = module.exports = multibase +exports.encode = encode +exports.decode = decode +exports.isEncoded = isEncoded +exports.encoding = encoding +exports.encodingFromData = encodingFromData +exports.names = Object.freeze(constants.names) +exports.codes = Object.freeze(constants.codes) + + +/***/ }), + +/***/ 15920: +/***/ ((module) => { + +"use strict"; +// @ts-check + + +/** @typedef {import('./base').CodecFactory} CodecFactory */ + +/** + * @param {string} string + * @param {string} alphabet + * @param {number} bitsPerChar + * @returns {Uint8Array} + */ +const decode = (string, alphabet, bitsPerChar) => { + // Build the character lookup table: + const codes = {} + for (let i = 0; i < alphabet.length; ++i) { + codes[alphabet[i]] = i + } + + // Count the padding bytes: + let end = string.length + while (string[end - 1] === '=') { + --end + } + + // Allocate the output: + const out = new Uint8Array((end * bitsPerChar / 8) | 0) + + // Parse the data: + let bits = 0 // Number of bits currently in the buffer + let buffer = 0 // Bits waiting to be written out, MSB first + let written = 0 // Next byte to write + for (let i = 0; i < end; ++i) { + // Read one character from the string: + const value = codes[string[i]] + if (value === undefined) { + throw new SyntaxError('Invalid character ' + string[i]) + } + + // Append the bits to the buffer: + buffer = (buffer << bitsPerChar) | value + bits += bitsPerChar + + // Write out some bits if the buffer has a byte's worth: + if (bits >= 8) { + bits -= 8 + out[written++] = 0xff & (buffer >> bits) + } + } + + // Verify that we have received just enough bits: + if (bits >= bitsPerChar || 0xff & (buffer << (8 - bits))) { + throw new SyntaxError('Unexpected end of data') + } + + return out +} + +/** + * @param {Uint8Array} data + * @param {string} alphabet + * @param {number} bitsPerChar + * @returns {string} + */ +const encode = (data, alphabet, bitsPerChar) => { + const pad = alphabet[alphabet.length - 1] === '=' + const mask = (1 << bitsPerChar) - 1 + let out = '' + + let bits = 0 // Number of bits currently in the buffer + let buffer = 0 // Bits waiting to be written out, MSB first + for (let i = 0; i < data.length; ++i) { + // Slurp data into the buffer: + buffer = (buffer << 8) | data[i] + bits += 8 + + // Write out as much as we can: + while (bits > bitsPerChar) { + bits -= bitsPerChar + out += alphabet[mask & (buffer >> bits)] + } + } + + // Partial character: + if (bits) { + out += alphabet[mask & (buffer << (bitsPerChar - bits))] + } + + // Add padding characters until we hit a byte boundary: + if (pad) { + while ((out.length * bitsPerChar) & 7) { + out += '=' + } + } + + return out +} + +/** + * @param {number} bitsPerChar + * @returns {CodecFactory} + */ +module.exports = (bitsPerChar) => (alphabet) => { + return { + /** + * @param {Uint8Array} input + * @returns {string} + */ + encode (input) { + return encode(input, alphabet, bitsPerChar) + }, + /** + * @param {string} input + * @returns {Uint8Array} + */ + decode (input) { + return decode(input, alphabet, bitsPerChar) + } + } +} + + +/***/ }), + +/***/ 40639: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// @ts-check + + +const { Buffer } = __webpack_require__(48287) +const { TextEncoder, TextDecoder } = __webpack_require__(67019) + +const textDecoder = new TextDecoder() +/** + * @param {ArrayBufferView|ArrayBuffer} bytes + * @returns {string} + */ +const decodeText = (bytes) => textDecoder.decode(bytes) + +const textEncoder = new TextEncoder() +/** + * @param {string} text + * @returns {Uint8Array} + */ +const encodeText = (text) => textEncoder.encode(text) + +/** + * @param {ArrayBufferView} bytes + * @returns {Buffer} + */ +const asBuffer = ({ buffer, byteLength, byteOffset }) => + Buffer.from(buffer, byteOffset, byteLength) + +module.exports = { decodeText, encodeText, asBuffer } + + +/***/ }), + +/***/ 53702: +/***/ ((module) => { + +"use strict"; +/* eslint quote-props: off */ + + +const names = Object.freeze({ + 'identity': 0x00, + 'sha1': 0x11, + 'sha2-256': 0x12, + 'sha2-512': 0x13, + 'sha3-512': 0x14, + 'sha3-384': 0x15, + 'sha3-256': 0x16, + 'sha3-224': 0x17, + 'shake-128': 0x18, + 'shake-256': 0x19, + 'keccak-224': 0x1a, + 'keccak-256': 0x1b, + 'keccak-384': 0x1c, + 'keccak-512': 0x1d, + 'blake3': 0x1e, + 'murmur3-128': 0x22, + 'murmur3-32': 0x23, + 'dbl-sha2-256': 0x56, + 'md4': 0xd4, + 'md5': 0xd5, + 'bmt': 0xd6, + 'sha2-256-trunc254-padded': 0x1012, + 'ripemd-128': 0x1052, + 'ripemd-160': 0x1053, + 'ripemd-256': 0x1054, + 'ripemd-320': 0x1055, + 'x11': 0x1100, + 'sm3-256': 0x534d, + 'blake2b-8': 0xb201, + 'blake2b-16': 0xb202, + 'blake2b-24': 0xb203, + 'blake2b-32': 0xb204, + 'blake2b-40': 0xb205, + 'blake2b-48': 0xb206, + 'blake2b-56': 0xb207, + 'blake2b-64': 0xb208, + 'blake2b-72': 0xb209, + 'blake2b-80': 0xb20a, + 'blake2b-88': 0xb20b, + 'blake2b-96': 0xb20c, + 'blake2b-104': 0xb20d, + 'blake2b-112': 0xb20e, + 'blake2b-120': 0xb20f, + 'blake2b-128': 0xb210, + 'blake2b-136': 0xb211, + 'blake2b-144': 0xb212, + 'blake2b-152': 0xb213, + 'blake2b-160': 0xb214, + 'blake2b-168': 0xb215, + 'blake2b-176': 0xb216, + 'blake2b-184': 0xb217, + 'blake2b-192': 0xb218, + 'blake2b-200': 0xb219, + 'blake2b-208': 0xb21a, + 'blake2b-216': 0xb21b, + 'blake2b-224': 0xb21c, + 'blake2b-232': 0xb21d, + 'blake2b-240': 0xb21e, + 'blake2b-248': 0xb21f, + 'blake2b-256': 0xb220, + 'blake2b-264': 0xb221, + 'blake2b-272': 0xb222, + 'blake2b-280': 0xb223, + 'blake2b-288': 0xb224, + 'blake2b-296': 0xb225, + 'blake2b-304': 0xb226, + 'blake2b-312': 0xb227, + 'blake2b-320': 0xb228, + 'blake2b-328': 0xb229, + 'blake2b-336': 0xb22a, + 'blake2b-344': 0xb22b, + 'blake2b-352': 0xb22c, + 'blake2b-360': 0xb22d, + 'blake2b-368': 0xb22e, + 'blake2b-376': 0xb22f, + 'blake2b-384': 0xb230, + 'blake2b-392': 0xb231, + 'blake2b-400': 0xb232, + 'blake2b-408': 0xb233, + 'blake2b-416': 0xb234, + 'blake2b-424': 0xb235, + 'blake2b-432': 0xb236, + 'blake2b-440': 0xb237, + 'blake2b-448': 0xb238, + 'blake2b-456': 0xb239, + 'blake2b-464': 0xb23a, + 'blake2b-472': 0xb23b, + 'blake2b-480': 0xb23c, + 'blake2b-488': 0xb23d, + 'blake2b-496': 0xb23e, + 'blake2b-504': 0xb23f, + 'blake2b-512': 0xb240, + 'blake2s-8': 0xb241, + 'blake2s-16': 0xb242, + 'blake2s-24': 0xb243, + 'blake2s-32': 0xb244, + 'blake2s-40': 0xb245, + 'blake2s-48': 0xb246, + 'blake2s-56': 0xb247, + 'blake2s-64': 0xb248, + 'blake2s-72': 0xb249, + 'blake2s-80': 0xb24a, + 'blake2s-88': 0xb24b, + 'blake2s-96': 0xb24c, + 'blake2s-104': 0xb24d, + 'blake2s-112': 0xb24e, + 'blake2s-120': 0xb24f, + 'blake2s-128': 0xb250, + 'blake2s-136': 0xb251, + 'blake2s-144': 0xb252, + 'blake2s-152': 0xb253, + 'blake2s-160': 0xb254, + 'blake2s-168': 0xb255, + 'blake2s-176': 0xb256, + 'blake2s-184': 0xb257, + 'blake2s-192': 0xb258, + 'blake2s-200': 0xb259, + 'blake2s-208': 0xb25a, + 'blake2s-216': 0xb25b, + 'blake2s-224': 0xb25c, + 'blake2s-232': 0xb25d, + 'blake2s-240': 0xb25e, + 'blake2s-248': 0xb25f, + 'blake2s-256': 0xb260, + 'skein256-8': 0xb301, + 'skein256-16': 0xb302, + 'skein256-24': 0xb303, + 'skein256-32': 0xb304, + 'skein256-40': 0xb305, + 'skein256-48': 0xb306, + 'skein256-56': 0xb307, + 'skein256-64': 0xb308, + 'skein256-72': 0xb309, + 'skein256-80': 0xb30a, + 'skein256-88': 0xb30b, + 'skein256-96': 0xb30c, + 'skein256-104': 0xb30d, + 'skein256-112': 0xb30e, + 'skein256-120': 0xb30f, + 'skein256-128': 0xb310, + 'skein256-136': 0xb311, + 'skein256-144': 0xb312, + 'skein256-152': 0xb313, + 'skein256-160': 0xb314, + 'skein256-168': 0xb315, + 'skein256-176': 0xb316, + 'skein256-184': 0xb317, + 'skein256-192': 0xb318, + 'skein256-200': 0xb319, + 'skein256-208': 0xb31a, + 'skein256-216': 0xb31b, + 'skein256-224': 0xb31c, + 'skein256-232': 0xb31d, + 'skein256-240': 0xb31e, + 'skein256-248': 0xb31f, + 'skein256-256': 0xb320, + 'skein512-8': 0xb321, + 'skein512-16': 0xb322, + 'skein512-24': 0xb323, + 'skein512-32': 0xb324, + 'skein512-40': 0xb325, + 'skein512-48': 0xb326, + 'skein512-56': 0xb327, + 'skein512-64': 0xb328, + 'skein512-72': 0xb329, + 'skein512-80': 0xb32a, + 'skein512-88': 0xb32b, + 'skein512-96': 0xb32c, + 'skein512-104': 0xb32d, + 'skein512-112': 0xb32e, + 'skein512-120': 0xb32f, + 'skein512-128': 0xb330, + 'skein512-136': 0xb331, + 'skein512-144': 0xb332, + 'skein512-152': 0xb333, + 'skein512-160': 0xb334, + 'skein512-168': 0xb335, + 'skein512-176': 0xb336, + 'skein512-184': 0xb337, + 'skein512-192': 0xb338, + 'skein512-200': 0xb339, + 'skein512-208': 0xb33a, + 'skein512-216': 0xb33b, + 'skein512-224': 0xb33c, + 'skein512-232': 0xb33d, + 'skein512-240': 0xb33e, + 'skein512-248': 0xb33f, + 'skein512-256': 0xb340, + 'skein512-264': 0xb341, + 'skein512-272': 0xb342, + 'skein512-280': 0xb343, + 'skein512-288': 0xb344, + 'skein512-296': 0xb345, + 'skein512-304': 0xb346, + 'skein512-312': 0xb347, + 'skein512-320': 0xb348, + 'skein512-328': 0xb349, + 'skein512-336': 0xb34a, + 'skein512-344': 0xb34b, + 'skein512-352': 0xb34c, + 'skein512-360': 0xb34d, + 'skein512-368': 0xb34e, + 'skein512-376': 0xb34f, + 'skein512-384': 0xb350, + 'skein512-392': 0xb351, + 'skein512-400': 0xb352, + 'skein512-408': 0xb353, + 'skein512-416': 0xb354, + 'skein512-424': 0xb355, + 'skein512-432': 0xb356, + 'skein512-440': 0xb357, + 'skein512-448': 0xb358, + 'skein512-456': 0xb359, + 'skein512-464': 0xb35a, + 'skein512-472': 0xb35b, + 'skein512-480': 0xb35c, + 'skein512-488': 0xb35d, + 'skein512-496': 0xb35e, + 'skein512-504': 0xb35f, + 'skein512-512': 0xb360, + 'skein1024-8': 0xb361, + 'skein1024-16': 0xb362, + 'skein1024-24': 0xb363, + 'skein1024-32': 0xb364, + 'skein1024-40': 0xb365, + 'skein1024-48': 0xb366, + 'skein1024-56': 0xb367, + 'skein1024-64': 0xb368, + 'skein1024-72': 0xb369, + 'skein1024-80': 0xb36a, + 'skein1024-88': 0xb36b, + 'skein1024-96': 0xb36c, + 'skein1024-104': 0xb36d, + 'skein1024-112': 0xb36e, + 'skein1024-120': 0xb36f, + 'skein1024-128': 0xb370, + 'skein1024-136': 0xb371, + 'skein1024-144': 0xb372, + 'skein1024-152': 0xb373, + 'skein1024-160': 0xb374, + 'skein1024-168': 0xb375, + 'skein1024-176': 0xb376, + 'skein1024-184': 0xb377, + 'skein1024-192': 0xb378, + 'skein1024-200': 0xb379, + 'skein1024-208': 0xb37a, + 'skein1024-216': 0xb37b, + 'skein1024-224': 0xb37c, + 'skein1024-232': 0xb37d, + 'skein1024-240': 0xb37e, + 'skein1024-248': 0xb37f, + 'skein1024-256': 0xb380, + 'skein1024-264': 0xb381, + 'skein1024-272': 0xb382, + 'skein1024-280': 0xb383, + 'skein1024-288': 0xb384, + 'skein1024-296': 0xb385, + 'skein1024-304': 0xb386, + 'skein1024-312': 0xb387, + 'skein1024-320': 0xb388, + 'skein1024-328': 0xb389, + 'skein1024-336': 0xb38a, + 'skein1024-344': 0xb38b, + 'skein1024-352': 0xb38c, + 'skein1024-360': 0xb38d, + 'skein1024-368': 0xb38e, + 'skein1024-376': 0xb38f, + 'skein1024-384': 0xb390, + 'skein1024-392': 0xb391, + 'skein1024-400': 0xb392, + 'skein1024-408': 0xb393, + 'skein1024-416': 0xb394, + 'skein1024-424': 0xb395, + 'skein1024-432': 0xb396, + 'skein1024-440': 0xb397, + 'skein1024-448': 0xb398, + 'skein1024-456': 0xb399, + 'skein1024-464': 0xb39a, + 'skein1024-472': 0xb39b, + 'skein1024-480': 0xb39c, + 'skein1024-488': 0xb39d, + 'skein1024-496': 0xb39e, + 'skein1024-504': 0xb39f, + 'skein1024-512': 0xb3a0, + 'skein1024-520': 0xb3a1, + 'skein1024-528': 0xb3a2, + 'skein1024-536': 0xb3a3, + 'skein1024-544': 0xb3a4, + 'skein1024-552': 0xb3a5, + 'skein1024-560': 0xb3a6, + 'skein1024-568': 0xb3a7, + 'skein1024-576': 0xb3a8, + 'skein1024-584': 0xb3a9, + 'skein1024-592': 0xb3aa, + 'skein1024-600': 0xb3ab, + 'skein1024-608': 0xb3ac, + 'skein1024-616': 0xb3ad, + 'skein1024-624': 0xb3ae, + 'skein1024-632': 0xb3af, + 'skein1024-640': 0xb3b0, + 'skein1024-648': 0xb3b1, + 'skein1024-656': 0xb3b2, + 'skein1024-664': 0xb3b3, + 'skein1024-672': 0xb3b4, + 'skein1024-680': 0xb3b5, + 'skein1024-688': 0xb3b6, + 'skein1024-696': 0xb3b7, + 'skein1024-704': 0xb3b8, + 'skein1024-712': 0xb3b9, + 'skein1024-720': 0xb3ba, + 'skein1024-728': 0xb3bb, + 'skein1024-736': 0xb3bc, + 'skein1024-744': 0xb3bd, + 'skein1024-752': 0xb3be, + 'skein1024-760': 0xb3bf, + 'skein1024-768': 0xb3c0, + 'skein1024-776': 0xb3c1, + 'skein1024-784': 0xb3c2, + 'skein1024-792': 0xb3c3, + 'skein1024-800': 0xb3c4, + 'skein1024-808': 0xb3c5, + 'skein1024-816': 0xb3c6, + 'skein1024-824': 0xb3c7, + 'skein1024-832': 0xb3c8, + 'skein1024-840': 0xb3c9, + 'skein1024-848': 0xb3ca, + 'skein1024-856': 0xb3cb, + 'skein1024-864': 0xb3cc, + 'skein1024-872': 0xb3cd, + 'skein1024-880': 0xb3ce, + 'skein1024-888': 0xb3cf, + 'skein1024-896': 0xb3d0, + 'skein1024-904': 0xb3d1, + 'skein1024-912': 0xb3d2, + 'skein1024-920': 0xb3d3, + 'skein1024-928': 0xb3d4, + 'skein1024-936': 0xb3d5, + 'skein1024-944': 0xb3d6, + 'skein1024-952': 0xb3d7, + 'skein1024-960': 0xb3d8, + 'skein1024-968': 0xb3d9, + 'skein1024-976': 0xb3da, + 'skein1024-984': 0xb3db, + 'skein1024-992': 0xb3dc, + 'skein1024-1000': 0xb3dd, + 'skein1024-1008': 0xb3de, + 'skein1024-1016': 0xb3df, + 'skein1024-1024': 0xb3e0, + 'poseidon-bls12_381-a2-fc1': 0xb401, + 'poseidon-bls12_381-a2-fc1-sc': 0xb402 +}) + +module.exports = { names } + + +/***/ }), + +/***/ 14243: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; +// @ts-check +/* eslint-disable guard-for-in */ +/** + * Multihash implementation in JavaScript. + * + * @module multihash + */ + + +const { Buffer } = __webpack_require__(48287) +const multibase = __webpack_require__(42879) +const varint = __webpack_require__(61203) +const { names } = __webpack_require__(53702) +const { TextDecoder } = __webpack_require__(67019) + +const textDecoder = new TextDecoder() +const codes = {} + +for (const key in names) { + codes[names[key]] = key +} +exports.names = names +exports.codes = Object.freeze(codes) + +/** + * Convert the given multihash to a hex encoded string. + * + * @param {Uint8Array} hash + * @returns {string} + */ +exports.toHexString = function toHexString (hash) { + if (!(hash instanceof Uint8Array)) { + throw new Error('must be passed a Uint8Array') + } + + const buffer = Buffer.isBuffer(hash) + ? hash + : Buffer.from(hash.buffer, hash.byteOffset, hash.byteLength) + + return buffer.toString('hex') +} + +/** + * Convert the given hex encoded string to a multihash. + * + * @param {string} hash + * @returns {Buffer} + */ +exports.fromHexString = function fromHexString (hash) { + return Buffer.from(hash, 'hex') +} + +/** + * Convert the given multihash to a base58 encoded string. + * + * @param {Uint8Array} hash + * @returns {string} + */ +exports.toB58String = function toB58String (hash) { + if (!(hash instanceof Uint8Array)) { + throw new Error('must be passed a Uint8Array') + } + + return textDecoder.decode(multibase.encode('base58btc', hash)).slice(1) +} + +/** + * Convert the given base58 encoded string to a multihash. + * + * @param {string|Uint8Array} hash + * @returns {Buffer} + */ +exports.fromB58String = function fromB58String (hash) { + const encoded = hash instanceof Uint8Array + ? textDecoder.decode(hash) + : hash + + return multibase.decode('z' + encoded) +} + +/** + * Decode a hash from the given multihash. + * + * @param {Uint8Array} bytes + * @returns {{code: number, name: string, length: number, digest: Buffer}} result + */ +exports.decode = function decode (bytes) { + if (!(bytes instanceof Uint8Array)) { + throw new Error('multihash must be a Uint8Array') + } + let buf = Buffer.isBuffer(bytes) + ? bytes + : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength) + + if (buf.length < 2) { + throw new Error('multihash too short. must be > 2 bytes.') + } + + const code = varint.decode(buf) + if (!exports.isValidCode(code)) { + throw new Error(`multihash unknown function code: 0x${code.toString(16)}`) + } + buf = buf.slice(varint.decode.bytes) + + const len = varint.decode(buf) + if (len < 0) { + throw new Error(`multihash invalid length: ${len}`) + } + buf = buf.slice(varint.decode.bytes) + + if (buf.length !== len) { + throw new Error(`multihash length inconsistent: 0x${buf.toString('hex')}`) + } + + return { + code, + name: codes[code], + length: len, + digest: buf + } +} + +/** + * Encode a hash digest along with the specified function code. + * + * > **Note:** the length is derived from the length of the digest itself. + * + * @param {Uint8Array} digest + * @param {string|number} code + * @param {number} [length] + * @returns {Buffer} + */ +exports.encode = function encode (digest, code, length) { + if (!digest || code === undefined) { + throw new Error('multihash encode requires at least two args: digest, code') + } + + // ensure it's a hashfunction code. + const hashfn = exports.coerceCode(code) + + if (!(digest instanceof Uint8Array)) { + throw new Error('digest should be a Uint8Array') + } + + if (length == null) { + length = digest.length + } + + if (length && digest.length !== length) { + throw new Error('digest length should be equal to specified length.') + } + + const hash = varint.encode(hashfn) + const len = varint.encode(length) + const buffer = Buffer.alloc(hash.length + len.length + digest.length) + buffer.set(hash, 0) + buffer.set(len, hash.length) + buffer.set(digest, hash.length + len.length) + return buffer +} + +/** + * Converts a hash function name into the matching code. + * If passed a number it will return the number if it's a valid code. + * @param {string|number} name + * @returns {number} + */ +exports.coerceCode = function coerceCode (name) { + let code = name + + if (typeof name === 'string') { + if (names[name] === undefined) { + throw new Error(`Unrecognized hash function named: ${name}`) + } + code = names[name] + } + + if (typeof code !== 'number') { + throw new Error(`Hash function code should be a number. Got: ${code}`) + } + + if (codes[code] === undefined && !exports.isAppCode(code)) { + throw new Error(`Unrecognized function code: ${code}`) + } + + return code +} + +/** + * Checks wether a code is part of the app range + * + * @param {number} code + * @returns {boolean} + */ +exports.isAppCode = function appCode (code) { + return code > 0 && code < 0x10 +} + +/** + * Checks whether a multihash code is valid. + * + * @param {number} code + * @returns {boolean} + */ +exports.isValidCode = function validCode (code) { + if (exports.isAppCode(code)) { + return true + } + + if (codes[code]) { + return true + } + + return false +} + +/** + * Check if the given buffer is a valid multihash. Throws an error if it is not valid. + * + * @param {Uint8Array} multihash + * @returns {void} + * @throws {Error} + */ +function validate (multihash) { + exports.decode(multihash) // throws if bad. +} +exports.validate = validate + +/** + * Returns a prefix from a valid multihash. Throws an error if it is not valid. + * + * @param {Uint8Array} multihash + * @returns {Buffer} + * @throws {Error} + */ +exports.prefix = function prefix (multihash) { + validate(multihash) + + return Buffer.from(multihash.buffer, multihash.byteOffset, 2) +} + + /***/ }), /***/ 86889: @@ -85277,6 +123821,2121 @@ function assert (t, m) { } +/***/ }), + +/***/ 62045: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; +var __webpack_unused_export__; +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +/* eslint-disable no-proto */ + + + +const base64 = __webpack_require__(67526) +const ieee754 = __webpack_require__(251) +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.hp = Buffer +__webpack_unused_export__ = SlowBuffer +exports.IS = 50 + +const K_MAX_LENGTH = 0x7fffffff +__webpack_unused_export__ = 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.IS + 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') +} + + /***/ }), /***/ 89211: @@ -85679,62 +126338,6 @@ module.exports = function getPolyfill() { }; -/***/ }), - -/***/ 51072: -/***/ ((__unused_webpack_module, exports) => { - -exports.endianness = function () { return 'LE' }; - -exports.hostname = function () { - if (typeof location !== 'undefined') { - return location.hostname - } - else return ''; -}; - -exports.loadavg = function () { return [] }; - -exports.uptime = function () { return 0 }; - -exports.freemem = function () { - return Number.MAX_VALUE; -}; - -exports.totalmem = function () { - return Number.MAX_VALUE; -}; - -exports.cpus = function () { return [] }; - -exports.type = function () { return 'Browser' }; - -exports.release = function () { - if (typeof navigator !== 'undefined') { - return navigator.appVersion; - } - return ''; -}; - -exports.networkInterfaces -= exports.getNetworkInterfaces -= function () { return {} }; - -exports.arch = function () { return 'javascript' }; - -exports.platform = function () { return 'browser' }; - -exports.tmpdir = exports.tmpDir = function () { - return '/tmp'; -}; - -exports.EOL = '\n'; - -exports.homedir = function () { - return '/' -}; - - /***/ }), /***/ 9805: @@ -92052,7 +132655,6 @@ module.exports = function (password, salt, iterations, keylen, digest, callback) /***/ 2455: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var process = __webpack_require__(65606); var defaultEncoding /* istanbul ignore next */ if (__webpack_require__.g.process && __webpack_require__.g.process.browser) { @@ -92462,10 +133064,9 @@ module.exports = [ /***/ }), /***/ 33225: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ ((module) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(65606); if (typeof process === 'undefined' || @@ -92513,197 +133114,6 @@ function nextTick(fn, arg1, arg2, arg3) { -/***/ }), - -/***/ 65606: -/***/ ((module) => { - -// shim for using process in browser -var process = module.exports = {}; - -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. - -var cachedSetTimeout; -var cachedClearTimeout; - -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); -} -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - - -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - - -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; - -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} - -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; - -process.listeners = function (name) { return [] } - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; - - /***/ }), /***/ 97168: @@ -96448,7 +136858,6 @@ module.exports = function xor (a, b) { /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(65606); // limit of Crypto.getRandomValues() @@ -96507,7 +136916,6 @@ function randomBytes (size, cb) { /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(65606); function oldBrowser () { @@ -96759,7 +137167,6 @@ module.exports.F = codes; /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(65606); // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -96937,7 +137344,6 @@ PassThrough.prototype._transform = function (chunk, encoding, cb) { /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(65606); // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -98169,7 +138575,6 @@ function done(stream, er, data) { /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(65606); // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -98818,7 +139223,6 @@ Writable.prototype._destroy = function (err, cb) { /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(65606); var _Object$setPrototypeO; @@ -99193,10 +139597,9 @@ module.exports = /*#__PURE__*/function () { /***/ }), /***/ 75896: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ ((module) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(65606); // undocumented cb() API, needed for core, not for public API @@ -99889,2495 +140292,6 @@ SafeBuffer.allocUnsafeSlow = function (size) { } -/***/ }), - -/***/ 93904: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const ANY = Symbol('SemVer ANY') -// hoisted class for cyclic dependency -class Comparator { - static get ANY () { - return ANY - } - - constructor (comp, options) { - options = parseOptions(options) - - if (comp instanceof Comparator) { - if (comp.loose === !!options.loose) { - return comp - } else { - comp = comp.value - } - } - - comp = comp.trim().split(/\s+/).join(' ') - debug('comparator', comp, options) - this.options = options - this.loose = !!options.loose - this.parse(comp) - - if (this.semver === ANY) { - this.value = '' - } else { - this.value = this.operator + this.semver.version - } - - debug('comp', this) - } - - parse (comp) { - const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] - const m = comp.match(r) - - if (!m) { - throw new TypeError(`Invalid comparator: ${comp}`) - } - - this.operator = m[1] !== undefined ? m[1] : '' - if (this.operator === '=') { - this.operator = '' - } - - // if it literally is just '>' or '' then allow anything. - if (!m[2]) { - this.semver = ANY - } else { - this.semver = new SemVer(m[2], this.options.loose) - } - } - - toString () { - return this.value - } - - test (version) { - debug('Comparator.test', version, this.options.loose) - - if (this.semver === ANY || version === ANY) { - return true - } - - if (typeof version === 'string') { - try { - version = new SemVer(version, this.options) - } catch (er) { - return false - } - } - - return cmp(version, this.operator, this.semver, this.options) - } - - intersects (comp, options) { - if (!(comp instanceof Comparator)) { - throw new TypeError('a Comparator is required') - } - - if (this.operator === '') { - if (this.value === '') { - return true - } - return new Range(comp.value, options).test(this.value) - } else if (comp.operator === '') { - if (comp.value === '') { - return true - } - return new Range(this.value, options).test(comp.semver) - } - - options = parseOptions(options) - - // Special cases where nothing can possibly be lower - if (options.includePrerelease && - (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) { - return false - } - if (!options.includePrerelease && - (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) { - return false - } - - // Same direction increasing (> or >=) - if (this.operator.startsWith('>') && comp.operator.startsWith('>')) { - return true - } - // Same direction decreasing (< or <=) - if (this.operator.startsWith('<') && comp.operator.startsWith('<')) { - return true - } - // same SemVer and both sides are inclusive (<= or >=) - if ( - (this.semver.version === comp.semver.version) && - this.operator.includes('=') && comp.operator.includes('=')) { - return true - } - // opposite directions less than - if (cmp(this.semver, '<', comp.semver, options) && - this.operator.startsWith('>') && comp.operator.startsWith('<')) { - return true - } - // opposite directions greater than - if (cmp(this.semver, '>', comp.semver, options) && - this.operator.startsWith('<') && comp.operator.startsWith('>')) { - return true - } - return false - } -} - -module.exports = Comparator - -const parseOptions = __webpack_require__(98587) -const { safeRe: re, t } = __webpack_require__(99718) -const cmp = __webpack_require__(72111) -const debug = __webpack_require__(57272) -const SemVer = __webpack_require__(53908) -const Range = __webpack_require__(78311) - - -/***/ }), - -/***/ 78311: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -// hoisted class for cyclic dependency -class Range { - constructor (range, options) { - options = parseOptions(options) - - if (range instanceof Range) { - if ( - range.loose === !!options.loose && - range.includePrerelease === !!options.includePrerelease - ) { - return range - } else { - return new Range(range.raw, options) - } - } - - if (range instanceof Comparator) { - // just put it in the set and return - this.raw = range.value - this.set = [[range]] - this.format() - return this - } - - this.options = options - this.loose = !!options.loose - this.includePrerelease = !!options.includePrerelease - - // First reduce all whitespace as much as possible so we do not have to rely - // on potentially slow regexes like \s*. This is then stored and used for - // future error messages as well. - this.raw = range - .trim() - .split(/\s+/) - .join(' ') - - // First, split on || - this.set = this.raw - .split('||') - // map the range to a 2d array of comparators - .map(r => this.parseRange(r.trim())) - // throw out any comparator lists that are empty - // this generally means that it was not a valid range, which is allowed - // in loose mode, but will still throw if the WHOLE range is invalid. - .filter(c => c.length) - - if (!this.set.length) { - throw new TypeError(`Invalid SemVer Range: ${this.raw}`) - } - - // if we have any that are not the null set, throw out null sets. - if (this.set.length > 1) { - // keep the first one, in case they're all null sets - const first = this.set[0] - this.set = this.set.filter(c => !isNullSet(c[0])) - if (this.set.length === 0) { - this.set = [first] - } else if (this.set.length > 1) { - // if we have any that are *, then the range is just * - for (const c of this.set) { - if (c.length === 1 && isAny(c[0])) { - this.set = [c] - break - } - } - } - } - - this.format() - } - - format () { - this.range = this.set - .map((comps) => comps.join(' ').trim()) - .join('||') - .trim() - return this.range - } - - toString () { - return this.range - } - - parseRange (range) { - // memoize range parsing for performance. - // this is a very hot path, and fully deterministic. - const memoOpts = - (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | - (this.options.loose && FLAG_LOOSE) - const memoKey = memoOpts + ':' + range - const cached = cache.get(memoKey) - if (cached) { - return cached - } - - const loose = this.options.loose - // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` - const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] - range = range.replace(hr, hyphenReplace(this.options.includePrerelease)) - debug('hyphen replace', range) - - // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) - debug('comparator trim', range) - - // `~ 1.2.3` => `~1.2.3` - range = range.replace(re[t.TILDETRIM], tildeTrimReplace) - debug('tilde trim', range) - - // `^ 1.2.3` => `^1.2.3` - range = range.replace(re[t.CARETTRIM], caretTrimReplace) - debug('caret trim', range) - - // At this point, the range is completely trimmed and - // ready to be split into comparators. - - let rangeList = range - .split(' ') - .map(comp => parseComparator(comp, this.options)) - .join(' ') - .split(/\s+/) - // >=0.0.0 is equivalent to * - .map(comp => replaceGTE0(comp, this.options)) - - if (loose) { - // in loose mode, throw out any that are not valid comparators - rangeList = rangeList.filter(comp => { - debug('loose invalid filter', comp, this.options) - return !!comp.match(re[t.COMPARATORLOOSE]) - }) - } - debug('range list', rangeList) - - // if any comparators are the null set, then replace with JUST null set - // if more than one comparator, remove any * comparators - // also, don't include the same comparator more than once - const rangeMap = new Map() - const comparators = rangeList.map(comp => new Comparator(comp, this.options)) - for (const comp of comparators) { - if (isNullSet(comp)) { - return [comp] - } - rangeMap.set(comp.value, comp) - } - if (rangeMap.size > 1 && rangeMap.has('')) { - rangeMap.delete('') - } - - const result = [...rangeMap.values()] - cache.set(memoKey, result) - return result - } - - intersects (range, options) { - if (!(range instanceof Range)) { - throw new TypeError('a Range is required') - } - - return this.set.some((thisComparators) => { - return ( - isSatisfiable(thisComparators, options) && - range.set.some((rangeComparators) => { - return ( - isSatisfiable(rangeComparators, options) && - thisComparators.every((thisComparator) => { - return rangeComparators.every((rangeComparator) => { - return thisComparator.intersects(rangeComparator, options) - }) - }) - ) - }) - ) - }) - } - - // if ANY of the sets match ALL of its comparators, then pass - test (version) { - if (!version) { - return false - } - - if (typeof version === 'string') { - try { - version = new SemVer(version, this.options) - } catch (er) { - return false - } - } - - for (let i = 0; i < this.set.length; i++) { - if (testSet(this.set[i], version, this.options)) { - return true - } - } - return false - } -} - -module.exports = Range - -const LRU = __webpack_require__(69749) -const cache = new LRU({ max: 1000 }) - -const parseOptions = __webpack_require__(98587) -const Comparator = __webpack_require__(93904) -const debug = __webpack_require__(57272) -const SemVer = __webpack_require__(53908) -const { - safeRe: re, - t, - comparatorTrimReplace, - tildeTrimReplace, - caretTrimReplace, -} = __webpack_require__(99718) -const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = __webpack_require__(16874) - -const isNullSet = c => c.value === '<0.0.0-0' -const isAny = c => c.value === '' - -// take a set of comparators and determine whether there -// exists a version which can satisfy it -const isSatisfiable = (comparators, options) => { - let result = true - const remainingComparators = comparators.slice() - let testComparator = remainingComparators.pop() - - while (result && remainingComparators.length) { - result = remainingComparators.every((otherComparator) => { - return testComparator.intersects(otherComparator, options) - }) - - testComparator = remainingComparators.pop() - } - - return result -} - -// comprised of xranges, tildes, stars, and gtlt's at this point. -// already replaced the hyphen ranges -// turn into a set of JUST comparators. -const parseComparator = (comp, options) => { - debug('comp', comp, options) - comp = replaceCarets(comp, options) - debug('caret', comp) - comp = replaceTildes(comp, options) - debug('tildes', comp) - comp = replaceXRanges(comp, options) - debug('xrange', comp) - comp = replaceStars(comp, options) - debug('stars', comp) - return comp -} - -const isX = id => !id || id.toLowerCase() === 'x' || id === '*' - -// ~, ~> --> * (any, kinda silly) -// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0 -// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0 -// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0 -// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0 -// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0 -// ~0.0.1 --> >=0.0.1 <0.1.0-0 -const replaceTildes = (comp, options) => { - return comp - .trim() - .split(/\s+/) - .map((c) => replaceTilde(c, options)) - .join(' ') -} - -const replaceTilde = (comp, options) => { - const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE] - return comp.replace(r, (_, M, m, p, pr) => { - debug('tilde', comp, _, M, m, p, pr) - let ret - - if (isX(M)) { - ret = '' - } else if (isX(m)) { - ret = `>=${M}.0.0 <${+M + 1}.0.0-0` - } else if (isX(p)) { - // ~1.2 == >=1.2.0 <1.3.0-0 - ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0` - } else if (pr) { - debug('replaceTilde pr', pr) - ret = `>=${M}.${m}.${p}-${pr - } <${M}.${+m + 1}.0-0` - } else { - // ~1.2.3 == >=1.2.3 <1.3.0-0 - ret = `>=${M}.${m}.${p - } <${M}.${+m + 1}.0-0` - } - - debug('tilde return', ret) - return ret - }) -} - -// ^ --> * (any, kinda silly) -// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0 -// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0 -// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0 -// ^1.2.3 --> >=1.2.3 <2.0.0-0 -// ^1.2.0 --> >=1.2.0 <2.0.0-0 -// ^0.0.1 --> >=0.0.1 <0.0.2-0 -// ^0.1.0 --> >=0.1.0 <0.2.0-0 -const replaceCarets = (comp, options) => { - return comp - .trim() - .split(/\s+/) - .map((c) => replaceCaret(c, options)) - .join(' ') -} - -const replaceCaret = (comp, options) => { - debug('caret', comp, options) - const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET] - const z = options.includePrerelease ? '-0' : '' - return comp.replace(r, (_, M, m, p, pr) => { - debug('caret', comp, _, M, m, p, pr) - let ret - - if (isX(M)) { - ret = '' - } else if (isX(m)) { - ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0` - } else if (isX(p)) { - if (M === '0') { - ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0` - } else { - ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0` - } - } else if (pr) { - debug('replaceCaret pr', pr) - if (M === '0') { - if (m === '0') { - ret = `>=${M}.${m}.${p}-${pr - } <${M}.${m}.${+p + 1}-0` - } else { - ret = `>=${M}.${m}.${p}-${pr - } <${M}.${+m + 1}.0-0` - } - } else { - ret = `>=${M}.${m}.${p}-${pr - } <${+M + 1}.0.0-0` - } - } else { - debug('no pr') - if (M === '0') { - if (m === '0') { - ret = `>=${M}.${m}.${p - }${z} <${M}.${m}.${+p + 1}-0` - } else { - ret = `>=${M}.${m}.${p - }${z} <${M}.${+m + 1}.0-0` - } - } else { - ret = `>=${M}.${m}.${p - } <${+M + 1}.0.0-0` - } - } - - debug('caret return', ret) - return ret - }) -} - -const replaceXRanges = (comp, options) => { - debug('replaceXRanges', comp, options) - return comp - .split(/\s+/) - .map((c) => replaceXRange(c, options)) - .join(' ') -} - -const replaceXRange = (comp, options) => { - comp = comp.trim() - const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE] - return comp.replace(r, (ret, gtlt, M, m, p, pr) => { - debug('xRange', comp, ret, gtlt, M, m, p, pr) - const xM = isX(M) - const xm = xM || isX(m) - const xp = xm || isX(p) - const anyX = xp - - if (gtlt === '=' && anyX) { - gtlt = '' - } - - // if we're including prereleases in the match, then we need - // to fix this to -0, the lowest possible prerelease value - pr = options.includePrerelease ? '-0' : '' - - if (xM) { - if (gtlt === '>' || gtlt === '<') { - // nothing is allowed - ret = '<0.0.0-0' - } else { - // nothing is forbidden - ret = '*' - } - } else if (gtlt && anyX) { - // we know patch is an x, because we have any x at all. - // replace X with 0 - if (xm) { - m = 0 - } - p = 0 - - if (gtlt === '>') { - // >1 => >=2.0.0 - // >1.2 => >=1.3.0 - gtlt = '>=' - if (xm) { - M = +M + 1 - m = 0 - p = 0 - } else { - m = +m + 1 - p = 0 - } - } else if (gtlt === '<=') { - // <=0.7.x is actually <0.8.0, since any 0.7.x should - // pass. Similarly, <=7.x is actually <8.0.0, etc. - gtlt = '<' - if (xm) { - M = +M + 1 - } else { - m = +m + 1 - } - } - - if (gtlt === '<') { - pr = '-0' - } - - ret = `${gtlt + M}.${m}.${p}${pr}` - } else if (xm) { - ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0` - } else if (xp) { - ret = `>=${M}.${m}.0${pr - } <${M}.${+m + 1}.0-0` - } - - debug('xRange return', ret) - - return ret - }) -} - -// Because * is AND-ed with everything else in the comparator, -// and '' means "any version", just remove the *s entirely. -const replaceStars = (comp, options) => { - debug('replaceStars', comp, options) - // Looseness is ignored here. star is always as loose as it gets! - return comp - .trim() - .replace(re[t.STAR], '') -} - -const replaceGTE0 = (comp, options) => { - debug('replaceGTE0', comp, options) - return comp - .trim() - .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '') -} - -// This function is passed to string.replace(re[t.HYPHENRANGE]) -// M, m, patch, prerelease, build -// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 -// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do -// 1.2 - 3.4 => >=1.2.0 <3.5.0-0 -const hyphenReplace = incPr => ($0, - from, fM, fm, fp, fpr, fb, - to, tM, tm, tp, tpr, tb) => { - if (isX(fM)) { - from = '' - } else if (isX(fm)) { - from = `>=${fM}.0.0${incPr ? '-0' : ''}` - } else if (isX(fp)) { - from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}` - } else if (fpr) { - from = `>=${from}` - } else { - from = `>=${from}${incPr ? '-0' : ''}` - } - - if (isX(tM)) { - to = '' - } else if (isX(tm)) { - to = `<${+tM + 1}.0.0-0` - } else if (isX(tp)) { - to = `<${tM}.${+tm + 1}.0-0` - } else if (tpr) { - to = `<=${tM}.${tm}.${tp}-${tpr}` - } else if (incPr) { - to = `<${tM}.${tm}.${+tp + 1}-0` - } else { - to = `<=${to}` - } - - return `${from} ${to}`.trim() -} - -const testSet = (set, version, options) => { - for (let i = 0; i < set.length; i++) { - if (!set[i].test(version)) { - return false - } - } - - if (version.prerelease.length && !options.includePrerelease) { - // Find the set of versions that are allowed to have prereleases - // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 - // That should allow `1.2.3-pr.2` to pass. - // However, `1.2.4-alpha.notready` should NOT be allowed, - // even though it's within the range set by the comparators. - for (let i = 0; i < set.length; i++) { - debug(set[i].semver) - if (set[i].semver === Comparator.ANY) { - continue - } - - if (set[i].semver.prerelease.length > 0) { - const allowed = set[i].semver - if (allowed.major === version.major && - allowed.minor === version.minor && - allowed.patch === version.patch) { - return true - } - } - } - - // Version has a -pre, but it's not one of the ones we like. - return false - } - - return true -} - - -/***/ }), - -/***/ 53908: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const debug = __webpack_require__(57272) -const { MAX_LENGTH, MAX_SAFE_INTEGER } = __webpack_require__(16874) -const { safeRe: re, t } = __webpack_require__(99718) - -const parseOptions = __webpack_require__(98587) -const { compareIdentifiers } = __webpack_require__(61123) -class SemVer { - constructor (version, options) { - options = parseOptions(options) - - if (version instanceof SemVer) { - if (version.loose === !!options.loose && - version.includePrerelease === !!options.includePrerelease) { - return version - } else { - version = version.version - } - } else if (typeof version !== 'string') { - throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`) - } - - if (version.length > MAX_LENGTH) { - throw new TypeError( - `version is longer than ${MAX_LENGTH} characters` - ) - } - - debug('SemVer', version, options) - this.options = options - this.loose = !!options.loose - // this isn't actually relevant for versions, but keep it so that we - // don't run into trouble passing this.options around. - this.includePrerelease = !!options.includePrerelease - - const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]) - - if (!m) { - throw new TypeError(`Invalid Version: ${version}`) - } - - this.raw = version - - // these are actually numbers - this.major = +m[1] - this.minor = +m[2] - this.patch = +m[3] - - if (this.major > MAX_SAFE_INTEGER || this.major < 0) { - throw new TypeError('Invalid major version') - } - - if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { - throw new TypeError('Invalid minor version') - } - - if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { - throw new TypeError('Invalid patch version') - } - - // numberify any prerelease numeric ids - if (!m[4]) { - this.prerelease = [] - } else { - this.prerelease = m[4].split('.').map((id) => { - if (/^[0-9]+$/.test(id)) { - const num = +id - if (num >= 0 && num < MAX_SAFE_INTEGER) { - return num - } - } - return id - }) - } - - this.build = m[5] ? m[5].split('.') : [] - this.format() - } - - format () { - this.version = `${this.major}.${this.minor}.${this.patch}` - if (this.prerelease.length) { - this.version += `-${this.prerelease.join('.')}` - } - return this.version - } - - toString () { - return this.version - } - - compare (other) { - debug('SemVer.compare', this.version, this.options, other) - if (!(other instanceof SemVer)) { - if (typeof other === 'string' && other === this.version) { - return 0 - } - other = new SemVer(other, this.options) - } - - if (other.version === this.version) { - return 0 - } - - return this.compareMain(other) || this.comparePre(other) - } - - compareMain (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - return ( - compareIdentifiers(this.major, other.major) || - compareIdentifiers(this.minor, other.minor) || - compareIdentifiers(this.patch, other.patch) - ) - } - - comparePre (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - // NOT having a prerelease is > having one - if (this.prerelease.length && !other.prerelease.length) { - return -1 - } else if (!this.prerelease.length && other.prerelease.length) { - return 1 - } else if (!this.prerelease.length && !other.prerelease.length) { - return 0 - } - - let i = 0 - do { - const a = this.prerelease[i] - const b = other.prerelease[i] - debug('prerelease compare', i, a, b) - if (a === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - return -1 - } else if (a === b) { - continue - } else { - return compareIdentifiers(a, b) - } - } while (++i) - } - - compareBuild (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - let i = 0 - do { - const a = this.build[i] - const b = other.build[i] - debug('prerelease compare', i, a, b) - if (a === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - return -1 - } else if (a === b) { - continue - } else { - return compareIdentifiers(a, b) - } - } while (++i) - } - - // preminor will bump the version up to the next minor release, and immediately - // down to pre-release. premajor and prepatch work the same way. - inc (release, identifier, identifierBase) { - switch (release) { - case 'premajor': - this.prerelease.length = 0 - this.patch = 0 - this.minor = 0 - this.major++ - this.inc('pre', identifier, identifierBase) - break - case 'preminor': - this.prerelease.length = 0 - this.patch = 0 - this.minor++ - this.inc('pre', identifier, identifierBase) - break - case 'prepatch': - // If this is already a prerelease, it will bump to the next version - // drop any prereleases that might already exist, since they are not - // relevant at this point. - this.prerelease.length = 0 - this.inc('patch', identifier, identifierBase) - this.inc('pre', identifier, identifierBase) - break - // If the input is a non-prerelease version, this acts the same as - // prepatch. - case 'prerelease': - if (this.prerelease.length === 0) { - this.inc('patch', identifier, identifierBase) - } - this.inc('pre', identifier, identifierBase) - break - - case 'major': - // If this is a pre-major version, bump up to the same major version. - // Otherwise increment major. - // 1.0.0-5 bumps to 1.0.0 - // 1.1.0 bumps to 2.0.0 - if ( - this.minor !== 0 || - this.patch !== 0 || - this.prerelease.length === 0 - ) { - this.major++ - } - this.minor = 0 - this.patch = 0 - this.prerelease = [] - break - case 'minor': - // If this is a pre-minor version, bump up to the same minor version. - // Otherwise increment minor. - // 1.2.0-5 bumps to 1.2.0 - // 1.2.1 bumps to 1.3.0 - if (this.patch !== 0 || this.prerelease.length === 0) { - this.minor++ - } - this.patch = 0 - this.prerelease = [] - break - case 'patch': - // If this is not a pre-release version, it will increment the patch. - // If it is a pre-release it will bump up to the same patch version. - // 1.2.0-5 patches to 1.2.0 - // 1.2.0 patches to 1.2.1 - if (this.prerelease.length === 0) { - this.patch++ - } - this.prerelease = [] - break - // This probably shouldn't be used publicly. - // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. - case 'pre': { - const base = Number(identifierBase) ? 1 : 0 - - if (!identifier && identifierBase === false) { - throw new Error('invalid increment argument: identifier is empty') - } - - if (this.prerelease.length === 0) { - this.prerelease = [base] - } else { - let i = this.prerelease.length - while (--i >= 0) { - if (typeof this.prerelease[i] === 'number') { - this.prerelease[i]++ - i = -2 - } - } - if (i === -1) { - // didn't increment anything - if (identifier === this.prerelease.join('.') && identifierBase === false) { - throw new Error('invalid increment argument: identifier already exists') - } - this.prerelease.push(base) - } - } - if (identifier) { - // 1.2.0-beta.1 bumps to 1.2.0-beta.2, - // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 - let prerelease = [identifier, base] - if (identifierBase === false) { - prerelease = [identifier] - } - if (compareIdentifiers(this.prerelease[0], identifier) === 0) { - if (isNaN(this.prerelease[1])) { - this.prerelease = prerelease - } - } else { - this.prerelease = prerelease - } - } - break - } - default: - throw new Error(`invalid increment argument: ${release}`) - } - this.raw = this.format() - if (this.build.length) { - this.raw += `+${this.build.join('.')}` - } - return this - } -} - -module.exports = SemVer - - -/***/ }), - -/***/ 57414: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const parse = __webpack_require__(30144) -const clean = (version, options) => { - const s = parse(version.trim().replace(/^[=v]+/, ''), options) - return s ? s.version : null -} -module.exports = clean - - -/***/ }), - -/***/ 72111: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const eq = __webpack_require__(94641) -const neq = __webpack_require__(13999) -const gt = __webpack_require__(35580) -const gte = __webpack_require__(54089) -const lt = __webpack_require__(7059) -const lte = __webpack_require__(25200) - -const cmp = (a, op, b, loose) => { - switch (op) { - case '===': - if (typeof a === 'object') { - a = a.version - } - if (typeof b === 'object') { - b = b.version - } - return a === b - - case '!==': - if (typeof a === 'object') { - a = a.version - } - if (typeof b === 'object') { - b = b.version - } - return a !== b - - case '': - case '=': - case '==': - return eq(a, b, loose) - - case '!=': - return neq(a, b, loose) - - case '>': - return gt(a, b, loose) - - case '>=': - return gte(a, b, loose) - - case '<': - return lt(a, b, loose) - - case '<=': - return lte(a, b, loose) - - default: - throw new TypeError(`Invalid operator: ${op}`) - } -} -module.exports = cmp - - -/***/ }), - -/***/ 46170: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(53908) -const parse = __webpack_require__(30144) -const { safeRe: re, t } = __webpack_require__(99718) - -const coerce = (version, options) => { - if (version instanceof SemVer) { - return version - } - - if (typeof version === 'number') { - version = String(version) - } - - if (typeof version !== 'string') { - return null - } - - options = options || {} - - let match = null - if (!options.rtl) { - match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]) - } else { - // Find the right-most coercible string that does not share - // a terminus with a more left-ward coercible string. - // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' - // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4' - // - // Walk through the string checking with a /g regexp - // Manually set the index so as to pick up overlapping matches. - // Stop when we get a match that ends at the string end, since no - // coercible string can be more right-ward without the same terminus. - const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL] - let next - while ((next = coerceRtlRegex.exec(version)) && - (!match || match.index + match[0].length !== version.length) - ) { - if (!match || - next.index + next[0].length !== match.index + match[0].length) { - match = next - } - coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length - } - // leave it in a clean state - coerceRtlRegex.lastIndex = -1 - } - - if (match === null) { - return null - } - - const major = match[2] - const minor = match[3] || '0' - const patch = match[4] || '0' - const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : '' - const build = options.includePrerelease && match[6] ? `+${match[6]}` : '' - - return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options) -} -module.exports = coerce - - -/***/ }), - -/***/ 40909: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(53908) -const compareBuild = (a, b, loose) => { - const versionA = new SemVer(a, loose) - const versionB = new SemVer(b, loose) - return versionA.compare(versionB) || versionA.compareBuild(versionB) -} -module.exports = compareBuild - - -/***/ }), - -/***/ 11763: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const compare = __webpack_require__(50560) -const compareLoose = (a, b) => compare(a, b, true) -module.exports = compareLoose - - -/***/ }), - -/***/ 50560: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(53908) -const compare = (a, b, loose) => - new SemVer(a, loose).compare(new SemVer(b, loose)) - -module.exports = compare - - -/***/ }), - -/***/ 51832: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const parse = __webpack_require__(30144) - -const diff = (version1, version2) => { - const v1 = parse(version1, null, true) - const v2 = parse(version2, null, true) - const comparison = v1.compare(v2) - - if (comparison === 0) { - return null - } - - const v1Higher = comparison > 0 - const highVersion = v1Higher ? v1 : v2 - const lowVersion = v1Higher ? v2 : v1 - const highHasPre = !!highVersion.prerelease.length - const lowHasPre = !!lowVersion.prerelease.length - - if (lowHasPre && !highHasPre) { - // Going from prerelease -> no prerelease requires some special casing - - // If the low version has only a major, then it will always be a major - // Some examples: - // 1.0.0-1 -> 1.0.0 - // 1.0.0-1 -> 1.1.1 - // 1.0.0-1 -> 2.0.0 - if (!lowVersion.patch && !lowVersion.minor) { - return 'major' - } - - // Otherwise it can be determined by checking the high version - - if (highVersion.patch) { - // anything higher than a patch bump would result in the wrong version - return 'patch' - } - - if (highVersion.minor) { - // anything higher than a minor bump would result in the wrong version - return 'minor' - } - - // bumping major/minor/patch all have same result - return 'major' - } - - // add the `pre` prefix if we are going to a prerelease version - const prefix = highHasPre ? 'pre' : '' - - if (v1.major !== v2.major) { - return prefix + 'major' - } - - if (v1.minor !== v2.minor) { - return prefix + 'minor' - } - - if (v1.patch !== v2.patch) { - return prefix + 'patch' - } - - // high and low are preleases - return 'prerelease' -} - -module.exports = diff - - -/***/ }), - -/***/ 94641: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const compare = __webpack_require__(50560) -const eq = (a, b, loose) => compare(a, b, loose) === 0 -module.exports = eq - - -/***/ }), - -/***/ 35580: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const compare = __webpack_require__(50560) -const gt = (a, b, loose) => compare(a, b, loose) > 0 -module.exports = gt - - -/***/ }), - -/***/ 54089: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const compare = __webpack_require__(50560) -const gte = (a, b, loose) => compare(a, b, loose) >= 0 -module.exports = gte - - -/***/ }), - -/***/ 93007: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(53908) - -const inc = (version, release, options, identifier, identifierBase) => { - if (typeof (options) === 'string') { - identifierBase = identifier - identifier = options - options = undefined - } - - try { - return new SemVer( - version instanceof SemVer ? version.version : version, - options - ).inc(release, identifier, identifierBase).version - } catch (er) { - return null - } -} -module.exports = inc - - -/***/ }), - -/***/ 7059: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const compare = __webpack_require__(50560) -const lt = (a, b, loose) => compare(a, b, loose) < 0 -module.exports = lt - - -/***/ }), - -/***/ 25200: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const compare = __webpack_require__(50560) -const lte = (a, b, loose) => compare(a, b, loose) <= 0 -module.exports = lte - - -/***/ }), - -/***/ 32938: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(53908) -const major = (a, loose) => new SemVer(a, loose).major -module.exports = major - - -/***/ }), - -/***/ 46254: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(53908) -const minor = (a, loose) => new SemVer(a, loose).minor -module.exports = minor - - -/***/ }), - -/***/ 13999: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const compare = __webpack_require__(50560) -const neq = (a, b, loose) => compare(a, b, loose) !== 0 -module.exports = neq - - -/***/ }), - -/***/ 30144: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(53908) -const parse = (version, options, throwErrors = false) => { - if (version instanceof SemVer) { - return version - } - try { - return new SemVer(version, options) - } catch (er) { - if (!throwErrors) { - return null - } - throw er - } -} - -module.exports = parse - - -/***/ }), - -/***/ 24493: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(53908) -const patch = (a, loose) => new SemVer(a, loose).patch -module.exports = patch - - -/***/ }), - -/***/ 31729: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const parse = __webpack_require__(30144) -const prerelease = (version, options) => { - const parsed = parse(version, options) - return (parsed && parsed.prerelease.length) ? parsed.prerelease : null -} -module.exports = prerelease - - -/***/ }), - -/***/ 9970: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const compare = __webpack_require__(50560) -const rcompare = (a, b, loose) => compare(b, a, loose) -module.exports = rcompare - - -/***/ }), - -/***/ 74277: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const compareBuild = __webpack_require__(40909) -const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)) -module.exports = rsort - - -/***/ }), - -/***/ 97638: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const Range = __webpack_require__(78311) -const satisfies = (version, range, options) => { - try { - range = new Range(range, options) - } catch (er) { - return false - } - return range.test(version) -} -module.exports = satisfies - - -/***/ }), - -/***/ 43927: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const compareBuild = __webpack_require__(40909) -const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)) -module.exports = sort - - -/***/ }), - -/***/ 56953: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const parse = __webpack_require__(30144) -const valid = (version, options) => { - const v = parse(version, options) - return v ? v.version : null -} -module.exports = valid - - -/***/ }), - -/***/ 99589: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -// just pre-load all the stuff that index.js lazily exports -const internalRe = __webpack_require__(99718) -const constants = __webpack_require__(16874) -const SemVer = __webpack_require__(53908) -const identifiers = __webpack_require__(61123) -const parse = __webpack_require__(30144) -const valid = __webpack_require__(56953) -const clean = __webpack_require__(57414) -const inc = __webpack_require__(93007) -const diff = __webpack_require__(51832) -const major = __webpack_require__(32938) -const minor = __webpack_require__(46254) -const patch = __webpack_require__(24493) -const prerelease = __webpack_require__(31729) -const compare = __webpack_require__(50560) -const rcompare = __webpack_require__(9970) -const compareLoose = __webpack_require__(11763) -const compareBuild = __webpack_require__(40909) -const sort = __webpack_require__(43927) -const rsort = __webpack_require__(74277) -const gt = __webpack_require__(35580) -const lt = __webpack_require__(7059) -const eq = __webpack_require__(94641) -const neq = __webpack_require__(13999) -const gte = __webpack_require__(54089) -const lte = __webpack_require__(25200) -const cmp = __webpack_require__(72111) -const coerce = __webpack_require__(46170) -const Comparator = __webpack_require__(93904) -const Range = __webpack_require__(78311) -const satisfies = __webpack_require__(97638) -const toComparators = __webpack_require__(77631) -const maxSatisfying = __webpack_require__(19628) -const minSatisfying = __webpack_require__(270) -const minVersion = __webpack_require__(41261) -const validRange = __webpack_require__(13874) -const outside = __webpack_require__(97075) -const gtr = __webpack_require__(75571) -const ltr = __webpack_require__(5342) -const intersects = __webpack_require__(76780) -const simplifyRange = __webpack_require__(72525) -const subset = __webpack_require__(75032) -module.exports = { - parse, - valid, - clean, - inc, - diff, - major, - minor, - patch, - prerelease, - compare, - rcompare, - compareLoose, - compareBuild, - sort, - rsort, - gt, - lt, - eq, - neq, - gte, - lte, - cmp, - coerce, - Comparator, - Range, - satisfies, - toComparators, - maxSatisfying, - minSatisfying, - minVersion, - validRange, - outside, - gtr, - ltr, - intersects, - simplifyRange, - subset, - SemVer, - re: internalRe.re, - src: internalRe.src, - tokens: internalRe.t, - SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION, - RELEASE_TYPES: constants.RELEASE_TYPES, - compareIdentifiers: identifiers.compareIdentifiers, - rcompareIdentifiers: identifiers.rcompareIdentifiers, -} - - -/***/ }), - -/***/ 16874: -/***/ ((module) => { - -// Note: this is the semver.org version of the spec that it implements -// Not necessarily the package version of this code. -const SEMVER_SPEC_VERSION = '2.0.0' - -const MAX_LENGTH = 256 -const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || -/* istanbul ignore next */ 9007199254740991 - -// Max safe segment length for coercion. -const MAX_SAFE_COMPONENT_LENGTH = 16 - -// Max safe length for a build identifier. The max length minus 6 characters for -// the shortest version with a build 0.0.0+BUILD. -const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6 - -const RELEASE_TYPES = [ - 'major', - 'premajor', - 'minor', - 'preminor', - 'patch', - 'prepatch', - 'prerelease', -] - -module.exports = { - MAX_LENGTH, - MAX_SAFE_COMPONENT_LENGTH, - MAX_SAFE_BUILD_LENGTH, - MAX_SAFE_INTEGER, - RELEASE_TYPES, - SEMVER_SPEC_VERSION, - FLAG_INCLUDE_PRERELEASE: 0b001, - FLAG_LOOSE: 0b010, -} - - -/***/ }), - -/***/ 57272: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* provided dependency */ var process = __webpack_require__(65606); -/* provided dependency */ var console = __webpack_require__(96763); -const debug = ( - typeof process === 'object' && - process.env && - process.env.NODE_DEBUG && - /\bsemver\b/i.test(process.env.NODE_DEBUG) -) ? (...args) => console.error('SEMVER', ...args) - : () => {} - -module.exports = debug - - -/***/ }), - -/***/ 61123: -/***/ ((module) => { - -const numeric = /^[0-9]+$/ -const compareIdentifiers = (a, b) => { - const anum = numeric.test(a) - const bnum = numeric.test(b) - - if (anum && bnum) { - a = +a - b = +b - } - - return a === b ? 0 - : (anum && !bnum) ? -1 - : (bnum && !anum) ? 1 - : a < b ? -1 - : 1 -} - -const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a) - -module.exports = { - compareIdentifiers, - rcompareIdentifiers, -} - - -/***/ }), - -/***/ 98587: -/***/ ((module) => { - -// parse out just the options we care about -const looseOption = Object.freeze({ loose: true }) -const emptyOpts = Object.freeze({ }) -const parseOptions = options => { - if (!options) { - return emptyOpts - } - - if (typeof options !== 'object') { - return looseOption - } - - return options -} -module.exports = parseOptions - - -/***/ }), - -/***/ 99718: -/***/ ((module, exports, __webpack_require__) => { - -const { - MAX_SAFE_COMPONENT_LENGTH, - MAX_SAFE_BUILD_LENGTH, - MAX_LENGTH, -} = __webpack_require__(16874) -const debug = __webpack_require__(57272) -exports = module.exports = {} - -// The actual regexps go on exports.re -const re = exports.re = [] -const safeRe = exports.safeRe = [] -const src = exports.src = [] -const t = exports.t = {} -let R = 0 - -const LETTERDASHNUMBER = '[a-zA-Z0-9-]' - -// Replace some greedy regex tokens to prevent regex dos issues. These regex are -// used internally via the safeRe object since all inputs in this library get -// normalized first to trim and collapse all extra whitespace. The original -// regexes are exported for userland consumption and lower level usage. A -// future breaking change could export the safer regex only with a note that -// all input should have extra whitespace removed. -const safeRegexReplacements = [ - ['\\s', 1], - ['\\d', MAX_LENGTH], - [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH], -] - -const makeSafeRegex = (value) => { - for (const [token, max] of safeRegexReplacements) { - value = value - .split(`${token}*`).join(`${token}{0,${max}}`) - .split(`${token}+`).join(`${token}{1,${max}}`) - } - return value -} - -const createToken = (name, value, isGlobal) => { - const safe = makeSafeRegex(value) - const index = R++ - debug(name, index, value) - t[name] = index - src[index] = value - re[index] = new RegExp(value, isGlobal ? 'g' : undefined) - safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined) -} - -// The following Regular Expressions can be used for tokenizing, -// validating, and parsing SemVer version strings. - -// ## Numeric Identifier -// A single `0`, or a non-zero digit followed by zero or more digits. - -createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*') -createToken('NUMERICIDENTIFIERLOOSE', '\\d+') - -// ## Non-numeric Identifier -// Zero or more digits, followed by a letter or hyphen, and then zero or -// more letters, digits, or hyphens. - -createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`) - -// ## Main Version -// Three dot-separated numeric identifiers. - -createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + - `(${src[t.NUMERICIDENTIFIER]})\\.` + - `(${src[t.NUMERICIDENTIFIER]})`) - -createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + - `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + - `(${src[t.NUMERICIDENTIFIERLOOSE]})`) - -// ## Pre-release Version Identifier -// A numeric identifier, or a non-numeric identifier. - -createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER] -}|${src[t.NONNUMERICIDENTIFIER]})`) - -createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE] -}|${src[t.NONNUMERICIDENTIFIER]})`) - -// ## Pre-release Version -// Hyphen, followed by one or more dot-separated pre-release version -// identifiers. - -createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER] -}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`) - -createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE] -}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`) - -// ## Build Metadata Identifier -// Any combination of digits, letters, or hyphens. - -createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`) - -// ## Build Metadata -// Plus sign, followed by one or more period-separated build metadata -// identifiers. - -createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER] -}(?:\\.${src[t.BUILDIDENTIFIER]})*))`) - -// ## Full Version String -// A main version, followed optionally by a pre-release version and -// build metadata. - -// Note that the only major, minor, patch, and pre-release sections of -// the version string are capturing groups. The build metadata is not a -// capturing group, because it should not ever be used in version -// comparison. - -createToken('FULLPLAIN', `v?${src[t.MAINVERSION] -}${src[t.PRERELEASE]}?${ - src[t.BUILD]}?`) - -createToken('FULL', `^${src[t.FULLPLAIN]}$`) - -// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. -// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty -// common in the npm registry. -createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] -}${src[t.PRERELEASELOOSE]}?${ - src[t.BUILD]}?`) - -createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`) - -createToken('GTLT', '((?:<|>)?=?)') - -// Something like "2.*" or "1.2.x". -// Note that "x.x" is a valid xRange identifer, meaning "any version" -// Only the first item is strictly required. -createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`) -createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`) - -createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + - `(?:${src[t.PRERELEASE]})?${ - src[t.BUILD]}?` + - `)?)?`) - -createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + - `(?:${src[t.PRERELEASELOOSE]})?${ - src[t.BUILD]}?` + - `)?)?`) - -createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`) -createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`) - -// Coercion. -// Extract anything that could conceivably be a part of a valid semver -createToken('COERCEPLAIN', `${'(^|[^\\d])' + - '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + - `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + - `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`) -createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`) -createToken('COERCEFULL', src[t.COERCEPLAIN] + - `(?:${src[t.PRERELEASE]})?` + - `(?:${src[t.BUILD]})?` + - `(?:$|[^\\d])`) -createToken('COERCERTL', src[t.COERCE], true) -createToken('COERCERTLFULL', src[t.COERCEFULL], true) - -// Tilde ranges. -// Meaning is "reasonably at or greater than" -createToken('LONETILDE', '(?:~>?)') - -createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true) -exports.tildeTrimReplace = '$1~' - -createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`) -createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`) - -// Caret ranges. -// Meaning is "at least and backwards compatible with" -createToken('LONECARET', '(?:\\^)') - -createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true) -exports.caretTrimReplace = '$1^' - -createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`) -createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`) - -// A simple gt/lt/eq thing, or just "" to indicate "any version" -createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`) -createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`) - -// An expression to strip any whitespace between the gtlt and the thing -// it modifies, so that `> 1.2.3` ==> `>1.2.3` -createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT] -}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true) -exports.comparatorTrimReplace = '$1$2$3' - -// Something like `1.2.3 - 1.2.4` -// Note that these all use the loose form, because they'll be -// checked against either the strict or loose comparator form -// later. -createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + - `\\s+-\\s+` + - `(${src[t.XRANGEPLAIN]})` + - `\\s*$`) - -createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + - `\\s+-\\s+` + - `(${src[t.XRANGEPLAINLOOSE]})` + - `\\s*$`) - -// Star ranges basically just allow anything at all. -createToken('STAR', '(<|>)?=?\\s*\\*') -// >=0.0.0 is like a star -createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$') -createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$') - - -/***/ }), - -/***/ 75571: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -// Determine if version is greater than all the versions possible in the range. -const outside = __webpack_require__(97075) -const gtr = (version, range, options) => outside(version, range, '>', options) -module.exports = gtr - - -/***/ }), - -/***/ 76780: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const Range = __webpack_require__(78311) -const intersects = (r1, r2, options) => { - r1 = new Range(r1, options) - r2 = new Range(r2, options) - return r1.intersects(r2, options) -} -module.exports = intersects - - -/***/ }), - -/***/ 5342: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const outside = __webpack_require__(97075) -// Determine if version is less than all the versions possible in the range -const ltr = (version, range, options) => outside(version, range, '<', options) -module.exports = ltr - - -/***/ }), - -/***/ 19628: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(53908) -const Range = __webpack_require__(78311) - -const maxSatisfying = (versions, range, options) => { - let max = null - let maxSV = null - let rangeObj = null - try { - rangeObj = new Range(range, options) - } catch (er) { - return null - } - versions.forEach((v) => { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!max || maxSV.compare(v) === -1) { - // compare(max, v, true) - max = v - maxSV = new SemVer(max, options) - } - } - }) - return max -} -module.exports = maxSatisfying - - -/***/ }), - -/***/ 270: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(53908) -const Range = __webpack_require__(78311) -const minSatisfying = (versions, range, options) => { - let min = null - let minSV = null - let rangeObj = null - try { - rangeObj = new Range(range, options) - } catch (er) { - return null - } - versions.forEach((v) => { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!min || minSV.compare(v) === 1) { - // compare(min, v, true) - min = v - minSV = new SemVer(min, options) - } - } - }) - return min -} -module.exports = minSatisfying - - -/***/ }), - -/***/ 41261: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(53908) -const Range = __webpack_require__(78311) -const gt = __webpack_require__(35580) - -const minVersion = (range, loose) => { - range = new Range(range, loose) - - let minver = new SemVer('0.0.0') - if (range.test(minver)) { - return minver - } - - minver = new SemVer('0.0.0-0') - if (range.test(minver)) { - return minver - } - - minver = null - for (let i = 0; i < range.set.length; ++i) { - const comparators = range.set[i] - - let setMin = null - comparators.forEach((comparator) => { - // Clone to avoid manipulating the comparator's semver object. - const compver = new SemVer(comparator.semver.version) - switch (comparator.operator) { - case '>': - if (compver.prerelease.length === 0) { - compver.patch++ - } else { - compver.prerelease.push(0) - } - compver.raw = compver.format() - /* fallthrough */ - case '': - case '>=': - if (!setMin || gt(compver, setMin)) { - setMin = compver - } - break - case '<': - case '<=': - /* Ignore maximum versions */ - break - /* istanbul ignore next */ - default: - throw new Error(`Unexpected operation: ${comparator.operator}`) - } - }) - if (setMin && (!minver || gt(minver, setMin))) { - minver = setMin - } - } - - if (minver && range.test(minver)) { - return minver - } - - return null -} -module.exports = minVersion - - -/***/ }), - -/***/ 97075: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const SemVer = __webpack_require__(53908) -const Comparator = __webpack_require__(93904) -const { ANY } = Comparator -const Range = __webpack_require__(78311) -const satisfies = __webpack_require__(97638) -const gt = __webpack_require__(35580) -const lt = __webpack_require__(7059) -const lte = __webpack_require__(25200) -const gte = __webpack_require__(54089) - -const outside = (version, range, hilo, options) => { - version = new SemVer(version, options) - range = new Range(range, options) - - let gtfn, ltefn, ltfn, comp, ecomp - switch (hilo) { - case '>': - gtfn = gt - ltefn = lte - ltfn = lt - comp = '>' - ecomp = '>=' - break - case '<': - gtfn = lt - ltefn = gte - ltfn = gt - comp = '<' - ecomp = '<=' - break - default: - throw new TypeError('Must provide a hilo val of "<" or ">"') - } - - // If it satisfies the range it is not outside - if (satisfies(version, range, options)) { - return false - } - - // From now on, variable terms are as if we're in "gtr" mode. - // but note that everything is flipped for the "ltr" function. - - for (let i = 0; i < range.set.length; ++i) { - const comparators = range.set[i] - - let high = null - let low = null - - comparators.forEach((comparator) => { - if (comparator.semver === ANY) { - comparator = new Comparator('>=0.0.0') - } - high = high || comparator - low = low || comparator - if (gtfn(comparator.semver, high.semver, options)) { - high = comparator - } else if (ltfn(comparator.semver, low.semver, options)) { - low = comparator - } - }) - - // If the edge version comparator has a operator then our version - // isn't outside it - if (high.operator === comp || high.operator === ecomp) { - return false - } - - // If the lowest version comparator has an operator and our version - // is less than it then it isn't higher than the range - if ((!low.operator || low.operator === comp) && - ltefn(version, low.semver)) { - return false - } else if (low.operator === ecomp && ltfn(version, low.semver)) { - return false - } - } - return true -} - -module.exports = outside - - -/***/ }), - -/***/ 72525: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -// given a set of versions and a range, create a "simplified" range -// that includes the same versions that the original range does -// If the original range is shorter than the simplified one, return that. -const satisfies = __webpack_require__(97638) -const compare = __webpack_require__(50560) -module.exports = (versions, range, options) => { - const set = [] - let first = null - let prev = null - const v = versions.sort((a, b) => compare(a, b, options)) - for (const version of v) { - const included = satisfies(version, range, options) - if (included) { - prev = version - if (!first) { - first = version - } - } else { - if (prev) { - set.push([first, prev]) - } - prev = null - first = null - } - } - if (first) { - set.push([first, null]) - } - - const ranges = [] - for (const [min, max] of set) { - if (min === max) { - ranges.push(min) - } else if (!max && min === v[0]) { - ranges.push('*') - } else if (!max) { - ranges.push(`>=${min}`) - } else if (min === v[0]) { - ranges.push(`<=${max}`) - } else { - ranges.push(`${min} - ${max}`) - } - } - const simplified = ranges.join(' || ') - const original = typeof range.raw === 'string' ? range.raw : String(range) - return simplified.length < original.length ? simplified : range -} - - -/***/ }), - -/***/ 75032: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const Range = __webpack_require__(78311) -const Comparator = __webpack_require__(93904) -const { ANY } = Comparator -const satisfies = __webpack_require__(97638) -const compare = __webpack_require__(50560) - -// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff: -// - Every simple range `r1, r2, ...` is a null set, OR -// - Every simple range `r1, r2, ...` which is not a null set is a subset of -// some `R1, R2, ...` -// -// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff: -// - If c is only the ANY comparator -// - If C is only the ANY comparator, return true -// - Else if in prerelease mode, return false -// - else replace c with `[>=0.0.0]` -// - If C is only the ANY comparator -// - if in prerelease mode, return true -// - else replace C with `[>=0.0.0]` -// - Let EQ be the set of = comparators in c -// - If EQ is more than one, return true (null set) -// - Let GT be the highest > or >= comparator in c -// - Let LT be the lowest < or <= comparator in c -// - If GT and LT, and GT.semver > LT.semver, return true (null set) -// - If any C is a = range, and GT or LT are set, return false -// - If EQ -// - If GT, and EQ does not satisfy GT, return true (null set) -// - If LT, and EQ does not satisfy LT, return true (null set) -// - If EQ satisfies every C, return true -// - Else return false -// - If GT -// - If GT.semver is lower than any > or >= comp in C, return false -// - If GT is >=, and GT.semver does not satisfy every C, return false -// - If GT.semver has a prerelease, and not in prerelease mode -// - If no C has a prerelease and the GT.semver tuple, return false -// - If LT -// - If LT.semver is greater than any < or <= comp in C, return false -// - If LT is <=, and LT.semver does not satisfy every C, return false -// - If GT.semver has a prerelease, and not in prerelease mode -// - If no C has a prerelease and the LT.semver tuple, return false -// - Else return true - -const subset = (sub, dom, options = {}) => { - if (sub === dom) { - return true - } - - sub = new Range(sub, options) - dom = new Range(dom, options) - let sawNonNull = false - - OUTER: for (const simpleSub of sub.set) { - for (const simpleDom of dom.set) { - const isSub = simpleSubset(simpleSub, simpleDom, options) - sawNonNull = sawNonNull || isSub !== null - if (isSub) { - continue OUTER - } - } - // the null set is a subset of everything, but null simple ranges in - // a complex range should be ignored. so if we saw a non-null range, - // then we know this isn't a subset, but if EVERY simple range was null, - // then it is a subset. - if (sawNonNull) { - return false - } - } - return true -} - -const minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')] -const minimumVersion = [new Comparator('>=0.0.0')] - -const simpleSubset = (sub, dom, options) => { - if (sub === dom) { - return true - } - - if (sub.length === 1 && sub[0].semver === ANY) { - if (dom.length === 1 && dom[0].semver === ANY) { - return true - } else if (options.includePrerelease) { - sub = minimumVersionWithPreRelease - } else { - sub = minimumVersion - } - } - - if (dom.length === 1 && dom[0].semver === ANY) { - if (options.includePrerelease) { - return true - } else { - dom = minimumVersion - } - } - - const eqSet = new Set() - let gt, lt - for (const c of sub) { - if (c.operator === '>' || c.operator === '>=') { - gt = higherGT(gt, c, options) - } else if (c.operator === '<' || c.operator === '<=') { - lt = lowerLT(lt, c, options) - } else { - eqSet.add(c.semver) - } - } - - if (eqSet.size > 1) { - return null - } - - let gtltComp - if (gt && lt) { - gtltComp = compare(gt.semver, lt.semver, options) - if (gtltComp > 0) { - return null - } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) { - return null - } - } - - // will iterate one or zero times - for (const eq of eqSet) { - if (gt && !satisfies(eq, String(gt), options)) { - return null - } - - if (lt && !satisfies(eq, String(lt), options)) { - return null - } - - for (const c of dom) { - if (!satisfies(eq, String(c), options)) { - return false - } - } - - return true - } - - let higher, lower - let hasDomLT, hasDomGT - // if the subset has a prerelease, we need a comparator in the superset - // with the same tuple and a prerelease, or it's not a subset - let needDomLTPre = lt && - !options.includePrerelease && - lt.semver.prerelease.length ? lt.semver : false - let needDomGTPre = gt && - !options.includePrerelease && - gt.semver.prerelease.length ? gt.semver : false - // exception: <1.2.3-0 is the same as <1.2.3 - if (needDomLTPre && needDomLTPre.prerelease.length === 1 && - lt.operator === '<' && needDomLTPre.prerelease[0] === 0) { - needDomLTPre = false - } - - for (const c of dom) { - hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=' - hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=' - if (gt) { - if (needDomGTPre) { - if (c.semver.prerelease && c.semver.prerelease.length && - c.semver.major === needDomGTPre.major && - c.semver.minor === needDomGTPre.minor && - c.semver.patch === needDomGTPre.patch) { - needDomGTPre = false - } - } - if (c.operator === '>' || c.operator === '>=') { - higher = higherGT(gt, c, options) - if (higher === c && higher !== gt) { - return false - } - } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) { - return false - } - } - if (lt) { - if (needDomLTPre) { - if (c.semver.prerelease && c.semver.prerelease.length && - c.semver.major === needDomLTPre.major && - c.semver.minor === needDomLTPre.minor && - c.semver.patch === needDomLTPre.patch) { - needDomLTPre = false - } - } - if (c.operator === '<' || c.operator === '<=') { - lower = lowerLT(lt, c, options) - if (lower === c && lower !== lt) { - return false - } - } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) { - return false - } - } - if (!c.operator && (lt || gt) && gtltComp !== 0) { - return false - } - } - - // if there was a < or >, and nothing in the dom, then must be false - // UNLESS it was limited by another range in the other direction. - // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0 - if (gt && hasDomLT && !lt && gtltComp !== 0) { - return false - } - - if (lt && hasDomGT && !gt && gtltComp !== 0) { - return false - } - - // we needed a prerelease range in a specific tuple, but didn't get one - // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0, - // because it includes prereleases in the 1.2.3 tuple - if (needDomGTPre || needDomLTPre) { - return false - } - - return true -} - -// >=1.2.3 is lower than >1.2.3 -const higherGT = (a, b, options) => { - if (!a) { - return b - } - const comp = compare(a.semver, b.semver, options) - return comp > 0 ? a - : comp < 0 ? b - : b.operator === '>' && a.operator === '>=' ? b - : a -} - -// <=1.2.3 is higher than <1.2.3 -const lowerLT = (a, b, options) => { - if (!a) { - return b - } - const comp = compare(a.semver, b.semver, options) - return comp < 0 ? a - : comp > 0 ? b - : b.operator === '<' && a.operator === '<=' ? b - : a -} - -module.exports = subset - - -/***/ }), - -/***/ 77631: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const Range = __webpack_require__(78311) - -// Mostly just for testing and legacy API reasons -const toComparators = (range, options) => - new Range(range, options).set - .map(comp => comp.map(c => c.value).join(' ').trim().split(' ')) - -module.exports = toComparators - - -/***/ }), - -/***/ 13874: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const Range = __webpack_require__(78311) -const validRange = (range, options) => { - try { - // Return '*' instead of '' so that truthiness works. - // This will throw if it's invalid anyway - return new Range(range, options).range || '*' - } catch (er) { - return null - } -} -module.exports = validRange - - /***/ }), /***/ 96897: @@ -103576,8 +141490,7 @@ xhr = null // Help gc /***/ 55537: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; -/* provided dependency */ var process = __webpack_require__(65606); +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; var capability = __webpack_require__(6688) var inherits = __webpack_require__(56698) var response = __webpack_require__(6917) @@ -103937,8 +141850,7 @@ var unsafeHeaders = [ /***/ 6917: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/* provided dependency */ var process = __webpack_require__(65606); -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; var capability = __webpack_require__(6688) var inherits = __webpack_require__(56698) var stream = __webpack_require__(28399) @@ -104455,95 +142367,6 @@ function simpleEnd(buf) { return buf && buf.length ? this.write(buf) : ''; } -/***/ }), - -/***/ 76386: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; -// Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri. -// Public domain. -(function(root, f) { - 'use strict'; - if ( true && module.exports) module.exports = f(); - else if (root.nacl) root.nacl.util = f(); - else { - root.nacl = {}; - root.nacl.util = f(); - } -}(this, function() { - 'use strict'; - - var util = {}; - - function validateBase64(s) { - if (!(/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(s))) { - throw new TypeError('invalid encoding'); - } - } - - util.decodeUTF8 = function(s) { - if (typeof s !== 'string') throw new TypeError('expected string'); - var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length); - for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i); - return b; - }; - - util.encodeUTF8 = function(arr) { - var i, s = []; - for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i])); - return decodeURIComponent(escape(s.join(''))); - }; - - if (typeof atob === 'undefined') { - // Node.js - - if (typeof Buffer.from !== 'undefined') { - // Node v6 and later - util.encodeBase64 = function (arr) { // v6 and later - return Buffer.from(arr).toString('base64'); - }; - - util.decodeBase64 = function (s) { - validateBase64(s); - return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0)); - }; - - } else { - // Node earlier than v6 - util.encodeBase64 = function (arr) { // v6 and later - return (new Buffer(arr)).toString('base64'); - }; - - util.decodeBase64 = function(s) { - validateBase64(s); - return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0)); - }; - } - - } else { - // Browsers - - util.encodeBase64 = function(arr) { - var i, s = [], len = arr.length; - for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i])); - return btoa(s.join('')); - }; - - util.decodeBase64 = function(s) { - validateBase64(s); - var i, d = atob(s), b = new Uint8Array(d.length); - for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i); - return b; - }; - - } - - return util; - -})); - - /***/ }), /***/ 88947: @@ -106942,1461 +144765,11 @@ nacl.setPRNG = function(fn) { })( true && module.exports ? module.exports : (self.nacl = self.nacl || {})); -/***/ }), - -/***/ 46579: -/***/ (function(__unused_webpack_module, exports) { - -/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */ -(function (global, factory) { - true ? factory(exports) : - 0; -}(this, (function (exports) { 'use strict'; - -function merge() { - for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) { - sets[_key] = arguments[_key]; - } - - if (sets.length > 1) { - sets[0] = sets[0].slice(0, -1); - var xl = sets.length - 1; - for (var x = 1; x < xl; ++x) { - sets[x] = sets[x].slice(1, -1); - } - sets[xl] = sets[xl].slice(1); - return sets.join(''); - } else { - return sets[0]; - } -} -function subexp(str) { - return "(?:" + str + ")"; -} -function typeOf(o) { - return o === undefined ? "undefined" : o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase(); -} -function toUpperCase(str) { - return str.toUpperCase(); -} -function toArray(obj) { - return obj !== undefined && obj !== null ? obj instanceof Array ? obj : typeof obj.length !== "number" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj) : []; -} -function assign(target, source) { - var obj = target; - if (source) { - for (var key in source) { - obj[key] = source[key]; - } - } - return obj; -} - -function buildExps(isIRI) { - var ALPHA$$ = "[A-Za-z]", - CR$ = "[\\x0D]", - DIGIT$$ = "[0-9]", - DQUOTE$$ = "[\\x22]", - HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"), - //case-insensitive - LF$$ = "[\\x0A]", - SP$$ = "[\\x20]", - PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)), - //expanded - GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]", - SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", - RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$), - UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", - //subset, excludes bidi control characters - IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]", - //subset - UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$), - SCHEME$ = subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*"), - USERINFO$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*"), - DEC_OCTET$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("[1-9]" + DIGIT$$) + "|" + DIGIT$$), - DEC_OCTET_RELAXED$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("0?[1-9]" + DIGIT$$) + "|0?0?" + DIGIT$$), - //relaxed parsing rules - IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$), - H16$ = subexp(HEXDIG$$ + "{1,4}"), - LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$), - IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$), - // 6( h16 ":" ) ls32 - IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$), - // "::" 5( h16 ":" ) ls32 - IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$), - //[ h16 ] "::" 4( h16 ":" ) ls32 - IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$), - //[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 - IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$), - //[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 - IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$), - //[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 - IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$), - //[ *4( h16 ":" ) h16 ] "::" ls32 - IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$), - //[ *5( h16 ":" ) h16 ] "::" h16 - IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"), - //[ *6( h16 ":" ) h16 ] "::" - IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")), - ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+"), - //RFC 6874 - IPV6ADDRZ$ = subexp(IPV6ADDRESS$ + "\\%25" + ZONEID$), - //RFC 6874 - IPV6ADDRZ_RELAXED$ = subexp(IPV6ADDRESS$ + subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + ZONEID$), - //RFC 6874, with relaxed parsing rules - IPVFUTURE$ = subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+"), - IP_LITERAL$ = subexp("\\[" + subexp(IPV6ADDRZ_RELAXED$ + "|" + IPV6ADDRESS$ + "|" + IPVFUTURE$) + "\\]"), - //RFC 6874 - REG_NAME$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*"), - HOST$ = subexp(IP_LITERAL$ + "|" + IPV4ADDRESS$ + "(?!" + REG_NAME$ + ")" + "|" + REG_NAME$), - PORT$ = subexp(DIGIT$$ + "*"), - AUTHORITY$ = subexp(subexp(USERINFO$ + "@") + "?" + HOST$ + subexp("\\:" + PORT$) + "?"), - PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]")), - SEGMENT$ = subexp(PCHAR$ + "*"), - SEGMENT_NZ$ = subexp(PCHAR$ + "+"), - SEGMENT_NZ_NC$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+"), - PATH_ABEMPTY$ = subexp(subexp("\\/" + SEGMENT$) + "*"), - PATH_ABSOLUTE$ = subexp("\\/" + subexp(SEGMENT_NZ$ + PATH_ABEMPTY$) + "?"), - //simplified - PATH_NOSCHEME$ = subexp(SEGMENT_NZ_NC$ + PATH_ABEMPTY$), - //simplified - PATH_ROOTLESS$ = subexp(SEGMENT_NZ$ + PATH_ABEMPTY$), - //simplified - PATH_EMPTY$ = "(?!" + PCHAR$ + ")", - PATH$ = subexp(PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$), - QUERY$ = subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*"), - FRAGMENT$ = subexp(subexp(PCHAR$ + "|[\\/\\?]") + "*"), - HIER_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$), - URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"), - RELATIVE_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$), - RELATIVE$ = subexp(RELATIVE_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"), - URI_REFERENCE$ = subexp(URI$ + "|" + RELATIVE$), - ABSOLUTE_URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?"), - GENERIC_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", - RELATIVE_REF$ = "^(){0}" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", - ABSOLUTE_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?$", - SAMEDOC_REF$ = "^" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", - AUTHORITY_REF$ = "^" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?$"; - return { - NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"), - NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"), - NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"), - NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"), - NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"), - NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"), - NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"), - ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"), - UNRESERVED: new RegExp(UNRESERVED$$, "g"), - OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"), - PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"), - IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"), - IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules - }; -} -var URI_PROTOCOL = buildExps(false); - -var IRI_PROTOCOL = buildExps(true); - -var slicedToArray = function () { - function sliceIterator(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"]) _i["return"](); - } finally { - if (_d) throw _e; - } - } - - return _arr; - } - - return function (arr, i) { - if (Array.isArray(arr)) { - return arr; - } else if (Symbol.iterator in Object(arr)) { - return sliceIterator(arr, i); - } else { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); - } - }; -}(); - - - - - - - - - - - - - -var toConsumableArray = function (arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; - - return arr2; - } else { - return Array.from(arr); - } -}; - -/** Highest positive signed 32-bit float value */ - -var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1 - -/** Bootstring parameters */ -var base = 36; -var tMin = 1; -var tMax = 26; -var skew = 38; -var damp = 700; -var initialBias = 72; -var initialN = 128; // 0x80 -var delimiter = '-'; // '\x2D' - -/** Regular expressions */ -var regexPunycode = /^xn--/; -var regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars -var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators - -/** Error messages */ -var errors = { - 'overflow': 'Overflow: input needs wider integers to process', - 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', - 'invalid-input': 'Invalid input' -}; - -/** Convenience shortcuts */ -var baseMinusTMin = base - tMin; -var floor = Math.floor; -var stringFromCharCode = String.fromCharCode; - -/*--------------------------------------------------------------------------*/ - -/** - * A generic error utility function. - * @private - * @param {String} type The error type. - * @returns {Error} Throws a `RangeError` with the applicable error message. - */ -function error$1(type) { - throw new RangeError(errors[type]); -} - -/** - * A generic `Array#map` utility function. - * @private - * @param {Array} array The array to iterate over. - * @param {Function} callback The function that gets called for every array - * item. - * @returns {Array} A new array of values returned by the callback function. - */ -function map(array, fn) { - var result = []; - var length = array.length; - while (length--) { - result[length] = fn(array[length]); - } - return result; -} - -/** - * A simple `Array#map`-like wrapper to work with domain name strings or email - * addresses. - * @private - * @param {String} domain The domain name or email address. - * @param {Function} callback The function that gets called for every - * character. - * @returns {Array} A new string of characters returned by the callback - * function. - */ -function mapDomain(string, fn) { - var parts = string.split('@'); - var result = ''; - if (parts.length > 1) { - // In email addresses, only the domain name should be punycoded. Leave - // the local part (i.e. everything up to `@`) intact. - result = parts[0] + '@'; - string = parts[1]; - } - // Avoid `split(regex)` for IE8 compatibility. See #17. - string = string.replace(regexSeparators, '\x2E'); - var labels = string.split('.'); - var encoded = map(labels, fn).join('.'); - return result + encoded; -} - -/** - * Creates an array containing the numeric code points of each Unicode - * character in the string. While JavaScript uses UCS-2 internally, - * this function will convert a pair of surrogate halves (each of which - * UCS-2 exposes as separate characters) into a single code point, - * matching UTF-16. - * @see `punycode.ucs2.encode` - * @see - * @memberOf punycode.ucs2 - * @name decode - * @param {String} string The Unicode input string (UCS-2). - * @returns {Array} The new array of code points. - */ -function ucs2decode(string) { - var output = []; - var counter = 0; - var length = string.length; - while (counter < length) { - var value = string.charCodeAt(counter++); - if (value >= 0xD800 && value <= 0xDBFF && counter < length) { - // It's a high surrogate, and there is a next character. - var extra = string.charCodeAt(counter++); - if ((extra & 0xFC00) == 0xDC00) { - // Low surrogate. - output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); - } else { - // It's an unmatched surrogate; only append this code unit, in case the - // next code unit is the high surrogate of a surrogate pair. - output.push(value); - counter--; - } - } else { - output.push(value); - } - } - return output; -} - -/** - * Creates a string based on an array of numeric code points. - * @see `punycode.ucs2.decode` - * @memberOf punycode.ucs2 - * @name encode - * @param {Array} codePoints The array of numeric code points. - * @returns {String} The new Unicode string (UCS-2). - */ -var ucs2encode = function ucs2encode(array) { - return String.fromCodePoint.apply(String, toConsumableArray(array)); -}; - -/** - * Converts a basic code point into a digit/integer. - * @see `digitToBasic()` - * @private - * @param {Number} codePoint The basic numeric code point value. - * @returns {Number} The numeric value of a basic code point (for use in - * representing integers) in the range `0` to `base - 1`, or `base` if - * the code point does not represent a value. - */ -var basicToDigit = function basicToDigit(codePoint) { - if (codePoint - 0x30 < 0x0A) { - return codePoint - 0x16; - } - if (codePoint - 0x41 < 0x1A) { - return codePoint - 0x41; - } - if (codePoint - 0x61 < 0x1A) { - return codePoint - 0x61; - } - return base; -}; - -/** - * Converts a digit/integer into a basic code point. - * @see `basicToDigit()` - * @private - * @param {Number} digit The numeric value of a basic code point. - * @returns {Number} The basic code point whose value (when used for - * representing integers) is `digit`, which needs to be in the range - * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is - * used; else, the lowercase form is used. The behavior is undefined - * if `flag` is non-zero and `digit` has no uppercase form. - */ -var digitToBasic = function digitToBasic(digit, flag) { - // 0..25 map to ASCII a..z or A..Z - // 26..35 map to ASCII 0..9 - return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); -}; - -/** - * Bias adaptation function as per section 3.4 of RFC 3492. - * https://tools.ietf.org/html/rfc3492#section-3.4 - * @private - */ -var adapt = function adapt(delta, numPoints, firstTime) { - var k = 0; - delta = firstTime ? floor(delta / damp) : delta >> 1; - delta += floor(delta / numPoints); - for (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) { - delta = floor(delta / baseMinusTMin); - } - return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); -}; - -/** - * Converts a Punycode string of ASCII-only symbols to a string of Unicode - * symbols. - * @memberOf punycode - * @param {String} input The Punycode string of ASCII-only symbols. - * @returns {String} The resulting string of Unicode symbols. - */ -var decode = function decode(input) { - // Don't use UCS-2. - var output = []; - var inputLength = input.length; - var i = 0; - var n = initialN; - var bias = initialBias; - - // Handle the basic code points: let `basic` be the number of input code - // points before the last delimiter, or `0` if there is none, then copy - // the first basic code points to the output. - - var basic = input.lastIndexOf(delimiter); - if (basic < 0) { - basic = 0; - } - - for (var j = 0; j < basic; ++j) { - // if it's not a basic code point - if (input.charCodeAt(j) >= 0x80) { - error$1('not-basic'); - } - output.push(input.charCodeAt(j)); - } - - // Main decoding loop: start just after the last delimiter if any basic code - // points were copied; start at the beginning otherwise. - - for (var index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{ - - // `index` is the index of the next character to be consumed. - // Decode a generalized variable-length integer into `delta`, - // which gets added to `i`. The overflow checking is easier - // if we increase `i` as we go, then subtract off its starting - // value at the end to obtain `delta`. - var oldi = i; - for (var w = 1, k = base;; /* no condition */k += base) { - - if (index >= inputLength) { - error$1('invalid-input'); - } - - var digit = basicToDigit(input.charCodeAt(index++)); - - if (digit >= base || digit > floor((maxInt - i) / w)) { - error$1('overflow'); - } - - i += digit * w; - var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; - - if (digit < t) { - break; - } - - var baseMinusT = base - t; - if (w > floor(maxInt / baseMinusT)) { - error$1('overflow'); - } - - w *= baseMinusT; - } - - var out = output.length + 1; - bias = adapt(i - oldi, out, oldi == 0); - - // `i` was supposed to wrap around from `out` to `0`, - // incrementing `n` each time, so we'll fix that now: - if (floor(i / out) > maxInt - n) { - error$1('overflow'); - } - - n += floor(i / out); - i %= out; - - // Insert `n` at position `i` of the output. - output.splice(i++, 0, n); - } - - return String.fromCodePoint.apply(String, output); -}; - -/** - * Converts a string of Unicode symbols (e.g. a domain name label) to a - * Punycode string of ASCII-only symbols. - * @memberOf punycode - * @param {String} input The string of Unicode symbols. - * @returns {String} The resulting Punycode string of ASCII-only symbols. - */ -var encode = function encode(input) { - var output = []; - - // Convert the input in UCS-2 to an array of Unicode code points. - input = ucs2decode(input); - - // Cache the length. - var inputLength = input.length; - - // Initialize the state. - var n = initialN; - var delta = 0; - var bias = initialBias; - - // Handle the basic code points. - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var _currentValue2 = _step.value; - - if (_currentValue2 < 0x80) { - output.push(stringFromCharCode(_currentValue2)); - } - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - - var basicLength = output.length; - var handledCPCount = basicLength; - - // `handledCPCount` is the number of code points that have been handled; - // `basicLength` is the number of basic code points. - - // Finish the basic string with a delimiter unless it's empty. - if (basicLength) { - output.push(delimiter); - } - - // Main encoding loop: - while (handledCPCount < inputLength) { - - // All non-basic code points < n have been handled already. Find the next - // larger one: - var m = maxInt; - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = undefined; - - try { - for (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { - var currentValue = _step2.value; - - if (currentValue >= n && currentValue < m) { - m = currentValue; - } - } - - // Increase `delta` enough to advance the decoder's state to , - // but guard against overflow. - } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; - } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2.return) { - _iterator2.return(); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } - } - - var handledCPCountPlusOne = handledCPCount + 1; - if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { - error$1('overflow'); - } - - delta += (m - n) * handledCPCountPlusOne; - n = m; - - var _iteratorNormalCompletion3 = true; - var _didIteratorError3 = false; - var _iteratorError3 = undefined; - - try { - for (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { - var _currentValue = _step3.value; - - if (_currentValue < n && ++delta > maxInt) { - error$1('overflow'); - } - if (_currentValue == n) { - // Represent delta as a generalized variable-length integer. - var q = delta; - for (var k = base;; /* no condition */k += base) { - var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; - if (q < t) { - break; - } - var qMinusT = q - t; - var baseMinusT = base - t; - output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))); - q = floor(qMinusT / baseMinusT); - } - - output.push(stringFromCharCode(digitToBasic(q, 0))); - bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); - delta = 0; - ++handledCPCount; - } - } - } catch (err) { - _didIteratorError3 = true; - _iteratorError3 = err; - } finally { - try { - if (!_iteratorNormalCompletion3 && _iterator3.return) { - _iterator3.return(); - } - } finally { - if (_didIteratorError3) { - throw _iteratorError3; - } - } - } - - ++delta; - ++n; - } - return output.join(''); -}; - -/** - * Converts a Punycode string representing a domain name or an email address - * to Unicode. Only the Punycoded parts of the input will be converted, i.e. - * it doesn't matter if you call it on a string that has already been - * converted to Unicode. - * @memberOf punycode - * @param {String} input The Punycoded domain name or email address to - * convert to Unicode. - * @returns {String} The Unicode representation of the given Punycode - * string. - */ -var toUnicode = function toUnicode(input) { - return mapDomain(input, function (string) { - return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string; - }); -}; - -/** - * Converts a Unicode string representing a domain name or an email address to - * Punycode. Only the non-ASCII parts of the domain name will be converted, - * i.e. it doesn't matter if you call it with a domain that's already in - * ASCII. - * @memberOf punycode - * @param {String} input The domain name or email address to convert, as a - * Unicode string. - * @returns {String} The Punycode representation of the given domain name or - * email address. - */ -var toASCII = function toASCII(input) { - return mapDomain(input, function (string) { - return regexNonASCII.test(string) ? 'xn--' + encode(string) : string; - }); -}; - -/*--------------------------------------------------------------------------*/ - -/** Define the public API */ -var punycode = { - /** - * A string representing the current Punycode.js version number. - * @memberOf punycode - * @type String - */ - 'version': '2.1.0', - /** - * An object of methods to convert from JavaScript's internal character - * representation (UCS-2) to Unicode code points, and back. - * @see - * @memberOf punycode - * @type Object - */ - 'ucs2': { - 'decode': ucs2decode, - 'encode': ucs2encode - }, - 'decode': decode, - 'encode': encode, - 'toASCII': toASCII, - 'toUnicode': toUnicode -}; - -/** - * URI.js - * - * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript. - * @author Gary Court - * @see http://github.com/garycourt/uri-js - */ -/** - * Copyright 2011 Gary Court. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of Gary Court. - */ -var SCHEMES = {}; -function pctEncChar(chr) { - var c = chr.charCodeAt(0); - var e = void 0; - if (c < 16) e = "%0" + c.toString(16).toUpperCase();else if (c < 128) e = "%" + c.toString(16).toUpperCase();else if (c < 2048) e = "%" + (c >> 6 | 192).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase();else e = "%" + (c >> 12 | 224).toString(16).toUpperCase() + "%" + (c >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase(); - return e; -} -function pctDecChars(str) { - var newStr = ""; - var i = 0; - var il = str.length; - while (i < il) { - var c = parseInt(str.substr(i + 1, 2), 16); - if (c < 128) { - newStr += String.fromCharCode(c); - i += 3; - } else if (c >= 194 && c < 224) { - if (il - i >= 6) { - var c2 = parseInt(str.substr(i + 4, 2), 16); - newStr += String.fromCharCode((c & 31) << 6 | c2 & 63); - } else { - newStr += str.substr(i, 6); - } - i += 6; - } else if (c >= 224) { - if (il - i >= 9) { - var _c = parseInt(str.substr(i + 4, 2), 16); - var c3 = parseInt(str.substr(i + 7, 2), 16); - newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63); - } else { - newStr += str.substr(i, 9); - } - i += 9; - } else { - newStr += str.substr(i, 3); - i += 3; - } - } - return newStr; -} -function _normalizeComponentEncoding(components, protocol) { - function decodeUnreserved(str) { - var decStr = pctDecChars(str); - return !decStr.match(protocol.UNRESERVED) ? str : decStr; - } - if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, ""); - if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); - if (components.host !== undefined) components.host = String(components.host).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_HOST, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); - if (components.path !== undefined) components.path = String(components.path).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(components.scheme ? protocol.NOT_PATH : protocol.NOT_PATH_NOSCHEME, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); - if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); - if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); - return components; -} - -function _stripLeadingZeros(str) { - return str.replace(/^0*(.*)/, "$1") || "0"; -} -function _normalizeIPv4(host, protocol) { - var matches = host.match(protocol.IPV4ADDRESS) || []; - - var _matches = slicedToArray(matches, 2), - address = _matches[1]; - - if (address) { - return address.split(".").map(_stripLeadingZeros).join("."); - } else { - return host; - } -} -function _normalizeIPv6(host, protocol) { - var matches = host.match(protocol.IPV6ADDRESS) || []; - - var _matches2 = slicedToArray(matches, 3), - address = _matches2[1], - zone = _matches2[2]; - - if (address) { - var _address$toLowerCase$ = address.toLowerCase().split('::').reverse(), - _address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2), - last = _address$toLowerCase$2[0], - first = _address$toLowerCase$2[1]; - - var firstFields = first ? first.split(":").map(_stripLeadingZeros) : []; - var lastFields = last.split(":").map(_stripLeadingZeros); - var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]); - var fieldCount = isLastFieldIPv4Address ? 7 : 8; - var lastFieldsStart = lastFields.length - fieldCount; - var fields = Array(fieldCount); - for (var x = 0; x < fieldCount; ++x) { - fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || ''; - } - if (isLastFieldIPv4Address) { - fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol); - } - var allZeroFields = fields.reduce(function (acc, field, index) { - if (!field || field === "0") { - var lastLongest = acc[acc.length - 1]; - if (lastLongest && lastLongest.index + lastLongest.length === index) { - lastLongest.length++; - } else { - acc.push({ index: index, length: 1 }); - } - } - return acc; - }, []); - var longestZeroFields = allZeroFields.sort(function (a, b) { - return b.length - a.length; - })[0]; - var newHost = void 0; - if (longestZeroFields && longestZeroFields.length > 1) { - var newFirst = fields.slice(0, longestZeroFields.index); - var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length); - newHost = newFirst.join(":") + "::" + newLast.join(":"); - } else { - newHost = fields.join(":"); - } - if (zone) { - newHost += "%" + zone; - } - return newHost; - } else { - return host; - } -} -var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i; -var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === undefined; -function parse(uriString) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var components = {}; - var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL; - if (options.reference === "suffix") uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString; - var matches = uriString.match(URI_PARSE); - if (matches) { - if (NO_MATCH_IS_UNDEFINED) { - //store each component - components.scheme = matches[1]; - components.userinfo = matches[3]; - components.host = matches[4]; - components.port = parseInt(matches[5], 10); - components.path = matches[6] || ""; - components.query = matches[7]; - components.fragment = matches[8]; - //fix port number - if (isNaN(components.port)) { - components.port = matches[5]; - } - } else { - //IE FIX for improper RegExp matching - //store each component - components.scheme = matches[1] || undefined; - components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : undefined; - components.host = uriString.indexOf("//") !== -1 ? matches[4] : undefined; - components.port = parseInt(matches[5], 10); - components.path = matches[6] || ""; - components.query = uriString.indexOf("?") !== -1 ? matches[7] : undefined; - components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : undefined; - //fix port number - if (isNaN(components.port)) { - components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined; - } - } - if (components.host) { - //normalize IP hosts - components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol); - } - //determine reference type - if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) { - components.reference = "same-document"; - } else if (components.scheme === undefined) { - components.reference = "relative"; - } else if (components.fragment === undefined) { - components.reference = "absolute"; - } else { - components.reference = "uri"; - } - //check for reference errors - if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) { - components.error = components.error || "URI is not a " + options.reference + " reference."; - } - //find scheme handler - var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()]; - //check if scheme can't handle IRIs - if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) { - //if host component is a domain name - if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) { - //convert Unicode IDN -> ASCII IDN - try { - components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()); - } catch (e) { - components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e; - } - } - //convert IRI -> URI - _normalizeComponentEncoding(components, URI_PROTOCOL); - } else { - //normalize encodings - _normalizeComponentEncoding(components, protocol); - } - //perform scheme specific parsing - if (schemeHandler && schemeHandler.parse) { - schemeHandler.parse(components, options); - } - } else { - components.error = components.error || "URI can not be parsed."; - } - return components; -} - -function _recomposeAuthority(components, options) { - var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL; - var uriTokens = []; - if (components.userinfo !== undefined) { - uriTokens.push(components.userinfo); - uriTokens.push("@"); - } - if (components.host !== undefined) { - //normalize IP hosts, add brackets and escape zone separator for IPv6 - uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function (_, $1, $2) { - return "[" + $1 + ($2 ? "%25" + $2 : "") + "]"; - })); - } - if (typeof components.port === "number" || typeof components.port === "string") { - uriTokens.push(":"); - uriTokens.push(String(components.port)); - } - return uriTokens.length ? uriTokens.join("") : undefined; -} - -var RDS1 = /^\.\.?\//; -var RDS2 = /^\/\.(\/|$)/; -var RDS3 = /^\/\.\.(\/|$)/; -var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/; -function removeDotSegments(input) { - var output = []; - while (input.length) { - if (input.match(RDS1)) { - input = input.replace(RDS1, ""); - } else if (input.match(RDS2)) { - input = input.replace(RDS2, "/"); - } else if (input.match(RDS3)) { - input = input.replace(RDS3, "/"); - output.pop(); - } else if (input === "." || input === "..") { - input = ""; - } else { - var im = input.match(RDS5); - if (im) { - var s = im[0]; - input = input.slice(s.length); - output.push(s); - } else { - throw new Error("Unexpected dot segment condition"); - } - } - } - return output.join(""); -} - -function serialize(components) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL; - var uriTokens = []; - //find scheme handler - var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()]; - //perform scheme specific serialization - if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options); - if (components.host) { - //if host component is an IPv6 address - if (protocol.IPV6ADDRESS.test(components.host)) {} - //TODO: normalize IPv6 address as per RFC 5952 - - //if host component is a domain name - else if (options.domainHost || schemeHandler && schemeHandler.domainHost) { - //convert IDN via punycode - try { - components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host); - } catch (e) { - components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e; - } - } - } - //normalize encoding - _normalizeComponentEncoding(components, protocol); - if (options.reference !== "suffix" && components.scheme) { - uriTokens.push(components.scheme); - uriTokens.push(":"); - } - var authority = _recomposeAuthority(components, options); - if (authority !== undefined) { - if (options.reference !== "suffix") { - uriTokens.push("//"); - } - uriTokens.push(authority); - if (components.path && components.path.charAt(0) !== "/") { - uriTokens.push("/"); - } - } - if (components.path !== undefined) { - var s = components.path; - if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) { - s = removeDotSegments(s); - } - if (authority === undefined) { - s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//" - } - uriTokens.push(s); - } - if (components.query !== undefined) { - uriTokens.push("?"); - uriTokens.push(components.query); - } - if (components.fragment !== undefined) { - uriTokens.push("#"); - uriTokens.push(components.fragment); - } - return uriTokens.join(""); //merge tokens into a string -} - -function resolveComponents(base, relative) { - var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - var skipNormalization = arguments[3]; - - var target = {}; - if (!skipNormalization) { - base = parse(serialize(base, options), options); //normalize base components - relative = parse(serialize(relative, options), options); //normalize relative components - } - options = options || {}; - if (!options.tolerant && relative.scheme) { - target.scheme = relative.scheme; - //target.authority = relative.authority; - target.userinfo = relative.userinfo; - target.host = relative.host; - target.port = relative.port; - target.path = removeDotSegments(relative.path || ""); - target.query = relative.query; - } else { - if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) { - //target.authority = relative.authority; - target.userinfo = relative.userinfo; - target.host = relative.host; - target.port = relative.port; - target.path = removeDotSegments(relative.path || ""); - target.query = relative.query; - } else { - if (!relative.path) { - target.path = base.path; - if (relative.query !== undefined) { - target.query = relative.query; - } else { - target.query = base.query; - } - } else { - if (relative.path.charAt(0) === "/") { - target.path = removeDotSegments(relative.path); - } else { - if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) { - target.path = "/" + relative.path; - } else if (!base.path) { - target.path = relative.path; - } else { - target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path; - } - target.path = removeDotSegments(target.path); - } - target.query = relative.query; - } - //target.authority = base.authority; - target.userinfo = base.userinfo; - target.host = base.host; - target.port = base.port; - } - target.scheme = base.scheme; - } - target.fragment = relative.fragment; - return target; -} - -function resolve(baseURI, relativeURI, options) { - var schemelessOptions = assign({ scheme: 'null' }, options); - return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions); -} - -function normalize(uri, options) { - if (typeof uri === "string") { - uri = serialize(parse(uri, options), options); - } else if (typeOf(uri) === "object") { - uri = parse(serialize(uri, options), options); - } - return uri; -} - -function equal(uriA, uriB, options) { - if (typeof uriA === "string") { - uriA = serialize(parse(uriA, options), options); - } else if (typeOf(uriA) === "object") { - uriA = serialize(uriA, options); - } - if (typeof uriB === "string") { - uriB = serialize(parse(uriB, options), options); - } else if (typeOf(uriB) === "object") { - uriB = serialize(uriB, options); - } - return uriA === uriB; -} - -function escapeComponent(str, options) { - return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar); -} - -function unescapeComponent(str, options) { - return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars); -} - -var handler = { - scheme: "http", - domainHost: true, - parse: function parse(components, options) { - //report missing host - if (!components.host) { - components.error = components.error || "HTTP URIs must have a host."; - } - return components; - }, - serialize: function serialize(components, options) { - var secure = String(components.scheme).toLowerCase() === "https"; - //normalize the default port - if (components.port === (secure ? 443 : 80) || components.port === "") { - components.port = undefined; - } - //normalize the empty path - if (!components.path) { - components.path = "/"; - } - //NOTE: We do not parse query strings for HTTP URIs - //as WWW Form Url Encoded query strings are part of the HTML4+ spec, - //and not the HTTP spec. - return components; - } -}; - -var handler$1 = { - scheme: "https", - domainHost: handler.domainHost, - parse: handler.parse, - serialize: handler.serialize -}; - -function isSecure(wsComponents) { - return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss"; -} -//RFC 6455 -var handler$2 = { - scheme: "ws", - domainHost: true, - parse: function parse(components, options) { - var wsComponents = components; - //indicate if the secure flag is set - wsComponents.secure = isSecure(wsComponents); - //construct resouce name - wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : ''); - wsComponents.path = undefined; - wsComponents.query = undefined; - return wsComponents; - }, - serialize: function serialize(wsComponents, options) { - //normalize the default port - if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") { - wsComponents.port = undefined; - } - //ensure scheme matches secure flag - if (typeof wsComponents.secure === 'boolean') { - wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws'; - wsComponents.secure = undefined; - } - //reconstruct path from resource name - if (wsComponents.resourceName) { - var _wsComponents$resourc = wsComponents.resourceName.split('?'), - _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2), - path = _wsComponents$resourc2[0], - query = _wsComponents$resourc2[1]; - - wsComponents.path = path && path !== '/' ? path : undefined; - wsComponents.query = query; - wsComponents.resourceName = undefined; - } - //forbid fragment component - wsComponents.fragment = undefined; - return wsComponents; - } -}; - -var handler$3 = { - scheme: "wss", - domainHost: handler$2.domainHost, - parse: handler$2.parse, - serialize: handler$2.serialize -}; - -var O = {}; -var isIRI = true; -//RFC 3986 -var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + (isIRI ? "\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" : "") + "]"; -var HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive -var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded -//RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; = -//const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]"; -//const WSP$$ = "[\\x20\\x09]"; -//const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127) -//const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext -//const VCHAR$$ = "[\\x21-\\x7E]"; -//const WSP$$ = "[\\x20\\x09]"; -//const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext -//const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+"); -//const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$); -//const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"'); -var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]"; -var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]"; -var VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]"); -var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"; -var UNRESERVED = new RegExp(UNRESERVED$$, "g"); -var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g"); -var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g"); -var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g"); -var NOT_HFVALUE = NOT_HFNAME; -function decodeUnreserved(str) { - var decStr = pctDecChars(str); - return !decStr.match(UNRESERVED) ? str : decStr; -} -var handler$4 = { - scheme: "mailto", - parse: function parse$$1(components, options) { - var mailtoComponents = components; - var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : []; - mailtoComponents.path = undefined; - if (mailtoComponents.query) { - var unknownHeaders = false; - var headers = {}; - var hfields = mailtoComponents.query.split("&"); - for (var x = 0, xl = hfields.length; x < xl; ++x) { - var hfield = hfields[x].split("="); - switch (hfield[0]) { - case "to": - var toAddrs = hfield[1].split(","); - for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) { - to.push(toAddrs[_x]); - } - break; - case "subject": - mailtoComponents.subject = unescapeComponent(hfield[1], options); - break; - case "body": - mailtoComponents.body = unescapeComponent(hfield[1], options); - break; - default: - unknownHeaders = true; - headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options); - break; - } - } - if (unknownHeaders) mailtoComponents.headers = headers; - } - mailtoComponents.query = undefined; - for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) { - var addr = to[_x2].split("@"); - addr[0] = unescapeComponent(addr[0]); - if (!options.unicodeSupport) { - //convert Unicode IDN -> ASCII IDN - try { - addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase()); - } catch (e) { - mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e; - } - } else { - addr[1] = unescapeComponent(addr[1], options).toLowerCase(); - } - to[_x2] = addr.join("@"); - } - return mailtoComponents; - }, - serialize: function serialize$$1(mailtoComponents, options) { - var components = mailtoComponents; - var to = toArray(mailtoComponents.to); - if (to) { - for (var x = 0, xl = to.length; x < xl; ++x) { - var toAddr = String(to[x]); - var atIdx = toAddr.lastIndexOf("@"); - var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar); - var domain = toAddr.slice(atIdx + 1); - //convert IDN via punycode - try { - domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain); - } catch (e) { - components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e; - } - to[x] = localPart + "@" + domain; - } - components.path = to.join(","); - } - var headers = mailtoComponents.headers = mailtoComponents.headers || {}; - if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject; - if (mailtoComponents.body) headers["body"] = mailtoComponents.body; - var fields = []; - for (var name in headers) { - if (headers[name] !== O[name]) { - fields.push(name.replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFNAME, pctEncChar) + "=" + headers[name].replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFVALUE, pctEncChar)); - } - } - if (fields.length) { - components.query = fields.join("&"); - } - return components; - } -}; - -var URN_PARSE = /^([^\:]+)\:(.*)/; -//RFC 2141 -var handler$5 = { - scheme: "urn", - parse: function parse$$1(components, options) { - var matches = components.path && components.path.match(URN_PARSE); - var urnComponents = components; - if (matches) { - var scheme = options.scheme || urnComponents.scheme || "urn"; - var nid = matches[1].toLowerCase(); - var nss = matches[2]; - var urnScheme = scheme + ":" + (options.nid || nid); - var schemeHandler = SCHEMES[urnScheme]; - urnComponents.nid = nid; - urnComponents.nss = nss; - urnComponents.path = undefined; - if (schemeHandler) { - urnComponents = schemeHandler.parse(urnComponents, options); - } - } else { - urnComponents.error = urnComponents.error || "URN can not be parsed."; - } - return urnComponents; - }, - serialize: function serialize$$1(urnComponents, options) { - var scheme = options.scheme || urnComponents.scheme || "urn"; - var nid = urnComponents.nid; - var urnScheme = scheme + ":" + (options.nid || nid); - var schemeHandler = SCHEMES[urnScheme]; - if (schemeHandler) { - urnComponents = schemeHandler.serialize(urnComponents, options); - } - var uriComponents = urnComponents; - var nss = urnComponents.nss; - uriComponents.path = (nid || options.nid) + ":" + nss; - return uriComponents; - } -}; - -var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/; -//RFC 4122 -var handler$6 = { - scheme: "urn:uuid", - parse: function parse(urnComponents, options) { - var uuidComponents = urnComponents; - uuidComponents.uuid = uuidComponents.nss; - uuidComponents.nss = undefined; - if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) { - uuidComponents.error = uuidComponents.error || "UUID is not valid."; - } - return uuidComponents; - }, - serialize: function serialize(uuidComponents, options) { - var urnComponents = uuidComponents; - //normalize UUID - urnComponents.nss = (uuidComponents.uuid || "").toLowerCase(); - return urnComponents; - } -}; - -SCHEMES[handler.scheme] = handler; -SCHEMES[handler$1.scheme] = handler$1; -SCHEMES[handler$2.scheme] = handler$2; -SCHEMES[handler$3.scheme] = handler$3; -SCHEMES[handler$4.scheme] = handler$4; -SCHEMES[handler$5.scheme] = handler$5; -SCHEMES[handler$6.scheme] = handler$6; - -exports.SCHEMES = SCHEMES; -exports.pctEncChar = pctEncChar; -exports.pctDecChars = pctDecChars; -exports.parse = parse; -exports.removeDotSegments = removeDotSegments; -exports.serialize = serialize; -exports.resolveComponents = resolveComponents; -exports.resolve = resolve; -exports.normalize = normalize; -exports.equal = equal; -exports.escapeComponent = escapeComponent; -exports.unescapeComponent = unescapeComponent; - -Object.defineProperty(exports, '__esModule', { value: true }); - -}))); -//# sourceMappingURL=uri.all.js.map - - /***/ }), /***/ 94643: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var console = __webpack_require__(96763); /** * Module exports. @@ -108825,8 +145198,6 @@ exports.isAnyArrayBuffer = isAnyArrayBuffer; /***/ 40537: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/* provided dependency */ var process = __webpack_require__(65606); -/* provided dependency */ var console = __webpack_require__(96763); // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -109544,6 +145915,119 @@ function callbackify(original) { exports.callbackify = callbackify; +/***/ }), + +/***/ 26797: +/***/ ((module) => { + +module.exports = read + +var MSB = 0x80 + , REST = 0x7F + +function read(buf, offset) { + var res = 0 + , offset = offset || 0 + , shift = 0 + , counter = offset + , b + , l = buf.length + + do { + if (counter >= l) { + read.bytes = 0 + throw new RangeError('Could not decode varint') + } + b = buf[counter++] + res += shift < 28 + ? (b & REST) << shift + : (b & REST) * Math.pow(2, shift) + shift += 7 + } while (b >= MSB) + + read.bytes = counter - offset + + return res +} + + +/***/ }), + +/***/ 81877: +/***/ ((module) => { + +module.exports = encode + +var MSB = 0x80 + , REST = 0x7F + , MSBALL = ~REST + , INT = Math.pow(2, 31) + +function encode(num, out, offset) { + out = out || [] + offset = offset || 0 + var oldOffset = offset + + while(num >= INT) { + out[offset++] = (num & 0xFF) | MSB + num /= 128 + } + while(num & MSBALL) { + out[offset++] = (num & 0xFF) | MSB + num >>>= 7 + } + out[offset] = num | 0 + + encode.bytes = offset - oldOffset + 1 + + return out +} + + +/***/ }), + +/***/ 61203: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +module.exports = { + encode: __webpack_require__(81877) + , decode: __webpack_require__(26797) + , encodingLength: __webpack_require__(37867) +} + + +/***/ }), + +/***/ 37867: +/***/ ((module) => { + + +var N1 = Math.pow(2, 7) +var N2 = Math.pow(2, 14) +var N3 = Math.pow(2, 21) +var N4 = Math.pow(2, 28) +var N5 = Math.pow(2, 35) +var N6 = Math.pow(2, 42) +var N7 = Math.pow(2, 49) +var N8 = Math.pow(2, 56) +var N9 = Math.pow(2, 63) + +module.exports = function (value) { + return ( + value < N1 ? 1 + : value < N2 ? 2 + : value < N3 ? 3 + : value < N4 ? 4 + : value < N5 ? 5 + : value < N6 ? 6 + : value < N7 ? 7 + : value < N8 ? 8 + : value < N9 ? 9 + : 10 + ) +} + + /***/ }), /***/ 68961: @@ -109702,1908 +146186,9609 @@ exports.createContext = Script.createContext = function (context) { /***/ }), -/***/ 14400: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 67019: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/* - Copyright 2019 0KIMS association. +"use strict"; - This file is part of wasmbuilder - wasmbuilder is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. +exports.TextEncoder = + typeof TextEncoder !== "undefined" ? TextEncoder : (__webpack_require__(40537).TextEncoder) - wasmbuilder is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmbuilder. If not, see . -*/ - -module.exports.ModuleBuilder = __webpack_require__(80442); -/* unused reexport */ __webpack_require__(38269); -/* unused reexport */ __webpack_require__(77831); +exports.TextDecoder = + typeof TextDecoder !== "undefined" ? TextDecoder : (__webpack_require__(40537).TextDecoder) /***/ }), -/***/ 65705: +/***/ 25767: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* - Copyright 2019 0KIMS association. - - This file is part of wasmbuilder - - wasmbuilder is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmbuilder is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmbuilder. If not, see . -*/ - -const utils = __webpack_require__(60484); - -class CodeBuilder { - constructor(func) { - this.func = func; - this.functionName = func.functionName; - this.module = func.module; - } - - setLocal(localName, valCode) { - const idx = this.func.localIdxByName[localName]; - if (idx === undefined) - throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${localName} `); - return [...valCode, 0x21, ...utils.varuint32( idx )]; - } - - teeLocal(localName, valCode) { - const idx = this.func.localIdxByName[localName]; - if (idx === undefined) - throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${localName} `); - return [...valCode, 0x22, ...utils.varuint32( idx )]; - } - - getLocal(localName) { - const idx = this.func.localIdxByName[localName]; - if (idx === undefined) - throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${localName} `); - return [0x20, ...utils.varuint32( idx )]; - } - - i64_load8_s(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 0 : _align; // 8 bits alignment by default - return [...idxCode, 0x30, align, ...utils.varuint32(offset)]; - } - - i64_load8_u(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 0 : _align; // 8 bits alignment by default - return [...idxCode, 0x31, align, ...utils.varuint32(offset)]; - } - - i64_load16_s(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 1 : _align; // 16 bits alignment by default - return [...idxCode, 0x32, align, ...utils.varuint32(offset)]; - } - - i64_load16_u(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 1 : _align; // 16 bits alignment by default - return [...idxCode, 0x33, align, ...utils.varuint32(offset)]; - } - - i64_load32_s(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 2 : _align; // 32 bits alignment by default - return [...idxCode, 0x34, align, ...utils.varuint32(offset)]; - } - - i64_load32_u(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 2 : _align; // 32 bits alignment by default - return [...idxCode, 0x35, align, ...utils.varuint32(offset)]; - } - - i64_load(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 3 : _align; // 64 bits alignment by default - return [...idxCode, 0x29, align, ...utils.varuint32(offset)]; - } +"use strict"; - i64_store(idxCode, _offset, _align, _codeVal) { - let offset, align, codeVal; - if (Array.isArray(_offset)) { - offset = 0; - align = 3; - codeVal = _offset; - } else if (Array.isArray(_align)) { - offset = _offset; - align = 3; - codeVal = _align; - } else if (Array.isArray(_codeVal)) { - offset = _offset; - align = _align; - codeVal = _codeVal; - } - return [...idxCode, ...codeVal, 0x37, align, ...utils.varuint32(offset)]; - } +var forEach = __webpack_require__(82682); +var availableTypedArrays = __webpack_require__(39209); +var callBind = __webpack_require__(10487); +var callBound = __webpack_require__(38075); +var gOPD = __webpack_require__(75795); - i64_store32(idxCode, _offset, _align, _codeVal) { - let offset, align, codeVal; - if (Array.isArray(_offset)) { - offset = 0; - align = 2; - codeVal = _offset; - } else if (Array.isArray(_align)) { - offset = _offset; - align = 2; - codeVal = _align; - } else if (Array.isArray(_codeVal)) { - offset = _offset; - align = _align; - codeVal = _codeVal; - } - return [...idxCode, ...codeVal, 0x3e, align, ...utils.varuint32(offset)]; - } +/** @type {(O: object) => string} */ +var $toString = callBound('Object.prototype.toString'); +var hasToStringTag = __webpack_require__(49092)(); +var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis; +var typedArrays = availableTypedArrays(); - i64_store16(idxCode, _offset, _align, _codeVal) { - let offset, align, codeVal; - if (Array.isArray(_offset)) { - offset = 0; - align = 1; - codeVal = _offset; - } else if (Array.isArray(_align)) { - offset = _offset; - align = 1; - codeVal = _align; - } else if (Array.isArray(_codeVal)) { - offset = _offset; - align = _align; - codeVal = _codeVal; - } - return [...idxCode, ...codeVal, 0x3d, align, ...utils.varuint32(offset)]; - } +var $slice = callBound('String.prototype.slice'); +var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); +/** @type {(array: readonly T[], value: unknown) => number} */ +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; +}; - i64_store8(idxCode, _offset, _align, _codeVal) { - let offset, align, codeVal; - if (Array.isArray(_offset)) { - offset = 0; - align = 0; - codeVal = _offset; - } else if (Array.isArray(_align)) { - offset = _offset; - align = 0; - codeVal = _align; - } else if (Array.isArray(_codeVal)) { - offset = _offset; - align = _align; - codeVal = _codeVal; - } - return [...idxCode, ...codeVal, 0x3c, align, ...utils.varuint32(offset)]; - } - - i32_load8_s(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 0 : _align; // 32 bits alignment by default - return [...idxCode, 0x2c, align, ...utils.varuint32(offset)]; - } - - i32_load8_u(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 0 : _align; // 32 bits alignment by default - return [...idxCode, 0x2d, align, ...utils.varuint32(offset)]; - } - - i32_load16_s(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 1 : _align; // 32 bits alignment by default - return [...idxCode, 0x2e, align, ...utils.varuint32(offset)]; - } - - i32_load16_u(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 1 : _align; // 32 bits alignment by default - return [...idxCode, 0x2f, align, ...utils.varuint32(offset)]; - } - - i32_load(idxCode, _offset, _align) { - const offset = _offset || 0; - const align = (_align === undefined) ? 2 : _align; // 32 bits alignment by default - return [...idxCode, 0x28, align, ...utils.varuint32(offset)]; - } - - i32_store(idxCode, _offset, _align, _codeVal) { - let offset, align, codeVal; - if (Array.isArray(_offset)) { - offset = 0; - align = 2; - codeVal = _offset; - } else if (Array.isArray(_align)) { - offset = _offset; - align = 2; - codeVal = _align; - } else if (Array.isArray(_codeVal)) { - offset = _offset; - align = _align; - codeVal = _codeVal; - } - return [...idxCode, ...codeVal, 0x36, align, ...utils.varuint32(offset)]; - } - - - i32_store16(idxCode, _offset, _align, _codeVal) { - let offset, align, codeVal; - if (Array.isArray(_offset)) { - offset = 0; - align = 1; - codeVal = _offset; - } else if (Array.isArray(_align)) { - offset = _offset; - align = 1; - codeVal = _align; - } else if (Array.isArray(_codeVal)) { - offset = _offset; - align = _align; - codeVal = _codeVal; - } - return [...idxCode, ...codeVal, 0x3b, align, ...utils.varuint32(offset)]; - } - - i32_store8(idxCode, _offset, _align, _codeVal) { - let offset, align, codeVal; - if (Array.isArray(_offset)) { - offset = 0; - align = 0; - codeVal = _offset; - } else if (Array.isArray(_align)) { - offset = _offset; - align = 0; - codeVal = _align; - } else if (Array.isArray(_codeVal)) { - offset = _offset; - align = _align; - codeVal = _codeVal; - } - return [...idxCode, ...codeVal, 0x3a, align, ...utils.varuint32(offset)]; - } - - call(fnName, ...args) { - const idx = this.module.functionIdxByName[fnName]; - if (idx === undefined) - throw new Error(`Function not defined: Function: ${fnName}`); - return [...[].concat(...args), 0x10, ...utils.varuint32(idx)]; - } - - call_indirect(fnIdx, ...args) { - return [...[].concat(...args), ...fnIdx, 0x11, 0, 0]; - } - - if(condCode, thenCode, elseCode) { - if (elseCode) { - return [...condCode, 0x04, 0x40, ...thenCode, 0x05, ...elseCode, 0x0b]; - } else { - return [...condCode, 0x04, 0x40, ...thenCode, 0x0b]; - } - } - - block(bCode) { return [0x02, 0x40, ...bCode, 0x0b]; } - loop(...args) { - return [0x03, 0x40, ...[].concat(...[...args]), 0x0b]; - } - br_if(relPath, condCode) { return [...condCode, 0x0d, ...utils.varuint32(relPath)]; } - br(relPath) { return [0x0c, ...utils.varuint32(relPath)]; } - ret(rCode) { return [...rCode, 0x0f]; } - drop(dCode) { return [...dCode, 0x1a]; } - - i64_const(num) { return [0x42, ...utils.varint64(num)]; } - i32_const(num) { return [0x41, ...utils.varint32(num)]; } - - - i64_eqz(opcode) { return [...opcode, 0x50]; } - i64_eq(op1code, op2code) { return [...op1code, ...op2code, 0x51]; } - i64_ne(op1code, op2code) { return [...op1code, ...op2code, 0x52]; } - i64_lt_s(op1code, op2code) { return [...op1code, ...op2code, 0x53]; } - i64_lt_u(op1code, op2code) { return [...op1code, ...op2code, 0x54]; } - i64_gt_s(op1code, op2code) { return [...op1code, ...op2code, 0x55]; } - i64_gt_u(op1code, op2code) { return [...op1code, ...op2code, 0x56]; } - i64_le_s(op1code, op2code) { return [...op1code, ...op2code, 0x57]; } - i64_le_u(op1code, op2code) { return [...op1code, ...op2code, 0x58]; } - i64_ge_s(op1code, op2code) { return [...op1code, ...op2code, 0x59]; } - i64_ge_u(op1code, op2code) { return [...op1code, ...op2code, 0x5a]; } - i64_add(op1code, op2code) { return [...op1code, ...op2code, 0x7c]; } - i64_sub(op1code, op2code) { return [...op1code, ...op2code, 0x7d]; } - i64_mul(op1code, op2code) { return [...op1code, ...op2code, 0x7e]; } - i64_div_s(op1code, op2code) { return [...op1code, ...op2code, 0x7f]; } - i64_div_u(op1code, op2code) { return [...op1code, ...op2code, 0x80]; } - i64_rem_s(op1code, op2code) { return [...op1code, ...op2code, 0x81]; } - i64_rem_u(op1code, op2code) { return [...op1code, ...op2code, 0x82]; } - i64_and(op1code, op2code) { return [...op1code, ...op2code, 0x83]; } - i64_or(op1code, op2code) { return [...op1code, ...op2code, 0x84]; } - i64_xor(op1code, op2code) { return [...op1code, ...op2code, 0x85]; } - i64_shl(op1code, op2code) { return [...op1code, ...op2code, 0x86]; } - i64_shr_s(op1code, op2code) { return [...op1code, ...op2code, 0x87]; } - i64_shr_u(op1code, op2code) { return [...op1code, ...op2code, 0x88]; } - i64_extend_i32_s(op1code) { return [...op1code, 0xac]; } - i64_extend_i32_u(op1code) { return [...op1code, 0xad]; } - i64_clz(op1code) { return [...op1code, 0x79]; } - i64_ctz(op1code) { return [...op1code, 0x7a]; } - - i32_eqz(op1code) { return [...op1code, 0x45]; } - i32_eq(op1code, op2code) { return [...op1code, ...op2code, 0x46]; } - i32_ne(op1code, op2code) { return [...op1code, ...op2code, 0x47]; } - i32_lt_s(op1code, op2code) { return [...op1code, ...op2code, 0x48]; } - i32_lt_u(op1code, op2code) { return [...op1code, ...op2code, 0x49]; } - i32_gt_s(op1code, op2code) { return [...op1code, ...op2code, 0x4a]; } - i32_gt_u(op1code, op2code) { return [...op1code, ...op2code, 0x4b]; } - i32_le_s(op1code, op2code) { return [...op1code, ...op2code, 0x4c]; } - i32_le_u(op1code, op2code) { return [...op1code, ...op2code, 0x4d]; } - i32_ge_s(op1code, op2code) { return [...op1code, ...op2code, 0x4e]; } - i32_ge_u(op1code, op2code) { return [...op1code, ...op2code, 0x4f]; } - i32_add(op1code, op2code) { return [...op1code, ...op2code, 0x6a]; } - i32_sub(op1code, op2code) { return [...op1code, ...op2code, 0x6b]; } - i32_mul(op1code, op2code) { return [...op1code, ...op2code, 0x6c]; } - i32_div_s(op1code, op2code) { return [...op1code, ...op2code, 0x6d]; } - i32_div_u(op1code, op2code) { return [...op1code, ...op2code, 0x6e]; } - i32_rem_s(op1code, op2code) { return [...op1code, ...op2code, 0x6f]; } - i32_rem_u(op1code, op2code) { return [...op1code, ...op2code, 0x70]; } - i32_and(op1code, op2code) { return [...op1code, ...op2code, 0x71]; } - i32_or(op1code, op2code) { return [...op1code, ...op2code, 0x72]; } - i32_xor(op1code, op2code) { return [...op1code, ...op2code, 0x73]; } - i32_shl(op1code, op2code) { return [...op1code, ...op2code, 0x74]; } - i32_shr_s(op1code, op2code) { return [...op1code, ...op2code, 0x75]; } - i32_shr_u(op1code, op2code) { return [...op1code, ...op2code, 0x76]; } - i32_rotl(op1code, op2code) { return [...op1code, ...op2code, 0x77]; } - i32_rotr(op1code, op2code) { return [...op1code, ...op2code, 0x78]; } - i32_wrap_i64(op1code) { return [...op1code, 0xa7]; } - i32_clz(op1code) { return [...op1code, 0x67]; } - i32_ctz(op1code) { return [...op1code, 0x68]; } - - unreachable() { return [ 0x0 ]; } - - current_memory() { return [ 0x3f, 0]; } - - comment() { return []; } +/** @typedef {(receiver: import('.').TypedArray) => string | typeof Uint8Array.prototype.slice.call | typeof Uint8Array.prototype.set.call} Getter */ +/** @type {{ [k in `\$${import('.').TypedArrayName}`]?: Getter } & { __proto__: null }} */ +var cache = { __proto__: null }; +if (hasToStringTag && gOPD && getPrototypeOf) { + forEach(typedArrays, function (typedArray) { + var arr = new g[typedArray](); + if (Symbol.toStringTag in arr) { + var proto = getPrototypeOf(arr); + // @ts-expect-error TS won't narrow inside a closure + var descriptor = gOPD(proto, Symbol.toStringTag); + if (!descriptor) { + var superProto = getPrototypeOf(proto); + // @ts-expect-error TS won't narrow inside a closure + descriptor = gOPD(superProto, Symbol.toStringTag); + } + // @ts-expect-error TODO: fix + cache['$' + typedArray] = callBind(descriptor.get); + } + }); +} else { + forEach(typedArrays, function (typedArray) { + var arr = new g[typedArray](); + var fn = arr.slice || arr.set; + if (fn) { + // @ts-expect-error TODO: fix + cache['$' + typedArray] = callBind(fn); + } + }); } -module.exports = CodeBuilder; +/** @type {(value: object) => false | import('.').TypedArrayName} */ +var tryTypedArrays = function tryAllTypedArrays(value) { + /** @type {ReturnType} */ var found = false; + forEach( + // eslint-disable-next-line no-extra-parens + /** @type {Record<`\$${TypedArrayName}`, Getter>} */ /** @type {any} */ (cache), + /** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */ + function (getter, typedArray) { + if (!found) { + try { + // @ts-expect-error TODO: fix + if ('$' + getter(value) === typedArray) { + found = $slice(typedArray, 1); + } + } catch (e) { /**/ } + } + } + ); + return found; +}; +/** @type {(value: object) => false | import('.').TypedArrayName} */ +var trySlices = function tryAllSlices(value) { + /** @type {ReturnType} */ var found = false; + forEach( + // eslint-disable-next-line no-extra-parens + /** @type {Record<`\$${TypedArrayName}`, Getter>} */ /** @type {any} */ (cache), + /** @type {(getter: typeof cache, name: `\$${import('.').TypedArrayName}`) => void} */ function (getter, name) { + if (!found) { + try { + // @ts-expect-error TODO: fix + getter(value); + found = $slice(name, 1); + } catch (e) { /**/ } + } + } + ); + return found; +}; -/***/ }), - -/***/ 24010: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmbuilder - - wasmbuilder is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmbuilder is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmbuilder. If not, see . -*/ - -const utils = __webpack_require__(60484); - -class CodeBuilderWat { - constructor(func) { - this.func = func; - this.functionName = func.functionName; - this.module = func.module; - } - - setLocal(localName, valCode) { - const idx = this.func.localIdxByName[localName]; - if (idx === undefined) - throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${localName} `); - return [valCode, `set_local $${localName}`]; - } - - teeLocal(localName, valCode) { - const idx = this.func.localIdxByName[localName]; - if (idx === undefined) - throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${localName} `); - return [valCode, `tee_local $${localName}`]; - } - - getLocal(localName) { - const idx = this.func.localIdxByName[localName]; - if (idx === undefined) - throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${localName} `); - return `get_local $${localName}`; - } - - genLoad(inst, def_align, idxCode, _offset, _align) { - let S = inst; - const offset = _offset || 0; - if (offset>0) S += ` offset=${offset}`; - const align = (_align === undefined) ? def_align : _align; // 8 bits alignment by default - if (align!=def_align) S += ` align=${1 << align}`; - return [idxCode, S]; - } - - - genStore(inst, def_align, idxCode, _offset, _align, _codeVal) { - let offset, align, codeVal; - if (typeof _align === "undefined") { - offset = 0; - align = def_align; - codeVal = _offset; - } else if (typeof _codeVal === "undefined") { - offset = _offset; - align = def_align; - codeVal = _align; - } else { - offset = _offset; - align = _align; - codeVal = _codeVal; - } - let S = inst; - if (offset>0) S += ` offset=${offset}`; - if (align!=def_align) S += ` align=${1 << align}`; - return [idxCode, codeVal, S]; - } - - i64_load8_s(idxCode, _offset, _align) { - return this.genLoad("i64.load8_s", 0, idxCode, _offset, _align); - } - - i64_load8_u(idxCode, _offset, _align) { - return this.genLoad("i64.load8_u", 0, idxCode, _offset, _align); - } - - i64_load16_s(idxCode, _offset, _align) { - return this.genLoad("i64.load16_s", 1,idxCode, _offset, _align); - } - - i64_load16_u(idxCode, _offset, _align) { - return this.genLoad("i64.load16_u", 1, idxCode, _offset, _align); - } - - i64_load32_s(idxCode, _offset, _align) { - return this.genLoad("i64.load32_s", 2, idxCode, _offset, _align); - } - - i64_load32_u(idxCode, _offset, _align) { - return this.genLoad("i64.load32_u", 2, idxCode, _offset, _align); - } - - i64_load(idxCode, _offset, _align) { - return this.genLoad("i64.load", 3, idxCode, _offset, _align); - } - - - i64_store(idxCode, _offset, _align, _codeVal) { - return this.genStore("i64.store", 3, idxCode, _offset, _align, _codeVal); - } - - i64_store32(idxCode, _offset, _align, _codeVal) { - return this.genStore("i64.store32", 2, idxCode, _offset, _align, _codeVal); - } - - i64_store16(idxCode, _offset, _align, _codeVal) { - return this.genStore("i64.store16", 1, idxCode, _offset, _align, _codeVal); - } - - i64_store8(idxCode, _offset, _align, _codeVal) { - return this.genStore("i64.store8", 0, idxCode, _offset, _align, _codeVal); - } - - i32_load8_s(idxCode, _offset, _align) { - return this.genLoad("i32.load8_s", 0, idxCode, _offset, _align); - } - - i32_load8_u(idxCode, _offset, _align) { - return this.genLoad("i32.load8_u", 0, idxCode, _offset, _align); - } - - i32_load16_s(idxCode, _offset, _align) { - return this.genLoad("i32.load16_s", 1, idxCode, _offset, _align); - } - - i32_load16_u(idxCode, _offset, _align) { - return this.genLoad("i32.load16_u", 1, idxCode, _offset, _align); - } - - i32_load(idxCode, _offset, _align) { - return this.genLoad("i32.load", 2, idxCode, _offset, _align); - } - - i32_store(idxCode, _offset, _align, _codeVal) { - return this.genStore("i32.store", 2, idxCode, _offset, _align, _codeVal); - } - - i32_store16(idxCode, _offset, _align, _codeVal) { - return this.genStore("i32.store16", 1, idxCode, _offset, _align, _codeVal); - } - - i32_store8(idxCode, _offset, _align, _codeVal) { - return this.genStore("i32.store8", 0, idxCode, _offset, _align, _codeVal); - } - - call(fnName, ...args) { - const idx = this.module.functionIdxByName[fnName]; - if (idx === undefined) - throw new Error(`Function not defined: Function: ${fnName}`); - return [args, `call $${fnName}`]; - } - - call_indirect(fnIdx, ...args) { - return [args, fnIdx, "call_indirect (type 0)"]; - } - - if(condCode, thenCode, elseCode) { - if (elseCode) { - return [condCode, "if", utils.ident(thenCode), "else", utils.ident(elseCode), "end"]; - } else { - return [condCode, "if", utils.ident(thenCode), "end"]; - } - } - - block(bCode) { return ["block", utils.ident(bCode), "end"]; } - loop(...args) { return ["loop", utils.ident(args), "end"]; } - br_if(relPath, condCode) { return [condCode, `br_if ${relPath}`]; } - br(relPath) { return `br ${relPath}`; } - ret(rCode) { return [rCode, "return"]; } - drop(dCode) { return [dCode, "drop"]; } - - i64_const(num) { return `i64.const ${num}`; } - i32_const(num) { return `i32.const ${num}`; } - - i64_eqz(opcode) { return [opcode, "i64.eqz"]; } - i64_eq(op1code, op2code) { return [op1code, op2code, "i64.eq"]; } - i64_ne(op1code, op2code) { return [op1code, op2code, "i64.ne"]; } - i64_lt_s(op1code, op2code) { return [op1code, op2code, "i64.lt_s"]; } - i64_lt_u(op1code, op2code) { return [op1code, op2code, "i64.lt_u"]; } - i64_gt_s(op1code, op2code) { return [op1code, op2code, "i64.gt_s"]; } - i64_gt_u(op1code, op2code) { return [op1code, op2code, "i64.gt_u"]; } - i64_le_s(op1code, op2code) { return [op1code, op2code, "i64.le_s"]; } - i64_le_u(op1code, op2code) { return [op1code, op2code, "i64.le_u"]; } - i64_ge_s(op1code, op2code) { return [op1code, op2code, "i64.ge_s"]; } - i64_ge_u(op1code, op2code) { return [op1code, op2code, "i64.ge_u"]; } - i64_add(op1code, op2code) { return [op1code, op2code, "i64.add"]; } - i64_sub(op1code, op2code) { return [op1code, op2code, "i64.sub"]; } - i64_mul(op1code, op2code) { return [op1code, op2code, "i64.mul"]; } - i64_div_s(op1code, op2code) { return [op1code, op2code, "i64.div_s"]; } - i64_div_u(op1code, op2code) { return [op1code, op2code, "i64.div_u"]; } - i64_rem_s(op1code, op2code) { return [op1code, op2code, "i64.rem_s"]; } - i64_rem_u(op1code, op2code) { return [op1code, op2code, "i64.rem_u"]; } - i64_and(op1code, op2code) { return [op1code, op2code, "i64.and"]; } - i64_or(op1code, op2code) { return [op1code, op2code, "i64.or"]; } - i64_xor(op1code, op2code) { return [op1code, op2code, "i64.xor"]; } - i64_shl(op1code, op2code) { return [op1code, op2code, "i64.shl"]; } - i64_shr_s(op1code, op2code) { return [op1code, op2code, "i64.shr_s"]; } - i64_shr_u(op1code, op2code) { return [op1code, op2code, "i64.shr_u"]; } - i64_extend_i32_s(op1code) { return [op1code, "i64.extend_s/i32"]; } - i64_extend_i32_u(op1code) { return [op1code, "i64.extend_u/i32"]; } - - - i32_eqz(op1code) { return [op1code, "i32.eqz"]; } - i32_eq(op1code, op2code) { return [op1code, op2code, "i32.eq"]; } - i32_ne(op1code, op2code) { return [op1code, op2code, "i32.ne"]; } - i32_lt_s(op1code, op2code) { return [op1code, op2code, "i32.lt_s"]; } - i32_lt_u(op1code, op2code) { return [op1code, op2code, "i32.lt_u"]; } - i32_gt_s(op1code, op2code) { return [op1code, op2code, "i32.gt_s"]; } - i32_gt_u(op1code, op2code) { return [op1code, op2code, "i32.gt_u"]; } - i32_le_s(op1code, op2code) { return [op1code, op2code, "i32.le_s"]; } - i32_le_u(op1code, op2code) { return [op1code, op2code, "i32.le_u"]; } - i32_ge_s(op1code, op2code) { return [op1code, op2code, "i32.ge_s"]; } - i32_ge_u(op1code, op2code) { return [op1code, op2code, "i32.ge_u"]; } - i32_add(op1code, op2code) { return [op1code, op2code, "i32.add"]; } - i32_sub(op1code, op2code) { return [op1code, op2code, "i32.sub"]; } - i32_mul(op1code, op2code) { return [op1code, op2code, "i32.mul"]; } - i32_div_s(op1code, op2code) { return [op1code, op2code, "i32.div_s"]; } - i32_div_u(op1code, op2code) { return [op1code, op2code, "i32.div_u"]; } - i32_rem_s(op1code, op2code) { return [op1code, op2code, "i32.rem_s"]; } - i32_rem_u(op1code, op2code) { return [op1code, op2code, "i32.rem_u"]; } - i32_and(op1code, op2code) { return [op1code, op2code, "i32.and"]; } - i32_or(op1code, op2code) { return [op1code, op2code, "i32.or"]; } - i32_xor(op1code, op2code) { return [op1code, op2code, "i32.xor"]; } - i32_shl(op1code, op2code) { return [op1code, op2code, "i32.shl"]; } - i32_shr_s(op1code, op2code) { return [op1code, op2code, "i32.shr_s"]; } - i32_shr_u(op1code, op2code) { return [op1code, op2code, "i32.shr_u"]; } - i32_rotl(op1code, op2code) { return [op1code, op2code, "i32.rotl"]; } - i32_rotr(op1code, op2code) { return [op1code, op2code, "i32.rotr"]; } - i32_wrap_i64(op1code) { return [op1code, "i32.wrap/i64"]; } - - ureachable() { return "unreachable"; } - - current_memory() { return "current_memory"; } - - comment(c) { return ";; " + c; } - -} - -module.exports = CodeBuilderWat; - - -/***/ }), - -/***/ 55986: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmbuilder - - wasmbuilder is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmbuilder is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmbuilder. If not, see . -*/ - -const CodeBuilder = __webpack_require__(65705); -const utils = __webpack_require__(60484); - -const typeCodes = { - "i32": 0x7f, - "i64": 0x7e, - "f32": 0x7d, - "f64": 0x7c, - "anyfunc": 0x70, - "func": 0x60, - "emptyblock": 0x40 +/** @type {import('.')} */ +module.exports = function whichTypedArray(value) { + if (!value || typeof value !== 'object') { return false; } + if (!hasToStringTag) { + /** @type {string} */ + var tag = $slice($toString(value), 8, -1); + if ($indexOf(typedArrays, tag) > -1) { + return tag; + } + if (tag !== 'Object') { + return false; + } + // node < 0.6 hits here on real Typed Arrays + return trySlices(value); + } + if (!gOPD) { return null; } // unknown engine + return tryTypedArrays(value); }; -class FunctionBuilder { +/***/ }), - constructor (module, fnName, fnType, moduleName, fieldName) { - if (fnType == "import") { - this.fnType = "import"; - this.moduleName = moduleName; - this.fieldName = fieldName; - } else if (fnType == "internal") { - this.fnType = "internal"; - } else { - throw new Error("Invalid function fnType: " + fnType); +/***/ 57510: +/***/ ((module) => { + +module.exports = extend + +var hasOwnProperty = Object.prototype.hasOwnProperty; + +function extend() { + var target = {} + + for (var i = 0; i < arguments.length; i++) { + var source = arguments[i] + + for (var key in source) { + if (hasOwnProperty.call(source, key)) { + target[key] = source[key] + } } - this.module = module; - this.fnName = fnName; - this.params = []; - this.locals = []; - this.localIdxByName = {}; - this.code = []; - this.returnType = null; - this.nextLocal =0; } - addParam(paramName, paramType) { - if (this.localIdxByName[paramName]) - throw new Error(`param already exists. Function: ${this.fnName}, Param: ${paramName} `); - const idx = this.nextLocal++; - this.localIdxByName[paramName] = idx; - this.params.push({ - type: paramType - }); - } - - addLocal(localName, localType, _length) { - const length = _length || 1; - if (this.localIdxByName[localName]) - throw new Error(`local already exists. Function: ${this.fnName}, Param: ${localName} `); - const idx = this.nextLocal++; - this.localIdxByName[localName] = idx; - this.locals.push({ - type: localType, - length: length - }); - } - - setReturnType(returnType) { - if (this.returnType) - throw new Error(`returnType already defined. Function: ${this.fnName}`); - this.returnType = returnType; - } - - getSignature() { - const params = [...utils.varuint32(this.params.length), ...this.params.map((p) => typeCodes[p.type])]; - const returns = this.returnType ? [0x01, typeCodes[this.returnType]] : [0]; - return [0x60, ...params, ...returns]; - } - - getBody() { - const locals = this.locals.map((l) => [ - ...utils.varuint32(l.length), - typeCodes[l.type] - ]); - - const body = [ - ...utils.varuint32(this.locals.length), - ...[].concat(...locals), - ...this.code, - 0x0b - ]; - return [ - ...utils.varuint32(body.length), - ...body - ]; - } - - addCode(...code) { - this.code.push(...[].concat(...[...code])); - } - - getCodeBuilder() { - return new CodeBuilder(this); - } + return target } -module.exports = FunctionBuilder; - /***/ }), -/***/ 42341: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmbuilder - - wasmbuilder is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmbuilder is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmbuilder. If not, see . -*/ - -const CodeBuilderWat = __webpack_require__(24010); -const utils = __webpack_require__(60484); - -class FunctionBuilderWat { - - constructor (module, fnName, fnType, moduleName, fieldName) { - if (fnType == "import") { - this.fnType = "import"; - this.moduleName = moduleName; - this.fieldName = fieldName; - } else if (fnType == "internal") { - this.fnType = "internal"; - this.comment = moduleName; - } else { - throw new Error("Invalid function fnType: " + fnType); - } - this.module = module; - this.fnName = fnName; - this.params = []; - this.locals = []; - this.localIdxByName = {}; - this.code = []; - this.returnType = null; - this.nextLocal =0; - } - - addParam(paramName, paramType) { - if (this.localIdxByName[paramName]) - throw new Error(`param already exists. Function: ${this.fnName}, Param: ${paramName} `); - const idx = this.nextLocal++; - this.localIdxByName[paramName] = idx; - this.params.push({ - type: paramType, - name: paramName - }); - } - - addLocal(localName, localType, _length) { - if ((typeof _length != "undefined") && (_length != 1)) { - throw new Error("Locals greater than 1 not implemented"); - } - if (this.localIdxByName[localName]) - throw new Error(`local already exists. Function: ${this.fnName}, Param: ${localName} `); - const idx = this.nextLocal++; - this.localIdxByName[localName] = idx; - this.locals.push({ - type: localType, - name: localName, - }); - } - - setReturnType(returnType) { - if (this.returnType) - throw new Error(`returnType already defined. Function: ${this.fnName}`); - this.returnType = returnType; - } - - getSignature() { - let p = ""; - for (let i=0; i { +/* (ignored) */ /***/ }), -/***/ 80442: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmbuilder - - wasmbuilder is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmbuilder is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmbuilder. If not, see . -*/ - - -const FunctionBuilder = __webpack_require__(55986); -const utils = __webpack_require__(60484); - -class ModuleBuilder { - - constructor() { - this.functions = []; - this.functionIdxByName = {}; - this.nImportFunctions = 0; - this.nInternalFunctions =0; - this.memory = { - pagesSize: 1, - moduleName: "env", - fieldName: "memory" - }; - this.free = 8; - this.datas = []; - this.modules = {}; - this.exports = []; - this.functionsTable = []; - } - - build() { - this._setSignatures(); - return new Uint8Array([ - ...utils.u32(0x6d736100), - ...utils.u32(1), - ...this._buildType(), - ...this._buildImport(), - ...this._buildFunctionDeclarations(), - ...this._buildFunctionsTable(), - ...this._buildExports(), - ...this._buildElements(), - ...this._buildCode(), - ...this._buildData() - ]); - } - - addFunction(fnName) { - if (typeof(this.functionIdxByName[fnName]) !== "undefined") - throw new Error(`Function already defined: ${fnName}`); - - const idx = this.functions.length; - this.functionIdxByName[fnName] = idx; - - this.functions.push(new FunctionBuilder(this, fnName, "internal")); - - this.nInternalFunctions++; - return this.functions[idx]; - } - - addIimportFunction(fnName, moduleName, _fieldName) { - if (typeof(this.functionIdxByName[fnName]) !== "undefined") - throw new Error(`Function already defined: ${fnName}`); - - if ( (this.functions.length>0) - &&(this.functions[this.functions.length-1].type == "internal")) - throw new Error(`Import functions must be declared before internal: ${fnName}`); - - let fieldName = _fieldName || fnName; - - const idx = this.functions.length; - this.functionIdxByName[fnName] = idx; - - this.functions.push(new FunctionBuilder(this, fnName, "import", moduleName, fieldName)); - - this.nImportFunctions ++; - return this.functions[idx]; - } - - setMemory(pagesSize, moduleName, fieldName) { - this.memory = { - pagesSize: pagesSize, - moduleName: moduleName || "env", - fieldName: fieldName || "memory" - }; - } - - exportFunction(fnName, _exportName) { - const exportName = _exportName || fnName; - if (typeof(this.functionIdxByName[fnName]) === "undefined") - throw new Error(`Function not defined: ${fnName}`); - const idx = this.functionIdxByName[fnName]; - if (exportName != fnName) { - this.functionIdxByName[exportName] = idx; - } - this.exports.push({ - exportName: exportName, - idx: idx - }); - } - - addFunctionToTable(fnName) { - const idx = this.functionIdxByName[fnName]; - this.functionsTable.push(idx); - } - - addData(offset, bytes) { - this.datas.push({ - offset: offset, - bytes: bytes - }); - } - - alloc(a, b) { - let size; - let bytes; - if ((Array.isArray(a) || ArrayBuffer.isView(a)) && (typeof(b) === "undefined")) { - size = a.length; - bytes = a; - } else { - size = a; - bytes = b; - } - size = (((size-1)>>3) +1)<<3; // Align to 64 bits. - const p = this.free; - this.free += size; - if (bytes) { - this.addData(p, bytes); - } - return p; - } - - allocString(s) { - const encoder = new globalThis.TextEncoder(); - const uint8array = encoder.encode(s); - return this.alloc([...uint8array, 0]); - } - - _setSignatures() { - this.signatures = []; - const signatureIdxByName = {}; - if (this.functionsTable.length>0) { - const signature = this.functions[this.functionsTable[0]].getSignature(); - const signatureName = "s_"+utils.toHexString(signature); - signatureIdxByName[signatureName] = 0; - this.signatures.push(signature); - } - for (let i=0; i { +/* (ignored) */ /***/ }), -/***/ 38269: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/***/ 47790: +/***/ (() => { -/* provided dependency */ var Buffer = __webpack_require__(48287)["Buffer"]; -/* - Copyright 2019 0KIMS association. +/* (ignored) */ - This file is part of wasmbuilder +/***/ }), - wasmbuilder is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. +/***/ 73776: +/***/ (() => { - wasmbuilder is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. +/* (ignored) */ - You should have received a copy of the GNU General Public License - along with wasmbuilder. If not, see . -*/ +/***/ }), +/***/ 21638: +/***/ (() => { -const FunctionBuilderWat = __webpack_require__(42341); -const utils = __webpack_require__(60484); +/* (ignored) */ -class ModuleBuilderWat { +/***/ }), - constructor() { - this.functions = []; - this.functionIdxByName = {}; - this.nImportFunctions = 0; - this.nInternalFunctions =0; - this.memory = { - pagesSize: 1, - moduleName: "env", - fieldName: "memory" - }; - this.free = 8; - this.datas = []; - this.modules = {}; - this.exports = []; - this.functionsTable = []; - } +/***/ 92668: +/***/ (() => { - build() { - const src = []; - this._setSignatures(); - src.push(this._buildType()); - src.push(this._buildImport()); - if (this.functionsTable.length>0) { - src.push(this._buildFunctionsTable()); +/* (ignored) */ + +/***/ }), + +/***/ 77965: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 66089: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 79368: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 23276: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 59676: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 64688: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 51069: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 15340: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 79838: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 59817: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 71281: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 60513: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 2378: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 60290: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 47882: +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ 27754: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/** + * A `StructFailure` represents a single specific failure in validation. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.StructError = void 0; +/** + * `StructError` objects are thrown (or returned) when validation fails. + * + * Validation logic is design to exit early for maximum performance. The error + * represents the first error encountered during validation. For more detail, + * the `error.failures` property is a generator function that can be run to + * continue validation and receive all the failures in the data. + */ +class StructError extends TypeError { + constructor(failure, failures) { + let cached; + const { message, explanation, ...rest } = failure; + const { path } = failure; + const cause = path.length === 0 ? message : `At path: ${path.join('.')} -- ${message}`; + super(explanation ?? cause); + if (explanation !== null && explanation !== undefined) { + this.cause = cause; } - if (this.exports.length > 0) { - src.push(this._buildExports()); - } - if (this.functionsTable.length>0) { - src.push(this._buildElements()); - } - if (this.nInternalFunctions>0) { - src.push(this._buildFunctions()); - } - src.push(this._buildData()); - return [ - "(module", - utils.ident(src), - ")" - ]; - } - - addFunction(fnName, comment) { - if (typeof(this.functionIdxByName[fnName]) !== "undefined") - throw new Error(`Function already defined: ${fnName}`); - - const idx = this.functions.length; - this.functionIdxByName[fnName] = idx; - - this.functions.push(new FunctionBuilderWat(this, fnName, "internal", comment)); - - this.nInternalFunctions++; - return this.functions[idx]; - } - - addIimportFunction(fnName, moduleName, _fieldName) { - if (typeof(this.functionIdxByName[fnName]) !== "undefined") - throw new Error(`Function already defined: ${fnName}`); - - if ( (this.functions.length>0) - &&(this.functions[this.functions.length-1].type == "internal")) - throw new Error(`Import functions must be declared before internal: ${fnName}`); - - let fieldName = _fieldName || fnName; - - const idx = this.functions.length; - this.functionIdxByName[fnName] = idx; - - this.functions.push(new FunctionBuilderWat(this, fnName, "import", moduleName, fieldName)); - - this.nImportFunctions ++; - return this.functions[idx]; - } - - setMemory(pagesSize, moduleName, fieldName) { - this.memory = { - pagesSize: pagesSize, - moduleName: moduleName || "env", - fieldName: fieldName || "memory" + Object.assign(this, rest); + this.name = this.constructor.name; + this.failures = () => { + return (cached ?? (cached = [failure, ...failures()])); }; } +} +exports.StructError = StructError; +//# sourceMappingURL=error.cjs.map - exportFunction(fnName, _exportName) { - const exportName = _exportName || fnName; - if (typeof(this.functionIdxByName[fnName]) === "undefined") - throw new Error(`Function not defined: ${fnName}`); - const idx = this.functionIdxByName[fnName]; - if (exportName != fnName) { - this.functionIdxByName[exportName] = idx; +/***/ }), + +/***/ 35620: +/***/ (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 })); +__exportStar(__webpack_require__(27754), exports); +__exportStar(__webpack_require__(99067), exports); +__exportStar(__webpack_require__(91704), exports); +__exportStar(__webpack_require__(50401), exports); +__exportStar(__webpack_require__(67792), exports); +__exportStar(__webpack_require__(65991), exports); +//# sourceMappingURL=index.cjs.map + +/***/ }), + +/***/ 99067: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.validate = exports.is = exports.mask = exports.create = exports.assert = exports.Struct = void 0; +const error_js_1 = __webpack_require__(27754); +const utils_js_1 = __webpack_require__(70639); +/** + * `Struct` objects encapsulate the validation logic for a specific type of + * values. Once constructed, you use the `assert`, `is` or `validate` helpers to + * validate unknown input data against the struct. + */ +class Struct { + constructor(props) { + const { type, schema, validator, refiner, coercer = (value) => value, entries = function* () { + /* noop */ + }, } = props; + this.type = type; + this.schema = schema; + this.entries = entries; + this.coercer = coercer; + if (validator) { + this.validator = (value, context) => { + const result = validator(value, context); + return (0, utils_js_1.toFailures)(result, context, this, value); + }; } - this.exports.push({ - exportName: exportName, - idx: idx - }); - } - - addFunctionToTable(fnName) { - const idx = this.functionIdxByName[fnName]; - this.functionsTable.push(idx); - } - - addData(offset, bytes) { - this.datas.push({ - offset: offset, - bytes: bytes - }); - } - - alloc(a, b) { - let size; - let bytes; - if ((Array.isArray(a) || ArrayBuffer.isView(a)) && (typeof(b) === "undefined")) { - size = a.length; - bytes = a; - } else { - size = a; - bytes = b; + else { + this.validator = () => []; } - size = (((size-1)>>3) +1)<<3; // Align to 64 bits. - const p = this.free; - this.free += size; - if (bytes) { - this.addData(p, bytes); + if (refiner) { + this.refiner = (value, context) => { + const result = refiner(value, context); + return (0, utils_js_1.toFailures)(result, context, this, value); + }; } - return p; - } - - allocString(s) { - const encoder = new TextEncoder(); - const uint8array = encoder.encode(s); - return this.alloc([...uint8array, 0]); - } - - _setSignatures() { - this.signatures = []; - const signatureIdxByName = {}; - if (this.functionsTable.length>0) { - const signature = this.functions[this.functionsTable[0]].getSignature(); - const signatureName = this.functions[this.functionsTable[0]].getSignatureName(); - signatureIdxByName[signatureName] = 0; - this.signatures.push(signature); + else { + this.refiner = () => []; } - for (let i=0; i126 || b[i] == 34 || b[i]==92) { - let h=b[i].toString(16); - while (h.length<2) h = "0"+h; - S += "\\" + h; - } else { - S += String.fromCharCode(b[i]); +} +exports.assert = assert; +/** + * Create a value with the coercion logic of struct and validate it. + * + * @param value - The value to coerce and validate. + * @param struct - The struct to validate against. + * @param message - An optional message to include in the error. + * @returns The coerced and validated value. + */ +function create(value, struct, message) { + const result = validate(value, struct, { coerce: true, message }); + if (result[0]) { + throw result[0]; + } + else { + return result[1]; + } +} +exports.create = create; +/** + * Mask a value, returning only the subset of properties defined by a struct. + * + * @param value - The value to mask. + * @param struct - The struct to mask against. + * @param message - An optional message to include in the error. + * @returns The masked value. + */ +function mask(value, struct, message) { + const result = validate(value, struct, { coerce: true, mask: true, message }); + if (result[0]) { + throw result[0]; + } + else { + return result[1]; + } +} +exports.mask = mask; +/** + * Check if a value passes a struct. + * + * @param value - The value to validate. + * @param struct - The struct to validate against. + * @returns `true` if the value passes the struct, `false` otherwise. + */ +function is(value, struct) { + const result = validate(value, struct); + return !result[0]; +} +exports.is = is; +/** + * Validate a value against a struct, returning an error if invalid, or the + * value (with potential coercion) if valid. + * + * @param value - The value to validate. + * @param struct - The struct to validate against. + * @param options - Optional settings. + * @param options.coerce - Whether to coerce the value before validating it. + * @param options.mask - Whether to mask the value before validating it. + * @param options.message - An optional message to include in the error. + * @returns A tuple containing the error (if invalid) and the validated value. + */ +function validate(value, struct, options = {}) { + const tuples = (0, utils_js_1.run)(value, struct, options); + const tuple = (0, utils_js_1.shiftIterator)(tuples); + if (tuple[0]) { + const error = new error_js_1.StructError(tuple[0], function* () { + for (const innerTuple of tuples) { + if (innerTuple[0]) { + yield innerTuple[0]; } } - S += "\""; - return S; + }); + return [error, undefined]; + } + const validatedValue = tuple[1]; + return [undefined, validatedValue]; +} +exports.validate = validate; +//# sourceMappingURL=struct.cjs.map + +/***/ }), + +/***/ 91704: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.trimmed = exports.defaulted = exports.coerce = void 0; +const struct_js_1 = __webpack_require__(99067); +const utils_js_1 = __webpack_require__(70639); +const types_js_1 = __webpack_require__(67792); +/** + * Augment a `Struct` to add an additional coercion step to its input. + * + * This allows you to transform input data before validating it, to increase the + * likelihood that it passes validation—for example for default values, parsing + * different formats, etc. + * + * Note: You must use `create(value, Struct)` on the value to have the coercion + * take effect! Using simply `assert()` or `is()` will not use coercion. + * + * @param struct - The struct to augment. + * @param condition - A struct that the input must pass to be coerced. + * @param coercer - A function that takes the input and returns the coerced + * value. + * @returns A new struct that will coerce its input before validating it. + */ +function coerce(struct, condition, coercer) { + return new struct_js_1.Struct({ + ...struct, + coercer: (value, ctx) => { + return (0, struct_js_1.is)(value, condition) + ? struct.coercer(coercer(value, ctx), ctx) + : struct.coercer(value, ctx); + }, + }); +} +exports.coerce = coerce; +/** + * Augment a struct to replace `undefined` values with a default. + * + * Note: You must use `create(value, Struct)` on the value to have the coercion + * take effect! Using simply `assert()` or `is()` will not use coercion. + * + * @param struct - The struct to augment. + * @param fallback - The value to use when the input is `undefined`. + * @param options - An optional options object. + * @param options.strict - When `true`, the fallback will only be used when the + * input is `undefined`. When `false`, the fallback will be used when the input + * is `undefined` or when the input is a plain object and the fallback is a + * plain object, and any keys in the fallback are missing from the input. + * @returns A new struct that will replace `undefined` inputs with a default. + */ +function defaulted(struct, fallback, options = {}) { + return coerce(struct, (0, types_js_1.unknown)(), (value) => { + const result = typeof fallback === 'function' ? fallback() : fallback; + if (value === undefined) { + return result; + } + if (!options.strict && (0, utils_js_1.isPlainObject)(value) && (0, utils_js_1.isPlainObject)(result)) { + const ret = { ...value }; + let changed = false; + for (const key in result) { + if (ret[key] === undefined) { + ret[key] = result[key]; + changed = true; + } + } + if (changed) { + return ret; + } + } + return value; + }); +} +exports.defaulted = defaulted; +/** + * Augment a struct to trim string inputs. + * + * Note: You must use `create(value, Struct)` on the value to have the coercion + * take effect! Using simply `assert()` or `is()` will not use coercion. + * + * @param struct - The struct to augment. + * @returns A new struct that will trim string inputs before validating them. + */ +function trimmed(struct) { + return coerce(struct, (0, types_js_1.string)(), (value) => value.trim()); +} +exports.trimmed = trimmed; +//# sourceMappingURL=coercions.cjs.map + +/***/ }), + +/***/ 50401: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.refine = exports.size = exports.pattern = exports.nonempty = exports.min = exports.max = exports.empty = void 0; +const struct_js_1 = __webpack_require__(99067); +const utils_js_1 = __webpack_require__(70639); +/** + * Ensure that a string, array, map, or set is empty. + * + * @param struct - The struct to augment. + * @returns A new struct that will only accept empty values. + */ +function empty(struct) { + return refine(struct, 'empty', (value) => { + // eslint-disable-next-line @typescript-eslint/no-shadow + const size = getSize(value); + return (size === 0 || + `Expected an empty ${struct.type} but received one with a size of \`${size}\``); + }); +} +exports.empty = empty; +/** + * Get the size of a string, array, map, or set. + * + * @param value - The value to measure. + * @returns The size of the value. + */ +function getSize(value) { + if (value instanceof Map || value instanceof Set) { + return value.size; + } + return value.length; +} +/** + * Ensure that a number or date is below a threshold. + * + * @param struct - The struct to augment. + * @param threshold - The maximum value that the input can be. + * @param options - An optional options object. + * @param options.exclusive - When `true`, the input must be strictly less than + * the threshold. When `false`, the input must be less than or equal to the + * threshold. + * @returns A new struct that will only accept values below the threshold. + */ +function max(struct, threshold, options = {}) { + const { exclusive } = options; + return refine(struct, 'max', (value) => { + return exclusive + ? value < threshold + : value <= threshold || + `Expected a ${struct.type} less than ${exclusive ? '' : 'or equal to ' + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions + }${threshold} but received \`${value}\``; + }); +} +exports.max = max; +/** + * Ensure that a number or date is above a threshold. + * + * @param struct - The struct to augment. + * @param threshold - The minimum value that the input can be. + * @param options - An optional options object. + * @param options.exclusive - When `true`, the input must be strictly greater + * than the threshold. When `false`, the input must be greater than or equal to + * the threshold. + * @returns A new struct that will only accept values above the threshold. + */ +function min(struct, threshold, options = {}) { + const { exclusive } = options; + return refine(struct, 'min', (value) => { + return exclusive + ? value > threshold + : value >= threshold || + `Expected a ${struct.type} greater than ${exclusive ? '' : 'or equal to ' + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions + }${threshold} but received \`${value}\``; + }); +} +exports.min = min; +/** + * Ensure that a string, array, map or set is not empty. + * + * @param struct - The struct to augment. + * @returns A new struct that will only accept non-empty values. + */ +function nonempty(struct) { + return refine(struct, 'nonempty', (value) => { + // eslint-disable-next-line @typescript-eslint/no-shadow + const size = getSize(value); + return (size > 0 || `Expected a nonempty ${struct.type} but received an empty one`); + }); +} +exports.nonempty = nonempty; +/** + * Ensure that a string matches a regular expression. + * + * @param struct - The struct to augment. + * @param regexp - The regular expression to match against. + * @returns A new struct that will only accept strings matching the regular + * expression. + */ +function pattern(struct, regexp) { + return refine(struct, 'pattern', (value) => { + return (regexp.test(value) || + `Expected a ${struct.type} matching \`/${regexp.source}/\` but received "${value}"`); + }); +} +exports.pattern = pattern; +/** + * Ensure that a string, array, number, date, map, or set has a size (or length, + * or time) between `min` and `max`. + * + * @param struct - The struct to augment. + * @param minimum - The minimum size that the input can be. + * @param maximum - The maximum size that the input can be. + * @returns A new struct that will only accept values within the given size + * range. + */ +function size(struct, minimum, maximum = minimum) { + const expected = `Expected a ${struct.type}`; + const of = minimum === maximum + ? `of \`${minimum}\`` + : `between \`${minimum}\` and \`${maximum}\``; + return refine(struct, 'size', (value) => { + if (typeof value === 'number' || value instanceof Date) { + return ((minimum <= value && value <= maximum) || + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions + `${expected} ${of} but received \`${value}\``); + } + else if (value instanceof Map || value instanceof Set) { + // eslint-disable-next-line @typescript-eslint/no-shadow + const { size } = value; + return ((minimum <= size && size <= maximum) || + `${expected} with a size ${of} but received one with a size of \`${size}\``); + } + const { length } = value; + return ((minimum <= length && length <= maximum) || + `${expected} with a length ${of} but received one with a length of \`${length}\``); + }); +} +exports.size = size; +/** + * Augment a `Struct` to add an additional refinement to the validation. + * + * The refiner function is guaranteed to receive a value of the struct's type, + * because the struct's existing validation will already have passed. This + * allows you to layer additional validation on top of existing structs. + * + * @param struct - The struct to augment. + * @param name - The name of the refinement. + * @param refiner - The refiner function. + * @returns A new struct that will run the refiner function after the existing + * validation. + */ +function refine(struct, name, refiner) { + return new struct_js_1.Struct({ + ...struct, + *refiner(value, ctx) { + yield* struct.refiner(value, ctx); + const result = refiner(value, ctx); + const failures = (0, utils_js_1.toFailures)(result, ctx, struct, value); + for (const failure of failures) { + yield { ...failure, refinement: name }; + } + }, + }); +} +exports.refine = refine; +//# sourceMappingURL=refinements.cjs.map + +/***/ }), + +/***/ 67792: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.unknown = exports.union = exports.type = exports.tuple = exports.string = exports.set = exports.regexp = exports.record = exports.optional = exports.object = exports.number = exports.nullable = exports.never = exports.map = exports.literal = exports.intersection = exports.integer = exports.instance = exports.func = exports.enums = exports.date = exports.boolean = exports.bigint = exports.array = exports.any = void 0; +const struct_js_1 = __webpack_require__(99067); +const utils_js_1 = __webpack_require__(70639); +const utilities_js_1 = __webpack_require__(65991); +/** + * Ensure that any value passes validation. + * + * @returns A struct that will always pass validation. + */ +function any() { + return (0, utilities_js_1.define)('any', () => true); +} +exports.any = any; +/** + * Ensure that a value is an array and that its elements are of a specific type. + * + * Note: If you omit the element struct, the arrays elements will not be + * iterated at all. This can be helpful for cases where performance is critical, + * and it is preferred to using `array(any())`. + * + * @param Element - The struct to validate each element in the array against. + * @returns A new struct that will only accept arrays of the given type. + */ +function array(Element) { + return new struct_js_1.Struct({ + type: 'array', + schema: Element, + *entries(value) { + if (Element && Array.isArray(value)) { + for (const [index, arrayValue] of value.entries()) { + yield [index, arrayValue, Element]; + } + } + }, + coercer(value) { + return Array.isArray(value) ? value.slice() : value; + }, + validator(value) { + return (Array.isArray(value) || + `Expected an array value, but received: ${(0, utils_js_1.print)(value)}`); + }, + }); +} +exports.array = array; +/** + * Ensure that a value is a bigint. + * + * @returns A new struct that will only accept bigints. + */ +function bigint() { + return (0, utilities_js_1.define)('bigint', (value) => { + return typeof value === 'bigint'; + }); +} +exports.bigint = bigint; +/** + * Ensure that a value is a boolean. + * + * @returns A new struct that will only accept booleans. + */ +function boolean() { + return (0, utilities_js_1.define)('boolean', (value) => { + return typeof value === 'boolean'; + }); +} +exports.boolean = boolean; +/** + * Ensure that a value is a valid `Date`. + * + * Note: this also ensures that the value is *not* an invalid `Date` object, + * which can occur when parsing a date fails but still returns a `Date`. + * + * @returns A new struct that will only accept valid `Date` objects. + */ +function date() { + return (0, utilities_js_1.define)('date', (value) => { + return ((value instanceof Date && !isNaN(value.getTime())) || + `Expected a valid \`Date\` object, but received: ${(0, utils_js_1.print)(value)}`); + }); +} +exports.date = date; +/** + * Ensure that a value is one of a set of potential values. + * + * Note: after creating the struct, you can access the definition of the + * potential values as `struct.schema`. + * + * @param values - The potential values that the input can be. + * @returns A new struct that will only accept the given values. + */ +function enums(values) { + const schema = {}; + const description = values.map((value) => (0, utils_js_1.print)(value)).join(); + for (const key of values) { + schema[key] = key; + } + return new struct_js_1.Struct({ + type: 'enums', + schema, + validator(value) { + return (values.includes(value) || + `Expected one of \`${description}\`, but received: ${(0, utils_js_1.print)(value)}`); + }, + }); +} +exports.enums = enums; +/** + * Ensure that a value is a function. + * + * @returns A new struct that will only accept functions. + */ +// eslint-disable-next-line @typescript-eslint/ban-types +function func() { + return (0, utilities_js_1.define)('func', (value) => { + return (typeof value === 'function' || + `Expected a function, but received: ${(0, utils_js_1.print)(value)}`); + }); +} +exports.func = func; +/** + * Ensure that a value is an instance of a specific class. + * + * @param Class - The class that the value must be an instance of. + * @returns A new struct that will only accept instances of the given class. + */ +function instance(Class) { + return (0, utilities_js_1.define)('instance', (value) => { + return (value instanceof Class || + `Expected a \`${Class.name}\` instance, but received: ${(0, utils_js_1.print)(value)}`); + }); +} +exports.instance = instance; +/** + * Ensure that a value is an integer. + * + * @returns A new struct that will only accept integers. + */ +function integer() { + return (0, utilities_js_1.define)('integer', (value) => { + return ((typeof value === 'number' && !isNaN(value) && Number.isInteger(value)) || + `Expected an integer, but received: ${(0, utils_js_1.print)(value)}`); + }); +} +exports.integer = integer; +/** + * Ensure that a value matches all of a set of types. + * + * @param Structs - The set of structs that the value must match. + * @returns A new struct that will only accept values that match all of the + * given structs. + */ +function intersection(Structs) { + return new struct_js_1.Struct({ + type: 'intersection', + schema: null, + *entries(value, context) { + for (const { entries } of Structs) { + yield* entries(value, context); + } + }, + *validator(value, context) { + for (const { validator } of Structs) { + yield* validator(value, context); + } + }, + *refiner(value, context) { + for (const { refiner } of Structs) { + yield* refiner(value, context); + } + }, + }); +} +exports.intersection = intersection; +/** + * Ensure that a value is an exact value, using `===` for comparison. + * + * @param constant - The exact value that the input must be. + * @returns A new struct that will only accept the exact given value. + */ +function literal(constant) { + const description = (0, utils_js_1.print)(constant); + const valueType = typeof constant; + return new struct_js_1.Struct({ + type: 'literal', + schema: valueType === 'string' || + valueType === 'number' || + valueType === 'boolean' + ? constant + : null, + validator(value) { + return (value === constant || + `Expected the literal \`${description}\`, but received: ${(0, utils_js_1.print)(value)}`); + }, + }); +} +exports.literal = literal; +/** + * Ensure that a value is a `Map` object, and that its keys and values are of + * specific types. + * + * @param Key - The struct to validate each key in the map against. + * @param Value - The struct to validate each value in the map against. + * @returns A new struct that will only accept `Map` objects. + */ +function map(Key, Value) { + return new struct_js_1.Struct({ + type: 'map', + schema: null, + *entries(value) { + if (Key && Value && value instanceof Map) { + for (const [mapKey, mapValue] of value.entries()) { + yield [mapKey, mapKey, Key]; + yield [mapKey, mapValue, Value]; + } + } + }, + coercer(value) { + return value instanceof Map ? new Map(value) : value; + }, + validator(value) { + return (value instanceof Map || + `Expected a \`Map\` object, but received: ${(0, utils_js_1.print)(value)}`); + }, + }); +} +exports.map = map; +/** + * Ensure that no value ever passes validation. + * + * @returns A new struct that will never pass validation. + */ +function never() { + return (0, utilities_js_1.define)('never', () => false); +} +exports.never = never; +/** + * Augment an existing struct to allow `null` values. + * + * @param struct - The struct to augment. + * @returns A new struct that will accept `null` values. + */ +function nullable(struct) { + return new struct_js_1.Struct({ + ...struct, + validator: (value, ctx) => value === null || struct.validator(value, ctx), + refiner: (value, ctx) => value === null || struct.refiner(value, ctx), + }); +} +exports.nullable = nullable; +/** + * Ensure that a value is a number. + * + * @returns A new struct that will only accept numbers. + */ +function number() { + return (0, utilities_js_1.define)('number', (value) => { + return ((typeof value === 'number' && !isNaN(value)) || + `Expected a number, but received: ${(0, utils_js_1.print)(value)}`); + }); +} +exports.number = number; +/** + * Ensure that a value is an object, that it has a known set of properties, + * and that its properties are of specific types. + * + * Note: Unrecognized properties will fail validation. + * + * @param schema - An object that defines the structure of the object. + * @returns A new struct that will only accept objects. + */ +function object(schema) { + const knowns = schema ? Object.keys(schema) : []; + const Never = never(); + return new struct_js_1.Struct({ + type: 'object', + schema: schema ?? null, + *entries(value) { + if (schema && (0, utils_js_1.isObject)(value)) { + const unknowns = new Set(Object.keys(value)); + for (const key of knowns) { + unknowns.delete(key); + yield [key, value[key], schema[key]]; + } + for (const key of unknowns) { + yield [key, value[key], Never]; + } + } + }, + validator(value) { + return ((0, utils_js_1.isObject)(value) || `Expected an object, but received: ${(0, utils_js_1.print)(value)}`); + }, + coercer(value) { + return (0, utils_js_1.isObject)(value) ? { ...value } : value; + }, + }); +} +exports.object = object; +/** + * Augment a struct to allow `undefined` values. + * + * @param struct - The struct to augment. + * @returns A new struct that will accept `undefined` values. + */ +function optional(struct) { + return new struct_js_1.Struct({ + ...struct, + validator: (value, ctx) => value === undefined || struct.validator(value, ctx), + refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx), + }); +} +exports.optional = optional; +/** + * Ensure that a value is an object with keys and values of specific types, but + * without ensuring any specific shape of properties. + * + * Like TypeScript's `Record` utility. + */ +/** + * Ensure that a value is an object with keys and values of specific types, but + * without ensuring any specific shape of properties. + * + * @param Key - The struct to validate each key in the record against. + * @param Value - The struct to validate each value in the record against. + * @returns A new struct that will only accept objects. + */ +function record(Key, Value) { + return new struct_js_1.Struct({ + type: 'record', + schema: null, + *entries(value) { + if ((0, utils_js_1.isObject)(value)) { + // eslint-disable-next-line guard-for-in + for (const objectKey in value) { + const objectValue = value[objectKey]; + yield [objectKey, objectKey, Key]; + yield [objectKey, objectValue, Value]; + } + } + }, + validator(value) { + return ((0, utils_js_1.isObject)(value) || `Expected an object, but received: ${(0, utils_js_1.print)(value)}`); + }, + }); +} +exports.record = record; +/** + * Ensure that a value is a `RegExp`. + * + * Note: this does not test the value against the regular expression! For that + * you need to use the `pattern()` refinement. + * + * @returns A new struct that will only accept `RegExp` objects. + */ +function regexp() { + return (0, utilities_js_1.define)('regexp', (value) => { + return value instanceof RegExp; + }); +} +exports.regexp = regexp; +/** + * Ensure that a value is a `Set` object, and that its elements are of a + * specific type. + * + * @param Element - The struct to validate each element in the set against. + * @returns A new struct that will only accept `Set` objects. + */ +function set(Element) { + return new struct_js_1.Struct({ + type: 'set', + schema: null, + *entries(value) { + if (Element && value instanceof Set) { + for (const setValue of value) { + yield [setValue, setValue, Element]; + } + } + }, + coercer(value) { + return value instanceof Set ? new Set(value) : value; + }, + validator(value) { + return (value instanceof Set || + `Expected a \`Set\` object, but received: ${(0, utils_js_1.print)(value)}`); + }, + }); +} +exports.set = set; +/** + * Ensure that a value is a string. + * + * @returns A new struct that will only accept strings. + */ +function string() { + return (0, utilities_js_1.define)('string', (value) => { + return (typeof value === 'string' || + `Expected a string, but received: ${(0, utils_js_1.print)(value)}`); + }); +} +exports.string = string; +/** + * Ensure that a value is a tuple of a specific length, and that each of its + * elements is of a specific type. + * + * @param Structs - The set of structs that the value must match. + * @returns A new struct that will only accept tuples of the given types. + */ +function tuple(Structs) { + const Never = never(); + return new struct_js_1.Struct({ + type: 'tuple', + schema: null, + *entries(value) { + if (Array.isArray(value)) { + const length = Math.max(Structs.length, value.length); + for (let i = 0; i < length; i++) { + yield [i, value[i], Structs[i] || Never]; + } + } + }, + validator(value) { + return (Array.isArray(value) || + `Expected an array, but received: ${(0, utils_js_1.print)(value)}`); + }, + }); +} +exports.tuple = tuple; +/** + * Ensure that a value has a set of known properties of specific types. + * + * Note: Unrecognized properties are allowed and untouched. This is similar to + * how TypeScript's structural typing works. + * + * @param schema - An object that defines the structure of the object. + * @returns A new struct that will only accept objects. + */ +function type(schema) { + const keys = Object.keys(schema); + return new struct_js_1.Struct({ + type: 'type', + schema, + *entries(value) { + if ((0, utils_js_1.isObject)(value)) { + for (const k of keys) { + yield [k, value[k], schema[k]]; + } + } + }, + validator(value) { + return ((0, utils_js_1.isObject)(value) || `Expected an object, but received: ${(0, utils_js_1.print)(value)}`); + }, + coercer(value) { + return (0, utils_js_1.isObject)(value) ? { ...value } : value; + }, + }); +} +exports.type = type; +/** + * Ensure that a value matches one of a set of types. + * + * @param Structs - The set of structs that the value must match. + * @returns A new struct that will only accept values that match one of the + * given structs. + */ +function union(Structs) { + const description = Structs.map((struct) => struct.type).join(' | '); + return new struct_js_1.Struct({ + type: 'union', + schema: null, + coercer(value) { + for (const InnerStruct of Structs) { + const [error, coerced] = InnerStruct.validate(value, { coerce: true }); + if (!error) { + return coerced; + } + } + return value; + }, + validator(value, ctx) { + const failures = []; + for (const InnerStruct of Structs) { + const [...tuples] = (0, utils_js_1.run)(value, InnerStruct, ctx); + const [first] = tuples; + if (!first?.[0]) { + return []; + } + for (const [failure] of tuples) { + if (failure) { + failures.push(failure); + } + } + } + return [ + `Expected the value to satisfy a union of \`${description}\`, but received: ${(0, utils_js_1.print)(value)}`, + ...failures, + ]; + }, + }); +} +exports.union = union; +/** + * Ensure that any value passes validation, without widening its type to `any`. + * + * @returns A struct that will always pass validation. + */ +function unknown() { + return (0, utilities_js_1.define)('unknown', () => true); +} +exports.unknown = unknown; +//# sourceMappingURL=types.cjs.map + +/***/ }), + +/***/ 65991: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.pick = exports.partial = exports.omit = exports.lazy = exports.dynamic = exports.deprecated = exports.define = exports.assign = void 0; +const struct_js_1 = __webpack_require__(99067); +const types_js_1 = __webpack_require__(67792); +/** + * Create a new struct that combines the properties from multiple object or type + * structs. Its return type will match the first parameter's type. + * + * @param Structs - The structs to combine. + * @returns A new struct that combines the properties of the input structs. + */ +function assign(...Structs) { + const isType = Structs[0]?.type === 'type'; + const schemas = Structs.map(({ schema }) => schema); + const schema = Object.assign({}, ...schemas); + return isType ? (0, types_js_1.type)(schema) : (0, types_js_1.object)(schema); +} +exports.assign = assign; +/** + * Define a new struct type with a custom validation function. + * + * @param name - The name of the struct type. + * @param validator - The validation function. + * @returns A new struct type. + */ +function define(name, validator) { + return new struct_js_1.Struct({ type: name, schema: null, validator }); +} +exports.define = define; +/** + * Create a new struct based on an existing struct, but the value is allowed to + * be `undefined`. `log` will be called if the value is not `undefined`. + * + * @param struct - The struct to augment. + * @param log - The function to call when the value is not `undefined`. + * @returns A new struct that will only accept `undefined` or values that pass + * the input struct. + */ +function deprecated(struct, log) { + return new struct_js_1.Struct({ + ...struct, + refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx), + validator(value, ctx) { + if (value === undefined) { + return true; + } + log(value, ctx); + return struct.validator(value, ctx); + }, + }); +} +exports.deprecated = deprecated; +/** + * Create a struct with dynamic validation logic. + * + * The callback will receive the value currently being validated, and must + * return a struct object to validate it with. This can be useful to model + * validation logic that changes based on its input. + * + * @param fn - The callback to create the struct. + * @returns A new struct with dynamic validation logic. + */ +function dynamic(fn) { + return new struct_js_1.Struct({ + type: 'dynamic', + schema: null, + *entries(value, ctx) { + const struct = fn(value, ctx); + yield* struct.entries(value, ctx); + }, + validator(value, ctx) { + const struct = fn(value, ctx); + return struct.validator(value, ctx); + }, + coercer(value, ctx) { + const struct = fn(value, ctx); + return struct.coercer(value, ctx); + }, + refiner(value, ctx) { + const struct = fn(value, ctx); + return struct.refiner(value, ctx); + }, + }); +} +exports.dynamic = dynamic; +/** + * Create a struct with lazily evaluated validation logic. + * + * The first time validation is run with the struct, the callback will be called + * and must return a struct object to use. This is useful for cases where you + * want to have self-referential structs for nested data structures to avoid a + * circular definition problem. + * + * @param fn - The callback to create the struct. + * @returns A new struct with lazily evaluated validation logic. + */ +function lazy(fn) { + let struct; + return new struct_js_1.Struct({ + type: 'lazy', + schema: null, + *entries(value, ctx) { + struct ?? (struct = fn()); + yield* struct.entries(value, ctx); + }, + validator(value, ctx) { + struct ?? (struct = fn()); + return struct.validator(value, ctx); + }, + coercer(value, ctx) { + struct ?? (struct = fn()); + return struct.coercer(value, ctx); + }, + refiner(value, ctx) { + struct ?? (struct = fn()); + return struct.refiner(value, ctx); + }, + }); +} +exports.lazy = lazy; +/** + * Create a new struct based on an existing object struct, but excluding + * specific properties. + * + * Like TypeScript's `Omit` utility. + * + * @param struct - The struct to augment. + * @param keys - The keys to omit. + * @returns A new struct that will not accept the input keys. + */ +function omit(struct, keys) { + const { schema } = struct; + const subschema = { ...schema }; + for (const key of keys) { + delete subschema[key]; + } + switch (struct.type) { + case 'type': + return (0, types_js_1.type)(subschema); + default: + return (0, types_js_1.object)(subschema); + } +} +exports.omit = omit; +/** + * Create a new struct based on an existing object struct, but with all of its + * properties allowed to be `undefined`. + * + * Like TypeScript's `Partial` utility. + * + * @param struct - The struct to augment. + * @returns A new struct that will accept the input keys as `undefined`. + */ +function partial(struct) { + const isStruct = struct instanceof struct_js_1.Struct; + const schema = isStruct ? { ...struct.schema } : { ...struct }; + // eslint-disable-next-line guard-for-in + for (const key in schema) { + schema[key] = (0, types_js_1.optional)(schema[key]); + } + if (isStruct && struct.type === 'type') { + return (0, types_js_1.type)(schema); + } + return (0, types_js_1.object)(schema); +} +exports.partial = partial; +/** + * Create a new struct based on an existing object struct, but only including + * specific properties. + * + * Like TypeScript's `Pick` utility. + * + * @param struct - The struct to augment. + * @param keys - The keys to pick. + * @returns A new struct that will only accept the input keys. + */ +function pick(struct, keys) { + const { schema } = struct; + const subschema = {}; + for (const key of keys) { + subschema[key] = schema[key]; + } + switch (struct.type) { + case 'type': + return (0, types_js_1.type)(subschema); + default: + return (0, types_js_1.object)(subschema); + } +} +exports.pick = pick; +//# sourceMappingURL=utilities.cjs.map + +/***/ }), + +/***/ 70639: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.run = exports.toFailures = exports.toFailure = exports.shiftIterator = exports.print = exports.isPlainObject = exports.isObject = void 0; +/** + * Check if a value is an iterator. + * + * @param value - The value to check. + * @returns Whether the value is an iterator. + */ +function isIterable(value) { + return isObject(value) && typeof value[Symbol.iterator] === 'function'; +} +/** + * Check if a value is a plain object. + * + * @param value - The value to check. + * @returns Whether the value is a plain object. + */ +function isObject(value) { + return typeof value === 'object' && value !== null; +} +exports.isObject = isObject; +/** + * Check if a value is a plain object. + * + * @param value - The value to check. + * @returns Whether the value is a plain object. + */ +function isPlainObject(value) { + if (Object.prototype.toString.call(value) !== '[object Object]') { + return false; + } + const prototype = Object.getPrototypeOf(value); + return prototype === null || prototype === Object.prototype; +} +exports.isPlainObject = isPlainObject; +/** + * Return a value as a printable string. + * + * @param value - The value to print. + * @returns The value as a string. + */ +function print(value) { + if (typeof value === 'symbol') { + return value.toString(); + } + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions + return typeof value === 'string' ? JSON.stringify(value) : `${value}`; +} +exports.print = print; +/** + * Shift (remove and return) the first value from the `input` iterator. + * Like `Array.prototype.shift()` but for an `Iterator`. + * + * @param input - The iterator to shift. + * @returns The first value of the iterator, or `undefined` if the iterator is + * empty. + */ +function shiftIterator(input) { + const { done, value } = input.next(); + return done ? undefined : value; +} +exports.shiftIterator = shiftIterator; +/** + * Convert a single validation result to a failure. + * + * @param result - The result to convert. + * @param context - The context of the validation. + * @param struct - The struct being validated. + * @param value - The value being validated. + * @returns A failure if the result is a failure, or `undefined` if the result + * is a success. + */ +function toFailure(result, context, struct, value) { + if (result === true) { + return undefined; + } + else if (result === false) { + // eslint-disable-next-line no-param-reassign + result = {}; + } + else if (typeof result === 'string') { + // eslint-disable-next-line no-param-reassign + result = { message: result }; + } + const { path, branch } = context; + const { type } = struct; + const { refinement, message = `Expected a value of type \`${type}\`${refinement ? ` with refinement \`${refinement}\`` : ''}, but received: \`${print(value)}\``, } = result; + return { + value, + type, + refinement, + key: path[path.length - 1], + path, + branch, + ...result, + message, + }; +} +exports.toFailure = toFailure; +/** + * Convert a validation result to an iterable of failures. + * + * @param result - The result to convert. + * @param context - The context of the validation. + * @param struct - The struct being validated. + * @param value - The value being validated. + * @yields The failures. + * @returns An iterable of failures. + */ +function* toFailures(result, context, struct, value) { + if (!isIterable(result)) { + // eslint-disable-next-line no-param-reassign + result = [result]; + } + for (const validationResult of result) { + const failure = toFailure(validationResult, context, struct, value); + if (failure) { + yield failure; + } + } +} +exports.toFailures = toFailures; +/** + * Check a value against a struct, traversing deeply into nested values, and + * returning an iterator of failures or success. + * + * @param value - The value to check. + * @param struct - The struct to check against. + * @param options - Optional settings. + * @param options.path - The path to the value in the input data. + * @param options.branch - The branch of the value in the input data. + * @param options.coerce - Whether to coerce the value before validating it. + * @param options.mask - Whether to mask the value before validating it. + * @param options.message - An optional message to include in the error. + * @yields An iterator of failures or success. + * @returns An iterator of failures or success. + */ +function* run(value, struct, options = {}) { + const { path = [], branch = [value], coerce = false, mask = false } = options; + const context = { path, branch }; + if (coerce) { + // eslint-disable-next-line no-param-reassign + value = struct.coercer(value, context); + if (mask && + struct.type !== 'type' && + isObject(struct.schema) && + isObject(value) && + !Array.isArray(value)) { + for (const key in value) { + if (struct.schema[key] === undefined) { + delete value[key]; + } + } + } + } + let status = 'valid'; + for (const failure of struct.validator(value, context)) { + failure.explanation = options.message; + status = 'not_valid'; + yield [failure, undefined]; + } + // eslint-disable-next-line prefer-const + for (let [innerKey, innerValue, innerStruct] of struct.entries(value, context)) { + const iterable = run(innerValue, innerStruct, { + path: innerKey === undefined ? path : [...path, innerKey], + branch: innerKey === undefined ? branch : [...branch, innerValue], + coerce, + mask, + message: options.message, + }); + for (const result of iterable) { + if (result[0]) { + status = + result[0].refinement === null || result[0].refinement === undefined + ? 'not_valid' + : 'not_refined'; + yield [result[0], undefined]; + } + else if (coerce) { + innerValue = result[1]; + if (innerKey === undefined) { + // eslint-disable-next-line no-param-reassign + value = innerValue; + } + else if (value instanceof Map) { + value.set(innerKey, innerValue); + } + else if (value instanceof Set) { + value.add(innerValue); + } + else if (isObject(value)) { + if (innerValue !== undefined || innerKey in value) { + value[innerKey] = innerValue; + } + } + } + } + } + if (status !== 'not_valid') { + for (const failure of struct.refiner(value, context)) { + failure.explanation = options.message; + status = 'not_refined'; + yield [failure, undefined]; + } + } + if (status === 'valid') { + yield [undefined, value]; + } +} +exports.run = run; +//# sourceMappingURL=utils.cjs.map + +/***/ }), + +/***/ 22011: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.assertExhaustive = exports.assertStruct = exports.assert = exports.AssertionError = void 0; +const superstruct_1 = __webpack_require__(35620); +const errors_1 = __webpack_require__(75940); +/** + * Check if a value is a constructor, i.e., a function that can be called with + * the `new` keyword. + * + * @param fn - The value to check. + * @returns `true` if the value is a constructor, or `false` otherwise. + */ +function isConstructable(fn) { + /* istanbul ignore next */ + return Boolean(typeof fn?.prototype?.constructor?.name === 'string'); +} +/** + * Attempts to obtain the message from a possible error object. If it is + * possible to do so, any trailing period will be removed from the message; + * otherwise an empty string is returned. + * + * @param error - The error object to get the message from. + * @returns The message without any trailing period if `error` is an object + * with a `message` property; the string version of `error` without any trailing + * period if it is not `undefined` or `null`; otherwise an empty string. + */ +function getErrorMessageWithoutTrailingPeriod(error) { + // We'll add our own period. + return (0, errors_1.getErrorMessage)(error).replace(/\.$/u, ''); +} +/** + * Initialise an {@link AssertionErrorConstructor} error. + * + * @param ErrorWrapper - The error class to use. + * @param message - The error message. + * @returns The error object. + */ +// eslint-disable-next-line @typescript-eslint/naming-convention +function getError(ErrorWrapper, message) { + if (isConstructable(ErrorWrapper)) { + return new ErrorWrapper({ + message, + }); + } + return ErrorWrapper({ + message, + }); +} +/** + * The default error class that is thrown if an assertion fails. + */ +class AssertionError extends Error { + constructor(options) { + super(options.message); + this.code = 'ERR_ASSERTION'; + } +} +exports.AssertionError = AssertionError; +/** + * Same as Node.js assert. + * If the value is falsy, throws an error, does nothing otherwise. + * + * @throws {@link AssertionError} If value is falsy. + * @param value - The test that should be truthy to pass. + * @param message - Message to be passed to {@link AssertionError} or an + * {@link Error} instance to throw. + * @param ErrorWrapper - The error class to throw if the assertion fails. + * Defaults to {@link AssertionError}. If a custom error class is provided for + * the `message` argument, this argument is ignored. + */ +function assert(value, message = 'Assertion failed.', +// eslint-disable-next-line @typescript-eslint/naming-convention +ErrorWrapper = AssertionError) { + if (!value) { + if (message instanceof Error) { + throw message; + } + throw getError(ErrorWrapper, message); + } +} +exports.assert = assert; +/** + * Assert a value against a Superstruct struct. + * + * @param value - The value to validate. + * @param struct - The struct to validate against. + * @param errorPrefix - A prefix to add to the error message. Defaults to + * "Assertion failed". + * @param ErrorWrapper - The error class to throw if the assertion fails. + * Defaults to {@link AssertionError}. + * @throws If the value is not valid. + */ +function assertStruct(value, struct, errorPrefix = 'Assertion failed', +// eslint-disable-next-line @typescript-eslint/naming-convention +ErrorWrapper = AssertionError) { + try { + (0, superstruct_1.assert)(value, struct); + } + catch (error) { + throw getError(ErrorWrapper, `${errorPrefix}: ${getErrorMessageWithoutTrailingPeriod(error)}.`); + } +} +exports.assertStruct = assertStruct; +/** + * Use in the default case of a switch that you want to be fully exhaustive. + * Using this function forces the compiler to enforce exhaustivity during + * compile-time. + * + * @example + * ``` + * const number = 1; + * switch (number) { + * case 0: + * ... + * case 1: + * ... + * default: + * assertExhaustive(snapPrefix); + * } + * ``` + * @param _object - The object on which the switch is being operated. + */ +function assertExhaustive(_object) { + throw new Error('Invalid branch reached. Should be detected during compilation.'); +} +exports.assertExhaustive = assertExhaustive; +//# sourceMappingURL=assert.cjs.map + +/***/ }), + +/***/ 20472: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.base64 = void 0; +const superstruct_1 = __webpack_require__(35620); +const assert_1 = __webpack_require__(22011); +/** + * Ensure that a provided string-based struct is valid base64. + * + * @param struct - The string based struct. + * @param options - Optional options to specialize base64 validation. See {@link Base64Options} documentation. + * @returns A superstruct validating base64. + */ +const base64 = (struct, options = {}) => { + const paddingRequired = options.paddingRequired ?? false; + const characterSet = options.characterSet ?? 'base64'; + let letters; + if (characterSet === 'base64') { + letters = String.raw `[A-Za-z0-9+\/]`; + } + else { + (0, assert_1.assert)(characterSet === 'base64url'); + letters = String.raw `[-_A-Za-z0-9]`; + } + let re; + if (paddingRequired) { + re = new RegExp(`^(?:${letters}{4})*(?:${letters}{3}=|${letters}{2}==)?$`, 'u'); + } + else { + re = new RegExp(`^(?:${letters}{4})*(?:${letters}{2,3}|${letters}{3}=|${letters}{2}==)?$`, 'u'); + } + return (0, superstruct_1.pattern)(struct, re); +}; +exports.base64 = base64; +//# sourceMappingURL=base64.cjs.map + +/***/ }), + +/***/ 77862: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createDataView = exports.concatBytes = exports.valueToBytes = exports.base64ToBytes = exports.stringToBytes = exports.numberToBytes = exports.signedBigIntToBytes = exports.bigIntToBytes = exports.hexToBytes = exports.bytesToBase64 = exports.bytesToString = exports.bytesToNumber = exports.bytesToSignedBigInt = exports.bytesToBigInt = exports.bytesToHex = exports.assertIsBytes = exports.isBytes = void 0; +const base_1 = __webpack_require__(63203); +const assert_1 = __webpack_require__(22011); +const hex_1 = __webpack_require__(93976); +// '0'.charCodeAt(0) === 48 +const HEX_MINIMUM_NUMBER_CHARACTER = 48; +// '9'.charCodeAt(0) === 57 +const HEX_MAXIMUM_NUMBER_CHARACTER = 58; +const HEX_CHARACTER_OFFSET = 87; +/** + * Memoized function that returns an array to be used as a lookup table for + * converting bytes to hexadecimal values. + * + * The array is created lazily and then cached for future use. The benefit of + * this approach is that the performance of converting bytes to hex is much + * better than if we were to call `toString(16)` on each byte. + * + * The downside is that the array is created once and then never garbage + * collected. This is not a problem in practice because the array is only 256 + * elements long. + * + * @returns A function that returns the lookup table. + */ +function getPrecomputedHexValuesBuilder() { + // To avoid issues with tree shaking, we need to use a function to return the + // array. This is because the array is only used in the `bytesToHex` function + // and if we were to use a global variable, the array might be removed by the + // tree shaker. + const lookupTable = []; + return () => { + if (lookupTable.length === 0) { + for (let i = 0; i < 256; i++) { + lookupTable.push(i.toString(16).padStart(2, '0')); + } + } + return lookupTable; + }; +} +/** + * Function implementation of the {@link getPrecomputedHexValuesBuilder} + * function. + */ +const getPrecomputedHexValues = getPrecomputedHexValuesBuilder(); +/** + * Check if a value is a `Uint8Array`. + * + * @param value - The value to check. + * @returns Whether the value is a `Uint8Array`. + */ +function isBytes(value) { + return value instanceof Uint8Array; +} +exports.isBytes = isBytes; +/** + * Assert that a value is a `Uint8Array`. + * + * @param value - The value to check. + * @throws If the value is not a `Uint8Array`. + */ +function assertIsBytes(value) { + (0, assert_1.assert)(isBytes(value), 'Value must be a Uint8Array.'); +} +exports.assertIsBytes = assertIsBytes; +/** + * Convert a `Uint8Array` to a hexadecimal string. + * + * @param bytes - The bytes to convert to a hexadecimal string. + * @returns The hexadecimal string. + */ +function bytesToHex(bytes) { + assertIsBytes(bytes); + if (bytes.length === 0) { + return '0x'; + } + const lookupTable = getPrecomputedHexValues(); + const hexadecimal = new Array(bytes.length); + for (let i = 0; i < bytes.length; i++) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + hexadecimal[i] = lookupTable[bytes[i]]; + } + return (0, hex_1.add0x)(hexadecimal.join('')); +} +exports.bytesToHex = bytesToHex; +/** + * Convert a `Uint8Array` to a `bigint`. + * + * To convert a `Uint8Array` to a `number` instead, use {@link bytesToNumber}. + * To convert a two's complement encoded `Uint8Array` to a `bigint`, use + * {@link bytesToSignedBigInt}. + * + * @param bytes - The bytes to convert to a `bigint`. + * @returns The `bigint`. + */ +function bytesToBigInt(bytes) { + assertIsBytes(bytes); + const hexadecimal = bytesToHex(bytes); + return BigInt(hexadecimal); +} +exports.bytesToBigInt = bytesToBigInt; +/** + * Convert a `Uint8Array` to a signed `bigint`. This assumes that the bytes are + * encoded in two's complement. + * + * To convert a `Uint8Array` to an unsigned `bigint` instead, use + * {@link bytesToBigInt}. + * + * @see https://en.wikipedia.org/wiki/Two%27s_complement + * @param bytes - The bytes to convert to a signed `bigint`. + * @returns The signed `bigint`. + */ +function bytesToSignedBigInt(bytes) { + assertIsBytes(bytes); + let value = BigInt(0); + for (const byte of bytes) { + // eslint-disable-next-line no-bitwise + value = (value << BigInt(8)) + BigInt(byte); + } + return BigInt.asIntN(bytes.length * 8, value); +} +exports.bytesToSignedBigInt = bytesToSignedBigInt; +/** + * Convert a `Uint8Array` to a `number`. + * + * To convert a `Uint8Array` to a `bigint` instead, use {@link bytesToBigInt}. + * + * @param bytes - The bytes to convert to a number. + * @returns The number. + * @throws If the resulting number is not a safe integer. + */ +function bytesToNumber(bytes) { + assertIsBytes(bytes); + const bigint = bytesToBigInt(bytes); + (0, assert_1.assert)(bigint <= BigInt(Number.MAX_SAFE_INTEGER), 'Number is not a safe integer. Use `bytesToBigInt` instead.'); + return Number(bigint); +} +exports.bytesToNumber = bytesToNumber; +/** + * Convert a UTF-8 encoded `Uint8Array` to a `string`. + * + * @param bytes - The bytes to convert to a string. + * @returns The string. + */ +function bytesToString(bytes) { + assertIsBytes(bytes); + return new TextDecoder().decode(bytes); +} +exports.bytesToString = bytesToString; +/** + * Convert a `Uint8Array` to a base64 encoded string. + * + * @param bytes - The bytes to convert to a base64 encoded string. + * @returns The base64 encoded string. + */ +function bytesToBase64(bytes) { + assertIsBytes(bytes); + return base_1.base64.encode(bytes); +} +exports.bytesToBase64 = bytesToBase64; +/** + * Convert a hexadecimal string to a `Uint8Array`. The string can optionally be + * prefixed with `0x`. It accepts even and odd length strings. + * + * If the value is "0x", an empty `Uint8Array` is returned. + * + * @param value - The hexadecimal string to convert to bytes. + * @returns The bytes as `Uint8Array`. + */ +function hexToBytes(value) { + // "0x" is often used as empty byte array. + if (value?.toLowerCase?.() === '0x') { + return new Uint8Array(); + } + (0, hex_1.assertIsHexString)(value); + // Remove the `0x` prefix if it exists, and pad the string to have an even + // number of characters. + const strippedValue = (0, hex_1.remove0x)(value).toLowerCase(); + const normalizedValue = strippedValue.length % 2 === 0 ? strippedValue : `0${strippedValue}`; + const bytes = new Uint8Array(normalizedValue.length / 2); + for (let i = 0; i < bytes.length; i++) { + // While this is not the prettiest way to convert a hexadecimal string to a + // `Uint8Array`, it is a lot faster than using `parseInt` to convert each + // character. + const c1 = normalizedValue.charCodeAt(i * 2); + const c2 = normalizedValue.charCodeAt(i * 2 + 1); + const n1 = c1 - + (c1 < HEX_MAXIMUM_NUMBER_CHARACTER + ? HEX_MINIMUM_NUMBER_CHARACTER + : HEX_CHARACTER_OFFSET); + const n2 = c2 - + (c2 < HEX_MAXIMUM_NUMBER_CHARACTER + ? HEX_MINIMUM_NUMBER_CHARACTER + : HEX_CHARACTER_OFFSET); + bytes[i] = n1 * 16 + n2; + } + return bytes; +} +exports.hexToBytes = hexToBytes; +/** + * Convert a `bigint` to a `Uint8Array`. + * + * This assumes that the `bigint` is an unsigned integer. To convert a signed + * `bigint` instead, use {@link signedBigIntToBytes}. + * + * @param value - The bigint to convert to bytes. + * @returns The bytes as `Uint8Array`. + */ +function bigIntToBytes(value) { + (0, assert_1.assert)(typeof value === 'bigint', 'Value must be a bigint.'); + (0, assert_1.assert)(value >= BigInt(0), 'Value must be a non-negative bigint.'); + const hexadecimal = value.toString(16); + return hexToBytes(hexadecimal); +} +exports.bigIntToBytes = bigIntToBytes; +/** + * Check if a `bigint` fits in a certain number of bytes. + * + * @param value - The `bigint` to check. + * @param bytes - The number of bytes. + * @returns Whether the `bigint` fits in the number of bytes. + */ +function bigIntFits(value, bytes) { + (0, assert_1.assert)(bytes > 0); + /* eslint-disable no-bitwise */ + const mask = value >> BigInt(31); + return !(((~value & mask) + (value & ~mask)) >> BigInt(bytes * 8 + ~0)); + /* eslint-enable no-bitwise */ +} +/** + * Convert a signed `bigint` to a `Uint8Array`. This uses two's complement + * encoding to represent negative numbers. + * + * To convert an unsigned `bigint` to a `Uint8Array` instead, use + * {@link bigIntToBytes}. + * + * @see https://en.wikipedia.org/wiki/Two%27s_complement + * @param value - The number to convert to bytes. + * @param byteLength - The length of the resulting `Uint8Array`. If the number + * is larger than the maximum value that can be represented by the given length, + * an error is thrown. + * @returns The bytes as `Uint8Array`. + */ +function signedBigIntToBytes(value, byteLength) { + (0, assert_1.assert)(typeof value === 'bigint', 'Value must be a bigint.'); + (0, assert_1.assert)(typeof byteLength === 'number', 'Byte length must be a number.'); + (0, assert_1.assert)(byteLength > 0, 'Byte length must be greater than 0.'); + (0, assert_1.assert)(bigIntFits(value, byteLength), 'Byte length is too small to represent the given value.'); + // ESLint doesn't like mutating function parameters, so to avoid having to + // disable the rule, we create a new variable. + let numberValue = value; + const bytes = new Uint8Array(byteLength); + for (let i = 0; i < bytes.length; i++) { + bytes[i] = Number(BigInt.asUintN(8, numberValue)); + // eslint-disable-next-line no-bitwise + numberValue >>= BigInt(8); + } + return bytes.reverse(); +} +exports.signedBigIntToBytes = signedBigIntToBytes; +/** + * Convert a `number` to a `Uint8Array`. + * + * @param value - The number to convert to bytes. + * @returns The bytes as `Uint8Array`. + * @throws If the number is not a safe integer. + */ +function numberToBytes(value) { + (0, assert_1.assert)(typeof value === 'number', 'Value must be a number.'); + (0, assert_1.assert)(value >= 0, 'Value must be a non-negative number.'); + (0, assert_1.assert)(Number.isSafeInteger(value), 'Value is not a safe integer. Use `bigIntToBytes` instead.'); + const hexadecimal = value.toString(16); + return hexToBytes(hexadecimal); +} +exports.numberToBytes = numberToBytes; +/** + * Convert a `string` to a UTF-8 encoded `Uint8Array`. + * + * @param value - The string to convert to bytes. + * @returns The bytes as `Uint8Array`. + */ +function stringToBytes(value) { + (0, assert_1.assert)(typeof value === 'string', 'Value must be a string.'); + return new TextEncoder().encode(value); +} +exports.stringToBytes = stringToBytes; +/** + * Convert a base64 encoded string to a `Uint8Array`. + * + * @param value - The base64 encoded string to convert to bytes. + * @returns The bytes as `Uint8Array`. + */ +function base64ToBytes(value) { + (0, assert_1.assert)(typeof value === 'string', 'Value must be a string.'); + return base_1.base64.decode(value); +} +exports.base64ToBytes = base64ToBytes; +/** + * Convert a byte-like value to a `Uint8Array`. The value can be a `Uint8Array`, + * a `bigint`, a `number`, or a `string`. + * + * This will attempt to guess the type of the value based on its type and + * contents. For more control over the conversion, use the more specific + * conversion functions, such as {@link hexToBytes} or {@link stringToBytes}. + * + * If the value is a `string`, and it is prefixed with `0x`, it will be + * interpreted as a hexadecimal string. Otherwise, it will be interpreted as a + * UTF-8 string. To convert a hexadecimal string to bytes without interpreting + * it as a UTF-8 string, use {@link hexToBytes} instead. + * + * If the value is a `bigint`, it is assumed to be unsigned. To convert a signed + * `bigint` to bytes, use {@link signedBigIntToBytes} instead. + * + * If the value is a `Uint8Array`, it will be returned as-is. + * + * @param value - The value to convert to bytes. + * @returns The bytes as `Uint8Array`. + */ +function valueToBytes(value) { + if (typeof value === 'bigint') { + return bigIntToBytes(value); + } + if (typeof value === 'number') { + return numberToBytes(value); + } + if (typeof value === 'string') { + if (value.startsWith('0x')) { + return hexToBytes(value); + } + return stringToBytes(value); + } + if (isBytes(value)) { + return value; + } + throw new TypeError(`Unsupported value type: "${typeof value}".`); +} +exports.valueToBytes = valueToBytes; +/** + * Concatenate multiple byte-like values into a single `Uint8Array`. The values + * can be `Uint8Array`, `bigint`, `number`, or `string`. This uses + * {@link valueToBytes} under the hood to convert each value to bytes. Refer to + * the documentation of that function for more information. + * + * @param values - The values to concatenate. + * @returns The concatenated bytes as `Uint8Array`. + */ +function concatBytes(values) { + const normalizedValues = new Array(values.length); + let byteLength = 0; + for (let i = 0; i < values.length; i++) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const value = valueToBytes(values[i]); + normalizedValues[i] = value; + byteLength += value.length; + } + const bytes = new Uint8Array(byteLength); + for (let i = 0, offset = 0; i < normalizedValues.length; i++) { + // While we could simply spread the values into an array and use + // `Uint8Array.from`, that is a lot slower than using `Uint8Array.set`. + bytes.set(normalizedValues[i], offset); + offset += normalizedValues[i].length; + } + return bytes; +} +exports.concatBytes = concatBytes; +/** + * Create a {@link DataView} from a {@link Uint8Array}. This is a convenience + * function that avoids having to create a {@link DataView} manually, which + * requires passing the `byteOffset` and `byteLength` parameters every time. + * + * Not passing the `byteOffset` and `byteLength` parameters can result in + * unexpected behavior when the {@link Uint8Array} is a view of a larger + * {@link ArrayBuffer}, e.g., when using {@link Uint8Array.subarray}. + * + * This function also supports Node.js {@link Buffer}s. + * + * @example + * ```typescript + * const bytes = new Uint8Array([1, 2, 3]); + * + * // This is equivalent to: + * // const dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength); + * const dataView = createDataView(bytes); + * ``` + * @param bytes - The bytes to create the {@link DataView} from. + * @returns The {@link DataView}. + */ +function createDataView(bytes) { + // To maintain compatibility with Node.js, we need to check if the bytes are + // a Buffer. If so, we need to slice the buffer to get the underlying + // ArrayBuffer. + // eslint-disable-next-line no-restricted-globals + if (typeof Buffer !== 'undefined' && bytes instanceof Buffer) { + const buffer = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength); + return new DataView(buffer); + } + return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength); +} +exports.createDataView = createDataView; +//# sourceMappingURL=bytes.cjs.map + +/***/ }), + +/***/ 87690: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.toCaipChainId = exports.parseCaipAccountId = exports.parseCaipChainId = exports.isCaipAccountAddress = exports.isCaipAccountId = exports.isCaipReference = exports.isCaipNamespace = exports.isCaipChainId = exports.KnownCaipNamespace = exports.CaipAccountAddressStruct = exports.CaipAccountIdStruct = exports.CaipReferenceStruct = exports.CaipNamespaceStruct = exports.CaipChainIdStruct = exports.CAIP_ACCOUNT_ADDRESS_REGEX = exports.CAIP_ACCOUNT_ID_REGEX = exports.CAIP_REFERENCE_REGEX = exports.CAIP_NAMESPACE_REGEX = exports.CAIP_CHAIN_ID_REGEX = void 0; +const superstruct_1 = __webpack_require__(35620); +exports.CAIP_CHAIN_ID_REGEX = /^(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})$/u; +exports.CAIP_NAMESPACE_REGEX = /^[-a-z0-9]{3,8}$/u; +exports.CAIP_REFERENCE_REGEX = /^[-_a-zA-Z0-9]{1,32}$/u; +exports.CAIP_ACCOUNT_ID_REGEX = /^(?(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})):(?[-.%a-zA-Z0-9]{1,128})$/u; +exports.CAIP_ACCOUNT_ADDRESS_REGEX = /^[-.%a-zA-Z0-9]{1,128}$/u; +/** + * A CAIP-2 chain ID, i.e., a human-readable namespace and reference. + */ +exports.CaipChainIdStruct = (0, superstruct_1.pattern)((0, superstruct_1.string)(), exports.CAIP_CHAIN_ID_REGEX); +/** + * A CAIP-2 namespace, i.e., the first part of a CAIP chain ID. + */ +exports.CaipNamespaceStruct = (0, superstruct_1.pattern)((0, superstruct_1.string)(), exports.CAIP_NAMESPACE_REGEX); +/** + * A CAIP-2 reference, i.e., the second part of a CAIP chain ID. + */ +exports.CaipReferenceStruct = (0, superstruct_1.pattern)((0, superstruct_1.string)(), exports.CAIP_REFERENCE_REGEX); +/** + * A CAIP-10 account ID, i.e., a human-readable namespace, reference, and account address. + */ +exports.CaipAccountIdStruct = (0, superstruct_1.pattern)((0, superstruct_1.string)(), exports.CAIP_ACCOUNT_ID_REGEX); +/** + * A CAIP-10 account address, i.e., the third part of the CAIP account ID. + */ +exports.CaipAccountAddressStruct = (0, superstruct_1.pattern)((0, superstruct_1.string)(), exports.CAIP_ACCOUNT_ADDRESS_REGEX); +/** Known CAIP namespaces. */ +var KnownCaipNamespace; +(function (KnownCaipNamespace) { + /** EIP-155 compatible chains. */ + KnownCaipNamespace["Eip155"] = "eip155"; + KnownCaipNamespace["Wallet"] = "wallet"; +})(KnownCaipNamespace = exports.KnownCaipNamespace || (exports.KnownCaipNamespace = {})); +/** + * Check if the given value is a {@link CaipChainId}. + * + * @param value - The value to check. + * @returns Whether the value is a {@link CaipChainId}. + */ +function isCaipChainId(value) { + return (0, superstruct_1.is)(value, exports.CaipChainIdStruct); +} +exports.isCaipChainId = isCaipChainId; +/** + * Check if the given value is a {@link CaipNamespace}. + * + * @param value - The value to check. + * @returns Whether the value is a {@link CaipNamespace}. + */ +function isCaipNamespace(value) { + return (0, superstruct_1.is)(value, exports.CaipNamespaceStruct); +} +exports.isCaipNamespace = isCaipNamespace; +/** + * Check if the given value is a {@link CaipReference}. + * + * @param value - The value to check. + * @returns Whether the value is a {@link CaipReference}. + */ +function isCaipReference(value) { + return (0, superstruct_1.is)(value, exports.CaipReferenceStruct); +} +exports.isCaipReference = isCaipReference; +/** + * Check if the given value is a {@link CaipAccountId}. + * + * @param value - The value to check. + * @returns Whether the value is a {@link CaipAccountId}. + */ +function isCaipAccountId(value) { + return (0, superstruct_1.is)(value, exports.CaipAccountIdStruct); +} +exports.isCaipAccountId = isCaipAccountId; +/** + * Check if a value is a {@link CaipAccountAddress}. + * + * @param value - The value to validate. + * @returns True if the value is a valid {@link CaipAccountAddress}. + */ +function isCaipAccountAddress(value) { + return (0, superstruct_1.is)(value, exports.CaipAccountAddressStruct); +} +exports.isCaipAccountAddress = isCaipAccountAddress; +/** + * Parse a CAIP-2 chain ID to an object containing the namespace and reference. + * This validates the CAIP-2 chain ID before parsing it. + * + * @param caipChainId - The CAIP-2 chain ID to validate and parse. + * @returns The parsed CAIP-2 chain ID. + */ +function parseCaipChainId(caipChainId) { + const match = exports.CAIP_CHAIN_ID_REGEX.exec(caipChainId); + if (!match?.groups) { + throw new Error('Invalid CAIP chain ID.'); + } + return { + namespace: match.groups.namespace, + reference: match.groups.reference, + }; +} +exports.parseCaipChainId = parseCaipChainId; +/** + * Parse an CAIP-10 account ID to an object containing the chain ID, parsed chain ID, and account address. + * This validates the CAIP-10 account ID before parsing it. + * + * @param caipAccountId - The CAIP-10 account ID to validate and parse. + * @returns The parsed CAIP-10 account ID. + */ +function parseCaipAccountId(caipAccountId) { + const match = exports.CAIP_ACCOUNT_ID_REGEX.exec(caipAccountId); + if (!match?.groups) { + throw new Error('Invalid CAIP account ID.'); + } + return { + address: match.groups.accountAddress, + chainId: match.groups.chainId, + chain: { + namespace: match.groups.namespace, + reference: match.groups.reference, + }, + }; +} +exports.parseCaipAccountId = parseCaipAccountId; +/** + * Chain ID as defined per the CAIP-2 + * {@link https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-2.md}. + * + * It defines a way to uniquely identify any blockchain in a human-readable + * way. + * + * @param namespace - The standard (ecosystem) of similar blockchains. + * @param reference - Identify of a blockchain within a given namespace. + * @throws {@link Error} + * This exception is thrown if the inputs does not comply with the CAIP-2 + * syntax specification + * {@link https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-2.md#syntax}. + * @returns A CAIP chain ID. + */ +function toCaipChainId(namespace, reference) { + if (!isCaipNamespace(namespace)) { + throw new Error(`Invalid "namespace", must match: ${exports.CAIP_NAMESPACE_REGEX.toString()}`); + } + if (!isCaipReference(reference)) { + throw new Error(`Invalid "reference", must match: ${exports.CAIP_REFERENCE_REGEX.toString()}`); + } + return `${namespace}:${reference}`; +} +exports.toCaipChainId = toCaipChainId; +//# sourceMappingURL=caip-types.cjs.map + +/***/ }), + +/***/ 98860: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ChecksumStruct = void 0; +const superstruct_1 = __webpack_require__(35620); +const base64_1 = __webpack_require__(20472); +exports.ChecksumStruct = (0, superstruct_1.size)((0, base64_1.base64)((0, superstruct_1.string)(), { paddingRequired: true }), 44, 44); +//# sourceMappingURL=checksum.cjs.map + +/***/ }), + +/***/ 65211: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createHex = exports.createBytes = exports.createBigInt = exports.createNumber = void 0; +const superstruct_1 = __webpack_require__(35620); +const assert_1 = __webpack_require__(22011); +const bytes_1 = __webpack_require__(77862); +const hex_1 = __webpack_require__(93976); +const NumberLikeStruct = (0, superstruct_1.union)([(0, superstruct_1.number)(), (0, superstruct_1.bigint)(), (0, superstruct_1.string)(), hex_1.StrictHexStruct]); +const NumberCoercer = (0, superstruct_1.coerce)((0, superstruct_1.number)(), NumberLikeStruct, Number); +const BigIntCoercer = (0, superstruct_1.coerce)((0, superstruct_1.bigint)(), NumberLikeStruct, BigInt); +const BytesLikeStruct = (0, superstruct_1.union)([hex_1.StrictHexStruct, (0, superstruct_1.instance)(Uint8Array)]); +const BytesCoercer = (0, superstruct_1.coerce)((0, superstruct_1.instance)(Uint8Array), (0, superstruct_1.union)([hex_1.StrictHexStruct]), bytes_1.hexToBytes); +const HexCoercer = (0, superstruct_1.coerce)(hex_1.StrictHexStruct, (0, superstruct_1.instance)(Uint8Array), bytes_1.bytesToHex); +/** + * Create a number from a number-like value. + * + * - If the value is a number, it is returned as-is. + * - If the value is a `bigint`, it is converted to a number. + * - If the value is a string, it is interpreted as a decimal number. + * - If the value is a hex string (i.e., it starts with "0x"), it is + * interpreted as a hexadecimal number. + * + * This validates that the value is a number-like value, and that the resulting + * number is not `NaN` or `Infinity`. + * + * @example + * ```typescript + * const value = createNumber('0x010203'); + * console.log(value); // 66051 + * + * const otherValue = createNumber(123n); + * console.log(otherValue); // 123 + * ``` + * @param value - The value to create the number from. + * @returns The created number. + * @throws If the value is not a number-like value, or if the resulting number + * is `NaN` or `Infinity`. + */ +function createNumber(value) { + try { + const result = (0, superstruct_1.create)(value, NumberCoercer); + (0, assert_1.assert)(Number.isFinite(result), `Expected a number-like value, got "${value}".`); + return result; + } + catch (error) { + if (error instanceof superstruct_1.StructError) { + throw new Error(`Expected a number-like value, got "${value}".`); + } + /* istanbul ignore next */ + throw error; + } +} +exports.createNumber = createNumber; +/** + * Create a `bigint` from a number-like value. + * + * - If the value is a number, it is converted to a `bigint`. + * - If the value is a `bigint`, it is returned as-is. + * - If the value is a string, it is interpreted as a decimal number and + * converted to a `bigint`. + * - If the value is a hex string (i.e., it starts with "0x"), it is + * interpreted as a hexadecimal number and converted to a `bigint`. + * + * @example + * ```typescript + * const value = createBigInt('0x010203'); + * console.log(value); // 16909060n + * + * const otherValue = createBigInt(123); + * console.log(otherValue); // 123n + * ``` + * @param value - The value to create the bigint from. + * @returns The created bigint. + * @throws If the value is not a number-like value. + */ +function createBigInt(value) { + try { + // The `BigInt` constructor throws if the value is not a number-like value. + // There is no need to validate the value manually. + return (0, superstruct_1.create)(value, BigIntCoercer); + } + catch (error) { + if (error instanceof superstruct_1.StructError) { + throw new Error(`Expected a number-like value, got "${String(error.value)}".`); + } + /* istanbul ignore next */ + throw error; + } +} +exports.createBigInt = createBigInt; +/** + * Create a byte array from a bytes-like value. + * + * - If the value is a byte array, it is returned as-is. + * - If the value is a hex string (i.e., it starts with "0x"), it is interpreted + * as a hexadecimal number and converted to a byte array. + * + * @example + * ```typescript + * const value = createBytes('0x010203'); + * console.log(value); // Uint8Array [ 1, 2, 3 ] + * + * const otherValue = createBytes('0x010203'); + * console.log(otherValue); // Uint8Array [ 1, 2, 3 ] + * ``` + * @param value - The value to create the byte array from. + * @returns The created byte array. + * @throws If the value is not a bytes-like value. + */ +function createBytes(value) { + if (typeof value === 'string' && value.toLowerCase() === '0x') { + return new Uint8Array(); + } + try { + return (0, superstruct_1.create)(value, BytesCoercer); + } + catch (error) { + if (error instanceof superstruct_1.StructError) { + throw new Error(`Expected a bytes-like value, got "${String(error.value)}".`); + } + /* istanbul ignore next */ + throw error; + } +} +exports.createBytes = createBytes; +/** + * Create a hexadecimal string from a bytes-like value. + * + * - If the value is a hex string (i.e., it starts with "0x"), it is returned + * as-is. + * - If the value is a `Uint8Array`, it is converted to a hex string. + * + * @example + * ```typescript + * const value = createHex(new Uint8Array([1, 2, 3])); + * console.log(value); // '0x010203' + * + * const otherValue = createHex('0x010203'); + * console.log(otherValue); // '0x010203' + * ``` + * @param value - The value to create the hex string from. + * @returns The created hex string. + * @throws If the value is not a bytes-like value. + */ +function createHex(value) { + if ((value instanceof Uint8Array && value.length === 0) || + (typeof value === 'string' && value.toLowerCase() === '0x')) { + return '0x'; + } + try { + return (0, superstruct_1.create)(value, HexCoercer); + } + catch (error) { + if (error instanceof superstruct_1.StructError) { + throw new Error(`Expected a bytes-like value, got "${String(error.value)}".`); + } + /* istanbul ignore next */ + throw error; + } +} +exports.createHex = createHex; +//# sourceMappingURL=coercers.cjs.map + +/***/ }), + +/***/ 44180: +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _FrozenMap_map, _FrozenSet_set; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.FrozenSet = exports.FrozenMap = void 0; +/** + * A {@link ReadonlyMap} that cannot be modified after instantiation. + * The implementation uses an inner map hidden via a private field, and the + * immutability guarantee relies on it being impossible to get a reference + * to this map. + */ +class FrozenMap { + get size() { + return __classPrivateFieldGet(this, _FrozenMap_map, "f").size; + } + [(_FrozenMap_map = new WeakMap(), Symbol.iterator)]() { + return __classPrivateFieldGet(this, _FrozenMap_map, "f")[Symbol.iterator](); + } + constructor(entries) { + _FrozenMap_map.set(this, void 0); + __classPrivateFieldSet(this, _FrozenMap_map, new Map(entries), "f"); + Object.freeze(this); + } + entries() { + return __classPrivateFieldGet(this, _FrozenMap_map, "f").entries(); + } + forEach(callbackfn, thisArg) { + // We have to wrap the specified callback in order to prevent it from + // receiving a reference to the inner map. + return __classPrivateFieldGet(this, _FrozenMap_map, "f").forEach((value, key, _map) => callbackfn.call(thisArg, value, key, this)); + } + get(key) { + return __classPrivateFieldGet(this, _FrozenMap_map, "f").get(key); + } + has(key) { + return __classPrivateFieldGet(this, _FrozenMap_map, "f").has(key); + } + keys() { + return __classPrivateFieldGet(this, _FrozenMap_map, "f").keys(); + } + values() { + return __classPrivateFieldGet(this, _FrozenMap_map, "f").values(); + } + toString() { + return `FrozenMap(${this.size}) {${this.size > 0 + ? ` ${[...this.entries()] + .map(([key, value]) => `${String(key)} => ${String(value)}`) + .join(', ')} ` + : ''}}`; + } +} +exports.FrozenMap = FrozenMap; +/** + * A {@link ReadonlySet} that cannot be modified after instantiation. + * The implementation uses an inner set hidden via a private field, and the + * immutability guarantee relies on it being impossible to get a reference + * to this set. + */ +class FrozenSet { + get size() { + return __classPrivateFieldGet(this, _FrozenSet_set, "f").size; + } + [(_FrozenSet_set = new WeakMap(), Symbol.iterator)]() { + return __classPrivateFieldGet(this, _FrozenSet_set, "f")[Symbol.iterator](); + } + constructor(values) { + _FrozenSet_set.set(this, void 0); + __classPrivateFieldSet(this, _FrozenSet_set, new Set(values), "f"); + Object.freeze(this); + } + entries() { + return __classPrivateFieldGet(this, _FrozenSet_set, "f").entries(); + } + forEach(callbackfn, thisArg) { + // We have to wrap the specified callback in order to prevent it from + // receiving a reference to the inner set. + return __classPrivateFieldGet(this, _FrozenSet_set, "f").forEach((value, value2, _set) => callbackfn.call(thisArg, value, value2, this)); + } + has(value) { + return __classPrivateFieldGet(this, _FrozenSet_set, "f").has(value); + } + keys() { + return __classPrivateFieldGet(this, _FrozenSet_set, "f").keys(); + } + values() { + return __classPrivateFieldGet(this, _FrozenSet_set, "f").values(); + } + toString() { + return `FrozenSet(${this.size}) {${this.size > 0 + ? ` ${[...this.values()].map((member) => String(member)).join(', ')} ` + : ''}}`; + } +} +exports.FrozenSet = FrozenSet; +Object.freeze(FrozenMap); +Object.freeze(FrozenMap.prototype); +Object.freeze(FrozenSet); +Object.freeze(FrozenSet.prototype); +//# sourceMappingURL=collections.cjs.map + +/***/ }), + +/***/ 91630: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=encryption-types.cjs.map + +/***/ }), + +/***/ 75940: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.wrapError = exports.getErrorMessage = exports.isErrorWithStack = exports.isErrorWithMessage = exports.isErrorWithCode = void 0; +const pony_cause_1 = __webpack_require__(71843); +const misc_1 = __webpack_require__(33745); +/** + * Type guard for determining whether the given value is an instance of Error. + * For errors generated via `fs.promises`, `error instanceof Error` won't work, + * so we have to come up with another way of testing. + * + * @param error - The object to check. + * @returns A boolean. + */ +function isError(error) { + return (error instanceof Error || + ((0, misc_1.isObject)(error) && error.constructor.name === 'Error')); +} +/** + * Type guard for determining whether the given value is an error object with a + * `code` property such as the type of error that Node throws for filesystem + * operations, etc. + * + * @param error - The object to check. + * @returns A boolean. + */ +function isErrorWithCode(error) { + return typeof error === 'object' && error !== null && 'code' in error; +} +exports.isErrorWithCode = isErrorWithCode; +/** + * Type guard for determining whether the given value is an error object with a + * `message` property, such as an instance of Error. + * + * @param error - The object to check. + * @returns A boolean. + */ +function isErrorWithMessage(error) { + return typeof error === 'object' && error !== null && 'message' in error; +} +exports.isErrorWithMessage = isErrorWithMessage; +/** + * Type guard for determining whether the given value is an error object with a + * `stack` property, such as an instance of Error. + * + * @param error - The object to check. + * @returns A boolean. + */ +function isErrorWithStack(error) { + return typeof error === 'object' && error !== null && 'stack' in error; +} +exports.isErrorWithStack = isErrorWithStack; +/** + * Attempts to obtain the message from a possible error object, defaulting to an + * empty string if it is impossible to do so. + * + * @param error - The possible error to get the message from. + * @returns The message if `error` is an object with a `message` property; + * the string version of `error` if it is not `undefined` or `null`; otherwise + * an empty string. + */ +function getErrorMessage(error) { + if (isErrorWithMessage(error) && typeof error.message === 'string') { + return error.message; + } + if ((0, misc_1.isNullOrUndefined)(error)) { + return ''; + } + return String(error); +} +exports.getErrorMessage = getErrorMessage; +/** + * Builds a new error object, linking it to the original error via the `cause` + * property if it is an Error. + * + * This function is useful to reframe error messages in general, but is + * _critical_ when interacting with any of Node's filesystem functions as + * provided via `fs.promises`, because these do not produce stack traces in the + * case of an I/O error (see ). + * + * @param originalError - The error to be wrapped (something throwable). + * @param message - The desired message of the new error. + * @returns A new error object. + */ +function wrapError(originalError, message) { + if (isError(originalError)) { + let error; + if (Error.length === 2) { + // for some reason `tsserver` is not complaining that the + // Error constructor doesn't support a second argument in the editor, + // but `tsc` does. Error causes are not supported by our current tsc target (ES2020, we need ES2022 to make this work) + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + error = new Error(message, { cause: originalError }); + } + else { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + error = new pony_cause_1.ErrorWithCause(message, { cause: originalError }); + } + if (isErrorWithCode(originalError)) { + error.code = originalError.code; + } + return error; + } + if (message.length > 0) { + return new Error(`${String(originalError)}: ${message}`); + } + return new Error(String(originalError)); +} +exports.wrapError = wrapError; +//# sourceMappingURL=errors.cjs.map + +/***/ }), + +/***/ 93976: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.remove0x = exports.add0x = exports.isValidChecksumAddress = exports.getChecksumAddress = exports.isValidHexAddress = exports.assertIsStrictHexString = exports.assertIsHexString = exports.isStrictHexString = exports.isHexString = exports.HexChecksumAddressStruct = exports.HexAddressStruct = exports.StrictHexStruct = exports.HexStruct = void 0; +const superstruct_1 = __webpack_require__(35620); +const sha3_1 = __webpack_require__(32955); +const assert_1 = __webpack_require__(22011); +const bytes_1 = __webpack_require__(77862); +exports.HexStruct = (0, superstruct_1.pattern)((0, superstruct_1.string)(), /^(?:0x)?[0-9a-f]+$/iu); +exports.StrictHexStruct = (0, superstruct_1.pattern)((0, superstruct_1.string)(), /^0x[0-9a-f]+$/iu); +exports.HexAddressStruct = (0, superstruct_1.pattern)((0, superstruct_1.string)(), /^0x[0-9a-f]{40}$/u); +exports.HexChecksumAddressStruct = (0, superstruct_1.pattern)((0, superstruct_1.string)(), /^0x[0-9a-fA-F]{40}$/u); +/** + * Check if a string is a valid hex string. + * + * @param value - The value to check. + * @returns Whether the value is a valid hex string. + */ +function isHexString(value) { + return (0, superstruct_1.is)(value, exports.HexStruct); +} +exports.isHexString = isHexString; +/** + * Strictly check if a string is a valid hex string. A valid hex string must + * start with the "0x"-prefix. + * + * @param value - The value to check. + * @returns Whether the value is a valid hex string. + */ +function isStrictHexString(value) { + return (0, superstruct_1.is)(value, exports.StrictHexStruct); +} +exports.isStrictHexString = isStrictHexString; +/** + * Assert that a value is a valid hex string. + * + * @param value - The value to check. + * @throws If the value is not a valid hex string. + */ +function assertIsHexString(value) { + (0, assert_1.assert)(isHexString(value), 'Value must be a hexadecimal string.'); +} +exports.assertIsHexString = assertIsHexString; +/** + * Assert that a value is a valid hex string. A valid hex string must start with + * the "0x"-prefix. + * + * @param value - The value to check. + * @throws If the value is not a valid hex string. + */ +function assertIsStrictHexString(value) { + (0, assert_1.assert)(isStrictHexString(value), 'Value must be a hexadecimal string, starting with "0x".'); +} +exports.assertIsStrictHexString = assertIsStrictHexString; +/** + * Validate that the passed prefixed hex string is an all-lowercase + * hex address, or a valid mixed-case checksum address. + * + * @param possibleAddress - Input parameter to check against. + * @returns Whether or not the input is a valid hex address. + */ +function isValidHexAddress(possibleAddress) { + return ((0, superstruct_1.is)(possibleAddress, exports.HexAddressStruct) || + isValidChecksumAddress(possibleAddress)); +} +exports.isValidHexAddress = isValidHexAddress; +/** + * Encode a passed hex string as an ERC-55 mixed-case checksum address. + * + * @param address - The hex address to encode. + * @returns The address encoded according to ERC-55. + * @see https://eips.ethereum.org/EIPS/eip-55 + */ +function getChecksumAddress(address) { + (0, assert_1.assert)((0, superstruct_1.is)(address, exports.HexChecksumAddressStruct), 'Invalid hex address.'); + const unPrefixed = remove0x(address.toLowerCase()); + const unPrefixedHash = remove0x((0, bytes_1.bytesToHex)((0, sha3_1.keccak_256)(unPrefixed))); + return `0x${unPrefixed + .split('') + .map((character, nibbleIndex) => { + const hashCharacter = unPrefixedHash[nibbleIndex]; + (0, assert_1.assert)((0, superstruct_1.is)(hashCharacter, (0, superstruct_1.string)()), 'Hash shorter than address.'); + return parseInt(hashCharacter, 16) > 7 + ? character.toUpperCase() + : character; + }) + .join('')}`; +} +exports.getChecksumAddress = getChecksumAddress; +/** + * Validate that the passed hex string is a valid ERC-55 mixed-case + * checksum address. + * + * @param possibleChecksum - The hex address to check. + * @returns True if the address is a checksum address. + */ +function isValidChecksumAddress(possibleChecksum) { + if (!(0, superstruct_1.is)(possibleChecksum, exports.HexChecksumAddressStruct)) { + return false; + } + return getChecksumAddress(possibleChecksum) === possibleChecksum; +} +exports.isValidChecksumAddress = isValidChecksumAddress; +/** + * Add the `0x`-prefix to a hexadecimal string. If the string already has the + * prefix, it is returned as-is. + * + * @param hexadecimal - The hexadecimal string to add the prefix to. + * @returns The prefixed hexadecimal string. + */ +function add0x(hexadecimal) { + if (hexadecimal.startsWith('0x')) { + return hexadecimal; + } + if (hexadecimal.startsWith('0X')) { + return `0x${hexadecimal.substring(2)}`; + } + return `0x${hexadecimal}`; +} +exports.add0x = add0x; +/** + * Remove the `0x`-prefix from a hexadecimal string. If the string doesn't have + * the prefix, it is returned as-is. + * + * @param hexadecimal - The hexadecimal string to remove the prefix from. + * @returns The un-prefixed hexadecimal string. + */ +function remove0x(hexadecimal) { + if (hexadecimal.startsWith('0x') || hexadecimal.startsWith('0X')) { + return hexadecimal.substring(2); + } + return hexadecimal; +} +exports.remove0x = remove0x; +//# sourceMappingURL=hex.cjs.map + +/***/ }), + +/***/ 52367: +/***/ (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 })); +__exportStar(__webpack_require__(22011), exports); +__exportStar(__webpack_require__(20472), exports); +__exportStar(__webpack_require__(77862), exports); +__exportStar(__webpack_require__(87690), exports); +__exportStar(__webpack_require__(98860), exports); +__exportStar(__webpack_require__(65211), exports); +__exportStar(__webpack_require__(44180), exports); +__exportStar(__webpack_require__(91630), exports); +__exportStar(__webpack_require__(75940), exports); +__exportStar(__webpack_require__(93976), exports); +__exportStar(__webpack_require__(60087), exports); +__exportStar(__webpack_require__(24956), exports); +__exportStar(__webpack_require__(98912), exports); +__exportStar(__webpack_require__(33745), exports); +__exportStar(__webpack_require__(5770), exports); +__exportStar(__webpack_require__(3028), exports); +__exportStar(__webpack_require__(2812), exports); +__exportStar(__webpack_require__(32954), exports); +__exportStar(__webpack_require__(16871), exports); +__exportStar(__webpack_require__(49266), exports); +//# sourceMappingURL=index.cjs.map + +/***/ }), + +/***/ 60087: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getJsonRpcIdValidator = exports.assertIsJsonRpcError = exports.isJsonRpcError = exports.assertIsJsonRpcFailure = exports.isJsonRpcFailure = exports.assertIsJsonRpcSuccess = exports.isJsonRpcSuccess = exports.assertIsJsonRpcResponse = exports.isJsonRpcResponse = exports.assertIsPendingJsonRpcResponse = exports.isPendingJsonRpcResponse = exports.JsonRpcResponseStruct = exports.JsonRpcFailureStruct = exports.JsonRpcSuccessStruct = exports.PendingJsonRpcResponseStruct = exports.assertIsJsonRpcRequest = exports.isJsonRpcRequest = exports.assertIsJsonRpcNotification = exports.isJsonRpcNotification = exports.JsonRpcNotificationStruct = exports.JsonRpcRequestStruct = exports.JsonRpcParamsStruct = exports.JsonRpcErrorStruct = exports.JsonRpcIdStruct = exports.JsonRpcVersionStruct = exports.jsonrpc2 = exports.getJsonSize = exports.getSafeJson = exports.isValidJson = exports.JsonStruct = exports.UnsafeJsonStruct = exports.exactOptional = exports.object = void 0; +const superstruct_1 = __webpack_require__(35620); +const assert_1 = __webpack_require__(22011); +const misc_1 = __webpack_require__(33745); +/** + * A struct to check if the given value is a valid object, with support for + * {@link exactOptional} types. + * + * @param schema - The schema of the object. + * @returns A struct to check if the given value is an object. + */ +const object = (schema) => +// The type is slightly different from a regular object struct, because we +// want to make properties with `undefined` in their type optional, but not +// `undefined` itself. This means that we need a type cast. +(0, superstruct_1.object)(schema); +exports.object = object; +/** + * Check the last field of a path is present. + * + * @param context - The context to check. + * @param context.path - The path to check. + * @param context.branch - The branch to check. + * @returns Whether the last field of a path is present. + */ +function hasOptional({ path, branch }) { + const field = path[path.length - 1]; + return (0, misc_1.hasProperty)(branch[branch.length - 2], field); +} +/** + * A struct which allows the property of an object to be absent, or to be present + * as long as it's valid and not set to `undefined`. + * + * This struct should be used in conjunction with the {@link object} from this + * library, to get proper type inference. + * + * @param struct - The struct to check the value against, if present. + * @returns A struct to check if the given value is valid, or not present. + * @example + * ```ts + * const struct = object({ + * foo: exactOptional(string()), + * bar: exactOptional(number()), + * baz: optional(boolean()), + * qux: unknown(), + * }); + * + * type Type = Infer; + * // Type is equivalent to: + * // { + * // foo?: string; + * // bar?: number; + * // baz?: boolean | undefined; + * // qux: unknown; + * // } + * ``` + */ +function exactOptional(struct) { + return new superstruct_1.Struct({ + ...struct, + type: `optional ${struct.type}`, + validator: (value, context) => !hasOptional(context) || struct.validator(value, context), + refiner: (value, context) => !hasOptional(context) || struct.refiner(value, context), + }); +} +exports.exactOptional = exactOptional; +/** + * A struct to check if the given value is finite number. Superstruct's + * `number()` struct does not check if the value is finite. + * + * @returns A struct to check if the given value is finite number. + */ +const finiteNumber = () => (0, superstruct_1.define)('finite number', (value) => { + return (0, superstruct_1.is)(value, (0, superstruct_1.number)()) && Number.isFinite(value); +}); +/** + * A struct to check if the given value is a valid JSON-serializable value. + * + * Note that this struct is unsafe. For safe validation, use {@link JsonStruct}. + */ +// We cannot infer the type of the struct, because it is recursive. +exports.UnsafeJsonStruct = (0, superstruct_1.union)([ + (0, superstruct_1.literal)(null), + (0, superstruct_1.boolean)(), + finiteNumber(), + (0, superstruct_1.string)(), + (0, superstruct_1.array)((0, superstruct_1.lazy)(() => exports.UnsafeJsonStruct)), + (0, superstruct_1.record)((0, superstruct_1.string)(), (0, superstruct_1.lazy)(() => exports.UnsafeJsonStruct)), +]); +/** + * A struct to check if the given value is a valid JSON-serializable value. + * + * This struct sanitizes the value before validating it, so that it is safe to + * use with untrusted input. + */ +exports.JsonStruct = (0, superstruct_1.coerce)(exports.UnsafeJsonStruct, (0, superstruct_1.any)(), (value) => { + (0, assert_1.assertStruct)(value, exports.UnsafeJsonStruct); + return JSON.parse(JSON.stringify(value, (propKey, propValue) => { + // Strip __proto__ and constructor properties to prevent prototype pollution. + if (propKey === '__proto__' || propKey === 'constructor') { + return undefined; + } + return propValue; + })); +}); +/** + * Check if the given value is a valid {@link Json} value, i.e., a value that is + * serializable to JSON. + * + * @param value - The value to check. + * @returns Whether the value is a valid {@link Json} value. + */ +function isValidJson(value) { + try { + getSafeJson(value); + return true; + } + catch { + return false; + } +} +exports.isValidJson = isValidJson; +/** + * Validate and return sanitized JSON. + * + * Note: + * This function uses sanitized JsonStruct for validation + * that applies stringify and then parse of a value provided + * to ensure that there are no getters which can have side effects + * that can cause security issues. + * + * @param value - JSON structure to be processed. + * @returns Sanitized JSON structure. + */ +function getSafeJson(value) { + return (0, superstruct_1.create)(value, exports.JsonStruct); +} +exports.getSafeJson = getSafeJson; +/** + * Get the size of a JSON value in bytes. This also validates the value. + * + * @param value - The JSON value to get the size of. + * @returns The size of the JSON value in bytes. + */ +function getJsonSize(value) { + (0, assert_1.assertStruct)(value, exports.JsonStruct, 'Invalid JSON value'); + const json = JSON.stringify(value); + return new TextEncoder().encode(json).byteLength; +} +exports.getJsonSize = getJsonSize; +/** + * The string '2.0'. + */ +exports.jsonrpc2 = '2.0'; +exports.JsonRpcVersionStruct = (0, superstruct_1.literal)(exports.jsonrpc2); +exports.JsonRpcIdStruct = (0, superstruct_1.nullable)((0, superstruct_1.union)([(0, superstruct_1.number)(), (0, superstruct_1.string)()])); +exports.JsonRpcErrorStruct = (0, exports.object)({ + code: (0, superstruct_1.integer)(), + message: (0, superstruct_1.string)(), + data: exactOptional(exports.JsonStruct), + stack: exactOptional((0, superstruct_1.string)()), +}); +exports.JsonRpcParamsStruct = (0, superstruct_1.union)([(0, superstruct_1.record)((0, superstruct_1.string)(), exports.JsonStruct), (0, superstruct_1.array)(exports.JsonStruct)]); +exports.JsonRpcRequestStruct = (0, exports.object)({ + id: exports.JsonRpcIdStruct, + jsonrpc: exports.JsonRpcVersionStruct, + method: (0, superstruct_1.string)(), + params: exactOptional(exports.JsonRpcParamsStruct), +}); +exports.JsonRpcNotificationStruct = (0, exports.object)({ + jsonrpc: exports.JsonRpcVersionStruct, + method: (0, superstruct_1.string)(), + params: exactOptional(exports.JsonRpcParamsStruct), +}); +/** + * Check if the given value is a valid {@link JsonRpcNotification} object. + * + * @param value - The value to check. + * @returns Whether the given value is a valid {@link JsonRpcNotification} + * object. + */ +function isJsonRpcNotification(value) { + return (0, superstruct_1.is)(value, exports.JsonRpcNotificationStruct); +} +exports.isJsonRpcNotification = isJsonRpcNotification; +/** + * Assert that the given value is a valid {@link JsonRpcNotification} object. + * + * @param value - The value to check. + * @param ErrorWrapper - The error class to throw if the assertion fails. + * Defaults to {@link AssertionError}. + * @throws If the given value is not a valid {@link JsonRpcNotification} object. + */ +function assertIsJsonRpcNotification(value, +// eslint-disable-next-line @typescript-eslint/naming-convention +ErrorWrapper) { + (0, assert_1.assertStruct)(value, exports.JsonRpcNotificationStruct, 'Invalid JSON-RPC notification', ErrorWrapper); +} +exports.assertIsJsonRpcNotification = assertIsJsonRpcNotification; +/** + * Check if the given value is a valid {@link JsonRpcRequest} object. + * + * @param value - The value to check. + * @returns Whether the given value is a valid {@link JsonRpcRequest} object. + */ +function isJsonRpcRequest(value) { + return (0, superstruct_1.is)(value, exports.JsonRpcRequestStruct); +} +exports.isJsonRpcRequest = isJsonRpcRequest; +/** + * Assert that the given value is a valid {@link JsonRpcRequest} object. + * + * @param value - The JSON-RPC request or notification to check. + * @param ErrorWrapper - The error class to throw if the assertion fails. + * Defaults to {@link AssertionError}. + * @throws If the given value is not a valid {@link JsonRpcRequest} object. + */ +function assertIsJsonRpcRequest(value, +// eslint-disable-next-line @typescript-eslint/naming-convention +ErrorWrapper) { + (0, assert_1.assertStruct)(value, exports.JsonRpcRequestStruct, 'Invalid JSON-RPC request', ErrorWrapper); +} +exports.assertIsJsonRpcRequest = assertIsJsonRpcRequest; +exports.PendingJsonRpcResponseStruct = (0, superstruct_1.object)({ + id: exports.JsonRpcIdStruct, + jsonrpc: exports.JsonRpcVersionStruct, + result: (0, superstruct_1.optional)((0, superstruct_1.unknown)()), + error: (0, superstruct_1.optional)(exports.JsonRpcErrorStruct), +}); +exports.JsonRpcSuccessStruct = (0, exports.object)({ + id: exports.JsonRpcIdStruct, + jsonrpc: exports.JsonRpcVersionStruct, + result: exports.JsonStruct, +}); +exports.JsonRpcFailureStruct = (0, exports.object)({ + id: exports.JsonRpcIdStruct, + jsonrpc: exports.JsonRpcVersionStruct, + error: exports.JsonRpcErrorStruct, +}); +exports.JsonRpcResponseStruct = (0, superstruct_1.union)([ + exports.JsonRpcSuccessStruct, + exports.JsonRpcFailureStruct, +]); +/** + * Type guard to check whether specified JSON-RPC response is a + * {@link PendingJsonRpcResponse}. + * + * @param response - The JSON-RPC response to check. + * @returns Whether the specified JSON-RPC response is pending. + */ +function isPendingJsonRpcResponse(response) { + return (0, superstruct_1.is)(response, exports.PendingJsonRpcResponseStruct); +} +exports.isPendingJsonRpcResponse = isPendingJsonRpcResponse; +/** + * Assert that the given value is a valid {@link PendingJsonRpcResponse} object. + * + * @param response - The JSON-RPC response to check. + * @param ErrorWrapper - The error class to throw if the assertion fails. + * Defaults to {@link AssertionError}. + * @throws If the given value is not a valid {@link PendingJsonRpcResponse} + * object. + */ +function assertIsPendingJsonRpcResponse(response, +// eslint-disable-next-line @typescript-eslint/naming-convention +ErrorWrapper) { + (0, assert_1.assertStruct)(response, exports.PendingJsonRpcResponseStruct, 'Invalid pending JSON-RPC response', ErrorWrapper); +} +exports.assertIsPendingJsonRpcResponse = assertIsPendingJsonRpcResponse; +/** + * Type guard to check if a value is a {@link JsonRpcResponse}. + * + * @param response - The object to check. + * @returns Whether the object is a JsonRpcResponse. + */ +function isJsonRpcResponse(response) { + return (0, superstruct_1.is)(response, exports.JsonRpcResponseStruct); +} +exports.isJsonRpcResponse = isJsonRpcResponse; +/** + * Assert that the given value is a valid {@link JsonRpcResponse} object. + * + * @param value - The value to check. + * @param ErrorWrapper - The error class to throw if the assertion fails. + * Defaults to {@link AssertionError}. + * @throws If the given value is not a valid {@link JsonRpcResponse} object. + */ +function assertIsJsonRpcResponse(value, +// eslint-disable-next-line @typescript-eslint/naming-convention +ErrorWrapper) { + (0, assert_1.assertStruct)(value, exports.JsonRpcResponseStruct, 'Invalid JSON-RPC response', ErrorWrapper); +} +exports.assertIsJsonRpcResponse = assertIsJsonRpcResponse; +/** + * Check if the given value is a valid {@link JsonRpcSuccess} object. + * + * @param value - The value to check. + * @returns Whether the given value is a valid {@link JsonRpcSuccess} object. + */ +function isJsonRpcSuccess(value) { + return (0, superstruct_1.is)(value, exports.JsonRpcSuccessStruct); +} +exports.isJsonRpcSuccess = isJsonRpcSuccess; +/** + * Assert that the given value is a valid {@link JsonRpcSuccess} object. + * + * @param value - The value to check. + * @param ErrorWrapper - The error class to throw if the assertion fails. + * Defaults to {@link AssertionError}. + * @throws If the given value is not a valid {@link JsonRpcSuccess} object. + */ +function assertIsJsonRpcSuccess(value, +// eslint-disable-next-line @typescript-eslint/naming-convention +ErrorWrapper) { + (0, assert_1.assertStruct)(value, exports.JsonRpcSuccessStruct, 'Invalid JSON-RPC success response', ErrorWrapper); +} +exports.assertIsJsonRpcSuccess = assertIsJsonRpcSuccess; +/** + * Check if the given value is a valid {@link JsonRpcFailure} object. + * + * @param value - The value to check. + * @returns Whether the given value is a valid {@link JsonRpcFailure} object. + */ +function isJsonRpcFailure(value) { + return (0, superstruct_1.is)(value, exports.JsonRpcFailureStruct); +} +exports.isJsonRpcFailure = isJsonRpcFailure; +/** + * Assert that the given value is a valid {@link JsonRpcFailure} object. + * + * @param value - The value to check. + * @param ErrorWrapper - The error class to throw if the assertion fails. + * Defaults to {@link AssertionError}. + * @throws If the given value is not a valid {@link JsonRpcFailure} object. + */ +function assertIsJsonRpcFailure(value, +// eslint-disable-next-line @typescript-eslint/naming-convention +ErrorWrapper) { + (0, assert_1.assertStruct)(value, exports.JsonRpcFailureStruct, 'Invalid JSON-RPC failure response', ErrorWrapper); +} +exports.assertIsJsonRpcFailure = assertIsJsonRpcFailure; +/** + * Check if the given value is a valid {@link JsonRpcError} object. + * + * @param value - The value to check. + * @returns Whether the given value is a valid {@link JsonRpcError} object. + */ +function isJsonRpcError(value) { + return (0, superstruct_1.is)(value, exports.JsonRpcErrorStruct); +} +exports.isJsonRpcError = isJsonRpcError; +/** + * Assert that the given value is a valid {@link JsonRpcError} object. + * + * @param value - The value to check. + * @param ErrorWrapper - The error class to throw if the assertion fails. + * Defaults to {@link AssertionError}. + * @throws If the given value is not a valid {@link JsonRpcError} object. + */ +function assertIsJsonRpcError(value, +// eslint-disable-next-line @typescript-eslint/naming-convention +ErrorWrapper) { + (0, assert_1.assertStruct)(value, exports.JsonRpcErrorStruct, 'Invalid JSON-RPC error', ErrorWrapper); +} +exports.assertIsJsonRpcError = assertIsJsonRpcError; +/** + * Gets a function for validating JSON-RPC request / response `id` values. + * + * By manipulating the options of this factory, you can control the behavior + * of the resulting validator for some edge cases. This is useful because e.g. + * `null` should sometimes but not always be permitted. + * + * Note that the empty string (`''`) is always permitted by the JSON-RPC + * specification, but that kind of sucks and you may want to forbid it in some + * instances anyway. + * + * For more details, see the + * [JSON-RPC Specification](https://www.jsonrpc.org/specification). + * + * @param options - An options object. + * @param options.permitEmptyString - Whether the empty string (i.e. `''`) + * should be treated as a valid ID. Default: `true` + * @param options.permitFractions - Whether fractional numbers (e.g. `1.2`) + * should be treated as valid IDs. Default: `false` + * @param options.permitNull - Whether `null` should be treated as a valid ID. + * Default: `true` + * @returns The JSON-RPC ID validator function. + */ +function getJsonRpcIdValidator(options) { + const { permitEmptyString, permitFractions, permitNull } = { + permitEmptyString: true, + permitFractions: false, + permitNull: true, + ...options, + }; + /** + * Type guard for {@link JsonRpcId}. + * + * @param id - The JSON-RPC ID value to check. + * @returns Whether the given ID is valid per the options given to the + * factory. + */ + const isValidJsonRpcId = (id) => { + return Boolean((typeof id === 'number' && (permitFractions || Number.isInteger(id))) || + (typeof id === 'string' && (permitEmptyString || id.length > 0)) || + (permitNull && id === null)); + }; + return isValidJsonRpcId; +} +exports.getJsonRpcIdValidator = getJsonRpcIdValidator; +//# sourceMappingURL=json.cjs.map + +/***/ }), + +/***/ 24956: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=keyring.cjs.map + +/***/ }), + +/***/ 98912: +/***/ (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.createModuleLogger = exports.createProjectLogger = void 0; +const debug_1 = __importDefault(__webpack_require__(17833)); +const globalLogger = (0, debug_1.default)('metamask'); +/** + * Creates a logger via the `debug` library whose log messages will be tagged + * using the name of your project. By default, such messages will be + * suppressed, but you can reveal them by setting the `DEBUG` environment + * variable to `metamask:`. You can also set this variable to + * `metamask:*` if you want to see log messages from all MetaMask projects that + * are also using this function to create their loggers. + * + * @param projectName - The name of your project. This should be the name of + * your NPM package if you're developing one. + * @returns An instance of `debug`. + */ +function createProjectLogger(projectName) { + return globalLogger.extend(projectName); +} +exports.createProjectLogger = createProjectLogger; +/** + * Creates a logger via the `debug` library which is derived from the logger for + * the whole project whose log messages will be tagged using the name of your + * module. By default, such messages will be suppressed, but you can reveal them + * by setting the `DEBUG` environment variable to + * `metamask::`. You can also set this variable to + * `metamask::*` if you want to see log messages from the project, + * or `metamask:*` if you want to see log messages from all MetaMask projects. + * + * @param projectLogger - The logger created via {@link createProjectLogger}. + * @param moduleName - The name of your module. You could use the name of the + * file where you're using this logger or some other name. + * @returns An instance of `debug`. + */ +function createModuleLogger(projectLogger, moduleName) { + return projectLogger.extend(moduleName); +} +exports.createModuleLogger = createModuleLogger; +//# sourceMappingURL=logging.cjs.map + +/***/ }), + +/***/ 33745: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// +// Types +// +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.calculateNumberSize = exports.calculateStringSize = exports.isASCII = exports.isPlainObject = exports.ESCAPE_CHARACTERS_REGEXP = exports.JsonSize = exports.getKnownPropertyNames = exports.hasProperty = exports.isObject = exports.isNullOrUndefined = exports.isNonEmptyArray = void 0; +// +// Type Guards +// +/** + * A {@link NonEmptyArray} type guard. + * + * @template Element - The non-empty array member type. + * @param value - The value to check. + * @returns Whether the value is a non-empty array. + */ +function isNonEmptyArray(value) { + return Array.isArray(value) && value.length > 0; +} +exports.isNonEmptyArray = isNonEmptyArray; +/** + * Type guard for "nullishness". + * + * @param value - Any value. + * @returns `true` if the value is null or undefined, `false` otherwise. + */ +function isNullOrUndefined(value) { + return value === null || value === undefined; +} +exports.isNullOrUndefined = isNullOrUndefined; +/** + * A type guard for {@link RuntimeObject}. + * + * @param value - The value to check. + * @returns Whether the specified value has a runtime type of `object` and is + * neither `null` nor an `Array`. + */ +function isObject(value) { + return Boolean(value) && typeof value === 'object' && !Array.isArray(value); +} +exports.isObject = isObject; +// +// Other utility functions +// +/** + * A type guard for ensuring an object has a property. + * + * @param objectToCheck - The object to check. + * @param name - The property name to check for. + * @returns Whether the specified object has an own property with the specified + * name, regardless of whether it is enumerable or not. + */ +const hasProperty = (objectToCheck, name) => Object.hasOwnProperty.call(objectToCheck, name); +exports.hasProperty = hasProperty; +/** + * `Object.getOwnPropertyNames()` is intentionally generic: it returns the + * immediate property names of an object, but it cannot make guarantees about + * the contents of that object, so the type of the property names is merely + * `string[]`. While this is technically accurate, it is also unnecessary if we + * have an object with a type that we own (such as an enum). + * + * @param object - The plain object. + * @returns The own property names of the object which are assigned a type + * derived from the object itself. + */ +function getKnownPropertyNames(object) { + return Object.getOwnPropertyNames(object); +} +exports.getKnownPropertyNames = getKnownPropertyNames; +/** + * Predefined sizes (in Bytes) of specific parts of JSON structure. + */ +var JsonSize; +(function (JsonSize) { + JsonSize[JsonSize["Null"] = 4] = "Null"; + JsonSize[JsonSize["Comma"] = 1] = "Comma"; + JsonSize[JsonSize["Wrapper"] = 1] = "Wrapper"; + JsonSize[JsonSize["True"] = 4] = "True"; + JsonSize[JsonSize["False"] = 5] = "False"; + JsonSize[JsonSize["Quote"] = 1] = "Quote"; + JsonSize[JsonSize["Colon"] = 1] = "Colon"; + // eslint-disable-next-line @typescript-eslint/no-shadow + JsonSize[JsonSize["Date"] = 24] = "Date"; +})(JsonSize = exports.JsonSize || (exports.JsonSize = {})); +/** + * Regular expression with pattern matching for (special) escaped characters. + */ +exports.ESCAPE_CHARACTERS_REGEXP = /"|\\|\n|\r|\t/gu; +/** + * Check if the value is plain object. + * + * @param value - Value to be checked. + * @returns True if an object is the plain JavaScript object, + * false if the object is not plain (e.g. function). + */ +function isPlainObject(value) { + if (typeof value !== 'object' || value === null) { + return false; + } + try { + let proto = value; + while (Object.getPrototypeOf(proto) !== null) { + proto = Object.getPrototypeOf(proto); + } + return Object.getPrototypeOf(value) === proto; + } + catch (_) { + return false; + } +} +exports.isPlainObject = isPlainObject; +/** + * Check if character is ASCII. + * + * @param character - Character. + * @returns True if a character code is ASCII, false if not. + */ +function isASCII(character) { + return character.charCodeAt(0) <= 127; +} +exports.isASCII = isASCII; +/** + * Calculate string size. + * + * @param value - String value to calculate size. + * @returns Number of bytes used to store whole string value. + */ +function calculateStringSize(value) { + const size = value.split('').reduce((total, character) => { + if (isASCII(character)) { + return total + 1; + } + return total + 2; + }, 0); + // Also detect characters that need backslash escape + return size + (value.match(exports.ESCAPE_CHARACTERS_REGEXP) ?? []).length; +} +exports.calculateStringSize = calculateStringSize; +/** + * Calculate size of a number ofter JSON serialization. + * + * @param value - Number value to calculate size. + * @returns Number of bytes used to store whole number in JSON. + */ +function calculateNumberSize(value) { + return value.toString().length; +} +exports.calculateNumberSize = calculateNumberSize; +//# sourceMappingURL=misc.cjs.map + +/***/ }), + +/***/ 5770: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.hexToBigInt = exports.hexToNumber = exports.bigIntToHex = exports.numberToHex = void 0; +const assert_1 = __webpack_require__(22011); +const hex_1 = __webpack_require__(93976); +/** + * Convert a number to a hexadecimal string. This verifies that the number is a + * non-negative safe integer. + * + * To convert a `bigint` to a hexadecimal string instead, use + * {@link bigIntToHex}. + * + * @example + * ```typescript + * numberToHex(0); // '0x0' + * numberToHex(1); // '0x1' + * numberToHex(16); // '0x10' + * ``` + * @param value - The number to convert to a hexadecimal string. + * @returns The hexadecimal string, with the "0x"-prefix. + * @throws If the number is not a non-negative safe integer. + */ +const numberToHex = (value) => { + (0, assert_1.assert)(typeof value === 'number', 'Value must be a number.'); + (0, assert_1.assert)(value >= 0, 'Value must be a non-negative number.'); + (0, assert_1.assert)(Number.isSafeInteger(value), 'Value is not a safe integer. Use `bigIntToHex` instead.'); + return (0, hex_1.add0x)(value.toString(16)); +}; +exports.numberToHex = numberToHex; +/** + * Convert a `bigint` to a hexadecimal string. This verifies that the `bigint` + * is a non-negative integer. + * + * To convert a number to a hexadecimal string instead, use {@link numberToHex}. + * + * @example + * ```typescript + * bigIntToHex(0n); // '0x0' + * bigIntToHex(1n); // '0x1' + * bigIntToHex(16n); // '0x10' + * ``` + * @param value - The `bigint` to convert to a hexadecimal string. + * @returns The hexadecimal string, with the "0x"-prefix. + * @throws If the `bigint` is not a non-negative integer. + */ +const bigIntToHex = (value) => { + (0, assert_1.assert)(typeof value === 'bigint', 'Value must be a bigint.'); + (0, assert_1.assert)(value >= 0, 'Value must be a non-negative bigint.'); + return (0, hex_1.add0x)(value.toString(16)); +}; +exports.bigIntToHex = bigIntToHex; +/** + * Convert a hexadecimal string to a number. This verifies that the string is a + * valid hex string, and that the resulting number is a safe integer. Both + * "0x"-prefixed and unprefixed strings are supported. + * + * To convert a hexadecimal string to a `bigint` instead, use + * {@link hexToBigInt}. + * + * @example + * ```typescript + * hexToNumber('0x0'); // 0 + * hexToNumber('0x1'); // 1 + * hexToNumber('0x10'); // 16 + * ``` + * @param value - The hexadecimal string to convert to a number. + * @returns The number. + * @throws If the value is not a valid hexadecimal string, or if the resulting + * number is not a safe integer. + */ +const hexToNumber = (value) => { + (0, hex_1.assertIsHexString)(value); + // `parseInt` accepts values without the "0x"-prefix, whereas `Number` does + // not. Using this is slightly faster than `Number(add0x(value))`. + const numberValue = parseInt(value, 16); + (0, assert_1.assert)(Number.isSafeInteger(numberValue), 'Value is not a safe integer. Use `hexToBigInt` instead.'); + return numberValue; +}; +exports.hexToNumber = hexToNumber; +/** + * Convert a hexadecimal string to a `bigint`. This verifies that the string is + * a valid hex string. Both "0x"-prefixed and unprefixed strings are supported. + * + * To convert a hexadecimal string to a number instead, use {@link hexToNumber}. + * + * @example + * ```typescript + * hexToBigInt('0x0'); // 0n + * hexToBigInt('0x1'); // 1n + * hexToBigInt('0x10'); // 16n + * ``` + * @param value - The hexadecimal string to convert to a `bigint`. + * @returns The `bigint`. + * @throws If the value is not a valid hexadecimal string. + */ +const hexToBigInt = (value) => { + (0, hex_1.assertIsHexString)(value); + // The `BigInt` constructor requires the "0x"-prefix to parse a hex string. + return BigInt((0, hex_1.add0x)(value)); +}; +exports.hexToBigInt = hexToBigInt; +//# sourceMappingURL=number.cjs.map + +/***/ }), + +/***/ 3028: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=opaque.cjs.map + +/***/ }), + +/***/ 2812: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createDeferredPromise = void 0; +/** + * Create a defered Promise. + * + * If the Promise is rejected prior to a handler being added, this can result in an + * `UnhandledPromiseRejection` error. Optionally this can be suppressed with the + * `suppressUnhandledRejection` flag, as it's common to belatedly handle deferred Promises, or to + * ignore them if they're no longer relevant (e.g. related to a cancelled request). + * + * However, be very careful that you have handled the Promise if you do this. Suppressing these + * errors is dangerous, they exist for good reason. An unhandled rejection can hide errors, making + * debugging extremely difficult. They should only be suppressed if you're confident that the + * Promise is always handled correctly, in both the success and failure cases. + * + * @param args - The arguments. + * @param args.suppressUnhandledRejection - This option adds an empty error handler + * to the Promise to suppress the UnhandledPromiseRejection error. This can be + * useful if the deferred Promise is sometimes intentionally not used. + * @returns A deferred Promise. + * @template Result - The result type of the Promise. + */ +function createDeferredPromise({ suppressUnhandledRejection = false, } = {}) { + let resolve; + let reject; + const promise = new Promise((innerResolve, innerReject) => { + resolve = innerResolve; + reject = innerReject; + }); + if (suppressUnhandledRejection) { + promise.catch((_error) => { + // This handler is used to suppress the UnhandledPromiseRejection error + }); + } + // @ts-expect-error We know that these are assigned, but TypeScript doesn't + return { promise, resolve, reject }; +} +exports.createDeferredPromise = createDeferredPromise; +//# sourceMappingURL=promise.cjs.map + +/***/ }), + +/***/ 32954: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.timeSince = exports.inMilliseconds = exports.Duration = void 0; +/** + * Common duration constants, in milliseconds. + */ +var Duration; +(function (Duration) { + /** + * A millisecond. + */ + Duration[Duration["Millisecond"] = 1] = "Millisecond"; + /** + * A second, in milliseconds. + */ + Duration[Duration["Second"] = 1000] = "Second"; + /** + * A minute, in milliseconds. + */ + Duration[Duration["Minute"] = 60000] = "Minute"; + /** + * An hour, in milliseconds. + */ + Duration[Duration["Hour"] = 3600000] = "Hour"; + /** + * A day, in milliseconds. + */ + Duration[Duration["Day"] = 86400000] = "Day"; + /** + * A week, in milliseconds. + */ + Duration[Duration["Week"] = 604800000] = "Week"; + /** + * A year, in milliseconds. + */ + Duration[Duration["Year"] = 31536000000] = "Year"; +})(Duration = exports.Duration || (exports.Duration = {})); +const isNonNegativeInteger = (number) => Number.isInteger(number) && number >= 0; +const assertIsNonNegativeInteger = (number, name) => { + if (!isNonNegativeInteger(number)) { + throw new Error(`"${name}" must be a non-negative integer. Received: "${number}".`); + } +}; +/** + * Calculates the millisecond value of the specified number of units of time. + * + * @param count - The number of units of time. + * @param duration - The unit of time to count. + * @returns The count multiplied by the specified duration. + */ +function inMilliseconds(count, duration) { + assertIsNonNegativeInteger(count, 'count'); + return count * duration; +} +exports.inMilliseconds = inMilliseconds; +/** + * Gets the milliseconds since a particular Unix epoch timestamp. + * + * @param timestamp - A Unix millisecond timestamp. + * @returns The number of milliseconds elapsed since the specified timestamp. + */ +function timeSince(timestamp) { + assertIsNonNegativeInteger(timestamp, 'timestamp'); + return Date.now() - timestamp; +} +exports.timeSince = timeSince; +//# sourceMappingURL=time.cjs.map + +/***/ }), + +/***/ 16871: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=transaction-types.cjs.map + +/***/ }), + +/***/ 49266: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.satisfiesVersionRange = exports.gtRange = exports.gtVersion = exports.assertIsSemVerRange = exports.assertIsSemVerVersion = exports.isValidSemVerRange = exports.isValidSemVerVersion = exports.VersionRangeStruct = exports.VersionStruct = void 0; +const superstruct_1 = __webpack_require__(35620); +const semver_1 = __webpack_require__(56864); +const assert_1 = __webpack_require__(22011); +/** + * A struct for validating a version string. + */ +exports.VersionStruct = (0, superstruct_1.refine)((0, superstruct_1.string)(), 'Version', (value) => { + if ((0, semver_1.valid)(value) === null) { + return `Expected SemVer version, got "${value}"`; + } + return true; +}); +exports.VersionRangeStruct = (0, superstruct_1.refine)((0, superstruct_1.string)(), 'Version range', (value) => { + if ((0, semver_1.validRange)(value) === null) { + return `Expected SemVer range, got "${value}"`; + } + return true; +}); +/** + * Checks whether a SemVer version is valid. + * + * @param version - A potential version. + * @returns `true` if the version is valid, and `false` otherwise. + */ +function isValidSemVerVersion(version) { + return (0, superstruct_1.is)(version, exports.VersionStruct); +} +exports.isValidSemVerVersion = isValidSemVerVersion; +/** + * Checks whether a SemVer version range is valid. + * + * @param versionRange - A potential version range. + * @returns `true` if the version range is valid, and `false` otherwise. + */ +function isValidSemVerRange(versionRange) { + return (0, superstruct_1.is)(versionRange, exports.VersionRangeStruct); +} +exports.isValidSemVerRange = isValidSemVerRange; +/** + * Asserts that a value is a valid concrete SemVer version. + * + * @param version - A potential SemVer concrete version. + */ +function assertIsSemVerVersion(version) { + (0, assert_1.assertStruct)(version, exports.VersionStruct); +} +exports.assertIsSemVerVersion = assertIsSemVerVersion; +/** + * Asserts that a value is a valid SemVer range. + * + * @param range - A potential SemVer range. + */ +function assertIsSemVerRange(range) { + (0, assert_1.assertStruct)(range, exports.VersionRangeStruct); +} +exports.assertIsSemVerRange = assertIsSemVerRange; +/** + * Checks whether a SemVer version is greater than another. + * + * @param version1 - The left-hand version. + * @param version2 - The right-hand version. + * @returns `version1 > version2`. + */ +function gtVersion(version1, version2) { + return (0, semver_1.gt)(version1, version2); +} +exports.gtVersion = gtVersion; +/** + * Checks whether a SemVer version is greater than all possibilities in a range. + * + * @param version - A SemvVer version. + * @param range - The range to check against. + * @returns `version > range`. + */ +function gtRange(version, range) { + return (0, semver_1.gtr)(version, range); +} +exports.gtRange = gtRange; +/** + * Returns whether a SemVer version satisfies a SemVer range. + * + * @param version - The SemVer version to check. + * @param versionRange - The SemVer version range to check against. + * @returns Whether the version satisfied the version range. + */ +function satisfiesVersionRange(version, versionRange) { + return (0, semver_1.satisfies)(version, versionRange, { + includePrerelease: true, + }); +} +exports.satisfiesVersionRange = satisfiesVersionRange; +//# sourceMappingURL=versions.cjs.map + +/***/ }), + +/***/ 39209: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var possibleNames = __webpack_require__(76578); + +var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis; + +/** @type {import('.')} */ +module.exports = function availableTypedArrays() { + var /** @type {ReturnType} */ out = []; + for (var i = 0; i < possibleNames.length; i++) { + if (typeof g[possibleNames[i]] === 'function') { + // @ts-expect-error + out[out.length] = possibleNames[i]; + } + } + return out; +}; + + +/***/ }), + +/***/ 48343: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { normalizeIPv6, normalizeIPv4, removeDotSegments, recomposeAuthority, normalizeComponentEncoding } = __webpack_require__(34834) +const SCHEMES = __webpack_require__(343) + +function normalize (uri, options) { + if (typeof uri === 'string') { + uri = serialize(parse(uri, options), options) + } else if (typeof uri === 'object') { + uri = parse(serialize(uri, options), options) + } + return uri +} + +function resolve (baseURI, relativeURI, options) { + const schemelessOptions = Object.assign({ scheme: 'null' }, options) + const resolved = resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true) + return serialize(resolved, { ...schemelessOptions, skipEscape: true }) +} + +function resolveComponents (base, relative, options, skipNormalization) { + const target = {} + if (!skipNormalization) { + base = parse(serialize(base, options), options) // normalize base components + relative = parse(serialize(relative, options), options) // normalize relative components + } + options = options || {} + + if (!options.tolerant && relative.scheme) { + target.scheme = relative.scheme + // target.authority = relative.authority; + target.userinfo = relative.userinfo + target.host = relative.host + target.port = relative.port + target.path = removeDotSegments(relative.path || '') + target.query = relative.query + } else { + if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) { + // target.authority = relative.authority; + target.userinfo = relative.userinfo + target.host = relative.host + target.port = relative.port + target.path = removeDotSegments(relative.path || '') + target.query = relative.query + } else { + if (!relative.path) { + target.path = base.path + if (relative.query !== undefined) { + target.query = relative.query + } else { + target.query = base.query + } + } else { + if (relative.path.charAt(0) === '/') { + target.path = removeDotSegments(relative.path) + } else { + if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) { + target.path = '/' + relative.path + } else if (!base.path) { + target.path = relative.path + } else { + target.path = base.path.slice(0, base.path.lastIndexOf('/') + 1) + relative.path + } + target.path = removeDotSegments(target.path) + } + target.query = relative.query + } + // target.authority = base.authority; + target.userinfo = base.userinfo + target.host = base.host + target.port = base.port + } + target.scheme = base.scheme + } + + target.fragment = relative.fragment + + return target +} + +function equal (uriA, uriB, options) { + if (typeof uriA === 'string') { + uriA = unescape(uriA) + uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true }) + } else if (typeof uriA === 'object') { + uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true }) + } + + if (typeof uriB === 'string') { + uriB = unescape(uriB) + uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true }) + } else if (typeof uriB === 'object') { + uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true }) + } + + return uriA.toLowerCase() === uriB.toLowerCase() +} + +function serialize (cmpts, opts) { + const components = { + host: cmpts.host, + scheme: cmpts.scheme, + userinfo: cmpts.userinfo, + port: cmpts.port, + path: cmpts.path, + query: cmpts.query, + nid: cmpts.nid, + nss: cmpts.nss, + uuid: cmpts.uuid, + fragment: cmpts.fragment, + reference: cmpts.reference, + resourceName: cmpts.resourceName, + secure: cmpts.secure, + error: '' + } + const options = Object.assign({}, opts) + const uriTokens = [] + + // find scheme handler + const schemeHandler = SCHEMES[(options.scheme || components.scheme || '').toLowerCase()] + + // perform scheme specific serialization + if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options) + + if (components.path !== undefined) { + if (!options.skipEscape) { + components.path = escape(components.path) + + if (components.scheme !== undefined) { + components.path = components.path.split('%3A').join(':') + } + } else { + components.path = unescape(components.path) + } + } + + if (options.reference !== 'suffix' && components.scheme) { + uriTokens.push(components.scheme) + uriTokens.push(':') + } + + const authority = recomposeAuthority(components, options) + if (authority !== undefined) { + if (options.reference !== 'suffix') { + uriTokens.push('//') + } + + uriTokens.push(authority) + + if (components.path && components.path.charAt(0) !== '/') { + uriTokens.push('/') + } + } + if (components.path !== undefined) { + let s = components.path + + if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) { + s = removeDotSegments(s) + } + + if (authority === undefined) { + s = s.replace(/^\/\//u, '/%2F') // don't allow the path to start with "//" + } + + uriTokens.push(s) + } + + if (components.query !== undefined) { + uriTokens.push('?') + uriTokens.push(components.query) + } + + if (components.fragment !== undefined) { + uriTokens.push('#') + uriTokens.push(components.fragment) + } + return uriTokens.join('') +} + +const hexLookUp = Array.from({ length: 127 }, (v, k) => /[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(k))) + +function nonSimpleDomain (value) { + let code = 0 + for (let i = 0, len = value.length; i < len; ++i) { + code = value.charCodeAt(i) + if (code > 126 || hexLookUp[code]) { + return true + } + } + return false +} + +const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u + +function parse (uri, opts) { + const options = Object.assign({}, opts) + const parsed = { + scheme: undefined, + userinfo: undefined, + host: '', + port: undefined, + path: '', + query: undefined, + fragment: undefined + } + const gotEncoding = uri.indexOf('%') !== -1 + let isIP = false + if (options.reference === 'suffix') uri = (options.scheme ? options.scheme + ':' : '') + '//' + uri + + const matches = uri.match(URI_PARSE) + + if (matches) { + // store each component + parsed.scheme = matches[1] + parsed.userinfo = matches[3] + parsed.host = matches[4] + parsed.port = parseInt(matches[5], 10) + parsed.path = matches[6] || '' + parsed.query = matches[7] + parsed.fragment = matches[8] + + // fix port number + if (isNaN(parsed.port)) { + parsed.port = matches[5] + } + if (parsed.host) { + const ipv4result = normalizeIPv4(parsed.host) + if (ipv4result.isIPV4 === false) { + const ipv6result = normalizeIPv6(ipv4result.host, { isIPV4: false }) + parsed.host = ipv6result.host.toLowerCase() + isIP = ipv6result.isIPV6 + } else { + parsed.host = ipv4result.host + isIP = true + } + } + if (parsed.scheme === undefined && parsed.userinfo === undefined && parsed.host === undefined && parsed.port === undefined && !parsed.path && parsed.query === undefined) { + parsed.reference = 'same-document' + } else if (parsed.scheme === undefined) { + parsed.reference = 'relative' + } else if (parsed.fragment === undefined) { + parsed.reference = 'absolute' + } else { + parsed.reference = 'uri' + } + + // check for reference errors + if (options.reference && options.reference !== 'suffix' && options.reference !== parsed.reference) { + parsed.error = parsed.error || 'URI is not a ' + options.reference + ' reference.' + } + + // find scheme handler + const schemeHandler = SCHEMES[(options.scheme || parsed.scheme || '').toLowerCase()] + + // check if scheme can't handle IRIs + if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) { + // if host component is a domain name + if (parsed.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost)) && isIP === false && nonSimpleDomain(parsed.host)) { + // convert Unicode IDN -> ASCII IDN + try { + parsed.host = URL.domainToASCII(parsed.host.toLowerCase()) + } catch (e) { + parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e + } + } + // convert IRI -> URI + } + + if (!schemeHandler || (schemeHandler && !schemeHandler.skipNormalize)) { + if (gotEncoding && parsed.scheme !== undefined) { + parsed.scheme = unescape(parsed.scheme) + } + if (gotEncoding && parsed.userinfo !== undefined) { + parsed.userinfo = unescape(parsed.userinfo) + } + if (gotEncoding && parsed.host !== undefined) { + parsed.host = unescape(parsed.host) + } + if (parsed.path !== undefined && parsed.path.length) { + parsed.path = escape(unescape(parsed.path)) + } + if (parsed.fragment !== undefined && parsed.fragment.length) { + parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment)) + } + } + + // perform scheme specific parsing + if (schemeHandler && schemeHandler.parse) { + schemeHandler.parse(parsed, options) + } + } else { + parsed.error = parsed.error || 'URI can not be parsed.' + } + return parsed +} + +const fastUri = { + SCHEMES, + normalize, + resolve, + resolveComponents, + equal, + serialize, + parse +} + +module.exports = fastUri +module.exports["default"] = fastUri +module.exports.fastUri = fastUri + + +/***/ }), + +/***/ 343: +/***/ ((module) => { + +"use strict"; + + +const UUID_REG = /^[\da-f]{8}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{12}$/iu +const URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu + +function isSecure (wsComponents) { + return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === 'wss' +} + +function httpParse (components) { + if (!components.host) { + components.error = components.error || 'HTTP URIs must have a host.' + } + + return components +} + +function httpSerialize (components) { + const secure = String(components.scheme).toLowerCase() === 'https' + + // normalize the default port + if (components.port === (secure ? 443 : 80) || components.port === '') { + components.port = undefined + } + + // normalize the empty path + if (!components.path) { + components.path = '/' + } + + // NOTE: We do not parse query strings for HTTP URIs + // as WWW Form Url Encoded query strings are part of the HTML4+ spec, + // and not the HTTP spec. + + return components +} + +function wsParse (wsComponents) { +// indicate if the secure flag is set + wsComponents.secure = isSecure(wsComponents) + + // construct resouce name + wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '') + wsComponents.path = undefined + wsComponents.query = undefined + + return wsComponents +} + +function wsSerialize (wsComponents) { +// normalize the default port + if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === '') { + wsComponents.port = undefined + } + + // ensure scheme matches secure flag + if (typeof wsComponents.secure === 'boolean') { + wsComponents.scheme = (wsComponents.secure ? 'wss' : 'ws') + wsComponents.secure = undefined + } + + // reconstruct path from resource name + if (wsComponents.resourceName) { + const [path, query] = wsComponents.resourceName.split('?') + wsComponents.path = (path && path !== '/' ? path : undefined) + wsComponents.query = query + wsComponents.resourceName = undefined + } + + // forbid fragment component + wsComponents.fragment = undefined + + return wsComponents +} + +function urnParse (urnComponents, options) { + if (!urnComponents.path) { + urnComponents.error = 'URN can not be parsed' + return urnComponents + } + const matches = urnComponents.path.match(URN_REG) + if (matches) { + const scheme = options.scheme || urnComponents.scheme || 'urn' + urnComponents.nid = matches[1].toLowerCase() + urnComponents.nss = matches[2] + const urnScheme = `${scheme}:${options.nid || urnComponents.nid}` + const schemeHandler = SCHEMES[urnScheme] + urnComponents.path = undefined + + if (schemeHandler) { + urnComponents = schemeHandler.parse(urnComponents, options) + } + } else { + urnComponents.error = urnComponents.error || 'URN can not be parsed.' + } + + return urnComponents +} + +function urnSerialize (urnComponents, options) { + const scheme = options.scheme || urnComponents.scheme || 'urn' + const nid = urnComponents.nid.toLowerCase() + const urnScheme = `${scheme}:${options.nid || nid}` + const schemeHandler = SCHEMES[urnScheme] + + if (schemeHandler) { + urnComponents = schemeHandler.serialize(urnComponents, options) + } + + const uriComponents = urnComponents + const nss = urnComponents.nss + uriComponents.path = `${nid || options.nid}:${nss}` + + options.skipEscape = true + return uriComponents +} + +function urnuuidParse (urnComponents, options) { + const uuidComponents = urnComponents + uuidComponents.uuid = uuidComponents.nss + uuidComponents.nss = undefined + + if (!options.tolerant && (!uuidComponents.uuid || !UUID_REG.test(uuidComponents.uuid))) { + uuidComponents.error = uuidComponents.error || 'UUID is not valid.' + } + + return uuidComponents +} + +function urnuuidSerialize (uuidComponents) { + const urnComponents = uuidComponents + // normalize UUID + urnComponents.nss = (uuidComponents.uuid || '').toLowerCase() + return urnComponents +} + +const http = { + scheme: 'http', + domainHost: true, + parse: httpParse, + serialize: httpSerialize +} + +const https = { + scheme: 'https', + domainHost: http.domainHost, + parse: httpParse, + serialize: httpSerialize +} + +const ws = { + scheme: 'ws', + domainHost: true, + parse: wsParse, + serialize: wsSerialize +} + +const wss = { + scheme: 'wss', + domainHost: ws.domainHost, + parse: ws.parse, + serialize: ws.serialize +} + +const urn = { + scheme: 'urn', + parse: urnParse, + serialize: urnSerialize, + skipNormalize: true +} + +const urnuuid = { + scheme: 'urn:uuid', + parse: urnuuidParse, + serialize: urnuuidSerialize, + skipNormalize: true +} + +const SCHEMES = { + http, + https, + ws, + wss, + urn, + 'urn:uuid': urnuuid +} + +module.exports = SCHEMES + + +/***/ }), + +/***/ 64914: +/***/ ((module) => { + +"use strict"; + + +const HEX = { + 0: 0, + 1: 1, + 2: 2, + 3: 3, + 4: 4, + 5: 5, + 6: 6, + 7: 7, + 8: 8, + 9: 9, + a: 10, + A: 10, + b: 11, + B: 11, + c: 12, + C: 12, + d: 13, + D: 13, + e: 14, + E: 14, + f: 15, + F: 15 +} + +module.exports = { + HEX +} + + +/***/ }), + +/***/ 34834: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { HEX } = __webpack_require__(64914) + +function normalizeIPv4 (host) { + if (findToken(host, '.') < 3) { return { host, isIPV4: false } } + const matches = host.match(/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/u) || [] + const [address] = matches + if (address) { + return { host: stripLeadingZeros(address, '.'), isIPV4: true } + } else { + return { host, isIPV4: false } + } +} + +/** + * @param {string[]} input + * @param {boolean} [keepZero=false] + * @returns {string|undefined} + */ +function stringArrayToHexStripped (input, keepZero = false) { + let acc = '' + let strip = true + for (const c of input) { + if (HEX[c] === undefined) return undefined + if (c !== '0' && strip === true) strip = false + if (!strip) acc += c + } + if (keepZero && acc.length === 0) acc = '0' + return acc +} + +function getIPV6 (input) { + let tokenCount = 0 + const output = { error: false, address: '', zone: '' } + const address = [] + const buffer = [] + let isZone = false + let endipv6Encountered = false + let endIpv6 = false + + function consume () { + if (buffer.length) { + if (isZone === false) { + const hex = stringArrayToHexStripped(buffer) + if (hex !== undefined) { + address.push(hex) + } else { + output.error = true + return false + } + } + buffer.length = 0 + } + return true + } + + for (let i = 0; i < input.length; i++) { + const cursor = input[i] + if (cursor === '[' || cursor === ']') { continue } + if (cursor === ':') { + if (endipv6Encountered === true) { + endIpv6 = true + } + if (!consume()) { break } + tokenCount++ + address.push(':') + if (tokenCount > 7) { + // not valid + output.error = true + break + } + if (i - 1 >= 0 && input[i - 1] === ':') { + endipv6Encountered = true + } + continue + } else if (cursor === '%') { + if (!consume()) { break } + // switch to zone detection + isZone = true + } else { + buffer.push(cursor) + continue + } + } + if (buffer.length) { + if (isZone) { + output.zone = buffer.join('') + } else if (endIpv6) { + address.push(buffer.join('')) + } else { + address.push(stringArrayToHexStripped(buffer)) + } + } + output.address = address.join('') + return output +} + +function normalizeIPv6 (host, opts = {}) { + if (findToken(host, ':') < 2) { return { host, isIPV6: false } } + const ipv6 = getIPV6(host) + + if (!ipv6.error) { + let newHost = ipv6.address + let escapedHost = ipv6.address + if (ipv6.zone) { + newHost += '%' + ipv6.zone + escapedHost += '%25' + ipv6.zone + } + return { host: newHost, escapedHost, isIPV6: true } + } else { + return { host, isIPV6: false } + } +} + +function stripLeadingZeros (str, token) { + let out = '' + let skip = true + const l = str.length + for (let i = 0; i < l; i++) { + const c = str[i] + if (c === '0' && skip) { + if ((i + 1 <= l && str[i + 1] === token) || i + 1 === l) { + out += c + skip = false + } + } else { + if (c === token) { + skip = true + } else { + skip = false + } + out += c + } + } + return out +} + +function findToken (str, token) { + let ind = 0 + for (let i = 0; i < str.length; i++) { + if (str[i] === token) ind++ + } + return ind +} + +const RDS1 = /^\.\.?\//u +const RDS2 = /^\/\.(?:\/|$)/u +const RDS3 = /^\/\.\.(?:\/|$)/u +const RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/u + +function removeDotSegments (input) { + const output = [] + + while (input.length) { + if (input.match(RDS1)) { + input = input.replace(RDS1, '') + } else if (input.match(RDS2)) { + input = input.replace(RDS2, '/') + } else if (input.match(RDS3)) { + input = input.replace(RDS3, '/') + output.pop() + } else if (input === '.' || input === '..') { + input = '' + } else { + const im = input.match(RDS5) + if (im) { + const s = im[0] + input = input.slice(s.length) + output.push(s) + } else { + throw new Error('Unexpected dot segment condition') + } + } + } + return output.join('') +} + +function normalizeComponentEncoding (components, esc) { + const func = esc !== true ? escape : unescape + if (components.scheme !== undefined) { + components.scheme = func(components.scheme) + } + if (components.userinfo !== undefined) { + components.userinfo = func(components.userinfo) + } + if (components.host !== undefined) { + components.host = func(components.host) + } + if (components.path !== undefined) { + components.path = func(components.path) + } + if (components.query !== undefined) { + components.query = func(components.query) + } + if (components.fragment !== undefined) { + components.fragment = func(components.fragment) + } + return components +} + +function recomposeAuthority (components, options) { + const uriTokens = [] + + if (components.userinfo !== undefined) { + uriTokens.push(components.userinfo) + uriTokens.push('@') + } + + if (components.host !== undefined) { + let host = unescape(components.host) + const ipV4res = normalizeIPv4(host) + + if (ipV4res.isIPV4) { + host = ipV4res.host + } else { + const ipV6res = normalizeIPv6(ipV4res.host, { isIPV4: false }) + if (ipV6res.isIPV6 === true) { + host = `[${ipV6res.escapedHost}]` + } else { + host = components.host + } + } + uriTokens.push(host) + } + + if (typeof components.port === 'number' || typeof components.port === 'string') { + uriTokens.push(':') + uriTokens.push(String(components.port)) + } + + return uriTokens.length ? uriTokens.join('') : undefined +}; + +module.exports = { + recomposeAuthority, + normalizeComponentEncoding, + removeDotSegments, + normalizeIPv4, + normalizeIPv6, + stringArrayToHexStripped +} + + +/***/ }), + +/***/ 89190: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ CG: () => (/* binding */ output), +/* harmony export */ ai: () => (/* binding */ number), +/* harmony export */ ee: () => (/* binding */ bytes), +/* harmony export */ t2: () => (/* binding */ exists), +/* harmony export */ tW: () => (/* binding */ hash) +/* harmony export */ }); +/* unused harmony export bool */ +function number(n) { + if (!Number.isSafeInteger(n) || n < 0) + throw new Error(`Wrong positive integer: ${n}`); +} +function bool(b) { + if (typeof b !== 'boolean') + throw new Error(`Expected boolean, not ${b}`); +} +function bytes(b, ...lengths) { + if (!(b instanceof Uint8Array)) + throw new Error('Expected Uint8Array'); + if (lengths.length > 0 && !lengths.includes(b.length)) + throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`); +} +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); +} +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'); +} +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}`); + } +} + +const assert = { number, bool, bytes, hash, exists, output }; +/* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ((/* unused pure expression or super */ null && (assert))); +//# sourceMappingURL=_assert.js.map + +/***/ }), + +/***/ 6800: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ D: () => (/* binding */ SHA2) +/* harmony export */ }); +/* harmony import */ var _assert_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(89190); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32531); + + +// 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__WEBPACK_IMPORTED_MODULE_0__/* .Hash */ .Vw { + 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__WEBPACK_IMPORTED_MODULE_0__/* .createView */ .O8)(this.buffer); + } + update(data) { + (0,_assert_js__WEBPACK_IMPORTED_MODULE_1__/* .exists */ .t2)(this); + const { view, buffer, blockLen } = this; + data = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__/* .toBytes */ .ZJ)(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__WEBPACK_IMPORTED_MODULE_0__/* .createView */ .O8)(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) { + (0,_assert_js__WEBPACK_IMPORTED_MODULE_1__/* .exists */ .t2)(this); + (0,_assert_js__WEBPACK_IMPORTED_MODULE_1__/* .output */ .CG)(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__WEBPACK_IMPORTED_MODULE_0__/* .createView */ .O8)(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; + } +} +//# sourceMappingURL=_sha2.js.map + +/***/ }), + +/***/ 79271: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Ay: () => (__WEBPACK_DEFAULT_EXPORT__), +/* harmony export */ B4: () => (/* binding */ rotlSL), +/* harmony export */ P5: () => (/* binding */ rotlSH), +/* harmony export */ WM: () => (/* binding */ rotlBH), +/* harmony export */ im: () => (/* binding */ rotlBL), +/* harmony export */ lD: () => (/* binding */ split) +/* harmony export */ }); +/* unused harmony exports fromBig, toBig, shrSH, shrSL, rotrSH, rotrSL, rotrBH, rotrBL, rotr32H, rotr32L, add, add3L, add3H, add4L, add4H, add5H, add5L */ +const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1); +const _32n = /* @__PURE__ */ 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 }; +} +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]; +} +const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0); +// 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. +function add(Ah, Al, Bh, Bl) { + const l = (Al >>> 0) + (Bl >>> 0); + return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 }; +} +// 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 + +// prettier-ignore +const u64 = { + fromBig, split, toBig, + shrSH, shrSL, + rotrSH, rotrSL, rotrBH, rotrBL, + rotr32H, rotr32L, + rotlSH, rotlSL, rotlBH, rotlBL, + add, add3L, add3H, add4L, add4H, add5H, add5L, +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (u64); +//# sourceMappingURL=_u64.js.map + +/***/ }), + +/***/ 21454: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ w: () => (/* binding */ hmac) +/* harmony export */ }); +/* unused harmony export HMAC */ +/* harmony import */ var _assert_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(89190); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32531); + + +// HMAC (RFC 2104) +class HMAC extends _utils_js__WEBPACK_IMPORTED_MODULE_0__/* .Hash */ .Vw { + constructor(hash, _key) { + super(); + this.finished = false; + this.destroyed = false; + (0,_assert_js__WEBPACK_IMPORTED_MODULE_1__/* .hash */ .tW)(hash); + const key = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__/* .toBytes */ .ZJ)(_key); + this.iHash = hash.create(); + if (typeof this.iHash.update !== 'function') + throw new Error('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) { + (0,_assert_js__WEBPACK_IMPORTED_MODULE_1__/* .exists */ .t2)(this); + this.iHash.update(buf); + return this; + } + digestInto(out) { + (0,_assert_js__WEBPACK_IMPORTED_MODULE_1__/* .exists */ .t2)(this); + (0,_assert_js__WEBPACK_IMPORTED_MODULE_1__/* .bytes */ .ee)(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(); +hmac.create = (hash, key) => new HMAC(hash, key); +//# sourceMappingURL=hmac.js.map + +/***/ }), + +/***/ 2200: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ A: () => (/* binding */ pbkdf2) +/* harmony export */ }); +/* unused harmony export pbkdf2Async */ +/* harmony import */ var _assert_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(89190); +/* harmony import */ var _hmac_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(21454); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(32531); + + + +// Common prologue and epilogue for sync/async functions +function pbkdf2Init(hash, _password, _salt, _opts) { + (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__/* .hash */ .tW)(hash); + const opts = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .checkOpts */ .tY)({ dkLen: 32, asyncTick: 10 }, _opts); + const { c, dkLen, asyncTick } = opts; + (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__/* .number */ .ai)(c); + (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__/* .number */ .ai)(dkLen); + (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__/* .number */ .ai)(asyncTick); + if (c < 1) + throw new Error('PBKDF2: iterations (c) should be >= 1'); + const password = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .toBytes */ .ZJ)(_password); + const salt = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .toBytes */ .ZJ)(_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__WEBPACK_IMPORTED_MODULE_2__/* .hmac */ .w.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__WEBPACK_IMPORTED_MODULE_1__/* .createView */ .O8)(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); +} +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 = 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 asyncLoop(c - 1, asyncTick, () => { + // 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); +} +//# sourceMappingURL=pbkdf2.js.map + +/***/ }), + +/***/ 78226: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ s: () => (/* binding */ sha256) +/* harmony export */ }); +/* unused harmony export sha224 */ +/* harmony import */ var _sha2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6800); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(32531); + + +// SHA2-256 need to try 2^128 hashes to execute birthday attack. +// BTC network is doing 2^67 hashes/sec as per early 2023. +// 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 = /* @__PURE__ */ 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 = /* @__PURE__ */ 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 = /* @__PURE__ */ new Uint32Array(64); +class SHA256 extends _sha2_js__WEBPACK_IMPORTED_MODULE_0__/* .SHA2 */ .D { + 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__WEBPACK_IMPORTED_MODULE_1__/* .rotr */ .Ow)(W15, 7) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .rotr */ .Ow)(W15, 18) ^ (W15 >>> 3); + const s1 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .rotr */ .Ow)(W2, 17) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .rotr */ .Ow)(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__WEBPACK_IMPORTED_MODULE_1__/* .rotr */ .Ow)(E, 6) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .rotr */ .Ow)(E, 11) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .rotr */ .Ow)(E, 25); + const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; + const sigma0 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .rotr */ .Ow)(A, 2) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .rotr */ .Ow)(A, 13) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .rotr */ .Ow)(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 + */ +const sha256 = /* @__PURE__ */ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .wrapConstructor */ .ld)(() => new SHA256()); +const sha224 = /* @__PURE__ */ (/* unused pure expression or super */ null && (wrapConstructor(() => new SHA224()))); +//# sourceMappingURL=sha256.js.map + +/***/ }), + +/***/ 32531: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; + +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + Vw: () => (/* binding */ Hash), + $h: () => (/* binding */ asyncLoop), + tY: () => (/* binding */ checkOpts), + Id: () => (/* binding */ concatBytes), + O8: () => (/* binding */ createView), + po: () => (/* binding */ randomBytes), + Ow: () => (/* binding */ rotr), + ZJ: () => (/* binding */ toBytes), + DH: () => (/* binding */ u32), + ld: () => (/* binding */ wrapConstructor) +}); + +// UNUSED EXPORTS: bytesToHex, hexToBytes, isLE, nextTick, u8, utf8ToBytes, wrapConstructorWithOpts, wrapXOFConstructorWithOpts + +;// ./node_modules/@noble/hashes/esm/crypto.js +const crypto_crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined; +//# sourceMappingURL=crypto.js.map +;// ./node_modules/@noble/hashes/esm/utils.js +/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+. +// 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 u8a = (a) => a instanceof Uint8Array; +// Cast array to different type +const u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength); +const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); +// Cast array to view +const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength); +// The rotate right (circular right shift) operation for uint32 +const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift); +// 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. +const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44; +if (!isLE) + throw new Error('Non little-endian hardware is not supported'); +const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0')); +/** + * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123' + */ +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; +} +/** + * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23]) + */ +function hexToBytes(hex) { + if (typeof hex !== 'string') + throw new Error('hex string expected, got ' + typeof hex); + const len = hex.length; + if (len % 2) + throw new Error('padded hex string expected, got unpadded hex of length ' + len); + const array = new Uint8Array(len / 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; +} +// 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 () => { }; +// 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 nextTick(); + ts += diff; + } +} +/** + * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) + */ +function utf8ToBytes(str) { + if (typeof str !== 'string') + throw new Error(`utf8ToBytes expected string, got ${typeof str}`); + return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809 +} +/** + * Normalizes (non-hex) string or Uint8Array to Uint8Array. + * Warning: when Uint8Array is passed, it would NOT get copied. + * Keep in mind for future mutable operations. + */ +function toBytes(data) { + if (typeof data === 'string') + data = utf8ToBytes(data); + if (!u8a(data)) + throw new Error(`expected Uint8Array, got ${typeof data}`); + return data; +} +/** + * Copies several Uint8Arrays into one. + */ +function concatBytes(...arrays) { + const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0)); + let pad = 0; // walk through each item, ensure they have proper type + arrays.forEach((a) => { + if (!u8a(a)) + throw new Error('Uint8Array expected'); + r.set(a, pad); + pad += a.length; + }); + return r; +} +// For runtime check if class implements interface +class Hash { + // Safe version that clones internal state + clone() { + return this._cloneInto(); + } +} +const toStr = {}.toString; +function checkOpts(defaults, opts) { + if (opts !== undefined && toStr.call(opts) !== '[object Object]') + throw new Error('Options should be object or undefined'); + const merged = Object.assign(defaults, opts); + return merged; +} +function wrapConstructor(hashCons) { + const hashC = (msg) => hashCons().update(toBytes(msg)).digest(); + const tmp = hashCons(); + hashC.outputLen = tmp.outputLen; + hashC.blockLen = tmp.blockLen; + hashC.create = () => hashCons(); + return hashC; +} +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; +} +function wrapXOFConstructorWithOpts(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; +} +/** + * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS. + */ +function randomBytes(bytesLength = 32) { + if (crypto_crypto && typeof crypto_crypto.getRandomValues === 'function') { + return crypto_crypto.getRandomValues(new Uint8Array(bytesLength)); + } + throw new Error('crypto.getRandomValues must be defined'); +} +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ 90294: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; + +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + HI: () => (/* reexport */ mimcsponge_buildMimcSponge), + vu: () => (/* reexport */ pedersen_hash_buildPedersenHash) +}); + +// UNUSED EXPORTS: SMT, SMTMemDb, buildBabyjub, buildEddsa, buildMimc7, buildPoseidon, buildPoseidonOpt, buildPoseidonReference, buildPoseidonWasm, buildSMT, evmasm, mimc7Contract, mimcSpongecontract, newMemEmptyTrie, poseidonContract + +;// ./node_modules/circomlibjs/node_modules/ffjavascript/build/browser.esm.js +/* global BigInt */ +const hexLen = [ 0, 1, 2, 2, 3, 3, 3, 3, 4 ,4 ,4 ,4 ,4 ,4 ,4 ,4]; + +function fromString(s, radix) { + if ((!radix)||(radix==10)) { + return BigInt(s); + } else if (radix==16) { + if (s.slice(0,2) == "0x") { + return BigInt(s); + } else { + return BigInt("0x"+s); + } + } +} + +const e = fromString; + +function fromArray(a, radix) { + let acc =BigInt(0); + radix = BigInt(radix); + for (let i=0; i> BigInt(n); +} + +const shl = shiftLeft; +const shr = shiftRight; + +function isOdd$5(a) { + return (BigInt(a) & BigInt(1)) == BigInt(1); +} + + +function naf(n) { + let E = BigInt(n); + const res = []; + while (E) { + if (E & BigInt(1)) { + const z = 2 - Number(E % BigInt(4)); + res.push( z ); + E = E - BigInt(z); + } else { + res.push( 0 ); + } + E = E >> BigInt(1); + } + return res; +} + + +function bits(n) { + let E = BigInt(n); + const res = []; + while (E) { + if (E & BigInt(1)) { + res.push(1); + } else { + res.push( 0 ); + } + E = E >> BigInt(1); + } + return res; +} + +function toNumber$1(s) { + if (s>BigInt(Number.MAX_SAFE_INTEGER )) { + throw new Error("Number too big"); + } + return Number(s); +} + +function toArray(s, radix) { + const res = []; + let rem = BigInt(s); + radix = BigInt(radix); + while (rem) { + res.unshift( Number(rem % radix)); + rem = rem / radix; + } + return res; +} + + +function add(a, b) { + return BigInt(a) + BigInt(b); +} + +function sub(a, b) { + return BigInt(a) - BigInt(b); +} + +function neg(a) { + return -BigInt(a); +} + +function mul(a, b) { + return BigInt(a) * BigInt(b); +} + +function square$2(a) { + return BigInt(a) * BigInt(a); +} + +function pow(a, b) { + return BigInt(a) ** BigInt(b); +} + +function exp$1(a, b) { + return BigInt(a) ** BigInt(b); +} + +function abs$1(a) { + return BigInt(a) >= 0 ? BigInt(a) : -BigInt(a); +} + +function div(a, b) { + return BigInt(a) / BigInt(b); +} + +function mod(a, b) { + return BigInt(a) % BigInt(b); +} + +function eq(a, b) { + return BigInt(a) == BigInt(b); +} + +function neq(a, b) { + return BigInt(a) != BigInt(b); +} + +function lt(a, b) { + return BigInt(a) < BigInt(b); +} + +function gt(a, b) { + return BigInt(a) > BigInt(b); +} + +function leq(a, b) { + return BigInt(a) <= BigInt(b); +} + +function geq(a, b) { + return BigInt(a) >= BigInt(b); +} + +function band(a, b) { + return BigInt(a) & BigInt(b); +} + +function bor(a, b) { + return BigInt(a) | BigInt(b); +} + +function bxor(a, b) { + return BigInt(a) ^ BigInt(b); +} + +function land(a, b) { + return BigInt(a) && BigInt(b); +} + +function lor(a, b) { + return BigInt(a) || BigInt(b); +} + +function lnot(a) { + return !BigInt(a); +} + +// Returns a buffer with Little Endian Representation +function toRprLE(buff, o, e, n8) { + const s = "0000000" + e.toString(16); + const v = new Uint32Array(buff.buffer, buff.byteOffset + o, n8/4); + const l = (((s.length-7)*4 - 1) >> 5)+1; // Number of 32bit words; + for (let i=0; i> 5)+1; // Number of 32bit words; + for (let i=0; i a[a.length-i-1] = ch.toString(16).padStart(8,"0") ); + return fromString(a.join(""), 16); +} + +// Pases a buffer with Big Endian Representation +function fromRprBE(buff, o, n8) { + n8 = n8 || buff.byteLength; + o = o || 0; + const v = new DataView(buff.buffer, buff.byteOffset + o, n8); + const a = new Array(n8/4); + for (let i=0; i. +*/ + +/* + This library does operations on polynomials with coefficients in a field F. + + A polynomial P(x) = p0 + p1 * x + p2 * x^2 + ... + pn * x^n is represented + by the array [ p0, p1, p2, ... , pn ]. + */ + +class PolField { + constructor (F) { + this.F = F; + + let rem = F.sqrt_t; + let s = F.sqrt_s; + + const five = this.F.add(this.F.add(this.F.two, this.F.two), this.F.one); + + this.w = new Array(s+1); + this.wi = new Array(s+1); + this.w[s] = this.F.pow(five, rem); + this.wi[s] = this.F.inv(this.w[s]); + + let n=s-1; + while (n>=0) { + this.w[n] = this.F.square(this.w[n+1]); + this.wi[n] = this.F.square(this.wi[n+1]); + n--; + } + + + this.roots = []; +/* for (let i=0; i<16; i++) { + let r = this.F.one; + n = 1 << i; + const rootsi = new Array(n); + for (let j=0; j this.F.sqrt_s) n = this.s; + for (let i=n; (i>=0) && (!this.roots[i]); i--) { + let r = this.F.one; + const nroots = 1 << i; + const rootsi = new Array(nroots); + for (let j=0; j a.length) { + [b, a] = [a, b]; + } + + if ((b.length <= 2) || (b.length < log2$2(a.length))) { + return this.mulNormal(a,b); + } else { + return this.mulFFT(a,b); + } + } + + mulNormal(a, b) { + let res = []; + for (let i=0; i0) { + const z = new Array(n).fill(this.F.zero); + return z.concat(p); + } else { + if (-n >= p.length) return []; + return p.slice(-n); + } + } + + eval2(p, x) { + let v = this.F.zero; + let ix = this.F.one; + for (let i=0; i> 1), + F.mul( + x, + _eval(p, newX, offset+step , step << 1, n >> 1))); + return res; + } + } + + lagrange(points) { + let roots = [this.F.one]; + for (let i=0; i> 1; + const p1 = this._fft(pall, bits-1, offset, step*2); + const p2 = this._fft(pall, bits-1, offset+step, step*2); + + const out = new Array(n); + + let m= this.F.one; + for (let i=0; i0 && this.F.eq(p[i], this.F.zero) ) i--; + return p.slice(0, i+1); + } + + eq(a, b) { + const pa = this.reduce(a); + const pb = this.reduce(b); + + if (pa.length != pb.length) return false; + for (let i=0; i=0; i--) { + res[i] = this.F.add(this.F.mul(res[i+1], r), p[i+1]); + } + return res; + } + + _next2Power(v) { + v--; + v |= v >> 1; + v |= v >> 2; + v |= v >> 4; + v |= v >> 8; + v |= v >> 16; + v++; + return v; + } + + toString(p) { + const ap = this.normalize(p); + let S = ""; + for (let i=ap.length-1; i>=0; i--) { + if (!this.F.eq(p[i], this.F.zero)) { + if (S!="") S += " + "; + S = S + p[i].toString(10); + if (i>0) { + S = S + "x"; + if (i>1) { + S = S + "^" +i; + } + } + } + } + return S; + } + + normalize(p) { + const res = new Array(p.length); + for (let i=0; i + // rec = x^(k-2-scaleV)/ v + // + // res = x^m/v = x^(m + (2*k-2 - scaleV) - (2*k-2 - scaleV)) /v => + // res = rec * x^(m - (2*k-2 - scaleV)) => + // res = rec * x^(m - 2*k + 2 + scaleV) + + const rec = this._reciprocal(this.scaleX(v, scaleV), kbits); + const res = this.scaleX(rec, m - 2*k + 2 + scaleV); + + return res; + } + + div(_u, _v) { + if (_u.length < _v.length) return []; + const kbits = log2$2(_v.length-1)+1; + const k = 1 << kbits; + + const u = this.scaleX(_u, k-_v.length); + const v = this.scaleX(_v, k-_v.length); + + const n = v.length-1; + let m = u.length-1; + + const s = this._reciprocal(v, kbits); + let t; + if (m>2*n) { + t = this.sub(this.scaleX([this.F.one], 2*n), this.mul(s, v)); + } + + let q = []; + let rem = u; + let us, ut; + let finish = false; + + while (!finish) { + us = this.mul(rem, s); + q = this.add(q, this.scaleX(us, -2*n)); + + if ( m > 2*n ) { + ut = this.mul(rem, t); + rem = this.scaleX(ut, -2*n); + m = rem.length-1; + } else { + finish = true; + } + } + + return q; + } + + + // returns the ith nth-root of one + oneRoot(n, i) { + let nbits = log2$2(n-1)+1; + let res = this.F.one; + let r = i; + + if(i>=n) { + throw new Error("Given 'i' should be lower than 'n'"); + } + else if (1<0) { + if (r & 1 == 1) { + res = this.F.mul(res, this.w[nbits]); + } + r = r >> 1; + nbits --; + } + return res; + } + + computeVanishingPolinomial(bits, t) { + const m = 1 << bits; + return this.F.sub(this.F.pow(t, m), this.F.one); + } + + evaluateLagrangePolynomials(bits, t) { + const m= 1 << bits; + const tm = this.F.pow(t, m); + const u= new Array(m).fill(this.F.zero); + this._setRoots(bits); + const omega = this.w[bits]; + + if (this.F.eq(tm, this.F.one)) { + for (let i = 0; i < m; i++) { + if (this.F.eq(this.roots[bits][0],t)) { // i.e., t equals omega^i + u[i] = this.F.one; + return u; + } + } + } + + const z = this.F.sub(tm, this.F.one); + // let l = this.F.mul(z, this.F.pow(this.F.twoinv, m)); + let l = this.F.mul(z, this.F.inv(this.F.e(m))); + for (let i = 0; i < m; i++) { + u[i] = this.F.mul(l, this.F.inv(this.F.sub(t,this.roots[bits][i]))); + l = this.F.mul(l, omega); + } + + return u; + } + + log2(V) { + return log2$2(V); + } +} + +function log2$2( V ) +{ + return( ( ( V & 0xFFFF0000 ) !== 0 ? ( V &= 0xFFFF0000, 16 ) : 0 ) | ( ( V & 0xFF00FF00 ) !== 0 ? ( V &= 0xFF00FF00, 8 ) : 0 ) | ( ( V & 0xF0F0F0F0 ) !== 0 ? ( V &= 0xF0F0F0F0, 4 ) : 0 ) | ( ( V & 0xCCCCCCCC ) !== 0 ? ( V &= 0xCCCCCCCC, 2 ) : 0 ) | ( ( V & 0xAAAAAAAA ) !== 0 ) ); +} + + +function __fft$1(PF, pall, bits, offset, step) { + + const n = 1 << bits; + if (n==1) { + return [ pall[offset] ]; + } else if (n==2) { + return [ + PF.F.add(pall[offset], pall[offset + step]), + PF.F.sub(pall[offset], pall[offset + step])]; + } + + const ndiv2 = n >> 1; + const p1 = __fft$1(PF, pall, bits-1, offset, step*2); + const p2 = __fft$1(PF, pall, bits-1, offset+step, step*2); + + const out = new Array(n); + + for (let i=0; i> 1; + const p1 = __fft2(PF, pall.slice(0, ndiv2), bits-1); + const p2 = __fft2(PF, pall.slice(ndiv2), bits-1); + + const out = new Array(n); + + for (let i=0; i>=1; + } + return res; +} + +function rev(idx, bits) { + return ( + _revTable$1[idx >>> 24] | + (_revTable$1[(idx >>> 16) & 0xFF] << 8) | + (_revTable$1[(idx >>> 8) & 0xFF] << 16) | + (_revTable$1[idx & 0xFF] << 24) + ) >>> (32-bits); +} + +function __bitReverse(p, bits) { + for (let k=0; kk) { + const tmp= p[k]; + p[k] = p[r]; + p[r] = tmp; } } } -module.exports = ModuleBuilderWat; +/* + Copyright 2018 0kims association. + + This file is part of snarkjs. + + snarkjs is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. + + snarkjs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + snarkjs. If not, see . +*/ -/***/ }), -/***/ 77831: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +function mulScalar(F, base, e) { + let res; + + if (isZero$1(e)) return F.zero; + + const n = naf(e); + + if (n[n.length-1] == 1) { + res = base; + } else if (n[n.length-1] == -1) { + res = F.neg(base); + } else { + throw new Error("invlaud NAF"); + } + + for (let i=n.length-2; i>=0; i--) { + + res = F.double(res); + + if (n[i] == 1) { + res = F.add(res, base); + } else if (n[i] == -1) { + res = F.sub(res, base); + } + } + + return res; +} + + +/* +exports.mulScalar = (F, base, e) =>{ + let res = F.zero; + let rem = bigInt(e); + let exp = base; + + while (! rem.eq(bigInt.zero)) { + if (rem.and(bigInt.one).eq(bigInt.one)) { + res = F.add(res, exp); + } + exp = F.double(exp); + rem = rem.shiftRight(1); + } + + return res; +}; +*/ + + +function exp(F, base, e) { + + if (isZero$1(e)) return F.one; + + const n = bits(e); + + if (n.length==0) return F.one; + + let res = base; + + for (let i=n.length-2; i>=0; i--) { + + res = F.square(res); + + if (n[i]) { + res = F.mul(res, base); + } + } + + return res; +} + +// Check here: https://eprint.iacr.org/2012/685.pdf + +function buildSqrt (F) { + if ((F.m % 2) == 1) { + if (eq(mod(F.p, 4), 1 )) { + if (eq(mod(F.p, 8), 1 )) { + if (eq(mod(F.p, 16), 1 )) { + // alg7_muller(F); + alg5_tonelliShanks(F); + } else if (eq(mod(F.p, 16), 9 )) { + alg4_kong(F); + } else { + throw new Error("Field withot sqrt"); + } + } else if (eq(mod(F.p, 8), 5 )) { + alg3_atkin(F); + } else { + throw new Error("Field withot sqrt"); + } + } else if (eq(mod(F.p, 4), 3 )) { + alg2_shanks(F); + } + } else { + const pm2mod4 = mod(pow(F.p, F.m/2), 4); + if (pm2mod4 == 1) { + alg10_adj(F); + } else if (pm2mod4 == 3) { + alg9_adj(F); + } else { + alg8_complex(F); + } + + } +} + + +function alg5_tonelliShanks(F) { + F.sqrt_q = pow(F.p, F.m); + + F.sqrt_s = 0; + F.sqrt_t = sub(F.sqrt_q, 1); + + while (!isOdd$5(F.sqrt_t)) { + F.sqrt_s = F.sqrt_s + 1; + F.sqrt_t = div(F.sqrt_t, 2); + } + + let c0 = F.one; + + while (F.eq(c0, F.one)) { + const c = F.random(); + F.sqrt_z = F.pow(c, F.sqrt_t); + c0 = F.pow(F.sqrt_z, 2 ** (F.sqrt_s-1) ); + } + + F.sqrt_tm1d2 = div(sub(F.sqrt_t, 1),2); + + F.sqrt = function(a) { + const F=this; + if (F.isZero(a)) return F.zero; + let w = F.pow(a, F.sqrt_tm1d2); + const a0 = F.pow( F.mul(F.square(w), a), 2 ** (F.sqrt_s-1) ); + if (F.eq(a0, F.negone)) return null; + + let v = F.sqrt_s; + let x = F.mul(a, w); + let b = F.mul(x, w); + let z = F.sqrt_z; + while (!F.eq(b, F.one)) { + let b2k = F.square(b); + let k=1; + while (!F.eq(b2k, F.one)) { + b2k = F.square(b2k); + k++; + } + + w = z; + for (let i=0; i>> 0; + st[d] = (st[d] ^ st[a]) >>> 0; + st[d] = ((st[d] << 16) | ((st[d]>>>16) & 0xFFFF)) >>> 0; + + st[c] = (st[c] + st[d]) >>> 0; + st[b] = (st[b] ^ st[c]) >>> 0; + st[b] = ((st[b] << 12) | ((st[b]>>>20) & 0xFFF)) >>> 0; + + st[a] = (st[a] + st[b]) >>> 0; + st[d] = (st[d] ^ st[a]) >>> 0; + st[d] = ((st[d] << 8) | ((st[d]>>>24) & 0xFF)) >>> 0; + + st[c] = (st[c] + st[d]) >>> 0; + st[b] = (st[b] ^ st[c]) >>> 0; + st[b] = ((st[b] << 7) | ((st[b]>>>25) & 0x7F)) >>> 0; +} + +function doubleRound(st) { + quarterRound(st, 0, 4, 8,12); + quarterRound(st, 1, 5, 9,13); + quarterRound(st, 2, 6,10,14); + quarterRound(st, 3, 7,11,15); + + quarterRound(st, 0, 5,10,15); + quarterRound(st, 1, 6,11,12); + quarterRound(st, 2, 7, 8,13); + quarterRound(st, 3, 4, 9,14); +} + +class ChaCha { + + constructor(seed) { + seed = seed || [0,0,0,0,0,0,0,0]; + this.state = [ + 0x61707865, + 0x3320646E, + 0x79622D32, + 0x6B206574, + seed[0], + seed[1], + seed[2], + seed[3], + seed[4], + seed[5], + seed[6], + seed[7], + 0, + 0, + 0, + 0 + ]; + this.idx = 16; + this.buff = new Array(16); + } + + nextU32() { + if (this.idx == 16) this.update(); + return this.buff[this.idx++]; + } + + nextU64() { + return add(mul(this.nextU32(), 0x100000000), this.nextU32()); + } + + nextBool() { + return (this.nextU32() & 1) == 1; + } + + update() { + // Copy the state + for (let i=0; i<16; i++) this.buff[i] = this.state[i]; + + // Apply the rounds + for (let i=0; i<10; i++) doubleRound(this.buff); + + // Add to the initial + for (let i=0; i<16; i++) this.buff[i] = (this.buff[i] + this.state[i]) >>> 0; + + this.idx = 0; + + this.state[12] = (this.state[12] + 1) >>> 0; + if (this.state[12] != 0) return; + this.state[13] = (this.state[13] + 1) >>> 0; + if (this.state[13] != 0) return; + this.state[14] = (this.state[14] + 1) >>> 0; + if (this.state[14] != 0) return; + this.state[15] = (this.state[15] + 1) >>> 0; + } +} + +function getRandomBytes(n) { + let array = new Uint8Array(n); + { // Browser + if (typeof globalThis.crypto !== "undefined") { // Supported + globalThis.crypto.getRandomValues(array); + } else { // fallback + for (let i=0; i>>0; + } + } + } + return array; +} + +function getRandomSeed() { + const arr = getRandomBytes(32); + const arrV = new Uint32Array(arr.buffer); + const seed = []; + for (let i=0; i<8; i++) { + seed.push(arrV[i]); + } + return seed; +} + +let threadRng = null; + +function getThreadRng() { + if (threadRng) return threadRng; + threadRng = new ChaCha(getRandomSeed()); + return threadRng; +} + +/* + Copyright 2018 0kims association. + + This file is part of snarkjs. + + snarkjs is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. + + snarkjs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + snarkjs. If not, see . +*/ + +/* + This library does operations on polynomials with coefficients in a field F. + + A polynomial P(x) = p0 + p1 * x + p2 * x^2 + ... + pn * x^n is represented + by the array [ p0, p1, p2, ... , pn ]. + */ + +class FFT { + constructor (G, F, opMulGF) { + this.F = F; + this.G = G; + this.opMulGF = opMulGF; + + let rem = F.sqrt_t || F.t; + let s = F.sqrt_s || F.s; + + let nqr = F.one; + while (F.eq(F.pow(nqr, F.half), F.one)) nqr = F.add(nqr, F.one); + + this.w = new Array(s+1); + this.wi = new Array(s+1); + this.w[s] = this.F.pow(nqr, rem); + this.wi[s] = this.F.inv(this.w[s]); + + let n=s-1; + while (n>=0) { + this.w[n] = this.F.square(this.w[n+1]); + this.wi[n] = this.F.square(this.wi[n+1]); + n--; + } + + + this.roots = []; + /* + for (let i=0; i<16; i++) { + let r = this.F.one; + n = 1 << i; + const rootsi = new Array(n); + for (let j=0; j=0) && (!this.roots[i]); i--) { + let r = this.F.one; + const nroots = 1 << i; + const rootsi = new Array(nroots); + for (let j=0; j> 1; + const p1 = __fft(PF, pall, bits-1, offset, step*2); + const p2 = __fft(PF, pall, bits-1, offset+step, step*2); + + const out = new Array(n); + + for (let i=0; i> this.one; + this.bitLength = bitLength$6(this.p); + this.mask = (this.one << BigInt(this.bitLength)) - this.one; + + this.n64 = Math.floor((this.bitLength - 1) / 64)+1; + this.n32 = this.n64*2; + this.n8 = this.n64*8; + this.R = this.e(this.one << BigInt(this.n64*64)); + this.Ri = this.inv(this.R); + + const e = this.negone >> this.one; + this.nqr = this.two; + let r = this.pow(this.nqr, e); + while (!this.eq(r, this.negone)) { + this.nqr = this.nqr + this.one; + r = this.pow(this.nqr, e); + } + + + this.s = 0; + this.t = this.negone; + + while ((this.t & this.one) == this.zero) { + this.s = this.s + 1; + this.t = this.t >> this.one; + } + + this.nqr_to_t = this.pow(this.nqr, this.t); + + buildSqrt(this); + + this.FFT = new FFT(this, this, this.mul.bind(this)); + + this.fft = this.FFT.fft.bind(this.FFT); + this.ifft = this.FFT.ifft.bind(this.FFT); + this.w = this.FFT.w; + this.wi = this.FFT.wi; + + this.shift = this.square(this.nqr); + this.k = this.exp(this.nqr, 2**this.s); + } + + e(a,b) { + let res; + if (!b) { + res = BigInt(a); + } else if (b==16) { + res = BigInt("0x"+a); + } + if (res < 0) { + let nres = -res; + if (nres >= this.p) nres = nres % this.p; + return this.p - nres; + } else { + return (res>= this.p) ? res%this.p : res; + } + + } + + add(a, b) { + const res = a + b; + return res >= this.p ? res-this.p : res; + } + + sub(a, b) { + return (a >= b) ? a-b : this.p-b+a; + } + + neg(a) { + return a ? this.p-a : a; + } + + mul(a, b) { + return (a*b)%this.p; + } + + mulScalar(base, s) { + return (base * this.e(s)) % this.p; + } + + square(a) { + return (a*a) % this.p; + } + + eq(a, b) { + return a==b; + } + + neq(a, b) { + return a!=b; + } + + lt(a, b) { + const aa = (a > this.half) ? a - this.p : a; + const bb = (b > this.half) ? b - this.p : b; + return aa < bb; + } + + gt(a, b) { + const aa = (a > this.half) ? a - this.p : a; + const bb = (b > this.half) ? b - this.p : b; + return aa > bb; + } + + leq(a, b) { + const aa = (a > this.half) ? a - this.p : a; + const bb = (b > this.half) ? b - this.p : b; + return aa <= bb; + } + + geq(a, b) { + const aa = (a > this.half) ? a - this.p : a; + const bb = (b > this.half) ? b - this.p : b; + return aa >= bb; + } + + div(a, b) { + return this.mul(a, this.inv(b)); + } + + idiv(a, b) { + if (!b) throw new Error("Division by zero"); + return a / b; + } + + inv(a) { + if (!a) throw new Error("Division by zero"); + + let t = this.zero; + let r = this.p; + let newt = this.one; + let newr = a % this.p; + while (newr) { + let q = r/newr; + [t, newt] = [newt, t-q*newt]; + [r, newr] = [newr, r-q*newr]; + } + if (t= this.p ? res-this.p : res; + } + + bor(a, b) { + const res = ((a | b) & this.mask); + return res >= this.p ? res-this.p : res; + } + + bxor(a, b) { + const res = ((a ^ b) & this.mask); + return res >= this.p ? res-this.p : res; + } + + bnot(a) { + const res = a ^ this.mask; + return res >= this.p ? res-this.p : res; + } + + shl(a, b) { + if (Number(b) < this.bitLength) { + const res = (a << b) & this.mask; + return res >= this.p ? res-this.p : res; + } else { + const nb = this.p - b; + if (Number(nb) < this.bitLength) { + return a >> nb; + } else { + return this.zero; + } + } + } + + shr(a, b) { + if (Number(b) < this.bitLength) { + return a >> b; + } else { + const nb = this.p - b; + if (Number(nb) < this.bitLength) { + const res = (a << nb) & this.mask; + return res >= this.p ? res-this.p : res; + } else { + return 0; + } + } + } + + land(a, b) { + return (a && b) ? this.one : this.zero; + } + + lor(a, b) { + return (a || b) ? this.one : this.zero; + } + + lnot(a) { + return (a) ? this.zero : this.one; + } + + sqrt_old(n) { + + if (n == this.zero) return this.zero; + + // Test that have solution + const res = this.pow(n, this.negone >> this.one); + if ( res != this.one ) return null; + + let m = this.s; + let c = this.nqr_to_t; + let t = this.pow(n, this.t); + let r = this.pow(n, this.add(this.t, this.one) >> this.one ); + + while ( t != this.one ) { + let sq = this.square(t); + let i = 1; + while (sq != this.one ) { + i++; + sq = this.square(sq); + } + + // b = c ^ m-i-1 + let b = c; + for (let j=0; j< m-i-1; j ++) b = this.square(b); + + m = i; + c = this.square(b); + t = this.mul(t, c); + r = this.mul(r, b); + } + + if (r > (this.p >> this.one)) { + r = this.neg(r); + } + + return r; + } + + normalize(a, b) { + a = BigInt(a,b); + if (a < 0) { + let na = -a; + if (na >= this.p) na = na % this.p; + return this.p - na; + } else { + return (a>= this.p) ? a%this.p : a; + } + } + + random() { + const nBytes = (this.bitLength*2 / 8); + let res =this.zero; + for (let i=0; i this.half)&&(base == 10)) { + const v = this.p-a; + vs = "-"+v.toString(base); + } else { + vs = a.toString(base); + } + return vs; + } + + isZero(a) { + return a == this.zero; + } + + fromRng(rng) { + let v; + do { + v=this.zero; + for (let i=0; i= this.p); + v = (v * this.Ri) % this.p; // Convert from montgomery + return v; + } + + fft(a) { + return this.FFT.fft(a); + } + + ifft(a) { + return this.FFT.ifft(a); + } + + // Returns a buffer with Little Endian Representation + toRprLE(buff, o, e) { + toRprLE(buff, o, e, this.n64*8); + } + + // Returns a buffer with Big Endian Representation + toRprBE(buff, o, e) { + toRprBE(buff, o, e, this.n64*8); + } + + // Returns a buffer with Big Endian Montgomery Representation + toRprBEM(buff, o, e) { + return this.toRprBE(buff, o, this.mul(this.R, e)); + } + + toRprLEM(buff, o, e) { + return this.toRprLE(buff, o, this.mul(this.R, e)); + } + + + // Pases a buffer with Little Endian Representation + fromRprLE(buff, o) { + return fromRprLE(buff, o, this.n8); + } + + // Pases a buffer with Big Endian Representation + fromRprBE(buff, o) { + return fromRprBE(buff, o, this.n8); + } + + fromRprLEM(buff, o) { + return this.mul(this.fromRprLE(buff, o), this.Ri); + } + + fromRprBEM(buff, o) { + return this.mul(this.fromRprBE(buff, o), this.Ri); + } + + toObject(a) { + return a; + } +} + +/* + Copyright 2018 0kims association. + + This file is part of snarkjs. + + snarkjs is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. + + snarkjs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + snarkjs. If not, see . +*/ + + +class F2Field { + constructor(F, nonResidue) { + this.type="F2"; + this.F = F; + this.zero = [this.F.zero, this.F.zero]; + this.one = [this.F.one, this.F.zero]; + this.negone = this.neg(this.one); + this.nonResidue = nonResidue; + this.m = F.m*2; + this.p = F.p; + this.n64 = F.n64*2; + this.n32 = this.n64*2; + this.n8 = this.n64*8; + + buildSqrt(this); + } + + _mulByNonResidue(a) { + return this.F.mul(this.nonResidue, a); + } + + copy(a) { + return [this.F.copy(a[0]), this.F.copy(a[1])]; + } + + add(a, b) { + return [ + this.F.add(a[0], b[0]), + this.F.add(a[1], b[1]) + ]; + } + + double(a) { + return this.add(a,a); + } + + sub(a, b) { + return [ + this.F.sub(a[0], b[0]), + this.F.sub(a[1], b[1]) + ]; + } + + neg(a) { + return this.sub(this.zero, a); + } + + conjugate(a) { + return [ + a[0], + this.F.neg(a[1]) + ]; + } + + mul(a, b) { + const aA = this.F.mul(a[0] , b[0]); + const bB = this.F.mul(a[1] , b[1]); + + return [ + this.F.add( aA , this._mulByNonResidue(bB)), + this.F.sub( + this.F.mul( + this.F.add(a[0], a[1]), + this.F.add(b[0], b[1])), + this.F.add(aA, bB))]; + } + + inv(a) { + const t0 = this.F.square(a[0]); + const t1 = this.F.square(a[1]); + const t2 = this.F.sub(t0, this._mulByNonResidue(t1)); + const t3 = this.F.inv(t2); + return [ + this.F.mul(a[0], t3), + this.F.neg(this.F.mul( a[1], t3)) ]; + } + + div(a, b) { + return this.mul(a, this.inv(b)); + } + + square(a) { + const ab = this.F.mul(a[0] , a[1]); + + /* + [ + (a + b) * (a + non_residue * b) - ab - non_residue * ab, + ab + ab + ]; + */ + + return [ + this.F.sub( + this.F.mul( + this.F.add(a[0], a[1]) , + this.F.add( + a[0] , + this._mulByNonResidue(a[1]))), + this.F.add( + ab, + this._mulByNonResidue(ab))), + this.F.add(ab, ab) + ]; + } + + isZero(a) { + return this.F.isZero(a[0]) && this.F.isZero(a[1]); + } + + eq(a, b) { + return this.F.eq(a[0], b[0]) && this.F.eq(a[1], b[1]); + } + + mulScalar(base, e) { + return mulScalar(this, base, e); + } + + pow(base, e) { + return exp(this, base, e); + } + + exp(base, e) { + return exp(this, base, e); + } + + toString(a) { + return `[ ${this.F.toString(a[0])} , ${this.F.toString(a[1])} ]`; + } + + fromRng(rng) { + const c0 = this.F.fromRng(rng); + const c1 = this.F.fromRng(rng); + return [c0, c1]; + } + + gt(a, b) { + if (this.F.gt(a[0], b[0])) return true; + if (this.F.gt(b[0], a[0])) return false; + if (this.F.gt(a[1], b[1])) return true; + return false; + } + + geq(a, b) { + return this.gt(a, b) || this.eq(a, b); + } + + lt(a, b) { + return !this.geq(a,b); + } + + leq(a, b) { + return !this.gt(a,b); + } + + neq(a, b) { + return !this.eq(a,b); + } + + random() { + return [this.F.random(), this.F.random()]; + } + + + toRprLE(buff, o, e) { + this.F.toRprLE(buff, o, e[0]); + this.F.toRprLE(buff, o+this.F.n8, e[1]); + } + + toRprBE(buff, o, e) { + this.F.toRprBE(buff, o, e[1]); + this.F.toRprBE(buff, o+this.F.n8, e[0]); + } + + toRprLEM(buff, o, e) { + this.F.toRprLEM(buff, o, e[0]); + this.F.toRprLEM(buff, o+this.F.n8, e[1]); + } + + + toRprBEM(buff, o, e) { + this.F.toRprBEM(buff, o, e[1]); + this.F.toRprBEM(buff, o+this.F.n8, e[0]); + } + + fromRprLE(buff, o) { + o = o || 0; + const c0 = this.F.fromRprLE(buff, o); + const c1 = this.F.fromRprLE(buff, o+this.F.n8); + return [c0, c1]; + } + + fromRprBE(buff, o) { + o = o || 0; + const c1 = this.F.fromRprBE(buff, o); + const c0 = this.F.fromRprBE(buff, o+this.F.n8); + return [c0, c1]; + } + + fromRprLEM(buff, o) { + o = o || 0; + const c0 = this.F.fromRprLEM(buff, o); + const c1 = this.F.fromRprLEM(buff, o+this.F.n8); + return [c0, c1]; + } + + fromRprBEM(buff, o) { + o = o || 0; + const c1 = this.F.fromRprBEM(buff, o); + const c0 = this.F.fromRprBEM(buff, o+this.F.n8); + return [c0, c1]; + } + + toObject(a) { + return a; + } + +} + +/* + Copyright 2018 0kims association. + + This file is part of snarkjs. + + snarkjs is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. + + snarkjs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + snarkjs. If not, see . +*/ + + +class F3Field { + constructor(F, nonResidue) { + this.type="F3"; + this.F = F; + this.zero = [this.F.zero, this.F.zero, this.F.zero]; + this.one = [this.F.one, this.F.zero, this.F.zero]; + this.negone = this.neg(this.one); + this.nonResidue = nonResidue; + this.m = F.m*3; + this.p = F.p; + this.n64 = F.n64*3; + this.n32 = this.n64*2; + this.n8 = this.n64*8; + } + + _mulByNonResidue(a) { + return this.F.mul(this.nonResidue, a); + } + + copy(a) { + return [this.F.copy(a[0]), this.F.copy(a[1]), this.F.copy(a[2])]; + } + + add(a, b) { + return [ + this.F.add(a[0], b[0]), + this.F.add(a[1], b[1]), + this.F.add(a[2], b[2]) + ]; + } + + double(a) { + return this.add(a,a); + } + + sub(a, b) { + return [ + this.F.sub(a[0], b[0]), + this.F.sub(a[1], b[1]), + this.F.sub(a[2], b[2]) + ]; + } + + neg(a) { + return this.sub(this.zero, a); + } + + mul(a, b) { + + const aA = this.F.mul(a[0] , b[0]); + const bB = this.F.mul(a[1] , b[1]); + const cC = this.F.mul(a[2] , b[2]); + + return [ + this.F.add( + aA, + this._mulByNonResidue( + this.F.sub( + this.F.mul( + this.F.add(a[1], a[2]), + this.F.add(b[1], b[2])), + this.F.add(bB, cC)))), // aA + non_residue*((b+c)*(B+C)-bB-cC), + + this.F.add( + this.F.sub( + this.F.mul( + this.F.add(a[0], a[1]), + this.F.add(b[0], b[1])), + this.F.add(aA, bB)), + this._mulByNonResidue( cC)), // (a+b)*(A+B)-aA-bB+non_residue*cC + + this.F.add( + this.F.sub( + this.F.mul( + this.F.add(a[0], a[2]), + this.F.add(b[0], b[2])), + this.F.add(aA, cC)), + bB)]; // (a+c)*(A+C)-aA+bB-cC) + } + + inv(a) { + const t0 = this.F.square(a[0]); // t0 = a^2 ; + const t1 = this.F.square(a[1]); // t1 = b^2 ; + const t2 = this.F.square(a[2]); // t2 = c^2; + const t3 = this.F.mul(a[0],a[1]); // t3 = ab + const t4 = this.F.mul(a[0],a[2]); // t4 = ac + const t5 = this.F.mul(a[1],a[2]); // t5 = bc; + // c0 = t0 - non_residue * t5; + const c0 = this.F.sub(t0, this._mulByNonResidue(t5)); + // c1 = non_residue * t2 - t3; + const c1 = this.F.sub(this._mulByNonResidue(t2), t3); + const c2 = this.F.sub(t1, t4); // c2 = t1-t4 + + // t6 = (a * c0 + non_residue * (c * c1 + b * c2)).inv(); + const t6 = + this.F.inv( + this.F.add( + this.F.mul(a[0], c0), + this._mulByNonResidue( + this.F.add( + this.F.mul(a[2], c1), + this.F.mul(a[1], c2))))); + + return [ + this.F.mul(t6, c0), // t6*c0 + this.F.mul(t6, c1), // t6*c1 + this.F.mul(t6, c2)]; // t6*c2 + } + + div(a, b) { + return this.mul(a, this.inv(b)); + } + + square(a) { + const s0 = this.F.square(a[0]); // s0 = a^2 + const ab = this.F.mul(a[0], a[1]); // ab = a*b + const s1 = this.F.add(ab, ab); // s1 = 2ab; + const s2 = this.F.square( + this.F.add(this.F.sub(a[0],a[1]), a[2])); // s2 = (a - b + c)^2; + const bc = this.F.mul(a[1],a[2]); // bc = b*c + const s3 = this.F.add(bc, bc); // s3 = 2*bc + const s4 = this.F.square(a[2]); // s4 = c^2 + + + return [ + this.F.add( + s0, + this._mulByNonResidue(s3)), // s0 + non_residue * s3, + this.F.add( + s1, + this._mulByNonResidue(s4)), // s1 + non_residue * s4, + this.F.sub( + this.F.add( this.F.add(s1, s2) , s3 ), + this.F.add(s0, s4))]; // s1 + s2 + s3 - s0 - s4 + } + + isZero(a) { + return this.F.isZero(a[0]) && this.F.isZero(a[1]) && this.F.isZero(a[2]); + } + + eq(a, b) { + return this.F.eq(a[0], b[0]) && this.F.eq(a[1], b[1]) && this.F.eq(a[2], b[2]); + } + + affine(a) { + return [this.F.affine(a[0]), this.F.affine(a[1]), this.F.affine(a[2])]; + } + + mulScalar(base, e) { + return mulScalar(this, base, e); + } + + pow(base, e) { + return exp(this, base, e); + } + + exp(base, e) { + return exp(this, base, e); + } + + toString(a) { + return `[ ${this.F.toString(a[0])} , ${this.F.toString(a[1])}, ${this.F.toString(a[2])} ]`; + } + + fromRng(rng) { + const c0 = this.F.fromRng(rng); + const c1 = this.F.fromRng(rng); + const c2 = this.F.fromRng(rng); + return [c0, c1, c2]; + } + + gt(a, b) { + if (this.F.gt(a[0], b[0])) return true; + if (this.F.gt(b[0], a[0])) return false; + if (this.F.gt(a[1], b[1])) return true; + if (this.F.gt(b[1], a[1])) return false; + if (this.F.gt(a[2], b[2])) return true; + return false; + } + + + geq(a, b) { + return this.gt(a, b) || this.eq(a, b); + } + + lt(a, b) { + return !this.geq(a,b); + } + + leq(a, b) { + return !this.gt(a,b); + } + + neq(a, b) { + return !this.eq(a,b); + } + + random() { + return [this.F.random(), this.F.random(), this.F.random()]; + } + + + toRprLE(buff, o, e) { + this.F.toRprLE(buff, o, e[0]); + this.F.toRprLE(buff, o+this.F.n8, e[1]); + this.F.toRprLE(buff, o+this.F.n8*2, e[2]); + } + + toRprBE(buff, o, e) { + this.F.toRprBE(buff, o, e[2]); + this.F.toRprBE(buff, o+this.F.n8, e[1]); + this.F.toRprBE(buff, o+this.F.n8*2, e[0]); + } + + toRprLEM(buff, o, e) { + this.F.toRprLEM(buff, o, e[0]); + this.F.toRprLEM(buff, o+this.F.n8, e[1]); + this.F.toRprLEM(buff, o+this.F.n8*2, e[2]); + } + + + toRprBEM(buff, o, e) { + this.F.toRprBEM(buff, o, e[2]); + this.F.toRprBEM(buff, o+this.F.n8, e[1]); + this.F.toRprBEM(buff, o+this.F.n8*2, e[0]); + } + + fromRprLE(buff, o) { + o = o || 0; + const c0 = this.F.fromRprLE(buff, o); + const c1 = this.F.fromRprLE(buff, o+this.n8); + const c2 = this.F.fromRprLE(buff, o+this.n8*2); + return [c0, c1, c2]; + } + + fromRprBE(buff, o) { + o = o || 0; + const c2 = this.F.fromRprBE(buff, o); + const c1 = this.F.fromRprBE(buff, o+this.n8); + const c0 = this.F.fromRprBE(buff, o+this.n8*2); + return [c0, c1, c2]; + } + + fromRprLEM(buff, o) { + o = o || 0; + const c0 = this.F.fromRprLEM(buff, o); + const c1 = this.F.fromRprLEM(buff, o+this.n8); + const c2 = this.F.fromRprLEM(buff, o+this.n8*2); + return [c0, c1, c2]; + } + + fromRprBEM(buff, o) { + o = o || 0; + const c2 = this.F.fromRprBEM(buff, o); + const c1 = this.F.fromRprBEM(buff, o+this.n8); + const c0 = this.F.fromRprBEM(buff, o+this.n8*2); + return [c0, c1, c2]; + } + + toObject(a) { + return a; + } +} + +/* + Copyright 2018 0kims association. + + This file is part of snarkjs. + + snarkjs is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. + + snarkjs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + snarkjs. If not, see . +*/ + + + +function isGreatest(F, a) { + if (Array.isArray(a)) { + for (let i=a.length-1; i>=0; i--) { + if (!F.F.isZero(a[i])) { + return isGreatest(F.F, a[i]); + } + } + return 0; + } else { + const na = F.neg(a); + return gt(a, na); + } +} + + +class EC { + + constructor(F, g) { + this.F = F; + this.g = g; + if (this.g.length == 2) this.g[2] = this.F.one; + this.zero = [this.F.zero, this.F.one, this.F.zero]; + } + + add(p1, p2) { + + const F = this.F; + + if (this.eq(p1, this.zero)) return p2; + if (this.eq(p2, this.zero)) return p1; + + const res = new Array(3); + + const Z1Z1 = F.square( p1[2] ); + const Z2Z2 = F.square( p2[2] ); + + const U1 = F.mul( p1[0] , Z2Z2 ); // U1 = X1 * Z2Z2 + const U2 = F.mul( p2[0] , Z1Z1 ); // U2 = X2 * Z1Z1 + + const Z1_cubed = F.mul( p1[2] , Z1Z1); + const Z2_cubed = F.mul( p2[2] , Z2Z2); + + const S1 = F.mul( p1[1] , Z2_cubed); // S1 = Y1 * Z2 * Z2Z2 + const S2 = F.mul( p2[1] , Z1_cubed); // S2 = Y2 * Z1 * Z1Z1 + + if (F.eq(U1,U2) && F.eq(S1,S2)) { + return this.double(p1); + } + + const H = F.sub( U2 , U1 ); // H = U2-U1 + + const S2_minus_S1 = F.sub( S2 , S1 ); + + const I = F.square( F.add(H,H) ); // I = (2 * H)^2 + const J = F.mul( H , I ); // J = H * I + + const r = F.add( S2_minus_S1 , S2_minus_S1 ); // r = 2 * (S2-S1) + const V = F.mul( U1 , I ); // V = U1 * I + + res[0] = + F.sub( + F.sub( F.square(r) , J ), + F.add( V , V )); // X3 = r^2 - J - 2 * V + + const S1_J = F.mul( S1 , J ); + + res[1] = + F.sub( + F.mul( r , F.sub(V,res[0])), + F.add( S1_J,S1_J )); // Y3 = r * (V-X3)-2 S1 J + + res[2] = + F.mul( + H, + F.sub( + F.square( F.add(p1[2],p2[2]) ), + F.add( Z1Z1 , Z2Z2 ))); // Z3 = ((Z1+Z2)^2-Z1Z1-Z2Z2) * H + + return res; + } + + neg(p) { + return [p[0], this.F.neg(p[1]), p[2]]; + } + + sub(a, b) { + return this.add(a, this.neg(b)); + } + + double(p) { + const F = this.F; + + const res = new Array(3); + + if (this.eq(p, this.zero)) return p; + + const A = F.square( p[0] ); // A = X1^2 + const B = F.square( p[1] ); // B = Y1^2 + const C = F.square( B ); // C = B^2 + + let D = + F.sub( + F.square( F.add(p[0] , B )), + F.add( A , C)); + D = F.add(D,D); // D = 2 * ((X1 + B)^2 - A - C) + + const E = F.add( F.add(A,A), A); // E = 3 * A + const FF =F.square( E ); // F = E^2 + + res[0] = F.sub( FF , F.add(D,D) ); // X3 = F - 2 D + + let eightC = F.add( C , C ); + eightC = F.add( eightC , eightC ); + eightC = F.add( eightC , eightC ); + + res[1] = + F.sub( + F.mul( + E, + F.sub( D, res[0] )), + eightC); // Y3 = E * (D - X3) - 8 * C + + const Y1Z1 = F.mul( p[1] , p[2] ); + res[2] = F.add( Y1Z1 , Y1Z1 ); // Z3 = 2 * Y1 * Z1 + + return res; + } + + timesScalar(base, e) { + return mulScalar(this, base, e); + } + + mulScalar(base, e) { + return mulScalar(this, base, e); + } + + affine(p) { + const F = this.F; + if (this.isZero(p)) { + return this.zero; + } else if (F.eq(p[2], F.one)) { + return p; + } else { + const Z_inv = F.inv(p[2]); + const Z2_inv = F.square(Z_inv); + const Z3_inv = F.mul(Z2_inv, Z_inv); + + const res = new Array(3); + res[0] = F.mul(p[0],Z2_inv); + res[1] = F.mul(p[1],Z3_inv); + res[2] = F.one; + + return res; + } + } + + multiAffine(arr) { + const keys = Object.keys(arr); + const F = this.F; + const accMul = new Array(keys.length+1); + accMul[0] = F.one; + for (let i = 0; i< keys.length; i++) { + if (F.eq(arr[keys[i]][2], F.zero)) { + accMul[i+1] = accMul[i]; + } else { + accMul[i+1] = F.mul(accMul[i], arr[keys[i]][2]); + } + } + + accMul[keys.length] = F.inv(accMul[keys.length]); + + for (let i = keys.length-1; i>=0; i--) { + if (F.eq(arr[keys[i]][2], F.zero)) { + accMul[i] = accMul[i+1]; + arr[keys[i]] = this.zero; + } else { + const Z_inv = F.mul(accMul[i], accMul[i+1]); + accMul[i] = F.mul(arr[keys[i]][2], accMul[i+1]); + + const Z2_inv = F.square(Z_inv); + const Z3_inv = F.mul(Z2_inv, Z_inv); + + arr[keys[i]][0] = F.mul(arr[keys[i]][0],Z2_inv); + arr[keys[i]][1] = F.mul(arr[keys[i]][1],Z3_inv); + arr[keys[i]][2] = F.one; + } + } + + } + + eq(p1, p2) { + const F = this.F; + + if (this.F.eq(p1[2], this.F.zero)) return this.F.eq(p2[2], this.F.zero); + if (this.F.eq(p2[2], this.F.zero)) return false; + + const Z1Z1 = F.square( p1[2] ); + const Z2Z2 = F.square( p2[2] ); + + const U1 = F.mul( p1[0] , Z2Z2 ); + const U2 = F.mul( p2[0] , Z1Z1 ); + + const Z1_cubed = F.mul( p1[2] , Z1Z1); + const Z2_cubed = F.mul( p2[2] , Z2Z2); + + const S1 = F.mul( p1[1] , Z2_cubed); + const S2 = F.mul( p2[1] , Z1_cubed); + + return (F.eq(U1,U2) && F.eq(S1,S2)); + } + + isZero(p) { + return this.F.isZero(p[2]); + } + + toString(p) { + const cp = this.affine(p); + return `[ ${this.F.toString(cp[0])} , ${this.F.toString(cp[1])} ]`; + } + + fromRng(rng) { + const F = this.F; + let P = []; + let greatest; + do { + P[0] = F.fromRng(rng); + greatest = rng.nextBool(); + const x3b = F.add(F.mul(F.square(P[0]), P[0]), this.b); + P[1] = F.sqrt(x3b); + } while ((P[1] == null)||(F.isZero[P])); + + const s = isGreatest(F, P[1]); + if (greatest ^ s) P[1] = F.neg(P[1]); + P[2] = F.one; + + if (this.cofactor) { + P = this.mulScalar(P, this.cofactor); + } + + P = this.affine(P); + + return P; + + } + + toRprLE(buff, o, p) { + p = this.affine(p); + if (this.isZero(p)) { + const BuffV = new Uint8Array(buff, o, this.F.n8*2); + BuffV.fill(0); + return; + } + this.F.toRprLE(buff, o, p[0]); + this.F.toRprLE(buff, o+this.F.n8, p[1]); + } + + toRprBE(buff, o, p) { + p = this.affine(p); + if (this.isZero(p)) { + const BuffV = new Uint8Array(buff, o, this.F.n8*2); + BuffV.fill(0); + return; + } + this.F.toRprBE(buff, o, p[0]); + this.F.toRprBE(buff, o+this.F.n8, p[1]); + } + + toRprLEM(buff, o, p) { + p = this.affine(p); + if (this.isZero(p)) { + const BuffV = new Uint8Array(buff, o, this.F.n8*2); + BuffV.fill(0); + return; + } + this.F.toRprLEM(buff, o, p[0]); + this.F.toRprLEM(buff, o+this.F.n8, p[1]); + } + + toRprLEJM(buff, o, p) { + p = this.affine(p); + if (this.isZero(p)) { + const BuffV = new Uint8Array(buff, o, this.F.n8*2); + BuffV.fill(0); + return; + } + this.F.toRprLEM(buff, o, p[0]); + this.F.toRprLEM(buff, o+this.F.n8, p[1]); + this.F.toRprLEM(buff, o+2*this.F.n8, p[2]); + } + + + toRprBEM(buff, o, p) { + p = this.affine(p); + if (this.isZero(p)) { + const BuffV = new Uint8Array(buff, o, this.F.n8*2); + BuffV.fill(0); + return; + } + this.F.toRprBEM(buff, o, p[0]); + this.F.toRprBEM(buff, o+this.F.n8, p[1]); + } + + fromRprLE(buff, o) { + o = o || 0; + const x = this.F.fromRprLE(buff, o); + const y = this.F.fromRprLE(buff, o+this.F.n8); + if (this.F.isZero(x) && this.F.isZero(y)) { + return this.zero; + } + return [x, y, this.F.one]; + } + + fromRprBE(buff, o) { + o = o || 0; + const x = this.F.fromRprBE(buff, o); + const y = this.F.fromRprBE(buff, o+this.F.n8); + if (this.F.isZero(x) && this.F.isZero(y)) { + return this.zero; + } + return [x, y, this.F.one]; + } + + fromRprLEM(buff, o) { + o = o || 0; + const x = this.F.fromRprLEM(buff, o); + const y = this.F.fromRprLEM(buff, o+this.F.n8); + if (this.F.isZero(x) && this.F.isZero(y)) { + return this.zero; + } + return [x, y, this.F.one]; + } + + fromRprLEJM(buff, o) { + o = o || 0; + const x = this.F.fromRprLEM(buff, o); + const y = this.F.fromRprLEM(buff, o+this.F.n8); + const z = this.F.fromRprLEM(buff, o+this.F.n8*2); + if (this.F.isZero(x) && this.F.isZero(y)) { + return this.zero; + } + return [x, y, z]; + } + + fromRprBEM(buff, o) { + o = o || 0; + const x = this.F.fromRprBEM(buff, o); + const y = this.F.fromRprBEM(buff, o+this.F.n8); + if (this.F.isZero(x) && this.F.isZero(y)) { + return this.zero; + } + return [x, y, this.F.one]; + } + + fromRprCompressed(buff, o) { + const F = this.F; + const v = new Uint8Array(buff.buffer, o, F.n8); + if (v[0] & 0x40) return this.zero; + const P = new Array(3); + + const greatest = ((v[0] & 0x80) != 0); + v[0] = v[0] & 0x7F; + P[0] = F.fromRprBE(buff, o); + if (greatest) v[0] = v[0] | 0x80; // set back again the old value + + const x3b = F.add(F.mul(F.square(P[0]), P[0]), this.b); + P[1] = F.sqrt(x3b); + + if (P[1] === null) { + throw new Error("Invalid Point!"); + } + + const s = isGreatest(F, P[1]); + if (greatest ^ s) P[1] = F.neg(P[1]); + P[2] = F.one; + + return P; + } + + toRprCompressed(buff, o, p) { + p = this.affine(p); + const v = new Uint8Array(buff.buffer, o, this.F.n8); + if (this.isZero(p)) { + v.fill(0); + v[0] = 0x40; + return; + } + this.F.toRprBE(buff, o, p[0]); + + if (isGreatest(this.F, p[1])) { + v[0] = v[0] | 0x80; + } + } + + + fromRprUncompressed(buff, o) { + if (buff[0] & 0x40) return this.zero; + + return this.fromRprBE(buff, o); + } + + toRprUncompressed(buff, o, p) { + this.toRprBE(buff, o, p); + + if (this.isZero(p)) { + buff[o] = buff[o] | 0x40; + } + } + + +} + +function getDefaultExportFromCjs (x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; +} + +var utils$6 = {}; -/* provided dependency */ var console = __webpack_require__(96763); /* Copyright 2019 0KIMS association. - This file is part of websnark (Web Assembly zkSnark Prover). + This file is part of wasmsnark (Web Assembly zkSnark Prover). - websnark is a free software: you can redistribute it and/or modify it + wasmsnark is a free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - websnark is distributed in the hope that it will be useful, but WITHOUT + wasmsnark is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with websnark. If not, see . + along with wasmsnark. If not, see . */ -/* globals WebAssembly */ -const bigInt = __webpack_require__(92096); -const ModuleBuilder = __webpack_require__(80442); +utils$6.bigInt2BytesLE = function bigInt2BytesLE(_a, len) { + const b = Array(len); + let v = BigInt(_a); + for (let i=0; i> 8n; + } + return b; +}; -function buf2hex(buffer) { // buffer is an ArrayBuffer - return Array.prototype.map.call(new Uint8Array(buffer), x => ("00" + x.toString(16)).slice(-2)).join(""); -} +utils$6.bigInt2U32LE = function bigInt2BytesLE(_a, len) { + const b = Array(len); + let v = BigInt(_a); + for (let i=0; i> 32n; + } + return b; +}; +utils$6.isOcamNum = function(a) { + if (!Array.isArray(a)) return false; + if (a.length != 3) return false; + if (typeof a[0] !== "number") return false; + if (typeof a[1] !== "number") return false; + if (!Array.isArray(a[2])) return false; + return true; +}; -async function buildProtoboard(builder, defBytes, bitsPerBytes) { - const protoboard = new Protoboard(); +/* + Copyright 2019 0KIMS association. - protoboard.defBytes = defBytes; - protoboard.bitsPerBytes = bitsPerBytes || 32; + This file is part of wasmsnark (Web Assembly zkSnark Prover). - protoboard.memory = new WebAssembly.Memory({initial:20000}); - protoboard.i32 = new Uint32Array(protoboard.memory.buffer); - protoboard.i8 = new Uint8Array(protoboard.memory.buffer); + wasmsnark is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - const moduleBuilder = new ModuleBuilder(); + wasmsnark is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. - const fLog32 = moduleBuilder.addIimportFunction("debug_log32", "debug", "log32"); - fLog32.addParam("x", "i32"); - const fLog64 = moduleBuilder.addIimportFunction("debug_log64", "debug", "log64"); - fLog64.addParam("x", "i32"); - fLog64.addParam("y", "i32"); + You should have received a copy of the GNU General Public License + along with wasmsnark. If not, see . +*/ - buildLog32(moduleBuilder); - buildLog64(moduleBuilder); +var build_int = function buildInt(module, n64, _prefix) { - builder(moduleBuilder, protoboard); + const prefix = _prefix || "int"; + if (module.modules[prefix]) return prefix; // already builded + module.modules[prefix] = {}; + const n32 = n64*2; + const n8 = n64*8; - const code = moduleBuilder.build(); - - const wasmModule = await WebAssembly.compile(code); - - protoboard.log = console.log; - - protoboard.instance = await WebAssembly.instantiate(wasmModule, { - env: { - "memory": protoboard.memory - }, - debug: { - log32: function (c1) { - if (c1<0) c1 = 0x100000000+c1; - let s=c1.toString(16); - while (s.length<8) s = "0"+s; - protoboard.log(s + ": " + c1.toString()); - }, - log64: function (c1, c2) { - if (c1<0) c1 = 0x100000000+c1; - if (c2<0) c2 = 0x100000000+c2; - const n = bigInt(c1) + bigInt(c2).shiftLeft(32); - let s=n.toString(16); - while (s.length<16) s = "0"+s; - protoboard.log(s + ": " + n.toString()); - } - } - }); - - Object.assign(protoboard, protoboard.instance.exports); - Object.assign(protoboard, moduleBuilder.modules); - - return protoboard; - - function buildLog32(module) { - - const f = module.addFunction("log32"); - f.addParam("x", "i32"); + function buildCopy() { + const f = module.addFunction(prefix+"_copy"); + f.addParam("px", "i32"); + f.addParam("pr", "i32"); const c = f.getCodeBuilder(); - f.addCode(c.call("debug_log32", c.getLocal("x"))); + + for (let i=0; i>1) )&&(i>1, k>>1) + ) + ) + ); + + f.addCode( + c.setLocal(c1, + c.i64_add( + c.getLocal(c1), + c.i64_shr_u( + c.getLocal(c0), + c.i64_const(32) + ) + ) + ) + ); + } + + // Add the old carry + + if (k>0) { + f.addCode( + c.setLocal(c0, + c.i64_add( + c.i64_and( + c.getLocal(c0), + c.i64_const(0xFFFFFFFF) + ), + c.i64_and( + c.getLocal(c0_old), + c.i64_const(0xFFFFFFFF) + ), + ) + ) + ); + + f.addCode( + c.setLocal(c1, + c.i64_add( + c.i64_add( + c.getLocal(c1), + c.i64_shr_u( + c.getLocal(c0), + c.i64_const(32) + ) + ), + c.getLocal(c1_old) + ) + ) + ); + } + + f.addCode( + c.i64_store32( + c.getLocal("r"), + k*4, + c.getLocal(c0) + ) + ); + + f.addCode( + c.setLocal( + c0_old, + c.getLocal(c1) + ), + c.setLocal( + c1_old, + c.i64_shr_u( + c.getLocal(c0_old), + c.i64_const(32) + ) + ) + ); + + } + f.addCode( + c.i64_store32( + c.getLocal("r"), + n32*4*2-4, + c.getLocal(c0_old) + ) + ); + + } + + + function buildSquareOld() { + const f = module.addFunction(prefix+"_squareOld"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode(c.call(prefix + "_mul", c.getLocal("x"), c.getLocal("x"), c.getLocal("r"))); + } + + function _buildMul1() { + const f = module.addFunction(prefix+"__mul1"); + f.addParam("px", "i32"); + f.addParam("y", "i64"); + f.addParam("pr", "i32"); + f.addLocal("c", "i64"); + + const c = f.getCodeBuilder(); + + f.addCode(c.setLocal( + "c", + c.i64_mul( + c.i64_load32_u(c.getLocal("px"), 0, 0), + c.getLocal("y") + ) + )); + + f.addCode(c.i64_store32( + c.getLocal("pr"), + 0, + 0, + c.getLocal("c"), + )); + + for (let i=1; i3)&&(Y[eY]==0) ey--; + f.addCode(c.block(c.loop( + c.br_if( + 1, + c.i32_or( + c.i32_load8_u( + c.i32_add(Y , c.getLocal("eY")), + 0, + 0 + ), + c.i32_eq( + c.getLocal("eY"), + c.i32_const(3) + ) + ) + ), + c.setLocal("eY", c.i32_sub(c.getLocal("eY"), c.i32_const(1))), + c.br(0) + ))); + + f.addCode( + c.setLocal( + "sy", + c.i64_add( + c.i64_load32_u( + c.i32_sub( + c.i32_add( Y, c.getLocal("eY")), + c.i32_const(3) + ), + 0, + 0 + ), + c.i64_const(1) + ) ) + ); + + // Force a divide by 0 if quotien is 0 + f.addCode( + c.if( + c.i64_eq( + c.getLocal("sy"), + c.i64_const(1) + ), + c.drop(c.i64_div_u(c.i64_const(0), c.i64_const(0))) + ) + ); + + f.addCode(c.block(c.loop( + + // while (eX>7)&&(Y[eX]==0) ex--; + c.block(c.loop( + c.br_if( + 1, + c.i32_or( + c.i32_load8_u( + c.i32_add(R , c.getLocal("eX")), + 0, + 0 + ), + c.i32_eq( + c.getLocal("eX"), + c.i32_const(7) + ) + ) + ), + c.setLocal("eX", c.i32_sub(c.getLocal("eX"), c.i32_const(1))), + c.br(0) + )), + + c.setLocal( + "sx", + c.i64_load( + c.i32_sub( + c.i32_add( R, c.getLocal("eX")), + c.i32_const(7) + ), + 0, + 0 + ) + ), + + c.setLocal( + "sx", + c.i64_div_u( + c.getLocal("sx"), + c.getLocal("sy") + ) + ), + c.setLocal( + "ec", + c.i32_sub( + c.i32_sub( + c.getLocal("eX"), + c.getLocal("eY") + ), + c.i32_const(4) + ) + ), + + // While greater than 32 bits or ec is neg, shr and inc exp + c.block(c.loop( + c.br_if( + 1, + c.i32_and( + c.i64_eqz( + c.i64_and( + c.getLocal("sx"), + c.i64_const("0xFFFFFFFF00000000") + ) + ), + c.i32_ge_s( + c.getLocal("ec"), + c.i32_const(0) + ) + ) + ), + + c.setLocal( + "sx", + c.i64_shr_u( + c.getLocal("sx"), + c.i64_const(8) + ) + ), + + c.setLocal( + "ec", + c.i32_add( + c.getLocal("ec"), + c.i32_const(1) + ) + ), + c.br(0) + )), + + c.if( + c.i64_eqz(c.getLocal("sx")), + [ + ...c.br_if( + 2, + c.i32_eqz(c.call(prefix + "_gte", R, Y)) + ), + ...c.setLocal("sx", c.i64_const(1)), + ...c.setLocal("ec", c.i32_const(0)) + ] + ), + + c.call(prefix + "__mul1", Y, c.getLocal("sx"), R2), + c.drop(c.call( + prefix + "_sub", + R, + c.i32_sub(R2, c.getLocal("ec")), + R + )), + c.call( + prefix + "__add1", + c.i32_add(C, c.getLocal("ec")), + c.getLocal("sx") + ), + c.br(0) + ))); + } + + function buildInverseMod() { + + const f = module.addFunction(prefix+"_inverseMod"); + f.addParam("px", "i32"); + f.addParam("pm", "i32"); + f.addParam("pr", "i32"); + f.addLocal("t", "i32"); + f.addLocal("newt", "i32"); + f.addLocal("r", "i32"); + f.addLocal("qq", "i32"); + f.addLocal("qr", "i32"); + f.addLocal("newr", "i32"); + f.addLocal("swp", "i32"); + f.addLocal("x", "i32"); + f.addLocal("signt", "i32"); + f.addLocal("signnewt", "i32"); + f.addLocal("signx", "i32"); + + const c = f.getCodeBuilder(); + + const aux1 = c.i32_const(module.alloc(n8)); + const aux2 = c.i32_const(module.alloc(n8)); + const aux3 = c.i32_const(module.alloc(n8)); + const aux4 = c.i32_const(module.alloc(n8)); + const aux5 = c.i32_const(module.alloc(n8)); + const aux6 = c.i32_const(module.alloc(n8)); + const mulBuff = c.i32_const(module.alloc(n8*2)); + const aux7 = c.i32_const(module.alloc(n8)); + + f.addCode( + c.setLocal("t", aux1), + c.call(prefix + "_zero", aux1), + c.setLocal("signt", c.i32_const(0)), + ); + + f.addCode( + c.setLocal("r", aux2), + c.call(prefix + "_copy", c.getLocal("pm"), aux2) + ); + + f.addCode( + c.setLocal("newt", aux3), + c.call(prefix + "_one", aux3), + c.setLocal("signnewt", c.i32_const(0)), + ); + + f.addCode( + c.setLocal("newr", aux4), + c.call(prefix + "_copy", c.getLocal("px"), aux4) + ); + + + + + f.addCode(c.setLocal("qq", aux5)); + f.addCode(c.setLocal("qr", aux6)); + f.addCode(c.setLocal("x", aux7)); + + f.addCode(c.block(c.loop( + c.br_if( + 1, + c.call(prefix + "_isZero", c.getLocal("newr") ) + ), + c.call(prefix + "_div", c.getLocal("r"), c.getLocal("newr"), c.getLocal("qq"), c.getLocal("qr")), + + c.call(prefix + "_mul", c.getLocal("qq"), c.getLocal("newt"), mulBuff), + + c.if( + c.getLocal("signt"), + c.if( + c.getLocal("signnewt"), + c.if ( + c.call(prefix + "_gte", mulBuff, c.getLocal("t")), + [ + ...c.drop(c.call(prefix + "_sub", mulBuff, c.getLocal("t"), c.getLocal("x"))), + ...c.setLocal("signx", c.i32_const(0)) + ], + [ + ...c.drop(c.call(prefix + "_sub", c.getLocal("t"), mulBuff, c.getLocal("x"))), + ...c.setLocal("signx", c.i32_const(1)) + ], + ), + [ + ...c.drop(c.call(prefix + "_add", mulBuff, c.getLocal("t"), c.getLocal("x"))), + ...c.setLocal("signx", c.i32_const(1)) + ] + ), + c.if( + c.getLocal("signnewt"), + [ + ...c.drop(c.call(prefix + "_add", mulBuff, c.getLocal("t"), c.getLocal("x"))), + ...c.setLocal("signx", c.i32_const(0)) + ], + c.if ( + c.call(prefix + "_gte", c.getLocal("t"), mulBuff), + [ + ...c.drop(c.call(prefix + "_sub", c.getLocal("t"), mulBuff, c.getLocal("x"))), + ...c.setLocal("signx", c.i32_const(0)) + ], + [ + ...c.drop(c.call(prefix + "_sub", mulBuff, c.getLocal("t"), c.getLocal("x"))), + ...c.setLocal("signx", c.i32_const(1)) + ] + ) + ) + ), + + c.setLocal("swp", c.getLocal("t")), + c.setLocal("t", c.getLocal("newt")), + c.setLocal("newt", c.getLocal("x")), + c.setLocal("x", c.getLocal("swp")), + + c.setLocal("signt", c.getLocal("signnewt")), + c.setLocal("signnewt", c.getLocal("signx")), + + c.setLocal("swp", c.getLocal("r")), + c.setLocal("r", c.getLocal("newr")), + c.setLocal("newr", c.getLocal("qr")), + c.setLocal("qr", c.getLocal("swp")), + + c.br(0) + ))); + + f.addCode(c.if( + c.getLocal("signt"), + c.drop(c.call(prefix + "_sub", c.getLocal("pm"), c.getLocal("t"), c.getLocal("pr"))), + c.call(prefix + "_copy", c.getLocal("t"), c.getLocal("pr")) )); } -} -class Protoboard { + buildCopy(); + buildZero(); + buildIsZero(); + buildOne(); + buildEq(); + buildGte(); + buildAdd(); + buildSub(); + buildMul(); + buildSquare(); + buildSquareOld(); + buildDiv(); + buildInverseMod(); + module.exportFunction(prefix+"_copy"); + module.exportFunction(prefix+"_zero"); + module.exportFunction(prefix+"_one"); + module.exportFunction(prefix+"_isZero"); + module.exportFunction(prefix+"_eq"); + module.exportFunction(prefix+"_gte"); + module.exportFunction(prefix+"_add"); + module.exportFunction(prefix+"_sub"); + module.exportFunction(prefix+"_mul"); + module.exportFunction(prefix+"_square"); + module.exportFunction(prefix+"_squareOld"); + module.exportFunction(prefix+"_div"); + module.exportFunction(prefix+"_inverseMod"); - constructor() { - - } - - alloc(length) { - if (typeof length === "undefined") { - length = this.defBytes; - } - length = (((length-1)>>3) +1)<<3; // Align to 64 bits. - - const res = this.i32[0]; - this.i32[0] += length; - return res; - } - - set(pos, nums, nBytes) { - if (!Array.isArray(nums)) { - nums = [nums]; - } - if (typeof nBytes === "undefined") { - nBytes = this.defBytes; - } - - const words = Math.floor((nBytes -1)/4)+1; - let p = pos; - - const CHUNK = bigInt.one.shiftLeft(this.bitsPerBytes); - - for (let i=0; i>2] = rd.remainder.toJSNumber(); - v = rd.quotient; - p += 4; - } - if (!v.isZero()) { - throw new Error('Expected v to be 0'); - } -/* this.i32[p>>2] = bigInt(nums[i]).shiftRight( (words-1)*this.bitsPerBytes).toJSNumber(); - p += 4; -*/ } - - return pos; - } - - get(pos, nElements, nBytes) { - if (typeof nBytes == "undefined") { - if (typeof nElements == "undefined") { - nElements = 1; - nBytes = this.defBytes; - } else { - nElements = nBytes; - nBytes = this.defBytes; - } - } - - const words = Math.floor((nBytes -1)/4)+1; - - const CHUNK = bigInt.one.shiftLeft(this.bitsPerBytes); - - - const nums = []; - for (let i=0; i=0; j--) { - acc = acc.times(CHUNK); - let v = this.i32[(pos>>2)+j]; - if (this.bitsPerBytes <32) { - if (v&0x80000000) v = v-0x100000000; - } - acc = acc.add(v); - } - nums.push(acc); - pos += words*4; - } - - if (nums.length == 1) return nums[0]; - return nums; - } -} - -module.exports = buildProtoboard; - - -/***/ }), - -/***/ 60484: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmbuilder - - wasmbuilder is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmbuilder is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmbuilder. If not, see . -*/ - -const bigInt = __webpack_require__(92096); - -function toNumber(n) { - let v; - if (typeof n=="string") { - if (n.slice(0,2).toLowerCase() == "0x") { - v = bigInt(n.slice(2),16); - } else { - v = bigInt(n); - } - } else { - v = bigInt(n); - } - return v; -} - -function u32(n) { - const b = []; - const v = toNumber(n); - b.push(v.and(0xFF).toJSNumber()); - b.push(v.shiftRight(8).and(0xFF).toJSNumber()); - b.push(v.shiftRight(16).and(0xFF).toJSNumber()); - b.push(v.shiftRight(24).and(0xFF).toJSNumber()); - return b; -} - -function u64(n) { - const b = []; - const v = toNumber(n); - b.push(v.and(0xFF).toJSNumber()); - b.push(v.shiftRight(8).and(0xFF).toJSNumber()); - b.push(v.shiftRight(16).and(0xFF).toJSNumber()); - b.push(v.shiftRight(24).and(0xFF).toJSNumber()); - b.push(v.shiftRight(32).and(0xFF).toJSNumber()); - b.push(v.shiftRight(40).and(0xFF).toJSNumber()); - b.push(v.shiftRight(48).and(0xFF).toJSNumber()); - b.push(v.shiftRight(56).and(0xFF).toJSNumber()); - return b; -} - -function toUTF8Array(str) { - var utf8 = []; - for (var i=0; i < str.length; i++) { - var charcode = str.charCodeAt(i); - if (charcode < 0x80) utf8.push(charcode); - else if (charcode < 0x800) { - utf8.push(0xc0 | (charcode >> 6), - 0x80 | (charcode & 0x3f)); - } - else if (charcode < 0xd800 || charcode >= 0xe000) { - utf8.push(0xe0 | (charcode >> 12), - 0x80 | ((charcode>>6) & 0x3f), - 0x80 | (charcode & 0x3f)); - } - // surrogate pair - else { - i++; - // UTF-16 encodes 0x10000-0x10FFFF by - // subtracting 0x10000 and splitting the - // 20 bits of 0x0-0xFFFFF into two halves - charcode = 0x10000 + (((charcode & 0x3ff)<<10) - | (str.charCodeAt(i) & 0x3ff)); - utf8.push(0xf0 | (charcode >>18), - 0x80 | ((charcode>>12) & 0x3f), - 0x80 | ((charcode>>6) & 0x3f), - 0x80 | (charcode & 0x3f)); - } - } - return utf8; -} - -function string(str) { - const bytes = toUTF8Array(str); - return [ ...varuint32(bytes.length), ...bytes ]; -} - -function varuint(n) { - const code = []; - let v = toNumber(n); - if (v.isNegative()) throw new Error("Number cannot be negative"); - while (!v.isZero()) { - code.push(v.and(0x7F).toJSNumber()); - v = v.shiftRight(7); - } - if (code.length==0) code.push(0); - for (let i=0; i { + return prefix; +}; /* Copyright 2019 0KIMS association. @@ -111624,3285 +155809,78 @@ module.exports.ident = ident; along with wasmsnark. If not, see . */ - -// module.exports.bn128_wasm = require("./build/bn128_wasm.js"); -// module.exports.bls12381_wasm = require("./build/bls12381_wasm.js"); -// module.exports.mnt6753_wasm = require("./build/mnt6753_wasm.js"); - -module.exports.buildBn128 = __webpack_require__(23584); -module.exports.buildBls12381 = __webpack_require__(26920); -// module.exports.buildMnt6753 = require("./src/mnt6753/build_mnt7.js"); - - -/***/ }), - -/***/ 26920: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const bigInt = __webpack_require__(92096); -const utils = __webpack_require__(12333); - -const buildF1m =__webpack_require__(70075); -const buildF1 =__webpack_require__(38138); -const buildF2m =__webpack_require__(15420); -const buildF3m =__webpack_require__(77173); -const buildCurve =__webpack_require__(15904); -const buildFFT = __webpack_require__(93911); -const buildPol = __webpack_require__(2896); -const buildQAP = __webpack_require__(10637); -const buildApplyKey = __webpack_require__(23320); - -// Definition here: https://electriccoin.co/blog/new-snark-curve/ - -module.exports = function buildBLS12381(module, _prefix) { - - const prefix = _prefix || "bls12381"; - - if (module.modules[prefix]) return prefix; // already builded - - const q = bigInt("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab", 16); - const r = bigInt("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001", 16); - - const n64q = Math.floor((q.minus(1).bitLength() - 1)/64) +1; - const n8q = n64q*8; - const f1size = n8q; - const f2size = f1size * 2; - const f6size = f1size * 6; - const ftsize = f1size * 12; - - const n64r = Math.floor((r.minus(1).bitLength() - 1)/64) +1; - const n8r = n64r*8; - const frsize = n8r; - - - const pr = module.alloc(utils.bigInt2BytesLE( r, frsize )); - - const f1mPrefix = buildF1m(module, q, "f1m", "intq"); - buildF1(module, r, "fr", "frm", "intr"); - const pG1b = module.alloc(utils.bigInt2BytesLE( toMontgomery(bigInt(4)), f1size )); - const g1mPrefix = buildCurve(module, "g1m", "f1m", pG1b); - - buildFFT(module, "frm", "frm", "frm", "frm_mul"); - - buildPol(module, "pol", "frm"); - buildQAP(module, "qap", "frm"); - - const f2mPrefix = buildF2m(module, "f1m_neg", "f2m", "f1m"); - const pG2b = module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery(bigInt("4")), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(bigInt("4")), f1size ) - ]); - const g2mPrefix = buildCurve(module, "g2m", "f2m", pG2b); - - - function buildGTimesFr(fnName, opMul) { - const f = module.addFunction(fnName); - f.addParam("pG", "i32"); - f.addParam("pFr", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - const AUX = c.i32_const(module.alloc(n8r)); - - f.addCode( - c.call("frm_fromMontgomery", c.getLocal("pFr"), AUX), - c.call( - opMul, - c.getLocal("pG"), - AUX, - c.i32_const(n8r), - c.getLocal("pr") - ) - ); - - module.exportFunction(fnName); - } - buildGTimesFr("g1m_timesFr", "g1m_timesScalar"); - buildFFT(module, "g1m", "g1m", "frm", "g1m_timesFr"); - - buildGTimesFr("g2m_timesFr", "g2m_timesScalar"); - buildFFT(module, "g2m", "g2m", "frm", "g2m_timesFr"); - - buildGTimesFr("g1m_timesFrAffine", "g1m_timesScalarAffine"); - buildGTimesFr("g2m_timesFrAffine", "g2m_timesScalarAffine"); - - buildApplyKey(module, "frm_batchApplyKey", "fmr", "frm", n8r, n8r, n8r, "frm_mul"); - buildApplyKey(module, "g1m_batchApplyKey", "g1m", "frm", n8q*3, n8q*3, n8r, "g1m_timesFr"); - buildApplyKey(module, "g1m_batchApplyKeyMixed", "g1m", "frm", n8q*2, n8q*3, n8r, "g1m_timesFrAffine"); - buildApplyKey(module, "g2m_batchApplyKey", "g2m", "frm", n8q*2*3, n8q*3*2, n8r, "g2m_timesFr"); - buildApplyKey(module, "g2m_batchApplyKeyMixed", "g2m", "frm", n8q*2*2, n8q*3*2, n8r, "g2m_timesFrAffine"); - - - function toMontgomery(a) { - return bigInt(a).times( bigInt.one.shiftLeft(f1size*8)).mod(q); - } - - const G1gen = [ - bigInt("3685416753713387016781088315183077757961620795782546409894578378688607592378376318836054947676345821548104185464507"), - bigInt("1339506544944476473020471379941921221584933875938349620426543736416511423956333506472724655353366534992391756441569"), - bigInt.one - ]; - - const pG1gen = module.alloc( - [ - ...utils.bigInt2BytesLE( toMontgomery(G1gen[0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G1gen[1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G1gen[2]), f1size ), - ] - ); - - const G1zero = [ - bigInt.zero, - bigInt.one, - bigInt.zero - ]; - - const pG1zero = module.alloc( - [ - ...utils.bigInt2BytesLE( toMontgomery(G1zero[0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G1zero[1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G1zero[2]), f1size ) - ] - ); - - const G2gen = [ - [ - bigInt("352701069587466618187139116011060144890029952792775240219908644239793785735715026873347600343865175952761926303160"), - bigInt("3059144344244213709971259814753781636986470325476647558659373206291635324768958432433509563104347017837885763365758"), - ],[ - bigInt("1985150602287291935568054521177171638300868978215655730859378665066344726373823718423869104263333984641494340347905"), - bigInt("927553665492332455747201965776037880757740193453592970025027978793976877002675564980949289727957565575433344219582"), - ],[ - bigInt.one, - bigInt.zero, - ] - ]; - - const pG2gen = module.alloc( - [ - ...utils.bigInt2BytesLE( toMontgomery(G2gen[0][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2gen[0][1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2gen[1][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2gen[1][1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2gen[2][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2gen[2][1]), f1size ), - ] - ); - - const G2zero = [ - [ - bigInt.zero, - bigInt.zero, - ],[ - bigInt.one, - bigInt.zero, - ],[ - bigInt.zero, - bigInt.zero, - ] - ]; - - const pG2zero = module.alloc( - [ - ...utils.bigInt2BytesLE( toMontgomery(G2zero[0][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2zero[0][1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2zero[1][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2zero[1][1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2zero[2][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2zero[2][1]), f1size ), - ] - ); - - const pOneT = module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery(1), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ]); - - const pTwoInv = module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery( bigInt(2).modInv(q)), f1size ), - ...utils.bigInt2BytesLE( bigInt(0), f1size ) - ]); - - const pBls12381Twist = module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery(1), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(1), f1size ), - ]); - - const pTwistCoefB = module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery("4"), f1size ), - ...utils.bigInt2BytesLE( toMontgomery("4"), f1size ), - ]); - - function build_mulNR2() { - const f = module.addFunction(f2mPrefix + "_mulNR"); - f.addParam("x", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - const x0c = c.i32_const(module.alloc(f1size)); - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1size)); - const r0 = c.getLocal("pr"); - const r1 = c.i32_add(c.getLocal("pr"), c.i32_const(f1size)); - - f.addCode( - c.call(f1mPrefix+"_copy", x0, x0c), - c.call(f1mPrefix+"_sub", x0, x1, r0), - c.call(f1mPrefix+"_add", x0c, x1, r1), - ); - } - build_mulNR2(); - - const f6mPrefix = buildF3m(module, f2mPrefix+"_mulNR", "f6m", "f2m"); - - function build_mulNR6() { - const f = module.addFunction(f6mPrefix + "_mulNR"); - f.addParam("x", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - const c0copy = c.i32_const(module.alloc(f1size*2)); - - f.addCode( - c.call( - f2mPrefix + "_copy", - c.getLocal("x"), - c0copy - ), - c.call( - f2mPrefix + "_mulNR", - c.i32_add(c.getLocal("x"), c.i32_const(n8q*4)), - c.getLocal("pr") - ), - c.call( - f2mPrefix + "_copy", - c.i32_add(c.getLocal("x"), c.i32_const(n8q*2)), - c.i32_add(c.getLocal("pr"), c.i32_const(n8q*4)), - ), - c.call( - f2mPrefix + "_copy", - c0copy, - c.i32_add(c.getLocal("pr"), c.i32_const(n8q*2)), - ), - ); - } - build_mulNR6(); - - const ftmPrefix = buildF2m(module, f6mPrefix+"_mulNR", "ftm", f6mPrefix); - - const ateLoopCount = bigInt("d201000000010000", 16); - const ateLoopBitBytes = bits(ateLoopCount); - const pAteLoopBitBytes = module.alloc(ateLoopBitBytes); - const isLoopNegative = true; - - const ateCoefSize = 3 * f2size; - const ateNDblCoefs = ateLoopBitBytes.length-1; - const ateNAddCoefs = ateLoopBitBytes.reduce((acc, b) => acc + ( b!=0 ? 1 : 0) ,0); - const ateNCoefs = ateNAddCoefs + ateNDblCoefs + 1; - const prePSize = 3*2*n8q; - const preQSize = 3*n8q*2 + ateNCoefs*ateCoefSize; - const finalExpIsNegative = true; - - const finalExpZ = bigInt("15132376222941642752"); - - - module.modules[prefix] = { - n64q: n64q, - n64r: n64r, - n8q: n8q, - n8r: n8r, - pG1gen: pG1gen, - pG1zero: pG1zero, - pG1b: pG1b, - pG2gen: pG2gen, - pG2zero: pG2zero, - pG2b: pG2b, - pq: module.modules["f1m"].pq, - pr: pr, - pOneT: pOneT, - r: r, - q: q, - prePSize: prePSize, - preQSize: preQSize - }; - - - function naf(n) { - let E = n; - const res = []; - while (E.gt(bigInt.zero)) { - if (E.isOdd()) { - const z = 2 - E.mod(4).toJSNumber(); - res.push( z ); - E = E.minus(z); - } else { - res.push( 0 ); - } - E = E.shiftRight(1); - } - return res; - } - - function bits(n) { - let E = n; - const res = []; - while (E.gt(bigInt.zero)) { - if (E.isOdd()) { - res.push( 1 ); - } else { - res.push( 0 ); - } - E = E.shiftRight(1); - } - return res; - } - - function buildPrepareG1() { - const f = module.addFunction(prefix+ "_prepareG1"); - f.addParam("pP", "i32"); - f.addParam("ppreP", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call(g1mPrefix + "_normalize", c.getLocal("pP"), c.getLocal("ppreP")), // TODO Remove if already in affine - ); - } - - - - function buildPrepDoubleStep() { - const f = module.addFunction(prefix+ "_prepDblStep"); - f.addParam("R", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const Rx = c.getLocal("R"); - const Ry = c.i32_add(c.getLocal("R"), c.i32_const(2*n8q)); - const Rz = c.i32_add(c.getLocal("R"), c.i32_const(4*n8q)); - - const t0 = c.getLocal("r"); - const t3 = c.i32_add(c.getLocal("r"), c.i32_const(2*n8q)); - const t6 = c.i32_add(c.getLocal("r"), c.i32_const(4*n8q)); - - - const zsquared = c.i32_const(module.alloc(f2size)); - const t1 = c.i32_const(module.alloc(f2size)); - const t2 = c.i32_const(module.alloc(f2size)); - const t4 = c.i32_const(module.alloc(f2size)); - const t5 = c.i32_const(module.alloc(f2size)); - - f.addCode( - - // tmp0 = r.x.square(); - c.call(f2mPrefix + "_square", Rx, t0), - - // tmp1 = r.y.square(); - c.call(f2mPrefix + "_square", Ry, t1), - - // tmp2 = tmp1.square(); - c.call(f2mPrefix + "_square", t1, t2), - - // tmp3 = (tmp1 + r.x).square() - tmp0 - tmp2; - c.call(f2mPrefix + "_add", t1, Rx, t3), - c.call(f2mPrefix + "_square", t3, t3), - c.call(f2mPrefix + "_sub", t3, t0, t3), - c.call(f2mPrefix + "_sub", t3, t2, t3), - - // tmp3 = tmp3 + tmp3; - c.call(f2mPrefix + "_add", t3, t3, t3), - - // tmp4 = tmp0 + tmp0 + tmp0; - c.call(f2mPrefix + "_add", t0, t0, t4), - c.call(f2mPrefix + "_add", t4, t0, t4), - - // tmp6 = r.x + tmp4; - c.call(f2mPrefix + "_add", Rx, t4, t6), - - // tmp5 = tmp4.square(); - c.call(f2mPrefix + "_square", t4, t5), - - // zsquared = r.z.square(); - c.call(f2mPrefix + "_square", Rz, zsquared), - - // r.x = tmp5 - tmp3 - tmp3; - c.call(f2mPrefix + "_sub", t5, t3, Rx), - c.call(f2mPrefix + "_sub", Rx, t3, Rx), - - // r.z = (r.z + r.y).square() - tmp1 - zsquared; - c.call(f2mPrefix + "_add", Rz, Ry, Rz), - c.call(f2mPrefix + "_square", Rz, Rz), - c.call(f2mPrefix + "_sub", Rz, t1, Rz), - c.call(f2mPrefix + "_sub", Rz, zsquared, Rz), - - // r.y = (tmp3 - r.x) * tmp4; - c.call(f2mPrefix + "_sub", t3, Rx, Ry), - c.call(f2mPrefix + "_mul", Ry, t4, Ry), - - // tmp2 = tmp2 + tmp2; - c.call(f2mPrefix + "_add", t2, t2, t2), - - // tmp2 = tmp2 + tmp2; - c.call(f2mPrefix + "_add", t2, t2, t2), - - // tmp2 = tmp2 + tmp2; - c.call(f2mPrefix + "_add", t2, t2, t2), - - // r.y -= tmp2; - c.call(f2mPrefix + "_sub", Ry, t2, Ry), - - // tmp3 = tmp4 * zsquared; - c.call(f2mPrefix + "_mul", t4, zsquared, t3), - - // tmp3 = tmp3 + tmp3; - c.call(f2mPrefix + "_add", t3, t3, t3), - - // tmp3 = -tmp3; - c.call(f2mPrefix + "_neg", t3, t3), - - // tmp6 = tmp6.square() - tmp0 - tmp5; - c.call(f2mPrefix + "_square", t6, t6), - c.call(f2mPrefix + "_sub", t6, t0, t6), - c.call(f2mPrefix + "_sub", t6, t5, t6), - - // tmp1 = tmp1 + tmp1; - c.call(f2mPrefix + "_add", t1, t1, t1), - - // tmp1 = tmp1 + tmp1; - c.call(f2mPrefix + "_add", t1, t1, t1), - - // tmp6 = tmp6 - tmp1; - c.call(f2mPrefix + "_sub", t6, t1, t6), - - // tmp0 = r.z * zsquared; - c.call(f2mPrefix + "_mul", Rz, zsquared, t0), - - // tmp0 = tmp0 + tmp0; - c.call(f2mPrefix + "_add", t0, t0, t0), - - ); - } - - function buildPrepAddStep() { - const f = module.addFunction(prefix+ "_prepAddStep"); - f.addParam("R", "i32"); - f.addParam("Q", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const Rx = c.getLocal("R"); - const Ry = c.i32_add(c.getLocal("R"), c.i32_const(2*n8q)); - const Rz = c.i32_add(c.getLocal("R"), c.i32_const(4*n8q)); - - const Qx = c.getLocal("Q"); - const Qy = c.i32_add(c.getLocal("Q"), c.i32_const(2*n8q)); - - const t10 = c.getLocal("r"); - const t1 = c.i32_add(c.getLocal("r"), c.i32_const(2*n8q)); - const t9 = c.i32_add(c.getLocal("r"), c.i32_const(4*n8q)); - - const zsquared = c.i32_const(module.alloc(f2size)); - const ysquared = c.i32_const(module.alloc(f2size)); - const ztsquared = c.i32_const(module.alloc(f2size)); - const t0 = c.i32_const(module.alloc(f2size)); - const t2 = c.i32_const(module.alloc(f2size)); - const t3 = c.i32_const(module.alloc(f2size)); - const t4 = c.i32_const(module.alloc(f2size)); - const t5 = c.i32_const(module.alloc(f2size)); - const t6 = c.i32_const(module.alloc(f2size)); - const t7 = c.i32_const(module.alloc(f2size)); - const t8 = c.i32_const(module.alloc(f2size)); - - f.addCode( - - // zsquared = r.z.square(); - c.call(f2mPrefix + "_square", Rz, zsquared), - - // ysquared = q.y.square(); - c.call(f2mPrefix + "_square", Qy, ysquared), - - // t0 = zsquared * q.x; - c.call(f2mPrefix + "_mul", zsquared, Qx, t0), - - // t1 = ((q.y + r.z).square() - ysquared - zsquared) * zsquared; - c.call(f2mPrefix + "_add", Qy, Rz, t1), - c.call(f2mPrefix + "_square", t1, t1), - c.call(f2mPrefix + "_sub", t1, ysquared, t1), - c.call(f2mPrefix + "_sub", t1, zsquared, t1), - c.call(f2mPrefix + "_mul", t1, zsquared, t1), - - // t2 = t0 - r.x; - c.call(f2mPrefix + "_sub", t0, Rx, t2), - - // t3 = t2.square(); - c.call(f2mPrefix + "_square", t2, t3), - - // t4 = t3 + t3; - c.call(f2mPrefix + "_add", t3, t3, t4), - - // t4 = t4 + t4; - c.call(f2mPrefix + "_add", t4, t4, t4), - - // t5 = t4 * t2; - c.call(f2mPrefix + "_mul", t4, t2, t5), - - // t6 = t1 - r.y - r.y; - c.call(f2mPrefix + "_sub", t1, Ry, t6), - c.call(f2mPrefix + "_sub", t6, Ry, t6), - - // t9 = t6 * q.x; - c.call(f2mPrefix + "_mul", t6, Qx, t9), - - // t7 = t4 * r.x; - c.call(f2mPrefix + "_mul", t4, Rx, t7), - - // r.x = t6.square() - t5 - t7 - t7; - c.call(f2mPrefix + "_square", t6, Rx), - c.call(f2mPrefix + "_sub", Rx, t5, Rx), - c.call(f2mPrefix + "_sub", Rx, t7, Rx), - c.call(f2mPrefix + "_sub", Rx, t7, Rx), - - // r.z = (r.z + t2).square() - zsquared - t3; - c.call(f2mPrefix + "_add", Rz, t2, Rz), - c.call(f2mPrefix + "_square", Rz, Rz), - c.call(f2mPrefix + "_sub", Rz, zsquared, Rz), - c.call(f2mPrefix + "_sub", Rz, t3, Rz), - - // t10 = q.y + r.z; - c.call(f2mPrefix + "_add", Qy, Rz, t10), - - // t8 = (t7 - r.x) * t6; - c.call(f2mPrefix + "_sub", t7, Rx, t8), - c.call(f2mPrefix + "_mul", t8, t6, t8), - - // t0 = r.y * t5; - c.call(f2mPrefix + "_mul", Ry, t5, t0), - - // t0 = t0 + t0; - c.call(f2mPrefix + "_add", t0, t0, t0), - - // r.y = t8 - t0; - c.call(f2mPrefix + "_sub", t8, t0, Ry), - - // t10 = t10.square() - ysquared; - c.call(f2mPrefix + "_square", t10, t10), - c.call(f2mPrefix + "_sub", t10, ysquared, t10), - - // ztsquared = r.z.square(); - c.call(f2mPrefix + "_square", Rz, ztsquared), - - // t10 = t10 - ztsquared; - c.call(f2mPrefix + "_sub", t10, ztsquared, t10), - - // t9 = t9 + t9 - t10; - c.call(f2mPrefix + "_add", t9, t9, t9), - c.call(f2mPrefix + "_sub", t9, t10, t9), - - // t10 = r.z + r.z; - c.call(f2mPrefix + "_add", Rz, Rz, t10), - - // t6 = -t6; - c.call(f2mPrefix + "_neg", t6, t6), - - // t1 = t6 + t6; - c.call(f2mPrefix + "_add", t6, t6, t1), - ); - } - - - function buildPrepareG2() { - const f = module.addFunction(prefix+ "_prepareG2"); - f.addParam("pQ", "i32"); - f.addParam("ppreQ", "i32"); - f.addLocal("pCoef", "i32"); - f.addLocal("i", "i32"); - - const c = f.getCodeBuilder(); - - - const Q = c.getLocal("pQ"); - - const pR = module.alloc(f2size*3); - const R = c.i32_const(pR); - - const base = c.getLocal("ppreQ"); - - f.addCode( - c.call(g2mPrefix + "_normalize", Q, base), - c.if( - c.call(g2mPrefix + "_isZero", base), - c.ret([]) - ), - c.call(g2mPrefix + "_copy", base, R), - c.setLocal("pCoef", c.i32_add(c.getLocal("ppreQ"), c.i32_const(f2size*3))), - ); - - f.addCode( - c.setLocal("i", c.i32_const(ateLoopBitBytes.length-2)), - c.block(c.loop( - - c.call(prefix + "_prepDblStep", R, c.getLocal("pCoef")), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - c.if( - c.i32_load8_s(c.getLocal("i"), pAteLoopBitBytes), - [ - ...c.call(prefix + "_prepAddStep", R, base, c.getLocal("pCoef")), - ...c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - ] - ), - c.br_if(1, c.i32_eqz ( c.getLocal("i") )), - c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - ); - } - - - function buildF6Mul1() { - const f = module.addFunction(f6mPrefix+ "_mul1"); - f.addParam("pA", "i32"); // F6 - f.addParam("pC1", "i32"); // F2 - f.addParam("pR", "i32"); // F6 - - const c = f.getCodeBuilder(); - - const A_c0 = c.getLocal("pA"); - const A_c1 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*2)); - const A_c2 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*4)); - - const c1 = c.getLocal("pC1"); - - const t1 = c.getLocal("pR"); - const t2 = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*2)); - const b_b = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*4)); - - const Ac0_Ac1 = c.i32_const(module.alloc(f1size*2)); - const Ac1_Ac2 = c.i32_const(module.alloc(f1size*2)); - - f.addCode( - - c.call(f2mPrefix + "_add", A_c0, A_c1, Ac0_Ac1), - c.call(f2mPrefix + "_add", A_c1, A_c2, Ac1_Ac2), - - // let b_b = self.c1 * c1; - c.call(f2mPrefix + "_mul", A_c1, c1, b_b), - - // let t1 = (self.c1 + self.c2) * c1 - b_b; - c.call(f2mPrefix + "_mul", Ac1_Ac2, c1, t1), - c.call(f2mPrefix + "_sub", t1, b_b, t1), - - // let t1 = t1.mul_by_nonresidue(); - c.call(f2mPrefix + "_mulNR", t1, t1), - - // let t2 = (self.c0 + self.c1) * c1 - b_b; - c.call(f2mPrefix + "_mul", Ac0_Ac1, c1, t2), - c.call(f2mPrefix + "_sub", t2, b_b, t2), - ); - } - buildF6Mul1(); - - function buildF6Mul01() { - const f = module.addFunction(f6mPrefix+ "_mul01"); - f.addParam("pA", "i32"); // F6 - f.addParam("pC0", "i32"); // F2 - f.addParam("pC1", "i32"); // F2 - f.addParam("pR", "i32"); // F6 - - const c = f.getCodeBuilder(); - - const A_c0 = c.getLocal("pA"); - const A_c1 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*2)); - const A_c2 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*4)); - - const c0 = c.getLocal("pC0"); - const c1 = c.getLocal("pC1"); - - const t1 = c.getLocal("pR"); - const t2 = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*2)); - const t3 = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*4)); - - const a_a = c.i32_const(module.alloc(f1size*2)); - const b_b = c.i32_const(module.alloc(f1size*2)); - const Ac0_Ac1 = c.i32_const(module.alloc(f1size*2)); - const Ac0_Ac2 = c.i32_const(module.alloc(f1size*2)); - - f.addCode( - // let a_a = self.c0 * c0; - c.call(f2mPrefix + "_mul", A_c0, c0, a_a), - - // let b_b = self.c1 * c1; - c.call(f2mPrefix + "_mul", A_c1, c1, b_b), - - - c.call(f2mPrefix + "_add", A_c0, A_c1, Ac0_Ac1), - c.call(f2mPrefix + "_add", A_c0, A_c2, Ac0_Ac2), - - // let t1 = (self.c1 + self.c2) * c1 - b_b; - c.call(f2mPrefix + "_add", A_c1, A_c2, t1), - c.call(f2mPrefix + "_mul", t1, c1, t1), - c.call(f2mPrefix + "_sub", t1, b_b, t1), - - // let t1 = t1.mul_by_nonresidue() + a_a; - c.call(f2mPrefix + "_mulNR", t1, t1), - c.call(f2mPrefix + "_add", t1, a_a, t1), - - // let t2 = (c0 + c1) * (self.c0 + self.c1) - a_a - b_b; - c.call(f2mPrefix + "_add", c0, c1, t2), - c.call(f2mPrefix + "_mul", t2, Ac0_Ac1, t2), - c.call(f2mPrefix + "_sub", t2, a_a, t2), - c.call(f2mPrefix + "_sub", t2, b_b, t2), - - // let t3 = (self.c0 + self.c2) * c0 - a_a + b_b; - c.call(f2mPrefix + "_mul", Ac0_Ac2, c0, t3), - c.call(f2mPrefix + "_sub", t3, a_a, t3), - c.call(f2mPrefix + "_add", t3, b_b, t3), - - - ); - } - buildF6Mul01(); - - - function buildF12Mul014() { - - const f = module.addFunction(ftmPrefix+ "_mul014"); - f.addParam("pA", "i32"); // F12 - f.addParam("pC0", "i32"); // F2 - f.addParam("pC1", "i32"); // F2 - f.addParam("pC4", "i32"); // F2 - f.addParam("pR", "i32"); // F12 - - const c = f.getCodeBuilder(); - - - const A_c0 = c.getLocal("pA"); - const A_c1 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*6)); - - const c0 = c.getLocal("pC0"); - const c1 = c.getLocal("pC1"); - const c4 = c.getLocal("pC4"); - - const aa = c.i32_const(module.alloc(f1size*6)); - const bb = c.i32_const(module.alloc(f1size*6)); - const o = c.i32_const(module.alloc(f1size*2)); - - const R_c0 = c.getLocal("pR"); - const R_c1 = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*6)); - - f.addCode( - // let aa = self.c0.mul_by_01(c0, c1); - c.call(f6mPrefix + "_mul01", A_c0, c0, c1, aa), - - // let bb = self.c1.mul_by_1(c4); - c.call(f6mPrefix + "_mul1", A_c1, c4, bb), - - // let o = c1 + c4; - c.call(f2mPrefix + "_add", c1, c4, o), - - // let c1 = self.c1 + self.c0; - c.call(f6mPrefix + "_add", A_c1, A_c0, R_c1), - - // let c1 = c1.mul_by_01(c0, &o); - c.call(f6mPrefix + "_mul01", R_c1, c0, o, R_c1), - - // let c1 = c1 - aa - bb; - c.call(f6mPrefix + "_sub", R_c1, aa, R_c1), - c.call(f6mPrefix + "_sub", R_c1, bb, R_c1), - - // let c0 = bb; - c.call(f6mPrefix + "_copy", bb, R_c0), - - // let c0 = c0.mul_by_nonresidue(); - c.call(f6mPrefix + "_mulNR", R_c0, R_c0), - - // let c0 = c0 + aa; - c.call(f6mPrefix + "_add", R_c0, aa, R_c0), - ); - } - buildF12Mul014(); - - - function buildELL() { - const f = module.addFunction(prefix+ "_ell"); - f.addParam("pP", "i32"); - f.addParam("pCoefs", "i32"); - f.addParam("pF", "i32"); - - const c = f.getCodeBuilder(); - - const Px = c.getLocal("pP"); - const Py = c.i32_add(c.getLocal("pP"), c.i32_const(n8q)); - - const F = c.getLocal("pF"); - - const coef0_0 = c.getLocal("pCoefs"); - const coef0_1 = c.i32_add(c.getLocal("pCoefs"), c.i32_const(f1size)); - const coef1_0 = c.i32_add(c.getLocal("pCoefs"), c.i32_const(f1size*2)); - const coef1_1 = c.i32_add(c.getLocal("pCoefs"), c.i32_const(f1size*3)); - const coef2 = c.i32_add(c.getLocal("pCoefs"), c.i32_const(f1size*4)); - - const pc0 = module.alloc(f1size*2); - const c0 = c.i32_const(pc0); - const c0_c0 = c.i32_const(pc0); - const c0_c1 = c.i32_const(pc0+f1size); - - const pc1 = module.alloc(f1size*2); - const c1 = c.i32_const(pc1); - const c1_c0 = c.i32_const(pc1); - const c1_c1 = c.i32_const(pc1+f1size); - f.addCode( - // let mut c0 = coeffs.0; - // let mut c1 = coeffs.1; - // - // c0.c0 *= p.y; - // c0.c1 *= p.y; - // - // c1.c0 *= p.x; - // c1.c1 *= p.x; - // - // f.mul_by_014(&coeffs.2, &c1, &c0) - - c.call(f1mPrefix + "_mul", coef0_0, Py, c0_c0), - c.call(f1mPrefix + "_mul", coef0_1, Py, c0_c1), - c.call(f1mPrefix + "_mul", coef1_0, Px, c1_c0), - c.call(f1mPrefix + "_mul", coef1_1, Px, c1_c1), - - c.call(ftmPrefix + "_mul014", F, coef2, c1, c0, F), - - ); - - } - buildELL(); - - function buildMillerLoop() { - const f = module.addFunction(prefix+ "_millerLoop"); - f.addParam("ppreP", "i32"); - f.addParam("ppreQ", "i32"); - f.addParam("r", "i32"); - f.addLocal("pCoef", "i32"); - f.addLocal("i", "i32"); - - const c = f.getCodeBuilder(); - - const preP = c.getLocal("ppreP"); - const preQ = c.getLocal("ppreQ"); - - const coefs = c.getLocal("pCoef"); - - const F = c.getLocal("r"); - - - f.addCode( - c.call(ftmPrefix + "_one", F), - - c.if( - c.call(g1mPrefix + "_isZero", preP), - c.ret([]) - ), - c.if( - c.call(g1mPrefix + "_isZero", c.getLocal("ppreQ")), - c.ret([]) - ), - c.setLocal("pCoef", c.i32_add( c.getLocal("ppreQ"), c.i32_const(f2size*3))), - - c.setLocal("i", c.i32_const(ateLoopBitBytes.length-2)), - c.block(c.loop( - - - c.call(prefix + "_ell", preP, coefs, F), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - c.if( - c.i32_load8_s(c.getLocal("i"), pAteLoopBitBytes), - [ - ...c.call(prefix + "_ell", preP, coefs, F), - ...c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - ] - ), - c.call(ftmPrefix + "_square", F, F), - - c.br_if(1, c.i32_eq ( c.getLocal("i"), c.i32_const(1) )), - c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )), - c.call(prefix + "_ell", preP, coefs, F), - - ); - - - if (isLoopNegative) { - f.addCode( - c.call(ftmPrefix + "_conjugate", F, F), - ); - } - } - - - function buildFrobeniusMap(n) { - const F12 = [ - [ - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - ], - [ - [bigInt("1"), bigInt("0")], - [bigInt("3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760"), bigInt("151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027")], - [bigInt("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351"), bigInt("0")], - [bigInt("2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530"), bigInt("1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257")], - [bigInt("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350"), bigInt("0")], - [bigInt("3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557"), bigInt("877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230")], - [bigInt("4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786"), bigInt("0")], - [bigInt("151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027"), bigInt("3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760")], - [bigInt("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436"), bigInt("0")], - [bigInt("1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257"), bigInt("2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530")], - [bigInt("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437"), bigInt("0")], - [bigInt("877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230"), bigInt("3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557")], - ] - ]; - - const F6 = [ - [ - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - ], - [ - [bigInt("1"), bigInt("0")], - [bigInt("0"), bigInt("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436")], - [bigInt("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350"), bigInt("0")], - [bigInt("0"), bigInt("1")], - [bigInt("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436"), bigInt("0")], - [bigInt("0"), bigInt("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350")], - ], - [ - [bigInt("1"), bigInt("0")], - [bigInt("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437"), bigInt("0")], - [bigInt("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436"), bigInt("0")], - [bigInt("4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786"), bigInt("0")], - [bigInt("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350"), bigInt("0")], - [bigInt("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351"), bigInt("0")], - ] - ]; - - const f = module.addFunction(ftmPrefix + "_frobeniusMap"+n); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - for (let i=0; i<6; i++) { - const X = (i==0) ? c.getLocal("x") : c.i32_add(c.getLocal("x"), c.i32_const(i*f2size)); - const Xc0 = X; - const Xc1 = c.i32_add(c.getLocal("x"), c.i32_const(i*f2size + f1size)); - const R = (i==0) ? c.getLocal("r") : c.i32_add(c.getLocal("r"), c.i32_const(i*f2size)); - const Rc0 = R; - const Rc1 = c.i32_add(c.getLocal("r"), c.i32_const(i*f2size + f1size)); - const coef = mul2(F12[Math.floor(i/3)][n%12] , F6[i%3][n%6]); - const pCoef = module.alloc([ - ...utils.bigInt2BytesLE(toMontgomery(coef[0]), n8q), - ...utils.bigInt2BytesLE(toMontgomery(coef[1]), n8q), - ]); - if (n%2 == 1) { - f.addCode( - c.call(f1mPrefix + "_copy", Xc0, Rc0), - c.call(f1mPrefix + "_neg", Xc1, Rc1), - c.call(f2mPrefix + "_mul", R, c.i32_const(pCoef), R), - ); - } else { - f.addCode(c.call(f2mPrefix + "_mul", X, c.i32_const(pCoef), R)); - } - } - - function mul2(a, b) { - const ac0 = bigInt(a[0]); - const ac1 = bigInt(a[1]); - const bc0 = bigInt(b[0]); - const bc1 = bigInt(b[1]); - const res = [ - ac0.times(bc0).minus( ac1.times(bc1) ).mod(q), - ac0.times(bc1).add( ac1.times(bc0) ).mod(q), - ]; - if (res[0].isNegative()) res[0] = res[0].add(q); - return res; - } - - } - - - function buildCyclotomicSquare() { - const f = module.addFunction(prefix+ "__cyclotomicSquare"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x4 = c.i32_add(c.getLocal("x"), c.i32_const(f2size)); - const x3 = c.i32_add(c.getLocal("x"), c.i32_const(2*f2size)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(3*f2size)); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(4*f2size)); - const x5 = c.i32_add(c.getLocal("x"), c.i32_const(5*f2size)); - - const r0 = c.getLocal("r"); - const r4 = c.i32_add(c.getLocal("r"), c.i32_const(f2size)); - const r3 = c.i32_add(c.getLocal("r"), c.i32_const(2*f2size)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(3*f2size)); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(4*f2size)); - const r5 = c.i32_add(c.getLocal("r"), c.i32_const(5*f2size)); - - const t0 = c.i32_const(module.alloc(f2size)); - const t1 = c.i32_const(module.alloc(f2size)); - const t2 = c.i32_const(module.alloc(f2size)); - const t3 = c.i32_const(module.alloc(f2size)); - const t4 = c.i32_const(module.alloc(f2size)); - const t5 = c.i32_const(module.alloc(f2size)); - const tmp = c.i32_const(module.alloc(f2size)); - const AUX = c.i32_const(module.alloc(f2size)); - - - f.addCode( - -// c.call(ftmPrefix + "_square", x0, r0), - - // // t0 + t1*y = (z0 + z1*y)^2 = a^2 - // tmp = z0 * z1; - // t0 = (z0 + z1) * (z0 + my_Fp6::non_residue * z1) - tmp - my_Fp6::non_residue * tmp; - // t1 = tmp + tmp; - c.call(f2mPrefix + "_mul", x0, x1, tmp), - c.call(f2mPrefix + "_mulNR", x1, t0), - c.call(f2mPrefix + "_add", x0, t0, t0), - c.call(f2mPrefix + "_add", x0, x1, AUX), - c.call(f2mPrefix + "_mul", AUX, t0, t0), - c.call(f2mPrefix + "_mulNR", tmp, AUX), - c.call(f2mPrefix + "_add", tmp, AUX, AUX), - c.call(f2mPrefix + "_sub", t0, AUX, t0), - c.call(f2mPrefix + "_add", tmp, tmp, t1), - - // // t2 + t3*y = (z2 + z3*y)^2 = b^2 - // tmp = z2 * z3; - // t2 = (z2 + z3) * (z2 + my_Fp6::non_residue * z3) - tmp - my_Fp6::non_residue * tmp; - // t3 = tmp + tmp; - c.call(f2mPrefix + "_mul", x2, x3, tmp), - c.call(f2mPrefix + "_mulNR", x3, t2), - c.call(f2mPrefix + "_add", x2, t2, t2), - c.call(f2mPrefix + "_add", x2, x3, AUX), - c.call(f2mPrefix + "_mul", AUX, t2, t2), - c.call(f2mPrefix + "_mulNR", tmp, AUX), - c.call(f2mPrefix + "_add", tmp, AUX, AUX), - c.call(f2mPrefix + "_sub", t2, AUX, t2), - c.call(f2mPrefix + "_add", tmp, tmp, t3), - - // // t4 + t5*y = (z4 + z5*y)^2 = c^2 - // tmp = z4 * z5; - // t4 = (z4 + z5) * (z4 + my_Fp6::non_residue * z5) - tmp - my_Fp6::non_residue * tmp; - // t5 = tmp + tmp; - c.call(f2mPrefix + "_mul", x4, x5, tmp), - c.call(f2mPrefix + "_mulNR", x5, t4), - c.call(f2mPrefix + "_add", x4, t4, t4), - c.call(f2mPrefix + "_add", x4, x5, AUX), - c.call(f2mPrefix + "_mul", AUX, t4, t4), - c.call(f2mPrefix + "_mulNR", tmp, AUX), - c.call(f2mPrefix + "_add", tmp, AUX, AUX), - c.call(f2mPrefix + "_sub", t4, AUX, t4), - c.call(f2mPrefix + "_add", tmp, tmp, t5), - - // For A - // z0 = 3 * t0 - 2 * z0 - c.call(f2mPrefix + "_sub", t0, x0, r0), - c.call(f2mPrefix + "_add", r0, r0, r0), - c.call(f2mPrefix + "_add", t0, r0, r0), - // z1 = 3 * t1 + 2 * z1 - c.call(f2mPrefix + "_add", t1, x1, r1), - c.call(f2mPrefix + "_add", r1, r1, r1), - c.call(f2mPrefix + "_add", t1, r1, r1), - - // For B - // z2 = 3 * (xi * t5) + 2 * z2 - c.call(f2mPrefix + "_mul", t5, c.i32_const(pBls12381Twist), AUX), - c.call(f2mPrefix + "_add", AUX, x2, r2), - c.call(f2mPrefix + "_add", r2, r2, r2), - c.call(f2mPrefix + "_add", AUX, r2, r2), - // z3 = 3 * t4 - 2 * z3 - c.call(f2mPrefix + "_sub", t4, x3, r3), - c.call(f2mPrefix + "_add", r3, r3, r3), - c.call(f2mPrefix + "_add", t4, r3, r3), - - // For C - // z4 = 3 * t2 - 2 * z4 - c.call(f2mPrefix + "_sub", t2, x4, r4), - c.call(f2mPrefix + "_add", r4, r4, r4), - c.call(f2mPrefix + "_add", t2, r4, r4), - // z5 = 3 * t3 + 2 * z5 - c.call(f2mPrefix + "_add", t3, x5, r5), - c.call(f2mPrefix + "_add", r5, r5, r5), - c.call(f2mPrefix + "_add", t3, r5, r5), - - ); - } - - - function buildCyclotomicExp(exponent, isExpNegative, fnName) { - const exponentNafBytes = naf(exponent).map( (b) => (b==-1 ? 0xFF: b) ); - const pExponentNafBytes = module.alloc(exponentNafBytes); - // const pExponent = module.alloc(utils.bigInt2BytesLE(exponent, n8)); - - const f = module.addFunction(prefix+ "__cyclotomicExp_"+fnName); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - f.addLocal("bit", "i32"); - f.addLocal("i", "i32"); - - const c = f.getCodeBuilder(); - - const x = c.getLocal("x"); - - const res = c.getLocal("r"); - - const inverse = c.i32_const(module.alloc(ftsize)); - - - f.addCode( -// c.call(ftmPrefix + "_exp", x, c.i32_const(pExponent), c.i32_const(32), res), - - c.call(ftmPrefix + "_conjugate", x, inverse), - c.call(ftmPrefix + "_one", res), - - c.if( - c.teeLocal("bit", c.i32_load8_s(c.i32_const(exponentNafBytes.length-1), pExponentNafBytes)), - c.if( - c.i32_eq( - c.getLocal("bit"), - c.i32_const(1) - ), - c.call(ftmPrefix + "_mul", res, x, res), - c.call(ftmPrefix + "_mul", res, inverse, res), - ) - ), - - c.setLocal("i", c.i32_const(exponentNafBytes.length-2)), - c.block(c.loop( -// c.call(ftmPrefix + "_square", res, res), - c.call(prefix + "__cyclotomicSquare", res, res), - c.if( - c.teeLocal("bit", c.i32_load8_s(c.getLocal("i"), pExponentNafBytes)), - c.if( - c.i32_eq( - c.getLocal("bit"), - c.i32_const(1) - ), - c.call(ftmPrefix + "_mul", res, x, res), - c.call(ftmPrefix + "_mul", res, inverse, res), - ) - ), - c.br_if(1, c.i32_eqz ( c.getLocal("i") )), - c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - ); - - if (isExpNegative) { - f.addCode( - c.call(ftmPrefix + "_conjugate", res, res), - ); - } - - } - - function buildFinalExponentiation() { - buildCyclotomicSquare(); - buildCyclotomicExp(finalExpZ, finalExpIsNegative, "w0"); - - const f = module.addFunction(prefix+ "_finalExponentiation"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const elt = c.getLocal("x"); - const res = c.getLocal("r"); - const t0 = c.i32_const(module.alloc(ftsize)); - const t1 = c.i32_const(module.alloc(ftsize)); - const t2 = c.i32_const(module.alloc(ftsize)); - const t3 = c.i32_const(module.alloc(ftsize)); - const t4 = c.i32_const(module.alloc(ftsize)); - const t5 = c.i32_const(module.alloc(ftsize)); - const t6 = c.i32_const(module.alloc(ftsize)); - - f.addCode( - - // let mut t0 = f.frobenius_map(6) - c.call(ftmPrefix + "_frobeniusMap6", elt, t0), - - // let t1 = f.invert() - c.call(ftmPrefix + "_inverse", elt, t1), - - // let mut t2 = t0 * t1; - c.call(ftmPrefix + "_mul", t0, t1, t2), - - // t1 = t2.clone(); - c.call(ftmPrefix + "_copy", t2, t1), - - // t2 = t2.frobenius_map().frobenius_map(); - c.call(ftmPrefix + "_frobeniusMap2", t2, t2), - - // t2 *= t1; - c.call(ftmPrefix + "_mul", t2, t1, t2), - - - // t1 = cyclotomic_square(t2).conjugate(); - c.call(prefix + "__cyclotomicSquare", t2, t1), - c.call(ftmPrefix + "_conjugate", t1, t1), - - // let mut t3 = cycolotomic_exp(t2); - c.call(prefix + "__cyclotomicExp_w0", t2, t3), - - // let mut t4 = cyclotomic_square(t3); - c.call(prefix + "__cyclotomicSquare", t3, t4), - - // let mut t5 = t1 * t3; - c.call(ftmPrefix + "_mul", t1, t3, t5), - - // t1 = cycolotomic_exp(t5); - c.call(prefix + "__cyclotomicExp_w0", t5, t1), - - // t0 = cycolotomic_exp(t1); - c.call(prefix + "__cyclotomicExp_w0", t1, t0), - - // let mut t6 = cycolotomic_exp(t0); - c.call(prefix + "__cyclotomicExp_w0", t0, t6), - - // t6 *= t4; - c.call(ftmPrefix + "_mul", t6, t4, t6), - - // t4 = cycolotomic_exp(t6); - c.call(prefix + "__cyclotomicExp_w0", t6, t4), - - // t5 = t5.conjugate(); - c.call(ftmPrefix + "_conjugate", t5, t5), - - // t4 *= t5 * t2; - c.call(ftmPrefix + "_mul", t4, t5, t4), - c.call(ftmPrefix + "_mul", t4, t2, t4), - - // t5 = t2.conjugate(); - c.call(ftmPrefix + "_conjugate", t2, t5), - - // t1 *= t2; - c.call(ftmPrefix + "_mul", t1, t2, t1), - - // t1 = t1.frobenius_map().frobenius_map().frobenius_map(); - c.call(ftmPrefix + "_frobeniusMap3", t1, t1), - - // t6 *= t5; - c.call(ftmPrefix + "_mul", t6, t5, t6), - - // t6 = t6.frobenius_map(); - c.call(ftmPrefix + "_frobeniusMap1", t6, t6), - - // t3 *= t0; - c.call(ftmPrefix + "_mul", t3, t0, t3), - - // t3 = t3.frobenius_map().frobenius_map(); - c.call(ftmPrefix + "_frobeniusMap2", t3, t3), - - // t3 *= t1; - c.call(ftmPrefix + "_mul", t3, t1, t3), - - // t3 *= t6; - c.call(ftmPrefix + "_mul", t3, t6, t3), - - // f = t3 * t4; - c.call(ftmPrefix + "_mul", t3, t4, res), - - ); - } - - - function buildFinalExponentiationOld() { - const f = module.addFunction(prefix+ "_finalExponentiationOld"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const exponent = bigInt("322277361516934140462891564586510139908379969514828494218366688025288661041104682794998680497580008899973249814104447692778988208376779573819485263026159588510513834876303014016798809919343532899164848730280942609956670917565618115867287399623286813270357901731510188149934363360381614501334086825442271920079363289954510565375378443704372994881406797882676971082200626541916413184642520269678897559532260949334760604962086348898118982248842634379637598665468817769075878555493752214492790122785850202957575200176084204422751485957336465472324810982833638490904279282696134323072515220044451592646885410572234451732790590013479358343841220074174848221722017083597872017638514103174122784843925578370430843522959600095676285723737049438346544753168912974976791528535276317256904336520179281145394686565050419250614107803233314658825463117900250701199181529205942363159325765991819433914303908860460720581408201373164047773794825411011922305820065611121544561808414055302212057471395719432072209245600258134364584636810093520285711072578721435517884103526483832733289802426157301542744476740008494780363354305116978805620671467071400711358839553375340724899735460480144599782014906586543813292157922220645089192130209334926661588737007768565838519456601560804957985667880395221049249803753582637708560"); - - const pExponent = module.alloc(utils.bigInt2BytesLE( exponent, 544 )); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call(ftmPrefix + "_exp", c.getLocal("x"), c.i32_const(pExponent), c.i32_const(544), c.getLocal("r")), - ); - } - - - const pPreP = module.alloc(prePSize); - const pPreQ = module.alloc(preQSize); - - function buildPairingEquation(nPairings) { - - const f = module.addFunction(prefix+ "_pairingEq"+nPairings); - for (let i=0; i { - -const bigInt = __webpack_require__(92096); -const utils = __webpack_require__(12333); - -const buildF1m =__webpack_require__(70075); -const buildF1 =__webpack_require__(38138); -const buildF2m =__webpack_require__(15420); -const buildF3m =__webpack_require__(77173); -const buildCurve =__webpack_require__(15904); -const buildFFT = __webpack_require__(93911); -const buildPol = __webpack_require__(2896); -const buildQAP = __webpack_require__(10637); -const buildApplyKey = __webpack_require__(23320); - -module.exports = function buildBN128(module, _prefix) { - - const prefix = _prefix || "bn128"; - - if (module.modules[prefix]) return prefix; // already builded - - const q = bigInt("21888242871839275222246405745257275088696311157297823662689037894645226208583"); - const r = bigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617"); - - - const n64 = Math.floor((q.minus(1).bitLength() - 1)/64) +1; - const n8 = n64*8; - const frsize = n8; - const f1size = n8; - const f2size = f1size * 2; - const f6size = f1size * 6; - const ftsize = f1size * 12; - - const pr = module.alloc(utils.bigInt2BytesLE( r, frsize )); - - const f1mPrefix = buildF1m(module, q, "f1m"); - buildF1(module, r, "fr", "frm"); - - const pG1b = module.alloc(utils.bigInt2BytesLE( toMontgomery(bigInt(3)), f1size )); - const g1mPrefix = buildCurve(module, "g1m", "f1m", pG1b); - - buildFFT(module, "frm", "frm", "frm", "frm_mul"); - - buildPol(module, "pol", "frm"); - buildQAP(module, "qap", "frm"); - - const f2mPrefix = buildF2m(module, "f1m_neg", "f2m", "f1m"); - const pG2b = module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery(bigInt("19485874751759354771024239261021720505790618469301721065564631296452457478373")), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(bigInt("266929791119991161246907387137283842545076965332900288569378510910307636690")), f1size ) - ]); - const g2mPrefix = buildCurve(module, "g2m", "f2m", pG2b); - - - function buildGTimesFr(fnName, opMul) { - const f = module.addFunction(fnName); - f.addParam("pG", "i32"); - f.addParam("pFr", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - const AUX = c.i32_const(module.alloc(n8)); - - f.addCode( - c.call("frm_fromMontgomery", c.getLocal("pFr"), AUX), - c.call( - opMul, - c.getLocal("pG"), - AUX, - c.i32_const(n8), - c.getLocal("pr") - ) - ); - - module.exportFunction(fnName); - } - buildGTimesFr("g1m_timesFr", "g1m_timesScalar"); - buildFFT(module, "g1m", "g1m", "frm", "g1m_timesFr"); - - buildGTimesFr("g2m_timesFr", "g2m_timesScalar"); - buildFFT(module, "g2m", "g2m", "frm", "g2m_timesFr"); - - buildGTimesFr("g1m_timesFrAffine", "g1m_timesScalarAffine"); - buildGTimesFr("g2m_timesFrAffine", "g2m_timesScalarAffine"); - - buildApplyKey(module, "frm_batchApplyKey", "fmr", "frm", n8, n8, n8, "frm_mul"); - buildApplyKey(module, "g1m_batchApplyKey", "g1m", "frm", n8*3, n8*3, n8, "g1m_timesFr"); - buildApplyKey(module, "g1m_batchApplyKeyMixed", "g1m", "frm", n8*2, n8*3, n8, "g1m_timesFrAffine"); - buildApplyKey(module, "g2m_batchApplyKey", "g2m", "frm", n8*2*3, n8*3*2, n8, "g2m_timesFr"); - buildApplyKey(module, "g2m_batchApplyKeyMixed", "g2m", "frm", n8*2*2, n8*3*2, n8, "g2m_timesFrAffine"); - - function toMontgomery(a) { - return bigInt(a).times( bigInt.one.shiftLeft(f1size*8)).mod(q); - } - - const G1gen = [ - bigInt("1"), - bigInt("2"), - bigInt.one - ]; - - const pG1gen = module.alloc( - [ - ...utils.bigInt2BytesLE( toMontgomery(G1gen[0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G1gen[1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G1gen[2]), f1size ), - ] - ); - - const G1zero = [ - bigInt.zero, - bigInt.one, - bigInt.zero - ]; - - const pG1zero = module.alloc( - [ - ...utils.bigInt2BytesLE( toMontgomery(G1zero[0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G1zero[1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G1zero[2]), f1size ) - ] - ); - - const G2gen = [ - [ - bigInt("10857046999023057135944570762232829481370756359578518086990519993285655852781"), - bigInt("11559732032986387107991004021392285783925812861821192530917403151452391805634"), - ],[ - bigInt("8495653923123431417604973247489272438418190587263600148770280649306958101930"), - bigInt("4082367875863433681332203403145435568316851327593401208105741076214120093531"), - ],[ - bigInt.one, - bigInt.zero, - ] - ]; - - const pG2gen = module.alloc( - [ - ...utils.bigInt2BytesLE( toMontgomery(G2gen[0][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2gen[0][1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2gen[1][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2gen[1][1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2gen[2][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2gen[2][1]), f1size ), - ] - ); - - const G2zero = [ - [ - bigInt.zero, - bigInt.zero, - ],[ - bigInt.one, - bigInt.zero, - ],[ - bigInt.zero, - bigInt.zero, - ] - ]; - - const pG2zero = module.alloc( - [ - ...utils.bigInt2BytesLE( toMontgomery(G2zero[0][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2zero[0][1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2zero[1][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2zero[1][1]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2zero[2][0]), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(G2zero[2][1]), f1size ), - ] - ); - - const pOneT = module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery(1), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(0), f1size ), - ]); - - const pNonResidueF6 = module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery(9), f1size ), - ...utils.bigInt2BytesLE( toMontgomery(1), f1size ), - ]); - - const pTwoInv = module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery( bigInt(2).modInv(q)), f1size ), - ...utils.bigInt2BytesLE( bigInt(0), f1size ) - ]); - - const pAltBn128Twist = pNonResidueF6; - - const pTwistCoefB = module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery("19485874751759354771024239261021720505790618469301721065564631296452457478373"), f1size ), - ...utils.bigInt2BytesLE( toMontgomery("266929791119991161246907387137283842545076965332900288569378510910307636690"), f1size ), - ]); - - function build_mulNR6() { - const f = module.addFunction(prefix + "_mulNR6"); - f.addParam("x", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call( - f2mPrefix + "_mul", - c.i32_const(pNonResidueF6), - c.getLocal("x"), - c.getLocal("pr") - ) - ); - } - build_mulNR6(); - - const f6mPrefix = buildF3m(module, prefix+"_mulNR6", "f6m", "f2m"); - - function build_mulNR12() { - const f = module.addFunction(prefix + "_mulNR12"); - f.addParam("x", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call( - f2mPrefix + "_mul", - c.i32_const(pNonResidueF6), - c.i32_add(c.getLocal("x"), c.i32_const(n8*4)), - c.getLocal("pr") - ), - c.call( - f2mPrefix + "_copy", - c.getLocal("x"), - c.i32_add(c.getLocal("pr"), c.i32_const(n8*2)), - ), - c.call( - f2mPrefix + "_copy", - c.i32_add(c.getLocal("x"), c.i32_const(n8*2)), - c.i32_add(c.getLocal("pr"), c.i32_const(n8*4)), - ) - ); - } - build_mulNR12(); - - const ftmPrefix = buildF2m(module, prefix+"_mulNR12", "ftm", f6mPrefix); - - - const ateLoopCount = bigInt("29793968203157093288"); - const ateLoopBitBytes = bits(ateLoopCount); - const pAteLoopBitBytes = module.alloc(ateLoopBitBytes); - const isLoopNegative = false; - - const ateCoefSize = 3 * f2size; - const ateNDblCoefs = ateLoopBitBytes.length-1; - const ateNAddCoefs = ateLoopBitBytes.reduce((acc, b) => acc + ( b!=0 ? 1 : 0) ,0); - const ateNCoefs = ateNAddCoefs + ateNDblCoefs + 1; - const prePSize = 3*2*n8; - const preQSize = 3*n8*2 + ateNCoefs*ateCoefSize; - const finalExpIsNegative = false; - - - module.modules[prefix] = { - n64: n64, - pG1gen: pG1gen, - pG1zero: pG1zero, - pG1b: pG1b, - pG2gen: pG2gen, - pG2zero: pG2zero, - pG2b: pG2b, - pq: module.modules["f1m"].pq, - pr: pr, - pOneT: pOneT, - prePSize: prePSize, - preQSize: preQSize, - r: r.toString(), - q: q.toString() - }; - - // console.log("PrePSize: " +prePSize); - // console.log("PreQSize: " +preQSize); - - const finalExpZ = bigInt("4965661367192848881"); - - function naf(n) { - let E = n; - const res = []; - while (E.gt(bigInt.zero)) { - if (E.isOdd()) { - const z = 2 - E.mod(4).toJSNumber(); - res.push( z ); - E = E.minus(z); - } else { - res.push( 0 ); - } - E = E.shiftRight(1); - } - return res; - } - - function bits(n) { - let E = n; - const res = []; - while (E.gt(bigInt.zero)) { - if (E.isOdd()) { - res.push( 1 ); - } else { - res.push( 0 ); - } - E = E.shiftRight(1); - } - return res; - } - - function buildPrepareG1() { - const f = module.addFunction(prefix+ "_prepareG1"); - f.addParam("pP", "i32"); - f.addParam("ppreP", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call(g1mPrefix + "_normalize", c.getLocal("pP"), c.getLocal("ppreP")), // TODO Remove if already in affine - ); - } - - function buildPrepAddStep() { - const f = module.addFunction(prefix+ "_prepAddStep"); - f.addParam("pQ", "i32"); - f.addParam("pR", "i32"); - f.addParam("pCoef", "i32"); - - const c = f.getCodeBuilder(); - - const X2 = c.getLocal("pQ"); - const Y2 = c.i32_add(c.getLocal("pQ"), c.i32_const(f2size)); - - const X1 = c.getLocal("pR"); - const Y1 = c.i32_add(c.getLocal("pR"), c.i32_const(f2size)); - const Z1 = c.i32_add(c.getLocal("pR"), c.i32_const(2*f2size)); - - const ELL_0 = c.getLocal("pCoef"); - const ELL_VW = c.i32_add(c.getLocal("pCoef"), c.i32_const(f2size)); - const ELL_VV = c.i32_add(c.getLocal("pCoef"), c.i32_const(2*f2size)); - - const D = ELL_VW; - const E = c.i32_const(module.alloc(f2size)); - const F = c.i32_const(module.alloc(f2size)); - const G = c.i32_const(module.alloc(f2size)); - const H = c.i32_const(module.alloc(f2size)); - const I = c.i32_const(module.alloc(f2size)); - const J = c.i32_const(module.alloc(f2size)); - const AUX = c.i32_const(module.alloc(f2size)); - - f.addCode( - // D = X1 - X2*Z1 - c.call(f2mPrefix + "_mul", X2, Z1, D), - c.call(f2mPrefix + "_sub", X1, D, D), - - // E = Y1 - Y2*Z1 - c.call(f2mPrefix + "_mul", Y2, Z1, E), - c.call(f2mPrefix + "_sub", Y1, E, E), - - // F = D^2 - c.call(f2mPrefix + "_square", D, F), - - // G = E^2 - c.call(f2mPrefix + "_square", E, G), - - // H = D*F - c.call(f2mPrefix + "_mul", D, F, H), - - // I = X1 * F - c.call(f2mPrefix + "_mul", X1, F, I), - - // J = H + Z1*G - (I+I) - c.call(f2mPrefix + "_add", I, I, AUX), - c.call(f2mPrefix + "_mul", Z1, G, J), - c.call(f2mPrefix + "_add", H, J, J), - c.call(f2mPrefix + "_sub", J, AUX, J), - - - // X3 (X1) = D*J - c.call(f2mPrefix + "_mul", D, J, X1), - - // Y3 (Y1) = E*(I-J)-(H*Y1) - c.call(f2mPrefix + "_mul", H, Y1, Y1), - c.call(f2mPrefix + "_sub", I, J, AUX), - c.call(f2mPrefix + "_mul", E, AUX, AUX), - c.call(f2mPrefix + "_sub", AUX, Y1, Y1), - - // Z3 (Z1) = Z1*H - c.call(f2mPrefix + "_mul", Z1, H, Z1), - - // ell_0 = xi * (E * X2 - D * Y2) - c.call(f2mPrefix + "_mul", D, Y2, AUX), - c.call(f2mPrefix + "_mul", E, X2, ELL_0), - c.call(f2mPrefix + "_sub", ELL_0, AUX, ELL_0), - c.call(f2mPrefix + "_mul", ELL_0, c.i32_const(pAltBn128Twist), ELL_0), - - - // ell_VV = - E (later: * xP) - c.call(f2mPrefix + "_neg", E, ELL_VV), - - // ell_VW = D (later: * yP ) - // Already assigned - - ); - } - - - - function buildPrepDoubleStep() { - const f = module.addFunction(prefix+ "_prepDblStep"); - f.addParam("pR", "i32"); - f.addParam("pCoef", "i32"); - - const c = f.getCodeBuilder(); - - const X1 = c.getLocal("pR"); - const Y1 = c.i32_add(c.getLocal("pR"), c.i32_const(f2size)); - const Z1 = c.i32_add(c.getLocal("pR"), c.i32_const(2*f2size)); - - const ELL_0 = c.getLocal("pCoef"); - const ELL_VW = c.i32_add(c.getLocal("pCoef"), c.i32_const(f2size)); - const ELL_VV = c.i32_add(c.getLocal("pCoef"), c.i32_const(2*f2size)); - - const A = c.i32_const(module.alloc(f2size)); - const B = c.i32_const(module.alloc(f2size)); - const C = c.i32_const(module.alloc(f2size)); - const D = c.i32_const(module.alloc(f2size)); - const E = c.i32_const(module.alloc(f2size)); - const F = c.i32_const(module.alloc(f2size)); - const G = c.i32_const(module.alloc(f2size)); - const H = c.i32_const(module.alloc(f2size)); - const I = c.i32_const(module.alloc(f2size)); - const J = c.i32_const(module.alloc(f2size)); - const E2 = c.i32_const(module.alloc(f2size)); - const AUX = c.i32_const(module.alloc(f2size)); - - f.addCode( - - // A = X1 * Y1 / 2 - c.call(f2mPrefix + "_mul", Y1, c.i32_const(pTwoInv), A), - c.call(f2mPrefix + "_mul", X1, A, A), - - // B = Y1^2 - c.call(f2mPrefix + "_square", Y1, B), - - // C = Z1^2 - c.call(f2mPrefix + "_square", Z1, C), - - // D = 3 * C - c.call(f2mPrefix + "_add", C, C, D), - c.call(f2mPrefix + "_add", D, C, D), - - // E = twist_b * D - c.call(f2mPrefix + "_mul", c.i32_const(pTwistCoefB), D, E), - - // F = 3 * E - c.call(f2mPrefix + "_add", E, E, F), - c.call(f2mPrefix + "_add", E, F, F), - - // G = (B+F)/2 - c.call(f2mPrefix + "_add", B, F, G), - c.call(f2mPrefix + "_mul", G, c.i32_const(pTwoInv), G), - - // H = (Y1+Z1)^2-(B+C) - c.call(f2mPrefix + "_add", B, C, AUX), - c.call(f2mPrefix + "_add", Y1, Z1, H), - c.call(f2mPrefix + "_square", H, H), - c.call(f2mPrefix + "_sub", H, AUX, H), - - // I = E-B - c.call(f2mPrefix + "_sub", E, B, I), - - // J = X1^2 - c.call(f2mPrefix + "_square", X1, J), - - // E_squared = E^2 - c.call(f2mPrefix + "_square", E, E2), - - // X3 (X1) = A * (B-F) - c.call(f2mPrefix + "_sub", B, F, AUX), - c.call(f2mPrefix + "_mul", A, AUX, X1), - - // Y3 (Y1) = G^2 - 3*E^2 - c.call(f2mPrefix + "_add", E2, E2, AUX), - c.call(f2mPrefix + "_add", E2, AUX, AUX), - c.call(f2mPrefix + "_square", G, Y1), - c.call(f2mPrefix + "_sub", Y1, AUX, Y1), - - // Z3 (Z1) = B * H - c.call(f2mPrefix + "_mul", B, H, Z1), - - // ell_0 = xi * I - c.call(f2mPrefix + "_mul", c.i32_const(pAltBn128Twist), I, ELL_0), - - // ell_VW = - H (later: * yP) - c.call(f2mPrefix + "_neg", H, ELL_VW), - - // ell_VV = 3*J (later: * xP) - c.call(f2mPrefix + "_add", J, J, ELL_VV), - c.call(f2mPrefix + "_add", J, ELL_VV, ELL_VV), - - ); - } - - function buildMulByQ() { - const f = module.addFunction(prefix + "_mulByQ"); - f.addParam("p1", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - const x = c.getLocal("p1"); - const y = c.i32_add(c.getLocal("p1"), c.i32_const(f2size)); - const z = c.i32_add(c.getLocal("p1"), c.i32_const(f2size*2)); - const x3 = c.getLocal("pr"); - const y3 = c.i32_add(c.getLocal("pr"), c.i32_const(f2size)); - const z3 = c.i32_add(c.getLocal("pr"), c.i32_const(f2size*2)); - - const MulByQX = c.i32_const(module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery("21575463638280843010398324269430826099269044274347216827212613867836435027261"), f1size ), - ...utils.bigInt2BytesLE( toMontgomery("10307601595873709700152284273816112264069230130616436755625194854815875713954"), f1size ), - ])); - - const MulByQY = c.i32_const(module.alloc([ - ...utils.bigInt2BytesLE( toMontgomery("2821565182194536844548159561693502659359617185244120367078079554186484126554"), f1size ), - ...utils.bigInt2BytesLE( toMontgomery("3505843767911556378687030309984248845540243509899259641013678093033130930403"), f1size ), - ])); - - f.addCode( - // The frobeniusMap(1) in this field, is the conjugate - c.call(f2mPrefix + "_conjugate", x, x3), - c.call(f2mPrefix + "_mul", MulByQX, x3, x3), - c.call(f2mPrefix + "_conjugate", y, y3), - c.call(f2mPrefix + "_mul", MulByQY, y3, y3), - c.call(f2mPrefix + "_conjugate", z, z3), - ); - } - - - function buildPrepareG2() { - buildMulByQ(); - const f = module.addFunction(prefix+ "_prepareG2"); - f.addParam("pQ", "i32"); - f.addParam("ppreQ", "i32"); - f.addLocal("pCoef", "i32"); - f.addLocal("i", "i32"); - - const c = f.getCodeBuilder(); - - const QX = c.getLocal("pQ"); - const QY = c.i32_add( c.getLocal("pQ"), c.i32_const(f2size)); - const QZ = c.i32_add( c.getLocal("pQ"), c.i32_const(f2size*2)); - - const pR = module.alloc(f2size*3); - const R = c.i32_const(pR); - const RX = c.i32_const(pR); - const RY = c.i32_const(pR+f2size); - const RZ = c.i32_const(pR+2*f2size); - - const cQX = c.i32_add( c.getLocal("ppreQ"), c.i32_const(0)); - const cQY = c.i32_add( c.getLocal("ppreQ"), c.i32_const(f2size)); - const cQZ = c.i32_add( c.getLocal("ppreQ"), c.i32_const(f2size*2)); - - const pQ1 = module.alloc(f2size*3); - const Q1 = c.i32_const(pQ1); - - const pQ2 = module.alloc(f2size*3); - const Q2 = c.i32_const(pQ2); - const Q2X = c.i32_const(pQ2); - const Q2Y = c.i32_const(pQ2 + f2size); - const Q2Z = c.i32_const(pQ2 + f2size*2); - - f.addCode( - c.call(g2mPrefix + "_normalize", QX, cQX), // TODO Remove if already in affine - c.call(f2mPrefix + "_copy", cQX, RX), - c.call(f2mPrefix + "_copy", cQY, RY), - c.call(f2mPrefix + "_one", RZ), - ); - - f.addCode( - c.setLocal("pCoef", c.i32_add( c.getLocal("ppreQ"), c.i32_const(f2size*3))), - c.setLocal("i", c.i32_const(ateLoopBitBytes.length-2)), - c.block(c.loop( - - c.call(prefix + "_prepDblStep", R, c.getLocal("pCoef")), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - c.if( - c.i32_load8_s(c.getLocal("i"), pAteLoopBitBytes), - [ - ...c.call(prefix + "_prepAddStep", cQX, R, c.getLocal("pCoef")), - ...c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - ] - ), - c.br_if(1, c.i32_eqz ( c.getLocal("i") )), - c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - ); - - f.addCode( - c.call(prefix + "_mulByQ", cQX, Q1), - c.call(prefix + "_mulByQ", Q1, Q2) - ); - - if (isLoopNegative) { - f.addCode( - c.call(f2mPrefix + "_neg", RY, RY), - ); - } - - f.addCode( - c.call(f2mPrefix + "_neg", Q2Y, Q2Y), - - c.call(prefix + "_prepAddStep", Q1, R, c.getLocal("pCoef")), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - c.call(prefix + "_prepAddStep", Q2, R, c.getLocal("pCoef")), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - ); - } - - function buildMulBy024Old() { - const f = module.addFunction(prefix+ "__mulBy024Old"); - f.addParam("pEll0", "i32"); - f.addParam("pEllVW", "i32"); - f.addParam("pEllVV", "i32"); - f.addParam("pR", "i32"); // Result in F12 - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("pEll0"); - const x2 = c.getLocal("pEllVV"); - const x4 = c.getLocal("pEllVW"); - - const z0 = c.getLocal("pR"); - - const pAUX12 = module.alloc(ftsize); - const AUX12 = c.i32_const(pAUX12); - const AUX12_0 = c.i32_const(pAUX12); - const AUX12_2 = c.i32_const(pAUX12+f2size); - const AUX12_4 = c.i32_const(pAUX12+f2size*2); - const AUX12_6 = c.i32_const(pAUX12+f2size*3); - const AUX12_8 = c.i32_const(pAUX12+f2size*4); - const AUX12_10 = c.i32_const(pAUX12+f2size*5); - - f.addCode( - - c.call(f2mPrefix + "_copy", x0, AUX12_0), - c.call(f2mPrefix + "_zero", AUX12_2), - c.call(f2mPrefix + "_copy", x2, AUX12_4), - c.call(f2mPrefix + "_zero", AUX12_6), - c.call(f2mPrefix + "_copy", x4, AUX12_8), - c.call(f2mPrefix + "_zero", AUX12_10), - c.call(ftmPrefix + "_mul", AUX12, z0, z0), - ); - } - - function buildMulBy024() { - const f = module.addFunction(prefix+ "__mulBy024"); - f.addParam("pEll0", "i32"); - f.addParam("pEllVW", "i32"); - f.addParam("pEllVV", "i32"); - f.addParam("pR", "i32"); // Result in F12 - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("pEll0"); - const x2 = c.getLocal("pEllVV"); - const x4 = c.getLocal("pEllVW"); - - const z0 = c.getLocal("pR"); - const z1 = c.i32_add(c.getLocal("pR"), c.i32_const(2*n8)); - const z2 = c.i32_add(c.getLocal("pR"), c.i32_const(4*n8)); - const z3 = c.i32_add(c.getLocal("pR"), c.i32_const(6*n8)); - const z4 = c.i32_add(c.getLocal("pR"), c.i32_const(8*n8)); - const z5 = c.i32_add(c.getLocal("pR"), c.i32_const(10*n8)); - - const t0 = c.i32_const(module.alloc(f2size)); - const t1 = c.i32_const(module.alloc(f2size)); - const t2 = c.i32_const(module.alloc(f2size)); - const s0 = c.i32_const(module.alloc(f2size)); - const T3 = c.i32_const(module.alloc(f2size)); - const T4 = c.i32_const(module.alloc(f2size)); - const D0 = c.i32_const(module.alloc(f2size)); - const D2 = c.i32_const(module.alloc(f2size)); - const D4 = c.i32_const(module.alloc(f2size)); - const S1 = c.i32_const(module.alloc(f2size)); - const AUX = c.i32_const(module.alloc(f2size)); - - f.addCode( - - // D0 = z0 * x0; - c.call(f2mPrefix + "_mul", z0, x0, D0), - // D2 = z2 * x2; - c.call(f2mPrefix + "_mul", z2, x2, D2), - // D4 = z4 * x4; - c.call(f2mPrefix + "_mul", z4, x4, D4), - // t2 = z0 + z4; - c.call(f2mPrefix + "_add", z0, z4, t2), - // t1 = z0 + z2; - c.call(f2mPrefix + "_add", z0, z2, t1), - // s0 = z1 + z3 + z5; - c.call(f2mPrefix + "_add", z1, z3, s0), - c.call(f2mPrefix + "_add", s0, z5, s0), - - - // For z.a_.a_ = z0. - // S1 = z1 * x2; - c.call(f2mPrefix + "_mul", z1, x2, S1), - // T3 = S1 + D4; - c.call(f2mPrefix + "_add", S1, D4, T3), - // T4 = my_Fp6::non_residue * T3 + D0; - c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), T3, T4), - c.call(f2mPrefix + "_add", T4, D0, z0), - // z0 = T4; - - // For z.a_.b_ = z1 - // T3 = z5 * x4; - c.call(f2mPrefix + "_mul", z5, x4, T3), - // S1 = S1 + T3; - c.call(f2mPrefix + "_add", S1, T3, S1), - // T3 = T3 + D2; - c.call(f2mPrefix + "_add", T3, D2, T3), - // T4 = my_Fp6::non_residue * T3; - c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), T3, T4), - // T3 = z1 * x0; - c.call(f2mPrefix + "_mul", z1, x0, T3), - // S1 = S1 + T3; - c.call(f2mPrefix + "_add", S1, T3, S1), - // T4 = T4 + T3; - c.call(f2mPrefix + "_add", T4, T3, z1), - // z1 = T4; - - - - // For z.a_.c_ = z2 - // t0 = x0 + x2; - c.call(f2mPrefix + "_add", x0, x2, t0), - // T3 = t1 * t0 - D0 - D2; - c.call(f2mPrefix + "_mul", t1, t0, T3), - c.call(f2mPrefix + "_add", D0, D2, AUX), - c.call(f2mPrefix + "_sub", T3, AUX, T3), - // T4 = z3 * x4; - c.call(f2mPrefix + "_mul", z3, x4, T4), - // S1 = S1 + T4; - c.call(f2mPrefix + "_add", S1, T4, S1), - - - // For z.b_.a_ = z3 (z3 needs z2) - // t0 = z2 + z4; - c.call(f2mPrefix + "_add", z2, z4, t0), - // T3 = T3 + T4; - // z2 = T3; - c.call(f2mPrefix + "_add", T3, T4, z2), - // t1 = x2 + x4; - c.call(f2mPrefix + "_add", x2, x4, t1), - // T3 = t0 * t1 - D2 - D4; - c.call(f2mPrefix + "_mul", t1, t0, T3), - c.call(f2mPrefix + "_add", D2, D4, AUX), - c.call(f2mPrefix + "_sub", T3, AUX, T3), - // T4 = my_Fp6::non_residue * T3; - c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), T3, T4), - // T3 = z3 * x0; - c.call(f2mPrefix + "_mul", z3, x0, T3), - // S1 = S1 + T3; - c.call(f2mPrefix + "_add", S1, T3, S1), - // T4 = T4 + T3; - c.call(f2mPrefix + "_add", T4, T3, z3), - // z3 = T4; - - // For z.b_.b_ = z4 - // T3 = z5 * x2; - c.call(f2mPrefix + "_mul", z5, x2, T3), - // S1 = S1 + T3; - c.call(f2mPrefix + "_add", S1, T3, S1), - // T4 = my_Fp6::non_residue * T3; - c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), T3, T4), - // t0 = x0 + x4; - c.call(f2mPrefix + "_add", x0, x4, t0), - // T3 = t2 * t0 - D0 - D4; - c.call(f2mPrefix + "_mul", t2, t0, T3), - c.call(f2mPrefix + "_add", D0, D4, AUX), - c.call(f2mPrefix + "_sub", T3, AUX, T3), - // T4 = T4 + T3; - c.call(f2mPrefix + "_add", T4, T3, z4), - // z4 = T4; - - // For z.b_.c_ = z5. - // t0 = x0 + x2 + x4; - c.call(f2mPrefix + "_add", x0, x2, t0), - c.call(f2mPrefix + "_add", t0, x4, t0), - // T3 = s0 * t0 - S1; - c.call(f2mPrefix + "_mul", s0, t0, T3), - c.call(f2mPrefix + "_sub", T3, S1, z5), - // z5 = T3; - - ); - } - - - function buildMillerLoop() { - const f = module.addFunction(prefix+ "_millerLoop"); - f.addParam("ppreP", "i32"); - f.addParam("ppreQ", "i32"); - f.addParam("r", "i32"); - f.addLocal("pCoef", "i32"); - f.addLocal("i", "i32"); - - const c = f.getCodeBuilder(); - - const preP_PX = c.getLocal("ppreP"); - const preP_PY = c.i32_add(c.getLocal("ppreP"), c.i32_const(f1size)); - - const ELL_0 = c.getLocal("pCoef"); - const ELL_VW = c.i32_add(c.getLocal("pCoef"), c.i32_const(f2size)); - const ELL_VV = c.i32_add(c.getLocal("pCoef"), c.i32_const(2*f2size)); - - - const pVW = module.alloc(f2size); - const VW = c.i32_const(pVW); - const pVV = module.alloc(f2size); - const VV = c.i32_const(pVV); - - const F = c.getLocal("r"); - - - f.addCode( - c.call(ftmPrefix + "_one", F), - - c.setLocal("pCoef", c.i32_add( c.getLocal("ppreQ"), c.i32_const(f2size*3))), - - c.setLocal("i", c.i32_const(ateLoopBitBytes.length-2)), - c.block(c.loop( - - - c.call(ftmPrefix + "_square", F, F), - - c.call(f2mPrefix + "_mul1", ELL_VW,preP_PY, VW), - c.call(f2mPrefix + "_mul1", ELL_VV, preP_PX, VV), - c.call(prefix + "__mulBy024", ELL_0, VW, VV, F), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - c.if( - c.i32_load8_s(c.getLocal("i"), pAteLoopBitBytes), - [ - ...c.call(f2mPrefix + "_mul1", ELL_VW, preP_PY, VW), - ...c.call(f2mPrefix + "_mul1", ELL_VV, preP_PX, VV), - - ...c.call(prefix + "__mulBy024", ELL_0, VW, VV, F), - ...c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - ] - ), - c.br_if(1, c.i32_eqz ( c.getLocal("i") )), - c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - - ); - - if (isLoopNegative) { - f.addCode( - c.call(ftmPrefix + "_inverse", F, F), - ); - } - - f.addCode( - c.call(f2mPrefix + "_mul1", ELL_VW, preP_PY, VW), - c.call(f2mPrefix + "_mul1", ELL_VV, preP_PX, VV), - c.call(prefix + "__mulBy024", ELL_0, VW, VV, F), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - c.call(f2mPrefix + "_mul1", ELL_VW, preP_PY, VW), - c.call(f2mPrefix + "_mul1", ELL_VV, preP_PX, VV), - c.call(prefix + "__mulBy024", ELL_0, VW, VV, F), - c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), - - ); - - } - - - function buildFrobeniusMap(n) { - const F12 = [ - [ - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - ], - [ - [bigInt("1"), bigInt("0")], - [bigInt("8376118865763821496583973867626364092589906065868298776909617916018768340080"), bigInt("16469823323077808223889137241176536799009286646108169935659301613961712198316")], - [bigInt("21888242871839275220042445260109153167277707414472061641714758635765020556617"), bigInt("0")], - [bigInt("11697423496358154304825782922584725312912383441159505038794027105778954184319"), bigInt("303847389135065887422783454877609941456349188919719272345083954437860409601")], - [bigInt("21888242871839275220042445260109153167277707414472061641714758635765020556616"), bigInt("0")], - [bigInt("3321304630594332808241809054958361220322477375291206261884409189760185844239"), bigInt("5722266937896532885780051958958348231143373700109372999374820235121374419868")], - [bigInt("21888242871839275222246405745257275088696311157297823662689037894645226208582"), bigInt("0")], - [bigInt("13512124006075453725662431877630910996106405091429524885779419978626457868503"), bigInt("5418419548761466998357268504080738289687024511189653727029736280683514010267")], - [bigInt("2203960485148121921418603742825762020974279258880205651966"), bigInt("0")], - [bigInt("10190819375481120917420622822672549775783927716138318623895010788866272024264"), bigInt("21584395482704209334823622290379665147239961968378104390343953940207365798982")], - [bigInt("2203960485148121921418603742825762020974279258880205651967"), bigInt("0")], - [bigInt("18566938241244942414004596690298913868373833782006617400804628704885040364344"), bigInt("16165975933942742336466353786298926857552937457188450663314217659523851788715")], - ] - ]; - - const F6 = [ - [ - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - [bigInt("1"), bigInt("0")], - ], - [ - [bigInt("1"), bigInt("0")], - [bigInt("21575463638280843010398324269430826099269044274347216827212613867836435027261"), bigInt("10307601595873709700152284273816112264069230130616436755625194854815875713954")], - [bigInt("21888242871839275220042445260109153167277707414472061641714758635765020556616"), bigInt("0")], - [bigInt("3772000881919853776433695186713858239009073593817195771773381919316419345261"), bigInt("2236595495967245188281701248203181795121068902605861227855261137820944008926")], - [bigInt("2203960485148121921418603742825762020974279258880205651966"), bigInt("0")], - [bigInt("18429021223477853657660792034369865839114504446431234726392080002137598044644"), bigInt("9344045779998320333812420223237981029506012124075525679208581902008406485703")], - ], - [ - [bigInt("1"), bigInt("0")], - [bigInt("2581911344467009335267311115468803099551665605076196740867805258568234346338"), bigInt("19937756971775647987995932169929341994314640652964949448313374472400716661030")], - [bigInt("2203960485148121921418603742825762020974279258880205651966"), bigInt("0")], - [bigInt("5324479202449903542726783395506214481928257762400643279780343368557297135718"), bigInt("16208900380737693084919495127334387981393726419856888799917914180988844123039")], - [bigInt("21888242871839275220042445260109153167277707414472061641714758635765020556616"), bigInt("0")], - [bigInt("13981852324922362344252311234282257507216387789820983642040889267519694726527"), bigInt("7629828391165209371577384193250820201684255241773809077146787135900891633097")], - ] - ]; - - const f = module.addFunction(prefix+ "__frobeniusMap"+n); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - for (let i=0; i<6; i++) { - const X = (i==0) ? c.getLocal("x") : c.i32_add(c.getLocal("x"), c.i32_const(i*f2size)); - const Xc0 = X; - const Xc1 = c.i32_add(c.getLocal("x"), c.i32_const(i*f2size + f1size)); - const R = (i==0) ? c.getLocal("r") : c.i32_add(c.getLocal("r"), c.i32_const(i*f2size)); - const Rc0 = R; - const Rc1 = c.i32_add(c.getLocal("r"), c.i32_const(i*f2size + f1size)); - const coef = mul2(F12[Math.floor(i/3)][n%12] , F6[i%3][n%6]); - const pCoef = module.alloc([ - ...utils.bigInt2BytesLE(toMontgomery(coef[0]), 32), - ...utils.bigInt2BytesLE(toMontgomery(coef[1]), 32), - ]); - if (n%2 == 1) { - f.addCode( - c.call(f1mPrefix + "_copy", Xc0, Rc0), - c.call(f1mPrefix + "_neg", Xc1, Rc1), - c.call(f2mPrefix + "_mul", R, c.i32_const(pCoef), R), - ); - } else { - f.addCode(c.call(f2mPrefix + "_mul", X, c.i32_const(pCoef), R)); - } - } - - function mul2(a, b) { - const ac0 = bigInt(a[0]); - const ac1 = bigInt(a[1]); - const bc0 = bigInt(b[0]); - const bc1 = bigInt(b[1]); - const res = [ - ac0.times(bc0).minus( ac1.times(bc1) ).mod(q), - ac0.times(bc1).add( ac1.times(bc0) ).mod(q), - ]; - if (res[0].isNegative()) res[0] = res[0].add(q); - return res; - } - - } - - - - function buildFinalExponentiationFirstChunk() { - - const f = module.addFunction(prefix+ "__finalExponentiationFirstChunk"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const elt = c.getLocal("x"); - const eltC0 = elt; - const eltC1 = c.i32_add(elt, c.i32_const(n8*6)); - const r = c.getLocal("r"); - const pA = module.alloc(ftsize); - const A = c.i32_const(pA); - const Ac0 = A; - const Ac1 = c.i32_const(pA + n8*6); - const B = c.i32_const(module.alloc(ftsize)); - const C = c.i32_const(module.alloc(ftsize)); - const D = c.i32_const(module.alloc(ftsize)); - - f.addCode( - // const alt_bn128_Fq12 A = alt_bn128_Fq12(elt.c0,-elt.c1); - c.call(f6mPrefix + "_copy", eltC0, Ac0), - c.call(f6mPrefix + "_neg", eltC1, Ac1), - - // const alt_bn128_Fq12 B = elt.inverse(); - c.call(ftmPrefix + "_inverse", elt, B), - - // const alt_bn128_Fq12 C = A * B; - c.call(ftmPrefix + "_mul", A, B, C), - // const alt_bn128_Fq12 D = C.Frobenius_map(2); - c.call(prefix + "__frobeniusMap2", C, D), - // const alt_bn128_Fq12 result = D * C; - c.call(ftmPrefix + "_mul", C, D, r), - ); - } - - function buildCyclotomicSquare() { - const f = module.addFunction(prefix+ "__cyclotomicSquare"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x4 = c.i32_add(c.getLocal("x"), c.i32_const(f2size)); - const x3 = c.i32_add(c.getLocal("x"), c.i32_const(2*f2size)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(3*f2size)); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(4*f2size)); - const x5 = c.i32_add(c.getLocal("x"), c.i32_const(5*f2size)); - - const r0 = c.getLocal("r"); - const r4 = c.i32_add(c.getLocal("r"), c.i32_const(f2size)); - const r3 = c.i32_add(c.getLocal("r"), c.i32_const(2*f2size)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(3*f2size)); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(4*f2size)); - const r5 = c.i32_add(c.getLocal("r"), c.i32_const(5*f2size)); - - const t0 = c.i32_const(module.alloc(f2size)); - const t1 = c.i32_const(module.alloc(f2size)); - const t2 = c.i32_const(module.alloc(f2size)); - const t3 = c.i32_const(module.alloc(f2size)); - const t4 = c.i32_const(module.alloc(f2size)); - const t5 = c.i32_const(module.alloc(f2size)); - const tmp = c.i32_const(module.alloc(f2size)); - const AUX = c.i32_const(module.alloc(f2size)); - - - f.addCode( - -// c.call(ftmPrefix + "_square", x0, r0), - - // // t0 + t1*y = (z0 + z1*y)^2 = a^2 - // tmp = z0 * z1; - // t0 = (z0 + z1) * (z0 + my_Fp6::non_residue * z1) - tmp - my_Fp6::non_residue * tmp; - // t1 = tmp + tmp; - c.call(f2mPrefix + "_mul", x0, x1, tmp), - c.call(f2mPrefix + "_mul", x1, c.i32_const(pNonResidueF6), t0), - c.call(f2mPrefix + "_add", x0, t0, t0), - c.call(f2mPrefix + "_add", x0, x1, AUX), - c.call(f2mPrefix + "_mul", AUX, t0, t0), - c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), tmp, AUX), - c.call(f2mPrefix + "_add", tmp, AUX, AUX), - c.call(f2mPrefix + "_sub", t0, AUX, t0), - c.call(f2mPrefix + "_add", tmp, tmp, t1), - - // // t2 + t3*y = (z2 + z3*y)^2 = b^2 - // tmp = z2 * z3; - // t2 = (z2 + z3) * (z2 + my_Fp6::non_residue * z3) - tmp - my_Fp6::non_residue * tmp; - // t3 = tmp + tmp; - c.call(f2mPrefix + "_mul", x2, x3, tmp), - c.call(f2mPrefix + "_mul", x3, c.i32_const(pNonResidueF6), t2), - c.call(f2mPrefix + "_add", x2, t2, t2), - c.call(f2mPrefix + "_add", x2, x3, AUX), - c.call(f2mPrefix + "_mul", AUX, t2, t2), - c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), tmp, AUX), - c.call(f2mPrefix + "_add", tmp, AUX, AUX), - c.call(f2mPrefix + "_sub", t2, AUX, t2), - c.call(f2mPrefix + "_add", tmp, tmp, t3), - - // // t4 + t5*y = (z4 + z5*y)^2 = c^2 - // tmp = z4 * z5; - // t4 = (z4 + z5) * (z4 + my_Fp6::non_residue * z5) - tmp - my_Fp6::non_residue * tmp; - // t5 = tmp + tmp; - c.call(f2mPrefix + "_mul", x4, x5, tmp), - c.call(f2mPrefix + "_mul", x5, c.i32_const(pNonResidueF6), t4), - c.call(f2mPrefix + "_add", x4, t4, t4), - c.call(f2mPrefix + "_add", x4, x5, AUX), - c.call(f2mPrefix + "_mul", AUX, t4, t4), - c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), tmp, AUX), - c.call(f2mPrefix + "_add", tmp, AUX, AUX), - c.call(f2mPrefix + "_sub", t4, AUX, t4), - c.call(f2mPrefix + "_add", tmp, tmp, t5), - - // For A - // z0 = 3 * t0 - 2 * z0 - c.call(f2mPrefix + "_sub", t0, x0, r0), - c.call(f2mPrefix + "_add", r0, r0, r0), - c.call(f2mPrefix + "_add", t0, r0, r0), - // z1 = 3 * t1 + 2 * z1 - c.call(f2mPrefix + "_add", t1, x1, r1), - c.call(f2mPrefix + "_add", r1, r1, r1), - c.call(f2mPrefix + "_add", t1, r1, r1), - - // For B - // z2 = 3 * (xi * t5) + 2 * z2 - c.call(f2mPrefix + "_mul", t5, c.i32_const(pAltBn128Twist), AUX), - c.call(f2mPrefix + "_add", AUX, x2, r2), - c.call(f2mPrefix + "_add", r2, r2, r2), - c.call(f2mPrefix + "_add", AUX, r2, r2), - // z3 = 3 * t4 - 2 * z3 - c.call(f2mPrefix + "_sub", t4, x3, r3), - c.call(f2mPrefix + "_add", r3, r3, r3), - c.call(f2mPrefix + "_add", t4, r3, r3), - - // For C - // z4 = 3 * t2 - 2 * z4 - c.call(f2mPrefix + "_sub", t2, x4, r4), - c.call(f2mPrefix + "_add", r4, r4, r4), - c.call(f2mPrefix + "_add", t2, r4, r4), - // z5 = 3 * t3 + 2 * z5 - c.call(f2mPrefix + "_add", t3, x5, r5), - c.call(f2mPrefix + "_add", r5, r5, r5), - c.call(f2mPrefix + "_add", t3, r5, r5), - - ); - } - - - function buildCyclotomicExp(exponent, fnName) { - const exponentNafBytes = naf(exponent).map( (b) => (b==-1 ? 0xFF: b) ); - const pExponentNafBytes = module.alloc(exponentNafBytes); - const pExponent = module.alloc(utils.bigInt2BytesLE(exponent, 32)); - - const f = module.addFunction(prefix+ "__cyclotomicExp_"+fnName); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - f.addLocal("bit", "i32"); - f.addLocal("i", "i32"); - - const c = f.getCodeBuilder(); - - const x = c.getLocal("x"); - - const res = c.getLocal("r"); - - const inverse = c.i32_const(module.alloc(ftsize)); - - - f.addCode( -// c.call(ftmPrefix + "_exp", x, c.i32_const(pExponent), c.i32_const(32), res), - - c.call(ftmPrefix + "_conjugate", x, inverse), - c.call(ftmPrefix + "_one", res), - - c.if( - c.teeLocal("bit", c.i32_load8_s(c.i32_const(exponentNafBytes.length-1), pExponentNafBytes)), - c.if( - c.i32_eq( - c.getLocal("bit"), - c.i32_const(1) - ), - c.call(ftmPrefix + "_mul", res, x, res), - c.call(ftmPrefix + "_mul", res, inverse, res), - ) - ), - - c.setLocal("i", c.i32_const(exponentNafBytes.length-2)), - c.block(c.loop( -// c.call(ftmPrefix + "_square", res, res), - c.call(prefix + "__cyclotomicSquare", res, res), - c.if( - c.teeLocal("bit", c.i32_load8_s(c.getLocal("i"), pExponentNafBytes)), - c.if( - c.i32_eq( - c.getLocal("bit"), - c.i32_const(1) - ), - c.call(ftmPrefix + "_mul", res, x, res), - c.call(ftmPrefix + "_mul", res, inverse, res), - ) - ), - c.br_if(1, c.i32_eqz ( c.getLocal("i") )), - c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - ); - } - - - - function buildFinalExponentiationLastChunk() { - buildCyclotomicSquare(); - buildCyclotomicExp(finalExpZ, "w0"); - - const f = module.addFunction(prefix+ "__finalExponentiationLastChunk"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const elt = c.getLocal("x"); - const result = c.getLocal("r"); - const A = c.i32_const(module.alloc(ftsize)); - const B = c.i32_const(module.alloc(ftsize)); - const C = c.i32_const(module.alloc(ftsize)); - const D = c.i32_const(module.alloc(ftsize)); - const E = c.i32_const(module.alloc(ftsize)); - const F = c.i32_const(module.alloc(ftsize)); - const G = c.i32_const(module.alloc(ftsize)); - const H = c.i32_const(module.alloc(ftsize)); - const I = c.i32_const(module.alloc(ftsize)); - const J = c.i32_const(module.alloc(ftsize)); - const K = c.i32_const(module.alloc(ftsize)); - const L = c.i32_const(module.alloc(ftsize)); - const M = c.i32_const(module.alloc(ftsize)); - const N = c.i32_const(module.alloc(ftsize)); - const O = c.i32_const(module.alloc(ftsize)); - const P = c.i32_const(module.alloc(ftsize)); - const Q = c.i32_const(module.alloc(ftsize)); - const R = c.i32_const(module.alloc(ftsize)); - const S = c.i32_const(module.alloc(ftsize)); - const T = c.i32_const(module.alloc(ftsize)); - const U = c.i32_const(module.alloc(ftsize)); - - f.addCode( - - - // A = exp_by_neg_z(elt) // = elt^(-z) - c.call(prefix + "__cyclotomicExp_w0", elt, A), - finalExpIsNegative ? [] : c.call(ftmPrefix + "_conjugate", A, A), - // B = A^2 // = elt^(-2*z) - c.call(prefix + "__cyclotomicSquare", A, B), - // C = B^2 // = elt^(-4*z) - c.call(prefix + "__cyclotomicSquare", B, C), - // D = C * B // = elt^(-6*z) - c.call(ftmPrefix + "_mul", C, B, D), - // E = exp_by_neg_z(D) // = elt^(6*z^2) - c.call(prefix + "__cyclotomicExp_w0", D, E), - finalExpIsNegative ? [] : c.call(ftmPrefix + "_conjugate", E, E), - // F = E^2 // = elt^(12*z^2) - c.call(prefix + "__cyclotomicSquare", E, F), - // G = epx_by_neg_z(F) // = elt^(-12*z^3) - c.call(prefix + "__cyclotomicExp_w0", F, G), - finalExpIsNegative ? [] : c.call(ftmPrefix + "_conjugate", G, G), - // H = conj(D) // = elt^(6*z) - c.call(ftmPrefix + "_conjugate", D, H), - // I = conj(G) // = elt^(12*z^3) - c.call(ftmPrefix + "_conjugate", G, I), - // J = I * E // = elt^(12*z^3 + 6*z^2) - c.call(ftmPrefix + "_mul", I, E, J), - // K = J * H // = elt^(12*z^3 + 6*z^2 + 6*z) - c.call(ftmPrefix + "_mul", J, H, K), - // L = K * B // = elt^(12*z^3 + 6*z^2 + 4*z) - c.call(ftmPrefix + "_mul", K, B, L), - // M = K * E // = elt^(12*z^3 + 12*z^2 + 6*z) - c.call(ftmPrefix + "_mul", K, E, M), - - // N = M * elt // = elt^(12*z^3 + 12*z^2 + 6*z + 1) - c.call(ftmPrefix + "_mul", M, elt, N), - - // O = L.Frobenius_map(1) // = elt^(q*(12*z^3 + 6*z^2 + 4*z)) - c.call(prefix + "__frobeniusMap1", L, O), - // P = O * N // = elt^(q*(12*z^3 + 6*z^2 + 4*z) * (12*z^3 + 12*z^2 + 6*z + 1)) - c.call(ftmPrefix + "_mul", O, N, P), - // Q = K.Frobenius_map(2) // = elt^(q^2 * (12*z^3 + 6*z^2 + 6*z)) - c.call(prefix + "__frobeniusMap2", K, Q), - // R = Q * P // = elt^(q^2 * (12*z^3 + 6*z^2 + 6*z) + q*(12*z^3 + 6*z^2 + 4*z) * (12*z^3 + 12*z^2 + 6*z + 1)) - c.call(ftmPrefix + "_mul", Q, P, R), - // S = conj(elt) // = elt^(-1) - c.call(ftmPrefix + "_conjugate", elt, S), - // T = S * L // = elt^(12*z^3 + 6*z^2 + 4*z - 1) - c.call(ftmPrefix + "_mul", S, L, T), - // U = T.Frobenius_map(3) // = elt^(q^3(12*z^3 + 6*z^2 + 4*z - 1)) - c.call(prefix + "__frobeniusMap3", T, U), - // V = U * R // = elt^(q^3(12*z^3 + 6*z^2 + 4*z - 1) + q^2 * (12*z^3 + 6*z^2 + 6*z) + q*(12*z^3 + 6*z^2 + 4*z) * (12*z^3 + 12*z^2 + 6*z + 1)) - c.call(ftmPrefix + "_mul", U, R, result), - // result = V - ); - } - - - function buildFinalExponentiation() { - buildFinalExponentiationFirstChunk(); - buildFinalExponentiationLastChunk(); - const f = module.addFunction(prefix+ "_finalExponentiation"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const elt = c.getLocal("x"); - const result = c.getLocal("r"); - const eltToFirstChunk = c.i32_const(module.alloc(ftsize)); - - f.addCode( - c.call(prefix + "__finalExponentiationFirstChunk", elt, eltToFirstChunk ), - c.call(prefix + "__finalExponentiationLastChunk", eltToFirstChunk, result ) - ); - } - - - function buildFinalExponentiationOld() { - const f = module.addFunction(prefix+ "_finalExponentiationOld"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const exponent = bigInt("552484233613224096312617126783173147097382103762957654188882734314196910839907541213974502761540629817009608548654680343627701153829446747810907373256841551006201639677726139946029199968412598804882391702273019083653272047566316584365559776493027495458238373902875937659943504873220554161550525926302303331747463515644711876653177129578303191095900909191624817826566688241804408081892785725967931714097716709526092261278071952560171111444072049229123565057483750161460024353346284167282452756217662335528813519139808291170539072125381230815729071544861602750936964829313608137325426383735122175229541155376346436093930287402089517426973178917569713384748081827255472576937471496195752727188261435633271238710131736096299798168852925540549342330775279877006784354801422249722573783561685179618816480037695005515426162362431072245638324744480"); - - const pExponent = module.alloc(utils.bigInt2BytesLE( exponent, 352 )); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call(ftmPrefix + "_exp", c.getLocal("x"), c.i32_const(pExponent), c.i32_const(352), c.getLocal("r")), - ); - } - - - - - const pPreP = module.alloc(prePSize); - const pPreQ = module.alloc(preQSize); - - function buildPairingEquation(nPairings) { - - const f = module.addFunction(prefix+ "_pairingEq"+nPairings); - for (let i=0; i { - - - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ - -module.exports = function buildApplyKey(module, fnName, gPrefix, frPrefix, sizeGIn, sizeGOut, sizeF, opGtimesF) { +var build_timesscalar = function buildTimesScalar(module, fnName, elementLen, opAB, opAA, opCopy, opInit) { const f = module.addFunction(fnName); - f.addParam("pIn", "i32"); - f.addParam("n", "i32"); - f.addParam("pFirst", "i32"); - f.addParam("pInc", "i32"); - f.addParam("pOut", "i32"); - f.addLocal("pOldFree", "i32"); + f.addParam("base", "i32"); + f.addParam("scalar", "i32"); + f.addParam("scalarLength", "i32"); + f.addParam("r", "i32"); f.addLocal("i", "i32"); - f.addLocal("pFrom", "i32"); - f.addLocal("pTo", "i32"); + f.addLocal("b", "i32"); const c = f.getCodeBuilder(); - const t = c.i32_const(module.alloc(sizeF)); + const aux = c.i32_const(module.alloc(elementLen)); f.addCode( - c.setLocal("pFrom", c.getLocal("pIn")), - c.setLocal("pTo", c.getLocal("pOut")), - ); - - // t = first - f.addCode( - c.call( - frPrefix + "_copy", - c.getLocal("pFirst"), - t + c.if( + c.i32_eqz(c.getLocal("scalarLength")), + [ + ...c.call(opInit, c.getLocal("r")), + ...c.ret([]) + ] ) ); - f.addCode( - c.setLocal("i", c.i32_const(0)), - c.block(c.loop( - c.br_if(1, c.i32_eq ( c.getLocal("i"), c.getLocal("n") )), + f.addCode(c.call(opCopy, c.getLocal("base"), aux)); + f.addCode(c.call(opInit, c.getLocal("r"))); + f.addCode(c.setLocal("i", c.getLocal("scalarLength"))); + f.addCode(c.block(c.loop( + c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), - c.call( - opGtimesF, - c.getLocal("pFrom"), - t, - c.getLocal("pTo") - ), - c.setLocal("pFrom", c.i32_add(c.getLocal("pFrom"), c.i32_const(sizeGIn))), - c.setLocal("pTo", c.i32_add(c.getLocal("pTo"), c.i32_const(sizeGOut))), + c.setLocal( + "b", + c.i32_load8_u( + c.i32_add( + c.getLocal("scalar"), + c.getLocal("i") + ) + ) + ), + ...innerLoop(), + c.br_if(1, c.i32_eqz ( c.getLocal("i") )), + c.br(0) + ))); - // t = t* inc - c.call( - frPrefix + "_mul", - t, - c.getLocal("pInc"), - t - ), - c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )) - ); - module.exportFunction(fnName); + function innerLoop() { + const code = []; + for (let i=0; i<8; i++) { + code.push( + ...c.call(opAA, c.getLocal("r"), c.getLocal("r")), + ...c.if( + c.i32_ge_u( c.getLocal("b"), c.i32_const(0x80 >> i)), + [ + ...c.setLocal( + "b", + c.i32_sub( + c.getLocal("b"), + c.i32_const(0x80 >> i) + ) + ), + ...c.call(opAB, c.getLocal("r"),aux, c.getLocal("r")) + ] + ) + ); + } + return code; + } }; +var build_batchinverse = buildBatchInverse$3; -/***/ }), - -/***/ 9440: -/***/ ((module) => { - - - -module.exports = buildBatchConvertion; - -function buildBatchConvertion(module, fnName, internalFnName, sizeIn, sizeOut, reverse) { - if (typeof reverse === "undefined") { - // Set the reverse in a way that allows to use the same buffer as in/out. - if (sizeIn < sizeOut) { - reverse = true; - } else { - reverse = false; - } - } - - const f = module.addFunction(fnName); - f.addParam("pIn", "i32"); - f.addParam("n", "i32"); - f.addParam("pOut", "i32"); - f.addLocal("i", "i32"); - f.addLocal("itIn", "i32"); - f.addLocal("itOut", "i32"); - - const c = f.getCodeBuilder(); - - if (reverse) { - f.addCode( - c.setLocal("itIn", - c.i32_add( - c.getLocal("pIn"), - c.i32_mul( - c.i32_sub( - c.getLocal("n"), - c.i32_const(1) - ), - c.i32_const(sizeIn) - ) - ) - ), - c.setLocal("itOut", - c.i32_add( - c.getLocal("pOut"), - c.i32_mul( - c.i32_sub( - c.getLocal("n"), - c.i32_const(1) - ), - c.i32_const(sizeOut) - ) - ) - ), - c.setLocal("i", c.i32_const(0)), - c.block(c.loop( - c.br_if(1, c.i32_eq ( c.getLocal("i"), c.getLocal("n") )), - - c.call(internalFnName, c.getLocal("itIn"), c.getLocal("itOut")), - - c.setLocal("itIn", c.i32_sub(c.getLocal("itIn"), c.i32_const(sizeIn))), - c.setLocal("itOut", c.i32_sub(c.getLocal("itOut"), c.i32_const(sizeOut))), - c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )), - ); - } else { - f.addCode( - c.setLocal("itIn", c.getLocal("pIn")), - c.setLocal("itOut", c.getLocal("pOut")), - c.setLocal("i", c.i32_const(0)), - c.block(c.loop( - c.br_if(1, c.i32_eq ( c.getLocal("i"), c.getLocal("n") )), - - c.call(internalFnName, c.getLocal("itIn"), c.getLocal("itOut")), - - c.setLocal("itIn", c.i32_add(c.getLocal("itIn"), c.i32_const(sizeIn))), - c.setLocal("itOut", c.i32_add(c.getLocal("itOut"), c.i32_const(sizeOut))), - c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )), - ); - } -} - - -/***/ }), - -/***/ 18163: -/***/ ((module) => { - - -module.exports = buildBatchInverse; - -function buildBatchInverse(module, prefix) { +function buildBatchInverse$3(module, prefix) { const n8 = module.modules[prefix].n64*8; @@ -115040,17 +156018,88 @@ function buildBatchInverse(module, prefix) { } +var build_batchconvertion = buildBatchConvertion$3; -/***/ }), +function buildBatchConvertion$3(module, fnName, internalFnName, sizeIn, sizeOut, reverse) { + if (typeof reverse === "undefined") { + // Set the reverse in a way that allows to use the same buffer as in/out. + if (sizeIn < sizeOut) { + reverse = true; + } else { + reverse = false; + } + } -/***/ 4948: -/***/ ((module) => { + const f = module.addFunction(fnName); + f.addParam("pIn", "i32"); + f.addParam("n", "i32"); + f.addParam("pOut", "i32"); + f.addLocal("i", "i32"); + f.addLocal("itIn", "i32"); + f.addLocal("itOut", "i32"); + const c = f.getCodeBuilder(); + if (reverse) { + f.addCode( + c.setLocal("itIn", + c.i32_add( + c.getLocal("pIn"), + c.i32_mul( + c.i32_sub( + c.getLocal("n"), + c.i32_const(1) + ), + c.i32_const(sizeIn) + ) + ) + ), + c.setLocal("itOut", + c.i32_add( + c.getLocal("pOut"), + c.i32_mul( + c.i32_sub( + c.getLocal("n"), + c.i32_const(1) + ), + c.i32_const(sizeOut) + ) + ) + ), + c.setLocal("i", c.i32_const(0)), + c.block(c.loop( + c.br_if(1, c.i32_eq ( c.getLocal("i"), c.getLocal("n") )), -module.exports = buildBatchConvertion; + c.call(internalFnName, c.getLocal("itIn"), c.getLocal("itOut")), -function buildBatchConvertion(module, fnName, internalFnName, sizeIn, sizeOut, reverse) { + c.setLocal("itIn", c.i32_sub(c.getLocal("itIn"), c.i32_const(sizeIn))), + c.setLocal("itOut", c.i32_sub(c.getLocal("itOut"), c.i32_const(sizeOut))), + c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), + c.br(0) + )), + ); + } else { + f.addCode( + c.setLocal("itIn", c.getLocal("pIn")), + c.setLocal("itOut", c.getLocal("pOut")), + c.setLocal("i", c.i32_const(0)), + c.block(c.loop( + c.br_if(1, c.i32_eq ( c.getLocal("i"), c.getLocal("n") )), + + c.call(internalFnName, c.getLocal("itIn"), c.getLocal("itOut")), + + c.setLocal("itIn", c.i32_add(c.getLocal("itIn"), c.i32_const(sizeIn))), + c.setLocal("itOut", c.i32_add(c.getLocal("itOut"), c.i32_const(sizeOut))), + c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), + c.br(0) + )), + ); + } +} + +var build_batchop = buildBatchConvertion$2; + +function buildBatchConvertion$2(module, fnName, internalFnName, sizeIn, sizeOut, reverse) { if (typeof reverse === "undefined") { // Set the reverse in a way that allows to use the same buffer as in/out. if (sizeIn < sizeOut) { @@ -115144,11 +156193,162 @@ function buildBatchConvertion(module, fnName, internalFnName, sizeIn, sizeOut, r } } +var bigint = {}; -/***/ }), +// Many of these utilities are from the `big-integer` library, +// but adjusted to only work with native BigInt type +// Ref https://github.com/peterolson/BigInteger.js/blob/e5d2154d3c417069c51e7116bafc3b91d0b9fe41/BigInteger.js +// Originally licensed The Unlicense -/***/ 15904: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +function compare(a, b) { + return a === b ? 0 : a > b ? 1 : -1; +} + +function square$1(n) { + return n * n; +} + +function isOdd$4(n) { + return n % 2n !== 0n; +} + +function isEven(n) { + return n % 2n === 0n; +} + +function isNegative$3(n) { + return n < 0n; +} + +function isPositive(n) { + return n > 0n; +} + +function bitLength$5(n) { + if (isNegative$3(n)) { + return n.toString(2).length - 1; // discard the - sign + } else { + return n.toString(2).length; + } +} + +function abs(n) { + return n < 0n ? -n : n; +} + +function isUnit(n) { + return abs(n) === 1n; +} + +function modInv$3(a, n) { + var t = 0n, newT = 1n, r = n, newR = abs(a), q, lastT, lastR; + while (newR !== 0n) { + q = r / newR; + lastT = t; + lastR = r; + t = newT; + r = newR; + newT = lastT - (q * newT); + newR = lastR - (q * newR); + } + if (!isUnit(r)) throw new Error(a.toString() + " and " + n.toString() + " are not co-prime"); + if (compare(t, 0n) === -1) { + t = t + n; + } + if (isNegative$3(a)) { + return -t; + } + return t; +} + +function modPow$2(n, exp, mod) { + if (mod === 0n) throw new Error("Cannot take modPow with modulus 0"); + var r = 1n, + base = n % mod; + if (isNegative$3(exp)) { + exp = exp * -1n; + base = modInv$3(base, mod); + } + while (isPositive(exp)) { + if (base === 0n) return 0n; + if (isOdd$4(exp)) r = r * base % mod; + exp = exp / 2n; + base = square$1(base) % mod; + } + return r; +} + +function compareAbs(a, b) { + a = a >= 0n ? a : -a; + b = b >= 0n ? b : -b; + return a === b ? 0 : a > b ? 1 : -1; +} + +function isDivisibleBy(a, n) { + if (n === 0n) return false; + if (isUnit(n)) return true; + if (compareAbs(n, 2n) === 0) return isEven(a); + return a % n === 0n; +} + +function isBasicPrime(v) { + var n = abs(v); + if (isUnit(n)) return false; + if (n === 2n || n === 3n || n === 5n) return true; + if (isEven(n) || isDivisibleBy(n, 3n) || isDivisibleBy(n, 5n)) return false; + if (n < 49n) return true; + // we don't know if it's prime: let the other functions figure it out +} + +function prev(n) { + return n - 1n; +} + +function millerRabinTest(n, a) { + var nPrev = prev(n), + b = nPrev, + r = 0, + d, i, x; + while (isEven(b)) b = b / 2n, r++; + next: for (i = 0; i < a.length; i++) { + if (n < a[i]) continue; + x = modPow$2(BigInt(a[i]), b, n); + if (isUnit(x) || x === nPrev) continue; + for (d = r - 1; d != 0; d--) { + x = square$1(x) % n; + if (isUnit(x)) return false; + if (x === nPrev) continue next; + } + return false; + } + return true; +} + +function isPrime$1(p) { + var isPrime = isBasicPrime(p); + if (isPrime !== undefined) return isPrime; + var n = abs(p); + var bits = bitLength$5(n); + if (bits <= 64) + return millerRabinTest(n, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]); + var logN = Math.log(2) * Number(bits); + var t = Math.ceil(logN); + for (var a = [], i = 0; i < t; i++) { + a.push(BigInt(i + 2)); + } + return millerRabinTest(n, a); +} + +bigint.bitLength = bitLength$5; +bigint.isOdd = isOdd$4; +bigint.isNegative = isNegative$3; +bigint.abs = abs; +bigint.isUnit = isUnit; +bigint.compare = compare; +bigint.modInv = modInv$3; +bigint.modPow = modPow$2; +bigint.isPrime = isPrime$1; +bigint.square = square$1; /* Copyright 2019 0KIMS association. @@ -115169,12 +156369,3098 @@ function buildBatchConvertion(module, fnName, internalFnName, sizeIn, sizeOut, r along with wasmsnark. If not, see . */ -const buildTimesScalarNAF = __webpack_require__(33972); -//const buildTimesScalar = require("./build_timesscalar"); -const buildBatchConvertion = __webpack_require__(9440); -const buildMultiexp = __webpack_require__(74911); +const buildInt = build_int; +const utils$5 = utils$6; +const buildExp$2 = build_timesscalar; +const buildBatchInverse$2 = build_batchinverse; +const buildBatchConvertion$1 = build_batchconvertion; +const buildBatchOp = build_batchop; +const { bitLength: bitLength$4, modInv: modInv$2, modPow: modPow$1, isPrime, isOdd: isOdd$3, square } = bigint; -module.exports = function buildCurve(module, prefix, prefixField, pB) { +var build_f1m = function buildF1m(module, _q, _prefix, _intPrefix) { + const q = BigInt(_q); + const n64 = Math.floor((bitLength$4(q - 1n) - 1)/64) +1; + const n32 = n64*2; + const n8 = n64*8; + + const prefix = _prefix || "f1m"; + if (module.modules[prefix]) return prefix; // already builded + + const intPrefix = buildInt(module, n64, _intPrefix); + const pq = module.alloc(n8, utils$5.bigInt2BytesLE(q, n8)); + + const pR2 = module.alloc(utils$5.bigInt2BytesLE(square(1n << BigInt(n64*64)) % q, n8)); + const pOne = module.alloc(utils$5.bigInt2BytesLE((1n << BigInt(n64*64)) % q, n8)); + const pZero = module.alloc(utils$5.bigInt2BytesLE(0n, n8)); + const _minusOne = q - 1n; + const _e = _minusOne >> 1n; // e = (p-1)/2 + const pe = module.alloc(n8, utils$5.bigInt2BytesLE(_e, n8)); + + const _ePlusOne = _e + 1n; // e = (p-1)/2 + const pePlusOne = module.alloc(n8, utils$5.bigInt2BytesLE(_ePlusOne, n8)); + + module.modules[prefix] = { + pq: pq, + pR2: pR2, + n64: n64, + q: q, + pOne: pOne, + pZero: pZero, + pePlusOne: pePlusOne + }; + + function buildOne() { + const f = module.addFunction(prefix+"_one"); + f.addParam("pr", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode(c.call(intPrefix + "_copy", c.i32_const(pOne), c.getLocal("pr"))); + } + + function buildAdd() { + const f = module.addFunction(prefix+"_add"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode( + c.if( + c.call(intPrefix+"_add", c.getLocal("x"), c.getLocal("y"), c.getLocal("r")), + c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), + c.if( + c.call(intPrefix+"_gte", c.getLocal("r"), c.i32_const(pq) ), + c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), + ) + ) + ); + } + + function buildSub() { + const f = module.addFunction(prefix+"_sub"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode( + c.if( + c.call(intPrefix+"_sub", c.getLocal("x"), c.getLocal("y"), c.getLocal("r")), + c.drop(c.call(intPrefix+"_add", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))) + ) + ); + } + + function buildNeg() { + const f = module.addFunction(prefix+"_neg"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode( + c.call(prefix + "_sub", c.i32_const(pZero), c.getLocal("x"), c.getLocal("r")) + ); + } + + + function buildIsNegative() { + const f = module.addFunction(prefix+"_isNegative"); + f.addParam("x", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const AUX = c.i32_const(module.alloc(n8)); + + f.addCode( + c.call(prefix + "_fromMontgomery", c.getLocal("x"), AUX), + c.call(intPrefix + "_gte", AUX, c.i32_const(pePlusOne) ) + ); + } + + function buildSign() { + const f = module.addFunction(prefix+"_sign"); + f.addParam("x", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const AUX = c.i32_const(module.alloc(n8)); + + f.addCode( + c.if ( + c.call(intPrefix + "_isZero", c.getLocal("x")), + c.ret(c.i32_const(0)) + ), + c.call(prefix + "_fromMontgomery", c.getLocal("x"), AUX), + c.if( + c.call(intPrefix + "_gte", AUX, c.i32_const(pePlusOne)), + c.ret(c.i32_const(-1)) + ), + c.ret(c.i32_const(1)) + ); + } + + + function buildMReduct() { + const carries = module.alloc(n32*n32*8); + + const f = module.addFunction(prefix+"_mReduct"); + f.addParam("t", "i32"); + f.addParam("r", "i32"); + f.addLocal("np32", "i64"); + f.addLocal("c", "i64"); + f.addLocal("m", "i64"); + + const c = f.getCodeBuilder(); + + const np32 = Number(0x100000000n - modInv$2(q, 0x100000000n)); + + f.addCode(c.setLocal("np32", c.i64_const(np32))); + + for (let i=0; i=n32) { + f.addCode( + c.i64_store32( + c.getLocal("r"), + (k-n32)*4, + c.getLocal(c0) + ) + ); + } + [c0, c1] = [c1, c0]; + f.addCode( + c.setLocal(c1, + c.i64_shr_u( + c.getLocal(c0), + c.i64_const(32) + ) + ) + ); + } + f.addCode( + c.i64_store32( + c.getLocal("r"), + n32*4-4, + c.getLocal(c0) + ) + ); + + f.addCode( + c.if( + c.i32_wrap_i64(c.getLocal(c1)), + c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), + c.if( + c.call(intPrefix+"_gte", c.getLocal("r"), c.i32_const(pq) ), + c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), + ) + ) + ); + } + + + function buildSquare() { + + const f = module.addFunction(prefix+"_square"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + f.addLocal("c0", "i64"); + f.addLocal("c1", "i64"); + f.addLocal("c0_old", "i64"); + f.addLocal("c1_old", "i64"); + f.addLocal("np32", "i64"); + + + for (let i=0;i>1) )&&(i>1, k>>1) + ) + ) + ); + + f.addCode( + c.setLocal(c1, + c.i64_add( + c.getLocal(c1), + c.i64_shr_u( + c.getLocal(c0), + c.i64_const(32) + ) + ) + ) + ); + } + + // Add the old carry + + if (k>0) { + f.addCode( + c.setLocal(c0, + c.i64_add( + c.i64_and( + c.getLocal(c0), + c.i64_const(0xFFFFFFFF) + ), + c.i64_and( + c.getLocal(c0_old), + c.i64_const(0xFFFFFFFF) + ), + ) + ) + ); + + f.addCode( + c.setLocal(c1, + c.i64_add( + c.i64_add( + c.getLocal(c1), + c.i64_shr_u( + c.getLocal(c0), + c.i64_const(32) + ) + ), + c.getLocal(c1_old) + ) + ) + ); + } + + + for (let i=Math.max(1, k-n32+1); (i<=k)&&(i=n32) { + f.addCode( + c.i64_store32( + c.getLocal("r"), + (k-n32)*4, + c.getLocal(c0) + ) + ); + } + f.addCode( + c.setLocal( + c0_old, + c.getLocal(c1) + ), + c.setLocal( + c1_old, + c.i64_shr_u( + c.getLocal(c0_old), + c.i64_const(32) + ) + ) + ); + } + f.addCode( + c.i64_store32( + c.getLocal("r"), + n32*4-4, + c.getLocal(c0_old) + ) + ); + + f.addCode( + c.if( + c.i32_wrap_i64(c.getLocal(c1_old)), + c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), + c.if( + c.call(intPrefix+"_gte", c.getLocal("r"), c.i32_const(pq) ), + c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), + ) + ) + ); + } + + + function buildSquareOld() { + const f = module.addFunction(prefix+"_squareOld"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode(c.call(prefix + "_mul", c.getLocal("x"), c.getLocal("x"), c.getLocal("r"))); + } + + function buildToMontgomery() { + const f = module.addFunction(prefix+"_toMontgomery"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + f.addCode(c.call(prefix+"_mul", c.getLocal("x"), c.i32_const(pR2), c.getLocal("r"))); + } + + function buildFromMontgomery() { + + const pAux2 = module.alloc(n8*2); + + const f = module.addFunction(prefix+"_fromMontgomery"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + f.addCode(c.call(intPrefix + "_copy", c.getLocal("x"), c.i32_const(pAux2) )); + f.addCode(c.call(intPrefix + "_zero", c.i32_const(pAux2 + n8) )); + f.addCode(c.call(prefix+"_mReduct", c.i32_const(pAux2), c.getLocal("r"))); + } + + function buildInverse() { + + const f = module.addFunction(prefix+ "_inverse"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + f.addCode(c.call(prefix + "_fromMontgomery", c.getLocal("x"), c.getLocal("r"))); + f.addCode(c.call(intPrefix + "_inverseMod", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))); + f.addCode(c.call(prefix + "_toMontgomery", c.getLocal("r"), c.getLocal("r"))); + } + + // Calculate various valuse needed for sqrt + + + let _nqr = 2n; + if (isPrime(q)) { + while (modPow$1(_nqr, _e, q) !== _minusOne) _nqr = _nqr + 1n; + } + + let s2 = 0; + let _t = _minusOne; + + while ((!isOdd$3(_t))&&(_t !== 0n)) { + s2++; + _t = _t >> 1n; + } + const pt = module.alloc(n8, utils$5.bigInt2BytesLE(_t, n8)); + + const _nqrToT = modPow$1(_nqr, _t, q); + const pNqrToT = module.alloc(utils$5.bigInt2BytesLE((_nqrToT << BigInt(n64*64)) % q, n8)); + + const _tPlusOneOver2 = (_t + 1n) >> 1n; + const ptPlusOneOver2 = module.alloc(n8, utils$5.bigInt2BytesLE(_tPlusOneOver2, n8)); + + function buildSqrt() { + + const f = module.addFunction(prefix+ "_sqrt"); + f.addParam("n", "i32"); + f.addParam("r", "i32"); + f.addLocal("m", "i32"); + f.addLocal("i", "i32"); + f.addLocal("j", "i32"); + + const c = f.getCodeBuilder(); + + const ONE = c.i32_const(pOne); + const C = c.i32_const(module.alloc(n8)); + const T = c.i32_const(module.alloc(n8)); + const R = c.i32_const(module.alloc(n8)); + const SQ = c.i32_const(module.alloc(n8)); + const B = c.i32_const(module.alloc(n8)); + + f.addCode( + + // If (n==0) return 0 + c.if( + c.call(prefix + "_isZero", c.getLocal("n")), + c.ret( + c.call(prefix + "_zero", c.getLocal("r")) + ) + ), + + c.setLocal("m", c.i32_const(s2)), + c.call(prefix + "_copy", c.i32_const(pNqrToT), C), + c.call(prefix + "_exp", c.getLocal("n"), c.i32_const(pt), c.i32_const(n8), T), + c.call(prefix + "_exp", c.getLocal("n"), c.i32_const(ptPlusOneOver2), c.i32_const(n8), R), + + c.block(c.loop( + c.br_if(1, c.call(prefix + "_eq", T, ONE)), + + c.call(prefix + "_square", T, SQ), + c.setLocal("i", c.i32_const(1)), + c.block(c.loop( + c.br_if(1, c.call(prefix + "_eq", SQ, ONE)), + c.call(prefix + "_square", SQ, SQ), + c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), + c.br(0) + )), + + c.call(prefix + "_copy", C, B), + c.setLocal("j", c.i32_sub(c.i32_sub( c.getLocal("m"), c.getLocal("i")), c.i32_const(1)) ), + c.block(c.loop( + c.br_if(1, c.i32_eqz(c.getLocal("j"))), + c.call(prefix + "_square", B, B), + c.setLocal("j", c.i32_sub(c.getLocal("j"), c.i32_const(1))), + c.br(0) + )), + + c.setLocal("m", c.getLocal("i")), + c.call(prefix + "_square", B, C), + c.call(prefix + "_mul", T, C, T), + c.call(prefix + "_mul", R, B, R), + + c.br(0) + )), + + c.if( + c.call(prefix + "_isNegative", R), + c.call(prefix + "_neg", R, c.getLocal("r")), + c.call(prefix + "_copy", R, c.getLocal("r")), + ) + ); + } + + function buildIsSquare() { + const f = module.addFunction(prefix+"_isSquare"); + f.addParam("n", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const ONE = c.i32_const(pOne); + const AUX = c.i32_const(module.alloc(n8)); + + f.addCode( + c.if( + c.call(prefix + "_isZero", c.getLocal("n")), + c.ret(c.i32_const(1)) + ), + c.call(prefix + "_exp", c.getLocal("n"), c.i32_const(pe), c.i32_const(n8), AUX), + c.call(prefix + "_eq", AUX, ONE) + ); + } + + + function buildLoad() { + const f = module.addFunction(prefix+"_load"); + f.addParam("scalar", "i32"); + f.addParam("scalarLen", "i32"); + f.addParam("r", "i32"); + f.addLocal("p", "i32"); + f.addLocal("l", "i32"); + f.addLocal("i", "i32"); + f.addLocal("j", "i32"); + const c = f.getCodeBuilder(); + + const R = c.i32_const(module.alloc(n8)); + const pAux = module.alloc(n8); + const AUX = c.i32_const(pAux); + + f.addCode( + c.call(intPrefix + "_zero", c.getLocal("r")), + c.setLocal("i", c.i32_const(n8)), + c.setLocal("p", c.getLocal("scalar")), + c.block(c.loop( + c.br_if(1, c.i32_gt_u(c.getLocal("i"), c.getLocal("scalarLen"))), + + c.if( + c.i32_eq(c.getLocal("i"), c.i32_const(n8)), + c.call(prefix + "_one", R), + c.call(prefix + "_mul", R, c.i32_const(pR2), R) + ), + c.call(prefix + "_mul", c.getLocal("p"), R, AUX), + c.call(prefix + "_add", c.getLocal("r"), AUX, c.getLocal("r")), + + c.setLocal("p", c.i32_add(c.getLocal("p"), c.i32_const(n8))), + c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(n8))), + c.br(0) + )), + + c.setLocal("l", c.i32_rem_u( c.getLocal("scalarLen"), c.i32_const(n8))), + c.if(c.i32_eqz(c.getLocal("l")), c.ret([])), + c.call(intPrefix + "_zero", AUX), + c.setLocal("j", c.i32_const(0)), + c.block(c.loop( + c.br_if(1, c.i32_eq(c.getLocal("j"), c.getLocal("l"))), + + c.i32_store8( + c.getLocal("j"), + pAux, + c.i32_load8_u(c.getLocal("p")), + ), + c.setLocal("p", c.i32_add(c.getLocal("p"), c.i32_const(1))), + c.setLocal("j", c.i32_add(c.getLocal("j"), c.i32_const(1))), + c.br(0) + )), + + c.if( + c.i32_eq(c.getLocal("i"), c.i32_const(n8)), + c.call(prefix + "_one", R), + c.call(prefix + "_mul", R, c.i32_const(pR2), R) + ), + c.call(prefix + "_mul", AUX, R, AUX), + c.call(prefix + "_add", c.getLocal("r"), AUX, c.getLocal("r")), + ); + } + + function buildTimesScalar() { + const f = module.addFunction(prefix+"_timesScalar"); + f.addParam("x", "i32"); + f.addParam("scalar", "i32"); + f.addParam("scalarLen", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const AUX = c.i32_const(module.alloc(n8)); + + f.addCode( + c.call(prefix + "_load", c.getLocal("scalar"), c.getLocal("scalarLen"), AUX), + c.call(prefix + "_toMontgomery", AUX, AUX), + c.call(prefix + "_mul", c.getLocal("x"), AUX, c.getLocal("r")), + ); + } + + function buildIsOne() { + const f = module.addFunction(prefix+"_isOne"); + f.addParam("x", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + f.addCode( + c.ret(c.call(intPrefix + "_eq", c.getLocal("x"), c.i32_const(pOne))) + ); + } + + + module.exportFunction(intPrefix + "_copy", prefix+"_copy"); + module.exportFunction(intPrefix + "_zero", prefix+"_zero"); + module.exportFunction(intPrefix + "_isZero", prefix+"_isZero"); + module.exportFunction(intPrefix + "_eq", prefix+"_eq"); + + buildIsOne(); + buildAdd(); + buildSub(); + buildNeg(); + buildMReduct(); + buildMul(); + buildSquare(); + buildSquareOld(); + buildToMontgomery(); + buildFromMontgomery(); + buildIsNegative(); + buildSign(); + buildInverse(); + buildOne(); + buildLoad(); + buildTimesScalar(); + buildBatchInverse$2(module, prefix); + buildBatchConvertion$1(module, prefix + "_batchToMontgomery", prefix + "_toMontgomery", n8, n8); + buildBatchConvertion$1(module, prefix + "_batchFromMontgomery", prefix + "_fromMontgomery", n8, n8); + buildBatchConvertion$1(module, prefix + "_batchNeg", prefix + "_neg", n8, n8); + buildBatchOp(module, prefix + "_batchAdd", prefix + "_add", n8, n8); + buildBatchOp(module, prefix + "_batchSub", prefix + "_sub", n8, n8); + buildBatchOp(module, prefix + "_batchMul", prefix + "_mul", n8, n8); + + module.exportFunction(prefix + "_add"); + module.exportFunction(prefix + "_sub"); + module.exportFunction(prefix + "_neg"); + module.exportFunction(prefix + "_isNegative"); + module.exportFunction(prefix + "_isOne"); + module.exportFunction(prefix + "_sign"); + module.exportFunction(prefix + "_mReduct"); + module.exportFunction(prefix + "_mul"); + module.exportFunction(prefix + "_square"); + module.exportFunction(prefix + "_squareOld"); + module.exportFunction(prefix + "_fromMontgomery"); + module.exportFunction(prefix + "_toMontgomery"); + module.exportFunction(prefix + "_inverse"); + module.exportFunction(prefix + "_one"); + module.exportFunction(prefix + "_load"); + module.exportFunction(prefix + "_timesScalar"); + buildExp$2( + module, + prefix + "_exp", + n8, + prefix + "_mul", + prefix + "_square", + intPrefix + "_copy", + prefix + "_one", + ); + module.exportFunction(prefix + "_exp"); + module.exportFunction(prefix + "_batchInverse"); + if (isPrime(q)) { + buildSqrt(); + buildIsSquare(); + module.exportFunction(prefix + "_sqrt"); + module.exportFunction(prefix + "_isSquare"); + } + module.exportFunction(prefix + "_batchToMontgomery"); + module.exportFunction(prefix + "_batchFromMontgomery"); + // console.log(module.functionIdxByName); + + return prefix; +}; + +/* + Copyright 2019 0KIMS association. + + This file is part of wasmsnark (Web Assembly zkSnark Prover). + + wasmsnark is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + wasmsnark is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with wasmsnark. If not, see . +*/ + +const buildF1m$2 =build_f1m; +const { bitLength: bitLength$3 } = bigint; + +var build_f1 = function buildF1(module, _q, _prefix, _f1mPrefix, _intPrefix) { + + const q = BigInt(_q); + const n64 = Math.floor((bitLength$3(q - 1n) - 1)/64) +1; + const n8 = n64*8; + + const prefix = _prefix || "f1"; + if (module.modules[prefix]) return prefix; // already builded + module.modules[prefix] = { + n64: n64 + }; + + const intPrefix = _intPrefix || "int"; + const f1mPrefix = buildF1m$2(module, q, _f1mPrefix, intPrefix); + + + const pR2 = module.modules[f1mPrefix].pR2; + const pq = module.modules[f1mPrefix].pq; + const pePlusOne = module.modules[f1mPrefix].pePlusOne; + + function buildMul() { + const pAux1 = module.alloc(n8); + + const f = module.addFunction(prefix+ "_mul"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + f.addCode(c.call(f1mPrefix + "_mul", c.getLocal("x"), c.getLocal("y"), c.i32_const(pAux1))); + f.addCode(c.call(f1mPrefix + "_mul", c.i32_const(pAux1), c.i32_const(pR2), c.getLocal("r"))); + } + + function buildSquare() { + const f = module.addFunction(prefix+"_square"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode(c.call(prefix + "_mul", c.getLocal("x"), c.getLocal("x"), c.getLocal("r"))); + } + + + function buildInverse() { + + const f = module.addFunction(prefix+ "_inverse"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + f.addCode(c.call(intPrefix + "_inverseMod", c.getLocal("x"), c.i32_const(pq), c.getLocal("r"))); + } + + function buildIsNegative() { + const f = module.addFunction(prefix+"_isNegative"); + f.addParam("x", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + f.addCode( + c.call(intPrefix + "_gte", c.getLocal("x"), c.i32_const(pePlusOne) ) + ); + } + + + buildMul(); + buildSquare(); + buildInverse(); + buildIsNegative(); + module.exportFunction(f1mPrefix + "_add", prefix + "_add"); + module.exportFunction(f1mPrefix + "_sub", prefix + "_sub"); + module.exportFunction(f1mPrefix + "_neg", prefix + "_neg"); + module.exportFunction(prefix + "_mul"); + module.exportFunction(prefix + "_square"); + module.exportFunction(prefix + "_inverse"); + module.exportFunction(prefix + "_isNegative"); + module.exportFunction(f1mPrefix + "_copy", prefix+"_copy"); + module.exportFunction(f1mPrefix + "_zero", prefix+"_zero"); + module.exportFunction(f1mPrefix + "_one", prefix+"_one"); + module.exportFunction(f1mPrefix + "_isZero", prefix+"_isZero"); + module.exportFunction(f1mPrefix + "_eq", prefix+"_eq"); + + return prefix; +}; + +/* + Copyright 2019 0KIMS association. + + This file is part of wasmsnark (Web Assembly zkSnark Prover). + + wasmsnark is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + wasmsnark is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with wasmsnark. If not, see . +*/ + +const buildExp$1 = build_timesscalar; +const buildBatchInverse$1 = build_batchinverse; +const utils$4 = utils$6; + +var build_f2m = function buildF2m(module, mulNonResidueFn, prefix, f1mPrefix) { + + if (module.modules[prefix]) return prefix; // already builded + + const f1n8 = module.modules[f1mPrefix].n64*8; + const q = module.modules[f1mPrefix].q; + + module.modules[prefix] = { + n64: module.modules[f1mPrefix].n64*2 + }; + + function buildAdd() { + const f = module.addFunction(prefix+"_add"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const y0 = c.getLocal("y"); + const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_add", x0, y0, r0), + c.call(f1mPrefix+"_add", x1, y1, r1), + ); + } + + function buildTimesScalar() { + const f = module.addFunction(prefix+"_timesScalar"); + f.addParam("x", "i32"); + f.addParam("scalar", "i32"); + f.addParam("scalarLen", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_timesScalar", x0, c.getLocal("scalar"), c.getLocal("scalarLen"), r0), + c.call(f1mPrefix+"_timesScalar", x1, c.getLocal("scalar"), c.getLocal("scalarLen"), r1), + ); + } + + function buildSub() { + const f = module.addFunction(prefix+"_sub"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const y0 = c.getLocal("y"); + const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_sub", x0, y0, r0), + c.call(f1mPrefix+"_sub", x1, y1, r1), + ); + } + + function buildNeg() { + const f = module.addFunction(prefix+"_neg"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_neg", x0, r0), + c.call(f1mPrefix+"_neg", x1, r1), + ); + } + + function buildConjugate() { + const f = module.addFunction(prefix+"_conjugate"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_copy", x0, r0), + c.call(f1mPrefix+"_neg", x1, r1), + ); + } + + + function buildIsNegative() { + const f = module.addFunction(prefix+"_isNegative"); + f.addParam("x", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + + f.addCode( + c.if( + c.call(f1mPrefix+"_isZero", x1), + c.ret(c.call(f1mPrefix+"_isNegative", x0)) + ), + c.ret(c.call(f1mPrefix+"_isNegative", x1)) + ); + } + + function buildMul() { + const f = module.addFunction(prefix+"_mul"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const y0 = c.getLocal("y"); + const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + const A = c.i32_const(module.alloc(f1n8)); + const B = c.i32_const(module.alloc(f1n8)); + const C = c.i32_const(module.alloc(f1n8)); + const D = c.i32_const(module.alloc(f1n8)); + + + f.addCode( + c.call(f1mPrefix + "_mul", x0, y0, A), // A = x0*y0 + c.call(f1mPrefix + "_mul", x1, y1, B), // B = x1*y1 + + c.call(f1mPrefix + "_add", x0, x1, C), // C = x0 + x1 + c.call(f1mPrefix + "_add", y0, y1, D), // D = y0 + y1 + c.call(f1mPrefix + "_mul", C, D, C), // C = (x0 + x1)*(y0 + y1) = x0*y0+x0*y1+x1*y0+x1*y1 + + // c.call(f1mPrefix + "_mul", B, c.i32_const(pNonResidue), r0), // r0 = nr*(x1*y1) + c.call(mulNonResidueFn, B, r0), // r0 = nr*(x1*y1) + c.call(f1mPrefix + "_add", A, r0, r0), // r0 = x0*y0 + nr*(x1*y1) + c.call(f1mPrefix + "_add", A, B, r1), // r1 = x0*y0+x1*y1 + c.call(f1mPrefix + "_sub", C, r1, r1) // r1 = x0*y0+x0*y1+x1*y0+x1*y1 - x0*y0+x1*y1 = x0*y1+x1*y0 + ); + + } + + function buildMul1() { + const f = module.addFunction(prefix+"_mul1"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const y = c.getLocal("y"); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + + f.addCode( + c.call(f1mPrefix + "_mul", x0, y, r0), // A = x0*y + c.call(f1mPrefix + "_mul", x1, y, r1), // B = x1*y + ); + } + + function buildSquare() { + const f = module.addFunction(prefix+"_square"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + const AB = c.i32_const(module.alloc(f1n8)); + const APB = c.i32_const(module.alloc(f1n8)); + const APNB = c.i32_const(module.alloc(f1n8)); + const ABPNAB = c.i32_const(module.alloc(f1n8)); + + + f.addCode( + // AB = x0*y1 + c.call(f1mPrefix + "_mul", x0, x1, AB), + + // APB = x0+y1 + c.call(f1mPrefix + "_add", x0, x1, APB), + + // APBN0 = x0 + nr*x1 + c.call(mulNonResidueFn, x1, APNB), + c.call(f1mPrefix + "_add", x0, APNB, APNB), + + // ABPNAB = ab + nr*ab + c.call(mulNonResidueFn, AB, ABPNAB), + c.call(f1mPrefix + "_add", ABPNAB, AB, ABPNAB), + + // r0 = APB * APNB - ABPNAB + c.call(f1mPrefix + "_mul", APB, APNB, r0), + c.call(f1mPrefix + "_sub", r0, ABPNAB, r0), + + // r1 = AB + AB + c.call(f1mPrefix + "_add", AB, AB, r1), + ); + + } + + + function buildToMontgomery() { + const f = module.addFunction(prefix+"_toMontgomery"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_toMontgomery", x0, r0), + c.call(f1mPrefix+"_toMontgomery", x1, r1) + ); + } + + function buildFromMontgomery() { + const f = module.addFunction(prefix+"_fromMontgomery"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_fromMontgomery", x0, r0), + c.call(f1mPrefix+"_fromMontgomery", x1, r1) + ); + } + + function buildCopy() { + const f = module.addFunction(prefix+"_copy"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_copy", x0, r0), + c.call(f1mPrefix+"_copy", x1, r1) + ); + } + + function buildZero() { + const f = module.addFunction(prefix+"_zero"); + f.addParam("x", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_zero", x0), + c.call(f1mPrefix+"_zero", x1) + ); + } + + function buildOne() { + const f = module.addFunction(prefix+"_one"); + f.addParam("x", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_one", x0), + c.call(f1mPrefix+"_zero", x1) + ); + } + + function buildEq() { + const f = module.addFunction(prefix+"_eq"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const y0 = c.getLocal("y"); + const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); + + f.addCode( + c.i32_and( + c.call(f1mPrefix+"_eq", x0, y0), + c.call(f1mPrefix+"_eq", x1, y1) + ) + ); + } + + function buildIsZero() { + const f = module.addFunction(prefix+"_isZero"); + f.addParam("x", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + + f.addCode( + c.i32_and( + c.call(f1mPrefix+"_isZero", x0), + c.call(f1mPrefix+"_isZero", x1) + ) + ); + } + + function buildInverse() { + const f = module.addFunction(prefix+"_inverse"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + + const t0 = c.i32_const(module.alloc(f1n8)); + const t1 = c.i32_const(module.alloc(f1n8)); + const t2 = c.i32_const(module.alloc(f1n8)); + const t3 = c.i32_const(module.alloc(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_square", x0, t0), + c.call(f1mPrefix+"_square", x1, t1), + // c.call(f1mPrefix+"_mul", t1, c.i32_const(pNonResidue), t2), + c.call(mulNonResidueFn, t1, t2), + + c.call(f1mPrefix+"_sub", t0, t2, t2), + c.call(f1mPrefix+"_inverse", t2, t3), + + c.call(f1mPrefix+"_mul", x0, t3, r0), + c.call(f1mPrefix+"_mul", x1, t3, r1), + c.call(f1mPrefix+"_neg", r1, r1), + ); + } + + + function buildSign() { + const f = module.addFunction(prefix+"_sign"); + f.addParam("x", "i32"); + f.addLocal("s", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + + f.addCode( + c.setLocal("s" , c.call( f1mPrefix + "_sign", x1)), + c.if( + c.getLocal("s"), + c.ret(c.getLocal("s")) + ), + c.ret(c.call( f1mPrefix + "_sign", x0)) + ); + } + + function buildIsOne() { + const f = module.addFunction(prefix+"_isOne"); + f.addParam("x", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + + f.addCode( + c.ret(c.i32_and( + c.call(f1mPrefix + "_isOne", x0), + c.call(f1mPrefix + "_isZero", x1), + )) + ); + } + + + // Check here: https://eprint.iacr.org/2012/685.pdf + // Alg 9adj + function buildSqrt() { + + const f = module.addFunction(prefix+"_sqrt"); + f.addParam("a", "i32"); + f.addParam("pr", "i32"); + + const c = f.getCodeBuilder(); + + // BigInt can't take `undefined` so we use `|| 0` + const e34 = c.i32_const(module.alloc(utils$4.bigInt2BytesLE((BigInt(q || 0) - 3n) / 4n, f1n8 ))); + // BigInt can't take `undefined` so we use `|| 0` + const e12 = c.i32_const(module.alloc(utils$4.bigInt2BytesLE((BigInt(q || 0) - 1n) / 2n, f1n8 ))); + + const a = c.getLocal("a"); + const a1 = c.i32_const(module.alloc(f1n8*2)); + const alpha = c.i32_const(module.alloc(f1n8*2)); + const a0 = c.i32_const(module.alloc(f1n8*2)); + const pn1 = module.alloc(f1n8*2); + const n1 = c.i32_const(pn1); + const n1a = c.i32_const(pn1); + const n1b = c.i32_const(pn1+f1n8); + const x0 = c.i32_const(module.alloc(f1n8*2)); + const b = c.i32_const(module.alloc(f1n8*2)); + + f.addCode( + + c.call(prefix + "_one", n1), + c.call(prefix + "_neg", n1, n1), + + // const a1 = F.pow(a, F.sqrt_e34); + c.call(prefix + "_exp", a, e34, c.i32_const(f1n8), a1), + + // const a1 = F.pow(a, F.sqrt_e34); + c.call(prefix + "_square", a1, alpha), + c.call(prefix + "_mul", a, alpha, alpha), + + // const a0 = F.mul(F.frobenius(1, alfa), alfa); + c.call(prefix + "_conjugate", alpha, a0), + c.call(prefix + "_mul", a0, alpha, a0), + + // if (F.eq(a0, F.negone)) return null; + c.if(c.call(prefix + "_eq",a0,n1), c.unreachable() ), + + // const x0 = F.mul(a1, a); + c.call(prefix + "_mul", a1, a, x0), + + // if (F.eq(alfa, F.negone)) { + c.if( + c.call(prefix + "_eq", alpha, n1), + [ + // x = F.mul(x0, [F.F.zero, F.F.one]); + ...c.call(f1mPrefix + "_zero", n1a), + ...c.call(f1mPrefix + "_one", n1b), + ...c.call(prefix + "_mul", n1, x0, c.getLocal("pr")), + ], + [ + // const b = F.pow(F.add(F.one, alfa), F.sqrt_e12); + ...c.call(prefix + "_one", b), + ...c.call(prefix + "_add", b, alpha, b), + ...c.call(prefix + "_exp", b, e12, c.i32_const(f1n8), b), + + // x = F.mul(b, x0); + ...c.call(prefix + "_mul", b, x0, c.getLocal("pr")), + ] + ) + ); + + } + + + function buildIsSquare() { + + const f = module.addFunction(prefix+"_isSquare"); + f.addParam("a", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + // BigInt can't take `undefined` so we use `|| 0` + const e34 = c.i32_const(module.alloc(utils$4.bigInt2BytesLE((BigInt(q || 0) - 3n) / 4n, f1n8 ))); + + const a = c.getLocal("a"); + const a1 = c.i32_const(module.alloc(f1n8*2)); + const alpha = c.i32_const(module.alloc(f1n8*2)); + const a0 = c.i32_const(module.alloc(f1n8*2)); + const pn1 = module.alloc(f1n8*2); + const n1 = c.i32_const(pn1); + + f.addCode( + + c.call(prefix + "_one", n1), + c.call(prefix + "_neg", n1, n1), + + // const a1 = F.pow(a, F.sqrt_e34); + c.call(prefix + "_exp", a, e34, c.i32_const(f1n8), a1), + + // const a1 = F.pow(a, F.sqrt_e34); + c.call(prefix + "_square", a1, alpha), + c.call(prefix + "_mul", a, alpha, alpha), + + // const a0 = F.mul(F.frobenius(1, alfa), alfa); + c.call(prefix + "_conjugate", alpha, a0), + c.call(prefix + "_mul", a0, alpha, a0), + + // if (F.eq(a0, F.negone)) return null; + c.if( + c.call( + prefix + "_eq", + a0, + n1 + ), + c.ret(c.i32_const(0)) + ), + c.ret(c.i32_const(1)) + ); + + } + + + buildIsZero(); + buildIsOne(); + buildZero(); + buildOne(); + buildCopy(); + buildMul(); + buildMul1(); + buildSquare(); + buildAdd(); + buildSub(); + buildNeg(); + buildConjugate(); + buildToMontgomery(); + buildFromMontgomery(); + buildEq(); + buildInverse(); + buildTimesScalar(); + buildSign(); + buildIsNegative(); + + module.exportFunction(prefix + "_isZero"); + module.exportFunction(prefix + "_isOne"); + module.exportFunction(prefix + "_zero"); + module.exportFunction(prefix + "_one"); + module.exportFunction(prefix + "_copy"); + module.exportFunction(prefix + "_mul"); + module.exportFunction(prefix + "_mul1"); + module.exportFunction(prefix + "_square"); + module.exportFunction(prefix + "_add"); + module.exportFunction(prefix + "_sub"); + module.exportFunction(prefix + "_neg"); + module.exportFunction(prefix + "_sign"); + module.exportFunction(prefix + "_conjugate"); + module.exportFunction(prefix + "_fromMontgomery"); + module.exportFunction(prefix + "_toMontgomery"); + module.exportFunction(prefix + "_eq"); + module.exportFunction(prefix + "_inverse"); + buildBatchInverse$1(module, prefix); + buildExp$1( + module, + prefix + "_exp", + f1n8*2, + prefix + "_mul", + prefix + "_square", + prefix + "_copy", + prefix + "_one", + ); + buildSqrt(); + buildIsSquare(); + + module.exportFunction(prefix + "_exp"); + module.exportFunction(prefix + "_timesScalar"); + module.exportFunction(prefix + "_batchInverse"); + module.exportFunction(prefix + "_sqrt"); + module.exportFunction(prefix + "_isSquare"); + module.exportFunction(prefix + "_isNegative"); + + + return prefix; +}; + +/* + Copyright 2019 0KIMS association. + + This file is part of wasmsnark (Web Assembly zkSnark Prover). + + wasmsnark is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + wasmsnark is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with wasmsnark. If not, see . +*/ + +const buildExp = build_timesscalar; +const buildBatchInverse = build_batchinverse; + +var build_f3m = function buildF3m(module, mulNonResidueFn, prefix, f1mPrefix) { + + if (module.modules[prefix]) return prefix; // already builded + + const f1n8 = module.modules[f1mPrefix].n64*8; + module.modules[prefix] = { + n64: module.modules[f1mPrefix].n64*3 + }; + + function buildAdd() { + const f = module.addFunction(prefix+"_add"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + const y0 = c.getLocal("y"); + const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); + const y2 = c.i32_add(c.getLocal("y"), c.i32_const(2*f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); + + f.addCode( + c.call(f1mPrefix+"_add", x0, y0, r0), + c.call(f1mPrefix+"_add", x1, y1, r1), + c.call(f1mPrefix+"_add", x2, y2, r2), + ); + } + + function buildTimesScalar() { + const f = module.addFunction(prefix+"_timesScalar"); + f.addParam("x", "i32"); + f.addParam("scalar", "i32"); + f.addParam("scalarLen", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); + + f.addCode( + c.call(f1mPrefix+"_timesScalar", x0, c.getLocal("scalar"), c.getLocal("scalarLen"), r0), + c.call(f1mPrefix+"_timesScalar", x1, c.getLocal("scalar"), c.getLocal("scalarLen"), r1), + c.call(f1mPrefix+"_timesScalar", x2, c.getLocal("scalar"), c.getLocal("scalarLen"), r2), + ); + } + + + function buildSub() { + const f = module.addFunction(prefix+"_sub"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + const y0 = c.getLocal("y"); + const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); + const y2 = c.i32_add(c.getLocal("y"), c.i32_const(2*f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); + + f.addCode( + c.call(f1mPrefix+"_sub", x0, y0, r0), + c.call(f1mPrefix+"_sub", x1, y1, r1), + c.call(f1mPrefix+"_sub", x2, y2, r2), + ); + } + + function buildNeg() { + const f = module.addFunction(prefix+"_neg"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); + + f.addCode( + c.call(f1mPrefix+"_neg", x0, r0), + c.call(f1mPrefix+"_neg", x1, r1), + c.call(f1mPrefix+"_neg", x2, r2), + ); + } + + function buildIsNegative() { + const f = module.addFunction(prefix+"_isNegative"); + f.addParam("x", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + + f.addCode( + c.if( + c.call(f1mPrefix+"_isZero", x2), + c.if( + c.call(f1mPrefix+"_isZero", x1), + c.ret(c.call(f1mPrefix+"_isNegative", x0)), + c.ret(c.call(f1mPrefix+"_isNegative", x1)) + ) + ), + c.ret(c.call(f1mPrefix+"_isNegative", x2)) + ); + } + + + function buildMul() { + const f = module.addFunction(prefix+"_mul"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.addParam("r", "i32"); + + const cd = f.getCodeBuilder(); + + const a = cd.getLocal("x"); + const b = cd.i32_add(cd.getLocal("x"), cd.i32_const(f1n8)); + const c = cd.i32_add(cd.getLocal("x"), cd.i32_const(2*f1n8)); + const A = cd.getLocal("y"); + const B = cd.i32_add(cd.getLocal("y"), cd.i32_const(f1n8)); + const C = cd.i32_add(cd.getLocal("y"), cd.i32_const(2*f1n8)); + const r0 = cd.getLocal("r"); + const r1 = cd.i32_add(cd.getLocal("r"), cd.i32_const(f1n8)); + const r2 = cd.i32_add(cd.getLocal("r"), cd.i32_const(2*f1n8)); + + const aA = cd.i32_const(module.alloc(f1n8)); + const bB = cd.i32_const(module.alloc(f1n8)); + const cC = cd.i32_const(module.alloc(f1n8)); + const a_b = cd.i32_const(module.alloc(f1n8)); + const A_B = cd.i32_const(module.alloc(f1n8)); + const a_c = cd.i32_const(module.alloc(f1n8)); + const A_C = cd.i32_const(module.alloc(f1n8)); + const b_c = cd.i32_const(module.alloc(f1n8)); + const B_C = cd.i32_const(module.alloc(f1n8)); + const aA_bB = cd.i32_const(module.alloc(f1n8)); + const aA_cC = cd.i32_const(module.alloc(f1n8)); + const bB_cC = cd.i32_const(module.alloc(f1n8)); + const AUX = cd.i32_const(module.alloc(f1n8)); + + + f.addCode( + cd.call(f1mPrefix + "_mul", a, A, aA), + cd.call(f1mPrefix + "_mul", b, B, bB), + cd.call(f1mPrefix + "_mul", c, C, cC), + + cd.call(f1mPrefix + "_add", a, b, a_b), + cd.call(f1mPrefix + "_add", A, B, A_B), + cd.call(f1mPrefix + "_add", a, c, a_c), + cd.call(f1mPrefix + "_add", A, C, A_C), + cd.call(f1mPrefix + "_add", b, c, b_c), + cd.call(f1mPrefix + "_add", B, C, B_C), + + cd.call(f1mPrefix + "_add", aA, bB, aA_bB), + cd.call(f1mPrefix + "_add", aA, cC, aA_cC), + cd.call(f1mPrefix + "_add", bB, cC, bB_cC), + + cd.call(f1mPrefix + "_mul", b_c, B_C, r0), + cd.call(f1mPrefix + "_sub", r0, bB_cC, r0), + cd.call(mulNonResidueFn, r0, r0), + cd.call(f1mPrefix + "_add", aA, r0, r0), + + cd.call(f1mPrefix + "_mul", a_b, A_B, r1), + cd.call(f1mPrefix + "_sub", r1, aA_bB, r1), + cd.call(mulNonResidueFn, cC, AUX), + cd.call(f1mPrefix + "_add", r1, AUX, r1), + + cd.call(f1mPrefix + "_mul", a_c, A_C, r2), + cd.call(f1mPrefix + "_sub", r2, aA_cC, r2), + cd.call(f1mPrefix + "_add", r2, bB, r2), + ); + + } + + function buildSquare() { + const f = module.addFunction(prefix+"_square"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const A = c.getLocal("x"); + const B = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const C = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); + + const s0 = c.i32_const(module.alloc(f1n8)); + const ab = c.i32_const(module.alloc(f1n8)); + const s1 = c.i32_const(module.alloc(f1n8)); + const s2 = c.i32_const(module.alloc(f1n8)); + const bc = c.i32_const(module.alloc(f1n8)); + const s3 = c.i32_const(module.alloc(f1n8)); + const s4 = c.i32_const(module.alloc(f1n8)); + + + f.addCode( + + c.call(f1mPrefix + "_square", A, s0), + c.call(f1mPrefix + "_mul", A, B, ab), + c.call(f1mPrefix + "_add", ab, ab, s1), + + c.call(f1mPrefix + "_sub", A, B, s2), + c.call(f1mPrefix + "_add", s2, C, s2), + c.call(f1mPrefix + "_square", s2, s2), + + c.call(f1mPrefix + "_mul", B, C, bc), + c.call(f1mPrefix + "_add", bc, bc, s3), + + c.call(f1mPrefix + "_square", C, s4), + + c.call(mulNonResidueFn, s3, r0), + c.call(f1mPrefix + "_add", s0, r0, r0), + + c.call(mulNonResidueFn, s4, r1), + c.call(f1mPrefix + "_add", s1, r1, r1), + + c.call(f1mPrefix + "_add", s0, s4, r2), + c.call(f1mPrefix + "_sub", s3, r2, r2), + c.call(f1mPrefix + "_add", s2, r2, r2), + c.call(f1mPrefix + "_add", s1, r2, r2), + ); + + } + + + function buildToMontgomery() { + const f = module.addFunction(prefix+"_toMontgomery"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); + + f.addCode( + c.call(f1mPrefix+"_toMontgomery", x0, r0), + c.call(f1mPrefix+"_toMontgomery", x1, r1), + c.call(f1mPrefix+"_toMontgomery", x2, r2) + ); + } + + function buildFromMontgomery() { + const f = module.addFunction(prefix+"_fromMontgomery"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); + + f.addCode( + c.call(f1mPrefix+"_fromMontgomery", x0, r0), + c.call(f1mPrefix+"_fromMontgomery", x1, r1), + c.call(f1mPrefix+"_fromMontgomery", x2, r2) + ); + } + + function buildCopy() { + const f = module.addFunction(prefix+"_copy"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); + + f.addCode( + c.call(f1mPrefix+"_copy", x0, r0), + c.call(f1mPrefix+"_copy", x1, r1), + c.call(f1mPrefix+"_copy", x2, r2), + ); + } + + function buildZero() { + const f = module.addFunction(prefix+"_zero"); + f.addParam("x", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + + f.addCode( + c.call(f1mPrefix+"_zero", x0), + c.call(f1mPrefix+"_zero", x1), + c.call(f1mPrefix+"_zero", x2), + ); + } + + function buildOne() { + const f = module.addFunction(prefix+"_one"); + f.addParam("x", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + + f.addCode( + c.call(f1mPrefix+"_one", x0), + c.call(f1mPrefix+"_zero", x1), + c.call(f1mPrefix+"_zero", x2), + ); + } + + function buildEq() { + const f = module.addFunction(prefix+"_eq"); + f.addParam("x", "i32"); + f.addParam("y", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + const y0 = c.getLocal("y"); + const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); + const y2 = c.i32_add(c.getLocal("y"), c.i32_const(2*f1n8)); + + f.addCode( + c.i32_and( + c.i32_and( + c.call(f1mPrefix+"_eq", x0, y0), + c.call(f1mPrefix+"_eq", x1, y1), + ), + c.call(f1mPrefix+"_eq", x2, y2) + ) + ); + } + + function buildIsZero() { + const f = module.addFunction(prefix+"_isZero"); + f.addParam("x", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + + f.addCode( + c.i32_and( + c.i32_and( + c.call(f1mPrefix+"_isZero", x0), + c.call(f1mPrefix+"_isZero", x1) + ), + c.call(f1mPrefix+"_isZero", x2) + ) + ); + } + + function buildInverse() { + const f = module.addFunction(prefix+"_inverse"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + const r0 = c.getLocal("r"); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); + const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); + + const t0 = c.i32_const(module.alloc(f1n8)); + const t1 = c.i32_const(module.alloc(f1n8)); + const t2 = c.i32_const(module.alloc(f1n8)); + const t3 = c.i32_const(module.alloc(f1n8)); + const t4 = c.i32_const(module.alloc(f1n8)); + const t5 = c.i32_const(module.alloc(f1n8)); + const c0 = c.i32_const(module.alloc(f1n8)); + const c1 = c.i32_const(module.alloc(f1n8)); + const c2 = c.i32_const(module.alloc(f1n8)); + const t6 = c.i32_const(module.alloc(f1n8)); + const AUX = c.i32_const(module.alloc(f1n8)); + + f.addCode( + c.call(f1mPrefix+"_square", x0, t0), + c.call(f1mPrefix+"_square", x1, t1), + c.call(f1mPrefix+"_square", x2, t2), + c.call(f1mPrefix+"_mul", x0, x1, t3), + c.call(f1mPrefix+"_mul", x0, x2, t4), + c.call(f1mPrefix+"_mul", x1, x2, t5), + + c.call(mulNonResidueFn, t5, c0), + c.call(f1mPrefix+"_sub", t0, c0, c0), + + c.call(mulNonResidueFn, t2, c1), + c.call(f1mPrefix+"_sub", c1, t3, c1), + + c.call(f1mPrefix+"_sub", t1, t4, c2), + + c.call(f1mPrefix+"_mul", x2, c1, t6), + c.call(f1mPrefix+"_mul", x1, c2, AUX), + c.call(f1mPrefix+"_add", t6, AUX, t6), + c.call(mulNonResidueFn, t6, t6), + c.call(f1mPrefix+"_mul", x0, c0, AUX), + c.call(f1mPrefix+"_add", AUX, t6, t6), + + c.call(f1mPrefix+"_inverse", t6, t6), + + c.call(f1mPrefix+"_mul", t6, c0, r0), + c.call(f1mPrefix+"_mul", t6, c1, r1), + c.call(f1mPrefix+"_mul", t6, c2, r2) + ); + } + + + function buildSign() { + const f = module.addFunction(prefix+"_sign"); + f.addParam("x", "i32"); + f.addLocal("s", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); + + f.addCode( + c.setLocal("s" , c.call( f1mPrefix + "_sign", x2)), + c.if( + c.getLocal("s"), + c.ret(c.getLocal("s")) + ), + c.setLocal("s" , c.call( f1mPrefix + "_sign", x1)), + c.if( + c.getLocal("s"), + c.ret(c.getLocal("s")) + ), + c.ret(c.call( f1mPrefix + "_sign", x0)) + ); + } + + function buildIsOne() { + const f = module.addFunction(prefix+"_isOne"); + f.addParam("x", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8*2)); + + f.addCode( + c.ret( + c.i32_and( + c.i32_and( + c.call(f1mPrefix + "_isOne", x0), + c.call(f1mPrefix + "_isZero", x1) + ), + c.call(f1mPrefix + "_isZero", x2) + ) + ) + ); + } + + buildIsZero(); + buildIsOne(); + buildZero(); + buildOne(); + buildCopy(); + buildMul(); + buildSquare(); + buildAdd(); + buildSub(); + buildNeg(); + buildSign(); + buildToMontgomery(); + buildFromMontgomery(); + buildEq(); + buildInverse(); + buildTimesScalar(); + buildIsNegative(); + + module.exportFunction(prefix + "_isZero"); + module.exportFunction(prefix + "_isOne"); + module.exportFunction(prefix + "_zero"); + module.exportFunction(prefix + "_one"); + module.exportFunction(prefix + "_copy"); + module.exportFunction(prefix + "_mul"); + module.exportFunction(prefix + "_square"); + module.exportFunction(prefix + "_add"); + module.exportFunction(prefix + "_sub"); + module.exportFunction(prefix + "_neg"); + module.exportFunction(prefix + "_sign"); + module.exportFunction(prefix + "_fromMontgomery"); + module.exportFunction(prefix + "_toMontgomery"); + module.exportFunction(prefix + "_eq"); + module.exportFunction(prefix + "_inverse"); + buildBatchInverse(module, prefix); + buildExp( + module, + prefix + "_exp", + f1n8*3, + prefix + "_mul", + prefix + "_square", + prefix + "_copy", + prefix + "_one" + ); + module.exportFunction(prefix + "_exp"); + module.exportFunction(prefix + "_timesScalar"); + module.exportFunction(prefix + "_batchInverse"); + module.exportFunction(prefix + "_isNegative"); + + return prefix; +}; + +/* + Copyright 2019 0KIMS association. + + This file is part of wasmsnark (Web Assembly zkSnark Prover). + + wasmsnark is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + wasmsnark is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with wasmsnark. If not, see . +*/ + +var build_timesscalarnaf = function buildTimesScalarNAF(module, fnName, elementLen, opAB, opAA, opAmB, opCopy, opInit) { + + const f = module.addFunction(fnName); + f.addParam("base", "i32"); + f.addParam("scalar", "i32"); + f.addParam("scalarLength", "i32"); + f.addParam("r", "i32"); + f.addLocal("old0", "i32"); + f.addLocal("nbits", "i32"); + f.addLocal("i", "i32"); + f.addLocal("last", "i32"); + f.addLocal("cur", "i32"); + f.addLocal("carry", "i32"); + f.addLocal("p", "i32"); + + const c = f.getCodeBuilder(); + + const aux = c.i32_const(module.alloc(elementLen)); + + function getBit(IDX) { + return c.i32_and( + c.i32_shr_u( + c.i32_load( + c.i32_add( + c.getLocal("scalar"), + c.i32_and( + c.i32_shr_u( + IDX, + c.i32_const(3) + ), + c.i32_const(0xFFFFFFFC) + ) + ) + ), + c.i32_and( + IDX, + c.i32_const(0x1F) + ) + ), + c.i32_const(1) + ); + } + + function pushBit(b) { + return [ + ...c.i32_store8( + c.getLocal("p"), + c.i32_const(b) + ), + ...c.setLocal( + "p", + c.i32_add( + c.getLocal("p"), + c.i32_const(1) + ) + ) + ]; + } + + f.addCode( + c.if( + c.i32_eqz(c.getLocal("scalarLength")), + [ + ...c.call(opInit, c.getLocal("r")), + ...c.ret([]) + ] + ), + c.setLocal("nbits", c.i32_shl(c.getLocal("scalarLength"), c.i32_const(3))), + c.setLocal("old0", c.i32_load(c.i32_const(0))), + c.setLocal("p", c.getLocal("old0")), + c.i32_store( + c.i32_const(0), + c.i32_and( + c.i32_add( + c.i32_add( + c.getLocal("old0"), + c.i32_const(32) + ), + c.getLocal("nbits") + ), + c.i32_const(0xFFFFFFF8) + ) + ), + c.setLocal("i", c.i32_const(1)), + + c.setLocal("last",getBit(c.i32_const(0))), + c.setLocal("carry",c.i32_const(0)), + + c.block(c.loop( + c.br_if(1, c.i32_eq( c.getLocal("i"), c.getLocal("nbits"))), + + c.setLocal("cur", getBit(c.getLocal("i"))), + c.if( c.getLocal("last"), + c.if( c.getLocal("cur"), + c.if(c.getLocal("carry"), + [ + ...c.setLocal("last", c.i32_const(0)), + ...c.setLocal("carry", c.i32_const(1)), + ...pushBit(1) + ] + , + [ + ...c.setLocal("last", c.i32_const(0)), + ...c.setLocal("carry", c.i32_const(1)), + ...pushBit(255) + ], + ), + c.if(c.getLocal("carry"), + [ + ...c.setLocal("last", c.i32_const(0)), + ...c.setLocal("carry", c.i32_const(1)), + ...pushBit(255) + ] + , + [ + ...c.setLocal("last", c.i32_const(0)), + ...c.setLocal("carry", c.i32_const(0)), + ...pushBit(1) + ], + ), + ), + c.if( c.getLocal("cur"), + c.if(c.getLocal("carry"), + [ + ...c.setLocal("last", c.i32_const(0)), + ...c.setLocal("carry", c.i32_const(1)), + ...pushBit(0) + ] + , + [ + ...c.setLocal("last", c.i32_const(1)), + ...c.setLocal("carry", c.i32_const(0)), + ...pushBit(0) + ], + ), + c.if(c.getLocal("carry"), + [ + ...c.setLocal("last", c.i32_const(1)), + ...c.setLocal("carry", c.i32_const(0)), + ...pushBit(0) + ] + , + [ + ...c.setLocal("last", c.i32_const(0)), + ...c.setLocal("carry", c.i32_const(0)), + ...pushBit(0) + ], + ), + ) + ), + c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), + c.br(0) + )), + + c.if( c.getLocal("last"), + c.if(c.getLocal("carry"), + [ + ...pushBit(255), + ...pushBit(0), + ...pushBit(1) + ] + , + [ + ...pushBit(1) + ], + ), + c.if(c.getLocal("carry"), + [ + ...pushBit(0), + ...pushBit(1) + ] + ), + ), + + c.setLocal("p", c.i32_sub(c.getLocal("p"), c.i32_const(1))), + + // p already points to the last bit + + c.call(opCopy, c.getLocal("base"), aux), + + c.call(opInit, c.getLocal("r")), + + c.block(c.loop( + + + c.call(opAA, c.getLocal("r"), c.getLocal("r")), + + + c.setLocal("cur", + c.i32_load8_u( + c.getLocal("p") + ) + ), + + c.if( + c.getLocal("cur"), + c.if( + c.i32_eq(c.getLocal("cur"), c.i32_const(1)), + c.call(opAB, c.getLocal("r"), aux, c.getLocal("r")), + c.call(opAmB, c.getLocal("r"), aux, c.getLocal("r")), + ) + ), + + c.br_if(1, c.i32_eq( c.getLocal("old0"), c.getLocal("p"))), + c.setLocal("p", c.i32_sub(c.getLocal("p"), c.i32_const(1))), + c.br(0) + + )), + + c.i32_store( c.i32_const(0), c.getLocal("old0")) + + ); + +}; + +/* + Copyright 2019 0KIMS association. + + This file is part of wasmsnark (Web Assembly zkSnark Prover). + + wasmsnark is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + wasmsnark is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with wasmsnark. If not, see . +*/ + +var build_multiexp = function buildMultiexp(module, prefix, fnName, opAdd, n8b) { + + const n64g = module.modules[prefix].n64; + const n8g = n64g*8; + + function buildGetChunk() { + const f = module.addFunction(fnName + "_getChunk"); + f.addParam("pScalar", "i32"); + f.addParam("scalarSize", "i32"); // Number of bytes of the scalar + f.addParam("startBit", "i32"); // Bit to start extract + f.addParam("chunkSize", "i32"); // Chunk size in bits + f.addLocal("bitsToEnd", "i32"); + f.addLocal("mask", "i32"); + f.setReturnType("i32"); + + const c = f.getCodeBuilder(); + + f.addCode( + c.setLocal("bitsToEnd", + c.i32_sub( + c.i32_mul( + c.getLocal("scalarSize"), + c.i32_const(8) + ), + c.getLocal("startBit") + ) + ), + c.if( + c.i32_gt_s( + c.getLocal("chunkSize"), + c.getLocal("bitsToEnd") + ), + c.setLocal( + "mask", + c.i32_sub( + c.i32_shl( + c.i32_const(1), + c.getLocal("bitsToEnd") + ), + c.i32_const(1) + ) + ), + c.setLocal( + "mask", + c.i32_sub( + c.i32_shl( + c.i32_const(1), + c.getLocal("chunkSize") + ), + c.i32_const(1) + ) + ) + ), + c.i32_and( + c.i32_shr_u( + c.i32_load( + c.i32_add( + c.getLocal("pScalar"), + c.i32_shr_u( + c.getLocal("startBit"), + c.i32_const(3) + ) + ), + 0, // offset + 0 // align to byte. + ), + c.i32_and( + c.getLocal("startBit"), + c.i32_const(0x7) + ) + ), + c.getLocal("mask") + ) + ); + } + + function buildMutiexpChunk() { + const f = module.addFunction(fnName + "_chunk"); + f.addParam("pBases", "i32"); + f.addParam("pScalars", "i32"); + f.addParam("scalarSize", "i32"); // Number of points + f.addParam("n", "i32"); // Number of points + f.addParam("startBit", "i32"); // bit where it starts the chunk + f.addParam("chunkSize", "i32"); // bit where it starts the chunk + f.addParam("pr", "i32"); + f.addLocal("nChunks", "i32"); + f.addLocal("itScalar", "i32"); + f.addLocal("endScalar", "i32"); + f.addLocal("itBase", "i32"); + f.addLocal("i", "i32"); + f.addLocal("j", "i32"); + f.addLocal("nTable", "i32"); + f.addLocal("pTable", "i32"); + f.addLocal("idx", "i32"); + f.addLocal("pIdxTable", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode( + c.if( + c.i32_eqz(c.getLocal("n")), + [ + ...c.call(prefix + "_zero", c.getLocal("pr")), + ...c.ret([]) + ] + ), + + // Allocate memory + + c.setLocal( + "nTable", + c.i32_shl( + c.i32_const(1), + c.getLocal("chunkSize") + ) + ), + c.setLocal("pTable", c.i32_load( c.i32_const(0) )), + c.i32_store( + c.i32_const(0), + c.i32_add( + c.getLocal("pTable"), + c.i32_mul( + c.getLocal("nTable"), + c.i32_const(n8g) + ) + ) + ), + + // Reset Table + c.setLocal("j", c.i32_const(0)), + c.block(c.loop( + c.br_if( + 1, + c.i32_eq( + c.getLocal("j"), + c.getLocal("nTable") + ) + ), + + c.call( + prefix + "_zero", + c.i32_add( + c.getLocal("pTable"), + c.i32_mul( + c.getLocal("j"), + c.i32_const(n8g) + ) + ) + ), + + c.setLocal("j", c.i32_add(c.getLocal("j"), c.i32_const(1))), + c.br(0) + )), + + // Distribute elements + c.setLocal("itBase", c.getLocal("pBases")), + c.setLocal("itScalar", c.getLocal("pScalars")), + c.setLocal("endScalar", + c.i32_add( + c.getLocal("pScalars"), + c.i32_mul( + c.getLocal("n"), + c.getLocal("scalarSize") + ) + ) + ), + c.block(c.loop( + c.br_if( + 1, + c.i32_eq( + c.getLocal("itScalar"), + c.getLocal("endScalar") + ) + ), + + c.setLocal( + "idx", + c.call(fnName + "_getChunk", + c.getLocal("itScalar"), + c.getLocal("scalarSize"), + c.getLocal("startBit"), + c.getLocal("chunkSize") + ) + ), + + c.if( + c.getLocal("idx"), + [ + ...c.setLocal( + "pIdxTable", + c.i32_add( + c.getLocal("pTable"), + c.i32_mul( + c.i32_sub( + c.getLocal("idx"), + c.i32_const(1) + ), + c.i32_const(n8g) + ) + ) + ), + ...c.call( + opAdd, + c.getLocal("pIdxTable"), + c.getLocal("itBase"), + c.getLocal("pIdxTable"), + ) + ] + ), + + c.setLocal("itScalar", c.i32_add(c.getLocal("itScalar"), c.getLocal("scalarSize"))), + c.setLocal("itBase", c.i32_add(c.getLocal("itBase"), c.i32_const(n8b))), + c.br(0) + )), + + c.call(fnName + "_reduceTable", c.getLocal("pTable"), c.getLocal("chunkSize")), + c.call( + prefix + "_copy", + c.getLocal("pTable"), + c.getLocal("pr") + ), + + + c.i32_store( + c.i32_const(0), + c.getLocal("pTable") + ) + + ); + } + + function buildMultiexp() { + const f = module.addFunction(fnName); + f.addParam("pBases", "i32"); + f.addParam("pScalars", "i32"); + f.addParam("scalarSize", "i32"); // Number of points + f.addParam("n", "i32"); // Number of points + f.addParam("pr", "i32"); + f.addLocal("chunkSize", "i32"); + f.addLocal("nChunks", "i32"); + f.addLocal("itScalar", "i32"); + f.addLocal("endScalar", "i32"); + f.addLocal("itBase", "i32"); + f.addLocal("itBit", "i32"); + f.addLocal("i", "i32"); + f.addLocal("j", "i32"); + f.addLocal("nTable", "i32"); + f.addLocal("pTable", "i32"); + f.addLocal("idx", "i32"); + f.addLocal("pIdxTable", "i32"); + + const c = f.getCodeBuilder(); + + const aux = c.i32_const(module.alloc(n8g)); + + const pTSizes = module.alloc([ + 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 16, 16, 15, 14, 13, 13, + 12, 11, 10, 9, 8, 7, 7, 6, + 5 , 4, 3, 2, 1, 1, 1, 1 + ]); + + f.addCode( + c.call(prefix + "_zero", c.getLocal("pr")), + c.if( + c.i32_eqz(c.getLocal("n")), + c.ret([]) + ), + c.setLocal("chunkSize", c.i32_load8_u( c.i32_clz(c.getLocal("n")), pTSizes )), + c.setLocal( + "nChunks", + c.i32_add( + c.i32_div_u( + c.i32_sub( + c.i32_shl( + c.getLocal("scalarSize"), + c.i32_const(3) + ), + c.i32_const(1) + ), + c.getLocal("chunkSize") + ), + c.i32_const(1) + ) + ), + + + // Allocate memory + + c.setLocal( + "itBit", + c.i32_mul( + c.i32_sub( + c.getLocal("nChunks"), + c.i32_const(1) + ), + c.getLocal("chunkSize") + ) + ), + c.block(c.loop( + c.br_if( + 1, + c.i32_lt_s( + c.getLocal("itBit"), + c.i32_const(0) + ) + ), + + // Double nChunk times + c.if( + c.i32_eqz(c.call(prefix + "_isZero", c.getLocal("pr"))), + [ + ...c.setLocal("j", c.i32_const(0)), + ...c.block(c.loop( + c.br_if( + 1, + c.i32_eq( + c.getLocal("j"), + c.getLocal("chunkSize") + ) + ), + + c.call(prefix + "_double", c.getLocal("pr"), c.getLocal("pr")), + + c.setLocal("j", c.i32_add(c.getLocal("j"), c.i32_const(1))), + c.br(0) + )) + ] + ), + + c.call( + fnName + "_chunk", + c.getLocal("pBases"), + c.getLocal("pScalars"), + c.getLocal("scalarSize"), + c.getLocal("n"), + c.getLocal("itBit"), + c.getLocal("chunkSize"), + aux + ), + + c.call( + prefix + "_add", + c.getLocal("pr"), + aux, + c.getLocal("pr") + ), + c.setLocal("itBit", c.i32_sub(c.getLocal("itBit"), c.getLocal("chunkSize"))), + c.br(0) + )) + ); + } + + function buildReduceTable() { + const f = module.addFunction(fnName + "_reduceTable"); + f.addParam("pTable", "i32"); + f.addParam("p", "i32"); // Number of bits of the table + f.addLocal("half", "i32"); + f.addLocal("it1", "i32"); + f.addLocal("it2", "i32"); + f.addLocal("pAcc", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode( + c.if( + c.i32_eq(c.getLocal("p"), c.i32_const(1)), + c.ret([]) + ), + c.setLocal( + "half", + c.i32_shl( + c.i32_const(1), + c.i32_sub( + c.getLocal("p"), + c.i32_const(1) + ) + ) + ), + + c.setLocal("it1", c.getLocal("pTable")), + c.setLocal( + "it2", + c.i32_add( + c.getLocal("pTable"), + c.i32_mul( + c.getLocal("half"), + c.i32_const(n8g) + ) + ) + ), + c.setLocal("pAcc", + c.i32_sub( + c.getLocal("it2"), + c.i32_const(n8g) + ) + ), + c.block(c.loop( + c.br_if( + 1, + c.i32_eq( + c.getLocal("it1"), + c.getLocal("pAcc") + ) + ), + c.call( + prefix + "_add", + c.getLocal("it1"), + c.getLocal("it2"), + c.getLocal("it1") + ), + c.call( + prefix + "_add", + c.getLocal("pAcc"), + c.getLocal("it2"), + c.getLocal("pAcc") + ), + c.setLocal("it1", c.i32_add(c.getLocal("it1"), c.i32_const(n8g))), + c.setLocal("it2", c.i32_add(c.getLocal("it2"), c.i32_const(n8g))), + c.br(0) + )), + + c.call( + fnName + "_reduceTable", + c.getLocal("pTable"), + c.i32_sub( + c.getLocal("p"), + c.i32_const(1) + ) + ), + + c.setLocal("p", c.i32_sub(c.getLocal("p"), c.i32_const(1))), + c.block(c.loop( + c.br_if(1, c.i32_eqz(c.getLocal("p"))), + c.call(prefix + "_double", c.getLocal("pAcc"), c.getLocal("pAcc")), + c.setLocal("p", c.i32_sub(c.getLocal("p"), c.i32_const(1))), + c.br(0) + )), + + c.call(prefix + "_add", c.getLocal("pTable"), c.getLocal("pAcc"), c.getLocal("pTable")) + ); + } + + buildGetChunk(); + buildReduceTable(); + buildMutiexpChunk(); + buildMultiexp(); + + module.exportFunction(fnName); + module.exportFunction(fnName +"_chunk"); + + +}; + +/* + Copyright 2019 0KIMS association. + + This file is part of wasmsnark (Web Assembly zkSnark Prover). + + wasmsnark is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + wasmsnark is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with wasmsnark. If not, see . +*/ + +const buildTimesScalarNAF = build_timesscalarnaf; +//const buildTimesScalar = require("./build_timesscalar"); +const buildBatchConvertion = build_batchconvertion; +const buildMultiexp$1 = build_multiexp; + +var build_curve_jacobian_a0 = function buildCurve(module, prefix, prefixField, pB) { const n64 = module.modules[prefixField].n64; @@ -116324,7 +160610,7 @@ module.exports = function buildCurve(module, prefix, prefixField, pB) { f.addCode( c.if( - c.call(prefix + "_isZero", c.getLocal("pIn")), + c.call(prefix + "_isZeroAffine", c.getLocal("pIn")), [ ...c.call(prefixField + "_zero", c.getLocal("pOut")), ...c.i32_store8( @@ -116369,10 +160655,6 @@ module.exports = function buildCurve(module, prefix, prefixField, pB) { c.call(prefix + "_isZeroAffine", c.getLocal("pIn")), [ ...c.call(prefix + "_zeroAffine", c.getLocal("pOut")), - ...c.i32_store8( - c.getLocal("pOut"), - c.i32_const(0x40) - ), ...c.ret([]) ] ), @@ -116475,32 +160757,6 @@ module.exports = function buildCurve(module, prefix, prefixField, pB) { ); } - - function buildInCurveAffine() { - const f = module.addFunction(prefix + "_inCurveAffine"); - f.addParam("pIn", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x = c.getLocal("pIn"); - const y = c.i32_add(c.getLocal("pIn"), n8); - - const y2 = module.alloc(n8*2); - const x3b = module.alloc(n8*2); - - f.addCode( - c.call(prefixField + "_square", y, y2), - c.call(prefixField + "_square", x, x3b), - c.call(prefixField + "_mul", x, x3b, x3b), - c.call(prefixField + "_add", x3b, c.i32_const(pB), x3b), - - c.ret( - c.call(prefixField + "_eq", y2, x3b) - ) - ); - } - function buildInCurveAffine() { const f = module.addFunction(prefix + "_inCurveAffine"); f.addParam("pIn", "i32"); @@ -116591,8 +160847,8 @@ module.exports = function buildCurve(module, prefix, prefixField, pB) { buildBatchConvertion(module, prefix + "_batchToJacobian", prefix + "_toJacobian", n8*2, n8*3, true); - buildMultiexp(module, prefix, prefix + "_multiexp", prefix + "_add", n8*3); - buildMultiexp(module, prefix, prefix + "_multiexpAffine", prefix + "_addMixed", n8*2); + buildMultiexp$1(module, prefix, prefix + "_multiexp", prefix + "_add", n8*3); + buildMultiexp$1(module, prefix, prefix + "_multiexpAffine", prefix + "_addMixed", n8*2); /* buildTimesScalar( @@ -116693,12 +160949,6 @@ module.exports = function buildCurve(module, prefix, prefixField, pB) { return prefix; }; - -/***/ }), - -/***/ 38138: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /* Copyright 2019 0KIMS association. @@ -116718,2434 +160968,10 @@ module.exports = function buildCurve(module, prefix, prefixField, pB) { along with wasmsnark. If not, see . */ -const bigInt = __webpack_require__(92096); +const { isOdd: isOdd$2, modInv: modInv$1, modPow } = bigint; +const utils$3 = utils$6; -const buildF1m =__webpack_require__(70075); - -module.exports = function buildF1(module, _q, _prefix, _f1mPrefix, _intPrefix) { - - const q = bigInt(_q); - const n64 = Math.floor((q.minus(1).bitLength() - 1)/64) +1; - const n8 = n64*8; - - const prefix = _prefix || "f1"; - if (module.modules[prefix]) return prefix; // already builded - module.modules[prefix] = { - n64: n64 - }; - - const intPrefix = _intPrefix || "int"; - const f1mPrefix = buildF1m(module, q, _f1mPrefix, intPrefix); - - - const pR2 = module.modules[f1mPrefix].pR2; - const pq = module.modules[f1mPrefix].pq; - const pePlusOne = module.modules[f1mPrefix].pePlusOne; - - function buildMul() { - const pAux1 = module.alloc(n8); - - const f = module.addFunction(prefix+ "_mul"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - f.addCode(c.call(f1mPrefix + "_mul", c.getLocal("x"), c.getLocal("y"), c.i32_const(pAux1))); - f.addCode(c.call(f1mPrefix + "_mul", c.i32_const(pAux1), c.i32_const(pR2), c.getLocal("r"))); - } - - function buildSquare() { - const f = module.addFunction(prefix+"_square"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode(c.call(prefix + "_mul", c.getLocal("x"), c.getLocal("x"), c.getLocal("r"))); - } - - - function buildInverse() { - - const f = module.addFunction(prefix+ "_inverse"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - f.addCode(c.call(intPrefix + "_inverseMod", c.getLocal("x"), c.i32_const(pq), c.getLocal("r"))); - } - - function buildIsNegative() { - const f = module.addFunction(prefix+"_isNegative"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call(intPrefix + "_gte", c.getLocal("x"), c.i32_const(pePlusOne) ) - ); - } - - - buildMul(); - buildSquare(); - buildInverse(); - buildIsNegative(); - module.exportFunction(f1mPrefix + "_add", prefix + "_add"); - module.exportFunction(f1mPrefix + "_sub", prefix + "_sub"); - module.exportFunction(f1mPrefix + "_neg", prefix + "_neg"); - module.exportFunction(prefix + "_mul"); - module.exportFunction(prefix + "_square"); - module.exportFunction(prefix + "_inverse"); - module.exportFunction(prefix + "_isNegative"); - module.exportFunction(f1mPrefix + "_copy", prefix+"_copy"); - module.exportFunction(f1mPrefix + "_zero", prefix+"_zero"); - module.exportFunction(f1mPrefix + "_one", prefix+"_one"); - module.exportFunction(f1mPrefix + "_isZero", prefix+"_isZero"); - module.exportFunction(f1mPrefix + "_eq", prefix+"_eq"); - - return prefix; -}; - - -/***/ }), - -/***/ 70075: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ - -const bigInt = __webpack_require__(92096); -const buildInt = __webpack_require__(76754); -const utils = __webpack_require__(12333); -const buildExp = __webpack_require__(50345); -const buildBatchInverse = __webpack_require__(18163); -const buildBatchConvertion = __webpack_require__(9440); -const buildBatchOp = __webpack_require__(4948); - -module.exports = function buildF1m(module, _q, _prefix, _intPrefix) { - const q = bigInt(_q); - const n64 = Math.floor((q.minus(1).bitLength() - 1)/64) +1; - const n32 = n64*2; - const n8 = n64*8; - - const prefix = _prefix || "f1m"; - if (module.modules[prefix]) return prefix; // already builded - - const intPrefix = buildInt(module, n64, _intPrefix); - const pq = module.alloc(n8, utils.bigInt2BytesLE(q, n8)); - - const pR = module.alloc(utils.bigInt2BytesLE(bigInt.one.shiftLeft(n64*64).mod(q), n8)); - const pR2 = module.alloc(utils.bigInt2BytesLE(bigInt.one.shiftLeft(n64*64).square().mod(q), n8)); - const pOne = module.alloc(utils.bigInt2BytesLE(bigInt.one.shiftLeft(n64*64).mod(q), n8)); - const pZero = module.alloc(utils.bigInt2BytesLE(bigInt.zero, n8)); - const _minusOne = q.minus(bigInt.one); - const _e = _minusOne.shiftRight(1); // e = (p-1)/2 - const pe = module.alloc(n8, utils.bigInt2BytesLE(_e, n8)); - - const _ePlusOne = _e.add(bigInt.one); // e = (p-1)/2 - const pePlusOne = module.alloc(n8, utils.bigInt2BytesLE(_ePlusOne, n8)); - - module.modules[prefix] = { - pq: pq, - pR2: pR2, - n64: n64, - q: q, - pOne: pOne, - pZero: pZero, - pePlusOne: pePlusOne - }; - - function buildOne() { - const f = module.addFunction(prefix+"_one"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode(c.call(intPrefix + "_copy", c.i32_const(pOne), c.getLocal("pr"))); - } - - function buildAdd() { - const f = module.addFunction(prefix+"_add"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.if( - c.call(intPrefix+"_add", c.getLocal("x"), c.getLocal("y"), c.getLocal("r")), - c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), - c.if( - c.call(intPrefix+"_gte", c.getLocal("r"), c.i32_const(pq) ), - c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), - ) - ) - ); - } - - function buildSub() { - const f = module.addFunction(prefix+"_sub"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.if( - c.call(intPrefix+"_sub", c.getLocal("x"), c.getLocal("y"), c.getLocal("r")), - c.drop(c.call(intPrefix+"_add", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))) - ) - ); - } - - function buildNeg() { - const f = module.addFunction(prefix+"_neg"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.call(prefix + "_sub", c.i32_const(pZero), c.getLocal("x"), c.getLocal("r")) - ); - } - - - function buildIsNegative() { - const f = module.addFunction(prefix+"_isNegative"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const AUX = c.i32_const(module.alloc(n8)); - - f.addCode( - c.call(prefix + "_fromMontgomery", c.getLocal("x"), AUX), - c.call(intPrefix + "_gte", AUX, c.i32_const(pePlusOne) ) - ); - } - - -/* - function buildIsNegative() { - const f = module.addFunction(prefix+"_isNegative"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const AUX = c.i32_const(module.alloc(n8)); - - f.addCode( - c.call(prefix + "_fromMontgomery", c.getLocal("x"), AUX), - c.i32_and( - c.i32_load(AUX), - c.i32_const(1) - ) - ); - } -*/ - - function buildSign() { - const f = module.addFunction(prefix+"_sign"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const AUX = c.i32_const(module.alloc(n8)); - - f.addCode( - c.if ( - c.call(intPrefix + "_isZero", c.getLocal("x")), - c.ret(c.i32_const(0)) - ), - c.call(prefix + "_fromMontgomery", c.getLocal("x"), AUX), - c.if( - c.call(intPrefix + "_gte", AUX, c.i32_const(pePlusOne)), - c.ret(c.i32_const(-1)) - ), - c.ret(c.i32_const(1)) - ); - } - - - function buildMReduct() { - const carries = module.alloc(n32*n32*8); - - const f = module.addFunction(prefix+"_mReduct"); - f.addParam("t", "i32"); - f.addParam("r", "i32"); - f.addLocal("np32", "i64"); - f.addLocal("c", "i64"); - f.addLocal("m", "i64"); - - const c = f.getCodeBuilder(); - - const np32 = bigInt("100000000",16).minus( q.modInv(bigInt("100000000",16))).toJSNumber(); - - f.addCode(c.setLocal("np32", c.i64_const(np32))); - - for (let i=0; i=n32) { - f.addCode( - c.i64_store32( - c.getLocal("r"), - (k-n32)*4, - c.getLocal(c0) - ) - ); - } - [c0, c1] = [c1, c0]; - f.addCode( - c.setLocal(c1, - c.i64_shr_u( - c.getLocal(c0), - c.i64_const(32) - ) - ) - ); - } - f.addCode( - c.i64_store32( - c.getLocal("r"), - n32*4-4, - c.getLocal(c0) - ) - ); - - f.addCode( - c.if( - c.i32_wrap_i64(c.getLocal(c1)), - c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), - c.if( - c.call(intPrefix+"_gte", c.getLocal("r"), c.i32_const(pq) ), - c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), - ) - ) - ); - } - - - function buildSquare() { - - const f = module.addFunction(prefix+"_square"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - f.addLocal("c0", "i64"); - f.addLocal("c1", "i64"); - f.addLocal("c0_old", "i64"); - f.addLocal("c1_old", "i64"); - f.addLocal("np32", "i64"); - - - for (let i=0;i>1) )&&(i>1, k>>1) - ) - ) - ); - - f.addCode( - c.setLocal(c1, - c.i64_add( - c.getLocal(c1), - c.i64_shr_u( - c.getLocal(c0), - c.i64_const(32) - ) - ) - ) - ); - } - - // Add the old carry - - if (k>0) { - f.addCode( - c.setLocal(c0, - c.i64_add( - c.i64_and( - c.getLocal(c0), - c.i64_const(0xFFFFFFFF) - ), - c.i64_and( - c.getLocal(c0_old), - c.i64_const(0xFFFFFFFF) - ), - ) - ) - ); - - f.addCode( - c.setLocal(c1, - c.i64_add( - c.i64_add( - c.getLocal(c1), - c.i64_shr_u( - c.getLocal(c0), - c.i64_const(32) - ) - ), - c.getLocal(c1_old) - ) - ) - ); - } - - - for (let i=Math.max(1, k-n32+1); (i<=k)&&(i=n32) { - f.addCode( - c.i64_store32( - c.getLocal("r"), - (k-n32)*4, - c.getLocal(c0) - ) - ); - } - f.addCode( - c.setLocal( - c0_old, - c.getLocal(c1) - ), - c.setLocal( - c1_old, - c.i64_shr_u( - c.getLocal(c0_old), - c.i64_const(32) - ) - ) - ); - } - f.addCode( - c.i64_store32( - c.getLocal("r"), - n32*4-4, - c.getLocal(c0_old) - ) - ); - - f.addCode( - c.if( - c.i32_wrap_i64(c.getLocal(c1_old)), - c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), - c.if( - c.call(intPrefix+"_gte", c.getLocal("r"), c.i32_const(pq) ), - c.drop(c.call(intPrefix+"_sub", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))), - ) - ) - ); - } - - - function buildSquareOld() { - const f = module.addFunction(prefix+"_squareOld"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode(c.call(prefix + "_mul", c.getLocal("x"), c.getLocal("x"), c.getLocal("r"))); - } - - function buildToMontgomery() { - const f = module.addFunction(prefix+"_toMontgomery"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - f.addCode(c.call(prefix+"_mul", c.getLocal("x"), c.i32_const(pR2), c.getLocal("r"))); - } - - function buildFromMontgomery() { - - const pAux2 = module.alloc(n8*2); - - const f = module.addFunction(prefix+"_fromMontgomery"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - f.addCode(c.call(intPrefix + "_copy", c.getLocal("x"), c.i32_const(pAux2) )); - f.addCode(c.call(intPrefix + "_zero", c.i32_const(pAux2 + n8) )); - f.addCode(c.call(prefix+"_mReduct", c.i32_const(pAux2), c.getLocal("r"))); - } - - function buildInverse() { - - const f = module.addFunction(prefix+ "_inverse"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - f.addCode(c.call(prefix + "_fromMontgomery", c.getLocal("x"), c.getLocal("r"))); - f.addCode(c.call(intPrefix + "_inverseMod", c.getLocal("r"), c.i32_const(pq), c.getLocal("r"))); - f.addCode(c.call(prefix + "_toMontgomery", c.getLocal("r"), c.getLocal("r"))); - } - - // Calculate various valuse needed for sqrt - - - let _nqr = bigInt(2); - if (q.isPrime()) { - while (!_nqr.modPow(_e, q).equals(_minusOne)) _nqr = _nqr.add(bigInt.one); - } - - const pnqr = module.alloc(utils.bigInt2BytesLE(_nqr.shiftLeft(n64*64).mod(q), n8)); - - let s2 = 0; - let _t = _minusOne; - - while ((!_t.isOdd())&&(!_t.isZero())) { - s2++; - _t = _t.shiftRight(1); - } - const pt = module.alloc(n8, utils.bigInt2BytesLE(_t, n8)); - - const _nqrToT = _nqr.modPow(_t, q); - const pNqrToT = module.alloc(utils.bigInt2BytesLE(_nqrToT.shiftLeft(n64*64).mod(q), n8)); - - const _tPlusOneOver2 = _t.add(1).shiftRight(1); - const ptPlusOneOver2 = module.alloc(n8, utils.bigInt2BytesLE(_tPlusOneOver2, n8)); - - function buildSqrt() { - - const f = module.addFunction(prefix+ "_sqrt"); - f.addParam("n", "i32"); - f.addParam("r", "i32"); - f.addLocal("m", "i32"); - f.addLocal("i", "i32"); - f.addLocal("j", "i32"); - - const c = f.getCodeBuilder(); - - const ONE = c.i32_const(pOne); - const C = c.i32_const(module.alloc(n8)); - const T = c.i32_const(module.alloc(n8)); - const R = c.i32_const(module.alloc(n8)); - const SQ = c.i32_const(module.alloc(n8)); - const B = c.i32_const(module.alloc(n8)); - - f.addCode( - - // If (n==0) return 0 - c.if( - c.call(prefix + "_isZero", c.getLocal("n")), - c.ret( - c.call(prefix + "_zero", c.getLocal("r")) - ) - ), - - c.setLocal("m", c.i32_const(s2)), - c.call(prefix + "_copy", c.i32_const(pNqrToT), C), - c.call(prefix + "_exp", c.getLocal("n"), c.i32_const(pt), c.i32_const(n8), T), - c.call(prefix + "_exp", c.getLocal("n"), c.i32_const(ptPlusOneOver2), c.i32_const(n8), R), - - c.block(c.loop( - c.br_if(1, c.call(prefix + "_eq", T, ONE)), - - c.call(prefix + "_square", T, SQ), - c.setLocal("i", c.i32_const(1)), - c.block(c.loop( - c.br_if(1, c.call(prefix + "_eq", SQ, ONE)), - c.call(prefix + "_square", SQ, SQ), - c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), - c.br(0) - )), - - c.call(prefix + "_copy", C, B), - c.setLocal("j", c.i32_sub(c.i32_sub( c.getLocal("m"), c.getLocal("i")), c.i32_const(1)) ), - c.block(c.loop( - c.br_if(1, c.i32_eqz(c.getLocal("j"))), - c.call(prefix + "_square", B, B), - c.setLocal("j", c.i32_sub(c.getLocal("j"), c.i32_const(1))), - c.br(0) - )), - - c.setLocal("m", c.getLocal("i")), - c.call(prefix + "_square", B, C), - c.call(prefix + "_mul", T, C, T), - c.call(prefix + "_mul", R, B, R), - - c.br(0) - )), - - c.if( - c.call(prefix + "_isNegative", R), - c.call(prefix + "_neg", R, c.getLocal("r")), - c.call(prefix + "_copy", R, c.getLocal("r")), - ) - ); - } - - function buildIsSquare() { - const f = module.addFunction(prefix+"_isSquare"); - f.addParam("n", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const ONE = c.i32_const(pOne); - const AUX = c.i32_const(module.alloc(n8)); - - f.addCode( - c.if( - c.call(prefix + "_isZero", c.getLocal("n")), - c.ret(c.i32_const(1)) - ), - c.call(prefix + "_exp", c.getLocal("n"), c.i32_const(pe), c.i32_const(n8), AUX), - c.call(prefix + "_eq", AUX, ONE) - ); - } - - - function buildLoad() { - const f = module.addFunction(prefix+"_load"); - f.addParam("scalar", "i32"); - f.addParam("scalarLen", "i32"); - f.addParam("r", "i32"); - f.addLocal("p", "i32"); - f.addLocal("l", "i32"); - f.addLocal("i", "i32"); - f.addLocal("j", "i32"); - const c = f.getCodeBuilder(); - - const R = c.i32_const(module.alloc(n8)); - const pAux = module.alloc(n8); - const AUX = c.i32_const(pAux); - - f.addCode( - c.call(intPrefix + "_zero", c.getLocal("r")), - c.setLocal("i", c.i32_const(n8)), - c.setLocal("p", c.getLocal("scalar")), - c.block(c.loop( - c.br_if(1, c.i32_gt_u(c.getLocal("i"), c.getLocal("scalarLen"))), - - c.if( - c.i32_eq(c.getLocal("i"), c.i32_const(n8)), - c.call(prefix + "_one", R), - c.call(prefix + "_mul", R, c.i32_const(pR2), R) - ), - c.call(prefix + "_mul", c.getLocal("p"), R, AUX), - c.call(prefix + "_add", c.getLocal("r"), AUX, c.getLocal("r")), - - c.setLocal("p", c.i32_add(c.getLocal("p"), c.i32_const(n8))), - c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(n8))), - c.br(0) - )), - - c.setLocal("l", c.i32_rem_u( c.getLocal("scalarLen"), c.i32_const(n8))), - c.if(c.i32_eqz(c.getLocal("l")), c.ret([])), - c.call(intPrefix + "_zero", AUX), - c.setLocal("j", c.i32_const(0)), - c.block(c.loop( - c.br_if(1, c.i32_eq(c.getLocal("j"), c.getLocal("l"))), - - c.i32_store8( - c.getLocal("j"), - pAux, - c.i32_load8_u(c.getLocal("p")), - ), - c.setLocal("p", c.i32_add(c.getLocal("p"), c.i32_const(1))), - c.setLocal("j", c.i32_add(c.getLocal("j"), c.i32_const(1))), - c.br(0) - )), - - c.if( - c.i32_eq(c.getLocal("i"), c.i32_const(n8)), - c.call(prefix + "_one", R), - c.call(prefix + "_mul", R, c.i32_const(pR2), R) - ), - c.call(prefix + "_mul", AUX, R, AUX), - c.call(prefix + "_add", c.getLocal("r"), AUX, c.getLocal("r")), - ); - } - - function buildTimesScalar() { - const f = module.addFunction(prefix+"_timesScalar"); - f.addParam("x", "i32"); - f.addParam("scalar", "i32"); - f.addParam("scalarLen", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const AUX = c.i32_const(module.alloc(n8)); - - f.addCode( - c.call(prefix + "_load", c.getLocal("scalar"), c.getLocal("scalarLen"), AUX), - c.call(prefix + "_toMontgomery", AUX, AUX), - c.call(prefix + "_mul", c.getLocal("x"), AUX, c.getLocal("r")), - ); - } - - function buildIsOne() { - const f = module.addFunction(prefix+"_isOne"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - f.addCode( - c.ret(c.call(intPrefix + "_eq", c.getLocal("x"), c.i32_const(pOne))) - ); - } - - - module.exportFunction(intPrefix + "_copy", prefix+"_copy"); - module.exportFunction(intPrefix + "_zero", prefix+"_zero"); - module.exportFunction(intPrefix + "_isZero", prefix+"_isZero"); - module.exportFunction(intPrefix + "_eq", prefix+"_eq"); - - buildIsOne(); - buildAdd(); - buildSub(); - buildNeg(); - buildMReduct(); - buildMul(); - buildSquare(); - buildSquareOld(); - buildToMontgomery(); - buildFromMontgomery(); - buildIsNegative(); - buildSign(); - buildInverse(); - buildOne(); - buildLoad(); - buildTimesScalar(); - buildBatchInverse(module, prefix); - buildBatchConvertion(module, prefix + "_batchToMontgomery", prefix + "_toMontgomery", n8, n8); - buildBatchConvertion(module, prefix + "_batchFromMontgomery", prefix + "_fromMontgomery", n8, n8); - buildBatchConvertion(module, prefix + "_batchNeg", prefix + "_neg", n8, n8); - buildBatchOp(module, prefix + "_batchAdd", prefix + "_add", n8, n8); - buildBatchOp(module, prefix + "_batchSub", prefix + "_sub", n8, n8); - buildBatchOp(module, prefix + "_batchMul", prefix + "_mul", n8, n8); - - module.exportFunction(prefix + "_add"); - module.exportFunction(prefix + "_sub"); - module.exportFunction(prefix + "_neg"); - module.exportFunction(prefix + "_isNegative"); - module.exportFunction(prefix + "_isOne"); - module.exportFunction(prefix + "_sign"); - module.exportFunction(prefix + "_mReduct"); - module.exportFunction(prefix + "_mul"); - module.exportFunction(prefix + "_square"); - module.exportFunction(prefix + "_squareOld"); - module.exportFunction(prefix + "_fromMontgomery"); - module.exportFunction(prefix + "_toMontgomery"); - module.exportFunction(prefix + "_inverse"); - module.exportFunction(prefix + "_one"); - module.exportFunction(prefix + "_load"); - module.exportFunction(prefix + "_timesScalar"); - buildExp( - module, - prefix + "_exp", - n8, - prefix + "_mul", - prefix + "_square", - intPrefix + "_copy", - prefix + "_one", - ); - module.exportFunction(prefix + "_exp"); - module.exportFunction(prefix + "_batchInverse"); - if (q.isPrime()) { - buildSqrt(); - buildIsSquare(); - module.exportFunction(prefix + "_sqrt"); - module.exportFunction(prefix + "_isSquare"); - } - module.exportFunction(prefix + "_batchToMontgomery"); - module.exportFunction(prefix + "_batchFromMontgomery"); - // console.log(module.functionIdxByName); - - return prefix; -}; - - -/***/ }), - -/***/ 15420: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ -const buildExp = __webpack_require__(50345); -const buildBatchInverse = __webpack_require__(18163); -const bigInt = __webpack_require__(92096); -const utils = __webpack_require__(12333); - -module.exports = function buildF2m(module, mulNonResidueFn, prefix, f1mPrefix) { - - if (module.modules[prefix]) return prefix; // already builded - - const f1n8 = module.modules[f1mPrefix].n64*8; - const q = module.modules[f1mPrefix].q; - - module.modules[prefix] = { - n64: module.modules[f1mPrefix].n64*2 - }; - - function buildAdd() { - const f = module.addFunction(prefix+"_add"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const y0 = c.getLocal("y"); - const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_add", x0, y0, r0), - c.call(f1mPrefix+"_add", x1, y1, r1), - ); - } - - function buildTimesScalar() { - const f = module.addFunction(prefix+"_timesScalar"); - f.addParam("x", "i32"); - f.addParam("scalar", "i32"); - f.addParam("scalarLen", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_timesScalar", x0, c.getLocal("scalar"), c.getLocal("scalarLen"), r0), - c.call(f1mPrefix+"_timesScalar", x1, c.getLocal("scalar"), c.getLocal("scalarLen"), r1), - ); - } - - function buildSub() { - const f = module.addFunction(prefix+"_sub"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const y0 = c.getLocal("y"); - const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_sub", x0, y0, r0), - c.call(f1mPrefix+"_sub", x1, y1, r1), - ); - } - - function buildNeg() { - const f = module.addFunction(prefix+"_neg"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_neg", x0, r0), - c.call(f1mPrefix+"_neg", x1, r1), - ); - } - - function buildConjugate() { - const f = module.addFunction(prefix+"_conjugate"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_copy", x0, r0), - c.call(f1mPrefix+"_neg", x1, r1), - ); - } - - - function buildIsNegative() { - const f = module.addFunction(prefix+"_isNegative"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - - f.addCode( - c.if( - c.call(f1mPrefix+"_isZero", x1), - c.ret(c.call(f1mPrefix+"_isNegative", x0)) - ), - c.ret(c.call(f1mPrefix+"_isNegative", x1)) - ); - } - - function buildMul() { - const f = module.addFunction(prefix+"_mul"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const y0 = c.getLocal("y"); - const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - const A = c.i32_const(module.alloc(f1n8)); - const B = c.i32_const(module.alloc(f1n8)); - const C = c.i32_const(module.alloc(f1n8)); - const D = c.i32_const(module.alloc(f1n8)); - - - f.addCode( - c.call(f1mPrefix + "_mul", x0, y0, A), // A = x0*y0 - c.call(f1mPrefix + "_mul", x1, y1, B), // B = x1*y1 - - c.call(f1mPrefix + "_add", x0, x1, C), // C = x0 + x1 - c.call(f1mPrefix + "_add", y0, y1, D), // D = y0 + y1 - c.call(f1mPrefix + "_mul", C, D, C), // C = (x0 + x1)*(y0 + y1) = x0*y0+x0*y1+x1*y0+x1*y1 - - // c.call(f1mPrefix + "_mul", B, c.i32_const(pNonResidue), r0), // r0 = nr*(x1*y1) - c.call(mulNonResidueFn, B, r0), // r0 = nr*(x1*y1) - c.call(f1mPrefix + "_add", A, r0, r0), // r0 = x0*y0 + nr*(x1*y1) - c.call(f1mPrefix + "_add", A, B, r1), // r1 = x0*y0+x1*y1 - c.call(f1mPrefix + "_sub", C, r1, r1) // r1 = x0*y0+x0*y1+x1*y0+x1*y1 - x0*y0+x1*y1 = x0*y1+x1*y0 - ); - - } - - function buildMul1() { - const f = module.addFunction(prefix+"_mul1"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const y = c.getLocal("y"); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - - f.addCode( - c.call(f1mPrefix + "_mul", x0, y, r0), // A = x0*y - c.call(f1mPrefix + "_mul", x1, y, r1), // B = x1*y - ); - } - - function buildSquare() { - const f = module.addFunction(prefix+"_square"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - const AB = c.i32_const(module.alloc(f1n8)); - const APB = c.i32_const(module.alloc(f1n8)); - const APNB = c.i32_const(module.alloc(f1n8)); - const ABPNAB = c.i32_const(module.alloc(f1n8)); - - - f.addCode( - // AB = x0*y1 - c.call(f1mPrefix + "_mul", x0, x1, AB), - - // APB = x0+y1 - c.call(f1mPrefix + "_add", x0, x1, APB), - - // APBN0 = x0 + nr*x1 - c.call(mulNonResidueFn, x1, APNB), - c.call(f1mPrefix + "_add", x0, APNB, APNB), - - // ABPNAB = ab + nr*ab - c.call(mulNonResidueFn, AB, ABPNAB), - c.call(f1mPrefix + "_add", ABPNAB, AB, ABPNAB), - - // r0 = APB * APNB - ABPNAB - c.call(f1mPrefix + "_mul", APB, APNB, r0), - c.call(f1mPrefix + "_sub", r0, ABPNAB, r0), - - // r1 = AB + AB - c.call(f1mPrefix + "_add", AB, AB, r1), - ); - - } - - - function buildToMontgomery() { - const f = module.addFunction(prefix+"_toMontgomery"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_toMontgomery", x0, r0), - c.call(f1mPrefix+"_toMontgomery", x1, r1) - ); - } - - function buildFromMontgomery() { - const f = module.addFunction(prefix+"_fromMontgomery"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_fromMontgomery", x0, r0), - c.call(f1mPrefix+"_fromMontgomery", x1, r1) - ); - } - - function buildCopy() { - const f = module.addFunction(prefix+"_copy"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_copy", x0, r0), - c.call(f1mPrefix+"_copy", x1, r1) - ); - } - - function buildZero() { - const f = module.addFunction(prefix+"_zero"); - f.addParam("x", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_zero", x0), - c.call(f1mPrefix+"_zero", x1) - ); - } - - function buildOne() { - const f = module.addFunction(prefix+"_one"); - f.addParam("x", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_one", x0), - c.call(f1mPrefix+"_zero", x1) - ); - } - - function buildEq() { - const f = module.addFunction(prefix+"_eq"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const y0 = c.getLocal("y"); - const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); - - f.addCode( - c.i32_and( - c.call(f1mPrefix+"_eq", x0, y0), - c.call(f1mPrefix+"_eq", x1, y1) - ) - ); - } - - function buildIsZero() { - const f = module.addFunction(prefix+"_isZero"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - - f.addCode( - c.i32_and( - c.call(f1mPrefix+"_isZero", x0), - c.call(f1mPrefix+"_isZero", x1) - ) - ); - } - - function buildInverse() { - const f = module.addFunction(prefix+"_inverse"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - - const t0 = c.i32_const(module.alloc(f1n8)); - const t1 = c.i32_const(module.alloc(f1n8)); - const t2 = c.i32_const(module.alloc(f1n8)); - const t3 = c.i32_const(module.alloc(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_square", x0, t0), - c.call(f1mPrefix+"_square", x1, t1), - // c.call(f1mPrefix+"_mul", t1, c.i32_const(pNonResidue), t2), - c.call(mulNonResidueFn, t1, t2), - - c.call(f1mPrefix+"_sub", t0, t2, t2), - c.call(f1mPrefix+"_inverse", t2, t3), - - c.call(f1mPrefix+"_mul", x0, t3, r0), - c.call(f1mPrefix+"_mul", x1, t3, r1), - c.call(f1mPrefix+"_neg", r1, r1), - ); - } - - - function buildSign() { - const f = module.addFunction(prefix+"_sign"); - f.addParam("x", "i32"); - f.addLocal("s", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - - f.addCode( - c.setLocal("s" , c.call( f1mPrefix + "_sign", x1)), - c.if( - c.getLocal("s"), - c.ret(c.getLocal("s")) - ), - c.ret(c.call( f1mPrefix + "_sign", x0)) - ); - } - - function buildIsOne() { - const f = module.addFunction(prefix+"_isOne"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - - f.addCode( - c.ret(c.i32_and( - c.call(f1mPrefix + "_isOne", x0), - c.call(f1mPrefix + "_isZero", x1), - )) - ); - } - - - // Check here: https://eprint.iacr.org/2012/685.pdf - // Alg 9adj - function buildSqrt() { - - const f = module.addFunction(prefix+"_sqrt"); - f.addParam("a", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - const e34 = c.i32_const(module.alloc(utils.bigInt2BytesLE(bigInt(q).minus(bigInt(3)).divide(4), f1n8 ))); - const e12 = c.i32_const(module.alloc(utils.bigInt2BytesLE(bigInt(q).minus(bigInt(1)).divide(2), f1n8 ))); - - const a = c.getLocal("a"); - const a1 = c.i32_const(module.alloc(f1n8*2)); - const alpha = c.i32_const(module.alloc(f1n8*2)); - const a0 = c.i32_const(module.alloc(f1n8*2)); - const pn1 = module.alloc(f1n8*2); - const n1 = c.i32_const(pn1); - const n1a = c.i32_const(pn1); - const n1b = c.i32_const(pn1+f1n8); - const x0 = c.i32_const(module.alloc(f1n8*2)); - const b = c.i32_const(module.alloc(f1n8*2)); - - f.addCode( - - c.call(prefix + "_one", n1), - c.call(prefix + "_neg", n1, n1), - - // const a1 = F.pow(a, F.sqrt_e34); - c.call(prefix + "_exp", a, e34, c.i32_const(f1n8), a1), - - // const a1 = F.pow(a, F.sqrt_e34); - c.call(prefix + "_square", a1, alpha), - c.call(prefix + "_mul", a, alpha, alpha), - - // const a0 = F.mul(F.frobenius(1, alfa), alfa); - c.call(prefix + "_conjugate", alpha, a0), - c.call(prefix + "_mul", a0, alpha, a0), - - // if (F.eq(a0, F.negone)) return null; - c.if(c.call(prefix + "_eq",a0,n1), c.unreachable() ), - - // const x0 = F.mul(a1, a); - c.call(prefix + "_mul", a1, a, x0), - - // if (F.eq(alfa, F.negone)) { - c.if( - c.call(prefix + "_eq", alpha, n1), - [ - // x = F.mul(x0, [F.F.zero, F.F.one]); - ...c.call(f1mPrefix + "_zero", n1a), - ...c.call(f1mPrefix + "_one", n1b), - ...c.call(prefix + "_mul", n1, x0, c.getLocal("pr")), - ], - [ - // const b = F.pow(F.add(F.one, alfa), F.sqrt_e12); - ...c.call(prefix + "_one", b), - ...c.call(prefix + "_add", b, alpha, b), - ...c.call(prefix + "_exp", b, e12, c.i32_const(f1n8), b), - - // x = F.mul(b, x0); - ...c.call(prefix + "_mul", b, x0, c.getLocal("pr")), - ] - ) - ); - - } - - - function buildIsSquare() { - - const f = module.addFunction(prefix+"_isSquare"); - f.addParam("a", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const e34 = c.i32_const(module.alloc(utils.bigInt2BytesLE(bigInt(q).minus(bigInt(3)).divide(4), f1n8 ))); - - const a = c.getLocal("a"); - const a1 = c.i32_const(module.alloc(f1n8*2)); - const alpha = c.i32_const(module.alloc(f1n8*2)); - const a0 = c.i32_const(module.alloc(f1n8*2)); - const pn1 = module.alloc(f1n8*2); - const n1 = c.i32_const(pn1); - - f.addCode( - - c.call(prefix + "_one", n1), - c.call(prefix + "_neg", n1, n1), - - // const a1 = F.pow(a, F.sqrt_e34); - c.call(prefix + "_exp", a, e34, c.i32_const(f1n8), a1), - - // const a1 = F.pow(a, F.sqrt_e34); - c.call(prefix + "_square", a1, alpha), - c.call(prefix + "_mul", a, alpha, alpha), - - // const a0 = F.mul(F.frobenius(1, alfa), alfa); - c.call(prefix + "_conjugate", alpha, a0), - c.call(prefix + "_mul", a0, alpha, a0), - - // if (F.eq(a0, F.negone)) return null; - c.if( - c.call( - prefix + "_eq", - a0, - n1 - ), - c.ret(c.i32_const(0)) - ), - c.ret(c.i32_const(1)) - ); - - } - - - buildIsZero(); - buildIsOne(); - buildZero(); - buildOne(); - buildCopy(); - buildMul(); - buildMul1(); - buildSquare(); - buildAdd(); - buildSub(); - buildNeg(); - buildConjugate(); - buildToMontgomery(); - buildFromMontgomery(); - buildEq(); - buildInverse(); - buildTimesScalar(); - buildSign(); - buildIsNegative(); - - module.exportFunction(prefix + "_isZero"); - module.exportFunction(prefix + "_isOne"); - module.exportFunction(prefix + "_zero"); - module.exportFunction(prefix + "_one"); - module.exportFunction(prefix + "_copy"); - module.exportFunction(prefix + "_mul"); - module.exportFunction(prefix + "_mul1"); - module.exportFunction(prefix + "_square"); - module.exportFunction(prefix + "_add"); - module.exportFunction(prefix + "_sub"); - module.exportFunction(prefix + "_neg"); - module.exportFunction(prefix + "_sign"); - module.exportFunction(prefix + "_conjugate"); - module.exportFunction(prefix + "_fromMontgomery"); - module.exportFunction(prefix + "_toMontgomery"); - module.exportFunction(prefix + "_eq"); - module.exportFunction(prefix + "_inverse"); - buildBatchInverse(module, prefix); - buildExp( - module, - prefix + "_exp", - f1n8*2, - prefix + "_mul", - prefix + "_square", - prefix + "_copy", - prefix + "_one", - ); - buildSqrt(); - buildIsSquare(); - - module.exportFunction(prefix + "_exp"); - module.exportFunction(prefix + "_timesScalar"); - module.exportFunction(prefix + "_batchInverse"); - module.exportFunction(prefix + "_sqrt"); - module.exportFunction(prefix + "_isSquare"); - module.exportFunction(prefix + "_isNegative"); - - - return prefix; -}; - - -/***/ }), - -/***/ 77173: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ -const buildExp = __webpack_require__(50345); -const buildBatchInverse = __webpack_require__(18163); - -module.exports = function buildF3m(module, mulNonResidueFn, prefix, f1mPrefix) { - - if (module.modules[prefix]) return prefix; // already builded - - const f1n8 = module.modules[f1mPrefix].n64*8; - module.modules[prefix] = { - n64: module.modules[f1mPrefix].n64*3 - }; - - function buildAdd() { - const f = module.addFunction(prefix+"_add"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const y0 = c.getLocal("y"); - const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); - const y2 = c.i32_add(c.getLocal("y"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_add", x0, y0, r0), - c.call(f1mPrefix+"_add", x1, y1, r1), - c.call(f1mPrefix+"_add", x2, y2, r2), - ); - } - - function buildTimesScalar() { - const f = module.addFunction(prefix+"_timesScalar"); - f.addParam("x", "i32"); - f.addParam("scalar", "i32"); - f.addParam("scalarLen", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_timesScalar", x0, c.getLocal("scalar"), c.getLocal("scalarLen"), r0), - c.call(f1mPrefix+"_timesScalar", x1, c.getLocal("scalar"), c.getLocal("scalarLen"), r1), - c.call(f1mPrefix+"_timesScalar", x2, c.getLocal("scalar"), c.getLocal("scalarLen"), r2), - ); - } - - - function buildSub() { - const f = module.addFunction(prefix+"_sub"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const y0 = c.getLocal("y"); - const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); - const y2 = c.i32_add(c.getLocal("y"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_sub", x0, y0, r0), - c.call(f1mPrefix+"_sub", x1, y1, r1), - c.call(f1mPrefix+"_sub", x2, y2, r2), - ); - } - - function buildNeg() { - const f = module.addFunction(prefix+"_neg"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_neg", x0, r0), - c.call(f1mPrefix+"_neg", x1, r1), - c.call(f1mPrefix+"_neg", x2, r2), - ); - } - - function buildIsNegative() { - const f = module.addFunction(prefix+"_isNegative"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - - f.addCode( - c.if( - c.call(f1mPrefix+"_isZero", x2), - c.if( - c.call(f1mPrefix+"_isZero", x1), - c.ret(c.call(f1mPrefix+"_isNegative", x0)), - c.ret(c.call(f1mPrefix+"_isNegative", x1)) - ) - ), - c.ret(c.call(f1mPrefix+"_isNegative", x2)) - ); - } - - - function buildMul() { - const f = module.addFunction(prefix+"_mul"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.addParam("r", "i32"); - - const cd = f.getCodeBuilder(); - - const a = cd.getLocal("x"); - const b = cd.i32_add(cd.getLocal("x"), cd.i32_const(f1n8)); - const c = cd.i32_add(cd.getLocal("x"), cd.i32_const(2*f1n8)); - const A = cd.getLocal("y"); - const B = cd.i32_add(cd.getLocal("y"), cd.i32_const(f1n8)); - const C = cd.i32_add(cd.getLocal("y"), cd.i32_const(2*f1n8)); - const r0 = cd.getLocal("r"); - const r1 = cd.i32_add(cd.getLocal("r"), cd.i32_const(f1n8)); - const r2 = cd.i32_add(cd.getLocal("r"), cd.i32_const(2*f1n8)); - - const aA = cd.i32_const(module.alloc(f1n8)); - const bB = cd.i32_const(module.alloc(f1n8)); - const cC = cd.i32_const(module.alloc(f1n8)); - const a_b = cd.i32_const(module.alloc(f1n8)); - const A_B = cd.i32_const(module.alloc(f1n8)); - const a_c = cd.i32_const(module.alloc(f1n8)); - const A_C = cd.i32_const(module.alloc(f1n8)); - const b_c = cd.i32_const(module.alloc(f1n8)); - const B_C = cd.i32_const(module.alloc(f1n8)); - const aA_bB = cd.i32_const(module.alloc(f1n8)); - const aA_cC = cd.i32_const(module.alloc(f1n8)); - const bB_cC = cd.i32_const(module.alloc(f1n8)); - const AUX = cd.i32_const(module.alloc(f1n8)); - - - f.addCode( - cd.call(f1mPrefix + "_mul", a, A, aA), - cd.call(f1mPrefix + "_mul", b, B, bB), - cd.call(f1mPrefix + "_mul", c, C, cC), - - cd.call(f1mPrefix + "_add", a, b, a_b), - cd.call(f1mPrefix + "_add", A, B, A_B), - cd.call(f1mPrefix + "_add", a, c, a_c), - cd.call(f1mPrefix + "_add", A, C, A_C), - cd.call(f1mPrefix + "_add", b, c, b_c), - cd.call(f1mPrefix + "_add", B, C, B_C), - - cd.call(f1mPrefix + "_add", aA, bB, aA_bB), - cd.call(f1mPrefix + "_add", aA, cC, aA_cC), - cd.call(f1mPrefix + "_add", bB, cC, bB_cC), - - cd.call(f1mPrefix + "_mul", b_c, B_C, r0), - cd.call(f1mPrefix + "_sub", r0, bB_cC, r0), - cd.call(mulNonResidueFn, r0, r0), - cd.call(f1mPrefix + "_add", aA, r0, r0), - - cd.call(f1mPrefix + "_mul", a_b, A_B, r1), - cd.call(f1mPrefix + "_sub", r1, aA_bB, r1), - cd.call(mulNonResidueFn, cC, AUX), - cd.call(f1mPrefix + "_add", r1, AUX, r1), - - cd.call(f1mPrefix + "_mul", a_c, A_C, r2), - cd.call(f1mPrefix + "_sub", r2, aA_cC, r2), - cd.call(f1mPrefix + "_add", r2, bB, r2), - ); - - } - - function buildSquare() { - const f = module.addFunction(prefix+"_square"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const A = c.getLocal("x"); - const B = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const C = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - const s0 = c.i32_const(module.alloc(f1n8)); - const ab = c.i32_const(module.alloc(f1n8)); - const s1 = c.i32_const(module.alloc(f1n8)); - const s2 = c.i32_const(module.alloc(f1n8)); - const bc = c.i32_const(module.alloc(f1n8)); - const s3 = c.i32_const(module.alloc(f1n8)); - const s4 = c.i32_const(module.alloc(f1n8)); - - - f.addCode( - - c.call(f1mPrefix + "_square", A, s0), - c.call(f1mPrefix + "_mul", A, B, ab), - c.call(f1mPrefix + "_add", ab, ab, s1), - - c.call(f1mPrefix + "_sub", A, B, s2), - c.call(f1mPrefix + "_add", s2, C, s2), - c.call(f1mPrefix + "_square", s2, s2), - - c.call(f1mPrefix + "_mul", B, C, bc), - c.call(f1mPrefix + "_add", bc, bc, s3), - - c.call(f1mPrefix + "_square", C, s4), - - c.call(mulNonResidueFn, s3, r0), - c.call(f1mPrefix + "_add", s0, r0, r0), - - c.call(mulNonResidueFn, s4, r1), - c.call(f1mPrefix + "_add", s1, r1, r1), - - c.call(f1mPrefix + "_add", s0, s4, r2), - c.call(f1mPrefix + "_sub", s3, r2, r2), - c.call(f1mPrefix + "_add", s2, r2, r2), - c.call(f1mPrefix + "_add", s1, r2, r2), - ); - - } - - - function buildToMontgomery() { - const f = module.addFunction(prefix+"_toMontgomery"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_toMontgomery", x0, r0), - c.call(f1mPrefix+"_toMontgomery", x1, r1), - c.call(f1mPrefix+"_toMontgomery", x2, r2) - ); - } - - function buildFromMontgomery() { - const f = module.addFunction(prefix+"_fromMontgomery"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_fromMontgomery", x0, r0), - c.call(f1mPrefix+"_fromMontgomery", x1, r1), - c.call(f1mPrefix+"_fromMontgomery", x2, r2) - ); - } - - function buildCopy() { - const f = module.addFunction(prefix+"_copy"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_copy", x0, r0), - c.call(f1mPrefix+"_copy", x1, r1), - c.call(f1mPrefix+"_copy", x2, r2), - ); - } - - function buildZero() { - const f = module.addFunction(prefix+"_zero"); - f.addParam("x", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_zero", x0), - c.call(f1mPrefix+"_zero", x1), - c.call(f1mPrefix+"_zero", x2), - ); - } - - function buildOne() { - const f = module.addFunction(prefix+"_one"); - f.addParam("x", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - - f.addCode( - c.call(f1mPrefix+"_one", x0), - c.call(f1mPrefix+"_zero", x1), - c.call(f1mPrefix+"_zero", x2), - ); - } - - function buildEq() { - const f = module.addFunction(prefix+"_eq"); - f.addParam("x", "i32"); - f.addParam("y", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const y0 = c.getLocal("y"); - const y1 = c.i32_add(c.getLocal("y"), c.i32_const(f1n8)); - const y2 = c.i32_add(c.getLocal("y"), c.i32_const(2*f1n8)); - - f.addCode( - c.i32_and( - c.i32_and( - c.call(f1mPrefix+"_eq", x0, y0), - c.call(f1mPrefix+"_eq", x1, y1), - ), - c.call(f1mPrefix+"_eq", x2, y2) - ) - ); - } - - function buildIsZero() { - const f = module.addFunction(prefix+"_isZero"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - - f.addCode( - c.i32_and( - c.i32_and( - c.call(f1mPrefix+"_isZero", x0), - c.call(f1mPrefix+"_isZero", x1) - ), - c.call(f1mPrefix+"_isZero", x2) - ) - ); - } - - function buildInverse() { - const f = module.addFunction(prefix+"_inverse"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - const r0 = c.getLocal("r"); - const r1 = c.i32_add(c.getLocal("r"), c.i32_const(f1n8)); - const r2 = c.i32_add(c.getLocal("r"), c.i32_const(2*f1n8)); - - const t0 = c.i32_const(module.alloc(f1n8)); - const t1 = c.i32_const(module.alloc(f1n8)); - const t2 = c.i32_const(module.alloc(f1n8)); - const t3 = c.i32_const(module.alloc(f1n8)); - const t4 = c.i32_const(module.alloc(f1n8)); - const t5 = c.i32_const(module.alloc(f1n8)); - const c0 = c.i32_const(module.alloc(f1n8)); - const c1 = c.i32_const(module.alloc(f1n8)); - const c2 = c.i32_const(module.alloc(f1n8)); - const t6 = c.i32_const(module.alloc(f1n8)); - const AUX = c.i32_const(module.alloc(f1n8)); - - f.addCode( - c.call(f1mPrefix+"_square", x0, t0), - c.call(f1mPrefix+"_square", x1, t1), - c.call(f1mPrefix+"_square", x2, t2), - c.call(f1mPrefix+"_mul", x0, x1, t3), - c.call(f1mPrefix+"_mul", x0, x2, t4), - c.call(f1mPrefix+"_mul", x1, x2, t5), - - c.call(mulNonResidueFn, t5, c0), - c.call(f1mPrefix+"_sub", t0, c0, c0), - - c.call(mulNonResidueFn, t2, c1), - c.call(f1mPrefix+"_sub", c1, t3, c1), - - c.call(f1mPrefix+"_sub", t1, t4, c2), - - c.call(f1mPrefix+"_mul", x2, c1, t6), - c.call(f1mPrefix+"_mul", x1, c2, AUX), - c.call(f1mPrefix+"_add", t6, AUX, t6), - c.call(mulNonResidueFn, t6, t6), - c.call(f1mPrefix+"_mul", x0, c0, AUX), - c.call(f1mPrefix+"_add", AUX, t6, t6), - - c.call(f1mPrefix+"_inverse", t6, t6), - - c.call(f1mPrefix+"_mul", t6, c0, r0), - c.call(f1mPrefix+"_mul", t6, c1, r1), - c.call(f1mPrefix+"_mul", t6, c2, r2) - ); - } - - - function buildSign() { - const f = module.addFunction(prefix+"_sign"); - f.addParam("x", "i32"); - f.addLocal("s", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(2*f1n8)); - - f.addCode( - c.setLocal("s" , c.call( f1mPrefix + "_sign", x2)), - c.if( - c.getLocal("s"), - c.ret(c.getLocal("s")) - ), - c.setLocal("s" , c.call( f1mPrefix + "_sign", x1)), - c.if( - c.getLocal("s"), - c.ret(c.getLocal("s")) - ), - c.ret(c.call( f1mPrefix + "_sign", x0)) - ); - } - - function buildIsOne() { - const f = module.addFunction(prefix+"_isOne"); - f.addParam("x", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - const x0 = c.getLocal("x"); - const x1 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8)); - const x2 = c.i32_add(c.getLocal("x"), c.i32_const(f1n8*2)); - - f.addCode( - c.ret( - c.i32_and( - c.i32_and( - c.call(f1mPrefix + "_isOne", x0), - c.call(f1mPrefix + "_isZero", x1) - ), - c.call(f1mPrefix + "_isZero", x2) - ) - ) - ); - } - - buildIsZero(); - buildIsOne(); - buildZero(); - buildOne(); - buildCopy(); - buildMul(); - buildSquare(); - buildAdd(); - buildSub(); - buildNeg(); - buildSign(); - buildToMontgomery(); - buildFromMontgomery(); - buildEq(); - buildInverse(); - buildTimesScalar(); - buildIsNegative(); - - module.exportFunction(prefix + "_isZero"); - module.exportFunction(prefix + "_isOne"); - module.exportFunction(prefix + "_zero"); - module.exportFunction(prefix + "_one"); - module.exportFunction(prefix + "_copy"); - module.exportFunction(prefix + "_mul"); - module.exportFunction(prefix + "_square"); - module.exportFunction(prefix + "_add"); - module.exportFunction(prefix + "_sub"); - module.exportFunction(prefix + "_neg"); - module.exportFunction(prefix + "_sign"); - module.exportFunction(prefix + "_fromMontgomery"); - module.exportFunction(prefix + "_toMontgomery"); - module.exportFunction(prefix + "_eq"); - module.exportFunction(prefix + "_inverse"); - buildBatchInverse(module, prefix); - buildExp( - module, - prefix + "_exp", - f1n8*3, - prefix + "_mul", - prefix + "_square", - prefix + "_copy", - prefix + "_one" - ); - module.exportFunction(prefix + "_exp"); - module.exportFunction(prefix + "_timesScalar"); - module.exportFunction(prefix + "_batchInverse"); - module.exportFunction(prefix + "_isNegative"); - - return prefix; -}; - - -/***/ }), - -/***/ 93911: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ - -const bigInt = __webpack_require__(92096); -const utils = __webpack_require__(12333); - -module.exports = function buildFFT(module, prefix, gPrefix, fPrefix, opGtimesF) { +var build_fft = function buildFFT(module, prefix, gPrefix, fPrefix, opGtimesF) { const n64f = module.modules[fPrefix].n64; const n8f = n64f*8; @@ -119155,61 +160981,61 @@ module.exports = function buildFFT(module, prefix, gPrefix, fPrefix, opGtimesF) const q = module.modules[fPrefix].q; - let rem = q.minus(bigInt(1)); + let rem = q - 1n; let maxBits = 0; - while (!rem.isOdd()) { + while (!isOdd$2(rem)) { maxBits ++; - rem = rem.shiftRight(1); + rem = rem >> 1n; } - let nr = bigInt(2); + let nr = 2n; - while ( nr.modPow(q.shiftRight(1), q).equals(1) ) nr = nr.add(1); + while ( modPow(nr, q >> 1n, q) === 1n ) nr = nr + 1n; // console.log(nr); const w = new Array(maxBits+1); - w[maxBits] = nr.modPow(rem, q); + w[maxBits] = modPow(nr, rem, q); let n=maxBits-1; while (n>=0) { - w[n] = w[n+1].modPow(2, q); + w[n] = modPow(w[n+1], 2n, q); n--; } const bytes = []; - const R = bigInt(1).shiftLeft(n8f*8).mod(q); + const R = (1n << BigInt(n8f*8)) % q; for (let i=0; i { - /* Copyright 2019 0KIMS association. @@ -120515,1581 +162335,7 @@ module.exports = function buildFFT(module, prefix, gPrefix, fPrefix, opGtimesF) along with wasmsnark. If not, see . */ -const utils = __webpack_require__(12333); - -module.exports = function buildInt(module, n64, _prefix) { - - const prefix = _prefix || "int"; - if (module.modules[prefix]) return prefix; // already builded - module.modules[prefix] = {}; - - const n32 = n64*2; - const n8 = n64*8; - - const one = module.alloc(n8, utils.bigInt2BytesLE(1, n8)); - - function buildCopy() { - const f = module.addFunction(prefix+"_copy"); - f.addParam("px", "i32"); - f.addParam("pr", "i32"); - - const c = f.getCodeBuilder(); - - for (let i=0; i>1) )&&(i>1, k>>1) - ) - ) - ); - - f.addCode( - c.setLocal(c1, - c.i64_add( - c.getLocal(c1), - c.i64_shr_u( - c.getLocal(c0), - c.i64_const(32) - ) - ) - ) - ); - } - - // Add the old carry - - if (k>0) { - f.addCode( - c.setLocal(c0, - c.i64_add( - c.i64_and( - c.getLocal(c0), - c.i64_const(0xFFFFFFFF) - ), - c.i64_and( - c.getLocal(c0_old), - c.i64_const(0xFFFFFFFF) - ), - ) - ) - ); - - f.addCode( - c.setLocal(c1, - c.i64_add( - c.i64_add( - c.getLocal(c1), - c.i64_shr_u( - c.getLocal(c0), - c.i64_const(32) - ) - ), - c.getLocal(c1_old) - ) - ) - ); - } - - f.addCode( - c.i64_store32( - c.getLocal("r"), - k*4, - c.getLocal(c0) - ) - ); - - f.addCode( - c.setLocal( - c0_old, - c.getLocal(c1) - ), - c.setLocal( - c1_old, - c.i64_shr_u( - c.getLocal(c0_old), - c.i64_const(32) - ) - ) - ); - - } - f.addCode( - c.i64_store32( - c.getLocal("r"), - n32*4*2-4, - c.getLocal(c0_old) - ) - ); - - } - - - function buildSquareOld() { - const f = module.addFunction(prefix+"_squareOld"); - f.addParam("x", "i32"); - f.addParam("r", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode(c.call(prefix + "_mul", c.getLocal("x"), c.getLocal("x"), c.getLocal("r"))); - } - - function _buildMul1() { - const f = module.addFunction(prefix+"__mul1"); - f.addParam("px", "i32"); - f.addParam("y", "i64"); - f.addParam("pr", "i32"); - f.addLocal("c", "i64"); - - const c = f.getCodeBuilder(); - - f.addCode(c.setLocal( - "c", - c.i64_mul( - c.i64_load32_u(c.getLocal("px"), 0, 0), - c.getLocal("y") - ) - )); - - f.addCode(c.i64_store32( - c.getLocal("pr"), - 0, - 0, - c.getLocal("c"), - )); - - for (let i=1; i3)&&(Y[eY]==0) ey--; - f.addCode(c.block(c.loop( - c.br_if( - 1, - c.i32_or( - c.i32_load8_u( - c.i32_add(Y , c.getLocal("eY")), - 0, - 0 - ), - c.i32_eq( - c.getLocal("eY"), - c.i32_const(3) - ) - ) - ), - c.setLocal("eY", c.i32_sub(c.getLocal("eY"), c.i32_const(1))), - c.br(0) - ))); - - f.addCode( - c.setLocal( - "sy", - c.i64_add( - c.i64_load32_u( - c.i32_sub( - c.i32_add( Y, c.getLocal("eY")), - c.i32_const(3) - ), - 0, - 0 - ), - c.i64_const(1) - ) - ) - ); - - // Force a divide by 0 if quotien is 0 - f.addCode( - c.if( - c.i64_eq( - c.getLocal("sy"), - c.i64_const(1) - ), - c.drop(c.i64_div_u(c.i64_const(0), c.i64_const(0))) - ) - ); - - f.addCode(c.block(c.loop( - - // while (eX>7)&&(Y[eX]==0) ex--; - c.block(c.loop( - c.br_if( - 1, - c.i32_or( - c.i32_load8_u( - c.i32_add(R , c.getLocal("eX")), - 0, - 0 - ), - c.i32_eq( - c.getLocal("eX"), - c.i32_const(7) - ) - ) - ), - c.setLocal("eX", c.i32_sub(c.getLocal("eX"), c.i32_const(1))), - c.br(0) - )), - - c.setLocal( - "sx", - c.i64_load( - c.i32_sub( - c.i32_add( R, c.getLocal("eX")), - c.i32_const(7) - ), - 0, - 0 - ) - ), - - c.setLocal( - "sx", - c.i64_div_u( - c.getLocal("sx"), - c.getLocal("sy") - ) - ), - c.setLocal( - "ec", - c.i32_sub( - c.i32_sub( - c.getLocal("eX"), - c.getLocal("eY") - ), - c.i32_const(4) - ) - ), - - // While greater than 32 bits or ec is neg, shr and inc exp - c.block(c.loop( - c.br_if( - 1, - c.i32_and( - c.i64_eqz( - c.i64_and( - c.getLocal("sx"), - c.i64_const("0xFFFFFFFF00000000") - ) - ), - c.i32_ge_s( - c.getLocal("ec"), - c.i32_const(0) - ) - ) - ), - - c.setLocal( - "sx", - c.i64_shr_u( - c.getLocal("sx"), - c.i64_const(8) - ) - ), - - c.setLocal( - "ec", - c.i32_add( - c.getLocal("ec"), - c.i32_const(1) - ) - ), - c.br(0) - )), - - c.if( - c.i64_eqz(c.getLocal("sx")), - [ - ...c.br_if( - 2, - c.i32_eqz(c.call(prefix + "_gte", R, Y)) - ), - ...c.setLocal("sx", c.i64_const(1)), - ...c.setLocal("ec", c.i32_const(0)) - ] - ), - - c.call(prefix + "__mul1", Y, c.getLocal("sx"), R2), - c.drop(c.call( - prefix + "_sub", - R, - c.i32_sub(R2, c.getLocal("ec")), - R - )), - c.call( - prefix + "__add1", - c.i32_add(C, c.getLocal("ec")), - c.getLocal("sx") - ), - c.br(0) - ))); - } - - function buildInverseMod() { - - const f = module.addFunction(prefix+"_inverseMod"); - f.addParam("px", "i32"); - f.addParam("pm", "i32"); - f.addParam("pr", "i32"); - f.addLocal("t", "i32"); - f.addLocal("newt", "i32"); - f.addLocal("r", "i32"); - f.addLocal("qq", "i32"); - f.addLocal("qr", "i32"); - f.addLocal("newr", "i32"); - f.addLocal("swp", "i32"); - f.addLocal("x", "i32"); - f.addLocal("signt", "i32"); - f.addLocal("signnewt", "i32"); - f.addLocal("signx", "i32"); - - const c = f.getCodeBuilder(); - - const aux1 = c.i32_const(module.alloc(n8)); - const aux2 = c.i32_const(module.alloc(n8)); - const aux3 = c.i32_const(module.alloc(n8)); - const aux4 = c.i32_const(module.alloc(n8)); - const aux5 = c.i32_const(module.alloc(n8)); - const aux6 = c.i32_const(module.alloc(n8)); - const mulBuff = c.i32_const(module.alloc(n8*2)); - const aux7 = c.i32_const(module.alloc(n8)); - - f.addCode( - c.setLocal("t", aux1), - c.call(prefix + "_zero", aux1), - c.setLocal("signt", c.i32_const(0)), - ); - - f.addCode( - c.setLocal("r", aux2), - c.call(prefix + "_copy", c.getLocal("pm"), aux2) - ); - - f.addCode( - c.setLocal("newt", aux3), - c.call(prefix + "_one", aux3), - c.setLocal("signnewt", c.i32_const(0)), - ); - - f.addCode( - c.setLocal("newr", aux4), - c.call(prefix + "_copy", c.getLocal("px"), aux4) - ); - - - - - f.addCode(c.setLocal("qq", aux5)); - f.addCode(c.setLocal("qr", aux6)); - f.addCode(c.setLocal("x", aux7)); - - f.addCode(c.block(c.loop( - c.br_if( - 1, - c.call(prefix + "_isZero", c.getLocal("newr") ) - ), - c.call(prefix + "_div", c.getLocal("r"), c.getLocal("newr"), c.getLocal("qq"), c.getLocal("qr")), - - c.call(prefix + "_mul", c.getLocal("qq"), c.getLocal("newt"), mulBuff), - - c.if( - c.getLocal("signt"), - c.if( - c.getLocal("signnewt"), - c.if ( - c.call(prefix + "_gte", mulBuff, c.getLocal("t")), - [ - ...c.drop(c.call(prefix + "_sub", mulBuff, c.getLocal("t"), c.getLocal("x"))), - ...c.setLocal("signx", c.i32_const(0)) - ], - [ - ...c.drop(c.call(prefix + "_sub", c.getLocal("t"), mulBuff, c.getLocal("x"))), - ...c.setLocal("signx", c.i32_const(1)) - ], - ), - [ - ...c.drop(c.call(prefix + "_add", mulBuff, c.getLocal("t"), c.getLocal("x"))), - ...c.setLocal("signx", c.i32_const(1)) - ] - ), - c.if( - c.getLocal("signnewt"), - [ - ...c.drop(c.call(prefix + "_add", mulBuff, c.getLocal("t"), c.getLocal("x"))), - ...c.setLocal("signx", c.i32_const(0)) - ], - c.if ( - c.call(prefix + "_gte", c.getLocal("t"), mulBuff), - [ - ...c.drop(c.call(prefix + "_sub", c.getLocal("t"), mulBuff, c.getLocal("x"))), - ...c.setLocal("signx", c.i32_const(0)) - ], - [ - ...c.drop(c.call(prefix + "_sub", mulBuff, c.getLocal("t"), c.getLocal("x"))), - ...c.setLocal("signx", c.i32_const(1)) - ] - ) - ) - ), - - c.setLocal("swp", c.getLocal("t")), - c.setLocal("t", c.getLocal("newt")), - c.setLocal("newt", c.getLocal("x")), - c.setLocal("x", c.getLocal("swp")), - - c.setLocal("signt", c.getLocal("signnewt")), - c.setLocal("signnewt", c.getLocal("signx")), - - c.setLocal("swp", c.getLocal("r")), - c.setLocal("r", c.getLocal("newr")), - c.setLocal("newr", c.getLocal("qr")), - c.setLocal("qr", c.getLocal("swp")), - - c.br(0) - ))); - - f.addCode(c.if( - c.getLocal("signt"), - c.drop(c.call(prefix + "_sub", c.getLocal("pm"), c.getLocal("t"), c.getLocal("pr"))), - c.call(prefix + "_copy", c.getLocal("t"), c.getLocal("pr")) - )); - } - - - buildCopy(); - buildZero(); - buildIsZero(); - buildOne(); - buildEq(); - buildGte(); - buildAdd(); - buildSub(); - buildMul(); - buildSquare(); - buildSquareOld(); - buildDiv(); - buildInverseMod(); - module.exportFunction(prefix+"_copy"); - module.exportFunction(prefix+"_zero"); - module.exportFunction(prefix+"_one"); - module.exportFunction(prefix+"_isZero"); - module.exportFunction(prefix+"_eq"); - module.exportFunction(prefix+"_gte"); - module.exportFunction(prefix+"_add"); - module.exportFunction(prefix+"_sub"); - module.exportFunction(prefix+"_mul"); - module.exportFunction(prefix+"_square"); - module.exportFunction(prefix+"_squareOld"); - module.exportFunction(prefix+"_div"); - module.exportFunction(prefix+"_inverseMod"); - - return prefix; -}; - - -/***/ }), - -/***/ 74911: -/***/ ((module) => { - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ - -module.exports = function buildMultiexp(module, prefix, fnName, opAdd, n8b) { - - const n64g = module.modules[prefix].n64; - const n8g = n64g*8; - - function buildGetChunk() { - const f = module.addFunction(fnName + "_getChunk"); - f.addParam("pScalar", "i32"); - f.addParam("scalarSize", "i32"); // Number of bytes of the scalar - f.addParam("startBit", "i32"); // Bit to start extract - f.addParam("chunkSize", "i32"); // Chunk size in bits - f.addLocal("bitsToEnd", "i32"); - f.addLocal("mask", "i32"); - f.setReturnType("i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.setLocal("bitsToEnd", - c.i32_sub( - c.i32_mul( - c.getLocal("scalarSize"), - c.i32_const(8) - ), - c.getLocal("startBit") - ) - ), - c.if( - c.i32_gt_s( - c.getLocal("chunkSize"), - c.getLocal("bitsToEnd") - ), - c.setLocal( - "mask", - c.i32_sub( - c.i32_shl( - c.i32_const(1), - c.getLocal("bitsToEnd") - ), - c.i32_const(1) - ) - ), - c.setLocal( - "mask", - c.i32_sub( - c.i32_shl( - c.i32_const(1), - c.getLocal("chunkSize") - ), - c.i32_const(1) - ) - ) - ), - c.i32_and( - c.i32_shr_u( - c.i32_load( - c.i32_add( - c.getLocal("pScalar"), - c.i32_shr_u( - c.getLocal("startBit"), - c.i32_const(3) - ) - ), - 0, // offset - 0 // align to byte. - ), - c.i32_and( - c.getLocal("startBit"), - c.i32_const(0x7) - ) - ), - c.getLocal("mask") - ) - ); - } - - function buildMutiexpChunk() { - const f = module.addFunction(fnName + "_chunk"); - f.addParam("pBases", "i32"); - f.addParam("pScalars", "i32"); - f.addParam("scalarSize", "i32"); // Number of points - f.addParam("n", "i32"); // Number of points - f.addParam("startBit", "i32"); // bit where it starts the chunk - f.addParam("chunkSize", "i32"); // bit where it starts the chunk - f.addParam("pr", "i32"); - f.addLocal("nChunks", "i32"); - f.addLocal("itScalar", "i32"); - f.addLocal("endScalar", "i32"); - f.addLocal("itBase", "i32"); - f.addLocal("i", "i32"); - f.addLocal("j", "i32"); - f.addLocal("nTable", "i32"); - f.addLocal("pTable", "i32"); - f.addLocal("idx", "i32"); - f.addLocal("pIdxTable", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.if( - c.i32_eqz(c.getLocal("n")), - [ - ...c.call(prefix + "_zero", c.getLocal("pr")), - ...c.ret([]) - ] - ), - - // Allocate memory - - c.setLocal( - "nTable", - c.i32_shl( - c.i32_const(1), - c.getLocal("chunkSize") - ) - ), - c.setLocal("pTable", c.i32_load( c.i32_const(0) )), - c.i32_store( - c.i32_const(0), - c.i32_add( - c.getLocal("pTable"), - c.i32_mul( - c.getLocal("nTable"), - c.i32_const(n8g) - ) - ) - ), - - // Reset Table - c.setLocal("j", c.i32_const(0)), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("j"), - c.getLocal("nTable") - ) - ), - - c.call( - prefix + "_zero", - c.i32_add( - c.getLocal("pTable"), - c.i32_mul( - c.getLocal("j"), - c.i32_const(n8g) - ) - ) - ), - - c.setLocal("j", c.i32_add(c.getLocal("j"), c.i32_const(1))), - c.br(0) - )), - - // Distribute elements - c.setLocal("itBase", c.getLocal("pBases")), - c.setLocal("itScalar", c.getLocal("pScalars")), - c.setLocal("endScalar", - c.i32_add( - c.getLocal("pScalars"), - c.i32_mul( - c.getLocal("n"), - c.getLocal("scalarSize") - ) - ) - ), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("itScalar"), - c.getLocal("endScalar") - ) - ), - - c.setLocal( - "idx", - c.call(fnName + "_getChunk", - c.getLocal("itScalar"), - c.getLocal("scalarSize"), - c.getLocal("startBit"), - c.getLocal("chunkSize") - ) - ), - - c.if( - c.getLocal("idx"), - [ - ...c.setLocal( - "pIdxTable", - c.i32_add( - c.getLocal("pTable"), - c.i32_mul( - c.i32_sub( - c.getLocal("idx"), - c.i32_const(1) - ), - c.i32_const(n8g) - ) - ) - ), - ...c.call( - opAdd, - c.getLocal("pIdxTable"), - c.getLocal("itBase"), - c.getLocal("pIdxTable"), - ) - ] - ), - - c.setLocal("itScalar", c.i32_add(c.getLocal("itScalar"), c.getLocal("scalarSize"))), - c.setLocal("itBase", c.i32_add(c.getLocal("itBase"), c.i32_const(n8b))), - c.br(0) - )), - - c.call(fnName + "_reduceTable", c.getLocal("pTable"), c.getLocal("chunkSize")), - c.call( - prefix + "_copy", - c.getLocal("pTable"), - c.getLocal("pr") - ), - - - c.i32_store( - c.i32_const(0), - c.getLocal("pTable") - ) - - ); - } - - function buildMultiexp() { - const f = module.addFunction(fnName); - f.addParam("pBases", "i32"); - f.addParam("pScalars", "i32"); - f.addParam("scalarSize", "i32"); // Number of points - f.addParam("n", "i32"); // Number of points - f.addParam("pr", "i32"); - f.addLocal("chunkSize", "i32"); - f.addLocal("nChunks", "i32"); - f.addLocal("itScalar", "i32"); - f.addLocal("endScalar", "i32"); - f.addLocal("itBase", "i32"); - f.addLocal("itBit", "i32"); - f.addLocal("i", "i32"); - f.addLocal("j", "i32"); - f.addLocal("nTable", "i32"); - f.addLocal("pTable", "i32"); - f.addLocal("idx", "i32"); - f.addLocal("pIdxTable", "i32"); - - const c = f.getCodeBuilder(); - - const aux = c.i32_const(module.alloc(n8g)); - - const pTSizes = module.alloc([ - 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 16, 16, 15, 14, 13, 13, - 12, 11, 10, 9, 8, 7, 7, 6, - 5 , 4, 3, 2, 1, 1, 1, 1 - ]); - - f.addCode( - c.call(prefix + "_zero", c.getLocal("pr")), - c.if( - c.i32_eqz(c.getLocal("n")), - c.ret([]) - ), - c.setLocal("chunkSize", c.i32_load8_u( c.i32_clz(c.getLocal("n")), pTSizes )), - c.setLocal( - "nChunks", - c.i32_add( - c.i32_div_u( - c.i32_sub( - c.i32_shl( - c.getLocal("scalarSize"), - c.i32_const(3) - ), - c.i32_const(1) - ), - c.getLocal("chunkSize") - ), - c.i32_const(1) - ) - ), - - - // Allocate memory - - c.setLocal( - "itBit", - c.i32_mul( - c.i32_sub( - c.getLocal("nChunks"), - c.i32_const(1) - ), - c.getLocal("chunkSize") - ) - ), - c.block(c.loop( - c.br_if( - 1, - c.i32_lt_s( - c.getLocal("itBit"), - c.i32_const(0) - ) - ), - - // Double nChunk times - c.if( - c.i32_eqz(c.call(prefix + "_isZero", c.getLocal("pr"))), - [ - ...c.setLocal("j", c.i32_const(0)), - ...c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("j"), - c.getLocal("chunkSize") - ) - ), - - c.call(prefix + "_double", c.getLocal("pr"), c.getLocal("pr")), - - c.setLocal("j", c.i32_add(c.getLocal("j"), c.i32_const(1))), - c.br(0) - )) - ] - ), - - c.call( - fnName + "_chunk", - c.getLocal("pBases"), - c.getLocal("pScalars"), - c.getLocal("scalarSize"), - c.getLocal("n"), - c.getLocal("itBit"), - c.getLocal("chunkSize"), - aux - ), - - c.call( - prefix + "_add", - c.getLocal("pr"), - aux, - c.getLocal("pr") - ), - c.setLocal("itBit", c.i32_sub(c.getLocal("itBit"), c.getLocal("chunkSize"))), - c.br(0) - )) - ); - } - - function buildReduceTable() { - const f = module.addFunction(fnName + "_reduceTable"); - f.addParam("pTable", "i32"); - f.addParam("p", "i32"); // Number of bits of the table - f.addLocal("half", "i32"); - f.addLocal("it1", "i32"); - f.addLocal("it2", "i32"); - f.addLocal("pAcc", "i32"); - - const c = f.getCodeBuilder(); - - f.addCode( - c.if( - c.i32_eq(c.getLocal("p"), c.i32_const(1)), - c.ret([]) - ), - c.setLocal( - "half", - c.i32_shl( - c.i32_const(1), - c.i32_sub( - c.getLocal("p"), - c.i32_const(1) - ) - ) - ), - - c.setLocal("it1", c.getLocal("pTable")), - c.setLocal( - "it2", - c.i32_add( - c.getLocal("pTable"), - c.i32_mul( - c.getLocal("half"), - c.i32_const(n8g) - ) - ) - ), - c.setLocal("pAcc", - c.i32_sub( - c.getLocal("it2"), - c.i32_const(n8g) - ) - ), - c.block(c.loop( - c.br_if( - 1, - c.i32_eq( - c.getLocal("it1"), - c.getLocal("pAcc") - ) - ), - c.call( - prefix + "_add", - c.getLocal("it1"), - c.getLocal("it2"), - c.getLocal("it1") - ), - c.call( - prefix + "_add", - c.getLocal("pAcc"), - c.getLocal("it2"), - c.getLocal("pAcc") - ), - c.setLocal("it1", c.i32_add(c.getLocal("it1"), c.i32_const(n8g))), - c.setLocal("it2", c.i32_add(c.getLocal("it2"), c.i32_const(n8g))), - c.br(0) - )), - - c.call( - fnName + "_reduceTable", - c.getLocal("pTable"), - c.i32_sub( - c.getLocal("p"), - c.i32_const(1) - ) - ), - - c.setLocal("p", c.i32_sub(c.getLocal("p"), c.i32_const(1))), - c.block(c.loop( - c.br_if(1, c.i32_eqz(c.getLocal("p"))), - c.call(prefix + "_double", c.getLocal("pAcc"), c.getLocal("pAcc")), - c.setLocal("p", c.i32_sub(c.getLocal("p"), c.i32_const(1))), - c.br(0) - )), - - c.call(prefix + "_add", c.getLocal("pTable"), c.getLocal("pAcc"), c.getLocal("pTable")) - ); - } - - buildGetChunk(); - buildReduceTable(); - buildMutiexpChunk(); - buildMultiexp(); - - module.exportFunction(fnName); - module.exportFunction(fnName +"_chunk"); - - -}; - - - - - -/***/ }), - -/***/ 2896: -/***/ ((module) => { - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ - -module.exports = function buildPol(module, prefix, prefixField) { +var build_pol = function buildPol(module, prefix, prefixField) { const n64 = module.modules[prefixField].n64; const n8 = n64*8; @@ -122229,14 +162475,7 @@ module.exports = function buildPol(module, prefix, prefixField) { }; - -/***/ }), - -/***/ 10637: -/***/ ((module) => { - - -module.exports = function buildQAP(module, prefix, prefixField) { +var build_qap = function buildQAP(module, prefix, prefixField) { const n64 = module.modules[prefixField].n64; const n8 = n64*8; @@ -122573,13 +162812,6 @@ module.exports = function buildQAP(module, prefix, prefixField) { }; - - -/***/ }), - -/***/ 50345: -/***/ ((module) => { - /* Copyright 2019 0KIMS association. @@ -122599,320 +162831,3090 @@ module.exports = function buildQAP(module, prefix, prefixField) { along with wasmsnark. If not, see . */ -module.exports = function buildTimesScalar(module, fnName, elementLen, opAB, opAA, opCopy, opInit) { +var build_applykey = function buildApplyKey(module, fnName, gPrefix, frPrefix, sizeGIn, sizeGOut, sizeF, opGtimesF) { const f = module.addFunction(fnName); - f.addParam("base", "i32"); - f.addParam("scalar", "i32"); - f.addParam("scalarLength", "i32"); - f.addParam("r", "i32"); + f.addParam("pIn", "i32"); + f.addParam("n", "i32"); + f.addParam("pFirst", "i32"); + f.addParam("pInc", "i32"); + f.addParam("pOut", "i32"); + f.addLocal("pOldFree", "i32"); f.addLocal("i", "i32"); - f.addLocal("b", "i32"); + f.addLocal("pFrom", "i32"); + f.addLocal("pTo", "i32"); const c = f.getCodeBuilder(); - const aux = c.i32_const(module.alloc(elementLen)); + const t = c.i32_const(module.alloc(sizeF)); f.addCode( - c.if( - c.i32_eqz(c.getLocal("scalarLength")), - [ - ...c.call(opInit, c.getLocal("r")), - ...c.ret([]) - ] + c.setLocal("pFrom", c.getLocal("pIn")), + c.setLocal("pTo", c.getLocal("pOut")), + ); + + // t = first + f.addCode( + c.call( + frPrefix + "_copy", + c.getLocal("pFirst"), + t ) ); - f.addCode(c.call(opCopy, c.getLocal("base"), aux)); - f.addCode(c.call(opInit, c.getLocal("r"))); - f.addCode(c.setLocal("i", c.getLocal("scalarLength"))); - f.addCode(c.block(c.loop( - c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), - - c.setLocal( - "b", - c.i32_load8_u( - c.i32_add( - c.getLocal("scalar"), - c.getLocal("i") - ) - ) - ), - ...innerLoop(), - c.br_if(1, c.i32_eqz ( c.getLocal("i") )), - c.br(0) - ))); - - - function innerLoop() { - const code = []; - for (let i=0; i<8; i++) { - code.push( - ...c.call(opAA, c.getLocal("r"), c.getLocal("r")), - ...c.if( - c.i32_ge_u( c.getLocal("b"), c.i32_const(0x80 >> i)), - [ - ...c.setLocal( - "b", - c.i32_sub( - c.getLocal("b"), - c.i32_const(0x80 >> i) - ) - ), - ...c.call(opAB, c.getLocal("r"),aux, c.getLocal("r")) - ] - ) - ); - } - return code; - } - -}; - - -/***/ }), - -/***/ 33972: -/***/ ((module) => { - -/* - Copyright 2019 0KIMS association. - - This file is part of wasmsnark (Web Assembly zkSnark Prover). - - wasmsnark is a free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - wasmsnark is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with wasmsnark. If not, see . -*/ - -module.exports = function buildTimesScalarNAF(module, fnName, elementLen, opAB, opAA, opAmB, opCopy, opInit) { - - const f = module.addFunction(fnName); - f.addParam("base", "i32"); - f.addParam("scalar", "i32"); - f.addParam("scalarLength", "i32"); - f.addParam("r", "i32"); - f.addLocal("old0", "i32"); - f.addLocal("nbits", "i32"); - f.addLocal("i", "i32"); - f.addLocal("last", "i32"); - f.addLocal("cur", "i32"); - f.addLocal("carry", "i32"); - f.addLocal("p", "i32"); - - const c = f.getCodeBuilder(); - - const aux = c.i32_const(module.alloc(elementLen)); - - function getBit(IDX) { - return c.i32_and( - c.i32_shr_u( - c.i32_load( - c.i32_add( - c.getLocal("scalar"), - c.i32_and( - c.i32_shr_u( - IDX, - c.i32_const(3) - ), - c.i32_const(0xFFFFFFFC) - ) - ) - ), - c.i32_and( - IDX, - c.i32_const(0x1F) - ) - ), - c.i32_const(1) - ); - } - - function pushBit(b) { - return [ - ...c.i32_store8( - c.getLocal("p"), - c.i32_const(b) - ), - ...c.setLocal( - "p", - c.i32_add( - c.getLocal("p"), - c.i32_const(1) - ) - ) - ]; - } - f.addCode( - c.if( - c.i32_eqz(c.getLocal("scalarLength")), - [ - ...c.call(opInit, c.getLocal("r")), - ...c.ret([]) - ] - ), - c.setLocal("nbits", c.i32_shl(c.getLocal("scalarLength"), c.i32_const(3))), - c.setLocal("old0", c.i32_load(c.i32_const(0))), - c.setLocal("p", c.getLocal("old0")), - c.i32_store( - c.i32_const(0), - c.i32_and( - c.i32_add( - c.i32_add( - c.getLocal("old0"), - c.i32_const(32) - ), - c.getLocal("nbits") - ), - c.i32_const(0xFFFFFFF8) - ) - ), - c.setLocal("i", c.i32_const(1)), - - c.setLocal("last",getBit(c.i32_const(0))), - c.setLocal("carry",c.i32_const(0)), - + c.setLocal("i", c.i32_const(0)), c.block(c.loop( - c.br_if(1, c.i32_eq( c.getLocal("i"), c.getLocal("nbits"))), + c.br_if(1, c.i32_eq ( c.getLocal("i"), c.getLocal("n") )), - c.setLocal("cur", getBit(c.getLocal("i"))), - c.if( c.getLocal("last"), - c.if( c.getLocal("cur"), - c.if(c.getLocal("carry"), - [ - ...c.setLocal("last", c.i32_const(0)), - ...c.setLocal("carry", c.i32_const(1)), - ...pushBit(1) - ] - , - [ - ...c.setLocal("last", c.i32_const(0)), - ...c.setLocal("carry", c.i32_const(1)), - ...pushBit(255) - ], - ), - c.if(c.getLocal("carry"), - [ - ...c.setLocal("last", c.i32_const(0)), - ...c.setLocal("carry", c.i32_const(1)), - ...pushBit(255) - ] - , - [ - ...c.setLocal("last", c.i32_const(0)), - ...c.setLocal("carry", c.i32_const(0)), - ...pushBit(1) - ], - ), - ), - c.if( c.getLocal("cur"), - c.if(c.getLocal("carry"), - [ - ...c.setLocal("last", c.i32_const(0)), - ...c.setLocal("carry", c.i32_const(1)), - ...pushBit(0) - ] - , - [ - ...c.setLocal("last", c.i32_const(1)), - ...c.setLocal("carry", c.i32_const(0)), - ...pushBit(0) - ], - ), - c.if(c.getLocal("carry"), - [ - ...c.setLocal("last", c.i32_const(1)), - ...c.setLocal("carry", c.i32_const(0)), - ...pushBit(0) - ] - , - [ - ...c.setLocal("last", c.i32_const(0)), - ...c.setLocal("carry", c.i32_const(0)), - ...pushBit(0) - ], - ), - ) + c.call( + opGtimesF, + c.getLocal("pFrom"), + t, + c.getLocal("pTo") + ), + c.setLocal("pFrom", c.i32_add(c.getLocal("pFrom"), c.i32_const(sizeGIn))), + c.setLocal("pTo", c.i32_add(c.getLocal("pTo"), c.i32_const(sizeGOut))), + + // t = t* inc + c.call( + frPrefix + "_mul", + t, + c.getLocal("pInc"), + t ), c.setLocal("i", c.i32_add(c.getLocal("i"), c.i32_const(1))), c.br(0) - )), - - c.if( c.getLocal("last"), - c.if(c.getLocal("carry"), - [ - ...pushBit(255), - ...pushBit(0), - ...pushBit(1) - ] - , - [ - ...pushBit(1) - ], - ), - c.if(c.getLocal("carry"), - [ - ...pushBit(0), - ...pushBit(1) - ] - ), - ), - - c.setLocal("p", c.i32_sub(c.getLocal("p"), c.i32_const(1))), - - // p already points to the last bit - - c.call(opCopy, c.getLocal("base"), aux), - - c.call(opInit, c.getLocal("r")), - - c.block(c.loop( - - - c.call(opAA, c.getLocal("r"), c.getLocal("r")), - - - c.setLocal("cur", - c.i32_load8_u( - c.getLocal("p") - ) - ), - - c.if( - c.getLocal("cur"), - c.if( - c.i32_eq(c.getLocal("cur"), c.i32_const(1)), - c.call(opAB, c.getLocal("r"), aux, c.getLocal("r")), - c.call(opAmB, c.getLocal("r"), aux, c.getLocal("r")), - ) - ), - - c.br_if(1, c.i32_eq( c.getLocal("old0"), c.getLocal("p"))), - c.setLocal("p", c.i32_sub(c.getLocal("p"), c.i32_const(1))), - c.br(0) - - )), - - c.i32_store( c.i32_const(0), c.getLocal("old0")) - + )) ); + module.exportFunction(fnName); + }; +const utils$2 = utils$6; -/***/ }), +const buildF1m$1 =build_f1m; +const buildF1$1 =build_f1; +const buildF2m$1 =build_f2m; +const buildF3m$1 =build_f3m; +const buildCurve$1 =build_curve_jacobian_a0; +const buildFFT$2 = build_fft; +const buildPol$1 = build_pol; +const buildQAP$1 = build_qap; +const buildApplyKey$1 = build_applykey; +const { bitLength: bitLength$2, modInv, isOdd: isOdd$1, isNegative: isNegative$2 } = bigint; -/***/ 12333: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +var build_bn128 = function buildBN128(module, _prefix) { + + const prefix = _prefix || "bn128"; + + if (module.modules[prefix]) return prefix; // already builded + + const q = 21888242871839275222246405745257275088696311157297823662689037894645226208583n; + const r = 21888242871839275222246405745257275088548364400416034343698204186575808495617n; + + + const n64 = Math.floor((bitLength$2(q - 1n) - 1)/64) +1; + const n8 = n64*8; + const frsize = n8; + const f1size = n8; + const f2size = f1size * 2; + const ftsize = f1size * 12; + + const pr = module.alloc(utils$2.bigInt2BytesLE( r, frsize )); + + const f1mPrefix = buildF1m$1(module, q, "f1m"); + buildF1$1(module, r, "fr", "frm"); + + const pG1b = module.alloc(utils$2.bigInt2BytesLE( toMontgomery(3n), f1size )); + const g1mPrefix = buildCurve$1(module, "g1m", "f1m", pG1b); + + buildFFT$2(module, "frm", "frm", "frm", "frm_mul"); + + buildPol$1(module, "pol", "frm"); + buildQAP$1(module, "qap", "frm"); + + const f2mPrefix = buildF2m$1(module, "f1m_neg", "f2m", "f1m"); + const pG2b = module.alloc([ + ...utils$2.bigInt2BytesLE( toMontgomery(19485874751759354771024239261021720505790618469301721065564631296452457478373n), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(266929791119991161246907387137283842545076965332900288569378510910307636690n), f1size ) + ]); + const g2mPrefix = buildCurve$1(module, "g2m", "f2m", pG2b); + + + function buildGTimesFr(fnName, opMul) { + const f = module.addFunction(fnName); + f.addParam("pG", "i32"); + f.addParam("pFr", "i32"); + f.addParam("pr", "i32"); + + const c = f.getCodeBuilder(); + + const AUX = c.i32_const(module.alloc(n8)); + + f.addCode( + c.call("frm_fromMontgomery", c.getLocal("pFr"), AUX), + c.call( + opMul, + c.getLocal("pG"), + AUX, + c.i32_const(n8), + c.getLocal("pr") + ) + ); + + module.exportFunction(fnName); + } + buildGTimesFr("g1m_timesFr", "g1m_timesScalar"); + buildFFT$2(module, "g1m", "g1m", "frm", "g1m_timesFr"); + + buildGTimesFr("g2m_timesFr", "g2m_timesScalar"); + buildFFT$2(module, "g2m", "g2m", "frm", "g2m_timesFr"); + + buildGTimesFr("g1m_timesFrAffine", "g1m_timesScalarAffine"); + buildGTimesFr("g2m_timesFrAffine", "g2m_timesScalarAffine"); + + buildApplyKey$1(module, "frm_batchApplyKey", "fmr", "frm", n8, n8, n8, "frm_mul"); + buildApplyKey$1(module, "g1m_batchApplyKey", "g1m", "frm", n8*3, n8*3, n8, "g1m_timesFr"); + buildApplyKey$1(module, "g1m_batchApplyKeyMixed", "g1m", "frm", n8*2, n8*3, n8, "g1m_timesFrAffine"); + buildApplyKey$1(module, "g2m_batchApplyKey", "g2m", "frm", n8*2*3, n8*3*2, n8, "g2m_timesFr"); + buildApplyKey$1(module, "g2m_batchApplyKeyMixed", "g2m", "frm", n8*2*2, n8*3*2, n8, "g2m_timesFrAffine"); + + function toMontgomery(a) { + return BigInt(a) * ( 1n << BigInt(f1size*8)) % q; + } + + const G1gen = [ + 1n, + 2n, + 1n + ]; + + const pG1gen = module.alloc( + [ + ...utils$2.bigInt2BytesLE( toMontgomery(G1gen[0]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G1gen[1]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G1gen[2]), f1size ), + ] + ); + + const G1zero = [ + 0n, + 1n, + 0n + ]; + + const pG1zero = module.alloc( + [ + ...utils$2.bigInt2BytesLE( toMontgomery(G1zero[0]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G1zero[1]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G1zero[2]), f1size ) + ] + ); + + const G2gen = [ + [ + 10857046999023057135944570762232829481370756359578518086990519993285655852781n, + 11559732032986387107991004021392285783925812861821192530917403151452391805634n, + ],[ + 8495653923123431417604973247489272438418190587263600148770280649306958101930n, + 4082367875863433681332203403145435568316851327593401208105741076214120093531n, + ],[ + 1n, + 0n, + ] + ]; + + const pG2gen = module.alloc( + [ + ...utils$2.bigInt2BytesLE( toMontgomery(G2gen[0][0]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G2gen[0][1]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G2gen[1][0]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G2gen[1][1]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G2gen[2][0]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G2gen[2][1]), f1size ), + ] + ); + + const G2zero = [ + [ + 0n, + 0n, + ],[ + 1n, + 0n, + ],[ + 0n, + 0n, + ] + ]; + + const pG2zero = module.alloc( + [ + ...utils$2.bigInt2BytesLE( toMontgomery(G2zero[0][0]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G2zero[0][1]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G2zero[1][0]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G2zero[1][1]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G2zero[2][0]), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(G2zero[2][1]), f1size ), + ] + ); + + const pOneT = module.alloc([ + ...utils$2.bigInt2BytesLE( toMontgomery(1), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(0), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(0), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(0), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(0), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(0), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(0), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(0), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(0), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(0), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(0), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(0), f1size ), + ]); + + const pNonResidueF6 = module.alloc([ + ...utils$2.bigInt2BytesLE( toMontgomery(9), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(1), f1size ), + ]); + + const pTwoInv = module.alloc([ + ...utils$2.bigInt2BytesLE( toMontgomery( modInv(2n, q)), f1size ), + ...utils$2.bigInt2BytesLE( 0n, f1size ) + ]); + + const pAltBn128Twist = pNonResidueF6; + + const pTwistCoefB = module.alloc([ + ...utils$2.bigInt2BytesLE( toMontgomery(19485874751759354771024239261021720505790618469301721065564631296452457478373n), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery(266929791119991161246907387137283842545076965332900288569378510910307636690n), f1size ), + ]); + + function build_mulNR6() { + const f = module.addFunction(prefix + "_mulNR6"); + f.addParam("x", "i32"); + f.addParam("pr", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode( + c.call( + f2mPrefix + "_mul", + c.i32_const(pNonResidueF6), + c.getLocal("x"), + c.getLocal("pr") + ) + ); + } + build_mulNR6(); + + const f6mPrefix = buildF3m$1(module, prefix+"_mulNR6", "f6m", "f2m"); + + function build_mulNR12() { + const f = module.addFunction(prefix + "_mulNR12"); + f.addParam("x", "i32"); + f.addParam("pr", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode( + c.call( + f2mPrefix + "_mul", + c.i32_const(pNonResidueF6), + c.i32_add(c.getLocal("x"), c.i32_const(n8*4)), + c.getLocal("pr") + ), + c.call( + f2mPrefix + "_copy", + c.getLocal("x"), + c.i32_add(c.getLocal("pr"), c.i32_const(n8*2)), + ), + c.call( + f2mPrefix + "_copy", + c.i32_add(c.getLocal("x"), c.i32_const(n8*2)), + c.i32_add(c.getLocal("pr"), c.i32_const(n8*4)), + ) + ); + } + build_mulNR12(); + + const ftmPrefix = buildF2m$1(module, prefix+"_mulNR12", "ftm", f6mPrefix); + + + const ateLoopCount = 29793968203157093288n; + const ateLoopBitBytes = bits(ateLoopCount); + const pAteLoopBitBytes = module.alloc(ateLoopBitBytes); + + const ateCoefSize = 3 * f2size; + const ateNDblCoefs = ateLoopBitBytes.length-1; + const ateNAddCoefs = ateLoopBitBytes.reduce((acc, b) => acc + ( b!=0 ? 1 : 0) ,0); + const ateNCoefs = ateNAddCoefs + ateNDblCoefs + 1; + const prePSize = 3*2*n8; + const preQSize = 3*n8*2 + ateNCoefs*ateCoefSize; + + + module.modules[prefix] = { + n64: n64, + pG1gen: pG1gen, + pG1zero: pG1zero, + pG1b: pG1b, + pG2gen: pG2gen, + pG2zero: pG2zero, + pG2b: pG2b, + pq: module.modules["f1m"].pq, + pr: pr, + pOneT: pOneT, + prePSize: prePSize, + preQSize: preQSize, + r: r.toString(), + q: q.toString() + }; + + // console.log("PrePSize: " +prePSize); + // console.log("PreQSize: " +preQSize); + + const finalExpZ = 4965661367192848881n; + + function naf(n) { + let E = n; + const res = []; + while (E > 0n) { + if (isOdd$1(E)) { + const z = 2 - Number(E % 4n); + res.push( z ); + E = E - BigInt(z); + } else { + res.push( 0 ); + } + E = E >> 1n; + } + return res; + } + + function bits(n) { + let E = n; + const res = []; + while (E > 0n) { + if (isOdd$1(E)) { + res.push( 1 ); + } else { + res.push( 0 ); + } + E = E >> 1n; + } + return res; + } + + function buildPrepareG1() { + const f = module.addFunction(prefix+ "_prepareG1"); + f.addParam("pP", "i32"); + f.addParam("ppreP", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode( + c.call(g1mPrefix + "_normalize", c.getLocal("pP"), c.getLocal("ppreP")), // TODO Remove if already in affine + ); + } + + function buildPrepAddStep() { + const f = module.addFunction(prefix+ "_prepAddStep"); + f.addParam("pQ", "i32"); + f.addParam("pR", "i32"); + f.addParam("pCoef", "i32"); + + const c = f.getCodeBuilder(); + + const X2 = c.getLocal("pQ"); + const Y2 = c.i32_add(c.getLocal("pQ"), c.i32_const(f2size)); + + const X1 = c.getLocal("pR"); + const Y1 = c.i32_add(c.getLocal("pR"), c.i32_const(f2size)); + const Z1 = c.i32_add(c.getLocal("pR"), c.i32_const(2*f2size)); + + const ELL_0 = c.getLocal("pCoef"); + const ELL_VW = c.i32_add(c.getLocal("pCoef"), c.i32_const(f2size)); + const ELL_VV = c.i32_add(c.getLocal("pCoef"), c.i32_const(2*f2size)); + + const D = ELL_VW; + const E = c.i32_const(module.alloc(f2size)); + const F = c.i32_const(module.alloc(f2size)); + const G = c.i32_const(module.alloc(f2size)); + const H = c.i32_const(module.alloc(f2size)); + const I = c.i32_const(module.alloc(f2size)); + const J = c.i32_const(module.alloc(f2size)); + const AUX = c.i32_const(module.alloc(f2size)); + + f.addCode( + // D = X1 - X2*Z1 + c.call(f2mPrefix + "_mul", X2, Z1, D), + c.call(f2mPrefix + "_sub", X1, D, D), + + // E = Y1 - Y2*Z1 + c.call(f2mPrefix + "_mul", Y2, Z1, E), + c.call(f2mPrefix + "_sub", Y1, E, E), + + // F = D^2 + c.call(f2mPrefix + "_square", D, F), + + // G = E^2 + c.call(f2mPrefix + "_square", E, G), + + // H = D*F + c.call(f2mPrefix + "_mul", D, F, H), + + // I = X1 * F + c.call(f2mPrefix + "_mul", X1, F, I), + + // J = H + Z1*G - (I+I) + c.call(f2mPrefix + "_add", I, I, AUX), + c.call(f2mPrefix + "_mul", Z1, G, J), + c.call(f2mPrefix + "_add", H, J, J), + c.call(f2mPrefix + "_sub", J, AUX, J), + + + // X3 (X1) = D*J + c.call(f2mPrefix + "_mul", D, J, X1), + + // Y3 (Y1) = E*(I-J)-(H*Y1) + c.call(f2mPrefix + "_mul", H, Y1, Y1), + c.call(f2mPrefix + "_sub", I, J, AUX), + c.call(f2mPrefix + "_mul", E, AUX, AUX), + c.call(f2mPrefix + "_sub", AUX, Y1, Y1), + + // Z3 (Z1) = Z1*H + c.call(f2mPrefix + "_mul", Z1, H, Z1), + + // ell_0 = xi * (E * X2 - D * Y2) + c.call(f2mPrefix + "_mul", D, Y2, AUX), + c.call(f2mPrefix + "_mul", E, X2, ELL_0), + c.call(f2mPrefix + "_sub", ELL_0, AUX, ELL_0), + c.call(f2mPrefix + "_mul", ELL_0, c.i32_const(pAltBn128Twist), ELL_0), + + + // ell_VV = - E (later: * xP) + c.call(f2mPrefix + "_neg", E, ELL_VV), + + // ell_VW = D (later: * yP ) + // Already assigned + + ); + } + + + + function buildPrepDoubleStep() { + const f = module.addFunction(prefix+ "_prepDblStep"); + f.addParam("pR", "i32"); + f.addParam("pCoef", "i32"); + + const c = f.getCodeBuilder(); + + const X1 = c.getLocal("pR"); + const Y1 = c.i32_add(c.getLocal("pR"), c.i32_const(f2size)); + const Z1 = c.i32_add(c.getLocal("pR"), c.i32_const(2*f2size)); + + const ELL_0 = c.getLocal("pCoef"); + const ELL_VW = c.i32_add(c.getLocal("pCoef"), c.i32_const(f2size)); + const ELL_VV = c.i32_add(c.getLocal("pCoef"), c.i32_const(2*f2size)); + + const A = c.i32_const(module.alloc(f2size)); + const B = c.i32_const(module.alloc(f2size)); + const C = c.i32_const(module.alloc(f2size)); + const D = c.i32_const(module.alloc(f2size)); + const E = c.i32_const(module.alloc(f2size)); + const F = c.i32_const(module.alloc(f2size)); + const G = c.i32_const(module.alloc(f2size)); + const H = c.i32_const(module.alloc(f2size)); + const I = c.i32_const(module.alloc(f2size)); + const J = c.i32_const(module.alloc(f2size)); + const E2 = c.i32_const(module.alloc(f2size)); + const AUX = c.i32_const(module.alloc(f2size)); + + f.addCode( + + // A = X1 * Y1 / 2 + c.call(f2mPrefix + "_mul", Y1, c.i32_const(pTwoInv), A), + c.call(f2mPrefix + "_mul", X1, A, A), + + // B = Y1^2 + c.call(f2mPrefix + "_square", Y1, B), + + // C = Z1^2 + c.call(f2mPrefix + "_square", Z1, C), + + // D = 3 * C + c.call(f2mPrefix + "_add", C, C, D), + c.call(f2mPrefix + "_add", D, C, D), + + // E = twist_b * D + c.call(f2mPrefix + "_mul", c.i32_const(pTwistCoefB), D, E), + + // F = 3 * E + c.call(f2mPrefix + "_add", E, E, F), + c.call(f2mPrefix + "_add", E, F, F), + + // G = (B+F)/2 + c.call(f2mPrefix + "_add", B, F, G), + c.call(f2mPrefix + "_mul", G, c.i32_const(pTwoInv), G), + + // H = (Y1+Z1)^2-(B+C) + c.call(f2mPrefix + "_add", B, C, AUX), + c.call(f2mPrefix + "_add", Y1, Z1, H), + c.call(f2mPrefix + "_square", H, H), + c.call(f2mPrefix + "_sub", H, AUX, H), + + // I = E-B + c.call(f2mPrefix + "_sub", E, B, I), + + // J = X1^2 + c.call(f2mPrefix + "_square", X1, J), + + // E_squared = E^2 + c.call(f2mPrefix + "_square", E, E2), + + // X3 (X1) = A * (B-F) + c.call(f2mPrefix + "_sub", B, F, AUX), + c.call(f2mPrefix + "_mul", A, AUX, X1), + + // Y3 (Y1) = G^2 - 3*E^2 + c.call(f2mPrefix + "_add", E2, E2, AUX), + c.call(f2mPrefix + "_add", E2, AUX, AUX), + c.call(f2mPrefix + "_square", G, Y1), + c.call(f2mPrefix + "_sub", Y1, AUX, Y1), + + // Z3 (Z1) = B * H + c.call(f2mPrefix + "_mul", B, H, Z1), + + // ell_0 = xi * I + c.call(f2mPrefix + "_mul", c.i32_const(pAltBn128Twist), I, ELL_0), + + // ell_VW = - H (later: * yP) + c.call(f2mPrefix + "_neg", H, ELL_VW), + + // ell_VV = 3*J (later: * xP) + c.call(f2mPrefix + "_add", J, J, ELL_VV), + c.call(f2mPrefix + "_add", J, ELL_VV, ELL_VV), + + ); + } + + function buildMulByQ() { + const f = module.addFunction(prefix + "_mulByQ"); + f.addParam("p1", "i32"); + f.addParam("pr", "i32"); + + const c = f.getCodeBuilder(); + + const x = c.getLocal("p1"); + const y = c.i32_add(c.getLocal("p1"), c.i32_const(f2size)); + const z = c.i32_add(c.getLocal("p1"), c.i32_const(f2size*2)); + const x3 = c.getLocal("pr"); + const y3 = c.i32_add(c.getLocal("pr"), c.i32_const(f2size)); + const z3 = c.i32_add(c.getLocal("pr"), c.i32_const(f2size*2)); + + const MulByQX = c.i32_const(module.alloc([ + ...utils$2.bigInt2BytesLE( toMontgomery("21575463638280843010398324269430826099269044274347216827212613867836435027261"), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery("10307601595873709700152284273816112264069230130616436755625194854815875713954"), f1size ), + ])); + + const MulByQY = c.i32_const(module.alloc([ + ...utils$2.bigInt2BytesLE( toMontgomery("2821565182194536844548159561693502659359617185244120367078079554186484126554"), f1size ), + ...utils$2.bigInt2BytesLE( toMontgomery("3505843767911556378687030309984248845540243509899259641013678093033130930403"), f1size ), + ])); + + f.addCode( + // The frobeniusMap(1) in this field, is the conjugate + c.call(f2mPrefix + "_conjugate", x, x3), + c.call(f2mPrefix + "_mul", MulByQX, x3, x3), + c.call(f2mPrefix + "_conjugate", y, y3), + c.call(f2mPrefix + "_mul", MulByQY, y3, y3), + c.call(f2mPrefix + "_conjugate", z, z3), + ); + } + + + function buildPrepareG2() { + buildMulByQ(); + const f = module.addFunction(prefix+ "_prepareG2"); + f.addParam("pQ", "i32"); + f.addParam("ppreQ", "i32"); + f.addLocal("pCoef", "i32"); + f.addLocal("i", "i32"); + + const c = f.getCodeBuilder(); + + const QX = c.getLocal("pQ"); + + const pR = module.alloc(f2size*3); + const R = c.i32_const(pR); + const RX = c.i32_const(pR); + const RY = c.i32_const(pR+f2size); + const RZ = c.i32_const(pR+2*f2size); + + const cQX = c.i32_add( c.getLocal("ppreQ"), c.i32_const(0)); + const cQY = c.i32_add( c.getLocal("ppreQ"), c.i32_const(f2size)); + + const pQ1 = module.alloc(f2size*3); + const Q1 = c.i32_const(pQ1); + + const pQ2 = module.alloc(f2size*3); + const Q2 = c.i32_const(pQ2); + const Q2Y = c.i32_const(pQ2 + f2size); + + f.addCode( + c.call(g2mPrefix + "_normalize", QX, cQX), // TODO Remove if already in affine + c.call(f2mPrefix + "_copy", cQX, RX), + c.call(f2mPrefix + "_copy", cQY, RY), + c.call(f2mPrefix + "_one", RZ), + ); + + f.addCode( + c.setLocal("pCoef", c.i32_add( c.getLocal("ppreQ"), c.i32_const(f2size*3))), + c.setLocal("i", c.i32_const(ateLoopBitBytes.length-2)), + c.block(c.loop( + + c.call(prefix + "_prepDblStep", R, c.getLocal("pCoef")), + c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + + c.if( + c.i32_load8_s(c.getLocal("i"), pAteLoopBitBytes), + [ + ...c.call(prefix + "_prepAddStep", cQX, R, c.getLocal("pCoef")), + ...c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + ] + ), + c.br_if(1, c.i32_eqz ( c.getLocal("i") )), + c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), + c.br(0) + )) + ); + + f.addCode( + c.call(prefix + "_mulByQ", cQX, Q1), + c.call(prefix + "_mulByQ", Q1, Q2) + ); + + f.addCode( + c.call(f2mPrefix + "_neg", Q2Y, Q2Y), + + c.call(prefix + "_prepAddStep", Q1, R, c.getLocal("pCoef")), + c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + + c.call(prefix + "_prepAddStep", Q2, R, c.getLocal("pCoef")), + c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + ); + } + + function buildMulBy024Old() { + const f = module.addFunction(prefix+ "__mulBy024Old"); + f.addParam("pEll0", "i32"); + f.addParam("pEllVW", "i32"); + f.addParam("pEllVV", "i32"); + f.addParam("pR", "i32"); // Result in F12 + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("pEll0"); + const x2 = c.getLocal("pEllVV"); + const x4 = c.getLocal("pEllVW"); + + const z0 = c.getLocal("pR"); + + const pAUX12 = module.alloc(ftsize); + const AUX12 = c.i32_const(pAUX12); + const AUX12_0 = c.i32_const(pAUX12); + const AUX12_2 = c.i32_const(pAUX12+f2size); + const AUX12_4 = c.i32_const(pAUX12+f2size*2); + const AUX12_6 = c.i32_const(pAUX12+f2size*3); + const AUX12_8 = c.i32_const(pAUX12+f2size*4); + const AUX12_10 = c.i32_const(pAUX12+f2size*5); + + f.addCode( + + c.call(f2mPrefix + "_copy", x0, AUX12_0), + c.call(f2mPrefix + "_zero", AUX12_2), + c.call(f2mPrefix + "_copy", x2, AUX12_4), + c.call(f2mPrefix + "_zero", AUX12_6), + c.call(f2mPrefix + "_copy", x4, AUX12_8), + c.call(f2mPrefix + "_zero", AUX12_10), + c.call(ftmPrefix + "_mul", AUX12, z0, z0), + ); + } + + function buildMulBy024() { + const f = module.addFunction(prefix+ "__mulBy024"); + f.addParam("pEll0", "i32"); + f.addParam("pEllVW", "i32"); + f.addParam("pEllVV", "i32"); + f.addParam("pR", "i32"); // Result in F12 + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("pEll0"); + const x2 = c.getLocal("pEllVV"); + const x4 = c.getLocal("pEllVW"); + + const z0 = c.getLocal("pR"); + const z1 = c.i32_add(c.getLocal("pR"), c.i32_const(2*n8)); + const z2 = c.i32_add(c.getLocal("pR"), c.i32_const(4*n8)); + const z3 = c.i32_add(c.getLocal("pR"), c.i32_const(6*n8)); + const z4 = c.i32_add(c.getLocal("pR"), c.i32_const(8*n8)); + const z5 = c.i32_add(c.getLocal("pR"), c.i32_const(10*n8)); + + const t0 = c.i32_const(module.alloc(f2size)); + const t1 = c.i32_const(module.alloc(f2size)); + const t2 = c.i32_const(module.alloc(f2size)); + const s0 = c.i32_const(module.alloc(f2size)); + const T3 = c.i32_const(module.alloc(f2size)); + const T4 = c.i32_const(module.alloc(f2size)); + const D0 = c.i32_const(module.alloc(f2size)); + const D2 = c.i32_const(module.alloc(f2size)); + const D4 = c.i32_const(module.alloc(f2size)); + const S1 = c.i32_const(module.alloc(f2size)); + const AUX = c.i32_const(module.alloc(f2size)); + + f.addCode( + + // D0 = z0 * x0; + c.call(f2mPrefix + "_mul", z0, x0, D0), + // D2 = z2 * x2; + c.call(f2mPrefix + "_mul", z2, x2, D2), + // D4 = z4 * x4; + c.call(f2mPrefix + "_mul", z4, x4, D4), + // t2 = z0 + z4; + c.call(f2mPrefix + "_add", z0, z4, t2), + // t1 = z0 + z2; + c.call(f2mPrefix + "_add", z0, z2, t1), + // s0 = z1 + z3 + z5; + c.call(f2mPrefix + "_add", z1, z3, s0), + c.call(f2mPrefix + "_add", s0, z5, s0), + + + // For z.a_.a_ = z0. + // S1 = z1 * x2; + c.call(f2mPrefix + "_mul", z1, x2, S1), + // T3 = S1 + D4; + c.call(f2mPrefix + "_add", S1, D4, T3), + // T4 = my_Fp6::non_residue * T3 + D0; + c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), T3, T4), + c.call(f2mPrefix + "_add", T4, D0, z0), + // z0 = T4; + + // For z.a_.b_ = z1 + // T3 = z5 * x4; + c.call(f2mPrefix + "_mul", z5, x4, T3), + // S1 = S1 + T3; + c.call(f2mPrefix + "_add", S1, T3, S1), + // T3 = T3 + D2; + c.call(f2mPrefix + "_add", T3, D2, T3), + // T4 = my_Fp6::non_residue * T3; + c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), T3, T4), + // T3 = z1 * x0; + c.call(f2mPrefix + "_mul", z1, x0, T3), + // S1 = S1 + T3; + c.call(f2mPrefix + "_add", S1, T3, S1), + // T4 = T4 + T3; + c.call(f2mPrefix + "_add", T4, T3, z1), + // z1 = T4; + + + + // For z.a_.c_ = z2 + // t0 = x0 + x2; + c.call(f2mPrefix + "_add", x0, x2, t0), + // T3 = t1 * t0 - D0 - D2; + c.call(f2mPrefix + "_mul", t1, t0, T3), + c.call(f2mPrefix + "_add", D0, D2, AUX), + c.call(f2mPrefix + "_sub", T3, AUX, T3), + // T4 = z3 * x4; + c.call(f2mPrefix + "_mul", z3, x4, T4), + // S1 = S1 + T4; + c.call(f2mPrefix + "_add", S1, T4, S1), + + + // For z.b_.a_ = z3 (z3 needs z2) + // t0 = z2 + z4; + c.call(f2mPrefix + "_add", z2, z4, t0), + // T3 = T3 + T4; + // z2 = T3; + c.call(f2mPrefix + "_add", T3, T4, z2), + // t1 = x2 + x4; + c.call(f2mPrefix + "_add", x2, x4, t1), + // T3 = t0 * t1 - D2 - D4; + c.call(f2mPrefix + "_mul", t1, t0, T3), + c.call(f2mPrefix + "_add", D2, D4, AUX), + c.call(f2mPrefix + "_sub", T3, AUX, T3), + // T4 = my_Fp6::non_residue * T3; + c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), T3, T4), + // T3 = z3 * x0; + c.call(f2mPrefix + "_mul", z3, x0, T3), + // S1 = S1 + T3; + c.call(f2mPrefix + "_add", S1, T3, S1), + // T4 = T4 + T3; + c.call(f2mPrefix + "_add", T4, T3, z3), + // z3 = T4; + + // For z.b_.b_ = z4 + // T3 = z5 * x2; + c.call(f2mPrefix + "_mul", z5, x2, T3), + // S1 = S1 + T3; + c.call(f2mPrefix + "_add", S1, T3, S1), + // T4 = my_Fp6::non_residue * T3; + c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), T3, T4), + // t0 = x0 + x4; + c.call(f2mPrefix + "_add", x0, x4, t0), + // T3 = t2 * t0 - D0 - D4; + c.call(f2mPrefix + "_mul", t2, t0, T3), + c.call(f2mPrefix + "_add", D0, D4, AUX), + c.call(f2mPrefix + "_sub", T3, AUX, T3), + // T4 = T4 + T3; + c.call(f2mPrefix + "_add", T4, T3, z4), + // z4 = T4; + + // For z.b_.c_ = z5. + // t0 = x0 + x2 + x4; + c.call(f2mPrefix + "_add", x0, x2, t0), + c.call(f2mPrefix + "_add", t0, x4, t0), + // T3 = s0 * t0 - S1; + c.call(f2mPrefix + "_mul", s0, t0, T3), + c.call(f2mPrefix + "_sub", T3, S1, z5), + // z5 = T3; + + ); + } + + + function buildMillerLoop() { + const f = module.addFunction(prefix+ "_millerLoop"); + f.addParam("ppreP", "i32"); + f.addParam("ppreQ", "i32"); + f.addParam("r", "i32"); + f.addLocal("pCoef", "i32"); + f.addLocal("i", "i32"); + + const c = f.getCodeBuilder(); + + const preP_PX = c.getLocal("ppreP"); + const preP_PY = c.i32_add(c.getLocal("ppreP"), c.i32_const(f1size)); + + const ELL_0 = c.getLocal("pCoef"); + const ELL_VW = c.i32_add(c.getLocal("pCoef"), c.i32_const(f2size)); + const ELL_VV = c.i32_add(c.getLocal("pCoef"), c.i32_const(2*f2size)); + + + const pVW = module.alloc(f2size); + const VW = c.i32_const(pVW); + const pVV = module.alloc(f2size); + const VV = c.i32_const(pVV); + + const F = c.getLocal("r"); + + + f.addCode( + c.call(ftmPrefix + "_one", F), + + c.setLocal("pCoef", c.i32_add( c.getLocal("ppreQ"), c.i32_const(f2size*3))), + + c.setLocal("i", c.i32_const(ateLoopBitBytes.length-2)), + c.block(c.loop( + + + c.call(ftmPrefix + "_square", F, F), + + c.call(f2mPrefix + "_mul1", ELL_VW,preP_PY, VW), + c.call(f2mPrefix + "_mul1", ELL_VV, preP_PX, VV), + c.call(prefix + "__mulBy024", ELL_0, VW, VV, F), + c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + + c.if( + c.i32_load8_s(c.getLocal("i"), pAteLoopBitBytes), + [ + ...c.call(f2mPrefix + "_mul1", ELL_VW, preP_PY, VW), + ...c.call(f2mPrefix + "_mul1", ELL_VV, preP_PX, VV), + + ...c.call(prefix + "__mulBy024", ELL_0, VW, VV, F), + ...c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + + ] + ), + c.br_if(1, c.i32_eqz ( c.getLocal("i") )), + c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), + c.br(0) + )) + + ); + + f.addCode( + c.call(f2mPrefix + "_mul1", ELL_VW, preP_PY, VW), + c.call(f2mPrefix + "_mul1", ELL_VV, preP_PX, VV), + c.call(prefix + "__mulBy024", ELL_0, VW, VV, F), + c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + + c.call(f2mPrefix + "_mul1", ELL_VW, preP_PY, VW), + c.call(f2mPrefix + "_mul1", ELL_VV, preP_PX, VV), + c.call(prefix + "__mulBy024", ELL_0, VW, VV, F), + c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + + ); + + } + + + function buildFrobeniusMap(n) { + const F12 = [ + [ + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + ], + [ + [1n, 0n], + [8376118865763821496583973867626364092589906065868298776909617916018768340080n, 16469823323077808223889137241176536799009286646108169935659301613961712198316n], + [21888242871839275220042445260109153167277707414472061641714758635765020556617n, 0n], + [11697423496358154304825782922584725312912383441159505038794027105778954184319n, 303847389135065887422783454877609941456349188919719272345083954437860409601n], + [21888242871839275220042445260109153167277707414472061641714758635765020556616n, 0n], + [3321304630594332808241809054958361220322477375291206261884409189760185844239n, 5722266937896532885780051958958348231143373700109372999374820235121374419868n], + [21888242871839275222246405745257275088696311157297823662689037894645226208582n, 0n], + [13512124006075453725662431877630910996106405091429524885779419978626457868503n, 5418419548761466998357268504080738289687024511189653727029736280683514010267n], + [2203960485148121921418603742825762020974279258880205651966n, 0n], + [10190819375481120917420622822672549775783927716138318623895010788866272024264n, 21584395482704209334823622290379665147239961968378104390343953940207365798982n], + [2203960485148121921418603742825762020974279258880205651967n, 0n], + [18566938241244942414004596690298913868373833782006617400804628704885040364344n, 16165975933942742336466353786298926857552937457188450663314217659523851788715n], + ] + ]; + + const F6 = [ + [ + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + ], + [ + [1n, 0n], + [21575463638280843010398324269430826099269044274347216827212613867836435027261n, 10307601595873709700152284273816112264069230130616436755625194854815875713954n], + [21888242871839275220042445260109153167277707414472061641714758635765020556616n, 0n], + [3772000881919853776433695186713858239009073593817195771773381919316419345261n, 2236595495967245188281701248203181795121068902605861227855261137820944008926n], + [2203960485148121921418603742825762020974279258880205651966n, 0n], + [18429021223477853657660792034369865839114504446431234726392080002137598044644n, 9344045779998320333812420223237981029506012124075525679208581902008406485703n], + ], + [ + [1n, 0n], + [2581911344467009335267311115468803099551665605076196740867805258568234346338n, 19937756971775647987995932169929341994314640652964949448313374472400716661030n], + [2203960485148121921418603742825762020974279258880205651966n, 0n], + [5324479202449903542726783395506214481928257762400643279780343368557297135718n, 16208900380737693084919495127334387981393726419856888799917914180988844123039n], + [21888242871839275220042445260109153167277707414472061641714758635765020556616n, 0n], + [13981852324922362344252311234282257507216387789820983642040889267519694726527n, 7629828391165209371577384193250820201684255241773809077146787135900891633097n], + ] + ]; + + const f = module.addFunction(prefix+ "__frobeniusMap"+n); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + for (let i=0; i<6; i++) { + const X = (i==0) ? c.getLocal("x") : c.i32_add(c.getLocal("x"), c.i32_const(i*f2size)); + const Xc0 = X; + const Xc1 = c.i32_add(c.getLocal("x"), c.i32_const(i*f2size + f1size)); + const R = (i==0) ? c.getLocal("r") : c.i32_add(c.getLocal("r"), c.i32_const(i*f2size)); + const Rc0 = R; + const Rc1 = c.i32_add(c.getLocal("r"), c.i32_const(i*f2size + f1size)); + const coef = mul2(F12[Math.floor(i/3)][n%12] , F6[i%3][n%6]); + const pCoef = module.alloc([ + ...utils$2.bigInt2BytesLE(toMontgomery(coef[0]), 32), + ...utils$2.bigInt2BytesLE(toMontgomery(coef[1]), 32), + ]); + if (n%2 == 1) { + f.addCode( + c.call(f1mPrefix + "_copy", Xc0, Rc0), + c.call(f1mPrefix + "_neg", Xc1, Rc1), + c.call(f2mPrefix + "_mul", R, c.i32_const(pCoef), R), + ); + } else { + f.addCode(c.call(f2mPrefix + "_mul", X, c.i32_const(pCoef), R)); + } + } + + function mul2(a, b) { + const ac0 = BigInt(a[0]); + const ac1 = BigInt(a[1]); + const bc0 = BigInt(b[0]); + const bc1 = BigInt(b[1]); + const res = [ + (ac0 * bc0 - ( ac1 * bc1) ) % q, + (ac0 * bc1 + ( ac1 * bc0) ) % q, + ]; + if (isNegative$2(res[0])) res[0] = res[0] + q; + return res; + } + + } + + + + function buildFinalExponentiationFirstChunk() { + + const f = module.addFunction(prefix+ "__finalExponentiationFirstChunk"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const elt = c.getLocal("x"); + const eltC0 = elt; + const eltC1 = c.i32_add(elt, c.i32_const(n8*6)); + const r = c.getLocal("r"); + const pA = module.alloc(ftsize); + const A = c.i32_const(pA); + const Ac0 = A; + const Ac1 = c.i32_const(pA + n8*6); + const B = c.i32_const(module.alloc(ftsize)); + const C = c.i32_const(module.alloc(ftsize)); + const D = c.i32_const(module.alloc(ftsize)); + + f.addCode( + // const alt_bn128_Fq12 A = alt_bn128_Fq12(elt.c0,-elt.c1); + c.call(f6mPrefix + "_copy", eltC0, Ac0), + c.call(f6mPrefix + "_neg", eltC1, Ac1), + + // const alt_bn128_Fq12 B = elt.inverse(); + c.call(ftmPrefix + "_inverse", elt, B), + + // const alt_bn128_Fq12 C = A * B; + c.call(ftmPrefix + "_mul", A, B, C), + // const alt_bn128_Fq12 D = C.Frobenius_map(2); + c.call(prefix + "__frobeniusMap2", C, D), + // const alt_bn128_Fq12 result = D * C; + c.call(ftmPrefix + "_mul", C, D, r), + ); + } + + function buildCyclotomicSquare() { + const f = module.addFunction(prefix+ "__cyclotomicSquare"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x4 = c.i32_add(c.getLocal("x"), c.i32_const(f2size)); + const x3 = c.i32_add(c.getLocal("x"), c.i32_const(2*f2size)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(3*f2size)); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(4*f2size)); + const x5 = c.i32_add(c.getLocal("x"), c.i32_const(5*f2size)); + + const r0 = c.getLocal("r"); + const r4 = c.i32_add(c.getLocal("r"), c.i32_const(f2size)); + const r3 = c.i32_add(c.getLocal("r"), c.i32_const(2*f2size)); + const r2 = c.i32_add(c.getLocal("r"), c.i32_const(3*f2size)); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(4*f2size)); + const r5 = c.i32_add(c.getLocal("r"), c.i32_const(5*f2size)); + + const t0 = c.i32_const(module.alloc(f2size)); + const t1 = c.i32_const(module.alloc(f2size)); + const t2 = c.i32_const(module.alloc(f2size)); + const t3 = c.i32_const(module.alloc(f2size)); + const t4 = c.i32_const(module.alloc(f2size)); + const t5 = c.i32_const(module.alloc(f2size)); + const tmp = c.i32_const(module.alloc(f2size)); + const AUX = c.i32_const(module.alloc(f2size)); + + + f.addCode( + // // t0 + t1*y = (z0 + z1*y)^2 = a^2 + // tmp = z0 * z1; + // t0 = (z0 + z1) * (z0 + my_Fp6::non_residue * z1) - tmp - my_Fp6::non_residue * tmp; + // t1 = tmp + tmp; + c.call(f2mPrefix + "_mul", x0, x1, tmp), + c.call(f2mPrefix + "_mul", x1, c.i32_const(pNonResidueF6), t0), + c.call(f2mPrefix + "_add", x0, t0, t0), + c.call(f2mPrefix + "_add", x0, x1, AUX), + c.call(f2mPrefix + "_mul", AUX, t0, t0), + c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), tmp, AUX), + c.call(f2mPrefix + "_add", tmp, AUX, AUX), + c.call(f2mPrefix + "_sub", t0, AUX, t0), + c.call(f2mPrefix + "_add", tmp, tmp, t1), + + // // t2 + t3*y = (z2 + z3*y)^2 = b^2 + // tmp = z2 * z3; + // t2 = (z2 + z3) * (z2 + my_Fp6::non_residue * z3) - tmp - my_Fp6::non_residue * tmp; + // t3 = tmp + tmp; + c.call(f2mPrefix + "_mul", x2, x3, tmp), + c.call(f2mPrefix + "_mul", x3, c.i32_const(pNonResidueF6), t2), + c.call(f2mPrefix + "_add", x2, t2, t2), + c.call(f2mPrefix + "_add", x2, x3, AUX), + c.call(f2mPrefix + "_mul", AUX, t2, t2), + c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), tmp, AUX), + c.call(f2mPrefix + "_add", tmp, AUX, AUX), + c.call(f2mPrefix + "_sub", t2, AUX, t2), + c.call(f2mPrefix + "_add", tmp, tmp, t3), + + // // t4 + t5*y = (z4 + z5*y)^2 = c^2 + // tmp = z4 * z5; + // t4 = (z4 + z5) * (z4 + my_Fp6::non_residue * z5) - tmp - my_Fp6::non_residue * tmp; + // t5 = tmp + tmp; + c.call(f2mPrefix + "_mul", x4, x5, tmp), + c.call(f2mPrefix + "_mul", x5, c.i32_const(pNonResidueF6), t4), + c.call(f2mPrefix + "_add", x4, t4, t4), + c.call(f2mPrefix + "_add", x4, x5, AUX), + c.call(f2mPrefix + "_mul", AUX, t4, t4), + c.call(f2mPrefix + "_mul", c.i32_const(pNonResidueF6), tmp, AUX), + c.call(f2mPrefix + "_add", tmp, AUX, AUX), + c.call(f2mPrefix + "_sub", t4, AUX, t4), + c.call(f2mPrefix + "_add", tmp, tmp, t5), + + // For A + // z0 = 3 * t0 - 2 * z0 + c.call(f2mPrefix + "_sub", t0, x0, r0), + c.call(f2mPrefix + "_add", r0, r0, r0), + c.call(f2mPrefix + "_add", t0, r0, r0), + // z1 = 3 * t1 + 2 * z1 + c.call(f2mPrefix + "_add", t1, x1, r1), + c.call(f2mPrefix + "_add", r1, r1, r1), + c.call(f2mPrefix + "_add", t1, r1, r1), + + // For B + // z2 = 3 * (xi * t5) + 2 * z2 + c.call(f2mPrefix + "_mul", t5, c.i32_const(pAltBn128Twist), AUX), + c.call(f2mPrefix + "_add", AUX, x2, r2), + c.call(f2mPrefix + "_add", r2, r2, r2), + c.call(f2mPrefix + "_add", AUX, r2, r2), + // z3 = 3 * t4 - 2 * z3 + c.call(f2mPrefix + "_sub", t4, x3, r3), + c.call(f2mPrefix + "_add", r3, r3, r3), + c.call(f2mPrefix + "_add", t4, r3, r3), + + // For C + // z4 = 3 * t2 - 2 * z4 + c.call(f2mPrefix + "_sub", t2, x4, r4), + c.call(f2mPrefix + "_add", r4, r4, r4), + c.call(f2mPrefix + "_add", t2, r4, r4), + // z5 = 3 * t3 + 2 * z5 + c.call(f2mPrefix + "_add", t3, x5, r5), + c.call(f2mPrefix + "_add", r5, r5, r5), + c.call(f2mPrefix + "_add", t3, r5, r5), + + ); + } + + + function buildCyclotomicExp(exponent, fnName) { + const exponentNafBytes = naf(exponent).map( (b) => (b==-1 ? 0xFF: b) ); + const pExponentNafBytes = module.alloc(exponentNafBytes); + + const f = module.addFunction(prefix+ "__cyclotomicExp_"+fnName); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + f.addLocal("bit", "i32"); + f.addLocal("i", "i32"); + + const c = f.getCodeBuilder(); + + const x = c.getLocal("x"); + + const res = c.getLocal("r"); + + const inverse = c.i32_const(module.alloc(ftsize)); + + + f.addCode( + c.call(ftmPrefix + "_conjugate", x, inverse), + c.call(ftmPrefix + "_one", res), + + c.if( + c.teeLocal("bit", c.i32_load8_s(c.i32_const(exponentNafBytes.length-1), pExponentNafBytes)), + c.if( + c.i32_eq( + c.getLocal("bit"), + c.i32_const(1) + ), + c.call(ftmPrefix + "_mul", res, x, res), + c.call(ftmPrefix + "_mul", res, inverse, res), + ) + ), + + c.setLocal("i", c.i32_const(exponentNafBytes.length-2)), + c.block(c.loop( + c.call(prefix + "__cyclotomicSquare", res, res), + c.if( + c.teeLocal("bit", c.i32_load8_s(c.getLocal("i"), pExponentNafBytes)), + c.if( + c.i32_eq( + c.getLocal("bit"), + c.i32_const(1) + ), + c.call(ftmPrefix + "_mul", res, x, res), + c.call(ftmPrefix + "_mul", res, inverse, res), + ) + ), + c.br_if(1, c.i32_eqz ( c.getLocal("i") )), + c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), + c.br(0) + )) + ); + } + + + + function buildFinalExponentiationLastChunk() { + buildCyclotomicSquare(); + buildCyclotomicExp(finalExpZ, "w0"); + + const f = module.addFunction(prefix+ "__finalExponentiationLastChunk"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const elt = c.getLocal("x"); + const result = c.getLocal("r"); + const A = c.i32_const(module.alloc(ftsize)); + const B = c.i32_const(module.alloc(ftsize)); + const C = c.i32_const(module.alloc(ftsize)); + const D = c.i32_const(module.alloc(ftsize)); + const E = c.i32_const(module.alloc(ftsize)); + const F = c.i32_const(module.alloc(ftsize)); + const G = c.i32_const(module.alloc(ftsize)); + const H = c.i32_const(module.alloc(ftsize)); + const I = c.i32_const(module.alloc(ftsize)); + const J = c.i32_const(module.alloc(ftsize)); + const K = c.i32_const(module.alloc(ftsize)); + const L = c.i32_const(module.alloc(ftsize)); + const M = c.i32_const(module.alloc(ftsize)); + const N = c.i32_const(module.alloc(ftsize)); + const O = c.i32_const(module.alloc(ftsize)); + const P = c.i32_const(module.alloc(ftsize)); + const Q = c.i32_const(module.alloc(ftsize)); + const R = c.i32_const(module.alloc(ftsize)); + const S = c.i32_const(module.alloc(ftsize)); + const T = c.i32_const(module.alloc(ftsize)); + const U = c.i32_const(module.alloc(ftsize)); + + f.addCode( + + + // A = exp_by_neg_z(elt) // = elt^(-z) + c.call(prefix + "__cyclotomicExp_w0", elt, A), + c.call(ftmPrefix + "_conjugate", A, A), + // B = A^2 // = elt^(-2*z) + c.call(prefix + "__cyclotomicSquare", A, B), + // C = B^2 // = elt^(-4*z) + c.call(prefix + "__cyclotomicSquare", B, C), + // D = C * B // = elt^(-6*z) + c.call(ftmPrefix + "_mul", C, B, D), + // E = exp_by_neg_z(D) // = elt^(6*z^2) + c.call(prefix + "__cyclotomicExp_w0", D, E), + c.call(ftmPrefix + "_conjugate", E, E), + // F = E^2 // = elt^(12*z^2) + c.call(prefix + "__cyclotomicSquare", E, F), + // G = epx_by_neg_z(F) // = elt^(-12*z^3) + c.call(prefix + "__cyclotomicExp_w0", F, G), + c.call(ftmPrefix + "_conjugate", G, G), + // H = conj(D) // = elt^(6*z) + c.call(ftmPrefix + "_conjugate", D, H), + // I = conj(G) // = elt^(12*z^3) + c.call(ftmPrefix + "_conjugate", G, I), + // J = I * E // = elt^(12*z^3 + 6*z^2) + c.call(ftmPrefix + "_mul", I, E, J), + // K = J * H // = elt^(12*z^3 + 6*z^2 + 6*z) + c.call(ftmPrefix + "_mul", J, H, K), + // L = K * B // = elt^(12*z^3 + 6*z^2 + 4*z) + c.call(ftmPrefix + "_mul", K, B, L), + // M = K * E // = elt^(12*z^3 + 12*z^2 + 6*z) + c.call(ftmPrefix + "_mul", K, E, M), + + // N = M * elt // = elt^(12*z^3 + 12*z^2 + 6*z + 1) + c.call(ftmPrefix + "_mul", M, elt, N), + + // O = L.Frobenius_map(1) // = elt^(q*(12*z^3 + 6*z^2 + 4*z)) + c.call(prefix + "__frobeniusMap1", L, O), + // P = O * N // = elt^(q*(12*z^3 + 6*z^2 + 4*z) * (12*z^3 + 12*z^2 + 6*z + 1)) + c.call(ftmPrefix + "_mul", O, N, P), + // Q = K.Frobenius_map(2) // = elt^(q^2 * (12*z^3 + 6*z^2 + 6*z)) + c.call(prefix + "__frobeniusMap2", K, Q), + // R = Q * P // = elt^(q^2 * (12*z^3 + 6*z^2 + 6*z) + q*(12*z^3 + 6*z^2 + 4*z) * (12*z^3 + 12*z^2 + 6*z + 1)) + c.call(ftmPrefix + "_mul", Q, P, R), + // S = conj(elt) // = elt^(-1) + c.call(ftmPrefix + "_conjugate", elt, S), + // T = S * L // = elt^(12*z^3 + 6*z^2 + 4*z - 1) + c.call(ftmPrefix + "_mul", S, L, T), + // U = T.Frobenius_map(3) // = elt^(q^3(12*z^3 + 6*z^2 + 4*z - 1)) + c.call(prefix + "__frobeniusMap3", T, U), + // V = U * R // = elt^(q^3(12*z^3 + 6*z^2 + 4*z - 1) + q^2 * (12*z^3 + 6*z^2 + 6*z) + q*(12*z^3 + 6*z^2 + 4*z) * (12*z^3 + 12*z^2 + 6*z + 1)) + c.call(ftmPrefix + "_mul", U, R, result), + // result = V + ); + } + + + function buildFinalExponentiation() { + buildFinalExponentiationFirstChunk(); + buildFinalExponentiationLastChunk(); + const f = module.addFunction(prefix+ "_finalExponentiation"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const elt = c.getLocal("x"); + const result = c.getLocal("r"); + const eltToFirstChunk = c.i32_const(module.alloc(ftsize)); + + f.addCode( + c.call(prefix + "__finalExponentiationFirstChunk", elt, eltToFirstChunk ), + c.call(prefix + "__finalExponentiationLastChunk", eltToFirstChunk, result ) + ); + } + + + function buildFinalExponentiationOld() { + const f = module.addFunction(prefix+ "_finalExponentiationOld"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const exponent = 552484233613224096312617126783173147097382103762957654188882734314196910839907541213974502761540629817009608548654680343627701153829446747810907373256841551006201639677726139946029199968412598804882391702273019083653272047566316584365559776493027495458238373902875937659943504873220554161550525926302303331747463515644711876653177129578303191095900909191624817826566688241804408081892785725967931714097716709526092261278071952560171111444072049229123565057483750161460024353346284167282452756217662335528813519139808291170539072125381230815729071544861602750936964829313608137325426383735122175229541155376346436093930287402089517426973178917569713384748081827255472576937471496195752727188261435633271238710131736096299798168852925540549342330775279877006784354801422249722573783561685179618816480037695005515426162362431072245638324744480n; + + const pExponent = module.alloc(utils$2.bigInt2BytesLE( exponent, 352 )); + + const c = f.getCodeBuilder(); + + f.addCode( + c.call(ftmPrefix + "_exp", c.getLocal("x"), c.i32_const(pExponent), c.i32_const(352), c.getLocal("r")), + ); + } + + + + + const pPreP = module.alloc(prePSize); + const pPreQ = module.alloc(preQSize); + + function buildPairingEquation(nPairings) { + + const f = module.addFunction(prefix+ "_pairingEq"+nPairings); + for (let i=0; i acc + ( b!=0 ? 1 : 0) ,0); + const ateNCoefs = ateNAddCoefs + ateNDblCoefs + 1; + const prePSize = 3*2*n8q; + const preQSize = 3*n8q*2 + ateNCoefs*ateCoefSize; + const finalExpIsNegative = true; + + const finalExpZ = 15132376222941642752n; + + + module.modules[prefix] = { + n64q: n64q, + n64r: n64r, + n8q: n8q, + n8r: n8r, + pG1gen: pG1gen, + pG1zero: pG1zero, + pG1b: pG1b, + pG2gen: pG2gen, + pG2zero: pG2zero, + pG2b: pG2b, + pq: module.modules["f1m"].pq, + pr: pr, + pOneT: pOneT, + r: r, + q: q, + prePSize: prePSize, + preQSize: preQSize + }; + + + function naf(n) { + let E = n; + const res = []; + while (E > 0n) { + if (isOdd(E)) { + const z = 2 - Number(E % 4n); + res.push( z ); + E = E - BigInt(z); + } else { + res.push( 0 ); + } + E = E >> 1n; + } + return res; + } + + function bits(n) { + let E = n; + const res = []; + while (E > 0n) { + if (isOdd(E)) { + res.push( 1 ); + } else { + res.push( 0 ); + } + E = E >> 1n; + } + return res; + } + + function buildPrepareG1() { + const f = module.addFunction(prefix+ "_prepareG1"); + f.addParam("pP", "i32"); + f.addParam("ppreP", "i32"); + + const c = f.getCodeBuilder(); + + f.addCode( + c.call(g1mPrefix + "_normalize", c.getLocal("pP"), c.getLocal("ppreP")), // TODO Remove if already in affine + ); + } + + + + function buildPrepDoubleStep() { + const f = module.addFunction(prefix+ "_prepDblStep"); + f.addParam("R", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const Rx = c.getLocal("R"); + const Ry = c.i32_add(c.getLocal("R"), c.i32_const(2*n8q)); + const Rz = c.i32_add(c.getLocal("R"), c.i32_const(4*n8q)); + + const t0 = c.getLocal("r"); + const t3 = c.i32_add(c.getLocal("r"), c.i32_const(2*n8q)); + const t6 = c.i32_add(c.getLocal("r"), c.i32_const(4*n8q)); + + + const zsquared = c.i32_const(module.alloc(f2size)); + const t1 = c.i32_const(module.alloc(f2size)); + const t2 = c.i32_const(module.alloc(f2size)); + const t4 = c.i32_const(module.alloc(f2size)); + const t5 = c.i32_const(module.alloc(f2size)); + + f.addCode( + + // tmp0 = r.x.square(); + c.call(f2mPrefix + "_square", Rx, t0), + + // tmp1 = r.y.square(); + c.call(f2mPrefix + "_square", Ry, t1), + + // tmp2 = tmp1.square(); + c.call(f2mPrefix + "_square", t1, t2), + + // tmp3 = (tmp1 + r.x).square() - tmp0 - tmp2; + c.call(f2mPrefix + "_add", t1, Rx, t3), + c.call(f2mPrefix + "_square", t3, t3), + c.call(f2mPrefix + "_sub", t3, t0, t3), + c.call(f2mPrefix + "_sub", t3, t2, t3), + + // tmp3 = tmp3 + tmp3; + c.call(f2mPrefix + "_add", t3, t3, t3), + + // tmp4 = tmp0 + tmp0 + tmp0; + c.call(f2mPrefix + "_add", t0, t0, t4), + c.call(f2mPrefix + "_add", t4, t0, t4), + + // tmp6 = r.x + tmp4; + c.call(f2mPrefix + "_add", Rx, t4, t6), + + // tmp5 = tmp4.square(); + c.call(f2mPrefix + "_square", t4, t5), + + // zsquared = r.z.square(); + c.call(f2mPrefix + "_square", Rz, zsquared), + + // r.x = tmp5 - tmp3 - tmp3; + c.call(f2mPrefix + "_sub", t5, t3, Rx), + c.call(f2mPrefix + "_sub", Rx, t3, Rx), + + // r.z = (r.z + r.y).square() - tmp1 - zsquared; + c.call(f2mPrefix + "_add", Rz, Ry, Rz), + c.call(f2mPrefix + "_square", Rz, Rz), + c.call(f2mPrefix + "_sub", Rz, t1, Rz), + c.call(f2mPrefix + "_sub", Rz, zsquared, Rz), + + // r.y = (tmp3 - r.x) * tmp4; + c.call(f2mPrefix + "_sub", t3, Rx, Ry), + c.call(f2mPrefix + "_mul", Ry, t4, Ry), + + // tmp2 = tmp2 + tmp2; + c.call(f2mPrefix + "_add", t2, t2, t2), + + // tmp2 = tmp2 + tmp2; + c.call(f2mPrefix + "_add", t2, t2, t2), + + // tmp2 = tmp2 + tmp2; + c.call(f2mPrefix + "_add", t2, t2, t2), + + // r.y -= tmp2; + c.call(f2mPrefix + "_sub", Ry, t2, Ry), + + // tmp3 = tmp4 * zsquared; + c.call(f2mPrefix + "_mul", t4, zsquared, t3), + + // tmp3 = tmp3 + tmp3; + c.call(f2mPrefix + "_add", t3, t3, t3), + + // tmp3 = -tmp3; + c.call(f2mPrefix + "_neg", t3, t3), + + // tmp6 = tmp6.square() - tmp0 - tmp5; + c.call(f2mPrefix + "_square", t6, t6), + c.call(f2mPrefix + "_sub", t6, t0, t6), + c.call(f2mPrefix + "_sub", t6, t5, t6), + + // tmp1 = tmp1 + tmp1; + c.call(f2mPrefix + "_add", t1, t1, t1), + + // tmp1 = tmp1 + tmp1; + c.call(f2mPrefix + "_add", t1, t1, t1), + + // tmp6 = tmp6 - tmp1; + c.call(f2mPrefix + "_sub", t6, t1, t6), + + // tmp0 = r.z * zsquared; + c.call(f2mPrefix + "_mul", Rz, zsquared, t0), + + // tmp0 = tmp0 + tmp0; + c.call(f2mPrefix + "_add", t0, t0, t0), + + ); + } + + function buildPrepAddStep() { + const f = module.addFunction(prefix+ "_prepAddStep"); + f.addParam("R", "i32"); + f.addParam("Q", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const Rx = c.getLocal("R"); + const Ry = c.i32_add(c.getLocal("R"), c.i32_const(2*n8q)); + const Rz = c.i32_add(c.getLocal("R"), c.i32_const(4*n8q)); + + const Qx = c.getLocal("Q"); + const Qy = c.i32_add(c.getLocal("Q"), c.i32_const(2*n8q)); + + const t10 = c.getLocal("r"); + const t1 = c.i32_add(c.getLocal("r"), c.i32_const(2*n8q)); + const t9 = c.i32_add(c.getLocal("r"), c.i32_const(4*n8q)); + + const zsquared = c.i32_const(module.alloc(f2size)); + const ysquared = c.i32_const(module.alloc(f2size)); + const ztsquared = c.i32_const(module.alloc(f2size)); + const t0 = c.i32_const(module.alloc(f2size)); + const t2 = c.i32_const(module.alloc(f2size)); + const t3 = c.i32_const(module.alloc(f2size)); + const t4 = c.i32_const(module.alloc(f2size)); + const t5 = c.i32_const(module.alloc(f2size)); + const t6 = c.i32_const(module.alloc(f2size)); + const t7 = c.i32_const(module.alloc(f2size)); + const t8 = c.i32_const(module.alloc(f2size)); + + f.addCode( + + // zsquared = r.z.square(); + c.call(f2mPrefix + "_square", Rz, zsquared), + + // ysquared = q.y.square(); + c.call(f2mPrefix + "_square", Qy, ysquared), + + // t0 = zsquared * q.x; + c.call(f2mPrefix + "_mul", zsquared, Qx, t0), + + // t1 = ((q.y + r.z).square() - ysquared - zsquared) * zsquared; + c.call(f2mPrefix + "_add", Qy, Rz, t1), + c.call(f2mPrefix + "_square", t1, t1), + c.call(f2mPrefix + "_sub", t1, ysquared, t1), + c.call(f2mPrefix + "_sub", t1, zsquared, t1), + c.call(f2mPrefix + "_mul", t1, zsquared, t1), + + // t2 = t0 - r.x; + c.call(f2mPrefix + "_sub", t0, Rx, t2), + + // t3 = t2.square(); + c.call(f2mPrefix + "_square", t2, t3), + + // t4 = t3 + t3; + c.call(f2mPrefix + "_add", t3, t3, t4), + + // t4 = t4 + t4; + c.call(f2mPrefix + "_add", t4, t4, t4), + + // t5 = t4 * t2; + c.call(f2mPrefix + "_mul", t4, t2, t5), + + // t6 = t1 - r.y - r.y; + c.call(f2mPrefix + "_sub", t1, Ry, t6), + c.call(f2mPrefix + "_sub", t6, Ry, t6), + + // t9 = t6 * q.x; + c.call(f2mPrefix + "_mul", t6, Qx, t9), + + // t7 = t4 * r.x; + c.call(f2mPrefix + "_mul", t4, Rx, t7), + + // r.x = t6.square() - t5 - t7 - t7; + c.call(f2mPrefix + "_square", t6, Rx), + c.call(f2mPrefix + "_sub", Rx, t5, Rx), + c.call(f2mPrefix + "_sub", Rx, t7, Rx), + c.call(f2mPrefix + "_sub", Rx, t7, Rx), + + // r.z = (r.z + t2).square() - zsquared - t3; + c.call(f2mPrefix + "_add", Rz, t2, Rz), + c.call(f2mPrefix + "_square", Rz, Rz), + c.call(f2mPrefix + "_sub", Rz, zsquared, Rz), + c.call(f2mPrefix + "_sub", Rz, t3, Rz), + + // t10 = q.y + r.z; + c.call(f2mPrefix + "_add", Qy, Rz, t10), + + // t8 = (t7 - r.x) * t6; + c.call(f2mPrefix + "_sub", t7, Rx, t8), + c.call(f2mPrefix + "_mul", t8, t6, t8), + + // t0 = r.y * t5; + c.call(f2mPrefix + "_mul", Ry, t5, t0), + + // t0 = t0 + t0; + c.call(f2mPrefix + "_add", t0, t0, t0), + + // r.y = t8 - t0; + c.call(f2mPrefix + "_sub", t8, t0, Ry), + + // t10 = t10.square() - ysquared; + c.call(f2mPrefix + "_square", t10, t10), + c.call(f2mPrefix + "_sub", t10, ysquared, t10), + + // ztsquared = r.z.square(); + c.call(f2mPrefix + "_square", Rz, ztsquared), + + // t10 = t10 - ztsquared; + c.call(f2mPrefix + "_sub", t10, ztsquared, t10), + + // t9 = t9 + t9 - t10; + c.call(f2mPrefix + "_add", t9, t9, t9), + c.call(f2mPrefix + "_sub", t9, t10, t9), + + // t10 = r.z + r.z; + c.call(f2mPrefix + "_add", Rz, Rz, t10), + + // t6 = -t6; + c.call(f2mPrefix + "_neg", t6, t6), + + // t1 = t6 + t6; + c.call(f2mPrefix + "_add", t6, t6, t1), + ); + } + + + function buildPrepareG2() { + const f = module.addFunction(prefix+ "_prepareG2"); + f.addParam("pQ", "i32"); + f.addParam("ppreQ", "i32"); + f.addLocal("pCoef", "i32"); + f.addLocal("i", "i32"); + + const c = f.getCodeBuilder(); + + + const Q = c.getLocal("pQ"); + + const pR = module.alloc(f2size*3); + const R = c.i32_const(pR); + + const base = c.getLocal("ppreQ"); + + f.addCode( + c.call(g2mPrefix + "_normalize", Q, base), + c.if( + c.call(g2mPrefix + "_isZero", base), + c.ret([]) + ), + c.call(g2mPrefix + "_copy", base, R), + c.setLocal("pCoef", c.i32_add(c.getLocal("ppreQ"), c.i32_const(f2size*3))), + ); + + f.addCode( + c.setLocal("i", c.i32_const(ateLoopBitBytes.length-2)), + c.block(c.loop( + + c.call(prefix + "_prepDblStep", R, c.getLocal("pCoef")), + c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + + c.if( + c.i32_load8_s(c.getLocal("i"), pAteLoopBitBytes), + [ + ...c.call(prefix + "_prepAddStep", R, base, c.getLocal("pCoef")), + ...c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + ] + ), + c.br_if(1, c.i32_eqz ( c.getLocal("i") )), + c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), + c.br(0) + )) + ); + } + + + function buildF6Mul1() { + const f = module.addFunction(f6mPrefix+ "_mul1"); + f.addParam("pA", "i32"); // F6 + f.addParam("pC1", "i32"); // F2 + f.addParam("pR", "i32"); // F6 + + const c = f.getCodeBuilder(); + + const A_c0 = c.getLocal("pA"); + const A_c1 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*2)); + const A_c2 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*4)); + + const c1 = c.getLocal("pC1"); + + const t1 = c.getLocal("pR"); + const t2 = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*2)); + const b_b = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*4)); + + const Ac0_Ac1 = c.i32_const(module.alloc(f1size*2)); + const Ac1_Ac2 = c.i32_const(module.alloc(f1size*2)); + + f.addCode( + + c.call(f2mPrefix + "_add", A_c0, A_c1, Ac0_Ac1), + c.call(f2mPrefix + "_add", A_c1, A_c2, Ac1_Ac2), + + // let b_b = self.c1 * c1; + c.call(f2mPrefix + "_mul", A_c1, c1, b_b), + + // let t1 = (self.c1 + self.c2) * c1 - b_b; + c.call(f2mPrefix + "_mul", Ac1_Ac2, c1, t1), + c.call(f2mPrefix + "_sub", t1, b_b, t1), + + // let t1 = t1.mul_by_nonresidue(); + c.call(f2mPrefix + "_mulNR", t1, t1), + + // let t2 = (self.c0 + self.c1) * c1 - b_b; + c.call(f2mPrefix + "_mul", Ac0_Ac1, c1, t2), + c.call(f2mPrefix + "_sub", t2, b_b, t2), + ); + } + buildF6Mul1(); + + function buildF6Mul01() { + const f = module.addFunction(f6mPrefix+ "_mul01"); + f.addParam("pA", "i32"); // F6 + f.addParam("pC0", "i32"); // F2 + f.addParam("pC1", "i32"); // F2 + f.addParam("pR", "i32"); // F6 + + const c = f.getCodeBuilder(); + + const A_c0 = c.getLocal("pA"); + const A_c1 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*2)); + const A_c2 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*4)); + + const c0 = c.getLocal("pC0"); + const c1 = c.getLocal("pC1"); + + const t1 = c.getLocal("pR"); + const t2 = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*2)); + const t3 = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*4)); + + const a_a = c.i32_const(module.alloc(f1size*2)); + const b_b = c.i32_const(module.alloc(f1size*2)); + const Ac0_Ac1 = c.i32_const(module.alloc(f1size*2)); + const Ac0_Ac2 = c.i32_const(module.alloc(f1size*2)); + + f.addCode( + // let a_a = self.c0 * c0; + c.call(f2mPrefix + "_mul", A_c0, c0, a_a), + + // let b_b = self.c1 * c1; + c.call(f2mPrefix + "_mul", A_c1, c1, b_b), + + + c.call(f2mPrefix + "_add", A_c0, A_c1, Ac0_Ac1), + c.call(f2mPrefix + "_add", A_c0, A_c2, Ac0_Ac2), + + // let t1 = (self.c1 + self.c2) * c1 - b_b; + c.call(f2mPrefix + "_add", A_c1, A_c2, t1), + c.call(f2mPrefix + "_mul", t1, c1, t1), + c.call(f2mPrefix + "_sub", t1, b_b, t1), + + // let t1 = t1.mul_by_nonresidue() + a_a; + c.call(f2mPrefix + "_mulNR", t1, t1), + c.call(f2mPrefix + "_add", t1, a_a, t1), + + // let t2 = (c0 + c1) * (self.c0 + self.c1) - a_a - b_b; + c.call(f2mPrefix + "_add", c0, c1, t2), + c.call(f2mPrefix + "_mul", t2, Ac0_Ac1, t2), + c.call(f2mPrefix + "_sub", t2, a_a, t2), + c.call(f2mPrefix + "_sub", t2, b_b, t2), + + // let t3 = (self.c0 + self.c2) * c0 - a_a + b_b; + c.call(f2mPrefix + "_mul", Ac0_Ac2, c0, t3), + c.call(f2mPrefix + "_sub", t3, a_a, t3), + c.call(f2mPrefix + "_add", t3, b_b, t3), + + + ); + } + buildF6Mul01(); + + + function buildF12Mul014() { + + const f = module.addFunction(ftmPrefix+ "_mul014"); + f.addParam("pA", "i32"); // F12 + f.addParam("pC0", "i32"); // F2 + f.addParam("pC1", "i32"); // F2 + f.addParam("pC4", "i32"); // F2 + f.addParam("pR", "i32"); // F12 + + const c = f.getCodeBuilder(); + + + const A_c0 = c.getLocal("pA"); + const A_c1 = c.i32_add(c.getLocal("pA"), c.i32_const(f1size*6)); + + const c0 = c.getLocal("pC0"); + const c1 = c.getLocal("pC1"); + const c4 = c.getLocal("pC4"); + + const aa = c.i32_const(module.alloc(f1size*6)); + const bb = c.i32_const(module.alloc(f1size*6)); + const o = c.i32_const(module.alloc(f1size*2)); + + const R_c0 = c.getLocal("pR"); + const R_c1 = c.i32_add(c.getLocal("pR"), c.i32_const(f1size*6)); + + f.addCode( + // let aa = self.c0.mul_by_01(c0, c1); + c.call(f6mPrefix + "_mul01", A_c0, c0, c1, aa), + + // let bb = self.c1.mul_by_1(c4); + c.call(f6mPrefix + "_mul1", A_c1, c4, bb), + + // let o = c1 + c4; + c.call(f2mPrefix + "_add", c1, c4, o), + + // let c1 = self.c1 + self.c0; + c.call(f6mPrefix + "_add", A_c1, A_c0, R_c1), + + // let c1 = c1.mul_by_01(c0, &o); + c.call(f6mPrefix + "_mul01", R_c1, c0, o, R_c1), + + // let c1 = c1 - aa - bb; + c.call(f6mPrefix + "_sub", R_c1, aa, R_c1), + c.call(f6mPrefix + "_sub", R_c1, bb, R_c1), + + // let c0 = bb; + c.call(f6mPrefix + "_copy", bb, R_c0), + + // let c0 = c0.mul_by_nonresidue(); + c.call(f6mPrefix + "_mulNR", R_c0, R_c0), + + // let c0 = c0 + aa; + c.call(f6mPrefix + "_add", R_c0, aa, R_c0), + ); + } + buildF12Mul014(); + + + function buildELL() { + const f = module.addFunction(prefix+ "_ell"); + f.addParam("pP", "i32"); + f.addParam("pCoefs", "i32"); + f.addParam("pF", "i32"); + + const c = f.getCodeBuilder(); + + const Px = c.getLocal("pP"); + const Py = c.i32_add(c.getLocal("pP"), c.i32_const(n8q)); + + const F = c.getLocal("pF"); + + const coef0_0 = c.getLocal("pCoefs"); + const coef0_1 = c.i32_add(c.getLocal("pCoefs"), c.i32_const(f1size)); + const coef1_0 = c.i32_add(c.getLocal("pCoefs"), c.i32_const(f1size*2)); + const coef1_1 = c.i32_add(c.getLocal("pCoefs"), c.i32_const(f1size*3)); + const coef2 = c.i32_add(c.getLocal("pCoefs"), c.i32_const(f1size*4)); + + const pc0 = module.alloc(f1size*2); + const c0 = c.i32_const(pc0); + const c0_c0 = c.i32_const(pc0); + const c0_c1 = c.i32_const(pc0+f1size); + + const pc1 = module.alloc(f1size*2); + const c1 = c.i32_const(pc1); + const c1_c0 = c.i32_const(pc1); + const c1_c1 = c.i32_const(pc1+f1size); + f.addCode( + // let mut c0 = coeffs.0; + // let mut c1 = coeffs.1; + // + // c0.c0 *= p.y; + // c0.c1 *= p.y; + // + // c1.c0 *= p.x; + // c1.c1 *= p.x; + // + // f.mul_by_014(&coeffs.2, &c1, &c0) + + c.call(f1mPrefix + "_mul", coef0_0, Py, c0_c0), + c.call(f1mPrefix + "_mul", coef0_1, Py, c0_c1), + c.call(f1mPrefix + "_mul", coef1_0, Px, c1_c0), + c.call(f1mPrefix + "_mul", coef1_1, Px, c1_c1), + + c.call(ftmPrefix + "_mul014", F, coef2, c1, c0, F), + + ); + + } + buildELL(); + + function buildMillerLoop() { + const f = module.addFunction(prefix+ "_millerLoop"); + f.addParam("ppreP", "i32"); + f.addParam("ppreQ", "i32"); + f.addParam("r", "i32"); + f.addLocal("pCoef", "i32"); + f.addLocal("i", "i32"); + + const c = f.getCodeBuilder(); + + const preP = c.getLocal("ppreP"); + + const coefs = c.getLocal("pCoef"); + + const F = c.getLocal("r"); + + + f.addCode( + c.call(ftmPrefix + "_one", F), + + c.if( + c.call(g1mPrefix + "_isZero", preP), + c.ret([]) + ), + c.if( + c.call(g1mPrefix + "_isZero", c.getLocal("ppreQ")), + c.ret([]) + ), + c.setLocal("pCoef", c.i32_add( c.getLocal("ppreQ"), c.i32_const(f2size*3))), + + c.setLocal("i", c.i32_const(ateLoopBitBytes.length-2)), + c.block(c.loop( + + + c.call(prefix + "_ell", preP, coefs, F), + c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + + c.if( + c.i32_load8_s(c.getLocal("i"), pAteLoopBitBytes), + [ + ...c.call(prefix + "_ell", preP, coefs, F), + ...c.setLocal("pCoef", c.i32_add(c.getLocal("pCoef"), c.i32_const(ateCoefSize))), + ] + ), + c.call(ftmPrefix + "_square", F, F), + + c.br_if(1, c.i32_eq ( c.getLocal("i"), c.i32_const(1) )), + c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), + c.br(0) + )), + c.call(prefix + "_ell", preP, coefs, F), + + ); + + + { + f.addCode( + c.call(ftmPrefix + "_conjugate", F, F), + ); + } + } + + + function buildFrobeniusMap(n) { + const F12 = [ + [ + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + ], + [ + [1n, 0n], + [3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760n, 151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027n], + [793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351n, 0n], + [2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n, 1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257n], + [793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n, 0n], + [3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557n, 877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230n], + [4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786n, 0n], + [151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027n, 3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760n], + [4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n, 0n], + [1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257n, 2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n], + [4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437n, 0n], + [877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230n, 3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557n], + ] + ]; + + const F6 = [ + [ + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + [1n, 0n], + ], + [ + [1n, 0n], + [0n, 4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n], + [793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n, 0n], + [0n, 1n], + [4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n, 0n], + [0n, 793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n], + ], + [ + [1n, 0n], + [4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437n, 0n], + [4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n, 0n], + [4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786n, 0n], + [793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n, 0n], + [793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351n, 0n], + ] + ]; + + const f = module.addFunction(ftmPrefix + "_frobeniusMap"+n); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + for (let i=0; i<6; i++) { + const X = (i==0) ? c.getLocal("x") : c.i32_add(c.getLocal("x"), c.i32_const(i*f2size)); + const Xc0 = X; + const Xc1 = c.i32_add(c.getLocal("x"), c.i32_const(i*f2size + f1size)); + const R = (i==0) ? c.getLocal("r") : c.i32_add(c.getLocal("r"), c.i32_const(i*f2size)); + const Rc0 = R; + const Rc1 = c.i32_add(c.getLocal("r"), c.i32_const(i*f2size + f1size)); + const coef = mul2(F12[Math.floor(i/3)][n%12] , F6[i%3][n%6]); + const pCoef = module.alloc([ + ...utils$1.bigInt2BytesLE(toMontgomery(coef[0]), n8q), + ...utils$1.bigInt2BytesLE(toMontgomery(coef[1]), n8q), + ]); + if (n%2 == 1) { + f.addCode( + c.call(f1mPrefix + "_copy", Xc0, Rc0), + c.call(f1mPrefix + "_neg", Xc1, Rc1), + c.call(f2mPrefix + "_mul", R, c.i32_const(pCoef), R), + ); + } else { + f.addCode(c.call(f2mPrefix + "_mul", X, c.i32_const(pCoef), R)); + } + } + + function mul2(a, b) { + const ac0 = a[0]; + const ac1 = a[1]; + const bc0 = b[0]; + const bc1 = b[1]; + const res = [ + (ac0 * bc0 - (ac1 * bc1)) % q, + (ac0 * bc1 + (ac1 * bc0)) % q, + ]; + if (isNegative$1(res[0])) res[0] = res[0] + q; + return res; + } + + } + + + function buildCyclotomicSquare() { + const f = module.addFunction(prefix+ "__cyclotomicSquare"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const x0 = c.getLocal("x"); + const x4 = c.i32_add(c.getLocal("x"), c.i32_const(f2size)); + const x3 = c.i32_add(c.getLocal("x"), c.i32_const(2*f2size)); + const x2 = c.i32_add(c.getLocal("x"), c.i32_const(3*f2size)); + const x1 = c.i32_add(c.getLocal("x"), c.i32_const(4*f2size)); + const x5 = c.i32_add(c.getLocal("x"), c.i32_const(5*f2size)); + + const r0 = c.getLocal("r"); + const r4 = c.i32_add(c.getLocal("r"), c.i32_const(f2size)); + const r3 = c.i32_add(c.getLocal("r"), c.i32_const(2*f2size)); + const r2 = c.i32_add(c.getLocal("r"), c.i32_const(3*f2size)); + const r1 = c.i32_add(c.getLocal("r"), c.i32_const(4*f2size)); + const r5 = c.i32_add(c.getLocal("r"), c.i32_const(5*f2size)); + + const t0 = c.i32_const(module.alloc(f2size)); + const t1 = c.i32_const(module.alloc(f2size)); + const t2 = c.i32_const(module.alloc(f2size)); + const t3 = c.i32_const(module.alloc(f2size)); + const t4 = c.i32_const(module.alloc(f2size)); + const t5 = c.i32_const(module.alloc(f2size)); + const tmp = c.i32_const(module.alloc(f2size)); + const AUX = c.i32_const(module.alloc(f2size)); + + + f.addCode( + // // t0 + t1*y = (z0 + z1*y)^2 = a^2 + // tmp = z0 * z1; + // t0 = (z0 + z1) * (z0 + my_Fp6::non_residue * z1) - tmp - my_Fp6::non_residue * tmp; + // t1 = tmp + tmp; + c.call(f2mPrefix + "_mul", x0, x1, tmp), + c.call(f2mPrefix + "_mulNR", x1, t0), + c.call(f2mPrefix + "_add", x0, t0, t0), + c.call(f2mPrefix + "_add", x0, x1, AUX), + c.call(f2mPrefix + "_mul", AUX, t0, t0), + c.call(f2mPrefix + "_mulNR", tmp, AUX), + c.call(f2mPrefix + "_add", tmp, AUX, AUX), + c.call(f2mPrefix + "_sub", t0, AUX, t0), + c.call(f2mPrefix + "_add", tmp, tmp, t1), + + // // t2 + t3*y = (z2 + z3*y)^2 = b^2 + // tmp = z2 * z3; + // t2 = (z2 + z3) * (z2 + my_Fp6::non_residue * z3) - tmp - my_Fp6::non_residue * tmp; + // t3 = tmp + tmp; + c.call(f2mPrefix + "_mul", x2, x3, tmp), + c.call(f2mPrefix + "_mulNR", x3, t2), + c.call(f2mPrefix + "_add", x2, t2, t2), + c.call(f2mPrefix + "_add", x2, x3, AUX), + c.call(f2mPrefix + "_mul", AUX, t2, t2), + c.call(f2mPrefix + "_mulNR", tmp, AUX), + c.call(f2mPrefix + "_add", tmp, AUX, AUX), + c.call(f2mPrefix + "_sub", t2, AUX, t2), + c.call(f2mPrefix + "_add", tmp, tmp, t3), + + // // t4 + t5*y = (z4 + z5*y)^2 = c^2 + // tmp = z4 * z5; + // t4 = (z4 + z5) * (z4 + my_Fp6::non_residue * z5) - tmp - my_Fp6::non_residue * tmp; + // t5 = tmp + tmp; + c.call(f2mPrefix + "_mul", x4, x5, tmp), + c.call(f2mPrefix + "_mulNR", x5, t4), + c.call(f2mPrefix + "_add", x4, t4, t4), + c.call(f2mPrefix + "_add", x4, x5, AUX), + c.call(f2mPrefix + "_mul", AUX, t4, t4), + c.call(f2mPrefix + "_mulNR", tmp, AUX), + c.call(f2mPrefix + "_add", tmp, AUX, AUX), + c.call(f2mPrefix + "_sub", t4, AUX, t4), + c.call(f2mPrefix + "_add", tmp, tmp, t5), + + // For A + // z0 = 3 * t0 - 2 * z0 + c.call(f2mPrefix + "_sub", t0, x0, r0), + c.call(f2mPrefix + "_add", r0, r0, r0), + c.call(f2mPrefix + "_add", t0, r0, r0), + // z1 = 3 * t1 + 2 * z1 + c.call(f2mPrefix + "_add", t1, x1, r1), + c.call(f2mPrefix + "_add", r1, r1, r1), + c.call(f2mPrefix + "_add", t1, r1, r1), + + // For B + // z2 = 3 * (xi * t5) + 2 * z2 + c.call(f2mPrefix + "_mul", t5, c.i32_const(pBls12381Twist), AUX), + c.call(f2mPrefix + "_add", AUX, x2, r2), + c.call(f2mPrefix + "_add", r2, r2, r2), + c.call(f2mPrefix + "_add", AUX, r2, r2), + // z3 = 3 * t4 - 2 * z3 + c.call(f2mPrefix + "_sub", t4, x3, r3), + c.call(f2mPrefix + "_add", r3, r3, r3), + c.call(f2mPrefix + "_add", t4, r3, r3), + + // For C + // z4 = 3 * t2 - 2 * z4 + c.call(f2mPrefix + "_sub", t2, x4, r4), + c.call(f2mPrefix + "_add", r4, r4, r4), + c.call(f2mPrefix + "_add", t2, r4, r4), + // z5 = 3 * t3 + 2 * z5 + c.call(f2mPrefix + "_add", t3, x5, r5), + c.call(f2mPrefix + "_add", r5, r5, r5), + c.call(f2mPrefix + "_add", t3, r5, r5), + + ); + } + + + function buildCyclotomicExp(exponent, isExpNegative, fnName) { + const exponentNafBytes = naf(exponent).map( (b) => (b==-1 ? 0xFF: b) ); + const pExponentNafBytes = module.alloc(exponentNafBytes); + // const pExponent = module.alloc(utils.bigInt2BytesLE(exponent, n8)); + + const f = module.addFunction(prefix+ "__cyclotomicExp_"+fnName); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + f.addLocal("bit", "i32"); + f.addLocal("i", "i32"); + + const c = f.getCodeBuilder(); + + const x = c.getLocal("x"); + + const res = c.getLocal("r"); + + const inverse = c.i32_const(module.alloc(ftsize)); + + + f.addCode( + c.call(ftmPrefix + "_conjugate", x, inverse), + c.call(ftmPrefix + "_one", res), + + c.if( + c.teeLocal("bit", c.i32_load8_s(c.i32_const(exponentNafBytes.length-1), pExponentNafBytes)), + c.if( + c.i32_eq( + c.getLocal("bit"), + c.i32_const(1) + ), + c.call(ftmPrefix + "_mul", res, x, res), + c.call(ftmPrefix + "_mul", res, inverse, res), + ) + ), + + c.setLocal("i", c.i32_const(exponentNafBytes.length-2)), + c.block(c.loop( + c.call(prefix + "__cyclotomicSquare", res, res), + c.if( + c.teeLocal("bit", c.i32_load8_s(c.getLocal("i"), pExponentNafBytes)), + c.if( + c.i32_eq( + c.getLocal("bit"), + c.i32_const(1) + ), + c.call(ftmPrefix + "_mul", res, x, res), + c.call(ftmPrefix + "_mul", res, inverse, res), + ) + ), + c.br_if(1, c.i32_eqz ( c.getLocal("i") )), + c.setLocal("i", c.i32_sub(c.getLocal("i"), c.i32_const(1))), + c.br(0) + )) + ); + + if (isExpNegative) { + f.addCode( + c.call(ftmPrefix + "_conjugate", res, res), + ); + } + + } + + function buildFinalExponentiation() { + buildCyclotomicSquare(); + buildCyclotomicExp(finalExpZ, finalExpIsNegative, "w0"); + + const f = module.addFunction(prefix+ "_finalExponentiation"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const c = f.getCodeBuilder(); + + const elt = c.getLocal("x"); + const res = c.getLocal("r"); + const t0 = c.i32_const(module.alloc(ftsize)); + const t1 = c.i32_const(module.alloc(ftsize)); + const t2 = c.i32_const(module.alloc(ftsize)); + const t3 = c.i32_const(module.alloc(ftsize)); + const t4 = c.i32_const(module.alloc(ftsize)); + const t5 = c.i32_const(module.alloc(ftsize)); + const t6 = c.i32_const(module.alloc(ftsize)); + + f.addCode( + + // let mut t0 = f.frobenius_map(6) + c.call(ftmPrefix + "_frobeniusMap6", elt, t0), + + // let t1 = f.invert() + c.call(ftmPrefix + "_inverse", elt, t1), + + // let mut t2 = t0 * t1; + c.call(ftmPrefix + "_mul", t0, t1, t2), + + // t1 = t2.clone(); + c.call(ftmPrefix + "_copy", t2, t1), + + // t2 = t2.frobenius_map().frobenius_map(); + c.call(ftmPrefix + "_frobeniusMap2", t2, t2), + + // t2 *= t1; + c.call(ftmPrefix + "_mul", t2, t1, t2), + + + // t1 = cyclotomic_square(t2).conjugate(); + c.call(prefix + "__cyclotomicSquare", t2, t1), + c.call(ftmPrefix + "_conjugate", t1, t1), + + // let mut t3 = cycolotomic_exp(t2); + c.call(prefix + "__cyclotomicExp_w0", t2, t3), + + // let mut t4 = cyclotomic_square(t3); + c.call(prefix + "__cyclotomicSquare", t3, t4), + + // let mut t5 = t1 * t3; + c.call(ftmPrefix + "_mul", t1, t3, t5), + + // t1 = cycolotomic_exp(t5); + c.call(prefix + "__cyclotomicExp_w0", t5, t1), + + // t0 = cycolotomic_exp(t1); + c.call(prefix + "__cyclotomicExp_w0", t1, t0), + + // let mut t6 = cycolotomic_exp(t0); + c.call(prefix + "__cyclotomicExp_w0", t0, t6), + + // t6 *= t4; + c.call(ftmPrefix + "_mul", t6, t4, t6), + + // t4 = cycolotomic_exp(t6); + c.call(prefix + "__cyclotomicExp_w0", t6, t4), + + // t5 = t5.conjugate(); + c.call(ftmPrefix + "_conjugate", t5, t5), + + // t4 *= t5 * t2; + c.call(ftmPrefix + "_mul", t4, t5, t4), + c.call(ftmPrefix + "_mul", t4, t2, t4), + + // t5 = t2.conjugate(); + c.call(ftmPrefix + "_conjugate", t2, t5), + + // t1 *= t2; + c.call(ftmPrefix + "_mul", t1, t2, t1), + + // t1 = t1.frobenius_map().frobenius_map().frobenius_map(); + c.call(ftmPrefix + "_frobeniusMap3", t1, t1), + + // t6 *= t5; + c.call(ftmPrefix + "_mul", t6, t5, t6), + + // t6 = t6.frobenius_map(); + c.call(ftmPrefix + "_frobeniusMap1", t6, t6), + + // t3 *= t0; + c.call(ftmPrefix + "_mul", t3, t0, t3), + + // t3 = t3.frobenius_map().frobenius_map(); + c.call(ftmPrefix + "_frobeniusMap2", t3, t3), + + // t3 *= t1; + c.call(ftmPrefix + "_mul", t3, t1, t3), + + // t3 *= t6; + c.call(ftmPrefix + "_mul", t3, t6, t3), + + // f = t3 * t4; + c.call(ftmPrefix + "_mul", t3, t4, res), + + ); + } + + + function buildFinalExponentiationOld() { + const f = module.addFunction(prefix+ "_finalExponentiationOld"); + f.addParam("x", "i32"); + f.addParam("r", "i32"); + + const exponent = 322277361516934140462891564586510139908379969514828494218366688025288661041104682794998680497580008899973249814104447692778988208376779573819485263026159588510513834876303014016798809919343532899164848730280942609956670917565618115867287399623286813270357901731510188149934363360381614501334086825442271920079363289954510565375378443704372994881406797882676971082200626541916413184642520269678897559532260949334760604962086348898118982248842634379637598665468817769075878555493752214492790122785850202957575200176084204422751485957336465472324810982833638490904279282696134323072515220044451592646885410572234451732790590013479358343841220074174848221722017083597872017638514103174122784843925578370430843522959600095676285723737049438346544753168912974976791528535276317256904336520179281145394686565050419250614107803233314658825463117900250701199181529205942363159325765991819433914303908860460720581408201373164047773794825411011922305820065611121544561808414055302212057471395719432072209245600258134364584636810093520285711072578721435517884103526483832733289802426157301542744476740008494780363354305116978805620671467071400711358839553375340724899735460480144599782014906586543813292157922220645089192130209334926661588737007768565838519456601560804957985667880395221049249803753582637708560n; + + const pExponent = module.alloc(utils$1.bigInt2BytesLE( exponent, 544 )); + + const c = f.getCodeBuilder(); + + f.addCode( + c.call(ftmPrefix + "_exp", c.getLocal("x"), c.i32_const(pExponent), c.i32_const(544), c.getLocal("r")), + ); + } + + + const pPreP = module.alloc(prePSize); + const pPreQ = module.alloc(preQSize); + + function buildPairingEquation(nPairings) { + + const f = module.addFunction(prefix+ "_pairingEq"+nPairings); + for (let i=0; i. */ -const bigInt = __webpack_require__(92096); +// module.exports.bn128_wasm = require("./build/bn128_wasm.js"); +// module.exports.bls12381_wasm = require("./build/bls12381_wasm.js"); +// module.exports.mnt6753_wasm = require("./build/mnt6753_wasm.js"); -exports.bigInt2BytesLE = function bigInt2BytesLE(_a, len) { - const b = Array(len); - let v = bigInt(_a); - for (let i=0; i { - -"use strict"; - - -var forEach = __webpack_require__(82682); -var availableTypedArrays = __webpack_require__(39209); -var callBind = __webpack_require__(10487); -var callBound = __webpack_require__(38075); -var gOPD = __webpack_require__(75795); - -/** @type {(O: object) => string} */ -var $toString = callBound('Object.prototype.toString'); -var hasToStringTag = __webpack_require__(49092)(); - -var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis; -var typedArrays = availableTypedArrays(); - -var $slice = callBound('String.prototype.slice'); -var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); - -/** @type {(array: readonly T[], value: unknown) => number} */ -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; -}; - -/** @typedef {(receiver: import('.').TypedArray) => string | typeof Uint8Array.prototype.slice.call | typeof Uint8Array.prototype.set.call} Getter */ -/** @type {{ [k in `\$${import('.').TypedArrayName}`]?: Getter } & { __proto__: null }} */ -var cache = { __proto__: null }; -if (hasToStringTag && gOPD && getPrototypeOf) { - forEach(typedArrays, function (typedArray) { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - // @ts-expect-error TS won't narrow inside a closure - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - // @ts-expect-error TS won't narrow inside a closure - descriptor = gOPD(superProto, Symbol.toStringTag); - } - // @ts-expect-error TODO: fix - cache['$' + typedArray] = callBind(descriptor.get); - } - }); -} else { - forEach(typedArrays, function (typedArray) { - var arr = new g[typedArray](); - var fn = arr.slice || arr.set; - if (fn) { - // @ts-expect-error TODO: fix - cache['$' + typedArray] = callBind(fn); - } - }); -} - -/** @type {(value: object) => false | import('.').TypedArrayName} */ -var tryTypedArrays = function tryAllTypedArrays(value) { - /** @type {ReturnType} */ var found = false; - forEach( - // eslint-disable-next-line no-extra-parens - /** @type {Record<`\$${TypedArrayName}`, Getter>} */ /** @type {any} */ (cache), - /** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */ - function (getter, typedArray) { - if (!found) { - try { - // @ts-expect-error TODO: fix - if ('$' + getter(value) === typedArray) { - found = $slice(typedArray, 1); - } - } catch (e) { /**/ } - } - } - ); - return found; -}; - -/** @type {(value: object) => false | import('.').TypedArrayName} */ -var trySlices = function tryAllSlices(value) { - /** @type {ReturnType} */ var found = false; - forEach( - // eslint-disable-next-line no-extra-parens - /** @type {Record<`\$${TypedArrayName}`, Getter>} */ /** @type {any} */ (cache), - /** @type {(getter: typeof cache, name: `\$${import('.').TypedArrayName}`) => void} */ function (getter, name) { - if (!found) { - try { - // @ts-expect-error TODO: fix - getter(value); - found = $slice(name, 1); - } catch (e) { /**/ } - } - } - ); - return found; -}; - -/** @type {import('.')} */ -module.exports = function whichTypedArray(value) { - if (!value || typeof value !== 'object') { return false; } - if (!hasToStringTag) { - /** @type {string} */ - var tag = $slice($toString(value), 8, -1); - if ($indexOf(typedArrays, tag) > -1) { - return tag; - } - if (tag !== 'Object') { - return false; - } - // node < 0.6 hits here on real Typed Arrays - return trySlices(value); - } - if (!gOPD) { return null; } // unknown engine - return tryTypedArrays(value); -}; - - -/***/ }), - -/***/ 57510: -/***/ ((module) => { - -module.exports = extend - -var hasOwnProperty = Object.prototype.hasOwnProperty; - -function extend() { - var target = {} - - for (var i = 0; i < arguments.length; i++) { - var source = arguments[i] - - for (var key in source) { - if (hasOwnProperty.call(source, key)) { - target[key] = source[key] - } - } - } - - return target -} - - -/***/ }), - -/***/ 40259: -/***/ ((module) => { - -"use strict"; - -module.exports = function (Yallist) { - Yallist.prototype[Symbol.iterator] = function* () { - for (let walker = this.head; walker; walker = walker.next) { - yield walker.value - } - } -} - - -/***/ }), - -/***/ 28799: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - -module.exports = Yallist - -Yallist.Node = Node -Yallist.create = Yallist - -function Yallist (list) { - var self = this - if (!(self instanceof Yallist)) { - self = new Yallist() - } - - self.tail = null - self.head = null - self.length = 0 - - if (list && typeof list.forEach === 'function') { - list.forEach(function (item) { - self.push(item) - }) - } else if (arguments.length > 0) { - for (var i = 0, l = arguments.length; i < l; i++) { - self.push(arguments[i]) - } - } - - return self -} - -Yallist.prototype.removeNode = function (node) { - if (node.list !== this) { - throw new Error('removing node which does not belong to this list') - } - - var next = node.next - var prev = node.prev - - if (next) { - next.prev = prev - } - - if (prev) { - prev.next = next - } - - if (node === this.head) { - this.head = next - } - if (node === this.tail) { - this.tail = prev - } - - node.list.length-- - node.next = null - node.prev = null - node.list = null - - return next -} - -Yallist.prototype.unshiftNode = function (node) { - if (node === this.head) { - return - } - - if (node.list) { - node.list.removeNode(node) - } - - var head = this.head - node.list = this - node.next = head - if (head) { - head.prev = node - } - - this.head = node - if (!this.tail) { - this.tail = node - } - this.length++ -} - -Yallist.prototype.pushNode = function (node) { - if (node === this.tail) { - return - } - - if (node.list) { - node.list.removeNode(node) - } - - var tail = this.tail - node.list = this - node.prev = tail - if (tail) { - tail.next = node - } - - this.tail = node - if (!this.head) { - this.head = node - } - this.length++ -} - -Yallist.prototype.push = function () { - for (var i = 0, l = arguments.length; i < l; i++) { - push(this, arguments[i]) - } - return this.length -} - -Yallist.prototype.unshift = function () { - for (var i = 0, l = arguments.length; i < l; i++) { - unshift(this, arguments[i]) - } - return this.length -} - -Yallist.prototype.pop = function () { - if (!this.tail) { - return undefined - } - - var res = this.tail.value - this.tail = this.tail.prev - if (this.tail) { - this.tail.next = null - } else { - this.head = null - } - this.length-- - return res -} - -Yallist.prototype.shift = function () { - if (!this.head) { - return undefined - } - - var res = this.head.value - this.head = this.head.next - if (this.head) { - this.head.prev = null - } else { - this.tail = null - } - this.length-- - return res -} - -Yallist.prototype.forEach = function (fn, thisp) { - thisp = thisp || this - for (var walker = this.head, i = 0; walker !== null; i++) { - fn.call(thisp, walker.value, i, this) - walker = walker.next - } -} - -Yallist.prototype.forEachReverse = function (fn, thisp) { - thisp = thisp || this - for (var walker = this.tail, i = this.length - 1; walker !== null; i--) { - fn.call(thisp, walker.value, i, this) - walker = walker.prev - } -} - -Yallist.prototype.get = function (n) { - for (var i = 0, walker = this.head; walker !== null && i < n; i++) { - // abort out of the list early if we hit a cycle - walker = walker.next - } - if (i === n && walker !== null) { - return walker.value - } -} - -Yallist.prototype.getReverse = function (n) { - for (var i = 0, walker = this.tail; walker !== null && i < n; i++) { - // abort out of the list early if we hit a cycle - walker = walker.prev - } - if (i === n && walker !== null) { - return walker.value - } -} - -Yallist.prototype.map = function (fn, thisp) { - thisp = thisp || this - var res = new Yallist() - for (var walker = this.head; walker !== null;) { - res.push(fn.call(thisp, walker.value, this)) - walker = walker.next - } - return res -} - -Yallist.prototype.mapReverse = function (fn, thisp) { - thisp = thisp || this - var res = new Yallist() - for (var walker = this.tail; walker !== null;) { - res.push(fn.call(thisp, walker.value, this)) - walker = walker.prev - } - return res -} - -Yallist.prototype.reduce = function (fn, initial) { - var acc - var walker = this.head - if (arguments.length > 1) { - acc = initial - } else if (this.head) { - walker = this.head.next - acc = this.head.value - } else { - throw new TypeError('Reduce of empty list with no initial value') - } - - for (var i = 0; walker !== null; i++) { - acc = fn(acc, walker.value, i) - walker = walker.next - } - - return acc -} - -Yallist.prototype.reduceReverse = function (fn, initial) { - var acc - var walker = this.tail - if (arguments.length > 1) { - acc = initial - } else if (this.tail) { - walker = this.tail.prev - acc = this.tail.value - } else { - throw new TypeError('Reduce of empty list with no initial value') - } - - for (var i = this.length - 1; walker !== null; i--) { - acc = fn(acc, walker.value, i) - walker = walker.prev - } - - return acc -} - -Yallist.prototype.toArray = function () { - var arr = new Array(this.length) - for (var i = 0, walker = this.head; walker !== null; i++) { - arr[i] = walker.value - walker = walker.next - } - return arr -} - -Yallist.prototype.toArrayReverse = function () { - var arr = new Array(this.length) - for (var i = 0, walker = this.tail; walker !== null; i++) { - arr[i] = walker.value - walker = walker.prev - } - return arr -} - -Yallist.prototype.slice = function (from, to) { - to = to || this.length - if (to < 0) { - to += this.length - } - from = from || 0 - if (from < 0) { - from += this.length - } - var ret = new Yallist() - if (to < from || to < 0) { - return ret - } - if (from < 0) { - from = 0 - } - if (to > this.length) { - to = this.length - } - for (var i = 0, walker = this.head; walker !== null && i < from; i++) { - walker = walker.next - } - for (; walker !== null && i < to; i++, walker = walker.next) { - ret.push(walker.value) - } - return ret -} - -Yallist.prototype.sliceReverse = function (from, to) { - to = to || this.length - if (to < 0) { - to += this.length - } - from = from || 0 - if (from < 0) { - from += this.length - } - var ret = new Yallist() - if (to < from || to < 0) { - return ret - } - if (from < 0) { - from = 0 - } - if (to > this.length) { - to = this.length - } - for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) { - walker = walker.prev - } - for (; walker !== null && i > from; i--, walker = walker.prev) { - ret.push(walker.value) - } - return ret -} - -Yallist.prototype.splice = function (start, deleteCount, ...nodes) { - if (start > this.length) { - start = this.length - 1 - } - if (start < 0) { - start = this.length + start; - } - - for (var i = 0, walker = this.head; walker !== null && i < start; i++) { - walker = walker.next - } - - var ret = [] - for (var i = 0; walker && i < deleteCount; i++) { - ret.push(walker.value) - walker = this.removeNode(walker) - } - if (walker === null) { - walker = this.tail - } - - if (walker !== this.head && walker !== this.tail) { - walker = walker.prev - } - - for (var i = 0; i < nodes.length; i++) { - walker = insert(this, walker, nodes[i]) - } - return ret; -} - -Yallist.prototype.reverse = function () { - var head = this.head - var tail = this.tail - for (var walker = head; walker !== null; walker = walker.prev) { - var p = walker.prev - walker.prev = walker.next - walker.next = p - } - this.head = tail - this.tail = head - return this -} - -function insert (self, node, value) { - var inserted = node === self.head ? - new Node(value, null, node, self) : - new Node(value, node, node.next, self) - - if (inserted.next === null) { - self.tail = inserted - } - if (inserted.prev === null) { - self.head = inserted - } - - self.length++ - - return inserted -} - -function push (self, item) { - self.tail = new Node(item, self.tail, null, self) - if (!self.head) { - self.head = self.tail - } - self.length++ -} - -function unshift (self, item) { - self.head = new Node(item, null, self.head, self) - if (!self.tail) { - self.tail = self.head - } - self.length++ -} - -function Node (value, prev, next, list) { - if (!(this instanceof Node)) { - return new Node(value, prev, next, list) - } - - this.list = list - this.value = value - - if (prev) { - prev.next = this - this.prev = prev - } else { - this.prev = null - } - - if (next) { - next.prev = this - this.next = next - } else { - this.next = null - } -} - -try { - // add if support for Symbol.iterator is present - __webpack_require__(40259)(Yallist) -} catch (er) {} - - -/***/ }), - -/***/ 5183: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 78982: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 47790: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 73776: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 21638: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 92668: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 77965: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 66089: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 79368: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 23276: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 59676: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 64688: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 51069: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 15340: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 79838: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 59817: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 71281: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 60513: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 2378: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 60290: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 47882: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 39209: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var possibleNames = __webpack_require__(76578); - -var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis; - -/** @type {import('.')} */ -module.exports = function availableTypedArrays() { - var /** @type {ReturnType} */ out = []; - for (var i = 0; i < possibleNames.length; i++) { - if (typeof g[possibleNames[i]] === 'function') { - // @ts-expect-error - out[out.length] = possibleNames[i]; - } - } - return out; -}; - - -/***/ }), - -/***/ 89082: -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; - -// EXPORTS -__webpack_require__.d(__webpack_exports__, { - HI: () => (/* reexport */ mimcsponge_buildMimcSponge), - vu: () => (/* reexport */ pedersen_hash_buildPedersenHash) -}); - -// UNUSED EXPORTS: SMT, SMTMemDb, buildBabyjub, buildEddsa, buildMimc7, buildPoseidon, buildPoseidonOpt, buildPoseidonReference, buildPoseidonWasm, buildSMT, evmasm, mimc7Contract, mimcSpongecontract, newMemEmptyTrie, poseidonContract - -// NAMESPACE OBJECT: ./node_modules/ffjavascript/src/scalar_native.js -var scalar_native_namespaceObject = {}; -__webpack_require__.r(scalar_native_namespaceObject); -__webpack_require__.d(scalar_native_namespaceObject, { - abs: () => (abs), - add: () => (add), - band: () => (band), - bitLength: () => (bitLength), - bits: () => (bits), - bor: () => (bor), - bxor: () => (bxor), - div: () => (div), - e: () => (e), - eq: () => (eq), - exp: () => (exp), - fromArray: () => (fromArray), - fromString: () => (fromString), - geq: () => (geq), - gt: () => (gt), - isNegative: () => (isNegative), - isOdd: () => (isOdd), - isZero: () => (isZero), - land: () => (land), - leq: () => (leq), - lnot: () => (lnot), - lor: () => (lor), - lt: () => (lt), - mod: () => (mod), - mul: () => (mul), - naf: () => (naf), - neg: () => (neg), - neq: () => (neq), - pow: () => (pow), - shiftLeft: () => (shiftLeft), - shiftRight: () => (shiftRight), - shl: () => (shl), - shr: () => (shr), - square: () => (square), - sub: () => (sub), - toArray: () => (toArray), - toNumber: () => (toNumber) -}); - -// NAMESPACE OBJECT: ./node_modules/ffjavascript/src/scalar_bigint.js -var scalar_bigint_namespaceObject = {}; -__webpack_require__.r(scalar_bigint_namespaceObject); -__webpack_require__.d(scalar_bigint_namespaceObject, { - abs: () => (scalar_bigint_abs), - add: () => (scalar_bigint_add), - band: () => (scalar_bigint_band), - bitLength: () => (scalar_bigint_bitLength), - bits: () => (scalar_bigint_bits), - bor: () => (scalar_bigint_bor), - bxor: () => (scalar_bigint_bxor), - div: () => (scalar_bigint_div), - e: () => (scalar_bigint_e), - eq: () => (scalar_bigint_eq), - exp: () => (scalar_bigint_exp), - fromArray: () => (scalar_bigint_fromArray), - fromString: () => (scalar_bigint_fromString), - geq: () => (scalar_bigint_geq), - gt: () => (scalar_bigint_gt), - isNegative: () => (scalar_bigint_isNegative), - isOdd: () => (scalar_bigint_isOdd), - isZero: () => (scalar_bigint_isZero), - land: () => (scalar_bigint_land), - leq: () => (scalar_bigint_leq), - lnot: () => (scalar_bigint_lnot), - lor: () => (scalar_bigint_lor), - lt: () => (scalar_bigint_lt), - mod: () => (scalar_bigint_mod), - mul: () => (scalar_bigint_mul), - naf: () => (scalar_bigint_naf), - neg: () => (scalar_bigint_neg), - neq: () => (scalar_bigint_neq), - pow: () => (scalar_bigint_pow), - shiftLeft: () => (scalar_bigint_shiftLeft), - shiftRight: () => (scalar_bigint_shiftRight), - shl: () => (scalar_bigint_shl), - shr: () => (scalar_bigint_shr), - square: () => (scalar_bigint_square), - sub: () => (scalar_bigint_sub), - toArray: () => (scalar_bigint_toArray), - toNumber: () => (scalar_bigint_toNumber) -}); - -// NAMESPACE OBJECT: ./node_modules/ffjavascript/src/scalar.js -var scalar_namespaceObject = {}; -__webpack_require__.r(scalar_namespaceObject); -__webpack_require__.d(scalar_namespaceObject, { - abs: () => (scalar_abs), - add: () => (scalar_add), - band: () => (scalar_band), - bitLength: () => (scalar_bitLength), - bits: () => (scalar_bits), - bor: () => (scalar_bor), - bxor: () => (scalar_bxor), - div: () => (scalar_div), - e: () => (scalar_e), - eq: () => (scalar_eq), - exp: () => (scalar_exp), - fromArray: () => (scalar_fromArray), - fromRprBE: () => (fromRprBE), - fromRprLE: () => (fromRprLE), - fromString: () => (scalar_fromString), - geq: () => (scalar_geq), - gt: () => (scalar_gt), - isNegative: () => (scalar_isNegative), - isOdd: () => (scalar_isOdd), - isZero: () => (scalar_isZero), - land: () => (scalar_land), - leq: () => (scalar_leq), - lnot: () => (scalar_lnot), - lor: () => (scalar_lor), - lt: () => (scalar_lt), - mod: () => (scalar_mod), - mul: () => (scalar_mul), - naf: () => (scalar_naf), - neg: () => (scalar_neg), - neq: () => (scalar_neq), - one: () => (one), - pow: () => (scalar_pow), - shiftLeft: () => (scalar_shiftLeft), - shiftRight: () => (scalar_shiftRight), - shl: () => (scalar_shl), - shr: () => (scalar_shr), - square: () => (scalar_square), - sub: () => (scalar_sub), - toArray: () => (scalar_toArray), - toLEBuff: () => (toLEBuff), - toNumber: () => (scalar_toNumber), - toRprBE: () => (toRprBE), - toRprLE: () => (toRprLE), - toString: () => (scalar_toString), - zero: () => (zero) -}); - -// NAMESPACE OBJECT: ./node_modules/ffjavascript/src/utils_native.js -var utils_native_namespaceObject = {}; -__webpack_require__.r(utils_native_namespaceObject); -__webpack_require__.d(utils_native_namespaceObject, { - beBuff2int: () => (beBuff2int), - beInt2Buff: () => (beInt2Buff), - leBuff2int: () => (leBuff2int), - leInt2Buff: () => (leInt2Buff), - stringifyBigInts: () => (stringifyBigInts), - stringifyFElements: () => (stringifyFElements), - unstringifyBigInts: () => (unstringifyBigInts), - unstringifyFElements: () => (unstringifyFElements) -}); - -// NAMESPACE OBJECT: ./node_modules/ffjavascript/src/utils_bigint.js -var utils_bigint_namespaceObject = {}; -__webpack_require__.r(utils_bigint_namespaceObject); -__webpack_require__.d(utils_bigint_namespaceObject, { - beBuff2int: () => (utils_bigint_beBuff2int), - beInt2Buff: () => (utils_bigint_beInt2Buff), - leBuff2int: () => (utils_bigint_leBuff2int), - leInt2Buff: () => (utils_bigint_leInt2Buff), - stringifyBigInts: () => (utils_bigint_stringifyBigInts), - unstringifyBigInts: () => (utils_bigint_unstringifyBigInts) -}); - -// NAMESPACE OBJECT: ./node_modules/ffjavascript/src/utils.js -var utils_namespaceObject = {}; -__webpack_require__.r(utils_namespaceObject); -__webpack_require__.d(utils_namespaceObject, { - array2buffer: () => (array2buffer), - beBuff2int: () => (utils_beBuff2int), - beInt2Buff: () => (utils_beInt2Buff), - bitReverse: () => (bitReverse), - buffReverseBits: () => (buffReverseBits), - buffer2array: () => (buffer2array), - leBuff2int: () => (utils_leBuff2int), - leInt2Buff: () => (utils_leInt2Buff), - log2: () => (utils_log2), - stringifyBigInts: () => (utils_stringifyBigInts), - stringifyFElements: () => (utils_stringifyFElements), - unstringifyBigInts: () => (utils_unstringifyBigInts), - unstringifyFElements: () => (utils_unstringifyFElements) -}); - -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/scalar_native.js /* global BigInt */ -const hexLen = [ 0, 1, 2, 2, 3, 3, 3, 3, 4 ,4 ,4 ,4 ,4 ,4 ,4 ,4]; - -function fromString(s, radix) { - if ((!radix)||(radix==10)) { - return BigInt(s); - } else if (radix==16) { - if (s.slice(0,2) == "0x") { - return BigInt(s); - } else { - return BigInt("0x"+s); - } - } -} - -const e = fromString; - -function fromArray(a, radix) { - let acc =BigInt(0); - radix = BigInt(radix); - for (let i=0; i> BigInt(n); -} - -const shl = shiftLeft; -const shr = shiftRight; - -function isOdd(a) { - return (BigInt(a) & BigInt(1)) == BigInt(1); -} - - -function naf(n) { - let E = BigInt(n); - const res = []; - while (E) { - if (E & BigInt(1)) { - const z = 2 - Number(E % BigInt(4)); - res.push( z ); - E = E - BigInt(z); - } else { - res.push( 0 ); - } - E = E >> BigInt(1); - } - return res; -} - - -function bits(n) { - let E = BigInt(n); - const res = []; - while (E) { - if (E & BigInt(1)) { - res.push(1); - } else { - res.push( 0 ); - } - E = E >> BigInt(1); - } - return res; -} - -function toNumber(s) { - if (s>BigInt(Number.MAX_SAFE_INTEGER )) { - throw new Error("Number too big"); - } - return Number(s); -} - -function toArray(s, radix) { - const res = []; - let rem = BigInt(s); - radix = BigInt(radix); - while (rem) { - res.unshift( Number(rem % radix)); - rem = rem / radix; - } - return res; -} - - -function add(a, b) { - return BigInt(a) + BigInt(b); -} - -function sub(a, b) { - return BigInt(a) - BigInt(b); -} - -function neg(a) { - return -BigInt(a); -} - -function mul(a, b) { - return BigInt(a) * BigInt(b); -} - -function square(a) { - return BigInt(a) * BigInt(a); -} - -function pow(a, b) { - return BigInt(a) ** BigInt(b); -} - -function exp(a, b) { - return BigInt(a) ** BigInt(b); -} - -function abs(a) { - return BigInt(a) >= 0 ? BigInt(a) : -BigInt(a); -} - -function div(a, b) { - return BigInt(a) / BigInt(b); -} - -function mod(a, b) { - return BigInt(a) % BigInt(b); -} - -function eq(a, b) { - return BigInt(a) == BigInt(b); -} - -function neq(a, b) { - return BigInt(a) != BigInt(b); -} - -function lt(a, b) { - return BigInt(a) < BigInt(b); -} - -function gt(a, b) { - return BigInt(a) > BigInt(b); -} - -function leq(a, b) { - return BigInt(a) <= BigInt(b); -} - -function geq(a, b) { - return BigInt(a) >= BigInt(b); -} - -function band(a, b) { - return BigInt(a) & BigInt(b); -} - -function bor(a, b) { - return BigInt(a) | BigInt(b); -} - -function bxor(a, b) { - return BigInt(a) ^ BigInt(b); -} - -function land(a, b) { - return BigInt(a) && BigInt(b); -} - -function lor(a, b) { - return BigInt(a) || BigInt(b); -} - -function lnot(a) { - return !BigInt(a); -} - - -// EXTERNAL MODULE: ./node_modules/big-integer/BigInteger.js -var BigInteger = __webpack_require__(92096); -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/scalar_bigint.js - - -function scalar_bigint_fromString(s, radix) { - if (typeof s == "string") { - if (s.slice(0,2) == "0x") { - return BigInteger(s.slice(2), 16); - } else { - return BigInteger(s,radix); - } - } else { - return BigInteger(s, radix); - } -} - -const scalar_bigint_e = scalar_bigint_fromString; - -function scalar_bigint_fromArray(a, radix) { - return BigInteger.fromArray(a, radix); -} - -function scalar_bigint_bitLength(a) { - return BigInteger(a).bitLength(); -} - -function scalar_bigint_isNegative(a) { - return BigInteger(a).isNegative(); -} - -function scalar_bigint_isZero(a) { - return BigInteger(a).isZero(); -} - -function scalar_bigint_shiftLeft(a, n) { - return BigInteger(a).shiftLeft(n); -} - -function scalar_bigint_shiftRight(a, n) { - return BigInteger(a).shiftRight(n); -} - -const scalar_bigint_shl = scalar_bigint_shiftLeft; -const scalar_bigint_shr = scalar_bigint_shiftRight; - -function scalar_bigint_isOdd(a) { - return BigInteger(a).isOdd(); -} - - -function scalar_bigint_naf(n) { - let E = BigInteger(n); - const res = []; - while (E.gt(BigInteger.zero)) { - if (E.isOdd()) { - const z = 2 - E.mod(4).toJSNumber(); - res.push( z ); - E = E.minus(z); - } else { - res.push( 0 ); - } - E = E.shiftRight(1); - } - return res; -} - -function scalar_bigint_bits(n) { - let E = BigInteger(n); - const res = []; - while (E.gt(BigInteger.zero)) { - if (E.isOdd()) { - res.push(1); - } else { - res.push( 0 ); - } - E = E.shiftRight(1); - } - return res; -} - -function scalar_bigint_toNumber(s) { - if (!s.lt(BigInteger("9007199254740992", 10))) { - throw new Error("Number too big"); - } - return s.toJSNumber(); -} - -function scalar_bigint_toArray(s, radix) { - return BigInteger(s).toArray(radix); -} - -function scalar_bigint_add(a, b) { - return BigInteger(a).add(BigInteger(b)); -} - -function scalar_bigint_sub(a, b) { - return BigInteger(a).minus(BigInteger(b)); -} - -function scalar_bigint_neg(a) { - return BigInteger.zero.minus(BigInteger(a)); -} - -function scalar_bigint_mul(a, b) { - return BigInteger(a).times(BigInteger(b)); -} - -function scalar_bigint_square(a) { - return BigInteger(a).square(); -} - -function scalar_bigint_pow(a, b) { - return BigInteger(a).pow(BigInteger(b)); -} - -function scalar_bigint_exp(a, b) { - return BigInteger(a).pow(BigInteger(b)); -} - -function scalar_bigint_abs(a) { - return BigInteger(a).abs(); -} - -function scalar_bigint_div(a, b) { - return BigInteger(a).divide(BigInteger(b)); -} - -function scalar_bigint_mod(a, b) { - return BigInteger(a).mod(BigInteger(b)); -} - -function scalar_bigint_eq(a, b) { - return BigInteger(a).eq(BigInteger(b)); -} - -function scalar_bigint_neq(a, b) { - return BigInteger(a).neq(BigInteger(b)); -} - -function scalar_bigint_lt(a, b) { - return BigInteger(a).lt(BigInteger(b)); -} - -function scalar_bigint_gt(a, b) { - return BigInteger(a).gt(BigInteger(b)); -} - -function scalar_bigint_leq(a, b) { - return BigInteger(a).leq(BigInteger(b)); -} - -function scalar_bigint_geq(a, b) { - return BigInteger(a).geq(BigInteger(b)); -} - -function scalar_bigint_band(a, b) { - return BigInteger(a).and(BigInteger(b)); -} - -function scalar_bigint_bor(a, b) { - return BigInteger(a).or(BigInteger(b)); -} - -function scalar_bigint_bxor(a, b) { - return BigInteger(a).xor(BigInteger(b)); -} - -function scalar_bigint_land(a, b) { - return (!BigInteger(a).isZero()) && (!BigInteger(b).isZero()); -} - -function scalar_bigint_lor(a, b) { - return (!BigInteger(a).isZero()) || (!BigInteger(b).isZero()); -} - -function scalar_bigint_lnot(a) { - return BigInteger(a).isZero(); -} - - - -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/scalar.js - - - - -const supportsNativeBigInt = typeof BigInt === "function"; - -let scalar_Scalar = {}; -if (supportsNativeBigInt) { - Object.assign(scalar_Scalar, scalar_native_namespaceObject); -} else { - Object.assign(scalar_Scalar, scalar_bigint_namespaceObject); -} - - -// Returns a buffer with Little Endian Representation -scalar_Scalar.toRprLE = function rprBE(buff, o, e, n8) { - const s = "0000000" + e.toString(16); - const v = new Uint32Array(buff.buffer, o, n8/4); - const l = (((s.length-7)*4 - 1) >> 5)+1; // Number of 32bit words; - for (let i=0; i> 5)+1; // Number of 32bit words; - for (let i=0; i a[a.length-i-1] = ch.toString(16).padStart(8,"0") ); - return scalar_Scalar.fromString(a.join(""), 16); -}; - -// Pases a buffer with Big Endian Representation -scalar_Scalar.fromRprBE = function rprLEM(buff, o, n8) { - n8 = n8 || buff.byteLength; - o = o || 0; - const v = new DataView(buff.buffer, buff.byteOffset + o, n8); - const a = new Array(n8/4); - for (let i=0; i. -*/ - -/* - This library does operations on polynomials with coefficients in a field F. - - A polynomial P(x) = p0 + p1 * x + p2 * x^2 + ... + pn * x^n is represented - by the array [ p0, p1, p2, ... , pn ]. - */ - -class PolField { - constructor (F) { - this.F = F; - - let rem = F.sqrt_t; - let s = F.sqrt_s; - - const five = this.F.add(this.F.add(this.F.two, this.F.two), this.F.one); - - this.w = new Array(s+1); - this.wi = new Array(s+1); - this.w[s] = this.F.pow(five, rem); - this.wi[s] = this.F.inv(this.w[s]); - - let n=s-1; - while (n>=0) { - this.w[n] = this.F.square(this.w[n+1]); - this.wi[n] = this.F.square(this.wi[n+1]); - n--; - } - - - this.roots = []; -/* for (let i=0; i<16; i++) { - let r = this.F.one; - n = 1 << i; - const rootsi = new Array(n); - for (let j=0; j this.F.sqrt_s) n = this.s; - for (let i=n; (i>=0) && (!this.roots[i]); i--) { - let r = this.F.one; - const nroots = 1 << i; - const rootsi = new Array(nroots); - for (let j=0; j a.length) { - [b, a] = [a, b]; - } - - if ((b.length <= 2) || (b.length < log2(a.length))) { - return this.mulNormal(a,b); - } else { - return this.mulFFT(a,b); - } - } - - mulNormal(a, b) { - let res = []; - for (let i=0; i0) { - const z = new Array(n).fill(this.F.zero); - return z.concat(p); - } else { - if (-n >= p.length) return []; - return p.slice(-n); - } - } - - eval2(p, x) { - let v = this.F.zero; - let ix = this.F.one; - for (let i=0; i> 1), - F.mul( - x, - _eval(p, newX, offset+step , step << 1, n >> 1))); - return res; - } - } - - lagrange(points) { - let roots = [this.F.one]; - for (let i=0; i> 1; - const p1 = this._fft(pall, bits-1, offset, step*2); - const p2 = this._fft(pall, bits-1, offset+step, step*2); - - const out = new Array(n); - - let m= this.F.one; - for (let i=0; i0 && this.F.eq(p[i], this.F.zero) ) i--; - return p.slice(0, i+1); - } - - eq(a, b) { - const pa = this.reduce(a); - const pb = this.reduce(b); - - if (pa.length != pb.length) return false; - for (let i=0; i=0; i--) { - res[i] = this.F.add(this.F.mul(res[i+1], r), p[i+1]); - } - return res; - } - - _next2Power(v) { - v--; - v |= v >> 1; - v |= v >> 2; - v |= v >> 4; - v |= v >> 8; - v |= v >> 16; - v++; - return v; - } - - toString(p) { - const ap = this.normalize(p); - let S = ""; - for (let i=ap.length-1; i>=0; i--) { - if (!this.F.eq(p[i], this.F.zero)) { - if (S!="") S += " + "; - S = S + p[i].toString(10); - if (i>0) { - S = S + "x"; - if (i>1) { - S = S + "^" +i; - } - } - } - } - return S; - } - - normalize(p) { - const res = new Array(p.length); - for (let i=0; i - // rec = x^(k-2-scaleV)/ v - // - // res = x^m/v = x^(m + (2*k-2 - scaleV) - (2*k-2 - scaleV)) /v => - // res = rec * x^(m - (2*k-2 - scaleV)) => - // res = rec * x^(m - 2*k + 2 + scaleV) - - const rec = this._reciprocal(this.scaleX(v, scaleV), kbits); - const res = this.scaleX(rec, m - 2*k + 2 + scaleV); - - return res; - } - - div(_u, _v) { - if (_u.length < _v.length) return []; - const kbits = log2(_v.length-1)+1; - const k = 1 << kbits; - - const u = this.scaleX(_u, k-_v.length); - const v = this.scaleX(_v, k-_v.length); - - const n = v.length-1; - let m = u.length-1; - - const s = this._reciprocal(v, kbits); - let t; - if (m>2*n) { - t = this.sub(this.scaleX([this.F.one], 2*n), this.mul(s, v)); - } - - let q = []; - let rem = u; - let us, ut; - let finish = false; - - while (!finish) { - us = this.mul(rem, s); - q = this.add(q, this.scaleX(us, -2*n)); - - if ( m > 2*n ) { - ut = this.mul(rem, t); - rem = this.scaleX(ut, -2*n); - m = rem.length-1; - } else { - finish = true; - } - } - - return q; - } - - - // returns the ith nth-root of one - oneRoot(n, i) { - let nbits = log2(n-1)+1; - let res = this.F.one; - let r = i; - - if(i>=n) { - throw new Error("Given 'i' should be lower than 'n'"); - } - else if (1<0) { - if (r & 1 == 1) { - res = this.F.mul(res, this.w[nbits]); - } - r = r >> 1; - nbits --; - } - return res; - } - - computeVanishingPolinomial(bits, t) { - const m = 1 << bits; - return this.F.sub(this.F.pow(t, m), this.F.one); - } - - evaluateLagrangePolynomials(bits, t) { - const m= 1 << bits; - const tm = this.F.pow(t, m); - const u= new Array(m).fill(this.F.zero); - this._setRoots(bits); - const omega = this.w[bits]; - - if (this.F.eq(tm, this.F.one)) { - for (let i = 0; i < m; i++) { - if (this.F.eq(this.roots[bits][0],t)) { // i.e., t equals omega^i - u[i] = this.F.one; - return u; - } - } - } - - const z = this.F.sub(tm, this.F.one); - // let l = this.F.mul(z, this.F.pow(this.F.twoinv, m)); - let l = this.F.mul(z, this.F.inv(this.F.e(m))); - for (let i = 0; i < m; i++) { - u[i] = this.F.mul(l, this.F.inv(this.F.sub(t,this.roots[bits][i]))); - l = this.F.mul(l, omega); - } - - return u; - } - - log2(V) { - return log2(V); - } -} - -function log2( V ) -{ - return( ( ( V & 0xFFFF0000 ) !== 0 ? ( V &= 0xFFFF0000, 16 ) : 0 ) | ( ( V & 0xFF00FF00 ) !== 0 ? ( V &= 0xFF00FF00, 8 ) : 0 ) | ( ( V & 0xF0F0F0F0 ) !== 0 ? ( V &= 0xF0F0F0F0, 4 ) : 0 ) | ( ( V & 0xCCCCCCCC ) !== 0 ? ( V &= 0xCCCCCCCC, 2 ) : 0 ) | ( ( V & 0xAAAAAAAA ) !== 0 ) ); -} - - -function __fft(PF, pall, bits, offset, step) { - - const n = 1 << bits; - if (n==1) { - return [ pall[offset] ]; - } else if (n==2) { - return [ - PF.F.add(pall[offset], pall[offset + step]), - PF.F.sub(pall[offset], pall[offset + step])]; - } - - const ndiv2 = n >> 1; - const p1 = __fft(PF, pall, bits-1, offset, step*2); - const p2 = __fft(PF, pall, bits-1, offset+step, step*2); - - const out = new Array(n); - - for (let i=0; i> 1; - const p1 = __fft2(PF, pall.slice(0, ndiv2), bits-1); - const p2 = __fft2(PF, pall.slice(ndiv2), bits-1); - - const out = new Array(n); - - for (let i=0; i>=1; - } - return res; -} - -function rev(idx, bits) { - return ( - _revTable[idx >>> 24] | - (_revTable[(idx >>> 16) & 0xFF] << 8) | - (_revTable[(idx >>> 8) & 0xFF] << 16) | - (_revTable[idx & 0xFF] << 24) - ) >>> (32-bits); -} - -function __bitReverse(p, bits) { - for (let k=0; kk) { - const tmp= p[k]; - p[k] = p[r]; - p[r] = tmp; - } - } - -} - - - -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/futils.js -/* - Copyright 2018 0kims association. - - This file is part of snarkjs. - - snarkjs is a free software: you can redistribute it and/or - modify it under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your option) - any later version. - - snarkjs is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - snarkjs. If not, see . -*/ - - - - -function mulScalar(F, base, e) { - let res; - - if (Scalar.isZero(e)) return F.zero; - - const n = Scalar.naf(e); - - if (n[n.length-1] == 1) { - res = base; - } else if (n[n.length-1] == -1) { - res = F.neg(base); - } else { - throw new Error("invlaud NAF"); - } - - for (let i=n.length-2; i>=0; i--) { - - res = F.double(res); - - if (n[i] == 1) { - res = F.add(res, base); - } else if (n[i] == -1) { - res = F.sub(res, base); - } - } - - return res; -} - - -/* -exports.mulScalar = (F, base, e) =>{ - let res = F.zero; - let rem = bigInt(e); - let exp = base; - - while (! rem.eq(bigInt.zero)) { - if (rem.and(bigInt.one).eq(bigInt.one)) { - res = F.add(res, exp); - } - exp = F.double(exp); - rem = rem.shiftRight(1); - } - - return res; -}; -*/ - - -function futils_exp(F, base, e) { - - if (scalar_isZero(e)) return F.one; - - const n = scalar_bits(e); - - if (n.legth==0) return F.one; - - let res = base; - - for (let i=n.length-2; i>=0; i--) { - - res = F.square(res); - - if (n[i]) { - res = F.mul(res, base); - } - } - - return res; -} - - - -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/fsqrt.js - -// Check here: https://eprint.iacr.org/2012/685.pdf - -function fsqrt_buildSqrt (F) { - if ((F.m % 2) == 1) { - if (scalar_eq(scalar_mod(F.p, 4), 1 )) { - if (scalar_eq(scalar_mod(F.p, 8), 1 )) { - if (scalar_eq(scalar_mod(F.p, 16), 1 )) { - // alg7_muller(F); - alg5_tonelliShanks(F); - } else if (scalar_eq(scalar_mod(F.p, 16), 9 )) { - alg4_kong(F); - } else { - throw new Error("Field withot sqrt"); - } - } else if (scalar_eq(scalar_mod(F.p, 8), 5 )) { - alg3_atkin(F); - } else { - throw new Error("Field withot sqrt"); - } - } else if (scalar_eq(scalar_mod(F.p, 4), 3 )) { - alg2_shanks(F); - } - } else { - const pm2mod4 = scalar_mod(scalar_pow(F.p, F.m/2), 4); - if (pm2mod4 == 1) { - alg10_adj(F); - } else if (pm2mod4 == 3) { - alg9_adj(F); - } else { - alg8_complex(F); - } - - } -} - - -function alg5_tonelliShanks(F) { - F.sqrt_q = scalar_pow(F.p, F.m); - - F.sqrt_s = 0; - F.sqrt_t = scalar_sub(F.sqrt_q, 1); - - while (!scalar_isOdd(F.sqrt_t)) { - F.sqrt_s = F.sqrt_s + 1; - F.sqrt_t = scalar_div(F.sqrt_t, 2); - } - - let c0 = F.one; - - while (F.eq(c0, F.one)) { - const c = F.random(); - F.sqrt_z = F.pow(c, F.sqrt_t); - c0 = F.pow(F.sqrt_z, 2 ** (F.sqrt_s-1) ); - } - - F.sqrt_tm1d2 = scalar_div(scalar_sub(F.sqrt_t, 1),2); - - F.sqrt = function(a) { - const F=this; - if (F.isZero(a)) return F.zero; - let w = F.pow(a, F.sqrt_tm1d2); - const a0 = F.pow( F.mul(F.square(w), a), 2 ** (F.sqrt_s-1) ); - if (F.eq(a0, F.negone)) return null; - - let v = F.sqrt_s; - let x = F.mul(a, w); - let b = F.mul(x, w); - let z = F.sqrt_z; - while (!F.eq(b, F.one)) { - let b2k = F.square(b); - let k=1; - while (!F.eq(b2k, F.one)) { - b2k = F.square(b2k); - k++; - } - - w = z; - for (let i=0; i>> 0; - st[d] = (st[d] ^ st[a]) >>> 0; - st[d] = ((st[d] << 16) | ((st[d]>>>16) & 0xFFFF)) >>> 0; - - st[c] = (st[c] + st[d]) >>> 0; - st[b] = (st[b] ^ st[c]) >>> 0; - st[b] = ((st[b] << 12) | ((st[b]>>>20) & 0xFFF)) >>> 0; - - st[a] = (st[a] + st[b]) >>> 0; - st[d] = (st[d] ^ st[a]) >>> 0; - st[d] = ((st[d] << 8) | ((st[d]>>>24) & 0xFF)) >>> 0; - - st[c] = (st[c] + st[d]) >>> 0; - st[b] = (st[b] ^ st[c]) >>> 0; - st[b] = ((st[b] << 7) | ((st[b]>>>25) & 0x7F)) >>> 0; -} - -function doubleRound(st) { - quarterRound(st, 0, 4, 8,12); - quarterRound(st, 1, 5, 9,13); - quarterRound(st, 2, 6,10,14); - quarterRound(st, 3, 7,11,15); - - quarterRound(st, 0, 5,10,15); - quarterRound(st, 1, 6,11,12); - quarterRound(st, 2, 7, 8,13); - quarterRound(st, 3, 4, 9,14); -} - -class ChaCha { - - constructor(seed) { - seed = seed || [0,0,0,0,0,0,0,0]; - this.state = [ - 0x61707865, - 0x3320646E, - 0x79622D32, - 0x6B206574, - seed[0], - seed[1], - seed[2], - seed[3], - seed[4], - seed[5], - seed[6], - seed[7], - 0, - 0, - 0, - 0 - ]; - this.idx = 16; - this.buff = new Array(16); - } - - nextU32() { - if (this.idx == 16) this.update(); - return this.buff[this.idx++]; - } - - nextU64() { - return scalar_add(scalar_mul(this.nextU32(), 0x100000000), this.nextU32()); - } - - nextBool() { - return (this.nextU32() & 1) == 1; - } - - update() { - // Copy the state - for (let i=0; i<16; i++) this.buff[i] = this.state[i]; - - // Apply the rounds - for (let i=0; i<10; i++) doubleRound(this.buff); - - // Add to the initial - for (let i=0; i<16; i++) this.buff[i] = (this.buff[i] + this.state[i]) >>> 0; - - this.idx = 0; - - this.state[12] = (this.state[12] + 1) >>> 0; - if (this.state[12] != 0) return; - this.state[13] = (this.state[13] + 1) >>> 0; - if (this.state[13] != 0) return; - this.state[14] = (this.state[14] + 1) >>> 0; - if (this.state[14] != 0) return; - this.state[15] = (this.state[15] + 1) >>> 0; - } -} - -// EXTERNAL MODULE: ./node_modules/crypto-browserify/index.js -var crypto_browserify = __webpack_require__(91565); -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/random.js -/* provided dependency */ var process = __webpack_require__(65606); - - - -function getRandomBytes(n) { - let array = new Uint8Array(n); - if (process.browser) { // Browser - if (typeof globalThis.crypto !== "undefined") { // Supported - globalThis.crypto.getRandomValues(array); - } else { // fallback - for (let i=0; i>>0; - } - } - } - else { // NodeJS - crypto_browserify.randomFillSync(array); - } - return array; -} - -function getRandomSeed() { - const arr = getRandomBytes(32); - const arrV = new Uint32Array(arr.buffer); - const seed = []; - for (let i=0; i<8; i++) { - seed.push(arrV[i]); - } - return seed; -} - -let threadRng = null; - -function getThreadRng() { - if (threadRng) return threadRng; - threadRng = new ChaCha(getRandomSeed()); - return threadRng; -} - -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/f1field_native.js -/* global BigInt */ - - - - - -class ZqField { - constructor(p) { - this.type="F1"; - this.one = BigInt(1); - this.zero = BigInt(0); - this.p = BigInt(p); - this.m = 1; - this.negone = this.p-this.one; - this.two = BigInt(2); - this.half = this.p >> this.one; - this.bitLength = scalar_bitLength(this.p); - this.mask = (this.one << BigInt(this.bitLength)) - this.one; - - this.n64 = Math.floor((this.bitLength - 1) / 64)+1; - this.n32 = this.n64*2; - this.n8 = this.n64*8; - this.R = this.e(this.one << BigInt(this.n64*64)); - this.Ri = this.inv(this.R); - - const e = this.negone >> this.one; - this.nqr = this.two; - let r = this.pow(this.nqr, e); - while (!this.eq(r, this.negone)) { - this.nqr = this.nqr + this.one; - r = this.pow(this.nqr, e); - } - - - this.s = 0; - this.t = this.negone; - - while ((this.t & this.one) == this.zero) { - this.s = this.s + 1; - this.t = this.t >> this.one; - } - - this.nqr_to_t = this.pow(this.nqr, this.t); - - fsqrt_buildSqrt(this); - } - - e(a,b) { - let res; - if (!b) { - res = BigInt(a); - } else if (b==16) { - res = BigInt("0x"+a); - } - if (res < 0) { - let nres = -res; - if (nres >= this.p) nres = nres % this.p; - return this.p - nres; - } else { - return (res>= this.p) ? res%this.p : res; - } - - } - - add(a, b) { - const res = a + b; - return res >= this.p ? res-this.p : res; - } - - sub(a, b) { - return (a >= b) ? a-b : this.p-b+a; - } - - neg(a) { - return a ? this.p-a : a; - } - - mul(a, b) { - return (a*b)%this.p; - } - - mulScalar(base, s) { - return (base * this.e(s)) % this.p; - } - - square(a) { - return (a*a) % this.p; - } - - eq(a, b) { - return a==b; - } - - neq(a, b) { - return a!=b; - } - - lt(a, b) { - const aa = (a > this.half) ? a - this.p : a; - const bb = (b > this.half) ? b - this.p : b; - return aa < bb; - } - - gt(a, b) { - const aa = (a > this.half) ? a - this.p : a; - const bb = (b > this.half) ? b - this.p : b; - return aa > bb; - } - - leq(a, b) { - const aa = (a > this.half) ? a - this.p : a; - const bb = (b > this.half) ? b - this.p : b; - return aa <= bb; - } - - geq(a, b) { - const aa = (a > this.half) ? a - this.p : a; - const bb = (b > this.half) ? b - this.p : b; - return aa >= bb; - } - - div(a, b) { - return this.mul(a, this.inv(b)); - } - - idiv(a, b) { - if (!b) throw new Error("Division by zero"); - return a / b; - } - - inv(a) { - if (!a) throw new Error("Division by zero"); - - let t = this.zero; - let r = this.p; - let newt = this.one; - let newr = a % this.p; - while (newr) { - let q = r/newr; - [t, newt] = [newt, t-q*newt]; - [r, newr] = [newr, r-q*newr]; - } - if (t= this.p ? res-this.p : res; - } - - bor(a, b) { - const res = ((a | b) & this.mask); - return res >= this.p ? res-this.p : res; - } - - bxor(a, b) { - const res = ((a ^ b) & this.mask); - return res >= this.p ? res-this.p : res; - } - - bnot(a) { - const res = a ^ this.mask; - return res >= this.p ? res-this.p : res; - } - - shl(a, b) { - if (Number(b) < this.bitLength) { - const res = (a << b) & this.mask; - return res >= this.p ? res-this.p : res; - } else { - const nb = this.p - b; - if (Number(nb) < this.bitLength) { - return a >> nb; - } else { - return this.zero; - } - } - } - - shr(a, b) { - if (Number(b) < this.bitLength) { - return a >> b; - } else { - const nb = this.p - b; - if (Number(nb) < this.bitLength) { - const res = (a << nb) & this.mask; - return res >= this.p ? res-this.p : res; - } else { - return 0; - } - } - } - - land(a, b) { - return (a && b) ? this.one : this.zero; - } - - lor(a, b) { - return (a || b) ? this.one : this.zero; - } - - lnot(a) { - return (a) ? this.zero : this.one; - } - - sqrt_old(n) { - - if (n == this.zero) return this.zero; - - // Test that have solution - const res = this.pow(n, this.negone >> this.one); - if ( res != this.one ) return null; - - let m = this.s; - let c = this.nqr_to_t; - let t = this.pow(n, this.t); - let r = this.pow(n, this.add(this.t, this.one) >> this.one ); - - while ( t != this.one ) { - let sq = this.square(t); - let i = 1; - while (sq != this.one ) { - i++; - sq = this.square(sq); - } - - // b = c ^ m-i-1 - let b = c; - for (let j=0; j< m-i-1; j ++) b = this.square(b); - - m = i; - c = this.square(b); - t = this.mul(t, c); - r = this.mul(r, b); - } - - if (r > (this.p >> this.one)) { - r = this.neg(r); - } - - return r; - } - - normalize(a, b) { - a = BigInt(a,b); - if (a < 0) { - let na = -a; - if (na >= this.p) na = na % this.p; - return this.p - na; - } else { - return (a>= this.p) ? a%this.p : a; - } - } - - random() { - const nBytes = (this.bitLength*2 / 8); - let res =this.zero; - for (let i=0; i this.half) { - const v = this.p-a; - vs = "-"+v.toString(base); - } else { - vs = a.toString(base); - } - return vs; - } - - isZero(a) { - return a == this.zero; - } - - fromRng(rng) { - let v; - do { - v=this.zero; - for (let i=0; i= this.p); - v = (v * this.Ri) % this.p; // Convert from montgomery - return v; - } - -} - - -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/f1field_bigint.js - - - - -class f1field_bigint_ZqField { - constructor(p) { - this.type="F1"; - this.one = BigInteger.one; - this.zero = BigInteger.zero; - this.p = BigInteger(p); - this.m = 1; - this.negone = this.p.minus(BigInteger.one); - this.two = BigInteger(2); - this.half = this.p.shiftRight(1); - this.bitLength = this.p.bitLength(); - this.mask = BigInteger.one.shiftLeft(this.bitLength).minus(BigInteger.one); - - this.n64 = Math.floor((this.bitLength - 1) / 64)+1; - this.n32 = this.n64*2; - this.n8 = this.n64*8; - this.R = BigInteger.one.shiftLeft(this.n64*64); - this.Ri = this.inv(this.R); - - const e = this.negone.shiftRight(this.one); - this.nqr = this.two; - let r = this.pow(this.nqr, e); - while (!r.equals(this.negone)) { - this.nqr = this.nqr.add(this.one); - r = this.pow(this.nqr, e); - } - - this.s = this.zero; - this.t = this.negone; - - while (!this.t.isOdd()) { - this.s = this.s.add(this.one); - this.t = this.t.shiftRight(this.one); - } - - this.nqr_to_t = this.pow(this.nqr, this.t); - - fsqrt_buildSqrt(this); - } - - e(a,b) { - - const res = BigInteger(a,b); - - return this.normalize(res); - - } - - add(a, b) { - let res = a.add(b); - if (res.geq(this.p)) { - res = res.minus(this.p); - } - return res; - } - - sub(a, b) { - if (a.geq(b)) { - return a.minus(b); - } else { - return this.p.minus(b.minus(a)); - } - } - - neg(a) { - if (a.isZero()) return a; - return this.p.minus(a); - } - - mul(a, b) { - return a.times(b).mod(this.p); - } - - mulScalar(base, s) { - return base.times(BigInteger(s)).mod(this.p); - } - - square(a) { - return a.square().mod(this.p); - } - - eq(a, b) { - return a.eq(b); - } - - neq(a, b) { - return a.neq(b); - } - - lt(a, b) { - const aa = a.gt(this.half) ? a.minus(this.p) : a; - const bb = b.gt(this.half) ? b.minus(this.p) : b; - return aa.lt(bb); - } - - gt(a, b) { - const aa = a.gt(this.half) ? a.minus(this.p) : a; - const bb = b.gt(this.half) ? b.minus(this.p) : b; - return aa.gt(bb); - } - - leq(a, b) { - const aa = a.gt(this.half) ? a.minus(this.p) : a; - const bb = b.gt(this.half) ? b.minus(this.p) : b; - return aa.leq(bb); - } - - geq(a, b) { - const aa = a.gt(this.half) ? a.minus(this.p) : a; - const bb = b.gt(this.half) ? b.minus(this.p) : b; - return aa.geq(bb); - } - - div(a, b) { - if (b.isZero()) throw new Error("Division by zero"); - return a.times(b.modInv(this.p)).mod(this.p); - } - - idiv(a, b) { - if (b.isZero()) throw new Error("Division by zero"); - return a.divide(b); - } - - inv(a) { - if (a.isZero()) throw new Error("Division by zero"); - return a.modInv(this.p); - } - - mod(a, b) { - return a.mod(b); - } - - pow(a, b) { - return a.modPow(b, this.p); - } - - exp(a, b) { - return a.modPow(b, this.p); - } - - band(a, b) { - return a.and(b).and(this.mask).mod(this.p); - } - - bor(a, b) { - return a.or(b).and(this.mask).mod(this.p); - } - - bxor(a, b) { - return a.xor(b).and(this.mask).mod(this.p); - } - - bnot(a) { - return a.xor(this.mask).mod(this.p); - } - - shl(a, b) { - if (b.lt(this.bitLength)) { - return a.shiftLeft(b).and(this.mask).mod(this.p); - } else { - const nb = this.p.minus(b); - if (nb.lt(this.bitLength)) { - return this.shr(a, nb); - } else { - return BigInteger.zero; - } - } - } - - shr(a, b) { - if (b.lt(this.bitLength)) { - return a.shiftRight(b); - } else { - const nb = this.p.minus(b); - if (nb.lt(this.bitLength)) { - return this.shl(a, nb); - } else { - return BigInteger.zero; - } - } - } - - land(a, b) { - return (a.isZero() || b.isZero()) ? BigInteger.zero : BigInteger.one; - } - - lor(a, b) { - return (a.isZero() && b.isZero()) ? BigInteger.zero : BigInteger.one; - } - - lnot(a) { - return a.isZero() ? BigInteger.one : BigInteger.zero; - } - - sqrt_old(n) { - - if (n.equals(this.zero)) return this.zero; - - // Test that have solution - const res = this.pow(n, this.negone.shiftRight(this.one)); - if (!res.equals(this.one)) return null; - - let m = parseInt(this.s); - let c = this.nqr_to_t; - let t = this.pow(n, this.t); - let r = this.pow(n, this.add(this.t, this.one).shiftRight(this.one) ); - - while (!t.equals(this.one)) { - let sq = this.square(t); - let i = 1; - while (!sq.equals(this.one)) { - i++; - sq = this.square(sq); - } - - // b = c ^ m-i-1 - let b = c; - for (let j=0; j< m-i-1; j ++) b = this.square(b); - - m = i; - c = this.square(b); - t = this.mul(t, c); - r = this.mul(r, b); - } - - if (r.greater(this.p.shiftRight(this.one))) { - r = this.neg(r); - } - - return r; - } - - normalize(a) { - a = BigInteger(a); - if (a.isNegative()) { - return this.p.minus(a.abs().mod(this.p)); - } else { - return a.mod(this.p); - } - } - - random() { - let res = BigInteger(0); - let n = BigInteger(this.p.square()); - while (!n.isZero()) { - res = res.shiftLeft(8).add(BigInteger(getRandomBytes(1)[0])); - n = n.shiftRight(8); - } - return res.mod(this.p); - } - - toString(a, base) { - let vs; - if (!a.lesserOrEquals(this.p.shiftRight(BigInteger(1)))) { - const v = this.p.minus(a); - vs = "-"+v.toString(base); - } else { - vs = a.toString(base); - } - - return vs; - } - - isZero(a) { - return a.isZero(); - } - - fromRng(rng) { - let v; - do { - v = BigInteger(0); - for (let i=0; i. -*/ - - - - -class F2Field { - constructor(F, nonResidue) { - this.type="F2"; - this.F = F; - this.zero = [this.F.zero, this.F.zero]; - this.one = [this.F.one, this.F.zero]; - this.negone = this.neg(this.one); - this.nonResidue = nonResidue; - this.m = F.m*2; - this.p = F.p; - this.n64 = F.n64*2; - this.n32 = this.n64*2; - this.n8 = this.n64*8; - - buildSqrt(this); - } - - _mulByNonResidue(a) { - return this.F.mul(this.nonResidue, a); - } - - copy(a) { - return [this.F.copy(a[0]), this.F.copy(a[1])]; - } - - add(a, b) { - return [ - this.F.add(a[0], b[0]), - this.F.add(a[1], b[1]) - ]; - } - - double(a) { - return this.add(a,a); - } - - sub(a, b) { - return [ - this.F.sub(a[0], b[0]), - this.F.sub(a[1], b[1]) - ]; - } - - neg(a) { - return this.sub(this.zero, a); - } - - conjugate(a) { - return [ - a[0], - this.F.neg(a[1]) - ]; - } - - mul(a, b) { - const aA = this.F.mul(a[0] , b[0]); - const bB = this.F.mul(a[1] , b[1]); - - return [ - this.F.add( aA , this._mulByNonResidue(bB)), - this.F.sub( - this.F.mul( - this.F.add(a[0], a[1]), - this.F.add(b[0], b[1])), - this.F.add(aA, bB))]; - } - - inv(a) { - const t0 = this.F.square(a[0]); - const t1 = this.F.square(a[1]); - const t2 = this.F.sub(t0, this._mulByNonResidue(t1)); - const t3 = this.F.inv(t2); - return [ - this.F.mul(a[0], t3), - this.F.neg(this.F.mul( a[1], t3)) ]; - } - - div(a, b) { - return this.mul(a, this.inv(b)); - } - - square(a) { - const ab = this.F.mul(a[0] , a[1]); - - /* - [ - (a + b) * (a + non_residue * b) - ab - non_residue * ab, - ab + ab - ]; - */ - - return [ - this.F.sub( - this.F.mul( - this.F.add(a[0], a[1]) , - this.F.add( - a[0] , - this._mulByNonResidue(a[1]))), - this.F.add( - ab, - this._mulByNonResidue(ab))), - this.F.add(ab, ab) - ]; - } - - isZero(a) { - return this.F.isZero(a[0]) && this.F.isZero(a[1]); - } - - eq(a, b) { - return this.F.eq(a[0], b[0]) && this.F.eq(a[1], b[1]); - } - - mulScalar(base, e) { - return fUtils.mulScalar(this, base, e); - } - - pow(base, e) { - return fUtils.exp(this, base, e); - } - - exp(base, e) { - return fUtils.exp(this, base, e); - } - - toString(a) { - return `[ ${this.F.toString(a[0])} , ${this.F.toString(a[1])} ]`; - } - - fromRng(rng) { - const c0 = this.F.fromRng(rng); - const c1 = this.F.fromRng(rng); - return [c0, c1]; - } - - gt(a, b) { - if (this.F.gt(a[0], b[0])) return true; - if (this.F.gt(b[0], a[0])) return false; - if (this.F.gt(a[1], b[1])) return true; - return false; - } - - geq(a, b) { - return this.gt(a, b) || this.eq(a, b); - } - - lt(a, b) { - return !this.geq(a,b); - } - - leq(a, b) { - return !this.gt(a,b); - } - - neq(a, b) { - return !this.eq(a,b); - } - - random() { - return [this.F.random(), this.F.random()]; - } - - - toRprLE(buff, o, e) { - this.F.toRprLE(buff, o, e[0]); - this.F.toRprLE(buff, o+this.F.n8, e[1]); - } - - toRprBE(buff, o, e) { - this.F.toRprBE(buff, o, e[1]); - this.F.toRprBE(buff, o+this.F.n8, e[0]); - } - - toRprLEM(buff, o, e) { - this.F.toRprLEM(buff, o, e[0]); - this.F.toRprLEM(buff, o+this.F.n8, e[1]); - } - - - toRprBEM(buff, o, e) { - this.F.toRprBEM(buff, o, e[1]); - this.F.toRprBEM(buff, o+this.F.n8, e[0]); - } - - fromRprLE(buff, o) { - o = o || 0; - const c0 = this.F.fromRprLE(buff, o); - const c1 = this.F.fromRprLE(buff, o+this.F.n8); - return [c0, c1]; - } - - fromRprBE(buff, o) { - o = o || 0; - const c1 = this.F.fromRprBE(buff, o); - const c0 = this.F.fromRprBE(buff, o+this.F.n8); - return [c0, c1]; - } - - fromRprLEM(buff, o) { - o = o || 0; - const c0 = this.F.fromRprLEM(buff, o); - const c1 = this.F.fromRprLEM(buff, o+this.F.n8); - return [c0, c1]; - } - - fromRprBEM(buff, o) { - o = o || 0; - const c1 = this.F.fromRprBEM(buff, o); - const c0 = this.F.fromRprBEM(buff, o+this.F.n8); - return [c0, c1]; - } - -} - - -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/f3field.js -/* - Copyright 2018 0kims association. - - This file is part of snarkjs. - - snarkjs is a free software: you can redistribute it and/or - modify it under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your option) - any later version. - - snarkjs is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - snarkjs. If not, see . -*/ - - - -class F3Field { - constructor(F, nonResidue) { - this.type="F3"; - this.F = F; - this.zero = [this.F.zero, this.F.zero, this.F.zero]; - this.one = [this.F.one, this.F.zero, this.F.zero]; - this.negone = this.neg(this.one); - this.nonResidue = nonResidue; - this.m = F.m*3; - this.p = F.p; - this.n64 = F.n64*3; - this.n32 = this.n64*2; - this.n8 = this.n64*8; - } - - _mulByNonResidue(a) { - return this.F.mul(this.nonResidue, a); - } - - copy(a) { - return [this.F.copy(a[0]), this.F.copy(a[1]), this.F.copy(a[2])]; - } - - add(a, b) { - return [ - this.F.add(a[0], b[0]), - this.F.add(a[1], b[1]), - this.F.add(a[2], b[2]) - ]; - } - - double(a) { - return this.add(a,a); - } - - sub(a, b) { - return [ - this.F.sub(a[0], b[0]), - this.F.sub(a[1], b[1]), - this.F.sub(a[2], b[2]) - ]; - } - - neg(a) { - return this.sub(this.zero, a); - } - - mul(a, b) { - - const aA = this.F.mul(a[0] , b[0]); - const bB = this.F.mul(a[1] , b[1]); - const cC = this.F.mul(a[2] , b[2]); - - return [ - this.F.add( - aA, - this._mulByNonResidue( - this.F.sub( - this.F.mul( - this.F.add(a[1], a[2]), - this.F.add(b[1], b[2])), - this.F.add(bB, cC)))), // aA + non_residue*((b+c)*(B+C)-bB-cC), - - this.F.add( - this.F.sub( - this.F.mul( - this.F.add(a[0], a[1]), - this.F.add(b[0], b[1])), - this.F.add(aA, bB)), - this._mulByNonResidue( cC)), // (a+b)*(A+B)-aA-bB+non_residue*cC - - this.F.add( - this.F.sub( - this.F.mul( - this.F.add(a[0], a[2]), - this.F.add(b[0], b[2])), - this.F.add(aA, cC)), - bB)]; // (a+c)*(A+C)-aA+bB-cC) - } - - inv(a) { - const t0 = this.F.square(a[0]); // t0 = a^2 ; - const t1 = this.F.square(a[1]); // t1 = b^2 ; - const t2 = this.F.square(a[2]); // t2 = c^2; - const t3 = this.F.mul(a[0],a[1]); // t3 = ab - const t4 = this.F.mul(a[0],a[2]); // t4 = ac - const t5 = this.F.mul(a[1],a[2]); // t5 = bc; - // c0 = t0 - non_residue * t5; - const c0 = this.F.sub(t0, this._mulByNonResidue(t5)); - // c1 = non_residue * t2 - t3; - const c1 = this.F.sub(this._mulByNonResidue(t2), t3); - const c2 = this.F.sub(t1, t4); // c2 = t1-t4 - - // t6 = (a * c0 + non_residue * (c * c1 + b * c2)).inv(); - const t6 = - this.F.inv( - this.F.add( - this.F.mul(a[0], c0), - this._mulByNonResidue( - this.F.add( - this.F.mul(a[2], c1), - this.F.mul(a[1], c2))))); - - return [ - this.F.mul(t6, c0), // t6*c0 - this.F.mul(t6, c1), // t6*c1 - this.F.mul(t6, c2)]; // t6*c2 - } - - div(a, b) { - return this.mul(a, this.inv(b)); - } - - square(a) { - const s0 = this.F.square(a[0]); // s0 = a^2 - const ab = this.F.mul(a[0], a[1]); // ab = a*b - const s1 = this.F.add(ab, ab); // s1 = 2ab; - const s2 = this.F.square( - this.F.add(this.F.sub(a[0],a[1]), a[2])); // s2 = (a - b + c)^2; - const bc = this.F.mul(a[1],a[2]); // bc = b*c - const s3 = this.F.add(bc, bc); // s3 = 2*bc - const s4 = this.F.square(a[2]); // s4 = c^2 - - - return [ - this.F.add( - s0, - this._mulByNonResidue(s3)), // s0 + non_residue * s3, - this.F.add( - s1, - this._mulByNonResidue(s4)), // s1 + non_residue * s4, - this.F.sub( - this.F.add( this.F.add(s1, s2) , s3 ), - this.F.add(s0, s4))]; // s1 + s2 + s3 - s0 - s4 - } - - isZero(a) { - return this.F.isZero(a[0]) && this.F.isZero(a[1]) && this.F.isZero(a[2]); - } - - eq(a, b) { - return this.F.eq(a[0], b[0]) && this.F.eq(a[1], b[1]) && this.F.eq(a[2], b[2]); - } - - affine(a) { - return [this.F.affine(a[0]), this.F.affine(a[1]), this.F.affine(a[2])]; - } - - mulScalar(base, e) { - return fUtils.mulScalar(this, base, e); - } - - pow(base, e) { - return fUtils.exp(this, base, e); - } - - exp(base, e) { - return fUtils.exp(this, base, e); - } - - toString(a) { - return `[ ${this.F.toString(a[0])} , ${this.F.toString(a[1])}, ${this.F.toString(a[2])} ]`; - } - - fromRng(rng) { - const c0 = this.F.fromRng(rng); - const c1 = this.F.fromRng(rng); - const c2 = this.F.fromRng(rng); - return [c0, c1, c2]; - } - - gt(a, b) { - if (this.F.gt(a[0], b[0])) return true; - if (this.F.gt(b[0], a[0])) return false; - if (this.F.gt(a[1], b[1])) return true; - if (this.F.gt(b[1], a[1])) return false; - if (this.F.gt(a[2], b[2])) return true; - return false; - } - - - geq(a, b) { - return this.gt(a, b) || this.eq(a, b); - } - - lt(a, b) { - return !this.geq(a,b); - } - - leq(a, b) { - return !this.gt(a,b); - } - - neq(a, b) { - return !this.eq(a,b); - } - - random() { - return [this.F.random(), this.F.random(), this.F.random()]; - } - - - toRprLE(buff, o, e) { - this.F.toRprLE(buff, o, e[0]); - this.F.toRprLE(buff, o+this.F.n8, e[1]); - this.F.toRprLE(buff, o+this.F.n8*2, e[2]); - } - - toRprBE(buff, o, e) { - this.F.toRprBE(buff, o, e[2]); - this.F.toRprBE(buff, o+this.F.n8, e[1]); - this.F.toRprBE(buff, o+this.F.n8*2, e[0]); - } - - toRprLEM(buff, o, e) { - this.F.toRprLEM(buff, o, e[0]); - this.F.toRprLEM(buff, o+this.F.n8, e[1]); - this.F.toRprLEM(buff, o+this.F.n8*2, e[2]); - } - - - toRprBEM(buff, o, e) { - this.F.toRprBEM(buff, o, e[2]); - this.F.toRprBEM(buff, o+this.F.n8, e[1]); - this.F.toRprBEM(buff, o+this.F.n8*2, e[0]); - } - - fromRprLE(buff, o) { - o = o || 0; - const c0 = this.F.fromRprLE(buff, o); - const c1 = this.F.fromRprLE(buff, o+this.n8); - const c2 = this.F.fromRprLE(buff, o+this.n8*2); - return [c0, c1, c2]; - } - - fromRprBE(buff, o) { - o = o || 0; - const c2 = this.F.fromRprBE(buff, o); - const c1 = this.F.fromRprBE(buff, o+this.n8); - const c0 = this.F.fromRprBE(buff, o+this.n8*2); - return [c0, c1, c2]; - } - - fromRprLEM(buff, o) { - o = o || 0; - const c0 = this.F.fromRprLEM(buff, o); - const c1 = this.F.fromRprLEM(buff, o+this.n8); - const c2 = this.F.fromRprLEM(buff, o+this.n8*2); - return [c0, c1, c2]; - } - - fromRprBEM(buff, o) { - o = o || 0; - const c2 = this.F.fromRprBEM(buff, o); - const c1 = this.F.fromRprBEM(buff, o+this.n8); - const c0 = this.F.fromRprBEM(buff, o+this.n8*2); - return [c0, c1, c2]; - } - -} - -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/ec.js -/* - Copyright 2018 0kims association. - - This file is part of snarkjs. - - snarkjs is a free software: you can redistribute it and/or - modify it under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your option) - any later version. - - snarkjs is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - snarkjs. If not, see . -*/ - - - - - - - -function isGreatest(F, a) { - if (Array.isArray(a)) { - for (let i=a.length-1; i>=0; i--) { - if (!F.F.isZero(a[i])) { - return isGreatest(F.F, a[i]); - } - } - return 0; - } else { - const na = F.neg(a); - return Scalar.gt(a, na); - } -} - - -class EC { - - constructor(F, g) { - this.F = F; - this.g = g; - if (this.g.length == 2) this.g[2] = this.F.one; - this.zero = [this.F.zero, this.F.one, this.F.zero]; - } - - add(p1, p2) { - - const F = this.F; - - if (this.eq(p1, this.zero)) return p2; - if (this.eq(p2, this.zero)) return p1; - - const res = new Array(3); - - const Z1Z1 = F.square( p1[2] ); - const Z2Z2 = F.square( p2[2] ); - - const U1 = F.mul( p1[0] , Z2Z2 ); // U1 = X1 * Z2Z2 - const U2 = F.mul( p2[0] , Z1Z1 ); // U2 = X2 * Z1Z1 - - const Z1_cubed = F.mul( p1[2] , Z1Z1); - const Z2_cubed = F.mul( p2[2] , Z2Z2); - - const S1 = F.mul( p1[1] , Z2_cubed); // S1 = Y1 * Z2 * Z2Z2 - const S2 = F.mul( p2[1] , Z1_cubed); // S2 = Y2 * Z1 * Z1Z1 - - if (F.eq(U1,U2) && F.eq(S1,S2)) { - return this.double(p1); - } - - const H = F.sub( U2 , U1 ); // H = U2-U1 - - const S2_minus_S1 = F.sub( S2 , S1 ); - - const I = F.square( F.add(H,H) ); // I = (2 * H)^2 - const J = F.mul( H , I ); // J = H * I - - const r = F.add( S2_minus_S1 , S2_minus_S1 ); // r = 2 * (S2-S1) - const V = F.mul( U1 , I ); // V = U1 * I - - res[0] = - F.sub( - F.sub( F.square(r) , J ), - F.add( V , V )); // X3 = r^2 - J - 2 * V - - const S1_J = F.mul( S1 , J ); - - res[1] = - F.sub( - F.mul( r , F.sub(V,res[0])), - F.add( S1_J,S1_J )); // Y3 = r * (V-X3)-2 S1 J - - res[2] = - F.mul( - H, - F.sub( - F.square( F.add(p1[2],p2[2]) ), - F.add( Z1Z1 , Z2Z2 ))); // Z3 = ((Z1+Z2)^2-Z1Z1-Z2Z2) * H - - return res; - } - - neg(p) { - return [p[0], this.F.neg(p[1]), p[2]]; - } - - sub(a, b) { - return this.add(a, this.neg(b)); - } - - double(p) { - const F = this.F; - - const res = new Array(3); - - if (this.eq(p, this.zero)) return p; - - const A = F.square( p[0] ); // A = X1^2 - const B = F.square( p[1] ); // B = Y1^2 - const C = F.square( B ); // C = B^2 - - let D = - F.sub( - F.square( F.add(p[0] , B )), - F.add( A , C)); - D = F.add(D,D); // D = 2 * ((X1 + B)^2 - A - C) - - const E = F.add( F.add(A,A), A); // E = 3 * A - const FF =F.square( E ); // F = E^2 - - res[0] = F.sub( FF , F.add(D,D) ); // X3 = F - 2 D - - let eightC = F.add( C , C ); - eightC = F.add( eightC , eightC ); - eightC = F.add( eightC , eightC ); - - res[1] = - F.sub( - F.mul( - E, - F.sub( D, res[0] )), - eightC); // Y3 = E * (D - X3) - 8 * C - - const Y1Z1 = F.mul( p[1] , p[2] ); - res[2] = F.add( Y1Z1 , Y1Z1 ); // Z3 = 2 * Y1 * Z1 - - return res; - } - - timesScalar(base, e) { - return fUtils.mulScalar(this, base, e); - } - - mulScalar(base, e) { - return fUtils.mulScalar(this, base, e); - } - - affine(p) { - const F = this.F; - if (this.isZero(p)) { - return this.zero; - } else if (F.eq(p[2], F.one)) { - return p; - } else { - const Z_inv = F.inv(p[2]); - const Z2_inv = F.square(Z_inv); - const Z3_inv = F.mul(Z2_inv, Z_inv); - - const res = new Array(3); - res[0] = F.mul(p[0],Z2_inv); - res[1] = F.mul(p[1],Z3_inv); - res[2] = F.one; - - return res; - } - } - - multiAffine(arr) { - const keys = Object.keys(arr); - const F = this.F; - const accMul = new Array(keys.length+1); - accMul[0] = F.one; - for (let i = 0; i< keys.length; i++) { - if (F.eq(arr[keys[i]][2], F.zero)) { - accMul[i+1] = accMul[i]; - } else { - accMul[i+1] = F.mul(accMul[i], arr[keys[i]][2]); - } - } - - accMul[keys.length] = F.inv(accMul[keys.length]); - - for (let i = keys.length-1; i>=0; i--) { - if (F.eq(arr[keys[i]][2], F.zero)) { - accMul[i] = accMul[i+1]; - arr[keys[i]] = this.zero; - } else { - const Z_inv = F.mul(accMul[i], accMul[i+1]); - accMul[i] = F.mul(arr[keys[i]][2], accMul[i+1]); - - const Z2_inv = F.square(Z_inv); - const Z3_inv = F.mul(Z2_inv, Z_inv); - - arr[keys[i]][0] = F.mul(arr[keys[i]][0],Z2_inv); - arr[keys[i]][1] = F.mul(arr[keys[i]][1],Z3_inv); - arr[keys[i]][2] = F.one; - } - } - - } - - eq(p1, p2) { - const F = this.F; - - if (this.F.eq(p1[2], this.F.zero)) return this.F.eq(p2[2], this.F.zero); - if (this.F.eq(p2[2], this.F.zero)) return false; - - const Z1Z1 = F.square( p1[2] ); - const Z2Z2 = F.square( p2[2] ); - - const U1 = F.mul( p1[0] , Z2Z2 ); - const U2 = F.mul( p2[0] , Z1Z1 ); - - const Z1_cubed = F.mul( p1[2] , Z1Z1); - const Z2_cubed = F.mul( p2[2] , Z2Z2); - - const S1 = F.mul( p1[1] , Z2_cubed); - const S2 = F.mul( p2[1] , Z1_cubed); - - return (F.eq(U1,U2) && F.eq(S1,S2)); - } - - isZero(p) { - return this.F.isZero(p[2]); - } - - toString(p) { - const cp = this.affine(p); - return `[ ${this.F.toString(cp[0])} , ${this.F.toString(cp[1])} ]`; - } - - fromRng(rng) { - const F = this.F; - let P = []; - let greatest; - do { - P[0] = F.fromRng(rng); - greatest = rng.nextBool(); - const x3b = F.add(F.mul(F.square(P[0]), P[0]), this.b); - P[1] = F.sqrt(x3b); - } while ((P[1] == null)||(F.isZero[P])); - - const s = isGreatest(F, P[1]); - if (greatest ^ s) P[1] = F.neg(P[1]); - P[2] = F.one; - - if (this.cofactor) { - P = this.mulScalar(P, this.cofactor); - } - - P = this.affine(P); - - return P; - - } - - toRprLE(buff, o, p) { - p = this.affine(p); - if (this.isZero(p)) { - const BuffV = new Uint8Array(buff, o, this.F.n8*2); - BuffV.fill(0); - return; - } - this.F.toRprLE(buff, o, p[0]); - this.F.toRprLE(buff, o+this.F.n8, p[1]); - } - - toRprBE(buff, o, p) { - p = this.affine(p); - if (this.isZero(p)) { - const BuffV = new Uint8Array(buff, o, this.F.n8*2); - BuffV.fill(0); - return; - } - this.F.toRprBE(buff, o, p[0]); - this.F.toRprBE(buff, o+this.F.n8, p[1]); - } - - toRprLEM(buff, o, p) { - p = this.affine(p); - if (this.isZero(p)) { - const BuffV = new Uint8Array(buff, o, this.F.n8*2); - BuffV.fill(0); - return; - } - this.F.toRprLEM(buff, o, p[0]); - this.F.toRprLEM(buff, o+this.F.n8, p[1]); - } - - toRprLEJM(buff, o, p) { - p = this.affine(p); - if (this.isZero(p)) { - const BuffV = new Uint8Array(buff, o, this.F.n8*2); - BuffV.fill(0); - return; - } - this.F.toRprLEM(buff, o, p[0]); - this.F.toRprLEM(buff, o+this.F.n8, p[1]); - this.F.toRprLEM(buff, o+2*this.F.n8, p[2]); - } - - - toRprBEM(buff, o, p) { - p = this.affine(p); - if (this.isZero(p)) { - const BuffV = new Uint8Array(buff, o, this.F.n8*2); - BuffV.fill(0); - return; - } - this.F.toRprBEM(buff, o, p[0]); - this.F.toRprBEM(buff, o+this.F.n8, p[1]); - } - - fromRprLE(buff, o) { - o = o || 0; - const x = this.F.fromRprLE(buff, o); - const y = this.F.fromRprLE(buff, o+this.F.n8); - if (this.F.isZero(x) && this.F.isZero(y)) { - return this.zero; - } - return [x, y, this.F.one]; - } - - fromRprBE(buff, o) { - o = o || 0; - const x = this.F.fromRprBE(buff, o); - const y = this.F.fromRprBE(buff, o+this.F.n8); - if (this.F.isZero(x) && this.F.isZero(y)) { - return this.zero; - } - return [x, y, this.F.one]; - } - - fromRprLEM(buff, o) { - o = o || 0; - const x = this.F.fromRprLEM(buff, o); - const y = this.F.fromRprLEM(buff, o+this.F.n8); - if (this.F.isZero(x) && this.F.isZero(y)) { - return this.zero; - } - return [x, y, this.F.one]; - } - - fromRprLEJM(buff, o) { - o = o || 0; - const x = this.F.fromRprLEM(buff, o); - const y = this.F.fromRprLEM(buff, o+this.F.n8); - const z = this.F.fromRprLEM(buff, o+this.F.n8*2); - if (this.F.isZero(x) && this.F.isZero(y)) { - return this.zero; - } - return [x, y, z]; - } - - fromRprBEM(buff, o) { - o = o || 0; - const x = this.F.fromRprBEM(buff, o); - const y = this.F.fromRprBEM(buff, o+this.F.n8); - if (this.F.isZero(x) && this.F.isZero(y)) { - return this.zero; - } - return [x, y, this.F.one]; - } - - fromRprCompressed(buff, o) { - const F = this.F; - const v = new Uint8Array(buff.buffer, o, F.n8); - if (v[0] & 0x40) return this.zero; - const P = new Array(3); - - const greatest = ((v[0] & 0x80) != 0); - v[0] = v[0] & 0x7F; - P[0] = F.fromRprBE(buff, o); - if (greatest) v[0] = v[0] | 0x80; // set back again the old value - - const x3b = F.add(F.mul(F.square(P[0]), P[0]), this.b); - P[1] = F.sqrt(x3b); - - if (P[1] === null) { - throw new Error("Invalid Point!"); - } - - const s = isGreatest(F, P[1]); - if (greatest ^ s) P[1] = F.neg(P[1]); - P[2] = F.one; - - return P; - } - - toRprCompressed(buff, o, p) { - p = this.affine(p); - const v = new Uint8Array(buff.buffer, o, this.F.n8); - if (this.isZero(p)) { - v.fill(0); - v[0] = 0x40; - return; - } - this.F.toRprBE(buff, o, p[0]); - - if (isGreatest(this.F, p[1])) { - v[0] = v[0] | 0x80; - } - } - - - fromRprUncompressed(buff, o) { - if (buff[0] & 0x40) return this.zero; - - return this.fromRprBE(buff, o); - } - - toRprUncompressed(buff, o, p) { - this.toRprBE(buff, o, p); - - if (this.isZero(p)) { - buff[o] = buff[o] | 0x40; - } - } - - -} - - - -// EXTERNAL MODULE: ./node_modules/wasmcurves/index.js -var wasmcurves = __webpack_require__(70189); -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/utils_native.js -/* global BigInt */ - function stringifyBigInts(o) { - if ((typeof(o) == "bigint") || o.eq !== undefined) { + if (typeof o == "bigint" || o.eq !== undefined) { return o.toString(10); } else if (o instanceof Uint8Array) { return fromRprLE(o, 0); @@ -127090,7 +165954,7 @@ function stringifyBigInts(o) { } else if (typeof o == "object") { const res = {}; const keys = Object.keys(o); - keys.forEach( (k) => { + keys.forEach((k) => { res[k] = stringifyBigInts(o[k]); }); return res; @@ -127100,17 +165964,17 @@ function stringifyBigInts(o) { } function unstringifyBigInts(o) { - if ((typeof(o) == "string") && (/^[0-9]+$/.test(o) )) { + if (typeof o == "string" && /^[0-9]+$/.test(o)) { return BigInt(o); - } else if ((typeof(o) == "string") && (/^0x[0-9a-fA-F]+$/.test(o) )) { + } else if (typeof o == "string" && /^0x[0-9a-fA-F]+$/.test(o)) { return BigInt(o); } else if (Array.isArray(o)) { return o.map(unstringifyBigInts); } else if (typeof o == "object") { - if (o===null) return null; + if (o === null) return null; const res = {}; const keys = Object.keys(o); - keys.forEach( (k) => { + keys.forEach((k) => { res[k] = unstringifyBigInts(o[k]); }); return res; @@ -127124,18 +165988,18 @@ function beBuff2int(buff) { let i = buff.length; let offset = 0; const buffV = new DataView(buff.buffer, buff.byteOffset, buff.byteLength); - while (i>0) { + while (i > 0) { if (i >= 4) { i -= 4; - res += BigInt(buffV.getUint32(i)) << BigInt(offset*8); + res += BigInt(buffV.getUint32(i)) << BigInt(offset * 8); offset += 4; } else if (i >= 2) { i -= 2; - res += BigInt(buffV.getUint16(i)) << BigInt(offset*8); + res += BigInt(buffV.getUint16(i)) << BigInt(offset * 8); offset += 2; } else { i -= 1; - res += BigInt(buffV.getUint8(i)) << BigInt(offset*8); + res += BigInt(buffV.getUint8(i)) << BigInt(offset * 8); offset += 1; } } @@ -127148,17 +166012,17 @@ function beInt2Buff(n, len) { const buffV = new DataView(buff.buffer); let o = len; while (o > 0) { - if (o-4 >= 0) { + if (o - 4 >= 0) { o -= 4; - buffV.setUint32(o, Number(r & BigInt(0xFFFFFFFF))); + buffV.setUint32(o, Number(r & BigInt(0xffffffff))); r = r >> BigInt(32); - } else if (o-2 >= 0) { + } else if (o - 2 >= 0) { o -= 2; - buffV.setUint16(o, Number(r & BigInt(0xFFFF))); + buffV.setUint16(o, Number(r & BigInt(0xffff))); r = r >> BigInt(16); } else { o -= 1; - buffV.setUint8(o, Number(r & BigInt(0xFF))); + buffV.setUint8(o, Number(r & BigInt(0xff))); r = r >> BigInt(8); } } @@ -127168,20 +166032,19 @@ function beInt2Buff(n, len) { return buff; } - function leBuff2int(buff) { let res = BigInt(0); let i = 0; const buffV = new DataView(buff.buffer, buff.byteOffset, buff.byteLength); - while (i> BigInt(32); - } else if (o+2 <= len) { - buffV.setUint16(Number(o, r & BigInt(0xFFFF)), true ); + } else if (o + 2 <= len) { + buffV.setUint16(o, Number(r & BigInt(0xffff)), true); o += 2; r = r >> BigInt(16); } else { - buffV.setUint8(Number(o, r & BigInt(0xFF)), true ); + buffV.setUint8(o, Number(r & BigInt(0xff)), true); o += 1; r = r >> BigInt(8); } @@ -127218,18 +166081,17 @@ function leInt2Buff(n, len) { return buff; } - function stringifyFElements(F, o) { - if ((typeof(o) == "bigint") || o.eq !== undefined) { + if (typeof o == "bigint" || o.eq !== undefined) { return o.toString(10); } else if (o instanceof Uint8Array) { return F.toString(F.e(o)); } else if (Array.isArray(o)) { - return o.map(stringifyFElements.bind(this,F)); + return o.map(stringifyFElements.bind(this, F)); } else if (typeof o == "object") { const res = {}; const keys = Object.keys(o); - keys.forEach( (k) => { + keys.forEach((k) => { res[k] = stringifyFElements(F, o[k]); }); return res; @@ -127238,19 +166100,18 @@ function stringifyFElements(F, o) { } } - function unstringifyFElements(F, o) { - if ((typeof(o) == "string") && (/^[0-9]+$/.test(o) )) { + if (typeof o == "string" && /^[0-9]+$/.test(o)) { return F.e(o); - } else if ((typeof(o) == "string") && (/^0x[0-9a-fA-F]+$/.test(o) )) { + } else if (typeof o == "string" && /^0x[0-9a-fA-F]+$/.test(o)) { return F.e(o); } else if (Array.isArray(o)) { - return o.map(unstringifyFElements.bind(this,F)); + return o.map(unstringifyFElements.bind(this, F)); } else if (typeof o == "object") { - if (o===null) return null; + if (o === null) return null; const res = {}; const keys = Object.keys(o); - keys.forEach( (k) => { + keys.forEach((k) => { res[k] = unstringifyFElements(F, o[k]); }); return res; @@ -127259,195 +166120,93 @@ function unstringifyFElements(F, o) { } } -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/utils_bigint.js - - -function utils_bigint_stringifyBigInts(o) { - if ((typeof(o) == "bigint") || o.eq !== undefined) { - return o.toString(10); - } else if (Array.isArray(o)) { - return o.map(utils_bigint_stringifyBigInts); - } else if (typeof o == "object") { - const res = {}; - const keys = Object.keys(o); - keys.forEach( (k) => { - res[k] = utils_bigint_stringifyBigInts(o[k]); - }); - return res; - } else { - return o; - } +const _revTable = []; +for (let i = 0; i < 256; i++) { + _revTable[i] = _revSlow(i, 8); } -function utils_bigint_unstringifyBigInts(o) { - if ((typeof(o) == "string") && (/^[0-9]+$/.test(o) )) { - return BigInteger(o); - } else if ((typeof(o) == "string") && (/^0x[0-9a-fA-F]+$/.test(o) )) { - return BigInteger(o); - } else if (Array.isArray(o)) { - return o.map(utils_bigint_unstringifyBigInts); - } else if (typeof o == "object") { - const res = {}; - const keys = Object.keys(o); - keys.forEach( (k) => { - res[k] = utils_bigint_unstringifyBigInts(o[k]); - }); - return res; - } else { - return o; - } -} - -function utils_bigint_beBuff2int(buff) { - let res = BigInteger.zero; - for (let i=0; i=0)) { - let c = Number(r.and(BigInteger("255"))); - buff[o] = c; - o--; - r = r.shiftRight(8); - } - if (!r.eq(BigInteger.zero)) { - throw new Error("Number does not fit in this length"); - } - return buff; -} - - -function utils_bigint_leBuff2int (buff) { - let res = BigInteger.zero; - for (let i=0; i>=1; + res = res | (a & 1); + a >>= 1; } return res; } -utils.bitReverse = function bitReverse(idx, bits) { +function bitReverse(idx, bits) { return ( - utils_revTable[idx >>> 24] | - (utils_revTable[(idx >>> 16) & 0xFF] << 8) | - (utils_revTable[(idx >>> 8) & 0xFF] << 16) | - (utils_revTable[idx & 0xFF] << 24) - ) >>> (32-bits); -}; + (_revTable[idx >>> 24] | + (_revTable[(idx >>> 16) & 0xff] << 8) | + (_revTable[(idx >>> 8) & 0xff] << 16) | + (_revTable[idx & 0xff] << 24)) >>> + (32 - bits) + ); +} +function log2(V) { + return ( + ((V & 0xffff0000) !== 0 ? ((V &= 0xffff0000), 16) : 0) | + ((V & 0xff00ff00) !== 0 ? ((V &= 0xff00ff00), 8) : 0) | + ((V & 0xf0f0f0f0) !== 0 ? ((V &= 0xf0f0f0f0), 4) : 0) | + ((V & 0xcccccccc) !== 0 ? ((V &= 0xcccccccc), 2) : 0) | + ((V & 0xaaaaaaaa) !== 0) + ); +} -utils.log2 = function log2( V ) -{ - return( ( ( V & 0xFFFF0000 ) !== 0 ? ( V &= 0xFFFF0000, 16 ) : 0 ) | ( ( V & 0xFF00FF00 ) !== 0 ? ( V &= 0xFF00FF00, 8 ) : 0 ) | ( ( V & 0xF0F0F0F0 ) !== 0 ? ( V &= 0xF0F0F0F0, 4 ) : 0 ) | ( ( V & 0xCCCCCCCC ) !== 0 ? ( V &= 0xCCCCCCCC, 2 ) : 0 ) | ( ( V & 0xAAAAAAAA ) !== 0 ) ); -}; - -utils.buffReverseBits = function buffReverseBits(buff, eSize) { - const n = buff.byteLength /eSize; - const bits = utils.log2(n); - if (n != (1 << bits)) { +function buffReverseBits(buff, eSize) { + const n = buff.byteLength / eSize; + const bits = log2(n); + if (n != 1 << bits) { throw new Error("Invalid number of pointers"); } - for (let i=0; ir) { - const tmp = buff.slice(i*eSize, (i+1)*eSize); - buff.set( buff.slice(r*eSize, (r+1)*eSize), i*eSize); - buff.set(tmp, r*eSize); + for (let i = 0; i < n; i++) { + const r = bitReverse(i, bits); + if (i > r) { + const tmp = buff.slice(i * eSize, (i + 1) * eSize); + buff.set(buff.slice(r * eSize, (r + 1) * eSize), i * eSize); + buff.set(tmp, r * eSize); } } -}; +} +function array2buffer(arr, sG) { + const buff = new Uint8Array(sG * arr.length); -utils.array2buffer = function(arr, sG) { - const buff = new Uint8Array(sG*arr.length); - - for (let i=0; i { @@ -128887,14 +167599,12 @@ function sleep(ms) { } function stringToBase64(str) { - if (threadman_process.browser) { + { return globalThis.btoa(str); - } else { - return Buffer.from(str).toString("base64"); } } -const threadSource = stringToBase64("(" + thread.toString() + ")(self)"); +const threadSource = stringToBase64("(" + "function thread(self) {\n const MAXMEM = 32767;\n let instance;\n let memory;\n\n if (self) {\n self.onmessage = function(e) {\n let data;\n if (e.data) {\n data = e.data;\n } else {\n data = e;\n }\n\n if (data[0].cmd == \"INIT\") {\n init(data[0]).then(function() {\n self.postMessage(data.result);\n });\n } else if (data[0].cmd == \"TERMINATE\") {\n self.close();\n } else {\n const res = runTask(data);\n self.postMessage(res);\n }\n };\n }\n\n async function init(data) {\n const code = new Uint8Array(data.code);\n const wasmModule = await WebAssembly.compile(code);\n memory = new WebAssembly.Memory({initial:data.init, maximum: MAXMEM});\n\n instance = await WebAssembly.instantiate(wasmModule, {\n env: {\n \"memory\": memory\n }\n });\n }\n\n\n\n function alloc(length) {\n const u32 = new Uint32Array(memory.buffer, 0, 1);\n while (u32[0] & 3) u32[0]++; // Return always aligned pointers\n const res = u32[0];\n u32[0] += length;\n if (u32[0] + length > memory.buffer.byteLength) {\n const currentPages = memory.buffer.byteLength / 0x10000;\n let requiredPages = Math.floor((u32[0] + length) / 0x10000)+1;\n if (requiredPages>MAXMEM) requiredPages=MAXMEM;\n memory.grow(requiredPages-currentPages);\n }\n return res;\n }\n\n function allocBuffer(buffer) {\n const p = alloc(buffer.byteLength);\n setBuffer(p, buffer);\n return p;\n }\n\n function getBuffer(pointer, length) {\n const u8 = new Uint8Array(memory.buffer);\n return new Uint8Array(u8.buffer, u8.byteOffset + pointer, length);\n }\n\n function setBuffer(pointer, buffer) {\n const u8 = new Uint8Array(memory.buffer);\n u8.set(new Uint8Array(buffer), pointer);\n }\n\n function runTask(task) {\n if (task[0].cmd == \"INIT\") {\n return init(task[0]);\n }\n const ctx = {\n vars: [],\n out: []\n };\n const u32a = new Uint32Array(memory.buffer, 0, 1);\n const oldAlloc = u32a[0];\n for (let i=0; i. +*/ + +function toNumber(n) { + return BigInt(n); +} + +function isNegative(n) { + return n < 0n; +} + +function isZero(n) { + return n === 0n; +} + +function bitLength(n) { + if (isNegative(n)) { + return n.toString(2).length - 1; // discard the - sign + } else { + return n.toString(2).length; + } +} + +function u32(n) { + const b = []; + const v = toNumber(n); + b.push(Number(v & 0xFFn)); + b.push(Number(v >> 8n & 0xFFn)); + b.push(Number(v >> 16n & 0xFFn)); + b.push(Number(v >> 24n & 0xFFn)); + return b; +} + +function toUTF8Array(str) { + var utf8 = []; + for (var i=0; i < str.length; i++) { + var charcode = str.charCodeAt(i); + if (charcode < 0x80) utf8.push(charcode); + else if (charcode < 0x800) { + utf8.push(0xc0 | (charcode >> 6), + 0x80 | (charcode & 0x3f)); + } + else if (charcode < 0xd800 || charcode >= 0xe000) { + utf8.push(0xe0 | (charcode >> 12), + 0x80 | ((charcode>>6) & 0x3f), + 0x80 | (charcode & 0x3f)); + } + // surrogate pair + else { + i++; + // UTF-16 encodes 0x10000-0x10FFFF by + // subtracting 0x10000 and splitting the + // 20 bits of 0x0-0xFFFFF into two halves + charcode = 0x10000 + (((charcode & 0x3ff)<<10) + | (str.charCodeAt(i) & 0x3ff)); + utf8.push(0xf0 | (charcode >>18), + 0x80 | ((charcode>>12) & 0x3f), + 0x80 | ((charcode>>6) & 0x3f), + 0x80 | (charcode & 0x3f)); + } + } + return utf8; +} + +function string(str) { + const bytes = toUTF8Array(str); + return [ ...varuint32(bytes.length), ...bytes ]; +} + +function varuint(n) { + const code = []; + let v = toNumber(n); + if (isNegative(v)) throw new Error("Number cannot be negative"); + while (!isZero(v)) { + code.push(Number(v & 0x7Fn)); + v = v >> 7n; + } + if (code.length==0) code.push(0); + for (let i=0; i 0xFFFFFFFFn) throw new Error("Number too big"); + if (v > 0x7FFFFFFFn) v = v - 0x100000000n; + // bigInt("-80000000", 16) as base10 + if (v < -2147483648n) throw new Error("Number too small"); + return varint(v); +} + +function varint64(n) { + let v = toNumber(n); + if (v > 0xFFFFFFFFFFFFFFFFn) throw new Error("Number too big"); + if (v > 0x7FFFFFFFFFFFFFFFn) v = v - 0x10000000000000000n; + // bigInt("-8000000000000000", 16) as base10 + if (v < -9223372036854775808n) throw new Error("Number too small"); + return varint(v); +} + +function varuint32(n) { + let v = toNumber(n); + if (v > 0xFFFFFFFFn) throw new Error("Number too big"); + return varuint(v); +} + +function toHexString(byteArray) { + return Array.from(byteArray, function(byte) { + return ("0" + (byte & 0xFF).toString(16)).slice(-2); + }).join(""); +} + +/* + Copyright 2019 0KIMS association. + + This file is part of wasmbuilder + + wasmbuilder is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + wasmbuilder is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with wasmbuilder. If not, see . +*/ -// EXTERNAL MODULE: ./node_modules/wasmbuilder/index.js -var wasmbuilder = __webpack_require__(14400); -;// CONCATENATED MODULE: ./node_modules/ffjavascript/src/bn128.js +class CodeBuilder { + constructor(func) { + this.func = func; + this.functionName = func.functionName; + this.module = func.module; + } + + setLocal(localName, valCode) { + const idx = this.func.localIdxByName[localName]; + if (idx === undefined) + throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${localName} `); + return [...valCode, 0x21, ...varuint32( idx )]; + } + + teeLocal(localName, valCode) { + const idx = this.func.localIdxByName[localName]; + if (idx === undefined) + throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${localName} `); + return [...valCode, 0x22, ...varuint32( idx )]; + } + + getLocal(localName) { + const idx = this.func.localIdxByName[localName]; + if (idx === undefined) + throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${localName} `); + return [0x20, ...varuint32( idx )]; + } + + i64_load8_s(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 0 : _align; // 8 bits alignment by default + return [...idxCode, 0x30, align, ...varuint32(offset)]; + } + + i64_load8_u(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 0 : _align; // 8 bits alignment by default + return [...idxCode, 0x31, align, ...varuint32(offset)]; + } + + i64_load16_s(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 1 : _align; // 16 bits alignment by default + return [...idxCode, 0x32, align, ...varuint32(offset)]; + } + + i64_load16_u(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 1 : _align; // 16 bits alignment by default + return [...idxCode, 0x33, align, ...varuint32(offset)]; + } + + i64_load32_s(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 2 : _align; // 32 bits alignment by default + return [...idxCode, 0x34, align, ...varuint32(offset)]; + } + + i64_load32_u(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 2 : _align; // 32 bits alignment by default + return [...idxCode, 0x35, align, ...varuint32(offset)]; + } + + i64_load(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 3 : _align; // 64 bits alignment by default + return [...idxCode, 0x29, align, ...varuint32(offset)]; + } + i64_store(idxCode, _offset, _align, _codeVal) { + let offset, align, codeVal; + if (Array.isArray(_offset)) { + offset = 0; + align = 3; + codeVal = _offset; + } else if (Array.isArray(_align)) { + offset = _offset; + align = 3; + codeVal = _align; + } else if (Array.isArray(_codeVal)) { + offset = _offset; + align = _align; + codeVal = _codeVal; + } + return [...idxCode, ...codeVal, 0x37, align, ...varuint32(offset)]; + } + + i64_store32(idxCode, _offset, _align, _codeVal) { + let offset, align, codeVal; + if (Array.isArray(_offset)) { + offset = 0; + align = 2; + codeVal = _offset; + } else if (Array.isArray(_align)) { + offset = _offset; + align = 2; + codeVal = _align; + } else if (Array.isArray(_codeVal)) { + offset = _offset; + align = _align; + codeVal = _codeVal; + } + return [...idxCode, ...codeVal, 0x3e, align, ...varuint32(offset)]; + } + i64_store16(idxCode, _offset, _align, _codeVal) { + let offset, align, codeVal; + if (Array.isArray(_offset)) { + offset = 0; + align = 1; + codeVal = _offset; + } else if (Array.isArray(_align)) { + offset = _offset; + align = 1; + codeVal = _align; + } else if (Array.isArray(_codeVal)) { + offset = _offset; + align = _align; + codeVal = _codeVal; + } + return [...idxCode, ...codeVal, 0x3d, align, ...varuint32(offset)]; + } + + + i64_store8(idxCode, _offset, _align, _codeVal) { + let offset, align, codeVal; + if (Array.isArray(_offset)) { + offset = 0; + align = 0; + codeVal = _offset; + } else if (Array.isArray(_align)) { + offset = _offset; + align = 0; + codeVal = _align; + } else if (Array.isArray(_codeVal)) { + offset = _offset; + align = _align; + codeVal = _codeVal; + } + return [...idxCode, ...codeVal, 0x3c, align, ...varuint32(offset)]; + } + + i32_load8_s(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 0 : _align; // 32 bits alignment by default + return [...idxCode, 0x2c, align, ...varuint32(offset)]; + } + + i32_load8_u(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 0 : _align; // 32 bits alignment by default + return [...idxCode, 0x2d, align, ...varuint32(offset)]; + } + + i32_load16_s(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 1 : _align; // 32 bits alignment by default + return [...idxCode, 0x2e, align, ...varuint32(offset)]; + } + + i32_load16_u(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 1 : _align; // 32 bits alignment by default + return [...idxCode, 0x2f, align, ...varuint32(offset)]; + } + + i32_load(idxCode, _offset, _align) { + const offset = _offset || 0; + const align = (_align === undefined) ? 2 : _align; // 32 bits alignment by default + return [...idxCode, 0x28, align, ...varuint32(offset)]; + } + + i32_store(idxCode, _offset, _align, _codeVal) { + let offset, align, codeVal; + if (Array.isArray(_offset)) { + offset = 0; + align = 2; + codeVal = _offset; + } else if (Array.isArray(_align)) { + offset = _offset; + align = 2; + codeVal = _align; + } else if (Array.isArray(_codeVal)) { + offset = _offset; + align = _align; + codeVal = _codeVal; + } + return [...idxCode, ...codeVal, 0x36, align, ...varuint32(offset)]; + } + + + i32_store16(idxCode, _offset, _align, _codeVal) { + let offset, align, codeVal; + if (Array.isArray(_offset)) { + offset = 0; + align = 1; + codeVal = _offset; + } else if (Array.isArray(_align)) { + offset = _offset; + align = 1; + codeVal = _align; + } else if (Array.isArray(_codeVal)) { + offset = _offset; + align = _align; + codeVal = _codeVal; + } + return [...idxCode, ...codeVal, 0x3b, align, ...varuint32(offset)]; + } + + i32_store8(idxCode, _offset, _align, _codeVal) { + let offset, align, codeVal; + if (Array.isArray(_offset)) { + offset = 0; + align = 0; + codeVal = _offset; + } else if (Array.isArray(_align)) { + offset = _offset; + align = 0; + codeVal = _align; + } else if (Array.isArray(_codeVal)) { + offset = _offset; + align = _align; + codeVal = _codeVal; + } + return [...idxCode, ...codeVal, 0x3a, align, ...varuint32(offset)]; + } + + call(fnName, ...args) { + const idx = this.module.functionIdxByName[fnName]; + if (idx === undefined) + throw new Error(`Function not defined: Function: ${fnName}`); + return [...[].concat(...args), 0x10, ...varuint32(idx)]; + } + + call_indirect(fnIdx, ...args) { + return [...[].concat(...args), ...fnIdx, 0x11, 0, 0]; + } + + if(condCode, thenCode, elseCode) { + if (elseCode) { + return [...condCode, 0x04, 0x40, ...thenCode, 0x05, ...elseCode, 0x0b]; + } else { + return [...condCode, 0x04, 0x40, ...thenCode, 0x0b]; + } + } + + block(bCode) { return [0x02, 0x40, ...bCode, 0x0b]; } + loop(...args) { + return [0x03, 0x40, ...[].concat(...[...args]), 0x0b]; + } + br_if(relPath, condCode) { return [...condCode, 0x0d, ...varuint32(relPath)]; } + br(relPath) { return [0x0c, ...varuint32(relPath)]; } + ret(rCode) { return [...rCode, 0x0f]; } + drop(dCode) { return [...dCode, 0x1a]; } + + i64_const(num) { return [0x42, ...varint64(num)]; } + i32_const(num) { return [0x41, ...varint32(num)]; } + + + i64_eqz(opcode) { return [...opcode, 0x50]; } + i64_eq(op1code, op2code) { return [...op1code, ...op2code, 0x51]; } + i64_ne(op1code, op2code) { return [...op1code, ...op2code, 0x52]; } + i64_lt_s(op1code, op2code) { return [...op1code, ...op2code, 0x53]; } + i64_lt_u(op1code, op2code) { return [...op1code, ...op2code, 0x54]; } + i64_gt_s(op1code, op2code) { return [...op1code, ...op2code, 0x55]; } + i64_gt_u(op1code, op2code) { return [...op1code, ...op2code, 0x56]; } + i64_le_s(op1code, op2code) { return [...op1code, ...op2code, 0x57]; } + i64_le_u(op1code, op2code) { return [...op1code, ...op2code, 0x58]; } + i64_ge_s(op1code, op2code) { return [...op1code, ...op2code, 0x59]; } + i64_ge_u(op1code, op2code) { return [...op1code, ...op2code, 0x5a]; } + i64_add(op1code, op2code) { return [...op1code, ...op2code, 0x7c]; } + i64_sub(op1code, op2code) { return [...op1code, ...op2code, 0x7d]; } + i64_mul(op1code, op2code) { return [...op1code, ...op2code, 0x7e]; } + i64_div_s(op1code, op2code) { return [...op1code, ...op2code, 0x7f]; } + i64_div_u(op1code, op2code) { return [...op1code, ...op2code, 0x80]; } + i64_rem_s(op1code, op2code) { return [...op1code, ...op2code, 0x81]; } + i64_rem_u(op1code, op2code) { return [...op1code, ...op2code, 0x82]; } + i64_and(op1code, op2code) { return [...op1code, ...op2code, 0x83]; } + i64_or(op1code, op2code) { return [...op1code, ...op2code, 0x84]; } + i64_xor(op1code, op2code) { return [...op1code, ...op2code, 0x85]; } + i64_shl(op1code, op2code) { return [...op1code, ...op2code, 0x86]; } + i64_shr_s(op1code, op2code) { return [...op1code, ...op2code, 0x87]; } + i64_shr_u(op1code, op2code) { return [...op1code, ...op2code, 0x88]; } + i64_extend_i32_s(op1code) { return [...op1code, 0xac]; } + i64_extend_i32_u(op1code) { return [...op1code, 0xad]; } + i64_clz(op1code) { return [...op1code, 0x79]; } + i64_ctz(op1code) { return [...op1code, 0x7a]; } + + i32_eqz(op1code) { return [...op1code, 0x45]; } + i32_eq(op1code, op2code) { return [...op1code, ...op2code, 0x46]; } + i32_ne(op1code, op2code) { return [...op1code, ...op2code, 0x47]; } + i32_lt_s(op1code, op2code) { return [...op1code, ...op2code, 0x48]; } + i32_lt_u(op1code, op2code) { return [...op1code, ...op2code, 0x49]; } + i32_gt_s(op1code, op2code) { return [...op1code, ...op2code, 0x4a]; } + i32_gt_u(op1code, op2code) { return [...op1code, ...op2code, 0x4b]; } + i32_le_s(op1code, op2code) { return [...op1code, ...op2code, 0x4c]; } + i32_le_u(op1code, op2code) { return [...op1code, ...op2code, 0x4d]; } + i32_ge_s(op1code, op2code) { return [...op1code, ...op2code, 0x4e]; } + i32_ge_u(op1code, op2code) { return [...op1code, ...op2code, 0x4f]; } + i32_add(op1code, op2code) { return [...op1code, ...op2code, 0x6a]; } + i32_sub(op1code, op2code) { return [...op1code, ...op2code, 0x6b]; } + i32_mul(op1code, op2code) { return [...op1code, ...op2code, 0x6c]; } + i32_div_s(op1code, op2code) { return [...op1code, ...op2code, 0x6d]; } + i32_div_u(op1code, op2code) { return [...op1code, ...op2code, 0x6e]; } + i32_rem_s(op1code, op2code) { return [...op1code, ...op2code, 0x6f]; } + i32_rem_u(op1code, op2code) { return [...op1code, ...op2code, 0x70]; } + i32_and(op1code, op2code) { return [...op1code, ...op2code, 0x71]; } + i32_or(op1code, op2code) { return [...op1code, ...op2code, 0x72]; } + i32_xor(op1code, op2code) { return [...op1code, ...op2code, 0x73]; } + i32_shl(op1code, op2code) { return [...op1code, ...op2code, 0x74]; } + i32_shr_s(op1code, op2code) { return [...op1code, ...op2code, 0x75]; } + i32_shr_u(op1code, op2code) { return [...op1code, ...op2code, 0x76]; } + i32_rotl(op1code, op2code) { return [...op1code, ...op2code, 0x77]; } + i32_rotr(op1code, op2code) { return [...op1code, ...op2code, 0x78]; } + i32_wrap_i64(op1code) { return [...op1code, 0xa7]; } + i32_clz(op1code) { return [...op1code, 0x67]; } + i32_ctz(op1code) { return [...op1code, 0x68]; } + + unreachable() { return [ 0x0 ]; } + + current_memory() { return [ 0x3f, 0]; } + + comment() { return []; } +} + +/* + Copyright 2019 0KIMS association. + + This file is part of wasmbuilder + + wasmbuilder is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + wasmbuilder is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with wasmbuilder. If not, see . +*/ + + +const typeCodes = { + "i32": 0x7f, + "i64": 0x7e, + "f32": 0x7d, + "f64": 0x7c, + "anyfunc": 0x70, + "func": 0x60, + "emptyblock": 0x40 +}; + + +class FunctionBuilder { + + constructor (module, fnName, fnType, moduleName, fieldName) { + if (fnType == "import") { + this.fnType = "import"; + this.moduleName = moduleName; + this.fieldName = fieldName; + } else if (fnType == "internal") { + this.fnType = "internal"; + } else { + throw new Error("Invalid function fnType: " + fnType); + } + this.module = module; + this.fnName = fnName; + this.params = []; + this.locals = []; + this.localIdxByName = {}; + this.code = []; + this.returnType = null; + this.nextLocal =0; + } + + addParam(paramName, paramType) { + if (this.localIdxByName[paramName]) + throw new Error(`param already exists. Function: ${this.fnName}, Param: ${paramName} `); + const idx = this.nextLocal++; + this.localIdxByName[paramName] = idx; + this.params.push({ + type: paramType + }); + } + + addLocal(localName, localType, _length) { + const length = _length || 1; + if (this.localIdxByName[localName]) + throw new Error(`local already exists. Function: ${this.fnName}, Param: ${localName} `); + const idx = this.nextLocal++; + this.localIdxByName[localName] = idx; + this.locals.push({ + type: localType, + length: length + }); + } + + setReturnType(returnType) { + if (this.returnType) + throw new Error(`returnType already defined. Function: ${this.fnName}`); + this.returnType = returnType; + } + + getSignature() { + const params = [...varuint32(this.params.length), ...this.params.map((p) => typeCodes[p.type])]; + const returns = this.returnType ? [0x01, typeCodes[this.returnType]] : [0]; + return [0x60, ...params, ...returns]; + } + + getBody() { + const locals = this.locals.map((l) => [ + ...varuint32(l.length), + typeCodes[l.type] + ]); + + const body = [ + ...varuint32(this.locals.length), + ...[].concat(...locals), + ...this.code, + 0x0b + ]; + return [ + ...varuint32(body.length), + ...body + ]; + } + + addCode(...code) { + this.code.push(...[].concat(...[...code])); + } + + getCodeBuilder() { + return new CodeBuilder(this); + } +} + +/* + Copyright 2019 0KIMS association. + + This file is part of wasmbuilder + + wasmbuilder is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + wasmbuilder is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with wasmbuilder. If not, see . +*/ + + +class ModuleBuilder { + + constructor() { + this.functions = []; + this.functionIdxByName = {}; + this.nImportFunctions = 0; + this.nInternalFunctions =0; + this.memory = { + pagesSize: 1, + moduleName: "env", + fieldName: "memory" + }; + this.free = 8; + this.datas = []; + this.modules = {}; + this.exports = []; + this.functionsTable = []; + } + + build() { + this._setSignatures(); + return new Uint8Array([ + ...u32(0x6d736100), + ...u32(1), + ...this._buildType(), + ...this._buildImport(), + ...this._buildFunctionDeclarations(), + ...this._buildFunctionsTable(), + ...this._buildExports(), + ...this._buildElements(), + ...this._buildCode(), + ...this._buildData() + ]); + } + + addFunction(fnName) { + if (typeof(this.functionIdxByName[fnName]) !== "undefined") + throw new Error(`Function already defined: ${fnName}`); + + const idx = this.functions.length; + this.functionIdxByName[fnName] = idx; + + this.functions.push(new FunctionBuilder(this, fnName, "internal")); + + this.nInternalFunctions++; + return this.functions[idx]; + } + + addIimportFunction(fnName, moduleName, _fieldName) { + if (typeof(this.functionIdxByName[fnName]) !== "undefined") + throw new Error(`Function already defined: ${fnName}`); + + if ( (this.functions.length>0) + &&(this.functions[this.functions.length-1].type == "internal")) + throw new Error(`Import functions must be declared before internal: ${fnName}`); + + let fieldName = _fieldName || fnName; + + const idx = this.functions.length; + this.functionIdxByName[fnName] = idx; + + this.functions.push(new FunctionBuilder(this, fnName, "import", moduleName, fieldName)); + + this.nImportFunctions ++; + return this.functions[idx]; + } + + setMemory(pagesSize, moduleName, fieldName) { + this.memory = { + pagesSize: pagesSize, + moduleName: moduleName || "env", + fieldName: fieldName || "memory" + }; + } + + exportFunction(fnName, _exportName) { + const exportName = _exportName || fnName; + if (typeof(this.functionIdxByName[fnName]) === "undefined") + throw new Error(`Function not defined: ${fnName}`); + const idx = this.functionIdxByName[fnName]; + if (exportName != fnName) { + this.functionIdxByName[exportName] = idx; + } + this.exports.push({ + exportName: exportName, + idx: idx + }); + } + + addFunctionToTable(fnName) { + const idx = this.functionIdxByName[fnName]; + this.functionsTable.push(idx); + } + + addData(offset, bytes) { + this.datas.push({ + offset: offset, + bytes: bytes + }); + } + + alloc(a, b) { + let size; + let bytes; + if ((Array.isArray(a) || ArrayBuffer.isView(a)) && (typeof(b) === "undefined")) { + size = a.length; + bytes = a; + } else { + size = a; + bytes = b; + } + size = (((size-1)>>3) +1)<<3; // Align to 64 bits. + const p = this.free; + this.free += size; + if (bytes) { + this.addData(p, bytes); + } + return p; + } + + allocString(s) { + const encoder = new globalThis.TextEncoder(); + const uint8array = encoder.encode(s); + return this.alloc([...uint8array, 0]); + } + + _setSignatures() { + this.signatures = []; + const signatureIdxByName = {}; + if (this.functionsTable.length>0) { + const signature = this.functions[this.functionsTable[0]].getSignature(); + const signatureName = "s_"+toHexString(signature); + signatureIdxByName[signatureName] = 0; + this.signatures.push(signature); + } + for (let i=0; i= 0) { - curve = await bn128_buildBn128(singleThread, plugins); + curve = await buildBn128(singleThread, plugins); } else if (["BLS12381"].indexOf(normName) >= 0) { - curve = await bls12381_buildBls12381(singleThread, plugins); + curve = await buildBls12381(singleThread, plugins); } else { throw new Error(`Curve not supported: ${name}`); } @@ -130520,45 +170101,24 @@ async function curves_getCurveFromName(name, singleThread, plugins) { } -;// CONCATENATED MODULE: ./node_modules/ffjavascript/main.js - - -const main_Scalar=scalar_namespaceObject; +const browser_esm_Scalar=_Scalar; +const utils = _utils; - - - - - - - - - - - -const main_utils = utils_namespaceObject; - - - - - - - -;// CONCATENATED MODULE: ./node_modules/circomlibjs/src/babyjub.js +;// ./node_modules/circomlibjs/src/babyjub.js async function babyjub_buildBabyJub() { - const bn128 = await curves_getCurveFromName("bn128", true); + const bn128 = await browser_esm_getCurveFromName("bn128", true); return new BabyJub(bn128.Fr); } class BabyJub { constructor(F) { this.F = F; - this.p = main_Scalar.fromString("21888242871839275222246405745257275088548364400416034343698204186575808495617"); - this.pm1d2 = main_Scalar.div(main_Scalar.sub(this.p, main_Scalar.e(1)), main_Scalar.e(2)); + this.p = browser_esm_Scalar.fromString("21888242871839275222246405745257275088548364400416034343698204186575808495617"); + this.pm1d2 = browser_esm_Scalar.div(browser_esm_Scalar.sub(this.p, browser_esm_Scalar.e(1)), browser_esm_Scalar.e(2)); this.Generator = [ F.e("995203441582195749578291179787384436505546430278305826713579947235728471134"), @@ -130568,8 +170128,8 @@ class BabyJub { F.e("5299619240641551281634865583518297030282874472190772894086521144482721001553"), F.e("16950150798460657717958625567821834550301663161624707787222815936182638968203") ]; - this.order = main_Scalar.fromString("21888242871839275222246405745257275088614511777268538073601725287587578984328"); - this.subOrder = main_Scalar.shiftRight(this.order, 3); + this.order = browser_esm_Scalar.fromString("21888242871839275222246405745257275088614511777268538073601725287587578984328"); + this.subOrder = browser_esm_Scalar.shiftRight(this.order, 3); this.A = F.e("168700"); this.D = F.e("168696"); } @@ -130613,12 +170173,12 @@ class BabyJub { let rem = e; let exp = base; - while (! main_Scalar.isZero(rem)) { - if (main_Scalar.isOdd(rem)) { + while (! browser_esm_Scalar.isZero(rem)) { + if (browser_esm_Scalar.isOdd(rem)) { res = this.addPoint(res, exp); } exp = this.addPoint(exp, exp); - rem = main_Scalar.shiftRight(rem, 1); + rem = browser_esm_Scalar.shiftRight(rem, 1); } return res; @@ -130648,7 +170208,7 @@ class BabyJub { const buff = new Uint8Array(32); F.toRprLE(buff, 0, P[1]); const n = F.toObject(P[0]); - if (main_Scalar.gt(n, this.pm1d2)) { + if (browser_esm_Scalar.gt(n, this.pm1d2)) { buff[31] = buff[31] | 0x80; } return buff; @@ -130663,7 +170223,7 @@ class BabyJub { buff[31] = buff[31] & 0x7F; } P[1] = F.fromRprLE(buff, 0); - if (main_Scalar.gt(F.toObject(P[1]), this.p)) return null; + if (browser_esm_Scalar.gt(F.toObject(P[1]), this.p)) return null; const y2 = F.square(P[1]); @@ -130691,8 +170251,8 @@ class BabyJub { var blake2b = __webpack_require__(72206); // EXTERNAL MODULE: ./node_modules/blake-hash/js.js var js = __webpack_require__(60654); -;// CONCATENATED MODULE: ./node_modules/circomlibjs/src/pedersen_hash.js -/* provided dependency */ var pedersen_hash_Buffer = __webpack_require__(48287)["Buffer"]; +;// ./node_modules/circomlibjs/src/pedersen_hash.js +/* provided dependency */ var Buffer = __webpack_require__(62045)["hp"]; @@ -130718,7 +170278,7 @@ class PedersenHash { if (type == "blake") { return js("blake256").update(S).digest(); } else if (type == "blake2b") { - return pedersen_hash_Buffer.from(blake2b(32).update(pedersen_hash_Buffer.from(S)).digest()); + return Buffer.from(blake2b(32).update(Buffer.from(S)).digest()); } } @@ -130740,29 +170300,29 @@ class PedersenHash { } else { nWindows = nWindowsPerSegment; } - let escalar = main_Scalar.e(0); - let exp = main_Scalar.e(1); + let escalar = browser_esm_Scalar.e(0); + let exp = browser_esm_Scalar.e(1); for (let w=0; w= 0) { + return items.map((item, index) => { + if (item instanceof Result) { + return toObject(getNames(item), item, deep); + } + return item; + }); + } + return names.reduce((accum, name, index) => { + let item = items.getValue(name); + if (!(name in accum)) { + if (deep && item instanceof Result) { + item = toObject(getNames(item), item, deep); + } + accum[name] = item; + } + return accum; + }, {}); +} /** * A [[Result]] is a sub-class of Array, which allows accessing any * of its values either positionally by its index or, if keys are @@ -159769,6 +199355,9 @@ function throwError(name, error) { * @_docloc: api/abi */ class Result extends Array { + // No longer used; but cannot be removed as it will remove the + // #private field from the .d.ts which may break backwards + // compatibility #names; /** * @private @@ -159801,20 +199390,25 @@ class Result extends Array { return accum; }, (new Map())); // Remove any key thats not unique - this.#names = Object.freeze(items.map((item, index) => { + setNames(this, Object.freeze(items.map((item, index) => { const name = names[index]; if (name != null && nameCounts.get(name) === 1) { return name; } return null; - })); + }))); + // Dummy operations to prevent TypeScript from complaining + this.#names = []; + if (this.#names == null) { + void (this.#names); + } if (!wrap) { return; } // A wrapped Result is immutable Object.freeze(this); // Proxy indices and names so we can trap deferred errors - return new Proxy(this, { + const proxy = new Proxy(this, { get: (target, prop, receiver) => { if (typeof (prop) === "string") { // Index accessor @@ -159849,6 +199443,8 @@ class Result extends Array { return Reflect.get(target, prop, receiver); } }); + setNames(proxy, getNames(this)); + return proxy; } /** * Returns the Result as a normal Array. If %%deep%%, any children @@ -159879,19 +199475,12 @@ class Result extends Array { * any outstanding deferred errors. */ toObject(deep) { - return this.#names.reduce((accum, name, index) => { - (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_1__/* .assert */ .vA)(name != null, "value at index ${ index } unnamed", "UNSUPPORTED_OPERATION", { + const names = getNames(this); + return names.reduce((accum, name, index) => { + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_1__/* .assert */ .vA)(name != null, `value at index ${index} unnamed`, "UNSUPPORTED_OPERATION", { operation: "toObject()" }); - // Add values for names that don't conflict - if (!(name in accum)) { - let child = this.getValue(name); - if (deep && child instanceof Result) { - child = child.toObject(deep); - } - accum[name] = child; - } - return accum; + return toObject(names, this, deep); }, {}); } /** @@ -159919,10 +199508,11 @@ class Result extends Array { if (end > this.length) { end = this.length; } + const _names = getNames(this); const result = [], names = []; for (let i = start; i < end; i++) { result.push(this[i]); - names.push(this.#names[i]); + names.push(_names[i]); } return new Result(_guard, result, names); } @@ -159930,6 +199520,7 @@ class Result extends Array { * @_ignore */ filter(callback, thisArg) { + const _names = getNames(this); const result = [], names = []; for (let i = 0; i < this.length; i++) { const item = this[i]; @@ -159938,7 +199529,7 @@ class Result extends Array { } if (callback.call(thisArg, item, i, this)) { result.push(item); - names.push(this.#names[i]); + names.push(_names[i]); } } return new Result(_guard, result, names); @@ -159966,7 +199557,7 @@ class Result extends Array { * accessible by name. */ getValue(name) { - const index = this.#names.indexOf(name); + const index = getNames(this).indexOf(name); if (index === -1) { return undefined; } @@ -160788,7 +200379,7 @@ class ParamType { * Walks the **ParamType** with %%value%%, asynchronously calling * %%process%% on each type, destructing the %%value%% recursively. * - * This can be used to resolve ENS naes by walking and resolving each + * This can be used to resolve ENS names by walking and resolving each * ``"address"`` type. */ async walkAsync(value, process) { @@ -161528,7 +201119,7 @@ class StructFragment extends NamedFragment { /* harmony export */ KA: () => (/* binding */ Interface) /* harmony export */ }); /* unused harmony exports LogDescription, TransactionDescription, ErrorDescription, Indexed */ -/* harmony import */ var _crypto_index_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(15539); +/* harmony import */ var _crypto_index_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(2011); /* harmony import */ var _hash_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(38264); /* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(88081); /* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(57339); @@ -161538,7 +201129,6 @@ class StructFragment extends NamedFragment { /* harmony import */ var _coders_abstract_coder_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(21228); /* harmony import */ var _fragments_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(76124); /* harmony import */ var _typed_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(19353); -/* provided dependency */ var console = __webpack_require__(96763); /** * The Interface class is a low-level class that accepts an * ABI and provides all the necessary functionality to encode @@ -162627,7 +202217,11 @@ getSelector(fragment: ErrorFragment | FunctionFragment): string { if (typeof (value) === "string") { return new Interface(JSON.parse(value)); } - // Maybe an interface from an older version, or from a symlinked copy + // An Interface; possibly from another v6 instance + if (typeof (value.formatJson) === "function") { + return new Interface(value.formatJson()); + } + // A legacy Interface; from an older version if (typeof (value.format) === "function") { return new Interface(value.format("json")); } @@ -163261,7 +202855,7 @@ class Typed { /* harmony export */ b: () => (/* binding */ getAddress) /* harmony export */ }); /* unused harmony export getIcapAddress */ -/* harmony import */ var _crypto_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15539); +/* harmony import */ var _crypto_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2011); /* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(36212); /* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(57339); @@ -163429,11 +203023,11 @@ function getIcapAddress(address) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ $C: () => (/* binding */ isAddressable), +/* harmony export */ PW: () => (/* binding */ isAddress), /* harmony export */ tG: () => (/* binding */ resolveAddress) /* harmony export */ }); -/* unused harmony export isAddress */ -/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57339); -/* harmony import */ var _address_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(30031); +/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(57339); +/* harmony import */ var _address_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(30031); /** @@ -163480,7 +203074,7 @@ function isAddressable(value) { */ function isAddress(value) { try { - getAddress(value); + (0,_address_js__WEBPACK_IMPORTED_MODULE_0__/* .getAddress */ .b)(value); return true; } catch (error) { } @@ -163489,10 +203083,10 @@ function isAddress(value) { async function checkAddress(target, promise) { const result = await promise; if (result == null || result === "0x0000000000000000000000000000000000000000") { - (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .assert */ .vA)(typeof (target) !== "string", "unconfigured name", "UNCONFIGURED_NAME", { value: target }); - (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .assertArgument */ .MR)(false, "invalid AddressLike value; did not resolve to a value address", "target", target); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_1__/* .assert */ .vA)(typeof (target) !== "string", "unconfigured name", "UNCONFIGURED_NAME", { value: target }); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_1__/* .assertArgument */ .MR)(false, "invalid AddressLike value; did not resolve to a value address", "target", target); } - return (0,_address_js__WEBPACK_IMPORTED_MODULE_1__/* .getAddress */ .b)(result); + return (0,_address_js__WEBPACK_IMPORTED_MODULE_0__/* .getAddress */ .b)(result); } /** * Resolves to an address for the %%target%%, which may be any @@ -163534,9 +203128,9 @@ async function checkAddress(target, promise) { function resolveAddress(target, resolver) { if (typeof (target) === "string") { if (target.match(/^0x[0-9a-f]{40}$/i)) { - return (0,_address_js__WEBPACK_IMPORTED_MODULE_1__/* .getAddress */ .b)(target); + return (0,_address_js__WEBPACK_IMPORTED_MODULE_0__/* .getAddress */ .b)(target); } - (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .assert */ .vA)(resolver != null, "ENS resolution requires a provider", "UNSUPPORTED_OPERATION", { operation: "resolveName" }); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_1__/* .assert */ .vA)(resolver != null, "ENS resolution requires a provider", "UNSUPPORTED_OPERATION", { operation: "resolveName" }); return checkAddress(target, resolver.resolveName(target)); } else if (isAddressable(target)) { @@ -163545,12 +203139,97 @@ function resolveAddress(target, resolver) { else if (target && typeof (target.then) === "function") { return checkAddress(target, target); } - (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .assertArgument */ .MR)(false, "unsupported addressable value", "target", target); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_1__/* .assertArgument */ .MR)(false, "unsupported addressable value", "target", target); } //# sourceMappingURL=checks.js.map /***/ }), +/***/ 7040: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ t: () => (/* binding */ getCreateAddress) +/* harmony export */ }); +/* unused harmony export getCreate2Address */ +/* harmony import */ var _crypto_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2011); +/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27033); +/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(36212); +/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65735); +/* harmony import */ var _address_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(30031); + + + +// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed +/** + * Returns the address that would result from a ``CREATE`` for %%tx%%. + * + * This can be used to compute the address a contract will be + * deployed to by an EOA when sending a deployment transaction (i.e. + * when the ``to`` address is ``null``). + * + * This can also be used to compute the address a contract will be + * deployed to by a contract, by using the contract's address as the + * ``to`` and the contract's nonce. + * + * @example + * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; + * nonce = 5; + * + * getCreateAddress({ from, nonce }); + * //_result: + */ +function getCreateAddress(tx) { + const from = (0,_address_js__WEBPACK_IMPORTED_MODULE_0__/* .getAddress */ .b)(tx.from); + const nonce = (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_1__/* .getBigInt */ .Ab)(tx.nonce, "tx.nonce"); + let nonceHex = nonce.toString(16); + if (nonceHex === "0") { + nonceHex = "0x"; + } + else if (nonceHex.length % 2) { + nonceHex = "0x0" + nonceHex; + } + else { + nonceHex = "0x" + nonceHex; + } + return (0,_address_js__WEBPACK_IMPORTED_MODULE_0__/* .getAddress */ .b)((0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .dataSlice */ .ZG)((0,_crypto_index_js__WEBPACK_IMPORTED_MODULE_3__/* .keccak256 */ .S)((0,_utils_index_js__WEBPACK_IMPORTED_MODULE_4__/* .encodeRlp */ .R)([from, nonceHex])), 12)); +} +/** + * Returns the address that would result from a ``CREATE2`` operation + * with the given %%from%%, %%salt%% and %%initCodeHash%%. + * + * To compute the %%initCodeHash%% from a contract's init code, use + * the [[keccak256]] function. + * + * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]]. + * + * @example + * // The address of the contract + * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72" + * + * // The salt + * salt = id("HelloWorld") + * + * // The hash of the initCode + * initCode = "0x6394198df16000526103ff60206004601c335afa6040516060f3"; + * initCodeHash = keccak256(initCode) + * + * getCreate2Address(from, salt, initCodeHash) + * //_result: + */ +function getCreate2Address(_from, _salt, _initCodeHash) { + const from = getAddress(_from); + const salt = getBytes(_salt, "salt"); + const initCodeHash = getBytes(_initCodeHash, "initCodeHash"); + assertArgument(salt.length === 32, "salt must be 32 bytes", "salt", _salt); + assertArgument(initCodeHash.length === 32, "initCodeHash must be 32 bytes", "initCodeHash", _initCodeHash); + return getAddress(dataSlice(keccak256(concat(["0xff", from, salt, initCodeHash])), 12)); +} +//# sourceMappingURL=contract-address.js.map + +/***/ }), + /***/ 98982: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { @@ -163568,215 +203247,25 @@ const ZeroAddress = "0x0000000000000000000000000000000000000000"; /***/ }), -/***/ 24391: +/***/ 13269: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; - -// EXPORTS -__webpack_require__.d(__webpack_exports__, { - NZ: () => (/* binding */ Contract) -}); - -// UNUSED EXPORTS: BaseContract, copyOverrides, resolveArgs - -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/abi/typed.js -var typed = __webpack_require__(19353); -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/abi/interface.js -var abi_interface = __webpack_require__(73622); -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/address/checks.js -var checks = __webpack_require__(41442); -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/providers/provider.js -var providers_provider = __webpack_require__(43948); -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/properties.js -var properties = __webpack_require__(88081); -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/errors.js -var errors = __webpack_require__(57339); -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/maths.js -var maths = __webpack_require__(27033); -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/data.js -var data = __webpack_require__(36212); -// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/events.js -var events = __webpack_require__(99381); -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/contract/wrappers.js -// import from provider.ts instead of index.ts to prevent circular dep -// from EtherscanProvider - - -/** - * An **EventLog** contains additional properties parsed from the [[Log]]. - */ -class EventLog extends providers_provider/* Log */.tG { - /** - * The Contract Interface. - */ - interface; - /** - * The matching event. - */ - fragment; - /** - * The parsed arguments passed to the event by ``emit``. - */ - args; - /** - * @_ignore: - */ - constructor(log, iface, fragment) { - super(log, log.provider); - const args = iface.decodeEventLog(fragment, log.data, log.topics); - (0,properties/* defineProperties */.n)(this, { args, fragment, interface: iface }); - } - /** - * The name of the event. - */ - get eventName() { return this.fragment.name; } - /** - * The signature of the event. - */ - get eventSignature() { return this.fragment.format(); } -} -/** - * An **EventLog** contains additional properties parsed from the [[Log]]. - */ -class UndecodedEventLog extends providers_provider/* Log */.tG { - /** - * The error encounted when trying to decode the log. - */ - error; - /** - * @_ignore: - */ - constructor(log, error) { - super(log, log.provider); - (0,properties/* defineProperties */.n)(this, { error }); - } -} -/** - * A **ContractTransactionReceipt** includes the parsed logs from a - * [[TransactionReceipt]]. - */ -class ContractTransactionReceipt extends providers_provider/* TransactionReceipt */.z5 { - #iface; - /** - * @_ignore: - */ - constructor(iface, provider, tx) { - super(tx, provider); - this.#iface = iface; - } - /** - * The parsed logs for any [[Log]] which has a matching event in the - * Contract ABI. - */ - get logs() { - return super.logs.map((log) => { - const fragment = log.topics.length ? this.#iface.getEvent(log.topics[0]) : null; - if (fragment) { - try { - return new EventLog(log, this.#iface, fragment); - } - catch (error) { - return new UndecodedEventLog(log, error); - } - } - return log; - }); - } -} -/** - * A **ContractTransactionResponse** will return a - * [[ContractTransactionReceipt]] when waited on. - */ -class ContractTransactionResponse extends providers_provider/* TransactionResponse */.uI { - #iface; - /** - * @_ignore: - */ - constructor(iface, provider, tx) { - super(tx, provider); - this.#iface = iface; - } - /** - * Resolves once this transaction has been mined and has - * %%confirms%% blocks including it (default: ``1``) with an - * optional %%timeout%%. - * - * This can resolve to ``null`` only if %%confirms%% is ``0`` - * and the transaction has not been mined, otherwise this will - * wait until enough confirmations have completed. - */ - async wait(confirms, timeout) { - const receipt = await super.wait(confirms, timeout); - if (receipt == null) { - return null; - } - return new ContractTransactionReceipt(this.#iface, this.provider, receipt); - } -} -/** - * A **ContractUnknownEventPayload** is included as the last parameter to - * Contract Events when the event does not match any events in the ABI. - */ -class ContractUnknownEventPayload extends events/* EventPayload */.z { - /** - * The log with no matching events. - */ - log; - /** - * @_event: - */ - constructor(contract, listener, filter, log) { - super(contract, listener, filter); - (0,properties/* defineProperties */.n)(this, { log }); - } - /** - * Resolves to the block the event occured in. - */ - async getBlock() { - return await this.log.getBlock(); - } - /** - * Resolves to the transaction the event occured in. - */ - async getTransaction() { - return await this.log.getTransaction(); - } - /** - * Resolves to the transaction receipt the event occured in. - */ - async getTransactionReceipt() { - return await this.log.getTransactionReceipt(); - } -} -/** - * A **ContractEventPayload** is included as the last parameter to - * Contract Events when the event is known. - */ -class ContractEventPayload extends ContractUnknownEventPayload { - /** - * @_ignore: - */ - constructor(contract, listener, filter, fragment, _log) { - super(contract, listener, filter, new EventLog(_log, contract.interface, fragment)); - const args = contract.interface.decodeEventLog(fragment, this.log.data, this.log.topics); - (0,properties/* defineProperties */.n)(this, { args, fragment }); - } - /** - * The event name. - */ - get eventName() { - return this.fragment.name; - } - /** - * The event signature. - */ - get eventSignature() { - return this.fragment.format(); - } -} -//# sourceMappingURL=wrappers.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/contract/contract.js +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ FC: () => (/* binding */ copyOverrides), +/* harmony export */ NZ: () => (/* binding */ Contract), +/* harmony export */ Uq: () => (/* binding */ BaseContract), +/* harmony export */ yN: () => (/* binding */ resolveArgs) +/* harmony export */ }); +/* harmony import */ var _abi_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(19353); +/* harmony import */ var _abi_index_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(73622); +/* harmony import */ var _address_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(41442); +/* harmony import */ var _providers_provider_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(43948); +/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(88081); +/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(57339); +/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(27033); +/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(36212); +/* harmony import */ var _wrappers_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(24359); // import from provider.ts instead of index.ts to prevent circular dep @@ -163812,7 +203301,7 @@ class PreparedTopicFilter { #filter; fragment; constructor(contract, fragment, args) { - (0,properties/* defineProperties */.n)(this, { fragment }); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .defineProperties */ .n)(this, { fragment }); if (fragment.inputs.length < args.length) { throw new Error("too many arguments"); } @@ -163828,9 +203317,9 @@ class PreparedTopicFilter { return param.walkAsync(args[index], (type, value) => { if (type === "address") { if (Array.isArray(value)) { - return Promise.all(value.map((v) => (0,checks/* resolveAddress */.tG)(v, resolver))); + return Promise.all(value.map((v) => (0,_address_index_js__WEBPACK_IMPORTED_MODULE_1__/* .resolveAddress */ .tG)(v, resolver))); } - return (0,checks/* resolveAddress */.tG)(value, resolver); + return (0,_address_index_js__WEBPACK_IMPORTED_MODULE_1__/* .resolveAddress */ .tG)(value, resolver); } return value; }); @@ -163871,12 +203360,12 @@ function getProvider(value) { */ async function copyOverrides(arg, allowed) { // Make sure the overrides passed in are a valid overrides object - const _overrides = typed/* Typed */.V.dereference(arg, "overrides"); - (0,errors/* assertArgument */.MR)(typeof (_overrides) === "object", "invalid overrides parameter", "overrides", arg); + const _overrides = _abi_index_js__WEBPACK_IMPORTED_MODULE_2__/* .Typed */ .V.dereference(arg, "overrides"); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assertArgument */ .MR)(typeof (_overrides) === "object", "invalid overrides parameter", "overrides", arg); // Create a shallow copy (we'll deep-ify anything needed during normalizing) - const overrides = (0,providers_provider/* copyRequest */.VS)(_overrides); - (0,errors/* assertArgument */.MR)(overrides.to == null || (allowed || []).indexOf("to") >= 0, "cannot override to", "overrides.to", overrides.to); - (0,errors/* assertArgument */.MR)(overrides.data == null || (allowed || []).indexOf("data") >= 0, "cannot override data", "overrides.data", overrides.data); + const overrides = (0,_providers_provider_js__WEBPACK_IMPORTED_MODULE_4__/* .copyRequest */ .VS)(_overrides); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assertArgument */ .MR)(overrides.to == null || (allowed || []).indexOf("to") >= 0, "cannot override to", "overrides.to", overrides.to); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assertArgument */ .MR)(overrides.data == null || (allowed || []).indexOf("data") >= 0, "cannot override data", "overrides.data", overrides.data); // Resolve any from if (overrides.from) { overrides.from = overrides.from; @@ -163892,9 +203381,9 @@ async function resolveArgs(_runner, inputs, args) { const resolver = canResolve(runner) ? runner : null; return await Promise.all(inputs.map((param, index) => { return param.walkAsync(args[index], (type, value) => { - value = typed/* Typed */.V.dereference(value, type); + value = _abi_index_js__WEBPACK_IMPORTED_MODULE_2__/* .Typed */ .V.dereference(value, type); if (type === "address") { - return (0,checks/* resolveAddress */.tG)(value, resolver); + return (0,_address_index_js__WEBPACK_IMPORTED_MODULE_1__/* .resolveAddress */ .tG)(value, resolver); } return value; }); @@ -163906,31 +203395,31 @@ function buildWrappedFallback(contract) { const tx = (await copyOverrides(overrides, ["data"])); tx.to = await contract.getAddress(); if (tx.from) { - tx.from = await (0,checks/* resolveAddress */.tG)(tx.from, getResolver(contract.runner)); + tx.from = await (0,_address_index_js__WEBPACK_IMPORTED_MODULE_1__/* .resolveAddress */ .tG)(tx.from, getResolver(contract.runner)); } const iface = contract.interface; - const noValue = ((0,maths/* getBigInt */.Ab)((tx.value || BN_0), "overrides.value") === BN_0); + const noValue = ((0,_utils_index_js__WEBPACK_IMPORTED_MODULE_5__/* .getBigInt */ .Ab)((tx.value || BN_0), "overrides.value") === BN_0); const noData = ((tx.data || "0x") === "0x"); if (iface.fallback && !iface.fallback.payable && iface.receive && !noData && !noValue) { - (0,errors/* assertArgument */.MR)(false, "cannot send data to receive or send value to non-payable fallback", "overrides", overrides); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assertArgument */ .MR)(false, "cannot send data to receive or send value to non-payable fallback", "overrides", overrides); } - (0,errors/* assertArgument */.MR)(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assertArgument */ .MR)(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data); // Only allow payable contracts to set non-zero value const payable = iface.receive || (iface.fallback && iface.fallback.payable); - (0,errors/* assertArgument */.MR)(payable || noValue, "cannot send value to non-payable fallback", "overrides.value", tx.value); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assertArgument */ .MR)(payable || noValue, "cannot send value to non-payable fallback", "overrides.value", tx.value); // Only allow fallback contracts to set non-empty data - (0,errors/* assertArgument */.MR)(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assertArgument */ .MR)(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data); return tx; }; const staticCall = async function (overrides) { const runner = getRunner(contract.runner, "call"); - (0,errors/* assert */.vA)(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .vA)(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); const tx = await populateTransaction(overrides); try { return await runner.call(tx); } catch (error) { - if ((0,errors/* isCallException */.E)(error) && error.data) { + if ((0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .isCallException */ .E)(error) && error.data) { throw contract.interface.makeError(error.data, tx); } throw error; @@ -163938,22 +203427,22 @@ function buildWrappedFallback(contract) { }; const send = async function (overrides) { const runner = contract.runner; - (0,errors/* assert */.vA)(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .vA)(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); const tx = await runner.sendTransaction(await populateTransaction(overrides)); const provider = getProvider(contract.runner); // @TODO: the provider can be null; make a custom dummy provider that will throw a // meaningful error - return new ContractTransactionResponse(contract.interface, provider, tx); + return new _wrappers_js__WEBPACK_IMPORTED_MODULE_6__/* .ContractTransactionResponse */ .Cn(contract.interface, provider, tx); }; const estimateGas = async function (overrides) { const runner = getRunner(contract.runner, "estimateGas"); - (0,errors/* assert */.vA)(canEstimate(runner), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .vA)(canEstimate(runner), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }); return await runner.estimateGas(await populateTransaction(overrides)); }; const method = async (overrides) => { return await send(overrides); }; - (0,properties/* defineProperties */.n)(method, { + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .defineProperties */ .n)(method, { _contract: contract, estimateGas, populateTransaction, @@ -163964,7 +203453,7 @@ function buildWrappedFallback(contract) { function buildWrappedMethod(contract, key) { const getFragment = function (...args) { const fragment = contract.interface.getFunction(key, args); - (0,errors/* assert */.vA)(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .vA)(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { operation: "fragment", info: { key, args } }); @@ -163977,14 +203466,14 @@ function buildWrappedMethod(contract, key) { if (fragment.inputs.length + 1 === args.length) { overrides = await copyOverrides(args.pop()); if (overrides.from) { - overrides.from = await (0,checks/* resolveAddress */.tG)(overrides.from, getResolver(contract.runner)); + overrides.from = await (0,_address_index_js__WEBPACK_IMPORTED_MODULE_1__/* .resolveAddress */ .tG)(overrides.from, getResolver(contract.runner)); } } if (fragment.inputs.length !== args.length) { throw new Error("internal error: fragment inputs doesn't match arguments; should not happen"); } const resolvedArgs = await resolveArgs(contract.runner, fragment.inputs, args); - return Object.assign({}, overrides, await (0,properties/* resolveProperties */.k)({ + return Object.assign({}, overrides, await (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .resolveProperties */ .k)({ to: contract.getAddress(), data: contract.interface.encodeFunctionData(fragment, resolvedArgs) })); @@ -163998,28 +203487,28 @@ function buildWrappedMethod(contract, key) { }; const send = async function (...args) { const runner = contract.runner; - (0,errors/* assert */.vA)(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .vA)(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); const tx = await runner.sendTransaction(await populateTransaction(...args)); const provider = getProvider(contract.runner); // @TODO: the provider can be null; make a custom dummy provider that will throw a // meaningful error - return new ContractTransactionResponse(contract.interface, provider, tx); + return new _wrappers_js__WEBPACK_IMPORTED_MODULE_6__/* .ContractTransactionResponse */ .Cn(contract.interface, provider, tx); }; const estimateGas = async function (...args) { const runner = getRunner(contract.runner, "estimateGas"); - (0,errors/* assert */.vA)(canEstimate(runner), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .vA)(canEstimate(runner), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }); return await runner.estimateGas(await populateTransaction(...args)); }; const staticCallResult = async function (...args) { const runner = getRunner(contract.runner, "call"); - (0,errors/* assert */.vA)(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .vA)(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); const tx = await populateTransaction(...args); let result = "0x"; try { result = await runner.call(tx); } catch (error) { - if ((0,errors/* isCallException */.E)(error) && error.data) { + if ((0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .isCallException */ .E)(error) && error.data) { throw contract.interface.makeError(error.data, tx); } throw error; @@ -164034,7 +203523,7 @@ function buildWrappedMethod(contract, key) { } return await send(...args); }; - (0,properties/* defineProperties */.n)(method, { + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .defineProperties */ .n)(method, { name: contract.interface.getFunctionName(key), _contract: contract, _key: key, getFragment, @@ -164048,7 +203537,7 @@ function buildWrappedMethod(contract, key) { enumerable: true, get: () => { const fragment = contract.interface.getFunction(key); - (0,errors/* assert */.vA)(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .vA)(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { operation: "fragment", info: { key } }); @@ -164060,7 +203549,7 @@ function buildWrappedMethod(contract, key) { function buildWrappedEvent(contract, key) { const getFragment = function (...args) { const fragment = contract.interface.getEvent(key, args); - (0,errors/* assert */.vA)(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .vA)(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { operation: "fragment", info: { key, args } }); @@ -164069,7 +203558,7 @@ function buildWrappedEvent(contract, key) { const method = function (...args) { return new PreparedTopicFilter(contract, getFragment(...args), args); }; - (0,properties/* defineProperties */.n)(method, { + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .defineProperties */ .n)(method, { name: contract.interface.getEventName(key), _contract: contract, _key: key, getFragment @@ -164080,7 +203569,7 @@ function buildWrappedEvent(contract, key) { enumerable: true, get: () => { const fragment = contract.interface.getEvent(key); - (0,errors/* assert */.vA)(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .vA)(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { operation: "fragment", info: { key } }); @@ -164112,11 +203601,11 @@ async function getSubInfo(contract, event) { // events which need deconstructing. if (Array.isArray(event)) { const topicHashify = function (name) { - if ((0,data/* isHexString */.Lo)(name, 32)) { + if ((0,_utils_index_js__WEBPACK_IMPORTED_MODULE_7__/* .isHexString */ .Lo)(name, 32)) { return name; } const fragment = contract.interface.getEvent(name); - (0,errors/* assertArgument */.MR)(fragment, "unknown fragment", "name", name); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assertArgument */ .MR)(fragment, "unknown fragment", "name", name); return fragment.topicHash; }; // Array of Topics and Names; e.g. `[ "0x1234...89ab", "Transfer(address)" ]` @@ -164134,14 +203623,14 @@ async function getSubInfo(contract, event) { topics = [null]; } else if (typeof (event) === "string") { - if ((0,data/* isHexString */.Lo)(event, 32)) { + if ((0,_utils_index_js__WEBPACK_IMPORTED_MODULE_7__/* .isHexString */ .Lo)(event, 32)) { // Topic Hash topics = [event]; } else { // Name or Signature; e.g. `"Transfer", `"Transfer(address)"` fragment = contract.interface.getEvent(event); - (0,errors/* assertArgument */.MR)(fragment, "unknown fragment", "event", event); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assertArgument */ .MR)(fragment, "unknown fragment", "event", event); topics = [fragment.topicHash]; } } @@ -164155,7 +203644,7 @@ async function getSubInfo(contract, event) { topics = [fragment.topicHash]; } else { - (0,errors/* assertArgument */.MR)(false, "unknown event name", "event", event); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assertArgument */ .MR)(false, "unknown event name", "event", event); } // Normalize topics and sort TopicSets topics = topics.map((t) => { @@ -164190,7 +203679,7 @@ async function hasSub(contract, event) { async function getSub(contract, operation, event) { // Make sure our runner can actually subscribe to events const provider = getProvider(contract.runner); - (0,errors/* assert */.vA)(provider, "contract runner does not support subscribing", "UNSUPPORTED_OPERATION", { operation }); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .vA)(provider, "contract runner does not support subscribing", "UNSUPPORTED_OPERATION", { operation }); const { fragment, tag, topics } = await getSubInfo(contract, event); const { addr, subs } = getInternal(contract); let sub = subs.get(tag); @@ -164210,12 +203699,12 @@ async function getSub(contract, operation, event) { const _foundFragment = foundFragment; const args = fragment ? contract.interface.decodeEventLog(fragment, log.data, log.topics) : []; emit(contract, event, args, (listener) => { - return new ContractEventPayload(contract, listener, event, _foundFragment, log); + return new _wrappers_js__WEBPACK_IMPORTED_MODULE_6__/* .ContractEventPayload */ .HZ(contract, listener, event, _foundFragment, log); }); } else { emit(contract, event, [], (listener) => { - return new ContractUnknownEventPayload(contract, listener, event, log); + return new _wrappers_js__WEBPACK_IMPORTED_MODULE_6__/* .ContractUnknownEventPayload */ ._k(contract, listener, event, log); }); } }; @@ -164317,12 +203806,12 @@ class BaseContract { * of. */ constructor(target, abi, runner, _deployTx) { - (0,errors/* assertArgument */.MR)(typeof (target) === "string" || (0,checks/* isAddressable */.$C)(target), "invalid value for Contract target", "target", target); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assertArgument */ .MR)(typeof (target) === "string" || (0,_address_index_js__WEBPACK_IMPORTED_MODULE_1__/* .isAddressable */ .$C)(target), "invalid value for Contract target", "target", target); if (runner == null) { runner = null; } - const iface = abi_interface/* Interface */.KA.from(abi); - (0,properties/* defineProperties */.n)(this, { target, runner, interface: iface }); + const iface = _abi_index_js__WEBPACK_IMPORTED_MODULE_8__/* .Interface */ .KA.from(abi); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .defineProperties */ .n)(this, { target, runner, interface: iface }); Object.defineProperty(this, internal, { value: {} }); let addrPromise; let addr = null; @@ -164331,25 +203820,25 @@ class BaseContract { const provider = getProvider(runner); // @TODO: the provider can be null; make a custom dummy provider that will throw a // meaningful error - deployTx = new ContractTransactionResponse(this.interface, provider, _deployTx); + deployTx = new _wrappers_js__WEBPACK_IMPORTED_MODULE_6__/* .ContractTransactionResponse */ .Cn(this.interface, provider, _deployTx); } let subs = new Map(); // Resolve the target as the address if (typeof (target) === "string") { - if ((0,data/* isHexString */.Lo)(target)) { + if ((0,_utils_index_js__WEBPACK_IMPORTED_MODULE_7__/* .isHexString */ .Lo)(target)) { addr = target; addrPromise = Promise.resolve(target); } else { const resolver = getRunner(runner, "resolveName"); if (!canResolve(resolver)) { - throw (0,errors/* makeError */.xz)("contract runner does not support name resolution", "UNSUPPORTED_OPERATION", { + throw (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .makeError */ .xz)("contract runner does not support name resolution", "UNSUPPORTED_OPERATION", { operation: "resolveName" }); } addrPromise = resolver.resolveName(target).then((addr) => { if (addr == null) { - throw (0,errors/* makeError */.xz)("an ENS name used for a contract target must be correctly configured", "UNCONFIGURED_NAME", { + throw (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .makeError */ .xz)("an ENS name used for a contract target must be correctly configured", "UNCONFIGURED_NAME", { value: target }); } @@ -164380,7 +203869,7 @@ class BaseContract { return this.getEvent(prop); } catch (error) { - if (!(0,errors/* isError */.bJ)(error, "INVALID_ARGUMENT") || error.argument !== "key") { + if (!(0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .isError */ .bJ)(error, "INVALID_ARGUMENT") || error.argument !== "key") { throw error; } } @@ -164394,8 +203883,8 @@ class BaseContract { return Reflect.has(target, prop) || this.interface.hasEvent(String(prop)); } }); - (0,properties/* defineProperties */.n)(this, { filters }); - (0,properties/* defineProperties */.n)(this, { + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .defineProperties */ .n)(this, { filters }); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .defineProperties */ .n)(this, { fallback: ((iface.receive || iface.fallback) ? (buildWrappedFallback(this)) : null) }); // Return a Proxy that will respond to functions @@ -164409,7 +203898,7 @@ class BaseContract { return target.getFunction(prop); } catch (error) { - if (!(0,errors/* isError */.bJ)(error, "INVALID_ARGUMENT") || error.argument !== "key") { + if (!(0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .isError */ .bJ)(error, "INVALID_ARGUMENT") || error.argument !== "key") { throw error; } } @@ -164446,7 +203935,7 @@ class BaseContract { */ async getDeployedCode() { const provider = getProvider(this.runner); - (0,errors/* assert */.vA)(provider, "runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "getDeployedCode" }); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .vA)(provider, "runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "getDeployedCode" }); const code = await provider.getCode(await this.getAddress()); if (code === "0x") { return null; @@ -164471,7 +203960,7 @@ class BaseContract { } // Make sure we can subscribe to a provider event const provider = getProvider(this.runner); - (0,errors/* assert */.vA)(provider != null, "contract runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "waitForDeployment" }); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .vA)(provider != null, "contract runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "waitForDeployment" }); return new Promise((resolve, reject) => { const checkCode = async () => { try { @@ -164558,7 +204047,7 @@ class BaseContract { const { fragment, topics } = await getSubInfo(this, event); const filter = { address, topics, fromBlock, toBlock }; const provider = getProvider(this.runner); - (0,errors/* assert */.vA)(provider, "contract runner does not have a provider", "UNSUPPORTED_OPERATION", { operation: "queryFilter" }); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .vA)(provider, "contract runner does not have a provider", "UNSUPPORTED_OPERATION", { operation: "queryFilter" }); return (await provider.getLogs(filter)).map((log) => { let foundFragment = fragment; if (foundFragment == null) { @@ -164569,13 +204058,13 @@ class BaseContract { } if (foundFragment) { try { - return new EventLog(log, this.interface, foundFragment); + return new _wrappers_js__WEBPACK_IMPORTED_MODULE_6__/* .EventLog */ .vu(log, this.interface, foundFragment); } catch (error) { - return new UndecodedEventLog(log, error); + return new _wrappers_js__WEBPACK_IMPORTED_MODULE_6__/* .UndecodedEventLog */ .AA(log, error); } } - return new providers_provider/* Log */.tG(log, provider); + return new _providers_provider_js__WEBPACK_IMPORTED_MODULE_4__/* .Log */ .tG(log, provider); }); } /** @@ -164733,7 +204222,202 @@ class Contract extends _ContractBase() { /***/ }), -/***/ 8180: +/***/ 24359: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AA: () => (/* binding */ UndecodedEventLog), +/* harmony export */ Cn: () => (/* binding */ ContractTransactionResponse), +/* harmony export */ HZ: () => (/* binding */ ContractEventPayload), +/* harmony export */ _k: () => (/* binding */ ContractUnknownEventPayload), +/* harmony export */ vu: () => (/* binding */ EventLog) +/* harmony export */ }); +/* unused harmony export ContractTransactionReceipt */ +/* harmony import */ var _providers_provider_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(43948); +/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(88081); +/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(99381); +// import from provider.ts instead of index.ts to prevent circular dep +// from EtherscanProvider + + +/** + * An **EventLog** contains additional properties parsed from the [[Log]]. + */ +class EventLog extends _providers_provider_js__WEBPACK_IMPORTED_MODULE_0__/* .Log */ .tG { + /** + * The Contract Interface. + */ + interface; + /** + * The matching event. + */ + fragment; + /** + * The parsed arguments passed to the event by ``emit``. + */ + args; + /** + * @_ignore: + */ + constructor(log, iface, fragment) { + super(log, log.provider); + const args = iface.decodeEventLog(fragment, log.data, log.topics); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_1__/* .defineProperties */ .n)(this, { args, fragment, interface: iface }); + } + /** + * The name of the event. + */ + get eventName() { return this.fragment.name; } + /** + * The signature of the event. + */ + get eventSignature() { return this.fragment.format(); } +} +/** + * An **EventLog** contains additional properties parsed from the [[Log]]. + */ +class UndecodedEventLog extends _providers_provider_js__WEBPACK_IMPORTED_MODULE_0__/* .Log */ .tG { + /** + * The error encounted when trying to decode the log. + */ + error; + /** + * @_ignore: + */ + constructor(log, error) { + super(log, log.provider); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_1__/* .defineProperties */ .n)(this, { error }); + } +} +/** + * A **ContractTransactionReceipt** includes the parsed logs from a + * [[TransactionReceipt]]. + */ +class ContractTransactionReceipt extends _providers_provider_js__WEBPACK_IMPORTED_MODULE_0__/* .TransactionReceipt */ .z5 { + #iface; + /** + * @_ignore: + */ + constructor(iface, provider, tx) { + super(tx, provider); + this.#iface = iface; + } + /** + * The parsed logs for any [[Log]] which has a matching event in the + * Contract ABI. + */ + get logs() { + return super.logs.map((log) => { + const fragment = log.topics.length ? this.#iface.getEvent(log.topics[0]) : null; + if (fragment) { + try { + return new EventLog(log, this.#iface, fragment); + } + catch (error) { + return new UndecodedEventLog(log, error); + } + } + return log; + }); + } +} +/** + * A **ContractTransactionResponse** will return a + * [[ContractTransactionReceipt]] when waited on. + */ +class ContractTransactionResponse extends _providers_provider_js__WEBPACK_IMPORTED_MODULE_0__/* .TransactionResponse */ .uI { + #iface; + /** + * @_ignore: + */ + constructor(iface, provider, tx) { + super(tx, provider); + this.#iface = iface; + } + /** + * Resolves once this transaction has been mined and has + * %%confirms%% blocks including it (default: ``1``) with an + * optional %%timeout%%. + * + * This can resolve to ``null`` only if %%confirms%% is ``0`` + * and the transaction has not been mined, otherwise this will + * wait until enough confirmations have completed. + */ + async wait(confirms, timeout) { + const receipt = await super.wait(confirms, timeout); + if (receipt == null) { + return null; + } + return new ContractTransactionReceipt(this.#iface, this.provider, receipt); + } +} +/** + * A **ContractUnknownEventPayload** is included as the last parameter to + * Contract Events when the event does not match any events in the ABI. + */ +class ContractUnknownEventPayload extends _utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .EventPayload */ .z { + /** + * The log with no matching events. + */ + log; + /** + * @_event: + */ + constructor(contract, listener, filter, log) { + super(contract, listener, filter); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_1__/* .defineProperties */ .n)(this, { log }); + } + /** + * Resolves to the block the event occured in. + */ + async getBlock() { + return await this.log.getBlock(); + } + /** + * Resolves to the transaction the event occured in. + */ + async getTransaction() { + return await this.log.getTransaction(); + } + /** + * Resolves to the transaction receipt the event occured in. + */ + async getTransactionReceipt() { + return await this.log.getTransactionReceipt(); + } +} +/** + * A **ContractEventPayload** is included as the last parameter to + * Contract Events when the event is known. + */ +class ContractEventPayload extends ContractUnknownEventPayload { + /** + * @_ignore: + */ + constructor(contract, listener, filter, fragment, _log) { + super(contract, listener, filter, new EventLog(_log, contract.interface, fragment)); + const args = contract.interface.decodeEventLog(fragment, this.log.data, this.log.topics); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_1__/* .defineProperties */ .n)(this, { args, fragment }); + } + /** + * The event name. + */ + get eventName() { + return this.fragment.name; + } + /** + * The event signature. + */ + get eventSignature() { + return this.fragment.format(); + } +} +//# sourceMappingURL=wrappers.js.map + +/***/ }), + +/***/ 68682: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; @@ -164746,19 +204430,19 @@ __webpack_require__.d(__webpack_exports__, { po: () => (/* binding */ randomBytes) }); -// EXTERNAL MODULE: ./node_modules/ethers/node_modules/@noble/hashes/esm/hmac.js -var hmac = __webpack_require__(4655); -// EXTERNAL MODULE: ./node_modules/ethers/node_modules/@noble/hashes/esm/pbkdf2.js -var pbkdf2 = __webpack_require__(84877); -// EXTERNAL MODULE: ./node_modules/ethers/node_modules/@noble/hashes/esm/sha256.js -var sha256 = __webpack_require__(3439); -// EXTERNAL MODULE: ./node_modules/ethers/node_modules/@noble/hashes/esm/_sha2.js -var _sha2 = __webpack_require__(37171); -// EXTERNAL MODULE: ./node_modules/ethers/node_modules/@noble/hashes/esm/_u64.js -var _u64 = __webpack_require__(86558); -// EXTERNAL MODULE: ./node_modules/ethers/node_modules/@noble/hashes/esm/utils.js + 1 modules -var utils = __webpack_require__(10750); -;// CONCATENATED MODULE: ./node_modules/ethers/node_modules/@noble/hashes/esm/sha512.js +// EXTERNAL MODULE: ./node_modules/@noble/hashes/esm/hmac.js +var hmac = __webpack_require__(21454); +// EXTERNAL MODULE: ./node_modules/@noble/hashes/esm/pbkdf2.js +var pbkdf2 = __webpack_require__(2200); +// EXTERNAL MODULE: ./node_modules/@noble/hashes/esm/sha256.js +var sha256 = __webpack_require__(78226); +// EXTERNAL MODULE: ./node_modules/@noble/hashes/esm/_sha2.js +var _sha2 = __webpack_require__(6800); +// EXTERNAL MODULE: ./node_modules/@noble/hashes/esm/_u64.js +var _u64 = __webpack_require__(79271); +// EXTERNAL MODULE: ./node_modules/@noble/hashes/esm/utils.js + 1 modules +var utils = __webpack_require__(32531); +;// ./node_modules/@noble/hashes/esm/sha512.js @@ -164992,7 +204676,7 @@ const sha384 = /* @__PURE__ */ (/* unused pure expression or super */ null && (w //# sourceMappingURL=sha512.js.map // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/errors.js var errors = __webpack_require__(57339); -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/crypto/crypto-browser.js +;// ./node_modules/ethers/lib.esm/crypto/crypto-browser.js /* Browser Crypto Shims */ @@ -165044,7 +204728,7 @@ function randomBytes(length) { /***/ }), -/***/ 15539: +/***/ 2011: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; @@ -165054,13 +204738,13 @@ __webpack_require__.d(__webpack_exports__, { S: () => (/* binding */ keccak256) }); -// EXTERNAL MODULE: ./node_modules/ethers/node_modules/@noble/hashes/esm/_assert.js -var _assert = __webpack_require__(27125); -// EXTERNAL MODULE: ./node_modules/ethers/node_modules/@noble/hashes/esm/_u64.js -var _u64 = __webpack_require__(86558); -// EXTERNAL MODULE: ./node_modules/ethers/node_modules/@noble/hashes/esm/utils.js + 1 modules -var utils = __webpack_require__(10750); -;// CONCATENATED MODULE: ./node_modules/ethers/node_modules/@noble/hashes/esm/sha3.js +// EXTERNAL MODULE: ./node_modules/@noble/hashes/esm/_assert.js +var _assert = __webpack_require__(89190); +// EXTERNAL MODULE: ./node_modules/@noble/hashes/esm/_u64.js +var _u64 = __webpack_require__(79271); +// EXTERNAL MODULE: ./node_modules/@noble/hashes/esm/utils.js + 1 modules +var utils = __webpack_require__(32531); +;// ./node_modules/@noble/hashes/esm/sha3.js @@ -165271,7 +204955,7 @@ const shake256 = /* @__PURE__ */ (/* unused pure expression or super */ null && //# sourceMappingURL=sha3.js.map // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/data.js var utils_data = __webpack_require__(36212); -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/crypto/keccak.js +;// ./node_modules/ethers/lib.esm/crypto/keccak.js /** * Cryptographic hashing functions * @@ -165331,7 +205015,7 @@ Object.freeze(keccak256); /* harmony export */ s: () => (/* binding */ sha256) /* harmony export */ }); /* unused harmony export sha512 */ -/* harmony import */ var _crypto_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8180); +/* harmony import */ var _crypto_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(68682); /* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(36212); @@ -165417,7 +205101,7 @@ __webpack_require__.d(__webpack_exports__, { t: () => (/* binding */ Signature) }); -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/constants/hashes.js +;// ./node_modules/ethers/lib.esm/constants/hashes.js /** * A constant for the zero hash. * @@ -165431,7 +205115,7 @@ var data = __webpack_require__(36212); var maths = __webpack_require__(27033); // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/errors.js var errors = __webpack_require__(57339); -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/crypto/signature.js +;// ./node_modules/ethers/lib.esm/crypto/signature.js // Constants @@ -165736,7 +205420,7 @@ class Signature { /***/ }), -/***/ 15496: +/***/ 72588: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; @@ -165746,26 +205430,26 @@ __webpack_require__.d(__webpack_exports__, { h: () => (/* binding */ SigningKey) }); -// NAMESPACE OBJECT: ./node_modules/ethers/node_modules/@noble/curves/esm/abstract/utils.js +// NAMESPACE OBJECT: ./node_modules/@noble/curves/esm/abstract/utils.js var utils_namespaceObject = {}; __webpack_require__.r(utils_namespaceObject); __webpack_require__.d(utils_namespaceObject, { OG: () => (bitMask), My: () => (bytesToHex), - bytesToNumberBE: () => (utils_bytesToNumberBE), + Ph: () => (utils_bytesToNumberBE), lX: () => (utils_bytesToNumberLE), Id: () => (utils_concatBytes), fg: () => (createHmacDrbg), qj: () => (utils_ensureBytes), - hexToBytes: () => (hexToBytes), + aT: () => (hexToBytes), lq: () => (utils_numberToBytesBE), z: () => (numberToBytesLE), Q5: () => (validateObject) }); -// EXTERNAL MODULE: ./node_modules/ethers/node_modules/@noble/hashes/esm/sha256.js -var esm_sha256 = __webpack_require__(3439); -;// CONCATENATED MODULE: ./node_modules/ethers/node_modules/@noble/curves/esm/abstract/utils.js +// EXTERNAL MODULE: ./node_modules/@noble/hashes/esm/sha256.js +var esm_sha256 = __webpack_require__(78226); +;// ./node_modules/@noble/curves/esm/abstract/utils.js /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ // 100 lines of code in the file are duplicated from noble-hashes (utils). // This is OK: `abstract` directory does not use noble-hashes. @@ -166032,7 +205716,7 @@ function validateObject(object, validators, optValidators = {}) { // const z3 = validateObject(o, { test: 'boolean', z: 'bug' }); // const z4 = validateObject(o, { a: 'boolean', z: 'bug' }); //# sourceMappingURL=utils.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/node_modules/@noble/curves/esm/abstract/modular.js +;// ./node_modules/@noble/curves/esm/abstract/modular.js /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ // Utilities for modular arithmetics and finite fields @@ -166449,11 +206133,11 @@ function mapHashToField(key, fieldOrder, isLE = false) { return isLE ? numberToBytesLE(reduced, fieldLen) : utils_numberToBytesBE(reduced, fieldLen); } //# sourceMappingURL=modular.js.map -// EXTERNAL MODULE: ./node_modules/ethers/node_modules/@noble/hashes/esm/hmac.js -var hmac = __webpack_require__(4655); -// EXTERNAL MODULE: ./node_modules/ethers/node_modules/@noble/hashes/esm/utils.js + 1 modules -var utils = __webpack_require__(10750); -;// CONCATENATED MODULE: ./node_modules/ethers/node_modules/@noble/curves/esm/abstract/curve.js +// EXTERNAL MODULE: ./node_modules/@noble/hashes/esm/hmac.js +var hmac = __webpack_require__(21454); +// EXTERNAL MODULE: ./node_modules/@noble/hashes/esm/utils.js + 1 modules +var utils = __webpack_require__(32531); +;// ./node_modules/@noble/curves/esm/abstract/curve.js /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ // Abelian group utilities @@ -166610,7 +206294,7 @@ function validateBasic(curve) { }); } //# sourceMappingURL=curve.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/node_modules/@noble/curves/esm/abstract/weierstrass.js +;// ./node_modules/@noble/curves/esm/abstract/weierstrass.js /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ // Short Weierstrass curve. The formula is: y² = x³ + ax + b @@ -166645,7 +206329,7 @@ function validatePointOpts(curve) { return Object.freeze({ ...opts }); } // ASN.1 DER encoding utilities -const { bytesToNumberBE: b2n, hexToBytes: h2b } = utils_namespaceObject; +const { /* bytesToNumberBE */ "Ph": b2n, /* hexToBytes */ "aT": h2b } = utils_namespaceObject; const DER = { // asn.1 DER encoding utils Err: class DERErr extends Error { @@ -167667,7 +207351,7 @@ function weierstrass_mapToCurveSimpleSWU(Fp, opts) { }; } //# sourceMappingURL=weierstrass.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/node_modules/@noble/curves/esm/_shortw_utils.js +;// ./node_modules/@noble/curves/esm/_shortw_utils.js /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ @@ -167685,7 +207369,7 @@ function createCurve(curveDef, defHash) { return Object.freeze({ ...create(defHash), create }); } //# sourceMappingURL=_shortw_utils.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/node_modules/@noble/curves/esm/secp256k1.js +;// ./node_modules/@noble/curves/esm/secp256k1.js /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ @@ -167948,7 +207632,7 @@ var data = __webpack_require__(36212); var maths = __webpack_require__(27033); // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/crypto/signature.js + 1 modules var crypto_signature = __webpack_require__(20260); -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/crypto/signing-key.js +;// ./node_modules/ethers/lib.esm/crypto/signing-key.js /** * Add details about signing here. * @@ -168125,7 +207809,7 @@ class SigningKey { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ id: () => (/* binding */ id) /* harmony export */ }); -/* harmony import */ var _crypto_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15539); +/* harmony import */ var _crypto_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2011); /* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(87303); @@ -168161,14 +207845,14 @@ __webpack_require__.d(__webpack_exports__, { // UNUSED EXPORTS: ensNormalize, isValidName // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/crypto/keccak.js + 1 modules -var keccak = __webpack_require__(15539); +var keccak = __webpack_require__(2011); // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/errors.js var errors = __webpack_require__(57339); // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/utf8.js var utf8 = __webpack_require__(87303); // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/data.js var data = __webpack_require__(36212); -;// CONCATENATED MODULE: ./node_modules/@adraffy/ens-normalize/dist/index.mjs +;// ./node_modules/@adraffy/ens-normalize/dist/index.mjs // created 2023-09-25T01:01:55.148Z // compressed base64-encoded blob for include-ens data // source: https://github.com/adraffy/ens-normalize.js/blob/main/src/make.js @@ -169410,7 +209094,7 @@ function collapse_valid_tokens(tokens) { -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/hash/namehash.js +;// ./node_modules/ethers/lib.esm/hash/namehash.js @@ -169498,6 +209182,1060 @@ function dnsEncode(name, _maxLength) { /***/ }), +/***/ 82314: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ z: () => (/* binding */ TypedDataEncoder) +/* harmony export */ }); +/* unused harmony export verifyTypedData */ +/* harmony import */ var _address_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(30031); +/* harmony import */ var _crypto_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2011); +/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(36212); +/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27033); +/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(57339); +/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(88081); +/* harmony import */ var _id_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(38264); +//import { TypedDataDomain, TypedDataField } from "@ethersproject/providerabstract-signer"; + + + + + +const padding = new Uint8Array(32); +padding.fill(0); +const BN__1 = BigInt(-1); +const BN_0 = BigInt(0); +const BN_1 = BigInt(1); +const BN_MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +; +; +function hexPadRight(value) { + const bytes = (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .getBytes */ .q5)(value); + const padOffset = bytes.length % 32; + if (padOffset) { + return (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .concat */ .xW)([bytes, padding.slice(padOffset)]); + } + return (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .hexlify */ .c$)(bytes); +} +const hexTrue = (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_1__/* .toBeHex */ .up)(BN_1, 32); +const hexFalse = (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_1__/* .toBeHex */ .up)(BN_0, 32); +const domainFieldTypes = { + name: "string", + version: "string", + chainId: "uint256", + verifyingContract: "address", + salt: "bytes32" +}; +const domainFieldNames = [ + "name", "version", "chainId", "verifyingContract", "salt" +]; +function checkString(key) { + return function (value) { + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(typeof (value) === "string", `invalid domain value for ${JSON.stringify(key)}`, `domain.${key}`, value); + return value; + }; +} +const domainChecks = { + name: checkString("name"), + version: checkString("version"), + chainId: function (_value) { + const value = (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_1__/* .getBigInt */ .Ab)(_value, "domain.chainId"); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(value >= 0, "invalid chain ID", "domain.chainId", _value); + if (Number.isSafeInteger(value)) { + return Number(value); + } + return (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_1__/* .toQuantity */ .nD)(value); + }, + verifyingContract: function (value) { + try { + return (0,_address_index_js__WEBPACK_IMPORTED_MODULE_3__/* .getAddress */ .b)(value).toLowerCase(); + } + catch (error) { } + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(false, `invalid domain value "verifyingContract"`, "domain.verifyingContract", value); + }, + salt: function (value) { + const bytes = (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .getBytes */ .q5)(value, "domain.salt"); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(bytes.length === 32, `invalid domain value "salt"`, "domain.salt", value); + return (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .hexlify */ .c$)(bytes); + } +}; +function getBaseEncoder(type) { + // intXX and uintXX + { + const match = type.match(/^(u?)int(\d+)$/); + if (match) { + const signed = (match[1] === ""); + const width = parseInt(match[2]); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(width % 8 === 0 && width !== 0 && width <= 256 && match[2] === String(width), "invalid numeric width", "type", type); + const boundsUpper = (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_1__/* .mask */ .dK)(BN_MAX_UINT256, signed ? (width - 1) : width); + const boundsLower = signed ? ((boundsUpper + BN_1) * BN__1) : BN_0; + return function (_value) { + const value = (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_1__/* .getBigInt */ .Ab)(_value, "value"); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(value >= boundsLower && value <= boundsUpper, `value out-of-bounds for ${type}`, "value", value); + return (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_1__/* .toBeHex */ .up)(signed ? (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_1__/* .toTwos */ .JJ)(value, 256) : value, 32); + }; + } + } + // bytesXX + { + const match = type.match(/^bytes(\d+)$/); + if (match) { + const width = parseInt(match[1]); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(width !== 0 && width <= 32 && match[1] === String(width), "invalid bytes width", "type", type); + return function (value) { + const bytes = (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .getBytes */ .q5)(value); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(bytes.length === width, `invalid length for ${type}`, "value", value); + return hexPadRight(value); + }; + } + } + switch (type) { + case "address": return function (value) { + return (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .zeroPadValue */ .nx)((0,_address_index_js__WEBPACK_IMPORTED_MODULE_3__/* .getAddress */ .b)(value), 32); + }; + case "bool": return function (value) { + return ((!value) ? hexFalse : hexTrue); + }; + case "bytes": return function (value) { + return (0,_crypto_index_js__WEBPACK_IMPORTED_MODULE_4__/* .keccak256 */ .S)(value); + }; + case "string": return function (value) { + return (0,_id_js__WEBPACK_IMPORTED_MODULE_5__.id)(value); + }; + } + return null; +} +function encodeType(name, fields) { + return `${name}(${fields.map(({ name, type }) => (type + " " + name)).join(",")})`; +} +// foo[][3] => { base: "foo", index: "[][3]", array: { +// base: "foo", prefix: "foo[]", count: 3 } } +function splitArray(type) { + const match = type.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/); + if (match) { + return { + base: match[1], + index: (match[2] + match[4]), + array: { + base: match[1], + prefix: (match[1] + match[2]), + count: (match[5] ? parseInt(match[5]) : -1), + } + }; + } + return { base: type }; +} +/** + * A **TypedDataEncode** prepares and encodes [[link-eip-712]] payloads + * for signed typed data. + * + * This is useful for those that wish to compute various components of a + * typed data hash, primary types, or sub-components, but generally the + * higher level [[Signer-signTypedData]] is more useful. + */ +class TypedDataEncoder { + /** + * The primary type for the structured [[types]]. + * + * This is derived automatically from the [[types]], since no + * recursion is possible, once the DAG for the types is consturcted + * internally, the primary type must be the only remaining type with + * no parent nodes. + */ + primaryType; + #types; + /** + * The types. + */ + get types() { + return JSON.parse(this.#types); + } + #fullTypes; + #encoderCache; + /** + * Create a new **TypedDataEncoder** for %%types%%. + * + * This performs all necessary checking that types are valid and + * do not violate the [[link-eip-712]] structural constraints as + * well as computes the [[primaryType]]. + */ + constructor(_types) { + this.#fullTypes = new Map(); + this.#encoderCache = new Map(); + // Link struct types to their direct child structs + const links = new Map(); + // Link structs to structs which contain them as a child + const parents = new Map(); + // Link all subtypes within a given struct + const subtypes = new Map(); + const types = {}; + Object.keys(_types).forEach((type) => { + types[type] = _types[type].map(({ name, type }) => { + // Normalize the base type (unless name conflict) + let { base, index } = splitArray(type); + if (base === "int" && !_types["int"]) { + base = "int256"; + } + if (base === "uint" && !_types["uint"]) { + base = "uint256"; + } + return { name, type: (base + (index || "")) }; + }); + links.set(type, new Set()); + parents.set(type, []); + subtypes.set(type, new Set()); + }); + this.#types = JSON.stringify(types); + for (const name in types) { + const uniqueNames = new Set(); + for (const field of types[name]) { + // Check each field has a unique name + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(!uniqueNames.has(field.name), `duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", _types); + uniqueNames.add(field.name); + // Get the base type (drop any array specifiers) + const baseType = splitArray(field.type).base; + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(baseType !== name, `circular type reference to ${JSON.stringify(baseType)}`, "types", _types); + // Is this a base encoding type? + const encoder = getBaseEncoder(baseType); + if (encoder) { + continue; + } + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(parents.has(baseType), `unknown type ${JSON.stringify(baseType)}`, "types", _types); + // Add linkage + parents.get(baseType).push(name); + links.get(name).add(baseType); + } + } + // Deduce the primary type + const primaryTypes = Array.from(parents.keys()).filter((n) => (parents.get(n).length === 0)); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(primaryTypes.length !== 0, "missing primary type", "types", _types); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(primaryTypes.length === 1, `ambiguous primary types or unused types: ${primaryTypes.map((t) => (JSON.stringify(t))).join(", ")}`, "types", _types); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_6__/* .defineProperties */ .n)(this, { primaryType: primaryTypes[0] }); + // Check for circular type references + function checkCircular(type, found) { + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(!found.has(type), `circular type reference to ${JSON.stringify(type)}`, "types", _types); + found.add(type); + for (const child of links.get(type)) { + if (!parents.has(child)) { + continue; + } + // Recursively check children + checkCircular(child, found); + // Mark all ancestors as having this decendant + for (const subtype of found) { + subtypes.get(subtype).add(child); + } + } + found.delete(type); + } + checkCircular(this.primaryType, new Set()); + // Compute each fully describe type + for (const [name, set] of subtypes) { + const st = Array.from(set); + st.sort(); + this.#fullTypes.set(name, encodeType(name, types[name]) + st.map((t) => encodeType(t, types[t])).join("")); + } + } + /** + * Returnthe encoder for the specific %%type%%. + */ + getEncoder(type) { + let encoder = this.#encoderCache.get(type); + if (!encoder) { + encoder = this.#getEncoder(type); + this.#encoderCache.set(type, encoder); + } + return encoder; + } + #getEncoder(type) { + // Basic encoder type (address, bool, uint256, etc) + { + const encoder = getBaseEncoder(type); + if (encoder) { + return encoder; + } + } + // Array + const array = splitArray(type).array; + if (array) { + const subtype = array.prefix; + const subEncoder = this.getEncoder(subtype); + return (value) => { + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${array.count}`, "value", value); + let result = value.map(subEncoder); + if (this.#fullTypes.has(subtype)) { + result = result.map(_crypto_index_js__WEBPACK_IMPORTED_MODULE_4__/* .keccak256 */ .S); + } + return (0,_crypto_index_js__WEBPACK_IMPORTED_MODULE_4__/* .keccak256 */ .S)((0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .concat */ .xW)(result)); + }; + } + // Struct + const fields = this.types[type]; + if (fields) { + const encodedType = (0,_id_js__WEBPACK_IMPORTED_MODULE_5__.id)(this.#fullTypes.get(type)); + return (value) => { + const values = fields.map(({ name, type }) => { + const result = this.getEncoder(type)(value[name]); + if (this.#fullTypes.has(type)) { + return (0,_crypto_index_js__WEBPACK_IMPORTED_MODULE_4__/* .keccak256 */ .S)(result); + } + return result; + }); + values.unshift(encodedType); + return (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .concat */ .xW)(values); + }; + } + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(false, `unknown type: ${type}`, "type", type); + } + /** + * Return the full type for %%name%%. + */ + encodeType(name) { + const result = this.#fullTypes.get(name); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(result, `unknown type: ${JSON.stringify(name)}`, "name", name); + return result; + } + /** + * Return the encoded %%value%% for the %%type%%. + */ + encodeData(type, value) { + return this.getEncoder(type)(value); + } + /** + * Returns the hash of %%value%% for the type of %%name%%. + */ + hashStruct(name, value) { + return (0,_crypto_index_js__WEBPACK_IMPORTED_MODULE_4__/* .keccak256 */ .S)(this.encodeData(name, value)); + } + /** + * Return the fulled encoded %%value%% for the [[types]]. + */ + encode(value) { + return this.encodeData(this.primaryType, value); + } + /** + * Return the hash of the fully encoded %%value%% for the [[types]]. + */ + hash(value) { + return this.hashStruct(this.primaryType, value); + } + /** + * @_ignore: + */ + _visit(type, value, callback) { + // Basic encoder type (address, bool, uint256, etc) + { + const encoder = getBaseEncoder(type); + if (encoder) { + return callback(type, value); + } + } + // Array + const array = splitArray(type).array; + if (array) { + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${array.count}`, "value", value); + return value.map((v) => this._visit(array.prefix, v, callback)); + } + // Struct + const fields = this.types[type]; + if (fields) { + return fields.reduce((accum, { name, type }) => { + accum[name] = this._visit(type, value[name], callback); + return accum; + }, {}); + } + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(false, `unknown type: ${type}`, "type", type); + } + /** + * Call %%calback%% for each value in %%value%%, passing the type and + * component within %%value%%. + * + * This is useful for replacing addresses or other transformation that + * may be desired on each component, based on its type. + */ + visit(value, callback) { + return this._visit(this.primaryType, value, callback); + } + /** + * Create a new **TypedDataEncoder** for %%types%%. + */ + static from(types) { + return new TypedDataEncoder(types); + } + /** + * Return the primary type for %%types%%. + */ + static getPrimaryType(types) { + return TypedDataEncoder.from(types).primaryType; + } + /** + * Return the hashed struct for %%value%% using %%types%% and %%name%%. + */ + static hashStruct(name, types, value) { + return TypedDataEncoder.from(types).hashStruct(name, value); + } + /** + * Return the domain hash for %%domain%%. + */ + static hashDomain(domain) { + const domainFields = []; + for (const name in domain) { + if (domain[name] == null) { + continue; + } + const type = domainFieldTypes[name]; + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(type, `invalid typed-data domain key: ${JSON.stringify(name)}`, "domain", domain); + domainFields.push({ name, type }); + } + domainFields.sort((a, b) => { + return domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name); + }); + return TypedDataEncoder.hashStruct("EIP712Domain", { EIP712Domain: domainFields }, domain); + } + /** + * Return the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. + */ + static encode(domain, types, value) { + return (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .concat */ .xW)([ + "0x1901", + TypedDataEncoder.hashDomain(domain), + TypedDataEncoder.from(types).hash(value) + ]); + } + /** + * Return the hash of the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. + */ + static hash(domain, types, value) { + return (0,_crypto_index_js__WEBPACK_IMPORTED_MODULE_4__/* .keccak256 */ .S)(TypedDataEncoder.encode(domain, types, value)); + } + // Replaces all address types with ENS names with their looked up address + /** + * Resolves to the value from resolving all addresses in %%value%% for + * %%types%% and the %%domain%%. + */ + static async resolveNames(domain, types, value, resolveName) { + // Make a copy to isolate it from the object passed in + domain = Object.assign({}, domain); + // Allow passing null to ignore value + for (const key in domain) { + if (domain[key] == null) { + delete domain[key]; + } + } + // Look up all ENS names + const ensCache = {}; + // Do we need to look up the domain's verifyingContract? + if (domain.verifyingContract && !(0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .isHexString */ .Lo)(domain.verifyingContract, 20)) { + ensCache[domain.verifyingContract] = "0x"; + } + // We are going to use the encoder to visit all the base values + const encoder = TypedDataEncoder.from(types); + // Get a list of all the addresses + encoder.visit(value, (type, value) => { + if (type === "address" && !(0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .isHexString */ .Lo)(value, 20)) { + ensCache[value] = "0x"; + } + return value; + }); + // Lookup each name + for (const name in ensCache) { + ensCache[name] = await resolveName(name); + } + // Replace the domain verifyingContract if needed + if (domain.verifyingContract && ensCache[domain.verifyingContract]) { + domain.verifyingContract = ensCache[domain.verifyingContract]; + } + // Replace all ENS names with their address + value = encoder.visit(value, (type, value) => { + if (type === "address" && ensCache[value]) { + return ensCache[value]; + } + return value; + }); + return { domain, value }; + } + /** + * Returns the JSON-encoded payload expected by nodes which implement + * the JSON-RPC [[link-eip-712]] method. + */ + static getPayload(domain, types, value) { + // Validate the domain fields + TypedDataEncoder.hashDomain(domain); + // Derive the EIP712Domain Struct reference type + const domainValues = {}; + const domainTypes = []; + domainFieldNames.forEach((name) => { + const value = domain[name]; + if (value == null) { + return; + } + domainValues[name] = domainChecks[name](value); + domainTypes.push({ name, type: domainFieldTypes[name] }); + }); + const encoder = TypedDataEncoder.from(types); + // Get the normalized types + types = encoder.types; + const typesWithDomain = Object.assign({}, types); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(typesWithDomain.EIP712Domain == null, "types must not contain EIP712Domain type", "types.EIP712Domain", types); + typesWithDomain.EIP712Domain = domainTypes; + // Validate the data structures and types + encoder.encode(value); + return { + types: typesWithDomain, + domain: domainValues, + primaryType: encoder.primaryType, + message: encoder.visit(value, (type, value) => { + // bytes + if (type.match(/^bytes(\d*)/)) { + return (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .hexlify */ .c$)((0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .getBytes */ .q5)(value)); + } + // uint or int + if (type.match(/^u?int/)) { + return (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_1__/* .getBigInt */ .Ab)(value).toString(); + } + switch (type) { + case "address": + return value.toLowerCase(); + case "bool": + return !!value; + case "string": + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(typeof (value) === "string", "invalid string", "value", value); + return value; + } + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__/* .assertArgument */ .MR)(false, "unsupported type", "type", type); + }) + }; + } +} +/** + * Compute the address used to sign the typed data for the %%signature%%. + */ +function verifyTypedData(domain, types, value, signature) { + return recoverAddress(TypedDataEncoder.hash(domain, types, value), signature); +} +//# sourceMappingURL=typed-data.js.map + +/***/ }), + +/***/ 97876: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Pz: () => (/* binding */ EnsResolver) +/* harmony export */ }); +/* unused harmony exports MulticoinProviderPlugin, BasicMulticoinProviderPlugin */ +/* harmony import */ var _address_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(30031); +/* harmony import */ var _constants_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(98982); +/* harmony import */ var _contract_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(13269); +/* harmony import */ var _hash_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(64563); +/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57339); +/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(88081); +/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(36212); +/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(14132); +/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(27033); +/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(26976); +/** + * ENS is a service which allows easy-to-remember names to map to + * network addresses. + * + * @_section: api/providers/ens-resolver:ENS Resolver [about-ens-rsolver] + */ + + + + + +// @TODO: This should use the fetch-data:ipfs gateway +// Trim off the ipfs:// prefix and return the default gateway URL +function getIpfsLink(link) { + if (link.match(/^ipfs:\/\/ipfs\//i)) { + link = link.substring(12); + } + else if (link.match(/^ipfs:\/\//i)) { + link = link.substring(7); + } + else { + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .assertArgument */ .MR)(false, "unsupported IPFS format", "link", link); + } + return `https:/\/gateway.ipfs.io/ipfs/${link}`; +} +; +; +/** + * A provider plugin super-class for processing multicoin address types. + */ +class MulticoinProviderPlugin { + /** + * The name. + */ + name; + /** + * Creates a new **MulticoinProviderPluing** for %%name%%. + */ + constructor(name) { + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_1__/* .defineProperties */ .n)(this, { name }); + } + connect(proivder) { + return this; + } + /** + * Returns ``true`` if %%coinType%% is supported by this plugin. + */ + supportsCoinType(coinType) { + return false; + } + /** + * Resolves to the encoded %%address%% for %%coinType%%. + */ + async encodeAddress(coinType, address) { + throw new Error("unsupported coin"); + } + /** + * Resolves to the decoded %%data%% for %%coinType%%. + */ + async decodeAddress(coinType, data) { + throw new Error("unsupported coin"); + } +} +const BasicMulticoinPluginId = "org.ethers.plugins.provider.BasicMulticoin"; +/** + * A **BasicMulticoinProviderPlugin** provides service for common + * coin types, which do not require additional libraries to encode or + * decode. + */ +class BasicMulticoinProviderPlugin extends MulticoinProviderPlugin { + /** + * Creates a new **BasicMulticoinProviderPlugin**. + */ + constructor() { + super(BasicMulticoinPluginId); + } +} +const matcherIpfs = new RegExp("^(ipfs):/\/(.*)$", "i"); +const matchers = [ + new RegExp("^(https):/\/(.*)$", "i"), + new RegExp("^(data):(.*)$", "i"), + matcherIpfs, + new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i"), +]; +/** + * A connected object to a resolved ENS name resolver, which can be + * used to query additional details. + */ +class EnsResolver { + /** + * The connected provider. + */ + provider; + /** + * The address of the resolver. + */ + address; + /** + * The name this resolver was resolved against. + */ + name; + // For EIP-2544 names, the ancestor that provided the resolver + #supports2544; + #resolver; + constructor(provider, address, name) { + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_1__/* .defineProperties */ .n)(this, { provider, address, name }); + this.#supports2544 = null; + this.#resolver = new _contract_index_js__WEBPACK_IMPORTED_MODULE_2__/* .Contract */ .NZ(address, [ + "function supportsInterface(bytes4) view returns (bool)", + "function resolve(bytes, bytes) view returns (bytes)", + "function addr(bytes32) view returns (address)", + "function addr(bytes32, uint) view returns (bytes)", + "function text(bytes32, string) view returns (string)", + "function contenthash(bytes32) view returns (bytes)", + ], provider); + } + /** + * Resolves to true if the resolver supports wildcard resolution. + */ + async supportsWildcard() { + if (this.#supports2544 == null) { + this.#supports2544 = (async () => { + try { + return await this.#resolver.supportsInterface("0x9061b923"); + } + catch (error) { + // Wildcard resolvers must understand supportsInterface + // and return true. + if ((0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .isError */ .bJ)(error, "CALL_EXCEPTION")) { + return false; + } + // Let future attempts try again... + this.#supports2544 = null; + throw error; + } + })(); + } + return await this.#supports2544; + } + async #fetch(funcName, params) { + params = (params || []).slice(); + const iface = this.#resolver.interface; + // The first parameters is always the nodehash + params.unshift((0,_hash_index_js__WEBPACK_IMPORTED_MODULE_3__/* .namehash */ .kM)(this.name)); + let fragment = null; + if (await this.supportsWildcard()) { + fragment = iface.getFunction(funcName); + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .assert */ .vA)(fragment, "missing fragment", "UNKNOWN_ERROR", { + info: { funcName } + }); + params = [ + (0,_hash_index_js__WEBPACK_IMPORTED_MODULE_3__/* .dnsEncode */ .Wh)(this.name, 255), + iface.encodeFunctionData(fragment, params) + ]; + funcName = "resolve(bytes,bytes)"; + } + params.push({ + enableCcipRead: true + }); + try { + const result = await this.#resolver[funcName](...params); + if (fragment) { + return iface.decodeFunctionResult(fragment, result)[0]; + } + return result; + } + catch (error) { + if (!(0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .isError */ .bJ)(error, "CALL_EXCEPTION")) { + throw error; + } + } + return null; + } + /** + * Resolves to the address for %%coinType%% or null if the + * provided %%coinType%% has not been configured. + */ + async getAddress(coinType) { + if (coinType == null) { + coinType = 60; + } + if (coinType === 60) { + try { + const result = await this.#fetch("addr(bytes32)"); + // No address + if (result == null || result === _constants_index_js__WEBPACK_IMPORTED_MODULE_4__/* .ZeroAddress */ .j) { + return null; + } + return result; + } + catch (error) { + if ((0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .isError */ .bJ)(error, "CALL_EXCEPTION")) { + return null; + } + throw error; + } + } + // Try decoding its EVM canonical chain as an EVM chain address first + if (coinType >= 0 && coinType < 0x80000000) { + let ethCoinType = coinType + 0x80000000; + const data = await this.#fetch("addr(bytes32,uint)", [ethCoinType]); + if ((0,_utils_index_js__WEBPACK_IMPORTED_MODULE_5__/* .isHexString */ .Lo)(data, 20)) { + return (0,_address_index_js__WEBPACK_IMPORTED_MODULE_6__/* .getAddress */ .b)(data); + } + } + let coinPlugin = null; + for (const plugin of this.provider.plugins) { + if (!(plugin instanceof MulticoinProviderPlugin)) { + continue; + } + if (plugin.supportsCoinType(coinType)) { + coinPlugin = plugin; + break; + } + } + if (coinPlugin == null) { + return null; + } + // keccak256("addr(bytes32,uint256") + const data = await this.#fetch("addr(bytes32,uint)", [coinType]); + // No address + if (data == null || data === "0x") { + return null; + } + // Compute the address + const address = await coinPlugin.decodeAddress(coinType, data); + if (address != null) { + return address; + } + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .assert */ .vA)(false, `invalid coin data`, "UNSUPPORTED_OPERATION", { + operation: `getAddress(${coinType})`, + info: { coinType, data } + }); + } + /** + * Resolves to the EIP-634 text record for %%key%%, or ``null`` + * if unconfigured. + */ + async getText(key) { + const data = await this.#fetch("text(bytes32,string)", [key]); + if (data == null || data === "0x") { + return null; + } + return data; + } + /** + * Rsolves to the content-hash or ``null`` if unconfigured. + */ + async getContentHash() { + // keccak256("contenthash()") + const data = await this.#fetch("contenthash(bytes32)"); + // No contenthash + if (data == null || data === "0x") { + return null; + } + // IPFS (CID: 1, Type: 70=DAG-PB, 72=libp2p-key) + const ipfs = data.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/); + if (ipfs) { + const scheme = (ipfs[1] === "e3010170") ? "ipfs" : "ipns"; + const length = parseInt(ipfs[4], 16); + if (ipfs[5].length === length * 2) { + return `${scheme}:/\/${(0,_utils_index_js__WEBPACK_IMPORTED_MODULE_7__/* .encodeBase58 */ .R)("0x" + ipfs[2])}`; + } + } + // Swarm (CID: 1, Type: swarm-manifest; hash/length hard-coded to keccak256/32) + const swarm = data.match(/^0xe40101fa011b20([0-9a-f]*)$/); + if (swarm && swarm[1].length === 64) { + return `bzz:/\/${swarm[1]}`; + } + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .assert */ .vA)(false, `invalid or unsupported content hash data`, "UNSUPPORTED_OPERATION", { + operation: "getContentHash()", + info: { data } + }); + } + /** + * Resolves to the avatar url or ``null`` if the avatar is either + * unconfigured or incorrectly configured (e.g. references an NFT + * not owned by the address). + * + * If diagnosing issues with configurations, the [[_getAvatar]] + * method may be useful. + */ + async getAvatar() { + const avatar = await this._getAvatar(); + return avatar.url; + } + /** + * When resolving an avatar, there are many steps involved, such + * fetching metadata and possibly validating ownership of an + * NFT. + * + * This method can be used to examine each step and the value it + * was working from. + */ + async _getAvatar() { + const linkage = [{ type: "name", value: this.name }]; + try { + // test data for ricmoo.eth + //const avatar = "eip155:1/erc721:0x265385c7f4132228A0d54EB1A9e7460b91c0cC68/29233"; + const avatar = await this.getText("avatar"); + if (avatar == null) { + linkage.push({ type: "!avatar", value: "" }); + return { url: null, linkage }; + } + linkage.push({ type: "avatar", value: avatar }); + for (let i = 0; i < matchers.length; i++) { + const match = avatar.match(matchers[i]); + if (match == null) { + continue; + } + const scheme = match[1].toLowerCase(); + switch (scheme) { + case "https": + case "data": + linkage.push({ type: "url", value: avatar }); + return { linkage, url: avatar }; + case "ipfs": { + const url = getIpfsLink(avatar); + linkage.push({ type: "ipfs", value: avatar }); + linkage.push({ type: "url", value: url }); + return { linkage, url }; + } + case "erc721": + case "erc1155": { + // Depending on the ERC type, use tokenURI(uint256) or url(uint256) + const selector = (scheme === "erc721") ? "tokenURI(uint256)" : "uri(uint256)"; + linkage.push({ type: scheme, value: avatar }); + // The owner of this name + const owner = await this.getAddress(); + if (owner == null) { + linkage.push({ type: "!owner", value: "" }); + return { url: null, linkage }; + } + const comps = (match[2] || "").split("/"); + if (comps.length !== 2) { + linkage.push({ type: `!${scheme}caip`, value: (match[2] || "") }); + return { url: null, linkage }; + } + const tokenId = comps[1]; + const contract = new _contract_index_js__WEBPACK_IMPORTED_MODULE_2__/* .Contract */ .NZ(comps[0], [ + // ERC-721 + "function tokenURI(uint) view returns (string)", + "function ownerOf(uint) view returns (address)", + // ERC-1155 + "function uri(uint) view returns (string)", + "function balanceOf(address, uint256) view returns (uint)" + ], this.provider); + // Check that this account owns the token + if (scheme === "erc721") { + const tokenOwner = await contract.ownerOf(tokenId); + if (owner !== tokenOwner) { + linkage.push({ type: "!owner", value: tokenOwner }); + return { url: null, linkage }; + } + linkage.push({ type: "owner", value: tokenOwner }); + } + else if (scheme === "erc1155") { + const balance = await contract.balanceOf(owner, tokenId); + if (!balance) { + linkage.push({ type: "!balance", value: "0" }); + return { url: null, linkage }; + } + linkage.push({ type: "balance", value: balance.toString() }); + } + // Call the token contract for the metadata URL + let metadataUrl = await contract[selector](tokenId); + if (metadataUrl == null || metadataUrl === "0x") { + linkage.push({ type: "!metadata-url", value: "" }); + return { url: null, linkage }; + } + linkage.push({ type: "metadata-url-base", value: metadataUrl }); + // ERC-1155 allows a generic {id} in the URL + if (scheme === "erc1155") { + metadataUrl = metadataUrl.replace("{id}", (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_8__/* .toBeHex */ .up)(tokenId, 32).substring(2)); + linkage.push({ type: "metadata-url-expanded", value: metadataUrl }); + } + // Transform IPFS metadata links + if (metadataUrl.match(/^ipfs:/i)) { + metadataUrl = getIpfsLink(metadataUrl); + } + linkage.push({ type: "metadata-url", value: metadataUrl }); + // Get the token metadata + let metadata = {}; + const response = await (new _utils_index_js__WEBPACK_IMPORTED_MODULE_9__/* .FetchRequest */ .ui(metadataUrl)).send(); + response.assertOk(); + try { + metadata = response.bodyJson; + } + catch (error) { + try { + linkage.push({ type: "!metadata", value: response.bodyText }); + } + catch (error) { + const bytes = response.body; + if (bytes) { + linkage.push({ type: "!metadata", value: (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_5__/* .hexlify */ .c$)(bytes) }); + } + return { url: null, linkage }; + } + return { url: null, linkage }; + } + if (!metadata) { + linkage.push({ type: "!metadata", value: "" }); + return { url: null, linkage }; + } + linkage.push({ type: "metadata", value: JSON.stringify(metadata) }); + // Pull the image URL out + let imageUrl = metadata.image; + if (typeof (imageUrl) !== "string") { + linkage.push({ type: "!imageUrl", value: "" }); + return { url: null, linkage }; + } + if (imageUrl.match(/^(https:\/\/|data:)/i)) { + // Allow + } + else { + // Transform IPFS link to gateway + const ipfs = imageUrl.match(matcherIpfs); + if (ipfs == null) { + linkage.push({ type: "!imageUrl-ipfs", value: imageUrl }); + return { url: null, linkage }; + } + linkage.push({ type: "imageUrl-ipfs", value: imageUrl }); + imageUrl = getIpfsLink(imageUrl); + } + linkage.push({ type: "url", value: imageUrl }); + return { linkage, url: imageUrl }; + } + } + } + } + catch (error) { } + return { linkage, url: null }; + } + static async getEnsAddress(provider) { + const network = await provider.getNetwork(); + const ensPlugin = network.getPlugin("org.ethers.plugins.network.Ens"); + // No ENS... + (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__/* .assert */ .vA)(ensPlugin, "network does not support ENS", "UNSUPPORTED_OPERATION", { + operation: "getEnsAddress", info: { network } + }); + return ensPlugin.address; + } + static async #getResolver(provider, name) { + const ensAddr = await EnsResolver.getEnsAddress(provider); + try { + const contract = new _contract_index_js__WEBPACK_IMPORTED_MODULE_2__/* .Contract */ .NZ(ensAddr, [ + "function resolver(bytes32) view returns (address)" + ], provider); + const addr = await contract.resolver((0,_hash_index_js__WEBPACK_IMPORTED_MODULE_3__/* .namehash */ .kM)(name), { + enableCcipRead: true + }); + if (addr === _constants_index_js__WEBPACK_IMPORTED_MODULE_4__/* .ZeroAddress */ .j) { + return null; + } + return addr; + } + catch (error) { + // ENS registry cannot throw errors on resolver(bytes32), + // so probably a link error + throw error; + } + return null; + } + /** + * Resolve to the ENS resolver for %%name%% using %%provider%% or + * ``null`` if unconfigured. + */ + static async fromName(provider, name) { + let currentName = name; + while (true) { + if (currentName === "" || currentName === ".") { + return null; + } + // Optimization since the eth node cannot change and does + // not have a wildcard resolver + if (name !== "eth" && currentName === "eth") { + return null; + } + // Check the current node for a resolver + const addr = await EnsResolver.#getResolver(provider, currentName); + // Found a resolver! + if (addr != null) { + const resolver = new EnsResolver(provider, addr, name); + // Legacy resolver found, using EIP-2544 so it isn't safe to use + if (currentName !== name && !(await resolver.supportsWildcard())) { + return null; + } + return resolver; + } + // Get the parent node + currentName = currentName.split(".").slice(1).join("."); + } + } +} +//# sourceMappingURL=ens-resolver.js.map + +/***/ }), + /***/ 43948: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { @@ -170881,8 +211619,8 @@ function accessListify(value) { /* harmony export */ x: () => (/* binding */ recoverAddress) /* harmony export */ }); /* harmony import */ var _address_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(30031); -/* harmony import */ var _crypto_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15496); -/* harmony import */ var _crypto_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(15539); +/* harmony import */ var _crypto_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(72588); +/* harmony import */ var _crypto_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2011); /** @@ -170930,16 +211668,16 @@ var sha2 = __webpack_require__(68650); // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/crypto/signature.js + 1 modules var crypto_signature = __webpack_require__(20260); // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/crypto/keccak.js + 1 modules -var keccak = __webpack_require__(15539); +var keccak = __webpack_require__(2011); // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/crypto/signing-key.js + 6 modules -var signing_key = __webpack_require__(15496); +var signing_key = __webpack_require__(72588); // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/errors.js var errors = __webpack_require__(57339); // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/maths.js var maths = __webpack_require__(27033); // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/data.js var utils_data = __webpack_require__(36212); -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/utils/rlp-decode.js +;// ./node_modules/ethers/lib.esm/utils/rlp-decode.js //See: https://github.com/ethereum/wiki/wiki/RLP @@ -171025,7 +211763,7 @@ var rlp_encode = __webpack_require__(65735); var accesslist = __webpack_require__(8177); // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/transaction/address.js var transaction_address = __webpack_require__(20415); -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/transaction/transaction.js +;// ./node_modules/ethers/lib.esm/transaction/transaction.js @@ -172010,6 +212748,83 @@ class Transaction { /***/ }), +/***/ 14132: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ H: () => (/* binding */ decodeBase58), +/* harmony export */ R: () => (/* binding */ encodeBase58) +/* harmony export */ }); +/* harmony import */ var _data_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(36212); +/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57339); +/* harmony import */ var _maths_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(27033); +/** + * The [Base58 Encoding](link-base58) scheme allows a **numeric** value + * to be encoded as a compact string using a radix of 58 using only + * alpha-numeric characters. Confusingly similar characters are omitted + * (i.e. ``"l0O"``). + * + * Note that Base58 encodes a **numeric** value, not arbitrary bytes, + * since any zero-bytes on the left would get removed. To mitigate this + * issue most schemes that use Base58 choose specific high-order values + * to ensure non-zero prefixes. + * + * @_subsection: api/utils:Base58 Encoding [about-base58] + */ + + + +const Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; +let Lookup = null; +function getAlpha(letter) { + if (Lookup == null) { + Lookup = {}; + for (let i = 0; i < Alphabet.length; i++) { + Lookup[Alphabet[i]] = BigInt(i); + } + } + const result = Lookup[letter]; + (0,_errors_js__WEBPACK_IMPORTED_MODULE_0__/* .assertArgument */ .MR)(result != null, `invalid base58 value`, "letter", letter); + return result; +} +const BN_0 = BigInt(0); +const BN_58 = BigInt(58); +/** + * Encode %%value%% as a Base58-encoded string. + */ +function encodeBase58(_value) { + const bytes = (0,_data_js__WEBPACK_IMPORTED_MODULE_1__/* .getBytes */ .q5)(_value); + let value = (0,_maths_js__WEBPACK_IMPORTED_MODULE_2__/* .toBigInt */ .Dg)(bytes); + let result = ""; + while (value) { + result = Alphabet[Number(value % BN_58)] + result; + value /= BN_58; + } + // Account for leading padding zeros + for (let i = 0; i < bytes.length; i++) { + if (bytes[i]) { + break; + } + result = Alphabet[0] + result; + } + return result; +} +/** + * Decode the Base58-encoded %%value%%. + */ +function decodeBase58(value) { + let result = BN_0; + for (let i = 0; i < value.length; i++) { + result *= BN_58; + result += getAlpha(value[i]); + } + return result; +} +//# sourceMappingURL=base58.js.map + +/***/ }), + /***/ 36212: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { @@ -172042,7 +212857,7 @@ function _getBytes(value, name, copy) { } return value; } - if (typeof (value) === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) { + if (typeof (value) === "string" && value.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) { const result = new Uint8Array((value.length - 2) / 2); let offset = 2; for (let i = 0; i < result.length; i++) { @@ -172497,6 +213312,965 @@ class EventPayload { /***/ }), +/***/ 26976: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; + +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + ui: () => (/* binding */ FetchRequest) +}); + +// UNUSED EXPORTS: FetchCancelSignal, FetchResponse + +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/data.js +var utils_data = __webpack_require__(36212); +;// ./node_modules/ethers/lib.esm/utils/base64-browser.js +// utils/base64-browser + +function decodeBase64(textData) { + textData = atob(textData); + const data = new Uint8Array(textData.length); + for (let i = 0; i < textData.length; i++) { + data[i] = textData.charCodeAt(i); + } + return (0,utils_data/* getBytes */.q5)(data); +} +function encodeBase64(_data) { + const data = (0,utils_data/* getBytes */.q5)(_data); + let textData = ""; + for (let i = 0; i < data.length; i++) { + textData += String.fromCharCode(data[i]); + } + return btoa(textData); +} +//# sourceMappingURL=base64-browser.js.map +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/errors.js +var errors = __webpack_require__(57339); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/properties.js +var properties = __webpack_require__(88081); +// EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/utf8.js +var utf8 = __webpack_require__(87303); +;// ./node_modules/ethers/lib.esm/utils/geturl-browser.js + +function createGetUrl(options) { + async function getUrl(req, _signal) { + (0,errors/* assert */.vA)(_signal == null || !_signal.cancelled, "request cancelled before sending", "CANCELLED"); + const protocol = req.url.split(":")[0].toLowerCase(); + (0,errors/* assert */.vA)(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", { + info: { protocol }, + operation: "request" + }); + (0,errors/* assert */.vA)(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { + operation: "request" + }); + let error = null; + const controller = new AbortController(); + const timer = setTimeout(() => { + error = (0,errors/* makeError */.xz)("request timeout", "TIMEOUT"); + controller.abort(); + }, req.timeout); + if (_signal) { + _signal.addListener(() => { + error = (0,errors/* makeError */.xz)("request cancelled", "CANCELLED"); + controller.abort(); + }); + } + const init = { + method: req.method, + headers: new Headers(Array.from(req)), + body: req.body || undefined, + signal: controller.signal + }; + let resp; + try { + resp = await fetch(req.url, init); + } + catch (_error) { + clearTimeout(timer); + if (error) { + throw error; + } + throw _error; + } + clearTimeout(timer); + const headers = {}; + resp.headers.forEach((value, key) => { + headers[key.toLowerCase()] = value; + }); + const respBody = await resp.arrayBuffer(); + const body = (respBody == null) ? null : new Uint8Array(respBody); + return { + statusCode: resp.status, + statusMessage: resp.statusText, + headers, body + }; + } + return getUrl; +} +// @TODO: remove in v7; provided for backwards compat +const defaultGetUrl = createGetUrl({}); +async function getUrl(req, _signal) { + return defaultGetUrl(req, _signal); +} +//# sourceMappingURL=geturl-browser.js.map +;// ./node_modules/ethers/lib.esm/utils/fetch.js +/** + * Fetching content from the web is environment-specific, so Ethers + * provides an abstraction that each environment can implement to provide + * this service. + * + * On [Node.js](link-node), the ``http`` and ``https`` libs are used to + * create a request object, register event listeners and process data + * and populate the [[FetchResponse]]. + * + * In a browser, the [DOM fetch](link-js-fetch) is used, and the resulting + * ``Promise`` is waited on to retrieve the payload. + * + * The [[FetchRequest]] is responsible for handling many common situations, + * such as redirects, server throttling, authentication, etc. + * + * It also handles common gateways, such as IPFS and data URIs. + * + * @_section api/utils/fetching:Fetching Web Content [about-fetch] + */ + + + + + + +const MAX_ATTEMPTS = 12; +const SLOT_INTERVAL = 250; +// The global FetchGetUrlFunc implementation. +let defaultGetUrlFunc = createGetUrl(); +const reData = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i"); +const reIpfs = new RegExp("^ipfs:/\/(ipfs/)?(.*)$", "i"); +// If locked, new Gateways cannot be added +let locked = false; +// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs +async function dataGatewayFunc(url, signal) { + try { + const match = url.match(reData); + if (!match) { + throw new Error("invalid data"); + } + return new FetchResponse(200, "OK", { + "content-type": (match[1] || "text/plain"), + }, (match[2] ? decodeBase64(match[3]) : unpercent(match[3]))); + } + catch (error) { + return new FetchResponse(599, "BAD REQUEST (invalid data: URI)", {}, null, new FetchRequest(url)); + } +} +/** + * Returns a [[FetchGatewayFunc]] for fetching content from a standard + * IPFS gateway hosted at %%baseUrl%%. + */ +function getIpfsGatewayFunc(baseUrl) { + async function gatewayIpfs(url, signal) { + try { + const match = url.match(reIpfs); + if (!match) { + throw new Error("invalid link"); + } + return new FetchRequest(`${baseUrl}${match[2]}`); + } + catch (error) { + return new FetchResponse(599, "BAD REQUEST (invalid IPFS URI)", {}, null, new FetchRequest(url)); + } + } + return gatewayIpfs; +} +const Gateways = { + "data": dataGatewayFunc, + "ipfs": getIpfsGatewayFunc("https:/\/gateway.ipfs.io/ipfs/") +}; +const fetchSignals = new WeakMap(); +/** + * @_ignore + */ +class FetchCancelSignal { + #listeners; + #cancelled; + constructor(request) { + this.#listeners = []; + this.#cancelled = false; + fetchSignals.set(request, () => { + if (this.#cancelled) { + return; + } + this.#cancelled = true; + for (const listener of this.#listeners) { + setTimeout(() => { listener(); }, 0); + } + this.#listeners = []; + }); + } + addListener(listener) { + (0,errors/* assert */.vA)(!this.#cancelled, "singal already cancelled", "UNSUPPORTED_OPERATION", { + operation: "fetchCancelSignal.addCancelListener" + }); + this.#listeners.push(listener); + } + get cancelled() { return this.#cancelled; } + checkSignal() { + (0,errors/* assert */.vA)(!this.cancelled, "cancelled", "CANCELLED", {}); + } +} +// Check the signal, throwing if it is cancelled +function checkSignal(signal) { + if (signal == null) { + throw new Error("missing signal; should not happen"); + } + signal.checkSignal(); + return signal; +} +/** + * Represents a request for a resource using a URI. + * + * By default, the supported schemes are ``HTTP``, ``HTTPS``, ``data:``, + * and ``IPFS:``. + * + * Additional schemes can be added globally using [[registerGateway]]. + * + * @example: + * req = new FetchRequest("https://www.ricmoo.com") + * resp = await req.send() + * resp.body.length + * //_result: + */ +class FetchRequest { + #allowInsecure; + #gzip; + #headers; + #method; + #timeout; + #url; + #body; + #bodyType; + #creds; + // Hooks + #preflight; + #process; + #retry; + #signal; + #throttle; + #getUrlFunc; + /** + * The fetch URL to request. + */ + get url() { return this.#url; } + set url(url) { + this.#url = String(url); + } + /** + * The fetch body, if any, to send as the request body. //(default: null)// + * + * When setting a body, the intrinsic ``Content-Type`` is automatically + * set and will be used if **not overridden** by setting a custom + * header. + * + * If %%body%% is null, the body is cleared (along with the + * intrinsic ``Content-Type``). + * + * If %%body%% is a string, the intrinsic ``Content-Type`` is set to + * ``text/plain``. + * + * If %%body%% is a Uint8Array, the intrinsic ``Content-Type`` is set to + * ``application/octet-stream``. + * + * If %%body%% is any other object, the intrinsic ``Content-Type`` is + * set to ``application/json``. + */ + get body() { + if (this.#body == null) { + return null; + } + return new Uint8Array(this.#body); + } + set body(body) { + if (body == null) { + this.#body = undefined; + this.#bodyType = undefined; + } + else if (typeof (body) === "string") { + this.#body = (0,utf8/* toUtf8Bytes */.YW)(body); + this.#bodyType = "text/plain"; + } + else if (body instanceof Uint8Array) { + this.#body = body; + this.#bodyType = "application/octet-stream"; + } + else if (typeof (body) === "object") { + this.#body = (0,utf8/* toUtf8Bytes */.YW)(JSON.stringify(body)); + this.#bodyType = "application/json"; + } + else { + throw new Error("invalid body"); + } + } + /** + * Returns true if the request has a body. + */ + hasBody() { + return (this.#body != null); + } + /** + * The HTTP method to use when requesting the URI. If no method + * has been explicitly set, then ``GET`` is used if the body is + * null and ``POST`` otherwise. + */ + get method() { + if (this.#method) { + return this.#method; + } + if (this.hasBody()) { + return "POST"; + } + return "GET"; + } + set method(method) { + if (method == null) { + method = ""; + } + this.#method = String(method).toUpperCase(); + } + /** + * The headers that will be used when requesting the URI. All + * keys are lower-case. + * + * This object is a copy, so any changes will **NOT** be reflected + * in the ``FetchRequest``. + * + * To set a header entry, use the ``setHeader`` method. + */ + get headers() { + const headers = Object.assign({}, this.#headers); + if (this.#creds) { + headers["authorization"] = `Basic ${encodeBase64((0,utf8/* toUtf8Bytes */.YW)(this.#creds))}`; + } + ; + if (this.allowGzip) { + headers["accept-encoding"] = "gzip"; + } + if (headers["content-type"] == null && this.#bodyType) { + headers["content-type"] = this.#bodyType; + } + if (this.body) { + headers["content-length"] = String(this.body.length); + } + return headers; + } + /** + * Get the header for %%key%%, ignoring case. + */ + getHeader(key) { + return this.headers[key.toLowerCase()]; + } + /** + * Set the header for %%key%% to %%value%%. All values are coerced + * to a string. + */ + setHeader(key, value) { + this.#headers[String(key).toLowerCase()] = String(value); + } + /** + * Clear all headers, resetting all intrinsic headers. + */ + clearHeaders() { + this.#headers = {}; + } + [Symbol.iterator]() { + const headers = this.headers; + const keys = Object.keys(headers); + let index = 0; + return { + next: () => { + if (index < keys.length) { + const key = keys[index++]; + return { + value: [key, headers[key]], done: false + }; + } + return { value: undefined, done: true }; + } + }; + } + /** + * The value that will be sent for the ``Authorization`` header. + * + * To set the credentials, use the ``setCredentials`` method. + */ + get credentials() { + return this.#creds || null; + } + /** + * Sets an ``Authorization`` for %%username%% with %%password%%. + */ + setCredentials(username, password) { + (0,errors/* assertArgument */.MR)(!username.match(/:/), "invalid basic authentication username", "username", "[REDACTED]"); + this.#creds = `${username}:${password}`; + } + /** + * Enable and request gzip-encoded responses. The response will + * automatically be decompressed. //(default: true)// + */ + get allowGzip() { + return this.#gzip; + } + set allowGzip(value) { + this.#gzip = !!value; + } + /** + * Allow ``Authentication`` credentials to be sent over insecure + * channels. //(default: false)// + */ + get allowInsecureAuthentication() { + return !!this.#allowInsecure; + } + set allowInsecureAuthentication(value) { + this.#allowInsecure = !!value; + } + /** + * The timeout (in milliseconds) to wait for a complete response. + * //(default: 5 minutes)// + */ + get timeout() { return this.#timeout; } + set timeout(timeout) { + (0,errors/* assertArgument */.MR)(timeout >= 0, "timeout must be non-zero", "timeout", timeout); + this.#timeout = timeout; + } + /** + * This function is called prior to each request, for example + * during a redirection or retry in case of server throttling. + * + * This offers an opportunity to populate headers or update + * content before sending a request. + */ + get preflightFunc() { + return this.#preflight || null; + } + set preflightFunc(preflight) { + this.#preflight = preflight; + } + /** + * This function is called after each response, offering an + * opportunity to provide client-level throttling or updating + * response data. + * + * Any error thrown in this causes the ``send()`` to throw. + * + * To schedule a retry attempt (assuming the maximum retry limit + * has not been reached), use [[response.throwThrottleError]]. + */ + get processFunc() { + return this.#process || null; + } + set processFunc(process) { + this.#process = process; + } + /** + * This function is called on each retry attempt. + */ + get retryFunc() { + return this.#retry || null; + } + set retryFunc(retry) { + this.#retry = retry; + } + /** + * This function is called to fetch content from HTTP and + * HTTPS URLs and is platform specific (e.g. nodejs vs + * browsers). + * + * This is by default the currently registered global getUrl + * function, which can be changed using [[registerGetUrl]]. + * If this has been set, setting is to ``null`` will cause + * this FetchRequest (and any future clones) to revert back to + * using the currently registered global getUrl function. + * + * Setting this is generally not necessary, but may be useful + * for developers that wish to intercept requests or to + * configurege a proxy or other agent. + */ + get getUrlFunc() { + return this.#getUrlFunc || defaultGetUrlFunc; + } + set getUrlFunc(value) { + this.#getUrlFunc = value; + } + /** + * Create a new FetchRequest instance with default values. + * + * Once created, each property may be set before issuing a + * ``.send()`` to make the request. + */ + constructor(url) { + this.#url = String(url); + this.#allowInsecure = false; + this.#gzip = true; + this.#headers = {}; + this.#method = ""; + this.#timeout = 300000; + this.#throttle = { + slotInterval: SLOT_INTERVAL, + maxAttempts: MAX_ATTEMPTS + }; + this.#getUrlFunc = null; + } + toString() { + return ``; + } + /** + * Update the throttle parameters used to determine maximum + * attempts and exponential-backoff properties. + */ + setThrottleParams(params) { + if (params.slotInterval != null) { + this.#throttle.slotInterval = params.slotInterval; + } + if (params.maxAttempts != null) { + this.#throttle.maxAttempts = params.maxAttempts; + } + } + async #send(attempt, expires, delay, _request, _response) { + if (attempt >= this.#throttle.maxAttempts) { + return _response.makeServerError("exceeded maximum retry limit"); + } + (0,errors/* assert */.vA)(getTime() <= expires, "timeout", "TIMEOUT", { + operation: "request.send", reason: "timeout", request: _request + }); + if (delay > 0) { + await wait(delay); + } + let req = this.clone(); + const scheme = (req.url.split(":")[0] || "").toLowerCase(); + // Process any Gateways + if (scheme in Gateways) { + const result = await Gateways[scheme](req.url, checkSignal(_request.#signal)); + if (result instanceof FetchResponse) { + let response = result; + if (this.processFunc) { + checkSignal(_request.#signal); + try { + response = await this.processFunc(req, response); + } + catch (error) { + // Something went wrong during processing; throw a 5xx server error + if (error.throttle == null || typeof (error.stall) !== "number") { + response.makeServerError("error in post-processing function", error).assertOk(); + } + // Ignore throttling + } + } + return response; + } + req = result; + } + // We have a preflight function; update the request + if (this.preflightFunc) { + req = await this.preflightFunc(req); + } + const resp = await this.getUrlFunc(req, checkSignal(_request.#signal)); + let response = new FetchResponse(resp.statusCode, resp.statusMessage, resp.headers, resp.body, _request); + if (response.statusCode === 301 || response.statusCode === 302) { + // Redirect + try { + const location = response.headers.location || ""; + return req.redirect(location).#send(attempt + 1, expires, 0, _request, response); + } + catch (error) { } + // Things won't get any better on another attempt; abort + return response; + } + else if (response.statusCode === 429) { + // Throttle + if (this.retryFunc == null || (await this.retryFunc(req, response, attempt))) { + const retryAfter = response.headers["retry-after"]; + let delay = this.#throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt)); + if (typeof (retryAfter) === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { + delay = parseInt(retryAfter); + } + return req.clone().#send(attempt + 1, expires, delay, _request, response); + } + } + if (this.processFunc) { + checkSignal(_request.#signal); + try { + response = await this.processFunc(req, response); + } + catch (error) { + // Something went wrong during processing; throw a 5xx server error + if (error.throttle == null || typeof (error.stall) !== "number") { + response.makeServerError("error in post-processing function", error).assertOk(); + } + // Throttle + let delay = this.#throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt)); + ; + if (error.stall >= 0) { + delay = error.stall; + } + return req.clone().#send(attempt + 1, expires, delay, _request, response); + } + } + return response; + } + /** + * Resolves to the response by sending the request. + */ + send() { + (0,errors/* assert */.vA)(this.#signal == null, "request already sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.send" }); + this.#signal = new FetchCancelSignal(this); + return this.#send(0, getTime() + this.timeout, 0, this, new FetchResponse(0, "", {}, null, this)); + } + /** + * Cancels the inflight response, causing a ``CANCELLED`` + * error to be rejected from the [[send]]. + */ + cancel() { + (0,errors/* assert */.vA)(this.#signal != null, "request has not been sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.cancel" }); + const signal = fetchSignals.get(this); + if (!signal) { + throw new Error("missing signal; should not happen"); + } + signal(); + } + /** + * Returns a new [[FetchRequest]] that represents the redirection + * to %%location%%. + */ + redirect(location) { + // Redirection; for now we only support absolute locations + const current = this.url.split(":")[0].toLowerCase(); + const target = location.split(":")[0].toLowerCase(); + // Don't allow redirecting: + // - non-GET requests + // - downgrading the security (e.g. https => http) + // - to non-HTTP (or non-HTTPS) protocols [this could be relaxed?] + (0,errors/* assert */.vA)(this.method === "GET" && (current !== "https" || target !== "http") && location.match(/^https?:/), `unsupported redirect`, "UNSUPPORTED_OPERATION", { + operation: `redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(location)})` + }); + // Create a copy of this request, with a new URL + const req = new FetchRequest(location); + req.method = "GET"; + req.allowGzip = this.allowGzip; + req.timeout = this.timeout; + req.#headers = Object.assign({}, this.#headers); + if (this.#body) { + req.#body = new Uint8Array(this.#body); + } + req.#bodyType = this.#bodyType; + // Do not forward credentials unless on the same domain; only absolute + //req.allowInsecure = false; + // paths are currently supported; may want a way to specify to forward? + //setStore(req.#props, "creds", getStore(this.#pros, "creds")); + return req; + } + /** + * Create a new copy of this request. + */ + clone() { + const clone = new FetchRequest(this.url); + // Preserve "default method" (i.e. null) + clone.#method = this.#method; + // Preserve "default body" with type, copying the Uint8Array is present + if (this.#body) { + clone.#body = this.#body; + } + clone.#bodyType = this.#bodyType; + // Preserve "default headers" + clone.#headers = Object.assign({}, this.#headers); + // Credentials is readonly, so we copy internally + clone.#creds = this.#creds; + if (this.allowGzip) { + clone.allowGzip = true; + } + clone.timeout = this.timeout; + if (this.allowInsecureAuthentication) { + clone.allowInsecureAuthentication = true; + } + clone.#preflight = this.#preflight; + clone.#process = this.#process; + clone.#retry = this.#retry; + clone.#throttle = Object.assign({}, this.#throttle); + clone.#getUrlFunc = this.#getUrlFunc; + return clone; + } + /** + * Locks all static configuration for gateways and FetchGetUrlFunc + * registration. + */ + static lockConfig() { + locked = true; + } + /** + * Get the current Gateway function for %%scheme%%. + */ + static getGateway(scheme) { + return Gateways[scheme.toLowerCase()] || null; + } + /** + * Use the %%func%% when fetching URIs using %%scheme%%. + * + * This method affects all requests globally. + * + * If [[lockConfig]] has been called, no change is made and this + * throws. + */ + static registerGateway(scheme, func) { + scheme = scheme.toLowerCase(); + if (scheme === "http" || scheme === "https") { + throw new Error(`cannot intercept ${scheme}; use registerGetUrl`); + } + if (locked) { + throw new Error("gateways locked"); + } + Gateways[scheme] = func; + } + /** + * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests. + * + * This method affects all requests globally. + * + * If [[lockConfig]] has been called, no change is made and this + * throws. + */ + static registerGetUrl(getUrl) { + if (locked) { + throw new Error("gateways locked"); + } + defaultGetUrlFunc = getUrl; + } + /** + * Creates a getUrl function that fetches content from HTTP and + * HTTPS URLs. + * + * The available %%options%% are dependent on the platform + * implementation of the default getUrl function. + * + * This is not generally something that is needed, but is useful + * when trying to customize simple behaviour when fetching HTTP + * content. + */ + static createGetUrlFunc(options) { + return createGetUrl(options); + } + /** + * Creates a function that can "fetch" data URIs. + * + * Note that this is automatically done internally to support + * data URIs, so it is not necessary to register it. + * + * This is not generally something that is needed, but may + * be useful in a wrapper to perfom custom data URI functionality. + */ + static createDataGateway() { + return dataGatewayFunc; + } + /** + * Creates a function that will fetch IPFS (unvalidated) from + * a custom gateway baseUrl. + * + * The default IPFS gateway used internally is + * ``"https:/\/gateway.ipfs.io/ipfs/"``. + */ + static createIpfsGatewayFunc(baseUrl) { + return getIpfsGatewayFunc(baseUrl); + } +} +; +/** + * The response for a FetchRequest. + */ +class FetchResponse { + #statusCode; + #statusMessage; + #headers; + #body; + #request; + #error; + toString() { + return ``; + } + /** + * The response status code. + */ + get statusCode() { return this.#statusCode; } + /** + * The response status message. + */ + get statusMessage() { return this.#statusMessage; } + /** + * The response headers. All keys are lower-case. + */ + get headers() { return Object.assign({}, this.#headers); } + /** + * The response body, or ``null`` if there was no body. + */ + get body() { + return (this.#body == null) ? null : new Uint8Array(this.#body); + } + /** + * The response body as a UTF-8 encoded string, or the empty + * string (i.e. ``""``) if there was no body. + * + * An error is thrown if the body is invalid UTF-8 data. + */ + get bodyText() { + try { + return (this.#body == null) ? "" : (0,utf8/* toUtf8String */._v)(this.#body); + } + catch (error) { + (0,errors/* assert */.vA)(false, "response body is not valid UTF-8 data", "UNSUPPORTED_OPERATION", { + operation: "bodyText", info: { response: this } + }); + } + } + /** + * The response body, decoded as JSON. + * + * An error is thrown if the body is invalid JSON-encoded data + * or if there was no body. + */ + get bodyJson() { + try { + return JSON.parse(this.bodyText); + } + catch (error) { + (0,errors/* assert */.vA)(false, "response body is not valid JSON", "UNSUPPORTED_OPERATION", { + operation: "bodyJson", info: { response: this } + }); + } + } + [Symbol.iterator]() { + const headers = this.headers; + const keys = Object.keys(headers); + let index = 0; + return { + next: () => { + if (index < keys.length) { + const key = keys[index++]; + return { + value: [key, headers[key]], done: false + }; + } + return { value: undefined, done: true }; + } + }; + } + constructor(statusCode, statusMessage, headers, body, request) { + this.#statusCode = statusCode; + this.#statusMessage = statusMessage; + this.#headers = Object.keys(headers).reduce((accum, k) => { + accum[k.toLowerCase()] = String(headers[k]); + return accum; + }, {}); + this.#body = ((body == null) ? null : new Uint8Array(body)); + this.#request = (request || null); + this.#error = { message: "" }; + } + /** + * Return a Response with matching headers and body, but with + * an error status code (i.e. 599) and %%message%% with an + * optional %%error%%. + */ + makeServerError(message, error) { + let statusMessage; + if (!message) { + message = `${this.statusCode} ${this.statusMessage}`; + statusMessage = `CLIENT ESCALATED SERVER ERROR (${message})`; + } + else { + statusMessage = `CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`; + } + const response = new FetchResponse(599, statusMessage, this.headers, this.body, this.#request || undefined); + response.#error = { message, error }; + return response; + } + /** + * If called within a [request.processFunc](FetchRequest-processFunc) + * call, causes the request to retry as if throttled for %%stall%% + * milliseconds. + */ + throwThrottleError(message, stall) { + if (stall == null) { + stall = -1; + } + else { + (0,errors/* assertArgument */.MR)(Number.isInteger(stall) && stall >= 0, "invalid stall timeout", "stall", stall); + } + const error = new Error(message || "throttling requests"); + (0,properties/* defineProperties */.n)(error, { stall, throttle: true }); + throw error; + } + /** + * Get the header value for %%key%%, ignoring case. + */ + getHeader(key) { + return this.headers[key.toLowerCase()]; + } + /** + * Returns true if the response has a body. + */ + hasBody() { + return (this.#body != null); + } + /** + * The request made for this response. + */ + get request() { return this.#request; } + /** + * Returns true if this response was a success statusCode. + */ + ok() { + return (this.#error.message === "" && this.statusCode >= 200 && this.statusCode < 300); + } + /** + * Throws a ``SERVER_ERROR`` if this response is not ok. + */ + assertOk() { + if (this.ok()) { + return; + } + let { message, error } = this.#error; + if (message === "") { + message = `server response ${this.statusCode} ${this.statusMessage}`; + } + let requestUrl = null; + if (this.request) { + requestUrl = this.request.url; + } + let responseBody = null; + try { + if (this.#body) { + responseBody = (0,utf8/* toUtf8String */._v)(this.#body); + } + } + catch (e) { } + (0,errors/* assert */.vA)(false, message, "SERVER_ERROR", { + request: (this.request || "unknown request"), response: this, error, + info: { + requestUrl, responseBody, + responseStatus: `${this.statusCode} ${this.statusMessage}` + } + }); + } +} +function getTime() { return (new Date()).getTime(); } +function unpercent(value) { + return (0,utf8/* toUtf8Bytes */.YW)(value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => { + return String.fromCharCode(parseInt(code, 16)); + })); +} +function wait(delay) { + return new Promise((resolve) => setTimeout(resolve, delay)); +} +//# sourceMappingURL=fetch.js.map + +/***/ }), + /***/ 27033: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { @@ -172866,11 +214640,12 @@ function encodeRlp(object) { // EXPORTS __webpack_require__.d(__webpack_exports__, { + ck: () => (/* binding */ formatEther), g5: () => (/* binding */ parseEther), XS: () => (/* binding */ parseUnits) }); -// UNUSED EXPORTS: formatEther, formatUnits +// UNUSED EXPORTS: formatUnits // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/errors.js var errors = __webpack_require__(57339); @@ -172880,7 +214655,7 @@ var data = __webpack_require__(36212); var maths = __webpack_require__(27033); // EXTERNAL MODULE: ./node_modules/ethers/lib.esm/utils/properties.js var properties = __webpack_require__(88081); -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/utils/fixednumber.js +;// ./node_modules/ethers/lib.esm/utils/fixednumber.js /** * The **FixedNumber** class permits using values with decimal places, * using fixed-pont math. @@ -173041,7 +214816,7 @@ function fixednumber_toString(val, decimals) { * variant will silently ignore underflow, while the //signalling// variant * will thow a [[NumericFaultError]] on underflow. */ -class fixednumber_FixedNumber { +class FixedNumber { /** * The specific fixed-point arithmetic field for this value. */ @@ -173116,7 +214891,7 @@ class fixednumber_FixedNumber { } */ val = checkValue(val, this.#format, safeOp); - return new fixednumber_FixedNumber(_guard, val, this.#format); + return new FixedNumber(_guard, val, this.#format); } #add(o, safeOp) { this.#checkFormat(o); @@ -173303,7 +215078,7 @@ class fixednumber_FixedNumber { const tens = getTens(delta); value = (value / tens) * tens; checkValue(value, this.#format, "round"); - return new fixednumber_FixedNumber(_guard, value, this.#format); + return new FixedNumber(_guard, value, this.#format); } /** * Returns true if %%this%% is equal to ``0``. @@ -173332,7 +215107,7 @@ class fixednumber_FixedNumber { * This will throw if the value cannot fit into %%format%%. */ toFormat(format) { - return fixednumber_FixedNumber.fromString(this.toString(), format); + return FixedNumber.fromString(this.toString(), format); } /** * Creates a new [[FixedNumber]] for %%value%% divided by @@ -173358,7 +215133,7 @@ class fixednumber_FixedNumber { value *= getTens(-delta); } checkValue(value, format, "fromValue"); - return new fixednumber_FixedNumber(_guard, value, format); + return new FixedNumber(_guard, value, format); } /** * Creates a new [[FixedNumber]] for %%value%% with %%format%%. @@ -173383,7 +215158,7 @@ class fixednumber_FixedNumber { decimal = decimal.substring(0, format.decimals); const value = BigInt(match[1] + whole + decimal); checkValue(value, format, "fromString"); - return new fixednumber_FixedNumber(_guard, value, format); + return new FixedNumber(_guard, value, format); } /** * Creates a new [[FixedNumber]] with the big-endian representation @@ -173399,7 +215174,7 @@ class fixednumber_FixedNumber { value = (0,maths/* fromTwos */.ST)(value, format.width); } checkValue(value, format, "fromBytes"); - return new fixednumber_FixedNumber(_guard, value, format); + return new FixedNumber(_guard, value, format); } } //const f1 = FixedNumber.fromString("12.56", "fixed16x2"); @@ -173407,7 +215182,7 @@ class fixednumber_FixedNumber { //console.log(f1.divSignal(f2)); //const BUMP = FixedNumber.from("0.5"); //# sourceMappingURL=fixednumber.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/utils/units.js +;// ./node_modules/ethers/lib.esm/utils/units.js /** * Most interactions with Ethereum requires integer values, which use * the smallest magnitude unit. @@ -173451,11 +215226,11 @@ function formatUnits(value, unit) { let decimals = 18; if (typeof (unit) === "string") { const index = names.indexOf(unit); - assertArgument(index >= 0, "invalid unit", "unit", unit); + (0,errors/* assertArgument */.MR)(index >= 0, "invalid unit", "unit", unit); decimals = 3 * index; } else if (unit != null) { - decimals = getNumber(unit, "unit"); + decimals = (0,maths/* getNumber */.WZ)(unit, "unit"); } return FixedNumber.fromValue(value, decimals, { decimals, width: 512 }).toString(); } @@ -173475,7 +215250,7 @@ function parseUnits(value, unit) { else if (unit != null) { decimals = (0,maths/* getNumber */.WZ)(unit, "unit"); } - return fixednumber_FixedNumber.fromString(value, { decimals, width: 512 }).value; + return FixedNumber.fromString(value, { decimals, width: 512 }).value; } /** * Converts %%value%% into a //decimal string// using 18 decimal places. @@ -173729,1837 +215504,1351 @@ function toUtf8CodePoints(str, form) { /***/ }), -/***/ 27125: +/***/ 45238: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ CG: () => (/* binding */ output), -/* harmony export */ ai: () => (/* binding */ number), -/* harmony export */ ee: () => (/* binding */ bytes), -/* harmony export */ t2: () => (/* binding */ exists), -/* harmony export */ tW: () => (/* binding */ hash) +/* harmony export */ K: () => (/* binding */ allocUnsafe) /* harmony export */ }); -/* unused harmony export bool */ -function number(n) { - if (!Number.isSafeInteger(n) || n < 0) - throw new Error(`Wrong positive integer: ${n}`); -} -function bool(b) { - if (typeof b !== 'boolean') - throw new Error(`Expected boolean, not ${b}`); -} -function bytes(b, ...lengths) { - if (!(b instanceof Uint8Array)) - throw new Error('Expected Uint8Array'); - if (lengths.length > 0 && !lengths.includes(b.length)) - throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`); -} -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); -} -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'); -} -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}`); - } -} +/* unused harmony export alloc */ +/* harmony import */ var _util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(75930); -const assert = { number, bool, bytes, hash, exists, output }; -/* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ((/* unused pure expression or super */ null && (assert))); -//# sourceMappingURL=_assert.js.map +function alloc(size = 0) { + if (globalThis.Buffer != null && globalThis.Buffer.alloc != null) { + return asUint8Array(globalThis.Buffer.alloc(size)); + } + return new Uint8Array(size); +} +function allocUnsafe(size = 0) { + if (globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null) { + return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_0__/* .asUint8Array */ .o)(globalThis.Buffer.allocUnsafe(size)); + } + return new Uint8Array(size); +} /***/ }), -/***/ 37171: +/***/ 75007: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ concat: () => (/* binding */ concat) +/* harmony export */ }); +/* harmony import */ var _alloc_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(45238); +/* harmony import */ var _util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(75930); + + +function concat(arrays, length) { + if (!length) { + length = arrays.reduce((acc, curr) => acc + curr.length, 0); + } + const output = (0,_alloc_js__WEBPACK_IMPORTED_MODULE_0__/* .allocUnsafe */ .K)(length); + let offset = 0; + for (const arr of arrays) { + output.set(arr, offset); + offset += arr.length; + } + return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__/* .asUint8Array */ .o)(output); +} + +/***/ }), + +/***/ 18402: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ equals: () => (/* binding */ equals) +/* harmony export */ }); +function equals(a, b) { + if (a === b) { + return true; + } + if (a.byteLength !== b.byteLength) { + return false; + } + for (let i = 0; i < a.byteLength; i++) { + if (a[i] !== b[i]) { + return false; + } + } + return true; +} + +/***/ }), + +/***/ 44117: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ fromString: () => (/* binding */ fromString) +/* harmony export */ }); +/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(50040); +/* harmony import */ var _util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(75930); + + +function fromString(string, encoding = 'utf8') { + const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A[encoding]; + if (!base) { + throw new Error(`Unsupported encoding "${ encoding }"`); + } + if ((encoding === 'utf8' || encoding === 'utf-8') && globalThis.Buffer != null && globalThis.Buffer.from != null) { + return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__/* .asUint8Array */ .o)(globalThis.Buffer.from(string, 'utf-8')); + } + return base.decoder.decode(`${ base.prefix }${ string }`); +} + +/***/ }), + +/***/ 27302: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ toString: () => (/* binding */ toString) +/* harmony export */ }); +/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(50040); + +function toString(array, encoding = 'utf8') { + const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A[encoding]; + if (!base) { + throw new Error(`Unsupported encoding "${ encoding }"`); + } + if ((encoding === 'utf8' || encoding === 'utf-8') && globalThis.Buffer != null && globalThis.Buffer.from != null) { + return globalThis.Buffer.from(array.buffer, array.byteOffset, array.byteLength).toString('utf8'); + } + return base.encoder.encode(array).substring(1); +} + +/***/ }), + +/***/ 75930: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ D: () => (/* binding */ SHA2) +/* harmony export */ o: () => (/* binding */ asUint8Array) /* harmony export */ }); -/* harmony import */ var _assert_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27125); -/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10750); - - -// 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); +function asUint8Array(buf) { + if (globalThis.Buffer != null) { + return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength); + } + return buf; } -// Base SHA2 class (RFC 6234) -class SHA2 extends _utils_js__WEBPACK_IMPORTED_MODULE_0__/* .Hash */ .Vw { - 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__WEBPACK_IMPORTED_MODULE_0__/* .createView */ .O8)(this.buffer); - } - update(data) { - (0,_assert_js__WEBPACK_IMPORTED_MODULE_1__/* .exists */ .t2)(this); - const { view, buffer, blockLen } = this; - data = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__/* .toBytes */ .ZJ)(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__WEBPACK_IMPORTED_MODULE_0__/* .createView */ .O8)(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) { - (0,_assert_js__WEBPACK_IMPORTED_MODULE_1__/* .exists */ .t2)(this); - (0,_assert_js__WEBPACK_IMPORTED_MODULE_1__/* .output */ .CG)(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__WEBPACK_IMPORTED_MODULE_0__/* .createView */ .O8)(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; - } -} -//# sourceMappingURL=_sha2.js.map /***/ }), -/***/ 86558: -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ Ay: () => (__WEBPACK_DEFAULT_EXPORT__), -/* harmony export */ B4: () => (/* binding */ rotlSL), -/* harmony export */ P5: () => (/* binding */ rotlSH), -/* harmony export */ WM: () => (/* binding */ rotlBH), -/* harmony export */ im: () => (/* binding */ rotlBL), -/* harmony export */ lD: () => (/* binding */ split) -/* harmony export */ }); -/* unused harmony exports fromBig, toBig, shrSH, shrSL, rotrSH, rotrSL, rotrBH, rotrBL, rotr32H, rotr32L, add, add3L, add3H, add4L, add4H, add5H, add5L */ -const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1); -const _32n = /* @__PURE__ */ 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 }; -} -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]; -} -const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0); -// 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. -function add(Ah, Al, Bh, Bl) { - const l = (Al >>> 0) + (Bl >>> 0); - return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 }; -} -// 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 - -// prettier-ignore -const u64 = { - fromBig, split, toBig, - shrSH, shrSL, - rotrSH, rotrSL, rotrBH, rotrBL, - rotr32H, rotr32L, - rotlSH, rotlSL, rotlBH, rotlBL, - add, add3L, add3H, add4L, add4H, add5H, add5L, -}; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (u64); -//# sourceMappingURL=_u64.js.map - -/***/ }), - -/***/ 4655: -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ w: () => (/* binding */ hmac) -/* harmony export */ }); -/* unused harmony export HMAC */ -/* harmony import */ var _assert_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27125); -/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10750); - - -// HMAC (RFC 2104) -class HMAC extends _utils_js__WEBPACK_IMPORTED_MODULE_0__/* .Hash */ .Vw { - constructor(hash, _key) { - super(); - this.finished = false; - this.destroyed = false; - (0,_assert_js__WEBPACK_IMPORTED_MODULE_1__/* .hash */ .tW)(hash); - const key = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__/* .toBytes */ .ZJ)(_key); - this.iHash = hash.create(); - if (typeof this.iHash.update !== 'function') - throw new Error('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) { - (0,_assert_js__WEBPACK_IMPORTED_MODULE_1__/* .exists */ .t2)(this); - this.iHash.update(buf); - return this; - } - digestInto(out) { - (0,_assert_js__WEBPACK_IMPORTED_MODULE_1__/* .exists */ .t2)(this); - (0,_assert_js__WEBPACK_IMPORTED_MODULE_1__/* .bytes */ .ee)(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(); -hmac.create = (hash, key) => new HMAC(hash, key); -//# sourceMappingURL=hmac.js.map - -/***/ }), - -/***/ 84877: -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ A: () => (/* binding */ pbkdf2) -/* harmony export */ }); -/* unused harmony export pbkdf2Async */ -/* harmony import */ var _assert_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27125); -/* harmony import */ var _hmac_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4655); -/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(10750); - - - -// Common prologue and epilogue for sync/async functions -function pbkdf2Init(hash, _password, _salt, _opts) { - (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__/* .hash */ .tW)(hash); - const opts = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .checkOpts */ .tY)({ dkLen: 32, asyncTick: 10 }, _opts); - const { c, dkLen, asyncTick } = opts; - (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__/* .number */ .ai)(c); - (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__/* .number */ .ai)(dkLen); - (0,_assert_js__WEBPACK_IMPORTED_MODULE_0__/* .number */ .ai)(asyncTick); - if (c < 1) - throw new Error('PBKDF2: iterations (c) should be >= 1'); - const password = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .toBytes */ .ZJ)(_password); - const salt = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .toBytes */ .ZJ)(_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__WEBPACK_IMPORTED_MODULE_2__/* .hmac */ .w.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__WEBPACK_IMPORTED_MODULE_1__/* .createView */ .O8)(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); -} -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 = 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 asyncLoop(c - 1, asyncTick, () => { - // 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); -} -//# sourceMappingURL=pbkdf2.js.map - -/***/ }), - -/***/ 3439: -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ s: () => (/* binding */ sha256) -/* harmony export */ }); -/* unused harmony export sha224 */ -/* harmony import */ var _sha2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(37171); -/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(10750); - - -// SHA2-256 need to try 2^128 hashes to execute birthday attack. -// BTC network is doing 2^67 hashes/sec as per early 2023. -// 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 = /* @__PURE__ */ 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 = /* @__PURE__ */ 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 = /* @__PURE__ */ new Uint32Array(64); -class SHA256 extends _sha2_js__WEBPACK_IMPORTED_MODULE_0__/* .SHA2 */ .D { - 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__WEBPACK_IMPORTED_MODULE_1__/* .rotr */ .Ow)(W15, 7) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .rotr */ .Ow)(W15, 18) ^ (W15 >>> 3); - const s1 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .rotr */ .Ow)(W2, 17) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .rotr */ .Ow)(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__WEBPACK_IMPORTED_MODULE_1__/* .rotr */ .Ow)(E, 6) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .rotr */ .Ow)(E, 11) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .rotr */ .Ow)(E, 25); - const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; - const sigma0 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .rotr */ .Ow)(A, 2) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .rotr */ .Ow)(A, 13) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .rotr */ .Ow)(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 - */ -const sha256 = /* @__PURE__ */ (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .wrapConstructor */ .ld)(() => new SHA256()); -const sha224 = /* @__PURE__ */ (/* unused pure expression or super */ null && (wrapConstructor(() => new SHA224()))); -//# sourceMappingURL=sha256.js.map - -/***/ }), - -/***/ 10750: +/***/ 50040: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { - Vw: () => (/* binding */ Hash), - $h: () => (/* binding */ asyncLoop), - tY: () => (/* binding */ checkOpts), - Id: () => (/* binding */ concatBytes), - O8: () => (/* binding */ createView), - po: () => (/* binding */ randomBytes), - Ow: () => (/* binding */ rotr), - ZJ: () => (/* binding */ toBytes), - DH: () => (/* binding */ u32), - ld: () => (/* binding */ wrapConstructor) + A: () => (/* binding */ util_bases) }); -// UNUSED EXPORTS: bytesToHex, hexToBytes, isLE, nextTick, u8, utf8ToBytes, wrapConstructorWithOpts, wrapXOFConstructorWithOpts +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/bases/identity.js +var identity_namespaceObject = {}; +__webpack_require__.r(identity_namespaceObject); +__webpack_require__.d(identity_namespaceObject, { + identity: () => (identity) +}); -;// CONCATENATED MODULE: ./node_modules/ethers/node_modules/@noble/hashes/esm/crypto.js -const crypto_crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined; -//# sourceMappingURL=crypto.js.map -;// CONCATENATED MODULE: ./node_modules/ethers/node_modules/@noble/hashes/esm/utils.js -/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+. -// 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. +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/bases/base2.js +var base2_namespaceObject = {}; +__webpack_require__.r(base2_namespaceObject); +__webpack_require__.d(base2_namespaceObject, { + base2: () => (base2) +}); -const u8a = (a) => a instanceof Uint8Array; -// Cast array to different type -const u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength); -const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); -// Cast array to view -const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength); -// The rotate right (circular right shift) operation for uint32 -const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift); -// 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. -const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44; -if (!isLE) - throw new Error('Non little-endian hardware is not supported'); -const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0')); -/** - * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123' - */ -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; -} -/** - * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23]) - */ -function hexToBytes(hex) { - if (typeof hex !== 'string') - throw new Error('hex string expected, got ' + typeof hex); - const len = hex.length; - if (len % 2) - throw new Error('padded hex string expected, got unpadded hex of length ' + len); - const array = new Uint8Array(len / 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; -} -// 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 () => { }; -// 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 nextTick(); - ts += diff; - } -} -/** - * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) - */ -function utf8ToBytes(str) { - if (typeof str !== 'string') - throw new Error(`utf8ToBytes expected string, got ${typeof str}`); - return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809 -} -/** - * Normalizes (non-hex) string or Uint8Array to Uint8Array. - * Warning: when Uint8Array is passed, it would NOT get copied. - * Keep in mind for future mutable operations. - */ -function toBytes(data) { - if (typeof data === 'string') - data = utf8ToBytes(data); - if (!u8a(data)) - throw new Error(`expected Uint8Array, got ${typeof data}`); - return data; -} -/** - * Copies several Uint8Arrays into one. - */ -function concatBytes(...arrays) { - const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0)); - let pad = 0; // walk through each item, ensure they have proper type - arrays.forEach((a) => { - if (!u8a(a)) - throw new Error('Uint8Array expected'); - r.set(a, pad); - pad += a.length; - }); - return r; -} -// For runtime check if class implements interface -class Hash { - // Safe version that clones internal state - clone() { - return this._cloneInto(); - } -} -const toStr = {}.toString; -function checkOpts(defaults, opts) { - if (opts !== undefined && toStr.call(opts) !== '[object Object]') - throw new Error('Options should be object or undefined'); - const merged = Object.assign(defaults, opts); - return merged; -} -function wrapConstructor(hashCons) { - const hashC = (msg) => hashCons().update(toBytes(msg)).digest(); - const tmp = hashCons(); - hashC.outputLen = tmp.outputLen; - hashC.blockLen = tmp.blockLen; - hashC.create = () => hashCons(); - return hashC; -} -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; -} -function wrapXOFConstructorWithOpts(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; -} -/** - * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS. - */ -function randomBytes(bytesLength = 32) { - if (crypto_crypto && typeof crypto_crypto.getRandomValues === 'function') { - return crypto_crypto.getRandomValues(new Uint8Array(bytesLength)); - } - throw new Error('crypto.getRandomValues must be defined'); -} -//# sourceMappingURL=utils.js.map +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/bases/base8.js +var base8_namespaceObject = {}; +__webpack_require__.r(base8_namespaceObject); +__webpack_require__.d(base8_namespaceObject, { + base8: () => (base8) +}); -/***/ }), +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/bases/base10.js +var base10_namespaceObject = {}; +__webpack_require__.r(base10_namespaceObject); +__webpack_require__.d(base10_namespaceObject, { + base10: () => (base10) +}); -/***/ 2150: -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/bases/base16.js +var base16_namespaceObject = {}; +__webpack_require__.r(base16_namespaceObject); +__webpack_require__.d(base16_namespaceObject, { + base16: () => (base16), + base16upper: () => (base16upper) +}); -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ Struct: () => (/* binding */ Struct), -/* harmony export */ StructError: () => (/* binding */ StructError), -/* harmony export */ any: () => (/* binding */ any), -/* harmony export */ array: () => (/* binding */ array), -/* harmony export */ assert: () => (/* binding */ assert), -/* harmony export */ assign: () => (/* binding */ assign), -/* harmony export */ bigint: () => (/* binding */ bigint), -/* harmony export */ boolean: () => (/* binding */ boolean), -/* harmony export */ coerce: () => (/* binding */ coerce), -/* harmony export */ create: () => (/* binding */ create), -/* harmony export */ date: () => (/* binding */ date), -/* harmony export */ defaulted: () => (/* binding */ defaulted), -/* harmony export */ define: () => (/* binding */ define), -/* harmony export */ deprecated: () => (/* binding */ deprecated), -/* harmony export */ dynamic: () => (/* binding */ dynamic), -/* harmony export */ empty: () => (/* binding */ empty), -/* harmony export */ enums: () => (/* binding */ enums), -/* harmony export */ func: () => (/* binding */ func), -/* harmony export */ instance: () => (/* binding */ instance), -/* harmony export */ integer: () => (/* binding */ integer), -/* harmony export */ intersection: () => (/* binding */ intersection), -/* harmony export */ is: () => (/* binding */ is), -/* harmony export */ lazy: () => (/* binding */ lazy), -/* harmony export */ literal: () => (/* binding */ literal), -/* harmony export */ map: () => (/* binding */ map), -/* harmony export */ mask: () => (/* binding */ mask), -/* harmony export */ max: () => (/* binding */ max), -/* harmony export */ min: () => (/* binding */ min), -/* harmony export */ never: () => (/* binding */ never), -/* harmony export */ nonempty: () => (/* binding */ nonempty), -/* harmony export */ nullable: () => (/* binding */ nullable), -/* harmony export */ number: () => (/* binding */ number), -/* harmony export */ object: () => (/* binding */ object), -/* harmony export */ omit: () => (/* binding */ omit), -/* harmony export */ optional: () => (/* binding */ optional), -/* harmony export */ partial: () => (/* binding */ partial), -/* harmony export */ pattern: () => (/* binding */ pattern), -/* harmony export */ pick: () => (/* binding */ pick), -/* harmony export */ record: () => (/* binding */ record), -/* harmony export */ refine: () => (/* binding */ refine), -/* harmony export */ regexp: () => (/* binding */ regexp), -/* harmony export */ set: () => (/* binding */ set), -/* harmony export */ size: () => (/* binding */ size), -/* harmony export */ string: () => (/* binding */ string), -/* harmony export */ struct: () => (/* binding */ struct), -/* harmony export */ trimmed: () => (/* binding */ trimmed), -/* harmony export */ tuple: () => (/* binding */ tuple), -/* harmony export */ type: () => (/* binding */ type), -/* harmony export */ union: () => (/* binding */ union), -/* harmony export */ unknown: () => (/* binding */ unknown), -/* harmony export */ validate: () => (/* binding */ validate) -/* harmony export */ }); -/* provided dependency */ var console = __webpack_require__(96763); -/** - * A `StructFailure` represents a single specific failure in validation. - */ -/** - * `StructError` objects are thrown (or returned) when validation fails. - * - * Validation logic is design to exit early for maximum performance. The error - * represents the first error encountered during validation. For more detail, - * the `error.failures` property is a generator function that can be run to - * continue validation and receive all the failures in the data. - */ -class StructError extends TypeError { - constructor(failure, failures) { - let cached; - const { message, explanation, ...rest } = failure; - const { path } = failure; - const msg = path.length === 0 ? message : `At path: ${path.join('.')} -- ${message}`; - super(explanation ?? msg); - if (explanation != null) - this.cause = msg; - Object.assign(this, rest); - this.name = this.constructor.name; - this.failures = () => { - return (cached ?? (cached = [failure, ...failures()])); - }; - } -} +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/bases/base32.js +var base32_namespaceObject = {}; +__webpack_require__.r(base32_namespaceObject); +__webpack_require__.d(base32_namespaceObject, { + base32: () => (base32), + base32hex: () => (base32hex), + base32hexpad: () => (base32hexpad), + base32hexpadupper: () => (base32hexpadupper), + base32hexupper: () => (base32hexupper), + base32pad: () => (base32pad), + base32padupper: () => (base32padupper), + base32upper: () => (base32upper), + base32z: () => (base32z) +}); -/** - * Check if a value is an iterator. - */ -function isIterable(x) { - return isObject(x) && typeof x[Symbol.iterator] === 'function'; -} -/** - * Check if a value is a plain object. - */ -function isObject(x) { - return typeof x === 'object' && x != null; -} -/** - * Check if a value is a plain object. - */ -function isPlainObject(x) { - if (Object.prototype.toString.call(x) !== '[object Object]') { - return false; +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/bases/base36.js +var base36_namespaceObject = {}; +__webpack_require__.r(base36_namespaceObject); +__webpack_require__.d(base36_namespaceObject, { + base36: () => (base36), + base36upper: () => (base36upper) +}); + +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/bases/base58.js +var base58_namespaceObject = {}; +__webpack_require__.r(base58_namespaceObject); +__webpack_require__.d(base58_namespaceObject, { + base58btc: () => (base58btc), + base58flickr: () => (base58flickr) +}); + +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/bases/base64.js +var base64_namespaceObject = {}; +__webpack_require__.r(base64_namespaceObject); +__webpack_require__.d(base64_namespaceObject, { + base64: () => (base64), + base64pad: () => (base64pad), + base64url: () => (base64url), + base64urlpad: () => (base64urlpad) +}); + +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/bases/base256emoji.js +var base256emoji_namespaceObject = {}; +__webpack_require__.r(base256emoji_namespaceObject); +__webpack_require__.d(base256emoji_namespaceObject, { + base256emoji: () => (base256emoji) +}); + +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/hashes/sha2-browser.js +var sha2_browser_namespaceObject = {}; +__webpack_require__.r(sha2_browser_namespaceObject); +__webpack_require__.d(sha2_browser_namespaceObject, { + sha256: () => (sha256), + sha512: () => (sha512) +}); + +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/hashes/identity.js +var hashes_identity_namespaceObject = {}; +__webpack_require__.r(hashes_identity_namespaceObject); +__webpack_require__.d(hashes_identity_namespaceObject, { + identity: () => (identity_identity) +}); + +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/codecs/raw.js +var raw_namespaceObject = {}; +__webpack_require__.r(raw_namespaceObject); +__webpack_require__.d(raw_namespaceObject, { + code: () => (raw_code), + decode: () => (raw_decode), + encode: () => (raw_encode), + name: () => (raw_name) +}); + +// NAMESPACE OBJECT: ./node_modules/multiformats/esm/src/codecs/json.js +var json_namespaceObject = {}; +__webpack_require__.r(json_namespaceObject); +__webpack_require__.d(json_namespaceObject, { + code: () => (json_code), + decode: () => (json_decode), + encode: () => (json_encode), + name: () => (json_name) +}); + +;// ./node_modules/multiformats/esm/vendor/base-x.js +function base(ALPHABET, name) { + if (ALPHABET.length >= 255) { + throw new TypeError('Alphabet too long'); + } + var BASE_MAP = new Uint8Array(256); + for (var j = 0; j < BASE_MAP.length; j++) { + BASE_MAP[j] = 255; + } + for (var i = 0; i < ALPHABET.length; i++) { + var x = ALPHABET.charAt(i); + var xc = x.charCodeAt(0); + if (BASE_MAP[xc] !== 255) { + throw new TypeError(x + ' is ambiguous'); } - const prototype = Object.getPrototypeOf(x); - return prototype === null || prototype === Object.prototype; -} -/** - * Return a value as a printable string. - */ -function print(value) { - if (typeof value === 'symbol') { - return value.toString(); + BASE_MAP[xc] = i; + } + var BASE = ALPHABET.length; + var LEADER = ALPHABET.charAt(0); + var FACTOR = Math.log(BASE) / Math.log(256); + var iFACTOR = Math.log(256) / Math.log(BASE); + function encode(source) { + if (source instanceof Uint8Array); + else if (ArrayBuffer.isView(source)) { + source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength); + } else if (Array.isArray(source)) { + source = Uint8Array.from(source); } - return typeof value === 'string' ? JSON.stringify(value) : `${value}`; -} -/** - * Shifts (removes and returns) the first value from the `input` iterator. - * Like `Array.prototype.shift()` but for an `Iterator`. - */ -function shiftIterator(input) { - const { done, value } = input.next(); - return done ? undefined : value; -} -/** - * Convert a single validation result to a failure. - */ -function toFailure(result, context, struct, value) { - if (result === true) { + if (!(source instanceof Uint8Array)) { + throw new TypeError('Expected Uint8Array'); + } + if (source.length === 0) { + return ''; + } + var zeroes = 0; + var length = 0; + var pbegin = 0; + var pend = source.length; + while (pbegin !== pend && source[pbegin] === 0) { + pbegin++; + zeroes++; + } + var size = (pend - pbegin) * iFACTOR + 1 >>> 0; + var b58 = new Uint8Array(size); + while (pbegin !== pend) { + var carry = source[pbegin]; + var i = 0; + for (var it1 = size - 1; (carry !== 0 || i < length) && it1 !== -1; it1--, i++) { + carry += 256 * b58[it1] >>> 0; + b58[it1] = carry % BASE >>> 0; + carry = carry / BASE >>> 0; + } + if (carry !== 0) { + throw new Error('Non-zero carry'); + } + length = i; + pbegin++; + } + var it2 = size - length; + while (it2 !== size && b58[it2] === 0) { + it2++; + } + var str = LEADER.repeat(zeroes); + for (; it2 < size; ++it2) { + str += ALPHABET.charAt(b58[it2]); + } + return str; + } + function decodeUnsafe(source) { + if (typeof source !== 'string') { + throw new TypeError('Expected String'); + } + if (source.length === 0) { + return new Uint8Array(); + } + var psz = 0; + if (source[psz] === ' ') { + return; + } + var zeroes = 0; + var length = 0; + while (source[psz] === LEADER) { + zeroes++; + psz++; + } + var size = (source.length - psz) * FACTOR + 1 >>> 0; + var b256 = new Uint8Array(size); + while (source[psz]) { + var carry = BASE_MAP[source.charCodeAt(psz)]; + if (carry === 255) { return; + } + var i = 0; + for (var it3 = size - 1; (carry !== 0 || i < length) && it3 !== -1; it3--, i++) { + carry += BASE * b256[it3] >>> 0; + b256[it3] = carry % 256 >>> 0; + carry = carry / 256 >>> 0; + } + if (carry !== 0) { + throw new Error('Non-zero carry'); + } + length = i; + psz++; } - else if (result === false) { - result = {}; + if (source[psz] === ' ') { + return; } - else if (typeof result === 'string') { - result = { message: result }; + var it4 = size - length; + while (it4 !== size && b256[it4] === 0) { + it4++; } - const { path, branch } = context; - const { type } = struct; - const { refinement, message = `Expected a value of type \`${type}\`${refinement ? ` with refinement \`${refinement}\`` : ''}, but received: \`${print(value)}\``, } = result; + var vch = new Uint8Array(zeroes + (size - it4)); + var j = zeroes; + while (it4 !== size) { + vch[j++] = b256[it4++]; + } + return vch; + } + function decode(string) { + var buffer = decodeUnsafe(string); + if (buffer) { + return buffer; + } + throw new Error(`Non-${ name } character`); + } + return { + encode: encode, + decodeUnsafe: decodeUnsafe, + decode: decode + }; +} +var src = base; +var _brrp__multiformats_scope_baseX = src; +/* harmony default export */ const base_x = (_brrp__multiformats_scope_baseX); +;// ./node_modules/multiformats/esm/src/bytes.js +const empty = new Uint8Array(0); +const toHex = d => d.reduce((hex, byte) => hex + byte.toString(16).padStart(2, '0'), ''); +const fromHex = hex => { + const hexes = hex.match(/../g); + return hexes ? new Uint8Array(hexes.map(b => parseInt(b, 16))) : empty; +}; +const equals = (aa, bb) => { + if (aa === bb) + return true; + if (aa.byteLength !== bb.byteLength) { + return false; + } + for (let ii = 0; ii < aa.byteLength; ii++) { + if (aa[ii] !== bb[ii]) { + return false; + } + } + return true; +}; +const coerce = o => { + if (o instanceof Uint8Array && o.constructor.name === 'Uint8Array') + return o; + if (o instanceof ArrayBuffer) + return new Uint8Array(o); + if (ArrayBuffer.isView(o)) { + return new Uint8Array(o.buffer, o.byteOffset, o.byteLength); + } + throw new Error('Unknown type, must be binary type'); +}; +const isBinary = o => o instanceof ArrayBuffer || ArrayBuffer.isView(o); +const fromString = str => new TextEncoder().encode(str); +const bytes_toString = b => new TextDecoder().decode(b); + +;// ./node_modules/multiformats/esm/src/bases/base.js + + +class Encoder { + constructor(name, prefix, baseEncode) { + this.name = name; + this.prefix = prefix; + this.baseEncode = baseEncode; + } + encode(bytes) { + if (bytes instanceof Uint8Array) { + return `${ this.prefix }${ this.baseEncode(bytes) }`; + } else { + throw Error('Unknown type, must be binary type'); + } + } +} +class Decoder { + constructor(name, prefix, baseDecode) { + this.name = name; + this.prefix = prefix; + if (prefix.codePointAt(0) === undefined) { + throw new Error('Invalid prefix character'); + } + this.prefixCodePoint = prefix.codePointAt(0); + this.baseDecode = baseDecode; + } + decode(text) { + if (typeof text === 'string') { + if (text.codePointAt(0) !== this.prefixCodePoint) { + throw Error(`Unable to decode multibase string ${ JSON.stringify(text) }, ${ this.name } decoder only supports inputs prefixed with ${ this.prefix }`); + } + return this.baseDecode(text.slice(this.prefix.length)); + } else { + throw Error('Can only multibase decode strings'); + } + } + or(decoder) { + return or(this, decoder); + } +} +class ComposedDecoder { + constructor(decoders) { + this.decoders = decoders; + } + or(decoder) { + return or(this, decoder); + } + decode(input) { + const prefix = input[0]; + const decoder = this.decoders[prefix]; + if (decoder) { + return decoder.decode(input); + } else { + throw RangeError(`Unable to decode multibase string ${ JSON.stringify(input) }, only inputs prefixed with ${ Object.keys(this.decoders) } are supported`); + } + } +} +const or = (left, right) => new ComposedDecoder({ + ...left.decoders || { [left.prefix]: left }, + ...right.decoders || { [right.prefix]: right } +}); +class Codec { + constructor(name, prefix, baseEncode, baseDecode) { + this.name = name; + this.prefix = prefix; + this.baseEncode = baseEncode; + this.baseDecode = baseDecode; + this.encoder = new Encoder(name, prefix, baseEncode); + this.decoder = new Decoder(name, prefix, baseDecode); + } + encode(input) { + return this.encoder.encode(input); + } + decode(input) { + return this.decoder.decode(input); + } +} +const from = ({name, prefix, encode, decode}) => new Codec(name, prefix, encode, decode); +const baseX = ({prefix, name, alphabet}) => { + const {encode, decode} = base_x(alphabet, name); + return from({ + prefix, + name, + encode, + decode: text => coerce(decode(text)) + }); +}; +const decode = (string, alphabet, bitsPerChar, name) => { + const codes = {}; + for (let i = 0; i < alphabet.length; ++i) { + codes[alphabet[i]] = i; + } + let end = string.length; + while (string[end - 1] === '=') { + --end; + } + const out = new Uint8Array(end * bitsPerChar / 8 | 0); + let bits = 0; + let buffer = 0; + let written = 0; + for (let i = 0; i < end; ++i) { + const value = codes[string[i]]; + if (value === undefined) { + throw new SyntaxError(`Non-${ name } character`); + } + buffer = buffer << bitsPerChar | value; + bits += bitsPerChar; + if (bits >= 8) { + bits -= 8; + out[written++] = 255 & buffer >> bits; + } + } + if (bits >= bitsPerChar || 255 & buffer << 8 - bits) { + throw new SyntaxError('Unexpected end of data'); + } + return out; +}; +const encode = (data, alphabet, bitsPerChar) => { + const pad = alphabet[alphabet.length - 1] === '='; + const mask = (1 << bitsPerChar) - 1; + let out = ''; + let bits = 0; + let buffer = 0; + for (let i = 0; i < data.length; ++i) { + buffer = buffer << 8 | data[i]; + bits += 8; + while (bits > bitsPerChar) { + bits -= bitsPerChar; + out += alphabet[mask & buffer >> bits]; + } + } + if (bits) { + out += alphabet[mask & buffer << bitsPerChar - bits]; + } + if (pad) { + while (out.length * bitsPerChar & 7) { + out += '='; + } + } + return out; +}; +const rfc4648 = ({name, prefix, bitsPerChar, alphabet}) => { + return from({ + prefix, + name, + encode(input) { + return encode(input, alphabet, bitsPerChar); + }, + decode(input) { + return decode(input, alphabet, bitsPerChar, name); + } + }); +}; +;// ./node_modules/multiformats/esm/src/bases/identity.js + + +const identity = from({ + prefix: '\0', + name: 'identity', + encode: buf => bytes_toString(buf), + decode: str => fromString(str) +}); +;// ./node_modules/multiformats/esm/src/bases/base2.js + +const base2 = rfc4648({ + prefix: '0', + name: 'base2', + alphabet: '01', + bitsPerChar: 1 +}); +;// ./node_modules/multiformats/esm/src/bases/base8.js + +const base8 = rfc4648({ + prefix: '7', + name: 'base8', + alphabet: '01234567', + bitsPerChar: 3 +}); +;// ./node_modules/multiformats/esm/src/bases/base10.js + +const base10 = baseX({ + prefix: '9', + name: 'base10', + alphabet: '0123456789' +}); +;// ./node_modules/multiformats/esm/src/bases/base16.js + +const base16 = rfc4648({ + prefix: 'f', + name: 'base16', + alphabet: '0123456789abcdef', + bitsPerChar: 4 +}); +const base16upper = rfc4648({ + prefix: 'F', + name: 'base16upper', + alphabet: '0123456789ABCDEF', + bitsPerChar: 4 +}); +;// ./node_modules/multiformats/esm/src/bases/base32.js + +const base32 = rfc4648({ + prefix: 'b', + name: 'base32', + alphabet: 'abcdefghijklmnopqrstuvwxyz234567', + bitsPerChar: 5 +}); +const base32upper = rfc4648({ + prefix: 'B', + name: 'base32upper', + alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567', + bitsPerChar: 5 +}); +const base32pad = rfc4648({ + prefix: 'c', + name: 'base32pad', + alphabet: 'abcdefghijklmnopqrstuvwxyz234567=', + bitsPerChar: 5 +}); +const base32padupper = rfc4648({ + prefix: 'C', + name: 'base32padupper', + alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=', + bitsPerChar: 5 +}); +const base32hex = rfc4648({ + prefix: 'v', + name: 'base32hex', + alphabet: '0123456789abcdefghijklmnopqrstuv', + bitsPerChar: 5 +}); +const base32hexupper = rfc4648({ + prefix: 'V', + name: 'base32hexupper', + alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUV', + bitsPerChar: 5 +}); +const base32hexpad = rfc4648({ + prefix: 't', + name: 'base32hexpad', + alphabet: '0123456789abcdefghijklmnopqrstuv=', + bitsPerChar: 5 +}); +const base32hexpadupper = rfc4648({ + prefix: 'T', + name: 'base32hexpadupper', + alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUV=', + bitsPerChar: 5 +}); +const base32z = rfc4648({ + prefix: 'h', + name: 'base32z', + alphabet: 'ybndrfg8ejkmcpqxot1uwisza345h769', + bitsPerChar: 5 +}); +;// ./node_modules/multiformats/esm/src/bases/base36.js + +const base36 = baseX({ + prefix: 'k', + name: 'base36', + alphabet: '0123456789abcdefghijklmnopqrstuvwxyz' +}); +const base36upper = baseX({ + prefix: 'K', + name: 'base36upper', + alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' +}); +;// ./node_modules/multiformats/esm/src/bases/base58.js + +const base58btc = baseX({ + name: 'base58btc', + prefix: 'z', + alphabet: '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' +}); +const base58flickr = baseX({ + name: 'base58flickr', + prefix: 'Z', + alphabet: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ' +}); +;// ./node_modules/multiformats/esm/src/bases/base64.js + +const base64 = rfc4648({ + prefix: 'm', + name: 'base64', + alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', + bitsPerChar: 6 +}); +const base64pad = rfc4648({ + prefix: 'M', + name: 'base64pad', + alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=', + bitsPerChar: 6 +}); +const base64url = rfc4648({ + prefix: 'u', + name: 'base64url', + alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_', + bitsPerChar: 6 +}); +const base64urlpad = rfc4648({ + prefix: 'U', + name: 'base64urlpad', + alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=', + bitsPerChar: 6 +}); +;// ./node_modules/multiformats/esm/src/bases/base256emoji.js + +const alphabet = Array.from('\uD83D\uDE80\uD83E\uDE90\u2604\uD83D\uDEF0\uD83C\uDF0C\uD83C\uDF11\uD83C\uDF12\uD83C\uDF13\uD83C\uDF14\uD83C\uDF15\uD83C\uDF16\uD83C\uDF17\uD83C\uDF18\uD83C\uDF0D\uD83C\uDF0F\uD83C\uDF0E\uD83D\uDC09\u2600\uD83D\uDCBB\uD83D\uDDA5\uD83D\uDCBE\uD83D\uDCBF\uD83D\uDE02\u2764\uD83D\uDE0D\uD83E\uDD23\uD83D\uDE0A\uD83D\uDE4F\uD83D\uDC95\uD83D\uDE2D\uD83D\uDE18\uD83D\uDC4D\uD83D\uDE05\uD83D\uDC4F\uD83D\uDE01\uD83D\uDD25\uD83E\uDD70\uD83D\uDC94\uD83D\uDC96\uD83D\uDC99\uD83D\uDE22\uD83E\uDD14\uD83D\uDE06\uD83D\uDE44\uD83D\uDCAA\uD83D\uDE09\u263A\uD83D\uDC4C\uD83E\uDD17\uD83D\uDC9C\uD83D\uDE14\uD83D\uDE0E\uD83D\uDE07\uD83C\uDF39\uD83E\uDD26\uD83C\uDF89\uD83D\uDC9E\u270C\u2728\uD83E\uDD37\uD83D\uDE31\uD83D\uDE0C\uD83C\uDF38\uD83D\uDE4C\uD83D\uDE0B\uD83D\uDC97\uD83D\uDC9A\uD83D\uDE0F\uD83D\uDC9B\uD83D\uDE42\uD83D\uDC93\uD83E\uDD29\uD83D\uDE04\uD83D\uDE00\uD83D\uDDA4\uD83D\uDE03\uD83D\uDCAF\uD83D\uDE48\uD83D\uDC47\uD83C\uDFB6\uD83D\uDE12\uD83E\uDD2D\u2763\uD83D\uDE1C\uD83D\uDC8B\uD83D\uDC40\uD83D\uDE2A\uD83D\uDE11\uD83D\uDCA5\uD83D\uDE4B\uD83D\uDE1E\uD83D\uDE29\uD83D\uDE21\uD83E\uDD2A\uD83D\uDC4A\uD83E\uDD73\uD83D\uDE25\uD83E\uDD24\uD83D\uDC49\uD83D\uDC83\uD83D\uDE33\u270B\uD83D\uDE1A\uD83D\uDE1D\uD83D\uDE34\uD83C\uDF1F\uD83D\uDE2C\uD83D\uDE43\uD83C\uDF40\uD83C\uDF37\uD83D\uDE3B\uD83D\uDE13\u2B50\u2705\uD83E\uDD7A\uD83C\uDF08\uD83D\uDE08\uD83E\uDD18\uD83D\uDCA6\u2714\uD83D\uDE23\uD83C\uDFC3\uD83D\uDC90\u2639\uD83C\uDF8A\uD83D\uDC98\uD83D\uDE20\u261D\uD83D\uDE15\uD83C\uDF3A\uD83C\uDF82\uD83C\uDF3B\uD83D\uDE10\uD83D\uDD95\uD83D\uDC9D\uD83D\uDE4A\uD83D\uDE39\uD83D\uDDE3\uD83D\uDCAB\uD83D\uDC80\uD83D\uDC51\uD83C\uDFB5\uD83E\uDD1E\uD83D\uDE1B\uD83D\uDD34\uD83D\uDE24\uD83C\uDF3C\uD83D\uDE2B\u26BD\uD83E\uDD19\u2615\uD83C\uDFC6\uD83E\uDD2B\uD83D\uDC48\uD83D\uDE2E\uD83D\uDE46\uD83C\uDF7B\uD83C\uDF43\uD83D\uDC36\uD83D\uDC81\uD83D\uDE32\uD83C\uDF3F\uD83E\uDDE1\uD83C\uDF81\u26A1\uD83C\uDF1E\uD83C\uDF88\u274C\u270A\uD83D\uDC4B\uD83D\uDE30\uD83E\uDD28\uD83D\uDE36\uD83E\uDD1D\uD83D\uDEB6\uD83D\uDCB0\uD83C\uDF53\uD83D\uDCA2\uD83E\uDD1F\uD83D\uDE41\uD83D\uDEA8\uD83D\uDCA8\uD83E\uDD2C\u2708\uD83C\uDF80\uD83C\uDF7A\uD83E\uDD13\uD83D\uDE19\uD83D\uDC9F\uD83C\uDF31\uD83D\uDE16\uD83D\uDC76\uD83E\uDD74\u25B6\u27A1\u2753\uD83D\uDC8E\uD83D\uDCB8\u2B07\uD83D\uDE28\uD83C\uDF1A\uD83E\uDD8B\uD83D\uDE37\uD83D\uDD7A\u26A0\uD83D\uDE45\uD83D\uDE1F\uD83D\uDE35\uD83D\uDC4E\uD83E\uDD32\uD83E\uDD20\uD83E\uDD27\uD83D\uDCCC\uD83D\uDD35\uD83D\uDC85\uD83E\uDDD0\uD83D\uDC3E\uD83C\uDF52\uD83D\uDE17\uD83E\uDD11\uD83C\uDF0A\uD83E\uDD2F\uD83D\uDC37\u260E\uD83D\uDCA7\uD83D\uDE2F\uD83D\uDC86\uD83D\uDC46\uD83C\uDFA4\uD83D\uDE47\uD83C\uDF51\u2744\uD83C\uDF34\uD83D\uDCA3\uD83D\uDC38\uD83D\uDC8C\uD83D\uDCCD\uD83E\uDD40\uD83E\uDD22\uD83D\uDC45\uD83D\uDCA1\uD83D\uDCA9\uD83D\uDC50\uD83D\uDCF8\uD83D\uDC7B\uD83E\uDD10\uD83E\uDD2E\uD83C\uDFBC\uD83E\uDD75\uD83D\uDEA9\uD83C\uDF4E\uD83C\uDF4A\uD83D\uDC7C\uD83D\uDC8D\uD83D\uDCE3\uD83E\uDD42'); +const alphabetBytesToChars = alphabet.reduce((p, c, i) => { + p[i] = c; + return p; +}, []); +const alphabetCharsToBytes = alphabet.reduce((p, c, i) => { + p[c.codePointAt(0)] = i; + return p; +}, []); +function base256emoji_encode(data) { + return data.reduce((p, c) => { + p += alphabetBytesToChars[c]; + return p; + }, ''); +} +function base256emoji_decode(str) { + const byts = []; + for (const char of str) { + const byt = alphabetCharsToBytes[char.codePointAt(0)]; + if (byt === undefined) { + throw new Error(`Non-base256emoji character: ${ char }`); + } + byts.push(byt); + } + return new Uint8Array(byts); +} +const base256emoji = from({ + prefix: '\uD83D\uDE80', + name: 'base256emoji', + encode: base256emoji_encode, + decode: base256emoji_decode +}); +;// ./node_modules/multiformats/esm/vendor/varint.js +var encode_1 = varint_encode; +var MSB = 128, REST = 127, MSBALL = ~REST, INT = Math.pow(2, 31); +function varint_encode(num, out, offset) { + out = out || []; + offset = offset || 0; + var oldOffset = offset; + while (num >= INT) { + out[offset++] = num & 255 | MSB; + num /= 128; + } + while (num & MSBALL) { + out[offset++] = num & 255 | MSB; + num >>>= 7; + } + out[offset] = num | 0; + varint_encode.bytes = offset - oldOffset + 1; + return out; +} +var varint_decode = read; +var MSB$1 = 128, REST$1 = 127; +function read(buf, offset) { + var res = 0, offset = offset || 0, shift = 0, counter = offset, b, l = buf.length; + do { + if (counter >= l) { + read.bytes = 0; + throw new RangeError('Could not decode varint'); + } + b = buf[counter++]; + res += shift < 28 ? (b & REST$1) << shift : (b & REST$1) * Math.pow(2, shift); + shift += 7; + } while (b >= MSB$1); + read.bytes = counter - offset; + return res; +} +var N1 = Math.pow(2, 7); +var N2 = Math.pow(2, 14); +var N3 = Math.pow(2, 21); +var N4 = Math.pow(2, 28); +var N5 = Math.pow(2, 35); +var N6 = Math.pow(2, 42); +var N7 = Math.pow(2, 49); +var N8 = Math.pow(2, 56); +var N9 = Math.pow(2, 63); +var varint_length = function (value) { + return value < N1 ? 1 : value < N2 ? 2 : value < N3 ? 3 : value < N4 ? 4 : value < N5 ? 5 : value < N6 ? 6 : value < N7 ? 7 : value < N8 ? 8 : value < N9 ? 9 : 10; +}; +var varint = { + encode: encode_1, + decode: varint_decode, + encodingLength: varint_length +}; +var _brrp_varint = varint; +/* harmony default export */ const vendor_varint = (_brrp_varint); +;// ./node_modules/multiformats/esm/src/varint.js + +const src_varint_decode = (data, offset = 0) => { + const code = vendor_varint.decode(data, offset); + return [ + code, + vendor_varint.decode.bytes + ]; +}; +const encodeTo = (int, target, offset = 0) => { + vendor_varint.encode(int, target, offset); + return target; +}; +const encodingLength = int => { + return vendor_varint.encodingLength(int); +}; +;// ./node_modules/multiformats/esm/src/hashes/digest.js + + +const create = (code, digest) => { + const size = digest.byteLength; + const sizeOffset = encodingLength(code); + const digestOffset = sizeOffset + encodingLength(size); + const bytes = new Uint8Array(digestOffset + size); + encodeTo(code, bytes, 0); + encodeTo(size, bytes, sizeOffset); + bytes.set(digest, digestOffset); + return new Digest(code, size, digest, bytes); +}; +const digest_decode = multihash => { + const bytes = coerce(multihash); + const [code, sizeOffset] = src_varint_decode(bytes); + const [size, digestOffset] = src_varint_decode(bytes.subarray(sizeOffset)); + const digest = bytes.subarray(sizeOffset + digestOffset); + if (digest.byteLength !== size) { + throw new Error('Incorrect length'); + } + return new Digest(code, size, digest, bytes); +}; +const digest_equals = (a, b) => { + if (a === b) { + return true; + } else { + return a.code === b.code && a.size === b.size && equals(a.bytes, b.bytes); + } +}; +class Digest { + constructor(code, size, digest, bytes) { + this.code = code; + this.size = size; + this.digest = digest; + this.bytes = bytes; + } +} +;// ./node_modules/multiformats/esm/src/hashes/hasher.js + +const hasher_from = ({name, code, encode}) => new Hasher(name, code, encode); +class Hasher { + constructor(name, code, encode) { + this.name = name; + this.code = code; + this.encode = encode; + } + digest(input) { + if (input instanceof Uint8Array) { + const result = this.encode(input); + return result instanceof Uint8Array ? create(this.code, result) : result.then(digest => create(this.code, digest)); + } else { + throw Error('Unknown type, must be binary type'); + } + } +} +;// ./node_modules/multiformats/esm/src/hashes/sha2-browser.js + +const sha = name => async data => new Uint8Array(await crypto.subtle.digest(name, data)); +const sha256 = hasher_from({ + name: 'sha2-256', + code: 18, + encode: sha('SHA-256') +}); +const sha512 = hasher_from({ + name: 'sha2-512', + code: 19, + encode: sha('SHA-512') +}); +;// ./node_modules/multiformats/esm/src/hashes/identity.js + + +const code = 0; +const identity_name = 'identity'; +const identity_encode = coerce; +const digest = input => create(code, identity_encode(input)); +const identity_identity = { + code, + name: identity_name, + encode: identity_encode, + digest +}; +;// ./node_modules/multiformats/esm/src/codecs/raw.js + +const raw_name = 'raw'; +const raw_code = 85; +const raw_encode = node => coerce(node); +const raw_decode = data => coerce(data); +;// ./node_modules/multiformats/esm/src/codecs/json.js +const textEncoder = new TextEncoder(); +const textDecoder = new TextDecoder(); +const json_name = 'json'; +const json_code = 512; +const json_encode = node => textEncoder.encode(JSON.stringify(node)); +const json_decode = data => JSON.parse(textDecoder.decode(data)); +;// ./node_modules/multiformats/esm/src/cid.js + + + + + +class CID { + constructor(version, code, multihash, bytes) { + this.code = code; + this.version = version; + this.multihash = multihash; + this.bytes = bytes; + this.byteOffset = bytes.byteOffset; + this.byteLength = bytes.byteLength; + this.asCID = this; + this._baseCache = new Map(); + Object.defineProperties(this, { + byteOffset: cid_hidden, + byteLength: cid_hidden, + code: readonly, + version: readonly, + multihash: readonly, + bytes: readonly, + _baseCache: cid_hidden, + asCID: cid_hidden + }); + } + toV0() { + switch (this.version) { + case 0: { + return this; + } + default: { + const {code, multihash} = this; + if (code !== DAG_PB_CODE) { + throw new Error('Cannot convert a non dag-pb CID to CIDv0'); + } + if (multihash.code !== SHA_256_CODE) { + throw new Error('Cannot convert non sha2-256 multihash CID to CIDv0'); + } + return CID.createV0(multihash); + } + } + } + toV1() { + switch (this.version) { + case 0: { + const {code, digest} = this.multihash; + const multihash = create(code, digest); + return CID.createV1(this.code, multihash); + } + case 1: { + return this; + } + default: { + throw Error(`Can not convert CID version ${ this.version } to version 0. This is a bug please report`); + } + } + } + equals(other) { + return other && this.code === other.code && this.version === other.version && digest_equals(this.multihash, other.multihash); + } + toString(base) { + const {bytes, version, _baseCache} = this; + switch (version) { + case 0: + return toStringV0(bytes, _baseCache, base || base58btc.encoder); + default: + return toStringV1(bytes, _baseCache, base || base32.encoder); + } + } + toJSON() { return { - value, - type, - refinement, - key: path[path.length - 1], - path, - branch, - ...result, - message, + code: this.code, + version: this.version, + hash: this.multihash.bytes }; + } + get [Symbol.toStringTag]() { + return 'CID'; + } + [Symbol.for('nodejs.util.inspect.custom')]() { + return 'CID(' + this.toString() + ')'; + } + static isCID(value) { + deprecate(/^0\.0/, IS_CID_DEPRECATION); + return !!(value && (value[cidSymbol] || value.asCID === value)); + } + get toBaseEncodedString() { + throw new Error('Deprecated, use .toString()'); + } + get codec() { + throw new Error('"codec" property is deprecated, use integer "code" property instead'); + } + get buffer() { + throw new Error('Deprecated .buffer property, use .bytes to get Uint8Array instead'); + } + get multibaseName() { + throw new Error('"multibaseName" property is deprecated'); + } + get prefix() { + throw new Error('"prefix" property is deprecated'); + } + static asCID(value) { + if (value instanceof CID) { + return value; + } else if (value != null && value.asCID === value) { + const {version, code, multihash, bytes} = value; + return new CID(version, code, multihash, bytes || encodeCID(version, code, multihash.bytes)); + } else if (value != null && value[cidSymbol] === true) { + const {version, multihash, code} = value; + const digest = digest_decode(multihash); + return CID.create(version, code, digest); + } else { + return null; + } + } + static create(version, code, digest) { + if (typeof code !== 'number') { + throw new Error('String codecs are no longer supported'); + } + switch (version) { + case 0: { + if (code !== DAG_PB_CODE) { + throw new Error(`Version 0 CID must use dag-pb (code: ${ DAG_PB_CODE }) block encoding`); + } else { + return new CID(version, code, digest, digest.bytes); + } + } + case 1: { + const bytes = encodeCID(version, code, digest.bytes); + return new CID(version, code, digest, bytes); + } + default: { + throw new Error('Invalid version'); + } + } + } + static createV0(digest) { + return CID.create(0, DAG_PB_CODE, digest); + } + static createV1(code, digest) { + return CID.create(1, code, digest); + } + static decode(bytes) { + const [cid, remainder] = CID.decodeFirst(bytes); + if (remainder.length) { + throw new Error('Incorrect length'); + } + return cid; + } + static decodeFirst(bytes) { + const specs = CID.inspectBytes(bytes); + const prefixSize = specs.size - specs.multihashSize; + const multihashBytes = coerce(bytes.subarray(prefixSize, prefixSize + specs.multihashSize)); + if (multihashBytes.byteLength !== specs.multihashSize) { + throw new Error('Incorrect length'); + } + const digestBytes = multihashBytes.subarray(specs.multihashSize - specs.digestSize); + const digest = new Digest(specs.multihashCode, specs.digestSize, digestBytes, multihashBytes); + const cid = specs.version === 0 ? CID.createV0(digest) : CID.createV1(specs.codec, digest); + return [ + cid, + bytes.subarray(specs.size) + ]; + } + static inspectBytes(initialBytes) { + let offset = 0; + const next = () => { + const [i, length] = src_varint_decode(initialBytes.subarray(offset)); + offset += length; + return i; + }; + let version = next(); + let codec = DAG_PB_CODE; + if (version === 18) { + version = 0; + offset = 0; + } else if (version === 1) { + codec = next(); + } + if (version !== 0 && version !== 1) { + throw new RangeError(`Invalid CID version ${ version }`); + } + const prefixSize = offset; + const multihashCode = next(); + const digestSize = next(); + const size = offset + digestSize; + const multihashSize = size - prefixSize; + return { + version, + codec, + multihashCode, + digestSize, + multihashSize, + size + }; + } + static parse(source, base) { + const [prefix, bytes] = parseCIDtoBytes(source, base); + const cid = CID.decode(bytes); + cid._baseCache.set(prefix, source); + return cid; + } } -/** - * Convert a validation result to an iterable of failures. - */ -function* toFailures(result, context, struct, value) { - if (!isIterable(result)) { - result = [result]; +const parseCIDtoBytes = (source, base) => { + switch (source[0]) { + case 'Q': { + const decoder = base || base58btc; + return [ + base58btc.prefix, + decoder.decode(`${ base58btc.prefix }${ source }`) + ]; } - for (const r of result) { - const failure = toFailure(r, context, struct, value); - if (failure) { - yield failure; - } + case base58btc.prefix: { + const decoder = base || base58btc; + return [ + base58btc.prefix, + decoder.decode(source) + ]; } -} -/** - * Check a value against a struct, traversing deeply into nested values, and - * returning an iterator of failures or success. - */ -function* run(value, struct, options = {}) { - const { path = [], branch = [value], coerce = false, mask = false } = options; - const ctx = { path, branch }; - if (coerce) { - value = struct.coercer(value, ctx); - if (mask && - struct.type !== 'type' && - isObject(struct.schema) && - isObject(value) && - !Array.isArray(value)) { - for (const key in value) { - if (struct.schema[key] === undefined) { - delete value[key]; - } - } - } + case base32.prefix: { + const decoder = base || base32; + return [ + base32.prefix, + decoder.decode(source) + ]; } - let status = 'valid'; - for (const failure of struct.validator(value, ctx)) { - failure.explanation = options.message; - status = 'not_valid'; - yield [failure, undefined]; - } - for (let [k, v, s] of struct.entries(value, ctx)) { - const ts = run(v, s, { - path: k === undefined ? path : [...path, k], - branch: k === undefined ? branch : [...branch, v], - coerce, - mask, - message: options.message, - }); - for (const t of ts) { - if (t[0]) { - status = t[0].refinement != null ? 'not_refined' : 'not_valid'; - yield [t[0], undefined]; - } - else if (coerce) { - v = t[1]; - if (k === undefined) { - value = v; - } - else if (value instanceof Map) { - value.set(k, v); - } - else if (value instanceof Set) { - value.add(v); - } - else if (isObject(value)) { - if (v !== undefined || k in value) - value[k] = v; - } - } - } - } - if (status !== 'not_valid') { - for (const failure of struct.refiner(value, ctx)) { - failure.explanation = options.message; - status = 'not_refined'; - yield [failure, undefined]; - } - } - if (status === 'valid') { - yield [undefined, value]; + default: { + if (base == null) { + throw Error('To parse non base32 or base58btc encoded CID multibase decoder must be provided'); + } + return [ + source[0], + base.decode(source) + ]; } + } +}; +const toStringV0 = (bytes, cache, base) => { + const {prefix} = base; + if (prefix !== base58btc.prefix) { + throw Error(`Cannot string encode V0 in ${ base.name } encoding`); + } + const cid = cache.get(prefix); + if (cid == null) { + const cid = base.encode(bytes).slice(1); + cache.set(prefix, cid); + return cid; + } else { + return cid; + } +}; +const toStringV1 = (bytes, cache, base) => { + const {prefix} = base; + const cid = cache.get(prefix); + if (cid == null) { + const cid = base.encode(bytes); + cache.set(prefix, cid); + return cid; + } else { + return cid; + } +}; +const DAG_PB_CODE = 112; +const SHA_256_CODE = 18; +const encodeCID = (version, code, multihash) => { + const codeOffset = encodingLength(version); + const hashOffset = codeOffset + encodingLength(code); + const bytes = new Uint8Array(hashOffset + multihash.byteLength); + encodeTo(version, bytes, 0); + encodeTo(code, bytes, codeOffset); + bytes.set(multihash, hashOffset); + return bytes; +}; +const cidSymbol = Symbol.for('@ipld/js-cid/CID'); +const readonly = { + writable: false, + configurable: false, + enumerable: true +}; +const cid_hidden = { + writable: false, + enumerable: false, + configurable: false +}; +const version = '0.0.0-dev'; +const deprecate = (range, message) => { + if (range.test(version)) { + console.warn(message); + } else { + throw new Error(message); + } +}; +const IS_CID_DEPRECATION = `CID.isCID(v) is deprecated and will be removed in the next major release. +Following code pattern: + +if (CID.isCID(value)) { + doSomethingWithCID(value) } -/** - * `Struct` objects encapsulate the validation logic for a specific type of - * values. Once constructed, you use the `assert`, `is` or `validate` helpers to - * validate unknown input data against the struct. - */ -class Struct { - constructor(props) { - const { type, schema, validator, refiner, coercer = (value) => value, entries = function* () { }, } = props; - this.type = type; - this.schema = schema; - this.entries = entries; - this.coercer = coercer; - if (validator) { - this.validator = (value, context) => { - const result = validator(value, context); - return toFailures(result, context, this, value); - }; - } - else { - this.validator = () => []; - } - if (refiner) { - this.refiner = (value, context) => { - const result = refiner(value, context); - return toFailures(result, context, this, value); - }; - } - else { - this.refiner = () => []; - } - } - /** - * Assert that a value passes the struct's validation, throwing if it doesn't. - */ - assert(value, message) { - return assert(value, this, message); - } - /** - * Create a value with the struct's coercion logic, then validate it. - */ - create(value, message) { - return create(value, this, message); - } - /** - * Check if a value passes the struct's validation. - */ - is(value) { - return is(value, this); - } - /** - * Mask a value, coercing and validating it, but returning only the subset of - * properties defined by the struct's schema. - */ - mask(value, message) { - return mask(value, this, message); - } - /** - * Validate a value with the struct's validation logic, returning a tuple - * representing the result. - * - * You may optionally pass `true` for the `withCoercion` argument to coerce - * the value before attempting to validate it. If you do, the result will - * contain the coerced result when successful. - */ - validate(value, options = {}) { - return validate(value, this, options); - } -} -/** - * Assert that a value passes a struct, throwing if it doesn't. - */ -function assert(value, struct, message) { - const result = validate(value, struct, { message }); - if (result[0]) { - throw result[0]; - } -} -/** - * Create a value with the coercion logic of struct and validate it. - */ -function create(value, struct, message) { - const result = validate(value, struct, { coerce: true, message }); - if (result[0]) { - throw result[0]; - } - else { - return result[1]; - } -} -/** - * Mask a value, returning only the subset of properties defined by a struct. - */ -function mask(value, struct, message) { - const result = validate(value, struct, { coerce: true, mask: true, message }); - if (result[0]) { - throw result[0]; - } - else { - return result[1]; - } -} -/** - * Check if a value passes a struct. - */ -function is(value, struct) { - const result = validate(value, struct); - return !result[0]; -} -/** - * Validate a value against a struct, returning an error if invalid, or the - * value (with potential coercion) if valid. - */ -function validate(value, struct, options = {}) { - const tuples = run(value, struct, options); - const tuple = shiftIterator(tuples); - if (tuple[0]) { - const error = new StructError(tuple[0], function* () { - for (const t of tuples) { - if (t[0]) { - yield t[0]; - } - } - }); - return [error, undefined]; - } - else { - const v = tuple[1]; - return [undefined, v]; - } -} +Is replaced with: -function assign(...Structs) { - const isType = Structs[0].type === 'type'; - const schemas = Structs.map((s) => s.schema); - const schema = Object.assign({}, ...schemas); - return isType ? type(schema) : object(schema); -} -/** - * Define a new struct type with a custom validation function. - */ -function define(name, validator) { - return new Struct({ type: name, schema: null, validator }); -} -/** - * Create a new struct based on an existing struct, but the value is allowed to - * be `undefined`. `log` will be called if the value is not `undefined`. - */ -function deprecated(struct, log) { - return new Struct({ - ...struct, - refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx), - validator(value, ctx) { - if (value === undefined) { - return true; - } - else { - log(value, ctx); - return struct.validator(value, ctx); - } - }, - }); -} -/** - * Create a struct with dynamic validation logic. - * - * The callback will receive the value currently being validated, and must - * return a struct object to validate it with. This can be useful to model - * validation logic that changes based on its input. - */ -function dynamic(fn) { - return new Struct({ - type: 'dynamic', - schema: null, - *entries(value, ctx) { - const struct = fn(value, ctx); - yield* struct.entries(value, ctx); - }, - validator(value, ctx) { - const struct = fn(value, ctx); - return struct.validator(value, ctx); - }, - coercer(value, ctx) { - const struct = fn(value, ctx); - return struct.coercer(value, ctx); - }, - refiner(value, ctx) { - const struct = fn(value, ctx); - return struct.refiner(value, ctx); - }, - }); -} -/** - * Create a struct with lazily evaluated validation logic. - * - * The first time validation is run with the struct, the callback will be called - * and must return a struct object to use. This is useful for cases where you - * want to have self-referential structs for nested data structures to avoid a - * circular definition problem. - */ -function lazy(fn) { - let struct; - return new Struct({ - type: 'lazy', - schema: null, - *entries(value, ctx) { - struct ?? (struct = fn()); - yield* struct.entries(value, ctx); - }, - validator(value, ctx) { - struct ?? (struct = fn()); - return struct.validator(value, ctx); - }, - coercer(value, ctx) { - struct ?? (struct = fn()); - return struct.coercer(value, ctx); - }, - refiner(value, ctx) { - struct ?? (struct = fn()); - return struct.refiner(value, ctx); - }, - }); -} -/** - * Create a new struct based on an existing object struct, but excluding - * specific properties. - * - * Like TypeScript's `Omit` utility. - */ -function omit(struct, keys) { - const { schema } = struct; - const subschema = { ...schema }; - for (const key of keys) { - delete subschema[key]; - } - switch (struct.type) { - case 'type': - return type(subschema); - default: - return object(subschema); - } -} -/** - * Create a new struct based on an existing object struct, but with all of its - * properties allowed to be `undefined`. - * - * Like TypeScript's `Partial` utility. - */ -function partial(struct) { - const isStruct = struct instanceof Struct; - const schema = isStruct ? { ...struct.schema } : { ...struct }; - for (const key in schema) { - schema[key] = optional(schema[key]); - } - if (isStruct && struct.type === 'type') { - return type(schema); - } - return object(schema); -} -/** - * Create a new struct based on an existing object struct, but only including - * specific properties. - * - * Like TypeScript's `Pick` utility. - */ -function pick(struct, keys) { - const { schema } = struct; - const subschema = {}; - for (const key of keys) { - subschema[key] = schema[key]; - } - switch (struct.type) { - case 'type': - return type(subschema); - default: - return object(subschema); - } -} -/** - * Define a new struct type with a custom validation function. - * - * @deprecated This function has been renamed to `define`. - */ -function struct(name, validator) { - console.warn('superstruct@0.11 - The `struct` helper has been renamed to `define`.'); - return define(name, validator); -} - -/** - * Ensure that any value passes validation. - */ -function any() { - return define('any', () => true); -} -function array(Element) { - return new Struct({ - type: 'array', - schema: Element, - *entries(value) { - if (Element && Array.isArray(value)) { - for (const [i, v] of value.entries()) { - yield [i, v, Element]; - } - } - }, - coercer(value) { - return Array.isArray(value) ? value.slice() : value; - }, - validator(value) { - return (Array.isArray(value) || - `Expected an array value, but received: ${print(value)}`); - }, - }); -} -/** - * Ensure that a value is a bigint. - */ -function bigint() { - return define('bigint', (value) => { - return typeof value === 'bigint'; - }); -} -/** - * Ensure that a value is a boolean. - */ -function boolean() { - return define('boolean', (value) => { - return typeof value === 'boolean'; - }); -} -/** - * Ensure that a value is a valid `Date`. - * - * Note: this also ensures that the value is *not* an invalid `Date` object, - * which can occur when parsing a date fails but still returns a `Date`. - */ -function date() { - return define('date', (value) => { - return ((value instanceof Date && !isNaN(value.getTime())) || - `Expected a valid \`Date\` object, but received: ${print(value)}`); - }); -} -function enums(values) { - const schema = {}; - const description = values.map((v) => print(v)).join(); - for (const key of values) { - schema[key] = key; - } - return new Struct({ - type: 'enums', - schema, - validator(value) { - return (values.includes(value) || - `Expected one of \`${description}\`, but received: ${print(value)}`); - }, - }); -} -/** - * Ensure that a value is a function. - */ -function func() { - return define('func', (value) => { - return (typeof value === 'function' || - `Expected a function, but received: ${print(value)}`); - }); -} -/** - * Ensure that a value is an instance of a specific class. - */ -function instance(Class) { - return define('instance', (value) => { - return (value instanceof Class || - `Expected a \`${Class.name}\` instance, but received: ${print(value)}`); - }); -} -/** - * Ensure that a value is an integer. - */ -function integer() { - return define('integer', (value) => { - return ((typeof value === 'number' && !isNaN(value) && Number.isInteger(value)) || - `Expected an integer, but received: ${print(value)}`); - }); -} -/** - * Ensure that a value matches all of a set of types. - */ -function intersection(Structs) { - return new Struct({ - type: 'intersection', - schema: null, - *entries(value, ctx) { - for (const S of Structs) { - yield* S.entries(value, ctx); - } - }, - *validator(value, ctx) { - for (const S of Structs) { - yield* S.validator(value, ctx); - } - }, - *refiner(value, ctx) { - for (const S of Structs) { - yield* S.refiner(value, ctx); - } - }, - }); -} -function literal(constant) { - const description = print(constant); - const t = typeof constant; - return new Struct({ - type: 'literal', - schema: t === 'string' || t === 'number' || t === 'boolean' ? constant : null, - validator(value) { - return (value === constant || - `Expected the literal \`${description}\`, but received: ${print(value)}`); - }, - }); -} -function map(Key, Value) { - return new Struct({ - type: 'map', - schema: null, - *entries(value) { - if (Key && Value && value instanceof Map) { - for (const [k, v] of value.entries()) { - yield [k, k, Key]; - yield [k, v, Value]; - } - } - }, - coercer(value) { - return value instanceof Map ? new Map(value) : value; - }, - validator(value) { - return (value instanceof Map || - `Expected a \`Map\` object, but received: ${print(value)}`); - }, - }); -} -/** - * Ensure that no value ever passes validation. - */ -function never() { - return define('never', () => false); -} -/** - * Augment an existing struct to allow `null` values. - */ -function nullable(struct) { - return new Struct({ - ...struct, - validator: (value, ctx) => value === null || struct.validator(value, ctx), - refiner: (value, ctx) => value === null || struct.refiner(value, ctx), - }); -} -/** - * Ensure that a value is a number. - */ -function number() { - return define('number', (value) => { - return ((typeof value === 'number' && !isNaN(value)) || - `Expected a number, but received: ${print(value)}`); - }); -} -function object(schema) { - const knowns = schema ? Object.keys(schema) : []; - const Never = never(); - return new Struct({ - type: 'object', - schema: schema ? schema : null, - *entries(value) { - if (schema && isObject(value)) { - const unknowns = new Set(Object.keys(value)); - for (const key of knowns) { - unknowns.delete(key); - yield [key, value[key], schema[key]]; - } - for (const key of unknowns) { - yield [key, value[key], Never]; - } - } - }, - validator(value) { - return (isObject(value) || `Expected an object, but received: ${print(value)}`); - }, - coercer(value) { - return isObject(value) ? { ...value } : value; - }, - }); -} -/** - * Augment a struct to allow `undefined` values. - */ -function optional(struct) { - return new Struct({ - ...struct, - validator: (value, ctx) => value === undefined || struct.validator(value, ctx), - refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx), - }); -} -/** - * Ensure that a value is an object with keys and values of specific types, but - * without ensuring any specific shape of properties. - * - * Like TypeScript's `Record` utility. - */ -function record(Key, Value) { - return new Struct({ - type: 'record', - schema: null, - *entries(value) { - if (isObject(value)) { - for (const k in value) { - const v = value[k]; - yield [k, k, Key]; - yield [k, v, Value]; - } - } - }, - validator(value) { - return (isObject(value) || `Expected an object, but received: ${print(value)}`); - }, - }); -} -/** - * Ensure that a value is a `RegExp`. - * - * Note: this does not test the value against the regular expression! For that - * you need to use the `pattern()` refinement. - */ -function regexp() { - return define('regexp', (value) => { - return value instanceof RegExp; - }); -} -function set(Element) { - return new Struct({ - type: 'set', - schema: null, - *entries(value) { - if (Element && value instanceof Set) { - for (const v of value) { - yield [v, v, Element]; - } - } - }, - coercer(value) { - return value instanceof Set ? new Set(value) : value; - }, - validator(value) { - return (value instanceof Set || - `Expected a \`Set\` object, but received: ${print(value)}`); - }, - }); -} -/** - * Ensure that a value is a string. - */ -function string() { - return define('string', (value) => { - return (typeof value === 'string' || - `Expected a string, but received: ${print(value)}`); - }); -} -/** - * Ensure that a value is a tuple of a specific length, and that each of its - * elements is of a specific type. - */ -function tuple(Structs) { - const Never = never(); - return new Struct({ - type: 'tuple', - schema: null, - *entries(value) { - if (Array.isArray(value)) { - const length = Math.max(Structs.length, value.length); - for (let i = 0; i < length; i++) { - yield [i, value[i], Structs[i] || Never]; - } - } - }, - validator(value) { - return (Array.isArray(value) || - `Expected an array, but received: ${print(value)}`); - }, - }); -} -/** - * Ensure that a value has a set of known properties of specific types. - * - * Note: Unrecognized properties are allowed and untouched. This is similar to - * how TypeScript's structural typing works. - */ -function type(schema) { - const keys = Object.keys(schema); - return new Struct({ - type: 'type', - schema, - *entries(value) { - if (isObject(value)) { - for (const k of keys) { - yield [k, value[k], schema[k]]; - } - } - }, - validator(value) { - return (isObject(value) || `Expected an object, but received: ${print(value)}`); - }, - coercer(value) { - return isObject(value) ? { ...value } : value; - }, - }); -} -/** - * Ensure that a value matches one of a set of types. - */ -function union(Structs) { - const description = Structs.map((s) => s.type).join(' | '); - return new Struct({ - type: 'union', - schema: null, - coercer(value) { - for (const S of Structs) { - const [error, coerced] = S.validate(value, { coerce: true }); - if (!error) { - return coerced; - } - } - return value; - }, - validator(value, ctx) { - const failures = []; - for (const S of Structs) { - const [...tuples] = run(value, S, ctx); - const [first] = tuples; - if (!first[0]) { - return []; - } - else { - for (const [failure] of tuples) { - if (failure) { - failures.push(failure); - } - } - } - } - return [ - `Expected the value to satisfy a union of \`${description}\`, but received: ${print(value)}`, - ...failures, - ]; - }, - }); -} -/** - * Ensure that any value passes validation, without widening its type to `any`. - */ -function unknown() { - return define('unknown', () => true); -} - -/** - * Augment a `Struct` to add an additional coercion step to its input. - * - * This allows you to transform input data before validating it, to increase the - * likelihood that it passes validation—for example for default values, parsing - * different formats, etc. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ -function coerce(struct, condition, coercer) { - return new Struct({ - ...struct, - coercer: (value, ctx) => { - return is(value, condition) - ? struct.coercer(coercer(value, ctx), ctx) - : struct.coercer(value, ctx); - }, - }); -} -/** - * Augment a struct to replace `undefined` values with a default. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ -function defaulted(struct, fallback, options = {}) { - return coerce(struct, unknown(), (x) => { - const f = typeof fallback === 'function' ? fallback() : fallback; - if (x === undefined) { - return f; - } - if (!options.strict && isPlainObject(x) && isPlainObject(f)) { - const ret = { ...x }; - let changed = false; - for (const key in f) { - if (ret[key] === undefined) { - ret[key] = f[key]; - changed = true; - } - } - if (changed) { - return ret; - } - } - return x; - }); -} -/** - * Augment a struct to trim string inputs. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ -function trimmed(struct) { - return coerce(struct, string(), (x) => x.trim()); -} - -/** - * Ensure that a string, array, map, or set is empty. - */ -function empty(struct) { - return refine(struct, 'empty', (value) => { - const size = getSize(value); - return (size === 0 || - `Expected an empty ${struct.type} but received one with a size of \`${size}\``); - }); -} -function getSize(value) { - if (value instanceof Map || value instanceof Set) { - return value.size; - } - else { - return value.length; - } -} -/** - * Ensure that a number or date is below a threshold. - */ -function max(struct, threshold, options = {}) { - const { exclusive } = options; - return refine(struct, 'max', (value) => { - return exclusive - ? value < threshold - : value <= threshold || - `Expected a ${struct.type} less than ${exclusive ? '' : 'or equal to '}${threshold} but received \`${value}\``; - }); -} -/** - * Ensure that a number or date is above a threshold. - */ -function min(struct, threshold, options = {}) { - const { exclusive } = options; - return refine(struct, 'min', (value) => { - return exclusive - ? value > threshold - : value >= threshold || - `Expected a ${struct.type} greater than ${exclusive ? '' : 'or equal to '}${threshold} but received \`${value}\``; - }); -} -/** - * Ensure that a string, array, map or set is not empty. - */ -function nonempty(struct) { - return refine(struct, 'nonempty', (value) => { - const size = getSize(value); - return (size > 0 || `Expected a nonempty ${struct.type} but received an empty one`); - }); -} -/** - * Ensure that a string matches a regular expression. - */ -function pattern(struct, regexp) { - return refine(struct, 'pattern', (value) => { - return (regexp.test(value) || - `Expected a ${struct.type} matching \`/${regexp.source}/\` but received "${value}"`); - }); -} -/** - * Ensure that a string, array, number, date, map, or set has a size (or length, or time) between `min` and `max`. - */ -function size(struct, min, max = min) { - const expected = `Expected a ${struct.type}`; - const of = min === max ? `of \`${min}\`` : `between \`${min}\` and \`${max}\``; - return refine(struct, 'size', (value) => { - if (typeof value === 'number' || value instanceof Date) { - return ((min <= value && value <= max) || - `${expected} ${of} but received \`${value}\``); - } - else if (value instanceof Map || value instanceof Set) { - const { size } = value; - return ((min <= size && size <= max) || - `${expected} with a size ${of} but received one with a size of \`${size}\``); - } - else { - const { length } = value; - return ((min <= length && length <= max) || - `${expected} with a length ${of} but received one with a length of \`${length}\``); - } - }); -} -/** - * Augment a `Struct` to add an additional refinement to the validation. - * - * The refiner function is guaranteed to receive a value of the struct's type, - * because the struct's existing validation will already have passed. This - * allows you to layer additional validation on top of existing structs. - */ -function refine(struct, name, refiner) { - return new Struct({ - ...struct, - *refiner(value, ctx) { - yield* struct.refiner(value, ctx); - const result = refiner(value, ctx); - const failures = toFailures(result, ctx, struct, value); - for (const failure of failures) { - yield { ...failure, refinement: name }; - } - }, - }); +const cid = CID.asCID(value) +if (cid) { + // Make sure to use cid instead of value + doSomethingWithCID(cid) } +`; +;// ./node_modules/multiformats/esm/src/index.js -//# sourceMappingURL=index.mjs.map + + +;// ./node_modules/multiformats/esm/src/basics.js + + + + + + + + + + + + + + + +const bases = { + ...identity_namespaceObject, + ...base2_namespaceObject, + ...base8_namespaceObject, + ...base10_namespaceObject, + ...base16_namespaceObject, + ...base32_namespaceObject, + ...base36_namespaceObject, + ...base58_namespaceObject, + ...base64_namespaceObject, + ...base256emoji_namespaceObject +}; +const hashes = { + ...sha2_browser_namespaceObject, + ...hashes_identity_namespaceObject +}; +const codecs = { + raw: raw_namespaceObject, + json: json_namespaceObject +}; + +// EXTERNAL MODULE: ./node_modules/uint8arrays/esm/src/alloc.js +var alloc = __webpack_require__(45238); +;// ./node_modules/uint8arrays/esm/src/util/bases.js + + +function createCodec(name, prefix, encode, decode) { + return { + name, + prefix, + encoder: { + name, + prefix, + encode + }, + decoder: { decode } + }; +} +const string = createCodec('utf8', 'u', buf => { + const decoder = new TextDecoder('utf8'); + return 'u' + decoder.decode(buf); +}, str => { + const encoder = new TextEncoder(); + return encoder.encode(str.substring(1)); +}); +const ascii = createCodec('ascii', 'a', buf => { + let string = 'a'; + for (let i = 0; i < buf.length; i++) { + string += String.fromCharCode(buf[i]); + } + return string; +}, str => { + str = str.substring(1); + const buf = (0,alloc/* allocUnsafe */.K)(str.length); + for (let i = 0; i < str.length; i++) { + buf[i] = str.charCodeAt(i); + } + return buf; +}); +const BASES = { + utf8: string, + 'utf-8': string, + hex: bases.base16, + latin1: ascii, + ascii: ascii, + binary: ascii, + ...bases +}; +/* harmony default export */ const util_bases = (BASES); + /***/ }), /***/ 63837: @@ -175614,7 +216903,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"modp1":{"gen":"02","prime":"ffffffff /***/ ((module) => { "use strict"; -module.exports = {"rE":"6.5.5"}; +module.exports = {"rE":"6.5.7"}; /***/ }), @@ -175729,138 +217018,179 @@ var __webpack_exports__ = {}; "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ BatchBlockService: () => (/* reexport safe */ _batch__WEBPACK_IMPORTED_MODULE_4__.B3), -/* harmony export */ BatchEventsService: () => (/* reexport safe */ _batch__WEBPACK_IMPORTED_MODULE_4__.JY), -/* harmony export */ BatchTransactionService: () => (/* reexport safe */ _batch__WEBPACK_IMPORTED_MODULE_4__.AF), -/* harmony export */ Deposit: () => (/* reexport safe */ _deposits__WEBPACK_IMPORTED_MODULE_5__.dA), -/* harmony export */ ENS__factory: () => (/* reexport safe */ _typechain__WEBPACK_IMPORTED_MODULE_3__.p2), -/* harmony export */ ERC20__factory: () => (/* reexport safe */ _typechain__WEBPACK_IMPORTED_MODULE_3__.Xc), -/* harmony export */ GET_DEPOSITS: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.GET_DEPOSITS), -/* harmony export */ GET_ECHO_EVENTS: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.GET_ECHO_EVENTS), -/* harmony export */ GET_ENCRYPTED_NOTES: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.GET_ENCRYPTED_NOTES), -/* harmony export */ GET_GOVERNANCE_APY: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.GET_GOVERNANCE_APY), -/* harmony export */ GET_GOVERNANCE_EVENTS: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.GET_GOVERNANCE_EVENTS), -/* harmony export */ GET_NOTE_ACCOUNTS: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.GET_NOTE_ACCOUNTS), -/* harmony export */ GET_REGISTERED: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.GET_REGISTERED), -/* harmony export */ GET_STATISTIC: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.GET_STATISTIC), -/* harmony export */ GET_WITHDRAWALS: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.GET_WITHDRAWALS), -/* harmony export */ GasPriceOracle__factory: () => (/* reexport safe */ _typechain__WEBPACK_IMPORTED_MODULE_3__.Hu), -/* harmony export */ Invoice: () => (/* reexport safe */ _deposits__WEBPACK_IMPORTED_MODULE_5__.qO), -/* harmony export */ MIN_STAKE_BALANCE: () => (/* reexport safe */ _relayerClient__WEBPACK_IMPORTED_MODULE_15__.pO), -/* harmony export */ MerkleTreeService: () => (/* reexport safe */ _merkleTree__WEBPACK_IMPORTED_MODULE_8__.s), -/* harmony export */ Mimc: () => (/* reexport safe */ _mimc__WEBPACK_IMPORTED_MODULE_9__.p), -/* harmony export */ Multicall__factory: () => (/* reexport safe */ _typechain__WEBPACK_IMPORTED_MODULE_3__.Q2), -/* harmony export */ NetId: () => (/* reexport safe */ _networkConfig__WEBPACK_IMPORTED_MODULE_11__.zr), -/* harmony export */ NoteAccount: () => (/* reexport safe */ _encryptedNotes__WEBPACK_IMPORTED_MODULE_6__.Ad), -/* harmony export */ OffchainOracle__factory: () => (/* reexport safe */ _typechain__WEBPACK_IMPORTED_MODULE_3__.Hk), -/* harmony export */ OvmGasPriceOracle__factory: () => (/* reexport safe */ _typechain__WEBPACK_IMPORTED_MODULE_3__.Ld), -/* harmony export */ Pedersen: () => (/* reexport safe */ _pedersen__WEBPACK_IMPORTED_MODULE_12__.Hr), -/* harmony export */ RelayerClient: () => (/* reexport safe */ _relayerClient__WEBPACK_IMPORTED_MODULE_15__.OR), -/* harmony export */ ReverseRecords__factory: () => (/* reexport safe */ _typechain__WEBPACK_IMPORTED_MODULE_3__.Rp), -/* harmony export */ TokenPriceOracle: () => (/* reexport safe */ _prices__WEBPACK_IMPORTED_MODULE_13__.T), -/* harmony export */ TornadoBrowserProvider: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_14__.D2), +/* harmony export */ BatchBlockService: () => (/* reexport safe */ _batch__WEBPACK_IMPORTED_MODULE_3__.B3), +/* harmony export */ BatchEventsService: () => (/* reexport safe */ _batch__WEBPACK_IMPORTED_MODULE_3__.JY), +/* harmony export */ BatchTransactionService: () => (/* reexport safe */ _batch__WEBPACK_IMPORTED_MODULE_3__.AF), +/* harmony export */ Deposit: () => (/* reexport safe */ _deposits__WEBPACK_IMPORTED_MODULE_4__.dA), +/* harmony export */ ENSNameWrapper__factory: () => (/* reexport safe */ _typechain__WEBPACK_IMPORTED_MODULE_2__.rZ), +/* harmony export */ ENSRegistry__factory: () => (/* reexport safe */ _typechain__WEBPACK_IMPORTED_MODULE_2__.S4), +/* harmony export */ ENSResolver__factory: () => (/* reexport safe */ _typechain__WEBPACK_IMPORTED_MODULE_2__.BB), +/* harmony export */ ENSUtils: () => (/* reexport safe */ _ens__WEBPACK_IMPORTED_MODULE_6__.gH), +/* harmony export */ ENS__factory: () => (/* reexport safe */ _typechain__WEBPACK_IMPORTED_MODULE_2__.p2), +/* harmony export */ ERC20__factory: () => (/* reexport safe */ _typechain__WEBPACK_IMPORTED_MODULE_2__.Xc), +/* harmony export */ EnsContracts: () => (/* reexport safe */ _ens__WEBPACK_IMPORTED_MODULE_6__.A6), +/* harmony export */ INDEX_DB_ERROR: () => (/* reexport safe */ _idb__WEBPACK_IMPORTED_MODULE_10__.Fl), +/* harmony export */ IndexedDB: () => (/* reexport safe */ _idb__WEBPACK_IMPORTED_MODULE_10__.mc), +/* harmony export */ Invoice: () => (/* reexport safe */ _deposits__WEBPACK_IMPORTED_MODULE_4__.qO), +/* harmony export */ MAX_FEE: () => (/* reexport safe */ _relayerClient__WEBPACK_IMPORTED_MODULE_20__.KN), +/* harmony export */ MAX_TOVARISH_EVENTS: () => (/* reexport safe */ _tovarishClient__WEBPACK_IMPORTED_MODULE_22__.o), +/* harmony export */ MIN_FEE: () => (/* reexport safe */ _relayerClient__WEBPACK_IMPORTED_MODULE_20__.Ss), +/* harmony export */ MIN_STAKE_BALANCE: () => (/* reexport safe */ _relayerClient__WEBPACK_IMPORTED_MODULE_20__.pO), +/* harmony export */ MerkleTreeService: () => (/* reexport safe */ _merkleTree__WEBPACK_IMPORTED_MODULE_12__.s), +/* harmony export */ Mimc: () => (/* reexport safe */ _mimc__WEBPACK_IMPORTED_MODULE_13__.p), +/* harmony export */ Multicall__factory: () => (/* reexport safe */ _typechain__WEBPACK_IMPORTED_MODULE_2__.Q2), +/* harmony export */ NetId: () => (/* reexport safe */ _networkConfig__WEBPACK_IMPORTED_MODULE_15__.zr), +/* harmony export */ NoteAccount: () => (/* reexport safe */ _encryptedNotes__WEBPACK_IMPORTED_MODULE_5__.Ad), +/* harmony export */ OffchainOracle__factory: () => (/* reexport safe */ _typechain__WEBPACK_IMPORTED_MODULE_2__.Hk), +/* harmony export */ OvmGasPriceOracle__factory: () => (/* reexport safe */ _typechain__WEBPACK_IMPORTED_MODULE_2__.Ld), +/* harmony export */ Pedersen: () => (/* reexport safe */ _pedersen__WEBPACK_IMPORTED_MODULE_16__.Hr), +/* harmony export */ RelayerClient: () => (/* reexport safe */ _relayerClient__WEBPACK_IMPORTED_MODULE_20__.OR), +/* harmony export */ ReverseRecords__factory: () => (/* reexport safe */ _typechain__WEBPACK_IMPORTED_MODULE_2__.Rp), +/* harmony export */ TokenPriceOracle: () => (/* reexport safe */ _prices__WEBPACK_IMPORTED_MODULE_18__.T), +/* harmony export */ TornadoBrowserProvider: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_19__.D2), /* harmony export */ TornadoFeeOracle: () => (/* reexport safe */ _fees__WEBPACK_IMPORTED_MODULE_7__.o), -/* harmony export */ TornadoRpcSigner: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_14__.Vr), -/* harmony export */ TornadoVoidSigner: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_14__.Gd), -/* harmony export */ TornadoWallet: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_14__.nA), -/* harmony export */ _META: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__._META), -/* harmony export */ addNetwork: () => (/* reexport safe */ _networkConfig__WEBPACK_IMPORTED_MODULE_11__.AE), -/* harmony export */ ajv: () => (/* reexport safe */ _schemas__WEBPACK_IMPORTED_MODULE_2__.SS), -/* harmony export */ base64ToBytes: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_17__.Kp), -/* harmony export */ bigIntReplacer: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_17__.gn), -/* harmony export */ bnToBytes: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_17__.jm), -/* harmony export */ buffPedersenHash: () => (/* reexport safe */ _pedersen__WEBPACK_IMPORTED_MODULE_12__.UB), -/* harmony export */ bufferToBytes: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_17__.lY), -/* harmony export */ bytesToBN: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_17__.Ju), -/* harmony export */ bytesToBase64: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_17__["if"]), -/* harmony export */ bytesToHex: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_17__.My), -/* harmony export */ calculateScore: () => (/* reexport safe */ _relayerClient__WEBPACK_IMPORTED_MODULE_15__.zy), -/* harmony export */ calculateSnarkProof: () => (/* reexport safe */ _websnark__WEBPACK_IMPORTED_MODULE_18__.i), -/* harmony export */ chunk: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_17__.iv), -/* harmony export */ concatBytes: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_17__.Id), +/* harmony export */ TornadoRpcSigner: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_19__.Vr), +/* harmony export */ TornadoVoidSigner: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_19__.Gd), +/* harmony export */ TornadoWallet: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_19__.nA), +/* harmony export */ TovarishClient: () => (/* reexport safe */ _tovarishClient__WEBPACK_IMPORTED_MODULE_22__.E), +/* harmony export */ addNetwork: () => (/* reexport safe */ _networkConfig__WEBPACK_IMPORTED_MODULE_15__.AE), +/* harmony export */ addressSchemaType: () => (/* reexport safe */ _schemas__WEBPACK_IMPORTED_MODULE_1__.SC), +/* harmony export */ ajv: () => (/* reexport safe */ _schemas__WEBPACK_IMPORTED_MODULE_1__.SS), +/* harmony export */ base64ToBytes: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.Kp), +/* harmony export */ bigIntReplacer: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.gn), +/* harmony export */ bnSchemaType: () => (/* reexport safe */ _schemas__WEBPACK_IMPORTED_MODULE_1__.iL), +/* harmony export */ bnToBytes: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.jm), +/* harmony export */ buffPedersenHash: () => (/* reexport safe */ _pedersen__WEBPACK_IMPORTED_MODULE_16__.UB), +/* harmony export */ bufferToBytes: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.lY), +/* harmony export */ bytes32BNSchemaType: () => (/* reexport safe */ _schemas__WEBPACK_IMPORTED_MODULE_1__.i1), +/* harmony export */ bytes32SchemaType: () => (/* reexport safe */ _schemas__WEBPACK_IMPORTED_MODULE_1__.yF), +/* harmony export */ bytesToBN: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.Ju), +/* harmony export */ bytesToBase64: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__["if"]), +/* harmony export */ bytesToHex: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.My), +/* harmony export */ calculateScore: () => (/* reexport safe */ _relayerClient__WEBPACK_IMPORTED_MODULE_20__.zy), +/* harmony export */ calculateSnarkProof: () => (/* reexport safe */ _websnark__WEBPACK_IMPORTED_MODULE_24__.i), +/* harmony export */ chunk: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.iv), +/* harmony export */ concatBytes: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.Id), /* harmony export */ convertETHToTokenAmount: () => (/* reexport safe */ _fees__WEBPACK_IMPORTED_MODULE_7__.N), -/* harmony export */ createDeposit: () => (/* reexport safe */ _deposits__WEBPACK_IMPORTED_MODULE_5__.Hr), -/* harmony export */ crypto: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_17__.Et), -/* harmony export */ customConfig: () => (/* reexport safe */ _networkConfig__WEBPACK_IMPORTED_MODULE_11__.cX), -/* harmony export */ defaultConfig: () => (/* reexport safe */ _networkConfig__WEBPACK_IMPORTED_MODULE_11__.sb), -/* harmony export */ defaultUserAgent: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_14__.mJ), -/* harmony export */ enabledChains: () => (/* reexport safe */ _networkConfig__WEBPACK_IMPORTED_MODULE_11__.Af), -/* harmony export */ factories: () => (/* reexport safe */ _typechain__WEBPACK_IMPORTED_MODULE_3__.XB), -/* harmony export */ fetch: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_14__.hd), -/* harmony export */ fetchData: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_14__.Fd), -/* harmony export */ fetchGetUrlFunc: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_14__.uY), -/* harmony export */ getAllDeposits: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.getAllDeposits), -/* harmony export */ getAllEncryptedNotes: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.getAllEncryptedNotes), -/* harmony export */ getAllGovernanceEvents: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.getAllGovernanceEvents), -/* harmony export */ getAllGraphEchoEvents: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.getAllGraphEchoEvents), -/* harmony export */ getAllRegisters: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.getAllRegisters), -/* harmony export */ getAllWithdrawals: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.getAllWithdrawals), -/* harmony export */ getConfig: () => (/* reexport safe */ _networkConfig__WEBPACK_IMPORTED_MODULE_11__.zj), -/* harmony export */ getDeposits: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.getDeposits), -/* harmony export */ getEncryptedNotes: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.getEncryptedNotes), -/* harmony export */ getGasOraclePlugin: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_14__.bD), -/* harmony export */ getGovernanceEvents: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.getGovernanceEvents), -/* harmony export */ getGraphEchoEvents: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.getGraphEchoEvents), -/* harmony export */ getHttpAgent: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_14__.WU), -/* harmony export */ getInstanceByAddress: () => (/* reexport safe */ _networkConfig__WEBPACK_IMPORTED_MODULE_11__.Zh), -/* harmony export */ getMeta: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.getMeta), -/* harmony export */ getNetworkConfig: () => (/* reexport safe */ _networkConfig__WEBPACK_IMPORTED_MODULE_11__.RY), -/* harmony export */ getNoteAccounts: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.getNoteAccounts), -/* harmony export */ getProvider: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_14__.sO), -/* harmony export */ getProviderWithNetId: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_14__.MF), -/* harmony export */ getRegisters: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.getRegisters), -/* harmony export */ getStatistic: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.getStatistic), -/* harmony export */ getStatusSchema: () => (/* reexport safe */ _schemas__WEBPACK_IMPORTED_MODULE_2__.c_), -/* harmony export */ getSubdomains: () => (/* reexport safe */ _networkConfig__WEBPACK_IMPORTED_MODULE_11__.cF), -/* harmony export */ getSupportedInstances: () => (/* reexport safe */ _relayerClient__WEBPACK_IMPORTED_MODULE_15__.XF), -/* harmony export */ getTokenBalances: () => (/* reexport safe */ _tokens__WEBPACK_IMPORTED_MODULE_16__.H), -/* harmony export */ getWeightRandom: () => (/* reexport safe */ _relayerClient__WEBPACK_IMPORTED_MODULE_15__.c$), -/* harmony export */ getWithdrawals: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.getWithdrawals), -/* harmony export */ hexToBytes: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_17__.aT), -/* harmony export */ initGroth16: () => (/* reexport safe */ _websnark__WEBPACK_IMPORTED_MODULE_18__.O), -/* harmony export */ isNode: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_17__.Ll), -/* harmony export */ isRelayerUpdated: () => (/* reexport safe */ _relayerClient__WEBPACK_IMPORTED_MODULE_15__.mU), -/* harmony export */ jobsSchema: () => (/* reexport safe */ _schemas__WEBPACK_IMPORTED_MODULE_2__.Us), -/* harmony export */ leBuff2Int: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_17__.ae), -/* harmony export */ leInt2Buff: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_17__.EI), -/* harmony export */ mimc: () => (/* reexport safe */ _mimc__WEBPACK_IMPORTED_MODULE_9__.f), -/* harmony export */ multicall: () => (/* reexport safe */ _multicall__WEBPACK_IMPORTED_MODULE_10__.C), -/* harmony export */ packEncryptedMessage: () => (/* reexport safe */ _encryptedNotes__WEBPACK_IMPORTED_MODULE_6__.Fr), -/* harmony export */ parseSemanticVersion: () => (/* reexport safe */ _relayerClient__WEBPACK_IMPORTED_MODULE_15__.qo), -/* harmony export */ pedersen: () => (/* reexport safe */ _pedersen__WEBPACK_IMPORTED_MODULE_12__.NO), -/* harmony export */ pickWeightedRandomRelayer: () => (/* reexport safe */ _relayerClient__WEBPACK_IMPORTED_MODULE_15__.sN), -/* harmony export */ populateTransaction: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_14__.zr), -/* harmony export */ queryGraph: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_1__.queryGraph), -/* harmony export */ rBigInt: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_17__.ib), -/* harmony export */ sleep: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_17__.yy), -/* harmony export */ substring: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_17__.uU), -/* harmony export */ toFixedHex: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_17__.$W), -/* harmony export */ toFixedLength: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_17__.sY), -/* harmony export */ unpackEncryptedMessage: () => (/* reexport safe */ _encryptedNotes__WEBPACK_IMPORTED_MODULE_6__.ol), -/* harmony export */ validateUrl: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_17__.wv) +/* harmony export */ createDeposit: () => (/* reexport safe */ _deposits__WEBPACK_IMPORTED_MODULE_4__.Hr), +/* harmony export */ crypto: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.Et), +/* harmony export */ customConfig: () => (/* reexport safe */ _networkConfig__WEBPACK_IMPORTED_MODULE_15__.cX), +/* harmony export */ defaultConfig: () => (/* reexport safe */ _networkConfig__WEBPACK_IMPORTED_MODULE_15__.sb), +/* harmony export */ defaultUserAgent: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_19__.mJ), +/* harmony export */ deployHasher: () => (/* reexport safe */ _hasher__WEBPACK_IMPORTED_MODULE_9__.l), +/* harmony export */ depositsEventsSchema: () => (/* reexport safe */ _schemas__WEBPACK_IMPORTED_MODULE_1__.CI), +/* harmony export */ digest: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.br), +/* harmony export */ downloadZip: () => (/* reexport safe */ _zip__WEBPACK_IMPORTED_MODULE_25__._6), +/* harmony export */ echoEventsSchema: () => (/* reexport safe */ _schemas__WEBPACK_IMPORTED_MODULE_1__.ME), +/* harmony export */ enabledChains: () => (/* reexport safe */ _networkConfig__WEBPACK_IMPORTED_MODULE_15__.Af), +/* harmony export */ encodedLabelToLabelhash: () => (/* reexport safe */ _ens__WEBPACK_IMPORTED_MODULE_6__.qX), +/* harmony export */ encryptedNotesSchema: () => (/* reexport safe */ _schemas__WEBPACK_IMPORTED_MODULE_1__.XW), +/* harmony export */ factories: () => (/* reexport safe */ _typechain__WEBPACK_IMPORTED_MODULE_2__.XB), +/* harmony export */ fetchData: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_19__.Fd), +/* harmony export */ fetchGetUrlFunc: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_19__.uY), +/* harmony export */ fetchIp: () => (/* reexport safe */ _ip__WEBPACK_IMPORTED_MODULE_11__.W), +/* harmony export */ fromContentHash: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.yp), +/* harmony export */ gasZipID: () => (/* reexport safe */ _gaszip__WEBPACK_IMPORTED_MODULE_8__.Qx), +/* harmony export */ gasZipInbounds: () => (/* reexport safe */ _gaszip__WEBPACK_IMPORTED_MODULE_8__.dT), +/* harmony export */ gasZipInput: () => (/* reexport safe */ _gaszip__WEBPACK_IMPORTED_MODULE_8__.x5), +/* harmony export */ gasZipMinMax: () => (/* reexport safe */ _gaszip__WEBPACK_IMPORTED_MODULE_8__.X), +/* harmony export */ getActiveTokenInstances: () => (/* reexport safe */ _networkConfig__WEBPACK_IMPORTED_MODULE_15__.oY), +/* harmony export */ getActiveTokens: () => (/* reexport safe */ _networkConfig__WEBPACK_IMPORTED_MODULE_15__.h9), +/* harmony export */ getConfig: () => (/* reexport safe */ _networkConfig__WEBPACK_IMPORTED_MODULE_15__.zj), +/* harmony export */ getEventsSchemaValidator: () => (/* reexport safe */ _schemas__WEBPACK_IMPORTED_MODULE_1__.ZC), +/* harmony export */ getHttpAgent: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_19__.WU), +/* harmony export */ getIndexedDB: () => (/* reexport safe */ _idb__WEBPACK_IMPORTED_MODULE_10__.W7), +/* harmony export */ getInstanceByAddress: () => (/* reexport safe */ _networkConfig__WEBPACK_IMPORTED_MODULE_15__.Zh), +/* harmony export */ getMultiInstances: () => (/* reexport safe */ _networkConfig__WEBPACK_IMPORTED_MODULE_15__.sX), +/* harmony export */ getNetworkConfig: () => (/* reexport safe */ _networkConfig__WEBPACK_IMPORTED_MODULE_15__.RY), +/* harmony export */ getPermit2CommitmentsSignature: () => (/* reexport safe */ _permit__WEBPACK_IMPORTED_MODULE_17__.Sl), +/* harmony export */ getPermit2Signature: () => (/* reexport safe */ _permit__WEBPACK_IMPORTED_MODULE_17__.KM), +/* harmony export */ getPermitCommitmentsSignature: () => (/* reexport safe */ _permit__WEBPACK_IMPORTED_MODULE_17__.sx), +/* harmony export */ getPermitSignature: () => (/* reexport safe */ _permit__WEBPACK_IMPORTED_MODULE_17__.id), +/* harmony export */ getProvider: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_19__.sO), +/* harmony export */ getProviderWithNetId: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_19__.MF), +/* harmony export */ getRelayerEnsSubdomains: () => (/* reexport safe */ _networkConfig__WEBPACK_IMPORTED_MODULE_15__.o2), +/* harmony export */ getStatusSchema: () => (/* reexport safe */ _schemas__WEBPACK_IMPORTED_MODULE_1__.c_), +/* harmony export */ getSubInfo: () => (/* reexport safe */ _batch__WEBPACK_IMPORTED_MODULE_3__.vS), +/* harmony export */ getSupportedInstances: () => (/* reexport safe */ _relayerClient__WEBPACK_IMPORTED_MODULE_20__.XF), +/* harmony export */ getTokenBalances: () => (/* reexport safe */ _tokens__WEBPACK_IMPORTED_MODULE_21__.H), +/* harmony export */ getWeightRandom: () => (/* reexport safe */ _relayerClient__WEBPACK_IMPORTED_MODULE_20__.c$), +/* harmony export */ governanceEventsSchema: () => (/* reexport safe */ _schemas__WEBPACK_IMPORTED_MODULE_1__.FR), +/* harmony export */ hasherBytecode: () => (/* reexport safe */ _hasher__WEBPACK_IMPORTED_MODULE_9__.B), +/* harmony export */ hexToBytes: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.aT), +/* harmony export */ initGroth16: () => (/* reexport safe */ _websnark__WEBPACK_IMPORTED_MODULE_24__.O), +/* harmony export */ isHex: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.qv), +/* harmony export */ isNode: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.Ll), +/* harmony export */ jobRequestSchema: () => (/* reexport safe */ _schemas__WEBPACK_IMPORTED_MODULE_1__.Yq), +/* harmony export */ jobsSchema: () => (/* reexport safe */ _schemas__WEBPACK_IMPORTED_MODULE_1__.Us), +/* harmony export */ labelhash: () => (/* reexport safe */ _ens__WEBPACK_IMPORTED_MODULE_6__.Lr), +/* harmony export */ leBuff2Int: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.ae), +/* harmony export */ leInt2Buff: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.EI), +/* harmony export */ makeLabelNodeAndParent: () => (/* reexport safe */ _ens__WEBPACK_IMPORTED_MODULE_6__.QP), +/* harmony export */ mimc: () => (/* reexport safe */ _mimc__WEBPACK_IMPORTED_MODULE_13__.f), +/* harmony export */ multiQueryFilter: () => (/* reexport safe */ _batch__WEBPACK_IMPORTED_MODULE_3__.QL), +/* harmony export */ multicall: () => (/* reexport safe */ _multicall__WEBPACK_IMPORTED_MODULE_14__.C), +/* harmony export */ numberFormatter: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.Eg), +/* harmony export */ packEncryptedMessage: () => (/* reexport safe */ _encryptedNotes__WEBPACK_IMPORTED_MODULE_5__.Fr), +/* harmony export */ parseInvoice: () => (/* reexport safe */ _deposits__WEBPACK_IMPORTED_MODULE_4__.Ps), +/* harmony export */ parseNote: () => (/* reexport safe */ _deposits__WEBPACK_IMPORTED_MODULE_4__.wd), +/* harmony export */ pedersen: () => (/* reexport safe */ _pedersen__WEBPACK_IMPORTED_MODULE_16__.NO), +/* harmony export */ permit2Address: () => (/* reexport safe */ _permit__WEBPACK_IMPORTED_MODULE_17__.CS), +/* harmony export */ pickWeightedRandomRelayer: () => (/* reexport safe */ _relayerClient__WEBPACK_IMPORTED_MODULE_20__.sN), +/* harmony export */ populateTransaction: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_19__.zr), +/* harmony export */ proofSchemaType: () => (/* reexport safe */ _schemas__WEBPACK_IMPORTED_MODULE_1__.Y6), +/* harmony export */ rBigInt: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.ib), +/* harmony export */ rHex: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.G9), +/* harmony export */ relayerRegistryEventsSchema: () => (/* reexport safe */ _schemas__WEBPACK_IMPORTED_MODULE_1__.cl), +/* harmony export */ sleep: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.yy), +/* harmony export */ stakeBurnedEventsSchema: () => (/* reexport safe */ _schemas__WEBPACK_IMPORTED_MODULE_1__.Fz), +/* harmony export */ substring: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.uU), +/* harmony export */ toContentHash: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.vd), +/* harmony export */ toFixedHex: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.$W), +/* harmony export */ toFixedLength: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.sY), +/* harmony export */ tornadoEventsSchema: () => (/* reexport safe */ _schemas__WEBPACK_IMPORTED_MODULE_1__.U7), +/* harmony export */ unpackEncryptedMessage: () => (/* reexport safe */ _encryptedNotes__WEBPACK_IMPORTED_MODULE_5__.ol), +/* harmony export */ unzipAsync: () => (/* reexport safe */ _zip__WEBPACK_IMPORTED_MODULE_25__.fY), +/* harmony export */ validateUrl: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_23__.wv), +/* harmony export */ withdrawalsEventsSchema: () => (/* reexport safe */ _schemas__WEBPACK_IMPORTED_MODULE_1__.$j), +/* harmony export */ zipAsync: () => (/* reexport safe */ _zip__WEBPACK_IMPORTED_MODULE_25__.a8) /* harmony export */ }); /* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(94513); /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; /* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _events__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _events__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); -/* harmony import */ var _graphql__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(52049); -/* harmony import */ var _schemas__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7613); -/* harmony import */ var _typechain__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(67276); -/* harmony import */ var _batch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9723); -/* harmony import */ var _deposits__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7240); -/* harmony import */ var _encryptedNotes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(33298); +/* harmony import */ var _schemas__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(59511); +/* harmony import */ var _typechain__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(62463); +/* harmony import */ var _batch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9723); +/* harmony import */ var _deposits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7240); +/* harmony import */ var _encryptedNotes__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(33298); +/* harmony import */ var _ens__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(16795); /* harmony import */ var _fees__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(37182); -/* harmony import */ var _merkleTree__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(5217); -/* harmony import */ var _mimc__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(22901); -/* harmony import */ var _multicall__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(48486); -/* harmony import */ var _networkConfig__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(59499); -/* harmony import */ var _pedersen__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(85111); -/* harmony import */ var _prices__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(34525); -/* harmony import */ var _providers__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(68434); -/* harmony import */ var _relayerClient__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(57194); -/* harmony import */ var _tokens__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(7393); -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(67418); -/* harmony import */ var _websnark__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(26746); +/* harmony import */ var _gaszip__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(56079); +/* harmony import */ var _hasher__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(49540); +/* harmony import */ var _idb__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(83968); +/* harmony import */ var _ip__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(57390); +/* harmony import */ var _merkleTree__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(5217); +/* harmony import */ var _mimc__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(22901); +/* harmony import */ var _multicall__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(48486); +/* harmony import */ var _networkConfig__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(59499); +/* harmony import */ var _pedersen__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(85111); +/* harmony import */ var _permit__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(1180); +/* harmony import */ var _prices__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(34525); +/* harmony import */ var _providers__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(46170); +/* harmony import */ var _relayerClient__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(57194); +/* harmony import */ var _tokens__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(7393); +/* harmony import */ var _tovarishClient__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(96838); +/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(67418); +/* harmony import */ var _websnark__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(26746); +/* harmony import */ var _zip__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(18995); + + + + + + + diff --git a/dist/tornado.umd.min.js b/dist/tornado.umd.min.js new file mode 100644 index 0000000..902c443 --- /dev/null +++ b/dist/tornado.umd.min.js @@ -0,0 +1,8 @@ +/*! For license information please see tornado.umd.min.js.LICENSE.txt */ +!function(e,a){"object"==typeof exports&&"object"==typeof module?module.exports=a():"function"==typeof define&&define.amd?define([],a):"object"==typeof exports?exports.Tornado=a():e.Tornado=a()}(self,(()=>(()=>{var __webpack_modules__={15795:(e,a,t)=>{const c=t(26613);a.cidForWeb=e=>{let a=new c(e);0===a.version&&(a=a.toV1());let t=a.toString("base32");if(t.length>63){const e=a.toString("base36");if(e.length<=63)return e;throw new TypeError("CID is longer than DNS limit of 63 characters and is not compatible with public gateways")}return t},a.cidV0ToV1Base32=e=>{let a=new c(e);return 0===a.version&&(a=a.toV1()),a.toString("base32")}},81810:(e,a,t)=>{const c=t(52021),f=t(14243),{hexStringToBuffer:d,profiles:r}=t(55262),{cidForWeb:n,cidV0ToV1Base32:i}=t(15795);e.exports={helpers:{cidForWeb:n,cidV0ToV1Base32:i},decode:function(e){const a=d(e),t=c.getCodec(a),f=c.rmPrefix(a);let n=r[t];return n||(n=r.default),n.decode(f)},fromIpfs:function(e){return this.encode("ipfs-ns",e)},fromSkylink:function(e){return this.encode("skynet-ns",e)},fromSwarm:function(e){return this.encode("swarm-ns",e)},fromArweave:function(e){return this.encode("arweave-ns",e)},encode:function(e,a){let t=r[e];t||(t=r.default);const d=t.encode(a);return f.toHexString(c.addPrefix(e,d))},getCodec:function(e){let a=d(e);return c.getCodec(a)}}},55262:(e,a,t)=>{var c=t(62045).hp;const f=t(26613),d=t(14243),r=t(8127),n=e=>{let a=e.slice(0,2),t=e.slice(2),c="";return c="0x"===a?t:e,d.fromHexString(c)},i=e=>{try{const{multihash:a}=e;if(a.length<38){const e=d.decode(a);if("identity"===e.name&&e.length<36)return!1}return!0}catch(e){return!1}},b={skynet:e=>r.toUint8Array(e),swarm:e=>{const a=d.encode(n(e),"keccak-256");return new f(1,"swarm-manifest",a).bytes},ipfs:e=>new f(e).toV1().bytes,ipns:e=>{const a=new f(e);if(!i(a))throw Error("ipns-ns allows only valid cryptographic libp2p-key identifiers, try using ED25519 pubkey instead");return new f(1,"libp2p-key",a.multihash).bytes},utf8:e=>c.from(e,"utf8"),arweave:e=>r.toUint8Array(e)},o={hexMultiHash:e=>{const a=new f(e);return d.decode(a.multihash).digest.toString("hex")},ipfs:e=>{const a=new f(e).toV1();return a.toString("libp2p-key"===a.codec?"base36":"base32")},ipns:e=>{const a=new f(e).toV1();return i(a)?a.toString("base36"):(console.warn("[ensdomains/content-hash] use of non-cryptographic identifiers in ipns-ns is deprecated and will be removed, migrate to ED25519 libp2p-key"),String(d.decode(new f(e).multihash).digest))},utf8:e=>e.toString("utf8"),base64:e=>r.fromUint8Array(e,!0)},s={"skynet-ns":{encode:b.skynet,decode:o.base64},"swarm-ns":{encode:b.swarm,decode:o.hexMultiHash},"ipfs-ns":{encode:b.ipfs,decode:o.ipfs},"ipns-ns":{encode:b.ipns,decode:o.ipns},"arweave-ns":{encode:b.arweave,decode:o.base64},default:{encode:b.utf8,decode:o.utf8}};a.hexStringToBuffer=n,a.profiles=s},66289:(e,a)=>{"use strict";function t(e){if(Array.isArray(e)){const a=[];let c=0;for(let f=0;fe.length)throw new Error("invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds");return e.slice(a,t)}function f(e){if(0===e[0])throw new Error("invalid RLP: extra zeros");return o(b(e))}function d(e,a){if(e<56)return Uint8Array.from([e+a]);const t=h(e),c=h(a+55+t.length/2);return Uint8Array.from(s(c+t))}function r(e,a=!1){if(null==e||0===e.length)return Uint8Array.from([]);const t=n(g(e));if(a)return t;if(0!==t.remainder.length)throw new Error("invalid RLP: remainder must be zero");return t.data}function n(e){let a,t,d,r,i;const b=[],o=e[0];if(o<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(o<=183){if(a=o-127,d=128===o?Uint8Array.from([]):c(e,1,a),2===a&&d[0]<128)throw new Error("invalid RLP encoding: invalid prefix, single byte < 0x80 are not prefixed");return{data:d,remainder:e.slice(a)}}if(o<=191){if(t=o-182,e.length-1e.length)throw new Error("invalid RLP: total length is larger than the data");for(r=c(e,t,d);r.length;)i=n(r),b.push(i.data),r=i.remainder;return{data:b,remainder:e.slice(d)}}}Object.defineProperty(a,"__esModule",{value:!0}),a.RLP=a.utils=a.decode=a.encode=void 0,a.encode=t,a.decode=r;const i=Array.from({length:256},((e,a)=>a.toString(16).padStart(2,"0")));function b(e){let a="";for(let t=0;te+a.length),0),t=new Uint8Array(a);for(let a=0,c=0;a=2&&"0"===e[0]&&"x"===e[1]}function g(e){if(e instanceof Uint8Array)return e;if("string"==typeof e)return p(e)?s((a="string"!=typeof(t=e)?t:p(t)?t.slice(2):t).length%2?`0${a}`:a):u(e);var a,t;if("number"==typeof e||"bigint"==typeof e)return e?s(h(e)):Uint8Array.from([]);if(null==e)return Uint8Array.from([]);throw new Error("toBytes: received unsupported type "+typeof e)}a.utils={bytesToHex:b,concatBytes:l,hexToBytes:s,utf8ToBytes:u},a.RLP={encode:t,decode:r}},16284:(e,a,t)=>{"use strict";var c=t(62045).hp;Object.defineProperty(a,"__esModule",{value:!0}),a.accountBodyToRLP=a.accountBodyToSlim=a.accountBodyFromSlim=a.isZeroAddress=a.zeroAddress=a.importPublic=a.privateToAddress=a.privateToPublic=a.publicToAddress=a.pubToAddress=a.isValidPublic=a.isValidPrivate=a.generateAddress2=a.generateAddress=a.isValidChecksumAddress=a.toChecksumAddress=a.isValidAddress=a.Account=void 0;const f=t(66289),d=t(32019),r=t(26513),n=t(82672),i=t(77312),b=t(89838),o=t(35546),s=t(59498),l=BigInt(0);class u{constructor(e=l,a=l,t=b.KECCAK256_RLP,c=b.KECCAK256_NULL){this.nonce=e,this.balance=a,this.storageRoot=t,this.codeHash=c,this._validate()}static fromAccountData(e){const{nonce:a,balance:t,storageRoot:c,codeHash:f}=e;return new u(void 0!==a?(0,i.bufferToBigInt)((0,i.toBuffer)(a)):void 0,void 0!==t?(0,i.bufferToBigInt)((0,i.toBuffer)(t)):void 0,void 0!==c?(0,i.toBuffer)(c):void 0,void 0!==f?(0,i.toBuffer)(f):void 0)}static fromRlpSerializedAccount(e){const a=(0,i.arrToBufArr)(f.RLP.decode(Uint8Array.from(e)));if(!Array.isArray(a))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(a)}static fromValuesArray(e){const[a,t,c,f]=e;return new u((0,i.bufferToBigInt)(a),(0,i.bufferToBigInt)(t),c,f)}_validate(){if(this.nonce=8?l+=t[e].toUpperCase():l+=t[e];return l},a.isValidChecksumAddress=function(e,t){return(0,a.isValidAddress)(e)&&(0,a.toChecksumAddress)(e,t)===e},a.generateAddress=function(e,a){return(0,o.assertIsBuffer)(e),(0,o.assertIsBuffer)(a),(0,i.bufferToBigInt)(a)===BigInt(0)?c.from((0,d.keccak256)(f.RLP.encode((0,i.bufArrToArr)([e,null])))).slice(-20):c.from((0,d.keccak256)(f.RLP.encode((0,i.bufArrToArr)([e,a])))).slice(-20)},a.generateAddress2=function(e,a,t){if((0,o.assertIsBuffer)(e),(0,o.assertIsBuffer)(a),(0,o.assertIsBuffer)(t),20!==e.length)throw new Error("Expected from to be of length 20");if(32!==a.length)throw new Error("Expected salt to be of length 32");const f=(0,d.keccak256)(c.concat([c.from("ff","hex"),e,a,(0,d.keccak256)(t)]));return(0,i.toBuffer)(f).slice(-20)},a.isValidPrivate=function(e){return r.secp256k1.utils.isValidPrivateKey(e)},a.isValidPublic=function(e,a=!1){if((0,o.assertIsBuffer)(e),64===e.length)try{return r.secp256k1.ProjectivePoint.fromHex(c.concat([c.from([4]),e])),!0}catch(e){return!1}if(!a)return!1;try{return r.secp256k1.ProjectivePoint.fromHex(e),!0}catch(e){return!1}},a.pubToAddress=function(e,a=!1){if((0,o.assertIsBuffer)(e),a&&64!==e.length&&(e=c.from(r.secp256k1.ProjectivePoint.fromHex(e).toRawBytes(!1).slice(1))),64!==e.length)throw new Error("Expected pubKey to be of length 64");return c.from((0,d.keccak256)(e)).slice(-20)},a.publicToAddress=a.pubToAddress,a.privateToPublic=function(e){return(0,o.assertIsBuffer)(e),c.from(r.secp256k1.ProjectivePoint.fromPrivateKey(e).toRawBytes(!1).slice(1))},a.privateToAddress=function(e){return(0,a.publicToAddress)((0,a.privateToPublic)(e))},a.importPublic=function(e){return(0,o.assertIsBuffer)(e),64!==e.length&&(e=c.from(r.secp256k1.ProjectivePoint.fromHex(e).toRawBytes(!1).slice(1))),e},a.zeroAddress=function(){const e=(0,i.zeros)(20);return(0,i.bufferToHex)(e)},a.isZeroAddress=function(e){try{(0,o.assertIsString)(e)}catch(e){return!1}return(0,a.zeroAddress)()===e},a.accountBodyFromSlim=h;const p=new Uint8Array(0);a.accountBodyToSlim=function(e){const[a,t,c,f]=e;return[a,t,(0,i.arrToBufArr)(c).equals(b.KECCAK256_RLP)?p:c,(0,i.arrToBufArr)(f).equals(b.KECCAK256_NULL)?p:f]},a.accountBodyToRLP=function(e,a=!0){const t=a?h(e):e;return(0,i.arrToBufArr)(f.RLP.encode(t))}},86727:(e,a,t)=>{"use strict";var c=t(62045).hp;Object.defineProperty(a,"__esModule",{value:!0}),a.Address=void 0;const f=t(16284),d=t(77312);class r{constructor(e){if(20!==e.length)throw new Error("Invalid address length");this.buf=e}static zero(){return new r((0,d.zeros)(20))}static fromString(e){if(!(0,f.isValidAddress)(e))throw new Error("Invalid address");return new r((0,d.toBuffer)(e))}static fromPublicKey(e){if(!c.isBuffer(e))throw new Error("Public key should be Buffer");const a=(0,f.pubToAddress)(e);return new r(a)}static fromPrivateKey(e){if(!c.isBuffer(e))throw new Error("Private key should be Buffer");const a=(0,f.privateToAddress)(e);return new r(a)}static generate(e,a){if("bigint"!=typeof a)throw new Error("Expected nonce to be a bigint");return new r((0,f.generateAddress)(e.buf,(0,d.bigIntToBuffer)(a)))}static generate2(e,a,t){if(!c.isBuffer(a))throw new Error("Expected salt to be a Buffer");if(!c.isBuffer(t))throw new Error("Expected initCode to be a Buffer");return new r((0,f.generateAddress2)(e.buf,a,t))}equals(e){return this.buf.equals(e.buf)}isZero(){return this.equals(r.zero())}isPrecompileOrSystemAddress(){const e=(0,d.bufferToBigInt)(this.buf),a=BigInt(0),t=BigInt("0xffff");return e>=a&&e<=t}toString(){return"0x"+this.buf.toString("hex")}toBuffer(){return c.from(this.buf)}}a.Address=r},98421:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.AsyncEventEmitter=void 0;const c=t(37007);class f extends c.EventEmitter{emit(e,...a){let[t,c]=a;const f=this;let d=f._events[e]??[];return void 0===c&&"function"==typeof t&&(c=t,t=void 0),"newListener"!==e&&"removeListener"!==e||(t={event:t,fn:c},c=void 0),d=Array.isArray(d)?d:[d],async function(e,a,t){let c;for await(const f of a)try{f.length<2?f.call(e,t):await new Promise(((a,c)=>{f.call(e,t,(e=>{e?c(e):a()}))}))}catch(e){c=e}if(c)throw c}(f,d.slice(),t).then(c).catch(c),f.listenerCount(e)>0}once(e,a){const t=this;let c;if("function"!=typeof a)throw new TypeError("listener must be a function");return c=a.length>=2?function(f,d){t.removeListener(e,c),a(f,d)}:function(f){t.removeListener(e,c),a(f,c)},t.on(e,c),t}first(e,a){let t=this._events[e]??[];if("function"!=typeof a)throw new TypeError("listener must be a function");return Array.isArray(t)||(this._events[e]=t=[t]),t.unshift(a),this}before(e,a,t){return this.beforeOrAfter(e,a,t)}after(e,a,t){return this.beforeOrAfter(e,a,t,"after")}beforeOrAfter(e,a,t,c){let f,d,r=this._events[e]??[];const n="after"===c?1:0;if("function"!=typeof t)throw new TypeError("listener must be a function");if("function"!=typeof a)throw new TypeError("target must be a function");for(Array.isArray(r)||(this._events[e]=r=[r]),d=r.length,f=r.length;f--;)if(r[f]===a){d=f+n;break}return r.splice(d,0,t),this}on(e,a){return super.on(e,a)}addListener(e,a){return super.addListener(e,a)}prependListener(e,a){return super.prependListener(e,a)}prependOnceListener(e,a){return super.prependOnceListener(e,a)}removeAllListeners(e){return super.removeAllListeners(e)}removeListener(e,a){return super.removeListener(e,a)}eventNames(){return super.eventNames()}listeners(e){return super.listeners(e)}listenerCount(e){return super.listenerCount(e)}getMaxListeners(){return super.getMaxListeners()}setMaxListeners(e){return super.setMaxListeners(e)}}a.AsyncEventEmitter=f},77312:(e,a,t)=>{"use strict";var c=t(62045).hp;Object.defineProperty(a,"__esModule",{value:!0}),a.intToUnpaddedBuffer=a.bigIntToUnpaddedBuffer=a.bigIntToHex=a.bufArrToArr=a.arrToBufArr=a.validateNoLeadingZeroes=a.baToJSON=a.toUtf8=a.short=a.addHexPrefix=a.toUnsigned=a.fromSigned=a.bufferToInt=a.bigIntToBuffer=a.bufferToBigInt=a.bufferToHex=a.toBuffer=a.unpadHexString=a.unpadArray=a.unpadBuffer=a.setLengthRight=a.setLengthLeft=a.zeros=a.intToBuffer=a.intToHex=void 0;const f=t(35546),d=t(59498);a.intToHex=function(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Received an invalid integer type: ${e}`);return`0x${e.toString(16)}`},a.intToBuffer=function(e){const t=(0,a.intToHex)(e);return c.from((0,d.padToEven)(t.slice(2)),"hex")},a.zeros=function(e){return c.allocUnsafe(e).fill(0)};const r=function(e,t,c){const f=(0,a.zeros)(t);return c?e.length0&&"0"===a.toString();)a=(e=e.slice(1))[0];return e};function i(e){const t=(0,a.bufferToHex)(e);return"0x"===t?BigInt(0):BigInt(t)}function b(e){return(0,a.toBuffer)("0x"+e.toString(16))}a.unpadBuffer=function(e){return(0,f.assertIsBuffer)(e),n(e)},a.unpadArray=function(e){return(0,f.assertIsArray)(e),n(e)},a.unpadHexString=function(e){return(0,f.assertIsHexString)(e),e=(0,d.stripHexPrefix)(e),"0x"+n(e)},a.toBuffer=function(e){if(null==e)return c.allocUnsafe(0);if(c.isBuffer(e))return c.from(e);if(Array.isArray(e)||e instanceof Uint8Array)return c.from(e);if("string"==typeof e){if(!(0,d.isHexString)(e))throw new Error(`Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ${e}`);return c.from((0,d.padToEven)((0,d.stripHexPrefix)(e)),"hex")}if("number"==typeof e)return(0,a.intToBuffer)(e);if("bigint"==typeof e){if(e0&&0===t[0])throw new Error(`${a} cannot have leading zeroes, received: ${t.toString("hex")}`)},a.arrToBufArr=function e(a){return Array.isArray(a)?a.map((a=>e(a))):c.from(a)},a.bufArrToArr=function e(a){return Array.isArray(a)?a.map((a=>e(a))):Uint8Array.from(a??[])},a.bigIntToHex=e=>"0x"+e.toString(16),a.bigIntToUnpaddedBuffer=function(e){return(0,a.unpadBuffer)(b(e))},a.intToUnpaddedBuffer=function(e){return(0,a.unpadBuffer)((0,a.intToBuffer)(e))}},89838:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.MAX_WITHDRAWALS_PER_PAYLOAD=a.RLP_EMPTY_STRING=a.KECCAK256_RLP=a.KECCAK256_RLP_S=a.KECCAK256_RLP_ARRAY=a.KECCAK256_RLP_ARRAY_S=a.KECCAK256_NULL=a.KECCAK256_NULL_S=a.TWO_POW256=a.SECP256K1_ORDER_DIV_2=a.SECP256K1_ORDER=a.MAX_INTEGER_BIGINT=a.MAX_INTEGER=a.MAX_UINT64=void 0;const c=t(48287),f=t(26513);a.MAX_UINT64=BigInt("0xffffffffffffffff"),a.MAX_INTEGER=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),a.MAX_INTEGER_BIGINT=BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"),a.SECP256K1_ORDER=f.secp256k1.CURVE.n,a.SECP256K1_ORDER_DIV_2=f.secp256k1.CURVE.n/BigInt(2),a.TWO_POW256=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),a.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",a.KECCAK256_NULL=c.Buffer.from(a.KECCAK256_NULL_S,"hex"),a.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",a.KECCAK256_RLP_ARRAY=c.Buffer.from(a.KECCAK256_RLP_ARRAY_S,"hex"),a.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",a.KECCAK256_RLP=c.Buffer.from(a.KECCAK256_RLP_S,"hex"),a.RLP_EMPTY_STRING=c.Buffer.from([128]),a.MAX_WITHDRAWALS_PER_PAYLOAD=16},45062:(e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.compactBytesToNibbles=a.bytesToNibbles=a.nibblesToCompactBytes=a.nibblesToBytes=a.hasTerminator=void 0,a.hasTerminator=e=>e.length>0&&16===e[e.length-1],a.nibblesToBytes=(e,a)=>{for(let t=0,c=0;c{let t=0;(0,a.hasTerminator)(e)&&(t=1,e=e.subarray(0,e.length-1));const c=new Uint8Array(e.length/2+1);return c[0]=t<<5,1&~e.length||(c[0]|=16,c[0]|=e[0],e=e.subarray(1)),(0,a.nibblesToBytes)(e,c.subarray(1)),c},a.bytesToNibbles=e=>{const a=2*e.length+1,t=new Uint8Array(a);for(let a=0;a{if(0===e.length)return e;let t=(0,a.bytesToNibbles)(e);t[0]<2&&(t=t.subarray(0,t.length-1));const c=2-(1&t[0]);return t.subarray(c)}},35546:(e,a,t)=>{"use strict";var c=t(62045).hp;Object.defineProperty(a,"__esModule",{value:!0}),a.assertIsString=a.assertIsArray=a.assertIsBuffer=a.assertIsHexString=void 0;const f=t(59498);a.assertIsHexString=function(e){if(!(0,f.isHexString)(e))throw new Error(`This method only supports 0x-prefixed hex strings but input was: ${e}`)},a.assertIsBuffer=function(e){if(!c.isBuffer(e))throw new Error(`This method only supports Buffer but input was: ${e}`)},a.assertIsArray=function(e){if(!Array.isArray(e))throw new Error(`This method only supports number arrays but input was: ${e}`)},a.assertIsString=function(e){if("string"!=typeof e)throw new Error(`This method only supports strings but input was: ${e}`)}},68683:function(e,a,t){"use strict";var c=this&&this.__createBinding||(Object.create?function(e,a,t,c){void 0===c&&(c=t);var f=Object.getOwnPropertyDescriptor(a,t);f&&!("get"in f?!a.__esModule:f.writable||f.configurable)||(f={enumerable:!0,get:function(){return a[t]}}),Object.defineProperty(e,c,f)}:function(e,a,t,c){void 0===c&&(c=t),e[c]=a[t]}),f=this&&this.__exportStar||function(e,a){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(a,t)||c(a,e,t)};Object.defineProperty(a,"__esModule",{value:!0}),a.toAscii=a.stripHexPrefix=a.padToEven=a.isHexString=a.isHexPrefixed=a.getKeys=a.getBinarySize=a.fromUtf8=a.fromAscii=a.arrayContainsArray=void 0,f(t(89838),a),f(t(52652),a),f(t(16284),a),f(t(86727),a),f(t(37380),a),f(t(92133),a),f(t(77312),a),f(t(42666),a),f(t(45062),a),f(t(98421),a);var d=t(59498);Object.defineProperty(a,"arrayContainsArray",{enumerable:!0,get:function(){return d.arrayContainsArray}}),Object.defineProperty(a,"fromAscii",{enumerable:!0,get:function(){return d.fromAscii}}),Object.defineProperty(a,"fromUtf8",{enumerable:!0,get:function(){return d.fromUtf8}}),Object.defineProperty(a,"getBinarySize",{enumerable:!0,get:function(){return d.getBinarySize}}),Object.defineProperty(a,"getKeys",{enumerable:!0,get:function(){return d.getKeys}}),Object.defineProperty(a,"isHexPrefixed",{enumerable:!0,get:function(){return d.isHexPrefixed}}),Object.defineProperty(a,"isHexString",{enumerable:!0,get:function(){return d.isHexString}}),Object.defineProperty(a,"padToEven",{enumerable:!0,get:function(){return d.padToEven}}),Object.defineProperty(a,"stripHexPrefix",{enumerable:!0,get:function(){return d.stripHexPrefix}}),Object.defineProperty(a,"toAscii",{enumerable:!0,get:function(){return d.toAscii}}),f(t(31708),a),f(t(81862),a)},59498:(e,a,t)=>{"use strict";var c=t(62045).hp;function f(e){if("string"!=typeof e)throw new Error("[isHexPrefixed] input must be type 'string', received type "+typeof e);return"0"===e[0]&&"x"===e[1]}function d(e){let a=e;if("string"!=typeof a)throw new Error("[padToEven] value must be type 'string', received "+typeof a);return a.length%2&&(a=`0${a}`),a}Object.defineProperty(a,"__esModule",{value:!0}),a.isHexString=a.getKeys=a.fromAscii=a.fromUtf8=a.toAscii=a.arrayContainsArray=a.getBinarySize=a.padToEven=a.stripHexPrefix=a.isHexPrefixed=void 0,a.isHexPrefixed=f,a.stripHexPrefix=e=>{if("string"!=typeof e)throw new Error("[stripHexPrefix] input must be type 'string', received "+typeof e);return f(e)?e.slice(2):e},a.padToEven=d,a.getBinarySize=function(e){if("string"!=typeof e)throw new Error("[getBinarySize] method requires input type 'string', received "+typeof e);return c.byteLength(e,"utf8")},a.arrayContainsArray=function(e,a,t){if(!0!==Array.isArray(e))throw new Error(`[arrayContainsArray] method requires input 'superset' to be an array, got type '${typeof e}'`);if(!0!==Array.isArray(a))throw new Error(`[arrayContainsArray] method requires input 'subset' to be an array, got type '${typeof a}'`);return a[!0===t?"some":"every"]((a=>e.indexOf(a)>=0))},a.toAscii=function(e){let a="",t=0;const c=e.length;for("0x"===e.substring(0,2)&&(t=2);t0&&e.length!==2+2*a)}},31708:(e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.Lock=void 0,a.Lock=class{constructor(){this.permits=1,this.promiseResolverQueue=[]}async acquire(){return this.permits>0?(this.permits-=1,Promise.resolve(!0)):new Promise((e=>this.promiseResolverQueue.push(e)))}release(){if(this.permits+=1,this.permits>1&&this.promiseResolverQueue.length>0)console.warn("Lock.permits should never be > 0 when there is someone waiting.");else if(1===this.permits&&this.promiseResolverQueue.length>0){this.permits-=1;const e=this.promiseResolverQueue.shift();e&&e(!0)}}}},81862:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.getProvider=a.fetchFromProvider=void 0;const c=t(6215);a.fetchFromProvider=async(e,a)=>(await(0,c.default)(e,{headers:{"content-type":"application/json"},type:"json",data:{method:a.method,params:a.params,jsonrpc:"2.0",id:1}})).result,a.getProvider=e=>{if("string"==typeof e)return e;if(void 0!==e?.connection?.url)return e.connection.url;throw new Error("Must provide valid provider URL or Web3Provider")}},92133:(e,a,t)=>{"use strict";var c=t(62045).hp;Object.defineProperty(a,"__esModule",{value:!0}),a.hashPersonalMessage=a.isValidSignature=a.fromRpcSig=a.toCompactSig=a.toRpcSig=a.ecrecover=a.ecsign=void 0;const f=t(32019),d=t(26513),r=t(77312),n=t(89838),i=t(35546);function b(e,a){return e===BigInt(0)||e===BigInt(1)?e:void 0===a?e-BigInt(27):e-(a*BigInt(2)+BigInt(35))}function o(e){return e===BigInt(0)||e===BigInt(1)}a.ecsign=function(e,a,t){const f=d.secp256k1.sign(e,a),r=f.toCompactRawBytes();return{r:c.from(r.slice(0,32)),s:c.from(r.slice(32,64)),v:void 0===t?BigInt(f.recovery+27):BigInt(f.recovery+35)+BigInt(t)*BigInt(2)}},a.ecrecover=function(e,a,t,f,n){const i=c.concat([(0,r.setLengthLeft)(t,32),(0,r.setLengthLeft)(f,32)],64),s=b(a,n);if(!o(s))throw new Error("Invalid signature v value");const l=d.secp256k1.Signature.fromCompact(i).addRecoveryBit(Number(s)).recoverPublicKey(e);return c.from(l.toRawBytes(!1).slice(1))},a.toRpcSig=function(e,a,t,f){if(!o(b(e,f)))throw new Error("Invalid signature v value");return(0,r.bufferToHex)(c.concat([(0,r.setLengthLeft)(a,32),(0,r.setLengthLeft)(t,32),(0,r.toBuffer)(e)]))},a.toCompactSig=function(e,a,t,f){if(!o(b(e,f)))throw new Error("Invalid signature v value");let d=t;return(e>BigInt(28)&&e%BigInt(2)===BigInt(1)||e===BigInt(1)||e===BigInt(28))&&(d=c.from(t),d[0]|=128),(0,r.bufferToHex)(c.concat([(0,r.setLengthLeft)(a,32),(0,r.setLengthLeft)(d,32)]))},a.fromRpcSig=function(e){const a=(0,r.toBuffer)(e);let t,c,f;if(a.length>=65)t=a.slice(0,32),c=a.slice(32,64),f=(0,r.bufferToBigInt)(a.slice(64));else{if(64!==a.length)throw new Error("Invalid signature length");t=a.slice(0,32),c=a.slice(32,64),f=BigInt((0,r.bufferToInt)(a.slice(32,33))>>7),c[0]&=127}return f<27&&(f+=BigInt(27)),{v:f,r:t,s:c}},a.isValidSignature=function(e,a,t,c=!0,f){if(32!==a.length||32!==t.length)return!1;if(!o(b(e,f)))return!1;const d=(0,r.bufferToBigInt)(a),i=(0,r.bufferToBigInt)(t);return!(d===BigInt(0)||d>=n.SECP256K1_ORDER||i===BigInt(0)||i>=n.SECP256K1_ORDER||c&&i>=n.SECP256K1_ORDER_DIV_2)},a.hashPersonalMessage=function(e){(0,i.assertIsBuffer)(e);const a=c.from(`Ethereum Signed Message:\n${e.length}`,"utf-8");return c.from((0,f.keccak256)(c.concat([a,e])))}},42666:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.toType=a.TypeOutput=void 0;const c=t(77312),f=t(59498);var d;!function(e){e[e.Number=0]="Number",e[e.BigInt=1]="BigInt",e[e.Buffer=2]="Buffer",e[e.PrefixedHexString=3]="PrefixedHexString"}(d=a.TypeOutput||(a.TypeOutput={})),a.toType=function(e,a){if(null===e)return null;if(void 0===e)return;if("string"==typeof e&&!(0,f.isHexString)(e))throw new Error(`A string must be provided with a 0x-prefix, given: ${e}`);if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");const t=(0,c.toBuffer)(e);switch(a){case d.Buffer:return t;case d.BigInt:return(0,c.bufferToBigInt)(t);case d.Number:{const e=(0,c.bufferToBigInt)(t);if(e>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return Number(e)}case d.PrefixedHexString:return(0,c.bufferToHex)(t);default:throw new Error("unknown outputType")}}},52652:(e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.GWEI_TO_WEI=void 0,a.GWEI_TO_WEI=BigInt(1e9)},37380:(e,a,t)=>{"use strict";var c=t(62045).hp;Object.defineProperty(a,"__esModule",{value:!0}),a.Withdrawal=void 0;const f=t(86727),d=t(77312),r=t(42666);class n{constructor(e,a,t,c){this.index=e,this.validatorIndex=a,this.address=t,this.amount=c}static fromWithdrawalData(e){const{index:a,validatorIndex:t,address:c,amount:d}=e,i=(0,r.toType)(a,r.TypeOutput.BigInt),b=(0,r.toType)(t,r.TypeOutput.BigInt),o=new f.Address((0,r.toType)(c,r.TypeOutput.Buffer)),s=(0,r.toType)(d,r.TypeOutput.BigInt);return new n(i,b,o,s)}static fromValuesArray(e){if(4!==e.length)throw Error(`Invalid withdrawalArray length expected=4 actual=${e.length}`);const[a,t,c,f]=e;return n.fromWithdrawalData({index:a,validatorIndex:t,address:c,amount:f})}static toBufferArray(e){const{index:a,validatorIndex:t,address:d,amount:n}=e,i=(0,r.toType)(a,r.TypeOutput.BigInt)===BigInt(0)?c.alloc(0):(0,r.toType)(a,r.TypeOutput.Buffer),b=(0,r.toType)(t,r.TypeOutput.BigInt)===BigInt(0)?c.alloc(0):(0,r.toType)(t,r.TypeOutput.Buffer);let o;return o=d instanceof f.Address?d.buf:(0,r.toType)(d,r.TypeOutput.Buffer),[i,b,o,(0,r.toType)(n,r.TypeOutput.BigInt)===BigInt(0)?c.alloc(0):(0,r.toType)(n,r.TypeOutput.Buffer)]}raw(){return n.toBufferArray(this)}toValue(){return{index:this.index,validatorIndex:this.validatorIndex,address:this.address.buf,amount:this.amount}}toJSON(){return{index:(0,d.bigIntToHex)(this.index),validatorIndex:(0,d.bigIntToHex)(this.validatorIndex),address:"0x"+this.address.buf.toString("hex"),amount:(0,d.bigIntToHex)(this.amount)}}}a.Withdrawal=n},56498:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.decodeSingle=a.decode=a.encodePacked=a.encodeSingle=a.encode=void 0;const c=t(52367),f=t(5961),d=t(37700);a.encode=(e,a,t,c)=>{try{return(0,d.pack)({types:e,values:a,packed:t,tight:c})}catch(e){if(e instanceof f.ParserError)throw new f.ParserError(`Unable to encode value: ${e.message}`,e);throw new f.ParserError(`An unexpected error occurred: ${(0,f.getErrorMessage)(e)}`,e)}},a.encodeSingle=(e,t)=>(0,a.encode)([e],[t]),a.encodePacked=(e,t,c)=>(0,a.encode)(e,t,!0,c),a.decode=(e,a)=>{const t=(0,c.createBytes)(a);try{return(0,d.unpack)(e,t)}catch(e){if(e instanceof f.ParserError)throw new f.ParserError(`Unable to decode value: ${e.message}`,e);throw new f.ParserError(`An unexpected error occurred: ${(0,f.getErrorMessage)(e)}`,e)}},a.decodeSingle=(e,t)=>{const d=(0,a.decode)([e],t);return(0,c.assert)(1===d.length,new f.ParserError("Decoded value array has unexpected length.")),d[0]}},5961:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.ParserError=a.getErrorStack=a.getErrorMessage=void 0;const c=t(52367);a.getErrorMessage=e=>"string"==typeof e?e:e instanceof Error||(0,c.isObject)(e)&&(0,c.hasProperty)(e,"message")&&"string"==typeof e.message?e.message:"Unknown error.",a.getErrorStack=e=>{if(e instanceof Error)return e.stack};class f extends Error{constructor(e,t){super(e),this.name="ParserError";const c=(0,a.getErrorStack)(t);c&&(this.stack=c)}}a.ParserError=f},93256:function(e,a,t){"use strict";var c=this&&this.__createBinding||(Object.create?function(e,a,t,c){void 0===c&&(c=t);var f=Object.getOwnPropertyDescriptor(a,t);f&&!("get"in f?!a.__esModule:f.writable||f.configurable)||(f={enumerable:!0,get:function(){return a[t]}}),Object.defineProperty(e,c,f)}:function(e,a,t,c){void 0===c&&(c=t),e[c]=a[t]}),f=this&&this.__exportStar||function(e,a){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(a,t)||c(a,e,t)};Object.defineProperty(a,"__esModule",{value:!0}),f(t(56498),a),f(t(5961),a),f(t(11126),a)},57924:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.iterate=void 0;const c=t(52367);a.iterate=function*(e,a=32){for(let t=0;t{(0,c.assert)(e>=0,"Cannot skip a negative number of bytes."),(0,c.assert)(e%a==0,"Length must be a multiple of the size."),t+=e},d=e.subarray(t);yield{skip:f,value:d}}return{skip:()=>{},value:new Uint8Array}}},37700:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.unpack=a.pack=a.isDynamicParser=a.getParser=void 0;const c=t(52367),f=t(5961),d=t(57924),r=t(46207),n=t(26365);a.getParser=e=>{const a={address:r.address,array:r.array,bool:r.bool,bytes:r.bytes,fixedBytes:r.fixedBytes,function:r.fn,number:r.number,string:r.string,tuple:r.tuple},t=a[e];if(t)return t;const c=Object.values(a).find((a=>a.isType(e)));if(c)return c;throw new f.ParserError(`The type "${e}" is not supported.`)},a.isDynamicParser=(e,a)=>{const{isDynamic:t}=e;return"function"==typeof t?t(a):t},a.pack=({types:e,values:t,packed:d=!1,tight:r=!1,arrayPacked:i=!1,byteArray:b=new Uint8Array})=>{(0,c.assert)(e.length===t.length,new f.ParserError(`The number of types (${e.length}) does not match the number of values (${t.length}).`));const{staticBuffer:o,dynamicBuffer:s,pointers:l}=e.reduce((({staticBuffer:e,dynamicBuffer:f,pointers:n},b,o)=>{const s=(0,a.getParser)(b),l=t[o];return d||i||!(0,a.isDynamicParser)(s,b)?{staticBuffer:s.encode({buffer:e,value:l,type:b,packed:d,tight:r}),dynamicBuffer:f,pointers:n}:{staticBuffer:(0,c.concatBytes)([e,new Uint8Array(32)]),dynamicBuffer:s.encode({buffer:f,value:l,type:b,packed:d,tight:r}),pointers:[...n,{position:e.length,pointer:f.length}]}}),{staticBuffer:new Uint8Array,dynamicBuffer:new Uint8Array,pointers:[]});(0,c.assert)(!d&&!i||0===s.length,new f.ParserError("Invalid pack state."));const u=o.length,h=l.reduce(((e,{pointer:a,position:t})=>{const f=(0,n.padStart)((0,c.numberToBytes)(u+a));return(0,n.set)(e,f,t)}),o);return(0,c.concatBytes)([b,h,s])},a.unpack=(e,t)=>{const r=(0,d.iterate)(t);return e.map((e=>{const{value:{value:d,skip:n},done:i}=r.next();(0,c.assert)(!i,new f.ParserError(`The encoded value is invalid for the provided types. Reached end of buffer while attempting to parse "${e}".`));const b=(0,a.getParser)(e);if((0,a.isDynamicParser)(b,e)){const a=(0,c.bytesToNumber)(d.subarray(0,32)),f=t.subarray(a);return b.decode({type:e,value:f,skip:n})}return b.decode({type:e,value:d,skip:n})}))}},91563:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.address=a.getAddress=void 0;const c=t(52367),f=t(5961),d=t(26365);a.getAddress=e=>{const a=(0,c.createBytes)(e);return(0,c.assert)(a.length<=20,new f.ParserError(`Invalid address value. Expected address to be 20 bytes long, but received ${a.length} bytes.`)),(0,d.padStart)(a,20)},a.address={isDynamic:!1,isType:e=>"address"===e,getByteLength:()=>32,encode({buffer:e,value:t,packed:f}){const r=(0,a.getAddress)(t);if(f)return(0,c.concatBytes)([e,r]);const n=(0,d.padStart)(r);return(0,c.concatBytes)([e,n])},decode:({value:e})=>(0,c.add0x)((0,c.bytesToHex)(e.slice(12,32)))}},186:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.array=a.getTupleType=a.getArrayType=a.isArrayType=void 0;const c=t(52367),f=t(5961),d=t(37700),r=t(26365),n=t(83415),i=t(30717),b=/^(?.*)\[(?\d*?)\]$/u;a.isArrayType=e=>b.test(e),a.getArrayType=e=>{const a=e.match(b);return(0,c.assert)(a?.groups?.type,new f.ParserError(`Invalid array type. Expected an array type, but received "${e}".`)),[a.groups.type,a.groups.length?parseInt(a.groups.length,10):void 0]},a.getTupleType=(e,a)=>`(${new Array(a).fill(e).join(",")})`,a.array={isDynamic(e){const[t,c]=(0,a.getArrayType)(e);return void 0===c||(0,d.isDynamicParser)((0,d.getParser)(t),t)},isType:e=>(0,a.isArrayType)(e),getByteLength(e){(0,c.assert)((0,a.isArrayType)(e),new f.ParserError(`Expected an array type, but received "${e}".`));const[t,r]=(0,a.getArrayType)(e);return(0,d.isDynamicParser)(this,e)||void 0===r?32:i.tuple.getByteLength((0,a.getTupleType)(t,r))},encode({type:e,buffer:t,value:b,packed:o,tight:s}){const[l,u]=(0,a.getArrayType)(e);if((0,c.assert)(!o||!(0,a.isArrayType)(l),new f.ParserError("Cannot pack nested arrays.")),o&&(0,d.isDynamicParser)((0,d.getParser)(l),l))return(0,d.pack)({types:new Array(b.length).fill(l),values:b,byteArray:t,packed:o,arrayPacked:!0,tight:s});if(u)return(0,c.assert)(u===b.length,new f.ParserError(`Array length does not match type length. Expected a length of ${u}, but received ${b.length}.`)),i.tuple.encode({type:(0,a.getTupleType)(l,u),buffer:t,value:b,packed:n.fixedBytes.isType(l)&&s,tight:s});if(o)return(0,d.pack)({types:new Array(b.length).fill(l),values:b,byteArray:t,packed:n.fixedBytes.isType(l)&&s,arrayPacked:!0,tight:s});const h=(0,r.padStart)((0,c.numberToBytes)(b.length));return(0,d.pack)({types:new Array(b.length).fill(l),values:b,byteArray:(0,c.concatBytes)([t,h]),packed:o,tight:s})},decode({type:e,value:t,...r}){const[n,b]=(0,a.getArrayType)(e);if(b){const e=i.tuple.decode({type:(0,a.getTupleType)(n,b),value:t,...r});return(0,c.assert)(e.length===b,new f.ParserError(`Array length does not match type length. Expected a length of ${b}, but received ${e.length}.`)),e}const o=(0,c.bytesToNumber)(t.subarray(0,32));return(0,d.unpack)(new Array(o).fill(n),t.subarray(32))}}},47435:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.bool=a.getBooleanValue=void 0;const c=t(35620),f=t(52367),d=t(5961),r=t(6150),n=(0,c.coerce)((0,c.boolean)(),(0,c.union)([(0,c.literal)("true"),(0,c.literal)("false")]),(e=>"true"===e));a.getBooleanValue=e=>{try{return(0,c.create)(e,n)?BigInt(1):BigInt(0)}catch{throw new d.ParserError(`Invalid boolean value. Expected a boolean literal, or the string "true" or "false", but received "${e}".`)}},a.bool={isDynamic:!1,isType:e=>"bool"===e,getByteLength:()=>32,encode({buffer:e,value:t,packed:c,tight:d}){const n=(0,a.getBooleanValue)(t);return c?(0,f.concatBytes)([e,(0,f.bigIntToBytes)(n)]):r.number.encode({type:"uint256",buffer:e,value:n,packed:c,tight:d})},decode:e=>r.number.decode({...e,type:"uint256"})===BigInt(1)}},99356:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.bytes=void 0;const c=t(52367),f=t(26365);a.bytes={isDynamic:!0,isType:e=>"bytes"===e,getByteLength:()=>32,encode({buffer:e,value:a,packed:t}){const d=(0,c.createBytes)(a);if(t)return(0,c.concatBytes)([e,d]);const r=32*Math.ceil(d.byteLength/32);return(0,c.concatBytes)([e,(0,f.padStart)((0,c.numberToBytes)(d.byteLength)),(0,f.padEnd)(d,r)])},decode({value:e}){const a=e.subarray(0,32),t=(0,c.bytesToNumber)(a);return e.slice(32,32+t)}}},83415:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.fixedBytes=a.getByteLength=void 0;const c=t(52367),f=t(5961),d=t(26365),r=/^bytes([0-9]{1,2})$/u;a.getByteLength=e=>{const a=e.match(r)?.[1];(0,c.assert)(a,`Invalid byte length. Expected a number between 1 and 32, but received "${e}".`);const t=Number(a);return(0,c.assert)(t>0&&t<=32,new f.ParserError(`Invalid byte length. Expected a number between 1 and 32, but received "${e}".`)),t},a.fixedBytes={isDynamic:!1,isType:e=>r.test(e),getByteLength:()=>32,encode({type:e,buffer:t,value:r,packed:n}){const i=(0,a.getByteLength)(e),b=(0,c.createBytes)(r);return(0,c.assert)(b.length<=i,new f.ParserError(`Expected a value of length ${i}, but received a value of length ${b.length}.`)),n?(0,c.concatBytes)([t,(0,d.padEnd)(b,i)]):(0,c.concatBytes)([t,(0,d.padEnd)(b)])},decode({type:e,value:t}){const c=(0,a.getByteLength)(e);return t.slice(0,c)}}},27827:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.fn=a.getFunction=void 0;const c=t(35620),f=t(52367),d=t(5961),r=t(83415),n=(0,c.coerce)((0,c.object)({address:f.StrictHexStruct,selector:f.StrictHexStruct}),(0,c.union)([f.StrictHexStruct,(0,c.instance)(Uint8Array)]),(e=>{const a=(0,f.createBytes)(e);return(0,f.assert)(24===a.length,new d.ParserError(`Invalid Solidity function. Expected function to be 24 bytes long, but received ${a.length} bytes.`)),{address:(0,f.bytesToHex)(a.subarray(0,20)),selector:(0,f.bytesToHex)(a.subarray(20,24))}}));a.getFunction=e=>{const a=(0,c.create)(e,n);return(0,f.concatBytes)([(0,f.hexToBytes)(a.address),(0,f.hexToBytes)(a.selector)])},a.fn={isDynamic:!1,isType:e=>"function"===e,getByteLength:()=>32,encode({buffer:e,value:t,packed:c,tight:f}){const d=(0,a.getFunction)(t);return r.fixedBytes.encode({type:"bytes24",buffer:e,value:d,packed:c,tight:f})},decode:({value:e})=>({address:(0,f.bytesToHex)(e.slice(0,20)),selector:(0,f.bytesToHex)(e.slice(20,24))})}},46207:function(e,a,t){"use strict";var c=this&&this.__createBinding||(Object.create?function(e,a,t,c){void 0===c&&(c=t);var f=Object.getOwnPropertyDescriptor(a,t);f&&!("get"in f?!a.__esModule:f.writable||f.configurable)||(f={enumerable:!0,get:function(){return a[t]}}),Object.defineProperty(e,c,f)}:function(e,a,t,c){void 0===c&&(c=t),e[c]=a[t]}),f=this&&this.__exportStar||function(e,a){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(a,t)||c(a,e,t)};Object.defineProperty(a,"__esModule",{value:!0}),f(t(91563),a),f(t(186),a),f(t(47435),a),f(t(99356),a),f(t(83415),a),f(t(27827),a),f(t(6150),a),f(t(28160),a),f(t(8446),a),f(t(30717),a)},6150:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.number=a.getBigInt=a.assertNumberLength=a.getLength=a.isSigned=void 0;const c=t(52367),f=t(5961),d=t(26365),r=/^u?int(?[0-9]*)?$/u;a.isSigned=e=>!e.startsWith("u"),a.getLength=e=>{if("int"===e||"uint"===e)return 256;const a=e.match(r);(0,c.assert)(a?.groups?.length,new f.ParserError(`Invalid number type. Expected a number type, but received "${e}".`));const t=parseInt(a.groups.length,10);return(0,c.assert)(t>=8&&t<=256,new f.ParserError(`Invalid number length. Expected a number between 8 and 256, but received "${e}".`)),(0,c.assert)(t%8==0,new f.ParserError(`Invalid number length. Expected a multiple of 8, but received "${e}".`)),t},a.assertNumberLength=(e,t)=>{const d=(0,a.getLength)(t),r=BigInt(2)**BigInt(d-((0,a.isSigned)(t)?1:0))-BigInt(1);(0,a.isSigned)(t)?(0,c.assert)(e>=-(r+BigInt(1))&&e<=r,new f.ParserError(`Number "${e}" is out of range for type "${t}".`)):(0,c.assert)(e<=r,new f.ParserError(`Number "${e}" is out of range for type "${t}".`))},a.getBigInt=e=>{try{return(0,c.createBigInt)(e)}catch{throw new f.ParserError(`Invalid number. Expected a valid number value, but received "${e}".`)}},a.number={isDynamic:!1,isType:e=>r.test(e),getByteLength:()=>32,encode({type:e,buffer:t,value:f,packed:r}){const n=(0,a.getBigInt)(f);if((0,a.assertNumberLength)(n,e),(0,a.isSigned)(e)){if(r){const f=(0,a.getLength)(e)/8;return(0,c.concatBytes)([t,(0,c.signedBigIntToBytes)(n,f)])}return(0,c.concatBytes)([t,(0,d.padStart)((0,c.signedBigIntToBytes)(n,32))])}if(r){const f=(0,a.getLength)(e)/8;return(0,c.concatBytes)([t,(0,d.padStart)((0,c.bigIntToBytes)(n),f)])}return(0,c.concatBytes)([t,(0,d.padStart)((0,c.bigIntToBytes)(n))])},decode({type:e,value:t}){const f=t.subarray(0,32);if((0,a.isSigned)(e)){const t=(0,c.bytesToSignedBigInt)(f);return(0,a.assertNumberLength)(t,e),t}const d=(0,c.bytesToBigInt)(f);return(0,a.assertNumberLength)(d,e),d}}},28160:(e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0})},8446:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.string=void 0;const c=t(52367),f=t(99356);a.string={isDynamic:!0,isType:e=>"string"===e,getByteLength:()=>32,encode:({buffer:e,value:a,packed:t,tight:d})=>f.bytes.encode({type:"bytes",buffer:e,value:(0,c.stringToBytes)(a),packed:t,tight:d}),decode:e=>(0,c.bytesToString)(f.bytes.decode(e))}},30717:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.tuple=a.getTupleElements=void 0;const c=t(52367),f=t(5961),d=t(37700),r=/^\((.+)\)$/u;a.getTupleElements=e=>{(0,c.assert)(e.startsWith("(")&&e.endsWith(")"),new f.ParserError(`Invalid tuple type. Expected tuple type, but received "${e}".`));const a=[];let t="",d=0;for(let c=1;c(0,a.getTupleElements)(e).some((e=>{const a=(0,d.getParser)(e);return(0,d.isDynamicParser)(a,e)})),isType:e=>(e=>r.test(e))(e),getByteLength(e){return(0,d.isDynamicParser)(this,e)?32:(0,a.getTupleElements)(e).reduce(((e,a)=>e+(0,d.getParser)(a).getByteLength(a)),0)},encode({type:e,buffer:t,value:c,packed:f,tight:r}){const n=(0,a.getTupleElements)(e);return(0,d.pack)({types:n,values:c,byteArray:t,packed:f,tight:r})},decode({type:e,value:t,skip:c}){const f=(0,a.getTupleElements)(e);return c(this.getByteLength(e)-32),(0,d.unpack)(f,t)}}},15744:(e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0})},11126:function(e,a,t){"use strict";var c=this&&this.__createBinding||(Object.create?function(e,a,t,c){void 0===c&&(c=t);var f=Object.getOwnPropertyDescriptor(a,t);f&&!("get"in f?!a.__esModule:f.writable||f.configurable)||(f={enumerable:!0,get:function(){return a[t]}}),Object.defineProperty(e,c,f)}:function(e,a,t,c){void 0===c&&(c=t),e[c]=a[t]}),f=this&&this.__exportStar||function(e,a){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(a,t)||c(a,e,t)};Object.defineProperty(a,"__esModule",{value:!0}),f(t(15744),a)},59194:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.padEnd=a.padStart=a.set=void 0;const c=t(52367);a.set=(e,a,t)=>(0,c.concatBytes)([e.subarray(0,t),a,e.subarray(t+a.length)]),a.padStart=(e,a=32)=>{const t=new Uint8Array(Math.max(a-e.length,0)).fill(0);return(0,c.concatBytes)([t,e])},a.padEnd=(e,a=32)=>{const t=new Uint8Array(Math.max(a-e.length,0)).fill(0);return(0,c.concatBytes)([e,t])}},26365:function(e,a,t){"use strict";var c=this&&this.__createBinding||(Object.create?function(e,a,t,c){void 0===c&&(c=t);var f=Object.getOwnPropertyDescriptor(a,t);f&&!("get"in f?!a.__esModule:f.writable||f.configurable)||(f={enumerable:!0,get:function(){return a[t]}}),Object.defineProperty(e,c,f)}:function(e,a,t,c){void 0===c&&(c=t),e[c]=a[t]}),f=this&&this.__exportStar||function(e,a){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(a,t)||c(a,e,t)};Object.defineProperty(a,"__esModule",{value:!0}),f(t(59194),a)},98537:function(e,a,t){"use strict";var c=t(62045).hp,f=this&&this.__createBinding||(Object.create?function(e,a,t,c){void 0===c&&(c=t);var f=Object.getOwnPropertyDescriptor(a,t);f&&!("get"in f?!a.__esModule:f.writable||f.configurable)||(f={enumerable:!0,get:function(){return a[t]}}),Object.defineProperty(e,c,f)}:function(e,a,t,c){void 0===c&&(c=t),e[c]=a[t]}),d=this&&this.__setModuleDefault||(Object.create?function(e,a){Object.defineProperty(e,"default",{enumerable:!0,value:a})}:function(e,a){e.default=a}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var a={};if(null!=e)for(var t in e)"default"!==t&&Object.prototype.hasOwnProperty.call(e,t)&&f(a,e,t);return d(a,e),a};Object.defineProperty(a,"__esModule",{value:!0}),a.getEncryptionPublicKey=a.decryptSafely=a.decrypt=a.encryptSafely=a.encrypt=void 0;const n=t(63203),i=r(t(88947)),b=t(54907);function o({publicKey:e,data:a,version:t}){if((0,b.isNullish)(e))throw new Error("Missing publicKey parameter");if((0,b.isNullish)(a))throw new Error("Missing data parameter");if((0,b.isNullish)(t))throw new Error("Missing version parameter");if("x25519-xsalsa20-poly1305"===t){if("string"!=typeof a)throw new Error("Message data must be given as a string");const t=i.box.keyPair();let c;try{c=n.base64.decode(e)}catch(e){throw new Error("Bad public key")}const f=n.utf8.decode(a),d=i.randomBytes(i.box.nonceLength),r=i.box(f,d,c,t.secretKey);return{version:"x25519-xsalsa20-poly1305",nonce:n.base64.encode(d),ephemPublicKey:n.base64.encode(t.publicKey),ciphertext:n.base64.encode(r)}}throw new Error("Encryption type/version not supported")}function s({encryptedData:e,privateKey:a}){if((0,b.isNullish)(e))throw new Error("Missing encryptedData parameter");if((0,b.isNullish)(a))throw new Error("Missing privateKey parameter");if("x25519-xsalsa20-poly1305"===e.version){const t=c.from(a,"hex"),f=i.box.keyPair.fromSecretKey(t).secretKey,d=n.base64.decode(e.nonce),r=n.base64.decode(e.ciphertext),b=n.base64.decode(e.ephemPublicKey),o=i.box.open(r,d,b,f);try{if(!o)throw new Error;const e=n.utf8.encode(o);if(!e)throw new Error;return e}catch(e){if(e&&"string"==typeof e.message&&e.message.length)throw new Error(`Decryption failed: ${e.message}`);throw new Error("Decryption failed.")}}throw new Error("Encryption type/version not supported.")}a.encrypt=o,a.encryptSafely=function({publicKey:e,data:a,version:t}){if((0,b.isNullish)(e))throw new Error("Missing publicKey parameter");if((0,b.isNullish)(a))throw new Error("Missing data parameter");if((0,b.isNullish)(t))throw new Error("Missing version parameter");if("object"==typeof a&&a&&"toJSON"in a)throw new Error("Cannot encrypt with toJSON property. Please remove toJSON property");const f={data:a,padding:""},d=c.byteLength(JSON.stringify(f),"utf-8")%2048;let r=0;return d>0&&(r=2048-d-16),f.padding="0".repeat(r),o({publicKey:e,data:JSON.stringify(f),version:t})},a.decrypt=s,a.decryptSafely=function({encryptedData:e,privateKey:a}){if((0,b.isNullish)(e))throw new Error("Missing encryptedData parameter");if((0,b.isNullish)(a))throw new Error("Missing privateKey parameter");return JSON.parse(s({encryptedData:e,privateKey:a})).data},a.getEncryptionPublicKey=function(e){const a=c.from(e,"hex"),t=i.box.keyPair.fromSecretKey(a).publicKey;return n.base64.encode(t)}},51594:function(e,a,t){"use strict";var c=this&&this.__createBinding||(Object.create?function(e,a,t,c){void 0===c&&(c=t);var f=Object.getOwnPropertyDescriptor(a,t);f&&!("get"in f?!a.__esModule:f.writable||f.configurable)||(f={enumerable:!0,get:function(){return a[t]}}),Object.defineProperty(e,c,f)}:function(e,a,t,c){void 0===c&&(c=t),e[c]=a[t]}),f=this&&this.__exportStar||function(e,a){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(a,t)||c(a,e,t)};Object.defineProperty(a,"__esModule",{value:!0}),a.normalize=a.concatSig=void 0,f(t(20252),a),f(t(10169),a),f(t(98537),a);var d=t(54907);Object.defineProperty(a,"concatSig",{enumerable:!0,get:function(){return d.concatSig}}),Object.defineProperty(a,"normalize",{enumerable:!0,get:function(){return d.normalize}})},20252:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.extractPublicKey=a.recoverPersonalSignature=a.personalSign=void 0;const c=t(68683),f=t(54907);function d(e,a){const t=(0,c.hashPersonalMessage)((0,f.legacyToBuffer)(e));return(0,f.recoverPublicKey)(t,a)}a.personalSign=function({privateKey:e,data:a}){if((0,f.isNullish)(a))throw new Error("Missing data parameter");if((0,f.isNullish)(e))throw new Error("Missing privateKey parameter");const t=(0,f.legacyToBuffer)(a),d=(0,c.hashPersonalMessage)(t),r=(0,c.ecsign)(d,e);return(0,f.concatSig)((0,c.toBuffer)(r.v),r.r,r.s)},a.recoverPersonalSignature=function({data:e,signature:a}){if((0,f.isNullish)(e))throw new Error("Missing data parameter");if((0,f.isNullish)(a))throw new Error("Missing signature parameter");const t=d(e,a),r=(0,c.publicToAddress)(t);return(0,c.bufferToHex)(r)},a.extractPublicKey=function({data:e,signature:a}){if((0,f.isNullish)(e))throw new Error("Missing data parameter");if((0,f.isNullish)(a))throw new Error("Missing signature parameter");return`0x${d(e,a).toString("hex")}`}},10169:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.recoverTypedSignature=a.signTypedData=a.typedSignatureHash=a.TypedDataUtils=a.TYPED_MESSAGE_SCHEMA=a.SignTypedDataVersion=void 0;const c=t(68683),f=t(93256),d=t(46207),r=t(26365),n=t(52367),i=t(32019),b=t(54907);var o;function s(e,a){if(!Object.keys(o).includes(e))throw new Error(`Invalid version: '${e}'`);if(a&&!a.includes(e))throw new Error(`SignTypedDataVersion not allowed: '${e}'. Allowed versions are: ${a.join(", ")}`)}function l(e,a){(0,n.assert)(null!==a,`Unable to encode value: Invalid number. Expected a valid number value, but received "${a}".`);const t=BigInt(a),c=(0,d.getLength)(e),f=BigInt(2)**BigInt(c)-BigInt(1);return(0,n.assert)(t>=-f&&t<=f,`Unable to encode value: Number "${a}" is out of range for type "${e}".`),t}function u(e){let a=BigInt(0);for(let t=0;t=49?c-BigInt(49)+BigInt(10):c>=17?c-BigInt(17)+BigInt(10):c}return(0,r.padStart)((0,n.bigIntToBytes)(a),20)}function h(e,a,t,d,b){if(s(b,[o.V3,o.V4]),void 0!==e[t])return["bytes32",b===o.V4&&null==d?"0x0000000000000000000000000000000000000000000000000000000000000000":(0,c.arrToBufArr)((0,i.keccak256)(p(t,d,e,b)))];if("function"===t)throw new Error('Unsupported or invalid type: "function"');if(void 0===d)throw new Error(`missing value for field ${a} of type ${t}`);if("address"===t){if("number"==typeof d)return["address",(0,r.padStart)((0,n.numberToBytes)(d),20)];if((0,n.isStrictHexString)(d))return["address",(0,n.add0x)(d)];if("string"==typeof d)return["address",u(d).subarray(0,20)]}if("bool"===t)return["bool",Boolean(d)];if("bytes"===t)return"number"==typeof d?d=(0,n.numberToBytes)(d):(0,n.isStrictHexString)(d)||"0x"===d?d=(0,n.hexToBytes)(d):"string"==typeof d&&(d=(0,n.stringToBytes)(d)),["bytes32",(0,c.arrToBufArr)((0,i.keccak256)(d))];if(t.startsWith("bytes")&&"bytes"!==t&&!t.includes("["))return"number"==typeof d?d<0?["bytes32",new Uint8Array(32)]:["bytes32",(0,n.bigIntToBytes)(BigInt(d))]:(0,n.isStrictHexString)(d)?["bytes32",(0,n.hexToBytes)(d)]:["bytes32",d];if(t.startsWith("int")&&!t.includes("[")){const e=l(t,d);return e>=BigInt(0)?["uint256",e]:["int256",e]}if("string"===t)return d="number"==typeof d?(0,n.numberToBytes)(d):(0,n.stringToBytes)(null!=d?d:""),["bytes32",(0,c.arrToBufArr)((0,i.keccak256)(d))];if(t.endsWith("]")){if(b===o.V3)throw new Error("Arrays are unimplemented in encodeData; use V4 extension");const r=t.slice(0,t.lastIndexOf("[")),n=d.map((t=>h(e,a,r,t,b)));return["bytes32",(0,c.arrToBufArr)((0,i.keccak256)((0,f.encode)(n.map((([e])=>e)),n.map((([,e])=>e)))))]}return[t,d]}function p(e,a,t,d){s(d,[o.V3,o.V4]);const r=["bytes32"],n=[y(e,t)];for(const c of t[e]){if(d===o.V3&&void 0===a[c.name])continue;const[e,f]=h(t,c.name,c.type,a[c.name],d);r.push(e),n.push(f)}return(0,c.arrToBufArr)((0,f.encode)(r,n))}function g(e,a){let t="";const c=m(e,a);c.delete(e);const f=[e,...Array.from(c).sort()];for(const e of f){if(!a[e])throw new Error(`No type definition specified: ${e}`);t+=`${e}(${a[e].map((({name:e,type:a})=>`${a} ${e}`)).join(",")})`}return t}function m(e,a,t=new Set){if("string"!=typeof e)throw new Error(`Invalid findTypeDependencies input ${JSON.stringify(e)}`);const c=e.match(/^\w*/u);if([e]=c,t.has(e)||void 0===a[e])return t;t.add(e);for(const c of a[e])m(c.type,a,t);return t}function x(e,a,t,f){s(f,[o.V3,o.V4]);const d=p(e,a,t,f),r=(0,i.keccak256)(d);return(0,c.arrToBufArr)(r)}function y(e,a){const t=(0,n.stringToBytes)(g(e,a));return(0,c.arrToBufArr)((0,i.keccak256)(t))}function A(e){const t={};for(const c in a.TYPED_MESSAGE_SCHEMA.properties)e[c]&&(t[c]=e[c]);return"types"in t&&(t.types=Object.assign({EIP712Domain:[]},t.types)),t}function v(e,a){s(a,[o.V3,o.V4]);const t=A(e),{domain:c}=t;return x("EIP712Domain",c,{EIP712Domain:t.types.EIP712Domain},a)}function w(e,a){if((0,d.isArrayType)(e)&&Array.isArray(a)){const[t]=(0,d.getArrayType)(e);return a.map((e=>w(t,e)))}if("address"===e){if((0,n.isStrictHexString)(a))return(0,r.padStart)((0,n.hexToBytes)(a).subarray(0,20),20);if(a instanceof Uint8Array)return(0,r.padStart)(a.subarray(0,20),20)}if("bool"===e)return Boolean(a);if(e.startsWith("bytes")&&"bytes"!==e){const t=(0,d.getByteLength)(e);if("number"==typeof a)return a<0?new Uint8Array:(0,n.numberToBytes)(a).subarray(0,t);if((0,n.isStrictHexString)(a))return(0,n.hexToBytes)(a).subarray(0,t);if(a instanceof Uint8Array)return a.subarray(0,t)}if(e.startsWith("uint")&&"number"==typeof a)return Math.abs(a);if(e.startsWith("int")&&"number"==typeof a){const t=(0,d.getLength)(e);return BigInt.asIntN(t,BigInt(a))}return a}function _(e,a){return a.map((a=>{if("string"==typeof a||"number"==typeof a||"bigint"==typeof a){const t=l(e,a);if(t>=BigInt(0))return(0,r.padStart)((0,n.bigIntToBytes)(t),32);const c=(0,d.getLength)(e),f=BigInt.asIntN(c,t);return(0,n.signedBigIntToBytes)(f,32)}return a}))}function I(e){const a=new Error("Expect argument to be non-empty array");if("object"!=typeof e||!("length"in e)||!e.length)throw a;const t=e.map((({name:e,type:a,value:t})=>{if("address[]"===a)return{name:e,type:"bytes32[]",value:(c=t,c.map((e=>"number"==typeof e?(0,r.padStart)((0,n.numberToBytes)(e),32):(0,n.isStrictHexString)(e)?(0,r.padStart)((0,n.hexToBytes)(e).subarray(0,32),32):e instanceof Uint8Array?(0,r.padStart)(e.subarray(0,32),32):e)))};var c;if(a.startsWith("int")&&(0,d.isArrayType)(a)){const[c,f]=(0,d.getArrayType)(a);return{name:e,type:`bytes32[${null!=f?f:""}]`,value:_(c,t)}}return{name:e,type:a,value:w(a,t)}})),o=t.map((e=>"bytes"!==e.type?e.value:(0,b.legacyToBuffer)(e.value))),s=t.map((e=>{if("function"===e.type)throw new Error('Unsupported or invalid type: "function"');return e.type})),l=e.map((e=>{if(!e.name)throw a;return`${e.type} ${e.name}`}));return(0,c.arrToBufArr)((0,i.keccak256)((0,f.encodePacked)(["bytes32","bytes32"],[(0,i.keccak256)((0,f.encodePacked)(["string[]"],[l],!0)),(0,i.keccak256)((0,f.encodePacked)(s,o,!0))])))}!function(e){e.V1="V1",e.V3="V3",e.V4="V4"}(o=a.SignTypedDataVersion||(a.SignTypedDataVersion={})),a.TYPED_MESSAGE_SCHEMA={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},a.TypedDataUtils={encodeData:p,encodeType:g,findTypeDependencies:m,hashStruct:x,hashType:y,sanitizeData:A,eip712Hash:function(e,a){s(a,[o.V3,o.V4]);const t=A(e),f=[(0,n.hexToBytes)("1901")];return f.push(v(e,a)),"EIP712Domain"!==t.primaryType&&f.push(x(t.primaryType,t.message,t.types,a)),(0,c.arrToBufArr)((0,i.keccak256)((0,n.concatBytes)(f)))},eip712DomainHash:v},a.typedSignatureHash=function(e){const a=I(e);return(0,n.bytesToHex)(a)},a.signTypedData=function({privateKey:e,data:t,version:f}){if(s(f),(0,b.isNullish)(t))throw new Error("Missing data parameter");if((0,b.isNullish)(e))throw new Error("Missing private key parameter");const d=f===o.V1?I(t):a.TypedDataUtils.eip712Hash(t,f),r=(0,c.ecsign)(d,e);return(0,b.concatSig)((0,c.arrToBufArr)((0,n.bigIntToBytes)(r.v)),r.r,r.s)},a.recoverTypedSignature=function({data:e,signature:t,version:f}){if(s(f),(0,b.isNullish)(e))throw new Error("Missing data parameter");if((0,b.isNullish)(t))throw new Error("Missing signature parameter");const d=f===o.V1?I(e):a.TypedDataUtils.eip712Hash(e,f),r=(0,b.recoverPublicKey)(d,t),i=(0,c.publicToAddress)(r);return(0,n.bytesToHex)(i)}},54907:(e,a,t)=>{"use strict";var c=t(62045).hp;Object.defineProperty(a,"__esModule",{value:!0}),a.normalize=a.recoverPublicKey=a.concatSig=a.legacyToBuffer=a.isNullish=a.padWithZeroes=void 0;const f=t(68683),d=t(52367);function r(e,a){if(""!==e&&!/^[a-f0-9]+$/iu.test(e))throw new Error(`Expected an unprefixed hex string. Received: ${e}`);if(a<0)throw new Error(`Expected a non-negative integer target length. Received: ${a}`);return String.prototype.padStart.call(e,a,"0")}function n(e){return null==e}a.padWithZeroes=r,a.isNullish=n,a.legacyToBuffer=function(e){return"string"!=typeof e||(0,f.isHexString)(e)?(0,f.toBuffer)(e):c.from(e)},a.concatSig=function(e,a,t){const c=(0,f.fromSigned)(a),n=(0,f.fromSigned)(t),i=(0,f.bufferToInt)(e),b=r((0,f.toUnsigned)(c).toString("hex"),64),o=r((0,f.toUnsigned)(n).toString("hex"),64),s=(0,d.remove0x)((0,d.numberToHex)(i));return(0,d.add0x)(b.concat(o,s))},a.recoverPublicKey=function(e,a){const t=(0,f.fromRpcSig)(a);return(0,f.ecrecover)(e,t.v,t.r,t.s)},a.normalize=function(e){if(!n(e)){if("number"==typeof e){if(e<0)return"0x";const a=(0,d.numberToBytes)(e);e=(0,d.bytesToHex)(a)}if("string"!=typeof e){let a="eth-sig-util.normalize() requires hex string or integer input.";throw a+=` received ${typeof e}: ${e}`,new Error(a)}return(0,d.add0x)(e.toLowerCase())}}},52139:(e,a,t)=>{const c=Symbol("SemVer ANY");class f{static get ANY(){return c}constructor(e,a){if(a=d(a),e instanceof f){if(e.loose===!!a.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),b("comparator",e,a),this.options=a,this.loose=!!a.loose,this.parse(e),this.semver===c?this.value="":this.value=this.operator+this.semver.version,b("comp",this)}parse(e){const a=this.options.loose?r[n.COMPARATORLOOSE]:r[n.COMPARATOR],t=e.match(a);if(!t)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==t[1]?t[1]:"","="===this.operator&&(this.operator=""),t[2]?this.semver=new o(t[2],this.options.loose):this.semver=c}toString(){return this.value}test(e){if(b("Comparator.test",e,this.options.loose),this.semver===c||e===c)return!0;if("string"==typeof e)try{e=new o(e,this.options)}catch(e){return!1}return i(e,this.operator,this.semver,this.options)}intersects(e,a){if(!(e instanceof f))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new s(e.value,a).test(this.value):""===e.operator?""===e.value||new s(this.value,a).test(e.semver):!((a=d(a)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===e.value)||!a.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))||(!this.operator.startsWith(">")||!e.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!e.operator.startsWith("<"))&&(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))&&!(i(this.semver,"<",e.semver,a)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))&&!(i(this.semver,">",e.semver,a)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}e.exports=f;const d=t(69932),{safeRe:r,t:n}=t(34567),i=t(73646),b=t(52207),o=t(64739),s=t(25926)},25926:(e,a,t)=>{const c=/\s+/g;class f{constructor(e,a){if(a=r(a),e instanceof f)return e.loose===!!a.loose&&e.includePrerelease===!!a.includePrerelease?e:new f(e.raw,a);if(e instanceof n)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=a,this.loose=!!a.loose,this.includePrerelease=!!a.includePrerelease,this.raw=e.trim().replace(c," "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!m(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&x(e[0])){this.set=[e];break}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e0&&(this.formatted+="||");const a=this.set[e];for(let e=0;e0&&(this.formatted+=" "),this.formatted+=a[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){const a=((this.options.includePrerelease&&p)|(this.options.loose&&g))+":"+e,t=d.get(a);if(t)return t;const c=this.options.loose,f=c?o[s.HYPHENRANGELOOSE]:o[s.HYPHENRANGE];e=e.replace(f,L(this.options.includePrerelease)),i("hyphen replace",e),e=e.replace(o[s.COMPARATORTRIM],l),i("comparator trim",e),e=e.replace(o[s.TILDETRIM],u),i("tilde trim",e),e=e.replace(o[s.CARETTRIM],h),i("caret trim",e);let r=e.split(" ").map((e=>A(e,this.options))).join(" ").split(/\s+/).map((e=>k(e,this.options)));c&&(r=r.filter((e=>(i("loose invalid filter",e,this.options),!!e.match(o[s.COMPARATORLOOSE]))))),i("range list",r);const b=new Map,x=r.map((e=>new n(e,this.options)));for(const e of x){if(m(e))return[e];b.set(e.value,e)}b.size>1&&b.has("")&&b.delete("");const y=[...b.values()];return d.set(a,y),y}intersects(e,a){if(!(e instanceof f))throw new TypeError("a Range is required");return this.set.some((t=>y(t,a)&&e.set.some((e=>y(e,a)&&t.every((t=>e.every((e=>t.intersects(e,a)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new b(e,this.options)}catch(e){return!1}for(let a=0;a"<0.0.0-0"===e.value,x=e=>""===e.value,y=(e,a)=>{let t=!0;const c=e.slice();let f=c.pop();for(;t&&c.length;)t=c.every((e=>f.intersects(e,a))),f=c.pop();return t},A=(e,a)=>(i("comp",e,a),e=I(e,a),i("caret",e),e=w(e,a),i("tildes",e),e=C(e,a),i("xrange",e),e=B(e,a),i("stars",e),e),v=e=>!e||"x"===e.toLowerCase()||"*"===e,w=(e,a)=>e.trim().split(/\s+/).map((e=>_(e,a))).join(" "),_=(e,a)=>{const t=a.loose?o[s.TILDELOOSE]:o[s.TILDE];return e.replace(t,((a,t,c,f,d)=>{let r;return i("tilde",e,a,t,c,f,d),v(t)?r="":v(c)?r=`>=${t}.0.0 <${+t+1}.0.0-0`:v(f)?r=`>=${t}.${c}.0 <${t}.${+c+1}.0-0`:d?(i("replaceTilde pr",d),r=`>=${t}.${c}.${f}-${d} <${t}.${+c+1}.0-0`):r=`>=${t}.${c}.${f} <${t}.${+c+1}.0-0`,i("tilde return",r),r}))},I=(e,a)=>e.trim().split(/\s+/).map((e=>E(e,a))).join(" "),E=(e,a)=>{i("caret",e,a);const t=a.loose?o[s.CARETLOOSE]:o[s.CARET],c=a.includePrerelease?"-0":"";return e.replace(t,((a,t,f,d,r)=>{let n;return i("caret",e,a,t,f,d,r),v(t)?n="":v(f)?n=`>=${t}.0.0${c} <${+t+1}.0.0-0`:v(d)?n="0"===t?`>=${t}.${f}.0${c} <${t}.${+f+1}.0-0`:`>=${t}.${f}.0${c} <${+t+1}.0.0-0`:r?(i("replaceCaret pr",r),n="0"===t?"0"===f?`>=${t}.${f}.${d}-${r} <${t}.${f}.${+d+1}-0`:`>=${t}.${f}.${d}-${r} <${t}.${+f+1}.0-0`:`>=${t}.${f}.${d}-${r} <${+t+1}.0.0-0`):(i("no pr"),n="0"===t?"0"===f?`>=${t}.${f}.${d}${c} <${t}.${f}.${+d+1}-0`:`>=${t}.${f}.${d}${c} <${t}.${+f+1}.0-0`:`>=${t}.${f}.${d} <${+t+1}.0.0-0`),i("caret return",n),n}))},C=(e,a)=>(i("replaceXRanges",e,a),e.split(/\s+/).map((e=>M(e,a))).join(" ")),M=(e,a)=>{e=e.trim();const t=a.loose?o[s.XRANGELOOSE]:o[s.XRANGE];return e.replace(t,((t,c,f,d,r,n)=>{i("xRange",e,t,c,f,d,r,n);const b=v(f),o=b||v(d),s=o||v(r),l=s;return"="===c&&l&&(c=""),n=a.includePrerelease?"-0":"",b?t=">"===c||"<"===c?"<0.0.0-0":"*":c&&l?(o&&(d=0),r=0,">"===c?(c=">=",o?(f=+f+1,d=0,r=0):(d=+d+1,r=0)):"<="===c&&(c="<",o?f=+f+1:d=+d+1),"<"===c&&(n="-0"),t=`${c+f}.${d}.${r}${n}`):o?t=`>=${f}.0.0${n} <${+f+1}.0.0-0`:s&&(t=`>=${f}.${d}.0${n} <${f}.${+d+1}.0-0`),i("xRange return",t),t}))},B=(e,a)=>(i("replaceStars",e,a),e.trim().replace(o[s.STAR],"")),k=(e,a)=>(i("replaceGTE0",e,a),e.trim().replace(o[a.includePrerelease?s.GTE0PRE:s.GTE0],"")),L=e=>(a,t,c,f,d,r,n,i,b,o,s,l)=>`${t=v(c)?"":v(f)?`>=${c}.0.0${e?"-0":""}`:v(d)?`>=${c}.${f}.0${e?"-0":""}`:r?`>=${t}`:`>=${t}${e?"-0":""}`} ${i=v(b)?"":v(o)?`<${+b+1}.0.0-0`:v(s)?`<${b}.${+o+1}.0-0`:l?`<=${b}.${o}.${s}-${l}`:e?`<${b}.${o}.${+s+1}-0`:`<=${i}`}`.trim(),S=(e,a,t)=>{for(let t=0;t0){const c=e[t].semver;if(c.major===a.major&&c.minor===a.minor&&c.patch===a.patch)return!0}return!1}return!0}},64739:(e,a,t)=>{const c=t(52207),{MAX_LENGTH:f,MAX_SAFE_INTEGER:d}=t(35237),{safeRe:r,t:n}=t(34567),i=t(69932),{compareIdentifiers:b}=t(27660);class o{constructor(e,a){if(a=i(a),e instanceof o){if(e.loose===!!a.loose&&e.includePrerelease===!!a.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>f)throw new TypeError(`version is longer than ${f} characters`);c("SemVer",e,a),this.options=a,this.loose=!!a.loose,this.includePrerelease=!!a.includePrerelease;const t=e.trim().match(a.loose?r[n.LOOSE]:r[n.FULL]);if(!t)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+t[1],this.minor=+t[2],this.patch=+t[3],this.major>d||this.major<0)throw new TypeError("Invalid major version");if(this.minor>d||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>d||this.patch<0)throw new TypeError("Invalid patch version");t[4]?this.prerelease=t[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const a=+e;if(a>=0&&a=0;)"number"==typeof this.prerelease[c]&&(this.prerelease[c]++,c=-2);if(-1===c){if(a===this.prerelease.join(".")&&!1===t)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(a){let c=[a,e];!1===t&&(c=[a]),0===b(this.prerelease[0],a)?isNaN(this.prerelease[1])&&(this.prerelease=c):this.prerelease=c}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=o},30911:(e,a,t)=>{const c=t(83321);e.exports=(e,a)=>{const t=c(e.trim().replace(/^[=v]+/,""),a);return t?t.version:null}},73646:(e,a,t)=>{const c=t(5778),f=t(10710),d=t(90047),r=t(70668),n=t(15960),i=t(99925);e.exports=(e,a,t,b)=>{switch(a){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof t&&(t=t.version),e===t;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof t&&(t=t.version),e!==t;case"":case"=":case"==":return c(e,t,b);case"!=":return f(e,t,b);case">":return d(e,t,b);case">=":return r(e,t,b);case"<":return n(e,t,b);case"<=":return i(e,t,b);default:throw new TypeError(`Invalid operator: ${a}`)}}},17425:(e,a,t)=>{const c=t(64739),f=t(83321),{safeRe:d,t:r}=t(34567);e.exports=(e,a)=>{if(e instanceof c)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let t=null;if((a=a||{}).rtl){const c=a.includePrerelease?d[r.COERCERTLFULL]:d[r.COERCERTL];let f;for(;(f=c.exec(e))&&(!t||t.index+t[0].length!==e.length);)t&&f.index+f[0].length===t.index+t[0].length||(t=f),c.lastIndex=f.index+f[1].length+f[2].length;c.lastIndex=-1}else t=e.match(a.includePrerelease?d[r.COERCEFULL]:d[r.COERCE]);if(null===t)return null;const n=t[2],i=t[3]||"0",b=t[4]||"0",o=a.includePrerelease&&t[5]?`-${t[5]}`:"",s=a.includePrerelease&&t[6]?`+${t[6]}`:"";return f(`${n}.${i}.${b}${o}${s}`,a)}},67544:(e,a,t)=>{const c=t(64739);e.exports=(e,a,t)=>{const f=new c(e,t),d=new c(a,t);return f.compare(d)||f.compareBuild(d)}},91554:(e,a,t)=>{const c=t(8317);e.exports=(e,a)=>c(e,a,!0)},8317:(e,a,t)=>{const c=t(64739);e.exports=(e,a,t)=>new c(e,t).compare(new c(a,t))},45007:(e,a,t)=>{const c=t(83321);e.exports=(e,a)=>{const t=c(e,null,!0),f=c(a,null,!0),d=t.compare(f);if(0===d)return null;const r=d>0,n=r?t:f,i=r?f:t,b=!!n.prerelease.length;if(i.prerelease.length&&!b)return i.patch||i.minor?n.patch?"patch":n.minor?"minor":"major":"major";const o=b?"pre":"";return t.major!==f.major?o+"major":t.minor!==f.minor?o+"minor":t.patch!==f.patch?o+"patch":"prerelease"}},5778:(e,a,t)=>{const c=t(8317);e.exports=(e,a,t)=>0===c(e,a,t)},90047:(e,a,t)=>{const c=t(8317);e.exports=(e,a,t)=>c(e,a,t)>0},70668:(e,a,t)=>{const c=t(8317);e.exports=(e,a,t)=>c(e,a,t)>=0},94586:(e,a,t)=>{const c=t(64739);e.exports=(e,a,t,f,d)=>{"string"==typeof t&&(d=f,f=t,t=void 0);try{return new c(e instanceof c?e.version:e,t).inc(a,f,d).version}catch(e){return null}}},15960:(e,a,t)=>{const c=t(8317);e.exports=(e,a,t)=>c(e,a,t)<0},99925:(e,a,t)=>{const c=t(8317);e.exports=(e,a,t)=>c(e,a,t)<=0},95207:(e,a,t)=>{const c=t(64739);e.exports=(e,a)=>new c(e,a).major},70547:(e,a,t)=>{const c=t(64739);e.exports=(e,a)=>new c(e,a).minor},10710:(e,a,t)=>{const c=t(8317);e.exports=(e,a,t)=>0!==c(e,a,t)},83321:(e,a,t)=>{const c=t(64739);e.exports=(e,a,t=!1)=>{if(e instanceof c)return e;try{return new c(e,a)}catch(e){if(!t)return null;throw e}}},5852:(e,a,t)=>{const c=t(64739);e.exports=(e,a)=>new c(e,a).patch},84058:(e,a,t)=>{const c=t(83321);e.exports=(e,a)=>{const t=c(e,a);return t&&t.prerelease.length?t.prerelease:null}},69173:(e,a,t)=>{const c=t(8317);e.exports=(e,a,t)=>c(a,e,t)},51200:(e,a,t)=>{const c=t(67544);e.exports=(e,a)=>e.sort(((e,t)=>c(t,e,a)))},52643:(e,a,t)=>{const c=t(25926);e.exports=(e,a,t)=>{try{a=new c(a,t)}catch(e){return!1}return a.test(e)}},63400:(e,a,t)=>{const c=t(67544);e.exports=(e,a)=>e.sort(((e,t)=>c(e,t,a)))},79572:(e,a,t)=>{const c=t(83321);e.exports=(e,a)=>{const t=c(e,a);return t?t.version:null}},56864:(e,a,t)=>{const c=t(34567),f=t(35237),d=t(64739),r=t(27660),n=t(83321),i=t(79572),b=t(30911),o=t(94586),s=t(45007),l=t(95207),u=t(70547),h=t(5852),p=t(84058),g=t(8317),m=t(69173),x=t(91554),y=t(67544),A=t(63400),v=t(51200),w=t(90047),_=t(15960),I=t(5778),E=t(10710),C=t(70668),M=t(99925),B=t(73646),k=t(17425),L=t(52139),S=t(25926),T=t(52643),N=t(24054),R=t(83777),P=t(63099),D=t(36258),O=t(77529),F=t(22944),Q=t(14316),U=t(12373),j=t(48337),H=t(72196),q=t(72505);e.exports={parse:n,valid:i,clean:b,inc:o,diff:s,major:l,minor:u,patch:h,prerelease:p,compare:g,rcompare:m,compareLoose:x,compareBuild:y,sort:A,rsort:v,gt:w,lt:_,eq:I,neq:E,gte:C,lte:M,cmp:B,coerce:k,Comparator:L,Range:S,satisfies:T,toComparators:N,maxSatisfying:R,minSatisfying:P,minVersion:D,validRange:O,outside:F,gtr:Q,ltr:U,intersects:j,simplifyRange:H,subset:q,SemVer:d,re:c.re,src:c.src,tokens:c.t,SEMVER_SPEC_VERSION:f.SEMVER_SPEC_VERSION,RELEASE_TYPES:f.RELEASE_TYPES,compareIdentifiers:r.compareIdentifiers,rcompareIdentifiers:r.rcompareIdentifiers}},35237:e=>{const a=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:a,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},52207:e=>{const a="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=a},27660:e=>{const a=/^[0-9]+$/,t=(e,t)=>{const c=a.test(e),f=a.test(t);return c&&f&&(e=+e,t=+t),e===t?0:c&&!f?-1:f&&!c?1:et(a,e)}},97228:e=>{e.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){const a=this.map.get(e);return void 0===a?void 0:(this.map.delete(e),this.map.set(e,a),a)}delete(e){return this.map.delete(e)}set(e,a){if(!this.delete(e)&&void 0!==a){if(this.map.size>=this.max){const e=this.map.keys().next().value;this.delete(e)}this.map.set(e,a)}return this}}},69932:e=>{const a=Object.freeze({loose:!0}),t=Object.freeze({});e.exports=e=>e?"object"!=typeof e?a:e:t},34567:(e,a,t)=>{const{MAX_SAFE_COMPONENT_LENGTH:c,MAX_SAFE_BUILD_LENGTH:f,MAX_LENGTH:d}=t(35237),r=t(52207),n=(a=e.exports={}).re=[],i=a.safeRe=[],b=a.src=[],o=a.t={};let s=0;const l="[a-zA-Z0-9-]",u=[["\\s",1],["\\d",d],[l,f]],h=(e,a,t)=>{const c=(e=>{for(const[a,t]of u)e=e.split(`${a}*`).join(`${a}{0,${t}}`).split(`${a}+`).join(`${a}{1,${t}}`);return e})(a),f=s++;r(e,f,a),o[e]=f,b[f]=a,n[f]=new RegExp(a,t?"g":void 0),i[f]=new RegExp(c,t?"g":void 0)};h("NUMERICIDENTIFIER","0|[1-9]\\d*"),h("NUMERICIDENTIFIERLOOSE","\\d+"),h("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${l}*`),h("MAINVERSION",`(${b[o.NUMERICIDENTIFIER]})\\.(${b[o.NUMERICIDENTIFIER]})\\.(${b[o.NUMERICIDENTIFIER]})`),h("MAINVERSIONLOOSE",`(${b[o.NUMERICIDENTIFIERLOOSE]})\\.(${b[o.NUMERICIDENTIFIERLOOSE]})\\.(${b[o.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASEIDENTIFIER",`(?:${b[o.NUMERICIDENTIFIER]}|${b[o.NONNUMERICIDENTIFIER]})`),h("PRERELEASEIDENTIFIERLOOSE",`(?:${b[o.NUMERICIDENTIFIERLOOSE]}|${b[o.NONNUMERICIDENTIFIER]})`),h("PRERELEASE",`(?:-(${b[o.PRERELEASEIDENTIFIER]}(?:\\.${b[o.PRERELEASEIDENTIFIER]})*))`),h("PRERELEASELOOSE",`(?:-?(${b[o.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${b[o.PRERELEASEIDENTIFIERLOOSE]})*))`),h("BUILDIDENTIFIER",`${l}+`),h("BUILD",`(?:\\+(${b[o.BUILDIDENTIFIER]}(?:\\.${b[o.BUILDIDENTIFIER]})*))`),h("FULLPLAIN",`v?${b[o.MAINVERSION]}${b[o.PRERELEASE]}?${b[o.BUILD]}?`),h("FULL",`^${b[o.FULLPLAIN]}$`),h("LOOSEPLAIN",`[v=\\s]*${b[o.MAINVERSIONLOOSE]}${b[o.PRERELEASELOOSE]}?${b[o.BUILD]}?`),h("LOOSE",`^${b[o.LOOSEPLAIN]}$`),h("GTLT","((?:<|>)?=?)"),h("XRANGEIDENTIFIERLOOSE",`${b[o.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h("XRANGEIDENTIFIER",`${b[o.NUMERICIDENTIFIER]}|x|X|\\*`),h("XRANGEPLAIN",`[v=\\s]*(${b[o.XRANGEIDENTIFIER]})(?:\\.(${b[o.XRANGEIDENTIFIER]})(?:\\.(${b[o.XRANGEIDENTIFIER]})(?:${b[o.PRERELEASE]})?${b[o.BUILD]}?)?)?`),h("XRANGEPLAINLOOSE",`[v=\\s]*(${b[o.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[o.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[o.XRANGEIDENTIFIERLOOSE]})(?:${b[o.PRERELEASELOOSE]})?${b[o.BUILD]}?)?)?`),h("XRANGE",`^${b[o.GTLT]}\\s*${b[o.XRANGEPLAIN]}$`),h("XRANGELOOSE",`^${b[o.GTLT]}\\s*${b[o.XRANGEPLAINLOOSE]}$`),h("COERCEPLAIN",`(^|[^\\d])(\\d{1,${c}})(?:\\.(\\d{1,${c}}))?(?:\\.(\\d{1,${c}}))?`),h("COERCE",`${b[o.COERCEPLAIN]}(?:$|[^\\d])`),h("COERCEFULL",b[o.COERCEPLAIN]+`(?:${b[o.PRERELEASE]})?`+`(?:${b[o.BUILD]})?(?:$|[^\\d])`),h("COERCERTL",b[o.COERCE],!0),h("COERCERTLFULL",b[o.COERCEFULL],!0),h("LONETILDE","(?:~>?)"),h("TILDETRIM",`(\\s*)${b[o.LONETILDE]}\\s+`,!0),a.tildeTrimReplace="$1~",h("TILDE",`^${b[o.LONETILDE]}${b[o.XRANGEPLAIN]}$`),h("TILDELOOSE",`^${b[o.LONETILDE]}${b[o.XRANGEPLAINLOOSE]}$`),h("LONECARET","(?:\\^)"),h("CARETTRIM",`(\\s*)${b[o.LONECARET]}\\s+`,!0),a.caretTrimReplace="$1^",h("CARET",`^${b[o.LONECARET]}${b[o.XRANGEPLAIN]}$`),h("CARETLOOSE",`^${b[o.LONECARET]}${b[o.XRANGEPLAINLOOSE]}$`),h("COMPARATORLOOSE",`^${b[o.GTLT]}\\s*(${b[o.LOOSEPLAIN]})$|^$`),h("COMPARATOR",`^${b[o.GTLT]}\\s*(${b[o.FULLPLAIN]})$|^$`),h("COMPARATORTRIM",`(\\s*)${b[o.GTLT]}\\s*(${b[o.LOOSEPLAIN]}|${b[o.XRANGEPLAIN]})`,!0),a.comparatorTrimReplace="$1$2$3",h("HYPHENRANGE",`^\\s*(${b[o.XRANGEPLAIN]})\\s+-\\s+(${b[o.XRANGEPLAIN]})\\s*$`),h("HYPHENRANGELOOSE",`^\\s*(${b[o.XRANGEPLAINLOOSE]})\\s+-\\s+(${b[o.XRANGEPLAINLOOSE]})\\s*$`),h("STAR","(<|>)?=?\\s*\\*"),h("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),h("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},14316:(e,a,t)=>{const c=t(22944);e.exports=(e,a,t)=>c(e,a,">",t)},48337:(e,a,t)=>{const c=t(25926);e.exports=(e,a,t)=>(e=new c(e,t),a=new c(a,t),e.intersects(a,t))},12373:(e,a,t)=>{const c=t(22944);e.exports=(e,a,t)=>c(e,a,"<",t)},83777:(e,a,t)=>{const c=t(64739),f=t(25926);e.exports=(e,a,t)=>{let d=null,r=null,n=null;try{n=new f(a,t)}catch(e){return null}return e.forEach((e=>{n.test(e)&&(d&&-1!==r.compare(e)||(d=e,r=new c(d,t)))})),d}},63099:(e,a,t)=>{const c=t(64739),f=t(25926);e.exports=(e,a,t)=>{let d=null,r=null,n=null;try{n=new f(a,t)}catch(e){return null}return e.forEach((e=>{n.test(e)&&(d&&1!==r.compare(e)||(d=e,r=new c(d,t)))})),d}},36258:(e,a,t)=>{const c=t(64739),f=t(25926),d=t(90047);e.exports=(e,a)=>{e=new f(e,a);let t=new c("0.0.0");if(e.test(t))return t;if(t=new c("0.0.0-0"),e.test(t))return t;t=null;for(let a=0;a{const a=new c(e.semver.version);switch(e.operator){case">":0===a.prerelease.length?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":r&&!d(a,r)||(r=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!r||t&&!d(t,r)||(t=r)}return t&&e.test(t)?t:null}},22944:(e,a,t)=>{const c=t(64739),f=t(52139),{ANY:d}=f,r=t(25926),n=t(52643),i=t(90047),b=t(15960),o=t(99925),s=t(70668);e.exports=(e,a,t,l)=>{let u,h,p,g,m;switch(e=new c(e,l),a=new r(a,l),t){case">":u=i,h=o,p=b,g=">",m=">=";break;case"<":u=b,h=s,p=i,g="<",m="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(n(e,a,l))return!1;for(let t=0;t{e.semver===d&&(e=new f(">=0.0.0")),r=r||e,n=n||e,u(e.semver,r.semver,l)?r=e:p(e.semver,n.semver,l)&&(n=e)})),r.operator===g||r.operator===m)return!1;if((!n.operator||n.operator===g)&&h(e,n.semver))return!1;if(n.operator===m&&p(e,n.semver))return!1}return!0}},72196:(e,a,t)=>{const c=t(52643),f=t(8317);e.exports=(e,a,t)=>{const d=[];let r=null,n=null;const i=e.sort(((e,a)=>f(e,a,t)));for(const e of i)c(e,a,t)?(n=e,r||(r=e)):(n&&d.push([r,n]),n=null,r=null);r&&d.push([r,null]);const b=[];for(const[e,a]of d)e===a?b.push(e):a||e!==i[0]?a?e===i[0]?b.push(`<=${a}`):b.push(`${e} - ${a}`):b.push(`>=${e}`):b.push("*");const o=b.join(" || "),s="string"==typeof a.raw?a.raw:String(a);return o.length{const c=t(25926),f=t(52139),{ANY:d}=f,r=t(52643),n=t(8317),i=[new f(">=0.0.0-0")],b=[new f(">=0.0.0")],o=(e,a,t)=>{if(e===a)return!0;if(1===e.length&&e[0].semver===d){if(1===a.length&&a[0].semver===d)return!0;e=t.includePrerelease?i:b}if(1===a.length&&a[0].semver===d){if(t.includePrerelease)return!0;a=b}const c=new Set;let f,o,u,h,p,g,m;for(const a of e)">"===a.operator||">="===a.operator?f=s(f,a,t):"<"===a.operator||"<="===a.operator?o=l(o,a,t):c.add(a.semver);if(c.size>1)return null;if(f&&o){if(u=n(f.semver,o.semver,t),u>0)return null;if(0===u&&(">="!==f.operator||"<="!==o.operator))return null}for(const e of c){if(f&&!r(e,String(f),t))return null;if(o&&!r(e,String(o),t))return null;for(const c of a)if(!r(e,String(c),t))return!1;return!0}let x=!(!o||t.includePrerelease||!o.semver.prerelease.length)&&o.semver,y=!(!f||t.includePrerelease||!f.semver.prerelease.length)&&f.semver;x&&1===x.prerelease.length&&"<"===o.operator&&0===x.prerelease[0]&&(x=!1);for(const e of a){if(m=m||">"===e.operator||">="===e.operator,g=g||"<"===e.operator||"<="===e.operator,f)if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),">"===e.operator||">="===e.operator){if(h=s(f,e,t),h===e&&h!==f)return!1}else if(">="===f.operator&&!r(f.semver,String(e),t))return!1;if(o)if(x&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===x.major&&e.semver.minor===x.minor&&e.semver.patch===x.patch&&(x=!1),"<"===e.operator||"<="===e.operator){if(p=l(o,e,t),p===e&&p!==o)return!1}else if("<="===o.operator&&!r(o.semver,String(e),t))return!1;if(!e.operator&&(o||f)&&0!==u)return!1}return!(f&&g&&!o&&0!==u||o&&m&&!f&&0!==u||y||x)},s=(e,a,t)=>{if(!e)return a;const c=n(e.semver,a.semver,t);return c>0?e:c<0||">"===a.operator&&">="===e.operator?a:e},l=(e,a,t)=>{if(!e)return a;const c=n(e.semver,a.semver,t);return c<0?e:c>0||"<"===a.operator&&"<="===e.operator?a:e};e.exports=(e,a,t={})=>{if(e===a)return!0;e=new c(e,t),a=new c(a,t);let f=!1;e:for(const c of e.set){for(const e of a.set){const a=o(c,e,t);if(f=f||null!==a,a)continue e}if(f)return!1}return!0}},24054:(e,a,t)=>{const c=t(25926);e.exports=(e,a)=>new c(e,a).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")))},77529:(e,a,t)=>{const c=t(25926);e.exports=(e,a)=>{try{return new c(e,a).range||"*"}catch(e){return null}}},25084:e=>{"use strict";e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var a=new Uint8Array(256),t=0;t>>0,b=new Uint8Array(d);e[t];){var o=a[e.charCodeAt(t)];if(255===o)return;for(var s=0,l=d-1;(0!==o||s>>0,b[l]=o%256>>>0,o=o/256>>>0;if(0!==o)throw new Error("Non-zero carry");f=s,t++}if(" "!==e[t]){for(var u=d-f;u!==d&&0===b[u];)u++;for(var h=new Uint8Array(c+(d-u)),p=c;u!==d;)h[p++]=b[u++];return h}}}return{encode:function(a){if(a instanceof Uint8Array||(ArrayBuffer.isView(a)?a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength):Array.isArray(a)&&(a=Uint8Array.from(a))),!(a instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===a.length)return"";for(var t=0,c=0,f=0,d=a.length;f!==d&&0===a[f];)f++,t++;for(var i=(d-f)*b+1>>>0,o=new Uint8Array(i);f!==d;){for(var s=a[f],l=0,u=i-1;(0!==s||l>>0,o[u]=s%r>>>0,s=s/r>>>0;if(0!==s)throw new Error("Non-zero carry");c=l,f++}for(var h=i-c;h!==i&&0===o[h];)h++;for(var p=n.repeat(t);h{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.createCurve=a.getHash=void 0;const c=t(39615),f=t(99175),d=t(91705);function r(e){return{hash:e,hmac:(a,...t)=>(0,c.hmac)(e,a,(0,f.concatBytes)(...t)),randomBytes:f.randomBytes}}a.getHash=r,a.createCurve=function(e,a){const t=a=>(0,d.weierstrass)({...e,...r(a)});return Object.freeze({...t(a),create:t})}},62422:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.validateBasic=a.wNAF=void 0;const c=t(24967),f=t(91484),d=BigInt(0),r=BigInt(1);a.wNAF=function(e,a){const t=(e,a)=>{const t=a.negate();return e?t:a},c=e=>({windows:Math.ceil(a/e)+1,windowSize:2**(e-1)});return{constTimeNegate:t,unsafeLadder(a,t){let c=e.ZERO,f=a;for(;t>d;)t&r&&(c=c.add(f)),f=f.double(),t>>=r;return c},precomputeWindow(e,a){const{windows:t,windowSize:f}=c(a),d=[];let r=e,n=r;for(let e=0;e>=u,c>i&&(c-=l,d+=r);const n=a,h=a+Math.abs(c)-1,p=e%2!=0,g=c<0;0===c?o=o.add(t(p,f[n])):b=b.add(t(g,f[h]))}return{p:b,f:o}},wNAFCached(e,a,t,c){const f=e._WINDOW_SIZE||1;let d=a.get(e);return d||(d=this.precomputeWindow(e,f),1!==f&&a.set(e,c(d))),this.wNAF(f,d,t)}}},a.validateBasic=function(e){return(0,c.validateField)(e.Fp),(0,f.validateObject)(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,c.nLength)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}},71761:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.createHasher=a.isogenyMap=a.hash_to_field=a.expand_message_xof=a.expand_message_xmd=void 0;const c=t(24967),f=t(91484),d=f.bytesToNumberBE;function r(e,a){if(e<0||e>=1<<8*a)throw new Error(`bad I2OSP call: value=${e} length=${a}`);const t=Array.from({length:a}).fill(0);for(let c=a-1;c>=0;c--)t[c]=255&e,e>>>=8;return new Uint8Array(t)}function n(e,a){const t=new Uint8Array(e.length);for(let c=0;c255&&(a=c((0,f.concatBytes)((0,f.utf8ToBytes)("H2C-OVERSIZE-DST-"),a)));const{outputLen:d,blockLen:o}=c,s=Math.ceil(t/d);if(s>255)throw new Error("Invalid xmd length");const l=(0,f.concatBytes)(a,r(a.length,1)),u=r(0,o),h=r(t,2),p=new Array(s),g=c((0,f.concatBytes)(u,e,h,r(0,1),l));p[0]=c((0,f.concatBytes)(g,r(1,1),l));for(let e=1;e<=s;e++){const a=[n(g,p[e-1]),r(e+1,1),l];p[e]=c((0,f.concatBytes)(...a))}return(0,f.concatBytes)(...p).slice(0,t)}function s(e,a,t,c,d){if(i(e),i(a),b(t),a.length>255){const e=Math.ceil(2*c/8);a=d.create({dkLen:e}).update((0,f.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(a).digest()}if(t>65535||a.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return d.create({dkLen:t}).update(e).update(r(t,2)).update(a).update(r(a.length,1)).digest()}function l(e,a,t){(0,f.validateObject)(t,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:r,k:n,m:l,hash:u,expand:h,DST:p}=t;i(e),b(a);const g=function(e){if(e instanceof Uint8Array)return e;if("string"==typeof e)return(0,f.utf8ToBytes)(e);throw new Error("DST must be Uint8Array or string")}(p),m=r.toString(2).length,x=Math.ceil((m+n)/8),y=a*l*x;let A;if("xmd"===h)A=o(e,g,y,u);else if("xof"===h)A=s(e,g,y,n,u);else{if("_internal_pass"!==h)throw new Error('expand must be "xmd" or "xof"');A=e}const v=new Array(a);for(let e=0;eArray.from(e).reverse()));return(a,c)=>{const[f,d,r,n]=t.map((t=>t.reduce(((t,c)=>e.add(e.mul(t,a),c)))));return a=e.div(f,d),c=e.mul(c,e.div(r,n)),{x:a,y:c}}},a.createHasher=function(e,a,t){if("function"!=typeof a)throw new Error("mapToCurve() must be defined");return{hashToCurve(c,f){const d=l(c,2,{...t,DST:t.DST,...f}),r=e.fromAffine(a(d[0])),n=e.fromAffine(a(d[1])),i=r.add(n).clearCofactor();return i.assertValidity(),i},encodeToCurve(c,f){const d=l(c,1,{...t,DST:t.encodeDST,...f}),r=e.fromAffine(a(d[0])).clearCofactor();return r.assertValidity(),r}}}},24967:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.mapHashToField=a.getMinHashLength=a.getFieldBytesLength=a.hashToPrivateScalar=a.FpSqrtEven=a.FpSqrtOdd=a.Field=a.nLength=a.FpIsSquare=a.FpDiv=a.FpInvertBatch=a.FpPow=a.validateField=a.isNegativeLE=a.FpSqrt=a.tonelliShanks=a.invert=a.pow2=a.pow=a.mod=void 0;const c=t(91484),f=BigInt(0),d=BigInt(1),r=BigInt(2),n=BigInt(3),i=BigInt(4),b=BigInt(5),o=BigInt(8);function s(e,a){const t=e%a;return t>=f?t:a+t}function l(e,a,t){if(t<=f||a 0");if(t===d)return f;let c=d;for(;a>f;)a&d&&(c=c*e%t),e=e*e%t,a>>=d;return c}function u(e,a){if(e===f||a<=f)throw new Error(`invert: expected positive integers, got n=${e} mod=${a}`);let t=s(e,a),c=a,r=f,n=d,i=d,b=f;for(;t!==f;){const e=c/t,a=c%t,f=r-i*e,d=n-b*e;c=t,t=a,r=i,n=b,i=f,b=d}if(c!==d)throw new Error("invert: does not exist");return s(r,a)}function h(e){const a=(e-d)/r;let t,c,n;for(t=e-d,c=0;t%r===f;t/=r,c++);for(n=r;nf;)c*=c,c%=t;return c},a.invert=u,a.tonelliShanks=h,a.FpSqrt=p,a.isNegativeLE=(e,a)=>(s(e,a)&d)===d;const g=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function m(e,a,t){if(t 0");if(t===f)return e.ONE;if(t===d)return a;let c=e.ONE,r=a;for(;t>f;)t&d&&(c=e.mul(c,r)),r=e.sqr(r),t>>=d;return c}function x(e,a){const t=new Array(a.length),c=a.reduce(((a,c,f)=>e.is0(c)?a:(t[f]=a,e.mul(a,c))),e.ONE),f=e.inv(c);return a.reduceRight(((a,c,f)=>e.is0(c)?a:(t[f]=e.mul(a,t[f]),e.mul(a,c))),f),t}function y(e,a){const t=void 0!==a?a:e.toString(2).length;return{nBitLength:t,nByteLength:Math.ceil(t/8)}}function A(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const a=e.toString(2).length;return Math.ceil(a/8)}function v(e){const a=A(e);return a+Math.ceil(a/2)}a.validateField=function(e){const a=g.reduce(((e,a)=>(e[a]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});return(0,c.validateObject)(e,a)},a.FpPow=m,a.FpInvertBatch=x,a.FpDiv=function(e,a,t){return e.mul(a,"bigint"==typeof t?u(t,e.ORDER):e.inv(t))},a.FpIsSquare=function(e){const a=(e.ORDER-d)/r;return t=>{const c=e.pow(t,a);return e.eql(c,e.ZERO)||e.eql(c,e.ONE)}},a.nLength=y,a.Field=function(e,a,t=!1,r={}){if(e<=f)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:n,nByteLength:i}=y(e,a);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const b=p(e),o=Object.freeze({ORDER:e,BITS:n,BYTES:i,MASK:(0,c.bitMask)(n),ZERO:f,ONE:d,create:a=>s(a,e),isValid:a=>{if("bigint"!=typeof a)throw new Error("Invalid field element: expected bigint, got "+typeof a);return f<=a&&ae===f,isOdd:e=>(e&d)===d,neg:a=>s(-a,e),eql:(e,a)=>e===a,sqr:a=>s(a*a,e),add:(a,t)=>s(a+t,e),sub:(a,t)=>s(a-t,e),mul:(a,t)=>s(a*t,e),pow:(e,a)=>m(o,e,a),div:(a,t)=>s(a*u(t,e),e),sqrN:e=>e*e,addN:(e,a)=>e+a,subN:(e,a)=>e-a,mulN:(e,a)=>e*a,inv:a=>u(a,e),sqrt:r.sqrt||(e=>b(o,e)),invertBatch:e=>x(o,e),cmov:(e,a,t)=>t?a:e,toBytes:e=>t?(0,c.numberToBytesLE)(e,i):(0,c.numberToBytesBE)(e,i),fromBytes:e=>{if(e.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${e.length}`);return t?(0,c.bytesToNumberLE)(e):(0,c.bytesToNumberBE)(e)}});return Object.freeze(o)},a.FpSqrtOdd=function(e,a){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const t=e.sqrt(a);return e.isOdd(t)?t:e.neg(t)},a.FpSqrtEven=function(e,a){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const t=e.sqrt(a);return e.isOdd(t)?e.neg(t):t},a.hashToPrivateScalar=function(e,a,t=!1){const f=(e=(0,c.ensureBytes)("privateHash",e)).length,r=y(a).nByteLength+8;if(r<24||f1024)throw new Error(`hashToPrivateScalar: expected ${r}-1024 bytes of input, got ${f}`);return s(t?(0,c.bytesToNumberLE)(e):(0,c.bytesToNumberBE)(e),a-d)+d},a.getFieldBytesLength=A,a.getMinHashLength=v,a.mapHashToField=function(e,a,t=!1){const f=e.length,r=A(a),n=v(a);if(f<16||f1024)throw new Error(`expected ${n}-1024 bytes of input, got ${f}`);const i=s(t?(0,c.bytesToNumberBE)(e):(0,c.bytesToNumberLE)(e),a-d)+d;return t?(0,c.numberToBytesLE)(i,r):(0,c.numberToBytesBE)(i,r)}},91484:(e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.validateObject=a.createHmacDrbg=a.bitMask=a.bitSet=a.bitGet=a.bitLen=a.utf8ToBytes=a.equalBytes=a.concatBytes=a.ensureBytes=a.numberToVarBytesBE=a.numberToBytesLE=a.numberToBytesBE=a.bytesToNumberLE=a.bytesToNumberBE=a.hexToBytes=a.hexToNumber=a.numberToHexUnpadded=a.bytesToHex=void 0;const t=BigInt(0),c=BigInt(1),f=BigInt(2),d=e=>e instanceof Uint8Array,r=Array.from({length:256},((e,a)=>a.toString(16).padStart(2,"0")));function n(e){if(!d(e))throw new Error("Uint8Array expected");let a="";for(let t=0;te+a.length),0));let t=0;return e.forEach((e=>{if(!d(e))throw new Error("Uint8Array expected");a.set(e,t),t+=e.length})),a}a.bytesToHex=n,a.numberToHexUnpadded=i,a.hexToNumber=b,a.hexToBytes=o,a.bytesToNumberBE=function(e){return b(n(e))},a.bytesToNumberLE=function(e){if(!d(e))throw new Error("Uint8Array expected");return b(n(Uint8Array.from(e).reverse()))},a.numberToBytesBE=s,a.numberToBytesLE=function(e,a){return s(e,a).reverse()},a.numberToVarBytesBE=function(e){return o(i(e))},a.ensureBytes=function(e,a,t){let c;if("string"==typeof a)try{c=o(a)}catch(t){throw new Error(`${e} must be valid hex string, got "${a}". Cause: ${t}`)}else{if(!d(a))throw new Error(`${e} must be hex string or Uint8Array`);c=Uint8Array.from(a)}const f=c.length;if("number"==typeof t&&f!==t)throw new Error(`${e} expected ${t} bytes, got ${f}`);return c},a.concatBytes=l,a.equalBytes=function(e,a){if(e.length!==a.length)return!1;for(let t=0;tt;e>>=c,a+=1);return a},a.bitGet=function(e,a){return e>>BigInt(a)&c},a.bitSet=(e,a,f)=>e|(f?c:t)<(f<new Uint8Array(e),h=e=>Uint8Array.from(e);a.createHmacDrbg=function(e,a,t){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof a||a<2)throw new Error("qByteLen must be a number");if("function"!=typeof t)throw new Error("hmacFn must be a function");let c=u(e),f=u(e),d=0;const r=()=>{c.fill(1),f.fill(0),d=0},n=(...e)=>t(f,c,...e),i=(e=u())=>{f=n(h([0]),e),c=n(),0!==e.length&&(f=n(h([1]),e),c=n())},b=()=>{if(d++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const t=[];for(;e{let t;for(r(),i(e);!(t=a(b()));)i();return r(),t}};const p={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||e instanceof Uint8Array,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,a)=>a.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};a.validateObject=function(e,a,t={}){const c=(a,t,c)=>{const f=p[t];if("function"!=typeof f)throw new Error(`Invalid validator "${t}", expected function`);const d=e[a];if(!(c&&void 0===d||f(d,e)))throw new Error(`Invalid param ${String(a)}=${d} (${typeof d}), expected ${t}`)};for(const[e,t]of Object.entries(a))c(e,t,!1);for(const[e,a]of Object.entries(t))c(e,a,!0);return e}},91705:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.mapToCurveSimpleSWU=a.SWUFpSqrtRatio=a.weierstrass=a.weierstrassPoints=a.DER=void 0;const c=t(24967),f=t(91484),d=t(91484),r=t(62422),{bytesToNumberBE:n,hexToBytes:i}=f;a.DER={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(e){const{Err:t}=a.DER;if(e.length<2||2!==e[0])throw new t("Invalid signature integer tag");const c=e[1],f=e.subarray(2,c+2);if(!c||f.length!==c)throw new t("Invalid signature integer: wrong length");if(128&f[0])throw new t("Invalid signature integer: negative");if(0===f[0]&&!(128&f[1]))throw new t("Invalid signature integer: unnecessary leading zero");return{d:n(f),l:e.subarray(c+2)}},toSig(e){const{Err:t}=a.DER,c="string"==typeof e?i(e):e;if(!(c instanceof Uint8Array))throw new Error("ui8a expected");let f=c.length;if(f<2||48!=c[0])throw new t("Invalid signature tag");if(c[1]!==f-2)throw new t("Invalid signature: incorrect length");const{d,l:r}=a.DER._parseInt(c.subarray(2)),{d:n,l:b}=a.DER._parseInt(r);if(b.length)throw new t("Invalid signature: left bytes after parsing");return{r:d,s:n}},hexFromSig(e){const a=e=>8&Number.parseInt(e[0],16)?"00"+e:e,t=e=>{const a=e.toString(16);return 1&a.length?`0${a}`:a},c=a(t(e.s)),f=a(t(e.r)),d=c.length/2,r=f.length/2,n=t(d),i=t(r);return`30${t(r+d+4)}02${i}${f}02${n}${c}`}};const b=BigInt(0),o=BigInt(1),s=BigInt(2),l=BigInt(3),u=BigInt(4);function h(e){const a=function(e){const a=(0,r.validateBasic)(e);f.validateObject(a,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:c,a:d}=a;if(t){if(!c.eql(d,c.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof t||"bigint"!=typeof t.beta||"function"!=typeof t.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...a})}(e),{Fp:t}=a,n=a.toBytes||((e,a,c)=>{const d=a.toAffine();return f.concatBytes(Uint8Array.from([4]),t.toBytes(d.x),t.toBytes(d.y))}),i=a.fromBytes||(e=>{const a=e.subarray(1);return{x:t.fromBytes(a.subarray(0,t.BYTES)),y:t.fromBytes(a.subarray(t.BYTES,2*t.BYTES))}});function s(e){const{a:c,b:f}=a,d=t.sqr(e),r=t.mul(d,e);return t.add(t.add(r,t.mul(e,c)),f)}if(!t.eql(t.sqr(a.Gy),s(a.Gx)))throw new Error("bad generator point: equation left != right");function u(e){return"bigint"==typeof e&&bt.eql(e,t.ZERO);return f(a)&&f(c)?x.ZERO:new x(a,c,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const a=t.invertBatch(e.map((e=>e.pz)));return e.map(((e,t)=>e.toAffine(a[t]))).map(x.fromAffine)}static fromHex(e){const a=x.fromAffine(i((0,d.ensureBytes)("pointHex",e)));return a.assertValidity(),a}static fromPrivateKey(e){return x.BASE.multiply(p(e))}_setWindowSize(e){this._WINDOW_SIZE=e,g.delete(this)}assertValidity(){if(this.is0()){if(a.allowInfinityPoint&&!t.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:e,y:c}=this.toAffine();if(!t.isValid(e)||!t.isValid(c))throw new Error("bad point: x or y not FE");const f=t.sqr(c),d=s(e);if(!t.eql(f,d))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:e}=this.toAffine();if(t.isOdd)return!t.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){m(e);const{px:a,py:c,pz:f}=this,{px:d,py:r,pz:n}=e,i=t.eql(t.mul(a,n),t.mul(d,f)),b=t.eql(t.mul(c,n),t.mul(r,f));return i&&b}negate(){return new x(this.px,t.neg(this.py),this.pz)}double(){const{a:e,b:c}=a,f=t.mul(c,l),{px:d,py:r,pz:n}=this;let i=t.ZERO,b=t.ZERO,o=t.ZERO,s=t.mul(d,d),u=t.mul(r,r),h=t.mul(n,n),p=t.mul(d,r);return p=t.add(p,p),o=t.mul(d,n),o=t.add(o,o),i=t.mul(e,o),b=t.mul(f,h),b=t.add(i,b),i=t.sub(u,b),b=t.add(u,b),b=t.mul(i,b),i=t.mul(p,i),o=t.mul(f,o),h=t.mul(e,h),p=t.sub(s,h),p=t.mul(e,p),p=t.add(p,o),o=t.add(s,s),s=t.add(o,s),s=t.add(s,h),s=t.mul(s,p),b=t.add(b,s),h=t.mul(r,n),h=t.add(h,h),s=t.mul(h,p),i=t.sub(i,s),o=t.mul(h,u),o=t.add(o,o),o=t.add(o,o),new x(i,b,o)}add(e){m(e);const{px:c,py:f,pz:d}=this,{px:r,py:n,pz:i}=e;let b=t.ZERO,o=t.ZERO,s=t.ZERO;const u=a.a,h=t.mul(a.b,l);let p=t.mul(c,r),g=t.mul(f,n),y=t.mul(d,i),A=t.add(c,f),v=t.add(r,n);A=t.mul(A,v),v=t.add(p,g),A=t.sub(A,v),v=t.add(c,d);let w=t.add(r,i);return v=t.mul(v,w),w=t.add(p,y),v=t.sub(v,w),w=t.add(f,d),b=t.add(n,i),w=t.mul(w,b),b=t.add(g,y),w=t.sub(w,b),s=t.mul(u,v),b=t.mul(h,y),s=t.add(b,s),b=t.sub(g,s),s=t.add(g,s),o=t.mul(b,s),g=t.add(p,p),g=t.add(g,p),y=t.mul(u,y),v=t.mul(h,v),g=t.add(g,y),y=t.sub(p,y),y=t.mul(u,y),v=t.add(v,y),p=t.mul(g,v),o=t.add(o,p),p=t.mul(w,v),b=t.mul(A,b),b=t.sub(b,p),p=t.mul(A,g),s=t.mul(w,s),s=t.add(s,p),new x(b,o,s)}subtract(e){return this.add(e.negate())}is0(){return this.equals(x.ZERO)}wNAF(e){return A.wNAFCached(this,g,e,(e=>{const a=t.invertBatch(e.map((e=>e.pz)));return e.map(((e,t)=>e.toAffine(a[t]))).map(x.fromAffine)}))}multiplyUnsafe(e){const c=x.ZERO;if(e===b)return c;if(h(e),e===o)return this;const{endo:f}=a;if(!f)return A.unsafeLadder(this,e);let{k1neg:d,k1:r,k2neg:n,k2:i}=f.splitScalar(e),s=c,l=c,u=this;for(;r>b||i>b;)r&o&&(s=s.add(u)),i&o&&(l=l.add(u)),u=u.double(),r>>=o,i>>=o;return d&&(s=s.negate()),n&&(l=l.negate()),l=new x(t.mul(l.px,f.beta),l.py,l.pz),s.add(l)}multiply(e){h(e);let c,f,d=e;const{endo:r}=a;if(r){const{k1neg:e,k1:a,k2neg:n,k2:i}=r.splitScalar(d);let{p:b,f:o}=this.wNAF(a),{p:s,f:l}=this.wNAF(i);b=A.constTimeNegate(e,b),s=A.constTimeNegate(n,s),s=new x(t.mul(s.px,r.beta),s.py,s.pz),c=b.add(s),f=o.add(l)}else{const{p:e,f:a}=this.wNAF(d);c=e,f=a}return x.normalizeZ([c,f])[0]}multiplyAndAddUnsafe(e,a,t){const c=x.BASE,f=(e,a)=>a!==b&&a!==o&&e.equals(c)?e.multiply(a):e.multiplyUnsafe(a),d=f(this,a).add(f(e,t));return d.is0()?void 0:d}toAffine(e){const{px:a,py:c,pz:f}=this,d=this.is0();null==e&&(e=d?t.ONE:t.inv(f));const r=t.mul(a,e),n=t.mul(c,e),i=t.mul(f,e);if(d)return{x:t.ZERO,y:t.ZERO};if(!t.eql(i,t.ONE))throw new Error("invZ was invalid");return{x:r,y:n}}isTorsionFree(){const{h:e,isTorsionFree:t}=a;if(e===o)return!0;if(t)return t(x,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:t}=a;return e===o?this:t?t(x,this):this.multiplyUnsafe(a.h)}toRawBytes(e=!0){return this.assertValidity(),n(x,this,e)}toHex(e=!0){return f.bytesToHex(this.toRawBytes(e))}}x.BASE=new x(a.Gx,a.Gy,t.ONE),x.ZERO=new x(t.ZERO,t.ONE,t.ZERO);const y=a.nBitLength,A=(0,r.wNAF)(x,a.endo?Math.ceil(y/2):y);return{CURVE:a,ProjectivePoint:x,normPrivateKeyToScalar:p,weierstrassEquation:s,isWithinCurveOrder:u}}function p(e,a){const t=e.ORDER;let c=b;for(let e=t-o;e%s===b;e/=s)c+=o;const f=c,d=s<{let c=g,d=e.pow(t,h),r=e.sqr(d);r=e.mul(r,t);let n=e.mul(a,r);n=e.pow(n,i),n=e.mul(n,d),d=e.mul(n,t),r=e.mul(n,a);let b=e.mul(r,d);n=e.pow(b,p);let l=e.eql(n,e.ONE);d=e.mul(r,m),n=e.mul(b,c),r=e.cmov(d,r,l),b=e.cmov(n,b,l);for(let a=f;a>o;a--){let t=a-s;t=s<{let d=e.sqr(f);const r=e.mul(a,f);d=e.mul(d,r);let n=e.pow(d,t);n=e.mul(n,r);const i=e.mul(n,c),b=e.mul(e.sqr(n),f),o=e.eql(b,a);return{isValid:o,value:e.cmov(i,n,o)}}}return x}a.weierstrassPoints=h,a.weierstrass=function(e){const t=function(e){const a=(0,r.validateBasic)(e);return f.validateObject(a,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...a})}(e),{Fp:n,n:i}=t,s=n.BYTES+1,l=2*n.BYTES+1;function u(e){return c.mod(e,i)}function p(e){return c.invert(e,i)}const{ProjectivePoint:g,normPrivateKeyToScalar:m,weierstrassEquation:x,isWithinCurveOrder:y}=h({...t,toBytes(e,a,t){const c=a.toAffine(),d=n.toBytes(c.x),r=f.concatBytes;return t?r(Uint8Array.from([a.hasEvenY()?2:3]),d):r(Uint8Array.from([4]),d,n.toBytes(c.y))},fromBytes(e){const a=e.length,t=e[0],c=e.subarray(1);if(a!==s||2!==t&&3!==t){if(a===l&&4===t)return{x:n.fromBytes(c.subarray(0,n.BYTES)),y:n.fromBytes(c.subarray(n.BYTES,2*n.BYTES))};throw new Error(`Point of length ${a} was invalid. Expected ${s} compressed bytes or ${l} uncompressed bytes`)}{const e=f.bytesToNumberBE(c);if(!(b<(d=e)&&df.bytesToHex(f.numberToBytesBE(e,t.nByteLength));function v(e){return e>i>>o}const w=(e,a,t)=>f.bytesToNumberBE(e.slice(a,t));class _{constructor(e,a,t){this.r=e,this.s=a,this.recovery=t,this.assertValidity()}static fromCompact(e){const a=t.nByteLength;return e=(0,d.ensureBytes)("compactSignature",e,2*a),new _(w(e,0,a),w(e,a,2*a))}static fromDER(e){const{r:t,s:c}=a.DER.toSig((0,d.ensureBytes)("DER",e));return new _(t,c)}assertValidity(){if(!y(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!y(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(e){return new _(this.r,this.s,e)}recoverPublicKey(e){const{r:a,s:c,recovery:f}=this,r=M((0,d.ensureBytes)("msgHash",e));if(null==f||![0,1,2,3].includes(f))throw new Error("recovery id invalid");const i=2===f||3===f?a+t.n:a;if(i>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const b=1&f?"03":"02",o=g.fromHex(b+A(i)),s=p(i),l=u(-r*s),h=u(c*s),m=g.BASE.multiplyAndAddUnsafe(o,l,h);if(!m)throw new Error("point at infinify");return m.assertValidity(),m}hasHighS(){return v(this.s)}normalizeS(){return this.hasHighS()?new _(this.r,u(-this.s),this.recovery):this}toDERRawBytes(){return f.hexToBytes(this.toDERHex())}toDERHex(){return a.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return f.hexToBytes(this.toCompactHex())}toCompactHex(){return A(this.r)+A(this.s)}}const I={isValidPrivateKey(e){try{return m(e),!0}catch(e){return!1}},normPrivateKeyToScalar:m,randomPrivateKey:()=>{const e=c.getMinHashLength(t.n);return c.mapHashToField(t.randomBytes(e),t.n)},precompute:(e=8,a=g.BASE)=>(a._setWindowSize(e),a.multiply(BigInt(3)),a)};function E(e){const a=e instanceof Uint8Array,t="string"==typeof e,c=(a||t)&&e.length;return a?c===s||c===l:t?c===2*s||c===2*l:e instanceof g}const C=t.bits2int||function(e){const a=f.bytesToNumberBE(e),c=8*e.length-t.nBitLength;return c>0?a>>BigInt(c):a},M=t.bits2int_modN||function(e){return u(C(e))},B=f.bitMask(t.nBitLength);function k(e){if("bigint"!=typeof e)throw new Error("bigint expected");if(!(b<=e&&ee in c)))throw new Error("sign() legacy options not supported");const{hash:r,randomBytes:i}=t;let{lowS:s,prehash:l,extraEntropy:h}=c;null==s&&(s=!0),e=(0,d.ensureBytes)("msgHash",e),l&&(e=(0,d.ensureBytes)("prehashed msgHash",r(e)));const x=M(e),A=m(a),w=[k(A),k(x)];if(null!=h){const e=!0===h?i(n.BYTES):h;w.push((0,d.ensureBytes)("extraEntropy",e))}const I=f.concatBytes(...w),E=x;return{seed:I,k2sig:function(e){const a=C(e);if(!y(a))return;const t=p(a),c=g.BASE.multiply(a).toAffine(),f=u(c.x);if(f===b)return;const d=u(t*u(E+f*A));if(d===b)return;let r=(c.x===f?0:2)|Number(c.y&o),n=d;return s&&v(d)&&(n=function(e){return v(e)?u(-e):e}(d),r^=1),new _(f,n,r)}}}(e,a,c),s=t;return f.createHmacDrbg(s.hash.outputLen,s.nByteLength,s.hmac)(r,i)},verify:function(e,c,f,r=S){const n=e;if(c=(0,d.ensureBytes)("msgHash",c),f=(0,d.ensureBytes)("publicKey",f),"strict"in r)throw new Error("options.strict was renamed to lowS");const{lowS:i,prehash:b}=r;let o,s;try{if("string"==typeof n||n instanceof Uint8Array)try{o=_.fromDER(n)}catch(e){if(!(e instanceof a.DER.Err))throw e;o=_.fromCompact(n)}else{if("object"!=typeof n||"bigint"!=typeof n.r||"bigint"!=typeof n.s)throw new Error("PARSE");{const{r:e,s:a}=n;o=new _(e,a)}}s=g.fromHex(f)}catch(e){if("PARSE"===e.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(i&&o.hasHighS())return!1;b&&(c=t.hash(c));const{r:l,s:h}=o,m=M(c),x=p(h),y=u(m*x),A=u(l*x),v=g.BASE.multiplyAndAddUnsafe(s,y,A)?.toAffine();return!!v&&u(v.x)===l},ProjectivePoint:g,Signature:_,utils:I}},a.SWUFpSqrtRatio=p,a.mapToCurveSimpleSWU=function(e,a){if(c.validateField(e),!e.isValid(a.A)||!e.isValid(a.B)||!e.isValid(a.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const t=p(e,a.Z);if(!e.isOdd)throw new Error("Fp.isOdd is not implemented!");return c=>{let f,d,r,n,i,b,o,s;f=e.sqr(c),f=e.mul(f,a.Z),d=e.sqr(f),d=e.add(d,f),r=e.add(d,e.ONE),r=e.mul(r,a.B),n=e.cmov(a.Z,e.neg(d),!e.eql(d,e.ZERO)),n=e.mul(n,a.A),d=e.sqr(r),b=e.sqr(n),i=e.mul(b,a.A),d=e.add(d,i),d=e.mul(d,r),b=e.mul(b,n),i=e.mul(b,a.B),d=e.add(d,i),o=e.mul(f,r);const{isValid:l,value:u}=t(d,b);s=e.mul(f,c),s=e.mul(s,u),o=e.cmov(o,r,l),s=e.cmov(s,u,l);const h=e.isOdd(c)===e.isOdd(s);return s=e.cmov(e.neg(s),s,h),o=e.div(o,n),{x:o,y:s}}}},8510:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.encodeToCurve=a.hashToCurve=a.schnorr=a.secp256k1=void 0;const c=t(22623),f=t(99175),d=t(24967),r=t(91705),n=t(91484),i=t(71761),b=t(73562),o=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),s=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),l=BigInt(1),u=BigInt(2),h=(e,a)=>(e+a/u)/a;function p(e){const a=o,t=BigInt(3),c=BigInt(6),f=BigInt(11),r=BigInt(22),n=BigInt(23),i=BigInt(44),b=BigInt(88),s=e*e*e%a,l=s*s*e%a,h=(0,d.pow2)(l,t,a)*l%a,p=(0,d.pow2)(h,t,a)*l%a,m=(0,d.pow2)(p,u,a)*s%a,x=(0,d.pow2)(m,f,a)*m%a,y=(0,d.pow2)(x,r,a)*x%a,A=(0,d.pow2)(y,i,a)*y%a,v=(0,d.pow2)(A,b,a)*A%a,w=(0,d.pow2)(v,i,a)*y%a,_=(0,d.pow2)(w,t,a)*l%a,I=(0,d.pow2)(_,n,a)*x%a,E=(0,d.pow2)(I,c,a)*s%a,C=(0,d.pow2)(E,u,a);if(!g.eql(g.sqr(C),e))throw new Error("Cannot find square root");return C}const g=(0,d.Field)(o,void 0,void 0,{sqrt:p});a.secp256k1=(0,b.createCurve)({a:BigInt(0),b:BigInt(7),Fp:g,n:s,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const a=s,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),c=-l*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),f=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),r=t,n=BigInt("0x100000000000000000000000000000000"),i=h(r*e,a),b=h(-c*e,a);let o=(0,d.mod)(e-i*t-b*f,a),u=(0,d.mod)(-i*c-b*r,a);const p=o>n,g=u>n;if(p&&(o=a-o),g&&(u=a-u),o>n||u>n)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:p,k1:o,k2neg:g,k2:u}}}},c.sha256);const m=BigInt(0),x=e=>"bigint"==typeof e&&me.charCodeAt(0))));t=(0,n.concatBytes)(a,a),y[e]=t}return(0,c.sha256)((0,n.concatBytes)(t,...a))}const v=e=>e.toRawBytes(!0).slice(1),w=e=>(0,n.numberToBytesBE)(e,32),_=e=>(0,d.mod)(e,o),I=e=>(0,d.mod)(e,s),E=a.secp256k1.ProjectivePoint;function C(e){let t=a.secp256k1.utils.normPrivateKeyToScalar(e),c=E.fromPrivateKey(t);return{scalar:c.hasEvenY()?t:I(-t),bytes:v(c)}}function M(e){if(!x(e))throw new Error("bad x: need 0 < x < p");const a=_(e*e);let t=p(_(a*e+BigInt(7)));t%u!==m&&(t=_(-t));const c=new E(e,t,l);return c.assertValidity(),c}function B(...e){return I((0,n.bytesToNumberBE)(A("BIP0340/challenge",...e)))}function k(e,a,t){const c=(0,n.ensureBytes)("signature",e,64),f=(0,n.ensureBytes)("message",a),d=(0,n.ensureBytes)("publicKey",t,32);try{const e=M((0,n.bytesToNumberBE)(d)),a=(0,n.bytesToNumberBE)(c.subarray(0,32));if(!x(a))return!1;const t=(0,n.bytesToNumberBE)(c.subarray(32,64));if(!("bigint"==typeof(o=t)&&m(0,i.isogenyMap)(g,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map((e=>e.map((e=>BigInt(e)))))))(),S=(()=>(0,r.mapToCurveSimpleSWU)(g,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:g.create(BigInt("-11"))}))(),T=(()=>(0,i.createHasher)(a.secp256k1.ProjectivePoint,(e=>{const{x:a,y:t}=S(g.create(e[0]));return L(a,t)}),{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:g.ORDER,m:1,k:128,expand:"xmd",hash:c.sha256}))();a.hashToCurve=T.hashToCurve,a.encodeToCurve=T.encodeToCurve},67557:(e,a)=>{"use strict";function t(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function c(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)}function f(e,...a){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(a.length>0&&!a.includes(e.length))throw new Error(`Expected Uint8Array of length ${a}, not of length=${e.length}`)}function d(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");t(e.outputLen),t(e.blockLen)}function r(e,a=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(a&&e.finished)throw new Error("Hash#digest() has already been called")}function n(e,a){f(e);const t=a.outputLen;if(e.length{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.SHA2=void 0;const c=t(67557),f=t(99175);class d extends f.Hash{constructor(e,a,t,c){super(),this.blockLen=e,this.outputLen=a,this.padOffset=t,this.isLE=c,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,f.createView)(this.buffer)}update(e){(0,c.exists)(this);const{view:a,buffer:t,blockLen:d}=this,r=(e=(0,f.toBytes)(e)).length;for(let c=0;cd-n&&(this.process(t,0),n=0);for(let e=n;e>f&d),n=Number(t&d),i=c?4:0,b=c?0:4;e.setUint32(a+i,r,c),e.setUint32(a+b,n,c)}(t,d-8,BigInt(8*this.length),r),this.process(t,0);const i=(0,f.createView)(e),b=this.outputLen;if(b%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const o=b/4,s=this.get();if(o>s.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.add5L=a.add5H=a.add4H=a.add4L=a.add3H=a.add3L=a.add=a.rotlBL=a.rotlBH=a.rotlSL=a.rotlSH=a.rotr32L=a.rotr32H=a.rotrBL=a.rotrBH=a.rotrSL=a.rotrSH=a.shrSL=a.shrSH=a.toBig=a.split=a.fromBig=void 0;const t=BigInt(2**32-1),c=BigInt(32);function f(e,a=!1){return a?{h:Number(e&t),l:Number(e>>c&t)}:{h:0|Number(e>>c&t),l:0|Number(e&t)}}function d(e,a=!1){let t=new Uint32Array(e.length),c=new Uint32Array(e.length);for(let d=0;dBigInt(e>>>0)<>>0);a.toBig=r;const n=(e,a,t)=>e>>>t;a.shrSH=n;const i=(e,a,t)=>e<<32-t|a>>>t;a.shrSL=i;const b=(e,a,t)=>e>>>t|a<<32-t;a.rotrSH=b;const o=(e,a,t)=>e<<32-t|a>>>t;a.rotrSL=o;const s=(e,a,t)=>e<<64-t|a>>>t-32;a.rotrBH=s;const l=(e,a,t)=>e>>>t-32|a<<64-t;a.rotrBL=l;const u=(e,a)=>a;a.rotr32H=u;const h=(e,a)=>e;a.rotr32L=h;const p=(e,a,t)=>e<>>32-t;a.rotlSH=p;const g=(e,a,t)=>a<>>32-t;a.rotlSL=g;const m=(e,a,t)=>a<>>64-t;a.rotlBH=m;const x=(e,a,t)=>e<>>64-t;function y(e,a,t,c){const f=(a>>>0)+(c>>>0);return{h:e+t+(f/2**32|0)|0,l:0|f}}a.rotlBL=x,a.add=y;const A=(e,a,t)=>(e>>>0)+(a>>>0)+(t>>>0);a.add3L=A;const v=(e,a,t,c)=>a+t+c+(e/2**32|0)|0;a.add3H=v;const w=(e,a,t,c)=>(e>>>0)+(a>>>0)+(t>>>0)+(c>>>0);a.add4L=w;const _=(e,a,t,c,f)=>a+t+c+f+(e/2**32|0)|0;a.add4H=_;const I=(e,a,t,c,f)=>(e>>>0)+(a>>>0)+(t>>>0)+(c>>>0)+(f>>>0);a.add5L=I;const E=(e,a,t,c,f,d)=>a+t+c+f+d+(e/2**32|0)|0;a.add5H=E;const C={fromBig:f,split:d,toBig:r,shrSH:n,shrSL:i,rotrSH:b,rotrSL:o,rotrBH:s,rotrBL:l,rotr32H:u,rotr32L:h,rotlSH:p,rotlSL:g,rotlBH:m,rotlBL:x,add:y,add3L:A,add3H:v,add4L:w,add4H:_,add5H:E,add5L:I};a.default=C},25145:(e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.crypto=void 0,a.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},39615:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.hmac=a.HMAC=void 0;const c=t(67557),f=t(99175);class d extends f.Hash{constructor(e,a){super(),this.finished=!1,this.destroyed=!1,(0,c.hash)(e);const t=(0,f.toBytes)(a);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const d=this.blockLen,r=new Uint8Array(d);r.set(t.length>d?e.create().update(t).digest():t);for(let e=0;enew d(e,a).update(t).digest(),a.hmac.create=(e,a)=>new d(e,a)},22623:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.sha224=a.sha256=void 0;const c=t(90915),f=t(99175),d=(e,a,t)=>e&a^e&t^a&t,r=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),n=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),i=new Uint32Array(64);class b extends c.SHA2{constructor(){super(64,32,8,!1),this.A=0|n[0],this.B=0|n[1],this.C=0|n[2],this.D=0|n[3],this.E=0|n[4],this.F=0|n[5],this.G=0|n[6],this.H=0|n[7]}get(){const{A:e,B:a,C:t,D:c,E:f,F:d,G:r,H:n}=this;return[e,a,t,c,f,d,r,n]}set(e,a,t,c,f,d,r,n){this.A=0|e,this.B=0|a,this.C=0|t,this.D=0|c,this.E=0|f,this.F=0|d,this.G=0|r,this.H=0|n}process(e,a){for(let t=0;t<16;t++,a+=4)i[t]=e.getUint32(a,!1);for(let e=16;e<64;e++){const a=i[e-15],t=i[e-2],c=(0,f.rotr)(a,7)^(0,f.rotr)(a,18)^a>>>3,d=(0,f.rotr)(t,17)^(0,f.rotr)(t,19)^t>>>10;i[e]=d+i[e-7]+c+i[e-16]|0}let{A:t,B:c,C:n,D:b,E:o,F:s,G:l,H:u}=this;for(let e=0;e<64;e++){const a=u+((0,f.rotr)(o,6)^(0,f.rotr)(o,11)^(0,f.rotr)(o,25))+((h=o)&s^~h&l)+r[e]+i[e]|0,p=((0,f.rotr)(t,2)^(0,f.rotr)(t,13)^(0,f.rotr)(t,22))+d(t,c,n)|0;u=l,l=s,s=o,o=b+a|0,b=n,n=c,c=t,t=a+p|0}var h;t=t+this.A|0,c=c+this.B|0,n=n+this.C|0,b=b+this.D|0,o=o+this.E|0,s=s+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(t,c,n,b,o,s,l,u)}roundClean(){i.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class o extends b{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}a.sha256=(0,f.wrapConstructor)((()=>new b)),a.sha224=(0,f.wrapConstructor)((()=>new o))},32955:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.shake256=a.shake128=a.keccak_512=a.keccak_384=a.keccak_256=a.keccak_224=a.sha3_512=a.sha3_384=a.sha3_256=a.sha3_224=a.Keccak=a.keccakP=void 0;const c=t(67557),f=t(22318),d=t(99175),[r,n,i]=[[],[],[]],b=BigInt(0),o=BigInt(1),s=BigInt(2),l=BigInt(7),u=BigInt(256),h=BigInt(113);for(let e=0,a=o,t=1,c=0;e<24;e++){[t,c]=[c,(2*t+3*c)%5],r.push(2*(5*c+t)),n.push((e+1)*(e+2)/2%64);let f=b;for(let e=0;e<7;e++)a=(a<>l)*h)%u,a&s&&(f^=o<<(o<t>32?(0,f.rotlBH)(e,a,t):(0,f.rotlSH)(e,a,t),x=(e,a,t)=>t>32?(0,f.rotlBL)(e,a,t):(0,f.rotlSL)(e,a,t);function y(e,a=24){const t=new Uint32Array(10);for(let c=24-a;c<24;c++){for(let a=0;a<10;a++)t[a]=e[a]^e[a+10]^e[a+20]^e[a+30]^e[a+40];for(let a=0;a<10;a+=2){const c=(a+8)%10,f=(a+2)%10,d=t[f],r=t[f+1],n=m(d,r,1)^t[c],i=x(d,r,1)^t[c+1];for(let t=0;t<50;t+=10)e[a+t]^=n,e[a+t+1]^=i}let a=e[2],f=e[3];for(let t=0;t<24;t++){const c=n[t],d=m(a,f,c),i=x(a,f,c),b=r[t];a=e[b],f=e[b+1],e[b]=d,e[b+1]=i}for(let a=0;a<50;a+=10){for(let c=0;c<10;c++)t[c]=e[a+c];for(let c=0;c<10;c++)e[a+c]^=~t[(c+2)%10]&t[(c+4)%10]}e[0]^=p[c],e[1]^=g[c]}t.fill(0)}a.keccakP=y;class A extends d.Hash{constructor(e,a,t,f=!1,r=24){if(super(),this.blockLen=e,this.suffix=a,this.outputLen=t,this.enableXOF=f,this.rounds=r,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,c.number)(t),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,d.u32)(this.state)}keccak(){y(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){(0,c.exists)(this);const{blockLen:a,state:t}=this,f=(e=(0,d.toBytes)(e)).length;for(let c=0;c=t&&this.keccak();const d=Math.min(t-this.posOut,f-c);e.set(a.subarray(this.posOut,this.posOut+d),c),this.posOut+=d,c+=d}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,c.number)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,c.output)(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:a,suffix:t,outputLen:c,rounds:f,enableXOF:d}=this;return e||(e=new A(a,t,c,d,f)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=f,e.suffix=t,e.outputLen=c,e.enableXOF=d,e.destroyed=this.destroyed,e}}a.Keccak=A;const v=(e,a,t)=>(0,d.wrapConstructor)((()=>new A(a,e,t)));a.sha3_224=v(6,144,28),a.sha3_256=v(6,136,32),a.sha3_384=v(6,104,48),a.sha3_512=v(6,72,64),a.keccak_224=v(1,144,28),a.keccak_256=v(1,136,32),a.keccak_384=v(1,104,48),a.keccak_512=v(1,72,64);const w=(e,a,t)=>(0,d.wrapXOFConstructorWithOpts)(((c={})=>new A(a,e,void 0===c.dkLen?t:c.dkLen,!0)));a.shake128=w(31,168,16),a.shake256=w(31,136,32)},99175:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.randomBytes=a.wrapXOFConstructorWithOpts=a.wrapConstructorWithOpts=a.wrapConstructor=a.checkOpts=a.Hash=a.concatBytes=a.toBytes=a.utf8ToBytes=a.asyncLoop=a.nextTick=a.hexToBytes=a.bytesToHex=a.isLE=a.rotr=a.createView=a.u32=a.u8=void 0;const c=t(25145),f=e=>e instanceof Uint8Array;if(a.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),a.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),a.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),a.rotr=(e,a)=>e<<32-a|e>>>a,a.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!a.isLE)throw new Error("Non little-endian hardware is not supported");const d=Array.from({length:256},((e,a)=>a.toString(16).padStart(2,"0")));function r(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function n(e){if("string"==typeof e&&(e=r(e)),!f(e))throw new Error("expected Uint8Array, got "+typeof e);return e}a.bytesToHex=function(e){if(!f(e))throw new Error("Uint8Array expected");let a="";for(let t=0;t{},a.asyncLoop=async function(e,t,c){let f=Date.now();for(let d=0;d=0&&ee+a.length),0));let t=0;return e.forEach((e=>{if(!f(e))throw new Error("Uint8Array expected");a.set(e,t),t+=e.length})),a},a.Hash=class{clone(){return this._cloneInto()}};const i={}.toString;a.checkOpts=function(e,a){if(void 0!==a&&"[object Object]"!==i.call(a))throw new Error("Options should be object or undefined");return Object.assign(e,a)},a.wrapConstructor=function(e){const a=a=>e().update(n(a)).digest(),t=e();return a.outputLen=t.outputLen,a.blockLen=t.blockLen,a.create=()=>e(),a},a.wrapConstructorWithOpts=function(e){const a=(a,t)=>e(t).update(n(a)).digest(),t=e({});return a.outputLen=t.outputLen,a.blockLen=t.blockLen,a.create=a=>e(a),a},a.wrapXOFConstructorWithOpts=function(e){const a=(a,t)=>e(t).update(n(a)).digest(),t=e({});return a.outputLen=t.outputLen,a.blockLen=t.blockLen,a.create=a=>e(a),a},a.randomBytes=function(e=32){if(c.crypto&&"function"==typeof c.crypto.getRandomValues)return c.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}},63203:(e,a)=>{"use strict";function t(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function c(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function f(...e){const a=e=>e,t=(e,a)=>t=>e(a(t));return{encode:e.map((e=>e.encode)).reduceRight(t,a),decode:e.map((e=>e.decode)).reduce(t,a)}}function d(e){return{encode:a=>{if(!Array.isArray(a)||a.length&&"number"!=typeof a[0])throw new Error("alphabet.encode input should be an array of numbers");return a.map((a=>{if(t(a),a<0||a>=e.length)throw new Error(`Digit index outside alphabet: ${a} (alphabet: ${e.length})`);return e[a]}))},decode:a=>{if(!Array.isArray(a)||a.length&&"string"!=typeof a[0])throw new Error("alphabet.decode input should be array of strings");return a.map((a=>{if("string"!=typeof a)throw new Error(`alphabet.decode: not string element=${a}`);const t=e.indexOf(a);if(-1===t)throw new Error(`Unknown letter: "${a}". Allowed: ${e}`);return t}))}}}function r(e=""){if("string"!=typeof e)throw new Error("join separator should be string");return{encode:a=>{if(!Array.isArray(a)||a.length&&"string"!=typeof a[0])throw new Error("join.encode input should be array of strings");for(let e of a)if("string"!=typeof e)throw new Error(`join.encode: non-string input=${e}`);return a.join(e)},decode:a=>{if("string"!=typeof a)throw new Error("join.decode input should be string");return a.split(e)}}}function n(e,a="="){if(t(e),"string"!=typeof a)throw new Error("padding chr should be string");return{encode(t){if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("padding.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`padding.encode: non-string input=${e}`);for(;t.length*e%8;)t.push(a);return t},decode(t){if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("padding.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`padding.decode: non-string input=${e}`);let c=t.length;if(c*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;c>0&&t[c-1]===a;c--)if(!((c-1)*e%8))throw new Error("Invalid padding: string has too much padding");return t.slice(0,c)}}}function i(e){if("function"!=typeof e)throw new Error("normalize fn should be function");return{encode:e=>e,decode:a=>e(a)}}function b(e,a,c){if(a<2)throw new Error(`convertRadix: wrong from=${a}, base cannot be less than 2`);if(c<2)throw new Error(`convertRadix: wrong to=${c}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let f=0;const d=[],r=Array.from(e);for(r.forEach((e=>{if(t(e),e<0||e>=a)throw new Error(`Wrong integer: ${e}`)}));;){let e=0,t=!0;for(let d=f;da?o(a,e%a):e,s=(e,a)=>e+(a-o(e,a));function l(e,a,c,f){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(a<=0||a>32)throw new Error(`convertRadix2: wrong from=${a}`);if(c<=0||c>32)throw new Error(`convertRadix2: wrong to=${c}`);if(s(a,c)>32)throw new Error(`convertRadix2: carry overflow from=${a} to=${c} carryBits=${s(a,c)}`);let d=0,r=0;const n=2**c-1,i=[];for(const f of e){if(t(f),f>=2**a)throw new Error(`convertRadix2: invalid data word=${f} from=${a}`);if(d=d<32)throw new Error(`convertRadix2: carry overflow pos=${r} from=${a}`);for(r+=a;r>=c;r-=c)i.push((d>>r-c&n)>>>0);d&=2**r-1}if(d=d<=a)throw new Error("Excess padding");if(!f&&d)throw new Error(`Non-zero padding: ${d}`);return f&&r>0&&i.push(d>>>0),i}function u(e){return t(e),{encode:a=>{if(!c(a))throw new Error("radix.encode input should be Uint8Array");return b(Array.from(a),256,e)},decode:a=>{if(!Array.isArray(a)||a.length&&"number"!=typeof a[0])throw new Error("radix.decode input should be array of numbers");return Uint8Array.from(b(a,e,256))}}}function h(e,a=!1){if(t(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(s(8,e)>32||s(e,8)>32)throw new Error("radix2: carry overflow");return{encode:t=>{if(!c(t))throw new Error("radix2.encode input should be Uint8Array");return l(Array.from(t),8,e,!a)},decode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("radix2.decode input should be array of numbers");return Uint8Array.from(l(t,e,8,a))}}}function p(e){if("function"!=typeof e)throw new Error("unsafeWrapper fn should be function");return function(...a){try{return e.apply(null,a)}catch(e){}}}function g(e,a){if(t(e),"function"!=typeof a)throw new Error("checksum fn should be function");return{encode(t){if(!c(t))throw new Error("checksum.encode: input should be Uint8Array");const f=a(t).slice(0,e),d=new Uint8Array(t.length+e);return d.set(t),d.set(f,t.length),d},decode(t){if(!c(t))throw new Error("checksum.decode: input should be Uint8Array");const f=t.slice(0,-e),d=a(f).slice(0,e),r=t.slice(-e);for(let a=0;ae.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")))),a.base64=f(h(6),d("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),n(6),r("")),a.base64nopad=f(h(6),d("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),r("")),a.base64url=f(h(6),d("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),n(6),r("")),a.base64urlnopad=f(h(6),d("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),r(""));const m=e=>f(u(58),d(e),r(""));a.base58=m("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),a.base58flickr=m("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),a.base58xrp=m("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const x=[0,2,3,5,6,7,9,10,11];a.base58xmr={encode(e){let t="";for(let c=0;cf(g(4,(a=>e(e(a)))),a.base58),a.base58check=a.createBase58check;const y=f(d("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),r("")),A=[996825010,642813549,513874426,1027748829,705979059];function v(e){const a=e>>25;let t=(33554431&e)<<5;for(let e=0;e>e&1)&&(t^=A[e]);return t}function w(e,a,t=1){const c=e.length;let f=1;for(let a=0;a126)throw new Error(`Invalid prefix (${e})`);f=v(f)^t>>5}f=v(f);for(let a=0;ac)throw new TypeError(`Length ${f} exceeds limit ${c}`);const d=e.toLowerCase(),r=w(d,t,a);return`${d}1${y.encode(t)}${r}`}function n(e,t=90){if("string"!=typeof e)throw new Error("bech32.decode input should be string, not "+typeof e);if(e.length<8||!1!==t&&e.length>t)throw new TypeError(`Wrong string length: ${e.length} (${e}). Expected (8..${t})`);const c=e.toLowerCase();if(e!==c&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const f=c.lastIndexOf("1");if(0===f||-1===f)throw new Error('Letter "1" must be present between prefix and data only');const d=c.slice(0,f),r=c.slice(f+1);if(r.length<6)throw new Error("Data must be at least 6 characters long");const n=y.decode(r).slice(0,-6),i=w(d,n,a);if(!r.endsWith(i))throw new Error(`Invalid checksum in ${e}: expected "${i}"`);return{prefix:d,words:n}}return{encode:r,decode:n,encodeFromBytes:function(e,a){return r(e,f(a))},decodeToBytes:function(e){const{prefix:a,words:t}=n(e,!1);return{prefix:a,words:t,bytes:c(t)}},decodeUnsafe:p(n),fromWords:c,fromWordsUnsafe:d,toWords:f}}a.bech32=_("bech32"),a.bech32m=_("bech32m"),a.utf8={encode:e=>(new TextDecoder).decode(e),decode:e=>(new TextEncoder).encode(e)},a.hex=f(h(4),d("0123456789abcdef"),r(""),i((e=>{if("string"!=typeof e||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})));const I={utf8:a.utf8,hex:a.hex,base16:a.base16,base32:a.base32,base64:a.base64,base64url:a.base64url,base58:a.base58,base58xmr:a.base58xmr},E="Invalid encoding type. Available types: utf8, hex, base16, base32, base64, base64url, base58, base58xmr";a.bytesToString=(e,a)=>{if("string"!=typeof e||!I.hasOwnProperty(e))throw new TypeError(E);if(!c(a))throw new TypeError("bytesToString() expects Uint8Array");return I[e].encode(a)},a.str=a.bytesToString,a.stringToBytes=(e,a)=>{if(!I.hasOwnProperty(e))throw new TypeError(E);if("string"!=typeof a)throw new TypeError("stringToBytes() expects string");return I[e].decode(a)},a.bytes=a.stringToBytes},7736:(e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.BaseTree=void 0,a.BaseTree=class{get capacity(){return 2**this.levels}get layers(){return this._layers.slice()}get zeros(){return this._zeros.slice()}get elements(){return this._layers[0].slice()}get root(){var e;return null!==(e=this._layers[this.levels][0])&&void 0!==e?e:this._zeros[this.levels]}static indexOf(e,a,t,c){return c?e.findIndex((e=>c(a,e))):e.indexOf(a,t)}insert(e){if(this._layers[0].length>=this.capacity)throw new Error("Tree is full");this.update(this._layers[0].length,e)}bulkInsert(e){if(e.length){if(this._layers[0].length+e.length>this.capacity)throw new Error("Tree is full");for(let a=0;a>=1;const e=this._layers[t-1][2*c],a=this._layers[t-1][2*c+1];this._layers[t][c]=this._hashFn(e,a)}}this.insert(e[e.length-1])}}update(e,a){if(isNaN(Number(e))||e<0||e>this._layers[0].length||e>=this.capacity)throw new Error("Insert index out of bounds: "+e);this._layers[0][e]=a,this._processUpdate(e)}path(e){if(isNaN(Number(e))||e<0||e>=this._layers[0].length)throw new Error("Index out of bounds: "+e);let a=+e;const t=[],c=[],f=[];for(let e=0;e>=1}return{pathElements:t,pathIndices:c,pathPositions:f,pathRoot:this.root}}_buildZeros(){this._zeros=[this.zeroElement];for(let e=1;e<=this.levels;e++)this._zeros[e]=this._hashFn(this._zeros[e-1],this._zeros[e-1])}_processNodes(e,a){const t=e.length;let c=Math.ceil(t/2);const f=new Array(c);c--;const d=t-(t%2^1);let r=0;for(let n=d;n>=0&&void 0!==e[n-1];n-=2){const i=e[n-1],b=n===d&&t%2==1?this._zeros[a-1]:e[n];f[c-r]=this._hashFn(i,b),r++}return f}_processUpdate(e){for(let a=1;a<=this.levels;a++){e>>=1;const t=this._layers[a-1][2*e],c=2*e+1this.capacity)throw new Error("Tree is full");this._hashFn=t,this.zeroElement=c,this._layers=[];const d=a.slice();this._layers=[d],this._buildZeros(),this._buildHashes()}_buildHashes(){for(let e=1;e<=this.levels;e++){const a=this._layers[e-1];this._layers[e]=this._processNodes(a,e)}}bulkInsert(e){if(e.length){if(this._layers[0].length+e.length>this.capacity)throw new Error("Tree is full");for(let a=0;a>=1,this._layers[t][c]=this._hashFn(this._layers[t-1][2*c],this._layers[t-1][2*c+1])}this.insert(e[e.length-1])}}indexOf(e,a){return d.BaseTree.indexOf(this._layers[0],e,0,a)}proof(e){const a=this.indexOf(e);return this.path(a)}getTreeEdge(e){const a=this._layers[0][e];if(void 0===a)throw new Error("Element not found");return{edgePath:this.path(e),edgeElement:a,edgeIndex:e,edgeElementsCount:this._layers[0].length}}getTreeSlices(e=4){const a=this._layers[0].length;let t=Math.ceil(a/e);t%2&&t++;const c=[];for(let e=0;e(e.set(t,[a,this.edgeLeafProof.pathElements[t]]),e)),new Map),this._proofMap.set(this.levels,[0,this.edgeLeafProof.pathRoot])}_buildTree(){const e=this._edgeLeaf.index;if(this._leaves=Array(e).concat(this._leavesAfterEdge),this._proofMap.has(0)){const[e,a]=this._proofMap.get(0);this._leaves[e]=a}this._layers=[this._leaves],this._buildZeros(),this._buildHashes()}_buildHashes(){for(let e=1;e<=this.levels;e++){const a=this._layers[e-1],t=this._processNodes(a,e);if(this._proofMap.has(e)){const[a,c]=this._proofMap.get(e);t[a]||(t[a]=c)}this._layers[e]=t}}update(e,a){if(isNaN(Number(e))||e<0||e>this._layers[0].length||e>=this.capacity)throw new Error("Insert index out of bounds: "+e);if(e=this._layers[0].length)throw new Error("Index out of bounds: "+e);if(e>=1}return{pathElements:c,pathIndices:f,pathPositions:d,pathRoot:this.root}}indexOf(e,a){return d.BaseTree.indexOf(this._layers[0],e,this.edgeIndex,a)}proof(e){const a=this.indexOf(e);return this.path(a)}shiftEdge(e,a){if(this._edgeLeaf.index<=e.edgeIndex)throw new Error(`New edgeIndex should be smaller then ${this._edgeLeaf.index}`);if(a.length!==this._edgeLeaf.index-e.edgeIndex)throw new Error("Elements length should be "+(this._edgeLeaf.index-e.edgeIndex));this._edgeLeafProof=e.edgePath,this._edgeLeaf={index:e.edgeIndex,data:e.edgeElement},this._leavesAfterEdge=[...a,...this._leavesAfterEdge],this._createProofMap(),this._buildTree()}serialize(){return{_edgeLeafProof:this._edgeLeafProof,_edgeLeaf:this._edgeLeaf,_layers:this._layers,_zeros:this._zeros,levels:this.levels}}static deserialize(e,a){const t=Object.assign(Object.create(this.prototype),e);return t._hashFn=a||f.default,t._initialRoot=e._edgeLeafProof.pathRoot,t.zeroElement=t._zeros[0],t._leavesAfterEdge=t._layers[0].slice(e._edgeLeaf.index),t._createProofMap(),t}toString(){return JSON.stringify(this.serialize())}}a.PartialMerkleTree=r},41217:function(e,a,t){"use strict";var c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(a,"__esModule",{value:!0}),a.MerkleTree=a.simpleHash=a.PartialMerkleTree=void 0;const f=c(t(9093));Object.defineProperty(a,"MerkleTree",{enumerable:!0,get:function(){return f.default}});var d=t(91230);Object.defineProperty(a,"PartialMerkleTree",{enumerable:!0,get:function(){return d.PartialMerkleTree}});var r=t(5319);Object.defineProperty(a,"simpleHash",{enumerable:!0,get:function(){return r.simpleHash}}),a.default=f.default},5319:(e,a)=>{"use strict";function t(e,a,t=40){const c=e.join("");let f,d,r=null!=a?a:34658180293;for(f=0,d=c.length;f>>0).toString(16);return BigInt("0x"+n.padEnd(t-(n.length-1),"0")).toString(10)}Object.defineProperty(a,"__esModule",{value:!0}),a.simpleHash=void 0,a.simpleHash=t,a.default=(e,a)=>t([e,a])},27351:(e,a,t)=>{var c=t(62045).hp;const f=t(92096);let d;if("undefined"!=typeof BigInt)d=BigInt,d.one=d(1),d.zero=d(0),d.genAffine=e=>{const a=-e;return t=>{let c=t;return c<0?(c<=a&&(c%=e),c=e&&(c%=e),c.valueOf()}},d.genInverse=e=>a=>{let t=d.zero,c=e,f=d.one,r=d.affine(a,e);for(;r!=d.zero;){let e=c/r;[t,f]=[f,t-e*f],[c,r]=[r,c-e*r]}return te?(a,t)=>(a+t)%e:(e,a)=>e+a,d.genSub=e=>e?(a,t)=>(a-t)%e:(e,a)=>e-a,d.genNeg=e=>e?a=>-a%e:e=>-e,d.genMul=e=>e?(a,t)=>a*t%e:(e,a)=>e*a,d.genShr=()=>(e,a)=>e>>d(a),d.genShl=e=>e?(a,t)=>(a<e<e?(a,t)=>a.affine(e)==t.affine(e):(e,a)=>e==a,d.genSquare=e=>e?a=>a*a%e:e=>e*e,d.genDouble=e=>e?a=>(a+a)%e:e=>e+e,d.genIsZero=e=>e?a=>a.affine(e)==d.zero:e=>e==d.zero,d.prototype.isOdd=function(){return(this&d.one)==d(1)},d.prototype.isNegative=function(){return thisd.zero?this:-this},d.prototype.modPow=function(e,a){let t=d.one,c=this,f=e;for(;f;)f&d.one&&(t=t*c%a),c=c*c%a,f>>=d.one;return t},d.prototype.greaterOrEquals=function(e){return this>=e},d.prototype.greater=function(e){return this>e},d.prototype.gt=d.prototype.greater,d.prototype.lesserOrEquals=function(e){return this<=e},d.prototype.lesser=function(e){return this{const a=d.zero.minus(e);return t=>{let c=t;return c.isNegative()?(c.lesserOrEquals(a)&&(c=c.mod(e)),c.isNegative()&&(c=c.add(e))):c.greaterOrEquals(e)&&(c=c.mod(e)),c}},d.genInverse=e=>a=>a.affine(e).modInv(e),d.genAdd=e=>e?(a,t)=>{const c=a.add(t);return c.greaterOrEquals(e)?c.minus(e):c}:(e,a)=>e.add(a),d.genSub=e=>e?(a,t)=>a.greaterOrEquals(t)?a.minus(t):a.minus(t).add(e):(e,a)=>e.minus(a),d.genNeg=e=>e?a=>a.isZero()?a:e.minus(a):e=>d.zero.minus(e),d.genMul=e=>e?(a,t)=>a.times(t).mod(e):(e,a)=>e.times(a),d.genShr=()=>(e,a)=>e.shiftRight(d(a).value),d.genShl=e=>e?(a,t)=>a.shiftLeft(d(t).value).mod(e):(e,a)=>e.shiftLeft(d(a).value),d.genSquare=e=>e?a=>a.square().mod(e):e=>e.square(),d.genDouble=e=>e?a=>a.add(a).mod(e):e=>e.add(e),d.genEquals=e=>e?(a,t)=>a.affine(e).equals(t.affine(e)):(e,a)=>e.equals(a),d.genIsZero=e=>e?a=>a.affine(e).isZero():e=>e.isZero()}d.affine=function(e,a){return d.genAffine(a)(e)},d.prototype.affine=function(e){return d.affine(this,e)},d.inverse=function(e,a){return d.genInverse(a)(e)},d.prototype.inverse=function(e){return d.genInverse(e)(this)},d.add=function(e,a,t){return d.genAdd(t)(e,a)},d.prototype.add=function(e,a){return d.genAdd(a)(this,e)},d.sub=function(e,a,t){return d.genSub(t)(e,a)},d.prototype.sub=function(e,a){return d.genSub(a)(this,e)},d.neg=function(e,a){return d.genNeg(a)(e)},d.prototype.neg=function(e){return d.genNeg(e)(this)},d.mul=function(e,a,t){return d.genMul(t)(e,a)},d.prototype.mul=function(e,a){return d.genMul(a)(this,e)},d.shr=function(e,a,t){return d.genShr(t)(e,a)},d.prototype.shr=function(e,a){return d.genShr(a)(this,e)},d.shl=function(e,a,t){return d.genShl(t)(e,a)},d.prototype.shl=function(e,a){return d.genShl(a)(this,e)},d.equals=function(e,a,t){return d.genEquals(t)(e,a)},d.prototype.equals=function(e,a){return d.genEquals(a)(this,e)},d.square=function(e,a){return d.genSquare(a)(e)},d.prototype.square=function(e){return d.genSquare(e)(this)},d.double=function(e,a){return d.genDouble(a)(e)},d.prototype.double=function(e){return d.genDouble(e)(this)},d.isZero=function(e,a){return d.genIsZero(a)(e)},d.prototype.isZero=function(e){return d.genIsZero(e)(this)},d.leBuff2int=function(e){let a=d.zero;for(let t=0;t=0;){let e=Number(t.and(d("255")));r[f]=e,f--,t=t.shr(8)}if(t.greater(d.zero))throw new Error("Number does not feed in buffer");return r},d.prototype.beInt2Buff=function(e){return d.beInt2Buff(this,e)},e.exports=d},28803:(e,a,t)=>{const c=t(27351);e.exports=function(e,a,t){(t=t||{}).logFunction||(t.logFunction=console.log);const d=new f(e,t);function r(e,a,t){if(!Array.isArray(e))return t(a,e);for(let c=0;c{0==this.notInitSignals[e]&&this.triggerComponent(e)})),this.witness[t]}setVar(e,a,t){const c=this.scopes[this.scopes.length-1];return 0==a.length?c[e]=t:(void 0===c[e]&&(c[e]=[]),function e(a,t,c){1==t.length?a[t[0]]=c:(void 0===a[t[0]]&&(a[t[0]]=[]),e(a[t[0]],t.slice(1),c))}(c[e],a,t)),t}getVar(e,a){function t(e,a){return 0==a.length?e:t(e[a[0]],a.slice(1))}for(let c=this.scopes.length-1;c>=0;c--)if(void 0!==this.scopes[c][e])return t(this.scopes[c][e],a);throw new Error("Variable not defined: "+e)}getSignal(e,a){let t="one"==e?"one":this.currentComponent+"."+e;return t+=this._sels2str(a),this.getSignalFullName(t)}getPin(e,a,t,c){let f="one"==e?"one":this.currentComponent+"."+e;return f+=this._sels2str(a)+"."+t+this._sels2str(c),this.getSignalFullName(f)}getSignalFullName(e){const a=this.circuit.getSignalIdx(e);if(void 0===this.witness[a])throw new Error("Signal not initialized: "+e);return this.options.logGet&&this.options.logFunction("get ---\x3e"+e+" = "+this.witness[a].toString()),this.witness[a]}assert(e,a,t){const f=c(e),d=c(a);if(!f.equals(d))throw new Error("Constraint doesn't match "+this.currentComponent+": "+t+" -> "+f.toString()+" != "+d.toString())}}},98665:(module,__unused_webpack_exports,__webpack_require__)=>{const bigInt=__webpack_require__(27351),__P__=bigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617"),__MASK__=bigInt("28948022309329048855892746252171976963317496166410141009864396001978282409983"),calculateWitness=__webpack_require__(28803);module.exports=class Circuit{constructor(circuitDef){this.nPubInputs=circuitDef.nPubInputs,this.nPrvInputs=circuitDef.nPrvInputs,this.nInputs=circuitDef.nInputs,this.nOutputs=circuitDef.nOutputs,this.nVars=circuitDef.nVars,this.nSignals=circuitDef.nSignals,this.nConstants=circuitDef.nConstants,this.nConstraints=circuitDef.constraints.length,this.signalName2Idx=circuitDef.signalName2Idx,this.components=circuitDef.components,this.componentName2Idx=circuitDef.componentName2Idx,this.signals=circuitDef.signals,this.constraints=circuitDef.constraints,this.templates={};for(let t in circuitDef.templates)this.templates[t]=eval(" const __f= "+circuitDef.templates[t]+"\n__f");this.functions={};for(let f in circuitDef.functions)this.functions[f]={params:circuitDef.functions[f].params,func:eval(" const __f= "+circuitDef.functions[f].func+"\n__f;")}}calculateWitness(e,a){return calculateWitness(this,e,a)}checkWitness(e){const a=(e,a)=>{let t=bigInt(0);for(let c in e)t=t.add(bigInt(a[c]).mul(bigInt(e[c]))).mod(__P__);return t},t=(e,t)=>{const c=a(e[0],t),f=a(e[1],t),d=a(e[2],t);return!!c.mul(f).sub(d).affine(__P__).isZero()};for(let a=0;a{let a="";for(let t in e){let c=this.signals[t].names[0];"one"==c&&(c="");let f,d=bigInt(e[t]);d.lesserOrEquals(__P__.shr(bigInt(1)))?(f=""!=a?"+"+d.toString():"","1"!=f&&(f+=d.toString())):(d=__P__.sub(d),f="-"+d.toString()),a=a+" "+f+c}return a},t=`[ ${a(e[0])} ] * [ ${a(e[1])} ] - [ ${a(e[2])} ] = 0`;console.log(t)}printConstraints(){for(let e=0;e=this.nOutputs)throw new Error("Accessing an invalid output: "+e);return e+1}inputIdx(e){if(e>=this.nInputs)throw new Error("Accessing an invalid input: "+e);return this.nOutputs+1+e}pubInputIdx(e){if(e>=this.nPubInputs)throw new Error("Accessing an invalid pubInput: "+e);return this.inputIdx(e)}prvInputIdx(e){if(e>=this.nPrvInputs)throw new Error("Accessing an invalid prvInput: "+e);return this.inputIdx(this.nPubInputs+e)}varIdx(e){if(e>=this.nVars)throw new Error("Accessing an invalid variable: "+e);return e}constantIdx(e){if(e>=this.nConstants)throw new Error("Accessing an invalid constant: "+e);return this.nVars+e}signalIdx(e){if(e>=this.nSignls)throw new Error("Accessing an invalid signal: "+e);return e}signalNames(e){return this.signals[this.getSignalIdx(e)].names.join(", ")}a(e,a){return bigInt(this.constraints[e][0][a]||0)}b(e,a){return bigInt(this.constraints[e][1][a]||0)}c(e,a){return bigInt(this.constraints[e][2][a]||0)}}},73248:(e,a,t)=>{const c=t(27351);e.exports.e=function e(a){if("bigint"==typeof a||void 0!==a.isZero)return a.toString(10);if(Array.isArray(a))return a.map(e);if("object"==typeof a){const t={};for(let c in a)t[c]=e(a[c]);return t}return a},e.exports.H=function e(a){if("string"==typeof a&&/^[0-9]+$/.test(a))return c(a);if(Array.isArray(a))return a.map(e);if("object"==typeof a){const t={};for(let c in a)t[c]=e(a[c]);return t}return a}},71293:(e,a,t)=>{var c=t(62045).hp;a.code=new c("AGFzbQEAAAABPApgAn9/AGABfwBgAX8Bf2ACf38Bf2ADf39/AX9gA39/fwBgA39+fwBgAn9+AGAEf39/fwBgBX9/f39/AAIQAQNlbnYGbWVtb3J5AgDoBwNsawABAgEDAwQEBQUGBwgFBQUAAAUFAAAAAQUFAAAFBQAAAAEFAAIBAAAFAAUAAAAIAQIAAgUICQgABQkDAAUFBQUAAgUFCAAIAgEBAAUFBQAAAAMAAgEAAAUABQAAAAgBAgACBQgJCAAFCQgIB8gJYghpbnRfY29weQAACGludF96ZXJvAAEHaW50X29uZQADCmludF9pc1plcm8AAgZpbnRfZXEABAdpbnRfZ3RlAAUHaW50X2FkZAAGB2ludF9zdWIABwppbnRfbXVsT2xkAAkHaW50X211bAAIB2ludF9kaXYADA5pbnRfaW52ZXJzZU1vZAANB2YxbV9hZGQADgdmMW1fc3ViAA8HZjFtX25lZwAQC2YxbV9tUmVkdWN0ABEHZjFtX211bAASCmYxbV9tdWxPbGQAExJmMW1fZnJvbU1vbnRnb21lcnkAFRBmMW1fdG9Nb250Z29tZXJ5ABQLZjFtX2ludmVyc2UAFghmMW1fY29weQAACGYxbV96ZXJvAAEKZjFtX2lzWmVybwACBmYxbV9lcQAEB2YxbV9vbmUAFwdmcm1fYWRkABgHZnJtX3N1YgAZB2ZybV9uZWcAGgtmcm1fbVJlZHVjdAAbB2ZybV9tdWwAHApmcm1fbXVsT2xkAB0SZnJtX2Zyb21Nb250Z29tZXJ5AB8QZnJtX3RvTW9udGdvbWVyeQAeC2ZybV9pbnZlcnNlACAIZnJtX2NvcHkAAAhmcm1femVybwABCmZybV9pc1plcm8AAgZmcm1fZXEABAdmcm1fb25lACEGZnJfYWRkABgGZnJfc3ViABkGZnJfbmVnABoGZnJfbXVsACIKZnJfaW52ZXJzZQAjB2ZyX2NvcHkAAAdmcl96ZXJvAAEGZnJfb25lACEJZnJfaXNaZXJvAAIFZnJfZXEABAlnMV9pc1plcm8AJAdnMV9jb3B5ACYHZzFfemVybwAlCWcxX2RvdWJsZQAnBmcxX2FkZAAoBmcxX25lZwApBmcxX3N1YgAqEWcxX2Zyb21Nb250Z29tZXJ5ACsPZzFfdG9Nb250Z29tZXJ5ACwJZzFfYWZmaW5lAC0OZzFfdGltZXNTY2FsYXIALgtnMV9tdWx0aWV4cAA1DGcxX211bHRpZXhwMgA5B2ZmdF9mZnQAQghmZnRfaWZmdABDEWZmdF90b01vbnRnb21lcnlOAD8TZmZ0X2Zyb21Nb250Z29tZXJ5TgA+FGZmdF9jb3B5TkludGVybGVhdmVkAD0IZmZ0X211bE4ARAhwb2xfemVybwBFD3BvbF9jb25zdHJ1Y3RMQwBGCmYybV9pc1plcm8ARwhmMm1femVybwBIB2YybV9vbmUASQhmMm1fY29weQBKB2YybV9tdWwASwdmMm1fYWRkAEwHZjJtX3N1YgBNB2YybV9uZWcAThJmMm1fZnJvbU1vbnRnb21lcnkAUBBmMm1fdG9Nb250Z29tZXJ5AE8GZjJtX2VxAFELZjJtX2ludmVyc2UAUglnMl9pc1plcm8AUwdnMl9jb3B5AFUHZzJfemVybwBUCWcyX2RvdWJsZQBWBmcyX2FkZABXBmcyX25lZwBYBmcyX3N1YgBZEWcyX2Zyb21Nb250Z29tZXJ5AFoPZzJfdG9Nb250Z29tZXJ5AFsJZzJfYWZmaW5lAFwOZzJfdGltZXNTY2FsYXIAXQtnMl9tdWx0aWV4cABkDGcyX211bHRpZXhwMgBoDHRlc3RfZjFtX211bABpD3Rlc3RfZjFtX211bE9sZABqCsfEAWsqACABIAApAwA3AwAgASAAKQMINwMIIAEgACkDEDcDECABIAApAxg3AxgLHgAgAEIANwMAIABCADcDCCAAQgA3AxAgAEIANwMYCzMAIAApAxhQBEAgACkDEFAEQCAAKQMIUARAIAApAwBQDwVBAA8LBUEADwsFQQAPC0EADwseACAAQgE3AwAgAEIANwMIIABCADcDECAAQgA3AxgLRwAgACkDGCABKQMYUQRAIAApAxAgASkDEFEEQCAAKQMIIAEpAwhRBEAgACkDACABKQMAUQ8FQQAPCwVBAA8LBUEADwtBAA8LfQAgACkDGCABKQMYVARAQQAPBSAAKQMYIAEpAxhWBEBBAQ8FIAApAxAgASkDEFQEQEEADwUgACkDECABKQMQVgRAQQEPBSAAKQMIIAEpAwhUBEBBAA8FIAApAwggASkDCFYEQEEBDwUgACkDACABKQMAWg8LCwsLCwtBAA8L1AEBAX4gADUCACABNQIAfCEDIAIgAz4CACAANQIEIAE1AgR8IANCIIh8IQMgAiADPgIEIAA1AgggATUCCHwgA0IgiHwhAyACIAM+AgggADUCDCABNQIMfCADQiCIfCEDIAIgAz4CDCAANQIQIAE1AhB8IANCIIh8IQMgAiADPgIQIAA1AhQgATUCFHwgA0IgiHwhAyACIAM+AhQgADUCGCABNQIYfCADQiCIfCEDIAIgAz4CGCAANQIcIAE1Ahx8IANCIIh8IQMgAiADPgIcIANCIIinC4wCAQF+IAA1AgAgATUCAH0hAyACIANC/////w+DPgIAIAA1AgQgATUCBH0gA0Igh3whAyACIANC/////w+DPgIEIAA1AgggATUCCH0gA0Igh3whAyACIANC/////w+DPgIIIAA1AgwgATUCDH0gA0Igh3whAyACIANC/////w+DPgIMIAA1AhAgATUCEH0gA0Igh3whAyACIANC/////w+DPgIQIAA1AhQgATUCFH0gA0Igh3whAyACIANC/////w+DPgIUIAA1AhggATUCGH0gA0Igh3whAyACIANC/////w+DPgIYIAA1AhwgATUCHH0gA0Igh3whAyACIANC/////w+DPgIcIANCIIenC48QEgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfiADQv////8PgyAANQIAIgUgATUCACIGfnwhAyAEIANCIIh8IQQgAiADPgIAIARCIIghAyAEQv////8PgyAFIAE1AgQiCH58IQQgAyAEQiCIfCEDIARC/////w+DIAA1AgQiByAGfnwhBCADIARCIIh8IQMgAiAEPgIEIANCIIghBCADQv////8PgyAFIAE1AggiCn58IQMgBCADQiCIfCEEIANC/////w+DIAcgCH58IQMgBCADQiCIfCEEIANC/////w+DIAA1AggiCSAGfnwhAyAEIANCIIh8IQQgAiADPgIIIARCIIghAyAEQv////8PgyAFIAE1AgwiDH58IQQgAyAEQiCIfCEDIARC/////w+DIAcgCn58IQQgAyAEQiCIfCEDIARC/////w+DIAkgCH58IQQgAyAEQiCIfCEDIARC/////w+DIAA1AgwiCyAGfnwhBCADIARCIIh8IQMgAiAEPgIMIANCIIghBCADQv////8PgyAFIAE1AhAiDn58IQMgBCADQiCIfCEEIANC/////w+DIAcgDH58IQMgBCADQiCIfCEEIANC/////w+DIAkgCn58IQMgBCADQiCIfCEEIANC/////w+DIAsgCH58IQMgBCADQiCIfCEEIANC/////w+DIAA1AhAiDSAGfnwhAyAEIANCIIh8IQQgAiADPgIQIARCIIghAyAEQv////8PgyAFIAE1AhQiEH58IQQgAyAEQiCIfCEDIARC/////w+DIAcgDn58IQQgAyAEQiCIfCEDIARC/////w+DIAkgDH58IQQgAyAEQiCIfCEDIARC/////w+DIAsgCn58IQQgAyAEQiCIfCEDIARC/////w+DIA0gCH58IQQgAyAEQiCIfCEDIARC/////w+DIAA1AhQiDyAGfnwhBCADIARCIIh8IQMgAiAEPgIUIANCIIghBCADQv////8PgyAFIAE1AhgiEn58IQMgBCADQiCIfCEEIANC/////w+DIAcgEH58IQMgBCADQiCIfCEEIANC/////w+DIAkgDn58IQMgBCADQiCIfCEEIANC/////w+DIAsgDH58IQMgBCADQiCIfCEEIANC/////w+DIA0gCn58IQMgBCADQiCIfCEEIANC/////w+DIA8gCH58IQMgBCADQiCIfCEEIANC/////w+DIAA1AhgiESAGfnwhAyAEIANCIIh8IQQgAiADPgIYIARCIIghAyAEQv////8PgyAFIAE1AhwiFH58IQQgAyAEQiCIfCEDIARC/////w+DIAcgEn58IQQgAyAEQiCIfCEDIARC/////w+DIAkgEH58IQQgAyAEQiCIfCEDIARC/////w+DIAsgDn58IQQgAyAEQiCIfCEDIARC/////w+DIA0gDH58IQQgAyAEQiCIfCEDIARC/////w+DIA8gCn58IQQgAyAEQiCIfCEDIARC/////w+DIBEgCH58IQQgAyAEQiCIfCEDIARC/////w+DIAA1AhwiEyAGfnwhBCADIARCIIh8IQMgAiAEPgIcIANCIIghBCADQv////8PgyAHIBR+fCEDIAQgA0IgiHwhBCADQv////8PgyAJIBJ+fCEDIAQgA0IgiHwhBCADQv////8PgyALIBB+fCEDIAQgA0IgiHwhBCADQv////8PgyANIA5+fCEDIAQgA0IgiHwhBCADQv////8PgyAPIAx+fCEDIAQgA0IgiHwhBCADQv////8PgyARIAp+fCEDIAQgA0IgiHwhBCADQv////8PgyATIAh+fCEDIAQgA0IgiHwhBCACIAM+AiAgBEIgiCEDIARC/////w+DIAkgFH58IQQgAyAEQiCIfCEDIARC/////w+DIAsgEn58IQQgAyAEQiCIfCEDIARC/////w+DIA0gEH58IQQgAyAEQiCIfCEDIARC/////w+DIA8gDn58IQQgAyAEQiCIfCEDIARC/////w+DIBEgDH58IQQgAyAEQiCIfCEDIARC/////w+DIBMgCn58IQQgAyAEQiCIfCEDIAIgBD4CJCADQiCIIQQgA0L/////D4MgCyAUfnwhAyAEIANCIIh8IQQgA0L/////D4MgDSASfnwhAyAEIANCIIh8IQQgA0L/////D4MgDyAQfnwhAyAEIANCIIh8IQQgA0L/////D4MgESAOfnwhAyAEIANCIIh8IQQgA0L/////D4MgEyAMfnwhAyAEIANCIIh8IQQgAiADPgIoIARCIIghAyAEQv////8PgyANIBR+fCEEIAMgBEIgiHwhAyAEQv////8PgyAPIBJ+fCEEIAMgBEIgiHwhAyAEQv////8PgyARIBB+fCEEIAMgBEIgiHwhAyAEQv////8PgyATIA5+fCEEIAMgBEIgiHwhAyACIAQ+AiwgA0IgiCEEIANC/////w+DIA8gFH58IQMgBCADQiCIfCEEIANC/////w+DIBEgEn58IQMgBCADQiCIfCEEIANC/////w+DIBMgEH58IQMgBCADQiCIfCEEIAIgAz4CMCAEQiCIIQMgBEL/////D4MgESAUfnwhBCADIARCIIh8IQMgBEL/////D4MgEyASfnwhBCADIARCIIh8IQMgAiAEPgI0IANCIIghBCADQv////8PgyATIBR+fCEDIAQgA0IgiHwhBCACIAM+AjggBEIgiCEDIAIgBD4CPAv0EAEBfkEoIAA1AgAgATUCAH43AwBBKCAANQIAIAE1AgR+NwMIQSggADUCACABNQIIfjcDEEEoIAA1AgAgATUCDH43AxhBKCAANQIAIAE1AhB+NwMgQSggADUCACABNQIUfjcDKEEoIAA1AgAgATUCGH43AzBBKCAANQIAIAE1Ahx+NwM4QSggADUCBCABNQIAfjcDQEEoIAA1AgQgATUCBH43A0hBKCAANQIEIAE1Agh+NwNQQSggADUCBCABNQIMfjcDWEEoIAA1AgQgATUCEH43A2BBKCAANQIEIAE1AhR+NwNoQSggADUCBCABNQIYfjcDcEEoIAA1AgQgATUCHH43A3hBKCAANQIIIAE1AgB+NwOAAUEoIAA1AgggATUCBH43A4gBQSggADUCCCABNQIIfjcDkAFBKCAANQIIIAE1Agx+NwOYAUEoIAA1AgggATUCEH43A6ABQSggADUCCCABNQIUfjcDqAFBKCAANQIIIAE1Ahh+NwOwAUEoIAA1AgggATUCHH43A7gBQSggADUCDCABNQIAfjcDwAFBKCAANQIMIAE1AgR+NwPIAUEoIAA1AgwgATUCCH43A9ABQSggADUCDCABNQIMfjcD2AFBKCAANQIMIAE1AhB+NwPgAUEoIAA1AgwgATUCFH43A+gBQSggADUCDCABNQIYfjcD8AFBKCAANQIMIAE1Ahx+NwP4AUEoIAA1AhAgATUCAH43A4ACQSggADUCECABNQIEfjcDiAJBKCAANQIQIAE1Agh+NwOQAkEoIAA1AhAgATUCDH43A5gCQSggADUCECABNQIQfjcDoAJBKCAANQIQIAE1AhR+NwOoAkEoIAA1AhAgATUCGH43A7ACQSggADUCECABNQIcfjcDuAJBKCAANQIUIAE1AgB+NwPAAkEoIAA1AhQgATUCBH43A8gCQSggADUCFCABNQIIfjcD0AJBKCAANQIUIAE1Agx+NwPYAkEoIAA1AhQgATUCEH43A+ACQSggADUCFCABNQIUfjcD6AJBKCAANQIUIAE1Ahh+NwPwAkEoIAA1AhQgATUCHH43A/gCQSggADUCGCABNQIAfjcDgANBKCAANQIYIAE1AgR+NwOIA0EoIAA1AhggATUCCH43A5ADQSggADUCGCABNQIMfjcDmANBKCAANQIYIAE1AhB+NwOgA0EoIAA1AhggATUCFH43A6gDQSggADUCGCABNQIYfjcDsANBKCAANQIYIAE1Ahx+NwO4A0EoIAA1AhwgATUCAH43A8ADQSggADUCHCABNQIEfjcDyANBKCAANQIcIAE1Agh+NwPQA0EoIAA1AhwgATUCDH43A9gDQSggADUCHCABNQIQfjcD4ANBKCAANQIcIAE1AhR+NwPoA0EoIAA1AhwgATUCGH43A/ADQSggADUCHCABNQIcfjcD+AMgA0IgiEEoNQIAfCEDIAIgAz4CACADQiCIQSg1AgR8QSg1Agh8QSg1AkB8IQMgAiADPgIEIANCIIhBKDUCDHxBKDUCRHxBKDUCEHxBKDUCSHxBKDUCgAF8IQMgAiADPgIIIANCIIhBKDUCFHxBKDUCTHxBKDUChAF8QSg1Ahh8QSg1AlB8QSg1AogBfEEoNQLAAXwhAyACIAM+AgwgA0IgiEEoNQIcfEEoNQJUfEEoNQKMAXxBKDUCxAF8QSg1AiB8QSg1Alh8QSg1ApABfEEoNQLIAXxBKDUCgAJ8IQMgAiADPgIQIANCIIhBKDUCJHxBKDUCXHxBKDUClAF8QSg1AswBfEEoNQKEAnxBKDUCKHxBKDUCYHxBKDUCmAF8QSg1AtABfEEoNQKIAnxBKDUCwAJ8IQMgAiADPgIUIANCIIhBKDUCLHxBKDUCZHxBKDUCnAF8QSg1AtQBfEEoNQKMAnxBKDUCxAJ8QSg1AjB8QSg1Amh8QSg1AqABfEEoNQLYAXxBKDUCkAJ8QSg1AsgCfEEoNQKAA3whAyACIAM+AhggA0IgiEEoNQI0fEEoNQJsfEEoNQKkAXxBKDUC3AF8QSg1ApQCfEEoNQLMAnxBKDUChAN8QSg1Ajh8QSg1AnB8QSg1AqgBfEEoNQLgAXxBKDUCmAJ8QSg1AtACfEEoNQKIA3xBKDUCwAN8IQMgAiADPgIcIANCIIhBKDUCPHxBKDUCdHxBKDUCrAF8QSg1AuQBfEEoNQKcAnxBKDUC1AJ8QSg1AowDfEEoNQLEA3xBKDUCeHxBKDUCsAF8QSg1AugBfEEoNQKgAnxBKDUC2AJ8QSg1ApADfEEoNQLIA3whAyACIAM+AiAgA0IgiEEoNQJ8fEEoNQK0AXxBKDUC7AF8QSg1AqQCfEEoNQLcAnxBKDUClAN8QSg1AswDfEEoNQK4AXxBKDUC8AF8QSg1AqgCfEEoNQLgAnxBKDUCmAN8QSg1AtADfCEDIAIgAz4CJCADQiCIQSg1ArwBfEEoNQL0AXxBKDUCrAJ8QSg1AuQCfEEoNQKcA3xBKDUC1AN8QSg1AvgBfEEoNQKwAnxBKDUC6AJ8QSg1AqADfEEoNQLYA3whAyACIAM+AiggA0IgiEEoNQL8AXxBKDUCtAJ8QSg1AuwCfEEoNQKkA3xBKDUC3AN8QSg1ArgCfEEoNQLwAnxBKDUCqAN8QSg1AuADfCEDIAIgAz4CLCADQiCIQSg1ArwCfEEoNQL0AnxBKDUCrAN8QSg1AuQDfEEoNQL4AnxBKDUCsAN8QSg1AugDfCEDIAIgAz4CMCADQiCIQSg1AvwCfEEoNQK0A3xBKDUC7AN8QSg1ArgDfEEoNQLwA3whAyACIAM+AjQgA0IgiEEoNQK8A3xBKDUC9AN8QSg1AvgDfCEDIAIgAz4COCADQiCIQSg1AvwDfCEDIAIgAz4CPAu2AQEBfiAANQAAIAF+IQMgAiADPgAAIAA1AAQgAX4gA0IgiHwhAyACIAM+AAQgADUACCABfiADQiCIfCEDIAIgAz4ACCAANQAMIAF+IANCIIh8IQMgAiADPgAMIAA1ABAgAX4gA0IgiHwhAyACIAM+ABAgADUAFCABfiADQiCIfCEDIAIgAz4AFCAANQAYIAF+IANCIIh8IQMgAiADPgAYIAA1ABwgAX4gA0IgiHwhAyACIAM+ABwLTgIBfgF/IAAhAyADNQAAIAF8IQIgAyACPgAAIAJCIIghAgJAA0AgAlANASADQQRqIQMgAzUAACACfCECIAMgAj4AACACQiCIIQIMAAsLC7ACBwF/AX8BfwF/AX4BfgF/IAIEQCACIQUFQcgEIQULIAMEQCADIQQFQegEIQQLIAAgBBAAIAFBqAQQACAFEAFBiAUQAUEfIQZBHyEHAkADQEGoBCAHai0AACAHQQNGcg0BIAdBAWshBwwACwtBqAQgB2pBA2s1AABCAXwhCCAIQgFRBEBCAEIAgBoLAkADQAJAA0AgBCAGai0AACAGQQdGcg0BIAZBAWshBgwACwsgBCAGakEHaykAACEJIAkgCIAhCSAGIAdrQQRrIQoCQANAIAlCgICAgHCDUCAKQQBOcQ0BIAlCCIghCSAKQQFqIQoMAAsLIAlQBEAgBEGoBBAFRQ0CQgEhCUEAIQoLQagEIAlBqAUQCiAEQagFIAprIAQQBxogBSAKaiAJEAsMAAsLC7UCCwF/AX8BfwF/AX8BfwF/AX8BfwF/AX9ByAUhA0HIBRABQQAhC0HoBSEFIAFB6AUQAEGIBiEEQYgGEANBACEMQagGIQggAEGoBhAAQcgGIQZB6AYhB0HIByEKAkADQCAIEAINASAFIAggBiAHEAwgBiAEQYgHEAggCwRAIAwEQEGIByADEAUEQEGIByADIAoQBxpBACENBSADQYgHIAoQBxpBASENCwVBiAcgAyAKEAYaQQEhDQsFIAwEQEGIByADIAoQBhpBACENBSADQYgHEAUEQCADQYgHIAoQBxpBACENBUGIByADIAoQBxpBASENCwsLIAMhCSAEIQMgCiEEIAkhCiAMIQsgDSEMIAUhCSAIIQUgByEIIAkhBwwACwsgCwRAIAEgAyACEAcaBSADIAIQAAsLLAAgACABIAIQBgRAIAJB6AcgAhAHGgUgAkHoBxAFBEAgAkHoByACEAcaCwsLFwAgACABIAIQBwRAIAJB6AcgAhAGGgsLFAAgABACRQRAQegHIAAgARAHGgsLnBEDAX4BfgF+QonHmaQOIQJCACEDIAA1AgAgAn5C/////w+DIQQgADUCACADQiCIfEHoBzUCACAEfnwhAyAAIAM+AgAgADUCBCADQiCIfEHoBzUCBCAEfnwhAyAAIAM+AgQgADUCCCADQiCIfEHoBzUCCCAEfnwhAyAAIAM+AgggADUCDCADQiCIfEHoBzUCDCAEfnwhAyAAIAM+AgwgADUCECADQiCIfEHoBzUCECAEfnwhAyAAIAM+AhAgADUCFCADQiCIfEHoBzUCFCAEfnwhAyAAIAM+AhQgADUCGCADQiCIfEHoBzUCGCAEfnwhAyAAIAM+AhggADUCHCADQiCIfEHoBzUCHCAEfnwhAyAAIAM+AhxB6AggA0IgiD4CAEIAIQMgADUCBCACfkL/////D4MhBCAANQIEIANCIIh8QegHNQIAIAR+fCEDIAAgAz4CBCAANQIIIANCIIh8QegHNQIEIAR+fCEDIAAgAz4CCCAANQIMIANCIIh8QegHNQIIIAR+fCEDIAAgAz4CDCAANQIQIANCIIh8QegHNQIMIAR+fCEDIAAgAz4CECAANQIUIANCIIh8QegHNQIQIAR+fCEDIAAgAz4CFCAANQIYIANCIIh8QegHNQIUIAR+fCEDIAAgAz4CGCAANQIcIANCIIh8QegHNQIYIAR+fCEDIAAgAz4CHCAANQIgIANCIIh8QegHNQIcIAR+fCEDIAAgAz4CIEHoCCADQiCIPgIEQgAhAyAANQIIIAJ+Qv////8PgyEEIAA1AgggA0IgiHxB6Ac1AgAgBH58IQMgACADPgIIIAA1AgwgA0IgiHxB6Ac1AgQgBH58IQMgACADPgIMIAA1AhAgA0IgiHxB6Ac1AgggBH58IQMgACADPgIQIAA1AhQgA0IgiHxB6Ac1AgwgBH58IQMgACADPgIUIAA1AhggA0IgiHxB6Ac1AhAgBH58IQMgACADPgIYIAA1AhwgA0IgiHxB6Ac1AhQgBH58IQMgACADPgIcIAA1AiAgA0IgiHxB6Ac1AhggBH58IQMgACADPgIgIAA1AiQgA0IgiHxB6Ac1AhwgBH58IQMgACADPgIkQegIIANCIIg+AghCACEDIAA1AgwgAn5C/////w+DIQQgADUCDCADQiCIfEHoBzUCACAEfnwhAyAAIAM+AgwgADUCECADQiCIfEHoBzUCBCAEfnwhAyAAIAM+AhAgADUCFCADQiCIfEHoBzUCCCAEfnwhAyAAIAM+AhQgADUCGCADQiCIfEHoBzUCDCAEfnwhAyAAIAM+AhggADUCHCADQiCIfEHoBzUCECAEfnwhAyAAIAM+AhwgADUCICADQiCIfEHoBzUCFCAEfnwhAyAAIAM+AiAgADUCJCADQiCIfEHoBzUCGCAEfnwhAyAAIAM+AiQgADUCKCADQiCIfEHoBzUCHCAEfnwhAyAAIAM+AihB6AggA0IgiD4CDEIAIQMgADUCECACfkL/////D4MhBCAANQIQIANCIIh8QegHNQIAIAR+fCEDIAAgAz4CECAANQIUIANCIIh8QegHNQIEIAR+fCEDIAAgAz4CFCAANQIYIANCIIh8QegHNQIIIAR+fCEDIAAgAz4CGCAANQIcIANCIIh8QegHNQIMIAR+fCEDIAAgAz4CHCAANQIgIANCIIh8QegHNQIQIAR+fCEDIAAgAz4CICAANQIkIANCIIh8QegHNQIUIAR+fCEDIAAgAz4CJCAANQIoIANCIIh8QegHNQIYIAR+fCEDIAAgAz4CKCAANQIsIANCIIh8QegHNQIcIAR+fCEDIAAgAz4CLEHoCCADQiCIPgIQQgAhAyAANQIUIAJ+Qv////8PgyEEIAA1AhQgA0IgiHxB6Ac1AgAgBH58IQMgACADPgIUIAA1AhggA0IgiHxB6Ac1AgQgBH58IQMgACADPgIYIAA1AhwgA0IgiHxB6Ac1AgggBH58IQMgACADPgIcIAA1AiAgA0IgiHxB6Ac1AgwgBH58IQMgACADPgIgIAA1AiQgA0IgiHxB6Ac1AhAgBH58IQMgACADPgIkIAA1AiggA0IgiHxB6Ac1AhQgBH58IQMgACADPgIoIAA1AiwgA0IgiHxB6Ac1AhggBH58IQMgACADPgIsIAA1AjAgA0IgiHxB6Ac1AhwgBH58IQMgACADPgIwQegIIANCIIg+AhRCACEDIAA1AhggAn5C/////w+DIQQgADUCGCADQiCIfEHoBzUCACAEfnwhAyAAIAM+AhggADUCHCADQiCIfEHoBzUCBCAEfnwhAyAAIAM+AhwgADUCICADQiCIfEHoBzUCCCAEfnwhAyAAIAM+AiAgADUCJCADQiCIfEHoBzUCDCAEfnwhAyAAIAM+AiQgADUCKCADQiCIfEHoBzUCECAEfnwhAyAAIAM+AiggADUCLCADQiCIfEHoBzUCFCAEfnwhAyAAIAM+AiwgADUCMCADQiCIfEHoBzUCGCAEfnwhAyAAIAM+AjAgADUCNCADQiCIfEHoBzUCHCAEfnwhAyAAIAM+AjRB6AggA0IgiD4CGEIAIQMgADUCHCACfkL/////D4MhBCAANQIcIANCIIh8QegHNQIAIAR+fCEDIAAgAz4CHCAANQIgIANCIIh8QegHNQIEIAR+fCEDIAAgAz4CICAANQIkIANCIIh8QegHNQIIIAR+fCEDIAAgAz4CJCAANQIoIANCIIh8QegHNQIMIAR+fCEDIAAgAz4CKCAANQIsIANCIIh8QegHNQIQIAR+fCEDIAAgAz4CLCAANQIwIANCIIh8QegHNQIUIAR+fCEDIAAgAz4CMCAANQI0IANCIIh8QegHNQIYIAR+fCEDIAAgAz4CNCAANQI4IANCIIh8QegHNQIcIAR+fCEDIAAgAz4COEHoCCADQiCIPgIcQegIIABBIGogARAOC74fIwF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX5CiceZpA4hBSADQv////8PgyAANQIAIgYgATUCACIHfnwhAyAEIANCIIh8IQQgA0L/////D4MgBX5C/////w+DIQggA0L/////D4NBADUC6AciCSAIfnwhAyAEIANCIIh8IQQgBEIgiCEDIARC/////w+DIAYgATUCBCILfnwhBCADIARCIIh8IQMgBEL/////D4MgADUCBCIKIAd+fCEEIAMgBEIgiHwhAyAEQv////8Pg0EANQLsByINIAh+fCEEIAMgBEIgiHwhAyAEQv////8PgyAFfkL/////D4MhDCAEQv////8PgyAJIAx+fCEEIAMgBEIgiHwhAyADQiCIIQQgA0L/////D4MgBiABNQIIIg9+fCEDIAQgA0IgiHwhBCADQv////8PgyAKIAt+fCEDIAQgA0IgiHwhBCADQv////8PgyAANQIIIg4gB358IQMgBCADQiCIfCEEIANC/////w+DIA0gDH58IQMgBCADQiCIfCEEIANC/////w+DQQA1AvAHIhEgCH58IQMgBCADQiCIfCEEIANC/////w+DIAV+Qv////8PgyEQIANC/////w+DIAkgEH58IQMgBCADQiCIfCEEIARCIIghAyAEQv////8PgyAGIAE1AgwiE358IQQgAyAEQiCIfCEDIARC/////w+DIAogD358IQQgAyAEQiCIfCEDIARC/////w+DIA4gC358IQQgAyAEQiCIfCEDIARC/////w+DIAA1AgwiEiAHfnwhBCADIARCIIh8IQMgBEL/////D4MgDSAQfnwhBCADIARCIIh8IQMgBEL/////D4MgESAMfnwhBCADIARCIIh8IQMgBEL/////D4NBADUC9AciFSAIfnwhBCADIARCIIh8IQMgBEL/////D4MgBX5C/////w+DIRQgBEL/////D4MgCSAUfnwhBCADIARCIIh8IQMgA0IgiCEEIANC/////w+DIAYgATUCECIXfnwhAyAEIANCIIh8IQQgA0L/////D4MgCiATfnwhAyAEIANCIIh8IQQgA0L/////D4MgDiAPfnwhAyAEIANCIIh8IQQgA0L/////D4MgEiALfnwhAyAEIANCIIh8IQQgA0L/////D4MgADUCECIWIAd+fCEDIAQgA0IgiHwhBCADQv////8PgyANIBR+fCEDIAQgA0IgiHwhBCADQv////8PgyARIBB+fCEDIAQgA0IgiHwhBCADQv////8PgyAVIAx+fCEDIAQgA0IgiHwhBCADQv////8Pg0EANQL4ByIZIAh+fCEDIAQgA0IgiHwhBCADQv////8PgyAFfkL/////D4MhGCADQv////8PgyAJIBh+fCEDIAQgA0IgiHwhBCAEQiCIIQMgBEL/////D4MgBiABNQIUIht+fCEEIAMgBEIgiHwhAyAEQv////8PgyAKIBd+fCEEIAMgBEIgiHwhAyAEQv////8PgyAOIBN+fCEEIAMgBEIgiHwhAyAEQv////8PgyASIA9+fCEEIAMgBEIgiHwhAyAEQv////8PgyAWIAt+fCEEIAMgBEIgiHwhAyAEQv////8PgyAANQIUIhogB358IQQgAyAEQiCIfCEDIARC/////w+DIA0gGH58IQQgAyAEQiCIfCEDIARC/////w+DIBEgFH58IQQgAyAEQiCIfCEDIARC/////w+DIBUgEH58IQQgAyAEQiCIfCEDIARC/////w+DIBkgDH58IQQgAyAEQiCIfCEDIARC/////w+DQQA1AvwHIh0gCH58IQQgAyAEQiCIfCEDIARC/////w+DIAV+Qv////8PgyEcIARC/////w+DIAkgHH58IQQgAyAEQiCIfCEDIANCIIghBCADQv////8PgyAGIAE1AhgiH358IQMgBCADQiCIfCEEIANC/////w+DIAogG358IQMgBCADQiCIfCEEIANC/////w+DIA4gF358IQMgBCADQiCIfCEEIANC/////w+DIBIgE358IQMgBCADQiCIfCEEIANC/////w+DIBYgD358IQMgBCADQiCIfCEEIANC/////w+DIBogC358IQMgBCADQiCIfCEEIANC/////w+DIAA1AhgiHiAHfnwhAyAEIANCIIh8IQQgA0L/////D4MgDSAcfnwhAyAEIANCIIh8IQQgA0L/////D4MgESAYfnwhAyAEIANCIIh8IQQgA0L/////D4MgFSAUfnwhAyAEIANCIIh8IQQgA0L/////D4MgGSAQfnwhAyAEIANCIIh8IQQgA0L/////D4MgHSAMfnwhAyAEIANCIIh8IQQgA0L/////D4NBADUCgAgiISAIfnwhAyAEIANCIIh8IQQgA0L/////D4MgBX5C/////w+DISAgA0L/////D4MgCSAgfnwhAyAEIANCIIh8IQQgBEIgiCEDIARC/////w+DIAYgATUCHCIjfnwhBCADIARCIIh8IQMgBEL/////D4MgCiAffnwhBCADIARCIIh8IQMgBEL/////D4MgDiAbfnwhBCADIARCIIh8IQMgBEL/////D4MgEiAXfnwhBCADIARCIIh8IQMgBEL/////D4MgFiATfnwhBCADIARCIIh8IQMgBEL/////D4MgGiAPfnwhBCADIARCIIh8IQMgBEL/////D4MgHiALfnwhBCADIARCIIh8IQMgBEL/////D4MgADUCHCIiIAd+fCEEIAMgBEIgiHwhAyAEQv////8PgyANICB+fCEEIAMgBEIgiHwhAyAEQv////8PgyARIBx+fCEEIAMgBEIgiHwhAyAEQv////8PgyAVIBh+fCEEIAMgBEIgiHwhAyAEQv////8PgyAZIBR+fCEEIAMgBEIgiHwhAyAEQv////8PgyAdIBB+fCEEIAMgBEIgiHwhAyAEQv////8PgyAhIAx+fCEEIAMgBEIgiHwhAyAEQv////8Pg0EANQKECCIlIAh+fCEEIAMgBEIgiHwhAyAEQv////8PgyAFfkL/////D4MhJCAEQv////8PgyAJICR+fCEEIAMgBEIgiHwhAyADQiCIIQQgA0L/////D4MgCiAjfnwhAyAEIANCIIh8IQQgA0L/////D4MgDiAffnwhAyAEIANCIIh8IQQgA0L/////D4MgEiAbfnwhAyAEIANCIIh8IQQgA0L/////D4MgFiAXfnwhAyAEIANCIIh8IQQgA0L/////D4MgGiATfnwhAyAEIANCIIh8IQQgA0L/////D4MgHiAPfnwhAyAEIANCIIh8IQQgA0L/////D4MgIiALfnwhAyAEIANCIIh8IQQgA0L/////D4MgDSAkfnwhAyAEIANCIIh8IQQgA0L/////D4MgESAgfnwhAyAEIANCIIh8IQQgA0L/////D4MgFSAcfnwhAyAEIANCIIh8IQQgA0L/////D4MgGSAYfnwhAyAEIANCIIh8IQQgA0L/////D4MgHSAUfnwhAyAEIANCIIh8IQQgA0L/////D4MgISAQfnwhAyAEIANCIIh8IQQgA0L/////D4MgJSAMfnwhAyAEIANCIIh8IQQgAiADPgIAIARCIIghAyAEQv////8PgyAOICN+fCEEIAMgBEIgiHwhAyAEQv////8PgyASIB9+fCEEIAMgBEIgiHwhAyAEQv////8PgyAWIBt+fCEEIAMgBEIgiHwhAyAEQv////8PgyAaIBd+fCEEIAMgBEIgiHwhAyAEQv////8PgyAeIBN+fCEEIAMgBEIgiHwhAyAEQv////8PgyAiIA9+fCEEIAMgBEIgiHwhAyAEQv////8PgyARICR+fCEEIAMgBEIgiHwhAyAEQv////8PgyAVICB+fCEEIAMgBEIgiHwhAyAEQv////8PgyAZIBx+fCEEIAMgBEIgiHwhAyAEQv////8PgyAdIBh+fCEEIAMgBEIgiHwhAyAEQv////8PgyAhIBR+fCEEIAMgBEIgiHwhAyAEQv////8PgyAlIBB+fCEEIAMgBEIgiHwhAyACIAQ+AgQgA0IgiCEEIANC/////w+DIBIgI358IQMgBCADQiCIfCEEIANC/////w+DIBYgH358IQMgBCADQiCIfCEEIANC/////w+DIBogG358IQMgBCADQiCIfCEEIANC/////w+DIB4gF358IQMgBCADQiCIfCEEIANC/////w+DICIgE358IQMgBCADQiCIfCEEIANC/////w+DIBUgJH58IQMgBCADQiCIfCEEIANC/////w+DIBkgIH58IQMgBCADQiCIfCEEIANC/////w+DIB0gHH58IQMgBCADQiCIfCEEIANC/////w+DICEgGH58IQMgBCADQiCIfCEEIANC/////w+DICUgFH58IQMgBCADQiCIfCEEIAIgAz4CCCAEQiCIIQMgBEL/////D4MgFiAjfnwhBCADIARCIIh8IQMgBEL/////D4MgGiAffnwhBCADIARCIIh8IQMgBEL/////D4MgHiAbfnwhBCADIARCIIh8IQMgBEL/////D4MgIiAXfnwhBCADIARCIIh8IQMgBEL/////D4MgGSAkfnwhBCADIARCIIh8IQMgBEL/////D4MgHSAgfnwhBCADIARCIIh8IQMgBEL/////D4MgISAcfnwhBCADIARCIIh8IQMgBEL/////D4MgJSAYfnwhBCADIARCIIh8IQMgAiAEPgIMIANCIIghBCADQv////8PgyAaICN+fCEDIAQgA0IgiHwhBCADQv////8PgyAeIB9+fCEDIAQgA0IgiHwhBCADQv////8PgyAiIBt+fCEDIAQgA0IgiHwhBCADQv////8PgyAdICR+fCEDIAQgA0IgiHwhBCADQv////8PgyAhICB+fCEDIAQgA0IgiHwhBCADQv////8PgyAlIBx+fCEDIAQgA0IgiHwhBCACIAM+AhAgBEIgiCEDIARC/////w+DIB4gI358IQQgAyAEQiCIfCEDIARC/////w+DICIgH358IQQgAyAEQiCIfCEDIARC/////w+DICEgJH58IQQgAyAEQiCIfCEDIARC/////w+DICUgIH58IQQgAyAEQiCIfCEDIAIgBD4CFCADQiCIIQQgA0L/////D4MgIiAjfnwhAyAEIANCIIh8IQQgA0L/////D4MgJSAkfnwhAyAEIANCIIh8IQQgAiADPgIYIARCIIghAyACIAQ+AhwgA6cEQCACQegHIAIQBxoFIAJB6AcQBQRAIAJB6AcgAhAHGgsLCxIAIAAgAUHoDBAJQegMIAIQEQsLACAAQYgIIAEQEgsVACAAQagNEABByA0QAUGoDSABEBELFwAgACABEBUgAUHoByABEA0gASABEBQLCQBBqAggABAACywAIAAgASACEAYEQCACQegNIAIQBxoFIAJB6A0QBQRAIAJB6A0gAhAHGgsLCxcAIAAgASACEAcEQCACQegNIAIQBhoLCxQAIAAQAkUEQEHoDSAAIAEQBxoLC5wRAwF+AX4BfkL/////DiECQgAhAyAANQIAIAJ+Qv////8PgyEEIAA1AgAgA0IgiHxB6A01AgAgBH58IQMgACADPgIAIAA1AgQgA0IgiHxB6A01AgQgBH58IQMgACADPgIEIAA1AgggA0IgiHxB6A01AgggBH58IQMgACADPgIIIAA1AgwgA0IgiHxB6A01AgwgBH58IQMgACADPgIMIAA1AhAgA0IgiHxB6A01AhAgBH58IQMgACADPgIQIAA1AhQgA0IgiHxB6A01AhQgBH58IQMgACADPgIUIAA1AhggA0IgiHxB6A01AhggBH58IQMgACADPgIYIAA1AhwgA0IgiHxB6A01AhwgBH58IQMgACADPgIcQegOIANCIIg+AgBCACEDIAA1AgQgAn5C/////w+DIQQgADUCBCADQiCIfEHoDTUCACAEfnwhAyAAIAM+AgQgADUCCCADQiCIfEHoDTUCBCAEfnwhAyAAIAM+AgggADUCDCADQiCIfEHoDTUCCCAEfnwhAyAAIAM+AgwgADUCECADQiCIfEHoDTUCDCAEfnwhAyAAIAM+AhAgADUCFCADQiCIfEHoDTUCECAEfnwhAyAAIAM+AhQgADUCGCADQiCIfEHoDTUCFCAEfnwhAyAAIAM+AhggADUCHCADQiCIfEHoDTUCGCAEfnwhAyAAIAM+AhwgADUCICADQiCIfEHoDTUCHCAEfnwhAyAAIAM+AiBB6A4gA0IgiD4CBEIAIQMgADUCCCACfkL/////D4MhBCAANQIIIANCIIh8QegNNQIAIAR+fCEDIAAgAz4CCCAANQIMIANCIIh8QegNNQIEIAR+fCEDIAAgAz4CDCAANQIQIANCIIh8QegNNQIIIAR+fCEDIAAgAz4CECAANQIUIANCIIh8QegNNQIMIAR+fCEDIAAgAz4CFCAANQIYIANCIIh8QegNNQIQIAR+fCEDIAAgAz4CGCAANQIcIANCIIh8QegNNQIUIAR+fCEDIAAgAz4CHCAANQIgIANCIIh8QegNNQIYIAR+fCEDIAAgAz4CICAANQIkIANCIIh8QegNNQIcIAR+fCEDIAAgAz4CJEHoDiADQiCIPgIIQgAhAyAANQIMIAJ+Qv////8PgyEEIAA1AgwgA0IgiHxB6A01AgAgBH58IQMgACADPgIMIAA1AhAgA0IgiHxB6A01AgQgBH58IQMgACADPgIQIAA1AhQgA0IgiHxB6A01AgggBH58IQMgACADPgIUIAA1AhggA0IgiHxB6A01AgwgBH58IQMgACADPgIYIAA1AhwgA0IgiHxB6A01AhAgBH58IQMgACADPgIcIAA1AiAgA0IgiHxB6A01AhQgBH58IQMgACADPgIgIAA1AiQgA0IgiHxB6A01AhggBH58IQMgACADPgIkIAA1AiggA0IgiHxB6A01AhwgBH58IQMgACADPgIoQegOIANCIIg+AgxCACEDIAA1AhAgAn5C/////w+DIQQgADUCECADQiCIfEHoDTUCACAEfnwhAyAAIAM+AhAgADUCFCADQiCIfEHoDTUCBCAEfnwhAyAAIAM+AhQgADUCGCADQiCIfEHoDTUCCCAEfnwhAyAAIAM+AhggADUCHCADQiCIfEHoDTUCDCAEfnwhAyAAIAM+AhwgADUCICADQiCIfEHoDTUCECAEfnwhAyAAIAM+AiAgADUCJCADQiCIfEHoDTUCFCAEfnwhAyAAIAM+AiQgADUCKCADQiCIfEHoDTUCGCAEfnwhAyAAIAM+AiggADUCLCADQiCIfEHoDTUCHCAEfnwhAyAAIAM+AixB6A4gA0IgiD4CEEIAIQMgADUCFCACfkL/////D4MhBCAANQIUIANCIIh8QegNNQIAIAR+fCEDIAAgAz4CFCAANQIYIANCIIh8QegNNQIEIAR+fCEDIAAgAz4CGCAANQIcIANCIIh8QegNNQIIIAR+fCEDIAAgAz4CHCAANQIgIANCIIh8QegNNQIMIAR+fCEDIAAgAz4CICAANQIkIANCIIh8QegNNQIQIAR+fCEDIAAgAz4CJCAANQIoIANCIIh8QegNNQIUIAR+fCEDIAAgAz4CKCAANQIsIANCIIh8QegNNQIYIAR+fCEDIAAgAz4CLCAANQIwIANCIIh8QegNNQIcIAR+fCEDIAAgAz4CMEHoDiADQiCIPgIUQgAhAyAANQIYIAJ+Qv////8PgyEEIAA1AhggA0IgiHxB6A01AgAgBH58IQMgACADPgIYIAA1AhwgA0IgiHxB6A01AgQgBH58IQMgACADPgIcIAA1AiAgA0IgiHxB6A01AgggBH58IQMgACADPgIgIAA1AiQgA0IgiHxB6A01AgwgBH58IQMgACADPgIkIAA1AiggA0IgiHxB6A01AhAgBH58IQMgACADPgIoIAA1AiwgA0IgiHxB6A01AhQgBH58IQMgACADPgIsIAA1AjAgA0IgiHxB6A01AhggBH58IQMgACADPgIwIAA1AjQgA0IgiHxB6A01AhwgBH58IQMgACADPgI0QegOIANCIIg+AhhCACEDIAA1AhwgAn5C/////w+DIQQgADUCHCADQiCIfEHoDTUCACAEfnwhAyAAIAM+AhwgADUCICADQiCIfEHoDTUCBCAEfnwhAyAAIAM+AiAgADUCJCADQiCIfEHoDTUCCCAEfnwhAyAAIAM+AiQgADUCKCADQiCIfEHoDTUCDCAEfnwhAyAAIAM+AiggADUCLCADQiCIfEHoDTUCECAEfnwhAyAAIAM+AiwgADUCMCADQiCIfEHoDTUCFCAEfnwhAyAAIAM+AjAgADUCNCADQiCIfEHoDTUCGCAEfnwhAyAAIAM+AjQgADUCOCADQiCIfEHoDTUCHCAEfnwhAyAAIAM+AjhB6A4gA0IgiD4CHEHoDiAAQSBqIAEQGAu+HyMBfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+AX4BfgF+Qv////8OIQUgA0L/////D4MgADUCACIGIAE1AgAiB358IQMgBCADQiCIfCEEIANC/////w+DIAV+Qv////8PgyEIIANC/////w+DQQA1AugNIgkgCH58IQMgBCADQiCIfCEEIARCIIghAyAEQv////8PgyAGIAE1AgQiC358IQQgAyAEQiCIfCEDIARC/////w+DIAA1AgQiCiAHfnwhBCADIARCIIh8IQMgBEL/////D4NBADUC7A0iDSAIfnwhBCADIARCIIh8IQMgBEL/////D4MgBX5C/////w+DIQwgBEL/////D4MgCSAMfnwhBCADIARCIIh8IQMgA0IgiCEEIANC/////w+DIAYgATUCCCIPfnwhAyAEIANCIIh8IQQgA0L/////D4MgCiALfnwhAyAEIANCIIh8IQQgA0L/////D4MgADUCCCIOIAd+fCEDIAQgA0IgiHwhBCADQv////8PgyANIAx+fCEDIAQgA0IgiHwhBCADQv////8Pg0EANQLwDSIRIAh+fCEDIAQgA0IgiHwhBCADQv////8PgyAFfkL/////D4MhECADQv////8PgyAJIBB+fCEDIAQgA0IgiHwhBCAEQiCIIQMgBEL/////D4MgBiABNQIMIhN+fCEEIAMgBEIgiHwhAyAEQv////8PgyAKIA9+fCEEIAMgBEIgiHwhAyAEQv////8PgyAOIAt+fCEEIAMgBEIgiHwhAyAEQv////8PgyAANQIMIhIgB358IQQgAyAEQiCIfCEDIARC/////w+DIA0gEH58IQQgAyAEQiCIfCEDIARC/////w+DIBEgDH58IQQgAyAEQiCIfCEDIARC/////w+DQQA1AvQNIhUgCH58IQQgAyAEQiCIfCEDIARC/////w+DIAV+Qv////8PgyEUIARC/////w+DIAkgFH58IQQgAyAEQiCIfCEDIANCIIghBCADQv////8PgyAGIAE1AhAiF358IQMgBCADQiCIfCEEIANC/////w+DIAogE358IQMgBCADQiCIfCEEIANC/////w+DIA4gD358IQMgBCADQiCIfCEEIANC/////w+DIBIgC358IQMgBCADQiCIfCEEIANC/////w+DIAA1AhAiFiAHfnwhAyAEIANCIIh8IQQgA0L/////D4MgDSAUfnwhAyAEIANCIIh8IQQgA0L/////D4MgESAQfnwhAyAEIANCIIh8IQQgA0L/////D4MgFSAMfnwhAyAEIANCIIh8IQQgA0L/////D4NBADUC+A0iGSAIfnwhAyAEIANCIIh8IQQgA0L/////D4MgBX5C/////w+DIRggA0L/////D4MgCSAYfnwhAyAEIANCIIh8IQQgBEIgiCEDIARC/////w+DIAYgATUCFCIbfnwhBCADIARCIIh8IQMgBEL/////D4MgCiAXfnwhBCADIARCIIh8IQMgBEL/////D4MgDiATfnwhBCADIARCIIh8IQMgBEL/////D4MgEiAPfnwhBCADIARCIIh8IQMgBEL/////D4MgFiALfnwhBCADIARCIIh8IQMgBEL/////D4MgADUCFCIaIAd+fCEEIAMgBEIgiHwhAyAEQv////8PgyANIBh+fCEEIAMgBEIgiHwhAyAEQv////8PgyARIBR+fCEEIAMgBEIgiHwhAyAEQv////8PgyAVIBB+fCEEIAMgBEIgiHwhAyAEQv////8PgyAZIAx+fCEEIAMgBEIgiHwhAyAEQv////8Pg0EANQL8DSIdIAh+fCEEIAMgBEIgiHwhAyAEQv////8PgyAFfkL/////D4MhHCAEQv////8PgyAJIBx+fCEEIAMgBEIgiHwhAyADQiCIIQQgA0L/////D4MgBiABNQIYIh9+fCEDIAQgA0IgiHwhBCADQv////8PgyAKIBt+fCEDIAQgA0IgiHwhBCADQv////8PgyAOIBd+fCEDIAQgA0IgiHwhBCADQv////8PgyASIBN+fCEDIAQgA0IgiHwhBCADQv////8PgyAWIA9+fCEDIAQgA0IgiHwhBCADQv////8PgyAaIAt+fCEDIAQgA0IgiHwhBCADQv////8PgyAANQIYIh4gB358IQMgBCADQiCIfCEEIANC/////w+DIA0gHH58IQMgBCADQiCIfCEEIANC/////w+DIBEgGH58IQMgBCADQiCIfCEEIANC/////w+DIBUgFH58IQMgBCADQiCIfCEEIANC/////w+DIBkgEH58IQMgBCADQiCIfCEEIANC/////w+DIB0gDH58IQMgBCADQiCIfCEEIANC/////w+DQQA1AoAOIiEgCH58IQMgBCADQiCIfCEEIANC/////w+DIAV+Qv////8PgyEgIANC/////w+DIAkgIH58IQMgBCADQiCIfCEEIARCIIghAyAEQv////8PgyAGIAE1AhwiI358IQQgAyAEQiCIfCEDIARC/////w+DIAogH358IQQgAyAEQiCIfCEDIARC/////w+DIA4gG358IQQgAyAEQiCIfCEDIARC/////w+DIBIgF358IQQgAyAEQiCIfCEDIARC/////w+DIBYgE358IQQgAyAEQiCIfCEDIARC/////w+DIBogD358IQQgAyAEQiCIfCEDIARC/////w+DIB4gC358IQQgAyAEQiCIfCEDIARC/////w+DIAA1AhwiIiAHfnwhBCADIARCIIh8IQMgBEL/////D4MgDSAgfnwhBCADIARCIIh8IQMgBEL/////D4MgESAcfnwhBCADIARCIIh8IQMgBEL/////D4MgFSAYfnwhBCADIARCIIh8IQMgBEL/////D4MgGSAUfnwhBCADIARCIIh8IQMgBEL/////D4MgHSAQfnwhBCADIARCIIh8IQMgBEL/////D4MgISAMfnwhBCADIARCIIh8IQMgBEL/////D4NBADUChA4iJSAIfnwhBCADIARCIIh8IQMgBEL/////D4MgBX5C/////w+DISQgBEL/////D4MgCSAkfnwhBCADIARCIIh8IQMgA0IgiCEEIANC/////w+DIAogI358IQMgBCADQiCIfCEEIANC/////w+DIA4gH358IQMgBCADQiCIfCEEIANC/////w+DIBIgG358IQMgBCADQiCIfCEEIANC/////w+DIBYgF358IQMgBCADQiCIfCEEIANC/////w+DIBogE358IQMgBCADQiCIfCEEIANC/////w+DIB4gD358IQMgBCADQiCIfCEEIANC/////w+DICIgC358IQMgBCADQiCIfCEEIANC/////w+DIA0gJH58IQMgBCADQiCIfCEEIANC/////w+DIBEgIH58IQMgBCADQiCIfCEEIANC/////w+DIBUgHH58IQMgBCADQiCIfCEEIANC/////w+DIBkgGH58IQMgBCADQiCIfCEEIANC/////w+DIB0gFH58IQMgBCADQiCIfCEEIANC/////w+DICEgEH58IQMgBCADQiCIfCEEIANC/////w+DICUgDH58IQMgBCADQiCIfCEEIAIgAz4CACAEQiCIIQMgBEL/////D4MgDiAjfnwhBCADIARCIIh8IQMgBEL/////D4MgEiAffnwhBCADIARCIIh8IQMgBEL/////D4MgFiAbfnwhBCADIARCIIh8IQMgBEL/////D4MgGiAXfnwhBCADIARCIIh8IQMgBEL/////D4MgHiATfnwhBCADIARCIIh8IQMgBEL/////D4MgIiAPfnwhBCADIARCIIh8IQMgBEL/////D4MgESAkfnwhBCADIARCIIh8IQMgBEL/////D4MgFSAgfnwhBCADIARCIIh8IQMgBEL/////D4MgGSAcfnwhBCADIARCIIh8IQMgBEL/////D4MgHSAYfnwhBCADIARCIIh8IQMgBEL/////D4MgISAUfnwhBCADIARCIIh8IQMgBEL/////D4MgJSAQfnwhBCADIARCIIh8IQMgAiAEPgIEIANCIIghBCADQv////8PgyASICN+fCEDIAQgA0IgiHwhBCADQv////8PgyAWIB9+fCEDIAQgA0IgiHwhBCADQv////8PgyAaIBt+fCEDIAQgA0IgiHwhBCADQv////8PgyAeIBd+fCEDIAQgA0IgiHwhBCADQv////8PgyAiIBN+fCEDIAQgA0IgiHwhBCADQv////8PgyAVICR+fCEDIAQgA0IgiHwhBCADQv////8PgyAZICB+fCEDIAQgA0IgiHwhBCADQv////8PgyAdIBx+fCEDIAQgA0IgiHwhBCADQv////8PgyAhIBh+fCEDIAQgA0IgiHwhBCADQv////8PgyAlIBR+fCEDIAQgA0IgiHwhBCACIAM+AgggBEIgiCEDIARC/////w+DIBYgI358IQQgAyAEQiCIfCEDIARC/////w+DIBogH358IQQgAyAEQiCIfCEDIARC/////w+DIB4gG358IQQgAyAEQiCIfCEDIARC/////w+DICIgF358IQQgAyAEQiCIfCEDIARC/////w+DIBkgJH58IQQgAyAEQiCIfCEDIARC/////w+DIB0gIH58IQQgAyAEQiCIfCEDIARC/////w+DICEgHH58IQQgAyAEQiCIfCEDIARC/////w+DICUgGH58IQQgAyAEQiCIfCEDIAIgBD4CDCADQiCIIQQgA0L/////D4MgGiAjfnwhAyAEIANCIIh8IQQgA0L/////D4MgHiAffnwhAyAEIANCIIh8IQQgA0L/////D4MgIiAbfnwhAyAEIANCIIh8IQQgA0L/////D4MgHSAkfnwhAyAEIANCIIh8IQQgA0L/////D4MgISAgfnwhAyAEIANCIIh8IQQgA0L/////D4MgJSAcfnwhAyAEIANCIIh8IQQgAiADPgIQIARCIIghAyAEQv////8PgyAeICN+fCEEIAMgBEIgiHwhAyAEQv////8PgyAiIB9+fCEEIAMgBEIgiHwhAyAEQv////8PgyAhICR+fCEEIAMgBEIgiHwhAyAEQv////8PgyAlICB+fCEEIAMgBEIgiHwhAyACIAQ+AhQgA0IgiCEEIANC/////w+DICIgI358IQMgBCADQiCIfCEEIANC/////w+DICUgJH58IQMgBCADQiCIfCEEIAIgAz4CGCAEQiCIIQMgAiAEPgIcIAOnBEAgAkHoDSACEAcaBSACQegNEAUEQCACQegNIAIQBxoLCwsSACAAIAFB6BIQCUHoEiACEBsLCwAgAEGIDiABEBwLFQAgAEGoExAAQcgTEAFBqBMgARAbCxcAIAAgARAfIAFB6A0gARANIAEgARAeCwkAQagOIAAQAAsVACAAIAFB6BMQHEHoE0GIDiACEBwLCwAgAEHoDSABEA0LCgAgAEHAAGoQAgsVACAAEAEgAEEgahAXIABBwABqEAELIgAgACABEAAgAEEgaiABQSBqEAAgAEHAAGogAUHAAGoQAAuGAgAgABAkBEAgACABECYPCyAAIABBiBQQEiAAQSBqIABBIGpBqBQQEkGoFEGoFEHIFBASIABBqBRB6BQQDkHoFEHoFEHoFBASQegUQYgUQegUEA9B6BRByBRB6BQQD0HoFEHoFEHoFBAOQYgUQYgUQYgVEA5BiBVBiBRBiBUQDkGIFUGIFUGoFRASIABBIGogAEHAAGpByBUQEkHoFEHoFCABEA5BqBUgASABEA9ByBRByBRB6BUQDkHoFUHoFUHoFRAOQegVQegVQegVEA5B6BQgASABQSBqEA8gAUEgakGIFSABQSBqEBIgAUEgakHoFSABQSBqEA9ByBVByBUgAUHAAGoQDgusAwIBfwF/IABBwABqIQMgAUHAAGohBCAAECQEQCABIAIQJg8LIAEQJARAIAAgAhAmDwsgAyADQYgWEBIgBCAEQagWEBIgAEGoFkHIFhASIAFBiBZB6BYQEiADQYgWQYgXEBIgBEGoFkGoFxASIABBIGpBqBdByBcQEiABQSBqQYgXQegXEBJByBZB6BYQBARAQcgXQegXEAQEQCAAIAIQJw8LC0HoFkHIFkGIGBAPQegXQcgXQagYEA9BiBhBiBhByBgQDkHIGEHIGEHIGBASQYgYQcgYQegYEBJBqBhBqBhBiBkQDkHIFkHIGEHIGRASQYgZQYgZQagZEBJByBlByBlB6BkQDkGoGUHoGCACEA8gAkHoGSACEA9ByBdB6BhBiBoQEkGIGkGIGkGIGhAOQcgZIAIgAkEgahAPIAJBIGpBiBkgAkEgahASIAJBIGpBiBogAkEgahAPIAMgBCACQcAAahAOIAJBwABqIAJBwABqIAJBwABqEBIgAkHAAGpBiBYgAkHAAGoQDyACQcAAakGoFiACQcAAahAPIAJBwABqQYgYIAJBwABqEBILIgAgACABEAAgAEEgaiABQSBqEBAgAEHAAGogAUHAAGoQAAsQACABIAIQKSAAIAIgAhAoCyIAIAAgARAVIABBIGogAUEgahAVIABBwABqIAFBwABqEBULIgAgACABEBQgAEEgaiABQSBqEBQgAEHAAGogAUHAAGoQFAtPACAAECQEQCABECUFIABBwABqQagaEBZBqBpBqBpByBoQEkGoGkHIGkHoGhASIABByBogARASIABBIGpB6BogAUEgahASIAFBwABqEBcLC6cCAgF/AX8gAEGIGxAmIAMQJSACIQQCQANAIARBAWshBCABIARqLQAAIQUgAyADECcgBUGAAU8EQCAFQYABayEFQYgbIAMgAxAoCyADIAMQJyAFQcAATwRAIAVBwABrIQVBiBsgAyADECgLIAMgAxAnIAVBIE8EQCAFQSBrIQVBiBsgAyADECgLIAMgAxAnIAVBEE8EQCAFQRBrIQVBiBsgAyADECgLIAMgAxAnIAVBCE8EQCAFQQhrIQVBiBsgAyADECgLIAMgAxAnIAVBBE8EQCAFQQRrIQVBiBsgAyADECgLIAMgAxAnIAVBAk8EQCAFQQJrIQVBiBsgAyADECgLIAMgAxAnIAVBAU8EQCAFQQFrIQVBiBsgAyADECgLIARFDQEMAAsLCysCAX8BfyAAQQV2QQJ0IQFBASAAQR9xdCECIAEgASgC6NsBIAJyNgLo2wELJAIBfwF/IABBBXZBAnQhAUEBIABBH3F0IQIgASgC6NsBIAJxC6ABBAF/AX8BfwF/IAAhAkHoGxAlQQAhBAJAA0AgBCABRg0BQegbQQEgBHRB4ABsaiEDIAIQAiEFIAIgAxAAIAJBIGohAiADQSBqIQMgAiADEAAgAkEgaiECIANBIGohAyAFBEAgAxABBSADEBcLIARBAWohBAwACwtB6NsBQpeChIAQNwMAQfDbAUIBNwMAQfjbAUIBNwMAQYDcAUIANwMAC0ADAX8BfwF/QegbIABB4ABsaiEBIAAQMEUEQCAALQCI3AEQMiECIAAtAIjeARAyIQMgAiADIAEQKCAAEC8LIAELpQEEAX8BfwF+AX5BACEDAkADQCADQSBGDQFCACEGQQAhBAJAA0AgBCABRg0BIAAgBEEgbCADamoxAAAhBSAFIAVCHIaEQo+AgIDwAYMhBSAFIAVCDoaEQoOAjICwgMABgyEFIAUgBUIHhoRCgYKEiJCgwIABgyEFIAYgBSAErYaEIQYgBEEBaiEEDAALCyACIANBCGxqIAY3AwAgA0EBaiEDDAALCwtLAQF/IAAgAkGI4AEQMyADECUgASACEDFBACEEAkADQCAEQYACRg0BIAMgAxAnIANBh+IBIARrLQAAEDIgAxAoIARBAWohBAwACwsLfgQBfwF/AX8BfyAAIQUgASEGIAUgAiADbiADbEEgbGohCAJAA0AgBSAIRg0BIAUgBiADQYjiARA0QYjiASAEIAQQKCAFQSAgA2xqIQUgBkHAACADbGohBgwACwsgAiADcCEHIAcEQCAFIAYgB0GI4gEQNEGI4gEgBCAEECgLC04CAX8BfyAAIAJB6OIBEDMgASACEDFBACEEAkADQCAEQYACRg0BIAMgBEHgAGxqIQUgBUHn5AEgBGstAAAQMiAFECggBEEBaiEEDAALCwspAQF/QQAhAgJAA0AgAiABRg0BIAAgAkHgAGxqECUgAkEBaiECDAALCwtIAgF/AX8gACEEIAQgAhAmIARB4ABqIQRBASEDAkADQCADIAFGDQEgAiACECcgBCACIAIQKCAEQeAAaiEEIANBAWohAwwACwsLigEEAX8BfwF/AX9B6OQBQYACEDcgACEFIAEhBiAFIAIgA24gA2xBIGxqIQgCQANAIAUgCEYNASAFIAYgA0Ho5AEQNiAFQSAgA2xqIQUgBkHAACADbGohBgwACwsgAiADcCEHIAcEQCAFIAYgB0Ho5AEQNgtB6OQBQYACQeikAxA4QeikAyAEIAQQKAtGACAAQf8BcS0AiLQDQRh0IABBCHZB/wFxLQCItANBEHRqIABBEHZB/wFxLQCItANBCHQgAEEYdkH/AXEtAIi0A2pqIAF3C2cFAX8BfwF/AX8Bf0EBIAF0IQJBACEDAkADQCADIAJGDQEgACADQSBsaiEFIAMgARA6IQQgACAEQSBsaiEGIAMgBEkEQCAFQYi2AxAAIAYgBRAAQYi2AyAGEAALIANBAWohAwwACwsL7wEJAX8BfwF/AX8BfwF/AX8BfwF/IAAgARA7QQEgAXQhCEEBIQMCQANAIAMgAUsNAUEBIAN0IQZByKUDIANBIGxqIQlBACEEAkADQCAEIAhPDQEgAgRAIAlBIGpBqLYDEAAFQai2AxAhCyAGQQF2IQdBACEFAkADQCAFIAdPDQEgACAEIAVqQSBsaiEKIAogB0EgbGohC0GotgMgC0HItgMQHCAKQei2AxAAQei2A0HItgMgChAYQei2A0HItgMgCxAZQai2AyAJQai2AxAcIAVBAWohBQwACwsgBCAGaiEEDAALCyADQQFqIQMMAAsLCz4DAX8BfwF/IAAhAyABIQQgACACQSBsaiEFAkADQCADIAVGDQEgAyAEEAAgA0EgaiEDIARBwABqIQQMAAsLCz0DAX8BfwF/IAAhAyABIQQgACACQSBsaiEFAkADQCADIAVGDQEgAyAEEB8gA0EgaiEDIARBIGohBAwACwsLPQMBfwF/AX8gACEDIAEhBCAAIAJBIGxqIQUCQANAIAMgBUYNASADIAQQHiADQSBqIQMgBEEgaiEEDAALCwuWAQcBfwF/AX8BfwF/AX8Bf0EBIAF0IQJB6KwDIAFBIGxqIQQgAkEBayEGQQEhBSACQQF2IQMCQANAIAUgA0YNASAAIAVBIGxqIQcgACACIAVrQSBsaiEIIAdBiLcDEAAgCCAEIAcQHEGItwMgBCAIEBwgBUEBaiEFDAALCyAAIAQgABAcIAAgA0EgbGohCCAIIAQgCBAcC0MCAX8BfyAAQQF2IQJBACEBAkADQCACRQ0BIAJBAXYhAiABQQFqIQEMAAsLIABBASABdEcEQAALIAFBHEsEQAALIAELEgEBfyABEEEhAyAAIAMgAhA8CxgBAX8gARBBIQMgACADIAIQPCAAIAMQQAtMBAF/AX8BfwF/IAAhBCABIQUgAyEGIAAgAkEgbGohBwJAA0AgBCAHRg0BIAQgBSAGEBwgBEEgaiEEIAVBIGohBSAGQSBqIQYMAAsLCy4CAX8BfyAAIQMgACABQSBsaiECAkADQCADIAJGDQEgAxABIANBIGohAwwACwsLjgEGAX8BfwF/AX8BfwF/QQAhBCAAIQYgASEHAkADQCAEIAJGDQEgBigCACEJIAZBBGohBkEAIQUCQANAIAUgCUYNASADIAYoAgBBIGxqIQggBkEEaiEGIAcgBkGotwMQHEGotwMgCCAIEBggBkEgaiEGIAVBAWohBQwACwsgB0EgaiEHIARBAWohBAwACwsLDgAgABACIABBIGoQAnELDQAgABABIABBIGoQAQsNACAAEBcgAEEgahABCxQAIAAgARAAIABBIGogAUEgahAAC3kAIAAgAUHotwMQEiAAQSBqIAFBIGpBiLgDEBIgACAAQSBqQai4AxAOIAEgAUEgakHIuAMQDkGouANByLgDQai4AxASQYi4A0HItwMgAhASQei3AyACIAIQDkHotwNBiLgDIAJBIGoQDkGouAMgAkEgaiACQSBqEA8LGwAgACABIAIQDiAAQSBqIAFBIGogAkEgahAOCxsAIAAgASACEA8gAEEgaiABQSBqIAJBIGoQDwsUACAAIAEQECAAQSBqIAFBIGoQEAsUACAAIAEQFCAAQSBqIAFBIGoQFAsUACAAIAEQFSAAQSBqIAFBIGoQFQsVACAAIAEQBCAAQSBqIAFBIGoQBHELaAAgACAAQei4AxASIABBIGogAEEgakGIuQMQEkGIuQNByLcDQai5AxASQei4A0GouQNBqLkDEA9BqLkDQci5AxAWIABByLkDIAEQEiAAQSBqQci5AyABQSBqEBIgAUEgaiABQSBqEBALCgAgAEGAAWoQRwsWACAAEEggAEHAAGoQSSAAQYABahBICyQAIAAgARBKIABBwABqIAFBwABqEEogAEGAAWogAUGAAWoQSgu8AgAgABBTBEAgACABEFUPCyAAIABB6LkDEEsgAEHAAGogAEHAAGpBqLoDEEtBqLoDQai6A0HougMQSyAAQai6A0GouwMQTEGouwNBqLsDQai7AxBLQai7A0HouQNBqLsDEE1BqLsDQei6A0GouwMQTUGouwNBqLsDQai7AxBMQei5A0HouQNB6LsDEExB6LsDQei5A0HouwMQTEHouwNB6LsDQai8AxBLIABBwABqIABBgAFqQei8AxBLQai7A0GouwMgARBMQai8AyABIAEQTUHougNB6LoDQai9AxBMQai9A0GovQNBqL0DEExBqL0DQai9A0GovQMQTEGouwMgASABQcAAahBNIAFBwABqQei7AyABQcAAahBLIAFBwABqQai9AyABQcAAahBNQei8A0HovAMgAUGAAWoQTAvvAwIBfwF/IABBgAFqIQMgAUGAAWohBCAAEFMEQCABIAIQVQ8LIAEQUwRAIAAgAhBVDwsgAyADQei9AxBLIAQgBEGovgMQSyAAQai+A0HovgMQSyABQei9A0GovwMQSyADQei9A0HovwMQSyAEQai+A0GowAMQSyAAQcAAakGowANB6MADEEsgAUHAAGpB6L8DQajBAxBLQei+A0GovwMQUQRAQejAA0GowQMQUQRAIAAgAhBWDwsLQai/A0HovgNB6MEDEE1BqMEDQejAA0GowgMQTUHowQNB6MEDQejCAxBMQejCA0HowgNB6MIDEEtB6MEDQejCA0GowwMQS0GowgNBqMIDQejDAxBMQei+A0HowgNB6MQDEEtB6MMDQejDA0GoxAMQS0HoxANB6MQDQajFAxBMQajEA0GowwMgAhBNIAJBqMUDIAIQTUHowANBqMMDQejFAxBLQejFA0HoxQNB6MUDEExB6MQDIAIgAkHAAGoQTSACQcAAakHowwMgAkHAAGoQSyACQcAAakHoxQMgAkHAAGoQTSADIAQgAkGAAWoQTCACQYABaiACQYABaiACQYABahBLIAJBgAFqQei9AyACQYABahBNIAJBgAFqQai+AyACQYABahBNIAJBgAFqQejBAyACQYABahBLCyQAIAAgARBKIABBwABqIAFBwABqEE4gAEGAAWogAUGAAWoQSgsQACABIAIQWCAAIAIgAhBXCyQAIAAgARBQIABBwABqIAFBwABqEFAgAEGAAWogAUGAAWoQUAskACAAIAEQTyAAQcAAaiABQcAAahBPIABBgAFqIAFBgAFqEE8LWgAgABBTBEAgARBUBSAAQYABakGoxgMQUkGoxgNBqMYDQejGAxBLQajGA0HoxgNBqMcDEEsgAEHoxgMgARBLIABBwABqQajHAyABQcAAahBLIAFBgAFqEEkLC7ACAgF/AX8gAEHoxwMQVSADEFQgAiEEAkADQCAEQQFrIQQgASAEai0AACEFIAMgAxBWIAVBgAFPBEAgBUGAAWshBUHoxwMgAyADEFcLIAMgAxBWIAVBwABPBEAgBUHAAGshBUHoxwMgAyADEFcLIAMgAxBWIAVBIE8EQCAFQSBrIQVB6McDIAMgAxBXCyADIAMQViAFQRBPBEAgBUEQayEFQejHAyADIAMQVwsgAyADEFYgBUEITwRAIAVBCGshBUHoxwMgAyADEFcLIAMgAxBWIAVBBE8EQCAFQQRrIQVB6McDIAMgAxBXCyADIAMQViAFQQJPBEAgBUECayEFQejHAyADIAMQVwsgAyADEFYgBUEBTwRAIAVBAWshBUHoxwMgAyADEFcLIARFDQEMAAsLCysCAX8BfyAAQQV2QQJ0IQFBASAAQR9xdCECIAEgASgCqMkGIAJyNgKoyQYLJAIBfwF/IABBBXZBAnQhAUEBIABBH3F0IQIgASgCqMkGIAJxC6YBBAF/AX8BfwF/IAAhAkGoyQMQVEEAIQQCQANAIAQgAUYNAUGoyQNBASAEdEHAAWxqIQMgAhBHIQUgAiADEEogAkHAAGohAiADQcAAaiEDIAIgAxBKIAJBwABqIQIgA0HAAGohAyAFBEAgAxBIBSADEEkLIARBAWohBAwACwtBqMkGQpeChIAQNwMAQbDJBkIBNwMAQbjJBkIBNwMAQcDJBkIANwMAC0EDAX8BfwF/QajJAyAAQcABbGohASAAEF9FBEAgAC0AyMkGEGEhAiAALQDIywYQYSEDIAIgAyABEFcgABBeCyABC6UBBAF/AX8BfgF+QQAhAwJAA0AgA0EgRg0BQgAhBkEAIQQCQANAIAQgAUYNASAAIARBIGwgA2pqMQAAIQUgBSAFQhyGhEKPgICA8AGDIQUgBSAFQg6GhEKDgIyAsIDAAYMhBSAFIAVCB4aEQoGChIiQoMCAAYMhBSAGIAUgBK2GhCEGIARBAWohBAwACwsgAiADQQhsaiAGNwMAIANBAWohAwwACwsLSwEBfyAAIAJByM0GEGIgAxBUIAEgAhBgQQAhBAJAA0AgBEGAAkYNASADIAMQViADQcfPBiAEay0AABBhIAMQVyAEQQFqIQQMAAsLC34EAX8BfwF/AX8gACEFIAEhBiAFIAIgA24gA2xBIGxqIQgCQANAIAUgCEYNASAFIAYgA0HIzwYQY0HIzwYgBCAEEFcgBUEgIANsaiEFIAZBgAEgA2xqIQYMAAsLIAIgA3AhByAHBEAgBSAGIAdByM8GEGNByM8GIAQgBBBXCwtOAgF/AX8gACACQYjRBhBiIAEgAhBgQQAhBAJAA0AgBEGAAkYNASADIARBwAFsaiEFIAVBh9MGIARrLQAAEGEgBRBXIARBAWohBAwACwsLKQEBf0EAIQICQANAIAIgAUYNASAAIAJBwAFsahBUIAJBAWohAgwACwsLSAIBfwF/IAAhBCAEIAIQVSAEQcABaiEEQQEhAwJAA0AgAyABRg0BIAIgAhBWIAQgAiACEFcgBEHAAWohBCADQQFqIQMMAAsLC4oBBAF/AX8BfwF/QYjTBkGAAhBmIAAhBSABIQYgBSACIANuIANsQSBsaiEIAkADQCAFIAhGDQEgBSAGIANBiNMGEGUgBUEgIANsaiEFIAZBgAEgA2xqIQYMAAsLIAIgA3AhByAHBEAgBSAGIAdBiNMGEGULQYjTBkGAAkGI0wkQZ0GI0wkgBCAEEFcLJAEBfyADIQQCQANAIAAgASACEBIgBEEBayEEIARFDQEMAAsLCyQBAX8gAyEEAkADQCAAIAEgAhATIARBAWshBCAERQ0BDAALCwsL/hsSAEEACwRIagIAAEEICyABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABB6AcLIEf9fNgWjCA8jcpxaJFqgZddWIGBtkVQuCmgMeFyTmQwAEGICAsgifqKU1v8LPP7AUXUERnntfZ/QQr/HqtHHzW4ynGf2AYAQagICyCdDY/FjUNd0z0Lx/Uo63gKLEZ5eG+jbmYv3weawXcKDgBByAgLIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEHoDQsgAQAA8JP14UORcLl5SOgzKF1YgYG2RVC4KaAx4XJOZDAAQYgOCyCnbSGuRea4G+NZXOOxOv5ThYC7Uz2DSYylRE5/sdAWAgBBqA4LIPv//08cNJasKc1gn5V2/DYuRnl4b6NuZi/fB5rBdwoOAEHIDgsgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQYjcAQuAAgAAAAIABAQGAAgICggMDAwAEBASEBQUFBAYGBgYGBgcACAgIiAkJCQgKCgoKCgoLCAwMDAwMDA0MDAwODA4ODgAQEBCQEREREBISEhISEhMQFBQUFBQUFRQUFBYUFhYWEBgYGBgYGBkYGBgaGBoaGhgYGBwYHBwcGBwcHBwcHB4AICAgoCEhISAiIiIiIiIjICQkJCQkJCUkJCQmJCYmJiAoKCgoKCgpKCgoKigqKiooKCgsKCwsLCgsLCwsLCwuIDAwMDAwMDEwMDAyMDIyMjAwMDQwNDQ0MDQ0NDQ0NDYwMDA4MDg4ODA4ODg4ODg6MDg4ODg4ODw4ODg8ODw8PAAQYjeAQuAAgAAAAEAAQIBAAECAQQBAgMAAQIBBAECAwgBAgMEBQYDAAECAQQBAgMIAQIDBAUGAxABAgMEBQYDCAkKAwwFBgcAAQIBBAECAwgBAgMEBQYDEAECAwQFBgMICQoDDAUGByABAgMEBQYDCAkKAwwFBgcQERIDFAUGBxgJCgsMDQ4HAAECAQQBAgMIAQIDBAUGAxABAgMEBQYDCAkKAwwFBgcgAQIDBAUGAwgJCgMMBQYHEBESAxQFBgcYCQoLDA0OB0ABAgMEBQYDCAkKAwwFBgcQERIDFAUGBxgJCgsMDQ4HICEiAyQFBgcoCQoLDA0OBzAREhMUFRYHGBkaCxwNDg8AQcilAwugB/v//08cNJasKc1gn5V2/DYuRnl4b6NuZi/fB5rBdwoOBgAAoHfBS5dno1jasnE38S4SCAlHouFR+sApR7HWWSKL79yelz11fyCRR7EsFz9fbmwJdHlisY3PCME5NXs3Kz98rbXiSq34voXLg//GYC33KZRdK/122anZmj/nfEAkA48vdHx9tvTMaNBj3C0baGpX+xvvvOWM/jy20lEpfBZkTFe/sfcUIvJ9MfcvI/kozXWtsKiEdeUDbRfcWfuBK0KecG6u8VG1znHA3RMpmJsOBYBC6VZzZO31B/wGuNMJgFNdsQYNFKuXWzG8zDovjE+ZBJIlN1l4NCbiWfDzshwAnKOeMZOPf4JXzPlZECV7fFP7zWe9g1asm6gYrsbsFzMECZKPksjJo/TZf6YBR9mLJ4/9+1Xmzt4OLRdwRY4VE6UgZnX5WZ2ZVwHqo0XnM2zdv2C/4paJx+I1twLvpiIudgBd/OlRSeWuZMGCrX128iJOQvGv4V+XE7D47etlI9kBPlZnQaSjJboMUrpemCwhbXCfkuALYy7ljTRjrYwPGmYZCIlu6JiUND20wnGJpQyvbkFNfcvYJ1nvfCLUBAERlgf+kG8TKjJxjFo7lZGQN1CWNzfy380mlBQCXqEpDNRyDoJMZGltDMJyc8g9YzCdm1pCQQw7VxcnCqB/QlgeELjTUZK0AZScwI809Zg83oOT1AeLGbXPYwx/RlvO7CngQ+GA5vdXj3vbSsX5Loork99rO4/jEMoAAl1nXrctKecj6qy4yOYv8R6NjwW1zvfwzRJ8H4QnUTCoubd9byIhzi1+AHOxdSTqeQVkX6otYtxn8e7Xdq71fylqiLEQ7iUzR54WRLPrASD4tYlq3XaJ3TQOTAP7n6IA4mGcFayzGX0R+krdZAdiV5Mti3GsHJG6+FYYISp3CMFg9aFV9WgXZIs6zEmo7UWQbqVH9LpafStbw6/v4Ua/Pkg47qP9/RfvaMRqvM7HsG9Jryf2s34eEapUzcyjkkpfuMOubR1HFMwGf4lFmV7tafi5x3bRxWN5uYLSR51EFtxVzV1/hyoj2h08y2o/HLkYoHNUZKTEngzfD2tkXfnp9i7EyNy6ei9uxcz31cVAdqfy89gf8xbnR/8w9Pae3HbbOE42ZfQcIrN9xQ6tQO/ha7dA7s7CGs1m0ftNi8+MHDB7M+wTiPEQuP45tsXHMpaZ8g8NQONcmNjssAEAiN2yKc6YbQ0HaR0AQeisAwugB/v//08cNJasKc1gn5V2/DYuRnl4b6NuZi/fB5rBdwoO/v//H9gUPHjdHo0Mby+Yr0VP/fySdF+PrL+cPRpjNx////8PbAoevG6PRoa3F8zXoqd+fkm6r0fWX84ejbGbDwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAQYi0AwuAAgCAQMAgoGDgEJBQ0DCwcPAIiEjIKKho6BiYWNg4uHj4BIRExCSkZOQUlFTUNLR09AyMTMwsrGzsHJxc3Dy8fPwCgkLCIqJi4hKSUtIysnLyCopKyiqqauoamlraOrp6+gaGRsYmpmbmFpZW1ja2dvYOjk7OLq5u7h6eXt4+vn7+AYFBwSGhYeERkVHRMbFx8QmJSckpqWnpGZlZ2Tm5efkFhUXFJaVl5RWVVdU1tXX1DY1NzS2tbe0dnV3dPb19/QODQ8Mjo2PjE5NT0zOzc/MLi0vLK6tr6xubW9s7u3v7B4dHxyenZ+cXl1fXN7d39w+PT88vr2/vH59f3z+/f/8AQci3Awsgqu/tEolIw2hPv6pyaH8IjTESCAlHouFR+sApR7HWWSIAQcjJBguAAgAAAAIABAQGAAgICggMDAwAEBASEBQUFBAYGBgYGBgcACAgIiAkJCQgKCgoKCgoLCAwMDAwMDA0MDAwODA4ODgAQEBCQEREREBISEhISEhMQFBQUFBQUFRQUFBYUFhYWEBgYGBgYGBkYGBgaGBoaGhgYGBwYHBwcGBwcHBwcHB4AICAgoCEhISAiIiIiIiIjICQkJCQkJCUkJCQmJCYmJiAoKCgoKCgpKCgoKigqKiooKCgsKCwsLCgsLCwsLCwuIDAwMDAwMDEwMDAyMDIyMjAwMDQwNDQ0MDQ0NDQ0NDYwMDA4MDg4ODA4ODg4ODg6MDg4ODg4ODw4ODg8ODw8PAAQcjLBguAAgAAAAEAAQIBAAECAQQBAgMAAQIBBAECAwgBAgMEBQYDAAECAQQBAgMIAQIDBAUGAxABAgMEBQYDCAkKAwwFBgcAAQIBBAECAwgBAgMEBQYDEAECAwQFBgMICQoDDAUGByABAgMEBQYDCAkKAwwFBgcQERIDFAUGBxgJCgsMDQ4HAAECAQQBAgMIAQIDBAUGAxABAgMEBQYDCAkKAwwFBgcgAQIDBAUGAwgJCgMMBQYHEBESAxQFBgcYCQoLDA0OB0ABAgMEBQYDCAkKAwwFBgcQERIDFAUGBxgJCgsMDQ4HICEiAyQFBgcoCQoLDA0OBzAREhMUFRYHGBkaCxwNDg8=","base64"),a.pq=1e3,a.pr=1768},9565:(e,a,t)=>{var c;e=t.nmd(e);var f=function(e){"use strict";var a=1e7,t=9007199254740992,c=l(t),d="0123456789abcdefghijklmnopqrstuvwxyz",r="function"==typeof BigInt;function n(e,a,t,c){return void 0===e?n[0]:void 0===a||10==+a&&!t?Z(e):$(e,a,t,c)}function i(e,a){this.value=e,this.sign=a,this.isSmall=!1}function b(e){this.value=e,this.sign=e<0,this.isSmall=!0}function o(e){this.value=e}function s(e){return-t0?Math.floor(e):Math.ceil(e)}function m(e,t){var c,f,d=e.length,r=t.length,n=new Array(d),i=0,b=a;for(f=0;f=b?1:0,n[f]=c-i*b;for(;f0&&n.push(i),n}function x(e,a){return e.length>=a.length?m(e,a):m(a,e)}function y(e,t){var c,f,d=e.length,r=new Array(d),n=a;for(f=0;f0;)r[f++]=t%n,t=Math.floor(t/n);return r}function A(e,t){var c,f,d=e.length,r=t.length,n=new Array(d),i=0,b=a;for(c=0;c0;)r[f++]=i%n,i=Math.floor(i/n);return r}function I(e,a){for(var t=[];a-- >0;)t.push(0);return t.concat(e)}function E(e,a){var t=Math.max(e.length,a.length);if(t<=30)return w(e,a);t=Math.ceil(t/2);var c=e.slice(t),f=e.slice(0,t),d=a.slice(t),r=a.slice(0,t),n=E(f,r),i=E(c,d),b=E(x(f,c),x(r,d)),o=x(x(n,I(A(A(b,n),i),t)),I(i,2*t));return h(o),o}function C(e,t,c){return new i(e=0;--c)d=(r=d*b+e[c])-(f=g(r/t))*t,i[c]=0|f;return[i,0|d]}function k(e,t){var c,f=Z(t);if(r)return[new o(e.value/f.value),new o(e.value%f.value)];var d,s=e.value,m=f.value;if(0===m)throw new Error("Cannot divide by zero");if(e.isSmall)return f.isSmall?[new b(g(s/m)),new b(s%m)]:[n[0],e];if(f.isSmall){if(1===m)return[e,n[0]];if(-1==m)return[e.negate(),n[0]];var x=Math.abs(m);if(x=0;f--){for(c=l-1,x[f+s]!==g&&(c=Math.floor((x[f+s]*l+x[f+s-1])/g)),d=0,r=0,i=y.length,n=0;nb&&(d=(d+1)*l),c=Math.ceil(d/r);do{if(L(n=_(t,c),s)<=0)break;c--}while(c);o.push(c),s=A(s,n)}return o.reverse(),[u(o),u(s)]}(s,m),d=c[0];var w=e.sign!==f.sign,I=c[1],E=e.sign;return"number"==typeof d?(w&&(d=-d),d=new b(d)):d=new i(d,w),"number"==typeof I?(E&&(I=-I),I=new b(I)):I=new i(I,E),[d,I]}function L(e,a){if(e.length!==a.length)return e.length>a.length?1:-1;for(var t=e.length-1;t>=0;t--)if(e[t]!==a[t])return e[t]>a[t]?1:-1;return 0}function S(e){var a=e.abs();return!a.isUnit()&&(!!(a.equals(2)||a.equals(3)||a.equals(5))||!(a.isEven()||a.isDivisibleBy(3)||a.isDivisibleBy(5))&&(!!a.lesser(49)||void 0))}function T(e,a){for(var t,c,d,r=e.prev(),n=r,i=0;n.isEven();)n=n.divide(2),i++;e:for(c=0;c=0?c=A(e,a):(c=A(a,e),t=!t),"number"==typeof(c=u(c))?(t&&(c=-c),new b(c)):new i(c,t)}(t,c,this.sign)},i.prototype.minus=i.prototype.subtract,b.prototype.subtract=function(e){var a=Z(e),t=this.value;if(t<0!==a.sign)return this.add(a.negate());var c=a.value;return a.isSmall?new b(t-c):v(c,Math.abs(t),t>=0)},b.prototype.minus=b.prototype.subtract,o.prototype.subtract=function(e){return new o(this.value-Z(e).value)},o.prototype.minus=o.prototype.subtract,i.prototype.negate=function(){return new i(this.value,!this.sign)},b.prototype.negate=function(){var e=this.sign,a=new b(-this.value);return a.sign=!e,a},o.prototype.negate=function(){return new o(-this.value)},i.prototype.abs=function(){return new i(this.value,!1)},b.prototype.abs=function(){return new b(Math.abs(this.value))},o.prototype.abs=function(){return new o(this.value>=0?this.value:-this.value)},i.prototype.multiply=function(e){var t,c,f,d=Z(e),r=this.value,b=d.value,o=this.sign!==d.sign;if(d.isSmall){if(0===b)return n[0];if(1===b)return this;if(-1===b)return this.negate();if((t=Math.abs(b))0?E(r,b):w(r,b),o)},i.prototype.times=i.prototype.multiply,b.prototype._multiplyBySmall=function(e){return s(e.value*this.value)?new b(e.value*this.value):C(Math.abs(e.value),l(Math.abs(this.value)),this.sign!==e.sign)},i.prototype._multiplyBySmall=function(e){return 0===e.value?n[0]:1===e.value?this:-1===e.value?this.negate():C(Math.abs(e.value),this.value,this.sign!==e.sign)},b.prototype.multiply=function(e){return Z(e)._multiplyBySmall(this)},b.prototype.times=b.prototype.multiply,o.prototype.multiply=function(e){return new o(this.value*Z(e).value)},o.prototype.times=o.prototype.multiply,i.prototype.square=function(){return new i(M(this.value),!1)},b.prototype.square=function(){var e=this.value*this.value;return s(e)?new b(e):new i(M(l(Math.abs(this.value))),!1)},o.prototype.square=function(e){return new o(this.value*this.value)},i.prototype.divmod=function(e){var a=k(this,e);return{quotient:a[0],remainder:a[1]}},o.prototype.divmod=b.prototype.divmod=i.prototype.divmod,i.prototype.divide=function(e){return k(this,e)[0]},o.prototype.over=o.prototype.divide=function(e){return new o(this.value/Z(e).value)},b.prototype.over=b.prototype.divide=i.prototype.over=i.prototype.divide,i.prototype.mod=function(e){return k(this,e)[1]},o.prototype.mod=o.prototype.remainder=function(e){return new o(this.value%Z(e).value)},b.prototype.remainder=b.prototype.mod=i.prototype.remainder=i.prototype.mod,i.prototype.pow=function(e){var a,t,c,f=Z(e),d=this.value,r=f.value;if(0===r)return n[1];if(0===d)return n[0];if(1===d)return n[1];if(-1===d)return f.isEven()?n[1]:n[-1];if(f.sign)return n[0];if(!f.isSmall)throw new Error("The exponent "+f.toString()+" is too large.");if(this.isSmall&&s(a=Math.pow(d,r)))return new b(g(a));for(t=this,c=n[1];!0&r&&(c=c.times(t),--r),0!==r;)r/=2,t=t.square();return c},b.prototype.pow=i.prototype.pow,o.prototype.pow=function(e){var a=Z(e),t=this.value,c=a.value,f=BigInt(0),d=BigInt(1),r=BigInt(2);if(c===f)return n[1];if(t===f)return n[0];if(t===d)return n[1];if(t===BigInt(-1))return a.isEven()?n[1]:n[-1];if(a.isNegative())return new o(f);for(var i=this,b=n[1];(c&d)===d&&(b=b.times(i),--c),c!==f;)c/=r,i=i.square();return b},i.prototype.modPow=function(e,a){if(e=Z(e),(a=Z(a)).isZero())throw new Error("Cannot take modPow with modulus 0");for(var t=n[1],c=this.mod(a);e.isPositive();){if(c.isZero())return n[0];e.isOdd()&&(t=t.multiply(c).mod(a)),e=e.divide(2),c=c.square().mod(a)}return t},o.prototype.modPow=b.prototype.modPow=i.prototype.modPow,i.prototype.compareAbs=function(e){var a=Z(e),t=this.value,c=a.value;return a.isSmall?1:L(t,c)},b.prototype.compareAbs=function(e){var a=Z(e),t=Math.abs(this.value),c=a.value;return a.isSmall?t===(c=Math.abs(c))?0:t>c?1:-1:-1},o.prototype.compareAbs=function(e){var a=this.value,t=Z(e).value;return(a=a>=0?a:-a)===(t=t>=0?t:-t)?0:a>t?1:-1},i.prototype.compare=function(e){if(e===1/0)return-1;if(e===-1/0)return 1;var a=Z(e),t=this.value,c=a.value;return this.sign!==a.sign?a.sign?1:-1:a.isSmall?this.sign?-1:1:L(t,c)*(this.sign?-1:1)},i.prototype.compareTo=i.prototype.compare,b.prototype.compare=function(e){if(e===1/0)return-1;if(e===-1/0)return 1;var a=Z(e),t=this.value,c=a.value;return a.isSmall?t==c?0:t>c?1:-1:t<0!==a.sign?t<0?-1:1:t<0?1:-1},b.prototype.compareTo=b.prototype.compare,o.prototype.compare=function(e){if(e===1/0)return-1;if(e===-1/0)return 1;var a=this.value,t=Z(e).value;return a===t?0:a>t?1:-1},o.prototype.compareTo=o.prototype.compare,i.prototype.equals=function(e){return 0===this.compare(e)},o.prototype.eq=o.prototype.equals=b.prototype.eq=b.prototype.equals=i.prototype.eq=i.prototype.equals,i.prototype.notEquals=function(e){return 0!==this.compare(e)},o.prototype.neq=o.prototype.notEquals=b.prototype.neq=b.prototype.notEquals=i.prototype.neq=i.prototype.notEquals,i.prototype.greater=function(e){return this.compare(e)>0},o.prototype.gt=o.prototype.greater=b.prototype.gt=b.prototype.greater=i.prototype.gt=i.prototype.greater,i.prototype.lesser=function(e){return this.compare(e)<0},o.prototype.lt=o.prototype.lesser=b.prototype.lt=b.prototype.lesser=i.prototype.lt=i.prototype.lesser,i.prototype.greaterOrEquals=function(e){return this.compare(e)>=0},o.prototype.geq=o.prototype.greaterOrEquals=b.prototype.geq=b.prototype.greaterOrEquals=i.prototype.geq=i.prototype.greaterOrEquals,i.prototype.lesserOrEquals=function(e){return this.compare(e)<=0},o.prototype.leq=o.prototype.lesserOrEquals=b.prototype.leq=b.prototype.lesserOrEquals=i.prototype.leq=i.prototype.lesserOrEquals,i.prototype.isEven=function(){return!(1&this.value[0])},b.prototype.isEven=function(){return!(1&this.value)},o.prototype.isEven=function(){return(this.value&BigInt(1))===BigInt(0)},i.prototype.isOdd=function(){return!(1&~this.value[0])},b.prototype.isOdd=function(){return!(1&~this.value)},o.prototype.isOdd=function(){return(this.value&BigInt(1))===BigInt(1)},i.prototype.isPositive=function(){return!this.sign},b.prototype.isPositive=function(){return this.value>0},o.prototype.isPositive=b.prototype.isPositive,i.prototype.isNegative=function(){return this.sign},b.prototype.isNegative=function(){return this.value<0},o.prototype.isNegative=b.prototype.isNegative,i.prototype.isUnit=function(){return!1},b.prototype.isUnit=function(){return 1===Math.abs(this.value)},o.prototype.isUnit=function(){return this.abs().value===BigInt(1)},i.prototype.isZero=function(){return!1},b.prototype.isZero=function(){return 0===this.value},o.prototype.isZero=function(){return this.value===BigInt(0)},i.prototype.isDivisibleBy=function(e){var a=Z(e);return!a.isZero()&&(!!a.isUnit()||(0===a.compareAbs(2)?this.isEven():this.mod(a).isZero()))},o.prototype.isDivisibleBy=b.prototype.isDivisibleBy=i.prototype.isDivisibleBy,i.prototype.isPrime=function(a){var t=S(this);if(t!==e)return t;var c=this.abs(),d=c.bitLength();if(d<=64)return T(c,[2,3,5,7,11,13,17,19,23,29,31,37]);for(var r=Math.log(2)*d.toJSNumber(),n=Math.ceil(!0===a?2*Math.pow(r,2):r),i=[],b=0;b-t?new b(e-1):new i(c,!0)},o.prototype.prev=function(){return new o(this.value-BigInt(1))};for(var N=[1];2*N[N.length-1]<=a;)N.push(2*N[N.length-1]);var R=N.length,P=N[R-1];function D(e){return Math.abs(e)<=a}function O(e,a,t){a=Z(a);for(var c=e.isNegative(),d=a.isNegative(),r=c?e.not():e,n=d?a.not():a,i=0,b=0,o=null,s=null,l=[];!r.isZero()||!n.isZero();)i=(o=k(r,P))[1].toJSNumber(),c&&(i=P-1-i),b=(s=k(n,P))[1].toJSNumber(),d&&(b=P-1-b),r=o[0],n=s[0],l.push(t(i,b));for(var u=0!==t(c?1:0,d?1:0)?f(-1):f(0),h=l.length-1;h>=0;h-=1)u=u.multiply(P).add(f(l[h]));return u}i.prototype.shiftLeft=function(e){var a=Z(e).toJSNumber();if(!D(a))throw new Error(String(a)+" is too large for shifting.");if(a<0)return this.shiftRight(-a);var t=this;if(t.isZero())return t;for(;a>=R;)t=t.multiply(P),a-=R-1;return t.multiply(N[a])},o.prototype.shiftLeft=b.prototype.shiftLeft=i.prototype.shiftLeft,i.prototype.shiftRight=function(e){var a,t=Z(e).toJSNumber();if(!D(t))throw new Error(String(t)+" is too large for shifting.");if(t<0)return this.shiftLeft(-t);for(var c=this;t>=R;){if(c.isZero()||c.isNegative()&&c.isUnit())return c;c=(a=k(c,P))[1].isNegative()?a[0].prev():a[0],t-=R-1}return(a=k(c,N[t]))[1].isNegative()?a[0].prev():a[0]},o.prototype.shiftRight=b.prototype.shiftRight=i.prototype.shiftRight,i.prototype.not=function(){return this.negate().prev()},o.prototype.not=b.prototype.not=i.prototype.not,i.prototype.and=function(e){return O(this,e,(function(e,a){return e&a}))},o.prototype.and=b.prototype.and=i.prototype.and,i.prototype.or=function(e){return O(this,e,(function(e,a){return e|a}))},o.prototype.or=b.prototype.or=i.prototype.or,i.prototype.xor=function(e){return O(this,e,(function(e,a){return e^a}))},o.prototype.xor=b.prototype.xor=i.prototype.xor;var F=1<<30;function Q(e){var t=e.value,c="number"==typeof t?t|F:"bigint"==typeof t?t|BigInt(F):t[0]+t[1]*a|1073758208;return c&-c}function U(e,a){if(a.compareTo(e)<=0){var t=U(e,a.square(a)),c=t.p,d=t.e,r=c.multiply(a);return r.compareTo(e)<=0?{p:r,e:2*d+1}:{p:c,e:2*d}}return{p:f(1),e:0}}function j(e,a){return e=Z(e),a=Z(a),e.greater(a)?e:a}function H(e,a){return e=Z(e),a=Z(a),e.lesser(a)?e:a}function q(e,a){if(e=Z(e).abs(),a=Z(a).abs(),e.equals(a))return e;if(e.isZero())return a;if(a.isZero())return e;for(var t,c,f=n[1];e.isEven()&&a.isEven();)t=H(Q(e),Q(a)),e=e.divide(t),a=a.divide(t),f=f.multiply(t);for(;e.isEven();)e=e.divide(Q(e));do{for(;a.isEven();)a=a.divide(Q(a));e.greater(a)&&(c=a,a=e,e=c),a=a.subtract(e)}while(!a.isZero());return f.isUnit()?e:e.multiply(f)}i.prototype.bitLength=function(){var e=this;return e.compareTo(f(0))<0&&(e=e.negate().subtract(f(1))),0===e.compareTo(f(0))?f(0):f(U(e,f(2)).e).add(f(1))},o.prototype.bitLength=b.prototype.bitLength=i.prototype.bitLength;var $=function(e,a,t,c){t=t||d,e=String(e),c||(e=e.toLowerCase(),t=t.toLowerCase());var f,r=e.length,n=Math.abs(a),i={};for(f=0;f=n){if("1"===s&&1===n)continue;throw new Error(s+" is not a valid digit in base "+a+".")}a=Z(a);var b=[],o="-"===e[0];for(f=o?1:0;f"!==e[f]&&f=0;c--)f=f.add(e[c].times(d)),d=d.times(a);return t?f.negate():f}function G(e,a){if((a=f(a)).isZero()){if(e.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(a.equals(-1)){if(e.isZero())return{value:[0],isNegative:!1};if(e.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-e.toJSNumber())).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var t=Array.apply(null,Array(e.toJSNumber()-1)).map(Array.prototype.valueOf,[0,1]);return t.unshift([1]),{value:[].concat.apply([],t),isNegative:!1}}var c=!1;if(e.isNegative()&&a.isPositive()&&(c=!0,e=e.abs()),a.isUnit())return e.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(e.toJSNumber())).map(Number.prototype.valueOf,1),isNegative:c};for(var d,r=[],n=e;n.isNegative()||n.compareAbs(a)>=0;){d=n.divmod(a),n=d.quotient;var i=d.remainder;i.isNegative()&&(i=a.minus(i).abs(),n=n.next()),r.push(i.toJSNumber())}return r.push(n.toJSNumber()),{value:r.reverse(),isNegative:c}}function K(e,a,t){var c=G(e,a);return(c.isNegative?"-":"")+c.value.map((function(e){return function(e,a){return e<(a=a||d).length?a[e]:"<"+e+">"}(e,t)})).join("")}function V(e){if(s(+e)){var a=+e;if(a===g(a))return r?new o(BigInt(a)):new b(a);throw new Error("Invalid integer: "+e)}var t="-"===e[0];t&&(e=e.slice(1));var c=e.split(/e/i);if(c.length>2)throw new Error("Invalid integer: "+c.join("e"));if(2===c.length){var f=c[1];if("+"===f[0]&&(f=f.slice(1)),(f=+f)!==g(f)||!s(f))throw new Error("Invalid integer: "+f+" is not a valid exponent.");var d=c[0],n=d.indexOf(".");if(n>=0&&(f-=d.length-n-1,d=d.slice(0,n)+d.slice(n+1)),f<0)throw new Error("Cannot include negative exponent part for integers");e=d+=new Array(f+1).join("0")}if(!/^([0-9][0-9]*)$/.test(e))throw new Error("Invalid integer: "+e);if(r)return new o(BigInt(t?"-"+e:e));for(var l=[],u=e.length,p=u-7;u>0;)l.push(+e.slice(p,u)),(p-=7)<0&&(p=0),u-=7;return h(l),new i(l,t)}function Z(e){return"number"==typeof e?function(e){if(r)return new o(BigInt(e));if(s(e)){if(e!==g(e))throw new Error(e+" is not an integer.");return new b(e)}return V(e.toString())}(e):"string"==typeof e?V(e):"bigint"==typeof e?new o(e):e}i.prototype.toArray=function(e){return G(this,e)},b.prototype.toArray=function(e){return G(this,e)},o.prototype.toArray=function(e){return G(this,e)},i.prototype.toString=function(a,t){if(a===e&&(a=10),10!==a)return K(this,a,t);for(var c,f=this.value,d=f.length,r=String(f[--d]);--d>=0;)c=String(f[d]),r+="0000000".slice(c.length)+c;return(this.sign?"-":"")+r},b.prototype.toString=function(a,t){return a===e&&(a=10),10!=a?K(this,a,t):String(this.value)},o.prototype.toString=b.prototype.toString,o.prototype.toJSON=i.prototype.toJSON=b.prototype.toJSON=function(){return this.toString()},i.prototype.valueOf=function(){return parseInt(this.toString(),10)},i.prototype.toJSNumber=i.prototype.valueOf,b.prototype.valueOf=function(){return this.value},b.prototype.toJSNumber=b.prototype.valueOf,o.prototype.valueOf=o.prototype.toJSNumber=function(){return parseInt(this.toString(),10)};for(var J=0;J<1e3;J++)n[J]=Z(J),J>0&&(n[-J]=Z(-J));return n.one=n[1],n.zero=n[0],n.minusOne=n[-1],n.max=j,n.min=H,n.gcd=q,n.lcm=function(e,a){return e=Z(e).abs(),a=Z(a).abs(),e.divide(q(e,a)).multiply(a)},n.isInstance=function(e){return e instanceof i||e instanceof b||e instanceof o},n.randBetween=function(e,t){var c=H(e=Z(e),t=Z(t)),f=j(e,t).subtract(c).add(1);if(f.isSmall)return c.add(Math.floor(Math.random()*f));for(var d=G(f,a).value,r=[],i=!0,b=0;b{const c=t(9565),f=t(71293),d=t(94148),r="undefined"!=typeof window;let n,i;r||(n=t(5183).Worker,i=t(91565));class b{constructor(){this.promise=new Promise(((e,a)=>{this.reject=a,this.resolve=e}))}}function o(e){let a,t,c;function f(e){for(;3&c[0];)c[0]++;const a=c[0];for(c[0]+=e;c[0]>t.buffer.byteLength;)t.grow(100);return c=new Uint32Array(t.buffer),a}function d(e){const a=f(e.byteLength),t=new Uint32Array(e);return c.set(t,a/4),a}function r(e,a){return t.buffer.slice(e,e+a)}e.onmessage=function(n){let i;if(i=n.data?n.data:n,"INIT"==i.command)(async function(e){const f=new Uint8Array(e.code),d=await WebAssembly.compile(f);t=new WebAssembly.Memory({initial:e.init}),c=new Uint32Array(t.buffer),a=await WebAssembly.instantiate(d,{env:{memory:t}})})(i).then((function(){e.postMessage(i.result)}));else if("G1_MULTIEXP"==i.command){const t=c[0],n=d(i.scalars),b=d(i.points),o=f(96);a.exports.g1_zero(o),a.exports.g1_multiexp2(n,b,i.n,7,o),i.result=r(o,96),c[0]=t,e.postMessage(i.result,[i.result])}else if("G2_MULTIEXP"==i.command){const t=c[0],n=d(i.scalars),b=d(i.points),o=f(192);a.exports.g2_zero(o),a.exports.g2_multiexp(n,b,i.n,7,o),i.result=r(o,192),c[0]=t,e.postMessage(i.result,[i.result])}else if("CALC_H"==i.command){const t=c[0],n=d(i.signals),b=d(i.polsA),o=d(i.polsB),s=i.nSignals,l=i.domainSize,u=f(32*s),h=f(32*l),p=f(32*l),g=f(32*l*2),m=f(32*l*2);a.exports.fft_toMontgomeryN(n,u,s),a.exports.pol_zero(h,l),a.exports.pol_zero(p,l),a.exports.pol_constructLC(b,u,s,h),a.exports.pol_constructLC(o,u,s,p),a.exports.fft_copyNInterleaved(h,g,l),a.exports.fft_copyNInterleaved(p,m,l),a.exports.fft_ifft(h,l,0),a.exports.fft_ifft(p,l,0),a.exports.fft_fft(h,l,1),a.exports.fft_fft(p,l,1),a.exports.fft_copyNInterleaved(h,g+32,l),a.exports.fft_copyNInterleaved(p,m+32,l),a.exports.fft_mulN(g,m,2*l,g),a.exports.fft_ifft(g,2*l,0),a.exports.fft_fromMontgomeryN(g+32*l,g+32*l,l),i.result=r(g+32*l,32*l),c[0]=t,e.postMessage(i.result,[i.result])}else"TERMINATE"==i.command&&process.exit()}}class s{constructor(){this.actionQueue=[]}postAction(e,a,t,c){return d(0==this.working[e]),this.working[e]=!0,this.pendingDeferreds[e]=c||new b,this.workers[e].postMessage(a,t),this.pendingDeferreds[e].promise}processWorks(){for(let e=0;e0;e++)if(0==this.working[e]){const a=this.actionQueue.shift();this.postAction(e,a.data,a.transfers,a.deferred)}}queueAction(e,a){const t=new b;return this.actionQueue.push({data:e,transfers:a,deferred:t}),this.processWorks(),t.promise}alloc(e){for(;3&this.i32[0];)this.i32[0]++;const a=this.i32[0];return this.i32[0]+=e,a}putBin(e,a){const t=new Uint32Array(a);this.i32.set(t,e/4)}getBin(e,a){return this.memory.buffer.slice(e,e+a)}bin2int(e){const a=new Uint32Array(e);let t=c(a[7]);for(let e=6;e>=0;e--)t=t.shiftLeft(32),t=t.add(a[e]);return t.toString()}bin2g1(e){return[this.bin2int(e.slice(0,32)),this.bin2int(e.slice(32,64)),this.bin2int(e.slice(64,96))]}bin2g2(e){return[[this.bin2int(e.slice(0,32)),this.bin2int(e.slice(32,64))],[this.bin2int(e.slice(64,96)),this.bin2int(e.slice(96,128))],[this.bin2int(e.slice(128,160)),this.bin2int(e.slice(160,192))]]}async g1_multiexp(e,a){const t=e.byteLength/32,c=Math.floor(t/this.workers.length),f=[];for(let d=0;dthis.g1_multiexp(e,v))),B=this.g1_multiexp(e.slice(0),m),k=this.g1_multiexp(e.slice(0),x),L=this.g2_multiexp(e.slice(0),y),S=this.g1_multiexp(e.slice(32*(f+1)),A),T=await Promise.all([B,k,L,S,M]),N=this.alloc(96),R=this.alloc(192),P=this.alloc(96),D=this.alloc(96);this.putBin(N,T[0]),this.putBin(D,T[1]),this.putBin(R,T[2]),this.putBin(P,T[3]);const O=this.loadPoint1(w),F=this.loadPoint1(_),Q=this.loadPoint1(I),U=this.loadPoint2(E),j=this.loadPoint2(C);let H=new Uint32Array(8);const q=this.alloc(96),$=this.alloc(192),z=this.alloc(32),G=this.alloc(32);if(r)window.crypto.getRandomValues(H),this.putBin(z,H),window.crypto.getRandomValues(H),this.putBin(G,H);else{const e=i.randomBytes(32);this.putBin(z,e);const a=i.randomBytes(32);this.putBin(G,a)}this.instance.exports.g1_add(O,N,N),this.instance.exports.g1_timesScalar(Q,z,32,q),this.instance.exports.g1_add(q,N,N),this.instance.exports.g2_add(U,R,R),this.instance.exports.g2_timesScalar(j,G,32,$),this.instance.exports.g2_add($,R,R),this.instance.exports.g1_add(F,D,D),this.instance.exports.g1_timesScalar(Q,G,32,q),this.instance.exports.g1_add(q,D,D),this.putBin(q,T[4]),this.instance.exports.g1_add(q,P,P),this.instance.exports.g1_timesScalar(N,G,32,q),this.instance.exports.g1_add(q,P,P),this.instance.exports.g1_timesScalar(D,z,32,q),this.instance.exports.g1_add(q,P,P);const K=this.alloc(64);return this.instance.exports.int_mul(z,G,K),this.instance.exports.g1_timesScalar(Q,K,64,q),this.instance.exports.g1_neg(q,q),this.instance.exports.g1_add(q,P,P),this.instance.exports.g1_affine(N,N),this.instance.exports.g2_affine(R,R),this.instance.exports.g1_affine(P,P),this.instance.exports.g1_fromMontgomery(N,N),this.instance.exports.g2_fromMontgomery(R,R),this.instance.exports.g1_fromMontgomery(P,P),{pi_a:this.bin2g1(this.getBin(N,96)),pi_b:this.bin2g2(this.getBin(R,192)),pi_c:this.bin2g1(this.getBin(P,96))}}}e.exports=async function(e){const a={wasmInitialMemory:5e3};Object.assign(a,e);const t=new s;t.q=c("21888242871839275222246405745257275088696311157297823662689037894645226208583"),t.r=c("21888242871839275222246405745257275088548364400416034343698204186575808495617"),t.n64=Math.floor((t.q.minus(1).bitLength()-1)/64)+1,t.n32=2*t.n64,t.n8=8*t.n64,t.memory=new WebAssembly.Memory({initial:a.wasmInitialMemory}),t.i32=new Uint32Array(t.memory.buffer);const d=await WebAssembly.compile(f.code);let i;function b(e){return function(a){let c;c=a&&a.data?a.data:a,t.working[e]=!1,t.pendingDeferreds[e].resolve(c),t.processWorks()}}t.instance=await WebAssembly.instantiate(d,{env:{memory:t.memory}}),t.pq=f.pq,t.pr=f.pr,t.pr0=t.alloc(192),t.pr1=t.alloc(192),t.workers=[],t.pendingDeferreds=[],t.working=[],i="object"==typeof navigator&&navigator.hardwareConcurrency?navigator.hardwareConcurrency:8;for(let e=0;e{const c=t(9565),f=t(98665),d=t(27351),r=t(56274).cL,n=(t(56274).XL,t(56274).ex,t(56274).Hf),i=t(73248).e,b=t(73248).H;e.exports={bigInt2BytesLE:function(e,a){const t=Array(a);let f=c(e);for(let e=0;efunction(e){let a=e.toString(16);for(;a.length<64;)a="0"+a;return a}(e))).join("")};return e.publicSignals&&(a.publicSignals=r(n(e.publicSignals))),a},genWitnessAndProve:async function(e,a,t,c){const r=function(e,a){const t=new f(b(a)),c=t.calculateWitness(b(e)),d=c.slice(1,t.nPubInputs+t.nOutputs+1);return{witness:c,publicSignals:d}}(a,t),n=function(e){const a=32*e.length,t=new ArrayBuffer(a),c={dataView:new DataView(t),offset:0},f=d(4294967295);for(let a=0;a{const c=t(9565);e.exports.ex=function e(a){if("bigint"==typeof a||a instanceof c)return a.toString(10);if(Array.isArray(a))return a.map(e);if("object"==typeof a){const t={};for(let c in a)t[c]=e(a[c]);return t}return a},e.exports.Hf=function e(a){if("string"==typeof a&&/^[0-9]+$/.test(a))return c(a);if(Array.isArray(a))return a.map(e);if("object"!=typeof a||a instanceof c)return a;{const t={};for(let c in a)t[c]=e(a[c]);return t}},e.exports.cL=function e(a){if("bigInt"==typeof a||a instanceof c){let e=a.toString(16);for(;e.length<64;)e="0"+e;return e="0x"+e,e}if(Array.isArray(a))return a.map(e);if("object"==typeof a){const t={};for(let c in a)t[c]=e(a[c]);return t}return a},e.exports.XL=function e(a){if("string"==typeof a&&/^0x[0-9a-fA-F]+$/.test(a))return c(a);if(Array.isArray(a))return a.map(e);if("object"==typeof a){const t={};for(let c in a)t[c]=e(a[c]);return t}return a}},63282:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.MissingRefError=a.ValidationError=a.CodeGen=a.Name=a.nil=a.stringify=a.str=a._=a.KeywordCxt=a.Ajv=void 0;const c=t(4042),f=t(86144),d=t(36653),r=t(72079),n=["/properties"],i="http://json-schema.org/draft-07/schema";class b extends c.default{_addVocabularies(){super._addVocabularies(),f.default.forEach((e=>this.addVocabulary(e))),this.opts.discriminator&&this.addKeyword(d.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(r,n):r;this.addMetaSchema(e,i,!1),this.refs["http://json-schema.org/schema"]=i}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}}a.Ajv=b,e.exports=a=b,e.exports.Ajv=b,Object.defineProperty(a,"__esModule",{value:!0}),a.default=b;var o=t(62586);Object.defineProperty(a,"KeywordCxt",{enumerable:!0,get:function(){return o.KeywordCxt}});var s=t(99029);Object.defineProperty(a,"_",{enumerable:!0,get:function(){return s._}}),Object.defineProperty(a,"str",{enumerable:!0,get:function(){return s.str}}),Object.defineProperty(a,"stringify",{enumerable:!0,get:function(){return s.stringify}}),Object.defineProperty(a,"nil",{enumerable:!0,get:function(){return s.nil}}),Object.defineProperty(a,"Name",{enumerable:!0,get:function(){return s.Name}}),Object.defineProperty(a,"CodeGen",{enumerable:!0,get:function(){return s.CodeGen}});var l=t(13558);Object.defineProperty(a,"ValidationError",{enumerable:!0,get:function(){return l.default}});var u=t(34551);Object.defineProperty(a,"MissingRefError",{enumerable:!0,get:function(){return u.default}})},41520:(e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.regexpCode=a.getEsmExportName=a.getProperty=a.safeStringify=a.stringify=a.strConcat=a.addCodeArg=a.str=a._=a.nil=a._Code=a.Name=a.IDENTIFIER=a._CodeOrName=void 0;class t{}a._CodeOrName=t,a.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class c extends t{constructor(e){if(super(),!a.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}a.Name=c;class f extends t{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce(((e,a)=>`${e}${a}`),"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce(((e,a)=>(a instanceof c&&(e[a.str]=(e[a.str]||0)+1),e)),{})}}function d(e,...a){const t=[e[0]];let c=0;for(;c{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.or=a.and=a.not=a.CodeGen=a.operators=a.varKinds=a.ValueScopeName=a.ValueScope=a.Scope=a.Name=a.regexpCode=a.stringify=a.getProperty=a.nil=a.strConcat=a.str=a._=void 0;const c=t(41520),f=t(57845);var d=t(41520);Object.defineProperty(a,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(a,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(a,"strConcat",{enumerable:!0,get:function(){return d.strConcat}}),Object.defineProperty(a,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(a,"getProperty",{enumerable:!0,get:function(){return d.getProperty}}),Object.defineProperty(a,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(a,"regexpCode",{enumerable:!0,get:function(){return d.regexpCode}}),Object.defineProperty(a,"Name",{enumerable:!0,get:function(){return d.Name}});var r=t(57845);Object.defineProperty(a,"Scope",{enumerable:!0,get:function(){return r.Scope}}),Object.defineProperty(a,"ValueScope",{enumerable:!0,get:function(){return r.ValueScope}}),Object.defineProperty(a,"ValueScopeName",{enumerable:!0,get:function(){return r.ValueScopeName}}),Object.defineProperty(a,"varKinds",{enumerable:!0,get:function(){return r.varKinds}}),a.operators={GT:new c._Code(">"),GTE:new c._Code(">="),LT:new c._Code("<"),LTE:new c._Code("<="),EQ:new c._Code("==="),NEQ:new c._Code("!=="),NOT:new c._Code("!"),OR:new c._Code("||"),AND:new c._Code("&&"),ADD:new c._Code("+")};class n{optimizeNodes(){return this}optimizeNames(e,a){return this}}class i extends n{constructor(e,a,t){super(),this.varKind=e,this.name=a,this.rhs=t}render({es5:e,_n:a}){const t=e?f.varKinds.var:this.varKind,c=void 0===this.rhs?"":` = ${this.rhs}`;return`${t} ${this.name}${c};`+a}optimizeNames(e,a){if(e[this.name.str])return this.rhs&&(this.rhs=S(this.rhs,e,a)),this}get names(){return this.rhs instanceof c._CodeOrName?this.rhs.names:{}}}class b extends n{constructor(e,a,t){super(),this.lhs=e,this.rhs=a,this.sideEffects=t}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,a){if(!(this.lhs instanceof c.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=S(this.rhs,e,a),this}get names(){return L(this.lhs instanceof c.Name?{}:{...this.lhs.names},this.rhs)}}class o extends b{constructor(e,a,t,c){super(e,t,c),this.op=a}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class s extends n{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class l extends n{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class u extends n{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class h extends n{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,a){return this.code=S(this.code,e,a),this}get names(){return this.code instanceof c._CodeOrName?this.code.names:{}}}class p extends n{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce(((a,t)=>a+t.render(e)),"")}optimizeNodes(){const{nodes:e}=this;let a=e.length;for(;a--;){const t=e[a].optimizeNodes();Array.isArray(t)?e.splice(a,1,...t):t?e[a]=t:e.splice(a,1)}return e.length>0?this:void 0}optimizeNames(e,a){const{nodes:t}=this;let c=t.length;for(;c--;){const f=t[c];f.optimizeNames(e,a)||(T(e,f.names),t.splice(c,1))}return t.length>0?this:void 0}get names(){return this.nodes.reduce(((e,a)=>k(e,a.names)),{})}}class g extends p{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class m extends p{}class x extends g{}x.kind="else";class y extends g{constructor(e,a){super(a),this.condition=e}render(e){let a=`if(${this.condition})`+super.render(e);return this.else&&(a+="else "+this.else.render(e)),a}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let a=this.else;if(a){const e=a.optimizeNodes();a=this.else=Array.isArray(e)?new x(e):e}return a?!1===e?a instanceof y?a:a.nodes:this.nodes.length?this:new y(N(e),a instanceof y?[a]:a.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,a){var t;if(this.else=null===(t=this.else)||void 0===t?void 0:t.optimizeNames(e,a),super.optimizeNames(e,a)||this.else)return this.condition=S(this.condition,e,a),this}get names(){const e=super.names;return L(e,this.condition),this.else&&k(e,this.else.names),e}}y.kind="if";class A extends g{}A.kind="for";class v extends A{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,a){if(super.optimizeNames(e,a))return this.iteration=S(this.iteration,e,a),this}get names(){return k(super.names,this.iteration.names)}}class w extends A{constructor(e,a,t,c){super(),this.varKind=e,this.name=a,this.from=t,this.to=c}render(e){const a=e.es5?f.varKinds.var:this.varKind,{name:t,from:c,to:d}=this;return`for(${a} ${t}=${c}; ${t}<${d}; ${t}++)`+super.render(e)}get names(){const e=L(super.names,this.from);return L(e,this.to)}}class _ extends A{constructor(e,a,t,c){super(),this.loop=e,this.varKind=a,this.name=t,this.iterable=c}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,a){if(super.optimizeNames(e,a))return this.iterable=S(this.iterable,e,a),this}get names(){return k(super.names,this.iterable.names)}}class I extends g{constructor(e,a,t){super(),this.name=e,this.args=a,this.async=t}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}I.kind="func";class E extends p{render(e){return"return "+super.render(e)}}E.kind="return";class C extends g{render(e){let a="try"+super.render(e);return this.catch&&(a+=this.catch.render(e)),this.finally&&(a+=this.finally.render(e)),a}optimizeNodes(){var e,a;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(a=this.finally)||void 0===a||a.optimizeNodes(),this}optimizeNames(e,a){var t,c;return super.optimizeNames(e,a),null===(t=this.catch)||void 0===t||t.optimizeNames(e,a),null===(c=this.finally)||void 0===c||c.optimizeNames(e,a),this}get names(){const e=super.names;return this.catch&&k(e,this.catch.names),this.finally&&k(e,this.finally.names),e}}class M extends g{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}M.kind="catch";class B extends g{render(e){return"finally"+super.render(e)}}function k(e,a){for(const t in a)e[t]=(e[t]||0)+(a[t]||0);return e}function L(e,a){return a instanceof c._CodeOrName?k(e,a.names):e}function S(e,a,t){return e instanceof c.Name?d(e):(f=e)instanceof c._Code&&f._items.some((e=>e instanceof c.Name&&1===a[e.str]&&void 0!==t[e.str]))?new c._Code(e._items.reduce(((e,a)=>(a instanceof c.Name&&(a=d(a)),a instanceof c._Code?e.push(...a._items):e.push(a),e)),[])):e;var f;function d(e){const c=t[e.str];return void 0===c||1!==a[e.str]?e:(delete a[e.str],c)}}function T(e,a){for(const t in a)e[t]=(e[t]||0)-(a[t]||0)}function N(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:c._`!${O(e)}`}B.kind="finally",a.CodeGen=class{constructor(e,a={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...a,_n:a.lines?"\n":""},this._extScope=e,this._scope=new f.Scope({parent:e}),this._nodes=[new m]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,a){const t=this._extScope.value(e,a);return(this._values[t.prefix]||(this._values[t.prefix]=new Set)).add(t),t}getScopeValue(e,a){return this._extScope.getValue(e,a)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,a,t,c){const f=this._scope.toName(a);return void 0!==t&&c&&(this._constants[f.str]=t),this._leafNode(new i(e,f,t)),f}const(e,a,t){return this._def(f.varKinds.const,e,a,t)}let(e,a,t){return this._def(f.varKinds.let,e,a,t)}var(e,a,t){return this._def(f.varKinds.var,e,a,t)}assign(e,a,t){return this._leafNode(new b(e,a,t))}add(e,t){return this._leafNode(new o(e,a.operators.ADD,t))}code(e){return"function"==typeof e?e():e!==c.nil&&this._leafNode(new h(e)),this}object(...e){const a=["{"];for(const[t,f]of e)a.length>1&&a.push(","),a.push(t),(t!==f||this.opts.es5)&&(a.push(":"),(0,c.addCodeArg)(a,f));return a.push("}"),new c._Code(a)}if(e,a,t){if(this._blockNode(new y(e)),a&&t)this.code(a).else().code(t).endIf();else if(a)this.code(a).endIf();else if(t)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new y(e))}else(){return this._elseNode(new x)}endIf(){return this._endBlockNode(y,x)}_for(e,a){return this._blockNode(e),a&&this.code(a).endFor(),this}for(e,a){return this._for(new v(e),a)}forRange(e,a,t,c,d=(this.opts.es5?f.varKinds.var:f.varKinds.let)){const r=this._scope.toName(e);return this._for(new w(d,r,a,t),(()=>c(r)))}forOf(e,a,t,d=f.varKinds.const){const r=this._scope.toName(e);if(this.opts.es5){const e=a instanceof c.Name?a:this.var("_arr",a);return this.forRange("_i",0,c._`${e}.length`,(a=>{this.var(r,c._`${e}[${a}]`),t(r)}))}return this._for(new _("of",d,r,a),(()=>t(r)))}forIn(e,a,t,d=(this.opts.es5?f.varKinds.var:f.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,c._`Object.keys(${a})`,t);const r=this._scope.toName(e);return this._for(new _("in",d,r,a),(()=>t(r)))}endFor(){return this._endBlockNode(A)}label(e){return this._leafNode(new s(e))}break(e){return this._leafNode(new l(e))}return(e){const a=new E;if(this._blockNode(a),this.code(e),1!==a.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(E)}try(e,a,t){if(!a&&!t)throw new Error('CodeGen: "try" without "catch" and "finally"');const c=new C;if(this._blockNode(c),this.code(e),a){const e=this.name("e");this._currNode=c.catch=new M(e),a(e)}return t&&(this._currNode=c.finally=new B,this.code(t)),this._endBlockNode(M,B)}throw(e){return this._leafNode(new u(e))}block(e,a){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(a),this}endBlock(e){const a=this._blockStarts.pop();if(void 0===a)throw new Error("CodeGen: not in self-balancing block");const t=this._nodes.length-a;if(t<0||void 0!==e&&t!==e)throw new Error(`CodeGen: wrong number of nodes: ${t} vs ${e} expected`);return this._nodes.length=a,this}func(e,a=c.nil,t,f){return this._blockNode(new I(e,a,t)),f&&this.code(f).endFunc(),this}endFunc(){return this._endBlockNode(I)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,a){const t=this._currNode;if(t instanceof e||a&&t instanceof a)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${a?`${e.kind}/${a.kind}`:e.kind}"`)}_elseNode(e){const a=this._currNode;if(!(a instanceof y))throw new Error('CodeGen: "else" without "if"');return this._currNode=a.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const a=this._nodes;a[a.length-1]=e}},a.not=N;const R=D(a.operators.AND);a.and=function(...e){return e.reduce(R)};const P=D(a.operators.OR);function D(e){return(a,t)=>a===c.nil?t:t===c.nil?a:c._`${O(a)} ${e} ${O(t)}`}function O(e){return e instanceof c.Name?e:c._`(${e})`}a.or=function(...e){return e.reduce(P)}},57845:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.ValueScope=a.ValueScopeName=a.Scope=a.varKinds=a.UsedValueState=void 0;const c=t(41520);class f extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var d;!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(d||(a.UsedValueState=d={})),a.varKinds={const:new c.Name("const"),let:new c.Name("let"),var:new c.Name("var")};class r{constructor({prefixes:e,parent:a}={}){this._names={},this._prefixes=e,this._parent=a}toName(e){return e instanceof c.Name?e:this.name(e)}name(e){return new c.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var a,t;if((null===(t=null===(a=this._parent)||void 0===a?void 0:a._prefixes)||void 0===t?void 0:t.has(e))||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}a.Scope=r;class n extends c.Name{constructor(e,a){super(a),this.prefix=e}setValue(e,{property:a,itemIndex:t}){this.value=e,this.scopePath=c._`.${new c.Name(a)}[${t}]`}}a.ValueScopeName=n;const i=c._`\n`;a.ValueScope=class extends r{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?i:c.nil}}get(){return this._scope}name(e){return new n(e,this._newName(e))}value(e,a){var t;if(void 0===a.ref)throw new Error("CodeGen: ref must be passed in value");const c=this.toName(e),{prefix:f}=c,d=null!==(t=a.key)&&void 0!==t?t:a.ref;let r=this._values[f];if(r){const e=r.get(d);if(e)return e}else r=this._values[f]=new Map;r.set(d,c);const n=this._scope[f]||(this._scope[f]=[]),i=n.length;return n[i]=a.ref,c.setValue(a,{property:f,itemIndex:i}),c}getValue(e,a){const t=this._values[e];if(t)return t.get(a)}scopeRefs(e,a=this._values){return this._reduceValues(a,(a=>{if(void 0===a.scopePath)throw new Error(`CodeGen: name "${a}" has no value`);return c._`${e}${a.scopePath}`}))}scopeCode(e=this._values,a,t){return this._reduceValues(e,(e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code}),a,t)}_reduceValues(e,t,r={},n){let i=c.nil;for(const b in e){const o=e[b];if(!o)continue;const s=r[b]=r[b]||new Map;o.forEach((e=>{if(s.has(e))return;s.set(e,d.Started);let r=t(e);if(r){const t=this.opts.es5?a.varKinds.var:a.varKinds.const;i=c._`${i}${t} ${e} = ${r};${this.opts._n}`}else{if(!(r=null==n?void 0:n(e)))throw new f(e);i=c._`${i}${r}${this.opts._n}`}s.set(e,d.Completed)}))}return i}}},48708:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.extendErrors=a.resetErrorsCount=a.reportExtraError=a.reportError=a.keyword$DataError=a.keywordError=void 0;const c=t(99029),f=t(94227),d=t(42023);function r(e,a){const t=e.const("err",a);e.if(c._`${d.default.vErrors} === null`,(()=>e.assign(d.default.vErrors,c._`[${t}]`)),c._`${d.default.vErrors}.push(${t})`),e.code(c._`${d.default.errors}++`)}function n(e,a){const{gen:t,validateName:f,schemaEnv:d}=e;d.$async?t.throw(c._`new ${e.ValidationError}(${a})`):(t.assign(c._`${f}.errors`,a),t.return(!1))}a.keywordError={message:({keyword:e})=>c.str`must pass "${e}" keyword validation`},a.keyword$DataError={message:({keyword:e,schemaType:a})=>a?c.str`"${e}" keyword must be ${a} ($data)`:c.str`"${e}" keyword is invalid ($data)`},a.reportError=function(e,t=a.keywordError,f,d){const{it:i}=e,{gen:o,compositeRule:s,allErrors:l}=i,u=b(e,t,f);(null!=d?d:s||l)?r(o,u):n(i,c._`[${u}]`)},a.reportExtraError=function(e,t=a.keywordError,c){const{it:f}=e,{gen:i,compositeRule:o,allErrors:s}=f;r(i,b(e,t,c)),o||s||n(f,d.default.vErrors)},a.resetErrorsCount=function(e,a){e.assign(d.default.errors,a),e.if(c._`${d.default.vErrors} !== null`,(()=>e.if(a,(()=>e.assign(c._`${d.default.vErrors}.length`,a)),(()=>e.assign(d.default.vErrors,null)))))},a.extendErrors=function({gen:e,keyword:a,schemaValue:t,data:f,errsCount:r,it:n}){if(void 0===r)throw new Error("ajv implementation error");const i=e.name("err");e.forRange("i",r,d.default.errors,(r=>{e.const(i,c._`${d.default.vErrors}[${r}]`),e.if(c._`${i}.instancePath === undefined`,(()=>e.assign(c._`${i}.instancePath`,(0,c.strConcat)(d.default.instancePath,n.errorPath)))),e.assign(c._`${i}.schemaPath`,c.str`${n.errSchemaPath}/${a}`),n.opts.verbose&&(e.assign(c._`${i}.schema`,t),e.assign(c._`${i}.data`,f))}))};const i={keyword:new c.Name("keyword"),schemaPath:new c.Name("schemaPath"),params:new c.Name("params"),propertyName:new c.Name("propertyName"),message:new c.Name("message"),schema:new c.Name("schema"),parentSchema:new c.Name("parentSchema")};function b(e,a,t){const{createErrors:f}=e.it;return!1===f?c._`{}`:function(e,a,t={}){const{gen:f,it:r}=e,n=[o(r,t),s(e,t)];return function(e,{params:a,message:t},f){const{keyword:r,data:n,schemaValue:b,it:o}=e,{opts:s,propertyName:l,topSchemaRef:u,schemaPath:h}=o;f.push([i.keyword,r],[i.params,"function"==typeof a?a(e):a||c._`{}`]),s.messages&&f.push([i.message,"function"==typeof t?t(e):t]),s.verbose&&f.push([i.schema,b],[i.parentSchema,c._`${u}${h}`],[d.default.data,n]),l&&f.push([i.propertyName,l])}(e,a,n),f.object(...n)}(e,a,t)}function o({errorPath:e},{instancePath:a}){const t=a?c.str`${e}${(0,f.getErrorPath)(a,f.Type.Str)}`:e;return[d.default.instancePath,(0,c.strConcat)(d.default.instancePath,t)]}function s({keyword:e,it:{errSchemaPath:a}},{schemaPath:t,parentSchema:d}){let r=d?a:c.str`${a}/${e}`;return t&&(r=c.str`${r}${(0,f.getErrorPath)(t,f.Type.Str)}`),[i.schemaPath,r]}},73835:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.resolveSchema=a.getCompilingSchema=a.resolveRef=a.compileSchema=a.SchemaEnv=void 0;const c=t(99029),f=t(13558),d=t(42023),r=t(66939),n=t(94227),i=t(62586);class b{constructor(e){var a;let t;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(t=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(a=e.baseId)&&void 0!==a?a:(0,r.normalizeId)(null==t?void 0:t[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==t?void 0:t.$async,this.refs={}}}function o(e){const a=l.call(this,e);if(a)return a;const t=(0,r.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:b}=this.opts.code,{ownProperties:o}=this.opts,s=new c.CodeGen(this.scope,{es5:n,lines:b,ownProperties:o});let u;e.$async&&(u=s.scopeValue("Error",{ref:f.default,code:c._`require("ajv/dist/runtime/validation_error").default`}));const h=s.scopeName("validate");e.validateName=h;const p={gen:s,allErrors:this.opts.allErrors,data:d.default.data,parentData:d.default.parentData,parentDataProperty:d.default.parentDataProperty,dataNames:[d.default.data],dataPathArr:[c.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,c.stringify)(e.schema)}:{ref:e.schema}),validateName:h,ValidationError:u,schema:e.schema,schemaEnv:e,rootId:t,baseId:e.baseId||t,schemaPath:c.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:c._`""`,opts:this.opts,self:this};let g;try{this._compilations.add(e),(0,i.validateFunctionCode)(p),s.optimize(this.opts.code.optimize);const a=s.toString();g=`${s.scopeRefs(d.default.scope)}return ${a}`,this.opts.code.process&&(g=this.opts.code.process(g,e));const t=new Function(`${d.default.self}`,`${d.default.scope}`,g)(this,this.scope.get());if(this.scope.value(h,{ref:t}),t.errors=null,t.schema=e.schema,t.schemaEnv=e,e.$async&&(t.$async=!0),!0===this.opts.code.source&&(t.source={validateName:h,validateCode:a,scopeValues:s._values}),this.opts.unevaluated){const{props:e,items:a}=p;t.evaluated={props:e instanceof c.Name?void 0:e,items:a instanceof c.Name?void 0:a,dynamicProps:e instanceof c.Name,dynamicItems:a instanceof c.Name},t.source&&(t.source.evaluated=(0,c.stringify)(t.evaluated))}return e.validate=t,e}catch(a){throw delete e.validate,delete e.validateName,g&&this.logger.error("Error compiling schema, function code:",g),a}finally{this._compilations.delete(e)}}function s(e){return(0,r.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:o.call(this,e)}function l(e){for(const c of this._compilations)if(t=e,(a=c).schema===t.schema&&a.root===t.root&&a.baseId===t.baseId)return c;var a,t}function u(e,a){let t;for(;"string"==typeof(t=this.refs[a]);)a=t;return t||this.schemas[a]||h.call(this,e,a)}function h(e,a){const t=this.opts.uriResolver.parse(a),c=(0,r._getFullPath)(this.opts.uriResolver,t);let f=(0,r.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&c===f)return g.call(this,t,e);const d=(0,r.normalizeId)(c),n=this.refs[d]||this.schemas[d];if("string"==typeof n){const a=h.call(this,e,n);if("object"!=typeof(null==a?void 0:a.schema))return;return g.call(this,t,a)}if("object"==typeof(null==n?void 0:n.schema)){if(n.validate||o.call(this,n),d===(0,r.normalizeId)(a)){const{schema:a}=n,{schemaId:t}=this.opts,c=a[t];return c&&(f=(0,r.resolveUrl)(this.opts.uriResolver,f,c)),new b({schema:a,schemaId:t,root:e,baseId:f})}return g.call(this,t,n)}}a.SchemaEnv=b,a.compileSchema=o,a.resolveRef=function(e,a,t){var c;t=(0,r.resolveUrl)(this.opts.uriResolver,a,t);const f=e.refs[t];if(f)return f;let d=u.call(this,e,t);if(void 0===d){const f=null===(c=e.localRefs)||void 0===c?void 0:c[t],{schemaId:r}=this.opts;f&&(d=new b({schema:f,schemaId:r,root:e,baseId:a}))}return void 0!==d?e.refs[t]=s.call(this,d):void 0},a.getCompilingSchema=l,a.resolveSchema=h;const p=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function g(e,{baseId:a,schema:t,root:c}){var f;if("/"!==(null===(f=e.fragment)||void 0===f?void 0:f[0]))return;for(const c of e.fragment.slice(1).split("/")){if("boolean"==typeof t)return;const e=t[(0,n.unescapeFragment)(c)];if(void 0===e)return;const f="object"==typeof(t=e)&&t[this.opts.schemaId];!p.has(c)&&f&&(a=(0,r.resolveUrl)(this.opts.uriResolver,a,f))}let d;if("boolean"!=typeof t&&t.$ref&&!(0,n.schemaHasRulesButRef)(t,this.RULES)){const e=(0,r.resolveUrl)(this.opts.uriResolver,a,t.$ref);d=h.call(this,c,e)}const{schemaId:i}=this.opts;return d=d||new b({schema:t,schemaId:i,root:c,baseId:a}),d.schema!==d.root.schema?d:void 0}},42023:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(99029),f={data:new c.Name("data"),valCxt:new c.Name("valCxt"),instancePath:new c.Name("instancePath"),parentData:new c.Name("parentData"),parentDataProperty:new c.Name("parentDataProperty"),rootData:new c.Name("rootData"),dynamicAnchors:new c.Name("dynamicAnchors"),vErrors:new c.Name("vErrors"),errors:new c.Name("errors"),this:new c.Name("this"),self:new c.Name("self"),scope:new c.Name("scope"),json:new c.Name("json"),jsonPos:new c.Name("jsonPos"),jsonLen:new c.Name("jsonLen"),jsonPart:new c.Name("jsonPart")};a.default=f},34551:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(66939);class f extends Error{constructor(e,a,t,f){super(f||`can't resolve reference ${t} from id ${a}`),this.missingRef=(0,c.resolveUrl)(e,a,t),this.missingSchema=(0,c.normalizeId)((0,c.getFullPath)(e,this.missingRef))}}a.default=f},66939:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.getSchemaRefs=a.resolveUrl=a.normalizeId=a._getFullPath=a.getFullPath=a.inlineRef=void 0;const c=t(94227),f=t(32017),d=t(7106),r=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);a.inlineRef=function(e,a=!0){return"boolean"==typeof e||(!0===a?!i(e):!!a&&b(e)<=a)};const n=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function i(e){for(const a in e){if(n.has(a))return!0;const t=e[a];if(Array.isArray(t)&&t.some(i))return!0;if("object"==typeof t&&i(t))return!0}return!1}function b(e){let a=0;for(const t in e){if("$ref"===t)return 1/0;if(a++,!r.has(t)&&("object"==typeof e[t]&&(0,c.eachItem)(e[t],(e=>a+=b(e))),a===1/0))return 1/0}return a}function o(e,a="",t){!1!==t&&(a=u(a));const c=e.parse(a);return s(e,c)}function s(e,a){return e.serialize(a).split("#")[0]+"#"}a.getFullPath=o,a._getFullPath=s;const l=/#\/?$/;function u(e){return e?e.replace(l,""):""}a.normalizeId=u,a.resolveUrl=function(e,a,t){return t=u(t),e.resolve(a,t)};const h=/^[a-z_][-a-z0-9._]*$/i;a.getSchemaRefs=function(e,a){if("boolean"==typeof e)return{};const{schemaId:t,uriResolver:c}=this.opts,r=u(e[t]||a),n={"":r},i=o(c,r,!1),b={},s=new Set;return d(e,{allKeys:!0},((e,a,c,f)=>{if(void 0===f)return;const d=i+a;let r=n[f];function o(a){const t=this.opts.uriResolver.resolve;if(a=u(r?t(r,a):a),s.has(a))throw p(a);s.add(a);let c=this.refs[a];return"string"==typeof c&&(c=this.refs[c]),"object"==typeof c?l(e,c.schema,a):a!==u(d)&&("#"===a[0]?(l(e,b[a],a),b[a]=e):this.refs[a]=d),a}function g(e){if("string"==typeof e){if(!h.test(e))throw new Error(`invalid anchor "${e}"`);o.call(this,`#${e}`)}}"string"==typeof e[t]&&(r=o.call(this,e[t])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),n[a]=r})),b;function l(e,a,t){if(void 0!==a&&!f(e,a))throw p(t)}function p(e){return new Error(`reference "${e}" resolves to more than one schema`)}}},10396:(e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.getRules=a.isJSONType=void 0;const t=new Set(["string","number","integer","boolean","null","object","array"]);a.isJSONType=function(e){return"string"==typeof e&&t.has(e)},a.getRules=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}},94227:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.checkStrictMode=a.getErrorPath=a.Type=a.useFunc=a.setEvaluated=a.evaluatedPropsToName=a.mergeEvaluated=a.eachItem=a.unescapeJsonPointer=a.escapeJsonPointer=a.escapeFragment=a.unescapeFragment=a.schemaRefOrVal=a.schemaHasRulesButRef=a.schemaHasRules=a.checkUnknownRules=a.alwaysValidSchema=a.toHash=void 0;const c=t(99029),f=t(41520);function d(e,a=e.schema){const{opts:t,self:c}=e;if(!t.strictSchema)return;if("boolean"==typeof a)return;const f=c.RULES.keywords;for(const t in a)f[t]||h(e,`unknown keyword: "${t}"`)}function r(e,a){if("boolean"==typeof e)return!e;for(const t in e)if(a[t])return!0;return!1}function n(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function i(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function b({mergeNames:e,mergeToName:a,mergeValues:t,resultToName:f}){return(d,r,n,i)=>{const b=void 0===n?r:n instanceof c.Name?(r instanceof c.Name?e(d,r,n):a(d,r,n),n):r instanceof c.Name?(a(d,n,r),r):t(r,n);return i!==c.Name||b instanceof c.Name?b:f(d,b)}}function o(e,a){if(!0===a)return e.var("props",!0);const t=e.var("props",c._`{}`);return void 0!==a&&s(e,t,a),t}function s(e,a,t){Object.keys(t).forEach((t=>e.assign(c._`${a}${(0,c.getProperty)(t)}`,!0)))}a.toHash=function(e){const a={};for(const t of e)a[t]=!0;return a},a.alwaysValidSchema=function(e,a){return"boolean"==typeof a?a:0===Object.keys(a).length||(d(e,a),!r(a,e.self.RULES.all))},a.checkUnknownRules=d,a.schemaHasRules=r,a.schemaHasRulesButRef=function(e,a){if("boolean"==typeof e)return!e;for(const t in e)if("$ref"!==t&&a.all[t])return!0;return!1},a.schemaRefOrVal=function({topSchemaRef:e,schemaPath:a},t,f,d){if(!d){if("number"==typeof t||"boolean"==typeof t)return t;if("string"==typeof t)return c._`${t}`}return c._`${e}${a}${(0,c.getProperty)(f)}`},a.unescapeFragment=function(e){return i(decodeURIComponent(e))},a.escapeFragment=function(e){return encodeURIComponent(n(e))},a.escapeJsonPointer=n,a.unescapeJsonPointer=i,a.eachItem=function(e,a){if(Array.isArray(e))for(const t of e)a(t);else a(e)},a.mergeEvaluated={props:b({mergeNames:(e,a,t)=>e.if(c._`${t} !== true && ${a} !== undefined`,(()=>{e.if(c._`${a} === true`,(()=>e.assign(t,!0)),(()=>e.assign(t,c._`${t} || {}`).code(c._`Object.assign(${t}, ${a})`)))})),mergeToName:(e,a,t)=>e.if(c._`${t} !== true`,(()=>{!0===a?e.assign(t,!0):(e.assign(t,c._`${t} || {}`),s(e,t,a))})),mergeValues:(e,a)=>!0===e||{...e,...a},resultToName:o}),items:b({mergeNames:(e,a,t)=>e.if(c._`${t} !== true && ${a} !== undefined`,(()=>e.assign(t,c._`${a} === true ? true : ${t} > ${a} ? ${t} : ${a}`))),mergeToName:(e,a,t)=>e.if(c._`${t} !== true`,(()=>e.assign(t,!0===a||c._`${t} > ${a} ? ${t} : ${a}`))),mergeValues:(e,a)=>!0===e||Math.max(e,a),resultToName:(e,a)=>e.var("items",a)})},a.evaluatedPropsToName=o,a.setEvaluated=s;const l={};var u;function h(e,a,t=e.opts.strictSchema){if(t){if(a=`strict mode: ${a}`,!0===t)throw new Error(a);e.self.logger.warn(a)}}a.useFunc=function(e,a){return e.scopeValue("func",{ref:a,code:l[a.code]||(l[a.code]=new f._Code(a.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(u||(a.Type=u={})),a.getErrorPath=function(e,a,t){if(e instanceof c.Name){const f=a===u.Num;return t?f?c._`"[" + ${e} + "]"`:c._`"['" + ${e} + "']"`:f?c._`"/" + ${e}`:c._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return t?(0,c.getProperty)(e).toString():"/"+n(e)},a.checkStrictMode=h},7887:(e,a)=>{"use strict";function t(e,a){return a.rules.some((a=>c(e,a)))}function c(e,a){var t;return void 0!==e[a.keyword]||(null===(t=a.definition.implements)||void 0===t?void 0:t.some((a=>void 0!==e[a])))}Object.defineProperty(a,"__esModule",{value:!0}),a.shouldUseRule=a.shouldUseGroup=a.schemaHasRulesForType=void 0,a.schemaHasRulesForType=function({schema:e,self:a},c){const f=a.RULES.types[c];return f&&!0!==f&&t(e,f)},a.shouldUseGroup=t,a.shouldUseRule=c},28727:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.boolOrEmptySchema=a.topBoolOrEmptySchema=void 0;const c=t(48708),f=t(99029),d=t(42023),r={message:"boolean schema is false"};function n(e,a){const{gen:t,data:f}=e,d={gen:t,keyword:"false schema",data:f,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,c.reportError)(d,r,void 0,a)}a.topBoolOrEmptySchema=function(e){const{gen:a,schema:t,validateName:c}=e;!1===t?n(e,!1):"object"==typeof t&&!0===t.$async?a.return(d.default.data):(a.assign(f._`${c}.errors`,null),a.return(!0))},a.boolOrEmptySchema=function(e,a){const{gen:t,schema:c}=e;!1===c?(t.var(a,!1),n(e)):t.var(a,!0)}},10208:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.reportTypeError=a.checkDataTypes=a.checkDataType=a.coerceAndCheckDataType=a.getJSONTypes=a.getSchemaTypes=a.DataType=void 0;const c=t(10396),f=t(7887),d=t(48708),r=t(99029),n=t(94227);var i;function b(e){const a=Array.isArray(e)?e:e?[e]:[];if(a.every(c.isJSONType))return a;throw new Error("type must be JSONType or JSONType[]: "+a.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(i||(a.DataType=i={})),a.getSchemaTypes=function(e){const a=b(e.type);if(a.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!a.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&a.push("null")}return a},a.getJSONTypes=b,a.coerceAndCheckDataType=function(e,a){const{gen:t,data:c,opts:d}=e,n=function(e,a){return a?e.filter((e=>o.has(e)||"array"===a&&"array"===e)):[]}(a,d.coerceTypes),b=a.length>0&&!(0===n.length&&1===a.length&&(0,f.schemaHasRulesForType)(e,a[0]));if(b){const f=l(a,c,d.strictNumbers,i.Wrong);t.if(f,(()=>{n.length?function(e,a,t){const{gen:c,data:f,opts:d}=e,n=c.let("dataType",r._`typeof ${f}`),i=c.let("coerced",r._`undefined`);"array"===d.coerceTypes&&c.if(r._`${n} == 'object' && Array.isArray(${f}) && ${f}.length == 1`,(()=>c.assign(f,r._`${f}[0]`).assign(n,r._`typeof ${f}`).if(l(a,f,d.strictNumbers),(()=>c.assign(i,f))))),c.if(r._`${i} !== undefined`);for(const e of t)(o.has(e)||"array"===e&&"array"===d.coerceTypes)&&b(e);function b(e){switch(e){case"string":return void c.elseIf(r._`${n} == "number" || ${n} == "boolean"`).assign(i,r._`"" + ${f}`).elseIf(r._`${f} === null`).assign(i,r._`""`);case"number":return void c.elseIf(r._`${n} == "boolean" || ${f} === null + || (${n} == "string" && ${f} && ${f} == +${f})`).assign(i,r._`+${f}`);case"integer":return void c.elseIf(r._`${n} === "boolean" || ${f} === null + || (${n} === "string" && ${f} && ${f} == +${f} && !(${f} % 1))`).assign(i,r._`+${f}`);case"boolean":return void c.elseIf(r._`${f} === "false" || ${f} === 0 || ${f} === null`).assign(i,!1).elseIf(r._`${f} === "true" || ${f} === 1`).assign(i,!0);case"null":return c.elseIf(r._`${f} === "" || ${f} === 0 || ${f} === false`),void c.assign(i,null);case"array":c.elseIf(r._`${n} === "string" || ${n} === "number" + || ${n} === "boolean" || ${f} === null`).assign(i,r._`[${f}]`)}}c.else(),h(e),c.endIf(),c.if(r._`${i} !== undefined`,(()=>{c.assign(f,i),function({gen:e,parentData:a,parentDataProperty:t},c){e.if(r._`${a} !== undefined`,(()=>e.assign(r._`${a}[${t}]`,c)))}(e,i)}))}(e,a,n):h(e)}))}return b};const o=new Set(["string","number","integer","boolean","null"]);function s(e,a,t,c=i.Correct){const f=c===i.Correct?r.operators.EQ:r.operators.NEQ;let d;switch(e){case"null":return r._`${a} ${f} null`;case"array":d=r._`Array.isArray(${a})`;break;case"object":d=r._`${a} && typeof ${a} == "object" && !Array.isArray(${a})`;break;case"integer":d=n(r._`!(${a} % 1) && !isNaN(${a})`);break;case"number":d=n();break;default:return r._`typeof ${a} ${f} ${e}`}return c===i.Correct?d:(0,r.not)(d);function n(e=r.nil){return(0,r.and)(r._`typeof ${a} == "number"`,e,t?r._`isFinite(${a})`:r.nil)}}function l(e,a,t,c){if(1===e.length)return s(e[0],a,t,c);let f;const d=(0,n.toHash)(e);if(d.array&&d.object){const e=r._`typeof ${a} != "object"`;f=d.null?e:r._`!${a} || ${e}`,delete d.null,delete d.array,delete d.object}else f=r.nil;d.number&&delete d.integer;for(const e in d)f=(0,r.and)(f,s(e,a,t,c));return f}a.checkDataType=s,a.checkDataTypes=l;const u={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:a})=>"string"==typeof e?r._`{type: ${e}}`:r._`{type: ${a}}`};function h(e){const a=function(e){const{gen:a,data:t,schema:c}=e,f=(0,n.schemaRefOrVal)(e,c,"type");return{gen:a,keyword:"type",data:t,schema:c.type,schemaCode:f,schemaValue:f,parentSchema:c,params:{},it:e}}(e);(0,d.reportError)(a,u)}a.reportTypeError=h},7870:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.assignDefaults=void 0;const c=t(99029),f=t(94227);function d(e,a,t){const{gen:d,compositeRule:r,data:n,opts:i}=e;if(void 0===t)return;const b=c._`${n}${(0,c.getProperty)(a)}`;if(r)return void(0,f.checkStrictMode)(e,`default is ignored for: ${b}`);let o=c._`${b} === undefined`;"empty"===i.useDefaults&&(o=c._`${o} || ${b} === null || ${b} === ""`),d.if(o,c._`${b} = ${(0,c.stringify)(t)}`)}a.assignDefaults=function(e,a){const{properties:t,items:c}=e.schema;if("object"===a&&t)for(const a in t)d(e,a,t[a].default);else"array"===a&&Array.isArray(c)&&c.forEach(((a,t)=>d(e,t,a.default)))}},62586:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.getData=a.KeywordCxt=a.validateFunctionCode=void 0;const c=t(28727),f=t(10208),d=t(7887),r=t(10208),n=t(7870),i=t(33673),b=t(24495),o=t(99029),s=t(42023),l=t(66939),u=t(94227),h=t(48708);function p({gen:e,validateName:a,schema:t,schemaEnv:c,opts:f},d){f.code.es5?e.func(a,o._`${s.default.data}, ${s.default.valCxt}`,c.$async,(()=>{e.code(o._`"use strict"; ${g(t,f)}`),function(e,a){e.if(s.default.valCxt,(()=>{e.var(s.default.instancePath,o._`${s.default.valCxt}.${s.default.instancePath}`),e.var(s.default.parentData,o._`${s.default.valCxt}.${s.default.parentData}`),e.var(s.default.parentDataProperty,o._`${s.default.valCxt}.${s.default.parentDataProperty}`),e.var(s.default.rootData,o._`${s.default.valCxt}.${s.default.rootData}`),a.dynamicRef&&e.var(s.default.dynamicAnchors,o._`${s.default.valCxt}.${s.default.dynamicAnchors}`)}),(()=>{e.var(s.default.instancePath,o._`""`),e.var(s.default.parentData,o._`undefined`),e.var(s.default.parentDataProperty,o._`undefined`),e.var(s.default.rootData,s.default.data),a.dynamicRef&&e.var(s.default.dynamicAnchors,o._`{}`)}))}(e,f),e.code(d)})):e.func(a,o._`${s.default.data}, ${function(e){return o._`{${s.default.instancePath}="", ${s.default.parentData}, ${s.default.parentDataProperty}, ${s.default.rootData}=${s.default.data}${e.dynamicRef?o._`, ${s.default.dynamicAnchors}={}`:o.nil}}={}`}(f)}`,c.$async,(()=>e.code(g(t,f)).code(d)))}function g(e,a){const t="object"==typeof e&&e[a.schemaId];return t&&(a.code.source||a.code.process)?o._`/*# sourceURL=${t} */`:o.nil}function m({schema:e,self:a}){if("boolean"==typeof e)return!e;for(const t in e)if(a.RULES.all[t])return!0;return!1}function x(e){return"boolean"!=typeof e.schema}function y(e){(0,u.checkUnknownRules)(e),function(e){const{schema:a,errSchemaPath:t,opts:c,self:f}=e;a.$ref&&c.ignoreKeywordsWithRef&&(0,u.schemaHasRulesButRef)(a,f.RULES)&&f.logger.warn(`$ref: keywords ignored in schema at path "${t}"`)}(e)}function A(e,a){if(e.opts.jtd)return w(e,[],!1,a);const t=(0,f.getSchemaTypes)(e.schema);w(e,t,!(0,f.coerceAndCheckDataType)(e,t),a)}function v({gen:e,schemaEnv:a,schema:t,errSchemaPath:c,opts:f}){const d=t.$comment;if(!0===f.$comment)e.code(o._`${s.default.self}.logger.log(${d})`);else if("function"==typeof f.$comment){const t=o.str`${c}/$comment`,f=e.scopeValue("root",{ref:a.root});e.code(o._`${s.default.self}.opts.$comment(${d}, ${t}, ${f}.schema)`)}}function w(e,a,t,c){const{gen:f,schema:n,data:i,allErrors:b,opts:l,self:h}=e,{RULES:p}=h;function g(u){(0,d.shouldUseGroup)(n,u)&&(u.type?(f.if((0,r.checkDataType)(u.type,i,l.strictNumbers)),_(e,u),1===a.length&&a[0]===u.type&&t&&(f.else(),(0,r.reportTypeError)(e)),f.endIf()):_(e,u),b||f.if(o._`${s.default.errors} === ${c||0}`))}!n.$ref||!l.ignoreKeywordsWithRef&&(0,u.schemaHasRulesButRef)(n,p)?(l.jtd||function(e,a){!e.schemaEnv.meta&&e.opts.strictTypes&&(function(e,a){a.length&&(e.dataTypes.length?(a.forEach((a=>{I(e.dataTypes,a)||E(e,`type "${a}" not allowed by context "${e.dataTypes.join(",")}"`)})),function(e,a){const t=[];for(const c of e.dataTypes)I(a,c)?t.push(c):a.includes("integer")&&"number"===c&&t.push("integer");e.dataTypes=t}(e,a)):e.dataTypes=a)}(e,a),e.opts.allowUnionTypes||function(e,a){a.length>1&&(2!==a.length||!a.includes("null"))&&E(e,"use allowUnionTypes to allow union type keyword")}(e,a),function(e,a){const t=e.self.RULES.all;for(const c in t){const f=t[c];if("object"==typeof f&&(0,d.shouldUseRule)(e.schema,f)){const{type:t}=f.definition;t.length&&!t.some((e=>{return c=e,(t=a).includes(c)||"number"===c&&t.includes("integer");var t,c}))&&E(e,`missing type "${t.join(",")}" for keyword "${c}"`)}}}(e,e.dataTypes))}(e,a),f.block((()=>{for(const e of p.rules)g(e);g(p.post)}))):f.block((()=>M(e,"$ref",p.all.$ref.definition)))}function _(e,a){const{gen:t,schema:c,opts:{useDefaults:f}}=e;f&&(0,n.assignDefaults)(e,a.type),t.block((()=>{for(const t of a.rules)(0,d.shouldUseRule)(c,t)&&M(e,t.keyword,t.definition,a.type)}))}function I(e,a){return e.includes(a)||"integer"===a&&e.includes("number")}function E(e,a){a+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,u.checkStrictMode)(e,a,e.opts.strictTypes)}a.validateFunctionCode=function(e){x(e)&&(y(e),m(e))?function(e){const{schema:a,opts:t,gen:c}=e;p(e,(()=>{t.$comment&&a.$comment&&v(e),function(e){const{schema:a,opts:t}=e;void 0!==a.default&&t.useDefaults&&t.strictSchema&&(0,u.checkStrictMode)(e,"default is ignored in the schema root")}(e),c.let(s.default.vErrors,null),c.let(s.default.errors,0),t.unevaluated&&function(e){const{gen:a,validateName:t}=e;e.evaluated=a.const("evaluated",o._`${t}.evaluated`),a.if(o._`${e.evaluated}.dynamicProps`,(()=>a.assign(o._`${e.evaluated}.props`,o._`undefined`))),a.if(o._`${e.evaluated}.dynamicItems`,(()=>a.assign(o._`${e.evaluated}.items`,o._`undefined`)))}(e),A(e),function(e){const{gen:a,schemaEnv:t,validateName:c,ValidationError:f,opts:d}=e;t.$async?a.if(o._`${s.default.errors} === 0`,(()=>a.return(s.default.data)),(()=>a.throw(o._`new ${f}(${s.default.vErrors})`))):(a.assign(o._`${c}.errors`,s.default.vErrors),d.unevaluated&&function({gen:e,evaluated:a,props:t,items:c}){t instanceof o.Name&&e.assign(o._`${a}.props`,t),c instanceof o.Name&&e.assign(o._`${a}.items`,c)}(e),a.return(o._`${s.default.errors} === 0`))}(e)}))}(e):p(e,(()=>(0,c.topBoolOrEmptySchema)(e)))};class C{constructor(e,a,t){if((0,i.validateKeywordUsage)(e,a,t),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=t,this.data=e.data,this.schema=e.schema[t],this.$data=a.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,u.schemaRefOrVal)(e,this.schema,t,this.$data),this.schemaType=a.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=a,this.$data)this.schemaCode=e.gen.const("vSchema",L(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,i.validSchemaType)(this.schema,a.schemaType,a.allowUndefined))throw new Error(`${t} value must be ${JSON.stringify(a.schemaType)}`);("code"in a?a.trackErrors:!1!==a.errors)&&(this.errsCount=e.gen.const("_errs",s.default.errors))}result(e,a,t){this.failResult((0,o.not)(e),a,t)}failResult(e,a,t){this.gen.if(e),t?t():this.error(),a?(this.gen.else(),a(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,a){this.failResult((0,o.not)(e),void 0,a)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:a}=this;this.fail(o._`${a} !== undefined && (${(0,o.or)(this.invalid$data(),e)})`)}error(e,a,t){if(a)return this.setParams(a),this._error(e,t),void this.setParams({});this._error(e,t)}_error(e,a){(e?h.reportExtraError:h.reportError)(this,this.def.error,a)}$dataError(){(0,h.reportError)(this,this.def.$dataError||h.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,h.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,a){a?Object.assign(this.params,e):this.params=e}block$data(e,a,t=o.nil){this.gen.block((()=>{this.check$data(e,t),a()}))}check$data(e=o.nil,a=o.nil){if(!this.$data)return;const{gen:t,schemaCode:c,schemaType:f,def:d}=this;t.if((0,o.or)(o._`${c} === undefined`,a)),e!==o.nil&&t.assign(e,!0),(f.length||d.validateSchema)&&(t.elseIf(this.invalid$data()),this.$dataError(),e!==o.nil&&t.assign(e,!1)),t.else()}invalid$data(){const{gen:e,schemaCode:a,schemaType:t,def:c,it:f}=this;return(0,o.or)(function(){if(t.length){if(!(a instanceof o.Name))throw new Error("ajv implementation error");const e=Array.isArray(t)?t:[t];return o._`${(0,r.checkDataTypes)(e,a,f.opts.strictNumbers,r.DataType.Wrong)}`}return o.nil}(),function(){if(c.validateSchema){const t=e.scopeValue("validate$data",{ref:c.validateSchema});return o._`!${t}(${a})`}return o.nil}())}subschema(e,a){const t=(0,b.getSubschema)(this.it,e);(0,b.extendSubschemaData)(t,this.it,e),(0,b.extendSubschemaMode)(t,e);const f={...this.it,...t,items:void 0,props:void 0};return function(e,a){x(e)&&(y(e),m(e))?function(e,a){const{schema:t,gen:c,opts:f}=e;f.$comment&&t.$comment&&v(e),function(e){const a=e.schema[e.opts.schemaId];a&&(e.baseId=(0,l.resolveUrl)(e.opts.uriResolver,e.baseId,a))}(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const d=c.const("_errs",s.default.errors);A(e,d),c.var(a,o._`${d} === ${s.default.errors}`)}(e,a):(0,c.boolOrEmptySchema)(e,a)}(f,a),f}mergeEvaluated(e,a){const{it:t,gen:c}=this;t.opts.unevaluated&&(!0!==t.props&&void 0!==e.props&&(t.props=u.mergeEvaluated.props(c,e.props,t.props,a)),!0!==t.items&&void 0!==e.items&&(t.items=u.mergeEvaluated.items(c,e.items,t.items,a)))}mergeValidEvaluated(e,a){const{it:t,gen:c}=this;if(t.opts.unevaluated&&(!0!==t.props||!0!==t.items))return c.if(a,(()=>this.mergeEvaluated(e,o.Name))),!0}}function M(e,a,t,c){const f=new C(e,t,a);"code"in t?t.code(f,c):f.$data&&t.validate?(0,i.funcKeywordCode)(f,t):"macro"in t?(0,i.macroKeywordCode)(f,t):(t.compile||t.validate)&&(0,i.funcKeywordCode)(f,t)}a.KeywordCxt=C;const B=/^\/(?:[^~]|~0|~1)*$/,k=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function L(e,{dataLevel:a,dataNames:t,dataPathArr:c}){let f,d;if(""===e)return s.default.rootData;if("/"===e[0]){if(!B.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);f=e,d=s.default.rootData}else{const r=k.exec(e);if(!r)throw new Error(`Invalid JSON-pointer: ${e}`);const n=+r[1];if(f=r[2],"#"===f){if(n>=a)throw new Error(i("property/index",n));return c[a-n]}if(n>a)throw new Error(i("data",n));if(d=t[a-n],!f)return d}let r=d;const n=f.split("/");for(const e of n)e&&(d=o._`${d}${(0,o.getProperty)((0,u.unescapeJsonPointer)(e))}`,r=o._`${r} && ${d}`);return r;function i(e,t){return`Cannot access ${e} ${t} levels up, current level is ${a}`}}a.getData=L},33673:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.validateKeywordUsage=a.validSchemaType=a.funcKeywordCode=a.macroKeywordCode=void 0;const c=t(99029),f=t(42023),d=t(15765),r=t(48708);function n(e){const{gen:a,data:t,it:f}=e;a.if(f.parentData,(()=>a.assign(t,c._`${f.parentData}[${f.parentDataProperty}]`)))}function i(e,a,t){if(void 0===t)throw new Error(`keyword "${a}" failed to compile`);return e.scopeValue("keyword","function"==typeof t?{ref:t}:{ref:t,code:(0,c.stringify)(t)})}a.macroKeywordCode=function(e,a){const{gen:t,keyword:f,schema:d,parentSchema:r,it:n}=e,b=a.macro.call(n.self,d,r,n),o=i(t,f,b);!1!==n.opts.validateSchema&&n.self.validateSchema(b,!0);const s=t.name("valid");e.subschema({schema:b,schemaPath:c.nil,errSchemaPath:`${n.errSchemaPath}/${f}`,topSchemaRef:o,compositeRule:!0},s),e.pass(s,(()=>e.error(!0)))},a.funcKeywordCode=function(e,a){var t;const{gen:b,keyword:o,schema:s,parentSchema:l,$data:u,it:h}=e;!function({schemaEnv:e},a){if(a.async&&!e.$async)throw new Error("async keyword in sync schema")}(h,a);const p=!u&&a.compile?a.compile.call(h.self,s,l,h):a.validate,g=i(b,o,p),m=b.let("valid");function x(t=(a.async?c._`await `:c.nil)){const r=h.opts.passContext?f.default.this:f.default.self,n=!("compile"in a&&!u||!1===a.schema);b.assign(m,c._`${t}${(0,d.callValidateCode)(e,g,r,n)}`,a.modifying)}function y(e){var t;b.if((0,c.not)(null!==(t=a.valid)&&void 0!==t?t:m),e)}e.block$data(m,(function(){if(!1===a.errors)x(),a.modifying&&n(e),y((()=>e.error()));else{const t=a.async?function(){const e=b.let("ruleErrs",null);return b.try((()=>x(c._`await `)),(a=>b.assign(m,!1).if(c._`${a} instanceof ${h.ValidationError}`,(()=>b.assign(e,c._`${a}.errors`)),(()=>b.throw(a))))),e}():function(){const e=c._`${g}.errors`;return b.assign(e,null),x(c.nil),e}();a.modifying&&n(e),y((()=>function(e,a){const{gen:t}=e;t.if(c._`Array.isArray(${a})`,(()=>{t.assign(f.default.vErrors,c._`${f.default.vErrors} === null ? ${a} : ${f.default.vErrors}.concat(${a})`).assign(f.default.errors,c._`${f.default.vErrors}.length`),(0,r.extendErrors)(e)}),(()=>e.error()))}(e,t)))}})),e.ok(null!==(t=a.valid)&&void 0!==t?t:m)},a.validSchemaType=function(e,a,t=!1){return!a.length||a.some((a=>"array"===a?Array.isArray(e):"object"===a?e&&"object"==typeof e&&!Array.isArray(e):typeof e==a||t&&void 0===e))},a.validateKeywordUsage=function({schema:e,opts:a,self:t,errSchemaPath:c},f,d){if(Array.isArray(f.keyword)?!f.keyword.includes(d):f.keyword!==d)throw new Error("ajv implementation error");const r=f.dependencies;if(null==r?void 0:r.some((a=>!Object.prototype.hasOwnProperty.call(e,a))))throw new Error(`parent schema must have dependencies of ${d}: ${r.join(",")}`);if(f.validateSchema&&!f.validateSchema(e[d])){const e=`keyword "${d}" value is invalid at path "${c}": `+t.errorsText(f.validateSchema.errors);if("log"!==a.validateSchema)throw new Error(e);t.logger.error(e)}}},24495:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.extendSubschemaMode=a.extendSubschemaData=a.getSubschema=void 0;const c=t(99029),f=t(94227);a.getSubschema=function(e,{keyword:a,schemaProp:t,schema:d,schemaPath:r,errSchemaPath:n,topSchemaRef:i}){if(void 0!==a&&void 0!==d)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==a){const d=e.schema[a];return void 0===t?{schema:d,schemaPath:c._`${e.schemaPath}${(0,c.getProperty)(a)}`,errSchemaPath:`${e.errSchemaPath}/${a}`}:{schema:d[t],schemaPath:c._`${e.schemaPath}${(0,c.getProperty)(a)}${(0,c.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${a}/${(0,f.escapeFragment)(t)}`}}if(void 0!==d){if(void 0===r||void 0===n||void 0===i)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:d,schemaPath:r,topSchemaRef:i,errSchemaPath:n}}throw new Error('either "keyword" or "schema" must be passed')},a.extendSubschemaData=function(e,a,{dataProp:t,dataPropType:d,data:r,dataTypes:n,propertyName:i}){if(void 0!==r&&void 0!==t)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:b}=a;if(void 0!==t){const{errorPath:r,dataPathArr:n,opts:i}=a;o(b.let("data",c._`${a.data}${(0,c.getProperty)(t)}`,!0)),e.errorPath=c.str`${r}${(0,f.getErrorPath)(t,d,i.jsPropertySyntax)}`,e.parentDataProperty=c._`${t}`,e.dataPathArr=[...n,e.parentDataProperty]}function o(t){e.data=t,e.dataLevel=a.dataLevel+1,e.dataTypes=[],a.definedProperties=new Set,e.parentData=a.data,e.dataNames=[...a.dataNames,t]}void 0!==r&&(o(r instanceof c.Name?r:b.let("data",r,!0)),void 0!==i&&(e.propertyName=i)),n&&(e.dataTypes=n)},a.extendSubschemaMode=function(e,{jtdDiscriminator:a,jtdMetadata:t,compositeRule:c,createErrors:f,allErrors:d}){void 0!==c&&(e.compositeRule=c),void 0!==f&&(e.createErrors=f),void 0!==d&&(e.allErrors=d),e.jtdDiscriminator=a,e.jtdMetadata=t}},4042:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.CodeGen=a.Name=a.nil=a.stringify=a.str=a._=a.KeywordCxt=void 0;var c=t(62586);Object.defineProperty(a,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var f=t(99029);Object.defineProperty(a,"_",{enumerable:!0,get:function(){return f._}}),Object.defineProperty(a,"str",{enumerable:!0,get:function(){return f.str}}),Object.defineProperty(a,"stringify",{enumerable:!0,get:function(){return f.stringify}}),Object.defineProperty(a,"nil",{enumerable:!0,get:function(){return f.nil}}),Object.defineProperty(a,"Name",{enumerable:!0,get:function(){return f.Name}}),Object.defineProperty(a,"CodeGen",{enumerable:!0,get:function(){return f.CodeGen}});const d=t(13558),r=t(34551),n=t(10396),i=t(73835),b=t(99029),o=t(66939),s=t(10208),l=t(94227),u=t(63837),h=t(55944),p=(e,a)=>new RegExp(e,a);p.code="new RegExp";const g=["removeAdditional","useDefaults","coerceTypes"],m=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),x={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},y={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function A(e){var a,t,c,f,d,r,n,i,b,o,s,l,u,g,m,x,y,A,v,w,_,I,E,C,M;const B=e.strict,k=null===(a=e.code)||void 0===a?void 0:a.optimize,L=!0===k||void 0===k?1:k||0,S=null!==(c=null===(t=e.code)||void 0===t?void 0:t.regExp)&&void 0!==c?c:p,T=null!==(f=e.uriResolver)&&void 0!==f?f:h.default;return{strictSchema:null===(r=null!==(d=e.strictSchema)&&void 0!==d?d:B)||void 0===r||r,strictNumbers:null===(i=null!==(n=e.strictNumbers)&&void 0!==n?n:B)||void 0===i||i,strictTypes:null!==(o=null!==(b=e.strictTypes)&&void 0!==b?b:B)&&void 0!==o?o:"log",strictTuples:null!==(l=null!==(s=e.strictTuples)&&void 0!==s?s:B)&&void 0!==l?l:"log",strictRequired:null!==(g=null!==(u=e.strictRequired)&&void 0!==u?u:B)&&void 0!==g&&g,code:e.code?{...e.code,optimize:L,regExp:S}:{optimize:L,regExp:S},loopRequired:null!==(m=e.loopRequired)&&void 0!==m?m:200,loopEnum:null!==(x=e.loopEnum)&&void 0!==x?x:200,meta:null===(y=e.meta)||void 0===y||y,messages:null===(A=e.messages)||void 0===A||A,inlineRefs:null===(v=e.inlineRefs)||void 0===v||v,schemaId:null!==(w=e.schemaId)&&void 0!==w?w:"$id",addUsedSchema:null===(_=e.addUsedSchema)||void 0===_||_,validateSchema:null===(I=e.validateSchema)||void 0===I||I,validateFormats:null===(E=e.validateFormats)||void 0===E||E,unicodeRegExp:null===(C=e.unicodeRegExp)||void 0===C||C,int32range:null===(M=e.int32range)||void 0===M||M,uriResolver:T}}class v{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...A(e)};const{es5:a,lines:t}=this.opts.code;this.scope=new b.ValueScope({scope:{},prefixes:m,es5:a,lines:t}),this.logger=function(e){if(!1===e)return B;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const c=e.validateFormats;e.validateFormats=!1,this.RULES=(0,n.getRules)(),w.call(this,x,e,"NOT SUPPORTED"),w.call(this,y,e,"DEPRECATED","warn"),this._metaOpts=M.call(this),e.formats&&E.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&C.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),I.call(this),e.validateFormats=c}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:a,schemaId:t}=this.opts;let c=u;"id"===t&&(c={...u},c.id=c.$id,delete c.$id),a&&e&&this.addMetaSchema(c,c[t],!1)}defaultMeta(){const{meta:e,schemaId:a}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[a]||e:void 0}validate(e,a){let t;if("string"==typeof e){if(t=this.getSchema(e),!t)throw new Error(`no schema with key or ref "${e}"`)}else t=this.compile(e);const c=t(a);return"$async"in t||(this.errors=t.errors),c}compile(e,a){const t=this._addSchema(e,a);return t.validate||this._compileSchemaEnv(t)}compileAsync(e,a){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:t}=this.opts;return c.call(this,e,a);async function c(e,a){await f.call(this,e.$schema);const t=this._addSchema(e,a);return t.validate||d.call(this,t)}async function f(e){e&&!this.getSchema(e)&&await c.call(this,{$ref:e},!0)}async function d(e){try{return this._compileSchemaEnv(e)}catch(a){if(!(a instanceof r.default))throw a;return n.call(this,a),await i.call(this,a.missingSchema),d.call(this,e)}}function n({missingSchema:e,missingRef:a}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${a} cannot be resolved`)}async function i(e){const t=await b.call(this,e);this.refs[e]||await f.call(this,t.$schema),this.refs[e]||this.addSchema(t,e,a)}async function b(e){const a=this._loading[e];if(a)return a;try{return await(this._loading[e]=t(e))}finally{delete this._loading[e]}}}addSchema(e,a,t,c=this.opts.validateSchema){if(Array.isArray(e)){for(const a of e)this.addSchema(a,void 0,t,c);return this}let f;if("object"==typeof e){const{schemaId:a}=this.opts;if(f=e[a],void 0!==f&&"string"!=typeof f)throw new Error(`schema ${a} must be string`)}return a=(0,o.normalizeId)(a||f),this._checkUnique(a),this.schemas[a]=this._addSchema(e,t,a,c,!0),this}addMetaSchema(e,a,t=this.opts.validateSchema){return this.addSchema(e,a,!0,t),this}validateSchema(e,a){if("boolean"==typeof e)return!0;let t;if(t=e.$schema,void 0!==t&&"string"!=typeof t)throw new Error("$schema must be a string");if(t=t||this.opts.defaultMeta||this.defaultMeta(),!t)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const c=this.validate(t,e);if(!c&&a){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return c}getSchema(e){let a;for(;"string"==typeof(a=_.call(this,e));)e=a;if(void 0===a){const{schemaId:t}=this.opts,c=new i.SchemaEnv({schema:{},schemaId:t});if(a=i.resolveSchema.call(this,c,e),!a)return;this.refs[e]=a}return a.validate||this._compileSchemaEnv(a)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const a=_.call(this,e);return"object"==typeof a&&this._cache.delete(a.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const a=e;this._cache.delete(a);let t=e[this.opts.schemaId];return t&&(t=(0,o.normalizeId)(t),delete this.schemas[t],delete this.refs[t]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const a of e)this.addKeyword(a);return this}addKeyword(e,a){let t;if("string"==typeof e)t=e,"object"==typeof a&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),a.keyword=t);else{if("object"!=typeof e||void 0!==a)throw new Error("invalid addKeywords parameters");if(t=(a=e).keyword,Array.isArray(t)&&!t.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(L.call(this,t,a),!a)return(0,l.eachItem)(t,(e=>S.call(this,e))),this;N.call(this,a);const c={...a,type:(0,s.getJSONTypes)(a.type),schemaType:(0,s.getJSONTypes)(a.schemaType)};return(0,l.eachItem)(t,0===c.type.length?e=>S.call(this,e,c):e=>c.type.forEach((a=>S.call(this,e,c,a)))),this}getKeyword(e){const a=this.RULES.all[e];return"object"==typeof a?a.definition:!!a}removeKeyword(e){const{RULES:a}=this;delete a.keywords[e],delete a.all[e];for(const t of a.rules){const a=t.rules.findIndex((a=>a.keyword===e));a>=0&&t.rules.splice(a,1)}return this}addFormat(e,a){return"string"==typeof a&&(a=new RegExp(a)),this.formats[e]=a,this}errorsText(e=this.errors,{separator:a=", ",dataVar:t="data"}={}){return e&&0!==e.length?e.map((e=>`${t}${e.instancePath} ${e.message}`)).reduce(((e,t)=>e+a+t)):"No errors"}$dataMetaSchema(e,a){const t=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const c of a){const a=c.split("/").slice(1);let f=e;for(const e of a)f=f[e];for(const e in t){const a=t[e];if("object"!=typeof a)continue;const{$data:c}=a.definition,d=f[e];c&&d&&(f[e]=P(d))}}return e}_removeAllSchemas(e,a){for(const t in e){const c=e[t];a&&!a.test(t)||("string"==typeof c?delete e[t]:c&&!c.meta&&(this._cache.delete(c.schema),delete e[t]))}}_addSchema(e,a,t,c=this.opts.validateSchema,f=this.opts.addUsedSchema){let d;const{schemaId:r}=this.opts;if("object"==typeof e)d=e[r];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let n=this._cache.get(e);if(void 0!==n)return n;t=(0,o.normalizeId)(d||t);const b=o.getSchemaRefs.call(this,e,t);return n=new i.SchemaEnv({schema:e,schemaId:r,meta:a,baseId:t,localRefs:b}),this._cache.set(n.schema,n),f&&!t.startsWith("#")&&(t&&this._checkUnique(t),this.refs[t]=n),c&&this.validateSchema(e,!0),n}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):i.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const a=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,e)}finally{this.opts=a}}}function w(e,a,t,c="error"){for(const f in e){const d=f;d in a&&this.logger[c](`${t}: option ${f}. ${e[d]}`)}}function _(e){return e=(0,o.normalizeId)(e),this.schemas[e]||this.refs[e]}function I(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const a in e)this.addSchema(e[a],a)}function E(){for(const e in this.opts.formats){const a=this.opts.formats[e];a&&this.addFormat(e,a)}}function C(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const a in e){const t=e[a];t.keyword||(t.keyword=a),this.addKeyword(t)}}}function M(){const e={...this.opts};for(const a of g)delete e[a];return e}v.ValidationError=d.default,v.MissingRefError=r.default,a.default=v;const B={log(){},warn(){},error(){}},k=/^[a-z_$][a-z0-9_$:-]*$/i;function L(e,a){const{RULES:t}=this;if((0,l.eachItem)(e,(e=>{if(t.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!k.test(e))throw new Error(`Keyword ${e} has invalid name`)})),a&&a.$data&&!("code"in a)&&!("validate"in a))throw new Error('$data keyword must have "code" or "validate" function')}function S(e,a,t){var c;const f=null==a?void 0:a.post;if(t&&f)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:d}=this;let r=f?d.post:d.rules.find((({type:e})=>e===t));if(r||(r={type:t,rules:[]},d.rules.push(r)),d.keywords[e]=!0,!a)return;const n={keyword:e,definition:{...a,type:(0,s.getJSONTypes)(a.type),schemaType:(0,s.getJSONTypes)(a.schemaType)}};a.before?T.call(this,r,n,a.before):r.rules.push(n),d.all[e]=n,null===(c=a.implements)||void 0===c||c.forEach((e=>this.addKeyword(e)))}function T(e,a,t){const c=e.rules.findIndex((e=>e.keyword===t));c>=0?e.rules.splice(c,0,a):(e.rules.push(a),this.logger.warn(`rule ${t} is not defined`))}function N(e){let{metaSchema:a}=e;void 0!==a&&(e.$data&&this.opts.$data&&(a=P(a)),e.validateSchema=this.compile(a,!0))}const R={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function P(e){return{anyOf:[e,R]}}},76250:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(32017);c.code='require("ajv/dist/runtime/equal").default',a.default=c},53853:(e,a)=>{"use strict";function t(e){const a=e.length;let t,c=0,f=0;for(;f=55296&&t<=56319&&f{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(48343);c.code='require("ajv/dist/runtime/uri").default',a.default=c},13558:(e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});class t extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}a.default=t},15457:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.validateAdditionalItems=void 0;const c=t(99029),f=t(94227),d={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>c.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>c._`{limit: ${e}}`},code(e){const{parentSchema:a,it:t}=e,{items:c}=a;Array.isArray(c)?r(e,c):(0,f.checkStrictMode)(t,'"additionalItems" is ignored when "items" is not an array of schemas')}};function r(e,a){const{gen:t,schema:d,data:r,keyword:n,it:i}=e;i.items=!0;const b=t.const("len",c._`${r}.length`);if(!1===d)e.setParams({len:a.length}),e.pass(c._`${b} <= ${a.length}`);else if("object"==typeof d&&!(0,f.alwaysValidSchema)(i,d)){const d=t.var("valid",c._`${b} <= ${a.length}`);t.if((0,c.not)(d),(()=>function(d){t.forRange("i",a.length,b,(a=>{e.subschema({keyword:n,dataProp:a,dataPropType:f.Type.Num},d),i.allErrors||t.if((0,c.not)(d),(()=>t.break()))}))}(d))),e.ok(d)}}a.validateAdditionalItems=r,a.default=d},38660:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(15765),f=t(99029),d=t(42023),r=t(94227),n={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>f._`{additionalProperty: ${e.additionalProperty}}`},code(e){const{gen:a,schema:t,parentSchema:n,data:i,errsCount:b,it:o}=e;if(!b)throw new Error("ajv implementation error");const{allErrors:s,opts:l}=o;if(o.props=!0,"all"!==l.removeAdditional&&(0,r.alwaysValidSchema)(o,t))return;const u=(0,c.allSchemaProperties)(n.properties),h=(0,c.allSchemaProperties)(n.patternProperties);function p(e){a.code(f._`delete ${i}[${e}]`)}function g(c){if("all"===l.removeAdditional||l.removeAdditional&&!1===t)p(c);else{if(!1===t)return e.setParams({additionalProperty:c}),e.error(),void(s||a.break());if("object"==typeof t&&!(0,r.alwaysValidSchema)(o,t)){const t=a.name("valid");"failing"===l.removeAdditional?(m(c,t,!1),a.if((0,f.not)(t),(()=>{e.reset(),p(c)}))):(m(c,t),s||a.if((0,f.not)(t),(()=>a.break())))}}}function m(a,t,c){const f={keyword:"additionalProperties",dataProp:a,dataPropType:r.Type.Str};!1===c&&Object.assign(f,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(f,t)}a.forIn("key",i,(t=>{u.length||h.length?a.if(function(t){let d;if(u.length>8){const e=(0,r.schemaRefOrVal)(o,n.properties,"properties");d=(0,c.isOwnProperty)(a,e,t)}else d=u.length?(0,f.or)(...u.map((e=>f._`${t} === ${e}`))):f.nil;return h.length&&(d=(0,f.or)(d,...h.map((a=>f._`${(0,c.usePattern)(e,a)}.test(${t})`)))),(0,f.not)(d)}(t),(()=>g(t))):g(t)})),e.ok(f._`${b} === ${d.default.errors}`)}};a.default=n},15844:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(94227),f={keyword:"allOf",schemaType:"array",code(e){const{gen:a,schema:t,it:f}=e;if(!Array.isArray(t))throw new Error("ajv implementation error");const d=a.name("valid");t.forEach(((a,t)=>{if((0,c.alwaysValidSchema)(f,a))return;const r=e.subschema({keyword:"allOf",schemaProp:t},d);e.ok(d),e.mergeEvaluated(r)}))}};a.default=f},16505:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:t(15765).validateUnion,error:{message:"must match a schema in anyOf"}};a.default=c},12661:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(99029),f=t(94227),d={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:a}})=>void 0===a?c.str`must contain at least ${e} valid item(s)`:c.str`must contain at least ${e} and no more than ${a} valid item(s)`,params:({params:{min:e,max:a}})=>void 0===a?c._`{minContains: ${e}}`:c._`{minContains: ${e}, maxContains: ${a}}`},code(e){const{gen:a,schema:t,parentSchema:d,data:r,it:n}=e;let i,b;const{minContains:o,maxContains:s}=d;n.opts.next?(i=void 0===o?1:o,b=s):i=1;const l=a.const("len",c._`${r}.length`);if(e.setParams({min:i,max:b}),void 0===b&&0===i)return void(0,f.checkStrictMode)(n,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==b&&i>b)return(0,f.checkStrictMode)(n,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,f.alwaysValidSchema)(n,t)){let a=c._`${l} >= ${i}`;return void 0!==b&&(a=c._`${a} && ${l} <= ${b}`),void e.pass(a)}n.items=!0;const u=a.name("valid");function h(){const e=a.name("_valid"),t=a.let("count",0);p(e,(()=>a.if(e,(()=>function(e){a.code(c._`${e}++`),void 0===b?a.if(c._`${e} >= ${i}`,(()=>a.assign(u,!0).break())):(a.if(c._`${e} > ${b}`,(()=>a.assign(u,!1).break())),1===i?a.assign(u,!0):a.if(c._`${e} >= ${i}`,(()=>a.assign(u,!0))))}(t)))))}function p(t,c){a.forRange("i",0,l,(a=>{e.subschema({keyword:"contains",dataProp:a,dataPropType:f.Type.Num,compositeRule:!0},t),c()}))}void 0===b&&1===i?p(u,(()=>a.if(u,(()=>a.break())))):0===i?(a.let(u,!0),void 0!==b&&a.if(c._`${r}.length > 0`,h)):(a.let(u,!1),h()),e.result(u,(()=>e.reset()))}};a.default=d},83025:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.validateSchemaDeps=a.validatePropertyDeps=a.error=void 0;const c=t(99029),f=t(94227),d=t(15765);a.error={message:({params:{property:e,depsCount:a,deps:t}})=>{const f=1===a?"property":"properties";return c.str`must have ${f} ${t} when property ${e} is present`},params:({params:{property:e,depsCount:a,deps:t,missingProperty:f}})=>c._`{property: ${e}, + missingProperty: ${f}, + depsCount: ${a}, + deps: ${t}}`};const r={keyword:"dependencies",type:"object",schemaType:"object",error:a.error,code(e){const[a,t]=function({schema:e}){const a={},t={};for(const c in e)"__proto__"!==c&&((Array.isArray(e[c])?a:t)[c]=e[c]);return[a,t]}(e);n(e,a),i(e,t)}};function n(e,a=e.schema){const{gen:t,data:f,it:r}=e;if(0===Object.keys(a).length)return;const n=t.let("missing");for(const i in a){const b=a[i];if(0===b.length)continue;const o=(0,d.propertyInData)(t,f,i,r.opts.ownProperties);e.setParams({property:i,depsCount:b.length,deps:b.join(", ")}),r.allErrors?t.if(o,(()=>{for(const a of b)(0,d.checkReportMissingProp)(e,a)})):(t.if(c._`${o} && (${(0,d.checkMissingProp)(e,b,n)})`),(0,d.reportMissingProp)(e,n),t.else())}}function i(e,a=e.schema){const{gen:t,data:c,keyword:r,it:n}=e,i=t.name("valid");for(const b in a)(0,f.alwaysValidSchema)(n,a[b])||(t.if((0,d.propertyInData)(t,c,b,n.opts.ownProperties),(()=>{const a=e.subschema({keyword:r,schemaProp:b},i);e.mergeValidEvaluated(a,i)}),(()=>t.var(i,!0))),e.ok(i))}a.validatePropertyDeps=n,a.validateSchemaDeps=i,a.default=r},1239:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(99029),f=t(94227),d={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>c.str`must match "${e.ifClause}" schema`,params:({params:e})=>c._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:a,parentSchema:t,it:d}=e;void 0===t.then&&void 0===t.else&&(0,f.checkStrictMode)(d,'"if" without "then" and "else" is ignored');const n=r(d,"then"),i=r(d,"else");if(!n&&!i)return;const b=a.let("valid",!0),o=a.name("_valid");if(function(){const a=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},o);e.mergeEvaluated(a)}(),e.reset(),n&&i){const t=a.let("ifClause");e.setParams({ifClause:t}),a.if(o,s("then",t),s("else",t))}else n?a.if(o,s("then")):a.if((0,c.not)(o),s("else"));function s(t,f){return()=>{const d=e.subschema({keyword:t},o);a.assign(b,o),e.mergeValidEvaluated(d,b),f?a.assign(f,c._`${t}`):e.setParams({ifClause:t})}}e.pass(b,(()=>e.error(!0)))}};function r(e,a){const t=e.schema[a];return void 0!==t&&!(0,f.alwaysValidSchema)(e,t)}a.default=d},56378:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(15457),f=t(65354),d=t(20494),r=t(93966),n=t(12661),i=t(83025),b=t(19713),o=t(38660),s=t(40117),l=t(45333),u=t(57923),h=t(16505),p=t(96163),g=t(15844),m=t(1239),x=t(14426);a.default=function(e=!1){const a=[u.default,h.default,p.default,g.default,m.default,x.default,b.default,o.default,i.default,s.default,l.default];return e?a.push(f.default,r.default):a.push(c.default,d.default),a.push(n.default),a}},20494:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.validateTuple=void 0;const c=t(99029),f=t(94227),d=t(15765),r={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:a,it:t}=e;if(Array.isArray(a))return n(e,"additionalItems",a);t.items=!0,(0,f.alwaysValidSchema)(t,a)||e.ok((0,d.validateArray)(e))}};function n(e,a,t=e.schema){const{gen:d,parentSchema:r,data:n,keyword:i,it:b}=e;!function(e){const{opts:c,errSchemaPath:d}=b,r=t.length,n=r===e.minItems&&(r===e.maxItems||!1===e[a]);if(c.strictTuples&&!n){const e=`"${i}" is ${r}-tuple, but minItems or maxItems/${a} are not specified or different at path "${d}"`;(0,f.checkStrictMode)(b,e,c.strictTuples)}}(r),b.opts.unevaluated&&t.length&&!0!==b.items&&(b.items=f.mergeEvaluated.items(d,t.length,b.items));const o=d.name("valid"),s=d.const("len",c._`${n}.length`);t.forEach(((a,t)=>{(0,f.alwaysValidSchema)(b,a)||(d.if(c._`${s} > ${t}`,(()=>e.subschema({keyword:i,schemaProp:t,dataProp:t},o))),e.ok(o))}))}a.validateTuple=n,a.default=r},93966:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(99029),f=t(94227),d=t(15765),r=t(15457),n={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>c.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>c._`{limit: ${e}}`},code(e){const{schema:a,parentSchema:t,it:c}=e,{prefixItems:n}=t;c.items=!0,(0,f.alwaysValidSchema)(c,a)||(n?(0,r.validateAdditionalItems)(e,n):e.ok((0,d.validateArray)(e)))}};a.default=n},57923:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(94227),f={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:a,schema:t,it:f}=e;if((0,c.alwaysValidSchema)(f,t))return void e.fail();const d=a.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},d),e.failResult(d,(()=>e.reset()),(()=>e.error()))},error:{message:"must NOT be valid"}};a.default=f},96163:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(99029),f=t(94227),d={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>c._`{passingSchemas: ${e.passing}}`},code(e){const{gen:a,schema:t,parentSchema:d,it:r}=e;if(!Array.isArray(t))throw new Error("ajv implementation error");if(r.opts.discriminator&&d.discriminator)return;const n=t,i=a.let("valid",!1),b=a.let("passing",null),o=a.name("_valid");e.setParams({passing:b}),a.block((function(){n.forEach(((t,d)=>{let n;(0,f.alwaysValidSchema)(r,t)?a.var(o,!0):n=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},o),d>0&&a.if(c._`${o} && ${i}`).assign(i,!1).assign(b,c._`[${b}, ${d}]`).else(),a.if(o,(()=>{a.assign(i,!0),a.assign(b,d),n&&e.mergeEvaluated(n,c.Name)}))}))})),e.result(i,(()=>e.reset()),(()=>e.error(!0)))}};a.default=d},45333:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(15765),f=t(99029),d=t(94227),r=t(94227),n={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:a,schema:t,data:n,parentSchema:i,it:b}=e,{opts:o}=b,s=(0,c.allSchemaProperties)(t),l=s.filter((e=>(0,d.alwaysValidSchema)(b,t[e])));if(0===s.length||l.length===s.length&&(!b.opts.unevaluated||!0===b.props))return;const u=o.strictSchema&&!o.allowMatchingProperties&&i.properties,h=a.name("valid");!0===b.props||b.props instanceof f.Name||(b.props=(0,r.evaluatedPropsToName)(a,b.props));const{props:p}=b;function g(e){for(const a in u)new RegExp(e).test(a)&&(0,d.checkStrictMode)(b,`property ${a} matches pattern ${e} (use allowMatchingProperties)`)}function m(t){a.forIn("key",n,(d=>{a.if(f._`${(0,c.usePattern)(e,t)}.test(${d})`,(()=>{const c=l.includes(t);c||e.subschema({keyword:"patternProperties",schemaProp:t,dataProp:d,dataPropType:r.Type.Str},h),b.opts.unevaluated&&!0!==p?a.assign(f._`${p}[${d}]`,!0):c||b.allErrors||a.if((0,f.not)(h),(()=>a.break()))}))}))}!function(){for(const e of s)u&&g(e),b.allErrors?m(e):(a.var(h,!0),m(e),a.if(h))}()}};a.default=n},65354:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(20494),f={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,c.validateTuple)(e,"items")};a.default=f},40117:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(62586),f=t(15765),d=t(94227),r=t(38660),n={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:a,schema:t,parentSchema:n,data:i,it:b}=e;"all"===b.opts.removeAdditional&&void 0===n.additionalProperties&&r.default.code(new c.KeywordCxt(b,r.default,"additionalProperties"));const o=(0,f.allSchemaProperties)(t);for(const e of o)b.definedProperties.add(e);b.opts.unevaluated&&o.length&&!0!==b.props&&(b.props=d.mergeEvaluated.props(a,(0,d.toHash)(o),b.props));const s=o.filter((e=>!(0,d.alwaysValidSchema)(b,t[e])));if(0===s.length)return;const l=a.name("valid");for(const t of s)u(t)?h(t):(a.if((0,f.propertyInData)(a,i,t,b.opts.ownProperties)),h(t),b.allErrors||a.else().var(l,!0),a.endIf()),e.it.definedProperties.add(t),e.ok(l);function u(e){return b.opts.useDefaults&&!b.compositeRule&&void 0!==t[e].default}function h(a){e.subschema({keyword:"properties",schemaProp:a,dataProp:a},l)}}};a.default=n},19713:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(99029),f=t(94227),d={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>c._`{propertyName: ${e.propertyName}}`},code(e){const{gen:a,schema:t,data:d,it:r}=e;if((0,f.alwaysValidSchema)(r,t))return;const n=a.name("valid");a.forIn("key",d,(t=>{e.setParams({propertyName:t}),e.subschema({keyword:"propertyNames",data:t,dataTypes:["string"],propertyName:t,compositeRule:!0},n),a.if((0,c.not)(n),(()=>{e.error(!0),r.allErrors||a.break()}))})),e.ok(n)}};a.default=d},14426:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(94227),f={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:a,it:t}){void 0===a.if&&(0,c.checkStrictMode)(t,`"${e}" without "if" is ignored`)}};a.default=f},15765:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.validateUnion=a.validateArray=a.usePattern=a.callValidateCode=a.schemaProperties=a.allSchemaProperties=a.noPropertyInData=a.propertyInData=a.isOwnProperty=a.hasPropFunc=a.reportMissingProp=a.checkMissingProp=a.checkReportMissingProp=void 0;const c=t(99029),f=t(94227),d=t(42023),r=t(94227);function n(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:c._`Object.prototype.hasOwnProperty`})}function i(e,a,t){return c._`${n(e)}.call(${a}, ${t})`}function b(e,a,t,f){const d=c._`${a}${(0,c.getProperty)(t)} === undefined`;return f?(0,c.or)(d,(0,c.not)(i(e,a,t))):d}function o(e){return e?Object.keys(e).filter((e=>"__proto__"!==e)):[]}a.checkReportMissingProp=function(e,a){const{gen:t,data:f,it:d}=e;t.if(b(t,f,a,d.opts.ownProperties),(()=>{e.setParams({missingProperty:c._`${a}`},!0),e.error()}))},a.checkMissingProp=function({gen:e,data:a,it:{opts:t}},f,d){return(0,c.or)(...f.map((f=>(0,c.and)(b(e,a,f,t.ownProperties),c._`${d} = ${f}`))))},a.reportMissingProp=function(e,a){e.setParams({missingProperty:a},!0),e.error()},a.hasPropFunc=n,a.isOwnProperty=i,a.propertyInData=function(e,a,t,f){const d=c._`${a}${(0,c.getProperty)(t)} !== undefined`;return f?c._`${d} && ${i(e,a,t)}`:d},a.noPropertyInData=b,a.allSchemaProperties=o,a.schemaProperties=function(e,a){return o(a).filter((t=>!(0,f.alwaysValidSchema)(e,a[t])))},a.callValidateCode=function({schemaCode:e,data:a,it:{gen:t,topSchemaRef:f,schemaPath:r,errorPath:n},it:i},b,o,s){const l=s?c._`${e}, ${a}, ${f}${r}`:a,u=[[d.default.instancePath,(0,c.strConcat)(d.default.instancePath,n)],[d.default.parentData,i.parentData],[d.default.parentDataProperty,i.parentDataProperty],[d.default.rootData,d.default.rootData]];i.opts.dynamicRef&&u.push([d.default.dynamicAnchors,d.default.dynamicAnchors]);const h=c._`${l}, ${t.object(...u)}`;return o!==c.nil?c._`${b}.call(${o}, ${h})`:c._`${b}(${h})`};const s=c._`new RegExp`;a.usePattern=function({gen:e,it:{opts:a}},t){const f=a.unicodeRegExp?"u":"",{regExp:d}=a.code,n=d(t,f);return e.scopeValue("pattern",{key:n.toString(),ref:n,code:c._`${"new RegExp"===d.code?s:(0,r.useFunc)(e,d)}(${t}, ${f})`})},a.validateArray=function(e){const{gen:a,data:t,keyword:d,it:r}=e,n=a.name("valid");if(r.allErrors){const e=a.let("valid",!0);return i((()=>a.assign(e,!1))),e}return a.var(n,!0),i((()=>a.break())),n;function i(r){const i=a.const("len",c._`${t}.length`);a.forRange("i",0,i,(t=>{e.subschema({keyword:d,dataProp:t,dataPropType:f.Type.Num},n),a.if((0,c.not)(n),r)}))}},a.validateUnion=function(e){const{gen:a,schema:t,keyword:d,it:r}=e;if(!Array.isArray(t))throw new Error("ajv implementation error");if(t.some((e=>(0,f.alwaysValidSchema)(r,e)))&&!r.opts.unevaluated)return;const n=a.let("valid",!1),i=a.name("_valid");a.block((()=>t.forEach(((t,f)=>{const r=e.subschema({keyword:d,schemaProp:f,compositeRule:!0},i);a.assign(n,c._`${n} || ${i}`),e.mergeValidEvaluated(r,i)||a.if((0,c.not)(n))})))),e.result(n,(()=>e.reset()),(()=>e.error(!0)))}},83463:(e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const t={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};a.default=t},72128:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(83463),f=t(13693),d=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",c.default,f.default];a.default=d},13693:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.callRef=a.getValidate=void 0;const c=t(34551),f=t(15765),d=t(99029),r=t(42023),n=t(73835),i=t(94227),b={keyword:"$ref",schemaType:"string",code(e){const{gen:a,schema:t,it:f}=e,{baseId:r,schemaEnv:i,validateName:b,opts:l,self:u}=f,{root:h}=i;if(("#"===t||"#/"===t)&&r===h.baseId)return function(){if(i===h)return s(e,b,i,i.$async);const t=a.scopeValue("root",{ref:h});return s(e,d._`${t}.validate`,h,h.$async)}();const p=n.resolveRef.call(u,h,r,t);if(void 0===p)throw new c.default(f.opts.uriResolver,r,t);return p instanceof n.SchemaEnv?function(a){const t=o(e,a);s(e,t,a,a.$async)}(p):function(c){const f=a.scopeValue("schema",!0===l.code.source?{ref:c,code:(0,d.stringify)(c)}:{ref:c}),r=a.name("valid"),n=e.subschema({schema:c,dataTypes:[],schemaPath:d.nil,topSchemaRef:f,errSchemaPath:t},r);e.mergeEvaluated(n),e.ok(r)}(p)}};function o(e,a){const{gen:t}=e;return a.validate?t.scopeValue("validate",{ref:a.validate}):d._`${t.scopeValue("wrapper",{ref:a})}.validate`}function s(e,a,t,c){const{gen:n,it:b}=e,{allErrors:o,schemaEnv:s,opts:l}=b,u=l.passContext?r.default.this:d.nil;function h(e){const a=d._`${e}.errors`;n.assign(r.default.vErrors,d._`${r.default.vErrors} === null ? ${a} : ${r.default.vErrors}.concat(${a})`),n.assign(r.default.errors,d._`${r.default.vErrors}.length`)}function p(e){var a;if(!b.opts.unevaluated)return;const c=null===(a=null==t?void 0:t.validate)||void 0===a?void 0:a.evaluated;if(!0!==b.props)if(c&&!c.dynamicProps)void 0!==c.props&&(b.props=i.mergeEvaluated.props(n,c.props,b.props));else{const a=n.var("props",d._`${e}.evaluated.props`);b.props=i.mergeEvaluated.props(n,a,b.props,d.Name)}if(!0!==b.items)if(c&&!c.dynamicItems)void 0!==c.items&&(b.items=i.mergeEvaluated.items(n,c.items,b.items));else{const a=n.var("items",d._`${e}.evaluated.items`);b.items=i.mergeEvaluated.items(n,a,b.items,d.Name)}}c?function(){if(!s.$async)throw new Error("async schema referenced by sync schema");const t=n.let("valid");n.try((()=>{n.code(d._`await ${(0,f.callValidateCode)(e,a,u)}`),p(a),o||n.assign(t,!0)}),(e=>{n.if(d._`!(${e} instanceof ${b.ValidationError})`,(()=>n.throw(e))),h(e),o||n.assign(t,!1)})),e.ok(t)}():e.result((0,f.callValidateCode)(e,a,u),(()=>p(a)),(()=>h(a)))}a.getValidate=o,a.callRef=s,a.default=b},36653:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(99029),f=t(97652),d=t(73835),r=t(34551),n=t(94227),i={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:a}})=>e===f.DiscrError.Tag?`tag "${a}" must be string`:`value of tag "${a}" must be in oneOf`,params:({params:{discrError:e,tag:a,tagName:t}})=>c._`{error: ${e}, tag: ${t}, tagValue: ${a}}`},code(e){const{gen:a,data:t,schema:i,parentSchema:b,it:o}=e,{oneOf:s}=b;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");const l=i.propertyName;if("string"!=typeof l)throw new Error("discriminator: requires propertyName");if(i.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");const u=a.let("valid",!1),h=a.const("tag",c._`${t}${(0,c.getProperty)(l)}`);function p(t){const f=a.name("valid"),d=e.subschema({keyword:"oneOf",schemaProp:t},f);return e.mergeEvaluated(d,c.Name),f}a.if(c._`typeof ${h} == "string"`,(()=>function(){const t=function(){var e;const a={},t=f(b);let c=!0;for(let a=0;ae.error(!1,{discrError:f.DiscrError.Tag,tag:h,tagName:l}))),e.ok(u)}};a.default=i},97652:(e,a)=>{"use strict";var t;Object.defineProperty(a,"__esModule",{value:!0}),a.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(t||(a.DiscrError=t={}))},86144:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(72128),f=t(67060),d=t(56378),r=t(97532),n=t(69857),i=[c.default,f.default,(0,d.default)(),r.default,n.metadataVocabulary,n.contentVocabulary];a.default=i},94737:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(99029),f={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>c.str`must match format "${e}"`,params:({schemaCode:e})=>c._`{format: ${e}}`},code(e,a){const{gen:t,data:f,$data:d,schema:r,schemaCode:n,it:i}=e,{opts:b,errSchemaPath:o,schemaEnv:s,self:l}=i;b.validateFormats&&(d?function(){const d=t.scopeValue("formats",{ref:l.formats,code:b.code.formats}),r=t.const("fDef",c._`${d}[${n}]`),i=t.let("fType"),o=t.let("format");t.if(c._`typeof ${r} == "object" && !(${r} instanceof RegExp)`,(()=>t.assign(i,c._`${r}.type || "string"`).assign(o,c._`${r}.validate`)),(()=>t.assign(i,c._`"string"`).assign(o,r))),e.fail$data((0,c.or)(!1===b.strictSchema?c.nil:c._`${n} && !${o}`,function(){const e=s.$async?c._`(${r}.async ? await ${o}(${f}) : ${o}(${f}))`:c._`${o}(${f})`,t=c._`(typeof ${o} == "function" ? ${e} : ${o}.test(${f}))`;return c._`${o} && ${o} !== true && ${i} === ${a} && !${t}`}()))}():function(){const d=l.formats[r];if(!d)return void function(){if(!1!==b.strictSchema)throw new Error(e());function e(){return`unknown format "${r}" ignored in schema at path "${o}"`}l.logger.warn(e())}();if(!0===d)return;const[n,i,u]=function(e){const a=e instanceof RegExp?(0,c.regexpCode)(e):b.code.formats?c._`${b.code.formats}${(0,c.getProperty)(r)}`:void 0,f=t.scopeValue("formats",{key:r,ref:e,code:a});return"object"!=typeof e||e instanceof RegExp?["string",e,f]:[e.type||"string",e.validate,c._`${f}.validate`]}(d);n===a&&e.pass(function(){if("object"==typeof d&&!(d instanceof RegExp)&&d.async){if(!s.$async)throw new Error("async format in sync schema");return c._`await ${u}(${f})`}return"function"==typeof i?c._`${u}(${f})`:c._`${u}.test(${f})`}())}())}};a.default=f},97532:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=[t(94737).default];a.default=c},69857:(e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.contentVocabulary=a.metadataVocabulary=void 0,a.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],a.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]},27935:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(99029),f=t(94227),d=t(76250),r={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>c._`{allowedValue: ${e}}`},code(e){const{gen:a,data:t,$data:r,schemaCode:n,schema:i}=e;r||i&&"object"==typeof i?e.fail$data(c._`!${(0,f.useFunc)(a,d.default)}(${t}, ${n})`):e.fail(c._`${i} !== ${t}`)}};a.default=r},28643:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(99029),f=t(94227),d=t(76250),r={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>c._`{allowedValues: ${e}}`},code(e){const{gen:a,data:t,$data:r,schema:n,schemaCode:i,it:b}=e;if(!r&&0===n.length)throw new Error("enum must have non-empty array");const o=n.length>=b.opts.loopEnum;let s;const l=()=>null!=s?s:s=(0,f.useFunc)(a,d.default);let u;if(o||r)u=a.let("valid"),e.block$data(u,(function(){a.assign(u,!1),a.forOf("v",i,(e=>a.if(c._`${l()}(${t}, ${e})`,(()=>a.assign(u,!0).break()))))}));else{if(!Array.isArray(n))throw new Error("ajv implementation error");const e=a.const("vSchema",i);u=(0,c.or)(...n.map(((a,f)=>function(e,a){const f=n[a];return"object"==typeof f&&null!==f?c._`${l()}(${t}, ${e}[${a}])`:c._`${t} === ${f}`}(e,f))))}e.pass(u)}};a.default=r},67060:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(75882),f=t(63439),d=t(77307),r=t(90422),n=t(34486),i=t(34003),b=t(61163),o=t(60617),s=t(27935),l=t(28643),u=[c.default,f.default,d.default,r.default,n.default,i.default,b.default,o.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},s.default,l.default];a.default=u},61163:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(99029),f={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:a}){const t="maxItems"===e?"more":"fewer";return c.str`must NOT have ${t} than ${a} items`},params:({schemaCode:e})=>c._`{limit: ${e}}`},code(e){const{keyword:a,data:t,schemaCode:f}=e,d="maxItems"===a?c.operators.GT:c.operators.LT;e.fail$data(c._`${t}.length ${d} ${f}`)}};a.default=f},77307:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(99029),f=t(94227),d=t(53853),r={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:a}){const t="maxLength"===e?"more":"fewer";return c.str`must NOT have ${t} than ${a} characters`},params:({schemaCode:e})=>c._`{limit: ${e}}`},code(e){const{keyword:a,data:t,schemaCode:r,it:n}=e,i="maxLength"===a?c.operators.GT:c.operators.LT,b=!1===n.opts.unicode?c._`${t}.length`:c._`${(0,f.useFunc)(e.gen,d.default)}(${t})`;e.fail$data(c._`${b} ${i} ${r}`)}};a.default=r},75882:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(99029),f=c.operators,d={maximum:{okStr:"<=",ok:f.LTE,fail:f.GT},minimum:{okStr:">=",ok:f.GTE,fail:f.LT},exclusiveMaximum:{okStr:"<",ok:f.LT,fail:f.GTE},exclusiveMinimum:{okStr:">",ok:f.GT,fail:f.LTE}},r={message:({keyword:e,schemaCode:a})=>c.str`must be ${d[e].okStr} ${a}`,params:({keyword:e,schemaCode:a})=>c._`{comparison: ${d[e].okStr}, limit: ${a}}`},n={keyword:Object.keys(d),type:"number",schemaType:"number",$data:!0,error:r,code(e){const{keyword:a,data:t,schemaCode:f}=e;e.fail$data(c._`${t} ${d[a].fail} ${f} || isNaN(${t})`)}};a.default=n},34486:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(99029),f={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:a}){const t="maxProperties"===e?"more":"fewer";return c.str`must NOT have ${t} than ${a} properties`},params:({schemaCode:e})=>c._`{limit: ${e}}`},code(e){const{keyword:a,data:t,schemaCode:f}=e,d="maxProperties"===a?c.operators.GT:c.operators.LT;e.fail$data(c._`Object.keys(${t}).length ${d} ${f}`)}};a.default=f},63439:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(99029),f={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>c.str`must be multiple of ${e}`,params:({schemaCode:e})=>c._`{multipleOf: ${e}}`},code(e){const{gen:a,data:t,schemaCode:f,it:d}=e,r=d.opts.multipleOfPrecision,n=a.let("res"),i=r?c._`Math.abs(Math.round(${n}) - ${n}) > 1e-${r}`:c._`${n} !== parseInt(${n})`;e.fail$data(c._`(${f} === 0 || (${n} = ${t}/${f}, ${i}))`)}};a.default=f},90422:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(15765),f=t(99029),d={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>f.str`must match pattern "${e}"`,params:({schemaCode:e})=>f._`{pattern: ${e}}`},code(e){const{data:a,$data:t,schema:d,schemaCode:r,it:n}=e,i=n.opts.unicodeRegExp?"u":"",b=t?f._`(new RegExp(${r}, ${i}))`:(0,c.usePattern)(e,d);e.fail$data(f._`!${b}.test(${a})`)}};a.default=d},34003:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(15765),f=t(99029),d=t(94227),r={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>f.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>f._`{missingProperty: ${e}}`},code(e){const{gen:a,schema:t,schemaCode:r,data:n,$data:i,it:b}=e,{opts:o}=b;if(!i&&0===t.length)return;const s=t.length>=o.loopRequired;if(b.allErrors?function(){if(s||i)e.block$data(f.nil,l);else for(const a of t)(0,c.checkReportMissingProp)(e,a)}():function(){const d=a.let("missing");if(s||i){const t=a.let("valid",!0);e.block$data(t,(()=>function(t,d){e.setParams({missingProperty:t}),a.forOf(t,r,(()=>{a.assign(d,(0,c.propertyInData)(a,n,t,o.ownProperties)),a.if((0,f.not)(d),(()=>{e.error(),a.break()}))}),f.nil)}(d,t))),e.ok(t)}else a.if((0,c.checkMissingProp)(e,t,d)),(0,c.reportMissingProp)(e,d),a.else()}(),o.strictRequired){const a=e.parentSchema.properties,{definedProperties:c}=e.it;for(const e of t)if(void 0===(null==a?void 0:a[e])&&!c.has(e)){const a=`required property "${e}" is not defined at "${b.schemaEnv.baseId+b.errSchemaPath}" (strictRequired)`;(0,d.checkStrictMode)(b,a,b.opts.strictRequired)}}function l(){a.forOf("prop",r,(t=>{e.setParams({missingProperty:t}),a.if((0,c.noPropertyInData)(a,n,t,o.ownProperties),(()=>e.error()))}))}}};a.default=r},60617:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(10208),f=t(99029),d=t(94227),r=t(76250),n={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:a}})=>f.str`must NOT have duplicate items (items ## ${a} and ${e} are identical)`,params:({params:{i:e,j:a}})=>f._`{i: ${e}, j: ${a}}`},code(e){const{gen:a,data:t,$data:n,schema:i,parentSchema:b,schemaCode:o,it:s}=e;if(!n&&!i)return;const l=a.let("valid"),u=b.items?(0,c.getSchemaTypes)(b.items):[];function h(d,r){const n=a.name("item"),i=(0,c.checkDataTypes)(u,n,s.opts.strictNumbers,c.DataType.Wrong),b=a.const("indices",f._`{}`);a.for(f._`;${d}--;`,(()=>{a.let(n,f._`${t}[${d}]`),a.if(i,f._`continue`),u.length>1&&a.if(f._`typeof ${n} == "string"`,f._`${n} += "_"`),a.if(f._`typeof ${b}[${n}] == "number"`,(()=>{a.assign(r,f._`${b}[${n}]`),e.error(),a.assign(l,!1).break()})).code(f._`${b}[${n}] = ${d}`)}))}function p(c,n){const i=(0,d.useFunc)(a,r.default),b=a.name("outer");a.label(b).for(f._`;${c}--;`,(()=>a.for(f._`${n} = ${c}; ${n}--;`,(()=>a.if(f._`${i}(${t}[${c}], ${t}[${n}])`,(()=>{e.error(),a.assign(l,!1).break(b)}))))))}e.block$data(l,(function(){const c=a.let("i",f._`${t}.length`),d=a.let("j");e.setParams({i:c,j:d}),a.assign(l,!0),a.if(f._`${c} > 1`,(()=>(u.length>0&&!u.some((e=>"object"===e||"array"===e))?h:p)(c,d)))}),f._`${o} === false`),e.ok(l)}};a.default=n},87568:(e,a,t)=>{var c=a;c.bignum=t(72344),c.define=t(47363).define,c.base=t(9673),c.constants=t(22153),c.decoders=t(22853),c.encoders=t(24669)},47363:(e,a,t)=>{var c=t(87568),f=t(56698);function d(e,a){this.name=e,this.body=a,this.decoders={},this.encoders={}}a.define=function(e,a){return new d(e,a)},d.prototype._createNamed=function(e){var a;try{a=t(68961).runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(e){a=function(e){this._initNamed(e)}}return f(a,e),a.prototype._initNamed=function(a){e.call(this,a)},new a(this)},d.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(c.decoders[e])),this.decoders[e]},d.prototype.decode=function(e,a,t){return this._getDecoder(a).decode(e,t)},d.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(c.encoders[e])),this.encoders[e]},d.prototype.encode=function(e,a,t){return this._getEncoder(a).encode(e,t)}},47227:(e,a,t)=>{var c=t(56698),f=t(9673).Reporter,d=t(48287).Buffer;function r(e,a){f.call(this,a),d.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function n(e,a){if(Array.isArray(e))this.length=0,this.value=e.map((function(e){return e instanceof n||(e=new n(e,a)),this.length+=e.length,e}),this);else if("number"==typeof e){if(!(0<=e&&e<=255))return a.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=d.byteLength(e);else{if(!d.isBuffer(e))return a.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}c(r,f),a.t=r,r.prototype.save=function(){return{offset:this.offset,reporter:f.prototype.save.call(this)}},r.prototype.restore=function(e){var a=new r(this.base);return a.offset=e.offset,a.length=this.offset,this.offset=e.offset,f.prototype.restore.call(this,e.reporter),a},r.prototype.isEmpty=function(){return this.offset===this.length},r.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},r.prototype.skip=function(e,a){if(!(this.offset+e<=this.length))return this.error(a||"DecoderBuffer overrun");var t=new r(this.base);return t._reporterState=this._reporterState,t.offset=this.offset,t.length=this.offset+e,this.offset+=e,t},r.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},a.d=n,n.prototype.join=function(e,a){return e||(e=new d(this.length)),a||(a=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(t){t.join(e,a),a+=t.length})):("number"==typeof this.value?e[a]=this.value:"string"==typeof this.value?e.write(this.value,a):d.isBuffer(this.value)&&this.value.copy(e,a),a+=this.length)),e}},9673:(e,a,t)=>{var c=a;c.Reporter=t(89220).a,c.DecoderBuffer=t(47227).t,c.EncoderBuffer=t(47227).d,c.Node=t(90993)},90993:(e,a,t)=>{var c=t(9673).Reporter,f=t(9673).EncoderBuffer,d=t(9673).DecoderBuffer,r=t(43349),n=["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"],i=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(n);function b(e,a){var t={};this._baseState=t,t.enc=e,t.parent=a||null,t.children=null,t.tag=null,t.args=null,t.reverseArgs=null,t.choice=null,t.optional=!1,t.any=!1,t.obj=!1,t.use=null,t.useDecoder=null,t.key=null,t.default=null,t.explicit=null,t.implicit=null,t.contains=null,t.parent||(t.children=[],this._wrap())}e.exports=b;var o=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];b.prototype.clone=function(){var e=this._baseState,a={};o.forEach((function(t){a[t]=e[t]}));var t=new this.constructor(a.parent);return t._baseState=a,t},b.prototype._wrap=function(){var e=this._baseState;i.forEach((function(a){this[a]=function(){var t=new this.constructor(this);return e.children.push(t),t[a].apply(t,arguments)}}),this)},b.prototype._init=function(e){var a=this._baseState;r(null===a.parent),e.call(this),a.children=a.children.filter((function(e){return e._baseState.parent===this}),this),r.equal(a.children.length,1,"Root node can have only one child")},b.prototype._useArgs=function(e){var a=this._baseState,t=e.filter((function(e){return e instanceof this.constructor}),this);e=e.filter((function(e){return!(e instanceof this.constructor)}),this),0!==t.length&&(r(null===a.children),a.children=t,t.forEach((function(e){e._baseState.parent=this}),this)),0!==e.length&&(r(null===a.args),a.args=e,a.reverseArgs=e.map((function(e){if("object"!=typeof e||e.constructor!==Object)return e;var a={};return Object.keys(e).forEach((function(t){t==(0|t)&&(t|=0);var c=e[t];a[c]=t})),a})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(e){b.prototype[e]=function(){var a=this._baseState;throw new Error(e+" not implemented for encoding: "+a.enc)}})),n.forEach((function(e){b.prototype[e]=function(){var a=this._baseState,t=Array.prototype.slice.call(arguments);return r(null===a.tag),a.tag=e,this._useArgs(t),this}})),b.prototype.use=function(e){r(e);var a=this._baseState;return r(null===a.use),a.use=e,this},b.prototype.optional=function(){return this._baseState.optional=!0,this},b.prototype.def=function(e){var a=this._baseState;return r(null===a.default),a.default=e,a.optional=!0,this},b.prototype.explicit=function(e){var a=this._baseState;return r(null===a.explicit&&null===a.implicit),a.explicit=e,this},b.prototype.implicit=function(e){var a=this._baseState;return r(null===a.explicit&&null===a.implicit),a.implicit=e,this},b.prototype.obj=function(){var e=this._baseState,a=Array.prototype.slice.call(arguments);return e.obj=!0,0!==a.length&&this._useArgs(a),this},b.prototype.key=function(e){var a=this._baseState;return r(null===a.key),a.key=e,this},b.prototype.any=function(){return this._baseState.any=!0,this},b.prototype.choice=function(e){var a=this._baseState;return r(null===a.choice),a.choice=e,this._useArgs(Object.keys(e).map((function(a){return e[a]}))),this},b.prototype.contains=function(e){var a=this._baseState;return r(null===a.use),a.contains=e,this},b.prototype._decode=function(e,a){var t=this._baseState;if(null===t.parent)return e.wrapResult(t.children[0]._decode(e,a));var c,f=t.default,r=!0,n=null;if(null!==t.key&&(n=e.enterKey(t.key)),t.optional){var i=null;if(null!==t.explicit?i=t.explicit:null!==t.implicit?i=t.implicit:null!==t.tag&&(i=t.tag),null!==i||t.any){if(r=this._peekTag(e,i,t.any),e.isError(r))return r}else{var b=e.save();try{null===t.choice?this._decodeGeneric(t.tag,e,a):this._decodeChoice(e,a),r=!0}catch(e){r=!1}e.restore(b)}}if(t.obj&&r&&(c=e.enterObject()),r){if(null!==t.explicit){var o=this._decodeTag(e,t.explicit);if(e.isError(o))return o;e=o}var s=e.offset;if(null===t.use&&null===t.choice){t.any&&(b=e.save());var l=this._decodeTag(e,null!==t.implicit?t.implicit:t.tag,t.any);if(e.isError(l))return l;t.any?f=e.raw(b):e=l}if(a&&a.track&&null!==t.tag&&a.track(e.path(),s,e.length,"tagged"),a&&a.track&&null!==t.tag&&a.track(e.path(),e.offset,e.length,"content"),t.any||(f=null===t.choice?this._decodeGeneric(t.tag,e,a):this._decodeChoice(e,a)),e.isError(f))return f;if(t.any||null!==t.choice||null===t.children||t.children.forEach((function(t){t._decode(e,a)})),t.contains&&("octstr"===t.tag||"bitstr"===t.tag)){var u=new d(f);f=this._getUse(t.contains,e._reporterState.obj)._decode(u,a)}}return t.obj&&r&&(f=e.leaveObject(c)),null===t.key||null===f&&!0!==r?null!==n&&e.exitKey(n):e.leaveKey(n,t.key,f),f},b.prototype._decodeGeneric=function(e,a,t){var c=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(a,e,c.args[0],t):/str$/.test(e)?this._decodeStr(a,e,t):"objid"===e&&c.args?this._decodeObjid(a,c.args[0],c.args[1],t):"objid"===e?this._decodeObjid(a,null,null,t):"gentime"===e||"utctime"===e?this._decodeTime(a,e,t):"null_"===e?this._decodeNull(a,t):"bool"===e?this._decodeBool(a,t):"objDesc"===e?this._decodeStr(a,e,t):"int"===e||"enum"===e?this._decodeInt(a,c.args&&c.args[0],t):null!==c.use?this._getUse(c.use,a._reporterState.obj)._decode(a,t):a.error("unknown tag: "+e)},b.prototype._getUse=function(e,a){var t=this._baseState;return t.useDecoder=this._use(e,a),r(null===t.useDecoder._baseState.parent),t.useDecoder=t.useDecoder._baseState.children[0],t.implicit!==t.useDecoder._baseState.implicit&&(t.useDecoder=t.useDecoder.clone(),t.useDecoder._baseState.implicit=t.implicit),t.useDecoder},b.prototype._decodeChoice=function(e,a){var t=this._baseState,c=null,f=!1;return Object.keys(t.choice).some((function(d){var r=e.save(),n=t.choice[d];try{var i=n._decode(e,a);if(e.isError(i))return!1;c={type:d,value:i},f=!0}catch(a){return e.restore(r),!1}return!0}),this),f?c:e.error("Choice not matched")},b.prototype._createEncoderBuffer=function(e){return new f(e,this.reporter)},b.prototype._encode=function(e,a,t){var c=this._baseState;if(null===c.default||c.default!==e){var f=this._encodeValue(e,a,t);if(void 0!==f&&!this._skipDefault(f,a,t))return f}},b.prototype._encodeValue=function(e,a,t){var f=this._baseState;if(null===f.parent)return f.children[0]._encode(e,a||new c);var d=null;if(this.reporter=a,f.optional&&void 0===e){if(null===f.default)return;e=f.default}var r=null,n=!1;if(f.any)d=this._createEncoderBuffer(e);else if(f.choice)d=this._encodeChoice(e,a);else if(f.contains)r=this._getUse(f.contains,t)._encode(e,a),n=!0;else if(f.children)r=f.children.map((function(t){if("null_"===t._baseState.tag)return t._encode(null,a,e);if(null===t._baseState.key)return a.error("Child should have a key");var c=a.enterKey(t._baseState.key);if("object"!=typeof e)return a.error("Child expected, but input is not object");var f=t._encode(e[t._baseState.key],a,e);return a.leaveKey(c),f}),this).filter((function(e){return e})),r=this._createEncoderBuffer(r);else if("seqof"===f.tag||"setof"===f.tag){if(!f.args||1!==f.args.length)return a.error("Too many args for : "+f.tag);if(!Array.isArray(e))return a.error("seqof/setof, but data is not Array");var i=this.clone();i._baseState.implicit=null,r=this._createEncoderBuffer(e.map((function(t){var c=this._baseState;return this._getUse(c.args[0],e)._encode(t,a)}),i))}else null!==f.use?d=this._getUse(f.use,t)._encode(e,a):(r=this._encodePrimitive(f.tag,e),n=!0);if(!f.any&&null===f.choice){var b=null!==f.implicit?f.implicit:f.tag,o=null===f.implicit?"universal":"context";null===b?null===f.use&&a.error("Tag could be omitted only for .use()"):null===f.use&&(d=this._encodeComposite(b,n,o,r))}return null!==f.explicit&&(d=this._encodeComposite(f.explicit,!1,"context",d)),d},b.prototype._encodeChoice=function(e,a){var t=this._baseState,c=t.choice[e.type];return c||r(!1,e.type+" not found in "+JSON.stringify(Object.keys(t.choice))),c._encode(e.value,a)},b.prototype._encodePrimitive=function(e,a){var t=this._baseState;if(/str$/.test(e))return this._encodeStr(a,e);if("objid"===e&&t.args)return this._encodeObjid(a,t.reverseArgs[0],t.args[1]);if("objid"===e)return this._encodeObjid(a,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(a,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(a,t.args&&t.reverseArgs[0]);if("bool"===e)return this._encodeBool(a);if("objDesc"===e)return this._encodeStr(a,e);throw new Error("Unsupported tag: "+e)},b.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},b.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e)}},89220:(e,a,t)=>{var c=t(56698);function f(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function d(e,a){this.path=e,this.rethrow(a)}a.a=f,f.prototype.isError=function(e){return e instanceof d},f.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},f.prototype.restore=function(e){var a=this._reporterState;a.obj=e.obj,a.path=a.path.slice(0,e.pathLen)},f.prototype.enterKey=function(e){return this._reporterState.path.push(e)},f.prototype.exitKey=function(e){var a=this._reporterState;a.path=a.path.slice(0,e-1)},f.prototype.leaveKey=function(e,a,t){var c=this._reporterState;this.exitKey(e),null!==c.obj&&(c.obj[a]=t)},f.prototype.path=function(){return this._reporterState.path.join("/")},f.prototype.enterObject=function(){var e=this._reporterState,a=e.obj;return e.obj={},a},f.prototype.leaveObject=function(e){var a=this._reporterState,t=a.obj;return a.obj=e,t},f.prototype.error=function(e){var a,t=this._reporterState,c=e instanceof d;if(a=c?e:new d(t.path.map((function(e){return"["+JSON.stringify(e)+"]"})).join(""),e.message||e,e.stack),!t.options.partial)throw a;return c||t.errors.push(a),a},f.prototype.wrapResult=function(e){var a=this._reporterState;return a.options.partial?{result:this.isError(e)?null:e,errors:a.errors}:e},c(d,Error),d.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,d),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},74598:(e,a,t)=>{var c=t(22153);a.tagClass={0:"universal",1:"application",2:"context",3:"private"},a.tagClassByName=c._reverse(a.tagClass),a.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},a.tagByName=c._reverse(a.tag)},22153:(e,a,t)=>{var c=a;c._reverse=function(e){var a={};return Object.keys(e).forEach((function(t){(0|t)==t&&(t|=0);var c=e[t];a[c]=t})),a},c.der=t(74598)},62010:(e,a,t)=>{var c=t(56698),f=t(87568),d=f.base,r=f.bignum,n=f.constants.der;function i(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new b,this.tree._init(e.body)}function b(e){d.Node.call(this,"der",e)}function o(e,a){var t=e.readUInt8(a);if(e.isError(t))return t;var c=n.tagClass[t>>6],f=!(32&t);if(31&~t)t&=31;else{var d=t;for(t=0;!(128&~d);){if(d=e.readUInt8(a),e.isError(d))return d;t<<=7,t|=127&d}}return{cls:c,primitive:f,tag:t,tagStr:n.tag[t]}}function s(e,a,t){var c=e.readUInt8(t);if(e.isError(c))return c;if(!a&&128===c)return null;if(!(128&c))return c;var f=127&c;if(f>4)return e.error("length octect is too long");c=0;for(var d=0;d{var c=a;c.der=t(62010),c.pem=t(58903)},58903:(e,a,t)=>{var c=t(56698),f=t(48287).Buffer,d=t(62010);function r(e){d.call(this,e),this.enc="pem"}c(r,d),e.exports=r,r.prototype.decode=function(e,a){for(var t=e.toString().split(/[\r\n]+/g),c=a.label.toUpperCase(),r=/^-----(BEGIN|END) ([^-]+)-----$/,n=-1,i=-1,b=0;b{var c=t(56698),f=t(48287).Buffer,d=t(87568),r=d.base,n=d.constants.der;function i(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new b,this.tree._init(e.body)}function b(e){r.Node.call(this,"der",e)}function o(e){return e<10?"0"+e:e}e.exports=i,i.prototype.encode=function(e,a){return this.tree._encode(e,a).join()},c(b,r.Node),b.prototype._encodeComposite=function(e,a,t,c){var d,r=function(e,a,t,c){var f;if("seqof"===e?e="seq":"setof"===e&&(e="set"),n.tagByName.hasOwnProperty(e))f=n.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return c.error("Unknown tag: "+e);f=e}return f>=31?c.error("Multi-octet tag encoding unsupported"):(a||(f|=32),f|=n.tagClassByName[t||"universal"]<<6)}(e,a,t,this.reporter);if(c.length<128)return(d=new f(2))[0]=r,d[1]=c.length,this._createEncoderBuffer([d,c]);for(var i=1,b=c.length;b>=256;b>>=8)i++;(d=new f(2+i))[0]=r,d[1]=128|i,b=1+i;for(var o=c.length;o>0;b--,o>>=8)d[b]=255&o;return this._createEncoderBuffer([d,c])},b.prototype._encodeStr=function(e,a){if("bitstr"===a)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===a){for(var t=new f(2*e.length),c=0;c=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}var d=0;for(c=0;c=128;r>>=7)d++}var n=new f(d),i=n.length-1;for(c=e.length-1;c>=0;c--)for(r=e[c],n[i--]=127&r;(r>>=7)>0;)n[i--]=128|127&r;return this._createEncoderBuffer(n)},b.prototype._encodeTime=function(e,a){var t,c=new Date(e);return"gentime"===a?t=[o(c.getFullYear()),o(c.getUTCMonth()+1),o(c.getUTCDate()),o(c.getUTCHours()),o(c.getUTCMinutes()),o(c.getUTCSeconds()),"Z"].join(""):"utctime"===a?t=[o(c.getFullYear()%100),o(c.getUTCMonth()+1),o(c.getUTCDate()),o(c.getUTCHours()),o(c.getUTCMinutes()),o(c.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+a+" time is not supported yet"),this._encodeStr(t,"octstr")},b.prototype._encodeNull=function(){return this._createEncoderBuffer("")},b.prototype._encodeInt=function(e,a){if("string"==typeof e){if(!a)return this.reporter.error("String int or enum given, but no values map");if(!a.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=a[e]}if("number"!=typeof e&&!f.isBuffer(e)){var t=e.toArray();!e.sign&&128&t[0]&&t.unshift(0),e=new f(t)}if(f.isBuffer(e)){var c=e.length;0===e.length&&c++;var d=new f(c);return e.copy(d),0===e.length&&(d[0]=0),this._createEncoderBuffer(d)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);c=1;for(var r=e;r>=256;r>>=8)c++;for(r=(d=new Array(c)).length-1;r>=0;r--)d[r]=255&e,e>>=8;return 128&d[0]&&d.unshift(0),this._createEncoderBuffer(new f(d))},b.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},b.prototype._use=function(e,a){return"function"==typeof e&&(e=e(a)),e._getEncoder("der").tree},b.prototype._skipDefault=function(e,a,t){var c,f=this._baseState;if(null===f.default)return!1;var d=e.join();if(void 0===f.defaultBuffer&&(f.defaultBuffer=this._encodeValue(f.default,a,t).join()),d.length!==f.defaultBuffer.length)return!1;for(c=0;c{var c=a;c.der=t(70082),c.pem=t(90735)},90735:(e,a,t)=>{var c=t(56698),f=t(70082);function d(e){f.call(this,e),this.enc="pem"}c(d,f),e.exports=d,d.prototype.encode=function(e,a){for(var t=f.prototype.encode.call(this,e).toString("base64"),c=["-----BEGIN "+a.label+"-----"],d=0;d=65&&t<=70?t-55:t>=97&&t<=102?t-87:t-48&15}function i(e,a,t){var c=n(e,t);return t-1>=a&&(c|=n(e,t-1)<<4),c}function b(e,a,t,c){for(var f=0,d=Math.min(e.length,t),r=a;r=49?n-49+10:n>=17?n-17+10:n}return f}d.isBN=function(e){return e instanceof d||null!==e&&"object"==typeof e&&e.constructor.wordSize===d.wordSize&&Array.isArray(e.words)},d.max=function(e,a){return e.cmp(a)>0?e:a},d.min=function(e,a){return e.cmp(a)<0?e:a},d.prototype._init=function(e,a,t){if("number"==typeof e)return this._initNumber(e,a,t);if("object"==typeof e)return this._initArray(e,a,t);"hex"===a&&(a=16),c(a===(0|a)&&a>=2&&a<=36);var f=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(f++,this.negative=1),f=0;f-=3)r=e[f]|e[f-1]<<8|e[f-2]<<16,this.words[d]|=r<>>26-n&67108863,(n+=24)>=26&&(n-=26,d++);else if("le"===t)for(f=0,d=0;f>>26-n&67108863,(n+=24)>=26&&(n-=26,d++);return this.strip()},d.prototype._parseHex=function(e,a,t){this.length=Math.ceil((e.length-a)/6),this.words=new Array(this.length);for(var c=0;c=a;c-=2)f=i(e,a,c)<=18?(d-=18,r+=1,this.words[r]|=f>>>26):d+=8;else for(c=(e.length-a)%2==0?a+1:a;c=18?(d-=18,r+=1,this.words[r]|=f>>>26):d+=8;this.strip()},d.prototype._parseBase=function(e,a,t){this.words=[0],this.length=1;for(var c=0,f=1;f<=67108863;f*=a)c++;c--,f=f/a|0;for(var d=e.length-t,r=d%c,n=Math.min(d,d-r)+t,i=0,o=t;o1&&0===this.words[this.length-1];)this.length--;return this._normSign()},d.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},d.prototype.inspect=function(){return(this.red?""};var o=["","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"],s=[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],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function u(e,a,t){t.negative=a.negative^e.negative;var c=e.length+a.length|0;t.length=c,c=c-1|0;var f=0|e.words[0],d=0|a.words[0],r=f*d,n=67108863&r,i=r/67108864|0;t.words[0]=n;for(var b=1;b>>26,s=67108863&i,l=Math.min(b,a.length-1),u=Math.max(0,b-e.length+1);u<=l;u++){var h=b-u|0;o+=(r=(f=0|e.words[h])*(d=0|a.words[u])+s)/67108864|0,s=67108863&r}t.words[b]=0|s,i=0|o}return 0!==i?t.words[b]=0|i:t.length--,t.strip()}d.prototype.toString=function(e,a){var t;if(a=0|a||1,16===(e=e||10)||"hex"===e){t="";for(var f=0,d=0,r=0;r>>24-f&16777215)||r!==this.length-1?o[6-i.length]+i+t:i+t,(f+=2)>=26&&(f-=26,r--)}for(0!==d&&(t=d.toString(16)+t);t.length%a!=0;)t="0"+t;return 0!==this.negative&&(t="-"+t),t}if(e===(0|e)&&e>=2&&e<=36){var b=s[e],u=l[e];t="";var h=this.clone();for(h.negative=0;!h.isZero();){var p=h.modn(u).toString(e);t=(h=h.idivn(u)).isZero()?p+t:o[b-p.length]+p+t}for(this.isZero()&&(t="0"+t);t.length%a!=0;)t="0"+t;return 0!==this.negative&&(t="-"+t),t}c(!1,"Base should be between 2 and 36")},d.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&c(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},d.prototype.toJSON=function(){return this.toString(16)},d.prototype.toBuffer=function(e,a){return c(void 0!==r),this.toArrayLike(r,e,a)},d.prototype.toArray=function(e,a){return this.toArrayLike(Array,e,a)},d.prototype.toArrayLike=function(e,a,t){var f=this.byteLength(),d=t||Math.max(1,f);c(f<=d,"byte array longer than desired length"),c(d>0,"Requested array length <= 0"),this.strip();var r,n,i="le"===a,b=new e(d),o=this.clone();if(i){for(n=0;!o.isZero();n++)r=o.andln(255),o.iushrn(8),b[n]=r;for(;n=4096&&(t+=13,a>>>=13),a>=64&&(t+=7,a>>>=7),a>=8&&(t+=4,a>>>=4),a>=2&&(t+=2,a>>>=2),t+a},d.prototype._zeroBits=function(e){if(0===e)return 26;var a=e,t=0;return 8191&a||(t+=13,a>>>=13),127&a||(t+=7,a>>>=7),15&a||(t+=4,a>>>=4),3&a||(t+=2,a>>>=2),1&a||t++,t},d.prototype.bitLength=function(){var e=this.words[this.length-1],a=this._countBits(e);return 26*(this.length-1)+a},d.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,a=0;ae.length?this.clone().ior(e):e.clone().ior(this)},d.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},d.prototype.iuand=function(e){var a;a=this.length>e.length?e:this;for(var t=0;te.length?this.clone().iand(e):e.clone().iand(this)},d.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},d.prototype.iuxor=function(e){var a,t;this.length>e.length?(a=this,t=e):(a=e,t=this);for(var c=0;ce.length?this.clone().ixor(e):e.clone().ixor(this)},d.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},d.prototype.inotn=function(e){c("number"==typeof e&&e>=0);var a=0|Math.ceil(e/26),t=e%26;this._expand(a),t>0&&a--;for(var f=0;f0&&(this.words[f]=~this.words[f]&67108863>>26-t),this.strip()},d.prototype.notn=function(e){return this.clone().inotn(e)},d.prototype.setn=function(e,a){c("number"==typeof e&&e>=0);var t=e/26|0,f=e%26;return this._expand(t+1),this.words[t]=a?this.words[t]|1<e.length?(t=this,c=e):(t=e,c=this);for(var f=0,d=0;d>>26;for(;0!==f&&d>>26;if(this.length=t.length,0!==f)this.words[this.length]=f,this.length++;else if(t!==this)for(;de.length?this.clone().iadd(e):e.clone().iadd(this)},d.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var a=this.iadd(e);return e.negative=1,a._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var t,c,f=this.cmp(e);if(0===f)return this.negative=0,this.length=1,this.words[0]=0,this;f>0?(t=this,c=e):(t=e,c=this);for(var d=0,r=0;r>26,this.words[r]=67108863&a;for(;0!==d&&r>26,this.words[r]=67108863&a;if(0===d&&r>>13,u=0|r[1],h=8191&u,p=u>>>13,g=0|r[2],m=8191&g,x=g>>>13,y=0|r[3],A=8191&y,v=y>>>13,w=0|r[4],_=8191&w,I=w>>>13,E=0|r[5],C=8191&E,M=E>>>13,B=0|r[6],k=8191&B,L=B>>>13,S=0|r[7],T=8191&S,N=S>>>13,R=0|r[8],P=8191&R,D=R>>>13,O=0|r[9],F=8191&O,Q=O>>>13,U=0|n[0],j=8191&U,H=U>>>13,q=0|n[1],$=8191&q,z=q>>>13,G=0|n[2],K=8191&G,V=G>>>13,Z=0|n[3],J=8191&Z,W=Z>>>13,Y=0|n[4],X=8191&Y,ee=Y>>>13,ae=0|n[5],te=8191&ae,ce=ae>>>13,fe=0|n[6],de=8191&fe,re=fe>>>13,ne=0|n[7],ie=8191&ne,be=ne>>>13,oe=0|n[8],se=8191&oe,le=oe>>>13,ue=0|n[9],he=8191&ue,pe=ue>>>13;t.negative=e.negative^a.negative,t.length=19;var ge=(b+(c=Math.imul(s,j))|0)+((8191&(f=(f=Math.imul(s,H))+Math.imul(l,j)|0))<<13)|0;b=((d=Math.imul(l,H))+(f>>>13)|0)+(ge>>>26)|0,ge&=67108863,c=Math.imul(h,j),f=(f=Math.imul(h,H))+Math.imul(p,j)|0,d=Math.imul(p,H);var me=(b+(c=c+Math.imul(s,$)|0)|0)+((8191&(f=(f=f+Math.imul(s,z)|0)+Math.imul(l,$)|0))<<13)|0;b=((d=d+Math.imul(l,z)|0)+(f>>>13)|0)+(me>>>26)|0,me&=67108863,c=Math.imul(m,j),f=(f=Math.imul(m,H))+Math.imul(x,j)|0,d=Math.imul(x,H),c=c+Math.imul(h,$)|0,f=(f=f+Math.imul(h,z)|0)+Math.imul(p,$)|0,d=d+Math.imul(p,z)|0;var xe=(b+(c=c+Math.imul(s,K)|0)|0)+((8191&(f=(f=f+Math.imul(s,V)|0)+Math.imul(l,K)|0))<<13)|0;b=((d=d+Math.imul(l,V)|0)+(f>>>13)|0)+(xe>>>26)|0,xe&=67108863,c=Math.imul(A,j),f=(f=Math.imul(A,H))+Math.imul(v,j)|0,d=Math.imul(v,H),c=c+Math.imul(m,$)|0,f=(f=f+Math.imul(m,z)|0)+Math.imul(x,$)|0,d=d+Math.imul(x,z)|0,c=c+Math.imul(h,K)|0,f=(f=f+Math.imul(h,V)|0)+Math.imul(p,K)|0,d=d+Math.imul(p,V)|0;var ye=(b+(c=c+Math.imul(s,J)|0)|0)+((8191&(f=(f=f+Math.imul(s,W)|0)+Math.imul(l,J)|0))<<13)|0;b=((d=d+Math.imul(l,W)|0)+(f>>>13)|0)+(ye>>>26)|0,ye&=67108863,c=Math.imul(_,j),f=(f=Math.imul(_,H))+Math.imul(I,j)|0,d=Math.imul(I,H),c=c+Math.imul(A,$)|0,f=(f=f+Math.imul(A,z)|0)+Math.imul(v,$)|0,d=d+Math.imul(v,z)|0,c=c+Math.imul(m,K)|0,f=(f=f+Math.imul(m,V)|0)+Math.imul(x,K)|0,d=d+Math.imul(x,V)|0,c=c+Math.imul(h,J)|0,f=(f=f+Math.imul(h,W)|0)+Math.imul(p,J)|0,d=d+Math.imul(p,W)|0;var Ae=(b+(c=c+Math.imul(s,X)|0)|0)+((8191&(f=(f=f+Math.imul(s,ee)|0)+Math.imul(l,X)|0))<<13)|0;b=((d=d+Math.imul(l,ee)|0)+(f>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,c=Math.imul(C,j),f=(f=Math.imul(C,H))+Math.imul(M,j)|0,d=Math.imul(M,H),c=c+Math.imul(_,$)|0,f=(f=f+Math.imul(_,z)|0)+Math.imul(I,$)|0,d=d+Math.imul(I,z)|0,c=c+Math.imul(A,K)|0,f=(f=f+Math.imul(A,V)|0)+Math.imul(v,K)|0,d=d+Math.imul(v,V)|0,c=c+Math.imul(m,J)|0,f=(f=f+Math.imul(m,W)|0)+Math.imul(x,J)|0,d=d+Math.imul(x,W)|0,c=c+Math.imul(h,X)|0,f=(f=f+Math.imul(h,ee)|0)+Math.imul(p,X)|0,d=d+Math.imul(p,ee)|0;var ve=(b+(c=c+Math.imul(s,te)|0)|0)+((8191&(f=(f=f+Math.imul(s,ce)|0)+Math.imul(l,te)|0))<<13)|0;b=((d=d+Math.imul(l,ce)|0)+(f>>>13)|0)+(ve>>>26)|0,ve&=67108863,c=Math.imul(k,j),f=(f=Math.imul(k,H))+Math.imul(L,j)|0,d=Math.imul(L,H),c=c+Math.imul(C,$)|0,f=(f=f+Math.imul(C,z)|0)+Math.imul(M,$)|0,d=d+Math.imul(M,z)|0,c=c+Math.imul(_,K)|0,f=(f=f+Math.imul(_,V)|0)+Math.imul(I,K)|0,d=d+Math.imul(I,V)|0,c=c+Math.imul(A,J)|0,f=(f=f+Math.imul(A,W)|0)+Math.imul(v,J)|0,d=d+Math.imul(v,W)|0,c=c+Math.imul(m,X)|0,f=(f=f+Math.imul(m,ee)|0)+Math.imul(x,X)|0,d=d+Math.imul(x,ee)|0,c=c+Math.imul(h,te)|0,f=(f=f+Math.imul(h,ce)|0)+Math.imul(p,te)|0,d=d+Math.imul(p,ce)|0;var we=(b+(c=c+Math.imul(s,de)|0)|0)+((8191&(f=(f=f+Math.imul(s,re)|0)+Math.imul(l,de)|0))<<13)|0;b=((d=d+Math.imul(l,re)|0)+(f>>>13)|0)+(we>>>26)|0,we&=67108863,c=Math.imul(T,j),f=(f=Math.imul(T,H))+Math.imul(N,j)|0,d=Math.imul(N,H),c=c+Math.imul(k,$)|0,f=(f=f+Math.imul(k,z)|0)+Math.imul(L,$)|0,d=d+Math.imul(L,z)|0,c=c+Math.imul(C,K)|0,f=(f=f+Math.imul(C,V)|0)+Math.imul(M,K)|0,d=d+Math.imul(M,V)|0,c=c+Math.imul(_,J)|0,f=(f=f+Math.imul(_,W)|0)+Math.imul(I,J)|0,d=d+Math.imul(I,W)|0,c=c+Math.imul(A,X)|0,f=(f=f+Math.imul(A,ee)|0)+Math.imul(v,X)|0,d=d+Math.imul(v,ee)|0,c=c+Math.imul(m,te)|0,f=(f=f+Math.imul(m,ce)|0)+Math.imul(x,te)|0,d=d+Math.imul(x,ce)|0,c=c+Math.imul(h,de)|0,f=(f=f+Math.imul(h,re)|0)+Math.imul(p,de)|0,d=d+Math.imul(p,re)|0;var _e=(b+(c=c+Math.imul(s,ie)|0)|0)+((8191&(f=(f=f+Math.imul(s,be)|0)+Math.imul(l,ie)|0))<<13)|0;b=((d=d+Math.imul(l,be)|0)+(f>>>13)|0)+(_e>>>26)|0,_e&=67108863,c=Math.imul(P,j),f=(f=Math.imul(P,H))+Math.imul(D,j)|0,d=Math.imul(D,H),c=c+Math.imul(T,$)|0,f=(f=f+Math.imul(T,z)|0)+Math.imul(N,$)|0,d=d+Math.imul(N,z)|0,c=c+Math.imul(k,K)|0,f=(f=f+Math.imul(k,V)|0)+Math.imul(L,K)|0,d=d+Math.imul(L,V)|0,c=c+Math.imul(C,J)|0,f=(f=f+Math.imul(C,W)|0)+Math.imul(M,J)|0,d=d+Math.imul(M,W)|0,c=c+Math.imul(_,X)|0,f=(f=f+Math.imul(_,ee)|0)+Math.imul(I,X)|0,d=d+Math.imul(I,ee)|0,c=c+Math.imul(A,te)|0,f=(f=f+Math.imul(A,ce)|0)+Math.imul(v,te)|0,d=d+Math.imul(v,ce)|0,c=c+Math.imul(m,de)|0,f=(f=f+Math.imul(m,re)|0)+Math.imul(x,de)|0,d=d+Math.imul(x,re)|0,c=c+Math.imul(h,ie)|0,f=(f=f+Math.imul(h,be)|0)+Math.imul(p,ie)|0,d=d+Math.imul(p,be)|0;var Ie=(b+(c=c+Math.imul(s,se)|0)|0)+((8191&(f=(f=f+Math.imul(s,le)|0)+Math.imul(l,se)|0))<<13)|0;b=((d=d+Math.imul(l,le)|0)+(f>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,c=Math.imul(F,j),f=(f=Math.imul(F,H))+Math.imul(Q,j)|0,d=Math.imul(Q,H),c=c+Math.imul(P,$)|0,f=(f=f+Math.imul(P,z)|0)+Math.imul(D,$)|0,d=d+Math.imul(D,z)|0,c=c+Math.imul(T,K)|0,f=(f=f+Math.imul(T,V)|0)+Math.imul(N,K)|0,d=d+Math.imul(N,V)|0,c=c+Math.imul(k,J)|0,f=(f=f+Math.imul(k,W)|0)+Math.imul(L,J)|0,d=d+Math.imul(L,W)|0,c=c+Math.imul(C,X)|0,f=(f=f+Math.imul(C,ee)|0)+Math.imul(M,X)|0,d=d+Math.imul(M,ee)|0,c=c+Math.imul(_,te)|0,f=(f=f+Math.imul(_,ce)|0)+Math.imul(I,te)|0,d=d+Math.imul(I,ce)|0,c=c+Math.imul(A,de)|0,f=(f=f+Math.imul(A,re)|0)+Math.imul(v,de)|0,d=d+Math.imul(v,re)|0,c=c+Math.imul(m,ie)|0,f=(f=f+Math.imul(m,be)|0)+Math.imul(x,ie)|0,d=d+Math.imul(x,be)|0,c=c+Math.imul(h,se)|0,f=(f=f+Math.imul(h,le)|0)+Math.imul(p,se)|0,d=d+Math.imul(p,le)|0;var Ee=(b+(c=c+Math.imul(s,he)|0)|0)+((8191&(f=(f=f+Math.imul(s,pe)|0)+Math.imul(l,he)|0))<<13)|0;b=((d=d+Math.imul(l,pe)|0)+(f>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,c=Math.imul(F,$),f=(f=Math.imul(F,z))+Math.imul(Q,$)|0,d=Math.imul(Q,z),c=c+Math.imul(P,K)|0,f=(f=f+Math.imul(P,V)|0)+Math.imul(D,K)|0,d=d+Math.imul(D,V)|0,c=c+Math.imul(T,J)|0,f=(f=f+Math.imul(T,W)|0)+Math.imul(N,J)|0,d=d+Math.imul(N,W)|0,c=c+Math.imul(k,X)|0,f=(f=f+Math.imul(k,ee)|0)+Math.imul(L,X)|0,d=d+Math.imul(L,ee)|0,c=c+Math.imul(C,te)|0,f=(f=f+Math.imul(C,ce)|0)+Math.imul(M,te)|0,d=d+Math.imul(M,ce)|0,c=c+Math.imul(_,de)|0,f=(f=f+Math.imul(_,re)|0)+Math.imul(I,de)|0,d=d+Math.imul(I,re)|0,c=c+Math.imul(A,ie)|0,f=(f=f+Math.imul(A,be)|0)+Math.imul(v,ie)|0,d=d+Math.imul(v,be)|0,c=c+Math.imul(m,se)|0,f=(f=f+Math.imul(m,le)|0)+Math.imul(x,se)|0,d=d+Math.imul(x,le)|0;var Ce=(b+(c=c+Math.imul(h,he)|0)|0)+((8191&(f=(f=f+Math.imul(h,pe)|0)+Math.imul(p,he)|0))<<13)|0;b=((d=d+Math.imul(p,pe)|0)+(f>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,c=Math.imul(F,K),f=(f=Math.imul(F,V))+Math.imul(Q,K)|0,d=Math.imul(Q,V),c=c+Math.imul(P,J)|0,f=(f=f+Math.imul(P,W)|0)+Math.imul(D,J)|0,d=d+Math.imul(D,W)|0,c=c+Math.imul(T,X)|0,f=(f=f+Math.imul(T,ee)|0)+Math.imul(N,X)|0,d=d+Math.imul(N,ee)|0,c=c+Math.imul(k,te)|0,f=(f=f+Math.imul(k,ce)|0)+Math.imul(L,te)|0,d=d+Math.imul(L,ce)|0,c=c+Math.imul(C,de)|0,f=(f=f+Math.imul(C,re)|0)+Math.imul(M,de)|0,d=d+Math.imul(M,re)|0,c=c+Math.imul(_,ie)|0,f=(f=f+Math.imul(_,be)|0)+Math.imul(I,ie)|0,d=d+Math.imul(I,be)|0,c=c+Math.imul(A,se)|0,f=(f=f+Math.imul(A,le)|0)+Math.imul(v,se)|0,d=d+Math.imul(v,le)|0;var Me=(b+(c=c+Math.imul(m,he)|0)|0)+((8191&(f=(f=f+Math.imul(m,pe)|0)+Math.imul(x,he)|0))<<13)|0;b=((d=d+Math.imul(x,pe)|0)+(f>>>13)|0)+(Me>>>26)|0,Me&=67108863,c=Math.imul(F,J),f=(f=Math.imul(F,W))+Math.imul(Q,J)|0,d=Math.imul(Q,W),c=c+Math.imul(P,X)|0,f=(f=f+Math.imul(P,ee)|0)+Math.imul(D,X)|0,d=d+Math.imul(D,ee)|0,c=c+Math.imul(T,te)|0,f=(f=f+Math.imul(T,ce)|0)+Math.imul(N,te)|0,d=d+Math.imul(N,ce)|0,c=c+Math.imul(k,de)|0,f=(f=f+Math.imul(k,re)|0)+Math.imul(L,de)|0,d=d+Math.imul(L,re)|0,c=c+Math.imul(C,ie)|0,f=(f=f+Math.imul(C,be)|0)+Math.imul(M,ie)|0,d=d+Math.imul(M,be)|0,c=c+Math.imul(_,se)|0,f=(f=f+Math.imul(_,le)|0)+Math.imul(I,se)|0,d=d+Math.imul(I,le)|0;var Be=(b+(c=c+Math.imul(A,he)|0)|0)+((8191&(f=(f=f+Math.imul(A,pe)|0)+Math.imul(v,he)|0))<<13)|0;b=((d=d+Math.imul(v,pe)|0)+(f>>>13)|0)+(Be>>>26)|0,Be&=67108863,c=Math.imul(F,X),f=(f=Math.imul(F,ee))+Math.imul(Q,X)|0,d=Math.imul(Q,ee),c=c+Math.imul(P,te)|0,f=(f=f+Math.imul(P,ce)|0)+Math.imul(D,te)|0,d=d+Math.imul(D,ce)|0,c=c+Math.imul(T,de)|0,f=(f=f+Math.imul(T,re)|0)+Math.imul(N,de)|0,d=d+Math.imul(N,re)|0,c=c+Math.imul(k,ie)|0,f=(f=f+Math.imul(k,be)|0)+Math.imul(L,ie)|0,d=d+Math.imul(L,be)|0,c=c+Math.imul(C,se)|0,f=(f=f+Math.imul(C,le)|0)+Math.imul(M,se)|0,d=d+Math.imul(M,le)|0;var ke=(b+(c=c+Math.imul(_,he)|0)|0)+((8191&(f=(f=f+Math.imul(_,pe)|0)+Math.imul(I,he)|0))<<13)|0;b=((d=d+Math.imul(I,pe)|0)+(f>>>13)|0)+(ke>>>26)|0,ke&=67108863,c=Math.imul(F,te),f=(f=Math.imul(F,ce))+Math.imul(Q,te)|0,d=Math.imul(Q,ce),c=c+Math.imul(P,de)|0,f=(f=f+Math.imul(P,re)|0)+Math.imul(D,de)|0,d=d+Math.imul(D,re)|0,c=c+Math.imul(T,ie)|0,f=(f=f+Math.imul(T,be)|0)+Math.imul(N,ie)|0,d=d+Math.imul(N,be)|0,c=c+Math.imul(k,se)|0,f=(f=f+Math.imul(k,le)|0)+Math.imul(L,se)|0,d=d+Math.imul(L,le)|0;var Le=(b+(c=c+Math.imul(C,he)|0)|0)+((8191&(f=(f=f+Math.imul(C,pe)|0)+Math.imul(M,he)|0))<<13)|0;b=((d=d+Math.imul(M,pe)|0)+(f>>>13)|0)+(Le>>>26)|0,Le&=67108863,c=Math.imul(F,de),f=(f=Math.imul(F,re))+Math.imul(Q,de)|0,d=Math.imul(Q,re),c=c+Math.imul(P,ie)|0,f=(f=f+Math.imul(P,be)|0)+Math.imul(D,ie)|0,d=d+Math.imul(D,be)|0,c=c+Math.imul(T,se)|0,f=(f=f+Math.imul(T,le)|0)+Math.imul(N,se)|0,d=d+Math.imul(N,le)|0;var Se=(b+(c=c+Math.imul(k,he)|0)|0)+((8191&(f=(f=f+Math.imul(k,pe)|0)+Math.imul(L,he)|0))<<13)|0;b=((d=d+Math.imul(L,pe)|0)+(f>>>13)|0)+(Se>>>26)|0,Se&=67108863,c=Math.imul(F,ie),f=(f=Math.imul(F,be))+Math.imul(Q,ie)|0,d=Math.imul(Q,be),c=c+Math.imul(P,se)|0,f=(f=f+Math.imul(P,le)|0)+Math.imul(D,se)|0,d=d+Math.imul(D,le)|0;var Te=(b+(c=c+Math.imul(T,he)|0)|0)+((8191&(f=(f=f+Math.imul(T,pe)|0)+Math.imul(N,he)|0))<<13)|0;b=((d=d+Math.imul(N,pe)|0)+(f>>>13)|0)+(Te>>>26)|0,Te&=67108863,c=Math.imul(F,se),f=(f=Math.imul(F,le))+Math.imul(Q,se)|0,d=Math.imul(Q,le);var Ne=(b+(c=c+Math.imul(P,he)|0)|0)+((8191&(f=(f=f+Math.imul(P,pe)|0)+Math.imul(D,he)|0))<<13)|0;b=((d=d+Math.imul(D,pe)|0)+(f>>>13)|0)+(Ne>>>26)|0,Ne&=67108863;var Re=(b+(c=Math.imul(F,he))|0)+((8191&(f=(f=Math.imul(F,pe))+Math.imul(Q,he)|0))<<13)|0;return b=((d=Math.imul(Q,pe))+(f>>>13)|0)+(Re>>>26)|0,Re&=67108863,i[0]=ge,i[1]=me,i[2]=xe,i[3]=ye,i[4]=Ae,i[5]=ve,i[6]=we,i[7]=_e,i[8]=Ie,i[9]=Ee,i[10]=Ce,i[11]=Me,i[12]=Be,i[13]=ke,i[14]=Le,i[15]=Se,i[16]=Te,i[17]=Ne,i[18]=Re,0!==b&&(i[19]=b,t.length++),t};function p(e,a,t){return(new g).mulp(e,a,t)}function g(e,a){this.x=e,this.y=a}Math.imul||(h=u),d.prototype.mulTo=function(e,a){var t,c=this.length+e.length;return t=10===this.length&&10===e.length?h(this,e,a):c<63?u(this,e,a):c<1024?function(e,a,t){t.negative=a.negative^e.negative,t.length=e.length+a.length;for(var c=0,f=0,d=0;d>>26)|0)>>>26,r&=67108863}t.words[d]=n,c=r,r=f}return 0!==c?t.words[d]=c:t.length--,t.strip()}(this,e,a):p(this,e,a),t},g.prototype.makeRBT=function(e){for(var a=new Array(e),t=d.prototype._countBits(e)-1,c=0;c>=1;return c},g.prototype.permute=function(e,a,t,c,f,d){for(var r=0;r>>=1)f++;return 1<>>=13,t[2*r+1]=8191&d,d>>>=13;for(r=2*a;r>=26,a+=f/67108864|0,a+=d>>>26,this.words[t]=67108863&d}return 0!==a&&(this.words[t]=a,this.length++),this},d.prototype.muln=function(e){return this.clone().imuln(e)},d.prototype.sqr=function(){return this.mul(this)},d.prototype.isqr=function(){return this.imul(this.clone())},d.prototype.pow=function(e){var a=function(e){for(var a=new Array(e.bitLength()),t=0;t>>f}return a}(e);if(0===a.length)return new d(1);for(var t=this,c=0;c=0);var a,t=e%26,f=(e-t)/26,d=67108863>>>26-t<<26-t;if(0!==t){var r=0;for(a=0;a>>26-t}r&&(this.words[a]=r,this.length++)}if(0!==f){for(a=this.length-1;a>=0;a--)this.words[a+f]=this.words[a];for(a=0;a=0),f=a?(a-a%26)/26:0;var d=e%26,r=Math.min((e-d)/26,this.length),n=67108863^67108863>>>d<r)for(this.length-=r,b=0;b=0&&(0!==o||b>=f);b--){var s=0|this.words[b];this.words[b]=o<<26-d|s>>>d,o=s&n}return i&&0!==o&&(i.words[i.length++]=o),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},d.prototype.ishrn=function(e,a,t){return c(0===this.negative),this.iushrn(e,a,t)},d.prototype.shln=function(e){return this.clone().ishln(e)},d.prototype.ushln=function(e){return this.clone().iushln(e)},d.prototype.shrn=function(e){return this.clone().ishrn(e)},d.prototype.ushrn=function(e){return this.clone().iushrn(e)},d.prototype.testn=function(e){c("number"==typeof e&&e>=0);var a=e%26,t=(e-a)/26,f=1<=0);var a=e%26,t=(e-a)/26;if(c(0===this.negative,"imaskn works only with positive numbers"),this.length<=t)return this;if(0!==a&&t++,this.length=Math.min(t,this.length),0!==a){var f=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},d.prototype.isubn=function(e){if(c("number"==typeof e),c(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(i/67108864|0),this.words[f+t]=67108863&d}for(;f>26,this.words[f+t]=67108863&d;if(0===n)return this.strip();for(c(-1===n),n=0,f=0;f>26,this.words[f]=67108863&d;return this.negative=1,this.strip()},d.prototype._wordDiv=function(e,a){var t=(this.length,e.length),c=this.clone(),f=e,r=0|f.words[f.length-1];0!=(t=26-this._countBits(r))&&(f=f.ushln(t),c.iushln(t),r=0|f.words[f.length-1]);var n,i=c.length-f.length;if("mod"!==a){(n=new d(null)).length=i+1,n.words=new Array(n.length);for(var b=0;b=0;s--){var l=67108864*(0|c.words[f.length+s])+(0|c.words[f.length+s-1]);for(l=Math.min(l/r|0,67108863),c._ishlnsubmul(f,l,s);0!==c.negative;)l--,c.negative=0,c._ishlnsubmul(f,1,s),c.isZero()||(c.negative^=1);n&&(n.words[s]=l)}return n&&n.strip(),c.strip(),"div"!==a&&0!==t&&c.iushrn(t),{div:n||null,mod:c}},d.prototype.divmod=function(e,a,t){return c(!e.isZero()),this.isZero()?{div:new d(0),mod:new d(0)}:0!==this.negative&&0===e.negative?(n=this.neg().divmod(e,a),"mod"!==a&&(f=n.div.neg()),"div"!==a&&(r=n.mod.neg(),t&&0!==r.negative&&r.iadd(e)),{div:f,mod:r}):0===this.negative&&0!==e.negative?(n=this.divmod(e.neg(),a),"mod"!==a&&(f=n.div.neg()),{div:f,mod:n.mod}):this.negative&e.negative?(n=this.neg().divmod(e.neg(),a),"div"!==a&&(r=n.mod.neg(),t&&0!==r.negative&&r.isub(e)),{div:n.div,mod:r}):e.length>this.length||this.cmp(e)<0?{div:new d(0),mod:this}:1===e.length?"div"===a?{div:this.divn(e.words[0]),mod:null}:"mod"===a?{div:null,mod:new d(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new d(this.modn(e.words[0]))}:this._wordDiv(e,a);var f,r,n},d.prototype.div=function(e){return this.divmod(e,"div",!1).div},d.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},d.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},d.prototype.divRound=function(e){var a=this.divmod(e);if(a.mod.isZero())return a.div;var t=0!==a.div.negative?a.mod.isub(e):a.mod,c=e.ushrn(1),f=e.andln(1),d=t.cmp(c);return d<0||1===f&&0===d?a.div:0!==a.div.negative?a.div.isubn(1):a.div.iaddn(1)},d.prototype.modn=function(e){c(e<=67108863);for(var a=(1<<26)%e,t=0,f=this.length-1;f>=0;f--)t=(a*t+(0|this.words[f]))%e;return t},d.prototype.idivn=function(e){c(e<=67108863);for(var a=0,t=this.length-1;t>=0;t--){var f=(0|this.words[t])+67108864*a;this.words[t]=f/e|0,a=f%e}return this.strip()},d.prototype.divn=function(e){return this.clone().idivn(e)},d.prototype.egcd=function(e){c(0===e.negative),c(!e.isZero());var a=this,t=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var f=new d(1),r=new d(0),n=new d(0),i=new d(1),b=0;a.isEven()&&t.isEven();)a.iushrn(1),t.iushrn(1),++b;for(var o=t.clone(),s=a.clone();!a.isZero();){for(var l=0,u=1;!(a.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(a.iushrn(l);l-- >0;)(f.isOdd()||r.isOdd())&&(f.iadd(o),r.isub(s)),f.iushrn(1),r.iushrn(1);for(var h=0,p=1;!(t.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(n.isOdd()||i.isOdd())&&(n.iadd(o),i.isub(s)),n.iushrn(1),i.iushrn(1);a.cmp(t)>=0?(a.isub(t),f.isub(n),r.isub(i)):(t.isub(a),n.isub(f),i.isub(r))}return{a:n,b:i,gcd:t.iushln(b)}},d.prototype._invmp=function(e){c(0===e.negative),c(!e.isZero());var a=this,t=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var f,r=new d(1),n=new d(0),i=t.clone();a.cmpn(1)>0&&t.cmpn(1)>0;){for(var b=0,o=1;!(a.words[0]&o)&&b<26;++b,o<<=1);if(b>0)for(a.iushrn(b);b-- >0;)r.isOdd()&&r.iadd(i),r.iushrn(1);for(var s=0,l=1;!(t.words[0]&l)&&s<26;++s,l<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(i),n.iushrn(1);a.cmp(t)>=0?(a.isub(t),r.isub(n)):(t.isub(a),n.isub(r))}return(f=0===a.cmpn(1)?r:n).cmpn(0)<0&&f.iadd(e),f},d.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var a=this.clone(),t=e.clone();a.negative=0,t.negative=0;for(var c=0;a.isEven()&&t.isEven();c++)a.iushrn(1),t.iushrn(1);for(;;){for(;a.isEven();)a.iushrn(1);for(;t.isEven();)t.iushrn(1);var f=a.cmp(t);if(f<0){var d=a;a=t,t=d}else if(0===f||0===t.cmpn(1))break;a.isub(t)}return t.iushln(c)},d.prototype.invm=function(e){return this.egcd(e).a.umod(e)},d.prototype.isEven=function(){return!(1&this.words[0])},d.prototype.isOdd=function(){return!(1&~this.words[0])},d.prototype.andln=function(e){return this.words[0]&e},d.prototype.bincn=function(e){c("number"==typeof e);var a=e%26,t=(e-a)/26,f=1<>>26,n&=67108863,this.words[r]=n}return 0!==d&&(this.words[r]=d,this.length++),this},d.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},d.prototype.cmpn=function(e){var a,t=e<0;if(0!==this.negative&&!t)return-1;if(0===this.negative&&t)return 1;if(this.strip(),this.length>1)a=1;else{t&&(e=-e),c(e<=67108863,"Number is too big");var f=0|this.words[0];a=f===e?0:fe.length)return 1;if(this.length=0;t--){var c=0|this.words[t],f=0|e.words[t];if(c!==f){cf&&(a=1);break}}return a},d.prototype.gtn=function(e){return 1===this.cmpn(e)},d.prototype.gt=function(e){return 1===this.cmp(e)},d.prototype.gten=function(e){return this.cmpn(e)>=0},d.prototype.gte=function(e){return this.cmp(e)>=0},d.prototype.ltn=function(e){return-1===this.cmpn(e)},d.prototype.lt=function(e){return-1===this.cmp(e)},d.prototype.lten=function(e){return this.cmpn(e)<=0},d.prototype.lte=function(e){return this.cmp(e)<=0},d.prototype.eqn=function(e){return 0===this.cmpn(e)},d.prototype.eq=function(e){return 0===this.cmp(e)},d.red=function(e){return new _(e)},d.prototype.toRed=function(e){return c(!this.red,"Already a number in reduction context"),c(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},d.prototype.fromRed=function(){return c(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},d.prototype._forceRed=function(e){return this.red=e,this},d.prototype.forceRed=function(e){return c(!this.red,"Already a number in reduction context"),this._forceRed(e)},d.prototype.redAdd=function(e){return c(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},d.prototype.redIAdd=function(e){return c(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},d.prototype.redSub=function(e){return c(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},d.prototype.redISub=function(e){return c(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},d.prototype.redShl=function(e){return c(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},d.prototype.redMul=function(e){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},d.prototype.redIMul=function(e){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},d.prototype.redSqr=function(){return c(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},d.prototype.redISqr=function(){return c(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},d.prototype.redSqrt=function(){return c(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},d.prototype.redInvm=function(){return c(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},d.prototype.redNeg=function(){return c(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},d.prototype.redPow=function(e){return c(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var m={k256:null,p224:null,p192:null,p25519:null};function x(e,a){this.name=e,this.p=new d(a,16),this.n=this.p.bitLength(),this.k=new d(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){x.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){x.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){x.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){x.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"==typeof e){var a=d._prime(e);this.m=a.p,this.prime=a}else c(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function I(e){_.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new d(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)}x.prototype._tmp=function(){var e=new d(null);return e.words=new Array(Math.ceil(this.n/13)),e},x.prototype.ireduce=function(e){var a,t=e;do{this.split(t,this.tmp),a=(t=(t=this.imulK(t)).iadd(this.tmp)).bitLength()}while(a>this.n);var c=a0?t.isub(this.p):void 0!==t.strip?t.strip():t._strip(),t},x.prototype.split=function(e,a){e.iushrn(this.n,0,a)},x.prototype.imulK=function(e){return e.imul(this.k)},f(y,x),y.prototype.split=function(e,a){for(var t=4194303,c=Math.min(e.length,9),f=0;f>>22,d=r}d>>>=22,e.words[f-10]=d,0===d&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var a=0,t=0;t>>=26,e.words[t]=f,a=c}return 0!==a&&(e.words[e.length++]=a),e},d._prime=function(e){if(m[e])return m[e];var a;if("k256"===e)a=new y;else if("p224"===e)a=new A;else if("p192"===e)a=new v;else{if("p25519"!==e)throw new Error("Unknown prime "+e);a=new w}return m[e]=a,a},_.prototype._verify1=function(e){c(0===e.negative,"red works only with positives"),c(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,a){c(!(e.negative|a.negative),"red works only with positives"),c(e.red&&e.red===a.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,a){this._verify2(e,a);var t=e.add(a);return t.cmp(this.m)>=0&&t.isub(this.m),t._forceRed(this)},_.prototype.iadd=function(e,a){this._verify2(e,a);var t=e.iadd(a);return t.cmp(this.m)>=0&&t.isub(this.m),t},_.prototype.sub=function(e,a){this._verify2(e,a);var t=e.sub(a);return t.cmpn(0)<0&&t.iadd(this.m),t._forceRed(this)},_.prototype.isub=function(e,a){this._verify2(e,a);var t=e.isub(a);return t.cmpn(0)<0&&t.iadd(this.m),t},_.prototype.shl=function(e,a){return this._verify1(e),this.imod(e.ushln(a))},_.prototype.imul=function(e,a){return this._verify2(e,a),this.imod(e.imul(a))},_.prototype.mul=function(e,a){return this._verify2(e,a),this.imod(e.mul(a))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var a=this.m.andln(3);if(c(a%2==1),3===a){var t=this.m.add(new d(1)).iushrn(2);return this.pow(e,t)}for(var f=this.m.subn(1),r=0;!f.isZero()&&0===f.andln(1);)r++,f.iushrn(1);c(!f.isZero());var n=new d(1).toRed(this),i=n.redNeg(),b=this.m.subn(1).iushrn(1),o=this.m.bitLength();for(o=new d(2*o*o).toRed(this);0!==this.pow(o,b).cmp(i);)o.redIAdd(i);for(var s=this.pow(o,f),l=this.pow(e,f.addn(1).iushrn(1)),u=this.pow(e,f),h=r;0!==u.cmp(n);){for(var p=u,g=0;0!==p.cmp(n);g++)p=p.redSqr();c(g=0;c--){for(var b=a.words[c],o=i-1;o>=0;o--){var s=b>>o&1;f!==t[0]&&(f=this.sqr(f)),0!==s||0!==r?(r<<=1,r|=s,(4==++n||0===c&&0===o)&&(f=this.mul(f,t[r]),n=0,r=0)):n=0}i=26}return f},_.prototype.convertTo=function(e){var a=e.umod(this.m);return a===e?a.clone():a},_.prototype.convertFrom=function(e){var a=e.clone();return a.red=null,a},d.mont=function(e){return new I(e)},f(I,_),I.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},I.prototype.convertFrom=function(e){var a=this.imod(e.mul(this.rinv));return a.red=null,a},I.prototype.imul=function(e,a){if(e.isZero()||a.isZero())return e.words[0]=0,e.length=1,e;var t=e.imul(a),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=t.isub(c).iushrn(this.shift),d=f;return f.cmp(this.m)>=0?d=f.isub(this.m):f.cmpn(0)<0&&(d=f.iadd(this.m)),d._forceRed(this)},I.prototype.mul=function(e,a){if(e.isZero()||a.isZero())return new d(0)._forceRed(this);var t=e.mul(a),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=t.isub(c).iushrn(this.shift),r=f;return f.cmp(this.m)>=0?r=f.isub(this.m):f.cmpn(0)<0&&(r=f.iadd(this.m)),r._forceRed(this)},I.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=t.nmd(e),this)},94148:(e,a,t)=>{"use strict";function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function f(e,a){for(var t=0;t1?t-1:0),f=1;f1?t-1:0),f=1;f1?t-1:0),f=1;f1?t-1:0),f=1;f{"use strict";function c(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);a&&(c=c.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,c)}return t}function f(e){for(var a=1;ae.length)&&(t=e.length),e.substring(t-a.length,t)===a}var x="",y="",A="",v="",w={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:"};function _(e){var a=Object.keys(e),t=Object.create(Object.getPrototypeOf(e));return a.forEach((function(a){t[a]=e[a]})),Object.defineProperty(t,"message",{value:e.message}),t}function I(e){return p(e,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}var E=function(e,a){!function(e,a){if("function"!=typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(a&&a.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),a&&l(e,a)}(E,e);var t,c,r,b,o=(t=E,c=s(),function(){var e,a=u(t);if(c){var f=u(this).constructor;e=Reflect.construct(a,arguments,f)}else e=a.apply(this,arguments);return n(this,e)});function E(e){var a;if(function(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}(this,E),"object"!==h(e)||null===e)throw new g("options","Object",e);var t=e.message,c=e.operator,f=e.stackStartFn,d=e.actual,r=e.expected,b=Error.stackTraceLimit;if(Error.stackTraceLimit=0,null!=t)a=o.call(this,String(t));else if(process.stderr&&process.stderr.isTTY&&(process.stderr&&process.stderr.getColorDepth&&1!==process.stderr.getColorDepth()?(x="",y="",v="",A=""):(x="",y="",v="",A="")),"object"===h(d)&&null!==d&&"object"===h(r)&&null!==r&&"stack"in d&&d instanceof Error&&"stack"in r&&r instanceof Error&&(d=_(d),r=_(r)),"deepStrictEqual"===c||"strictEqual"===c)a=o.call(this,function(e,a,t){var c="",f="",d=0,r="",n=!1,i=I(e),b=i.split("\n"),o=I(a).split("\n"),s=0,l="";if("strictEqual"===t&&"object"===h(e)&&"object"===h(a)&&null!==e&&null!==a&&(t="strictEqualObject"),1===b.length&&1===o.length&&b[0]!==o[0]){var u=b[0].length+o[0].length;if(u<=10){if(!("object"===h(e)&&null!==e||"object"===h(a)&&null!==a||0===e&&0===a))return"".concat(w[t],"\n\n")+"".concat(b[0]," !== ").concat(o[0],"\n")}else if("strictEqualObject"!==t&&u<(process.stderr&&process.stderr.isTTY?process.stderr.columns:80)){for(;b[0][s]===o[0][s];)s++;s>2&&(l="\n ".concat(function(e,a){if(a=Math.floor(a),0==e.length||0==a)return"";var t=e.length*a;for(a=Math.floor(Math.log(a)/Math.log(2));a;)e+=e,a--;return e+e.substring(0,t-e.length)}(" ",s),"^"),s=0)}}for(var p=b[b.length-1],g=o[o.length-1];p===g&&(s++<2?r="\n ".concat(p).concat(r):c=p,b.pop(),o.pop(),0!==b.length&&0!==o.length);)p=b[b.length-1],g=o[o.length-1];var _=Math.max(b.length,o.length);if(0===_){var E=i.split("\n");if(E.length>30)for(E[26]="".concat(x,"...").concat(v);E.length>27;)E.pop();return"".concat(w.notIdentical,"\n\n").concat(E.join("\n"),"\n")}s>3&&(r="\n".concat(x,"...").concat(v).concat(r),n=!0),""!==c&&(r="\n ".concat(c).concat(r),c="");var C=0,M=w[t]+"\n".concat(y,"+ actual").concat(v," ").concat(A,"- expected").concat(v),B=" ".concat(x,"...").concat(v," Lines skipped");for(s=0;s<_;s++){var k=s-d;if(b.length1&&s>2&&(k>4?(f+="\n".concat(x,"...").concat(v),n=!0):k>3&&(f+="\n ".concat(o[s-2]),C++),f+="\n ".concat(o[s-1]),C++),d=s,c+="\n".concat(A,"-").concat(v," ").concat(o[s]),C++;else if(o.length1&&s>2&&(k>4?(f+="\n".concat(x,"...").concat(v),n=!0):k>3&&(f+="\n ".concat(b[s-2]),C++),f+="\n ".concat(b[s-1]),C++),d=s,f+="\n".concat(y,"+").concat(v," ").concat(b[s]),C++;else{var L=o[s],S=b[s],T=S!==L&&(!m(S,",")||S.slice(0,-1)!==L);T&&m(L,",")&&L.slice(0,-1)===S&&(T=!1,S+=","),T?(k>1&&s>2&&(k>4?(f+="\n".concat(x,"...").concat(v),n=!0):k>3&&(f+="\n ".concat(b[s-2]),C++),f+="\n ".concat(b[s-1]),C++),d=s,f+="\n".concat(y,"+").concat(v," ").concat(S),c+="\n".concat(A,"-").concat(v," ").concat(L),C+=2):(f+=c,c="",1!==k&&0!==s||(f+="\n ".concat(S),C++))}if(C>20&&s<_-2)return"".concat(M).concat(B,"\n").concat(f,"\n").concat(x,"...").concat(v).concat(c,"\n")+"".concat(x,"...").concat(v)}return"".concat(M).concat(n?B:"","\n").concat(f).concat(c).concat(r).concat(l)}(d,r,c));else if("notDeepStrictEqual"===c||"notStrictEqual"===c){var s=w[c],l=I(d).split("\n");if("notStrictEqual"===c&&"object"===h(d)&&null!==d&&(s=w.notStrictEqualObject),l.length>30)for(l[26]="".concat(x,"...").concat(v);l.length>27;)l.pop();a=1===l.length?o.call(this,"".concat(s," ").concat(l[0])):o.call(this,"".concat(s,"\n\n").concat(l.join("\n"),"\n"))}else{var u=I(d),p="",C=w[c];"notDeepEqual"===c||"notEqual"===c?(u="".concat(w[c],"\n\n").concat(u)).length>1024&&(u="".concat(u.slice(0,1021),"...")):(p="".concat(I(r)),u.length>512&&(u="".concat(u.slice(0,509),"...")),p.length>512&&(p="".concat(p.slice(0,509),"...")),"deepEqual"===c||"equal"===c?u="".concat(C,"\n\n").concat(u,"\n\nshould equal\n\n"):p=" ".concat(c," ").concat(p)),a=o.call(this,"".concat(u).concat(p))}return Error.stackTraceLimit=b,a.generatedMessage=!t,Object.defineProperty(i(a),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),a.code="ERR_ASSERTION",a.actual=d,a.expected=r,a.operator=c,Error.captureStackTrace&&Error.captureStackTrace(i(a),f),a.stack,a.name="AssertionError",n(a)}return r=E,(b=[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:a,value:function(e,a){return p(this,f(f({},a),{},{customInspect:!1,depth:0}))}}])&&d(r.prototype,b),Object.defineProperty(r,"prototype",{writable:!1}),E}(b(Error),p.custom);e.exports=E},69597:(e,a,t)=>{"use strict";function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function f(e,a){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,a){return e.__proto__=a,e},f(e,a)}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}var r,n,i={};function b(e,a,t){t||(t=Error);var r=function(t){!function(e,a){if("function"!=typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(a&&a.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),a&&f(e,a)}(o,t);var r,n,i,b=(n=o,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=d(n);if(i){var t=d(this).constructor;e=Reflect.construct(a,arguments,t)}else e=a.apply(this,arguments);return function(e,a){if(a&&("object"===c(a)||"function"==typeof a))return a;if(void 0!==a)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function o(t,c,f){var d;return function(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}(this,o),d=b.call(this,function(e,t,c){return"string"==typeof a?a:a(e,t,c)}(t,c,f)),d.code=e,d}return r=o,Object.defineProperty(r,"prototype",{writable:!1}),r}(t);i[e]=r}function o(e,a){if(Array.isArray(e)){var t=e.length;return e=e.map((function(e){return String(e)})),t>2?"one of ".concat(a," ").concat(e.slice(0,t-1).join(", "),", or ")+e[t-1]:2===t?"one of ".concat(a," ").concat(e[0]," or ").concat(e[1]):"of ".concat(a," ").concat(e[0])}return"of ".concat(a," ").concat(String(e))}b("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),b("ERR_INVALID_ARG_TYPE",(function(e,a,f){var d,n,i,b,s;if(void 0===r&&(r=t(94148)),r("string"==typeof e,"'name' must be a string"),"string"==typeof a&&(n="not ",a.substr(0,4)===n)?(d="must not be",a=a.replace(/^not /,"")):d="must be",function(e,a,t){return(void 0===t||t>e.length)&&(t=e.length),e.substring(t-9,t)===a}(e," argument"))i="The ".concat(e," ").concat(d," ").concat(o(a,"type"));else{var l=("number"!=typeof s&&(s=0),s+1>(b=e).length||-1===b.indexOf(".",s)?"argument":"property");i='The "'.concat(e,'" ').concat(l," ").concat(d," ").concat(o(a,"type"))}return i+". Received type ".concat(c(f))}),TypeError),b("ERR_INVALID_ARG_VALUE",(function(e,a){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"is invalid";void 0===n&&(n=t(40537));var f=n.inspect(a);return f.length>128&&(f="".concat(f.slice(0,128),"...")),"The argument '".concat(e,"' ").concat(c,". Received ").concat(f)}),TypeError,RangeError),b("ERR_INVALID_RETURN_VALUE",(function(e,a,t){var f;return f=t&&t.constructor&&t.constructor.name?"instance of ".concat(t.constructor.name):"type ".concat(c(t)),"Expected ".concat(e,' to be returned from the "').concat(a,'"')+" function but got ".concat(f,".")}),TypeError),b("ERR_MISSING_ARGS",(function(){for(var e=arguments.length,a=new Array(e),c=0;c0,"At least one arg needs to be specified");var f="The ",d=a.length;switch(a=a.map((function(e){return'"'.concat(e,'"')})),d){case 1:f+="".concat(a[0]," argument");break;case 2:f+="".concat(a[0]," and ").concat(a[1]," arguments");break;default:f+=a.slice(0,d-1).join(", "),f+=", and ".concat(a[d-1]," arguments")}return"".concat(f," must be specified")}),TypeError),e.exports.codes=i},82299:(e,a,t)=>{"use strict";function c(e,a){return function(e){if(Array.isArray(e))return e}(e)||function(e,a){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var c,f,d,r,n=[],i=!0,b=!1;try{if(d=(t=t.call(e)).next,0===a){if(Object(t)!==t)return;i=!1}else for(;!(i=(c=d.call(t)).done)&&(n.push(c.value),n.length!==a);i=!0);}catch(e){b=!0,f=e}finally{try{if(!i&&null!=t.return&&(r=t.return(),Object(r)!==r))return}finally{if(b)throw f}}return n}}(e,a)||function(e,a){if(e){if("string"==typeof e)return f(e,a);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?f(e,a):void 0}}(e,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,a){(null==a||a>e.length)&&(a=e.length);for(var t=0,c=new Array(a);t10)return!0;for(var a=0;a57)return!0}return 10===e.length&&e>=Math.pow(2,32)}function N(e){return Object.keys(e).filter(T).concat(o(e).filter(Object.prototype.propertyIsEnumerable.bind(e)))}function R(e,a){if(e===a)return 0;for(var t=e.length,c=a.length,f=0,d=Math.min(t,c);f{const c=t(36209),f=t(10943),d=t(51847),r=t(86679),n=t(65435),i=255===new Uint8Array(Uint16Array.of(255).buffer)[0];function b(e){switch(e){case"ascii":return c;case"base64":return f;case"hex":return d;case"utf8":case"utf-8":case void 0:return r;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n;default:throw new Error(`Unknown encoding: ${e}`)}}function o(e){return e instanceof Uint8Array}function s(e,a,t){return"string"==typeof e?function(e,a){const t=b(a),c=new Uint8Array(t.byteLength(e));return t.write(c,e,0,c.byteLength),c}(e,a):Array.isArray(e)?function(e){const a=new Uint8Array(e.length);return a.set(e),a}(e):ArrayBuffer.isView(e)?function(e){const a=new Uint8Array(e.byteLength);return a.set(e),a}(e):function(e,a,t){return new Uint8Array(e,a,t)}(e,a,t)}function l(e,a,t,c,f){if(0===e.byteLength)return-1;if("string"==typeof t?(c=t,t=0):void 0===t?t=f?0:e.length-1:t<0&&(t+=e.byteLength),t>=e.byteLength){if(f)return-1;t=e.byteLength-1}else if(t<0){if(!f)return-1;t=0}if("string"==typeof a)a=s(a,c);else if("number"==typeof a)return a&=255,f?e.indexOf(a,t):e.lastIndexOf(a,t);if(0===a.byteLength)return-1;if(f){let c=-1;for(let f=t;fe.byteLength&&(t=e.byteLength-a.byteLength);for(let c=t;c>=0;c--){let t=!0;for(let f=0;ff)return 1}return e.byteLength>a.byteLength?1:e.byteLengthe+a.byteLength),0));const t=new Uint8Array(a);let c=0;for(const a of e){if(c+a.byteLength>t.byteLength){const e=a.subarray(0,t.byteLength-c);return t.set(e,c),t}t.set(a,c),c+=a.byteLength}return t},copy:function(e,a,t=0,c=0,f=e.byteLength){if(f>0&&f=e.byteLength)throw new RangeError("sourceStart is out of range");if(f<0)throw new RangeError("sourceEnd is out of range");t>=a.byteLength&&(t=a.byteLength),f>e.byteLength&&(f=e.byteLength),a.byteLength-t=f||c<=t?"":(t<0&&(t=0),c>f&&(c=f),(0!==t||c{function a(e){return e.length}e.exports={byteLength:a,toString:function(e){const a=e.byteLength;let t="";for(let c=0;c{const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=new Uint8Array(256);for(let e=0;e<64;e++)t[a.charCodeAt(e)]=e;function c(e){let a=e.length;return 61===e.charCodeAt(a-1)&&a--,a>1&&61===e.charCodeAt(a-1)&&a--,3*a>>>2}t[45]=62,t[95]=63,e.exports={byteLength:c,toString:function(e){const t=e.byteLength;let c="";for(let f=0;f>2]+a[(3&e[f])<<4|e[f+1]>>4]+a[(15&e[f+1])<<2|e[f+2]>>6]+a[63&e[f+2]];return t%3==2?c=c.substring(0,c.length-1)+"=":t%3==1&&(c=c.substring(0,c.length-2)+"=="),c},write:function(e,a,f=0,d=c(a)){const r=Math.min(d,e.byteLength-f);for(let c=0,f=0;f>4,e[f++]=(15&r)<<4|n>>2,e[f++]=(3&n)<<6|63&i}return r}}},51847:e=>{function a(e){return e.length>>>1}function t(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-65+10:e>=97&&e<=102?e-97+10:void 0}e.exports={byteLength:a,toString:function(e){const a=e.byteLength;e=new DataView(e.buffer,e.byteOffset,a);let t="",c=0;for(let f=a-a%4;c{function a(e){return 2*e.length}e.exports={byteLength:a,toString:function(e){const a=e.byteLength;let t="";for(let c=0;c>8,r=f%256;e[c+2*a]=r,e[c+2*a+1]=d}return d}}},86679:e=>{function a(e){let a=0;for(let t=0,c=e.length;t=55296&&f<=56319&&t+1=56320&&c<=57343){a+=4,t++;continue}}a+=f<=127?1:f<=2047?2:3}return a}let t,c;if("undefined"!=typeof TextDecoder){const e=new TextDecoder;t=function(a){return e.decode(a)}}else t=function(e){const a=e.byteLength;let t="",c=0;for(;c0){let a=0;for(;a>c,c-=6;c>=0;)e[n++]=128|a>>c&63,c-=6;r+=a>=65536?2:1}return d};e.exports={byteLength:a,toString:t,write:c}},95364:(e,a,t)=>{"use strict";var c=t(92861).Buffer;e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var a=new Uint8Array(256),t=0;t>>0,o=new Uint8Array(r);t>>0,o[u]=s%256>>>0,s=s/256>>>0;if(0!==s)throw new Error("Non-zero carry");d=l,t++}for(var h=r-d;h!==r&&0===o[h];)h++;var p=c.allocUnsafe(f+(r-h));p.fill(0,0,f);for(var g=f;h!==r;)p[g++]=o[h++];return p}return{encode:function(a){if((Array.isArray(a)||a instanceof Uint8Array)&&(a=c.from(a)),!c.isBuffer(a))throw new TypeError("Expected Buffer");if(0===a.length)return"";for(var t=0,f=0,d=0,r=a.length;d!==r&&0===a[d];)d++,t++;for(var b=(r-d)*o+1>>>0,s=new Uint8Array(b);d!==r;){for(var l=a[d],u=0,h=b-1;(0!==l||u>>0,s[h]=l%n>>>0,l=l/n>>>0;if(0!==l)throw new Error("Non-zero carry");f=u,d++}for(var p=b-f;p!==b&&0===s[p];)p++;for(var g=i.repeat(t);p{"use strict";a.byteLength=function(e){var a=n(e),t=a[0],c=a[1];return 3*(t+c)/4-c},a.toByteArray=function(e){var a,t,d=n(e),r=d[0],i=d[1],b=new f(function(e,a,t){return 3*(a+t)/4-t}(0,r,i)),o=0,s=i>0?r-4:r;for(t=0;t>16&255,b[o++]=a>>8&255,b[o++]=255&a;return 2===i&&(a=c[e.charCodeAt(t)]<<2|c[e.charCodeAt(t+1)]>>4,b[o++]=255&a),1===i&&(a=c[e.charCodeAt(t)]<<10|c[e.charCodeAt(t+1)]<<4|c[e.charCodeAt(t+2)]>>2,b[o++]=a>>8&255,b[o++]=255&a),b},a.fromByteArray=function(e){for(var a,c=e.length,f=c%3,d=[],r=16383,n=0,b=c-f;nb?b:n+r));return 1===f?(a=e[c-1],d.push(t[a>>2]+t[a<<4&63]+"==")):2===f&&(a=(e[c-2]<<8)+e[c-1],d.push(t[a>>10]+t[a>>4&63]+t[a<<2&63]+"=")),d.join("")};for(var t=[],c=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0;r<64;++r)t[r]=d[r],c[d.charCodeAt(r)]=r;function n(e){var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=e.indexOf("=");return-1===t&&(t=a),[t,t===a?0:4-t%4]}function i(e,a,c){for(var f,d,r=[],n=a;n>18&63]+t[d>>12&63]+t[d>>6&63]+t[63&d]);return r.join("")}c["-".charCodeAt(0)]=62,c["_".charCodeAt(0)]=63},92096:(e,a,t)=>{var c;e=t.nmd(e);var f=function(e){"use strict";var a=1e7,t=9007199254740992,c=l(t),d="0123456789abcdefghijklmnopqrstuvwxyz",r="function"==typeof BigInt;function n(e,a,t,c){return void 0===e?n[0]:void 0===a||10==+a&&!t?Z(e):$(e,a,t,c)}function i(e,a){this.value=e,this.sign=a,this.isSmall=!1}function b(e){this.value=e,this.sign=e<0,this.isSmall=!0}function o(e){this.value=e}function s(e){return-t0?Math.floor(e):Math.ceil(e)}function m(e,t){var c,f,d=e.length,r=t.length,n=new Array(d),i=0,b=a;for(f=0;f=b?1:0,n[f]=c-i*b;for(;f0&&n.push(i),n}function x(e,a){return e.length>=a.length?m(e,a):m(a,e)}function y(e,t){var c,f,d=e.length,r=new Array(d),n=a;for(f=0;f0;)r[f++]=t%n,t=Math.floor(t/n);return r}function A(e,t){var c,f,d=e.length,r=t.length,n=new Array(d),i=0,b=a;for(c=0;c0;)r[f++]=i%n,i=Math.floor(i/n);return r}function I(e,a){for(var t=[];a-- >0;)t.push(0);return t.concat(e)}function E(e,a){var t=Math.max(e.length,a.length);if(t<=30)return w(e,a);t=Math.ceil(t/2);var c=e.slice(t),f=e.slice(0,t),d=a.slice(t),r=a.slice(0,t),n=E(f,r),i=E(c,d),b=E(x(f,c),x(r,d)),o=x(x(n,I(A(A(b,n),i),t)),I(i,2*t));return h(o),o}function C(e,t,c){return new i(e=0;--c)d=(r=d*b+e[c])-(f=g(r/t))*t,i[c]=0|f;return[i,0|d]}function k(e,t){var c,f=Z(t);if(r)return[new o(e.value/f.value),new o(e.value%f.value)];var d,s=e.value,m=f.value;if(0===m)throw new Error("Cannot divide by zero");if(e.isSmall)return f.isSmall?[new b(g(s/m)),new b(s%m)]:[n[0],e];if(f.isSmall){if(1===m)return[e,n[0]];if(-1==m)return[e.negate(),n[0]];var x=Math.abs(m);if(x=0;f--){for(c=l-1,x[f+s]!==g&&(c=Math.floor((x[f+s]*l+x[f+s-1])/g)),d=0,r=0,i=y.length,n=0;nb&&(d=(d+1)*l),c=Math.ceil(d/r);do{if(L(n=_(t,c),s)<=0)break;c--}while(c);o.push(c),s=A(s,n)}return o.reverse(),[u(o),u(s)]}(s,m),d=c[0];var w=e.sign!==f.sign,I=c[1],E=e.sign;return"number"==typeof d?(w&&(d=-d),d=new b(d)):d=new i(d,w),"number"==typeof I?(E&&(I=-I),I=new b(I)):I=new i(I,E),[d,I]}function L(e,a){if(e.length!==a.length)return e.length>a.length?1:-1;for(var t=e.length-1;t>=0;t--)if(e[t]!==a[t])return e[t]>a[t]?1:-1;return 0}function S(e){var a=e.abs();return!a.isUnit()&&(!!(a.equals(2)||a.equals(3)||a.equals(5))||!(a.isEven()||a.isDivisibleBy(3)||a.isDivisibleBy(5))&&(!!a.lesser(49)||void 0))}function T(e,a){for(var t,c,d,r=e.prev(),n=r,i=0;n.isEven();)n=n.divide(2),i++;e:for(c=0;c=0?c=A(e,a):(c=A(a,e),t=!t),"number"==typeof(c=u(c))?(t&&(c=-c),new b(c)):new i(c,t)}(t,c,this.sign)},i.prototype.minus=i.prototype.subtract,b.prototype.subtract=function(e){var a=Z(e),t=this.value;if(t<0!==a.sign)return this.add(a.negate());var c=a.value;return a.isSmall?new b(t-c):v(c,Math.abs(t),t>=0)},b.prototype.minus=b.prototype.subtract,o.prototype.subtract=function(e){return new o(this.value-Z(e).value)},o.prototype.minus=o.prototype.subtract,i.prototype.negate=function(){return new i(this.value,!this.sign)},b.prototype.negate=function(){var e=this.sign,a=new b(-this.value);return a.sign=!e,a},o.prototype.negate=function(){return new o(-this.value)},i.prototype.abs=function(){return new i(this.value,!1)},b.prototype.abs=function(){return new b(Math.abs(this.value))},o.prototype.abs=function(){return new o(this.value>=0?this.value:-this.value)},i.prototype.multiply=function(e){var t,c,f,d=Z(e),r=this.value,b=d.value,o=this.sign!==d.sign;if(d.isSmall){if(0===b)return n[0];if(1===b)return this;if(-1===b)return this.negate();if((t=Math.abs(b))0?E(r,b):w(r,b),o)},i.prototype.times=i.prototype.multiply,b.prototype._multiplyBySmall=function(e){return s(e.value*this.value)?new b(e.value*this.value):C(Math.abs(e.value),l(Math.abs(this.value)),this.sign!==e.sign)},i.prototype._multiplyBySmall=function(e){return 0===e.value?n[0]:1===e.value?this:-1===e.value?this.negate():C(Math.abs(e.value),this.value,this.sign!==e.sign)},b.prototype.multiply=function(e){return Z(e)._multiplyBySmall(this)},b.prototype.times=b.prototype.multiply,o.prototype.multiply=function(e){return new o(this.value*Z(e).value)},o.prototype.times=o.prototype.multiply,i.prototype.square=function(){return new i(M(this.value),!1)},b.prototype.square=function(){var e=this.value*this.value;return s(e)?new b(e):new i(M(l(Math.abs(this.value))),!1)},o.prototype.square=function(e){return new o(this.value*this.value)},i.prototype.divmod=function(e){var a=k(this,e);return{quotient:a[0],remainder:a[1]}},o.prototype.divmod=b.prototype.divmod=i.prototype.divmod,i.prototype.divide=function(e){return k(this,e)[0]},o.prototype.over=o.prototype.divide=function(e){return new o(this.value/Z(e).value)},b.prototype.over=b.prototype.divide=i.prototype.over=i.prototype.divide,i.prototype.mod=function(e){return k(this,e)[1]},o.prototype.mod=o.prototype.remainder=function(e){return new o(this.value%Z(e).value)},b.prototype.remainder=b.prototype.mod=i.prototype.remainder=i.prototype.mod,i.prototype.pow=function(e){var a,t,c,f=Z(e),d=this.value,r=f.value;if(0===r)return n[1];if(0===d)return n[0];if(1===d)return n[1];if(-1===d)return f.isEven()?n[1]:n[-1];if(f.sign)return n[0];if(!f.isSmall)throw new Error("The exponent "+f.toString()+" is too large.");if(this.isSmall&&s(a=Math.pow(d,r)))return new b(g(a));for(t=this,c=n[1];!0&r&&(c=c.times(t),--r),0!==r;)r/=2,t=t.square();return c},b.prototype.pow=i.prototype.pow,o.prototype.pow=function(e){var a=Z(e),t=this.value,c=a.value,f=BigInt(0),d=BigInt(1),r=BigInt(2);if(c===f)return n[1];if(t===f)return n[0];if(t===d)return n[1];if(t===BigInt(-1))return a.isEven()?n[1]:n[-1];if(a.isNegative())return new o(f);for(var i=this,b=n[1];(c&d)===d&&(b=b.times(i),--c),c!==f;)c/=r,i=i.square();return b},i.prototype.modPow=function(e,a){if(e=Z(e),(a=Z(a)).isZero())throw new Error("Cannot take modPow with modulus 0");var t=n[1],c=this.mod(a);for(e.isNegative()&&(e=e.multiply(n[-1]),c=c.modInv(a));e.isPositive();){if(c.isZero())return n[0];e.isOdd()&&(t=t.multiply(c).mod(a)),e=e.divide(2),c=c.square().mod(a)}return t},o.prototype.modPow=b.prototype.modPow=i.prototype.modPow,i.prototype.compareAbs=function(e){var a=Z(e),t=this.value,c=a.value;return a.isSmall?1:L(t,c)},b.prototype.compareAbs=function(e){var a=Z(e),t=Math.abs(this.value),c=a.value;return a.isSmall?t===(c=Math.abs(c))?0:t>c?1:-1:-1},o.prototype.compareAbs=function(e){var a=this.value,t=Z(e).value;return(a=a>=0?a:-a)===(t=t>=0?t:-t)?0:a>t?1:-1},i.prototype.compare=function(e){if(e===1/0)return-1;if(e===-1/0)return 1;var a=Z(e),t=this.value,c=a.value;return this.sign!==a.sign?a.sign?1:-1:a.isSmall?this.sign?-1:1:L(t,c)*(this.sign?-1:1)},i.prototype.compareTo=i.prototype.compare,b.prototype.compare=function(e){if(e===1/0)return-1;if(e===-1/0)return 1;var a=Z(e),t=this.value,c=a.value;return a.isSmall?t==c?0:t>c?1:-1:t<0!==a.sign?t<0?-1:1:t<0?1:-1},b.prototype.compareTo=b.prototype.compare,o.prototype.compare=function(e){if(e===1/0)return-1;if(e===-1/0)return 1;var a=this.value,t=Z(e).value;return a===t?0:a>t?1:-1},o.prototype.compareTo=o.prototype.compare,i.prototype.equals=function(e){return 0===this.compare(e)},o.prototype.eq=o.prototype.equals=b.prototype.eq=b.prototype.equals=i.prototype.eq=i.prototype.equals,i.prototype.notEquals=function(e){return 0!==this.compare(e)},o.prototype.neq=o.prototype.notEquals=b.prototype.neq=b.prototype.notEquals=i.prototype.neq=i.prototype.notEquals,i.prototype.greater=function(e){return this.compare(e)>0},o.prototype.gt=o.prototype.greater=b.prototype.gt=b.prototype.greater=i.prototype.gt=i.prototype.greater,i.prototype.lesser=function(e){return this.compare(e)<0},o.prototype.lt=o.prototype.lesser=b.prototype.lt=b.prototype.lesser=i.prototype.lt=i.prototype.lesser,i.prototype.greaterOrEquals=function(e){return this.compare(e)>=0},o.prototype.geq=o.prototype.greaterOrEquals=b.prototype.geq=b.prototype.greaterOrEquals=i.prototype.geq=i.prototype.greaterOrEquals,i.prototype.lesserOrEquals=function(e){return this.compare(e)<=0},o.prototype.leq=o.prototype.lesserOrEquals=b.prototype.leq=b.prototype.lesserOrEquals=i.prototype.leq=i.prototype.lesserOrEquals,i.prototype.isEven=function(){return!(1&this.value[0])},b.prototype.isEven=function(){return!(1&this.value)},o.prototype.isEven=function(){return(this.value&BigInt(1))===BigInt(0)},i.prototype.isOdd=function(){return!(1&~this.value[0])},b.prototype.isOdd=function(){return!(1&~this.value)},o.prototype.isOdd=function(){return(this.value&BigInt(1))===BigInt(1)},i.prototype.isPositive=function(){return!this.sign},b.prototype.isPositive=function(){return this.value>0},o.prototype.isPositive=b.prototype.isPositive,i.prototype.isNegative=function(){return this.sign},b.prototype.isNegative=function(){return this.value<0},o.prototype.isNegative=b.prototype.isNegative,i.prototype.isUnit=function(){return!1},b.prototype.isUnit=function(){return 1===Math.abs(this.value)},o.prototype.isUnit=function(){return this.abs().value===BigInt(1)},i.prototype.isZero=function(){return!1},b.prototype.isZero=function(){return 0===this.value},o.prototype.isZero=function(){return this.value===BigInt(0)},i.prototype.isDivisibleBy=function(e){var a=Z(e);return!a.isZero()&&(!!a.isUnit()||(0===a.compareAbs(2)?this.isEven():this.mod(a).isZero()))},o.prototype.isDivisibleBy=b.prototype.isDivisibleBy=i.prototype.isDivisibleBy,i.prototype.isPrime=function(a){var t=S(this);if(t!==e)return t;var c=this.abs(),d=c.bitLength();if(d<=64)return T(c,[2,3,5,7,11,13,17,19,23,29,31,37]);for(var r=Math.log(2)*d.toJSNumber(),n=Math.ceil(!0===a?2*Math.pow(r,2):r),i=[],b=0;b-t?new b(e-1):new i(c,!0)},o.prototype.prev=function(){return new o(this.value-BigInt(1))};for(var N=[1];2*N[N.length-1]<=a;)N.push(2*N[N.length-1]);var R=N.length,P=N[R-1];function D(e){return Math.abs(e)<=a}function O(e,a,t){a=Z(a);for(var c=e.isNegative(),d=a.isNegative(),r=c?e.not():e,n=d?a.not():a,i=0,b=0,o=null,s=null,l=[];!r.isZero()||!n.isZero();)i=(o=k(r,P))[1].toJSNumber(),c&&(i=P-1-i),b=(s=k(n,P))[1].toJSNumber(),d&&(b=P-1-b),r=o[0],n=s[0],l.push(t(i,b));for(var u=0!==t(c?1:0,d?1:0)?f(-1):f(0),h=l.length-1;h>=0;h-=1)u=u.multiply(P).add(f(l[h]));return u}i.prototype.shiftLeft=function(e){var a=Z(e).toJSNumber();if(!D(a))throw new Error(String(a)+" is too large for shifting.");if(a<0)return this.shiftRight(-a);var t=this;if(t.isZero())return t;for(;a>=R;)t=t.multiply(P),a-=R-1;return t.multiply(N[a])},o.prototype.shiftLeft=b.prototype.shiftLeft=i.prototype.shiftLeft,i.prototype.shiftRight=function(e){var a,t=Z(e).toJSNumber();if(!D(t))throw new Error(String(t)+" is too large for shifting.");if(t<0)return this.shiftLeft(-t);for(var c=this;t>=R;){if(c.isZero()||c.isNegative()&&c.isUnit())return c;c=(a=k(c,P))[1].isNegative()?a[0].prev():a[0],t-=R-1}return(a=k(c,N[t]))[1].isNegative()?a[0].prev():a[0]},o.prototype.shiftRight=b.prototype.shiftRight=i.prototype.shiftRight,i.prototype.not=function(){return this.negate().prev()},o.prototype.not=b.prototype.not=i.prototype.not,i.prototype.and=function(e){return O(this,e,(function(e,a){return e&a}))},o.prototype.and=b.prototype.and=i.prototype.and,i.prototype.or=function(e){return O(this,e,(function(e,a){return e|a}))},o.prototype.or=b.prototype.or=i.prototype.or,i.prototype.xor=function(e){return O(this,e,(function(e,a){return e^a}))},o.prototype.xor=b.prototype.xor=i.prototype.xor;var F=1<<30;function Q(e){var t=e.value,c="number"==typeof t?t|F:"bigint"==typeof t?t|BigInt(F):t[0]+t[1]*a|1073758208;return c&-c}function U(e,a){if(a.compareTo(e)<=0){var t=U(e,a.square(a)),c=t.p,d=t.e,r=c.multiply(a);return r.compareTo(e)<=0?{p:r,e:2*d+1}:{p:c,e:2*d}}return{p:f(1),e:0}}function j(e,a){return e=Z(e),a=Z(a),e.greater(a)?e:a}function H(e,a){return e=Z(e),a=Z(a),e.lesser(a)?e:a}function q(e,a){if(e=Z(e).abs(),a=Z(a).abs(),e.equals(a))return e;if(e.isZero())return a;if(a.isZero())return e;for(var t,c,f=n[1];e.isEven()&&a.isEven();)t=H(Q(e),Q(a)),e=e.divide(t),a=a.divide(t),f=f.multiply(t);for(;e.isEven();)e=e.divide(Q(e));do{for(;a.isEven();)a=a.divide(Q(a));e.greater(a)&&(c=a,a=e,e=c),a=a.subtract(e)}while(!a.isZero());return f.isUnit()?e:e.multiply(f)}i.prototype.bitLength=function(){var e=this;return e.compareTo(f(0))<0&&(e=e.negate().subtract(f(1))),0===e.compareTo(f(0))?f(0):f(U(e,f(2)).e).add(f(1))},o.prototype.bitLength=b.prototype.bitLength=i.prototype.bitLength;var $=function(e,a,t,c){t=t||d,e=String(e),c||(e=e.toLowerCase(),t=t.toLowerCase());var f,r=e.length,n=Math.abs(a),i={};for(f=0;f=n){if("1"===s&&1===n)continue;throw new Error(s+" is not a valid digit in base "+a+".")}a=Z(a);var b=[],o="-"===e[0];for(f=o?1:0;f"!==e[f]&&f=0;c--)f=f.add(e[c].times(d)),d=d.times(a);return t?f.negate():f}function G(e,a){if((a=f(a)).isZero()){if(e.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(a.equals(-1)){if(e.isZero())return{value:[0],isNegative:!1};if(e.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-e.toJSNumber())).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var t=Array.apply(null,Array(e.toJSNumber()-1)).map(Array.prototype.valueOf,[0,1]);return t.unshift([1]),{value:[].concat.apply([],t),isNegative:!1}}var c=!1;if(e.isNegative()&&a.isPositive()&&(c=!0,e=e.abs()),a.isUnit())return e.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(e.toJSNumber())).map(Number.prototype.valueOf,1),isNegative:c};for(var d,r=[],n=e;n.isNegative()||n.compareAbs(a)>=0;){d=n.divmod(a),n=d.quotient;var i=d.remainder;i.isNegative()&&(i=a.minus(i).abs(),n=n.next()),r.push(i.toJSNumber())}return r.push(n.toJSNumber()),{value:r.reverse(),isNegative:c}}function K(e,a,t){var c=G(e,a);return(c.isNegative?"-":"")+c.value.map((function(e){return function(e,a){return e<(a=a||d).length?a[e]:"<"+e+">"}(e,t)})).join("")}function V(e){if(s(+e)){var a=+e;if(a===g(a))return r?new o(BigInt(a)):new b(a);throw new Error("Invalid integer: "+e)}var t="-"===e[0];t&&(e=e.slice(1));var c=e.split(/e/i);if(c.length>2)throw new Error("Invalid integer: "+c.join("e"));if(2===c.length){var f=c[1];if("+"===f[0]&&(f=f.slice(1)),(f=+f)!==g(f)||!s(f))throw new Error("Invalid integer: "+f+" is not a valid exponent.");var d=c[0],n=d.indexOf(".");if(n>=0&&(f-=d.length-n-1,d=d.slice(0,n)+d.slice(n+1)),f<0)throw new Error("Cannot include negative exponent part for integers");e=d+=new Array(f+1).join("0")}if(!/^([0-9][0-9]*)$/.test(e))throw new Error("Invalid integer: "+e);if(r)return new o(BigInt(t?"-"+e:e));for(var l=[],u=e.length,p=u-7;u>0;)l.push(+e.slice(p,u)),(p-=7)<0&&(p=0),u-=7;return h(l),new i(l,t)}function Z(e){return"number"==typeof e?function(e){if(r)return new o(BigInt(e));if(s(e)){if(e!==g(e))throw new Error(e+" is not an integer.");return new b(e)}return V(e.toString())}(e):"string"==typeof e?V(e):"bigint"==typeof e?new o(e):e}i.prototype.toArray=function(e){return G(this,e)},b.prototype.toArray=function(e){return G(this,e)},o.prototype.toArray=function(e){return G(this,e)},i.prototype.toString=function(a,t){if(a===e&&(a=10),10!==a||t)return K(this,a,t);for(var c,f=this.value,d=f.length,r=String(f[--d]);--d>=0;)c=String(f[d]),r+="0000000".slice(c.length)+c;return(this.sign?"-":"")+r},b.prototype.toString=function(a,t){return a===e&&(a=10),10!=a||t?K(this,a,t):String(this.value)},o.prototype.toString=b.prototype.toString,o.prototype.toJSON=i.prototype.toJSON=b.prototype.toJSON=function(){return this.toString()},i.prototype.valueOf=function(){return parseInt(this.toString(),10)},i.prototype.toJSNumber=i.prototype.valueOf,b.prototype.valueOf=function(){return this.value},b.prototype.toJSNumber=b.prototype.valueOf,o.prototype.valueOf=o.prototype.toJSNumber=function(){return parseInt(this.toString(),10)};for(var J=0;J<1e3;J++)n[J]=Z(J),J>0&&(n[-J]=Z(-J));return n.one=n[1],n.zero=n[0],n.minusOne=n[-1],n.max=j,n.min=H,n.gcd=q,n.lcm=function(e,a){return e=Z(e).abs(),a=Z(a).abs(),e.divide(q(e,a)).multiply(a)},n.isInstance=function(e){return e instanceof i||e instanceof b||e instanceof o},n.randBetween=function(e,t,c){e=Z(e),t=Z(t);var f=c||Math.random,d=H(e,t),r=j(e,t).subtract(d).add(1);if(r.isSmall)return d.add(Math.floor(f()*r));for(var i=G(r,a).value,b=[],o=!0,s=0;s{e.exports=t(85702)(t(86989))},4315:(e,a,t)=>{var c=t(62045).hp;const f=t(28399).Transform;e.exports=class extends f{constructor(e,a){super(a),this._engine=e,this._finalized=!1}_transform(e,a,t){let c=null;try{this.update(e,a)}catch(e){c=e}t(c)}_flush(e){let a=null;try{this.push(this.digest())}catch(e){a=e}e(a)}update(e,a){if(!c.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return c.isBuffer(e)||(e=c.from(e,a)),this._engine.update(e),this}digest(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;let a=this._engine.digest();return void 0!==e&&(a=a.toString(e)),a}}},85702:(e,a,t)=>{const c=t(4315);e.exports=e=>(a,t)=>{const f=(a=>{switch("string"==typeof a?a.toLowerCase():a){case"blake224":return e.Blake224;case"blake256":return e.Blake256;case"blake384":return e.Blake384;case"blake512":return e.Blake512;default:throw new Error("Invald algorithm: "+a)}})(a);return new c(new f,t)}},34588:(e,a,t)=>{var c=t(62045).hp;class f{_lengthCarry(e){for(let a=0;a=a.length;){for(let c=this._blockOffset;c{var c=t(62045).hp;const f=t(23287),d=c.from([0]),r=c.from([128]);e.exports=class extends f{constructor(){super(),this._h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],this._zo=d,this._oo=r}digest(){this._padding();const e=c.alloc(28);for(let a=0;a<7;++a)e.writeUInt32BE(this._h[a],4*a);return e}}},23287:(e,a,t)=>{var c=t(62045).hp;const f=t(34588),d=c.from([1]),r=c.from([129]),n=(e,a)=>(e<<32-a|e>>>a)>>>0;function i(e,a,t,c,d,r,i,b){const o=f.sigma,s=f.u256;e[c]=e[c]+((a[o[t][b]]^s[o[t][b+1]])>>>0)+e[d]>>>0,e[i]=n(e[i]^e[c],16),e[r]=e[r]+e[i]>>>0,e[d]=n(e[d]^e[r],12),e[c]=e[c]+((a[o[t][b+1]]^s[o[t][b]])>>>0)+e[d]>>>0,e[i]=n(e[i]^e[c],8),e[r]=e[r]+e[i]>>>0,e[d]=n(e[d]^e[r],7)}e.exports=class extends f{constructor(){super(),this._h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this._s=[0,0,0,0],this._block=c.alloc(64),this._blockOffset=0,this._length=[0,0],this._nullt=!1,this._zo=d,this._oo=r}_compress(){const e=f.u256,a=new Array(16),t=new Array(16);let c;for(c=0;c<16;++c)t[c]=this._block.readUInt32BE(4*c);for(c=0;c<8;++c)a[c]=this._h[c]>>>0;for(c=8;c<12;++c)a[c]=(this._s[c-8]^e[c-8])>>>0;for(c=12;c<16;++c)a[c]=e[c-8];for(this._nullt||(a[12]=(a[12]^this._length[0])>>>0,a[13]=(a[13]^this._length[0])>>>0,a[14]=(a[14]^this._length[1])>>>0,a[15]=(a[15]^this._length[1])>>>0),c=0;c<14;++c)i(a,t,c,0,4,8,12,0),i(a,t,c,1,5,9,13,2),i(a,t,c,2,6,10,14,4),i(a,t,c,3,7,11,15,6),i(a,t,c,0,5,10,15,8),i(a,t,c,1,6,11,12,10),i(a,t,c,2,7,8,13,12),i(a,t,c,3,4,9,14,14);for(c=0;c<16;++c)this._h[c%8]=(this._h[c%8]^a[c])>>>0;for(c=0;c<8;++c)this._h[c]=(this._h[c]^this._s[c%4])>>>0}_padding(){let e=this._length[0]+8*this._blockOffset,a=this._length[1];e>=4294967296&&(e-=4294967296,a+=1);const t=c.alloc(8);t.writeUInt32BE(a,0),t.writeUInt32BE(e,4),55===this._blockOffset?(this._length[0]-=8,this.update(this._oo)):(this._blockOffset<55?(0===this._blockOffset&&(this._nullt=!0),this._length[0]-=8*(55-this._blockOffset),this.update(f.padding.slice(0,55-this._blockOffset))):(this._length[0]-=8*(64-this._blockOffset),this.update(f.padding.slice(0,64-this._blockOffset)),this._length[0]-=440,this.update(f.padding.slice(1,56)),this._nullt=!0),this.update(this._zo),this._length[0]-=8),this._length[0]-=64,this.update(t)}digest(){this._padding();const e=c.alloc(32);for(let a=0;a<8;++a)e.writeUInt32BE(this._h[a],4*a);return e}}},399:(e,a,t)=>{var c=t(62045).hp;const f=t(61070),d=c.from([0]),r=c.from([128]);e.exports=class extends f{constructor(){super(),this._h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428],this._zo=d,this._oo=r}digest(){this._padding();const e=c.alloc(48);for(let a=0;a<12;++a)e.writeUInt32BE(this._h[a],4*a);return e}}},61070:(e,a,t)=>{var c=t(62045).hp;const f=t(34588),d=c.from([1]),r=c.from([129]);function n(e,a,t,c){let f=e[2*a]^e[2*t],d=e[2*a+1]^e[2*t+1];c>=32&&(d^=f,f^=d,d^=f,c-=32),0===c?(e[2*a]=f>>>0,e[2*a+1]=d>>>0):(e[2*a]=(f>>>c|d<<32-c)>>>0,e[2*a+1]=(d>>>c|f<<32-c)>>>0)}function i(e,a,t,c,d,r,i,b){const o=f.sigma,s=f.u512;let l;l=e[2*c+1]+((a[2*o[t][b]+1]^s[2*o[t][b+1]+1])>>>0)+e[2*d+1],e[2*c]=e[2*c]+((a[2*o[t][b]]^s[2*o[t][b+1]])>>>0)+e[2*d]+~~(l/4294967296)>>>0,e[2*c+1]=l>>>0,n(e,i,c,32),l=e[2*r+1]+e[2*i+1],e[2*r]=e[2*r]+e[2*i]+~~(l/4294967296)>>>0,e[2*r+1]=l>>>0,n(e,d,r,25),l=e[2*c+1]+((a[2*o[t][b+1]+1]^s[2*o[t][b]+1])>>>0)+e[2*d+1],e[2*c]=e[2*c]+((a[2*o[t][b+1]]^s[2*o[t][b]])>>>0)+e[2*d]+~~(l/4294967296)>>>0,e[2*c+1]=l>>>0,n(e,i,c,16),l=e[2*r+1]+e[2*i+1],e[2*r]=e[2*r]+e[2*i]+~~(l/4294967296)>>>0,e[2*r+1]=l>>>0,n(e,d,r,11)}e.exports=class extends f{constructor(){super(),this._h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this._s=[0,0,0,0,0,0,0,0],this._block=c.alloc(128),this._blockOffset=0,this._length=[0,0,0,0],this._nullt=!1,this._zo=d,this._oo=r}_compress(){const e=f.u512,a=new Array(32),t=new Array(32);let c;for(c=0;c<32;++c)t[c]=this._block.readUInt32BE(4*c);for(c=0;c<16;++c)a[c]=this._h[c]>>>0;for(c=16;c<24;++c)a[c]=(this._s[c-16]^e[c-16])>>>0;for(c=24;c<32;++c)a[c]=e[c-16];for(this._nullt||(a[24]=(a[24]^this._length[1])>>>0,a[25]=(a[25]^this._length[0])>>>0,a[26]=(a[26]^this._length[1])>>>0,a[27]=(a[27]^this._length[0])>>>0,a[28]=(a[28]^this._length[3])>>>0,a[29]=(a[29]^this._length[2])>>>0,a[30]=(a[30]^this._length[3])>>>0,a[31]=(a[31]^this._length[2])>>>0),c=0;c<16;++c)i(a,t,c,0,4,8,12,0),i(a,t,c,1,5,9,13,2),i(a,t,c,2,6,10,14,4),i(a,t,c,3,7,11,15,6),i(a,t,c,0,5,10,15,8),i(a,t,c,1,6,11,12,10),i(a,t,c,2,7,8,13,12),i(a,t,c,3,4,9,14,14);for(c=0;c<16;++c)this._h[c%8*2]=(this._h[c%8*2]^a[2*c])>>>0,this._h[c%8*2+1]=(this._h[c%8*2+1]^a[2*c+1])>>>0;for(c=0;c<8;++c)this._h[2*c]=(this._h[2*c]^this._s[c%4*2])>>>0,this._h[2*c+1]=(this._h[2*c+1]^this._s[c%4*2+1])>>>0}_padding(){const e=this._length.slice();e[0]+=8*this._blockOffset,this._lengthCarry(e);const a=c.alloc(16);for(let t=0;t<4;++t)a.writeUInt32BE(e[3-t],4*t);111===this._blockOffset?(this._length[0]-=8,this.update(this._oo)):(this._blockOffset<111?(0===this._blockOffset&&(this._nullt=!0),this._length[0]-=8*(111-this._blockOffset),this.update(f.padding.slice(0,111-this._blockOffset))):(this._length[0]-=8*(128-this._blockOffset),this.update(f.padding.slice(0,128-this._blockOffset)),this._length[0]-=888,this.update(f.padding.slice(1,112)),this._nullt=!0),this.update(this._zo),this._length[0]-=8),this._length[0]-=128,this.update(a)}digest(){this._padding();const e=c.alloc(64);for(let a=0;a<16;++a)e.writeUInt32BE(this._h[a],4*a);return e}}},86989:(e,a,t)=>{e.exports={Blake224:t(48746),Blake256:t(23287),Blake384:t(399),Blake512:t(61070)}},91892:e=>{var a,t,c=(()=>{for(var e=new Uint8Array(128),a=0;a<64;a++)e[a<26?a+65:a<52?a+71:a<62?a-4:4*a-205]=a;return a=>{for(var t=a.length,c=new Uint8Array(3*(t-("="==a[t-1])-("="==a[t-2]))/4|0),f=0,d=0;f>4,c[d++]=n<<4|i>>2,c[d++]=i<<6|b}return c}})(),f=(a={"wasm-binary:./blake2b.wat"(e,a){a.exports=c("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMKvz8EwAIAIABCADcDACAAQgA3AwggAEIANwMQIABCADcDGCAAQgA3AyAgAEIANwMoIABCADcDMCAAQgA3AzggAEIANwNAIABCADcDSCAAQgA3A1AgAEIANwNYIABCADcDYCAAQgA3A2ggAEIANwNwIABCADcDeCAAQoiS853/zPmE6gBBACkDAIU3A4ABIABCu86qptjQ67O7f0EIKQMAhTcDiAEgAEKr8NP0r+68tzxBECkDAIU3A5ABIABC8e30+KWn/aelf0EYKQMAhTcDmAEgAELRhZrv+s+Uh9EAQSApAwCFNwOgASAAQp/Y+dnCkdqCm39BKCkDAIU3A6gBIABC6/qG2r+19sEfQTApAwCFNwOwASAAQvnC+JuRo7Pw2wBBOCkDAIU3A7gBIABCADcDwAEgAEIANwPIASAAQgA3A9ABC20BA38gAEHAAWohAyAAQcgBaiEEIAQpAwCnIQUCQANAIAEgAkYNASAFQYABRgRAIAMgAykDACAFrXw3AwBBACEFIAAQAwsgACAFaiABLQAAOgAAIAVBAWohBSABQQFqIQEMAAsLIAQgBa03AwALYQEDfyAAQcABaiEBIABByAFqIQIgASABKQMAIAIpAwB8NwMAIABCfzcD0AEgAikDAKchAwJAA0AgA0GAAUYNASAAIANqQQA6AAAgA0EBaiEDDAALCyACIAOtNwMAIAAQAwuqOwIgfgl/IABBgAFqISEgAEGIAWohIiAAQZABaiEjIABBmAFqISQgAEGgAWohJSAAQagBaiEmIABBsAFqIScgAEG4AWohKCAhKQMAIQEgIikDACECICMpAwAhAyAkKQMAIQQgJSkDACEFICYpAwAhBiAnKQMAIQcgKCkDACEIQoiS853/zPmE6gAhCUK7zqqm2NDrs7t/IQpCq/DT9K/uvLc8IQtC8e30+KWn/aelfyEMQtGFmu/6z5SH0QAhDUKf2PnZwpHagpt/IQ5C6/qG2r+19sEfIQ9C+cL4m5Gjs/DbACEQIAApAwAhESAAKQMIIRIgACkDECETIAApAxghFCAAKQMgIRUgACkDKCEWIAApAzAhFyAAKQM4IRggACkDQCEZIAApA0ghGiAAKQNQIRsgACkDWCEcIAApA2AhHSAAKQNoIR4gACkDcCEfIAApA3ghICANIAApA8ABhSENIA8gACkD0AGFIQ8gASAFIBF8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSASfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgE3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBR8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAVfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgFnx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBd8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAYfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgGXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBp8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAbfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgHHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIB18fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAefHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgH3x8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFICB8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAffHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgG3x8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBV8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAZfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgGnx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHICB8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAefHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggF3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBJ8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAdfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgEXx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBN8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAcfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggGHx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBZ8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAUfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgHHx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBl8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAdfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgEXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBZ8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByATfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggIHx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIB58fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAbfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgH3x8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBR8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAXfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggGHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBJ8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAafHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFXx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBh8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAafHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgFHx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBJ8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAefHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHXx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBx8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAffHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgE3x8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBd8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAWfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgG3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBV8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCARfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgIHx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBl8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAafHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEXx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBZ8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAYfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgE3x8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBV8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAbfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggIHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIB98fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiASfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgHHx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIB18fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAXfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggGXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBR8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAefHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgE3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIB18fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAXfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgG3x8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBF8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAcfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggGXx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBR8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAVfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBh8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAWfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggIHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIB98fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSASfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgGnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIB18fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAWfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgEnx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGICB8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAffHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHnx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBV8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAbfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBh8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAXfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgFHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBp8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCATfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgGXx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBx8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAefHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgHHx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBh8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAffHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgHXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBJ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAUfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGnx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBZ8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiARfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgIHx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBV8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAZfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggF3x8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBN8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAbfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgF3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFICB8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAffHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGnx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBx8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAUfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggEXx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBl8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAdfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgE3x8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIB58fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAYfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggEnx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBV8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAbfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBt8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSATfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgGXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBV8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAYfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgF3x8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBJ8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAWfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgIHx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBx8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAafHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgH3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBR8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAdfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgHnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBF8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSARfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBN8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAUfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgFXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBZ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAXfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBl8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAafHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgG3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBx8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAdfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHnx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB98fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAgfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgH3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBt8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAVfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBp8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAgfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggHnx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBd8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiASfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBF8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByATfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBh8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAWfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgISAhKQMAIAEgCYWFNwMAICIgIikDACACIAqFhTcDACAjICMpAwAgAyALhYU3AwAgJCAkKQMAIAQgDIWFNwMAICUgJSkDACAFIA2FhTcDACAmICYpAwAgBiAOhYU3AwAgJyAnKQMAIAcgD4WFNwMAICggKCkDACAIIBCFhTcDAAs=")}},function(){return t||(0,a[Object.keys(a)[0]])((t={exports:{}}).exports,t),t.exports})(),d=WebAssembly.compile(f);e.exports=async e=>(await WebAssembly.instantiate(await d,e)).exports},51685:(e,a,t)=>{var c=t(86889),f=t(35682),d=null,r="undefined"!=typeof WebAssembly&&t(91892)().then((e=>{d=e})),n=64,i=[];e.exports=p;var b=e.exports.BYTES_MIN=16,o=e.exports.BYTES_MAX=64,s=(e.exports.BYTES=32,e.exports.KEYBYTES_MIN=16),l=e.exports.KEYBYTES_MAX=64,u=(e.exports.KEYBYTES=32,e.exports.SALTBYTES=16),h=e.exports.PERSONALBYTES=16;function p(e,a,t,f,r){if(!(this instanceof p))return new p(e,a,t,f,r);if(!d)throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");e||(e=32),!0!==r&&(c(e>=b,"digestLength must be at least "+b+", was given "+e),c(e<=o,"digestLength must be at most "+o+", was given "+e),null!=a&&(c(a instanceof Uint8Array,"key must be Uint8Array or Buffer"),c(a.length>=s,"key must be at least "+s+", was given "+a.length),c(a.length<=l,"key must be at least "+l+", was given "+a.length)),null!=t&&(c(t instanceof Uint8Array,"salt must be Uint8Array or Buffer"),c(t.length===u,"salt must be exactly "+u+", was given "+t.length)),null!=f&&(c(f instanceof Uint8Array,"personal must be Uint8Array or Buffer"),c(f.length===h,"personal must be exactly "+h+", was given "+f.length))),i.length||(i.push(n),n+=216),this.digestLength=e,this.finalized=!1,this.pointer=i.pop(),this._memory=new Uint8Array(d.memory.buffer),this._memory.fill(0,0,64),this._memory[0]=this.digestLength,this._memory[1]=a?a.length:0,this._memory[2]=1,this._memory[3]=1,t&&this._memory.set(t,32),f&&this._memory.set(f,48),this.pointer+216>this._memory.length&&this._realloc(this.pointer+216),d.blake2b_init(this.pointer,this.digestLength),a&&(this.update(a),this._memory.fill(0,n,n+a.length),this._memory[this.pointer+200]=128)}function g(){}p.prototype._realloc=function(e){d.memory.grow(Math.max(0,Math.ceil(Math.abs(e-this._memory.length)/65536))),this._memory=new Uint8Array(d.memory.buffer)},p.prototype.update=function(e){return c(!1===this.finalized,"Hash instance finalized"),c(e instanceof Uint8Array,"input must be Uint8Array or Buffer"),n+e.length>this._memory.length&&this._realloc(n+e.length),this._memory.set(e,n),d.blake2b_update(this.pointer,n,n+e.length),this},p.prototype.digest=function(e){if(c(!1===this.finalized,"Hash instance finalized"),this.finalized=!0,i.push(this.pointer),d.blake2b_final(this.pointer),!e||"binary"===e)return this._memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if("string"==typeof e)return f.toString(this._memory,e,this.pointer+128,this.pointer+128+this.digestLength);c(e instanceof Uint8Array&&e.length>=this.digestLength,"input must be Uint8Array or Buffer");for(var a=0;ae()),e):e(new Error("WebAssembly not supported"))},p.prototype.ready=p.ready,p.prototype.getPartialHash=function(){return this._memory.slice(this.pointer,this.pointer+216)},p.prototype.setPartialHash=function(e){this._memory.set(e,this.pointer)}},72206:(e,a,t)=>{var c=t(86889),f=t(51685);function d(e,a,t){var c=e[a]+e[t],f=e[a+1]+e[t+1];c>=4294967296&&f++,e[a]=c,e[a+1]=f}function r(e,a,t,c){var f=e[a]+t;t<0&&(f+=4294967296);var d=e[a+1]+c;f>=4294967296&&d++,e[a]=f,e[a+1]=d}function n(e,a){return e[a]^e[a+1]<<8^e[a+2]<<16^e[a+3]<<24}function i(e,a,t,c,f,n){var i=l[f],b=l[f+1],o=l[n],u=l[n+1];d(s,e,a),r(s,e,i,b);var h=s[c]^s[e],p=s[c+1]^s[e+1];s[c]=p,s[c+1]=h,d(s,t,c),h=s[a]^s[t],p=s[a+1]^s[t+1],s[a]=h>>>24^p<<8,s[a+1]=p>>>24^h<<8,d(s,e,a),r(s,e,o,u),h=s[c]^s[e],p=s[c+1]^s[e+1],s[c]=h>>>16^p<<16,s[c+1]=p>>>16^h<<16,d(s,t,c),h=s[a]^s[t],p=s[a+1]^s[t+1],s[a]=p>>>31^h<<1,s[a+1]=h>>>31^p<<1}var b=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),o=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map((function(e){return 2*e}))),s=new Uint32Array(32),l=new Uint32Array(32);function u(e,a){var t=0;for(t=0;t<16;t++)s[t]=e.h[t],s[t+16]=b[t];for(s[24]=s[24]^e.t,s[25]=s[25]^e.t/4294967296,a&&(s[28]=~s[28],s[29]=~s[29]),t=0;t<32;t++)l[t]=n(e.b,4*t);for(t=0;t<12;t++)i(0,8,16,24,o[16*t+0],o[16*t+1]),i(2,10,18,26,o[16*t+2],o[16*t+3]),i(4,12,20,28,o[16*t+4],o[16*t+5]),i(6,14,22,30,o[16*t+6],o[16*t+7]),i(0,10,20,30,o[16*t+8],o[16*t+9]),i(2,12,22,24,o[16*t+10],o[16*t+11]),i(4,14,16,26,o[16*t+12],o[16*t+13]),i(6,8,18,28,o[16*t+14],o[16*t+15]);for(t=0;t<16;t++)e.h[t]=e.h[t]^s[t]^s[t+16]}var h=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function p(e,a,t,c){h.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=e,h[0]=e,a&&(h[1]=a.length),h[2]=1,h[3]=1,t&&h.set(t,32),c&&h.set(c,48);for(var f=0;f<16;f++)this.h[f]=b[f]^n(h,4*f);a&&(g(this,a),this.c=128)}function g(e,a){for(var t=0;t=this.outlen,"out must have at least outlen bytes of space"),function(e,a){for(e.t+=e.c;e.c<128;)e.b[e.c++]=0;u(e,!0);for(var t=0;t>2]>>8*(3&t)}(this,a),"hex"===e?function(e){for(var a="",t=0;t=x,"outlen must be at least "+x+", was given "+e),c(e<=y,"outlen must be at most "+y+", was given "+e),null!=a&&(c(a instanceof Uint8Array,"key must be Uint8Array or Buffer"),c(a.length>=A,"key must be at least "+A+", was given "+a.length),c(a.length<=v,"key must be at most "+v+", was given "+a.length)),null!=t&&(c(t instanceof Uint8Array,"salt must be Uint8Array or Buffer"),c(t.length===w,"salt must be exactly "+w+", was given "+t.length)),null!=f&&(c(f instanceof Uint8Array,"personal must be Uint8Array or Buffer"),c(f.length===_,"personal must be exactly "+_+", was given "+f.length))),new m(e,a,t,f)},e.exports.ready=function(e){f.ready((function(){e()}))},e.exports.WASM_SUPPORTED=f.SUPPORTED,e.exports.WASM_LOADED=!1;var x=e.exports.BYTES_MIN=16,y=e.exports.BYTES_MAX=64,A=(e.exports.BYTES=32,e.exports.KEYBYTES_MIN=16),v=e.exports.KEYBYTES_MAX=64,w=(e.exports.KEYBYTES=32,e.exports.SALTBYTES=16),_=e.exports.PERSONALBYTES=16;f.ready((function(a){a||(e.exports.WASM_LOADED=!0,e.exports=f)}))},39404:function(e,a,t){!function(e,a){"use strict";function c(e,a){if(!e)throw new Error(a||"Assertion failed")}function f(e,a){e.super_=a;var t=function(){};t.prototype=a.prototype,e.prototype=new t,e.prototype.constructor=e}function d(e,a,t){if(d.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==a&&"be"!==a||(t=a,a=10),this._init(e||0,a||10,t||"be"))}var r;"object"==typeof e?e.exports=d:a.BN=d,d.BN=d,d.wordSize=26;try{r="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:t(47790).Buffer}catch(e){}function n(e,a){var t=e.charCodeAt(a);return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:void c(!1,"Invalid character in "+e)}function i(e,a,t){var c=n(e,t);return t-1>=a&&(c|=n(e,t-1)<<4),c}function b(e,a,t,f){for(var d=0,r=0,n=Math.min(e.length,t),i=a;i=49?b-49+10:b>=17?b-17+10:b,c(b>=0&&r0?e:a},d.min=function(e,a){return e.cmp(a)<0?e:a},d.prototype._init=function(e,a,t){if("number"==typeof e)return this._initNumber(e,a,t);if("object"==typeof e)return this._initArray(e,a,t);"hex"===a&&(a=16),c(a===(0|a)&&a>=2&&a<=36);var f=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(f++,this.negative=1),f=0;f-=3)r=e[f]|e[f-1]<<8|e[f-2]<<16,this.words[d]|=r<>>26-n&67108863,(n+=24)>=26&&(n-=26,d++);else if("le"===t)for(f=0,d=0;f>>26-n&67108863,(n+=24)>=26&&(n-=26,d++);return this._strip()},d.prototype._parseHex=function(e,a,t){this.length=Math.ceil((e.length-a)/6),this.words=new Array(this.length);for(var c=0;c=a;c-=2)f=i(e,a,c)<=18?(d-=18,r+=1,this.words[r]|=f>>>26):d+=8;else for(c=(e.length-a)%2==0?a+1:a;c=18?(d-=18,r+=1,this.words[r]|=f>>>26):d+=8;this._strip()},d.prototype._parseBase=function(e,a,t){this.words=[0],this.length=1;for(var c=0,f=1;f<=67108863;f*=a)c++;c--,f=f/a|0;for(var d=e.length-t,r=d%c,n=Math.min(d,d-r)+t,i=0,o=t;o1&&0===this.words[this.length-1];)this.length--;return this._normSign()},d.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{d.prototype[Symbol.for("nodejs.util.inspect.custom")]=s}catch(e){d.prototype.inspect=s}else d.prototype.inspect=s;function s(){return(this.red?""}var l=["","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"],u=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function p(e,a,t){t.negative=a.negative^e.negative;var c=e.length+a.length|0;t.length=c,c=c-1|0;var f=0|e.words[0],d=0|a.words[0],r=f*d,n=67108863&r,i=r/67108864|0;t.words[0]=n;for(var b=1;b>>26,s=67108863&i,l=Math.min(b,a.length-1),u=Math.max(0,b-e.length+1);u<=l;u++){var h=b-u|0;o+=(r=(f=0|e.words[h])*(d=0|a.words[u])+s)/67108864|0,s=67108863&r}t.words[b]=0|s,i=0|o}return 0!==i?t.words[b]=0|i:t.length--,t._strip()}d.prototype.toString=function(e,a){var t;if(a=0|a||1,16===(e=e||10)||"hex"===e){t="";for(var f=0,d=0,r=0;r>>24-f&16777215,(f+=2)>=26&&(f-=26,r--),t=0!==d||r!==this.length-1?l[6-i.length]+i+t:i+t}for(0!==d&&(t=d.toString(16)+t);t.length%a!=0;)t="0"+t;return 0!==this.negative&&(t="-"+t),t}if(e===(0|e)&&e>=2&&e<=36){var b=u[e],o=h[e];t="";var s=this.clone();for(s.negative=0;!s.isZero();){var p=s.modrn(o).toString(e);t=(s=s.idivn(o)).isZero()?p+t:l[b-p.length]+p+t}for(this.isZero()&&(t="0"+t);t.length%a!=0;)t="0"+t;return 0!==this.negative&&(t="-"+t),t}c(!1,"Base should be between 2 and 36")},d.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&c(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},d.prototype.toJSON=function(){return this.toString(16,2)},r&&(d.prototype.toBuffer=function(e,a){return this.toArrayLike(r,e,a)}),d.prototype.toArray=function(e,a){return this.toArrayLike(Array,e,a)},d.prototype.toArrayLike=function(e,a,t){this._strip();var f=this.byteLength(),d=t||Math.max(1,f);c(f<=d,"byte array longer than desired length"),c(d>0,"Requested array length <= 0");var r=function(e,a){return e.allocUnsafe?e.allocUnsafe(a):new e(a)}(e,d);return this["_toArrayLike"+("le"===a?"LE":"BE")](r,f),r},d.prototype._toArrayLikeLE=function(e,a){for(var t=0,c=0,f=0,d=0;f>8&255),t>16&255),6===d?(t>24&255),c=0,d=0):(c=r>>>24,d+=2)}if(t=0&&(e[t--]=r>>8&255),t>=0&&(e[t--]=r>>16&255),6===d?(t>=0&&(e[t--]=r>>24&255),c=0,d=0):(c=r>>>24,d+=2)}if(t>=0)for(e[t--]=c;t>=0;)e[t--]=0},Math.clz32?d.prototype._countBits=function(e){return 32-Math.clz32(e)}:d.prototype._countBits=function(e){var a=e,t=0;return a>=4096&&(t+=13,a>>>=13),a>=64&&(t+=7,a>>>=7),a>=8&&(t+=4,a>>>=4),a>=2&&(t+=2,a>>>=2),t+a},d.prototype._zeroBits=function(e){if(0===e)return 26;var a=e,t=0;return 8191&a||(t+=13,a>>>=13),127&a||(t+=7,a>>>=7),15&a||(t+=4,a>>>=4),3&a||(t+=2,a>>>=2),1&a||t++,t},d.prototype.bitLength=function(){var e=this.words[this.length-1],a=this._countBits(e);return 26*(this.length-1)+a},d.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,a=0;ae.length?this.clone().ior(e):e.clone().ior(this)},d.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},d.prototype.iuand=function(e){var a;a=this.length>e.length?e:this;for(var t=0;te.length?this.clone().iand(e):e.clone().iand(this)},d.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},d.prototype.iuxor=function(e){var a,t;this.length>e.length?(a=this,t=e):(a=e,t=this);for(var c=0;ce.length?this.clone().ixor(e):e.clone().ixor(this)},d.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},d.prototype.inotn=function(e){c("number"==typeof e&&e>=0);var a=0|Math.ceil(e/26),t=e%26;this._expand(a),t>0&&a--;for(var f=0;f0&&(this.words[f]=~this.words[f]&67108863>>26-t),this._strip()},d.prototype.notn=function(e){return this.clone().inotn(e)},d.prototype.setn=function(e,a){c("number"==typeof e&&e>=0);var t=e/26|0,f=e%26;return this._expand(t+1),this.words[t]=a?this.words[t]|1<e.length?(t=this,c=e):(t=e,c=this);for(var f=0,d=0;d>>26;for(;0!==f&&d>>26;if(this.length=t.length,0!==f)this.words[this.length]=f,this.length++;else if(t!==this)for(;de.length?this.clone().iadd(e):e.clone().iadd(this)},d.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var a=this.iadd(e);return e.negative=1,a._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var t,c,f=this.cmp(e);if(0===f)return this.negative=0,this.length=1,this.words[0]=0,this;f>0?(t=this,c=e):(t=e,c=this);for(var d=0,r=0;r>26,this.words[r]=67108863&a;for(;0!==d&&r>26,this.words[r]=67108863&a;if(0===d&&r>>13,u=0|r[1],h=8191&u,p=u>>>13,g=0|r[2],m=8191&g,x=g>>>13,y=0|r[3],A=8191&y,v=y>>>13,w=0|r[4],_=8191&w,I=w>>>13,E=0|r[5],C=8191&E,M=E>>>13,B=0|r[6],k=8191&B,L=B>>>13,S=0|r[7],T=8191&S,N=S>>>13,R=0|r[8],P=8191&R,D=R>>>13,O=0|r[9],F=8191&O,Q=O>>>13,U=0|n[0],j=8191&U,H=U>>>13,q=0|n[1],$=8191&q,z=q>>>13,G=0|n[2],K=8191&G,V=G>>>13,Z=0|n[3],J=8191&Z,W=Z>>>13,Y=0|n[4],X=8191&Y,ee=Y>>>13,ae=0|n[5],te=8191&ae,ce=ae>>>13,fe=0|n[6],de=8191&fe,re=fe>>>13,ne=0|n[7],ie=8191&ne,be=ne>>>13,oe=0|n[8],se=8191&oe,le=oe>>>13,ue=0|n[9],he=8191&ue,pe=ue>>>13;t.negative=e.negative^a.negative,t.length=19;var ge=(b+(c=Math.imul(s,j))|0)+((8191&(f=(f=Math.imul(s,H))+Math.imul(l,j)|0))<<13)|0;b=((d=Math.imul(l,H))+(f>>>13)|0)+(ge>>>26)|0,ge&=67108863,c=Math.imul(h,j),f=(f=Math.imul(h,H))+Math.imul(p,j)|0,d=Math.imul(p,H);var me=(b+(c=c+Math.imul(s,$)|0)|0)+((8191&(f=(f=f+Math.imul(s,z)|0)+Math.imul(l,$)|0))<<13)|0;b=((d=d+Math.imul(l,z)|0)+(f>>>13)|0)+(me>>>26)|0,me&=67108863,c=Math.imul(m,j),f=(f=Math.imul(m,H))+Math.imul(x,j)|0,d=Math.imul(x,H),c=c+Math.imul(h,$)|0,f=(f=f+Math.imul(h,z)|0)+Math.imul(p,$)|0,d=d+Math.imul(p,z)|0;var xe=(b+(c=c+Math.imul(s,K)|0)|0)+((8191&(f=(f=f+Math.imul(s,V)|0)+Math.imul(l,K)|0))<<13)|0;b=((d=d+Math.imul(l,V)|0)+(f>>>13)|0)+(xe>>>26)|0,xe&=67108863,c=Math.imul(A,j),f=(f=Math.imul(A,H))+Math.imul(v,j)|0,d=Math.imul(v,H),c=c+Math.imul(m,$)|0,f=(f=f+Math.imul(m,z)|0)+Math.imul(x,$)|0,d=d+Math.imul(x,z)|0,c=c+Math.imul(h,K)|0,f=(f=f+Math.imul(h,V)|0)+Math.imul(p,K)|0,d=d+Math.imul(p,V)|0;var ye=(b+(c=c+Math.imul(s,J)|0)|0)+((8191&(f=(f=f+Math.imul(s,W)|0)+Math.imul(l,J)|0))<<13)|0;b=((d=d+Math.imul(l,W)|0)+(f>>>13)|0)+(ye>>>26)|0,ye&=67108863,c=Math.imul(_,j),f=(f=Math.imul(_,H))+Math.imul(I,j)|0,d=Math.imul(I,H),c=c+Math.imul(A,$)|0,f=(f=f+Math.imul(A,z)|0)+Math.imul(v,$)|0,d=d+Math.imul(v,z)|0,c=c+Math.imul(m,K)|0,f=(f=f+Math.imul(m,V)|0)+Math.imul(x,K)|0,d=d+Math.imul(x,V)|0,c=c+Math.imul(h,J)|0,f=(f=f+Math.imul(h,W)|0)+Math.imul(p,J)|0,d=d+Math.imul(p,W)|0;var Ae=(b+(c=c+Math.imul(s,X)|0)|0)+((8191&(f=(f=f+Math.imul(s,ee)|0)+Math.imul(l,X)|0))<<13)|0;b=((d=d+Math.imul(l,ee)|0)+(f>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,c=Math.imul(C,j),f=(f=Math.imul(C,H))+Math.imul(M,j)|0,d=Math.imul(M,H),c=c+Math.imul(_,$)|0,f=(f=f+Math.imul(_,z)|0)+Math.imul(I,$)|0,d=d+Math.imul(I,z)|0,c=c+Math.imul(A,K)|0,f=(f=f+Math.imul(A,V)|0)+Math.imul(v,K)|0,d=d+Math.imul(v,V)|0,c=c+Math.imul(m,J)|0,f=(f=f+Math.imul(m,W)|0)+Math.imul(x,J)|0,d=d+Math.imul(x,W)|0,c=c+Math.imul(h,X)|0,f=(f=f+Math.imul(h,ee)|0)+Math.imul(p,X)|0,d=d+Math.imul(p,ee)|0;var ve=(b+(c=c+Math.imul(s,te)|0)|0)+((8191&(f=(f=f+Math.imul(s,ce)|0)+Math.imul(l,te)|0))<<13)|0;b=((d=d+Math.imul(l,ce)|0)+(f>>>13)|0)+(ve>>>26)|0,ve&=67108863,c=Math.imul(k,j),f=(f=Math.imul(k,H))+Math.imul(L,j)|0,d=Math.imul(L,H),c=c+Math.imul(C,$)|0,f=(f=f+Math.imul(C,z)|0)+Math.imul(M,$)|0,d=d+Math.imul(M,z)|0,c=c+Math.imul(_,K)|0,f=(f=f+Math.imul(_,V)|0)+Math.imul(I,K)|0,d=d+Math.imul(I,V)|0,c=c+Math.imul(A,J)|0,f=(f=f+Math.imul(A,W)|0)+Math.imul(v,J)|0,d=d+Math.imul(v,W)|0,c=c+Math.imul(m,X)|0,f=(f=f+Math.imul(m,ee)|0)+Math.imul(x,X)|0,d=d+Math.imul(x,ee)|0,c=c+Math.imul(h,te)|0,f=(f=f+Math.imul(h,ce)|0)+Math.imul(p,te)|0,d=d+Math.imul(p,ce)|0;var we=(b+(c=c+Math.imul(s,de)|0)|0)+((8191&(f=(f=f+Math.imul(s,re)|0)+Math.imul(l,de)|0))<<13)|0;b=((d=d+Math.imul(l,re)|0)+(f>>>13)|0)+(we>>>26)|0,we&=67108863,c=Math.imul(T,j),f=(f=Math.imul(T,H))+Math.imul(N,j)|0,d=Math.imul(N,H),c=c+Math.imul(k,$)|0,f=(f=f+Math.imul(k,z)|0)+Math.imul(L,$)|0,d=d+Math.imul(L,z)|0,c=c+Math.imul(C,K)|0,f=(f=f+Math.imul(C,V)|0)+Math.imul(M,K)|0,d=d+Math.imul(M,V)|0,c=c+Math.imul(_,J)|0,f=(f=f+Math.imul(_,W)|0)+Math.imul(I,J)|0,d=d+Math.imul(I,W)|0,c=c+Math.imul(A,X)|0,f=(f=f+Math.imul(A,ee)|0)+Math.imul(v,X)|0,d=d+Math.imul(v,ee)|0,c=c+Math.imul(m,te)|0,f=(f=f+Math.imul(m,ce)|0)+Math.imul(x,te)|0,d=d+Math.imul(x,ce)|0,c=c+Math.imul(h,de)|0,f=(f=f+Math.imul(h,re)|0)+Math.imul(p,de)|0,d=d+Math.imul(p,re)|0;var _e=(b+(c=c+Math.imul(s,ie)|0)|0)+((8191&(f=(f=f+Math.imul(s,be)|0)+Math.imul(l,ie)|0))<<13)|0;b=((d=d+Math.imul(l,be)|0)+(f>>>13)|0)+(_e>>>26)|0,_e&=67108863,c=Math.imul(P,j),f=(f=Math.imul(P,H))+Math.imul(D,j)|0,d=Math.imul(D,H),c=c+Math.imul(T,$)|0,f=(f=f+Math.imul(T,z)|0)+Math.imul(N,$)|0,d=d+Math.imul(N,z)|0,c=c+Math.imul(k,K)|0,f=(f=f+Math.imul(k,V)|0)+Math.imul(L,K)|0,d=d+Math.imul(L,V)|0,c=c+Math.imul(C,J)|0,f=(f=f+Math.imul(C,W)|0)+Math.imul(M,J)|0,d=d+Math.imul(M,W)|0,c=c+Math.imul(_,X)|0,f=(f=f+Math.imul(_,ee)|0)+Math.imul(I,X)|0,d=d+Math.imul(I,ee)|0,c=c+Math.imul(A,te)|0,f=(f=f+Math.imul(A,ce)|0)+Math.imul(v,te)|0,d=d+Math.imul(v,ce)|0,c=c+Math.imul(m,de)|0,f=(f=f+Math.imul(m,re)|0)+Math.imul(x,de)|0,d=d+Math.imul(x,re)|0,c=c+Math.imul(h,ie)|0,f=(f=f+Math.imul(h,be)|0)+Math.imul(p,ie)|0,d=d+Math.imul(p,be)|0;var Ie=(b+(c=c+Math.imul(s,se)|0)|0)+((8191&(f=(f=f+Math.imul(s,le)|0)+Math.imul(l,se)|0))<<13)|0;b=((d=d+Math.imul(l,le)|0)+(f>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,c=Math.imul(F,j),f=(f=Math.imul(F,H))+Math.imul(Q,j)|0,d=Math.imul(Q,H),c=c+Math.imul(P,$)|0,f=(f=f+Math.imul(P,z)|0)+Math.imul(D,$)|0,d=d+Math.imul(D,z)|0,c=c+Math.imul(T,K)|0,f=(f=f+Math.imul(T,V)|0)+Math.imul(N,K)|0,d=d+Math.imul(N,V)|0,c=c+Math.imul(k,J)|0,f=(f=f+Math.imul(k,W)|0)+Math.imul(L,J)|0,d=d+Math.imul(L,W)|0,c=c+Math.imul(C,X)|0,f=(f=f+Math.imul(C,ee)|0)+Math.imul(M,X)|0,d=d+Math.imul(M,ee)|0,c=c+Math.imul(_,te)|0,f=(f=f+Math.imul(_,ce)|0)+Math.imul(I,te)|0,d=d+Math.imul(I,ce)|0,c=c+Math.imul(A,de)|0,f=(f=f+Math.imul(A,re)|0)+Math.imul(v,de)|0,d=d+Math.imul(v,re)|0,c=c+Math.imul(m,ie)|0,f=(f=f+Math.imul(m,be)|0)+Math.imul(x,ie)|0,d=d+Math.imul(x,be)|0,c=c+Math.imul(h,se)|0,f=(f=f+Math.imul(h,le)|0)+Math.imul(p,se)|0,d=d+Math.imul(p,le)|0;var Ee=(b+(c=c+Math.imul(s,he)|0)|0)+((8191&(f=(f=f+Math.imul(s,pe)|0)+Math.imul(l,he)|0))<<13)|0;b=((d=d+Math.imul(l,pe)|0)+(f>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,c=Math.imul(F,$),f=(f=Math.imul(F,z))+Math.imul(Q,$)|0,d=Math.imul(Q,z),c=c+Math.imul(P,K)|0,f=(f=f+Math.imul(P,V)|0)+Math.imul(D,K)|0,d=d+Math.imul(D,V)|0,c=c+Math.imul(T,J)|0,f=(f=f+Math.imul(T,W)|0)+Math.imul(N,J)|0,d=d+Math.imul(N,W)|0,c=c+Math.imul(k,X)|0,f=(f=f+Math.imul(k,ee)|0)+Math.imul(L,X)|0,d=d+Math.imul(L,ee)|0,c=c+Math.imul(C,te)|0,f=(f=f+Math.imul(C,ce)|0)+Math.imul(M,te)|0,d=d+Math.imul(M,ce)|0,c=c+Math.imul(_,de)|0,f=(f=f+Math.imul(_,re)|0)+Math.imul(I,de)|0,d=d+Math.imul(I,re)|0,c=c+Math.imul(A,ie)|0,f=(f=f+Math.imul(A,be)|0)+Math.imul(v,ie)|0,d=d+Math.imul(v,be)|0,c=c+Math.imul(m,se)|0,f=(f=f+Math.imul(m,le)|0)+Math.imul(x,se)|0,d=d+Math.imul(x,le)|0;var Ce=(b+(c=c+Math.imul(h,he)|0)|0)+((8191&(f=(f=f+Math.imul(h,pe)|0)+Math.imul(p,he)|0))<<13)|0;b=((d=d+Math.imul(p,pe)|0)+(f>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,c=Math.imul(F,K),f=(f=Math.imul(F,V))+Math.imul(Q,K)|0,d=Math.imul(Q,V),c=c+Math.imul(P,J)|0,f=(f=f+Math.imul(P,W)|0)+Math.imul(D,J)|0,d=d+Math.imul(D,W)|0,c=c+Math.imul(T,X)|0,f=(f=f+Math.imul(T,ee)|0)+Math.imul(N,X)|0,d=d+Math.imul(N,ee)|0,c=c+Math.imul(k,te)|0,f=(f=f+Math.imul(k,ce)|0)+Math.imul(L,te)|0,d=d+Math.imul(L,ce)|0,c=c+Math.imul(C,de)|0,f=(f=f+Math.imul(C,re)|0)+Math.imul(M,de)|0,d=d+Math.imul(M,re)|0,c=c+Math.imul(_,ie)|0,f=(f=f+Math.imul(_,be)|0)+Math.imul(I,ie)|0,d=d+Math.imul(I,be)|0,c=c+Math.imul(A,se)|0,f=(f=f+Math.imul(A,le)|0)+Math.imul(v,se)|0,d=d+Math.imul(v,le)|0;var Me=(b+(c=c+Math.imul(m,he)|0)|0)+((8191&(f=(f=f+Math.imul(m,pe)|0)+Math.imul(x,he)|0))<<13)|0;b=((d=d+Math.imul(x,pe)|0)+(f>>>13)|0)+(Me>>>26)|0,Me&=67108863,c=Math.imul(F,J),f=(f=Math.imul(F,W))+Math.imul(Q,J)|0,d=Math.imul(Q,W),c=c+Math.imul(P,X)|0,f=(f=f+Math.imul(P,ee)|0)+Math.imul(D,X)|0,d=d+Math.imul(D,ee)|0,c=c+Math.imul(T,te)|0,f=(f=f+Math.imul(T,ce)|0)+Math.imul(N,te)|0,d=d+Math.imul(N,ce)|0,c=c+Math.imul(k,de)|0,f=(f=f+Math.imul(k,re)|0)+Math.imul(L,de)|0,d=d+Math.imul(L,re)|0,c=c+Math.imul(C,ie)|0,f=(f=f+Math.imul(C,be)|0)+Math.imul(M,ie)|0,d=d+Math.imul(M,be)|0,c=c+Math.imul(_,se)|0,f=(f=f+Math.imul(_,le)|0)+Math.imul(I,se)|0,d=d+Math.imul(I,le)|0;var Be=(b+(c=c+Math.imul(A,he)|0)|0)+((8191&(f=(f=f+Math.imul(A,pe)|0)+Math.imul(v,he)|0))<<13)|0;b=((d=d+Math.imul(v,pe)|0)+(f>>>13)|0)+(Be>>>26)|0,Be&=67108863,c=Math.imul(F,X),f=(f=Math.imul(F,ee))+Math.imul(Q,X)|0,d=Math.imul(Q,ee),c=c+Math.imul(P,te)|0,f=(f=f+Math.imul(P,ce)|0)+Math.imul(D,te)|0,d=d+Math.imul(D,ce)|0,c=c+Math.imul(T,de)|0,f=(f=f+Math.imul(T,re)|0)+Math.imul(N,de)|0,d=d+Math.imul(N,re)|0,c=c+Math.imul(k,ie)|0,f=(f=f+Math.imul(k,be)|0)+Math.imul(L,ie)|0,d=d+Math.imul(L,be)|0,c=c+Math.imul(C,se)|0,f=(f=f+Math.imul(C,le)|0)+Math.imul(M,se)|0,d=d+Math.imul(M,le)|0;var ke=(b+(c=c+Math.imul(_,he)|0)|0)+((8191&(f=(f=f+Math.imul(_,pe)|0)+Math.imul(I,he)|0))<<13)|0;b=((d=d+Math.imul(I,pe)|0)+(f>>>13)|0)+(ke>>>26)|0,ke&=67108863,c=Math.imul(F,te),f=(f=Math.imul(F,ce))+Math.imul(Q,te)|0,d=Math.imul(Q,ce),c=c+Math.imul(P,de)|0,f=(f=f+Math.imul(P,re)|0)+Math.imul(D,de)|0,d=d+Math.imul(D,re)|0,c=c+Math.imul(T,ie)|0,f=(f=f+Math.imul(T,be)|0)+Math.imul(N,ie)|0,d=d+Math.imul(N,be)|0,c=c+Math.imul(k,se)|0,f=(f=f+Math.imul(k,le)|0)+Math.imul(L,se)|0,d=d+Math.imul(L,le)|0;var Le=(b+(c=c+Math.imul(C,he)|0)|0)+((8191&(f=(f=f+Math.imul(C,pe)|0)+Math.imul(M,he)|0))<<13)|0;b=((d=d+Math.imul(M,pe)|0)+(f>>>13)|0)+(Le>>>26)|0,Le&=67108863,c=Math.imul(F,de),f=(f=Math.imul(F,re))+Math.imul(Q,de)|0,d=Math.imul(Q,re),c=c+Math.imul(P,ie)|0,f=(f=f+Math.imul(P,be)|0)+Math.imul(D,ie)|0,d=d+Math.imul(D,be)|0,c=c+Math.imul(T,se)|0,f=(f=f+Math.imul(T,le)|0)+Math.imul(N,se)|0,d=d+Math.imul(N,le)|0;var Se=(b+(c=c+Math.imul(k,he)|0)|0)+((8191&(f=(f=f+Math.imul(k,pe)|0)+Math.imul(L,he)|0))<<13)|0;b=((d=d+Math.imul(L,pe)|0)+(f>>>13)|0)+(Se>>>26)|0,Se&=67108863,c=Math.imul(F,ie),f=(f=Math.imul(F,be))+Math.imul(Q,ie)|0,d=Math.imul(Q,be),c=c+Math.imul(P,se)|0,f=(f=f+Math.imul(P,le)|0)+Math.imul(D,se)|0,d=d+Math.imul(D,le)|0;var Te=(b+(c=c+Math.imul(T,he)|0)|0)+((8191&(f=(f=f+Math.imul(T,pe)|0)+Math.imul(N,he)|0))<<13)|0;b=((d=d+Math.imul(N,pe)|0)+(f>>>13)|0)+(Te>>>26)|0,Te&=67108863,c=Math.imul(F,se),f=(f=Math.imul(F,le))+Math.imul(Q,se)|0,d=Math.imul(Q,le);var Ne=(b+(c=c+Math.imul(P,he)|0)|0)+((8191&(f=(f=f+Math.imul(P,pe)|0)+Math.imul(D,he)|0))<<13)|0;b=((d=d+Math.imul(D,pe)|0)+(f>>>13)|0)+(Ne>>>26)|0,Ne&=67108863;var Re=(b+(c=Math.imul(F,he))|0)+((8191&(f=(f=Math.imul(F,pe))+Math.imul(Q,he)|0))<<13)|0;return b=((d=Math.imul(Q,pe))+(f>>>13)|0)+(Re>>>26)|0,Re&=67108863,i[0]=ge,i[1]=me,i[2]=xe,i[3]=ye,i[4]=Ae,i[5]=ve,i[6]=we,i[7]=_e,i[8]=Ie,i[9]=Ee,i[10]=Ce,i[11]=Me,i[12]=Be,i[13]=ke,i[14]=Le,i[15]=Se,i[16]=Te,i[17]=Ne,i[18]=Re,0!==b&&(i[19]=b,t.length++),t};function m(e,a,t){t.negative=a.negative^e.negative,t.length=e.length+a.length;for(var c=0,f=0,d=0;d>>26)|0)>>>26,r&=67108863}t.words[d]=n,c=r,r=f}return 0!==c?t.words[d]=c:t.length--,t._strip()}function x(e,a,t){return m(e,a,t)}function y(e,a){this.x=e,this.y=a}Math.imul||(g=p),d.prototype.mulTo=function(e,a){var t=this.length+e.length;return 10===this.length&&10===e.length?g(this,e,a):t<63?p(this,e,a):t<1024?m(this,e,a):x(this,e,a)},y.prototype.makeRBT=function(e){for(var a=new Array(e),t=d.prototype._countBits(e)-1,c=0;c>=1;return c},y.prototype.permute=function(e,a,t,c,f,d){for(var r=0;r>>=1)f++;return 1<>>=13,t[2*r+1]=8191&d,d>>>=13;for(r=2*a;r>=26,t+=d/67108864|0,t+=r>>>26,this.words[f]=67108863&r}return 0!==t&&(this.words[f]=t,this.length++),a?this.ineg():this},d.prototype.muln=function(e){return this.clone().imuln(e)},d.prototype.sqr=function(){return this.mul(this)},d.prototype.isqr=function(){return this.imul(this.clone())},d.prototype.pow=function(e){var a=function(e){for(var a=new Array(e.bitLength()),t=0;t>>f&1}return a}(e);if(0===a.length)return new d(1);for(var t=this,c=0;c=0);var a,t=e%26,f=(e-t)/26,d=67108863>>>26-t<<26-t;if(0!==t){var r=0;for(a=0;a>>26-t}r&&(this.words[a]=r,this.length++)}if(0!==f){for(a=this.length-1;a>=0;a--)this.words[a+f]=this.words[a];for(a=0;a=0),f=a?(a-a%26)/26:0;var d=e%26,r=Math.min((e-d)/26,this.length),n=67108863^67108863>>>d<r)for(this.length-=r,b=0;b=0&&(0!==o||b>=f);b--){var s=0|this.words[b];this.words[b]=o<<26-d|s>>>d,o=s&n}return i&&0!==o&&(i.words[i.length++]=o),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},d.prototype.ishrn=function(e,a,t){return c(0===this.negative),this.iushrn(e,a,t)},d.prototype.shln=function(e){return this.clone().ishln(e)},d.prototype.ushln=function(e){return this.clone().iushln(e)},d.prototype.shrn=function(e){return this.clone().ishrn(e)},d.prototype.ushrn=function(e){return this.clone().iushrn(e)},d.prototype.testn=function(e){c("number"==typeof e&&e>=0);var a=e%26,t=(e-a)/26,f=1<=0);var a=e%26,t=(e-a)/26;if(c(0===this.negative,"imaskn works only with positive numbers"),this.length<=t)return this;if(0!==a&&t++,this.length=Math.min(t,this.length),0!==a){var f=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},d.prototype.isubn=function(e){if(c("number"==typeof e),c(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(i/67108864|0),this.words[f+t]=67108863&d}for(;f>26,this.words[f+t]=67108863&d;if(0===n)return this._strip();for(c(-1===n),n=0,f=0;f>26,this.words[f]=67108863&d;return this.negative=1,this._strip()},d.prototype._wordDiv=function(e,a){var t=(this.length,e.length),c=this.clone(),f=e,r=0|f.words[f.length-1];0!=(t=26-this._countBits(r))&&(f=f.ushln(t),c.iushln(t),r=0|f.words[f.length-1]);var n,i=c.length-f.length;if("mod"!==a){(n=new d(null)).length=i+1,n.words=new Array(n.length);for(var b=0;b=0;s--){var l=67108864*(0|c.words[f.length+s])+(0|c.words[f.length+s-1]);for(l=Math.min(l/r|0,67108863),c._ishlnsubmul(f,l,s);0!==c.negative;)l--,c.negative=0,c._ishlnsubmul(f,1,s),c.isZero()||(c.negative^=1);n&&(n.words[s]=l)}return n&&n._strip(),c._strip(),"div"!==a&&0!==t&&c.iushrn(t),{div:n||null,mod:c}},d.prototype.divmod=function(e,a,t){return c(!e.isZero()),this.isZero()?{div:new d(0),mod:new d(0)}:0!==this.negative&&0===e.negative?(n=this.neg().divmod(e,a),"mod"!==a&&(f=n.div.neg()),"div"!==a&&(r=n.mod.neg(),t&&0!==r.negative&&r.iadd(e)),{div:f,mod:r}):0===this.negative&&0!==e.negative?(n=this.divmod(e.neg(),a),"mod"!==a&&(f=n.div.neg()),{div:f,mod:n.mod}):this.negative&e.negative?(n=this.neg().divmod(e.neg(),a),"div"!==a&&(r=n.mod.neg(),t&&0!==r.negative&&r.isub(e)),{div:n.div,mod:r}):e.length>this.length||this.cmp(e)<0?{div:new d(0),mod:this}:1===e.length?"div"===a?{div:this.divn(e.words[0]),mod:null}:"mod"===a?{div:null,mod:new d(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new d(this.modrn(e.words[0]))}:this._wordDiv(e,a);var f,r,n},d.prototype.div=function(e){return this.divmod(e,"div",!1).div},d.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},d.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},d.prototype.divRound=function(e){var a=this.divmod(e);if(a.mod.isZero())return a.div;var t=0!==a.div.negative?a.mod.isub(e):a.mod,c=e.ushrn(1),f=e.andln(1),d=t.cmp(c);return d<0||1===f&&0===d?a.div:0!==a.div.negative?a.div.isubn(1):a.div.iaddn(1)},d.prototype.modrn=function(e){var a=e<0;a&&(e=-e),c(e<=67108863);for(var t=(1<<26)%e,f=0,d=this.length-1;d>=0;d--)f=(t*f+(0|this.words[d]))%e;return a?-f:f},d.prototype.modn=function(e){return this.modrn(e)},d.prototype.idivn=function(e){var a=e<0;a&&(e=-e),c(e<=67108863);for(var t=0,f=this.length-1;f>=0;f--){var d=(0|this.words[f])+67108864*t;this.words[f]=d/e|0,t=d%e}return this._strip(),a?this.ineg():this},d.prototype.divn=function(e){return this.clone().idivn(e)},d.prototype.egcd=function(e){c(0===e.negative),c(!e.isZero());var a=this,t=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var f=new d(1),r=new d(0),n=new d(0),i=new d(1),b=0;a.isEven()&&t.isEven();)a.iushrn(1),t.iushrn(1),++b;for(var o=t.clone(),s=a.clone();!a.isZero();){for(var l=0,u=1;!(a.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(a.iushrn(l);l-- >0;)(f.isOdd()||r.isOdd())&&(f.iadd(o),r.isub(s)),f.iushrn(1),r.iushrn(1);for(var h=0,p=1;!(t.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(n.isOdd()||i.isOdd())&&(n.iadd(o),i.isub(s)),n.iushrn(1),i.iushrn(1);a.cmp(t)>=0?(a.isub(t),f.isub(n),r.isub(i)):(t.isub(a),n.isub(f),i.isub(r))}return{a:n,b:i,gcd:t.iushln(b)}},d.prototype._invmp=function(e){c(0===e.negative),c(!e.isZero());var a=this,t=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var f,r=new d(1),n=new d(0),i=t.clone();a.cmpn(1)>0&&t.cmpn(1)>0;){for(var b=0,o=1;!(a.words[0]&o)&&b<26;++b,o<<=1);if(b>0)for(a.iushrn(b);b-- >0;)r.isOdd()&&r.iadd(i),r.iushrn(1);for(var s=0,l=1;!(t.words[0]&l)&&s<26;++s,l<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(i),n.iushrn(1);a.cmp(t)>=0?(a.isub(t),r.isub(n)):(t.isub(a),n.isub(r))}return(f=0===a.cmpn(1)?r:n).cmpn(0)<0&&f.iadd(e),f},d.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var a=this.clone(),t=e.clone();a.negative=0,t.negative=0;for(var c=0;a.isEven()&&t.isEven();c++)a.iushrn(1),t.iushrn(1);for(;;){for(;a.isEven();)a.iushrn(1);for(;t.isEven();)t.iushrn(1);var f=a.cmp(t);if(f<0){var d=a;a=t,t=d}else if(0===f||0===t.cmpn(1))break;a.isub(t)}return t.iushln(c)},d.prototype.invm=function(e){return this.egcd(e).a.umod(e)},d.prototype.isEven=function(){return!(1&this.words[0])},d.prototype.isOdd=function(){return!(1&~this.words[0])},d.prototype.andln=function(e){return this.words[0]&e},d.prototype.bincn=function(e){c("number"==typeof e);var a=e%26,t=(e-a)/26,f=1<>>26,n&=67108863,this.words[r]=n}return 0!==d&&(this.words[r]=d,this.length++),this},d.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},d.prototype.cmpn=function(e){var a,t=e<0;if(0!==this.negative&&!t)return-1;if(0===this.negative&&t)return 1;if(this._strip(),this.length>1)a=1;else{t&&(e=-e),c(e<=67108863,"Number is too big");var f=0|this.words[0];a=f===e?0:fe.length)return 1;if(this.length=0;t--){var c=0|this.words[t],f=0|e.words[t];if(c!==f){cf&&(a=1);break}}return a},d.prototype.gtn=function(e){return 1===this.cmpn(e)},d.prototype.gt=function(e){return 1===this.cmp(e)},d.prototype.gten=function(e){return this.cmpn(e)>=0},d.prototype.gte=function(e){return this.cmp(e)>=0},d.prototype.ltn=function(e){return-1===this.cmpn(e)},d.prototype.lt=function(e){return-1===this.cmp(e)},d.prototype.lten=function(e){return this.cmpn(e)<=0},d.prototype.lte=function(e){return this.cmp(e)<=0},d.prototype.eqn=function(e){return 0===this.cmpn(e)},d.prototype.eq=function(e){return 0===this.cmp(e)},d.red=function(e){return new C(e)},d.prototype.toRed=function(e){return c(!this.red,"Already a number in reduction context"),c(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},d.prototype.fromRed=function(){return c(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},d.prototype._forceRed=function(e){return this.red=e,this},d.prototype.forceRed=function(e){return c(!this.red,"Already a number in reduction context"),this._forceRed(e)},d.prototype.redAdd=function(e){return c(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},d.prototype.redIAdd=function(e){return c(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},d.prototype.redSub=function(e){return c(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},d.prototype.redISub=function(e){return c(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},d.prototype.redShl=function(e){return c(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},d.prototype.redMul=function(e){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},d.prototype.redIMul=function(e){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},d.prototype.redSqr=function(){return c(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},d.prototype.redISqr=function(){return c(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},d.prototype.redSqrt=function(){return c(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},d.prototype.redInvm=function(){return c(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},d.prototype.redNeg=function(){return c(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},d.prototype.redPow=function(e){return c(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var A={k256:null,p224:null,p192:null,p25519:null};function v(e,a){this.name=e,this.p=new d(a,16),this.n=this.p.bitLength(),this.k=new d(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function I(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function C(e){if("string"==typeof e){var a=d._prime(e);this.m=a.p,this.prime=a}else c(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function M(e){C.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new d(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)}v.prototype._tmp=function(){var e=new d(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var a,t=e;do{this.split(t,this.tmp),a=(t=(t=this.imulK(t)).iadd(this.tmp)).bitLength()}while(a>this.n);var c=a0?t.isub(this.p):void 0!==t.strip?t.strip():t._strip(),t},v.prototype.split=function(e,a){e.iushrn(this.n,0,a)},v.prototype.imulK=function(e){return e.imul(this.k)},f(w,v),w.prototype.split=function(e,a){for(var t=4194303,c=Math.min(e.length,9),f=0;f>>22,d=r}d>>>=22,e.words[f-10]=d,0===d&&e.length>10?e.length-=10:e.length-=9},w.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var a=0,t=0;t>>=26,e.words[t]=f,a=c}return 0!==a&&(e.words[e.length++]=a),e},d._prime=function(e){if(A[e])return A[e];var a;if("k256"===e)a=new w;else if("p224"===e)a=new _;else if("p192"===e)a=new I;else{if("p25519"!==e)throw new Error("Unknown prime "+e);a=new E}return A[e]=a,a},C.prototype._verify1=function(e){c(0===e.negative,"red works only with positives"),c(e.red,"red works only with red numbers")},C.prototype._verify2=function(e,a){c(!(e.negative|a.negative),"red works only with positives"),c(e.red&&e.red===a.red,"red works only with red numbers")},C.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(o(e,e.umod(this.m)._forceRed(this)),e)},C.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},C.prototype.add=function(e,a){this._verify2(e,a);var t=e.add(a);return t.cmp(this.m)>=0&&t.isub(this.m),t._forceRed(this)},C.prototype.iadd=function(e,a){this._verify2(e,a);var t=e.iadd(a);return t.cmp(this.m)>=0&&t.isub(this.m),t},C.prototype.sub=function(e,a){this._verify2(e,a);var t=e.sub(a);return t.cmpn(0)<0&&t.iadd(this.m),t._forceRed(this)},C.prototype.isub=function(e,a){this._verify2(e,a);var t=e.isub(a);return t.cmpn(0)<0&&t.iadd(this.m),t},C.prototype.shl=function(e,a){return this._verify1(e),this.imod(e.ushln(a))},C.prototype.imul=function(e,a){return this._verify2(e,a),this.imod(e.imul(a))},C.prototype.mul=function(e,a){return this._verify2(e,a),this.imod(e.mul(a))},C.prototype.isqr=function(e){return this.imul(e,e.clone())},C.prototype.sqr=function(e){return this.mul(e,e)},C.prototype.sqrt=function(e){if(e.isZero())return e.clone();var a=this.m.andln(3);if(c(a%2==1),3===a){var t=this.m.add(new d(1)).iushrn(2);return this.pow(e,t)}for(var f=this.m.subn(1),r=0;!f.isZero()&&0===f.andln(1);)r++,f.iushrn(1);c(!f.isZero());var n=new d(1).toRed(this),i=n.redNeg(),b=this.m.subn(1).iushrn(1),o=this.m.bitLength();for(o=new d(2*o*o).toRed(this);0!==this.pow(o,b).cmp(i);)o.redIAdd(i);for(var s=this.pow(o,f),l=this.pow(e,f.addn(1).iushrn(1)),u=this.pow(e,f),h=r;0!==u.cmp(n);){for(var p=u,g=0;0!==p.cmp(n);g++)p=p.redSqr();c(g=0;c--){for(var b=a.words[c],o=i-1;o>=0;o--){var s=b>>o&1;f!==t[0]&&(f=this.sqr(f)),0!==s||0!==r?(r<<=1,r|=s,(4==++n||0===c&&0===o)&&(f=this.mul(f,t[r]),n=0,r=0)):n=0}i=26}return f},C.prototype.convertTo=function(e){var a=e.umod(this.m);return a===e?a.clone():a},C.prototype.convertFrom=function(e){var a=e.clone();return a.red=null,a},d.mont=function(e){return new M(e)},f(M,C),M.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},M.prototype.convertFrom=function(e){var a=this.imod(e.mul(this.rinv));return a.red=null,a},M.prototype.imul=function(e,a){if(e.isZero()||a.isZero())return e.words[0]=0,e.length=1,e;var t=e.imul(a),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=t.isub(c).iushrn(this.shift),d=f;return f.cmp(this.m)>=0?d=f.isub(this.m):f.cmpn(0)<0&&(d=f.iadd(this.m)),d._forceRed(this)},M.prototype.mul=function(e,a){if(e.isZero()||a.isZero())return new d(0)._forceRed(this);var t=e.mul(a),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=t.isub(c).iushrn(this.shift),r=f;return f.cmp(this.m)>=0?r=f.isub(this.m):f.cmpn(0)<0&&(r=f.iadd(this.m)),r._forceRed(this)},M.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=t.nmd(e),this)},15037:(e,a,t)=>{var c;function f(e){this.rand=e}if(e.exports=function(e){return c||(c=new f(null)),c.generate(e)},e.exports.Rand=f,f.prototype.generate=function(e){return this._rand(e)},f.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var a=new Uint8Array(e),t=0;t{var c=t(92861).Buffer;function f(e){c.isBuffer(e)||(e=c.from(e));for(var a=e.length/4|0,t=new Array(a),f=0;f>>24]^o[h>>>16&255]^s[p>>>8&255]^l[255&g]^a[m++],r=b[h>>>24]^o[p>>>16&255]^s[g>>>8&255]^l[255&u]^a[m++],n=b[p>>>24]^o[g>>>16&255]^s[u>>>8&255]^l[255&h]^a[m++],i=b[g>>>24]^o[u>>>16&255]^s[h>>>8&255]^l[255&p]^a[m++],u=d,h=r,p=n,g=i;return d=(c[u>>>24]<<24|c[h>>>16&255]<<16|c[p>>>8&255]<<8|c[255&g])^a[m++],r=(c[h>>>24]<<24|c[p>>>16&255]<<16|c[g>>>8&255]<<8|c[255&u])^a[m++],n=(c[p>>>24]<<24|c[g>>>16&255]<<16|c[u>>>8&255]<<8|c[255&h])^a[m++],i=(c[g>>>24]<<24|c[u>>>16&255]<<16|c[h>>>8&255]<<8|c[255&p])^a[m++],[d>>>=0,r>>>=0,n>>>=0,i>>>=0]}var n=[0,1,2,4,8,16,32,64,128,27,54],i=function(){for(var e=new Array(256),a=0;a<256;a++)e[a]=a<128?a<<1:a<<1^283;for(var t=[],c=[],f=[[],[],[],[]],d=[[],[],[],[]],r=0,n=0,i=0;i<256;++i){var b=n^n<<1^n<<2^n<<3^n<<4;b=b>>>8^255&b^99,t[r]=b,c[b]=r;var o=e[r],s=e[o],l=e[s],u=257*e[b]^16843008*b;f[0][r]=u<<24|u>>>8,f[1][r]=u<<16|u>>>16,f[2][r]=u<<8|u>>>24,f[3][r]=u,u=16843009*l^65537*s^257*o^16843008*r,d[0][b]=u<<24|u>>>8,d[1][b]=u<<16|u>>>16,d[2][b]=u<<8|u>>>24,d[3][b]=u,0===r?r=n=1:(r=o^e[e[e[l^o]]],n^=e[e[n]])}return{SBOX:t,INV_SBOX:c,SUB_MIX:f,INV_SUB_MIX:d}}();function b(e){this._key=f(e),this._reset()}b.blockSize=16,b.keySize=32,b.prototype.blockSize=b.blockSize,b.prototype.keySize=b.keySize,b.prototype._reset=function(){for(var e=this._key,a=e.length,t=a+6,c=4*(t+1),f=[],d=0;d>>24,r=i.SBOX[r>>>24]<<24|i.SBOX[r>>>16&255]<<16|i.SBOX[r>>>8&255]<<8|i.SBOX[255&r],r^=n[d/a|0]<<24):a>6&&d%a==4&&(r=i.SBOX[r>>>24]<<24|i.SBOX[r>>>16&255]<<16|i.SBOX[r>>>8&255]<<8|i.SBOX[255&r]),f[d]=f[d-a]^r}for(var b=[],o=0;o>>24]]^i.INV_SUB_MIX[1][i.SBOX[l>>>16&255]]^i.INV_SUB_MIX[2][i.SBOX[l>>>8&255]]^i.INV_SUB_MIX[3][i.SBOX[255&l]]}this._nRounds=t,this._keySchedule=f,this._invKeySchedule=b},b.prototype.encryptBlockRaw=function(e){return r(e=f(e),this._keySchedule,i.SUB_MIX,i.SBOX,this._nRounds)},b.prototype.encryptBlock=function(e){var a=this.encryptBlockRaw(e),t=c.allocUnsafe(16);return t.writeUInt32BE(a[0],0),t.writeUInt32BE(a[1],4),t.writeUInt32BE(a[2],8),t.writeUInt32BE(a[3],12),t},b.prototype.decryptBlock=function(e){var a=(e=f(e))[1];e[1]=e[3],e[3]=a;var t=r(e,this._invKeySchedule,i.INV_SUB_MIX,i.INV_SBOX,this._nRounds),d=c.allocUnsafe(16);return d.writeUInt32BE(t[0],0),d.writeUInt32BE(t[3],4),d.writeUInt32BE(t[2],8),d.writeUInt32BE(t[1],12),d},b.prototype.scrub=function(){d(this._keySchedule),d(this._invKeySchedule),d(this._key)},e.exports.AES=b},92356:(e,a,t)=>{var c=t(50462),f=t(92861).Buffer,d=t(56168),r=t(56698),n=t(25892),i=t(30295),b=t(45122);function o(e,a,t,r){d.call(this);var i=f.alloc(4,0);this._cipher=new c.AES(a);var o=this._cipher.encryptBlock(i);this._ghash=new n(o),t=function(e,a,t){if(12===a.length)return e._finID=f.concat([a,f.from([0,0,0,1])]),f.concat([a,f.from([0,0,0,2])]);var c=new n(t),d=a.length,r=d%16;c.update(a),r&&(r=16-r,c.update(f.alloc(r,0))),c.update(f.alloc(8,0));var i=8*d,o=f.alloc(8);o.writeUIntBE(i,0,8),c.update(o),e._finID=c.state;var s=f.from(e._finID);return b(s),s}(this,t,o),this._prev=f.from(t),this._cache=f.allocUnsafe(0),this._secCache=f.allocUnsafe(0),this._decrypt=r,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}r(o,d),o.prototype._update=function(e){if(!this._called&&this._alen){var a=16-this._alen%16;a<16&&(a=f.alloc(a,0),this._ghash.update(a))}this._called=!0;var t=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(t),this._len+=e.length,t},o.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=i(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,a){var t=0;e.length!==a.length&&t++;for(var c=Math.min(e.length,a.length),f=0;f{var c=t(25799),f=t(36171),d=t(3219);a.createCipher=a.Cipher=c.createCipher,a.createCipheriv=a.Cipheriv=c.createCipheriv,a.createDecipher=a.Decipher=f.createDecipher,a.createDecipheriv=a.Decipheriv=f.createDecipheriv,a.listCiphers=a.getCiphers=function(){return Object.keys(d)}},36171:(e,a,t)=>{var c=t(92356),f=t(92861).Buffer,d=t(530),r=t(50650),n=t(56168),i=t(50462),b=t(68078);function o(e,a,t){n.call(this),this._cache=new s,this._last=void 0,this._cipher=new i.AES(a),this._prev=f.from(t),this._mode=e,this._autopadding=!0}function s(){this.cache=f.allocUnsafe(0)}function l(e,a,t){var n=d[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=f.from(t)),"GCM"!==n.mode&&t.length!==n.iv)throw new TypeError("invalid iv length "+t.length);if("string"==typeof a&&(a=f.from(a)),a.length!==n.key/8)throw new TypeError("invalid key length "+a.length);return"stream"===n.type?new r(n.module,a,t,!0):"auth"===n.type?new c(n.module,a,t,!0):new o(n.module,a,t)}t(56698)(o,n),o.prototype._update=function(e){var a,t;this._cache.add(e);for(var c=[];a=this._cache.get(this._autopadding);)t=this._mode.decrypt(this,a),c.push(t);return f.concat(c)},o.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return function(e){var a=e[15];if(a<1||a>16)throw new Error("unable to decrypt data");for(var t=-1;++t16)return a=this.cache.slice(0,16),this.cache=this.cache.slice(16),a}else if(this.cache.length>=16)return a=this.cache.slice(0,16),this.cache=this.cache.slice(16),a;return null},s.prototype.flush=function(){if(this.cache.length)return this.cache},a.createDecipher=function(e,a){var t=d[e.toLowerCase()];if(!t)throw new TypeError("invalid suite type");var c=b(a,!1,t.key,t.iv);return l(e,c.key,c.iv)},a.createDecipheriv=l},25799:(e,a,t)=>{var c=t(530),f=t(92356),d=t(92861).Buffer,r=t(50650),n=t(56168),i=t(50462),b=t(68078);function o(e,a,t){n.call(this),this._cache=new l,this._cipher=new i.AES(a),this._prev=d.from(t),this._mode=e,this._autopadding=!0}t(56698)(o,n),o.prototype._update=function(e){var a,t;this._cache.add(e);for(var c=[];a=this._cache.get();)t=this._mode.encrypt(this,a),c.push(t);return d.concat(c)};var s=d.alloc(16,16);function l(){this.cache=d.allocUnsafe(0)}function u(e,a,t){var n=c[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");if("string"==typeof a&&(a=d.from(a)),a.length!==n.key/8)throw new TypeError("invalid key length "+a.length);if("string"==typeof t&&(t=d.from(t)),"GCM"!==n.mode&&t.length!==n.iv)throw new TypeError("invalid iv length "+t.length);return"stream"===n.type?new r(n.module,a,t):"auth"===n.type?new f(n.module,a,t):new o(n.module,a,t)}o.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(s))throw this._cipher.scrub(),new Error("data not multiple of block length")},o.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},l.prototype.add=function(e){this.cache=d.concat([this.cache,e])},l.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},l.prototype.flush=function(){for(var e=16-this.cache.length,a=d.allocUnsafe(e),t=-1;++t{var c=t(92861).Buffer,f=c.alloc(16,0);function d(e){var a=c.allocUnsafe(16);return a.writeUInt32BE(e[0]>>>0,0),a.writeUInt32BE(e[1]>>>0,4),a.writeUInt32BE(e[2]>>>0,8),a.writeUInt32BE(e[3]>>>0,12),a}function r(e){this.h=e,this.state=c.alloc(16,0),this.cache=c.allocUnsafe(0)}r.prototype.ghash=function(e){for(var a=-1;++a0;a--)c[a]=c[a]>>>1|(1&c[a-1])<<31;c[0]=c[0]>>>1,t&&(c[0]=c[0]^225<<24)}this.state=d(f)},r.prototype.update=function(e){var a;for(this.cache=c.concat([this.cache,e]);this.cache.length>=16;)a=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(a)},r.prototype.final=function(e,a){return this.cache.length&&this.ghash(c.concat([this.cache,f],16)),this.ghash(d([0,e,0,a])),this.state},e.exports=r},45122:e=>{e.exports=function(e){for(var a,t=e.length;t--;){if(255!==(a=e.readUInt8(t))){a++,e.writeUInt8(a,t);break}e.writeUInt8(0,t)}}},92884:(e,a,t)=>{var c=t(30295);a.encrypt=function(e,a){var t=c(a,e._prev);return e._prev=e._cipher.encryptBlock(t),e._prev},a.decrypt=function(e,a){var t=e._prev;e._prev=a;var f=e._cipher.decryptBlock(a);return c(f,t)}},46383:(e,a,t)=>{var c=t(92861).Buffer,f=t(30295);function d(e,a,t){var d=a.length,r=f(a,e._cache);return e._cache=e._cache.slice(d),e._prev=c.concat([e._prev,t?a:r]),r}a.encrypt=function(e,a,t){for(var f,r=c.allocUnsafe(0);a.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=c.allocUnsafe(0)),!(e._cache.length<=a.length)){r=c.concat([r,d(e,a,t)]);break}f=e._cache.length,r=c.concat([r,d(e,a.slice(0,f),t)]),a=a.slice(f)}return r}},55264:(e,a,t)=>{var c=t(92861).Buffer;function f(e,a,t){for(var c,f,r=-1,n=0;++r<8;)c=a&1<<7-r?128:0,n+=(128&(f=e._cipher.encryptBlock(e._prev)[0]^c))>>r%8,e._prev=d(e._prev,t?c:f);return n}function d(e,a){var t=e.length,f=-1,d=c.allocUnsafe(e.length);for(e=c.concat([e,c.from([a])]);++f>7;return d}a.encrypt=function(e,a,t){for(var d=a.length,r=c.allocUnsafe(d),n=-1;++n{var c=t(92861).Buffer;function f(e,a,t){var f=e._cipher.encryptBlock(e._prev)[0]^a;return e._prev=c.concat([e._prev.slice(1),c.from([t?a:f])]),f}a.encrypt=function(e,a,t){for(var d=a.length,r=c.allocUnsafe(d),n=-1;++n{var c=t(30295),f=t(92861).Buffer,d=t(45122);function r(e){var a=e._cipher.encryptBlockRaw(e._prev);return d(e._prev),a}a.encrypt=function(e,a){var t=Math.ceil(a.length/16),d=e._cache.length;e._cache=f.concat([e._cache,f.allocUnsafe(16*t)]);for(var n=0;n{a.encrypt=function(e,a){return e._cipher.encryptBlock(a)},a.decrypt=function(e,a){return e._cipher.decryptBlock(a)}},530:(e,a,t)=>{var c={ECB:t(52632),CBC:t(92884),CFB:t(46383),CFB8:t(86975),CFB1:t(55264),OFB:t(46843),CTR:t(63053),GCM:t(63053)},f=t(3219);for(var d in f)f[d].module=c[f[d].mode];e.exports=f},46843:(e,a,t)=>{var c=t(62045).hp,f=t(30295);function d(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}a.encrypt=function(e,a){for(;e._cache.length{var c=t(50462),f=t(92861).Buffer,d=t(56168);function r(e,a,t,r){d.call(this),this._cipher=new c.AES(a),this._prev=f.from(t),this._cache=f.allocUnsafe(0),this._secCache=f.allocUnsafe(0),this._decrypt=r,this._mode=e}t(56698)(r,d),r.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},r.prototype._final=function(){this._cipher.scrub()},e.exports=r},30125:(e,a,t)=>{var c=t(84050),f=t(1241),d=t(530),r=t(32438),n=t(68078);function i(e,a,t){if(e=e.toLowerCase(),d[e])return f.createCipheriv(e,a,t);if(r[e])return new c({key:a,iv:t,mode:e});throw new TypeError("invalid suite type")}function b(e,a,t){if(e=e.toLowerCase(),d[e])return f.createDecipheriv(e,a,t);if(r[e])return new c({key:a,iv:t,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}a.createCipher=a.Cipher=function(e,a){var t,c;if(e=e.toLowerCase(),d[e])t=d[e].key,c=d[e].iv;else{if(!r[e])throw new TypeError("invalid suite type");t=8*r[e].key,c=r[e].iv}var f=n(a,!1,t,c);return i(e,f.key,f.iv)},a.createCipheriv=a.Cipheriv=i,a.createDecipher=a.Decipher=function(e,a){var t,c;if(e=e.toLowerCase(),d[e])t=d[e].key,c=d[e].iv;else{if(!r[e])throw new TypeError("invalid suite type");t=8*r[e].key,c=r[e].iv}var f=n(a,!1,t,c);return b(e,f.key,f.iv)},a.createDecipheriv=a.Decipheriv=b,a.listCiphers=a.getCiphers=function(){return Object.keys(r).concat(f.getCiphers())}},84050:(e,a,t)=>{var c=t(56168),f=t(29560),d=t(56698),r=t(92861).Buffer,n={"des-ede3-cbc":f.CBC.instantiate(f.EDE),"des-ede3":f.EDE,"des-ede-cbc":f.CBC.instantiate(f.EDE),"des-ede":f.EDE,"des-cbc":f.CBC.instantiate(f.DES),"des-ecb":f.DES};function i(e){c.call(this);var a,t=e.mode.toLowerCase(),f=n[t];a=e.decrypt?"decrypt":"encrypt";var d=e.key;r.isBuffer(d)||(d=r.from(d)),"des-ede"!==t&&"des-ede-cbc"!==t||(d=r.concat([d,d.slice(0,8)]));var i=e.iv;r.isBuffer(i)||(i=r.from(i)),this._des=f.create({key:d,iv:i,type:a})}n.des=n["des-cbc"],n.des3=n["des-ede3-cbc"],e.exports=i,d(i,c),i.prototype._update=function(e){return r.from(this._des.update(e))},i.prototype._final=function(){return r.from(this._des.final())}},32438:(e,a)=>{a["des-ecb"]={key:8,iv:0},a["des-cbc"]=a.des={key:8,iv:8},a["des-ede3-cbc"]=a.des3={key:24,iv:8},a["des-ede3"]={key:24,iv:0},a["des-ede-cbc"]={key:16,iv:8},a["des-ede"]={key:16,iv:0}},67332:(e,a,t)=>{var c=t(62045).hp,f=t(39404),d=t(53209);function r(e){var a,t=e.modulus.byteLength();do{a=new f(d(t))}while(a.cmp(e.modulus)>=0||!a.umod(e.prime1)||!a.umod(e.prime2));return a}function n(e,a){var t=function(e){var a=r(e);return{blinder:a.toRed(f.mont(e.modulus)).redPow(new f(e.publicExponent)).fromRed(),unblinder:a.invm(e.modulus)}}(a),d=a.modulus.byteLength(),n=new f(e).mul(t.blinder).umod(a.modulus),i=n.toRed(f.mont(a.prime1)),b=n.toRed(f.mont(a.prime2)),o=a.coefficient,s=a.prime1,l=a.prime2,u=i.redPow(a.exponent1).fromRed(),h=b.redPow(a.exponent2).fromRed(),p=u.isub(h).imul(o).umod(s).imul(l);return h.iadd(p).imul(t.unblinder).umod(a.modulus).toArrayLike(c,"be",d)}n.getr=r,e.exports=n},55715:(e,a,t)=>{"use strict";e.exports=t(62951)},20:(e,a,t)=>{"use strict";var c=t(92861).Buffer,f=t(47108),d=t(46737),r=t(56698),n=t(35359),i=t(74847),b=t(62951);function o(e){d.Writable.call(this);var a=b[e];if(!a)throw new Error("Unknown message digest");this._hashType=a.hash,this._hash=f(a.hash),this._tag=a.id,this._signType=a.sign}function s(e){d.Writable.call(this);var a=b[e];if(!a)throw new Error("Unknown message digest");this._hash=f(a.hash),this._tag=a.id,this._signType=a.sign}function l(e){return new o(e)}function u(e){return new s(e)}Object.keys(b).forEach((function(e){b[e].id=c.from(b[e].id,"hex"),b[e.toLowerCase()]=b[e]})),r(o,d.Writable),o.prototype._write=function(e,a,t){this._hash.update(e),t()},o.prototype.update=function(e,a){return this._hash.update("string"==typeof e?c.from(e,a):e),this},o.prototype.sign=function(e,a){this.end();var t=this._hash.digest(),c=n(t,e,this._hashType,this._signType,this._tag);return a?c.toString(a):c},r(s,d.Writable),s.prototype._write=function(e,a,t){this._hash.update(e),t()},s.prototype.update=function(e,a){return this._hash.update("string"==typeof e?c.from(e,a):e),this},s.prototype.verify=function(e,a,t){var f="string"==typeof a?c.from(a,t):a;this.end();var d=this._hash.digest();return i(f,d,e,this._signType,this._tag)},e.exports={Sign:l,Verify:u,createSign:l,createVerify:u}},35359:(e,a,t)=>{"use strict";var c=t(92861).Buffer,f=t(83507),d=t(67332),r=t(86729).ec,n=t(39404),i=t(78170),b=t(64589);function o(e,a,t,d){if((e=c.from(e.toArray())).length0&&t.ishrn(c),t}function l(e,a,t){var d,r;do{for(d=c.alloc(0);8*d.length{"use strict";var c=t(92861).Buffer,f=t(39404),d=t(86729).ec,r=t(78170),n=t(64589);function i(e,a){if(e.cmpn(0)<=0)throw new Error("invalid sig");if(e.cmp(a)>=0)throw new Error("invalid sig")}e.exports=function(e,a,t,b,o){var s=r(t);if("ec"===s.type){if("ecdsa"!==b&&"ecdsa/rsa"!==b)throw new Error("wrong public key type");return function(e,a,t){var c=n[t.data.algorithm.curve.join(".")];if(!c)throw new Error("unknown curve "+t.data.algorithm.curve.join("."));var f=new d(c),r=t.data.subjectPrivateKey.data;return f.verify(a,e,r)}(e,a,s)}if("dsa"===s.type){if("dsa"!==b)throw new Error("wrong public key type");return function(e,a,t){var c=t.data.p,d=t.data.q,n=t.data.g,b=t.data.pub_key,o=r.signature.decode(e,"der"),s=o.s,l=o.r;i(s,d),i(l,d);var u=f.mont(c),h=s.invm(d);return 0===n.toRed(u).redPow(new f(a).mul(h).mod(d)).fromRed().mul(b.toRed(u).redPow(l.mul(h).mod(d)).fromRed()).mod(c).mod(d).cmp(l)}(e,a,s)}if("rsa"!==b&&"ecdsa/rsa"!==b)throw new Error("wrong public key type");a=c.concat([o,a]);for(var l=s.modulus.byteLength(),u=[1],h=0;a.length+u.length+2{var a={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==a.call(e)}},26248:(e,a,t)=>{"use strict";var c=t(33225),f=Object.keys||function(e){var a=[];for(var t in e)a.push(t);return a};e.exports=s;var d=Object.create(t(15622));d.inherits=t(56698);var r=t(30206),n=t(7314);d.inherits(s,r);for(var i=f(n.prototype),b=0;b{"use strict";e.exports=d;var c=t(81816),f=Object.create(t(15622));function d(e){if(!(this instanceof d))return new d(e);c.call(this,e)}f.inherits=t(56698),f.inherits(d,c),d.prototype._transform=function(e,a,t){t(null,e)}},30206:(e,a,t)=>{"use strict";var c=t(33225);e.exports=x;var f,d=t(32240);x.ReadableState=m,t(37007).EventEmitter;var r=function(e,a){return e.listeners(a).length},n=t(5567),i=t(24116).Buffer,b=(void 0!==t.g?t.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},o=Object.create(t(15622));o.inherits=t(56698);var s=t(92668),l=void 0;l=s&&s.debuglog?s.debuglog("stream"):function(){};var u,h=t(20672),p=t(36278);o.inherits(x,n);var g=["error","close","destroy","pause","resume"];function m(e,a){e=e||{};var c=a instanceof(f=f||t(26248));this.objectMode=!!e.objectMode,c&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var d=e.highWaterMark,r=e.readableHighWaterMark,n=this.objectMode?16:16384;this.highWaterMark=d||0===d?d:c&&(r||0===r)?r:n,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new h,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(u||(u=t(6427).I),this.decoder=new u(e.encoding),this.encoding=e.encoding)}function x(e){if(f=f||t(26248),!(this instanceof x))return new x(e);this._readableState=new m(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),n.call(this)}function y(e,a,t,c,f){var d,r=e._readableState;return null===a?(r.reading=!1,function(e,a){if(!a.ended){if(a.decoder){var t=a.decoder.end();t&&t.length&&(a.buffer.push(t),a.length+=a.objectMode?1:t.length)}a.ended=!0,_(e)}}(e,r)):(f||(d=function(e,a){var t,c;return c=a,i.isBuffer(c)||c instanceof b||"string"==typeof a||void 0===a||e.objectMode||(t=new TypeError("Invalid non-string/buffer chunk")),t}(r,a)),d?e.emit("error",d):r.objectMode||a&&a.length>0?("string"==typeof a||r.objectMode||Object.getPrototypeOf(a)===i.prototype||(a=function(e){return i.from(e)}(a)),c?r.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):A(e,r,a,!0):r.ended?e.emit("error",new Error("stream.push() after EOF")):(r.reading=!1,r.decoder&&!t?(a=r.decoder.write(a),r.objectMode||0!==a.length?A(e,r,a,!1):E(e,r)):A(e,r,a,!1))):c||(r.reading=!1)),function(e){return!e.ended&&(e.needReadable||e.lengtha.highWaterMark&&(a.highWaterMark=function(e){return e>=v?e=v:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=a.length?e:a.ended?a.length:(a.needReadable=!0,0))}function _(e){var a=e._readableState;a.needReadable=!1,a.emittedReadable||(l("emitReadable",a.flowing),a.emittedReadable=!0,a.sync?c.nextTick(I,e):I(e))}function I(e){l("emit readable"),e.emit("readable"),k(e)}function E(e,a){a.readingMore||(a.readingMore=!0,c.nextTick(C,e,a))}function C(e,a){for(var t=a.length;!a.reading&&!a.flowing&&!a.ended&&a.length=a.length?(t=a.decoder?a.buffer.join(""):1===a.buffer.length?a.buffer.head.data:a.buffer.concat(a.length),a.buffer.clear()):t=function(e,a,t){var c;return ed.length?d.length:e;if(r===d.length?f+=d:f+=d.slice(0,e),0==(e-=r)){r===d.length?(++c,t.next?a.head=t.next:a.head=a.tail=null):(a.head=t,t.data=d.slice(r));break}++c}return a.length-=c,f}(e,a):function(e,a){var t=i.allocUnsafe(e),c=a.head,f=1;for(c.data.copy(t),e-=c.data.length;c=c.next;){var d=c.data,r=e>d.length?d.length:e;if(d.copy(t,t.length-e,0,r),0==(e-=r)){r===d.length?(++f,c.next?a.head=c.next:a.head=a.tail=null):(a.head=c,c.data=d.slice(r));break}++f}return a.length-=f,t}(e,a),c}(e,a.buffer,a.decoder),t);var t}function S(e){var a=e._readableState;if(a.length>0)throw new Error('"endReadable()" called on non-empty stream');a.endEmitted||(a.ended=!0,c.nextTick(T,a,e))}function T(e,a){e.endEmitted||0!==e.length||(e.endEmitted=!0,a.readable=!1,a.emit("end"))}function N(e,a){for(var t=0,c=e.length;t=a.highWaterMark||a.ended))return l("read: emitReadable",a.length,a.ended),0===a.length&&a.ended?S(this):_(this),null;if(0===(e=w(e,a))&&a.ended)return 0===a.length&&S(this),null;var c,f=a.needReadable;return l("need readable",f),(0===a.length||a.length-e0?L(e,a):null)?(a.needReadable=!0,e=0):a.length-=e,0===a.length&&(a.ended||(a.needReadable=!0),t!==e&&a.ended&&S(this)),null!==c&&this.emit("data",c),c},x.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},x.prototype.pipe=function(e,a){var t=this,f=this._readableState;switch(f.pipesCount){case 0:f.pipes=e;break;case 1:f.pipes=[f.pipes,e];break;default:f.pipes.push(e)}f.pipesCount+=1,l("pipe count=%d opts=%j",f.pipesCount,a);var n=a&&!1===a.end||e===process.stdout||e===process.stderr?m:i;function i(){l("onend"),e.end()}f.endEmitted?c.nextTick(n):t.once("end",n),e.on("unpipe",(function a(c,d){l("onunpipe"),c===t&&d&&!1===d.hasUnpiped&&(d.hasUnpiped=!0,l("cleanup"),e.removeListener("close",p),e.removeListener("finish",g),e.removeListener("drain",b),e.removeListener("error",h),e.removeListener("unpipe",a),t.removeListener("end",i),t.removeListener("end",m),t.removeListener("data",u),o=!0,!f.awaitDrain||e._writableState&&!e._writableState.needDrain||b())}));var b=function(e){return function(){var a=e._readableState;l("pipeOnDrain",a.awaitDrain),a.awaitDrain&&a.awaitDrain--,0===a.awaitDrain&&r(e,"data")&&(a.flowing=!0,k(e))}}(t);e.on("drain",b);var o=!1,s=!1;function u(a){l("ondata"),s=!1,!1!==e.write(a)||s||((1===f.pipesCount&&f.pipes===e||f.pipesCount>1&&-1!==N(f.pipes,e))&&!o&&(l("false write response, pause",f.awaitDrain),f.awaitDrain++,s=!0),t.pause())}function h(a){l("onerror",a),m(),e.removeListener("error",h),0===r(e,"error")&&e.emit("error",a)}function p(){e.removeListener("finish",g),m()}function g(){l("onfinish"),e.removeListener("close",p),m()}function m(){l("unpipe"),t.unpipe(e)}return t.on("data",u),function(e,a,t){if("function"==typeof e.prependListener)return e.prependListener(a,t);e._events&&e._events[a]?d(e._events[a])?e._events[a].unshift(t):e._events[a]=[t,e._events[a]]:e.on(a,t)}(e,"error",h),e.once("close",p),e.once("finish",g),e.emit("pipe",t),f.flowing||(l("pipe resume"),t.resume()),e},x.prototype.unpipe=function(e){var a=this._readableState,t={hasUnpiped:!1};if(0===a.pipesCount)return this;if(1===a.pipesCount)return e&&e!==a.pipes||(e||(e=a.pipes),a.pipes=null,a.pipesCount=0,a.flowing=!1,e&&e.emit("unpipe",this,t)),this;if(!e){var c=a.pipes,f=a.pipesCount;a.pipes=null,a.pipesCount=0,a.flowing=!1;for(var d=0;d{"use strict";e.exports=r;var c=t(26248),f=Object.create(t(15622));function d(e,a){var t=this._transformState;t.transforming=!1;var c=t.writecb;if(!c)return this.emit("error",new Error("write callback called multiple times"));t.writechunk=null,t.writecb=null,null!=a&&this.push(a),c(e);var f=this._readableState;f.reading=!1,(f.needReadable||f.length{"use strict";var c=t(33225);function f(e){var a=this;this.next=null,this.entry=null,this.finish=function(){!function(e,a){var t=e.entry;for(e.entry=null;t;){var c=t.callback;a.pendingcb--,c(undefined),t=t.next}a.corkedRequestsFree.next=e}(a,e)}}e.exports=g;var d,r=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:c.nextTick;g.WritableState=p;var n=Object.create(t(15622));n.inherits=t(56698);var i,b={deprecate:t(94643)},o=t(5567),s=t(24116).Buffer,l=(void 0!==t.g?t.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},u=t(36278);function h(){}function p(e,a){d=d||t(26248),e=e||{};var n=a instanceof d;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,b=e.writableHighWaterMark,o=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(b||0===b)?b:o,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,a){var t=e._writableState,f=t.sync,d=t.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(t),a)!function(e,a,t,f,d){--a.pendingcb,t?(c.nextTick(d,f),c.nextTick(w,e,a),e._writableState.errorEmitted=!0,e.emit("error",f)):(d(f),e._writableState.errorEmitted=!0,e.emit("error",f),w(e,a))}(e,t,f,a,d);else{var n=A(t);n||t.corked||t.bufferProcessing||!t.bufferedRequest||y(e,t),f?r(x,e,t,n,d):x(e,t,n,d)}}(a,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new f(this)}function g(e){if(d=d||t(26248),!(i.call(g,this)||this instanceof d))return new g(e);this._writableState=new p(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),o.call(this)}function m(e,a,t,c,f,d,r){a.writelen=c,a.writecb=r,a.writing=!0,a.sync=!0,t?e._writev(f,a.onwrite):e._write(f,d,a.onwrite),a.sync=!1}function x(e,a,t,c){t||function(e,a){0===a.length&&a.needDrain&&(a.needDrain=!1,e.emit("drain"))}(e,a),a.pendingcb--,c(),w(e,a)}function y(e,a){a.bufferProcessing=!0;var t=a.bufferedRequest;if(e._writev&&t&&t.next){var c=a.bufferedRequestCount,d=new Array(c),r=a.corkedRequestsFree;r.entry=t;for(var n=0,i=!0;t;)d[n]=t,t.isBuf||(i=!1),t=t.next,n+=1;d.allBuffers=i,m(e,a,!0,a.length,d,"",r.finish),a.pendingcb++,a.lastBufferedRequest=null,r.next?(a.corkedRequestsFree=r.next,r.next=null):a.corkedRequestsFree=new f(a),a.bufferedRequestCount=0}else{for(;t;){var b=t.chunk,o=t.encoding,s=t.callback;if(m(e,a,!1,a.objectMode?1:b.length,b,o,s),t=t.next,a.bufferedRequestCount--,a.writing)break}null===t&&(a.lastBufferedRequest=null)}a.bufferedRequest=t,a.bufferProcessing=!1}function A(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function v(e,a){e._final((function(t){a.pendingcb--,t&&e.emit("error",t),a.prefinished=!0,e.emit("prefinish"),w(e,a)}))}function w(e,a){var t=A(a);return t&&(function(e,a){a.prefinished||a.finalCalled||("function"==typeof e._final?(a.pendingcb++,a.finalCalled=!0,c.nextTick(v,e,a)):(a.prefinished=!0,e.emit("prefinish")))}(e,a),0===a.pendingcb&&(a.finished=!0,e.emit("finish"))),t}n.inherits(g,o),p.prototype.getBuffer=function(){for(var e=this.bufferedRequest,a=[];e;)a.push(e),e=e.next;return a},function(){try{Object.defineProperty(p.prototype,"buffer",{get:b.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(i=Function.prototype[Symbol.hasInstance],Object.defineProperty(g,Symbol.hasInstance,{value:function(e){return!!i.call(this,e)||this===g&&e&&e._writableState instanceof p}})):i=function(e){return e instanceof this},g.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},g.prototype.write=function(e,a,t){var f,d=this._writableState,r=!1,n=!d.objectMode&&(f=e,s.isBuffer(f)||f instanceof l);return n&&!s.isBuffer(e)&&(e=function(e){return s.from(e)}(e)),"function"==typeof a&&(t=a,a=null),n?a="buffer":a||(a=d.defaultEncoding),"function"!=typeof t&&(t=h),d.ended?function(e,a){var t=new Error("write after end");e.emit("error",t),c.nextTick(a,t)}(this,t):(n||function(e,a,t,f){var d=!0,r=!1;return null===t?r=new TypeError("May not write null values to stream"):"string"==typeof t||void 0===t||a.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r&&(e.emit("error",r),c.nextTick(f,r),d=!1),d}(this,d,e,t))&&(d.pendingcb++,r=function(e,a,t,c,f,d){if(!t){var r=function(e,a,t){return e.objectMode||!1===e.decodeStrings||"string"!=typeof a||(a=s.from(a,t)),a}(a,c,f);c!==r&&(t=!0,f="buffer",c=r)}var n=a.objectMode?1:c.length;a.length+=n;var i=a.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(g.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),g.prototype._write=function(e,a,t){t(new Error("_write() is not implemented"))},g.prototype._writev=null,g.prototype.end=function(e,a,t){var f=this._writableState;"function"==typeof e?(t=e,e=null,a=null):"function"==typeof a&&(t=a,a=null),null!=e&&this.write(e,a),f.corked&&(f.corked=1,this.uncork()),f.ending||function(e,a,t){a.ending=!0,w(e,a),t&&(a.finished?c.nextTick(t):e.once("finish",t)),a.ended=!0,e.writable=!1}(this,f,t)},Object.defineProperty(g.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),g.prototype.destroy=u.destroy,g.prototype._undestroy=u.undestroy,g.prototype._destroy=function(e,a){this.end(),a(e)}},20672:(e,a,t)=>{"use strict";var c=t(24116).Buffer,f=t(21638);e.exports=function(){function e(){!function(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var a={data:e,next:null};this.length>0?this.tail.next=a:this.head=a,this.tail=a,++this.length},e.prototype.unshift=function(e){var a={data:e,next:this.head};0===this.length&&(this.tail=a),this.head=a,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var a=this.head,t=""+a.data;a=a.next;)t+=e+a.data;return t},e.prototype.concat=function(e){if(0===this.length)return c.alloc(0);for(var a,t,f=c.allocUnsafe(e>>>0),d=this.head,r=0;d;)a=f,t=r,d.data.copy(a,t),r+=d.data.length,d=d.next;return f},e}(),f&&f.inspect&&f.inspect.custom&&(e.exports.prototype[f.inspect.custom]=function(){var e=f.inspect({length:this.length});return this.constructor.name+" "+e})},36278:(e,a,t)=>{"use strict";var c=t(33225);function f(e,a){e.emit("error",a)}e.exports={destroy:function(e,a){var t=this,d=this._readableState&&this._readableState.destroyed,r=this._writableState&&this._writableState.destroyed;return d||r?(a?a(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,c.nextTick(f,this,e)):c.nextTick(f,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!a&&e?t._writableState?t._writableState.errorEmitted||(t._writableState.errorEmitted=!0,c.nextTick(f,t,e)):c.nextTick(f,t,e):a&&a(e)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},5567:(e,a,t)=>{e.exports=t(37007).EventEmitter},24116:(e,a,t)=>{var c=t(48287),f=c.Buffer;function d(e,a){for(var t in e)a[t]=e[t]}function r(e,a,t){return f(e,a,t)}f.from&&f.alloc&&f.allocUnsafe&&f.allocUnsafeSlow?e.exports=c:(d(c,a),a.Buffer=r),d(f,r),r.from=function(e,a,t){if("number"==typeof e)throw new TypeError("Argument must not be a number");return f(e,a,t)},r.alloc=function(e,a,t){if("number"!=typeof e)throw new TypeError("Argument must be a number");var c=f(e);return void 0!==a?"string"==typeof t?c.fill(a,t):c.fill(a):c.fill(0),c},r.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return f(e)},r.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return c.SlowBuffer(e)}},46737:(e,a,t)=>{(a=e.exports=t(30206)).Stream=a,a.Readable=a,a.Writable=t(7314),a.Duplex=t(26248),a.Transform=t(81816),a.PassThrough=t(75242)},6427:(e,a,t)=>{"use strict";var c=t(88393).Buffer,f=c.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function d(e){var a;switch(this.encoding=function(e){var a=function(e){if(!e)return"utf8";for(var a;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(a)return;e=(""+e).toLowerCase(),a=!0}}(e);if("string"!=typeof a&&(c.isEncoding===f||!f(e)))throw new Error("Unknown encoding: "+e);return a||e}(e),this.encoding){case"utf16le":this.text=i,this.end=b,a=4;break;case"utf8":this.fillLast=n,a=4;break;case"base64":this.text=o,this.end=s,a=3;break;default:return this.write=l,void(this.end=u)}this.lastNeed=0,this.lastTotal=0,this.lastChar=c.allocUnsafe(a)}function r(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function n(e){var a=this.lastTotal-this.lastNeed,t=function(e,a){if(128!=(192&a[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&a.length>1){if(128!=(192&a[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&a.length>2&&128!=(192&a[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==t?t:this.lastNeed<=e.length?(e.copy(this.lastChar,a,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,a,0,e.length),void(this.lastNeed-=e.length))}function i(e,a){if((e.length-a)%2==0){var t=e.toString("utf16le",a);if(t){var c=t.charCodeAt(t.length-1);if(c>=55296&&c<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],t.slice(0,-1)}return t}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",a,e.length-1)}function b(e){var a=e&&e.length?this.write(e):"";if(this.lastNeed){var t=this.lastTotal-this.lastNeed;return a+this.lastChar.toString("utf16le",0,t)}return a}function o(e,a){var t=(e.length-a)%3;return 0===t?e.toString("base64",a):(this.lastNeed=3-t,this.lastTotal=3,1===t?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",a,e.length-t))}function s(e){var a=e&&e.length?this.write(e):"";return this.lastNeed?a+this.lastChar.toString("base64",0,3-this.lastNeed):a}function l(e){return e.toString(this.encoding)}function u(e){return e&&e.length?this.write(e):""}a.I=d,d.prototype.write=function(e){if(0===e.length)return"";var a,t;if(this.lastNeed){if(void 0===(a=this.fillLast(e)))return"";t=this.lastNeed,this.lastNeed=0}else t=0;return t=0?(f>0&&(e.lastNeed=f-1),f):--c=0?(f>0&&(e.lastNeed=f-2),f):--c=0?(f>0&&(2===f?f=0:e.lastNeed=f-3),f):0}(this,e,a);if(!this.lastNeed)return e.toString("utf8",a);this.lastTotal=t;var c=e.length-(t-this.lastNeed);return e.copy(this.lastChar,0,c),e.toString("utf8",a,c)},d.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},88393:(e,a,t)=>{var c=t(48287),f=c.Buffer;function d(e,a){for(var t in e)a[t]=e[t]}function r(e,a,t){return f(e,a,t)}f.from&&f.alloc&&f.allocUnsafe&&f.allocUnsafeSlow?e.exports=c:(d(c,a),a.Buffer=r),d(f,r),r.from=function(e,a,t){if("number"==typeof e)throw new TypeError("Argument must not be a number");return f(e,a,t)},r.alloc=function(e,a,t){if("number"!=typeof e)throw new TypeError("Argument must be a number");var c=f(e);return void 0!==a?"string"==typeof t?c.fill(a,t):c.fill(a):c.fill(0),c},r.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return f(e)},r.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return c.SlowBuffer(e)}},5974:(e,a,t)=>{"use strict";var c=t(62045).hp,f=t(94148),d=t(44442),r=t(58411),n=t(71447),i=t(19681);for(var b in i)a[b]=i[b];function o(e){if("number"!=typeof e||ea.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}a.NONE=0,a.DEFLATE=1,a.INFLATE=2,a.GZIP=3,a.GUNZIP=4,a.DEFLATERAW=5,a.INFLATERAW=6,a.UNZIP=7,o.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,f(this.init_done,"close before init"),f(this.mode<=a.UNZIP),this.mode===a.DEFLATE||this.mode===a.GZIP||this.mode===a.DEFLATERAW?r.deflateEnd(this.strm):this.mode!==a.INFLATE&&this.mode!==a.GUNZIP&&this.mode!==a.INFLATERAW&&this.mode!==a.UNZIP||n.inflateEnd(this.strm),this.mode=a.NONE,this.dictionary=null)},o.prototype.write=function(e,a,t,c,f,d,r){return this._write(!0,e,a,t,c,f,d,r)},o.prototype.writeSync=function(e,a,t,c,f,d,r){return this._write(!1,e,a,t,c,f,d,r)},o.prototype._write=function(e,t,d,r,n,i,b,o){if(f.equal(arguments.length,8),f(this.init_done,"write before init"),f(this.mode!==a.NONE,"already finalized"),f.equal(!1,this.write_in_progress,"write already in progress"),f.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,f.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==a.Z_NO_FLUSH&&t!==a.Z_PARTIAL_FLUSH&&t!==a.Z_SYNC_FLUSH&&t!==a.Z_FULL_FLUSH&&t!==a.Z_FINISH&&t!==a.Z_BLOCK)throw new Error("Invalid flush value");if(null==d&&(d=c.alloc(0),n=0,r=0),this.strm.avail_in=n,this.strm.input=d,this.strm.next_in=r,this.strm.avail_out=o,this.strm.output=i,this.strm.next_out=b,this.flush=t,!e)return this._process(),this._checkError()?this._afterSync():void 0;var s=this;return process.nextTick((function(){s._process(),s._after()})),this},o.prototype._afterSync=function(){var e=this.strm.avail_out,a=this.strm.avail_in;return this.write_in_progress=!1,[a,e]},o.prototype._process=function(){var e=null;switch(this.mode){case a.DEFLATE:case a.GZIP:case a.DEFLATERAW:this.err=r.deflate(this.strm,this.flush);break;case a.UNZIP:switch(this.strm.avail_in>0&&(e=this.strm.next_in),this.gzip_id_bytes_read){case 0:if(null===e)break;if(31!==this.strm.input[e]){this.mode=a.INFLATE;break}if(this.gzip_id_bytes_read=1,e++,1===this.strm.avail_in)break;case 1:if(null===e)break;139===this.strm.input[e]?(this.gzip_id_bytes_read=2,this.mode=a.GUNZIP):this.mode=a.INFLATE;break;default:throw new Error("invalid number of gzip magic number bytes read")}case a.INFLATE:case a.GUNZIP:case a.INFLATERAW:for(this.err=n.inflate(this.strm,this.flush),this.err===a.Z_NEED_DICT&&this.dictionary&&(this.err=n.inflateSetDictionary(this.strm,this.dictionary),this.err===a.Z_OK?this.err=n.inflate(this.strm,this.flush):this.err===a.Z_DATA_ERROR&&(this.err=a.Z_NEED_DICT));this.strm.avail_in>0&&this.mode===a.GUNZIP&&this.err===a.Z_STREAM_END&&0!==this.strm.next_in[0];)this.reset(),this.err=n.inflate(this.strm,this.flush);break;default:throw new Error("Unknown mode "+this.mode)}},o.prototype._checkError=function(){switch(this.err){case a.Z_OK:case a.Z_BUF_ERROR:if(0!==this.strm.avail_out&&this.flush===a.Z_FINISH)return this._error("unexpected end of file"),!1;break;case a.Z_STREAM_END:break;case a.Z_NEED_DICT:return null==this.dictionary?this._error("Missing dictionary"):this._error("Bad dictionary"),!1;default:return this._error("Zlib error"),!1}return!0},o.prototype._after=function(){if(this._checkError()){var e=this.strm.avail_out,a=this.strm.avail_in;this.write_in_progress=!1,this.callback(a,e),this.pending_close&&this.close()}},o.prototype._error=function(e){this.strm.msg&&(e=this.strm.msg),this.onerror(e,this.err),this.write_in_progress=!1,this.pending_close&&this.close()},o.prototype.init=function(e,t,c,d,r){f(4===arguments.length||5===arguments.length,"init(windowBits, level, memLevel, strategy, [dictionary])"),f(e>=8&&e<=15,"invalid windowBits"),f(t>=-1&&t<=9,"invalid compression level"),f(c>=1&&c<=9,"invalid memlevel"),f(d===a.Z_FILTERED||d===a.Z_HUFFMAN_ONLY||d===a.Z_RLE||d===a.Z_FIXED||d===a.Z_DEFAULT_STRATEGY,"invalid strategy"),this._init(t,e,c,d,r),this._setDictionary()},o.prototype.params=function(){throw new Error("deflateParams Not supported")},o.prototype.reset=function(){this._reset(),this._setDictionary()},o.prototype._init=function(e,t,c,f,i){switch(this.level=e,this.windowBits=t,this.memLevel=c,this.strategy=f,this.flush=a.Z_NO_FLUSH,this.err=a.Z_OK,this.mode!==a.GZIP&&this.mode!==a.GUNZIP||(this.windowBits+=16),this.mode===a.UNZIP&&(this.windowBits+=32),this.mode!==a.DEFLATERAW&&this.mode!==a.INFLATERAW||(this.windowBits=-1*this.windowBits),this.strm=new d,this.mode){case a.DEFLATE:case a.GZIP:case a.DEFLATERAW:this.err=r.deflateInit2(this.strm,this.level,a.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case a.INFLATE:case a.GUNZIP:case a.INFLATERAW:case a.UNZIP:this.err=n.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}this.err!==a.Z_OK&&this._error("Init error"),this.dictionary=i,this.write_in_progress=!1,this.init_done=!0},o.prototype._setDictionary=function(){if(null!=this.dictionary){switch(this.err=a.Z_OK,this.mode){case a.DEFLATE:case a.DEFLATERAW:this.err=r.deflateSetDictionary(this.strm,this.dictionary)}this.err!==a.Z_OK&&this._error("Failed to set dictionary")}},o.prototype._reset=function(){switch(this.err=a.Z_OK,this.mode){case a.DEFLATE:case a.DEFLATERAW:case a.GZIP:this.err=r.deflateReset(this.strm);break;case a.INFLATE:case a.INFLATERAW:case a.GUNZIP:this.err=n.inflateReset(this.strm)}this.err!==a.Z_OK&&this._error("Failed to reset stream")},a.Zlib=o},78559:(e,a,t)=>{"use strict";var c=t(48287).Buffer,f=t(88310).Transform,d=t(5974),r=t(40537),n=t(94148).ok,i=t(48287).kMaxLength,b="Cannot create final Buffer. It would be larger than 0x"+i.toString(16)+" bytes";d.Z_MIN_WINDOWBITS=8,d.Z_MAX_WINDOWBITS=15,d.Z_DEFAULT_WINDOWBITS=15,d.Z_MIN_CHUNK=64,d.Z_MAX_CHUNK=1/0,d.Z_DEFAULT_CHUNK=16384,d.Z_MIN_MEMLEVEL=1,d.Z_MAX_MEMLEVEL=9,d.Z_DEFAULT_MEMLEVEL=8,d.Z_MIN_LEVEL=-1,d.Z_MAX_LEVEL=9,d.Z_DEFAULT_LEVEL=d.Z_DEFAULT_COMPRESSION;for(var o=Object.keys(d),s=0;s=i?r=new RangeError(b):a=c.concat(f,d),f=[],e.close(),t(r,a)}e.on("error",(function(a){e.removeListener("end",n),e.removeListener("readable",r),t(a)})),e.on("end",n),e.end(a),r()}function x(e,a){if("string"==typeof a&&(a=c.from(a)),!c.isBuffer(a))throw new TypeError("Not a string or buffer");var t=e._finishFlushFlag;return e._processChunk(a,t)}function y(e){if(!(this instanceof y))return new y(e);M.call(this,e,d.DEFLATE)}function A(e){if(!(this instanceof A))return new A(e);M.call(this,e,d.INFLATE)}function v(e){if(!(this instanceof v))return new v(e);M.call(this,e,d.GZIP)}function w(e){if(!(this instanceof w))return new w(e);M.call(this,e,d.GUNZIP)}function _(e){if(!(this instanceof _))return new _(e);M.call(this,e,d.DEFLATERAW)}function I(e){if(!(this instanceof I))return new I(e);M.call(this,e,d.INFLATERAW)}function E(e){if(!(this instanceof E))return new E(e);M.call(this,e,d.UNZIP)}function C(e){return e===d.Z_NO_FLUSH||e===d.Z_PARTIAL_FLUSH||e===d.Z_SYNC_FLUSH||e===d.Z_FULL_FLUSH||e===d.Z_FINISH||e===d.Z_BLOCK}function M(e,t){var r=this;if(this._opts=e=e||{},this._chunkSize=e.chunkSize||a.Z_DEFAULT_CHUNK,f.call(this,e),e.flush&&!C(e.flush))throw new Error("Invalid flush flag: "+e.flush);if(e.finishFlush&&!C(e.finishFlush))throw new Error("Invalid flush flag: "+e.finishFlush);if(this._flushFlag=e.flush||d.Z_NO_FLUSH,this._finishFlushFlag=void 0!==e.finishFlush?e.finishFlush:d.Z_FINISH,e.chunkSize&&(e.chunkSizea.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsa.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levela.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevela.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=a.Z_FILTERED&&e.strategy!=a.Z_HUFFMAN_ONLY&&e.strategy!=a.Z_RLE&&e.strategy!=a.Z_FIXED&&e.strategy!=a.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!c.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new d.Zlib(t);var n=this;this._hadError=!1,this._handle.onerror=function(e,t){B(n),n._hadError=!0;var c=new Error(e);c.errno=t,c.code=a.codes[t],n.emit("error",c)};var i=a.Z_DEFAULT_COMPRESSION;"number"==typeof e.level&&(i=e.level);var b=a.Z_DEFAULT_STRATEGY;"number"==typeof e.strategy&&(b=e.strategy),this._handle.init(e.windowBits||a.Z_DEFAULT_WINDOWBITS,i,e.memLevel||a.Z_DEFAULT_MEMLEVEL,b,e.dictionary),this._buffer=c.allocUnsafe(this._chunkSize),this._offset=0,this._level=i,this._strategy=b,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function B(e,a){a&&process.nextTick(a),e._handle&&(e._handle.close(),e._handle=null)}function k(e){e.emit("close")}Object.defineProperty(a,"codes",{enumerable:!0,value:Object.freeze(u),writable:!1}),a.Deflate=y,a.Inflate=A,a.Gzip=v,a.Gunzip=w,a.DeflateRaw=_,a.InflateRaw=I,a.Unzip=E,a.createDeflate=function(e){return new y(e)},a.createInflate=function(e){return new A(e)},a.createDeflateRaw=function(e){return new _(e)},a.createInflateRaw=function(e){return new I(e)},a.createGzip=function(e){return new v(e)},a.createGunzip=function(e){return new w(e)},a.createUnzip=function(e){return new E(e)},a.deflate=function(e,a,t){return"function"==typeof a&&(t=a,a={}),m(new y(a),e,t)},a.deflateSync=function(e,a){return x(new y(a),e)},a.gzip=function(e,a,t){return"function"==typeof a&&(t=a,a={}),m(new v(a),e,t)},a.gzipSync=function(e,a){return x(new v(a),e)},a.deflateRaw=function(e,a,t){return"function"==typeof a&&(t=a,a={}),m(new _(a),e,t)},a.deflateRawSync=function(e,a){return x(new _(a),e)},a.unzip=function(e,a,t){return"function"==typeof a&&(t=a,a={}),m(new E(a),e,t)},a.unzipSync=function(e,a){return x(new E(a),e)},a.inflate=function(e,a,t){return"function"==typeof a&&(t=a,a={}),m(new A(a),e,t)},a.inflateSync=function(e,a){return x(new A(a),e)},a.gunzip=function(e,a,t){return"function"==typeof a&&(t=a,a={}),m(new w(a),e,t)},a.gunzipSync=function(e,a){return x(new w(a),e)},a.inflateRaw=function(e,a,t){return"function"==typeof a&&(t=a,a={}),m(new I(a),e,t)},a.inflateRawSync=function(e,a){return x(new I(a),e)},r.inherits(M,f),M.prototype.params=function(e,t,c){if(ea.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=a.Z_FILTERED&&t!=a.Z_HUFFMAN_ONLY&&t!=a.Z_RLE&&t!=a.Z_FIXED&&t!=a.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);if(this._level!==e||this._strategy!==t){var f=this;this.flush(d.Z_SYNC_FLUSH,(function(){n(f._handle,"zlib binding closed"),f._handle.params(e,t),f._hadError||(f._level=e,f._strategy=t,c&&c())}))}else process.nextTick(c)},M.prototype.reset=function(){return n(this._handle,"zlib binding closed"),this._handle.reset()},M.prototype._flush=function(e){this._transform(c.alloc(0),"",e)},M.prototype.flush=function(e,a){var t=this,f=this._writableState;("function"==typeof e||void 0===e&&!a)&&(a=e,e=d.Z_FULL_FLUSH),f.ended?a&&process.nextTick(a):f.ending?a&&this.once("end",a):f.needDrain?a&&this.once("drain",(function(){return t.flush(e,a)})):(this._flushFlag=e,this.write(c.alloc(0),"",a))},M.prototype.close=function(e){B(this,e),process.nextTick(k,this)},M.prototype._transform=function(e,a,t){var f,r=this._writableState,n=(r.ending||r.ended)&&(!e||r.length===e.length);return null===e||c.isBuffer(e)?this._handle?(n?f=this._finishFlushFlag:(f=this._flushFlag,e.length>=r.length&&(this._flushFlag=this._opts.flush||d.Z_NO_FLUSH)),void this._processChunk(e,f,t)):t(new Error("zlib binding closed")):t(new Error("invalid input"))},M.prototype._processChunk=function(e,a,t){var f=e&&e.length,d=this._chunkSize-this._offset,r=0,o=this,s="function"==typeof t;if(!s){var l,u=[],h=0;this.on("error",(function(e){l=e})),n(this._handle,"zlib binding closed");do{var p=this._handle.writeSync(a,e,r,f,this._buffer,this._offset,d)}while(!this._hadError&&x(p[0],p[1]));if(this._hadError)throw l;if(h>=i)throw B(this),new RangeError(b);var g=c.concat(u,h);return B(this),g}n(this._handle,"zlib binding closed");var m=this._handle.write(a,e,r,f,this._buffer,this._offset,d);function x(i,b){if(this&&(this.buffer=null,this.callback=null),!o._hadError){var l=d-b;if(n(l>=0,"have should not go down"),l>0){var p=o._buffer.slice(o._offset,o._offset+l);o._offset+=l,s?o.push(p):(u.push(p),h+=p.length)}if((0===b||o._offset>=o._chunkSize)&&(d=o._chunkSize,o._offset=0,o._buffer=c.allocUnsafe(o._chunkSize)),0===b){if(r+=f-i,f=i,!s)return!0;var g=o._handle.write(a,e,r,f,o._buffer,o._offset,o._chunkSize);return g.callback=x,void(g.buffer=e)}if(!s)return!1;t()}}m.buffer=e,m.callback=x},r.inherits(y,M),r.inherits(A,M),r.inherits(v,M),r.inherits(w,M),r.inherits(_,M),r.inherits(I,M),r.inherits(E,M)},30295:(e,a,t)=>{var c=t(62045).hp;e.exports=function(e,a){for(var t=Math.min(e.length,a.length),f=new c(t),d=0;d{"use strict";var c=t(67526),f=t(251),d="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;a.Buffer=i,a.SlowBuffer=function(e){return+e!=e&&(e=0),i.alloc(+e)},a.INSPECT_MAX_BYTES=50;var r=2147483647;function n(e){if(e>r)throw new RangeError('The value "'+e+'" is invalid for option "size"');var a=new Uint8Array(e);return Object.setPrototypeOf(a,i.prototype),a}function i(e,a,t){if("number"==typeof e){if("string"==typeof a)throw new TypeError('The "string" argument must be of type string. Received type number');return s(e)}return b(e,a,t)}function b(e,a,t){if("string"==typeof e)return function(e,a){if("string"==typeof a&&""!==a||(a="utf8"),!i.isEncoding(a))throw new TypeError("Unknown encoding: "+a);var t=0|p(e,a),c=n(t),f=c.write(e,a);return f!==t&&(c=c.slice(0,f)),c}(e,a);if(ArrayBuffer.isView(e))return function(e){if(j(e,Uint8Array)){var a=new Uint8Array(e);return u(a.buffer,a.byteOffset,a.byteLength)}return l(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(j(e,ArrayBuffer)||e&&j(e.buffer,ArrayBuffer))return u(e,a,t);if("undefined"!=typeof SharedArrayBuffer&&(j(e,SharedArrayBuffer)||e&&j(e.buffer,SharedArrayBuffer)))return u(e,a,t);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var c=e.valueOf&&e.valueOf();if(null!=c&&c!==e)return i.from(c,a,t);var f=function(e){if(i.isBuffer(e)){var a=0|h(e.length),t=n(a);return 0===t.length||e.copy(t,0,0,a),t}return void 0!==e.length?"number"!=typeof e.length||H(e.length)?n(0):l(e):"Buffer"===e.type&&Array.isArray(e.data)?l(e.data):void 0}(e);if(f)return f;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return i.from(e[Symbol.toPrimitive]("string"),a,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function o(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function s(e){return o(e),n(e<0?0:0|h(e))}function l(e){for(var a=e.length<0?0:0|h(e.length),t=n(a),c=0;c=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|e}function p(e,a){if(i.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||j(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var t=e.length,c=arguments.length>2&&!0===arguments[2];if(!c&&0===t)return 0;for(var f=!1;;)switch(a){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return F(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*t;case"hex":return t>>>1;case"base64":return Q(e).length;default:if(f)return c?-1:F(e).length;a=(""+a).toLowerCase(),f=!0}}function g(e,a,t){var c=!1;if((void 0===a||a<0)&&(a=0),a>this.length)return"";if((void 0===t||t>this.length)&&(t=this.length),t<=0)return"";if((t>>>=0)<=(a>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return L(this,a,t);case"utf8":case"utf-8":return C(this,a,t);case"ascii":return B(this,a,t);case"latin1":case"binary":return k(this,a,t);case"base64":return E(this,a,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,a,t);default:if(c)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),c=!0}}function m(e,a,t){var c=e[a];e[a]=e[t],e[t]=c}function x(e,a,t,c,f){if(0===e.length)return-1;if("string"==typeof t?(c=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),H(t=+t)&&(t=f?0:e.length-1),t<0&&(t=e.length+t),t>=e.length){if(f)return-1;t=e.length-1}else if(t<0){if(!f)return-1;t=0}if("string"==typeof a&&(a=i.from(a,c)),i.isBuffer(a))return 0===a.length?-1:y(e,a,t,c,f);if("number"==typeof a)return a&=255,"function"==typeof Uint8Array.prototype.indexOf?f?Uint8Array.prototype.indexOf.call(e,a,t):Uint8Array.prototype.lastIndexOf.call(e,a,t):y(e,[a],t,c,f);throw new TypeError("val must be string, number or Buffer")}function y(e,a,t,c,f){var d,r=1,n=e.length,i=a.length;if(void 0!==c&&("ucs2"===(c=String(c).toLowerCase())||"ucs-2"===c||"utf16le"===c||"utf-16le"===c)){if(e.length<2||a.length<2)return-1;r=2,n/=2,i/=2,t/=2}function b(e,a){return 1===r?e[a]:e.readUInt16BE(a*r)}if(f){var o=-1;for(d=t;dn&&(t=n-i),d=t;d>=0;d--){for(var s=!0,l=0;lf&&(c=f):c=f;var d=a.length;c>d/2&&(c=d/2);for(var r=0;r>8,f=t%256,d.push(f),d.push(c);return d}(a,e.length-t),e,t,c)}function E(e,a,t){return 0===a&&t===e.length?c.fromByteArray(e):c.fromByteArray(e.slice(a,t))}function C(e,a,t){t=Math.min(e.length,t);for(var c=[],f=a;f239?4:b>223?3:b>191?2:1;if(f+s<=t)switch(s){case 1:b<128&&(o=b);break;case 2:128==(192&(d=e[f+1]))&&(i=(31&b)<<6|63&d)>127&&(o=i);break;case 3:d=e[f+1],r=e[f+2],128==(192&d)&&128==(192&r)&&(i=(15&b)<<12|(63&d)<<6|63&r)>2047&&(i<55296||i>57343)&&(o=i);break;case 4:d=e[f+1],r=e[f+2],n=e[f+3],128==(192&d)&&128==(192&r)&&128==(192&n)&&(i=(15&b)<<18|(63&d)<<12|(63&r)<<6|63&n)>65535&&i<1114112&&(o=i)}null===o?(o=65533,s=1):o>65535&&(o-=65536,c.push(o>>>10&1023|55296),o=56320|1023&o),c.push(o),f+=s}return function(e){var a=e.length;if(a<=M)return String.fromCharCode.apply(String,e);for(var t="",c=0;cc.length?i.from(d).copy(c,f):Uint8Array.prototype.set.call(c,d,f);else{if(!i.isBuffer(d))throw new TypeError('"list" argument must be an Array of Buffers');d.copy(c,f)}f+=d.length}return c},i.byteLength=p,i.prototype._isBuffer=!0,i.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var a=0;at&&(e+=" ... "),""},d&&(i.prototype[d]=i.prototype.inspect),i.prototype.compare=function(e,a,t,c,f){if(j(e,Uint8Array)&&(e=i.from(e,e.offset,e.byteLength)),!i.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===a&&(a=0),void 0===t&&(t=e?e.length:0),void 0===c&&(c=0),void 0===f&&(f=this.length),a<0||t>e.length||c<0||f>this.length)throw new RangeError("out of range index");if(c>=f&&a>=t)return 0;if(c>=f)return-1;if(a>=t)return 1;if(this===e)return 0;for(var d=(f>>>=0)-(c>>>=0),r=(t>>>=0)-(a>>>=0),n=Math.min(d,r),b=this.slice(c,f),o=e.slice(a,t),s=0;s>>=0,isFinite(t)?(t>>>=0,void 0===c&&(c="utf8")):(c=t,t=void 0)}var f=this.length-a;if((void 0===t||t>f)&&(t=f),e.length>0&&(t<0||a<0)||a>this.length)throw new RangeError("Attempt to write outside buffer bounds");c||(c="utf8");for(var d=!1;;)switch(c){case"hex":return A(this,e,a,t);case"utf8":case"utf-8":return v(this,e,a,t);case"ascii":case"latin1":case"binary":return w(this,e,a,t);case"base64":return _(this,e,a,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,a,t);default:if(d)throw new TypeError("Unknown encoding: "+c);c=(""+c).toLowerCase(),d=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var M=4096;function B(e,a,t){var c="";t=Math.min(e.length,t);for(var f=a;fc)&&(t=c);for(var f="",d=a;dt)throw new RangeError("Trying to access beyond buffer length")}function N(e,a,t,c,f,d){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(a>f||ae.length)throw new RangeError("Index out of range")}function R(e,a,t,c,f,d){if(t+c>e.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function P(e,a,t,c,d){return a=+a,t>>>=0,d||R(e,0,t,4),f.write(e,a,t,c,23,4),t+4}function D(e,a,t,c,d){return a=+a,t>>>=0,d||R(e,0,t,8),f.write(e,a,t,c,52,8),t+8}i.prototype.slice=function(e,a){var t=this.length;(e=~~e)<0?(e+=t)<0&&(e=0):e>t&&(e=t),(a=void 0===a?t:~~a)<0?(a+=t)<0&&(a=0):a>t&&(a=t),a>>=0,a>>>=0,t||T(e,a,this.length);for(var c=this[e],f=1,d=0;++d>>=0,a>>>=0,t||T(e,a,this.length);for(var c=this[e+--a],f=1;a>0&&(f*=256);)c+=this[e+--a]*f;return c},i.prototype.readUint8=i.prototype.readUInt8=function(e,a){return e>>>=0,a||T(e,1,this.length),this[e]},i.prototype.readUint16LE=i.prototype.readUInt16LE=function(e,a){return e>>>=0,a||T(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUint16BE=i.prototype.readUInt16BE=function(e,a){return e>>>=0,a||T(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUint32LE=i.prototype.readUInt32LE=function(e,a){return e>>>=0,a||T(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUint32BE=i.prototype.readUInt32BE=function(e,a){return e>>>=0,a||T(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readIntLE=function(e,a,t){e>>>=0,a>>>=0,t||T(e,a,this.length);for(var c=this[e],f=1,d=0;++d=(f*=128)&&(c-=Math.pow(2,8*a)),c},i.prototype.readIntBE=function(e,a,t){e>>>=0,a>>>=0,t||T(e,a,this.length);for(var c=a,f=1,d=this[e+--c];c>0&&(f*=256);)d+=this[e+--c]*f;return d>=(f*=128)&&(d-=Math.pow(2,8*a)),d},i.prototype.readInt8=function(e,a){return e>>>=0,a||T(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,a){e>>>=0,a||T(e,2,this.length);var t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},i.prototype.readInt16BE=function(e,a){e>>>=0,a||T(e,2,this.length);var t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},i.prototype.readInt32LE=function(e,a){return e>>>=0,a||T(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,a){return e>>>=0,a||T(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readFloatLE=function(e,a){return e>>>=0,a||T(e,4,this.length),f.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,a){return e>>>=0,a||T(e,4,this.length),f.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,a){return e>>>=0,a||T(e,8,this.length),f.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,a){return e>>>=0,a||T(e,8,this.length),f.read(this,e,!1,52,8)},i.prototype.writeUintLE=i.prototype.writeUIntLE=function(e,a,t,c){e=+e,a>>>=0,t>>>=0,c||N(this,e,a,t,Math.pow(2,8*t)-1,0);var f=1,d=0;for(this[a]=255&e;++d>>=0,t>>>=0,c||N(this,e,a,t,Math.pow(2,8*t)-1,0);var f=t-1,d=1;for(this[a+f]=255&e;--f>=0&&(d*=256);)this[a+f]=e/d&255;return a+t},i.prototype.writeUint8=i.prototype.writeUInt8=function(e,a,t){return e=+e,a>>>=0,t||N(this,e,a,1,255,0),this[a]=255&e,a+1},i.prototype.writeUint16LE=i.prototype.writeUInt16LE=function(e,a,t){return e=+e,a>>>=0,t||N(this,e,a,2,65535,0),this[a]=255&e,this[a+1]=e>>>8,a+2},i.prototype.writeUint16BE=i.prototype.writeUInt16BE=function(e,a,t){return e=+e,a>>>=0,t||N(this,e,a,2,65535,0),this[a]=e>>>8,this[a+1]=255&e,a+2},i.prototype.writeUint32LE=i.prototype.writeUInt32LE=function(e,a,t){return e=+e,a>>>=0,t||N(this,e,a,4,4294967295,0),this[a+3]=e>>>24,this[a+2]=e>>>16,this[a+1]=e>>>8,this[a]=255&e,a+4},i.prototype.writeUint32BE=i.prototype.writeUInt32BE=function(e,a,t){return e=+e,a>>>=0,t||N(this,e,a,4,4294967295,0),this[a]=e>>>24,this[a+1]=e>>>16,this[a+2]=e>>>8,this[a+3]=255&e,a+4},i.prototype.writeIntLE=function(e,a,t,c){if(e=+e,a>>>=0,!c){var f=Math.pow(2,8*t-1);N(this,e,a,t,f-1,-f)}var d=0,r=1,n=0;for(this[a]=255&e;++d>>=0,!c){var f=Math.pow(2,8*t-1);N(this,e,a,t,f-1,-f)}var d=t-1,r=1,n=0;for(this[a+d]=255&e;--d>=0&&(r*=256);)e<0&&0===n&&0!==this[a+d+1]&&(n=1),this[a+d]=(e/r|0)-n&255;return a+t},i.prototype.writeInt8=function(e,a,t){return e=+e,a>>>=0,t||N(this,e,a,1,127,-128),e<0&&(e=255+e+1),this[a]=255&e,a+1},i.prototype.writeInt16LE=function(e,a,t){return e=+e,a>>>=0,t||N(this,e,a,2,32767,-32768),this[a]=255&e,this[a+1]=e>>>8,a+2},i.prototype.writeInt16BE=function(e,a,t){return e=+e,a>>>=0,t||N(this,e,a,2,32767,-32768),this[a]=e>>>8,this[a+1]=255&e,a+2},i.prototype.writeInt32LE=function(e,a,t){return e=+e,a>>>=0,t||N(this,e,a,4,2147483647,-2147483648),this[a]=255&e,this[a+1]=e>>>8,this[a+2]=e>>>16,this[a+3]=e>>>24,a+4},i.prototype.writeInt32BE=function(e,a,t){return e=+e,a>>>=0,t||N(this,e,a,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[a]=e>>>24,this[a+1]=e>>>16,this[a+2]=e>>>8,this[a+3]=255&e,a+4},i.prototype.writeFloatLE=function(e,a,t){return P(this,e,a,!0,t)},i.prototype.writeFloatBE=function(e,a,t){return P(this,e,a,!1,t)},i.prototype.writeDoubleLE=function(e,a,t){return D(this,e,a,!0,t)},i.prototype.writeDoubleBE=function(e,a,t){return D(this,e,a,!1,t)},i.prototype.copy=function(e,a,t,c){if(!i.isBuffer(e))throw new TypeError("argument should be a Buffer");if(t||(t=0),c||0===c||(c=this.length),a>=e.length&&(a=e.length),a||(a=0),c>0&&c=this.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("sourceEnd out of bounds");c>this.length&&(c=this.length),e.length-a>>=0,t=void 0===t?this.length:t>>>0,e||(e=0),"number"==typeof e)for(d=a;d55295&&t<57344){if(!f){if(t>56319){(a-=3)>-1&&d.push(239,191,189);continue}if(r+1===c){(a-=3)>-1&&d.push(239,191,189);continue}f=t;continue}if(t<56320){(a-=3)>-1&&d.push(239,191,189),f=t;continue}t=65536+(f-55296<<10|t-56320)}else f&&(a-=3)>-1&&d.push(239,191,189);if(f=null,t<128){if((a-=1)<0)break;d.push(t)}else if(t<2048){if((a-=2)<0)break;d.push(t>>6|192,63&t|128)}else if(t<65536){if((a-=3)<0)break;d.push(t>>12|224,t>>6&63|128,63&t|128)}else{if(!(t<1114112))throw new Error("Invalid code point");if((a-=4)<0)break;d.push(t>>18|240,t>>12&63|128,t>>6&63|128,63&t|128)}}return d}function Q(e){return c.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(O,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function U(e,a,t,c){for(var f=0;f=a.length||f>=e.length);++f)a[f+t]=e[f];return f}function j(e,a){return e instanceof a||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===a.name}function H(e){return e!=e}var q=function(){for(var e="0123456789abcdef",a=new Array(256),t=0;t<16;++t)for(var c=16*t,f=0;f<16;++f)a[c+f]=e[t]+e[f];return a}()},86866:e=>{e.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"}},38075:(e,a,t)=>{"use strict";var c=t(70453),f=t(10487),d=f(c("String.prototype.indexOf"));e.exports=function(e,a){var t=c(e,!!a);return"function"==typeof t&&d(e,".prototype.")>-1?f(t):t}},10487:(e,a,t)=>{"use strict";var c=t(66743),f=t(70453),d=t(96897),r=t(69675),n=f("%Function.prototype.apply%"),i=f("%Function.prototype.call%"),b=f("%Reflect.apply%",!0)||c.call(i,n),o=t(30655),s=f("%Math.max%");e.exports=function(e){if("function"!=typeof e)throw new r("a function is required");var a=b(c,i,arguments);return d(a,1+s(0,e.length-(arguments.length-1)),!0)};var l=function(){return b(c,n,arguments)};o?o(e.exports,"apply",{value:l}):e.exports.apply=l},90297:e=>{"use strict";const a=Object.freeze({identity:0,sha1:17,"sha2-256":18,"sha2-512":19,"sha3-512":20,"sha3-384":21,"sha3-256":22,"sha3-224":23,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,blake3:30,"murmur3-128":34,"murmur3-32":35,"dbl-sha2-256":86,md4:212,md5:213,bmt:214,"sha2-256-trunc254-padded":4114,"ripemd-128":4178,"ripemd-160":4179,"ripemd-256":4180,"ripemd-320":4181,x11:4352,kangarootwelve:7425,"sm3-256":21325,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"skein256-8":45825,"skein256-16":45826,"skein256-24":45827,"skein256-32":45828,"skein256-40":45829,"skein256-48":45830,"skein256-56":45831,"skein256-64":45832,"skein256-72":45833,"skein256-80":45834,"skein256-88":45835,"skein256-96":45836,"skein256-104":45837,"skein256-112":45838,"skein256-120":45839,"skein256-128":45840,"skein256-136":45841,"skein256-144":45842,"skein256-152":45843,"skein256-160":45844,"skein256-168":45845,"skein256-176":45846,"skein256-184":45847,"skein256-192":45848,"skein256-200":45849,"skein256-208":45850,"skein256-216":45851,"skein256-224":45852,"skein256-232":45853,"skein256-240":45854,"skein256-248":45855,"skein256-256":45856,"skein512-8":45857,"skein512-16":45858,"skein512-24":45859,"skein512-32":45860,"skein512-40":45861,"skein512-48":45862,"skein512-56":45863,"skein512-64":45864,"skein512-72":45865,"skein512-80":45866,"skein512-88":45867,"skein512-96":45868,"skein512-104":45869,"skein512-112":45870,"skein512-120":45871,"skein512-128":45872,"skein512-136":45873,"skein512-144":45874,"skein512-152":45875,"skein512-160":45876,"skein512-168":45877,"skein512-176":45878,"skein512-184":45879,"skein512-192":45880,"skein512-200":45881,"skein512-208":45882,"skein512-216":45883,"skein512-224":45884,"skein512-232":45885,"skein512-240":45886,"skein512-248":45887,"skein512-256":45888,"skein512-264":45889,"skein512-272":45890,"skein512-280":45891,"skein512-288":45892,"skein512-296":45893,"skein512-304":45894,"skein512-312":45895,"skein512-320":45896,"skein512-328":45897,"skein512-336":45898,"skein512-344":45899,"skein512-352":45900,"skein512-360":45901,"skein512-368":45902,"skein512-376":45903,"skein512-384":45904,"skein512-392":45905,"skein512-400":45906,"skein512-408":45907,"skein512-416":45908,"skein512-424":45909,"skein512-432":45910,"skein512-440":45911,"skein512-448":45912,"skein512-456":45913,"skein512-464":45914,"skein512-472":45915,"skein512-480":45916,"skein512-488":45917,"skein512-496":45918,"skein512-504":45919,"skein512-512":45920,"skein1024-8":45921,"skein1024-16":45922,"skein1024-24":45923,"skein1024-32":45924,"skein1024-40":45925,"skein1024-48":45926,"skein1024-56":45927,"skein1024-64":45928,"skein1024-72":45929,"skein1024-80":45930,"skein1024-88":45931,"skein1024-96":45932,"skein1024-104":45933,"skein1024-112":45934,"skein1024-120":45935,"skein1024-128":45936,"skein1024-136":45937,"skein1024-144":45938,"skein1024-152":45939,"skein1024-160":45940,"skein1024-168":45941,"skein1024-176":45942,"skein1024-184":45943,"skein1024-192":45944,"skein1024-200":45945,"skein1024-208":45946,"skein1024-216":45947,"skein1024-224":45948,"skein1024-232":45949,"skein1024-240":45950,"skein1024-248":45951,"skein1024-256":45952,"skein1024-264":45953,"skein1024-272":45954,"skein1024-280":45955,"skein1024-288":45956,"skein1024-296":45957,"skein1024-304":45958,"skein1024-312":45959,"skein1024-320":45960,"skein1024-328":45961,"skein1024-336":45962,"skein1024-344":45963,"skein1024-352":45964,"skein1024-360":45965,"skein1024-368":45966,"skein1024-376":45967,"skein1024-384":45968,"skein1024-392":45969,"skein1024-400":45970,"skein1024-408":45971,"skein1024-416":45972,"skein1024-424":45973,"skein1024-432":45974,"skein1024-440":45975,"skein1024-448":45976,"skein1024-456":45977,"skein1024-464":45978,"skein1024-472":45979,"skein1024-480":45980,"skein1024-488":45981,"skein1024-496":45982,"skein1024-504":45983,"skein1024-512":45984,"skein1024-520":45985,"skein1024-528":45986,"skein1024-536":45987,"skein1024-544":45988,"skein1024-552":45989,"skein1024-560":45990,"skein1024-568":45991,"skein1024-576":45992,"skein1024-584":45993,"skein1024-592":45994,"skein1024-600":45995,"skein1024-608":45996,"skein1024-616":45997,"skein1024-624":45998,"skein1024-632":45999,"skein1024-640":46e3,"skein1024-648":46001,"skein1024-656":46002,"skein1024-664":46003,"skein1024-672":46004,"skein1024-680":46005,"skein1024-688":46006,"skein1024-696":46007,"skein1024-704":46008,"skein1024-712":46009,"skein1024-720":46010,"skein1024-728":46011,"skein1024-736":46012,"skein1024-744":46013,"skein1024-752":46014,"skein1024-760":46015,"skein1024-768":46016,"skein1024-776":46017,"skein1024-784":46018,"skein1024-792":46019,"skein1024-800":46020,"skein1024-808":46021,"skein1024-816":46022,"skein1024-824":46023,"skein1024-832":46024,"skein1024-840":46025,"skein1024-848":46026,"skein1024-856":46027,"skein1024-864":46028,"skein1024-872":46029,"skein1024-880":46030,"skein1024-888":46031,"skein1024-896":46032,"skein1024-904":46033,"skein1024-912":46034,"skein1024-920":46035,"skein1024-928":46036,"skein1024-936":46037,"skein1024-944":46038,"skein1024-952":46039,"skein1024-960":46040,"skein1024-968":46041,"skein1024-976":46042,"skein1024-984":46043,"skein1024-992":46044,"skein1024-1000":46045,"skein1024-1008":46046,"skein1024-1016":46047,"skein1024-1024":46048,"poseidon-bls12_381-a2-fc1":46081,"poseidon-bls12_381-a2-fc1-sc":46082});e.exports={names:a}},17684:(e,a,t)=>{"use strict";const c=t(91466),f=t(61203),{names:d}=t(90297),{toString:r}=t(27302),{fromString:n}=t(44117),{concat:i}=t(75007),b={};for(const e in d){const a=e;b[d[a]]=a}function o(e){if(!(e instanceof Uint8Array))throw new Error("multihash must be a Uint8Array");if(e.length<2)throw new Error("multihash too short. must be > 2 bytes.");const a=f.decode(e);if(!u(a))throw new Error(`multihash unknown function code: 0x${a.toString(16)}`);e=e.slice(f.decode.bytes);const t=f.decode(e);if(t<0)throw new Error(`multihash invalid length: ${t}`);if((e=e.slice(f.decode.bytes)).length!==t)throw new Error(`multihash length inconsistent: 0x${r(e,"base16")}`);return{code:a,name:b[a],length:t,digest:e}}function s(e){let a=e;if("string"==typeof e){if(void 0===d[e])throw new Error(`Unrecognized hash function named: ${e}`);a=d[e]}if("number"!=typeof a)throw new Error(`Hash function code should be a number. Got: ${a}`);if(void 0===b[a]&&!l(a))throw new Error(`Unrecognized function code: ${a}`);return a}function l(e){return e>0&&e<16}function u(e){return!!l(e)||!!b[e]}function h(e){o(e)}Object.freeze(b),e.exports={names:d,codes:b,toHexString:function(e){if(!(e instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return r(e,"base16")},fromHexString:function(e){return n(e,"base16")},toB58String:function(e){if(!(e instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return r(c.encode("base58btc",e)).slice(1)},fromB58String:function(e){const a=e instanceof Uint8Array?r(e):e;return c.decode("z"+a)},decode:o,encode:function(e,a,t){if(!e||void 0===a)throw new Error("multihash encode requires at least two args: digest, code");const c=s(a);if(!(e instanceof Uint8Array))throw new Error("digest should be a Uint8Array");if(null==t&&(t=e.length),t&&e.length!==t)throw new Error("digest length should be equal to specified length.");const d=f.encode(c),r=f.encode(t);return i([d,r,e],d.length+r.length+e.length)},coerceCode:s,isAppCode:l,validate:h,prefix:function(e){return h(e),e.subarray(0,2)},isValidCode:u}},64378:(e,a,t)=>{"use strict";const c=t(17684),f={checkCIDComponents:function(e){if(null==e)return"null values are not valid CIDs";if(0!==e.version&&1!==e.version)return"Invalid version, must be a number equal to 1 or 0";if("string"!=typeof e.codec)return"codec must be string";if(0===e.version){if("dag-pb"!==e.codec)return"codec must be 'dag-pb' for CIDv0";if("base58btc"!==e.multibaseName)return"multibaseName must be 'base58btc' for CIDv0"}if(!(e.multihash instanceof Uint8Array))return"multihash must be a Uint8Array";try{c.validate(e.multihash)}catch(e){let a=e.message;return a||(a="Multihash validation failed"),a}}};e.exports=f},26613:(e,a,t)=>{"use strict";const c=t(17684),f=t(91466),d=t(52021),r=t(64378),{concat:n}=t(75007),{toString:i}=t(27302),{equals:b}=t(18402),o=d.nameToCode,s=Object.keys(o).reduce(((e,a)=>(e[o[a]]=a,e)),{}),l=Symbol.for("@ipld/js-cid/CID");class u{constructor(e,a,t,r){if(this.version,this.codec,this.multihash,Object.defineProperty(this,l,{value:!0}),u.isCID(e)){const a=e;return this.version=a.version,this.codec=a.codec,this.multihash=a.multihash,void(this.multibaseName=a.multibaseName||(0===a.version?"base58btc":"base32"))}if("string"==typeof e){const a=f.isEncoded(e);if(a){const t=f.decode(e);this.version=parseInt(t[0].toString(),16),this.codec=d.getCodec(t.slice(1)),this.multihash=d.rmPrefix(t.slice(1)),this.multibaseName=a}else this.version=0,this.codec="dag-pb",this.multihash=c.fromB58String(e),this.multibaseName="base58btc";return u.validateCID(this),void Object.defineProperty(this,"string",{value:e})}if(e instanceof Uint8Array){const a=parseInt(e[0].toString(),16);if(1===a){const t=e;this.version=a,this.codec=d.getCodec(t.slice(1)),this.multihash=d.rmPrefix(t.slice(1)),this.multibaseName="base32"}else this.version=0,this.codec="dag-pb",this.multihash=e,this.multibaseName="base58btc";u.validateCID(this)}else this.version=e,"number"==typeof a&&(a=s[a]),this.codec=a,this.multihash=t,this.multibaseName=r||(0===e?"base58btc":"base32"),u.validateCID(this)}get bytes(){let e=this._bytes;if(!e){if(0===this.version)e=this.multihash;else{if(1!==this.version)throw new Error("unsupported version");{const a=d.getCodeVarint(this.codec);e=n([[1],a,this.multihash],1+a.byteLength+this.multihash.byteLength)}}Object.defineProperty(this,"_bytes",{value:e})}return e}get prefix(){const e=d.getCodeVarint(this.codec),a=c.prefix(this.multihash);return n([[this.version],e,a],1+e.byteLength+a.byteLength)}get code(){return o[this.codec]}toV0(){if("dag-pb"!==this.codec)throw new Error("Cannot convert a non dag-pb CID to CIDv0");const{name:e,length:a}=c.decode(this.multihash);if("sha2-256"!==e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(32!==a)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new u(0,this.codec,this.multihash)}toV1(){return new u(1,this.codec,this.multihash,this.multibaseName)}toBaseEncodedString(e=this.multibaseName){if(this.string&&0!==this.string.length&&e===this.multibaseName)return this.string;let a;if(0===this.version){if("base58btc"!==e)throw new Error("not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()");a=c.toB58String(this.multihash)}else{if(1!==this.version)throw new Error("unsupported version");a=i(f.encode(e,this.bytes))}return e===this.multibaseName&&Object.defineProperty(this,"string",{value:a}),a}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}toString(e){return this.toBaseEncodedString(e)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(e){return this.codec===e.codec&&this.version===e.version&&b(this.multihash,e.multihash)}static validateCID(e){const a=r.checkCIDComponents(e);if(a)throw new Error(a)}static isCID(e){return e instanceof u||Boolean(e&&e[l])}}u.codecs=o,e.exports=u},56168:(e,a,t)=>{var c=t(92861).Buffer,f=t(88310).Transform,d=t(83141).I;function r(e){f.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}t(56698)(r,f),r.prototype.update=function(e,a,t){"string"==typeof e&&(e=c.from(e,a));var f=this._update(e);return this.hashMode?this:(t&&(f=this._toString(f,t)),f)},r.prototype.setAutoPadding=function(){},r.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},r.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},r.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},r.prototype._transform=function(e,a,t){var c;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){c=e}finally{t(c)}},r.prototype._flush=function(e){var a;try{this.push(this.__final())}catch(e){a=e}e(a)},r.prototype._finalOrDigest=function(e){var a=this.__final()||c.alloc(0);return e&&(a=this._toString(a,e,!0)),a},r.prototype._toString=function(e,a,t){if(this._decoder||(this._decoder=new d(a),this._encoding=a),this._encoding!==a)throw new Error("can't switch encodings");var c=this._decoder.write(e);return t&&(c+=this._decoder.end()),c},e.exports=r},15622:(e,a,t)=>{function c(e){return Object.prototype.toString.call(e)}a.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===c(e)},a.isBoolean=function(e){return"boolean"==typeof e},a.isNull=function(e){return null===e},a.isNullOrUndefined=function(e){return null==e},a.isNumber=function(e){return"number"==typeof e},a.isString=function(e){return"string"==typeof e},a.isSymbol=function(e){return"symbol"==typeof e},a.isUndefined=function(e){return void 0===e},a.isRegExp=function(e){return"[object RegExp]"===c(e)},a.isObject=function(e){return"object"==typeof e&&null!==e},a.isDate=function(e){return"[object Date]"===c(e)},a.isError=function(e){return"[object Error]"===c(e)||e instanceof Error},a.isFunction=function(e){return"function"==typeof e},a.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},a.isBuffer=t(48287).Buffer.isBuffer},61324:(e,a,t)=>{var c=t(62045).hp,f=t(86729),d=t(92801);e.exports=function(e){return new n(e)};var r={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function n(e){this.curveType=r[e],this.curveType||(this.curveType={name:e}),this.curve=new f.ec(this.curveType.name),this.keys=void 0}function i(e,a,t){Array.isArray(e)||(e=e.toArray());var f=new c(e);if(t&&f.length=65&&t<=70?t-55:t>=97&&t<=102?t-87:t-48&15}function i(e,a,t){var c=n(e,t);return t-1>=a&&(c|=n(e,t-1)<<4),c}function b(e,a,t,c){for(var f=0,d=Math.min(e.length,t),r=a;r=49?n-49+10:n>=17?n-17+10:n}return f}d.isBN=function(e){return e instanceof d||null!==e&&"object"==typeof e&&e.constructor.wordSize===d.wordSize&&Array.isArray(e.words)},d.max=function(e,a){return e.cmp(a)>0?e:a},d.min=function(e,a){return e.cmp(a)<0?e:a},d.prototype._init=function(e,a,t){if("number"==typeof e)return this._initNumber(e,a,t);if("object"==typeof e)return this._initArray(e,a,t);"hex"===a&&(a=16),c(a===(0|a)&&a>=2&&a<=36);var f=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(f++,this.negative=1),f=0;f-=3)r=e[f]|e[f-1]<<8|e[f-2]<<16,this.words[d]|=r<>>26-n&67108863,(n+=24)>=26&&(n-=26,d++);else if("le"===t)for(f=0,d=0;f>>26-n&67108863,(n+=24)>=26&&(n-=26,d++);return this.strip()},d.prototype._parseHex=function(e,a,t){this.length=Math.ceil((e.length-a)/6),this.words=new Array(this.length);for(var c=0;c=a;c-=2)f=i(e,a,c)<=18?(d-=18,r+=1,this.words[r]|=f>>>26):d+=8;else for(c=(e.length-a)%2==0?a+1:a;c=18?(d-=18,r+=1,this.words[r]|=f>>>26):d+=8;this.strip()},d.prototype._parseBase=function(e,a,t){this.words=[0],this.length=1;for(var c=0,f=1;f<=67108863;f*=a)c++;c--,f=f/a|0;for(var d=e.length-t,r=d%c,n=Math.min(d,d-r)+t,i=0,o=t;o1&&0===this.words[this.length-1];)this.length--;return this._normSign()},d.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},d.prototype.inspect=function(){return(this.red?""};var o=["","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"],s=[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],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function u(e,a,t){t.negative=a.negative^e.negative;var c=e.length+a.length|0;t.length=c,c=c-1|0;var f=0|e.words[0],d=0|a.words[0],r=f*d,n=67108863&r,i=r/67108864|0;t.words[0]=n;for(var b=1;b>>26,s=67108863&i,l=Math.min(b,a.length-1),u=Math.max(0,b-e.length+1);u<=l;u++){var h=b-u|0;o+=(r=(f=0|e.words[h])*(d=0|a.words[u])+s)/67108864|0,s=67108863&r}t.words[b]=0|s,i=0|o}return 0!==i?t.words[b]=0|i:t.length--,t.strip()}d.prototype.toString=function(e,a){var t;if(a=0|a||1,16===(e=e||10)||"hex"===e){t="";for(var f=0,d=0,r=0;r>>24-f&16777215)||r!==this.length-1?o[6-i.length]+i+t:i+t,(f+=2)>=26&&(f-=26,r--)}for(0!==d&&(t=d.toString(16)+t);t.length%a!=0;)t="0"+t;return 0!==this.negative&&(t="-"+t),t}if(e===(0|e)&&e>=2&&e<=36){var b=s[e],u=l[e];t="";var h=this.clone();for(h.negative=0;!h.isZero();){var p=h.modn(u).toString(e);t=(h=h.idivn(u)).isZero()?p+t:o[b-p.length]+p+t}for(this.isZero()&&(t="0"+t);t.length%a!=0;)t="0"+t;return 0!==this.negative&&(t="-"+t),t}c(!1,"Base should be between 2 and 36")},d.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&c(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},d.prototype.toJSON=function(){return this.toString(16)},d.prototype.toBuffer=function(e,a){return c(void 0!==r),this.toArrayLike(r,e,a)},d.prototype.toArray=function(e,a){return this.toArrayLike(Array,e,a)},d.prototype.toArrayLike=function(e,a,t){var f=this.byteLength(),d=t||Math.max(1,f);c(f<=d,"byte array longer than desired length"),c(d>0,"Requested array length <= 0"),this.strip();var r,n,i="le"===a,b=new e(d),o=this.clone();if(i){for(n=0;!o.isZero();n++)r=o.andln(255),o.iushrn(8),b[n]=r;for(;n=4096&&(t+=13,a>>>=13),a>=64&&(t+=7,a>>>=7),a>=8&&(t+=4,a>>>=4),a>=2&&(t+=2,a>>>=2),t+a},d.prototype._zeroBits=function(e){if(0===e)return 26;var a=e,t=0;return 8191&a||(t+=13,a>>>=13),127&a||(t+=7,a>>>=7),15&a||(t+=4,a>>>=4),3&a||(t+=2,a>>>=2),1&a||t++,t},d.prototype.bitLength=function(){var e=this.words[this.length-1],a=this._countBits(e);return 26*(this.length-1)+a},d.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,a=0;ae.length?this.clone().ior(e):e.clone().ior(this)},d.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},d.prototype.iuand=function(e){var a;a=this.length>e.length?e:this;for(var t=0;te.length?this.clone().iand(e):e.clone().iand(this)},d.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},d.prototype.iuxor=function(e){var a,t;this.length>e.length?(a=this,t=e):(a=e,t=this);for(var c=0;ce.length?this.clone().ixor(e):e.clone().ixor(this)},d.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},d.prototype.inotn=function(e){c("number"==typeof e&&e>=0);var a=0|Math.ceil(e/26),t=e%26;this._expand(a),t>0&&a--;for(var f=0;f0&&(this.words[f]=~this.words[f]&67108863>>26-t),this.strip()},d.prototype.notn=function(e){return this.clone().inotn(e)},d.prototype.setn=function(e,a){c("number"==typeof e&&e>=0);var t=e/26|0,f=e%26;return this._expand(t+1),this.words[t]=a?this.words[t]|1<e.length?(t=this,c=e):(t=e,c=this);for(var f=0,d=0;d>>26;for(;0!==f&&d>>26;if(this.length=t.length,0!==f)this.words[this.length]=f,this.length++;else if(t!==this)for(;de.length?this.clone().iadd(e):e.clone().iadd(this)},d.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var a=this.iadd(e);return e.negative=1,a._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var t,c,f=this.cmp(e);if(0===f)return this.negative=0,this.length=1,this.words[0]=0,this;f>0?(t=this,c=e):(t=e,c=this);for(var d=0,r=0;r>26,this.words[r]=67108863&a;for(;0!==d&&r>26,this.words[r]=67108863&a;if(0===d&&r>>13,u=0|r[1],h=8191&u,p=u>>>13,g=0|r[2],m=8191&g,x=g>>>13,y=0|r[3],A=8191&y,v=y>>>13,w=0|r[4],_=8191&w,I=w>>>13,E=0|r[5],C=8191&E,M=E>>>13,B=0|r[6],k=8191&B,L=B>>>13,S=0|r[7],T=8191&S,N=S>>>13,R=0|r[8],P=8191&R,D=R>>>13,O=0|r[9],F=8191&O,Q=O>>>13,U=0|n[0],j=8191&U,H=U>>>13,q=0|n[1],$=8191&q,z=q>>>13,G=0|n[2],K=8191&G,V=G>>>13,Z=0|n[3],J=8191&Z,W=Z>>>13,Y=0|n[4],X=8191&Y,ee=Y>>>13,ae=0|n[5],te=8191&ae,ce=ae>>>13,fe=0|n[6],de=8191&fe,re=fe>>>13,ne=0|n[7],ie=8191&ne,be=ne>>>13,oe=0|n[8],se=8191&oe,le=oe>>>13,ue=0|n[9],he=8191&ue,pe=ue>>>13;t.negative=e.negative^a.negative,t.length=19;var ge=(b+(c=Math.imul(s,j))|0)+((8191&(f=(f=Math.imul(s,H))+Math.imul(l,j)|0))<<13)|0;b=((d=Math.imul(l,H))+(f>>>13)|0)+(ge>>>26)|0,ge&=67108863,c=Math.imul(h,j),f=(f=Math.imul(h,H))+Math.imul(p,j)|0,d=Math.imul(p,H);var me=(b+(c=c+Math.imul(s,$)|0)|0)+((8191&(f=(f=f+Math.imul(s,z)|0)+Math.imul(l,$)|0))<<13)|0;b=((d=d+Math.imul(l,z)|0)+(f>>>13)|0)+(me>>>26)|0,me&=67108863,c=Math.imul(m,j),f=(f=Math.imul(m,H))+Math.imul(x,j)|0,d=Math.imul(x,H),c=c+Math.imul(h,$)|0,f=(f=f+Math.imul(h,z)|0)+Math.imul(p,$)|0,d=d+Math.imul(p,z)|0;var xe=(b+(c=c+Math.imul(s,K)|0)|0)+((8191&(f=(f=f+Math.imul(s,V)|0)+Math.imul(l,K)|0))<<13)|0;b=((d=d+Math.imul(l,V)|0)+(f>>>13)|0)+(xe>>>26)|0,xe&=67108863,c=Math.imul(A,j),f=(f=Math.imul(A,H))+Math.imul(v,j)|0,d=Math.imul(v,H),c=c+Math.imul(m,$)|0,f=(f=f+Math.imul(m,z)|0)+Math.imul(x,$)|0,d=d+Math.imul(x,z)|0,c=c+Math.imul(h,K)|0,f=(f=f+Math.imul(h,V)|0)+Math.imul(p,K)|0,d=d+Math.imul(p,V)|0;var ye=(b+(c=c+Math.imul(s,J)|0)|0)+((8191&(f=(f=f+Math.imul(s,W)|0)+Math.imul(l,J)|0))<<13)|0;b=((d=d+Math.imul(l,W)|0)+(f>>>13)|0)+(ye>>>26)|0,ye&=67108863,c=Math.imul(_,j),f=(f=Math.imul(_,H))+Math.imul(I,j)|0,d=Math.imul(I,H),c=c+Math.imul(A,$)|0,f=(f=f+Math.imul(A,z)|0)+Math.imul(v,$)|0,d=d+Math.imul(v,z)|0,c=c+Math.imul(m,K)|0,f=(f=f+Math.imul(m,V)|0)+Math.imul(x,K)|0,d=d+Math.imul(x,V)|0,c=c+Math.imul(h,J)|0,f=(f=f+Math.imul(h,W)|0)+Math.imul(p,J)|0,d=d+Math.imul(p,W)|0;var Ae=(b+(c=c+Math.imul(s,X)|0)|0)+((8191&(f=(f=f+Math.imul(s,ee)|0)+Math.imul(l,X)|0))<<13)|0;b=((d=d+Math.imul(l,ee)|0)+(f>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,c=Math.imul(C,j),f=(f=Math.imul(C,H))+Math.imul(M,j)|0,d=Math.imul(M,H),c=c+Math.imul(_,$)|0,f=(f=f+Math.imul(_,z)|0)+Math.imul(I,$)|0,d=d+Math.imul(I,z)|0,c=c+Math.imul(A,K)|0,f=(f=f+Math.imul(A,V)|0)+Math.imul(v,K)|0,d=d+Math.imul(v,V)|0,c=c+Math.imul(m,J)|0,f=(f=f+Math.imul(m,W)|0)+Math.imul(x,J)|0,d=d+Math.imul(x,W)|0,c=c+Math.imul(h,X)|0,f=(f=f+Math.imul(h,ee)|0)+Math.imul(p,X)|0,d=d+Math.imul(p,ee)|0;var ve=(b+(c=c+Math.imul(s,te)|0)|0)+((8191&(f=(f=f+Math.imul(s,ce)|0)+Math.imul(l,te)|0))<<13)|0;b=((d=d+Math.imul(l,ce)|0)+(f>>>13)|0)+(ve>>>26)|0,ve&=67108863,c=Math.imul(k,j),f=(f=Math.imul(k,H))+Math.imul(L,j)|0,d=Math.imul(L,H),c=c+Math.imul(C,$)|0,f=(f=f+Math.imul(C,z)|0)+Math.imul(M,$)|0,d=d+Math.imul(M,z)|0,c=c+Math.imul(_,K)|0,f=(f=f+Math.imul(_,V)|0)+Math.imul(I,K)|0,d=d+Math.imul(I,V)|0,c=c+Math.imul(A,J)|0,f=(f=f+Math.imul(A,W)|0)+Math.imul(v,J)|0,d=d+Math.imul(v,W)|0,c=c+Math.imul(m,X)|0,f=(f=f+Math.imul(m,ee)|0)+Math.imul(x,X)|0,d=d+Math.imul(x,ee)|0,c=c+Math.imul(h,te)|0,f=(f=f+Math.imul(h,ce)|0)+Math.imul(p,te)|0,d=d+Math.imul(p,ce)|0;var we=(b+(c=c+Math.imul(s,de)|0)|0)+((8191&(f=(f=f+Math.imul(s,re)|0)+Math.imul(l,de)|0))<<13)|0;b=((d=d+Math.imul(l,re)|0)+(f>>>13)|0)+(we>>>26)|0,we&=67108863,c=Math.imul(T,j),f=(f=Math.imul(T,H))+Math.imul(N,j)|0,d=Math.imul(N,H),c=c+Math.imul(k,$)|0,f=(f=f+Math.imul(k,z)|0)+Math.imul(L,$)|0,d=d+Math.imul(L,z)|0,c=c+Math.imul(C,K)|0,f=(f=f+Math.imul(C,V)|0)+Math.imul(M,K)|0,d=d+Math.imul(M,V)|0,c=c+Math.imul(_,J)|0,f=(f=f+Math.imul(_,W)|0)+Math.imul(I,J)|0,d=d+Math.imul(I,W)|0,c=c+Math.imul(A,X)|0,f=(f=f+Math.imul(A,ee)|0)+Math.imul(v,X)|0,d=d+Math.imul(v,ee)|0,c=c+Math.imul(m,te)|0,f=(f=f+Math.imul(m,ce)|0)+Math.imul(x,te)|0,d=d+Math.imul(x,ce)|0,c=c+Math.imul(h,de)|0,f=(f=f+Math.imul(h,re)|0)+Math.imul(p,de)|0,d=d+Math.imul(p,re)|0;var _e=(b+(c=c+Math.imul(s,ie)|0)|0)+((8191&(f=(f=f+Math.imul(s,be)|0)+Math.imul(l,ie)|0))<<13)|0;b=((d=d+Math.imul(l,be)|0)+(f>>>13)|0)+(_e>>>26)|0,_e&=67108863,c=Math.imul(P,j),f=(f=Math.imul(P,H))+Math.imul(D,j)|0,d=Math.imul(D,H),c=c+Math.imul(T,$)|0,f=(f=f+Math.imul(T,z)|0)+Math.imul(N,$)|0,d=d+Math.imul(N,z)|0,c=c+Math.imul(k,K)|0,f=(f=f+Math.imul(k,V)|0)+Math.imul(L,K)|0,d=d+Math.imul(L,V)|0,c=c+Math.imul(C,J)|0,f=(f=f+Math.imul(C,W)|0)+Math.imul(M,J)|0,d=d+Math.imul(M,W)|0,c=c+Math.imul(_,X)|0,f=(f=f+Math.imul(_,ee)|0)+Math.imul(I,X)|0,d=d+Math.imul(I,ee)|0,c=c+Math.imul(A,te)|0,f=(f=f+Math.imul(A,ce)|0)+Math.imul(v,te)|0,d=d+Math.imul(v,ce)|0,c=c+Math.imul(m,de)|0,f=(f=f+Math.imul(m,re)|0)+Math.imul(x,de)|0,d=d+Math.imul(x,re)|0,c=c+Math.imul(h,ie)|0,f=(f=f+Math.imul(h,be)|0)+Math.imul(p,ie)|0,d=d+Math.imul(p,be)|0;var Ie=(b+(c=c+Math.imul(s,se)|0)|0)+((8191&(f=(f=f+Math.imul(s,le)|0)+Math.imul(l,se)|0))<<13)|0;b=((d=d+Math.imul(l,le)|0)+(f>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,c=Math.imul(F,j),f=(f=Math.imul(F,H))+Math.imul(Q,j)|0,d=Math.imul(Q,H),c=c+Math.imul(P,$)|0,f=(f=f+Math.imul(P,z)|0)+Math.imul(D,$)|0,d=d+Math.imul(D,z)|0,c=c+Math.imul(T,K)|0,f=(f=f+Math.imul(T,V)|0)+Math.imul(N,K)|0,d=d+Math.imul(N,V)|0,c=c+Math.imul(k,J)|0,f=(f=f+Math.imul(k,W)|0)+Math.imul(L,J)|0,d=d+Math.imul(L,W)|0,c=c+Math.imul(C,X)|0,f=(f=f+Math.imul(C,ee)|0)+Math.imul(M,X)|0,d=d+Math.imul(M,ee)|0,c=c+Math.imul(_,te)|0,f=(f=f+Math.imul(_,ce)|0)+Math.imul(I,te)|0,d=d+Math.imul(I,ce)|0,c=c+Math.imul(A,de)|0,f=(f=f+Math.imul(A,re)|0)+Math.imul(v,de)|0,d=d+Math.imul(v,re)|0,c=c+Math.imul(m,ie)|0,f=(f=f+Math.imul(m,be)|0)+Math.imul(x,ie)|0,d=d+Math.imul(x,be)|0,c=c+Math.imul(h,se)|0,f=(f=f+Math.imul(h,le)|0)+Math.imul(p,se)|0,d=d+Math.imul(p,le)|0;var Ee=(b+(c=c+Math.imul(s,he)|0)|0)+((8191&(f=(f=f+Math.imul(s,pe)|0)+Math.imul(l,he)|0))<<13)|0;b=((d=d+Math.imul(l,pe)|0)+(f>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,c=Math.imul(F,$),f=(f=Math.imul(F,z))+Math.imul(Q,$)|0,d=Math.imul(Q,z),c=c+Math.imul(P,K)|0,f=(f=f+Math.imul(P,V)|0)+Math.imul(D,K)|0,d=d+Math.imul(D,V)|0,c=c+Math.imul(T,J)|0,f=(f=f+Math.imul(T,W)|0)+Math.imul(N,J)|0,d=d+Math.imul(N,W)|0,c=c+Math.imul(k,X)|0,f=(f=f+Math.imul(k,ee)|0)+Math.imul(L,X)|0,d=d+Math.imul(L,ee)|0,c=c+Math.imul(C,te)|0,f=(f=f+Math.imul(C,ce)|0)+Math.imul(M,te)|0,d=d+Math.imul(M,ce)|0,c=c+Math.imul(_,de)|0,f=(f=f+Math.imul(_,re)|0)+Math.imul(I,de)|0,d=d+Math.imul(I,re)|0,c=c+Math.imul(A,ie)|0,f=(f=f+Math.imul(A,be)|0)+Math.imul(v,ie)|0,d=d+Math.imul(v,be)|0,c=c+Math.imul(m,se)|0,f=(f=f+Math.imul(m,le)|0)+Math.imul(x,se)|0,d=d+Math.imul(x,le)|0;var Ce=(b+(c=c+Math.imul(h,he)|0)|0)+((8191&(f=(f=f+Math.imul(h,pe)|0)+Math.imul(p,he)|0))<<13)|0;b=((d=d+Math.imul(p,pe)|0)+(f>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,c=Math.imul(F,K),f=(f=Math.imul(F,V))+Math.imul(Q,K)|0,d=Math.imul(Q,V),c=c+Math.imul(P,J)|0,f=(f=f+Math.imul(P,W)|0)+Math.imul(D,J)|0,d=d+Math.imul(D,W)|0,c=c+Math.imul(T,X)|0,f=(f=f+Math.imul(T,ee)|0)+Math.imul(N,X)|0,d=d+Math.imul(N,ee)|0,c=c+Math.imul(k,te)|0,f=(f=f+Math.imul(k,ce)|0)+Math.imul(L,te)|0,d=d+Math.imul(L,ce)|0,c=c+Math.imul(C,de)|0,f=(f=f+Math.imul(C,re)|0)+Math.imul(M,de)|0,d=d+Math.imul(M,re)|0,c=c+Math.imul(_,ie)|0,f=(f=f+Math.imul(_,be)|0)+Math.imul(I,ie)|0,d=d+Math.imul(I,be)|0,c=c+Math.imul(A,se)|0,f=(f=f+Math.imul(A,le)|0)+Math.imul(v,se)|0,d=d+Math.imul(v,le)|0;var Me=(b+(c=c+Math.imul(m,he)|0)|0)+((8191&(f=(f=f+Math.imul(m,pe)|0)+Math.imul(x,he)|0))<<13)|0;b=((d=d+Math.imul(x,pe)|0)+(f>>>13)|0)+(Me>>>26)|0,Me&=67108863,c=Math.imul(F,J),f=(f=Math.imul(F,W))+Math.imul(Q,J)|0,d=Math.imul(Q,W),c=c+Math.imul(P,X)|0,f=(f=f+Math.imul(P,ee)|0)+Math.imul(D,X)|0,d=d+Math.imul(D,ee)|0,c=c+Math.imul(T,te)|0,f=(f=f+Math.imul(T,ce)|0)+Math.imul(N,te)|0,d=d+Math.imul(N,ce)|0,c=c+Math.imul(k,de)|0,f=(f=f+Math.imul(k,re)|0)+Math.imul(L,de)|0,d=d+Math.imul(L,re)|0,c=c+Math.imul(C,ie)|0,f=(f=f+Math.imul(C,be)|0)+Math.imul(M,ie)|0,d=d+Math.imul(M,be)|0,c=c+Math.imul(_,se)|0,f=(f=f+Math.imul(_,le)|0)+Math.imul(I,se)|0,d=d+Math.imul(I,le)|0;var Be=(b+(c=c+Math.imul(A,he)|0)|0)+((8191&(f=(f=f+Math.imul(A,pe)|0)+Math.imul(v,he)|0))<<13)|0;b=((d=d+Math.imul(v,pe)|0)+(f>>>13)|0)+(Be>>>26)|0,Be&=67108863,c=Math.imul(F,X),f=(f=Math.imul(F,ee))+Math.imul(Q,X)|0,d=Math.imul(Q,ee),c=c+Math.imul(P,te)|0,f=(f=f+Math.imul(P,ce)|0)+Math.imul(D,te)|0,d=d+Math.imul(D,ce)|0,c=c+Math.imul(T,de)|0,f=(f=f+Math.imul(T,re)|0)+Math.imul(N,de)|0,d=d+Math.imul(N,re)|0,c=c+Math.imul(k,ie)|0,f=(f=f+Math.imul(k,be)|0)+Math.imul(L,ie)|0,d=d+Math.imul(L,be)|0,c=c+Math.imul(C,se)|0,f=(f=f+Math.imul(C,le)|0)+Math.imul(M,se)|0,d=d+Math.imul(M,le)|0;var ke=(b+(c=c+Math.imul(_,he)|0)|0)+((8191&(f=(f=f+Math.imul(_,pe)|0)+Math.imul(I,he)|0))<<13)|0;b=((d=d+Math.imul(I,pe)|0)+(f>>>13)|0)+(ke>>>26)|0,ke&=67108863,c=Math.imul(F,te),f=(f=Math.imul(F,ce))+Math.imul(Q,te)|0,d=Math.imul(Q,ce),c=c+Math.imul(P,de)|0,f=(f=f+Math.imul(P,re)|0)+Math.imul(D,de)|0,d=d+Math.imul(D,re)|0,c=c+Math.imul(T,ie)|0,f=(f=f+Math.imul(T,be)|0)+Math.imul(N,ie)|0,d=d+Math.imul(N,be)|0,c=c+Math.imul(k,se)|0,f=(f=f+Math.imul(k,le)|0)+Math.imul(L,se)|0,d=d+Math.imul(L,le)|0;var Le=(b+(c=c+Math.imul(C,he)|0)|0)+((8191&(f=(f=f+Math.imul(C,pe)|0)+Math.imul(M,he)|0))<<13)|0;b=((d=d+Math.imul(M,pe)|0)+(f>>>13)|0)+(Le>>>26)|0,Le&=67108863,c=Math.imul(F,de),f=(f=Math.imul(F,re))+Math.imul(Q,de)|0,d=Math.imul(Q,re),c=c+Math.imul(P,ie)|0,f=(f=f+Math.imul(P,be)|0)+Math.imul(D,ie)|0,d=d+Math.imul(D,be)|0,c=c+Math.imul(T,se)|0,f=(f=f+Math.imul(T,le)|0)+Math.imul(N,se)|0,d=d+Math.imul(N,le)|0;var Se=(b+(c=c+Math.imul(k,he)|0)|0)+((8191&(f=(f=f+Math.imul(k,pe)|0)+Math.imul(L,he)|0))<<13)|0;b=((d=d+Math.imul(L,pe)|0)+(f>>>13)|0)+(Se>>>26)|0,Se&=67108863,c=Math.imul(F,ie),f=(f=Math.imul(F,be))+Math.imul(Q,ie)|0,d=Math.imul(Q,be),c=c+Math.imul(P,se)|0,f=(f=f+Math.imul(P,le)|0)+Math.imul(D,se)|0,d=d+Math.imul(D,le)|0;var Te=(b+(c=c+Math.imul(T,he)|0)|0)+((8191&(f=(f=f+Math.imul(T,pe)|0)+Math.imul(N,he)|0))<<13)|0;b=((d=d+Math.imul(N,pe)|0)+(f>>>13)|0)+(Te>>>26)|0,Te&=67108863,c=Math.imul(F,se),f=(f=Math.imul(F,le))+Math.imul(Q,se)|0,d=Math.imul(Q,le);var Ne=(b+(c=c+Math.imul(P,he)|0)|0)+((8191&(f=(f=f+Math.imul(P,pe)|0)+Math.imul(D,he)|0))<<13)|0;b=((d=d+Math.imul(D,pe)|0)+(f>>>13)|0)+(Ne>>>26)|0,Ne&=67108863;var Re=(b+(c=Math.imul(F,he))|0)+((8191&(f=(f=Math.imul(F,pe))+Math.imul(Q,he)|0))<<13)|0;return b=((d=Math.imul(Q,pe))+(f>>>13)|0)+(Re>>>26)|0,Re&=67108863,i[0]=ge,i[1]=me,i[2]=xe,i[3]=ye,i[4]=Ae,i[5]=ve,i[6]=we,i[7]=_e,i[8]=Ie,i[9]=Ee,i[10]=Ce,i[11]=Me,i[12]=Be,i[13]=ke,i[14]=Le,i[15]=Se,i[16]=Te,i[17]=Ne,i[18]=Re,0!==b&&(i[19]=b,t.length++),t};function p(e,a,t){return(new g).mulp(e,a,t)}function g(e,a){this.x=e,this.y=a}Math.imul||(h=u),d.prototype.mulTo=function(e,a){var t,c=this.length+e.length;return t=10===this.length&&10===e.length?h(this,e,a):c<63?u(this,e,a):c<1024?function(e,a,t){t.negative=a.negative^e.negative,t.length=e.length+a.length;for(var c=0,f=0,d=0;d>>26)|0)>>>26,r&=67108863}t.words[d]=n,c=r,r=f}return 0!==c?t.words[d]=c:t.length--,t.strip()}(this,e,a):p(this,e,a),t},g.prototype.makeRBT=function(e){for(var a=new Array(e),t=d.prototype._countBits(e)-1,c=0;c>=1;return c},g.prototype.permute=function(e,a,t,c,f,d){for(var r=0;r>>=1)f++;return 1<>>=13,t[2*r+1]=8191&d,d>>>=13;for(r=2*a;r>=26,a+=f/67108864|0,a+=d>>>26,this.words[t]=67108863&d}return 0!==a&&(this.words[t]=a,this.length++),this},d.prototype.muln=function(e){return this.clone().imuln(e)},d.prototype.sqr=function(){return this.mul(this)},d.prototype.isqr=function(){return this.imul(this.clone())},d.prototype.pow=function(e){var a=function(e){for(var a=new Array(e.bitLength()),t=0;t>>f}return a}(e);if(0===a.length)return new d(1);for(var t=this,c=0;c=0);var a,t=e%26,f=(e-t)/26,d=67108863>>>26-t<<26-t;if(0!==t){var r=0;for(a=0;a>>26-t}r&&(this.words[a]=r,this.length++)}if(0!==f){for(a=this.length-1;a>=0;a--)this.words[a+f]=this.words[a];for(a=0;a=0),f=a?(a-a%26)/26:0;var d=e%26,r=Math.min((e-d)/26,this.length),n=67108863^67108863>>>d<r)for(this.length-=r,b=0;b=0&&(0!==o||b>=f);b--){var s=0|this.words[b];this.words[b]=o<<26-d|s>>>d,o=s&n}return i&&0!==o&&(i.words[i.length++]=o),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},d.prototype.ishrn=function(e,a,t){return c(0===this.negative),this.iushrn(e,a,t)},d.prototype.shln=function(e){return this.clone().ishln(e)},d.prototype.ushln=function(e){return this.clone().iushln(e)},d.prototype.shrn=function(e){return this.clone().ishrn(e)},d.prototype.ushrn=function(e){return this.clone().iushrn(e)},d.prototype.testn=function(e){c("number"==typeof e&&e>=0);var a=e%26,t=(e-a)/26,f=1<=0);var a=e%26,t=(e-a)/26;if(c(0===this.negative,"imaskn works only with positive numbers"),this.length<=t)return this;if(0!==a&&t++,this.length=Math.min(t,this.length),0!==a){var f=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},d.prototype.isubn=function(e){if(c("number"==typeof e),c(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(i/67108864|0),this.words[f+t]=67108863&d}for(;f>26,this.words[f+t]=67108863&d;if(0===n)return this.strip();for(c(-1===n),n=0,f=0;f>26,this.words[f]=67108863&d;return this.negative=1,this.strip()},d.prototype._wordDiv=function(e,a){var t=(this.length,e.length),c=this.clone(),f=e,r=0|f.words[f.length-1];0!=(t=26-this._countBits(r))&&(f=f.ushln(t),c.iushln(t),r=0|f.words[f.length-1]);var n,i=c.length-f.length;if("mod"!==a){(n=new d(null)).length=i+1,n.words=new Array(n.length);for(var b=0;b=0;s--){var l=67108864*(0|c.words[f.length+s])+(0|c.words[f.length+s-1]);for(l=Math.min(l/r|0,67108863),c._ishlnsubmul(f,l,s);0!==c.negative;)l--,c.negative=0,c._ishlnsubmul(f,1,s),c.isZero()||(c.negative^=1);n&&(n.words[s]=l)}return n&&n.strip(),c.strip(),"div"!==a&&0!==t&&c.iushrn(t),{div:n||null,mod:c}},d.prototype.divmod=function(e,a,t){return c(!e.isZero()),this.isZero()?{div:new d(0),mod:new d(0)}:0!==this.negative&&0===e.negative?(n=this.neg().divmod(e,a),"mod"!==a&&(f=n.div.neg()),"div"!==a&&(r=n.mod.neg(),t&&0!==r.negative&&r.iadd(e)),{div:f,mod:r}):0===this.negative&&0!==e.negative?(n=this.divmod(e.neg(),a),"mod"!==a&&(f=n.div.neg()),{div:f,mod:n.mod}):this.negative&e.negative?(n=this.neg().divmod(e.neg(),a),"div"!==a&&(r=n.mod.neg(),t&&0!==r.negative&&r.isub(e)),{div:n.div,mod:r}):e.length>this.length||this.cmp(e)<0?{div:new d(0),mod:this}:1===e.length?"div"===a?{div:this.divn(e.words[0]),mod:null}:"mod"===a?{div:null,mod:new d(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new d(this.modn(e.words[0]))}:this._wordDiv(e,a);var f,r,n},d.prototype.div=function(e){return this.divmod(e,"div",!1).div},d.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},d.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},d.prototype.divRound=function(e){var a=this.divmod(e);if(a.mod.isZero())return a.div;var t=0!==a.div.negative?a.mod.isub(e):a.mod,c=e.ushrn(1),f=e.andln(1),d=t.cmp(c);return d<0||1===f&&0===d?a.div:0!==a.div.negative?a.div.isubn(1):a.div.iaddn(1)},d.prototype.modn=function(e){c(e<=67108863);for(var a=(1<<26)%e,t=0,f=this.length-1;f>=0;f--)t=(a*t+(0|this.words[f]))%e;return t},d.prototype.idivn=function(e){c(e<=67108863);for(var a=0,t=this.length-1;t>=0;t--){var f=(0|this.words[t])+67108864*a;this.words[t]=f/e|0,a=f%e}return this.strip()},d.prototype.divn=function(e){return this.clone().idivn(e)},d.prototype.egcd=function(e){c(0===e.negative),c(!e.isZero());var a=this,t=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var f=new d(1),r=new d(0),n=new d(0),i=new d(1),b=0;a.isEven()&&t.isEven();)a.iushrn(1),t.iushrn(1),++b;for(var o=t.clone(),s=a.clone();!a.isZero();){for(var l=0,u=1;!(a.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(a.iushrn(l);l-- >0;)(f.isOdd()||r.isOdd())&&(f.iadd(o),r.isub(s)),f.iushrn(1),r.iushrn(1);for(var h=0,p=1;!(t.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(n.isOdd()||i.isOdd())&&(n.iadd(o),i.isub(s)),n.iushrn(1),i.iushrn(1);a.cmp(t)>=0?(a.isub(t),f.isub(n),r.isub(i)):(t.isub(a),n.isub(f),i.isub(r))}return{a:n,b:i,gcd:t.iushln(b)}},d.prototype._invmp=function(e){c(0===e.negative),c(!e.isZero());var a=this,t=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var f,r=new d(1),n=new d(0),i=t.clone();a.cmpn(1)>0&&t.cmpn(1)>0;){for(var b=0,o=1;!(a.words[0]&o)&&b<26;++b,o<<=1);if(b>0)for(a.iushrn(b);b-- >0;)r.isOdd()&&r.iadd(i),r.iushrn(1);for(var s=0,l=1;!(t.words[0]&l)&&s<26;++s,l<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(i),n.iushrn(1);a.cmp(t)>=0?(a.isub(t),r.isub(n)):(t.isub(a),n.isub(r))}return(f=0===a.cmpn(1)?r:n).cmpn(0)<0&&f.iadd(e),f},d.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var a=this.clone(),t=e.clone();a.negative=0,t.negative=0;for(var c=0;a.isEven()&&t.isEven();c++)a.iushrn(1),t.iushrn(1);for(;;){for(;a.isEven();)a.iushrn(1);for(;t.isEven();)t.iushrn(1);var f=a.cmp(t);if(f<0){var d=a;a=t,t=d}else if(0===f||0===t.cmpn(1))break;a.isub(t)}return t.iushln(c)},d.prototype.invm=function(e){return this.egcd(e).a.umod(e)},d.prototype.isEven=function(){return!(1&this.words[0])},d.prototype.isOdd=function(){return!(1&~this.words[0])},d.prototype.andln=function(e){return this.words[0]&e},d.prototype.bincn=function(e){c("number"==typeof e);var a=e%26,t=(e-a)/26,f=1<>>26,n&=67108863,this.words[r]=n}return 0!==d&&(this.words[r]=d,this.length++),this},d.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},d.prototype.cmpn=function(e){var a,t=e<0;if(0!==this.negative&&!t)return-1;if(0===this.negative&&t)return 1;if(this.strip(),this.length>1)a=1;else{t&&(e=-e),c(e<=67108863,"Number is too big");var f=0|this.words[0];a=f===e?0:fe.length)return 1;if(this.length=0;t--){var c=0|this.words[t],f=0|e.words[t];if(c!==f){cf&&(a=1);break}}return a},d.prototype.gtn=function(e){return 1===this.cmpn(e)},d.prototype.gt=function(e){return 1===this.cmp(e)},d.prototype.gten=function(e){return this.cmpn(e)>=0},d.prototype.gte=function(e){return this.cmp(e)>=0},d.prototype.ltn=function(e){return-1===this.cmpn(e)},d.prototype.lt=function(e){return-1===this.cmp(e)},d.prototype.lten=function(e){return this.cmpn(e)<=0},d.prototype.lte=function(e){return this.cmp(e)<=0},d.prototype.eqn=function(e){return 0===this.cmpn(e)},d.prototype.eq=function(e){return 0===this.cmp(e)},d.red=function(e){return new _(e)},d.prototype.toRed=function(e){return c(!this.red,"Already a number in reduction context"),c(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},d.prototype.fromRed=function(){return c(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},d.prototype._forceRed=function(e){return this.red=e,this},d.prototype.forceRed=function(e){return c(!this.red,"Already a number in reduction context"),this._forceRed(e)},d.prototype.redAdd=function(e){return c(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},d.prototype.redIAdd=function(e){return c(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},d.prototype.redSub=function(e){return c(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},d.prototype.redISub=function(e){return c(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},d.prototype.redShl=function(e){return c(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},d.prototype.redMul=function(e){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},d.prototype.redIMul=function(e){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},d.prototype.redSqr=function(){return c(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},d.prototype.redISqr=function(){return c(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},d.prototype.redSqrt=function(){return c(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},d.prototype.redInvm=function(){return c(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},d.prototype.redNeg=function(){return c(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},d.prototype.redPow=function(e){return c(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var m={k256:null,p224:null,p192:null,p25519:null};function x(e,a){this.name=e,this.p=new d(a,16),this.n=this.p.bitLength(),this.k=new d(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){x.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){x.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){x.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){x.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"==typeof e){var a=d._prime(e);this.m=a.p,this.prime=a}else c(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function I(e){_.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new d(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)}x.prototype._tmp=function(){var e=new d(null);return e.words=new Array(Math.ceil(this.n/13)),e},x.prototype.ireduce=function(e){var a,t=e;do{this.split(t,this.tmp),a=(t=(t=this.imulK(t)).iadd(this.tmp)).bitLength()}while(a>this.n);var c=a0?t.isub(this.p):void 0!==t.strip?t.strip():t._strip(),t},x.prototype.split=function(e,a){e.iushrn(this.n,0,a)},x.prototype.imulK=function(e){return e.imul(this.k)},f(y,x),y.prototype.split=function(e,a){for(var t=4194303,c=Math.min(e.length,9),f=0;f>>22,d=r}d>>>=22,e.words[f-10]=d,0===d&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var a=0,t=0;t>>=26,e.words[t]=f,a=c}return 0!==a&&(e.words[e.length++]=a),e},d._prime=function(e){if(m[e])return m[e];var a;if("k256"===e)a=new y;else if("p224"===e)a=new A;else if("p192"===e)a=new v;else{if("p25519"!==e)throw new Error("Unknown prime "+e);a=new w}return m[e]=a,a},_.prototype._verify1=function(e){c(0===e.negative,"red works only with positives"),c(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,a){c(!(e.negative|a.negative),"red works only with positives"),c(e.red&&e.red===a.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,a){this._verify2(e,a);var t=e.add(a);return t.cmp(this.m)>=0&&t.isub(this.m),t._forceRed(this)},_.prototype.iadd=function(e,a){this._verify2(e,a);var t=e.iadd(a);return t.cmp(this.m)>=0&&t.isub(this.m),t},_.prototype.sub=function(e,a){this._verify2(e,a);var t=e.sub(a);return t.cmpn(0)<0&&t.iadd(this.m),t._forceRed(this)},_.prototype.isub=function(e,a){this._verify2(e,a);var t=e.isub(a);return t.cmpn(0)<0&&t.iadd(this.m),t},_.prototype.shl=function(e,a){return this._verify1(e),this.imod(e.ushln(a))},_.prototype.imul=function(e,a){return this._verify2(e,a),this.imod(e.imul(a))},_.prototype.mul=function(e,a){return this._verify2(e,a),this.imod(e.mul(a))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var a=this.m.andln(3);if(c(a%2==1),3===a){var t=this.m.add(new d(1)).iushrn(2);return this.pow(e,t)}for(var f=this.m.subn(1),r=0;!f.isZero()&&0===f.andln(1);)r++,f.iushrn(1);c(!f.isZero());var n=new d(1).toRed(this),i=n.redNeg(),b=this.m.subn(1).iushrn(1),o=this.m.bitLength();for(o=new d(2*o*o).toRed(this);0!==this.pow(o,b).cmp(i);)o.redIAdd(i);for(var s=this.pow(o,f),l=this.pow(e,f.addn(1).iushrn(1)),u=this.pow(e,f),h=r;0!==u.cmp(n);){for(var p=u,g=0;0!==p.cmp(n);g++)p=p.redSqr();c(g=0;c--){for(var b=a.words[c],o=i-1;o>=0;o--){var s=b>>o&1;f!==t[0]&&(f=this.sqr(f)),0!==s||0!==r?(r<<=1,r|=s,(4==++n||0===c&&0===o)&&(f=this.mul(f,t[r]),n=0,r=0)):n=0}i=26}return f},_.prototype.convertTo=function(e){var a=e.umod(this.m);return a===e?a.clone():a},_.prototype.convertFrom=function(e){var a=e.clone();return a.red=null,a},d.mont=function(e){return new I(e)},f(I,_),I.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},I.prototype.convertFrom=function(e){var a=this.imod(e.mul(this.rinv));return a.red=null,a},I.prototype.imul=function(e,a){if(e.isZero()||a.isZero())return e.words[0]=0,e.length=1,e;var t=e.imul(a),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=t.isub(c).iushrn(this.shift),d=f;return f.cmp(this.m)>=0?d=f.isub(this.m):f.cmpn(0)<0&&(d=f.iadd(this.m)),d._forceRed(this)},I.prototype.mul=function(e,a){if(e.isZero()||a.isZero())return new d(0)._forceRed(this);var t=e.mul(a),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=t.isub(c).iushrn(this.shift),r=f;return f.cmp(this.m)>=0?r=f.isub(this.m):f.cmpn(0)<0&&(r=f.iadd(this.m)),r._forceRed(this)},I.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=t.nmd(e),this)},47108:(e,a,t)=>{"use strict";var c=t(56698),f=t(88276),d=t(66011),r=t(62802),n=t(56168);function i(e){n.call(this,"digest"),this._hash=e}c(i,n),i.prototype._update=function(e){this._hash.update(e)},i.prototype._final=function(){return this._hash.digest()},e.exports=function(e){return"md5"===(e=e.toLowerCase())?new f:"rmd160"===e||"ripemd160"===e?new d:new i(r(e))}},20320:(e,a,t)=>{var c=t(88276);e.exports=function(e){return(new c).update(e).digest()}},83507:(e,a,t)=>{"use strict";var c=t(56698),f=t(41800),d=t(56168),r=t(92861).Buffer,n=t(20320),i=t(66011),b=t(62802),o=r.alloc(128);function s(e,a){d.call(this,"digest"),"string"==typeof a&&(a=r.from(a));var t="sha512"===e||"sha384"===e?128:64;this._alg=e,this._key=a,a.length>t?a=("rmd160"===e?new i:b(e)).update(a).digest():a.length{"use strict";var c=t(56698),f=t(92861).Buffer,d=t(56168),r=f.alloc(128),n=64;function i(e,a){d.call(this,"digest"),"string"==typeof a&&(a=f.from(a)),this._alg=e,this._key=a,a.length>n?a=e(a):a.length{var c="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==t.g&&t.g,f=function(){function e(){this.fetch=!1,this.DOMException=c.DOMException}return e.prototype=c,new e}();!function(e){!function(a){var t=void 0!==e&&e||"undefined"!=typeof self&&self||void 0!==t&&t,c="URLSearchParams"in t,f="Symbol"in t&&"iterator"in Symbol,d="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(e){return!1}}(),r="FormData"in t,n="ArrayBuffer"in t;if(n)var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],b=ArrayBuffer.isView||function(e){return e&&i.indexOf(Object.prototype.toString.call(e))>-1};function o(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function s(e){return"string"!=typeof e&&(e=String(e)),e}function l(e){var a={next:function(){var a=e.shift();return{done:void 0===a,value:a}}};return f&&(a[Symbol.iterator]=function(){return a}),a}function u(e){this.map={},e instanceof u?e.forEach((function(e,a){this.append(a,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(a){this.append(a,e[a])}),this)}function h(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(a,t){e.onload=function(){a(e.result)},e.onerror=function(){t(e.error)}}))}function g(e){var a=new FileReader,t=p(a);return a.readAsArrayBuffer(e),t}function m(e){if(e.slice)return e.slice(0);var a=new Uint8Array(e.byteLength);return a.set(new Uint8Array(e)),a.buffer}function x(){return this.bodyUsed=!1,this._initBody=function(e){var a;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:d&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:r&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:c&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():n&&d&&(a=e)&&DataView.prototype.isPrototypeOf(a)?(this._bodyArrayBuffer=m(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):n&&(ArrayBuffer.prototype.isPrototypeOf(e)||b(e))?this._bodyArrayBuffer=m(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},d&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer)):this.blob().then(g)}),this.text=function(){var e,a,t,c=h(this);if(c)return c;if(this._bodyBlob)return e=this._bodyBlob,t=p(a=new FileReader),a.readAsText(e),t;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var a=new Uint8Array(e),t=new Array(a.length),c=0;c-1?c:t),this.mode=a.mode||this.mode||null,this.signal=a.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&f)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(f),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==a.cache&&"no-cache"!==a.cache)){var d=/([?&])_=[^&]*/;d.test(this.url)?this.url=this.url.replace(d,"$1_="+(new Date).getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}function v(e){var a=new FormData;return e.trim().split("&").forEach((function(e){if(e){var t=e.split("="),c=t.shift().replace(/\+/g," "),f=t.join("=").replace(/\+/g," ");a.append(decodeURIComponent(c),decodeURIComponent(f))}})),a}function w(e,a){if(!(this instanceof w))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');a||(a={}),this.type="default",this.status=void 0===a.status?200:a.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===a.statusText?"":""+a.statusText,this.headers=new u(a.headers),this.url=a.url||"",this._initBody(e)}A.prototype.clone=function(){return new A(this,{body:this._bodyInit})},x.call(A.prototype),x.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},w.error=function(){var e=new w(null,{status:0,statusText:""});return e.type="error",e};var _=[301,302,303,307,308];w.redirect=function(e,a){if(-1===_.indexOf(a))throw new RangeError("Invalid status code");return new w(null,{status:a,headers:{location:e}})},a.DOMException=t.DOMException;try{new a.DOMException}catch(e){a.DOMException=function(e,a){this.message=e,this.name=a;var t=Error(e);this.stack=t.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function I(e,c){return new Promise((function(f,r){var i=new A(e,c);if(i.signal&&i.signal.aborted)return r(new a.DOMException("Aborted","AbortError"));var b=new XMLHttpRequest;function o(){b.abort()}b.onload=function(){var e,a,t={status:b.status,statusText:b.statusText,headers:(e=b.getAllResponseHeaders()||"",a=new u,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var t=e.split(":"),c=t.shift().trim();if(c){var f=t.join(":").trim();a.append(c,f)}})),a)};t.url="responseURL"in b?b.responseURL:t.headers.get("X-Request-URL");var c="response"in b?b.response:b.responseText;setTimeout((function(){f(new w(c,t))}),0)},b.onerror=function(){setTimeout((function(){r(new TypeError("Network request failed"))}),0)},b.ontimeout=function(){setTimeout((function(){r(new TypeError("Network request failed"))}),0)},b.onabort=function(){setTimeout((function(){r(new a.DOMException("Aborted","AbortError"))}),0)},b.open(i.method,function(e){try{return""===e&&t.location.href?t.location.href:e}catch(a){return e}}(i.url),!0),"include"===i.credentials?b.withCredentials=!0:"omit"===i.credentials&&(b.withCredentials=!1),"responseType"in b&&(d?b.responseType="blob":n&&i.headers.get("Content-Type")&&-1!==i.headers.get("Content-Type").indexOf("application/octet-stream")&&(b.responseType="arraybuffer")),!c||"object"!=typeof c.headers||c.headers instanceof u?i.headers.forEach((function(e,a){b.setRequestHeader(a,e)})):Object.getOwnPropertyNames(c.headers).forEach((function(e){b.setRequestHeader(e,s(c.headers[e]))})),i.signal&&(i.signal.addEventListener("abort",o),b.onreadystatechange=function(){4===b.readyState&&i.signal.removeEventListener("abort",o)}),b.send(void 0===i._bodyInit?null:i._bodyInit)}))}I.polyfill=!0,t.fetch||(t.fetch=I,t.Headers=u,t.Request=A,t.Response=w),a.Headers=u,a.Request=A,a.Response=w,a.fetch=I}({})}(f),f.fetch.ponyfill=!0,delete f.fetch.polyfill;var d=c.fetch?c:f;(a=d.fetch).default=d.fetch,a.fetch=d.fetch,a.Headers=d.Headers,a.Request=d.Request,a.Response=d.Response,e.exports=a},91565:(e,a,t)=>{"use strict";a.randomBytes=a.rng=a.pseudoRandomBytes=a.prng=t(53209),a.createHash=a.Hash=t(47108),a.createHmac=a.Hmac=t(83507);var c=t(55715),f=Object.keys(c),d=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(f);a.getHashes=function(){return d};var r=t(78396);a.pbkdf2=r.pbkdf2,a.pbkdf2Sync=r.pbkdf2Sync;var n=t(30125);a.Cipher=n.Cipher,a.createCipher=n.createCipher,a.Cipheriv=n.Cipheriv,a.createCipheriv=n.createCipheriv,a.Decipher=n.Decipher,a.createDecipher=n.createDecipher,a.Decipheriv=n.Decipheriv,a.createDecipheriv=n.createDecipheriv,a.getCiphers=n.getCiphers,a.listCiphers=n.listCiphers;var i=t(15380);a.DiffieHellmanGroup=i.DiffieHellmanGroup,a.createDiffieHellmanGroup=i.createDiffieHellmanGroup,a.getDiffieHellman=i.getDiffieHellman,a.createDiffieHellman=i.createDiffieHellman,a.DiffieHellman=i.DiffieHellman;var b=t(20);a.createSign=b.createSign,a.Sign=b.Sign,a.createVerify=b.createVerify,a.Verify=b.Verify,a.createECDH=t(61324);var o=t(97168);a.publicEncrypt=o.publicEncrypt,a.privateEncrypt=o.privateEncrypt,a.publicDecrypt=o.publicDecrypt,a.privateDecrypt=o.privateDecrypt;var s=t(76983);a.randomFill=s.randomFill,a.randomFillSync=s.randomFillSync,a.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},a.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}},17833:(e,a,t)=>{a.formatArgs=function(a){if(a[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+a[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const t="color: "+this.color;a.splice(1,0,t,"color: inherit");let c=0,f=0;a[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(c++,"%c"===e&&(f=c))})),a.splice(f,0,t)},a.save=function(e){try{e?a.storage.setItem("debug",e):a.storage.removeItem("debug")}catch(e){}},a.load=function(){let e;try{e=a.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},a.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},a.storage=function(){try{return localStorage}catch(e){}}(),a.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),a.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"],a.log=console.debug||console.log||(()=>{}),e.exports=t(40736)(a);const{formatters:c}=e.exports;c.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},40736:(e,a,t)=>{e.exports=function(e){function a(e){let t,f,d,r=null;function n(...e){if(!n.enabled)return;const c=n,f=Number(new Date),d=f-(t||f);c.diff=d,c.prev=t,c.curr=f,t=f,e[0]=a.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let r=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((t,f)=>{if("%%"===t)return"%";r++;const d=a.formatters[f];if("function"==typeof d){const a=e[r];t=d.call(c,a),e.splice(r,1),r--}return t})),a.formatArgs.call(c,e),(c.log||a.log).apply(c,e)}return n.namespace=e,n.useColors=a.useColors(),n.color=a.selectColor(e),n.extend=c,n.destroy=a.destroy,Object.defineProperty(n,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==r?r:(f!==a.namespaces&&(f=a.namespaces,d=a.enabled(e)),d),set:e=>{r=e}}),"function"==typeof a.init&&a.init(n),n}function c(e,t){const c=a(this.namespace+(void 0===t?":":t)+e);return c.log=this.log,c}function f(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return a.debug=a,a.default=a,a.coerce=function(e){return e instanceof Error?e.stack||e.message:e},a.disable=function(){const e=[...a.names.map(f),...a.skips.map(f).map((e=>"-"+e))].join(",");return a.enable(""),e},a.enable=function(e){let t;a.save(e),a.namespaces=e,a.names=[],a.skips=[];const c=("string"==typeof e?e:"").split(/[\s,]+/),f=c.length;for(t=0;t{a[t]=e[t]})),a.names=[],a.skips=[],a.formatters={},a.selectColor=function(e){let t=0;for(let a=0;a{"use strict";var c=t(30655),f=t(58068),d=t(69675),r=t(75795);e.exports=function(e,a,t){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new d("`obj` must be an object or a function`");if("string"!=typeof a&&"symbol"!=typeof a)throw new d("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new d("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new d("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new d("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new d("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,i=arguments.length>4?arguments[4]:null,b=arguments.length>5?arguments[5]:null,o=arguments.length>6&&arguments[6],s=!!r&&r(e,a);if(c)c(e,a,{configurable:null===b&&s?s.configurable:!b,enumerable:null===n&&s?s.enumerable:!n,value:t,writable:null===i&&s?s.writable:!i});else{if(!o&&(n||i||b))throw new f("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[a]=t}}},38452:(e,a,t)=>{"use strict";var c=t(1189),f="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),d=Object.prototype.toString,r=Array.prototype.concat,n=t(30041),i=t(30592)(),b=function(e,a,t,c){if(a in e)if(!0===c){if(e[a]===t)return}else if("function"!=typeof(f=c)||"[object Function]"!==d.call(f)||!c())return;var f;i?n(e,a,t,!0):n(e,a,t)},o=function(e,a){var t=arguments.length>2?arguments[2]:{},d=c(a);f&&(d=r.call(d,Object.getOwnPropertySymbols(a)));for(var n=0;n{"use strict";a.utils=t(87626),a.Cipher=t(82808),a.DES=t(82211),a.CBC=t(3389),a.EDE=t(65279)},3389:(e,a,t)=>{"use strict";var c=t(43349),f=t(56698),d={};function r(e){c.equal(e.length,8,"Invalid IV length"),this.iv=new Array(8);for(var a=0;a{"use strict";var c=t(43349);function f(e){this.options=e,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=!1!==e.padding}e.exports=f,f.prototype._init=function(){},f.prototype.update=function(e){return 0===e.length?[]:"decrypt"===this.type?this._updateDecrypt(e):this._updateEncrypt(e)},f.prototype._buffer=function(e,a){for(var t=Math.min(this.buffer.length-this.bufferOff,e.length-a),c=0;c0;c--)a+=this._buffer(e,a),t+=this._flushBuffer(f,t);return a+=this._buffer(e,a),f},f.prototype.final=function(e){var a,t;return e&&(a=this.update(e)),t="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),a?a.concat(t):t},f.prototype._pad=function(e,a){if(0===a)return!1;for(;a{"use strict";var c=t(43349),f=t(56698),d=t(87626),r=t(82808);function n(){this.tmp=new Array(2),this.keys=null}function i(e){r.call(this,e);var a=new n;this._desState=a,this.deriveKeys(a,e.key)}f(i,r),e.exports=i,i.create=function(e){return new i(e)};var b=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];i.prototype.deriveKeys=function(e,a){e.keys=new Array(32),c.equal(a.length,this.blockSize,"Invalid key length");var t=d.readUInt32BE(a,0),f=d.readUInt32BE(a,4);d.pc1(t,f,e.tmp,0),t=e.tmp[0],f=e.tmp[1];for(var r=0;r>>1];t=d.r28shl(t,n),f=d.r28shl(f,n),d.pc2(t,f,e.keys,r)}},i.prototype._update=function(e,a,t,c){var f=this._desState,r=d.readUInt32BE(e,a),n=d.readUInt32BE(e,a+4);d.ip(r,n,f.tmp,0),r=f.tmp[0],n=f.tmp[1],"encrypt"===this.type?this._encrypt(f,r,n,f.tmp,0):this._decrypt(f,r,n,f.tmp,0),r=f.tmp[0],n=f.tmp[1],d.writeUInt32BE(t,r,c),d.writeUInt32BE(t,n,c+4)},i.prototype._pad=function(e,a){if(!1===this.padding)return!1;for(var t=e.length-a,c=a;c>>0,r=l}d.rip(n,r,c,f)},i.prototype._decrypt=function(e,a,t,c,f){for(var r=t,n=a,i=e.keys.length-2;i>=0;i-=2){var b=e.keys[i],o=e.keys[i+1];d.expand(r,e.tmp,0),b^=e.tmp[0],o^=e.tmp[1];var s=d.substitute(b,o),l=r;r=(n^d.permute(s))>>>0,n=l}d.rip(r,n,c,f)}},65279:(e,a,t)=>{"use strict";var c=t(43349),f=t(56698),d=t(82808),r=t(82211);function n(e,a){c.equal(a.length,24,"Invalid key length");var t=a.slice(0,8),f=a.slice(8,16),d=a.slice(16,24);this.ciphers="encrypt"===e?[r.create({type:"encrypt",key:t}),r.create({type:"decrypt",key:f}),r.create({type:"encrypt",key:d})]:[r.create({type:"decrypt",key:d}),r.create({type:"encrypt",key:f}),r.create({type:"decrypt",key:t})]}function i(e){d.call(this,e);var a=new n(this.type,this.options.key);this._edeState=a}f(i,d),e.exports=i,i.create=function(e){return new i(e)},i.prototype._update=function(e,a,t,c){var f=this._edeState;f.ciphers[0]._update(e,a,t,c),f.ciphers[1]._update(t,c,t,c),f.ciphers[2]._update(t,c,t,c)},i.prototype._pad=r.prototype._pad,i.prototype._unpad=r.prototype._unpad},87626:(e,a)=>{"use strict";a.readUInt32BE=function(e,a){return(e[0+a]<<24|e[1+a]<<16|e[2+a]<<8|e[3+a])>>>0},a.writeUInt32BE=function(e,a,t){e[0+t]=a>>>24,e[1+t]=a>>>16&255,e[2+t]=a>>>8&255,e[3+t]=255&a},a.ip=function(e,a,t,c){for(var f=0,d=0,r=6;r>=0;r-=2){for(var n=0;n<=24;n+=8)f<<=1,f|=a>>>n+r&1;for(n=0;n<=24;n+=8)f<<=1,f|=e>>>n+r&1}for(r=6;r>=0;r-=2){for(n=1;n<=25;n+=8)d<<=1,d|=a>>>n+r&1;for(n=1;n<=25;n+=8)d<<=1,d|=e>>>n+r&1}t[c+0]=f>>>0,t[c+1]=d>>>0},a.rip=function(e,a,t,c){for(var f=0,d=0,r=0;r<4;r++)for(var n=24;n>=0;n-=8)f<<=1,f|=a>>>n+r&1,f<<=1,f|=e>>>n+r&1;for(r=4;r<8;r++)for(n=24;n>=0;n-=8)d<<=1,d|=a>>>n+r&1,d<<=1,d|=e>>>n+r&1;t[c+0]=f>>>0,t[c+1]=d>>>0},a.pc1=function(e,a,t,c){for(var f=0,d=0,r=7;r>=5;r--){for(var n=0;n<=24;n+=8)f<<=1,f|=a>>n+r&1;for(n=0;n<=24;n+=8)f<<=1,f|=e>>n+r&1}for(n=0;n<=24;n+=8)f<<=1,f|=a>>n+r&1;for(r=1;r<=3;r++){for(n=0;n<=24;n+=8)d<<=1,d|=a>>n+r&1;for(n=0;n<=24;n+=8)d<<=1,d|=e>>n+r&1}for(n=0;n<=24;n+=8)d<<=1,d|=e>>n+r&1;t[c+0]=f>>>0,t[c+1]=d>>>0},a.r28shl=function(e,a){return e<>>28-a};var t=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];a.pc2=function(e,a,c,f){for(var d=0,r=0,n=t.length>>>1,i=0;i>>t[i]&1;for(i=n;i>>t[i]&1;c[f+0]=d>>>0,c[f+1]=r>>>0},a.expand=function(e,a,t){var c=0,f=0;c=(1&e)<<5|e>>>27;for(var d=23;d>=15;d-=4)c<<=6,c|=e>>>d&63;for(d=11;d>=3;d-=4)f|=e>>>d&63,f<<=6;f|=(31&e)<<1|e>>>31,a[t+0]=c>>>0,a[t+1]=f>>>0};var c=[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];a.substitute=function(e,a){for(var t=0,f=0;f<4;f++)t<<=4,t|=c[64*f+(e>>>18-6*f&63)];for(f=0;f<4;f++)t<<=4,t|=c[256+64*f+(a>>>18-6*f&63)];return t>>>0};var f=[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];a.permute=function(e){for(var a=0,t=0;t>>f[t]&1;return a>>>0},a.padSplit=function(e,a,t){for(var c=e.toString(2);c.length{var c=t(62045).hp,f=t(4934),d=t(23241),r=t(14910),n={binary:!0,hex:!0,base64:!0};a.DiffieHellmanGroup=a.createDiffieHellmanGroup=a.getDiffieHellman=function(e){var a=new c(d[e].prime,"hex"),t=new c(d[e].gen,"hex");return new r(a,t)},a.createDiffieHellman=a.DiffieHellman=function e(a,t,d,i){return c.isBuffer(t)||void 0===n[t]?e(a,"binary",t,d):(t=t||"binary",i=i||"binary",d=d||new c([2]),c.isBuffer(d)||(d=new c(d,i)),"number"==typeof a?new r(f(a,d),d,!0):(c.isBuffer(a)||(a=new c(a,t)),new r(a,d,!0)))}},14910:(e,a,t)=>{var c=t(62045).hp,f=t(66473),d=new(t(52244)),r=new f(24),n=new f(11),i=new f(10),b=new f(3),o=new f(7),s=t(4934),l=t(53209);function u(e,a){return a=a||"utf8",c.isBuffer(e)||(e=new c(e,a)),this._pub=new f(e),this}function h(e,a){return a=a||"utf8",c.isBuffer(e)||(e=new c(e,a)),this._priv=new f(e),this}e.exports=g;var p={};function g(e,a,t){this.setGenerator(a),this.__prime=new f(e),this._prime=f.mont(this.__prime),this._primeLen=e.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,t?(this.setPublicKey=u,this.setPrivateKey=h):this._primeCode=8}function m(e,a){var t=new c(e.toArray());return a?t.toString(a):t}Object.defineProperty(g.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(e,a){var t=a.toString("hex"),c=[t,e.toString(16)].join("_");if(c in p)return p[c];var f,l=0;if(e.isEven()||!s.simpleSieve||!s.fermatTest(e)||!d.test(e))return l+=1,l+="02"===t||"05"===t?8:4,p[c]=l,l;switch(d.test(e.shrn(1))||(l+=2),t){case"02":e.mod(r).cmp(n)&&(l+=8);break;case"05":(f=e.mod(i)).cmp(b)&&f.cmp(o)&&(l+=8);break;default:l+=4}return p[c]=l,l}(this.__prime,this.__gen)),this._primeCode}}),g.prototype.generateKeys=function(){return this._priv||(this._priv=new f(l(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},g.prototype.computeSecret=function(e){var a=(e=(e=new f(e)).toRed(this._prime)).redPow(this._priv).fromRed(),t=new c(a.toArray()),d=this.getPrime();if(t.length{var c=t(53209);e.exports=x,x.simpleSieve=g,x.fermatTest=m;var f=t(66473),d=new f(24),r=new(t(52244)),n=new f(1),i=new f(2),b=new f(5),o=(new f(16),new f(8),new f(10)),s=new f(3),l=(new f(7),new f(11)),u=new f(4),h=(new f(12),null);function p(){if(null!==h)return h;var e=[];e[0]=2;for(var a=1,t=3;t<1048576;t+=2){for(var c=Math.ceil(Math.sqrt(t)),f=0;fe;)t.ishrn(1);if(t.isEven()&&t.iadd(n),t.testn(1)||t.iadd(i),a.cmp(i)){if(!a.cmp(b))for(;t.mod(o).cmp(s);)t.iadd(u)}else for(;t.mod(d).cmp(l);)t.iadd(u);if(g(h=t.shrn(1))&&g(t)&&m(h)&&m(t)&&r.test(h)&&r.test(t))return t}}},66473:function(e,a,t){!function(e,a){"use strict";function c(e,a){if(!e)throw new Error(a||"Assertion failed")}function f(e,a){e.super_=a;var t=function(){};t.prototype=a.prototype,e.prototype=new t,e.prototype.constructor=e}function d(e,a,t){if(d.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==a&&"be"!==a||(t=a,a=10),this._init(e||0,a||10,t||"be"))}var r;"object"==typeof e?e.exports=d:a.BN=d,d.BN=d,d.wordSize=26;try{r="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:t(66089).Buffer}catch(e){}function n(e,a){var t=e.charCodeAt(a);return t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:t-48&15}function i(e,a,t){var c=n(e,t);return t-1>=a&&(c|=n(e,t-1)<<4),c}function b(e,a,t,c){for(var f=0,d=Math.min(e.length,t),r=a;r=49?n-49+10:n>=17?n-17+10:n}return f}d.isBN=function(e){return e instanceof d||null!==e&&"object"==typeof e&&e.constructor.wordSize===d.wordSize&&Array.isArray(e.words)},d.max=function(e,a){return e.cmp(a)>0?e:a},d.min=function(e,a){return e.cmp(a)<0?e:a},d.prototype._init=function(e,a,t){if("number"==typeof e)return this._initNumber(e,a,t);if("object"==typeof e)return this._initArray(e,a,t);"hex"===a&&(a=16),c(a===(0|a)&&a>=2&&a<=36);var f=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(f++,this.negative=1),f=0;f-=3)r=e[f]|e[f-1]<<8|e[f-2]<<16,this.words[d]|=r<>>26-n&67108863,(n+=24)>=26&&(n-=26,d++);else if("le"===t)for(f=0,d=0;f>>26-n&67108863,(n+=24)>=26&&(n-=26,d++);return this.strip()},d.prototype._parseHex=function(e,a,t){this.length=Math.ceil((e.length-a)/6),this.words=new Array(this.length);for(var c=0;c=a;c-=2)f=i(e,a,c)<=18?(d-=18,r+=1,this.words[r]|=f>>>26):d+=8;else for(c=(e.length-a)%2==0?a+1:a;c=18?(d-=18,r+=1,this.words[r]|=f>>>26):d+=8;this.strip()},d.prototype._parseBase=function(e,a,t){this.words=[0],this.length=1;for(var c=0,f=1;f<=67108863;f*=a)c++;c--,f=f/a|0;for(var d=e.length-t,r=d%c,n=Math.min(d,d-r)+t,i=0,o=t;o1&&0===this.words[this.length-1];)this.length--;return this._normSign()},d.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},d.prototype.inspect=function(){return(this.red?""};var o=["","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"],s=[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],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function u(e,a,t){t.negative=a.negative^e.negative;var c=e.length+a.length|0;t.length=c,c=c-1|0;var f=0|e.words[0],d=0|a.words[0],r=f*d,n=67108863&r,i=r/67108864|0;t.words[0]=n;for(var b=1;b>>26,s=67108863&i,l=Math.min(b,a.length-1),u=Math.max(0,b-e.length+1);u<=l;u++){var h=b-u|0;o+=(r=(f=0|e.words[h])*(d=0|a.words[u])+s)/67108864|0,s=67108863&r}t.words[b]=0|s,i=0|o}return 0!==i?t.words[b]=0|i:t.length--,t.strip()}d.prototype.toString=function(e,a){var t;if(a=0|a||1,16===(e=e||10)||"hex"===e){t="";for(var f=0,d=0,r=0;r>>24-f&16777215)||r!==this.length-1?o[6-i.length]+i+t:i+t,(f+=2)>=26&&(f-=26,r--)}for(0!==d&&(t=d.toString(16)+t);t.length%a!=0;)t="0"+t;return 0!==this.negative&&(t="-"+t),t}if(e===(0|e)&&e>=2&&e<=36){var b=s[e],u=l[e];t="";var h=this.clone();for(h.negative=0;!h.isZero();){var p=h.modn(u).toString(e);t=(h=h.idivn(u)).isZero()?p+t:o[b-p.length]+p+t}for(this.isZero()&&(t="0"+t);t.length%a!=0;)t="0"+t;return 0!==this.negative&&(t="-"+t),t}c(!1,"Base should be between 2 and 36")},d.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&c(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},d.prototype.toJSON=function(){return this.toString(16)},d.prototype.toBuffer=function(e,a){return c(void 0!==r),this.toArrayLike(r,e,a)},d.prototype.toArray=function(e,a){return this.toArrayLike(Array,e,a)},d.prototype.toArrayLike=function(e,a,t){var f=this.byteLength(),d=t||Math.max(1,f);c(f<=d,"byte array longer than desired length"),c(d>0,"Requested array length <= 0"),this.strip();var r,n,i="le"===a,b=new e(d),o=this.clone();if(i){for(n=0;!o.isZero();n++)r=o.andln(255),o.iushrn(8),b[n]=r;for(;n=4096&&(t+=13,a>>>=13),a>=64&&(t+=7,a>>>=7),a>=8&&(t+=4,a>>>=4),a>=2&&(t+=2,a>>>=2),t+a},d.prototype._zeroBits=function(e){if(0===e)return 26;var a=e,t=0;return 8191&a||(t+=13,a>>>=13),127&a||(t+=7,a>>>=7),15&a||(t+=4,a>>>=4),3&a||(t+=2,a>>>=2),1&a||t++,t},d.prototype.bitLength=function(){var e=this.words[this.length-1],a=this._countBits(e);return 26*(this.length-1)+a},d.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,a=0;ae.length?this.clone().ior(e):e.clone().ior(this)},d.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},d.prototype.iuand=function(e){var a;a=this.length>e.length?e:this;for(var t=0;te.length?this.clone().iand(e):e.clone().iand(this)},d.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},d.prototype.iuxor=function(e){var a,t;this.length>e.length?(a=this,t=e):(a=e,t=this);for(var c=0;ce.length?this.clone().ixor(e):e.clone().ixor(this)},d.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},d.prototype.inotn=function(e){c("number"==typeof e&&e>=0);var a=0|Math.ceil(e/26),t=e%26;this._expand(a),t>0&&a--;for(var f=0;f0&&(this.words[f]=~this.words[f]&67108863>>26-t),this.strip()},d.prototype.notn=function(e){return this.clone().inotn(e)},d.prototype.setn=function(e,a){c("number"==typeof e&&e>=0);var t=e/26|0,f=e%26;return this._expand(t+1),this.words[t]=a?this.words[t]|1<e.length?(t=this,c=e):(t=e,c=this);for(var f=0,d=0;d>>26;for(;0!==f&&d>>26;if(this.length=t.length,0!==f)this.words[this.length]=f,this.length++;else if(t!==this)for(;de.length?this.clone().iadd(e):e.clone().iadd(this)},d.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var a=this.iadd(e);return e.negative=1,a._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var t,c,f=this.cmp(e);if(0===f)return this.negative=0,this.length=1,this.words[0]=0,this;f>0?(t=this,c=e):(t=e,c=this);for(var d=0,r=0;r>26,this.words[r]=67108863&a;for(;0!==d&&r>26,this.words[r]=67108863&a;if(0===d&&r>>13,u=0|r[1],h=8191&u,p=u>>>13,g=0|r[2],m=8191&g,x=g>>>13,y=0|r[3],A=8191&y,v=y>>>13,w=0|r[4],_=8191&w,I=w>>>13,E=0|r[5],C=8191&E,M=E>>>13,B=0|r[6],k=8191&B,L=B>>>13,S=0|r[7],T=8191&S,N=S>>>13,R=0|r[8],P=8191&R,D=R>>>13,O=0|r[9],F=8191&O,Q=O>>>13,U=0|n[0],j=8191&U,H=U>>>13,q=0|n[1],$=8191&q,z=q>>>13,G=0|n[2],K=8191&G,V=G>>>13,Z=0|n[3],J=8191&Z,W=Z>>>13,Y=0|n[4],X=8191&Y,ee=Y>>>13,ae=0|n[5],te=8191&ae,ce=ae>>>13,fe=0|n[6],de=8191&fe,re=fe>>>13,ne=0|n[7],ie=8191&ne,be=ne>>>13,oe=0|n[8],se=8191&oe,le=oe>>>13,ue=0|n[9],he=8191&ue,pe=ue>>>13;t.negative=e.negative^a.negative,t.length=19;var ge=(b+(c=Math.imul(s,j))|0)+((8191&(f=(f=Math.imul(s,H))+Math.imul(l,j)|0))<<13)|0;b=((d=Math.imul(l,H))+(f>>>13)|0)+(ge>>>26)|0,ge&=67108863,c=Math.imul(h,j),f=(f=Math.imul(h,H))+Math.imul(p,j)|0,d=Math.imul(p,H);var me=(b+(c=c+Math.imul(s,$)|0)|0)+((8191&(f=(f=f+Math.imul(s,z)|0)+Math.imul(l,$)|0))<<13)|0;b=((d=d+Math.imul(l,z)|0)+(f>>>13)|0)+(me>>>26)|0,me&=67108863,c=Math.imul(m,j),f=(f=Math.imul(m,H))+Math.imul(x,j)|0,d=Math.imul(x,H),c=c+Math.imul(h,$)|0,f=(f=f+Math.imul(h,z)|0)+Math.imul(p,$)|0,d=d+Math.imul(p,z)|0;var xe=(b+(c=c+Math.imul(s,K)|0)|0)+((8191&(f=(f=f+Math.imul(s,V)|0)+Math.imul(l,K)|0))<<13)|0;b=((d=d+Math.imul(l,V)|0)+(f>>>13)|0)+(xe>>>26)|0,xe&=67108863,c=Math.imul(A,j),f=(f=Math.imul(A,H))+Math.imul(v,j)|0,d=Math.imul(v,H),c=c+Math.imul(m,$)|0,f=(f=f+Math.imul(m,z)|0)+Math.imul(x,$)|0,d=d+Math.imul(x,z)|0,c=c+Math.imul(h,K)|0,f=(f=f+Math.imul(h,V)|0)+Math.imul(p,K)|0,d=d+Math.imul(p,V)|0;var ye=(b+(c=c+Math.imul(s,J)|0)|0)+((8191&(f=(f=f+Math.imul(s,W)|0)+Math.imul(l,J)|0))<<13)|0;b=((d=d+Math.imul(l,W)|0)+(f>>>13)|0)+(ye>>>26)|0,ye&=67108863,c=Math.imul(_,j),f=(f=Math.imul(_,H))+Math.imul(I,j)|0,d=Math.imul(I,H),c=c+Math.imul(A,$)|0,f=(f=f+Math.imul(A,z)|0)+Math.imul(v,$)|0,d=d+Math.imul(v,z)|0,c=c+Math.imul(m,K)|0,f=(f=f+Math.imul(m,V)|0)+Math.imul(x,K)|0,d=d+Math.imul(x,V)|0,c=c+Math.imul(h,J)|0,f=(f=f+Math.imul(h,W)|0)+Math.imul(p,J)|0,d=d+Math.imul(p,W)|0;var Ae=(b+(c=c+Math.imul(s,X)|0)|0)+((8191&(f=(f=f+Math.imul(s,ee)|0)+Math.imul(l,X)|0))<<13)|0;b=((d=d+Math.imul(l,ee)|0)+(f>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,c=Math.imul(C,j),f=(f=Math.imul(C,H))+Math.imul(M,j)|0,d=Math.imul(M,H),c=c+Math.imul(_,$)|0,f=(f=f+Math.imul(_,z)|0)+Math.imul(I,$)|0,d=d+Math.imul(I,z)|0,c=c+Math.imul(A,K)|0,f=(f=f+Math.imul(A,V)|0)+Math.imul(v,K)|0,d=d+Math.imul(v,V)|0,c=c+Math.imul(m,J)|0,f=(f=f+Math.imul(m,W)|0)+Math.imul(x,J)|0,d=d+Math.imul(x,W)|0,c=c+Math.imul(h,X)|0,f=(f=f+Math.imul(h,ee)|0)+Math.imul(p,X)|0,d=d+Math.imul(p,ee)|0;var ve=(b+(c=c+Math.imul(s,te)|0)|0)+((8191&(f=(f=f+Math.imul(s,ce)|0)+Math.imul(l,te)|0))<<13)|0;b=((d=d+Math.imul(l,ce)|0)+(f>>>13)|0)+(ve>>>26)|0,ve&=67108863,c=Math.imul(k,j),f=(f=Math.imul(k,H))+Math.imul(L,j)|0,d=Math.imul(L,H),c=c+Math.imul(C,$)|0,f=(f=f+Math.imul(C,z)|0)+Math.imul(M,$)|0,d=d+Math.imul(M,z)|0,c=c+Math.imul(_,K)|0,f=(f=f+Math.imul(_,V)|0)+Math.imul(I,K)|0,d=d+Math.imul(I,V)|0,c=c+Math.imul(A,J)|0,f=(f=f+Math.imul(A,W)|0)+Math.imul(v,J)|0,d=d+Math.imul(v,W)|0,c=c+Math.imul(m,X)|0,f=(f=f+Math.imul(m,ee)|0)+Math.imul(x,X)|0,d=d+Math.imul(x,ee)|0,c=c+Math.imul(h,te)|0,f=(f=f+Math.imul(h,ce)|0)+Math.imul(p,te)|0,d=d+Math.imul(p,ce)|0;var we=(b+(c=c+Math.imul(s,de)|0)|0)+((8191&(f=(f=f+Math.imul(s,re)|0)+Math.imul(l,de)|0))<<13)|0;b=((d=d+Math.imul(l,re)|0)+(f>>>13)|0)+(we>>>26)|0,we&=67108863,c=Math.imul(T,j),f=(f=Math.imul(T,H))+Math.imul(N,j)|0,d=Math.imul(N,H),c=c+Math.imul(k,$)|0,f=(f=f+Math.imul(k,z)|0)+Math.imul(L,$)|0,d=d+Math.imul(L,z)|0,c=c+Math.imul(C,K)|0,f=(f=f+Math.imul(C,V)|0)+Math.imul(M,K)|0,d=d+Math.imul(M,V)|0,c=c+Math.imul(_,J)|0,f=(f=f+Math.imul(_,W)|0)+Math.imul(I,J)|0,d=d+Math.imul(I,W)|0,c=c+Math.imul(A,X)|0,f=(f=f+Math.imul(A,ee)|0)+Math.imul(v,X)|0,d=d+Math.imul(v,ee)|0,c=c+Math.imul(m,te)|0,f=(f=f+Math.imul(m,ce)|0)+Math.imul(x,te)|0,d=d+Math.imul(x,ce)|0,c=c+Math.imul(h,de)|0,f=(f=f+Math.imul(h,re)|0)+Math.imul(p,de)|0,d=d+Math.imul(p,re)|0;var _e=(b+(c=c+Math.imul(s,ie)|0)|0)+((8191&(f=(f=f+Math.imul(s,be)|0)+Math.imul(l,ie)|0))<<13)|0;b=((d=d+Math.imul(l,be)|0)+(f>>>13)|0)+(_e>>>26)|0,_e&=67108863,c=Math.imul(P,j),f=(f=Math.imul(P,H))+Math.imul(D,j)|0,d=Math.imul(D,H),c=c+Math.imul(T,$)|0,f=(f=f+Math.imul(T,z)|0)+Math.imul(N,$)|0,d=d+Math.imul(N,z)|0,c=c+Math.imul(k,K)|0,f=(f=f+Math.imul(k,V)|0)+Math.imul(L,K)|0,d=d+Math.imul(L,V)|0,c=c+Math.imul(C,J)|0,f=(f=f+Math.imul(C,W)|0)+Math.imul(M,J)|0,d=d+Math.imul(M,W)|0,c=c+Math.imul(_,X)|0,f=(f=f+Math.imul(_,ee)|0)+Math.imul(I,X)|0,d=d+Math.imul(I,ee)|0,c=c+Math.imul(A,te)|0,f=(f=f+Math.imul(A,ce)|0)+Math.imul(v,te)|0,d=d+Math.imul(v,ce)|0,c=c+Math.imul(m,de)|0,f=(f=f+Math.imul(m,re)|0)+Math.imul(x,de)|0,d=d+Math.imul(x,re)|0,c=c+Math.imul(h,ie)|0,f=(f=f+Math.imul(h,be)|0)+Math.imul(p,ie)|0,d=d+Math.imul(p,be)|0;var Ie=(b+(c=c+Math.imul(s,se)|0)|0)+((8191&(f=(f=f+Math.imul(s,le)|0)+Math.imul(l,se)|0))<<13)|0;b=((d=d+Math.imul(l,le)|0)+(f>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,c=Math.imul(F,j),f=(f=Math.imul(F,H))+Math.imul(Q,j)|0,d=Math.imul(Q,H),c=c+Math.imul(P,$)|0,f=(f=f+Math.imul(P,z)|0)+Math.imul(D,$)|0,d=d+Math.imul(D,z)|0,c=c+Math.imul(T,K)|0,f=(f=f+Math.imul(T,V)|0)+Math.imul(N,K)|0,d=d+Math.imul(N,V)|0,c=c+Math.imul(k,J)|0,f=(f=f+Math.imul(k,W)|0)+Math.imul(L,J)|0,d=d+Math.imul(L,W)|0,c=c+Math.imul(C,X)|0,f=(f=f+Math.imul(C,ee)|0)+Math.imul(M,X)|0,d=d+Math.imul(M,ee)|0,c=c+Math.imul(_,te)|0,f=(f=f+Math.imul(_,ce)|0)+Math.imul(I,te)|0,d=d+Math.imul(I,ce)|0,c=c+Math.imul(A,de)|0,f=(f=f+Math.imul(A,re)|0)+Math.imul(v,de)|0,d=d+Math.imul(v,re)|0,c=c+Math.imul(m,ie)|0,f=(f=f+Math.imul(m,be)|0)+Math.imul(x,ie)|0,d=d+Math.imul(x,be)|0,c=c+Math.imul(h,se)|0,f=(f=f+Math.imul(h,le)|0)+Math.imul(p,se)|0,d=d+Math.imul(p,le)|0;var Ee=(b+(c=c+Math.imul(s,he)|0)|0)+((8191&(f=(f=f+Math.imul(s,pe)|0)+Math.imul(l,he)|0))<<13)|0;b=((d=d+Math.imul(l,pe)|0)+(f>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,c=Math.imul(F,$),f=(f=Math.imul(F,z))+Math.imul(Q,$)|0,d=Math.imul(Q,z),c=c+Math.imul(P,K)|0,f=(f=f+Math.imul(P,V)|0)+Math.imul(D,K)|0,d=d+Math.imul(D,V)|0,c=c+Math.imul(T,J)|0,f=(f=f+Math.imul(T,W)|0)+Math.imul(N,J)|0,d=d+Math.imul(N,W)|0,c=c+Math.imul(k,X)|0,f=(f=f+Math.imul(k,ee)|0)+Math.imul(L,X)|0,d=d+Math.imul(L,ee)|0,c=c+Math.imul(C,te)|0,f=(f=f+Math.imul(C,ce)|0)+Math.imul(M,te)|0,d=d+Math.imul(M,ce)|0,c=c+Math.imul(_,de)|0,f=(f=f+Math.imul(_,re)|0)+Math.imul(I,de)|0,d=d+Math.imul(I,re)|0,c=c+Math.imul(A,ie)|0,f=(f=f+Math.imul(A,be)|0)+Math.imul(v,ie)|0,d=d+Math.imul(v,be)|0,c=c+Math.imul(m,se)|0,f=(f=f+Math.imul(m,le)|0)+Math.imul(x,se)|0,d=d+Math.imul(x,le)|0;var Ce=(b+(c=c+Math.imul(h,he)|0)|0)+((8191&(f=(f=f+Math.imul(h,pe)|0)+Math.imul(p,he)|0))<<13)|0;b=((d=d+Math.imul(p,pe)|0)+(f>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,c=Math.imul(F,K),f=(f=Math.imul(F,V))+Math.imul(Q,K)|0,d=Math.imul(Q,V),c=c+Math.imul(P,J)|0,f=(f=f+Math.imul(P,W)|0)+Math.imul(D,J)|0,d=d+Math.imul(D,W)|0,c=c+Math.imul(T,X)|0,f=(f=f+Math.imul(T,ee)|0)+Math.imul(N,X)|0,d=d+Math.imul(N,ee)|0,c=c+Math.imul(k,te)|0,f=(f=f+Math.imul(k,ce)|0)+Math.imul(L,te)|0,d=d+Math.imul(L,ce)|0,c=c+Math.imul(C,de)|0,f=(f=f+Math.imul(C,re)|0)+Math.imul(M,de)|0,d=d+Math.imul(M,re)|0,c=c+Math.imul(_,ie)|0,f=(f=f+Math.imul(_,be)|0)+Math.imul(I,ie)|0,d=d+Math.imul(I,be)|0,c=c+Math.imul(A,se)|0,f=(f=f+Math.imul(A,le)|0)+Math.imul(v,se)|0,d=d+Math.imul(v,le)|0;var Me=(b+(c=c+Math.imul(m,he)|0)|0)+((8191&(f=(f=f+Math.imul(m,pe)|0)+Math.imul(x,he)|0))<<13)|0;b=((d=d+Math.imul(x,pe)|0)+(f>>>13)|0)+(Me>>>26)|0,Me&=67108863,c=Math.imul(F,J),f=(f=Math.imul(F,W))+Math.imul(Q,J)|0,d=Math.imul(Q,W),c=c+Math.imul(P,X)|0,f=(f=f+Math.imul(P,ee)|0)+Math.imul(D,X)|0,d=d+Math.imul(D,ee)|0,c=c+Math.imul(T,te)|0,f=(f=f+Math.imul(T,ce)|0)+Math.imul(N,te)|0,d=d+Math.imul(N,ce)|0,c=c+Math.imul(k,de)|0,f=(f=f+Math.imul(k,re)|0)+Math.imul(L,de)|0,d=d+Math.imul(L,re)|0,c=c+Math.imul(C,ie)|0,f=(f=f+Math.imul(C,be)|0)+Math.imul(M,ie)|0,d=d+Math.imul(M,be)|0,c=c+Math.imul(_,se)|0,f=(f=f+Math.imul(_,le)|0)+Math.imul(I,se)|0,d=d+Math.imul(I,le)|0;var Be=(b+(c=c+Math.imul(A,he)|0)|0)+((8191&(f=(f=f+Math.imul(A,pe)|0)+Math.imul(v,he)|0))<<13)|0;b=((d=d+Math.imul(v,pe)|0)+(f>>>13)|0)+(Be>>>26)|0,Be&=67108863,c=Math.imul(F,X),f=(f=Math.imul(F,ee))+Math.imul(Q,X)|0,d=Math.imul(Q,ee),c=c+Math.imul(P,te)|0,f=(f=f+Math.imul(P,ce)|0)+Math.imul(D,te)|0,d=d+Math.imul(D,ce)|0,c=c+Math.imul(T,de)|0,f=(f=f+Math.imul(T,re)|0)+Math.imul(N,de)|0,d=d+Math.imul(N,re)|0,c=c+Math.imul(k,ie)|0,f=(f=f+Math.imul(k,be)|0)+Math.imul(L,ie)|0,d=d+Math.imul(L,be)|0,c=c+Math.imul(C,se)|0,f=(f=f+Math.imul(C,le)|0)+Math.imul(M,se)|0,d=d+Math.imul(M,le)|0;var ke=(b+(c=c+Math.imul(_,he)|0)|0)+((8191&(f=(f=f+Math.imul(_,pe)|0)+Math.imul(I,he)|0))<<13)|0;b=((d=d+Math.imul(I,pe)|0)+(f>>>13)|0)+(ke>>>26)|0,ke&=67108863,c=Math.imul(F,te),f=(f=Math.imul(F,ce))+Math.imul(Q,te)|0,d=Math.imul(Q,ce),c=c+Math.imul(P,de)|0,f=(f=f+Math.imul(P,re)|0)+Math.imul(D,de)|0,d=d+Math.imul(D,re)|0,c=c+Math.imul(T,ie)|0,f=(f=f+Math.imul(T,be)|0)+Math.imul(N,ie)|0,d=d+Math.imul(N,be)|0,c=c+Math.imul(k,se)|0,f=(f=f+Math.imul(k,le)|0)+Math.imul(L,se)|0,d=d+Math.imul(L,le)|0;var Le=(b+(c=c+Math.imul(C,he)|0)|0)+((8191&(f=(f=f+Math.imul(C,pe)|0)+Math.imul(M,he)|0))<<13)|0;b=((d=d+Math.imul(M,pe)|0)+(f>>>13)|0)+(Le>>>26)|0,Le&=67108863,c=Math.imul(F,de),f=(f=Math.imul(F,re))+Math.imul(Q,de)|0,d=Math.imul(Q,re),c=c+Math.imul(P,ie)|0,f=(f=f+Math.imul(P,be)|0)+Math.imul(D,ie)|0,d=d+Math.imul(D,be)|0,c=c+Math.imul(T,se)|0,f=(f=f+Math.imul(T,le)|0)+Math.imul(N,se)|0,d=d+Math.imul(N,le)|0;var Se=(b+(c=c+Math.imul(k,he)|0)|0)+((8191&(f=(f=f+Math.imul(k,pe)|0)+Math.imul(L,he)|0))<<13)|0;b=((d=d+Math.imul(L,pe)|0)+(f>>>13)|0)+(Se>>>26)|0,Se&=67108863,c=Math.imul(F,ie),f=(f=Math.imul(F,be))+Math.imul(Q,ie)|0,d=Math.imul(Q,be),c=c+Math.imul(P,se)|0,f=(f=f+Math.imul(P,le)|0)+Math.imul(D,se)|0,d=d+Math.imul(D,le)|0;var Te=(b+(c=c+Math.imul(T,he)|0)|0)+((8191&(f=(f=f+Math.imul(T,pe)|0)+Math.imul(N,he)|0))<<13)|0;b=((d=d+Math.imul(N,pe)|0)+(f>>>13)|0)+(Te>>>26)|0,Te&=67108863,c=Math.imul(F,se),f=(f=Math.imul(F,le))+Math.imul(Q,se)|0,d=Math.imul(Q,le);var Ne=(b+(c=c+Math.imul(P,he)|0)|0)+((8191&(f=(f=f+Math.imul(P,pe)|0)+Math.imul(D,he)|0))<<13)|0;b=((d=d+Math.imul(D,pe)|0)+(f>>>13)|0)+(Ne>>>26)|0,Ne&=67108863;var Re=(b+(c=Math.imul(F,he))|0)+((8191&(f=(f=Math.imul(F,pe))+Math.imul(Q,he)|0))<<13)|0;return b=((d=Math.imul(Q,pe))+(f>>>13)|0)+(Re>>>26)|0,Re&=67108863,i[0]=ge,i[1]=me,i[2]=xe,i[3]=ye,i[4]=Ae,i[5]=ve,i[6]=we,i[7]=_e,i[8]=Ie,i[9]=Ee,i[10]=Ce,i[11]=Me,i[12]=Be,i[13]=ke,i[14]=Le,i[15]=Se,i[16]=Te,i[17]=Ne,i[18]=Re,0!==b&&(i[19]=b,t.length++),t};function p(e,a,t){return(new g).mulp(e,a,t)}function g(e,a){this.x=e,this.y=a}Math.imul||(h=u),d.prototype.mulTo=function(e,a){var t,c=this.length+e.length;return t=10===this.length&&10===e.length?h(this,e,a):c<63?u(this,e,a):c<1024?function(e,a,t){t.negative=a.negative^e.negative,t.length=e.length+a.length;for(var c=0,f=0,d=0;d>>26)|0)>>>26,r&=67108863}t.words[d]=n,c=r,r=f}return 0!==c?t.words[d]=c:t.length--,t.strip()}(this,e,a):p(this,e,a),t},g.prototype.makeRBT=function(e){for(var a=new Array(e),t=d.prototype._countBits(e)-1,c=0;c>=1;return c},g.prototype.permute=function(e,a,t,c,f,d){for(var r=0;r>>=1)f++;return 1<>>=13,t[2*r+1]=8191&d,d>>>=13;for(r=2*a;r>=26,a+=f/67108864|0,a+=d>>>26,this.words[t]=67108863&d}return 0!==a&&(this.words[t]=a,this.length++),this},d.prototype.muln=function(e){return this.clone().imuln(e)},d.prototype.sqr=function(){return this.mul(this)},d.prototype.isqr=function(){return this.imul(this.clone())},d.prototype.pow=function(e){var a=function(e){for(var a=new Array(e.bitLength()),t=0;t>>f}return a}(e);if(0===a.length)return new d(1);for(var t=this,c=0;c=0);var a,t=e%26,f=(e-t)/26,d=67108863>>>26-t<<26-t;if(0!==t){var r=0;for(a=0;a>>26-t}r&&(this.words[a]=r,this.length++)}if(0!==f){for(a=this.length-1;a>=0;a--)this.words[a+f]=this.words[a];for(a=0;a=0),f=a?(a-a%26)/26:0;var d=e%26,r=Math.min((e-d)/26,this.length),n=67108863^67108863>>>d<r)for(this.length-=r,b=0;b=0&&(0!==o||b>=f);b--){var s=0|this.words[b];this.words[b]=o<<26-d|s>>>d,o=s&n}return i&&0!==o&&(i.words[i.length++]=o),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},d.prototype.ishrn=function(e,a,t){return c(0===this.negative),this.iushrn(e,a,t)},d.prototype.shln=function(e){return this.clone().ishln(e)},d.prototype.ushln=function(e){return this.clone().iushln(e)},d.prototype.shrn=function(e){return this.clone().ishrn(e)},d.prototype.ushrn=function(e){return this.clone().iushrn(e)},d.prototype.testn=function(e){c("number"==typeof e&&e>=0);var a=e%26,t=(e-a)/26,f=1<=0);var a=e%26,t=(e-a)/26;if(c(0===this.negative,"imaskn works only with positive numbers"),this.length<=t)return this;if(0!==a&&t++,this.length=Math.min(t,this.length),0!==a){var f=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},d.prototype.isubn=function(e){if(c("number"==typeof e),c(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(i/67108864|0),this.words[f+t]=67108863&d}for(;f>26,this.words[f+t]=67108863&d;if(0===n)return this.strip();for(c(-1===n),n=0,f=0;f>26,this.words[f]=67108863&d;return this.negative=1,this.strip()},d.prototype._wordDiv=function(e,a){var t=(this.length,e.length),c=this.clone(),f=e,r=0|f.words[f.length-1];0!=(t=26-this._countBits(r))&&(f=f.ushln(t),c.iushln(t),r=0|f.words[f.length-1]);var n,i=c.length-f.length;if("mod"!==a){(n=new d(null)).length=i+1,n.words=new Array(n.length);for(var b=0;b=0;s--){var l=67108864*(0|c.words[f.length+s])+(0|c.words[f.length+s-1]);for(l=Math.min(l/r|0,67108863),c._ishlnsubmul(f,l,s);0!==c.negative;)l--,c.negative=0,c._ishlnsubmul(f,1,s),c.isZero()||(c.negative^=1);n&&(n.words[s]=l)}return n&&n.strip(),c.strip(),"div"!==a&&0!==t&&c.iushrn(t),{div:n||null,mod:c}},d.prototype.divmod=function(e,a,t){return c(!e.isZero()),this.isZero()?{div:new d(0),mod:new d(0)}:0!==this.negative&&0===e.negative?(n=this.neg().divmod(e,a),"mod"!==a&&(f=n.div.neg()),"div"!==a&&(r=n.mod.neg(),t&&0!==r.negative&&r.iadd(e)),{div:f,mod:r}):0===this.negative&&0!==e.negative?(n=this.divmod(e.neg(),a),"mod"!==a&&(f=n.div.neg()),{div:f,mod:n.mod}):this.negative&e.negative?(n=this.neg().divmod(e.neg(),a),"div"!==a&&(r=n.mod.neg(),t&&0!==r.negative&&r.isub(e)),{div:n.div,mod:r}):e.length>this.length||this.cmp(e)<0?{div:new d(0),mod:this}:1===e.length?"div"===a?{div:this.divn(e.words[0]),mod:null}:"mod"===a?{div:null,mod:new d(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new d(this.modn(e.words[0]))}:this._wordDiv(e,a);var f,r,n},d.prototype.div=function(e){return this.divmod(e,"div",!1).div},d.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},d.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},d.prototype.divRound=function(e){var a=this.divmod(e);if(a.mod.isZero())return a.div;var t=0!==a.div.negative?a.mod.isub(e):a.mod,c=e.ushrn(1),f=e.andln(1),d=t.cmp(c);return d<0||1===f&&0===d?a.div:0!==a.div.negative?a.div.isubn(1):a.div.iaddn(1)},d.prototype.modn=function(e){c(e<=67108863);for(var a=(1<<26)%e,t=0,f=this.length-1;f>=0;f--)t=(a*t+(0|this.words[f]))%e;return t},d.prototype.idivn=function(e){c(e<=67108863);for(var a=0,t=this.length-1;t>=0;t--){var f=(0|this.words[t])+67108864*a;this.words[t]=f/e|0,a=f%e}return this.strip()},d.prototype.divn=function(e){return this.clone().idivn(e)},d.prototype.egcd=function(e){c(0===e.negative),c(!e.isZero());var a=this,t=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var f=new d(1),r=new d(0),n=new d(0),i=new d(1),b=0;a.isEven()&&t.isEven();)a.iushrn(1),t.iushrn(1),++b;for(var o=t.clone(),s=a.clone();!a.isZero();){for(var l=0,u=1;!(a.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(a.iushrn(l);l-- >0;)(f.isOdd()||r.isOdd())&&(f.iadd(o),r.isub(s)),f.iushrn(1),r.iushrn(1);for(var h=0,p=1;!(t.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(n.isOdd()||i.isOdd())&&(n.iadd(o),i.isub(s)),n.iushrn(1),i.iushrn(1);a.cmp(t)>=0?(a.isub(t),f.isub(n),r.isub(i)):(t.isub(a),n.isub(f),i.isub(r))}return{a:n,b:i,gcd:t.iushln(b)}},d.prototype._invmp=function(e){c(0===e.negative),c(!e.isZero());var a=this,t=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var f,r=new d(1),n=new d(0),i=t.clone();a.cmpn(1)>0&&t.cmpn(1)>0;){for(var b=0,o=1;!(a.words[0]&o)&&b<26;++b,o<<=1);if(b>0)for(a.iushrn(b);b-- >0;)r.isOdd()&&r.iadd(i),r.iushrn(1);for(var s=0,l=1;!(t.words[0]&l)&&s<26;++s,l<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(i),n.iushrn(1);a.cmp(t)>=0?(a.isub(t),r.isub(n)):(t.isub(a),n.isub(r))}return(f=0===a.cmpn(1)?r:n).cmpn(0)<0&&f.iadd(e),f},d.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var a=this.clone(),t=e.clone();a.negative=0,t.negative=0;for(var c=0;a.isEven()&&t.isEven();c++)a.iushrn(1),t.iushrn(1);for(;;){for(;a.isEven();)a.iushrn(1);for(;t.isEven();)t.iushrn(1);var f=a.cmp(t);if(f<0){var d=a;a=t,t=d}else if(0===f||0===t.cmpn(1))break;a.isub(t)}return t.iushln(c)},d.prototype.invm=function(e){return this.egcd(e).a.umod(e)},d.prototype.isEven=function(){return!(1&this.words[0])},d.prototype.isOdd=function(){return!(1&~this.words[0])},d.prototype.andln=function(e){return this.words[0]&e},d.prototype.bincn=function(e){c("number"==typeof e);var a=e%26,t=(e-a)/26,f=1<>>26,n&=67108863,this.words[r]=n}return 0!==d&&(this.words[r]=d,this.length++),this},d.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},d.prototype.cmpn=function(e){var a,t=e<0;if(0!==this.negative&&!t)return-1;if(0===this.negative&&t)return 1;if(this.strip(),this.length>1)a=1;else{t&&(e=-e),c(e<=67108863,"Number is too big");var f=0|this.words[0];a=f===e?0:fe.length)return 1;if(this.length=0;t--){var c=0|this.words[t],f=0|e.words[t];if(c!==f){cf&&(a=1);break}}return a},d.prototype.gtn=function(e){return 1===this.cmpn(e)},d.prototype.gt=function(e){return 1===this.cmp(e)},d.prototype.gten=function(e){return this.cmpn(e)>=0},d.prototype.gte=function(e){return this.cmp(e)>=0},d.prototype.ltn=function(e){return-1===this.cmpn(e)},d.prototype.lt=function(e){return-1===this.cmp(e)},d.prototype.lten=function(e){return this.cmpn(e)<=0},d.prototype.lte=function(e){return this.cmp(e)<=0},d.prototype.eqn=function(e){return 0===this.cmpn(e)},d.prototype.eq=function(e){return 0===this.cmp(e)},d.red=function(e){return new _(e)},d.prototype.toRed=function(e){return c(!this.red,"Already a number in reduction context"),c(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},d.prototype.fromRed=function(){return c(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},d.prototype._forceRed=function(e){return this.red=e,this},d.prototype.forceRed=function(e){return c(!this.red,"Already a number in reduction context"),this._forceRed(e)},d.prototype.redAdd=function(e){return c(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},d.prototype.redIAdd=function(e){return c(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},d.prototype.redSub=function(e){return c(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},d.prototype.redISub=function(e){return c(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},d.prototype.redShl=function(e){return c(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},d.prototype.redMul=function(e){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},d.prototype.redIMul=function(e){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},d.prototype.redSqr=function(){return c(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},d.prototype.redISqr=function(){return c(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},d.prototype.redSqrt=function(){return c(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},d.prototype.redInvm=function(){return c(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},d.prototype.redNeg=function(){return c(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},d.prototype.redPow=function(e){return c(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var m={k256:null,p224:null,p192:null,p25519:null};function x(e,a){this.name=e,this.p=new d(a,16),this.n=this.p.bitLength(),this.k=new d(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){x.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){x.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){x.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){x.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"==typeof e){var a=d._prime(e);this.m=a.p,this.prime=a}else c(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function I(e){_.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new d(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)}x.prototype._tmp=function(){var e=new d(null);return e.words=new Array(Math.ceil(this.n/13)),e},x.prototype.ireduce=function(e){var a,t=e;do{this.split(t,this.tmp),a=(t=(t=this.imulK(t)).iadd(this.tmp)).bitLength()}while(a>this.n);var c=a0?t.isub(this.p):void 0!==t.strip?t.strip():t._strip(),t},x.prototype.split=function(e,a){e.iushrn(this.n,0,a)},x.prototype.imulK=function(e){return e.imul(this.k)},f(y,x),y.prototype.split=function(e,a){for(var t=4194303,c=Math.min(e.length,9),f=0;f>>22,d=r}d>>>=22,e.words[f-10]=d,0===d&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var a=0,t=0;t>>=26,e.words[t]=f,a=c}return 0!==a&&(e.words[e.length++]=a),e},d._prime=function(e){if(m[e])return m[e];var a;if("k256"===e)a=new y;else if("p224"===e)a=new A;else if("p192"===e)a=new v;else{if("p25519"!==e)throw new Error("Unknown prime "+e);a=new w}return m[e]=a,a},_.prototype._verify1=function(e){c(0===e.negative,"red works only with positives"),c(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,a){c(!(e.negative|a.negative),"red works only with positives"),c(e.red&&e.red===a.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,a){this._verify2(e,a);var t=e.add(a);return t.cmp(this.m)>=0&&t.isub(this.m),t._forceRed(this)},_.prototype.iadd=function(e,a){this._verify2(e,a);var t=e.iadd(a);return t.cmp(this.m)>=0&&t.isub(this.m),t},_.prototype.sub=function(e,a){this._verify2(e,a);var t=e.sub(a);return t.cmpn(0)<0&&t.iadd(this.m),t._forceRed(this)},_.prototype.isub=function(e,a){this._verify2(e,a);var t=e.isub(a);return t.cmpn(0)<0&&t.iadd(this.m),t},_.prototype.shl=function(e,a){return this._verify1(e),this.imod(e.ushln(a))},_.prototype.imul=function(e,a){return this._verify2(e,a),this.imod(e.imul(a))},_.prototype.mul=function(e,a){return this._verify2(e,a),this.imod(e.mul(a))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var a=this.m.andln(3);if(c(a%2==1),3===a){var t=this.m.add(new d(1)).iushrn(2);return this.pow(e,t)}for(var f=this.m.subn(1),r=0;!f.isZero()&&0===f.andln(1);)r++,f.iushrn(1);c(!f.isZero());var n=new d(1).toRed(this),i=n.redNeg(),b=this.m.subn(1).iushrn(1),o=this.m.bitLength();for(o=new d(2*o*o).toRed(this);0!==this.pow(o,b).cmp(i);)o.redIAdd(i);for(var s=this.pow(o,f),l=this.pow(e,f.addn(1).iushrn(1)),u=this.pow(e,f),h=r;0!==u.cmp(n);){for(var p=u,g=0;0!==p.cmp(n);g++)p=p.redSqr();c(g=0;c--){for(var b=a.words[c],o=i-1;o>=0;o--){var s=b>>o&1;f!==t[0]&&(f=this.sqr(f)),0!==s||0!==r?(r<<=1,r|=s,(4==++n||0===c&&0===o)&&(f=this.mul(f,t[r]),n=0,r=0)):n=0}i=26}return f},_.prototype.convertTo=function(e){var a=e.umod(this.m);return a===e?a.clone():a},_.prototype.convertFrom=function(e){var a=e.clone();return a.red=null,a},d.mont=function(e){return new I(e)},f(I,_),I.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},I.prototype.convertFrom=function(e){var a=this.imod(e.mul(this.rinv));return a.red=null,a},I.prototype.imul=function(e,a){if(e.isZero()||a.isZero())return e.words[0]=0,e.length=1,e;var t=e.imul(a),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=t.isub(c).iushrn(this.shift),d=f;return f.cmp(this.m)>=0?d=f.isub(this.m):f.cmpn(0)<0&&(d=f.iadd(this.m)),d._forceRed(this)},I.prototype.mul=function(e,a){if(e.isZero()||a.isZero())return new d(0)._forceRed(this);var t=e.mul(a),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=t.isub(c).iushrn(this.shift),r=f;return f.cmp(this.m)>=0?r=f.isub(this.m):f.cmpn(0)<0&&(r=f.iadd(this.m)),r._forceRed(this)},I.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=t.nmd(e),this)},86729:(e,a,t)=>{"use strict";var c=a;c.version=t(1636).rE,c.utils=t(47011),c.rand=t(15037),c.curve=t(894),c.curves=t(60480),c.ec=t(57447),c.eddsa=t(8650)},36677:(e,a,t)=>{"use strict";var c=t(28490),f=t(47011),d=f.getNAF,r=f.getJSF,n=f.assert;function i(e,a){this.type=e,this.p=new c(a.p,16),this.red=a.prime?c.red(a.prime):c.mont(this.p),this.zero=new c(0).toRed(this.red),this.one=new c(1).toRed(this.red),this.two=new c(2).toRed(this.red),this.n=a.n&&new c(a.n,16),this.g=a.g&&this.pointFromJSON(a.g,a.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function b(e,a){this.curve=e,this.type=a,this.precomputed=null}e.exports=i,i.prototype.point=function(){throw new Error("Not implemented")},i.prototype.validate=function(){throw new Error("Not implemented")},i.prototype._fixedNafMul=function(e,a){n(e.precomputed);var t=e._getDoubles(),c=d(a,1,this._bitLength),f=(1<=r;o--)i=(i<<1)+c[o];b.push(i)}for(var s=this.jpoint(null,null,null),l=this.jpoint(null,null,null),u=f;u>0;u--){for(r=0;r=0;b--){for(var o=0;b>=0&&0===r[b];b--)o++;if(b>=0&&o++,i=i.dblp(o),b<0)break;var s=r[b];n(0!==s),i="affine"===e.type?s>0?i.mixedAdd(f[s-1>>1]):i.mixedAdd(f[-s-1>>1].neg()):s>0?i.add(f[s-1>>1]):i.add(f[-s-1>>1].neg())}return"affine"===e.type?i.toP():i},i.prototype._wnafMulAdd=function(e,a,t,c,f){var n,i,b,o=this._wnafT1,s=this._wnafT2,l=this._wnafT3,u=0;for(n=0;n=1;n-=2){var p=n-1,g=n;if(1===o[p]&&1===o[g]){var m=[a[p],null,null,a[g]];0===a[p].y.cmp(a[g].y)?(m[1]=a[p].add(a[g]),m[2]=a[p].toJ().mixedAdd(a[g].neg())):0===a[p].y.cmp(a[g].y.redNeg())?(m[1]=a[p].toJ().mixedAdd(a[g]),m[2]=a[p].add(a[g].neg())):(m[1]=a[p].toJ().mixedAdd(a[g]),m[2]=a[p].toJ().mixedAdd(a[g].neg()));var x=[-3,-1,-5,-7,0,7,5,1,3],y=r(t[p],t[g]);for(u=Math.max(y[0].length,u),l[p]=new Array(u),l[g]=new Array(u),i=0;i=0;n--){for(var I=0;n>=0;){var E=!0;for(i=0;i=0&&I++,w=w.dblp(I),n<0)break;for(i=0;i0?b=s[i][C-1>>1]:C<0&&(b=s[i][-C-1>>1].neg()),w="affine"===b.type?w.mixedAdd(b):w.add(b))}}for(n=0;n=Math.ceil((e.bitLength()+1)/a.step)},b.prototype._getDoubles=function(e,a){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var t=[this],c=this,f=0;f{"use strict";var c=t(47011),f=t(28490),d=t(56698),r=t(36677),n=c.assert;function i(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,r.call(this,"edwards",e),this.a=new f(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new f(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new f(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),n(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function b(e,a,t,c,d){r.BasePoint.call(this,e,"projective"),null===a&&null===t&&null===c?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new f(a,16),this.y=new f(t,16),this.z=c?new f(c,16):this.curve.one,this.t=d&&new f(d,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}d(i,r),e.exports=i,i.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},i.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},i.prototype.jpoint=function(e,a,t,c){return this.point(e,a,t,c)},i.prototype.pointFromX=function(e,a){(e=new f(e,16)).red||(e=e.toRed(this.red));var t=e.redSqr(),c=this.c2.redSub(this.a.redMul(t)),d=this.one.redSub(this.c2.redMul(this.d).redMul(t)),r=c.redMul(d.redInvm()),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(a&&!i||!a&&i)&&(n=n.redNeg()),this.point(e,n)},i.prototype.pointFromY=function(e,a){(e=new f(e,16)).red||(e=e.toRed(this.red));var t=e.redSqr(),c=t.redSub(this.c2),d=t.redMul(this.d).redMul(this.c2).redSub(this.a),r=c.redMul(d.redInvm());if(0===r.cmp(this.zero)){if(a)throw new Error("invalid point");return this.point(this.zero,e)}var n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");return n.fromRed().isOdd()!==a&&(n=n.redNeg()),this.point(n,e)},i.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var a=e.x.redSqr(),t=e.y.redSqr(),c=a.redMul(this.a).redAdd(t),f=this.c2.redMul(this.one.redAdd(this.d.redMul(a).redMul(t)));return 0===c.cmp(f)},d(b,r.BasePoint),i.prototype.pointFromJSON=function(e){return b.fromJSON(this,e)},i.prototype.point=function(e,a,t,c){return new b(this,e,a,t,c)},b.fromJSON=function(e,a){return new b(e,a[0],a[1],a[2])},b.prototype.inspect=function(){return this.isInfinity()?"":""},b.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},b.prototype._extDbl=function(){var e=this.x.redSqr(),a=this.y.redSqr(),t=this.z.redSqr();t=t.redIAdd(t);var c=this.curve._mulA(e),f=this.x.redAdd(this.y).redSqr().redISub(e).redISub(a),d=c.redAdd(a),r=d.redSub(t),n=c.redSub(a),i=f.redMul(r),b=d.redMul(n),o=f.redMul(n),s=r.redMul(d);return this.curve.point(i,b,s,o)},b.prototype._projDbl=function(){var e,a,t,c,f,d,r=this.x.redAdd(this.y).redSqr(),n=this.x.redSqr(),i=this.y.redSqr();if(this.curve.twisted){var b=(c=this.curve._mulA(n)).redAdd(i);this.zOne?(e=r.redSub(n).redSub(i).redMul(b.redSub(this.curve.two)),a=b.redMul(c.redSub(i)),t=b.redSqr().redSub(b).redSub(b)):(f=this.z.redSqr(),d=b.redSub(f).redISub(f),e=r.redSub(n).redISub(i).redMul(d),a=b.redMul(c.redSub(i)),t=b.redMul(d))}else c=n.redAdd(i),f=this.curve._mulC(this.z).redSqr(),d=c.redSub(f).redSub(f),e=this.curve._mulC(r.redISub(c)).redMul(d),a=this.curve._mulC(c).redMul(n.redISub(i)),t=c.redMul(d);return this.curve.point(e,a,t)},b.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},b.prototype._extAdd=function(e){var a=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),t=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),c=this.t.redMul(this.curve.dd).redMul(e.t),f=this.z.redMul(e.z.redAdd(e.z)),d=t.redSub(a),r=f.redSub(c),n=f.redAdd(c),i=t.redAdd(a),b=d.redMul(r),o=n.redMul(i),s=d.redMul(i),l=r.redMul(n);return this.curve.point(b,o,l,s)},b.prototype._projAdd=function(e){var a,t,c=this.z.redMul(e.z),f=c.redSqr(),d=this.x.redMul(e.x),r=this.y.redMul(e.y),n=this.curve.d.redMul(d).redMul(r),i=f.redSub(n),b=f.redAdd(n),o=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(d).redISub(r),s=c.redMul(i).redMul(o);return this.curve.twisted?(a=c.redMul(b).redMul(r.redSub(this.curve._mulA(d))),t=i.redMul(b)):(a=c.redMul(b).redMul(r.redSub(d)),t=this.curve._mulC(i).redMul(b)),this.curve.point(s,a,t)},b.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},b.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},b.prototype.mulAdd=function(e,a,t){return this.curve._wnafMulAdd(1,[this,a],[e,t],2,!1)},b.prototype.jmulAdd=function(e,a,t){return this.curve._wnafMulAdd(1,[this,a],[e,t],2,!0)},b.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},b.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},b.prototype.getX=function(){return this.normalize(),this.x.fromRed()},b.prototype.getY=function(){return this.normalize(),this.y.fromRed()},b.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},b.prototype.eqXToP=function(e){var a=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(a))return!0;for(var t=e.clone(),c=this.curve.redN.redMul(this.z);;){if(t.iadd(this.curve.n),t.cmp(this.curve.p)>=0)return!1;if(a.redIAdd(c),0===this.x.cmp(a))return!0}},b.prototype.toP=b.prototype.normalize,b.prototype.mixedAdd=b.prototype.add},894:(e,a,t)=>{"use strict";var c=a;c.base=t(36677),c.short=t(39188),c.mont=t(30370),c.edwards=t(31298)},30370:(e,a,t)=>{"use strict";var c=t(28490),f=t(56698),d=t(36677),r=t(47011);function n(e){d.call(this,"mont",e),this.a=new c(e.a,16).toRed(this.red),this.b=new c(e.b,16).toRed(this.red),this.i4=new c(4).toRed(this.red).redInvm(),this.two=new c(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function i(e,a,t){d.BasePoint.call(this,e,"projective"),null===a&&null===t?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new c(a,16),this.z=new c(t,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}f(n,d),e.exports=n,n.prototype.validate=function(e){var a=e.normalize().x,t=a.redSqr(),c=t.redMul(a).redAdd(t.redMul(this.a)).redAdd(a);return 0===c.redSqrt().redSqr().cmp(c)},f(i,d.BasePoint),n.prototype.decodePoint=function(e,a){return this.point(r.toArray(e,a),1)},n.prototype.point=function(e,a){return new i(this,e,a)},n.prototype.pointFromJSON=function(e){return i.fromJSON(this,e)},i.prototype.precompute=function(){},i.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},i.fromJSON=function(e,a){return new i(e,a[0],a[1]||e.one)},i.prototype.inspect=function(){return this.isInfinity()?"":""},i.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},i.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),a=this.x.redSub(this.z).redSqr(),t=e.redSub(a),c=e.redMul(a),f=t.redMul(a.redAdd(this.curve.a24.redMul(t)));return this.curve.point(c,f)},i.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.diffAdd=function(e,a){var t=this.x.redAdd(this.z),c=this.x.redSub(this.z),f=e.x.redAdd(e.z),d=e.x.redSub(e.z).redMul(t),r=f.redMul(c),n=a.z.redMul(d.redAdd(r).redSqr()),i=a.x.redMul(d.redISub(r).redSqr());return this.curve.point(n,i)},i.prototype.mul=function(e){for(var a=e.clone(),t=this,c=this.curve.point(null,null),f=[];0!==a.cmpn(0);a.iushrn(1))f.push(a.andln(1));for(var d=f.length-1;d>=0;d--)0===f[d]?(t=t.diffAdd(c,this),c=c.dbl()):(c=t.diffAdd(c,this),t=t.dbl());return c},i.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},i.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},39188:(e,a,t)=>{"use strict";var c=t(47011),f=t(28490),d=t(56698),r=t(36677),n=c.assert;function i(e){r.call(this,"short",e),this.a=new f(e.a,16).toRed(this.red),this.b=new f(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function b(e,a,t,c){r.BasePoint.call(this,e,"affine"),null===a&&null===t?(this.x=null,this.y=null,this.inf=!0):(this.x=new f(a,16),this.y=new f(t,16),c&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function o(e,a,t,c){r.BasePoint.call(this,e,"jacobian"),null===a&&null===t&&null===c?(this.x=this.curve.one,this.y=this.curve.one,this.z=new f(0)):(this.x=new f(a,16),this.y=new f(t,16),this.z=new f(c,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}d(i,r),e.exports=i,i.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var a,t;if(e.beta)a=new f(e.beta,16).toRed(this.red);else{var c=this._getEndoRoots(this.p);a=(a=c[0].cmp(c[1])<0?c[0]:c[1]).toRed(this.red)}if(e.lambda)t=new f(e.lambda,16);else{var d=this._getEndoRoots(this.n);0===this.g.mul(d[0]).x.cmp(this.g.x.redMul(a))?t=d[0]:(t=d[1],n(0===this.g.mul(t).x.cmp(this.g.x.redMul(a))))}return{beta:a,lambda:t,basis:e.basis?e.basis.map((function(e){return{a:new f(e.a,16),b:new f(e.b,16)}})):this._getEndoBasis(t)}}},i.prototype._getEndoRoots=function(e){var a=e===this.p?this.red:f.mont(e),t=new f(2).toRed(a).redInvm(),c=t.redNeg(),d=new f(3).toRed(a).redNeg().redSqrt().redMul(t);return[c.redAdd(d).fromRed(),c.redSub(d).fromRed()]},i.prototype._getEndoBasis=function(e){for(var a,t,c,d,r,n,i,b,o,s=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=e,u=this.n.clone(),h=new f(1),p=new f(0),g=new f(0),m=new f(1),x=0;0!==l.cmpn(0);){var y=u.div(l);b=u.sub(y.mul(l)),o=g.sub(y.mul(h));var A=m.sub(y.mul(p));if(!c&&b.cmp(s)<0)a=i.neg(),t=h,c=b.neg(),d=o;else if(c&&2==++x)break;i=b,u=l,l=b,g=h,h=o,m=p,p=A}r=b.neg(),n=o;var v=c.sqr().add(d.sqr());return r.sqr().add(n.sqr()).cmp(v)>=0&&(r=a,n=t),c.negative&&(c=c.neg(),d=d.neg()),r.negative&&(r=r.neg(),n=n.neg()),[{a:c,b:d},{a:r,b:n}]},i.prototype._endoSplit=function(e){var a=this.endo.basis,t=a[0],c=a[1],f=c.b.mul(e).divRound(this.n),d=t.b.neg().mul(e).divRound(this.n),r=f.mul(t.a),n=d.mul(c.a),i=f.mul(t.b),b=d.mul(c.b);return{k1:e.sub(r).sub(n),k2:i.add(b).neg()}},i.prototype.pointFromX=function(e,a){(e=new f(e,16)).red||(e=e.toRed(this.red));var t=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),c=t.redSqrt();if(0!==c.redSqr().redSub(t).cmp(this.zero))throw new Error("invalid point");var d=c.fromRed().isOdd();return(a&&!d||!a&&d)&&(c=c.redNeg()),this.point(e,c)},i.prototype.validate=function(e){if(e.inf)return!0;var a=e.x,t=e.y,c=this.a.redMul(a),f=a.redSqr().redMul(a).redIAdd(c).redIAdd(this.b);return 0===t.redSqr().redISub(f).cmpn(0)},i.prototype._endoWnafMulAdd=function(e,a,t){for(var c=this._endoWnafT1,f=this._endoWnafT2,d=0;d":""},b.prototype.isInfinity=function(){return this.inf},b.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var a=this.y.redSub(e.y);0!==a.cmpn(0)&&(a=a.redMul(this.x.redSub(e.x).redInvm()));var t=a.redSqr().redISub(this.x).redISub(e.x),c=a.redMul(this.x.redSub(t)).redISub(this.y);return this.curve.point(t,c)},b.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var a=this.curve.a,t=this.x.redSqr(),c=e.redInvm(),f=t.redAdd(t).redIAdd(t).redIAdd(a).redMul(c),d=f.redSqr().redISub(this.x.redAdd(this.x)),r=f.redMul(this.x.redSub(d)).redISub(this.y);return this.curve.point(d,r)},b.prototype.getX=function(){return this.x.fromRed()},b.prototype.getY=function(){return this.y.fromRed()},b.prototype.mul=function(e){return e=new f(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},b.prototype.mulAdd=function(e,a,t){var c=[this,a],f=[e,t];return this.curve.endo?this.curve._endoWnafMulAdd(c,f):this.curve._wnafMulAdd(1,c,f,2)},b.prototype.jmulAdd=function(e,a,t){var c=[this,a],f=[e,t];return this.curve.endo?this.curve._endoWnafMulAdd(c,f,!0):this.curve._wnafMulAdd(1,c,f,2,!0)},b.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},b.prototype.neg=function(e){if(this.inf)return this;var a=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var t=this.precomputed,c=function(e){return e.neg()};a.precomputed={naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(c)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(c)}}}return a},b.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},d(o,r.BasePoint),i.prototype.jpoint=function(e,a,t){return new o(this,e,a,t)},o.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),a=e.redSqr(),t=this.x.redMul(a),c=this.y.redMul(a).redMul(e);return this.curve.point(t,c)},o.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},o.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var a=e.z.redSqr(),t=this.z.redSqr(),c=this.x.redMul(a),f=e.x.redMul(t),d=this.y.redMul(a.redMul(e.z)),r=e.y.redMul(t.redMul(this.z)),n=c.redSub(f),i=d.redSub(r);if(0===n.cmpn(0))return 0!==i.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var b=n.redSqr(),o=b.redMul(n),s=c.redMul(b),l=i.redSqr().redIAdd(o).redISub(s).redISub(s),u=i.redMul(s.redISub(l)).redISub(d.redMul(o)),h=this.z.redMul(e.z).redMul(n);return this.curve.jpoint(l,u,h)},o.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var a=this.z.redSqr(),t=this.x,c=e.x.redMul(a),f=this.y,d=e.y.redMul(a).redMul(this.z),r=t.redSub(c),n=f.redSub(d);if(0===r.cmpn(0))return 0!==n.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var i=r.redSqr(),b=i.redMul(r),o=t.redMul(i),s=n.redSqr().redIAdd(b).redISub(o).redISub(o),l=n.redMul(o.redISub(s)).redISub(f.redMul(b)),u=this.z.redMul(r);return this.curve.jpoint(s,l,u)},o.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var a;if(this.curve.zeroA||this.curve.threeA){var t=this;for(a=0;a=0)return!1;if(t.redIAdd(f),0===this.x.cmp(t))return!0}},o.prototype.inspect=function(){return this.isInfinity()?"":""},o.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},60480:(e,a,t)=>{"use strict";var c,f=a,d=t(77952),r=t(894),n=t(47011).assert;function i(e){"short"===e.type?this.curve=new r.short(e):"edwards"===e.type?this.curve=new r.edwards(e):this.curve=new r.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function b(e,a){Object.defineProperty(f,e,{configurable:!0,enumerable:!0,get:function(){var t=new i(a);return Object.defineProperty(f,e,{configurable:!0,enumerable:!0,value:t}),t}})}f.PresetCurve=i,b("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:d.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),b("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:d.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),b("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:d.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),b("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:d.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),b("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:d.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),b("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:d.sha256,gRed:!1,g:["9"]}),b("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:d.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{c=t(74011)}catch(e){c=void 0}b("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:d.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",c]})},57447:(e,a,t)=>{"use strict";var c=t(28490),f=t(32723),d=t(47011),r=t(60480),n=t(15037),i=d.assert,b=t(61200),o=t(28545);function s(e){if(!(this instanceof s))return new s(e);"string"==typeof e&&(i(Object.prototype.hasOwnProperty.call(r,e),"Unknown curve "+e),e=r[e]),e instanceof r.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=s,s.prototype.keyPair=function(e){return new b(this,e)},s.prototype.keyFromPrivate=function(e,a){return b.fromPrivate(this,e,a)},s.prototype.keyFromPublic=function(e,a){return b.fromPublic(this,e,a)},s.prototype.genKeyPair=function(e){e||(e={});for(var a=new f({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||n(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),t=this.n.byteLength(),d=this.n.sub(new c(2));;){var r=new c(a.generate(t));if(!(r.cmp(d)>0))return r.iaddn(1),this.keyFromPrivate(r)}},s.prototype._truncateToN=function(e,a){var t=8*e.byteLength()-this.n.bitLength();return t>0&&(e=e.ushrn(t)),!a&&e.cmp(this.n)>=0?e.sub(this.n):e},s.prototype.sign=function(e,a,t,d){"object"==typeof t&&(d=t,t=null),d||(d={}),a=this.keyFromPrivate(a,t),e=this._truncateToN(new c(e,16));for(var r=this.n.byteLength(),n=a.getPrivate().toArray("be",r),i=e.toArray("be",r),b=new f({hash:this.hash,entropy:n,nonce:i,pers:d.pers,persEnc:d.persEnc||"utf8"}),s=this.n.sub(new c(1)),l=0;;l++){var u=d.k?d.k(l):new c(b.generate(this.n.byteLength()));if(!((u=this._truncateToN(u,!0)).cmpn(1)<=0||u.cmp(s)>=0)){var h=this.g.mul(u);if(!h.isInfinity()){var p=h.getX(),g=p.umod(this.n);if(0!==g.cmpn(0)){var m=u.invm(this.n).mul(g.mul(a.getPrivate()).iadd(e));if(0!==(m=m.umod(this.n)).cmpn(0)){var x=(h.getY().isOdd()?1:0)|(0!==p.cmp(g)?2:0);return d.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),x^=1),new o({r:g,s:m,recoveryParam:x})}}}}}},s.prototype.verify=function(e,a,t,f){e=this._truncateToN(new c(e,16)),t=this.keyFromPublic(t,f);var d=(a=new o(a,"hex")).r,r=a.s;if(d.cmpn(1)<0||d.cmp(this.n)>=0)return!1;if(r.cmpn(1)<0||r.cmp(this.n)>=0)return!1;var n,i=r.invm(this.n),b=i.mul(e).umod(this.n),s=i.mul(d).umod(this.n);return this.curve._maxwellTrick?!(n=this.g.jmulAdd(b,t.getPublic(),s)).isInfinity()&&n.eqXToP(d):!(n=this.g.mulAdd(b,t.getPublic(),s)).isInfinity()&&0===n.getX().umod(this.n).cmp(d)},s.prototype.recoverPubKey=function(e,a,t,f){i((3&t)===t,"The recovery param is more than two bits"),a=new o(a,f);var d=this.n,r=new c(e),n=a.r,b=a.s,s=1&t,l=t>>1;if(n.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");n=l?this.curve.pointFromX(n.add(this.curve.n),s):this.curve.pointFromX(n,s);var u=a.r.invm(d),h=d.sub(r).mul(u).umod(d),p=b.mul(u).umod(d);return this.g.mulAdd(h,n,p)},s.prototype.getKeyRecoveryParam=function(e,a,t,c){if(null!==(a=new o(a,c)).recoveryParam)return a.recoveryParam;for(var f=0;f<4;f++){var d;try{d=this.recoverPubKey(e,a,f)}catch(e){continue}if(d.eq(t))return f}throw new Error("Unable to find valid recovery factor")}},61200:(e,a,t)=>{"use strict";var c=t(28490),f=t(47011).assert;function d(e,a){this.ec=e,this.priv=null,this.pub=null,a.priv&&this._importPrivate(a.priv,a.privEnc),a.pub&&this._importPublic(a.pub,a.pubEnc)}e.exports=d,d.fromPublic=function(e,a,t){return a instanceof d?a:new d(e,{pub:a,pubEnc:t})},d.fromPrivate=function(e,a,t){return a instanceof d?a:new d(e,{priv:a,privEnc:t})},d.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},d.prototype.getPublic=function(e,a){return"string"==typeof e&&(a=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),a?this.pub.encode(a,e):this.pub},d.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},d.prototype._importPrivate=function(e,a){this.priv=new c(e,a||16),this.priv=this.priv.umod(this.ec.curve.n)},d.prototype._importPublic=function(e,a){if(e.x||e.y)return"mont"===this.ec.curve.type?f(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||f(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,a)},d.prototype.derive=function(e){return e.validate()||f(e.validate(),"public point not validated"),e.mul(this.priv).getX()},d.prototype.sign=function(e,a,t){return this.ec.sign(e,this,a,t)},d.prototype.verify=function(e,a){return this.ec.verify(e,a,this)},d.prototype.inspect=function(){return""}},28545:(e,a,t)=>{"use strict";var c=t(28490),f=t(47011),d=f.assert;function r(e,a){if(e instanceof r)return e;this._importDER(e,a)||(d(e.r&&e.s,"Signature without r or s"),this.r=new c(e.r,16),this.s=new c(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function n(){this.place=0}function i(e,a){var t=e[a.place++];if(!(128&t))return t;var c=15&t;if(0===c||c>4)return!1;if(0===e[a.place])return!1;for(var f=0,d=0,r=a.place;d>>=0;return!(f<=127)&&(a.place=r,f)}function b(e){for(var a=0,t=e.length-1;!e[a]&&!(128&e[a+1])&&a>>3);for(e.push(128|t);--t;)e.push(a>>>(t<<3)&255);e.push(a)}}e.exports=r,r.prototype._importDER=function(e,a){e=f.toArray(e,a);var t=new n;if(48!==e[t.place++])return!1;var d=i(e,t);if(!1===d)return!1;if(d+t.place!==e.length)return!1;if(2!==e[t.place++])return!1;var r=i(e,t);if(!1===r)return!1;if(128&e[t.place])return!1;var b=e.slice(t.place,r+t.place);if(t.place+=r,2!==e[t.place++])return!1;var o=i(e,t);if(!1===o)return!1;if(e.length!==o+t.place)return!1;if(128&e[t.place])return!1;var s=e.slice(t.place,o+t.place);if(0===b[0]){if(!(128&b[1]))return!1;b=b.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new c(b),this.s=new c(s),this.recoveryParam=null,!0},r.prototype.toDER=function(e){var a=this.r.toArray(),t=this.s.toArray();for(128&a[0]&&(a=[0].concat(a)),128&t[0]&&(t=[0].concat(t)),a=b(a),t=b(t);!(t[0]||128&t[1]);)t=t.slice(1);var c=[2];o(c,a.length),(c=c.concat(a)).push(2),o(c,t.length);var d=c.concat(t),r=[48];return o(r,d.length),r=r.concat(d),f.encode(r,e)}},8650:(e,a,t)=>{"use strict";var c=t(77952),f=t(60480),d=t(47011),r=d.assert,n=d.parseBytes,i=t(46661),b=t(90220);function o(e){if(r("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof o))return new o(e);e=f[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=c.sha512}e.exports=o,o.prototype.sign=function(e,a){e=n(e);var t=this.keyFromSecret(a),c=this.hashInt(t.messagePrefix(),e),f=this.g.mul(c),d=this.encodePoint(f),r=this.hashInt(d,t.pubBytes(),e).mul(t.priv()),i=c.add(r).umod(this.curve.n);return this.makeSignature({R:f,S:i,Rencoded:d})},o.prototype.verify=function(e,a,t){if(e=n(e),(a=this.makeSignature(a)).S().gte(a.eddsa.curve.n)||a.S().isNeg())return!1;var c=this.keyFromPublic(t),f=this.hashInt(a.Rencoded(),c.pubBytes(),e),d=this.g.mul(a.S());return a.R().add(c.pub().mul(f)).eq(d)},o.prototype.hashInt=function(){for(var e=this.hash(),a=0;a{"use strict";var c=t(47011),f=c.assert,d=c.parseBytes,r=c.cachedProperty;function n(e,a){this.eddsa=e,this._secret=d(a.secret),e.isPoint(a.pub)?this._pub=a.pub:this._pubBytes=d(a.pub)}n.fromPublic=function(e,a){return a instanceof n?a:new n(e,{pub:a})},n.fromSecret=function(e,a){return a instanceof n?a:new n(e,{secret:a})},n.prototype.secret=function(){return this._secret},r(n,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),r(n,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),r(n,"privBytes",(function(){var e=this.eddsa,a=this.hash(),t=e.encodingLength-1,c=a.slice(0,e.encodingLength);return c[0]&=248,c[t]&=127,c[t]|=64,c})),r(n,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),r(n,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),r(n,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),n.prototype.sign=function(e){return f(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},n.prototype.verify=function(e,a){return this.eddsa.verify(e,a,this)},n.prototype.getSecret=function(e){return f(this._secret,"KeyPair is public only"),c.encode(this.secret(),e)},n.prototype.getPublic=function(e){return c.encode(this.pubBytes(),e)},e.exports=n},90220:(e,a,t)=>{"use strict";var c=t(28490),f=t(47011),d=f.assert,r=f.cachedProperty,n=f.parseBytes;function i(e,a){this.eddsa=e,"object"!=typeof a&&(a=n(a)),Array.isArray(a)&&(d(a.length===2*e.encodingLength,"Signature has invalid size"),a={R:a.slice(0,e.encodingLength),S:a.slice(e.encodingLength)}),d(a.R&&a.S,"Signature without R or S"),e.isPoint(a.R)&&(this._R=a.R),a.S instanceof c&&(this._S=a.S),this._Rencoded=Array.isArray(a.R)?a.R:a.Rencoded,this._Sencoded=Array.isArray(a.S)?a.S:a.Sencoded}r(i,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),r(i,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),r(i,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),r(i,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),i.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},i.prototype.toHex=function(){return f.encode(this.toBytes(),"hex").toUpperCase()},e.exports=i},74011:e=>{e.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"]]}}},47011:(e,a,t)=>{"use strict";var c=a,f=t(28490),d=t(43349),r=t(64367);c.assert=d,c.toArray=r.toArray,c.zero2=r.zero2,c.toHex=r.toHex,c.encode=r.encode,c.getNAF=function(e,a,t){var c,f=new Array(Math.max(e.bitLength(),t)+1);for(c=0;c(d>>1)-1?(d>>1)-i:i,r.isubn(n)):n=0,f[c]=n,r.iushrn(1)}return f},c.getJSF=function(e,a){var t=[[],[]];e=e.clone(),a=a.clone();for(var c,f=0,d=0;e.cmpn(-f)>0||a.cmpn(-d)>0;){var r,n,i=e.andln(3)+f&3,b=a.andln(3)+d&3;3===i&&(i=-1),3===b&&(b=-1),r=1&i?3!=(c=e.andln(7)+f&7)&&5!==c||2!==b?i:-i:0,t[0].push(r),n=1&b?3!=(c=a.andln(7)+d&7)&&5!==c||2!==i?b:-b:0,t[1].push(n),2*f===r+1&&(f=1-f),2*d===n+1&&(d=1-d),e.iushrn(1),a.iushrn(1)}return t},c.cachedProperty=function(e,a,t){var c="_"+a;e.prototype[a]=function(){return void 0!==this[c]?this[c]:this[c]=t.call(this)}},c.parseBytes=function(e){return"string"==typeof e?c.toArray(e,"hex"):e},c.intFromLE=function(e){return new f(e,"hex","le")}},28490:function(e,a,t){!function(e,a){"use strict";function c(e,a){if(!e)throw new Error(a||"Assertion failed")}function f(e,a){e.super_=a;var t=function(){};t.prototype=a.prototype,e.prototype=new t,e.prototype.constructor=e}function d(e,a,t){if(d.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==a&&"be"!==a||(t=a,a=10),this._init(e||0,a||10,t||"be"))}var r;"object"==typeof e?e.exports=d:a.BN=d,d.BN=d,d.wordSize=26;try{r="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:t(79368).Buffer}catch(e){}function n(e,a){var t=e.charCodeAt(a);return t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:t-48&15}function i(e,a,t){var c=n(e,t);return t-1>=a&&(c|=n(e,t-1)<<4),c}function b(e,a,t,c){for(var f=0,d=Math.min(e.length,t),r=a;r=49?n-49+10:n>=17?n-17+10:n}return f}d.isBN=function(e){return e instanceof d||null!==e&&"object"==typeof e&&e.constructor.wordSize===d.wordSize&&Array.isArray(e.words)},d.max=function(e,a){return e.cmp(a)>0?e:a},d.min=function(e,a){return e.cmp(a)<0?e:a},d.prototype._init=function(e,a,t){if("number"==typeof e)return this._initNumber(e,a,t);if("object"==typeof e)return this._initArray(e,a,t);"hex"===a&&(a=16),c(a===(0|a)&&a>=2&&a<=36);var f=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(f++,this.negative=1),f=0;f-=3)r=e[f]|e[f-1]<<8|e[f-2]<<16,this.words[d]|=r<>>26-n&67108863,(n+=24)>=26&&(n-=26,d++);else if("le"===t)for(f=0,d=0;f>>26-n&67108863,(n+=24)>=26&&(n-=26,d++);return this.strip()},d.prototype._parseHex=function(e,a,t){this.length=Math.ceil((e.length-a)/6),this.words=new Array(this.length);for(var c=0;c=a;c-=2)f=i(e,a,c)<=18?(d-=18,r+=1,this.words[r]|=f>>>26):d+=8;else for(c=(e.length-a)%2==0?a+1:a;c=18?(d-=18,r+=1,this.words[r]|=f>>>26):d+=8;this.strip()},d.prototype._parseBase=function(e,a,t){this.words=[0],this.length=1;for(var c=0,f=1;f<=67108863;f*=a)c++;c--,f=f/a|0;for(var d=e.length-t,r=d%c,n=Math.min(d,d-r)+t,i=0,o=t;o1&&0===this.words[this.length-1];)this.length--;return this._normSign()},d.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},d.prototype.inspect=function(){return(this.red?""};var o=["","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"],s=[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],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function u(e,a,t){t.negative=a.negative^e.negative;var c=e.length+a.length|0;t.length=c,c=c-1|0;var f=0|e.words[0],d=0|a.words[0],r=f*d,n=67108863&r,i=r/67108864|0;t.words[0]=n;for(var b=1;b>>26,s=67108863&i,l=Math.min(b,a.length-1),u=Math.max(0,b-e.length+1);u<=l;u++){var h=b-u|0;o+=(r=(f=0|e.words[h])*(d=0|a.words[u])+s)/67108864|0,s=67108863&r}t.words[b]=0|s,i=0|o}return 0!==i?t.words[b]=0|i:t.length--,t.strip()}d.prototype.toString=function(e,a){var t;if(a=0|a||1,16===(e=e||10)||"hex"===e){t="";for(var f=0,d=0,r=0;r>>24-f&16777215)||r!==this.length-1?o[6-i.length]+i+t:i+t,(f+=2)>=26&&(f-=26,r--)}for(0!==d&&(t=d.toString(16)+t);t.length%a!=0;)t="0"+t;return 0!==this.negative&&(t="-"+t),t}if(e===(0|e)&&e>=2&&e<=36){var b=s[e],u=l[e];t="";var h=this.clone();for(h.negative=0;!h.isZero();){var p=h.modn(u).toString(e);t=(h=h.idivn(u)).isZero()?p+t:o[b-p.length]+p+t}for(this.isZero()&&(t="0"+t);t.length%a!=0;)t="0"+t;return 0!==this.negative&&(t="-"+t),t}c(!1,"Base should be between 2 and 36")},d.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&c(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},d.prototype.toJSON=function(){return this.toString(16)},d.prototype.toBuffer=function(e,a){return c(void 0!==r),this.toArrayLike(r,e,a)},d.prototype.toArray=function(e,a){return this.toArrayLike(Array,e,a)},d.prototype.toArrayLike=function(e,a,t){var f=this.byteLength(),d=t||Math.max(1,f);c(f<=d,"byte array longer than desired length"),c(d>0,"Requested array length <= 0"),this.strip();var r,n,i="le"===a,b=new e(d),o=this.clone();if(i){for(n=0;!o.isZero();n++)r=o.andln(255),o.iushrn(8),b[n]=r;for(;n=4096&&(t+=13,a>>>=13),a>=64&&(t+=7,a>>>=7),a>=8&&(t+=4,a>>>=4),a>=2&&(t+=2,a>>>=2),t+a},d.prototype._zeroBits=function(e){if(0===e)return 26;var a=e,t=0;return 8191&a||(t+=13,a>>>=13),127&a||(t+=7,a>>>=7),15&a||(t+=4,a>>>=4),3&a||(t+=2,a>>>=2),1&a||t++,t},d.prototype.bitLength=function(){var e=this.words[this.length-1],a=this._countBits(e);return 26*(this.length-1)+a},d.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,a=0;ae.length?this.clone().ior(e):e.clone().ior(this)},d.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},d.prototype.iuand=function(e){var a;a=this.length>e.length?e:this;for(var t=0;te.length?this.clone().iand(e):e.clone().iand(this)},d.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},d.prototype.iuxor=function(e){var a,t;this.length>e.length?(a=this,t=e):(a=e,t=this);for(var c=0;ce.length?this.clone().ixor(e):e.clone().ixor(this)},d.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},d.prototype.inotn=function(e){c("number"==typeof e&&e>=0);var a=0|Math.ceil(e/26),t=e%26;this._expand(a),t>0&&a--;for(var f=0;f0&&(this.words[f]=~this.words[f]&67108863>>26-t),this.strip()},d.prototype.notn=function(e){return this.clone().inotn(e)},d.prototype.setn=function(e,a){c("number"==typeof e&&e>=0);var t=e/26|0,f=e%26;return this._expand(t+1),this.words[t]=a?this.words[t]|1<e.length?(t=this,c=e):(t=e,c=this);for(var f=0,d=0;d>>26;for(;0!==f&&d>>26;if(this.length=t.length,0!==f)this.words[this.length]=f,this.length++;else if(t!==this)for(;de.length?this.clone().iadd(e):e.clone().iadd(this)},d.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var a=this.iadd(e);return e.negative=1,a._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var t,c,f=this.cmp(e);if(0===f)return this.negative=0,this.length=1,this.words[0]=0,this;f>0?(t=this,c=e):(t=e,c=this);for(var d=0,r=0;r>26,this.words[r]=67108863&a;for(;0!==d&&r>26,this.words[r]=67108863&a;if(0===d&&r>>13,u=0|r[1],h=8191&u,p=u>>>13,g=0|r[2],m=8191&g,x=g>>>13,y=0|r[3],A=8191&y,v=y>>>13,w=0|r[4],_=8191&w,I=w>>>13,E=0|r[5],C=8191&E,M=E>>>13,B=0|r[6],k=8191&B,L=B>>>13,S=0|r[7],T=8191&S,N=S>>>13,R=0|r[8],P=8191&R,D=R>>>13,O=0|r[9],F=8191&O,Q=O>>>13,U=0|n[0],j=8191&U,H=U>>>13,q=0|n[1],$=8191&q,z=q>>>13,G=0|n[2],K=8191&G,V=G>>>13,Z=0|n[3],J=8191&Z,W=Z>>>13,Y=0|n[4],X=8191&Y,ee=Y>>>13,ae=0|n[5],te=8191&ae,ce=ae>>>13,fe=0|n[6],de=8191&fe,re=fe>>>13,ne=0|n[7],ie=8191&ne,be=ne>>>13,oe=0|n[8],se=8191&oe,le=oe>>>13,ue=0|n[9],he=8191&ue,pe=ue>>>13;t.negative=e.negative^a.negative,t.length=19;var ge=(b+(c=Math.imul(s,j))|0)+((8191&(f=(f=Math.imul(s,H))+Math.imul(l,j)|0))<<13)|0;b=((d=Math.imul(l,H))+(f>>>13)|0)+(ge>>>26)|0,ge&=67108863,c=Math.imul(h,j),f=(f=Math.imul(h,H))+Math.imul(p,j)|0,d=Math.imul(p,H);var me=(b+(c=c+Math.imul(s,$)|0)|0)+((8191&(f=(f=f+Math.imul(s,z)|0)+Math.imul(l,$)|0))<<13)|0;b=((d=d+Math.imul(l,z)|0)+(f>>>13)|0)+(me>>>26)|0,me&=67108863,c=Math.imul(m,j),f=(f=Math.imul(m,H))+Math.imul(x,j)|0,d=Math.imul(x,H),c=c+Math.imul(h,$)|0,f=(f=f+Math.imul(h,z)|0)+Math.imul(p,$)|0,d=d+Math.imul(p,z)|0;var xe=(b+(c=c+Math.imul(s,K)|0)|0)+((8191&(f=(f=f+Math.imul(s,V)|0)+Math.imul(l,K)|0))<<13)|0;b=((d=d+Math.imul(l,V)|0)+(f>>>13)|0)+(xe>>>26)|0,xe&=67108863,c=Math.imul(A,j),f=(f=Math.imul(A,H))+Math.imul(v,j)|0,d=Math.imul(v,H),c=c+Math.imul(m,$)|0,f=(f=f+Math.imul(m,z)|0)+Math.imul(x,$)|0,d=d+Math.imul(x,z)|0,c=c+Math.imul(h,K)|0,f=(f=f+Math.imul(h,V)|0)+Math.imul(p,K)|0,d=d+Math.imul(p,V)|0;var ye=(b+(c=c+Math.imul(s,J)|0)|0)+((8191&(f=(f=f+Math.imul(s,W)|0)+Math.imul(l,J)|0))<<13)|0;b=((d=d+Math.imul(l,W)|0)+(f>>>13)|0)+(ye>>>26)|0,ye&=67108863,c=Math.imul(_,j),f=(f=Math.imul(_,H))+Math.imul(I,j)|0,d=Math.imul(I,H),c=c+Math.imul(A,$)|0,f=(f=f+Math.imul(A,z)|0)+Math.imul(v,$)|0,d=d+Math.imul(v,z)|0,c=c+Math.imul(m,K)|0,f=(f=f+Math.imul(m,V)|0)+Math.imul(x,K)|0,d=d+Math.imul(x,V)|0,c=c+Math.imul(h,J)|0,f=(f=f+Math.imul(h,W)|0)+Math.imul(p,J)|0,d=d+Math.imul(p,W)|0;var Ae=(b+(c=c+Math.imul(s,X)|0)|0)+((8191&(f=(f=f+Math.imul(s,ee)|0)+Math.imul(l,X)|0))<<13)|0;b=((d=d+Math.imul(l,ee)|0)+(f>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,c=Math.imul(C,j),f=(f=Math.imul(C,H))+Math.imul(M,j)|0,d=Math.imul(M,H),c=c+Math.imul(_,$)|0,f=(f=f+Math.imul(_,z)|0)+Math.imul(I,$)|0,d=d+Math.imul(I,z)|0,c=c+Math.imul(A,K)|0,f=(f=f+Math.imul(A,V)|0)+Math.imul(v,K)|0,d=d+Math.imul(v,V)|0,c=c+Math.imul(m,J)|0,f=(f=f+Math.imul(m,W)|0)+Math.imul(x,J)|0,d=d+Math.imul(x,W)|0,c=c+Math.imul(h,X)|0,f=(f=f+Math.imul(h,ee)|0)+Math.imul(p,X)|0,d=d+Math.imul(p,ee)|0;var ve=(b+(c=c+Math.imul(s,te)|0)|0)+((8191&(f=(f=f+Math.imul(s,ce)|0)+Math.imul(l,te)|0))<<13)|0;b=((d=d+Math.imul(l,ce)|0)+(f>>>13)|0)+(ve>>>26)|0,ve&=67108863,c=Math.imul(k,j),f=(f=Math.imul(k,H))+Math.imul(L,j)|0,d=Math.imul(L,H),c=c+Math.imul(C,$)|0,f=(f=f+Math.imul(C,z)|0)+Math.imul(M,$)|0,d=d+Math.imul(M,z)|0,c=c+Math.imul(_,K)|0,f=(f=f+Math.imul(_,V)|0)+Math.imul(I,K)|0,d=d+Math.imul(I,V)|0,c=c+Math.imul(A,J)|0,f=(f=f+Math.imul(A,W)|0)+Math.imul(v,J)|0,d=d+Math.imul(v,W)|0,c=c+Math.imul(m,X)|0,f=(f=f+Math.imul(m,ee)|0)+Math.imul(x,X)|0,d=d+Math.imul(x,ee)|0,c=c+Math.imul(h,te)|0,f=(f=f+Math.imul(h,ce)|0)+Math.imul(p,te)|0,d=d+Math.imul(p,ce)|0;var we=(b+(c=c+Math.imul(s,de)|0)|0)+((8191&(f=(f=f+Math.imul(s,re)|0)+Math.imul(l,de)|0))<<13)|0;b=((d=d+Math.imul(l,re)|0)+(f>>>13)|0)+(we>>>26)|0,we&=67108863,c=Math.imul(T,j),f=(f=Math.imul(T,H))+Math.imul(N,j)|0,d=Math.imul(N,H),c=c+Math.imul(k,$)|0,f=(f=f+Math.imul(k,z)|0)+Math.imul(L,$)|0,d=d+Math.imul(L,z)|0,c=c+Math.imul(C,K)|0,f=(f=f+Math.imul(C,V)|0)+Math.imul(M,K)|0,d=d+Math.imul(M,V)|0,c=c+Math.imul(_,J)|0,f=(f=f+Math.imul(_,W)|0)+Math.imul(I,J)|0,d=d+Math.imul(I,W)|0,c=c+Math.imul(A,X)|0,f=(f=f+Math.imul(A,ee)|0)+Math.imul(v,X)|0,d=d+Math.imul(v,ee)|0,c=c+Math.imul(m,te)|0,f=(f=f+Math.imul(m,ce)|0)+Math.imul(x,te)|0,d=d+Math.imul(x,ce)|0,c=c+Math.imul(h,de)|0,f=(f=f+Math.imul(h,re)|0)+Math.imul(p,de)|0,d=d+Math.imul(p,re)|0;var _e=(b+(c=c+Math.imul(s,ie)|0)|0)+((8191&(f=(f=f+Math.imul(s,be)|0)+Math.imul(l,ie)|0))<<13)|0;b=((d=d+Math.imul(l,be)|0)+(f>>>13)|0)+(_e>>>26)|0,_e&=67108863,c=Math.imul(P,j),f=(f=Math.imul(P,H))+Math.imul(D,j)|0,d=Math.imul(D,H),c=c+Math.imul(T,$)|0,f=(f=f+Math.imul(T,z)|0)+Math.imul(N,$)|0,d=d+Math.imul(N,z)|0,c=c+Math.imul(k,K)|0,f=(f=f+Math.imul(k,V)|0)+Math.imul(L,K)|0,d=d+Math.imul(L,V)|0,c=c+Math.imul(C,J)|0,f=(f=f+Math.imul(C,W)|0)+Math.imul(M,J)|0,d=d+Math.imul(M,W)|0,c=c+Math.imul(_,X)|0,f=(f=f+Math.imul(_,ee)|0)+Math.imul(I,X)|0,d=d+Math.imul(I,ee)|0,c=c+Math.imul(A,te)|0,f=(f=f+Math.imul(A,ce)|0)+Math.imul(v,te)|0,d=d+Math.imul(v,ce)|0,c=c+Math.imul(m,de)|0,f=(f=f+Math.imul(m,re)|0)+Math.imul(x,de)|0,d=d+Math.imul(x,re)|0,c=c+Math.imul(h,ie)|0,f=(f=f+Math.imul(h,be)|0)+Math.imul(p,ie)|0,d=d+Math.imul(p,be)|0;var Ie=(b+(c=c+Math.imul(s,se)|0)|0)+((8191&(f=(f=f+Math.imul(s,le)|0)+Math.imul(l,se)|0))<<13)|0;b=((d=d+Math.imul(l,le)|0)+(f>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,c=Math.imul(F,j),f=(f=Math.imul(F,H))+Math.imul(Q,j)|0,d=Math.imul(Q,H),c=c+Math.imul(P,$)|0,f=(f=f+Math.imul(P,z)|0)+Math.imul(D,$)|0,d=d+Math.imul(D,z)|0,c=c+Math.imul(T,K)|0,f=(f=f+Math.imul(T,V)|0)+Math.imul(N,K)|0,d=d+Math.imul(N,V)|0,c=c+Math.imul(k,J)|0,f=(f=f+Math.imul(k,W)|0)+Math.imul(L,J)|0,d=d+Math.imul(L,W)|0,c=c+Math.imul(C,X)|0,f=(f=f+Math.imul(C,ee)|0)+Math.imul(M,X)|0,d=d+Math.imul(M,ee)|0,c=c+Math.imul(_,te)|0,f=(f=f+Math.imul(_,ce)|0)+Math.imul(I,te)|0,d=d+Math.imul(I,ce)|0,c=c+Math.imul(A,de)|0,f=(f=f+Math.imul(A,re)|0)+Math.imul(v,de)|0,d=d+Math.imul(v,re)|0,c=c+Math.imul(m,ie)|0,f=(f=f+Math.imul(m,be)|0)+Math.imul(x,ie)|0,d=d+Math.imul(x,be)|0,c=c+Math.imul(h,se)|0,f=(f=f+Math.imul(h,le)|0)+Math.imul(p,se)|0,d=d+Math.imul(p,le)|0;var Ee=(b+(c=c+Math.imul(s,he)|0)|0)+((8191&(f=(f=f+Math.imul(s,pe)|0)+Math.imul(l,he)|0))<<13)|0;b=((d=d+Math.imul(l,pe)|0)+(f>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,c=Math.imul(F,$),f=(f=Math.imul(F,z))+Math.imul(Q,$)|0,d=Math.imul(Q,z),c=c+Math.imul(P,K)|0,f=(f=f+Math.imul(P,V)|0)+Math.imul(D,K)|0,d=d+Math.imul(D,V)|0,c=c+Math.imul(T,J)|0,f=(f=f+Math.imul(T,W)|0)+Math.imul(N,J)|0,d=d+Math.imul(N,W)|0,c=c+Math.imul(k,X)|0,f=(f=f+Math.imul(k,ee)|0)+Math.imul(L,X)|0,d=d+Math.imul(L,ee)|0,c=c+Math.imul(C,te)|0,f=(f=f+Math.imul(C,ce)|0)+Math.imul(M,te)|0,d=d+Math.imul(M,ce)|0,c=c+Math.imul(_,de)|0,f=(f=f+Math.imul(_,re)|0)+Math.imul(I,de)|0,d=d+Math.imul(I,re)|0,c=c+Math.imul(A,ie)|0,f=(f=f+Math.imul(A,be)|0)+Math.imul(v,ie)|0,d=d+Math.imul(v,be)|0,c=c+Math.imul(m,se)|0,f=(f=f+Math.imul(m,le)|0)+Math.imul(x,se)|0,d=d+Math.imul(x,le)|0;var Ce=(b+(c=c+Math.imul(h,he)|0)|0)+((8191&(f=(f=f+Math.imul(h,pe)|0)+Math.imul(p,he)|0))<<13)|0;b=((d=d+Math.imul(p,pe)|0)+(f>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,c=Math.imul(F,K),f=(f=Math.imul(F,V))+Math.imul(Q,K)|0,d=Math.imul(Q,V),c=c+Math.imul(P,J)|0,f=(f=f+Math.imul(P,W)|0)+Math.imul(D,J)|0,d=d+Math.imul(D,W)|0,c=c+Math.imul(T,X)|0,f=(f=f+Math.imul(T,ee)|0)+Math.imul(N,X)|0,d=d+Math.imul(N,ee)|0,c=c+Math.imul(k,te)|0,f=(f=f+Math.imul(k,ce)|0)+Math.imul(L,te)|0,d=d+Math.imul(L,ce)|0,c=c+Math.imul(C,de)|0,f=(f=f+Math.imul(C,re)|0)+Math.imul(M,de)|0,d=d+Math.imul(M,re)|0,c=c+Math.imul(_,ie)|0,f=(f=f+Math.imul(_,be)|0)+Math.imul(I,ie)|0,d=d+Math.imul(I,be)|0,c=c+Math.imul(A,se)|0,f=(f=f+Math.imul(A,le)|0)+Math.imul(v,se)|0,d=d+Math.imul(v,le)|0;var Me=(b+(c=c+Math.imul(m,he)|0)|0)+((8191&(f=(f=f+Math.imul(m,pe)|0)+Math.imul(x,he)|0))<<13)|0;b=((d=d+Math.imul(x,pe)|0)+(f>>>13)|0)+(Me>>>26)|0,Me&=67108863,c=Math.imul(F,J),f=(f=Math.imul(F,W))+Math.imul(Q,J)|0,d=Math.imul(Q,W),c=c+Math.imul(P,X)|0,f=(f=f+Math.imul(P,ee)|0)+Math.imul(D,X)|0,d=d+Math.imul(D,ee)|0,c=c+Math.imul(T,te)|0,f=(f=f+Math.imul(T,ce)|0)+Math.imul(N,te)|0,d=d+Math.imul(N,ce)|0,c=c+Math.imul(k,de)|0,f=(f=f+Math.imul(k,re)|0)+Math.imul(L,de)|0,d=d+Math.imul(L,re)|0,c=c+Math.imul(C,ie)|0,f=(f=f+Math.imul(C,be)|0)+Math.imul(M,ie)|0,d=d+Math.imul(M,be)|0,c=c+Math.imul(_,se)|0,f=(f=f+Math.imul(_,le)|0)+Math.imul(I,se)|0,d=d+Math.imul(I,le)|0;var Be=(b+(c=c+Math.imul(A,he)|0)|0)+((8191&(f=(f=f+Math.imul(A,pe)|0)+Math.imul(v,he)|0))<<13)|0;b=((d=d+Math.imul(v,pe)|0)+(f>>>13)|0)+(Be>>>26)|0,Be&=67108863,c=Math.imul(F,X),f=(f=Math.imul(F,ee))+Math.imul(Q,X)|0,d=Math.imul(Q,ee),c=c+Math.imul(P,te)|0,f=(f=f+Math.imul(P,ce)|0)+Math.imul(D,te)|0,d=d+Math.imul(D,ce)|0,c=c+Math.imul(T,de)|0,f=(f=f+Math.imul(T,re)|0)+Math.imul(N,de)|0,d=d+Math.imul(N,re)|0,c=c+Math.imul(k,ie)|0,f=(f=f+Math.imul(k,be)|0)+Math.imul(L,ie)|0,d=d+Math.imul(L,be)|0,c=c+Math.imul(C,se)|0,f=(f=f+Math.imul(C,le)|0)+Math.imul(M,se)|0,d=d+Math.imul(M,le)|0;var ke=(b+(c=c+Math.imul(_,he)|0)|0)+((8191&(f=(f=f+Math.imul(_,pe)|0)+Math.imul(I,he)|0))<<13)|0;b=((d=d+Math.imul(I,pe)|0)+(f>>>13)|0)+(ke>>>26)|0,ke&=67108863,c=Math.imul(F,te),f=(f=Math.imul(F,ce))+Math.imul(Q,te)|0,d=Math.imul(Q,ce),c=c+Math.imul(P,de)|0,f=(f=f+Math.imul(P,re)|0)+Math.imul(D,de)|0,d=d+Math.imul(D,re)|0,c=c+Math.imul(T,ie)|0,f=(f=f+Math.imul(T,be)|0)+Math.imul(N,ie)|0,d=d+Math.imul(N,be)|0,c=c+Math.imul(k,se)|0,f=(f=f+Math.imul(k,le)|0)+Math.imul(L,se)|0,d=d+Math.imul(L,le)|0;var Le=(b+(c=c+Math.imul(C,he)|0)|0)+((8191&(f=(f=f+Math.imul(C,pe)|0)+Math.imul(M,he)|0))<<13)|0;b=((d=d+Math.imul(M,pe)|0)+(f>>>13)|0)+(Le>>>26)|0,Le&=67108863,c=Math.imul(F,de),f=(f=Math.imul(F,re))+Math.imul(Q,de)|0,d=Math.imul(Q,re),c=c+Math.imul(P,ie)|0,f=(f=f+Math.imul(P,be)|0)+Math.imul(D,ie)|0,d=d+Math.imul(D,be)|0,c=c+Math.imul(T,se)|0,f=(f=f+Math.imul(T,le)|0)+Math.imul(N,se)|0,d=d+Math.imul(N,le)|0;var Se=(b+(c=c+Math.imul(k,he)|0)|0)+((8191&(f=(f=f+Math.imul(k,pe)|0)+Math.imul(L,he)|0))<<13)|0;b=((d=d+Math.imul(L,pe)|0)+(f>>>13)|0)+(Se>>>26)|0,Se&=67108863,c=Math.imul(F,ie),f=(f=Math.imul(F,be))+Math.imul(Q,ie)|0,d=Math.imul(Q,be),c=c+Math.imul(P,se)|0,f=(f=f+Math.imul(P,le)|0)+Math.imul(D,se)|0,d=d+Math.imul(D,le)|0;var Te=(b+(c=c+Math.imul(T,he)|0)|0)+((8191&(f=(f=f+Math.imul(T,pe)|0)+Math.imul(N,he)|0))<<13)|0;b=((d=d+Math.imul(N,pe)|0)+(f>>>13)|0)+(Te>>>26)|0,Te&=67108863,c=Math.imul(F,se),f=(f=Math.imul(F,le))+Math.imul(Q,se)|0,d=Math.imul(Q,le);var Ne=(b+(c=c+Math.imul(P,he)|0)|0)+((8191&(f=(f=f+Math.imul(P,pe)|0)+Math.imul(D,he)|0))<<13)|0;b=((d=d+Math.imul(D,pe)|0)+(f>>>13)|0)+(Ne>>>26)|0,Ne&=67108863;var Re=(b+(c=Math.imul(F,he))|0)+((8191&(f=(f=Math.imul(F,pe))+Math.imul(Q,he)|0))<<13)|0;return b=((d=Math.imul(Q,pe))+(f>>>13)|0)+(Re>>>26)|0,Re&=67108863,i[0]=ge,i[1]=me,i[2]=xe,i[3]=ye,i[4]=Ae,i[5]=ve,i[6]=we,i[7]=_e,i[8]=Ie,i[9]=Ee,i[10]=Ce,i[11]=Me,i[12]=Be,i[13]=ke,i[14]=Le,i[15]=Se,i[16]=Te,i[17]=Ne,i[18]=Re,0!==b&&(i[19]=b,t.length++),t};function p(e,a,t){return(new g).mulp(e,a,t)}function g(e,a){this.x=e,this.y=a}Math.imul||(h=u),d.prototype.mulTo=function(e,a){var t,c=this.length+e.length;return t=10===this.length&&10===e.length?h(this,e,a):c<63?u(this,e,a):c<1024?function(e,a,t){t.negative=a.negative^e.negative,t.length=e.length+a.length;for(var c=0,f=0,d=0;d>>26)|0)>>>26,r&=67108863}t.words[d]=n,c=r,r=f}return 0!==c?t.words[d]=c:t.length--,t.strip()}(this,e,a):p(this,e,a),t},g.prototype.makeRBT=function(e){for(var a=new Array(e),t=d.prototype._countBits(e)-1,c=0;c>=1;return c},g.prototype.permute=function(e,a,t,c,f,d){for(var r=0;r>>=1)f++;return 1<>>=13,t[2*r+1]=8191&d,d>>>=13;for(r=2*a;r>=26,a+=f/67108864|0,a+=d>>>26,this.words[t]=67108863&d}return 0!==a&&(this.words[t]=a,this.length++),this},d.prototype.muln=function(e){return this.clone().imuln(e)},d.prototype.sqr=function(){return this.mul(this)},d.prototype.isqr=function(){return this.imul(this.clone())},d.prototype.pow=function(e){var a=function(e){for(var a=new Array(e.bitLength()),t=0;t>>f}return a}(e);if(0===a.length)return new d(1);for(var t=this,c=0;c=0);var a,t=e%26,f=(e-t)/26,d=67108863>>>26-t<<26-t;if(0!==t){var r=0;for(a=0;a>>26-t}r&&(this.words[a]=r,this.length++)}if(0!==f){for(a=this.length-1;a>=0;a--)this.words[a+f]=this.words[a];for(a=0;a=0),f=a?(a-a%26)/26:0;var d=e%26,r=Math.min((e-d)/26,this.length),n=67108863^67108863>>>d<r)for(this.length-=r,b=0;b=0&&(0!==o||b>=f);b--){var s=0|this.words[b];this.words[b]=o<<26-d|s>>>d,o=s&n}return i&&0!==o&&(i.words[i.length++]=o),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},d.prototype.ishrn=function(e,a,t){return c(0===this.negative),this.iushrn(e,a,t)},d.prototype.shln=function(e){return this.clone().ishln(e)},d.prototype.ushln=function(e){return this.clone().iushln(e)},d.prototype.shrn=function(e){return this.clone().ishrn(e)},d.prototype.ushrn=function(e){return this.clone().iushrn(e)},d.prototype.testn=function(e){c("number"==typeof e&&e>=0);var a=e%26,t=(e-a)/26,f=1<=0);var a=e%26,t=(e-a)/26;if(c(0===this.negative,"imaskn works only with positive numbers"),this.length<=t)return this;if(0!==a&&t++,this.length=Math.min(t,this.length),0!==a){var f=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},d.prototype.isubn=function(e){if(c("number"==typeof e),c(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(i/67108864|0),this.words[f+t]=67108863&d}for(;f>26,this.words[f+t]=67108863&d;if(0===n)return this.strip();for(c(-1===n),n=0,f=0;f>26,this.words[f]=67108863&d;return this.negative=1,this.strip()},d.prototype._wordDiv=function(e,a){var t=(this.length,e.length),c=this.clone(),f=e,r=0|f.words[f.length-1];0!=(t=26-this._countBits(r))&&(f=f.ushln(t),c.iushln(t),r=0|f.words[f.length-1]);var n,i=c.length-f.length;if("mod"!==a){(n=new d(null)).length=i+1,n.words=new Array(n.length);for(var b=0;b=0;s--){var l=67108864*(0|c.words[f.length+s])+(0|c.words[f.length+s-1]);for(l=Math.min(l/r|0,67108863),c._ishlnsubmul(f,l,s);0!==c.negative;)l--,c.negative=0,c._ishlnsubmul(f,1,s),c.isZero()||(c.negative^=1);n&&(n.words[s]=l)}return n&&n.strip(),c.strip(),"div"!==a&&0!==t&&c.iushrn(t),{div:n||null,mod:c}},d.prototype.divmod=function(e,a,t){return c(!e.isZero()),this.isZero()?{div:new d(0),mod:new d(0)}:0!==this.negative&&0===e.negative?(n=this.neg().divmod(e,a),"mod"!==a&&(f=n.div.neg()),"div"!==a&&(r=n.mod.neg(),t&&0!==r.negative&&r.iadd(e)),{div:f,mod:r}):0===this.negative&&0!==e.negative?(n=this.divmod(e.neg(),a),"mod"!==a&&(f=n.div.neg()),{div:f,mod:n.mod}):this.negative&e.negative?(n=this.neg().divmod(e.neg(),a),"div"!==a&&(r=n.mod.neg(),t&&0!==r.negative&&r.isub(e)),{div:n.div,mod:r}):e.length>this.length||this.cmp(e)<0?{div:new d(0),mod:this}:1===e.length?"div"===a?{div:this.divn(e.words[0]),mod:null}:"mod"===a?{div:null,mod:new d(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new d(this.modn(e.words[0]))}:this._wordDiv(e,a);var f,r,n},d.prototype.div=function(e){return this.divmod(e,"div",!1).div},d.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},d.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},d.prototype.divRound=function(e){var a=this.divmod(e);if(a.mod.isZero())return a.div;var t=0!==a.div.negative?a.mod.isub(e):a.mod,c=e.ushrn(1),f=e.andln(1),d=t.cmp(c);return d<0||1===f&&0===d?a.div:0!==a.div.negative?a.div.isubn(1):a.div.iaddn(1)},d.prototype.modn=function(e){c(e<=67108863);for(var a=(1<<26)%e,t=0,f=this.length-1;f>=0;f--)t=(a*t+(0|this.words[f]))%e;return t},d.prototype.idivn=function(e){c(e<=67108863);for(var a=0,t=this.length-1;t>=0;t--){var f=(0|this.words[t])+67108864*a;this.words[t]=f/e|0,a=f%e}return this.strip()},d.prototype.divn=function(e){return this.clone().idivn(e)},d.prototype.egcd=function(e){c(0===e.negative),c(!e.isZero());var a=this,t=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var f=new d(1),r=new d(0),n=new d(0),i=new d(1),b=0;a.isEven()&&t.isEven();)a.iushrn(1),t.iushrn(1),++b;for(var o=t.clone(),s=a.clone();!a.isZero();){for(var l=0,u=1;!(a.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(a.iushrn(l);l-- >0;)(f.isOdd()||r.isOdd())&&(f.iadd(o),r.isub(s)),f.iushrn(1),r.iushrn(1);for(var h=0,p=1;!(t.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(n.isOdd()||i.isOdd())&&(n.iadd(o),i.isub(s)),n.iushrn(1),i.iushrn(1);a.cmp(t)>=0?(a.isub(t),f.isub(n),r.isub(i)):(t.isub(a),n.isub(f),i.isub(r))}return{a:n,b:i,gcd:t.iushln(b)}},d.prototype._invmp=function(e){c(0===e.negative),c(!e.isZero());var a=this,t=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var f,r=new d(1),n=new d(0),i=t.clone();a.cmpn(1)>0&&t.cmpn(1)>0;){for(var b=0,o=1;!(a.words[0]&o)&&b<26;++b,o<<=1);if(b>0)for(a.iushrn(b);b-- >0;)r.isOdd()&&r.iadd(i),r.iushrn(1);for(var s=0,l=1;!(t.words[0]&l)&&s<26;++s,l<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(i),n.iushrn(1);a.cmp(t)>=0?(a.isub(t),r.isub(n)):(t.isub(a),n.isub(r))}return(f=0===a.cmpn(1)?r:n).cmpn(0)<0&&f.iadd(e),f},d.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var a=this.clone(),t=e.clone();a.negative=0,t.negative=0;for(var c=0;a.isEven()&&t.isEven();c++)a.iushrn(1),t.iushrn(1);for(;;){for(;a.isEven();)a.iushrn(1);for(;t.isEven();)t.iushrn(1);var f=a.cmp(t);if(f<0){var d=a;a=t,t=d}else if(0===f||0===t.cmpn(1))break;a.isub(t)}return t.iushln(c)},d.prototype.invm=function(e){return this.egcd(e).a.umod(e)},d.prototype.isEven=function(){return!(1&this.words[0])},d.prototype.isOdd=function(){return!(1&~this.words[0])},d.prototype.andln=function(e){return this.words[0]&e},d.prototype.bincn=function(e){c("number"==typeof e);var a=e%26,t=(e-a)/26,f=1<>>26,n&=67108863,this.words[r]=n}return 0!==d&&(this.words[r]=d,this.length++),this},d.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},d.prototype.cmpn=function(e){var a,t=e<0;if(0!==this.negative&&!t)return-1;if(0===this.negative&&t)return 1;if(this.strip(),this.length>1)a=1;else{t&&(e=-e),c(e<=67108863,"Number is too big");var f=0|this.words[0];a=f===e?0:fe.length)return 1;if(this.length=0;t--){var c=0|this.words[t],f=0|e.words[t];if(c!==f){cf&&(a=1);break}}return a},d.prototype.gtn=function(e){return 1===this.cmpn(e)},d.prototype.gt=function(e){return 1===this.cmp(e)},d.prototype.gten=function(e){return this.cmpn(e)>=0},d.prototype.gte=function(e){return this.cmp(e)>=0},d.prototype.ltn=function(e){return-1===this.cmpn(e)},d.prototype.lt=function(e){return-1===this.cmp(e)},d.prototype.lten=function(e){return this.cmpn(e)<=0},d.prototype.lte=function(e){return this.cmp(e)<=0},d.prototype.eqn=function(e){return 0===this.cmpn(e)},d.prototype.eq=function(e){return 0===this.cmp(e)},d.red=function(e){return new _(e)},d.prototype.toRed=function(e){return c(!this.red,"Already a number in reduction context"),c(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},d.prototype.fromRed=function(){return c(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},d.prototype._forceRed=function(e){return this.red=e,this},d.prototype.forceRed=function(e){return c(!this.red,"Already a number in reduction context"),this._forceRed(e)},d.prototype.redAdd=function(e){return c(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},d.prototype.redIAdd=function(e){return c(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},d.prototype.redSub=function(e){return c(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},d.prototype.redISub=function(e){return c(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},d.prototype.redShl=function(e){return c(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},d.prototype.redMul=function(e){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},d.prototype.redIMul=function(e){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},d.prototype.redSqr=function(){return c(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},d.prototype.redISqr=function(){return c(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},d.prototype.redSqrt=function(){return c(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},d.prototype.redInvm=function(){return c(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},d.prototype.redNeg=function(){return c(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},d.prototype.redPow=function(e){return c(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var m={k256:null,p224:null,p192:null,p25519:null};function x(e,a){this.name=e,this.p=new d(a,16),this.n=this.p.bitLength(),this.k=new d(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){x.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){x.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){x.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){x.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"==typeof e){var a=d._prime(e);this.m=a.p,this.prime=a}else c(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function I(e){_.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new d(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)}x.prototype._tmp=function(){var e=new d(null);return e.words=new Array(Math.ceil(this.n/13)),e},x.prototype.ireduce=function(e){var a,t=e;do{this.split(t,this.tmp),a=(t=(t=this.imulK(t)).iadd(this.tmp)).bitLength()}while(a>this.n);var c=a0?t.isub(this.p):void 0!==t.strip?t.strip():t._strip(),t},x.prototype.split=function(e,a){e.iushrn(this.n,0,a)},x.prototype.imulK=function(e){return e.imul(this.k)},f(y,x),y.prototype.split=function(e,a){for(var t=4194303,c=Math.min(e.length,9),f=0;f>>22,d=r}d>>>=22,e.words[f-10]=d,0===d&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var a=0,t=0;t>>=26,e.words[t]=f,a=c}return 0!==a&&(e.words[e.length++]=a),e},d._prime=function(e){if(m[e])return m[e];var a;if("k256"===e)a=new y;else if("p224"===e)a=new A;else if("p192"===e)a=new v;else{if("p25519"!==e)throw new Error("Unknown prime "+e);a=new w}return m[e]=a,a},_.prototype._verify1=function(e){c(0===e.negative,"red works only with positives"),c(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,a){c(!(e.negative|a.negative),"red works only with positives"),c(e.red&&e.red===a.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,a){this._verify2(e,a);var t=e.add(a);return t.cmp(this.m)>=0&&t.isub(this.m),t._forceRed(this)},_.prototype.iadd=function(e,a){this._verify2(e,a);var t=e.iadd(a);return t.cmp(this.m)>=0&&t.isub(this.m),t},_.prototype.sub=function(e,a){this._verify2(e,a);var t=e.sub(a);return t.cmpn(0)<0&&t.iadd(this.m),t._forceRed(this)},_.prototype.isub=function(e,a){this._verify2(e,a);var t=e.isub(a);return t.cmpn(0)<0&&t.iadd(this.m),t},_.prototype.shl=function(e,a){return this._verify1(e),this.imod(e.ushln(a))},_.prototype.imul=function(e,a){return this._verify2(e,a),this.imod(e.imul(a))},_.prototype.mul=function(e,a){return this._verify2(e,a),this.imod(e.mul(a))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var a=this.m.andln(3);if(c(a%2==1),3===a){var t=this.m.add(new d(1)).iushrn(2);return this.pow(e,t)}for(var f=this.m.subn(1),r=0;!f.isZero()&&0===f.andln(1);)r++,f.iushrn(1);c(!f.isZero());var n=new d(1).toRed(this),i=n.redNeg(),b=this.m.subn(1).iushrn(1),o=this.m.bitLength();for(o=new d(2*o*o).toRed(this);0!==this.pow(o,b).cmp(i);)o.redIAdd(i);for(var s=this.pow(o,f),l=this.pow(e,f.addn(1).iushrn(1)),u=this.pow(e,f),h=r;0!==u.cmp(n);){for(var p=u,g=0;0!==p.cmp(n);g++)p=p.redSqr();c(g=0;c--){for(var b=a.words[c],o=i-1;o>=0;o--){var s=b>>o&1;f!==t[0]&&(f=this.sqr(f)),0!==s||0!==r?(r<<=1,r|=s,(4==++n||0===c&&0===o)&&(f=this.mul(f,t[r]),n=0,r=0)):n=0}i=26}return f},_.prototype.convertTo=function(e){var a=e.umod(this.m);return a===e?a.clone():a},_.prototype.convertFrom=function(e){var a=e.clone();return a.red=null,a},d.mont=function(e){return new I(e)},f(I,_),I.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},I.prototype.convertFrom=function(e){var a=this.imod(e.mul(this.rinv));return a.red=null,a},I.prototype.imul=function(e,a){if(e.isZero()||a.isZero())return e.words[0]=0,e.length=1,e;var t=e.imul(a),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=t.isub(c).iushrn(this.shift),d=f;return f.cmp(this.m)>=0?d=f.isub(this.m):f.cmpn(0)<0&&(d=f.iadd(this.m)),d._forceRed(this)},I.prototype.mul=function(e,a){if(e.isZero()||a.isZero())return new d(0)._forceRed(this);var t=e.mul(a),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=t.isub(c).iushrn(this.shift),r=f;return f.cmp(this.m)>=0?r=f.isub(this.m):f.cmpn(0)<0&&(r=f.iadd(this.m)),r._forceRed(this)},I.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=t.nmd(e),this)},30655:(e,a,t)=>{"use strict";var c=t(70453)("%Object.defineProperty%",!0)||!1;if(c)try{c({},"a",{value:1})}catch(e){c=!1}e.exports=c},41237:e=>{"use strict";e.exports=EvalError},69383:e=>{"use strict";e.exports=Error},79290:e=>{"use strict";e.exports=RangeError},79538:e=>{"use strict";e.exports=ReferenceError},58068:e=>{"use strict";e.exports=SyntaxError},69675:e=>{"use strict";e.exports=TypeError},35345:e=>{"use strict";e.exports=URIError},9723:(e,a,t)=>{"use strict";t.d(a,{AF:()=>s,B3:()=>o,JY:()=>l,QL:()=>b,vS:()=>i});var c=t(36212),f=t(57339),d=t(24359),r=t(43948),n=t(67418);async function i(e,a){let t,d=null;if(Array.isArray(a)){const d=function(a){if((0,c.Lo)(a,32))return a;const t=e.getEvent(a);return(0,f.MR)(t,"unknown fragment","name",a),t.topicHash};t=a.map((e=>null==e?null:Array.isArray(e)?e.map(d):d(e)))}else"*"===a?t=[null]:"string"==typeof a?(0,c.Lo)(a,32)?t=[a]:(d=e.getEvent(a),(0,f.MR)(d,"unknown fragment","event",a),t=[d.topicHash]):(r=a)&&"object"==typeof r&&"getTopicFilter"in r&&"function"==typeof r.getTopicFilter&&r.fragment?t=await a.getTopicFilter():"fragment"in a?(d=a.fragment,t=[d.topicHash]):(0,f.MR)(!1,"unknown event name","event",a);var r;return t=t.map((e=>{if(null==e)return null;if(Array.isArray(e)){const a=Array.from(new Set(e.map((e=>e.toLowerCase()))).values());return 1===a.length?a[0]:(a.sort(),a)}return e.toLowerCase()})),{fragment:d,tag:t.map((e=>null==e?"null":Array.isArray(e)?e.join("|"):e)).join("&"),topics:t}}async function b(e,a,t,c,n){null==c&&(c=0),null==n&&(n="latest");const{fragment:b,topics:o}=await i(a.interface,t),s={address:"*"===e?void 0:e,topics:o,fromBlock:c,toBlock:n},l=a.runner;return(0,f.vA)(l,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await l.getLogs(s)).map((e=>{let t=b;if(null==t)try{t=a.interface.getEvent(e.topics[0])}catch{}if(t)try{return new d.vu(e,a.interface,t)}catch(a){return new d.AA(e,a)}return new r.tG(e,l)}))}class o{provider;onProgress;concurrencySize;batchSize;shouldRetry;retryMax;retryOn;constructor({provider:e,onProgress:a,concurrencySize:t=10,batchSize:c=10,shouldRetry:f=!0,retryMax:d=5,retryOn:r=500}){this.provider=e,this.onProgress=a,this.concurrencySize=t,this.batchSize=c,this.shouldRetry=f,this.retryMax=d,this.retryOn=r}async getBlock(e){const a=await this.provider.getBlock(e);if(!a)throw new Error(`No block for ${e}`);return a}createBatchRequest(e){return e.map((async(e,a)=>(await(0,n.yy)(40*a),(async()=>{let a,t=0;for(;!this.shouldRetry&&0===t||this.shouldRetry&&tthis.getBlock(e))))}catch(e){t++,a=e,await(0,n.yy)(this.retryOn)}throw a})())))}async getBatchBlocks(e){let a=0;const t=[];for(const c of(0,n.iv)(e,this.concurrencySize*this.batchSize)){const f=(await Promise.all(this.createBatchRequest((0,n.iv)(c,this.batchSize)))).flat();t.push(...f),a+=c.length,"function"==typeof this.onProgress&&this.onProgress({percentage:a/e.length,currentIndex:a,totalIndex:e.length})}return t}}class s{provider;onProgress;concurrencySize;batchSize;shouldRetry;retryMax;retryOn;constructor({provider:e,onProgress:a,concurrencySize:t=10,batchSize:c=10,shouldRetry:f=!0,retryMax:d=5,retryOn:r=500}){this.provider=e,this.onProgress=a,this.concurrencySize=t,this.batchSize=c,this.shouldRetry=f,this.retryMax=d,this.retryOn=r}async getTransaction(e){const a=await this.provider.getTransaction(e);if(!a)throw new Error(`No transaction for ${e}`);return a}async getTransactionReceipt(e){const a=await this.provider.getTransactionReceipt(e);if(!a)throw new Error(`No transaction receipt for ${e}`);return a}createBatchRequest(e,a){return e.map((async(e,t)=>(await(0,n.yy)(40*t),(async()=>{let t,c=0;for(;!this.shouldRetry&&0===c||this.shouldRetry&&cthis.getTransactionReceipt(e)))):await Promise.all(e.map((e=>this.getTransaction(e))))}catch(e){c++,t=e,await(0,n.yy)(this.retryOn)}throw t})())))}async getBatchTransactions(e){let a=0;const t=[];for(const c of(0,n.iv)(e,this.concurrencySize*this.batchSize)){const f=(await Promise.all(this.createBatchRequest((0,n.iv)(c,this.batchSize)))).flat();t.push(...f),a+=c.length,"function"==typeof this.onProgress&&this.onProgress({percentage:a/e.length,currentIndex:a,totalIndex:e.length})}return t}async getBatchReceipt(e){let a=0;const t=[];for(const c of(0,n.iv)(e,this.concurrencySize*this.batchSize)){const f=(await Promise.all(this.createBatchRequest((0,n.iv)(c,this.batchSize),!0))).flat();t.push(...f),a+=c.length,"function"==typeof this.onProgress&&this.onProgress({percentage:a/e.length,currentIndex:a,totalIndex:e.length})}return t}}class l{provider;contract;address;onProgress;concurrencySize;blocksPerRequest;shouldRetry;retryMax;retryOn;constructor({provider:e,contract:a,address:t,onProgress:c,concurrencySize:f=10,blocksPerRequest:d=5e3,shouldRetry:r=!0,retryMax:n=5,retryOn:i=500}){this.provider=e,this.contract=a,this.address=t,this.onProgress=c,this.concurrencySize=f,this.blocksPerRequest=d,this.shouldRetry=r,this.retryMax=n,this.retryOn=i}async getPastEvents({fromBlock:e,toBlock:a,type:t}){let c,f=0;for(;!this.shouldRetry&&0===f||this.shouldRetry&&f(await(0,n.yy)(10*a),this.getPastEvents(e))))}async getBatchEvents({fromBlock:e,toBlock:a,type:t="*"}){a||(a=await this.provider.getBlockNumber());const c=[];for(let f=e;fa?a:f+this.blocksPerRequest-1;c.push({fromBlock:f,toBlock:e,type:t})}const f=[],d=(0,n.iv)(c,this.concurrencySize);let r=0;for(const e of d){r++;const a=(await Promise.all(this.createBatchRequest(e))).flat();f.push(...a),"function"==typeof this.onProgress&&this.onProgress({percentage:r/d.length,type:t,fromBlock:e[0].fromBlock,toBlock:e[e.length-1].toBlock,count:a.length})}return f}}},7240:(e,a,t)=>{"use strict";t.d(a,{Hr:()=>n,Ps:()=>r,dA:()=>i,qO:()=>b,wd:()=>d});var c=t(67418),f=t(85111);function d(e){const a=/tornado-(?\w+)-(?[\d.]+)-(?\d+)-0x(?[0-9a-fA-F]{124})/g.exec(e);if(!a)return;const{currency:t,amount:c,netId:f,noteHex:d}=a.groups;return{currency:t.toLowerCase(),amount:c,netId:Number(f),noteHex:"0x"+d,note:e}}function r(e){const a=/tornadoInvoice-(?\w+)-(?[\d.]+)-(?\d+)-0x(?[0-9a-fA-F]{64})/g.exec(e);if(!a)return;const{currency:t,amount:c,netId:f,commitmentHex:d}=a.groups;return{currency:t.toLowerCase(),amount:c,netId:Number(f),commitmentHex:"0x"+d,invoice:e}}async function n({nullifier:e,secret:a}){const t=new Uint8Array([...(0,c.EI)(e),...(0,c.EI)(a)]),d=(0,c.$W)((0,c.Ju)(t),62),r=BigInt(await(0,f.UB)(t)),n=(0,c.$W)(r),i=BigInt(await(0,f.UB)((0,c.EI)(e)));return{preimage:t,noteHex:d,commitment:r,commitmentHex:n,nullifierHash:i,nullifierHex:(0,c.$W)(i)}}class i{currency;amount;netId;nullifier;secret;note;noteHex;invoice;commitmentHex;nullifierHex;constructor({currency:e,amount:a,netId:t,nullifier:c,secret:f,note:d,noteHex:r,invoice:n,commitmentHex:i,nullifierHex:b}){this.currency=e,this.amount=a,this.netId=t,this.nullifier=c,this.secret=f,this.note=d,this.noteHex=r,this.invoice=n,this.commitmentHex=i,this.nullifierHex=b}toString(){return JSON.stringify({currency:this.currency,amount:this.amount,netId:this.netId,nullifier:this.nullifier,secret:this.secret,note:this.note,noteHex:this.noteHex,invoice:this.invoice,commitmentHex:this.commitmentHex,nullifierHex:this.nullifierHex},null,2)}static async createNote({currency:e,amount:a,netId:t,nullifier:f,secret:d}){f||(f=(0,c.ib)(31)),d||(d=(0,c.ib)(31));const r=await n({nullifier:f,secret:d});return new i({currency:e.toLowerCase(),amount:a,netId:t,note:`tornado-${e.toLowerCase()}-${a}-${t}-${r.noteHex}`,noteHex:r.noteHex,invoice:`tornadoInvoice-${e.toLowerCase()}-${a}-${t}-${r.commitmentHex}`,nullifier:f,secret:d,commitmentHex:r.commitmentHex,nullifierHex:r.nullifierHex})}static async parseNote(e){const a=d(e);if(!a)throw new Error("The note has invalid format");const{currency:t,amount:f,netId:r,note:b,noteHex:o}=a,s=(0,c.jm)(o),l=BigInt((0,c.ae)(s.slice(0,31)).toString()),u=BigInt((0,c.ae)(s.slice(31,62)).toString()),{noteHex:h,commitmentHex:p,nullifierHex:g}=await n({nullifier:l,secret:u});return new i({currency:t,amount:f,netId:r,note:b,noteHex:h,invoice:`tornadoInvoice-${t}-${f}-${r}-${p}`,nullifier:l,secret:u,commitmentHex:p,nullifierHex:g})}}class b{currency;amount;netId;commitmentHex;invoice;constructor(e){const a=r(e);if(!a)throw new Error("The invoice has invalid format");const{currency:t,amount:c,netId:f,invoice:d,commitmentHex:n}=a;this.currency=t,this.amount=c,this.netId=f,this.commitmentHex=n,this.invoice=d}toString(){return JSON.stringify({currency:this.currency,amount:this.amount,netId:this.netId,commitmentHex:this.commitmentHex,invoice:this.invoice},null,2)}}},33298:(e,a,t)=>{"use strict";t.d(a,{Ad:()=>b,Fr:()=>n,ol:()=>i});var c=t(51594),f=t(20415),d=t(30031),r=t(67418);function n({nonce:e,ephemPublicKey:a,ciphertext:t}){const c=(0,r.$W)((0,r.My)((0,r.Kp)(e)),24),f=(0,r.$W)((0,r.My)((0,r.Kp)(a)),32),d=(0,r.My)((0,r.Kp)(t)),n=(0,r.Id)((0,r.aT)(c),(0,r.aT)(f),(0,r.aT)(d));return(0,r.My)(n)}function i(e){const a=(0,r.aT)(e),t=(0,r.if)(a.slice(0,24)),c=(0,r.if)(a.slice(24,56)),f=(0,r.if)(a.slice(56));return{messageBuff:(0,r.My)(a),version:"x25519-xsalsa20-poly1305",nonce:t,ephemPublicKey:c,ciphertext:f}}class b{blockNumber;recoveryKey;recoveryAddress;recoveryPublicKey;constructor({blockNumber:e,recoveryKey:a}){a||(a=(0,r.G9)(32).slice(2)),this.blockNumber=e,this.recoveryKey=a,this.recoveryAddress=(0,f.K)("0x"+a),this.recoveryPublicKey=(0,c.getEncryptionPublicKey)(a)}static async getSignerPublicKey(e){if(e.privateKey){const a=e,t="0x"===a.privateKey.slice(0,2)?a.privateKey.slice(2):a.privateKey;return(0,c.getEncryptionPublicKey)(t)}const a=e.provider;return await a.send("eth_getEncryptionPublicKey",[e.address])}getEncryptedAccount(e){const a=(0,c.encrypt)({publicKey:e,data:this.recoveryKey,version:"x25519-xsalsa20-poly1305"});return{encryptedData:a,data:n(a)}}static async decryptSignerNoteAccounts(e,a){const t=e.address,f=[];for(const d of a)if(d.address===t)try{const a=i(d.encryptedAccount);let n;if(e.privateKey){const t=e,f="0x"===t.privateKey.slice(0,2)?t.privateKey.slice(2):t.privateKey;n=(0,c.decrypt)({encryptedData:a,privateKey:f})}else{const{version:c,nonce:f,ephemPublicKey:d,ciphertext:i}=a,b=(0,r.My)((new TextEncoder).encode(JSON.stringify({version:c,nonce:f,ephemPublicKey:d,ciphertext:i}))),o=e.provider;n=await o.send("eth_decrypt",[b,t])}f.push(new b({blockNumber:d.blockNumber,recoveryKey:n}))}catch{continue}return f}decryptNotes(e){const a=[];for(const t of e)try{const e=i(t.encryptedNote),[f,r]=(0,c.decrypt)({encryptedData:e,privateKey:this.recoveryKey}).split("-");a.push({blockNumber:t.blockNumber,address:(0,d.b)(f),noteHex:r})}catch{continue}return a}encryptNote({address:e,noteHex:a}){return n((0,c.encrypt)({publicKey:this.recoveryPublicKey,data:`${e}-${a}`,version:"x25519-xsalsa20-poly1305"}))}}},16795:(e,a,t)=>{"use strict";t.d(a,{A6:()=>l,Lr:()=>o,QP:()=>s,gH:()=>u,qX:()=>b});var c=t(2011),f=t(64563),d=t(97876),r=t(62463),n=t(67418),i=t(59499);function b(e){if(66!==e.length)return null;if(0!==e.indexOf("["))return null;if(65!==e.indexOf("]"))return null;const a=`0x${e.slice(1,65)}`;return(0,n.qv)(a)?a:null}function o(e){return e?b(e)||(0,c.S)((new TextEncoder).encode(e)):(0,n.My)(new Uint8Array(32).fill(0))}function s(e){const a=e.split("."),t=a.shift(),c=(0,f.kM)(a.join("."));return{label:t,labelhash:o(t),parentNode:c}}const l={[i.zr.MAINNET]:{ensRegistry:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",ensPublicResolver:"0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63",ensNameWrapper:"0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401"},[i.zr.SEPOLIA]:{ensRegistry:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",ensPublicResolver:"0x8FADE66B79cC9f707aB26799354482EB93a5B7dD",ensNameWrapper:"0x0635513f179D50A207757E05759CbD106d7dFcE8"}};class u{ENSRegistry;ENSResolver;ENSNameWrapper;provider;constructor(e){this.provider=e}async getContracts(){const{chainId:e}=await this.provider.getNetwork(),{ensRegistry:a,ensPublicResolver:t,ensNameWrapper:c}=l[Number(e)];this.ENSRegistry=r.S4.connect(a,this.provider),this.ENSResolver=r.BB.connect(t,this.provider),this.ENSNameWrapper=r.rZ.connect(c,this.provider)}async getOwner(e){return this.ENSRegistry||await this.getContracts(),this.ENSRegistry.owner((0,f.kM)(e))}async unwrap(e,a){this.ENSNameWrapper||await this.getContracts();const t=e.address,c=this.ENSNameWrapper.connect(e),{labelhash:f}=s(a);return c.unwrapETH2LD(f,t,t)}async setSubnodeRecord(e,a){this.ENSResolver||await this.getContracts();const t=this.ENSResolver,c=this.ENSRegistry.connect(e),f=e.address,{labelhash:d,parentNode:r}=s(a);return c.setSubnodeRecord(r,d,f,t.target,BigInt(0))}getResolver(e){return d.Pz.fromName(this.provider,e)}async getText(e,a){const t=await this.getResolver(e);return t?await t.getText(a)||"":t}async setText(e,a,t,c){return r.BB.connect((await this.getResolver(a))?.address,e).setText((0,f.kM)(a),t,c)}}},96221:(e,a,t)=>{"use strict";t.d(a,{GS:()=>y,O_:()=>A,uw:()=>g,JJ:()=>_,lG:()=>x,cE:()=>C,Do:()=>M,e0:()=>m,EU:()=>I,sf:()=>w});var c=t(30031),f=t(35273),d=t(36212),r=t(99770),n=t(64563),i=t(73622),b=t(13269);t(7040),t(88081),t(57339);const o=[{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"commitment",type:"bytes32"},{indexed:!1,internalType:"uint32",name:"leafIndex",type:"uint32"},{indexed:!1,internalType:"uint256",name:"timestamp",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"bytes32",name:"nullifierHash",type:"bytes32"},{indexed:!0,internalType:"address",name:"relayer",type:"address"},{indexed:!1,internalType:"uint256",name:"fee",type:"uint256"}],name:"Withdrawal",type:"event"},{inputs:[],name:"FIELD_SIZE",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"ROOT_HISTORY_SIZE",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"ZERO_VALUE",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"commitments",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"currentRootIndex",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"denomination",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"_commitment",type:"bytes32"}],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"filledSubtrees",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLastRoot",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IHasher",name:"_hasher",type:"address"},{internalType:"bytes32",name:"_left",type:"bytes32"},{internalType:"bytes32",name:"_right",type:"bytes32"}],name:"hashLeftRight",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"pure",type:"function"},{inputs:[],name:"hasher",outputs:[{internalType:"contract IHasher",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"_root",type:"bytes32"}],name:"isKnownRoot",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"_nullifierHash",type:"bytes32"}],name:"isSpent",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32[]",name:"_nullifierHashes",type:"bytes32[]"}],name:"isSpentArray",outputs:[{internalType:"bool[]",name:"spent",type:"bool[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"levels",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"nextIndex",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"nullifierHashes",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"roots",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"verifier",outputs:[{internalType:"contract IVerifier",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"_proof",type:"bytes"},{internalType:"bytes32",name:"_root",type:"bytes32"},{internalType:"bytes32",name:"_nullifierHash",type:"bytes32"},{internalType:"address payable",name:"_recipient",type:"address"},{internalType:"address payable",name:"_relayer",type:"address"},{internalType:"uint256",name:"_fee",type:"uint256"},{internalType:"uint256",name:"_refund",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"zeros",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"}];class s{static abi=o;static createInterface(){return new i.KA(o)}static connect(e,a){return new b.NZ(e,o,a)}}var l=t(9723),u=t(46170),h=t(59499),p=t(57194);class g{netId;provider;contract;type;deployedBlock;batchEventsService;fetchDataOptions;tovarishClient;constructor({netId:e,provider:a,contract:t,type:c="",deployedBlock:f=0,fetchDataOptions:d,tovarishClient:r}){this.netId=e,this.provider=a,this.fetchDataOptions=d,this.contract=t,this.type=c,this.deployedBlock=f,this.batchEventsService=new l.JY({provider:a,contract:t,onProgress:this.updateEventProgress}),this.tovarishClient=r}getInstanceName(){return""}getType(){return this.type||""}getTovarishType(){return String(this.getType()||"").toLowerCase()}updateEventProgress({percentage:e,type:a,fromBlock:t,toBlock:c,count:f}){}updateBlockProgress({percentage:e,currentIndex:a,totalIndex:t}){}updateTransactionProgress({percentage:e,currentIndex:a,totalIndex:t}){}async formatEvents(e){return await new Promise((a=>a(e)))}async getEventsFromDB(){return{events:[],lastBlock:0}}async getEventsFromCache(){return{events:[],lastBlock:0,fromCache:!0}}async getSavedEvents(){let e=await this.getEventsFromDB();return e.lastBlock||(e=await this.getEventsFromCache()),e}async getEventsFromRpc({fromBlock:e,toBlock:a}){try{return a||(a=await this.provider.getBlockNumber()),e>=a?{events:[],lastBlock:a}:(this.updateEventProgress({percentage:0,type:this.getType()}),{events:await this.formatEvents(await this.batchEventsService.getBatchEvents({fromBlock:e,toBlock:a,type:this.getType()})),lastBlock:a})}catch(a){return console.log(a),{events:[],lastBlock:e}}}async getLatestEvents({fromBlock:e}){if(this.tovarishClient?.selectedRelayer){const{events:a,lastSyncBlock:t}=await this.tovarishClient.getEvents({type:this.getTovarishType(),fromBlock:e});return{events:a,lastBlock:t}}return await this.getEventsFromRpc({fromBlock:e})}async validateEvents({events:e,newEvents:a,lastBlock:t}){}async saveEvents({events:e,newEvents:a,lastBlock:t}){}async updateEvents(){const e=await this.getSavedEvents();let a=this.deployedBlock;e&&e.lastBlock&&(a=e.lastBlock+1);const t=await this.getLatestEvents({fromBlock:a}),c=new Set,f=[...e.events,...t.events].sort(((e,a)=>e.blockNumber===a.blockNumber?e.logIndex-a.logIndex:e.blockNumber-a.blockNumber)).filter((({transactionHash:e,logIndex:a})=>{const t=`${e}_${a}`,f=c.has(t);return c.add(t),!f})),d=t.lastBlock||f[f.length-1]?.blockNumber,r=await this.validateEvents({events:f,newEvents:t.events,lastBlock:d});return(e.fromCache||t.events.length)&&await this.saveEvents({events:f,newEvents:t.events,lastBlock:d}),{events:f,lastBlock:d,validateResult:r}}}class m extends g{amount;currency;optionalTree;merkleTreeService;batchTransactionService;batchBlockService;constructor(e){const{Tornado:a,amount:t,currency:c,provider:f,optionalTree:d,merkleTreeService:r}=e;super({...e,contract:a}),this.amount=t,this.currency=c,this.optionalTree=d,this.merkleTreeService=r,this.batchTransactionService=new l.AF({provider:f,onProgress:this.updateTransactionProgress}),this.batchBlockService=new l.B3({provider:f,onProgress:this.updateBlockProgress})}getInstanceName(){return`${this.getType().toLowerCase()}s_${this.netId}_${this.currency}_${this.amount}`}async formatEvents(e){if("Deposit"===this.getType()){const a=await this.batchTransactionService.getBatchTransactions([...new Set(e.map((({transactionHash:e})=>e)))]);return e.map((({blockNumber:e,index:t,transactionHash:c,args:f})=>{const{commitment:d,leafIndex:r,timestamp:n}=f;return{blockNumber:e,logIndex:t,transactionHash:c,commitment:d,leafIndex:Number(r),timestamp:Number(n),from:a.find((({hash:e})=>e===c))?.from||""}}))}{const a=await this.batchBlockService.getBatchBlocks([...new Set(e.map((({blockNumber:e})=>e)))]);return e.map((({blockNumber:e,index:t,transactionHash:f,args:d})=>{const{nullifierHash:r,to:n,fee:i}=d;return{blockNumber:e,logIndex:t,transactionHash:f,nullifierHash:String(r),to:(0,c.b)(n),fee:String(i),timestamp:a.find((({number:a})=>a===e))?.timestamp||0}}))}}async validateEvents({events:e,newEvents:a}){if(e.length&&"Deposit"===this.getType()){const t=e,c=t[t.length-1];if(c.leafIndex!==t.length-1){const e=`Deposit events invalid wants ${t.length-1} leafIndex have ${c.leafIndex}`;throw new Error(e)}if(this.merkleTreeService&&(!this.optionalTree||a.length))return await this.merkleTreeService.verifyTree(t)}}async getLatestEvents({fromBlock:e}){if(this.tovarishClient?.selectedRelayer){const{events:a,lastSyncBlock:t}=await this.tovarishClient.getEvents({type:this.getTovarishType(),currency:this.currency,amount:this.amount,fromBlock:e});return{events:a,lastBlock:t}}return await this.getEventsFromRpc({fromBlock:e})}}class x extends g{instances;optionalTree;merkleTreeService;batchTransactionService;batchBlockService;constructor(e){const{instances:a,provider:t,optionalTree:c,merkleTreeService:f}=e,d=f?.Tornado||s.connect(Object.keys(a)[0],t);super({...e,contract:d,type:"*"}),this.batchEventsService=new l.JY({provider:t,contract:d,address:Object.keys(a),onProgress:this.updateEventProgress}),this.instances=a,this.optionalTree=c,this.merkleTreeService=f,this.batchTransactionService=new l.AF({provider:t,onProgress:this.updateTransactionProgress}),this.batchBlockService=new l.B3({provider:t,onProgress:this.updateBlockProgress})}getInstanceName(){return`tornado_${this.netId}`}getTovarishType(){return"tornado"}async formatEvents(e){const a=await this.batchTransactionService.getBatchTransactions([...new Set(e.filter((({eventName:e})=>"Deposit"===e)).map((({transactionHash:e})=>e)))]),t=await this.batchBlockService.getBatchBlocks([...new Set(e.filter((({eventName:e})=>"Withdrawal"===e)).map((({blockNumber:e})=>e)))]);return e.map((({address:e,blockNumber:c,index:f,transactionHash:d,args:r,eventName:n})=>{const i={blockNumber:c,logIndex:f,transactionHash:d,event:n,instanceAddress:e};if("Deposit"===n){const{commitment:e,leafIndex:t,timestamp:c}=r;return{...i,commitment:e,leafIndex:Number(t),timestamp:Number(c),from:a.find((({hash:e})=>e===d))?.from||""}}if("Withdrawal"===n){const{nullifierHash:e,to:a,relayer:n,fee:b}=r;return{...i,logIndex:f,transactionHash:d,nullifierHash:String(e),to:a,relayerAddress:n,fee:String(b),timestamp:t.find((({number:e})=>e===c))?.timestamp||0}}})).filter((e=>e))}async validateEvents({events:e,newEvents:a}){const t=[...new Set(a.filter((({event:e})=>"Deposit"===e)).map((({instanceAddress:e})=>e)))];let c;const f=this.merkleTreeService?.Tornado?.target;f&&!t.includes(f)&&t.push(f);for(const a of t){const t=e.filter((({instanceAddress:e,event:t})=>e===a&&"Deposit"===t)),d=t[t.length-1];if(d.leafIndex!==t.length-1){const e=`Invalid deposit events for ${a} wants ${t.length-1} leafIndex have ${d.leafIndex}`;throw new Error(e)}f!==a||this.optionalTree||(c=await(this.merkleTreeService?.verifyTree(t)))}return c}async getEvents(e){const{events:a,validateResult:t,lastBlock:c}=await this.updateEvents(),{depositEvents:f,withdrawalEvents:d}=a.reduce(((a,t)=>(t.instanceAddress===e&&("Deposit"===t.event?a.depositEvents.push(t):"Withdrawal"===t.event&&a.withdrawalEvents.push(t)),a)),{});return{depositEvents:f,withdrawalEvents:d,tree:t,lastBlock:c}}}class y extends g{constructor(e){super({...e,contract:e.Echoer,type:"Echo"})}getInstanceName(){return`echo_${this.netId}`}async formatEvents(e){return e.map((({blockNumber:e,index:a,transactionHash:t,args:c})=>{const{who:f,data:d}=c;if(f&&d)return{blockNumber:e,logIndex:a,transactionHash:t,address:f,encryptedAccount:d}})).filter((e=>e))}}class A extends g{constructor(e){super({...e,contract:e.Router,type:"EncryptedNote"})}getInstanceName(){return`encrypted_notes_${this.netId}`}getTovarishType(){return"encrypted_notes"}async formatEvents(e){return e.map((({blockNumber:e,index:a,transactionHash:t,args:c})=>{const{encryptedNote:f}=c;if(f&&"0x"!==f)return{blockNumber:e,logIndex:a,transactionHash:t,encryptedNote:f}})).filter((e=>e))}}const v=f.y.defaultAbiCoder(),w={0:"Pending",1:"Active",2:"Defeated",3:"Timelocked",4:"AwaitingExecution",5:"Executed",6:"Expired"};class _ extends g{Governance;Aggregator;ReverseRecords;batchTransactionService;constructor(e){const{Governance:a,Aggregator:t,ReverseRecords:c,provider:f}=e;super({...e,contract:a,type:"*"}),this.Governance=a,this.Aggregator=t,this.ReverseRecords=c,this.batchTransactionService=new l.AF({provider:f,onProgress:this.updateTransactionProgress})}getInstanceName(){return`governance_${this.netId}`}getTovarishType(){return"governance"}async formatEvents(e){const a=[],t=[],c=[],f=[];if(e.forEach((({blockNumber:e,index:d,transactionHash:r,args:n,eventName:i})=>{const b={blockNumber:e,logIndex:d,transactionHash:r,event:i};if("ProposalCreated"===i){const{id:e,proposer:t,target:c,startTime:f,endTime:d,description:r}=n;a.push({...b,id:Number(e),proposer:t,target:c,startTime:Number(f),endTime:Number(d),description:r})}if("Voted"===i){const{proposalId:e,voter:a,support:c,votes:f}=n;t.push({...b,proposalId:Number(e),voter:a,support:c,votes:f,from:"",input:""})}if("Delegated"===i){const{account:e,to:a}=n;c.push({...b,account:e,delegateTo:a})}if("Undelegated"===i){const{account:e,from:a}=n;f.push({...b,account:e,delegateFrom:a})}})),t.length){this.updateTransactionProgress({percentage:0});const e=await this.batchTransactionService.getBatchTransactions([...new Set(t.map((({transactionHash:e})=>e)))]);t.forEach(((a,c)=>{let{data:f,from:d}=e.find((e=>e.hash===a.transactionHash));(!f||f.length>2048)&&(f=""),t[c].from=d,t[c].input=f}))}return[...a,...t,...c,...f]}async getAllProposals(){const{events:e}=await this.updateEvents(),a=e.filter((e=>"ProposalCreated"===e.event)),t=[...new Set(a.map((e=>[e.proposer])).flat())],[c,f,d]=await Promise.all([this.Governance.QUORUM_VOTES(),this.Aggregator.getAllProposals(this.Governance.target),this.ReverseRecords.getNames(t)]),r=t.reduce(((e,a,t)=>(d[t]&&(e[a]=d[t]),e)),{});return a.map(((e,a)=>{const{id:t,proposer:d,description:n}=e,i=f[a],{forVotes:b,againstVotes:o,executed:s,extended:l,state:u}=i,{title:h,description:p}=function(e,a){switch(e){case 1:return{title:a,description:"See: https://torn.community/t/proposal-1-enable-torn-transfers/38"};case 10:a=a.replace("\n","\\n\\n");break;case 11:a=a.replace('"description"',',"description"');break;case 13:a=a.replace(/\\\\n\\\\n(\s)?(\\n)?/g,"\\n");break;case 15:a=(a=a.replaceAll("'",'"')).replace('"description"',',"description"');break;case 16:a=a.replace("#16: ","");break;case 21:return{title:"Proposal #21: Restore Governance",description:""}}let t,c,f;try{({title:t,description:c}=JSON.parse(a))}catch{[t,...f]=a.split("\n",2),c=f.join("\n")}return{title:t,description:c}}(t,n),g=(Number(b+o)/Number(c)*100).toFixed(0)+"%";return{...e,title:h,proposerName:r[d]||void 0,description:p,forVotes:b,againstVotes:o,executed:s,extended:l,quorum:g,state:w[String(u)]}}))}async getVotes(e){const{events:a}=await this.getSavedEvents(),t=a.filter((a=>"Voted"===a.event&&a.proposalId===e)),c=[...new Set(t.map((e=>[e.from,e.voter])).flat())],f=await this.ReverseRecords.getNames(c),r=c.reduce(((e,a,t)=>(f[t]&&(e[a]=f[t]),e)),{});return t.map((e=>{const{from:a,voter:t}=e,{contact:c,message:f}=function(e,a){try{const t=4,c=v.decode(["address[]","uint256","bool"],(0,d.ZG)(a,t)),f=e.interface.encodeFunctionData("castDelegatedVote",c),r=(0,d.pO)(f),n=v.decode(["string"],(0,d.ZG)(a,r))[0],[i,b]=JSON.parse(n);return{contact:i,message:b}}catch{return{contact:"",message:""}}}(this.Governance,e.input);return{...e,contact:c,message:f,fromName:r[a]||void 0,voterName:r[t]||void 0}}))}async getDelegatedBalance(e){const{events:a}=await this.getSavedEvents(),t=a.filter((a=>"Delegated"===a.event&&a.delegateTo===e)).map((e=>e.account)),c=a.filter((a=>"Undelegated"===a.event&&a.delegateFrom===e)).map((e=>e.account)),f=[...c],d=t.filter((e=>{const a=f.indexOf(e);return-1===a||(f.splice(a,1),!1)})),[r,n]=await Promise.all([this.Aggregator.getGovernanceBalances(this.Governance.target,d),this.ReverseRecords.getNames(d)]),i=d.reduce(((e,a,t)=>(n[t]&&(e[a]=n[t]),e)),{});return{delegatedAccs:t,undelegatedAccs:c,uniq:d,uniqNames:i,balances:r,balance:r.reduce(((e,a)=>e+a),BigInt(0))}}}async function I(e,a){await Promise.all(a.filter((e=>e.tovarishHost)).map((async a=>{try{a.tovarishNetworks=await(0,u.Fd)(a.tovarishHost,{...e.fetchDataOptions,headers:{"Content-Type":"application/json"},timeout:3e4,maxRetry:e.fetchDataOptions?.torPort?2:0})}catch{a.tovarishNetworks=[]}})))}const E=[{ensName:"tornadowithdraw.eth",relayerAddress:"0x40c3d1656a26C9266f4A10fed0D87EFf79F54E64",hostnames:{},tovarishHost:"tornadowithdraw.com",tovarishNetworks:h.Af}];class C extends g{Aggregator;relayerEnsSubdomains;updateInterval;constructor(e){const{RelayerRegistry:a,Aggregator:t,relayerEnsSubdomains:c}=e;super({...e,contract:a,type:"*"}),this.Aggregator=t,this.relayerEnsSubdomains=c,this.updateInterval=86400}getInstanceName(){return`registry_${this.netId}`}getTovarishType(){return"registry"}async formatEvents(e){const a=[],t=[],c=[],f=[];return e.forEach((({blockNumber:e,index:d,transactionHash:n,args:i,eventName:b})=>{const o={blockNumber:e,logIndex:d,transactionHash:n,event:b};if("RelayerRegistered"===b){const{relayer:e,ensName:t,relayerAddress:c,stakedAmount:f}=i;a.push({...o,ensName:t,relayerAddress:c,ensHash:e,stakedAmount:(0,r.ck)(f)})}if("RelayerUnregistered"===b){const{relayer:e}=i;t.push({...o,relayerAddress:e})}if("WorkerRegistered"===b){const{relayer:e,worker:a}=i;c.push({...o,relayerAddress:e,workerAddress:a})}if("WorkerUnregistered"===b){const{relayer:e,worker:a}=i;f.push({...o,relayerAddress:e,workerAddress:a})}})),[...a,...t,...c,...f]}async getRelayersFromDB(){return{lastBlock:0,timestamp:0,relayers:[]}}async getRelayersFromCache(){return{lastBlock:0,timestamp:0,relayers:[],fromCache:!0}}async getSavedRelayers(){let e=await this.getRelayersFromDB();return e&&e.relayers.length||(e=await this.getRelayersFromCache()),e}async getLatestRelayers(){const{events:e,lastBlock:a}=await this.updateEvents(),t=e.filter((e=>"RelayerRegistered"===e.event)),c=Object.values(this.relayerEnsSubdomains),f=new Set,d=t.filter((({ensName:e})=>!f.has(e)&&(f.add(e),!0))),i=d.map((e=>(0,n.kM)(e.ensName))),[b,o]=await Promise.all([this.Aggregator.relayersData.staticCall(i,c.concat("tovarish-relayer")),this.provider.getBlock(a).then((e=>Number(e?.timestamp)))]),s=b.map((({owner:e,balance:a,records:t,isRegistered:c},f)=>{const{ensName:n,relayerAddress:i}=d[f];let b;const o=t.reduce(((e,a,c)=>{if(a){if(c===t.length-1)return b=a,e;e[Number(Object.keys(this.relayerEnsSubdomains)[c])]=a}return e}),{}),s=a>=p.pO;if(Object.keys(o).length&&c&&s)return{ensName:n,relayerAddress:e,registeredAddress:e!==i?i:void 0,isRegistered:c,stakeBalance:(0,r.ck)(a),hostnames:o,tovarishHost:b}})).filter((e=>e));await I(this,s);const l=[...E,...s];return{lastBlock:a,timestamp:o,relayers:[...l.filter((e=>e.tovarishHost)),...l.filter((e=>!e.tovarishHost))]}}async saveRelayers({lastBlock:e,timestamp:a,relayers:t}){}async updateRelayers(){let{lastBlock:e,timestamp:a,relayers:t,fromCache:c}=await this.getSavedRelayers(),f=c??!1;return(!t.length||a+this.updateIntervale)))]),t=await this.batchTransactionService.getBatchReceipt([...new Set(e.map((({transactionHash:e})=>e)))]),c=new Set(e.map((({args:e})=>e.relayer))),f=s.createInterface(),d=f.getEvent("Withdrawal").topicHash,r=t.map((e=>e.logs.map((t=>{if(t.topics[0]===d){const d=a.find((e=>e.number===t.blockNumber)),r=f.parseLog(t);if(r&&c.has(r.args.relayer))return{instanceAddress:t.address,gasFee:(e.cumulativeGasUsed*e.gasPrice).toString(),relayerFee:r.args.fee.toString(),timestamp:d?.timestamp||0}}})).filter((e=>e)))).flat();return r.length!==e.length&&console.log(`\nRevenueService: Mismatch on withdrawal logs (${r.length} ) and events logs (${e.length})\n`),e.map((({blockNumber:e,index:a,transactionHash:t,args:c},f)=>{const d={blockNumber:e,logIndex:a,transactionHash:t},{relayer:n,amountBurned:i}=c,{instanceAddress:b,gasFee:o,relayerFee:s,timestamp:l}=r[f];return{...d,relayerAddress:n,amountBurned:i.toString(),instanceAddress:b,gasFee:o,relayerFee:s,timestamp:l}}))}}},12591:(e,a,t)=>{"use strict";t.d(a,{$B:()=>l,Aq:()=>u,Fb:()=>n,Oz:()=>b,f8:()=>o,hD:()=>h,w8:()=>i,wV:()=>p,xc:()=>s});var c=t(18995),f=t(67418),d=t(46170),r=t(96221);async function n({idb:e,instanceName:a,events:t,lastBlock:c}){try{const f=t.map((e=>({eid:`${e.transactionHash}_${e.logIndex}`,...e})));await e.createMultipleTransactions({data:f,storeName:a}),await e.putItem({data:{blockNumber:c,name:a},storeName:"lastEvents"})}catch(e){console.log("Method saveDBEvents has error"),console.log(e)}}async function i({idb:e,instanceName:a}){try{const t=await e.getItem({storeName:"lastEvents",key:a});return t?.blockNumber?{events:(await e.getAll({storeName:a})).map((e=>(delete e.eid,e))),lastBlock:t.blockNumber}:{events:[],lastBlock:0}}catch(e){return console.log("Method loadDBEvents has error"),console.log(e),{events:[],lastBlock:0}}}async function b({staticUrl:e,instanceName:a,deployedBlock:t,zipDigest:f}){try{const d=`${a}.json`.toLowerCase(),r=await(0,c._6)({staticUrl:e,zipName:d,zipDigest:f});if(!Array.isArray(r)){const a=`Invalid events from ${e}/${d}`;throw new Error(a)}return{events:r,lastBlock:r[r.length-1]?.blockNumber||t,fromCache:!0}}catch(e){return console.log("Method loadRemoteEvents has error"),console.log(e),{events:[],lastBlock:t,fromCache:!0}}}class o extends r.e0{staticUrl;idb;zipDigest;constructor(e){super(e),this.staticUrl=e.staticUrl,this.idb=e.idb}async getEventsFromDB(){return await i({idb:this.idb,instanceName:this.getInstanceName()})}async getEventsFromCache(){return await b({staticUrl:this.staticUrl,instanceName:this.getInstanceName(),deployedBlock:this.deployedBlock,zipDigest:this.zipDigest})}async saveEvents({events:e,lastBlock:a}){await n({idb:this.idb,instanceName:this.getInstanceName(),events:e,lastBlock:a})}}class s extends r.GS{staticUrl;idb;zipDigest;constructor(e){super(e),this.staticUrl=e.staticUrl,this.idb=e.idb}async getEventsFromDB(){return await i({idb:this.idb,instanceName:this.getInstanceName()})}async getEventsFromCache(){return await b({staticUrl:this.staticUrl,instanceName:this.getInstanceName(),deployedBlock:this.deployedBlock,zipDigest:this.zipDigest})}async saveEvents({events:e,lastBlock:a}){await n({idb:this.idb,instanceName:this.getInstanceName(),events:e,lastBlock:a})}}class l extends r.O_{staticUrl;idb;zipDigest;constructor(e){super(e),this.staticUrl=e.staticUrl,this.idb=e.idb}async getEventsFromDB(){return await i({idb:this.idb,instanceName:this.getInstanceName()})}async getEventsFromCache(){return await b({staticUrl:this.staticUrl,instanceName:this.getInstanceName(),deployedBlock:this.deployedBlock,zipDigest:this.zipDigest})}async saveEvents({events:e,lastBlock:a}){await n({idb:this.idb,instanceName:this.getInstanceName(),events:e,lastBlock:a})}}class u extends r.JJ{staticUrl;idb;zipDigest;constructor(e){super(e),this.staticUrl=e.staticUrl,this.idb=e.idb}async getEventsFromDB(){return await i({idb:this.idb,instanceName:this.getInstanceName()})}async getEventsFromCache(){return await b({staticUrl:this.staticUrl,instanceName:this.getInstanceName(),deployedBlock:this.deployedBlock,zipDigest:this.zipDigest})}async saveEvents({events:e,lastBlock:a}){await n({idb:this.idb,instanceName:this.getInstanceName(),events:e,lastBlock:a})}}class h extends r.cE{staticUrl;idb;zipDigest;relayerJsonDigest;constructor(e){super(e),this.staticUrl=e.staticUrl,this.idb=e.idb}async getEventsFromDB(){return await i({idb:this.idb,instanceName:this.getInstanceName()})}async getEventsFromCache(){return await b({staticUrl:this.staticUrl,instanceName:this.getInstanceName(),deployedBlock:this.deployedBlock,zipDigest:this.zipDigest})}async saveEvents({events:e,lastBlock:a}){await n({idb:this.idb,instanceName:this.getInstanceName(),events:e,lastBlock:a})}async getRelayersFromDB(){try{const e=await this.idb.getAll({storeName:`relayers_${this.netId}`});return e?.length?e.slice(-1)[0]:{lastBlock:0,timestamp:0,relayers:[]}}catch(e){return console.log("Method getRelayersFromDB has error"),console.log(e),{lastBlock:0,timestamp:0,relayers:[]}}}async getRelayersFromCache(){const e=`${this.staticUrl}/relayers.json`;try{const a=await(0,d.Fd)(e,{method:"GET",returnResponse:!0}),t=new Uint8Array(await a.arrayBuffer());if(this.relayerJsonDigest){const a="sha384-"+(0,f.if)(await(0,f.br)(t));if(a!==this.relayerJsonDigest){const t=`Invalid digest hash for ${e}, wants ${this.relayerJsonDigest} has ${a}`;throw new Error(t)}}return JSON.parse((new TextDecoder).decode(t))}catch(e){return console.log("Method getRelayersFromCache has error"),console.log(e),{lastBlock:0,timestamp:0,relayers:[]}}}async saveRelayers(e){try{await this.idb.putItem({data:e,storeName:`relayers_${this.netId}`})}catch(e){console.log("Method saveRelayers has error"),console.log(e)}}}class p extends r.Do{staticUrl;idb;zipDigest;relayerJsonDigest;constructor(e){super(e),this.staticUrl=e.staticUrl,this.idb=e.idb}async getEventsFromDB(){return await i({idb:this.idb,instanceName:this.getInstanceName()})}async getEventsFromCache(){return await b({staticUrl:this.staticUrl,instanceName:this.getInstanceName(),deployedBlock:this.deployedBlock,zipDigest:this.zipDigest})}async saveEvents({events:e,lastBlock:a}){await n({idb:this.idb,instanceName:this.getInstanceName(),events:e,lastBlock:a})}}},94513:(e,a,t)=>{"use strict";t.r(a),t.d(a,{BaseEchoService:()=>d.GS,BaseEncryptedNotesService:()=>d.O_,BaseEventsService:()=>d.uw,BaseGovernanceService:()=>d.JJ,BaseMultiTornadoService:()=>d.lG,BaseRegistryService:()=>d.cE,BaseRevenueService:()=>d.Do,BaseTornadoService:()=>d.e0,DBEchoService:()=>r.xc,DBEncryptedNotesService:()=>r.$B,DBGovernanceService:()=>r.Aq,DBRegistryService:()=>r.hD,DBRevenueService:()=>r.wV,DBTornadoService:()=>r.f8,getTovarishNetworks:()=>d.EU,loadDBEvents:()=>r.w8,loadRemoteEvents:()=>r.Oz,proposalState:()=>d.sf,saveDBEvents:()=>r.Fb});var c=t(61060),f={};for(const e in c)"default"!==e&&(f[e]=()=>c[e]);t.d(a,f);var d=t(96221),r=t(12591)},61060:()=>{},37182:(e,a,t)=>{"use strict";t.d(a,{N:()=>d,o:()=>r});var c=t(99770),f=t(79453);function d(e,a,t=18){const c=BigInt(10**Number(t));return BigInt(e)*c/BigInt(a)}class r{provider;ovmGasPriceOracle;constructor(e,a){this.provider=e,a&&(this.ovmGasPriceOracle=a)}async gasPrice(){const[e,a,t]=await Promise.all([this.provider.getBlock("latest"),(async()=>{try{return BigInt(await this.provider.send("eth_gasPrice",[]))}catch{return(0,c.XS)("1","gwei")}})(),(async()=>{try{return BigInt(await this.provider.send("eth_maxPriorityFeePerGas",[]))}catch{return BigInt(0)}})()]);return e?.baseFeePerGas?e.baseFeePerGas*BigInt(15)/BigInt(10)+t:a}fetchL1OptimismFee(e){return this.ovmGasPriceOracle?(e||(e={type:0,gasLimit:1e6,nonce:1024,data:"0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111",gasPrice:(0,c.XS)("1","gwei"),to:"0x1111111111111111111111111111111111111111"}),this.ovmGasPriceOracle.getL1Fee.staticCall(f.Z.from(e).unsignedSerialized)):new Promise((e=>e(BigInt(0))))}defaultEthRefund(e,a){return(e?BigInt(e):(0,c.XS)("30","gwei"))*BigInt(a||1e6)}calculateTokenAmount(e,a,t){return d(e,a,t)}calculateRelayerFee({gasPrice:e,gasLimit:a=6e5,l1Fee:t=0,denomination:c,ethRefund:f=BigInt(0),tokenPriceInWei:r,tokenDecimals:n=18,relayerFeePercent:i=.33,isEth:b=!0,premiumPercent:o=20}){const s=BigInt(e)*BigInt(a)+BigInt(t),l=BigInt(c)*BigInt(Math.floor(1e4*i))/BigInt(1e6);return b?(s+l)*BigInt(o?100+o:100)/BigInt(100):(d(s+BigInt(f),r,n)+l)*BigInt(o?100+o:100)/BigInt(100)}}},56079:(e,a,t)=>{"use strict";t.d(a,{Qx:()=>r,X:()=>i,dT:()=>d,x5:()=>n});var c=t(41442),f=t(59499);const d={[f.zr.MAINNET]:"0x391E7C679d29bD940d63be94AD22A25d25b5A604",[f.zr.BSC]:"0x391E7C679d29bD940d63be94AD22A25d25b5A604",[f.zr.POLYGON]:"0x391E7C679d29bD940d63be94AD22A25d25b5A604",[f.zr.OPTIMISM]:"0x391E7C679d29bD940d63be94AD22A25d25b5A604",[f.zr.ARBITRUM]:"0x391E7C679d29bD940d63be94AD22A25d25b5A604",[f.zr.GNOSIS]:"0x391E7C679d29bD940d63be94AD22A25d25b5A604",[f.zr.AVALANCHE]:"0x391E7C679d29bD940d63be94AD22A25d25b5A604"},r={[f.zr.MAINNET]:255,[f.zr.BSC]:14,[f.zr.POLYGON]:17,[f.zr.OPTIMISM]:55,[f.zr.ARBITRUM]:57,[f.zr.GNOSIS]:16,[f.zr.AVALANCHE]:15,[f.zr.SEPOLIA]:102};function n(e,a){let t="0x";if((0,c.PW)(e)){if(42!==e.length)return null;t+="02",t+=e.slice(2)}else t+="01";for(const e in a)t+=Number(a[e]).toString(16).padStart(4,"0");return t}function i(e){return{min:1/e,max:50/e,ethUsd:e}}},49540:(e,a,t)=>{"use strict";t.d(a,{B:()=>c,l:()=>f});const c="0x38600c600039612b1b6000f3606460006000377c01000000000000000000000000000000000000000000000000000000006000510463f47d33b5146200003557fe5b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000016004518160245181838180828009800909089082827f0fbe43c36a80e36d7c7c584d4f8f3759fb51f0d66065d8a227b688d12488c5d408839081808280098009098391089082827f9c48cd3e00a6195a253fc009e60f249456f802ff9baf6549210d201321efc1cc08839081808280098009098391089082827f27c0849dba2643077c13eb42ffb97663cdcecd669bf10f756be30bab71b86cf808839081808280098009098391089082827f2bf76744736132e5c68f7dfdd5b792681d415098554fd8280f00d11b172b80d208839081808280098009098391089082827f33133eb4a1a1ab45037c8bdf9adbb2999baf06f20a9c95180dc4ccdcbec5856808839081808280098009098391089082827f588bb66012356dbc9b059ef1d792b563d6c18624dddecc3fe4583fd3551e9b3008839081808280098009098391089082827f71bc3e244e1b92911fe7f53cf523e491fd6ff487d59337a1d92f92668c4f4c3608839081808280098009098391089082827fd1808e2b039fd010c489768f78d7499938ccc0858f3295151787cfe8b7e40be108839081808280098009098391089082827f76978af3ded437cf41b3faa40cd6bcfce94f27f4abcc3ed34be19abd2c4537d008839081808280098009098391089082827f0a9baee798a320b0ca5b1cf888386d1dc12c13b38e10225aa4e9f03069a099f508839081808280098009098391089082827fb79dbf6050a03b16c3ade8d77e11c767d2251af9cdbd6cdf9a8a0ee921b32c7908839081808280098009098391089082827fa74bbcf5067f067faec2cce4b98d130d7927456f5c5f6c00e0f5406a24eb8b1908839081808280098009098391089082827fab7ab080d4c4018bda6ecc8bd67468bc4619ba12f25b0da879a639c758c8855d08839081808280098009098391089082827fe6a5b797c2bba7e9a873b37f5c41adc47765e9be4a1f0e0650e6a24ad226876308839081808280098009098391089082827f6270ae87cf3d82cf9c0b5f428466c429d7b7cbe234cecff39969171af006016c08839081808280098009098391089082827f9951c9f6e76d636b52f7600d979ca9f3b643dfbe9551c83b31542830321b2a6608839081808280098009098391089082827f4119469e44229cc40c4ff555a2b6f6b39961088e741e3c20a3c9b47f130c555008839081808280098009098391089082827f5d795e02bbaf90ff1f384741e5f18f8b644a0080441315d0e5b3c8123452a0b008839081808280098009098391089082827f281e90a515e6409e9177b4f297f8049ce3d4c3659423c48b3fd64e83596ff10108839081808280098009098391089082827f424185c60a21e84970f7d32cacaa2725aa8a844caea7ed760d2b965af1bf3e7d08839081808280098009098391089082827fd96fcbc3960614ea887da609187a5dada2e1b829f23309a6375212cea1f25c0908839081808280098009098391089082827ffde84026d7c294300af18f7712fc3662f43387ae8cf7fdda1f9a810f4b24bcf208839081808280098009098391089082827f3a9d568575846aa6b8a890b3c237fd0447426db878e6e25333b8eb9b386195c108839081808280098009098391089082827f55a2aa32c84a4cae196dd4094b685dd11757470a3be094d98eea73f02452aa3608839081808280098009098391089082827fcbc9481380978d29ebc5b0a8d4481cd2ef654ee800907adb3d38dc2fd9265fab08839081808280098009098391089082827f24e53af71ef06bacb76d3294c11223911e9d177ff09b7009febc484add0beb7408839081808280098009098391089082827fdbd44e16108225766dac3e5fe7acbe9df519bbba97380e5e9437a90658f2139308839081808280098009098391089082827fc6f434863c79013bb2c202331e04bccea2251c1ff6f191dc2afa23e6f6d28e4e08839081808280098009098391089082827f3490eeb39a733c0e8062d87f981ae65a8fccf25c448f4455d27db3915351b06608839081808280098009098391089082827f30b89830ff7ade3558a5361a24869130ce1fcce97211602962e34859525dac4f08839081808280098009098391089082827f29bae21b579d080a75c1694da628d0ecfd83efc9c8468704f410300062f64ca908839081808280098009098391089082827fe326499de0476e719915dd1c661ef4550723d4aee9ee9af224edd208790fce4408839081808280098009098391089082827f8c45208b8baa6f473821415957088c0b7e72a465f460b09ece2d270aee2f184108839081808280098009098391089082827ffe2ad454f451348f26ce2cc7e7914aef3eb96e8f89a4619a1dc7d11f8401c35208839081808280098009098391089082827f0929db368ef2af2d29bca38845325b0b7a820a4889e44b5829bbe1ed47fd4d5208839081808280098009098391089082827f16531d424b0cbaf9abbf2d2acde698462ea4555bf32ccf1bbd26697e905066f608839081808280098009098391089082827ff5c30d247f045ff6d05cf0dd0a49c9823e7a24b0d751d3c721353b96f29d76f608839081808280098009098391089082827f6eb7a3614056c230c6f171370fdd9d1048bb00b2cdd1b2721d11bdda5023f48608839081808280098009098391089082827f0ee9c4621642a272f710908707557498d25a6fdd51866da5d9f0d205355a618908839081808280098009098391089082827f78ca1cb1c7f6c6894d1cf94f327b8763be173151b6b06f99dfc6a944bb5a72f008839081808280098009098391089082827f5d24d0b1b304d05311ce0f274b0d93746a4860ed5cdd8d4348de557ea7a5ee7a08839081808280098009098391089082827f77423dabd1a3cddc8691438fc5891e3fd49ac0f3e21aaf249791bfde1303d2f308839081808280098009098391089082827f0642e8800a48cc04c0168232c6f542396597a67cf395ad622d947e98bb68697a08839081808280098009098391089082827fc1e7d3cbbc4c35b7490647d8402e56d334336943bda91fe2d34ca9727c0e3df508839081808280098009098391089082827f8d6fb1730335204f38f85e408ac861e76f24349ab6ee0469c22e19350bb24fe108839081808280098009098391089082827f67d0faf5f0db32a1b60e13dc4914246b9edac7990fb4990b19aa86815586441a08839081808280098009098391089082827f2605b9b909ded1b04971eae979027c4e0de57f3b6a60d5ed58aba619c34749ce08839081808280098009098391089082827fd276890b2c205db85f000d1f5111ed8f177e279cae3e52862780f04e846228d008839081808280098009098391089082827f2ac5905f9450a21ef6905ed5951a91b3730e3a2e2d62b50bdeb810015d50376b08839081808280098009098391089082827f7a366839f0291ca54da674ac3f0e1e9aa8b687ba533926cb40268039e57b967a08839081808280098009098391089082827f67ab0f3466989c3dbbe209c37ec272ba83984ba6e445be6d472b63e3ca7270e308839081808280098009098391089082827f0e786007d0ce7e28a90e31d3263887d40c556dec88fcb8b56bc9e9c05ecc0c2908839081808280098009098391089082827f0b814ed99bd00eca389b0022663dbfddfbfa15e321c19abcf1eaf9556075fb6808839081808280098009098391089082827f65c0321ba26fcee4fdc35b4999b78ceb54dcaf9fec2e3bdea98e9f82925c093208839081808280098009098391089082827fab2d2a929601f9c3520e0b14aaa6ba9f1e79821a5b768919670a4ea970722bf408839081808280098009098391089082827fcdd2e0744d4af1a81918de69ec12128a5871367303ff83ed764771cbbdf6502308839081808280098009098391089082827f74527d0c0868f2ec628086b874fa66a7347d3d3b918d2e07a5f33e1067e8ac5808839081808280098009098391089082827f1c6bf6ac0314caead23e357bfcbbaa17d670672ae3a475f80934c716f10aca2508839081808280098009098391089082827f3c4007e286f8dc7efd5d0eeb0e95d7aa6589361d128a0cccb17b554c851a643208839081808280098009098391089082827fae468a86a5a7db7c763a053eb09ac1a02809ce095258c88101ee319e12b0697e08839081808280098009098391089082827f9333e3d052b7c77fcac1eb366f610f6f97852242b1317a87b80f3bbc5c8c2d1d08839081808280098009098391089082827f52ec1d675cf5353153f6b628414783ca6b7fc0fe01948ca206daad712296e39508839081808280098009098391089082827f13ceeeb301572b4991076750e11ea7e7fcbfee454d90dc1763989004a1894f9308839081808280098009098391089082827f8505737e7e94939a08d8cda10b6fbbbf879b2141ae7eabc30fcd22405135fe6408839081808280098009098391089082827f6127db7ac5200a212092b66ec2bfc63653f4dc8ac66c76008fef885258a258b508839081808280098009098391089082827f12692a7d808f44e31d628dbcfea377eb073fb918d7beb8136ea47f8cf094c88c08839081808280098009098391089082827f260e384b1268e3a347c91d6987fd280fa0a275541a7c5be34bf126af35c962e008839081808280098009098391089082827fd88c3b01966d90e713aee8d482ceaa6925311d2342e1a5aca4fcd2f44b6daddc08839081808280098009098391089082827fb87e868affd91b078a87fa75ac9332a6cf23587d94e20c3262db5e91f30bf04b08839081808280098009098391089082827fb5ba5f8acad1a950a3bbf2201055cd3ea27056c0c53f0c4c97f33cda8dbfe90908839081808280098009098391089082827f59ca814b49e00d7b3118c53a2986ded128584acd7428735e08ade6661c457f7508839081808280098009098391089082827f0fc4c0bea813a223fd510c07f7bbe337badd4bcf28649a0d378970c2a15b3aa508839081808280098009098391089082827f0053f1ea6dd60e7a6db09a00be77549ff3d4ee3737be7fb42052ae1321f667c308839081808280098009098391089082827feb937077bb10c8fe38716d4e38edc1f9e7b18c6414fef85fe7e9c5567baa4a0408839081808280098009098391089082827fbacb14c0f1508d828f7fd048d716b8044aec7f0fb48e85e717bf532db972520708839081808280098009098391089082827f4ca0abb8beb7cff572a0c1e6f58e080e1bb243d497a3e74538442a4555ad40be08839081808280098009098391089082827fda9eefd411e590d7e44592cce298af87b2c62aa3cc8bb137aa99ca8d4aa551b508839081808280098009098391089082827f153dae43cef763e7a2fc9846f09a2973b0ad9c35894c220699bcc2954501c6bd08839081808280098009098391089082827fd4ed2a09375813b4fb504c7a9ba13110bdd8549a47349db82c15a434c090e87b08839081808280098009098391089082827f0063a5c4c9c12dcf4bae72c69f3a225664469503d61d9eae5d9553bfb006095b08839081808280098009098391089082827fdc8a4d35ad28e59dd3713b45985cd3b70e37ccc2be42086f1ea078fe2dc9d82d08839081808280098009098391089082827f486ba219308f0c847b22fcb4449f8855192536c01b8057904e81c1c7814f483b08839081808280098009098391089082827f34d9604140a1ac9fdb204285b9fe1b303c281af2fc5fb362f6577282b423bcf308839081808280098009098391089082827fc1681959ec4bc3656911db2b2f56aa4db709c26f1a0a25c879286e37f437465d08839081808280098009098391089082827ffcd849f3b5f9e4368af75619fb27f2e335adbb9b44988f17c4d389fa751ad47a08839081808280098009098391089082827ff5f7fc22ad64c8e7c1e005110e13f4f1c6b1f8f8cc59000db0e3bb38f99554a508839081808280098009098391089082827fa9133b8a20fbae4633ec5f82cb47a38ae1877d12d1febb23982c7c808aa5317508839081808280098009098391089082827ff4827c5c7b61141cc31b75984bb3ed16ed579e5b72e32a1289b63ab55eaf8c1208839081808280098009098391089082827fcca361819ffefe3e50fe34c91a322c9405f4e5a168c1fc0a0a1883993e32c9f408839081808280098009098391089082827f6656088842bfc9e325a532784d3362cecfa86f9c7b208a6b499836ebe48ff15708839081808280098009098391089082827f00129c7cd00e42ed05a37dbceb80d47b65e1d750ef2148278a54723fdf42c4cc08839081808280098009098391089082827fa85b235631b786f85cd46f7768f6c71ae004ad267ae59bdf929ada149b19588808839081808280098009098391089082827f34df65a82686be09c5b237911abf237a9887c1a418f279ac79b446d7d311f5ea08839081808280098009098391089082827f815a850c3989df9ca6231e0bdd9916fc0e076f2c6c7f0f260a846d0179f9c32d08839081808280098009098391089082827f50fb0940848a67aee83d348421fadd79aefc7a2adabeec6e64904ebe1bf63e7d08839081808280098009098391089082827fbab63a16273599f8b66895461e62a19ff0d103693be771d93e3691bba89cdd8d08839081808280098009098391089082827f6931a091756e0bc709ebecfffba5038634c5b3d5d0c5876dd72aac67452db8a208839081808280098009098391089082827f55559b8bb79db8809c46ee627f1b5ce1d8e6d89bf94a9987a1407759d1ba896308839081808280098009098391089082827fa9a1a11b2979018cb155914d09f1df19b7ffec241e8b2487b6f6272a56a44a0a08839081808280098009098391089082827ff83293400e7bccea4bb86dcb0d5ca57fa2466e13a572d7d3531c6fa491cb0f1b08839081808280098009098391089082827fb7cb5742b6bc5339624d3568a33c21f31b877f8396972582028da999abf249f208839081808280098009098391089082827ff56efb400f8500b5c5bf811c65c86c7ed2e965f14f1a69bca436c0c60b79f46508839081808280098009098391089082827fd7c4427998d9c440f849dcd75b7157996eaad1b9a1d58cc2441931300e26eb2208839081808280098009098391089082827fca5ed18ad53e33fdc3ae8cf353ff3f6dd315f60060442b74f6b614b24ebd4cc308839081808280098009098391089082827f9ad3e9376c97b194a0fbf43e22a3616981d777365c765ead09a1d033fdf536b708839081808280098009098391089082827fc6daeff5769a06b26fe3b8fef30df07b1387373a7814cef364fe1d6059eaf54a08839081808280098009098391089082827fc20a78398345c6b8cf439643dab96223bf879c302648293eaf496fee5c978c6608839081808280098009098391089082827f589ca65b6cf0e90653c06dddc057dc61ba2839974569051c98b43e8618716efb08839081808280098009098391089082827f83064161f127d8c59fc73625957e21630dc6dc99e5443f6ce37ecd6bf28e69b708839081808280098009098391089082827f46d0ba662b50100b9a3af52052f68932feec1d12290b2033c4f49148893d8ba308839081808280098009098391089082827f18dd55b4a83a53f2ee578eb3e6d26f594824d44670fc3f4de80642344d15c09a08839081808280098009098391089082827f9fb5b594f48bc58b345ab90ded705920a7274b8e070eee8ce8cf90c72c3604b608839081808280098009098391089082827f1901d8f4f2c8449128e00663978f2050f2eb1cd6acb60d9d09c57c5d46ee54fe08839081808280098009098391089082827f5ec56789beab24ef7ee32f594d5fc561ec59dfeb93606dc7dcc6fe65133a7db408839081808280098009098391089082827f01c0b2cbe4fa9877a3d08eb67c510e8630da0a8beda94a6d9283e6f70d268bc508839081808280098009098391089082827f0b1d85acd9031a9107350eed946a25734e974799c5ba7cff13b15a5a623a25f008839081808280098009098391089082827f204497d1d359552905a2fe655f3d6f94926ea92d12cdaa6556ec26362f239f6408839081808280098009098391089082827fe075f7edc6631a8d7ffe33019f44fc91f286236d5a5f90f16de4791b72a2a5f008839081808280098009098391089082827f243f46e353354256ab8fe0ca4e9230dfc330bc163e602dfeaf307c1d1a7264b908839081808280098009098391089082827fd448ae5e09625fa1fcfd732fc9cd8f06e4c33b81f0a9240c83da56f41e9ecceb08839081808280098009098391089082827f2f312eef69a33d9fa753c08840275692a03432b3e6da67f9c59b9f9f4971cd5608839081808280098009098391089082827f5f333996af231bd5a293137da91801e191a6f24eb532ad1a7e6e9a2ad0efbc0008839081808280098009098391089082827fa8f771e0383a832dc8e2eaa8efabda300947acaf0684fabddf8b4abb0abd8a6208839081808280098009098391089082827f9ff0b3d7a4643596f651b70c1963cc4fa6c46018d78f05cb2c5f187e25df83a908839081808280098009098391089082827f9c373b704838325648273734dcdf962d7c156f431f70380ba4855832c4a238b808839081808280098009098391089082827fea2afa02604b8afeeb570f48a0e97a5e6bfe9613394b9a6b0026ecd6cec8c33a08839081808280098009098391089082827f68892258cd8eb43b71caa6d6837ec9959bfdfd72f25c9005ebaffc4011f8a7bf08839081808280098009098391089082827ff2824f561f6f82e3c1232836b0d268fa3b1b5489edd39a5fe1503bfc7ca91f4908839081808280098009098391089082827f164eda75fda2861f9d812f24e37ac938844fbe383c243b32b9f66ae2e76be71908839081808280098009098391089082827ff0a6fc431f5bf0dd1cca93b8b65b3f72c91f0693e2c74be9243b15abb31afcc008839081808280098009098391089082827fe68db66ba891ef0cd527f09ec6fff3ec0a269cf3d891a35ec13c902f70334b4f08839081808280098009098391089082827f3a44a5b102f7883a2b8630a3cae6e6db2e6e483bb7cfeb3492cbd91793ef598e08839081808280098009098391089082827f43939fe8ef789acb33cbf129ba8a3aa1bd61510a178022a05177c9c5a1c59bf108839081808280098009098391089082827f936fe3b66dfda1bc5a7aae241b4db442858bd720c1d579c0c869f273cd55d77408839081808280098009098391089082827f3490fcaa8ffa37f35dc67ae006e81352c7103945417b8e4b142afcaefa344b8508839081808280098009098391089082827fcae66096cff344caca53ffe0e58aafeb468bd174f00d8abc425b2099c088187408839081808280098009098391089082827fc7d05783a41bc14f3c9a45384b6d5e2547c5b6a224c8316910b208f2718a70ab08839081808280098009098391089082827f5ac6b9ba94040d5692b865b6677b60ef3201b5c2121699f70beb9f9b2528a02608839081808280098009098391089082827fa902a3d4d9ecbfb9b2c76fddf780554bf93cad97b244e805d3adb94e1816290008839081808280098009098391089082827fe9df91ffeeb086a4d26041c29dac6fca1d56a4d022fe34b38831267395b98d2708839081808280098009098391089082827f862646f851d91a8840ad9ee711f12ec13b3e8f980ff5ef5ee43ca4520d57def708839081808280098009098391089082827f30b7381c9725b9db07816baf8524943a79cea135807c84cce0833485c11e0c2e08839081808280098009098391089082827f96afc10c5cedaddbda99df79387397c9be74a5b50f3a0c04ccb68d4e0f3a989f08839081808280098009098391089082827f3543da80d10da251c548776fe907c4ef89993d62e0062ae5c0496fcb851c366108839081808280098009098391089082827fe5140fe26d8b008430fccd50a68e3e11c1163d63b6d8b7cc40bc6f3c1d0b1b0608839081808280098009098391089082827ffefdf1872e4475e8bbb0ef6fab7f561bff121314695c433bd4c29ec118060c9608839081808280098009098391089082827f6bb8c9f3d57b18e002df059db1e6a5d42ad566f153f18460774f68ac2650940008839081808280098009098391089082827f5415122d50b26f4fab5784004c56cf03f128f825ad2236f4b3d51f74737bd97308839081808280098009098391089082827f00e115c4a98efae6a3a5ecc873b0cef63ccd5b515710a3ab03ec52218f784dc908839081808280098009098391089082827fda7d525427bad87b88238657c21331245578bc76aa6240b7f972382537a202ab08839081808280098009098391089082827f83332e8b34505b83010270dc795290a2f515b8f89c163acecdf4799df04c62f808839081808280098009098391089082827fb09ecb6033d1a065f17a61066cd737d0c3c5873b51c3ab0a285e26939e62aa1808839081808280098009098391089082827f24e65c718938c2b937378e7435332174329730bde85a4185e37875824eb4985908839081808280098009098391089082827f68e41430ccd41cc5e92a9f9acd2e955c1385b9f5ed8d3f133d767429484a8eba08839081808280098009098391089082827fc038fe9d0125ab8be54545276f841274e414c596ed4c9eaa6919604603d1ffa908839081808280098009098391089082827f23248698612cd8e83234fcf5db9b6b225f4b0ba78d72ef13ea1edff5f0fb029808839081808280098009098391089082827fd2a9fa3d39c1ba91eefa666a1db71c6e0e4e3b707626b0197a4e59e7110cf0d408839081808280098009098391089082827fc28931ee7dfa02b62872e0d937ba3dc5c637118273a1f1f0c4fc880905c82efc08839081808280098009098391089082827f01cd399556445e3d7b201d6c5e56a5794e60be2cfd9a4643e7ead79bb4f60f7908839081808280098009098391089082827fac855cc58d5fbb0dff91a79683eb0e914c1b7d8d0a540d416838a89f83a8312f08839081808280098009098391089082827ff7798af7ccf36b836705849f7dd40328bf9346657255b431446ec75a6817181608839081808280098009098391089082827fe52a24c92d3f067bf551eeaf98c62ba525e84882d7adad835fad8de72986b2b108839081808280098009098391089082827fffc8682759a2bf1dd67c87a77c285467801f1c44fd78fa4eb5957a4832c9d72d08839081808280098009098391089082827f1482ac3e7e4f321627850d95a13942aea6d2923402b913046856ff7e8aaf9aff08839081808280098009098391089082827f17332b4c7aac2a07ccfe954de7ad22ccf6fcb4c5fa15c130ed22a40ae9398f4708839081808280098009098391089082827fd4be0546013f84a0d1e118b37589723b58e323983263616d1b036f8b3fdd858308839081808280098009098391089082827fa64ec737d31dddf939b184438ccdd3e1d3e667572857cd6c9c31a0d1d9b7b08508839081808280098009098391089082827f8ad12fbc74117cff4743d674539c86548c6758710a07a6abe3715e4b53526d3408839081808280098009098391089082827f15a16435a2300b27a337561401f06682ba85019aa0af61b264a1177d38b5c13c08839081808280098009098391089082827f22616f306e76352293a22ab6ee15509d9b108d4136b32fa7f9ed259793f392a108839081808280098009098391089082827f519727b25560caf00ce0d3f911bd4356f907160ab5186da10a629c7ccae1851e08839081808280098009098391089082827fcff39e77928ce9310118d50e29bc87e7f78b53ad51366359aa17f07902ae639208839081808280098009098391089082827f17dead3bfa1968c744118023dead77cdbee22c5b7c2414f5a6bdf82fd94cf3ad08839081808280098009098391089082827f2bef0f8b22a1cfb90100f4a552a9d02b772130123de8144a00c4d57497e1d7f408839081808280098009098391089082827fbf5188713fef90b31c35243f92cfa4331ab076e30e24b355c79b01f41d152a1108839081808280098009098391089082827f3baadd2fd92e3e12fb371be0578941dc0a108fbca0a7d81b88316fb94d6b4dfe08839081808280098009098391089082827fd4f955742e20a28d38611bf9fc4a478c97b673a7cd40d0113a58a1efe338d9aa08839081808280098009098391089082827f3c1c3fe9a5f7ccd54ad5a51a224b3f94775266d19c3733017e4920d7391ad64508839081808280098009098391089082827f6372df6148abeed66fda5461779a9651130c6c525df733852bcd929016768a7a08839081808280098009098391089082827f6d098e848fb853f95adb5a6364b5ab33c79fb08877f2cf3e0e160d9fcb3ebcc508839081808280098009098391089082827f48c5fc90f27431fabfe496dfba14bb0dba71141eb5472a365fd13023f4fe629608839081808280098009098391089082827fbb988dfc0c4dfe53999bd34840adcb63fdbf501ccd622ca2ddf5064ad8cdebf408839081808280098009098391089082827f25b068c942724c424ed5851c9575c22752c9bd25f91ebfa589de3d88ee7627f908839081808280098009098391089082827fed98a1931e361add218de11ff7879bd7114cda19c24ddbe15b3b0190ce01e1aa08839081808280098009098391089082827fc80b5a7d63f6c43542ad612023d3ffd6c684ce2eab837180addcb4decf51854408839081808280098009098391089082827fe2ef24bf47c5203118c6ff96657dd3c6fdff7212d5c798d826455de77b4b70cd08839081808280098009098391089082827f907da812fd5a8375587e4860f87691d0a8d61d454c507d09e5562e1a5d0fcc7608839081808280098009098391089082827fc459abbc62bc6070cacdff597e97990de56edc51cc6643afb0f6789fef1bad6308839081808280098009098391089082827f38d61f5e566855d70d36ef0f0f1fefcd7c829bdd60d95e0ef1fb5b98856280a408839081808280098009098391089082827f13218626665c420d3aa2b0fa49224a3dce8e08b8b56f8851bd9cb5e25cb3042d08839081808280098009098391089082827f6f685fb152dba21b4d02422e237e246df73d7d711ae6d7d33983bae0f873e31008839081808280098009098391089082827f5ade34719e2498dde70e4571c40474475a4af706a3cb82ac18a7fa44c22d1c4708839081808280098009098391089082827f8a0c3dc7a496adca059cb95d9b173812a00f3c4d435e0b9e8116e0c4b5f56acb08839081808280098009098391089082827f196bc98252f63169ed79073ee091a0e8ed0b5af51017da143940c00bdb86370908839081808280098009098391089082827fd979bf70695d93f8efb552a413701918afec9e12dfe213f4d0c27cfa68fad6c208839081808280098009098391089082827fb803072d02f54d237a3c6c4cc18eda6dce87a03c6819df54e4ed8aed6dc56d4608839081808280098009098391089082827f1efcda9d986cddcf431af4d59c6a7709d650885b7886cba70f0e7cd92b331cdc08839081808280098009098391089082827fd3ca5f7859b82ac50b63da06d43aa68a6b685f0a60397638bbea173b3f60419208839081808280098009098391089082827fa59d392c0667316ad37a06be2d51aabe9e79bdef0013bc109985648a14c7e41f08839081808280098009098391089082827fac2f5f0d2146791b396e2bed6cf15a20bc22cc4c8cf7dd4b3514ac00148dd0a708839081808280098009098391089082827f17a993a6af068d72bc36f0e814d29fef3f97d7a72aa963889b16a8457409861a08839081808280098009098391089082827f6f1bf99686550e0396f7f4e2df6fdaa090fbc272c8c76eb32a3c6791de5a07b508839081808280098009098391089082827f8234d705e1ecdc59cc6ed40749069d4b45e63deb49b5b7d7f527abd31c072b1b08839081808280098009098391089082827f6fe929a1fd6aacba5c4012c45dd727d2c816119567450003913d882cb97bc47e08839081808280098009098391089082827fad5371215f2aba49026b2e48739c11b4d8ffbb24dd4a6e41b9763862af96787a08839081808280098009098391089082827fd0e704566c49e1a11edc2c128b2e07f36dc0c755468268f8fe4c4859b9fa595b08839081808280098009098391089082827f263e1195090d00be1d8fb37de17ccf3b66d180645efa0d831865cfaa8797769e08839081808280098009098391089082827fe65c090eebde2cfa7f9c92cf75641c7683fb8e81f4a48f5b7a9c7eb26a85029f08839081808280098009098391089082827fa18971781c6855f6a9752912780bb9b719c14a677a4c6393d62d6e046b97a2ac08839081808280098009098391089082827ff6fc1ef1bca8bec055cc66edecc5dc99030fe78311a3f21d8cd624df4f89e62508839081808280098009098391089082827f824e4e2838501516d3296542cb47a59a1ca4326e947c9c874d88dccc8e37b99a08839081808280098009098391089082827f3cd5a9e7353a50e454c9c1381b556b543897cc89153c3e3749f2021d8237226308839081808280098009098391089082827fb4bcedbd54d0c917a315cc7ca785e3c5995abbeeb3deb3ebaf02c7a9bf6cc83f08839081808280098009098391089082827f1f7476211105b3039cef009c51155ae93526c53a74973ecfce40754b3df1052108839081808280098009098391089082827f58aefbd978440c94b4b9fbd36e00e6e36caeacf82b0da0a6161d34c541a5a6e308839081808280098009098391089082827fc22cd6d61be780a33c77677bc6ba40307b597ed981db57cb485313eec2a5a49708839081808280098009098391089082827fd9ffc4fe0dc5f835c8dcdc1e60b8f0b1637f32a809175371b94a057272b0748d08839081808280098009098391089082827ff6a5268541bc4c64ad0ade8f55dda3492604857a71c923662a214dd7e9c20c1008839081808280098009098391089082826000088390818082800980090983910860205260005260406000f3";function f(e){return e.sendTransaction({data:c})}},83968:(e,a,t)=>{"use strict";t.d(a,{Fl:()=>C,mc:()=>M,W7:()=>B});const c=(e,a)=>a.some((a=>e instanceof a));let f,d;const r=new WeakMap,n=new WeakMap,i=new WeakMap;let b={get(e,a,t){if(e instanceof IDBTransaction){if("done"===a)return r.get(e);if("store"===a)return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return l(e[a])},set:(e,a,t)=>(e[a]=t,!0),has:(e,a)=>e instanceof IDBTransaction&&("done"===a||"store"===a)||a in e};function o(e){b=e(b)}function s(e){return"function"==typeof e?(a=e,(d||(d=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(a)?function(...e){return a.apply(u(this),e),l(this.request)}:function(...e){return l(a.apply(u(this),e))}):(e instanceof IDBTransaction&&function(e){if(r.has(e))return;const a=new Promise(((a,t)=>{const c=()=>{e.removeEventListener("complete",f),e.removeEventListener("error",d),e.removeEventListener("abort",d)},f=()=>{a(),c()},d=()=>{t(e.error||new DOMException("AbortError","AbortError")),c()};e.addEventListener("complete",f),e.addEventListener("error",d),e.addEventListener("abort",d)}));r.set(e,a)}(e),c(e,f||(f=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,b):e);var a}function l(e){if(e instanceof IDBRequest)return function(e){const a=new Promise(((a,t)=>{const c=()=>{e.removeEventListener("success",f),e.removeEventListener("error",d)},f=()=>{a(l(e.result)),c()},d=()=>{t(e.error),c()};e.addEventListener("success",f),e.addEventListener("error",d)}));return i.set(a,e),a}(e);if(n.has(e))return n.get(e);const a=s(e);return a!==e&&(n.set(e,a),i.set(a,e)),a}const u=e=>i.get(e),h=["get","getKey","getAll","getAllKeys","count"],p=["put","add","delete","clear"],g=new Map;function m(e,a){if(!(e instanceof IDBDatabase)||a in e||"string"!=typeof a)return;if(g.get(a))return g.get(a);const t=a.replace(/FromIndex$/,""),c=a!==t,f=p.includes(t);if(!(t in(c?IDBIndex:IDBObjectStore).prototype)||!f&&!h.includes(t))return;const d=async function(e,...a){const d=this.transaction(e,f?"readwrite":"readonly");let r=d.store;return c&&(r=r.index(a.shift())),(await Promise.all([r[t](...a),f&&d.done]))[0]};return g.set(a,d),d}o((e=>({...e,get:(a,t,c)=>m(a,t)||e.get(a,t,c),has:(a,t)=>!!m(a,t)||e.has(a,t)})));const x=["continue","continuePrimaryKey","advance"],y={},A=new WeakMap,v=new WeakMap,w={get(e,a){if(!x.includes(a))return e[a];let t=y[a];return t||(t=y[a]=function(...e){A.set(this,v.get(this)[a](...e))}),t}};async function*_(...e){let a=this;if(a instanceof IDBCursor||(a=await a.openCursor(...e)),!a)return;const t=new Proxy(a,w);for(v.set(t,a),i.set(t,u(a));a;)yield t,a=await(A.get(t)||a.continue()),A.delete(t)}function I(e,a){return a===Symbol.asyncIterator&&c(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===a&&c(e,[IDBIndex,IDBObjectStore])}o((e=>({...e,get:(a,t,c)=>I(a,t)?_:e.get(a,t,c),has:(a,t)=>I(a,t)||e.has(a,t)})));var E=t(59499);const C="A mutation operation was attempted on a database that did not allow mutations.";class M{dbExists;isBlocked;options;dbName;dbVersion;db;constructor({dbName:e,stores:a}){this.dbExists=!1,this.isBlocked=!1,this.options={upgrade(e){Object.values(e.objectStoreNames).forEach((a=>{e.deleteObjectStore(a)})),[{name:"keyval"},...a||[]].forEach((({name:a,keyPath:t,indexes:c})=>{const f=e.createObjectStore(a,{keyPath:t,autoIncrement:!0});Array.isArray(c)&&c.forEach((({name:e,unique:a=!1})=>{f.createIndex(e,e,{unique:a})}))}))}},this.dbName=e,this.dbVersion=35}async initDB(){try{if(this.dbExists||this.isBlocked)return;this.db=await function(e,a,{blocked:t,upgrade:c,blocking:f,terminated:d}={}){const r=indexedDB.open(e,a),n=l(r);return c&&r.addEventListener("upgradeneeded",(e=>{c(l(r.result),e.oldVersion,e.newVersion,l(r.transaction),e)})),t&&r.addEventListener("blocked",(e=>t(e.oldVersion,e.newVersion,e))),n.then((e=>{d&&e.addEventListener("close",(()=>d())),f&&e.addEventListener("versionchange",(e=>f(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),n}(this.dbName,this.dbVersion,this.options),this.db.addEventListener("onupgradeneeded",(async()=>{await this._removeExist()})),this.dbExists=!0}catch(e){if(e.message.includes(C))return console.log("This browser does not support IndexedDB!"),void(this.isBlocked=!0);if(e.message.includes("less than the existing version"))return console.log(`Upgrading DB ${this.dbName} to ${this.dbVersion}`),void await this._removeExist();console.error(`Method initDB has error: ${e.message}`)}}async _removeExist(){await function(e,{blocked:a}={}){const t=indexedDB.deleteDatabase(e);return a&&t.addEventListener("blocked",(e=>a(e.oldVersion,e))),l(t).then((()=>{}))}(this.dbName),this.dbExists=!1,await this.initDB()}async getFromIndex({storeName:e,indexName:a,key:t}){if(await this.initDB(),this.db)try{return await this.db.getFromIndex(e,a,t)}catch(e){throw new Error(`Method getFromIndex has error: ${e.message}`)}}async getAllFromIndex({storeName:e,indexName:a,key:t,count:c}){if(await this.initDB(),!this.db)return[];try{return await this.db.getAllFromIndex(e,a,t,c)}catch(e){throw new Error(`Method getAllFromIndex has error: ${e.message}`)}}async getItem({storeName:e,key:a}){if(await this.initDB(),this.db)try{const t=this.db.transaction(e).objectStore(e);return await t.get(a)}catch(e){throw new Error(`Method getItem has error: ${e.message}`)}}async addItem({storeName:e,data:a,key:t=""}){if(await this.initDB(),this.db)try{const c=this.db.transaction(e,"readwrite");await c.objectStore(e).get(t)||await c.objectStore(e).add(a)}catch(e){throw new Error(`Method addItem has error: ${e.message}`)}}async putItem({storeName:e,data:a,key:t}){if(await this.initDB(),this.db)try{const c=this.db.transaction(e,"readwrite");await c.objectStore(e).put(a,t)}catch(e){throw new Error(`Method putItem has error: ${e.message}`)}}async deleteItem({storeName:e,key:a}){if(await this.initDB(),this.db)try{const t=this.db.transaction(e,"readwrite");await t.objectStore(e).delete(a)}catch(e){throw new Error(`Method deleteItem has error: ${e.message}`)}}async getAll({storeName:e}){if(await this.initDB(),!this.db)return[];try{const a=this.db.transaction(e,"readonly");return await a.objectStore(e).getAll()}catch(e){throw new Error(`Method getAll has error: ${e.message}`)}}getValue(e){return this.getItem({storeName:"keyval",key:e})}setValue(e,a){return this.putItem({storeName:"keyval",key:e,data:a})}delValue(e){return this.deleteItem({storeName:"keyval",key:e})}async clearStore({storeName:e,mode:a="readwrite"}){if(await this.initDB(),this.db)try{const t=this.db.transaction(e,a);await t.objectStore(e).clear()}catch(e){throw new Error(`Method clearStore has error: ${e.message}`)}}async createTransactions({storeName:e,data:a,mode:t="readwrite"}){if(await this.initDB(),this.db)try{const c=this.db.transaction(e,t);await c.objectStore(e).add(a),await c.done}catch(e){throw new Error(`Method createTransactions has error: ${e.message}`)}}async createMultipleTransactions({storeName:e,data:a,index:t,mode:c="readwrite"}){if(await this.initDB(),this.db)try{const f=this.db.transaction(e,c);for(const e of a)e&&await f.store.put({...e,...t})}catch(e){throw new Error(`Method createMultipleTransactions has error: ${e.message}`)}}}async function B(e){if(!e){const e=new M({dbName:"tornado-core"});return await e.initDB(),e}const a=[{name:"blockNumber",unique:!1},{name:"transactionHash",unique:!1}],t=[{name:`echo_${e}`,keyPath:"eid",indexes:[...a,{name:"address",unique:!1}]},{name:`encrypted_notes_${e}`,keyPath:"eid",indexes:a},{name:"lastEvents",keyPath:"name",indexes:[{name:"name",unique:!1}]}],c=(0,E.zj)(e),{tokens:f,nativeCurrency:d,registryContract:r,governanceContract:n}=c,i=[...t];r&&(i.push({name:`registry_${e}`,keyPath:"ensName",indexes:[...a,{name:"event",unique:!1}]}),i.push({name:`relayers_${e}`,keyPath:"timestamp",indexes:[{name:"timestamp",unique:!0}]}),i.push({name:`revenue_${e}`,keyPath:"timestamp",indexes:[{name:"timestamp",unique:!0}]})),n&&i.push({name:`governance_${e}`,keyPath:"eid",indexes:[...a,{name:"event",unique:!1}]}),Object.entries(f).forEach((([t,{instanceAddress:c}])=>{Object.keys(c).forEach((c=>{d===t&&i.push({name:`stringify_bloom_${e}_${t}_${c}`,keyPath:"hashBloom",indexes:[]},{name:`stringify_tree_${e}_${t}_${c}`,keyPath:"hashTree",indexes:[]}),i.push({name:`deposits_${e}_${t}_${c}`,keyPath:"leafIndex",indexes:[...a,{name:"commitment",unique:!0}]},{name:`withdrawals_${e}_${t}_${c}`,keyPath:"eid",indexes:[...a,{name:"nullifierHash",unique:!0}]})}))}));const b=new M({dbName:`tornado_core_${e}`,stores:i});return await b.initDB(),b}},57390:(e,a,t)=>{"use strict";t.d(a,{W:()=>f});var c=t(46170);async function f(e){return await(0,c.Fd)(e,{method:"GET",timeout:3e4})}},5217:(e,a,t)=>{"use strict";t.d(a,{s:()=>n});var c=t(47882),f=t(41217),d=t(67418),r=t(22901);class n{currency;amount;netId;Tornado;commitmentHex;instanceName;merkleTreeHeight;emptyElement;merkleWorkerPath;constructor({netId:e,amount:a,currency:t,Tornado:c,commitmentHex:f,merkleTreeHeight:d=20,emptyElement:r="21663839004416932945382355908790599225266501822907911457504978515578255421292",merkleWorkerPath:n}){const i=`${e}_${t}_${a}`;this.currency=t,this.amount=a,this.netId=Number(e),this.Tornado=c,this.instanceName=i,this.commitmentHex=f,this.merkleTreeHeight=d,this.emptyElement=r,this.merkleWorkerPath=n}async createTree(e){const{hash:a}=await r.f.getHash();if(this.merkleWorkerPath){console.log("Using merkleWorker\n");try{if(d.Ll){const t=new Promise(((a,t)=>{const f=new c.Worker(this.merkleWorkerPath,{workerData:{merkleTreeHeight:this.merkleTreeHeight,elements:e,zeroElement:this.emptyElement}});f.on("message",a),f.on("error",t),f.on("exit",(e=>{0!==e&&t(new Error(`Worker stopped with exit code ${e}`))}))}));return f.MerkleTree.deserialize(JSON.parse(await t),a)}{const t=new Promise(((a,t)=>{const c=new Worker(this.merkleWorkerPath);c.onmessage=e=>{a(e.data)},c.onerror=e=>{t(e)},c.postMessage({merkleTreeHeight:this.merkleTreeHeight,elements:e,zeroElement:this.emptyElement})}));return f.MerkleTree.deserialize(JSON.parse(await t),a)}}catch(e){console.log("merkleWorker failed, falling back to synchronous merkle tree"),console.log(e)}}return new f.MerkleTree(this.merkleTreeHeight,e,{zeroElement:this.emptyElement,hashFunction:a})}async createPartialTree({edge:e,elements:a}){const{hash:t}=await r.f.getHash();if(this.merkleWorkerPath){console.log("Using merkleWorker\n");try{if(d.Ll){const d=new Promise(((t,f)=>{const d=new c.Worker(this.merkleWorkerPath,{workerData:{merkleTreeHeight:this.merkleTreeHeight,edge:e,elements:a,zeroElement:this.emptyElement}});d.on("message",t),d.on("error",f),d.on("exit",(e=>{0!==e&&f(new Error(`Worker stopped with exit code ${e}`))}))}));return f.PartialMerkleTree.deserialize(JSON.parse(await d),t)}{const c=new Promise(((t,c)=>{const f=new Worker(this.merkleWorkerPath);f.onmessage=e=>{t(e.data)},f.onerror=e=>{c(e)},f.postMessage({merkleTreeHeight:this.merkleTreeHeight,edge:e,elements:a,zeroElement:this.emptyElement})}));return f.PartialMerkleTree.deserialize(JSON.parse(await c),t)}}catch(e){console.log("merkleWorker failed, falling back to synchronous merkle tree"),console.log(e)}}return new f.PartialMerkleTree(this.merkleTreeHeight,e,a,{zeroElement:this.emptyElement,hashFunction:t})}async verifyTree(e){console.log(`\nCreating deposit tree for ${this.netId} ${this.amount} ${this.currency.toUpperCase()} would take a while\n`);const a=Date.now(),t=await this.createTree(e.map((({commitment:e})=>e)));if(!await this.Tornado.isKnownRoot((0,d.$W)(BigInt(t.root)))){const e=`Deposit Event ${this.netId} ${this.amount} ${this.currency} is invalid`;throw new Error(e)}return console.log(`\nCreated ${this.netId} ${this.amount} ${this.currency.toUpperCase()} tree in ${Date.now()-a}ms\n`),t}}},22901:(e,a,t)=>{"use strict";t.d(a,{f:()=>d,p:()=>f});var c=t(90294);class f{sponge;hash;mimcPromise;constructor(){this.mimcPromise=this.initMimc()}async initMimc(){this.sponge=await(0,c.HI)(),this.hash=(e,a)=>this.sponge?.F.toString(this.sponge?.multiHash([BigInt(e),BigInt(a)]))}async getHash(){return await this.mimcPromise,{sponge:this.sponge,hash:this.hash}}}const d=new f},48486:(e,a,t)=>{"use strict";async function c(e,a){const t=a.map((e=>({target:e.contract?.target||e.address,callData:(e.contract?.interface||e.interface).encodeFunctionData(e.name,e.params),allowFailure:e.allowFailure??!1})));return(await e.aggregate3.staticCall(t)).map(((e,t)=>{const c=a[t].contract?.interface||a[t].interface,[f,d]=e,r=f&&d&&"0x"!==d?c.decodeFunctionResult(a[t].name,d):null;return r?1===r.length?r[0]:r:null}))}t.d(a,{C:()=>c})},59499:(e,a,t)=>{"use strict";t.d(a,{AE:()=>n,Af:()=>d,RY:()=>i,Zh:()=>l,cX:()=>r,h9:()=>o,o2:()=>u,oY:()=>s,sX:()=>h,sb:()=>f,zj:()=>b,zr:()=>c});var c=(e=>(e[e.MAINNET=1]="MAINNET",e[e.BSC=56]="BSC",e[e.POLYGON=137]="POLYGON",e[e.OPTIMISM=10]="OPTIMISM",e[e.ARBITRUM=42161]="ARBITRUM",e[e.GNOSIS=100]="GNOSIS",e[e.AVALANCHE=43114]="AVALANCHE",e[e.SEPOLIA=11155111]="SEPOLIA",e))(c||{});const f={1:{rpcCallRetryAttempt:15,gasPrices:{instant:80,fast:50,standard:25,low:8},nativeCurrency:"eth",currencyName:"ETH",explorerUrl:"https://etherscan.io",merkleTreeHeight:20,emptyElement:"21663839004416932945382355908790599225266501822907911457504978515578255421292",networkName:"Ethereum Mainnet",deployedBlock:9116966,rpcUrls:{mevblockerRPC:{name:"MEV Blocker",url:"https://rpc.mevblocker.io"},keydonix:{name:"Horswap ( Keydonix )",url:"https://ethereum.keydonix.com/v1/mainnet"},SecureRpc:{name:"SecureRpc",url:"https://api.securerpc.com/v1"},stackup:{name:"Stackup",url:"https://public.stackup.sh/api/v1/node/ethereum-mainnet"},oneRpc:{name:"1RPC",url:"https://1rpc.io/eth"}},stablecoin:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",multicallContract:"0xcA11bde05977b3631167028862bE2a173976CA11",routerContract:"0xd90e2f925DA726b50C4Ed8D0Fb90Ad053324F31b",echoContract:"0x9B27DD5Bb15d42DC224FCD0B7caEbBe16161Df42",offchainOracleContract:"0x00000000000D6FFc74A8feb35aF5827bf57f6786",tornContract:"0x77777FeDdddFfC19Ff86DB637967013e6C6A116C",governanceContract:"0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce",stakingRewardsContract:"0x5B3f656C80E8ddb9ec01Dd9018815576E9238c29",registryContract:"0x58E8dCC13BE9780fC42E8723D8EaD4CF46943dF2",aggregatorContract:"0xE8F47A78A6D52D317D0D2FFFac56739fE14D1b49",reverseRecordsContract:"0x3671aE578E63FdF66ad4F3E12CC0c0d71Ac7510C",tornadoSubgraph:"tornadocash/mainnet-tornado-subgraph",registrySubgraph:"tornadocash/tornado-relayer-registry",governanceSubgraph:"tornadocash/tornado-governance",subgraphs:{},tokens:{eth:{instanceAddress:{.1:"0x12D66f87A04A9E220743712cE6d9bB1B5616B8Fc",1:"0x47CE0C6eD5B0Ce3d3A51fdb1C52DC66a7c3c2936",10:"0x910Cbd523D972eb0a6f4cAe4618aD62622b39DbF",100:"0xA160cdAB225685dA1d56aa342Ad8841c3b53f291"},symbol:"ETH",decimals:18},dai:{instanceAddress:{100:"0xD4B88Df4D29F5CedD6857912842cff3b20C8Cfa3",1e3:"0xFD8610d20aA15b7B2E3Be39B396a1bC3516c7144",1e4:"0x07687e702b410Fa43f4cB4Af7FA097918ffD2730",1e5:"0x23773E65ed146A459791799d01336DB287f25334"},tokenAddress:"0x6B175474E89094C44Da98b954EedeAC495271d0F",tokenGasLimit:7e4,symbol:"DAI",decimals:18,gasLimit:7e5},cdai:{instanceAddress:{5e3:"0x22aaA7720ddd5388A3c0A3333430953C68f1849b",5e4:"0x03893a7c7463AE47D46bc7f091665f1893656003",5e5:"0x2717c5e28cf931547B621a5dddb772Ab6A35B701",5e6:"0xD21be7248e0197Ee08E0c20D4a96DEBdaC3D20Af"},tokenAddress:"0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643",tokenGasLimit:2e5,symbol:"cDAI",decimals:8,gasLimit:7e5},usdc:{instanceAddress:{100:"0xd96f2B1c14Db8458374d9Aca76E26c3D18364307",1e3:"0x4736dCf1b7A3d580672CcE6E7c65cd5cc9cFBa9D"},tokenAddress:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",tokenGasLimit:7e4,symbol:"USDC",decimals:6,gasLimit:7e5},usdt:{instanceAddress:{100:"0x169AD27A470D064DEDE56a2D3ff727986b15D52B",1e3:"0x0836222F2B2B24A3F36f98668Ed8F0B38D1a872f"},tokenAddress:"0xdAC17F958D2ee523a2206206994597C13D831ec7",tokenGasLimit:7e4,symbol:"USDT",decimals:6,gasLimit:7e5},wbtc:{instanceAddress:{.1:"0x178169B423a011fff22B9e3F3abeA13414dDD0F1",1:"0x610B717796ad172B316836AC95a2ffad065CeaB4",10:"0xbB93e510BbCD0B7beb5A853875f9eC60275CF498"},tokenAddress:"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",tokenGasLimit:7e4,symbol:"WBTC",decimals:8,gasLimit:7e5}},disabledTokens:["cdai","usdt","usdc"],relayerEnsSubdomain:"mainnet-tornado",pollInterval:15,constants:{GOVERNANCE_BLOCK:11474695,NOTE_ACCOUNT_BLOCK:11842486,ENCRYPTED_NOTES_BLOCK:12143762,REGISTRY_BLOCK:14173129,MINING_BLOCK_TIME:15}},56:{rpcCallRetryAttempt:15,gasPrices:{instant:5,fast:5,standard:5,low:5},nativeCurrency:"bnb",currencyName:"BNB",explorerUrl:"https://bscscan.com",merkleTreeHeight:20,emptyElement:"21663839004416932945382355908790599225266501822907911457504978515578255421292",networkName:"Binance Smart Chain",deployedBlock:8158799,stablecoin:"0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",multicallContract:"0xcA11bde05977b3631167028862bE2a173976CA11",routerContract:"0x0D5550d52428E7e3175bfc9550207e4ad3859b17",echoContract:"0xa75BF2815618872f155b7C4B0C81bF990f5245E4",offchainOracleContract:"0x00000000000D6FFc74A8feb35aF5827bf57f6786",tornadoSubgraph:"tornadocash/bsc-tornado-subgraph",subgraphs:{},rpcUrls:{bnbchain:{name:"BNB Chain",url:"https://bsc-dataseed.bnbchain.org"},ninicoin:{name:"BNB Chain 2",url:"https://bsc-dataseed1.ninicoin.io"},nodereal:{name:"NodeReal",url:"https://binance.nodereal.io"},stackup:{name:"Stackup",url:"https://public.stackup.sh/api/v1/node/bsc-mainnet"},oneRpc:{name:"1RPC",url:"https://1rpc.io/bnb"}},tokens:{bnb:{instanceAddress:{.1:"0x84443CFd09A48AF6eF360C6976C5392aC5023a1F",1:"0xd47438C816c9E7f2E2888E060936a499Af9582b3",10:"0x330bdFADE01eE9bF63C209Ee33102DD334618e0a",100:"0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD"},symbol:"BNB",decimals:18}},relayerEnsSubdomain:"bsc-tornado",pollInterval:10,constants:{NOTE_ACCOUNT_BLOCK:8159269,ENCRYPTED_NOTES_BLOCK:8159269}},137:{rpcCallRetryAttempt:15,gasPrices:{instant:100,fast:75,standard:50,low:30},nativeCurrency:"matic",currencyName:"MATIC",explorerUrl:"https://polygonscan.com",merkleTreeHeight:20,emptyElement:"21663839004416932945382355908790599225266501822907911457504978515578255421292",networkName:"Polygon (Matic) Network",deployedBlock:16257962,stablecoin:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",multicallContract:"0xcA11bde05977b3631167028862bE2a173976CA11",routerContract:"0x0D5550d52428E7e3175bfc9550207e4ad3859b17",echoContract:"0xa75BF2815618872f155b7C4B0C81bF990f5245E4",offchainOracleContract:"0x00000000000D6FFc74A8feb35aF5827bf57f6786",tornadoSubgraph:"tornadocash/matic-tornado-subgraph",subgraphs:{},rpcUrls:{oneRpc:{name:"1RPC",url:"https://1rpc.io/matic"},stackup:{name:"Stackup",url:"https://public.stackup.sh/api/v1/node/polygon-mainnet"}},tokens:{matic:{instanceAddress:{100:"0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD",1e3:"0xdf231d99Ff8b6c6CBF4E9B9a945CBAcEF9339178",1e4:"0xaf4c0B70B2Ea9FB7487C7CbB37aDa259579fe040",1e5:"0xa5C2254e4253490C54cef0a4347fddb8f75A4998"},symbol:"MATIC",decimals:18}},relayerEnsSubdomain:"polygon-tornado",pollInterval:10,constants:{NOTE_ACCOUNT_BLOCK:16257996,ENCRYPTED_NOTES_BLOCK:16257996}},10:{rpcCallRetryAttempt:15,gasPrices:{instant:.001,fast:.001,standard:.001,low:.001},nativeCurrency:"eth",currencyName:"ETH",explorerUrl:"https://optimistic.etherscan.io",merkleTreeHeight:20,emptyElement:"21663839004416932945382355908790599225266501822907911457504978515578255421292",networkName:"Optimism",deployedBlock:2243689,stablecoin:"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",multicallContract:"0xcA11bde05977b3631167028862bE2a173976CA11",routerContract:"0x0D5550d52428E7e3175bfc9550207e4ad3859b17",echoContract:"0xa75BF2815618872f155b7C4B0C81bF990f5245E4",offchainOracleContract:"0x00000000000D6FFc74A8feb35aF5827bf57f6786",ovmGasPriceOracleContract:"0x420000000000000000000000000000000000000F",tornadoSubgraph:"tornadocash/optimism-tornado-subgraph",subgraphs:{},rpcUrls:{oneRpc:{name:"1RPC",url:"https://1rpc.io/op"},stackup:{name:"Stackup",url:"https://public.stackup.sh/api/v1/node/optimism-mainnet"}},tokens:{eth:{instanceAddress:{.1:"0x84443CFd09A48AF6eF360C6976C5392aC5023a1F",1:"0xd47438C816c9E7f2E2888E060936a499Af9582b3",10:"0x330bdFADE01eE9bF63C209Ee33102DD334618e0a",100:"0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD"},symbol:"ETH",decimals:18}},relayerEnsSubdomain:"optimism-tornado",pollInterval:15,constants:{NOTE_ACCOUNT_BLOCK:2243694,ENCRYPTED_NOTES_BLOCK:2243694}},42161:{rpcCallRetryAttempt:15,gasPrices:{instant:4,fast:3,standard:2.52,low:2.29},nativeCurrency:"eth",currencyName:"ETH",explorerUrl:"https://arbiscan.io",merkleTreeHeight:20,emptyElement:"21663839004416932945382355908790599225266501822907911457504978515578255421292",networkName:"Arbitrum One",deployedBlock:3430648,stablecoin:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",multicallContract:"0xcA11bde05977b3631167028862bE2a173976CA11",routerContract:"0x0D5550d52428E7e3175bfc9550207e4ad3859b17",echoContract:"0xa75BF2815618872f155b7C4B0C81bF990f5245E4",offchainOracleContract:"0x00000000000D6FFc74A8feb35aF5827bf57f6786",tornadoSubgraph:"tornadocash/arbitrum-tornado-subgraph",subgraphs:{},rpcUrls:{Arbitrum:{name:"Arbitrum",url:"https://arb1.arbitrum.io/rpc"},stackup:{name:"Stackup",url:"https://public.stackup.sh/api/v1/node/arbitrum-one"},oneRpc:{name:"1RPC",url:"https://1rpc.io/arb"}},tokens:{eth:{instanceAddress:{.1:"0x84443CFd09A48AF6eF360C6976C5392aC5023a1F",1:"0xd47438C816c9E7f2E2888E060936a499Af9582b3",10:"0x330bdFADE01eE9bF63C209Ee33102DD334618e0a",100:"0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD"},symbol:"ETH",decimals:18}},relayerEnsSubdomain:"arbitrum-tornado",pollInterval:15,constants:{NOTE_ACCOUNT_BLOCK:3430605,ENCRYPTED_NOTES_BLOCK:3430605}},100:{rpcCallRetryAttempt:15,gasPrices:{instant:6,fast:5,standard:4,low:1},nativeCurrency:"xdai",currencyName:"xDAI",explorerUrl:"https://gnosisscan.io",merkleTreeHeight:20,emptyElement:"21663839004416932945382355908790599225266501822907911457504978515578255421292",networkName:"Gnosis Chain",deployedBlock:17754561,stablecoin:"0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83",multicallContract:"0xcA11bde05977b3631167028862bE2a173976CA11",routerContract:"0x0D5550d52428E7e3175bfc9550207e4ad3859b17",echoContract:"0xa75BF2815618872f155b7C4B0C81bF990f5245E4",offchainOracleContract:"0x00000000000D6FFc74A8feb35aF5827bf57f6786",tornadoSubgraph:"tornadocash/xdai-tornado-subgraph",subgraphs:{},rpcUrls:{gnosis:{name:"Gnosis",url:"https://rpc.gnosischain.com"},oneRpc:{name:"1RPC",url:"https://1rpc.io/gnosis"}},tokens:{xdai:{instanceAddress:{100:"0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD",1e3:"0xdf231d99Ff8b6c6CBF4E9B9a945CBAcEF9339178",1e4:"0xaf4c0B70B2Ea9FB7487C7CbB37aDa259579fe040",1e5:"0xa5C2254e4253490C54cef0a4347fddb8f75A4998"},symbol:"xDAI",decimals:18}},relayerEnsSubdomain:"gnosis-tornado",pollInterval:15,constants:{NOTE_ACCOUNT_BLOCK:17754564,ENCRYPTED_NOTES_BLOCK:17754564}},43114:{rpcCallRetryAttempt:15,gasPrices:{instant:225,fast:35,standard:25,low:25},nativeCurrency:"avax",currencyName:"AVAX",explorerUrl:"https://snowtrace.io",merkleTreeHeight:20,emptyElement:"21663839004416932945382355908790599225266501822907911457504978515578255421292",networkName:"Avalanche Mainnet",deployedBlock:4429818,stablecoin:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",multicallContract:"0xcA11bde05977b3631167028862bE2a173976CA11",routerContract:"0x0D5550d52428E7e3175bfc9550207e4ad3859b17",echoContract:"0xa75BF2815618872f155b7C4B0C81bF990f5245E4",offchainOracleContract:"0x00000000000D6FFc74A8feb35aF5827bf57f6786",tornadoSubgraph:"tornadocash/avalanche-tornado-subgraph",subgraphs:{},rpcUrls:{oneRpc:{name:"1RPC",url:"https://1rpc.io/avax/c"},stackup:{name:"Stackup",url:"https://public.stackup.sh/api/v1/node/avalanche-mainnet"}},tokens:{avax:{instanceAddress:{10:"0x330bdFADE01eE9bF63C209Ee33102DD334618e0a",100:"0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD",500:"0xaf8d1839c3c67cf571aa74B5c12398d4901147B3"},symbol:"AVAX",decimals:18}},relayerEnsSubdomain:"avalanche-tornado",pollInterval:10,constants:{NOTE_ACCOUNT_BLOCK:4429813,ENCRYPTED_NOTES_BLOCK:4429813}},11155111:{rpcCallRetryAttempt:15,gasPrices:{instant:2,fast:2,standard:2,low:2},nativeCurrency:"eth",currencyName:"SepoliaETH",explorerUrl:"https://sepolia.etherscan.io",merkleTreeHeight:20,emptyElement:"21663839004416932945382355908790599225266501822907911457504978515578255421292",networkName:"Ethereum Sepolia",deployedBlock:5594395,stablecoin:"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",multicallContract:"0xcA11bde05977b3631167028862bE2a173976CA11",routerContract:"0x1572AFE6949fdF51Cb3E0856216670ae9Ee160Ee",echoContract:"0xcDD1fc3F5ac2782D83449d3AbE80D6b7B273B0e5",offchainOracleContract:"0x1f89EAF03E5b260Bc6D4Ae3c3334b1B750F3e127",tornContract:"0x3AE6667167C0f44394106E197904519D808323cA",governanceContract:"0xe5324cD7602eeb387418e594B87aCADee08aeCAD",stakingRewardsContract:"0x6d0018890751Efd31feb8166711B16732E2b496b",registryContract:"0x1428e5d2356b13778A13108b10c440C83011dfB8",aggregatorContract:"0x4088712AC9fad39ea133cdb9130E465d235e9642",reverseRecordsContract:"0xEc29700C0283e5Be64AcdFe8077d6cC95dE23C23",tornadoSubgraph:"tornadocash/sepolia-tornado-subgraph",subgraphs:{},rpcUrls:{sepolia:{name:"Sepolia RPC",url:"https://rpc.sepolia.org"},stackup:{name:"Stackup",url:"https://public.stackup.sh/api/v1/node/ethereum-sepolia"},oneRpc:{name:"1RPC",url:"https://1rpc.io/sepolia"},ethpandaops:{name:"ethpandaops",url:"https://rpc.sepolia.ethpandaops.io"}},tokens:{eth:{instanceAddress:{.1:"0x8C4A04d872a6C1BE37964A21ba3a138525dFF50b",1:"0x8cc930096B4Df705A007c4A039BDFA1320Ed2508",10:"0x8D10d506D29Fc62ABb8A290B99F66dB27Fc43585",100:"0x44c5C92ed73dB43888210264f0C8b36Fd68D8379"},symbol:"ETH",decimals:18},dai:{instanceAddress:{100:"0x6921fd1a97441dd603a997ED6DDF388658daf754",1e3:"0x50a637770F5d161999420F7d70d888DE47207145",1e4:"0xecD649870407cD43923A816Cc6334a5bdf113621",1e5:"0x73B4BD04bF83206B6e979BE2507098F92EDf4F90"},tokenAddress:"0xFF34B3d4Aee8ddCd6F9AFFFB6Fe49bD371b8a357",tokenGasLimit:7e4,symbol:"DAI",decimals:18,gasLimit:7e5}},relayerEnsSubdomain:"sepolia-tornado",pollInterval:15,constants:{GOVERNANCE_BLOCK:5594395,NOTE_ACCOUNT_BLOCK:5594395,ENCRYPTED_NOTES_BLOCK:5594395,REGISTRY_BLOCK:5594395,MINING_BLOCK_TIME:15}}},d=Object.values(c).filter((e=>"number"==typeof e));let r={};function n(e){d.push(...Object.keys(e).map((e=>Number(e))).filter((e=>!d.includes(e)))),r={...r,...e}}function i(){const e={...f,...r};return d.reduce(((a,t)=>(a[t]=e[t],a)),{})}function b(e){const a=i()[e];if(!a)throw new Error(`No config found for network ${e}!`);return a}function o(e){const{tokens:a,disabledTokens:t}=e;return Object.keys(a).filter((e=>!t?.includes(e)))}function s(e){const{tokens:a,disabledTokens:t}=e;return Object.entries(a).reduce(((e,[a,c])=>(t?.includes(a)||(e[a]=c),e)),{})}function l(e,a){const{tokens:t,disabledTokens:c}=e;for(const[e,{instanceAddress:f,tokenAddress:d,symbol:r,decimals:n}]of Object.entries(t))if(!c?.includes(e))for(const[t,c]of Object.entries(f))if(c===a)return{amount:t,currency:e,symbol:r,decimals:n,tokenAddress:d}}function u(){const e=i();return d.reduce(((a,t)=>(a[t]=e[t].relayerEnsSubdomain,a)),{})}function h(e,a){return Object.entries(a.tokens).reduce(((a,[t,{instanceAddress:c}])=>(Object.entries(c).forEach((([c,f])=>{a[f]={currency:t,amount:c,netId:e}})),a)),{})}},85111:(e,a,t)=>{"use strict";t.d(a,{Hr:()=>f,NO:()=>d,UB:()=>r});var c=t(90294);class f{pedersenHash;babyJub;pedersenPromise;constructor(){this.pedersenPromise=this.initPedersen()}async initPedersen(){this.pedersenHash=await(0,c.vu)(),this.babyJub=this.pedersenHash.babyJub}async unpackPoint(e){return await this.pedersenPromise,this.babyJub?.unpackPoint(this.pedersenHash?.hash(e))}toStringBuffer(e){return this.babyJub?.F.toString(e)}}const d=new f;async function r(e){const[a]=await d.unpackPoint(e);return d.toStringBuffer(a)}},1180:(e,a,t)=>{"use strict";t.d(a,{Sl:()=>_,KM:()=>w,sx:()=>v,id:()=>A,CS:()=>y});var c=t(20260);BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),BigInt("1000000000000000000");const f=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");BigInt("0x8000000000000000000000000000000000000000000000000000000000000000"),BigInt(-1),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var d=t(30031),r=t(2011),n=t(36212),i=t(87303),b=t(57339),o=t(27033);const s=new RegExp("^bytes([0-9]+)$"),l=new RegExp("^(u?int)([0-9]*)$"),u=new RegExp("^(.*)\\[([0-9]*)\\]$");function h(e,a,t){switch(e){case"address":return t?(0,n.q5)((0,n.nx)(a,32)):(0,n.q5)((0,d.b)(a));case"string":return(0,i.YW)(a);case"bytes":return(0,n.q5)(a);case"bool":return a=a?"0x01":"0x00",t?(0,n.q5)((0,n.nx)(a,32)):(0,n.q5)(a)}let c=e.match(l);if(c){let f="int"===c[1],d=parseInt(c[2]||"256");return(0,b.MR)((!c[2]||c[2]===String(d))&&d%8==0&&0!==d&&d<=256,"invalid number type","type",e),t&&(d=256),f&&(a=(0,o.JJ)(a,d)),(0,n.q5)((0,n.nx)((0,o.c4)(a),d/8))}if(c=e.match(s),c){const f=parseInt(c[1]);return(0,b.MR)(String(f)===c[1]&&0!==f&&f<=32,"invalid bytes type","type",e),(0,b.MR)((0,n.pO)(a)===f,`invalid value for ${e}`,"value",a),t?(0,n.q5)((0,n.X_)(a,32)):a}if(c=e.match(u),c&&Array.isArray(a)){const t=c[1],f=parseInt(c[2]||String(a.length));(0,b.MR)(f===a.length,`invalid array length for ${e}`,"value",a);const d=[];return a.forEach((function(e){d.push(h(t,e,!0))})),(0,n.q5)((0,n.xW)(d))}(0,b.MR)(!1,"invalid type","type",e)}function p(e,a){(0,b.MR)(e.length===a.length,"wrong number of values; expected ${ types.length }","values",a);const t=[];return e.forEach((function(e,c){t.push(h(e,a[c]))})),(0,n.c$)((0,n.xW)(t))}function g(e,a){return(0,r.S)(p(e,a))}var m=t(82314),x=t(67418);const y="0x000000000022D473030F116dDEE9F6B43aC78BA3";async function A({Token:e,signer:a,spender:t,value:d,nonce:r,deadline:n}){const i=a||e.runner,b=i.provider,[o,s,{chainId:l}]=await Promise.all([e.name(),e.nonces(i.address),b.getNetwork()]),u={name:o,version:"1",chainId:l,verifyingContract:e.target};return c.t.from(await i.signTypedData(u,{Permit:[{name:"owner",type:"address"},{name:"spender",type:"address"},{name:"value",type:"uint256"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}]},{owner:i.address,spender:t,value:d,nonce:r||s,deadline:n||f}))}async function v({PermitTornado:e,Token:a,signer:t,denomination:c,commitments:f,nonce:d}){const r=BigInt(f.length)*c,n=g(["bytes32[]"],[f]);return await A({Token:a,signer:t,spender:e.target,value:r,nonce:d,deadline:BigInt(n)})}async function w({Token:e,signer:a,spender:t,value:d,nonce:r,deadline:n,witness:i}){const b=a||e.runner,o=b.provider,s={name:"Permit2",chainId:(await o.getNetwork()).chainId,verifyingContract:y},l=i?{PermitWitnessTransferFrom:[{name:"permitted",type:"TokenPermissions"},{name:"spender",type:"address"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"},{name:"witness",type:i.witnessTypeName}],TokenPermissions:[{name:"token",type:"address"},{name:"amount",type:"uint256"}],...i.witnessType}:{PermitTransferFrom:[{name:"permitted",type:"TokenPermissions"},{name:"spender",type:"address"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}],TokenPermissions:[{name:"token",type:"address"},{name:"amount",type:"uint256"}]},u={permitted:{token:e.target,amount:d},spender:t,nonce:r||(0,x.ib)(16),deadline:n||f};return i&&(u.witness=i.witness),{domain:s,types:l,values:u,hash:new m.z(l).hash(u),signature:c.t.from(await b.signTypedData(s,l,u))}}async function _({PermitTornado:e,Token:a,signer:t,denomination:c,commitments:f,nonce:d,deadline:r}){const n=BigInt(f.length)*c,i=g(["bytes32[]"],[f]);return await w({Token:a,signer:t,spender:e.target,value:n,nonce:d,deadline:r,witness:{witnessTypeName:"PermitCommitments",witnessType:{PermitCommitments:[{name:"instance",type:"address"},{name:"commitmentsHash",type:"bytes32"}]},witness:{instance:e.target,commitmentsHash:i}}})}},34525:(e,a,t)=>{"use strict";t.d(a,{T:()=>r});var c=t(99770),f=t(62463),d=t(48486);class r{oracle;multicall;provider;fallbackPrice;constructor(e,a,t){this.provider=e,this.multicall=a,this.oracle=t,this.fallbackPrice=(0,c.g5)("0.0001")}buildCalls(e){return e.map((({tokenAddress:e})=>({contract:this.oracle,name:"getRateToEth",params:[e,!0],allowFailure:!0})))}buildStable(e){const a=f.Xc.connect(e,this.provider);return[{contract:a,name:"decimals"},{contract:this.oracle,name:"getRateToEth",params:[a.target,!0],allowFailure:!0}]}async fetchPrice(e,a){if(!this.oracle)return new Promise((e=>e(this.fallbackPrice)));try{return await this.oracle.getRateToEth(e,!0)*BigInt(10**a)/BigInt(10**18)}catch(a){return console.log(`Failed to fetch oracle price for ${e}, will use fallback price ${this.fallbackPrice}`),console.log(a),this.fallbackPrice}}async fetchPrices(e){return this.oracle?(await(0,d.C)(this.multicall,this.buildCalls(e))).map(((a,t)=>(a||(a=this.fallbackPrice),a*BigInt(10**e[t].decimals)/BigInt(10**18)))):new Promise((a=>a(e.map((()=>this.fallbackPrice)))))}async fetchEthUSD(e){if(!this.oracle)return new Promise((e=>e(10**18/Number(this.fallbackPrice))));const[a,t]=await(0,d.C)(this.multicall,this.buildStable(e)),f=(t||this.fallbackPrice)*BigInt(10n**a)/BigInt(10**18);return 1/Number((0,c.ck)(f))}}},46170:(e,a,t)=>{"use strict";t.d(a,{D2:()=>pc,Vr:()=>hc,Gd:()=>uc,nA:()=>lc,mJ:()=>dc,Fd:()=>nc,uY:()=>ic,WU:()=>rc,sO:()=>bc,MF:()=>oc,zr:()=>sc});var c=t(74945),f=t.n(c),d=t(26976),r=t(35273),n=t(30031),i=t(41442),b=t(82314),o=t(8177),s=t(88081),l=t(57339),u=t(87303),h=t(36212),p=t(27033),g=t(98982),m=t(13269),x=t(64563),y=t(79453),A=t(99381),v=t(97876),w=t(7040),_=t(20260);const I=BigInt(0);function E(e,a){return function(t){return null==t?a:e(t)}}function C(e,a){return t=>{if(a&&null==t)return null;if(!Array.isArray(t))throw new Error("not an array");return t.map((a=>e(a)))}}function M(e,a){return t=>{const c={};for(const f in e){let d=f;if(a&&f in a&&!(d in t))for(const e of a[f])if(e in t){d=e;break}try{const a=e[f](t[d]);void 0!==a&&(c[f]=a)}catch(e){const a=e instanceof Error?e.message:"not-an-error";(0,l.vA)(!1,`invalid value for value.${f} (${a})`,"BAD_DATA",{value:t})}}return c}}function B(e){return(0,l.MR)((0,h.Lo)(e,!0),"invalid data","value",e),e}function k(e){return(0,l.MR)((0,h.Lo)(e,32),"invalid hash","value",e),e}const L=M({address:n.b,blockHash:k,blockNumber:p.WZ,data:B,index:p.WZ,removed:E((function(e){switch(e){case!0:case"true":return!0;case!1:case"false":return!1}(0,l.MR)(!1,`invalid boolean; ${JSON.stringify(e)}`,"value",e)}),!1),topics:C(k),transactionHash:k,transactionIndex:p.WZ},{index:["logIndex"]}),S=M({hash:E(k),parentHash:k,parentBeaconBlockRoot:E(k,null),number:p.WZ,timestamp:p.WZ,nonce:E(B),difficulty:p.Ab,gasLimit:p.Ab,gasUsed:p.Ab,stateRoot:E(k,null),receiptsRoot:E(k,null),blobGasUsed:E(p.Ab,null),excessBlobGas:E(p.Ab,null),miner:E(n.b),prevRandao:E(k,null),extraData:B,baseFeePerGas:E(p.Ab)},{prevRandao:["mixHash"]}),T=M({transactionIndex:p.WZ,blockNumber:p.WZ,transactionHash:k,address:n.b,topics:C(k),data:B,index:p.WZ,blockHash:k},{index:["logIndex"]}),N=M({to:E(n.b,null),from:E(n.b,null),contractAddress:E(n.b,null),index:p.WZ,root:E(h.c$),gasUsed:p.Ab,blobGasUsed:E(p.Ab,null),logsBloom:E(B),blockHash:k,hash:k,logs:C((function(e){return T(e)})),blockNumber:p.WZ,cumulativeGasUsed:p.Ab,effectiveGasPrice:E(p.Ab),blobGasPrice:E(p.Ab,null),status:E(p.WZ),type:E(p.WZ,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function R(e){e.to&&(0,p.Ab)(e.to)===I&&(e.to="0x0000000000000000000000000000000000000000");const a=M({hash:k,index:E(p.WZ,void 0),type:e=>"0x"===e||null==e?0:(0,p.WZ)(e),accessList:E(o.$,null),blobVersionedHashes:E(C(k,!0),null),blockHash:E(k,null),blockNumber:E(p.WZ,null),transactionIndex:E(p.WZ,null),from:n.b,gasPrice:E(p.Ab),maxPriorityFeePerGas:E(p.Ab),maxFeePerGas:E(p.Ab),maxFeePerBlobGas:E(p.Ab,null),gasLimit:p.Ab,to:E(n.b,null),value:p.Ab,nonce:p.WZ,data:B,creates:E(n.b,null),chainId:E(p.Ab,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(e);if(null==a.to&&null==a.creates&&(a.creates=(0,w.t)(a)),1!==e.type&&2!==e.type||null!=e.accessList||(a.accessList=[]),e.signature?a.signature=_.t.from(e.signature):a.signature=_.t.from(e),null==a.chainId){const e=a.signature.legacyChainId;null!=e&&(a.chainId=e)}return a.blockHash&&(0,p.Ab)(a.blockHash)===I&&(a.blockHash=null),a}class P{name;constructor(e){(0,s.n)(this,{name:e})}clone(){return new P(this.name)}}class D extends P{effectiveBlock;txBase;txCreate;txDataZero;txDataNonzero;txAccessListStorageKey;txAccessListAddress;constructor(e,a){null==e&&(e=0),super(`org.ethers.network.plugins.GasCost#${e||0}`);const t={effectiveBlock:e};function c(e,c){let f=(a||{})[e];null==f&&(f=c),(0,l.MR)("number"==typeof f,`invalud value for ${e}`,"costs",a),t[e]=f}c("txBase",21e3),c("txCreate",32e3),c("txDataZero",4),c("txDataNonzero",16),c("txAccessListStorageKey",1900),c("txAccessListAddress",2400),(0,s.n)(this,t)}clone(){return new D(this.effectiveBlock,this)}}class O extends P{address;targetNetwork;constructor(e,a){super("org.ethers.plugins.network.Ens"),(0,s.n)(this,{address:e||"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",targetNetwork:null==a?1:a})}clone(){return new O(this.address,this.targetNetwork)}}class F extends P{#e;#a;get url(){return this.#e}get processFunc(){return this.#a}constructor(e,a){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin"),this.#e=e,this.#a=a}clone(){return this}}const Q=new Map;class U{#t;#c;#f;constructor(e,a){this.#t=e,this.#c=(0,p.Ab)(a),this.#f=new Map}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return this.#t}set name(e){this.#t=e}get chainId(){return this.#c}set chainId(e){this.#c=(0,p.Ab)(e,"chainId")}matches(e){if(null==e)return!1;if("string"==typeof e){try{return this.chainId===(0,p.Ab)(e)}catch(e){}return this.name===e}if("number"==typeof e||"bigint"==typeof e){try{return this.chainId===(0,p.Ab)(e)}catch(e){}return!1}if("object"==typeof e){if(null!=e.chainId){try{return this.chainId===(0,p.Ab)(e.chainId)}catch(e){}return!1}return null!=e.name&&this.name===e.name}return!1}get plugins(){return Array.from(this.#f.values())}attachPlugin(e){if(this.#f.get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return this.#f.set(e.name,e.clone()),this}getPlugin(e){return this.#f.get(e)||null}getPlugins(e){return this.plugins.filter((a=>a.name.split("#")[0]===e))}clone(){const e=new U(this.name,this.chainId);return this.plugins.forEach((a=>{e.attachPlugin(a.clone())})),e}computeIntrinsicGas(e){const a=this.getPlugin("org.ethers.plugins.network.GasCost")||new D;let t=a.txBase;if(null==e.to&&(t+=a.txCreate),e.data)for(let c=2;c{c.attachPlugin(e)})),c};U.register(e,c),U.register(a,c),t.altNames&&t.altNames.forEach((e=>{U.register(e,c)}))}q||(q=!0,e("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),e("ropsten",3,{ensNetwork:3}),e("rinkeby",4,{ensNetwork:4}),e("goerli",5,{ensNetwork:5}),e("kovan",42,{ensNetwork:42}),e("sepolia",11155111,{ensNetwork:11155111}),e("holesky",17e3,{ensNetwork:17e3}),e("classic",61,{}),e("classicKotti",6,{}),e("arbitrum",42161,{ensNetwork:1}),e("arbitrum-goerli",421613,{}),e("arbitrum-sepolia",421614,{}),e("base",8453,{ensNetwork:1}),e("base-goerli",84531,{}),e("base-sepolia",84532,{}),e("bnb",56,{ensNetwork:1}),e("bnbt",97,{}),e("linea",59144,{ensNetwork:1}),e("linea-goerli",59140,{}),e("linea-sepolia",59141,{}),e("matic",137,{ensNetwork:1,plugins:[H("https://gasstation.polygon.technology/v2")]}),e("matic-amoy",80002,{}),e("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[H("https://gasstation-testnet.polygon.technology/v2")]}),e("optimism",10,{ensNetwork:1,plugins:[]}),e("optimism-goerli",420,{}),e("optimism-sepolia",11155420,{}),e("xdai",100,{ensNetwork:1}))}(),null==e)return U.from("mainnet");if("number"==typeof e&&(e=BigInt(e)),"string"==typeof e||"bigint"==typeof e){const a=Q.get(e);if(a)return a();if("bigint"==typeof e)return new U("unknown",e);(0,l.MR)(!1,"unknown network","network",e)}if("function"==typeof e.clone)return e.clone();if("object"==typeof e){(0,l.MR)("string"==typeof e.name&&"number"==typeof e.chainId,"invalid network object name or chainId","network",e);const a=new U(e.name,e.chainId);return(e.ensAddress||null!=e.ensNetwork)&&a.attachPlugin(new O(e.ensAddress,e.ensNetwork)),a}(0,l.MR)(!1,"invalid network","network",e)}static register(e,a){"number"==typeof e&&(e=BigInt(e));const t=Q.get(e);t&&(0,l.MR)(!1,`conflicting network for ${JSON.stringify(t.name)}`,"nameOrChainId",e),Q.set(e,a)}}function j(e,a){const t=String(e);if(!t.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${e}`);const c=t.split(".");if(1===c.length&&c.push(""),2!==c.length)throw new Error(`invalid gwei value: ${e}`);for(;c[1].length9){let e=BigInt(c[1].substring(0,9));c[1].substring(9).match(/^0+$/)||e++,c[1]=e.toString()}return BigInt(c[0]+c[1])}function H(e){return new F(e,(async(e,a,t)=>{let c;t.setHeader("User-Agent","ethers");try{const[a,f]=await Promise.all([t.send(),e()]);c=a;const d=c.bodyJson.standard;return{gasPrice:f.gasPrice,maxFeePerGas:j(d.maxFee,9),maxPriorityFeePerGas:j(d.maxPriorityFee,9)}}catch(e){(0,l.vA)(!1,`error encountered with polygon gas station (${JSON.stringify(t.url)})`,"SERVER_ERROR",{request:t,response:c,error:e})}}))}let q=!1;var $=t(43948);function z(e){return JSON.parse(JSON.stringify(e))}class G{#d;#r;#n;#i;constructor(e){this.#d=e,this.#r=null,this.#n=4e3,this.#i=-2}get pollingInterval(){return this.#n}set pollingInterval(e){this.#n=e}async#b(){try{const e=await this.#d.getBlockNumber();if(-2===this.#i)return void(this.#i=e);if(e!==this.#i){for(let a=this.#i+1;a<=e;a++){if(null==this.#r)return;await this.#d.emit("block",a)}this.#i=e}}catch(e){}null!=this.#r&&(this.#r=this.#d._setTimeout(this.#b.bind(this),this.#n))}start(){this.#r||(this.#r=this.#d._setTimeout(this.#b.bind(this),this.#n),this.#b())}stop(){this.#r&&(this.#d._clearTimeout(this.#r),this.#r=null)}pause(e){this.stop(),e&&(this.#i=-2)}resume(){this.start()}}class K{#d;#b;#o;constructor(e){this.#d=e,this.#o=!1,this.#b=e=>{this._poll(e,this.#d)}}async _poll(e,a){throw new Error("sub-classes must override this")}start(){this.#o||(this.#o=!0,this.#b(-2),this.#d.on("block",this.#b))}stop(){this.#o&&(this.#o=!1,this.#d.off("block",this.#b))}pause(e){this.stop()}resume(){this.start()}}class V extends K{#s;#l;constructor(e,a){super(e),this.#s=a,this.#l=-2}pause(e){e&&(this.#l=-2),super.pause(e)}async _poll(e,a){const t=await a.getBlock(this.#s);null!=t&&(-2===this.#l?this.#l=t.number:t.number>this.#l&&(a.emit(this.#s,t.number),this.#l=t.number))}}class Z extends K{#u;constructor(e,a){super(e),this.#u=z(a)}async _poll(e,a){throw new Error("@TODO")}}class J extends K{#h;constructor(e,a){super(e),this.#h=a}async _poll(e,a){const t=await a.getTransactionReceipt(this.#h);t&&a.emit(this.#h,t)}}class W{#d;#u;#r;#o;#i;constructor(e,a){this.#d=e,this.#u=z(a),this.#r=this.#b.bind(this),this.#o=!1,this.#i=-2}async#b(e){if(-2===this.#i)return;const a=z(this.#u);a.fromBlock=this.#i+1,a.toBlock=e;const t=await this.#d.getLogs(a);if(0!==t.length)for(const e of t)this.#d.emit(this.#u,e),this.#i=e.blockNumber;else this.#i{this.#i=e})),this.#d.on("block",this.#r))}stop(){this.#o&&(this.#o=!1,this.#d.off("block",this.#r))}pause(e){this.stop(),e&&(this.#i=-2)}resume(){this.start()}}const Y=BigInt(2);function X(e){return e&&"function"==typeof e.then}function ee(e,a){return e+":"+JSON.stringify(a,((e,a)=>{if(null==a)return"null";if("bigint"==typeof a)return`bigint:${a.toString()}`;if("string"==typeof a)return a.toLowerCase();if("object"==typeof a&&!Array.isArray(a)){const e=Object.keys(a);return e.sort(),e.reduce(((e,t)=>(e[t]=a[t],e)),{})}return a}))}class ae{name;constructor(e){(0,s.n)(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function te(e){return(e=Array.from(new Set(e).values())).sort(),e}async function ce(e,a){if(null==e)throw new Error("invalid event");if(Array.isArray(e)&&(e={topics:e}),"string"==typeof e)switch(e){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:e,tag:e}}if((0,h.Lo)(e,32)){const a=e.toLowerCase();return{type:"transaction",tag:ee("tx",{hash:a}),hash:a}}if(e.orphan){const a=e;return{type:"orphan",tag:ee("orphan",a),filter:(t=a,JSON.parse(JSON.stringify(t)))}}var t;if(e.address||e.topics){const t=e,c={topics:(t.topics||[]).map((e=>null==e?null:Array.isArray(e)?te(e.map((e=>e.toLowerCase()))):e.toLowerCase()))};if(t.address){const e=[],f=[],d=t=>{(0,h.Lo)(t)?e.push(t):f.push((async()=>{e.push(await(0,i.tG)(t,a))})())};Array.isArray(t.address)?t.address.forEach(d):d(t.address),f.length&&await Promise.all(f),c.address=te(e.map((e=>e.toLowerCase())))}return{filter:c,tag:ee("event",c),type:"event"}}(0,l.MR)(!1,"unknown ProviderEvent","event",e)}function fe(){return(new Date).getTime()}const de={cacheTimeout:250,pollingInterval:4e3};class re{#p;#f;#g;#m;#x;#y;#A;#v;#w;#_;#I;#E;constructor(e,a){if(this.#E=Object.assign({},de,a||{}),"any"===e)this.#y=!0,this.#x=null;else if(e){const a=U.from(e);this.#y=!1,this.#x=Promise.resolve(a),setTimeout((()=>{this.emit("network",a,null)}),0)}else this.#y=!1,this.#x=null;this.#v=-1,this.#A=new Map,this.#p=new Map,this.#f=new Map,this.#g=null,this.#m=!1,this.#w=1,this.#_=new Map,this.#I=!1}get pollingInterval(){return this.#E.pollingInterval}get provider(){return this}get plugins(){return Array.from(this.#f.values())}attachPlugin(e){if(this.#f.get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return this.#f.set(e.name,e.connect(this)),this}getPlugin(e){return this.#f.get(e)||null}get disableCcipRead(){return this.#I}set disableCcipRead(e){this.#I=!!e}async#C(e){const a=this.#E.cacheTimeout;if(a<0)return await this._perform(e);const t=ee(e.method,e);let c=this.#A.get(t);return c||(c=this._perform(e),this.#A.set(t,c),setTimeout((()=>{this.#A.get(t)===c&&this.#A.delete(t)}),a)),await c}async ccipReadFetch(e,a,t){if(this.disableCcipRead||0===t.length||null==e.to)return null;const c=e.to.toLowerCase(),f=a.toLowerCase(),r=[];for(let a=0;a=500,`response not found during CCIP fetch: ${s}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:e,info:{url:n,errorMessage:s}}),r.push(s)}(0,l.vA)(!1,`error encountered during CCIP fetch: ${r.map((e=>JSON.stringify(e))).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:e,info:{urls:t,errorMessages:r}})}_wrapBlock(e,a){return new $.eB(function(e){const a=S(e);return a.transactions=e.transactions.map((e=>"string"==typeof e?e:R(e))),a}(e),this)}_wrapLog(e,a){return new $.tG(function(e){return L(e)}(e),this)}_wrapTransactionReceipt(e,a){return new $.z5(function(e){return N(e)}(e),this)}_wrapTransactionResponse(e,a){return new $.uI(R(e),this)}_detectNetwork(){(0,l.vA)(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){(0,l.vA)(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=(0,p.WZ)(await this.#C({method:"getBlockNumber"}),"%response");return this.#v>=0&&(this.#v=e),e}_getAddress(e){return(0,i.tG)(e,this)}_getBlockTag(e){if(null==e)return"latest";switch(e){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return e}return(0,h.Lo)(e)?(0,h.Lo)(e,32)?e:(0,p.nD)(e):("bigint"==typeof e&&(e=(0,p.WZ)(e,"blockTag")),"number"==typeof e?e>=0?(0,p.nD)(e):this.#v>=0?(0,p.nD)(this.#v+e):this.getBlockNumber().then((a=>(0,p.nD)(a+e))):void(0,l.MR)(!1,"invalid blockTag","blockTag",e))}_getFilter(e){const a=(e.topics||[]).map((e=>null==e?null:Array.isArray(e)?te(e.map((e=>e.toLowerCase()))):e.toLowerCase())),t="blockHash"in e?e.blockHash:void 0,c=(e,c,f)=>{let d;switch(e.length){case 0:break;case 1:d=e[0];break;default:e.sort(),d=e}if(t&&(null!=c||null!=f))throw new Error("invalid filter");const r={};return d&&(r.address=d),a.length&&(r.topics=a),c&&(r.fromBlock=c),f&&(r.toBlock=f),t&&(r.blockHash=t),r};let f,d,r=[];if(e.address)if(Array.isArray(e.address))for(const a of e.address)r.push(this._getAddress(a));else r.push(this._getAddress(e.address));return"fromBlock"in e&&(f=this._getBlockTag(e.fromBlock)),"toBlock"in e&&(d=this._getBlockTag(e.toBlock)),r.filter((e=>"string"!=typeof e)).length||null!=f&&"string"!=typeof f||null!=d&&"string"!=typeof d?Promise.all([Promise.all(r),f,d]).then((e=>c(e[0],e[1],e[2]))):c(r,f,d)}_getTransactionRequest(e){const a=(0,$.VS)(e),t=[];if(["to","from"].forEach((e=>{if(null==a[e])return;const c=(0,i.tG)(a[e],this);X(c)?t.push(async function(){a[e]=await c}()):a[e]=c})),null!=a.blockTag){const e=this._getBlockTag(a.blockTag);X(e)?t.push(async function(){a.blockTag=await e}()):a.blockTag=e}return t.length?async function(){return await Promise.all(t),a}():a}async getNetwork(){if(null==this.#x){const e=(async()=>{try{const e=await this._detectNetwork();return this.emit("network",e,null),e}catch(a){throw this.#x===e&&(this.#x=null),a}})();return this.#x=e,(await e).clone()}const e=this.#x,[a,t]=await Promise.all([e,this._detectNetwork()]);return a.chainId!==t.chainId&&(this.#y?(this.emit("network",t,a),this.#x===e&&(this.#x=Promise.resolve(t))):(0,l.vA)(!1,`network changed: ${a.chainId} => ${t.chainId} `,"NETWORK_ERROR",{event:"changed"})),a.clone()}async getFeeData(){const e=await this.getNetwork(),a=async()=>{const{_block:a,gasPrice:t,priorityFee:c}=await(0,s.k)({_block:this.#M("latest",!1),gasPrice:(async()=>{try{const e=await this.#C({method:"getGasPrice"});return(0,p.Ab)(e,"%response")}catch(e){}return null})(),priorityFee:(async()=>{try{const e=await this.#C({method:"getPriorityFee"});return(0,p.Ab)(e,"%response")}catch(e){}return null})()});let f=null,d=null;const r=this._wrapBlock(a,e);return r&&r.baseFeePerGas&&(d=null!=c?c:BigInt("1000000000"),f=r.baseFeePerGas*Y+d),new $.J9(t,f,d)},t=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(t){const e=new d.ui(t.url),c=await t.processFunc(a,this,e);return new $.J9(c.gasPrice,c.maxFeePerGas,c.maxPriorityFeePerGas)}return await a()}async estimateGas(e){let a=this._getTransactionRequest(e);return X(a)&&(a=await a),(0,p.Ab)(await this.#C({method:"estimateGas",transaction:a}),"%response")}async#B(e,a,t){(0,l.vA)(t<10,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},e,{blockTag:a,enableCcipRead:!0})});const c=(0,$.VS)(e);try{return(0,h.c$)(await this._perform({method:"call",transaction:c,blockTag:a}))}catch(e){if(!this.disableCcipRead&&(0,l.E)(e)&&e.data&&t>=0&&"latest"===a&&null!=c.to&&"0x556f1830"===(0,h.ZG)(e.data,0,4)){const f=e.data,d=await(0,i.tG)(c.to,this);let r;try{r=function(e){const a={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};(0,l.vA)((0,h.pO)(e)>=160,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const t=(0,h.ZG)(e,0,32);(0,l.vA)((0,h.ZG)(t,0,12)===(0,h.ZG)(ue,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),a.sender=(0,h.ZG)(t,12);try{const t=[],c=(0,p.WZ)((0,h.ZG)(e,32,64)),f=(0,p.WZ)((0,h.ZG)(e,c,c+32)),d=(0,h.ZG)(e,c+32);for(let e=0;ea[e])),a}((0,h.ZG)(e.data,4))}catch(e){(0,l.vA)(!1,e.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:c,info:{data:f}})}(0,l.vA)(r.sender.toLowerCase()===d.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:f,reason:"OffchainLookup",transaction:c,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:r.errorArgs}});const n=await this.ccipReadFetch(c,r.calldata,r.urls);(0,l.vA)(null!=n,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:c,info:{data:e.data,errorArgs:r.errorArgs}});const b={to:d,data:(0,h.xW)([r.selector,le([n,r.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:b});try{const e=await this.#B(b,a,t+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},b),result:e}),e}catch(e){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},b),error:e}),e}}throw e}}async#k(e){const{value:a}=await(0,s.k)({network:this.getNetwork(),value:e});return a}async call(e){const{tx:a,blockTag:t}=await(0,s.k)({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await this.#k(this.#B(a,t,e.enableCcipRead?0:-1))}async#L(e,a,t){let c=this._getAddress(a),f=this._getBlockTag(t);return"string"==typeof c&&"string"==typeof f||([c,f]=await Promise.all([c,f])),await this.#k(this.#C(Object.assign(e,{address:c,blockTag:f})))}async getBalance(e,a){return(0,p.Ab)(await this.#L({method:"getBalance"},e,a),"%response")}async getTransactionCount(e,a){return(0,p.WZ)(await this.#L({method:"getTransactionCount"},e,a),"%response")}async getCode(e,a){return(0,h.c$)(await this.#L({method:"getCode"},e,a))}async getStorage(e,a,t){const c=(0,p.Ab)(a,"position");return(0,h.c$)(await this.#L({method:"getStorage",position:c},e,t))}async broadcastTransaction(e){const{blockNumber:a,hash:t,network:c}=await(0,s.k)({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),f=y.Z.from(e);if(f.hash!==t)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(f,c).replaceableTransaction(a)}async#M(e,a){if((0,h.Lo)(e,32))return await this.#C({method:"getBlock",blockHash:e,includeTransactions:a});let t=this._getBlockTag(e);return"string"!=typeof t&&(t=await t),await this.#C({method:"getBlock",blockTag:t,includeTransactions:a})}async getBlock(e,a){const{network:t,params:c}=await(0,s.k)({network:this.getNetwork(),params:this.#M(e,!!a)});return null==c?null:this._wrapBlock(c,t)}async getTransaction(e){const{network:a,params:t}=await(0,s.k)({network:this.getNetwork(),params:this.#C({method:"getTransaction",hash:e})});return null==t?null:this._wrapTransactionResponse(t,a)}async getTransactionReceipt(e){const{network:a,params:t}=await(0,s.k)({network:this.getNetwork(),params:this.#C({method:"getTransactionReceipt",hash:e})});if(null==t)return null;if(null==t.gasPrice&&null==t.effectiveGasPrice){const a=await this.#C({method:"getTransaction",hash:e});if(null==a)throw new Error("report this; could not find tx or effectiveGasPrice");t.effectiveGasPrice=a.gasPrice}return this._wrapTransactionReceipt(t,a)}async getTransactionResult(e){const{result:a}=await(0,s.k)({network:this.getNetwork(),result:this.#C({method:"getTransactionResult",hash:e})});return null==a?null:(0,h.c$)(a)}async getLogs(e){let a=this._getFilter(e);X(a)&&(a=await a);const{network:t,params:c}=await(0,s.k)({network:this.getNetwork(),params:this.#C({method:"getLogs",filter:a})});return c.map((e=>this._wrapLog(e,t)))}_getProvider(e){(0,l.vA)(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await v.Pz.fromName(this,e)}async getAvatar(e){const a=await this.getResolver(e);return a?await a.getAvatar():null}async resolveName(e){const a=await this.getResolver(e);return a?await a.getAddress():null}async lookupAddress(e){e=(0,n.b)(e);const a=(0,x.kM)(e.substring(2).toLowerCase()+".addr.reverse");try{const t=await v.Pz.getEnsAddress(this),c=new m.NZ(t,["function resolver(bytes32) view returns (address)"],this),f=await c.resolver(a);if(null==f||f===g.j)return null;const d=new m.NZ(f,["function name(bytes32) view returns (string)"],this),r=await d.name(a);return await this.resolveName(r)!==e?null:r}catch(e){if((0,l.bJ)(e,"BAD_DATA")&&"0x"===e.value)return null;if((0,l.bJ)(e,"CALL_EXCEPTION"))return null;throw e}return null}async waitForTransaction(e,a,t){const c=null!=a?a:1;return 0===c?this.getTransactionReceipt(e):new Promise((async(a,f)=>{let d=null;const r=async t=>{try{const f=await this.getTransactionReceipt(e);if(null!=f&&t-f.blockNumber+1>=c)return a(f),void(d&&(clearTimeout(d),d=null))}catch(e){console.log("EEE",e)}this.once("block",r)};null!=t&&(d=setTimeout((()=>{null!=d&&(d=null,this.off("block",r),f((0,l.xz)("timeout","TIMEOUT",{reason:"timeout"})))}),t)),r(await this.getBlockNumber())}))}async waitForBlock(e){(0,l.vA)(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const a=this.#_.get(e);a&&(a.timer&&clearTimeout(a.timer),this.#_.delete(e))}_setTimeout(e,a){null==a&&(a=0);const t=this.#w++,c=()=>{this.#_.delete(t),e()};if(this.paused)this.#_.set(t,{timer:null,func:c,time:a});else{const e=setTimeout(c,a);this.#_.set(t,{timer:e,func:c,time:fe()})}return t}_forEachSubscriber(e){for(const a of this.#p.values())e(a.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new ae(e.type);case"block":{const e=new G(this);return e.pollingInterval=this.pollingInterval,e}case"safe":case"finalized":return new V(this,e.type);case"event":return new W(this,e.filter);case"transaction":return new J(this,e.hash);case"orphan":return new Z(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,a){for(const t of this.#p.values())if(t.subscriber===e){t.started&&t.subscriber.stop(),t.subscriber=a,t.started&&a.start(),null!=this.#g&&a.pause(this.#g);break}}async#S(e,a){let t=await ce(e,this);return"event"===t.type&&a&&a.length>0&&!0===a[0].removed&&(t=await ce({orphan:"drop-log",log:a[0]},this)),this.#p.get(t.tag)||null}async#T(e){const a=await ce(e,this),t=a.tag;let c=this.#p.get(t);return c||(c={subscriber:this._getSubscriber(a),tag:t,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},this.#p.set(t,c)),c}async on(e,a){const t=await this.#T(e);return t.listeners.push({listener:a,once:!1}),t.started||(t.subscriber.start(),t.started=!0,null!=this.#g&&t.subscriber.pause(this.#g)),this}async once(e,a){const t=await this.#T(e);return t.listeners.push({listener:a,once:!0}),t.started||(t.subscriber.start(),t.started=!0,null!=this.#g&&t.subscriber.pause(this.#g)),this}async emit(e,...a){const t=await this.#S(e,a);if(!t||0===t.listeners.length)return!1;const c=t.listeners.length;return t.listeners=t.listeners.filter((({listener:t,once:c})=>{const f=new A.z(this,c?null:t,e);try{t.call(this,...a,f)}catch(e){}return!c})),0===t.listeners.length&&(t.started&&t.subscriber.stop(),this.#p.delete(t.tag)),c>0}async listenerCount(e){if(e){const a=await this.#S(e);return a?a.listeners.length:0}let a=0;for(const{listeners:e}of this.#p.values())a+=e.length;return a}async listeners(e){if(e){const a=await this.#S(e);return a?a.listeners.map((({listener:e})=>e)):[]}let a=[];for(const{listeners:e}of this.#p.values())a=a.concat(e.map((({listener:e})=>e)));return a}async off(e,a){const t=await this.#S(e);if(!t)return this;if(a){const e=t.listeners.map((({listener:e})=>e)).indexOf(a);e>=0&&t.listeners.splice(e,1)}return a&&0!==t.listeners.length||(t.started&&t.subscriber.stop(),this.#p.delete(t.tag)),this}async removeAllListeners(e){if(e){const{tag:a,started:t,subscriber:c}=await this.#T(e);t&&c.stop(),this.#p.delete(a)}else for(const[e,{started:a,subscriber:t}]of this.#p)a&&t.stop(),this.#p.delete(e);return this}async addListener(e,a){return await this.on(e,a)}async removeListener(e,a){return this.off(e,a)}get destroyed(){return this.#m}destroy(){this.removeAllListeners();for(const e of this.#_.keys())this._clearTimeout(e);this.#m=!0}get paused(){return null!=this.#g}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(this.#v=-1,null!=this.#g){if(this.#g==!!e)return;(0,l.vA)(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber((a=>a.pause(e))),this.#g=!!e;for(const e of this.#_.values())e.timer&&clearTimeout(e.timer),e.time=fe()-e.time}resume(){if(null!=this.#g){this._forEachSubscriber((e=>e.resume())),this.#g=null;for(const e of this.#_.values()){let a=e.time;a<0&&(a=0),e.time=fe(),setTimeout(e.func,a)}}}}function ne(e,a){try{const t=ie(e,a);if(t)return(0,u._v)(t)}catch(e){}return null}function ie(e,a){if("0x"===e)return null;try{const t=(0,p.WZ)((0,h.ZG)(e,a,a+32)),c=(0,p.WZ)((0,h.ZG)(e,t,t+32));return(0,h.ZG)(e,t+32,t+32+c)}catch(e){}return null}function be(e){const a=(0,p.c4)(e);if(a.length>32)throw new Error("internal; should not happen");const t=new Uint8Array(32);return t.set(a,32-a.length),t}function oe(e){if(e.length%32==0)return e;const a=new Uint8Array(32*Math.ceil(e.length/32));return a.set(e),a}const se=new Uint8Array([]);function le(e){const a=[];let t=0;for(let c=0;c((0,l.MR)(e.toLowerCase()===a.toLowerCase(),"transaction from mismatch","tx.from",a),e)))}else t.from=e.getAddress();return await(0,s.k)(t)}class ge{provider;constructor(e){(0,s.n)(this,{provider:e||null})}async getNonce(e){return he(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await pe(this,e)}async populateTransaction(e){const a=he(this,"populateTransaction"),t=await pe(this,e);null==t.nonce&&(t.nonce=await this.getNonce("pending")),null==t.gasLimit&&(t.gasLimit=await this.estimateGas(t));const c=await this.provider.getNetwork();if(null!=t.chainId){const a=(0,p.Ab)(t.chainId);(0,l.MR)(a===c.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else t.chainId=c.chainId;const f=null!=t.maxFeePerGas||null!=t.maxPriorityFeePerGas;if(null==t.gasPrice||2!==t.type&&!f?0!==t.type&&1!==t.type||!f||(0,l.MR)(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e):(0,l.MR)(!1,"eip-1559 transaction do not support gasPrice","tx",e),2!==t.type&&null!=t.type||null==t.maxFeePerGas||null==t.maxPriorityFeePerGas)if(0===t.type||1===t.type){const e=await a.getFeeData();(0,l.vA)(null!=e.gasPrice,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),null==t.gasPrice&&(t.gasPrice=e.gasPrice)}else{const e=await a.getFeeData();if(null==t.type)if(null!=e.maxFeePerGas&&null!=e.maxPriorityFeePerGas)if(t.type=2,null!=t.gasPrice){const e=t.gasPrice;delete t.gasPrice,t.maxFeePerGas=e,t.maxPriorityFeePerGas=e}else null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas);else null!=e.gasPrice?((0,l.vA)(!f,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),null==t.gasPrice&&(t.gasPrice=e.gasPrice),t.type=0):(0,l.vA)(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else 2!==t.type&&3!==t.type||(null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas))}else t.type=2;return await(0,s.k)(t)}async estimateGas(e){return he(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return he(this,"call").call(await this.populateCall(e))}async resolveName(e){const a=he(this,"resolveName");return await a.resolveName(e)}async sendTransaction(e){const a=he(this,"sendTransaction"),t=await this.populateTransaction(e);delete t.from;const c=y.Z.from(t);return await a.broadcastTransaction(await this.signTransaction(c))}}class me extends ge{address;constructor(e,a){super(a),(0,s.n)(this,{address:e})}async getAddress(){return this.address}connect(e){return new me(this.address,e)}#N(e,a){(0,l.vA)(!1,`VoidSigner cannot sign ${e}`,"UNSUPPORTED_OPERATION",{operation:a})}async signTransaction(e){this.#N("transactions","signTransaction")}async signMessage(e){this.#N("messages","signMessage")}async signTypedData(e,a,t){this.#N("typed-data","signTypedData")}}class xe{#d;#R;#r;#o;#P;#D;constructor(e){this.#d=e,this.#R=null,this.#r=this.#b.bind(this),this.#o=!1,this.#P=null,this.#D=!1}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,a){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}async#b(e){try{null==this.#R&&(this.#R=this._subscribe(this.#d));let e=null;try{e=await this.#R}catch(e){if(!(0,l.bJ)(e,"UNSUPPORTED_OPERATION")||"eth_newFilter"!==e.operation)throw e}if(null==e)return this.#R=null,void this.#d._recoverSubscriber(this,this._recover(this.#d));const a=await this.#d.getNetwork();if(this.#P||(this.#P=a),this.#P.chainId!==a.chainId)throw new Error("chaid changed");if(this.#D)return;const t=await this.#d.send("eth_getFilterChanges",[e]);await this._emitResults(this.#d,t)}catch(e){console.log("@TODO",e)}this.#d.once("block",this.#r)}#O(){const e=this.#R;e&&(this.#R=null,e.then((e=>{this.#d.destroyed||this.#d.send("eth_uninstallFilter",[e])})))}start(){this.#o||(this.#o=!0,this.#b(-2))}stop(){this.#o&&(this.#o=!1,this.#D=!0,this.#O(),this.#d.off("block",this.#r))}pause(e){e&&this.#O(),this.#d.off("block",this.#r)}resume(){this.start()}}class ye extends xe{#F;constructor(e,a){var t;super(e),this.#F=(t=a,JSON.parse(JSON.stringify(t)))}_recover(e){return new W(e,this.#F)}async _subscribe(e){return await e.send("eth_newFilter",[this.#F])}async _emitResults(e,a){for(const t of a)e.emit(this.#F,e._wrapLog(t,e._network))}}class Ae extends xe{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,a){for(const t of a)e.emit("pending",t)}}const ve="bigint,boolean,function,number,string,symbol".split(/,/g);function we(e){if(null==e||ve.indexOf(typeof e)>=0)return e;if("function"==typeof e.getAddress)return e;if(Array.isArray(e))return e.map(we);if("object"==typeof e)return Object.keys(e).reduce(((a,t)=>(a[t]=e[t],a)),{});throw new Error(`should not happen: ${e} (${typeof e})`)}function _e(e){return new Promise((a=>{setTimeout(a,e)}))}function Ie(e){return e?e.toLowerCase():e}function Ee(e){return e&&"number"==typeof e.pollingInterval}const Ce={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class Me extends ge{address;constructor(e,a){super(e),a=(0,n.b)(a),(0,s.n)(this,{address:a})}connect(e){(0,l.vA)(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(e){return await this.populateCall(e)}async sendUncheckedTransaction(e){const a=we(e),t=[];if(a.from){const c=a.from;t.push((async()=>{const t=await(0,i.tG)(c,this.provider);(0,l.MR)(null!=t&&t.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",e),a.from=t})())}else a.from=this.address;if(null==a.gasLimit&&t.push((async()=>{a.gasLimit=await this.provider.estimateGas({...a,from:this.address})})()),null!=a.to){const e=a.to;t.push((async()=>{a.to=await(0,i.tG)(e,this.provider)})())}t.length&&await Promise.all(t);const c=this.provider.getRpcTransaction(a);return this.provider.send("eth_sendTransaction",[c])}async sendTransaction(e){const a=await this.provider.getBlockNumber(),t=await this.sendUncheckedTransaction(e);return await new Promise(((e,c)=>{const f=[1e3,100];let d=0;const r=async()=>{try{const c=await this.provider.getTransaction(t);if(null!=c)return void e(c.replaceableTransaction(a))}catch(e){if((0,l.bJ)(e,"CANCELLED")||(0,l.bJ)(e,"BAD_DATA")||(0,l.bJ)(e,"NETWORK_ERROR")||(0,l.bJ)(e,"UNSUPPORTED_OPERATION"))return null==e.info&&(e.info={}),e.info.sendTransactionHash=t,void c(e);if((0,l.bJ)(e,"INVALID_ARGUMENT")&&(d++,null==e.info&&(e.info={}),e.info.sendTransactionHash=t,d>10))return void c(e);this.provider.emit("error",(0,l.xz)("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:e}))}this.provider._setTimeout((()=>{r()}),f.pop()||4e3)};r()}))}async signTransaction(e){const a=we(e);if(a.from){const t=await(0,i.tG)(a.from,this.provider);(0,l.MR)(null!=t&&t.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",e),a.from=t}else a.from=this.address;const t=this.provider.getRpcTransaction(a);return await this.provider.send("eth_signTransaction",[t])}async signMessage(e){const a="string"==typeof e?(0,u.YW)(e):e;return await this.provider.send("personal_sign",[(0,h.c$)(a),this.address.toLowerCase()])}async signTypedData(e,a,t){const c=we(t),f=await b.z.resolveNames(e,a,c,(async e=>{const a=await(0,i.tG)(e);return(0,l.MR)(null!=a,"TypedData does not support null address","value",e),a}));return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(b.z.getPayload(f.domain,a,f.value))])}async unlock(e){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),e,null])}async _legacySignMessage(e){const a="string"==typeof e?(0,u.YW)(e):e;return await this.provider.send("eth_sign",[this.address.toLowerCase(),(0,h.c$)(a)])}}class Be extends re{#E;#Q;#U;#j;#H;#P;#q;#$(){if(this.#j)return;const e=1===this._getOption("batchMaxCount")?0:this._getOption("batchStallTime");this.#j=setTimeout((()=>{this.#j=null;const e=this.#U;for(this.#U=[];e.length;){const a=[e.shift()];for(;e.length&&a.length!==this.#E.batchMaxCount;)if(a.push(e.shift()),JSON.stringify(a.map((e=>e.payload))).length>this.#E.batchMaxSize){e.unshift(a.pop());break}(async()=>{const e=1===a.length?a[0].payload:a.map((e=>e.payload));this.emit("debug",{action:"sendRpcPayload",payload:e});try{const t=await this._send(e);this.emit("debug",{action:"receiveRpcResult",result:t});for(const{resolve:e,reject:c,payload:f}of a){if(this.destroyed){c((0,l.xz)("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:f.method}));continue}const a=t.filter((e=>e.id===f.id))[0];if(null!=a)"error"in a?c(this.getRpcError(f,a)):e(a.result);else{const e=(0,l.xz)("missing response for request","BAD_DATA",{value:t,info:{payload:f}});this.emit("error",e),c(e)}}}catch(e){this.emit("debug",{action:"receiveRpcError",error:e});for(const{reject:t}of a)t(e)}})()}}),e)}constructor(e,a){super(e,a),this.#Q=1,this.#E=Object.assign({},Ce,a||{}),this.#U=[],this.#j=null,this.#P=null,this.#q=null;{let e=null;const a=new Promise((a=>{e=a}));this.#H={promise:a,resolve:e}}const t=this._getOption("staticNetwork");"boolean"==typeof t?((0,l.MR)(!t||"any"!==e,"staticNetwork cannot be used on special network 'any'","options",a),t&&null!=e&&(this.#P=U.from(e))):t&&((0,l.MR)(null==e||t.matches(e),"staticNetwork MUST match network object","options",a),this.#P=t)}_getOption(e){return this.#E[e]}get _network(){return(0,l.vA)(this.#P,"network is not available yet","NETWORK_ERROR"),this.#P}async _perform(e){if("call"===e.method||"estimateGas"===e.method){let a=e.transaction;if(a&&null!=a.type&&(0,p.Ab)(a.type)&&null==a.maxFeePerGas&&null==a.maxPriorityFeePerGas){const t=await this.getFeeData();null==t.maxFeePerGas&&null==t.maxPriorityFeePerGas&&(e=Object.assign({},e,{transaction:Object.assign({},a,{type:void 0})}))}}const a=this.getRpcRequest(e);return null!=a?await this.send(a.method,a.args):super._perform(e)}async _detectNetwork(){const e=this._getOption("staticNetwork");if(e){if(!0!==e)return e;if(this.#P)return this.#P}return this.#q?await this.#q:this.ready?(this.#q=(async()=>{try{const e=U.from((0,p.Ab)(await this.send("eth_chainId",[])));return this.#q=null,e}catch(e){throw this.#q=null,e}})(),await this.#q):(this.#q=(async()=>{const e={id:this.#Q++,method:"eth_chainId",params:[],jsonrpc:"2.0"};let a;this.emit("debug",{action:"sendRpcPayload",payload:e});try{a=(await this._send(e))[0],this.#q=null}catch(e){throw this.#q=null,this.emit("debug",{action:"receiveRpcError",error:e}),e}if(this.emit("debug",{action:"receiveRpcResult",result:a}),"result"in a)return U.from((0,p.Ab)(a.result));throw this.getRpcError(e,a)})(),await this.#q)}_start(){null!=this.#H&&null!=this.#H.resolve&&(this.#H.resolve(),this.#H=null,(async()=>{for(;null==this.#P&&!this.destroyed;)try{this.#P=await this._detectNetwork()}catch(e){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",(0,l.xz)("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:e}})),await _e(1e3)}this.#$()})())}async _waitUntilReady(){if(null!=this.#H)return await this.#H.promise}_getSubscriber(e){return"pending"===e.type?new Ae(this):"event"===e.type?this._getOption("polling")?new W(this,e.filter):new ye(this,e.filter):"orphan"===e.type&&"drop-log"===e.filter.orphan?new ae("orphan"):super._getSubscriber(e)}get ready(){return null==this.#H}getRpcTransaction(e){const a={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((t=>{if(null==e[t])return;let c=t;"gasLimit"===t&&(c="gas"),a[c]=(0,p.nD)((0,p.Ab)(e[t],`tx.${t}`))})),["from","to","data"].forEach((t=>{null!=e[t]&&(a[t]=(0,h.c$)(e[t]))})),e.accessList&&(a.accessList=(0,o.$)(e.accessList)),e.blobVersionedHashes&&(a.blobVersionedHashes=e.blobVersionedHashes.map((e=>e.toLowerCase()))),a}getRpcRequest(e){switch(e.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[Ie(e.address),e.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[Ie(e.address),e.blockTag]};case"getCode":return{method:"eth_getCode",args:[Ie(e.address),e.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[Ie(e.address),"0x"+e.position.toString(16),e.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[e.signedTransaction]};case"getBlock":if("blockTag"in e)return{method:"eth_getBlockByNumber",args:[e.blockTag,!!e.includeTransactions]};if("blockHash"in e)return{method:"eth_getBlockByHash",args:[e.blockHash,!!e.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[e.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[e.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(e.transaction),e.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(e.transaction)]};case"getLogs":return e.filter&&null!=e.filter.address&&(Array.isArray(e.filter.address)?e.filter.address=e.filter.address.map(Ie):e.filter.address=Ie(e.filter.address)),{method:"eth_getLogs",args:[e.filter]}}return null}getRpcError(e,a){const{method:t}=e,{error:c}=a;if("eth_estimateGas"===t&&c.message){const a=c.message;if(!a.match(/revert/i)&&a.match(/insufficient funds/i))return(0,l.xz)("insufficient funds","INSUFFICIENT_FUNDS",{transaction:e.params[0],info:{payload:e,error:c}})}if("eth_call"===t||"eth_estimateGas"===t){const a=Se(c),f=r.y.getBuiltinCallException("eth_call"===t?"call":"estimateGas",e.params[0],a?a.data:null);return f.info={error:c,payload:e},f}const f=JSON.stringify(function(e){const a=[];return Te(e,a),a}(c));if("string"==typeof c.message&&c.message.match(/user denied|ethers-user-denied/i)){const a={eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"};return(0,l.xz)("user rejected action","ACTION_REJECTED",{action:a[t]||"unknown",reason:"rejected",info:{payload:e,error:c}})}if("eth_sendRawTransaction"===t||"eth_sendTransaction"===t){const a=e.params[0];if(f.match(/insufficient funds|base fee exceeds gas limit/i))return(0,l.xz)("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:a,info:{error:c}});if(f.match(/nonce/i)&&f.match(/too low/i))return(0,l.xz)("nonce has already been used","NONCE_EXPIRED",{transaction:a,info:{error:c}});if(f.match(/replacement transaction/i)&&f.match(/underpriced/i))return(0,l.xz)("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:a,info:{error:c}});if(f.match(/only replay-protected/i))return(0,l.xz)("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:t,info:{transaction:a,info:{error:c}}})}let d=!!f.match(/the method .* does not exist/i);return d||c&&c.details&&c.details.startsWith("Unauthorized method:")&&(d=!0),d?(0,l.xz)("unsupported operation","UNSUPPORTED_OPERATION",{operation:e.method,info:{error:c,payload:e}}):(0,l.xz)("could not coalesce error","UNKNOWN_ERROR",{error:c,payload:e})}send(e,a){if(this.destroyed)return Promise.reject((0,l.xz)("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:e}));const t=this.#Q++,c=new Promise(((c,f)=>{this.#U.push({resolve:c,reject:f,payload:{method:e,params:a,id:t,jsonrpc:"2.0"}})}));return this.#$(),c}async getSigner(e){null==e&&(e=0);const a=this.send("eth_accounts",[]);if("number"==typeof e){const t=await a;if(e>=t.length)throw new Error("no such account");return new Me(this,t[e])}const{accounts:t}=await(0,s.k)({network:this.getNetwork(),accounts:a});e=(0,n.b)(e);for(const a of t)if((0,n.b)(a)===e)return new Me(this,e);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map((e=>new Me(this,e)))}destroy(){this.#j&&(clearTimeout(this.#j),this.#j=null);for(const{payload:e,reject:a}of this.#U)a((0,l.xz)("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:e.method}));this.#U=[],super.destroy()}}class ke extends Be{#z;constructor(e,a){super(e,a);let t=this._getOption("pollingInterval");null==t&&(t=Ce.pollingInterval),this.#z=t}_getSubscriber(e){const a=super._getSubscriber(e);return Ee(a)&&(a.pollingInterval=this.#z),a}get pollingInterval(){return this.#z}set pollingInterval(e){if(!Number.isInteger(e)||e<0)throw new Error("invalid interval");this.#z=e,this._forEachSubscriber((e=>{Ee(e)&&(e.pollingInterval=this.#z)}))}}class Le extends ke{#G;constructor(e,a,t){null==e&&(e="http://localhost:8545"),super(a,t),this.#G="string"==typeof e?new d.ui(e):e.clone()}_getConnection(){return this.#G.clone()}async send(e,a){return await this._start(),await super.send(e,a)}async _send(e){const a=this._getConnection();a.body=JSON.stringify(e),a.setHeader("content-type","application/json");const t=await a.send();t.assertOk();let c=t.bodyJson;return Array.isArray(c)||(c=[c]),c}}function Se(e){if(null==e)return null;if("string"==typeof e.message&&e.message.match(/revert/i)&&(0,h.Lo)(e.data))return{message:e.message,data:e.data};if("object"==typeof e){for(const a in e){const t=Se(e[a]);if(t)return t}return null}if("string"==typeof e)try{return Se(JSON.parse(e))}catch(e){}return null}function Te(e,a){if(null!=e){if("string"==typeof e.message&&a.push(e.message),"object"==typeof e)for(const t in e)Te(e[t],a);if("string"==typeof e)try{return Te(JSON.parse(e),a)}catch(e){}}}var Ne=t(72588),Re=t(2011);var Pe=t(20415);class De extends ge{address;#K;constructor(e,a){super(a),(0,l.MR)(e&&"function"==typeof e.sign,"invalid private key","privateKey","[ REDACTED ]"),this.#K=e;const t=(0,Pe.K)(this.signingKey.publicKey);(0,s.n)(this,{address:t})}get signingKey(){return this.#K}get privateKey(){return this.signingKey.privateKey}async getAddress(){return this.address}connect(e){return new De(this.#K,e)}async signTransaction(e){e=(0,$.VS)(e);const{to:a,from:t}=await(0,s.k)({to:e.to?(0,i.tG)(e.to,this.provider):void 0,from:e.from?(0,i.tG)(e.from,this.provider):void 0});null!=a&&(e.to=a),null!=t&&(e.from=t),null!=e.from&&((0,l.MR)((0,n.b)(e.from)===this.address,"transaction from address mismatch","tx.from",e.from),delete e.from);const c=y.Z.from(e);return c.signature=this.signingKey.sign(c.unsignedHash),c.serialized}async signMessage(e){return this.signMessageSync(e)}signMessageSync(e){return this.signingKey.sign(function(e){return"string"==typeof e&&(e=(0,u.YW)(e)),(0,Re.S)((0,h.xW)([(0,u.YW)("Ethereum Signed Message:\n"),(0,u.YW)(String(e.length)),e]))}(e)).serialized}async signTypedData(e,a,t){const c=await b.z.resolveNames(e,a,t,(async e=>{(0,l.vA)(null!=this.provider,"cannot resolve ENS names without a provider","UNSUPPORTED_OPERATION",{operation:"resolveName",info:{name:e}});const a=await this.provider.resolveName(e);return(0,l.vA)(null!=a,"unconfigured ENS name","UNCONFIGURED_NAME",{value:e}),a}));return this.signingKey.sign(b.z.hash(c.domain,a,c.value)).serialized}}var Oe=t(68650),Fe=t(68682);let Qe=!1;const Ue=function(e,a,t){return(0,Fe.Gz)(e,a).update(t).digest()};let je=Ue;function He(e,a,t){const c=(0,h.q5)(a,"key"),f=(0,h.q5)(t,"data");return(0,h.c$)(je(e,c,f))}He._=Ue,He.lock=function(){Qe=!0},He.register=function(e){if(Qe)throw new Error("computeHmac is locked");je=e},Object.freeze(He);var qe=t(6800),$e=t(32531);const ze=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Ge=Uint8Array.from({length:16},((e,a)=>a));let Ke=[Ge],Ve=[Ge.map((e=>(9*e+5)%16))];for(let e=0;e<4;e++)for(let a of[Ke,Ve])a.push(a[e].map((e=>ze[e])));const Ze=[[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((e=>new Uint8Array(e))),Je=Ke.map(((e,a)=>e.map((e=>Ze[a][e])))),We=Ve.map(((e,a)=>e.map((e=>Ze[a][e])))),Ye=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),Xe=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),ea=(e,a)=>e<>>32-a;function aa(e,a,t,c){return 0===e?a^t^c:1===e?a&t|~a&c:2===e?(a|~t)^c:3===e?a&c|t&~c:a^(t|~c)}const ta=new Uint32Array(16);class ca extends qe.D{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:a,h2:t,h3:c,h4:f}=this;return[e,a,t,c,f]}set(e,a,t,c,f){this.h0=0|e,this.h1=0|a,this.h2=0|t,this.h3=0|c,this.h4=0|f}process(e,a){for(let t=0;t<16;t++,a+=4)ta[t]=e.getUint32(a,!0);let t=0|this.h0,c=t,f=0|this.h1,d=f,r=0|this.h2,n=r,i=0|this.h3,b=i,o=0|this.h4,s=o;for(let e=0;e<5;e++){const a=4-e,l=Ye[e],u=Xe[e],h=Ke[e],p=Ve[e],g=Je[e],m=We[e];for(let a=0;a<16;a++){const c=ea(t+aa(e,f,r,i)+ta[h[a]]+l,g[a])+o|0;t=o,o=i,i=0|ea(r,10),r=f,f=c}for(let e=0;e<16;e++){const t=ea(c+aa(a,d,n,b)+ta[p[e]]+u,m[e])+s|0;c=s,s=b,b=0|ea(n,10),n=d,d=t}}this.set(this.h1+r+b|0,this.h2+i+s|0,this.h3+o+c|0,this.h4+t+d|0,this.h0+f+n|0)}roundClean(){ta.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const fa=(0,$e.ld)((()=>new ca));let da=!1;const ra=function(e){return fa(e)};let na=ra;function ia(e){const a=(0,h.q5)(e,"data");return(0,h.c$)(na(a))}ia._=ra,ia.lock=function(){da=!0},ia.register=function(e){if(da)throw new TypeError("ripemd160 is locked");na=e},Object.freeze(ia);let ba=!1;const oa=function(e){return new Uint8Array((0,Fe.po)(e))};let sa=oa;function la(e){return sa(e)}la._=oa,la.lock=function(){ba=!0},la.register=function(e){if(ba)throw new Error("randomBytes is locked");sa=e},Object.freeze(la);var ua=t(14132),ha=t(38264);const pa=/^[a-z]*$/i;function ga(e,a){let t=97;return e.reduce(((e,c)=>(c===a?t++:c.match(pa)?e.push(String.fromCharCode(t)+c):(t=97,e.push(c)),e)),[])}class ma{locale;constructor(e){(0,s.n)(this,{locale:e})}split(e){return e.toLowerCase().split(/\s+/g)}join(e){return e.join(" ")}}class xa extends ma{#V;#Z;constructor(e,a,t){super(e),this.#V=a,this.#Z=t,this.#J=null}get _data(){return this.#V}_decodeWords(){return e=this.#V,(0,l.MR)("0"===e[0],"unsupported auwl data","data",e),function(e,a){for(let t=28;t>=0;t--)e=e.split(" !#$%&'()*+,-./<=>?@[]^_`{|}~"[t]).join(a.substring(2*t,2*t+2));const t=[],c=e.replace(/(:|([0-9])|([A-Z][a-z]*))/g,((e,a,c,f)=>{if(c)for(let e=parseInt(c);e>=0;e--)t.push(";");else t.push(a.toLowerCase());return""}));if(c)throw new Error(`leftovers: ${JSON.stringify(c)}`);return ga(ga(t,";"),":")}(e.substring(59),e.substring(1,59));var e}#J;#W(){if(null==this.#J){const e=this._decodeWords();if((0,ha.id)(e.join("\n")+"\n")!==this.#Z)throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`);this.#J=e}return this.#J}getWord(e){const a=this.#W();return(0,l.MR)(e>=0&&eurAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEwI{etImeIspIt-OpO[Ou^OwdUci$UelUi'Umb!Un^UshYY,$2BeLtu*PPbo?dRiousRr|Rta(R=Sh]/omTe3C!:DMa+MpN)Ng R(gShUght WnY3AlBa>BrisCadeCemb CideCl(eC%a>C*a'ErF&'F(eFyG*eLayLiv M3AgramAlAm#dAryCeE'lEtFf G.$Gn.yLemmaNn NosaurRe@RtSag*eScov Sea'ShSmi[S%d Splay/<)V tVideV%)Zzy5Ct%Cum|G~Lph(Ma(Na>NkeyN%OrSeUb!Ve_ftAg#AmaA,-AwEamE[IftIllInkIpI=OpUmY2CkMbNeR(g/T^Ty1Arf1Nam-:G G!RlyRnR`Sily/Sy1HoOlogyOnomy0GeItUca>1F%t0G1GhtTh 2BowD E@r-EgSe0B?kBodyBra)Er+Ot]PloyPow Pty0Ab!A@DD![D%'EmyErgyF%)Ga+G(eH<)JoyLi,OughR-hRollSu*T Ti*TryVelope1Isode0U$Uip0AA'OdeOs]R%Upt0CapeSayS&)Ta>0Ern$H-s1Id&)IlOkeOl=1A@Amp!Ce[Ch<+C.eCludeCu'Ecu>Erci'Hau,Hib.I!I,ItOt-PM&'Mu}Pa@Po'Pro=Pul'0ChCludeComeC*a'DexD-a>Do%Du,ryFN Noc|PutQuirySSue0Em1Ory:CketGu?RZz3AlousAns~yWel9BInKeUr}yY5D+I)MpNg!Ni%Nk/:Ng?oo3EnEpT^upY3CkDD}yNdNgdomSsTT^&TeTt&Wi4EeIfeO{Ow:BBelB%Dd DyKeMpNgua+PtopR+T T(UghUndryVaWWnWsu.Y Zy3Ad AfArnA=Ctu*FtGG$G&dIsu*M#NdNg`NsOp?dSs#Tt Vel3ArB tyBr?yC&'FeFtGhtKeMbM.NkOnQuid/Tt!VeZ?d5AdAnB, C$CkG-NelyNgOpTt yUdUn+VeY$5CkyGga+Mb N?N^Xury3R-s:Ch(eDG-G}tIdIlInJ%KeMm$NNa+Nda>NgoNs]Nu$P!Rb!R^Rg(R(eRketRria+SkSs/ T^T i$ThTrixTt XimumZe3AdowAnAsu*AtCh<-D$DiaLodyLtMb M%yNt]NuRcyR+R.RryShSsa+T$Thod3Dd!DnightLk~]M-NdNimumN%Nu>Rac!Rr%S ySs/akeXXedXtu*5Bi!DelDifyMM|N.%NkeyN, N`OnR$ReRn(gSqu.oTh T]T%Unta(U'VeVie5ChFf(LeLtiplySc!SeumShroomS-/Tu$3Self/ yTh:I=MePk(Rrow/yT]Tu*3ArCkEdGati=G!@I` PhewR=/TTw%kUtr$V WsXt3CeGht5B!I'M(eeOd!Rm$R`SeTab!TeTh(gTi)VelW5C!?Mb R'T:K0EyJe@Li+Scu*S =Ta(Vious0CurEAyEa'Ed+U{UgUn+2EmEtIntL?LeLi)NdNyOlPul?Rt]S.]Ssib!/TatoTt yV tyWd W _@i)Ai'Ed-tEf Epa*Es|EttyEv|I)IdeIm?yIntI%.yIs#Iva>IzeOb!mO)[Odu)Of.OgramOje@Omo>OofOp tyOsp O>@OudOvide2Bl-Dd(g~LpL'Mpk(N^PilPpyR^a'R.yRpo'R'ShTZz!3Ramid:99Al.yAntumArt E,]I{ItIzO>:Bb.Cco#CeCkD?DioIlInI'~yMpN^NdomN+PidReTeTh V&WZ%3AdyAlAs#BelBuildC$lCei=CipeC%dCyc!Du)F!@F%mFu'G]G*tGul?Je@LaxLea'LiefLyMa(Memb M(dMo=Nd NewNtOp&PairPeatPla)P%tQui*ScueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOgAyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NNGradeHoldOnP Set1BOng::Rd3Ar~ow9UUngU`:3BraRo9NeO","0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60")}static wordlist(){return null==ya&&(ya=new Aa),ya}}let va=!1;const wa=function(e,a,t,c,f){return(0,Fe.T_)(e,a,t,c,f)};let _a=wa;function Ia(e,a,t,c,f){const d=(0,h.q5)(e,"password"),r=(0,h.q5)(a,"salt");return(0,h.c$)(_a(d,r,t,c,f))}function Ea(e){return(1<=12&&t.length<=24,"invalid mnemonic length","mnemonic","[ REDACTED ]");const c=new Uint8Array(Math.ceil(11*t.length/8));let f=0;for(let e=0;e=0,`invalid mnemonic word at index ${e}`,"mnemonic","[ REDACTED ]");for(let e=0;e<11;e++)d&1<<10-e&&(c[f>>3]|=1<<7-f%8),f++}const d=32*t.length/3,r=Ea(t.length/3),n=(0,h.q5)((0,Oe.s)(c.slice(0,d/8)))[0]&r;return(0,l.MR)(n===(c[c.length-1]&r),"invalid mnemonic checksum","mnemonic","[ REDACTED ]"),(0,h.c$)(c.slice(0,d/8))}function Ma(e,a){(0,l.MR)(e.length%4==0&&e.length>=16&&e.length<=32,"invalid entropy size","entropy","[ REDACTED ]"),null==a&&(a=Aa.wordlist());const t=[0];let c=11;for(let a=0;a8?(t[t.length-1]<<=8,t[t.length-1]|=e[a],c-=8):(t[t.length-1]<<=c,t[t.length-1]|=e[a]>>8-c,t.push(e[a]&(1<<8-c)-1&255),c+=3);const f=e.length/4,d=parseInt((0,Oe.s)(e).substring(2,4),16)&Ea(f);return t[t.length-1]<<=f,t[t.length-1]|=d>>8-f,a.join(t.map((e=>a.getWord(e))))}Ia._=wa,Ia.lock=function(){va=!0},Ia.register=function(e){if(va)throw new Error("pbkdf2 is locked");_a=e},Object.freeze(Ia);const Ba={};class ka{phrase;password;wordlist;entropy;constructor(e,a,t,c,f){null==c&&(c=""),null==f&&(f=Aa.wordlist()),(0,l.gk)(e,Ba,"Mnemonic"),(0,s.n)(this,{phrase:t,password:c,wordlist:f,entropy:a})}computeSeed(){const e=(0,u.YW)("mnemonic"+this.password,"NFKD");return Ia((0,u.YW)(this.phrase,"NFKD"),e,2048,64,"sha512")}static fromPhrase(e,a,t){const c=Ca(e,t);return e=Ma((0,h.q5)(c),t),new ka(Ba,c,e,a,t)}static fromEntropy(e,a,t){const c=(0,h.q5)(e,"entropy"),f=Ma(c,t);return new ka(Ba,(0,h.c$)(c),f,a,t)}static entropyToPhrase(e,a){return Ma((0,h.q5)(e,"entropy"),a)}static phraseToEntropy(e,a){return Ca(e,a)}static isValidMnemonic(e,a){try{return Ca(e,a),!0}catch(e){}return!1}}var La,Sa,Ta,Na=function(e,a,t,c){if("a"===t&&!c)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof a?e!==a||!c:!a.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?c:"a"===t?c.call(e):c?c.value:a.get(e)},Ra=function(e,a,t,c,f){if("m"===c)throw new TypeError("Private method is not writable");if("a"===c&&!f)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof a?e!==a||!f:!a.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===c?f.call(e,t):f?f.value=t:a.set(e,t),t};const Pa={16:10,24:12,32:14},Da=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],Oa=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],Fa=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],Qa=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],Ua=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],ja=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],Ha=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],qa=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],$a=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],za=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],Ga=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Ka=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Va=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Za=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Ja=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Wa(e){const a=[];for(let t=0;t>2,Na(this,Ta,"f")[d][e%4]=f[e],Na(this,Sa,"f")[a-d][e%4]=f[e];let r,n=0,i=c;for(;i>16&255]<<24^Oa[r>>8&255]<<16^Oa[255&r]<<8^Oa[r>>24&255]^Da[n]<<24,n+=1,8!=c)for(let e=1;e>8&255]<<8^Oa[r>>16&255]<<16^Oa[r>>24&255]<<24;for(let e=c/2+1;e>2,d=i%4,Na(this,Ta,"f")[e][d]=f[b],Na(this,Sa,"f")[a-e][d]=f[b++],i++}for(let e=1;e>24&255]^Va[r>>16&255]^Za[r>>8&255]^Ja[255&r]}encrypt(e){if(16!=e.length)throw new TypeError("invalid plaintext size (must be 16 bytes)");const a=Na(this,Ta,"f").length-1,t=[0,0,0,0];let c=Wa(e);for(let e=0;e<4;e++)c[e]^=Na(this,Ta,"f")[0][e];for(let e=1;e>24&255]^Ua[c[(a+1)%4]>>16&255]^ja[c[(a+2)%4]>>8&255]^Ha[255&c[(a+3)%4]]^Na(this,Ta,"f")[e][a];c=t.slice()}const f=new Uint8Array(16);let d=0;for(let e=0;e<4;e++)d=Na(this,Ta,"f")[a][e],f[4*e]=255&(Oa[c[e]>>24&255]^d>>24),f[4*e+1]=255&(Oa[c[(e+1)%4]>>16&255]^d>>16),f[4*e+2]=255&(Oa[c[(e+2)%4]>>8&255]^d>>8),f[4*e+3]=255&(Oa[255&c[(e+3)%4]]^d);return f}decrypt(e){if(16!=e.length)throw new TypeError("invalid ciphertext size (must be 16 bytes)");const a=Na(this,Sa,"f").length-1,t=[0,0,0,0];let c=Wa(e);for(let e=0;e<4;e++)c[e]^=Na(this,Sa,"f")[0][e];for(let e=1;e>24&255]^$a[c[(a+3)%4]>>16&255]^za[c[(a+2)%4]>>8&255]^Ga[255&c[(a+1)%4]]^Na(this,Sa,"f")[e][a];c=t.slice()}const f=new Uint8Array(16);let d=0;for(let e=0;e<4;e++)d=Na(this,Sa,"f")[a][e],f[4*e]=255&(Fa[c[e]>>24&255]^d>>24),f[4*e+1]=255&(Fa[c[(e+3)%4]>>16&255]^d>>16),f[4*e+2]=255&(Fa[c[(e+2)%4]>>8&255]^d>>8),f[4*e+3]=255&(Fa[255&c[(e+1)%4]]^d);return f}}La=new WeakMap,Sa=new WeakMap,Ta=new WeakMap;class Xa{constructor(e,a,t){if(t&&!(this instanceof t))throw new Error(`${e} must be instantiated with "new"`);Object.defineProperties(this,{aes:{enumerable:!0,value:new Ya(a)},name:{enumerable:!0,value:e}})}}var et,at,tt=function(e,a,t,c,f){if("m"===c)throw new TypeError("Private method is not writable");if("a"===c&&!f)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof a?e!==a||!f:!a.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===c?f.call(e,t):f?f.value=t:a.set(e,t),t},ct=function(e,a,t,c){if("a"===t&&!c)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof a?e!==a||!c:!a.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?c:"a"===t?c.call(e):c?c.value:a.get(e)};class ft extends Xa{constructor(e,a){if(super("ECC",e,ft),et.set(this,void 0),at.set(this,void 0),a){if(a.length%16)throw new TypeError("invalid iv size (must be 16 bytes)");tt(this,et,new Uint8Array(a),"f")}else tt(this,et,new Uint8Array(16),"f");tt(this,at,this.iv,"f")}get iv(){return new Uint8Array(ct(this,et,"f"))}encrypt(e){if(e.length%16)throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)");const a=new Uint8Array(e.length);for(let t=0;tNumber.MAX_SAFE_INTEGER)throw new TypeError("invalid counter initial integer value");for(let a=15;a>=0;--a)bt(this,nt,"f")[a]=e%256,e=Math.floor(e/256)}setCounterBytes(e){if(16!==e.length)throw new TypeError("invalid counter initial Uint8Array value length");bt(this,nt,"f").set(e)}increment(){for(let e=15;e>=0;e--){if(255!==bt(this,nt,"f")[e]){bt(this,nt,"f")[e]++;break}bt(this,nt,"f")[e]=0}}encrypt(e){var a,t;const c=new Uint8Array(e);for(let e=0;ee<>>32-a;function pt(e,a,t,c,f,d){let r=e[a++]^t[c++],n=e[a++]^t[c++],i=e[a++]^t[c++],b=e[a++]^t[c++],o=e[a++]^t[c++],s=e[a++]^t[c++],l=e[a++]^t[c++],u=e[a++]^t[c++],h=e[a++]^t[c++],p=e[a++]^t[c++],g=e[a++]^t[c++],m=e[a++]^t[c++],x=e[a++]^t[c++],y=e[a++]^t[c++],A=e[a++]^t[c++],v=e[a++]^t[c++],w=r,_=n,I=i,E=b,C=o,M=s,B=l,k=u,L=h,S=p,T=g,N=m,R=x,P=y,D=A,O=v;for(let e=0;e<8;e+=2)C^=ht(w+R|0,7),L^=ht(C+w|0,9),R^=ht(L+C|0,13),w^=ht(R+L|0,18),S^=ht(M+_|0,7),P^=ht(S+M|0,9),_^=ht(P+S|0,13),M^=ht(_+P|0,18),D^=ht(T+B|0,7),I^=ht(D+T|0,9),B^=ht(I+D|0,13),T^=ht(B+I|0,18),E^=ht(O+N|0,7),k^=ht(E+O|0,9),N^=ht(k+E|0,13),O^=ht(N+k|0,18),_^=ht(w+E|0,7),I^=ht(_+w|0,9),E^=ht(I+_|0,13),w^=ht(E+I|0,18),B^=ht(M+C|0,7),k^=ht(B+M|0,9),C^=ht(k+B|0,13),M^=ht(C+k|0,18),N^=ht(T+S|0,7),L^=ht(N+T|0,9),S^=ht(L+N|0,13),T^=ht(S+L|0,18),R^=ht(O+D|0,7),P^=ht(R+O|0,9),D^=ht(P+R|0,13),O^=ht(D+P|0,18);f[d++]=r+w|0,f[d++]=n+_|0,f[d++]=i+I|0,f[d++]=b+E|0,f[d++]=o+C|0,f[d++]=s+M|0,f[d++]=l+B|0,f[d++]=u+k|0,f[d++]=h+L|0,f[d++]=p+S|0,f[d++]=g+T|0,f[d++]=m+N|0,f[d++]=x+R|0,f[d++]=y+P|0,f[d++]=A+D|0,f[d++]=v+O|0}function gt(e,a,t,c,f){let d=c+0,r=c+16*f;for(let c=0;c<16;c++)t[r+c]=e[a+16*(2*f-1)+c];for(let c=0;c0&&(r+=16),pt(t,d,e,a+=16,t,r)}function mt(e,a,t){const c=(0,$e.tY)({dkLen:32,asyncTick:10,maxmem:1073742848},t),{N:f,r:d,p:r,dkLen:n,asyncTick:i,maxmem:b,onProgress:o}=c;if((0,st.ai)(f),(0,st.ai)(d),(0,st.ai)(r),(0,st.ai)(n),(0,st.ai)(i),(0,st.ai)(b),void 0!==o&&"function"!=typeof o)throw new Error("progressCb should be function");const s=128*d,l=s/4;if(f<=1||f&f-1||f>=2**(s/8)||f>2**32)throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32");if(r<0||r>137438953440/s)throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");if(n<0||n>137438953440)throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32");const u=s*(f+r);if(u>b)throw new Error(`Scrypt: parameters too large, ${u} (128 * r * (N + p)) > ${b} (maxmem)`);const h=(0,ut.A)(lt.s,e,a,{c:1,dkLen:s*r}),p=(0,$e.DH)(h),g=(0,$e.DH)(new Uint8Array(s*f)),m=(0,$e.DH)(new Uint8Array(s));let x=()=>{};if(o){const e=2*f*r,a=Math.max(Math.floor(e/1e4),1);let t=0;x=()=>{t++,!o||t%a&&t!==e||o(t/e)}}return{N:f,r:d,p:r,dkLen:n,blockSize32:l,V:g,B32:p,B:h,tmp:m,blockMixCb:x,asyncTick:i}}function xt(e,a,t,c,f){const d=(0,ut.A)(lt.s,e,t,{c:1,dkLen:a});return t.fill(0),c.fill(0),f.fill(0),d}let yt=!1,At=!1;const vt=async function(e,a,t,c,f,d,r){return await async function(e,a,t){const{N:c,r:f,p:d,dkLen:r,blockSize32:n,V:i,B32:b,B:o,tmp:s,blockMixCb:l,asyncTick:u}=mt(e,a,t);for(let e=0;e{gt(i,t,i,t+=n,f),l()})),gt(i,(c-1)*n,b,a,f),l(),await(0,$e.$h)(c,u,(()=>{const e=b[a+n-16]%c;for(let t=0;t0&&!(c&c-1),"invalid kdf.N","kdf.N",c),(0,l.MR)(f>0&&d>0,"invalid kdf","kdf",a);const r=St(e,"crypto.kdfparams.dklen:int!");return(0,l.MR)(32===r,"invalid kdf.dklen","kdf.dflen",r),{name:"scrypt",salt:t,N:c,r:f,p:d,dkLen:64}}if("pbkdf2"===a.toLowerCase()){const a=St(e,"crypto.kdfparams.salt:data!"),t=St(e,"crypto.kdfparams.prf:string!"),c=t.split("-").pop();(0,l.MR)("sha256"===c||"sha512"===c,"invalid kdf.pdf","kdf.pdf",t);const f=St(e,"crypto.kdfparams.c:int!"),d=St(e,"crypto.kdfparams.dklen:int!");return(0,l.MR)(32===d,"invalid kdf.dklen","kdf.dklen",d),{name:"pbkdf2",salt:a,count:f,dkLen:d,algorithm:c}}}(0,l.MR)(!1,"unsupported key-derivation function","kdf",a)}function Ot(e){return new Promise((a=>{setTimeout((()=>{a()}),e)}))}function Ft(e){const a=null!=e.salt?(0,h.q5)(e.salt,"options.salt"):la(32);let t=1<<17,c=8,f=1;return e.scrypt&&(e.scrypt.N&&(t=e.scrypt.N),e.scrypt.r&&(c=e.scrypt.r),e.scrypt.p&&(f=e.scrypt.p)),(0,l.MR)("number"==typeof t&&t>0&&Number.isSafeInteger(t)&&(BigInt(t)&BigInt(t-1))===BigInt(0),"invalid scrypt N parameter","options.N",t),(0,l.MR)("number"==typeof c&&c>0&&Number.isSafeInteger(c),"invalid scrypt r parameter","options.r",c),(0,l.MR)("number"==typeof f&&f>0&&Number.isSafeInteger(f),"invalid scrypt p parameter","options.p",f),{name:"scrypt",dkLen:32,salt:a,N:t,r:c,p:f}}function Qt(e,a,t,c){const f=(0,h.q5)(t.privateKey,"privateKey"),d=null!=c.iv?(0,h.q5)(c.iv,"options.iv"):la(16);(0,l.MR)(16===d.length,"invalid options.iv length","options.iv",c.iv);const r=null!=c.uuid?(0,h.q5)(c.uuid,"options.uuid"):la(16);(0,l.MR)(16===r.length,"invalid options.uuid length","options.uuid",c.iv);const n=e.slice(0,16),i=e.slice(16,32),b=new ot(n,d),o=(0,h.q5)(b.encrypt(f)),s=(0,Re.S)((0,h.xW)([i,o])),u={address:t.address.substring(2).toLowerCase(),id:Mt(r),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:(0,h.c$)(d).substring(2)},ciphertext:(0,h.c$)(o).substring(2),kdf:"scrypt",kdfparams:{salt:(0,h.c$)(a.salt).substring(2),n:a.N,dklen:32,p:a.p,r:a.r},mac:s.substring(2)}};if(t.mnemonic){const a=null!=c.client?c.client:`ethers/${Tt.r}`,f=t.mnemonic.path||Nt,d=t.mnemonic.locale||"en",r=e.slice(32,64),n=(0,h.q5)(t.mnemonic.entropy,"account.mnemonic.entropy"),i=la(16),b=new ot(r,i),o=(0,h.q5)(b.encrypt(n)),s=new Date,l="UTC--"+s.getUTCFullYear()+"-"+kt(s.getUTCMonth()+1,2)+"-"+kt(s.getUTCDate(),2)+"T"+kt(s.getUTCHours(),2)+"-"+kt(s.getUTCMinutes(),2)+"-"+kt(s.getUTCSeconds(),2)+".0Z--"+u.address;u["x-ethers"]={client:a,gethFilename:l,path:f,locale:d,mnemonicCounter:(0,h.c$)(i).substring(2),mnemonicCiphertext:(0,h.c$)(o).substring(2),version:"0.1"}}return JSON.stringify(u)}function Ut(e,a,t){null==t&&(t={});const c=Lt(a),f=Ft(t),d=Ct(c,f.salt,f.N,f.r,f.p,64);return Qt((0,h.q5)(d),f,e,t)}async function jt(e,a,t){null==t&&(t={});const c=Lt(a),f=Ft(t),d=await Et(c,f.salt,f.N,f.r,f.p,64,t.progressCallback);return Qt((0,h.q5)(d),f,e,t)}const Ht="m/44'/60'/0'/0/0",qt=new Uint8Array([66,105,116,99,111,105,110,32,115,101,101,100]),$t=2147483648,zt=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");function Gt(e,a){let t="";for(;e;)t="0123456789abcdef"[e%16]+t,e=Math.trunc(e/16);for(;t.length<2*a;)t="0"+t;return"0x"+t}function Kt(e){const a=(0,h.q5)(e),t=(0,h.ZG)((0,Oe.s)((0,Oe.s)(a)),0,4),c=(0,h.xW)([a,t]);return(0,ua.R)(c)}const Vt={};function Zt(e,a,t,c){const f=new Uint8Array(37);e&$t?((0,l.vA)(null!=c,"cannot derive child of neutered node","UNSUPPORTED_OPERATION",{operation:"deriveChild"}),f.set((0,h.q5)(c),1)):f.set((0,h.q5)(t));for(let a=24;a>=0;a-=8)f[33+(a>>3)]=e>>24-a&255;const d=(0,h.q5)(He("sha512",a,f));return{IL:d.slice(0,32),IR:d.slice(32)}}function Jt(e,a){const t=a.split("/");(0,l.MR)(t.length>0,"invalid path","path",a),"m"===t[0]&&((0,l.MR)(0===e.depth,`cannot derive root path (i.e. path starting with "m/") for a node at non-zero depth ${e.depth}`,"path",a),t.shift());let c=e;for(let e=0;e=16&&t.length<=64,"invalid seed","seed","[REDACTED]");const c=(0,h.q5)(He("sha512",qt,t)),f=new Ne.h((0,h.c$)(c.slice(0,32)));return new Wt(Vt,f,"0x00000000",(0,h.c$)(c.slice(32)),"m",0,0,a,null)}static fromExtendedKey(e){const a=(0,p.c4)((0,ua.H)(e));(0,l.MR)(82===a.length||Kt(a.slice(0,78))===e,"invalid extended key","extendedKey","[ REDACTED ]");const t=a[4],c=(0,h.c$)(a.slice(5,9)),f=parseInt((0,h.c$)(a.slice(9,13)).substring(2),16),d=(0,h.c$)(a.slice(13,45)),r=a.slice(45,78);switch((0,h.c$)(a.slice(0,4))){case"0x0488b21e":case"0x043587cf":{const e=(0,h.c$)(r);return new Yt(Vt,(0,Pe.K)(e),e,c,d,null,f,t,null)}case"0x0488ade4":case"0x04358394 ":if(0!==r[0])break;return new Wt(Vt,new Ne.h(r.slice(1)),c,d,null,f,t,null,null)}(0,l.MR)(!1,"invalid extended key prefix","extendedKey","[ REDACTED ]")}static createRandom(e,a,t){null==e&&(e=""),null==a&&(a=Ht),null==t&&(t=Aa.wordlist());const c=ka.fromEntropy(la(16),e,t);return Wt.#X(c.computeSeed(),c).derivePath(a)}static fromMnemonic(e,a){return a||(a=Ht),Wt.#X(e.computeSeed(),e).derivePath(a)}static fromPhrase(e,a,t,c){null==a&&(a=""),null==t&&(t=Ht),null==c&&(c=Aa.wordlist());const f=ka.fromPhrase(e,a,c);return Wt.#X(f.computeSeed(),f).derivePath(t)}static fromSeed(e){return Wt.#X(e,null)}}class Yt extends me{publicKey;fingerprint;parentFingerprint;chainCode;path;index;depth;constructor(e,a,t,c,f,d,r,n,i){super(a,i),(0,l.gk)(e,Vt,"HDNodeVoidWallet"),(0,s.n)(this,{publicKey:t});const b=(0,h.ZG)(ia((0,Oe.s)(t)),0,4);(0,s.n)(this,{publicKey:t,fingerprint:b,parentFingerprint:c,chainCode:f,path:d,index:r,depth:n})}connect(e){return new Yt(Vt,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,e)}get extendedKey(){return(0,l.vA)(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),Kt((0,h.xW)(["0x0488B21E",Gt(this.depth,1),this.parentFingerprint,Gt(this.index,4),this.chainCode,this.publicKey]))}hasPath(){return null!=this.path}deriveChild(e){const a=(0,p.WZ)(e,"index");(0,l.MR)(a<=4294967295,"invalid index","index",a);let t=this.path;t&&(t+="/"+(2147483647&a),a&$t&&(t+="'"));const{IR:c,IL:f}=Zt(a,this.chainCode,this.publicKey,null),d=Ne.h.addPoints(f,this.publicKey,!0),r=(0,Pe.K)(d);return new Yt(Vt,r,d,this.fingerprint,(0,h.c$)(c),t,a,this.depth+1,this.provider)}derivePath(e){return Jt(this,e)}}function Xt(e){try{if(JSON.parse(e).encseed)return!0}catch(e){}return!1}function ec(e,a){const t=JSON.parse(e),c=Lt(a),f=(0,n.b)(St(t,"ethaddr:string!")),d=Bt(St(t,"encseed:string!"));(0,l.MR)(d&&d.length%16==0,"invalid encseed","json",e);const r=(0,h.q5)(Ia(c,c,2e3,32,"sha256")).slice(0,16),i=d.slice(0,16),b=d.slice(16),o=new ft(r,i),s=function(e){if(e.length<16)throw new TypeError("PKCS#7 invalid length");const a=e[e.length-1];if(a>16)throw new TypeError("PKCS#7 padding byte out of range");const t=e.length-a;for(let c=0;c{setTimeout((()=>{a()}),e)}))}class tc extends De{constructor(e,a){"string"!=typeof e||e.startsWith("0x")||(e="0x"+e),super("string"==typeof e?new Ne.h(e):e,a)}connect(e){return new tc(this.signingKey,e)}async encrypt(e,a){const t={address:this.address,privateKey:this.privateKey};return await jt(t,e,{progressCallback:a})}encryptSync(e){return Ut({address:this.address,privateKey:this.privateKey},e)}static#ee(e){if((0,l.MR)(e,"invalid JSON wallet","json","[ REDACTED ]"),"mnemonic"in e&&e.mnemonic&&"en"===e.mnemonic.locale){const a=ka.fromEntropy(e.mnemonic.entropy),t=Wt.fromMnemonic(a,e.mnemonic.path);if(t.address===e.address&&t.privateKey===e.privateKey)return t;console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key")}const a=new tc(e.privateKey);return(0,l.MR)(a.address===e.address,"address/privateKey mismatch","json","[ REDACTED ]"),a}static async fromEncryptedJson(e,a,t){let c=null;return Rt(e)?c=await async function(e,a,t){const c=JSON.parse(e),f=Lt(a),d=Dt(c);if("pbkdf2"===d.name){t&&(t(0),await Ot(0));const{salt:e,count:a,dkLen:r,algorithm:n}=d,i=Ia(f,e,a,r,n);return t&&(t(1),await Ot(0)),Pt(c,i)}(0,l.vA)("scrypt"===d.name,"cannot be reached","UNKNOWN_ERROR",{params:d});const{salt:r,N:n,r:i,p:b,dkLen:o}=d;return Pt(c,await Et(f,r,n,i,b,o,t))}(e,a,t):Xt(e)&&(t&&(t(0),await ac(0)),c=ec(e,a),t&&(t(1),await ac(0))),tc.#ee(c)}static fromEncryptedJsonSync(e,a){let t=null;return Rt(e)?t=function(e,a){const t=JSON.parse(e),c=Lt(a),f=Dt(t);if("pbkdf2"===f.name){const{salt:e,count:a,dkLen:d,algorithm:r}=f;return Pt(t,Ia(c,e,a,d,r))}(0,l.vA)("scrypt"===f.name,"cannot be reached","UNKNOWN_ERROR",{params:f});const{salt:d,N:r,r:n,p:i,dkLen:b}=f;return Pt(t,Ct(c,d,r,n,i,b))}(e,a):Xt(e)?t=ec(e,a):(0,l.MR)(!1,"invalid JSON wallet","json","[ REDACTED ]"),tc.#ee(t)}static createRandom(e){const a=Wt.createRandom();return e?a.connect(e):a}static fromPhrase(e,a){const t=Wt.fromPhrase(e);return a?t.connect(a):t}}class cc extends ke{#ae;constructor(e,a,t){const c=Object.assign({},null!=t?t:{},{batchMaxCount:1});(0,l.MR)(e&&e.request,"invalid EIP-1193 provider","ethereum",e),super(a,c),this.#ae=async(a,t)=>{const c={method:a,params:t};this.emit("debug",{action:"sendEip1193Request",payload:c});try{const a=await e.request(c);return this.emit("debug",{action:"receiveEip1193Result",result:a}),a}catch(e){const a=new Error(e.message);throw a.code=e.code,a.data=e.data,a.payload=c,this.emit("debug",{action:"receiveEip1193Error",error:a}),a}}}async send(e,a){return await this._start(),await super.send(e,a)}async _send(e){(0,l.MR)(!Array.isArray(e),"EIP-1193 does not support batch request","payload",e);try{const a=await this.#ae(e.method,e.params||[]);return[{id:e.id,result:a}]}catch(a){return[{id:e.id,error:{code:a.code,data:a.data,message:a.message}}]}}getRpcError(e,a){switch((a=JSON.parse(JSON.stringify(a))).error.code||-1){case 4001:a.error.message=`ethers-user-denied: ${a.error.message}`;break;case 4200:a.error.message=`ethers-unsupported: ${a.error.message}`}return super.getRpcError(e,a)}async hasSigner(e){null==e&&(e=0);const a=await this.send("eth_accounts",[]);return"number"==typeof e?a.length>e:(e=e.toLowerCase(),0!==a.filter((a=>a.toLowerCase()===e)).length)}async getSigner(e){if(null==e&&(e=0),!await this.hasSigner(e))try{await this.#ae("eth_requestAccounts",[])}catch(e){const a=e.payload;throw this.getRpcError(a,{id:a.id,error:e})}return await super.getSigner(e)}}var fc=t(67418);const dc="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0";function rc({fetchUrl:e,proxyUrl:a,torPort:c,retry:f}){const{HttpProxyAgent:d}=t(60513),{HttpsProxyAgent:r}=t(2378),{SocksProxyAgent:n}=t(60290);if(c)return new n(`socks5h://tor${f}@127.0.0.1:${c}`);if(!a)return;const i=e.includes("https://");return a.includes("socks://")||a.includes("socks4://")||a.includes("socks5://")?new n(a):a.includes("http://")||a.includes("https://")?i?new r(a):new d(a):void 0}async function nc(e,a={}){const t=a.maxRetry??3,c=a.retryOn??500,d=a.userAgent??dc,r=globalThis.useGlobalFetch?globalThis.fetch:f();let n,i=0;for(a.method||(a.body?a.method="POST":a.method="GET"),a.headers||(a.headers={}),fc.Ll&&!a.headers["User-Agent"]&&(a.headers["User-Agent"]=d);i{e.abort()}),a.timeout),a.cancelSignal){if(a.cancelSignal.cancelled)throw new Error("request cancelled before sending");a.cancelSignal.addListener((()=>{e.abort()}))}}!a.agent&&fc.Ll&&(a.proxy||a.torPort)&&(a.agent=rc({fetchUrl:e,proxyUrl:a.proxy,torPort:a.torPort,retry:i})),a.debug&&"function"==typeof a.debug&&a.debug("request",{url:e,retry:i,errorObject:n,options:a});try{const t=await r(e,{method:a.method,headers:a.headers,body:a.body,redirect:a.redirect,signal:a.signal,agent:a.agent});if(a.debug&&"function"==typeof a.debug&&a.debug("response",t),!t.ok){const a=`Request to ${e} failed with error code ${t.status}:\n`+await t.text();throw new Error(a)}if(a.returnResponse)return t;const c=t.headers.get("content-type");return c?.includes("application/json")?await t.json():c?.includes("text")?await t.text():t}catch(e){t&&clearTimeout(t),n=e,i++,await(0,fc.yy)(c)}finally{t&&clearTimeout(t)}}throw a.debug&&"function"==typeof a.debug&&a.debug("error",n),n}const ic=(e={})=>async(a,t)=>{const c={...e,method:a.method||"POST",headers:a.headers,body:a.body||void 0,timeout:e.timeout||a.timeout,cancelSignal:t,returnResponse:!0},f=await nc(a.url,c),d={};f.headers.forEach(((e,a)=>{d[a.toLowerCase()]=e}));const r=await f.arrayBuffer(),n=null==r?null:new Uint8Array(r);return{statusCode:f.status,statusMessage:f.statusText,headers:d,body:n}};async function bc(e,a){const t=new d.ui(e);t.getUrlFunc=ic(a);const c=await new Le(t).getNetwork(),f=Number(c.chainId);if(a?.netId&&a.netId!==f){const t=`Wrong network for ${e}, wants ${a.netId} got ${f}`;throw new Error(t)}return new Le(t,c,{staticNetwork:c,pollingInterval:a?.pollingInterval||1e3})}function oc(e,a,t,c){const{networkName:f,reverseRecordsContract:r,pollInterval:n}=t,i=Boolean(r),b=new d.ui(a);b.getUrlFunc=ic(c);const o=new U(f,e);return i&&o.attachPlugin(new O(null,Number(e))),o.attachPlugin(new D),new Le(b,o,{staticNetwork:o,pollingInterval:c?.pollingInterval||1e3*n})}const sc=async(e,a)=>{const t=e.provider;if(a.from){if(a.from!==e.address){const t=`populateTransaction: signer mismatch for tx, wants ${a.from} have ${e.address}`;throw new Error(t)}}else a.from=e.address;const[c,f]=await Promise.all([a.maxFeePerGas||a.gasPrice?void 0:t.getFeeData(),a.nonce?void 0:t.getTransactionCount(e.address,"pending")]);if(c&&(c.maxFeePerGas?(a.type||(a.type=2),a.maxFeePerGas=c.maxFeePerGas*(BigInt(1e4)+BigInt(e.gasPriceBump))/BigInt(1e4),a.maxPriorityFeePerGas=c.maxPriorityFeePerGas,delete a.gasPrice):c.gasPrice&&(a.type||(a.type=0),a.gasPrice=c.gasPrice,delete a.maxFeePerGas,delete a.maxPriorityFeePerGas)),f&&(a.nonce=f),!a.gasLimit)try{const c=await t.estimateGas(a);a.gasLimit=c===BigInt(21e3)?c:c*(BigInt(1e4)+BigInt(e.gasLimitBump))/BigInt(1e4)}catch(t){if(!e.gasFailover)throw t;console.log("populateTransaction: warning gas estimation failed falling back to 3M gas"),a.gasLimit=BigInt("3000000")}return a};class lc extends tc{nonce;gasPriceBump;gasLimitBump;gasFailover;bumpNonce;constructor(e,a,{gasPriceBump:t,gasLimitBump:c,gasFailover:f,bumpNonce:d}={}){super(e,a),this.gasPriceBump=t??0,this.gasLimitBump=c??3e3,this.gasFailover=f??!1,this.bumpNonce=d??!1}static fromMnemonic(e,a,t=0,c){const f=`m/44'/60'/0'/0/${t}`,{privateKey:d}=Wt.fromPhrase(e,void 0,f);return new lc(d,a,c)}async populateTransaction(e){const a=await sc(this,e);return this.nonce=Number(a.nonce),super.populateTransaction(a)}}class uc extends me{nonce;gasPriceBump;gasLimitBump;gasFailover;bumpNonce;constructor(e,a,{gasPriceBump:t,gasLimitBump:c,gasFailover:f,bumpNonce:d}={}){super(e,a),this.gasPriceBump=t??0,this.gasLimitBump=c??3e3,this.gasFailover=f??!1,this.bumpNonce=d??!1}async populateTransaction(e){const a=await sc(this,e);return this.nonce=Number(a.nonce),super.populateTransaction(a)}}class hc extends Me{nonce;gasPriceBump;gasLimitBump;gasFailover;bumpNonce;constructor(e,a,{gasPriceBump:t,gasLimitBump:c,gasFailover:f,bumpNonce:d}={}){super(e,a),this.gasPriceBump=t??0,this.gasLimitBump=c??3e3,this.gasFailover=f??!1,this.bumpNonce=d??!1}async sendUncheckedTransaction(e){return super.sendUncheckedTransaction(await sc(this,e))}}class pc extends cc{options;constructor(e,a,t){super(e,a),this.options=t}async getSigner(e){const a=(await super.getSigner(e)).address;return this.options?.netId&&this.options?.connectWallet&&Number(await super.send("net_version",[]))!==this.options?.netId&&await this.options.connectWallet(this.options?.netId),this.options?.handleNetworkChanges&&window?.ethereum?.on("chainChanged",this.options.handleNetworkChanges),this.options?.handleAccountChanges&&window?.ethereum?.on("accountsChanged",this.options.handleAccountChanges),this.options?.handleAccountDisconnect&&window?.ethereum?.on("disconnect",this.options.handleAccountDisconnect),new hc(this,a,this.options)}}},57194:(e,a,t)=>{"use strict";t.d(a,{KN:()=>o,OR:()=>g,Ss:()=>b,XF:()=>h,c$:()=>u,pO:()=>s,sN:()=>p,zy:()=>l});var c=t(99770),f=t(30031),d=t(67418),r=t(59499),n=t(46170),i=t(59511);const b=.1,o=.9,s=(0,c.g5)("500");function l({stakeBalance:e,tornadoServiceFee:a}){if(a=o)return BigInt(0);const t=1-1/(o-b)**2*(a-b)**2;return BigInt(Math.floor(Number(e||"0")*t))}function u(e,a){for(let t=0;tObject.values(e))).flat().map((e=>(0,f.b)(e)))}function p(e){const a=e.map((e=>l(e))),t=a.reduce(((e,a)=>e+a),BigInt("0"));return e[u(a,BigInt(Math.floor(Number(t)*Math.random())))]}class g{netId;config;selectedRelayer;fetchDataOptions;tovarish;constructor({netId:e,config:a,fetchDataOptions:t}){this.netId=e,this.config=a,this.fetchDataOptions=t,this.tovarish=!1}async askRelayerStatus({hostname:e,url:a,relayerAddress:t}){!a&&e?a=`https://${e.endsWith("/")?e:e+"/"}`:a&&!a.endsWith("/")?a+="/":a="";const c=await(0,n.Fd)(`${a}status`,{...this.fetchDataOptions,headers:{"Content-Type":"application/json, application/x-www-form-urlencoded"},timeout:3e4,maxRetry:this.fetchDataOptions?.torPort?2:0});if(!i.SS.compile((0,i.c_)(this.netId,this.config,this.tovarish))(c))throw new Error("Invalid status schema");const f={...c,url:a};if(f.currentQueue>5)throw new Error("Withdrawal queue is overloaded");if(f.netId!==this.netId)throw new Error("This relayer serves a different network");if(t&&this.netId===r.zr.MAINNET&&f.rewardAccount!==t)throw new Error("The Relayer reward address must match registered address");return f}async filterRelayer(e){const a=e.hostnames[this.netId],{ensName:t,relayerAddress:c}=e;if(a)try{const d=await this.askRelayerStatus({hostname:a,relayerAddress:c});return{netId:d.netId,url:d.url,hostname:a,ensName:t,relayerAddress:c,rewardAccount:(0,f.b)(d.rewardAccount),instances:h(d.instances),stakeBalance:e.stakeBalance,gasPrice:d.gasPrices?.fast,ethPrices:d.ethPrices,currentQueue:d.currentQueue,tornadoServiceFee:d.tornadoServiceFee}}catch(e){return{hostname:a,relayerAddress:c,errorMessage:e.message,hasError:!0}}}async getValidRelayers(e){const a=[];return{validRelayers:(await Promise.all(e.map((e=>this.filterRelayer(e))))).filter((e=>!(!e||e.hasError&&(a.push(e),1)))),invalidRelayers:a}}pickWeightedRandomRelayer(e){return p(e)}async tornadoWithdraw({contract:e,proof:a,args:t},c){const{url:f}=this.selectedRelayer,r=await(0,n.Fd)(`${f}v1/tornadoWithdraw`,{...this.fetchDataOptions,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contract:e,proof:a,args:t})}),{id:b,error:o}=r;if(o)throw new Error(o);if(!i.SS.compile(i.Yq)(r))throw new Error(`${f}v1/tornadoWithdraw has an invalid job response`);let s;"function"==typeof c&&c(r);const l=`${f}v1/jobs/${b}`;for(console.log(`Job submitted: ${l}\n`);!s||!["FAILED","CONFIRMED"].includes(s);){const e=await(0,n.Fd)(l,{...this.fetchDataOptions,method:"GET",headers:{"Content-Type":"application/json"}});if(e.error)throw new Error(o);if(!i.SS.compile(i.Us)(e))throw new Error(`${l} has an invalid job response`);const{status:a,txHash:t,confirmations:f,failedReason:r}=e;if(s!==a){if("FAILED"===a)throw new Error(`Job ${a}: ${l} failed reason: ${r}`);"SENT"===a?console.log(`Job ${a}: ${l}, txhash: ${t}\n`):"MINED"===a||"CONFIRMED"===a?console.log(`Job ${a}: ${l}, txhash: ${t}, confirmations: ${f}\n`):console.log(`Job ${a}: ${l}\n`),s=a,"function"==typeof c&&c(e)}await(0,d.yy)(3e3)}}}},59511:(e,a,t)=>{"use strict";t.d(a,{SC:()=>n,SS:()=>r,iL:()=>i,i1:()=>s,yF:()=>o,CI:()=>m,ME:()=>A,XW:()=>v,ZC:()=>w,c_:()=>E,FR:()=>h,Yq:()=>M,Us:()=>C,Y6:()=>b,cl:()=>p,Fz:()=>g,U7:()=>y,$j:()=>x});var c=t(63282),f=t.n(c),d=t(41442);const r=new(f())({allErrors:!0});r.addKeyword({keyword:"BN",validate:(e,a)=>{try{return BigInt(a),!0}catch{return!1}},errors:!0}),r.addKeyword({keyword:"isAddress",validate:(e,a)=>{try{return(0,d.PW)(a)}catch{return!1}},errors:!0});const n={type:"string",pattern:"^0x[a-fA-F0-9]{40}$",isAddress:!0},i={type:"string",BN:!0},b={type:"string",pattern:"^0x[a-fA-F0-9]{512}$"},o={type:"string",pattern:"^0x[a-fA-F0-9]{64}$"},s={...o,BN:!0},l={blockNumber:{type:"number"},logIndex:{type:"number"},transactionHash:o},u=Object.keys(l),h={type:"array",items:{anyOf:[{type:"object",properties:{...l,event:{type:"string"},id:{type:"number"},proposer:n,target:n,startTime:{type:"number"},endTime:{type:"number"},description:{type:"string"}},required:[...u,"event","id","proposer","target","startTime","endTime","description"],additionalProperties:!1},{type:"object",properties:{...l,event:{type:"string"},proposalId:{type:"number"},voter:n,support:{type:"boolean"},votes:{type:"string"},from:n,input:{type:"string"}},required:[...u,"event","proposalId","voter","support","votes","from","input"],additionalProperties:!1},{type:"object",properties:{...l,event:{type:"string"},account:n,delegateTo:n},required:[...u,"account","delegateTo"],additionalProperties:!1},{type:"object",properties:{...l,event:{type:"string"},account:n,delegateFrom:n},required:[...u,"account","delegateFrom"],additionalProperties:!1}]}},p={type:"array",items:{anyOf:[{type:"object",properties:{...l,event:{type:"string"},ensName:{type:"string"},relayerAddress:n,ensHash:{type:"string"},stakedAmount:{type:"string"}},required:[...u,"event","ensName","relayerAddress","ensHash","stakedAmount"],additionalProperties:!1},{type:"object",properties:{...l,event:{type:"string"},relayerAddress:n},required:[...u,"event","relayerAddress"],additionalProperties:!1},{type:"object",properties:{...l,event:{type:"string"},relayerAddress:n,workerAddress:n},required:[...u,"event","relayerAddress","workerAddress"],additionalProperties:!1}]}},g={type:"array",items:{type:"object",properties:{...l,relayerAddress:n,amountBurned:i,instanceAddress:n,gasFee:i,relayerFee:i,timestamp:{type:"number"}},required:[...u,"relayerAddress","amountBurned","instanceAddress","gasFee","relayerFee","timestamp"],additionalProperties:!1}},m={type:"array",items:{type:"object",properties:{...l,commitment:o,leafIndex:{type:"number"},timestamp:{type:"number"},from:n},required:[...u,"commitment","leafIndex","timestamp","from"],additionalProperties:!1}},x={type:"array",items:{type:"object",properties:{...l,nullifierHash:o,to:n,fee:i,timestamp:{type:"number"}},required:[...u,"nullifierHash","to","fee","timestamp"],additionalProperties:!1}},y={type:"array",items:{anyOf:[{type:"object",properties:{...l,event:{type:"string"},instanceAddress:{type:"string"},commitment:o,leafIndex:{type:"number"},timestamp:{type:"number"},from:n},required:[...u,"event","instanceAddress","commitment","leafIndex","timestamp","from"],additionalProperties:!1},{type:"object",properties:{...l,event:{type:"string"},instanceAddress:{type:"string"},nullifierHash:o,to:n,relayerAddress:n,fee:i,timestamp:{type:"number"}},required:[...u,"event","instanceAddress","nullifierHash","to","relayerAddress","fee","timestamp"],additionalProperties:!1}]}},A={type:"array",items:{type:"object",properties:{...l,address:n,encryptedAccount:{type:"string"}},required:[...u,"address","encryptedAccount"],additionalProperties:!1}},v={type:"array",items:{type:"object",properties:{...l,encryptedNote:{type:"string"}},required:[...u,"encryptedNote"],additionalProperties:!1}};function w(e){if("tornado"===e)return r.compile(y);if("deposit"===e)return r.compile(m);if("withdrawal"===e)return r.compile(x);if("governance"===e)return r.compile(h);if("registry"===e)return r.compile(p);if("revenue"===e)return r.compile(g);if("echo"===e)return r.compile(A);if("encrypted_notes"===e)return r.compile(v);throw new Error("Unsupported event type for schema validation")}var _=t(59499);const I={type:"object",properties:{rewardAccount:n,gasPrices:{type:"object",properties:{fast:{type:"number"},additionalProperties:{type:"number"}},required:["fast"]},netId:{type:"integer"},tornadoServiceFee:{type:"number",maximum:20,minimum:0},latestBlock:{type:"number"},latestBalance:i,version:{type:"string"},health:{type:"object",properties:{status:{const:"true"},error:{type:"string"}},required:["status"]},syncStatus:{type:"object",properties:{events:{type:"boolean"},tokenPrice:{type:"boolean"},gasPrice:{type:"boolean"}},required:["events","tokenPrice","gasPrice"]},onSyncEvents:{type:"boolean"},currentQueue:{type:"number"}},required:["rewardAccount","instances","netId","tornadoServiceFee","version","health","currentQueue"]};function E(e,a,t){const{tokens:c,optionalTokens:f,disabledTokens:d,nativeCurrency:r}=a,b=JSON.parse(JSON.stringify(I)),o=Object.keys(c).reduce(((e,a)=>{const{instanceAddress:t,tokenAddress:r,symbol:i,decimals:b,optionalInstances:o=[]}=c[a],s=Object.keys(t),l={type:"object",properties:{instanceAddress:{type:"object",properties:s.reduce(((e,a)=>(e[a]=n,e)),{}),required:s.filter((e=>!o.includes(e)))},decimals:{enum:[b]}},required:["instanceAddress","decimals"].concat(r?["tokenAddress"]:[],i?["symbol"]:[])};return r&&(l.properties.tokenAddress=n),i&&(l.properties.symbol={enum:[i]}),e.properties[a]=l,f?.includes(a)||d?.includes(a)||e.required.push(a),e}),{type:"object",properties:{},required:[]});b.properties.instances=o;const s=Object.keys(c).filter((e=>e!==r&&!a.optionalTokens?.includes(e)&&!a.disabledTokens?.includes(e)));if(e===_.zr.MAINNET&&s.push("torn"),s.length){const e={type:"object",properties:s.reduce(((e,a)=>(e[a]=i,e)),{}),required:s};b.properties.ethPrices=e,b.required.push("ethPrices")}return t&&b.required.push("gasPrices","latestBlock","latestBalance","syncStatus","onSyncEvents"),b}const C={type:"object",properties:{error:{type:"string"},id:{type:"string"},type:{type:"string"},status:{type:"string"},contract:{type:"string"},proof:{type:"string"},args:{type:"array",items:{type:"string"}},txHash:{type:"string"},confirmations:{type:"number"},failedReason:{type:"string"}},required:["id","status"]},M={...C,required:["id"]}},7393:(e,a,t)=>{"use strict";t.d(a,{H:()=>n});var c=t(98982),f=t(62463),d=t(67418),r=t(48486);async function n({provider:e,Multicall:a,currencyName:t,userAddress:n,tokenAddresses:i=[]}){const b=i.map((a=>{const t=f.Xc.connect(a,e);return[{contract:t,name:"balanceOf",params:[n]},{contract:t,name:"name"},{contract:t,name:"symbol"},{contract:t,name:"decimals"}]})).flat(),o=await(0,r.C)(a,[{contract:a,name:"getEthBalance",params:[n]},...b.length?b:[]]),s=o[0],l=(o.slice(1).length?(0,d.iv)(o.slice(1),b.length/i.length):[]).map(((e,a)=>{const[t,c,f,d]=e;return{address:i[a],name:c,symbol:f,decimals:Number(d),balance:t}}));return[{address:c.j,name:t,symbol:t,decimals:18,balance:s},...l]}},96838:(e,a,t)=>{"use strict";t.d(a,{E:()=>b,o:()=>i});var c=t(30031),f=t(57194),d=t(46170),r=t(59511),n=t(59499);const i=5e3;class b extends f.OR{constructor(e){super(e),this.tovarish=!0}async askRelayerStatus({hostname:e,url:a,relayerAddress:t}){const c=await super.askRelayerStatus({hostname:e,url:a,relayerAddress:t});if(!c.version.includes("tovarish"))throw new Error("Not a tovarish relayer!");return c}async askAllStatus({hostname:e,url:a,relayerAddress:t}){!a&&e?a=`https://${e.endsWith("/")?e:e+"/"}`:a&&!a.endsWith("/")?a+="/":a="";const c=await(0,d.Fd)(`${a}status`,{...this.fetchDataOptions,headers:{"Content-Type":"application/json, application/x-www-form-urlencoded"},timeout:3e4,maxRetry:this.fetchDataOptions?.torPort?2:0});if(!Array.isArray(c))return[];const f=[];for(const e of c){const c=e.netId,d=(0,n.zj)(c);if(!r.SS.compile((0,r.c_)(e.netId,d,this.tovarish)))continue;const i={...e,url:`${a}${c}/`};if(i.currentQueue>5)throw new Error("Withdrawal queue is overloaded");if(!n.Af.includes(i.netId))throw new Error("This relayer serves a different network");if(t&&i.netId===n.zr.MAINNET&&i.rewardAccount!==t)throw new Error("The Relayer reward address must match registered address");if(!i.version.includes("tovarish"))throw new Error("Not a tovarish relayer!");f.push(i)}return f}async filterRelayer(e){const{ensName:a,relayerAddress:t,tovarishHost:d,tovarishNetworks:r}=e;if(!d||!r?.includes(this.netId))return;const n=`${d}/${this.netId}`;try{const d=await this.askRelayerStatus({hostname:n,relayerAddress:t});return{netId:d.netId,url:d.url,hostname:n,ensName:a,relayerAddress:t,rewardAccount:(0,c.b)(d.rewardAccount),instances:(0,f.XF)(d.instances),stakeBalance:e.stakeBalance,gasPrice:d.gasPrices?.fast,ethPrices:d.ethPrices,currentQueue:d.currentQueue,tornadoServiceFee:d.tornadoServiceFee,latestBlock:Number(d.latestBlock),latestBalance:d.latestBalance,version:d.version,events:d.events,syncStatus:d.syncStatus}}catch(e){return{hostname:n,relayerAddress:t,errorMessage:e.message,hasError:!0}}}async getValidRelayers(e){const a=[];return{validRelayers:(await Promise.all(e.map((e=>this.filterRelayer(e))))).filter((e=>!(!e||e.hasError&&(a.push(e),1)))),invalidRelayers:a}}async getTovarishRelayers(e){const a=[],t=[];return await Promise.all(e.filter((e=>e.tovarishHost&&e.tovarishNetworks?.length)).map((async e=>{const{ensName:d,relayerAddress:r,tovarishHost:n}=e;try{const t=await this.askAllStatus({hostname:n,relayerAddress:r});for(const i of t)a.push({netId:i.netId,url:i.url,hostname:n,ensName:d,relayerAddress:r,rewardAccount:(0,c.b)(i.rewardAccount),instances:(0,f.XF)(i.instances),stakeBalance:e.stakeBalance,gasPrice:i.gasPrices?.fast,ethPrices:i.ethPrices,currentQueue:i.currentQueue,tornadoServiceFee:i.tornadoServiceFee,latestBlock:Number(i.latestBlock),latestBalance:i.latestBalance,version:i.version,events:i.events,syncStatus:i.syncStatus})}catch(e){t.push({hostname:n,relayerAddress:r,errorMessage:e.message,hasError:!0})}}))),{validRelayers:a,invalidRelayers:t}}async getEvents({type:e,currency:a,amount:t,fromBlock:c,recent:f}){const n=`${this.selectedRelayer?.url}events`,b=(0,r.ZC)(e);try{const r=[];let o=c;for(;;){let{events:s,lastSyncBlock:l}=await(0,d.Fd)(n,{...this.fetchDataOptions,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:e,currency:a,amount:t,fromBlock:c,recent:f})});if(!b(s)){const a=`Schema validation failed for ${e} events`;throw new Error(a)}if(f)return{events:s,lastSyncBlock:l};if(o=l,!Array.isArray(s)||!s.length)break;s=s.sort(((e,a)=>e.blockNumber===a.blockNumber?e.logIndex-a.logIndex:e.blockNumber-a.blockNumber));const[u]=s.slice(-1);if(s.lengthe.blockNumber!==u.blockNumber)),c=Number(u.blockNumber),r.push(...s)}return{events:r,lastSyncBlock:o}}catch(e){return console.log("Error from TovarishClient events endpoint"),console.log(e),{events:[],lastSyncBlock:c}}}}},62463:(e,a,t)=>{"use strict";t.d(a,{rZ:()=>b,S4:()=>s,BB:()=>u,p2:()=>n,Xc:()=>p,Q2:()=>m,Hk:()=>y,Ld:()=>v,Rp:()=>_,XB:()=>c});var c={};t.r(c),t.d(c,{ENSNameWrapper__factory:()=>b,ENSRegistry__factory:()=>s,ENSResolver__factory:()=>u,ENS__factory:()=>n,ERC20__factory:()=>p,Multicall__factory:()=>m,OffchainOracle__factory:()=>y,OvmGasPriceOracle__factory:()=>v,ReverseRecords__factory:()=>_});var f=t(73622),d=t(13269);const r=[{constant:!0,inputs:[{internalType:"bytes4",name:"interfaceID",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],payable:!1,stateMutability:"pure",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"key",type:"string"},{internalType:"string",name:"value",type:"string"}],name:"setText",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes4",name:"interfaceID",type:"bytes4"}],name:"interfaceImplementer",outputs:[{internalType:"address",name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"contentTypes",type:"uint256"}],name:"ABI",outputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"x",type:"bytes32"},{internalType:"bytes32",name:"y",type:"bytes32"}],name:"setPubkey",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes",name:"hash",type:"bytes"}],name:"setContenthash",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"addr",outputs:[{internalType:"address",name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"target",type:"address"},{internalType:"bool",name:"isAuthorised",type:"bool"}],name:"setAuthorisation",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"key",type:"string"}],name:"text",outputs:[{internalType:"string",name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"contentType",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"setABI",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"name",type:"string"}],name:"setName",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"coinType",type:"uint256"},{internalType:"bytes",name:"a",type:"bytes"}],name:"setAddr",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"contenthash",outputs:[{internalType:"bytes",name:"",type:"bytes"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"pubkey",outputs:[{internalType:"bytes32",name:"x",type:"bytes32"},{internalType:"bytes32",name:"y",type:"bytes32"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"a",type:"address"}],name:"setAddr",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes4",name:"interfaceID",type:"bytes4"},{internalType:"address",name:"implementer",type:"address"}],name:"setInterface",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"coinType",type:"uint256"}],name:"addr",outputs:[{internalType:"bytes",name:"",type:"bytes"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"",type:"bytes32"},{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"authorisations",outputs:[{internalType:"bool",name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{inputs:[{internalType:"contract ENS",name:"_ens",type:"address"}],payable:!1,stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"target",type:"address"},{indexed:!1,internalType:"bool",name:"isAuthorised",type:"bool"}],name:"AuthorisationChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"string",name:"indexedKey",type:"string"},{indexed:!1,internalType:"string",name:"key",type:"string"}],name:"TextChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"x",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"y",type:"bytes32"}],name:"PubkeyChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"string",name:"name",type:"string"}],name:"NameChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"bytes4",name:"interfaceID",type:"bytes4"},{indexed:!1,internalType:"address",name:"implementer",type:"address"}],name:"InterfaceChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"hash",type:"bytes"}],name:"ContenthashChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"address",name:"a",type:"address"}],name:"AddrChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"coinType",type:"uint256"},{indexed:!1,internalType:"bytes",name:"newAddress",type:"bytes"}],name:"AddressChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"uint256",name:"contentType",type:"uint256"}],name:"ABIChanged",type:"event"}];class n{static abi=r;static createInterface(){return new f.KA(r)}static connect(e,a){return new d.NZ(e,r,a)}}const i=[{inputs:[{internalType:"contract ENS",name:"_ens",type:"address"},{internalType:"contract IBaseRegistrar",name:"_registrar",type:"address"},{internalType:"contract IMetadataService",name:"_metadataService",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"CannotUpgrade",type:"error"},{inputs:[],name:"IncompatibleParent",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"IncorrectTargetOwner",type:"error"},{inputs:[],name:"IncorrectTokenType",type:"error"},{inputs:[{internalType:"bytes32",name:"labelHash",type:"bytes32"},{internalType:"bytes32",name:"expectedLabelhash",type:"bytes32"}],name:"LabelMismatch",type:"error"},{inputs:[{internalType:"string",name:"label",type:"string"}],name:"LabelTooLong",type:"error"},{inputs:[],name:"LabelTooShort",type:"error"},{inputs:[],name:"NameIsNotWrapped",type:"error"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"OperationProhibited",type:"error"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"addr",type:"address"}],name:"Unauthorised",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"controller",type:"address"},{indexed:!1,internalType:"bool",name:"active",type:"bool"}],name:"ControllerChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint64",name:"expiry",type:"uint64"}],name:"ExpiryExtended",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint32",name:"fuses",type:"uint32"}],name:"FusesSet",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"address",name:"owner",type:"address"}],name:"NameUnwrapped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"name",type:"bytes"},{indexed:!1,internalType:"address",name:"owner",type:"address"},{indexed:!1,internalType:"uint32",name:"fuses",type:"uint32"},{indexed:!1,internalType:"uint64",name:"expiry",type:"uint64"}],name:"NameWrapped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256[]",name:"ids",type:"uint256[]"},{indexed:!1,internalType:"uint256[]",name:"values",type:"uint256[]"}],name:"TransferBatch",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"TransferSingle",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"value",type:"string"},{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"URI",type:"event"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"_tokens",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint32",name:"fuseMask",type:"uint32"}],name:"allFusesBurned",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address[]",name:"accounts",type:"address[]"},{internalType:"uint256[]",name:"ids",type:"uint256[]"}],name:"balanceOfBatch",outputs:[{internalType:"uint256[]",name:"",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"addr",type:"address"}],name:"canExtendSubnames",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"addr",type:"address"}],name:"canModifyName",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"controllers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"ens",outputs:[{internalType:"contract ENS",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"parentNode",type:"bytes32"},{internalType:"bytes32",name:"labelhash",type:"bytes32"},{internalType:"uint64",name:"expiry",type:"uint64"}],name:"extendExpiry",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"operator",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"getData",outputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint32",name:"fuses",type:"uint32"},{internalType:"uint64",name:"expiry",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"parentNode",type:"bytes32"},{internalType:"bytes32",name:"labelhash",type:"bytes32"}],name:"isWrapped",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"isWrapped",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"metadataService",outputs:[{internalType:"contract IMetadataService",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"names",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"onERC721Received",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"owner",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_token",type:"address"},{internalType:"address",name:"_to",type:"address"},{internalType:"uint256",name:"_amount",type:"uint256"}],name:"recoverFunds",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"label",type:"string"},{internalType:"address",name:"wrappedOwner",type:"address"},{internalType:"uint256",name:"duration",type:"uint256"},{internalType:"address",name:"resolver",type:"address"},{internalType:"uint16",name:"ownerControlledFuses",type:"uint16"}],name:"registerAndWrapETH2LD",outputs:[{internalType:"uint256",name:"registrarExpiry",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"registrar",outputs:[{internalType:"contract IBaseRegistrar",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"duration",type:"uint256"}],name:"renew",outputs:[{internalType:"uint256",name:"expires",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"ids",type:"uint256[]"},{internalType:"uint256[]",name:"amounts",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeBatchTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"id",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"parentNode",type:"bytes32"},{internalType:"bytes32",name:"labelhash",type:"bytes32"},{internalType:"uint32",name:"fuses",type:"uint32"},{internalType:"uint64",name:"expiry",type:"uint64"}],name:"setChildFuses",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"controller",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"setController",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint16",name:"ownerControlledFuses",type:"uint16"}],name:"setFuses",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IMetadataService",name:"_metadataService",type:"address"}],name:"setMetadataService",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"resolver",type:"address"},{internalType:"uint64",name:"ttl",type:"uint64"}],name:"setRecord",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"resolver",type:"address"}],name:"setResolver",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"parentNode",type:"bytes32"},{internalType:"string",name:"label",type:"string"},{internalType:"address",name:"owner",type:"address"},{internalType:"uint32",name:"fuses",type:"uint32"},{internalType:"uint64",name:"expiry",type:"uint64"}],name:"setSubnodeOwner",outputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"parentNode",type:"bytes32"},{internalType:"string",name:"label",type:"string"},{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"resolver",type:"address"},{internalType:"uint64",name:"ttl",type:"uint64"},{internalType:"uint32",name:"fuses",type:"uint32"},{internalType:"uint64",name:"expiry",type:"uint64"}],name:"setSubnodeRecord",outputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint64",name:"ttl",type:"uint64"}],name:"setTTL",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract INameWrapperUpgrade",name:"_upgradeAddress",type:"address"}],name:"setUpgradeContract",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"parentNode",type:"bytes32"},{internalType:"bytes32",name:"labelhash",type:"bytes32"},{internalType:"address",name:"controller",type:"address"}],name:"unwrap",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"labelhash",type:"bytes32"},{internalType:"address",name:"registrant",type:"address"},{internalType:"address",name:"controller",type:"address"}],name:"unwrapETH2LD",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"name",type:"bytes"},{internalType:"bytes",name:"extraData",type:"bytes"}],name:"upgrade",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"upgradeContract",outputs:[{internalType:"contract INameWrapperUpgrade",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"uri",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"name",type:"bytes"},{internalType:"address",name:"wrappedOwner",type:"address"},{internalType:"address",name:"resolver",type:"address"}],name:"wrap",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"label",type:"string"},{internalType:"address",name:"wrappedOwner",type:"address"},{internalType:"uint16",name:"ownerControlledFuses",type:"uint16"},{internalType:"address",name:"resolver",type:"address"}],name:"wrapETH2LD",outputs:[{internalType:"uint64",name:"expiry",type:"uint64"}],stateMutability:"nonpayable",type:"function"}];class b{static abi=i;static createInterface(){return new f.KA(i)}static connect(e,a){return new d.NZ(e,i,a)}}const o=[{inputs:[{internalType:"contract ENS",name:"_old",type:"address"}],payable:!1,stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"label",type:"bytes32"},{indexed:!1,internalType:"address",name:"owner",type:"address"}],name:"NewOwner",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"address",name:"resolver",type:"address"}],name:"NewResolver",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint64",name:"ttl",type:"uint64"}],name:"NewTTL",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"address",name:"owner",type:"address"}],name:"Transfer",type:"event"},{constant:!0,inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"old",outputs:[{internalType:"contract ENS",name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"recordExists",outputs:[{internalType:"bool",name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"resolver",outputs:[{internalType:"address",name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"owner",type:"address"}],name:"setOwner",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"resolver",type:"address"},{internalType:"uint64",name:"ttl",type:"uint64"}],name:"setRecord",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"resolver",type:"address"}],name:"setResolver",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"label",type:"bytes32"},{internalType:"address",name:"owner",type:"address"}],name:"setSubnodeOwner",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"label",type:"bytes32"},{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"resolver",type:"address"},{internalType:"uint64",name:"ttl",type:"uint64"}],name:"setSubnodeRecord",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint64",name:"ttl",type:"uint64"}],name:"setTTL",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"ttl",outputs:[{internalType:"uint64",name:"",type:"uint64"}],payable:!1,stateMutability:"view",type:"function"}];class s{static abi=o;static createInterface(){return new f.KA(o)}static connect(e,a){return new d.NZ(e,o,a)}}const l=[{inputs:[{internalType:"contract ENS",name:"_ens",type:"address"},{internalType:"contract INameWrapper",name:"wrapperAddress",type:"address"},{internalType:"address",name:"_trustedETHController",type:"address"},{internalType:"address",name:"_trustedReverseRegistrar",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"uint256",name:"contentType",type:"uint256"}],name:"ABIChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"address",name:"a",type:"address"}],name:"AddrChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"coinType",type:"uint256"},{indexed:!1,internalType:"bytes",name:"newAddress",type:"bytes"}],name:"AddressChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"address",name:"delegate",type:"address"},{indexed:!0,internalType:"bool",name:"approved",type:"bool"}],name:"Approved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"hash",type:"bytes"}],name:"ContenthashChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"name",type:"bytes"},{indexed:!1,internalType:"uint16",name:"resource",type:"uint16"},{indexed:!1,internalType:"bytes",name:"record",type:"bytes"}],name:"DNSRecordChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"name",type:"bytes"},{indexed:!1,internalType:"uint16",name:"resource",type:"uint16"}],name:"DNSRecordDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"lastzonehash",type:"bytes"},{indexed:!1,internalType:"bytes",name:"zonehash",type:"bytes"}],name:"DNSZonehashChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"bytes4",name:"interfaceID",type:"bytes4"},{indexed:!1,internalType:"address",name:"implementer",type:"address"}],name:"InterfaceChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"string",name:"name",type:"string"}],name:"NameChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"x",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"y",type:"bytes32"}],name:"PubkeyChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"string",name:"indexedKey",type:"string"},{indexed:!1,internalType:"string",name:"key",type:"string"},{indexed:!1,internalType:"string",name:"value",type:"string"}],name:"TextChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint64",name:"newVersion",type:"uint64"}],name:"VersionChanged",type:"event"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"contentTypes",type:"uint256"}],name:"ABI",outputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"addr",outputs:[{internalType:"address payable",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"coinType",type:"uint256"}],name:"addr",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"delegate",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"clearRecords",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"contenthash",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"name",type:"bytes32"},{internalType:"uint16",name:"resource",type:"uint16"}],name:"dnsRecord",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"name",type:"bytes32"}],name:"hasDNSRecords",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes4",name:"interfaceID",type:"bytes4"}],name:"interfaceImplementer",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"delegate",type:"address"}],name:"isApprovedFor",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"nodehash",type:"bytes32"},{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicallWithNodeCheck",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"pubkey",outputs:[{internalType:"bytes32",name:"x",type:"bytes32"},{internalType:"bytes32",name:"y",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"recordVersions",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"contentType",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"setABI",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"coinType",type:"uint256"},{internalType:"bytes",name:"a",type:"bytes"}],name:"setAddr",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"a",type:"address"}],name:"setAddr",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes",name:"hash",type:"bytes"}],name:"setContenthash",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes",name:"data",type:"bytes"}],name:"setDNSRecords",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes4",name:"interfaceID",type:"bytes4"},{internalType:"address",name:"implementer",type:"address"}],name:"setInterface",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"newName",type:"string"}],name:"setName",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"x",type:"bytes32"},{internalType:"bytes32",name:"y",type:"bytes32"}],name:"setPubkey",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"key",type:"string"},{internalType:"string",name:"value",type:"string"}],name:"setText",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes",name:"hash",type:"bytes"}],name:"setZonehash",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceID",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"key",type:"string"}],name:"text",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"zonehash",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"}];class u{static abi=l;static createInterface(){return new f.KA(l)}static connect(e,a){return new d.NZ(e,l,a)}}const h=[{constant:!0,inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"_totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{internalType:"address",name:"who",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transfer",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{constant:!0,inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transferFrom",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"approve",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"}];class p{static abi=h;static createInterface(){return new f.KA(h)}static connect(e,a){return new d.NZ(e,h,a)}}const g=[{inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall3.Call[]",name:"calls",type:"tuple[]"}],name:"aggregate",outputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"},{internalType:"bytes[]",name:"returnData",type:"bytes[]"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bool",name:"allowFailure",type:"bool"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall3.Call3[]",name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct Multicall3.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bool",name:"allowFailure",type:"bool"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall3.Call3Value[]",name:"calls",type:"tuple[]"}],name:"aggregate3Value",outputs:[{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct Multicall3.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall3.Call[]",name:"calls",type:"tuple[]"}],name:"blockAndAggregate",outputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"},{internalType:"bytes32",name:"blockHash",type:"bytes32"},{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct Multicall3.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[],name:"getBasefee",outputs:[{internalType:"uint256",name:"basefee",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"}],name:"getBlockHash",outputs:[{internalType:"bytes32",name:"blockHash",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"getBlockNumber",outputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getChainId",outputs:[{internalType:"uint256",name:"chainid",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockCoinbase",outputs:[{internalType:"address",name:"coinbase",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockDifficulty",outputs:[{internalType:"uint256",name:"difficulty",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockGasLimit",outputs:[{internalType:"uint256",name:"gaslimit",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"}],name:"getEthBalance",outputs:[{internalType:"uint256",name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLastBlockHash",outputs:[{internalType:"bytes32",name:"blockHash",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bool",name:"requireSuccess",type:"bool"},{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall3.Call[]",name:"calls",type:"tuple[]"}],name:"tryAggregate",outputs:[{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct Multicall3.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bool",name:"requireSuccess",type:"bool"},{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall3.Call[]",name:"calls",type:"tuple[]"}],name:"tryBlockAndAggregate",outputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"},{internalType:"bytes32",name:"blockHash",type:"bytes32"},{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct Multicall3.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"payable",type:"function"}];class m{static abi=g;static createInterface(){return new f.KA(g)}static connect(e,a){return new d.NZ(e,g,a)}}const x=[{inputs:[{internalType:"contract MultiWrapper",name:"_multiWrapper",type:"address"},{internalType:"contract IOracle[]",name:"existingOracles",type:"address[]"},{internalType:"enum OffchainOracle.OracleType[]",name:"oracleTypes",type:"uint8[]"},{internalType:"contract IERC20[]",name:"existingConnectors",type:"address[]"},{internalType:"contract IERC20",name:"wBase",type:"address"},{internalType:"address",name:"owner",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"ArraysLengthMismatch",type:"error"},{inputs:[],name:"ConnectorAlreadyAdded",type:"error"},{inputs:[],name:"InvalidOracleTokenKind",type:"error"},{inputs:[],name:"OracleAlreadyAdded",type:"error"},{inputs:[],name:"SameTokens",type:"error"},{inputs:[],name:"TooBigThreshold",type:"error"},{inputs:[],name:"UnknownConnector",type:"error"},{inputs:[],name:"UnknownOracle",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"contract IERC20",name:"connector",type:"address"}],name:"ConnectorAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"contract IERC20",name:"connector",type:"address"}],name:"ConnectorRemoved",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"contract MultiWrapper",name:"multiWrapper",type:"address"}],name:"MultiWrapperUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"contract IOracle",name:"oracle",type:"address"},{indexed:!1,internalType:"enum OffchainOracle.OracleType",name:"oracleType",type:"uint8"}],name:"OracleAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"contract IOracle",name:"oracle",type:"address"},{indexed:!1,internalType:"enum OffchainOracle.OracleType",name:"oracleType",type:"uint8"}],name:"OracleRemoved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{inputs:[{internalType:"contract IERC20",name:"connector",type:"address"}],name:"addConnector",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IOracle",name:"oracle",type:"address"},{internalType:"enum OffchainOracle.OracleType",name:"oracleKind",type:"uint8"}],name:"addOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"connectors",outputs:[{internalType:"contract IERC20[]",name:"allConnectors",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"srcToken",type:"address"},{internalType:"contract IERC20",name:"dstToken",type:"address"},{internalType:"bool",name:"useWrappers",type:"bool"}],name:"getRate",outputs:[{internalType:"uint256",name:"weightedRate",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"srcToken",type:"address"},{internalType:"bool",name:"useSrcWrappers",type:"bool"}],name:"getRateToEth",outputs:[{internalType:"uint256",name:"weightedRate",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"srcToken",type:"address"},{internalType:"bool",name:"useSrcWrappers",type:"bool"},{internalType:"contract IERC20[]",name:"customConnectors",type:"address[]"},{internalType:"uint256",name:"thresholdFilter",type:"uint256"}],name:"getRateToEthWithCustomConnectors",outputs:[{internalType:"uint256",name:"weightedRate",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"srcToken",type:"address"},{internalType:"bool",name:"useSrcWrappers",type:"bool"},{internalType:"uint256",name:"thresholdFilter",type:"uint256"}],name:"getRateToEthWithThreshold",outputs:[{internalType:"uint256",name:"weightedRate",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"srcToken",type:"address"},{internalType:"contract IERC20",name:"dstToken",type:"address"},{internalType:"bool",name:"useWrappers",type:"bool"},{internalType:"contract IERC20[]",name:"customConnectors",type:"address[]"},{internalType:"uint256",name:"thresholdFilter",type:"uint256"}],name:"getRateWithCustomConnectors",outputs:[{internalType:"uint256",name:"weightedRate",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"srcToken",type:"address"},{internalType:"contract IERC20",name:"dstToken",type:"address"},{internalType:"bool",name:"useWrappers",type:"bool"},{internalType:"uint256",name:"thresholdFilter",type:"uint256"}],name:"getRateWithThreshold",outputs:[{internalType:"uint256",name:"weightedRate",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"multiWrapper",outputs:[{internalType:"contract MultiWrapper",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"oracles",outputs:[{internalType:"contract IOracle[]",name:"allOracles",type:"address[]"},{internalType:"enum OffchainOracle.OracleType[]",name:"oracleTypes",type:"uint8[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"connector",type:"address"}],name:"removeConnector",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IOracle",name:"oracle",type:"address"},{internalType:"enum OffchainOracle.OracleType",name:"oracleKind",type:"uint8"}],name:"removeOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract MultiWrapper",name:"_multiWrapper",type:"address"}],name:"setMultiWrapper",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}];class y{static abi=x;static createInterface(){return new f.KA(x)}static connect(e,a){return new d.NZ(e,x,a)}}const A=[{inputs:[{internalType:"address",name:"_owner",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"",type:"uint256"}],name:"DecimalsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"",type:"uint256"}],name:"GasPriceUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"",type:"uint256"}],name:"L1BaseFeeUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"",type:"uint256"}],name:"OverheadUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"",type:"uint256"}],name:"ScalarUpdated",type:"event"},{inputs:[],name:"decimals",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"gasPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"_data",type:"bytes"}],name:"getL1Fee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"_data",type:"bytes"}],name:"getL1GasUsed",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"l1BaseFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"overhead",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"scalar",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_decimals",type:"uint256"}],name:"setDecimals",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_gasPrice",type:"uint256"}],name:"setGasPrice",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_baseFee",type:"uint256"}],name:"setL1BaseFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_overhead",type:"uint256"}],name:"setOverhead",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_scalar",type:"uint256"}],name:"setScalar",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}];class v{static abi=A;static createInterface(){return new f.KA(A)}static connect(e,a){return new d.NZ(e,A,a)}}const w=[{inputs:[{internalType:"contract ENS",name:"_ens",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"address[]",name:"addresses",type:"address[]"}],name:"getNames",outputs:[{internalType:"string[]",name:"r",type:"string[]"}],stateMutability:"view",type:"function"}];class _{static abi=w;static createInterface(){return new f.KA(w)}static connect(e,a){return new d.NZ(e,w,a)}}},67418:(e,a,t)=>{"use strict";t.d(a,{$W:()=>w,EI:()=>v,Eg:()=>k,Et:()=>i,G9:()=>E,Id:()=>l,Ju:()=>x,Kp:()=>p,Ll:()=>n,My:()=>g,aT:()=>m,ae:()=>A,br:()=>B,gn:()=>C,ib:()=>I,if:()=>h,iv:()=>b,jm:()=>y,lY:()=>u,qv:()=>L,sY:()=>_,uU:()=>M,vd:()=>S,wv:()=>s,yp:()=>T,yy:()=>o});var c=t(91565),f=t(39404),d=t.n(f),r=t(81810);BigInt.prototype.toJSON=function(){return this.toString()};const n=!process.browser&&void 0===globalThis.window,i=n?c.webcrypto:globalThis.crypto,b=(e,a)=>[...Array(Math.ceil(e.length/a))].map(((t,c)=>e.slice(a*c,a+a*c)));function o(e){return new Promise((a=>setTimeout(a,e)))}function s(e,a){try{const t=new URL(e);return!a||!a.length||a.map((e=>e.toLowerCase())).includes(t.protocol)}catch{return!1}}function l(...e){const a=e.reduce(((e,a)=>e+a.length),0),t=new Uint8Array(a);return e.forEach(((e,a,c)=>{const f=c.slice(0,a).reduce(((e,a)=>e+a.length),0);t.set(e,f)})),t}function u(e){return new Uint8Array(e.buffer)}function h(e){return btoa(e.reduce(((e,a)=>e+String.fromCharCode(a)),""))}function p(e){return Uint8Array.from(atob(e),(e=>e.charCodeAt(0)))}function g(e){return"0x"+Array.from(e).map((e=>e.toString(16).padStart(2,"0"))).join("")}function m(e){return"0x"===e.slice(0,2)&&(e=e.slice(2)),e.length%2!=0&&(e="0"+e),Uint8Array.from(e.match(/.{1,2}/g).map((e=>parseInt(e,16))))}function x(e){return BigInt(g(e))}function y(e){let a="bigint"==typeof e?e.toString(16):e;return"0x"===a.slice(0,2)&&(a=a.slice(2)),a.length%2!=0&&(a="0"+a),Uint8Array.from(a.match(/.{1,2}/g).map((e=>parseInt(e,16))))}function A(e){return new(d())(e,16,"le")}function v(e){return Uint8Array.from(new(d())(e).toArray("le",31))}function w(e,a=32){return"0x"+BigInt(e).toString(16).padStart(2*a,"0")}function _(e,a=32){return"0x"+(e=e.replace("0x","")).padStart(2*a,"0")}function I(e=31){return x(i.getRandomValues(new Uint8Array(e)))}function E(e=32){return g(i.getRandomValues(new Uint8Array(e)))}function C(e,a){return"bigint"==typeof a?a.toString():a}function M(e,a=10){return e.length<2*a?e:`${e.substring(0,a)}...${e.substring(e.length-a)}`}async function B(e,a="SHA-384"){return new Uint8Array(await i.subtle.digest(a,e))}function k(e,a=3){const t=[{value:1,symbol:""},{value:1e3,symbol:"K"},{value:1e6,symbol:"M"},{value:1e9,symbol:"G"},{value:1e12,symbol:"T"},{value:1e15,symbol:"P"},{value:1e18,symbol:"E"}].slice().reverse().find((a=>Number(e)>=a.value));return t?(Number(e)/t.value).toFixed(a).replace(/\.0+$|(?<=\.[0-9]*[1-9])0+$/,"").concat(t.symbol):"0"}function L(e){return/^0x[0-9a-fA-F]*$/.test(e)}function S(e){return r.fromIpfs(e)}function T(e){return r.decode(e)}},26746:(e,a,t)=>{"use strict";t.d(a,{O:()=>i,i:()=>b});var c=t(84276),f=t(36336),d=t.n(f),r=t(67418);let n;async function i(){n||(n=await d()({wasmInitialMemory:2e3}))}async function b(e,a,t){n||await i();const f={root:e.root,nullifierHash:BigInt(e.nullifierHex).toString(),recipient:BigInt(e.recipient),relayer:BigInt(e.relayer),fee:e.fee,refund:e.refund,nullifier:e.nullifier,secret:e.secret,pathElements:e.pathElements,pathIndices:e.pathIndices};console.log("Start generating SNARK proof",f),console.time("SNARK proof time");const d=await c.genWitnessAndProve(await n,f,a,t),b=c.toSolidityInput(d).proof;return console.timeEnd("SNARK proof time"),{proof:b,args:[(0,r.$W)(e.root,32),(0,r.$W)(e.nullifierHex,32),e.recipient,e.relayer,(0,r.$W)(e.fee,32),(0,r.$W)(e.refund,32)]}}},18995:(e,a,t)=>{"use strict";t.d(a,{_6:()=>Ee,fY:()=>Ie,a8:()=>_e});var c={},f=Uint8Array,d=Uint16Array,r=Int32Array,n=new f([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new f([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),b=new f([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=function(e,a){for(var t=new d(31),c=0;c<31;++c)t[c]=a+=1<>1|(21845&x)<<1;y=(61680&(y=(52428&y)>>2|(13107&y)<<2))>>4|(3855&y)<<4,m[x]=((65280&y)>>8|(255&y)<<8)>>1}var A=function(e,a,t){for(var c=e.length,f=0,r=new d(a);f>b]=o}else for(n=new d(c),f=0;f>15-e[f]);return n},v=new f(288);for(x=0;x<144;++x)v[x]=8;for(x=144;x<256;++x)v[x]=9;for(x=256;x<280;++x)v[x]=7;for(x=280;x<288;++x)v[x]=8;var w=new f(32);for(x=0;x<32;++x)w[x]=5;var _=A(v,9,0),I=A(v,9,1),E=A(w,5,0),C=A(w,5,1),M=function(e){for(var a=e[0],t=1;ta&&(a=e[t]);return a},B=function(e,a,t){var c=a/8|0;return(e[c]|e[c+1]<<8)>>(7&a)&t},k=function(e,a){var t=a/8|0;return(e[t]|e[t+1]<<8|e[t+2]<<16)>>(7&a)},L=function(e){return(e+7)/8|0},S=function(e,a,t){return(null==a||a<0)&&(a=0),(null==t||t>e.length)&&(t=e.length),new f(e.subarray(a,t))},T=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],N=function(e,a,t){var c=new Error(a||T[e]);if(c.code=e,Error.captureStackTrace&&Error.captureStackTrace(c,N),!t)throw c;return c},R=function(e,a,t,c){var d=e.length,r=c?c.length:0;if(!d||a.f&&!a.l)return t||new f(0);var o=!t,s=o||2!=a.i,u=a.i;o&&(t=new f(3*d));var h=function(e){var a=t.length;if(e>a){var c=new f(Math.max(2*a,e));c.set(t),t=c}},g=a.f||0,m=a.p||0,x=a.b||0,y=a.l,v=a.d,w=a.m,_=a.n,E=8*d;do{if(!y){g=B(e,m,1);var T=B(e,m+1,3);if(m+=3,!T){var R=e[(z=L(m)+4)-4]|e[z-3]<<8,P=z+R;if(P>d){u&&N(0);break}s&&h(x+R),t.set(e.subarray(z,P),x),a.b=x+=R,a.p=m=8*P,a.f=g;continue}if(1==T)y=I,v=C,w=9,_=5;else if(2==T){var D=B(e,m,31)+257,O=B(e,m+10,15)+4,F=D+B(e,m+5,31)+1;m+=14;for(var Q=new f(F),U=new f(19),j=0;j>4)<16)Q[j++]=z;else{var K=0,V=0;for(16==z?(V=3+B(e,m,3),m+=2,K=Q[j-1]):17==z?(V=3+B(e,m,7),m+=3):18==z&&(V=11+B(e,m,127),m+=7);V--;)Q[j++]=K}}var Z=Q.subarray(0,D),J=Q.subarray(D);w=M(Z),_=M(J),y=A(Z,w,1),v=A(J,_,1)}else N(1);if(m>E){u&&N(0);break}}s&&h(x+131072);for(var W=(1<>4;if((m+=15&K)>E){u&&N(0);break}if(K||N(2),ee<256)t[x++]=ee;else{if(256==ee){X=m,y=null;break}var ae=ee-254;if(ee>264){var te=n[j=ee-257];ae=B(e,m,(1<>4;if(ce||N(3),m+=15&ce,J=p[fe],fe>3&&(te=i[fe],J+=k(e,m)&(1<E){u&&N(0);break}s&&h(x+131072);var de=x+ae;if(x>8},D=function(e,a,t){t<<=7&a;var c=a/8|0;e[c]|=t,e[c+1]|=t>>8,e[c+2]|=t>>16},O=function(e,a){for(var t=[],c=0;ch&&(h=n[c].s);var p=new d(h+1),g=F(t[l-1],p,0);if(g>a){c=0;var m=0,x=g-a,y=1<a))break;m+=y-(1<>=x;m>0;){var v=n[c].s;p[v]=0&&m;--c){var w=n[c].s;p[w]==a&&(--p[w],++m)}g=a}return{t:new f(p),l:g}},F=function(e,a,t){return-1==e.s?Math.max(F(e.l,a,t+1),F(e.r,a,t+1)):a[e.s]=t},Q=function(e){for(var a=e.length;a&&!e[--a];);for(var t=new d(++a),c=0,f=e[0],r=1,n=function(e){t[c++]=e},i=1;i<=a;++i)if(e[i]==f&&i!=a)++r;else{if(!f&&r>2){for(;r>138;r-=138)n(32754);r>2&&(n(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(n(f),--r;r>6;r-=6)n(8304);r>2&&(n(r-3<<5|8208),r=0)}for(;r--;)n(f);r=1,f=e[i]}return{c:t.subarray(0,c),n:a}},U=function(e,a){for(var t=0,c=0;c>8,e[f+2]=255^e[f],e[f+3]=255^e[f+1];for(var d=0;d4&&!F[b[q-1]];--q);var $,z,G,K,V=u+5<<3,Z=U(f,v)+U(r,w)+o,J=U(f,g)+U(r,y)+o+14+3*q+U(T,F)+2*T[16]+3*T[17]+7*T[18];if(l>=0&&V<=Z&&V<=J)return j(a,h,e.subarray(l,l+u));if(P(a,h,1+(J15&&(P(a,h,ee[N]>>5&127),h+=ee[N]>>12)}}}else $=_,z=v,G=E,K=w;for(N=0;N255){D(a,h,$[257+(ae=te>>18&31)]),h+=z[ae+257],ae>7&&(P(a,h,te>>23&31),h+=n[ae]);var ce=31&te;D(a,h,G[ce]),h+=K[ce],ce>3&&(D(a,h,te>>5&8191),h+=i[ce])}else D(a,h,$[te]),h+=z[te]}return D(a,h,$[256]),h+z[256]},q=new r([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),$=new f(0),z=function(e,a,t,c,b,o){var s=o.z||e.length,l=new f(c+s+5*(1+Math.ceil(s/7e3))+b),h=l.subarray(c,l.length-b),p=o.l,m=7&(o.r||0);if(a){m&&(h[0]=o.r>>3);for(var x=q[a-1],y=x>>13,A=8191&x,v=(1<7e3||P>24576)&&($>423||!p)){m=H(e,h,0,M,B,k,N,P,O,R-O,m),P=T=N=0,O=R;for(var z=0;z<286;++z)B[z]=0;for(z=0;z<30;++z)k[z]=0}var G=2,K=0,V=A,Z=Q-U&32767;if($>2&&F==C(R-Z))for(var J=Math.min(y,$)-1,W=Math.min(32767,R),Y=Math.min(258,$);Z<=W&&--V&&Q!=U;){if(e[R+G]==e[R+G-Z]){for(var X=0;XG){if(G=X,K=Z,X>J)break;var ee=Math.min(Z,X-2),ae=0;for(z=0;zae&&(ae=ce,U=te)}}}Z+=(Q=U)-(U=w[Q])&32767}if(K){M[P++]=268435456|u[G]<<18|g[K];var fe=31&u[G],de=31&g[K];N+=n[fe]+i[de],++B[257+fe],++k[de],D=R+G,++T}else M[P++]=e[R],++B[e[R]]}}for(R=Math.max(R,D);R=s&&(h[m/8|0]=p,re=s),m=j(h,m+1,e.subarray(R,re))}o.i=s}return S(l,0,c+L(m)+b)},G=function(){for(var e=new Int32Array(256),a=0;a<256;++a){for(var t=a,c=9;--c;)t=(1&t&&-306674912)^t>>>1;e[a]=t}return e}(),K=function(){var e=-1;return{p:function(a){for(var t=e,c=0;c>>8;e=t},d:function(){return~e}}},V=function(e,a,t,c,d){if(!d&&(d={l:1},a.dictionary)){var r=a.dictionary.subarray(-32768),n=new f(r.length+e.length);n.set(r),n.set(e,r.length),e=n,d.w=r.length}return z(e,null==a.level?6:a.level,null==a.mem?d.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+a.mem,t,c,d)},Z=function(e,a){var t={};for(var c in e)t[c]=e[c];for(var c in a)t[c]=a[c];return t},J=function(e,a,t){for(var c=e(),f=e.toString(),d=f.slice(f.indexOf("[")+1,f.lastIndexOf("]")).replace(/\s+/g,"").split(","),r=0;r>>0},de=function(e,a){return fe(e,a)+4294967296*fe(e,a+4)},re=function(e,a,t){for(;t;++a)e[a]=t,t>>>=8};function ne(e,a){return V(e,a||{},0,0)}function ie(e,a){return R(e,{i:2},a&&a.out,a&&a.dictionary)}var be=function(e,a,t,c){for(var d in e){var r=e[d],n=a+d,i=c;Array.isArray(r)&&(i=Z(c,r[1]),r=r[0]),r instanceof f?t[n]=[r,i]:(t[n+="/"]=[new f(0),i],be(r,n,t,c))}},oe="undefined"!=typeof TextEncoder&&new TextEncoder,se="undefined"!=typeof TextDecoder&&new TextDecoder;try{se.decode($,{stream:!0})}catch(e){}function le(e,a){if(a){for(var t=new f(e.length),c=0;c>1)),n=0,i=function(e){r[n++]=e};for(c=0;cr.length){var b=new f(n+8+(d-c<<1));b.set(r),r=b}var o=e.charCodeAt(c);o<128||a?i(o):o<2048?(i(192|o>>6),i(128|63&o)):o>55295&&o<57344?(i(240|(o=65536+(1047552&o)|1023&e.charCodeAt(++c))>>18),i(128|o>>12&63),i(128|o>>6&63),i(128|63&o)):(i(224|o>>12),i(128|o>>6&63),i(128|63&o))}return S(r,0,n)}function ue(e,a){if(a){for(var t="",c=0;c127)+(c>223)+(c>239);if(t+f>e.length)return{s:a,r:S(e,t-1)};f?3==f?(c=((15&c)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,a+=String.fromCharCode(55296|c>>10,56320|1023&c)):a+=1&f?String.fromCharCode((31&c)<<6|63&e[t++]):String.fromCharCode((15&c)<<12|(63&e[t++])<<6|63&e[t++]):a+=String.fromCharCode(c)}}(e),d=f.s;return(t=f.r).length&&N(8),d}var he=function(e,a){return a+30+ce(e,a+26)+ce(e,a+28)},pe=function(e,a,t){var c=ce(e,a+28),f=ue(e.subarray(a+46,a+46+c),!(2048&ce(e,a+8))),d=a+46+c,r=fe(e,a+20),n=t&&4294967295==r?ge(e,d):[r,fe(e,a+24),fe(e,a+42)],i=n[0],b=n[1],o=n[2];return[ce(e,a+10),i,b,f,d+ce(e,a+30)+ce(e,a+32),o]},ge=function(e,a){for(;1!=ce(e,a);a+=4+ce(e,a+2));return[de(e,a+12),de(e,a+4),de(e,a+20)]},me=function(e){var a=0;if(e)for(var t in e){var c=e[t].length;c>65535&&N(9),a+=c+4}return a},xe=function(e,a,t,c,f,d,r,n){var i=c.length,b=t.extra,o=n&&n.length,s=me(b);re(e,a,null!=r?33639248:67324752),a+=4,null!=r&&(e[a++]=20,e[a++]=t.os),e[a]=20,a+=2,e[a++]=t.flag<<1|(d<0&&8),e[a++]=f&&8,e[a++]=255&t.compression,e[a++]=t.compression>>8;var l=new Date(null==t.mtime?Date.now():t.mtime),u=l.getFullYear()-1980;if((u<0||u>119)&&N(10),re(e,a,u<<25|l.getMonth()+1<<21|l.getDate()<<16|l.getHours()<<11|l.getMinutes()<<5|l.getSeconds()>>1),a+=4,-1!=d&&(re(e,a,t.crc),re(e,a+4,d<0?-d-2:d),re(e,a+8,t.size)),re(e,a+12,i),re(e,a+14,s),a+=16,null!=r&&(re(e,a,o),re(e,a+6,t.attrs),re(e,a+10,r),a+=14),e.set(c,a),a+=i,s)for(var h in b){var p=b[h],g=p.length;re(e,a,+h),re(e,a+2,g),e.set(p,a+4),a+=4+g}return o&&(e.set(n,a),a+=o),a},ye=function(e,a,t,c,f){re(e,a,101010256),re(e,a+8,t),re(e,a+10,t),re(e,a+12,c),re(e,a+16,f)};var Ae="function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout?setTimeout:function(e){e()},ve=t(46170),we=t(67418);function _e(e,a){return new Promise(((t,c)=>{!function(e,a,t){t||(t=a,a={}),"function"!=typeof t&&N(7);var c={};be(e,"",c,a);var d=Object.keys(c),r=d.length,n=0,i=0,b=r,o=new Array(r),s=[],l=function(){for(var e=0;e65535&&I(N(11,0,1),null),_)if(g<16e4)try{I(null,ne(f,b))}catch(e){I(e,null)}else s.push(function(e,a,t){return t||(t=a,a={}),"function"!=typeof t&&N(7),te(e,a,[X],(function(e){return ee(ne(e.data[0],e.data[1]))}),0,t)}(f,b,I));else I(null,f)},g=0;g{e?c(e):t(a)}))}))}function Ie(e){return new Promise(((a,t)=>{!function(e,a,t){t||(t=a,a={}),"function"!=typeof t&&N(7);var c=[],d=function(){for(var e=0;e65558)return n(N(13,0,1),null),d;var b=ce(e,i+8);if(b){var o=b,s=fe(e,i+16),l=4294967295==s||65535==o;if(l){var u=fe(e,i-12);(l=101075792==fe(e,u))&&(o=b=fe(e,u+32),s=fe(e,u+48))}for(var h=a&&a.filter,p=function(a){var t=pe(e,s,l),i=t[0],o=t[1],u=t[2],p=t[3],g=t[4],m=t[5],x=he(e,m);s=g;var y=function(e,a){e?(d(),n(e,null)):(a&&(r[p]=a),--b||n(null,r))};if(!h||h({name:p,size:o,originalSize:u,compression:i}))if(i)if(8==i){var A=e.subarray(x,x+o);if(u<524288||o>.8*u)try{y(null,ie(A,{out:new f(u)}))}catch(e){y(e,null)}else c.push(function(e,a,t){return t||(t=a,a={}),"function"!=typeof t&&N(7),te(e,a,[Y],(function(e){return ee(ie(e.data[0],ae(e.data[1])))}),1,t)}(A,{size:u},y))}else y(N(14,"unknown compression type "+i,1),null);else y(null,S(e,x,x+o));else y(null,null)},g=0;g{e?t(e):a(c)}))}))}async function Ee({staticUrl:e="",zipName:a,zipDigest:t,parseJson:c=!0}){const f=`${e}/${a}.zip`,d=await(0,ve.Fd)(f,{method:"GET",returnResponse:!0}),r=new Uint8Array(await d.arrayBuffer());if(t){const e="sha384-"+(0,we.if)(await(0,we.br)(r));if(t!==e)throw new Error(`Invalid digest hash for file ${f}, wants ${t} has ${e}`)}const{[a]:n}=await Ie(r);return console.log(`Downloaded ${f}${t?` ( Digest: ${t} )`:""}`),c?JSON.parse((new TextDecoder).decode(n)):n}},32019:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.keccak512=a.keccak384=a.keccak256=a.keccak224=void 0;const c=t(32955),f=t(82672);a.keccak224=(0,f.wrapHash)(c.keccak_224),a.keccak256=(()=>{const e=(0,f.wrapHash)(c.keccak_256);return e.create=c.keccak_256.create,e})(),a.keccak384=(0,f.wrapHash)(c.keccak_384),a.keccak512=(0,f.wrapHash)(c.keccak_512)},26513:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.secp256k1=void 0;var c=t(8510);Object.defineProperty(a,"secp256k1",{enumerable:!0,get:function(){return c.secp256k1}})},82672:function(e,a,t){"use strict";e=t.nmd(e);var c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(a,"__esModule",{value:!0}),a.crypto=a.utf8ToBytes=a.createView=a.concatBytes=a.toHex=a.bytesToHex=a.assertBytes=a.assertBool=void 0,a.bytesToUtf8=function(e){if(!(e instanceof Uint8Array))throw new TypeError("bytesToUtf8 expected Uint8Array, got "+typeof e);return(new TextDecoder).decode(e)},a.hexToBytes=function(e){const a=e.startsWith("0x")?e.substring(2):e;return(0,d.hexToBytes)(a)},a.equalsBytes=function(e,a){if(e.length!==a.length)return!1;for(let t=0;t(f.default.bytes(a),e(a))};const f=c(t(67557)),d=t(99175),r=f.default.bool;a.assertBool=r;const n=f.default.bytes;a.assertBytes=n;var i=t(99175);Object.defineProperty(a,"bytesToHex",{enumerable:!0,get:function(){return i.bytesToHex}}),Object.defineProperty(a,"toHex",{enumerable:!0,get:function(){return i.bytesToHex}}),Object.defineProperty(a,"concatBytes",{enumerable:!0,get:function(){return i.concatBytes}}),Object.defineProperty(a,"createView",{enumerable:!0,get:function(){return i.createView}}),Object.defineProperty(a,"utf8ToBytes",{enumerable:!0,get:function(){return i.utf8ToBytes}}),a.crypto=(()=>{const a="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,t="function"==typeof e.require&&e.require.bind(e);return{node:t&&!a?t("crypto"):void 0,web:a}})()},37007:e=>{"use strict";var a,t="object"==typeof Reflect?Reflect:null,c=t&&"function"==typeof t.apply?t.apply:function(e,a,t){return Function.prototype.apply.call(e,a,t)};a=t&&"function"==typeof t.ownKeys?t.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var f=Number.isNaN||function(e){return e!=e};function d(){d.init.call(this)}e.exports=d,e.exports.once=function(e,a){return new Promise((function(t,c){function f(t){e.removeListener(a,d),c(t)}function d(){"function"==typeof e.removeListener&&e.removeListener("error",f),t([].slice.call(arguments))}p(e,a,d,{once:!0}),"error"!==a&&function(e,a){"function"==typeof e.on&&p(e,"error",a,{once:!0})}(e,f)}))},d.EventEmitter=d,d.prototype._events=void 0,d.prototype._eventsCount=0,d.prototype._maxListeners=void 0;var r=10;function n(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function i(e){return void 0===e._maxListeners?d.defaultMaxListeners:e._maxListeners}function b(e,a,t,c){var f,d,r,b;if(n(t),void 0===(d=e._events)?(d=e._events=Object.create(null),e._eventsCount=0):(void 0!==d.newListener&&(e.emit("newListener",a,t.listener?t.listener:t),d=e._events),r=d[a]),void 0===r)r=d[a]=t,++e._eventsCount;else if("function"==typeof r?r=d[a]=c?[t,r]:[r,t]:c?r.unshift(t):r.push(t),(f=i(e))>0&&r.length>f&&!r.warned){r.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+r.length+" "+String(a)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=e,o.type=a,o.count=r.length,b=o,console&&console.warn&&console.warn(b)}return e}function o(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function s(e,a,t){var c={fired:!1,wrapFn:void 0,target:e,type:a,listener:t},f=o.bind(c);return f.listener=t,c.wrapFn=f,f}function l(e,a,t){var c=e._events;if(void 0===c)return[];var f=c[a];return void 0===f?[]:"function"==typeof f?t?[f.listener||f]:[f]:t?function(e){for(var a=new Array(e.length),t=0;t0&&(r=a[0]),r instanceof Error)throw r;var n=new Error("Unhandled error."+(r?" ("+r.message+")":""));throw n.context=r,n}var i=d[e];if(void 0===i)return!1;if("function"==typeof i)c(i,this,a);else{var b=i.length,o=h(i,b);for(t=0;t=0;d--)if(t[d]===a||t[d].listener===a){r=t[d].listener,f=d;break}if(f<0)return this;0===f?t.shift():function(e,a){for(;a+1=0;c--)this.removeListener(e,a[c]);return this},d.prototype.listeners=function(e){return l(this,e,!0)},d.prototype.rawListeners=function(e){return l(this,e,!1)},d.listenerCount=function(e,a){return"function"==typeof e.listenerCount?e.listenerCount(a):u.call(e,a)},d.prototype.listenerCount=u,d.prototype.eventNames=function(){return this._eventsCount>0?a(this._events):[]}},68078:(e,a,t)=>{var c=t(92861).Buffer,f=t(88276);e.exports=function(e,a,t,d){if(c.isBuffer(e)||(e=c.from(e,"binary")),a&&(c.isBuffer(a)||(a=c.from(a,"binary")),8!==a.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var r=t/8,n=c.alloc(r),i=c.alloc(d||0),b=c.alloc(0);r>0||d>0;){var o=new f;o.update(b),o.update(e),a&&o.update(a),b=o.digest();var s=0;if(r>0){var l=n.length-r;s=Math.min(r,b.length),b.copy(n,l,0,s),r-=s}if(s0){var u=i.length-d,h=Math.min(d,b.length-s);b.copy(i,u,s,s+h),d-=h}}return b.fill(0),{key:n,iv:i}}},32017:e=>{"use strict";e.exports=function e(a,t){if(a===t)return!0;if(a&&t&&"object"==typeof a&&"object"==typeof t){if(a.constructor!==t.constructor)return!1;var c,f,d;if(Array.isArray(a)){if((c=a.length)!=t.length)return!1;for(f=c;0!=f--;)if(!e(a[f],t[f]))return!1;return!0}if(a.constructor===RegExp)return a.source===t.source&&a.flags===t.flags;if(a.valueOf!==Object.prototype.valueOf)return a.valueOf()===t.valueOf();if(a.toString!==Object.prototype.toString)return a.toString()===t.toString();if((c=(d=Object.keys(a)).length)!==Object.keys(t).length)return!1;for(f=c;0!=f--;)if(!Object.prototype.hasOwnProperty.call(t,d[f]))return!1;for(f=c;0!=f--;){var r=d[f];if(!e(a[r],t[r]))return!1}return!0}return a!=a&&t!=t}},82682:(e,a,t)=>{"use strict";var c=t(69600),f=Object.prototype.toString,d=Object.prototype.hasOwnProperty;e.exports=function(e,a,t){if(!c(a))throw new TypeError("iterator must be a function");var r;arguments.length>=3&&(r=t),"[object Array]"===f.call(e)?function(e,a,t){for(var c=0,f=e.length;c{"use strict";var a=Object.prototype.toString,t=Math.max,c=function(e,a){for(var t=[],c=0;c{"use strict";var c=t(89353);e.exports=Function.prototype.bind||c},70453:(e,a,t)=>{"use strict";var c,f=t(69383),d=t(41237),r=t(79290),n=t(79538),i=t(58068),b=t(69675),o=t(35345),s=Function,l=function(e){try{return s('"use strict"; return ('+e+").constructor;")()}catch(e){}},u=Object.getOwnPropertyDescriptor;if(u)try{u({},"")}catch(e){u=null}var h=function(){throw new b},p=u?function(){try{return h}catch(e){try{return u(arguments,"callee").get}catch(e){return h}}}():h,g=t(64039)(),m=t(80024)(),x=Object.getPrototypeOf||(m?function(e){return e.__proto__}:null),y={},A="undefined"!=typeof Uint8Array&&x?x(Uint8Array):c,v={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?c:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?c:ArrayBuffer,"%ArrayIteratorPrototype%":g&&x?x([][Symbol.iterator]()):c,"%AsyncFromSyncIteratorPrototype%":c,"%AsyncFunction%":y,"%AsyncGenerator%":y,"%AsyncGeneratorFunction%":y,"%AsyncIteratorPrototype%":y,"%Atomics%":"undefined"==typeof Atomics?c:Atomics,"%BigInt%":"undefined"==typeof BigInt?c:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?c:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?c:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?c:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":f,"%eval%":eval,"%EvalError%":d,"%Float32Array%":"undefined"==typeof Float32Array?c:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?c:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?c:FinalizationRegistry,"%Function%":s,"%GeneratorFunction%":y,"%Int8Array%":"undefined"==typeof Int8Array?c:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?c:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?c:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":g&&x?x(x([][Symbol.iterator]())):c,"%JSON%":"object"==typeof JSON?JSON:c,"%Map%":"undefined"==typeof Map?c:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&g&&x?x((new Map)[Symbol.iterator]()):c,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?c:Promise,"%Proxy%":"undefined"==typeof Proxy?c:Proxy,"%RangeError%":r,"%ReferenceError%":n,"%Reflect%":"undefined"==typeof Reflect?c:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?c:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&g&&x?x((new Set)[Symbol.iterator]()):c,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?c:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":g&&x?x(""[Symbol.iterator]()):c,"%Symbol%":g?Symbol:c,"%SyntaxError%":i,"%ThrowTypeError%":p,"%TypedArray%":A,"%TypeError%":b,"%Uint8Array%":"undefined"==typeof Uint8Array?c:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?c:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?c:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?c:Uint32Array,"%URIError%":o,"%WeakMap%":"undefined"==typeof WeakMap?c:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?c:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?c:WeakSet};if(x)try{null.error}catch(e){var w=x(x(e));v["%Error.prototype%"]=w}var _=function e(a){var t;if("%AsyncFunction%"===a)t=l("async function () {}");else if("%GeneratorFunction%"===a)t=l("function* () {}");else if("%AsyncGeneratorFunction%"===a)t=l("async function* () {}");else if("%AsyncGenerator%"===a){var c=e("%AsyncGeneratorFunction%");c&&(t=c.prototype)}else if("%AsyncIteratorPrototype%"===a){var f=e("%AsyncGenerator%");f&&x&&(t=x(f.prototype))}return v[a]=t,t},I={__proto__:null,"%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"]},E=t(66743),C=t(9957),M=E.call(Function.call,Array.prototype.concat),B=E.call(Function.apply,Array.prototype.splice),k=E.call(Function.call,String.prototype.replace),L=E.call(Function.call,String.prototype.slice),S=E.call(Function.call,RegExp.prototype.exec),T=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,N=/\\(\\)?/g,R=function(e,a){var t,c=e;if(C(I,c)&&(c="%"+(t=I[c])[0]+"%"),C(v,c)){var f=v[c];if(f===y&&(f=_(c)),void 0===f&&!a)throw new b("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:t,name:c,value:f}}throw new i("intrinsic "+e+" does not exist!")};e.exports=function(e,a){if("string"!=typeof e||0===e.length)throw new b("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof a)throw new b('"allowMissing" argument must be a boolean');if(null===S(/^%?[^%]*%?$/,e))throw new i("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var t=function(e){var a=L(e,0,1),t=L(e,-1);if("%"===a&&"%"!==t)throw new i("invalid intrinsic syntax, expected closing `%`");if("%"===t&&"%"!==a)throw new i("invalid intrinsic syntax, expected opening `%`");var c=[];return k(e,T,(function(e,a,t,f){c[c.length]=t?k(f,N,"$1"):a||e})),c}(e),c=t.length>0?t[0]:"",f=R("%"+c+"%",a),d=f.name,r=f.value,n=!1,o=f.alias;o&&(c=o[0],B(t,M([0,1],o)));for(var s=1,l=!0;s=t.length){var m=u(r,h);r=(l=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:r[h]}else l=C(r,h),r=r[h];l&&!n&&(v[d]=r)}}return r}},75795:(e,a,t)=>{"use strict";var c=t(70453)("%Object.getOwnPropertyDescriptor%",!0);if(c)try{c([],"length")}catch(e){c=null}e.exports=c},30592:(e,a,t)=>{"use strict";var c=t(30655),f=function(){return!!c};f.hasArrayLengthDefineBug=function(){if(!c)return null;try{return 1!==c([],"length",{value:1}).length}catch(e){return!0}},e.exports=f},80024:e=>{"use strict";var a={__proto__:null,foo:{}},t=Object;e.exports=function(){return{__proto__:a}.foo===a.foo&&!(a instanceof t)}},64039:(e,a,t)=>{"use strict";var c="undefined"!=typeof Symbol&&Symbol,f=t(41333);e.exports=function(){return"function"==typeof c&&"function"==typeof Symbol&&"symbol"==typeof c("foo")&&"symbol"==typeof Symbol("bar")&&f()}},41333:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},a=Symbol("test"),t=Object(a);if("string"==typeof a)return!1;if("[object Symbol]"!==Object.prototype.toString.call(a))return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;for(a in e[a]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var c=Object.getOwnPropertySymbols(e);if(1!==c.length||c[0]!==a)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,a))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var f=Object.getOwnPropertyDescriptor(e,a);if(42!==f.value||!0!==f.enumerable)return!1}return!0}},49092:(e,a,t)=>{"use strict";var c=t(41333);e.exports=function(){return c()&&!!Symbol.toStringTag}},77952:(e,a,t)=>{var c=a;c.utils=t(67426),c.common=t(66166),c.sha=t(46229),c.ripemd=t(46784),c.hmac=t(28948),c.sha1=c.sha.sha1,c.sha256=c.sha.sha256,c.sha224=c.sha.sha224,c.sha384=c.sha.sha384,c.sha512=c.sha.sha512,c.ripemd160=c.ripemd.ripemd160},66166:(e,a,t)=>{"use strict";var c=t(67426),f=t(43349);function d(){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}a.BlockHash=d,d.prototype.update=function(e,a){if(e=c.toArray(e,a),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var t=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-t,e.length),0===this.pending.length&&(this.pending=null),e=c.join32(e,0,e.length-t,this.endian);for(var f=0;f>>24&255,c[f++]=e>>>16&255,c[f++]=e>>>8&255,c[f++]=255&e}else for(c[f++]=255&e,c[f++]=e>>>8&255,c[f++]=e>>>16&255,c[f++]=e>>>24&255,c[f++]=0,c[f++]=0,c[f++]=0,c[f++]=0,d=8;d{"use strict";var c=t(67426),f=t(43349);function d(e,a,t){if(!(this instanceof d))return new d(e,a,t);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(c.toArray(a,t))}e.exports=d,d.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),f(e.length<=this.blockSize);for(var a=e.length;a{"use strict";var c=t(67426),f=t(66166),d=c.rotl32,r=c.sum32,n=c.sum32_3,i=c.sum32_4,b=f.BlockHash;function o(){if(!(this instanceof o))return new o;b.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function s(e,a,t,c){return e<=15?a^t^c:e<=31?a&t|~a&c:e<=47?(a|~t)^c:e<=63?a&c|t&~c:a^(t|~c)}function l(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function u(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}c.inherits(o,b),a.ripemd160=o,o.blockSize=512,o.outSize=160,o.hmacStrength=192,o.padLength=64,o.prototype._update=function(e,a){for(var t=this.h[0],c=this.h[1],f=this.h[2],b=this.h[3],o=this.h[4],x=t,y=c,A=f,v=b,w=o,_=0;_<80;_++){var I=r(d(i(t,s(_,c,f,b),e[h[_]+a],l(_)),g[_]),o);t=o,o=b,b=d(f,10),f=c,c=I,I=r(d(i(x,s(79-_,y,A,v),e[p[_]+a],u(_)),m[_]),w),x=w,w=v,v=d(A,10),A=y,y=I}I=n(this.h[1],f,v),this.h[1]=n(this.h[2],b,w),this.h[2]=n(this.h[3],o,x),this.h[3]=n(this.h[4],t,y),this.h[4]=n(this.h[0],c,A),this.h[0]=I},o.prototype._digest=function(e){return"hex"===e?c.toHex32(this.h,"little"):c.split32(this.h,"little")};var h=[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],p=[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],g=[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],m=[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]},46229:(e,a,t)=>{"use strict";a.sha1=t(43917),a.sha224=t(47714),a.sha256=t(2287),a.sha384=t(21911),a.sha512=t(57766)},43917:(e,a,t)=>{"use strict";var c=t(67426),f=t(66166),d=t(66225),r=c.rotl32,n=c.sum32,i=c.sum32_5,b=d.ft_1,o=f.BlockHash,s=[1518500249,1859775393,2400959708,3395469782];function l(){if(!(this instanceof l))return new l;o.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}c.inherits(l,o),e.exports=l,l.blockSize=512,l.outSize=160,l.hmacStrength=80,l.padLength=64,l.prototype._update=function(e,a){for(var t=this.W,c=0;c<16;c++)t[c]=e[a+c];for(;c{"use strict";var c=t(67426),f=t(2287);function d(){if(!(this instanceof d))return new d;f.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}c.inherits(d,f),e.exports=d,d.blockSize=512,d.outSize=224,d.hmacStrength=192,d.padLength=64,d.prototype._digest=function(e){return"hex"===e?c.toHex32(this.h.slice(0,7),"big"):c.split32(this.h.slice(0,7),"big")}},2287:(e,a,t)=>{"use strict";var c=t(67426),f=t(66166),d=t(66225),r=t(43349),n=c.sum32,i=c.sum32_4,b=c.sum32_5,o=d.ch32,s=d.maj32,l=d.s0_256,u=d.s1_256,h=d.g0_256,p=d.g1_256,g=f.BlockHash,m=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function x(){if(!(this instanceof x))return new x;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=m,this.W=new Array(64)}c.inherits(x,g),e.exports=x,x.blockSize=512,x.outSize=256,x.hmacStrength=192,x.padLength=64,x.prototype._update=function(e,a){for(var t=this.W,c=0;c<16;c++)t[c]=e[a+c];for(;c{"use strict";var c=t(67426),f=t(57766);function d(){if(!(this instanceof d))return new d;f.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}c.inherits(d,f),e.exports=d,d.blockSize=1024,d.outSize=384,d.hmacStrength=192,d.padLength=128,d.prototype._digest=function(e){return"hex"===e?c.toHex32(this.h.slice(0,12),"big"):c.split32(this.h.slice(0,12),"big")}},57766:(e,a,t)=>{"use strict";var c=t(67426),f=t(66166),d=t(43349),r=c.rotr64_hi,n=c.rotr64_lo,i=c.shr64_hi,b=c.shr64_lo,o=c.sum64,s=c.sum64_hi,l=c.sum64_lo,u=c.sum64_4_hi,h=c.sum64_4_lo,p=c.sum64_5_hi,g=c.sum64_5_lo,m=f.BlockHash,x=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function y(){if(!(this instanceof y))return new y;m.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=x,this.W=new Array(160)}function A(e,a,t,c,f){var d=e&t^~e&f;return d<0&&(d+=4294967296),d}function v(e,a,t,c,f,d){var r=a&c^~a&d;return r<0&&(r+=4294967296),r}function w(e,a,t,c,f){var d=e&t^e&f^t&f;return d<0&&(d+=4294967296),d}function _(e,a,t,c,f,d){var r=a&c^a&d^c&d;return r<0&&(r+=4294967296),r}function I(e,a){var t=r(e,a,28)^r(a,e,2)^r(a,e,7);return t<0&&(t+=4294967296),t}function E(e,a){var t=n(e,a,28)^n(a,e,2)^n(a,e,7);return t<0&&(t+=4294967296),t}function C(e,a){var t=n(e,a,14)^n(e,a,18)^n(a,e,9);return t<0&&(t+=4294967296),t}function M(e,a){var t=r(e,a,1)^r(e,a,8)^i(e,a,7);return t<0&&(t+=4294967296),t}function B(e,a){var t=n(e,a,1)^n(e,a,8)^b(e,a,7);return t<0&&(t+=4294967296),t}function k(e,a){var t=n(e,a,19)^n(a,e,29)^b(e,a,6);return t<0&&(t+=4294967296),t}c.inherits(y,m),e.exports=y,y.blockSize=1024,y.outSize=512,y.hmacStrength=192,y.padLength=128,y.prototype._prepareBlock=function(e,a){for(var t=this.W,c=0;c<32;c++)t[c]=e[a+c];for(;c{"use strict";var c=t(67426).rotr32;function f(e,a,t){return e&a^~e&t}function d(e,a,t){return e&a^e&t^a&t}function r(e,a,t){return e^a^t}a.ft_1=function(e,a,t,c){return 0===e?f(a,t,c):1===e||3===e?r(a,t,c):2===e?d(a,t,c):void 0},a.ch32=f,a.maj32=d,a.p32=r,a.s0_256=function(e){return c(e,2)^c(e,13)^c(e,22)},a.s1_256=function(e){return c(e,6)^c(e,11)^c(e,25)},a.g0_256=function(e){return c(e,7)^c(e,18)^e>>>3},a.g1_256=function(e){return c(e,17)^c(e,19)^e>>>10}},67426:(e,a,t)=>{"use strict";var c=t(43349),f=t(56698);function d(e,a){return 55296==(64512&e.charCodeAt(a))&&!(a<0||a+1>=e.length)&&56320==(64512&e.charCodeAt(a+1))}function r(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function n(e){return 1===e.length?"0"+e:e}function i(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}a.inherits=f,a.toArray=function(e,a){if(Array.isArray(e))return e.slice();if(!e)return[];var t=[];if("string"==typeof e)if(a){if("hex"===a)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),f=0;f>6|192,t[c++]=63&r|128):d(e,f)?(r=65536+((1023&r)<<10)+(1023&e.charCodeAt(++f)),t[c++]=r>>18|240,t[c++]=r>>12&63|128,t[c++]=r>>6&63|128,t[c++]=63&r|128):(t[c++]=r>>12|224,t[c++]=r>>6&63|128,t[c++]=63&r|128)}else for(f=0;f>>0}return r},a.split32=function(e,a){for(var t=new Array(4*e.length),c=0,f=0;c>>24,t[f+1]=d>>>16&255,t[f+2]=d>>>8&255,t[f+3]=255&d):(t[f+3]=d>>>24,t[f+2]=d>>>16&255,t[f+1]=d>>>8&255,t[f]=255&d)}return t},a.rotr32=function(e,a){return e>>>a|e<<32-a},a.rotl32=function(e,a){return e<>>32-a},a.sum32=function(e,a){return e+a>>>0},a.sum32_3=function(e,a,t){return e+a+t>>>0},a.sum32_4=function(e,a,t,c){return e+a+t+c>>>0},a.sum32_5=function(e,a,t,c,f){return e+a+t+c+f>>>0},a.sum64=function(e,a,t,c){var f=e[a],d=c+e[a+1]>>>0,r=(d>>0,e[a+1]=d},a.sum64_hi=function(e,a,t,c){return(a+c>>>0>>0},a.sum64_lo=function(e,a,t,c){return a+c>>>0},a.sum64_4_hi=function(e,a,t,c,f,d,r,n){var i=0,b=a;return i+=(b=b+c>>>0)>>0)>>0)>>0},a.sum64_4_lo=function(e,a,t,c,f,d,r,n){return a+c+d+n>>>0},a.sum64_5_hi=function(e,a,t,c,f,d,r,n,i,b){var o=0,s=a;return o+=(s=s+c>>>0)>>0)>>0)>>0)>>0},a.sum64_5_lo=function(e,a,t,c,f,d,r,n,i,b){return a+c+d+n+b>>>0},a.rotr64_hi=function(e,a,t){return(a<<32-t|e>>>t)>>>0},a.rotr64_lo=function(e,a,t){return(e<<32-t|a>>>t)>>>0},a.shr64_hi=function(e,a,t){return e>>>t},a.shr64_lo=function(e,a,t){return(e<<32-t|a>>>t)>>>0}},9957:(e,a,t)=>{"use strict";var c=Function.prototype.call,f=Object.prototype.hasOwnProperty,d=t(66743);e.exports=d.call(c,f)},32723:(e,a,t)=>{"use strict";var c=t(77952),f=t(64367),d=t(43349);function r(e){if(!(this instanceof r))return new r(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var a=f.toArray(e.entropy,e.entropyEnc||"hex"),t=f.toArray(e.nonce,e.nonceEnc||"hex"),c=f.toArray(e.pers,e.persEnc||"hex");d(a.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(a,t,c)}e.exports=r,r.prototype._init=function(e,a,t){var c=e.concat(a).concat(t);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var f=0;f=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(t||[])),this._reseed=1},r.prototype.generate=function(e,a,t,c){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof a&&(c=t,t=a,a=null),t&&(t=f.toArray(t,c||"hex"),this._update(t));for(var d=[];d.length{var c=t(11568),f=t(23276),d=e.exports;for(var r in c)c.hasOwnProperty(r)&&(d[r]=c[r]);function n(e){if("string"==typeof e&&(e=f.parse(e)),e.protocol||(e.protocol="https:"),"https:"!==e.protocol)throw new Error('Protocol "'+e.protocol+'" not supported. Expected "https:"');return e}d.request=function(e,a){return e=n(e),c.request.call(this,e,a)},d.get=function(e,a){return e=n(e),c.get.call(this,e,a)}},251:(e,a)=>{a.read=function(e,a,t,c,f){var d,r,n=8*f-c-1,i=(1<>1,o=-7,s=t?f-1:0,l=t?-1:1,u=e[a+s];for(s+=l,d=u&(1<<-o)-1,u>>=-o,o+=n;o>0;d=256*d+e[a+s],s+=l,o-=8);for(r=d&(1<<-o)-1,d>>=-o,o+=c;o>0;r=256*r+e[a+s],s+=l,o-=8);if(0===d)d=1-b;else{if(d===i)return r?NaN:1/0*(u?-1:1);r+=Math.pow(2,c),d-=b}return(u?-1:1)*r*Math.pow(2,d-c)},a.write=function(e,a,t,c,f,d){var r,n,i,b=8*d-f-1,o=(1<>1,l=23===f?Math.pow(2,-24)-Math.pow(2,-77):0,u=c?0:d-1,h=c?1:-1,p=a<0||0===a&&1/a<0?1:0;for(a=Math.abs(a),isNaN(a)||a===1/0?(n=isNaN(a)?1:0,r=o):(r=Math.floor(Math.log(a)/Math.LN2),a*(i=Math.pow(2,-r))<1&&(r--,i*=2),(a+=r+s>=1?l/i:l*Math.pow(2,1-s))*i>=2&&(r++,i/=2),r+s>=o?(n=0,r=o):r+s>=1?(n=(a*i-1)*Math.pow(2,f),r+=s):(n=a*Math.pow(2,s-1)*Math.pow(2,f),r=0));f>=8;e[t+u]=255&n,u+=h,n/=256,f-=8);for(r=r<0;e[t+u]=255&r,u+=h,r/=256,b-=8);e[t+u-h]|=128*p}},56698:e=>{"function"==typeof Object.create?e.exports=function(e,a){a&&(e.super_=a,e.prototype=Object.create(a.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,a){if(a){e.super_=a;var t=function(){};t.prototype=a.prototype,e.prototype=new t,e.prototype.constructor=e}}},47244:(e,a,t)=>{"use strict";var c=t(49092)(),f=t(38075)("Object.prototype.toString"),d=function(e){return!(c&&e&&"object"==typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===f(e)},r=function(e){return!!d(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==f(e)&&"[object Function]"===f(e.callee)},n=function(){return d(arguments)}();d.isLegacyArguments=r,e.exports=n?d:r},69600:e=>{"use strict";var a,t,c=Function.prototype.toString,f="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof f&&"function"==typeof Object.defineProperty)try{a=Object.defineProperty({},"length",{get:function(){throw t}}),t={},f((function(){throw 42}),null,a)}catch(e){e!==t&&(f=null)}else f=null;var d=/^\s*class\b/,r=function(e){try{var a=c.call(e);return d.test(a)}catch(e){return!1}},n=function(e){try{return!r(e)&&(c.call(e),!0)}catch(e){return!1}},i=Object.prototype.toString,b="function"==typeof Symbol&&!!Symbol.toStringTag,o=!(0 in[,]),s=function(){return!1};if("object"==typeof document){var l=document.all;i.call(l)===i.call(document.all)&&(s=function(e){if((o||!e)&&(void 0===e||"object"==typeof e))try{var a=i.call(e);return("[object HTMLAllCollection]"===a||"[object HTML document.all class]"===a||"[object HTMLCollection]"===a||"[object Object]"===a)&&null==e("")}catch(e){}return!1})}e.exports=f?function(e){if(s(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;try{f(e,null,a)}catch(e){if(e!==t)return!1}return!r(e)&&n(e)}:function(e){if(s(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(b)return n(e);if(r(e))return!1;var a=i.call(e);return!("[object Function]"!==a&&"[object GeneratorFunction]"!==a&&!/^\[object HTML/.test(a))&&n(e)}},48184:(e,a,t)=>{"use strict";var c,f=Object.prototype.toString,d=Function.prototype.toString,r=/^\s*(?:function)?\*/,n=t(49092)(),i=Object.getPrototypeOf;e.exports=function(e){if("function"!=typeof e)return!1;if(r.test(d.call(e)))return!0;if(!n)return"[object GeneratorFunction]"===f.call(e);if(!i)return!1;if(void 0===c){var a=function(){if(!n)return!1;try{return Function("return function*() {}")()}catch(e){}}();c=!!a&&i(a)}return i(e)===c}},13003:e=>{"use strict";e.exports=function(e){return e!=e}},24133:(e,a,t)=>{"use strict";var c=t(10487),f=t(38452),d=t(13003),r=t(76642),n=t(92464),i=c(r(),Number);f(i,{getPolyfill:r,implementation:d,shim:n}),e.exports=i},76642:(e,a,t)=>{"use strict";var c=t(13003);e.exports=function(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:c}},92464:(e,a,t)=>{"use strict";var c=t(38452),f=t(76642);e.exports=function(){var e=f();return c(Number,{isNaN:e},{isNaN:function(){return Number.isNaN!==e}}),e}},35680:(e,a,t)=>{"use strict";var c=t(25767);e.exports=function(e){return!!c(e)}},8127:function(e,a,t){var c=t(62045).hp;"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t.g&&t.g,e.exports=function(){"use strict";var e,a="3.7.7",t=a,f="function"==typeof c,d="function"==typeof TextDecoder?new TextDecoder:void 0,r="function"==typeof TextEncoder?new TextEncoder:void 0,n=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),i=(e={},n.forEach((function(a,t){return e[a]=t})),e),b=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,o=String.fromCharCode.bind(String),s="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):function(e){return new Uint8Array(Array.prototype.slice.call(e,0))},l=function(e){return e.replace(/=/g,"").replace(/[+\/]/g,(function(e){return"+"==e?"-":"_"}))},u=function(e){return e.replace(/[^A-Za-z0-9\+\/]/g,"")},h=function(e){for(var a,t,c,f,d="",r=e.length%3,i=0;i255||(c=e.charCodeAt(i++))>255||(f=e.charCodeAt(i++))>255)throw new TypeError("invalid character found");d+=n[(a=t<<16|c<<8|f)>>18&63]+n[a>>12&63]+n[a>>6&63]+n[63&a]}return r?d.slice(0,r-3)+"===".substring(r):d},p="function"==typeof btoa?function(e){return btoa(e)}:f?function(e){return c.from(e,"binary").toString("base64")}:h,g=f?function(e){return c.from(e).toString("base64")}:function(e){for(var a=[],t=0,c=e.length;t>>6)+o(128|63&a):o(224|a>>>12&15)+o(128|a>>>6&63)+o(128|63&a);var a=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return o(240|a>>>18&7)+o(128|a>>>12&63)+o(128|a>>>6&63)+o(128|63&a)},y=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,A=function(e){return e.replace(y,x)},v=f?function(e){return c.from(e,"utf8").toString("base64")}:r?function(e){return g(r.encode(e))}:function(e){return p(A(e))},w=function(e,a){return void 0===a&&(a=!1),a?l(v(e)):v(e)},_=function(e){return w(e,!0)},I=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,E=function(e){switch(e.length){case 4:var a=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return o(55296+(a>>>10))+o(56320+(1023&a));case 3:return o((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return o((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},C=function(e){return e.replace(I,E)},M=function(e){if(e=e.replace(/\s+/g,""),!b.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));for(var a,t,c,f="",d=0;d>16&255):64===c?o(a>>16&255,a>>8&255):o(a>>16&255,a>>8&255,255&a);return f},B="function"==typeof atob?function(e){return atob(u(e))}:f?function(e){return c.from(e,"base64").toString("binary")}:M,k=f?function(e){return s(c.from(e,"base64"))}:function(e){return s(B(e).split("").map((function(e){return e.charCodeAt(0)})))},L=function(e){return k(T(e))},S=f?function(e){return c.from(e,"base64").toString("utf8")}:d?function(e){return d.decode(k(e))}:function(e){return C(B(e))},T=function(e){return u(e.replace(/[-_]/g,(function(e){return"-"==e?"+":"/"})))},N=function(e){return S(T(e))},R=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}},P=function(){var e=function(e,a){return Object.defineProperty(String.prototype,e,R(a))};e("fromBase64",(function(){return N(this)})),e("toBase64",(function(e){return w(this,e)})),e("toBase64URI",(function(){return w(this,!0)})),e("toBase64URL",(function(){return w(this,!0)})),e("toUint8Array",(function(){return L(this)}))},D=function(){var e=function(e,a){return Object.defineProperty(Uint8Array.prototype,e,R(a))};e("toBase64",(function(e){return m(this,e)})),e("toBase64URI",(function(){return m(this,!0)})),e("toBase64URL",(function(){return m(this,!0)}))},O={version:a,VERSION:t,atob:B,atobPolyfill:M,btoa:p,btoaPolyfill:h,fromBase64:N,toBase64:w,encode:w,encodeURI:_,encodeURL:_,utob:A,btou:C,decode:N,isValid:function(e){if("string"!=typeof e)return!1;var a=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(a)||!/[^\s0-9a-zA-Z\-_]/.test(a)},fromUint8Array:m,toUint8Array:L,extendString:P,extendUint8Array:D,extendBuiltins:function(){P(),D()},Base64:{}};return Object.keys(O).forEach((function(e){return O.Base64[e]=O[e]})),O}()},31176:(e,a,t)=>{var c;!function(){"use strict";var f="input is invalid type",d="object"==typeof window,r=d?window:{};r.JS_SHA3_NO_WINDOW&&(d=!1);var n=!d&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?r=t.g:n&&(r=self);var i=!r.JS_SHA3_NO_COMMON_JS&&e.exports,b=t.amdO,o=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,s="0123456789abcdef".split(""),l=[4,1024,262144,67108864],u=[0,8,16,24],h=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],p=[224,256,384,512],g=[128,256],m=["hex","buffer","arrayBuffer","array","digest"],x={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!o||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var y=function(e,a,t){return function(c){return new R(e,a,e).update(c)[t]()}},A=function(e,a,t){return function(c,f){return new R(e,a,f).update(c)[t]()}},v=function(e,a,t){return function(a,c,f,d){return C["cshake"+e].update(a,c,f,d)[t]()}},w=function(e,a,t){return function(a,c,f,d){return C["kmac"+e].update(a,c,f,d)[t]()}},_=function(e,a,t,c){for(var f=0;f>5,this.byteCount=this.blockCount<<2,this.outputBlocks=t>>5,this.extraBytes=(31&t)>>3;for(var c=0;c<50;++c)this.s[c]=0}function P(e,a,t){R.call(this,e,a,t)}R.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var a,t=typeof e;if("string"!==t){if("object"!==t)throw new Error(f);if(null===e)throw new Error(f);if(o&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||o&&ArrayBuffer.isView(e)))throw new Error(f);a=!0}for(var c,d,r=this.blocks,n=this.byteCount,i=e.length,b=this.blockCount,s=0,l=this.s;s>2]|=e[s]<>2]|=d<>2]|=(192|d>>6)<>2]|=(128|63&d)<=57344?(r[c>>2]|=(224|d>>12)<>2]|=(128|d>>6&63)<>2]|=(128|63&d)<>2]|=(240|d>>18)<>2]|=(128|d>>12&63)<>2]|=(128|d>>6&63)<>2]|=(128|63&d)<=n){for(this.start=c-n,this.block=r[b],c=0;c>=8);t>0;)f.unshift(t),t=255&(e>>=8),++c;return a?f.push(c):f.unshift(c),this.update(f),f.length},R.prototype.encodeString=function(e){var a,t=typeof e;if("string"!==t){if("object"!==t)throw new Error(f);if(null===e)throw new Error(f);if(o&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||o&&ArrayBuffer.isView(e)))throw new Error(f);a=!0}var c=0,d=e.length;if(a)c=d;else for(var r=0;r=57344?c+=3:(n=65536+((1023&n)<<10|1023&e.charCodeAt(++r)),c+=4)}return c+=this.encode(8*c),this.update(e),c},R.prototype.bytepad=function(e,a){for(var t=this.encode(a),c=0;c>2]|=this.padding[3&a],this.lastByteIndex===this.byteCount)for(e[0]=e[t],a=1;a>4&15]+s[15&e]+s[e>>12&15]+s[e>>8&15]+s[e>>20&15]+s[e>>16&15]+s[e>>28&15]+s[e>>24&15];r%a==0&&(D(t),d=0)}return f&&(e=t[d],n+=s[e>>4&15]+s[15&e],f>1&&(n+=s[e>>12&15]+s[e>>8&15]),f>2&&(n+=s[e>>20&15]+s[e>>16&15])),n},R.prototype.arrayBuffer=function(){this.finalize();var e,a=this.blockCount,t=this.s,c=this.outputBlocks,f=this.extraBytes,d=0,r=0,n=this.outputBits>>3;e=f?new ArrayBuffer(c+1<<2):new ArrayBuffer(n);for(var i=new Uint32Array(e);r>8&255,i[e+2]=a>>16&255,i[e+3]=a>>24&255;n%t==0&&D(c)}return d&&(e=n<<2,a=c[r],i[e]=255&a,d>1&&(i[e+1]=a>>8&255),d>2&&(i[e+2]=a>>16&255)),i},P.prototype=new R,P.prototype.finalize=function(){return this.encode(this.outputBits,!0),R.prototype.finalize.call(this)};var D=function(e){var a,t,c,f,d,r,n,i,b,o,s,l,u,p,g,m,x,y,A,v,w,_,I,E,C,M,B,k,L,S,T,N,R,P,D,O,F,Q,U,j,H,q,$,z,G,K,V,Z,J,W,Y,X,ee,ae,te,ce,fe,de,re,ne,ie,be,oe;for(c=0;c<48;c+=2)f=e[0]^e[10]^e[20]^e[30]^e[40],d=e[1]^e[11]^e[21]^e[31]^e[41],r=e[2]^e[12]^e[22]^e[32]^e[42],n=e[3]^e[13]^e[23]^e[33]^e[43],i=e[4]^e[14]^e[24]^e[34]^e[44],b=e[5]^e[15]^e[25]^e[35]^e[45],o=e[6]^e[16]^e[26]^e[36]^e[46],s=e[7]^e[17]^e[27]^e[37]^e[47],a=(l=e[8]^e[18]^e[28]^e[38]^e[48])^(r<<1|n>>>31),t=(u=e[9]^e[19]^e[29]^e[39]^e[49])^(n<<1|r>>>31),e[0]^=a,e[1]^=t,e[10]^=a,e[11]^=t,e[20]^=a,e[21]^=t,e[30]^=a,e[31]^=t,e[40]^=a,e[41]^=t,a=f^(i<<1|b>>>31),t=d^(b<<1|i>>>31),e[2]^=a,e[3]^=t,e[12]^=a,e[13]^=t,e[22]^=a,e[23]^=t,e[32]^=a,e[33]^=t,e[42]^=a,e[43]^=t,a=r^(o<<1|s>>>31),t=n^(s<<1|o>>>31),e[4]^=a,e[5]^=t,e[14]^=a,e[15]^=t,e[24]^=a,e[25]^=t,e[34]^=a,e[35]^=t,e[44]^=a,e[45]^=t,a=i^(l<<1|u>>>31),t=b^(u<<1|l>>>31),e[6]^=a,e[7]^=t,e[16]^=a,e[17]^=t,e[26]^=a,e[27]^=t,e[36]^=a,e[37]^=t,e[46]^=a,e[47]^=t,a=o^(f<<1|d>>>31),t=s^(d<<1|f>>>31),e[8]^=a,e[9]^=t,e[18]^=a,e[19]^=t,e[28]^=a,e[29]^=t,e[38]^=a,e[39]^=t,e[48]^=a,e[49]^=t,p=e[0],g=e[1],K=e[11]<<4|e[10]>>>28,V=e[10]<<4|e[11]>>>28,k=e[20]<<3|e[21]>>>29,L=e[21]<<3|e[20]>>>29,ne=e[31]<<9|e[30]>>>23,ie=e[30]<<9|e[31]>>>23,q=e[40]<<18|e[41]>>>14,$=e[41]<<18|e[40]>>>14,P=e[2]<<1|e[3]>>>31,D=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,x=e[12]<<12|e[13]>>>20,Z=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,S=e[33]<<13|e[32]>>>19,T=e[32]<<13|e[33]>>>19,be=e[42]<<2|e[43]>>>30,oe=e[43]<<2|e[42]>>>30,ae=e[5]<<30|e[4]>>>2,te=e[4]<<30|e[5]>>>2,O=e[14]<<6|e[15]>>>26,F=e[15]<<6|e[14]>>>26,y=e[25]<<11|e[24]>>>21,A=e[24]<<11|e[25]>>>21,W=e[34]<<15|e[35]>>>17,Y=e[35]<<15|e[34]>>>17,N=e[45]<<29|e[44]>>>3,R=e[44]<<29|e[45]>>>3,E=e[6]<<28|e[7]>>>4,C=e[7]<<28|e[6]>>>4,ce=e[17]<<23|e[16]>>>9,fe=e[16]<<23|e[17]>>>9,Q=e[26]<<25|e[27]>>>7,U=e[27]<<25|e[26]>>>7,v=e[36]<<21|e[37]>>>11,w=e[37]<<21|e[36]>>>11,X=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,z=e[8]<<27|e[9]>>>5,G=e[9]<<27|e[8]>>>5,M=e[18]<<20|e[19]>>>12,B=e[19]<<20|e[18]>>>12,de=e[29]<<7|e[28]>>>25,re=e[28]<<7|e[29]>>>25,j=e[38]<<8|e[39]>>>24,H=e[39]<<8|e[38]>>>24,_=e[48]<<14|e[49]>>>18,I=e[49]<<14|e[48]>>>18,e[0]=p^~m&y,e[1]=g^~x&A,e[10]=E^~M&k,e[11]=C^~B&L,e[20]=P^~O&Q,e[21]=D^~F&U,e[30]=z^~K&Z,e[31]=G^~V&J,e[40]=ae^~ce&de,e[41]=te^~fe&re,e[2]=m^~y&v,e[3]=x^~A&w,e[12]=M^~k&S,e[13]=B^~L&T,e[22]=O^~Q&j,e[23]=F^~U&H,e[32]=K^~Z&W,e[33]=V^~J&Y,e[42]=ce^~de&ne,e[43]=fe^~re&ie,e[4]=y^~v&_,e[5]=A^~w&I,e[14]=k^~S&N,e[15]=L^~T&R,e[24]=Q^~j&q,e[25]=U^~H&$,e[34]=Z^~W&X,e[35]=J^~Y&ee,e[44]=de^~ne&be,e[45]=re^~ie&oe,e[6]=v^~_&p,e[7]=w^~I&g,e[16]=S^~N&E,e[17]=T^~R&C,e[26]=j^~q&P,e[27]=H^~$&D,e[36]=W^~X&z,e[37]=Y^~ee&G,e[46]=ne^~be&ae,e[47]=ie^~oe&te,e[8]=_^~p&m,e[9]=I^~g&x,e[18]=N^~E&M,e[19]=R^~C&B,e[28]=q^~P&O,e[29]=$^~D&F,e[38]=X^~z&K,e[39]=ee^~G&V,e[48]=be^~ae&ce,e[49]=oe^~te&fe,e[0]^=h[c],e[1]^=h[c+1]};if(i)e.exports=C;else{for(B=0;B{"use strict";var a=e.exports=function(e,a,c){"function"==typeof a&&(c=a,a={}),t(a,"function"==typeof(c=a.cb||c)?c:c.pre||function(){},c.post||function(){},e,"",e)};function t(e,c,f,d,r,n,i,b,o,s){if(d&&"object"==typeof d&&!Array.isArray(d)){for(var l in c(d,r,n,i,b,o,s),d){var u=d[l];if(Array.isArray(u)){if(l in a.arrayKeywords)for(var h=0;h{"use strict";var c=t(56698),f=t(73726),d=t(92861).Buffer,r=new Array(16);function n(){f.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function i(e,a){return e<>>32-a}function b(e,a,t,c,f,d,r){return i(e+(a&t|~a&c)+f+d|0,r)+a|0}function o(e,a,t,c,f,d,r){return i(e+(a&c|t&~c)+f+d|0,r)+a|0}function s(e,a,t,c,f,d,r){return i(e+(a^t^c)+f+d|0,r)+a|0}function l(e,a,t,c,f,d,r){return i(e+(t^(a|~c))+f+d|0,r)+a|0}c(n,f),n.prototype._update=function(){for(var e=r,a=0;a<16;++a)e[a]=this._block.readInt32LE(4*a);var t=this._a,c=this._b,f=this._c,d=this._d;t=b(t,c,f,d,e[0],3614090360,7),d=b(d,t,c,f,e[1],3905402710,12),f=b(f,d,t,c,e[2],606105819,17),c=b(c,f,d,t,e[3],3250441966,22),t=b(t,c,f,d,e[4],4118548399,7),d=b(d,t,c,f,e[5],1200080426,12),f=b(f,d,t,c,e[6],2821735955,17),c=b(c,f,d,t,e[7],4249261313,22),t=b(t,c,f,d,e[8],1770035416,7),d=b(d,t,c,f,e[9],2336552879,12),f=b(f,d,t,c,e[10],4294925233,17),c=b(c,f,d,t,e[11],2304563134,22),t=b(t,c,f,d,e[12],1804603682,7),d=b(d,t,c,f,e[13],4254626195,12),f=b(f,d,t,c,e[14],2792965006,17),t=o(t,c=b(c,f,d,t,e[15],1236535329,22),f,d,e[1],4129170786,5),d=o(d,t,c,f,e[6],3225465664,9),f=o(f,d,t,c,e[11],643717713,14),c=o(c,f,d,t,e[0],3921069994,20),t=o(t,c,f,d,e[5],3593408605,5),d=o(d,t,c,f,e[10],38016083,9),f=o(f,d,t,c,e[15],3634488961,14),c=o(c,f,d,t,e[4],3889429448,20),t=o(t,c,f,d,e[9],568446438,5),d=o(d,t,c,f,e[14],3275163606,9),f=o(f,d,t,c,e[3],4107603335,14),c=o(c,f,d,t,e[8],1163531501,20),t=o(t,c,f,d,e[13],2850285829,5),d=o(d,t,c,f,e[2],4243563512,9),f=o(f,d,t,c,e[7],1735328473,14),t=s(t,c=o(c,f,d,t,e[12],2368359562,20),f,d,e[5],4294588738,4),d=s(d,t,c,f,e[8],2272392833,11),f=s(f,d,t,c,e[11],1839030562,16),c=s(c,f,d,t,e[14],4259657740,23),t=s(t,c,f,d,e[1],2763975236,4),d=s(d,t,c,f,e[4],1272893353,11),f=s(f,d,t,c,e[7],4139469664,16),c=s(c,f,d,t,e[10],3200236656,23),t=s(t,c,f,d,e[13],681279174,4),d=s(d,t,c,f,e[0],3936430074,11),f=s(f,d,t,c,e[3],3572445317,16),c=s(c,f,d,t,e[6],76029189,23),t=s(t,c,f,d,e[9],3654602809,4),d=s(d,t,c,f,e[12],3873151461,11),f=s(f,d,t,c,e[15],530742520,16),t=l(t,c=s(c,f,d,t,e[2],3299628645,23),f,d,e[0],4096336452,6),d=l(d,t,c,f,e[7],1126891415,10),f=l(f,d,t,c,e[14],2878612391,15),c=l(c,f,d,t,e[5],4237533241,21),t=l(t,c,f,d,e[12],1700485571,6),d=l(d,t,c,f,e[3],2399980690,10),f=l(f,d,t,c,e[10],4293915773,15),c=l(c,f,d,t,e[1],2240044497,21),t=l(t,c,f,d,e[8],1873313359,6),d=l(d,t,c,f,e[15],4264355552,10),f=l(f,d,t,c,e[6],2734768916,15),c=l(c,f,d,t,e[13],1309151649,21),t=l(t,c,f,d,e[4],4149444226,6),d=l(d,t,c,f,e[11],3174756917,10),f=l(f,d,t,c,e[2],718787259,15),c=l(c,f,d,t,e[9],3951481745,21),this._a=this._a+t|0,this._b=this._b+c|0,this._c=this._c+f|0,this._d=this._d+d|0},n.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=d.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=n},73726:(e,a,t)=>{"use strict";var c=t(92861).Buffer,f=t(28399).Transform;function d(e){f.call(this),this._block=c.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}t(56698)(d,f),d.prototype._transform=function(e,a,t){var c=null;try{this.update(e,a)}catch(e){c=e}t(c)},d.prototype._flush=function(e){var a=null;try{this.push(this.digest())}catch(e){a=e}e(a)},d.prototype.update=function(e,a){if(function(e){if(!c.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer")}(e),this._finalized)throw new Error("Digest already called");c.isBuffer(e)||(e=c.from(e,a));for(var t=this._block,f=0;this._blockOffset+e.length-f>=this._blockSize;){for(var d=this._blockOffset;d0;++r)this._length[r]+=n,(n=this._length[r]/4294967296|0)>0&&(this._length[r]-=4294967296*n);return this},d.prototype._update=function(){throw new Error("_update is not implemented")},d.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var a=this._digest();void 0!==e&&(a=a.toString(e)),this._block.fill(0),this._blockOffset=0;for(var t=0;t<4;++t)this._length[t]=0;return a},d.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=d},6215:(e,a,t)=>{"use strict";var c=t(62045).hp;Object.defineProperty(a,"__esModule",{value:!0}),a.InvalidStatusCodeError=a.InvalidCertError=void 0;const f=Object.freeze({redirect:!0,expectStatusCode:200,headers:{},full:!1,keepAlive:!0,cors:!1,referrer:!1,sslAllowSelfSigned:!1,_redirectCount:0});class d extends Error{constructor(e,a){super(e),this.fingerprint256=a}}a.InvalidCertError=d;class r extends Error{constructor(e){super(`Request Failed. Status Code: ${e}`),this.statusCode=e}}function n(e,a){if(!a||"text"===a||"json"===a)try{let t=new TextDecoder("utf8",{fatal:!0}).decode(e);if("text"===a)return t;try{return JSON.parse(t)}catch(e){if("json"===a)throw e;return t}}catch(e){if("text"===a||"json"===a)throw e}return e}a.InvalidStatusCodeError=r;let i={};function b(e,a){let o={...f,...a};const s=t(11568),l=t(11083),u=t(78559),{promisify:h}=t(40537),{resolve:p}=t(59676),g=!!/^https/.test(e);let m={method:o.method||"GET",headers:{"Accept-Encoding":"gzip, deflate, br"}};const x=e=>e.replace(/:| /g,"").toLowerCase();if(o.keepAlive){const e={keepAlive:!0,keepAliveMsecs:3e4,maxFreeSockets:1024,maxCachedSessions:1024},a=[g,g&&o.sslPinnedCertificates?.map((e=>x(e))).sort()].join();m.agent=i[a]||(i[a]=new(g?l:s).Agent(e))}return"json"===o.type&&(m.headers["Content-Type"]="application/json"),o.data&&(o.method||(m.method="POST"),m.body="json"===o.type?JSON.stringify(o.data):o.data),m.headers={...m.headers,...o.headers},o.sslAllowSelfSigned&&(m.rejectUnauthorized=!1),new Promise(((a,t)=>{const f=async a=>{if(a&&"DEPTH_ZERO_SELF_SIGNED_CERT"===a.code)try{await b(e,{...o,sslAllowSelfSigned:!0,sslPinnedCertificates:[]})}catch(e){e&&e.fingerprint256&&(a=new d(`Self-signed SSL certificate: ${e.fingerprint256}`,e.fingerprint256))}t(a)},i=(g?l:s).request(e,m,(d=>{d.on("error",f),(async()=>{try{a(await(async a=>{const t=a.statusCode;if(o.redirect&&300<=t&&t<400&&a.headers.location){if(10==o._redirectCount)throw new Error("Request failed. Too much redirects.");return o._redirectCount+=1,await b(p(e,a.headers.location),o)}if(o.expectStatusCode&&t!==o.expectStatusCode)throw a.resume(),new r(t);let f=[];for await(const e of a)f.push(e);let d=c.concat(f);const i=a.headers["content-encoding"];"br"===i&&(d=await h(u.brotliDecompress)(d)),"gzip"!==i&&"deflate"!==i||(d=await h(u.unzip)(d));const s=n(d,o.type);return o.full?{headers:a.headers,status:t,body:s}:s})(d))}catch(e){t(e)}})()}));i.on("error",f);const y=o.sslPinnedCertificates?.map((e=>x(e))),A=e=>{const a=x(e.getPeerCertificate()?.fingerprint256||"");if((a||!e.isSessionReused())&&!y.includes(a))return i.emit("error",new d(`Invalid SSL certificate: ${a} Expected: ${y}`,a)),i.abort()};o.sslPinnedCertificates&&i.on("socket",(e=>{e.listeners("secureConnect").map((e=>(e.name||"").replace("bound ",""))).includes("mfetchSecureConnect")||e.on("secureConnect",A.bind(null,e))})),o.keepAlive&&i.setNoDelay(!0),m.body&&i.write(m.body),i.end()}))}const o=new Set(["Accept","Accept-Language","Content-Language","Content-Type"].map((e=>e.toLowerCase()))),s=new Set(["Accept-Charset","Accept-Encoding","Access-Control-Request-Headers","Access-Control-Request-Method","Connection","Content-Length","Cookie","Cookie2","Date","DNT","Expect","Host","Keep-Alive","Origin","Referer","TE","Trailer","Transfer-Encoding","Upgrade","Via"].map((e=>e.toLowerCase())));async function l(e,a){let t={...f,...a};const c=new Headers;"json"===t.type&&c.set("Content-Type","application/json");let d=new URL(e);if(d.username){const e=btoa(`${d.username}:${d.password}`);c.set("Authorization",`Basic ${e}`),d.username="",d.password=""}e=""+d;for(let e in t.headers){const a=e.toLowerCase();(o.has(a)||t.cors&&!s.has(a))&&c.set(e,t.headers[e])}let i={headers:c,redirect:t.redirect?"follow":"manual"};t.referrer||(i.referrerPolicy="no-referrer"),t.cors&&(i.mode="cors"),t.data&&(t.method||(i.method="POST"),i.body="json"===t.type?JSON.stringify(t.data):t.data);const b=await fetch(e,i);if(t.expectStatusCode&&b.status!==t.expectStatusCode)throw new r(b.status);const l=n(new Uint8Array(await b.arrayBuffer()),t.type);return t.full?{headers:Object.fromEntries(b.headers.entries()),status:b.status,body:l}:l}const u=!!("object"==typeof process&&process.versions&&process.versions.node&&process.versions.v8);a.default=function(e,a){return(u?b:l)(e,a)}},52244:(e,a,t)=>{var c=t(61158),f=t(15037);function d(e){this.rand=e||new f.Rand}e.exports=d,d.create=function(e){return new d(e)},d.prototype._randbelow=function(e){var a=e.bitLength(),t=Math.ceil(a/8);do{var f=new c(this.rand.generate(t))}while(f.cmp(e)>=0);return f},d.prototype._randrange=function(e,a){var t=a.sub(e);return e.add(this._randbelow(t))},d.prototype.test=function(e,a,t){var f=e.bitLength(),d=c.mont(e),r=new c(1).toRed(d);a||(a=Math.max(1,f/48|0));for(var n=e.subn(1),i=0;!n.testn(i);i++);for(var b=e.shrn(i),o=n.toRed(d);a>0;a--){var s=this._randrange(new c(2),n);t&&t(s);var l=s.toRed(d).redPow(b);if(0!==l.cmp(r)&&0!==l.cmp(o)){for(var u=1;u0;a--){var o=this._randrange(new c(2),r),s=e.gcd(o);if(0!==s.cmpn(1))return s;var l=o.toRed(f).redPow(i);if(0!==l.cmp(d)&&0!==l.cmp(b)){for(var u=1;u=65&&t<=70?t-55:t>=97&&t<=102?t-87:t-48&15}function i(e,a,t){var c=n(e,t);return t-1>=a&&(c|=n(e,t-1)<<4),c}function b(e,a,t,c){for(var f=0,d=Math.min(e.length,t),r=a;r=49?n-49+10:n>=17?n-17+10:n}return f}d.isBN=function(e){return e instanceof d||null!==e&&"object"==typeof e&&e.constructor.wordSize===d.wordSize&&Array.isArray(e.words)},d.max=function(e,a){return e.cmp(a)>0?e:a},d.min=function(e,a){return e.cmp(a)<0?e:a},d.prototype._init=function(e,a,t){if("number"==typeof e)return this._initNumber(e,a,t);if("object"==typeof e)return this._initArray(e,a,t);"hex"===a&&(a=16),c(a===(0|a)&&a>=2&&a<=36);var f=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(f++,this.negative=1),f=0;f-=3)r=e[f]|e[f-1]<<8|e[f-2]<<16,this.words[d]|=r<>>26-n&67108863,(n+=24)>=26&&(n-=26,d++);else if("le"===t)for(f=0,d=0;f>>26-n&67108863,(n+=24)>=26&&(n-=26,d++);return this.strip()},d.prototype._parseHex=function(e,a,t){this.length=Math.ceil((e.length-a)/6),this.words=new Array(this.length);for(var c=0;c=a;c-=2)f=i(e,a,c)<=18?(d-=18,r+=1,this.words[r]|=f>>>26):d+=8;else for(c=(e.length-a)%2==0?a+1:a;c=18?(d-=18,r+=1,this.words[r]|=f>>>26):d+=8;this.strip()},d.prototype._parseBase=function(e,a,t){this.words=[0],this.length=1;for(var c=0,f=1;f<=67108863;f*=a)c++;c--,f=f/a|0;for(var d=e.length-t,r=d%c,n=Math.min(d,d-r)+t,i=0,o=t;o1&&0===this.words[this.length-1];)this.length--;return this._normSign()},d.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},d.prototype.inspect=function(){return(this.red?""};var o=["","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"],s=[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],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function u(e,a,t){t.negative=a.negative^e.negative;var c=e.length+a.length|0;t.length=c,c=c-1|0;var f=0|e.words[0],d=0|a.words[0],r=f*d,n=67108863&r,i=r/67108864|0;t.words[0]=n;for(var b=1;b>>26,s=67108863&i,l=Math.min(b,a.length-1),u=Math.max(0,b-e.length+1);u<=l;u++){var h=b-u|0;o+=(r=(f=0|e.words[h])*(d=0|a.words[u])+s)/67108864|0,s=67108863&r}t.words[b]=0|s,i=0|o}return 0!==i?t.words[b]=0|i:t.length--,t.strip()}d.prototype.toString=function(e,a){var t;if(a=0|a||1,16===(e=e||10)||"hex"===e){t="";for(var f=0,d=0,r=0;r>>24-f&16777215)||r!==this.length-1?o[6-i.length]+i+t:i+t,(f+=2)>=26&&(f-=26,r--)}for(0!==d&&(t=d.toString(16)+t);t.length%a!=0;)t="0"+t;return 0!==this.negative&&(t="-"+t),t}if(e===(0|e)&&e>=2&&e<=36){var b=s[e],u=l[e];t="";var h=this.clone();for(h.negative=0;!h.isZero();){var p=h.modn(u).toString(e);t=(h=h.idivn(u)).isZero()?p+t:o[b-p.length]+p+t}for(this.isZero()&&(t="0"+t);t.length%a!=0;)t="0"+t;return 0!==this.negative&&(t="-"+t),t}c(!1,"Base should be between 2 and 36")},d.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&c(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},d.prototype.toJSON=function(){return this.toString(16)},d.prototype.toBuffer=function(e,a){return c(void 0!==r),this.toArrayLike(r,e,a)},d.prototype.toArray=function(e,a){return this.toArrayLike(Array,e,a)},d.prototype.toArrayLike=function(e,a,t){var f=this.byteLength(),d=t||Math.max(1,f);c(f<=d,"byte array longer than desired length"),c(d>0,"Requested array length <= 0"),this.strip();var r,n,i="le"===a,b=new e(d),o=this.clone();if(i){for(n=0;!o.isZero();n++)r=o.andln(255),o.iushrn(8),b[n]=r;for(;n=4096&&(t+=13,a>>>=13),a>=64&&(t+=7,a>>>=7),a>=8&&(t+=4,a>>>=4),a>=2&&(t+=2,a>>>=2),t+a},d.prototype._zeroBits=function(e){if(0===e)return 26;var a=e,t=0;return 8191&a||(t+=13,a>>>=13),127&a||(t+=7,a>>>=7),15&a||(t+=4,a>>>=4),3&a||(t+=2,a>>>=2),1&a||t++,t},d.prototype.bitLength=function(){var e=this.words[this.length-1],a=this._countBits(e);return 26*(this.length-1)+a},d.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,a=0;ae.length?this.clone().ior(e):e.clone().ior(this)},d.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},d.prototype.iuand=function(e){var a;a=this.length>e.length?e:this;for(var t=0;te.length?this.clone().iand(e):e.clone().iand(this)},d.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},d.prototype.iuxor=function(e){var a,t;this.length>e.length?(a=this,t=e):(a=e,t=this);for(var c=0;ce.length?this.clone().ixor(e):e.clone().ixor(this)},d.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},d.prototype.inotn=function(e){c("number"==typeof e&&e>=0);var a=0|Math.ceil(e/26),t=e%26;this._expand(a),t>0&&a--;for(var f=0;f0&&(this.words[f]=~this.words[f]&67108863>>26-t),this.strip()},d.prototype.notn=function(e){return this.clone().inotn(e)},d.prototype.setn=function(e,a){c("number"==typeof e&&e>=0);var t=e/26|0,f=e%26;return this._expand(t+1),this.words[t]=a?this.words[t]|1<e.length?(t=this,c=e):(t=e,c=this);for(var f=0,d=0;d>>26;for(;0!==f&&d>>26;if(this.length=t.length,0!==f)this.words[this.length]=f,this.length++;else if(t!==this)for(;de.length?this.clone().iadd(e):e.clone().iadd(this)},d.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var a=this.iadd(e);return e.negative=1,a._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var t,c,f=this.cmp(e);if(0===f)return this.negative=0,this.length=1,this.words[0]=0,this;f>0?(t=this,c=e):(t=e,c=this);for(var d=0,r=0;r>26,this.words[r]=67108863&a;for(;0!==d&&r>26,this.words[r]=67108863&a;if(0===d&&r>>13,u=0|r[1],h=8191&u,p=u>>>13,g=0|r[2],m=8191&g,x=g>>>13,y=0|r[3],A=8191&y,v=y>>>13,w=0|r[4],_=8191&w,I=w>>>13,E=0|r[5],C=8191&E,M=E>>>13,B=0|r[6],k=8191&B,L=B>>>13,S=0|r[7],T=8191&S,N=S>>>13,R=0|r[8],P=8191&R,D=R>>>13,O=0|r[9],F=8191&O,Q=O>>>13,U=0|n[0],j=8191&U,H=U>>>13,q=0|n[1],$=8191&q,z=q>>>13,G=0|n[2],K=8191&G,V=G>>>13,Z=0|n[3],J=8191&Z,W=Z>>>13,Y=0|n[4],X=8191&Y,ee=Y>>>13,ae=0|n[5],te=8191&ae,ce=ae>>>13,fe=0|n[6],de=8191&fe,re=fe>>>13,ne=0|n[7],ie=8191&ne,be=ne>>>13,oe=0|n[8],se=8191&oe,le=oe>>>13,ue=0|n[9],he=8191&ue,pe=ue>>>13;t.negative=e.negative^a.negative,t.length=19;var ge=(b+(c=Math.imul(s,j))|0)+((8191&(f=(f=Math.imul(s,H))+Math.imul(l,j)|0))<<13)|0;b=((d=Math.imul(l,H))+(f>>>13)|0)+(ge>>>26)|0,ge&=67108863,c=Math.imul(h,j),f=(f=Math.imul(h,H))+Math.imul(p,j)|0,d=Math.imul(p,H);var me=(b+(c=c+Math.imul(s,$)|0)|0)+((8191&(f=(f=f+Math.imul(s,z)|0)+Math.imul(l,$)|0))<<13)|0;b=((d=d+Math.imul(l,z)|0)+(f>>>13)|0)+(me>>>26)|0,me&=67108863,c=Math.imul(m,j),f=(f=Math.imul(m,H))+Math.imul(x,j)|0,d=Math.imul(x,H),c=c+Math.imul(h,$)|0,f=(f=f+Math.imul(h,z)|0)+Math.imul(p,$)|0,d=d+Math.imul(p,z)|0;var xe=(b+(c=c+Math.imul(s,K)|0)|0)+((8191&(f=(f=f+Math.imul(s,V)|0)+Math.imul(l,K)|0))<<13)|0;b=((d=d+Math.imul(l,V)|0)+(f>>>13)|0)+(xe>>>26)|0,xe&=67108863,c=Math.imul(A,j),f=(f=Math.imul(A,H))+Math.imul(v,j)|0,d=Math.imul(v,H),c=c+Math.imul(m,$)|0,f=(f=f+Math.imul(m,z)|0)+Math.imul(x,$)|0,d=d+Math.imul(x,z)|0,c=c+Math.imul(h,K)|0,f=(f=f+Math.imul(h,V)|0)+Math.imul(p,K)|0,d=d+Math.imul(p,V)|0;var ye=(b+(c=c+Math.imul(s,J)|0)|0)+((8191&(f=(f=f+Math.imul(s,W)|0)+Math.imul(l,J)|0))<<13)|0;b=((d=d+Math.imul(l,W)|0)+(f>>>13)|0)+(ye>>>26)|0,ye&=67108863,c=Math.imul(_,j),f=(f=Math.imul(_,H))+Math.imul(I,j)|0,d=Math.imul(I,H),c=c+Math.imul(A,$)|0,f=(f=f+Math.imul(A,z)|0)+Math.imul(v,$)|0,d=d+Math.imul(v,z)|0,c=c+Math.imul(m,K)|0,f=(f=f+Math.imul(m,V)|0)+Math.imul(x,K)|0,d=d+Math.imul(x,V)|0,c=c+Math.imul(h,J)|0,f=(f=f+Math.imul(h,W)|0)+Math.imul(p,J)|0,d=d+Math.imul(p,W)|0;var Ae=(b+(c=c+Math.imul(s,X)|0)|0)+((8191&(f=(f=f+Math.imul(s,ee)|0)+Math.imul(l,X)|0))<<13)|0;b=((d=d+Math.imul(l,ee)|0)+(f>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,c=Math.imul(C,j),f=(f=Math.imul(C,H))+Math.imul(M,j)|0,d=Math.imul(M,H),c=c+Math.imul(_,$)|0,f=(f=f+Math.imul(_,z)|0)+Math.imul(I,$)|0,d=d+Math.imul(I,z)|0,c=c+Math.imul(A,K)|0,f=(f=f+Math.imul(A,V)|0)+Math.imul(v,K)|0,d=d+Math.imul(v,V)|0,c=c+Math.imul(m,J)|0,f=(f=f+Math.imul(m,W)|0)+Math.imul(x,J)|0,d=d+Math.imul(x,W)|0,c=c+Math.imul(h,X)|0,f=(f=f+Math.imul(h,ee)|0)+Math.imul(p,X)|0,d=d+Math.imul(p,ee)|0;var ve=(b+(c=c+Math.imul(s,te)|0)|0)+((8191&(f=(f=f+Math.imul(s,ce)|0)+Math.imul(l,te)|0))<<13)|0;b=((d=d+Math.imul(l,ce)|0)+(f>>>13)|0)+(ve>>>26)|0,ve&=67108863,c=Math.imul(k,j),f=(f=Math.imul(k,H))+Math.imul(L,j)|0,d=Math.imul(L,H),c=c+Math.imul(C,$)|0,f=(f=f+Math.imul(C,z)|0)+Math.imul(M,$)|0,d=d+Math.imul(M,z)|0,c=c+Math.imul(_,K)|0,f=(f=f+Math.imul(_,V)|0)+Math.imul(I,K)|0,d=d+Math.imul(I,V)|0,c=c+Math.imul(A,J)|0,f=(f=f+Math.imul(A,W)|0)+Math.imul(v,J)|0,d=d+Math.imul(v,W)|0,c=c+Math.imul(m,X)|0,f=(f=f+Math.imul(m,ee)|0)+Math.imul(x,X)|0,d=d+Math.imul(x,ee)|0,c=c+Math.imul(h,te)|0,f=(f=f+Math.imul(h,ce)|0)+Math.imul(p,te)|0,d=d+Math.imul(p,ce)|0;var we=(b+(c=c+Math.imul(s,de)|0)|0)+((8191&(f=(f=f+Math.imul(s,re)|0)+Math.imul(l,de)|0))<<13)|0;b=((d=d+Math.imul(l,re)|0)+(f>>>13)|0)+(we>>>26)|0,we&=67108863,c=Math.imul(T,j),f=(f=Math.imul(T,H))+Math.imul(N,j)|0,d=Math.imul(N,H),c=c+Math.imul(k,$)|0,f=(f=f+Math.imul(k,z)|0)+Math.imul(L,$)|0,d=d+Math.imul(L,z)|0,c=c+Math.imul(C,K)|0,f=(f=f+Math.imul(C,V)|0)+Math.imul(M,K)|0,d=d+Math.imul(M,V)|0,c=c+Math.imul(_,J)|0,f=(f=f+Math.imul(_,W)|0)+Math.imul(I,J)|0,d=d+Math.imul(I,W)|0,c=c+Math.imul(A,X)|0,f=(f=f+Math.imul(A,ee)|0)+Math.imul(v,X)|0,d=d+Math.imul(v,ee)|0,c=c+Math.imul(m,te)|0,f=(f=f+Math.imul(m,ce)|0)+Math.imul(x,te)|0,d=d+Math.imul(x,ce)|0,c=c+Math.imul(h,de)|0,f=(f=f+Math.imul(h,re)|0)+Math.imul(p,de)|0,d=d+Math.imul(p,re)|0;var _e=(b+(c=c+Math.imul(s,ie)|0)|0)+((8191&(f=(f=f+Math.imul(s,be)|0)+Math.imul(l,ie)|0))<<13)|0;b=((d=d+Math.imul(l,be)|0)+(f>>>13)|0)+(_e>>>26)|0,_e&=67108863,c=Math.imul(P,j),f=(f=Math.imul(P,H))+Math.imul(D,j)|0,d=Math.imul(D,H),c=c+Math.imul(T,$)|0,f=(f=f+Math.imul(T,z)|0)+Math.imul(N,$)|0,d=d+Math.imul(N,z)|0,c=c+Math.imul(k,K)|0,f=(f=f+Math.imul(k,V)|0)+Math.imul(L,K)|0,d=d+Math.imul(L,V)|0,c=c+Math.imul(C,J)|0,f=(f=f+Math.imul(C,W)|0)+Math.imul(M,J)|0,d=d+Math.imul(M,W)|0,c=c+Math.imul(_,X)|0,f=(f=f+Math.imul(_,ee)|0)+Math.imul(I,X)|0,d=d+Math.imul(I,ee)|0,c=c+Math.imul(A,te)|0,f=(f=f+Math.imul(A,ce)|0)+Math.imul(v,te)|0,d=d+Math.imul(v,ce)|0,c=c+Math.imul(m,de)|0,f=(f=f+Math.imul(m,re)|0)+Math.imul(x,de)|0,d=d+Math.imul(x,re)|0,c=c+Math.imul(h,ie)|0,f=(f=f+Math.imul(h,be)|0)+Math.imul(p,ie)|0,d=d+Math.imul(p,be)|0;var Ie=(b+(c=c+Math.imul(s,se)|0)|0)+((8191&(f=(f=f+Math.imul(s,le)|0)+Math.imul(l,se)|0))<<13)|0;b=((d=d+Math.imul(l,le)|0)+(f>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,c=Math.imul(F,j),f=(f=Math.imul(F,H))+Math.imul(Q,j)|0,d=Math.imul(Q,H),c=c+Math.imul(P,$)|0,f=(f=f+Math.imul(P,z)|0)+Math.imul(D,$)|0,d=d+Math.imul(D,z)|0,c=c+Math.imul(T,K)|0,f=(f=f+Math.imul(T,V)|0)+Math.imul(N,K)|0,d=d+Math.imul(N,V)|0,c=c+Math.imul(k,J)|0,f=(f=f+Math.imul(k,W)|0)+Math.imul(L,J)|0,d=d+Math.imul(L,W)|0,c=c+Math.imul(C,X)|0,f=(f=f+Math.imul(C,ee)|0)+Math.imul(M,X)|0,d=d+Math.imul(M,ee)|0,c=c+Math.imul(_,te)|0,f=(f=f+Math.imul(_,ce)|0)+Math.imul(I,te)|0,d=d+Math.imul(I,ce)|0,c=c+Math.imul(A,de)|0,f=(f=f+Math.imul(A,re)|0)+Math.imul(v,de)|0,d=d+Math.imul(v,re)|0,c=c+Math.imul(m,ie)|0,f=(f=f+Math.imul(m,be)|0)+Math.imul(x,ie)|0,d=d+Math.imul(x,be)|0,c=c+Math.imul(h,se)|0,f=(f=f+Math.imul(h,le)|0)+Math.imul(p,se)|0,d=d+Math.imul(p,le)|0;var Ee=(b+(c=c+Math.imul(s,he)|0)|0)+((8191&(f=(f=f+Math.imul(s,pe)|0)+Math.imul(l,he)|0))<<13)|0;b=((d=d+Math.imul(l,pe)|0)+(f>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,c=Math.imul(F,$),f=(f=Math.imul(F,z))+Math.imul(Q,$)|0,d=Math.imul(Q,z),c=c+Math.imul(P,K)|0,f=(f=f+Math.imul(P,V)|0)+Math.imul(D,K)|0,d=d+Math.imul(D,V)|0,c=c+Math.imul(T,J)|0,f=(f=f+Math.imul(T,W)|0)+Math.imul(N,J)|0,d=d+Math.imul(N,W)|0,c=c+Math.imul(k,X)|0,f=(f=f+Math.imul(k,ee)|0)+Math.imul(L,X)|0,d=d+Math.imul(L,ee)|0,c=c+Math.imul(C,te)|0,f=(f=f+Math.imul(C,ce)|0)+Math.imul(M,te)|0,d=d+Math.imul(M,ce)|0,c=c+Math.imul(_,de)|0,f=(f=f+Math.imul(_,re)|0)+Math.imul(I,de)|0,d=d+Math.imul(I,re)|0,c=c+Math.imul(A,ie)|0,f=(f=f+Math.imul(A,be)|0)+Math.imul(v,ie)|0,d=d+Math.imul(v,be)|0,c=c+Math.imul(m,se)|0,f=(f=f+Math.imul(m,le)|0)+Math.imul(x,se)|0,d=d+Math.imul(x,le)|0;var Ce=(b+(c=c+Math.imul(h,he)|0)|0)+((8191&(f=(f=f+Math.imul(h,pe)|0)+Math.imul(p,he)|0))<<13)|0;b=((d=d+Math.imul(p,pe)|0)+(f>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,c=Math.imul(F,K),f=(f=Math.imul(F,V))+Math.imul(Q,K)|0,d=Math.imul(Q,V),c=c+Math.imul(P,J)|0,f=(f=f+Math.imul(P,W)|0)+Math.imul(D,J)|0,d=d+Math.imul(D,W)|0,c=c+Math.imul(T,X)|0,f=(f=f+Math.imul(T,ee)|0)+Math.imul(N,X)|0,d=d+Math.imul(N,ee)|0,c=c+Math.imul(k,te)|0,f=(f=f+Math.imul(k,ce)|0)+Math.imul(L,te)|0,d=d+Math.imul(L,ce)|0,c=c+Math.imul(C,de)|0,f=(f=f+Math.imul(C,re)|0)+Math.imul(M,de)|0,d=d+Math.imul(M,re)|0,c=c+Math.imul(_,ie)|0,f=(f=f+Math.imul(_,be)|0)+Math.imul(I,ie)|0,d=d+Math.imul(I,be)|0,c=c+Math.imul(A,se)|0,f=(f=f+Math.imul(A,le)|0)+Math.imul(v,se)|0,d=d+Math.imul(v,le)|0;var Me=(b+(c=c+Math.imul(m,he)|0)|0)+((8191&(f=(f=f+Math.imul(m,pe)|0)+Math.imul(x,he)|0))<<13)|0;b=((d=d+Math.imul(x,pe)|0)+(f>>>13)|0)+(Me>>>26)|0,Me&=67108863,c=Math.imul(F,J),f=(f=Math.imul(F,W))+Math.imul(Q,J)|0,d=Math.imul(Q,W),c=c+Math.imul(P,X)|0,f=(f=f+Math.imul(P,ee)|0)+Math.imul(D,X)|0,d=d+Math.imul(D,ee)|0,c=c+Math.imul(T,te)|0,f=(f=f+Math.imul(T,ce)|0)+Math.imul(N,te)|0,d=d+Math.imul(N,ce)|0,c=c+Math.imul(k,de)|0,f=(f=f+Math.imul(k,re)|0)+Math.imul(L,de)|0,d=d+Math.imul(L,re)|0,c=c+Math.imul(C,ie)|0,f=(f=f+Math.imul(C,be)|0)+Math.imul(M,ie)|0,d=d+Math.imul(M,be)|0,c=c+Math.imul(_,se)|0,f=(f=f+Math.imul(_,le)|0)+Math.imul(I,se)|0,d=d+Math.imul(I,le)|0;var Be=(b+(c=c+Math.imul(A,he)|0)|0)+((8191&(f=(f=f+Math.imul(A,pe)|0)+Math.imul(v,he)|0))<<13)|0;b=((d=d+Math.imul(v,pe)|0)+(f>>>13)|0)+(Be>>>26)|0,Be&=67108863,c=Math.imul(F,X),f=(f=Math.imul(F,ee))+Math.imul(Q,X)|0,d=Math.imul(Q,ee),c=c+Math.imul(P,te)|0,f=(f=f+Math.imul(P,ce)|0)+Math.imul(D,te)|0,d=d+Math.imul(D,ce)|0,c=c+Math.imul(T,de)|0,f=(f=f+Math.imul(T,re)|0)+Math.imul(N,de)|0,d=d+Math.imul(N,re)|0,c=c+Math.imul(k,ie)|0,f=(f=f+Math.imul(k,be)|0)+Math.imul(L,ie)|0,d=d+Math.imul(L,be)|0,c=c+Math.imul(C,se)|0,f=(f=f+Math.imul(C,le)|0)+Math.imul(M,se)|0,d=d+Math.imul(M,le)|0;var ke=(b+(c=c+Math.imul(_,he)|0)|0)+((8191&(f=(f=f+Math.imul(_,pe)|0)+Math.imul(I,he)|0))<<13)|0;b=((d=d+Math.imul(I,pe)|0)+(f>>>13)|0)+(ke>>>26)|0,ke&=67108863,c=Math.imul(F,te),f=(f=Math.imul(F,ce))+Math.imul(Q,te)|0,d=Math.imul(Q,ce),c=c+Math.imul(P,de)|0,f=(f=f+Math.imul(P,re)|0)+Math.imul(D,de)|0,d=d+Math.imul(D,re)|0,c=c+Math.imul(T,ie)|0,f=(f=f+Math.imul(T,be)|0)+Math.imul(N,ie)|0,d=d+Math.imul(N,be)|0,c=c+Math.imul(k,se)|0,f=(f=f+Math.imul(k,le)|0)+Math.imul(L,se)|0,d=d+Math.imul(L,le)|0;var Le=(b+(c=c+Math.imul(C,he)|0)|0)+((8191&(f=(f=f+Math.imul(C,pe)|0)+Math.imul(M,he)|0))<<13)|0;b=((d=d+Math.imul(M,pe)|0)+(f>>>13)|0)+(Le>>>26)|0,Le&=67108863,c=Math.imul(F,de),f=(f=Math.imul(F,re))+Math.imul(Q,de)|0,d=Math.imul(Q,re),c=c+Math.imul(P,ie)|0,f=(f=f+Math.imul(P,be)|0)+Math.imul(D,ie)|0,d=d+Math.imul(D,be)|0,c=c+Math.imul(T,se)|0,f=(f=f+Math.imul(T,le)|0)+Math.imul(N,se)|0,d=d+Math.imul(N,le)|0;var Se=(b+(c=c+Math.imul(k,he)|0)|0)+((8191&(f=(f=f+Math.imul(k,pe)|0)+Math.imul(L,he)|0))<<13)|0;b=((d=d+Math.imul(L,pe)|0)+(f>>>13)|0)+(Se>>>26)|0,Se&=67108863,c=Math.imul(F,ie),f=(f=Math.imul(F,be))+Math.imul(Q,ie)|0,d=Math.imul(Q,be),c=c+Math.imul(P,se)|0,f=(f=f+Math.imul(P,le)|0)+Math.imul(D,se)|0,d=d+Math.imul(D,le)|0;var Te=(b+(c=c+Math.imul(T,he)|0)|0)+((8191&(f=(f=f+Math.imul(T,pe)|0)+Math.imul(N,he)|0))<<13)|0;b=((d=d+Math.imul(N,pe)|0)+(f>>>13)|0)+(Te>>>26)|0,Te&=67108863,c=Math.imul(F,se),f=(f=Math.imul(F,le))+Math.imul(Q,se)|0,d=Math.imul(Q,le);var Ne=(b+(c=c+Math.imul(P,he)|0)|0)+((8191&(f=(f=f+Math.imul(P,pe)|0)+Math.imul(D,he)|0))<<13)|0;b=((d=d+Math.imul(D,pe)|0)+(f>>>13)|0)+(Ne>>>26)|0,Ne&=67108863;var Re=(b+(c=Math.imul(F,he))|0)+((8191&(f=(f=Math.imul(F,pe))+Math.imul(Q,he)|0))<<13)|0;return b=((d=Math.imul(Q,pe))+(f>>>13)|0)+(Re>>>26)|0,Re&=67108863,i[0]=ge,i[1]=me,i[2]=xe,i[3]=ye,i[4]=Ae,i[5]=ve,i[6]=we,i[7]=_e,i[8]=Ie,i[9]=Ee,i[10]=Ce,i[11]=Me,i[12]=Be,i[13]=ke,i[14]=Le,i[15]=Se,i[16]=Te,i[17]=Ne,i[18]=Re,0!==b&&(i[19]=b,t.length++),t};function p(e,a,t){return(new g).mulp(e,a,t)}function g(e,a){this.x=e,this.y=a}Math.imul||(h=u),d.prototype.mulTo=function(e,a){var t,c=this.length+e.length;return t=10===this.length&&10===e.length?h(this,e,a):c<63?u(this,e,a):c<1024?function(e,a,t){t.negative=a.negative^e.negative,t.length=e.length+a.length;for(var c=0,f=0,d=0;d>>26)|0)>>>26,r&=67108863}t.words[d]=n,c=r,r=f}return 0!==c?t.words[d]=c:t.length--,t.strip()}(this,e,a):p(this,e,a),t},g.prototype.makeRBT=function(e){for(var a=new Array(e),t=d.prototype._countBits(e)-1,c=0;c>=1;return c},g.prototype.permute=function(e,a,t,c,f,d){for(var r=0;r>>=1)f++;return 1<>>=13,t[2*r+1]=8191&d,d>>>=13;for(r=2*a;r>=26,a+=f/67108864|0,a+=d>>>26,this.words[t]=67108863&d}return 0!==a&&(this.words[t]=a,this.length++),this},d.prototype.muln=function(e){return this.clone().imuln(e)},d.prototype.sqr=function(){return this.mul(this)},d.prototype.isqr=function(){return this.imul(this.clone())},d.prototype.pow=function(e){var a=function(e){for(var a=new Array(e.bitLength()),t=0;t>>f}return a}(e);if(0===a.length)return new d(1);for(var t=this,c=0;c=0);var a,t=e%26,f=(e-t)/26,d=67108863>>>26-t<<26-t;if(0!==t){var r=0;for(a=0;a>>26-t}r&&(this.words[a]=r,this.length++)}if(0!==f){for(a=this.length-1;a>=0;a--)this.words[a+f]=this.words[a];for(a=0;a=0),f=a?(a-a%26)/26:0;var d=e%26,r=Math.min((e-d)/26,this.length),n=67108863^67108863>>>d<r)for(this.length-=r,b=0;b=0&&(0!==o||b>=f);b--){var s=0|this.words[b];this.words[b]=o<<26-d|s>>>d,o=s&n}return i&&0!==o&&(i.words[i.length++]=o),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},d.prototype.ishrn=function(e,a,t){return c(0===this.negative),this.iushrn(e,a,t)},d.prototype.shln=function(e){return this.clone().ishln(e)},d.prototype.ushln=function(e){return this.clone().iushln(e)},d.prototype.shrn=function(e){return this.clone().ishrn(e)},d.prototype.ushrn=function(e){return this.clone().iushrn(e)},d.prototype.testn=function(e){c("number"==typeof e&&e>=0);var a=e%26,t=(e-a)/26,f=1<=0);var a=e%26,t=(e-a)/26;if(c(0===this.negative,"imaskn works only with positive numbers"),this.length<=t)return this;if(0!==a&&t++,this.length=Math.min(t,this.length),0!==a){var f=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},d.prototype.isubn=function(e){if(c("number"==typeof e),c(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(i/67108864|0),this.words[f+t]=67108863&d}for(;f>26,this.words[f+t]=67108863&d;if(0===n)return this.strip();for(c(-1===n),n=0,f=0;f>26,this.words[f]=67108863&d;return this.negative=1,this.strip()},d.prototype._wordDiv=function(e,a){var t=(this.length,e.length),c=this.clone(),f=e,r=0|f.words[f.length-1];0!=(t=26-this._countBits(r))&&(f=f.ushln(t),c.iushln(t),r=0|f.words[f.length-1]);var n,i=c.length-f.length;if("mod"!==a){(n=new d(null)).length=i+1,n.words=new Array(n.length);for(var b=0;b=0;s--){var l=67108864*(0|c.words[f.length+s])+(0|c.words[f.length+s-1]);for(l=Math.min(l/r|0,67108863),c._ishlnsubmul(f,l,s);0!==c.negative;)l--,c.negative=0,c._ishlnsubmul(f,1,s),c.isZero()||(c.negative^=1);n&&(n.words[s]=l)}return n&&n.strip(),c.strip(),"div"!==a&&0!==t&&c.iushrn(t),{div:n||null,mod:c}},d.prototype.divmod=function(e,a,t){return c(!e.isZero()),this.isZero()?{div:new d(0),mod:new d(0)}:0!==this.negative&&0===e.negative?(n=this.neg().divmod(e,a),"mod"!==a&&(f=n.div.neg()),"div"!==a&&(r=n.mod.neg(),t&&0!==r.negative&&r.iadd(e)),{div:f,mod:r}):0===this.negative&&0!==e.negative?(n=this.divmod(e.neg(),a),"mod"!==a&&(f=n.div.neg()),{div:f,mod:n.mod}):this.negative&e.negative?(n=this.neg().divmod(e.neg(),a),"div"!==a&&(r=n.mod.neg(),t&&0!==r.negative&&r.isub(e)),{div:n.div,mod:r}):e.length>this.length||this.cmp(e)<0?{div:new d(0),mod:this}:1===e.length?"div"===a?{div:this.divn(e.words[0]),mod:null}:"mod"===a?{div:null,mod:new d(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new d(this.modn(e.words[0]))}:this._wordDiv(e,a);var f,r,n},d.prototype.div=function(e){return this.divmod(e,"div",!1).div},d.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},d.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},d.prototype.divRound=function(e){var a=this.divmod(e);if(a.mod.isZero())return a.div;var t=0!==a.div.negative?a.mod.isub(e):a.mod,c=e.ushrn(1),f=e.andln(1),d=t.cmp(c);return d<0||1===f&&0===d?a.div:0!==a.div.negative?a.div.isubn(1):a.div.iaddn(1)},d.prototype.modn=function(e){c(e<=67108863);for(var a=(1<<26)%e,t=0,f=this.length-1;f>=0;f--)t=(a*t+(0|this.words[f]))%e;return t},d.prototype.idivn=function(e){c(e<=67108863);for(var a=0,t=this.length-1;t>=0;t--){var f=(0|this.words[t])+67108864*a;this.words[t]=f/e|0,a=f%e}return this.strip()},d.prototype.divn=function(e){return this.clone().idivn(e)},d.prototype.egcd=function(e){c(0===e.negative),c(!e.isZero());var a=this,t=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var f=new d(1),r=new d(0),n=new d(0),i=new d(1),b=0;a.isEven()&&t.isEven();)a.iushrn(1),t.iushrn(1),++b;for(var o=t.clone(),s=a.clone();!a.isZero();){for(var l=0,u=1;!(a.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(a.iushrn(l);l-- >0;)(f.isOdd()||r.isOdd())&&(f.iadd(o),r.isub(s)),f.iushrn(1),r.iushrn(1);for(var h=0,p=1;!(t.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(n.isOdd()||i.isOdd())&&(n.iadd(o),i.isub(s)),n.iushrn(1),i.iushrn(1);a.cmp(t)>=0?(a.isub(t),f.isub(n),r.isub(i)):(t.isub(a),n.isub(f),i.isub(r))}return{a:n,b:i,gcd:t.iushln(b)}},d.prototype._invmp=function(e){c(0===e.negative),c(!e.isZero());var a=this,t=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var f,r=new d(1),n=new d(0),i=t.clone();a.cmpn(1)>0&&t.cmpn(1)>0;){for(var b=0,o=1;!(a.words[0]&o)&&b<26;++b,o<<=1);if(b>0)for(a.iushrn(b);b-- >0;)r.isOdd()&&r.iadd(i),r.iushrn(1);for(var s=0,l=1;!(t.words[0]&l)&&s<26;++s,l<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(i),n.iushrn(1);a.cmp(t)>=0?(a.isub(t),r.isub(n)):(t.isub(a),n.isub(r))}return(f=0===a.cmpn(1)?r:n).cmpn(0)<0&&f.iadd(e),f},d.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var a=this.clone(),t=e.clone();a.negative=0,t.negative=0;for(var c=0;a.isEven()&&t.isEven();c++)a.iushrn(1),t.iushrn(1);for(;;){for(;a.isEven();)a.iushrn(1);for(;t.isEven();)t.iushrn(1);var f=a.cmp(t);if(f<0){var d=a;a=t,t=d}else if(0===f||0===t.cmpn(1))break;a.isub(t)}return t.iushln(c)},d.prototype.invm=function(e){return this.egcd(e).a.umod(e)},d.prototype.isEven=function(){return!(1&this.words[0])},d.prototype.isOdd=function(){return!(1&~this.words[0])},d.prototype.andln=function(e){return this.words[0]&e},d.prototype.bincn=function(e){c("number"==typeof e);var a=e%26,t=(e-a)/26,f=1<>>26,n&=67108863,this.words[r]=n}return 0!==d&&(this.words[r]=d,this.length++),this},d.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},d.prototype.cmpn=function(e){var a,t=e<0;if(0!==this.negative&&!t)return-1;if(0===this.negative&&t)return 1;if(this.strip(),this.length>1)a=1;else{t&&(e=-e),c(e<=67108863,"Number is too big");var f=0|this.words[0];a=f===e?0:fe.length)return 1;if(this.length=0;t--){var c=0|this.words[t],f=0|e.words[t];if(c!==f){cf&&(a=1);break}}return a},d.prototype.gtn=function(e){return 1===this.cmpn(e)},d.prototype.gt=function(e){return 1===this.cmp(e)},d.prototype.gten=function(e){return this.cmpn(e)>=0},d.prototype.gte=function(e){return this.cmp(e)>=0},d.prototype.ltn=function(e){return-1===this.cmpn(e)},d.prototype.lt=function(e){return-1===this.cmp(e)},d.prototype.lten=function(e){return this.cmpn(e)<=0},d.prototype.lte=function(e){return this.cmp(e)<=0},d.prototype.eqn=function(e){return 0===this.cmpn(e)},d.prototype.eq=function(e){return 0===this.cmp(e)},d.red=function(e){return new _(e)},d.prototype.toRed=function(e){return c(!this.red,"Already a number in reduction context"),c(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},d.prototype.fromRed=function(){return c(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},d.prototype._forceRed=function(e){return this.red=e,this},d.prototype.forceRed=function(e){return c(!this.red,"Already a number in reduction context"),this._forceRed(e)},d.prototype.redAdd=function(e){return c(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},d.prototype.redIAdd=function(e){return c(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},d.prototype.redSub=function(e){return c(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},d.prototype.redISub=function(e){return c(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},d.prototype.redShl=function(e){return c(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},d.prototype.redMul=function(e){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},d.prototype.redIMul=function(e){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},d.prototype.redSqr=function(){return c(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},d.prototype.redISqr=function(){return c(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},d.prototype.redSqrt=function(){return c(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},d.prototype.redInvm=function(){return c(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},d.prototype.redNeg=function(){return c(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},d.prototype.redPow=function(e){return c(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var m={k256:null,p224:null,p192:null,p25519:null};function x(e,a){this.name=e,this.p=new d(a,16),this.n=this.p.bitLength(),this.k=new d(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){x.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){x.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){x.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){x.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"==typeof e){var a=d._prime(e);this.m=a.p,this.prime=a}else c(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function I(e){_.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new d(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)}x.prototype._tmp=function(){var e=new d(null);return e.words=new Array(Math.ceil(this.n/13)),e},x.prototype.ireduce=function(e){var a,t=e;do{this.split(t,this.tmp),a=(t=(t=this.imulK(t)).iadd(this.tmp)).bitLength()}while(a>this.n);var c=a0?t.isub(this.p):void 0!==t.strip?t.strip():t._strip(),t},x.prototype.split=function(e,a){e.iushrn(this.n,0,a)},x.prototype.imulK=function(e){return e.imul(this.k)},f(y,x),y.prototype.split=function(e,a){for(var t=4194303,c=Math.min(e.length,9),f=0;f>>22,d=r}d>>>=22,e.words[f-10]=d,0===d&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var a=0,t=0;t>>=26,e.words[t]=f,a=c}return 0!==a&&(e.words[e.length++]=a),e},d._prime=function(e){if(m[e])return m[e];var a;if("k256"===e)a=new y;else if("p224"===e)a=new A;else if("p192"===e)a=new v;else{if("p25519"!==e)throw new Error("Unknown prime "+e);a=new w}return m[e]=a,a},_.prototype._verify1=function(e){c(0===e.negative,"red works only with positives"),c(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,a){c(!(e.negative|a.negative),"red works only with positives"),c(e.red&&e.red===a.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,a){this._verify2(e,a);var t=e.add(a);return t.cmp(this.m)>=0&&t.isub(this.m),t._forceRed(this)},_.prototype.iadd=function(e,a){this._verify2(e,a);var t=e.iadd(a);return t.cmp(this.m)>=0&&t.isub(this.m),t},_.prototype.sub=function(e,a){this._verify2(e,a);var t=e.sub(a);return t.cmpn(0)<0&&t.iadd(this.m),t._forceRed(this)},_.prototype.isub=function(e,a){this._verify2(e,a);var t=e.isub(a);return t.cmpn(0)<0&&t.iadd(this.m),t},_.prototype.shl=function(e,a){return this._verify1(e),this.imod(e.ushln(a))},_.prototype.imul=function(e,a){return this._verify2(e,a),this.imod(e.imul(a))},_.prototype.mul=function(e,a){return this._verify2(e,a),this.imod(e.mul(a))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var a=this.m.andln(3);if(c(a%2==1),3===a){var t=this.m.add(new d(1)).iushrn(2);return this.pow(e,t)}for(var f=this.m.subn(1),r=0;!f.isZero()&&0===f.andln(1);)r++,f.iushrn(1);c(!f.isZero());var n=new d(1).toRed(this),i=n.redNeg(),b=this.m.subn(1).iushrn(1),o=this.m.bitLength();for(o=new d(2*o*o).toRed(this);0!==this.pow(o,b).cmp(i);)o.redIAdd(i);for(var s=this.pow(o,f),l=this.pow(e,f.addn(1).iushrn(1)),u=this.pow(e,f),h=r;0!==u.cmp(n);){for(var p=u,g=0;0!==p.cmp(n);g++)p=p.redSqr();c(g=0;c--){for(var b=a.words[c],o=i-1;o>=0;o--){var s=b>>o&1;f!==t[0]&&(f=this.sqr(f)),0!==s||0!==r?(r<<=1,r|=s,(4==++n||0===c&&0===o)&&(f=this.mul(f,t[r]),n=0,r=0)):n=0}i=26}return f},_.prototype.convertTo=function(e){var a=e.umod(this.m);return a===e?a.clone():a},_.prototype.convertFrom=function(e){var a=e.clone();return a.red=null,a},d.mont=function(e){return new I(e)},f(I,_),I.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},I.prototype.convertFrom=function(e){var a=this.imod(e.mul(this.rinv));return a.red=null,a},I.prototype.imul=function(e,a){if(e.isZero()||a.isZero())return e.words[0]=0,e.length=1,e;var t=e.imul(a),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=t.isub(c).iushrn(this.shift),d=f;return f.cmp(this.m)>=0?d=f.isub(this.m):f.cmpn(0)<0&&(d=f.iadd(this.m)),d._forceRed(this)},I.prototype.mul=function(e,a){if(e.isZero()||a.isZero())return new d(0)._forceRed(this);var t=e.mul(a),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=t.isub(c).iushrn(this.shift),r=f;return f.cmp(this.m)>=0?r=f.isub(this.m):f.cmpn(0)<0&&(r=f.iadd(this.m)),r._forceRed(this)},I.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=t.nmd(e),this)},43349:e=>{function a(e,a){if(!e)throw new Error(a||"Assertion failed")}e.exports=a,a.equal=function(e,a,t){if(e!=a)throw new Error(t||"Assertion failed: "+e+" != "+a)}},64367:(e,a)=>{"use strict";var t=a;function c(e){return 1===e.length?"0"+e:e}function f(e){for(var a="",t=0;t>8,r=255&f;d?t.push(d,r):t.push(r)}return t},t.zero2=c,t.toHex=f,t.encode=function(e,a){return"hex"===a?f(e):e}},6585:e=>{var a=1e3,t=60*a,c=60*t,f=24*c,d=7*f;function r(e,a,t,c){var f=a>=1.5*t;return Math.round(e/t)+" "+c+(f?"s":"")}e.exports=function(e,n){n=n||{};var i,b,o=typeof e;if("string"===o&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(r){var n=parseFloat(r[1]);switch((r[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*n;case"weeks":case"week":case"w":return n*d;case"days":case"day":case"d":return n*f;case"hours":case"hour":case"hrs":case"hr":case"h":return n*c;case"minutes":case"minute":case"mins":case"min":case"m":return n*t;case"seconds":case"second":case"secs":case"sec":case"s":return n*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}(e);if("number"===o&&isFinite(e))return n.long?(i=e,(b=Math.abs(i))>=f?r(i,b,f,"day"):b>=c?r(i,b,c,"hour"):b>=t?r(i,b,t,"minute"):b>=a?r(i,b,a,"second"):i+" ms"):function(e){var d=Math.abs(e);return d>=f?Math.round(e/f)+"d":d>=c?Math.round(e/c)+"h":d>=t?Math.round(e/t)+"m":d>=a?Math.round(e/a)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},18633:(e,a,t)=>{"use strict";const{encodeText:c}=t(24084);e.exports=class{constructor(e,a,t,f){this.name=e,this.code=a,this.codeBuf=c(this.code),this.alphabet=f,this.codec=t(f)}encode(e){return this.codec.encode(e)}decode(e){for(const a of e)if(this.alphabet&&this.alphabet.indexOf(a)<0)throw new Error(`invalid character '${a}' in '${e}'`);return this.codec.decode(e)}}},67579:(e,a,t)=>{"use strict";const c=t(25084),f=t(18633),{rfc4648:d}=t(99417),{decodeText:r,encodeText:n}=t(24084),i=[["identity","\0",()=>({encode:r,decode:n}),""],["base2","0",d(1),"01"],["base8","7",d(3),"01234567"],["base10","9",c,"0123456789"],["base16","f",d(4),"0123456789abcdef"],["base16upper","F",d(4),"0123456789ABCDEF"],["base32hex","v",d(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",d(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",d(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",d(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",d(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",d(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",d(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",d(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",d(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",c,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",c,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",c,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",c,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",d(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",d(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",d(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",d(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],b=i.reduce(((e,a)=>(e[a[0]]=new f(a[0],a[1],a[2],a[3]),e)),{}),o=i.reduce(((e,a)=>(e[a[1]]=b[a[0]],e)),{});e.exports={names:b,codes:o}},91466:(e,a,t)=>{"use strict";const c=t(67579),{encodeText:f,decodeText:d,concat:r}=t(24084);function n(e){if(Object.prototype.hasOwnProperty.call(c.names,e))return c.names[e];if(Object.prototype.hasOwnProperty.call(c.codes,e))return c.codes[e];throw new Error(`Unsupported encoding: ${e}`)}(a=e.exports=function(e,a){if(!a)throw new Error("requires an encoded Uint8Array");const{name:t,codeBuf:c}=n(e);return function(e,a){n(e).decode(d(a))}(t,a),r([c,a],c.length+a.length)}).encode=function(e,a){const t=n(e),c=f(t.encode(a));return r([t.codeBuf,c],t.codeBuf.length+c.length)},a.decode=function(e){e instanceof Uint8Array&&(e=d(e));const a=e[0];return["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(a)&&(e=e.toLowerCase()),n(e[0]).decode(e.substring(1))},a.isEncoded=function(e){if(e instanceof Uint8Array&&(e=d(e)),"[object String]"!==Object.prototype.toString.call(e))return!1;try{return n(e[0]).name}catch(e){return!1}},a.encoding=n,a.encodingFromData=function(e){return e instanceof Uint8Array&&(e=d(e)),n(e[0])};const i=Object.freeze(c.names),b=Object.freeze(c.codes);a.names=i,a.codes=b},99417:e=>{"use strict";e.exports={rfc4648:e=>a=>({encode:t=>((e,a,t)=>{const c="="===a[a.length-1],f=(1<t;)r-=t,d+=a[f&n>>r];if(r&&(d+=a[f&n<((e,a,t)=>{const c={};for(let e=0;e=8&&(r-=8,d[i++]=255&n>>r)}if(r>=t||255&n<<8-r)throw new SyntaxError("Unexpected end of data");return d})(t,a,e)})}},24084:e=>{"use strict";const a=new TextDecoder,t=new TextEncoder;e.exports={decodeText:e=>a.decode(e),encodeText:e=>t.encode(e),concat:function(e,a){const t=new Uint8Array(a);let c=0;for(const a of e)t.set(a,c),c+=a.length;return t}}},35194:e=>{e.exports=function e(c,f){var d,r=0,n=0,i=f=f||0,b=c.length;do{if(i>=b||n>49)throw e.bytes=0,new RangeError("Could not decode varint");d=c[i++],r+=n<28?(d&t)<=a);return e.bytes=i-f,r};var a=128,t=127},25134:e=>{e.exports=function e(f,d,r){if(Number.MAX_SAFE_INTEGER&&f>Number.MAX_SAFE_INTEGER)throw e.bytes=0,new RangeError("Could not encode varint");d=d||[];for(var n=r=r||0;f>=c;)d[r++]=255&f|a,f/=128;for(;f&t;)d[r++]=255&f|a,f>>>=7;return d[r]=0|f,e.bytes=r-n+1,d};var a=128,t=-128,c=Math.pow(2,31)},20038:(e,a,t)=>{e.exports={encode:t(25134),decode:t(35194),encodingLength:t(36516)}},36516:e=>{var a=Math.pow(2,7),t=Math.pow(2,14),c=Math.pow(2,21),f=Math.pow(2,28),d=Math.pow(2,35),r=Math.pow(2,42),n=Math.pow(2,49),i=Math.pow(2,56),b=Math.pow(2,63);e.exports=function(e){return e{"use strict";const a=Object.freeze({identity:0,cidv1:1,cidv2:2,cidv3:3,ip4:4,tcp:6,sha1:17,"sha2-256":18,"sha2-512":19,"sha3-512":20,"sha3-384":21,"sha3-256":22,"sha3-224":23,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,blake3:30,dccp:33,"murmur3-128":34,"murmur3-32":35,ip6:41,ip6zone:42,path:47,multicodec:48,multihash:49,multiaddr:50,multibase:51,dns:53,dns4:54,dns6:55,dnsaddr:56,protobuf:80,cbor:81,raw:85,"dbl-sha2-256":86,rlp:96,bencode:99,"dag-pb":112,"dag-cbor":113,"libp2p-key":114,"git-raw":120,"torrent-info":123,"torrent-file":124,"leofcoin-block":129,"leofcoin-tx":130,"leofcoin-pr":131,sctp:132,"dag-jose":133,"dag-cose":134,"eth-block":144,"eth-block-list":145,"eth-tx-trie":146,"eth-tx":147,"eth-tx-receipt-trie":148,"eth-tx-receipt":149,"eth-state-trie":150,"eth-account-snapshot":151,"eth-storage-trie":152,"eth-receipt-log-trie":153,"eth-reciept-log":154,"bitcoin-block":176,"bitcoin-tx":177,"bitcoin-witness-commitment":178,"zcash-block":192,"zcash-tx":193,"caip-50":202,streamid:206,"stellar-block":208,"stellar-tx":209,md4:212,md5:213,bmt:214,"decred-block":224,"decred-tx":225,"ipld-ns":226,"ipfs-ns":227,"swarm-ns":228,"ipns-ns":229,zeronet:230,"secp256k1-pub":231,"bls12_381-g1-pub":234,"bls12_381-g2-pub":235,"x25519-pub":236,"ed25519-pub":237,"bls12_381-g1g2-pub":238,"dash-block":240,"dash-tx":241,"swarm-manifest":250,"swarm-feed":251,udp:273,"p2p-webrtc-star":275,"p2p-webrtc-direct":276,"p2p-stardust":277,"p2p-circuit":290,"dag-json":297,udt:301,utp:302,unix:400,thread:406,p2p:421,ipfs:421,https:443,onion:444,onion3:445,garlic64:446,garlic32:447,tls:448,noise:454,quic:460,ws:477,wss:478,"p2p-websocket-star":479,http:480,"swhid-1-snp":496,json:512,messagepack:513,"libp2p-peer-record":769,"libp2p-relay-rsvp":770,"car-index-sorted":1024,"sha2-256-trunc254-padded":4114,"ripemd-128":4178,"ripemd-160":4179,"ripemd-256":4180,"ripemd-320":4181,x11:4352,"p256-pub":4608,"p384-pub":4609,"p521-pub":4610,"ed448-pub":4611,"x448-pub":4612,"ed25519-priv":4864,"secp256k1-priv":4865,"x25519-priv":4866,kangarootwelve:7425,"sm3-256":21325,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"skein256-8":45825,"skein256-16":45826,"skein256-24":45827,"skein256-32":45828,"skein256-40":45829,"skein256-48":45830,"skein256-56":45831,"skein256-64":45832,"skein256-72":45833,"skein256-80":45834,"skein256-88":45835,"skein256-96":45836,"skein256-104":45837,"skein256-112":45838,"skein256-120":45839,"skein256-128":45840,"skein256-136":45841,"skein256-144":45842,"skein256-152":45843,"skein256-160":45844,"skein256-168":45845,"skein256-176":45846,"skein256-184":45847,"skein256-192":45848,"skein256-200":45849,"skein256-208":45850,"skein256-216":45851,"skein256-224":45852,"skein256-232":45853,"skein256-240":45854,"skein256-248":45855,"skein256-256":45856,"skein512-8":45857,"skein512-16":45858,"skein512-24":45859,"skein512-32":45860,"skein512-40":45861,"skein512-48":45862,"skein512-56":45863,"skein512-64":45864,"skein512-72":45865,"skein512-80":45866,"skein512-88":45867,"skein512-96":45868,"skein512-104":45869,"skein512-112":45870,"skein512-120":45871,"skein512-128":45872,"skein512-136":45873,"skein512-144":45874,"skein512-152":45875,"skein512-160":45876,"skein512-168":45877,"skein512-176":45878,"skein512-184":45879,"skein512-192":45880,"skein512-200":45881,"skein512-208":45882,"skein512-216":45883,"skein512-224":45884,"skein512-232":45885,"skein512-240":45886,"skein512-248":45887,"skein512-256":45888,"skein512-264":45889,"skein512-272":45890,"skein512-280":45891,"skein512-288":45892,"skein512-296":45893,"skein512-304":45894,"skein512-312":45895,"skein512-320":45896,"skein512-328":45897,"skein512-336":45898,"skein512-344":45899,"skein512-352":45900,"skein512-360":45901,"skein512-368":45902,"skein512-376":45903,"skein512-384":45904,"skein512-392":45905,"skein512-400":45906,"skein512-408":45907,"skein512-416":45908,"skein512-424":45909,"skein512-432":45910,"skein512-440":45911,"skein512-448":45912,"skein512-456":45913,"skein512-464":45914,"skein512-472":45915,"skein512-480":45916,"skein512-488":45917,"skein512-496":45918,"skein512-504":45919,"skein512-512":45920,"skein1024-8":45921,"skein1024-16":45922,"skein1024-24":45923,"skein1024-32":45924,"skein1024-40":45925,"skein1024-48":45926,"skein1024-56":45927,"skein1024-64":45928,"skein1024-72":45929,"skein1024-80":45930,"skein1024-88":45931,"skein1024-96":45932,"skein1024-104":45933,"skein1024-112":45934,"skein1024-120":45935,"skein1024-128":45936,"skein1024-136":45937,"skein1024-144":45938,"skein1024-152":45939,"skein1024-160":45940,"skein1024-168":45941,"skein1024-176":45942,"skein1024-184":45943,"skein1024-192":45944,"skein1024-200":45945,"skein1024-208":45946,"skein1024-216":45947,"skein1024-224":45948,"skein1024-232":45949,"skein1024-240":45950,"skein1024-248":45951,"skein1024-256":45952,"skein1024-264":45953,"skein1024-272":45954,"skein1024-280":45955,"skein1024-288":45956,"skein1024-296":45957,"skein1024-304":45958,"skein1024-312":45959,"skein1024-320":45960,"skein1024-328":45961,"skein1024-336":45962,"skein1024-344":45963,"skein1024-352":45964,"skein1024-360":45965,"skein1024-368":45966,"skein1024-376":45967,"skein1024-384":45968,"skein1024-392":45969,"skein1024-400":45970,"skein1024-408":45971,"skein1024-416":45972,"skein1024-424":45973,"skein1024-432":45974,"skein1024-440":45975,"skein1024-448":45976,"skein1024-456":45977,"skein1024-464":45978,"skein1024-472":45979,"skein1024-480":45980,"skein1024-488":45981,"skein1024-496":45982,"skein1024-504":45983,"skein1024-512":45984,"skein1024-520":45985,"skein1024-528":45986,"skein1024-536":45987,"skein1024-544":45988,"skein1024-552":45989,"skein1024-560":45990,"skein1024-568":45991,"skein1024-576":45992,"skein1024-584":45993,"skein1024-592":45994,"skein1024-600":45995,"skein1024-608":45996,"skein1024-616":45997,"skein1024-624":45998,"skein1024-632":45999,"skein1024-640":46e3,"skein1024-648":46001,"skein1024-656":46002,"skein1024-664":46003,"skein1024-672":46004,"skein1024-680":46005,"skein1024-688":46006,"skein1024-696":46007,"skein1024-704":46008,"skein1024-712":46009,"skein1024-720":46010,"skein1024-728":46011,"skein1024-736":46012,"skein1024-744":46013,"skein1024-752":46014,"skein1024-760":46015,"skein1024-768":46016,"skein1024-776":46017,"skein1024-784":46018,"skein1024-792":46019,"skein1024-800":46020,"skein1024-808":46021,"skein1024-816":46022,"skein1024-824":46023,"skein1024-832":46024,"skein1024-840":46025,"skein1024-848":46026,"skein1024-856":46027,"skein1024-864":46028,"skein1024-872":46029,"skein1024-880":46030,"skein1024-888":46031,"skein1024-896":46032,"skein1024-904":46033,"skein1024-912":46034,"skein1024-920":46035,"skein1024-928":46036,"skein1024-936":46037,"skein1024-944":46038,"skein1024-952":46039,"skein1024-960":46040,"skein1024-968":46041,"skein1024-976":46042,"skein1024-984":46043,"skein1024-992":46044,"skein1024-1000":46045,"skein1024-1008":46046,"skein1024-1016":46047,"skein1024-1024":46048,"poseidon-bls12_381-a2-fc1":46081,"poseidon-bls12_381-a2-fc1-sc":46082,"zeroxcert-imprint-256":52753,"fil-commitment-unsealed":61697,"fil-commitment-sealed":61698,"holochain-adr-v0":8417572,"holochain-adr-v1":8483108,"holochain-key-v0":9728292,"holochain-key-v1":9793828,"holochain-sig-v0":10645796,"holochain-sig-v1":10711332,"skynet-ns":11639056,"arweave-ns":11704592});e.exports={baseTable:a}},52021:(e,a,t)=>{"use strict";const c=t(20038),{concat:f}=t(75007),d=t(82693),{nameToVarint:r,constantToCode:n,nameToCode:i,codeToName:b}=t(90482);function o(e){const a=c.decode(e),t=b[a];if(void 0===t)throw new Error(`Code "${a}" not found`);return t}function s(e){return b[e]}function l(e){const a=i[e];if(void 0===a)throw new Error(`Codec "${e}" not found`);return a}function u(e){return c.decode(e)}function h(e){const a=r[e];if(void 0===a)throw new Error(`Codec "${e}" not found`);return a}function p(e){return d.varintEncode(e)}e.exports={addPrefix:function(e,a){let t;if(e instanceof Uint8Array)t=d.varintUint8ArrayEncode(e);else{if(!r[e])throw new Error("multicodec not recognized");t=r[e]}return f([t,a],t.length+a.length)},rmPrefix:function(e){return c.decode(e),e.slice(c.decode.bytes)},getNameFromData:o,getNameFromCode:s,getCodeFromName:l,getCodeFromData:u,getVarintFromName:h,getVarintFromCode:p,getCodec:function(e){return o(e)},getName:function(e){return s(e)},getNumber:function(e){return l(e)},getCode:function(e){return u(e)},getCodeVarint:function(e){return h(e)},getVarint:function(e){return Array.from(p(e))},...n,nameToVarint:r,nameToCode:i,codeToName:b}},90482:(e,a,t)=>{"use strict";const{baseTable:c}=t(15661),f=t(82693).varintEncode,d={},r={},n={};for(const e in c){const a=e,t=c[a];d[a]=f(t),r[a.toUpperCase().replace(/-/g,"_")]=t,n[t]||(n[t]=a)}Object.freeze(d),Object.freeze(r),Object.freeze(n);const i=Object.freeze(c);e.exports={nameToVarint:d,constantToCode:r,nameToCode:i,codeToName:n}},82693:(e,a,t)=>{"use strict";const c=t(20038),{toString:f}=t(27302),{fromString:d}=t(44117);function r(e){return parseInt(f(e,"base16"),16)}e.exports={numberToUint8Array:function(e){let a=e.toString(16);return a.length%2==1&&(a="0"+a),d(a,"base16")},uint8ArrayToNumber:r,varintUint8ArrayEncode:function(e){return Uint8Array.from(c.encode(r(e)))},varintEncode:function(e){return Uint8Array.from(c.encode(e))}}},76994:(e,a,t)=>{"use strict";const{Buffer:c}=t(48287);e.exports=class{constructor(e,a,t,f){this.name=e,this.code=a,this.codeBuf=c.from(this.code),this.alphabet=f,this.engine=t(f)}encode(e){return this.engine.encode(e)}decode(e){for(const a of e)if(this.alphabet&&this.alphabet.indexOf(a)<0)throw new Error(`invalid character '${a}' in '${e}'`);return this.engine.decode(e)}}},46082:(e,a,t)=>{"use strict";const c=t(95364),f=t(76994),d=t(15920),{decodeText:r,encodeText:n}=t(40639),i=[["identity","\0",()=>({encode:r,decode:n}),""],["base2","0",d(1),"01"],["base8","7",d(3),"01234567"],["base10","9",c,"0123456789"],["base16","f",d(4),"0123456789abcdef"],["base16upper","F",d(4),"0123456789ABCDEF"],["base32hex","v",d(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",d(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",d(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",d(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",d(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",d(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",d(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",d(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",d(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",c,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",c,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",c,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",c,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",d(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",d(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",d(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",d(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],b=i.reduce(((e,a)=>(e[a[0]]=new f(a[0],a[1],a[2],a[3]),e)),{}),o=i.reduce(((e,a)=>(e[a[1]]=b[a[0]],e)),{});e.exports={names:b,codes:o}},42879:(e,a,t)=>{"use strict";const{Buffer:c}=t(48287),f=t(46082),{decodeText:d,asBuffer:r}=t(40639);function n(e){if(f.names[e])return f.names[e];if(f.codes[e])return f.codes[e];throw new Error(`Unsupported encoding: ${e}`)}(a=e.exports=function(e,a){if(!a)throw new Error("requires an encoded buffer");const{name:t,codeBuf:f}=n(e);!function(e,a){n(e).decode(d(a))}(t,a);const r=c.alloc(f.length+a.length);return r.set(f,0),r.set(a,f.length),r}).encode=function(e,a){const t=n(e);return c.concat([t.codeBuf,c.from(t.encode(a))])},a.decode=function(e){ArrayBuffer.isView(e)&&(e=d(e));const a=e[0];["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(a)&&(e=e.toLowerCase());const t=n(e[0]);return r(t.decode(e.substring(1)))},a.isEncoded=function(e){if(e instanceof Uint8Array&&(e=d(e)),"[object String]"!==Object.prototype.toString.call(e))return!1;try{return n(e[0]).name}catch(e){return!1}},a.encoding=n,a.encodingFromData=function(e){return e instanceof Uint8Array&&(e=d(e)),n(e[0])},a.names=Object.freeze(f.names),a.codes=Object.freeze(f.codes)},15920:e=>{"use strict";e.exports=e=>a=>({encode:t=>((e,a,t)=>{const c="="===a[a.length-1],f=(1<t;)r-=t,d+=a[f&n>>r];if(r&&(d+=a[f&n<((e,a,t)=>{const c={};for(let e=0;e=8&&(r-=8,d[i++]=255&n>>r)}if(r>=t||255&n<<8-r)throw new SyntaxError("Unexpected end of data");return d})(t,a,e)})},40639:(e,a,t)=>{"use strict";const{Buffer:c}=t(48287),{TextEncoder:f,TextDecoder:d}=t(67019),r=new d,n=new f;e.exports={decodeText:e=>r.decode(e),encodeText:e=>n.encode(e),asBuffer:({buffer:e,byteLength:a,byteOffset:t})=>c.from(e,t,a)}},53702:e=>{"use strict";const a=Object.freeze({identity:0,sha1:17,"sha2-256":18,"sha2-512":19,"sha3-512":20,"sha3-384":21,"sha3-256":22,"sha3-224":23,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,blake3:30,"murmur3-128":34,"murmur3-32":35,"dbl-sha2-256":86,md4:212,md5:213,bmt:214,"sha2-256-trunc254-padded":4114,"ripemd-128":4178,"ripemd-160":4179,"ripemd-256":4180,"ripemd-320":4181,x11:4352,"sm3-256":21325,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"skein256-8":45825,"skein256-16":45826,"skein256-24":45827,"skein256-32":45828,"skein256-40":45829,"skein256-48":45830,"skein256-56":45831,"skein256-64":45832,"skein256-72":45833,"skein256-80":45834,"skein256-88":45835,"skein256-96":45836,"skein256-104":45837,"skein256-112":45838,"skein256-120":45839,"skein256-128":45840,"skein256-136":45841,"skein256-144":45842,"skein256-152":45843,"skein256-160":45844,"skein256-168":45845,"skein256-176":45846,"skein256-184":45847,"skein256-192":45848,"skein256-200":45849,"skein256-208":45850,"skein256-216":45851,"skein256-224":45852,"skein256-232":45853,"skein256-240":45854,"skein256-248":45855,"skein256-256":45856,"skein512-8":45857,"skein512-16":45858,"skein512-24":45859,"skein512-32":45860,"skein512-40":45861,"skein512-48":45862,"skein512-56":45863,"skein512-64":45864,"skein512-72":45865,"skein512-80":45866,"skein512-88":45867,"skein512-96":45868,"skein512-104":45869,"skein512-112":45870,"skein512-120":45871,"skein512-128":45872,"skein512-136":45873,"skein512-144":45874,"skein512-152":45875,"skein512-160":45876,"skein512-168":45877,"skein512-176":45878,"skein512-184":45879,"skein512-192":45880,"skein512-200":45881,"skein512-208":45882,"skein512-216":45883,"skein512-224":45884,"skein512-232":45885,"skein512-240":45886,"skein512-248":45887,"skein512-256":45888,"skein512-264":45889,"skein512-272":45890,"skein512-280":45891,"skein512-288":45892,"skein512-296":45893,"skein512-304":45894,"skein512-312":45895,"skein512-320":45896,"skein512-328":45897,"skein512-336":45898,"skein512-344":45899,"skein512-352":45900,"skein512-360":45901,"skein512-368":45902,"skein512-376":45903,"skein512-384":45904,"skein512-392":45905,"skein512-400":45906,"skein512-408":45907,"skein512-416":45908,"skein512-424":45909,"skein512-432":45910,"skein512-440":45911,"skein512-448":45912,"skein512-456":45913,"skein512-464":45914,"skein512-472":45915,"skein512-480":45916,"skein512-488":45917,"skein512-496":45918,"skein512-504":45919,"skein512-512":45920,"skein1024-8":45921,"skein1024-16":45922,"skein1024-24":45923,"skein1024-32":45924,"skein1024-40":45925,"skein1024-48":45926,"skein1024-56":45927,"skein1024-64":45928,"skein1024-72":45929,"skein1024-80":45930,"skein1024-88":45931,"skein1024-96":45932,"skein1024-104":45933,"skein1024-112":45934,"skein1024-120":45935,"skein1024-128":45936,"skein1024-136":45937,"skein1024-144":45938,"skein1024-152":45939,"skein1024-160":45940,"skein1024-168":45941,"skein1024-176":45942,"skein1024-184":45943,"skein1024-192":45944,"skein1024-200":45945,"skein1024-208":45946,"skein1024-216":45947,"skein1024-224":45948,"skein1024-232":45949,"skein1024-240":45950,"skein1024-248":45951,"skein1024-256":45952,"skein1024-264":45953,"skein1024-272":45954,"skein1024-280":45955,"skein1024-288":45956,"skein1024-296":45957,"skein1024-304":45958,"skein1024-312":45959,"skein1024-320":45960,"skein1024-328":45961,"skein1024-336":45962,"skein1024-344":45963,"skein1024-352":45964,"skein1024-360":45965,"skein1024-368":45966,"skein1024-376":45967,"skein1024-384":45968,"skein1024-392":45969,"skein1024-400":45970,"skein1024-408":45971,"skein1024-416":45972,"skein1024-424":45973,"skein1024-432":45974,"skein1024-440":45975,"skein1024-448":45976,"skein1024-456":45977,"skein1024-464":45978,"skein1024-472":45979,"skein1024-480":45980,"skein1024-488":45981,"skein1024-496":45982,"skein1024-504":45983,"skein1024-512":45984,"skein1024-520":45985,"skein1024-528":45986,"skein1024-536":45987,"skein1024-544":45988,"skein1024-552":45989,"skein1024-560":45990,"skein1024-568":45991,"skein1024-576":45992,"skein1024-584":45993,"skein1024-592":45994,"skein1024-600":45995,"skein1024-608":45996,"skein1024-616":45997,"skein1024-624":45998,"skein1024-632":45999,"skein1024-640":46e3,"skein1024-648":46001,"skein1024-656":46002,"skein1024-664":46003,"skein1024-672":46004,"skein1024-680":46005,"skein1024-688":46006,"skein1024-696":46007,"skein1024-704":46008,"skein1024-712":46009,"skein1024-720":46010,"skein1024-728":46011,"skein1024-736":46012,"skein1024-744":46013,"skein1024-752":46014,"skein1024-760":46015,"skein1024-768":46016,"skein1024-776":46017,"skein1024-784":46018,"skein1024-792":46019,"skein1024-800":46020,"skein1024-808":46021,"skein1024-816":46022,"skein1024-824":46023,"skein1024-832":46024,"skein1024-840":46025,"skein1024-848":46026,"skein1024-856":46027,"skein1024-864":46028,"skein1024-872":46029,"skein1024-880":46030,"skein1024-888":46031,"skein1024-896":46032,"skein1024-904":46033,"skein1024-912":46034,"skein1024-920":46035,"skein1024-928":46036,"skein1024-936":46037,"skein1024-944":46038,"skein1024-952":46039,"skein1024-960":46040,"skein1024-968":46041,"skein1024-976":46042,"skein1024-984":46043,"skein1024-992":46044,"skein1024-1000":46045,"skein1024-1008":46046,"skein1024-1016":46047,"skein1024-1024":46048,"poseidon-bls12_381-a2-fc1":46081,"poseidon-bls12_381-a2-fc1-sc":46082});e.exports={names:a}},14243:(e,a,t)=>{"use strict";const{Buffer:c}=t(48287),f=t(42879),d=t(61203),{names:r}=t(53702),{TextDecoder:n}=t(67019),i=new n,b={};for(const e in r)b[r[e]]=e;function o(e){a.decode(e)}a.names=r,a.codes=Object.freeze(b),a.toHexString=function(e){if(!(e instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return(c.isBuffer(e)?e:c.from(e.buffer,e.byteOffset,e.byteLength)).toString("hex")},a.fromHexString=function(e){return c.from(e,"hex")},a.toB58String=function(e){if(!(e instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return i.decode(f.encode("base58btc",e)).slice(1)},a.fromB58String=function(e){const a=e instanceof Uint8Array?i.decode(e):e;return f.decode("z"+a)},a.decode=function(e){if(!(e instanceof Uint8Array))throw new Error("multihash must be a Uint8Array");let t=c.isBuffer(e)?e:c.from(e.buffer,e.byteOffset,e.byteLength);if(t.length<2)throw new Error("multihash too short. must be > 2 bytes.");const f=d.decode(t);if(!a.isValidCode(f))throw new Error(`multihash unknown function code: 0x${f.toString(16)}`);t=t.slice(d.decode.bytes);const r=d.decode(t);if(r<0)throw new Error(`multihash invalid length: ${r}`);if(t=t.slice(d.decode.bytes),t.length!==r)throw new Error(`multihash length inconsistent: 0x${t.toString("hex")}`);return{code:f,name:b[f],length:r,digest:t}},a.encode=function(e,t,f){if(!e||void 0===t)throw new Error("multihash encode requires at least two args: digest, code");const r=a.coerceCode(t);if(!(e instanceof Uint8Array))throw new Error("digest should be a Uint8Array");if(null==f&&(f=e.length),f&&e.length!==f)throw new Error("digest length should be equal to specified length.");const n=d.encode(r),i=d.encode(f),b=c.alloc(n.length+i.length+e.length);return b.set(n,0),b.set(i,n.length),b.set(e,n.length+i.length),b},a.coerceCode=function(e){let t=e;if("string"==typeof e){if(void 0===r[e])throw new Error(`Unrecognized hash function named: ${e}`);t=r[e]}if("number"!=typeof t)throw new Error(`Hash function code should be a number. Got: ${t}`);if(void 0===b[t]&&!a.isAppCode(t))throw new Error(`Unrecognized function code: ${t}`);return t},a.isAppCode=function(e){return e>0&&e<16},a.isValidCode=function(e){return!!a.isAppCode(e)||!!b[e]},a.validate=o,a.prefix=function(e){return o(e),c.from(e.buffer,e.byteOffset,2)}},86889:e=>{e.exports=function e(t,c){if(!t){var f=new a(c);throw Error.captureStackTrace&&Error.captureStackTrace(f,e),f}};class a extends Error{}a.prototype.name="AssertionError"},62045:(e,a,t)=>{"use strict";const c=t(67526),f=t(251),d="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;a.hp=i,a.IS=50;const r=2147483647;function n(e){if(e>r)throw new RangeError('The value "'+e+'" is invalid for option "size"');const a=new Uint8Array(e);return Object.setPrototypeOf(a,i.prototype),a}function i(e,a,t){if("number"==typeof e){if("string"==typeof a)throw new TypeError('The "string" argument must be of type string. Received type number');return s(e)}return b(e,a,t)}function b(e,a,t){if("string"==typeof e)return function(e,a){if("string"==typeof a&&""!==a||(a="utf8"),!i.isEncoding(a))throw new TypeError("Unknown encoding: "+a);const t=0|p(e,a);let c=n(t);const f=c.write(e,a);return f!==t&&(c=c.slice(0,f)),c}(e,a);if(ArrayBuffer.isView(e))return function(e){if(Z(e,Uint8Array)){const a=new Uint8Array(e);return u(a.buffer,a.byteOffset,a.byteLength)}return l(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Z(e,ArrayBuffer)||e&&Z(e.buffer,ArrayBuffer))return u(e,a,t);if("undefined"!=typeof SharedArrayBuffer&&(Z(e,SharedArrayBuffer)||e&&Z(e.buffer,SharedArrayBuffer)))return u(e,a,t);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const c=e.valueOf&&e.valueOf();if(null!=c&&c!==e)return i.from(c,a,t);const f=function(e){if(i.isBuffer(e)){const a=0|h(e.length),t=n(a);return 0===t.length||e.copy(t,0,0,a),t}return void 0!==e.length?"number"!=typeof e.length||J(e.length)?n(0):l(e):"Buffer"===e.type&&Array.isArray(e.data)?l(e.data):void 0}(e);if(f)return f;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return i.from(e[Symbol.toPrimitive]("string"),a,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function o(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function s(e){return o(e),n(e<0?0:0|h(e))}function l(e){const a=e.length<0?0:0|h(e.length),t=n(a);for(let c=0;c=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|e}function p(e,a){if(i.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Z(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const t=e.length,c=arguments.length>2&&!0===arguments[2];if(!c&&0===t)return 0;let f=!1;for(;;)switch(a){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*t;case"hex":return t>>>1;case"base64":return K(e).length;default:if(f)return c?-1:G(e).length;a=(""+a).toLowerCase(),f=!0}}function g(e,a,t){let c=!1;if((void 0===a||a<0)&&(a=0),a>this.length)return"";if((void 0===t||t>this.length)&&(t=this.length),t<=0)return"";if((t>>>=0)<=(a>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return L(this,a,t);case"utf8":case"utf-8":return C(this,a,t);case"ascii":return B(this,a,t);case"latin1":case"binary":return k(this,a,t);case"base64":return E(this,a,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,a,t);default:if(c)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),c=!0}}function m(e,a,t){const c=e[a];e[a]=e[t],e[t]=c}function x(e,a,t,c,f){if(0===e.length)return-1;if("string"==typeof t?(c=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),J(t=+t)&&(t=f?0:e.length-1),t<0&&(t=e.length+t),t>=e.length){if(f)return-1;t=e.length-1}else if(t<0){if(!f)return-1;t=0}if("string"==typeof a&&(a=i.from(a,c)),i.isBuffer(a))return 0===a.length?-1:y(e,a,t,c,f);if("number"==typeof a)return a&=255,"function"==typeof Uint8Array.prototype.indexOf?f?Uint8Array.prototype.indexOf.call(e,a,t):Uint8Array.prototype.lastIndexOf.call(e,a,t):y(e,[a],t,c,f);throw new TypeError("val must be string, number or Buffer")}function y(e,a,t,c,f){let d,r=1,n=e.length,i=a.length;if(void 0!==c&&("ucs2"===(c=String(c).toLowerCase())||"ucs-2"===c||"utf16le"===c||"utf-16le"===c)){if(e.length<2||a.length<2)return-1;r=2,n/=2,i/=2,t/=2}function b(e,a){return 1===r?e[a]:e.readUInt16BE(a*r)}if(f){let c=-1;for(d=t;dn&&(t=n-i),d=t;d>=0;d--){let t=!0;for(let c=0;cf&&(c=f):c=f;const d=a.length;let r;for(c>d/2&&(c=d/2),r=0;r>8,f=t%256,d.push(f),d.push(c);return d}(a,e.length-t),e,t,c)}function E(e,a,t){return 0===a&&t===e.length?c.fromByteArray(e):c.fromByteArray(e.slice(a,t))}function C(e,a,t){t=Math.min(e.length,t);const c=[];let f=a;for(;f239?4:a>223?3:a>191?2:1;if(f+r<=t){let t,c,n,i;switch(r){case 1:a<128&&(d=a);break;case 2:t=e[f+1],128==(192&t)&&(i=(31&a)<<6|63&t,i>127&&(d=i));break;case 3:t=e[f+1],c=e[f+2],128==(192&t)&&128==(192&c)&&(i=(15&a)<<12|(63&t)<<6|63&c,i>2047&&(i<55296||i>57343)&&(d=i));break;case 4:t=e[f+1],c=e[f+2],n=e[f+3],128==(192&t)&&128==(192&c)&&128==(192&n)&&(i=(15&a)<<18|(63&t)<<12|(63&c)<<6|63&n,i>65535&&i<1114112&&(d=i))}}null===d?(d=65533,r=1):d>65535&&(d-=65536,c.push(d>>>10&1023|55296),d=56320|1023&d),c.push(d),f+=r}return function(e){const a=e.length;if(a<=M)return String.fromCharCode.apply(String,e);let t="",c=0;for(;cc.length?(i.isBuffer(a)||(a=i.from(a)),a.copy(c,f)):Uint8Array.prototype.set.call(c,a,f);else{if(!i.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(c,f)}f+=a.length}return c},i.byteLength=p,i.prototype._isBuffer=!0,i.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let a=0;at&&(e+=" ... "),""},d&&(i.prototype[d]=i.prototype.inspect),i.prototype.compare=function(e,a,t,c,f){if(Z(e,Uint8Array)&&(e=i.from(e,e.offset,e.byteLength)),!i.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===a&&(a=0),void 0===t&&(t=e?e.length:0),void 0===c&&(c=0),void 0===f&&(f=this.length),a<0||t>e.length||c<0||f>this.length)throw new RangeError("out of range index");if(c>=f&&a>=t)return 0;if(c>=f)return-1;if(a>=t)return 1;if(this===e)return 0;let d=(f>>>=0)-(c>>>=0),r=(t>>>=0)-(a>>>=0);const n=Math.min(d,r),b=this.slice(c,f),o=e.slice(a,t);for(let e=0;e>>=0,isFinite(t)?(t>>>=0,void 0===c&&(c="utf8")):(c=t,t=void 0)}const f=this.length-a;if((void 0===t||t>f)&&(t=f),e.length>0&&(t<0||a<0)||a>this.length)throw new RangeError("Attempt to write outside buffer bounds");c||(c="utf8");let d=!1;for(;;)switch(c){case"hex":return A(this,e,a,t);case"utf8":case"utf-8":return v(this,e,a,t);case"ascii":case"latin1":case"binary":return w(this,e,a,t);case"base64":return _(this,e,a,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,a,t);default:if(d)throw new TypeError("Unknown encoding: "+c);c=(""+c).toLowerCase(),d=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const M=4096;function B(e,a,t){let c="";t=Math.min(e.length,t);for(let f=a;fc)&&(t=c);let f="";for(let c=a;ct)throw new RangeError("Trying to access beyond buffer length")}function N(e,a,t,c,f,d){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(a>f||ae.length)throw new RangeError("Index out of range")}function R(e,a,t,c,f){H(a,c,f,e,t,7);let d=Number(a&BigInt(4294967295));e[t++]=d,d>>=8,e[t++]=d,d>>=8,e[t++]=d,d>>=8,e[t++]=d;let r=Number(a>>BigInt(32)&BigInt(4294967295));return e[t++]=r,r>>=8,e[t++]=r,r>>=8,e[t++]=r,r>>=8,e[t++]=r,t}function P(e,a,t,c,f){H(a,c,f,e,t,7);let d=Number(a&BigInt(4294967295));e[t+7]=d,d>>=8,e[t+6]=d,d>>=8,e[t+5]=d,d>>=8,e[t+4]=d;let r=Number(a>>BigInt(32)&BigInt(4294967295));return e[t+3]=r,r>>=8,e[t+2]=r,r>>=8,e[t+1]=r,r>>=8,e[t]=r,t+8}function D(e,a,t,c,f,d){if(t+c>e.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function O(e,a,t,c,d){return a=+a,t>>>=0,d||D(e,0,t,4),f.write(e,a,t,c,23,4),t+4}function F(e,a,t,c,d){return a=+a,t>>>=0,d||D(e,0,t,8),f.write(e,a,t,c,52,8),t+8}i.prototype.slice=function(e,a){const t=this.length;(e=~~e)<0?(e+=t)<0&&(e=0):e>t&&(e=t),(a=void 0===a?t:~~a)<0?(a+=t)<0&&(a=0):a>t&&(a=t),a>>=0,a>>>=0,t||T(e,a,this.length);let c=this[e],f=1,d=0;for(;++d>>=0,a>>>=0,t||T(e,a,this.length);let c=this[e+--a],f=1;for(;a>0&&(f*=256);)c+=this[e+--a]*f;return c},i.prototype.readUint8=i.prototype.readUInt8=function(e,a){return e>>>=0,a||T(e,1,this.length),this[e]},i.prototype.readUint16LE=i.prototype.readUInt16LE=function(e,a){return e>>>=0,a||T(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUint16BE=i.prototype.readUInt16BE=function(e,a){return e>>>=0,a||T(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUint32LE=i.prototype.readUInt32LE=function(e,a){return e>>>=0,a||T(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUint32BE=i.prototype.readUInt32BE=function(e,a){return e>>>=0,a||T(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readBigUInt64LE=Y((function(e){q(e>>>=0,"offset");const a=this[e],t=this[e+7];void 0!==a&&void 0!==t||$(e,this.length-8);const c=a+256*this[++e]+65536*this[++e]+this[++e]*2**24,f=this[++e]+256*this[++e]+65536*this[++e]+t*2**24;return BigInt(c)+(BigInt(f)<>>=0,"offset");const a=this[e],t=this[e+7];void 0!==a&&void 0!==t||$(e,this.length-8);const c=a*2**24+65536*this[++e]+256*this[++e]+this[++e],f=this[++e]*2**24+65536*this[++e]+256*this[++e]+t;return(BigInt(c)<>>=0,a>>>=0,t||T(e,a,this.length);let c=this[e],f=1,d=0;for(;++d=f&&(c-=Math.pow(2,8*a)),c},i.prototype.readIntBE=function(e,a,t){e>>>=0,a>>>=0,t||T(e,a,this.length);let c=a,f=1,d=this[e+--c];for(;c>0&&(f*=256);)d+=this[e+--c]*f;return f*=128,d>=f&&(d-=Math.pow(2,8*a)),d},i.prototype.readInt8=function(e,a){return e>>>=0,a||T(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,a){e>>>=0,a||T(e,2,this.length);const t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},i.prototype.readInt16BE=function(e,a){e>>>=0,a||T(e,2,this.length);const t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},i.prototype.readInt32LE=function(e,a){return e>>>=0,a||T(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,a){return e>>>=0,a||T(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readBigInt64LE=Y((function(e){q(e>>>=0,"offset");const a=this[e],t=this[e+7];void 0!==a&&void 0!==t||$(e,this.length-8);const c=this[e+4]+256*this[e+5]+65536*this[e+6]+(t<<24);return(BigInt(c)<>>=0,"offset");const a=this[e],t=this[e+7];void 0!==a&&void 0!==t||$(e,this.length-8);const c=(a<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(c)<>>=0,a||T(e,4,this.length),f.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,a){return e>>>=0,a||T(e,4,this.length),f.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,a){return e>>>=0,a||T(e,8,this.length),f.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,a){return e>>>=0,a||T(e,8,this.length),f.read(this,e,!1,52,8)},i.prototype.writeUintLE=i.prototype.writeUIntLE=function(e,a,t,c){e=+e,a>>>=0,t>>>=0,c||N(this,e,a,t,Math.pow(2,8*t)-1,0);let f=1,d=0;for(this[a]=255&e;++d>>=0,t>>>=0,c||N(this,e,a,t,Math.pow(2,8*t)-1,0);let f=t-1,d=1;for(this[a+f]=255&e;--f>=0&&(d*=256);)this[a+f]=e/d&255;return a+t},i.prototype.writeUint8=i.prototype.writeUInt8=function(e,a,t){return e=+e,a>>>=0,t||N(this,e,a,1,255,0),this[a]=255&e,a+1},i.prototype.writeUint16LE=i.prototype.writeUInt16LE=function(e,a,t){return e=+e,a>>>=0,t||N(this,e,a,2,65535,0),this[a]=255&e,this[a+1]=e>>>8,a+2},i.prototype.writeUint16BE=i.prototype.writeUInt16BE=function(e,a,t){return e=+e,a>>>=0,t||N(this,e,a,2,65535,0),this[a]=e>>>8,this[a+1]=255&e,a+2},i.prototype.writeUint32LE=i.prototype.writeUInt32LE=function(e,a,t){return e=+e,a>>>=0,t||N(this,e,a,4,4294967295,0),this[a+3]=e>>>24,this[a+2]=e>>>16,this[a+1]=e>>>8,this[a]=255&e,a+4},i.prototype.writeUint32BE=i.prototype.writeUInt32BE=function(e,a,t){return e=+e,a>>>=0,t||N(this,e,a,4,4294967295,0),this[a]=e>>>24,this[a+1]=e>>>16,this[a+2]=e>>>8,this[a+3]=255&e,a+4},i.prototype.writeBigUInt64LE=Y((function(e,a=0){return R(this,e,a,BigInt(0),BigInt("0xffffffffffffffff"))})),i.prototype.writeBigUInt64BE=Y((function(e,a=0){return P(this,e,a,BigInt(0),BigInt("0xffffffffffffffff"))})),i.prototype.writeIntLE=function(e,a,t,c){if(e=+e,a>>>=0,!c){const c=Math.pow(2,8*t-1);N(this,e,a,t,c-1,-c)}let f=0,d=1,r=0;for(this[a]=255&e;++f>>=0,!c){const c=Math.pow(2,8*t-1);N(this,e,a,t,c-1,-c)}let f=t-1,d=1,r=0;for(this[a+f]=255&e;--f>=0&&(d*=256);)e<0&&0===r&&0!==this[a+f+1]&&(r=1),this[a+f]=(e/d|0)-r&255;return a+t},i.prototype.writeInt8=function(e,a,t){return e=+e,a>>>=0,t||N(this,e,a,1,127,-128),e<0&&(e=255+e+1),this[a]=255&e,a+1},i.prototype.writeInt16LE=function(e,a,t){return e=+e,a>>>=0,t||N(this,e,a,2,32767,-32768),this[a]=255&e,this[a+1]=e>>>8,a+2},i.prototype.writeInt16BE=function(e,a,t){return e=+e,a>>>=0,t||N(this,e,a,2,32767,-32768),this[a]=e>>>8,this[a+1]=255&e,a+2},i.prototype.writeInt32LE=function(e,a,t){return e=+e,a>>>=0,t||N(this,e,a,4,2147483647,-2147483648),this[a]=255&e,this[a+1]=e>>>8,this[a+2]=e>>>16,this[a+3]=e>>>24,a+4},i.prototype.writeInt32BE=function(e,a,t){return e=+e,a>>>=0,t||N(this,e,a,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[a]=e>>>24,this[a+1]=e>>>16,this[a+2]=e>>>8,this[a+3]=255&e,a+4},i.prototype.writeBigInt64LE=Y((function(e,a=0){return R(this,e,a,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),i.prototype.writeBigInt64BE=Y((function(e,a=0){return P(this,e,a,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),i.prototype.writeFloatLE=function(e,a,t){return O(this,e,a,!0,t)},i.prototype.writeFloatBE=function(e,a,t){return O(this,e,a,!1,t)},i.prototype.writeDoubleLE=function(e,a,t){return F(this,e,a,!0,t)},i.prototype.writeDoubleBE=function(e,a,t){return F(this,e,a,!1,t)},i.prototype.copy=function(e,a,t,c){if(!i.isBuffer(e))throw new TypeError("argument should be a Buffer");if(t||(t=0),c||0===c||(c=this.length),a>=e.length&&(a=e.length),a||(a=0),c>0&&c=this.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("sourceEnd out of bounds");c>this.length&&(c=this.length),e.length-a>>=0,t=void 0===t?this.length:t>>>0,e||(e=0),"number"==typeof e)for(f=a;f=c+4;t-=3)a=`_${e.slice(t-3,t)}${a}`;return`${e.slice(0,t)}${a}`}function H(e,a,t,c,f,d){if(e>t||e3?0===a||a===BigInt(0)?`>= 0${c} and < 2${c} ** ${8*(d+1)}${c}`:`>= -(2${c} ** ${8*(d+1)-1}${c}) and < 2 ** ${8*(d+1)-1}${c}`:`>= ${a}${c} and <= ${t}${c}`,new Q.ERR_OUT_OF_RANGE("value",f,e)}!function(e,a,t){q(a,"offset"),void 0!==e[a]&&void 0!==e[a+t]||$(a,e.length-(t+1))}(c,f,d)}function q(e,a){if("number"!=typeof e)throw new Q.ERR_INVALID_ARG_TYPE(a,"number",e)}function $(e,a,t){if(Math.floor(e)!==e)throw q(e,t),new Q.ERR_OUT_OF_RANGE(t||"offset","an integer",e);if(a<0)throw new Q.ERR_BUFFER_OUT_OF_BOUNDS;throw new Q.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${a}`,e)}U("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),U("ERR_INVALID_ARG_TYPE",(function(e,a){return`The "${e}" argument must be of type number. Received type ${typeof a}`}),TypeError),U("ERR_OUT_OF_RANGE",(function(e,a,t){let c=`The value of "${e}" is out of range.`,f=t;return Number.isInteger(t)&&Math.abs(t)>2**32?f=j(String(t)):"bigint"==typeof t&&(f=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(f=j(f)),f+="n"),c+=` It must be ${a}. Received ${f}`,c}),RangeError);const z=/[^+/0-9A-Za-z-_]/g;function G(e,a){let t;a=a||1/0;const c=e.length;let f=null;const d=[];for(let r=0;r55295&&t<57344){if(!f){if(t>56319){(a-=3)>-1&&d.push(239,191,189);continue}if(r+1===c){(a-=3)>-1&&d.push(239,191,189);continue}f=t;continue}if(t<56320){(a-=3)>-1&&d.push(239,191,189),f=t;continue}t=65536+(f-55296<<10|t-56320)}else f&&(a-=3)>-1&&d.push(239,191,189);if(f=null,t<128){if((a-=1)<0)break;d.push(t)}else if(t<2048){if((a-=2)<0)break;d.push(t>>6|192,63&t|128)}else if(t<65536){if((a-=3)<0)break;d.push(t>>12|224,t>>6&63|128,63&t|128)}else{if(!(t<1114112))throw new Error("Invalid code point");if((a-=4)<0)break;d.push(t>>18|240,t>>12&63|128,t>>6&63|128,63&t|128)}}return d}function K(e){return c.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function V(e,a,t,c){let f;for(f=0;f=a.length||f>=e.length);++f)a[f+t]=e[f];return f}function Z(e,a){return e instanceof a||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===a.name}function J(e){return e!=e}const W=function(){const e="0123456789abcdef",a=new Array(256);for(let t=0;t<16;++t){const c=16*t;for(let f=0;f<16;++f)a[c+f]=e[t]+e[f]}return a}();function Y(e){return"undefined"==typeof BigInt?X:e}function X(){throw new Error("BigInt not supported")}},89211:e=>{"use strict";var a=function(e){return e!=e};e.exports=function(e,t){return 0===e&&0===t?1/e==1/t:e===t||!(!a(e)||!a(t))}},37653:(e,a,t)=>{"use strict";var c=t(38452),f=t(10487),d=t(89211),r=t(9394),n=t(36576),i=f(r(),Object);c(i,{getPolyfill:r,implementation:d,shim:n}),e.exports=i},9394:(e,a,t)=>{"use strict";var c=t(89211);e.exports=function(){return"function"==typeof Object.is?Object.is:c}},36576:(e,a,t)=>{"use strict";var c=t(9394),f=t(38452);e.exports=function(){var e=c();return f(Object,{is:e},{is:function(){return Object.is!==e}}),e}},28875:(e,a,t)=>{"use strict";var c;if(!Object.keys){var f=Object.prototype.hasOwnProperty,d=Object.prototype.toString,r=t(1093),n=Object.prototype.propertyIsEnumerable,i=!n.call({toString:null},"toString"),b=n.call((function(){}),"prototype"),o=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],s=function(e){var a=e.constructor;return a&&a.prototype===e},l={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},u=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!l["$"+e]&&f.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{s(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();c=function(e){var a=null!==e&&"object"==typeof e,t="[object Function]"===d.call(e),c=r(e),n=a&&"[object String]"===d.call(e),l=[];if(!a&&!t&&!c)throw new TypeError("Object.keys called on a non-object");var h=b&&t;if(n&&e.length>0&&!f.call(e,0))for(var p=0;p0)for(var g=0;g{"use strict";var c=Array.prototype.slice,f=t(1093),d=Object.keys,r=d?function(e){return d(e)}:t(28875),n=Object.keys;r.shim=function(){if(Object.keys){var e=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);e||(Object.keys=function(e){return f(e)?n(c.call(e)):n(e)})}else Object.keys=r;return Object.keys||r},e.exports=r},1093:e=>{"use strict";var a=Object.prototype.toString;e.exports=function(e){var t=a.call(e),c="[object Arguments]"===t;return c||(c="[object Array]"!==t&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===a.call(e.callee)),c}},38403:(e,a,t)=>{"use strict";var c=t(1189),f=t(41333)(),d=t(38075),r=Object,n=d("Array.prototype.push"),i=d("Object.prototype.propertyIsEnumerable"),b=f?Object.getOwnPropertySymbols:null;e.exports=function(e,a){if(null==e)throw new TypeError("target must be an object");var t=r(e);if(1===arguments.length)return t;for(var d=1;d{"use strict";var c=t(38403);e.exports=function(){return Object.assign?function(){if(!Object.assign)return!1;for(var e="abcdefghijklmnopqrst",a=e.split(""),t={},c=0;c{"use strict";var t="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function c(e,a){return Object.prototype.hasOwnProperty.call(e,a)}a.assign=function(e){for(var a=Array.prototype.slice.call(arguments,1);a.length;){var t=a.shift();if(t){if("object"!=typeof t)throw new TypeError(t+"must be non-object");for(var f in t)c(t,f)&&(e[f]=t[f])}}return e},a.shrinkBuf=function(e,a){return e.length===a?e:e.subarray?e.subarray(0,a):(e.length=a,e)};var f={arraySet:function(e,a,t,c,f){if(a.subarray&&e.subarray)e.set(a.subarray(t,t+c),f);else for(var d=0;d{"use strict";e.exports=function(e,a,t,c){for(var f=65535&e,d=e>>>16&65535,r=0;0!==t;){t-=r=t>2e3?2e3:t;do{d=d+(f=f+a[c++]|0)|0}while(--r);f%=65521,d%=65521}return f|d<<16}},19681:e=>{"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},14823:e=>{"use strict";var a=function(){for(var e,a=[],t=0;t<256;t++){e=t;for(var c=0;c<8;c++)e=1&e?3988292384^e>>>1:e>>>1;a[t]=e}return a}();e.exports=function(e,t,c,f){var d=a,r=f+c;e^=-1;for(var n=f;n>>8^d[255&(e^t[n])];return~e}},58411:(e,a,t)=>{"use strict";var c,f=t(9805),d=t(23665),r=t(53269),n=t(14823),i=t(54674),b=-2,o=258,s=262,l=103,u=113,h=666;function p(e,a){return e.msg=i[a],a}function g(e){return(e<<1)-(e>4?9:0)}function m(e){for(var a=e.length;--a>=0;)e[a]=0}function x(e){var a=e.state,t=a.pending;t>e.avail_out&&(t=e.avail_out),0!==t&&(f.arraySet(e.output,a.pending_buf,a.pending_out,t,e.next_out),e.next_out+=t,a.pending_out+=t,e.total_out+=t,e.avail_out-=t,a.pending-=t,0===a.pending&&(a.pending_out=0))}function y(e,a){d._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,a),e.block_start=e.strstart,x(e.strm)}function A(e,a){e.pending_buf[e.pending++]=a}function v(e,a){e.pending_buf[e.pending++]=a>>>8&255,e.pending_buf[e.pending++]=255&a}function w(e,a){var t,c,f=e.max_chain_length,d=e.strstart,r=e.prev_length,n=e.nice_match,i=e.strstart>e.w_size-s?e.strstart-(e.w_size-s):0,b=e.window,l=e.w_mask,u=e.prev,h=e.strstart+o,p=b[d+r-1],g=b[d+r];e.prev_length>=e.good_match&&(f>>=2),n>e.lookahead&&(n=e.lookahead);do{if(b[(t=a)+r]===g&&b[t+r-1]===p&&b[t]===b[d]&&b[++t]===b[d+1]){d+=2,t++;do{}while(b[++d]===b[++t]&&b[++d]===b[++t]&&b[++d]===b[++t]&&b[++d]===b[++t]&&b[++d]===b[++t]&&b[++d]===b[++t]&&b[++d]===b[++t]&&b[++d]===b[++t]&&dr){if(e.match_start=a,r=c,c>=n)break;p=b[d+r-1],g=b[d+r]}}}while((a=u[a&l])>i&&0!=--f);return r<=e.lookahead?r:e.lookahead}function _(e){var a,t,c,d,i,b,o,l,u,h,p=e.w_size;do{if(d=e.window_size-e.lookahead-e.strstart,e.strstart>=p+(p-s)){f.arraySet(e.window,e.window,p,p,0),e.match_start-=p,e.strstart-=p,e.block_start-=p,a=t=e.hash_size;do{c=e.head[--a],e.head[a]=c>=p?c-p:0}while(--t);a=t=p;do{c=e.prev[--a],e.prev[a]=c>=p?c-p:0}while(--t);d+=p}if(0===e.strm.avail_in)break;if(b=e.strm,o=e.window,l=e.strstart+e.lookahead,u=d,h=void 0,(h=b.avail_in)>u&&(h=u),t=0===h?0:(b.avail_in-=h,f.arraySet(o,b.input,b.next_in,h,l),1===b.state.wrap?b.adler=r(b.adler,o,h,l):2===b.state.wrap&&(b.adler=n(b.adler,o,h,l)),b.next_in+=h,b.total_in+=h,h),e.lookahead+=t,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=3&&(e.ins_h=(e.ins_h<=3)if(c=d._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<=3&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){f=e.strstart+e.lookahead-3,c=d._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=f&&(e.ins_h=(e.ins_h<15&&(n=2,c-=16),d<1||d>9||8!==t||c<8||c>15||a<0||a>9||r<0||r>4)return p(e,b);8===c&&(c=9);var i=new M;return e.state=i,i.strm=e,i.wrap=n,i.gzhead=null,i.w_bits=c,i.w_size=1<e.pending_buf_size-5&&(t=e.pending_buf_size-5);;){if(e.lookahead<=1){if(_(e),0===e.lookahead&&0===a)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var c=e.block_start+t;if((0===e.strstart||e.strstart>=c)&&(e.lookahead=e.strstart-c,e.strstart=c,y(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-s&&(y(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===a?(y(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(y(e,!1),e.strm.avail_out),1)})),new C(4,4,8,4,I),new C(4,5,16,8,I),new C(4,6,32,32,I),new C(4,4,16,16,E),new C(8,16,32,32,E),new C(8,16,128,128,E),new C(8,32,128,256,E),new C(32,128,258,1024,E),new C(32,258,258,4096,E)],a.deflateInit=function(e,a){return L(e,a,8,15,8,0)},a.deflateInit2=L,a.deflateReset=k,a.deflateResetKeep=B,a.deflateSetHeader=function(e,a){return e&&e.state?2!==e.state.wrap?b:(e.state.gzhead=a,0):b},a.deflate=function(e,a){var t,f,r,i;if(!e||!e.state||a>5||a<0)return e?p(e,b):b;if(f=e.state,!e.output||!e.input&&0!==e.avail_in||f.status===h&&4!==a)return p(e,0===e.avail_out?-5:b);if(f.strm=e,t=f.last_flush,f.last_flush=a,42===f.status)if(2===f.wrap)e.adler=0,A(f,31),A(f,139),A(f,8),f.gzhead?(A(f,(f.gzhead.text?1:0)+(f.gzhead.hcrc?2:0)+(f.gzhead.extra?4:0)+(f.gzhead.name?8:0)+(f.gzhead.comment?16:0)),A(f,255&f.gzhead.time),A(f,f.gzhead.time>>8&255),A(f,f.gzhead.time>>16&255),A(f,f.gzhead.time>>24&255),A(f,9===f.level?2:f.strategy>=2||f.level<2?4:0),A(f,255&f.gzhead.os),f.gzhead.extra&&f.gzhead.extra.length&&(A(f,255&f.gzhead.extra.length),A(f,f.gzhead.extra.length>>8&255)),f.gzhead.hcrc&&(e.adler=n(e.adler,f.pending_buf,f.pending,0)),f.gzindex=0,f.status=69):(A(f,0),A(f,0),A(f,0),A(f,0),A(f,0),A(f,9===f.level?2:f.strategy>=2||f.level<2?4:0),A(f,3),f.status=u);else{var s=8+(f.w_bits-8<<4)<<8;s|=(f.strategy>=2||f.level<2?0:f.level<6?1:6===f.level?2:3)<<6,0!==f.strstart&&(s|=32),s+=31-s%31,f.status=u,v(f,s),0!==f.strstart&&(v(f,e.adler>>>16),v(f,65535&e.adler)),e.adler=1}if(69===f.status)if(f.gzhead.extra){for(r=f.pending;f.gzindex<(65535&f.gzhead.extra.length)&&(f.pending!==f.pending_buf_size||(f.gzhead.hcrc&&f.pending>r&&(e.adler=n(e.adler,f.pending_buf,f.pending-r,r)),x(e),r=f.pending,f.pending!==f.pending_buf_size));)A(f,255&f.gzhead.extra[f.gzindex]),f.gzindex++;f.gzhead.hcrc&&f.pending>r&&(e.adler=n(e.adler,f.pending_buf,f.pending-r,r)),f.gzindex===f.gzhead.extra.length&&(f.gzindex=0,f.status=73)}else f.status=73;if(73===f.status)if(f.gzhead.name){r=f.pending;do{if(f.pending===f.pending_buf_size&&(f.gzhead.hcrc&&f.pending>r&&(e.adler=n(e.adler,f.pending_buf,f.pending-r,r)),x(e),r=f.pending,f.pending===f.pending_buf_size)){i=1;break}i=f.gzindexr&&(e.adler=n(e.adler,f.pending_buf,f.pending-r,r)),0===i&&(f.gzindex=0,f.status=91)}else f.status=91;if(91===f.status)if(f.gzhead.comment){r=f.pending;do{if(f.pending===f.pending_buf_size&&(f.gzhead.hcrc&&f.pending>r&&(e.adler=n(e.adler,f.pending_buf,f.pending-r,r)),x(e),r=f.pending,f.pending===f.pending_buf_size)){i=1;break}i=f.gzindexr&&(e.adler=n(e.adler,f.pending_buf,f.pending-r,r)),0===i&&(f.status=l)}else f.status=l;if(f.status===l&&(f.gzhead.hcrc?(f.pending+2>f.pending_buf_size&&x(e),f.pending+2<=f.pending_buf_size&&(A(f,255&e.adler),A(f,e.adler>>8&255),e.adler=0,f.status=u)):f.status=u),0!==f.pending){if(x(e),0===e.avail_out)return f.last_flush=-1,0}else if(0===e.avail_in&&g(a)<=g(t)&&4!==a)return p(e,-5);if(f.status===h&&0!==e.avail_in)return p(e,-5);if(0!==e.avail_in||0!==f.lookahead||0!==a&&f.status!==h){var w=2===f.strategy?function(e,a){for(var t;;){if(0===e.lookahead&&(_(e),0===e.lookahead)){if(0===a)return 1;break}if(e.match_length=0,t=d._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,t&&(y(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===a?(y(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(y(e,!1),0===e.strm.avail_out)?1:2}(f,a):3===f.strategy?function(e,a){for(var t,c,f,r,n=e.window;;){if(e.lookahead<=o){if(_(e),e.lookahead<=o&&0===a)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(c=n[f=e.strstart-1])===n[++f]&&c===n[++f]&&c===n[++f]){r=e.strstart+o;do{}while(c===n[++f]&&c===n[++f]&&c===n[++f]&&c===n[++f]&&c===n[++f]&&c===n[++f]&&c===n[++f]&&c===n[++f]&&fe.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(t=d._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(t=d._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),t&&(y(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===a?(y(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(y(e,!1),0===e.strm.avail_out)?1:2}(f,a):c[f.level].func(f,a);if(3!==w&&4!==w||(f.status=h),1===w||3===w)return 0===e.avail_out&&(f.last_flush=-1),0;if(2===w&&(1===a?d._tr_align(f):5!==a&&(d._tr_stored_block(f,0,0,!1),3===a&&(m(f.head),0===f.lookahead&&(f.strstart=0,f.block_start=0,f.insert=0))),x(e),0===e.avail_out))return f.last_flush=-1,0}return 4!==a?0:f.wrap<=0?1:(2===f.wrap?(A(f,255&e.adler),A(f,e.adler>>8&255),A(f,e.adler>>16&255),A(f,e.adler>>24&255),A(f,255&e.total_in),A(f,e.total_in>>8&255),A(f,e.total_in>>16&255),A(f,e.total_in>>24&255)):(v(f,e.adler>>>16),v(f,65535&e.adler)),x(e),f.wrap>0&&(f.wrap=-f.wrap),0!==f.pending?0:1)},a.deflateEnd=function(e){var a;return e&&e.state?42!==(a=e.state.status)&&69!==a&&73!==a&&91!==a&&a!==l&&a!==u&&a!==h?p(e,b):(e.state=null,a===u?p(e,-3):0):b},a.deflateSetDictionary=function(e,a){var t,c,d,n,i,o,s,l,u=a.length;if(!e||!e.state)return b;if(2===(n=(t=e.state).wrap)||1===n&&42!==t.status||t.lookahead)return b;for(1===n&&(e.adler=r(e.adler,a,u,0)),t.wrap=0,u>=t.w_size&&(0===n&&(m(t.head),t.strstart=0,t.block_start=0,t.insert=0),l=new f.Buf8(t.w_size),f.arraySet(l,a,u-t.w_size,t.w_size,0),a=l,u=t.w_size),i=e.avail_in,o=e.next_in,s=e.input,e.avail_in=u,e.next_in=0,e.input=a,_(t);t.lookahead>=3;){c=t.strstart,d=t.lookahead-2;do{t.ins_h=(t.ins_h<{"use strict";e.exports=function(e,a){var t,c,f,d,r,n,i,b,o,s,l,u,h,p,g,m,x,y,A,v,w,_,I,E,C;t=e.state,c=e.next_in,E=e.input,f=c+(e.avail_in-5),d=e.next_out,C=e.output,r=d-(a-e.avail_out),n=d+(e.avail_out-257),i=t.dmax,b=t.wsize,o=t.whave,s=t.wnext,l=t.window,u=t.hold,h=t.bits,p=t.lencode,g=t.distcode,m=(1<>>=A=y>>>24,h-=A,0==(A=y>>>16&255))C[d++]=65535&y;else{if(!(16&A)){if(64&A){if(32&A){t.mode=12;break e}e.msg="invalid literal/length code",t.mode=30;break e}y=p[(65535&y)+(u&(1<>>=A,h-=A),h<15&&(u+=E[c++]<>>=A=y>>>24,h-=A,16&(A=y>>>16&255)){if(w=65535&y,h<(A&=15)&&(u+=E[c++]<i){e.msg="invalid distance too far back",t.mode=30;break e}if(u>>>=A,h-=A,w>(A=d-r)){if((A=w-A)>o&&t.sane){e.msg="invalid distance too far back",t.mode=30;break e}if(_=0,I=l,0===s){if(_+=b-A,A2;)C[d++]=I[_++],C[d++]=I[_++],C[d++]=I[_++],v-=3;v&&(C[d++]=I[_++],v>1&&(C[d++]=I[_++]))}else{_=d-w;do{C[d++]=C[_++],C[d++]=C[_++],C[d++]=C[_++],v-=3}while(v>2);v&&(C[d++]=C[_++],v>1&&(C[d++]=C[_++]))}break}if(64&A){e.msg="invalid distance code",t.mode=30;break e}y=g[(65535&y)+(u&(1<>3,u&=(1<<(h-=v<<3))-1,e.next_in=c,e.next_out=d,e.avail_in=c{"use strict";var c=t(9805),f=t(53269),d=t(14823),r=t(47293),n=t(21998),i=-2,b=12,o=30;function s(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function l(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new c.Buf16(320),this.work=new c.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function u(e){var a;return e&&e.state?(a=e.state,e.total_in=e.total_out=a.total=0,e.msg="",a.wrap&&(e.adler=1&a.wrap),a.mode=1,a.last=0,a.havedict=0,a.dmax=32768,a.head=null,a.hold=0,a.bits=0,a.lencode=a.lendyn=new c.Buf32(852),a.distcode=a.distdyn=new c.Buf32(592),a.sane=1,a.back=-1,0):i}function h(e){var a;return e&&e.state?((a=e.state).wsize=0,a.whave=0,a.wnext=0,u(e)):i}function p(e,a){var t,c;return e&&e.state?(c=e.state,a<0?(t=0,a=-a):(t=1+(a>>4),a<48&&(a&=15)),a&&(a<8||a>15)?i:(null!==c.window&&c.wbits!==a&&(c.window=null),c.wrap=t,c.wbits=a,h(e))):i}function g(e,a){var t,c;return e?(c=new l,e.state=c,c.window=null,0!==(t=p(e,a))&&(e.state=null),t):i}var m,x,y=!0;function A(e){if(y){var a;for(m=new c.Buf32(512),x=new c.Buf32(32),a=0;a<144;)e.lens[a++]=8;for(;a<256;)e.lens[a++]=9;for(;a<280;)e.lens[a++]=7;for(;a<288;)e.lens[a++]=8;for(n(1,e.lens,0,288,m,0,e.work,{bits:9}),a=0;a<32;)e.lens[a++]=5;n(2,e.lens,0,32,x,0,e.work,{bits:5}),y=!1}e.lencode=m,e.lenbits=9,e.distcode=x,e.distbits=5}function v(e,a,t,f){var d,r=e.state;return null===r.window&&(r.wsize=1<=r.wsize?(c.arraySet(r.window,a,t-r.wsize,r.wsize,0),r.wnext=0,r.whave=r.wsize):((d=r.wsize-r.wnext)>f&&(d=f),c.arraySet(r.window,a,t-f,d,r.wnext),(f-=d)?(c.arraySet(r.window,a,t-f,f,0),r.wnext=f,r.whave=r.wsize):(r.wnext+=d,r.wnext===r.wsize&&(r.wnext=0),r.whave>>8&255,t.check=d(t.check,F,2,0),x=0,y=0,t.mode=2;break}if(t.flags=0,t.head&&(t.head.done=!1),!(1&t.wrap)||(((255&x)<<8)+(x>>8))%31){e.msg="incorrect header check",t.mode=o;break}if(8!=(15&x)){e.msg="unknown compression method",t.mode=o;break}if(y-=4,N=8+(15&(x>>>=4)),0===t.wbits)t.wbits=N;else if(N>t.wbits){e.msg="invalid window size",t.mode=o;break}t.dmax=1<>8&1),512&t.flags&&(F[0]=255&x,F[1]=x>>>8&255,t.check=d(t.check,F,2,0)),x=0,y=0,t.mode=3;case 3:for(;y<32;){if(0===g)break e;g--,x+=l[h++]<>>8&255,F[2]=x>>>16&255,F[3]=x>>>24&255,t.check=d(t.check,F,4,0)),x=0,y=0,t.mode=4;case 4:for(;y<16;){if(0===g)break e;g--,x+=l[h++]<>8),512&t.flags&&(F[0]=255&x,F[1]=x>>>8&255,t.check=d(t.check,F,2,0)),x=0,y=0,t.mode=5;case 5:if(1024&t.flags){for(;y<16;){if(0===g)break e;g--,x+=l[h++]<>>8&255,t.check=d(t.check,F,2,0)),x=0,y=0}else t.head&&(t.head.extra=null);t.mode=6;case 6:if(1024&t.flags&&((I=t.length)>g&&(I=g),I&&(t.head&&(N=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Array(t.head.extra_len)),c.arraySet(t.head.extra,l,h,I,N)),512&t.flags&&(t.check=d(t.check,l,I,h)),g-=I,h+=I,t.length-=I),t.length))break e;t.length=0,t.mode=7;case 7:if(2048&t.flags){if(0===g)break e;I=0;do{N=l[h+I++],t.head&&N&&t.length<65536&&(t.head.name+=String.fromCharCode(N))}while(N&&I>9&1,t.head.done=!0),e.adler=t.check=0,t.mode=b;break;case 10:for(;y<32;){if(0===g)break e;g--,x+=l[h++]<>>=7&y,y-=7&y,t.mode=27;break}for(;y<3;){if(0===g)break e;g--,x+=l[h++]<>>=1)){case 0:t.mode=14;break;case 1:if(A(t),t.mode=20,6===a){x>>>=2,y-=2;break e}break;case 2:t.mode=17;break;case 3:e.msg="invalid block type",t.mode=o}x>>>=2,y-=2;break;case 14:for(x>>>=7&y,y-=7&y;y<32;){if(0===g)break e;g--,x+=l[h++]<>>16^65535)){e.msg="invalid stored block lengths",t.mode=o;break}if(t.length=65535&x,x=0,y=0,t.mode=15,6===a)break e;case 15:t.mode=16;case 16:if(I=t.length){if(I>g&&(I=g),I>m&&(I=m),0===I)break e;c.arraySet(u,l,h,I,p),g-=I,h+=I,m-=I,p+=I,t.length-=I;break}t.mode=b;break;case 17:for(;y<14;){if(0===g)break e;g--,x+=l[h++]<>>=5,y-=5,t.ndist=1+(31&x),x>>>=5,y-=5,t.ncode=4+(15&x),x>>>=4,y-=4,t.nlen>286||t.ndist>30){e.msg="too many length or distance symbols",t.mode=o;break}t.have=0,t.mode=18;case 18:for(;t.have>>=3,y-=3}for(;t.have<19;)t.lens[Q[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,P={bits:t.lenbits},R=n(0,t.lens,0,19,t.lencode,0,t.work,P),t.lenbits=P.bits,R){e.msg="invalid code lengths set",t.mode=o;break}t.have=0,t.mode=19;case 19:for(;t.have>>16&255,k=65535&O,!((M=O>>>24)<=y);){if(0===g)break e;g--,x+=l[h++]<>>=M,y-=M,t.lens[t.have++]=k;else{if(16===k){for(D=M+2;y>>=M,y-=M,0===t.have){e.msg="invalid bit length repeat",t.mode=o;break}N=t.lens[t.have-1],I=3+(3&x),x>>>=2,y-=2}else if(17===k){for(D=M+3;y>>=M)),x>>>=3,y-=3}else{for(D=M+7;y>>=M)),x>>>=7,y-=7}if(t.have+I>t.nlen+t.ndist){e.msg="invalid bit length repeat",t.mode=o;break}for(;I--;)t.lens[t.have++]=N}}if(t.mode===o)break;if(0===t.lens[256]){e.msg="invalid code -- missing end-of-block",t.mode=o;break}if(t.lenbits=9,P={bits:t.lenbits},R=n(1,t.lens,0,t.nlen,t.lencode,0,t.work,P),t.lenbits=P.bits,R){e.msg="invalid literal/lengths set",t.mode=o;break}if(t.distbits=6,t.distcode=t.distdyn,P={bits:t.distbits},R=n(2,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,P),t.distbits=P.bits,R){e.msg="invalid distances set",t.mode=o;break}if(t.mode=20,6===a)break e;case 20:t.mode=21;case 21:if(g>=6&&m>=258){e.next_out=p,e.avail_out=m,e.next_in=h,e.avail_in=g,t.hold=x,t.bits=y,r(e,_),p=e.next_out,u=e.output,m=e.avail_out,h=e.next_in,l=e.input,g=e.avail_in,x=t.hold,y=t.bits,t.mode===b&&(t.back=-1);break}for(t.back=0;B=(O=t.lencode[x&(1<>>16&255,k=65535&O,!((M=O>>>24)<=y);){if(0===g)break e;g--,x+=l[h++]<>L)])>>>16&255,k=65535&O,!(L+(M=O>>>24)<=y);){if(0===g)break e;g--,x+=l[h++]<>>=L,y-=L,t.back+=L}if(x>>>=M,y-=M,t.back+=M,t.length=k,0===B){t.mode=26;break}if(32&B){t.back=-1,t.mode=b;break}if(64&B){e.msg="invalid literal/length code",t.mode=o;break}t.extra=15&B,t.mode=22;case 22:if(t.extra){for(D=t.extra;y>>=t.extra,y-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=23;case 23:for(;B=(O=t.distcode[x&(1<>>16&255,k=65535&O,!((M=O>>>24)<=y);){if(0===g)break e;g--,x+=l[h++]<>L)])>>>16&255,k=65535&O,!(L+(M=O>>>24)<=y);){if(0===g)break e;g--,x+=l[h++]<>>=L,y-=L,t.back+=L}if(x>>>=M,y-=M,t.back+=M,64&B){e.msg="invalid distance code",t.mode=o;break}t.offset=k,t.extra=15&B,t.mode=24;case 24:if(t.extra){for(D=t.extra;y>>=t.extra,y-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){e.msg="invalid distance too far back",t.mode=o;break}t.mode=25;case 25:if(0===m)break e;if(I=_-m,t.offset>I){if((I=t.offset-I)>t.whave&&t.sane){e.msg="invalid distance too far back",t.mode=o;break}I>t.wnext?(I-=t.wnext,E=t.wsize-I):E=t.wnext-I,I>t.length&&(I=t.length),C=t.window}else C=u,E=p-t.offset,I=t.length;I>m&&(I=m),m-=I,t.length-=I;do{u[p++]=C[E++]}while(--I);0===t.length&&(t.mode=21);break;case 26:if(0===m)break e;u[p++]=t.length,m--,t.mode=21;break;case 27:if(t.wrap){for(;y<32;){if(0===g)break e;g--,x|=l[h++]<{"use strict";var c=t(9805),f=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],d=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],r=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],n=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];e.exports=function(e,a,t,i,b,o,s,l){var u,h,p,g,m,x,y,A,v,w=l.bits,_=0,I=0,E=0,C=0,M=0,B=0,k=0,L=0,S=0,T=0,N=null,R=0,P=new c.Buf16(16),D=new c.Buf16(16),O=null,F=0;for(_=0;_<=15;_++)P[_]=0;for(I=0;I=1&&0===P[C];C--);if(M>C&&(M=C),0===C)return b[o++]=20971520,b[o++]=20971520,l.bits=1,0;for(E=1;E0&&(0===e||1!==C))return-1;for(D[1]=0,_=1;_<15;_++)D[_+1]=D[_]+P[_];for(I=0;I852||2===e&&S>592)return 1;for(;;){y=_-k,s[I]x?(A=O[F+s[I]],v=N[R+s[I]]):(A=96,v=0),u=1<<_-k,E=h=1<>k)+(h-=u)]=y<<24|A<<16|v}while(0!==h);for(u=1<<_-1;T&u;)u>>=1;if(0!==u?(T&=u-1,T+=u):T=0,I++,0==--P[_]){if(_===C)break;_=a[t+s[I]]}if(_>M&&(T&g)!==p){for(0===k&&(k=M),m+=E,L=1<<(B=_-k);B+k852||2===e&&S>592)return 1;b[p=T&g]=M<<24|B<<16|m-o}}return 0!==T&&(b[m+T]=_-k<<24|64<<16),l.bits=M,0}},54674:e=>{"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},23665:(e,a,t)=>{"use strict";var c=t(9805);function f(e){for(var a=e.length;--a>=0;)e[a]=0}var d=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],r=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],i=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],b=new Array(576);f(b);var o=new Array(60);f(o);var s=new Array(512);f(s);var l=new Array(256);f(l);var u=new Array(29);f(u);var h,p,g,m=new Array(30);function x(e,a,t,c,f){this.static_tree=e,this.extra_bits=a,this.extra_base=t,this.elems=c,this.max_length=f,this.has_stree=e&&e.length}function y(e,a){this.dyn_tree=e,this.max_code=0,this.stat_desc=a}function A(e){return e<256?s[e]:s[256+(e>>>7)]}function v(e,a){e.pending_buf[e.pending++]=255&a,e.pending_buf[e.pending++]=a>>>8&255}function w(e,a,t){e.bi_valid>16-t?(e.bi_buf|=a<>16-e.bi_valid,e.bi_valid+=t-16):(e.bi_buf|=a<>>=1,t<<=1}while(--a>0);return t>>>1}function E(e,a,t){var c,f,d=new Array(16),r=0;for(c=1;c<=15;c++)d[c]=r=r+t[c-1]<<1;for(f=0;f<=a;f++){var n=e[2*f+1];0!==n&&(e[2*f]=I(d[n]++,n))}}function C(e){var a;for(a=0;a<286;a++)e.dyn_ltree[2*a]=0;for(a=0;a<30;a++)e.dyn_dtree[2*a]=0;for(a=0;a<19;a++)e.bl_tree[2*a]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function M(e){e.bi_valid>8?v(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function B(e,a,t,c){var f=2*a,d=2*t;return e[f]>1;t>=1;t--)k(e,d,t);f=i;do{t=e.heap[1],e.heap[1]=e.heap[e.heap_len--],k(e,d,1),c=e.heap[1],e.heap[--e.heap_max]=t,e.heap[--e.heap_max]=c,d[2*f]=d[2*t]+d[2*c],e.depth[f]=(e.depth[t]>=e.depth[c]?e.depth[t]:e.depth[c])+1,d[2*t+1]=d[2*c+1]=f,e.heap[1]=f++,k(e,d,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,a){var t,c,f,d,r,n,i=a.dyn_tree,b=a.max_code,o=a.stat_desc.static_tree,s=a.stat_desc.has_stree,l=a.stat_desc.extra_bits,u=a.stat_desc.extra_base,h=a.stat_desc.max_length,p=0;for(d=0;d<=15;d++)e.bl_count[d]=0;for(i[2*e.heap[e.heap_max]+1]=0,t=e.heap_max+1;t<573;t++)(d=i[2*i[2*(c=e.heap[t])+1]+1]+1)>h&&(d=h,p++),i[2*c+1]=d,c>b||(e.bl_count[d]++,r=0,c>=u&&(r=l[c-u]),n=i[2*c],e.opt_len+=n*(d+r),s&&(e.static_len+=n*(o[2*c+1]+r)));if(0!==p){do{for(d=h-1;0===e.bl_count[d];)d--;e.bl_count[d]--,e.bl_count[d+1]+=2,e.bl_count[h]--,p-=2}while(p>0);for(d=h;0!==d;d--)for(c=e.bl_count[d];0!==c;)(f=e.heap[--t])>b||(i[2*f+1]!==d&&(e.opt_len+=(d-i[2*f+1])*i[2*f],i[2*f+1]=d),c--)}}(e,a),E(d,b,e.bl_count)}function T(e,a,t){var c,f,d=-1,r=a[1],n=0,i=7,b=4;for(0===r&&(i=138,b=3),a[2*(t+1)+1]=65535,c=0;c<=t;c++)f=r,r=a[2*(c+1)+1],++n>=7;c<30;c++)for(m[c]=f<<7,e=0;e<1<0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var a,t=4093624447;for(a=0;a<=31;a++,t>>>=1)if(1&t&&0!==e.dyn_ltree[2*a])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(a=32;a<256;a++)if(0!==e.dyn_ltree[2*a])return 1;return 0}(e)),S(e,e.l_desc),S(e,e.d_desc),r=function(e){var a;for(T(e,e.dyn_ltree,e.l_desc.max_code),T(e,e.dyn_dtree,e.d_desc.max_code),S(e,e.bl_desc),a=18;a>=3&&0===e.bl_tree[2*i[a]+1];a--);return e.opt_len+=3*(a+1)+5+5+4,a}(e),f=e.opt_len+3+7>>>3,(d=e.static_len+3+7>>>3)<=f&&(f=d)):f=d=t+5,t+4<=f&&-1!==a?P(e,a,t,c):4===e.strategy||d===f?(w(e,2+(c?1:0),3),L(e,b,o)):(w(e,4+(c?1:0),3),function(e,a,t,c){var f;for(w(e,a-257,5),w(e,t-1,5),w(e,c-4,4),f=0;f>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&a,e.pending_buf[e.l_buf+e.last_lit]=255&t,e.last_lit++,0===a?e.dyn_ltree[2*t]++:(e.matches++,a--,e.dyn_ltree[2*(l[t]+256+1)]++,e.dyn_dtree[2*A(a)]++),e.last_lit===e.lit_bufsize-1},a._tr_align=function(e){w(e,2,3),_(e,256,b),function(e){16===e.bi_valid?(v(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},44442:e=>{"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},21137:(e,a,t)=>{"use strict";var c=t(87568);a.certificate=t(36413);var f=c.define("RSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}));a.RSAPrivateKey=f;var d=c.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));a.RSAPublicKey=d;var r=c.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())})),n=c.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(r),this.key("subjectPublicKey").bitstr())}));a.PublicKey=n;var i=c.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(r),this.key("subjectPrivateKey").octstr())}));a.PrivateKey=i;var b=c.define("EncryptedPrivateKeyInfo",(function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())}));a.EncryptedPrivateKey=b;var o=c.define("DSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())}));a.DSAPrivateKey=o,a.DSAparam=c.define("DSAparam",(function(){this.int()}));var s=c.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})})),l=c.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(s),this.key("publicKey").optional().explicit(1).bitstr())}));a.ECPrivateKey=l,a.signature=c.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())}))},36413:(e,a,t)=>{"use strict";var c=t(87568),f=c.define("Time",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),d=c.define("AttributeTypeValue",(function(){this.seq().obj(this.key("type").objid(),this.key("value").any())})),r=c.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())})),n=c.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(r),this.key("subjectPublicKey").bitstr())})),i=c.define("RelativeDistinguishedName",(function(){this.setof(d)})),b=c.define("RDNSequence",(function(){this.seqof(i)})),o=c.define("Name",(function(){this.choice({rdnSequence:this.use(b)})})),s=c.define("Validity",(function(){this.seq().obj(this.key("notBefore").use(f),this.key("notAfter").use(f))})),l=c.define("Extension",(function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())})),u=c.define("TBSCertificate",(function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(r),this.key("issuer").use(o),this.key("validity").use(s),this.key("subject").use(o),this.key("subjectPublicKeyInfo").use(n),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(l).optional())})),h=c.define("X509Certificate",(function(){this.seq().obj(this.key("tbsCertificate").use(u),this.key("signatureAlgorithm").use(r),this.key("signatureValue").bitstr())}));e.exports=h},24101:(e,a,t)=>{"use strict";var c=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,f=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,d=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,r=t(68078),n=t(1241),i=t(92861).Buffer;e.exports=function(e,a){var t,b=e.toString(),o=b.match(c);if(o){var s="aes"+o[1],l=i.from(o[2],"hex"),u=i.from(o[3].replace(/[\r\n]/g,""),"base64"),h=r(a,l.slice(0,8),parseInt(o[1],10)).key,p=[],g=n.createDecipheriv(s,h,l);p.push(g.update(u)),p.push(g.final()),t=i.concat(p)}else{var m=b.match(d);t=i.from(m[2].replace(/[\r\n]/g,""),"base64")}return{tag:b.match(f)[1],data:t}}},78170:(e,a,t)=>{"use strict";var c=t(21137),f=t(15579),d=t(24101),r=t(1241),n=t(78396),i=t(92861).Buffer;function b(e){var a;"object"!=typeof e||i.isBuffer(e)||(a=e.passphrase,e=e.key),"string"==typeof e&&(e=i.from(e));var t,b,o=d(e,a),s=o.tag,l=o.data;switch(s){case"CERTIFICATE":b=c.certificate.decode(l,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(b||(b=c.PublicKey.decode(l,"der")),t=b.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return c.RSAPublicKey.decode(b.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return b.subjectPrivateKey=b.subjectPublicKey,{type:"ec",data:b};case"1.2.840.10040.4.1":return b.algorithm.params.pub_key=c.DSAparam.decode(b.subjectPublicKey.data,"der"),{type:"dsa",data:b.algorithm.params};default:throw new Error("unknown key id "+t)}case"ENCRYPTED PRIVATE KEY":l=function(e,a){var t=e.algorithm.decrypt.kde.kdeparams.salt,c=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),d=f[e.algorithm.decrypt.cipher.algo.join(".")],b=e.algorithm.decrypt.cipher.iv,o=e.subjectPrivateKey,s=parseInt(d.split("-")[1],10)/8,l=n.pbkdf2Sync(a,t,c,s,"sha1"),u=r.createDecipheriv(d,l,b),h=[];return h.push(u.update(o)),h.push(u.final()),i.concat(h)}(l=c.EncryptedPrivateKey.decode(l,"der"),a);case"PRIVATE KEY":switch(t=(b=c.PrivateKey.decode(l,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return c.RSAPrivateKey.decode(b.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:b.algorithm.curve,privateKey:c.ECPrivateKey.decode(b.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return b.algorithm.params.priv_key=c.DSAparam.decode(b.subjectPrivateKey,"der"),{type:"dsa",params:b.algorithm.params};default:throw new Error("unknown key id "+t)}case"RSA PUBLIC KEY":return c.RSAPublicKey.decode(l,"der");case"RSA PRIVATE KEY":return c.RSAPrivateKey.decode(l,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:c.DSAPrivateKey.decode(l,"der")};case"EC PRIVATE KEY":return{curve:(l=c.ECPrivateKey.decode(l,"der")).parameters.value,privateKey:l.privateKey};default:throw new Error("unknown key type "+s)}}b.signature=c.signature,e.exports=b},78396:(e,a,t)=>{a.pbkdf2=t(43832),a.pbkdf2Sync=t(21352)},43832:(e,a,t)=>{var c,f,d=t(92861).Buffer,r=t(64196),n=t(2455),i=t(21352),b=t(93382),o=t.g.crypto&&t.g.crypto.subtle,s={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},l=[];function u(){return f||(f=t.g.process&&t.g.process.nextTick?t.g.process.nextTick:t.g.queueMicrotask?t.g.queueMicrotask:t.g.setImmediate?t.g.setImmediate:t.g.setTimeout)}function h(e,a,t,c,f){return o.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]).then((function(e){return o.deriveBits({name:"PBKDF2",salt:a,iterations:t,hash:{name:f}},e,c<<3)})).then((function(e){return d.from(e)}))}e.exports=function(e,a,f,p,g,m){"function"==typeof g&&(m=g,g=void 0);var x=s[(g=g||"sha1").toLowerCase()];if(x&&"function"==typeof t.g.Promise){if(r(f,p),e=b(e,n,"Password"),a=b(a,n,"Salt"),"function"!=typeof m)throw new Error("No callback provided to pbkdf2");!function(e,a){e.then((function(e){u()((function(){a(null,e)}))}),(function(e){u()((function(){a(e)}))}))}(function(e){if(t.g.process&&!t.g.process.browser)return Promise.resolve(!1);if(!o||!o.importKey||!o.deriveBits)return Promise.resolve(!1);if(void 0!==l[e])return l[e];var a=h(c=c||d.alloc(8),c,10,128,e).then((function(){return!0})).catch((function(){return!1}));return l[e]=a,a}(x).then((function(t){return t?h(e,a,f,p,x):i(e,a,f,p,g)})),m)}else u()((function(){var t;try{t=i(e,a,f,p,g)}catch(e){return m(e)}m(null,t)}))}},2455:(e,a,t)=>{var c;c=t.g.process&&t.g.process.browser?"utf-8":t.g.process&&t.g.process.version?parseInt(process.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary":"utf-8",e.exports=c},64196:e=>{var a=Math.pow(2,30)-1;e.exports=function(e,t){if("number"!=typeof e)throw new TypeError("Iterations not a number");if(e<0)throw new TypeError("Bad iterations");if("number"!=typeof t)throw new TypeError("Key length not a number");if(t<0||t>a||t!=t)throw new TypeError("Bad key length")}},21352:(e,a,t)=>{var c=t(20320),f=t(66011),d=t(62802),r=t(92861).Buffer,n=t(64196),i=t(2455),b=t(93382),o=r.alloc(128),s={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function l(e,a,t){var n=function(e){return"rmd160"===e||"ripemd160"===e?function(e){return(new f).update(e).digest()}:"md5"===e?c:function(a){return d(e).update(a).digest()}}(e),i="sha512"===e||"sha384"===e?128:64;a.length>i?a=n(a):a.length{var c=t(92861).Buffer;e.exports=function(e,a,t){if(c.isBuffer(e))return e;if("string"==typeof e)return c.from(e,a);if(ArrayBuffer.isView(e))return c.from(e.buffer);throw new TypeError(t+" must be a string, a Buffer, a typed array or a DataView")}},71843:(e,a,t)=>{"use strict";const{ErrorWithCause:c}=t(75832),{findCauseByReference:f,getErrorCause:d,messageWithCauses:r,stackWithCauses:n}=t(94306);e.exports={ErrorWithCause:c,findCauseByReference:f,getErrorCause:d,stackWithCauses:n,messageWithCauses:r}},75832:e=>{"use strict";class a extends Error{constructor(e,{cause:t}={}){super(e),this.name=a.name,t&&(this.cause=t),this.message=e}}e.exports={ErrorWithCause:a}},94306:e=>{"use strict";const a=e=>{if(e&&"object"==typeof e&&"cause"in e){if("function"==typeof e.cause){const a=e.cause();return a instanceof Error?a:void 0}return e.cause instanceof Error?e.cause:void 0}},t=(e,c)=>{if(!(e instanceof Error))return"";const f=e.stack||"";if(c.has(e))return f+"\ncauses have become circular...";const d=a(e);return d?(c.add(e),f+"\ncaused by: "+t(d,c)):f},c=(e,t,f)=>{if(!(e instanceof Error))return"";const d=f?"":e.message||"";if(t.has(e))return d+": ...";const r=a(e);if(r){t.add(e);const a="cause"in e&&"function"==typeof e.cause;return d+(a?"":": ")+c(r,t,a)}return d};e.exports={findCauseByReference:(e,t)=>{if(!e||!t)return;if(!(e instanceof Error))return;if(!(t.prototype instanceof Error)&&t!==Error)return;const c=new Set;let f=e;for(;f&&!c.has(f);){if(c.add(f),f instanceof t)return f;f=a(f)}},getErrorCause:a,stackWithCauses:e=>t(e,new Set),messageWithCauses:e=>c(e,new Set)}},76578:e=>{"use strict";e.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]},33225:e=>{"use strict";"undefined"==typeof process||!process.version||0===process.version.indexOf("v0.")||0===process.version.indexOf("v1.")&&0!==process.version.indexOf("v1.8.")?e.exports={nextTick:function(e,a,t,c){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var f,d,r=arguments.length;switch(r){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick((function(){e.call(null,a)}));case 3:return process.nextTick((function(){e.call(null,a,t)}));case 4:return process.nextTick((function(){e.call(null,a,t,c)}));default:for(f=new Array(r-1),d=0;d{a.publicEncrypt=t(28902),a.privateDecrypt=t(77362),a.privateEncrypt=function(e,t){return a.publicEncrypt(e,t,!0)},a.publicDecrypt=function(e,t){return a.privateDecrypt(e,t,!0)}},48206:(e,a,t)=>{var c=t(47108),f=t(92861).Buffer;function d(e){var a=f.allocUnsafe(4);return a.writeUInt32BE(e,0),a}e.exports=function(e,a){for(var t,r=f.alloc(0),n=0;r.length=65&&t<=70?t-55:t>=97&&t<=102?t-87:t-48&15}function i(e,a,t){var c=n(e,t);return t-1>=a&&(c|=n(e,t-1)<<4),c}function b(e,a,t,c){for(var f=0,d=Math.min(e.length,t),r=a;r=49?n-49+10:n>=17?n-17+10:n}return f}d.isBN=function(e){return e instanceof d||null!==e&&"object"==typeof e&&e.constructor.wordSize===d.wordSize&&Array.isArray(e.words)},d.max=function(e,a){return e.cmp(a)>0?e:a},d.min=function(e,a){return e.cmp(a)<0?e:a},d.prototype._init=function(e,a,t){if("number"==typeof e)return this._initNumber(e,a,t);if("object"==typeof e)return this._initArray(e,a,t);"hex"===a&&(a=16),c(a===(0|a)&&a>=2&&a<=36);var f=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(f++,this.negative=1),f=0;f-=3)r=e[f]|e[f-1]<<8|e[f-2]<<16,this.words[d]|=r<>>26-n&67108863,(n+=24)>=26&&(n-=26,d++);else if("le"===t)for(f=0,d=0;f>>26-n&67108863,(n+=24)>=26&&(n-=26,d++);return this.strip()},d.prototype._parseHex=function(e,a,t){this.length=Math.ceil((e.length-a)/6),this.words=new Array(this.length);for(var c=0;c=a;c-=2)f=i(e,a,c)<=18?(d-=18,r+=1,this.words[r]|=f>>>26):d+=8;else for(c=(e.length-a)%2==0?a+1:a;c=18?(d-=18,r+=1,this.words[r]|=f>>>26):d+=8;this.strip()},d.prototype._parseBase=function(e,a,t){this.words=[0],this.length=1;for(var c=0,f=1;f<=67108863;f*=a)c++;c--,f=f/a|0;for(var d=e.length-t,r=d%c,n=Math.min(d,d-r)+t,i=0,o=t;o1&&0===this.words[this.length-1];)this.length--;return this._normSign()},d.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},d.prototype.inspect=function(){return(this.red?""};var o=["","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"],s=[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],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function u(e,a,t){t.negative=a.negative^e.negative;var c=e.length+a.length|0;t.length=c,c=c-1|0;var f=0|e.words[0],d=0|a.words[0],r=f*d,n=67108863&r,i=r/67108864|0;t.words[0]=n;for(var b=1;b>>26,s=67108863&i,l=Math.min(b,a.length-1),u=Math.max(0,b-e.length+1);u<=l;u++){var h=b-u|0;o+=(r=(f=0|e.words[h])*(d=0|a.words[u])+s)/67108864|0,s=67108863&r}t.words[b]=0|s,i=0|o}return 0!==i?t.words[b]=0|i:t.length--,t.strip()}d.prototype.toString=function(e,a){var t;if(a=0|a||1,16===(e=e||10)||"hex"===e){t="";for(var f=0,d=0,r=0;r>>24-f&16777215)||r!==this.length-1?o[6-i.length]+i+t:i+t,(f+=2)>=26&&(f-=26,r--)}for(0!==d&&(t=d.toString(16)+t);t.length%a!=0;)t="0"+t;return 0!==this.negative&&(t="-"+t),t}if(e===(0|e)&&e>=2&&e<=36){var b=s[e],u=l[e];t="";var h=this.clone();for(h.negative=0;!h.isZero();){var p=h.modn(u).toString(e);t=(h=h.idivn(u)).isZero()?p+t:o[b-p.length]+p+t}for(this.isZero()&&(t="0"+t);t.length%a!=0;)t="0"+t;return 0!==this.negative&&(t="-"+t),t}c(!1,"Base should be between 2 and 36")},d.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&c(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},d.prototype.toJSON=function(){return this.toString(16)},d.prototype.toBuffer=function(e,a){return c(void 0!==r),this.toArrayLike(r,e,a)},d.prototype.toArray=function(e,a){return this.toArrayLike(Array,e,a)},d.prototype.toArrayLike=function(e,a,t){var f=this.byteLength(),d=t||Math.max(1,f);c(f<=d,"byte array longer than desired length"),c(d>0,"Requested array length <= 0"),this.strip();var r,n,i="le"===a,b=new e(d),o=this.clone();if(i){for(n=0;!o.isZero();n++)r=o.andln(255),o.iushrn(8),b[n]=r;for(;n=4096&&(t+=13,a>>>=13),a>=64&&(t+=7,a>>>=7),a>=8&&(t+=4,a>>>=4),a>=2&&(t+=2,a>>>=2),t+a},d.prototype._zeroBits=function(e){if(0===e)return 26;var a=e,t=0;return 8191&a||(t+=13,a>>>=13),127&a||(t+=7,a>>>=7),15&a||(t+=4,a>>>=4),3&a||(t+=2,a>>>=2),1&a||t++,t},d.prototype.bitLength=function(){var e=this.words[this.length-1],a=this._countBits(e);return 26*(this.length-1)+a},d.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,a=0;ae.length?this.clone().ior(e):e.clone().ior(this)},d.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},d.prototype.iuand=function(e){var a;a=this.length>e.length?e:this;for(var t=0;te.length?this.clone().iand(e):e.clone().iand(this)},d.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},d.prototype.iuxor=function(e){var a,t;this.length>e.length?(a=this,t=e):(a=e,t=this);for(var c=0;ce.length?this.clone().ixor(e):e.clone().ixor(this)},d.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},d.prototype.inotn=function(e){c("number"==typeof e&&e>=0);var a=0|Math.ceil(e/26),t=e%26;this._expand(a),t>0&&a--;for(var f=0;f0&&(this.words[f]=~this.words[f]&67108863>>26-t),this.strip()},d.prototype.notn=function(e){return this.clone().inotn(e)},d.prototype.setn=function(e,a){c("number"==typeof e&&e>=0);var t=e/26|0,f=e%26;return this._expand(t+1),this.words[t]=a?this.words[t]|1<e.length?(t=this,c=e):(t=e,c=this);for(var f=0,d=0;d>>26;for(;0!==f&&d>>26;if(this.length=t.length,0!==f)this.words[this.length]=f,this.length++;else if(t!==this)for(;de.length?this.clone().iadd(e):e.clone().iadd(this)},d.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var a=this.iadd(e);return e.negative=1,a._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var t,c,f=this.cmp(e);if(0===f)return this.negative=0,this.length=1,this.words[0]=0,this;f>0?(t=this,c=e):(t=e,c=this);for(var d=0,r=0;r>26,this.words[r]=67108863&a;for(;0!==d&&r>26,this.words[r]=67108863&a;if(0===d&&r>>13,u=0|r[1],h=8191&u,p=u>>>13,g=0|r[2],m=8191&g,x=g>>>13,y=0|r[3],A=8191&y,v=y>>>13,w=0|r[4],_=8191&w,I=w>>>13,E=0|r[5],C=8191&E,M=E>>>13,B=0|r[6],k=8191&B,L=B>>>13,S=0|r[7],T=8191&S,N=S>>>13,R=0|r[8],P=8191&R,D=R>>>13,O=0|r[9],F=8191&O,Q=O>>>13,U=0|n[0],j=8191&U,H=U>>>13,q=0|n[1],$=8191&q,z=q>>>13,G=0|n[2],K=8191&G,V=G>>>13,Z=0|n[3],J=8191&Z,W=Z>>>13,Y=0|n[4],X=8191&Y,ee=Y>>>13,ae=0|n[5],te=8191&ae,ce=ae>>>13,fe=0|n[6],de=8191&fe,re=fe>>>13,ne=0|n[7],ie=8191&ne,be=ne>>>13,oe=0|n[8],se=8191&oe,le=oe>>>13,ue=0|n[9],he=8191&ue,pe=ue>>>13;t.negative=e.negative^a.negative,t.length=19;var ge=(b+(c=Math.imul(s,j))|0)+((8191&(f=(f=Math.imul(s,H))+Math.imul(l,j)|0))<<13)|0;b=((d=Math.imul(l,H))+(f>>>13)|0)+(ge>>>26)|0,ge&=67108863,c=Math.imul(h,j),f=(f=Math.imul(h,H))+Math.imul(p,j)|0,d=Math.imul(p,H);var me=(b+(c=c+Math.imul(s,$)|0)|0)+((8191&(f=(f=f+Math.imul(s,z)|0)+Math.imul(l,$)|0))<<13)|0;b=((d=d+Math.imul(l,z)|0)+(f>>>13)|0)+(me>>>26)|0,me&=67108863,c=Math.imul(m,j),f=(f=Math.imul(m,H))+Math.imul(x,j)|0,d=Math.imul(x,H),c=c+Math.imul(h,$)|0,f=(f=f+Math.imul(h,z)|0)+Math.imul(p,$)|0,d=d+Math.imul(p,z)|0;var xe=(b+(c=c+Math.imul(s,K)|0)|0)+((8191&(f=(f=f+Math.imul(s,V)|0)+Math.imul(l,K)|0))<<13)|0;b=((d=d+Math.imul(l,V)|0)+(f>>>13)|0)+(xe>>>26)|0,xe&=67108863,c=Math.imul(A,j),f=(f=Math.imul(A,H))+Math.imul(v,j)|0,d=Math.imul(v,H),c=c+Math.imul(m,$)|0,f=(f=f+Math.imul(m,z)|0)+Math.imul(x,$)|0,d=d+Math.imul(x,z)|0,c=c+Math.imul(h,K)|0,f=(f=f+Math.imul(h,V)|0)+Math.imul(p,K)|0,d=d+Math.imul(p,V)|0;var ye=(b+(c=c+Math.imul(s,J)|0)|0)+((8191&(f=(f=f+Math.imul(s,W)|0)+Math.imul(l,J)|0))<<13)|0;b=((d=d+Math.imul(l,W)|0)+(f>>>13)|0)+(ye>>>26)|0,ye&=67108863,c=Math.imul(_,j),f=(f=Math.imul(_,H))+Math.imul(I,j)|0,d=Math.imul(I,H),c=c+Math.imul(A,$)|0,f=(f=f+Math.imul(A,z)|0)+Math.imul(v,$)|0,d=d+Math.imul(v,z)|0,c=c+Math.imul(m,K)|0,f=(f=f+Math.imul(m,V)|0)+Math.imul(x,K)|0,d=d+Math.imul(x,V)|0,c=c+Math.imul(h,J)|0,f=(f=f+Math.imul(h,W)|0)+Math.imul(p,J)|0,d=d+Math.imul(p,W)|0;var Ae=(b+(c=c+Math.imul(s,X)|0)|0)+((8191&(f=(f=f+Math.imul(s,ee)|0)+Math.imul(l,X)|0))<<13)|0;b=((d=d+Math.imul(l,ee)|0)+(f>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,c=Math.imul(C,j),f=(f=Math.imul(C,H))+Math.imul(M,j)|0,d=Math.imul(M,H),c=c+Math.imul(_,$)|0,f=(f=f+Math.imul(_,z)|0)+Math.imul(I,$)|0,d=d+Math.imul(I,z)|0,c=c+Math.imul(A,K)|0,f=(f=f+Math.imul(A,V)|0)+Math.imul(v,K)|0,d=d+Math.imul(v,V)|0,c=c+Math.imul(m,J)|0,f=(f=f+Math.imul(m,W)|0)+Math.imul(x,J)|0,d=d+Math.imul(x,W)|0,c=c+Math.imul(h,X)|0,f=(f=f+Math.imul(h,ee)|0)+Math.imul(p,X)|0,d=d+Math.imul(p,ee)|0;var ve=(b+(c=c+Math.imul(s,te)|0)|0)+((8191&(f=(f=f+Math.imul(s,ce)|0)+Math.imul(l,te)|0))<<13)|0;b=((d=d+Math.imul(l,ce)|0)+(f>>>13)|0)+(ve>>>26)|0,ve&=67108863,c=Math.imul(k,j),f=(f=Math.imul(k,H))+Math.imul(L,j)|0,d=Math.imul(L,H),c=c+Math.imul(C,$)|0,f=(f=f+Math.imul(C,z)|0)+Math.imul(M,$)|0,d=d+Math.imul(M,z)|0,c=c+Math.imul(_,K)|0,f=(f=f+Math.imul(_,V)|0)+Math.imul(I,K)|0,d=d+Math.imul(I,V)|0,c=c+Math.imul(A,J)|0,f=(f=f+Math.imul(A,W)|0)+Math.imul(v,J)|0,d=d+Math.imul(v,W)|0,c=c+Math.imul(m,X)|0,f=(f=f+Math.imul(m,ee)|0)+Math.imul(x,X)|0,d=d+Math.imul(x,ee)|0,c=c+Math.imul(h,te)|0,f=(f=f+Math.imul(h,ce)|0)+Math.imul(p,te)|0,d=d+Math.imul(p,ce)|0;var we=(b+(c=c+Math.imul(s,de)|0)|0)+((8191&(f=(f=f+Math.imul(s,re)|0)+Math.imul(l,de)|0))<<13)|0;b=((d=d+Math.imul(l,re)|0)+(f>>>13)|0)+(we>>>26)|0,we&=67108863,c=Math.imul(T,j),f=(f=Math.imul(T,H))+Math.imul(N,j)|0,d=Math.imul(N,H),c=c+Math.imul(k,$)|0,f=(f=f+Math.imul(k,z)|0)+Math.imul(L,$)|0,d=d+Math.imul(L,z)|0,c=c+Math.imul(C,K)|0,f=(f=f+Math.imul(C,V)|0)+Math.imul(M,K)|0,d=d+Math.imul(M,V)|0,c=c+Math.imul(_,J)|0,f=(f=f+Math.imul(_,W)|0)+Math.imul(I,J)|0,d=d+Math.imul(I,W)|0,c=c+Math.imul(A,X)|0,f=(f=f+Math.imul(A,ee)|0)+Math.imul(v,X)|0,d=d+Math.imul(v,ee)|0,c=c+Math.imul(m,te)|0,f=(f=f+Math.imul(m,ce)|0)+Math.imul(x,te)|0,d=d+Math.imul(x,ce)|0,c=c+Math.imul(h,de)|0,f=(f=f+Math.imul(h,re)|0)+Math.imul(p,de)|0,d=d+Math.imul(p,re)|0;var _e=(b+(c=c+Math.imul(s,ie)|0)|0)+((8191&(f=(f=f+Math.imul(s,be)|0)+Math.imul(l,ie)|0))<<13)|0;b=((d=d+Math.imul(l,be)|0)+(f>>>13)|0)+(_e>>>26)|0,_e&=67108863,c=Math.imul(P,j),f=(f=Math.imul(P,H))+Math.imul(D,j)|0,d=Math.imul(D,H),c=c+Math.imul(T,$)|0,f=(f=f+Math.imul(T,z)|0)+Math.imul(N,$)|0,d=d+Math.imul(N,z)|0,c=c+Math.imul(k,K)|0,f=(f=f+Math.imul(k,V)|0)+Math.imul(L,K)|0,d=d+Math.imul(L,V)|0,c=c+Math.imul(C,J)|0,f=(f=f+Math.imul(C,W)|0)+Math.imul(M,J)|0,d=d+Math.imul(M,W)|0,c=c+Math.imul(_,X)|0,f=(f=f+Math.imul(_,ee)|0)+Math.imul(I,X)|0,d=d+Math.imul(I,ee)|0,c=c+Math.imul(A,te)|0,f=(f=f+Math.imul(A,ce)|0)+Math.imul(v,te)|0,d=d+Math.imul(v,ce)|0,c=c+Math.imul(m,de)|0,f=(f=f+Math.imul(m,re)|0)+Math.imul(x,de)|0,d=d+Math.imul(x,re)|0,c=c+Math.imul(h,ie)|0,f=(f=f+Math.imul(h,be)|0)+Math.imul(p,ie)|0,d=d+Math.imul(p,be)|0;var Ie=(b+(c=c+Math.imul(s,se)|0)|0)+((8191&(f=(f=f+Math.imul(s,le)|0)+Math.imul(l,se)|0))<<13)|0;b=((d=d+Math.imul(l,le)|0)+(f>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,c=Math.imul(F,j),f=(f=Math.imul(F,H))+Math.imul(Q,j)|0,d=Math.imul(Q,H),c=c+Math.imul(P,$)|0,f=(f=f+Math.imul(P,z)|0)+Math.imul(D,$)|0,d=d+Math.imul(D,z)|0,c=c+Math.imul(T,K)|0,f=(f=f+Math.imul(T,V)|0)+Math.imul(N,K)|0,d=d+Math.imul(N,V)|0,c=c+Math.imul(k,J)|0,f=(f=f+Math.imul(k,W)|0)+Math.imul(L,J)|0,d=d+Math.imul(L,W)|0,c=c+Math.imul(C,X)|0,f=(f=f+Math.imul(C,ee)|0)+Math.imul(M,X)|0,d=d+Math.imul(M,ee)|0,c=c+Math.imul(_,te)|0,f=(f=f+Math.imul(_,ce)|0)+Math.imul(I,te)|0,d=d+Math.imul(I,ce)|0,c=c+Math.imul(A,de)|0,f=(f=f+Math.imul(A,re)|0)+Math.imul(v,de)|0,d=d+Math.imul(v,re)|0,c=c+Math.imul(m,ie)|0,f=(f=f+Math.imul(m,be)|0)+Math.imul(x,ie)|0,d=d+Math.imul(x,be)|0,c=c+Math.imul(h,se)|0,f=(f=f+Math.imul(h,le)|0)+Math.imul(p,se)|0,d=d+Math.imul(p,le)|0;var Ee=(b+(c=c+Math.imul(s,he)|0)|0)+((8191&(f=(f=f+Math.imul(s,pe)|0)+Math.imul(l,he)|0))<<13)|0;b=((d=d+Math.imul(l,pe)|0)+(f>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,c=Math.imul(F,$),f=(f=Math.imul(F,z))+Math.imul(Q,$)|0,d=Math.imul(Q,z),c=c+Math.imul(P,K)|0,f=(f=f+Math.imul(P,V)|0)+Math.imul(D,K)|0,d=d+Math.imul(D,V)|0,c=c+Math.imul(T,J)|0,f=(f=f+Math.imul(T,W)|0)+Math.imul(N,J)|0,d=d+Math.imul(N,W)|0,c=c+Math.imul(k,X)|0,f=(f=f+Math.imul(k,ee)|0)+Math.imul(L,X)|0,d=d+Math.imul(L,ee)|0,c=c+Math.imul(C,te)|0,f=(f=f+Math.imul(C,ce)|0)+Math.imul(M,te)|0,d=d+Math.imul(M,ce)|0,c=c+Math.imul(_,de)|0,f=(f=f+Math.imul(_,re)|0)+Math.imul(I,de)|0,d=d+Math.imul(I,re)|0,c=c+Math.imul(A,ie)|0,f=(f=f+Math.imul(A,be)|0)+Math.imul(v,ie)|0,d=d+Math.imul(v,be)|0,c=c+Math.imul(m,se)|0,f=(f=f+Math.imul(m,le)|0)+Math.imul(x,se)|0,d=d+Math.imul(x,le)|0;var Ce=(b+(c=c+Math.imul(h,he)|0)|0)+((8191&(f=(f=f+Math.imul(h,pe)|0)+Math.imul(p,he)|0))<<13)|0;b=((d=d+Math.imul(p,pe)|0)+(f>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,c=Math.imul(F,K),f=(f=Math.imul(F,V))+Math.imul(Q,K)|0,d=Math.imul(Q,V),c=c+Math.imul(P,J)|0,f=(f=f+Math.imul(P,W)|0)+Math.imul(D,J)|0,d=d+Math.imul(D,W)|0,c=c+Math.imul(T,X)|0,f=(f=f+Math.imul(T,ee)|0)+Math.imul(N,X)|0,d=d+Math.imul(N,ee)|0,c=c+Math.imul(k,te)|0,f=(f=f+Math.imul(k,ce)|0)+Math.imul(L,te)|0,d=d+Math.imul(L,ce)|0,c=c+Math.imul(C,de)|0,f=(f=f+Math.imul(C,re)|0)+Math.imul(M,de)|0,d=d+Math.imul(M,re)|0,c=c+Math.imul(_,ie)|0,f=(f=f+Math.imul(_,be)|0)+Math.imul(I,ie)|0,d=d+Math.imul(I,be)|0,c=c+Math.imul(A,se)|0,f=(f=f+Math.imul(A,le)|0)+Math.imul(v,se)|0,d=d+Math.imul(v,le)|0;var Me=(b+(c=c+Math.imul(m,he)|0)|0)+((8191&(f=(f=f+Math.imul(m,pe)|0)+Math.imul(x,he)|0))<<13)|0;b=((d=d+Math.imul(x,pe)|0)+(f>>>13)|0)+(Me>>>26)|0,Me&=67108863,c=Math.imul(F,J),f=(f=Math.imul(F,W))+Math.imul(Q,J)|0,d=Math.imul(Q,W),c=c+Math.imul(P,X)|0,f=(f=f+Math.imul(P,ee)|0)+Math.imul(D,X)|0,d=d+Math.imul(D,ee)|0,c=c+Math.imul(T,te)|0,f=(f=f+Math.imul(T,ce)|0)+Math.imul(N,te)|0,d=d+Math.imul(N,ce)|0,c=c+Math.imul(k,de)|0,f=(f=f+Math.imul(k,re)|0)+Math.imul(L,de)|0,d=d+Math.imul(L,re)|0,c=c+Math.imul(C,ie)|0,f=(f=f+Math.imul(C,be)|0)+Math.imul(M,ie)|0,d=d+Math.imul(M,be)|0,c=c+Math.imul(_,se)|0,f=(f=f+Math.imul(_,le)|0)+Math.imul(I,se)|0,d=d+Math.imul(I,le)|0;var Be=(b+(c=c+Math.imul(A,he)|0)|0)+((8191&(f=(f=f+Math.imul(A,pe)|0)+Math.imul(v,he)|0))<<13)|0;b=((d=d+Math.imul(v,pe)|0)+(f>>>13)|0)+(Be>>>26)|0,Be&=67108863,c=Math.imul(F,X),f=(f=Math.imul(F,ee))+Math.imul(Q,X)|0,d=Math.imul(Q,ee),c=c+Math.imul(P,te)|0,f=(f=f+Math.imul(P,ce)|0)+Math.imul(D,te)|0,d=d+Math.imul(D,ce)|0,c=c+Math.imul(T,de)|0,f=(f=f+Math.imul(T,re)|0)+Math.imul(N,de)|0,d=d+Math.imul(N,re)|0,c=c+Math.imul(k,ie)|0,f=(f=f+Math.imul(k,be)|0)+Math.imul(L,ie)|0,d=d+Math.imul(L,be)|0,c=c+Math.imul(C,se)|0,f=(f=f+Math.imul(C,le)|0)+Math.imul(M,se)|0,d=d+Math.imul(M,le)|0;var ke=(b+(c=c+Math.imul(_,he)|0)|0)+((8191&(f=(f=f+Math.imul(_,pe)|0)+Math.imul(I,he)|0))<<13)|0;b=((d=d+Math.imul(I,pe)|0)+(f>>>13)|0)+(ke>>>26)|0,ke&=67108863,c=Math.imul(F,te),f=(f=Math.imul(F,ce))+Math.imul(Q,te)|0,d=Math.imul(Q,ce),c=c+Math.imul(P,de)|0,f=(f=f+Math.imul(P,re)|0)+Math.imul(D,de)|0,d=d+Math.imul(D,re)|0,c=c+Math.imul(T,ie)|0,f=(f=f+Math.imul(T,be)|0)+Math.imul(N,ie)|0,d=d+Math.imul(N,be)|0,c=c+Math.imul(k,se)|0,f=(f=f+Math.imul(k,le)|0)+Math.imul(L,se)|0,d=d+Math.imul(L,le)|0;var Le=(b+(c=c+Math.imul(C,he)|0)|0)+((8191&(f=(f=f+Math.imul(C,pe)|0)+Math.imul(M,he)|0))<<13)|0;b=((d=d+Math.imul(M,pe)|0)+(f>>>13)|0)+(Le>>>26)|0,Le&=67108863,c=Math.imul(F,de),f=(f=Math.imul(F,re))+Math.imul(Q,de)|0,d=Math.imul(Q,re),c=c+Math.imul(P,ie)|0,f=(f=f+Math.imul(P,be)|0)+Math.imul(D,ie)|0,d=d+Math.imul(D,be)|0,c=c+Math.imul(T,se)|0,f=(f=f+Math.imul(T,le)|0)+Math.imul(N,se)|0,d=d+Math.imul(N,le)|0;var Se=(b+(c=c+Math.imul(k,he)|0)|0)+((8191&(f=(f=f+Math.imul(k,pe)|0)+Math.imul(L,he)|0))<<13)|0;b=((d=d+Math.imul(L,pe)|0)+(f>>>13)|0)+(Se>>>26)|0,Se&=67108863,c=Math.imul(F,ie),f=(f=Math.imul(F,be))+Math.imul(Q,ie)|0,d=Math.imul(Q,be),c=c+Math.imul(P,se)|0,f=(f=f+Math.imul(P,le)|0)+Math.imul(D,se)|0,d=d+Math.imul(D,le)|0;var Te=(b+(c=c+Math.imul(T,he)|0)|0)+((8191&(f=(f=f+Math.imul(T,pe)|0)+Math.imul(N,he)|0))<<13)|0;b=((d=d+Math.imul(N,pe)|0)+(f>>>13)|0)+(Te>>>26)|0,Te&=67108863,c=Math.imul(F,se),f=(f=Math.imul(F,le))+Math.imul(Q,se)|0,d=Math.imul(Q,le);var Ne=(b+(c=c+Math.imul(P,he)|0)|0)+((8191&(f=(f=f+Math.imul(P,pe)|0)+Math.imul(D,he)|0))<<13)|0;b=((d=d+Math.imul(D,pe)|0)+(f>>>13)|0)+(Ne>>>26)|0,Ne&=67108863;var Re=(b+(c=Math.imul(F,he))|0)+((8191&(f=(f=Math.imul(F,pe))+Math.imul(Q,he)|0))<<13)|0;return b=((d=Math.imul(Q,pe))+(f>>>13)|0)+(Re>>>26)|0,Re&=67108863,i[0]=ge,i[1]=me,i[2]=xe,i[3]=ye,i[4]=Ae,i[5]=ve,i[6]=we,i[7]=_e,i[8]=Ie,i[9]=Ee,i[10]=Ce,i[11]=Me,i[12]=Be,i[13]=ke,i[14]=Le,i[15]=Se,i[16]=Te,i[17]=Ne,i[18]=Re,0!==b&&(i[19]=b,t.length++),t};function p(e,a,t){return(new g).mulp(e,a,t)}function g(e,a){this.x=e,this.y=a}Math.imul||(h=u),d.prototype.mulTo=function(e,a){var t,c=this.length+e.length;return t=10===this.length&&10===e.length?h(this,e,a):c<63?u(this,e,a):c<1024?function(e,a,t){t.negative=a.negative^e.negative,t.length=e.length+a.length;for(var c=0,f=0,d=0;d>>26)|0)>>>26,r&=67108863}t.words[d]=n,c=r,r=f}return 0!==c?t.words[d]=c:t.length--,t.strip()}(this,e,a):p(this,e,a),t},g.prototype.makeRBT=function(e){for(var a=new Array(e),t=d.prototype._countBits(e)-1,c=0;c>=1;return c},g.prototype.permute=function(e,a,t,c,f,d){for(var r=0;r>>=1)f++;return 1<>>=13,t[2*r+1]=8191&d,d>>>=13;for(r=2*a;r>=26,a+=f/67108864|0,a+=d>>>26,this.words[t]=67108863&d}return 0!==a&&(this.words[t]=a,this.length++),this},d.prototype.muln=function(e){return this.clone().imuln(e)},d.prototype.sqr=function(){return this.mul(this)},d.prototype.isqr=function(){return this.imul(this.clone())},d.prototype.pow=function(e){var a=function(e){for(var a=new Array(e.bitLength()),t=0;t>>f}return a}(e);if(0===a.length)return new d(1);for(var t=this,c=0;c=0);var a,t=e%26,f=(e-t)/26,d=67108863>>>26-t<<26-t;if(0!==t){var r=0;for(a=0;a>>26-t}r&&(this.words[a]=r,this.length++)}if(0!==f){for(a=this.length-1;a>=0;a--)this.words[a+f]=this.words[a];for(a=0;a=0),f=a?(a-a%26)/26:0;var d=e%26,r=Math.min((e-d)/26,this.length),n=67108863^67108863>>>d<r)for(this.length-=r,b=0;b=0&&(0!==o||b>=f);b--){var s=0|this.words[b];this.words[b]=o<<26-d|s>>>d,o=s&n}return i&&0!==o&&(i.words[i.length++]=o),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},d.prototype.ishrn=function(e,a,t){return c(0===this.negative),this.iushrn(e,a,t)},d.prototype.shln=function(e){return this.clone().ishln(e)},d.prototype.ushln=function(e){return this.clone().iushln(e)},d.prototype.shrn=function(e){return this.clone().ishrn(e)},d.prototype.ushrn=function(e){return this.clone().iushrn(e)},d.prototype.testn=function(e){c("number"==typeof e&&e>=0);var a=e%26,t=(e-a)/26,f=1<=0);var a=e%26,t=(e-a)/26;if(c(0===this.negative,"imaskn works only with positive numbers"),this.length<=t)return this;if(0!==a&&t++,this.length=Math.min(t,this.length),0!==a){var f=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},d.prototype.isubn=function(e){if(c("number"==typeof e),c(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(i/67108864|0),this.words[f+t]=67108863&d}for(;f>26,this.words[f+t]=67108863&d;if(0===n)return this.strip();for(c(-1===n),n=0,f=0;f>26,this.words[f]=67108863&d;return this.negative=1,this.strip()},d.prototype._wordDiv=function(e,a){var t=(this.length,e.length),c=this.clone(),f=e,r=0|f.words[f.length-1];0!=(t=26-this._countBits(r))&&(f=f.ushln(t),c.iushln(t),r=0|f.words[f.length-1]);var n,i=c.length-f.length;if("mod"!==a){(n=new d(null)).length=i+1,n.words=new Array(n.length);for(var b=0;b=0;s--){var l=67108864*(0|c.words[f.length+s])+(0|c.words[f.length+s-1]);for(l=Math.min(l/r|0,67108863),c._ishlnsubmul(f,l,s);0!==c.negative;)l--,c.negative=0,c._ishlnsubmul(f,1,s),c.isZero()||(c.negative^=1);n&&(n.words[s]=l)}return n&&n.strip(),c.strip(),"div"!==a&&0!==t&&c.iushrn(t),{div:n||null,mod:c}},d.prototype.divmod=function(e,a,t){return c(!e.isZero()),this.isZero()?{div:new d(0),mod:new d(0)}:0!==this.negative&&0===e.negative?(n=this.neg().divmod(e,a),"mod"!==a&&(f=n.div.neg()),"div"!==a&&(r=n.mod.neg(),t&&0!==r.negative&&r.iadd(e)),{div:f,mod:r}):0===this.negative&&0!==e.negative?(n=this.divmod(e.neg(),a),"mod"!==a&&(f=n.div.neg()),{div:f,mod:n.mod}):this.negative&e.negative?(n=this.neg().divmod(e.neg(),a),"div"!==a&&(r=n.mod.neg(),t&&0!==r.negative&&r.isub(e)),{div:n.div,mod:r}):e.length>this.length||this.cmp(e)<0?{div:new d(0),mod:this}:1===e.length?"div"===a?{div:this.divn(e.words[0]),mod:null}:"mod"===a?{div:null,mod:new d(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new d(this.modn(e.words[0]))}:this._wordDiv(e,a);var f,r,n},d.prototype.div=function(e){return this.divmod(e,"div",!1).div},d.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},d.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},d.prototype.divRound=function(e){var a=this.divmod(e);if(a.mod.isZero())return a.div;var t=0!==a.div.negative?a.mod.isub(e):a.mod,c=e.ushrn(1),f=e.andln(1),d=t.cmp(c);return d<0||1===f&&0===d?a.div:0!==a.div.negative?a.div.isubn(1):a.div.iaddn(1)},d.prototype.modn=function(e){c(e<=67108863);for(var a=(1<<26)%e,t=0,f=this.length-1;f>=0;f--)t=(a*t+(0|this.words[f]))%e;return t},d.prototype.idivn=function(e){c(e<=67108863);for(var a=0,t=this.length-1;t>=0;t--){var f=(0|this.words[t])+67108864*a;this.words[t]=f/e|0,a=f%e}return this.strip()},d.prototype.divn=function(e){return this.clone().idivn(e)},d.prototype.egcd=function(e){c(0===e.negative),c(!e.isZero());var a=this,t=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var f=new d(1),r=new d(0),n=new d(0),i=new d(1),b=0;a.isEven()&&t.isEven();)a.iushrn(1),t.iushrn(1),++b;for(var o=t.clone(),s=a.clone();!a.isZero();){for(var l=0,u=1;!(a.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(a.iushrn(l);l-- >0;)(f.isOdd()||r.isOdd())&&(f.iadd(o),r.isub(s)),f.iushrn(1),r.iushrn(1);for(var h=0,p=1;!(t.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(n.isOdd()||i.isOdd())&&(n.iadd(o),i.isub(s)),n.iushrn(1),i.iushrn(1);a.cmp(t)>=0?(a.isub(t),f.isub(n),r.isub(i)):(t.isub(a),n.isub(f),i.isub(r))}return{a:n,b:i,gcd:t.iushln(b)}},d.prototype._invmp=function(e){c(0===e.negative),c(!e.isZero());var a=this,t=e.clone();a=0!==a.negative?a.umod(e):a.clone();for(var f,r=new d(1),n=new d(0),i=t.clone();a.cmpn(1)>0&&t.cmpn(1)>0;){for(var b=0,o=1;!(a.words[0]&o)&&b<26;++b,o<<=1);if(b>0)for(a.iushrn(b);b-- >0;)r.isOdd()&&r.iadd(i),r.iushrn(1);for(var s=0,l=1;!(t.words[0]&l)&&s<26;++s,l<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(i),n.iushrn(1);a.cmp(t)>=0?(a.isub(t),r.isub(n)):(t.isub(a),n.isub(r))}return(f=0===a.cmpn(1)?r:n).cmpn(0)<0&&f.iadd(e),f},d.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var a=this.clone(),t=e.clone();a.negative=0,t.negative=0;for(var c=0;a.isEven()&&t.isEven();c++)a.iushrn(1),t.iushrn(1);for(;;){for(;a.isEven();)a.iushrn(1);for(;t.isEven();)t.iushrn(1);var f=a.cmp(t);if(f<0){var d=a;a=t,t=d}else if(0===f||0===t.cmpn(1))break;a.isub(t)}return t.iushln(c)},d.prototype.invm=function(e){return this.egcd(e).a.umod(e)},d.prototype.isEven=function(){return!(1&this.words[0])},d.prototype.isOdd=function(){return!(1&~this.words[0])},d.prototype.andln=function(e){return this.words[0]&e},d.prototype.bincn=function(e){c("number"==typeof e);var a=e%26,t=(e-a)/26,f=1<>>26,n&=67108863,this.words[r]=n}return 0!==d&&(this.words[r]=d,this.length++),this},d.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},d.prototype.cmpn=function(e){var a,t=e<0;if(0!==this.negative&&!t)return-1;if(0===this.negative&&t)return 1;if(this.strip(),this.length>1)a=1;else{t&&(e=-e),c(e<=67108863,"Number is too big");var f=0|this.words[0];a=f===e?0:fe.length)return 1;if(this.length=0;t--){var c=0|this.words[t],f=0|e.words[t];if(c!==f){cf&&(a=1);break}}return a},d.prototype.gtn=function(e){return 1===this.cmpn(e)},d.prototype.gt=function(e){return 1===this.cmp(e)},d.prototype.gten=function(e){return this.cmpn(e)>=0},d.prototype.gte=function(e){return this.cmp(e)>=0},d.prototype.ltn=function(e){return-1===this.cmpn(e)},d.prototype.lt=function(e){return-1===this.cmp(e)},d.prototype.lten=function(e){return this.cmpn(e)<=0},d.prototype.lte=function(e){return this.cmp(e)<=0},d.prototype.eqn=function(e){return 0===this.cmpn(e)},d.prototype.eq=function(e){return 0===this.cmp(e)},d.red=function(e){return new _(e)},d.prototype.toRed=function(e){return c(!this.red,"Already a number in reduction context"),c(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},d.prototype.fromRed=function(){return c(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},d.prototype._forceRed=function(e){return this.red=e,this},d.prototype.forceRed=function(e){return c(!this.red,"Already a number in reduction context"),this._forceRed(e)},d.prototype.redAdd=function(e){return c(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},d.prototype.redIAdd=function(e){return c(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},d.prototype.redSub=function(e){return c(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},d.prototype.redISub=function(e){return c(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},d.prototype.redShl=function(e){return c(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},d.prototype.redMul=function(e){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},d.prototype.redIMul=function(e){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},d.prototype.redSqr=function(){return c(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},d.prototype.redISqr=function(){return c(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},d.prototype.redSqrt=function(){return c(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},d.prototype.redInvm=function(){return c(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},d.prototype.redNeg=function(){return c(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},d.prototype.redPow=function(e){return c(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var m={k256:null,p224:null,p192:null,p25519:null};function x(e,a){this.name=e,this.p=new d(a,16),this.n=this.p.bitLength(),this.k=new d(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){x.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){x.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){x.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){x.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"==typeof e){var a=d._prime(e);this.m=a.p,this.prime=a}else c(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function I(e){_.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new d(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)}x.prototype._tmp=function(){var e=new d(null);return e.words=new Array(Math.ceil(this.n/13)),e},x.prototype.ireduce=function(e){var a,t=e;do{this.split(t,this.tmp),a=(t=(t=this.imulK(t)).iadd(this.tmp)).bitLength()}while(a>this.n);var c=a0?t.isub(this.p):void 0!==t.strip?t.strip():t._strip(),t},x.prototype.split=function(e,a){e.iushrn(this.n,0,a)},x.prototype.imulK=function(e){return e.imul(this.k)},f(y,x),y.prototype.split=function(e,a){for(var t=4194303,c=Math.min(e.length,9),f=0;f>>22,d=r}d>>>=22,e.words[f-10]=d,0===d&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var a=0,t=0;t>>=26,e.words[t]=f,a=c}return 0!==a&&(e.words[e.length++]=a),e},d._prime=function(e){if(m[e])return m[e];var a;if("k256"===e)a=new y;else if("p224"===e)a=new A;else if("p192"===e)a=new v;else{if("p25519"!==e)throw new Error("Unknown prime "+e);a=new w}return m[e]=a,a},_.prototype._verify1=function(e){c(0===e.negative,"red works only with positives"),c(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,a){c(!(e.negative|a.negative),"red works only with positives"),c(e.red&&e.red===a.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,a){this._verify2(e,a);var t=e.add(a);return t.cmp(this.m)>=0&&t.isub(this.m),t._forceRed(this)},_.prototype.iadd=function(e,a){this._verify2(e,a);var t=e.iadd(a);return t.cmp(this.m)>=0&&t.isub(this.m),t},_.prototype.sub=function(e,a){this._verify2(e,a);var t=e.sub(a);return t.cmpn(0)<0&&t.iadd(this.m),t._forceRed(this)},_.prototype.isub=function(e,a){this._verify2(e,a);var t=e.isub(a);return t.cmpn(0)<0&&t.iadd(this.m),t},_.prototype.shl=function(e,a){return this._verify1(e),this.imod(e.ushln(a))},_.prototype.imul=function(e,a){return this._verify2(e,a),this.imod(e.imul(a))},_.prototype.mul=function(e,a){return this._verify2(e,a),this.imod(e.mul(a))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var a=this.m.andln(3);if(c(a%2==1),3===a){var t=this.m.add(new d(1)).iushrn(2);return this.pow(e,t)}for(var f=this.m.subn(1),r=0;!f.isZero()&&0===f.andln(1);)r++,f.iushrn(1);c(!f.isZero());var n=new d(1).toRed(this),i=n.redNeg(),b=this.m.subn(1).iushrn(1),o=this.m.bitLength();for(o=new d(2*o*o).toRed(this);0!==this.pow(o,b).cmp(i);)o.redIAdd(i);for(var s=this.pow(o,f),l=this.pow(e,f.addn(1).iushrn(1)),u=this.pow(e,f),h=r;0!==u.cmp(n);){for(var p=u,g=0;0!==p.cmp(n);g++)p=p.redSqr();c(g=0;c--){for(var b=a.words[c],o=i-1;o>=0;o--){var s=b>>o&1;f!==t[0]&&(f=this.sqr(f)),0!==s||0!==r?(r<<=1,r|=s,(4==++n||0===c&&0===o)&&(f=this.mul(f,t[r]),n=0,r=0)):n=0}i=26}return f},_.prototype.convertTo=function(e){var a=e.umod(this.m);return a===e?a.clone():a},_.prototype.convertFrom=function(e){var a=e.clone();return a.red=null,a},d.mont=function(e){return new I(e)},f(I,_),I.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},I.prototype.convertFrom=function(e){var a=this.imod(e.mul(this.rinv));return a.red=null,a},I.prototype.imul=function(e,a){if(e.isZero()||a.isZero())return e.words[0]=0,e.length=1,e;var t=e.imul(a),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=t.isub(c).iushrn(this.shift),d=f;return f.cmp(this.m)>=0?d=f.isub(this.m):f.cmpn(0)<0&&(d=f.iadd(this.m)),d._forceRed(this)},I.prototype.mul=function(e,a){if(e.isZero()||a.isZero())return new d(0)._forceRed(this);var t=e.mul(a),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=t.isub(c).iushrn(this.shift),r=f;return f.cmp(this.m)>=0?r=f.isub(this.m):f.cmpn(0)<0&&(r=f.iadd(this.m)),r._forceRed(this)},I.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=t.nmd(e),this)},77362:(e,a,t)=>{var c=t(78170),f=t(48206),d=t(52061),r=t(82509),n=t(67332),i=t(47108),b=t(99247),o=t(92861).Buffer;e.exports=function(e,a,t){var s;s=e.padding?e.padding:t?1:4;var l,u=c(e),h=u.modulus.byteLength();if(a.length>h||new r(a).cmp(u.modulus)>=0)throw new Error("decryption error");l=t?b(new r(a),u):n(a,u);var p=o.alloc(h-l.length);if(l=o.concat([p,l],h),4===s)return function(e,a){var t=e.modulus.byteLength(),c=i("sha1").update(o.alloc(0)).digest(),r=c.length;if(0!==a[0])throw new Error("decryption error");var n=a.slice(1,r+1),b=a.slice(r+1),s=d(n,f(b,r)),l=d(b,f(s,t-r-1));if(function(e,a){e=o.from(e),a=o.from(a);var t=0,c=e.length;e.length!==a.length&&(t++,c=Math.min(e.length,a.length));for(var f=-1;++f=a.length){d++;break}var r=a.slice(2,f-1);if(("0002"!==c.toString("hex")&&!t||"0001"!==c.toString("hex")&&t)&&d++,r.length<8&&d++,d)throw new Error("decryption error");return a.slice(f)}(0,l,t);if(3===s)return l;throw new Error("unknown padding")}},28902:(e,a,t)=>{var c=t(78170),f=t(53209),d=t(47108),r=t(48206),n=t(52061),i=t(82509),b=t(99247),o=t(67332),s=t(92861).Buffer;e.exports=function(e,a,t){var l;l=e.padding?e.padding:t?1:4;var u,h=c(e);if(4===l)u=function(e,a){var t=e.modulus.byteLength(),c=a.length,b=d("sha1").update(s.alloc(0)).digest(),o=b.length,l=2*o;if(c>t-l-2)throw new Error("message too long");var u=s.alloc(t-c-l-2),h=t-o-1,p=f(o),g=n(s.concat([b,u,s.alloc(1,1),a],h),r(p,h)),m=n(p,r(g,o));return new i(s.concat([s.alloc(1),m,g],t))}(h,a);else if(1===l)u=function(e,a,t){var c,d=a.length,r=e.modulus.byteLength();if(d>r-11)throw new Error("message too long");return c=t?s.alloc(r-d-3,255):function(e){for(var a,t=s.allocUnsafe(e),c=0,d=f(2*e),r=0;c=0)throw new Error("data too long for modulus")}return t?o(u,h):b(u,h)}},99247:(e,a,t)=>{var c=t(82509),f=t(92861).Buffer;e.exports=function(e,a){return f.from(e.toRed(c.mont(a.modulus)).redPow(new c(a.publicExponent)).fromRed().toArray())}},52061:e=>{e.exports=function(e,a){for(var t=e.length,c=-1;++c{"use strict";var c=65536,f=t(92861).Buffer,d=t.g.crypto||t.g.msCrypto;d&&d.getRandomValues?e.exports=function(e,a){if(e>4294967295)throw new RangeError("requested too many random bytes");var t=f.allocUnsafe(e);if(e>0)if(e>c)for(var r=0;r{"use strict";function c(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var f=t(92861),d=t(53209),r=f.Buffer,n=f.kMaxLength,i=t.g.crypto||t.g.msCrypto,b=Math.pow(2,32)-1;function o(e,a){if("number"!=typeof e||e!=e)throw new TypeError("offset must be a number");if(e>b||e<0)throw new TypeError("offset must be a uint32");if(e>n||e>a)throw new RangeError("offset out of range")}function s(e,a,t){if("number"!=typeof e||e!=e)throw new TypeError("size must be a number");if(e>b||e<0)throw new TypeError("size must be a uint32");if(e+a>t||e>n)throw new RangeError("buffer too small")}function l(e,a,t,c){if(process.browser){var f=e.buffer,r=new Uint8Array(f,a,t);return i.getRandomValues(r),c?void process.nextTick((function(){c(null,e)})):e}if(!c)return d(t).copy(e,a),e;d(t,(function(t,f){if(t)return c(t);f.copy(e,a),c(null,e)}))}i&&i.getRandomValues||!process.browser?(a.randomFill=function(e,a,c,f){if(!(r.isBuffer(e)||e instanceof t.g.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof a)f=a,a=0,c=e.length;else if("function"==typeof c)f=c,c=e.length-a;else if("function"!=typeof f)throw new TypeError('"cb" argument must be a function');return o(a,e.length),s(c,a,e.length),l(e,a,c,f)},a.randomFillSync=function(e,a,c){if(void 0===a&&(a=0),!(r.isBuffer(e)||e instanceof t.g.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return o(a,e.length),void 0===c&&(c=e.length-a),s(c,a,e.length),l(e,a,c)}):(a.randomFill=c,a.randomFillSync=c)},86048:e=>{"use strict";var a={};function t(e,t,c){c||(c=Error);var f=function(e){var a,c;function f(a,c,f){return e.call(this,function(e,a,c){return"string"==typeof t?t:t(e,a,c)}(a,c,f))||this}return c=e,(a=f).prototype=Object.create(c.prototype),a.prototype.constructor=a,a.__proto__=c,f}(c);f.prototype.name=c.name,f.prototype.code=e,a[e]=f}function c(e,a){if(Array.isArray(e)){var t=e.length;return e=e.map((function(e){return String(e)})),t>2?"one of ".concat(a," ").concat(e.slice(0,t-1).join(", "),", or ")+e[t-1]:2===t?"one of ".concat(a," ").concat(e[0]," or ").concat(e[1]):"of ".concat(a," ").concat(e[0])}return"of ".concat(a," ").concat(String(e))}t("ERR_INVALID_OPT_VALUE",(function(e,a){return'The value "'+a+'" is invalid for option "'+e+'"'}),TypeError),t("ERR_INVALID_ARG_TYPE",(function(e,a,t){var f,d,r,n,i;if("string"==typeof a&&(d="not ",a.substr(0,4)===d)?(f="must not be",a=a.replace(/^not /,"")):f="must be",function(e,a,t){return(void 0===t||t>e.length)&&(t=e.length),e.substring(t-9,t)===a}(e," argument"))r="The ".concat(e," ").concat(f," ").concat(c(a,"type"));else{var b=("number"!=typeof i&&(i=0),i+1>(n=e).length||-1===n.indexOf(".",i)?"argument":"property");r='The "'.concat(e,'" ').concat(b," ").concat(f," ").concat(c(a,"type"))}return r+". Received type ".concat(typeof t)}),TypeError),t("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),t("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),t("ERR_STREAM_PREMATURE_CLOSE","Premature close"),t("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),t("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),t("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),t("ERR_STREAM_WRITE_AFTER_END","write after end"),t("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),t("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),t("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.F=a},25382:(e,a,t)=>{"use strict";var c=Object.keys||function(e){var a=[];for(var t in e)a.push(t);return a};e.exports=b;var f=t(45412),d=t(16708);t(56698)(b,f);for(var r=c(d.prototype),n=0;n{"use strict";e.exports=f;var c=t(74610);function f(e){if(!(this instanceof f))return new f(e);c.call(this,e)}t(56698)(f,c),f.prototype._transform=function(e,a,t){t(null,e)}},45412:(e,a,t)=>{"use strict";var c;e.exports=I,I.ReadableState=_,t(37007).EventEmitter;var f,d=function(e,a){return e.listeners(a).length},r=t(40345),n=t(48287).Buffer,i=(void 0!==t.g?t.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},b=t(79838);f=b&&b.debuglog?b.debuglog("stream"):function(){};var o,s,l,u=t(80345),h=t(75896),p=t(65291).getHighWaterMark,g=t(86048).F,m=g.ERR_INVALID_ARG_TYPE,x=g.ERR_STREAM_PUSH_AFTER_EOF,y=g.ERR_METHOD_NOT_IMPLEMENTED,A=g.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;t(56698)(I,r);var v=h.errorOrDestroy,w=["error","close","destroy","pause","resume"];function _(e,a,f){c=c||t(25382),e=e||{},"boolean"!=typeof f&&(f=a instanceof c),this.objectMode=!!e.objectMode,f&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=p(this,e,"readableHighWaterMark",f),this.buffer=new u,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(o||(o=t(83141).I),this.decoder=new o(e.encoding),this.encoding=e.encoding)}function I(e){if(c=c||t(25382),!(this instanceof I))return new I(e);var a=this instanceof c;this._readableState=new _(e,this,a),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),r.call(this)}function E(e,a,t,c,d){f("readableAddChunk",a);var r,b=e._readableState;if(null===a)b.reading=!1,function(e,a){if(f("onEofChunk"),!a.ended){if(a.decoder){var t=a.decoder.end();t&&t.length&&(a.buffer.push(t),a.length+=a.objectMode?1:t.length)}a.ended=!0,a.sync?k(e):(a.needReadable=!1,a.emittedReadable||(a.emittedReadable=!0,L(e)))}}(e,b);else if(d||(r=function(e,a){var t,c;return c=a,n.isBuffer(c)||c instanceof i||"string"==typeof a||void 0===a||e.objectMode||(t=new m("chunk",["string","Buffer","Uint8Array"],a)),t}(b,a)),r)v(e,r);else if(b.objectMode||a&&a.length>0)if("string"==typeof a||b.objectMode||Object.getPrototypeOf(a)===n.prototype||(a=function(e){return n.from(e)}(a)),c)b.endEmitted?v(e,new A):C(e,b,a,!0);else if(b.ended)v(e,new x);else{if(b.destroyed)return!1;b.reading=!1,b.decoder&&!t?(a=b.decoder.write(a),b.objectMode||0!==a.length?C(e,b,a,!1):S(e,b)):C(e,b,a,!1)}else c||(b.reading=!1,S(e,b));return!b.ended&&(b.lengtha.highWaterMark&&(a.highWaterMark=function(e){return e>=M?e=M:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=a.length?e:a.ended?a.length:(a.needReadable=!0,0))}function k(e){var a=e._readableState;f("emitReadable",a.needReadable,a.emittedReadable),a.needReadable=!1,a.emittedReadable||(f("emitReadable",a.flowing),a.emittedReadable=!0,process.nextTick(L,e))}function L(e){var a=e._readableState;f("emitReadable_",a.destroyed,a.length,a.ended),a.destroyed||!a.length&&!a.ended||(e.emit("readable"),a.emittedReadable=!1),a.needReadable=!a.flowing&&!a.ended&&a.length<=a.highWaterMark,D(e)}function S(e,a){a.readingMore||(a.readingMore=!0,process.nextTick(T,e,a))}function T(e,a){for(;!a.reading&&!a.ended&&(a.length0,a.resumeScheduled&&!a.paused?a.flowing=!0:e.listenerCount("data")>0&&e.resume()}function R(e){f("readable nexttick read 0"),e.read(0)}function P(e,a){f("resume",a.reading),a.reading||e.read(0),a.resumeScheduled=!1,e.emit("resume"),D(e),a.flowing&&!a.reading&&e.read(0)}function D(e){var a=e._readableState;for(f("flow",a.flowing);a.flowing&&null!==e.read(););}function O(e,a){return 0===a.length?null:(a.objectMode?t=a.buffer.shift():!e||e>=a.length?(t=a.decoder?a.buffer.join(""):1===a.buffer.length?a.buffer.first():a.buffer.concat(a.length),a.buffer.clear()):t=a.buffer.consume(e,a.decoder),t);var t}function F(e){var a=e._readableState;f("endReadable",a.endEmitted),a.endEmitted||(a.ended=!0,process.nextTick(Q,a,e))}function Q(e,a){if(f("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,a.readable=!1,a.emit("end"),e.autoDestroy)){var t=a._writableState;(!t||t.autoDestroy&&t.finished)&&a.destroy()}}function U(e,a){for(var t=0,c=e.length;t=a.highWaterMark:a.length>0)||a.ended))return f("read: emitReadable",a.length,a.ended),0===a.length&&a.ended?F(this):k(this),null;if(0===(e=B(e,a))&&a.ended)return 0===a.length&&F(this),null;var c,d=a.needReadable;return f("need readable",d),(0===a.length||a.length-e0?O(e,a):null)?(a.needReadable=a.length<=a.highWaterMark,e=0):(a.length-=e,a.awaitDrain=0),0===a.length&&(a.ended||(a.needReadable=!0),t!==e&&a.ended&&F(this)),null!==c&&this.emit("data",c),c},I.prototype._read=function(e){v(this,new y("_read()"))},I.prototype.pipe=function(e,a){var t=this,c=this._readableState;switch(c.pipesCount){case 0:c.pipes=e;break;case 1:c.pipes=[c.pipes,e];break;default:c.pipes.push(e)}c.pipesCount+=1,f("pipe count=%d opts=%j",c.pipesCount,a);var r=a&&!1===a.end||e===process.stdout||e===process.stderr?h:n;function n(){f("onend"),e.end()}c.endEmitted?process.nextTick(r):t.once("end",r),e.on("unpipe",(function a(d,r){f("onunpipe"),d===t&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,f("cleanup"),e.removeListener("close",l),e.removeListener("finish",u),e.removeListener("drain",i),e.removeListener("error",s),e.removeListener("unpipe",a),t.removeListener("end",n),t.removeListener("end",h),t.removeListener("data",o),b=!0,!c.awaitDrain||e._writableState&&!e._writableState.needDrain||i())}));var i=function(e){return function(){var a=e._readableState;f("pipeOnDrain",a.awaitDrain),a.awaitDrain&&a.awaitDrain--,0===a.awaitDrain&&d(e,"data")&&(a.flowing=!0,D(e))}}(t);e.on("drain",i);var b=!1;function o(a){f("ondata");var d=e.write(a);f("dest.write",d),!1===d&&((1===c.pipesCount&&c.pipes===e||c.pipesCount>1&&-1!==U(c.pipes,e))&&!b&&(f("false write response, pause",c.awaitDrain),c.awaitDrain++),t.pause())}function s(a){f("onerror",a),h(),e.removeListener("error",s),0===d(e,"error")&&v(e,a)}function l(){e.removeListener("finish",u),h()}function u(){f("onfinish"),e.removeListener("close",l),h()}function h(){f("unpipe"),t.unpipe(e)}return t.on("data",o),function(e,a,t){if("function"==typeof e.prependListener)return e.prependListener(a,t);e._events&&e._events[a]?Array.isArray(e._events[a])?e._events[a].unshift(t):e._events[a]=[t,e._events[a]]:e.on(a,t)}(e,"error",s),e.once("close",l),e.once("finish",u),e.emit("pipe",t),c.flowing||(f("pipe resume"),t.resume()),e},I.prototype.unpipe=function(e){var a=this._readableState,t={hasUnpiped:!1};if(0===a.pipesCount)return this;if(1===a.pipesCount)return e&&e!==a.pipes||(e||(e=a.pipes),a.pipes=null,a.pipesCount=0,a.flowing=!1,e&&e.emit("unpipe",this,t)),this;if(!e){var c=a.pipes,f=a.pipesCount;a.pipes=null,a.pipesCount=0,a.flowing=!1;for(var d=0;d0,!1!==c.flowing&&this.resume()):"readable"===e&&(c.endEmitted||c.readableListening||(c.readableListening=c.needReadable=!0,c.flowing=!1,c.emittedReadable=!1,f("on readable",c.length,c.reading),c.length?k(this):c.reading||process.nextTick(R,this))),t},I.prototype.addListener=I.prototype.on,I.prototype.removeListener=function(e,a){var t=r.prototype.removeListener.call(this,e,a);return"readable"===e&&process.nextTick(N,this),t},I.prototype.removeAllListeners=function(e){var a=r.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(N,this),a},I.prototype.resume=function(){var e=this._readableState;return e.flowing||(f("resume"),e.flowing=!e.readableListening,function(e,a){a.resumeScheduled||(a.resumeScheduled=!0,process.nextTick(P,e,a))}(this,e)),e.paused=!1,this},I.prototype.pause=function(){return f("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(f("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},I.prototype.wrap=function(e){var a=this,t=this._readableState,c=!1;for(var d in e.on("end",(function(){if(f("wrapped end"),t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&a.push(e)}a.push(null)})),e.on("data",(function(d){f("wrapped data"),t.decoder&&(d=t.decoder.write(d)),t.objectMode&&null==d||(t.objectMode||d&&d.length)&&(a.push(d)||(c=!0,e.pause()))})),e)void 0===this[d]&&"function"==typeof e[d]&&(this[d]=function(a){return function(){return e[a].apply(e,arguments)}}(d));for(var r=0;r{"use strict";e.exports=o;var c=t(86048).F,f=c.ERR_METHOD_NOT_IMPLEMENTED,d=c.ERR_MULTIPLE_CALLBACK,r=c.ERR_TRANSFORM_ALREADY_TRANSFORMING,n=c.ERR_TRANSFORM_WITH_LENGTH_0,i=t(25382);function b(e,a){var t=this._transformState;t.transforming=!1;var c=t.writecb;if(null===c)return this.emit("error",new d);t.writechunk=null,t.writecb=null,null!=a&&this.push(a),c(e);var f=this._readableState;f.reading=!1,(f.needReadable||f.length{"use strict";function c(e){var a=this;this.next=null,this.entry=null,this.finish=function(){!function(e,a){var t=e.entry;for(e.entry=null;t;){var c=t.callback;a.pendingcb--,c(undefined),t=t.next}a.corkedRequestsFree.next=e}(a,e)}}var f;e.exports=I,I.WritableState=_;var d,r={deprecate:t(94643)},n=t(40345),i=t(48287).Buffer,b=(void 0!==t.g?t.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},o=t(75896),s=t(65291).getHighWaterMark,l=t(86048).F,u=l.ERR_INVALID_ARG_TYPE,h=l.ERR_METHOD_NOT_IMPLEMENTED,p=l.ERR_MULTIPLE_CALLBACK,g=l.ERR_STREAM_CANNOT_PIPE,m=l.ERR_STREAM_DESTROYED,x=l.ERR_STREAM_NULL_VALUES,y=l.ERR_STREAM_WRITE_AFTER_END,A=l.ERR_UNKNOWN_ENCODING,v=o.errorOrDestroy;function w(){}function _(e,a,d){f=f||t(25382),e=e||{},"boolean"!=typeof d&&(d=a instanceof f),this.objectMode=!!e.objectMode,d&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=s(this,e,"writableHighWaterMark",d),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var r=!1===e.decodeStrings;this.decodeStrings=!r,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,a){var t=e._writableState,c=t.sync,f=t.writecb;if("function"!=typeof f)throw new p;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(t),a)!function(e,a,t,c,f){--a.pendingcb,t?(process.nextTick(f,c),process.nextTick(L,e,a),e._writableState.errorEmitted=!0,v(e,c)):(f(c),e._writableState.errorEmitted=!0,v(e,c),L(e,a))}(e,t,c,a,f);else{var d=B(t)||e.destroyed;d||t.corked||t.bufferProcessing||!t.bufferedRequest||M(e,t),c?process.nextTick(C,e,t,d,f):C(e,t,d,f)}}(a,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new c(this)}function I(e){var a=this instanceof(f=f||t(25382));if(!a&&!d.call(I,this))return new I(e);this._writableState=new _(e,this,a),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),n.call(this)}function E(e,a,t,c,f,d,r){a.writelen=c,a.writecb=r,a.writing=!0,a.sync=!0,a.destroyed?a.onwrite(new m("write")):t?e._writev(f,a.onwrite):e._write(f,d,a.onwrite),a.sync=!1}function C(e,a,t,c){t||function(e,a){0===a.length&&a.needDrain&&(a.needDrain=!1,e.emit("drain"))}(e,a),a.pendingcb--,c(),L(e,a)}function M(e,a){a.bufferProcessing=!0;var t=a.bufferedRequest;if(e._writev&&t&&t.next){var f=a.bufferedRequestCount,d=new Array(f),r=a.corkedRequestsFree;r.entry=t;for(var n=0,i=!0;t;)d[n]=t,t.isBuf||(i=!1),t=t.next,n+=1;d.allBuffers=i,E(e,a,!0,a.length,d,"",r.finish),a.pendingcb++,a.lastBufferedRequest=null,r.next?(a.corkedRequestsFree=r.next,r.next=null):a.corkedRequestsFree=new c(a),a.bufferedRequestCount=0}else{for(;t;){var b=t.chunk,o=t.encoding,s=t.callback;if(E(e,a,!1,a.objectMode?1:b.length,b,o,s),t=t.next,a.bufferedRequestCount--,a.writing)break}null===t&&(a.lastBufferedRequest=null)}a.bufferedRequest=t,a.bufferProcessing=!1}function B(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function k(e,a){e._final((function(t){a.pendingcb--,t&&v(e,t),a.prefinished=!0,e.emit("prefinish"),L(e,a)}))}function L(e,a){var t=B(a);if(t&&(function(e,a){a.prefinished||a.finalCalled||("function"!=typeof e._final||a.destroyed?(a.prefinished=!0,e.emit("prefinish")):(a.pendingcb++,a.finalCalled=!0,process.nextTick(k,e,a)))}(e,a),0===a.pendingcb&&(a.finished=!0,e.emit("finish"),a.autoDestroy))){var c=e._readableState;(!c||c.autoDestroy&&c.endEmitted)&&e.destroy()}return t}t(56698)(I,n),_.prototype.getBuffer=function(){for(var e=this.bufferedRequest,a=[];e;)a.push(e),e=e.next;return a},function(){try{Object.defineProperty(_.prototype,"buffer",{get:r.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(I,Symbol.hasInstance,{value:function(e){return!!d.call(this,e)||this===I&&e&&e._writableState instanceof _}})):d=function(e){return e instanceof this},I.prototype.pipe=function(){v(this,new g)},I.prototype.write=function(e,a,t){var c,f=this._writableState,d=!1,r=!f.objectMode&&(c=e,i.isBuffer(c)||c instanceof b);return r&&!i.isBuffer(e)&&(e=function(e){return i.from(e)}(e)),"function"==typeof a&&(t=a,a=null),r?a="buffer":a||(a=f.defaultEncoding),"function"!=typeof t&&(t=w),f.ending?function(e,a){var t=new y;v(e,t),process.nextTick(a,t)}(this,t):(r||function(e,a,t,c){var f;return null===t?f=new x:"string"==typeof t||a.objectMode||(f=new u("chunk",["string","Buffer"],t)),!f||(v(e,f),process.nextTick(c,f),!1)}(this,f,e,t))&&(f.pendingcb++,d=function(e,a,t,c,f,d){if(!t){var r=function(e,a,t){return e.objectMode||!1===e.decodeStrings||"string"!=typeof a||(a=i.from(a,t)),a}(a,c,f);c!==r&&(t=!0,f="buffer",c=r)}var n=a.objectMode?1:c.length;a.length+=n;var b=a.length-1))throw new A(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(I.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(I.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),I.prototype._write=function(e,a,t){t(new h("_write()"))},I.prototype._writev=null,I.prototype.end=function(e,a,t){var c=this._writableState;return"function"==typeof e?(t=e,e=null,a=null):"function"==typeof a&&(t=a,a=null),null!=e&&this.write(e,a),c.corked&&(c.corked=1,this.uncork()),c.ending||function(e,a,t){a.ending=!0,L(e,a),t&&(a.finished?process.nextTick(t):e.once("finish",t)),a.ended=!0,e.writable=!1}(this,c,t),this},Object.defineProperty(I.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(I.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),I.prototype.destroy=o.destroy,I.prototype._undestroy=o.undestroy,I.prototype._destroy=function(e,a){a(e)}},2955:(e,a,t)=>{"use strict";var c;function f(e,a,t){return(a=function(e){var a=function(e){if("object"!=typeof e||null===e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var t=a.call(e,"string");if("object"!=typeof t)return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof a?a:String(a)}(a))in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}var d=t(86238),r=Symbol("lastResolve"),n=Symbol("lastReject"),i=Symbol("error"),b=Symbol("ended"),o=Symbol("lastPromise"),s=Symbol("handlePromise"),l=Symbol("stream");function u(e,a){return{value:e,done:a}}function h(e){var a=e[r];if(null!==a){var t=e[l].read();null!==t&&(e[o]=null,e[r]=null,e[n]=null,a(u(t,!1)))}}function p(e){process.nextTick(h,e)}var g=Object.getPrototypeOf((function(){})),m=Object.setPrototypeOf((f(c={get stream(){return this[l]},next:function(){var e=this,a=this[i];if(null!==a)return Promise.reject(a);if(this[b])return Promise.resolve(u(void 0,!0));if(this[l].destroyed)return new Promise((function(a,t){process.nextTick((function(){e[i]?t(e[i]):a(u(void 0,!0))}))}));var t,c=this[o];if(c)t=new Promise(function(e,a){return function(t,c){e.then((function(){a[b]?t(u(void 0,!0)):a[s](t,c)}),c)}}(c,this));else{var f=this[l].read();if(null!==f)return Promise.resolve(u(f,!1));t=new Promise(this[s])}return this[o]=t,t}},Symbol.asyncIterator,(function(){return this})),f(c,"return",(function(){var e=this;return new Promise((function(a,t){e[l].destroy(null,(function(e){e?t(e):a(u(void 0,!0))}))}))})),c),g);e.exports=function(e){var a,t=Object.create(m,(f(a={},l,{value:e,writable:!0}),f(a,r,{value:null,writable:!0}),f(a,n,{value:null,writable:!0}),f(a,i,{value:null,writable:!0}),f(a,b,{value:e._readableState.endEmitted,writable:!0}),f(a,s,{value:function(e,a){var c=t[l].read();c?(t[o]=null,t[r]=null,t[n]=null,e(u(c,!1))):(t[r]=e,t[n]=a)},writable:!0}),a));return t[o]=null,d(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var a=t[n];return null!==a&&(t[o]=null,t[r]=null,t[n]=null,a(e)),void(t[i]=e)}var c=t[r];null!==c&&(t[o]=null,t[r]=null,t[n]=null,c(u(void 0,!0))),t[b]=!0})),e.on("readable",p.bind(null,t)),t}},80345:(e,a,t)=>{"use strict";function c(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);a&&(c=c.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,c)}return t}function f(e){for(var a=1;a0?this.tail.next=a:this.head=a,this.tail=a,++this.length}},{key:"unshift",value:function(e){var a={data:e,next:this.head};0===this.length&&(this.tail=a),this.head=a,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var a=this.head,t=""+a.data;a=a.next;)t+=e+a.data;return t}},{key:"concat",value:function(e){if(0===this.length)return i.alloc(0);for(var a,t,c,f=i.allocUnsafe(e>>>0),d=this.head,r=0;d;)a=d.data,t=f,c=r,i.prototype.copy.call(a,t,c),r+=d.data.length,d=d.next;return f}},{key:"consume",value:function(e,a){var t;return ef.length?f.length:e;if(d===f.length?c+=f:c+=f.slice(0,e),0==(e-=d)){d===f.length?(++t,a.next?this.head=a.next:this.head=this.tail=null):(this.head=a,a.data=f.slice(d));break}++t}return this.length-=t,c}},{key:"_getBuffer",value:function(e){var a=i.allocUnsafe(e),t=this.head,c=1;for(t.data.copy(a),e-=t.data.length;t=t.next;){var f=t.data,d=e>f.length?f.length:e;if(f.copy(a,a.length-e,0,d),0==(e-=d)){d===f.length?(++c,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=f.slice(d));break}++c}return this.length-=c,a}},{key:o,value:function(e,a){return b(this,f(f({},a),{},{depth:0,customInspect:!1}))}}])&&r(a.prototype,t),Object.defineProperty(a,"prototype",{writable:!1}),e}()},75896:e=>{"use strict";function a(e,a){c(e,a),t(e)}function t(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function c(e,a){e.emit("error",a)}e.exports={destroy:function(e,f){var d=this,r=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return r||n?(f?f(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(c,this,e)):process.nextTick(c,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!f&&e?d._writableState?d._writableState.errorEmitted?process.nextTick(t,d):(d._writableState.errorEmitted=!0,process.nextTick(a,d,e)):process.nextTick(a,d,e):f?(process.nextTick(t,d),f(e)):process.nextTick(t,d)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,a){var t=e._readableState,c=e._writableState;t&&t.autoDestroy||c&&c.autoDestroy?e.destroy(a):e.emit("error",a)}}},86238:(e,a,t)=>{"use strict";var c=t(86048).F.ERR_STREAM_PREMATURE_CLOSE;function f(){}e.exports=function e(a,t,d){if("function"==typeof t)return e(a,null,t);t||(t={}),d=function(e){var a=!1;return function(){if(!a){a=!0;for(var t=arguments.length,c=new Array(t),f=0;f{e.exports=function(){throw new Error("Readable.from is not available in the browser")}},57758:(e,a,t)=>{"use strict";var c,f=t(86048).F,d=f.ERR_MISSING_ARGS,r=f.ERR_STREAM_DESTROYED;function n(e){if(e)throw e}function i(e){e()}function b(e,a){return e.pipe(a)}e.exports=function(){for(var e=arguments.length,a=new Array(e),f=0;f0,(function(e){o||(o=e),e&&l.forEach(i),d||(l.forEach(i),s(o))}))}));return a.reduce(b)}},65291:(e,a,t)=>{"use strict";var c=t(86048).F.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,a,t,f){var d=function(e,a,t){return null!=e.highWaterMark?e.highWaterMark:a?e[t]:null}(a,f,t);if(null!=d){if(!isFinite(d)||Math.floor(d)!==d||d<0)throw new c(f?t:"highWaterMark",d);return Math.floor(d)}return e.objectMode?16:16384}}},40345:(e,a,t)=>{e.exports=t(37007).EventEmitter},28399:(e,a,t)=>{(a=e.exports=t(45412)).Stream=a,a.Readable=a,a.Writable=t(16708),a.Duplex=t(25382),a.Transform=t(74610),a.PassThrough=t(63600),a.finished=t(86238),a.pipeline=t(57758)},66011:(e,a,t)=>{"use strict";var c=t(48287).Buffer,f=t(56698),d=t(51147),r=new Array(16),n=[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],i=[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],b=[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],o=[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],s=[0,1518500249,1859775393,2400959708,2840853838],l=[1352829926,1548603684,1836072691,2053994217,0];function u(){d.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function h(e,a){return e<>>32-a}function p(e,a,t,c,f,d,r,n){return h(e+(a^t^c)+d+r|0,n)+f|0}function g(e,a,t,c,f,d,r,n){return h(e+(a&t|~a&c)+d+r|0,n)+f|0}function m(e,a,t,c,f,d,r,n){return h(e+((a|~t)^c)+d+r|0,n)+f|0}function x(e,a,t,c,f,d,r,n){return h(e+(a&c|t&~c)+d+r|0,n)+f|0}function y(e,a,t,c,f,d,r,n){return h(e+(a^(t|~c))+d+r|0,n)+f|0}f(u,d),u.prototype._update=function(){for(var e=r,a=0;a<16;++a)e[a]=this._block.readInt32LE(4*a);for(var t=0|this._a,c=0|this._b,f=0|this._c,d=0|this._d,u=0|this._e,A=0|this._a,v=0|this._b,w=0|this._c,_=0|this._d,I=0|this._e,E=0;E<80;E+=1){var C,M;E<16?(C=p(t,c,f,d,u,e[n[E]],s[0],b[E]),M=y(A,v,w,_,I,e[i[E]],l[0],o[E])):E<32?(C=g(t,c,f,d,u,e[n[E]],s[1],b[E]),M=x(A,v,w,_,I,e[i[E]],l[1],o[E])):E<48?(C=m(t,c,f,d,u,e[n[E]],s[2],b[E]),M=m(A,v,w,_,I,e[i[E]],l[2],o[E])):E<64?(C=x(t,c,f,d,u,e[n[E]],s[3],b[E]),M=g(A,v,w,_,I,e[i[E]],l[3],o[E])):(C=y(t,c,f,d,u,e[n[E]],s[4],b[E]),M=p(A,v,w,_,I,e[i[E]],l[4],o[E])),t=u,u=d,d=h(f,10),f=c,c=C,A=I,I=_,_=h(w,10),w=v,v=M}var B=this._b+f+_|0;this._b=this._c+d+I|0,this._c=this._d+u+A|0,this._d=this._e+t+v|0,this._e=this._a+c+w|0,this._a=B},u.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=c.alloc?c.alloc(20):new c(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},e.exports=u},51147:(e,a,t)=>{"use strict";var c=t(92861).Buffer,f=t(28399).Transform;function d(e){f.call(this),this._block=c.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}t(56698)(d,f),d.prototype._transform=function(e,a,t){var c=null;try{this.update(e,a)}catch(e){c=e}t(c)},d.prototype._flush=function(e){var a=null;try{this.push(this.digest())}catch(e){a=e}e(a)},d.prototype.update=function(e,a){if(function(e){if(!c.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer")}(e),this._finalized)throw new Error("Digest already called");c.isBuffer(e)||(e=c.from(e,a));for(var t=this._block,f=0;this._blockOffset+e.length-f>=this._blockSize;){for(var d=this._blockOffset;d0;++r)this._length[r]+=n,(n=this._length[r]/4294967296|0)>0&&(this._length[r]-=4294967296*n);return this},d.prototype._update=function(){throw new Error("_update is not implemented")},d.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var a=this._digest();void 0!==e&&(a=a.toString(e)),this._block.fill(0),this._blockOffset=0;for(var t=0;t<4;++t)this._length[t]=0;return a},d.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=d},92861:(e,a,t)=>{var c=t(48287),f=c.Buffer;function d(e,a){for(var t in e)a[t]=e[t]}function r(e,a,t){return f(e,a,t)}f.from&&f.alloc&&f.allocUnsafe&&f.allocUnsafeSlow?e.exports=c:(d(c,a),a.Buffer=r),r.prototype=Object.create(f.prototype),d(f,r),r.from=function(e,a,t){if("number"==typeof e)throw new TypeError("Argument must not be a number");return f(e,a,t)},r.alloc=function(e,a,t){if("number"!=typeof e)throw new TypeError("Argument must be a number");var c=f(e);return void 0!==a?"string"==typeof t?c.fill(a,t):c.fill(a):c.fill(0),c},r.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return f(e)},r.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return c.SlowBuffer(e)}},96897:(e,a,t)=>{"use strict";var c=t(70453),f=t(30041),d=t(30592)(),r=t(75795),n=t(69675),i=c("%Math.floor%");e.exports=function(e,a){if("function"!=typeof e)throw new n("`fn` is not a function");if("number"!=typeof a||a<0||a>4294967295||i(a)!==a)throw new n("`length` must be a positive 32-bit integer");var t=arguments.length>2&&!!arguments[2],c=!0,b=!0;if("length"in e&&r){var o=r(e,"length");o&&!o.configurable&&(c=!1),o&&!o.writable&&(b=!1)}return(c||b||!t)&&(d?f(e,"length",a,!0,!0):f(e,"length",a)),e}},90392:(e,a,t)=>{var c=t(92861).Buffer;function f(e,a){this._block=c.alloc(e),this._finalSize=a,this._blockSize=e,this._len=0}f.prototype.update=function(e,a){"string"==typeof e&&(a=a||"utf8",e=c.from(e,a));for(var t=this._block,f=this._blockSize,d=e.length,r=this._len,n=0;n=this._finalSize&&(this._update(this._block),this._block.fill(0));var t=8*this._len;if(t<=4294967295)this._block.writeUInt32BE(t,this._blockSize-4);else{var c=(4294967295&t)>>>0,f=(t-c)/4294967296;this._block.writeUInt32BE(f,this._blockSize-8),this._block.writeUInt32BE(c,this._blockSize-4)}this._update(this._block);var d=this._hash();return e?d.toString(e):d},f.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=f},62802:(e,a,t)=>{var c=e.exports=function(e){e=e.toLowerCase();var a=c[e];if(!a)throw new Error(e+" is not supported (we accept pull requests)");return new a};c.sha=t(27816),c.sha1=t(63737),c.sha224=t(26710),c.sha256=t(24107),c.sha384=t(32827),c.sha512=t(82890)},27816:(e,a,t)=>{var c=t(56698),f=t(90392),d=t(92861).Buffer,r=[1518500249,1859775393,-1894007588,-899497514],n=new Array(80);function i(){this.init(),this._w=n,f.call(this,64,56)}function b(e){return e<<30|e>>>2}function o(e,a,t,c){return 0===e?a&t|~a&c:2===e?a&t|a&c|t&c:a^t^c}c(i,f),i.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},i.prototype._update=function(e){for(var a,t=this._w,c=0|this._a,f=0|this._b,d=0|this._c,n=0|this._d,i=0|this._e,s=0;s<16;++s)t[s]=e.readInt32BE(4*s);for(;s<80;++s)t[s]=t[s-3]^t[s-8]^t[s-14]^t[s-16];for(var l=0;l<80;++l){var u=~~(l/20),h=0|((a=c)<<5|a>>>27)+o(u,f,d,n)+i+t[l]+r[u];i=n,n=d,d=b(f),f=c,c=h}this._a=c+this._a|0,this._b=f+this._b|0,this._c=d+this._c|0,this._d=n+this._d|0,this._e=i+this._e|0},i.prototype._hash=function(){var e=d.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=i},63737:(e,a,t)=>{var c=t(56698),f=t(90392),d=t(92861).Buffer,r=[1518500249,1859775393,-1894007588,-899497514],n=new Array(80);function i(){this.init(),this._w=n,f.call(this,64,56)}function b(e){return e<<5|e>>>27}function o(e){return e<<30|e>>>2}function s(e,a,t,c){return 0===e?a&t|~a&c:2===e?a&t|a&c|t&c:a^t^c}c(i,f),i.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},i.prototype._update=function(e){for(var a,t=this._w,c=0|this._a,f=0|this._b,d=0|this._c,n=0|this._d,i=0|this._e,l=0;l<16;++l)t[l]=e.readInt32BE(4*l);for(;l<80;++l)t[l]=(a=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|a>>>31;for(var u=0;u<80;++u){var h=~~(u/20),p=b(c)+s(h,f,d,n)+i+t[u]+r[h]|0;i=n,n=d,d=o(f),f=c,c=p}this._a=c+this._a|0,this._b=f+this._b|0,this._c=d+this._c|0,this._d=n+this._d|0,this._e=i+this._e|0},i.prototype._hash=function(){var e=d.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=i},26710:(e,a,t)=>{var c=t(56698),f=t(24107),d=t(90392),r=t(92861).Buffer,n=new Array(64);function i(){this.init(),this._w=n,d.call(this,64,56)}c(i,f),i.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},i.prototype._hash=function(){var e=r.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},e.exports=i},24107:(e,a,t)=>{var c=t(56698),f=t(90392),d=t(92861).Buffer,r=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],n=new Array(64);function i(){this.init(),this._w=n,f.call(this,64,56)}function b(e,a,t){return t^e&(a^t)}function o(e,a,t){return e&a|t&(e|a)}function s(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function l(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function u(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}c(i,f),i.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},i.prototype._update=function(e){for(var a,t=this._w,c=0|this._a,f=0|this._b,d=0|this._c,n=0|this._d,i=0|this._e,h=0|this._f,p=0|this._g,g=0|this._h,m=0;m<16;++m)t[m]=e.readInt32BE(4*m);for(;m<64;++m)t[m]=0|(((a=t[m-2])>>>17|a<<15)^(a>>>19|a<<13)^a>>>10)+t[m-7]+u(t[m-15])+t[m-16];for(var x=0;x<64;++x){var y=g+l(i)+b(i,h,p)+r[x]+t[x]|0,A=s(c)+o(c,f,d)|0;g=p,p=h,h=i,i=n+y|0,n=d,d=f,f=c,c=y+A|0}this._a=c+this._a|0,this._b=f+this._b|0,this._c=d+this._c|0,this._d=n+this._d|0,this._e=i+this._e|0,this._f=h+this._f|0,this._g=p+this._g|0,this._h=g+this._h|0},i.prototype._hash=function(){var e=d.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=i},32827:(e,a,t)=>{var c=t(56698),f=t(82890),d=t(90392),r=t(92861).Buffer,n=new Array(160);function i(){this.init(),this._w=n,d.call(this,128,112)}c(i,f),i.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},i.prototype._hash=function(){var e=r.allocUnsafe(48);function a(a,t,c){e.writeInt32BE(a,c),e.writeInt32BE(t,c+4)}return a(this._ah,this._al,0),a(this._bh,this._bl,8),a(this._ch,this._cl,16),a(this._dh,this._dl,24),a(this._eh,this._el,32),a(this._fh,this._fl,40),e},e.exports=i},82890:(e,a,t)=>{var c=t(56698),f=t(90392),d=t(92861).Buffer,r=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],n=new Array(160);function i(){this.init(),this._w=n,f.call(this,128,112)}function b(e,a,t){return t^e&(a^t)}function o(e,a,t){return e&a|t&(e|a)}function s(e,a){return(e>>>28|a<<4)^(a>>>2|e<<30)^(a>>>7|e<<25)}function l(e,a){return(e>>>14|a<<18)^(e>>>18|a<<14)^(a>>>9|e<<23)}function u(e,a){return(e>>>1|a<<31)^(e>>>8|a<<24)^e>>>7}function h(e,a){return(e>>>1|a<<31)^(e>>>8|a<<24)^(e>>>7|a<<25)}function p(e,a){return(e>>>19|a<<13)^(a>>>29|e<<3)^e>>>6}function g(e,a){return(e>>>19|a<<13)^(a>>>29|e<<3)^(e>>>6|a<<26)}function m(e,a){return e>>>0>>0?1:0}c(i,f),i.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},i.prototype._update=function(e){for(var a=this._w,t=0|this._ah,c=0|this._bh,f=0|this._ch,d=0|this._dh,n=0|this._eh,i=0|this._fh,x=0|this._gh,y=0|this._hh,A=0|this._al,v=0|this._bl,w=0|this._cl,_=0|this._dl,I=0|this._el,E=0|this._fl,C=0|this._gl,M=0|this._hl,B=0;B<32;B+=2)a[B]=e.readInt32BE(4*B),a[B+1]=e.readInt32BE(4*B+4);for(;B<160;B+=2){var k=a[B-30],L=a[B-30+1],S=u(k,L),T=h(L,k),N=p(k=a[B-4],L=a[B-4+1]),R=g(L,k),P=a[B-14],D=a[B-14+1],O=a[B-32],F=a[B-32+1],Q=T+D|0,U=S+P+m(Q,T)|0;U=(U=U+N+m(Q=Q+R|0,R)|0)+O+m(Q=Q+F|0,F)|0,a[B]=U,a[B+1]=Q}for(var j=0;j<160;j+=2){U=a[j],Q=a[j+1];var H=o(t,c,f),q=o(A,v,w),$=s(t,A),z=s(A,t),G=l(n,I),K=l(I,n),V=r[j],Z=r[j+1],J=b(n,i,x),W=b(I,E,C),Y=M+K|0,X=y+G+m(Y,M)|0;X=(X=(X=X+J+m(Y=Y+W|0,W)|0)+V+m(Y=Y+Z|0,Z)|0)+U+m(Y=Y+Q|0,Q)|0;var ee=z+q|0,ae=$+H+m(ee,z)|0;y=x,M=C,x=i,C=E,i=n,E=I,n=d+X+m(I=_+Y|0,_)|0,d=f,_=w,f=c,w=v,c=t,v=A,t=X+ae+m(A=Y+ee|0,Y)|0}this._al=this._al+A|0,this._bl=this._bl+v|0,this._cl=this._cl+w|0,this._dl=this._dl+_|0,this._el=this._el+I|0,this._fl=this._fl+E|0,this._gl=this._gl+C|0,this._hl=this._hl+M|0,this._ah=this._ah+t+m(this._al,A)|0,this._bh=this._bh+c+m(this._bl,v)|0,this._ch=this._ch+f+m(this._cl,w)|0,this._dh=this._dh+d+m(this._dl,_)|0,this._eh=this._eh+n+m(this._el,I)|0,this._fh=this._fh+i+m(this._fl,E)|0,this._gh=this._gh+x+m(this._gl,C)|0,this._hh=this._hh+y+m(this._hl,M)|0},i.prototype._hash=function(){var e=d.allocUnsafe(64);function a(a,t,c){e.writeInt32BE(a,c),e.writeInt32BE(t,c+4)}return a(this._ah,this._al,0),a(this._bh,this._bl,8),a(this._ch,this._cl,16),a(this._dh,this._dl,24),a(this._eh,this._el,32),a(this._fh,this._fl,40),a(this._gh,this._gl,48),a(this._hh,this._hl,56),e},e.exports=i},88310:(e,a,t)=>{e.exports=f;var c=t(37007).EventEmitter;function f(){c.call(this)}t(56698)(f,c),f.Readable=t(45412),f.Writable=t(16708),f.Duplex=t(25382),f.Transform=t(74610),f.PassThrough=t(63600),f.finished=t(86238),f.pipeline=t(57758),f.Stream=f,f.prototype.pipe=function(e,a){var t=this;function f(a){e.writable&&!1===e.write(a)&&t.pause&&t.pause()}function d(){t.readable&&t.resume&&t.resume()}t.on("data",f),e.on("drain",d),e._isStdio||a&&!1===a.end||(t.on("end",n),t.on("close",i));var r=!1;function n(){r||(r=!0,e.end())}function i(){r||(r=!0,"function"==typeof e.destroy&&e.destroy())}function b(e){if(o(),0===c.listenerCount(this,"error"))throw e}function o(){t.removeListener("data",f),e.removeListener("drain",d),t.removeListener("end",n),t.removeListener("close",i),t.removeListener("error",b),e.removeListener("error",b),t.removeListener("end",o),t.removeListener("close",o),e.removeListener("close",o)}return t.on("error",b),e.on("error",b),t.on("end",o),t.on("close",o),e.on("close",o),e.emit("pipe",t),e}},11568:(e,a,t)=>{var c=t(55537),f=t(6917),d=t(57510),r=t(86866),n=t(59817),i=a;i.request=function(e,a){e="string"==typeof e?n.parse(e):d(e);var f=-1===t.g.location.protocol.search(/^https?:$/)?"http:":"",r=e.protocol||f,i=e.hostname||e.host,b=e.port,o=e.path||"/";i&&-1!==i.indexOf(":")&&(i="["+i+"]"),e.url=(i?r+"//"+i:"")+(b?":"+b:"")+o,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var s=new c(e);return a&&s.on("response",a),s},i.get=function(e,a){var t=i.request(e,a);return t.end(),t},i.ClientRequest=c,i.IncomingMessage=f.IncomingMessage,i.Agent=function(){},i.Agent.defaultMaxSockets=4,i.globalAgent=new i.Agent,i.STATUS_CODES=r,i.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]},6688:(e,a,t)=>{var c;function f(){if(void 0!==c)return c;if(t.g.XMLHttpRequest){c=new t.g.XMLHttpRequest;try{c.open("GET",t.g.XDomainRequest?"/":"https://example.com")}catch(e){c=null}}else c=null;return c}function d(e){var a=f();if(!a)return!1;try{return a.responseType=e,a.responseType===e}catch(e){}return!1}function r(e){return"function"==typeof e}a.fetch=r(t.g.fetch)&&r(t.g.ReadableStream),a.writableStream=r(t.g.WritableStream),a.abortController=r(t.g.AbortController),a.arraybuffer=a.fetch||d("arraybuffer"),a.msstream=!a.fetch&&d("ms-stream"),a.mozchunkedarraybuffer=!a.fetch&&d("moz-chunked-arraybuffer"),a.overrideMimeType=a.fetch||!!f()&&r(f().overrideMimeType),c=null},55537:(e,a,t)=>{var c=t(62045).hp,f=t(6688),d=t(56698),r=t(6917),n=t(28399),i=r.IncomingMessage,b=r.readyStates,o=e.exports=function(e){var a,t=this;n.Writable.call(t),t._opts=e,t._body=[],t._headers={},e.auth&&t.setHeader("Authorization","Basic "+c.from(e.auth).toString("base64")),Object.keys(e.headers).forEach((function(a){t.setHeader(a,e.headers[a])}));var d=!0;if("disable-fetch"===e.mode||"requestTimeout"in e&&!f.abortController)d=!1,a=!0;else if("prefer-streaming"===e.mode)a=!1;else if("allow-wrong-content-type"===e.mode)a=!f.overrideMimeType;else{if(e.mode&&"default"!==e.mode&&"prefer-fast"!==e.mode)throw new Error("Invalid value for opts.mode");a=!0}t._mode=function(e,a){return f.fetch&&a?"fetch":f.mozchunkedarraybuffer?"moz-chunked-arraybuffer":f.msstream?"ms-stream":f.arraybuffer&&e?"arraybuffer":"text"}(a,d),t._fetchTimer=null,t._socketTimeout=null,t._socketTimer=null,t.on("finish",(function(){t._onFinish()}))};d(o,n.Writable),o.prototype.setHeader=function(e,a){var t=e.toLowerCase();-1===s.indexOf(t)&&(this._headers[t]={name:e,value:a})},o.prototype.getHeader=function(e){var a=this._headers[e.toLowerCase()];return a?a.value:null},o.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},o.prototype._onFinish=function(){var e=this;if(!e._destroyed){var a=e._opts;"timeout"in a&&0!==a.timeout&&e.setTimeout(a.timeout);var c=e._headers,d=null;"GET"!==a.method&&"HEAD"!==a.method&&(d=new Blob(e._body,{type:(c["content-type"]||{}).value||""}));var r=[];if(Object.keys(c).forEach((function(e){var a=c[e].name,t=c[e].value;Array.isArray(t)?t.forEach((function(e){r.push([a,e])})):r.push([a,t])})),"fetch"===e._mode){var n=null;if(f.abortController){var i=new AbortController;n=i.signal,e._fetchAbortController=i,"requestTimeout"in a&&0!==a.requestTimeout&&(e._fetchTimer=t.g.setTimeout((function(){e.emit("requestTimeout"),e._fetchAbortController&&e._fetchAbortController.abort()}),a.requestTimeout))}t.g.fetch(e._opts.url,{method:e._opts.method,headers:r,body:d||void 0,mode:"cors",credentials:a.withCredentials?"include":"same-origin",signal:n}).then((function(a){e._fetchResponse=a,e._resetTimers(!1),e._connect()}),(function(a){e._resetTimers(!0),e._destroyed||e.emit("error",a)}))}else{var o=e._xhr=new t.g.XMLHttpRequest;try{o.open(e._opts.method,e._opts.url,!0)}catch(a){return void process.nextTick((function(){e.emit("error",a)}))}"responseType"in o&&(o.responseType=e._mode),"withCredentials"in o&&(o.withCredentials=!!a.withCredentials),"text"===e._mode&&"overrideMimeType"in o&&o.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in a&&(o.timeout=a.requestTimeout,o.ontimeout=function(){e.emit("requestTimeout")}),r.forEach((function(e){o.setRequestHeader(e[0],e[1])})),e._response=null,o.onreadystatechange=function(){switch(o.readyState){case b.LOADING:case b.DONE:e._onXHRProgress()}},"moz-chunked-arraybuffer"===e._mode&&(o.onprogress=function(){e._onXHRProgress()}),o.onerror=function(){e._destroyed||(e._resetTimers(!0),e.emit("error",new Error("XHR error")))};try{o.send(d)}catch(a){return void process.nextTick((function(){e.emit("error",a)}))}}}},o.prototype._onXHRProgress=function(){var e=this;e._resetTimers(!1),function(e){try{var a=e.status;return null!==a&&0!==a}catch(e){return!1}}(e._xhr)&&!e._destroyed&&(e._response||e._connect(),e._response._onXHRProgress(e._resetTimers.bind(e)))},o.prototype._connect=function(){var e=this;e._destroyed||(e._response=new i(e._xhr,e._fetchResponse,e._mode,e._resetTimers.bind(e)),e._response.on("error",(function(a){e.emit("error",a)})),e.emit("response",e._response))},o.prototype._write=function(e,a,t){this._body.push(e),t()},o.prototype._resetTimers=function(e){var a=this;t.g.clearTimeout(a._socketTimer),a._socketTimer=null,e?(t.g.clearTimeout(a._fetchTimer),a._fetchTimer=null):a._socketTimeout&&(a._socketTimer=t.g.setTimeout((function(){a.emit("timeout")}),a._socketTimeout))},o.prototype.abort=o.prototype.destroy=function(e){var a=this;a._destroyed=!0,a._resetTimers(!0),a._response&&(a._response._destroyed=!0),a._xhr?a._xhr.abort():a._fetchAbortController&&a._fetchAbortController.abort(),e&&a.emit("error",e)},o.prototype.end=function(e,a,t){"function"==typeof e&&(t=e,e=void 0),n.Writable.prototype.end.call(this,e,a,t)},o.prototype.setTimeout=function(e,a){var t=this;a&&t.once("timeout",a),t._socketTimeout=e,t._resetTimers(!1)},o.prototype.flushHeaders=function(){},o.prototype.setNoDelay=function(){},o.prototype.setSocketKeepAlive=function(){};var s=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]},6917:(e,a,t)=>{var c=t(62045).hp,f=t(6688),d=t(56698),r=t(28399),n=a.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},i=a.IncomingMessage=function(e,a,t,d){var n=this;if(r.Readable.call(n),n._mode=t,n.headers={},n.rawHeaders=[],n.trailers={},n.rawTrailers=[],n.on("end",(function(){process.nextTick((function(){n.emit("close")}))})),"fetch"===t){if(n._fetchResponse=a,n.url=a.url,n.statusCode=a.status,n.statusMessage=a.statusText,a.headers.forEach((function(e,a){n.headers[a.toLowerCase()]=e,n.rawHeaders.push(a,e)})),f.writableStream){var i=new WritableStream({write:function(e){return d(!1),new Promise((function(a,t){n._destroyed?t():n.push(c.from(e))?a():n._resumeFetch=a}))},close:function(){d(!0),n._destroyed||n.push(null)},abort:function(e){d(!0),n._destroyed||n.emit("error",e)}});try{return void a.body.pipeTo(i).catch((function(e){d(!0),n._destroyed||n.emit("error",e)}))}catch(e){}}var b=a.body.getReader();!function e(){b.read().then((function(a){n._destroyed||(d(a.done),a.done?n.push(null):(n.push(c.from(a.value)),e()))})).catch((function(e){d(!0),n._destroyed||n.emit("error",e)}))}()}else if(n._xhr=e,n._pos=0,n.url=e.responseURL,n.statusCode=e.status,n.statusMessage=e.statusText,e.getAllResponseHeaders().split(/\r?\n/).forEach((function(e){var a=e.match(/^([^:]+):\s*(.*)/);if(a){var t=a[1].toLowerCase();"set-cookie"===t?(void 0===n.headers[t]&&(n.headers[t]=[]),n.headers[t].push(a[2])):void 0!==n.headers[t]?n.headers[t]+=", "+a[2]:n.headers[t]=a[2],n.rawHeaders.push(a[1],a[2])}})),n._charset="x-user-defined",!f.overrideMimeType){var o=n.rawHeaders["mime-type"];if(o){var s=o.match(/;\s*charset=([^;])(;|$)/);s&&(n._charset=s[1].toLowerCase())}n._charset||(n._charset="utf-8")}};d(i,r.Readable),i.prototype._read=function(){var e=this._resumeFetch;e&&(this._resumeFetch=null,e())},i.prototype._onXHRProgress=function(e){var a=this,f=a._xhr,d=null;switch(a._mode){case"text":if((d=f.responseText).length>a._pos){var r=d.substr(a._pos);if("x-user-defined"===a._charset){for(var i=c.alloc(r.length),b=0;ba._pos&&(a.push(c.from(new Uint8Array(o.result.slice(a._pos)))),a._pos=o.result.byteLength)},o.onload=function(){e(!0),a.push(null)},o.readAsArrayBuffer(d)}a._xhr.readyState===n.DONE&&"ms-stream"!==a._mode&&(e(!0),a.push(null))}},83141:(e,a,t)=>{"use strict";var c=t(92861).Buffer,f=c.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function d(e){var a;switch(this.encoding=function(e){var a=function(e){if(!e)return"utf8";for(var a;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(a)return;e=(""+e).toLowerCase(),a=!0}}(e);if("string"!=typeof a&&(c.isEncoding===f||!f(e)))throw new Error("Unknown encoding: "+e);return a||e}(e),this.encoding){case"utf16le":this.text=i,this.end=b,a=4;break;case"utf8":this.fillLast=n,a=4;break;case"base64":this.text=o,this.end=s,a=3;break;default:return this.write=l,void(this.end=u)}this.lastNeed=0,this.lastTotal=0,this.lastChar=c.allocUnsafe(a)}function r(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function n(e){var a=this.lastTotal-this.lastNeed,t=function(e,a){if(128!=(192&a[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&a.length>1){if(128!=(192&a[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&a.length>2&&128!=(192&a[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==t?t:this.lastNeed<=e.length?(e.copy(this.lastChar,a,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,a,0,e.length),void(this.lastNeed-=e.length))}function i(e,a){if((e.length-a)%2==0){var t=e.toString("utf16le",a);if(t){var c=t.charCodeAt(t.length-1);if(c>=55296&&c<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],t.slice(0,-1)}return t}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",a,e.length-1)}function b(e){var a=e&&e.length?this.write(e):"";if(this.lastNeed){var t=this.lastTotal-this.lastNeed;return a+this.lastChar.toString("utf16le",0,t)}return a}function o(e,a){var t=(e.length-a)%3;return 0===t?e.toString("base64",a):(this.lastNeed=3-t,this.lastTotal=3,1===t?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",a,e.length-t))}function s(e){var a=e&&e.length?this.write(e):"";return this.lastNeed?a+this.lastChar.toString("base64",0,3-this.lastNeed):a}function l(e){return e.toString(this.encoding)}function u(e){return e&&e.length?this.write(e):""}a.I=d,d.prototype.write=function(e){if(0===e.length)return"";var a,t;if(this.lastNeed){if(void 0===(a=this.fillLast(e)))return"";t=this.lastNeed,this.lastNeed=0}else t=0;return t=0?(f>0&&(e.lastNeed=f-1),f):--c=0?(f>0&&(e.lastNeed=f-2),f):--c=0?(f>0&&(2===f?f=0:e.lastNeed=f-3),f):0}(this,e,a);if(!this.lastNeed)return e.toString("utf8",a);this.lastTotal=t;var c=e.length-(t-this.lastNeed);return e.copy(this.lastChar,0,c),e.toString("utf8",a,c)},d.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},88947:(e,a,t)=>{!function(e){"use strict";var a=function(e){var a,t=new Float64Array(16);if(e)for(a=0;a>24&255,e[a+1]=t>>16&255,e[a+2]=t>>8&255,e[a+3]=255&t,e[a+4]=c>>24&255,e[a+5]=c>>16&255,e[a+6]=c>>8&255,e[a+7]=255&c}function p(e,a,t,c,f){var d,r=0;for(d=0;d>>8)-1}function g(e,a,t,c){return p(e,a,t,c,16)}function m(e,a,t,c){return p(e,a,t,c,32)}function x(e,a,t,c){!function(e,a,t,c){for(var f,d=255&c[0]|(255&c[1])<<8|(255&c[2])<<16|(255&c[3])<<24,r=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,n=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,i=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,b=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,o=255&c[4]|(255&c[5])<<8|(255&c[6])<<16|(255&c[7])<<24,s=255&a[0]|(255&a[1])<<8|(255&a[2])<<16|(255&a[3])<<24,l=255&a[4]|(255&a[5])<<8|(255&a[6])<<16|(255&a[7])<<24,u=255&a[8]|(255&a[9])<<8|(255&a[10])<<16|(255&a[11])<<24,h=255&a[12]|(255&a[13])<<8|(255&a[14])<<16|(255&a[15])<<24,p=255&c[8]|(255&c[9])<<8|(255&c[10])<<16|(255&c[11])<<24,g=255&t[16]|(255&t[17])<<8|(255&t[18])<<16|(255&t[19])<<24,m=255&t[20]|(255&t[21])<<8|(255&t[22])<<16|(255&t[23])<<24,x=255&t[24]|(255&t[25])<<8|(255&t[26])<<16|(255&t[27])<<24,y=255&t[28]|(255&t[29])<<8|(255&t[30])<<16|(255&t[31])<<24,A=255&c[12]|(255&c[13])<<8|(255&c[14])<<16|(255&c[15])<<24,v=d,w=r,_=n,I=i,E=b,C=o,M=s,B=l,k=u,L=h,S=p,T=g,N=m,R=x,P=y,D=A,O=0;O<20;O+=2)v^=(f=(N^=(f=(k^=(f=(E^=(f=v+N|0)<<7|f>>>25)+v|0)<<9|f>>>23)+E|0)<<13|f>>>19)+k|0)<<18|f>>>14,C^=(f=(w^=(f=(R^=(f=(L^=(f=C+w|0)<<7|f>>>25)+C|0)<<9|f>>>23)+L|0)<<13|f>>>19)+R|0)<<18|f>>>14,S^=(f=(M^=(f=(_^=(f=(P^=(f=S+M|0)<<7|f>>>25)+S|0)<<9|f>>>23)+P|0)<<13|f>>>19)+_|0)<<18|f>>>14,D^=(f=(T^=(f=(B^=(f=(I^=(f=D+T|0)<<7|f>>>25)+D|0)<<9|f>>>23)+I|0)<<13|f>>>19)+B|0)<<18|f>>>14,v^=(f=(I^=(f=(_^=(f=(w^=(f=v+I|0)<<7|f>>>25)+v|0)<<9|f>>>23)+w|0)<<13|f>>>19)+_|0)<<18|f>>>14,C^=(f=(E^=(f=(B^=(f=(M^=(f=C+E|0)<<7|f>>>25)+C|0)<<9|f>>>23)+M|0)<<13|f>>>19)+B|0)<<18|f>>>14,S^=(f=(L^=(f=(k^=(f=(T^=(f=S+L|0)<<7|f>>>25)+S|0)<<9|f>>>23)+T|0)<<13|f>>>19)+k|0)<<18|f>>>14,D^=(f=(P^=(f=(R^=(f=(N^=(f=D+P|0)<<7|f>>>25)+D|0)<<9|f>>>23)+N|0)<<13|f>>>19)+R|0)<<18|f>>>14;v=v+d|0,w=w+r|0,_=_+n|0,I=I+i|0,E=E+b|0,C=C+o|0,M=M+s|0,B=B+l|0,k=k+u|0,L=L+h|0,S=S+p|0,T=T+g|0,N=N+m|0,R=R+x|0,P=P+y|0,D=D+A|0,e[0]=v>>>0&255,e[1]=v>>>8&255,e[2]=v>>>16&255,e[3]=v>>>24&255,e[4]=w>>>0&255,e[5]=w>>>8&255,e[6]=w>>>16&255,e[7]=w>>>24&255,e[8]=_>>>0&255,e[9]=_>>>8&255,e[10]=_>>>16&255,e[11]=_>>>24&255,e[12]=I>>>0&255,e[13]=I>>>8&255,e[14]=I>>>16&255,e[15]=I>>>24&255,e[16]=E>>>0&255,e[17]=E>>>8&255,e[18]=E>>>16&255,e[19]=E>>>24&255,e[20]=C>>>0&255,e[21]=C>>>8&255,e[22]=C>>>16&255,e[23]=C>>>24&255,e[24]=M>>>0&255,e[25]=M>>>8&255,e[26]=M>>>16&255,e[27]=M>>>24&255,e[28]=B>>>0&255,e[29]=B>>>8&255,e[30]=B>>>16&255,e[31]=B>>>24&255,e[32]=k>>>0&255,e[33]=k>>>8&255,e[34]=k>>>16&255,e[35]=k>>>24&255,e[36]=L>>>0&255,e[37]=L>>>8&255,e[38]=L>>>16&255,e[39]=L>>>24&255,e[40]=S>>>0&255,e[41]=S>>>8&255,e[42]=S>>>16&255,e[43]=S>>>24&255,e[44]=T>>>0&255,e[45]=T>>>8&255,e[46]=T>>>16&255,e[47]=T>>>24&255,e[48]=N>>>0&255,e[49]=N>>>8&255,e[50]=N>>>16&255,e[51]=N>>>24&255,e[52]=R>>>0&255,e[53]=R>>>8&255,e[54]=R>>>16&255,e[55]=R>>>24&255,e[56]=P>>>0&255,e[57]=P>>>8&255,e[58]=P>>>16&255,e[59]=P>>>24&255,e[60]=D>>>0&255,e[61]=D>>>8&255,e[62]=D>>>16&255,e[63]=D>>>24&255}(e,a,t,c)}function y(e,a,t,c){!function(e,a,t,c){for(var f,d=255&c[0]|(255&c[1])<<8|(255&c[2])<<16|(255&c[3])<<24,r=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,n=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,i=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,b=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,o=255&c[4]|(255&c[5])<<8|(255&c[6])<<16|(255&c[7])<<24,s=255&a[0]|(255&a[1])<<8|(255&a[2])<<16|(255&a[3])<<24,l=255&a[4]|(255&a[5])<<8|(255&a[6])<<16|(255&a[7])<<24,u=255&a[8]|(255&a[9])<<8|(255&a[10])<<16|(255&a[11])<<24,h=255&a[12]|(255&a[13])<<8|(255&a[14])<<16|(255&a[15])<<24,p=255&c[8]|(255&c[9])<<8|(255&c[10])<<16|(255&c[11])<<24,g=255&t[16]|(255&t[17])<<8|(255&t[18])<<16|(255&t[19])<<24,m=255&t[20]|(255&t[21])<<8|(255&t[22])<<16|(255&t[23])<<24,x=255&t[24]|(255&t[25])<<8|(255&t[26])<<16|(255&t[27])<<24,y=255&t[28]|(255&t[29])<<8|(255&t[30])<<16|(255&t[31])<<24,A=255&c[12]|(255&c[13])<<8|(255&c[14])<<16|(255&c[15])<<24,v=0;v<20;v+=2)d^=(f=(m^=(f=(u^=(f=(b^=(f=d+m|0)<<7|f>>>25)+d|0)<<9|f>>>23)+b|0)<<13|f>>>19)+u|0)<<18|f>>>14,o^=(f=(r^=(f=(x^=(f=(h^=(f=o+r|0)<<7|f>>>25)+o|0)<<9|f>>>23)+h|0)<<13|f>>>19)+x|0)<<18|f>>>14,p^=(f=(s^=(f=(n^=(f=(y^=(f=p+s|0)<<7|f>>>25)+p|0)<<9|f>>>23)+y|0)<<13|f>>>19)+n|0)<<18|f>>>14,A^=(f=(g^=(f=(l^=(f=(i^=(f=A+g|0)<<7|f>>>25)+A|0)<<9|f>>>23)+i|0)<<13|f>>>19)+l|0)<<18|f>>>14,d^=(f=(i^=(f=(n^=(f=(r^=(f=d+i|0)<<7|f>>>25)+d|0)<<9|f>>>23)+r|0)<<13|f>>>19)+n|0)<<18|f>>>14,o^=(f=(b^=(f=(l^=(f=(s^=(f=o+b|0)<<7|f>>>25)+o|0)<<9|f>>>23)+s|0)<<13|f>>>19)+l|0)<<18|f>>>14,p^=(f=(h^=(f=(u^=(f=(g^=(f=p+h|0)<<7|f>>>25)+p|0)<<9|f>>>23)+g|0)<<13|f>>>19)+u|0)<<18|f>>>14,A^=(f=(y^=(f=(x^=(f=(m^=(f=A+y|0)<<7|f>>>25)+A|0)<<9|f>>>23)+m|0)<<13|f>>>19)+x|0)<<18|f>>>14;e[0]=d>>>0&255,e[1]=d>>>8&255,e[2]=d>>>16&255,e[3]=d>>>24&255,e[4]=o>>>0&255,e[5]=o>>>8&255,e[6]=o>>>16&255,e[7]=o>>>24&255,e[8]=p>>>0&255,e[9]=p>>>8&255,e[10]=p>>>16&255,e[11]=p>>>24&255,e[12]=A>>>0&255,e[13]=A>>>8&255,e[14]=A>>>16&255,e[15]=A>>>24&255,e[16]=s>>>0&255,e[17]=s>>>8&255,e[18]=s>>>16&255,e[19]=s>>>24&255,e[20]=l>>>0&255,e[21]=l>>>8&255,e[22]=l>>>16&255,e[23]=l>>>24&255,e[24]=u>>>0&255,e[25]=u>>>8&255,e[26]=u>>>16&255,e[27]=u>>>24&255,e[28]=h>>>0&255,e[29]=h>>>8&255,e[30]=h>>>16&255,e[31]=h>>>24&255}(e,a,t,c)}var A=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function v(e,a,t,c,f,d,r){var n,i,b=new Uint8Array(16),o=new Uint8Array(64);for(i=0;i<16;i++)b[i]=0;for(i=0;i<8;i++)b[i]=d[i];for(;f>=64;){for(x(o,b,r,A),i=0;i<64;i++)e[a+i]=t[c+i]^o[i];for(n=1,i=8;i<16;i++)n=n+(255&b[i])|0,b[i]=255&n,n>>>=8;f-=64,a+=64,c+=64}if(f>0)for(x(o,b,r,A),i=0;i=64;){for(x(i,n,f,A),r=0;r<64;r++)e[a+r]=i[r];for(d=1,r=8;r<16;r++)d=d+(255&n[r])|0,n[r]=255&d,d>>>=8;t-=64,a+=64}if(t>0)for(x(i,n,f,A),r=0;r>>13|t<<3),c=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(t>>>10|c<<6),f=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(c>>>7|f<<9),d=255&e[8]|(255&e[9])<<8,this.r[4]=255&(f>>>4|d<<12),this.r[5]=d>>>1&8190,r=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(d>>>14|r<<2),n=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(r>>>11|n<<5),i=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(n>>>8|i<<8),this.r[9]=i>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function C(e,a,t,c,f,d){var r=new E(d);return r.update(t,c,f),r.finish(e,a),0}function M(e,a,t,c,f,d){var r=new Uint8Array(16);return C(r,0,t,c,f,d),g(e,a,r,0)}function B(e,a,t,c,f){var d;if(t<32)return-1;for(I(e,0,a,0,t,c,f),C(e,16,e,32,t-32,e),d=0;d<16;d++)e[d]=0;return 0}function k(e,a,t,c,f){var d,r=new Uint8Array(32);if(t<32)return-1;if(_(r,0,32,c,f),0!==M(a,16,a,32,t-32,r))return-1;for(I(e,0,a,0,t,c,f),d=0;d<32;d++)e[d]=0;return 0}function L(e,a){var t;for(t=0;t<16;t++)e[t]=0|a[t]}function S(e){var a,t,c=1;for(a=0;a<16;a++)t=e[a]+c+65535,c=Math.floor(t/65536),e[a]=t-65536*c;e[0]+=c-1+37*(c-1)}function T(e,a,t){for(var c,f=~(t-1),d=0;d<16;d++)c=f&(e[d]^a[d]),e[d]^=c,a[d]^=c}function N(e,t){var c,f,d,r=a(),n=a();for(c=0;c<16;c++)n[c]=t[c];for(S(n),S(n),S(n),f=0;f<2;f++){for(r[0]=n[0]-65517,c=1;c<15;c++)r[c]=n[c]-65535-(r[c-1]>>16&1),r[c-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1),d=r[15]>>16&1,r[14]&=65535,T(n,r,1-d)}for(c=0;c<16;c++)e[2*c]=255&n[c],e[2*c+1]=n[c]>>8}function R(e,a){var t=new Uint8Array(32),c=new Uint8Array(32);return N(t,e),N(c,a),m(t,0,c,0)}function P(e){var a=new Uint8Array(32);return N(a,e),1&a[0]}function D(e,a){var t;for(t=0;t<16;t++)e[t]=a[2*t]+(a[2*t+1]<<8);e[15]&=32767}function O(e,a,t){for(var c=0;c<16;c++)e[c]=a[c]+t[c]}function F(e,a,t){for(var c=0;c<16;c++)e[c]=a[c]-t[c]}function Q(e,a,t){var c,f,d=0,r=0,n=0,i=0,b=0,o=0,s=0,l=0,u=0,h=0,p=0,g=0,m=0,x=0,y=0,A=0,v=0,w=0,_=0,I=0,E=0,C=0,M=0,B=0,k=0,L=0,S=0,T=0,N=0,R=0,P=0,D=t[0],O=t[1],F=t[2],Q=t[3],U=t[4],j=t[5],H=t[6],q=t[7],$=t[8],z=t[9],G=t[10],K=t[11],V=t[12],Z=t[13],J=t[14],W=t[15];d+=(c=a[0])*D,r+=c*O,n+=c*F,i+=c*Q,b+=c*U,o+=c*j,s+=c*H,l+=c*q,u+=c*$,h+=c*z,p+=c*G,g+=c*K,m+=c*V,x+=c*Z,y+=c*J,A+=c*W,r+=(c=a[1])*D,n+=c*O,i+=c*F,b+=c*Q,o+=c*U,s+=c*j,l+=c*H,u+=c*q,h+=c*$,p+=c*z,g+=c*G,m+=c*K,x+=c*V,y+=c*Z,A+=c*J,v+=c*W,n+=(c=a[2])*D,i+=c*O,b+=c*F,o+=c*Q,s+=c*U,l+=c*j,u+=c*H,h+=c*q,p+=c*$,g+=c*z,m+=c*G,x+=c*K,y+=c*V,A+=c*Z,v+=c*J,w+=c*W,i+=(c=a[3])*D,b+=c*O,o+=c*F,s+=c*Q,l+=c*U,u+=c*j,h+=c*H,p+=c*q,g+=c*$,m+=c*z,x+=c*G,y+=c*K,A+=c*V,v+=c*Z,w+=c*J,_+=c*W,b+=(c=a[4])*D,o+=c*O,s+=c*F,l+=c*Q,u+=c*U,h+=c*j,p+=c*H,g+=c*q,m+=c*$,x+=c*z,y+=c*G,A+=c*K,v+=c*V,w+=c*Z,_+=c*J,I+=c*W,o+=(c=a[5])*D,s+=c*O,l+=c*F,u+=c*Q,h+=c*U,p+=c*j,g+=c*H,m+=c*q,x+=c*$,y+=c*z,A+=c*G,v+=c*K,w+=c*V,_+=c*Z,I+=c*J,E+=c*W,s+=(c=a[6])*D,l+=c*O,u+=c*F,h+=c*Q,p+=c*U,g+=c*j,m+=c*H,x+=c*q,y+=c*$,A+=c*z,v+=c*G,w+=c*K,_+=c*V,I+=c*Z,E+=c*J,C+=c*W,l+=(c=a[7])*D,u+=c*O,h+=c*F,p+=c*Q,g+=c*U,m+=c*j,x+=c*H,y+=c*q,A+=c*$,v+=c*z,w+=c*G,_+=c*K,I+=c*V,E+=c*Z,C+=c*J,M+=c*W,u+=(c=a[8])*D,h+=c*O,p+=c*F,g+=c*Q,m+=c*U,x+=c*j,y+=c*H,A+=c*q,v+=c*$,w+=c*z,_+=c*G,I+=c*K,E+=c*V,C+=c*Z,M+=c*J,B+=c*W,h+=(c=a[9])*D,p+=c*O,g+=c*F,m+=c*Q,x+=c*U,y+=c*j,A+=c*H,v+=c*q,w+=c*$,_+=c*z,I+=c*G,E+=c*K,C+=c*V,M+=c*Z,B+=c*J,k+=c*W,p+=(c=a[10])*D,g+=c*O,m+=c*F,x+=c*Q,y+=c*U,A+=c*j,v+=c*H,w+=c*q,_+=c*$,I+=c*z,E+=c*G,C+=c*K,M+=c*V,B+=c*Z,k+=c*J,L+=c*W,g+=(c=a[11])*D,m+=c*O,x+=c*F,y+=c*Q,A+=c*U,v+=c*j,w+=c*H,_+=c*q,I+=c*$,E+=c*z,C+=c*G,M+=c*K,B+=c*V,k+=c*Z,L+=c*J,S+=c*W,m+=(c=a[12])*D,x+=c*O,y+=c*F,A+=c*Q,v+=c*U,w+=c*j,_+=c*H,I+=c*q,E+=c*$,C+=c*z,M+=c*G,B+=c*K,k+=c*V,L+=c*Z,S+=c*J,T+=c*W,x+=(c=a[13])*D,y+=c*O,A+=c*F,v+=c*Q,w+=c*U,_+=c*j,I+=c*H,E+=c*q,C+=c*$,M+=c*z,B+=c*G,k+=c*K,L+=c*V,S+=c*Z,T+=c*J,N+=c*W,y+=(c=a[14])*D,A+=c*O,v+=c*F,w+=c*Q,_+=c*U,I+=c*j,E+=c*H,C+=c*q,M+=c*$,B+=c*z,k+=c*G,L+=c*K,S+=c*V,T+=c*Z,N+=c*J,R+=c*W,A+=(c=a[15])*D,r+=38*(w+=c*F),n+=38*(_+=c*Q),i+=38*(I+=c*U),b+=38*(E+=c*j),o+=38*(C+=c*H),s+=38*(M+=c*q),l+=38*(B+=c*$),u+=38*(k+=c*z),h+=38*(L+=c*G),p+=38*(S+=c*K),g+=38*(T+=c*V),m+=38*(N+=c*Z),x+=38*(R+=c*J),y+=38*(P+=c*W),d=(c=(d+=38*(v+=c*O))+(f=1)+65535)-65536*(f=Math.floor(c/65536)),r=(c=r+f+65535)-65536*(f=Math.floor(c/65536)),n=(c=n+f+65535)-65536*(f=Math.floor(c/65536)),i=(c=i+f+65535)-65536*(f=Math.floor(c/65536)),b=(c=b+f+65535)-65536*(f=Math.floor(c/65536)),o=(c=o+f+65535)-65536*(f=Math.floor(c/65536)),s=(c=s+f+65535)-65536*(f=Math.floor(c/65536)),l=(c=l+f+65535)-65536*(f=Math.floor(c/65536)),u=(c=u+f+65535)-65536*(f=Math.floor(c/65536)),h=(c=h+f+65535)-65536*(f=Math.floor(c/65536)),p=(c=p+f+65535)-65536*(f=Math.floor(c/65536)),g=(c=g+f+65535)-65536*(f=Math.floor(c/65536)),m=(c=m+f+65535)-65536*(f=Math.floor(c/65536)),x=(c=x+f+65535)-65536*(f=Math.floor(c/65536)),y=(c=y+f+65535)-65536*(f=Math.floor(c/65536)),A=(c=A+f+65535)-65536*(f=Math.floor(c/65536)),d=(c=(d+=f-1+37*(f-1))+(f=1)+65535)-65536*(f=Math.floor(c/65536)),r=(c=r+f+65535)-65536*(f=Math.floor(c/65536)),n=(c=n+f+65535)-65536*(f=Math.floor(c/65536)),i=(c=i+f+65535)-65536*(f=Math.floor(c/65536)),b=(c=b+f+65535)-65536*(f=Math.floor(c/65536)),o=(c=o+f+65535)-65536*(f=Math.floor(c/65536)),s=(c=s+f+65535)-65536*(f=Math.floor(c/65536)),l=(c=l+f+65535)-65536*(f=Math.floor(c/65536)),u=(c=u+f+65535)-65536*(f=Math.floor(c/65536)),h=(c=h+f+65535)-65536*(f=Math.floor(c/65536)),p=(c=p+f+65535)-65536*(f=Math.floor(c/65536)),g=(c=g+f+65535)-65536*(f=Math.floor(c/65536)),m=(c=m+f+65535)-65536*(f=Math.floor(c/65536)),x=(c=x+f+65535)-65536*(f=Math.floor(c/65536)),y=(c=y+f+65535)-65536*(f=Math.floor(c/65536)),A=(c=A+f+65535)-65536*(f=Math.floor(c/65536)),d+=f-1+37*(f-1),e[0]=d,e[1]=r,e[2]=n,e[3]=i,e[4]=b,e[5]=o,e[6]=s,e[7]=l,e[8]=u,e[9]=h,e[10]=p,e[11]=g,e[12]=m,e[13]=x,e[14]=y,e[15]=A}function U(e,a){Q(e,a,a)}function j(e,t){var c,f=a();for(c=0;c<16;c++)f[c]=t[c];for(c=253;c>=0;c--)U(f,f),2!==c&&4!==c&&Q(f,f,t);for(c=0;c<16;c++)e[c]=f[c]}function H(e,t){var c,f=a();for(c=0;c<16;c++)f[c]=t[c];for(c=250;c>=0;c--)U(f,f),1!==c&&Q(f,f,t);for(c=0;c<16;c++)e[c]=f[c]}function q(e,t,c){var f,d,r=new Uint8Array(32),n=new Float64Array(80),b=a(),o=a(),s=a(),l=a(),u=a(),h=a();for(d=0;d<31;d++)r[d]=t[d];for(r[31]=127&t[31]|64,r[0]&=248,D(n,c),d=0;d<16;d++)o[d]=n[d],l[d]=b[d]=s[d]=0;for(b[0]=l[0]=1,d=254;d>=0;--d)T(b,o,f=r[d>>>3]>>>(7&d)&1),T(s,l,f),O(u,b,s),F(b,b,s),O(s,o,l),F(o,o,l),U(l,u),U(h,b),Q(b,s,b),Q(s,o,u),O(u,b,s),F(b,b,s),U(o,b),F(s,l,h),Q(b,s,i),O(b,b,l),Q(s,s,b),Q(b,l,h),Q(l,o,n),U(o,u),T(b,o,f),T(s,l,f);for(d=0;d<16;d++)n[d+16]=b[d],n[d+32]=s[d],n[d+48]=o[d],n[d+64]=l[d];var p=n.subarray(32),g=n.subarray(16);return j(p,p),Q(g,g,p),N(e,g),0}function $(e,a){return q(e,a,d)}function z(e,a){return c(a,32),$(e,a)}function G(e,a,t){var c=new Uint8Array(32);return q(c,t,a),y(e,f,c,A)}E.prototype.blocks=function(e,a,t){for(var c,f,d,r,n,i,b,o,s,l,u,h,p,g,m,x,y,A,v,w=this.fin?0:2048,_=this.h[0],I=this.h[1],E=this.h[2],C=this.h[3],M=this.h[4],B=this.h[5],k=this.h[6],L=this.h[7],S=this.h[8],T=this.h[9],N=this.r[0],R=this.r[1],P=this.r[2],D=this.r[3],O=this.r[4],F=this.r[5],Q=this.r[6],U=this.r[7],j=this.r[8],H=this.r[9];t>=16;)l=s=0,l+=(_+=8191&(c=255&e[a+0]|(255&e[a+1])<<8))*N,l+=(I+=8191&(c>>>13|(f=255&e[a+2]|(255&e[a+3])<<8)<<3))*(5*H),l+=(E+=8191&(f>>>10|(d=255&e[a+4]|(255&e[a+5])<<8)<<6))*(5*j),l+=(C+=8191&(d>>>7|(r=255&e[a+6]|(255&e[a+7])<<8)<<9))*(5*U),s=(l+=(M+=8191&(r>>>4|(n=255&e[a+8]|(255&e[a+9])<<8)<<12))*(5*Q))>>>13,l&=8191,l+=(B+=n>>>1&8191)*(5*F),l+=(k+=8191&(n>>>14|(i=255&e[a+10]|(255&e[a+11])<<8)<<2))*(5*O),l+=(L+=8191&(i>>>11|(b=255&e[a+12]|(255&e[a+13])<<8)<<5))*(5*D),l+=(S+=8191&(b>>>8|(o=255&e[a+14]|(255&e[a+15])<<8)<<8))*(5*P),u=s+=(l+=(T+=o>>>5|w)*(5*R))>>>13,u+=_*R,u+=I*N,u+=E*(5*H),u+=C*(5*j),s=(u+=M*(5*U))>>>13,u&=8191,u+=B*(5*Q),u+=k*(5*F),u+=L*(5*O),u+=S*(5*D),s+=(u+=T*(5*P))>>>13,u&=8191,h=s,h+=_*P,h+=I*R,h+=E*N,h+=C*(5*H),s=(h+=M*(5*j))>>>13,h&=8191,h+=B*(5*U),h+=k*(5*Q),h+=L*(5*F),h+=S*(5*O),p=s+=(h+=T*(5*D))>>>13,p+=_*D,p+=I*P,p+=E*R,p+=C*N,s=(p+=M*(5*H))>>>13,p&=8191,p+=B*(5*j),p+=k*(5*U),p+=L*(5*Q),p+=S*(5*F),g=s+=(p+=T*(5*O))>>>13,g+=_*O,g+=I*D,g+=E*P,g+=C*R,s=(g+=M*N)>>>13,g&=8191,g+=B*(5*H),g+=k*(5*j),g+=L*(5*U),g+=S*(5*Q),m=s+=(g+=T*(5*F))>>>13,m+=_*F,m+=I*O,m+=E*D,m+=C*P,s=(m+=M*R)>>>13,m&=8191,m+=B*N,m+=k*(5*H),m+=L*(5*j),m+=S*(5*U),x=s+=(m+=T*(5*Q))>>>13,x+=_*Q,x+=I*F,x+=E*O,x+=C*D,s=(x+=M*P)>>>13,x&=8191,x+=B*R,x+=k*N,x+=L*(5*H),x+=S*(5*j),y=s+=(x+=T*(5*U))>>>13,y+=_*U,y+=I*Q,y+=E*F,y+=C*O,s=(y+=M*D)>>>13,y&=8191,y+=B*P,y+=k*R,y+=L*N,y+=S*(5*H),A=s+=(y+=T*(5*j))>>>13,A+=_*j,A+=I*U,A+=E*Q,A+=C*F,s=(A+=M*O)>>>13,A&=8191,A+=B*D,A+=k*P,A+=L*R,A+=S*N,v=s+=(A+=T*(5*H))>>>13,v+=_*H,v+=I*j,v+=E*U,v+=C*Q,s=(v+=M*F)>>>13,v&=8191,v+=B*O,v+=k*D,v+=L*P,v+=S*R,_=l=8191&(s=(s=((s+=(v+=T*N)>>>13)<<2)+s|0)+(l&=8191)|0),I=u+=s>>>=13,E=h&=8191,C=p&=8191,M=g&=8191,B=m&=8191,k=x&=8191,L=y&=8191,S=A&=8191,T=v&=8191,a+=16,t-=16;this.h[0]=_,this.h[1]=I,this.h[2]=E,this.h[3]=C,this.h[4]=M,this.h[5]=B,this.h[6]=k,this.h[7]=L,this.h[8]=S,this.h[9]=T},E.prototype.finish=function(e,a){var t,c,f,d,r=new Uint16Array(10);if(this.leftover){for(d=this.leftover,this.buffer[d++]=1;d<16;d++)this.buffer[d]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(t=this.h[1]>>>13,this.h[1]&=8191,d=2;d<10;d++)this.h[d]+=t,t=this.h[d]>>>13,this.h[d]&=8191;for(this.h[0]+=5*t,t=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=t,t=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=t,r[0]=this.h[0]+5,t=r[0]>>>13,r[0]&=8191,d=1;d<10;d++)r[d]=this.h[d]+t,t=r[d]>>>13,r[d]&=8191;for(r[9]-=8192,c=(1^t)-1,d=0;d<10;d++)r[d]&=c;for(c=~c,d=0;d<10;d++)this.h[d]=this.h[d]&c|r[d];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),f=this.h[0]+this.pad[0],this.h[0]=65535&f,d=1;d<8;d++)f=(this.h[d]+this.pad[d]|0)+(f>>>16)|0,this.h[d]=65535&f;e[a+0]=this.h[0]>>>0&255,e[a+1]=this.h[0]>>>8&255,e[a+2]=this.h[1]>>>0&255,e[a+3]=this.h[1]>>>8&255,e[a+4]=this.h[2]>>>0&255,e[a+5]=this.h[2]>>>8&255,e[a+6]=this.h[3]>>>0&255,e[a+7]=this.h[3]>>>8&255,e[a+8]=this.h[4]>>>0&255,e[a+9]=this.h[4]>>>8&255,e[a+10]=this.h[5]>>>0&255,e[a+11]=this.h[5]>>>8&255,e[a+12]=this.h[6]>>>0&255,e[a+13]=this.h[6]>>>8&255,e[a+14]=this.h[7]>>>0&255,e[a+15]=this.h[7]>>>8&255},E.prototype.update=function(e,a,t){var c,f;if(this.leftover){for((f=16-this.leftover)>t&&(f=t),c=0;c=16&&(f=t-t%16,this.blocks(e,a,f),a+=f,t-=f),t){for(c=0;c=128;){for(w=0;w<16;w++)_=8*w+V,L[w]=t[_+0]<<24|t[_+1]<<16|t[_+2]<<8|t[_+3],S[w]=t[_+4]<<24|t[_+5]<<16|t[_+6]<<8|t[_+7];for(w=0;w<80;w++)if(f=T,d=N,r=R,n=P,i=D,b=O,o=F,l=U,u=j,h=H,p=q,g=$,m=z,x=G,C=65535&(E=K),M=E>>>16,B=65535&(I=Q),k=I>>>16,C+=65535&(E=($>>>14|D<<18)^($>>>18|D<<14)^(D>>>9|$<<23)),M+=E>>>16,B+=65535&(I=(D>>>14|$<<18)^(D>>>18|$<<14)^($>>>9|D<<23)),k+=I>>>16,C+=65535&(E=$&z^~$&G),M+=E>>>16,B+=65535&(I=D&O^~D&F),k+=I>>>16,C+=65535&(E=Z[2*w+1]),M+=E>>>16,B+=65535&(I=Z[2*w]),k+=I>>>16,I=L[w%16],M+=(E=S[w%16])>>>16,B+=65535&I,k+=I>>>16,B+=(M+=(C+=65535&E)>>>16)>>>16,C=65535&(E=v=65535&C|M<<16),M=E>>>16,B=65535&(I=A=65535&B|(k+=B>>>16)<<16),k=I>>>16,C+=65535&(E=(U>>>28|T<<4)^(T>>>2|U<<30)^(T>>>7|U<<25)),M+=E>>>16,B+=65535&(I=(T>>>28|U<<4)^(U>>>2|T<<30)^(U>>>7|T<<25)),k+=I>>>16,M+=(E=U&j^U&H^j&H)>>>16,B+=65535&(I=T&N^T&R^N&R),k+=I>>>16,s=65535&(B+=(M+=(C+=65535&E)>>>16)>>>16)|(k+=B>>>16)<<16,y=65535&C|M<<16,C=65535&(E=p),M=E>>>16,B=65535&(I=n),k=I>>>16,M+=(E=v)>>>16,B+=65535&(I=A),k+=I>>>16,N=f,R=d,P=r,D=n=65535&(B+=(M+=(C+=65535&E)>>>16)>>>16)|(k+=B>>>16)<<16,O=i,F=b,Q=o,T=s,j=l,H=u,q=h,$=p=65535&C|M<<16,z=g,G=m,K=x,U=y,w%16==15)for(_=0;_<16;_++)I=L[_],C=65535&(E=S[_]),M=E>>>16,B=65535&I,k=I>>>16,I=L[(_+9)%16],C+=65535&(E=S[(_+9)%16]),M+=E>>>16,B+=65535&I,k+=I>>>16,A=L[(_+1)%16],C+=65535&(E=((v=S[(_+1)%16])>>>1|A<<31)^(v>>>8|A<<24)^(v>>>7|A<<25)),M+=E>>>16,B+=65535&(I=(A>>>1|v<<31)^(A>>>8|v<<24)^A>>>7),k+=I>>>16,A=L[(_+14)%16],M+=(E=((v=S[(_+14)%16])>>>19|A<<13)^(A>>>29|v<<3)^(v>>>6|A<<26))>>>16,B+=65535&(I=(A>>>19|v<<13)^(v>>>29|A<<3)^A>>>6),k+=I>>>16,k+=(B+=(M+=(C+=65535&E)>>>16)>>>16)>>>16,L[_]=65535&B|k<<16,S[_]=65535&C|M<<16;C=65535&(E=U),M=E>>>16,B=65535&(I=T),k=I>>>16,I=e[0],M+=(E=a[0])>>>16,B+=65535&I,k+=I>>>16,k+=(B+=(M+=(C+=65535&E)>>>16)>>>16)>>>16,e[0]=T=65535&B|k<<16,a[0]=U=65535&C|M<<16,C=65535&(E=j),M=E>>>16,B=65535&(I=N),k=I>>>16,I=e[1],M+=(E=a[1])>>>16,B+=65535&I,k+=I>>>16,k+=(B+=(M+=(C+=65535&E)>>>16)>>>16)>>>16,e[1]=N=65535&B|k<<16,a[1]=j=65535&C|M<<16,C=65535&(E=H),M=E>>>16,B=65535&(I=R),k=I>>>16,I=e[2],M+=(E=a[2])>>>16,B+=65535&I,k+=I>>>16,k+=(B+=(M+=(C+=65535&E)>>>16)>>>16)>>>16,e[2]=R=65535&B|k<<16,a[2]=H=65535&C|M<<16,C=65535&(E=q),M=E>>>16,B=65535&(I=P),k=I>>>16,I=e[3],M+=(E=a[3])>>>16,B+=65535&I,k+=I>>>16,k+=(B+=(M+=(C+=65535&E)>>>16)>>>16)>>>16,e[3]=P=65535&B|k<<16,a[3]=q=65535&C|M<<16,C=65535&(E=$),M=E>>>16,B=65535&(I=D),k=I>>>16,I=e[4],M+=(E=a[4])>>>16,B+=65535&I,k+=I>>>16,k+=(B+=(M+=(C+=65535&E)>>>16)>>>16)>>>16,e[4]=D=65535&B|k<<16,a[4]=$=65535&C|M<<16,C=65535&(E=z),M=E>>>16,B=65535&(I=O),k=I>>>16,I=e[5],M+=(E=a[5])>>>16,B+=65535&I,k+=I>>>16,k+=(B+=(M+=(C+=65535&E)>>>16)>>>16)>>>16,e[5]=O=65535&B|k<<16,a[5]=z=65535&C|M<<16,C=65535&(E=G),M=E>>>16,B=65535&(I=F),k=I>>>16,I=e[6],M+=(E=a[6])>>>16,B+=65535&I,k+=I>>>16,k+=(B+=(M+=(C+=65535&E)>>>16)>>>16)>>>16,e[6]=F=65535&B|k<<16,a[6]=G=65535&C|M<<16,C=65535&(E=K),M=E>>>16,B=65535&(I=Q),k=I>>>16,I=e[7],M+=(E=a[7])>>>16,B+=65535&I,k+=I>>>16,k+=(B+=(M+=(C+=65535&E)>>>16)>>>16)>>>16,e[7]=Q=65535&B|k<<16,a[7]=K=65535&C|M<<16,V+=128,c-=128}return c}function W(e,a,t){var c,f=new Int32Array(8),d=new Int32Array(8),r=new Uint8Array(256),n=t;for(f[0]=1779033703,f[1]=3144134277,f[2]=1013904242,f[3]=2773480762,f[4]=1359893119,f[5]=2600822924,f[6]=528734635,f[7]=1541459225,d[0]=4089235720,d[1]=2227873595,d[2]=4271175723,d[3]=1595750129,d[4]=2917565137,d[5]=725511199,d[6]=4215389547,d[7]=327033209,J(f,d,a,t),t%=128,c=0;c=0;--f)X(e,a,c=t[f/8|0]>>(7&f)&1),Y(a,e),Y(e,e),X(e,a,c)}function te(e,t){var c=[a(),a(),a(),a()];L(c[0],s),L(c[1],l),L(c[2],n),Q(c[3],s,l),ae(e,c,t)}function ce(e,t,f){var d,r=new Uint8Array(64),n=[a(),a(),a(),a()];for(f||c(t,32),W(r,t,32),r[0]&=248,r[31]&=127,r[31]|=64,te(n,r),ee(e,n),d=0;d<32;d++)t[d+32]=e[d];return 0}var fe=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function de(e,a){var t,c,f,d;for(c=63;c>=32;--c){for(t=0,f=c-32,d=c-12;f>4)*fe[f],t=a[f]>>8,a[f]&=255;for(f=0;f<32;f++)a[f]-=t*fe[f];for(c=0;c<32;c++)a[c+1]+=a[c]>>8,e[c]=255&a[c]}function re(e){var a,t=new Float64Array(64);for(a=0;a<64;a++)t[a]=e[a];for(a=0;a<64;a++)e[a]=0;de(e,t)}function ne(e,t,c,f){var d,r,n=new Uint8Array(64),i=new Uint8Array(64),b=new Uint8Array(64),o=new Float64Array(64),s=[a(),a(),a(),a()];W(n,f,32),n[0]&=248,n[31]&=127,n[31]|=64;var l=c+64;for(d=0;d>7&&F(e[0],r,e[0]),Q(e[3],e[0],e[1]),0)}(l,f))return-1;for(d=0;d=0},e.sign.keyPair=function(){var e=new Uint8Array(oe),a=new Uint8Array(se);return ce(e,a),{publicKey:e,secretKey:a}},e.sign.keyPair.fromSecretKey=function(e){if(ue(e),e.length!==se)throw new Error("bad secret key size");for(var a=new Uint8Array(oe),t=0;t{function c(e){try{if(!t.g.localStorage)return!1}catch(e){return!1}var a=t.g.localStorage[e];return null!=a&&"true"===String(a).toLowerCase()}e.exports=function(e,a){if(c("noDeprecation"))return e;var t=!1;return function(){if(!t){if(c("throwDeprecation"))throw new Error(a);c("traceDeprecation")?console.trace(a):console.warn(a),t=!0}return e.apply(this,arguments)}}},81135:e=>{e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},49032:(e,a,t)=>{"use strict";var c=t(47244),f=t(48184),d=t(25767),r=t(35680);function n(e){return e.call.bind(e)}var i="undefined"!=typeof BigInt,b="undefined"!=typeof Symbol,o=n(Object.prototype.toString),s=n(Number.prototype.valueOf),l=n(String.prototype.valueOf),u=n(Boolean.prototype.valueOf);if(i)var h=n(BigInt.prototype.valueOf);if(b)var p=n(Symbol.prototype.valueOf);function g(e,a){if("object"!=typeof e)return!1;try{return a(e),!0}catch(e){return!1}}function m(e){return"[object Map]"===o(e)}function x(e){return"[object Set]"===o(e)}function y(e){return"[object WeakMap]"===o(e)}function A(e){return"[object WeakSet]"===o(e)}function v(e){return"[object ArrayBuffer]"===o(e)}function w(e){return"undefined"!=typeof ArrayBuffer&&(v.working?v(e):e instanceof ArrayBuffer)}function _(e){return"[object DataView]"===o(e)}function I(e){return"undefined"!=typeof DataView&&(_.working?_(e):e instanceof DataView)}a.isArgumentsObject=c,a.isGeneratorFunction=f,a.isTypedArray=r,a.isPromise=function(e){return"undefined"!=typeof Promise&&e instanceof Promise||null!==e&&"object"==typeof e&&"function"==typeof e.then&&"function"==typeof e.catch},a.isArrayBufferView=function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):r(e)||I(e)},a.isUint8Array=function(e){return"Uint8Array"===d(e)},a.isUint8ClampedArray=function(e){return"Uint8ClampedArray"===d(e)},a.isUint16Array=function(e){return"Uint16Array"===d(e)},a.isUint32Array=function(e){return"Uint32Array"===d(e)},a.isInt8Array=function(e){return"Int8Array"===d(e)},a.isInt16Array=function(e){return"Int16Array"===d(e)},a.isInt32Array=function(e){return"Int32Array"===d(e)},a.isFloat32Array=function(e){return"Float32Array"===d(e)},a.isFloat64Array=function(e){return"Float64Array"===d(e)},a.isBigInt64Array=function(e){return"BigInt64Array"===d(e)},a.isBigUint64Array=function(e){return"BigUint64Array"===d(e)},m.working="undefined"!=typeof Map&&m(new Map),a.isMap=function(e){return"undefined"!=typeof Map&&(m.working?m(e):e instanceof Map)},x.working="undefined"!=typeof Set&&x(new Set),a.isSet=function(e){return"undefined"!=typeof Set&&(x.working?x(e):e instanceof Set)},y.working="undefined"!=typeof WeakMap&&y(new WeakMap),a.isWeakMap=function(e){return"undefined"!=typeof WeakMap&&(y.working?y(e):e instanceof WeakMap)},A.working="undefined"!=typeof WeakSet&&A(new WeakSet),a.isWeakSet=function(e){return A(e)},v.working="undefined"!=typeof ArrayBuffer&&v(new ArrayBuffer),a.isArrayBuffer=w,_.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&_(new DataView(new ArrayBuffer(1),0,1)),a.isDataView=I;var E="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function C(e){return"[object SharedArrayBuffer]"===o(e)}function M(e){return void 0!==E&&(void 0===C.working&&(C.working=C(new E)),C.working?C(e):e instanceof E)}function B(e){return g(e,s)}function k(e){return g(e,l)}function L(e){return g(e,u)}function S(e){return i&&g(e,h)}function T(e){return b&&g(e,p)}a.isSharedArrayBuffer=M,a.isAsyncFunction=function(e){return"[object AsyncFunction]"===o(e)},a.isMapIterator=function(e){return"[object Map Iterator]"===o(e)},a.isSetIterator=function(e){return"[object Set Iterator]"===o(e)},a.isGeneratorObject=function(e){return"[object Generator]"===o(e)},a.isWebAssemblyCompiledModule=function(e){return"[object WebAssembly.Module]"===o(e)},a.isNumberObject=B,a.isStringObject=k,a.isBooleanObject=L,a.isBigIntObject=S,a.isSymbolObject=T,a.isBoxedPrimitive=function(e){return B(e)||k(e)||L(e)||S(e)||T(e)},a.isAnyArrayBuffer=function(e){return"undefined"!=typeof Uint8Array&&(w(e)||M(e))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(e){Object.defineProperty(a,e,{enumerable:!1,value:function(){throw new Error(e+" is not supported in userland")}})}))},40537:(e,a,t)=>{var c=Object.getOwnPropertyDescriptors||function(e){for(var a=Object.keys(e),t={},c=0;c=d)return e;switch(e){case"%s":return String(c[t++]);case"%d":return Number(c[t++]);case"%j":try{return JSON.stringify(c[t++])}catch(e){return"[Circular]"}default:return e}})),n=c[t];t=3&&(c.depth=arguments[2]),arguments.length>=4&&(c.colors=arguments[3]),p(t)?c.showHidden=t:t&&a._extend(c,t),y(c.showHidden)&&(c.showHidden=!1),y(c.depth)&&(c.depth=2),y(c.colors)&&(c.colors=!1),y(c.customInspect)&&(c.customInspect=!0),c.colors&&(c.stylize=b),s(c,e,c.depth)}function b(e,a){var t=i.styles[a];return t?"["+i.colors[t][0]+"m"+e+"["+i.colors[t][1]+"m":e}function o(e,a){return e}function s(e,t,c){if(e.customInspect&&t&&I(t.inspect)&&t.inspect!==a.inspect&&(!t.constructor||t.constructor.prototype!==t)){var f=t.inspect(c,e);return x(f)||(f=s(e,f,c)),f}var d=function(e,a){if(y(a))return e.stylize("undefined","undefined");if(x(a)){var t="'"+JSON.stringify(a).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(t,"string")}return m(a)?e.stylize(""+a,"number"):p(a)?e.stylize(""+a,"boolean"):g(a)?e.stylize("null","null"):void 0}(e,t);if(d)return d;var r=Object.keys(t),n=function(e){var a={};return e.forEach((function(e,t){a[e]=!0})),a}(r);if(e.showHidden&&(r=Object.getOwnPropertyNames(t)),_(t)&&(r.indexOf("message")>=0||r.indexOf("description")>=0))return l(t);if(0===r.length){if(I(t)){var i=t.name?": "+t.name:"";return e.stylize("[Function"+i+"]","special")}if(A(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(w(t))return e.stylize(Date.prototype.toString.call(t),"date");if(_(t))return l(t)}var b,o="",v=!1,E=["{","}"];return h(t)&&(v=!0,E=["[","]"]),I(t)&&(o=" [Function"+(t.name?": "+t.name:"")+"]"),A(t)&&(o=" "+RegExp.prototype.toString.call(t)),w(t)&&(o=" "+Date.prototype.toUTCString.call(t)),_(t)&&(o=" "+l(t)),0!==r.length||v&&0!=t.length?c<0?A(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),b=v?function(e,a,t,c,f){for(var d=[],r=0,n=a.length;r60?t[0]+(""===a?"":a+"\n ")+" "+e.join(",\n ")+" "+t[1]:t[0]+a+" "+e.join(", ")+" "+t[1]}(b,o,E)):E[0]+o+E[1]}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function u(e,a,t,c,f,d){var r,n,i;if((i=Object.getOwnPropertyDescriptor(a,f)||{value:a[f]}).get?n=i.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):i.set&&(n=e.stylize("[Setter]","special")),B(c,f)||(r="["+f+"]"),n||(e.seen.indexOf(i.value)<0?(n=g(t)?s(e,i.value,null):s(e,i.value,t-1)).indexOf("\n")>-1&&(n=d?n.split("\n").map((function(e){return" "+e})).join("\n").slice(2):"\n"+n.split("\n").map((function(e){return" "+e})).join("\n")):n=e.stylize("[Circular]","special")),y(r)){if(d&&f.match(/^\d+$/))return n;(r=JSON.stringify(""+f)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(r=r.slice(1,-1),r=e.stylize(r,"name")):(r=r.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),r=e.stylize(r,"string"))}return r+": "+n}function h(e){return Array.isArray(e)}function p(e){return"boolean"==typeof e}function g(e){return null===e}function m(e){return"number"==typeof e}function x(e){return"string"==typeof e}function y(e){return void 0===e}function A(e){return v(e)&&"[object RegExp]"===E(e)}function v(e){return"object"==typeof e&&null!==e}function w(e){return v(e)&&"[object Date]"===E(e)}function _(e){return v(e)&&("[object Error]"===E(e)||e instanceof Error)}function I(e){return"function"==typeof e}function E(e){return Object.prototype.toString.call(e)}function C(e){return e<10?"0"+e.toString(10):e.toString(10)}a.debuglog=function(e){if(e=e.toUpperCase(),!d[e])if(r.test(e)){var t=process.pid;d[e]=function(){var c=a.format.apply(a,arguments);console.error("%s %d: %s",e,t,c)}}else d[e]=function(){};return d[e]},a.inspect=i,i.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]},i.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},a.types=t(49032),a.isArray=h,a.isBoolean=p,a.isNull=g,a.isNullOrUndefined=function(e){return null==e},a.isNumber=m,a.isString=x,a.isSymbol=function(e){return"symbol"==typeof e},a.isUndefined=y,a.isRegExp=A,a.types.isRegExp=A,a.isObject=v,a.isDate=w,a.types.isDate=w,a.isError=_,a.types.isNativeError=_,a.isFunction=I,a.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},a.isBuffer=t(81135);var M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function B(e,a){return Object.prototype.hasOwnProperty.call(e,a)}a.log=function(){var e,t;console.log("%s - %s",(t=[C((e=new Date).getHours()),C(e.getMinutes()),C(e.getSeconds())].join(":"),[e.getDate(),M[e.getMonth()],t].join(" ")),a.format.apply(a,arguments))},a.inherits=t(56698),a._extend=function(e,a){if(!a||!v(a))return e;for(var t=Object.keys(a),c=t.length;c--;)e[t[c]]=a[t[c]];return e};var k="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function L(e,a){if(!e){var t=new Error("Promise was rejected with a falsy value");t.reason=e,e=t}return a(e)}a.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(k&&e[k]){var a;if("function"!=typeof(a=e[k]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(a,k,{value:a,enumerable:!1,writable:!1,configurable:!0}),a}function a(){for(var a,t,c=new Promise((function(e,c){a=e,t=c})),f=[],d=0;d{e.exports=function e(c,f){var d,r=0,n=0,i=f=f||0,b=c.length;do{if(i>=b)throw e.bytes=0,new RangeError("Could not decode varint");d=c[i++],r+=n<28?(d&t)<=a);return e.bytes=i-f,r};var a=128,t=127},81877:e=>{e.exports=function e(f,d,r){d=d||[];for(var n=r=r||0;f>=c;)d[r++]=255&f|a,f/=128;for(;f&t;)d[r++]=255&f|a,f>>>=7;return d[r]=0|f,e.bytes=r-n+1,d};var a=128,t=-128,c=Math.pow(2,31)},61203:(e,a,t)=>{e.exports={encode:t(81877),decode:t(26797),encodingLength:t(37867)}},37867:e=>{var a=Math.pow(2,7),t=Math.pow(2,14),c=Math.pow(2,21),f=Math.pow(2,28),d=Math.pow(2,35),r=Math.pow(2,42),n=Math.pow(2,49),i=Math.pow(2,56),b=Math.pow(2,63);e.exports=function(e){return e{var indexOf=function(e,a){if(e.indexOf)return e.indexOf(a);for(var t=0;t{"use strict";a.TextEncoder="undefined"!=typeof TextEncoder?TextEncoder:t(40537).TextEncoder,a.TextDecoder="undefined"!=typeof TextDecoder?TextDecoder:t(40537).TextDecoder},25767:(e,a,t)=>{"use strict";var c=t(82682),f=t(39209),d=t(10487),r=t(38075),n=t(75795),i=r("Object.prototype.toString"),b=t(49092)(),o="undefined"==typeof globalThis?t.g:globalThis,s=f(),l=r("String.prototype.slice"),u=Object.getPrototypeOf,h=r("Array.prototype.indexOf",!0)||function(e,a){for(var t=0;t-1?a:"Object"===a&&function(e){var a=!1;return c(p,(function(t,c){if(!a)try{t(e),a=l(c,1)}catch(e){}})),a}(e)}return n?function(e){var a=!1;return c(p,(function(t,c){if(!a)try{"$"+t(e)===c&&(a=l(c,1))}catch(e){}})),a}(e):null}},57510:e=>{e.exports=function(){for(var e={},t=0;t{},78982:()=>{},47790:()=>{},73776:()=>{},21638:()=>{},92668:()=>{},77965:()=>{},66089:()=>{},79368:()=>{},23276:()=>{},59676:()=>{},64688:()=>{},51069:()=>{},15340:()=>{},79838:()=>{},59817:()=>{},71281:()=>{},60513:()=>{},2378:()=>{},60290:()=>{},47882:()=>{},27754:(e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.StructError=void 0;class t extends TypeError{constructor(e,a){let t;const{message:c,explanation:f,...d}=e,{path:r}=e,n=0===r.length?c:`At path: ${r.join(".")} -- ${c}`;super(f??n),null!=f&&(this.cause=n),Object.assign(this,d),this.name=this.constructor.name,this.failures=()=>t??(t=[e,...a()])}}a.StructError=t},35620:function(e,a,t){"use strict";var c=this&&this.__createBinding||(Object.create?function(e,a,t,c){void 0===c&&(c=t);var f=Object.getOwnPropertyDescriptor(a,t);f&&!("get"in f?!a.__esModule:f.writable||f.configurable)||(f={enumerable:!0,get:function(){return a[t]}}),Object.defineProperty(e,c,f)}:function(e,a,t,c){void 0===c&&(c=t),e[c]=a[t]}),f=this&&this.__exportStar||function(e,a){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(a,t)||c(a,e,t)};Object.defineProperty(a,"__esModule",{value:!0}),f(t(27754),a),f(t(99067),a),f(t(91704),a),f(t(50401),a),f(t(67792),a),f(t(65991),a)},99067:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.validate=a.is=a.mask=a.create=a.assert=a.Struct=void 0;const c=t(27754),f=t(70639);function d(e,a,t){const c=b(e,a,{message:t});if(c[0])throw c[0]}function r(e,a,t){const c=b(e,a,{coerce:!0,message:t});if(c[0])throw c[0];return c[1]}function n(e,a,t){const c=b(e,a,{coerce:!0,mask:!0,message:t});if(c[0])throw c[0];return c[1]}function i(e,a){return!b(e,a)[0]}function b(e,a,t={}){const d=(0,f.run)(e,a,t),r=(0,f.shiftIterator)(d);return r[0]?[new c.StructError(r[0],(function*(){for(const e of d)e[0]&&(yield e[0])})),void 0]:[void 0,r[1]]}a.Struct=class{constructor(e){const{type:a,schema:t,validator:c,refiner:d,coercer:r=e=>e,entries:n=function*(){}}=e;this.type=a,this.schema=t,this.entries=n,this.coercer=r,this.validator=c?(e,a)=>{const t=c(e,a);return(0,f.toFailures)(t,a,this,e)}:()=>[],this.refiner=d?(e,a)=>{const t=d(e,a);return(0,f.toFailures)(t,a,this,e)}:()=>[]}assert(e,a){return d(e,this,a)}create(e,a){return r(e,this,a)}is(e){return i(e,this)}mask(e,a){return n(e,this,a)}validate(e,a={}){return b(e,this,a)}},a.assert=d,a.create=r,a.mask=n,a.is=i,a.validate=b},91704:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.trimmed=a.defaulted=a.coerce=void 0;const c=t(99067),f=t(70639),d=t(67792);function r(e,a,t){return new c.Struct({...e,coercer:(f,d)=>(0,c.is)(f,a)?e.coercer(t(f,d),d):e.coercer(f,d)})}a.coerce=r,a.defaulted=function(e,a,t={}){return r(e,(0,d.unknown)(),(e=>{const c="function"==typeof a?a():a;if(void 0===e)return c;if(!t.strict&&(0,f.isPlainObject)(e)&&(0,f.isPlainObject)(c)){const a={...e};let t=!1;for(const e in c)void 0===a[e]&&(a[e]=c[e],t=!0);if(t)return a}return e}))},a.trimmed=function(e){return r(e,(0,d.string)(),(e=>e.trim()))}},50401:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.refine=a.size=a.pattern=a.nonempty=a.min=a.max=a.empty=void 0;const c=t(99067),f=t(70639);function d(e){return e instanceof Map||e instanceof Set?e.size:e.length}function r(e,a,t){return new c.Struct({...e,*refiner(c,d){yield*e.refiner(c,d);const r=t(c,d),n=(0,f.toFailures)(r,d,e,c);for(const e of n)yield{...e,refinement:a}}})}a.empty=function(e){return r(e,"empty",(a=>{const t=d(a);return 0===t||`Expected an empty ${e.type} but received one with a size of \`${t}\``}))},a.max=function(e,a,t={}){const{exclusive:c}=t;return r(e,"max",(t=>c?tc?t>a:t>=a||`Expected a ${e.type} greater than ${c?"":"or equal to "}${a} but received \`${t}\``))},a.nonempty=function(e){return r(e,"nonempty",(a=>d(a)>0||`Expected a nonempty ${e.type} but received an empty one`))},a.pattern=function(e,a){return r(e,"pattern",(t=>a.test(t)||`Expected a ${e.type} matching \`/${a.source}/\` but received "${t}"`))},a.size=function(e,a,t=a){const c=`Expected a ${e.type}`,f=a===t?`of \`${a}\``:`between \`${a}\` and \`${t}\``;return r(e,"size",(e=>{if("number"==typeof e||e instanceof Date)return a<=e&&e<=t||`${c} ${f} but received \`${e}\``;if(e instanceof Map||e instanceof Set){const{size:d}=e;return a<=d&&d<=t||`${c} with a size ${f} but received one with a size of \`${d}\``}const{length:d}=e;return a<=d&&d<=t||`${c} with a length ${f} but received one with a length of \`${d}\``}))},a.refine=r},67792:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.unknown=a.union=a.type=a.tuple=a.string=a.set=a.regexp=a.record=a.optional=a.object=a.number=a.nullable=a.never=a.map=a.literal=a.intersection=a.integer=a.instance=a.func=a.enums=a.date=a.boolean=a.bigint=a.array=a.any=void 0;const c=t(99067),f=t(70639),d=t(65991);function r(){return(0,d.define)("never",(()=>!1))}a.any=function(){return(0,d.define)("any",(()=>!0))},a.array=function(e){return new c.Struct({type:"array",schema:e,*entries(a){if(e&&Array.isArray(a))for(const[t,c]of a.entries())yield[t,c,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${(0,f.print)(e)}`})},a.bigint=function(){return(0,d.define)("bigint",(e=>"bigint"==typeof e))},a.boolean=function(){return(0,d.define)("boolean",(e=>"boolean"==typeof e))},a.date=function(){return(0,d.define)("date",(e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${(0,f.print)(e)}`))},a.enums=function(e){const a={},t=e.map((e=>(0,f.print)(e))).join();for(const t of e)a[t]=t;return new c.Struct({type:"enums",schema:a,validator:a=>e.includes(a)||`Expected one of \`${t}\`, but received: ${(0,f.print)(a)}`})},a.func=function(){return(0,d.define)("func",(e=>"function"==typeof e||`Expected a function, but received: ${(0,f.print)(e)}`))},a.instance=function(e){return(0,d.define)("instance",(a=>a instanceof e||`Expected a \`${e.name}\` instance, but received: ${(0,f.print)(a)}`))},a.integer=function(){return(0,d.define)("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${(0,f.print)(e)}`))},a.intersection=function(e){return new c.Struct({type:"intersection",schema:null,*entries(a,t){for(const{entries:c}of e)yield*c(a,t)},*validator(a,t){for(const{validator:c}of e)yield*c(a,t)},*refiner(a,t){for(const{refiner:c}of e)yield*c(a,t)}})},a.literal=function(e){const a=(0,f.print)(e),t=typeof e;return new c.Struct({type:"literal",schema:"string"===t||"number"===t||"boolean"===t?e:null,validator:t=>t===e||`Expected the literal \`${a}\`, but received: ${(0,f.print)(t)}`})},a.map=function(e,a){return new c.Struct({type:"map",schema:null,*entries(t){if(e&&a&&t instanceof Map)for(const[c,f]of t.entries())yield[c,c,e],yield[c,f,a]},coercer:e=>e instanceof Map?new Map(e):e,validator:e=>e instanceof Map||`Expected a \`Map\` object, but received: ${(0,f.print)(e)}`})},a.never=r,a.nullable=function(e){return new c.Struct({...e,validator:(a,t)=>null===a||e.validator(a,t),refiner:(a,t)=>null===a||e.refiner(a,t)})},a.number=function(){return(0,d.define)("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${(0,f.print)(e)}`))},a.object=function(e){const a=e?Object.keys(e):[],t=r();return new c.Struct({type:"object",schema:e??null,*entries(c){if(e&&(0,f.isObject)(c)){const f=new Set(Object.keys(c));for(const t of a)f.delete(t),yield[t,c[t],e[t]];for(const e of f)yield[e,c[e],t]}},validator:e=>(0,f.isObject)(e)||`Expected an object, but received: ${(0,f.print)(e)}`,coercer:e=>(0,f.isObject)(e)?{...e}:e})},a.optional=function(e){return new c.Struct({...e,validator:(a,t)=>void 0===a||e.validator(a,t),refiner:(a,t)=>void 0===a||e.refiner(a,t)})},a.record=function(e,a){return new c.Struct({type:"record",schema:null,*entries(t){if((0,f.isObject)(t))for(const c in t){const f=t[c];yield[c,c,e],yield[c,f,a]}},validator:e=>(0,f.isObject)(e)||`Expected an object, but received: ${(0,f.print)(e)}`})},a.regexp=function(){return(0,d.define)("regexp",(e=>e instanceof RegExp))},a.set=function(e){return new c.Struct({type:"set",schema:null,*entries(a){if(e&&a instanceof Set)for(const t of a)yield[t,t,e]},coercer:e=>e instanceof Set?new Set(e):e,validator:e=>e instanceof Set||`Expected a \`Set\` object, but received: ${(0,f.print)(e)}`})},a.string=function(){return(0,d.define)("string",(e=>"string"==typeof e||`Expected a string, but received: ${(0,f.print)(e)}`))},a.tuple=function(e){const a=r();return new c.Struct({type:"tuple",schema:null,*entries(t){if(Array.isArray(t)){const c=Math.max(e.length,t.length);for(let f=0;fArray.isArray(e)||`Expected an array, but received: ${(0,f.print)(e)}`})},a.type=function(e){const a=Object.keys(e);return new c.Struct({type:"type",schema:e,*entries(t){if((0,f.isObject)(t))for(const c of a)yield[c,t[c],e[c]]},validator:e=>(0,f.isObject)(e)||`Expected an object, but received: ${(0,f.print)(e)}`,coercer:e=>(0,f.isObject)(e)?{...e}:e})},a.union=function(e){const a=e.map((e=>e.type)).join(" | ");return new c.Struct({type:"union",schema:null,coercer(a){for(const t of e){const[e,c]=t.validate(a,{coerce:!0});if(!e)return c}return a},validator(t,c){const d=[];for(const a of e){const[...e]=(0,f.run)(t,a,c),[r]=e;if(!r?.[0])return[];for(const[a]of e)a&&d.push(a)}return[`Expected the value to satisfy a union of \`${a}\`, but received: ${(0,f.print)(t)}`,...d]}})},a.unknown=function(){return(0,d.define)("unknown",(()=>!0))}},65991:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.pick=a.partial=a.omit=a.lazy=a.dynamic=a.deprecated=a.define=a.assign=void 0;const c=t(99067),f=t(67792);a.assign=function(...e){const a="type"===e[0]?.type,t=e.map((({schema:e})=>e)),c=Object.assign({},...t);return a?(0,f.type)(c):(0,f.object)(c)},a.define=function(e,a){return new c.Struct({type:e,schema:null,validator:a})},a.deprecated=function(e,a){return new c.Struct({...e,refiner:(a,t)=>void 0===a||e.refiner(a,t),validator:(t,c)=>void 0===t||(a(t,c),e.validator(t,c))})},a.dynamic=function(e){return new c.Struct({type:"dynamic",schema:null,*entries(a,t){const c=e(a,t);yield*c.entries(a,t)},validator:(a,t)=>e(a,t).validator(a,t),coercer:(a,t)=>e(a,t).coercer(a,t),refiner:(a,t)=>e(a,t).refiner(a,t)})},a.lazy=function(e){let a;return new c.Struct({type:"lazy",schema:null,*entries(t,c){a??(a=e()),yield*a.entries(t,c)},validator:(t,c)=>(a??(a=e()),a.validator(t,c)),coercer:(t,c)=>(a??(a=e()),a.coercer(t,c)),refiner:(t,c)=>(a??(a=e()),a.refiner(t,c))})},a.omit=function(e,a){const{schema:t}=e,c={...t};for(const e of a)delete c[e];return"type"===e.type?(0,f.type)(c):(0,f.object)(c)},a.partial=function(e){const a=e instanceof c.Struct,t=a?{...e.schema}:{...e};for(const e in t)t[e]=(0,f.optional)(t[e]);return a&&"type"===e.type?(0,f.type)(t):(0,f.object)(t)},a.pick=function(e,a){const{schema:t}=e,c={};for(const e of a)c[e]=t[e];return"type"===e.type?(0,f.type)(c):(0,f.object)(c)}},70639:(e,a)=>{"use strict";function t(e){return"object"==typeof e&&null!==e}function c(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function f(e,a,t,f){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:d,branch:r}=a,{type:n}=t,{refinement:i,message:b=`Expected a value of type \`${n}\`${i?` with refinement \`${i}\``:""}, but received: \`${c(f)}\``}=e;return{value:f,type:n,refinement:i,key:d[d.length-1],path:d,branch:r,...e,message:b}}Object.defineProperty(a,"__esModule",{value:!0}),a.run=a.toFailures=a.toFailure=a.shiftIterator=a.print=a.isPlainObject=a.isObject=void 0,a.isObject=t,a.isPlainObject=function(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;const a=Object.getPrototypeOf(e);return null===a||a===Object.prototype},a.print=c,a.shiftIterator=function(e){const{done:a,value:t}=e.next();return a?void 0:t},a.toFailure=f,a.toFailures=function*(e,a,c,d){(function(e){return t(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const t of e){const e=f(t,a,c,d);e&&(yield e)}},a.run=function*e(a,c,f={}){const{path:d=[],branch:r=[a],coerce:n=!1,mask:i=!1}=f,b={path:d,branch:r};if(n&&(a=c.coercer(a,b),i&&"type"!==c.type&&t(c.schema)&&t(a)&&!Array.isArray(a)))for(const e in a)void 0===c.schema[e]&&delete a[e];let o="valid";for(const e of c.validator(a,b))e.explanation=f.message,o="not_valid",yield[e,void 0];for(let[s,l,u]of c.entries(a,b)){const c=e(l,u,{path:void 0===s?d:[...d,s],branch:void 0===s?r:[...r,l],coerce:n,mask:i,message:f.message});for(const e of c)e[0]?(o=null===e[0].refinement||void 0===e[0].refinement?"not_valid":"not_refined",yield[e[0],void 0]):n&&(l=e[1],void 0===s?a=l:a instanceof Map?a.set(s,l):a instanceof Set?a.add(l):t(a)&&(void 0!==l||s in a)&&(a[s]=l))}if("not_valid"!==o)for(const e of c.refiner(a,b))e.explanation=f.message,o="not_refined",yield[e,void 0];"valid"===o&&(yield[void 0,a])}},22011:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.assertExhaustive=a.assertStruct=a.assert=a.AssertionError=void 0;const c=t(35620),f=t(75940);function d(e,a){return t=e,Boolean("string"==typeof t?.prototype?.constructor?.name)?new e({message:a}):e({message:a});var t}class r extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}a.AssertionError=r,a.assert=function(e,a="Assertion failed.",t=r){if(!e){if(a instanceof Error)throw a;throw d(t,a)}},a.assertStruct=function(e,a,t="Assertion failed",n=r){try{(0,c.assert)(e,a)}catch(e){throw d(n,`${t}: ${function(e){return(0,f.getErrorMessage)(e).replace(/\.$/u,"")}(e)}.`)}},a.assertExhaustive=function(e){throw new Error("Invalid branch reached. Should be detected during compilation.")}},20472:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.base64=void 0;const c=t(35620),f=t(22011);a.base64=(e,a={})=>{const t=a.paddingRequired??!1,d=a.characterSet??"base64";let r,n;return"base64"===d?r=String.raw`[A-Za-z0-9+\/]`:((0,f.assert)("base64url"===d),r=String.raw`[-_A-Za-z0-9]`),n=t?new RegExp(`^(?:${r}{4})*(?:${r}{3}=|${r}{2}==)?$`,"u"):new RegExp(`^(?:${r}{4})*(?:${r}{2,3}|${r}{3}=|${r}{2}==)?$`,"u"),(0,c.pattern)(e,n)}},77862:(e,a,t)=>{"use strict";var c=t(62045).hp;Object.defineProperty(a,"__esModule",{value:!0}),a.createDataView=a.concatBytes=a.valueToBytes=a.base64ToBytes=a.stringToBytes=a.numberToBytes=a.signedBigIntToBytes=a.bigIntToBytes=a.hexToBytes=a.bytesToBase64=a.bytesToString=a.bytesToNumber=a.bytesToSignedBigInt=a.bytesToBigInt=a.bytesToHex=a.assertIsBytes=a.isBytes=void 0;const f=t(63203),d=t(22011),r=t(93976),n=function(){const e=[];return()=>{if(0===e.length)for(let a=0;a<256;a++)e.push(a.toString(16).padStart(2,"0"));return e}}();function i(e){return e instanceof Uint8Array}function b(e){(0,d.assert)(i(e),"Value must be a Uint8Array.")}function o(e){if(b(e),0===e.length)return"0x";const a=n(),t=new Array(e.length);for(let c=0;c=BigInt(0),"Value must be a non-negative bigint."),l(e.toString(16))}function h(e){return(0,d.assert)("number"==typeof e,"Value must be a number."),(0,d.assert)(e>=0,"Value must be a non-negative number."),(0,d.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToBytes` instead."),l(e.toString(16))}function p(e){return(0,d.assert)("string"==typeof e,"Value must be a string."),(new TextEncoder).encode(e)}function g(e){if("bigint"==typeof e)return u(e);if("number"==typeof e)return h(e);if("string"==typeof e)return e.startsWith("0x")?l(e):p(e);if(i(e))return e;throw new TypeError(`Unsupported value type: "${typeof e}".`)}a.isBytes=i,a.assertIsBytes=b,a.bytesToHex=o,a.bytesToBigInt=s,a.bytesToSignedBigInt=function(e){b(e);let a=BigInt(0);for(const t of e)a=(a<0,"Byte length must be greater than 0."),(0,d.assert)(function(e,a){(0,d.assert)(a>0);const t=e>>BigInt(31);return!((~e&t)+(e&~t)>>BigInt(8*a-1))}(e,a),"Byte length is too small to represent the given value.");let t=e;const c=new Uint8Array(a);for(let e=0;e>=BigInt(8);return c.reverse()},a.numberToBytes=h,a.stringToBytes=p,a.base64ToBytes=function(e){return(0,d.assert)("string"==typeof e,"Value must be a string."),f.base64.decode(e)},a.valueToBytes=g,a.concatBytes=function(e){const a=new Array(e.length);let t=0;for(let c=0;c{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.toCaipChainId=a.parseCaipAccountId=a.parseCaipChainId=a.isCaipAccountAddress=a.isCaipAccountId=a.isCaipReference=a.isCaipNamespace=a.isCaipChainId=a.KnownCaipNamespace=a.CaipAccountAddressStruct=a.CaipAccountIdStruct=a.CaipReferenceStruct=a.CaipNamespaceStruct=a.CaipChainIdStruct=a.CAIP_ACCOUNT_ADDRESS_REGEX=a.CAIP_ACCOUNT_ID_REGEX=a.CAIP_REFERENCE_REGEX=a.CAIP_NAMESPACE_REGEX=a.CAIP_CHAIN_ID_REGEX=void 0;const c=t(35620);function f(e){return(0,c.is)(e,a.CaipNamespaceStruct)}function d(e){return(0,c.is)(e,a.CaipReferenceStruct)}var r;a.CAIP_CHAIN_ID_REGEX=/^(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})$/u,a.CAIP_NAMESPACE_REGEX=/^[-a-z0-9]{3,8}$/u,a.CAIP_REFERENCE_REGEX=/^[-_a-zA-Z0-9]{1,32}$/u,a.CAIP_ACCOUNT_ID_REGEX=/^(?(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})):(?[-.%a-zA-Z0-9]{1,128})$/u,a.CAIP_ACCOUNT_ADDRESS_REGEX=/^[-.%a-zA-Z0-9]{1,128}$/u,a.CaipChainIdStruct=(0,c.pattern)((0,c.string)(),a.CAIP_CHAIN_ID_REGEX),a.CaipNamespaceStruct=(0,c.pattern)((0,c.string)(),a.CAIP_NAMESPACE_REGEX),a.CaipReferenceStruct=(0,c.pattern)((0,c.string)(),a.CAIP_REFERENCE_REGEX),a.CaipAccountIdStruct=(0,c.pattern)((0,c.string)(),a.CAIP_ACCOUNT_ID_REGEX),a.CaipAccountAddressStruct=(0,c.pattern)((0,c.string)(),a.CAIP_ACCOUNT_ADDRESS_REGEX),(r=a.KnownCaipNamespace||(a.KnownCaipNamespace={})).Eip155="eip155",r.Wallet="wallet",a.isCaipChainId=function(e){return(0,c.is)(e,a.CaipChainIdStruct)},a.isCaipNamespace=f,a.isCaipReference=d,a.isCaipAccountId=function(e){return(0,c.is)(e,a.CaipAccountIdStruct)},a.isCaipAccountAddress=function(e){return(0,c.is)(e,a.CaipAccountAddressStruct)},a.parseCaipChainId=function(e){const t=a.CAIP_CHAIN_ID_REGEX.exec(e);if(!t?.groups)throw new Error("Invalid CAIP chain ID.");return{namespace:t.groups.namespace,reference:t.groups.reference}},a.parseCaipAccountId=function(e){const t=a.CAIP_ACCOUNT_ID_REGEX.exec(e);if(!t?.groups)throw new Error("Invalid CAIP account ID.");return{address:t.groups.accountAddress,chainId:t.groups.chainId,chain:{namespace:t.groups.namespace,reference:t.groups.reference}}},a.toCaipChainId=function(e,t){if(!f(e))throw new Error(`Invalid "namespace", must match: ${a.CAIP_NAMESPACE_REGEX.toString()}`);if(!d(t))throw new Error(`Invalid "reference", must match: ${a.CAIP_REFERENCE_REGEX.toString()}`);return`${e}:${t}`}},98860:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.ChecksumStruct=void 0;const c=t(35620),f=t(20472);a.ChecksumStruct=(0,c.size)((0,f.base64)((0,c.string)(),{paddingRequired:!0}),44,44)},65211:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.createHex=a.createBytes=a.createBigInt=a.createNumber=void 0;const c=t(35620),f=t(22011),d=t(77862),r=t(93976),n=(0,c.union)([(0,c.number)(),(0,c.bigint)(),(0,c.string)(),r.StrictHexStruct]),i=(0,c.coerce)((0,c.number)(),n,Number),b=(0,c.coerce)((0,c.bigint)(),n,BigInt),o=((0,c.union)([r.StrictHexStruct,(0,c.instance)(Uint8Array)]),(0,c.coerce)((0,c.instance)(Uint8Array),(0,c.union)([r.StrictHexStruct]),d.hexToBytes)),s=(0,c.coerce)(r.StrictHexStruct,(0,c.instance)(Uint8Array),d.bytesToHex);a.createNumber=function(e){try{const a=(0,c.create)(e,i);return(0,f.assert)(Number.isFinite(a),`Expected a number-like value, got "${e}".`),a}catch(a){if(a instanceof c.StructError)throw new Error(`Expected a number-like value, got "${e}".`);throw a}},a.createBigInt=function(e){try{return(0,c.create)(e,b)}catch(e){if(e instanceof c.StructError)throw new Error(`Expected a number-like value, got "${String(e.value)}".`);throw e}},a.createBytes=function(e){if("string"==typeof e&&"0x"===e.toLowerCase())return new Uint8Array;try{return(0,c.create)(e,o)}catch(e){if(e instanceof c.StructError)throw new Error(`Expected a bytes-like value, got "${String(e.value)}".`);throw e}},a.createHex=function(e){if(e instanceof Uint8Array&&0===e.length||"string"==typeof e&&"0x"===e.toLowerCase())return"0x";try{return(0,c.create)(e,s)}catch(e){if(e instanceof c.StructError)throw new Error(`Expected a bytes-like value, got "${String(e.value)}".`);throw e}}},44180:function(e,a){"use strict";var t,c,f=this&&this.__classPrivateFieldGet||function(e,a,t,c){if("a"===t&&!c)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof a?e!==a||!c:!a.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?c:"a"===t?c.call(e):c?c.value:a.get(e)},d=this&&this.__classPrivateFieldSet||function(e,a,t,c,f){if("m"===c)throw new TypeError("Private method is not writable");if("a"===c&&!f)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof a?e!==a||!f:!a.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===c?f.call(e,t):f?f.value=t:a.set(e,t),t};Object.defineProperty(a,"__esModule",{value:!0}),a.FrozenSet=a.FrozenMap=void 0;class r{get size(){return f(this,t,"f").size}[(t=new WeakMap,Symbol.iterator)](){return f(this,t,"f")[Symbol.iterator]()}constructor(e){t.set(this,void 0),d(this,t,new Map(e),"f"),Object.freeze(this)}entries(){return f(this,t,"f").entries()}forEach(e,a){return f(this,t,"f").forEach(((t,c,f)=>e.call(a,t,c,this)))}get(e){return f(this,t,"f").get(e)}has(e){return f(this,t,"f").has(e)}keys(){return f(this,t,"f").keys()}values(){return f(this,t,"f").values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map((([e,a])=>`${String(e)} => ${String(a)}`)).join(", ")} `:""}}`}}a.FrozenMap=r;class n{get size(){return f(this,c,"f").size}[(c=new WeakMap,Symbol.iterator)](){return f(this,c,"f")[Symbol.iterator]()}constructor(e){c.set(this,void 0),d(this,c,new Set(e),"f"),Object.freeze(this)}entries(){return f(this,c,"f").entries()}forEach(e,a){return f(this,c,"f").forEach(((t,c,f)=>e.call(a,t,c,this)))}has(e){return f(this,c,"f").has(e)}keys(){return f(this,c,"f").keys()}values(){return f(this,c,"f").values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map((e=>String(e))).join(", ")} `:""}}`}}a.FrozenSet=n,Object.freeze(r),Object.freeze(r.prototype),Object.freeze(n),Object.freeze(n.prototype)},91630:(e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0})},75940:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.wrapError=a.getErrorMessage=a.isErrorWithStack=a.isErrorWithMessage=a.isErrorWithCode=void 0;const c=t(71843),f=t(33745);function d(e){return"object"==typeof e&&null!==e&&"code"in e}function r(e){return"object"==typeof e&&null!==e&&"message"in e}a.isErrorWithCode=d,a.isErrorWithMessage=r,a.isErrorWithStack=function(e){return"object"==typeof e&&null!==e&&"stack"in e},a.getErrorMessage=function(e){return r(e)&&"string"==typeof e.message?e.message:(0,f.isNullOrUndefined)(e)?"":String(e)},a.wrapError=function(e,a){if((t=e)instanceof Error||(0,f.isObject)(t)&&"Error"===t.constructor.name){let t;return t=2===Error.length?new Error(a,{cause:e}):new c.ErrorWithCause(a,{cause:e}),d(e)&&(t.code=e.code),t}var t;return a.length>0?new Error(`${String(e)}: ${a}`):new Error(String(e))}},93976:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.remove0x=a.add0x=a.isValidChecksumAddress=a.getChecksumAddress=a.isValidHexAddress=a.assertIsStrictHexString=a.assertIsHexString=a.isStrictHexString=a.isHexString=a.HexChecksumAddressStruct=a.HexAddressStruct=a.StrictHexStruct=a.HexStruct=void 0;const c=t(35620),f=t(32955),d=t(22011),r=t(77862);function n(e){return(0,c.is)(e,a.HexStruct)}function i(e){return(0,c.is)(e,a.StrictHexStruct)}function b(e){(0,d.assert)((0,c.is)(e,a.HexChecksumAddressStruct),"Invalid hex address.");const t=s(e.toLowerCase()),n=s((0,r.bytesToHex)((0,f.keccak_256)(t)));return`0x${t.split("").map(((e,a)=>{const t=n[a];return(0,d.assert)((0,c.is)(t,(0,c.string)()),"Hash shorter than address."),parseInt(t,16)>7?e.toUpperCase():e})).join("")}`}function o(e){return!!(0,c.is)(e,a.HexChecksumAddressStruct)&&b(e)===e}function s(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}a.HexStruct=(0,c.pattern)((0,c.string)(),/^(?:0x)?[0-9a-f]+$/iu),a.StrictHexStruct=(0,c.pattern)((0,c.string)(),/^0x[0-9a-f]+$/iu),a.HexAddressStruct=(0,c.pattern)((0,c.string)(),/^0x[0-9a-f]{40}$/u),a.HexChecksumAddressStruct=(0,c.pattern)((0,c.string)(),/^0x[0-9a-fA-F]{40}$/u),a.isHexString=n,a.isStrictHexString=i,a.assertIsHexString=function(e){(0,d.assert)(n(e),"Value must be a hexadecimal string.")},a.assertIsStrictHexString=function(e){(0,d.assert)(i(e),'Value must be a hexadecimal string, starting with "0x".')},a.isValidHexAddress=function(e){return(0,c.is)(e,a.HexAddressStruct)||o(e)},a.getChecksumAddress=b,a.isValidChecksumAddress=o,a.add0x=function(e){return e.startsWith("0x")?e:e.startsWith("0X")?`0x${e.substring(2)}`:`0x${e}`},a.remove0x=s},52367:function(e,a,t){"use strict";var c=this&&this.__createBinding||(Object.create?function(e,a,t,c){void 0===c&&(c=t);var f=Object.getOwnPropertyDescriptor(a,t);f&&!("get"in f?!a.__esModule:f.writable||f.configurable)||(f={enumerable:!0,get:function(){return a[t]}}),Object.defineProperty(e,c,f)}:function(e,a,t,c){void 0===c&&(c=t),e[c]=a[t]}),f=this&&this.__exportStar||function(e,a){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(a,t)||c(a,e,t)};Object.defineProperty(a,"__esModule",{value:!0}),f(t(22011),a),f(t(20472),a),f(t(77862),a),f(t(87690),a),f(t(98860),a),f(t(65211),a),f(t(44180),a),f(t(91630),a),f(t(75940),a),f(t(93976),a),f(t(60087),a),f(t(24956),a),f(t(98912),a),f(t(33745),a),f(t(5770),a),f(t(3028),a),f(t(2812),a),f(t(32954),a),f(t(16871),a),f(t(49266),a)},60087:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.getJsonRpcIdValidator=a.assertIsJsonRpcError=a.isJsonRpcError=a.assertIsJsonRpcFailure=a.isJsonRpcFailure=a.assertIsJsonRpcSuccess=a.isJsonRpcSuccess=a.assertIsJsonRpcResponse=a.isJsonRpcResponse=a.assertIsPendingJsonRpcResponse=a.isPendingJsonRpcResponse=a.JsonRpcResponseStruct=a.JsonRpcFailureStruct=a.JsonRpcSuccessStruct=a.PendingJsonRpcResponseStruct=a.assertIsJsonRpcRequest=a.isJsonRpcRequest=a.assertIsJsonRpcNotification=a.isJsonRpcNotification=a.JsonRpcNotificationStruct=a.JsonRpcRequestStruct=a.JsonRpcParamsStruct=a.JsonRpcErrorStruct=a.JsonRpcIdStruct=a.JsonRpcVersionStruct=a.jsonrpc2=a.getJsonSize=a.getSafeJson=a.isValidJson=a.JsonStruct=a.UnsafeJsonStruct=a.exactOptional=a.object=void 0;const c=t(35620),f=t(22011),d=t(33745);function r({path:e,branch:a}){const t=e[e.length-1];return(0,d.hasProperty)(a[a.length-2],t)}function n(e){return new c.Struct({...e,type:`optional ${e.type}`,validator:(a,t)=>!r(t)||e.validator(a,t),refiner:(a,t)=>!r(t)||e.refiner(a,t)})}function i(e){return(0,c.create)(e,a.JsonStruct)}a.object=e=>(0,c.object)(e),a.exactOptional=n,a.UnsafeJsonStruct=(0,c.union)([(0,c.literal)(null),(0,c.boolean)(),(0,c.define)("finite number",(e=>(0,c.is)(e,(0,c.number)())&&Number.isFinite(e))),(0,c.string)(),(0,c.array)((0,c.lazy)((()=>a.UnsafeJsonStruct))),(0,c.record)((0,c.string)(),(0,c.lazy)((()=>a.UnsafeJsonStruct)))]),a.JsonStruct=(0,c.coerce)(a.UnsafeJsonStruct,(0,c.any)(),(e=>((0,f.assertStruct)(e,a.UnsafeJsonStruct),JSON.parse(JSON.stringify(e,((e,a)=>{if("__proto__"!==e&&"constructor"!==e)return a})))))),a.isValidJson=function(e){try{return i(e),!0}catch{return!1}},a.getSafeJson=i,a.getJsonSize=function(e){(0,f.assertStruct)(e,a.JsonStruct,"Invalid JSON value");const t=JSON.stringify(e);return(new TextEncoder).encode(t).byteLength},a.jsonrpc2="2.0",a.JsonRpcVersionStruct=(0,c.literal)(a.jsonrpc2),a.JsonRpcIdStruct=(0,c.nullable)((0,c.union)([(0,c.number)(),(0,c.string)()])),a.JsonRpcErrorStruct=(0,a.object)({code:(0,c.integer)(),message:(0,c.string)(),data:n(a.JsonStruct),stack:n((0,c.string)())}),a.JsonRpcParamsStruct=(0,c.union)([(0,c.record)((0,c.string)(),a.JsonStruct),(0,c.array)(a.JsonStruct)]),a.JsonRpcRequestStruct=(0,a.object)({id:a.JsonRpcIdStruct,jsonrpc:a.JsonRpcVersionStruct,method:(0,c.string)(),params:n(a.JsonRpcParamsStruct)}),a.JsonRpcNotificationStruct=(0,a.object)({jsonrpc:a.JsonRpcVersionStruct,method:(0,c.string)(),params:n(a.JsonRpcParamsStruct)}),a.isJsonRpcNotification=function(e){return(0,c.is)(e,a.JsonRpcNotificationStruct)},a.assertIsJsonRpcNotification=function(e,t){(0,f.assertStruct)(e,a.JsonRpcNotificationStruct,"Invalid JSON-RPC notification",t)},a.isJsonRpcRequest=function(e){return(0,c.is)(e,a.JsonRpcRequestStruct)},a.assertIsJsonRpcRequest=function(e,t){(0,f.assertStruct)(e,a.JsonRpcRequestStruct,"Invalid JSON-RPC request",t)},a.PendingJsonRpcResponseStruct=(0,c.object)({id:a.JsonRpcIdStruct,jsonrpc:a.JsonRpcVersionStruct,result:(0,c.optional)((0,c.unknown)()),error:(0,c.optional)(a.JsonRpcErrorStruct)}),a.JsonRpcSuccessStruct=(0,a.object)({id:a.JsonRpcIdStruct,jsonrpc:a.JsonRpcVersionStruct,result:a.JsonStruct}),a.JsonRpcFailureStruct=(0,a.object)({id:a.JsonRpcIdStruct,jsonrpc:a.JsonRpcVersionStruct,error:a.JsonRpcErrorStruct}),a.JsonRpcResponseStruct=(0,c.union)([a.JsonRpcSuccessStruct,a.JsonRpcFailureStruct]),a.isPendingJsonRpcResponse=function(e){return(0,c.is)(e,a.PendingJsonRpcResponseStruct)},a.assertIsPendingJsonRpcResponse=function(e,t){(0,f.assertStruct)(e,a.PendingJsonRpcResponseStruct,"Invalid pending JSON-RPC response",t)},a.isJsonRpcResponse=function(e){return(0,c.is)(e,a.JsonRpcResponseStruct)},a.assertIsJsonRpcResponse=function(e,t){(0,f.assertStruct)(e,a.JsonRpcResponseStruct,"Invalid JSON-RPC response",t)},a.isJsonRpcSuccess=function(e){return(0,c.is)(e,a.JsonRpcSuccessStruct)},a.assertIsJsonRpcSuccess=function(e,t){(0,f.assertStruct)(e,a.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",t)},a.isJsonRpcFailure=function(e){return(0,c.is)(e,a.JsonRpcFailureStruct)},a.assertIsJsonRpcFailure=function(e,t){(0,f.assertStruct)(e,a.JsonRpcFailureStruct,"Invalid JSON-RPC failure response",t)},a.isJsonRpcError=function(e){return(0,c.is)(e,a.JsonRpcErrorStruct)},a.assertIsJsonRpcError=function(e,t){(0,f.assertStruct)(e,a.JsonRpcErrorStruct,"Invalid JSON-RPC error",t)},a.getJsonRpcIdValidator=function(e){const{permitEmptyString:a,permitFractions:t,permitNull:c}={permitEmptyString:!0,permitFractions:!1,permitNull:!0,...e};return e=>Boolean("number"==typeof e&&(t||Number.isInteger(e))||"string"==typeof e&&(a||e.length>0)||c&&null===e)}},24956:(e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0})},98912:function(e,a,t){"use strict";var c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(a,"__esModule",{value:!0}),a.createModuleLogger=a.createProjectLogger=void 0;const f=(0,c(t(17833)).default)("metamask");a.createProjectLogger=function(e){return f.extend(e)},a.createModuleLogger=function(e,a){return e.extend(a)}},33745:(e,a)=>{"use strict";function t(e){return e.charCodeAt(0)<=127}var c;Object.defineProperty(a,"__esModule",{value:!0}),a.calculateNumberSize=a.calculateStringSize=a.isASCII=a.isPlainObject=a.ESCAPE_CHARACTERS_REGEXP=a.JsonSize=a.getKnownPropertyNames=a.hasProperty=a.isObject=a.isNullOrUndefined=a.isNonEmptyArray=void 0,a.isNonEmptyArray=function(e){return Array.isArray(e)&&e.length>0},a.isNullOrUndefined=function(e){return null==e},a.isObject=function(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)},a.hasProperty=(e,a)=>Object.hasOwnProperty.call(e,a),a.getKnownPropertyNames=function(e){return Object.getOwnPropertyNames(e)},(c=a.JsonSize||(a.JsonSize={}))[c.Null=4]="Null",c[c.Comma=1]="Comma",c[c.Wrapper=1]="Wrapper",c[c.True=4]="True",c[c.False=5]="False",c[c.Quote=1]="Quote",c[c.Colon=1]="Colon",c[c.Date=24]="Date",a.ESCAPE_CHARACTERS_REGEXP=/"|\\|\n|\r|\t/gu,a.isPlainObject=function(e){if("object"!=typeof e||null===e)return!1;try{let a=e;for(;null!==Object.getPrototypeOf(a);)a=Object.getPrototypeOf(a);return Object.getPrototypeOf(e)===a}catch(e){return!1}},a.isASCII=t,a.calculateStringSize=function(e){return e.split("").reduce(((e,a)=>t(a)?e+1:e+2),0)+(e.match(a.ESCAPE_CHARACTERS_REGEXP)??[]).length},a.calculateNumberSize=function(e){return e.toString().length}},5770:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.hexToBigInt=a.hexToNumber=a.bigIntToHex=a.numberToHex=void 0;const c=t(22011),f=t(93976);a.numberToHex=e=>((0,c.assert)("number"==typeof e,"Value must be a number."),(0,c.assert)(e>=0,"Value must be a non-negative number."),(0,c.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToHex` instead."),(0,f.add0x)(e.toString(16))),a.bigIntToHex=e=>((0,c.assert)("bigint"==typeof e,"Value must be a bigint."),(0,c.assert)(e>=0,"Value must be a non-negative bigint."),(0,f.add0x)(e.toString(16))),a.hexToNumber=e=>{(0,f.assertIsHexString)(e);const a=parseInt(e,16);return(0,c.assert)(Number.isSafeInteger(a),"Value is not a safe integer. Use `hexToBigInt` instead."),a},a.hexToBigInt=e=>((0,f.assertIsHexString)(e),BigInt((0,f.add0x)(e)))},3028:(e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0})},2812:(e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.createDeferredPromise=void 0,a.createDeferredPromise=function({suppressUnhandledRejection:e=!1}={}){let a,t;const c=new Promise(((e,c)=>{a=e,t=c}));return e&&c.catch((e=>{})),{promise:c,resolve:a,reject:t}}},32954:(e,a)=>{"use strict";var t;Object.defineProperty(a,"__esModule",{value:!0}),a.timeSince=a.inMilliseconds=a.Duration=void 0,(t=a.Duration||(a.Duration={}))[t.Millisecond=1]="Millisecond",t[t.Second=1e3]="Second",t[t.Minute=6e4]="Minute",t[t.Hour=36e5]="Hour",t[t.Day=864e5]="Day",t[t.Week=6048e5]="Week",t[t.Year=31536e6]="Year";const c=(e,a)=>{if(!(e=>Number.isInteger(e)&&e>=0)(e))throw new Error(`"${a}" must be a non-negative integer. Received: "${e}".`)};a.inMilliseconds=function(e,a){return c(e,"count"),e*a},a.timeSince=function(e){return c(e,"timestamp"),Date.now()-e}},16871:(e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0})},49266:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.satisfiesVersionRange=a.gtRange=a.gtVersion=a.assertIsSemVerRange=a.assertIsSemVerVersion=a.isValidSemVerRange=a.isValidSemVerVersion=a.VersionRangeStruct=a.VersionStruct=void 0;const c=t(35620),f=t(56864),d=t(22011);a.VersionStruct=(0,c.refine)((0,c.string)(),"Version",(e=>null!==(0,f.valid)(e)||`Expected SemVer version, got "${e}"`)),a.VersionRangeStruct=(0,c.refine)((0,c.string)(),"Version range",(e=>null!==(0,f.validRange)(e)||`Expected SemVer range, got "${e}"`)),a.isValidSemVerVersion=function(e){return(0,c.is)(e,a.VersionStruct)},a.isValidSemVerRange=function(e){return(0,c.is)(e,a.VersionRangeStruct)},a.assertIsSemVerVersion=function(e){(0,d.assertStruct)(e,a.VersionStruct)},a.assertIsSemVerRange=function(e){(0,d.assertStruct)(e,a.VersionRangeStruct)},a.gtVersion=function(e,a){return(0,f.gt)(e,a)},a.gtRange=function(e,a){return(0,f.gtr)(e,a)},a.satisfiesVersionRange=function(e,a){return(0,f.satisfies)(e,a,{includePrerelease:!0})}},39209:(e,a,t)=>{"use strict";var c=t(76578),f="undefined"==typeof globalThis?t.g:globalThis;e.exports=function(){for(var e=[],a=0;a{"use strict";const{normalizeIPv6:c,normalizeIPv4:f,removeDotSegments:d,recomposeAuthority:r,normalizeComponentEncoding:n}=t(34834),i=t(343);function b(e,a,t,c){const f={};return c||(e=u(o(e,t),t),a=u(o(a,t),t)),!(t=t||{}).tolerant&&a.scheme?(f.scheme=a.scheme,f.userinfo=a.userinfo,f.host=a.host,f.port=a.port,f.path=d(a.path||""),f.query=a.query):(void 0!==a.userinfo||void 0!==a.host||void 0!==a.port?(f.userinfo=a.userinfo,f.host=a.host,f.port=a.port,f.path=d(a.path||""),f.query=a.query):(a.path?("/"===a.path.charAt(0)?f.path=d(a.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?f.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+a.path:f.path=a.path:f.path="/"+a.path,f.path=d(f.path)),f.query=a.query):(f.path=e.path,void 0!==a.query?f.query=a.query:f.query=e.query),f.userinfo=e.userinfo,f.host=e.host,f.port=e.port),f.scheme=e.scheme),f.fragment=a.fragment,f}function o(e,a){const t={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},c=Object.assign({},a),f=[],n=i[(c.scheme||t.scheme||"").toLowerCase()];n&&n.serialize&&n.serialize(t,c),void 0!==t.path&&(c.skipEscape?t.path=unescape(t.path):(t.path=escape(t.path),void 0!==t.scheme&&(t.path=t.path.split("%3A").join(":")))),"suffix"!==c.reference&&t.scheme&&(f.push(t.scheme),f.push(":"));const b=r(t,c);if(void 0!==b&&("suffix"!==c.reference&&f.push("//"),f.push(b),t.path&&"/"!==t.path.charAt(0)&&f.push("/")),void 0!==t.path){let e=t.path;c.absolutePath||n&&n.absolutePath||(e=d(e)),void 0===b&&(e=e.replace(/^\/\//u,"/%2F")),f.push(e)}return void 0!==t.query&&(f.push("?"),f.push(t.query)),void 0!==t.fragment&&(f.push("#"),f.push(t.fragment)),f.join("")}const s=Array.from({length:127},((e,a)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(a)))),l=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function u(e,a){const t=Object.assign({},a),d={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},r=-1!==e.indexOf("%");let n=!1;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);const b=e.match(l);if(b){if(d.scheme=b[1],d.userinfo=b[3],d.host=b[4],d.port=parseInt(b[5],10),d.path=b[6]||"",d.query=b[7],d.fragment=b[8],isNaN(d.port)&&(d.port=b[5]),d.host){const e=f(d.host);if(!1===e.isIPV4){const a=c(e.host,{isIPV4:!1});d.host=a.host.toLowerCase(),n=a.isIPV6}else d.host=e.host,n=!0}void 0!==d.scheme||void 0!==d.userinfo||void 0!==d.host||void 0!==d.port||d.path||void 0!==d.query?void 0===d.scheme?d.reference="relative":void 0===d.fragment?d.reference="absolute":d.reference="uri":d.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==d.reference&&(d.error=d.error||"URI is not a "+t.reference+" reference.");const e=i[(t.scheme||d.scheme||"").toLowerCase()];if(!(t.unicodeSupport||e&&e.unicodeSupport)&&d.host&&(t.domainHost||e&&e.domainHost)&&!1===n&&function(e){let a=0;for(let t=0,c=e.length;t126||s[a])return!0;return!1}(d.host))try{d.host=URL.domainToASCII(d.host.toLowerCase())}catch(e){d.error=d.error||"Host's domain name can not be converted to ASCII: "+e}(!e||e&&!e.skipNormalize)&&(r&&void 0!==d.scheme&&(d.scheme=unescape(d.scheme)),r&&void 0!==d.userinfo&&(d.userinfo=unescape(d.userinfo)),r&&void 0!==d.host&&(d.host=unescape(d.host)),void 0!==d.path&&d.path.length&&(d.path=escape(unescape(d.path))),void 0!==d.fragment&&d.fragment.length&&(d.fragment=encodeURI(decodeURIComponent(d.fragment)))),e&&e.parse&&e.parse(d,t)}else d.error=d.error||"URI can not be parsed.";return d}const h={SCHEMES:i,normalize:function(e,a){return"string"==typeof e?e=o(u(e,a),a):"object"==typeof e&&(e=u(o(e,a),a)),e},resolve:function(e,a,t){const c=Object.assign({scheme:"null"},t);return o(b(u(e,c),u(a,c),c,!0),{...c,skipEscape:!0})},resolveComponents:b,equal:function(e,a,t){return"string"==typeof e?(e=unescape(e),e=o(n(u(e,t),!0),{...t,skipEscape:!0})):"object"==typeof e&&(e=o(n(e,!0),{...t,skipEscape:!0})),"string"==typeof a?(a=unescape(a),a=o(n(u(a,t),!0),{...t,skipEscape:!0})):"object"==typeof a&&(a=o(n(a,!0),{...t,skipEscape:!0})),e.toLowerCase()===a.toLowerCase()},serialize:o,parse:u};e.exports=h,e.exports.default=h,e.exports.fastUri=h},343:e=>{"use strict";const a=/^[\da-f]{8}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{12}$/iu,t=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function c(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}function f(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function d(e){const a="https"===String(e.scheme).toLowerCase();return e.port!==(a?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}const r={scheme:"http",domainHost:!0,parse:f,serialize:d},n={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=c(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if(e.port!==(c(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){const[a,t]=e.resourceName.split("?");e.path=a&&"/"!==a?a:void 0,e.query=t,e.resourceName=void 0}return e.fragment=void 0,e}},i={http:r,https:{scheme:"https",domainHost:r.domainHost,parse:f,serialize:d},ws:n,wss:{scheme:"wss",domainHost:n.domainHost,parse:n.parse,serialize:n.serialize},urn:{scheme:"urn",parse:function(e,a){if(!e.path)return e.error="URN can not be parsed",e;const c=e.path.match(t);if(c){const t=a.scheme||e.scheme||"urn";e.nid=c[1].toLowerCase(),e.nss=c[2];const f=`${t}:${a.nid||e.nid}`,d=i[f];e.path=void 0,d&&(e=d.parse(e,a))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,a){const t=a.scheme||e.scheme||"urn",c=e.nid.toLowerCase(),f=`${t}:${a.nid||c}`,d=i[f];d&&(e=d.serialize(e,a));const r=e,n=e.nss;return r.path=`${c||a.nid}:${n}`,a.skipEscape=!0,r},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(e,t){const c=e;return c.uuid=c.nss,c.nss=void 0,t.tolerant||c.uuid&&a.test(c.uuid)||(c.error=c.error||"UUID is not valid."),c},serialize:function(e){const a=e;return a.nss=(e.uuid||"").toLowerCase(),a},skipNormalize:!0}};e.exports=i},64914:e=>{"use strict";e.exports={HEX:{0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15}}},34834:(e,a,t)=>{"use strict";const{HEX:c}=t(64914);function f(e){if(i(e,".")<3)return{host:e,isIPV4:!1};const a=e.match(/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/u)||[],[t]=a;return t?{host:n(t,"."),isIPV4:!0}:{host:e,isIPV4:!1}}function d(e,a=!1){let t="",f=!0;for(const a of e){if(void 0===c[a])return;"0"!==a&&!0===f&&(f=!1),f||(t+=a)}return a&&0===t.length&&(t="0"),t}function r(e,a={}){if(i(e,":")<2)return{host:e,isIPV6:!1};const t=function(e){let a=0;const t={error:!1,address:"",zone:""},c=[],f=[];let r=!1,n=!1,i=!1;function b(){if(f.length){if(!1===r){const e=d(f);if(void 0===e)return t.error=!0,!1;c.push(e)}f.length=0}return!0}for(let d=0;d7){t.error=!0;break}d-1>=0&&":"===e[d-1]&&(n=!0)}}return f.length&&(r?t.zone=f.join(""):i?c.push(f.join("")):c.push(d(f))),t.address=c.join(""),t}(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,a=t.address;return t.zone&&(e+="%"+t.zone,a+="%25"+t.zone),{host:e,escapedHost:a,isIPV6:!0}}}function n(e,a){let t="",c=!0;const f=e.length;for(let d=0;d{"use strict";function c(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function f(e,...a){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(a.length>0&&!a.includes(e.length))throw new Error(`Expected Uint8Array of length ${a}, not of length=${e.length}`)}function d(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");c(e.outputLen),c(e.blockLen)}function r(e,a=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(a&&e.finished)throw new Error("Hash#digest() has already been called")}function n(e,a){f(e);const t=a.outputLen;if(e.lengthn,ai:()=>c,ee:()=>f,t2:()=>r,tW:()=>d})},6800:(e,a,t)=>{"use strict";t.d(a,{D:()=>d});var c=t(89190),f=t(32531);class d extends f.Vw{constructor(e,a,t,c){super(),this.blockLen=e,this.outputLen=a,this.padOffset=t,this.isLE=c,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,f.O8)(this.buffer)}update(e){(0,c.t2)(this);const{view:a,buffer:t,blockLen:d}=this,r=(e=(0,f.ZJ)(e)).length;for(let c=0;cd-n&&(this.process(t,0),n=0);for(let e=n;e>f&d),n=Number(t&d),i=c?4:0,b=c?0:4;e.setUint32(a+i,r,c),e.setUint32(a+b,n,c)}(t,d-8,BigInt(8*this.length),r),this.process(t,0);const i=(0,f.O8)(e),b=this.outputLen;if(b%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const o=b/4,s=this.get();if(o>s.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e{"use strict";t.d(a,{Ay:()=>s,B4:()=>i,P5:()=>n,WM:()=>b,im:()=>o,lD:()=>r});const c=BigInt(2**32-1),f=BigInt(32);function d(e,a=!1){return a?{h:Number(e&c),l:Number(e>>f&c)}:{h:0|Number(e>>f&c),l:0|Number(e&c)}}function r(e,a=!1){let t=new Uint32Array(e.length),c=new Uint32Array(e.length);for(let f=0;fe<>>32-t,i=(e,a,t)=>a<>>32-t,b=(e,a,t)=>a<>>64-t,o=(e,a,t)=>e<>>64-t,s={fromBig:d,split:r,toBig:(e,a)=>BigInt(e>>>0)<>>0),shrSH:(e,a,t)=>e>>>t,shrSL:(e,a,t)=>e<<32-t|a>>>t,rotrSH:(e,a,t)=>e>>>t|a<<32-t,rotrSL:(e,a,t)=>e<<32-t|a>>>t,rotrBH:(e,a,t)=>e<<64-t|a>>>t-32,rotrBL:(e,a,t)=>e>>>t-32|a<<64-t,rotr32H:(e,a)=>a,rotr32L:(e,a)=>e,rotlSH:n,rotlSL:i,rotlBH:b,rotlBL:o,add:function(e,a,t,c){const f=(a>>>0)+(c>>>0);return{h:e+t+(f/2**32|0)|0,l:0|f}},add3L:(e,a,t)=>(e>>>0)+(a>>>0)+(t>>>0),add3H:(e,a,t,c)=>a+t+c+(e/2**32|0)|0,add4L:(e,a,t,c)=>(e>>>0)+(a>>>0)+(t>>>0)+(c>>>0),add4H:(e,a,t,c,f)=>a+t+c+f+(e/2**32|0)|0,add5H:(e,a,t,c,f,d)=>a+t+c+f+d+(e/2**32|0)|0,add5L:(e,a,t,c,f)=>(e>>>0)+(a>>>0)+(t>>>0)+(c>>>0)+(f>>>0)}},21454:(e,a,t)=>{"use strict";t.d(a,{w:()=>r});var c=t(89190),f=t(32531);class d extends f.Vw{constructor(e,a){super(),this.finished=!1,this.destroyed=!1,(0,c.tW)(e);const t=(0,f.ZJ)(a);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const d=this.blockLen,r=new Uint8Array(d);r.set(t.length>d?e.create().update(t).digest():t);for(let e=0;enew d(e,a).update(t).digest();r.create=(e,a)=>new d(e,a)},2200:(e,a,t)=>{"use strict";t.d(a,{A:()=>r});var c=t(89190),f=t(21454),d=t(32531);function r(e,a,t,r){const{c:n,dkLen:i,DK:b,PRF:o,PRFSalt:s}=function(e,a,t,r){(0,c.tW)(e);const n=(0,d.tY)({dkLen:32,asyncTick:10},r),{c:i,dkLen:b,asyncTick:o}=n;if((0,c.ai)(i),(0,c.ai)(b),(0,c.ai)(o),i<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const s=(0,d.ZJ)(a),l=(0,d.ZJ)(t),u=new Uint8Array(b),h=f.w.create(e,s),p=h._cloneInto().update(l);return{c:i,dkLen:b,asyncTick:o,DK:u,PRF:h,PRFSalt:p}}(e,a,t,r);let l;const u=new Uint8Array(4),h=(0,d.O8)(u),p=new Uint8Array(o.outputLen);for(let e=1,a=0;a{"use strict";t.d(a,{s:()=>o});var c=t(6800),f=t(32531);const d=(e,a,t)=>e&a^e&t^a&t,r=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),n=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),i=new Uint32Array(64);class b extends c.D{constructor(){super(64,32,8,!1),this.A=0|n[0],this.B=0|n[1],this.C=0|n[2],this.D=0|n[3],this.E=0|n[4],this.F=0|n[5],this.G=0|n[6],this.H=0|n[7]}get(){const{A:e,B:a,C:t,D:c,E:f,F:d,G:r,H:n}=this;return[e,a,t,c,f,d,r,n]}set(e,a,t,c,f,d,r,n){this.A=0|e,this.B=0|a,this.C=0|t,this.D=0|c,this.E=0|f,this.F=0|d,this.G=0|r,this.H=0|n}process(e,a){for(let t=0;t<16;t++,a+=4)i[t]=e.getUint32(a,!1);for(let e=16;e<64;e++){const a=i[e-15],t=i[e-2],c=(0,f.Ow)(a,7)^(0,f.Ow)(a,18)^a>>>3,d=(0,f.Ow)(t,17)^(0,f.Ow)(t,19)^t>>>10;i[e]=d+i[e-7]+c+i[e-16]|0}let{A:t,B:c,C:n,D:b,E:o,F:s,G:l,H:u}=this;for(let e=0;e<64;e++){const a=u+((0,f.Ow)(o,6)^(0,f.Ow)(o,11)^(0,f.Ow)(o,25))+((h=o)&s^~h&l)+r[e]+i[e]|0,p=((0,f.Ow)(t,2)^(0,f.Ow)(t,13)^(0,f.Ow)(t,22))+d(t,c,n)|0;u=l,l=s,s=o,o=b+a|0,b=n,n=c,c=t,t=a+p|0}var h;t=t+this.A|0,c=c+this.B|0,n=n+this.C|0,b=b+this.D|0,o=o+this.E|0,s=s+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(t,c,n,b,o,s,l,u)}roundClean(){i.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const o=(0,f.ld)((()=>new b))},32531:(e,a,t)=>{"use strict";t.d(a,{Vw:()=>l,$h:()=>b,tY:()=>h,Id:()=>s,O8:()=>r,po:()=>g,Ow:()=>n,ZJ:()=>o,DH:()=>d,ld:()=>p});const c="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,f=e=>e instanceof Uint8Array,d=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),r=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),n=(e,a)=>e<<32-a|e>>>a;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");const i=async()=>{};async function b(e,a,t){let c=Date.now();for(let f=0;f=0&&ee+a.length),0));let t=0;return e.forEach((e=>{if(!f(e))throw new Error("Uint8Array expected");a.set(e,t),t+=e.length})),a}class l{clone(){return this._cloneInto()}}const u={}.toString;function h(e,a){if(void 0!==a&&"[object Object]"!==u.call(a))throw new Error("Options should be object or undefined");return Object.assign(e,a)}function p(e){const a=a=>e().update(o(a)).digest(),t=e();return a.outputLen=t.outputLen,a.blockLen=t.blockLen,a.create=()=>e(),a}function g(e=32){if(c&&"function"==typeof c.getRandomValues)return c.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}},90294:(e,a,t)=>{"use strict";t.d(a,{HI:()=>Bt,vu:()=>ct});const c=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4];function f(e,a){return a&&10!=a?16==a?"0x"==e.slice(0,2)?BigInt(e):BigInt("0x"+e):void 0:BigInt(e)}const d=f;function r(e){const a=e.toString(16);return 4*(a.length-1)+c[parseInt(a[0],16)]}function n(e){return BigInt(e)>BigInt(a)}const o=i,s=b;function l(e){return(BigInt(e)&BigInt(1))==BigInt(1)}function u(e){if(e>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("Number too big");return Number(e)}function h(e,a){return BigInt(e)+BigInt(a)}function p(e,a){return BigInt(e)-BigInt(a)}function g(e){return-BigInt(e)}function m(e,a){return BigInt(e)*BigInt(a)}function x(e,a){return BigInt(e)%BigInt(a)}function y(e,a){return BigInt(e)>BigInt(a)}function A(e,a){return BigInt(e)>=BigInt(a)}function v(e,a){return BigInt(e)&BigInt(a)}function w(e,a,t,c){const f="0000000"+t.toString(16),d=new Uint32Array(e.buffer,e.byteOffset+a,c/4),r=1+(4*(f.length-7)-1>>5);for(let e=0;ed[d.length-a-1]=e.toString(16).padStart(8,"0"))),f(d.join(""),16)}function I(e,a){return e.toString(a)}function E(e){const a=new Uint8Array(Math.floor((r(e)-1)/8)+1);return w(a,0,e,a.byteLength),a}const C=d(0),M=d(1);var B=Object.freeze({__proto__:null,abs:function(e){return BigInt(e)>=0?BigInt(e):-BigInt(e)},add:h,band:v,bitLength:r,bits:function(e){let a=BigInt(e);const t=[];for(;a;)a&BigInt(1)?t.push(1):t.push(0),a>>=BigInt(1);return t},bor:function(e,a){return BigInt(e)|BigInt(a)},bxor:function(e,a){return BigInt(e)^BigInt(a)},div:function(e,a){return BigInt(e)/BigInt(a)},e:d,eq:function(e,a){return BigInt(e)==BigInt(a)},exp:function(e,a){return BigInt(e)**BigInt(a)},fromArray:function(e,a){let t=BigInt(0);a=BigInt(a);for(let c=0;c>=BigInt(1)}return t},neg:g,neq:function(e,a){return BigInt(e)!=BigInt(a)},one:M,pow:function(e,a){return BigInt(e)**BigInt(a)},shiftLeft:i,shiftRight:b,shl:o,shr:s,square:function(e){return BigInt(e)*BigInt(e)},sub:p,toArray:function(e,a){const t=[];let c=BigInt(e);for(a=BigInt(a);c;)t.unshift(Number(c%a)),c/=a;return t},toLEBuff:E,toNumber:u,toRprBE:function(e,a,t,c){const f="0000000"+t.toString(16),d=new DataView(e.buffer,e.byteOffset+a,c),r=1+(4*(f.length-7)-1>>5);for(let e=0;e>=1;return t}function S(e,a,t,c,f){e[a]=e[a]+e[t]>>>0,e[f]=(e[f]^e[a])>>>0,e[f]=(e[f]<<16|e[f]>>>16&65535)>>>0,e[c]=e[c]+e[f]>>>0,e[t]=(e[t]^e[c])>>>0,e[t]=(e[t]<<12|e[t]>>>20&4095)>>>0,e[a]=e[a]+e[t]>>>0,e[f]=(e[f]^e[a])>>>0,e[f]=(e[f]<<8|e[f]>>>24&255)>>>0,e[c]=e[c]+e[f]>>>0,e[t]=(e[t]^e[c])>>>0,e[t]=(e[t]<<7|e[t]>>>25&127)>>>0}class T{constructor(e){e=e||[0,0,0,0,0,0,0,0],this.state=[1634760805,857760878,2036477234,1797285236,e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],0,0,0,0],this.idx=16,this.buff=new Array(16)}nextU32(){return 16==this.idx&&this.update(),this.buff[this.idx++]}nextU64(){return h(m(this.nextU32(),4294967296),this.nextU32())}nextBool(){return!(1&~this.nextU32())}update(){for(let e=0;e<16;e++)this.buff[e]=this.state[e];for(let a=0;a<10;a++)S(e=this.buff,0,4,8,12),S(e,1,5,9,13),S(e,2,6,10,14),S(e,3,7,11,15),S(e,0,5,10,15),S(e,1,6,11,12),S(e,2,7,8,13),S(e,3,4,9,14);var e;for(let e=0;e<16;e++)this.buff[e]=this.buff[e]+this.state[e]>>>0;this.idx=0,this.state[12]=this.state[12]+1>>>0,0==this.state[12]&&(this.state[13]=this.state[13]+1>>>0,0==this.state[13]&&(this.state[14]=this.state[14]+1>>>0,0==this.state[14]&&(this.state[15]=this.state[15]+1>>>0)))}}let N=null;function R(){return N||(N=new T(function(){const e=function(e){let a=new Uint8Array(e);if(void 0!==globalThis.crypto)globalThis.crypto.getRandomValues(a);else for(let t=0;t>>0;return a}(32),a=new Uint32Array(e.buffer),t=[];for(let e=0;e<8;e++)t.push(a[e]);return t}()),N)}function P(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var D={bigInt2BytesLE:function(e,a){const t=Array(a);let c=BigInt(e);for(let e=0;e>=8n;return t},bigInt2U32LE:function(e,a){const t=Array(a);let c=BigInt(e);for(let e=0;e>=32n;return t},isOcamNum:function(e){return!!Array.isArray(e)&&3==e.length&&"number"==typeof e[0]&&"number"==typeof e[1]&&!!Array.isArray(e[2])}},O=function(e,a,t,c,f,d,r){const n=e.addFunction(a);n.addParam("base","i32"),n.addParam("scalar","i32"),n.addParam("scalarLength","i32"),n.addParam("r","i32"),n.addLocal("i","i32"),n.addLocal("b","i32");const i=n.getCodeBuilder(),b=i.i32_const(e.alloc(t));n.addCode(i.if(i.i32_eqz(i.getLocal("scalarLength")),[...i.call(r,i.getLocal("r")),...i.ret([])])),n.addCode(i.call(d,i.getLocal("base"),b)),n.addCode(i.call(r,i.getLocal("r"))),n.addCode(i.setLocal("i",i.getLocal("scalarLength"))),n.addCode(i.block(i.loop(i.setLocal("i",i.i32_sub(i.getLocal("i"),i.i32_const(1))),i.setLocal("b",i.i32_load8_u(i.i32_add(i.getLocal("scalar"),i.getLocal("i")))),...function(){const e=[];for(let a=0;a<8;a++)e.push(...i.call(f,i.getLocal("r"),i.getLocal("r")),...i.if(i.i32_ge_u(i.getLocal("b"),i.i32_const(128>>a)),[...i.setLocal("b",i.i32_sub(i.getLocal("b"),i.i32_const(128>>a))),...i.call(c,i.getLocal("r"),b,i.getLocal("r"))]));return e}(),i.br_if(1,i.i32_eqz(i.getLocal("i"))),i.br(0))))},F=function(e,a){const t=8*e.modules[a].n64,c=e.addFunction(a+"_batchInverse");c.addParam("pIn","i32"),c.addParam("inStep","i32"),c.addParam("n","i32"),c.addParam("pOut","i32"),c.addParam("outStep","i32"),c.addLocal("itAux","i32"),c.addLocal("itIn","i32"),c.addLocal("itOut","i32"),c.addLocal("i","i32");const f=c.getCodeBuilder(),d=f.i32_const(e.alloc(t));c.addCode(f.setLocal("itAux",f.i32_load(f.i32_const(0))),f.i32_store(f.i32_const(0),f.i32_add(f.getLocal("itAux"),f.i32_mul(f.i32_add(f.getLocal("n"),f.i32_const(1)),f.i32_const(t))))),c.addCode(f.call(a+"_one",f.getLocal("itAux")),f.setLocal("itIn",f.getLocal("pIn")),f.setLocal("itAux",f.i32_add(f.getLocal("itAux"),f.i32_const(t))),f.setLocal("i",f.i32_const(0)),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal("i"),f.getLocal("n"))),f.if(f.call(a+"_isZero",f.getLocal("itIn")),f.call(a+"_copy",f.i32_sub(f.getLocal("itAux"),f.i32_const(t)),f.getLocal("itAux")),f.call(a+"_mul",f.getLocal("itIn"),f.i32_sub(f.getLocal("itAux"),f.i32_const(t)),f.getLocal("itAux"))),f.setLocal("itIn",f.i32_add(f.getLocal("itIn"),f.getLocal("inStep"))),f.setLocal("itAux",f.i32_add(f.getLocal("itAux"),f.i32_const(t))),f.setLocal("i",f.i32_add(f.getLocal("i"),f.i32_const(1))),f.br(0))),f.setLocal("itIn",f.i32_sub(f.getLocal("itIn"),f.getLocal("inStep"))),f.setLocal("itAux",f.i32_sub(f.getLocal("itAux"),f.i32_const(t))),f.setLocal("itOut",f.i32_add(f.getLocal("pOut"),f.i32_mul(f.i32_sub(f.getLocal("n"),f.i32_const(1)),f.getLocal("outStep")))),f.call(a+"_inverse",f.getLocal("itAux"),f.getLocal("itAux")),f.block(f.loop(f.br_if(1,f.i32_eqz(f.getLocal("i"))),f.if(f.call(a+"_isZero",f.getLocal("itIn")),[...f.call(a+"_copy",f.getLocal("itAux"),f.i32_sub(f.getLocal("itAux"),f.i32_const(t))),...f.call(a+"_zero",f.getLocal("itOut"))],[...f.call(a+"_copy",f.i32_sub(f.getLocal("itAux"),f.i32_const(t)),d),...f.call(a+"_mul",f.getLocal("itAux"),f.getLocal("itIn"),f.i32_sub(f.getLocal("itAux"),f.i32_const(t))),...f.call(a+"_mul",f.getLocal("itAux"),d,f.getLocal("itOut"))]),f.setLocal("itIn",f.i32_sub(f.getLocal("itIn"),f.getLocal("inStep"))),f.setLocal("itOut",f.i32_sub(f.getLocal("itOut"),f.getLocal("outStep"))),f.setLocal("itAux",f.i32_sub(f.getLocal("itAux"),f.i32_const(t))),f.setLocal("i",f.i32_sub(f.getLocal("i"),f.i32_const(1))),f.br(0)))),c.addCode(f.i32_store(f.i32_const(0),f.getLocal("itAux")))},Q=function(e,a,t,c,f,d){void 0===d&&(d=ca?1:-1}function H(e){return e*e}function q(e){return e%2n!==0n}function $(e){return e%2n===0n}function z(e){return e<0n}function G(e){return e>0n}function K(e){return z(e)?e.toString(2).length-1:e.toString(2).length}function V(e){return e<0n?-e:e}function Z(e){return 1n===V(e)}function J(e,a){for(var t,c,f,d=0n,r=1n,n=a,i=V(e);0n!==i;)t=n/i,c=d,f=n,d=r,n=i,r=c-t*r,i=f-t*i;if(!Z(n))throw new Error(e.toString()+" and "+a.toString()+" are not co-prime");return-1===j(d,0n)&&(d+=a),z(e)?-d:d}function W(e,a,t){if(0n===t)throw new Error("Cannot take modPow with modulus 0");var c=1n,f=e%t;for(z(a)&&(a*=-1n,f=J(f,t));G(a);){if(0n===f)return 0n;q(a)&&(c=c*f%t),a/=2n,f=H(f)%t}return c}function Y(e,a){return 0n!==a&&(!!Z(a)||(0===function(e,a){return(e=e>=0n?e:-e)===(a=a>=0n?a:-a)?0:e>a?1:-1}(a,2n)?$(e):e%a===0n))}function X(e,a){for(var t,c,f,d=function(e){return e-1n}(e),r=d,n=0;$(r);)r/=2n,n++;e:for(c=0;c>1&&c>1,e>>1)))),a.addCode(t.setLocal(i,t.i64_add(t.getLocal(i),t.i64_shr_u(t.getLocal(n),t.i64_const(32)))))),e>0&&(a.addCode(t.setLocal(n,t.i64_add(t.i64_and(t.getLocal(n),t.i64_const(4294967295)),t.i64_and(t.getLocal(b),t.i64_const(4294967295))))),a.addCode(t.setLocal(i,t.i64_add(t.i64_add(t.getLocal(i),t.i64_shr_u(t.getLocal(n),t.i64_const(32))),t.getLocal(o))))),a.addCode(t.i64_store32(t.getLocal("r"),4*e,t.getLocal(n))),a.addCode(t.setLocal(b,t.getLocal(i)),t.setLocal(o,t.i64_shr_u(t.getLocal(b),t.i64_const(32))))}a.addCode(t.i64_store32(t.getLocal("r"),4*f*2-4,t.getLocal(b)))}(),function(){const a=e.addFunction(c+"_squareOld");a.addParam("x","i32"),a.addParam("r","i32");const t=a.getCodeBuilder();a.addCode(t.call(c+"_mul",t.getLocal("x"),t.getLocal("x"),t.getLocal("r")))}(),function(){!function(){const a=e.addFunction(c+"__mul1");a.addParam("px","i32"),a.addParam("y","i64"),a.addParam("pr","i32"),a.addLocal("c","i64");const t=a.getCodeBuilder();a.addCode(t.setLocal("c",t.i64_mul(t.i64_load32_u(t.getLocal("px"),0,0),t.getLocal("y")))),a.addCode(t.i64_store32(t.getLocal("pr"),0,0,t.getLocal("c")));for(let e=1;e>1n,g=e.alloc(n,ee.bigInt2BytesLE(p,n)),m=p+1n,x=e.alloc(n,ee.bigInt2BytesLE(m,n));e.modules[i]={pq:o,pR2:s,n64:d,q:f,pOne:l,pZero:u,pePlusOne:x};let y=2n;if(ie(f))for(;ne(y,p,f)!==h;)y+=1n;let A=0,v=h;for(;!be(v)&&0n!==v;)A++,v>>=1n;const w=e.alloc(n,ee.bigInt2BytesLE(v,n)),_=ne(y,v,f),I=e.alloc(ee.bigInt2BytesLE((_<>1n,C=e.alloc(n,ee.bigInt2BytesLE(E,n));return e.exportFunction(b+"_copy",i+"_copy"),e.exportFunction(b+"_zero",i+"_zero"),e.exportFunction(b+"_isZero",i+"_isZero"),e.exportFunction(b+"_eq",i+"_eq"),function(){const a=e.addFunction(i+"_isOne");a.addParam("x","i32"),a.setReturnType("i32");const t=a.getCodeBuilder();a.addCode(t.ret(t.call(b+"_eq",t.getLocal("x"),t.i32_const(l))))}(),function(){const a=e.addFunction(i+"_add");a.addParam("x","i32"),a.addParam("y","i32"),a.addParam("r","i32");const t=a.getCodeBuilder();a.addCode(t.if(t.call(b+"_add",t.getLocal("x"),t.getLocal("y"),t.getLocal("r")),t.drop(t.call(b+"_sub",t.getLocal("r"),t.i32_const(o),t.getLocal("r"))),t.if(t.call(b+"_gte",t.getLocal("r"),t.i32_const(o)),t.drop(t.call(b+"_sub",t.getLocal("r"),t.i32_const(o),t.getLocal("r"))))))}(),function(){const a=e.addFunction(i+"_sub");a.addParam("x","i32"),a.addParam("y","i32"),a.addParam("r","i32");const t=a.getCodeBuilder();a.addCode(t.if(t.call(b+"_sub",t.getLocal("x"),t.getLocal("y"),t.getLocal("r")),t.drop(t.call(b+"_add",t.getLocal("r"),t.i32_const(o),t.getLocal("r")))))}(),function(){const a=e.addFunction(i+"_neg");a.addParam("x","i32"),a.addParam("r","i32");const t=a.getCodeBuilder();a.addCode(t.call(i+"_sub",t.i32_const(u),t.getLocal("x"),t.getLocal("r")))}(),function(){const a=e.alloc(r*r*8),t=e.addFunction(i+"_mReduct");t.addParam("t","i32"),t.addParam("r","i32"),t.addLocal("np32","i64"),t.addLocal("c","i64"),t.addLocal("m","i64");const c=t.getCodeBuilder(),d=Number(0x100000000n-re(f,0x100000000n));t.addCode(c.setLocal("np32",c.i64_const(d)));for(let e=0;e=r&&a.addCode(t.i64_store32(t.getLocal("r"),4*(e-r),t.getLocal(h))),[h,p]=[p,h],a.addCode(t.setLocal(p,t.i64_shr_u(t.getLocal(h),t.i64_const(32))))}a.addCode(t.i64_store32(t.getLocal("r"),4*r-4,t.getLocal(h))),a.addCode(t.if(t.i32_wrap_i64(t.getLocal(p)),t.drop(t.call(b+"_sub",t.getLocal("r"),t.i32_const(o),t.getLocal("r"))),t.if(t.call(b+"_gte",t.getLocal("r"),t.i32_const(o)),t.drop(t.call(b+"_sub",t.getLocal("r"),t.i32_const(o),t.getLocal("r"))))))}(),function(){const a=e.addFunction(i+"_square");a.addParam("x","i32"),a.addParam("r","i32"),a.addLocal("c0","i64"),a.addLocal("c1","i64"),a.addLocal("c0_old","i64"),a.addLocal("c1_old","i64"),a.addLocal("np32","i64");for(let e=0;e>1&&c>1,e>>1)))),a.addCode(t.setLocal(h,t.i64_add(t.getLocal(h),t.i64_shr_u(t.getLocal(u),t.i64_const(32)))))),e>0&&(a.addCode(t.setLocal(u,t.i64_add(t.i64_and(t.getLocal(u),t.i64_const(4294967295)),t.i64_and(t.getLocal(p),t.i64_const(4294967295))))),a.addCode(t.setLocal(h,t.i64_add(t.i64_add(t.getLocal(h),t.i64_shr_u(t.getLocal(u),t.i64_const(32))),t.getLocal(g)))));for(let c=Math.max(1,e-r+1);c<=e&&c=r&&a.addCode(t.i64_store32(t.getLocal("r"),4*(e-r),t.getLocal(u))),a.addCode(t.setLocal(p,t.getLocal(h)),t.setLocal(g,t.i64_shr_u(t.getLocal(p),t.i64_const(32))))}a.addCode(t.i64_store32(t.getLocal("r"),4*r-4,t.getLocal(p))),a.addCode(t.if(t.i32_wrap_i64(t.getLocal(g)),t.drop(t.call(b+"_sub",t.getLocal("r"),t.i32_const(o),t.getLocal("r"))),t.if(t.call(b+"_gte",t.getLocal("r"),t.i32_const(o)),t.drop(t.call(b+"_sub",t.getLocal("r"),t.i32_const(o),t.getLocal("r"))))))}(),function(){const a=e.addFunction(i+"_squareOld");a.addParam("x","i32"),a.addParam("r","i32");const t=a.getCodeBuilder();a.addCode(t.call(i+"_mul",t.getLocal("x"),t.getLocal("x"),t.getLocal("r")))}(),function(){const a=e.addFunction(i+"_toMontgomery");a.addParam("x","i32"),a.addParam("r","i32");const t=a.getCodeBuilder();a.addCode(t.call(i+"_mul",t.getLocal("x"),t.i32_const(s),t.getLocal("r")))}(),function(){const a=e.alloc(2*n),t=e.addFunction(i+"_fromMontgomery");t.addParam("x","i32"),t.addParam("r","i32");const c=t.getCodeBuilder();t.addCode(c.call(b+"_copy",c.getLocal("x"),c.i32_const(a))),t.addCode(c.call(b+"_zero",c.i32_const(a+n))),t.addCode(c.call(i+"_mReduct",c.i32_const(a),c.getLocal("r")))}(),function(){const a=e.addFunction(i+"_isNegative");a.addParam("x","i32"),a.setReturnType("i32");const t=a.getCodeBuilder(),c=t.i32_const(e.alloc(n));a.addCode(t.call(i+"_fromMontgomery",t.getLocal("x"),c),t.call(b+"_gte",c,t.i32_const(x)))}(),function(){const a=e.addFunction(i+"_sign");a.addParam("x","i32"),a.setReturnType("i32");const t=a.getCodeBuilder(),c=t.i32_const(e.alloc(n));a.addCode(t.if(t.call(b+"_isZero",t.getLocal("x")),t.ret(t.i32_const(0))),t.call(i+"_fromMontgomery",t.getLocal("x"),c),t.if(t.call(b+"_gte",c,t.i32_const(x)),t.ret(t.i32_const(-1))),t.ret(t.i32_const(1)))}(),function(){const a=e.addFunction(i+"_inverse");a.addParam("x","i32"),a.addParam("r","i32");const t=a.getCodeBuilder();a.addCode(t.call(i+"_fromMontgomery",t.getLocal("x"),t.getLocal("r"))),a.addCode(t.call(b+"_inverseMod",t.getLocal("r"),t.i32_const(o),t.getLocal("r"))),a.addCode(t.call(i+"_toMontgomery",t.getLocal("r"),t.getLocal("r")))}(),function(){const a=e.addFunction(i+"_one");a.addParam("pr","i32");const t=a.getCodeBuilder();a.addCode(t.call(b+"_copy",t.i32_const(l),t.getLocal("pr")))}(),function(){const a=e.addFunction(i+"_load");a.addParam("scalar","i32"),a.addParam("scalarLen","i32"),a.addParam("r","i32"),a.addLocal("p","i32"),a.addLocal("l","i32"),a.addLocal("i","i32"),a.addLocal("j","i32");const t=a.getCodeBuilder(),c=t.i32_const(e.alloc(n)),f=e.alloc(n),d=t.i32_const(f);a.addCode(t.call(b+"_zero",t.getLocal("r")),t.setLocal("i",t.i32_const(n)),t.setLocal("p",t.getLocal("scalar")),t.block(t.loop(t.br_if(1,t.i32_gt_u(t.getLocal("i"),t.getLocal("scalarLen"))),t.if(t.i32_eq(t.getLocal("i"),t.i32_const(n)),t.call(i+"_one",c),t.call(i+"_mul",c,t.i32_const(s),c)),t.call(i+"_mul",t.getLocal("p"),c,d),t.call(i+"_add",t.getLocal("r"),d,t.getLocal("r")),t.setLocal("p",t.i32_add(t.getLocal("p"),t.i32_const(n))),t.setLocal("i",t.i32_add(t.getLocal("i"),t.i32_const(n))),t.br(0))),t.setLocal("l",t.i32_rem_u(t.getLocal("scalarLen"),t.i32_const(n))),t.if(t.i32_eqz(t.getLocal("l")),t.ret([])),t.call(b+"_zero",d),t.setLocal("j",t.i32_const(0)),t.block(t.loop(t.br_if(1,t.i32_eq(t.getLocal("j"),t.getLocal("l"))),t.i32_store8(t.getLocal("j"),f,t.i32_load8_u(t.getLocal("p"))),t.setLocal("p",t.i32_add(t.getLocal("p"),t.i32_const(1))),t.setLocal("j",t.i32_add(t.getLocal("j"),t.i32_const(1))),t.br(0))),t.if(t.i32_eq(t.getLocal("i"),t.i32_const(n)),t.call(i+"_one",c),t.call(i+"_mul",c,t.i32_const(s),c)),t.call(i+"_mul",d,c,d),t.call(i+"_add",t.getLocal("r"),d,t.getLocal("r")))}(),function(){const a=e.addFunction(i+"_timesScalar");a.addParam("x","i32"),a.addParam("scalar","i32"),a.addParam("scalarLen","i32"),a.addParam("r","i32");const t=a.getCodeBuilder(),c=t.i32_const(e.alloc(n));a.addCode(t.call(i+"_load",t.getLocal("scalar"),t.getLocal("scalarLen"),c),t.call(i+"_toMontgomery",c,c),t.call(i+"_mul",t.getLocal("x"),c,t.getLocal("r")))}(),te(e,i),ce(e,i+"_batchToMontgomery",i+"_toMontgomery",n,n),ce(e,i+"_batchFromMontgomery",i+"_fromMontgomery",n,n),ce(e,i+"_batchNeg",i+"_neg",n,n),fe(e,i+"_batchAdd",i+"_add",n,n),fe(e,i+"_batchSub",i+"_sub",n,n),fe(e,i+"_batchMul",i+"_mul",n,n),e.exportFunction(i+"_add"),e.exportFunction(i+"_sub"),e.exportFunction(i+"_neg"),e.exportFunction(i+"_isNegative"),e.exportFunction(i+"_isOne"),e.exportFunction(i+"_sign"),e.exportFunction(i+"_mReduct"),e.exportFunction(i+"_mul"),e.exportFunction(i+"_square"),e.exportFunction(i+"_squareOld"),e.exportFunction(i+"_fromMontgomery"),e.exportFunction(i+"_toMontgomery"),e.exportFunction(i+"_inverse"),e.exportFunction(i+"_one"),e.exportFunction(i+"_load"),e.exportFunction(i+"_timesScalar"),ae(e,i+"_exp",n,i+"_mul",i+"_square",b+"_copy",i+"_one"),e.exportFunction(i+"_exp"),e.exportFunction(i+"_batchInverse"),ie(f)&&(function(){const a=e.addFunction(i+"_sqrt");a.addParam("n","i32"),a.addParam("r","i32"),a.addLocal("m","i32"),a.addLocal("i","i32"),a.addLocal("j","i32");const t=a.getCodeBuilder(),c=t.i32_const(l),f=t.i32_const(e.alloc(n)),d=t.i32_const(e.alloc(n)),r=t.i32_const(e.alloc(n)),b=t.i32_const(e.alloc(n)),o=t.i32_const(e.alloc(n));a.addCode(t.if(t.call(i+"_isZero",t.getLocal("n")),t.ret(t.call(i+"_zero",t.getLocal("r")))),t.setLocal("m",t.i32_const(A)),t.call(i+"_copy",t.i32_const(I),f),t.call(i+"_exp",t.getLocal("n"),t.i32_const(w),t.i32_const(n),d),t.call(i+"_exp",t.getLocal("n"),t.i32_const(C),t.i32_const(n),r),t.block(t.loop(t.br_if(1,t.call(i+"_eq",d,c)),t.call(i+"_square",d,b),t.setLocal("i",t.i32_const(1)),t.block(t.loop(t.br_if(1,t.call(i+"_eq",b,c)),t.call(i+"_square",b,b),t.setLocal("i",t.i32_add(t.getLocal("i"),t.i32_const(1))),t.br(0))),t.call(i+"_copy",f,o),t.setLocal("j",t.i32_sub(t.i32_sub(t.getLocal("m"),t.getLocal("i")),t.i32_const(1))),t.block(t.loop(t.br_if(1,t.i32_eqz(t.getLocal("j"))),t.call(i+"_square",o,o),t.setLocal("j",t.i32_sub(t.getLocal("j"),t.i32_const(1))),t.br(0))),t.setLocal("m",t.getLocal("i")),t.call(i+"_square",o,f),t.call(i+"_mul",d,f,d),t.call(i+"_mul",r,o,r),t.br(0))),t.if(t.call(i+"_isNegative",r),t.call(i+"_neg",r,t.getLocal("r")),t.call(i+"_copy",r,t.getLocal("r"))))}(),function(){const a=e.addFunction(i+"_isSquare");a.addParam("n","i32"),a.setReturnType("i32");const t=a.getCodeBuilder(),c=t.i32_const(l),f=t.i32_const(e.alloc(n));a.addCode(t.if(t.call(i+"_isZero",t.getLocal("n")),t.ret(t.i32_const(1))),t.call(i+"_exp",t.getLocal("n"),t.i32_const(g),t.i32_const(n),f),t.call(i+"_eq",f,c))}(),e.exportFunction(i+"_sqrt"),e.exportFunction(i+"_isSquare")),e.exportFunction(i+"_batchToMontgomery"),e.exportFunction(i+"_batchFromMontgomery"),i};const le=se,{bitLength:ue}=U;var he=function(e,a,t,c,f){const d=BigInt(a),r=Math.floor((ue(d-1n)-1)/64)+1,n=8*r,i=t||"f1";if(e.modules[i])return i;e.modules[i]={n64:r};const b=f||"int",o=le(e,d,c,b),s=e.modules[o].pR2,l=e.modules[o].pq,u=e.modules[o].pePlusOne;return function(){const a=e.alloc(n),t=e.addFunction(i+"_mul");t.addParam("x","i32"),t.addParam("y","i32"),t.addParam("r","i32");const c=t.getCodeBuilder();t.addCode(c.call(o+"_mul",c.getLocal("x"),c.getLocal("y"),c.i32_const(a))),t.addCode(c.call(o+"_mul",c.i32_const(a),c.i32_const(s),c.getLocal("r")))}(),function(){const a=e.addFunction(i+"_square");a.addParam("x","i32"),a.addParam("r","i32");const t=a.getCodeBuilder();a.addCode(t.call(i+"_mul",t.getLocal("x"),t.getLocal("x"),t.getLocal("r")))}(),function(){const a=e.addFunction(i+"_inverse");a.addParam("x","i32"),a.addParam("r","i32");const t=a.getCodeBuilder();a.addCode(t.call(b+"_inverseMod",t.getLocal("x"),t.i32_const(l),t.getLocal("r")))}(),function(){const a=e.addFunction(i+"_isNegative");a.addParam("x","i32"),a.setReturnType("i32");const t=a.getCodeBuilder();a.addCode(t.call(b+"_gte",t.getLocal("x"),t.i32_const(u)))}(),e.exportFunction(o+"_add",i+"_add"),e.exportFunction(o+"_sub",i+"_sub"),e.exportFunction(o+"_neg",i+"_neg"),e.exportFunction(i+"_mul"),e.exportFunction(i+"_square"),e.exportFunction(i+"_inverse"),e.exportFunction(i+"_isNegative"),e.exportFunction(o+"_copy",i+"_copy"),e.exportFunction(o+"_zero",i+"_zero"),e.exportFunction(o+"_one",i+"_one"),e.exportFunction(o+"_isZero",i+"_isZero"),e.exportFunction(o+"_eq",i+"_eq"),i};const pe=O,ge=F,me=D;var xe=function(e,a,t,c){if(e.modules[t])return t;const f=8*e.modules[c].n64,d=e.modules[c].q;return e.modules[t]={n64:2*e.modules[c].n64},function(){const a=e.addFunction(t+"_isZero");a.addParam("x","i32"),a.setReturnType("i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f));a.addCode(d.i32_and(d.call(c+"_isZero",r),d.call(c+"_isZero",n)))}(),function(){const a=e.addFunction(t+"_isOne");a.addParam("x","i32"),a.setReturnType("i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f));a.addCode(d.ret(d.i32_and(d.call(c+"_isOne",r),d.call(c+"_isZero",n))))}(),function(){const a=e.addFunction(t+"_zero");a.addParam("x","i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f));a.addCode(d.call(c+"_zero",r),d.call(c+"_zero",n))}(),function(){const a=e.addFunction(t+"_one");a.addParam("x","i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f));a.addCode(d.call(c+"_one",r),d.call(c+"_zero",n))}(),function(){const a=e.addFunction(t+"_copy");a.addParam("x","i32"),a.addParam("r","i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.getLocal("r"),b=d.i32_add(d.getLocal("r"),d.i32_const(f));a.addCode(d.call(c+"_copy",r,i),d.call(c+"_copy",n,b))}(),function(){const d=e.addFunction(t+"_mul");d.addParam("x","i32"),d.addParam("y","i32"),d.addParam("r","i32");const r=d.getCodeBuilder(),n=r.getLocal("x"),i=r.i32_add(r.getLocal("x"),r.i32_const(f)),b=r.getLocal("y"),o=r.i32_add(r.getLocal("y"),r.i32_const(f)),s=r.getLocal("r"),l=r.i32_add(r.getLocal("r"),r.i32_const(f)),u=r.i32_const(e.alloc(f)),h=r.i32_const(e.alloc(f)),p=r.i32_const(e.alloc(f)),g=r.i32_const(e.alloc(f));d.addCode(r.call(c+"_mul",n,b,u),r.call(c+"_mul",i,o,h),r.call(c+"_add",n,i,p),r.call(c+"_add",b,o,g),r.call(c+"_mul",p,g,p),r.call(a,h,s),r.call(c+"_add",u,s,s),r.call(c+"_add",u,h,l),r.call(c+"_sub",p,l,l))}(),function(){const a=e.addFunction(t+"_mul1");a.addParam("x","i32"),a.addParam("y","i32"),a.addParam("r","i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.getLocal("y"),b=d.getLocal("r"),o=d.i32_add(d.getLocal("r"),d.i32_const(f));a.addCode(d.call(c+"_mul",r,i,b),d.call(c+"_mul",n,i,o))}(),function(){const d=e.addFunction(t+"_square");d.addParam("x","i32"),d.addParam("r","i32");const r=d.getCodeBuilder(),n=r.getLocal("x"),i=r.i32_add(r.getLocal("x"),r.i32_const(f)),b=r.getLocal("r"),o=r.i32_add(r.getLocal("r"),r.i32_const(f)),s=r.i32_const(e.alloc(f)),l=r.i32_const(e.alloc(f)),u=r.i32_const(e.alloc(f)),h=r.i32_const(e.alloc(f));d.addCode(r.call(c+"_mul",n,i,s),r.call(c+"_add",n,i,l),r.call(a,i,u),r.call(c+"_add",n,u,u),r.call(a,s,h),r.call(c+"_add",h,s,h),r.call(c+"_mul",l,u,b),r.call(c+"_sub",b,h,b),r.call(c+"_add",s,s,o))}(),function(){const a=e.addFunction(t+"_add");a.addParam("x","i32"),a.addParam("y","i32"),a.addParam("r","i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.getLocal("y"),b=d.i32_add(d.getLocal("y"),d.i32_const(f)),o=d.getLocal("r"),s=d.i32_add(d.getLocal("r"),d.i32_const(f));a.addCode(d.call(c+"_add",r,i,o),d.call(c+"_add",n,b,s))}(),function(){const a=e.addFunction(t+"_sub");a.addParam("x","i32"),a.addParam("y","i32"),a.addParam("r","i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.getLocal("y"),b=d.i32_add(d.getLocal("y"),d.i32_const(f)),o=d.getLocal("r"),s=d.i32_add(d.getLocal("r"),d.i32_const(f));a.addCode(d.call(c+"_sub",r,i,o),d.call(c+"_sub",n,b,s))}(),function(){const a=e.addFunction(t+"_neg");a.addParam("x","i32"),a.addParam("r","i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.getLocal("r"),b=d.i32_add(d.getLocal("r"),d.i32_const(f));a.addCode(d.call(c+"_neg",r,i),d.call(c+"_neg",n,b))}(),function(){const a=e.addFunction(t+"_conjugate");a.addParam("x","i32"),a.addParam("r","i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.getLocal("r"),b=d.i32_add(d.getLocal("r"),d.i32_const(f));a.addCode(d.call(c+"_copy",r,i),d.call(c+"_neg",n,b))}(),function(){const a=e.addFunction(t+"_toMontgomery");a.addParam("x","i32"),a.addParam("r","i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.getLocal("r"),b=d.i32_add(d.getLocal("r"),d.i32_const(f));a.addCode(d.call(c+"_toMontgomery",r,i),d.call(c+"_toMontgomery",n,b))}(),function(){const a=e.addFunction(t+"_fromMontgomery");a.addParam("x","i32"),a.addParam("r","i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.getLocal("r"),b=d.i32_add(d.getLocal("r"),d.i32_const(f));a.addCode(d.call(c+"_fromMontgomery",r,i),d.call(c+"_fromMontgomery",n,b))}(),function(){const a=e.addFunction(t+"_eq");a.addParam("x","i32"),a.addParam("y","i32"),a.setReturnType("i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.getLocal("y"),b=d.i32_add(d.getLocal("y"),d.i32_const(f));a.addCode(d.i32_and(d.call(c+"_eq",r,i),d.call(c+"_eq",n,b)))}(),function(){const d=e.addFunction(t+"_inverse");d.addParam("x","i32"),d.addParam("r","i32");const r=d.getCodeBuilder(),n=r.getLocal("x"),i=r.i32_add(r.getLocal("x"),r.i32_const(f)),b=r.getLocal("r"),o=r.i32_add(r.getLocal("r"),r.i32_const(f)),s=r.i32_const(e.alloc(f)),l=r.i32_const(e.alloc(f)),u=r.i32_const(e.alloc(f)),h=r.i32_const(e.alloc(f));d.addCode(r.call(c+"_square",n,s),r.call(c+"_square",i,l),r.call(a,l,u),r.call(c+"_sub",s,u,u),r.call(c+"_inverse",u,h),r.call(c+"_mul",n,h,b),r.call(c+"_mul",i,h,o),r.call(c+"_neg",o,o))}(),function(){const a=e.addFunction(t+"_timesScalar");a.addParam("x","i32"),a.addParam("scalar","i32"),a.addParam("scalarLen","i32"),a.addParam("r","i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.getLocal("r"),b=d.i32_add(d.getLocal("r"),d.i32_const(f));a.addCode(d.call(c+"_timesScalar",r,d.getLocal("scalar"),d.getLocal("scalarLen"),i),d.call(c+"_timesScalar",n,d.getLocal("scalar"),d.getLocal("scalarLen"),b))}(),function(){const a=e.addFunction(t+"_sign");a.addParam("x","i32"),a.addLocal("s","i32"),a.setReturnType("i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f));a.addCode(d.setLocal("s",d.call(c+"_sign",n)),d.if(d.getLocal("s"),d.ret(d.getLocal("s"))),d.ret(d.call(c+"_sign",r)))}(),function(){const a=e.addFunction(t+"_isNegative");a.addParam("x","i32"),a.setReturnType("i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f));a.addCode(d.if(d.call(c+"_isZero",n),d.ret(d.call(c+"_isNegative",r))),d.ret(d.call(c+"_isNegative",n)))}(),e.exportFunction(t+"_isZero"),e.exportFunction(t+"_isOne"),e.exportFunction(t+"_zero"),e.exportFunction(t+"_one"),e.exportFunction(t+"_copy"),e.exportFunction(t+"_mul"),e.exportFunction(t+"_mul1"),e.exportFunction(t+"_square"),e.exportFunction(t+"_add"),e.exportFunction(t+"_sub"),e.exportFunction(t+"_neg"),e.exportFunction(t+"_sign"),e.exportFunction(t+"_conjugate"),e.exportFunction(t+"_fromMontgomery"),e.exportFunction(t+"_toMontgomery"),e.exportFunction(t+"_eq"),e.exportFunction(t+"_inverse"),ge(e,t),pe(e,t+"_exp",2*f,t+"_mul",t+"_square",t+"_copy",t+"_one"),function(){const a=e.addFunction(t+"_sqrt");a.addParam("a","i32"),a.addParam("pr","i32");const r=a.getCodeBuilder(),n=r.i32_const(e.alloc(me.bigInt2BytesLE((BigInt(d||0)-3n)/4n,f))),i=r.i32_const(e.alloc(me.bigInt2BytesLE((BigInt(d||0)-1n)/2n,f))),b=r.getLocal("a"),o=r.i32_const(e.alloc(2*f)),s=r.i32_const(e.alloc(2*f)),l=r.i32_const(e.alloc(2*f)),u=e.alloc(2*f),h=r.i32_const(u),p=r.i32_const(u),g=r.i32_const(u+f),m=r.i32_const(e.alloc(2*f)),x=r.i32_const(e.alloc(2*f));a.addCode(r.call(t+"_one",h),r.call(t+"_neg",h,h),r.call(t+"_exp",b,n,r.i32_const(f),o),r.call(t+"_square",o,s),r.call(t+"_mul",b,s,s),r.call(t+"_conjugate",s,l),r.call(t+"_mul",l,s,l),r.if(r.call(t+"_eq",l,h),r.unreachable()),r.call(t+"_mul",o,b,m),r.if(r.call(t+"_eq",s,h),[...r.call(c+"_zero",p),...r.call(c+"_one",g),...r.call(t+"_mul",h,m,r.getLocal("pr"))],[...r.call(t+"_one",x),...r.call(t+"_add",x,s,x),...r.call(t+"_exp",x,i,r.i32_const(f),x),...r.call(t+"_mul",x,m,r.getLocal("pr"))]))}(),function(){const a=e.addFunction(t+"_isSquare");a.addParam("a","i32"),a.setReturnType("i32");const c=a.getCodeBuilder(),r=c.i32_const(e.alloc(me.bigInt2BytesLE((BigInt(d||0)-3n)/4n,f))),n=c.getLocal("a"),i=c.i32_const(e.alloc(2*f)),b=c.i32_const(e.alloc(2*f)),o=c.i32_const(e.alloc(2*f)),s=e.alloc(2*f),l=c.i32_const(s);a.addCode(c.call(t+"_one",l),c.call(t+"_neg",l,l),c.call(t+"_exp",n,r,c.i32_const(f),i),c.call(t+"_square",i,b),c.call(t+"_mul",n,b,b),c.call(t+"_conjugate",b,o),c.call(t+"_mul",o,b,o),c.if(c.call(t+"_eq",o,l),c.ret(c.i32_const(0))),c.ret(c.i32_const(1)))}(),e.exportFunction(t+"_exp"),e.exportFunction(t+"_timesScalar"),e.exportFunction(t+"_batchInverse"),e.exportFunction(t+"_sqrt"),e.exportFunction(t+"_isSquare"),e.exportFunction(t+"_isNegative"),t};const ye=O,Ae=F;var ve=function(e,a,t,c){if(e.modules[t])return t;const f=8*e.modules[c].n64;return e.modules[t]={n64:3*e.modules[c].n64},function(){const a=e.addFunction(t+"_isZero");a.addParam("x","i32"),a.setReturnType("i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.i32_add(d.getLocal("x"),d.i32_const(2*f));a.addCode(d.i32_and(d.i32_and(d.call(c+"_isZero",r),d.call(c+"_isZero",n)),d.call(c+"_isZero",i)))}(),function(){const a=e.addFunction(t+"_isOne");a.addParam("x","i32"),a.setReturnType("i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.i32_add(d.getLocal("x"),d.i32_const(2*f));a.addCode(d.ret(d.i32_and(d.i32_and(d.call(c+"_isOne",r),d.call(c+"_isZero",n)),d.call(c+"_isZero",i))))}(),function(){const a=e.addFunction(t+"_zero");a.addParam("x","i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.i32_add(d.getLocal("x"),d.i32_const(2*f));a.addCode(d.call(c+"_zero",r),d.call(c+"_zero",n),d.call(c+"_zero",i))}(),function(){const a=e.addFunction(t+"_one");a.addParam("x","i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.i32_add(d.getLocal("x"),d.i32_const(2*f));a.addCode(d.call(c+"_one",r),d.call(c+"_zero",n),d.call(c+"_zero",i))}(),function(){const a=e.addFunction(t+"_copy");a.addParam("x","i32"),a.addParam("r","i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.i32_add(d.getLocal("x"),d.i32_const(2*f)),b=d.getLocal("r"),o=d.i32_add(d.getLocal("r"),d.i32_const(f)),s=d.i32_add(d.getLocal("r"),d.i32_const(2*f));a.addCode(d.call(c+"_copy",r,b),d.call(c+"_copy",n,o),d.call(c+"_copy",i,s))}(),function(){const d=e.addFunction(t+"_mul");d.addParam("x","i32"),d.addParam("y","i32"),d.addParam("r","i32");const r=d.getCodeBuilder(),n=r.getLocal("x"),i=r.i32_add(r.getLocal("x"),r.i32_const(f)),b=r.i32_add(r.getLocal("x"),r.i32_const(2*f)),o=r.getLocal("y"),s=r.i32_add(r.getLocal("y"),r.i32_const(f)),l=r.i32_add(r.getLocal("y"),r.i32_const(2*f)),u=r.getLocal("r"),h=r.i32_add(r.getLocal("r"),r.i32_const(f)),p=r.i32_add(r.getLocal("r"),r.i32_const(2*f)),g=r.i32_const(e.alloc(f)),m=r.i32_const(e.alloc(f)),x=r.i32_const(e.alloc(f)),y=r.i32_const(e.alloc(f)),A=r.i32_const(e.alloc(f)),v=r.i32_const(e.alloc(f)),w=r.i32_const(e.alloc(f)),_=r.i32_const(e.alloc(f)),I=r.i32_const(e.alloc(f)),E=r.i32_const(e.alloc(f)),C=r.i32_const(e.alloc(f)),M=r.i32_const(e.alloc(f)),B=r.i32_const(e.alloc(f));d.addCode(r.call(c+"_mul",n,o,g),r.call(c+"_mul",i,s,m),r.call(c+"_mul",b,l,x),r.call(c+"_add",n,i,y),r.call(c+"_add",o,s,A),r.call(c+"_add",n,b,v),r.call(c+"_add",o,l,w),r.call(c+"_add",i,b,_),r.call(c+"_add",s,l,I),r.call(c+"_add",g,m,E),r.call(c+"_add",g,x,C),r.call(c+"_add",m,x,M),r.call(c+"_mul",_,I,u),r.call(c+"_sub",u,M,u),r.call(a,u,u),r.call(c+"_add",g,u,u),r.call(c+"_mul",y,A,h),r.call(c+"_sub",h,E,h),r.call(a,x,B),r.call(c+"_add",h,B,h),r.call(c+"_mul",v,w,p),r.call(c+"_sub",p,C,p),r.call(c+"_add",p,m,p))}(),function(){const d=e.addFunction(t+"_square");d.addParam("x","i32"),d.addParam("r","i32");const r=d.getCodeBuilder(),n=r.getLocal("x"),i=r.i32_add(r.getLocal("x"),r.i32_const(f)),b=r.i32_add(r.getLocal("x"),r.i32_const(2*f)),o=r.getLocal("r"),s=r.i32_add(r.getLocal("r"),r.i32_const(f)),l=r.i32_add(r.getLocal("r"),r.i32_const(2*f)),u=r.i32_const(e.alloc(f)),h=r.i32_const(e.alloc(f)),p=r.i32_const(e.alloc(f)),g=r.i32_const(e.alloc(f)),m=r.i32_const(e.alloc(f)),x=r.i32_const(e.alloc(f)),y=r.i32_const(e.alloc(f));d.addCode(r.call(c+"_square",n,u),r.call(c+"_mul",n,i,h),r.call(c+"_add",h,h,p),r.call(c+"_sub",n,i,g),r.call(c+"_add",g,b,g),r.call(c+"_square",g,g),r.call(c+"_mul",i,b,m),r.call(c+"_add",m,m,x),r.call(c+"_square",b,y),r.call(a,x,o),r.call(c+"_add",u,o,o),r.call(a,y,s),r.call(c+"_add",p,s,s),r.call(c+"_add",u,y,l),r.call(c+"_sub",x,l,l),r.call(c+"_add",g,l,l),r.call(c+"_add",p,l,l))}(),function(){const a=e.addFunction(t+"_add");a.addParam("x","i32"),a.addParam("y","i32"),a.addParam("r","i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.i32_add(d.getLocal("x"),d.i32_const(2*f)),b=d.getLocal("y"),o=d.i32_add(d.getLocal("y"),d.i32_const(f)),s=d.i32_add(d.getLocal("y"),d.i32_const(2*f)),l=d.getLocal("r"),u=d.i32_add(d.getLocal("r"),d.i32_const(f)),h=d.i32_add(d.getLocal("r"),d.i32_const(2*f));a.addCode(d.call(c+"_add",r,b,l),d.call(c+"_add",n,o,u),d.call(c+"_add",i,s,h))}(),function(){const a=e.addFunction(t+"_sub");a.addParam("x","i32"),a.addParam("y","i32"),a.addParam("r","i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.i32_add(d.getLocal("x"),d.i32_const(2*f)),b=d.getLocal("y"),o=d.i32_add(d.getLocal("y"),d.i32_const(f)),s=d.i32_add(d.getLocal("y"),d.i32_const(2*f)),l=d.getLocal("r"),u=d.i32_add(d.getLocal("r"),d.i32_const(f)),h=d.i32_add(d.getLocal("r"),d.i32_const(2*f));a.addCode(d.call(c+"_sub",r,b,l),d.call(c+"_sub",n,o,u),d.call(c+"_sub",i,s,h))}(),function(){const a=e.addFunction(t+"_neg");a.addParam("x","i32"),a.addParam("r","i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.i32_add(d.getLocal("x"),d.i32_const(2*f)),b=d.getLocal("r"),o=d.i32_add(d.getLocal("r"),d.i32_const(f)),s=d.i32_add(d.getLocal("r"),d.i32_const(2*f));a.addCode(d.call(c+"_neg",r,b),d.call(c+"_neg",n,o),d.call(c+"_neg",i,s))}(),function(){const a=e.addFunction(t+"_sign");a.addParam("x","i32"),a.addLocal("s","i32"),a.setReturnType("i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.i32_add(d.getLocal("x"),d.i32_const(2*f));a.addCode(d.setLocal("s",d.call(c+"_sign",i)),d.if(d.getLocal("s"),d.ret(d.getLocal("s"))),d.setLocal("s",d.call(c+"_sign",n)),d.if(d.getLocal("s"),d.ret(d.getLocal("s"))),d.ret(d.call(c+"_sign",r)))}(),function(){const a=e.addFunction(t+"_toMontgomery");a.addParam("x","i32"),a.addParam("r","i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.i32_add(d.getLocal("x"),d.i32_const(2*f)),b=d.getLocal("r"),o=d.i32_add(d.getLocal("r"),d.i32_const(f)),s=d.i32_add(d.getLocal("r"),d.i32_const(2*f));a.addCode(d.call(c+"_toMontgomery",r,b),d.call(c+"_toMontgomery",n,o),d.call(c+"_toMontgomery",i,s))}(),function(){const a=e.addFunction(t+"_fromMontgomery");a.addParam("x","i32"),a.addParam("r","i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.i32_add(d.getLocal("x"),d.i32_const(2*f)),b=d.getLocal("r"),o=d.i32_add(d.getLocal("r"),d.i32_const(f)),s=d.i32_add(d.getLocal("r"),d.i32_const(2*f));a.addCode(d.call(c+"_fromMontgomery",r,b),d.call(c+"_fromMontgomery",n,o),d.call(c+"_fromMontgomery",i,s))}(),function(){const a=e.addFunction(t+"_eq");a.addParam("x","i32"),a.addParam("y","i32"),a.setReturnType("i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.i32_add(d.getLocal("x"),d.i32_const(2*f)),b=d.getLocal("y"),o=d.i32_add(d.getLocal("y"),d.i32_const(f)),s=d.i32_add(d.getLocal("y"),d.i32_const(2*f));a.addCode(d.i32_and(d.i32_and(d.call(c+"_eq",r,b),d.call(c+"_eq",n,o)),d.call(c+"_eq",i,s)))}(),function(){const d=e.addFunction(t+"_inverse");d.addParam("x","i32"),d.addParam("r","i32");const r=d.getCodeBuilder(),n=r.getLocal("x"),i=r.i32_add(r.getLocal("x"),r.i32_const(f)),b=r.i32_add(r.getLocal("x"),r.i32_const(2*f)),o=r.getLocal("r"),s=r.i32_add(r.getLocal("r"),r.i32_const(f)),l=r.i32_add(r.getLocal("r"),r.i32_const(2*f)),u=r.i32_const(e.alloc(f)),h=r.i32_const(e.alloc(f)),p=r.i32_const(e.alloc(f)),g=r.i32_const(e.alloc(f)),m=r.i32_const(e.alloc(f)),x=r.i32_const(e.alloc(f)),y=r.i32_const(e.alloc(f)),A=r.i32_const(e.alloc(f)),v=r.i32_const(e.alloc(f)),w=r.i32_const(e.alloc(f)),_=r.i32_const(e.alloc(f));d.addCode(r.call(c+"_square",n,u),r.call(c+"_square",i,h),r.call(c+"_square",b,p),r.call(c+"_mul",n,i,g),r.call(c+"_mul",n,b,m),r.call(c+"_mul",i,b,x),r.call(a,x,y),r.call(c+"_sub",u,y,y),r.call(a,p,A),r.call(c+"_sub",A,g,A),r.call(c+"_sub",h,m,v),r.call(c+"_mul",b,A,w),r.call(c+"_mul",i,v,_),r.call(c+"_add",w,_,w),r.call(a,w,w),r.call(c+"_mul",n,y,_),r.call(c+"_add",_,w,w),r.call(c+"_inverse",w,w),r.call(c+"_mul",w,y,o),r.call(c+"_mul",w,A,s),r.call(c+"_mul",w,v,l))}(),function(){const a=e.addFunction(t+"_timesScalar");a.addParam("x","i32"),a.addParam("scalar","i32"),a.addParam("scalarLen","i32"),a.addParam("r","i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.i32_add(d.getLocal("x"),d.i32_const(2*f)),b=d.getLocal("r"),o=d.i32_add(d.getLocal("r"),d.i32_const(f)),s=d.i32_add(d.getLocal("r"),d.i32_const(2*f));a.addCode(d.call(c+"_timesScalar",r,d.getLocal("scalar"),d.getLocal("scalarLen"),b),d.call(c+"_timesScalar",n,d.getLocal("scalar"),d.getLocal("scalarLen"),o),d.call(c+"_timesScalar",i,d.getLocal("scalar"),d.getLocal("scalarLen"),s))}(),function(){const a=e.addFunction(t+"_isNegative");a.addParam("x","i32"),a.setReturnType("i32");const d=a.getCodeBuilder(),r=d.getLocal("x"),n=d.i32_add(d.getLocal("x"),d.i32_const(f)),i=d.i32_add(d.getLocal("x"),d.i32_const(2*f));a.addCode(d.if(d.call(c+"_isZero",i),d.if(d.call(c+"_isZero",n),d.ret(d.call(c+"_isNegative",r)),d.ret(d.call(c+"_isNegative",n)))),d.ret(d.call(c+"_isNegative",i)))}(),e.exportFunction(t+"_isZero"),e.exportFunction(t+"_isOne"),e.exportFunction(t+"_zero"),e.exportFunction(t+"_one"),e.exportFunction(t+"_copy"),e.exportFunction(t+"_mul"),e.exportFunction(t+"_square"),e.exportFunction(t+"_add"),e.exportFunction(t+"_sub"),e.exportFunction(t+"_neg"),e.exportFunction(t+"_sign"),e.exportFunction(t+"_fromMontgomery"),e.exportFunction(t+"_toMontgomery"),e.exportFunction(t+"_eq"),e.exportFunction(t+"_inverse"),Ae(e,t),ye(e,t+"_exp",3*f,t+"_mul",t+"_square",t+"_copy",t+"_one"),e.exportFunction(t+"_exp"),e.exportFunction(t+"_timesScalar"),e.exportFunction(t+"_batchInverse"),e.exportFunction(t+"_isNegative"),t};const we=function(e,a,t,c,f,d,r,n){const i=e.addFunction(a);i.addParam("base","i32"),i.addParam("scalar","i32"),i.addParam("scalarLength","i32"),i.addParam("r","i32"),i.addLocal("old0","i32"),i.addLocal("nbits","i32"),i.addLocal("i","i32"),i.addLocal("last","i32"),i.addLocal("cur","i32"),i.addLocal("carry","i32"),i.addLocal("p","i32");const b=i.getCodeBuilder(),o=b.i32_const(e.alloc(t));function s(e){return b.i32_and(b.i32_shr_u(b.i32_load(b.i32_add(b.getLocal("scalar"),b.i32_and(b.i32_shr_u(e,b.i32_const(3)),b.i32_const(4294967292)))),b.i32_and(e,b.i32_const(31))),b.i32_const(1))}function l(e){return[...b.i32_store8(b.getLocal("p"),b.i32_const(e)),...b.setLocal("p",b.i32_add(b.getLocal("p"),b.i32_const(1)))]}i.addCode(b.if(b.i32_eqz(b.getLocal("scalarLength")),[...b.call(n,b.getLocal("r")),...b.ret([])]),b.setLocal("nbits",b.i32_shl(b.getLocal("scalarLength"),b.i32_const(3))),b.setLocal("old0",b.i32_load(b.i32_const(0))),b.setLocal("p",b.getLocal("old0")),b.i32_store(b.i32_const(0),b.i32_and(b.i32_add(b.i32_add(b.getLocal("old0"),b.i32_const(32)),b.getLocal("nbits")),b.i32_const(4294967288))),b.setLocal("i",b.i32_const(1)),b.setLocal("last",s(b.i32_const(0))),b.setLocal("carry",b.i32_const(0)),b.block(b.loop(b.br_if(1,b.i32_eq(b.getLocal("i"),b.getLocal("nbits"))),b.setLocal("cur",s(b.getLocal("i"))),b.if(b.getLocal("last"),b.if(b.getLocal("cur"),b.if(b.getLocal("carry"),[...b.setLocal("last",b.i32_const(0)),...b.setLocal("carry",b.i32_const(1)),...l(1)],[...b.setLocal("last",b.i32_const(0)),...b.setLocal("carry",b.i32_const(1)),...l(255)]),b.if(b.getLocal("carry"),[...b.setLocal("last",b.i32_const(0)),...b.setLocal("carry",b.i32_const(1)),...l(255)],[...b.setLocal("last",b.i32_const(0)),...b.setLocal("carry",b.i32_const(0)),...l(1)])),b.if(b.getLocal("cur"),b.if(b.getLocal("carry"),[...b.setLocal("last",b.i32_const(0)),...b.setLocal("carry",b.i32_const(1)),...l(0)],[...b.setLocal("last",b.i32_const(1)),...b.setLocal("carry",b.i32_const(0)),...l(0)]),b.if(b.getLocal("carry"),[...b.setLocal("last",b.i32_const(1)),...b.setLocal("carry",b.i32_const(0)),...l(0)],[...b.setLocal("last",b.i32_const(0)),...b.setLocal("carry",b.i32_const(0)),...l(0)]))),b.setLocal("i",b.i32_add(b.getLocal("i"),b.i32_const(1))),b.br(0))),b.if(b.getLocal("last"),b.if(b.getLocal("carry"),[...l(255),...l(0),...l(1)],[...l(1)]),b.if(b.getLocal("carry"),[...l(0),...l(1)])),b.setLocal("p",b.i32_sub(b.getLocal("p"),b.i32_const(1))),b.call(r,b.getLocal("base"),o),b.call(n,b.getLocal("r")),b.block(b.loop(b.call(f,b.getLocal("r"),b.getLocal("r")),b.setLocal("cur",b.i32_load8_u(b.getLocal("p"))),b.if(b.getLocal("cur"),b.if(b.i32_eq(b.getLocal("cur"),b.i32_const(1)),b.call(c,b.getLocal("r"),o,b.getLocal("r")),b.call(d,b.getLocal("r"),o,b.getLocal("r")))),b.br_if(1,b.i32_eq(b.getLocal("old0"),b.getLocal("p"))),b.setLocal("p",b.i32_sub(b.getLocal("p"),b.i32_const(1))),b.br(0))),b.i32_store(b.i32_const(0),b.getLocal("old0")))},_e=Q,Ie=function(e,a,t,c,f){const d=8*e.modules[a].n64;!function(){const a=e.addFunction(t+"_getChunk");a.addParam("pScalar","i32"),a.addParam("scalarSize","i32"),a.addParam("startBit","i32"),a.addParam("chunkSize","i32"),a.addLocal("bitsToEnd","i32"),a.addLocal("mask","i32"),a.setReturnType("i32");const c=a.getCodeBuilder();a.addCode(c.setLocal("bitsToEnd",c.i32_sub(c.i32_mul(c.getLocal("scalarSize"),c.i32_const(8)),c.getLocal("startBit"))),c.if(c.i32_gt_s(c.getLocal("chunkSize"),c.getLocal("bitsToEnd")),c.setLocal("mask",c.i32_sub(c.i32_shl(c.i32_const(1),c.getLocal("bitsToEnd")),c.i32_const(1))),c.setLocal("mask",c.i32_sub(c.i32_shl(c.i32_const(1),c.getLocal("chunkSize")),c.i32_const(1)))),c.i32_and(c.i32_shr_u(c.i32_load(c.i32_add(c.getLocal("pScalar"),c.i32_shr_u(c.getLocal("startBit"),c.i32_const(3))),0,0),c.i32_and(c.getLocal("startBit"),c.i32_const(7))),c.getLocal("mask")))}(),function(){const c=e.addFunction(t+"_reduceTable");c.addParam("pTable","i32"),c.addParam("p","i32"),c.addLocal("half","i32"),c.addLocal("it1","i32"),c.addLocal("it2","i32"),c.addLocal("pAcc","i32");const f=c.getCodeBuilder();c.addCode(f.if(f.i32_eq(f.getLocal("p"),f.i32_const(1)),f.ret([])),f.setLocal("half",f.i32_shl(f.i32_const(1),f.i32_sub(f.getLocal("p"),f.i32_const(1)))),f.setLocal("it1",f.getLocal("pTable")),f.setLocal("it2",f.i32_add(f.getLocal("pTable"),f.i32_mul(f.getLocal("half"),f.i32_const(d)))),f.setLocal("pAcc",f.i32_sub(f.getLocal("it2"),f.i32_const(d))),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal("it1"),f.getLocal("pAcc"))),f.call(a+"_add",f.getLocal("it1"),f.getLocal("it2"),f.getLocal("it1")),f.call(a+"_add",f.getLocal("pAcc"),f.getLocal("it2"),f.getLocal("pAcc")),f.setLocal("it1",f.i32_add(f.getLocal("it1"),f.i32_const(d))),f.setLocal("it2",f.i32_add(f.getLocal("it2"),f.i32_const(d))),f.br(0))),f.call(t+"_reduceTable",f.getLocal("pTable"),f.i32_sub(f.getLocal("p"),f.i32_const(1))),f.setLocal("p",f.i32_sub(f.getLocal("p"),f.i32_const(1))),f.block(f.loop(f.br_if(1,f.i32_eqz(f.getLocal("p"))),f.call(a+"_double",f.getLocal("pAcc"),f.getLocal("pAcc")),f.setLocal("p",f.i32_sub(f.getLocal("p"),f.i32_const(1))),f.br(0))),f.call(a+"_add",f.getLocal("pTable"),f.getLocal("pAcc"),f.getLocal("pTable")))}(),function(){const r=e.addFunction(t+"_chunk");r.addParam("pBases","i32"),r.addParam("pScalars","i32"),r.addParam("scalarSize","i32"),r.addParam("n","i32"),r.addParam("startBit","i32"),r.addParam("chunkSize","i32"),r.addParam("pr","i32"),r.addLocal("nChunks","i32"),r.addLocal("itScalar","i32"),r.addLocal("endScalar","i32"),r.addLocal("itBase","i32"),r.addLocal("i","i32"),r.addLocal("j","i32"),r.addLocal("nTable","i32"),r.addLocal("pTable","i32"),r.addLocal("idx","i32"),r.addLocal("pIdxTable","i32");const n=r.getCodeBuilder();r.addCode(n.if(n.i32_eqz(n.getLocal("n")),[...n.call(a+"_zero",n.getLocal("pr")),...n.ret([])]),n.setLocal("nTable",n.i32_shl(n.i32_const(1),n.getLocal("chunkSize"))),n.setLocal("pTable",n.i32_load(n.i32_const(0))),n.i32_store(n.i32_const(0),n.i32_add(n.getLocal("pTable"),n.i32_mul(n.getLocal("nTable"),n.i32_const(d)))),n.setLocal("j",n.i32_const(0)),n.block(n.loop(n.br_if(1,n.i32_eq(n.getLocal("j"),n.getLocal("nTable"))),n.call(a+"_zero",n.i32_add(n.getLocal("pTable"),n.i32_mul(n.getLocal("j"),n.i32_const(d)))),n.setLocal("j",n.i32_add(n.getLocal("j"),n.i32_const(1))),n.br(0))),n.setLocal("itBase",n.getLocal("pBases")),n.setLocal("itScalar",n.getLocal("pScalars")),n.setLocal("endScalar",n.i32_add(n.getLocal("pScalars"),n.i32_mul(n.getLocal("n"),n.getLocal("scalarSize")))),n.block(n.loop(n.br_if(1,n.i32_eq(n.getLocal("itScalar"),n.getLocal("endScalar"))),n.setLocal("idx",n.call(t+"_getChunk",n.getLocal("itScalar"),n.getLocal("scalarSize"),n.getLocal("startBit"),n.getLocal("chunkSize"))),n.if(n.getLocal("idx"),[...n.setLocal("pIdxTable",n.i32_add(n.getLocal("pTable"),n.i32_mul(n.i32_sub(n.getLocal("idx"),n.i32_const(1)),n.i32_const(d)))),...n.call(c,n.getLocal("pIdxTable"),n.getLocal("itBase"),n.getLocal("pIdxTable"))]),n.setLocal("itScalar",n.i32_add(n.getLocal("itScalar"),n.getLocal("scalarSize"))),n.setLocal("itBase",n.i32_add(n.getLocal("itBase"),n.i32_const(f))),n.br(0))),n.call(t+"_reduceTable",n.getLocal("pTable"),n.getLocal("chunkSize")),n.call(a+"_copy",n.getLocal("pTable"),n.getLocal("pr")),n.i32_store(n.i32_const(0),n.getLocal("pTable")))}(),function(){const c=e.addFunction(t);c.addParam("pBases","i32"),c.addParam("pScalars","i32"),c.addParam("scalarSize","i32"),c.addParam("n","i32"),c.addParam("pr","i32"),c.addLocal("chunkSize","i32"),c.addLocal("nChunks","i32"),c.addLocal("itScalar","i32"),c.addLocal("endScalar","i32"),c.addLocal("itBase","i32"),c.addLocal("itBit","i32"),c.addLocal("i","i32"),c.addLocal("j","i32"),c.addLocal("nTable","i32"),c.addLocal("pTable","i32"),c.addLocal("idx","i32"),c.addLocal("pIdxTable","i32");const f=c.getCodeBuilder(),r=f.i32_const(e.alloc(d)),n=e.alloc([17,17,17,17,17,17,17,17,17,17,16,16,15,14,13,13,12,11,10,9,8,7,7,6,5,4,3,2,1,1,1,1]);c.addCode(f.call(a+"_zero",f.getLocal("pr")),f.if(f.i32_eqz(f.getLocal("n")),f.ret([])),f.setLocal("chunkSize",f.i32_load8_u(f.i32_clz(f.getLocal("n")),n)),f.setLocal("nChunks",f.i32_add(f.i32_div_u(f.i32_sub(f.i32_shl(f.getLocal("scalarSize"),f.i32_const(3)),f.i32_const(1)),f.getLocal("chunkSize")),f.i32_const(1))),f.setLocal("itBit",f.i32_mul(f.i32_sub(f.getLocal("nChunks"),f.i32_const(1)),f.getLocal("chunkSize"))),f.block(f.loop(f.br_if(1,f.i32_lt_s(f.getLocal("itBit"),f.i32_const(0))),f.if(f.i32_eqz(f.call(a+"_isZero",f.getLocal("pr"))),[...f.setLocal("j",f.i32_const(0)),...f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal("j"),f.getLocal("chunkSize"))),f.call(a+"_double",f.getLocal("pr"),f.getLocal("pr")),f.setLocal("j",f.i32_add(f.getLocal("j"),f.i32_const(1))),f.br(0)))]),f.call(t+"_chunk",f.getLocal("pBases"),f.getLocal("pScalars"),f.getLocal("scalarSize"),f.getLocal("n"),f.getLocal("itBit"),f.getLocal("chunkSize"),r),f.call(a+"_add",f.getLocal("pr"),r,f.getLocal("pr")),f.setLocal("itBit",f.i32_sub(f.getLocal("itBit"),f.getLocal("chunkSize"))),f.br(0))))}(),e.exportFunction(t),e.exportFunction(t+"_chunk")};var Ee=function(e,a,t,c){const f=e.modules[t].n64,d=8*f;return e.modules[a]||(e.modules[a]={n64:3*f},function(){const c=e.addFunction(a+"_isZeroAffine");c.addParam("p1","i32"),c.setReturnType("i32");const f=c.getCodeBuilder();c.addCode(f.i32_and(f.call(t+"_isZero",f.getLocal("p1")),f.call(t+"_isZero",f.i32_add(f.getLocal("p1"),f.i32_const(d)))))}(),function(){const c=e.addFunction(a+"_isZero");c.addParam("p1","i32"),c.setReturnType("i32");const f=c.getCodeBuilder();c.addCode(f.call(t+"_isZero",f.i32_add(f.getLocal("p1"),f.i32_const(2*d))))}(),function(){const c=e.addFunction(a+"_zeroAffine");c.addParam("pr","i32");const f=c.getCodeBuilder();c.addCode(f.call(t+"_zero",f.getLocal("pr"))),c.addCode(f.call(t+"_zero",f.i32_add(f.getLocal("pr"),f.i32_const(d))))}(),function(){const c=e.addFunction(a+"_zero");c.addParam("pr","i32");const f=c.getCodeBuilder();c.addCode(f.call(t+"_zero",f.getLocal("pr"))),c.addCode(f.call(t+"_one",f.i32_add(f.getLocal("pr"),f.i32_const(d)))),c.addCode(f.call(t+"_zero",f.i32_add(f.getLocal("pr"),f.i32_const(2*d))))}(),function(){const t=e.addFunction(a+"_copyAffine");t.addParam("ps","i32"),t.addParam("pd","i32");const c=t.getCodeBuilder();for(let e=0;e<2*f;e++)t.addCode(c.i64_store(c.getLocal("pd"),8*e,c.i64_load(c.getLocal("ps"),8*e)))}(),function(){const t=e.addFunction(a+"_copy");t.addParam("ps","i32"),t.addParam("pd","i32");const c=t.getCodeBuilder();for(let e=0;e<3*f;e++)t.addCode(c.i64_store(c.getLocal("pd"),8*e,c.i64_load(c.getLocal("ps"),8*e)))}(),function(){const c=e.addFunction(a+"_toJacobian");c.addParam("p1","i32"),c.addParam("pr","i32");const f=c.getCodeBuilder(),r=f.getLocal("p1"),n=f.i32_add(f.getLocal("p1"),f.i32_const(d)),i=f.getLocal("pr"),b=f.i32_add(f.getLocal("pr"),f.i32_const(d)),o=f.i32_add(f.getLocal("pr"),f.i32_const(2*d));c.addCode(f.if(f.call(a+"_isZeroAffine",f.getLocal("p1")),f.call(a+"_zero",f.getLocal("pr")),[...f.call(t+"_one",o),...f.call(t+"_copy",n,b),...f.call(t+"_copy",r,i)]))}(),function(){const c=e.addFunction(a+"_eqAffine");c.addParam("p1","i32"),c.addParam("p2","i32"),c.setReturnType("i32"),c.addLocal("z1","i32");const f=c.getCodeBuilder();c.addCode(f.ret(f.i32_and(f.call(t+"_eq",f.getLocal("p1"),f.getLocal("p2")),f.call(t+"_eq",f.i32_add(f.getLocal("p1"),f.i32_const(d)),f.i32_add(f.getLocal("p2"),f.i32_const(d))))))}(),function(){const c=e.addFunction(a+"_eqMixed");c.addParam("p1","i32"),c.addParam("p2","i32"),c.setReturnType("i32"),c.addLocal("z1","i32");const f=c.getCodeBuilder(),r=f.getLocal("p1"),n=f.i32_add(f.getLocal("p1"),f.i32_const(d));c.addCode(f.setLocal("z1",f.i32_add(f.getLocal("p1"),f.i32_const(2*d))));const i=f.getLocal("z1"),b=f.getLocal("p2"),o=f.i32_add(f.getLocal("p2"),f.i32_const(d)),s=f.i32_const(e.alloc(d)),l=f.i32_const(e.alloc(d)),u=f.i32_const(e.alloc(d)),h=f.i32_const(e.alloc(d));c.addCode(f.if(f.call(a+"_isZero",f.getLocal("p1")),f.ret(f.call(a+"_isZeroAffine",f.getLocal("p2")))),f.if(f.call(a+"_isZeroAffine",f.getLocal("p2")),f.ret(f.i32_const(0))),f.if(f.call(t+"_isOne",i),f.ret(f.call(a+"_eqAffine",f.getLocal("p1"),f.getLocal("p2")))),f.call(t+"_square",i,s),f.call(t+"_mul",b,s,l),f.call(t+"_mul",i,s,u),f.call(t+"_mul",o,u,h),f.if(f.call(t+"_eq",r,l),f.if(f.call(t+"_eq",n,h),f.ret(f.i32_const(1)))),f.ret(f.i32_const(0)))}(),function(){const c=e.addFunction(a+"_eq");c.addParam("p1","i32"),c.addParam("p2","i32"),c.setReturnType("i32"),c.addLocal("z1","i32"),c.addLocal("z2","i32");const f=c.getCodeBuilder(),r=f.getLocal("p1"),n=f.i32_add(f.getLocal("p1"),f.i32_const(d));c.addCode(f.setLocal("z1",f.i32_add(f.getLocal("p1"),f.i32_const(2*d))));const i=f.getLocal("z1"),b=f.getLocal("p2"),o=f.i32_add(f.getLocal("p2"),f.i32_const(d));c.addCode(f.setLocal("z2",f.i32_add(f.getLocal("p2"),f.i32_const(2*d))));const s=f.getLocal("z2"),l=f.i32_const(e.alloc(d)),u=f.i32_const(e.alloc(d)),h=f.i32_const(e.alloc(d)),p=f.i32_const(e.alloc(d)),g=f.i32_const(e.alloc(d)),m=f.i32_const(e.alloc(d)),x=f.i32_const(e.alloc(d)),y=f.i32_const(e.alloc(d));c.addCode(f.if(f.call(a+"_isZero",f.getLocal("p1")),f.ret(f.call(a+"_isZero",f.getLocal("p2")))),f.if(f.call(a+"_isZero",f.getLocal("p2")),f.ret(f.i32_const(0))),f.if(f.call(t+"_isOne",i),f.ret(f.call(a+"_eqMixed",f.getLocal("p2"),f.getLocal("p1")))),f.if(f.call(t+"_isOne",s),f.ret(f.call(a+"_eqMixed",f.getLocal("p1"),f.getLocal("p2")))),f.call(t+"_square",i,l),f.call(t+"_square",s,u),f.call(t+"_mul",r,u,h),f.call(t+"_mul",b,l,p),f.call(t+"_mul",i,l,g),f.call(t+"_mul",s,u,m),f.call(t+"_mul",n,m,x),f.call(t+"_mul",o,g,y),f.if(f.call(t+"_eq",h,p),f.if(f.call(t+"_eq",x,y),f.ret(f.i32_const(1)))),f.ret(f.i32_const(0)))}(),function(){const c=e.addFunction(a+"_doubleAffine");c.addParam("p1","i32"),c.addParam("pr","i32");const f=c.getCodeBuilder(),r=f.getLocal("p1"),n=f.i32_add(f.getLocal("p1"),f.i32_const(d)),i=f.getLocal("pr"),b=f.i32_add(f.getLocal("pr"),f.i32_const(d)),o=f.i32_add(f.getLocal("pr"),f.i32_const(2*d)),s=f.i32_const(e.alloc(d)),l=f.i32_const(e.alloc(d)),u=f.i32_const(e.alloc(d)),h=f.i32_const(e.alloc(d)),p=f.i32_const(e.alloc(d)),g=f.i32_const(e.alloc(d));c.addCode(f.if(f.call(a+"_isZeroAffine",f.getLocal("p1")),[...f.call(a+"_toJacobian",f.getLocal("p1"),f.getLocal("pr")),...f.ret([])]),f.call(t+"_square",r,s),f.call(t+"_square",n,l),f.call(t+"_square",l,u),f.call(t+"_add",r,l,h),f.call(t+"_square",h,h),f.call(t+"_sub",h,s,h),f.call(t+"_sub",h,u,h),f.call(t+"_add",h,h,h),f.call(t+"_add",s,s,p),f.call(t+"_add",p,s,p),f.call(t+"_add",n,n,o),f.call(t+"_square",p,i),f.call(t+"_sub",i,h,i),f.call(t+"_sub",i,h,i),f.call(t+"_add",u,u,g),f.call(t+"_add",g,g,g),f.call(t+"_add",g,g,g),f.call(t+"_sub",h,i,b),f.call(t+"_mul",b,p,b),f.call(t+"_sub",b,g,b))}(),function(){const c=e.addFunction(a+"_double");c.addParam("p1","i32"),c.addParam("pr","i32");const f=c.getCodeBuilder(),r=f.getLocal("p1"),n=f.i32_add(f.getLocal("p1"),f.i32_const(d)),i=f.i32_add(f.getLocal("p1"),f.i32_const(2*d)),b=f.getLocal("pr"),o=f.i32_add(f.getLocal("pr"),f.i32_const(d)),s=f.i32_add(f.getLocal("pr"),f.i32_const(2*d)),l=f.i32_const(e.alloc(d)),u=f.i32_const(e.alloc(d)),h=f.i32_const(e.alloc(d)),p=f.i32_const(e.alloc(d)),g=f.i32_const(e.alloc(d)),m=f.i32_const(e.alloc(d)),x=f.i32_const(e.alloc(d)),y=f.i32_const(e.alloc(d));c.addCode(f.if(f.call(a+"_isZero",f.getLocal("p1")),[...f.call(a+"_copy",f.getLocal("p1"),f.getLocal("pr")),...f.ret([])]),f.if(f.call(t+"_isOne",i),[...f.ret(f.call(a+"_doubleAffine",f.getLocal("p1"),f.getLocal("pr"))),...f.ret([])]),f.call(t+"_square",r,l),f.call(t+"_square",n,u),f.call(t+"_square",u,h),f.call(t+"_add",r,u,p),f.call(t+"_square",p,p),f.call(t+"_sub",p,l,p),f.call(t+"_sub",p,h,p),f.call(t+"_add",p,p,p),f.call(t+"_add",l,l,g),f.call(t+"_add",g,l,g),f.call(t+"_square",g,m),f.call(t+"_mul",n,i,x),f.call(t+"_add",p,p,b),f.call(t+"_sub",m,b,b),f.call(t+"_add",h,h,y),f.call(t+"_add",y,y,y),f.call(t+"_add",y,y,y),f.call(t+"_sub",p,b,o),f.call(t+"_mul",o,g,o),f.call(t+"_sub",o,y,o),f.call(t+"_add",x,x,s))}(),function(){const c=e.addFunction(a+"_addAffine");c.addParam("p1","i32"),c.addParam("p2","i32"),c.addParam("pr","i32"),c.addLocal("z1","i32");const f=c.getCodeBuilder(),r=f.getLocal("p1"),n=f.i32_add(f.getLocal("p1"),f.i32_const(d));c.addCode(f.setLocal("z1",f.i32_add(f.getLocal("p1"),f.i32_const(2*d))));const i=f.getLocal("p2"),b=f.i32_add(f.getLocal("p2"),f.i32_const(d)),o=f.getLocal("pr"),s=f.i32_add(f.getLocal("pr"),f.i32_const(d)),l=f.i32_add(f.getLocal("pr"),f.i32_const(2*d)),u=f.i32_const(e.alloc(d)),h=f.i32_const(e.alloc(d)),p=f.i32_const(e.alloc(d)),g=f.i32_const(e.alloc(d)),m=f.i32_const(e.alloc(d)),x=f.i32_const(e.alloc(d)),y=f.i32_const(e.alloc(d)),A=f.i32_const(e.alloc(d)),v=f.i32_const(e.alloc(d)),w=f.i32_const(e.alloc(d));c.addCode(f.if(f.call(a+"_isZeroAffine",f.getLocal("p1")),[...f.call(a+"_copyAffine",f.getLocal("p2"),f.getLocal("pr")),...f.call(t+"_one",f.i32_add(f.getLocal("pr"),f.i32_const(2*d))),...f.ret([])]),f.if(f.call(a+"_isZeroAffine",f.getLocal("p2")),[...f.call(a+"_copyAffine",f.getLocal("p1"),f.getLocal("pr")),...f.call(t+"_one",f.i32_add(f.getLocal("pr"),f.i32_const(2*d))),...f.ret([])]),f.if(f.call(t+"_eq",r,i),f.if(f.call(t+"_eq",n,b),[...f.call(a+"_doubleAffine",f.getLocal("p2"),f.getLocal("pr")),...f.ret([])])),f.call(t+"_sub",i,r,u),f.call(t+"_sub",b,n,p),f.call(t+"_square",u,h),f.call(t+"_add",h,h,g),f.call(t+"_add",g,g,g),f.call(t+"_mul",u,g,m),f.call(t+"_add",p,p,x),f.call(t+"_mul",r,g,A),f.call(t+"_square",x,y),f.call(t+"_add",A,A,v),f.call(t+"_sub",y,m,o),f.call(t+"_sub",o,v,o),f.call(t+"_mul",n,m,w),f.call(t+"_add",w,w,w),f.call(t+"_sub",A,o,s),f.call(t+"_mul",s,x,s),f.call(t+"_sub",s,w,s),f.call(t+"_add",u,u,l))}(),function(){const c=e.addFunction(a+"_addMixed");c.addParam("p1","i32"),c.addParam("p2","i32"),c.addParam("pr","i32"),c.addLocal("z1","i32");const f=c.getCodeBuilder(),r=f.getLocal("p1"),n=f.i32_add(f.getLocal("p1"),f.i32_const(d));c.addCode(f.setLocal("z1",f.i32_add(f.getLocal("p1"),f.i32_const(2*d))));const i=f.getLocal("z1"),b=f.getLocal("p2"),o=f.i32_add(f.getLocal("p2"),f.i32_const(d)),s=f.getLocal("pr"),l=f.i32_add(f.getLocal("pr"),f.i32_const(d)),u=f.i32_add(f.getLocal("pr"),f.i32_const(2*d)),h=f.i32_const(e.alloc(d)),p=f.i32_const(e.alloc(d)),g=f.i32_const(e.alloc(d)),m=f.i32_const(e.alloc(d)),x=f.i32_const(e.alloc(d)),y=f.i32_const(e.alloc(d)),A=f.i32_const(e.alloc(d)),v=f.i32_const(e.alloc(d)),w=f.i32_const(e.alloc(d)),_=f.i32_const(e.alloc(d)),I=f.i32_const(e.alloc(d)),E=f.i32_const(e.alloc(d)),C=f.i32_const(e.alloc(d)),M=f.i32_const(e.alloc(d));c.addCode(f.if(f.call(a+"_isZero",f.getLocal("p1")),[...f.call(a+"_copyAffine",f.getLocal("p2"),f.getLocal("pr")),...f.call(t+"_one",f.i32_add(f.getLocal("pr"),f.i32_const(2*d))),...f.ret([])]),f.if(f.call(a+"_isZeroAffine",f.getLocal("p2")),[...f.call(a+"_copy",f.getLocal("p1"),f.getLocal("pr")),...f.ret([])]),f.if(f.call(t+"_isOne",i),[...f.call(a+"_addAffine",r,b,s),...f.ret([])]),f.call(t+"_square",i,h),f.call(t+"_mul",b,h,p),f.call(t+"_mul",i,h,g),f.call(t+"_mul",o,g,m),f.if(f.call(t+"_eq",r,p),f.if(f.call(t+"_eq",n,m),[...f.call(a+"_doubleAffine",f.getLocal("p2"),f.getLocal("pr")),...f.ret([])])),f.call(t+"_sub",p,r,x),f.call(t+"_sub",m,n,A),f.call(t+"_square",x,y),f.call(t+"_add",y,y,v),f.call(t+"_add",v,v,v),f.call(t+"_mul",x,v,w),f.call(t+"_add",A,A,_),f.call(t+"_mul",r,v,E),f.call(t+"_square",_,I),f.call(t+"_add",E,E,C),f.call(t+"_sub",I,w,s),f.call(t+"_sub",s,C,s),f.call(t+"_mul",n,w,M),f.call(t+"_add",M,M,M),f.call(t+"_sub",E,s,l),f.call(t+"_mul",l,_,l),f.call(t+"_sub",l,M,l),f.call(t+"_add",i,x,u),f.call(t+"_square",u,u),f.call(t+"_sub",u,h,u),f.call(t+"_sub",u,y,u))}(),function(){const c=e.addFunction(a+"_add");c.addParam("p1","i32"),c.addParam("p2","i32"),c.addParam("pr","i32"),c.addLocal("z1","i32"),c.addLocal("z2","i32");const f=c.getCodeBuilder(),r=f.getLocal("p1"),n=f.i32_add(f.getLocal("p1"),f.i32_const(d));c.addCode(f.setLocal("z1",f.i32_add(f.getLocal("p1"),f.i32_const(2*d))));const i=f.getLocal("z1"),b=f.getLocal("p2"),o=f.i32_add(f.getLocal("p2"),f.i32_const(d));c.addCode(f.setLocal("z2",f.i32_add(f.getLocal("p2"),f.i32_const(2*d))));const s=f.getLocal("z2"),l=f.getLocal("pr"),u=f.i32_add(f.getLocal("pr"),f.i32_const(d)),h=f.i32_add(f.getLocal("pr"),f.i32_const(2*d)),p=f.i32_const(e.alloc(d)),g=f.i32_const(e.alloc(d)),m=f.i32_const(e.alloc(d)),x=f.i32_const(e.alloc(d)),y=f.i32_const(e.alloc(d)),A=f.i32_const(e.alloc(d)),v=f.i32_const(e.alloc(d)),w=f.i32_const(e.alloc(d)),_=f.i32_const(e.alloc(d)),I=f.i32_const(e.alloc(d)),E=f.i32_const(e.alloc(d)),C=f.i32_const(e.alloc(d)),M=f.i32_const(e.alloc(d)),B=f.i32_const(e.alloc(d)),k=f.i32_const(e.alloc(d)),L=f.i32_const(e.alloc(d)),S=f.i32_const(e.alloc(d));c.addCode(f.if(f.call(a+"_isZero",f.getLocal("p1")),[...f.call(a+"_copy",f.getLocal("p2"),f.getLocal("pr")),...f.ret([])]),f.if(f.call(a+"_isZero",f.getLocal("p2")),[...f.call(a+"_copy",f.getLocal("p1"),f.getLocal("pr")),...f.ret([])]),f.if(f.call(t+"_isOne",i),[...f.call(a+"_addMixed",b,r,l),...f.ret([])]),f.if(f.call(t+"_isOne",s),[...f.call(a+"_addMixed",r,b,l),...f.ret([])]),f.call(t+"_square",i,p),f.call(t+"_square",s,g),f.call(t+"_mul",r,g,m),f.call(t+"_mul",b,p,x),f.call(t+"_mul",i,p,y),f.call(t+"_mul",s,g,A),f.call(t+"_mul",n,A,v),f.call(t+"_mul",o,y,w),f.if(f.call(t+"_eq",m,x),f.if(f.call(t+"_eq",v,w),[...f.call(a+"_double",f.getLocal("p1"),f.getLocal("pr")),...f.ret([])])),f.call(t+"_sub",x,m,_),f.call(t+"_sub",w,v,I),f.call(t+"_add",_,_,E),f.call(t+"_square",E,E),f.call(t+"_mul",_,E,C),f.call(t+"_add",I,I,M),f.call(t+"_mul",m,E,k),f.call(t+"_square",M,B),f.call(t+"_add",k,k,L),f.call(t+"_sub",B,C,l),f.call(t+"_sub",l,L,l),f.call(t+"_mul",v,C,S),f.call(t+"_add",S,S,S),f.call(t+"_sub",k,l,u),f.call(t+"_mul",u,M,u),f.call(t+"_sub",u,S,u),f.call(t+"_add",i,s,h),f.call(t+"_square",h,h),f.call(t+"_sub",h,p,h),f.call(t+"_sub",h,g,h),f.call(t+"_mul",h,_,h))}(),function(){const c=e.addFunction(a+"_negAffine");c.addParam("p1","i32"),c.addParam("pr","i32");const f=c.getCodeBuilder(),r=f.getLocal("p1"),n=f.i32_add(f.getLocal("p1"),f.i32_const(d)),i=f.getLocal("pr"),b=f.i32_add(f.getLocal("pr"),f.i32_const(d));c.addCode(f.call(t+"_copy",r,i),f.call(t+"_neg",n,b))}(),function(){const c=e.addFunction(a+"_neg");c.addParam("p1","i32"),c.addParam("pr","i32");const f=c.getCodeBuilder(),r=f.getLocal("p1"),n=f.i32_add(f.getLocal("p1"),f.i32_const(d)),i=f.i32_add(f.getLocal("p1"),f.i32_const(2*d)),b=f.getLocal("pr"),o=f.i32_add(f.getLocal("pr"),f.i32_const(d)),s=f.i32_add(f.getLocal("pr"),f.i32_const(2*d));c.addCode(f.call(t+"_copy",r,b),f.call(t+"_neg",n,o),f.call(t+"_copy",i,s))}(),function(){const t=e.addFunction(a+"_subAffine");t.addParam("p1","i32"),t.addParam("p2","i32"),t.addParam("pr","i32");const c=t.getCodeBuilder(),f=c.i32_const(e.alloc(3*d));t.addCode(c.call(a+"_negAffine",c.getLocal("p2"),f),c.call(a+"_addAffine",c.getLocal("p1"),f,c.getLocal("pr")))}(),function(){const t=e.addFunction(a+"_subMixed");t.addParam("p1","i32"),t.addParam("p2","i32"),t.addParam("pr","i32");const c=t.getCodeBuilder(),f=c.i32_const(e.alloc(3*d));t.addCode(c.call(a+"_negAffine",c.getLocal("p2"),f),c.call(a+"_addMixed",c.getLocal("p1"),f,c.getLocal("pr")))}(),function(){const t=e.addFunction(a+"_sub");t.addParam("p1","i32"),t.addParam("p2","i32"),t.addParam("pr","i32");const c=t.getCodeBuilder(),f=c.i32_const(e.alloc(3*d));t.addCode(c.call(a+"_neg",c.getLocal("p2"),f),c.call(a+"_add",c.getLocal("p1"),f,c.getLocal("pr")))}(),function(){const c=e.addFunction(a+"_fromMontgomeryAffine");c.addParam("p1","i32"),c.addParam("pr","i32");const f=c.getCodeBuilder();c.addCode(f.call(t+"_fromMontgomery",f.getLocal("p1"),f.getLocal("pr")));for(let e=1;e<2;e++)c.addCode(f.call(t+"_fromMontgomery",f.i32_add(f.getLocal("p1"),f.i32_const(e*d)),f.i32_add(f.getLocal("pr"),f.i32_const(e*d))))}(),function(){const c=e.addFunction(a+"_fromMontgomery");c.addParam("p1","i32"),c.addParam("pr","i32");const f=c.getCodeBuilder();c.addCode(f.call(t+"_fromMontgomery",f.getLocal("p1"),f.getLocal("pr")));for(let e=1;e<3;e++)c.addCode(f.call(t+"_fromMontgomery",f.i32_add(f.getLocal("p1"),f.i32_const(e*d)),f.i32_add(f.getLocal("pr"),f.i32_const(e*d))))}(),function(){const c=e.addFunction(a+"_toMontgomeryAffine");c.addParam("p1","i32"),c.addParam("pr","i32");const f=c.getCodeBuilder();c.addCode(f.call(t+"_toMontgomery",f.getLocal("p1"),f.getLocal("pr")));for(let e=1;e<2;e++)c.addCode(f.call(t+"_toMontgomery",f.i32_add(f.getLocal("p1"),f.i32_const(e*d)),f.i32_add(f.getLocal("pr"),f.i32_const(e*d))))}(),function(){const c=e.addFunction(a+"_toMontgomery");c.addParam("p1","i32"),c.addParam("pr","i32");const f=c.getCodeBuilder();c.addCode(f.call(t+"_toMontgomery",f.getLocal("p1"),f.getLocal("pr")));for(let e=1;e<3;e++)c.addCode(f.call(t+"_toMontgomery",f.i32_add(f.getLocal("p1"),f.i32_const(e*d)),f.i32_add(f.getLocal("pr"),f.i32_const(e*d))))}(),function(){const c=e.addFunction(a+"_toAffine");c.addParam("p1","i32"),c.addParam("pr","i32");const f=c.getCodeBuilder(),r=f.getLocal("p1"),n=f.i32_add(f.getLocal("p1"),f.i32_const(d)),i=f.i32_add(f.getLocal("p1"),f.i32_const(2*d)),b=f.getLocal("pr"),o=f.i32_add(f.getLocal("pr"),f.i32_const(d)),s=f.i32_const(e.alloc(d)),l=f.i32_const(e.alloc(d)),u=f.i32_const(e.alloc(d));c.addCode(f.if(f.call(a+"_isZero",f.getLocal("p1")),[...f.call(t+"_zero",b),...f.call(t+"_zero",o)],[...f.call(t+"_inverse",i,s),...f.call(t+"_square",s,l),...f.call(t+"_mul",s,l,u),...f.call(t+"_mul",r,l,b),...f.call(t+"_mul",n,u,o)]))}(),function(){const f=e.addFunction(a+"_inCurveAffine");f.addParam("pIn","i32"),f.setReturnType("i32");const r=f.getCodeBuilder(),n=r.getLocal("pIn"),i=r.i32_add(r.getLocal("pIn"),r.i32_const(d)),b=r.i32_const(e.alloc(d)),o=r.i32_const(e.alloc(d));f.addCode(r.call(t+"_square",i,b),r.call(t+"_square",n,o),r.call(t+"_mul",n,o,o),r.call(t+"_add",o,r.i32_const(c),o),r.ret(r.call(t+"_eq",b,o)))}(),function(){const t=e.addFunction(a+"_inCurve");t.addParam("pIn","i32"),t.setReturnType("i32");const c=t.getCodeBuilder(),f=c.i32_const(e.alloc(2*d));t.addCode(c.call(a+"_toAffine",c.getLocal("pIn"),f),c.ret(c.call(a+"_inCurveAffine",f)))}(),function(){const c=e.addFunction(a+"_batchToAffine");c.addParam("pIn","i32"),c.addParam("n","i32"),c.addParam("pOut","i32"),c.addLocal("pAux","i32"),c.addLocal("itIn","i32"),c.addLocal("itAux","i32"),c.addLocal("itOut","i32"),c.addLocal("i","i32");const f=c.getCodeBuilder(),r=f.i32_const(e.alloc(d));c.addCode(f.setLocal("pAux",f.i32_load(f.i32_const(0))),f.i32_store(f.i32_const(0),f.i32_add(f.getLocal("pAux"),f.i32_mul(f.getLocal("n"),f.i32_const(d)))),f.call(t+"_batchInverse",f.i32_add(f.getLocal("pIn"),f.i32_const(2*d)),f.i32_const(3*d),f.getLocal("n"),f.getLocal("pAux"),f.i32_const(d)),f.setLocal("itIn",f.getLocal("pIn")),f.setLocal("itAux",f.getLocal("pAux")),f.setLocal("itOut",f.getLocal("pOut")),f.setLocal("i",f.i32_const(0)),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal("i"),f.getLocal("n"))),f.if(f.call(t+"_isZero",f.getLocal("itAux")),[...f.call(t+"_zero",f.getLocal("itOut")),...f.call(t+"_zero",f.i32_add(f.getLocal("itOut"),f.i32_const(d)))],[...f.call(t+"_mul",f.getLocal("itAux"),f.i32_add(f.getLocal("itIn"),f.i32_const(d)),r),...f.call(t+"_square",f.getLocal("itAux"),f.getLocal("itAux")),...f.call(t+"_mul",f.getLocal("itAux"),f.getLocal("itIn"),f.getLocal("itOut")),...f.call(t+"_mul",f.getLocal("itAux"),r,f.i32_add(f.getLocal("itOut"),f.i32_const(d)))]),f.setLocal("itIn",f.i32_add(f.getLocal("itIn"),f.i32_const(3*d))),f.setLocal("itOut",f.i32_add(f.getLocal("itOut"),f.i32_const(2*d))),f.setLocal("itAux",f.i32_add(f.getLocal("itAux"),f.i32_const(d))),f.setLocal("i",f.i32_add(f.getLocal("i"),f.i32_const(1))),f.br(0))),f.i32_store(f.i32_const(0),f.getLocal("pAux")))}(),function(){const c=e.addFunction(a+"_normalize");c.addParam("p1","i32"),c.addParam("pr","i32");const f=c.getCodeBuilder(),r=f.getLocal("p1"),n=f.i32_add(f.getLocal("p1"),f.i32_const(d)),i=f.i32_add(f.getLocal("p1"),f.i32_const(2*d)),b=f.getLocal("pr"),o=f.i32_add(f.getLocal("pr"),f.i32_const(d)),s=f.i32_add(f.getLocal("pr"),f.i32_const(2*d)),l=f.i32_const(e.alloc(d)),u=f.i32_const(e.alloc(d)),h=f.i32_const(e.alloc(d));c.addCode(f.if(f.call(a+"_isZero",f.getLocal("p1")),f.call(a+"_zero",f.getLocal("pr")),[...f.call(t+"_inverse",i,l),...f.call(t+"_square",l,u),...f.call(t+"_mul",l,u,h),...f.call(t+"_mul",r,u,b),...f.call(t+"_mul",n,h,o),...f.call(t+"_one",s)]))}(),function(){const t=e.addFunction(a+"__reverseBytes");t.addParam("pIn","i32"),t.addParam("n","i32"),t.addParam("pOut","i32"),t.addLocal("itOut","i32"),t.addLocal("itIn","i32");const c=t.getCodeBuilder();t.addCode(c.setLocal("itOut",c.i32_sub(c.i32_add(c.getLocal("pOut"),c.getLocal("n")),c.i32_const(1))),c.setLocal("itIn",c.getLocal("pIn")),c.block(c.loop(c.br_if(1,c.i32_lt_s(c.getLocal("itOut"),c.getLocal("pOut"))),c.i32_store8(c.getLocal("itOut"),c.i32_load8_u(c.getLocal("itIn"))),c.setLocal("itOut",c.i32_sub(c.getLocal("itOut"),c.i32_const(1))),c.setLocal("itIn",c.i32_add(c.getLocal("itIn"),c.i32_const(1))),c.br(0))))}(),function(){const t=e.addFunction(a+"_LEMtoU");t.addParam("pIn","i32"),t.addParam("pOut","i32");const c=t.getCodeBuilder(),f=e.alloc(2*d),r=c.i32_const(f),n=c.i32_const(f),i=c.i32_const(f+d);t.addCode(c.if(c.call(a+"_isZeroAffine",c.getLocal("pIn")),[...c.call(a+"_zeroAffine",c.getLocal("pOut")),...c.ret([])]),c.call(a+"_fromMontgomeryAffine",c.getLocal("pIn"),r),c.call(a+"__reverseBytes",n,c.i32_const(d),c.getLocal("pOut")),c.call(a+"__reverseBytes",i,c.i32_const(d),c.i32_add(c.getLocal("pOut"),c.i32_const(d))))}(),function(){const c=e.addFunction(a+"_LEMtoC");c.addParam("pIn","i32"),c.addParam("pOut","i32");const f=c.getCodeBuilder(),r=f.i32_const(e.alloc(d));c.addCode(f.if(f.call(a+"_isZeroAffine",f.getLocal("pIn")),[...f.call(t+"_zero",f.getLocal("pOut")),...f.i32_store8(f.getLocal("pOut"),f.i32_const(64)),...f.ret([])]),f.call(t+"_fromMontgomery",f.getLocal("pIn"),r),f.call(a+"__reverseBytes",r,f.i32_const(d),f.getLocal("pOut")),f.if(f.i32_eq(f.call(t+"_sign",f.i32_add(f.getLocal("pIn"),f.i32_const(d))),f.i32_const(-1)),f.i32_store8(f.getLocal("pOut"),f.i32_or(f.i32_load8_u(f.getLocal("pOut")),f.i32_const(128)))))}(),function(){const t=e.addFunction(a+"_UtoLEM");t.addParam("pIn","i32"),t.addParam("pOut","i32");const c=t.getCodeBuilder(),f=e.alloc(2*d),r=c.i32_const(f),n=c.i32_const(f),i=c.i32_const(f+d);t.addCode(c.if(c.i32_and(c.i32_load8_u(c.getLocal("pIn")),c.i32_const(64)),[...c.call(a+"_zeroAffine",c.getLocal("pOut")),...c.ret([])]),c.call(a+"__reverseBytes",c.getLocal("pIn"),c.i32_const(d),n),c.call(a+"__reverseBytes",c.i32_add(c.getLocal("pIn"),c.i32_const(d)),c.i32_const(d),i),c.call(a+"_toMontgomeryAffine",r,c.getLocal("pOut")))}(),function(){const f=e.addFunction(a+"_CtoLEM");f.addParam("pIn","i32"),f.addParam("pOut","i32"),f.addLocal("firstByte","i32"),f.addLocal("greatest","i32");const r=f.getCodeBuilder(),n=e.alloc(2*d),i=r.i32_const(n),b=r.i32_const(n+d);f.addCode(r.setLocal("firstByte",r.i32_load8_u(r.getLocal("pIn"))),r.if(r.i32_and(r.getLocal("firstByte"),r.i32_const(64)),[...r.call(a+"_zeroAffine",r.getLocal("pOut")),...r.ret([])]),r.setLocal("greatest",r.i32_and(r.getLocal("firstByte"),r.i32_const(128))),r.call(t+"_copy",r.getLocal("pIn"),b),r.i32_store8(b,r.i32_and(r.getLocal("firstByte"),r.i32_const(63))),r.call(a+"__reverseBytes",b,r.i32_const(d),i),r.call(t+"_toMontgomery",i,r.getLocal("pOut")),r.call(t+"_square",r.getLocal("pOut"),b),r.call(t+"_mul",r.getLocal("pOut"),b,b),r.call(t+"_add",b,r.i32_const(c),b),r.call(t+"_sqrt",b,b),r.call(t+"_neg",b,i),r.if(r.i32_eq(r.call(t+"_sign",b),r.i32_const(-1)),r.if(r.getLocal("greatest"),r.call(t+"_copy",b,r.i32_add(r.getLocal("pOut"),r.i32_const(d))),r.call(t+"_neg",b,r.i32_add(r.getLocal("pOut"),r.i32_const(d)))),r.if(r.getLocal("greatest"),r.call(t+"_neg",b,r.i32_add(r.getLocal("pOut"),r.i32_const(d))),r.call(t+"_copy",b,r.i32_add(r.getLocal("pOut"),r.i32_const(d))))))}(),_e(e,a+"_batchLEMtoU",a+"_LEMtoU",2*d,2*d),_e(e,a+"_batchLEMtoC",a+"_LEMtoC",2*d,d),_e(e,a+"_batchUtoLEM",a+"_UtoLEM",2*d,2*d),_e(e,a+"_batchCtoLEM",a+"_CtoLEM",d,2*d,!0),_e(e,a+"_batchToJacobian",a+"_toJacobian",2*d,3*d,!0),Ie(e,a,a+"_multiexp",a+"_add",3*d),Ie(e,a,a+"_multiexpAffine",a+"_addMixed",2*d),we(e,a+"_timesScalar",3*d,a+"_add",a+"_double",a+"_sub",a+"_copy",a+"_zero"),we(e,a+"_timesScalarAffine",2*d,a+"_addMixed",a+"_double",a+"_subMixed",a+"_copyAffine",a+"_zero"),e.exportFunction(a+"_isZero"),e.exportFunction(a+"_isZeroAffine"),e.exportFunction(a+"_eq"),e.exportFunction(a+"_eqMixed"),e.exportFunction(a+"_eqAffine"),e.exportFunction(a+"_copy"),e.exportFunction(a+"_copyAffine"),e.exportFunction(a+"_zero"),e.exportFunction(a+"_zeroAffine"),e.exportFunction(a+"_double"),e.exportFunction(a+"_doubleAffine"),e.exportFunction(a+"_add"),e.exportFunction(a+"_addMixed"),e.exportFunction(a+"_addAffine"),e.exportFunction(a+"_neg"),e.exportFunction(a+"_negAffine"),e.exportFunction(a+"_sub"),e.exportFunction(a+"_subMixed"),e.exportFunction(a+"_subAffine"),e.exportFunction(a+"_fromMontgomery"),e.exportFunction(a+"_fromMontgomeryAffine"),e.exportFunction(a+"_toMontgomery"),e.exportFunction(a+"_toMontgomeryAffine"),e.exportFunction(a+"_timesScalar"),e.exportFunction(a+"_timesScalarAffine"),e.exportFunction(a+"_normalize"),e.exportFunction(a+"_LEMtoU"),e.exportFunction(a+"_LEMtoC"),e.exportFunction(a+"_UtoLEM"),e.exportFunction(a+"_CtoLEM"),e.exportFunction(a+"_batchLEMtoU"),e.exportFunction(a+"_batchLEMtoC"),e.exportFunction(a+"_batchUtoLEM"),e.exportFunction(a+"_batchCtoLEM"),e.exportFunction(a+"_toAffine"),e.exportFunction(a+"_toJacobian"),e.exportFunction(a+"_batchToAffine"),e.exportFunction(a+"_batchToJacobian"),e.exportFunction(a+"_inCurve"),e.exportFunction(a+"_inCurveAffine")),a};const{isOdd:Ce,modInv:Me,modPow:Be}=U,ke=D;var Le=function(e,a,t,c,f){const d=8*e.modules[c].n64,r=8*e.modules[t].n64,n=e.modules[c].q;let i=n-1n,b=0;for(;!Ce(i);)b++,i>>=1n;let o=2n;for(;1n===Be(o,n>>1n,n);)o+=1n;const s=new Array(b+1);s[b]=Be(o,i,n);let l=b-1;for(;l>=0;)s[l]=Be(s[l+1],2n,n),l--;const u=[],h=(1n<>t);return a}const E=Array(256);for(let e=0;e<256;e++)E[e]=I(e);const C=e.alloc(E);!function(){const t=e.addFunction(a+"__rev");t.addParam("x","i32"),t.addParam("bits","i32"),t.setReturnType("i32");const c=t.getCodeBuilder();t.addCode(c.i32_rotl(c.i32_add(c.i32_add(c.i32_shl(c.i32_load8_u(c.i32_and(c.getLocal("x"),c.i32_const(255)),C,0),c.i32_const(24)),c.i32_shl(c.i32_load8_u(c.i32_and(c.i32_shr_u(c.getLocal("x"),c.i32_const(8)),c.i32_const(255)),C,0),c.i32_const(16))),c.i32_add(c.i32_shl(c.i32_load8_u(c.i32_and(c.i32_shr_u(c.getLocal("x"),c.i32_const(16)),c.i32_const(255)),C,0),c.i32_const(8)),c.i32_load8_u(c.i32_and(c.i32_shr_u(c.getLocal("x"),c.i32_const(24)),c.i32_const(255)),C,0))),c.getLocal("bits")))}(),function(){const c=e.addFunction(a+"__reversePermutation");c.addParam("px","i32"),c.addParam("bits","i32"),c.addLocal("n","i32"),c.addLocal("i","i32"),c.addLocal("ri","i32"),c.addLocal("idx1","i32"),c.addLocal("idx2","i32");const f=c.getCodeBuilder(),d=f.i32_const(e.alloc(r));c.addCode(f.setLocal("n",f.i32_shl(f.i32_const(1),f.getLocal("bits"))),f.setLocal("i",f.i32_const(0)),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal("i"),f.getLocal("n"))),f.setLocal("idx1",f.i32_add(f.getLocal("px"),f.i32_mul(f.getLocal("i"),f.i32_const(r)))),f.setLocal("ri",f.call(a+"__rev",f.getLocal("i"),f.getLocal("bits"))),f.setLocal("idx2",f.i32_add(f.getLocal("px"),f.i32_mul(f.getLocal("ri"),f.i32_const(r)))),f.if(f.i32_lt_u(f.getLocal("i"),f.getLocal("ri")),[...f.call(t+"_copy",f.getLocal("idx1"),d),...f.call(t+"_copy",f.getLocal("idx2"),f.getLocal("idx1")),...f.call(t+"_copy",d,f.getLocal("idx2"))]),f.setLocal("i",f.i32_add(f.getLocal("i"),f.i32_const(1))),f.br(0))))}(),function(){const d=e.addFunction(a+"__fftFinal");d.addParam("px","i32"),d.addParam("bits","i32"),d.addParam("reverse","i32"),d.addParam("mulFactor","i32"),d.addLocal("n","i32"),d.addLocal("ndiv2","i32"),d.addLocal("pInv2","i32"),d.addLocal("i","i32"),d.addLocal("mask","i32"),d.addLocal("idx1","i32"),d.addLocal("idx2","i32");const n=d.getCodeBuilder(),i=n.i32_const(e.alloc(r));d.addCode(n.if(n.i32_and(n.i32_eqz(n.getLocal("reverse")),n.call(c+"_isOne",n.getLocal("mulFactor"))),n.ret([])),n.setLocal("n",n.i32_shl(n.i32_const(1),n.getLocal("bits"))),n.setLocal("mask",n.i32_sub(n.getLocal("n"),n.i32_const(1))),n.setLocal("i",n.i32_const(1)),n.setLocal("ndiv2",n.i32_shr_u(n.getLocal("n"),n.i32_const(1))),n.block(n.loop(n.br_if(1,n.i32_ge_u(n.getLocal("i"),n.getLocal("ndiv2"))),n.setLocal("idx1",n.i32_add(n.getLocal("px"),n.i32_mul(n.getLocal("i"),n.i32_const(r)))),n.setLocal("idx2",n.i32_add(n.getLocal("px"),n.i32_mul(n.i32_sub(n.getLocal("n"),n.getLocal("i")),n.i32_const(r)))),n.if(n.getLocal("reverse"),n.if(n.call(c+"_isOne",n.getLocal("mulFactor")),[...n.call(t+"_copy",n.getLocal("idx1"),i),...n.call(t+"_copy",n.getLocal("idx2"),n.getLocal("idx1")),...n.call(t+"_copy",i,n.getLocal("idx2"))],[...n.call(t+"_copy",n.getLocal("idx1"),i),...n.call(f,n.getLocal("idx2"),n.getLocal("mulFactor"),n.getLocal("idx1")),...n.call(f,i,n.getLocal("mulFactor"),n.getLocal("idx2"))]),n.if(n.call(c+"_isOne",n.getLocal("mulFactor")),[],[...n.call(f,n.getLocal("idx1"),n.getLocal("mulFactor"),n.getLocal("idx1")),...n.call(f,n.getLocal("idx2"),n.getLocal("mulFactor"),n.getLocal("idx2"))])),n.setLocal("i",n.i32_add(n.getLocal("i"),n.i32_const(1))),n.br(0))),n.if(n.call(c+"_isOne",n.getLocal("mulFactor")),[],[...n.call(f,n.getLocal("px"),n.getLocal("mulFactor"),n.getLocal("px")),...n.setLocal("idx2",n.i32_add(n.getLocal("px"),n.i32_mul(n.getLocal("ndiv2"),n.i32_const(r)))),...n.call(f,n.getLocal("idx2"),n.getLocal("mulFactor"),n.getLocal("idx2"))]))}(),function(){const n=e.addFunction(a+"_rawfft");n.addParam("px","i32"),n.addParam("bits","i32"),n.addParam("reverse","i32"),n.addParam("mulFactor","i32"),n.addLocal("s","i32"),n.addLocal("k","i32"),n.addLocal("j","i32"),n.addLocal("m","i32"),n.addLocal("mdiv2","i32"),n.addLocal("n","i32"),n.addLocal("pwm","i32"),n.addLocal("idx1","i32"),n.addLocal("idx2","i32");const i=n.getCodeBuilder(),b=i.i32_const(e.alloc(d)),o=i.i32_const(e.alloc(r)),s=i.i32_const(e.alloc(r));n.addCode(i.call(a+"__reversePermutation",i.getLocal("px"),i.getLocal("bits")),i.setLocal("n",i.i32_shl(i.i32_const(1),i.getLocal("bits"))),i.setLocal("s",i.i32_const(1)),i.block(i.loop(i.br_if(1,i.i32_gt_u(i.getLocal("s"),i.getLocal("bits"))),i.setLocal("m",i.i32_shl(i.i32_const(1),i.getLocal("s"))),i.setLocal("pwm",i.i32_add(i.i32_const(p),i.i32_mul(i.getLocal("s"),i.i32_const(d)))),i.setLocal("k",i.i32_const(0)),i.block(i.loop(i.br_if(1,i.i32_ge_u(i.getLocal("k"),i.getLocal("n"))),i.call(c+"_one",b),i.setLocal("mdiv2",i.i32_shr_u(i.getLocal("m"),i.i32_const(1))),i.setLocal("j",i.i32_const(0)),i.block(i.loop(i.br_if(1,i.i32_ge_u(i.getLocal("j"),i.getLocal("mdiv2"))),i.setLocal("idx1",i.i32_add(i.getLocal("px"),i.i32_mul(i.i32_add(i.getLocal("k"),i.getLocal("j")),i.i32_const(r)))),i.setLocal("idx2",i.i32_add(i.getLocal("idx1"),i.i32_mul(i.getLocal("mdiv2"),i.i32_const(r)))),i.call(f,i.getLocal("idx2"),b,o),i.call(t+"_copy",i.getLocal("idx1"),s),i.call(t+"_add",s,o,i.getLocal("idx1")),i.call(t+"_sub",s,o,i.getLocal("idx2")),i.call(c+"_mul",b,i.getLocal("pwm"),b),i.setLocal("j",i.i32_add(i.getLocal("j"),i.i32_const(1))),i.br(0))),i.setLocal("k",i.i32_add(i.getLocal("k"),i.getLocal("m"))),i.br(0))),i.setLocal("s",i.i32_add(i.getLocal("s"),i.i32_const(1))),i.br(0))),i.call(a+"__fftFinal",i.getLocal("px"),i.getLocal("bits"),i.getLocal("reverse"),i.getLocal("mulFactor")))}(),function(){const t=e.addFunction(a+"__log2");t.addParam("n","i32"),t.setReturnType("i32"),t.addLocal("bits","i32"),t.addLocal("aux","i32");const c=t.getCodeBuilder();t.addCode(c.setLocal("aux",c.i32_shr_u(c.getLocal("n"),c.i32_const(1)))),t.addCode(c.setLocal("bits",c.i32_const(0))),t.addCode(c.block(c.loop(c.br_if(1,c.i32_eqz(c.getLocal("aux"))),c.setLocal("aux",c.i32_shr_u(c.getLocal("aux"),c.i32_const(1))),c.setLocal("bits",c.i32_add(c.getLocal("bits"),c.i32_const(1))),c.br(0)))),t.addCode(c.if(c.i32_ne(c.getLocal("n"),c.i32_shl(c.i32_const(1),c.getLocal("bits"))),c.unreachable())),t.addCode(c.if(c.i32_gt_u(c.getLocal("bits"),c.i32_const(b)),c.unreachable())),t.addCode(c.getLocal("bits"))}(),function(){const t=e.addFunction(a+"_fft");t.addParam("px","i32"),t.addParam("n","i32"),t.addLocal("bits","i32");const f=t.getCodeBuilder(),r=f.i32_const(e.alloc(d));t.addCode(f.setLocal("bits",f.call(a+"__log2",f.getLocal("n"))),f.call(c+"_one",r),f.call(a+"_rawfft",f.getLocal("px"),f.getLocal("bits"),f.i32_const(0),r))}(),function(){const t=e.addFunction(a+"_ifft");t.addParam("px","i32"),t.addParam("n","i32"),t.addLocal("bits","i32"),t.addLocal("pInv2","i32");const c=t.getCodeBuilder();t.addCode(c.setLocal("bits",c.call(a+"__log2",c.getLocal("n"))),c.setLocal("pInv2",c.i32_add(c.i32_const(x),c.i32_mul(c.getLocal("bits"),c.i32_const(d)))),c.call(a+"_rawfft",c.getLocal("px"),c.getLocal("bits"),c.i32_const(1),c.getLocal("pInv2")))}(),function(){const n=e.addFunction(a+"_fftJoin");n.addParam("pBuff1","i32"),n.addParam("pBuff2","i32"),n.addParam("n","i32"),n.addParam("first","i32"),n.addParam("inc","i32"),n.addLocal("idx1","i32"),n.addLocal("idx2","i32"),n.addLocal("i","i32");const i=n.getCodeBuilder(),b=i.i32_const(e.alloc(d)),o=i.i32_const(e.alloc(r)),s=i.i32_const(e.alloc(r));n.addCode(i.call(c+"_copy",i.getLocal("first"),b),i.setLocal("i",i.i32_const(0)),i.block(i.loop(i.br_if(1,i.i32_eq(i.getLocal("i"),i.getLocal("n"))),i.setLocal("idx1",i.i32_add(i.getLocal("pBuff1"),i.i32_mul(i.getLocal("i"),i.i32_const(r)))),i.setLocal("idx2",i.i32_add(i.getLocal("pBuff2"),i.i32_mul(i.getLocal("i"),i.i32_const(r)))),i.call(f,i.getLocal("idx2"),b,o),i.call(t+"_copy",i.getLocal("idx1"),s),i.call(t+"_add",s,o,i.getLocal("idx1")),i.call(t+"_sub",s,o,i.getLocal("idx2")),i.call(c+"_mul",b,i.getLocal("inc"),b),i.setLocal("i",i.i32_add(i.getLocal("i"),i.i32_const(1))),i.br(0))))}(),function(){const n=e.addFunction(a+"_fftJoinExt");n.addParam("pBuff1","i32"),n.addParam("pBuff2","i32"),n.addParam("n","i32"),n.addParam("first","i32"),n.addParam("inc","i32"),n.addParam("totalBits","i32"),n.addLocal("idx1","i32"),n.addLocal("idx2","i32"),n.addLocal("i","i32"),n.addLocal("pShiftToM","i32");const i=n.getCodeBuilder(),b=i.i32_const(e.alloc(d)),o=i.i32_const(e.alloc(r));n.addCode(i.setLocal("pShiftToM",i.i32_add(i.i32_const(w),i.i32_mul(i.getLocal("totalBits"),i.i32_const(d)))),i.call(c+"_copy",i.getLocal("first"),b),i.setLocal("i",i.i32_const(0)),i.block(i.loop(i.br_if(1,i.i32_eq(i.getLocal("i"),i.getLocal("n"))),i.setLocal("idx1",i.i32_add(i.getLocal("pBuff1"),i.i32_mul(i.getLocal("i"),i.i32_const(r)))),i.setLocal("idx2",i.i32_add(i.getLocal("pBuff2"),i.i32_mul(i.getLocal("i"),i.i32_const(r)))),i.call(t+"_add",i.getLocal("idx1"),i.getLocal("idx2"),o),i.call(f,i.getLocal("idx2"),i.getLocal("pShiftToM"),i.getLocal("idx2")),i.call(t+"_add",i.getLocal("idx1"),i.getLocal("idx2"),i.getLocal("idx2")),i.call(f,i.getLocal("idx2"),b,i.getLocal("idx2")),i.call(t+"_copy",o,i.getLocal("idx1")),i.call(c+"_mul",b,i.getLocal("inc"),b),i.setLocal("i",i.i32_add(i.getLocal("i"),i.i32_const(1))),i.br(0))))}(),function(){const n=e.addFunction(a+"_fftJoinExtInv");n.addParam("pBuff1","i32"),n.addParam("pBuff2","i32"),n.addParam("n","i32"),n.addParam("first","i32"),n.addParam("inc","i32"),n.addParam("totalBits","i32"),n.addLocal("idx1","i32"),n.addLocal("idx2","i32"),n.addLocal("i","i32"),n.addLocal("pShiftToM","i32"),n.addLocal("pSConst","i32");const i=n.getCodeBuilder(),b=i.i32_const(e.alloc(d)),o=i.i32_const(e.alloc(r));n.addCode(i.setLocal("pShiftToM",i.i32_add(i.i32_const(w),i.i32_mul(i.getLocal("totalBits"),i.i32_const(d)))),i.setLocal("pSConst",i.i32_add(i.i32_const(_),i.i32_mul(i.getLocal("totalBits"),i.i32_const(d)))),i.call(c+"_copy",i.getLocal("first"),b),i.setLocal("i",i.i32_const(0)),i.block(i.loop(i.br_if(1,i.i32_eq(i.getLocal("i"),i.getLocal("n"))),i.setLocal("idx1",i.i32_add(i.getLocal("pBuff1"),i.i32_mul(i.getLocal("i"),i.i32_const(r)))),i.setLocal("idx2",i.i32_add(i.getLocal("pBuff2"),i.i32_mul(i.getLocal("i"),i.i32_const(r)))),i.call(f,i.getLocal("idx2"),b,o),i.call(t+"_sub",i.getLocal("idx1"),o,i.getLocal("idx2")),i.call(f,i.getLocal("idx2"),i.getLocal("pSConst"),i.getLocal("idx2")),i.call(f,i.getLocal("idx1"),i.getLocal("pShiftToM"),i.getLocal("idx1")),i.call(t+"_sub",o,i.getLocal("idx1"),i.getLocal("idx1")),i.call(f,i.getLocal("idx1"),i.getLocal("pSConst"),i.getLocal("idx1")),i.call(c+"_mul",b,i.getLocal("inc"),b),i.setLocal("i",i.i32_add(i.getLocal("i"),i.i32_const(1))),i.br(0))))}(),function(){const n=e.addFunction(a+"_fftMix");n.addParam("pBuff","i32"),n.addParam("n","i32"),n.addParam("exp","i32"),n.addLocal("nGroups","i32"),n.addLocal("nPerGroup","i32"),n.addLocal("nPerGroupDiv2","i32"),n.addLocal("pairOffset","i32"),n.addLocal("idx1","i32"),n.addLocal("idx2","i32"),n.addLocal("i","i32"),n.addLocal("j","i32"),n.addLocal("pwm","i32");const i=n.getCodeBuilder(),b=i.i32_const(e.alloc(d)),o=i.i32_const(e.alloc(r)),s=i.i32_const(e.alloc(r));n.addCode(i.setLocal("nPerGroup",i.i32_shl(i.i32_const(1),i.getLocal("exp"))),i.setLocal("nPerGroupDiv2",i.i32_shr_u(i.getLocal("nPerGroup"),i.i32_const(1))),i.setLocal("nGroups",i.i32_shr_u(i.getLocal("n"),i.getLocal("exp"))),i.setLocal("pairOffset",i.i32_mul(i.getLocal("nPerGroupDiv2"),i.i32_const(r))),i.setLocal("pwm",i.i32_add(i.i32_const(p),i.i32_mul(i.getLocal("exp"),i.i32_const(d)))),i.setLocal("i",i.i32_const(0)),i.block(i.loop(i.br_if(1,i.i32_eq(i.getLocal("i"),i.getLocal("nGroups"))),i.call(c+"_one",b),i.setLocal("j",i.i32_const(0)),i.block(i.loop(i.br_if(1,i.i32_eq(i.getLocal("j"),i.getLocal("nPerGroupDiv2"))),i.setLocal("idx1",i.i32_add(i.getLocal("pBuff"),i.i32_mul(i.i32_add(i.i32_mul(i.getLocal("i"),i.getLocal("nPerGroup")),i.getLocal("j")),i.i32_const(r)))),i.setLocal("idx2",i.i32_add(i.getLocal("idx1"),i.getLocal("pairOffset"))),i.call(f,i.getLocal("idx2"),b,o),i.call(t+"_copy",i.getLocal("idx1"),s),i.call(t+"_add",s,o,i.getLocal("idx1")),i.call(t+"_sub",s,o,i.getLocal("idx2")),i.call(c+"_mul",b,i.getLocal("pwm"),b),i.setLocal("j",i.i32_add(i.getLocal("j"),i.i32_const(1))),i.br(0))),i.setLocal("i",i.i32_add(i.getLocal("i"),i.i32_const(1))),i.br(0))))}(),function(){const c=e.addFunction(a+"_fftFinal");c.addParam("pBuff","i32"),c.addParam("n","i32"),c.addParam("factor","i32"),c.addLocal("idx1","i32"),c.addLocal("idx2","i32"),c.addLocal("i","i32"),c.addLocal("ndiv2","i32");const d=c.getCodeBuilder(),n=d.i32_const(e.alloc(r));c.addCode(d.setLocal("ndiv2",d.i32_shr_u(d.getLocal("n"),d.i32_const(1))),d.if(d.i32_and(d.getLocal("n"),d.i32_const(1)),d.call(f,d.i32_add(d.getLocal("pBuff"),d.i32_mul(d.getLocal("ndiv2"),d.i32_const(r))),d.getLocal("factor"),d.i32_add(d.getLocal("pBuff"),d.i32_mul(d.getLocal("ndiv2"),d.i32_const(r))))),d.setLocal("i",d.i32_const(0)),d.block(d.loop(d.br_if(1,d.i32_ge_u(d.getLocal("i"),d.getLocal("ndiv2"))),d.setLocal("idx1",d.i32_add(d.getLocal("pBuff"),d.i32_mul(d.getLocal("i"),d.i32_const(r)))),d.setLocal("idx2",d.i32_add(d.getLocal("pBuff"),d.i32_mul(d.i32_sub(d.i32_sub(d.getLocal("n"),d.i32_const(1)),d.getLocal("i")),d.i32_const(r)))),d.call(f,d.getLocal("idx2"),d.getLocal("factor"),n),d.call(f,d.getLocal("idx1"),d.getLocal("factor"),d.getLocal("idx2")),d.call(t+"_copy",n,d.getLocal("idx1")),d.setLocal("i",d.i32_add(d.getLocal("i"),d.i32_const(1))),d.br(0))))}(),function(){const n=e.addFunction(a+"_prepareLagrangeEvaluation");n.addParam("pBuff1","i32"),n.addParam("pBuff2","i32"),n.addParam("n","i32"),n.addParam("first","i32"),n.addParam("inc","i32"),n.addParam("totalBits","i32"),n.addLocal("idx1","i32"),n.addLocal("idx2","i32"),n.addLocal("i","i32"),n.addLocal("pShiftToM","i32"),n.addLocal("pSConst","i32");const i=n.getCodeBuilder(),b=i.i32_const(e.alloc(d)),o=i.i32_const(e.alloc(r));n.addCode(i.setLocal("pShiftToM",i.i32_add(i.i32_const(w),i.i32_mul(i.getLocal("totalBits"),i.i32_const(d)))),i.setLocal("pSConst",i.i32_add(i.i32_const(_),i.i32_mul(i.getLocal("totalBits"),i.i32_const(d)))),i.call(c+"_copy",i.getLocal("first"),b),i.setLocal("i",i.i32_const(0)),i.block(i.loop(i.br_if(1,i.i32_eq(i.getLocal("i"),i.getLocal("n"))),i.setLocal("idx1",i.i32_add(i.getLocal("pBuff1"),i.i32_mul(i.getLocal("i"),i.i32_const(r)))),i.setLocal("idx2",i.i32_add(i.getLocal("pBuff2"),i.i32_mul(i.getLocal("i"),i.i32_const(r)))),i.call(f,i.getLocal("idx1"),i.getLocal("pShiftToM"),o),i.call(t+"_sub",i.getLocal("idx2"),o,o),i.call(t+"_sub",i.getLocal("idx1"),i.getLocal("idx2"),i.getLocal("idx2")),i.call(f,o,i.getLocal("pSConst"),i.getLocal("idx1")),i.call(f,i.getLocal("idx2"),b,i.getLocal("idx2")),i.call(c+"_mul",b,i.getLocal("inc"),b),i.setLocal("i",i.i32_add(i.getLocal("i"),i.i32_const(1))),i.br(0))))}(),e.exportFunction(a+"_fft"),e.exportFunction(a+"_ifft"),e.exportFunction(a+"_rawfft"),e.exportFunction(a+"_fftJoin"),e.exportFunction(a+"_fftJoinExt"),e.exportFunction(a+"_fftJoinExtInv"),e.exportFunction(a+"_fftMix"),e.exportFunction(a+"_fftFinal"),e.exportFunction(a+"_prepareLagrangeEvaluation")},Se=function(e,a,t){const c=8*e.modules[t].n64;return function(){const f=e.addFunction(a+"_zero");f.addParam("px","i32"),f.addParam("n","i32"),f.addLocal("lastp","i32"),f.addLocal("p","i32");const d=f.getCodeBuilder();f.addCode(d.setLocal("p",d.getLocal("px")),d.setLocal("lastp",d.i32_add(d.getLocal("px"),d.i32_mul(d.getLocal("n"),d.i32_const(c)))),d.block(d.loop(d.br_if(1,d.i32_eq(d.getLocal("p"),d.getLocal("lastp"))),d.call(t+"_zero",d.getLocal("p")),d.setLocal("p",d.i32_add(d.getLocal("p"),d.i32_const(c))),d.br(0))))}(),function(){const f=e.addFunction(a+"_constructLC");f.addParam("ppolynomials","i32"),f.addParam("psignals","i32"),f.addParam("nSignals","i32"),f.addParam("pres","i32"),f.addLocal("i","i32"),f.addLocal("j","i32"),f.addLocal("pp","i32"),f.addLocal("ps","i32"),f.addLocal("pd","i32"),f.addLocal("ncoefs","i32");const d=f.getCodeBuilder(),r=d.i32_const(e.alloc(c));f.addCode(d.setLocal("i",d.i32_const(0)),d.setLocal("pp",d.getLocal("ppolynomials")),d.setLocal("ps",d.getLocal("psignals")),d.block(d.loop(d.br_if(1,d.i32_eq(d.getLocal("i"),d.getLocal("nSignals"))),d.setLocal("ncoefs",d.i32_load(d.getLocal("pp"))),d.setLocal("pp",d.i32_add(d.getLocal("pp"),d.i32_const(4))),d.setLocal("j",d.i32_const(0)),d.block(d.loop(d.br_if(1,d.i32_eq(d.getLocal("j"),d.getLocal("ncoefs"))),d.setLocal("pd",d.i32_add(d.getLocal("pres"),d.i32_mul(d.i32_load(d.getLocal("pp")),d.i32_const(c)))),d.setLocal("pp",d.i32_add(d.getLocal("pp"),d.i32_const(4))),d.call(t+"_mul",d.getLocal("ps"),d.getLocal("pp"),r),d.call(t+"_add",r,d.getLocal("pd"),d.getLocal("pd")),d.setLocal("pp",d.i32_add(d.getLocal("pp"),d.i32_const(c))),d.setLocal("j",d.i32_add(d.getLocal("j"),d.i32_const(1))),d.br(0))),d.setLocal("ps",d.i32_add(d.getLocal("ps"),d.i32_const(c))),d.setLocal("i",d.i32_add(d.getLocal("i"),d.i32_const(1))),d.br(0))))}(),e.exportFunction(a+"_zero"),e.exportFunction(a+"_constructLC"),a},Te=function(e,a,t){const c=8*e.modules[t].n64;return function(){const f=e.addFunction(a+"_buildABC");f.addParam("pCoefs","i32"),f.addParam("nCoefs","i32"),f.addParam("pWitness","i32"),f.addParam("pA","i32"),f.addParam("pB","i32"),f.addParam("pC","i32"),f.addParam("offsetOut","i32"),f.addParam("nOut","i32"),f.addParam("offsetWitness","i32"),f.addParam("nWitness","i32"),f.addLocal("it","i32"),f.addLocal("ita","i32"),f.addLocal("itb","i32"),f.addLocal("last","i32"),f.addLocal("m","i32"),f.addLocal("c","i32"),f.addLocal("s","i32"),f.addLocal("pOut","i32");const d=f.getCodeBuilder(),r=d.i32_const(e.alloc(c));f.addCode(d.setLocal("ita",d.getLocal("pA")),d.setLocal("itb",d.getLocal("pB")),d.setLocal("last",d.i32_add(d.getLocal("pA"),d.i32_mul(d.getLocal("nOut"),d.i32_const(c)))),d.block(d.loop(d.br_if(1,d.i32_eq(d.getLocal("ita"),d.getLocal("last"))),d.call(t+"_zero",d.getLocal("ita")),d.call(t+"_zero",d.getLocal("itb")),d.setLocal("ita",d.i32_add(d.getLocal("ita"),d.i32_const(c))),d.setLocal("itb",d.i32_add(d.getLocal("itb"),d.i32_const(c))),d.br(0))),d.setLocal("it",d.getLocal("pCoefs")),d.setLocal("last",d.i32_add(d.getLocal("pCoefs"),d.i32_mul(d.getLocal("nCoefs"),d.i32_const(c+12)))),d.block(d.loop(d.br_if(1,d.i32_eq(d.getLocal("it"),d.getLocal("last"))),d.setLocal("s",d.i32_load(d.getLocal("it"),8)),d.if(d.i32_or(d.i32_lt_u(d.getLocal("s"),d.getLocal("offsetWitness")),d.i32_ge_u(d.getLocal("s"),d.i32_add(d.getLocal("offsetWitness"),d.getLocal("nWitness")))),[...d.setLocal("it",d.i32_add(d.getLocal("it"),d.i32_const(c+12))),...d.br(1)]),d.setLocal("m",d.i32_load(d.getLocal("it"))),d.if(d.i32_eq(d.getLocal("m"),d.i32_const(0)),d.setLocal("pOut",d.getLocal("pA")),d.if(d.i32_eq(d.getLocal("m"),d.i32_const(1)),d.setLocal("pOut",d.getLocal("pB")),[...d.setLocal("it",d.i32_add(d.getLocal("it"),d.i32_const(c+12))),...d.br(1)])),d.setLocal("c",d.i32_load(d.getLocal("it"),4)),d.if(d.i32_or(d.i32_lt_u(d.getLocal("c"),d.getLocal("offsetOut")),d.i32_ge_u(d.getLocal("c"),d.i32_add(d.getLocal("offsetOut"),d.getLocal("nOut")))),[...d.setLocal("it",d.i32_add(d.getLocal("it"),d.i32_const(c+12))),...d.br(1)]),d.setLocal("pOut",d.i32_add(d.getLocal("pOut"),d.i32_mul(d.i32_sub(d.getLocal("c"),d.getLocal("offsetOut")),d.i32_const(c)))),d.call(t+"_mul",d.i32_add(d.getLocal("pWitness"),d.i32_mul(d.i32_sub(d.getLocal("s"),d.getLocal("offsetWitness")),d.i32_const(c))),d.i32_add(d.getLocal("it"),d.i32_const(12)),r),d.call(t+"_add",d.getLocal("pOut"),r,d.getLocal("pOut")),d.setLocal("it",d.i32_add(d.getLocal("it"),d.i32_const(c+12))),d.br(0))),d.setLocal("ita",d.getLocal("pA")),d.setLocal("itb",d.getLocal("pB")),d.setLocal("it",d.getLocal("pC")),d.setLocal("last",d.i32_add(d.getLocal("pA"),d.i32_mul(d.getLocal("nOut"),d.i32_const(c)))),d.block(d.loop(d.br_if(1,d.i32_eq(d.getLocal("ita"),d.getLocal("last"))),d.call(t+"_mul",d.getLocal("ita"),d.getLocal("itb"),d.getLocal("it")),d.setLocal("ita",d.i32_add(d.getLocal("ita"),d.i32_const(c))),d.setLocal("itb",d.i32_add(d.getLocal("itb"),d.i32_const(c))),d.setLocal("it",d.i32_add(d.getLocal("it"),d.i32_const(c))),d.br(0))))}(),function(){const f=e.addFunction(a+"_joinABC");f.addParam("pA","i32"),f.addParam("pB","i32"),f.addParam("pC","i32"),f.addParam("n","i32"),f.addParam("pP","i32"),f.addLocal("ita","i32"),f.addLocal("itb","i32"),f.addLocal("itc","i32"),f.addLocal("itp","i32"),f.addLocal("last","i32");const d=f.getCodeBuilder(),r=d.i32_const(e.alloc(c));f.addCode(d.setLocal("ita",d.getLocal("pA")),d.setLocal("itb",d.getLocal("pB")),d.setLocal("itc",d.getLocal("pC")),d.setLocal("itp",d.getLocal("pP")),d.setLocal("last",d.i32_add(d.getLocal("pA"),d.i32_mul(d.getLocal("n"),d.i32_const(c)))),d.block(d.loop(d.br_if(1,d.i32_eq(d.getLocal("ita"),d.getLocal("last"))),d.call(t+"_mul",d.getLocal("ita"),d.getLocal("itb"),r),d.call(t+"_sub",r,d.getLocal("itc"),d.getLocal("itp")),d.setLocal("ita",d.i32_add(d.getLocal("ita"),d.i32_const(c))),d.setLocal("itb",d.i32_add(d.getLocal("itb"),d.i32_const(c))),d.setLocal("itc",d.i32_add(d.getLocal("itc"),d.i32_const(c))),d.setLocal("itp",d.i32_add(d.getLocal("itp"),d.i32_const(c))),d.br(0))))}(),function(){const f=e.addFunction(a+"_batchAdd");f.addParam("pa","i32"),f.addParam("pb","i32"),f.addParam("n","i32"),f.addParam("pr","i32"),f.addLocal("ita","i32"),f.addLocal("itb","i32"),f.addLocal("itr","i32"),f.addLocal("last","i32");const d=f.getCodeBuilder();f.addCode(d.setLocal("ita",d.getLocal("pa")),d.setLocal("itb",d.getLocal("pb")),d.setLocal("itr",d.getLocal("pr")),d.setLocal("last",d.i32_add(d.getLocal("pa"),d.i32_mul(d.getLocal("n"),d.i32_const(c)))),d.block(d.loop(d.br_if(1,d.i32_eq(d.getLocal("ita"),d.getLocal("last"))),d.call(t+"_add",d.getLocal("ita"),d.getLocal("itb"),d.getLocal("itr")),d.setLocal("ita",d.i32_add(d.getLocal("ita"),d.i32_const(c))),d.setLocal("itb",d.i32_add(d.getLocal("itb"),d.i32_const(c))),d.setLocal("itr",d.i32_add(d.getLocal("itr"),d.i32_const(c))),d.br(0))))}(),e.exportFunction(a+"_buildABC"),e.exportFunction(a+"_joinABC"),e.exportFunction(a+"_batchAdd"),a},Ne=function(e,a,t,c,f,d,r,n){const i=e.addFunction(a);i.addParam("pIn","i32"),i.addParam("n","i32"),i.addParam("pFirst","i32"),i.addParam("pInc","i32"),i.addParam("pOut","i32"),i.addLocal("pOldFree","i32"),i.addLocal("i","i32"),i.addLocal("pFrom","i32"),i.addLocal("pTo","i32");const b=i.getCodeBuilder(),o=b.i32_const(e.alloc(r));i.addCode(b.setLocal("pFrom",b.getLocal("pIn")),b.setLocal("pTo",b.getLocal("pOut"))),i.addCode(b.call(c+"_copy",b.getLocal("pFirst"),o)),i.addCode(b.setLocal("i",b.i32_const(0)),b.block(b.loop(b.br_if(1,b.i32_eq(b.getLocal("i"),b.getLocal("n"))),b.call(n,b.getLocal("pFrom"),o,b.getLocal("pTo")),b.setLocal("pFrom",b.i32_add(b.getLocal("pFrom"),b.i32_const(f))),b.setLocal("pTo",b.i32_add(b.getLocal("pTo"),b.i32_const(d))),b.call(c+"_mul",o,b.getLocal("pInc"),o),b.setLocal("i",b.i32_add(b.getLocal("i"),b.i32_const(1))),b.br(0)))),e.exportFunction(a)};const Re=D,Pe=se,De=he,Oe=xe,Fe=ve,Qe=Ee,Ue=Le,je=Se,He=Te,qe=Ne,{bitLength:$e,modInv:ze,isOdd:Ge,isNegative:Ke}=U,Ve=D,Ze=se,Je=he,We=xe,Ye=ve,Xe=Ee,ea=Le,aa=Se,ta=Te,ca=Ne,{bitLength:fa,isOdd:da,isNegative:ra}=U;var na=function(e,a){const t=a||"bn128";if(e.modules[t])return t;const c=21888242871839275222246405745257275088696311157297823662689037894645226208583n,f=21888242871839275222246405745257275088548364400416034343698204186575808495617n,d=Math.floor(($e(c-1n)-1)/64)+1,r=8*d,n=r,i=r,b=2*i,o=12*i,s=e.alloc(Re.bigInt2BytesLE(f,n)),l=Pe(e,c,"f1m");De(e,f,"fr","frm");const u=e.alloc(Re.bigInt2BytesLE(y(3n),i)),h=Qe(e,"g1m","f1m",u);Ue(e,"frm","frm","frm","frm_mul"),je(e,"pol","frm"),He(e,"qap","frm");const p=Oe(e,"f1m_neg","f2m","f1m"),g=e.alloc([...Re.bigInt2BytesLE(y(19485874751759354771024239261021720505790618469301721065564631296452457478373n),i),...Re.bigInt2BytesLE(y(266929791119991161246907387137283842545076965332900288569378510910307636690n),i)]),m=Qe(e,"g2m","f2m",g);function x(a,t){const c=e.addFunction(a);c.addParam("pG","i32"),c.addParam("pFr","i32"),c.addParam("pr","i32");const f=c.getCodeBuilder(),d=f.i32_const(e.alloc(r));c.addCode(f.call("frm_fromMontgomery",f.getLocal("pFr"),d),f.call(t,f.getLocal("pG"),d,f.i32_const(r),f.getLocal("pr"))),e.exportFunction(a)}function y(e){return BigInt(e)*(1n<0n;)Ge(e)?a.push(1):a.push(0),e>>=1n;return a}(),D=e.alloc(P),O=3*b,F=P.length-1,Q=P.reduce(((e,a)=>e+(0!=a?1:0)),0),U=6*r,j=3*r*2+(Q+F+1)*O;function H(a){const f=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[8376118865763821496583973867626364092589906065868298776909617916018768340080n,16469823323077808223889137241176536799009286646108169935659301613961712198316n],[21888242871839275220042445260109153167277707414472061641714758635765020556617n,0n],[11697423496358154304825782922584725312912383441159505038794027105778954184319n,303847389135065887422783454877609941456349188919719272345083954437860409601n],[21888242871839275220042445260109153167277707414472061641714758635765020556616n,0n],[3321304630594332808241809054958361220322477375291206261884409189760185844239n,5722266937896532885780051958958348231143373700109372999374820235121374419868n],[21888242871839275222246405745257275088696311157297823662689037894645226208582n,0n],[13512124006075453725662431877630910996106405091429524885779419978626457868503n,5418419548761466998357268504080738289687024511189653727029736280683514010267n],[2203960485148121921418603742825762020974279258880205651966n,0n],[10190819375481120917420622822672549775783927716138318623895010788866272024264n,21584395482704209334823622290379665147239961968378104390343953940207365798982n],[2203960485148121921418603742825762020974279258880205651967n,0n],[18566938241244942414004596690298913868373833782006617400804628704885040364344n,16165975933942742336466353786298926857552937457188450663314217659523851788715n]]],d=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[21575463638280843010398324269430826099269044274347216827212613867836435027261n,10307601595873709700152284273816112264069230130616436755625194854815875713954n],[21888242871839275220042445260109153167277707414472061641714758635765020556616n,0n],[3772000881919853776433695186713858239009073593817195771773381919316419345261n,2236595495967245188281701248203181795121068902605861227855261137820944008926n],[2203960485148121921418603742825762020974279258880205651966n,0n],[18429021223477853657660792034369865839114504446431234726392080002137598044644n,9344045779998320333812420223237981029506012124075525679208581902008406485703n]],[[1n,0n],[2581911344467009335267311115468803099551665605076196740867805258568234346338n,19937756971775647987995932169929341994314640652964949448313374472400716661030n],[2203960485148121921418603742825762020974279258880205651966n,0n],[5324479202449903542726783395506214481928257762400643279780343368557297135718n,16208900380737693084919495127334387981393726419856888799917914180988844123039n],[21888242871839275220042445260109153167277707414472061641714758635765020556616n,0n],[13981852324922362344252311234282257507216387789820983642040889267519694726527n,7629828391165209371577384193250820201684255241773809077146787135900891633097n]]],r=e.addFunction(t+"__frobeniusMap"+a);r.addParam("x","i32"),r.addParam("r","i32");const n=r.getCodeBuilder();for(let t=0;t<6;t++){const c=0==t?n.getLocal("x"):n.i32_add(n.getLocal("x"),n.i32_const(t*b)),s=c,u=n.i32_add(n.getLocal("x"),n.i32_const(t*b+i)),h=0==t?n.getLocal("r"):n.i32_add(n.getLocal("r"),n.i32_const(t*b)),g=h,m=n.i32_add(n.getLocal("r"),n.i32_const(t*b+i)),x=o(f[Math.floor(t/3)][a%12],d[t%3][a%6]),A=e.alloc([...Re.bigInt2BytesLE(y(x[0]),32),...Re.bigInt2BytesLE(y(x[1]),32)]);a%2==1?r.addCode(n.call(l+"_copy",s,g),n.call(l+"_neg",u,m),n.call(p+"_mul",h,n.i32_const(A),h)):r.addCode(n.call(p+"_mul",c,n.i32_const(A),h))}function o(e,a){const t=BigInt(e[0]),f=BigInt(e[1]),d=BigInt(a[0]),r=BigInt(a[1]),n=[(t*d-f*r)%c,(t*r+f*d)%c];return Ke(n[0])&&(n[0]=n[0]+c),n}}function q(){!function(){const a=e.addFunction(t+"__cyclotomicSquare");a.addParam("x","i32"),a.addParam("r","i32");const c=a.getCodeBuilder(),f=c.getLocal("x"),d=c.i32_add(c.getLocal("x"),c.i32_const(b)),r=c.i32_add(c.getLocal("x"),c.i32_const(2*b)),n=c.i32_add(c.getLocal("x"),c.i32_const(3*b)),i=c.i32_add(c.getLocal("x"),c.i32_const(4*b)),o=c.i32_add(c.getLocal("x"),c.i32_const(5*b)),s=c.getLocal("r"),l=c.i32_add(c.getLocal("r"),c.i32_const(b)),u=c.i32_add(c.getLocal("r"),c.i32_const(2*b)),h=c.i32_add(c.getLocal("r"),c.i32_const(3*b)),g=c.i32_add(c.getLocal("r"),c.i32_const(4*b)),m=c.i32_add(c.getLocal("r"),c.i32_const(5*b)),x=c.i32_const(e.alloc(b)),y=c.i32_const(e.alloc(b)),A=c.i32_const(e.alloc(b)),v=c.i32_const(e.alloc(b)),w=c.i32_const(e.alloc(b)),_=c.i32_const(e.alloc(b)),I=c.i32_const(e.alloc(b)),E=c.i32_const(e.alloc(b));a.addCode(c.call(p+"_mul",f,i,I),c.call(p+"_mul",i,c.i32_const(k),x),c.call(p+"_add",f,x,x),c.call(p+"_add",f,i,E),c.call(p+"_mul",E,x,x),c.call(p+"_mul",c.i32_const(k),I,E),c.call(p+"_add",I,E,E),c.call(p+"_sub",x,E,x),c.call(p+"_add",I,I,y),c.call(p+"_mul",n,r,I),c.call(p+"_mul",r,c.i32_const(k),A),c.call(p+"_add",n,A,A),c.call(p+"_add",n,r,E),c.call(p+"_mul",E,A,A),c.call(p+"_mul",c.i32_const(k),I,E),c.call(p+"_add",I,E,E),c.call(p+"_sub",A,E,A),c.call(p+"_add",I,I,v),c.call(p+"_mul",d,o,I),c.call(p+"_mul",o,c.i32_const(k),w),c.call(p+"_add",d,w,w),c.call(p+"_add",d,o,E),c.call(p+"_mul",E,w,w),c.call(p+"_mul",c.i32_const(k),I,E),c.call(p+"_add",I,E,E),c.call(p+"_sub",w,E,w),c.call(p+"_add",I,I,_),c.call(p+"_sub",x,f,s),c.call(p+"_add",s,s,s),c.call(p+"_add",x,s,s),c.call(p+"_add",y,i,g),c.call(p+"_add",g,g,g),c.call(p+"_add",y,g,g),c.call(p+"_mul",_,c.i32_const(S),E),c.call(p+"_add",E,n,h),c.call(p+"_add",h,h,h),c.call(p+"_add",E,h,h),c.call(p+"_sub",w,r,u),c.call(p+"_add",u,u,u),c.call(p+"_add",w,u,u),c.call(p+"_sub",A,d,l),c.call(p+"_add",l,l,l),c.call(p+"_add",A,l,l),c.call(p+"_add",v,o,m),c.call(p+"_add",m,m,m),c.call(p+"_add",v,m,m))}(),function(a,c){const f=function(e){let a=e;const t=[];for(;a>0n;){if(Ge(a)){const e=2-Number(a%4n);t.push(e),a-=BigInt(e)}else t.push(0);a>>=1n}return t}(a).map((e=>-1==e?255:e)),d=e.alloc(f),r=e.addFunction(t+"__cyclotomicExp_"+c);r.addParam("x","i32"),r.addParam("r","i32"),r.addLocal("bit","i32"),r.addLocal("i","i32");const n=r.getCodeBuilder(),i=n.getLocal("x"),b=n.getLocal("r"),s=n.i32_const(e.alloc(o));r.addCode(n.call(R+"_conjugate",i,s),n.call(R+"_one",b),n.if(n.teeLocal("bit",n.i32_load8_s(n.i32_const(f.length-1),d)),n.if(n.i32_eq(n.getLocal("bit"),n.i32_const(1)),n.call(R+"_mul",b,i,b),n.call(R+"_mul",b,s,b))),n.setLocal("i",n.i32_const(f.length-2)),n.block(n.loop(n.call(t+"__cyclotomicSquare",b,b),n.if(n.teeLocal("bit",n.i32_load8_s(n.getLocal("i"),d)),n.if(n.i32_eq(n.getLocal("bit"),n.i32_const(1)),n.call(R+"_mul",b,i,b),n.call(R+"_mul",b,s,b))),n.br_if(1,n.i32_eqz(n.getLocal("i"))),n.setLocal("i",n.i32_sub(n.getLocal("i"),n.i32_const(1))),n.br(0))))}(4965661367192848881n,"w0");const a=e.addFunction(t+"__finalExponentiationLastChunk");a.addParam("x","i32"),a.addParam("r","i32");const c=a.getCodeBuilder(),f=c.getLocal("x"),d=c.getLocal("r"),r=c.i32_const(e.alloc(o)),n=c.i32_const(e.alloc(o)),i=c.i32_const(e.alloc(o)),s=c.i32_const(e.alloc(o)),l=c.i32_const(e.alloc(o)),u=c.i32_const(e.alloc(o)),h=c.i32_const(e.alloc(o)),g=c.i32_const(e.alloc(o)),m=c.i32_const(e.alloc(o)),x=c.i32_const(e.alloc(o)),y=c.i32_const(e.alloc(o)),A=c.i32_const(e.alloc(o)),v=c.i32_const(e.alloc(o)),w=c.i32_const(e.alloc(o)),_=c.i32_const(e.alloc(o)),I=c.i32_const(e.alloc(o)),E=c.i32_const(e.alloc(o)),C=c.i32_const(e.alloc(o)),M=c.i32_const(e.alloc(o)),B=c.i32_const(e.alloc(o)),L=c.i32_const(e.alloc(o));a.addCode(c.call(t+"__cyclotomicExp_w0",f,r),c.call(R+"_conjugate",r,r),c.call(t+"__cyclotomicSquare",r,n),c.call(t+"__cyclotomicSquare",n,i),c.call(R+"_mul",i,n,s),c.call(t+"__cyclotomicExp_w0",s,l),c.call(R+"_conjugate",l,l),c.call(t+"__cyclotomicSquare",l,u),c.call(t+"__cyclotomicExp_w0",u,h),c.call(R+"_conjugate",h,h),c.call(R+"_conjugate",s,g),c.call(R+"_conjugate",h,m),c.call(R+"_mul",m,l,x),c.call(R+"_mul",x,g,y),c.call(R+"_mul",y,n,A),c.call(R+"_mul",y,l,v),c.call(R+"_mul",v,f,w),c.call(t+"__frobeniusMap1",A,_),c.call(R+"_mul",_,w,I),c.call(t+"__frobeniusMap2",y,E),c.call(R+"_mul",E,I,C),c.call(R+"_conjugate",f,M),c.call(R+"_mul",M,A,B),c.call(t+"__frobeniusMap3",B,L),c.call(R+"_mul",L,C,d))}e.modules[t]={n64:d,pG1gen:v,pG1zero:_,pG1b:u,pG2gen:E,pG2zero:M,pG2b:g,pq:e.modules.f1m.pq,pr:s,pOneT:B,prePSize:U,preQSize:j,r:f.toString(),q:c.toString()};const $=e.alloc(U),z=e.alloc(j);function G(a){const c=e.addFunction(t+"_pairingEq"+a);for(let e=0;e0n;)da(e)?a.push(1):a.push(0),e>>=1n;return a}(),P=e.alloc(R),D=3*i,O=R.length-1,F=R.reduce(((e,a)=>e+(0!=a?1:0)),0),Q=6*r,U=3*r*2+(F+O+1)*D,j=15132376222941642752n;function H(a){const t=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760n,151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351n,0n],[2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n,1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n,0n],[3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557n,877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230n],[4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786n,0n],[151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027n,3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,0n],[1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257n,2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437n,0n],[877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230n,3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557n]]],f=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[0n,4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n,0n],[0n,1n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,0n],[0n,793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n]],[[1n,0n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437n,0n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,0n],[4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786n,0n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n,0n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351n,0n]]],d=e.addFunction(N+"_frobeniusMap"+a);d.addParam("x","i32"),d.addParam("r","i32");const b=d.getCodeBuilder();for(let c=0;c<6;c++){const s=0==c?b.getLocal("x"):b.i32_add(b.getLocal("x"),b.i32_const(c*i)),l=s,u=b.i32_add(b.getLocal("x"),b.i32_const(c*i+n)),p=0==c?b.getLocal("r"):b.i32_add(b.getLocal("r"),b.i32_const(c*i)),g=p,x=b.i32_add(b.getLocal("r"),b.i32_const(c*i+n)),y=o(t[Math.floor(c/3)][a%12],f[c%3][a%6]),A=e.alloc([...Ve.bigInt2BytesLE(v(y[0]),r),...Ve.bigInt2BytesLE(v(y[1]),r)]);a%2==1?d.addCode(b.call(h+"_copy",l,g),b.call(h+"_neg",u,x),b.call(m+"_mul",p,b.i32_const(A),p)):d.addCode(b.call(m+"_mul",s,b.i32_const(A),p))}function o(e,a){const t=e[0],f=e[1],d=a[0],r=a[1],n=[(t*d-f*r)%c,(t*r+f*d)%c];return ra(n[0])&&(n[0]=n[0]+c),n}}e.modules[t]={n64q:d,n64r:o,n8q:r,n8r:s,pG1gen:_,pG1zero:E,pG1b:p,pG2gen:M,pG2zero:k,pG2b:x,pq:e.modules.f1m.pq,pr:u,pOneT:L,r:f,q:c,prePSize:Q,preQSize:U},function(){const a=e.addFunction(T+"_mul1");a.addParam("pA","i32"),a.addParam("pC1","i32"),a.addParam("pR","i32");const t=a.getCodeBuilder(),c=t.getLocal("pA"),f=t.i32_add(t.getLocal("pA"),t.i32_const(2*n)),d=t.i32_add(t.getLocal("pA"),t.i32_const(4*n)),r=t.getLocal("pC1"),i=t.getLocal("pR"),b=t.i32_add(t.getLocal("pR"),t.i32_const(2*n)),o=t.i32_add(t.getLocal("pR"),t.i32_const(4*n)),s=t.i32_const(e.alloc(2*n)),l=t.i32_const(e.alloc(2*n));a.addCode(t.call(m+"_add",c,f,s),t.call(m+"_add",f,d,l),t.call(m+"_mul",f,r,o),t.call(m+"_mul",l,r,i),t.call(m+"_sub",i,o,i),t.call(m+"_mulNR",i,i),t.call(m+"_mul",s,r,b),t.call(m+"_sub",b,o,b))}(),function(){const a=e.addFunction(T+"_mul01");a.addParam("pA","i32"),a.addParam("pC0","i32"),a.addParam("pC1","i32"),a.addParam("pR","i32");const t=a.getCodeBuilder(),c=t.getLocal("pA"),f=t.i32_add(t.getLocal("pA"),t.i32_const(2*n)),d=t.i32_add(t.getLocal("pA"),t.i32_const(4*n)),r=t.getLocal("pC0"),i=t.getLocal("pC1"),b=t.getLocal("pR"),o=t.i32_add(t.getLocal("pR"),t.i32_const(2*n)),s=t.i32_add(t.getLocal("pR"),t.i32_const(4*n)),l=t.i32_const(e.alloc(2*n)),u=t.i32_const(e.alloc(2*n)),h=t.i32_const(e.alloc(2*n)),p=t.i32_const(e.alloc(2*n));a.addCode(t.call(m+"_mul",c,r,l),t.call(m+"_mul",f,i,u),t.call(m+"_add",c,f,h),t.call(m+"_add",c,d,p),t.call(m+"_add",f,d,b),t.call(m+"_mul",b,i,b),t.call(m+"_sub",b,u,b),t.call(m+"_mulNR",b,b),t.call(m+"_add",b,l,b),t.call(m+"_add",r,i,o),t.call(m+"_mul",o,h,o),t.call(m+"_sub",o,l,o),t.call(m+"_sub",o,u,o),t.call(m+"_mul",p,r,s),t.call(m+"_sub",s,l,s),t.call(m+"_add",s,u,s))}(),function(){const a=e.addFunction(N+"_mul014");a.addParam("pA","i32"),a.addParam("pC0","i32"),a.addParam("pC1","i32"),a.addParam("pC4","i32"),a.addParam("pR","i32");const t=a.getCodeBuilder(),c=t.getLocal("pA"),f=t.i32_add(t.getLocal("pA"),t.i32_const(6*n)),d=t.getLocal("pC0"),r=t.getLocal("pC1"),i=t.getLocal("pC4"),b=t.i32_const(e.alloc(6*n)),o=t.i32_const(e.alloc(6*n)),s=t.i32_const(e.alloc(2*n)),l=t.getLocal("pR"),u=t.i32_add(t.getLocal("pR"),t.i32_const(6*n));a.addCode(t.call(T+"_mul01",c,d,r,b),t.call(T+"_mul1",f,i,o),t.call(m+"_add",r,i,s),t.call(T+"_add",f,c,u),t.call(T+"_mul01",u,d,s,u),t.call(T+"_sub",u,b,u),t.call(T+"_sub",u,o,u),t.call(T+"_copy",o,l),t.call(T+"_mulNR",l,l),t.call(T+"_add",l,b,l))}(),function(){const a=e.addFunction(t+"_ell");a.addParam("pP","i32"),a.addParam("pCoefs","i32"),a.addParam("pF","i32");const c=a.getCodeBuilder(),f=c.getLocal("pP"),d=c.i32_add(c.getLocal("pP"),c.i32_const(r)),i=c.getLocal("pF"),b=c.getLocal("pCoefs"),o=c.i32_add(c.getLocal("pCoefs"),c.i32_const(n)),s=c.i32_add(c.getLocal("pCoefs"),c.i32_const(2*n)),l=c.i32_add(c.getLocal("pCoefs"),c.i32_const(3*n)),u=c.i32_add(c.getLocal("pCoefs"),c.i32_const(4*n)),p=e.alloc(2*n),g=c.i32_const(p),m=c.i32_const(p),x=c.i32_const(p+n),y=e.alloc(2*n),A=c.i32_const(y),v=c.i32_const(y),w=c.i32_const(y+n);a.addCode(c.call(h+"_mul",b,d,m),c.call(h+"_mul",o,d,x),c.call(h+"_mul",s,f,v),c.call(h+"_mul",l,f,w),c.call(N+"_mul014",i,u,A,g,i))}();const q=e.alloc(Q),$=e.alloc(U);function z(a){const c=e.addFunction(t+"_pairingEq"+a);for(let e=0;e0n;){if(da(a)){const e=2-Number(a%4n);t.push(e),a-=BigInt(e)}else t.push(0);a>>=1n}return t}(a).map((e=>-1==e?255:e)),r=e.alloc(d),n=e.addFunction(t+"__cyclotomicExp_"+f);n.addParam("x","i32"),n.addParam("r","i32"),n.addLocal("bit","i32"),n.addLocal("i","i32");const i=n.getCodeBuilder(),o=i.getLocal("x"),s=i.getLocal("r"),l=i.i32_const(e.alloc(b));n.addCode(i.call(N+"_conjugate",o,l),i.call(N+"_one",s),i.if(i.teeLocal("bit",i.i32_load8_s(i.i32_const(d.length-1),r)),i.if(i.i32_eq(i.getLocal("bit"),i.i32_const(1)),i.call(N+"_mul",s,o,s),i.call(N+"_mul",s,l,s))),i.setLocal("i",i.i32_const(d.length-2)),i.block(i.loop(i.call(t+"__cyclotomicSquare",s,s),i.if(i.teeLocal("bit",i.i32_load8_s(i.getLocal("i"),r)),i.if(i.i32_eq(i.getLocal("bit"),i.i32_const(1)),i.call(N+"_mul",s,o,s),i.call(N+"_mul",s,l,s))),i.br_if(1,i.i32_eqz(i.getLocal("i"))),i.setLocal("i",i.i32_sub(i.getLocal("i"),i.i32_const(1))),i.br(0)))),c&&n.addCode(i.call(N+"_conjugate",s,s))}(j,!0,"w0");const a=e.addFunction(t+"_finalExponentiation");a.addParam("x","i32"),a.addParam("r","i32");const c=a.getCodeBuilder(),f=c.getLocal("x"),d=c.getLocal("r"),r=c.i32_const(e.alloc(b)),n=c.i32_const(e.alloc(b)),o=c.i32_const(e.alloc(b)),s=c.i32_const(e.alloc(b)),l=c.i32_const(e.alloc(b)),u=c.i32_const(e.alloc(b)),h=c.i32_const(e.alloc(b));a.addCode(c.call(N+"_frobeniusMap6",f,r),c.call(N+"_inverse",f,n),c.call(N+"_mul",r,n,o),c.call(N+"_copy",o,n),c.call(N+"_frobeniusMap2",o,o),c.call(N+"_mul",o,n,o),c.call(t+"__cyclotomicSquare",o,n),c.call(N+"_conjugate",n,n),c.call(t+"__cyclotomicExp_w0",o,s),c.call(t+"__cyclotomicSquare",s,l),c.call(N+"_mul",n,s,u),c.call(t+"__cyclotomicExp_w0",u,n),c.call(t+"__cyclotomicExp_w0",n,r),c.call(t+"__cyclotomicExp_w0",r,h),c.call(N+"_mul",h,l,h),c.call(t+"__cyclotomicExp_w0",h,l),c.call(N+"_conjugate",u,u),c.call(N+"_mul",l,u,l),c.call(N+"_mul",l,o,l),c.call(N+"_conjugate",o,u),c.call(N+"_mul",n,o,n),c.call(N+"_frobeniusMap3",n,n),c.call(N+"_mul",h,u,h),c.call(N+"_frobeniusMap1",h,h),c.call(N+"_mul",s,r,s),c.call(N+"_frobeniusMap2",s,s),c.call(N+"_mul",s,n,s),c.call(N+"_mul",s,h,s),c.call(N+"_mul",s,l,d))}();for(let a=1;a<=5;a++)z(a),e.exportFunction(t+"_pairingEq"+a);!function(){const a=e.addFunction(t+"_pairing");a.addParam("p","i32"),a.addParam("q","i32"),a.addParam("r","i32");const c=a.getCodeBuilder(),f=c.i32_const(e.alloc(b));a.addCode(c.call(t+"_prepareG1",c.getLocal("p"),c.i32_const(q))),a.addCode(c.call(t+"_prepareG2",c.getLocal("q"),c.i32_const($))),a.addCode(c.call(t+"_millerLoop",c.i32_const(q),c.i32_const($),f)),a.addCode(c.call(t+"_finalExponentiation",f,c.getLocal("r")))}(),e.exportFunction(t+"_pairing"),e.exportFunction(t+"_prepareG1"),e.exportFunction(t+"_prepareG2"),e.exportFunction(t+"_millerLoop"),e.exportFunction(t+"_finalExponentiation"),e.exportFunction(t+"_finalExponentiationOld"),e.exportFunction(t+"__cyclotomicSquare"),e.exportFunction(t+"__cyclotomicExp_w0"),e.exportFunction(T+"_mul1"),e.exportFunction(T+"_mul01"),e.exportFunction(N+"_mul014"),e.exportFunction(g+"_inGroupAffine"),e.exportFunction(g+"_inGroup"),e.exportFunction(y+"_inGroupAffine"),e.exportFunction(y+"_inGroup")};function ba(e,a){let t=e;void 0===a&&0==(a=Math.floor((r(e)-1)/8)+1)&&(a=1);const c=new Uint8Array(a),f=new DataView(c.buffer);let d=0;for(;d>=BigInt(32)):d+2<=a?(f.setUint16(d,Number(t&BigInt(65535)),!0),d+=2,t>>=BigInt(16)):(f.setUint8(d,Number(t&BigInt(255)),!0),d+=1,t>>=BigInt(8));if(t)throw new Error("Number does not fit in this length");return c}const oa=[];for(let e=0;e<256;e++)oa[e]=sa(e,8);function sa(e,a){let t=0,c=e;for(let e=0;e>=1;return t}function la(e,a){return(oa[e>>>24]|oa[e>>>16&255]<<8|oa[e>>>8&255]<<16|oa[255&e]<<24)>>>32-a}function ua(e){return(4294901760&e?(e&=4294901760,16):0)|(4278255360&e?(e&=4278255360,8):0)|(4042322160&e?(e&=4042322160,4):0)|(3435973836&e?(e&=3435973836,2):0)|!!(2863311530&e)}function ha(e,a){const t=e.byteLength/a,c=ua(t);if(t!=1<t){const c=e.slice(f*a,(f+1)*a);e.set(e.slice(t*a,(t+1)*a),f*a),e.set(c,t*a)}}}function pa(e,a){const t=new Uint8Array(a*e.length);for(let c=0;c0;)t>=4?(t-=4,a+=BigInt(f.getUint32(t))<=2?(t-=2,a+=BigInt(f.getUint16(t))<0;)d-4>=0?(d-=4,f.setUint32(d,Number(t&BigInt(4294967295))),t>>=BigInt(32)):d-2>=0?(d-=2,f.setUint16(d,Number(t&BigInt(65535))),t>>=BigInt(16)):(d-=1,f.setUint8(d,Number(t&BigInt(255))),t>>=BigInt(8));if(t)throw new Error("Number does not fit in this length");return c},bitReverse:la,buffReverseBits:ha,buffer2array:ga,leBuff2int:function(e){let a=BigInt(0),t=0;const c=new DataView(e.buffer,e.byteOffset,e.byteLength);for(;t{t[c]=e(a[c])})),t}return a},stringifyFElements:function e(a,t){if("bigint"==typeof t||void 0!==t.eq)return t.toString(10);if(t instanceof Uint8Array)return a.toString(a.e(t));if(Array.isArray(t))return t.map(e.bind(this,a));if("object"==typeof t){const c={};return Object.keys(t).forEach((f=>{c[f]=e(a,t[f])})),c}return t},unstringifyBigInts:function e(a){if("string"==typeof a&&/^[0-9]+$/.test(a))return BigInt(a);if("string"==typeof a&&/^0x[0-9a-fA-F]+$/.test(a))return BigInt(a);if(Array.isArray(a))return a.map(e);if("object"==typeof a){if(null===a)return null;const t={};return Object.keys(a).forEach((c=>{t[c]=e(a[c])})),t}return a},unstringifyFElements:function e(a,t){if("string"==typeof t&&/^[0-9]+$/.test(t))return a.e(t);if("string"==typeof t&&/^0x[0-9a-fA-F]+$/.test(t))return a.e(t);if(Array.isArray(t))return t.map(e.bind(this,a));if("object"==typeof t){if(null===t)return null;const c={};return Object.keys(t).forEach((f=>{c[f]=e(a,t[f])})),c}return t}});const xa=1<<30;class ya{constructor(e){this.buffers=[],this.byteLength=e;for(let a=0;a0;){const e=r+n>xa?xa-r:n,a=new Uint8Array(this.buffers[d].buffer,this.buffers[d].byteOffset+r,e);if(e==t)return a.slice();f||(f=t<=xa?new Uint8Array(t):new ya(t)),f.set(a,t-n),n-=e,d++,r=0}return f}set(e,a){void 0===a&&(a=0);const t=e.byteLength;if(0==t)return;const c=Math.floor(a/xa);if(c==Math.floor((a+t-1)/xa))return e instanceof ya&&1==e.buffers.length?this.buffers[c].set(e.buffers[0],a%xa):this.buffers[c].set(e,a%xa);let f=c,d=a%xa,r=t;for(;r>0;){const a=d+r>xa?xa-d:r,c=e.slice(t-r,t-r+a);new Uint8Array(this.buffers[f].buffer,this.buffers[f].byteOffset+d,a).set(c),r-=a,f++,d=0}}}function Aa(e,a,t,c){return async function(f){const d=Math.floor(f.byteLength/t);if(d*t!==f.byteLength)throw new Error("Invalid buffer size");const r=Math.floor(d/e.concurrency),n=[];for(let i=0;i=0;e--)this.w[e]=this.square(this.w[e+1]);if(!this.eq(this.w[0],this.one))throw new Error("Error calculating roots of unity");this.batchToMontgomery=Aa(e,a+"_batchToMontgomery",this.n8,this.n8),this.batchFromMontgomery=Aa(e,a+"_batchFromMontgomery",this.n8,this.n8)}op2(e,a,t){return this.tm.setBuff(this.pOp1,a),this.tm.setBuff(this.pOp2,t),this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op2Bool(e,a,t){return this.tm.setBuff(this.pOp1,a),this.tm.setBuff(this.pOp2,t),!!this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp2)}op1(e,a){return this.tm.setBuff(this.pOp1,a),this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op1Bool(e,a){return this.tm.setBuff(this.pOp1,a),!!this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp3)}add(e,a){return this.op2("_add",e,a)}eq(e,a){return this.op2Bool("_eq",e,a)}isZero(e){return this.op1Bool("_isZero",e)}sub(e,a){return this.op2("_sub",e,a)}neg(e){return this.op1("_neg",e)}inv(e){return this.op1("_inverse",e)}toMontgomery(e){return this.op1("_toMontgomery",e)}fromMontgomery(e){return this.op1("_fromMontgomery",e)}mul(e,a){return this.op2("_mul",e,a)}div(e,a){return this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,a),this.tm.instance.exports[this.prefix+"_inverse"](this.pOp2,this.pOp2),this.tm.instance.exports[this.prefix+"_mul"](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}square(e){return this.op1("_square",e)}isSquare(e){return this.op1Bool("_isSquare",e)}sqrt(e){return this.op1("_sqrt",e)}exp(e,a){return a instanceof Uint8Array||(a=E(d(a))),this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,a),this.tm.instance.exports[this.prefix+"_exp"](this.pOp1,this.pOp2,a.byteLength,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}isNegative(e){return this.op1Bool("_isNegative",e)}e(e,a){if(e instanceof Uint8Array)return e;let t=d(e,a);n(t)?(t=g(t),y(t,this.p)&&(t=x(t,this.p)),t=p(this.p,t)):y(t,this.p)&&(t=x(t,this.p));const c=ba(t,this.n8);return this.toMontgomery(c)}toString(e,a){return I(_(this.fromMontgomery(e),0),a)}fromRng(e){let a;const t=new Uint8Array(this.n8);do{a=C;for(let t=0;t{this.reject=a,this.resolve=e}))}}const Ba="data:application/javascript;base64,"+globalThis.btoa('(function thread(self) {\n const MAXMEM = 32767;\n let instance;\n let memory;\n\n if (self) {\n self.onmessage = function(e) {\n let data;\n if (e.data) {\n data = e.data;\n } else {\n data = e;\n }\n\n if (data[0].cmd == "INIT") {\n init(data[0]).then(function() {\n self.postMessage(data.result);\n });\n } else if (data[0].cmd == "TERMINATE") {\n self.close();\n } else {\n const res = runTask(data);\n self.postMessage(res);\n }\n };\n }\n\n async function init(data) {\n const code = new Uint8Array(data.code);\n const wasmModule = await WebAssembly.compile(code);\n memory = new WebAssembly.Memory({initial:data.init, maximum: MAXMEM});\n\n instance = await WebAssembly.instantiate(wasmModule, {\n env: {\n "memory": memory\n }\n });\n }\n\n\n\n function alloc(length) {\n const u32 = new Uint32Array(memory.buffer, 0, 1);\n while (u32[0] & 3) u32[0]++; // Return always aligned pointers\n const res = u32[0];\n u32[0] += length;\n if (u32[0] + length > memory.buffer.byteLength) {\n const currentPages = memory.buffer.byteLength / 0x10000;\n let requiredPages = Math.floor((u32[0] + length) / 0x10000)+1;\n if (requiredPages>MAXMEM) requiredPages=MAXMEM;\n memory.grow(requiredPages-currentPages);\n }\n return res;\n }\n\n function allocBuffer(buffer) {\n const p = alloc(buffer.byteLength);\n setBuffer(p, buffer);\n return p;\n }\n\n function getBuffer(pointer, length) {\n const u8 = new Uint8Array(memory.buffer);\n return new Uint8Array(u8.buffer, u8.byteOffset + pointer, length);\n }\n\n function setBuffer(pointer, buffer) {\n const u8 = new Uint8Array(memory.buffer);\n u8.set(new Uint8Array(buffer), pointer);\n }\n\n function runTask(task) {\n if (task[0].cmd == "INIT") {\n return init(task[0]);\n }\n const ctx = {\n vars: [],\n out: []\n };\n const u32a = new Uint32Array(memory.buffer, 0, 1);\n const oldAlloc = u32a[0];\n for (let i=0; i0;e++)if(0==this.working[e]){const a=this.actionQueue.shift();this.postAction(e,a.data,a.transfers,a.deferred)}}queueAction(e,a){const t=new Ma;if(this.singleThread){const a=this.taskManager(e);t.resolve(a)}else this.actionQueue.push({data:e,transfers:a,deferred:t}),this.processWorks();return t.promise}resetMemory(){this.u32[0]=this.initalPFree}allocBuff(e){const a=this.alloc(e.byteLength);return this.setBuff(a,e),a}getBuff(e,a){return this.u8.slice(e,e+a)}setBuff(e,a){this.u8.set(new Uint8Array(a),e)}alloc(e){for(;3&this.u32[0];)this.u32[0]++;const a=this.u32[0];return this.u32[0]+=e,a}async terminate(){for(let e=0;esetTimeout(e,200)))}}function La(e,a){const t=e[a],c=e.Fr,f=e.tm;e[a].batchApplyKey=async function(e,d,r,n,i){let b,o,s,l,u;if(n=n||"affine",i=i||"affine","G1"==a)"jacobian"==n?(s=3*t.F.n8,b="g1m_batchApplyKey"):(s=2*t.F.n8,b="g1m_batchApplyKeyMixed"),l=3*t.F.n8,"jacobian"==i?u=3*t.F.n8:(o="g1m_batchToAffine",u=2*t.F.n8);else if("G2"==a)"jacobian"==n?(s=3*t.F.n8,b="g2m_batchApplyKey"):(s=2*t.F.n8,b="g2m_batchApplyKeyMixed"),l=3*t.F.n8,"jacobian"==i?u=3*t.F.n8:(o="g2m_batchToAffine",u=2*t.F.n8);else{if("Fr"!=a)throw new Error("Invalid group: "+a);b="frm_batchApplyKey",s=t.n8,l=t.n8,u=t.n8}const h=Math.floor(e.byteLength/s),p=Math.floor(h/f.concurrency),g=[];r=c.e(r);let m=c.e(d);for(let a=0;a=0;e--){if(!t.isZero(p))for(let e=0;eb&&(p=b),p<1024&&(p=1024);const g=[];for(let a=0;a(n&&n.debug(`Multiexp end: ${i}: ${a}/${s}`),e))))}const m=await Promise.all(g);let x=t.zero;for(let e=m.length-1;e>=0;e--)x=t.add(x,m[e]);return x}t.multiExp=async function(e,a,t,c){return await d(e,a,"jacobian",t,c)},t.multiExpAffine=async function(e,a,t,c){return await d(e,a,"affine",t,c)}}function Na(e,a){const t=e[a],c=e.Fr,f=t.tm;async function d(e,n,i,b,o,s){let l,u,h,p,g,m,x,y;i=i||"affine",b=b||"affine","G1"==a?("affine"==i?(l=2*t.F.n8,p="g1m_batchToJacobian"):l=3*t.F.n8,u=3*t.F.n8,n&&(y="g1m_fftFinal"),x="g1m_fftJoin",m="g1m_fftMix","affine"==b?(h=2*t.F.n8,g="g1m_batchToAffine"):h=3*t.F.n8):"G2"==a?("affine"==i?(l=2*t.F.n8,p="g2m_batchToJacobian"):l=3*t.F.n8,u=3*t.F.n8,n&&(y="g2m_fftFinal"),x="g2m_fftJoin",m="g2m_fftMix","affine"==b?(h=2*t.F.n8,g="g2m_batchToAffine"):h=3*t.F.n8):"Fr"==a&&(l=t.n8,u=t.n8,h=t.n8,n&&(y="frm_fftFinal"),m="frm_fftMix",x="frm_fftJoin");let A=!1;Array.isArray(e)?(e=pa(e,l),A=!0):e=e.slice(0,e.byteLength);const v=e.byteLength/l,w=ua(v);if(1<1<<28?new ya(2*s[0].byteLength):new Uint8Array(2*s[0].byteLength),l.set(s[0]),l.set(s[1],s[0].byteLength),l}(e,i,b,o,s):await async function(e,a,t,f,n){let i,b;i=e.slice(0,e.byteLength/2),b=e.slice(e.byteLength/2,e.byteLength);const o=[];[i,b]=await r(i,b,"fftJoinExt",c.one,c.shift,a,"jacobian",f,n),o.push(d(i,!1,"jacobian",t,f,n)),o.push(d(b,!1,"jacobian",t,f,n));const s=await Promise.all(o);let l;return l=s[0].byteLength>1<<28?new ya(2*s[0].byteLength):new Uint8Array(2*s[0].byteLength),l.set(s[0]),l.set(s[1],s[0].byteLength),l}(e,i,b,o,s),A?ga(a,h):a}let _,I,E;n&&(_=c.inv(c.e(v))),ha(e,l);let C=Math.min(16384,v),M=v/C;for(;M=16;)M*=2,C/=2;const B=ua(C),k=[];for(let a=0;a(o&&o.debug(`${s}: fft ${w} mix end: ${a}/${M}`),e))))}E=await Promise.all(k);for(let e=0;e(o&&o.debug(`${s}: fft ${w} join ${e}/${w} ${r+1}/${a} ${n}/${t/2}`),c))))}const r=await Promise.all(d);for(let e=0;e0;a--)I.set(E[a],e),e+=C*h,delete E[a];I.set(E[0].slice(0,(C-1)*h),e),delete E[0]}else for(let e=0;e65536&&(A=65536);const v=[];for(let a=0;a(s&&s.debug(`${l}: fftJoinExt End: ${a}/${y}`),e))))}const w=await Promise.all(v);let _,I;y*g>1<<28?(_=new ya(y*g),I=new ya(y*g)):(_=new Uint8Array(y*g),I=new Uint8Array(y*g));let E=0;for(let e=0;ec.s+1)throw i&&i.error("lagrangeEvaluations input too big"),new Error("lagrangeEvaluations input too big");let u=e.slice(0,e.byteLength/2),h=e.slice(e.byteLength/2,e.byteLength);const p=c.exp(c.shift,s/2),g=c.inv(c.sub(c.one,p));[u,h]=await r(u,h,"prepareLagrangeEvaluation",g,c.shiftInv,f,"jacobian",i,b+" prep");const m=[];let x;return m.push(d(u,!0,"jacobian",n,i,b+" t0")),m.push(d(h,!0,"jacobian",n,i,b+" t1")),[u,h]=await Promise.all(m),x=u.byteLength>1<<28?new ya(2*u.byteLength):new Uint8Array(2*u.byteLength),x.set(u),x.set(h,u.byteLength),x},t.fftMix=async function(e){const d=3*t.F.n8;let r,n;if("G1"==a)r="g1m_fftMix",n="g1m_fftJoin";else if("G2"==a)r="g2m_fftMix",n="g2m_fftJoin";else{if("Fr"!=a)throw new Error("Invalid group");r="frm_fftMix",n="frm_fftJoin"}const i=Math.floor(e.byteLength/d),b=ua(i);let o=1<=0;e--)u.set(l[e][0],h),h+=l[e][0].byteLength;return u}}async function Ra(e){const a=await async function(e,a){const t=new ka;t.memory=new WebAssembly.Memory({initial:Ca}),t.u8=new Uint8Array(t.memory.buffer),t.u32=new Uint32Array(t.memory.buffer);const c=await WebAssembly.compile(e.code);if(t.instance=await WebAssembly.instantiate(c,{env:{memory:t.memory}}),t.singleThread=a,t.initalPFree=t.u32[0],t.pq=e.pq,t.pr=e.pr,t.pG1gen=e.pG1gen,t.pG1zero=e.pG1zero,t.pG2gen=e.pG2gen,t.pG2zero=e.pG2zero,t.pOneT=e.pOneT,a)t.code=e.code,t.taskManager=function(){const e=32767;let a,t;async function c(c){const f=new Uint8Array(c.code),d=await WebAssembly.compile(f);t=new WebAssembly.Memory({initial:c.init,maximum:e}),a=await WebAssembly.instantiate(d,{env:{memory:t}})}function f(a){const c=new Uint32Array(t.buffer,0,1);for(;3&c[0];)c[0]++;const f=c[0];if(c[0]+=a,c[0]+a>t.buffer.byteLength){const f=t.buffer.byteLength/65536;let d=Math.floor((c[0]+a)/65536)+1;d>e&&(d=e),t.grow(d-f)}return f}function d(e){const a=f(e.byteLength);return n(a,e),a}function r(e,a){const c=new Uint8Array(t.buffer);return new Uint8Array(c.buffer,c.byteOffset+e,a)}function n(e,a){new Uint8Array(t.buffer).set(new Uint8Array(a),e)}function i(e){if("INIT"==e[0].cmd)return c(e[0]);const i={vars:[],out:[]},b=new Uint32Array(t.buffer,0,1)[0];for(let t=0;t64&&(a=64),t.concurrency=a;for(let e=0;e>8n&0xFFn)),a.push(Number(t>>16n&0xFFn)),a.push(Number(t>>24n&0xFFn)),a}function Qa(e){const a=function(e){for(var a=[],t=0;t>6,128|63&c):c<55296||c>=57344?a.push(224|c>>12,128|c>>6&63,128|63&c):(t++,c=65536+((1023&c)<<10|1023&e.charCodeAt(t)),a.push(240|c>>18,128|c>>12&63,128|c>>6&63,128|63&c))}return a}(e);return[...$a(a.length),...a]}function Ua(e){const a=[];let t=Pa(e);if(Da(t))throw new Error("Number cannot be negative");for(;!Oa(t);)a.push(Number(0x7Fn&t)),t>>=7n;0==a.length&&a.push(0);for(let e=0;e0xFFFFFFFFn)throw new Error("Number too big");if(a>0x7FFFFFFFn&&(a-=0x100000000n),a<-2147483648n)throw new Error("Number too small");return ja(a)}function qa(e){let a=Pa(e);if(a>0xFFFFFFFFFFFFFFFFn)throw new Error("Number too big");if(a>0x7FFFFFFFFFFFFFFFn&&(a-=0x10000000000000000n),a<-9223372036854775808n)throw new Error("Number too small");return ja(a)}function $a(e){let a=Pa(e);if(a>0xFFFFFFFFn)throw new Error("Number too big");return Ua(a)}function za(e){return Array.from(e,(function(e){return("0"+(255&e).toString(16)).slice(-2)})).join("")}class Ga{constructor(e){this.func=e,this.functionName=e.functionName,this.module=e.module}setLocal(e,a){const t=this.func.localIdxByName[e];if(void 0===t)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${e} `);return[...a,33,...$a(t)]}teeLocal(e,a){const t=this.func.localIdxByName[e];if(void 0===t)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${e} `);return[...a,34,...$a(t)]}getLocal(e){const a=this.func.localIdxByName[e];if(void 0===a)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${e} `);return[32,...$a(a)]}i64_load8_s(e,a,t){return[...e,48,void 0===t?0:t,...$a(a||0)]}i64_load8_u(e,a,t){return[...e,49,void 0===t?0:t,...$a(a||0)]}i64_load16_s(e,a,t){return[...e,50,void 0===t?1:t,...$a(a||0)]}i64_load16_u(e,a,t){return[...e,51,void 0===t?1:t,...$a(a||0)]}i64_load32_s(e,a,t){return[...e,52,void 0===t?2:t,...$a(a||0)]}i64_load32_u(e,a,t){return[...e,53,void 0===t?2:t,...$a(a||0)]}i64_load(e,a,t){return[...e,41,void 0===t?3:t,...$a(a||0)]}i64_store(e,a,t,c){let f,d,r;return Array.isArray(a)?(f=0,d=3,r=a):Array.isArray(t)?(f=a,d=3,r=t):Array.isArray(c)&&(f=a,d=t,r=c),[...e,...r,55,d,...$a(f)]}i64_store32(e,a,t,c){let f,d,r;return Array.isArray(a)?(f=0,d=2,r=a):Array.isArray(t)?(f=a,d=2,r=t):Array.isArray(c)&&(f=a,d=t,r=c),[...e,...r,62,d,...$a(f)]}i64_store16(e,a,t,c){let f,d,r;return Array.isArray(a)?(f=0,d=1,r=a):Array.isArray(t)?(f=a,d=1,r=t):Array.isArray(c)&&(f=a,d=t,r=c),[...e,...r,61,d,...$a(f)]}i64_store8(e,a,t,c){let f,d,r;return Array.isArray(a)?(f=0,d=0,r=a):Array.isArray(t)?(f=a,d=0,r=t):Array.isArray(c)&&(f=a,d=t,r=c),[...e,...r,60,d,...$a(f)]}i32_load8_s(e,a,t){return[...e,44,void 0===t?0:t,...$a(a||0)]}i32_load8_u(e,a,t){return[...e,45,void 0===t?0:t,...$a(a||0)]}i32_load16_s(e,a,t){return[...e,46,void 0===t?1:t,...$a(a||0)]}i32_load16_u(e,a,t){return[...e,47,void 0===t?1:t,...$a(a||0)]}i32_load(e,a,t){return[...e,40,void 0===t?2:t,...$a(a||0)]}i32_store(e,a,t,c){let f,d,r;return Array.isArray(a)?(f=0,d=2,r=a):Array.isArray(t)?(f=a,d=2,r=t):Array.isArray(c)&&(f=a,d=t,r=c),[...e,...r,54,d,...$a(f)]}i32_store16(e,a,t,c){let f,d,r;return Array.isArray(a)?(f=0,d=1,r=a):Array.isArray(t)?(f=a,d=1,r=t):Array.isArray(c)&&(f=a,d=t,r=c),[...e,...r,59,d,...$a(f)]}i32_store8(e,a,t,c){let f,d,r;return Array.isArray(a)?(f=0,d=0,r=a):Array.isArray(t)?(f=a,d=0,r=t):Array.isArray(c)&&(f=a,d=t,r=c),[...e,...r,58,d,...$a(f)]}call(e,...a){const t=this.module.functionIdxByName[e];if(void 0===t)throw new Error(`Function not defined: Function: ${e}`);return[...[].concat(...a),16,...$a(t)]}call_indirect(e,...a){return[...[].concat(...a),...e,17,0,0]}if(e,a,t){return t?[...e,4,64,...a,5,...t,11]:[...e,4,64,...a,11]}block(e){return[2,64,...e,11]}loop(...e){return[3,64,...[].concat(...e),11]}br_if(e,a){return[...a,13,...$a(e)]}br(e){return[12,...$a(e)]}ret(e){return[...e,15]}drop(e){return[...e,26]}i64_const(e){return[66,...qa(e)]}i32_const(e){return[65,...Ha(e)]}i64_eqz(e){return[...e,80]}i64_eq(e,a){return[...e,...a,81]}i64_ne(e,a){return[...e,...a,82]}i64_lt_s(e,a){return[...e,...a,83]}i64_lt_u(e,a){return[...e,...a,84]}i64_gt_s(e,a){return[...e,...a,85]}i64_gt_u(e,a){return[...e,...a,86]}i64_le_s(e,a){return[...e,...a,87]}i64_le_u(e,a){return[...e,...a,88]}i64_ge_s(e,a){return[...e,...a,89]}i64_ge_u(e,a){return[...e,...a,90]}i64_add(e,a){return[...e,...a,124]}i64_sub(e,a){return[...e,...a,125]}i64_mul(e,a){return[...e,...a,126]}i64_div_s(e,a){return[...e,...a,127]}i64_div_u(e,a){return[...e,...a,128]}i64_rem_s(e,a){return[...e,...a,129]}i64_rem_u(e,a){return[...e,...a,130]}i64_and(e,a){return[...e,...a,131]}i64_or(e,a){return[...e,...a,132]}i64_xor(e,a){return[...e,...a,133]}i64_shl(e,a){return[...e,...a,134]}i64_shr_s(e,a){return[...e,...a,135]}i64_shr_u(e,a){return[...e,...a,136]}i64_extend_i32_s(e){return[...e,172]}i64_extend_i32_u(e){return[...e,173]}i64_clz(e){return[...e,121]}i64_ctz(e){return[...e,122]}i32_eqz(e){return[...e,69]}i32_eq(e,a){return[...e,...a,70]}i32_ne(e,a){return[...e,...a,71]}i32_lt_s(e,a){return[...e,...a,72]}i32_lt_u(e,a){return[...e,...a,73]}i32_gt_s(e,a){return[...e,...a,74]}i32_gt_u(e,a){return[...e,...a,75]}i32_le_s(e,a){return[...e,...a,76]}i32_le_u(e,a){return[...e,...a,77]}i32_ge_s(e,a){return[...e,...a,78]}i32_ge_u(e,a){return[...e,...a,79]}i32_add(e,a){return[...e,...a,106]}i32_sub(e,a){return[...e,...a,107]}i32_mul(e,a){return[...e,...a,108]}i32_div_s(e,a){return[...e,...a,109]}i32_div_u(e,a){return[...e,...a,110]}i32_rem_s(e,a){return[...e,...a,111]}i32_rem_u(e,a){return[...e,...a,112]}i32_and(e,a){return[...e,...a,113]}i32_or(e,a){return[...e,...a,114]}i32_xor(e,a){return[...e,...a,115]}i32_shl(e,a){return[...e,...a,116]}i32_shr_s(e,a){return[...e,...a,117]}i32_shr_u(e,a){return[...e,...a,118]}i32_rotl(e,a){return[...e,...a,119]}i32_rotr(e,a){return[...e,...a,120]}i32_wrap_i64(e){return[...e,167]}i32_clz(e){return[...e,103]}i32_ctz(e){return[...e,104]}unreachable(){return[0]}current_memory(){return[63,0]}comment(){return[]}}const Ka={i32:127,i64:126,f32:125,f64:124,anyfunc:112,func:96,emptyblock:64};class Va{constructor(e,a,t,c,f){if("import"==t)this.fnType="import",this.moduleName=c,this.fieldName=f;else{if("internal"!=t)throw new Error("Invalid function fnType: "+t);this.fnType="internal"}this.module=e,this.fnName=a,this.params=[],this.locals=[],this.localIdxByName={},this.code=[],this.returnType=null,this.nextLocal=0}addParam(e,a){if(this.localIdxByName[e])throw new Error(`param already exists. Function: ${this.fnName}, Param: ${e} `);const t=this.nextLocal++;this.localIdxByName[e]=t,this.params.push({type:a})}addLocal(e,a,t){const c=t||1;if(this.localIdxByName[e])throw new Error(`local already exists. Function: ${this.fnName}, Param: ${e} `);const f=this.nextLocal++;this.localIdxByName[e]=f,this.locals.push({type:a,length:c})}setReturnType(e){if(this.returnType)throw new Error(`returnType already defined. Function: ${this.fnName}`);this.returnType=e}getSignature(){return[96,...$a(this.params.length),...this.params.map((e=>Ka[e.type])),...this.returnType?[1,Ka[this.returnType]]:[0]]}getBody(){const e=this.locals.map((e=>[...$a(e.length),Ka[e.type]])),a=[...$a(this.locals.length),...[].concat(...e),...this.code,11];return[...$a(a.length),...a]}addCode(...e){this.code.push(...[].concat(...e))}getCodeBuilder(){return new Ga(this)}}class Za{constructor(){this.functions=[],this.functionIdxByName={},this.nImportFunctions=0,this.nInternalFunctions=0,this.memory={pagesSize:1,moduleName:"env",fieldName:"memory"},this.free=8,this.datas=[],this.modules={},this.exports=[],this.functionsTable=[]}build(){return this._setSignatures(),new Uint8Array([...Fa(1836278016),...Fa(1),...this._buildType(),...this._buildImport(),...this._buildFunctionDeclarations(),...this._buildFunctionsTable(),...this._buildExports(),...this._buildElements(),...this._buildCode(),...this._buildData()])}addFunction(e){if(void 0!==this.functionIdxByName[e])throw new Error(`Function already defined: ${e}`);const a=this.functions.length;return this.functionIdxByName[e]=a,this.functions.push(new Va(this,e,"internal")),this.nInternalFunctions++,this.functions[a]}addIimportFunction(e,a,t){if(void 0!==this.functionIdxByName[e])throw new Error(`Function already defined: ${e}`);if(this.functions.length>0&&"internal"==this.functions[this.functions.length-1].type)throw new Error(`Import functions must be declared before internal: ${e}`);let c=t||e;const f=this.functions.length;return this.functionIdxByName[e]=f,this.functions.push(new Va(this,e,"import",a,c)),this.nImportFunctions++,this.functions[f]}setMemory(e,a,t){this.memory={pagesSize:e,moduleName:a||"env",fieldName:t||"memory"}}exportFunction(e,a){const t=a||e;if(void 0===this.functionIdxByName[e])throw new Error(`Function not defined: ${e}`);const c=this.functionIdxByName[e];t!=e&&(this.functionIdxByName[t]=c),this.exports.push({exportName:t,idx:c})}addFunctionToTable(e){const a=this.functionIdxByName[e];this.functionsTable.push(a)}addData(e,a){this.datas.push({offset:e,bytes:a})}alloc(e,a){let t,c;(Array.isArray(e)||ArrayBuffer.isView(e))&&void 0===a?(t=e.length,c=e):(t=e,c=a),t=1+(t-1>>3)<<3;const f=this.free;return this.free+=t,c&&this.addData(f,c),f}allocString(e){const a=(new globalThis.TextEncoder).encode(e);return this.alloc([...a,0])}_setSignatures(){this.signatures=[];const e={};if(this.functionsTable.length>0){const a=this.functions[this.functionsTable[0]].getSignature();e["s_"+za(a)]=0,this.signatures.push(a)}for(let a=0;a=0)c=await async function(e,a){if(!e&&globalThis.curve_bn128)return globalThis.curve_bn128;const t=new Za;t.setMemory(25),na(t),a&&a(t);const c={};c.code=t.build(),c.pq=t.modules.f1m.pq,c.pr=t.modules.frm.pq,c.pG1gen=t.modules.bn128.pG1gen,c.pG1zero=t.modules.bn128.pG1zero,c.pG1b=t.modules.bn128.pG1b,c.pG2gen=t.modules.bn128.pG2gen,c.pG2zero=t.modules.bn128.pG2zero,c.pG2b=t.modules.bn128.pG2b,c.pOneT=t.modules.bn128.pOneT,c.prePSize=t.modules.bn128.prePSize,c.preQSize=t.modules.bn128.preQSize,c.n8q=32,c.n8r=32,c.q=t.modules.bn128.q,c.r=t.modules.bn128.r;const f={name:"bn128",wasm:c,q:d("21888242871839275222246405745257275088696311157297823662689037894645226208583"),r:d("21888242871839275222246405745257275088548364400416034343698204186575808495617"),n8q:32,n8r:32,cofactorG2:d("30644e72e131a029b85045b68181585e06ceecda572a2489345f2299c0f9fa8d",16),singleThread:!!e},r=await Ra(f);return r.terminate=async function(){f.singleThread||(globalThis.curve_bn128=null,await this.tm.terminate())},e||(globalThis.curve_bn128=r),r}(a,t);else{if(!(["BLS12381"].indexOf(f)>=0))throw new Error(`Curve not supported: ${e}`);c=await async function(e,a){if(!e&&globalThis.curve_bls12381)return globalThis.curve_bls12381;const t=new Za;t.setMemory(25),ia(t),a&&a(t);const c={};c.code=t.build(),c.pq=t.modules.f1m.pq,c.pr=t.modules.frm.pq,c.pG1gen=t.modules.bls12381.pG1gen,c.pG1zero=t.modules.bls12381.pG1zero,c.pG1b=t.modules.bls12381.pG1b,c.pG2gen=t.modules.bls12381.pG2gen,c.pG2zero=t.modules.bls12381.pG2zero,c.pG2b=t.modules.bls12381.pG2b,c.pOneT=t.modules.bls12381.pOneT,c.prePSize=t.modules.bls12381.prePSize,c.preQSize=t.modules.bls12381.preQSize,c.n8q=48,c.n8r=32,c.q=t.modules.bls12381.q,c.r=t.modules.bls12381.r;const f={name:"bls12381",wasm:c,q:d("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab",16),r:d("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001",16),n8q:48,n8r:32,cofactorG1:d("0x396c8c005555e1568c00aaab0000aaab",16),cofactorG2:d("0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5",16),singleThread:!!e},r=await Ra(f);return r.terminate=async function(){f.singleThread||(globalThis.curve_bls12381=null,await this.tm.terminate())},e||(globalThis.curve_bls12381=r),r}(a,t)}return c}globalThis.curve_bn128=null,globalThis.curve_bls12381=null,d("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001",16),d("21888242871839275222246405745257275088548364400416034343698204186575808495617"),d("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab",16),d("21888242871839275222246405745257275088696311157297823662689037894645226208583");const Wa=B,Ya=ma;class Xa{constructor(e){this.F=e,this.p=Wa.fromString("21888242871839275222246405745257275088548364400416034343698204186575808495617"),this.pm1d2=Wa.div(Wa.sub(this.p,Wa.e(1)),Wa.e(2)),this.Generator=[e.e("995203441582195749578291179787384436505546430278305826713579947235728471134"),e.e("5472060717959818805561601436314318772137091100104008585924551046643952123905")],this.Base8=[e.e("5299619240641551281634865583518297030282874472190772894086521144482721001553"),e.e("16950150798460657717958625567821834550301663161624707787222815936182638968203")],this.order=Wa.fromString("21888242871839275222246405745257275088614511777268538073601725287587578984328"),this.subOrder=Wa.shiftRight(this.order,3),this.A=e.e("168700"),this.D=e.e("168696")}addPoint(e,a){const t=this.F,c=[],f=t.mul(e[0],a[1]),d=t.mul(e[1],a[0]),r=t.mul(t.sub(e[1],t.mul(this.A,e[0])),t.add(a[0],a[1])),n=t.mul(f,d),i=t.mul(this.D,n);return c[0]=t.div(t.add(f,d),t.add(t.one,i)),c[1]=t.div(t.add(r,t.sub(t.mul(this.A,f),d)),t.sub(t.one,i)),c}mulPointEscalar(e,a){const t=this.F;let c=[t.e("0"),t.e("1")],f=a,d=e;for(;!Wa.isZero(f);)Wa.isOdd(f)&&(c=this.addPoint(c,d)),d=this.addPoint(d,d),f=Wa.shiftRight(f,1);return c}inSubgroup(e){const a=this.F;if(!this.inCurve(e))return!1;const t=this.mulPointEscalar(e,this.subOrder);return a.isZero(t[0])&&a.eq(t[1],a.one)}inCurve(e){const a=this.F,t=a.square(e[0]),c=a.square(e[1]);return!!a.eq(a.add(a.mul(this.A,t),c),a.add(a.one,a.mul(a.mul(t,c),this.D)))}packPoint(e){const a=this.F,t=new Uint8Array(32);a.toRprLE(t,0,e[1]);const c=a.toObject(e[0]);return Wa.gt(c,this.pm1d2)&&(t[31]=128|t[31]),t}unpackPoint(e){const a=this.F;let t=!1;const c=new Array(2);if(128&e[31]&&(t=!0,e[31]=127&e[31]),c[1]=a.fromRprLE(e,0),Wa.gt(a.toObject(c[1]),this.p))return null;const f=a.square(c[1]),d=a.div(a.sub(a.one,f),a.sub(this.A,a.mul(this.D,f))),r=a.exp(d,a.half);if(!a.eq(a.one,r))return null;let n=a.sqrt(d);return null==n?null:(t&&(n=a.neg(n)),c[0]=n,c)}}var et=t(72206),at=t(60654),tt=t(62045).hp;async function ct(){const e=await async function(){const e=await Ja("bn128",!0);return new Xa(e.Fr)}();return new ft(e)}class ft{constructor(e){this.babyJub=e,this.bases=[]}baseHash(e,a){return"blake"==e?at("blake256").update(a).digest():"blake2b"==e?tt.from(et(32).update(tt.from(a)).digest()):void 0}hash(e,a){(a=a||{}).baseHash=a.baseHash||"blake";const t=this.babyJub,c=this.buffer2bits(e),f=Math.floor((c.length-1)/200)+1;let d=[t.F.zero,t.F.one];for(let e=0;e>1,a[8*t+2]=(4&c)>>2,a[8*t+3]=(8&c)>>3,a[8*t+4]=(16&c)>>4,a[8*t+5]=(32&c)>>5,a[8*t+6]=(64&c)>>6,a[8*t+7]=(128&c)>>7}return a}}var dt=t(31176),rt=t.n(dt);let nt=!1,it=!1;const bt={debug:1,default:2,info:2,warning:3,error:4,off:5};let ot=bt.default,st=null;const lt=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((a=>{try{if("test"!=="test".normalize(a))throw new Error("bad normalize")}catch(t){e.push(a)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var ut,ht;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(ut||(ut={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(ht||(ht={}));const pt="0123456789abcdef";class gt{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,a){const t=e.toLowerCase();null==bt[t]&&this.throwArgumentError("invalid log level name","logLevel",e),ot>bt[t]||console.log.apply(console,a)}debug(...e){this._log(gt.levels.DEBUG,e)}info(...e){this._log(gt.levels.INFO,e)}warn(...e){this._log(gt.levels.WARNING,e)}makeError(e,a,t){if(it)return this.makeError("censored error",a,{});a||(a=gt.errors.UNKNOWN_ERROR),t||(t={});const c=[];Object.keys(t).forEach((e=>{const a=t[e];try{if(a instanceof Uint8Array){let t="";for(let e=0;e>4],t+=pt[15&a[e]];c.push(e+"=Uint8Array(0x"+t+")")}else c.push(e+"="+JSON.stringify(a))}catch(a){c.push(e+"="+JSON.stringify(t[e].toString()))}})),c.push(`code=${a}`),c.push(`version=${this.version}`);const f=e;let d="";switch(a){case ht.NUMERIC_FAULT:{d="NUMERIC_FAULT";const a=e;switch(a){case"overflow":case"underflow":case"division-by-zero":d+="-"+a;break;case"negative-power":case"negative-width":d+="-unsupported";break;case"unbound-bitwise-result":d+="-unbound-result"}break}case ht.CALL_EXCEPTION:case ht.INSUFFICIENT_FUNDS:case ht.MISSING_NEW:case ht.NONCE_EXPIRED:case ht.REPLACEMENT_UNDERPRICED:case ht.TRANSACTION_REPLACED:case ht.UNPREDICTABLE_GAS_LIMIT:d=a}d&&(e+=" [ See: https://links.ethers.org/v5-errors-"+d+" ]"),c.length&&(e+=" ("+c.join(", ")+")");const r=new Error(e);return r.reason=f,r.code=a,Object.keys(t).forEach((function(e){r[e]=t[e]})),r}throwError(e,a,t){throw this.makeError(e,a,t)}throwArgumentError(e,a,t){return this.throwError(e,gt.errors.INVALID_ARGUMENT,{argument:a,value:t})}assert(e,a,t,c){e||this.throwError(a,t,c)}assertArgument(e,a,t,c){e||this.throwArgumentError(a,t,c)}checkNormalize(e){null==e&&(e="platform missing String.prototype.normalize"),lt&&this.throwError("platform missing String.prototype.normalize",gt.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:lt})}checkSafeUint53(e,a){"number"==typeof e&&(null==a&&(a="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(a,gt.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(a,gt.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,a,t){t=t?": "+t:"",ea&&this.throwError("too many arguments"+t,gt.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:a})}checkNew(e,a){e!==Object&&null!=e||this.throwError("missing new",gt.errors.MISSING_NEW,{name:a.name})}checkAbstract(e,a){e===a?this.throwError("cannot instantiate abstract class "+JSON.stringify(a.name)+" directly; use a sub-class",gt.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",gt.errors.MISSING_NEW,{name:a.name})}static globalLogger(){return st||(st=new gt("logger/5.7.0")),st}static setCensorship(e,a){if(!e&&a&&this.globalLogger().throwError("cannot permanently disable censorship",gt.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),nt){if(!e)return;this.globalLogger().throwError("error censorship permanent",gt.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}it=!!e,nt=!!a}static setLogLevel(e){const a=bt[e.toLowerCase()];null!=a?ot=a:gt.globalLogger().warn("invalid log level - "+e)}static from(e){return new gt(e)}}gt.errors=ht,gt.levels=ut;const mt=new gt("bytes/5.7.0");function xt(e){return e.slice||(e.slice=function(){const a=Array.prototype.slice.call(arguments);return xt(new Uint8Array(Array.prototype.slice.apply(e,a)))}),e}function yt(e){return"number"==typeof e&&e==e&&e%1==0}function At(e,a){if(a||(a={}),"number"==typeof e){mt.checkSafeUint53(e,"invalid arrayify value");const a=[];for(;e;)a.unshift(255&e),e=parseInt(String(e/256));return 0===a.length&&a.push(0),xt(new Uint8Array(a))}if(a.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),function(e){return!!e.toHexString}(e)&&(e=e.toHexString()),function(e,a){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/)||a&&e.length!==2+2*a)}(e)){let t=e.substring(2);t.length%2&&("left"===a.hexPad?t="0"+t:"right"===a.hexPad?t+="0":mt.throwArgumentError("hex data is odd-length","value",e));const c=[];for(let e=0;e=256)return!1}return!0}(e)?xt(new Uint8Array(e)):mt.throwArgumentError("invalid arrayify value","value",e)}function vt(e){return"0x"+rt().keccak_256(At(e))}const wt=new gt("strings/5.7.0");var _t,It;function Et(e,a,t,c,f){if(e===It.BAD_PREFIX||e===It.UNEXPECTED_CONTINUE){let e=0;for(let c=a+1;c>6==2;c++)e++;return e}return e===It.OVERRUN?t.length-a-1:0}function Ct(e,a=_t.current){a!=_t.current&&(wt.checkNormalize(),e=e.normalize(a));let t=[];for(let a=0;a>6|192),t.push(63&c|128);else if(55296==(64512&c)){a++;const f=e.charCodeAt(a);if(a>=e.length||56320!=(64512&f))throw new Error("invalid utf-8 string");const d=65536+((1023&c)<<10)+(1023&f);t.push(d>>18|240),t.push(d>>12&63|128),t.push(d>>6&63|128),t.push(63&d|128)}else t.push(c>>12|224),t.push(c>>6&63|128),t.push(63&c|128)}return At(t)}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(_t||(_t={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(It||(It={})),Object.freeze({error:function(e,a,t,c,f){return wt.throwArgumentError(`invalid codepoint at offset ${a}; ${e}`,"bytes",t)},ignore:Et,replace:function(e,a,t,c,f){return e===It.OVERLONG?(c.push(f),0):(c.push(65533),Et(e,a,t))}});const Mt="mimcsponge";async function Bt(){const e=await Ja("bn128",!0);return new kt(e.Fr)}class kt{constructor(e){this.F=e,this.cts=this.getConstants(Mt,220)}getIV(e){const a=this.F;void 0===e&&(e=Mt);const t=vt(Ct(e+"_iv"));return Wa.e(t).mod(a.p)}getConstants(e,a){const t=this.F;void 0===e&&(e=Mt),void 0===a&&(a=220);const c=new Array(a);let f=vt(Ct(Mt));for(let e=1;e{"use strict";t.d(a,{r:()=>c});const c="6.13.4"},35273:(e,a,t)=>{"use strict";t.d(a,{y:()=>R});var c=t(57339),f=t(21228),d=t(30031),r=t(27033),n=t(19353);class i extends f.Ue{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,a){let t=n.V.dereference(a,"string");try{t=(0,d.b)(t)}catch(e){return this._throwError(e.message,a)}return e.writeValue(t)}decode(e){return(0,d.b)((0,r.up)(e.readValue(),20))}}var b=t(88081);class o extends f.Ue{coder;constructor(e){super(e.name,e.type,"_",e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,a){return this.coder.encode(e,a)}decode(e){return this.coder.decode(e)}}function s(e,a,t){let d=[];if(Array.isArray(t))d=t;else if(t&&"object"==typeof t){let e={};d=a.map((a=>{const f=a.localName;return(0,c.vA)(f,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:a},value:t}),(0,c.vA)(!e[f],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:a},value:t}),e[f]=!0,t[f]}))}else(0,c.MR)(!1,"invalid tuple value","tuple",t);(0,c.MR)(a.length===d.length,"types/value length mismatch","tuple",t);let r=new f.AU,n=new f.AU,i=[];a.forEach(((e,a)=>{let t=d[a];if(e.dynamic){let a=n.length;e.encode(n,t);let c=r.writeUpdatableValue();i.push((e=>{c(e+a)}))}else e.encode(r,t)})),i.forEach((e=>{e(r.length)}));let b=e.appendWriter(r);return b+=e.appendWriter(n),b}function l(e,a){let t=[],d=[],r=e.subReader(0);return a.forEach((a=>{let f=null;if(a.dynamic){let t=e.readIndex(),d=r.subReader(t);try{f=a.decode(d)}catch(e){if((0,c.bJ)(e,"BUFFER_OVERRUN"))throw e;f=e,f.baseType=a.name,f.name=a.localName,f.type=a.type}}else try{f=a.decode(e)}catch(e){if((0,c.bJ)(e,"BUFFER_OVERRUN"))throw e;f=e,f.baseType=a.name,f.name=a.localName,f.type=a.type}if(null==f)throw new Error("investigate");t.push(f),d.push(a.localName||null)})),f.Q7.fromItems(t,d)}class u extends f.Ue{coder;length;constructor(e,a,t){super("array",e.type+"["+(a>=0?a:"")+"]",t,-1===a||e.dynamic),(0,b.n)(this,{coder:e,length:a})}defaultValue(){const e=this.coder.defaultValue(),a=[];for(let t=0;te||t<-(e+w))&&this._throwError("value out-of-bounds",a),t=(0,r.JJ)(t,8*f.Yx)}else(t(0,r.dK)(c,8*this.size))&&this._throwError("value out-of-bounds",a);return e.writeValue(t)}decode(e){let a=(0,r.dK)(e.readValue(),8*this.size);return this.signed&&(a=(0,r.ST)(a,8*this.size)),a}}var E=t(87303);class C extends g{constructor(e){super("string",e)}defaultValue(){return""}encode(e,a){return super.encode(e,(0,E.YW)(n.V.dereference(a,"string")))}decode(e){return(0,E._v)(super.decode(e))}}class M extends f.Ue{coders;constructor(e,a){let t=!1;const c=[];e.forEach((e=>{e.dynamic&&(t=!0),c.push(e.type)})),super("tuple","tuple("+c.join(",")+")",a,t),(0,b.n)(this,{coders:Object.freeze(e.slice())})}defaultValue(){const e=[];this.coders.forEach((a=>{e.push(a.defaultValue())}));const a=this.coders.reduce(((e,a)=>{const t=a.localName;return t&&(e[t]||(e[t]=0),e[t]++),e}),{});return this.coders.forEach(((t,c)=>{let f=t.localName;f&&1===a[f]&&("length"===f&&(f="_length"),null==e[f]&&(e[f]=e[c]))})),Object.freeze(e)}encode(e,a){const t=n.V.dereference(a,"tuple");return s(e,this.coders,t)}decode(e){return l(e,this.coders)}}var B=t(76124);const k=new Map;k.set(0,"GENERIC_PANIC"),k.set(1,"ASSERT_FALSE"),k.set(17,"OVERFLOW"),k.set(18,"DIVIDE_BY_ZERO"),k.set(33,"ENUM_RANGE_ERROR"),k.set(34,"BAD_STORAGE_DATA"),k.set(49,"STACK_UNDERFLOW"),k.set(50,"ARRAY_RANGE_ERROR"),k.set(65,"OUT_OF_MEMORY"),k.set(81,"UNINITIALIZED_FUNCTION_CALL");const L=new RegExp(/^bytes([0-9]*)$/),S=new RegExp(/^(u?int)([0-9]*)$/);let T=null,N=1024;class R{#te(e){if(e.isArray())return new u(this.#te(e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new M(e.components.map((e=>this.#te(e))),e.name);switch(e.baseType){case"address":return new i(e.name);case"bool":return new h(e.name);case"string":return new C(e.name);case"bytes":return new m(e.name);case"":return new A(e.name)}let a=e.type.match(S);if(a){let t=parseInt(a[2]||"256");return(0,c.MR)(0!==t&&t<=256&&t%8==0,"invalid "+a[1]+" bit length","param",e),new I(t/8,"int"===a[1],e.name)}if(a=e.type.match(L),a){let t=parseInt(a[1]);return(0,c.MR)(0!==t&&t<=32,"invalid bytes length","param",e),new x(t,e.name)}(0,c.MR)(!1,"invalid type","type",e.type)}getDefaultValue(e){const a=e.map((e=>this.#te(B.aX.from(e))));return new M(a,"_").defaultValue()}encode(e,a){(0,c.dd)(a.length,e.length,"types/values length mismatch");const t=e.map((e=>this.#te(B.aX.from(e)))),d=new M(t,"_"),r=new f.AU;return d.encode(r,a),r.data}decode(e,a,t){const c=e.map((e=>this.#te(B.aX.from(e))));return new M(c,"_").decode(new f.mP(a,t,N))}static _setDefaultMaxInflation(e){(0,c.MR)("number"==typeof e&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),N=e}static defaultAbiCoder(){return null==T&&(T=new R),T}static getBuiltinCallException(e,a,t){return function(e,a,t,f){let r="missing revert data",n=null,i=null;if(t){r="execution reverted";const e=(0,p.q5)(t);if(t=(0,p.c$)(t),0===e.length)r+=" (no data present; likely require(false) occurred",n="require(false)";else if(e.length%32!=4)r+=" (could not decode reason; invalid data length)";else if("0x08c379a0"===(0,p.c$)(e.slice(0,4)))try{n=f.decode(["string"],e.slice(4))[0],i={signature:"Error(string)",name:"Error",args:[n]},r+=`: ${JSON.stringify(n)}`}catch(e){r+=" (could not decode reason; invalid string data)"}else if("0x4e487b71"===(0,p.c$)(e.slice(0,4)))try{const a=Number(f.decode(["uint256"],e.slice(4))[0]);i={signature:"Panic(uint256)",name:"Panic",args:[a]},n=`Panic due to ${k.get(a)||"UNKNOWN"}(${a})`,r+=`: ${n}`}catch(e){r+=" (could not decode panic code)"}else r+=" (unknown custom error)"}const b={to:a.to?(0,d.b)(a.to):null,data:a.data||"0x"};return a.from&&(b.from=(0,d.b)(a.from)),(0,c.xz)(r,"CALL_EXCEPTION",{action:e,data:t,reason:n,transaction:b,invocation:null,revert:i})}(e,a,t,R.defaultAbiCoder())}}},21228:(e,a,t)=>{"use strict";t.d(a,{AU:()=>y,Q7:()=>g,Ue:()=>x,Yx:()=>n,mP:()=>A});var c=t(27033),f=t(57339),d=t(36212),r=t(88081);const n=32,i=new Uint8Array(n),b=["then"],o={},s=new WeakMap;function l(e){return s.get(e)}function u(e,a){s.set(e,a)}function h(e,a){const t=new Error(`deferred error during ABI decoding triggered accessing ${e}`);throw t.error=a,t}function p(e,a,t){return e.indexOf(null)>=0?a.map(((e,a)=>e instanceof g?p(l(e),e,t):e)):e.reduce(((e,c,f)=>{let d=a.getValue(c);return c in e||(t&&d instanceof g&&(d=p(l(d),d,t)),e[c]=d),e}),{})}class g extends Array{#ce;constructor(...e){const a=e[0];let t=e[1],f=(e[2]||[]).slice(),d=!0;a!==o&&(t=e,f=[],d=!1),super(t.length),t.forEach(((e,a)=>{this[a]=e}));const r=f.reduce(((e,a)=>("string"==typeof a&&e.set(a,(e.get(a)||0)+1),e)),new Map);if(u(this,Object.freeze(t.map(((e,a)=>{const t=f[a];return null!=t&&1===r.get(t)?t:null})))),this.#ce=[],null==this.#ce&&this.#ce,!d)return;Object.freeze(this);const n=new Proxy(this,{get:(e,a,t)=>{if("string"==typeof a){if(a.match(/^[0-9]+$/)){const t=(0,c.WZ)(a,"%index");if(t<0||t>=this.length)throw new RangeError("out of result range");const f=e[t];return f instanceof Error&&h(`index ${t}`,f),f}if(b.indexOf(a)>=0)return Reflect.get(e,a,t);const f=e[a];if(f instanceof Function)return function(...a){return f.apply(this===t?e:this,a)};if(!(a in e))return e.getValue.apply(this===t?e:this,[a])}return Reflect.get(e,a,t)}});return u(n,l(this)),n}toArray(e){const a=[];return this.forEach(((t,c)=>{t instanceof Error&&h(`index ${c}`,t),e&&t instanceof g&&(t=t.toArray(e)),a.push(t)})),a}toObject(e){const a=l(this);return a.reduce(((t,c,d)=>((0,f.vA)(null!=c,`value at index ${d} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),p(a,this,e))),{})}slice(e,a){null==e&&(e=0),e<0&&(e+=this.length)<0&&(e=0),null==a&&(a=this.length),a<0&&(a+=this.length)<0&&(a=0),a>this.length&&(a=this.length);const t=l(this),c=[],f=[];for(let d=e;d{this.#V[e]=m(a)}}}class A{allowLoose;#V;#re;#ne;#ie;#be;constructor(e,a,t){(0,r.n)(this,{allowLoose:!!a}),this.#V=(0,d.Lm)(e),this.#ne=0,this.#ie=null,this.#be=null!=t?t:1024,this.#re=0}get data(){return(0,d.c$)(this.#V)}get dataLength(){return this.#V.length}get consumed(){return this.#re}get bytes(){return new Uint8Array(this.#V)}#oe(e){if(this.#ie)return this.#ie.#oe(e);this.#ne+=e,(0,f.vA)(this.#be<1||this.#ne<=this.#be*this.dataLength,`compressed ABI data exceeds inflation ratio of ${this.#be} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:(0,d.Lm)(this.#V),offset:this.#re,length:e,info:{bytesRead:this.#ne,dataLength:this.dataLength}})}#se(e,a,t){let c=Math.ceil(a/n)*n;return this.#re+c>this.#V.length&&(this.allowLoose&&t&&this.#re+a<=this.#V.length?c=a:(0,f.vA)(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:(0,d.Lm)(this.#V),length:this.#V.length,offset:this.#re+c})),this.#V.slice(this.#re,this.#re+c)}subReader(e){const a=new A(this.#V.slice(this.#re+e),this.allowLoose,this.#be);return a.#ie=this,a}readBytes(e,a){let t=this.#se(0,e,!!a);return this.#oe(e),this.#re+=t.length,t.slice(0,e)}readValue(){return(0,c.Dg)(this.readBytes(n))}readIndex(){return(0,c.Ro)(this.readBytes(n))}}},76124:(e,a,t)=>{"use strict";t.d(a,{FK:()=>q,Pw:()=>V,Zp:()=>K,aX:()=>H,bp:()=>G,hc:()=>J});var c=t(27033),f=t(57339),d=t(88081),r=t(38264);function n(e){const a=new Set;return e.forEach((e=>a.add(e))),Object.freeze(a)}const i=n("external public payable override".split(" ")),b="constant external internal payable private public pure view override",o=n(b.split(" ")),s="constructor error event fallback function receive struct",l=n(s.split(" ")),u="calldata memory storage payable indexed",h=n(u.split(" ")),p=n([s,u,"tuple returns",b].join(" ").split(" ")),g={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},m=new RegExp("^(\\s*)"),x=new RegExp("^([0-9]+)"),y=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),A=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),v=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");class w{#re;#le;get offset(){return this.#re}get length(){return this.#le.length-this.#re}constructor(e){this.#re=0,this.#le=e.slice()}clone(){return new w(this.#le)}reset(){this.#re=0}#ue(e=0,a=0){return new w(this.#le.slice(e,a).map((a=>Object.freeze(Object.assign({},a,{match:a.match-e,linkBack:a.linkBack-e,linkNext:a.linkNext-e})))))}popKeyword(e){const a=this.peek();if("KEYWORD"!==a.type||!e.has(a.text))throw new Error(`expected keyword ${a.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const a=this.peek();throw new Error(`expected ${e}; got ${a.type} ${JSON.stringify(a.text)}`)}return this.pop().text}popParen(){const e=this.peek();if("OPEN_PAREN"!==e.type)throw new Error("bad start");const a=this.#ue(this.#re+1,e.match+1);return this.#re=e.match+1,a}popParams(){const e=this.peek();if("OPEN_PAREN"!==e.type)throw new Error("bad start");const a=[];for(;this.#re=this.#le.length)throw new Error("out-of-bounds");return this.#le[this.#re]}peekKeyword(e){const a=this.peekType("KEYWORD");return null!=a&&e.has(a)?a:null}peekType(e){if(0===this.length)return null;const a=this.peek();return a.type===e?a.text:null}pop(){const e=this.peek();return this.#re++,e}toString(){const e=[];for(let a=this.#re;a`}}function _(e){const a=[],t=a=>{const t=r0&&"NUMBER"===a[a.length-1].type){const t=a.pop().text;e=t+e,a[a.length-1].value=(0,c.WZ)(t)}if(0===a.length||"BRACKET"!==a[a.length-1].type)throw new Error("missing opening bracket");a[a.length-1].text+=e}}else if(i=n.match(y),i){if(b.text=i[1],r+=b.text.length,p.has(b.text)){b.type="KEYWORD";continue}if(b.text.match(v)){b.type="TYPE";continue}b.type="ID"}else{if(i=n.match(x),!i)throw new Error(`unexpected token ${JSON.stringify(n[0])} at position ${r}`);b.text=i[1],b.type="NUMBER",r+=b.text.length}}return new w(a.map((e=>Object.freeze(e))))}function I(e,a){let t=[];for(const c in a.keys())e.has(c)&&t.push(c);if(t.length>1)throw new Error(`conflicting types: ${t.join(", ")}`)}function E(e,a){if(a.peekKeyword(l)){const t=a.pop().text;if(t!==e)throw new Error(`expected ${e}, got ${t}`)}return a.popType("ID")}function C(e,a){const t=new Set;for(;;){const c=e.peekType("KEYWORD");if(null==c||a&&!a.has(c))break;if(e.pop(),t.has(c))throw new Error(`duplicate keywords: ${JSON.stringify(c)}`);t.add(c)}return Object.freeze(t)}function M(e){let a=C(e,o);return I(a,n("constant payable nonpayable".split(" "))),I(a,n("pure view payable nonpayable".split(" "))),a.has("view")?"view":a.has("pure")?"pure":a.has("payable")?"payable":a.has("nonpayable")?"nonpayable":a.has("constant")?"view":"nonpayable"}function B(e,a){return e.popParams().map((e=>H.from(e,a)))}function k(e){if(e.peekType("AT")){if(e.pop(),e.peekType("NUMBER"))return(0,c.Ab)(e.pop().text);throw new Error("invalid gas")}return null}function L(e){if(e.length)throw new Error(`unexpected tokens at offset ${e.offset}: ${e.toString()}`)}const S=new RegExp(/^(.*)\[([0-9]*)\]$/);function T(e){const a=e.match(v);if((0,f.MR)(a,"invalid type","type",e),"uint"===e)return"uint256";if("int"===e)return"int256";if(a[2]){const t=parseInt(a[2]);(0,f.MR)(0!==t&&t<=32,"invalid bytes length","type",e)}else if(a[3]){const t=parseInt(a[3]);(0,f.MR)(0!==t&&t<=256&&t%8==0,"invalid numeric width","type",e)}return e}const N={},R=Symbol.for("_ethers_internal"),P="_ParamTypeInternal",D="_ErrorInternal",O="_EventInternal",F="_ConstructorInternal",Q="_FallbackInternal",U="_FunctionInternal",j="_StructInternal";class H{name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(e,a,t,c,r,n,i,b){if((0,f.gk)(e,N,"ParamType"),Object.defineProperty(this,R,{value:P}),n&&(n=Object.freeze(n.slice())),"array"===c){if(null==i||null==b)throw new Error("")}else if(null!=i||null!=b)throw new Error("");if("tuple"===c){if(null==n)throw new Error("")}else if(null!=n)throw new Error("");(0,d.n)(this,{name:a,type:t,baseType:c,indexed:r,components:n,arrayLength:i,arrayChildren:b})}format(e){if(null==e&&(e="sighash"),"json"===e){const a=this.name||"";if(this.isArray()){const e=JSON.parse(this.arrayChildren.format("json"));return e.name=a,e.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(e)}const t={type:"tuple"===this.baseType?"tuple":this.type,name:a};return"boolean"==typeof this.indexed&&(t.indexed=this.indexed),this.isTuple()&&(t.components=this.components.map((a=>JSON.parse(a.format(e))))),JSON.stringify(t)}let a="";return this.isArray()?(a+=this.arrayChildren.format(e),a+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?a+="("+this.components.map((a=>a.format(e))).join("full"===e?", ":",")+")":a+=this.type,"sighash"!==e&&(!0===this.indexed&&(a+=" indexed"),"full"===e&&this.name&&(a+=" "+this.name)),a}isArray(){return"array"===this.baseType}isTuple(){return"tuple"===this.baseType}isIndexable(){return null!=this.indexed}walk(e,a){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(-1!==this.arrayLength&&e.length!==this.arrayLength)throw new Error("array is wrong length");const t=this;return e.map((e=>t.arrayChildren.walk(e,a)))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const t=this;return e.map(((e,c)=>t.components[c].walk(e,a)))}return a(this.type,e)}#he(e,a,t,c){if(this.isArray()){if(!Array.isArray(a))throw new Error("invalid array value");if(-1!==this.arrayLength&&a.length!==this.arrayLength)throw new Error("array is wrong length");const f=this.arrayChildren,d=a.slice();return d.forEach(((a,c)=>{f.#he(e,a,t,(e=>{d[c]=e}))})),void c(d)}if(this.isTuple()){const f=this.components;let d;if(Array.isArray(a))d=a.slice();else{if(null==a||"object"!=typeof a)throw new Error("invalid tuple value");d=f.map((e=>{if(!e.name)throw new Error("cannot use object value with unnamed components");if(!(e.name in a))throw new Error(`missing value for component ${e.name}`);return a[e.name]}))}if(d.length!==this.components.length)throw new Error("array is wrong length");return d.forEach(((a,c)=>{f[c].#he(e,a,t,(e=>{d[c]=e}))})),void c(d)}const f=t(this.type,a);f.then?e.push(async function(){c(await f)}()):c(f)}async walkAsync(e,a){const t=[],c=[e];return this.#he(t,e,a,(e=>{c[0]=e})),t.length&&await Promise.all(t),c[0]}static from(e,a){if(H.isParamType(e))return e;if("string"==typeof e)try{return H.from(_(e),a)}catch(a){(0,f.MR)(!1,"invalid param type","obj",e)}else if(e instanceof w){let t="",c="",f=null;C(e,n(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(c="tuple",f=e.popParams().map((e=>H.from(e))),t=`tuple(${f.map((e=>e.format())).join(",")})`):(t=T(e.popType("TYPE")),c=t);let d=null,r=null;for(;e.length&&e.peekType("BRACKET");){const a=e.pop();d=new H(N,"",t,c,null,f,r,d),r=a.value,t+=a.text,c="array",f=null}let i=null;if(C(e,h).has("indexed")){if(!a)throw new Error("");i=!0}const b=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new H(N,b,t,c,i,f,r,d)}const t=e.name;(0,f.MR)(!t||"string"==typeof t&&t.match(A),"invalid name","obj.name",t);let c=e.indexed;null!=c&&((0,f.MR)(a,"parameter cannot be indexed","obj.indexed",e.indexed),c=!!c);let d=e.type,r=d.match(S);if(r){const a=parseInt(r[2]||"-1"),f=H.from({type:r[1],components:e.components});return new H(N,t||"",d,"array",c,null,a,f)}if("tuple"===d||d.startsWith("tuple(")||d.startsWith("(")){const a=null!=e.components?e.components.map((e=>H.from(e))):null;return new H(N,t||"",d,"tuple",c,a,null,null)}return d=T(e.type),new H(N,t||"",d,d,c,null,null,null)}static isParamType(e){return e&&e[R]===P}}class q{type;inputs;constructor(e,a,t){(0,f.gk)(e,N,"Fragment"),t=Object.freeze(t.slice()),(0,d.n)(this,{type:a,inputs:t})}static from(e){if("string"==typeof e){try{q.from(JSON.parse(e))}catch(e){}return q.from(_(e))}if(e instanceof w)switch(e.peekKeyword(l)){case"constructor":return V.from(e);case"error":return G.from(e);case"event":return K.from(e);case"fallback":case"receive":return Z.from(e);case"function":return J.from(e);case"struct":return W.from(e)}else if("object"==typeof e){switch(e.type){case"constructor":return V.from(e);case"error":return G.from(e);case"event":return K.from(e);case"fallback":case"receive":return Z.from(e);case"function":return J.from(e);case"struct":return W.from(e)}(0,f.vA)(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}(0,f.MR)(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return V.isFragment(e)}static isError(e){return G.isFragment(e)}static isEvent(e){return K.isFragment(e)}static isFunction(e){return J.isFragment(e)}static isStruct(e){return W.isFragment(e)}}class $ extends q{name;constructor(e,a,t,c){super(e,a,c),(0,f.MR)("string"==typeof t&&t.match(A),"invalid identifier","name",t),c=Object.freeze(c.slice()),(0,d.n)(this,{name:t})}}function z(e,a){return"("+a.map((a=>a.format(e))).join("full"===e?", ":",")+")"}class G extends ${constructor(e,a,t){super(e,"error",a,t),Object.defineProperty(this,R,{value:D})}get selector(){return(0,r.id)(this.format("sighash")).substring(0,10)}format(e){if(null==e&&(e="sighash"),"json"===e)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((a=>JSON.parse(a.format(e))))});const a=[];return"sighash"!==e&&a.push("error"),a.push(this.name+z(e,this.inputs)),a.join(" ")}static from(e){if(G.isFragment(e))return e;if("string"==typeof e)return G.from(_(e));if(e instanceof w){const a=E("error",e),t=B(e);return L(e),new G(N,a,t)}return new G(N,e.name,e.inputs?e.inputs.map(H.from):[])}static isFragment(e){return e&&e[R]===D}}class K extends ${anonymous;constructor(e,a,t,c){super(e,"event",a,t),Object.defineProperty(this,R,{value:O}),(0,d.n)(this,{anonymous:c})}get topicHash(){return(0,r.id)(this.format("sighash"))}format(e){if(null==e&&(e="sighash"),"json"===e)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((a=>JSON.parse(a.format(e))))});const a=[];return"sighash"!==e&&a.push("event"),a.push(this.name+z(e,this.inputs)),"sighash"!==e&&this.anonymous&&a.push("anonymous"),a.join(" ")}static getTopicHash(e,a){return a=(a||[]).map((e=>H.from(e))),new K(N,e,a,!1).topicHash}static from(e){if(K.isFragment(e))return e;if("string"==typeof e)try{return K.from(_(e))}catch(a){(0,f.MR)(!1,"invalid event fragment","obj",e)}else if(e instanceof w){const a=E("event",e),t=B(e,!0),c=!!C(e,n(["anonymous"])).has("anonymous");return L(e),new K(N,a,t,c)}return new K(N,e.name,e.inputs?e.inputs.map((e=>H.from(e,!0))):[],!!e.anonymous)}static isFragment(e){return e&&e[R]===O}}class V extends q{payable;gas;constructor(e,a,t,c,f){super(e,a,t),Object.defineProperty(this,R,{value:F}),(0,d.n)(this,{payable:c,gas:f})}format(e){if((0,f.vA)(null!=e&&"sighash"!==e,"cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),"json"===e)return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:null!=this.gas?this.gas:void 0,inputs:this.inputs.map((a=>JSON.parse(a.format(e))))});const a=[`constructor${z(e,this.inputs)}`];return this.payable&&a.push("payable"),null!=this.gas&&a.push(`@${this.gas.toString()}`),a.join(" ")}static from(e){if(V.isFragment(e))return e;if("string"==typeof e)try{return V.from(_(e))}catch(a){(0,f.MR)(!1,"invalid constuctor fragment","obj",e)}else if(e instanceof w){C(e,n(["constructor"]));const a=B(e),t=!!C(e,i).has("payable"),c=k(e);return L(e),new V(N,"constructor",a,t,c)}return new V(N,"constructor",e.inputs?e.inputs.map(H.from):[],!!e.payable,null!=e.gas?e.gas:null)}static isFragment(e){return e&&e[R]===F}}class Z extends q{payable;constructor(e,a,t){super(e,"fallback",a),Object.defineProperty(this,R,{value:Q}),(0,d.n)(this,{payable:t})}format(e){const a=0===this.inputs.length?"receive":"fallback";if("json"===e){const e=this.payable?"payable":"nonpayable";return JSON.stringify({type:a,stateMutability:e})}return`${a}()${this.payable?" payable":""}`}static from(e){if(Z.isFragment(e))return e;if("string"==typeof e)try{return Z.from(_(e))}catch(a){(0,f.MR)(!1,"invalid fallback fragment","obj",e)}else if(e instanceof w){const a=e.toString(),t=e.peekKeyword(n(["fallback","receive"]));if((0,f.MR)(t,"type must be fallback or receive","obj",a),"receive"===e.popKeyword(n(["fallback","receive"]))){const a=B(e);return(0,f.MR)(0===a.length,"receive cannot have arguments","obj.inputs",a),C(e,n(["payable"])),L(e),new Z(N,[],!0)}let c=B(e);c.length?(0,f.MR)(1===c.length&&"bytes"===c[0].type,"invalid fallback inputs","obj.inputs",c.map((e=>e.format("minimal"))).join(", ")):c=[H.from("bytes")];const d=M(e);if((0,f.MR)("nonpayable"===d||"payable"===d,"fallback cannot be constants","obj.stateMutability",d),C(e,n(["returns"])).has("returns")){const a=B(e);(0,f.MR)(1===a.length&&"bytes"===a[0].type,"invalid fallback outputs","obj.outputs",a.map((e=>e.format("minimal"))).join(", "))}return L(e),new Z(N,c,"payable"===d)}if("receive"===e.type)return new Z(N,[],!0);if("fallback"===e.type){const a=[H.from("bytes")],t="payable"===e.stateMutability;return new Z(N,a,t)}(0,f.MR)(!1,"invalid fallback description","obj",e)}static isFragment(e){return e&&e[R]===Q}}class J extends ${constant;outputs;stateMutability;payable;gas;constructor(e,a,t,c,f,r){super(e,"function",a,c),Object.defineProperty(this,R,{value:U}),f=Object.freeze(f.slice());const n="view"===t||"pure"===t,i="payable"===t;(0,d.n)(this,{constant:n,gas:r,outputs:f,payable:i,stateMutability:t})}get selector(){return(0,r.id)(this.format("sighash")).substring(0,10)}format(e){if(null==e&&(e="sighash"),"json"===e)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:null!=this.gas?this.gas:void 0,inputs:this.inputs.map((a=>JSON.parse(a.format(e)))),outputs:this.outputs.map((a=>JSON.parse(a.format(e))))});const a=[];return"sighash"!==e&&a.push("function"),a.push(this.name+z(e,this.inputs)),"sighash"!==e&&("nonpayable"!==this.stateMutability&&a.push(this.stateMutability),this.outputs&&this.outputs.length&&(a.push("returns"),a.push(z(e,this.outputs))),null!=this.gas&&a.push(`@${this.gas.toString()}`)),a.join(" ")}static getSelector(e,a){return a=(a||[]).map((e=>H.from(e))),new J(N,e,"view",a,[],null).selector}static from(e){if(J.isFragment(e))return e;if("string"==typeof e)try{return J.from(_(e))}catch(a){(0,f.MR)(!1,"invalid function fragment","obj",e)}else if(e instanceof w){const a=E("function",e),t=B(e),c=M(e);let f=[];C(e,n(["returns"])).has("returns")&&(f=B(e));const d=k(e);return L(e),new J(N,a,c,t,f,d)}let a=e.stateMutability;return null==a&&(a="payable","boolean"==typeof e.constant?(a="view",e.constant||(a="payable","boolean"!=typeof e.payable||e.payable||(a="nonpayable"))):"boolean"!=typeof e.payable||e.payable||(a="nonpayable")),new J(N,e.name,a,e.inputs?e.inputs.map(H.from):[],e.outputs?e.outputs.map(H.from):[],null!=e.gas?e.gas:null)}static isFragment(e){return e&&e[R]===U}}class W extends ${constructor(e,a,t){super(e,"struct",a,t),Object.defineProperty(this,R,{value:j})}format(){throw new Error("@TODO")}static from(e){if("string"==typeof e)try{return W.from(_(e))}catch(a){(0,f.MR)(!1,"invalid struct fragment","obj",e)}else if(e instanceof w){const a=E("struct",e),t=B(e);return L(e),new W(N,a,t)}return new W(N,e.name,e.inputs?e.inputs.map(H.from):[])}static isFragment(e){return e&&e[R]===j}}},73622:(e,a,t)=>{"use strict";t.d(a,{KA:()=>y});var c=t(2011),f=t(38264),d=t(88081),r=t(57339),n=t(36212),i=t(27033),b=t(35273),o=t(21228),s=t(76124),l=t(19353);class u{fragment;name;signature;topic;args;constructor(e,a,t){const c=e.name,f=e.format();(0,d.n)(this,{fragment:e,name:c,signature:f,topic:a,args:t})}}class h{fragment;name;args;signature;selector;value;constructor(e,a,t,c){const f=e.name,r=e.format();(0,d.n)(this,{fragment:e,name:f,args:t,signature:r,selector:a,value:c})}}class p{fragment;name;args;signature;selector;constructor(e,a,t){const c=e.name,f=e.format();(0,d.n)(this,{fragment:e,name:c,args:t,signature:f,selector:a})}}class g{hash;_isIndexed;static isIndexed(e){return!(!e||!e._isIndexed)}constructor(e){(0,d.n)(this,{hash:e,_isIndexed:!0})}}const m={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},x={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:e=>`reverted with reason string ${JSON.stringify(e)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:e=>{let a="unknown panic code";return e>=0&&e<=255&&m[e.toString()]&&(a=m[e.toString()]),`reverted with panic code 0x${e.toString(16)} (${a})`}}};class y{fragments;deploy;fallback;receive;#pe;#ge;#me;#xe;constructor(e){let a=[];a="string"==typeof e?JSON.parse(e):e,this.#me=new Map,this.#pe=new Map,this.#ge=new Map;const t=[];for(const e of a)try{t.push(s.FK.from(e))}catch(a){console.log(`[Warning] Invalid Fragment ${JSON.stringify(e)}:`,a.message)}(0,d.n)(this,{fragments:Object.freeze(t)});let c=null,f=!1;this.#xe=this.getAbiCoder(),this.fragments.forEach(((e,a)=>{let t;switch(e.type){case"constructor":return this.deploy?void console.log("duplicate definition - constructor"):void(0,d.n)(this,{deploy:e});case"fallback":return void(0===e.inputs.length?f=!0:((0,r.MR)(!c||e.payable!==c.payable,"conflicting fallback fragments",`fragments[${a}]`,e),c=e,f=c.payable));case"function":t=this.#me;break;case"event":t=this.#ge;break;case"error":t=this.#pe;break;default:return}const n=e.format();t.has(n)||t.set(n,e)})),this.deploy||(0,d.n)(this,{deploy:s.Pw.from("constructor()")}),(0,d.n)(this,{fallback:c,receive:f})}format(e){const a=e?"minimal":"full";return this.fragments.map((e=>e.format(a)))}formatJson(){const e=this.fragments.map((e=>e.format("json")));return JSON.stringify(e.map((e=>JSON.parse(e))))}getAbiCoder(){return b.y.defaultAbiCoder()}#ye(e,a,t){if((0,n.Lo)(e)){const a=e.toLowerCase();for(const e of this.#me.values())if(a===e.selector)return e;return null}if(-1===e.indexOf("(")){const c=[];for(const[a,t]of this.#me)a.split("(")[0]===e&&c.push(t);if(a){const e=a.length>0?a[a.length-1]:null;let t=a.length,f=!0;l.V.isTyped(e)&&"overrides"===e.type&&(f=!1,t--);for(let e=c.length-1;e>=0;e--){const a=c[e].inputs.length;a===t||f&&a===t-1||c.splice(e,1)}for(let e=c.length-1;e>=0;e--){const t=c[e].inputs;for(let f=0;f=t.length){if("overrides"===a[f].type)continue;c.splice(e,1);break}if(a[f].type!==t[f].baseType){c.splice(e,1);break}}}}if(1===c.length&&a&&a.length!==c[0].inputs.length){const e=a[a.length-1];(null==e||Array.isArray(e)||"object"!=typeof e)&&c.splice(0,1)}if(0===c.length)return null;if(c.length>1&&t){const a=c.map((e=>JSON.stringify(e.format()))).join(", ");(0,r.MR)(!1,`ambiguous function description (i.e. matches ${a})`,"key",e)}return c[0]}return this.#me.get(s.hc.from(e).format())||null}getFunctionName(e){const a=this.#ye(e,null,!1);return(0,r.MR)(a,"no matching function","key",e),a.name}hasFunction(e){return!!this.#ye(e,null,!1)}getFunction(e,a){return this.#ye(e,a||null,!0)}forEachFunction(e){const a=Array.from(this.#me.keys());a.sort(((e,a)=>e.localeCompare(a)));for(let t=0;t=0;e--)c[e].inputs.length=0;e--){const t=c[e].inputs;for(let f=0;f1&&t){const a=c.map((e=>JSON.stringify(e.format()))).join(", ");(0,r.MR)(!1,`ambiguous event description (i.e. matches ${a})`,"key",e)}return c[0]}return this.#ge.get(s.Zp.from(e).format())||null}getEventName(e){const a=this.#Ae(e,null,!1);return(0,r.MR)(a,"no matching event","key",e),a.name}hasEvent(e){return!!this.#Ae(e,null,!1)}getEvent(e,a){return this.#Ae(e,a||null,!0)}forEachEvent(e){const a=Array.from(this.#ge.keys());a.sort(((e,a)=>e.localeCompare(a)));for(let t=0;t1){const t=a.map((e=>JSON.stringify(e.format()))).join(", ");(0,r.MR)(!1,`ambiguous error description (i.e. ${t})`,"name",e)}return a[0]}if("Error(string)"===(e=s.bp.from(e).format()))return s.bp.from("error Error(string)");if("Panic(uint256)"===e)return s.bp.from("error Panic(uint256)");return this.#pe.get(e)||null}forEachError(e){const a=Array.from(this.#pe.keys());a.sort(((e,a)=>e.localeCompare(a)));for(let t=0;t"string"===e.type?(0,f.id)(a):"bytes"===e.type?(0,c.S)((0,n.c$)(a)):("bool"===e.type&&"boolean"==typeof a?a=a?"0x01":"0x00":e.type.match(/^u?int/)?a=(0,i.up)(a):e.type.match(/^bytes/)?a=(0,n.X_)(a,32):"address"===e.type&&this.#xe.encode(["address"],[a]),(0,n.nx)((0,n.c$)(a),32));for(a.forEach(((a,c)=>{const f=e.inputs[c];f.indexed?null==a?t.push(null):"array"===f.baseType||"tuple"===f.baseType?(0,r.MR)(!1,"filtering with tuples or arrays not supported","contract."+f.name,a):Array.isArray(a)?t.push(a.map((e=>d(f,e)))):t.push(d(f,a)):(0,r.MR)(null==a,"cannot filter non-indexed parameters; must be null","contract."+f.name,a)}));t.length&&null===t[t.length-1];)t.pop();return t}encodeEventLog(e,a){if("string"==typeof e){const a=this.getEvent(e);(0,r.MR)(a,"unknown event","eventFragment",e),e=a}const t=[],d=[],n=[];return e.anonymous||t.push(e.topicHash),(0,r.MR)(a.length===e.inputs.length,"event arguments/values mismatch","values",a),e.inputs.forEach(((e,r)=>{const i=a[r];if(e.indexed)if("string"===e.type)t.push((0,f.id)(i));else if("bytes"===e.type)t.push((0,c.S)(i));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");t.push(this.#xe.encode([e.type],[i]))}else d.push(e),n.push(i)})),{data:this.#xe.encode(d,n),topics:t}}decodeEventLog(e,a,t){if("string"==typeof e){const a=this.getEvent(e);(0,r.MR)(a,"unknown event","eventFragment",e),e=a}if(null!=t&&!e.anonymous){const a=e.topicHash;(0,r.MR)((0,n.Lo)(t[0],32)&&t[0].toLowerCase()===a,"fragment/topic mismatch","topics[0]",t[0]),t=t.slice(1)}const c=[],f=[],d=[];e.inputs.forEach(((e,a)=>{e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(c.push(s.aX.from({type:"bytes32",name:e.name})),d.push(!0)):(c.push(e),d.push(!1)):(f.push(e),d.push(!1))}));const i=null!=t?this.#xe.decode(c,(0,n.xW)(t)):null,b=this.#xe.decode(f,a,!0),l=[],u=[];let h=0,p=0;return e.inputs.forEach(((e,a)=>{let t=null;if(e.indexed)if(null==i)t=new g(null);else if(d[a])t=new g(i[p++]);else try{t=i[p++]}catch(e){t=e}else try{t=b[h++]}catch(e){t=e}l.push(t),u.push(e.name||null)})),o.Q7.fromItems(l,u)}parseTransaction(e){const a=(0,n.q5)(e.data,"tx.data"),t=(0,i.Ab)(null!=e.value?e.value:0,"tx.value"),c=this.getFunction((0,n.c$)(a.slice(0,4)));if(!c)return null;const f=this.#xe.decode(c.inputs,a.slice(4));return new h(c,c.selector,f,t)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const a=this.getEvent(e.topics[0]);return!a||a.anonymous?null:new u(a,a.topicHash,this.decodeEventLog(a,e.data,e.topics))}parseError(e){const a=(0,n.c$)(e),t=this.getError((0,n.ZG)(a,0,4));if(!t)return null;const c=this.#xe.decode(t.inputs,(0,n.ZG)(a,4));return new p(t,t.selector,c)}static from(e){return e instanceof y?e:"string"==typeof e?new y(JSON.parse(e)):"function"==typeof e.formatJson?new y(e.formatJson()):"function"==typeof e.format?new y(e.format("json")):new y(e)}}},19353:(e,a,t)=>{"use strict";t.d(a,{V:()=>b});var c=t(57339),f=t(88081);const d={};function r(e,a){let t=!1;return a<0&&(t=!0,a*=-1),new b(d,`${t?"":"u"}int${a}`,e,{signed:t,width:a})}function n(e,a){return new b(d,`bytes${a||""}`,e,{size:a})}const i=Symbol.for("_ethers_typed");class b{type;value;#E;_typedSymbol;constructor(e,a,t,r){null==r&&(r=null),(0,c.gk)(d,e,"Typed"),(0,f.n)(this,{_typedSymbol:i,type:a,value:t}),this.#E=r,this.format()}format(){if("array"===this.type)throw new Error("");if("dynamicArray"===this.type)throw new Error("");return"tuple"===this.type?`tuple(${this.value.map((e=>e.format())).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return"string"===this.type}get tupleName(){if("tuple"!==this.type)throw TypeError("not a tuple");return this.#E}get arrayLength(){if("array"!==this.type)throw TypeError("not an array");return!0===this.#E?-1:!1===this.#E?this.value.length:null}static from(e,a){return new b(d,e,a)}static uint8(e){return r(e,8)}static uint16(e){return r(e,16)}static uint24(e){return r(e,24)}static uint32(e){return r(e,32)}static uint40(e){return r(e,40)}static uint48(e){return r(e,48)}static uint56(e){return r(e,56)}static uint64(e){return r(e,64)}static uint72(e){return r(e,72)}static uint80(e){return r(e,80)}static uint88(e){return r(e,88)}static uint96(e){return r(e,96)}static uint104(e){return r(e,104)}static uint112(e){return r(e,112)}static uint120(e){return r(e,120)}static uint128(e){return r(e,128)}static uint136(e){return r(e,136)}static uint144(e){return r(e,144)}static uint152(e){return r(e,152)}static uint160(e){return r(e,160)}static uint168(e){return r(e,168)}static uint176(e){return r(e,176)}static uint184(e){return r(e,184)}static uint192(e){return r(e,192)}static uint200(e){return r(e,200)}static uint208(e){return r(e,208)}static uint216(e){return r(e,216)}static uint224(e){return r(e,224)}static uint232(e){return r(e,232)}static uint240(e){return r(e,240)}static uint248(e){return r(e,248)}static uint256(e){return r(e,256)}static uint(e){return r(e,256)}static int8(e){return r(e,-8)}static int16(e){return r(e,-16)}static int24(e){return r(e,-24)}static int32(e){return r(e,-32)}static int40(e){return r(e,-40)}static int48(e){return r(e,-48)}static int56(e){return r(e,-56)}static int64(e){return r(e,-64)}static int72(e){return r(e,-72)}static int80(e){return r(e,-80)}static int88(e){return r(e,-88)}static int96(e){return r(e,-96)}static int104(e){return r(e,-104)}static int112(e){return r(e,-112)}static int120(e){return r(e,-120)}static int128(e){return r(e,-128)}static int136(e){return r(e,-136)}static int144(e){return r(e,-144)}static int152(e){return r(e,-152)}static int160(e){return r(e,-160)}static int168(e){return r(e,-168)}static int176(e){return r(e,-176)}static int184(e){return r(e,-184)}static int192(e){return r(e,-192)}static int200(e){return r(e,-200)}static int208(e){return r(e,-208)}static int216(e){return r(e,-216)}static int224(e){return r(e,-224)}static int232(e){return r(e,-232)}static int240(e){return r(e,-240)}static int248(e){return r(e,-248)}static int256(e){return r(e,-256)}static int(e){return r(e,-256)}static bytes1(e){return n(e,1)}static bytes2(e){return n(e,2)}static bytes3(e){return n(e,3)}static bytes4(e){return n(e,4)}static bytes5(e){return n(e,5)}static bytes6(e){return n(e,6)}static bytes7(e){return n(e,7)}static bytes8(e){return n(e,8)}static bytes9(e){return n(e,9)}static bytes10(e){return n(e,10)}static bytes11(e){return n(e,11)}static bytes12(e){return n(e,12)}static bytes13(e){return n(e,13)}static bytes14(e){return n(e,14)}static bytes15(e){return n(e,15)}static bytes16(e){return n(e,16)}static bytes17(e){return n(e,17)}static bytes18(e){return n(e,18)}static bytes19(e){return n(e,19)}static bytes20(e){return n(e,20)}static bytes21(e){return n(e,21)}static bytes22(e){return n(e,22)}static bytes23(e){return n(e,23)}static bytes24(e){return n(e,24)}static bytes25(e){return n(e,25)}static bytes26(e){return n(e,26)}static bytes27(e){return n(e,27)}static bytes28(e){return n(e,28)}static bytes29(e){return n(e,29)}static bytes30(e){return n(e,30)}static bytes31(e){return n(e,31)}static bytes32(e){return n(e,32)}static address(e){return new b(d,"address",e)}static bool(e){return new b(d,"bool",!!e)}static bytes(e){return new b(d,"bytes",e)}static string(e){return new b(d,"string",e)}static array(e,a){throw new Error("not implemented yet")}static tuple(e,a){throw new Error("not implemented yet")}static overrides(e){return new b(d,"overrides",Object.assign({},e))}static isTyped(e){return e&&"object"==typeof e&&"_typedSymbol"in e&&e._typedSymbol===i}static dereference(e,a){if(b.isTyped(e)){if(e.type!==a)throw new Error(`invalid type: expecetd ${a}, got ${e.type}`);return e.value}return e}}},30031:(e,a,t)=>{"use strict";t.d(a,{b:()=>l});var c=t(2011),f=t(36212),d=t(57339);const r=BigInt(0),n=BigInt(36);function i(e){const a=(e=e.toLowerCase()).substring(2).split(""),t=new Uint8Array(40);for(let e=0;e<40;e++)t[e]=a[e].charCodeAt(0);const d=(0,f.q5)((0,c.S)(t));for(let e=0;e<40;e+=2)d[e>>1]>>4>=8&&(a[e]=a[e].toUpperCase()),(15&d[e>>1])>=8&&(a[e+1]=a[e+1].toUpperCase());return"0x"+a.join("")}const b={};for(let e=0;e<10;e++)b[String(e)]=String(e);for(let e=0;e<26;e++)b[String.fromCharCode(65+e)]=String(10+e);const o=15;const s=function(){const e={};for(let a=0;a<36;a++)e["0123456789abcdefghijklmnopqrstuvwxyz"[a]]=BigInt(a);return e}();function l(e){if((0,d.MR)("string"==typeof e,"invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/)){e.startsWith("0x")||(e="0x"+e);const a=i(e);return(0,d.MR)(!e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||a===e,"bad address checksum","address",e),a}if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){(0,d.MR)(e.substring(2,4)===function(e){let a=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((e=>b[e])).join("");for(;a.length>=o;){let e=a.substring(0,o);a=parseInt(e,10)%97+a.substring(e.length)}let t=String(98-parseInt(a,10)%97);for(;t.length<2;)t="0"+t;return t}(e),"bad icap checksum","address",e);let a=function(e){e=e.toLowerCase();let a=r;for(let t=0;t{"use strict";t.d(a,{$C:()=>d,PW:()=>r,tG:()=>i});var c=t(57339),f=t(30031);function d(e){return e&&"function"==typeof e.getAddress}function r(e){try{return(0,f.b)(e),!0}catch(e){}return!1}async function n(e,a){const t=await a;return null!=t&&"0x0000000000000000000000000000000000000000"!==t||((0,c.vA)("string"!=typeof e,"unconfigured name","UNCONFIGURED_NAME",{value:e}),(0,c.MR)(!1,"invalid AddressLike value; did not resolve to a value address","target",e)),(0,f.b)(t)}function i(e,a){return"string"==typeof e?e.match(/^0x[0-9a-f]{40}$/i)?(0,f.b)(e):((0,c.vA)(null!=a,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),n(e,a.resolveName(e))):d(e)?n(e,e.getAddress()):e&&"function"==typeof e.then?n(e,e):void(0,c.MR)(!1,"unsupported addressable value","target",e)}},7040:(e,a,t)=>{"use strict";t.d(a,{t:()=>i});var c=t(2011),f=t(27033),d=t(36212),r=t(65735),n=t(30031);function i(e){const a=(0,n.b)(e.from);let t=(0,f.Ab)(e.nonce,"tx.nonce").toString(16);return t="0"===t?"0x":t.length%2?"0x0"+t:"0x"+t,(0,n.b)((0,d.ZG)((0,c.S)((0,r.R)([a,t])),12))}},98982:(e,a,t)=>{"use strict";t.d(a,{j:()=>c});const c="0x0000000000000000000000000000000000000000"},13269:(e,a,t)=>{"use strict";t.d(a,{FC:()=>v,NZ:()=>R,Uq:()=>N,yN:()=>w});var c=t(19353),f=t(73622),d=t(41442),r=t(43948),n=t(88081),i=t(57339),b=t(27033),o=t(36212),s=t(24359);const l=BigInt(0);function u(e){return e&&"function"==typeof e.call}function h(e){return e&&"function"==typeof e.estimateGas}function p(e){return e&&"function"==typeof e.resolveName}function g(e){return e&&"function"==typeof e.sendTransaction}function m(e){if(null!=e){if(p(e))return e;if(e.provider)return e.provider}}class x{#u;fragment;constructor(e,a,t){if((0,n.n)(this,{fragment:a}),a.inputs.lengthnull==t[a]?null:e.walkAsync(t[a],((e,a)=>"address"===e?Array.isArray(a)?Promise.all(a.map((e=>(0,d.tG)(e,f)))):(0,d.tG)(a,f):a)))));return e.interface.encodeFilterTopics(a,c)}()}getTopicFilter(){return this.#u}}function y(e,a){return null==e?null:"function"==typeof e[a]?e:e.provider&&"function"==typeof e.provider[a]?e.provider:null}function A(e){return null==e?null:e.provider||null}async function v(e,a){const t=c.V.dereference(e,"overrides");(0,i.MR)("object"==typeof t,"invalid overrides parameter","overrides",e);const f=(0,r.VS)(t);return(0,i.MR)(null==f.to||(a||[]).indexOf("to")>=0,"cannot override to","overrides.to",f.to),(0,i.MR)(null==f.data||(a||[]).indexOf("data")>=0,"cannot override data","overrides.data",f.data),f.from&&(f.from=f.from),f}async function w(e,a,t){const f=y(e,"resolveName"),r=p(f)?f:null;return await Promise.all(a.map(((e,a)=>e.walkAsync(t[a],((e,a)=>(a=c.V.dereference(a,e),"address"===e?(0,d.tG)(a,r):a))))))}function _(e){const a=async function(a){const t=await v(a,["data"]);t.to=await e.getAddress(),t.from&&(t.from=await(0,d.tG)(t.from,m(e.runner)));const c=e.interface,f=(0,b.Ab)(t.value||l,"overrides.value")===l,r="0x"===(t.data||"0x");!c.fallback||c.fallback.payable||!c.receive||r||f||(0,i.MR)(!1,"cannot send data to receive or send value to non-payable fallback","overrides",a),(0,i.MR)(c.fallback||r,"cannot send data to receive-only contract","overrides.data",t.data);const n=c.receive||c.fallback&&c.fallback.payable;return(0,i.MR)(n||f,"cannot send value to non-payable fallback","overrides.value",t.value),(0,i.MR)(c.fallback||r,"cannot send data to receive-only contract","overrides.data",t.data),t},t=async function(t){const c=e.runner;(0,i.vA)(g(c),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const f=await c.sendTransaction(await a(t)),d=A(e.runner);return new s.Cn(e.interface,d,f)},c=async e=>await t(e);return(0,n.n)(c,{_contract:e,estimateGas:async function(t){const c=y(e.runner,"estimateGas");return(0,i.vA)(h(c),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await c.estimateGas(await a(t))},populateTransaction:a,send:t,staticCall:async function(t){const c=y(e.runner,"call");(0,i.vA)(u(c),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const f=await a(t);try{return await c.call(f)}catch(a){if((0,i.E)(a)&&a.data)throw e.interface.makeError(a.data,f);throw a}}}),c}const I=Symbol.for("_ethersInternal_contract"),E=new WeakMap;function C(e){return E.get(e[I])}async function M(e,a){let t,c=null;if(Array.isArray(a)){const c=function(a){if((0,o.Lo)(a,32))return a;const t=e.interface.getEvent(a);return(0,i.MR)(t,"unknown fragment","name",a),t.topicHash};t=a.map((e=>null==e?null:Array.isArray(e)?e.map(c):c(e)))}else"*"===a?t=[null]:"string"==typeof a?(0,o.Lo)(a,32)?t=[a]:(c=e.interface.getEvent(a),(0,i.MR)(c,"unknown fragment","event",a),t=[c.topicHash]):(f=a)&&"object"==typeof f&&"getTopicFilter"in f&&"function"==typeof f.getTopicFilter&&f.fragment?t=await a.getTopicFilter():"fragment"in a?(c=a.fragment,t=[c.topicHash]):(0,i.MR)(!1,"unknown event name","event",a);var f;return t=t.map((e=>{if(null==e)return null;if(Array.isArray(e)){const a=Array.from(new Set(e.map((e=>e.toLowerCase()))).values());return 1===a.length?a[0]:(a.sort(),a)}return e.toLowerCase()})),{fragment:c,tag:t.map((e=>null==e?"null":Array.isArray(e)?e.join("|"):e)).join("&"),topics:t}}async function B(e,a){const{subs:t}=C(e);return t.get((await M(e,a)).tag)||null}async function k(e,a,t){const c=A(e.runner);(0,i.vA)(c,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:a});const{fragment:f,tag:d,topics:r}=await M(e,t),{addr:n,subs:b}=C(e);let o=b.get(d);if(!o){const a={address:n||e,topics:r},i=a=>{let c=f;if(null==c)try{c=e.interface.getEvent(a.topics[0])}catch(e){}if(c){const d=c,r=f?e.interface.decodeEventLog(f,a.data,a.topics):[];S(e,t,r,(c=>new s.HZ(e,c,t,d,a)))}else S(e,t,[],(c=>new s._k(e,c,t,a)))};let l=[];o={tag:d,listeners:[],start:()=>{l.length||l.push(c.on(a,i))},stop:async()=>{if(0==l.length)return;let e=l;l=[],await Promise.all(e),c.off(a,i)}},b.set(d,o)}return o}let L=Promise.resolve();async function S(e,a,t,c){try{await L}catch(e){}const f=async function(e,a,t,c){await L;const f=await B(e,a);if(!f)return!1;const d=f.listeners.length;return f.listeners=f.listeners.filter((({listener:a,once:f})=>{const d=Array.from(t);c&&d.push(c(f?null:a));try{a.call(e,...d)}catch(e){}return!f})),0===f.listeners.length&&(f.stop(),C(e).subs.delete(f.tag)),d>0}(e,a,t,c);return L=f,await f}const T=["then"];class N{target;interface;runner;filters;[I];fallback;constructor(e,a,t,c){(0,i.MR)("string"==typeof e||(0,d.$C)(e),"invalid value for Contract target","target",e),null==t&&(t=null);const r=f.KA.from(a);let b;(0,n.n)(this,{target:e,runner:t,interface:r}),Object.defineProperty(this,I,{value:{}});let l=null,u=null;if(c){const e=A(t);u=new s.Cn(this.interface,e,c)}let h=new Map;if("string"==typeof e)if((0,o.Lo)(e))l=e,b=Promise.resolve(e);else{const a=y(t,"resolveName");if(!p(a))throw(0,i.xz)("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});b=a.resolveName(e).then((a=>{if(null==a)throw(0,i.xz)("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return C(this).addr=a,a}))}else b=e.getAddress().then((e=>{if(null==e)throw new Error("TODO");return C(this).addr=e,e}));var g;g={addrPromise:b,addr:l,deployTx:u,subs:h},E.set(this[I],g);const m=new Proxy({},{get:(e,a,t)=>{if("symbol"==typeof a||T.indexOf(a)>=0)return Reflect.get(e,a,t);try{return this.getEvent(a)}catch(e){if(!(0,i.bJ)(e,"INVALID_ARGUMENT")||"key"!==e.argument)throw e}},has:(e,a)=>T.indexOf(a)>=0?Reflect.has(e,a):Reflect.has(e,a)||this.interface.hasEvent(String(a))});return(0,n.n)(this,{filters:m}),(0,n.n)(this,{fallback:r.receive||r.fallback?_(this):null}),new Proxy(this,{get:(e,a,t)=>{if("symbol"==typeof a||a in e||T.indexOf(a)>=0)return Reflect.get(e,a,t);try{return e.getFunction(a)}catch(e){if(!(0,i.bJ)(e,"INVALID_ARGUMENT")||"key"!==e.argument)throw e}},has:(e,a)=>"symbol"==typeof a||a in e||T.indexOf(a)>=0?Reflect.has(e,a):e.interface.hasFunction(a)})}connect(e){return new N(this.target,this.interface,e)}attach(e){return new N(e,this.interface,this.runner)}async getAddress(){return await C(this).addrPromise}async getDeployedCode(){const e=A(this.runner);(0,i.vA)(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const a=await e.getCode(await this.getAddress());return"0x"===a?null:a}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(null!=await this.getDeployedCode())return this;const a=A(this.runner);return(0,i.vA)(null!=a,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise(((e,t)=>{const c=async()=>{try{if(null!=await this.getDeployedCode())return e(this);a.once("block",c)}catch(e){t(e)}};c()}))}deploymentTransaction(){return C(this).deployTx}getFunction(e){"string"!=typeof e&&(e=e.format());const a=function(e,a){const t=function(...t){const c=e.interface.getFunction(a,t);return(0,i.vA)(c,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:a,args:t}}),c},c=async function(...a){const c=t(...a);let f={};if(c.inputs.length+1===a.length&&(f=await v(a.pop()),f.from&&(f.from=await(0,d.tG)(f.from,m(e.runner)))),c.inputs.length!==a.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const r=await w(e.runner,c.inputs,a);return Object.assign({},f,await(0,n.k)({to:e.getAddress(),data:e.interface.encodeFunctionData(c,r)}))},f=async function(...e){const a=await b(...e);return 1===a.length?a[0]:a},r=async function(...a){const t=e.runner;(0,i.vA)(g(t),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const f=await t.sendTransaction(await c(...a)),d=A(e.runner);return new s.Cn(e.interface,d,f)},b=async function(...a){const f=y(e.runner,"call");(0,i.vA)(u(f),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const d=await c(...a);let r="0x";try{r=await f.call(d)}catch(a){if((0,i.E)(a)&&a.data)throw e.interface.makeError(a.data,d);throw a}const n=t(...a);return e.interface.decodeFunctionResult(n,r)},o=async(...e)=>t(...e).constant?await f(...e):await r(...e);return(0,n.n)(o,{name:e.interface.getFunctionName(a),_contract:e,_key:a,getFragment:t,estimateGas:async function(...a){const t=y(e.runner,"estimateGas");return(0,i.vA)(h(t),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await t.estimateGas(await c(...a))},populateTransaction:c,send:r,staticCall:f,staticCallResult:b}),Object.defineProperty(o,"fragment",{configurable:!1,enumerable:!0,get:()=>{const t=e.interface.getFunction(a);return(0,i.vA)(t,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:a}}),t}}),o}(this,e);return a}getEvent(e){return"string"!=typeof e&&(e=e.format()),function(e,a){const t=function(...t){const c=e.interface.getEvent(a,t);return(0,i.vA)(c,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:a,args:t}}),c},c=function(...a){return new x(e,t(...a),a)};return(0,n.n)(c,{name:e.interface.getEventName(a),_contract:e,_key:a,getFragment:t}),Object.defineProperty(c,"fragment",{configurable:!1,enumerable:!0,get:()=>{const t=e.interface.getEvent(a);return(0,i.vA)(t,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:a}}),t}}),c}(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,a,t){null==a&&(a=0),null==t&&(t="latest");const{addr:c,addrPromise:f}=C(this),d=c||await f,{fragment:n,topics:b}=await M(this,e),o={address:d,topics:b,fromBlock:a,toBlock:t},l=A(this.runner);return(0,i.vA)(l,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await l.getLogs(o)).map((e=>{let a=n;if(null==a)try{a=this.interface.getEvent(e.topics[0])}catch(e){}if(a)try{return new s.vu(e,this.interface,a)}catch(a){return new s.AA(e,a)}return new r.tG(e,l)}))}async on(e,a){const t=await k(this,"on",e);return t.listeners.push({listener:a,once:!1}),t.start(),this}async once(e,a){const t=await k(this,"once",e);return t.listeners.push({listener:a,once:!0}),t.start(),this}async emit(e,...a){return await S(this,e,a,null)}async listenerCount(e){if(e){const a=await B(this,e);return a?a.listeners.length:0}const{subs:a}=C(this);let t=0;for(const{listeners:e}of a.values())t+=e.length;return t}async listeners(e){if(e){const a=await B(this,e);return a?a.listeners.map((({listener:e})=>e)):[]}const{subs:a}=C(this);let t=[];for(const{listeners:e}of a.values())t=t.concat(e.map((({listener:e})=>e)));return t}async off(e,a){const t=await B(this,e);if(!t)return this;if(a){const e=t.listeners.map((({listener:e})=>e)).indexOf(a);e>=0&&t.listeners.splice(e,1)}return null!=a&&0!==t.listeners.length||(t.stop(),C(this).subs.delete(t.tag)),this}async removeAllListeners(e){if(e){const a=await B(this,e);if(!a)return this;a.stop(),C(this).subs.delete(a.tag)}else{const{subs:e}=C(this);for(const{tag:a,stop:t}of e.values())t(),e.delete(a)}return this}async addListener(e,a){return await this.on(e,a)}async removeListener(e,a){return await this.off(e,a)}static buildClass(e){return class extends N{constructor(a,t=null){super(a,e,t)}}}static from(e,a,t){return null==t&&(t=null),new this(e,a,t)}}class R extends(function(){return N}()){}},24359:(e,a,t)=>{"use strict";t.d(a,{AA:()=>n,Cn:()=>b,HZ:()=>s,_k:()=>o,vu:()=>r});var c=t(43948),f=t(88081),d=t(99381);class r extends c.tG{interface;fragment;args;constructor(e,a,t){super(e,e.provider);const c=a.decodeEventLog(t,e.data,e.topics);(0,f.n)(this,{args:c,fragment:t,interface:a})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class n extends c.tG{error;constructor(e,a){super(e,e.provider),(0,f.n)(this,{error:a})}}class i extends c.z5{#ve;constructor(e,a,t){super(t,a),this.#ve=e}get logs(){return super.logs.map((e=>{const a=e.topics.length?this.#ve.getEvent(e.topics[0]):null;if(a)try{return new r(e,this.#ve,a)}catch(a){return new n(e,a)}return e}))}}class b extends c.uI{#ve;constructor(e,a,t){super(t,a),this.#ve=e}async wait(e,a){const t=await super.wait(e,a);return null==t?null:new i(this.#ve,this.provider,t)}}class o extends d.z{log;constructor(e,a,t,c){super(e,a,t),(0,f.n)(this,{log:c})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class s extends o{constructor(e,a,t,c,d){super(e,a,t,new r(d,e.interface,c));const n=e.interface.decodeEventLog(c,this.log.data,this.log.topics);(0,f.n)(this,{args:n,fragment:c})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}},68682:(e,a,t)=>{"use strict";t.d(a,{n1:()=>x,Gz:()=>y,T_:()=>A,po:()=>v});var c=t(21454),f=t(2200),d=t(78226),r=t(6800),n=t(79271),i=t(32531);const[b,o]=(()=>n.Ay.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((e=>BigInt(e)))))(),s=new Uint32Array(80),l=new Uint32Array(80);class u extends r.D{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:a,Bh:t,Bl:c,Ch:f,Cl:d,Dh:r,Dl:n,Eh:i,El:b,Fh:o,Fl:s,Gh:l,Gl:u,Hh:h,Hl:p}=this;return[e,a,t,c,f,d,r,n,i,b,o,s,l,u,h,p]}set(e,a,t,c,f,d,r,n,i,b,o,s,l,u,h,p){this.Ah=0|e,this.Al=0|a,this.Bh=0|t,this.Bl=0|c,this.Ch=0|f,this.Cl=0|d,this.Dh=0|r,this.Dl=0|n,this.Eh=0|i,this.El=0|b,this.Fh=0|o,this.Fl=0|s,this.Gh=0|l,this.Gl=0|u,this.Hh=0|h,this.Hl=0|p}process(e,a){for(let t=0;t<16;t++,a+=4)s[t]=e.getUint32(a),l[t]=e.getUint32(a+=4);for(let e=16;e<80;e++){const a=0|s[e-15],t=0|l[e-15],c=n.Ay.rotrSH(a,t,1)^n.Ay.rotrSH(a,t,8)^n.Ay.shrSH(a,t,7),f=n.Ay.rotrSL(a,t,1)^n.Ay.rotrSL(a,t,8)^n.Ay.shrSL(a,t,7),d=0|s[e-2],r=0|l[e-2],i=n.Ay.rotrSH(d,r,19)^n.Ay.rotrBH(d,r,61)^n.Ay.shrSH(d,r,6),b=n.Ay.rotrSL(d,r,19)^n.Ay.rotrBL(d,r,61)^n.Ay.shrSL(d,r,6),o=n.Ay.add4L(f,b,l[e-7],l[e-16]),u=n.Ay.add4H(o,c,i,s[e-7],s[e-16]);s[e]=0|u,l[e]=0|o}let{Ah:t,Al:c,Bh:f,Bl:d,Ch:r,Cl:i,Dh:u,Dl:h,Eh:p,El:g,Fh:m,Fl:x,Gh:y,Gl:A,Hh:v,Hl:w}=this;for(let e=0;e<80;e++){const a=n.Ay.rotrSH(p,g,14)^n.Ay.rotrSH(p,g,18)^n.Ay.rotrBH(p,g,41),_=n.Ay.rotrSL(p,g,14)^n.Ay.rotrSL(p,g,18)^n.Ay.rotrBL(p,g,41),I=p&m^~p&y,E=g&x^~g&A,C=n.Ay.add5L(w,_,E,o[e],l[e]),M=n.Ay.add5H(C,v,a,I,b[e],s[e]),B=0|C,k=n.Ay.rotrSH(t,c,28)^n.Ay.rotrBH(t,c,34)^n.Ay.rotrBH(t,c,39),L=n.Ay.rotrSL(t,c,28)^n.Ay.rotrBL(t,c,34)^n.Ay.rotrBL(t,c,39),S=t&f^t&r^f&r,T=c&d^c&i^d&i;v=0|y,w=0|A,y=0|m,A=0|x,m=0|p,x=0|g,({h:p,l:g}=n.Ay.add(0|u,0|h,0|M,0|B)),u=0|r,h=0|i,r=0|f,i=0|d,f=0|t,d=0|c;const N=n.Ay.add3L(B,L,T);t=n.Ay.add3H(N,M,k,S),c=0|N}({h:t,l:c}=n.Ay.add(0|this.Ah,0|this.Al,0|t,0|c)),({h:f,l:d}=n.Ay.add(0|this.Bh,0|this.Bl,0|f,0|d)),({h:r,l:i}=n.Ay.add(0|this.Ch,0|this.Cl,0|r,0|i)),({h:u,l:h}=n.Ay.add(0|this.Dh,0|this.Dl,0|u,0|h)),({h:p,l:g}=n.Ay.add(0|this.Eh,0|this.El,0|p,0|g)),({h:m,l:x}=n.Ay.add(0|this.Fh,0|this.Fl,0|m,0|x)),({h:y,l:A}=n.Ay.add(0|this.Gh,0|this.Gl,0|y,0|A)),({h:v,l:w}=n.Ay.add(0|this.Hh,0|this.Hl,0|v,0|w)),this.set(t,c,f,d,r,i,u,h,p,g,m,x,y,A,v,w)}roundClean(){s.fill(0),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)}}const h=(0,i.ld)((()=>new u));var p=t(57339);const g=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}(),m=g.crypto||g.msCrypto;function x(e){switch(e){case"sha256":return d.s.create();case"sha512":return h.create()}(0,p.MR)(!1,"invalid hashing algorithm name","algorithm",e)}function y(e,a){const t={sha256:d.s,sha512:h}[e];return(0,p.MR)(null!=t,"invalid hmac algorithm","algorithm",e),c.w.create(t,a)}function A(e,a,t,c,r){const n={sha256:d.s,sha512:h}[r];return(0,p.MR)(null!=n,"invalid pbkdf2 algorithm","algorithm",r),(0,f.A)(n,e,a,{c:t,dkLen:c})}function v(e){(0,p.vA)(null!=m,"platform does not support secure random numbers","UNSUPPORTED_OPERATION",{operation:"randomBytes"}),(0,p.MR)(Number.isInteger(e)&&e>0&&e<=1024,"invalid length","length",e);const a=new Uint8Array(e);return m.getRandomValues(a),a}},2011:(e,a,t)=>{"use strict";t.d(a,{S:()=>E});var c=t(89190),f=t(79271),d=t(32531);const[r,n,i]=[[],[],[]],b=BigInt(0),o=BigInt(1),s=BigInt(2),l=BigInt(7),u=BigInt(256),h=BigInt(113);for(let e=0,a=o,t=1,c=0;e<24;e++){[t,c]=[c,(2*t+3*c)%5],r.push(2*(5*c+t)),n.push((e+1)*(e+2)/2%64);let f=b;for(let e=0;e<7;e++)a=(a<>l)*h)%u,a&s&&(f^=o<<(o<t>32?(0,f.WM)(e,a,t):(0,f.P5)(e,a,t),x=(e,a,t)=>t>32?(0,f.im)(e,a,t):(0,f.B4)(e,a,t);class y extends d.Vw{constructor(e,a,t,f=!1,r=24){if(super(),this.blockLen=e,this.suffix=a,this.outputLen=t,this.enableXOF=f,this.rounds=r,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,c.ai)(t),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,d.DH)(this.state)}keccak(){!function(e,a=24){const t=new Uint32Array(10);for(let c=24-a;c<24;c++){for(let a=0;a<10;a++)t[a]=e[a]^e[a+10]^e[a+20]^e[a+30]^e[a+40];for(let a=0;a<10;a+=2){const c=(a+8)%10,f=(a+2)%10,d=t[f],r=t[f+1],n=m(d,r,1)^t[c],i=x(d,r,1)^t[c+1];for(let t=0;t<50;t+=10)e[a+t]^=n,e[a+t+1]^=i}let a=e[2],f=e[3];for(let t=0;t<24;t++){const c=n[t],d=m(a,f,c),i=x(a,f,c),b=r[t];a=e[b],f=e[b+1],e[b]=d,e[b+1]=i}for(let a=0;a<50;a+=10){for(let c=0;c<10;c++)t[c]=e[a+c];for(let c=0;c<10;c++)e[a+c]^=~t[(c+2)%10]&t[(c+4)%10]}e[0]^=p[c],e[1]^=g[c]}t.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){(0,c.t2)(this);const{blockLen:a,state:t}=this,f=(e=(0,d.ZJ)(e)).length;for(let c=0;c=t&&this.keccak();const d=Math.min(t-this.posOut,f-c);e.set(a.subarray(this.posOut,this.posOut+d),c),this.posOut+=d,c+=d}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,c.ai)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,c.CG)(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:a,suffix:t,outputLen:c,rounds:f,enableXOF:d}=this;return e||(e=new y(a,t,c,d,f)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=f,e.suffix=t,e.outputLen=c,e.enableXOF=d,e.destroyed=this.destroyed,e}}const A=((e,a,t)=>(0,d.ld)((()=>new y(a,e,t))))(1,136,32);var v=t(36212);let w=!1;const _=function(e){return A(e)};let I=_;function E(e){const a=(0,v.q5)(e,"data");return(0,v.c$)(I(a))}E._=_,E.lock=function(){w=!0},E.register=function(e){if(w)throw new TypeError("keccak256 is locked");I=e},Object.freeze(E)},68650:(e,a,t)=>{"use strict";t.d(a,{s:()=>s});var c=t(68682),f=t(36212);const d=function(e){return(0,c.n1)("sha256").update(e).digest()},r=function(e){return(0,c.n1)("sha512").update(e).digest()};let n=d,i=r,b=!1,o=!1;function s(e){const a=(0,f.q5)(e,"data");return(0,f.c$)(n(a))}function l(e){const a=(0,f.q5)(e,"data");return(0,f.c$)(i(a))}s._=d,s.lock=function(){b=!0},s.register=function(e){if(b)throw new Error("sha256 is locked");n=e},Object.freeze(s),l._=r,l.lock=function(){o=!0},l.register=function(e){if(o)throw new Error("sha512 is locked");i=e},Object.freeze(s)},20260:(e,a,t)=>{"use strict";t.d(a,{t:()=>p});const c="0x0000000000000000000000000000000000000000000000000000000000000000";var f=t(36212),d=t(27033),r=t(57339);const n=BigInt(0),i=BigInt(1),b=BigInt(2),o=BigInt(27),s=BigInt(28),l=BigInt(35),u={};function h(e){return(0,f.nx)((0,d.c4)(e),32)}class p{#we;#_e;#Ie;#Ee;get r(){return this.#we}set r(e){(0,r.MR)(32===(0,f.pO)(e),"invalid r","value",e),this.#we=(0,f.c$)(e)}get s(){return this.#_e}set s(e){(0,r.MR)(32===(0,f.pO)(e),"invalid s","value",e);const a=(0,f.c$)(e);(0,r.MR)(parseInt(a.substring(0,3))<8,"non-canonical s","value",a),this.#_e=a}get v(){return this.#Ie}set v(e){const a=(0,d.WZ)(e,"value");(0,r.MR)(27===a||28===a,"invalid v","v",e),this.#Ie=a}get networkV(){return this.#Ee}get legacyChainId(){const e=this.networkV;return null==e?null:p.getChainId(e)}get yParity(){return 27===this.v?0:1}get yParityAndS(){const e=(0,f.q5)(this.s);return this.yParity&&(e[0]|=128),(0,f.c$)(e)}get compactSerialized(){return(0,f.xW)([this.r,this.yParityAndS])}get serialized(){return(0,f.xW)([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(e,a,t,c){(0,r.gk)(e,u,"Signature"),this.#we=a,this.#_e=t,this.#Ie=c,this.#Ee=null}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const e=new p(u,this.r,this.s,this.v);return this.networkV&&(e.#Ee=this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:null!=e?e.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(e){const a=(0,d.Ab)(e,"v");return a==o||a==s?n:((0,r.MR)(a>=l,"invalid EIP-155 v","v",e),(a-l)/b)}static getChainIdV(e,a){return(0,d.Ab)(e)*b+BigInt(35+a-27)}static getNormalizedV(e){const a=(0,d.Ab)(e);return a===n||a===o?27:a===i||a===s?28:((0,r.MR)(a>=l,"invalid v","v",e),a&i?27:28)}static from(e){function a(a,t){(0,r.MR)(a,t,"signature",e)}if(null==e)return new p(u,c,c,27);if("string"==typeof e){const t=(0,f.q5)(e,"signature");if(64===t.length){const e=(0,f.c$)(t.slice(0,32)),a=t.slice(32,64),c=128&a[0]?28:27;return a[0]&=127,new p(u,e,(0,f.c$)(a),c)}if(65===t.length){const e=(0,f.c$)(t.slice(0,32)),c=t.slice(32,64);a(!(128&c[0]),"non-canonical s");const d=p.getNormalizedV(t[64]);return new p(u,e,(0,f.c$)(c),d)}a(!1,"invalid raw signature length")}if(e instanceof p)return e.clone();const t=e.r;a(null!=t,"missing r");const n=h(t),i=function(e,t){if(null!=e)return h(e);if(null!=t){a((0,f.Lo)(t,32),"invalid yParityAndS");const e=(0,f.q5)(t);return e[0]&=127,(0,f.c$)(e)}a(!1,"missing s")}(e.s,e.yParityAndS);a(!(128&(0,f.q5)(i)[0]),"non-canonical s");const{networkV:b,v:o}=function(e,t,c){if(null!=e){const a=(0,d.Ab)(e);return{networkV:a>=l?a:void 0,v:p.getNormalizedV(a)}}if(null!=t)return a((0,f.Lo)(t,32),"invalid yParityAndS"),{v:128&(0,f.q5)(t)[0]?28:27};if(null!=c){switch((0,d.WZ)(c,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}a(!1,"invalid yParity")}a(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),s=new p(u,n,i,o);return b&&(s.#Ee=b),a(null==e.yParity||(0,d.WZ)(e.yParity,"sig.yParity")===s.yParity,"yParity mismatch"),a(null==e.yParityAndS||e.yParityAndS===s.yParityAndS,"yParityAndS mismatch"),s}}},72588:(e,a,t)=>{"use strict";t.d(a,{h:()=>be});var c={};t.r(c),t.d(c,{OG:()=>x,My:()=>b,Ph:()=>l,lX:()=>u,Id:()=>m,fg:()=>v,qj:()=>g,aT:()=>s,lq:()=>h,z:()=>p,Q5:()=>_});var f=t(78226);BigInt(0);const d=BigInt(1),r=BigInt(2),n=e=>e instanceof Uint8Array,i=Array.from({length:256},((e,a)=>a.toString(16).padStart(2,"0")));function b(e){if(!n(e))throw new Error("Uint8Array expected");let a="";for(let t=0;te+a.length),0));let t=0;return e.forEach((e=>{if(!n(e))throw new Error("Uint8Array expected");a.set(e,t),t+=e.length})),a}const x=e=>(r<new Uint8Array(e),A=e=>Uint8Array.from(e);function v(e,a,t){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof a||a<2)throw new Error("qByteLen must be a number");if("function"!=typeof t)throw new Error("hmacFn must be a function");let c=y(e),f=y(e),d=0;const r=()=>{c.fill(1),f.fill(0),d=0},n=(...e)=>t(f,c,...e),i=(e=y())=>{f=n(A([0]),e),c=n(),0!==e.length&&(f=n(A([1]),e),c=n())},b=()=>{if(d++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const t=[];for(;e{let t;for(r(),i(e);!(t=a(b()));)i();return r(),t}}const w={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||e instanceof Uint8Array,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,a)=>a.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function _(e,a,t={}){const c=(a,t,c)=>{const f=w[t];if("function"!=typeof f)throw new Error(`Invalid validator "${t}", expected function`);const d=e[a];if(!(c&&void 0===d||f(d,e)))throw new Error(`Invalid param ${String(a)}=${d} (${typeof d}), expected ${t}`)};for(const[e,t]of Object.entries(a))c(e,t,!1);for(const[e,a]of Object.entries(t))c(e,a,!0);return e}const I=BigInt(0),E=BigInt(1),C=BigInt(2),M=BigInt(3),B=BigInt(4),k=BigInt(5),L=BigInt(8);function S(e,a){const t=e%a;return t>=I?t:a+t}function T(e,a,t){if(t<=I||a 0");if(t===E)return I;let c=E;for(;a>I;)a&E&&(c=c*e%t),e=e*e%t,a>>=E;return c}function N(e,a,t){let c=e;for(;a-- >I;)c*=c,c%=t;return c}function R(e,a){if(e===I||a<=I)throw new Error(`invert: expected positive integers, got n=${e} mod=${a}`);let t=S(e,a),c=a,f=I,d=E,r=E,n=I;for(;t!==I;){const e=c/t,a=c%t,i=f-r*e,b=d-n*e;c=t,t=a,f=r,d=n,r=i,n=b}if(c!==E)throw new Error("invert: does not exist");return S(f,a)}BigInt(9),BigInt(16);const P=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function D(e,a){const t=void 0!==a?a:e.toString(2).length;return{nBitLength:t,nByteLength:Math.ceil(t/8)}}function O(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const a=e.toString(2).length;return Math.ceil(a/8)}function F(e){const a=O(e);return a+Math.ceil(a/2)}var Q=t(21454),U=t(32531);const j=BigInt(0),H=BigInt(1);function q(e){return _(e.Fp,P.reduce(((e,a)=>(e[a]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),_(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...D(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}const{Ph:$,aT:z}=c,G={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(e){const{Err:a}=G;if(e.length<2||2!==e[0])throw new a("Invalid signature integer tag");const t=e[1],c=e.subarray(2,t+2);if(!t||c.length!==t)throw new a("Invalid signature integer: wrong length");if(128&c[0])throw new a("Invalid signature integer: negative");if(0===c[0]&&!(128&c[1]))throw new a("Invalid signature integer: unnecessary leading zero");return{d:$(c),l:e.subarray(t+2)}},toSig(e){const{Err:a}=G,t="string"==typeof e?z(e):e;if(!(t instanceof Uint8Array))throw new Error("ui8a expected");let c=t.length;if(c<2||48!=t[0])throw new a("Invalid signature tag");if(t[1]!==c-2)throw new a("Invalid signature: incorrect length");const{d:f,l:d}=G._parseInt(t.subarray(2)),{d:r,l:n}=G._parseInt(d);if(n.length)throw new a("Invalid signature: left bytes after parsing");return{r:f,s:r}},hexFromSig(e){const a=e=>8&Number.parseInt(e[0],16)?"00"+e:e,t=e=>{const a=e.toString(16);return 1&a.length?`0${a}`:a},c=a(t(e.s)),f=a(t(e.r)),d=c.length/2,r=f.length/2,n=t(d),i=t(r);return`30${t(r+d+4)}02${i}${f}02${n}${c}`}},K=BigInt(0),V=BigInt(1),Z=(BigInt(2),BigInt(3));function J(e){const a=function(e){const a=q(e);return _(a,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...a})}(e),{Fp:t,n:c}=a,f=t.BYTES+1,d=2*t.BYTES+1;function r(e){return S(e,c)}function n(e){return R(e,c)}const{ProjectivePoint:i,normPrivateKeyToScalar:o,weierstrassEquation:y,isWithinCurveOrder:A}=function(e){const a=function(e){const a=q(e);_(a,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:c,a:f}=a;if(t){if(!c.eql(f,c.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof t||"bigint"!=typeof t.beta||"function"!=typeof t.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...a})}(e),{Fp:t}=a,c=a.toBytes||((e,a,c)=>{const f=a.toAffine();return m(Uint8Array.from([4]),t.toBytes(f.x),t.toBytes(f.y))}),f=a.fromBytes||(e=>{const a=e.subarray(1);return{x:t.fromBytes(a.subarray(0,t.BYTES)),y:t.fromBytes(a.subarray(t.BYTES,2*t.BYTES))}});function d(e){const{a:c,b:f}=a,d=t.sqr(e),r=t.mul(d,e);return t.add(t.add(r,t.mul(e,c)),f)}if(!t.eql(t.sqr(a.Gy),d(a.Gx)))throw new Error("bad generator point: equation left != right");function r(e){return"bigint"==typeof e&&Kt.eql(e,t.ZERO);return f(a)&&f(c)?u.ZERO:new u(a,c,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const a=t.invertBatch(e.map((e=>e.pz)));return e.map(((e,t)=>e.toAffine(a[t]))).map(u.fromAffine)}static fromHex(e){const a=u.fromAffine(f(g("pointHex",e)));return a.assertValidity(),a}static fromPrivateKey(e){return u.BASE.multiply(i(e))}_setWindowSize(e){this._WINDOW_SIZE=e,o.delete(this)}assertValidity(){if(this.is0()){if(a.allowInfinityPoint&&!t.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:e,y:c}=this.toAffine();if(!t.isValid(e)||!t.isValid(c))throw new Error("bad point: x or y not FE");const f=t.sqr(c),r=d(e);if(!t.eql(f,r))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:e}=this.toAffine();if(t.isOdd)return!t.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){s(e);const{px:a,py:c,pz:f}=this,{px:d,py:r,pz:n}=e,i=t.eql(t.mul(a,n),t.mul(d,f)),b=t.eql(t.mul(c,n),t.mul(r,f));return i&&b}negate(){return new u(this.px,t.neg(this.py),this.pz)}double(){const{a:e,b:c}=a,f=t.mul(c,Z),{px:d,py:r,pz:n}=this;let i=t.ZERO,b=t.ZERO,o=t.ZERO,s=t.mul(d,d),l=t.mul(r,r),h=t.mul(n,n),p=t.mul(d,r);return p=t.add(p,p),o=t.mul(d,n),o=t.add(o,o),i=t.mul(e,o),b=t.mul(f,h),b=t.add(i,b),i=t.sub(l,b),b=t.add(l,b),b=t.mul(i,b),i=t.mul(p,i),o=t.mul(f,o),h=t.mul(e,h),p=t.sub(s,h),p=t.mul(e,p),p=t.add(p,o),o=t.add(s,s),s=t.add(o,s),s=t.add(s,h),s=t.mul(s,p),b=t.add(b,s),h=t.mul(r,n),h=t.add(h,h),s=t.mul(h,p),i=t.sub(i,s),o=t.mul(h,l),o=t.add(o,o),o=t.add(o,o),new u(i,b,o)}add(e){s(e);const{px:c,py:f,pz:d}=this,{px:r,py:n,pz:i}=e;let b=t.ZERO,o=t.ZERO,l=t.ZERO;const h=a.a,p=t.mul(a.b,Z);let g=t.mul(c,r),m=t.mul(f,n),x=t.mul(d,i),y=t.add(c,f),A=t.add(r,n);y=t.mul(y,A),A=t.add(g,m),y=t.sub(y,A),A=t.add(c,d);let v=t.add(r,i);return A=t.mul(A,v),v=t.add(g,x),A=t.sub(A,v),v=t.add(f,d),b=t.add(n,i),v=t.mul(v,b),b=t.add(m,x),v=t.sub(v,b),l=t.mul(h,A),b=t.mul(p,x),l=t.add(b,l),b=t.sub(m,l),l=t.add(m,l),o=t.mul(b,l),m=t.add(g,g),m=t.add(m,g),x=t.mul(h,x),A=t.mul(p,A),m=t.add(m,x),x=t.sub(g,x),x=t.mul(h,x),A=t.add(A,x),g=t.mul(m,A),o=t.add(o,g),g=t.mul(v,A),b=t.mul(y,b),b=t.sub(b,g),g=t.mul(y,m),l=t.mul(v,l),l=t.add(l,g),new u(b,o,l)}subtract(e){return this.add(e.negate())}is0(){return this.equals(u.ZERO)}wNAF(e){return p.wNAFCached(this,o,e,(e=>{const a=t.invertBatch(e.map((e=>e.pz)));return e.map(((e,t)=>e.toAffine(a[t]))).map(u.fromAffine)}))}multiplyUnsafe(e){const c=u.ZERO;if(e===K)return c;if(n(e),e===V)return this;const{endo:f}=a;if(!f)return p.unsafeLadder(this,e);let{k1neg:d,k1:r,k2neg:i,k2:b}=f.splitScalar(e),o=c,s=c,l=this;for(;r>K||b>K;)r&V&&(o=o.add(l)),b&V&&(s=s.add(l)),l=l.double(),r>>=V,b>>=V;return d&&(o=o.negate()),i&&(s=s.negate()),s=new u(t.mul(s.px,f.beta),s.py,s.pz),o.add(s)}multiply(e){n(e);let c,f,d=e;const{endo:r}=a;if(r){const{k1neg:e,k1:a,k2neg:n,k2:i}=r.splitScalar(d);let{p:b,f:o}=this.wNAF(a),{p:s,f:l}=this.wNAF(i);b=p.constTimeNegate(e,b),s=p.constTimeNegate(n,s),s=new u(t.mul(s.px,r.beta),s.py,s.pz),c=b.add(s),f=o.add(l)}else{const{p:e,f:a}=this.wNAF(d);c=e,f=a}return u.normalizeZ([c,f])[0]}multiplyAndAddUnsafe(e,a,t){const c=u.BASE,f=(e,a)=>a!==K&&a!==V&&e.equals(c)?e.multiply(a):e.multiplyUnsafe(a),d=f(this,a).add(f(e,t));return d.is0()?void 0:d}toAffine(e){const{px:a,py:c,pz:f}=this,d=this.is0();null==e&&(e=d?t.ONE:t.inv(f));const r=t.mul(a,e),n=t.mul(c,e),i=t.mul(f,e);if(d)return{x:t.ZERO,y:t.ZERO};if(!t.eql(i,t.ONE))throw new Error("invZ was invalid");return{x:r,y:n}}isTorsionFree(){const{h:e,isTorsionFree:t}=a;if(e===V)return!0;if(t)return t(u,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:t}=a;return e===V?this:t?t(u,this):this.multiplyUnsafe(a.h)}toRawBytes(e=!0){return this.assertValidity(),c(u,this,e)}toHex(e=!0){return b(this.toRawBytes(e))}}u.BASE=new u(a.Gx,a.Gy,t.ONE),u.ZERO=new u(t.ZERO,t.ONE,t.ZERO);const h=a.nBitLength,p=function(e,a){const t=(e,a)=>{const t=a.negate();return e?t:a},c=e=>({windows:Math.ceil(a/e)+1,windowSize:2**(e-1)});return{constTimeNegate:t,unsafeLadder(a,t){let c=e.ZERO,f=a;for(;t>j;)t&H&&(c=c.add(f)),f=f.double(),t>>=H;return c},precomputeWindow(e,a){const{windows:t,windowSize:f}=c(a),d=[];let r=e,n=r;for(let e=0;e>=l,c>n&&(c-=s,d+=H);const r=a,u=a+Math.abs(c)-1,h=e%2!=0,p=c<0;0===c?b=b.add(t(h,f[r])):i=i.add(t(p,f[u]))}return{p:i,f:b}},wNAFCached(e,a,t,c){const f=e._WINDOW_SIZE||1;let d=a.get(e);return d||(d=this.precomputeWindow(e,f),1!==f&&a.set(e,c(d))),this.wNAF(f,d,t)}}}(u,a.endo?Math.ceil(h/2):h);return{CURVE:a,ProjectivePoint:u,normPrivateKeyToScalar:i,weierstrassEquation:d,isWithinCurveOrder:r}}({...a,toBytes(e,a,c){const f=a.toAffine(),d=t.toBytes(f.x),r=m;return c?r(Uint8Array.from([a.hasEvenY()?2:3]),d):r(Uint8Array.from([4]),d,t.toBytes(f.y))},fromBytes(e){const a=e.length,c=e[0],r=e.subarray(1);if(a!==f||2!==c&&3!==c){if(a===d&&4===c)return{x:t.fromBytes(r.subarray(0,t.BYTES)),y:t.fromBytes(r.subarray(t.BYTES,2*t.BYTES))};throw new Error(`Point of length ${a} was invalid. Expected ${f} compressed bytes or ${d} uncompressed bytes`)}{const e=l(r);if(!(K<(n=e)&&nb(h(e,a.nByteLength));function I(e){return e>c>>V}const C=(e,a,t)=>l(e.slice(a,t));class M{constructor(e,a,t){this.r=e,this.s=a,this.recovery=t,this.assertValidity()}static fromCompact(e){const t=a.nByteLength;return e=g("compactSignature",e,2*t),new M(C(e,0,t),C(e,t,2*t))}static fromDER(e){const{r:a,s:t}=G.toSig(g("DER",e));return new M(a,t)}assertValidity(){if(!A(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!A(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(e){return new M(this.r,this.s,e)}recoverPublicKey(e){const{r:c,s:f,recovery:d}=this,b=T(g("msgHash",e));if(null==d||![0,1,2,3].includes(d))throw new Error("recovery id invalid");const o=2===d||3===d?c+a.n:c;if(o>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const s=1&d?"03":"02",l=i.fromHex(s+w(o)),u=n(o),h=r(-b*u),p=r(f*u),m=i.BASE.multiplyAndAddUnsafe(l,h,p);if(!m)throw new Error("point at infinify");return m.assertValidity(),m}hasHighS(){return I(this.s)}normalizeS(){return this.hasHighS()?new M(this.r,r(-this.s),this.recovery):this}toDERRawBytes(){return s(this.toDERHex())}toDERHex(){return G.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return s(this.toCompactHex())}toCompactHex(){return w(this.r)+w(this.s)}}const B={isValidPrivateKey(e){try{return o(e),!0}catch(e){return!1}},normPrivateKeyToScalar:o,randomPrivateKey:()=>{const e=F(a.n);return function(e,a,t=!1){const c=e.length,f=O(a),d=F(a);if(c<16||c1024)throw new Error(`expected ${d}-1024 bytes of input, got ${c}`);const r=S(t?l(e):u(e),a-E)+E;return t?p(r,f):h(r,f)}(a.randomBytes(e),a.n)},precompute:(e=8,a=i.BASE)=>(a._setWindowSize(e),a.multiply(BigInt(3)),a)};function k(e){const a=e instanceof Uint8Array,t="string"==typeof e,c=(a||t)&&e.length;return a?c===f||c===d:t?c===2*f||c===2*d:e instanceof i}const L=a.bits2int||function(e){const t=l(e),c=8*e.length-a.nBitLength;return c>0?t>>BigInt(c):t},T=a.bits2int_modN||function(e){return r(L(e))},N=x(a.nBitLength);function P(e){if("bigint"!=typeof e)throw new Error("bigint expected");if(!(K<=e&&ee in f)))throw new Error("sign() legacy options not supported");const{hash:d,randomBytes:b}=a;let{lowS:s,prehash:l,extraEntropy:u}=f;null==s&&(s=!0),e=g("msgHash",e),l&&(e=g("prehashed msgHash",d(e)));const h=T(e),p=o(c),x=[P(p),P(h)];if(null!=u){const e=!0===u?b(t.BYTES):u;x.push(g("extraEntropy",e))}const y=m(...x),v=h;return{seed:y,k2sig:function(e){const a=L(e);if(!A(a))return;const t=n(a),c=i.BASE.multiply(a).toAffine(),f=r(c.x);if(f===K)return;const d=r(t*r(v+f*p));if(d===K)return;let b=(c.x===f?0:2)|Number(c.y&V),o=d;return s&&I(d)&&(o=function(e){return I(e)?r(-e):e}(d),b^=1),new M(f,o,b)}}}(e,c,f),s=a;return v(s.hash.outputLen,s.nByteLength,s.hmac)(d,b)},verify:function(e,t,c,f=Q){const d=e;if(t=g("msgHash",t),c=g("publicKey",c),"strict"in f)throw new Error("options.strict was renamed to lowS");const{lowS:b,prehash:o}=f;let s,l;try{if("string"==typeof d||d instanceof Uint8Array)try{s=M.fromDER(d)}catch(e){if(!(e instanceof G.Err))throw e;s=M.fromCompact(d)}else{if("object"!=typeof d||"bigint"!=typeof d.r||"bigint"!=typeof d.s)throw new Error("PARSE");{const{r:e,s:a}=d;s=new M(e,a)}}l=i.fromHex(c)}catch(e){if("PARSE"===e.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(b&&s.hasHighS())return!1;o&&(t=a.hash(t));const{r:u,s:h}=s,p=T(t),m=n(h),x=r(p*m),y=r(u*m),A=i.BASE.multiplyAndAddUnsafe(l,x,y)?.toAffine();return!!A&&r(A.x)===u},ProjectivePoint:i,Signature:M,utils:B}}function W(e){return{hash:e,hmac:(a,...t)=>(0,Q.w)(e,a,(0,U.Id)(...t)),randomBytes:U.po}}BigInt(4);const Y=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),X=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),ee=BigInt(1),ae=BigInt(2),te=(e,a)=>(e+a/ae)/a;const ce=function(e,a,t=!1,c={}){if(e<=I)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:f,nByteLength:d}=D(e,a);if(d>2048)throw new Error("Field lengths over 2048 bytes are not supported");const r=function(e){if(e%B===M){const a=(e+E)/B;return function(e,t){const c=e.pow(t,a);if(!e.eql(e.sqr(c),t))throw new Error("Cannot find square root");return c}}if(e%L===k){const a=(e-k)/L;return function(e,t){const c=e.mul(t,C),f=e.pow(c,a),d=e.mul(t,f),r=e.mul(e.mul(d,C),f),n=e.mul(d,e.sub(r,e.ONE));if(!e.eql(e.sqr(n),t))throw new Error("Cannot find square root");return n}}return function(e){const a=(e-E)/C;let t,c,f;for(t=e-E,c=0;t%C===I;t/=C,c++);for(f=C;fS(a,e),isValid:a=>{if("bigint"!=typeof a)throw new Error("Invalid field element: expected bigint, got "+typeof a);return I<=a&&ae===I,isOdd:e=>(e&E)===E,neg:a=>S(-a,e),eql:(e,a)=>e===a,sqr:a=>S(a*a,e),add:(a,t)=>S(a+t,e),sub:(a,t)=>S(a-t,e),mul:(a,t)=>S(a*t,e),pow:(e,a)=>function(e,a,t){if(t 0");if(t===I)return e.ONE;if(t===E)return a;let c=e.ONE,f=a;for(;t>I;)t&E&&(c=e.mul(c,f)),f=e.sqr(f),t>>=E;return c}(n,e,a),div:(a,t)=>S(a*R(t,e),e),sqrN:e=>e*e,addN:(e,a)=>e+a,subN:(e,a)=>e-a,mulN:(e,a)=>e*a,inv:a=>R(a,e),sqrt:c.sqrt||(e=>r(n,e)),invertBatch:e=>function(e,a){const t=new Array(a.length),c=a.reduce(((a,c,f)=>e.is0(c)?a:(t[f]=a,e.mul(a,c))),e.ONE),f=e.inv(c);return a.reduceRight(((a,c,f)=>e.is0(c)?a:(t[f]=e.mul(a,t[f]),e.mul(a,c))),f),t}(n,e),cmov:(e,a,t)=>t?a:e,toBytes:e=>t?p(e,d):h(e,d),fromBytes:e=>{if(e.length!==d)throw new Error(`Fp.fromBytes: expected ${d}, got ${e.length}`);return t?u(e):l(e)}});return Object.freeze(n)}(Y,void 0,void 0,{sqrt:function(e){const a=Y,t=BigInt(3),c=BigInt(6),f=BigInt(11),d=BigInt(22),r=BigInt(23),n=BigInt(44),i=BigInt(88),b=e*e*e%a,o=b*b*e%a,s=N(o,t,a)*o%a,l=N(s,t,a)*o%a,u=N(l,ae,a)*b%a,h=N(u,f,a)*u%a,p=N(h,d,a)*h%a,g=N(p,n,a)*p%a,m=N(g,i,a)*g%a,x=N(m,n,a)*p%a,y=N(x,t,a)*o%a,A=N(y,r,a)*h%a,v=N(A,c,a)*b%a,w=N(v,ae,a);if(!ce.eql(ce.sqr(w),e))throw new Error("Cannot find square root");return w}}),fe=function(e,a){const t=a=>J({...e,...W(a)});return Object.freeze({...t(a),create:t})}({a:BigInt(0),b:BigInt(7),Fp:ce,n:X,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const a=X,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),c=-ee*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),f=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),d=t,r=BigInt("0x100000000000000000000000000000000"),n=te(d*e,a),i=te(-c*e,a);let b=S(e-n*t-i*f,a),o=S(-n*c-i*d,a);const s=b>r,l=o>r;if(s&&(b=a-b),l&&(o=a-o),b>r||o>r)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:s,k1:b,k2neg:l,k2:o}}}},f.s);BigInt(0),fe.ProjectivePoint;var de=t(57339),re=t(36212),ne=t(27033),ie=t(20260);class be{#Ce;constructor(e){(0,de.MR)(32===(0,re.pO)(e),"invalid private key","privateKey","[REDACTED]"),this.#Ce=(0,re.c$)(e)}get privateKey(){return this.#Ce}get publicKey(){return be.computePublicKey(this.#Ce)}get compressedPublicKey(){return be.computePublicKey(this.#Ce,!0)}sign(e){(0,de.MR)(32===(0,re.pO)(e),"invalid digest length","digest",e);const a=fe.sign((0,re.Lm)(e),(0,re.Lm)(this.#Ce),{lowS:!0});return ie.t.from({r:(0,ne.up)(a.r,32),s:(0,ne.up)(a.s,32),v:a.recovery?28:27})}computeSharedSecret(e){const a=be.computePublicKey(e);return(0,re.c$)(fe.getSharedSecret((0,re.Lm)(this.#Ce),(0,re.q5)(a),!1))}static computePublicKey(e,a){let t=(0,re.q5)(e,"key");if(32===t.length){const e=fe.getPublicKey(t,!!a);return(0,re.c$)(e)}if(64===t.length){const e=new Uint8Array(65);e[0]=4,e.set(t,1),t=e}const c=fe.ProjectivePoint.fromHex(t);return(0,re.c$)(c.toRawBytes(a))}static recoverPublicKey(e,a){(0,de.MR)(32===(0,re.pO)(e),"invalid digest length","digest",e);const t=ie.t.from(a);let c=fe.Signature.fromCompact((0,re.Lm)((0,re.xW)([t.r,t.s])));c=c.addRecoveryBit(t.yParity);const f=c.recoverPublicKey((0,re.Lm)(e));return(0,de.MR)(null!=f,"invalid signautre for digest","signature",a),"0x"+f.toHex(!1)}static addPoints(e,a,t){const c=fe.ProjectivePoint.fromHex(be.computePublicKey(e).substring(2)),f=fe.ProjectivePoint.fromHex(be.computePublicKey(a).substring(2));return"0x"+c.add(f).toHex(!!t)}}},38264:(e,a,t)=>{"use strict";t.d(a,{id:()=>d});var c=t(2011),f=t(87303);function d(e){return(0,c.S)((0,f.YW)(e))}},64563:(e,a,t)=>{"use strict";t.d(a,{Wh:()=>Ee,kM:()=>Ie});var c=t(2011),f=t(57339),d=t(87303),r=t(36212),n="AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBvAQohPvU3fAQgHwCyAc8CKQMA5zMSezr7ULgFmDp/LzVQBgEGAi8FYQVgt8AFcTtlQhpCWEmfe5tmZ6IAExsDzQ8t+X8rBKtTAltbAn0jsy8Bl6utPWMDTR8Ei2kRANkDBrNHNysDBzECQWUAcwFpJ3kAiyUhAJ0BUb8AL3EfAbfNAz81KUsFWwF3YQZtAm0A+VEfAzEJDQBRSQCzAQBlAHsAM70GD/v3IZWHBwARKQAxALsjTwHZAeMPEzmXgIHwABIAGQA8AEUAQDt3gdvIEGcQZAkGTRFMdEIVEwK0D64L7REdDNkq09PgADSxB/MDWwfzA1sDWwfzB/MDWwfzA1sDWwNbA1scEvAi28gQZw9QBHUFlgWTBN4IiyZREYkHMAjaVBV0JhxPA00BBCMtSSQ7mzMTJUpMFE0LCAQ2SmyvfUADTzGzVP2QqgPTMlc5dAkGHnkSqAAyD3skNb1OhnpPcagKU0+2tYdJak5vAsY6sEAACikJm2/Dd1YGRRAfJ6kQ+ww3AbkBPw3xS9wE9QY/BM0fgRkdD9GVoAipLeEM8SbnLqWAXiP5KocF8Uv4POELUVFsD10LaQnnOmeBUgMlAREijwrhDT0IcRD3Cs1vDekRSQc9A9lJngCpBwULFR05FbkmFGKwCw05ewb/GvoLkyazEy17AAXXGiUGUQEtGwMA0y7rhbRaNVwgT2MGBwspI8sUrFAkDSlAu3hMGh8HGSWtApVDdEqLUToelyH6PEENai4XUYAH+TwJGVMLhTyiRq9FEhHWPpE9TCJNTDAEOYMsMyePCdMPiQy9fHYBXQklCbUMdRM1ERs3yQg9Bx0xlygnGQglRplgngT7owP3E9UDDwVDCUUHFwO5HDETMhUtBRGBKNsC9zbZLrcCk1aEARsFzw8pH+MQVEfkDu0InwJpA4cl7wAxFSUAGyKfCEdnAGOP3FMJLs8Iy2pwI3gDaxTrZRF3B5UOWwerHDcVwxzlcMxeD4YMKKezCV8BeQmdAWME5wgNNV+MpCBFZ1eLXBifIGVBQ14AAjUMaRWjRMGHfAKPD28SHwE5AXcHPQ0FAnsR8RFvEJkI74YINbkz/DopBFMhhyAVCisDU2zSCysm/Qz8bQGnEmYDEDRBd/Jnr2C6KBgBBx0yyUFkIfULlk/RDKAaxRhGVDIZ6AfDA/ca9yfuQVsGAwOnBxc6UTPyBMELbQiPCUMATQ6nGwfbGG4KdYzUATWPAbudA1uVhwJzkwY7Bw8Aaw+LBX3pACECqwinAAkA0wNbAD0CsQehAB0AiUUBQQMrMwEl6QKTA5cINc8BmTMB9y0EH8cMGQD7O25OAsO1AoBuZqYF4VwCkgJNOQFRKQQJUktVA7N15QDfAE8GF+NLARmvTs8e50cB43MvAMsA/wAJOQcJRQHRAfdxALsBYws1Caa3uQFR7S0AhwAZbwHbAo0A4QA5AIP1AVcAUQVd/QXXAlNNARU1HC9bZQG/AyMBNwERAH0Gz5GpzQsjBHEH1wIQHxXlAu8yB7kFAyLjE9FCyQK94lkAMhoKPAqrCqpgX2Q3CjV2PVQAEh+sPss/UgVVO1c7XDtXO1w7VztcO1c7XDtXO1wDm8Pmw+YKcF9JYe8Mqg3YRMw6TRPfYFVgNhPMLbsUxRXSJVoZQRrAJwkl6FUNDwgt12Y0CDA0eRfAAEMpbINFY4oeNApPHOtTlVT8LR8AtUumM7MNsBsZREQFS3XxYi4WEgomAmSFAmJGX1GzAV83JAKh+wJonAJmDQKfiDgfDwJmPwJmKgRyBIMDfxcDfpY5Cjl7GzmGOicnAmwhAjI6OA4CbcsCbbLzjgM3a0kvAWsA4gDlAE4JB5wMkQECD8YAEbkCdzMCdqZDAnlPRwJ4viFg30WyRvcCfEMCeswCfQ0CfPRIBEiBZygALxlJXEpfGRtK0ALRBQLQ0EsrA4hTA4fqRMmRNgLypV0HAwOyS9JMMSkH001QTbMCi0MCitzFHwshR2sJuwKOOwKOYESbhQKO3QKOYHxRuFM5AQ5S2FSJApP/ApMQAO0AIFUiVbNV1AosHymZijLleGpFPz0Cl6MC77ZYJawAXSkClpMCloCgAK1ZsFoNhVEAPwKWuQKWUlxIXNUCmc8CmWhczl0LHQKcnznGOqECnBoCn58CnryOACETNS4TAp31Ap6WALlBYThh8wKe1wKgcgGtAp6jIwKeUqljzGQrKS8CJ7MCJoICoP8CoFDbAqYzAqXSAqgDAIECp/ZogGi1AAdNaiBq1QKs5wKssgKtawKtBgJXIQJV4AKx5dsDH1JsmwKywRECsuwbbORtZ21MYwMl0QK2YD9DbpQDKUkCuGICuUsZArkue3A6cOUCvR0DLbYDMhUCvoxyBgMzdQK+HnMmc1MCw88CwwhzhnRPOUl05AM8qwEDPJ4DPcMCxYACxksCxhSNAshtVQLISALJUwLJMgJkoQLd1nh9ZXiyeSlL1AMYp2cGAmH4GfeVKHsPXpZevxUCz28Cz3AzT1fW9xejAMqxAs93AS3uA04Wfk8JAtwrAtuOAtJTA1JgA1NjAQUDVZCAjUMEzxrxZEl5A4LSg5EC2ssC2eKEFIRNp0ADhqkAMwNkEoZ1Xf0AWQLfaQLevHd7AuIz7RgB8zQrAfSfAfLWiwLr9wLpdH0DAur9AuroAP1LAb0C7o0C66CWrpcHAu5DA4XkmH1w5HGlAvMHAG0DjhqZlwL3FwORcgOSiwL3nAL53QL4apogmq+/O5siA52HAv7+AR8APZ8gAZ+3AwWRA6ZuA6bdANXJAwZuoYyiCQ0DDE0BEwEjB3EGZb1rCQC/BG/DFY8etxEAG3k9ACcDNxJRA42DAWcrJQCM8wAlAOanC6OVCLsGI6fJBgCvBRnDBvElRUYFFoAFcD9GSDNCKUK8X3kZX8QAls0FOgCQVCGbwTsuYDoZutcONxjOGJHJ/gVfBWAFXwVgBWsFYAVfBWAFXwVgBV8FYAVfBWBOHQjfjW8KCgoKbF7xMwTRA7kGN8PDAMMEr8MA70gxFroFTj5xPnhCR0K+X30/X/AAWBkzswCNBsxzzASm70aCRS4rDDMeLz49fnXfcsH5GcoscQFz13Y4HwVnBXLJycnACNdRYwgICAqEXoWTxgA7P4kACxbZBu21Kw0AjMsTAwkVAOVtJUUsJ1JCuULESUArXy9gPi9AKwnJRQYKTD9LPoA+iT54PnkCkULEUUpDX9NWV3JVEjQAc1w3A3IBE3YnX+g7QiMJb6MKaiszRCUuQrNCxDPMCcwEX9EWJzYREBEEBwIHKn6l33JCNVIfybPJtAltydPUCmhBZw/tEKsZAJOVJU1CLRuxbUHOQAo7P0s+eEJHHA8SJVRPdGM0NVrpvBoKhfUlM0JHHGUQUhEWO1xLSj8MO0ucNAqJIzVCRxv9EFsqKyA4OQgNj2nwZgp5ZNFgE2A1K3YHS2AhQQojJmC7DgpzGG1WYFUZCQYHZO9gHWCdYIVgu2BTYJlwFh8GvRbcXbG8YgtDHrMBwzPVyQonHQgkCyYBgQJ0Ajc4nVqIAwGSCsBPIgDsK3SWEtIVBa5N8gGjAo+kVwVIZwD/AEUSCDweX4ITrRQsJ8K3TwBXFDwEAB0TvzVcAtoTS20RIwDgVgZ9BBImYgA5AL4Coi8LFnezOkCnIQFjAY4KBAPh9RcGsgZSBsEAJctdsWIRu2kTkQstRw7DAcMBKgpPBGIGMDAwKCYnKTQaLg4AKRSVAFwCdl+YUZ0JdicFD3lPAdt1F9ZZKCGxuE3yBxkFVGcA/wBFEgiCBwAOLHQSjxOtQDg1z7deFRMAZ8QTAGtKb1ApIiPHADkAvgKiLy1DFtYCmBiDAlDDWNB0eo7fpaMO/aEVRRv0ATEQZBIODyMEAc8JQhCbDRgzFD4TAEMAu9YBCgCsAOkAm5I3ABwAYxvONnR+MhXJAxgKQyxL2+kkJhMbhQKDBMkSsvF0AD9BNQ6uQC7WqSQHwxEAEEIu1hkhAH2z4iQPwyJPHNWpdyYBRSpnJALzoBAEVPPsH20MxA0CCEQKRgAFyAtFAlMNwwjEDUQJRArELtapMg7DDZgJIw+TGukEIwvDFkMAqAtDEMMMBhioe+QAO3MMRAACrgnEBSPY9Q0FDnbSBoMAB8MSYxkSxAEJAPIJAAB8FWMOFtMc/HcXwxhDAC7DAvOowwAewwJdKDKHAAHDAALrFUQVwwAbwyvzpWMWv8wA/ABpAy++bcYDUKPD0KhDCwKmJ1MAAmMA5+UZwxAagwipBRL/eADfw6fDGOMCGsOjk3l6BwOpo4sAEsMOGxMAA5sAbcMOAAvDp0MJGkMDwgipnNIPAwfIqUMGAOGDAAPzABXDAAcDAAnDAGmTABrDAA7DChjDjnEWAwABYwAOcwAuUyYABsMAF8MIKQANUgC6wy4AA8MADqMq8wCyYgAcIwAB8wqpAAXOCx0V4wAHowBCwwEKAGnDAAuDAB3DAAjDCakABdIAbqcZ3QCZCCkABdIAAAFDAAfjAB2jCCkABqIACYMAGzMAbSMA5sOIAAhjAAhDABTDBAkpAAbSAOOTAAlDC6kOzPtnAAdDAG6kQFAATwAKwwwAA0MACbUDPwAHIwAZgwACE6cDAAojAApDAAoDp/MGwwAJIwADEwAQQwgAFEMAEXMAD5MADfMADcMAGRMOFiMAFUMAbqMWuwHDAMIAE0MLAGkzEgDhUwACQwAEWgAXgwUjAAbYABjDBSYBgzBaAEFNALcQBxUMegAwMngBrA0IZgJ0KxQHBREPd1N0ZzKRJwaIHAZqNT4DqQq8BwngAB4DAwt2AX56T1ocKQNXAh1GATQGC3tOxYNagkgAMQA5CQADAQEAWxLjAIOYNAEzAH7tFRk6TglSAF8NAAlYAQ+S1ACAQwQorQBiAN4dAJ1wPyeTANVzuQDX3AIeEMp9eyMgXiUAEdkBkJizKltbVVAaRMqRAAEAhyQ/SDEz6BmfVwB6ATEsOClKIRcDOF0E/832AFNt5AByAnkCRxGCOs94NjXdAwINGBonDBwPALW2AwICAgAAAAAAAAYDBQMDARrUAwAtAAAAAgEGBgYGBgYFBQUFBQUEBQYHCAkEBQUFBQQAAAICAAAAIgCNAJAAlT0A6gC7ANwApEQAwgCyAK0AqADuAKYA2gCjAOcBCAEDAMcAgQBiANIA1AEDAN4A8gCQAKkBMQDqAN8A3AsBCQ8yO9ra2tq8xuLT1tRJOB0BUgFcNU0BWgFpAWgBWwFMUUlLbhMBUxsNEAs6PhMOACcUKy0vMj5AQENDQ0RFFEYGJFdXV1dZWVhZL1pbXVxcI2NnZ2ZoZypsbnZ1eHh4eHh4enp6enp6enp6enp8fH18e2IARPIASQCaAHgAMgBm+ACOAFcAVwA3AnbvAIsABfj4AGQAk/IAnwBPAGIAZP//sACFAIUAaQBWALEAJAC2AIMCQAJDAPwA5wD+AP4A6AD/AOkA6QDoAOYALwJ7AVEBQAE+AVQBPgE+AT4BOQE4ATgBOAEcAVgXADEQCAEAUx8SHgsdHhYAjgCWAKYAUQBqIAIxAHYAbwCXAxUDJzIDIUlGTzEAkQJPAMcCVwKkAMAClgKWApYClgKWApYCiwKWApYClgKWApYClgKVApUCmAKgApcClgKWApQClAKUApQCkgKVAnUB1AKXAp8ClgKWApUeAIETBQD+DQOfAmECOh8BVBg9AuIZEjMbAU4/G1WZAXusRAFpYQEFA0FPAQYAmTEeIJdyADFoAHEANgCRA5zMk/C2jGINwjMWygIZCaXdfDILBCs5dAE7YnQBugDlhoiHhoiGiYqKhouOjIaNkI6Ij4qQipGGkoaThpSSlYaWhpeKmIaZhpqGm4aci52QnoqfhuIC4XTpAt90AIp0LHSoAIsAdHQEQwRABEIERQRDBEkERgRBBEcESQRIBEQERgRJAJ5udACrA490ALxuAQ10ANFZdHQA13QCFHQA/mJ0AP4BIQD+APwA/AD9APwDhGZ03ASMK23HAP4A/AD8AP0A/CR0dACRYnQA/gCRASEA/gCRAvQA/gCRA4RmdNwEjCttxyR0AP9idAEhAP4A/gD8APwA/QD8AP8A/AD8AP0A/AOEZnTcBIwrbcckdHQAkWJ0ASEA/gCRAP4AkQL0AP4AkQOEZnTcBIwrbcckdAJLAT50AlIBQXQCU8l0dAJfdHQDpgL0A6YDpgOnA6cDpwOnA4RmdNwEjCttxyR0dACRYnQBIQOmAJEDpgCRAvQDpgCRA4RmdNwEjCttxyR0BDh0AJEEOQCRDpU5dSgCADR03gV2CwArdAEFAM5iCnR0AF1iAAYcOgp0dACRCnQAXAEIwWZ0CnRmdHQAkWZ0CnRmdEXgAFF03gp0dEY0tlT2u3SOAQTwscwhjZZKrhYcBSfFp9XNbKiVDOD2b+cpe4/Z17mQnbtzzhaeQtE2GGj0IDNTjRUSyTxxw/RPHW/+vS7d1NfRt9z9QPZg4X7QFfhCnkvgNPIItOsC2eV6hPannZNHlZ9xrwZXIMOlu3jSoQSq78WEjwLjw1ELSlF1aBvfzwk5ZX7AUvQzjPQKbDuQ+sm4wNOp4A6AdVuRS0t1y/DZpg4R6m7FNjM9HgvW7Bi88zaMjOo6lM8wtBBdj8LP4ylv3zCXPhebMKJc066o9sF71oFW/8JXu86HJbwDID5lzw5GWLR/LhT0Qqnp2JQxNZNfcbLIzPy+YypqRm/lBmGmex+82+PisxUumSeJkALIT6rJezxMH+CTJmQtt5uwTVbL3ptmjDUQzlSIvWi8Tl7ng1NpuRn1Ng4n14Qc+3Iil7OwkvNWogLSPkn3pihIFytyIGmMhOe3n1tWsuMy9BdKyqF4Z3v2SgggTL9KVvMXPnCbRe+oOuFFP3HejBG/w9gvmfNYvg6JuWia2lcSSN1uIjBktzoIazOHPJZ7kKHPz8mRWVdW3lA8WGF9dQF6Bm673boov3BUWDU2JNcahR23GtfHKLOz/viZ+rYnZFaIznXO67CYEJ1fXuTRpZhYZkKe54xeoagkNGLs+NTZHE0rX45/XvQ2RGADX6vcAvdxIUBV27wxGm2zjZo4X3ILgAlrOFheuZ6wtsvaIj4yLY7qqawlliaIcrz2G+c3vscAnCkCuMzMmZvMfu9lLwTvfX+3cVSyPdN9ZwgDZhfjRgNJcLiJ67b9xx8JHswprbiE3v9UphotAPIgnXVIN5KmMc0piXhc6cChPnN+MRhG9adtdttQTTwSIpl8I4/j//d3sz1326qTBTpPRM/Hgh3kzqEXs8ZAk4ErQhNO8hzrQ0DLkWMA/N+91tn2MdOJnWC2FCZehkQrwzwbKOjhvZsbM95QoeL9skYyMf4srVPVJSgg7pOLUtr/n9eT99oe9nLtFRpjA9okV2Kj8h9k5HaC0oivRD8VyXkJ81tcd4fHNXPCfloIQasxsuO18/46dR2jgul/UIet2G0kRvnyONMKhHs6J26FEoqSqd+rfYjeEGwHWVDpX1fh1jBBcKGMqRepju9Y00mDVHC+Xdij/j44rKfvfjGinNs1jO/0F3jB83XCDINN/HB84axlP+3E/klktRo+vl3U/aiyMJbIodE1XSsDn6UAzIoMtUObY2+k/4gY/l+AkZJ5Sj2vQrkyLm3FoxjhDX+31UXBFf9XrAH31fFqoBmDEZvhvvpnZ87N+oZEu7U9O/nnk+QWj3x8uyoRbEnf+O5UMr9i0nHP38IF5AvzrBW8YWBUR0mIAzIvndQq9N3v/Jto3aPjPXUPl8ASdPPyAp7jENf8bk7VMM9ol9XGmlBmeDMuGqt+WzuL6CXAxXjIhCPM5vACchgMJ/8XBGLO/D1isVvGhwwHHr1DLaI5mn2Jr/b1pUD90uciDaS8cXNDzCWvNmT/PhQe5e8nTnnnkt8Ds/SIjibcum/fqDhKopxAY8AkSrPn+IGDEKOO+U3XOP6djFs2H5N9+orhOahiQk5KnEUWa+CzkVzhp8bMHRbg81qhjjXuIKbHjSLSIBKWqockGtKinY+z4/RdBUF6pcc3JmnlxVcNgrI4SEzKUZSwcD2QCyxzKve+gAmg6ZuSRkpPFa6mfThu7LJNu3H5K42uCpNvPAsoedolKV/LHe/eJ+BbaG5MG0NaSGVPRUmNFMFFSSpXEcXwbVh7UETOZZtoVNRGOIbbkig3McEtR68cG0RZAoJevWYo7Dg/lZ1CQzblWeUvVHmr8fY4Nqd9JJiH/zEX24mJviH60fAyFr0A3c4bC1j3yZU60VgJxXn8JgJXLUIsiBnmKmMYz+7yBQFBvqb2eYnuW59joZBf56/wXvWIR4R8wTmV80i1mZy+S4+BUES+hzjk0uXpC///z/IlqHZ1monzlXp8aCfhGKMti73FI1KbL1q6IKO4fuBuZ59gagjn5xU79muMpHXg6S+e+gDM/U9BKLHbl9l6o8czQKl4RUkJJiqftQG2i3BMg/TQlUYFkJDYBOOvAugYuzYSDnZbDDd/aSd9x0Oe6F+bJcHfl9+gp6L5/TgA+BdFFovbfCrQ40s5vMPw8866pNX8zyFGeFWdxIpPVp9Rg1UPOVFbFZrvaFq/YAzHQgqMWpahMYfqHpmwXfHL1/kpYmGuHFwT55mQu0dylfNuq2Oq0hTMCPwqfxnuBIPLXfci4Y1ANy+1CUipQxld/izVh16WyG2Q0CQQ9NqtAnx1HCHwDj7sYxOSB0wopZSnOzxQOcExmxrVTF2BkOthVpGfuhaGECfCJpJKpjnihY+xOT2QJxN61+9K6QSqtv2Shr82I3jgJrqBg0wELFZPjvHpvzTtaJnLK6Vb97Yn933koO/saN7fsjwNKzp4l2lJVx2orjCGzC/4ZL4zCver6aQYtC5sdoychuFE6ufOiog+VWi5UDkbmvmtah/3aArEBIi39s5ILUnlFLgilcGuz9CQshEY7fw2ouoILAYPVT/gyAIq3TFAIwVsl+ktkRz/qGfnCDGrm5gsl/l9QdvCWGsjPz3dU7XuqKfdUrr/6XIgjp4rey6AJBmCmUJMjITHVdFb5m1p+dLMCL8t55zD42cmftmLEJC0Da04YiRCVUBLLa8D071/N5UBNBXDh0LFsmhV/5B5ExOB4j3WVG/S3lfK5o+V6ELHvy6RR9n4ac+VsK4VE4yphPvV+kG9FegTBH4ZRXL2HytUHCduJazB/KykjfetYxOXTLws267aGOd+I+JhKP//+VnXmS90OD/jvLcVu0asyqcuYN1mSb6XTlCkqv1vigZPIYwNF/zpWcT1GR/6aEIRjkh0yhg4LXJfaGobYJTY4JI58KiAKgmmgAKWdl5nYCeLqavRJGQNuYuZtZFGx+IkI4w4NS2xwbetNMunOjBu/hmKCI/w7tfiiyUd//4rbTeWt4izBY8YvGIN6vyKYmP/8X8wHKCeN+WRcKM70+tXKNGyevU9H2Dg5BsljnTf8YbsJ1TmMs74Ce2XlHisleguhyeg44rQOHZuw/6HTkhnnurK2d62q6yS7210SsAIaR+jXMQA+svkrLpsUY+F30Uw89uOdGAR6vo4FIME0EfVVeHTu6eKicfhSqOeXJhbftcd08sWEnNUL1C9fnprTgd83IMut8onVUF0hvqzZfHduPjbjwEXIcoYmy+P6tcJZHmeOv6VrvEdkHDJecjHuHeWANe79VG662qTjA/HCvumVv3qL+LrOcpqGps2ZGwQdFJ7PU4iuyRlBrwfO+xnPyr47s2cXVbWzAyznDiBGjCM3ksxjjqM62GE9C8f5U38kB3VjtabKp/nRdvMESPGDG90bWRLAt1Qk5DyLuazRR1YzdC1c+hZXvAWV8xA72S4A8B67vjVhbba3MMop293FeEXpe7zItMWrJG/LOH9ByOXmYnNJfjmfuX9KbrpgLOba4nZ+fl8Gbdv/ihv+6wFGKHCYrVwmhFC0J3V2bn2tIB1wCc1CST3d3X2OyxhguXcs4sm679UngzofuSeBewMFJboIQHbUh/m2JhW2hG9DIvG2t7yZIzKBTz9wBtnNC+2pCRYhSIuQ1j8xsz5VvqnyUIthvuoyyu7fNIrg/KQUVmGQaqkqZk/Vx5b33/gsEs8yX7SC1J+NV4icz6bvIE7C5G6McBaI8rVg56q5QBJWxn/87Q1sPK4+sQa8fLU5gXo4paaq4cOcQ4wR0VBHPGjKh+UlPCbA1nLXyEUX45qZ8J7/Ln4FPJE2TdzD0Z8MLSNQiykMMmSyOCiFfy84Rq60emYB2vD09KjYwsoIpeDcBDTElBbXxND72yhd9pC/1CMid/5HUMvAL27OtcIJDzNKpRPNqPOpyt2aPGz9QWIs9hQ9LiX5s8m9hjTUu/f7MyIatjjd+tSfQ3ufZxPpmJhTaBtZtKLUcfOCUqADuO+QoH8B9v6U+P0HV1GLQmtoNFTb3s74ivZgjES0qfK+8RdGgBbcCMSy8eBvh98+et1KIFqSe1KQPyXULBMTsIYnysIwiZBJYdI20vseV+wuJkcqGemehKjaAb9L57xZm3g2zX0bZ2xk/fU+bCo7TlnbW7JuF1YdURo/2Gw7VclDG1W7LOtas2LX4upifZ/23rzpsnY/ALfRgrcWP5hYmV9VxVOQA1fZvp9F2UNU+7d7xRyVm5wiLp3/0dlV7vdw1PMiZrbDAYzIVqEjRY2YU03sJhPnlwIPcZUG5ltL6S8XCxU1eYS5cjr34veBmXAvy7yN4ZjArIG0dfD/5UpBNlX1ZPoxJOwyqRi3wQWtOzd4oNKh0LkoTm8cwqgIfKhqqGOhwo71I+zXnMemTv2B2AUzABWyFztGgGULjDDzWYwJUVBTjKCn5K2QGMK1CQT7SzziOjo+BhAmqBjzuc3xYym2eedGeOIRJVyTwDw37iCMe4g5Vbnsb5ZBdxOAnMT7HU4DHpxWGuQ7GeiY30Cpbvzss55+5Km1YsbD5ea3NI9QNYIXol5apgSu9dZ8f8xS5dtHpido5BclDuLWY4lhik0tbJa07yJhH0BOyEut/GRbYTS6RfiTYWGMCkNpfSHi7HvdiTglEVHKZXaVhezH4kkXiIvKopYAlPusftpE4a5IZwvw1x/eLvoDIh/zpo9FiQInsTb2SAkKHV42XYBjpJDg4374XiVb3ws4qM0s9eSQ5HzsMU4OZJKuopFjBM+dAZEl8RUMx5uU2N486Kr141tVsGQfGjORYMCJAMsxELeNT4RmWjRcpdTGBwcx6XN9drWqPmJzcrGrH4+DRc7+n1w3kPZwu0BkNr6hQrqgo7JTB9A5kdJ/H7P4cWBMwsmuixAzJB3yrQpnGIq90lxAXLzDCdn1LPibsRt7rHNjgQBklRgPZ8vTbjXdgXrTWQsK5MdrXXQVPp0Rinq3frzZKJ0qD6Qhc40VzAraUXlob1gvkhK3vpmHgI6FRlQZNx6eRqkp0zy4AQlX813fAPtL3jMRaitGFFjo0zmErloC+h+YYdVQ6k4F/epxAoF0BmqEoKNTt6j4vQZNQ2BoqF9Vj53TOIoNmDiu9Xp15RkIgQIGcoLpfoIbenzpGUAtqFJp5W+LLnx38jHeECTJ/navKY1NWfN0sY1T8/pB8kIH3DU3DX+u6W3YwpypBMYOhbSxGjq84RZ84fWJow8pyHqn4S/9J15EcCMsXqrfwyd9mhiu3+rEo9pPpoJkdZqHjra4NvzFwuThNKy6hao/SlLw3ZADUcUp3w3SRVfW2rhl80zOgTYnKE0Hs2qp1J6H3xqPqIkvUDRMFDYyRbsFI3M9MEyovPk8rlw7/0a81cDVLmBsR2ze2pBuKb23fbeZC0uXoIvDppfTwIDxk1Oq2dGesGc+oJXWJLGkOha3CX+DUnzgAp9HGH9RsPZN63Hn4RMA5eSVhPHO+9RcRb/IOgtW31V1Q5IPGtoxPjC+MEJbVlIMYADd9aHYWUIQKopuPOHmoqSkubnAKnzgKHqgIOfW5RdAgotN6BN+O2ZYHkuemLnvQ8U9THVrS1RtLmKbcC7PeeDsYznvqzeg6VCNwmr0Yyx1wnLjyT84BZz3EJyCptD3yeueAyDWIs0L2qs/VQ3HUyqfrja0V1LdDzqAikeWuV4sc7RLIB69jEIBjCkyZedoUHqCrOvShVzyd73OdrJW0hPOuQv2qOoHDc9xVb6Yu6uq3Xqp2ZaH46A7lzevbxQEmfrzvAYSJuZ4WDk1Hz3QX1LVdiUK0EvlAGAYlG3Md30r7dcPN63yqBCIj25prpvZP0nI4+EgWoFG95V596CurXpKRBGRjQlHCvy5Ib/iW8nZJWwrET3mgd6mEhfP4KCuaLjopWs7h+MdXFdIv8dHQJgg1xi1eYqB0uDYjxwVmri0Sv5XKut/onqapC+FQiC2C1lvYJ9MVco6yDYsS3AANUfMtvtbYI2hfwZatiSsnoUeMZd34GVjkMMKA+XnjJpXgRW2SHTZplVowPmJsvXy6w3cfO1AK2dvtZEKTkC/TY9LFiKHCG0DnrMQdGm2lzlBHM9iEYynH2UcVMhUEjsc0oDBTgo2ZSQ1gzkAHeWeBXYFjYLuuf8yzTCy7/RFR81WDjXMbq2BOH5dURnxo6oivmxL3cKzKInlZkD31nvpHB9Kk7GfcfE1t+1V64b9LtgeJGlpRFxQCAqWJ5DoY77ski8gsOEOr2uywZaoO/NGa0X0y1pNQHBi3b2SUGNpcZxDT7rLbBf1FSnQ8guxGW3W+36BW0gBje4DOz6Ba6SVk0xiKgt+q2JOFyr4SYfnu+Ic1QZYIuwHBrgzr6UvOcSCzPTOo7D6IC4ISeS7zkl4h+2VoeHpnG/uWR3+ysNgPcOIXQbv0n4mr3BwQcdKJxgPSeyuP/z1Jjg4e9nUvoXegqQVIE30EHx5GHv+FAVUNTowYDJgyFhf5IvlYmEqRif6+WN1MkEJmDcQITx9FX23a4mxy1AQRsOHO/+eImX9l8EMJI3oPWzVXxSOeHU1dUWYr2uAA7AMb+vAEZSbU3qob9ibCyXeypEMpZ6863o6QPqlqGHZkuWABSTVNd4cOh9hv3qEpSx2Zy/DJMP6cItEmiBJ5PFqQnDEIt3NrA3COlOSgz43D7gpNFNJ5MBh4oFzhDPiglC2ypsNU4ISywY2erkyb1NC3Qh/IfWj0eDgZI4/ln8WPfBsT3meTjq1Uqt1E7Zl/qftqkx6aM9KueMCekSnMrcHj1CqTWWzEzPsZGcDe3Ue4Ws+XFYVxNbOFF8ezkvQGR6ZOtOLU2lQEnMBStx47vE6Pb7AYMBRj2OOfZXfisjJnpTfSNjo6sZ6qSvNxZNmDeS7Gk3yYyCk1HtKN2UnhMIjOXUzAqDv90lx9O/q/AT1ZMnit5XQe9wmQxnE/WSH0CqZ9/2Hy+Sfmpeg8RwsHI5Z8kC8H293m/LHVVM/BA7HaTJYg5Enk7M/xWpq0192ACfBai2LA/qrCjCr6Dh1BIMzMXINBmX96MJ5Hn2nxln/RXPFhwHxUmSV0EV2V0jm86/dxxuYSU1W7sVkEbN9EzkG0QFwPhyHKyb3t+Fj5WoUUTErcazE/N6EW6Lvp0d//SDPj7EV9UdJN+Amnf3Wwk3A0SlJ9Z00yvXZ7n3z70G47Hfsow8Wq1JXcfwnA+Yxa5mFsgV464KKP4T31wqIgzFPd3eCe3j5ory5fBF2hgCFyVFrLzI9eetNXvM7oQqyFgDo4CTp/hDV9NMX9JDHQ/nyHTLvZLNLF6ftn2OxjGm8+PqOwhxnPHWipkE/8wbtyri80Sr7pMNkQGMfo4ZYK9OcCC4ESVFFbLMIvlxSoRqWie0wxqnLfcLSXMSpMMQEJYDVObYsXIQNv4TGNwjq1kvT1UOkicTrG3IaBZ3XdScS3u8sgeZPVpOLkbiF940FjbCeNRINNvDbd01EPBrTCPpm12m43ze1bBB59Ia6Ovhnur/Nvx3IxwSWol+3H2qfCJR8df6aQf4v6WiONxkK+IqT4pKQrZK/LplgDI/PJZbOep8dtbV7oCr6CgfpWa8NczOkPx81iSHbsNhVSJBOtrLIMrL31LK9TqHqAbAHe0RLmmV806kRLDLNEhUEJfm9u0sxpkL93Zgd6rw+tqBfTMi59xqXHLXSHwSbSBl0EK0+loECOPtrl+/nsaFe197di4yUgoe4jKoAJDXc6DGDjrQOoFDWZJ9HXwt8xDrQP+7aRwWKWI1GF8s8O4KzxWBBcwnl3vnl1Oez3oh6Ea1vjR7/z7DDTrFtqU2W/KAEzAuXDNZ7MY73MF216dzdSbWmUp4lcm7keJfWaMHgut9x5C9mj66Z0lJ+yhsjVvyiWrfk1lzPOTdhG15Y7gQlXtacvI7qv/XNSscDwqkgwHT/gUsD5yB7LdRRvJxQGYINn9hTpodKFVSTPrtGvyQw+HlRFXIkodErAGu9Iy1YpfSPc3jkFh5CX3lPxv7aqjE/JAfTIpEjGb/H7MO0e2vsViSW1qa/Lmi4/n4DEI3g7lYrcanspDfEpKkdV1OjSLOy0BCUqVoECaB55vs06rXl4jqmLsPsFM/7vYJ0vrBhDCm/00A/H81l1uekJ/6Lml3Hb9+NKiLqATJmDpyzfYZFHumEjC662L0Bwkxi7E9U4cQA0XMVDuMYAIeLMPgQaMVOd8fmt5SflFIfuBoszeAw7ow5gXPE2Y/yBc/7jExARUf/BxIHQBF5Sn3i61w4z5xJdCyO1F1X3+3ax+JSvMeZ7S6QSKp1Fp/sjYz6Z+VgCZzibGeEoujryfMulH7Rai5kAft9ebcW50DyJr2uo2z97mTWIu45YsSnNSMrrNUuG1XsYBtD9TDYzQffKB87vWbkM4EbPAFgoBV4GQS+vtFDUqOFAoi1nTtmIOvg38N4hT2Sn8r8clmBCXspBlMBYTnrqFJGBT3wZOzAyJDre9dHH7+x7qaaKDOB4UQALD5ecS0DE4obubQEiuJZ0EpBVpLuYcce8Aa4PYd/V4DLDAJBYKQPCWTcrEaZ5HYbJi11Gd6hjGom1ii18VHYnG28NKpkz2UKVPxlhYSp8uZr367iOmoy7zsxehW9wzcy2zG0a80PBMCRQMb32hnaHeOR8fnNDzZhaNYhkOdDsBUZ3loDMa1YP0uS0cjUP3b/6DBlqmZOeNABDsLl5BI5QJups8uxAuWJdkUB/pO6Zax6tsg7fN5mjjDgMGngO+DPcKqiHIDbFIGudxtPTIyDi9SFMKBDcfdGQRv41q1AqmxgkVfJMnP8w/Bc7N9/TR6C7mGObFqFkIEom8sKi2xYqJLTCHK7cxzaZvqODo22c3wisBCP4HeAgcRbNPAsBkNRhSmD48dHupdBRw4mIvtS5oeF6zeT1KMCyhMnmhpkFAGWnGscoNkwvQ8ZM5lE/vgTHFYL99OuNxdFBxTEDd5v2qLR8y9WkXsWgG6kZNndFG+pO/UAkOCipqIhL3hq7cRSdrCq7YhUsTocEcnaFa6nVkhnSeRYUA1YO0z5itF9Sly3VlxYDw239TJJH6f3EUfYO5lb7bcFcz8Bp7Oo8QmnsUHOz/fagVUBtKEw1iT88j+aKkv8cscKNkMxjYr8344D1kFoZ7/td1W6LCNYN594301tUGRmFjAzeRg5vyoM1F6+bJZ/Q54jN/k8SFd3DxPTYaAUsivsBfgTn7Mx8H2SpPt4GOdYRnEJOH6jHM2p6SgB0gzIRq6fHxGMmSmqaPCmlfwxiuloaVIitLGN8wie2CDWhkzLoCJcODh7KIOAqbHEvXdUxaS4TTTs07Clzj/6GmVs9kiZDerMxEnhUB6QQPlcfqkG9882RqHoLiHGBoHfQuXIsAG8GTAtao2KVwRnvvam8jo1e312GQAKWEa4sUVEAMG4G6ckcONDwRcg1e2D3+ohXgY4UAWF8wHKQMrSnzCgfFpsxh+aHXMGtPQroQasRY4U6UdG0rz1Vjbka0MekOGRZQEvqQFlxseFor8zWFgHek3v29+WqN6gaK5gZOTOMZzpQIC1201LkMCXild3vWXSc5UX9xcFYfbRPzGFa1FDcPfPB/jUEq/FeGt419CI3YmBlVoHsa4KdcwQP5ZSwHHhFJ7/Ph/Rap/4vmG91eDwPP0lDfCDRCLszTqfzM71xpmiKi2HwS4WlqvGNwtvwF5Dqpn6KTq8ax00UMPkxDcZrEEEsIvHiUXXEphdb4GB4FymlPwBz4Gperqq5pW7TQ6/yNRhW8VT5NhuP0udlxo4gILq5ZxAZk8ZGh3g4CqxJlPKY7AQxupfUcVpWT5VItp1+30UqoyP4wWsRo3olRRgkWZZ2ZN6VC3OZFeXB8NbnUrSdikNptD1QiGuKkr8EmSR/AK9Rw+FF3s5uwuPbvHGiPeFOViltMK7AUaOsq9+x9cndk3iJEE5LKZRlWJbKOZweROzmPNVPkjE3K/TyA57Rs68TkZ3MR8akKpm7cFjnjPd/DdkWjgYoKHSr5Wu5ssoBYU4acRs5g2DHxUmdq8VXOXRbunD8QN0LhgkssgahcdoYsNvuXGUK/KXD/7oFb+VGdhqIn02veuM5bLudJOc2Ky0GMaG4W/xWBxIJcL7yliJOXOpx0AkBqUgzlDczmLT4iILXDxxtRR1oZa2JWFgiAb43obrJnG/TZC2KSK2wqOzRZTXavZZFMb1f3bXvVaNaK828w9TO610gk8JNf3gMfETzXXsbcvRGCG9JWQZ6+cDPqc4466Yo2RcKH+PILeKOqtnlbInR3MmBeGG3FH10yzkybuqEC2HSQwpA0An7d9+73BkDUTm30bZmoP/RGbgFN+GrCOfADgqr0WbI1a1okpFms8iHYw9hm0zUvlEMivBRxModrbJJ+9/p3jUdQQ9BCtQdxnOGrT5dzRUmw0593/mbRSdBg0nRvRZM5/E16m7ZHmDEtWhwvfdZCZ8J8M12W0yRMszXamWfQTwIZ4ayYktrnscQuWr8idp3PjT2eF/jmtdhIfcpMnb+IfZY2FebW6UY/AK3jP4u3Tu4zE4qlnQgLFbM19EBIsNf7KhjdbqQ/D6yiDb+NlEi2SKD+ivXVUK8ib0oBo366gXkR8ZxGjpJIDcEgZPa9TcYe0TIbiPl/rPUQDu3XBJ9X/GNq3FAUsKsll57DzaGMrjcT+gctp+9MLYXCq+sqP81eVQ0r9lt+gcQfZbACRbEjvlMskztZG8gbC8Qn9tt26Q7y7nDrbZq/LEz7kR6Jc6pg3N9rVX8Y5MJrGlML9p9lU4jbTkKqCveeZUJjHB03m2KRKR2TytoFkTXOLg7keU1s1lrPMQJpoOKLuAAC+y1HlJucU6ysB5hsXhvSPPLq5J7JtnqHKZ4vYjC4Vy8153QY+6780xDuGARsGbOs1WqzH0QS765rnSKEbbKlkO8oI/VDwUd0is13tKpqILu1mDJFNy/iJAWcvDgjxvusIT+PGz3ST/J9r9Mtfd0jpaGeiLYIqXc7DiHSS8TcjFVksi66PEkxW1z6ujbLLUGNNYnzOWpH8BZGK4bCK7iR+MbIv8ncDAz1u4StN3vTTzewr9IQjk9wxFxn+6N1ddKs0vffJiS08N3a4G1SVrlZ97Q/M+8G9fe5AP6d9/Qq4WRnORVhofPIKEdCr3llspUfE0oKIIYoByBRPh+bX1HLS3JWGJRhIvE1aW4NTd8ePi4Z+kXb+Z8snYfSNcqijhAgVsx4RCM54cXUiYkjeBmmC4ajOHrChoELscJJC7+9jjMjw5BagZKlgRMiSNYz7h7vvZIoQqbtQmspc0cUk1G/73iXtSpROl5wtLgQi0mW2Ex8i3WULhcggx6E1LMVHUsdc9GHI1PH3U2Ko0PyGdn9KdVOLm7FPBui0i9a0HpA60MsewVE4z8CAt5d401Gv6zXlIT5Ybit1VIA0FCs7wtvYreru1fUyW3oLAZ/+aTnZrOcYRNVA8spoRtlRoWflsRClFcgzkqiHOrf0/SVw+EpVaFlJ0g4Kxq1MMOmiQdpMNpte8lMMQqm6cIFXlnGbfJllysKDi+0JJMotkqgIxOSQgU9dn/lWkeVf8nUm3iwX2Nl3WDw9i6AUK3vBAbZZrcJpDQ/N64AVwjT07Jef30GSSmtNu2WlW7YoyW2FlWfZFQUwk867EdLYKk9VG6JgEnBiBxkY7LMo4YLQJJlAo9l/oTvJkSARDF/XtyAzM8O2t3eT/iXa6wDN3WewNmQHdPfsxChU/KtLG2Mn8i4ZqKdSlIaBZadxJmRzVS/o4yA65RTSViq60oa395Lqw0pzY4SipwE0SXXsKV+GZraGSkr/RW08wPRvqvSUkYBMA9lPx4m24az+IHmCbXA+0faxTRE9wuGeO06DIXa6QlKJ3puIyiuAVfPr736vzo2pBirS+Vxel3TMm3JKhz9o2ZoRvaFVpIkykb0Hcm4oHFBMcNSNj7/4GJt43ogonY2Vg4nsDQIWxAcorpXACzgBqQPjYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";const i=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),b=4;function o(e){return function(e){let a=0;return()=>e[a++]}(function(e){let a=0;function t(){return e[a++]<<8|e[a++]}let c=t(),f=1,d=[0,1];for(let e=1;e>--i&1}const s=2**31,l=s>>>1,u=l>>1,h=s-1;let p=0;for(let e=0;e<31;e++)p=p<<1|o();let g=[],m=0,x=s;for(;;){let e=Math.floor(((p-m+1)*f-1)/x),a=0,t=c;for(;t-a>1;){let c=a+t>>>1;e>>1|o(),r=r<<1^l,n=(n^l)<<1|l|1;m=r,x=1+n-r}let y=c-4;return g.map((a=>{switch(a-y){case 3:return y+65792+(e[n++]<<16|e[n++]<<8|e[n++]);case 2:return y+256+(e[n++]<<8|e[n++]);case 1:return y+e[n++];default:return a-1}}))}(function(e){let a=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach(((e,t)=>a[e.charCodeAt(0)]=t));let t=e.length,c=new Uint8Array(6*t>>3);for(let f=0,d=0,r=0,n=0;f=8&&(c[d++]=n>>(r-=8));return c}(e)))}function s(e){return 1&e?~e>>1:e>>1}function l(e,a){let t=Array(e);for(let c=0,f=0;c{let a=u(e);if(a.length)return a}))}function p(e){let a=[];for(;;){let t=e();if(0==t)break;a.push(x(t,e))}for(;;){let t=e()-1;if(t<0)break;a.push(y(t,e))}return a.flat()}function g(e){let a=[];for(;;){let t=e(a.length);if(!t)break;a.push(t)}return a}function m(e,a,t){let c=Array(e).fill().map((()=>[]));for(let f=0;fc[a].push(e)));return c}function x(e,a){let t=1+a(),c=a(),f=g(a);return m(f.length,1+e,a).flatMap(((e,a)=>{let[d,...r]=e;return Array(f[a]).fill().map(((e,a)=>{let f=a*c;return[d+a*t,r.map((e=>e+f))]}))}))}function y(e,a){return m(1+a(),1+e,a).map((e=>[e[0],e.slice(1)]))}function A(e){return`{${function(e){return e.toString(16).toUpperCase().padStart(2,"0")}(e)}}`}function v(e){let a=e.length;if(a<4096)return String.fromCodePoint(...e);let t=[];for(let c=0;c>24&255}function P(e){return 16777215&e}let D,O,F,Q;function U(e){return e>=I&&e=E&&e=C&&aM&&ae.map((e=>[e,a+1<<24]))))),O=new Set(u(e)),F=new Map,Q=new Map;for(let[a,t]of p(e)){if(!O.has(a)&&2==t.length){let[e,c]=t,f=Q.get(e);f||(f=new Map,Q.set(e,f)),f.set(c,a)}F.set(a,t.reverse())}}();let a=[],t=[],c=!1;function f(e){let t=D.get(e);t&&(c=!0,e|=t),a.push(e)}for(let c of e)for(;;){if(c<128)a.push(c);else if(U(c)){let e=c-I,a=e%k/B|0,t=e%B;f(E+(e/k|0)),f(C+a),t>0&&f(M+t)}else{let e=F.get(c);e?t.push(...e):f(c)}if(!t.length)break;c=t.pop()}if(c&&a.length>1){let e=R(a[0]);for(let t=1;t0&&f>=e)0==e?(a.push(c,...t),t.length=0,c=r):t.push(r),f=e;else{let d=j(c,r);d>=0?c=d:0==f&&0==e?(a.push(c),c=r):(t.push(r),f=e)}}return c>=0&&a.push(c,...t),a}(H(e))}const z=45,G=".",K=65039,V=1,Z=e=>Array.from(e);function J(e,a){return e.P.has(a)||e.Q.has(a)}class W extends Array{get is_emoji(){return!0}}let Y,X,ee,ae,te,ce,fe,de,re,ne,ie,be;function oe(){if(Y)return;let e=o(n);const a=()=>u(e),t=()=>new Set(a()),c=(e,a)=>a.forEach((a=>e.add(a)));Y=new Map(p(e)),X=t(),ee=a(),ae=new Set(a().map((e=>ee[e]))),ee=new Set(ee),te=t(),ce=t();let f=h(e),d=e();const r=()=>{let e=new Set;return a().forEach((a=>c(e,f[a]))),c(e,a()),e};fe=g((a=>{let t=g(e).map((e=>e+96));if(t.length){let c=a>=d;return t[0]-=32,t=v(t),c&&(t=`Restricted[${t}]`),{N:t,P:r(),Q:r(),M:!e(),R:c}}})),de=t(),re=new Map;let i=a().concat(Z(de)).sort(((e,a)=>e-a));i.forEach(((a,t)=>{let c=e(),f=i[t]=c?i[t-c]:{V:[],M:new Map};f.V.push(a),de.has(a)||re.set(a,f)}));for(let{V:e,M:a}of new Set(re.values())){let t=[];for(let a of e){let e=fe.filter((e=>J(e,a))),f=t.find((({G:a})=>e.some((e=>a.has(e)))));f||(f={G:new Set,V:[]},t.push(f)),f.V.push(a),c(f.G,e)}let f=t.flatMap((e=>Z(e.G)));for(let{G:e,V:c}of t){let t=new Set(f.filter((a=>!e.has(a))));for(let e of c)a.set(e,t)}}ne=new Set;let b=new Set;const s=e=>ne.has(e)?b.add(e):ne.add(e);for(let e of fe){for(let a of e.P)s(a);for(let a of e.Q)s(a)}for(let e of ne)re.has(e)||b.has(e)||re.set(e,V);c(ne,q(ne)),ie=function(e){let a=[],t=u(e);return function e({S:t,B:c},f,d){if(!(4&t&&d===f[f.length-1])){2&t&&(d=f[f.length-1]),1&t&&a.push(f);for(let a of c)for(let t of a.Q)e(a,[...f,t],d)}}(function a(c){return{S:e(),B:g((()=>{let c=u(e).map((e=>t[e]));if(c.length)return a(c)})),Q:c}}([]),[]),a}(e).map((e=>W.from(e))).sort(w),be=new Map;for(let e of ie){let a=[be];for(let t of e){let e=a.map((e=>{let a=e.get(t);return a||(a=new Map,e.set(t,a)),a}));t===K?a.push(...e):a=e}for(let t of a)t.V=e}}function se(e){return(he(e)?"":`${le(ue([e]))} `)+A(e)}function le(e){return`"${e}"‎`}function ue(e,a=1/0,t=A){let c=[];var f;f=e[0],oe(),ee.has(f)&&c.push("◌"),e.length>a&&(a>>=1,e=[...e.slice(0,a),8230,...e.slice(-a)]);let d=0,r=e.length;for(let a=0;a{let f=function(e){let a=[];for(let t=0,c=e.length;t0;)if(95!==e[--a])throw new Error("underscore allowed only at start")}(n),!(d.emoji=r>1||c[0].is_emoji)&&n.every((e=>e<128)))!function(e){if(e.length>=4&&e[2]==z&&e[3]==z)throw new Error(`invalid label extension: "${v(e.slice(0,4))}"`)}(n),e="ASCII";else{let a=c.flatMap((e=>e.is_emoji?[]:e));if(a.length){if(ee.has(n[0]))throw xe("leading combining mark");for(let e=1;eJ(e,t)));if(!e.length)throw fe.some((e=>J(e,t)))?me(a[0],t):ge(t);if(a=e,1==e.length)break}return a}(t);!function(e,a){for(let t of a)if(!J(e,t))throw me(e,t);if(e.M){let e=q(a);for(let a=1,t=e.length;ab)throw new Error(`excessive non-spacing marks: ${le(ue(e.slice(a-1,c)))} (${c-a}/${b})`);a=c}}}(f,a),function(e,a){let t,c=[];for(let e of a){let a=re.get(e);if(a===V)return;if(a){let c=a.M.get(e);if(t=t?t.filter((e=>c.has(e))):Z(c),!t.length)return}else c.push(e)}if(t)for(let a of t)if(c.every((e=>J(a,e))))throw new Error(`whole-script confusable: ${e.N}/${a.N}`)}(f,t),e=f.N}else e="Emoji"}d.type=e}catch(e){d.error=e}return d}))}function ge(e){return new Error(`disallowed character: ${se(e)}`)}function me(e,a){let t=se(a),c=fe.find((e=>e.P.has(a)));return c&&(t=`${c.N} ${t}`),new Error(`illegal mixture: ${e.N} + ${t}`)}function xe(e){return new Error(`illegal placement: ${e}`)}function ye(e){return e.filter((e=>e!=K))}function Ae(e,a){let t,c=be,f=e.length;for(;f&&(c=c.get(e[--f]),c);){let{V:d}=c;d&&(t=d,a&&a.push(...e.slice(f).reverse()),e.length=f)}return t}const ve=new Uint8Array(32);function we(e){return(0,f.MR)(0!==e.length,"invalid ENS name; empty component","comp",e),e}function _e(e){const a=(0,d.YW)(function(e){try{if(0===e.length)throw new Error("empty label");return function(e){return function(e){return e.map((({input:a,error:t,output:c})=>{if(t){let c=t.message;throw new Error(1==e.length?c:`Invalid label ${le(ue(a,63))}: ${c}`)}return v(c)})).join(G)}(pe(e,$,ye))}(e)}catch(a){(0,f.MR)(!1,`invalid ENS name (${a.message})`,"name",e)}}(e)),t=[];if(0===e.length)return t;let c=0;for(let e=0;e{(0,f.MR)(a.length<=t,`label ${JSON.stringify(e)} exceeds ${t} bytes`,"name",e);const c=new Uint8Array(a.length+1);return c.set(a,1),c[0]=c.length-1,c}))))+"00"}ve.fill(0)},82314:(e,a,t)=>{"use strict";t.d(a,{z:()=>I});var c=t(30031),f=t(2011),d=t(36212),r=t(27033),n=t(57339),i=t(88081),b=t(38264);const o=new Uint8Array(32);o.fill(0);const s=BigInt(-1),l=BigInt(0),u=BigInt(1),h=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),p=(0,r.up)(u,32),g=(0,r.up)(l,32),m={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},x=["name","version","chainId","verifyingContract","salt"];function y(e){return function(a){return(0,n.MR)("string"==typeof a,`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,a),a}}const A={name:y("name"),version:y("version"),chainId:function(e){const a=(0,r.Ab)(e,"domain.chainId");return(0,n.MR)(a>=0,"invalid chain ID","domain.chainId",e),Number.isSafeInteger(a)?Number(a):(0,r.nD)(a)},verifyingContract:function(e){try{return(0,c.b)(e).toLowerCase()}catch(e){}(0,n.MR)(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){const a=(0,d.q5)(e,"domain.salt");return(0,n.MR)(32===a.length,'invalid domain value "salt"',"domain.salt",e),(0,d.c$)(a)}};function v(e){{const a=e.match(/^(u?)int(\d+)$/);if(a){const t=""===a[1],c=parseInt(a[2]);(0,n.MR)(c%8==0&&0!==c&&c<=256&&a[2]===String(c),"invalid numeric width","type",e);const f=(0,r.dK)(h,t?c-1:c),d=t?(f+u)*s:l;return function(a){const c=(0,r.Ab)(a,"value");return(0,n.MR)(c>=d&&c<=f,`value out-of-bounds for ${e}`,"value",c),(0,r.up)(t?(0,r.JJ)(c,256):c,32)}}}{const a=e.match(/^bytes(\d+)$/);if(a){const t=parseInt(a[1]);return(0,n.MR)(0!==t&&t<=32&&a[1]===String(t),"invalid bytes width","type",e),function(a){const c=(0,d.q5)(a);return(0,n.MR)(c.length===t,`invalid length for ${e}`,"value",a),function(e){const a=(0,d.q5)(e),t=a.length%32;return t?(0,d.xW)([a,o.slice(t)]):(0,d.c$)(a)}(a)}}}switch(e){case"address":return function(e){return(0,d.nx)((0,c.b)(e),32)};case"bool":return function(e){return e?p:g};case"bytes":return function(e){return(0,f.S)(e)};case"string":return function(e){return(0,b.id)(e)}}return null}function w(e,a){return`${e}(${a.map((({name:e,type:a})=>a+" "+e)).join(",")})`}function _(e){const a=e.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return a?{base:a[1],index:a[2]+a[4],array:{base:a[1],prefix:a[1]+a[2],count:a[5]?parseInt(a[5]):-1}}:{base:e}}class I{primaryType;#Me;get types(){return JSON.parse(this.#Me)}#Be;#ke;constructor(e){this.#Be=new Map,this.#ke=new Map;const a=new Map,t=new Map,c=new Map,f={};Object.keys(e).forEach((d=>{f[d]=e[d].map((({name:a,type:t})=>{let{base:c,index:f}=_(t);return"int"!==c||e.int||(c="int256"),"uint"!==c||e.uint||(c="uint256"),{name:a,type:c+(f||"")}})),a.set(d,new Set),t.set(d,[]),c.set(d,new Set)})),this.#Me=JSON.stringify(f);for(const c in f){const d=new Set;for(const r of f[c]){(0,n.MR)(!d.has(r.name),`duplicate variable name ${JSON.stringify(r.name)} in ${JSON.stringify(c)}`,"types",e),d.add(r.name);const f=_(r.type).base;(0,n.MR)(f!==c,`circular type reference to ${JSON.stringify(f)}`,"types",e),v(f)||((0,n.MR)(t.has(f),`unknown type ${JSON.stringify(f)}`,"types",e),t.get(f).push(c),a.get(c).add(f))}}const d=Array.from(t.keys()).filter((e=>0===t.get(e).length));(0,n.MR)(0!==d.length,"missing primary type","types",e),(0,n.MR)(1===d.length,`ambiguous primary types or unused types: ${d.map((e=>JSON.stringify(e))).join(", ")}`,"types",e),(0,i.n)(this,{primaryType:d[0]}),function f(d,r){(0,n.MR)(!r.has(d),`circular type reference to ${JSON.stringify(d)}`,"types",e),r.add(d);for(const e of a.get(d))if(t.has(e)){f(e,r);for(const a of r)c.get(a).add(e)}r.delete(d)}(this.primaryType,new Set);for(const[e,a]of c){const t=Array.from(a);t.sort(),this.#Be.set(e,w(e,f[e])+t.map((e=>w(e,f[e]))).join(""))}}getEncoder(e){let a=this.#ke.get(e);return a||(a=this.#Le(e),this.#ke.set(e,a)),a}#Le(e){{const a=v(e);if(a)return a}const a=_(e).array;if(a){const e=a.prefix,t=this.getEncoder(e);return c=>{(0,n.MR)(-1===a.count||a.count===c.length,`array length mismatch; expected length ${a.count}`,"value",c);let r=c.map(t);return this.#Be.has(e)&&(r=r.map(f.S)),(0,f.S)((0,d.xW)(r))}}const t=this.types[e];if(t){const a=(0,b.id)(this.#Be.get(e));return e=>{const c=t.map((({name:a,type:t})=>{const c=this.getEncoder(t)(e[a]);return this.#Be.has(t)?(0,f.S)(c):c}));return c.unshift(a),(0,d.xW)(c)}}(0,n.MR)(!1,`unknown type: ${e}`,"type",e)}encodeType(e){const a=this.#Be.get(e);return(0,n.MR)(a,`unknown type: ${JSON.stringify(e)}`,"name",e),a}encodeData(e,a){return this.getEncoder(e)(a)}hashStruct(e,a){return(0,f.S)(this.encodeData(e,a))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,a,t){if(v(e))return t(e,a);const c=_(e).array;if(c)return(0,n.MR)(-1===c.count||c.count===a.length,`array length mismatch; expected length ${c.count}`,"value",a),a.map((e=>this._visit(c.prefix,e,t)));const f=this.types[e];if(f)return f.reduce(((e,{name:c,type:f})=>(e[c]=this._visit(f,a[c],t),e)),{});(0,n.MR)(!1,`unknown type: ${e}`,"type",e)}visit(e,a){return this._visit(this.primaryType,e,a)}static from(e){return new I(e)}static getPrimaryType(e){return I.from(e).primaryType}static hashStruct(e,a,t){return I.from(a).hashStruct(e,t)}static hashDomain(e){const a=[];for(const t in e){if(null==e[t])continue;const c=m[t];(0,n.MR)(c,`invalid typed-data domain key: ${JSON.stringify(t)}`,"domain",e),a.push({name:t,type:c})}return a.sort(((e,a)=>x.indexOf(e.name)-x.indexOf(a.name))),I.hashStruct("EIP712Domain",{EIP712Domain:a},e)}static encode(e,a,t){return(0,d.xW)(["0x1901",I.hashDomain(e),I.from(a).hash(t)])}static hash(e,a,t){return(0,f.S)(I.encode(e,a,t))}static async resolveNames(e,a,t,c){e=Object.assign({},e);for(const a in e)null==e[a]&&delete e[a];const f={};e.verifyingContract&&!(0,d.Lo)(e.verifyingContract,20)&&(f[e.verifyingContract]="0x");const r=I.from(a);r.visit(t,((e,a)=>("address"!==e||(0,d.Lo)(a,20)||(f[a]="0x"),a)));for(const e in f)f[e]=await c(e);return e.verifyingContract&&f[e.verifyingContract]&&(e.verifyingContract=f[e.verifyingContract]),{domain:e,value:t=r.visit(t,((e,a)=>"address"===e&&f[a]?f[a]:a))}}static getPayload(e,a,t){I.hashDomain(e);const c={},f=[];x.forEach((a=>{const t=e[a];null!=t&&(c[a]=A[a](t),f.push({name:a,type:m[a]}))}));const i=I.from(a);a=i.types;const b=Object.assign({},a);return(0,n.MR)(null==b.EIP712Domain,"types must not contain EIP712Domain type","types.EIP712Domain",a),b.EIP712Domain=f,i.encode(t),{types:b,domain:c,primaryType:i.primaryType,message:i.visit(t,((e,a)=>{if(e.match(/^bytes(\d*)/))return(0,d.c$)((0,d.q5)(a));if(e.match(/^u?int/))return(0,r.Ab)(a).toString();switch(e){case"address":return a.toLowerCase();case"bool":return!!a;case"string":return(0,n.MR)("string"==typeof a,"invalid string","value",a),a}(0,n.MR)(!1,"unsupported type","type",e)}))}}}},97876:(e,a,t)=>{"use strict";t.d(a,{Pz:()=>m});var c=t(30031),f=t(98982),d=t(13269),r=t(64563),n=t(57339),i=t(88081),b=t(36212),o=t(14132),s=t(27033),l=t(26976);function u(e){return e.match(/^ipfs:\/\/ipfs\//i)?e=e.substring(12):e.match(/^ipfs:\/\//i)?e=e.substring(7):(0,n.MR)(!1,"unsupported IPFS format","link",e),`https://gateway.ipfs.io/ipfs/${e}`}class h{name;constructor(e){(0,i.n)(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,a){throw new Error("unsupported coin")}async decodeAddress(e,a){throw new Error("unsupported coin")}}const p=new RegExp("^(ipfs)://(.*)$","i"),g=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),p,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];class m{provider;address;name;#Se;#Te;constructor(e,a,t){(0,i.n)(this,{provider:e,address:a,name:t}),this.#Se=null,this.#Te=new d.NZ(a,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],e)}async supportsWildcard(){return null==this.#Se&&(this.#Se=(async()=>{try{return await this.#Te.supportsInterface("0x9061b923")}catch(e){if((0,n.bJ)(e,"CALL_EXCEPTION"))return!1;throw this.#Se=null,e}})()),await this.#Se}async#Ne(e,a){a=(a||[]).slice();const t=this.#Te.interface;a.unshift((0,r.kM)(this.name));let c=null;await this.supportsWildcard()&&(c=t.getFunction(e),(0,n.vA)(c,"missing fragment","UNKNOWN_ERROR",{info:{funcName:e}}),a=[(0,r.Wh)(this.name,255),t.encodeFunctionData(c,a)],e="resolve(bytes,bytes)"),a.push({enableCcipRead:!0});try{const f=await this.#Te[e](...a);return c?t.decodeFunctionResult(c,f)[0]:f}catch(e){if(!(0,n.bJ)(e,"CALL_EXCEPTION"))throw e}return null}async getAddress(e){if(null==e&&(e=60),60===e)try{const e=await this.#Ne("addr(bytes32)");return null==e||e===f.j?null:e}catch(e){if((0,n.bJ)(e,"CALL_EXCEPTION"))return null;throw e}if(e>=0&&e<2147483648){let a=e+2147483648;const t=await this.#Ne("addr(bytes32,uint)",[a]);if((0,b.Lo)(t,20))return(0,c.b)(t)}let a=null;for(const t of this.provider.plugins)if(t instanceof h&&t.supportsCoinType(e)){a=t;break}if(null==a)return null;const t=await this.#Ne("addr(bytes32,uint)",[e]);if(null==t||"0x"===t)return null;const d=await a.decodeAddress(e,t);if(null!=d)return d;(0,n.vA)(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${e})`,info:{coinType:e,data:t}})}async getText(e){const a=await this.#Ne("text(bytes32,string)",[e]);return null==a||"0x"===a?null:a}async getContentHash(){const e=await this.#Ne("contenthash(bytes32)");if(null==e||"0x"===e)return null;const a=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(a){const e="e3010170"===a[1]?"ipfs":"ipns",t=parseInt(a[4],16);if(a[5].length===2*t)return`${e}://${(0,o.R)("0x"+a[2])}`}const t=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(t&&64===t[1].length)return`bzz://${t[1]}`;(0,n.vA)(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:e}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const e=[{type:"name",value:this.name}];try{const a=await this.getText("avatar");if(null==a)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:a});for(let t=0;t{"use strict";t.d(a,{J9:()=>s,VS:()=>l,eB:()=>u,tG:()=>h,uI:()=>g,z5:()=>p});var c=t(88081),f=t(36212),d=t(27033),r=t(57339),n=t(8177);const i=BigInt(0);function b(e){return null==e?null:e}function o(e){return null==e?null:e.toString()}class s{gasPrice;maxFeePerGas;maxPriorityFeePerGas;constructor(e,a,t){(0,c.n)(this,{gasPrice:b(e),maxFeePerGas:b(a),maxPriorityFeePerGas:b(t)})}toJSON(){const{gasPrice:e,maxFeePerGas:a,maxPriorityFeePerGas:t}=this;return{_type:"FeeData",gasPrice:o(e),maxFeePerGas:o(a),maxPriorityFeePerGas:o(t)}}}function l(e){const a={};e.to&&(a.to=e.to),e.from&&(a.from=e.from),e.data&&(a.data=(0,f.c$)(e.data));const t="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const c of t)c in e&&null!=e[c]&&(a[c]=(0,d.Ab)(e[c],`request.${c}`));const c="type,nonce".split(/,/);for(const t of c)t in e&&null!=e[t]&&(a[t]=(0,d.WZ)(e[t],`request.${t}`));return e.accessList&&(a.accessList=(0,n.$)(e.accessList)),"blockTag"in e&&(a.blockTag=e.blockTag),"enableCcipRead"in e&&(a.enableCcipRead=!!e.enableCcipRead),"customData"in e&&(a.customData=e.customData),"blobVersionedHashes"in e&&e.blobVersionedHashes&&(a.blobVersionedHashes=e.blobVersionedHashes.slice()),"kzg"in e&&(a.kzg=e.kzg),"blobs"in e&&e.blobs&&(a.blobs=e.blobs.map((e=>(0,f.f)(e)?(0,f.c$)(e):Object.assign({},e)))),a}class u{provider;number;hash;timestamp;parentHash;parentBeaconBlockRoot;nonce;difficulty;gasLimit;gasUsed;stateRoot;receiptsRoot;blobGasUsed;excessBlobGas;miner;prevRandao;extraData;baseFeePerGas;#Pe;constructor(e,a){this.#Pe=e.transactions.map((e=>"string"!=typeof e?new g(e,a):e)),(0,c.n)(this,{provider:a,hash:b(e.hash),number:e.number,timestamp:e.timestamp,parentHash:e.parentHash,parentBeaconBlockRoot:e.parentBeaconBlockRoot,nonce:e.nonce,difficulty:e.difficulty,gasLimit:e.gasLimit,gasUsed:e.gasUsed,blobGasUsed:e.blobGasUsed,excessBlobGas:e.excessBlobGas,miner:e.miner,prevRandao:b(e.prevRandao),extraData:e.extraData,baseFeePerGas:b(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return this.#Pe.map((e=>"string"==typeof e?e:e.hash))}get prefetchedTransactions(){const e=this.#Pe.slice();return 0===e.length?[]:((0,r.vA)("object"==typeof e[0],"transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:a,extraData:t,gasLimit:c,gasUsed:f,hash:d,miner:r,prevRandao:n,nonce:i,number:b,parentHash:s,parentBeaconBlockRoot:l,stateRoot:u,receiptsRoot:h,timestamp:p,transactions:g}=this;return{_type:"Block",baseFeePerGas:o(e),difficulty:o(a),extraData:t,gasLimit:o(c),gasUsed:o(f),blobGasUsed:o(this.blobGasUsed),excessBlobGas:o(this.excessBlobGas),hash:d,miner:r,prevRandao:n,nonce:i,number:b,parentHash:s,timestamp:p,parentBeaconBlockRoot:l,stateRoot:u,receiptsRoot:h,transactions:g}}[Symbol.iterator](){let e=0;const a=this.transactions;return{next:()=>enew h(e,a))));let t=i;null!=e.effectiveGasPrice?t=e.effectiveGasPrice:null!=e.gasPrice&&(t=e.gasPrice),(0,c.n)(this,{provider:a,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:t,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return this.#De}toJSON(){const{to:e,from:a,contractAddress:t,hash:c,index:f,blockHash:d,blockNumber:r,logsBloom:n,logs:i,status:b,root:s}=this;return{_type:"TransactionReceipt",blockHash:d,blockNumber:r,contractAddress:t,cumulativeGasUsed:o(this.cumulativeGasUsed),from:a,gasPrice:o(this.gasPrice),blobGasUsed:o(this.blobGasUsed),blobGasPrice:o(this.blobGasPrice),gasUsed:o(this.gasUsed),hash:c,index:f,logs:i,logsBloom:n,root:s,status:b,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e{if(b)return null;const{blockNumber:e,nonce:a}=await(0,c.k)({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(a{if(null==e||0!==e.status)return e;(0,r.vA)(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:e.to,from:e.from,data:""},receipt:e})},l=await this.provider.getTransactionReceipt(this.hash);if(0===t)return s(l);if(l){if(await l.confirmations()>=t)return s(l)}else if(await o(),0===t)return null;const u=new Promise(((e,a)=>{const c=[],n=()=>{c.forEach((e=>e()))};if(c.push((()=>{b=!0})),f>0){const e=setTimeout((()=>{n(),a((0,r.xz)("wait for transaction timeout","TIMEOUT"))}),f);c.push((()=>{clearTimeout(e)}))}const i=async c=>{if(await c.confirmations()>=t){n();try{e(s(c))}catch(e){a(e)}}};if(c.push((()=>{this.provider.off(this.hash,i)})),this.provider.on(this.hash,i),d>=0){const e=async()=>{try{await o()}catch(e){if((0,r.bJ)(e,"TRANSACTION_REPLACED"))return n(),void a(e)}b||this.provider.once("block",e)};c.push((()=>{this.provider.off("block",e)})),this.provider.once("block",e)}}));return await u}isMined(){return null!=this.blockHash}isLegacy(){return 0===this.type}isBerlin(){return 1===this.type}isLondon(){return 2===this.type}isCancun(){return 3===this.type}removedEvent(){return(0,r.vA)(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),x(this)}reorderedEvent(e){return(0,r.vA)(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),(0,r.vA)(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),m(this,e)}replaceableTransaction(e){(0,r.MR)(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const a=new g(this,this.provider);return a.#Oe=e,a}}function m(e,a){return{orphan:"reorder-transaction",tx:e,other:a}}function x(e){return{orphan:"drop-transaction",tx:e}}},8177:(e,a,t)=>{"use strict";t.d(a,{$:()=>n});var c=t(30031),f=t(57339),d=t(36212);function r(e,a){return{address:(0,c.b)(e),storageKeys:a.map(((e,a)=>((0,f.MR)((0,d.Lo)(e,32),"invalid slot",`storageKeys[${a}]`,e),e.toLowerCase())))}}function n(e){if(Array.isArray(e))return e.map(((a,t)=>Array.isArray(a)?((0,f.MR)(2===a.length,"invalid slot set",`value[${t}]`,a),r(a[0],a[1])):((0,f.MR)(null!=a&&"object"==typeof a,"invalid address-slot set","value",e),r(a.address,a.storageKeys))));(0,f.MR)(null!=e&&"object"==typeof e,"invalid access list","value",e);const a=Object.keys(e).map((a=>{const t=e[a].reduce(((e,a)=>(e[a]=!0,e)),{});return r(a,Object.keys(t).sort())}));return a.sort(((e,a)=>e.address.localeCompare(a.address))),a}},20415:(e,a,t)=>{"use strict";t.d(a,{K:()=>r,x:()=>n});var c=t(30031),f=t(72588),d=t(2011);function r(e){let a;return a="string"==typeof e?f.h.computePublicKey(e,!1):e.publicKey,(0,c.b)((0,d.S)("0x"+a.substring(4)).substring(26))}function n(e,a){return r(f.h.recoverPublicKey(e,a))}},79453:(e,a,t)=>{"use strict";t.d(a,{Z:()=>D});var c=t(30031),f=t(98982),d=t(68650),r=t(20260),n=t(2011),i=t(72588),b=t(57339),o=t(27033),s=t(36212);function l(e){let a=e.toString(16);for(;a.length<2;)a="0"+a;return"0x"+a}function u(e,a,t){let c=0;for(let f=0;f{(0,b.vA)(a<=e.length,"data short segment too short","BUFFER_OVERRUN",{buffer:e,length:e.length,offset:a})};if(e[a]>=248){const c=e[a]-247;t(a+1+c);const f=u(e,a+1,c);return t(a+1+c+f),h(e,a,a+1+c,c+f)}if(e[a]>=192){const c=e[a]-192;return t(a+1+c),h(e,a,a+1,c)}if(e[a]>=184){const c=e[a]-183;t(a+1+c);const f=u(e,a+1,c);return t(a+1+c+f),{consumed:1+c+f,result:(0,s.c$)(e.slice(a+1+c,a+1+c+f))}}if(e[a]>=128){const c=e[a]-128;return t(a+1+c),{consumed:1+c,result:(0,s.c$)(e.slice(a+1,a+1+c))}}return{consumed:1,result:l(e[a])}}function g(e){const a=(0,s.q5)(e,"data"),t=p(a,0);return(0,b.MR)(t.consumed===a.length,"unexpected junk after rlp payload","data",e),t.result}var m=t(65735),x=t(8177),y=t(20415);const A=BigInt(0),v=BigInt(2),w=BigInt(27),_=BigInt(28),I=BigInt(35),E=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),C=131072;function M(e,a){let t=e.toString(16);for(;t.length<2;)t="0"+t;return t+=(0,d.s)(a).substring(4),"0x"+t}function B(e){return"0x"===e?null:(0,c.b)(e)}function k(e,a){try{return(0,x.$)(e)}catch(t){(0,b.MR)(!1,t.message,a,e)}}function L(e,a){return"0x"===e?0:(0,o.WZ)(e,a)}function S(e,a){if("0x"===e)return A;const t=(0,o.Ab)(e,a);return(0,b.MR)(t<=E,"value exceeds uint size",a,t),t}function T(e,a){const t=(0,o.Ab)(e,"value"),c=(0,o.c4)(t);return(0,b.MR)(c.length<=32,"value too large",`tx.${a}`,t),c}function N(e){return(0,x.$)(e).map((e=>[e.address,e.storageKeys]))}function R(e,a){(0,b.MR)(Array.isArray(e),`invalid ${a}`,"value",e);for(let a=0;aObject.assign({},e)))}set blobs(e){if(null==e)return void(this.#We=null);const a=[],t=[];for(let c=0;ce.data)),t.map((e=>e.commitment)),t.map((e=>e.proof))])]):(0,s.xW)(["0x03",(0,m.R)(c)])}(this,t,a?this.blobs:null)}(0,b.vA)(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})}get serialized(){return this.#Ye(!0,!0)}get unsignedSerialized(){return this.#Ye(!1,!1)}inferType(){const e=this.inferTypes();return e.indexOf(2)>=0?2:e.pop()}inferTypes(){const e=null!=this.gasPrice,a=null!=this.maxFeePerGas||null!=this.maxPriorityFeePerGas,t=null!=this.accessList,c=null!=this.#Ve||this.#Ze;null!=this.maxFeePerGas&&null!=this.maxPriorityFeePerGas&&(0,b.vA)(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),(0,b.vA)(!a||0!==this.type&&1!==this.type,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),(0,b.vA)(0!==this.type||!t,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const f=[];return null!=this.type?f.push(this.type):a?f.push(2):e?(f.push(1),t||f.push(0)):t?(f.push(1),f.push(2)):(c&&this.to||(f.push(0),f.push(1),f.push(2)),f.push(3)),f.sort(),f}isLegacy(){return 0===this.type}isBerlin(){return 1===this.type}isLondon(){return 2===this.type}isCancun(){return 3===this.type}clone(){return D.from(this)}toJSON(){const e=e=>null==e?null:e.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(e){if(null==e)return new D;if("string"==typeof e){const a=(0,s.q5)(e);if(a[0]>=127)return D.from(function(e){const a=g(e);(0,b.MR)(Array.isArray(a)&&(9===a.length||6===a.length),"invalid field count for legacy transaction","data",e);const t={type:0,nonce:L(a[0],"nonce"),gasPrice:S(a[1],"gasPrice"),gasLimit:S(a[2],"gasLimit"),to:B(a[3]),value:S(a[4],"value"),data:(0,s.c$)(a[5]),chainId:A};if(6===a.length)return t;const c=S(a[6],"v"),f=S(a[7],"r"),d=S(a[8],"s");if(f===A&&d===A)t.chainId=c;else{let e=(c-I)/v;e{"use strict";t.d(a,{H:()=>l,R:()=>s});var c=t(36212),f=t(57339),d=t(27033);const r="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";let n=null;function i(e){if(null==n){n={};for(let e=0;e{"use strict";t.d(a,{Lm:()=>r,Lo:()=>n,X_:()=>g,ZG:()=>u,c$:()=>o,f:()=>i,nx:()=>p,pO:()=>l,q5:()=>d,xW:()=>s});var c=t(57339);function f(e,a,t){if(e instanceof Uint8Array)return t?new Uint8Array(e):e;if("string"==typeof e&&e.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const a=new Uint8Array((e.length-2)/2);let t=2;for(let c=0;c>4]+b[15&c]}return t}function s(e){return"0x"+e.map((e=>o(e).substring(2))).join("")}function l(e){return n(e,!0)?(e.length-2)/2:d(e).length}function u(e,a,t){const f=d(e);return null!=t&&t>f.length&&(0,c.vA)(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:f,length:f.length,offset:t}),o(f.slice(null==a?0:a,null==t?f.length:t))}function h(e,a,t){const f=d(e);(0,c.vA)(a>=f.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(f),length:a,offset:a+1});const r=new Uint8Array(a);return r.fill(0),t?r.set(f,a-f.length):r.set(f,0),o(r)}function p(e,a){return h(e,a,!0)}function g(e,a){return h(e,a,!1)}},57339:(e,a,t)=>{"use strict";t.d(a,{E:()=>n,MR:()=>o,SP:()=>u,bJ:()=>r,dd:()=>s,gk:()=>h,vA:()=>b,xz:()=>i});var c=t(99529),f=t(88081);function d(e){if(null==e)return"null";if(Array.isArray(e))return"[ "+e.map(d).join(", ")+" ]";if(e instanceof Uint8Array){const a="0123456789abcdef";let t="0x";for(let c=0;c>4],t+=a[15&e[c]];return t}if("object"==typeof e&&"function"==typeof e.toJSON)return d(e.toJSON());switch(typeof e){case"boolean":case"symbol":case"number":return e.toString();case"bigint":return BigInt(e).toString();case"string":return JSON.stringify(e);case"object":{const a=Object.keys(e);return a.sort(),"{ "+a.map((a=>`${d(a)}: ${d(e[a])}`)).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function r(e,a){return e&&e.code===a}function n(e){return r(e,"CALL_EXCEPTION")}function i(e,a,t){let r,n=e;{const f=[];if(t){if("message"in t||"code"in t||"name"in t)throw new Error(`value will overwrite populated values: ${d(t)}`);for(const e in t){if("shortMessage"===e)continue;const a=t[e];f.push(e+"="+d(a))}}f.push(`code=${a}`),f.push(`version=${c.r}`),f.length&&(e+=" ("+f.join(", ")+")")}switch(a){case"INVALID_ARGUMENT":r=new TypeError(e);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":r=new RangeError(e);break;default:r=new Error(e)}return(0,f.n)(r,{code:a}),t&&Object.assign(r,t),null==r.shortMessage&&(0,f.n)(r,{shortMessage:n}),r}function b(e,a,t,c){if(!e)throw i(a,t,c)}function o(e,a,t,c){b(e,a,"INVALID_ARGUMENT",{argument:t,value:c})}function s(e,a,t){null==t&&(t=""),t&&(t=": "+t),b(e>=a,"missing arguemnt"+t,"MISSING_ARGUMENT",{count:e,expectedCount:a}),b(e<=a,"too many arguments"+t,"UNEXPECTED_ARGUMENT",{count:e,expectedCount:a})}const l=["NFD","NFC","NFKD","NFKC"].reduce(((e,a)=>{try{if("test"!=="test".normalize(a))throw new Error("bad");if("NFD"===a){if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken")}e.push(a)}catch(e){}return e}),[]);function u(e){b(l.indexOf(e)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:e}})}function h(e,a,t){if(null==t&&(t=""),e!==a){let e=t,a="new";t&&(e+=".",a+=" "+t),b(!1,`private constructor; use ${e}from* methods`,"UNSUPPORTED_OPERATION",{operation:a})}}},99381:(e,a,t)=>{"use strict";t.d(a,{z:()=>f});var c=t(88081);class f{filter;emitter;#Xe;constructor(e,a,t){this.#Xe=a,(0,c.n)(this,{emitter:e,filter:t})}async removeListener(){null!=this.#Xe&&await this.emitter.off(this.filter,this.#Xe)}}},26976:(e,a,t)=>{"use strict";t.d(a,{ui:()=>x});var c=t(36212),f=t(57339),d=t(88081),r=t(87303);function n(e){return async function(e,a){(0,f.vA)(null==a||!a.cancelled,"request cancelled before sending","CANCELLED");const t=e.url.split(":")[0].toLowerCase();(0,f.vA)("http"===t||"https"===t,`unsupported protocol ${t}`,"UNSUPPORTED_OPERATION",{info:{protocol:t},operation:"request"}),(0,f.vA)("https"===t||!e.credentials||e.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let c=null;const d=new AbortController,r=setTimeout((()=>{c=(0,f.xz)("request timeout","TIMEOUT"),d.abort()}),e.timeout);a&&a.addListener((()=>{c=(0,f.xz)("request cancelled","CANCELLED"),d.abort()}));const n={method:e.method,headers:new Headers(Array.from(e)),body:e.body||void 0,signal:d.signal};let i;try{i=await fetch(e.url,n)}catch(e){if(clearTimeout(r),c)throw c;throw e}clearTimeout(r);const b={};i.headers.forEach(((e,a)=>{b[a.toLowerCase()]=e}));const o=await i.arrayBuffer(),s=null==o?null:new Uint8Array(o);return{statusCode:i.status,statusMessage:i.statusText,headers:b,body:s}}}n();let i=n();const b=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),o=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let s=!1;async function l(e,a){try{const a=e.match(b);if(!a)throw new Error("invalid data");return new y(200,"OK",{"content-type":a[1]||"text/plain"},a[2]?function(e){e=atob(e);const a=new Uint8Array(e.length);for(let t=0;tString.fromCharCode(parseInt(a,16)))))))}catch(a){return new y(599,"BAD REQUEST (invalid data: URI)",{},null,new x(e))}var t}function u(e){return async function(a,t){try{const t=a.match(o);if(!t)throw new Error("invalid link");return new x(`${e}${t[2]}`)}catch(e){return new y(599,"BAD REQUEST (invalid IPFS URI)",{},null,new x(a))}}}const h={data:l,ipfs:u("https://gateway.ipfs.io/ipfs/")},p=new WeakMap;class g{#ea;#aa;constructor(e){this.#ea=[],this.#aa=!1,p.set(e,(()=>{if(!this.#aa){this.#aa=!0;for(const e of this.#ea)setTimeout((()=>{e()}),0);this.#ea=[]}}))}addListener(e){(0,f.vA)(!this.#aa,"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),this.#ea.push(e)}get cancelled(){return this.#aa}checkSignal(){(0,f.vA)(!this.cancelled,"cancelled","CANCELLED",{})}}function m(e){if(null==e)throw new Error("missing signal; should not happen");return e.checkSignal(),e}class x{#ta;#ca;#fa;#da;#ra;#e;#na;#ia;#ba;#oa;#sa;#la;#ua;#ha;#pa;get url(){return this.#e}set url(e){this.#e=String(e)}get body(){return null==this.#na?null:new Uint8Array(this.#na)}set body(e){if(null==e)this.#na=void 0,this.#ia=void 0;else if("string"==typeof e)this.#na=(0,r.YW)(e),this.#ia="text/plain";else if(e instanceof Uint8Array)this.#na=e,this.#ia="application/octet-stream";else{if("object"!=typeof e)throw new Error("invalid body");this.#na=(0,r.YW)(JSON.stringify(e)),this.#ia="application/json"}}hasBody(){return null!=this.#na}get method(){return this.#da?this.#da:this.hasBody()?"POST":"GET"}set method(e){null==e&&(e=""),this.#da=String(e).toUpperCase()}get headers(){const e=Object.assign({},this.#fa);return this.#ba&&(e.authorization=`Basic ${function(e){const a=(0,c.q5)(e);let t="";for(let e=0;e{if(t=0,"timeout must be non-zero","timeout",e),this.#ra=e}get preflightFunc(){return this.#oa||null}set preflightFunc(e){this.#oa=e}get processFunc(){return this.#sa||null}set processFunc(e){this.#sa=e}get retryFunc(){return this.#la||null}set retryFunc(e){this.#la=e}get getUrlFunc(){return this.#pa||i}set getUrlFunc(e){this.#pa=e}constructor(e){this.#e=String(e),this.#ta=!1,this.#ca=!0,this.#fa={},this.#da="",this.#ra=3e5,this.#ha={slotInterval:250,maxAttempts:12},this.#pa=null}toString(){return``}setThrottleParams(e){null!=e.slotInterval&&(this.#ha.slotInterval=e.slotInterval),null!=e.maxAttempts&&(this.#ha.maxAttempts=e.maxAttempts)}async#ga(e,a,t,c,d){if(e>=this.#ha.maxAttempts)return d.makeServerError("exceeded maximum retry limit");(0,f.vA)(A()<=a,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:c}),t>0&&await function(e){return new Promise((a=>setTimeout(a,e)))}(t);let r=this.clone();const n=(r.url.split(":")[0]||"").toLowerCase();if(n in h){const e=await h[n](r.url,m(c.#ua));if(e instanceof y){let a=e;if(this.processFunc){m(c.#ua);try{a=await this.processFunc(r,a)}catch(e){null!=e.throttle&&"number"==typeof e.stall||a.makeServerError("error in post-processing function",e).assertOk()}}return a}r=e}this.preflightFunc&&(r=await this.preflightFunc(r));const i=await this.getUrlFunc(r,m(c.#ua));let b=new y(i.statusCode,i.statusMessage,i.headers,i.body,c);if(301===b.statusCode||302===b.statusCode){try{const t=b.headers.location||"";return r.redirect(t).#ga(e+1,a,0,c,b)}catch(e){}return b}if(429===b.statusCode&&(null==this.retryFunc||await this.retryFunc(r,b,e))){const t=b.headers["retry-after"];let f=this.#ha.slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return"string"==typeof t&&t.match(/^[1-9][0-9]*$/)&&(f=parseInt(t)),r.clone().#ga(e+1,a,f,c,b)}if(this.processFunc){m(c.#ua);try{b=await this.processFunc(r,b)}catch(t){null!=t.throttle&&"number"==typeof t.stall||b.makeServerError("error in post-processing function",t).assertOk();let f=this.#ha.slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return t.stall>=0&&(f=t.stall),r.clone().#ga(e+1,a,f,c,b)}}return b}send(){return(0,f.vA)(null==this.#ua,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),this.#ua=new g(this),this.#ga(0,A()+this.timeout,0,this,new y(0,"",{},null,this))}cancel(){(0,f.vA)(null!=this.#ua,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=p.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const a=this.url.split(":")[0].toLowerCase(),t=e.split(":")[0].toLowerCase();(0,f.vA)("GET"===this.method&&("https"!==a||"http"!==t)&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const c=new x(e);return c.method="GET",c.allowGzip=this.allowGzip,c.timeout=this.timeout,c.#fa=Object.assign({},this.#fa),this.#na&&(c.#na=new Uint8Array(this.#na)),c.#ia=this.#ia,c}clone(){const e=new x(this.url);return e.#da=this.#da,this.#na&&(e.#na=this.#na),e.#ia=this.#ia,e.#fa=Object.assign({},this.#fa),e.#ba=this.#ba,this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),e.#oa=this.#oa,e.#sa=this.#sa,e.#la=this.#la,e.#ha=Object.assign({},this.#ha),e.#pa=this.#pa,e}static lockConfig(){s=!0}static getGateway(e){return h[e.toLowerCase()]||null}static registerGateway(e,a){if("http"===(e=e.toLowerCase())||"https"===e)throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(s)throw new Error("gateways locked");h[e]=a}static registerGetUrl(e){if(s)throw new Error("gateways locked");i=e}static createGetUrlFunc(e){return n()}static createDataGateway(){return l}static createIpfsGatewayFunc(e){return u(e)}}class y{#ma;#xa;#fa;#na;#ae;#ya;toString(){return``}get statusCode(){return this.#ma}get statusMessage(){return this.#xa}get headers(){return Object.assign({},this.#fa)}get body(){return null==this.#na?null:new Uint8Array(this.#na)}get bodyText(){try{return null==this.#na?"":(0,r._v)(this.#na)}catch(e){(0,f.vA)(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch(e){(0,f.vA)(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,a=Object.keys(e);let t=0;return{next:()=>{if(t(e[a.toLowerCase()]=String(t[a]),e)),{}),this.#na=null==c?null:new Uint8Array(c),this.#ae=f||null,this.#ya={message:""}}makeServerError(e,a){let t;t=e?`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${e})`:`CLIENT ESCALATED SERVER ERROR (${e=`${this.statusCode} ${this.statusMessage}`})`;const c=new y(599,t,this.headers,this.body,this.#ae||void 0);return c.#ya={message:e,error:a},c}throwThrottleError(e,a){null==a?a=-1:(0,f.MR)(Number.isInteger(a)&&a>=0,"invalid stall timeout","stall",a);const t=new Error(e||"throttling requests");throw(0,d.n)(t,{stall:a,throttle:!0}),t}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return null!=this.#na}get request(){return this.#ae}ok(){return""===this.#ya.message&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:a}=this.#ya;""===e&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let t=null;this.request&&(t=this.request.url);let c=null;try{this.#na&&(c=(0,r._v)(this.#na))}catch(e){}(0,f.vA)(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:a,info:{requestUrl:t,responseBody:c,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}}function A(){return(new Date).getTime()}},27033:(e,a,t)=>{"use strict";t.d(a,{Ab:()=>s,Dg:()=>h,JJ:()=>b,Ro:()=>g,ST:()=>i,WZ:()=>p,c4:()=>x,dK:()=>o,nD:()=>y,up:()=>m});var c=t(36212),f=t(57339);const d=BigInt(0),r=BigInt(1),n=9007199254740991;function i(e,a){const t=l(e,"value"),c=BigInt(p(a,"width"));return(0,f.vA)(t>>c===d,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:e}),t>>c-r?-((~t&(r<=-n&&e<=n,"overflow",a||"value",e),BigInt(e);case"string":try{if(""===e)throw new Error("empty string");return"-"===e[0]&&"-"!==e[1]?-BigInt(e.substring(1)):BigInt(e)}catch(t){(0,f.MR)(!1,`invalid BigNumberish string: ${t.message}`,a||"value",e)}}(0,f.MR)(!1,"invalid BigNumberish value",a||"value",e)}function l(e,a){const t=s(e,a);return(0,f.vA)(t>=d,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:e}),t}const u="0123456789abcdef";function h(e){if(e instanceof Uint8Array){let a="0x0";for(const t of e)a+=u[t>>4],a+=u[15&t];return BigInt(a)}return s(e)}function p(e,a){switch(typeof e){case"bigint":return(0,f.MR)(e>=-n&&e<=n,"overflow",a||"value",e),Number(e);case"number":return(0,f.MR)(Number.isInteger(e),"underflow",a||"value",e),(0,f.MR)(e>=-n&&e<=n,"overflow",a||"value",e),e;case"string":try{if(""===e)throw new Error("empty string");return p(BigInt(e),a)}catch(t){(0,f.MR)(!1,`invalid numeric string: ${t.message}`,a||"value",e)}}(0,f.MR)(!1,"invalid numeric value",a||"value",e)}function g(e){return p(h(e))}function m(e,a){let t=l(e,"value").toString(16);if(null==a)t.length%2&&(t="0"+t);else{const c=p(a,"width");for((0,f.vA)(2*c>=t.length,`value exceeds width (${c} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:e});t.length<2*c;)t="0"+t}return"0x"+t}function x(e){const a=l(e,"value");if(a===d)return new Uint8Array([]);let t=a.toString(16);t.length%2&&(t="0"+t);const c=new Uint8Array(t.length/2);for(let e=0;e{"use strict";function c(e,a,t){const c=a.split("|").map((e=>e.trim()));for(let t=0;tPromise.resolve(e[a]))))).reduce(((e,t,c)=>(e[a[c]]=t,e)),{})}function d(e,a,t){for(let f in a){let d=a[f];const r=t?t[f]:null;r&&c(d,r,f),Object.defineProperty(e,f,{enumerable:!0,value:d,writable:!1})}}t.d(a,{k:()=>f,n:()=>d})},65735:(e,a,t)=>{"use strict";t.d(a,{R:()=>n});var c=t(36212);function f(e){const a=[];for(;e;)a.unshift(255&e),e>>=8;return a}function d(e){if(Array.isArray(e)){let a=[];if(e.forEach((function(e){a=a.concat(d(e))})),a.length<=55)return a.unshift(192+a.length),a;const t=f(a.length);return t.unshift(247+t.length),t.concat(a)}const a=Array.prototype.slice.call((0,c.q5)(e,"object"));if(1===a.length&&a[0]<=127)return a;if(a.length<=55)return a.unshift(128+a.length),a;const t=f(a.length);return t.unshift(183+t.length),t.concat(a)}const r="0123456789abcdef";function n(e){let a="0x";for(const t of d(e))a+=r[t>>4],a+=r[15&t];return a}},99770:(e,a,t)=>{"use strict";t.d(a,{ck:()=>y,g5:()=>A,XS:()=>x});var c=t(57339),f=t(36212),d=t(27033),r=t(88081);const n=BigInt(-1),i=BigInt(0),b=BigInt(1),o=BigInt(5),s={};let l="0000";for(;l.length<80;)l+=l;function u(e){let a=l;for(;a.length=-a&&ei?(0,d.ST)((0,d.dK)(e,f),f):-(0,d.ST)((0,d.dK)(-e,f),f)}else{const a=b<=0&&enull==d[e]?t:((0,c.MR)(typeof d[e]===a,"invalid fixed format ("+e+" not "+a+")","format."+e,d[e]),d[e]);a=r("signed","boolean",a),t=r("width","number",t),f=r("decimals","number",f)}return(0,c.MR)(t%8==0,"invalid FixedNumber width (not byte aligned)","format.width",t),(0,c.MR)(f<=80,"invalid FixedNumber decimals (too large)","format.decimals",f),{signed:a,width:t,decimals:f,name:(a?"":"u")+"fixed"+String(t)+"x"+String(f)}}class g{format;#Aa;#va;#wa;_value;constructor(e,a,t){(0,c.gk)(e,s,"FixedNumber"),this.#va=a,this.#Aa=t;const f=function(e,a){let t="";e0?t*=u(c):c<0&&(a*=u(-c)),at?1:0}eq(e){return 0===this.cmp(e)}lt(e){return this.cmp(e)<0}lte(e){return this.cmp(e)<=0}gt(e){return this.cmp(e)>0}gte(e){return this.cmp(e)>=0}floor(){let e=this.#va;return this.#vai&&(e+=this.#wa-b),e=this.#va/this.#wa*this.#wa,this.#Ia(e,"ceiling")}round(e){if(null==e&&(e=0),e>=this.decimals)return this;const a=this.decimals-e,t=o*u(a-1);let c=this.value+t;const f=u(a);return c=c/f*f,h(c,this.#Aa,"round"),new g(s,c,this.#Aa)}isZero(){return this.#va===i}isNegative(){return this.#va0){const a=u(b);(0,c.vA)(n%a===i,"value loses precision for format","NUMERIC_FAULT",{operation:"fromValue",fault:"underflow",value:e}),n/=a}else b<0&&(n*=u(-b));return h(n,r,"fromValue"),new g(s,n,r)}static fromString(e,a){const t=e.match(/^(-?)([0-9]*)\.?([0-9]*)$/);(0,c.MR)(t&&t[2].length+t[3].length>0,"invalid FixedNumber string value","value",e);const f=p(a);let d=t[2]||"0",r=t[3]||"";for(;r.length=0,"invalid unit","unit",a),t=3*e}else null!=a&&(t=(0,d.WZ)(a,"unit"));return g.fromString(e,{decimals:t,width:512}).value}function y(e){return function(e){let a=18;return a=(0,d.WZ)(18,"unit"),g.fromValue(e,a,{decimals:a,width:512}).toString()}(e)}function A(e){return x(e,18)}},87303:(e,a,t)=>{"use strict";t.d(a,{YW:()=>n,_v:()=>i});var c=t(36212),f=t(57339);function d(e,a,t,c,f){if("BAD_PREFIX"===e||"UNEXPECTED_CONTINUE"===e){let e=0;for(let c=a+1;c>6==2;c++)e++;return e}return"OVERRUN"===e?t.length-a-1:0}const r=Object.freeze({error:function(e,a,t,c,d){(0,f.MR)(!1,`invalid codepoint at offset ${a}; ${e}`,"bytes",t)},ignore:d,replace:function(e,a,t,c,r){return"OVERLONG"===e?((0,f.MR)("number"==typeof r,"invalid bad code point for replacement","badCodepoint",r),c.push(r),0):(c.push(65533),d(e,a,t))}});function n(e,a){(0,f.MR)("string"==typeof e,"invalid string value","str",e),null!=a&&((0,f.SP)(a),e=e.normalize(a));let t=[];for(let a=0;a>6|192),t.push(63&c|128);else if(55296==(64512&c)){a++;const d=e.charCodeAt(a);(0,f.MR)(a>18|240),t.push(r>>12&63|128),t.push(r>>6&63|128),t.push(63&r|128)}else t.push(c>>12|224),t.push(c>>6&63|128),t.push(63&c|128)}return new Uint8Array(t)}function i(e,a){return function(e,a){null==a&&(a=r.error);const t=(0,c.q5)(e,"bytes"),f=[];let d=0;for(;d>7)){f.push(e);continue}let c=null,r=null;if(192==(224&e))c=1,r=127;else if(224==(240&e))c=2,r=2047;else{if(240!=(248&e)){d+=a(128==(192&e)?"UNEXPECTED_CONTINUE":"BAD_PREFIX",d-1,t,f);continue}c=3,r=65535}if(d-1+c>=t.length){d+=a("OVERRUN",d-1,t,f);continue}let n=e&(1<<8-c-1)-1;for(let e=0;e1114111?d+=a("OUT_OF_RANGE",d-1-c,t,f,n):n>=55296&&n<=57343?d+=a("UTF16_SURROGATE",d-1-c,t,f,n):n<=r?d+=a("OVERLONG",d-1-c,t,f,n):f.push(n))}return f}(e,a).map((e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e))))).join("")}},45238:(e,a,t)=>{"use strict";t.d(a,{K:()=>f});var c=t(75930);function f(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?(0,c.o)(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}},75007:(e,a,t)=>{"use strict";t.r(a),t.d(a,{concat:()=>d});var c=t(45238),f=t(75930);function d(e,a){a||(a=e.reduce(((e,a)=>e+a.length),0));const t=(0,c.K)(a);let d=0;for(const a of e)t.set(a,d),d+=a.length;return(0,f.o)(t)}},18402:(e,a,t)=>{"use strict";function c(e,a){if(e===a)return!0;if(e.byteLength!==a.byteLength)return!1;for(let t=0;tc})},44117:(e,a,t)=>{"use strict";t.r(a),t.d(a,{fromString:()=>d});var c=t(50040),f=t(75930);function d(e,a="utf8"){const t=c.A[a];if(!t)throw new Error(`Unsupported encoding "${a}"`);return"utf8"!==a&&"utf-8"!==a||null==globalThis.Buffer||null==globalThis.Buffer.from?t.decoder.decode(`${t.prefix}${e}`):(0,f.o)(globalThis.Buffer.from(e,"utf-8"))}},27302:(e,a,t)=>{"use strict";t.r(a),t.d(a,{toString:()=>f});var c=t(50040);function f(e,a="utf8"){const t=c.A[a];if(!t)throw new Error(`Unsupported encoding "${a}"`);return"utf8"!==a&&"utf-8"!==a||null==globalThis.Buffer||null==globalThis.Buffer.from?t.encoder.encode(e).substring(1):globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8")}},75930:(e,a,t)=>{"use strict";function c(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}t.d(a,{o:()=>c})},50040:(e,a,t)=>{"use strict";t.d(a,{A:()=>Ue});var c={};t.r(c),t.d(c,{identity:()=>M});var f={};t.r(f),t.d(f,{base2:()=>B});var d={};t.r(d),t.d(d,{base8:()=>k});var r={};t.r(r),t.d(r,{base10:()=>L});var n={};t.r(n),t.d(n,{base16:()=>S,base16upper:()=>T});var i={};t.r(i),t.d(i,{base32:()=>N,base32hex:()=>O,base32hexpad:()=>Q,base32hexpadupper:()=>U,base32hexupper:()=>F,base32pad:()=>P,base32padupper:()=>D,base32upper:()=>R,base32z:()=>j});var b={};t.r(b),t.d(b,{base36:()=>H,base36upper:()=>q});var o={};t.r(o),t.d(o,{base58btc:()=>$,base58flickr:()=>z});var s={};t.r(s),t.d(s,{base64:()=>G,base64pad:()=>K,base64url:()=>V,base64urlpad:()=>Z});var l={};t.r(l),t.d(l,{base256emoji:()=>X});var u={};t.r(u),t.d(u,{sha256:()=>ve,sha512:()=>we});var h={};t.r(h),t.d(h,{identity:()=>Ie});var p={};t.r(p),t.d(p,{code:()=>Ce,decode:()=>Be,encode:()=>Me,name:()=>Ee});var g={};t.r(g),t.d(g,{code:()=>Te,decode:()=>Re,encode:()=>Ne,name:()=>Se});const m=function(e,a){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),c=0;c>>0,r=new Uint8Array(d);e[a];){var o=t[e.charCodeAt(a)];if(255===o)return;for(var s=0,l=d-1;(0!==o||s>>0,r[l]=o%256>>>0,o=o/256>>>0;if(0!==o)throw new Error("Non-zero carry");f=s,a++}if(" "!==e[a]){for(var u=d-f;u!==d&&0===r[u];)u++;for(var h=new Uint8Array(c+(d-u)),p=c;u!==d;)h[p++]=r[u++];return h}}}return{encode:function(a){if(a instanceof Uint8Array||(ArrayBuffer.isView(a)?a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength):Array.isArray(a)&&(a=Uint8Array.from(a))),!(a instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===a.length)return"";for(var t=0,c=0,f=0,d=a.length;f!==d&&0===a[f];)f++,t++;for(var r=(d-f)*o+1>>>0,b=new Uint8Array(r);f!==d;){for(var s=a[f],l=0,u=r-1;(0!==s||l>>0,b[u]=s%n>>>0,s=s/n>>>0;if(0!==s)throw new Error("Non-zero carry");c=l,f++}for(var h=r-c;h!==r&&0===b[h];)h++;for(var p=i.repeat(t);h{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")});class y{constructor(e,a,t){this.name=e,this.prefix=a,this.baseEncode=t}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class A{constructor(e,a,t){if(this.name=e,this.prefix=a,void 0===a.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=a.codePointAt(0),this.baseDecode=t}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return w(this,e)}}class v{constructor(e){this.decoders=e}or(e){return w(this,e)}decode(e){const a=e[0],t=this.decoders[a];if(t)return t.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const w=(e,a)=>new v({...e.decoders||{[e.prefix]:e},...a.decoders||{[a.prefix]:a}});class _{constructor(e,a,t,c){this.name=e,this.prefix=a,this.baseEncode=t,this.baseDecode=c,this.encoder=new y(e,a,t),this.decoder=new A(e,a,c)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const I=({name:e,prefix:a,encode:t,decode:c})=>new _(e,a,t,c),E=({prefix:e,name:a,alphabet:t})=>{const{encode:c,decode:f}=m(t,a);return I({prefix:e,name:a,encode:c,decode:e=>x(f(e))})},C=({name:e,prefix:a,bitsPerChar:t,alphabet:c})=>I({prefix:a,name:e,encode:e=>((e,a,t)=>{const c="="===a[a.length-1],f=(1<t;)r-=t,d+=a[f&n>>r];if(r&&(d+=a[f&n<((e,a,t,c)=>{const f={};for(let e=0;e=8&&(n-=8,r[b++]=255&i>>n)}if(n>=t||255&i<<8-n)throw new SyntaxError("Unexpected end of data");return r})(a,c,t,e)}),M=I({prefix:"\0",name:"identity",encode:e=>{return a=e,(new TextDecoder).decode(a);var a},decode:e=>(e=>(new TextEncoder).encode(e))(e)}),B=C({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),k=C({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),L=E({prefix:"9",name:"base10",alphabet:"0123456789"}),S=C({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),T=C({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),N=C({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),R=C({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),P=C({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),D=C({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),O=C({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),F=C({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Q=C({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),U=C({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),j=C({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),H=E({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),q=E({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),$=E({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),z=E({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),G=C({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),K=C({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),V=C({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Z=C({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),J=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),W=J.reduce(((e,a,t)=>(e[t]=a,e)),[]),Y=J.reduce(((e,a,t)=>(e[a.codePointAt(0)]=t,e)),[]),X=I({prefix:"🚀",name:"base256emoji",encode:function(e){return e.reduce(((e,a)=>e+W[a]),"")},decode:function(e){const a=[];for(const t of e){const e=Y[t.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${t}`);a.push(e)}return new Uint8Array(a)}});var ee=128,ae=-128,te=Math.pow(2,31),ce=Math.pow(2,7),fe=Math.pow(2,14),de=Math.pow(2,21),re=Math.pow(2,28),ne=Math.pow(2,35),ie=Math.pow(2,42),be=Math.pow(2,49),oe=Math.pow(2,56),se=Math.pow(2,63);const le=function e(a,t,c){t=t||[];for(var f=c=c||0;a>=te;)t[c++]=255&a|ee,a/=128;for(;a&ae;)t[c++]=255&a|ee,a>>>=7;return t[c]=0|a,e.bytes=c-f+1,t},ue=function(e){return e(le(e,a,t),a),pe=e=>ue(e),ge=(e,a)=>{const t=a.byteLength,c=pe(e),f=c+pe(t),d=new Uint8Array(f+t);return he(e,d,0),he(t,d,c),d.set(a,f),new me(e,t,a,d)};class me{constructor(e,a,t,c){this.code=e,this.size=a,this.digest=t,this.bytes=c}}const xe=({name:e,code:a,encode:t})=>new ye(e,a,t);class ye{constructor(e,a,t){this.name=e,this.code=a,this.encode=t}digest(e){if(e instanceof Uint8Array){const a=this.encode(e);return a instanceof Uint8Array?ge(this.code,a):a.then((e=>ge(this.code,e)))}throw Error("Unknown type, must be binary type")}}const Ae=e=>async a=>new Uint8Array(await crypto.subtle.digest(e,a)),ve=xe({name:"sha2-256",code:18,encode:Ae("SHA-256")}),we=xe({name:"sha2-512",code:19,encode:Ae("SHA-512")}),_e=x,Ie={code:0,name:"identity",encode:_e,digest:e=>ge(0,_e(e))},Ee="raw",Ce=85,Me=e=>x(e),Be=e=>x(e),ke=new TextEncoder,Le=new TextDecoder,Se="json",Te=512,Ne=e=>ke.encode(JSON.stringify(e)),Re=e=>JSON.parse(Le.decode(e));Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom"),Symbol.for("@ipld/js-cid/CID");const Pe={...c,...f,...d,...r,...n,...i,...b,...o,...s,...l};var De=t(45238);function Oe(e,a,t,c){return{name:e,prefix:a,encoder:{name:e,prefix:a,encode:t},decoder:{decode:c}}}const Fe=Oe("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),Qe=Oe("ascii","a",(e=>{let a="a";for(let t=0;t{e=e.substring(1);const a=(0,De.K)(e.length);for(let t=0;t{"use strict";e.exports=JSON.parse('{"$id":"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON AnySchema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}')},72079:e=>{"use strict";e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')},3219:e=>{"use strict";e.exports=JSON.parse('{"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}')},62951:e=>{"use strict";e.exports=JSON.parse('{"sha224WithRSAEncryption":{"sign":"rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"RSA-SHA224":{"sign":"ecdsa/rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"sha256WithRSAEncryption":{"sign":"rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"RSA-SHA256":{"sign":"ecdsa/rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"sha384WithRSAEncryption":{"sign":"rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"RSA-SHA384":{"sign":"ecdsa/rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"sha512WithRSAEncryption":{"sign":"rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA512":{"sign":"ecdsa/rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA1":{"sign":"rsa","hash":"sha1","id":"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{"sign":"ecdsa","hash":"sha1","id":""},"sha256":{"sign":"ecdsa","hash":"sha256","id":""},"sha224":{"sign":"ecdsa","hash":"sha224","id":""},"sha384":{"sign":"ecdsa","hash":"sha384","id":""},"sha512":{"sign":"ecdsa","hash":"sha512","id":""},"DSA-SHA":{"sign":"dsa","hash":"sha1","id":""},"DSA-SHA1":{"sign":"dsa","hash":"sha1","id":""},"DSA":{"sign":"dsa","hash":"sha1","id":""},"DSA-WITH-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-WITH-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-WITH-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-WITH-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-RIPEMD160":{"sign":"dsa","hash":"rmd160","id":""},"ripemd160WithRSA":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"RSA-RIPEMD160":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"md5WithRSAEncryption":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"},"RSA-MD5":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"}}')},64589:e=>{"use strict";e.exports=JSON.parse('{"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}')},23241:e=>{"use strict";e.exports=JSON.parse('{"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}')},1636:e=>{"use strict";e.exports={rE:"6.5.7"}},15579:e=>{"use strict";e.exports=JSON.parse('{"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}')}},__webpack_module_cache__={};function __webpack_require__(e){var a=__webpack_module_cache__[e];if(void 0!==a)return a.exports;var t=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e].call(t.exports,t,t.exports,__webpack_require__),t.loaded=!0,t.exports}__webpack_require__.amdO={},__webpack_require__.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(a,{a}),a},__webpack_require__.d=(e,a)=>{for(var t in a)__webpack_require__.o(a,t)&&!__webpack_require__.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:a[t]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var __webpack_exports__={};return(()=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{BatchBlockService:()=>f.B3,BatchEventsService:()=>f.JY,BatchTransactionService:()=>f.AF,Deposit:()=>d.dA,ENSNameWrapper__factory:()=>c.rZ,ENSRegistry__factory:()=>c.S4,ENSResolver__factory:()=>c.BB,ENSUtils:()=>n.gH,ENS__factory:()=>c.p2,ERC20__factory:()=>c.Xc,EnsContracts:()=>n.A6,INDEX_DB_ERROR:()=>s.Fl,IndexedDB:()=>s.mc,Invoice:()=>d.qO,MAX_FEE:()=>v.KN,MAX_TOVARISH_EVENTS:()=>_.o,MIN_FEE:()=>v.Ss,MIN_STAKE_BALANCE:()=>v.pO,MerkleTreeService:()=>u.s,Mimc:()=>h.p,Multicall__factory:()=>c.Q2,NetId:()=>g.zr,NoteAccount:()=>r.Ad,OffchainOracle__factory:()=>c.Hk,OvmGasPriceOracle__factory:()=>c.Ld,Pedersen:()=>m.Hr,RelayerClient:()=>v.OR,ReverseRecords__factory:()=>c.Rp,TokenPriceOracle:()=>y.T,TornadoBrowserProvider:()=>A.D2,TornadoFeeOracle:()=>i.o,TornadoRpcSigner:()=>A.Vr,TornadoVoidSigner:()=>A.Gd,TornadoWallet:()=>A.nA,TovarishClient:()=>_.E,addNetwork:()=>g.AE,addressSchemaType:()=>t.SC,ajv:()=>t.SS,base64ToBytes:()=>I.Kp,bigIntReplacer:()=>I.gn,bnSchemaType:()=>t.iL,bnToBytes:()=>I.jm,buffPedersenHash:()=>m.UB,bufferToBytes:()=>I.lY,bytes32BNSchemaType:()=>t.i1,bytes32SchemaType:()=>t.yF,bytesToBN:()=>I.Ju,bytesToBase64:()=>I.if,bytesToHex:()=>I.My,calculateScore:()=>v.zy,calculateSnarkProof:()=>E.i,chunk:()=>I.iv,concatBytes:()=>I.Id,convertETHToTokenAmount:()=>i.N,createDeposit:()=>d.Hr,crypto:()=>I.Et,customConfig:()=>g.cX,defaultConfig:()=>g.sb,defaultUserAgent:()=>A.mJ,deployHasher:()=>o.l,depositsEventsSchema:()=>t.CI,digest:()=>I.br,downloadZip:()=>C._6,echoEventsSchema:()=>t.ME,enabledChains:()=>g.Af,encodedLabelToLabelhash:()=>n.qX,encryptedNotesSchema:()=>t.XW,factories:()=>c.XB,fetchData:()=>A.Fd,fetchGetUrlFunc:()=>A.uY,fetchIp:()=>l.W,fromContentHash:()=>I.yp,gasZipID:()=>b.Qx,gasZipInbounds:()=>b.dT,gasZipInput:()=>b.x5,gasZipMinMax:()=>b.X,getActiveTokenInstances:()=>g.oY,getActiveTokens:()=>g.h9,getConfig:()=>g.zj,getEventsSchemaValidator:()=>t.ZC,getHttpAgent:()=>A.WU,getIndexedDB:()=>s.W7,getInstanceByAddress:()=>g.Zh,getMultiInstances:()=>g.sX,getNetworkConfig:()=>g.RY,getPermit2CommitmentsSignature:()=>x.Sl,getPermit2Signature:()=>x.KM,getPermitCommitmentsSignature:()=>x.sx,getPermitSignature:()=>x.id,getProvider:()=>A.sO,getProviderWithNetId:()=>A.MF,getRelayerEnsSubdomains:()=>g.o2,getStatusSchema:()=>t.c_,getSubInfo:()=>f.vS,getSupportedInstances:()=>v.XF,getTokenBalances:()=>w.H,getWeightRandom:()=>v.c$,governanceEventsSchema:()=>t.FR,hasherBytecode:()=>o.B,hexToBytes:()=>I.aT,initGroth16:()=>E.O,isHex:()=>I.qv,isNode:()=>I.Ll,jobRequestSchema:()=>t.Yq,jobsSchema:()=>t.Us,labelhash:()=>n.Lr,leBuff2Int:()=>I.ae,leInt2Buff:()=>I.EI,makeLabelNodeAndParent:()=>n.QP,mimc:()=>h.f,multiQueryFilter:()=>f.QL,multicall:()=>p.C,numberFormatter:()=>I.Eg,packEncryptedMessage:()=>r.Fr,parseInvoice:()=>d.Ps,parseNote:()=>d.wd,pedersen:()=>m.NO,permit2Address:()=>x.CS,pickWeightedRandomRelayer:()=>v.sN,populateTransaction:()=>A.zr,proofSchemaType:()=>t.Y6,rBigInt:()=>I.ib,rHex:()=>I.G9,relayerRegistryEventsSchema:()=>t.cl,sleep:()=>I.yy,stakeBurnedEventsSchema:()=>t.Fz,substring:()=>I.uU,toContentHash:()=>I.vd,toFixedHex:()=>I.$W,toFixedLength:()=>I.sY,tornadoEventsSchema:()=>t.U7,unpackEncryptedMessage:()=>r.ol,unzipAsync:()=>C.fY,validateUrl:()=>I.wv,withdrawalsEventsSchema:()=>t.$j,zipAsync:()=>C.a8});var e=__webpack_require__(94513),a={};for(const t in e)"default"!==t&&(a[t]=()=>e[t]);__webpack_require__.d(__webpack_exports__,a);var t=__webpack_require__(59511),c=__webpack_require__(62463),f=__webpack_require__(9723),d=__webpack_require__(7240),r=__webpack_require__(33298),n=__webpack_require__(16795),i=__webpack_require__(37182),b=__webpack_require__(56079),o=__webpack_require__(49540),s=__webpack_require__(83968),l=__webpack_require__(57390),u=__webpack_require__(5217),h=__webpack_require__(22901),p=__webpack_require__(48486),g=__webpack_require__(59499),m=__webpack_require__(85111),x=__webpack_require__(1180),y=__webpack_require__(34525),A=__webpack_require__(46170),v=__webpack_require__(57194),w=__webpack_require__(7393),_=__webpack_require__(96838),I=__webpack_require__(67418),E=__webpack_require__(26746),C=__webpack_require__(18995)})(),__webpack_exports__})())); \ No newline at end of file diff --git a/dist/tornado.umd.min.js.LICENSE.txt b/dist/tornado.umd.min.js.LICENSE.txt new file mode 100644 index 0000000..83b1ddd --- /dev/null +++ b/dist/tornado.umd.min.js.LICENSE.txt @@ -0,0 +1,34 @@ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ + +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ + +/*! MIT License. Copyright 2015-2022 Richard Moore . See LICENSE.txt. */ + +/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ + +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + +/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + +/*! safe-buffer. MIT License. Feross Aboukhadijeh */ + +/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + +/** + * [js-sha3]{@link https://github.com/emn178/js-sha3} + * + * @version 0.8.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2015-2018 + * @license MIT + */ diff --git a/dist/tornadoContracts.umd.js b/dist/tornadoContracts.umd.js new file mode 100644 index 0000000..5d84f2b --- /dev/null +++ b/dist/tornadoContracts.umd.js @@ -0,0 +1,43474 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["TornadoContracts"] = factory(); + else + root["TornadoContracts"] = factory(); +})(self, () => { +return /******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ // The require scope +/******/ var __webpack_require__ = {}; +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// ESM COMPAT FLAG +__webpack_require__.r(__webpack_exports__); + +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + AdminUpgradeableProxy__factory: () => (/* reexport */ AdminUpgradeableProxy__factory), + Aggregator__factory: () => (/* reexport */ Aggregator__factory), + AirdropMock__factory: () => (/* reexport */ AirdropMock__factory), + Airdrop__factory: () => (/* reexport */ Airdrop__factory), + BadRecipient__factory: () => (/* reexport */ BadRecipient__factory), + CTornado__factory: () => (/* reexport */ CTornado__factory), + Configuration__factory: () => (/* reexport */ Configuration__factory), + Core__factory: () => (/* reexport */ Core__factory), + Delegation__factory: () => (/* reexport */ Delegation__factory), + Deployer__factory: () => (/* reexport */ Deployer__factory), + DummySecond__factory: () => (/* reexport */ DummySecond__factory), + Dummy__factory: () => (/* reexport */ Dummy__factory), + ECDSA__factory: () => (/* reexport */ ECDSA__factory), + EIP712__factory: () => (/* reexport */ EIP712__factory), + ENSMock__factory: () => (/* reexport */ ENSMock__factory), + ENSNameWrapper: () => (/* reexport */ typechain_namespaceObject.ENSNameWrapper), + ENSNameWrapper__factory: () => (/* reexport */ ENSNameWrapper__factory), + ENSRegistry: () => (/* reexport */ typechain_namespaceObject.ENSRegistry), + ENSRegistry__factory: () => (/* reexport */ ENSRegistry__factory), + ENSResolver: () => (/* reexport */ typechain_namespaceObject.ENSResolver), + ENSResolver__factory: () => (/* reexport */ ENSResolver__factory), + ENS__factory: () => (/* reexport */ ENS__factory), + ERC20Basic__factory: () => (/* reexport */ ERC20Basic__factory), + ERC20Burnable__factory: () => (/* reexport */ ERC20Burnable__factory), + ERC20Mock__factory: () => (/* reexport */ ERC20Mock__factory), + ERC20Permit__factory: () => (/* reexport */ ERC20Permit__factory$1), + ERC20Tornado__factory: () => (/* reexport */ ERC20Tornado__factory), + ERC20__factory: () => (/* reexport */ ERC20__factory), + ETHTornado__factory: () => (/* reexport */ ETHTornado__factory), + Echoer__factory: () => (/* reexport */ Echoer__factory), + EnsResolve__factory: () => (/* reexport */ EnsResolve__factory), + FeeManager__factory: () => (/* reexport */ FeeManager__factory), + GasCompensationVault__factory: () => (/* reexport */ GasCompensationVault__factory), + GasCompensator__factory: () => (/* reexport */ GasCompensator__factory), + GovernanceAggregator__factory: () => (/* reexport */ GovernanceAggregator__factory), + GovernanceExploitPatchUpgrade__factory: () => (/* reexport */ GovernanceExploitPatchUpgrade__factory), + GovernanceGasUpgrade__factory: () => (/* reexport */ GovernanceGasUpgrade__factory), + GovernanceProposalStateUpgrade__factory: () => (/* reexport */ GovernanceProposalStateUpgrade__factory), + GovernanceStakingUpgrade__factory: () => (/* reexport */ GovernanceStakingUpgrade__factory), + GovernanceVaultUpgrade__factory: () => (/* reexport */ GovernanceVaultUpgrade__factory), + Governance__factory: () => (/* reexport */ Governance__factory), + IChainlinkOracle__factory: () => (/* reexport */ IChainlinkOracle__factory), + IDeployer__factory: () => (/* reexport */ IDeployer__factory$1), + IENSRegistry__factory: () => (/* reexport */ IENSRegistry__factory), + IENSResolver__factory: () => (/* reexport */ IENSResolver__factory), + IENS__factory: () => (/* reexport */ IENS__factory), + IERC1155Errors__factory: () => (/* reexport */ IERC1155Errors__factory), + IERC20Decimals__factory: () => (/* reexport */ IERC20Decimals__factory), + IERC20Errors__factory: () => (/* reexport */ IERC20Errors__factory), + IERC20Metadata__factory: () => (/* reexport */ IERC20Metadata__factory), + IERC20Permit__factory: () => (/* reexport */ IERC20Permit__factory), + IERC20__factory: () => (/* reexport */ IERC20__factory$1), + IERC5267__factory: () => (/* reexport */ IERC5267__factory), + IERC721Errors__factory: () => (/* reexport */ IERC721Errors__factory), + IFeeManager__factory: () => (/* reexport */ IFeeManager__factory), + IGasCompensationVault__factory: () => (/* reexport */ IGasCompensationVault__factory), + IGovernance__factory: () => (/* reexport */ IGovernance__factory), + IHasher__factory: () => (/* reexport */ IHasher__factory), + IMetamorphicContractFactory__factory: () => (/* reexport */ IMetamorphicContractFactory__factory), + IOffchainOracle__factory: () => (/* reexport */ IOffchainOracle__factory), + IProxy__factory: () => (/* reexport */ IProxy__factory), + IRelayerRegistry__factory: () => (/* reexport */ IRelayerRegistry__factory), + ISignatureTransfer__factory: () => (/* reexport */ ISignatureTransfer__factory), + ITornadoGovernance__factory: () => (/* reexport */ ITornadoGovernance__factory), + ITornadoInstance__factory: () => (/* reexport */ ITornadoInstance__factory$1), + ITornadoRouter__factory: () => (/* reexport */ ITornadoRouter__factory), + ITornadoStakingRewards__factory: () => (/* reexport */ ITornadoStakingRewards__factory), + ITornadoVault__factory: () => (/* reexport */ ITornadoVault__factory$1), + IUSDT__factory: () => (/* reexport */ IUSDT__factory), + IUniswapV3Factory__factory: () => (/* reexport */ IUniswapV3Factory__factory), + IUniswapV3PoolActions__factory: () => (/* reexport */ IUniswapV3PoolActions__factory), + IUniswapV3PoolDerivedState__factory: () => (/* reexport */ IUniswapV3PoolDerivedState__factory), + IUniswapV3PoolEvents__factory: () => (/* reexport */ IUniswapV3PoolEvents__factory), + IUniswapV3PoolImmutables__factory: () => (/* reexport */ IUniswapV3PoolImmutables__factory), + IUniswapV3PoolOwnerActions__factory: () => (/* reexport */ IUniswapV3PoolOwnerActions__factory), + IUniswapV3PoolState__factory: () => (/* reexport */ IUniswapV3PoolState__factory), + IUniswapV3Pool__factory: () => (/* reexport */ IUniswapV3Pool__factory), + IVerifier__factory: () => (/* reexport */ IVerifier__factory), + InitialProposal__factory: () => (/* reexport */ InitialProposal__factory), + InstanceRegistry__factory: () => (/* reexport */ InstanceRegistry__factory), + LoopbackProxy__factory: () => (/* reexport */ LoopbackProxy__factory), + MaliciousProposal__factory: () => (/* reexport */ MaliciousProposal__factory), + Math__factory: () => (/* reexport */ Math__factory), + MerkleTreeWithHistoryMock__factory: () => (/* reexport */ MerkleTreeWithHistoryMock__factory), + MerkleTreeWithHistory__factory: () => (/* reexport */ MerkleTreeWithHistory__factory), + MockGovernance__factory: () => (/* reexport */ MockGovernance__factory), + Multicall: () => (/* reexport */ typechain_namespaceObject.Multicall), + Multicall__factory: () => (/* reexport */ Multicall__factory), + NewImplementation__factory: () => (/* reexport */ NewImplementation__factory), + Nonces__factory: () => (/* reexport */ Nonces__factory), + OffchainOracle: () => (/* reexport */ typechain_namespaceObject.OffchainOracle), + OffchainOracle__factory: () => (/* reexport */ OffchainOracle__factory), + OvmGasPriceOracle: () => (/* reexport */ typechain_namespaceObject.OvmGasPriceOracle), + OvmGasPriceOracle__factory: () => (/* reexport */ OvmGasPriceOracle__factory), + Ownable__factory: () => (/* reexport */ Ownable__factory), + PatchProposal__factory: () => (/* reexport */ PatchProposal__factory), + Pausable__factory: () => (/* reexport */ Pausable__factory), + Permit2Mock__factory: () => (/* reexport */ Permit2Mock__factory), + PermitTornado__factory: () => (/* reexport */ PermitTornado__factory), + ProposalStateChangeGovernance__factory: () => (/* reexport */ ProposalStateChangeGovernance__factory), + ProposalUpgrade__factory: () => (/* reexport */ ProposalUpgrade__factory), + Proposal__factory: () => (/* reexport */ Proposal__factory), + Proxy__factory: () => (/* reexport */ Proxy__factory), + RelayerAggregator__factory: () => (/* reexport */ RelayerAggregator__factory), + RelayerRegistry__factory: () => (/* reexport */ RelayerRegistry__factory), + Resolver__factory: () => (/* reexport */ Resolver__factory), + ReverseRecords: () => (/* reexport */ typechain_namespaceObject.ReverseRecords), + ReverseRecords__factory: () => (/* reexport */ ReverseRecords__factory), + ShortStrings__factory: () => (/* reexport */ ShortStrings__factory), + SingletonFactory__factory: () => (/* reexport */ SingletonFactory__factory), + Strings__factory: () => (/* reexport */ Strings__factory), + TORNMock__factory: () => (/* reexport */ TORNMock__factory), + TORN__factory: () => (/* reexport */ TORN__factory), + TestnetAdminProxy__factory: () => (/* reexport */ TestnetAdminProxy__factory), + TestnetFeeManager__factory: () => (/* reexport */ TestnetFeeManager__factory), + TestnetGovernanceProxy__factory: () => (/* reexport */ TestnetGovernanceProxy__factory), + TestnetOracle__factory: () => (/* reexport */ TestnetOracle__factory), + Timestamp__factory: () => (/* reexport */ Timestamp__factory), + TornadoProxyLight__factory: () => (/* reexport */ TornadoProxyLight__factory), + TornadoRouter__factory: () => (/* reexport */ TornadoRouter__factory), + TornadoStakingRewards__factory: () => (/* reexport */ TornadoStakingRewards__factory), + TornadoVault__factory: () => (/* reexport */ TornadoVault__factory), + Tornado__factory: () => (/* reexport */ Tornado__factory), + TransparentUpgradeableProxy__factory: () => (/* reexport */ TransparentUpgradeableProxy__factory), + UpgradeableProxy__factory: () => (/* reexport */ UpgradeableProxy__factory), + Verifier__factory: () => (/* reexport */ Verifier__factory), + VestingMock__factory: () => (/* reexport */ VestingMock__factory), + Vesting__factory: () => (/* reexport */ Vesting__factory), + VoucherMock__factory: () => (/* reexport */ VoucherMock__factory), + Voucher__factory: () => (/* reexport */ Voucher__factory), + factories: () => (/* reexport */ index) +}); + +// NAMESPACE OBJECT: ./src/typechain/index.ts +var typechain_namespaceObject = {}; +__webpack_require__.r(typechain_namespaceObject); +__webpack_require__.d(typechain_namespaceObject, { + rZ: () => (ENSNameWrapper__factory), + S4: () => (ENSRegistry__factory), + BB: () => (ENSResolver__factory), + Q2: () => (Multicall__factory), + Hk: () => (OffchainOracle__factory), + Ld: () => (OvmGasPriceOracle__factory), + Rp: () => (ReverseRecords__factory) +}); + +;// ./node_modules/@noble/hashes/esm/_assert.js +function number(n) { + if (!Number.isSafeInteger(n) || n < 0) + throw new Error(`Wrong positive integer: ${n}`); +} +function bool(b) { + if (typeof b !== 'boolean') + throw new Error(`Expected boolean, not ${b}`); +} +function bytes(b, ...lengths) { + if (!(b instanceof Uint8Array)) + throw new Error('Expected Uint8Array'); + if (lengths.length > 0 && !lengths.includes(b.length)) + throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`); +} +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); +} +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'); +} +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}`); + } +} + +const assert = { number, bool, bytes, hash, exists, output }; +/* harmony default export */ const _assert = ((/* unused pure expression or super */ null && (assert))); +//# sourceMappingURL=_assert.js.map +;// ./node_modules/@noble/hashes/esm/_u64.js +const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1); +const _32n = /* @__PURE__ */ 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 }; +} +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]; +} +const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0); +// 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. +function add(Ah, Al, Bh, Bl) { + const l = (Al >>> 0) + (Bl >>> 0); + return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 }; +} +// 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 + +// prettier-ignore +const u64 = { + fromBig, split, toBig, + shrSH, shrSL, + rotrSH, rotrSL, rotrBH, rotrBL, + rotr32H, rotr32L, + rotlSH, rotlSL, rotlBH, rotlBL, + add, add3L, add3H, add4L, add4H, add5H, add5L, +}; +/* harmony default export */ const _u64 = ((/* unused pure expression or super */ null && (u64))); +//# sourceMappingURL=_u64.js.map +;// ./node_modules/@noble/hashes/esm/utils.js +/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+. +// 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 u8a = (a) => a instanceof Uint8Array; +// Cast array to different type +const u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength); +const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); +// Cast array to view +const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength); +// The rotate right (circular right shift) operation for uint32 +const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift); +// 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. +const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44; +if (!isLE) + throw new Error('Non little-endian hardware is not supported'); +const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0')); +/** + * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123' + */ +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; +} +/** + * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23]) + */ +function hexToBytes(hex) { + if (typeof hex !== 'string') + throw new Error('hex string expected, got ' + typeof hex); + const len = hex.length; + if (len % 2) + throw new Error('padded hex string expected, got unpadded hex of length ' + len); + const array = new Uint8Array(len / 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; +} +// 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 () => { }; +// 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 nextTick(); + ts += diff; + } +} +/** + * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) + */ +function utf8ToBytes(str) { + if (typeof str !== 'string') + throw new Error(`utf8ToBytes expected string, got ${typeof str}`); + return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809 +} +/** + * Normalizes (non-hex) string or Uint8Array to Uint8Array. + * Warning: when Uint8Array is passed, it would NOT get copied. + * Keep in mind for future mutable operations. + */ +function toBytes(data) { + if (typeof data === 'string') + data = utf8ToBytes(data); + if (!u8a(data)) + throw new Error(`expected Uint8Array, got ${typeof data}`); + return data; +} +/** + * Copies several Uint8Arrays into one. + */ +function concatBytes(...arrays) { + const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0)); + let pad = 0; // walk through each item, ensure they have proper type + arrays.forEach((a) => { + if (!u8a(a)) + throw new Error('Uint8Array expected'); + r.set(a, pad); + pad += a.length; + }); + return r; +} +// For runtime check if class implements interface +class Hash { + // Safe version that clones internal state + clone() { + return this._cloneInto(); + } +} +const toStr = {}.toString; +function checkOpts(defaults, opts) { + if (opts !== undefined && toStr.call(opts) !== '[object Object]') + throw new Error('Options should be object or undefined'); + const merged = Object.assign(defaults, opts); + return merged; +} +function wrapConstructor(hashCons) { + const hashC = (msg) => hashCons().update(toBytes(msg)).digest(); + const tmp = hashCons(); + hashC.outputLen = tmp.outputLen; + hashC.blockLen = tmp.blockLen; + hashC.create = () => hashCons(); + return hashC; +} +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; +} +function utils_wrapXOFConstructorWithOpts(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; +} +/** + * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS. + */ +function randomBytes(bytesLength = 32) { + if (crypto && typeof crypto.getRandomValues === 'function') { + return crypto.getRandomValues(new Uint8Array(bytesLength)); + } + throw new Error('crypto.getRandomValues must be defined'); +} +//# sourceMappingURL=utils.js.map +;// ./node_modules/@noble/hashes/esm/sha3.js + + + +// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size. +// It's called a sponge function. +// Various per round constants calculations +const [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []]; +const _0n = /* @__PURE__ */ BigInt(0); +const _1n = /* @__PURE__ */ BigInt(1); +const _2n = /* @__PURE__ */ BigInt(2); +const _7n = /* @__PURE__ */ BigInt(7); +const _256n = /* @__PURE__ */ BigInt(256); +const _0x71n = /* @__PURE__ */ 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 << /* @__PURE__ */ BigInt(j)) - _1n); + } + _SHA3_IOTA.push(t); +} +const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true); +// Left rotation (without 0, 32, 64) +const rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s)); +const rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : 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); +} +class Keccak extends 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 + 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 = u32(this.state); + } + keccak() { + keccakP(this.state32, this.rounds); + this.posOut = 0; + this.pos = 0; + } + update(data) { + exists(this); + const { blockLen, state } = this; + data = 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) { + exists(this, false); + 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) { + number(bytes); + return this.xofInto(new Uint8Array(bytes)); + } + digestInto(out) { + 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; + } +} +const gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen)); +const sha3_224 = /* @__PURE__ */ (/* unused pure expression or super */ null && (gen(0x06, 144, 224 / 8))); +/** + * SHA3-256 hash function + * @param message - that would be hashed + */ +const sha3_256 = /* @__PURE__ */ (/* unused pure expression or super */ null && (gen(0x06, 136, 256 / 8))); +const sha3_384 = /* @__PURE__ */ (/* unused pure expression or super */ null && (gen(0x06, 104, 384 / 8))); +const sha3_512 = /* @__PURE__ */ (/* unused pure expression or super */ null && (gen(0x06, 72, 512 / 8))); +const keccak_224 = /* @__PURE__ */ (/* unused pure expression or super */ null && (gen(0x01, 144, 224 / 8))); +/** + * keccak-256 hash function. Different from SHA3-256. + * @param message - that would be hashed + */ +const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8); +const keccak_384 = /* @__PURE__ */ (/* unused pure expression or super */ null && (gen(0x01, 104, 384 / 8))); +const keccak_512 = /* @__PURE__ */ (/* unused pure expression or super */ null && (gen(0x01, 72, 512 / 8))); +const genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true)); +const shake128 = /* @__PURE__ */ (/* unused pure expression or super */ null && (genShake(0x1f, 168, 128 / 8))); +const shake256 = /* @__PURE__ */ (/* unused pure expression or super */ null && (genShake(0x1f, 136, 256 / 8))); +//# sourceMappingURL=sha3.js.map +;// ./node_modules/ethers/lib.esm/_version.js +/* Do NOT modify this file; see /src.ts/_admin/update-version.ts */ +/** + * The current version of Ethers. + */ +const version = "6.13.4"; +//# sourceMappingURL=_version.js.map +;// ./node_modules/ethers/lib.esm/utils/properties.js +/** + * Property helper functions. + * + * @_subsection api/utils:Properties [about-properties] + */ +function checkType(value, type, name) { + const types = type.split("|").map(t => t.trim()); + for (let i = 0; i < types.length; i++) { + switch (type) { + case "any": + return; + case "bigint": + case "boolean": + case "number": + case "string": + if (typeof (value) === type) { + return; + } + } + } + const error = new Error(`invalid value for type ${type}`); + error.code = "INVALID_ARGUMENT"; + error.argument = `value.${name}`; + error.value = value; + throw error; +} +/** + * Resolves to a new object that is a copy of %%value%%, but with all + * values resolved. + */ +async function resolveProperties(value) { + const keys = Object.keys(value); + const results = await Promise.all(keys.map((k) => Promise.resolve(value[k]))); + return results.reduce((accum, v, index) => { + accum[keys[index]] = v; + return accum; + }, {}); +} +/** + * Assigns the %%values%% to %%target%% as read-only values. + * + * It %%types%% is specified, the values are checked. + */ +function properties_defineProperties(target, values, types) { + for (let key in values) { + let value = values[key]; + const type = (types ? types[key] : null); + if (type) { + checkType(value, type, key); + } + Object.defineProperty(target, key, { enumerable: true, value, writable: false }); + } +} +//# sourceMappingURL=properties.js.map +;// ./node_modules/ethers/lib.esm/utils/errors.js +/** + * All errors in ethers include properties to ensure they are both + * human-readable (i.e. ``.message``) and machine-readable (i.e. ``.code``). + * + * The [[isError]] function can be used to check the error ``code`` and + * provide a type guard for the properties present on that error interface. + * + * @_section: api/utils/errors:Errors [about-errors] + */ + + +function stringify(value) { + if (value == null) { + return "null"; + } + if (Array.isArray(value)) { + return "[ " + (value.map(stringify)).join(", ") + " ]"; + } + if (value instanceof Uint8Array) { + const HEX = "0123456789abcdef"; + let result = "0x"; + for (let i = 0; i < value.length; i++) { + result += HEX[value[i] >> 4]; + result += HEX[value[i] & 0xf]; + } + return result; + } + if (typeof (value) === "object" && typeof (value.toJSON) === "function") { + return stringify(value.toJSON()); + } + switch (typeof (value)) { + case "boolean": + case "symbol": + return value.toString(); + case "bigint": + return BigInt(value).toString(); + case "number": + return (value).toString(); + case "string": + return JSON.stringify(value); + case "object": { + const keys = Object.keys(value); + keys.sort(); + return "{ " + keys.map((k) => `${stringify(k)}: ${stringify(value[k])}`).join(", ") + " }"; + } + } + return `[ COULD NOT SERIALIZE ]`; +} +/** + * Returns true if the %%error%% matches an error thrown by ethers + * that matches the error %%code%%. + * + * In TypeScript environments, this can be used to check that %%error%% + * matches an EthersError type, which means the expected properties will + * be set. + * + * @See [ErrorCodes](api:ErrorCode) + * @example + * try { + * // code.... + * } catch (e) { + * if (isError(e, "CALL_EXCEPTION")) { + * // The Type Guard has validated this object + * console.log(e.data); + * } + * } + */ +function isError(error, code) { + return (error && error.code === code); +} +/** + * Returns true if %%error%% is a [[CallExceptionError]. + */ +function isCallException(error) { + return isError(error, "CALL_EXCEPTION"); +} +/** + * Returns a new Error configured to the format ethers emits errors, with + * the %%message%%, [[api:ErrorCode]] %%code%% and additional properties + * for the corresponding EthersError. + * + * Each error in ethers includes the version of ethers, a + * machine-readable [[ErrorCode]], and depending on %%code%%, additional + * required properties. The error message will also include the %%message%%, + * ethers version, %%code%% and all additional properties, serialized. + */ +function makeError(message, code, info) { + let shortMessage = message; + { + const details = []; + if (info) { + if ("message" in info || "code" in info || "name" in info) { + throw new Error(`value will overwrite populated values: ${stringify(info)}`); + } + for (const key in info) { + if (key === "shortMessage") { + continue; + } + const value = (info[key]); + // try { + details.push(key + "=" + stringify(value)); + // } catch (error: any) { + // console.log("MMM", error.message); + // details.push(key + "=[could not serialize object]"); + // } + } + } + details.push(`code=${code}`); + details.push(`version=${version}`); + if (details.length) { + message += " (" + details.join(", ") + ")"; + } + } + let error; + switch (code) { + case "INVALID_ARGUMENT": + error = new TypeError(message); + break; + case "NUMERIC_FAULT": + case "BUFFER_OVERRUN": + error = new RangeError(message); + break; + default: + error = new Error(message); + } + properties_defineProperties(error, { code }); + if (info) { + Object.assign(error, info); + } + if (error.shortMessage == null) { + properties_defineProperties(error, { shortMessage }); + } + return error; +} +/** + * Throws an EthersError with %%message%%, %%code%% and additional error + * %%info%% when %%check%% is falsish.. + * + * @see [[api:makeError]] + */ +function errors_assert(check, message, code, info) { + if (!check) { + throw makeError(message, code, info); + } +} +/** + * A simple helper to simply ensuring provided arguments match expected + * constraints, throwing if not. + * + * In TypeScript environments, the %%check%% has been asserted true, so + * any further code does not need additional compile-time checks. + */ +function errors_assertArgument(check, message, name, value) { + errors_assert(check, message, "INVALID_ARGUMENT", { argument: name, value: value }); +} +function assertArgumentCount(count, expectedCount, message) { + if (message == null) { + message = ""; + } + if (message) { + message = ": " + message; + } + errors_assert(count >= expectedCount, "missing arguemnt" + message, "MISSING_ARGUMENT", { + count: count, + expectedCount: expectedCount + }); + errors_assert(count <= expectedCount, "too many arguments" + message, "UNEXPECTED_ARGUMENT", { + count: count, + expectedCount: expectedCount + }); +} +const _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => { + try { + // General test for normalize + /* c8 ignore start */ + if ("test".normalize(form) !== "test") { + throw new Error("bad"); + } + ; + /* c8 ignore stop */ + if (form === "NFD") { + const check = String.fromCharCode(0xe9).normalize("NFD"); + const expected = String.fromCharCode(0x65, 0x0301); + /* c8 ignore start */ + if (check !== expected) { + throw new Error("broken"); + } + /* c8 ignore stop */ + } + accum.push(form); + } + catch (error) { } + return accum; +}, []); +/** + * Throws if the normalization %%form%% is not supported. + */ +function assertNormalize(form) { + errors_assert(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", { + operation: "String.prototype.normalize", info: { form } + }); +} +/** + * Many classes use file-scoped values to guard the constructor, + * making it effectively private. This facilitates that pattern + * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%, + * throwing if not, indicating the %%className%% if provided. + */ +function assertPrivate(givenGuard, guard, className) { + if (className == null) { + className = ""; + } + if (givenGuard !== guard) { + let method = className, operation = "new"; + if (className) { + method += "."; + operation += " " + className; + } + errors_assert(false, `private constructor; use ${method}from* methods`, "UNSUPPORTED_OPERATION", { + operation + }); + } +} +//# sourceMappingURL=errors.js.map +;// ./node_modules/ethers/lib.esm/utils/data.js +/** + * Some data helpers. + * + * + * @_subsection api/utils:Data Helpers [about-data] + */ + +function _getBytes(value, name, copy) { + if (value instanceof Uint8Array) { + if (copy) { + return new Uint8Array(value); + } + return value; + } + if (typeof (value) === "string" && value.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) { + const result = new Uint8Array((value.length - 2) / 2); + let offset = 2; + for (let i = 0; i < result.length; i++) { + result[i] = parseInt(value.substring(offset, offset + 2), 16); + offset += 2; + } + return result; + } + errors_assertArgument(false, "invalid BytesLike value", name || "value", value); +} +/** + * Get a typed Uint8Array for %%value%%. If already a Uint8Array + * the original %%value%% is returned; if a copy is required use + * [[getBytesCopy]]. + * + * @see: getBytesCopy + */ +function data_getBytes(value, name) { + return _getBytes(value, name, false); +} +/** + * Get a typed Uint8Array for %%value%%, creating a copy if necessary + * to prevent any modifications of the returned value from being + * reflected elsewhere. + * + * @see: getBytes + */ +function getBytesCopy(value, name) { + return _getBytes(value, name, true); +} +/** + * Returns true if %%value%% is a valid [[HexString]]. + * + * If %%length%% is ``true`` or a //number//, it also checks that + * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//) + * bytes of data (e.g. ``0x1234`` is 2 bytes). + */ +function isHexString(value, length) { + if (typeof (value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { + return false; + } + if (typeof (length) === "number" && value.length !== 2 + 2 * length) { + return false; + } + if (length === true && (value.length % 2) !== 0) { + return false; + } + return true; +} +/** + * Returns true if %%value%% is a valid representation of arbitrary + * data (i.e. a valid [[DataHexString]] or a Uint8Array). + */ +function data_isBytesLike(value) { + return (isHexString(value, true) || (value instanceof Uint8Array)); +} +const HexCharacters = "0123456789abcdef"; +/** + * Returns a [[DataHexString]] representation of %%data%%. + */ +function data_hexlify(data) { + const bytes = data_getBytes(data); + let result = "0x"; + for (let i = 0; i < bytes.length; i++) { + const v = bytes[i]; + result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]; + } + return result; +} +/** + * Returns a [[DataHexString]] by concatenating all values + * within %%data%%. + */ +function data_concat(datas) { + return "0x" + datas.map((d) => data_hexlify(d).substring(2)).join(""); +} +/** + * Returns the length of %%data%%, in bytes. + */ +function dataLength(data) { + if (isHexString(data, true)) { + return (data.length - 2) / 2; + } + return data_getBytes(data).length; +} +/** + * Returns a [[DataHexString]] by slicing %%data%% from the %%start%% + * offset to the %%end%% offset. + * + * By default %%start%% is 0 and %%end%% is the length of %%data%%. + */ +function data_dataSlice(data, start, end) { + const bytes = data_getBytes(data); + if (end != null && end > bytes.length) { + errors_assert(false, "cannot slice beyond data bounds", "BUFFER_OVERRUN", { + buffer: bytes, length: bytes.length, offset: end + }); + } + return data_hexlify(bytes.slice((start == null) ? 0 : start, (end == null) ? bytes.length : end)); +} +/** + * Return the [[DataHexString]] result by stripping all **leading** + ** zero bytes from %%data%%. + */ +function stripZerosLeft(data) { + let bytes = data_hexlify(data).substring(2); + while (bytes.startsWith("00")) { + bytes = bytes.substring(2); + } + return "0x" + bytes; +} +function zeroPad(data, length, left) { + const bytes = data_getBytes(data); + errors_assert(length >= bytes.length, "padding exceeds data length", "BUFFER_OVERRUN", { + buffer: new Uint8Array(bytes), + length: length, + offset: length + 1 + }); + const result = new Uint8Array(length); + result.fill(0); + if (left) { + result.set(bytes, length - bytes.length); + } + else { + result.set(bytes, 0); + } + return data_hexlify(result); +} +/** + * Return the [[DataHexString]] of %%data%% padded on the **left** + * to %%length%% bytes. + * + * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is + * thrown. + * + * This pads data the same as **values** are in Solidity + * (e.g. ``uint128``). + */ +function zeroPadValue(data, length) { + return zeroPad(data, length, true); +} +/** + * Return the [[DataHexString]] of %%data%% padded on the **right** + * to %%length%% bytes. + * + * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is + * thrown. + * + * This pads data the same as **bytes** are in Solidity + * (e.g. ``bytes16``). + */ +function zeroPadBytes(data, length) { + return zeroPad(data, length, false); +} +//# sourceMappingURL=data.js.map +;// ./node_modules/ethers/lib.esm/crypto/keccak.js +/** + * Cryptographic hashing functions + * + * @_subsection: api/crypto:Hash Functions [about-crypto-hashing] + */ + + +let locked = false; +const _keccak256 = function (data) { + return keccak_256(data); +}; +let __keccak256 = _keccak256; +/** + * Compute the cryptographic KECCAK256 hash of %%data%%. + * + * The %%data%% **must** be a data representation, to compute the + * hash of UTF-8 data use the [[id]] function. + * + * @returns DataHexstring + * @example: + * keccak256("0x") + * //_result: + * + * keccak256("0x1337") + * //_result: + * + * keccak256(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + * // Strings are assumed to be DataHexString, otherwise it will + * // throw. To hash UTF-8 data, see the note above. + * keccak256("Hello World") + * //_error: + */ +function keccak_keccak256(_data) { + const data = data_getBytes(_data, "data"); + return data_hexlify(__keccak256(data)); +} +keccak_keccak256._ = _keccak256; +keccak_keccak256.lock = function () { locked = true; }; +keccak_keccak256.register = function (func) { + if (locked) { + throw new TypeError("keccak256 is locked"); + } + __keccak256 = func; +}; +Object.freeze(keccak_keccak256); +//# sourceMappingURL=keccak.js.map +;// ./node_modules/ethers/lib.esm/utils/utf8.js +/** + * Using strings in Ethereum (or any security-basd system) requires + * additional care. These utilities attempt to mitigate some of the + * safety issues as well as provide the ability to recover and analyse + * strings. + * + * @_subsection api/utils:Strings and UTF-8 [about-strings] + */ + + +function errorFunc(reason, offset, bytes, output, badCodepoint) { + errors_assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes); +} +function ignoreFunc(reason, offset, bytes, output, badCodepoint) { + // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes + if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") { + let i = 0; + for (let o = offset + 1; o < bytes.length; o++) { + if (bytes[o] >> 6 !== 0x02) { + break; + } + i++; + } + return i; + } + // This byte runs us past the end of the string, so just jump to the end + // (but the first byte was read already read and therefore skipped) + if (reason === "OVERRUN") { + return bytes.length - offset - 1; + } + // Nothing to skip + return 0; +} +function replaceFunc(reason, offset, bytes, output, badCodepoint) { + // Overlong representations are otherwise "valid" code points; just non-deistingtished + if (reason === "OVERLONG") { + errors_assertArgument(typeof (badCodepoint) === "number", "invalid bad code point for replacement", "badCodepoint", badCodepoint); + output.push(badCodepoint); + return 0; + } + // Put the replacement character into the output + output.push(0xfffd); + // Otherwise, process as if ignoring errors + return ignoreFunc(reason, offset, bytes, output, badCodepoint); +} +/** + * A handful of popular, built-in UTF-8 error handling strategies. + * + * **``"error"``** - throws on ANY illegal UTF-8 sequence or + * non-canonical (overlong) codepoints (this is the default) + * + * **``"ignore"``** - silently drops any illegal UTF-8 sequence + * and accepts non-canonical (overlong) codepoints + * + * **``"replace"``** - replace any illegal UTF-8 sequence with the + * UTF-8 replacement character (i.e. ``"\\ufffd"``) and accepts + * non-canonical (overlong) codepoints + * + * @returns: Record<"error" | "ignore" | "replace", Utf8ErrorFunc> + */ +const Utf8ErrorFuncs = Object.freeze({ + error: errorFunc, + ignore: ignoreFunc, + replace: replaceFunc +}); +// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499 +function getUtf8CodePoints(_bytes, onError) { + if (onError == null) { + onError = Utf8ErrorFuncs.error; + } + const bytes = data_getBytes(_bytes, "bytes"); + const result = []; + let i = 0; + // Invalid bytes are ignored + while (i < bytes.length) { + const c = bytes[i++]; + // 0xxx xxxx + if (c >> 7 === 0) { + result.push(c); + continue; + } + // Multibyte; how many bytes left for this character? + let extraLength = null; + let overlongMask = null; + // 110x xxxx 10xx xxxx + if ((c & 0xe0) === 0xc0) { + extraLength = 1; + overlongMask = 0x7f; + // 1110 xxxx 10xx xxxx 10xx xxxx + } + else if ((c & 0xf0) === 0xe0) { + extraLength = 2; + overlongMask = 0x7ff; + // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx + } + else if ((c & 0xf8) === 0xf0) { + extraLength = 3; + overlongMask = 0xffff; + } + else { + if ((c & 0xc0) === 0x80) { + i += onError("UNEXPECTED_CONTINUE", i - 1, bytes, result); + } + else { + i += onError("BAD_PREFIX", i - 1, bytes, result); + } + continue; + } + // Do we have enough bytes in our data? + if (i - 1 + extraLength >= bytes.length) { + i += onError("OVERRUN", i - 1, bytes, result); + continue; + } + // Remove the length prefix from the char + let res = c & ((1 << (8 - extraLength - 1)) - 1); + for (let j = 0; j < extraLength; j++) { + let nextChar = bytes[i]; + // Invalid continuation byte + if ((nextChar & 0xc0) != 0x80) { + i += onError("MISSING_CONTINUE", i, bytes, result); + res = null; + break; + } + ; + res = (res << 6) | (nextChar & 0x3f); + i++; + } + // See above loop for invalid continuation byte + if (res === null) { + continue; + } + // Maximum code point + if (res > 0x10ffff) { + i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes, result, res); + continue; + } + // Reserved for UTF-16 surrogate halves + if (res >= 0xd800 && res <= 0xdfff) { + i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes, result, res); + continue; + } + // Check for overlong sequences (more bytes than needed) + if (res <= overlongMask) { + i += onError("OVERLONG", i - 1 - extraLength, bytes, result, res); + continue; + } + result.push(res); + } + return result; +} +// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array +/** + * Returns the UTF-8 byte representation of %%str%%. + * + * If %%form%% is specified, the string is normalized. + */ +function toUtf8Bytes(str, form) { + errors_assertArgument(typeof (str) === "string", "invalid string value", "str", str); + if (form != null) { + assertNormalize(form); + str = str.normalize(form); + } + let result = []; + for (let i = 0; i < str.length; i++) { + const c = str.charCodeAt(i); + if (c < 0x80) { + result.push(c); + } + else if (c < 0x800) { + result.push((c >> 6) | 0xc0); + result.push((c & 0x3f) | 0x80); + } + else if ((c & 0xfc00) == 0xd800) { + i++; + const c2 = str.charCodeAt(i); + errors_assertArgument(i < str.length && ((c2 & 0xfc00) === 0xdc00), "invalid surrogate pair", "str", str); + // Surrogate Pair + const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff); + result.push((pair >> 18) | 0xf0); + result.push(((pair >> 12) & 0x3f) | 0x80); + result.push(((pair >> 6) & 0x3f) | 0x80); + result.push((pair & 0x3f) | 0x80); + } + else { + result.push((c >> 12) | 0xe0); + result.push(((c >> 6) & 0x3f) | 0x80); + result.push((c & 0x3f) | 0x80); + } + } + return new Uint8Array(result); +} +; +//export +function _toUtf8String(codePoints) { + return codePoints.map((codePoint) => { + if (codePoint <= 0xffff) { + return String.fromCharCode(codePoint); + } + codePoint -= 0x10000; + return String.fromCharCode((((codePoint >> 10) & 0x3ff) + 0xd800), ((codePoint & 0x3ff) + 0xdc00)); + }).join(""); +} +/** + * Returns the string represented by the UTF-8 data %%bytes%%. + * + * When %%onError%% function is specified, it is called on UTF-8 + * errors allowing recovery using the [[Utf8ErrorFunc]] API. + * (default: [error](Utf8ErrorFuncs)) + */ +function toUtf8String(bytes, onError) { + return _toUtf8String(getUtf8CodePoints(bytes, onError)); +} +/** + * Returns the UTF-8 code-points for %%str%%. + * + * If %%form%% is specified, the string is normalized. + */ +function toUtf8CodePoints(str, form) { + return getUtf8CodePoints(toUtf8Bytes(str, form)); +} +//# sourceMappingURL=utf8.js.map +;// ./node_modules/ethers/lib.esm/hash/id.js + + +/** + * A simple hashing function which operates on UTF-8 strings to + * compute an 32-byte identifier. + * + * This simply computes the [UTF-8 bytes](toUtf8Bytes) and computes + * the [[keccak256]]. + * + * @example: + * id("hello world") + * //_result: + */ +function id(value) { + return keccak_keccak256(toUtf8Bytes(value)); +} +//# sourceMappingURL=id.js.map +;// ./node_modules/ethers/lib.esm/utils/maths.js +/** + * Some mathematic operations. + * + * @_subsection: api/utils:Math Helpers [about-maths] + */ + + +const BN_0 = BigInt(0); +const BN_1 = BigInt(1); +//const BN_Max256 = (BN_1 << BigInt(256)) - BN_1; +// IEEE 754 support 53-bits of mantissa +const maxValue = 0x1fffffffffffff; +/** + * Convert %%value%% from a twos-compliment representation of %%width%% + * bits to its value. + * + * If the highest bit is ``1``, the result will be negative. + */ +function fromTwos(_value, _width) { + const value = getUint(_value, "value"); + const width = BigInt(getNumber(_width, "width")); + errors_assert((value >> width) === BN_0, "overflow", "NUMERIC_FAULT", { + operation: "fromTwos", fault: "overflow", value: _value + }); + // Top bit set; treat as a negative value + if (value >> (width - BN_1)) { + const mask = (BN_1 << width) - BN_1; + return -(((~value) & mask) + BN_1); + } + return value; +} +/** + * Convert %%value%% to a twos-compliment representation of + * %%width%% bits. + * + * The result will always be positive. + */ +function toTwos(_value, _width) { + let value = getBigInt(_value, "value"); + const width = BigInt(getNumber(_width, "width")); + const limit = (BN_1 << (width - BN_1)); + if (value < BN_0) { + value = -value; + errors_assert(value <= limit, "too low", "NUMERIC_FAULT", { + operation: "toTwos", fault: "overflow", value: _value + }); + const mask = (BN_1 << width) - BN_1; + return ((~value) & mask) + BN_1; + } + else { + errors_assert(value < limit, "too high", "NUMERIC_FAULT", { + operation: "toTwos", fault: "overflow", value: _value + }); + } + return value; +} +/** + * Mask %%value%% with a bitmask of %%bits%% ones. + */ +function mask(_value, _bits) { + const value = getUint(_value, "value"); + const bits = BigInt(getNumber(_bits, "bits")); + return value & ((BN_1 << bits) - BN_1); +} +/** + * Gets a BigInt from %%value%%. If it is an invalid value for + * a BigInt, then an ArgumentError will be thrown for %%name%%. + */ +function getBigInt(value, name) { + switch (typeof (value)) { + case "bigint": return value; + case "number": + errors_assertArgument(Number.isInteger(value), "underflow", name || "value", value); + errors_assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); + return BigInt(value); + case "string": + try { + if (value === "") { + throw new Error("empty string"); + } + if (value[0] === "-" && value[1] !== "-") { + return -BigInt(value.substring(1)); + } + return BigInt(value); + } + catch (e) { + errors_assertArgument(false, `invalid BigNumberish string: ${e.message}`, name || "value", value); + } + } + errors_assertArgument(false, "invalid BigNumberish value", name || "value", value); +} +/** + * Returns %%value%% as a bigint, validating it is valid as a bigint + * value and that it is positive. + */ +function getUint(value, name) { + const result = getBigInt(value, name); + errors_assert(result >= BN_0, "unsigned value cannot be negative", "NUMERIC_FAULT", { + fault: "overflow", operation: "getUint", value + }); + return result; +} +const Nibbles = "0123456789abcdef"; +/* + * Converts %%value%% to a BigInt. If %%value%% is a Uint8Array, it + * is treated as Big Endian data. + */ +function toBigInt(value) { + if (value instanceof Uint8Array) { + let result = "0x0"; + for (const v of value) { + result += Nibbles[v >> 4]; + result += Nibbles[v & 0x0f]; + } + return BigInt(result); + } + return getBigInt(value); +} +/** + * Gets a //number// from %%value%%. If it is an invalid value for + * a //number//, then an ArgumentError will be thrown for %%name%%. + */ +function getNumber(value, name) { + switch (typeof (value)) { + case "bigint": + errors_assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); + return Number(value); + case "number": + errors_assertArgument(Number.isInteger(value), "underflow", name || "value", value); + errors_assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); + return value; + case "string": + try { + if (value === "") { + throw new Error("empty string"); + } + return getNumber(BigInt(value), name); + } + catch (e) { + errors_assertArgument(false, `invalid numeric string: ${e.message}`, name || "value", value); + } + } + errors_assertArgument(false, "invalid numeric value", name || "value", value); +} +/** + * Converts %%value%% to a number. If %%value%% is a Uint8Array, it + * is treated as Big Endian data. Throws if the value is not safe. + */ +function toNumber(value) { + return getNumber(toBigInt(value)); +} +/** + * Converts %%value%% to a Big Endian hexstring, optionally padded to + * %%width%% bytes. + */ +function toBeHex(_value, _width) { + const value = getUint(_value, "value"); + let result = value.toString(16); + if (_width == null) { + // Ensure the value is of even length + if (result.length % 2) { + result = "0" + result; + } + } + else { + const width = getNumber(_width, "width"); + errors_assert(width * 2 >= result.length, `value exceeds width (${width} bytes)`, "NUMERIC_FAULT", { + operation: "toBeHex", + fault: "overflow", + value: _value + }); + // Pad the value to the required width + while (result.length < (width * 2)) { + result = "0" + result; + } + } + return "0x" + result; +} +/** + * Converts %%value%% to a Big Endian Uint8Array. + */ +function toBeArray(_value) { + const value = getUint(_value, "value"); + if (value === BN_0) { + return new Uint8Array([]); + } + let hex = value.toString(16); + if (hex.length % 2) { + hex = "0" + hex; + } + const result = new Uint8Array(hex.length / 2); + for (let i = 0; i < result.length; i++) { + const offset = i * 2; + result[i] = parseInt(hex.substring(offset, offset + 2), 16); + } + return result; +} +/** + * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//. + * + * A //Quantity// does not have and leading 0 values unless the value is + * the literal value `0x0`. This is most commonly used for JSSON-RPC + * numeric values. + */ +function toQuantity(value) { + let result = hexlify(isBytesLike(value) ? value : toBeArray(value)).substring(2); + while (result.startsWith("0")) { + result = result.substring(1); + } + if (result === "") { + result = "0"; + } + return "0x" + result; +} +//# sourceMappingURL=maths.js.map +;// ./node_modules/ethers/lib.esm/abi/coders/abstract-coder.js + +/** + * @_ignore: + */ +const WordSize = 32; +const Padding = new Uint8Array(WordSize); +// Properties used to immediate pass through to the underlying object +// - `then` is used to detect if an object is a Promise for await +const passProperties = ["then"]; +const _guard = {}; +const resultNames = new WeakMap(); +function getNames(result) { + return resultNames.get(result); +} +function setNames(result, names) { + resultNames.set(result, names); +} +function throwError(name, error) { + const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${name}`); + wrapped.error = error; + throw wrapped; +} +function toObject(names, items, deep) { + if (names.indexOf(null) >= 0) { + return items.map((item, index) => { + if (item instanceof Result) { + return toObject(getNames(item), item, deep); + } + return item; + }); + } + return names.reduce((accum, name, index) => { + let item = items.getValue(name); + if (!(name in accum)) { + if (deep && item instanceof Result) { + item = toObject(getNames(item), item, deep); + } + accum[name] = item; + } + return accum; + }, {}); +} +/** + * A [[Result]] is a sub-class of Array, which allows accessing any + * of its values either positionally by its index or, if keys are + * provided by its name. + * + * @_docloc: api/abi + */ +class Result extends Array { + // No longer used; but cannot be removed as it will remove the + // #private field from the .d.ts which may break backwards + // compatibility + #names; + /** + * @private + */ + constructor(...args) { + // To properly sub-class Array so the other built-in + // functions work, the constructor has to behave fairly + // well. So, in the event we are created via fromItems() + // we build the read-only Result object we want, but on + // any other input, we use the default constructor + // constructor(guard: any, items: Array, keys?: Array); + const guard = args[0]; + let items = args[1]; + let names = (args[2] || []).slice(); + let wrap = true; + if (guard !== _guard) { + items = args; + names = []; + wrap = false; + } + // Can't just pass in ...items since an array of length 1 + // is a special case in the super. + super(items.length); + items.forEach((item, index) => { this[index] = item; }); + // Find all unique keys + const nameCounts = names.reduce((accum, name) => { + if (typeof (name) === "string") { + accum.set(name, (accum.get(name) || 0) + 1); + } + return accum; + }, (new Map())); + // Remove any key thats not unique + setNames(this, Object.freeze(items.map((item, index) => { + const name = names[index]; + if (name != null && nameCounts.get(name) === 1) { + return name; + } + return null; + }))); + // Dummy operations to prevent TypeScript from complaining + this.#names = []; + if (this.#names == null) { + void (this.#names); + } + if (!wrap) { + return; + } + // A wrapped Result is immutable + Object.freeze(this); + // Proxy indices and names so we can trap deferred errors + const proxy = new Proxy(this, { + get: (target, prop, receiver) => { + if (typeof (prop) === "string") { + // Index accessor + if (prop.match(/^[0-9]+$/)) { + const index = getNumber(prop, "%index"); + if (index < 0 || index >= this.length) { + throw new RangeError("out of result range"); + } + const item = target[index]; + if (item instanceof Error) { + throwError(`index ${index}`, item); + } + return item; + } + // Pass important checks (like `then` for Promise) through + if (passProperties.indexOf(prop) >= 0) { + return Reflect.get(target, prop, receiver); + } + const value = target[prop]; + if (value instanceof Function) { + // Make sure functions work with private variables + // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#no_private_property_forwarding + return function (...args) { + return value.apply((this === receiver) ? target : this, args); + }; + } + else if (!(prop in target)) { + // Possible name accessor + return target.getValue.apply((this === receiver) ? target : this, [prop]); + } + } + return Reflect.get(target, prop, receiver); + } + }); + setNames(proxy, getNames(this)); + return proxy; + } + /** + * Returns the Result as a normal Array. If %%deep%%, any children + * which are Result objects are also converted to a normal Array. + * + * This will throw if there are any outstanding deferred + * errors. + */ + toArray(deep) { + const result = []; + this.forEach((item, index) => { + if (item instanceof Error) { + throwError(`index ${index}`, item); + } + if (deep && item instanceof Result) { + item = item.toArray(deep); + } + result.push(item); + }); + return result; + } + /** + * Returns the Result as an Object with each name-value pair. If + * %%deep%%, any children which are Result objects are also + * converted to an Object. + * + * This will throw if any value is unnamed, or if there are + * any outstanding deferred errors. + */ + toObject(deep) { + const names = getNames(this); + return names.reduce((accum, name, index) => { + errors_assert(name != null, `value at index ${index} unnamed`, "UNSUPPORTED_OPERATION", { + operation: "toObject()" + }); + return toObject(names, this, deep); + }, {}); + } + /** + * @_ignore + */ + slice(start, end) { + if (start == null) { + start = 0; + } + if (start < 0) { + start += this.length; + if (start < 0) { + start = 0; + } + } + if (end == null) { + end = this.length; + } + if (end < 0) { + end += this.length; + if (end < 0) { + end = 0; + } + } + if (end > this.length) { + end = this.length; + } + const _names = getNames(this); + const result = [], names = []; + for (let i = start; i < end; i++) { + result.push(this[i]); + names.push(_names[i]); + } + return new Result(_guard, result, names); + } + /** + * @_ignore + */ + filter(callback, thisArg) { + const _names = getNames(this); + const result = [], names = []; + for (let i = 0; i < this.length; i++) { + const item = this[i]; + if (item instanceof Error) { + throwError(`index ${i}`, item); + } + if (callback.call(thisArg, item, i, this)) { + result.push(item); + names.push(_names[i]); + } + } + return new Result(_guard, result, names); + } + /** + * @_ignore + */ + map(callback, thisArg) { + const result = []; + for (let i = 0; i < this.length; i++) { + const item = this[i]; + if (item instanceof Error) { + throwError(`index ${i}`, item); + } + result.push(callback.call(thisArg, item, i, this)); + } + return result; + } + /** + * Returns the value for %%name%%. + * + * Since it is possible to have a key whose name conflicts with + * a method on a [[Result]] or its superclass Array, or any + * JavaScript keyword, this ensures all named values are still + * accessible by name. + */ + getValue(name) { + const index = getNames(this).indexOf(name); + if (index === -1) { + return undefined; + } + const value = this[index]; + if (value instanceof Error) { + throwError(`property ${JSON.stringify(name)}`, value.error); + } + return value; + } + /** + * Creates a new [[Result]] for %%items%% with each entry + * also accessible by its corresponding name in %%keys%%. + */ + static fromItems(items, keys) { + return new Result(_guard, items, keys); + } +} +/** + * Returns all errors found in a [[Result]]. + * + * Since certain errors encountered when creating a [[Result]] do + * not impact the ability to continue parsing data, they are + * deferred until they are actually accessed. Hence a faulty string + * in an Event that is never used does not impact the program flow. + * + * However, sometimes it may be useful to access, identify or + * validate correctness of a [[Result]]. + * + * @_docloc api/abi + */ +function checkResultErrors(result) { + // Find the first error (if any) + const errors = []; + const checkErrors = function (path, object) { + if (!Array.isArray(object)) { + return; + } + for (let key in object) { + const childPath = path.slice(); + childPath.push(key); + try { + checkErrors(childPath, object[key]); + } + catch (error) { + errors.push({ path: childPath, error: error }); + } + } + }; + checkErrors([], result); + return errors; +} +function getValue(value) { + let bytes = toBeArray(value); + errors_assert(bytes.length <= WordSize, "value out-of-bounds", "BUFFER_OVERRUN", { buffer: bytes, length: WordSize, offset: bytes.length }); + if (bytes.length !== WordSize) { + bytes = getBytesCopy(data_concat([Padding.slice(bytes.length % WordSize), bytes])); + } + return bytes; +} +/** + * @_ignore + */ +class Coder { + // The coder name: + // - address, uint256, tuple, array, etc. + name; + // The fully expanded type, including composite types: + // - address, uint256, tuple(address,bytes), uint256[3][4][], etc. + type; + // The localName bound in the signature, in this example it is "baz": + // - tuple(address foo, uint bar) baz + localName; + // Whether this type is dynamic: + // - Dynamic: bytes, string, address[], tuple(boolean[]), etc. + // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8) + dynamic; + constructor(name, type, localName, dynamic) { + properties_defineProperties(this, { name, type, localName, dynamic }, { + name: "string", type: "string", localName: "string", dynamic: "boolean" + }); + } + _throwError(message, value) { + errors_assertArgument(false, message, this.localName, value); + } +} +/** + * @_ignore + */ +class Writer { + // An array of WordSize lengthed objects to concatenation + #data; + #dataLength; + constructor() { + this.#data = []; + this.#dataLength = 0; + } + get data() { + return data_concat(this.#data); + } + get length() { return this.#dataLength; } + #writeData(data) { + this.#data.push(data); + this.#dataLength += data.length; + return data.length; + } + appendWriter(writer) { + return this.#writeData(getBytesCopy(writer.data)); + } + // Arrayish item; pad on the right to *nearest* WordSize + writeBytes(value) { + let bytes = getBytesCopy(value); + const paddingOffset = bytes.length % WordSize; + if (paddingOffset) { + bytes = getBytesCopy(data_concat([bytes, Padding.slice(paddingOffset)])); + } + return this.#writeData(bytes); + } + // Numeric item; pad on the left *to* WordSize + writeValue(value) { + return this.#writeData(getValue(value)); + } + // Inserts a numeric place-holder, returning a callback that can + // be used to asjust the value later + writeUpdatableValue() { + const offset = this.#data.length; + this.#data.push(Padding); + this.#dataLength += WordSize; + return (value) => { + this.#data[offset] = getValue(value); + }; + } +} +/** + * @_ignore + */ +class Reader { + // Allows incomplete unpadded data to be read; otherwise an error + // is raised if attempting to overrun the buffer. This is required + // to deal with an old Solidity bug, in which event data for + // external (not public thoguh) was tightly packed. + allowLoose; + #data; + #offset; + #bytesRead; + #parent; + #maxInflation; + constructor(data, allowLoose, maxInflation) { + properties_defineProperties(this, { allowLoose: !!allowLoose }); + this.#data = getBytesCopy(data); + this.#bytesRead = 0; + this.#parent = null; + this.#maxInflation = (maxInflation != null) ? maxInflation : 1024; + this.#offset = 0; + } + get data() { return data_hexlify(this.#data); } + get dataLength() { return this.#data.length; } + get consumed() { return this.#offset; } + get bytes() { return new Uint8Array(this.#data); } + #incrementBytesRead(count) { + if (this.#parent) { + return this.#parent.#incrementBytesRead(count); + } + this.#bytesRead += count; + // Check for excessive inflation (see: #4537) + errors_assert(this.#maxInflation < 1 || this.#bytesRead <= this.#maxInflation * this.dataLength, `compressed ABI data exceeds inflation ratio of ${this.#maxInflation} ( see: https:/\/github.com/ethers-io/ethers.js/issues/4537 )`, "BUFFER_OVERRUN", { + buffer: getBytesCopy(this.#data), offset: this.#offset, + length: count, info: { + bytesRead: this.#bytesRead, + dataLength: this.dataLength + } + }); + } + #peekBytes(offset, length, loose) { + let alignedLength = Math.ceil(length / WordSize) * WordSize; + if (this.#offset + alignedLength > this.#data.length) { + if (this.allowLoose && loose && this.#offset + length <= this.#data.length) { + alignedLength = length; + } + else { + errors_assert(false, "data out-of-bounds", "BUFFER_OVERRUN", { + buffer: getBytesCopy(this.#data), + length: this.#data.length, + offset: this.#offset + alignedLength + }); + } + } + return this.#data.slice(this.#offset, this.#offset + alignedLength); + } + // Create a sub-reader with the same underlying data, but offset + subReader(offset) { + const reader = new Reader(this.#data.slice(this.#offset + offset), this.allowLoose, this.#maxInflation); + reader.#parent = this; + return reader; + } + // Read bytes + readBytes(length, loose) { + let bytes = this.#peekBytes(0, length, !!loose); + this.#incrementBytesRead(length); + this.#offset += bytes.length; + // @TODO: Make sure the length..end bytes are all 0? + return bytes.slice(0, length); + } + // Read a numeric values + readValue() { + return toBigInt(this.readBytes(WordSize)); + } + readIndex() { + return toNumber(this.readBytes(WordSize)); + } +} +//# sourceMappingURL=abstract-coder.js.map +;// ./node_modules/ethers/lib.esm/address/address.js + + +const address_BN_0 = BigInt(0); +const BN_36 = BigInt(36); +function getChecksumAddress(address) { + // if (!isHexString(address, 20)) { + // logger.throwArgumentError("invalid address", "address", address); + // } + address = address.toLowerCase(); + const chars = address.substring(2).split(""); + const expanded = new Uint8Array(40); + for (let i = 0; i < 40; i++) { + expanded[i] = chars[i].charCodeAt(0); + } + const hashed = data_getBytes(keccak_keccak256(expanded)); + for (let i = 0; i < 40; i += 2) { + if ((hashed[i >> 1] >> 4) >= 8) { + chars[i] = chars[i].toUpperCase(); + } + if ((hashed[i >> 1] & 0x0f) >= 8) { + chars[i + 1] = chars[i + 1].toUpperCase(); + } + } + return "0x" + chars.join(""); +} +// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number +// Create lookup table +const ibanLookup = {}; +for (let i = 0; i < 10; i++) { + ibanLookup[String(i)] = String(i); +} +for (let i = 0; i < 26; i++) { + ibanLookup[String.fromCharCode(65 + i)] = String(10 + i); +} +// How many decimal digits can we process? (for 64-bit float, this is 15) +// i.e. Math.floor(Math.log10(Number.MAX_SAFE_INTEGER)); +const safeDigits = 15; +function ibanChecksum(address) { + address = address.toUpperCase(); + address = address.substring(4) + address.substring(0, 2) + "00"; + let expanded = address.split("").map((c) => { return ibanLookup[c]; }).join(""); + // Javascript can handle integers safely up to 15 (decimal) digits + while (expanded.length >= safeDigits) { + let block = expanded.substring(0, safeDigits); + expanded = parseInt(block, 10) % 97 + expanded.substring(block.length); + } + let checksum = String(98 - (parseInt(expanded, 10) % 97)); + while (checksum.length < 2) { + checksum = "0" + checksum; + } + return checksum; +} +; +const Base36 = (function () { + ; + const result = {}; + for (let i = 0; i < 36; i++) { + const key = "0123456789abcdefghijklmnopqrstuvwxyz"[i]; + result[key] = BigInt(i); + } + return result; +})(); +function fromBase36(value) { + value = value.toLowerCase(); + let result = address_BN_0; + for (let i = 0; i < value.length; i++) { + result = result * BN_36 + Base36[value[i]]; + } + return result; +} +/** + * Returns a normalized and checksumed address for %%address%%. + * This accepts non-checksum addresses, checksum addresses and + * [[getIcapAddress]] formats. + * + * The checksum in Ethereum uses the capitalization (upper-case + * vs lower-case) of the characters within an address to encode + * its checksum, which offers, on average, a checksum of 15-bits. + * + * If %%address%% contains both upper-case and lower-case, it is + * assumed to already be a checksum address and its checksum is + * validated, and if the address fails its expected checksum an + * error is thrown. + * + * If you wish the checksum of %%address%% to be ignore, it should + * be converted to lower-case (i.e. ``.toLowercase()``) before + * being passed in. This should be a very rare situation though, + * that you wish to bypass the safegaurds in place to protect + * against an address that has been incorrectly copied from another + * source. + * + * @example: + * // Adds the checksum (via upper-casing specific letters) + * getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72") + * //_result: + * + * // Converts ICAP address and adds checksum + * getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); + * //_result: + * + * // Throws an error if an address contains mixed case, + * // but the checksum fails + * getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") + * //_error: + */ +function address_getAddress(address) { + errors_assertArgument(typeof (address) === "string", "invalid address", "address", address); + if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) { + // Missing the 0x prefix + if (!address.startsWith("0x")) { + address = "0x" + address; + } + const result = getChecksumAddress(address); + // It is a checksummed address with a bad checksum + errors_assertArgument(!address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || result === address, "bad address checksum", "address", address); + return result; + } + // Maybe ICAP? (we only support direct mode) + if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { + // It is an ICAP address with a bad checksum + errors_assertArgument(address.substring(2, 4) === ibanChecksum(address), "bad icap checksum", "address", address); + let result = fromBase36(address.substring(4)).toString(16); + while (result.length < 40) { + result = "0" + result; + } + return getChecksumAddress("0x" + result); + } + errors_assertArgument(false, "invalid address", "address", address); +} +/** + * The [ICAP Address format](link-icap) format is an early checksum + * format which attempts to be compatible with the banking + * industry [IBAN format](link-wiki-iban) for bank accounts. + * + * It is no longer common or a recommended format. + * + * @example: + * getIcapAddress("0x8ba1f109551bd432803012645ac136ddd64dba72"); + * //_result: + * + * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); + * //_result: + * + * // Throws an error if the ICAP checksum is wrong + * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37"); + * //_error: + */ +function getIcapAddress(address) { + //let base36 = _base16To36(getAddress(address).substring(2)).toUpperCase(); + let base36 = BigInt(address_getAddress(address)).toString(36).toUpperCase(); + while (base36.length < 30) { + base36 = "0" + base36; + } + return "XE" + ibanChecksum("XE00" + base36) + base36; +} +//# sourceMappingURL=address.js.map +;// ./node_modules/ethers/lib.esm/abi/typed.js +/** + * A Typed object allows a value to have its type explicitly + * specified. + * + * For example, in Solidity, the value ``45`` could represent a + * ``uint8`` or a ``uint256``. The value ``0x1234`` could represent + * a ``bytes2`` or ``bytes``. + * + * Since JavaScript has no meaningful way to explicitly inform any + * APIs which what the type is, this allows transparent interoperation + * with Soldity. + * + * @_subsection: api/abi:Typed Values + */ + +const _gaurd = {}; +function n(value, width) { + let signed = false; + if (width < 0) { + signed = true; + width *= -1; + } + // @TODO: Check range is valid for value + return new Typed(_gaurd, `${signed ? "" : "u"}int${width}`, value, { signed, width }); +} +function b(value, size) { + // @TODO: Check range is valid for value + return new Typed(_gaurd, `bytes${(size) ? size : ""}`, value, { size }); +} +const _typedSymbol = Symbol.for("_ethers_typed"); +/** + * The **Typed** class to wrap values providing explicit type information. + */ +class Typed { + /** + * The type, as a Solidity-compatible type. + */ + type; + /** + * The actual value. + */ + value; + #options; + /** + * @_ignore: + */ + _typedSymbol; + /** + * @_ignore: + */ + constructor(gaurd, type, value, options) { + if (options == null) { + options = null; + } + assertPrivate(_gaurd, gaurd, "Typed"); + properties_defineProperties(this, { _typedSymbol, type, value }); + this.#options = options; + // Check the value is valid + this.format(); + } + /** + * Format the type as a Human-Readable type. + */ + format() { + if (this.type === "array") { + throw new Error(""); + } + else if (this.type === "dynamicArray") { + throw new Error(""); + } + else if (this.type === "tuple") { + return `tuple(${this.value.map((v) => v.format()).join(",")})`; + } + return this.type; + } + /** + * The default value returned by this type. + */ + defaultValue() { + return 0; + } + /** + * The minimum value for numeric types. + */ + minValue() { + return 0; + } + /** + * The maximum value for numeric types. + */ + maxValue() { + return 0; + } + /** + * Returns ``true`` and provides a type guard is this is a [[TypedBigInt]]. + */ + isBigInt() { + return !!(this.type.match(/^u?int[0-9]+$/)); + } + /** + * Returns ``true`` and provides a type guard is this is a [[TypedData]]. + */ + isData() { + return this.type.startsWith("bytes"); + } + /** + * Returns ``true`` and provides a type guard is this is a [[TypedString]]. + */ + isString() { + return (this.type === "string"); + } + /** + * Returns the tuple name, if this is a tuple. Throws otherwise. + */ + get tupleName() { + if (this.type !== "tuple") { + throw TypeError("not a tuple"); + } + return this.#options; + } + // Returns the length of this type as an array + // - `null` indicates the length is unforced, it could be dynamic + // - `-1` indicates the length is dynamic + // - any other value indicates it is a static array and is its length + /** + * Returns the length of the array type or ``-1`` if it is dynamic. + * + * Throws if the type is not an array. + */ + get arrayLength() { + if (this.type !== "array") { + throw TypeError("not an array"); + } + if (this.#options === true) { + return -1; + } + if (this.#options === false) { + return (this.value).length; + } + return null; + } + /** + * Returns a new **Typed** of %%type%% with the %%value%%. + */ + static from(type, value) { + return new Typed(_gaurd, type, value); + } + /** + * Return a new ``uint8`` type for %%v%%. + */ + static uint8(v) { return n(v, 8); } + /** + * Return a new ``uint16`` type for %%v%%. + */ + static uint16(v) { return n(v, 16); } + /** + * Return a new ``uint24`` type for %%v%%. + */ + static uint24(v) { return n(v, 24); } + /** + * Return a new ``uint32`` type for %%v%%. + */ + static uint32(v) { return n(v, 32); } + /** + * Return a new ``uint40`` type for %%v%%. + */ + static uint40(v) { return n(v, 40); } + /** + * Return a new ``uint48`` type for %%v%%. + */ + static uint48(v) { return n(v, 48); } + /** + * Return a new ``uint56`` type for %%v%%. + */ + static uint56(v) { return n(v, 56); } + /** + * Return a new ``uint64`` type for %%v%%. + */ + static uint64(v) { return n(v, 64); } + /** + * Return a new ``uint72`` type for %%v%%. + */ + static uint72(v) { return n(v, 72); } + /** + * Return a new ``uint80`` type for %%v%%. + */ + static uint80(v) { return n(v, 80); } + /** + * Return a new ``uint88`` type for %%v%%. + */ + static uint88(v) { return n(v, 88); } + /** + * Return a new ``uint96`` type for %%v%%. + */ + static uint96(v) { return n(v, 96); } + /** + * Return a new ``uint104`` type for %%v%%. + */ + static uint104(v) { return n(v, 104); } + /** + * Return a new ``uint112`` type for %%v%%. + */ + static uint112(v) { return n(v, 112); } + /** + * Return a new ``uint120`` type for %%v%%. + */ + static uint120(v) { return n(v, 120); } + /** + * Return a new ``uint128`` type for %%v%%. + */ + static uint128(v) { return n(v, 128); } + /** + * Return a new ``uint136`` type for %%v%%. + */ + static uint136(v) { return n(v, 136); } + /** + * Return a new ``uint144`` type for %%v%%. + */ + static uint144(v) { return n(v, 144); } + /** + * Return a new ``uint152`` type for %%v%%. + */ + static uint152(v) { return n(v, 152); } + /** + * Return a new ``uint160`` type for %%v%%. + */ + static uint160(v) { return n(v, 160); } + /** + * Return a new ``uint168`` type for %%v%%. + */ + static uint168(v) { return n(v, 168); } + /** + * Return a new ``uint176`` type for %%v%%. + */ + static uint176(v) { return n(v, 176); } + /** + * Return a new ``uint184`` type for %%v%%. + */ + static uint184(v) { return n(v, 184); } + /** + * Return a new ``uint192`` type for %%v%%. + */ + static uint192(v) { return n(v, 192); } + /** + * Return a new ``uint200`` type for %%v%%. + */ + static uint200(v) { return n(v, 200); } + /** + * Return a new ``uint208`` type for %%v%%. + */ + static uint208(v) { return n(v, 208); } + /** + * Return a new ``uint216`` type for %%v%%. + */ + static uint216(v) { return n(v, 216); } + /** + * Return a new ``uint224`` type for %%v%%. + */ + static uint224(v) { return n(v, 224); } + /** + * Return a new ``uint232`` type for %%v%%. + */ + static uint232(v) { return n(v, 232); } + /** + * Return a new ``uint240`` type for %%v%%. + */ + static uint240(v) { return n(v, 240); } + /** + * Return a new ``uint248`` type for %%v%%. + */ + static uint248(v) { return n(v, 248); } + /** + * Return a new ``uint256`` type for %%v%%. + */ + static uint256(v) { return n(v, 256); } + /** + * Return a new ``uint256`` type for %%v%%. + */ + static uint(v) { return n(v, 256); } + /** + * Return a new ``int8`` type for %%v%%. + */ + static int8(v) { return n(v, -8); } + /** + * Return a new ``int16`` type for %%v%%. + */ + static int16(v) { return n(v, -16); } + /** + * Return a new ``int24`` type for %%v%%. + */ + static int24(v) { return n(v, -24); } + /** + * Return a new ``int32`` type for %%v%%. + */ + static int32(v) { return n(v, -32); } + /** + * Return a new ``int40`` type for %%v%%. + */ + static int40(v) { return n(v, -40); } + /** + * Return a new ``int48`` type for %%v%%. + */ + static int48(v) { return n(v, -48); } + /** + * Return a new ``int56`` type for %%v%%. + */ + static int56(v) { return n(v, -56); } + /** + * Return a new ``int64`` type for %%v%%. + */ + static int64(v) { return n(v, -64); } + /** + * Return a new ``int72`` type for %%v%%. + */ + static int72(v) { return n(v, -72); } + /** + * Return a new ``int80`` type for %%v%%. + */ + static int80(v) { return n(v, -80); } + /** + * Return a new ``int88`` type for %%v%%. + */ + static int88(v) { return n(v, -88); } + /** + * Return a new ``int96`` type for %%v%%. + */ + static int96(v) { return n(v, -96); } + /** + * Return a new ``int104`` type for %%v%%. + */ + static int104(v) { return n(v, -104); } + /** + * Return a new ``int112`` type for %%v%%. + */ + static int112(v) { return n(v, -112); } + /** + * Return a new ``int120`` type for %%v%%. + */ + static int120(v) { return n(v, -120); } + /** + * Return a new ``int128`` type for %%v%%. + */ + static int128(v) { return n(v, -128); } + /** + * Return a new ``int136`` type for %%v%%. + */ + static int136(v) { return n(v, -136); } + /** + * Return a new ``int144`` type for %%v%%. + */ + static int144(v) { return n(v, -144); } + /** + * Return a new ``int52`` type for %%v%%. + */ + static int152(v) { return n(v, -152); } + /** + * Return a new ``int160`` type for %%v%%. + */ + static int160(v) { return n(v, -160); } + /** + * Return a new ``int168`` type for %%v%%. + */ + static int168(v) { return n(v, -168); } + /** + * Return a new ``int176`` type for %%v%%. + */ + static int176(v) { return n(v, -176); } + /** + * Return a new ``int184`` type for %%v%%. + */ + static int184(v) { return n(v, -184); } + /** + * Return a new ``int92`` type for %%v%%. + */ + static int192(v) { return n(v, -192); } + /** + * Return a new ``int200`` type for %%v%%. + */ + static int200(v) { return n(v, -200); } + /** + * Return a new ``int208`` type for %%v%%. + */ + static int208(v) { return n(v, -208); } + /** + * Return a new ``int216`` type for %%v%%. + */ + static int216(v) { return n(v, -216); } + /** + * Return a new ``int224`` type for %%v%%. + */ + static int224(v) { return n(v, -224); } + /** + * Return a new ``int232`` type for %%v%%. + */ + static int232(v) { return n(v, -232); } + /** + * Return a new ``int240`` type for %%v%%. + */ + static int240(v) { return n(v, -240); } + /** + * Return a new ``int248`` type for %%v%%. + */ + static int248(v) { return n(v, -248); } + /** + * Return a new ``int256`` type for %%v%%. + */ + static int256(v) { return n(v, -256); } + /** + * Return a new ``int256`` type for %%v%%. + */ + static int(v) { return n(v, -256); } + /** + * Return a new ``bytes1`` type for %%v%%. + */ + static bytes1(v) { return b(v, 1); } + /** + * Return a new ``bytes2`` type for %%v%%. + */ + static bytes2(v) { return b(v, 2); } + /** + * Return a new ``bytes3`` type for %%v%%. + */ + static bytes3(v) { return b(v, 3); } + /** + * Return a new ``bytes4`` type for %%v%%. + */ + static bytes4(v) { return b(v, 4); } + /** + * Return a new ``bytes5`` type for %%v%%. + */ + static bytes5(v) { return b(v, 5); } + /** + * Return a new ``bytes6`` type for %%v%%. + */ + static bytes6(v) { return b(v, 6); } + /** + * Return a new ``bytes7`` type for %%v%%. + */ + static bytes7(v) { return b(v, 7); } + /** + * Return a new ``bytes8`` type for %%v%%. + */ + static bytes8(v) { return b(v, 8); } + /** + * Return a new ``bytes9`` type for %%v%%. + */ + static bytes9(v) { return b(v, 9); } + /** + * Return a new ``bytes10`` type for %%v%%. + */ + static bytes10(v) { return b(v, 10); } + /** + * Return a new ``bytes11`` type for %%v%%. + */ + static bytes11(v) { return b(v, 11); } + /** + * Return a new ``bytes12`` type for %%v%%. + */ + static bytes12(v) { return b(v, 12); } + /** + * Return a new ``bytes13`` type for %%v%%. + */ + static bytes13(v) { return b(v, 13); } + /** + * Return a new ``bytes14`` type for %%v%%. + */ + static bytes14(v) { return b(v, 14); } + /** + * Return a new ``bytes15`` type for %%v%%. + */ + static bytes15(v) { return b(v, 15); } + /** + * Return a new ``bytes16`` type for %%v%%. + */ + static bytes16(v) { return b(v, 16); } + /** + * Return a new ``bytes17`` type for %%v%%. + */ + static bytes17(v) { return b(v, 17); } + /** + * Return a new ``bytes18`` type for %%v%%. + */ + static bytes18(v) { return b(v, 18); } + /** + * Return a new ``bytes19`` type for %%v%%. + */ + static bytes19(v) { return b(v, 19); } + /** + * Return a new ``bytes20`` type for %%v%%. + */ + static bytes20(v) { return b(v, 20); } + /** + * Return a new ``bytes21`` type for %%v%%. + */ + static bytes21(v) { return b(v, 21); } + /** + * Return a new ``bytes22`` type for %%v%%. + */ + static bytes22(v) { return b(v, 22); } + /** + * Return a new ``bytes23`` type for %%v%%. + */ + static bytes23(v) { return b(v, 23); } + /** + * Return a new ``bytes24`` type for %%v%%. + */ + static bytes24(v) { return b(v, 24); } + /** + * Return a new ``bytes25`` type for %%v%%. + */ + static bytes25(v) { return b(v, 25); } + /** + * Return a new ``bytes26`` type for %%v%%. + */ + static bytes26(v) { return b(v, 26); } + /** + * Return a new ``bytes27`` type for %%v%%. + */ + static bytes27(v) { return b(v, 27); } + /** + * Return a new ``bytes28`` type for %%v%%. + */ + static bytes28(v) { return b(v, 28); } + /** + * Return a new ``bytes29`` type for %%v%%. + */ + static bytes29(v) { return b(v, 29); } + /** + * Return a new ``bytes30`` type for %%v%%. + */ + static bytes30(v) { return b(v, 30); } + /** + * Return a new ``bytes31`` type for %%v%%. + */ + static bytes31(v) { return b(v, 31); } + /** + * Return a new ``bytes32`` type for %%v%%. + */ + static bytes32(v) { return b(v, 32); } + /** + * Return a new ``address`` type for %%v%%. + */ + static address(v) { return new Typed(_gaurd, "address", v); } + /** + * Return a new ``bool`` type for %%v%%. + */ + static bool(v) { return new Typed(_gaurd, "bool", !!v); } + /** + * Return a new ``bytes`` type for %%v%%. + */ + static bytes(v) { return new Typed(_gaurd, "bytes", v); } + /** + * Return a new ``string`` type for %%v%%. + */ + static string(v) { return new Typed(_gaurd, "string", v); } + /** + * Return a new ``array`` type for %%v%%, allowing %%dynamic%% length. + */ + static array(v, dynamic) { + throw new Error("not implemented yet"); + return new Typed(_gaurd, "array", v, dynamic); + } + /** + * Return a new ``tuple`` type for %%v%%, with the optional %%name%%. + */ + static tuple(v, name) { + throw new Error("not implemented yet"); + return new Typed(_gaurd, "tuple", v, name); + } + /** + * Return a new ``uint8`` type for %%v%%. + */ + static overrides(v) { + return new Typed(_gaurd, "overrides", Object.assign({}, v)); + } + /** + * Returns true only if %%value%% is a [[Typed]] instance. + */ + static isTyped(value) { + return (value + && typeof (value) === "object" + && "_typedSymbol" in value + && value._typedSymbol === _typedSymbol); + } + /** + * If the value is a [[Typed]] instance, validates the underlying value + * and returns it, otherwise returns value directly. + * + * This is useful for functions that with to accept either a [[Typed]] + * object or values. + */ + static dereference(value, type) { + if (Typed.isTyped(value)) { + if (value.type !== type) { + throw new Error(`invalid type: expecetd ${type}, got ${value.type}`); + } + return value.value; + } + return value; + } +} +//# sourceMappingURL=typed.js.map +;// ./node_modules/ethers/lib.esm/abi/coders/address.js + + + + +/** + * @_ignore + */ +class AddressCoder extends Coder { + constructor(localName) { + super("address", "address", localName, false); + } + defaultValue() { + return "0x0000000000000000000000000000000000000000"; + } + encode(writer, _value) { + let value = Typed.dereference(_value, "string"); + try { + value = address_getAddress(value); + } + catch (error) { + return this._throwError(error.message, _value); + } + return writer.writeValue(value); + } + decode(reader) { + return address_getAddress(toBeHex(reader.readValue(), 20)); + } +} +//# sourceMappingURL=address.js.map +;// ./node_modules/ethers/lib.esm/abi/coders/anonymous.js + +/** + * Clones the functionality of an existing Coder, but without a localName + * + * @_ignore + */ +class AnonymousCoder extends Coder { + coder; + constructor(coder) { + super(coder.name, coder.type, "_", coder.dynamic); + this.coder = coder; + } + defaultValue() { + return this.coder.defaultValue(); + } + encode(writer, value) { + return this.coder.encode(writer, value); + } + decode(reader) { + return this.coder.decode(reader); + } +} +//# sourceMappingURL=anonymous.js.map +;// ./node_modules/ethers/lib.esm/abi/coders/array.js + + + + +/** + * @_ignore + */ +function pack(writer, coders, values) { + let arrayValues = []; + if (Array.isArray(values)) { + arrayValues = values; + } + else if (values && typeof (values) === "object") { + let unique = {}; + arrayValues = coders.map((coder) => { + const name = coder.localName; + errors_assert(name, "cannot encode object for signature with missing names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); + errors_assert(!unique[name], "cannot encode object for signature with duplicate names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); + unique[name] = true; + return values[name]; + }); + } + else { + errors_assertArgument(false, "invalid tuple value", "tuple", values); + } + errors_assertArgument(coders.length === arrayValues.length, "types/value length mismatch", "tuple", values); + let staticWriter = new Writer(); + let dynamicWriter = new Writer(); + let updateFuncs = []; + coders.forEach((coder, index) => { + let value = arrayValues[index]; + if (coder.dynamic) { + // Get current dynamic offset (for the future pointer) + let dynamicOffset = dynamicWriter.length; + // Encode the dynamic value into the dynamicWriter + coder.encode(dynamicWriter, value); + // Prepare to populate the correct offset once we are done + let updateFunc = staticWriter.writeUpdatableValue(); + updateFuncs.push((baseOffset) => { + updateFunc(baseOffset + dynamicOffset); + }); + } + else { + coder.encode(staticWriter, value); + } + }); + // Backfill all the dynamic offsets, now that we know the static length + updateFuncs.forEach((func) => { func(staticWriter.length); }); + let length = writer.appendWriter(staticWriter); + length += writer.appendWriter(dynamicWriter); + return length; +} +/** + * @_ignore + */ +function unpack(reader, coders) { + let values = []; + let keys = []; + // A reader anchored to this base + let baseReader = reader.subReader(0); + coders.forEach((coder) => { + let value = null; + if (coder.dynamic) { + let offset = reader.readIndex(); + let offsetReader = baseReader.subReader(offset); + try { + value = coder.decode(offsetReader); + } + catch (error) { + // Cannot recover from this + if (isError(error, "BUFFER_OVERRUN")) { + throw error; + } + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } + else { + try { + value = coder.decode(reader); + } + catch (error) { + // Cannot recover from this + if (isError(error, "BUFFER_OVERRUN")) { + throw error; + } + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } + if (value == undefined) { + throw new Error("investigate"); + } + values.push(value); + keys.push(coder.localName || null); + }); + return Result.fromItems(values, keys); +} +/** + * @_ignore + */ +class ArrayCoder extends Coder { + coder; + length; + constructor(coder, length, localName) { + const type = (coder.type + "[" + (length >= 0 ? length : "") + "]"); + const dynamic = (length === -1 || coder.dynamic); + super("array", type, localName, dynamic); + properties_defineProperties(this, { coder, length }); + } + defaultValue() { + // Verifies the child coder is valid (even if the array is dynamic or 0-length) + const defaultChild = this.coder.defaultValue(); + const result = []; + for (let i = 0; i < this.length; i++) { + result.push(defaultChild); + } + return result; + } + encode(writer, _value) { + const value = Typed.dereference(_value, "array"); + if (!Array.isArray(value)) { + this._throwError("expected array value", value); + } + let count = this.length; + if (count === -1) { + count = value.length; + writer.writeValue(value.length); + } + assertArgumentCount(value.length, count, "coder array" + (this.localName ? (" " + this.localName) : "")); + let coders = []; + for (let i = 0; i < value.length; i++) { + coders.push(this.coder); + } + return pack(writer, coders, value); + } + decode(reader) { + let count = this.length; + if (count === -1) { + count = reader.readIndex(); + // Check that there is *roughly* enough data to ensure + // stray random data is not being read as a length. Each + // slot requires at least 32 bytes for their value (or 32 + // bytes as a link to the data). This could use a much + // tighter bound, but we are erroring on the side of safety. + errors_assert(count * WordSize <= reader.dataLength, "insufficient data length", "BUFFER_OVERRUN", { buffer: reader.bytes, offset: count * WordSize, length: reader.dataLength }); + } + let coders = []; + for (let i = 0; i < count; i++) { + coders.push(new AnonymousCoder(this.coder)); + } + return unpack(reader, coders); + } +} +//# sourceMappingURL=array.js.map +;// ./node_modules/ethers/lib.esm/abi/coders/boolean.js + + +/** + * @_ignore + */ +class BooleanCoder extends Coder { + constructor(localName) { + super("bool", "bool", localName, false); + } + defaultValue() { + return false; + } + encode(writer, _value) { + const value = Typed.dereference(_value, "bool"); + return writer.writeValue(value ? 1 : 0); + } + decode(reader) { + return !!reader.readValue(); + } +} +//# sourceMappingURL=boolean.js.map +;// ./node_modules/ethers/lib.esm/abi/coders/bytes.js + + +/** + * @_ignore + */ +class DynamicBytesCoder extends Coder { + constructor(type, localName) { + super(type, type, localName, true); + } + defaultValue() { + return "0x"; + } + encode(writer, value) { + value = getBytesCopy(value); + let length = writer.writeValue(value.length); + length += writer.writeBytes(value); + return length; + } + decode(reader) { + return reader.readBytes(reader.readIndex(), true); + } +} +/** + * @_ignore + */ +class BytesCoder extends DynamicBytesCoder { + constructor(localName) { + super("bytes", localName); + } + decode(reader) { + return data_hexlify(super.decode(reader)); + } +} +//# sourceMappingURL=bytes.js.map +;// ./node_modules/ethers/lib.esm/abi/coders/fixed-bytes.js + + + +/** + * @_ignore + */ +class FixedBytesCoder extends Coder { + size; + constructor(size, localName) { + let name = "bytes" + String(size); + super(name, name, localName, false); + properties_defineProperties(this, { size }, { size: "number" }); + } + defaultValue() { + return ("0x0000000000000000000000000000000000000000000000000000000000000000").substring(0, 2 + this.size * 2); + } + encode(writer, _value) { + let data = getBytesCopy(Typed.dereference(_value, this.type)); + if (data.length !== this.size) { + this._throwError("incorrect data length", _value); + } + return writer.writeBytes(data); + } + decode(reader) { + return data_hexlify(reader.readBytes(this.size)); + } +} +//# sourceMappingURL=fixed-bytes.js.map +;// ./node_modules/ethers/lib.esm/abi/coders/null.js + +const Empty = new Uint8Array([]); +/** + * @_ignore + */ +class NullCoder extends Coder { + constructor(localName) { + super("null", "", localName, false); + } + defaultValue() { + return null; + } + encode(writer, value) { + if (value != null) { + this._throwError("not null", value); + } + return writer.writeBytes(Empty); + } + decode(reader) { + reader.readBytes(0); + return null; + } +} +//# sourceMappingURL=null.js.map +;// ./node_modules/ethers/lib.esm/abi/coders/number.js + + + +const number_BN_0 = BigInt(0); +const number_BN_1 = BigInt(1); +const BN_MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +/** + * @_ignore + */ +class NumberCoder extends Coder { + size; + signed; + constructor(size, signed, localName) { + const name = ((signed ? "int" : "uint") + (size * 8)); + super(name, name, localName, false); + properties_defineProperties(this, { size, signed }, { size: "number", signed: "boolean" }); + } + defaultValue() { + return 0; + } + encode(writer, _value) { + let value = getBigInt(Typed.dereference(_value, this.type)); + // Check bounds are safe for encoding + let maxUintValue = mask(BN_MAX_UINT256, WordSize * 8); + if (this.signed) { + let bounds = mask(maxUintValue, (this.size * 8) - 1); + if (value > bounds || value < -(bounds + number_BN_1)) { + this._throwError("value out-of-bounds", _value); + } + value = toTwos(value, 8 * WordSize); + } + else if (value < number_BN_0 || value > mask(maxUintValue, this.size * 8)) { + this._throwError("value out-of-bounds", _value); + } + return writer.writeValue(value); + } + decode(reader) { + let value = mask(reader.readValue(), this.size * 8); + if (this.signed) { + value = fromTwos(value, this.size * 8); + } + return value; + } +} +//# sourceMappingURL=number.js.map +;// ./node_modules/ethers/lib.esm/abi/coders/string.js + + + +/** + * @_ignore + */ +class StringCoder extends DynamicBytesCoder { + constructor(localName) { + super("string", localName); + } + defaultValue() { + return ""; + } + encode(writer, _value) { + return super.encode(writer, toUtf8Bytes(Typed.dereference(_value, "string"))); + } + decode(reader) { + return toUtf8String(super.decode(reader)); + } +} +//# sourceMappingURL=string.js.map +;// ./node_modules/ethers/lib.esm/abi/coders/tuple.js + + + + +/** + * @_ignore + */ +class TupleCoder extends Coder { + coders; + constructor(coders, localName) { + let dynamic = false; + const types = []; + coders.forEach((coder) => { + if (coder.dynamic) { + dynamic = true; + } + types.push(coder.type); + }); + const type = ("tuple(" + types.join(",") + ")"); + super("tuple", type, localName, dynamic); + properties_defineProperties(this, { coders: Object.freeze(coders.slice()) }); + } + defaultValue() { + const values = []; + this.coders.forEach((coder) => { + values.push(coder.defaultValue()); + }); + // We only output named properties for uniquely named coders + const uniqueNames = this.coders.reduce((accum, coder) => { + const name = coder.localName; + if (name) { + if (!accum[name]) { + accum[name] = 0; + } + accum[name]++; + } + return accum; + }, {}); + // Add named values + this.coders.forEach((coder, index) => { + let name = coder.localName; + if (!name || uniqueNames[name] !== 1) { + return; + } + if (name === "length") { + name = "_length"; + } + if (values[name] != null) { + return; + } + values[name] = values[index]; + }); + return Object.freeze(values); + } + encode(writer, _value) { + const value = Typed.dereference(_value, "tuple"); + return pack(writer, this.coders, value); + } + decode(reader) { + return unpack(reader, this.coders); + } +} +//# sourceMappingURL=tuple.js.map +;// ./node_modules/ethers/lib.esm/abi/fragments.js +/** + * A fragment is a single item from an ABI, which may represent any of: + * + * - [Functions](FunctionFragment) + * - [Events](EventFragment) + * - [Constructors](ConstructorFragment) + * - Custom [Errors](ErrorFragment) + * - [Fallback or Receive](FallbackFragment) functions + * + * @_subsection api/abi/abi-coder:Fragments [about-fragments] + */ + + +; +// [ "a", "b" ] => { "a": 1, "b": 1 } +function setify(items) { + const result = new Set(); + items.forEach((k) => result.add(k)); + return Object.freeze(result); +} +const _kwVisibDeploy = "external public payable override"; +const KwVisibDeploy = setify(_kwVisibDeploy.split(" ")); +// Visibility Keywords +const _kwVisib = "constant external internal payable private public pure view override"; +const KwVisib = setify(_kwVisib.split(" ")); +const _kwTypes = "constructor error event fallback function receive struct"; +const KwTypes = setify(_kwTypes.split(" ")); +const _kwModifiers = "calldata memory storage payable indexed"; +const KwModifiers = setify(_kwModifiers.split(" ")); +const _kwOther = "tuple returns"; +// All Keywords +const _keywords = [_kwTypes, _kwModifiers, _kwOther, _kwVisib].join(" "); +const Keywords = setify(_keywords.split(" ")); +// Single character tokens +const SimpleTokens = { + "(": "OPEN_PAREN", ")": "CLOSE_PAREN", + "[": "OPEN_BRACKET", "]": "CLOSE_BRACKET", + ",": "COMMA", "@": "AT" +}; +// Parser regexes to consume the next token +const regexWhitespacePrefix = new RegExp("^(\\s*)"); +const regexNumberPrefix = new RegExp("^([0-9]+)"); +const regexIdPrefix = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"); +// Parser regexs to check validity +const regexId = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"); +const regexType = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"); +class TokenString { + #offset; + #tokens; + get offset() { return this.#offset; } + get length() { return this.#tokens.length - this.#offset; } + constructor(tokens) { + this.#offset = 0; + this.#tokens = tokens.slice(); + } + clone() { return new TokenString(this.#tokens); } + reset() { this.#offset = 0; } + #subTokenString(from = 0, to = 0) { + return new TokenString(this.#tokens.slice(from, to).map((t) => { + return Object.freeze(Object.assign({}, t, { + match: (t.match - from), + linkBack: (t.linkBack - from), + linkNext: (t.linkNext - from), + })); + })); + } + // Pops and returns the value of the next token, if it is a keyword in allowed; throws if out of tokens + popKeyword(allowed) { + const top = this.peek(); + if (top.type !== "KEYWORD" || !allowed.has(top.text)) { + throw new Error(`expected keyword ${top.text}`); + } + return this.pop().text; + } + // Pops and returns the value of the next token if it is `type`; throws if out of tokens + popType(type) { + if (this.peek().type !== type) { + const top = this.peek(); + throw new Error(`expected ${type}; got ${top.type} ${JSON.stringify(top.text)}`); + } + return this.pop().text; + } + // Pops and returns a "(" TOKENS ")" + popParen() { + const top = this.peek(); + if (top.type !== "OPEN_PAREN") { + throw new Error("bad start"); + } + const result = this.#subTokenString(this.#offset + 1, top.match + 1); + this.#offset = top.match + 1; + return result; + } + // Pops and returns the items within "(" ITEM1 "," ITEM2 "," ... ")" + popParams() { + const top = this.peek(); + if (top.type !== "OPEN_PAREN") { + throw new Error("bad start"); + } + const result = []; + while (this.#offset < top.match - 1) { + const link = this.peek().linkNext; + result.push(this.#subTokenString(this.#offset + 1, link)); + this.#offset = link; + } + this.#offset = top.match + 1; + return result; + } + // Returns the top Token, throwing if out of tokens + peek() { + if (this.#offset >= this.#tokens.length) { + throw new Error("out-of-bounds"); + } + return this.#tokens[this.#offset]; + } + // Returns the next value, if it is a keyword in `allowed` + peekKeyword(allowed) { + const top = this.peekType("KEYWORD"); + return (top != null && allowed.has(top)) ? top : null; + } + // Returns the value of the next token if it is `type` + peekType(type) { + if (this.length === 0) { + return null; + } + const top = this.peek(); + return (top.type === type) ? top.text : null; + } + // Returns the next token; throws if out of tokens + pop() { + const result = this.peek(); + this.#offset++; + return result; + } + toString() { + const tokens = []; + for (let i = this.#offset; i < this.#tokens.length; i++) { + const token = this.#tokens[i]; + tokens.push(`${token.type}:${token.text}`); + } + return ``; + } +} +function lex(text) { + const tokens = []; + const throwError = (message) => { + const token = (offset < text.length) ? JSON.stringify(text[offset]) : "$EOI"; + throw new Error(`invalid token ${token} at ${offset}: ${message}`); + }; + let brackets = []; + let commas = []; + let offset = 0; + while (offset < text.length) { + // Strip off any leading whitespace + let cur = text.substring(offset); + let match = cur.match(regexWhitespacePrefix); + if (match) { + offset += match[1].length; + cur = text.substring(offset); + } + const token = { depth: brackets.length, linkBack: -1, linkNext: -1, match: -1, type: "", text: "", offset, value: -1 }; + tokens.push(token); + let type = (SimpleTokens[cur[0]] || ""); + if (type) { + token.type = type; + token.text = cur[0]; + offset++; + if (type === "OPEN_PAREN") { + brackets.push(tokens.length - 1); + commas.push(tokens.length - 1); + } + else if (type == "CLOSE_PAREN") { + if (brackets.length === 0) { + throwError("no matching open bracket"); + } + token.match = brackets.pop(); + (tokens[token.match]).match = tokens.length - 1; + token.depth--; + token.linkBack = commas.pop(); + (tokens[token.linkBack]).linkNext = tokens.length - 1; + } + else if (type === "COMMA") { + token.linkBack = commas.pop(); + (tokens[token.linkBack]).linkNext = tokens.length - 1; + commas.push(tokens.length - 1); + } + else if (type === "OPEN_BRACKET") { + token.type = "BRACKET"; + } + else if (type === "CLOSE_BRACKET") { + // Remove the CLOSE_BRACKET + let suffix = tokens.pop().text; + if (tokens.length > 0 && tokens[tokens.length - 1].type === "NUMBER") { + const value = tokens.pop().text; + suffix = value + suffix; + (tokens[tokens.length - 1]).value = getNumber(value); + } + if (tokens.length === 0 || tokens[tokens.length - 1].type !== "BRACKET") { + throw new Error("missing opening bracket"); + } + (tokens[tokens.length - 1]).text += suffix; + } + continue; + } + match = cur.match(regexIdPrefix); + if (match) { + token.text = match[1]; + offset += token.text.length; + if (Keywords.has(token.text)) { + token.type = "KEYWORD"; + continue; + } + if (token.text.match(regexType)) { + token.type = "TYPE"; + continue; + } + token.type = "ID"; + continue; + } + match = cur.match(regexNumberPrefix); + if (match) { + token.text = match[1]; + token.type = "NUMBER"; + offset += token.text.length; + continue; + } + throw new Error(`unexpected token ${JSON.stringify(cur[0])} at position ${offset}`); + } + return new TokenString(tokens.map((t) => Object.freeze(t))); +} +// Check only one of `allowed` is in `set` +function allowSingle(set, allowed) { + let included = []; + for (const key in allowed.keys()) { + if (set.has(key)) { + included.push(key); + } + } + if (included.length > 1) { + throw new Error(`conflicting types: ${included.join(", ")}`); + } +} +// Functions to process a Solidity Signature TokenString from left-to-right for... +// ...the name with an optional type, returning the name +function consumeName(type, tokens) { + if (tokens.peekKeyword(KwTypes)) { + const keyword = tokens.pop().text; + if (keyword !== type) { + throw new Error(`expected ${type}, got ${keyword}`); + } + } + return tokens.popType("ID"); +} +// ...all keywords matching allowed, returning the keywords +function consumeKeywords(tokens, allowed) { + const keywords = new Set(); + while (true) { + const keyword = tokens.peekType("KEYWORD"); + if (keyword == null || (allowed && !allowed.has(keyword))) { + break; + } + tokens.pop(); + if (keywords.has(keyword)) { + throw new Error(`duplicate keywords: ${JSON.stringify(keyword)}`); + } + keywords.add(keyword); + } + return Object.freeze(keywords); +} +// ...all visibility keywords, returning the coalesced mutability +function consumeMutability(tokens) { + let modifiers = consumeKeywords(tokens, KwVisib); + // Detect conflicting modifiers + allowSingle(modifiers, setify("constant payable nonpayable".split(" "))); + allowSingle(modifiers, setify("pure view payable nonpayable".split(" "))); + // Process mutability states + if (modifiers.has("view")) { + return "view"; + } + if (modifiers.has("pure")) { + return "pure"; + } + if (modifiers.has("payable")) { + return "payable"; + } + if (modifiers.has("nonpayable")) { + return "nonpayable"; + } + // Process legacy `constant` last + if (modifiers.has("constant")) { + return "view"; + } + return "nonpayable"; +} +// ...a parameter list, returning the ParamType list +function consumeParams(tokens, allowIndexed) { + return tokens.popParams().map((t) => ParamType.from(t, allowIndexed)); +} +// ...a gas limit, returning a BigNumber or null if none +function consumeGas(tokens) { + if (tokens.peekType("AT")) { + tokens.pop(); + if (tokens.peekType("NUMBER")) { + return getBigInt(tokens.pop().text); + } + throw new Error("invalid gas"); + } + return null; +} +function consumeEoi(tokens) { + if (tokens.length) { + throw new Error(`unexpected tokens at offset ${tokens.offset}: ${tokens.toString()}`); + } +} +const regexArrayType = new RegExp(/^(.*)\[([0-9]*)\]$/); +function verifyBasicType(type) { + const match = type.match(regexType); + errors_assertArgument(match, "invalid type", "type", type); + if (type === "uint") { + return "uint256"; + } + if (type === "int") { + return "int256"; + } + if (match[2]) { + // bytesXX + const length = parseInt(match[2]); + errors_assertArgument(length !== 0 && length <= 32, "invalid bytes length", "type", type); + } + else if (match[3]) { + // intXX or uintXX + const size = parseInt(match[3]); + errors_assertArgument(size !== 0 && size <= 256 && (size % 8) === 0, "invalid numeric width", "type", type); + } + return type; +} +// Make the Fragment constructors effectively private +const fragments_guard = {}; +const internal = Symbol.for("_ethers_internal"); +const ParamTypeInternal = "_ParamTypeInternal"; +const ErrorFragmentInternal = "_ErrorInternal"; +const EventFragmentInternal = "_EventInternal"; +const ConstructorFragmentInternal = "_ConstructorInternal"; +const FallbackFragmentInternal = "_FallbackInternal"; +const FunctionFragmentInternal = "_FunctionInternal"; +const StructFragmentInternal = "_StructInternal"; +/** + * Each input and output of a [[Fragment]] is an Array of **ParamType**. + */ +class ParamType { + /** + * The local name of the parameter (or ``""`` if unbound) + */ + name; + /** + * The fully qualified type (e.g. ``"address"``, ``"tuple(address)"``, + * ``"uint256[3][]"``) + */ + type; + /** + * The base type (e.g. ``"address"``, ``"tuple"``, ``"array"``) + */ + baseType; + /** + * True if the parameters is indexed. + * + * For non-indexable types this is ``null``. + */ + indexed; + /** + * The components for the tuple. + * + * For non-tuple types this is ``null``. + */ + components; + /** + * The array length, or ``-1`` for dynamic-lengthed arrays. + * + * For non-array types this is ``null``. + */ + arrayLength; + /** + * The type of each child in the array. + * + * For non-array types this is ``null``. + */ + arrayChildren; + /** + * @private + */ + constructor(guard, name, type, baseType, indexed, components, arrayLength, arrayChildren) { + assertPrivate(guard, fragments_guard, "ParamType"); + Object.defineProperty(this, internal, { value: ParamTypeInternal }); + if (components) { + components = Object.freeze(components.slice()); + } + if (baseType === "array") { + if (arrayLength == null || arrayChildren == null) { + throw new Error(""); + } + } + else if (arrayLength != null || arrayChildren != null) { + throw new Error(""); + } + if (baseType === "tuple") { + if (components == null) { + throw new Error(""); + } + } + else if (components != null) { + throw new Error(""); + } + properties_defineProperties(this, { + name, type, baseType, indexed, components, arrayLength, arrayChildren + }); + } + /** + * Return a string representation of this type. + * + * For example, + * + * ``sighash" => "(uint256,address)"`` + * + * ``"minimal" => "tuple(uint256,address) indexed"`` + * + * ``"full" => "tuple(uint256 foo, address bar) indexed baz"`` + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + const name = this.name || ""; + if (this.isArray()) { + const result = JSON.parse(this.arrayChildren.format("json")); + result.name = name; + result.type += `[${(this.arrayLength < 0 ? "" : String(this.arrayLength))}]`; + return JSON.stringify(result); + } + const result = { + type: ((this.baseType === "tuple") ? "tuple" : this.type), + name + }; + if (typeof (this.indexed) === "boolean") { + result.indexed = this.indexed; + } + if (this.isTuple()) { + result.components = this.components.map((c) => JSON.parse(c.format(format))); + } + return JSON.stringify(result); + } + let result = ""; + // Array + if (this.isArray()) { + result += this.arrayChildren.format(format); + result += `[${(this.arrayLength < 0 ? "" : String(this.arrayLength))}]`; + } + else { + if (this.isTuple()) { + result += "(" + this.components.map((comp) => comp.format(format)).join((format === "full") ? ", " : ",") + ")"; + } + else { + result += this.type; + } + } + if (format !== "sighash") { + if (this.indexed === true) { + result += " indexed"; + } + if (format === "full" && this.name) { + result += " " + this.name; + } + } + return result; + } + /** + * Returns true if %%this%% is an Array type. + * + * This provides a type gaurd ensuring that [[arrayChildren]] + * and [[arrayLength]] are non-null. + */ + isArray() { + return (this.baseType === "array"); + } + /** + * Returns true if %%this%% is a Tuple type. + * + * This provides a type gaurd ensuring that [[components]] + * is non-null. + */ + isTuple() { + return (this.baseType === "tuple"); + } + /** + * Returns true if %%this%% is an Indexable type. + * + * This provides a type gaurd ensuring that [[indexed]] + * is non-null. + */ + isIndexable() { + return (this.indexed != null); + } + /** + * Walks the **ParamType** with %%value%%, calling %%process%% + * on each type, destructing the %%value%% recursively. + */ + walk(value, process) { + if (this.isArray()) { + if (!Array.isArray(value)) { + throw new Error("invalid array value"); + } + if (this.arrayLength !== -1 && value.length !== this.arrayLength) { + throw new Error("array is wrong length"); + } + const _this = this; + return value.map((v) => (_this.arrayChildren.walk(v, process))); + } + if (this.isTuple()) { + if (!Array.isArray(value)) { + throw new Error("invalid tuple value"); + } + if (value.length !== this.components.length) { + throw new Error("array is wrong length"); + } + const _this = this; + return value.map((v, i) => (_this.components[i].walk(v, process))); + } + return process(this.type, value); + } + #walkAsync(promises, value, process, setValue) { + if (this.isArray()) { + if (!Array.isArray(value)) { + throw new Error("invalid array value"); + } + if (this.arrayLength !== -1 && value.length !== this.arrayLength) { + throw new Error("array is wrong length"); + } + const childType = this.arrayChildren; + const result = value.slice(); + result.forEach((value, index) => { + childType.#walkAsync(promises, value, process, (value) => { + result[index] = value; + }); + }); + setValue(result); + return; + } + if (this.isTuple()) { + const components = this.components; + // Convert the object into an array + let result; + if (Array.isArray(value)) { + result = value.slice(); + } + else { + if (value == null || typeof (value) !== "object") { + throw new Error("invalid tuple value"); + } + result = components.map((param) => { + if (!param.name) { + throw new Error("cannot use object value with unnamed components"); + } + if (!(param.name in value)) { + throw new Error(`missing value for component ${param.name}`); + } + return value[param.name]; + }); + } + if (result.length !== this.components.length) { + throw new Error("array is wrong length"); + } + result.forEach((value, index) => { + components[index].#walkAsync(promises, value, process, (value) => { + result[index] = value; + }); + }); + setValue(result); + return; + } + const result = process(this.type, value); + if (result.then) { + promises.push((async function () { setValue(await result); })()); + } + else { + setValue(result); + } + } + /** + * Walks the **ParamType** with %%value%%, asynchronously calling + * %%process%% on each type, destructing the %%value%% recursively. + * + * This can be used to resolve ENS names by walking and resolving each + * ``"address"`` type. + */ + async walkAsync(value, process) { + const promises = []; + const result = [value]; + this.#walkAsync(promises, value, process, (value) => { + result[0] = value; + }); + if (promises.length) { + await Promise.all(promises); + } + return result[0]; + } + /** + * Creates a new **ParamType** for %%obj%%. + * + * If %%allowIndexed%% then the ``indexed`` keyword is permitted, + * otherwise the ``indexed`` keyword will throw an error. + */ + static from(obj, allowIndexed) { + if (ParamType.isParamType(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return ParamType.from(lex(obj), allowIndexed); + } + catch (error) { + errors_assertArgument(false, "invalid param type", "obj", obj); + } + } + else if (obj instanceof TokenString) { + let type = "", baseType = ""; + let comps = null; + if (consumeKeywords(obj, setify(["tuple"])).has("tuple") || obj.peekType("OPEN_PAREN")) { + // Tuple + baseType = "tuple"; + comps = obj.popParams().map((t) => ParamType.from(t)); + type = `tuple(${comps.map((c) => c.format()).join(",")})`; + } + else { + // Normal + type = verifyBasicType(obj.popType("TYPE")); + baseType = type; + } + // Check for Array + let arrayChildren = null; + let arrayLength = null; + while (obj.length && obj.peekType("BRACKET")) { + const bracket = obj.pop(); //arrays[i]; + arrayChildren = new ParamType(fragments_guard, "", type, baseType, null, comps, arrayLength, arrayChildren); + arrayLength = bracket.value; + type += bracket.text; + baseType = "array"; + comps = null; + } + let indexed = null; + const keywords = consumeKeywords(obj, KwModifiers); + if (keywords.has("indexed")) { + if (!allowIndexed) { + throw new Error(""); + } + indexed = true; + } + const name = (obj.peekType("ID") ? obj.pop().text : ""); + if (obj.length) { + throw new Error("leftover tokens"); + } + return new ParamType(fragments_guard, name, type, baseType, indexed, comps, arrayLength, arrayChildren); + } + const name = obj.name; + errors_assertArgument(!name || (typeof (name) === "string" && name.match(regexId)), "invalid name", "obj.name", name); + let indexed = obj.indexed; + if (indexed != null) { + errors_assertArgument(allowIndexed, "parameter cannot be indexed", "obj.indexed", obj.indexed); + indexed = !!indexed; + } + let type = obj.type; + let arrayMatch = type.match(regexArrayType); + if (arrayMatch) { + const arrayLength = parseInt(arrayMatch[2] || "-1"); + const arrayChildren = ParamType.from({ + type: arrayMatch[1], + components: obj.components + }); + return new ParamType(fragments_guard, name || "", type, "array", indexed, null, arrayLength, arrayChildren); + } + if (type === "tuple" || type.startsWith("tuple(" /* fix: ) */) || type.startsWith("(" /* fix: ) */)) { + const comps = (obj.components != null) ? obj.components.map((c) => ParamType.from(c)) : null; + const tuple = new ParamType(fragments_guard, name || "", type, "tuple", indexed, comps, null, null); + // @TODO: use lexer to validate and normalize type + return tuple; + } + type = verifyBasicType(obj.type); + return new ParamType(fragments_guard, name || "", type, type, indexed, null, null, null); + } + /** + * Returns true if %%value%% is a **ParamType**. + */ + static isParamType(value) { + return (value && value[internal] === ParamTypeInternal); + } +} +/** + * An abstract class to represent An individual fragment from a parse ABI. + */ +class Fragment { + /** + * The type of the fragment. + */ + type; + /** + * The inputs for the fragment. + */ + inputs; + /** + * @private + */ + constructor(guard, type, inputs) { + assertPrivate(guard, fragments_guard, "Fragment"); + inputs = Object.freeze(inputs.slice()); + properties_defineProperties(this, { type, inputs }); + } + /** + * Creates a new **Fragment** for %%obj%%, wich can be any supported + * ABI frgament type. + */ + static from(obj) { + if (typeof (obj) === "string") { + // Try parsing JSON... + try { + Fragment.from(JSON.parse(obj)); + } + catch (e) { } + // ...otherwise, use the human-readable lexer + return Fragment.from(lex(obj)); + } + if (obj instanceof TokenString) { + // Human-readable ABI (already lexed) + const type = obj.peekKeyword(KwTypes); + switch (type) { + case "constructor": return ConstructorFragment.from(obj); + case "error": return ErrorFragment.from(obj); + case "event": return EventFragment.from(obj); + case "fallback": + case "receive": + return FallbackFragment.from(obj); + case "function": return FunctionFragment.from(obj); + case "struct": return StructFragment.from(obj); + } + } + else if (typeof (obj) === "object") { + // JSON ABI + switch (obj.type) { + case "constructor": return ConstructorFragment.from(obj); + case "error": return ErrorFragment.from(obj); + case "event": return EventFragment.from(obj); + case "fallback": + case "receive": + return FallbackFragment.from(obj); + case "function": return FunctionFragment.from(obj); + case "struct": return StructFragment.from(obj); + } + errors_assert(false, `unsupported type: ${obj.type}`, "UNSUPPORTED_OPERATION", { + operation: "Fragment.from" + }); + } + errors_assertArgument(false, "unsupported frgament object", "obj", obj); + } + /** + * Returns true if %%value%% is a [[ConstructorFragment]]. + */ + static isConstructor(value) { + return ConstructorFragment.isFragment(value); + } + /** + * Returns true if %%value%% is an [[ErrorFragment]]. + */ + static isError(value) { + return ErrorFragment.isFragment(value); + } + /** + * Returns true if %%value%% is an [[EventFragment]]. + */ + static isEvent(value) { + return EventFragment.isFragment(value); + } + /** + * Returns true if %%value%% is a [[FunctionFragment]]. + */ + static isFunction(value) { + return FunctionFragment.isFragment(value); + } + /** + * Returns true if %%value%% is a [[StructFragment]]. + */ + static isStruct(value) { + return StructFragment.isFragment(value); + } +} +/** + * An abstract class to represent An individual fragment + * which has a name from a parse ABI. + */ +class NamedFragment extends Fragment { + /** + * The name of the fragment. + */ + name; + /** + * @private + */ + constructor(guard, type, name, inputs) { + super(guard, type, inputs); + errors_assertArgument(typeof (name) === "string" && name.match(regexId), "invalid identifier", "name", name); + inputs = Object.freeze(inputs.slice()); + properties_defineProperties(this, { name }); + } +} +function joinParams(format, params) { + return "(" + params.map((p) => p.format(format)).join((format === "full") ? ", " : ",") + ")"; +} +/** + * A Fragment which represents a //Custom Error//. + */ +class ErrorFragment extends NamedFragment { + /** + * @private + */ + constructor(guard, name, inputs) { + super(guard, "error", name, inputs); + Object.defineProperty(this, internal, { value: ErrorFragmentInternal }); + } + /** + * The Custom Error selector. + */ + get selector() { + return id(this.format("sighash")).substring(0, 10); + } + /** + * Returns a string representation of this fragment as %%format%%. + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + return JSON.stringify({ + type: "error", + name: this.name, + inputs: this.inputs.map((input) => JSON.parse(input.format(format))), + }); + } + const result = []; + if (format !== "sighash") { + result.push("error"); + } + result.push(this.name + joinParams(format, this.inputs)); + return result.join(" "); + } + /** + * Returns a new **ErrorFragment** for %%obj%%. + */ + static from(obj) { + if (ErrorFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + return ErrorFragment.from(lex(obj)); + } + else if (obj instanceof TokenString) { + const name = consumeName("error", obj); + const inputs = consumeParams(obj); + consumeEoi(obj); + return new ErrorFragment(fragments_guard, name, inputs); + } + return new ErrorFragment(fragments_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is an + * **ErrorFragment**. + */ + static isFragment(value) { + return (value && value[internal] === ErrorFragmentInternal); + } +} +/** + * A Fragment which represents an Event. + */ +class EventFragment extends NamedFragment { + /** + * Whether this event is anonymous. + */ + anonymous; + /** + * @private + */ + constructor(guard, name, inputs, anonymous) { + super(guard, "event", name, inputs); + Object.defineProperty(this, internal, { value: EventFragmentInternal }); + properties_defineProperties(this, { anonymous }); + } + /** + * The Event topic hash. + */ + get topicHash() { + return id(this.format("sighash")); + } + /** + * Returns a string representation of this event as %%format%%. + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + return JSON.stringify({ + type: "event", + anonymous: this.anonymous, + name: this.name, + inputs: this.inputs.map((i) => JSON.parse(i.format(format))) + }); + } + const result = []; + if (format !== "sighash") { + result.push("event"); + } + result.push(this.name + joinParams(format, this.inputs)); + if (format !== "sighash" && this.anonymous) { + result.push("anonymous"); + } + return result.join(" "); + } + /** + * Return the topic hash for an event with %%name%% and %%params%%. + */ + static getTopicHash(name, params) { + params = (params || []).map((p) => ParamType.from(p)); + const fragment = new EventFragment(fragments_guard, name, params, false); + return fragment.topicHash; + } + /** + * Returns a new **EventFragment** for %%obj%%. + */ + static from(obj) { + if (EventFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return EventFragment.from(lex(obj)); + } + catch (error) { + errors_assertArgument(false, "invalid event fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const name = consumeName("event", obj); + const inputs = consumeParams(obj, true); + const anonymous = !!consumeKeywords(obj, setify(["anonymous"])).has("anonymous"); + consumeEoi(obj); + return new EventFragment(fragments_guard, name, inputs, anonymous); + } + return new EventFragment(fragments_guard, obj.name, obj.inputs ? obj.inputs.map((p) => ParamType.from(p, true)) : [], !!obj.anonymous); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is an + * **EventFragment**. + */ + static isFragment(value) { + return (value && value[internal] === EventFragmentInternal); + } +} +/** + * A Fragment which represents a constructor. + */ +class ConstructorFragment extends Fragment { + /** + * Whether the constructor can receive an endowment. + */ + payable; + /** + * The recommended gas limit for deployment or ``null``. + */ + gas; + /** + * @private + */ + constructor(guard, type, inputs, payable, gas) { + super(guard, type, inputs); + Object.defineProperty(this, internal, { value: ConstructorFragmentInternal }); + properties_defineProperties(this, { payable, gas }); + } + /** + * Returns a string representation of this constructor as %%format%%. + */ + format(format) { + errors_assert(format != null && format !== "sighash", "cannot format a constructor for sighash", "UNSUPPORTED_OPERATION", { operation: "format(sighash)" }); + if (format === "json") { + return JSON.stringify({ + type: "constructor", + stateMutability: (this.payable ? "payable" : "undefined"), + payable: this.payable, + gas: ((this.gas != null) ? this.gas : undefined), + inputs: this.inputs.map((i) => JSON.parse(i.format(format))) + }); + } + const result = [`constructor${joinParams(format, this.inputs)}`]; + if (this.payable) { + result.push("payable"); + } + if (this.gas != null) { + result.push(`@${this.gas.toString()}`); + } + return result.join(" "); + } + /** + * Returns a new **ConstructorFragment** for %%obj%%. + */ + static from(obj) { + if (ConstructorFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return ConstructorFragment.from(lex(obj)); + } + catch (error) { + errors_assertArgument(false, "invalid constuctor fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + consumeKeywords(obj, setify(["constructor"])); + const inputs = consumeParams(obj); + const payable = !!consumeKeywords(obj, KwVisibDeploy).has("payable"); + const gas = consumeGas(obj); + consumeEoi(obj); + return new ConstructorFragment(fragments_guard, "constructor", inputs, payable, gas); + } + return new ConstructorFragment(fragments_guard, "constructor", obj.inputs ? obj.inputs.map(ParamType.from) : [], !!obj.payable, (obj.gas != null) ? obj.gas : null); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **ConstructorFragment**. + */ + static isFragment(value) { + return (value && value[internal] === ConstructorFragmentInternal); + } +} +/** + * A Fragment which represents a method. + */ +class FallbackFragment extends Fragment { + /** + * If the function can be sent value during invocation. + */ + payable; + constructor(guard, inputs, payable) { + super(guard, "fallback", inputs); + Object.defineProperty(this, internal, { value: FallbackFragmentInternal }); + properties_defineProperties(this, { payable }); + } + /** + * Returns a string representation of this fallback as %%format%%. + */ + format(format) { + const type = ((this.inputs.length === 0) ? "receive" : "fallback"); + if (format === "json") { + const stateMutability = (this.payable ? "payable" : "nonpayable"); + return JSON.stringify({ type, stateMutability }); + } + return `${type}()${this.payable ? " payable" : ""}`; + } + /** + * Returns a new **FallbackFragment** for %%obj%%. + */ + static from(obj) { + if (FallbackFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return FallbackFragment.from(lex(obj)); + } + catch (error) { + errors_assertArgument(false, "invalid fallback fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const errorObj = obj.toString(); + const topIsValid = obj.peekKeyword(setify(["fallback", "receive"])); + errors_assertArgument(topIsValid, "type must be fallback or receive", "obj", errorObj); + const type = obj.popKeyword(setify(["fallback", "receive"])); + // receive() + if (type === "receive") { + const inputs = consumeParams(obj); + errors_assertArgument(inputs.length === 0, `receive cannot have arguments`, "obj.inputs", inputs); + consumeKeywords(obj, setify(["payable"])); + consumeEoi(obj); + return new FallbackFragment(fragments_guard, [], true); + } + // fallback() [payable] + // fallback(bytes) [payable] returns (bytes) + let inputs = consumeParams(obj); + if (inputs.length) { + errors_assertArgument(inputs.length === 1 && inputs[0].type === "bytes", "invalid fallback inputs", "obj.inputs", inputs.map((i) => i.format("minimal")).join(", ")); + } + else { + inputs = [ParamType.from("bytes")]; + } + const mutability = consumeMutability(obj); + errors_assertArgument(mutability === "nonpayable" || mutability === "payable", "fallback cannot be constants", "obj.stateMutability", mutability); + if (consumeKeywords(obj, setify(["returns"])).has("returns")) { + const outputs = consumeParams(obj); + errors_assertArgument(outputs.length === 1 && outputs[0].type === "bytes", "invalid fallback outputs", "obj.outputs", outputs.map((i) => i.format("minimal")).join(", ")); + } + consumeEoi(obj); + return new FallbackFragment(fragments_guard, inputs, mutability === "payable"); + } + if (obj.type === "receive") { + return new FallbackFragment(fragments_guard, [], true); + } + if (obj.type === "fallback") { + const inputs = [ParamType.from("bytes")]; + const payable = (obj.stateMutability === "payable"); + return new FallbackFragment(fragments_guard, inputs, payable); + } + errors_assertArgument(false, "invalid fallback description", "obj", obj); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **FallbackFragment**. + */ + static isFragment(value) { + return (value && value[internal] === FallbackFragmentInternal); + } +} +/** + * A Fragment which represents a method. + */ +class FunctionFragment extends NamedFragment { + /** + * If the function is constant (e.g. ``pure`` or ``view`` functions). + */ + constant; + /** + * The returned types for the result of calling this function. + */ + outputs; + /** + * The state mutability (e.g. ``payable``, ``nonpayable``, ``view`` + * or ``pure``) + */ + stateMutability; + /** + * If the function can be sent value during invocation. + */ + payable; + /** + * The recommended gas limit to send when calling this function. + */ + gas; + /** + * @private + */ + constructor(guard, name, stateMutability, inputs, outputs, gas) { + super(guard, "function", name, inputs); + Object.defineProperty(this, internal, { value: FunctionFragmentInternal }); + outputs = Object.freeze(outputs.slice()); + const constant = (stateMutability === "view" || stateMutability === "pure"); + const payable = (stateMutability === "payable"); + properties_defineProperties(this, { constant, gas, outputs, payable, stateMutability }); + } + /** + * The Function selector. + */ + get selector() { + return id(this.format("sighash")).substring(0, 10); + } + /** + * Returns a string representation of this function as %%format%%. + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + return JSON.stringify({ + type: "function", + name: this.name, + constant: this.constant, + stateMutability: ((this.stateMutability !== "nonpayable") ? this.stateMutability : undefined), + payable: this.payable, + gas: ((this.gas != null) ? this.gas : undefined), + inputs: this.inputs.map((i) => JSON.parse(i.format(format))), + outputs: this.outputs.map((o) => JSON.parse(o.format(format))), + }); + } + const result = []; + if (format !== "sighash") { + result.push("function"); + } + result.push(this.name + joinParams(format, this.inputs)); + if (format !== "sighash") { + if (this.stateMutability !== "nonpayable") { + result.push(this.stateMutability); + } + if (this.outputs && this.outputs.length) { + result.push("returns"); + result.push(joinParams(format, this.outputs)); + } + if (this.gas != null) { + result.push(`@${this.gas.toString()}`); + } + } + return result.join(" "); + } + /** + * Return the selector for a function with %%name%% and %%params%%. + */ + static getSelector(name, params) { + params = (params || []).map((p) => ParamType.from(p)); + const fragment = new FunctionFragment(fragments_guard, name, "view", params, [], null); + return fragment.selector; + } + /** + * Returns a new **FunctionFragment** for %%obj%%. + */ + static from(obj) { + if (FunctionFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return FunctionFragment.from(lex(obj)); + } + catch (error) { + errors_assertArgument(false, "invalid function fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const name = consumeName("function", obj); + const inputs = consumeParams(obj); + const mutability = consumeMutability(obj); + let outputs = []; + if (consumeKeywords(obj, setify(["returns"])).has("returns")) { + outputs = consumeParams(obj); + } + const gas = consumeGas(obj); + consumeEoi(obj); + return new FunctionFragment(fragments_guard, name, mutability, inputs, outputs, gas); + } + let stateMutability = obj.stateMutability; + // Use legacy Solidity ABI logic if stateMutability is missing + if (stateMutability == null) { + stateMutability = "payable"; + if (typeof (obj.constant) === "boolean") { + stateMutability = "view"; + if (!obj.constant) { + stateMutability = "payable"; + if (typeof (obj.payable) === "boolean" && !obj.payable) { + stateMutability = "nonpayable"; + } + } + } + else if (typeof (obj.payable) === "boolean" && !obj.payable) { + stateMutability = "nonpayable"; + } + } + // @TODO: verifyState for stateMutability (e.g. throw if + // payable: false but stateMutability is "nonpayable") + return new FunctionFragment(fragments_guard, obj.name, stateMutability, obj.inputs ? obj.inputs.map(ParamType.from) : [], obj.outputs ? obj.outputs.map(ParamType.from) : [], (obj.gas != null) ? obj.gas : null); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **FunctionFragment**. + */ + static isFragment(value) { + return (value && value[internal] === FunctionFragmentInternal); + } +} +/** + * A Fragment which represents a structure. + */ +class StructFragment extends NamedFragment { + /** + * @private + */ + constructor(guard, name, inputs) { + super(guard, "struct", name, inputs); + Object.defineProperty(this, internal, { value: StructFragmentInternal }); + } + /** + * Returns a string representation of this struct as %%format%%. + */ + format() { + throw new Error("@TODO"); + } + /** + * Returns a new **StructFragment** for %%obj%%. + */ + static from(obj) { + if (typeof (obj) === "string") { + try { + return StructFragment.from(lex(obj)); + } + catch (error) { + errors_assertArgument(false, "invalid struct fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const name = consumeName("struct", obj); + const inputs = consumeParams(obj); + consumeEoi(obj); + return new StructFragment(fragments_guard, name, inputs); + } + return new StructFragment(fragments_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []); + } + // @TODO: fix this return type + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **StructFragment**. + */ + static isFragment(value) { + return (value && value[internal] === StructFragmentInternal); + } +} +//# sourceMappingURL=fragments.js.map +;// ./node_modules/ethers/lib.esm/abi/abi-coder.js +/** + * When sending values to or receiving values from a [[Contract]], the + * data is generally encoded using the [ABI standard](link-solc-abi). + * + * The AbiCoder provides a utility to encode values to ABI data and + * decode values from ABI data. + * + * Most of the time, developers should favour the [[Contract]] class, + * which further abstracts a lot of the finer details of ABI data. + * + * @_section api/abi/abi-coder:ABI Encoding + */ +// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI + + + + + + + + + + + + + + +// https://docs.soliditylang.org/en/v0.8.17/control-structures.html +const PanicReasons = new Map(); +PanicReasons.set(0x00, "GENERIC_PANIC"); +PanicReasons.set(0x01, "ASSERT_FALSE"); +PanicReasons.set(0x11, "OVERFLOW"); +PanicReasons.set(0x12, "DIVIDE_BY_ZERO"); +PanicReasons.set(0x21, "ENUM_RANGE_ERROR"); +PanicReasons.set(0x22, "BAD_STORAGE_DATA"); +PanicReasons.set(0x31, "STACK_UNDERFLOW"); +PanicReasons.set(0x32, "ARRAY_RANGE_ERROR"); +PanicReasons.set(0x41, "OUT_OF_MEMORY"); +PanicReasons.set(0x51, "UNINITIALIZED_FUNCTION_CALL"); +const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/); +const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); +let defaultCoder = null; +let defaultMaxInflation = 1024; +function getBuiltinCallException(action, tx, data, abiCoder) { + let message = "missing revert data"; + let reason = null; + const invocation = null; + let revert = null; + if (data) { + message = "execution reverted"; + const bytes = data_getBytes(data); + data = data_hexlify(data); + if (bytes.length === 0) { + message += " (no data present; likely require(false) occurred"; + reason = "require(false)"; + } + else if (bytes.length % 32 !== 4) { + message += " (could not decode reason; invalid data length)"; + } + else if (data_hexlify(bytes.slice(0, 4)) === "0x08c379a0") { + // Error(string) + try { + reason = abiCoder.decode(["string"], bytes.slice(4))[0]; + revert = { + signature: "Error(string)", + name: "Error", + args: [reason] + }; + message += `: ${JSON.stringify(reason)}`; + } + catch (error) { + message += " (could not decode reason; invalid string data)"; + } + } + else if (data_hexlify(bytes.slice(0, 4)) === "0x4e487b71") { + // Panic(uint256) + try { + const code = Number(abiCoder.decode(["uint256"], bytes.slice(4))[0]); + revert = { + signature: "Panic(uint256)", + name: "Panic", + args: [code] + }; + reason = `Panic due to ${PanicReasons.get(code) || "UNKNOWN"}(${code})`; + message += `: ${reason}`; + } + catch (error) { + message += " (could not decode panic code)"; + } + } + else { + message += " (unknown custom error)"; + } + } + const transaction = { + to: (tx.to ? address_getAddress(tx.to) : null), + data: (tx.data || "0x") + }; + if (tx.from) { + transaction.from = address_getAddress(tx.from); + } + return makeError(message, "CALL_EXCEPTION", { + action, data, reason, transaction, invocation, revert + }); +} +/** + * The **AbiCoder** is a low-level class responsible for encoding JavaScript + * values into binary data and decoding binary data into JavaScript values. + */ +class AbiCoder { + #getCoder(param) { + if (param.isArray()) { + return new ArrayCoder(this.#getCoder(param.arrayChildren), param.arrayLength, param.name); + } + if (param.isTuple()) { + return new TupleCoder(param.components.map((c) => this.#getCoder(c)), param.name); + } + switch (param.baseType) { + case "address": + return new AddressCoder(param.name); + case "bool": + return new BooleanCoder(param.name); + case "string": + return new StringCoder(param.name); + case "bytes": + return new BytesCoder(param.name); + case "": + return new NullCoder(param.name); + } + // u?int[0-9]* + let match = param.type.match(paramTypeNumber); + if (match) { + let size = parseInt(match[2] || "256"); + errors_assertArgument(size !== 0 && size <= 256 && (size % 8) === 0, "invalid " + match[1] + " bit length", "param", param); + return new NumberCoder(size / 8, (match[1] === "int"), param.name); + } + // bytes[0-9]+ + match = param.type.match(paramTypeBytes); + if (match) { + let size = parseInt(match[1]); + errors_assertArgument(size !== 0 && size <= 32, "invalid bytes length", "param", param); + return new FixedBytesCoder(size, param.name); + } + errors_assertArgument(false, "invalid type", "type", param.type); + } + /** + * Get the default values for the given %%types%%. + * + * For example, a ``uint`` is by default ``0`` and ``bool`` + * is by default ``false``. + */ + getDefaultValue(types) { + const coders = types.map((type) => this.#getCoder(ParamType.from(type))); + const coder = new TupleCoder(coders, "_"); + return coder.defaultValue(); + } + /** + * Encode the %%values%% as the %%types%% into ABI data. + * + * @returns DataHexstring + */ + encode(types, values) { + assertArgumentCount(values.length, types.length, "types/values length mismatch"); + const coders = types.map((type) => this.#getCoder(ParamType.from(type))); + const coder = (new TupleCoder(coders, "_")); + const writer = new Writer(); + coder.encode(writer, values); + return writer.data; + } + /** + * Decode the ABI %%data%% as the %%types%% into values. + * + * If %%loose%% decoding is enabled, then strict padding is + * not enforced. Some older versions of Solidity incorrectly + * padded event data emitted from ``external`` functions. + */ + decode(types, data, loose) { + const coders = types.map((type) => this.#getCoder(ParamType.from(type))); + const coder = new TupleCoder(coders, "_"); + return coder.decode(new Reader(data, loose, defaultMaxInflation)); + } + static _setDefaultMaxInflation(value) { + errors_assertArgument(typeof (value) === "number" && Number.isInteger(value), "invalid defaultMaxInflation factor", "value", value); + defaultMaxInflation = value; + } + /** + * Returns the shared singleton instance of a default [[AbiCoder]]. + * + * On the first call, the instance is created internally. + */ + static defaultAbiCoder() { + if (defaultCoder == null) { + defaultCoder = new AbiCoder(); + } + return defaultCoder; + } + /** + * Returns an ethers-compatible [[CallExceptionError]] Error for the given + * result %%data%% for the [[CallExceptionAction]] %%action%% against + * the Transaction %%tx%%. + */ + static getBuiltinCallException(action, tx, data) { + return getBuiltinCallException(action, tx, data, AbiCoder.defaultAbiCoder()); + } +} +//# sourceMappingURL=abi-coder.js.map +;// ./node_modules/ethers/lib.esm/abi/interface.js +/** + * The Interface class is a low-level class that accepts an + * ABI and provides all the necessary functionality to encode + * and decode paramaters to and results from methods, events + * and errors. + * + * It also provides several convenience methods to automatically + * search and find matching transactions and events to parse them. + * + * @_subsection api/abi:Interfaces [interfaces] + */ + + + + + + + + +/** + * When using the [[Interface-parseLog]] to automatically match a Log to its event + * for parsing, a **LogDescription** is returned. + */ +class LogDescription { + /** + * The matching fragment for the ``topic0``. + */ + fragment; + /** + * The name of the Event. + */ + name; + /** + * The full Event signature. + */ + signature; + /** + * The topic hash for the Event. + */ + topic; + /** + * The arguments passed into the Event with ``emit``. + */ + args; + /** + * @_ignore: + */ + constructor(fragment, topic, args) { + const name = fragment.name, signature = fragment.format(); + properties_defineProperties(this, { + fragment, name, signature, topic, args + }); + } +} +/** + * When using the [[Interface-parseTransaction]] to automatically match + * a transaction data to its function for parsing, + * a **TransactionDescription** is returned. + */ +class TransactionDescription { + /** + * The matching fragment from the transaction ``data``. + */ + fragment; + /** + * The name of the Function from the transaction ``data``. + */ + name; + /** + * The arguments passed to the Function from the transaction ``data``. + */ + args; + /** + * The full Function signature from the transaction ``data``. + */ + signature; + /** + * The selector for the Function from the transaction ``data``. + */ + selector; + /** + * The ``value`` (in wei) from the transaction. + */ + value; + /** + * @_ignore: + */ + constructor(fragment, selector, args, value) { + const name = fragment.name, signature = fragment.format(); + properties_defineProperties(this, { + fragment, name, args, signature, selector, value + }); + } +} +/** + * When using the [[Interface-parseError]] to automatically match an + * error for a call result for parsing, an **ErrorDescription** is returned. + */ +class ErrorDescription { + /** + * The matching fragment. + */ + fragment; + /** + * The name of the Error. + */ + name; + /** + * The arguments passed to the Error with ``revert``. + */ + args; + /** + * The full Error signature. + */ + signature; + /** + * The selector for the Error. + */ + selector; + /** + * @_ignore: + */ + constructor(fragment, selector, args) { + const name = fragment.name, signature = fragment.format(); + properties_defineProperties(this, { + fragment, name, args, signature, selector + }); + } +} +/** + * An **Indexed** is used as a value when a value that does not + * fit within a topic (i.e. not a fixed-length, 32-byte type). It + * is the ``keccak256`` of the value, and used for types such as + * arrays, tuples, bytes and strings. + */ +class Indexed { + /** + * The ``keccak256`` of the value logged. + */ + hash; + /** + * @_ignore: + */ + _isIndexed; + /** + * Returns ``true`` if %%value%% is an **Indexed**. + * + * This provides a Type Guard for property access. + */ + static isIndexed(value) { + return !!(value && value._isIndexed); + } + /** + * @_ignore: + */ + constructor(hash) { + properties_defineProperties(this, { hash, _isIndexed: true }); + } +} +// https://docs.soliditylang.org/en/v0.8.13/control-structures.html?highlight=panic#panic-via-assert-and-error-via-require +const interface_PanicReasons = { + "0": "generic panic", + "1": "assert(false)", + "17": "arithmetic overflow", + "18": "division or modulo by zero", + "33": "enum overflow", + "34": "invalid encoded storage byte array accessed", + "49": "out-of-bounds array access; popping on an empty array", + "50": "out-of-bounds access of an array or bytesN", + "65": "out of memory", + "81": "uninitialized function", +}; +const BuiltinErrors = { + "0x08c379a0": { + signature: "Error(string)", + name: "Error", + inputs: ["string"], + reason: (message) => { + return `reverted with reason string ${JSON.stringify(message)}`; + } + }, + "0x4e487b71": { + signature: "Panic(uint256)", + name: "Panic", + inputs: ["uint256"], + reason: (code) => { + let reason = "unknown panic code"; + if (code >= 0 && code <= 0xff && interface_PanicReasons[code.toString()]) { + reason = interface_PanicReasons[code.toString()]; + } + return `reverted with panic code 0x${code.toString(16)} (${reason})`; + } + } +}; +/** + * An Interface abstracts many of the low-level details for + * encoding and decoding the data on the blockchain. + * + * An ABI provides information on how to encode data to send to + * a Contract, how to decode the results and events and how to + * interpret revert errors. + * + * The ABI can be specified by [any supported format](InterfaceAbi). + */ +class interface_Interface { + /** + * All the Contract ABI members (i.e. methods, events, errors, etc). + */ + fragments; + /** + * The Contract constructor. + */ + deploy; + /** + * The Fallback method, if any. + */ + fallback; + /** + * If receiving ether is supported. + */ + receive; + #errors; + #events; + #functions; + // #structs: Map; + #abiCoder; + /** + * Create a new Interface for the %%fragments%%. + */ + constructor(fragments) { + let abi = []; + if (typeof (fragments) === "string") { + abi = JSON.parse(fragments); + } + else { + abi = fragments; + } + this.#functions = new Map(); + this.#errors = new Map(); + this.#events = new Map(); + // this.#structs = new Map(); + const frags = []; + for (const a of abi) { + try { + frags.push(Fragment.from(a)); + } + catch (error) { + console.log(`[Warning] Invalid Fragment ${JSON.stringify(a)}:`, error.message); + } + } + properties_defineProperties(this, { + fragments: Object.freeze(frags) + }); + let fallback = null; + let receive = false; + this.#abiCoder = this.getAbiCoder(); + // Add all fragments by their signature + this.fragments.forEach((fragment, index) => { + let bucket; + switch (fragment.type) { + case "constructor": + if (this.deploy) { + console.log("duplicate definition - constructor"); + return; + } + //checkNames(fragment, "input", fragment.inputs); + properties_defineProperties(this, { deploy: fragment }); + return; + case "fallback": + if (fragment.inputs.length === 0) { + receive = true; + } + else { + errors_assertArgument(!fallback || fragment.payable !== fallback.payable, "conflicting fallback fragments", `fragments[${index}]`, fragment); + fallback = fragment; + receive = fallback.payable; + } + return; + case "function": + //checkNames(fragment, "input", fragment.inputs); + //checkNames(fragment, "output", (fragment).outputs); + bucket = this.#functions; + break; + case "event": + //checkNames(fragment, "input", fragment.inputs); + bucket = this.#events; + break; + case "error": + bucket = this.#errors; + break; + default: + return; + } + // Two identical entries; ignore it + const signature = fragment.format(); + if (bucket.has(signature)) { + return; + } + bucket.set(signature, fragment); + }); + // If we do not have a constructor add a default + if (!this.deploy) { + properties_defineProperties(this, { + deploy: ConstructorFragment.from("constructor()") + }); + } + properties_defineProperties(this, { fallback, receive }); + } + /** + * Returns the entire Human-Readable ABI, as an array of + * signatures, optionally as %%minimal%% strings, which + * removes parameter names and unneceesary spaces. + */ + format(minimal) { + const format = (minimal ? "minimal" : "full"); + const abi = this.fragments.map((f) => f.format(format)); + return abi; + } + /** + * Return the JSON-encoded ABI. This is the format Solidiy + * returns. + */ + formatJson() { + const abi = this.fragments.map((f) => f.format("json")); + // We need to re-bundle the JSON fragments a bit + return JSON.stringify(abi.map((j) => JSON.parse(j))); + } + /** + * The ABI coder that will be used to encode and decode binary + * data. + */ + getAbiCoder() { + return AbiCoder.defaultAbiCoder(); + } + // Find a function definition by any means necessary (unless it is ambiguous) + #getFunction(key, values, forceUnique) { + // Selector + if (isHexString(key)) { + const selector = key.toLowerCase(); + for (const fragment of this.#functions.values()) { + if (selector === fragment.selector) { + return fragment; + } + } + return null; + } + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching = []; + for (const [name, fragment] of this.#functions) { + if (name.split("(" /* fix:) */)[0] === key) { + matching.push(fragment); + } + } + if (values) { + const lastValue = (values.length > 0) ? values[values.length - 1] : null; + let valueLength = values.length; + let allowOptions = true; + if (Typed.isTyped(lastValue) && lastValue.type === "overrides") { + allowOptions = false; + valueLength--; + } + // Remove all matches that don't have a compatible length. The args + // may contain an overrides, so the match may have n or n - 1 parameters + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs.length; + if (inputs !== valueLength && (!allowOptions || inputs !== valueLength - 1)) { + matching.splice(i, 1); + } + } + // Remove all matches that don't match the Typed signature + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs; + for (let j = 0; j < values.length; j++) { + // Not a typed value + if (!Typed.isTyped(values[j])) { + continue; + } + // We are past the inputs + if (j >= inputs.length) { + if (values[j].type === "overrides") { + continue; + } + matching.splice(i, 1); + break; + } + // Make sure the value type matches the input type + if (values[j].type !== inputs[j].baseType) { + matching.splice(i, 1); + break; + } + } + } + } + // We found a single matching signature with an overrides, but the + // last value is something that cannot possibly be an options + if (matching.length === 1 && values && values.length !== matching[0].inputs.length) { + const lastArg = values[values.length - 1]; + if (lastArg == null || Array.isArray(lastArg) || typeof (lastArg) !== "object") { + matching.splice(0, 1); + } + } + if (matching.length === 0) { + return null; + } + if (matching.length > 1 && forceUnique) { + const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); + errors_assertArgument(false, `ambiguous function description (i.e. matches ${matchStr})`, "key", key); + } + return matching[0]; + } + // Normalize the signature and lookup the function + const result = this.#functions.get(FunctionFragment.from(key).format()); + if (result) { + return result; + } + return null; + } + /** + * Get the function name for %%key%%, which may be a function selector, + * function name or function signature that belongs to the ABI. + */ + getFunctionName(key) { + const fragment = this.#getFunction(key, null, false); + errors_assertArgument(fragment, "no matching function", "key", key); + return fragment.name; + } + /** + * Returns true if %%key%% (a function selector, function name or + * function signature) is present in the ABI. + * + * In the case of a function name, the name may be ambiguous, so + * accessing the [[FunctionFragment]] may require refinement. + */ + hasFunction(key) { + return !!this.#getFunction(key, null, false); + } + /** + * Get the [[FunctionFragment]] for %%key%%, which may be a function + * selector, function name or function signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple functions match by name. + * + * If the %%key%% and %%values%% do not refine to a single function in + * the ABI, this will throw. + */ + getFunction(key, values) { + return this.#getFunction(key, values || null, true); + } + /** + * Iterate over all functions, calling %%callback%%, sorted by their name. + */ + forEachFunction(callback) { + const names = Array.from(this.#functions.keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback((this.#functions.get(name)), i); + } + } + // Find an event definition by any means necessary (unless it is ambiguous) + #getEvent(key, values, forceUnique) { + // EventTopic + if (isHexString(key)) { + const eventTopic = key.toLowerCase(); + for (const fragment of this.#events.values()) { + if (eventTopic === fragment.topicHash) { + return fragment; + } + } + return null; + } + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching = []; + for (const [name, fragment] of this.#events) { + if (name.split("(" /* fix:) */)[0] === key) { + matching.push(fragment); + } + } + if (values) { + // Remove all matches that don't have a compatible length. + for (let i = matching.length - 1; i >= 0; i--) { + if (matching[i].inputs.length < values.length) { + matching.splice(i, 1); + } + } + // Remove all matches that don't match the Typed signature + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs; + for (let j = 0; j < values.length; j++) { + // Not a typed value + if (!Typed.isTyped(values[j])) { + continue; + } + // Make sure the value type matches the input type + if (values[j].type !== inputs[j].baseType) { + matching.splice(i, 1); + break; + } + } + } + } + if (matching.length === 0) { + return null; + } + if (matching.length > 1 && forceUnique) { + const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); + errors_assertArgument(false, `ambiguous event description (i.e. matches ${matchStr})`, "key", key); + } + return matching[0]; + } + // Normalize the signature and lookup the function + const result = this.#events.get(EventFragment.from(key).format()); + if (result) { + return result; + } + return null; + } + /** + * Get the event name for %%key%%, which may be a topic hash, + * event name or event signature that belongs to the ABI. + */ + getEventName(key) { + const fragment = this.#getEvent(key, null, false); + errors_assertArgument(fragment, "no matching event", "key", key); + return fragment.name; + } + /** + * Returns true if %%key%% (an event topic hash, event name or + * event signature) is present in the ABI. + * + * In the case of an event name, the name may be ambiguous, so + * accessing the [[EventFragment]] may require refinement. + */ + hasEvent(key) { + return !!this.#getEvent(key, null, false); + } + /** + * Get the [[EventFragment]] for %%key%%, which may be a topic hash, + * event name or event signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple events match by name. + * + * If the %%key%% and %%values%% do not refine to a single event in + * the ABI, this will throw. + */ + getEvent(key, values) { + return this.#getEvent(key, values || null, true); + } + /** + * Iterate over all events, calling %%callback%%, sorted by their name. + */ + forEachEvent(callback) { + const names = Array.from(this.#events.keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback((this.#events.get(name)), i); + } + } + /** + * Get the [[ErrorFragment]] for %%key%%, which may be an error + * selector, error name or error signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple errors match by name. + * + * If the %%key%% and %%values%% do not refine to a single error in + * the ABI, this will throw. + */ + getError(key, values) { + if (isHexString(key)) { + const selector = key.toLowerCase(); + if (BuiltinErrors[selector]) { + return ErrorFragment.from(BuiltinErrors[selector].signature); + } + for (const fragment of this.#errors.values()) { + if (selector === fragment.selector) { + return fragment; + } + } + return null; + } + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching = []; + for (const [name, fragment] of this.#errors) { + if (name.split("(" /* fix:) */)[0] === key) { + matching.push(fragment); + } + } + if (matching.length === 0) { + if (key === "Error") { + return ErrorFragment.from("error Error(string)"); + } + if (key === "Panic") { + return ErrorFragment.from("error Panic(uint256)"); + } + return null; + } + else if (matching.length > 1) { + const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); + errors_assertArgument(false, `ambiguous error description (i.e. ${matchStr})`, "name", key); + } + return matching[0]; + } + // Normalize the signature and lookup the function + key = ErrorFragment.from(key).format(); + if (key === "Error(string)") { + return ErrorFragment.from("error Error(string)"); + } + if (key === "Panic(uint256)") { + return ErrorFragment.from("error Panic(uint256)"); + } + const result = this.#errors.get(key); + if (result) { + return result; + } + return null; + } + /** + * Iterate over all errors, calling %%callback%%, sorted by their name. + */ + forEachError(callback) { + const names = Array.from(this.#errors.keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback((this.#errors.get(name)), i); + } + } + // Get the 4-byte selector used by Solidity to identify a function + /* +getSelector(fragment: ErrorFragment | FunctionFragment): string { + if (typeof(fragment) === "string") { + const matches: Array = [ ]; + + try { matches.push(this.getFunction(fragment)); } catch (error) { } + try { matches.push(this.getError(fragment)); } catch (_) { } + + if (matches.length === 0) { + logger.throwArgumentError("unknown fragment", "key", fragment); + } else if (matches.length > 1) { + logger.throwArgumentError("ambiguous fragment matches function and error", "key", fragment); + } + + fragment = matches[0]; + } + + return dataSlice(id(fragment.format()), 0, 4); +} + */ + // Get the 32-byte topic hash used by Solidity to identify an event + /* + getEventTopic(fragment: EventFragment): string { + //if (typeof(fragment) === "string") { fragment = this.getEvent(eventFragment); } + return id(fragment.format()); + } + */ + _decodeParams(params, data) { + return this.#abiCoder.decode(params, data); + } + _encodeParams(params, values) { + return this.#abiCoder.encode(params, values); + } + /** + * Encodes a ``tx.data`` object for deploying the Contract with + * the %%values%% as the constructor arguments. + */ + encodeDeploy(values) { + return this._encodeParams(this.deploy.inputs, values || []); + } + /** + * Decodes the result %%data%% (e.g. from an ``eth_call``) for the + * specified error (see [[getError]] for valid values for + * %%key%%). + * + * Most developers should prefer the [[parseCallResult]] method instead, + * which will automatically detect a ``CALL_EXCEPTION`` and throw the + * corresponding error. + */ + decodeErrorResult(fragment, data) { + if (typeof (fragment) === "string") { + const f = this.getError(fragment); + errors_assertArgument(f, "unknown error", "fragment", fragment); + fragment = f; + } + errors_assertArgument(data_dataSlice(data, 0, 4) === fragment.selector, `data signature does not match error ${fragment.name}.`, "data", data); + return this._decodeParams(fragment.inputs, data_dataSlice(data, 4)); + } + /** + * Encodes the transaction revert data for a call result that + * reverted from the the Contract with the sepcified %%error%% + * (see [[getError]] for valid values for %%fragment%%) with the %%values%%. + * + * This is generally not used by most developers, unless trying to mock + * a result from a Contract. + */ + encodeErrorResult(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getError(fragment); + errors_assertArgument(f, "unknown error", "fragment", fragment); + fragment = f; + } + return data_concat([ + fragment.selector, + this._encodeParams(fragment.inputs, values || []) + ]); + } + /** + * Decodes the %%data%% from a transaction ``tx.data`` for + * the function specified (see [[getFunction]] for valid values + * for %%fragment%%). + * + * Most developers should prefer the [[parseTransaction]] method + * instead, which will automatically detect the fragment. + */ + decodeFunctionData(fragment, data) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + errors_assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + errors_assertArgument(data_dataSlice(data, 0, 4) === fragment.selector, `data signature does not match function ${fragment.name}.`, "data", data); + return this._decodeParams(fragment.inputs, data_dataSlice(data, 4)); + } + /** + * Encodes the ``tx.data`` for a transaction that calls the function + * specified (see [[getFunction]] for valid values for %%fragment%%) with + * the %%values%%. + */ + encodeFunctionData(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + errors_assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + return data_concat([ + fragment.selector, + this._encodeParams(fragment.inputs, values || []) + ]); + } + /** + * Decodes the result %%data%% (e.g. from an ``eth_call``) for the + * specified function (see [[getFunction]] for valid values for + * %%key%%). + * + * Most developers should prefer the [[parseCallResult]] method instead, + * which will automatically detect a ``CALL_EXCEPTION`` and throw the + * corresponding error. + */ + decodeFunctionResult(fragment, data) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + errors_assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + let message = "invalid length for result data"; + const bytes = getBytesCopy(data); + if ((bytes.length % 32) === 0) { + try { + return this.#abiCoder.decode(fragment.outputs, bytes); + } + catch (error) { + message = "could not decode result data"; + } + } + // Call returned data with no error, but the data is junk + errors_assert(false, message, "BAD_DATA", { + value: data_hexlify(bytes), + info: { method: fragment.name, signature: fragment.format() } + }); + } + makeError(_data, tx) { + const data = data_getBytes(_data, "data"); + const error = AbiCoder.getBuiltinCallException("call", tx, data); + // Not a built-in error; try finding a custom error + const customPrefix = "execution reverted (unknown custom error)"; + if (error.message.startsWith(customPrefix)) { + const selector = data_hexlify(data.slice(0, 4)); + const ef = this.getError(selector); + if (ef) { + try { + const args = this.#abiCoder.decode(ef.inputs, data.slice(4)); + error.revert = { + name: ef.name, signature: ef.format(), args + }; + error.reason = error.revert.signature; + error.message = `execution reverted: ${error.reason}`; + } + catch (e) { + error.message = `execution reverted (coult not decode custom error)`; + } + } + } + // Add the invocation, if available + const parsed = this.parseTransaction(tx); + if (parsed) { + error.invocation = { + method: parsed.name, + signature: parsed.signature, + args: parsed.args + }; + } + return error; + } + /** + * Encodes the result data (e.g. from an ``eth_call``) for the + * specified function (see [[getFunction]] for valid values + * for %%fragment%%) with %%values%%. + * + * This is generally not used by most developers, unless trying to mock + * a result from a Contract. + */ + encodeFunctionResult(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + errors_assertArgument(f, "unknown function", "fragment", fragment); + fragment = f; + } + return data_hexlify(this.#abiCoder.encode(fragment.outputs, values || [])); + } + /* + spelunk(inputs: Array, values: ReadonlyArray, processfunc: (type: string, value: any) => Promise): Promise> { + const promises: Array> = [ ]; + const process = function(type: ParamType, value: any): any { + if (type.baseType === "array") { + return descend(type.child + } + if (type. === "address") { + } + }; + + const descend = function (inputs: Array, values: ReadonlyArray) { + if (inputs.length !== values.length) { throw new Error("length mismatch"); } + + }; + + const result: Array = [ ]; + values.forEach((value, index) => { + if (value == null) { + topics.push(null); + } else if (param.baseType === "array" || param.baseType === "tuple") { + logger.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value); + } else if (Array.isArray(value)) { + topics.push(value.map((value) => encodeTopic(param, value))); + } else { + topics.push(encodeTopic(param, value)); + } + }); + } + */ + // Create the filter for the event with search criteria (e.g. for eth_filterLog) + encodeFilterTopics(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getEvent(fragment); + errors_assertArgument(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + errors_assert(values.length <= fragment.inputs.length, `too many arguments for ${fragment.format()}`, "UNEXPECTED_ARGUMENT", { count: values.length, expectedCount: fragment.inputs.length }); + const topics = []; + if (!fragment.anonymous) { + topics.push(fragment.topicHash); + } + // @TODO: Use the coders for this; to properly support tuples, etc. + const encodeTopic = (param, value) => { + if (param.type === "string") { + return id(value); + } + else if (param.type === "bytes") { + return keccak_keccak256(data_hexlify(value)); + } + if (param.type === "bool" && typeof (value) === "boolean") { + value = (value ? "0x01" : "0x00"); + } + else if (param.type.match(/^u?int/)) { + value = toBeHex(value); // @TODO: Should this toTwos?? + } + else if (param.type.match(/^bytes/)) { + value = zeroPadBytes(value, 32); + } + else if (param.type === "address") { + // Check addresses are valid + this.#abiCoder.encode(["address"], [value]); + } + return zeroPadValue(data_hexlify(value), 32); + }; + values.forEach((value, index) => { + const param = fragment.inputs[index]; + if (!param.indexed) { + errors_assertArgument(value == null, "cannot filter non-indexed parameters; must be null", ("contract." + param.name), value); + return; + } + if (value == null) { + topics.push(null); + } + else if (param.baseType === "array" || param.baseType === "tuple") { + errors_assertArgument(false, "filtering with tuples or arrays not supported", ("contract." + param.name), value); + } + else if (Array.isArray(value)) { + topics.push(value.map((value) => encodeTopic(param, value))); + } + else { + topics.push(encodeTopic(param, value)); + } + }); + // Trim off trailing nulls + while (topics.length && topics[topics.length - 1] === null) { + topics.pop(); + } + return topics; + } + encodeEventLog(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getEvent(fragment); + errors_assertArgument(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + const topics = []; + const dataTypes = []; + const dataValues = []; + if (!fragment.anonymous) { + topics.push(fragment.topicHash); + } + errors_assertArgument(values.length === fragment.inputs.length, "event arguments/values mismatch", "values", values); + fragment.inputs.forEach((param, index) => { + const value = values[index]; + if (param.indexed) { + if (param.type === "string") { + topics.push(id(value)); + } + else if (param.type === "bytes") { + topics.push(keccak_keccak256(value)); + } + else if (param.baseType === "tuple" || param.baseType === "array") { + // @TODO + throw new Error("not implemented"); + } + else { + topics.push(this.#abiCoder.encode([param.type], [value])); + } + } + else { + dataTypes.push(param); + dataValues.push(value); + } + }); + return { + data: this.#abiCoder.encode(dataTypes, dataValues), + topics: topics + }; + } + // Decode a filter for the event and the search criteria + decodeEventLog(fragment, data, topics) { + if (typeof (fragment) === "string") { + const f = this.getEvent(fragment); + errors_assertArgument(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + if (topics != null && !fragment.anonymous) { + const eventTopic = fragment.topicHash; + errors_assertArgument(isHexString(topics[0], 32) && topics[0].toLowerCase() === eventTopic, "fragment/topic mismatch", "topics[0]", topics[0]); + topics = topics.slice(1); + } + const indexed = []; + const nonIndexed = []; + const dynamic = []; + fragment.inputs.forEach((param, index) => { + if (param.indexed) { + if (param.type === "string" || param.type === "bytes" || param.baseType === "tuple" || param.baseType === "array") { + indexed.push(ParamType.from({ type: "bytes32", name: param.name })); + dynamic.push(true); + } + else { + indexed.push(param); + dynamic.push(false); + } + } + else { + nonIndexed.push(param); + dynamic.push(false); + } + }); + const resultIndexed = (topics != null) ? this.#abiCoder.decode(indexed, data_concat(topics)) : null; + const resultNonIndexed = this.#abiCoder.decode(nonIndexed, data, true); + //const result: (Array & { [ key: string ]: any }) = [ ]; + const values = []; + const keys = []; + let nonIndexedIndex = 0, indexedIndex = 0; + fragment.inputs.forEach((param, index) => { + let value = null; + if (param.indexed) { + if (resultIndexed == null) { + value = new Indexed(null); + } + else if (dynamic[index]) { + value = new Indexed(resultIndexed[indexedIndex++]); + } + else { + try { + value = resultIndexed[indexedIndex++]; + } + catch (error) { + value = error; + } + } + } + else { + try { + value = resultNonIndexed[nonIndexedIndex++]; + } + catch (error) { + value = error; + } + } + values.push(value); + keys.push(param.name || null); + }); + return Result.fromItems(values, keys); + } + /** + * Parses a transaction, finding the matching function and extracts + * the parameter values along with other useful function details. + * + * If the matching function cannot be found, return null. + */ + parseTransaction(tx) { + const data = data_getBytes(tx.data, "tx.data"); + const value = getBigInt((tx.value != null) ? tx.value : 0, "tx.value"); + const fragment = this.getFunction(data_hexlify(data.slice(0, 4))); + if (!fragment) { + return null; + } + const args = this.#abiCoder.decode(fragment.inputs, data.slice(4)); + return new TransactionDescription(fragment, fragment.selector, args, value); + } + parseCallResult(data) { + throw new Error("@TODO"); + } + /** + * Parses a receipt log, finding the matching event and extracts + * the parameter values along with other useful event details. + * + * If the matching event cannot be found, returns null. + */ + parseLog(log) { + const fragment = this.getEvent(log.topics[0]); + if (!fragment || fragment.anonymous) { + return null; + } + // @TODO: If anonymous, and the only method, and the input count matches, should we parse? + // Probably not, because just because it is the only event in the ABI does + // not mean we have the full ABI; maybe just a fragment? + return new LogDescription(fragment, fragment.topicHash, this.decodeEventLog(fragment, log.data, log.topics)); + } + /** + * Parses a revert data, finding the matching error and extracts + * the parameter values along with other useful error details. + * + * If the matching error cannot be found, returns null. + */ + parseError(data) { + const hexData = data_hexlify(data); + const fragment = this.getError(data_dataSlice(hexData, 0, 4)); + if (!fragment) { + return null; + } + const args = this.#abiCoder.decode(fragment.inputs, data_dataSlice(hexData, 4)); + return new ErrorDescription(fragment, fragment.selector, args); + } + /** + * Creates a new [[Interface]] from the ABI %%value%%. + * + * The %%value%% may be provided as an existing [[Interface]] object, + * a JSON-encoded ABI or any Human-Readable ABI format. + */ + static from(value) { + // Already an Interface, which is immutable + if (value instanceof interface_Interface) { + return value; + } + // JSON + if (typeof (value) === "string") { + return new interface_Interface(JSON.parse(value)); + } + // An Interface; possibly from another v6 instance + if (typeof (value.formatJson) === "function") { + return new interface_Interface(value.formatJson()); + } + // A legacy Interface; from an older version + if (typeof (value.format) === "function") { + return new interface_Interface(value.format("json")); + } + // Array of fragments + return new interface_Interface(value); + } +} +//# sourceMappingURL=interface.js.map +;// ./node_modules/ethers/lib.esm/address/checks.js + + +/** + * Returns true if %%value%% is an object which implements the + * [[Addressable]] interface. + * + * @example: + * // Wallets and AbstractSigner sub-classes + * isAddressable(Wallet.createRandom()) + * //_result: + * + * // Contracts + * contract = new Contract("dai.tokens.ethers.eth", [ ], provider) + * isAddressable(contract) + * //_result: + */ +function isAddressable(value) { + return (value && typeof (value.getAddress) === "function"); +} +/** + * Returns true if %%value%% is a valid address. + * + * @example: + * // Valid address + * isAddress("0x8ba1f109551bD432803012645Ac136ddd64DBA72") + * //_result: + * + * // Valid ICAP address + * isAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36") + * //_result: + * + * // Invalid checksum + * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBa72") + * //_result: + * + * // Invalid ICAP checksum + * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") + * //_result: + * + * // Not an address (an ENS name requires a provided and an + * // asynchronous API to access) + * isAddress("ricmoo.eth") + * //_result: + */ +function isAddress(value) { + try { + getAddress(value); + return true; + } + catch (error) { } + return false; +} +async function checkAddress(target, promise) { + const result = await promise; + if (result == null || result === "0x0000000000000000000000000000000000000000") { + errors_assert(typeof (target) !== "string", "unconfigured name", "UNCONFIGURED_NAME", { value: target }); + errors_assertArgument(false, "invalid AddressLike value; did not resolve to a value address", "target", target); + } + return address_getAddress(result); +} +/** + * Resolves to an address for the %%target%%, which may be any + * supported address type, an [[Addressable]] or a Promise which + * resolves to an address. + * + * If an ENS name is provided, but that name has not been correctly + * configured a [[UnconfiguredNameError]] is thrown. + * + * @example: + * addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F" + * + * // Addresses are return synchronously + * resolveAddress(addr, provider) + * //_result: + * + * // Address promises are resolved asynchronously + * resolveAddress(Promise.resolve(addr)) + * //_result: + * + * // ENS names are resolved asynchronously + * resolveAddress("dai.tokens.ethers.eth", provider) + * //_result: + * + * // Addressable objects are resolved asynchronously + * contract = new Contract(addr, [ ]) + * resolveAddress(contract, provider) + * //_result: + * + * // Unconfigured ENS names reject + * resolveAddress("nothing-here.ricmoo.eth", provider) + * //_error: + * + * // ENS names require a NameResolver object passed in + * // (notice the provider was omitted) + * resolveAddress("nothing-here.ricmoo.eth") + * //_error: + */ +function resolveAddress(target, resolver) { + if (typeof (target) === "string") { + if (target.match(/^0x[0-9a-f]{40}$/i)) { + return address_getAddress(target); + } + errors_assert(resolver != null, "ENS resolution requires a provider", "UNSUPPORTED_OPERATION", { operation: "resolveName" }); + return checkAddress(target, resolver.resolveName(target)); + } + else if (isAddressable(target)) { + return checkAddress(target, target.getAddress()); + } + else if (target && typeof (target.then) === "function") { + return checkAddress(target, target); + } + errors_assertArgument(false, "unsupported addressable value", "target", target); +} +//# sourceMappingURL=checks.js.map +;// ./node_modules/ethers/lib.esm/transaction/accesslist.js + + +function accessSetify(addr, storageKeys) { + return { + address: address_getAddress(addr), + storageKeys: storageKeys.map((storageKey, index) => { + errors_assertArgument(isHexString(storageKey, 32), "invalid slot", `storageKeys[${index}]`, storageKey); + return storageKey.toLowerCase(); + }) + }; +} +/** + * Returns a [[AccessList]] from any ethers-supported access-list structure. + */ +function accessListify(value) { + if (Array.isArray(value)) { + return value.map((set, index) => { + if (Array.isArray(set)) { + errors_assertArgument(set.length === 2, "invalid slot set", `value[${index}]`, set); + return accessSetify(set[0], set[1]); + } + errors_assertArgument(set != null && typeof (set) === "object", "invalid address-slot set", "value", value); + return accessSetify(set.address, set.storageKeys); + }); + } + errors_assertArgument(value != null && typeof (value) === "object", "invalid access list", "value", value); + const result = Object.keys(value).map((addr) => { + const storageKeys = value[addr].reduce((accum, storageKey) => { + accum[storageKey] = true; + return accum; + }, {}); + return accessSetify(addr, Object.keys(storageKeys).sort()); + }); + result.sort((a, b) => (a.address.localeCompare(b.address))); + return result; +} +//# sourceMappingURL=accesslist.js.map +;// ./node_modules/ethers/lib.esm/providers/provider.js +//import { resolveAddress } from "@ethersproject/address"; + + +const provider_BN_0 = BigInt(0); +// ----------------------- +function provider_getValue(value) { + if (value == null) { + return null; + } + return value; +} +function toJson(value) { + if (value == null) { + return null; + } + return value.toString(); +} +// @TODO? implements Required +/** + * A **FeeData** wraps all the fee-related values associated with + * the network. + */ +class FeeData { + /** + * The gas price for legacy networks. + */ + gasPrice; + /** + * The maximum fee to pay per gas. + * + * The base fee per gas is defined by the network and based on + * congestion, increasing the cost during times of heavy load + * and lowering when less busy. + * + * The actual fee per gas will be the base fee for the block + * and the priority fee, up to the max fee per gas. + * + * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559)) + */ + maxFeePerGas; + /** + * The additional amout to pay per gas to encourage a validator + * to include the transaction. + * + * The purpose of this is to compensate the validator for the + * adjusted risk for including a given transaction. + * + * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559)) + */ + maxPriorityFeePerGas; + /** + * Creates a new FeeData for %%gasPrice%%, %%maxFeePerGas%% and + * %%maxPriorityFeePerGas%%. + */ + constructor(gasPrice, maxFeePerGas, maxPriorityFeePerGas) { + defineProperties(this, { + gasPrice: provider_getValue(gasPrice), + maxFeePerGas: provider_getValue(maxFeePerGas), + maxPriorityFeePerGas: provider_getValue(maxPriorityFeePerGas) + }); + } + /** + * Returns a JSON-friendly value. + */ + toJSON() { + const { gasPrice, maxFeePerGas, maxPriorityFeePerGas } = this; + return { + _type: "FeeData", + gasPrice: toJson(gasPrice), + maxFeePerGas: toJson(maxFeePerGas), + maxPriorityFeePerGas: toJson(maxPriorityFeePerGas), + }; + } +} +; +/** + * Returns a copy of %%req%% with all properties coerced to their strict + * types. + */ +function copyRequest(req) { + const result = {}; + // These could be addresses, ENS names or Addressables + if (req.to) { + result.to = req.to; + } + if (req.from) { + result.from = req.from; + } + if (req.data) { + result.data = data_hexlify(req.data); + } + const bigIntKeys = "chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/); + for (const key of bigIntKeys) { + if (!(key in req) || req[key] == null) { + continue; + } + result[key] = getBigInt(req[key], `request.${key}`); + } + const numberKeys = "type,nonce".split(/,/); + for (const key of numberKeys) { + if (!(key in req) || req[key] == null) { + continue; + } + result[key] = getNumber(req[key], `request.${key}`); + } + if (req.accessList) { + result.accessList = accessListify(req.accessList); + } + if ("blockTag" in req) { + result.blockTag = req.blockTag; + } + if ("enableCcipRead" in req) { + result.enableCcipRead = !!req.enableCcipRead; + } + if ("customData" in req) { + result.customData = req.customData; + } + if ("blobVersionedHashes" in req && req.blobVersionedHashes) { + result.blobVersionedHashes = req.blobVersionedHashes.slice(); + } + if ("kzg" in req) { + result.kzg = req.kzg; + } + if ("blobs" in req && req.blobs) { + result.blobs = req.blobs.map((b) => { + if (data_isBytesLike(b)) { + return data_hexlify(b); + } + return Object.assign({}, b); + }); + } + return result; +} +/** + * A **Block** represents the data associated with a full block on + * Ethereum. + */ +class Block { + /** + * The provider connected to the block used to fetch additional details + * if necessary. + */ + provider; + /** + * The block number, sometimes called the block height. This is a + * sequential number that is one higher than the parent block. + */ + number; + /** + * The block hash. + * + * This hash includes all properties, so can be safely used to identify + * an exact set of block properties. + */ + hash; + /** + * The timestamp for this block, which is the number of seconds since + * epoch that this block was included. + */ + timestamp; + /** + * The block hash of the parent block. + */ + parentHash; + /** + * The hash tree root of the parent beacon block for the given + * execution block. See [[link-eip-4788]]. + */ + parentBeaconBlockRoot; + /** + * The nonce. + * + * On legacy networks, this is the random number inserted which + * permitted the difficulty target to be reached. + */ + nonce; + /** + * The difficulty target. + * + * On legacy networks, this is the proof-of-work target required + * for a block to meet the protocol rules to be included. + * + * On modern networks, this is a random number arrived at using + * randao. @TODO: Find links? + */ + difficulty; + /** + * The total gas limit for this block. + */ + gasLimit; + /** + * The total gas used in this block. + */ + gasUsed; + /** + * The root hash for the global state after applying changes + * in this block. + */ + stateRoot; + /** + * The hash of the transaction receipts trie. + */ + receiptsRoot; + /** + * The total amount of blob gas consumed by the transactions + * within the block. See [[link-eip-4844]]. + */ + blobGasUsed; + /** + * The running total of blob gas consumed in excess of the + * target, prior to the block. See [[link-eip-4844]]. + */ + excessBlobGas; + /** + * The miner coinbase address, wihch receives any subsidies for + * including this block. + */ + miner; + /** + * The latest RANDAO mix of the post beacon state of + * the previous block. + */ + prevRandao; + /** + * Any extra data the validator wished to include. + */ + extraData; + /** + * The base fee per gas that all transactions in this block were + * charged. + * + * This adjusts after each block, depending on how congested the network + * is. + */ + baseFeePerGas; + #transactions; + /** + * Create a new **Block** object. + * + * This should generally not be necessary as the unless implementing a + * low-level library. + */ + constructor(block, provider) { + this.#transactions = block.transactions.map((tx) => { + if (typeof (tx) !== "string") { + return new TransactionResponse(tx, provider); + } + return tx; + }); + properties_defineProperties(this, { + provider, + hash: provider_getValue(block.hash), + number: block.number, + timestamp: block.timestamp, + parentHash: block.parentHash, + parentBeaconBlockRoot: block.parentBeaconBlockRoot, + nonce: block.nonce, + difficulty: block.difficulty, + gasLimit: block.gasLimit, + gasUsed: block.gasUsed, + blobGasUsed: block.blobGasUsed, + excessBlobGas: block.excessBlobGas, + miner: block.miner, + prevRandao: provider_getValue(block.prevRandao), + extraData: block.extraData, + baseFeePerGas: provider_getValue(block.baseFeePerGas), + stateRoot: block.stateRoot, + receiptsRoot: block.receiptsRoot, + }); + } + /** + * Returns the list of transaction hashes, in the order + * they were executed within the block. + */ + get transactions() { + return this.#transactions.map((tx) => { + if (typeof (tx) === "string") { + return tx; + } + return tx.hash; + }); + } + /** + * Returns the complete transactions, in the order they + * were executed within the block. + * + * This is only available for blocks which prefetched + * transactions, by passing ``true`` to %%prefetchTxs%% + * into [[Provider-getBlock]]. + */ + get prefetchedTransactions() { + const txs = this.#transactions.slice(); + // Doesn't matter... + if (txs.length === 0) { + return []; + } + // Make sure we prefetched the transactions + errors_assert(typeof (txs[0]) === "object", "transactions were not prefetched with block request", "UNSUPPORTED_OPERATION", { + operation: "transactionResponses()" + }); + return txs; + } + /** + * Returns a JSON-friendly value. + */ + toJSON() { + const { baseFeePerGas, difficulty, extraData, gasLimit, gasUsed, hash, miner, prevRandao, nonce, number, parentHash, parentBeaconBlockRoot, stateRoot, receiptsRoot, timestamp, transactions } = this; + return { + _type: "Block", + baseFeePerGas: toJson(baseFeePerGas), + difficulty: toJson(difficulty), + extraData, + gasLimit: toJson(gasLimit), + gasUsed: toJson(gasUsed), + blobGasUsed: toJson(this.blobGasUsed), + excessBlobGas: toJson(this.excessBlobGas), + hash, miner, prevRandao, nonce, number, parentHash, timestamp, + parentBeaconBlockRoot, stateRoot, receiptsRoot, + transactions, + }; + } + [Symbol.iterator]() { + let index = 0; + const txs = this.transactions; + return { + next: () => { + if (index < this.length) { + return { + value: txs[index++], done: false + }; + } + return { value: undefined, done: true }; + } + }; + } + /** + * The number of transactions in this block. + */ + get length() { return this.#transactions.length; } + /** + * The [[link-js-date]] this block was included at. + */ + get date() { + if (this.timestamp == null) { + return null; + } + return new Date(this.timestamp * 1000); + } + /** + * Get the transaction at %%indexe%% within this block. + */ + async getTransaction(indexOrHash) { + // Find the internal value by its index or hash + let tx = undefined; + if (typeof (indexOrHash) === "number") { + tx = this.#transactions[indexOrHash]; + } + else { + const hash = indexOrHash.toLowerCase(); + for (const v of this.#transactions) { + if (typeof (v) === "string") { + if (v !== hash) { + continue; + } + tx = v; + break; + } + else { + if (v.hash === hash) { + continue; + } + tx = v; + break; + } + } + } + if (tx == null) { + throw new Error("no such tx"); + } + if (typeof (tx) === "string") { + return (await this.provider.getTransaction(tx)); + } + else { + return tx; + } + } + /** + * If a **Block** was fetched with a request to include the transactions + * this will allow synchronous access to those transactions. + * + * If the transactions were not prefetched, this will throw. + */ + getPrefetchedTransaction(indexOrHash) { + const txs = this.prefetchedTransactions; + if (typeof (indexOrHash) === "number") { + return txs[indexOrHash]; + } + indexOrHash = indexOrHash.toLowerCase(); + for (const tx of txs) { + if (tx.hash === indexOrHash) { + return tx; + } + } + errors_assertArgument(false, "no matching transaction", "indexOrHash", indexOrHash); + } + /** + * Returns true if this block been mined. This provides a type guard + * for all properties on a [[MinedBlock]]. + */ + isMined() { return !!this.hash; } + /** + * Returns true if this block is an [[link-eip-2930]] block. + */ + isLondon() { + return !!this.baseFeePerGas; + } + /** + * @_ignore: + */ + orphanedEvent() { + if (!this.isMined()) { + throw new Error(""); + } + return createOrphanedBlockFilter(this); + } +} +////////////////////// +// Log +/** + * A **Log** in Ethereum represents an event that has been included in a + * transaction using the ``LOG*`` opcodes, which are most commonly used by + * Solidity's emit for announcing events. + */ +class Log { + /** + * The provider connected to the log used to fetch additional details + * if necessary. + */ + provider; + /** + * The transaction hash of the transaction this log occurred in. Use the + * [[Log-getTransaction]] to get the [[TransactionResponse]]. + */ + transactionHash; + /** + * The block hash of the block this log occurred in. Use the + * [[Log-getBlock]] to get the [[Block]]. + */ + blockHash; + /** + * The block number of the block this log occurred in. It is preferred + * to use the [[Block-hash]] when fetching the related [[Block]], + * since in the case of an orphaned block, the block at that height may + * have changed. + */ + blockNumber; + /** + * If the **Log** represents a block that was removed due to an orphaned + * block, this will be true. + * + * This can only happen within an orphan event listener. + */ + removed; + /** + * The address of the contract that emitted this log. + */ + address; + /** + * The data included in this log when it was emitted. + */ + data; + /** + * The indexed topics included in this log when it was emitted. + * + * All topics are included in the bloom filters, so they can be + * efficiently filtered using the [[Provider-getLogs]] method. + */ + topics; + /** + * The index within the block this log occurred at. This is generally + * not useful to developers, but can be used with the various roots + * to proof inclusion within a block. + */ + index; + /** + * The index within the transaction of this log. + */ + transactionIndex; + /** + * @_ignore: + */ + constructor(log, provider) { + this.provider = provider; + const topics = Object.freeze(log.topics.slice()); + properties_defineProperties(this, { + transactionHash: log.transactionHash, + blockHash: log.blockHash, + blockNumber: log.blockNumber, + removed: log.removed, + address: log.address, + data: log.data, + topics, + index: log.index, + transactionIndex: log.transactionIndex, + }); + } + /** + * Returns a JSON-compatible object. + */ + toJSON() { + const { address, blockHash, blockNumber, data, index, removed, topics, transactionHash, transactionIndex } = this; + return { + _type: "log", + address, blockHash, blockNumber, data, index, + removed, topics, transactionHash, transactionIndex + }; + } + /** + * Returns the block that this log occurred in. + */ + async getBlock() { + const block = await this.provider.getBlock(this.blockHash); + errors_assert(!!block, "failed to find transaction", "UNKNOWN_ERROR", {}); + return block; + } + /** + * Returns the transaction that this log occurred in. + */ + async getTransaction() { + const tx = await this.provider.getTransaction(this.transactionHash); + errors_assert(!!tx, "failed to find transaction", "UNKNOWN_ERROR", {}); + return tx; + } + /** + * Returns the transaction receipt fot the transaction that this + * log occurred in. + */ + async getTransactionReceipt() { + const receipt = await this.provider.getTransactionReceipt(this.transactionHash); + errors_assert(!!receipt, "failed to find transaction receipt", "UNKNOWN_ERROR", {}); + return receipt; + } + /** + * @_ignore: + */ + removedEvent() { + return createRemovedLogFilter(this); + } +} +////////////////////// +// Transaction Receipt +/* +export interface LegacyTransactionReceipt { + byzantium: false; + status: null; + root: string; +} + +export interface ByzantiumTransactionReceipt { + byzantium: true; + status: number; + root: null; +} +*/ +/** + * A **TransactionReceipt** includes additional information about a + * transaction that is only available after it has been mined. + */ +class TransactionReceipt { + /** + * The provider connected to the log used to fetch additional details + * if necessary. + */ + provider; + /** + * The address the transaction was sent to. + */ + to; + /** + * The sender of the transaction. + */ + from; + /** + * The address of the contract if the transaction was directly + * responsible for deploying one. + * + * This is non-null **only** if the ``to`` is empty and the ``data`` + * was successfully executed as initcode. + */ + contractAddress; + /** + * The transaction hash. + */ + hash; + /** + * The index of this transaction within the block transactions. + */ + index; + /** + * The block hash of the [[Block]] this transaction was included in. + */ + blockHash; + /** + * The block number of the [[Block]] this transaction was included in. + */ + blockNumber; + /** + * The bloom filter bytes that represent all logs that occurred within + * this transaction. This is generally not useful for most developers, + * but can be used to validate the included logs. + */ + logsBloom; + /** + * The actual amount of gas used by this transaction. + * + * When creating a transaction, the amount of gas that will be used can + * only be approximated, but the sender must pay the gas fee for the + * entire gas limit. After the transaction, the difference is refunded. + */ + gasUsed; + /** + * The gas used for BLObs. See [[link-eip-4844]]. + */ + blobGasUsed; + /** + * The amount of gas used by all transactions within the block for this + * and all transactions with a lower ``index``. + * + * This is generally not useful for developers but can be used to + * validate certain aspects of execution. + */ + cumulativeGasUsed; + /** + * The actual gas price used during execution. + * + * Due to the complexity of [[link-eip-1559]] this value can only + * be caluclated after the transaction has been mined, snce the base + * fee is protocol-enforced. + */ + gasPrice; + /** + * The price paid per BLOB in gas. See [[link-eip-4844]]. + */ + blobGasPrice; + /** + * The [[link-eip-2718]] transaction type. + */ + type; + //readonly byzantium!: boolean; + /** + * The status of this transaction, indicating success (i.e. ``1``) or + * a revert (i.e. ``0``). + * + * This is available in post-byzantium blocks, but some backends may + * backfill this value. + */ + status; + /** + * The root hash of this transaction. + * + * This is no present and was only included in pre-byzantium blocks, but + * could be used to validate certain parts of the receipt. + */ + root; + #logs; + /** + * @_ignore: + */ + constructor(tx, provider) { + this.#logs = Object.freeze(tx.logs.map((log) => { + return new Log(log, provider); + })); + let gasPrice = provider_BN_0; + if (tx.effectiveGasPrice != null) { + gasPrice = tx.effectiveGasPrice; + } + else if (tx.gasPrice != null) { + gasPrice = tx.gasPrice; + } + properties_defineProperties(this, { + provider, + to: tx.to, + from: tx.from, + contractAddress: tx.contractAddress, + hash: tx.hash, + index: tx.index, + blockHash: tx.blockHash, + blockNumber: tx.blockNumber, + logsBloom: tx.logsBloom, + gasUsed: tx.gasUsed, + cumulativeGasUsed: tx.cumulativeGasUsed, + blobGasUsed: tx.blobGasUsed, + gasPrice, + blobGasPrice: tx.blobGasPrice, + type: tx.type, + //byzantium: tx.byzantium, + status: tx.status, + root: tx.root + }); + } + /** + * The logs for this transaction. + */ + get logs() { return this.#logs; } + /** + * Returns a JSON-compatible representation. + */ + toJSON() { + const { to, from, contractAddress, hash, index, blockHash, blockNumber, logsBloom, logs, //byzantium, + status, root } = this; + return { + _type: "TransactionReceipt", + blockHash, blockNumber, + //byzantium, + contractAddress, + cumulativeGasUsed: toJson(this.cumulativeGasUsed), + from, + gasPrice: toJson(this.gasPrice), + blobGasUsed: toJson(this.blobGasUsed), + blobGasPrice: toJson(this.blobGasPrice), + gasUsed: toJson(this.gasUsed), + hash, index, logs, logsBloom, root, status, to + }; + } + /** + * @_ignore: + */ + get length() { return this.logs.length; } + [Symbol.iterator]() { + let index = 0; + return { + next: () => { + if (index < this.length) { + return { value: this.logs[index++], done: false }; + } + return { value: undefined, done: true }; + } + }; + } + /** + * The total fee for this transaction, in wei. + */ + get fee() { + return this.gasUsed * this.gasPrice; + } + /** + * Resolves to the block this transaction occurred in. + */ + async getBlock() { + const block = await this.provider.getBlock(this.blockHash); + if (block == null) { + throw new Error("TODO"); + } + return block; + } + /** + * Resolves to the transaction this transaction occurred in. + */ + async getTransaction() { + const tx = await this.provider.getTransaction(this.hash); + if (tx == null) { + throw new Error("TODO"); + } + return tx; + } + /** + * Resolves to the return value of the execution of this transaction. + * + * Support for this feature is limited, as it requires an archive node + * with the ``debug_`` or ``trace_`` API enabled. + */ + async getResult() { + return (await this.provider.getTransactionResult(this.hash)); + } + /** + * Resolves to the number of confirmations this transaction has. + */ + async confirmations() { + return (await this.provider.getBlockNumber()) - this.blockNumber + 1; + } + /** + * @_ignore: + */ + removedEvent() { + return createRemovedTransactionFilter(this); + } + /** + * @_ignore: + */ + reorderedEvent(other) { + errors_assert(!other || other.isMined(), "unmined 'other' transction cannot be orphaned", "UNSUPPORTED_OPERATION", { operation: "reorderedEvent(other)" }); + return createReorderedTransactionFilter(this, other); + } +} +/** + * A **TransactionResponse** includes all properties about a transaction + * that was sent to the network, which may or may not be included in a + * block. + * + * The [[TransactionResponse-isMined]] can be used to check if the + * transaction has been mined as well as type guard that the otherwise + * possibly ``null`` properties are defined. + */ +class TransactionResponse { + /** + * The provider this is connected to, which will influence how its + * methods will resolve its async inspection methods. + */ + provider; + /** + * The block number of the block that this transaction was included in. + * + * This is ``null`` for pending transactions. + */ + blockNumber; + /** + * The blockHash of the block that this transaction was included in. + * + * This is ``null`` for pending transactions. + */ + blockHash; + /** + * The index within the block that this transaction resides at. + */ + index; + /** + * The transaction hash. + */ + hash; + /** + * The [[link-eip-2718]] transaction envelope type. This is + * ``0`` for legacy transactions types. + */ + type; + /** + * The receiver of this transaction. + * + * If ``null``, then the transaction is an initcode transaction. + * This means the result of executing the [[data]] will be deployed + * as a new contract on chain (assuming it does not revert) and the + * address may be computed using [[getCreateAddress]]. + */ + to; + /** + * The sender of this transaction. It is implicitly computed + * from the transaction pre-image hash (as the digest) and the + * [[signature]] using ecrecover. + */ + from; + /** + * The nonce, which is used to prevent replay attacks and offer + * a method to ensure transactions from a given sender are explicitly + * ordered. + * + * When sending a transaction, this must be equal to the number of + * transactions ever sent by [[from]]. + */ + nonce; + /** + * The maximum units of gas this transaction can consume. If execution + * exceeds this, the entries transaction is reverted and the sender + * is charged for the full amount, despite not state changes being made. + */ + gasLimit; + /** + * The gas price can have various values, depending on the network. + * + * In modern networks, for transactions that are included this is + * the //effective gas price// (the fee per gas that was actually + * charged), while for transactions that have not been included yet + * is the [[maxFeePerGas]]. + * + * For legacy transactions, or transactions on legacy networks, this + * is the fee that will be charged per unit of gas the transaction + * consumes. + */ + gasPrice; + /** + * The maximum priority fee (per unit of gas) to allow a + * validator to charge the sender. This is inclusive of the + * [[maxFeeFeePerGas]]. + */ + maxPriorityFeePerGas; + /** + * The maximum fee (per unit of gas) to allow this transaction + * to charge the sender. + */ + maxFeePerGas; + /** + * The [[link-eip-4844]] max fee per BLOb gas. + */ + maxFeePerBlobGas; + /** + * The data. + */ + data; + /** + * The value, in wei. Use [[formatEther]] to format this value + * as ether. + */ + value; + /** + * The chain ID. + */ + chainId; + /** + * The signature. + */ + signature; + /** + * The [[link-eip-2930]] access list for transaction types that + * support it, otherwise ``null``. + */ + accessList; + /** + * The [[link-eip-4844]] BLOb versioned hashes. + */ + blobVersionedHashes; + #startBlock; + /** + * @_ignore: + */ + constructor(tx, provider) { + this.provider = provider; + this.blockNumber = (tx.blockNumber != null) ? tx.blockNumber : null; + this.blockHash = (tx.blockHash != null) ? tx.blockHash : null; + this.hash = tx.hash; + this.index = tx.index; + this.type = tx.type; + this.from = tx.from; + this.to = tx.to || null; + this.gasLimit = tx.gasLimit; + this.nonce = tx.nonce; + this.data = tx.data; + this.value = tx.value; + this.gasPrice = tx.gasPrice; + this.maxPriorityFeePerGas = (tx.maxPriorityFeePerGas != null) ? tx.maxPriorityFeePerGas : null; + this.maxFeePerGas = (tx.maxFeePerGas != null) ? tx.maxFeePerGas : null; + this.maxFeePerBlobGas = (tx.maxFeePerBlobGas != null) ? tx.maxFeePerBlobGas : null; + this.chainId = tx.chainId; + this.signature = tx.signature; + this.accessList = (tx.accessList != null) ? tx.accessList : null; + this.blobVersionedHashes = (tx.blobVersionedHashes != null) ? tx.blobVersionedHashes : null; + this.#startBlock = -1; + } + /** + * Returns a JSON-compatible representation of this transaction. + */ + toJSON() { + const { blockNumber, blockHash, index, hash, type, to, from, nonce, data, signature, accessList, blobVersionedHashes } = this; + return { + _type: "TransactionResponse", + accessList, blockNumber, blockHash, + blobVersionedHashes, + chainId: toJson(this.chainId), + data, from, + gasLimit: toJson(this.gasLimit), + gasPrice: toJson(this.gasPrice), + hash, + maxFeePerGas: toJson(this.maxFeePerGas), + maxPriorityFeePerGas: toJson(this.maxPriorityFeePerGas), + maxFeePerBlobGas: toJson(this.maxFeePerBlobGas), + nonce, signature, to, index, type, + value: toJson(this.value), + }; + } + /** + * Resolves to the Block that this transaction was included in. + * + * This will return null if the transaction has not been included yet. + */ + async getBlock() { + let blockNumber = this.blockNumber; + if (blockNumber == null) { + const tx = await this.getTransaction(); + if (tx) { + blockNumber = tx.blockNumber; + } + } + if (blockNumber == null) { + return null; + } + const block = this.provider.getBlock(blockNumber); + if (block == null) { + throw new Error("TODO"); + } + return block; + } + /** + * Resolves to this transaction being re-requested from the + * provider. This can be used if you have an unmined transaction + * and wish to get an up-to-date populated instance. + */ + async getTransaction() { + return this.provider.getTransaction(this.hash); + } + /** + * Resolve to the number of confirmations this transaction has. + */ + async confirmations() { + if (this.blockNumber == null) { + const { tx, blockNumber } = await resolveProperties({ + tx: this.getTransaction(), + blockNumber: this.provider.getBlockNumber() + }); + // Not mined yet... + if (tx == null || tx.blockNumber == null) { + return 0; + } + return blockNumber - tx.blockNumber + 1; + } + const blockNumber = await this.provider.getBlockNumber(); + return blockNumber - this.blockNumber + 1; + } + /** + * Resolves once this transaction has been mined and has + * %%confirms%% blocks including it (default: ``1``) with an + * optional %%timeout%%. + * + * This can resolve to ``null`` only if %%confirms%% is ``0`` + * and the transaction has not been mined, otherwise this will + * wait until enough confirmations have completed. + */ + async wait(_confirms, _timeout) { + const confirms = (_confirms == null) ? 1 : _confirms; + const timeout = (_timeout == null) ? 0 : _timeout; + let startBlock = this.#startBlock; + let nextScan = -1; + let stopScanning = (startBlock === -1) ? true : false; + const checkReplacement = async () => { + // Get the current transaction count for this sender + if (stopScanning) { + return null; + } + const { blockNumber, nonce } = await resolveProperties({ + blockNumber: this.provider.getBlockNumber(), + nonce: this.provider.getTransactionCount(this.from) + }); + // No transaction or our nonce has not been mined yet; but we + // can start scanning later when we do start + if (nonce < this.nonce) { + startBlock = blockNumber; + return; + } + // We were mined; no replacement + if (stopScanning) { + return null; + } + const mined = await this.getTransaction(); + if (mined && mined.blockNumber != null) { + return; + } + // We were replaced; start scanning for that transaction + // Starting to scan; look back a few extra blocks for safety + if (nextScan === -1) { + nextScan = startBlock - 3; + if (nextScan < this.#startBlock) { + nextScan = this.#startBlock; + } + } + while (nextScan <= blockNumber) { + // Get the next block to scan + if (stopScanning) { + return null; + } + const block = await this.provider.getBlock(nextScan, true); + // This should not happen; but we'll try again shortly + if (block == null) { + return; + } + // We were mined; no replacement + for (const hash of block) { + if (hash === this.hash) { + return; + } + } + // Search for the transaction that replaced us + for (let i = 0; i < block.length; i++) { + const tx = await block.getTransaction(i); + if (tx.from === this.from && tx.nonce === this.nonce) { + // Get the receipt + if (stopScanning) { + return null; + } + const receipt = await this.provider.getTransactionReceipt(tx.hash); + // This should not happen; but we'll try again shortly + if (receipt == null) { + return; + } + // We will retry this on the next block (this case could be optimized) + if ((blockNumber - receipt.blockNumber + 1) < confirms) { + return; + } + // The reason we were replaced + let reason = "replaced"; + if (tx.data === this.data && tx.to === this.to && tx.value === this.value) { + reason = "repriced"; + } + else if (tx.data === "0x" && tx.from === tx.to && tx.value === provider_BN_0) { + reason = "cancelled"; + } + errors_assert(false, "transaction was replaced", "TRANSACTION_REPLACED", { + cancelled: (reason === "replaced" || reason === "cancelled"), + reason, + replacement: tx.replaceableTransaction(startBlock), + hash: tx.hash, + receipt + }); + } + } + nextScan++; + } + return; + }; + const checkReceipt = (receipt) => { + if (receipt == null || receipt.status !== 0) { + return receipt; + } + errors_assert(false, "transaction execution reverted", "CALL_EXCEPTION", { + action: "sendTransaction", + data: null, reason: null, invocation: null, revert: null, + transaction: { + to: receipt.to, + from: receipt.from, + data: "" // @TODO: in v7, split out sendTransaction properties + }, receipt + }); + }; + const receipt = await this.provider.getTransactionReceipt(this.hash); + if (confirms === 0) { + return checkReceipt(receipt); + } + if (receipt) { + if ((await receipt.confirmations()) >= confirms) { + return checkReceipt(receipt); + } + } + else { + // Check for a replacement; throws if a replacement was found + await checkReplacement(); + // Allow null only when the confirms is 0 + if (confirms === 0) { + return null; + } + } + const waiter = new Promise((resolve, reject) => { + // List of things to cancel when we have a result (one way or the other) + const cancellers = []; + const cancel = () => { cancellers.forEach((c) => c()); }; + // On cancel, stop scanning for replacements + cancellers.push(() => { stopScanning = true; }); + // Set up any timeout requested + if (timeout > 0) { + const timer = setTimeout(() => { + cancel(); + reject(makeError("wait for transaction timeout", "TIMEOUT")); + }, timeout); + cancellers.push(() => { clearTimeout(timer); }); + } + const txListener = async (receipt) => { + // Done; return it! + if ((await receipt.confirmations()) >= confirms) { + cancel(); + try { + resolve(checkReceipt(receipt)); + } + catch (error) { + reject(error); + } + } + }; + cancellers.push(() => { this.provider.off(this.hash, txListener); }); + this.provider.on(this.hash, txListener); + // We support replacement detection; start checking + if (startBlock >= 0) { + const replaceListener = async () => { + try { + // Check for a replacement; this throws only if one is found + await checkReplacement(); + } + catch (error) { + // We were replaced (with enough confirms); re-throw the error + if (isError(error, "TRANSACTION_REPLACED")) { + cancel(); + reject(error); + return; + } + } + // Rescheudle a check on the next block + if (!stopScanning) { + this.provider.once("block", replaceListener); + } + }; + cancellers.push(() => { this.provider.off("block", replaceListener); }); + this.provider.once("block", replaceListener); + } + }); + return await waiter; + } + /** + * Returns ``true`` if this transaction has been included. + * + * This is effective only as of the time the TransactionResponse + * was instantiated. To get up-to-date information, use + * [[getTransaction]]. + * + * This provides a Type Guard that this transaction will have + * non-null property values for properties that are null for + * unmined transactions. + */ + isMined() { + return (this.blockHash != null); + } + /** + * Returns true if the transaction is a legacy (i.e. ``type == 0``) + * transaction. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isLegacy() { + return (this.type === 0); + } + /** + * Returns true if the transaction is a Berlin (i.e. ``type == 1``) + * transaction. See [[link-eip-2070]]. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isBerlin() { + return (this.type === 1); + } + /** + * Returns true if the transaction is a London (i.e. ``type == 2``) + * transaction. See [[link-eip-1559]]. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isLondon() { + return (this.type === 2); + } + /** + * Returns true if hte transaction is a Cancun (i.e. ``type == 3``) + * transaction. See [[link-eip-4844]]. + */ + isCancun() { + return (this.type === 3); + } + /** + * Returns a filter which can be used to listen for orphan events + * that evict this transaction. + */ + removedEvent() { + errors_assert(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); + return createRemovedTransactionFilter(this); + } + /** + * Returns a filter which can be used to listen for orphan events + * that re-order this event against %%other%%. + */ + reorderedEvent(other) { + errors_assert(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); + errors_assert(!other || other.isMined(), "unmined 'other' transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); + return createReorderedTransactionFilter(this, other); + } + /** + * Returns a new TransactionResponse instance which has the ability to + * detect (and throw an error) if the transaction is replaced, which + * will begin scanning at %%startBlock%%. + * + * This should generally not be used by developers and is intended + * primarily for internal use. Setting an incorrect %%startBlock%% can + * have devastating performance consequences if used incorrectly. + */ + replaceableTransaction(startBlock) { + errors_assertArgument(Number.isInteger(startBlock) && startBlock >= 0, "invalid startBlock", "startBlock", startBlock); + const tx = new TransactionResponse(this, this.provider); + tx.#startBlock = startBlock; + return tx; + } +} +function createOrphanedBlockFilter(block) { + return { orphan: "drop-block", hash: block.hash, number: block.number }; +} +function createReorderedTransactionFilter(tx, other) { + return { orphan: "reorder-transaction", tx, other }; +} +function createRemovedTransactionFilter(tx) { + return { orphan: "drop-transaction", tx }; +} +function createRemovedLogFilter(log) { + return { orphan: "drop-log", log: { + transactionHash: log.transactionHash, + blockHash: log.blockHash, + blockNumber: log.blockNumber, + address: log.address, + data: log.data, + topics: Object.freeze(log.topics.slice()), + index: log.index + } }; +} +//# sourceMappingURL=provider.js.map +;// ./node_modules/ethers/lib.esm/utils/events.js +/** + * Events allow for applications to use the observer pattern, which + * allows subscribing and publishing events, outside the normal + * execution paths. + * + * @_section api/utils/events:Events [about-events] + */ + +/** + * When an [[EventEmitterable]] triggers a [[Listener]], the + * callback always ahas one additional argument passed, which is + * an **EventPayload**. + */ +class EventPayload { + /** + * The event filter. + */ + filter; + /** + * The **EventEmitterable**. + */ + emitter; + #listener; + /** + * Create a new **EventPayload** for %%emitter%% with + * the %%listener%% and for %%filter%%. + */ + constructor(emitter, listener, filter) { + this.#listener = listener; + properties_defineProperties(this, { emitter, filter }); + } + /** + * Unregister the triggered listener for future events. + */ + async removeListener() { + if (this.#listener == null) { + return; + } + await this.emitter.off(this.filter, this.#listener); + } +} +//# sourceMappingURL=events.js.map +;// ./node_modules/ethers/lib.esm/contract/wrappers.js +// import from provider.ts instead of index.ts to prevent circular dep +// from EtherscanProvider + + +/** + * An **EventLog** contains additional properties parsed from the [[Log]]. + */ +class EventLog extends Log { + /** + * The Contract Interface. + */ + interface; + /** + * The matching event. + */ + fragment; + /** + * The parsed arguments passed to the event by ``emit``. + */ + args; + /** + * @_ignore: + */ + constructor(log, iface, fragment) { + super(log, log.provider); + const args = iface.decodeEventLog(fragment, log.data, log.topics); + properties_defineProperties(this, { args, fragment, interface: iface }); + } + /** + * The name of the event. + */ + get eventName() { return this.fragment.name; } + /** + * The signature of the event. + */ + get eventSignature() { return this.fragment.format(); } +} +/** + * An **EventLog** contains additional properties parsed from the [[Log]]. + */ +class UndecodedEventLog extends Log { + /** + * The error encounted when trying to decode the log. + */ + error; + /** + * @_ignore: + */ + constructor(log, error) { + super(log, log.provider); + properties_defineProperties(this, { error }); + } +} +/** + * A **ContractTransactionReceipt** includes the parsed logs from a + * [[TransactionReceipt]]. + */ +class ContractTransactionReceipt extends TransactionReceipt { + #iface; + /** + * @_ignore: + */ + constructor(iface, provider, tx) { + super(tx, provider); + this.#iface = iface; + } + /** + * The parsed logs for any [[Log]] which has a matching event in the + * Contract ABI. + */ + get logs() { + return super.logs.map((log) => { + const fragment = log.topics.length ? this.#iface.getEvent(log.topics[0]) : null; + if (fragment) { + try { + return new EventLog(log, this.#iface, fragment); + } + catch (error) { + return new UndecodedEventLog(log, error); + } + } + return log; + }); + } +} +/** + * A **ContractTransactionResponse** will return a + * [[ContractTransactionReceipt]] when waited on. + */ +class ContractTransactionResponse extends TransactionResponse { + #iface; + /** + * @_ignore: + */ + constructor(iface, provider, tx) { + super(tx, provider); + this.#iface = iface; + } + /** + * Resolves once this transaction has been mined and has + * %%confirms%% blocks including it (default: ``1``) with an + * optional %%timeout%%. + * + * This can resolve to ``null`` only if %%confirms%% is ``0`` + * and the transaction has not been mined, otherwise this will + * wait until enough confirmations have completed. + */ + async wait(confirms, timeout) { + const receipt = await super.wait(confirms, timeout); + if (receipt == null) { + return null; + } + return new ContractTransactionReceipt(this.#iface, this.provider, receipt); + } +} +/** + * A **ContractUnknownEventPayload** is included as the last parameter to + * Contract Events when the event does not match any events in the ABI. + */ +class ContractUnknownEventPayload extends EventPayload { + /** + * The log with no matching events. + */ + log; + /** + * @_event: + */ + constructor(contract, listener, filter, log) { + super(contract, listener, filter); + properties_defineProperties(this, { log }); + } + /** + * Resolves to the block the event occured in. + */ + async getBlock() { + return await this.log.getBlock(); + } + /** + * Resolves to the transaction the event occured in. + */ + async getTransaction() { + return await this.log.getTransaction(); + } + /** + * Resolves to the transaction receipt the event occured in. + */ + async getTransactionReceipt() { + return await this.log.getTransactionReceipt(); + } +} +/** + * A **ContractEventPayload** is included as the last parameter to + * Contract Events when the event is known. + */ +class ContractEventPayload extends ContractUnknownEventPayload { + /** + * @_ignore: + */ + constructor(contract, listener, filter, fragment, _log) { + super(contract, listener, filter, new EventLog(_log, contract.interface, fragment)); + const args = contract.interface.decodeEventLog(fragment, this.log.data, this.log.topics); + properties_defineProperties(this, { args, fragment }); + } + /** + * The event name. + */ + get eventName() { + return this.fragment.name; + } + /** + * The event signature. + */ + get eventSignature() { + return this.fragment.format(); + } +} +//# sourceMappingURL=wrappers.js.map +;// ./node_modules/ethers/lib.esm/contract/contract.js + + +// import from provider.ts instead of index.ts to prevent circular dep +// from EtherscanProvider + + + +const contract_BN_0 = BigInt(0); +function canCall(value) { + return (value && typeof (value.call) === "function"); +} +function canEstimate(value) { + return (value && typeof (value.estimateGas) === "function"); +} +function canResolve(value) { + return (value && typeof (value.resolveName) === "function"); +} +function canSend(value) { + return (value && typeof (value.sendTransaction) === "function"); +} +function getResolver(value) { + if (value != null) { + if (canResolve(value)) { + return value; + } + if (value.provider) { + return value.provider; + } + } + return undefined; +} +class PreparedTopicFilter { + #filter; + fragment; + constructor(contract, fragment, args) { + properties_defineProperties(this, { fragment }); + if (fragment.inputs.length < args.length) { + throw new Error("too many arguments"); + } + // Recursively descend into args and resolve any addresses + const runner = getRunner(contract.runner, "resolveName"); + const resolver = canResolve(runner) ? runner : null; + this.#filter = (async function () { + const resolvedArgs = await Promise.all(fragment.inputs.map((param, index) => { + const arg = args[index]; + if (arg == null) { + return null; + } + return param.walkAsync(args[index], (type, value) => { + if (type === "address") { + if (Array.isArray(value)) { + return Promise.all(value.map((v) => resolveAddress(v, resolver))); + } + return resolveAddress(value, resolver); + } + return value; + }); + })); + return contract.interface.encodeFilterTopics(fragment, resolvedArgs); + })(); + } + getTopicFilter() { + return this.#filter; + } +} +// A = Arguments passed in as a tuple +// R = The result type of the call (i.e. if only one return type, +// the qualified type, otherwise Result) +// D = The type the default call will return (i.e. R for view/pure, +// TransactionResponse otherwise) +//export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = ContractTransactionResponse> { +function getRunner(value, feature) { + if (value == null) { + return null; + } + if (typeof (value[feature]) === "function") { + return value; + } + if (value.provider && typeof (value.provider[feature]) === "function") { + return value.provider; + } + return null; +} +function getProvider(value) { + if (value == null) { + return null; + } + return value.provider || null; +} +/** + * @_ignore: + */ +async function copyOverrides(arg, allowed) { + // Make sure the overrides passed in are a valid overrides object + const _overrides = Typed.dereference(arg, "overrides"); + errors_assertArgument(typeof (_overrides) === "object", "invalid overrides parameter", "overrides", arg); + // Create a shallow copy (we'll deep-ify anything needed during normalizing) + const overrides = copyRequest(_overrides); + errors_assertArgument(overrides.to == null || (allowed || []).indexOf("to") >= 0, "cannot override to", "overrides.to", overrides.to); + errors_assertArgument(overrides.data == null || (allowed || []).indexOf("data") >= 0, "cannot override data", "overrides.data", overrides.data); + // Resolve any from + if (overrides.from) { + overrides.from = overrides.from; + } + return overrides; +} +/** + * @_ignore: + */ +async function resolveArgs(_runner, inputs, args) { + // Recursively descend into args and resolve any addresses + const runner = getRunner(_runner, "resolveName"); + const resolver = canResolve(runner) ? runner : null; + return await Promise.all(inputs.map((param, index) => { + return param.walkAsync(args[index], (type, value) => { + value = Typed.dereference(value, type); + if (type === "address") { + return resolveAddress(value, resolver); + } + return value; + }); + })); +} +function buildWrappedFallback(contract) { + const populateTransaction = async function (overrides) { + // If an overrides was passed in, copy it and normalize the values + const tx = (await copyOverrides(overrides, ["data"])); + tx.to = await contract.getAddress(); + if (tx.from) { + tx.from = await resolveAddress(tx.from, getResolver(contract.runner)); + } + const iface = contract.interface; + const noValue = (getBigInt((tx.value || contract_BN_0), "overrides.value") === contract_BN_0); + const noData = ((tx.data || "0x") === "0x"); + if (iface.fallback && !iface.fallback.payable && iface.receive && !noData && !noValue) { + errors_assertArgument(false, "cannot send data to receive or send value to non-payable fallback", "overrides", overrides); + } + errors_assertArgument(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data); + // Only allow payable contracts to set non-zero value + const payable = iface.receive || (iface.fallback && iface.fallback.payable); + errors_assertArgument(payable || noValue, "cannot send value to non-payable fallback", "overrides.value", tx.value); + // Only allow fallback contracts to set non-empty data + errors_assertArgument(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data); + return tx; + }; + const staticCall = async function (overrides) { + const runner = getRunner(contract.runner, "call"); + errors_assert(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); + const tx = await populateTransaction(overrides); + try { + return await runner.call(tx); + } + catch (error) { + if (isCallException(error) && error.data) { + throw contract.interface.makeError(error.data, tx); + } + throw error; + } + }; + const send = async function (overrides) { + const runner = contract.runner; + errors_assert(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); + const tx = await runner.sendTransaction(await populateTransaction(overrides)); + const provider = getProvider(contract.runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + return new ContractTransactionResponse(contract.interface, provider, tx); + }; + const estimateGas = async function (overrides) { + const runner = getRunner(contract.runner, "estimateGas"); + errors_assert(canEstimate(runner), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }); + return await runner.estimateGas(await populateTransaction(overrides)); + }; + const method = async (overrides) => { + return await send(overrides); + }; + properties_defineProperties(method, { + _contract: contract, + estimateGas, + populateTransaction, + send, staticCall + }); + return method; +} +function buildWrappedMethod(contract, key) { + const getFragment = function (...args) { + const fragment = contract.interface.getFunction(key, args); + errors_assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key, args } + }); + return fragment; + }; + const populateTransaction = async function (...args) { + const fragment = getFragment(...args); + // If an overrides was passed in, copy it and normalize the values + let overrides = {}; + if (fragment.inputs.length + 1 === args.length) { + overrides = await copyOverrides(args.pop()); + if (overrides.from) { + overrides.from = await resolveAddress(overrides.from, getResolver(contract.runner)); + } + } + if (fragment.inputs.length !== args.length) { + throw new Error("internal error: fragment inputs doesn't match arguments; should not happen"); + } + const resolvedArgs = await resolveArgs(contract.runner, fragment.inputs, args); + return Object.assign({}, overrides, await resolveProperties({ + to: contract.getAddress(), + data: contract.interface.encodeFunctionData(fragment, resolvedArgs) + })); + }; + const staticCall = async function (...args) { + const result = await staticCallResult(...args); + if (result.length === 1) { + return result[0]; + } + return result; + }; + const send = async function (...args) { + const runner = contract.runner; + errors_assert(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); + const tx = await runner.sendTransaction(await populateTransaction(...args)); + const provider = getProvider(contract.runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + return new ContractTransactionResponse(contract.interface, provider, tx); + }; + const estimateGas = async function (...args) { + const runner = getRunner(contract.runner, "estimateGas"); + errors_assert(canEstimate(runner), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }); + return await runner.estimateGas(await populateTransaction(...args)); + }; + const staticCallResult = async function (...args) { + const runner = getRunner(contract.runner, "call"); + errors_assert(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); + const tx = await populateTransaction(...args); + let result = "0x"; + try { + result = await runner.call(tx); + } + catch (error) { + if (isCallException(error) && error.data) { + throw contract.interface.makeError(error.data, tx); + } + throw error; + } + const fragment = getFragment(...args); + return contract.interface.decodeFunctionResult(fragment, result); + }; + const method = async (...args) => { + const fragment = getFragment(...args); + if (fragment.constant) { + return await staticCall(...args); + } + return await send(...args); + }; + properties_defineProperties(method, { + name: contract.interface.getFunctionName(key), + _contract: contract, _key: key, + getFragment, + estimateGas, + populateTransaction, + send, staticCall, staticCallResult, + }); + // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) + Object.defineProperty(method, "fragment", { + configurable: false, + enumerable: true, + get: () => { + const fragment = contract.interface.getFunction(key); + errors_assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key } + }); + return fragment; + } + }); + return method; +} +function buildWrappedEvent(contract, key) { + const getFragment = function (...args) { + const fragment = contract.interface.getEvent(key, args); + errors_assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key, args } + }); + return fragment; + }; + const method = function (...args) { + return new PreparedTopicFilter(contract, getFragment(...args), args); + }; + properties_defineProperties(method, { + name: contract.interface.getEventName(key), + _contract: contract, _key: key, + getFragment + }); + // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) + Object.defineProperty(method, "fragment", { + configurable: false, + enumerable: true, + get: () => { + const fragment = contract.interface.getEvent(key); + errors_assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key } + }); + return fragment; + } + }); + return method; +} +// The combination of TypeScrype, Private Fields and Proxies makes +// the world go boom; so we hide variables with some trickery keeping +// a symbol attached to each BaseContract which its sub-class (even +// via a Proxy) can reach and use to look up its internal values. +const contract_internal = Symbol.for("_ethersInternal_contract"); +const internalValues = new WeakMap(); +function setInternal(contract, values) { + internalValues.set(contract[contract_internal], values); +} +function getInternal(contract) { + return internalValues.get(contract[contract_internal]); +} +function isDeferred(value) { + return (value && typeof (value) === "object" && ("getTopicFilter" in value) && + (typeof (value.getTopicFilter) === "function") && value.fragment); +} +async function getSubInfo(contract, event) { + let topics; + let fragment = null; + // Convert named events to topicHash and get the fragment for + // events which need deconstructing. + if (Array.isArray(event)) { + const topicHashify = function (name) { + if (isHexString(name, 32)) { + return name; + } + const fragment = contract.interface.getEvent(name); + errors_assertArgument(fragment, "unknown fragment", "name", name); + return fragment.topicHash; + }; + // Array of Topics and Names; e.g. `[ "0x1234...89ab", "Transfer(address)" ]` + topics = event.map((e) => { + if (e == null) { + return null; + } + if (Array.isArray(e)) { + return e.map(topicHashify); + } + return topicHashify(e); + }); + } + else if (event === "*") { + topics = [null]; + } + else if (typeof (event) === "string") { + if (isHexString(event, 32)) { + // Topic Hash + topics = [event]; + } + else { + // Name or Signature; e.g. `"Transfer", `"Transfer(address)"` + fragment = contract.interface.getEvent(event); + errors_assertArgument(fragment, "unknown fragment", "event", event); + topics = [fragment.topicHash]; + } + } + else if (isDeferred(event)) { + // Deferred Topic Filter; e.g. `contract.filter.Transfer(from)` + topics = await event.getTopicFilter(); + } + else if ("fragment" in event) { + // ContractEvent; e.g. `contract.filter.Transfer` + fragment = event.fragment; + topics = [fragment.topicHash]; + } + else { + errors_assertArgument(false, "unknown event name", "event", event); + } + // Normalize topics and sort TopicSets + topics = topics.map((t) => { + if (t == null) { + return null; + } + if (Array.isArray(t)) { + const items = Array.from(new Set(t.map((t) => t.toLowerCase())).values()); + if (items.length === 1) { + return items[0]; + } + items.sort(); + return items; + } + return t.toLowerCase(); + }); + const tag = topics.map((t) => { + if (t == null) { + return "null"; + } + if (Array.isArray(t)) { + return t.join("|"); + } + return t; + }).join("&"); + return { fragment, tag, topics }; +} +async function hasSub(contract, event) { + const { subs } = getInternal(contract); + return subs.get((await getSubInfo(contract, event)).tag) || null; +} +async function getSub(contract, operation, event) { + // Make sure our runner can actually subscribe to events + const provider = getProvider(contract.runner); + errors_assert(provider, "contract runner does not support subscribing", "UNSUPPORTED_OPERATION", { operation }); + const { fragment, tag, topics } = await getSubInfo(contract, event); + const { addr, subs } = getInternal(contract); + let sub = subs.get(tag); + if (!sub) { + const address = (addr ? addr : contract); + const filter = { address, topics }; + const listener = (log) => { + let foundFragment = fragment; + if (foundFragment == null) { + try { + foundFragment = contract.interface.getEvent(log.topics[0]); + } + catch (error) { } + } + // If fragment is null, we do not deconstruct the args to emit + if (foundFragment) { + const _foundFragment = foundFragment; + const args = fragment ? contract.interface.decodeEventLog(fragment, log.data, log.topics) : []; + emit(contract, event, args, (listener) => { + return new ContractEventPayload(contract, listener, event, _foundFragment, log); + }); + } + else { + emit(contract, event, [], (listener) => { + return new ContractUnknownEventPayload(contract, listener, event, log); + }); + } + }; + let starting = []; + const start = () => { + if (starting.length) { + return; + } + starting.push(provider.on(filter, listener)); + }; + const stop = async () => { + if (starting.length == 0) { + return; + } + let started = starting; + starting = []; + await Promise.all(started); + provider.off(filter, listener); + }; + sub = { tag, listeners: [], start, stop }; + subs.set(tag, sub); + } + return sub; +} +// We use this to ensure one emit resolves before firing the next to +// ensure correct ordering (note this cannot throw and just adds the +// notice to the event queu using setTimeout). +let lastEmit = Promise.resolve(); +async function _emit(contract, event, args, payloadFunc) { + await lastEmit; + const sub = await hasSub(contract, event); + if (!sub) { + return false; + } + const count = sub.listeners.length; + sub.listeners = sub.listeners.filter(({ listener, once }) => { + const passArgs = Array.from(args); + if (payloadFunc) { + passArgs.push(payloadFunc(once ? null : listener)); + } + try { + listener.call(contract, ...passArgs); + } + catch (error) { } + return !once; + }); + if (sub.listeners.length === 0) { + sub.stop(); + getInternal(contract).subs.delete(sub.tag); + } + return (count > 0); +} +async function emit(contract, event, args, payloadFunc) { + try { + await lastEmit; + } + catch (error) { } + const resultPromise = _emit(contract, event, args, payloadFunc); + lastEmit = resultPromise; + return await resultPromise; +} +const contract_passProperties = ["then"]; +class BaseContract { + /** + * The target to connect to. + * + * This can be an address, ENS name or any [[Addressable]], such as + * another contract. To get the resovled address, use the ``getAddress`` + * method. + */ + target; + /** + * The contract Interface. + */ + interface; + /** + * The connected runner. This is generally a [[Provider]] or a + * [[Signer]], which dictates what operations are supported. + * + * For example, a **Contract** connected to a [[Provider]] may + * only execute read-only operations. + */ + runner; + /** + * All the Events available on this contract. + */ + filters; + /** + * @_ignore: + */ + [contract_internal]; + /** + * The fallback or receive function if any. + */ + fallback; + /** + * Creates a new contract connected to %%target%% with the %%abi%% and + * optionally connected to a %%runner%% to perform operations on behalf + * of. + */ + constructor(target, abi, runner, _deployTx) { + errors_assertArgument(typeof (target) === "string" || isAddressable(target), "invalid value for Contract target", "target", target); + if (runner == null) { + runner = null; + } + const iface = interface_Interface.from(abi); + properties_defineProperties(this, { target, runner, interface: iface }); + Object.defineProperty(this, contract_internal, { value: {} }); + let addrPromise; + let addr = null; + let deployTx = null; + if (_deployTx) { + const provider = getProvider(runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + deployTx = new ContractTransactionResponse(this.interface, provider, _deployTx); + } + let subs = new Map(); + // Resolve the target as the address + if (typeof (target) === "string") { + if (isHexString(target)) { + addr = target; + addrPromise = Promise.resolve(target); + } + else { + const resolver = getRunner(runner, "resolveName"); + if (!canResolve(resolver)) { + throw makeError("contract runner does not support name resolution", "UNSUPPORTED_OPERATION", { + operation: "resolveName" + }); + } + addrPromise = resolver.resolveName(target).then((addr) => { + if (addr == null) { + throw makeError("an ENS name used for a contract target must be correctly configured", "UNCONFIGURED_NAME", { + value: target + }); + } + getInternal(this).addr = addr; + return addr; + }); + } + } + else { + addrPromise = target.getAddress().then((addr) => { + if (addr == null) { + throw new Error("TODO"); + } + getInternal(this).addr = addr; + return addr; + }); + } + // Set our private values + setInternal(this, { addrPromise, addr, deployTx, subs }); + // Add the event filters + const filters = new Proxy({}, { + get: (target, prop, receiver) => { + // Pass important checks (like `then` for Promise) through + if (typeof (prop) === "symbol" || contract_passProperties.indexOf(prop) >= 0) { + return Reflect.get(target, prop, receiver); + } + try { + return this.getEvent(prop); + } + catch (error) { + if (!isError(error, "INVALID_ARGUMENT") || error.argument !== "key") { + throw error; + } + } + return undefined; + }, + has: (target, prop) => { + // Pass important checks (like `then` for Promise) through + if (contract_passProperties.indexOf(prop) >= 0) { + return Reflect.has(target, prop); + } + return Reflect.has(target, prop) || this.interface.hasEvent(String(prop)); + } + }); + properties_defineProperties(this, { filters }); + properties_defineProperties(this, { + fallback: ((iface.receive || iface.fallback) ? (buildWrappedFallback(this)) : null) + }); + // Return a Proxy that will respond to functions + return new Proxy(this, { + get: (target, prop, receiver) => { + if (typeof (prop) === "symbol" || prop in target || contract_passProperties.indexOf(prop) >= 0) { + return Reflect.get(target, prop, receiver); + } + // Undefined properties should return undefined + try { + return target.getFunction(prop); + } + catch (error) { + if (!isError(error, "INVALID_ARGUMENT") || error.argument !== "key") { + throw error; + } + } + return undefined; + }, + has: (target, prop) => { + if (typeof (prop) === "symbol" || prop in target || contract_passProperties.indexOf(prop) >= 0) { + return Reflect.has(target, prop); + } + return target.interface.hasFunction(prop); + } + }); + } + /** + * Return a new Contract instance with the same target and ABI, but + * a different %%runner%%. + */ + connect(runner) { + return new BaseContract(this.target, this.interface, runner); + } + /** + * Return a new Contract instance with the same ABI and runner, but + * a different %%target%%. + */ + attach(target) { + return new BaseContract(target, this.interface, this.runner); + } + /** + * Return the resolved address of this Contract. + */ + async getAddress() { return await getInternal(this).addrPromise; } + /** + * Return the deployed bytecode or null if no bytecode is found. + */ + async getDeployedCode() { + const provider = getProvider(this.runner); + errors_assert(provider, "runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "getDeployedCode" }); + const code = await provider.getCode(await this.getAddress()); + if (code === "0x") { + return null; + } + return code; + } + /** + * Resolve to this Contract once the bytecode has been deployed, or + * resolve immediately if already deployed. + */ + async waitForDeployment() { + // We have the deployement transaction; just use that (throws if deployement fails) + const deployTx = this.deploymentTransaction(); + if (deployTx) { + await deployTx.wait(); + return this; + } + // Check for code + const code = await this.getDeployedCode(); + if (code != null) { + return this; + } + // Make sure we can subscribe to a provider event + const provider = getProvider(this.runner); + errors_assert(provider != null, "contract runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "waitForDeployment" }); + return new Promise((resolve, reject) => { + const checkCode = async () => { + try { + const code = await this.getDeployedCode(); + if (code != null) { + return resolve(this); + } + provider.once("block", checkCode); + } + catch (error) { + reject(error); + } + }; + checkCode(); + }); + } + /** + * Return the transaction used to deploy this contract. + * + * This is only available if this instance was returned from a + * [[ContractFactory]]. + */ + deploymentTransaction() { + return getInternal(this).deployTx; + } + /** + * Return the function for a given name. This is useful when a contract + * method name conflicts with a JavaScript name such as ``prototype`` or + * when using a Contract programatically. + */ + getFunction(key) { + if (typeof (key) !== "string") { + key = key.format(); + } + const func = buildWrappedMethod(this, key); + return func; + } + /** + * Return the event for a given name. This is useful when a contract + * event name conflicts with a JavaScript name such as ``prototype`` or + * when using a Contract programatically. + */ + getEvent(key) { + if (typeof (key) !== "string") { + key = key.format(); + } + return buildWrappedEvent(this, key); + } + /** + * @_ignore: + */ + async queryTransaction(hash) { + throw new Error("@TODO"); + } + /* + // @TODO: this is a non-backwards compatible change, but will be added + // in v7 and in a potential SmartContract class in an upcoming + // v6 release + async getTransactionReceipt(hash: string): Promise { + const provider = getProvider(this.runner); + assert(provider, "contract runner does not have a provider", + "UNSUPPORTED_OPERATION", { operation: "queryTransaction" }); + + const receipt = await provider.getTransactionReceipt(hash); + if (receipt == null) { return null; } + + return new ContractTransactionReceipt(this.interface, provider, receipt); + } + */ + /** + * Provide historic access to event data for %%event%% in the range + * %%fromBlock%% (default: ``0``) to %%toBlock%% (default: ``"latest"``) + * inclusive. + */ + async queryFilter(event, fromBlock, toBlock) { + if (fromBlock == null) { + fromBlock = 0; + } + if (toBlock == null) { + toBlock = "latest"; + } + const { addr, addrPromise } = getInternal(this); + const address = (addr ? addr : (await addrPromise)); + const { fragment, topics } = await getSubInfo(this, event); + const filter = { address, topics, fromBlock, toBlock }; + const provider = getProvider(this.runner); + errors_assert(provider, "contract runner does not have a provider", "UNSUPPORTED_OPERATION", { operation: "queryFilter" }); + return (await provider.getLogs(filter)).map((log) => { + let foundFragment = fragment; + if (foundFragment == null) { + try { + foundFragment = this.interface.getEvent(log.topics[0]); + } + catch (error) { } + } + if (foundFragment) { + try { + return new EventLog(log, this.interface, foundFragment); + } + catch (error) { + return new UndecodedEventLog(log, error); + } + } + return new Log(log, provider); + }); + } + /** + * Add an event %%listener%% for the %%event%%. + */ + async on(event, listener) { + const sub = await getSub(this, "on", event); + sub.listeners.push({ listener, once: false }); + sub.start(); + return this; + } + /** + * Add an event %%listener%% for the %%event%%, but remove the listener + * after it is fired once. + */ + async once(event, listener) { + const sub = await getSub(this, "once", event); + sub.listeners.push({ listener, once: true }); + sub.start(); + return this; + } + /** + * Emit an %%event%% calling all listeners with %%args%%. + * + * Resolves to ``true`` if any listeners were called. + */ + async emit(event, ...args) { + return await emit(this, event, args, null); + } + /** + * Resolves to the number of listeners of %%event%% or the total number + * of listeners if unspecified. + */ + async listenerCount(event) { + if (event) { + const sub = await hasSub(this, event); + if (!sub) { + return 0; + } + return sub.listeners.length; + } + const { subs } = getInternal(this); + let total = 0; + for (const { listeners } of subs.values()) { + total += listeners.length; + } + return total; + } + /** + * Resolves to the listeners subscribed to %%event%% or all listeners + * if unspecified. + */ + async listeners(event) { + if (event) { + const sub = await hasSub(this, event); + if (!sub) { + return []; + } + return sub.listeners.map(({ listener }) => listener); + } + const { subs } = getInternal(this); + let result = []; + for (const { listeners } of subs.values()) { + result = result.concat(listeners.map(({ listener }) => listener)); + } + return result; + } + /** + * Remove the %%listener%% from the listeners for %%event%% or remove + * all listeners if unspecified. + */ + async off(event, listener) { + const sub = await hasSub(this, event); + if (!sub) { + return this; + } + if (listener) { + const index = sub.listeners.map(({ listener }) => listener).indexOf(listener); + if (index >= 0) { + sub.listeners.splice(index, 1); + } + } + if (listener == null || sub.listeners.length === 0) { + sub.stop(); + getInternal(this).subs.delete(sub.tag); + } + return this; + } + /** + * Remove all the listeners for %%event%% or remove all listeners if + * unspecified. + */ + async removeAllListeners(event) { + if (event) { + const sub = await hasSub(this, event); + if (!sub) { + return this; + } + sub.stop(); + getInternal(this).subs.delete(sub.tag); + } + else { + const { subs } = getInternal(this); + for (const { tag, stop } of subs.values()) { + stop(); + subs.delete(tag); + } + } + return this; + } + /** + * Alias for [on]. + */ + async addListener(event, listener) { + return await this.on(event, listener); + } + /** + * Alias for [off]. + */ + async removeListener(event, listener) { + return await this.off(event, listener); + } + /** + * Create a new Class for the %%abi%%. + */ + static buildClass(abi) { + class CustomContract extends BaseContract { + constructor(address, runner = null) { + super(address, abi, runner); + } + } + return CustomContract; + } + ; + /** + * Create a new BaseContract with a specified Interface. + */ + static from(target, abi, runner) { + if (runner == null) { + runner = null; + } + const contract = new this(target, abi, runner); + return contract; + } +} +function _ContractBase() { + return BaseContract; +} +/** + * A [[BaseContract]] with no type guards on its methods or events. + */ +class contract_Contract extends _ContractBase() { +} +//# sourceMappingURL=contract.js.map +;// ./node_modules/ethers/lib.esm/utils/rlp-encode.js +//See: https://github.com/ethereum/wiki/wiki/RLP + +function arrayifyInteger(value) { + const result = []; + while (value) { + result.unshift(value & 0xff); + value >>= 8; + } + return result; +} +function _encode(object) { + if (Array.isArray(object)) { + let payload = []; + object.forEach(function (child) { + payload = payload.concat(_encode(child)); + }); + if (payload.length <= 55) { + payload.unshift(0xc0 + payload.length); + return payload; + } + const length = arrayifyInteger(payload.length); + length.unshift(0xf7 + length.length); + return length.concat(payload); + } + const data = Array.prototype.slice.call(data_getBytes(object, "object")); + if (data.length === 1 && data[0] <= 0x7f) { + return data; + } + else if (data.length <= 55) { + data.unshift(0x80 + data.length); + return data; + } + const length = arrayifyInteger(data.length); + length.unshift(0xb7 + length.length); + return length.concat(data); +} +const nibbles = "0123456789abcdef"; +/** + * Encodes %%object%% as an RLP-encoded [[DataHexString]]. + */ +function encodeRlp(object) { + let result = "0x"; + for (const v of _encode(object)) { + result += nibbles[v >> 4]; + result += nibbles[v & 0xf]; + } + return result; +} +//# sourceMappingURL=rlp-encode.js.map +;// ./node_modules/ethers/lib.esm/address/contract-address.js + + + +// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed +/** + * Returns the address that would result from a ``CREATE`` for %%tx%%. + * + * This can be used to compute the address a contract will be + * deployed to by an EOA when sending a deployment transaction (i.e. + * when the ``to`` address is ``null``). + * + * This can also be used to compute the address a contract will be + * deployed to by a contract, by using the contract's address as the + * ``to`` and the contract's nonce. + * + * @example + * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; + * nonce = 5; + * + * getCreateAddress({ from, nonce }); + * //_result: + */ +function getCreateAddress(tx) { + const from = address_getAddress(tx.from); + const nonce = getBigInt(tx.nonce, "tx.nonce"); + let nonceHex = nonce.toString(16); + if (nonceHex === "0") { + nonceHex = "0x"; + } + else if (nonceHex.length % 2) { + nonceHex = "0x0" + nonceHex; + } + else { + nonceHex = "0x" + nonceHex; + } + return address_getAddress(data_dataSlice(keccak_keccak256(encodeRlp([from, nonceHex])), 12)); +} +/** + * Returns the address that would result from a ``CREATE2`` operation + * with the given %%from%%, %%salt%% and %%initCodeHash%%. + * + * To compute the %%initCodeHash%% from a contract's init code, use + * the [[keccak256]] function. + * + * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]]. + * + * @example + * // The address of the contract + * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72" + * + * // The salt + * salt = id("HelloWorld") + * + * // The hash of the initCode + * initCode = "0x6394198df16000526103ff60206004601c335afa6040516060f3"; + * initCodeHash = keccak256(initCode) + * + * getCreate2Address(from, salt, initCodeHash) + * //_result: + */ +function getCreate2Address(_from, _salt, _initCodeHash) { + const from = getAddress(_from); + const salt = getBytes(_salt, "salt"); + const initCodeHash = getBytes(_initCodeHash, "initCodeHash"); + assertArgument(salt.length === 32, "salt must be 32 bytes", "salt", _salt); + assertArgument(initCodeHash.length === 32, "initCodeHash must be 32 bytes", "initCodeHash", _initCodeHash); + return getAddress(dataSlice(keccak256(concat(["0xff", from, salt, initCodeHash])), 12)); +} +//# sourceMappingURL=contract-address.js.map +;// ./node_modules/ethers/lib.esm/contract/factory.js + + + + +// A = Arguments to the constructor +// I = Interface of deployed contracts +/** + * A **ContractFactory** is used to deploy a Contract to the blockchain. + */ +class ContractFactory { + /** + * The Contract Interface. + */ + interface; + /** + * The Contract deployment bytecode. Often called the initcode. + */ + bytecode; + /** + * The ContractRunner to deploy the Contract as. + */ + runner; + /** + * Create a new **ContractFactory** with %%abi%% and %%bytecode%%, + * optionally connected to %%runner%%. + * + * The %%bytecode%% may be the ``bytecode`` property within the + * standard Solidity JSON output. + */ + constructor(abi, bytecode, runner) { + const iface = interface_Interface.from(abi); + // Dereference Solidity bytecode objects and allow a missing `0x`-prefix + if (bytecode instanceof Uint8Array) { + bytecode = data_hexlify(data_getBytes(bytecode)); + } + else { + if (typeof (bytecode) === "object") { + bytecode = bytecode.object; + } + if (!bytecode.startsWith("0x")) { + bytecode = "0x" + bytecode; + } + bytecode = data_hexlify(data_getBytes(bytecode)); + } + properties_defineProperties(this, { + bytecode, interface: iface, runner: (runner || null) + }); + } + attach(target) { + return new BaseContract(target, this.interface, this.runner); + } + /** + * Resolves to the transaction to deploy the contract, passing %%args%% + * into the constructor. + */ + async getDeployTransaction(...args) { + let overrides = {}; + const fragment = this.interface.deploy; + if (fragment.inputs.length + 1 === args.length) { + overrides = await copyOverrides(args.pop()); + } + if (fragment.inputs.length !== args.length) { + throw new Error("incorrect number of arguments to constructor"); + } + const resolvedArgs = await resolveArgs(this.runner, fragment.inputs, args); + const data = data_concat([this.bytecode, this.interface.encodeDeploy(resolvedArgs)]); + return Object.assign({}, overrides, { data }); + } + /** + * Resolves to the Contract deployed by passing %%args%% into the + * constructor. + * + * This will resolve to the Contract before it has been deployed to the + * network, so the [[BaseContract-waitForDeployment]] should be used before + * sending any transactions to it. + */ + async deploy(...args) { + const tx = await this.getDeployTransaction(...args); + errors_assert(this.runner && typeof (this.runner.sendTransaction) === "function", "factory runner does not support sending transactions", "UNSUPPORTED_OPERATION", { + operation: "sendTransaction" + }); + const sentTx = await this.runner.sendTransaction(tx); + const address = getCreateAddress(sentTx); + return new BaseContract(address, this.interface, this.runner, sentTx); + } + /** + * Return a new **ContractFactory** with the same ABI and bytecode, + * but connected to %%runner%%. + */ + connect(runner) { + return new ContractFactory(this.interface, this.bytecode, runner); + } + /** + * Create a new **ContractFactory** from the standard Solidity JSON output. + */ + static fromSolidity(output, runner) { + errors_assertArgument(output != null, "bad compiler output", "output", output); + if (typeof (output) === "string") { + output = JSON.parse(output); + } + const abi = output.abi; + let bytecode = ""; + if (output.bytecode) { + bytecode = output.bytecode; + } + else if (output.evm && output.evm.bytecode) { + bytecode = output.evm.bytecode; + } + return new this(abi, bytecode, runner); + } +} +//# sourceMappingURL=factory.js.map +;// ./node_modules/@tornado/contracts/dist/index.mjs + + +const _abi$1Y = [ + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "uint256", + name: "needed", + type: "uint256" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "ERC1155InsufficientBalance", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "approver", + type: "address" + } + ], + name: "ERC1155InvalidApprover", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "idsLength", + type: "uint256" + }, + { + internalType: "uint256", + name: "valuesLength", + type: "uint256" + } + ], + name: "ERC1155InvalidArrayLength", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + } + ], + name: "ERC1155InvalidOperator", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "receiver", + type: "address" + } + ], + name: "ERC1155InvalidReceiver", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "ERC1155InvalidSender", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "ERC1155MissingApprovalForAll", + type: "error" + } +]; +class IERC1155Errors__factory { + static abi = _abi$1Y; + static createInterface() { + return new interface_Interface(_abi$1Y); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1Y, runner); + } +} + +const _abi$1X = [ + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "allowance", + type: "uint256" + }, + { + internalType: "uint256", + name: "needed", + type: "uint256" + } + ], + name: "ERC20InsufficientAllowance", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "uint256", + name: "needed", + type: "uint256" + } + ], + name: "ERC20InsufficientBalance", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "approver", + type: "address" + } + ], + name: "ERC20InvalidApprover", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "receiver", + type: "address" + } + ], + name: "ERC20InvalidReceiver", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "ERC20InvalidSender", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "ERC20InvalidSpender", + type: "error" + } +]; +class IERC20Errors__factory { + static abi = _abi$1X; + static createInterface() { + return new interface_Interface(_abi$1X); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1X, runner); + } +} + +const _abi$1W = [ + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "ERC721IncorrectOwner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "ERC721InsufficientApproval", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "approver", + type: "address" + } + ], + name: "ERC721InvalidApprover", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + } + ], + name: "ERC721InvalidOperator", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "ERC721InvalidOwner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "receiver", + type: "address" + } + ], + name: "ERC721InvalidReceiver", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "ERC721InvalidSender", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "ERC721NonexistentToken", + type: "error" + } +]; +class IERC721Errors__factory { + static abi = _abi$1W; + static createInterface() { + return new interface_Interface(_abi$1W); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1W, runner); + } +} + +var index$X = /*#__PURE__*/Object.freeze({ + __proto__: null, + IERC1155Errors__factory: IERC1155Errors__factory, + IERC20Errors__factory: IERC20Errors__factory, + IERC721Errors__factory: IERC721Errors__factory +}); + +const _abi$1V = [ + { + anonymous: false, + inputs: [], + name: "EIP712DomainChanged", + type: "event" + }, + { + inputs: [], + name: "eip712Domain", + outputs: [ + { + internalType: "bytes1", + name: "fields", + type: "bytes1" + }, + { + internalType: "string", + name: "name", + type: "string" + }, + { + internalType: "string", + name: "version", + type: "string" + }, + { + internalType: "uint256", + name: "chainId", + type: "uint256" + }, + { + internalType: "address", + name: "verifyingContract", + type: "address" + }, + { + internalType: "bytes32", + name: "salt", + type: "bytes32" + }, + { + internalType: "uint256[]", + name: "extensions", + type: "uint256[]" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IERC5267__factory { + static abi = _abi$1V; + static createInterface() { + return new interface_Interface(_abi$1V); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1V, runner); + } +} + +var index$W = /*#__PURE__*/Object.freeze({ + __proto__: null, + IERC5267__factory: IERC5267__factory, + draftIerc6093Sol: index$X +}); + +const _abi$1U = [ + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "allowance", + type: "uint256" + }, + { + internalType: "uint256", + name: "needed", + type: "uint256" + } + ], + name: "ERC20InsufficientAllowance", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "uint256", + name: "needed", + type: "uint256" + } + ], + name: "ERC20InsufficientBalance", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "approver", + type: "address" + } + ], + name: "ERC20InvalidApprover", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "receiver", + type: "address" + } + ], + name: "ERC20InvalidReceiver", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "ERC20InvalidSender", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "ERC20InvalidSpender", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "burn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "burnFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +let ERC20Burnable__factory$1 = class ERC20Burnable__factory { + static abi = _abi$1U; + static createInterface() { + return new interface_Interface(_abi$1U); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1U, runner); + } +}; + +const _abi$1T = [ + { + inputs: [], + name: "ECDSAInvalidSignature", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "length", + type: "uint256" + } + ], + name: "ECDSAInvalidSignatureLength", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "ECDSAInvalidSignatureS", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "allowance", + type: "uint256" + }, + { + internalType: "uint256", + name: "needed", + type: "uint256" + } + ], + name: "ERC20InsufficientAllowance", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "uint256", + name: "needed", + type: "uint256" + } + ], + name: "ERC20InsufficientBalance", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "approver", + type: "address" + } + ], + name: "ERC20InvalidApprover", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "receiver", + type: "address" + } + ], + name: "ERC20InvalidReceiver", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "ERC20InvalidSender", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "ERC20InvalidSpender", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "deadline", + type: "uint256" + } + ], + name: "ERC2612ExpiredSignature", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "signer", + type: "address" + }, + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "ERC2612InvalidSigner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "currentNonce", + type: "uint256" + } + ], + name: "InvalidAccountNonce", + type: "error" + }, + { + inputs: [], + name: "InvalidShortString", + type: "error" + }, + { + inputs: [ + { + internalType: "string", + name: "str", + type: "string" + } + ], + name: "StringTooLong", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [], + name: "EIP712DomainChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [], + name: "DOMAIN_SEPARATOR", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "eip712Domain", + outputs: [ + { + internalType: "bytes1", + name: "fields", + type: "bytes1" + }, + { + internalType: "string", + name: "name", + type: "string" + }, + { + internalType: "string", + name: "version", + type: "string" + }, + { + internalType: "uint256", + name: "chainId", + type: "uint256" + }, + { + internalType: "address", + name: "verifyingContract", + type: "address" + }, + { + internalType: "bytes32", + name: "salt", + type: "bytes32" + }, + { + internalType: "uint256[]", + name: "extensions", + type: "uint256[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "nonces", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "permit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +let ERC20Permit__factory$1 = class ERC20Permit__factory { + static abi = _abi$1T; + static createInterface() { + return new interface_Interface(_abi$1T); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1T, runner); + } +}; + +const _abi$1S = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +class IERC20Metadata__factory { + static abi = _abi$1S; + static createInterface() { + return new interface_Interface(_abi$1S); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1S, runner); + } +} + +const _abi$1R = [ + { + inputs: [], + name: "DOMAIN_SEPARATOR", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "nonces", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "permit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class IERC20Permit__factory { + static abi = _abi$1R; + static createInterface() { + return new interface_Interface(_abi$1R); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1R, runner); + } +} + +var index$V = /*#__PURE__*/Object.freeze({ + __proto__: null, + ERC20Burnable__factory: ERC20Burnable__factory$1, + ERC20Permit__factory: ERC20Permit__factory$1, + IERC20Metadata__factory: IERC20Metadata__factory, + IERC20Permit__factory: IERC20Permit__factory +}); + +const _abi$1Q = [ + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "allowance", + type: "uint256" + }, + { + internalType: "uint256", + name: "needed", + type: "uint256" + } + ], + name: "ERC20InsufficientAllowance", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "uint256", + name: "needed", + type: "uint256" + } + ], + name: "ERC20InsufficientBalance", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "approver", + type: "address" + } + ], + name: "ERC20InvalidApprover", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "receiver", + type: "address" + } + ], + name: "ERC20InvalidReceiver", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "ERC20InvalidSender", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "ERC20InvalidSpender", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +let ERC20__factory$1 = class ERC20__factory { + static abi = _abi$1Q; + static createInterface() { + return new interface_Interface(_abi$1Q); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1Q, runner); + } +}; + +const _abi$1P = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +let IERC20__factory$2 = class IERC20__factory { + static abi = _abi$1P; + static createInterface() { + return new interface_Interface(_abi$1P); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1P, runner); + } +}; + +var index$U = /*#__PURE__*/Object.freeze({ + __proto__: null, + ERC20__factory: ERC20__factory$1, + IERC20__factory: IERC20__factory$2, + extensions: index$V +}); + +var index$T = /*#__PURE__*/Object.freeze({ + __proto__: null, + erc20: index$U +}); + +const _abi$1O = [ + { + inputs: [], + name: "ECDSAInvalidSignature", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "length", + type: "uint256" + } + ], + name: "ECDSAInvalidSignatureLength", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "ECDSAInvalidSignatureS", + type: "error" + } +]; +const _bytecode$11 = "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122045318690f3888125255e48382b32b90ae3da72675cabe3bcd6e9478e8383086264736f6c634300081c0033"; +const isSuperArgs$11 = (xs) => xs.length > 1; +class ECDSA__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$11(args)) { + super(...args); + } else { + super(_abi$1O, _bytecode$11, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$11; + static abi = _abi$1O; + static createInterface() { + return new interface_Interface(_abi$1O); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1O, runner); + } +} + +const _abi$1N = [ + { + inputs: [], + name: "InvalidShortString", + type: "error" + }, + { + inputs: [ + { + internalType: "string", + name: "str", + type: "string" + } + ], + name: "StringTooLong", + type: "error" + }, + { + anonymous: false, + inputs: [], + name: "EIP712DomainChanged", + type: "event" + }, + { + inputs: [], + name: "eip712Domain", + outputs: [ + { + internalType: "bytes1", + name: "fields", + type: "bytes1" + }, + { + internalType: "string", + name: "name", + type: "string" + }, + { + internalType: "string", + name: "version", + type: "string" + }, + { + internalType: "uint256", + name: "chainId", + type: "uint256" + }, + { + internalType: "address", + name: "verifyingContract", + type: "address" + }, + { + internalType: "bytes32", + name: "salt", + type: "bytes32" + }, + { + internalType: "uint256[]", + name: "extensions", + type: "uint256[]" + } + ], + stateMutability: "view", + type: "function" + } +]; +class EIP712__factory { + static abi = _abi$1N; + static createInterface() { + return new interface_Interface(_abi$1N); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1N, runner); + } +} + +var index$S = /*#__PURE__*/Object.freeze({ + __proto__: null, + ECDSA__factory: ECDSA__factory, + EIP712__factory: EIP712__factory +}); + +const _abi$1M = [ + { + inputs: [], + name: "MathOverflowedMulDiv", + type: "error" + } +]; +const _bytecode$10 = "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122054710e438b4d818c9886821c7249e64e03942ccb6f261579743c3dd2da7d85c964736f6c634300081c0033"; +const isSuperArgs$10 = (xs) => xs.length > 1; +class Math__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$10(args)) { + super(...args); + } else { + super(_abi$1M, _bytecode$10, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$10; + static abi = _abi$1M; + static createInterface() { + return new interface_Interface(_abi$1M); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1M, runner); + } +} + +var index$R = /*#__PURE__*/Object.freeze({ + __proto__: null, + Math__factory: Math__factory +}); + +const _abi$1L = [ + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "currentNonce", + type: "uint256" + } + ], + name: "InvalidAccountNonce", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "nonces", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + } +]; +class Nonces__factory { + static abi = _abi$1L; + static createInterface() { + return new interface_Interface(_abi$1L); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1L, runner); + } +} + +const _abi$1K = [ + { + inputs: [], + name: "InvalidShortString", + type: "error" + }, + { + inputs: [ + { + internalType: "string", + name: "str", + type: "string" + } + ], + name: "StringTooLong", + type: "error" + } +]; +const _bytecode$$ = "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212206a078d04f950e0ca410dd1769613f6ca85ff5970fa2ea088000c56fd336fbcaf64736f6c634300081c0033"; +const isSuperArgs$$ = (xs) => xs.length > 1; +class ShortStrings__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$$(args)) { + super(...args); + } else { + super(_abi$1K, _bytecode$$, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$$; + static abi = _abi$1K; + static createInterface() { + return new interface_Interface(_abi$1K); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1K, runner); + } +} + +const _abi$1J = [ + { + inputs: [ + { + internalType: "uint256", + name: "value", + type: "uint256" + }, + { + internalType: "uint256", + name: "length", + type: "uint256" + } + ], + name: "StringsInsufficientHexLength", + type: "error" + } +]; +const _bytecode$_ = "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220cdd8289a2d34ad06cf0635eabbcac19a2c578b590d1b046b83c091f968f77dd664736f6c634300081c0033"; +const isSuperArgs$_ = (xs) => xs.length > 1; +class Strings__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$_(args)) { + super(...args); + } else { + super(_abi$1J, _bytecode$_, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$_; + static abi = _abi$1J; + static createInterface() { + return new interface_Interface(_abi$1J); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1J, runner); + } +} + +var index$Q = /*#__PURE__*/Object.freeze({ + __proto__: null, + Nonces__factory: Nonces__factory, + ShortStrings__factory: ShortStrings__factory, + Strings__factory: Strings__factory, + cryptography: index$S, + math: index$R +}); + +var index$P = /*#__PURE__*/Object.freeze({ + __proto__: null, + interfaces: index$W, + token: index$T, + utils: index$Q +}); + +const _abi$1I = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class Ownable__factory { + static abi = _abi$1I; + static createInterface() { + return new interface_Interface(_abi$1I); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1I, runner); + } +} + +var index$O = /*#__PURE__*/Object.freeze({ + __proto__: null, + Ownable__factory: Ownable__factory +}); + +const _abi$1H = [ + { + stateMutability: "payable", + type: "fallback" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +class Proxy__factory { + static abi = _abi$1H; + static createInterface() { + return new interface_Interface(_abi$1H); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1H, runner); + } +} + +const _abi$1G = [ + { + inputs: [ + { + internalType: "address", + name: "_logic", + type: "address" + }, + { + internalType: "address", + name: "_admin", + type: "address" + }, + { + internalType: "bytes", + name: "_data", + type: "bytes" + } + ], + stateMutability: "payable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "previousAdmin", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "AdminChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "implementation", + type: "address" + } + ], + name: "Upgraded", + type: "event" + }, + { + stateMutability: "payable", + type: "fallback" + }, + { + inputs: [], + name: "admin", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "changeAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "implementation", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + } + ], + name: "upgradeTo", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "upgradeToAndCall", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$Z = "0x60806040526040516108dc3803806108dc8339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508290506100ee826101bf565b8051156101a6576000826001600160a01b0316826040518082805190602001908083835b602083106101315780518252601f199092019160209182019101610112565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610191576040519150601f19603f3d011682016040523d82523d6000602084013e610196565b606091505b50509050806101a457600080fd5b505b506101ae9050565b6101b782610231565b50505061025b565b6101d28161025560201b6103b41760201c565b61020d5760405162461bcd60e51b81526004018080602001828103825260368152602001806108a66036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3b151590565b61063c8061026a6000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b815260040180806020018281038252603a815260200180610555603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260428152602001806105c56042913960600191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603681526020018061058f6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a26469706673582212200bf5c74f32000c92994fb0de053047d19f9c526eb1b1953df8bcb7d7e0df8d2864736f6c634300060c00335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374"; +const isSuperArgs$Z = (xs) => xs.length > 1; +class TransparentUpgradeableProxy__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$Z(args)) { + super(...args); + } else { + super(_abi$1G, _bytecode$Z, args[0]); + } + } + getDeployTransaction(_logic, _admin, _data, overrides) { + return super.getDeployTransaction(_logic, _admin, _data, overrides || {}); + } + deploy(_logic, _admin, _data, overrides) { + return super.deploy(_logic, _admin, _data, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$Z; + static abi = _abi$1G; + static createInterface() { + return new interface_Interface(_abi$1G); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$1G, + runner + ); + } +} + +const _abi$1F = [ + { + inputs: [ + { + internalType: "address", + name: "_logic", + type: "address" + }, + { + internalType: "bytes", + name: "_data", + type: "bytes" + } + ], + stateMutability: "payable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "implementation", + type: "address" + } + ], + name: "Upgraded", + type: "event" + }, + { + stateMutability: "payable", + type: "fallback" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$Y = "0x60806040526040516103123803806103128339818101604052604081101561002657600080fd5b81516020830180516040519294929383019291908464010000000082111561004d57600080fd5b90830190602082018581111561006257600080fd5b825164010000000081118282018810171561007c57600080fd5b82525081516020918201929091019080838360005b838110156100a9578181015183820152602001610091565b50505050905090810190601f1680156100d65780820380516001836020036101000a031916815260200191505b50604052506100e3915050565b6100ec826101ab565b8051156101a4576000826001600160a01b0316826040518082805190602001908083835b6020831061012f5780518252601f199092019160209182019101610110565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d806000811461018f576040519150601f19603f3d011682016040523d82523d6000602084013e610194565b606091505b50509050806101a257600080fd5b505b5050610223565b6101be8161021d60201b6100271760201c565b6101f95760405162461bcd60e51b81526004018080602001828103825260368152602001806102dc6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b3b151590565b60ab806102316000396000f3fe608060405236601057600e6013565b005b600e5b60196025565b60256021602d565b6052565b565b3b151590565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156070573d6000f35b3d6000fdfea2646970667358221220621b7042bfb847b4073a3c58bdbea5295ce2e761b4e2307ca010caaac996d80c64736f6c634300060c00335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374"; +const isSuperArgs$Y = (xs) => xs.length > 1; +class UpgradeableProxy__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$Y(args)) { + super(...args); + } else { + super(_abi$1F, _bytecode$Y, args[0]); + } + } + getDeployTransaction(_logic, _data, overrides) { + return super.getDeployTransaction(_logic, _data, overrides || {}); + } + deploy(_logic, _data, overrides) { + return super.deploy(_logic, _data, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$Y; + static abi = _abi$1F; + static createInterface() { + return new interface_Interface(_abi$1F); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1F, runner); + } +} + +var index$N = /*#__PURE__*/Object.freeze({ + __proto__: null, + Proxy__factory: Proxy__factory, + TransparentUpgradeableProxy__factory: TransparentUpgradeableProxy__factory, + UpgradeableProxy__factory: UpgradeableProxy__factory +}); + +const _abi$1E = [ + { + inputs: [ + { + internalType: "string", + name: "name", + type: "string" + }, + { + internalType: "string", + name: "symbol", + type: "string" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "subtractedValue", + type: "uint256" + } + ], + name: "decreaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "addedValue", + type: "uint256" + } + ], + name: "increaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$X = "0x608060405234801561001057600080fd5b5060405162000c6238038062000c628339818101604052604081101561003557600080fd5b810190808051604051939291908464010000000082111561005557600080fd5b90830190602082018581111561006a57600080fd5b825164010000000081118282018810171561008457600080fd5b82525081516020918201929091019080838360005b838110156100b1578181015183820152602001610099565b50505050905090810190601f1680156100de5780820380516001836020036101000a031916815260200191505b506040526020018051604051939291908464010000000082111561010157600080fd5b90830190602082018581111561011657600080fd5b825164010000000081118282018810171561013057600080fd5b82525081516020918201929091019080838360005b8381101561015d578181015183820152602001610145565b50505050905090810190601f16801561018a5780820380516001836020036101000a031916815260200191505b50604052505082516101a4915060039060208501906101cd565b5080516101b89060049060208401906101cd565b50506005805460ff1916601217905550610260565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061020e57805160ff191683800117855561023b565b8280016001018555821561023b579182015b8281111561023b578251825591602001919060010190610220565b5061024792915061024b565b5090565b5b80821115610247576000815560010161024c565b6109f280620002706000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c8063395093511161007157806339509351146101d957806370a082311461020557806395d89b411461022b578063a457c2d714610233578063a9059cbb1461025f578063dd62ed3e1461028b576100a9565b806306fdde03146100ae578063095ea7b31461012b57806318160ddd1461016b57806323b872dd14610185578063313ce567146101bb575b600080fd5b6100b66102b9565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f05781810151838201526020016100d8565b50505050905090810190601f16801561011d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101576004803603604081101561014157600080fd5b506001600160a01b03813516906020013561034f565b604080519115158252519081900360200190f35b61017361036c565b60408051918252519081900360200190f35b6101576004803603606081101561019b57600080fd5b506001600160a01b03813581169160208101359091169060400135610372565b6101c36103f9565b6040805160ff9092168252519081900360200190f35b610157600480360360408110156101ef57600080fd5b506001600160a01b038135169060200135610402565b6101736004803603602081101561021b57600080fd5b50356001600160a01b0316610450565b6100b661046b565b6101576004803603604081101561024957600080fd5b506001600160a01b0381351690602001356104cc565b6101576004803603604081101561027557600080fd5b506001600160a01b038135169060200135610534565b610173600480360360408110156102a157600080fd5b506001600160a01b0381358116916020013516610548565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103455780601f1061031a57610100808354040283529160200191610345565b820191906000526020600020905b81548152906001019060200180831161032857829003601f168201915b5050505050905090565b600061036361035c610573565b8484610577565b50600192915050565b60025490565b600061037f848484610663565b6103ef8461038b610573565b6103ea85604051806060016040528060288152602001610927602891396001600160a01b038a166000908152600160205260408120906103c9610573565b6001600160a01b0316815260208101919091526040016000205491906107be565b610577565b5060019392505050565b60055460ff1690565b600061036361040f610573565b846103ea8560016000610420610573565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610855565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103455780601f1061031a57610100808354040283529160200191610345565b60006103636104d9610573565b846103ea856040518060600160405280602581526020016109986025913960016000610503610573565b6001600160a01b03908116825260208083019390935260409182016000908120918d168152925290205491906107be565b6000610363610541610573565b8484610663565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166105bc5760405162461bcd60e51b81526004018080602001828103825260248152602001806109746024913960400191505060405180910390fd5b6001600160a01b0382166106015760405162461bcd60e51b81526004018080602001828103825260228152602001806108df6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166106a85760405162461bcd60e51b815260040180806020018281038252602581526020018061094f6025913960400191505060405180910390fd5b6001600160a01b0382166106ed5760405162461bcd60e51b81526004018080602001828103825260238152602001806108bc6023913960400191505060405180910390fd5b6106f88383836108b6565b61073581604051806060016040528060268152602001610901602691396001600160a01b03861660009081526020819052604090205491906107be565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546107649082610855565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6000818484111561084d5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156108125781810151838201526020016107fa565b50505050905090810190601f16801561083f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000828201838110156108af576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220347718b9db0288208ab5957df73278c6f781963df0e13918151971217fc2827964736f6c634300060c0033"; +const isSuperArgs$X = (xs) => xs.length > 1; +class ERC20__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$X(args)) { + super(...args); + } else { + super(_abi$1E, _bytecode$X, args[0]); + } + } + getDeployTransaction(name, symbol, overrides) { + return super.getDeployTransaction(name, symbol, overrides || {}); + } + deploy(name, symbol, overrides) { + return super.deploy(name, symbol, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$X; + static abi = _abi$1E; + static createInterface() { + return new interface_Interface(_abi$1E); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1E, runner); + } +} + +const _abi$1D = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "burn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "burnFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "subtractedValue", + type: "uint256" + } + ], + name: "decreaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "addedValue", + type: "uint256" + } + ], + name: "increaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +class ERC20Burnable__factory { + static abi = _abi$1D; + static createInterface() { + return new interface_Interface(_abi$1D); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1D, runner); + } +} + +const _abi$1C = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +let IERC20__factory$1 = class IERC20__factory { + static abi = _abi$1C; + static createInterface() { + return new interface_Interface(_abi$1C); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1C, runner); + } +}; + +var index$M = /*#__PURE__*/Object.freeze({ + __proto__: null, + ERC20Burnable__factory: ERC20Burnable__factory, + ERC20__factory: ERC20__factory, + IERC20__factory: IERC20__factory$1 +}); + +var index$L = /*#__PURE__*/Object.freeze({ + __proto__: null, + erc20: index$M +}); + +const _abi$1B = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address" + } + ], + name: "Paused", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address" + } + ], + name: "Unpaused", + type: "event" + }, + { + inputs: [], + name: "paused", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + } +]; +class Pausable__factory { + static abi = _abi$1B; + static createInterface() { + return new interface_Interface(_abi$1B); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1B, runner); + } +} + +var index$K = /*#__PURE__*/Object.freeze({ + __proto__: null, + Pausable__factory: Pausable__factory +}); + +var index$J = /*#__PURE__*/Object.freeze({ + __proto__: null, + access: index$O, + proxy: index$N, + token: index$L, + utils: index$K +}); + +var index$I = /*#__PURE__*/Object.freeze({ + __proto__: null, + contracts: index$P, + contractsV3: index$J +}); + +const _abi$1A = [ + { + inputs: [ + { + internalType: "uint256", + name: "in_xL", + type: "uint256" + }, + { + internalType: "uint256", + name: "in_xR", + type: "uint256" + } + ], + name: "MiMCSponge", + outputs: [ + { + internalType: "uint256", + name: "xL", + type: "uint256" + }, + { + internalType: "uint256", + name: "xR", + type: "uint256" + } + ], + stateMutability: "pure", + type: "function" + } +]; +class IHasher__factory { + static abi = _abi$1A; + static createInterface() { + return new interface_Interface(_abi$1A); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1A, runner); + } +} + +const _abi$1z = [ + { + inputs: [ + { + internalType: "uint32", + name: "_levels", + type: "uint32" + }, + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "FIELD_SIZE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ROOT_HISTORY_SIZE", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ZERO_VALUE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "currentRootIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "filledSubtrees", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getLastRoot", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + }, + { + internalType: "bytes32", + name: "_left", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_right", + type: "bytes32" + } + ], + name: "hashLeftRight", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [], + name: "hasher", + outputs: [ + { + internalType: "contract IHasher", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + } + ], + name: "isKnownRoot", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "levels", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "nextIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "roots", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "zeros", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$W = "0x60c0604052600380546001600160401b031916905534801561002057600080fd5b50604051610a10380380610a1083398101604081905261003f91610385565b60008263ffffffff16116100a65760405162461bcd60e51b815260206004820152602360248201527f5f6c6576656c732073686f756c642062652067726561746572207468616e207a60448201526265726f60e81b60648201526084015b60405180910390fd5b60208263ffffffff16106100fc5760405162461bcd60e51b815260206004820152601e60248201527f5f6c6576656c732073686f756c64206265206c657373207468616e2033320000604482015260640161009d565b63ffffffff821660a0526001600160a01b0381166080527f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c60005b8363ffffffff168163ffffffff1610156101845763ffffffff8116600090815260016020908152604080832085905590829052902082905561017a8383806101b8565b9150600101610137565b506000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b55506103f89050565b60006000805160206109f083398151915283106102175760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c64604482015260640161009d565b6000805160206109f0833981519152821061027e5760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b606482015260840161009d565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156102cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f191906103d4565b90925090506000805160206109f083398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610356573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061037a91906103d4565b509695505050505050565b6000806040838503121561039857600080fd5b825163ffffffff811681146103ac57600080fd5b60208401519092506001600160a01b03811681146103c957600080fd5b809150509250929050565b600080604083850312156103e757600080fd5b505080516020909101519092909150565b60805160a0516105d361041d60003960006101010152600061020f01526105d36000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063c2b40ae41161008c578063ec73295911610066578063ec732959146101e3578063ed33639f1461020a578063f178e47c14610249578063fc7e9c6f1461026957600080fd5b8063c2b40ae41461019b578063cd87a3b4146101bb578063e8295588146101c357600080fd5b8063414a37ba146100d45780634ecf518b146100fc5780636d9833e3146101385780638ea3099e1461015b57806390eeb02b1461016e578063ba70f7571461017e575b600080fd5b6100e960008051602061057e83398151915281565b6040519081526020015b60405180910390f35b6101237f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff90911681526020016100f3565b61014b6101463660046104d1565b610281565b60405190151581526020016100f3565b6100e96101693660046104ea565b6102ff565b6003546101239063ffffffff1681565b60035463ffffffff166000908152600260205260409020546100e9565b6100e96101a93660046104d1565b60026020526000908152604090205481565b610123601e81565b6100e96101d13660046104d1565b60016020526000908152604090205481565b6100e97f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c81565b6102317f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100f3565b6100e96102573660046104d1565b60006020819052908152604090205481565b60035461012390640100000000900463ffffffff1681565b600081810361029257506000919050565b60035463ffffffff16805b63ffffffff811660009081526002602052604090205484036102c3575060019392505050565b8063ffffffff166000036102d55750601e5b806102df8161052b565b9150508163ffffffff168163ffffffff160361029d575060009392505050565b600060008051602061057e83398151915283106103635760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c6460448201526064015b60405180910390fd5b60008051602061057e83398151915282106103ca5760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b606482015260840161035a565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610419573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061043d9190610559565b909250905060008051602061057e83398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156104a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c69190610559565b509695505050505050565b6000602082840312156104e357600080fd5b5035919050565b6000806000606084860312156104ff57600080fd5b83356001600160a01b038116811461051657600080fd5b95602085013595506040909401359392505050565b600063ffffffff82168061054f57634e487b7160e01b600052601160045260246000fd5b6000190192915050565b6000806040838503121561056c57600080fd5b50508051602090910151909290915056fe30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001a2646970667358221220f11e23d9109ed5a17bac47fbd258c25bee376ed054e1d1f4c83e9dd46ebf2e1264736f6c634300081c003330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001"; +const isSuperArgs$W = (xs) => xs.length > 1; +class MerkleTreeWithHistory__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$W(args)) { + super(...args); + } else { + super(_abi$1z, _bytecode$W, args[0]); + } + } + getDeployTransaction(_levels, _hasher, overrides) { + return super.getDeployTransaction(_levels, _hasher, overrides || {}); + } + deploy(_levels, _hasher, overrides) { + return super.deploy(_levels, _hasher, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$W; + static abi = _abi$1z; + static createInterface() { + return new interface_Interface(_abi$1z); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$1z, + runner + ); + } +} + +var index$H = /*#__PURE__*/Object.freeze({ + __proto__: null, + IHasher__factory: IHasher__factory, + MerkleTreeWithHistory__factory: MerkleTreeWithHistory__factory +}); + +const _abi$1y = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [], + name: "_totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "who", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transfer", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class ERC20Basic__factory { + static abi = _abi$1y; + static createInterface() { + return new interface_Interface(_abi$1y); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1y, runner); + } +} + +const _abi$1x = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [], + name: "_totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "approve", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "who", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transfer", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class IUSDT__factory { + static abi = _abi$1x; + static createInterface() { + return new interface_Interface(_abi$1x); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1x, runner); + } +} + +var index$G = /*#__PURE__*/Object.freeze({ + __proto__: null, + ERC20Basic__factory: ERC20Basic__factory, + IUSDT__factory: IUSDT__factory +}); + +const _abi$1w = [ + { + stateMutability: "nonpayable", + type: "fallback" + } +]; +const _bytecode$V = "0x6080604052348015600f57600080fd5b50609c80601d6000396000f3fe6080604052348015600f57600080fd5b5060405162461bcd60e51b815260206004820152602160248201527f7468697320636f6e747261637420646f6573206e6f74206163636570742045546044820152600960fb1b606482015260840160405180910390fdfea2646970667358221220e3ea6c7cc6115518097ca37048fbc2dbf908554443ac49cb9f0f128dbca7c44e64736f6c634300081c0033"; +const isSuperArgs$V = (xs) => xs.length > 1; +class BadRecipient__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$V(args)) { + super(...args); + } else { + super(_abi$1w, _bytecode$V, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$V; + static abi = _abi$1w; + static createInterface() { + return new interface_Interface(_abi$1w); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1w, runner); + } +} + +const _abi$1v = [ + { + inputs: [], + name: "ECDSAInvalidSignature", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "length", + type: "uint256" + } + ], + name: "ECDSAInvalidSignatureLength", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "ECDSAInvalidSignatureS", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "allowance", + type: "uint256" + }, + { + internalType: "uint256", + name: "needed", + type: "uint256" + } + ], + name: "ERC20InsufficientAllowance", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "uint256", + name: "needed", + type: "uint256" + } + ], + name: "ERC20InsufficientBalance", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "approver", + type: "address" + } + ], + name: "ERC20InvalidApprover", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "receiver", + type: "address" + } + ], + name: "ERC20InvalidReceiver", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "ERC20InvalidSender", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "ERC20InvalidSpender", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "deadline", + type: "uint256" + } + ], + name: "ERC2612ExpiredSignature", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "signer", + type: "address" + }, + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "ERC2612InvalidSigner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "currentNonce", + type: "uint256" + } + ], + name: "InvalidAccountNonce", + type: "error" + }, + { + inputs: [], + name: "InvalidShortString", + type: "error" + }, + { + inputs: [ + { + internalType: "string", + name: "str", + type: "string" + } + ], + name: "StringTooLong", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [], + name: "EIP712DomainChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [], + name: "DOMAIN_SEPARATOR", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "burn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "burnFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "eip712Domain", + outputs: [ + { + internalType: "bytes1", + name: "fields", + type: "bytes1" + }, + { + internalType: "string", + name: "name", + type: "string" + }, + { + internalType: "string", + name: "version", + type: "string" + }, + { + internalType: "uint256", + name: "chainId", + type: "uint256" + }, + { + internalType: "address", + name: "verifyingContract", + type: "address" + }, + { + internalType: "bytes32", + name: "salt", + type: "bytes32" + }, + { + internalType: "uint256[]", + name: "extensions", + type: "uint256[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "mint", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "nonces", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "permit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$U = "0x61016060405234801561001157600080fd5b50604051806040016040528060078152602001664441494d6f636b60c81b81525080604051806040016040528060018152602001603160f81b815250604051806040016040528060078152602001664441494d6f636b60c81b815250604051806040016040528060048152602001634441494d60e01b8152508160039081610099919061027a565b5060046100a6828261027a565b506100b691508390506005610161565b610120526100c5816006610161565b61014052815160208084019190912060e052815190820120610100524660a05261015260e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60805250503060c052506103aa565b600060208351101561017d5761017683610194565b905061018e565b81610188848261027a565b5060ff90505b92915050565b600080829050601f815111156101c8578260405163305a27a960e01b81526004016101bf9190610338565b60405180910390fd5b80516101d382610386565b179392505050565b634e487b7160e01b600052604160045260246000fd5b600181811c9082168061020557607f821691505b60208210810361022557634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561027557806000526020600020601f840160051c810160208510156102525750805b601f840160051c820191505b81811015610272576000815560010161025e565b50505b505050565b81516001600160401b03811115610293576102936101db565b6102a7816102a184546101f1565b8461022b565b6020601f8211600181146102db57600083156102c35750848201515b600019600385901b1c1916600184901b178455610272565b600084815260208120601f198516915b8281101561030b57878501518255602094850194600190920191016102eb565b50848210156103295786840151600019600387901b60f8161c191681555b50505050600190811b01905550565b602081526000825180602084015260005b818110156103665760208186018101516040868401015201610349565b506000604082850101526040601f19601f83011684010191505092915050565b805160208083015191908110156102255760001960209190910360031b1b16919050565b60805160a05160c05160e05161010051610120516101405161101a6104046000396000610804015260006107d701526000610713015260006106eb01526000610646015260006106700152600061069a015261101a6000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c806370a082311161009757806395d89b411161006657806395d89b4114610214578063a9059cbb1461021c578063d505accf1461022f578063dd62ed3e1461024257600080fd5b806370a08231146101aa57806379cc6790146101d35780637ecebe00146101e657806384b0196e146101f957600080fd5b8063313ce567116100d3578063313ce5671461016b5780633644e5151461017a57806340c10f191461018257806342966c681461019757600080fd5b806306fdde0314610105578063095ea7b31461012357806318160ddd1461014657806323b872dd14610158575b600080fd5b61010d61027b565b60405161011a9190610d64565b60405180910390f35b610136610131366004610d9a565b61030d565b604051901515815260200161011a565b6002545b60405190815260200161011a565b610136610166366004610dc4565b610327565b6040516012815260200161011a565b61014a61034b565b610195610190366004610d9a565b61035a565b005b6101956101a5366004610e01565b610368565b61014a6101b8366004610e1a565b6001600160a01b031660009081526020819052604090205490565b6101956101e1366004610d9a565b610375565b61014a6101f4366004610e1a565b61038a565b6102016103a8565b60405161011a9796959493929190610e35565b61010d6103ee565b61013661022a366004610d9a565b6103fd565b61019561023d366004610ecd565b61040b565b61014a610250366004610f40565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60606003805461028a90610f73565b80601f01602080910402602001604051908101604052809291908181526020018280546102b690610f73565b80156103035780601f106102d857610100808354040283529160200191610303565b820191906000526020600020905b8154815290600101906020018083116102e657829003601f168201915b5050505050905090565b60003361031b81858561054a565b60019150505b92915050565b60003361033585828561055c565b6103408585856105da565b506001949350505050565b6000610355610639565b905090565b6103648282610764565b5050565b610372338261079a565b50565b61038082338361055c565b610364828261079a565b6001600160a01b038116600090815260076020526040812054610321565b6000606080600080600060606103bc6107d0565b6103c46107fd565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b60606004805461028a90610f73565b60003361031b8185856105da565b834211156104345760405163313c898160e11b8152600481018590526024015b60405180910390fd5b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886104818c6001600160a01b0316600090815260076020526040902080546001810190915590565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e00160405160208183030381529060405280519060200120905060006104dc8261082a565b905060006104ec82878787610857565b9050896001600160a01b0316816001600160a01b031614610533576040516325c0072360e11b81526001600160a01b0380831660048301528b16602482015260440161042b565b61053e8a8a8a61054a565b50505050505050505050565b6105578383836001610885565b505050565b6001600160a01b0383811660009081526001602090815260408083209386168352929052205460001981146105d457818110156105c557604051637dc7a0d960e11b81526001600160a01b0384166004820152602481018290526044810183905260640161042b565b6105d484848484036000610885565b50505050565b6001600160a01b03831661060457604051634b637e8f60e11b81526000600482015260240161042b565b6001600160a01b03821661062e5760405163ec442f0560e01b81526000600482015260240161042b565b61055783838361095a565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561069257507f000000000000000000000000000000000000000000000000000000000000000046145b156106bc57507f000000000000000000000000000000000000000000000000000000000000000090565b610355604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b6001600160a01b03821661078e5760405163ec442f0560e01b81526000600482015260240161042b565b6103646000838361095a565b6001600160a01b0382166107c457604051634b637e8f60e11b81526000600482015260240161042b565b6103648260008361095a565b60606103557f00000000000000000000000000000000000000000000000000000000000000006005610a84565b60606103557f00000000000000000000000000000000000000000000000000000000000000006006610a84565b6000610321610837610639565b8360405161190160f01b8152600281019290925260228201526042902090565b60008060008061086988888888610b2f565b9250925092506108798282610bfe565b50909695505050505050565b6001600160a01b0384166108af5760405163e602df0560e01b81526000600482015260240161042b565b6001600160a01b0383166108d957604051634a1406b160e11b81526000600482015260240161042b565b6001600160a01b03808516600090815260016020908152604080832093871683529290522082905580156105d457826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161094c91815260200190565b60405180910390a350505050565b6001600160a01b03831661098557806002600082825461097a9190610fad565b909155506109f79050565b6001600160a01b038316600090815260208190526040902054818110156109d85760405163391434e360e21b81526001600160a01b0385166004820152602481018290526044810183905260640161042b565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b038216610a1357600280548290039055610a32565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610a7791815260200190565b60405180910390a3505050565b606060ff8314610a9e57610a9783610cb7565b9050610321565b818054610aaa90610f73565b80601f0160208091040260200160405190810160405280929190818152602001828054610ad690610f73565b8015610b235780601f10610af857610100808354040283529160200191610b23565b820191906000526020600020905b815481529060010190602001808311610b0657829003601f168201915b50505050509050610321565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610b6a5750600091506003905082610bf4565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610bbe573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610bea57506000925060019150829050610bf4565b9250600091508190505b9450945094915050565b6000826003811115610c1257610c12610fce565b03610c1b575050565b6001826003811115610c2f57610c2f610fce565b03610c4d5760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115610c6157610c61610fce565b03610c825760405163fce698f760e01b81526004810182905260240161042b565b6003826003811115610c9657610c96610fce565b03610364576040516335e2f38360e21b81526004810182905260240161042b565b60606000610cc483610cf6565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b600060ff8216601f81111561032157604051632cd44ac360e21b815260040160405180910390fd5b6000815180845260005b81811015610d4457602081850181015186830182015201610d28565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000610d776020830184610d1e565b9392505050565b80356001600160a01b0381168114610d9557600080fd5b919050565b60008060408385031215610dad57600080fd5b610db683610d7e565b946020939093013593505050565b600080600060608486031215610dd957600080fd5b610de284610d7e565b9250610df060208501610d7e565b929592945050506040919091013590565b600060208284031215610e1357600080fd5b5035919050565b600060208284031215610e2c57600080fd5b610d7782610d7e565b60ff60f81b8816815260e060208201526000610e5460e0830189610d1e565b8281036040840152610e668189610d1e565b606084018890526001600160a01b038716608085015260a0840186905283810360c08501528451808252602080870193509091019060005b81811015610ebc578351835260209384019390920191600101610e9e565b50909b9a5050505050505050505050565b600080600080600080600060e0888a031215610ee857600080fd5b610ef188610d7e565b9650610eff60208901610d7e565b95506040880135945060608801359350608088013560ff81168114610f2357600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215610f5357600080fd5b610f5c83610d7e565b9150610f6a60208401610d7e565b90509250929050565b600181811c90821680610f8757607f821691505b602082108103610fa757634e487b7160e01b600052602260045260246000fd5b50919050565b8082018082111561032157634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fdfea2646970667358221220e576ea72175cad97303c16106a449691832d2c19ed98a87d7dad19549b0d754564736f6c634300081c0033"; +const isSuperArgs$U = (xs) => xs.length > 1; +class ERC20Mock__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$U(args)) { + super(...args); + } else { + super(_abi$1v, _bytecode$U, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$U; + static abi = _abi$1v; + static createInterface() { + return new interface_Interface(_abi$1v); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1v, runner); + } +} + +const _abi$1u = [ + { + inputs: [ + { + internalType: "bytes", + name: "_initCode", + type: "bytes" + }, + { + internalType: "bytes32", + name: "_salt", + type: "bytes32" + } + ], + name: "deploy", + outputs: [ + { + internalType: "address payable", + name: "createdContract", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +let IDeployer__factory$1 = class IDeployer__factory { + static abi = _abi$1u; + static createInterface() { + return new interface_Interface(_abi$1u); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1u, runner); + } +}; + +const _abi$1t = [ + { + inputs: [ + { + internalType: "uint32", + name: "_treeLevels", + type: "uint32" + }, + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "FIELD_SIZE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ROOT_HISTORY_SIZE", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ZERO_VALUE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "currentRootIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "filledSubtrees", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getLastRoot", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + }, + { + internalType: "bytes32", + name: "_left", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_right", + type: "bytes32" + } + ], + name: "hashLeftRight", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [], + name: "hasher", + outputs: [ + { + internalType: "contract IHasher", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_leaf", + type: "bytes32" + } + ], + name: "insert", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + } + ], + name: "isKnownRoot", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "levels", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "nextIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "roots", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "zeros", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$T = "0x60c0604052600380546001600160401b031916905534801561002057600080fd5b50604051610e43380380610e4383398101604081905261003f91610389565b818160008263ffffffff16116100a85760405162461bcd60e51b815260206004820152602360248201527f5f6c6576656c732073686f756c642062652067726561746572207468616e207a60448201526265726f60e81b60648201526084015b60405180910390fd5b60208263ffffffff16106100fe5760405162461bcd60e51b815260206004820152601e60248201527f5f6c6576656c732073686f756c64206265206c657373207468616e2033320000604482015260640161009f565b63ffffffff821660a0526001600160a01b0381166080527f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c60005b8363ffffffff168163ffffffff1610156101865763ffffffff8116600090815260016020908152604080832085905590829052902082905561017c8383806101bc565b9150600101610139565b506000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b55506103fc92505050565b6000600080516020610e23833981519152831061021b5760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c64604482015260640161009f565b600080516020610e2383398151915282106102825760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b606482015260840161009f565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156102d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f591906103d8565b9092509050600080516020610e2383398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa15801561035a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061037e91906103d8565b509695505050505050565b6000806040838503121561039c57600080fd5b825163ffffffff811681146103b057600080fd5b60208401519092506001600160a01b03811681146103cd57600080fd5b809150509250929050565b600080604083850312156103eb57600080fd5b505080516020909101519092909150565b60805160a0516109ed610436600039600081816101310152818161052701526105c901526000818161023f015261066101526109ed6000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063c2b40ae41161008c578063ec73295911610066578063ec73295914610213578063ed33639f1461023a578063f178e47c14610279578063fc7e9c6f1461029957600080fd5b8063c2b40ae4146101cb578063cd87a3b4146101eb578063e8295588146101f357600080fd5b80636d9833e3116100c85780636d9833e3146101685780638ea3099e1461018b57806390eeb02b1461019e578063ba70f757146101ae57600080fd5b80632d287e43146100ef578063414a37ba146101045780634ecf518b1461012c575b600080fd5b6101026100fd36600461072c565b6102b1565b005b61011960008051602061099883398151915281565b6040519081526020015b60405180910390f35b6101537f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff9091168152602001610123565b61017b61017636600461072c565b6102be565b6040519015158152602001610123565b610119610199366004610745565b61033c565b6003546101539063ffffffff1681565b60035463ffffffff16600090815260026020526040902054610119565b6101196101d936600461072c565b60026020526000908152604090205481565b610153601e81565b61011961020136600461072c565b60016020526000908152604090205481565b6101197f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c81565b6102617f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610123565b61011961028736600461072c565b60006020819052908152604090205481565b60035461015390640100000000900463ffffffff1681565b6102ba8161050e565b5050565b60008181036102cf57506000919050565b60035463ffffffff16805b63ffffffff81166000908152600260205260409020548403610300575060019392505050565b8063ffffffff166000036103125750601e5b8061031c8161079c565b9150508163ffffffff168163ffffffff16036102da575060009392505050565b600060008051602061099883398151915283106103a05760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c6460448201526064015b60405180910390fd5b60008051602061099883398151915282106104075760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b6064820152608401610397565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610456573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047a91906107bc565b909250905060008051602061099883398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156104df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050391906107bc565b509695505050505050565b600354600090640100000000900463ffffffff1661054d7f0000000000000000000000000000000000000000000000000000000000000000600261090c565b63ffffffff168163ffffffff16036105c05760405162461bcd60e51b815260206004820152603060248201527f4d65726b6c6520747265652069732066756c6c2e204e6f206d6f7265206c656160448201526f1d995cc818d85b88189948185919195960821b6064820152608401610397565b8083600080805b7f000000000000000000000000000000000000000000000000000000000000000063ffffffff168163ffffffff16101561069e5761060660028661092b565b63ffffffff166000036106405763ffffffff811660009081526001602090815260408083205491839052909120859055849350915061065c565b63ffffffff811660009081526020819052604090205492508391505b6106877f0000000000000000000000000000000000000000000000000000000000000000848461033c565b9350610694600286610953565b94506001016105c7565b50600354600090601e906106b99063ffffffff16600161097b565b6106c3919061092b565b6003805463ffffffff191663ffffffff8316908117909155600090815260026020526040902085905590506106f986600161097b565b6003805463ffffffff929092166401000000000267ffffffff000000001990921691909117905550939695505050505050565b60006020828403121561073e57600080fd5b5035919050565b60008060006060848603121561075a57600080fd5b83356001600160a01b038116811461077157600080fd5b95602085013595506040909401359392505050565b634e487b7160e01b600052601160045260246000fd5b600063ffffffff8216806107b2576107b2610786565b6000190192915050565b600080604083850312156107cf57600080fd5b505080516020909101519092909150565b634e487b7160e01b600052601260045260246000fd5b6001815b60018411156108315780850481111561081557610815610786565b600184161561082357908102905b60019390931c9280026107fa565b935093915050565b60008261084857506001610906565b8161085557506000610906565b816001811461086b5760028114610875576108a6565b6001915050610906565b60ff84111561088657610886610786565b6001841b915063ffffffff8211156108a0576108a0610786565b50610906565b5060208310610133831016604e8410600b84101617156108dd575081810a63ffffffff8111156108d8576108d8610786565b610906565b6108ec63ffffffff84846107f6565b8063ffffffff0482111561090257610902610786565b0290505b92915050565b600061092463ffffffff841663ffffffff8416610839565b9392505050565b600063ffffffff831680610941576109416107e0565b8063ffffffff84160691505092915050565b600063ffffffff831680610969576109696107e0565b8063ffffffff84160491505092915050565b63ffffffff81811683821601908111156109065761090661078656fe30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001a2646970667358221220d4af2da17834eee5c4dc18614acb3b0fdfdd29ac766eb65a8d0826d4773a4afb64736f6c634300081c003330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001"; +const isSuperArgs$T = (xs) => xs.length > 1; +class MerkleTreeWithHistoryMock__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$T(args)) { + super(...args); + } else { + super(_abi$1t, _bytecode$T, args[0]); + } + } + getDeployTransaction(_treeLevels, _hasher, overrides) { + return super.getDeployTransaction(_treeLevels, _hasher, overrides || {}); + } + deploy(_treeLevels, _hasher, overrides) { + return super.deploy(_treeLevels, _hasher, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$T; + static abi = _abi$1t; + static createInterface() { + return new interface_Interface(_abi$1t); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$1t, + runner + ); + } +} + +const _abi$1s = [ + { + inputs: [ + { + internalType: "uint256", + name: "_denomination", + type: "uint256" + }, + { + internalType: "address", + name: "_token", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "commitment", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "VerifiedCommitment", + type: "event" + }, + { + inputs: [], + name: "COMMITMENT_TYPE", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "COMMITMENT_TYPEHASH", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "WITNESS_TYPE_STRING", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "denomination", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "permit2", + outputs: [ + { + internalType: "contract ISignatureTransfer", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "bytes32[]", + name: "_commitments", + type: "bytes32[]" + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "bytes", + name: "_signature", + type: "bytes" + } + ], + name: "permit2Commitments", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "bytes", + name: "_signature", + type: "bytes" + } + ], + name: "permit2Test", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "token", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "verifiedCommitments", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "instance", + type: "address" + }, + { + internalType: "bytes32", + name: "commitmentsHash", + type: "bytes32" + } + ], + internalType: "struct Permit2Mock.PermitCommitments", + name: "permitData", + type: "tuple" + } + ], + name: "witness", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "pure", + type: "function" + } +]; +const _bytecode$S = "0x6080604052348015600f57600080fd5b50604051610bb1380380610bb1833981016040819052602c916055565b600091909155600180546001600160a01b0319166001600160a01b039092169190911790556090565b60008060408385031215606757600080fd5b825160208401519092506001600160a01b0381168114608557600080fd5b809150509250929050565b610b128061009f6000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c80638bca6d16116100665780638bca6d161461011e5780639e67ab1e14610127578063c58b4c4914610150578063f15ea35914610163578063fc0c546a1461017657600080fd5b806303ac0673146100a357806304f03273146100b857806312261ee7146100d3578063156e2152146101015780637e89f31f14610116575b600080fd5b6100b66100b13660046105ec565b610189565b005b6100c0610243565b6040519081526020015b60405180910390f35b6100e96e22d473030f116ddee9f6b43ac78ba381565b6040516001600160a01b0390911681526020016100ca565b610109610266565b6040516100ca91906106a4565b6101096102a1565b6100c060005481565b6100e96101353660046106be565b6002602052600090815260409020546001600160a01b031681565b6100c061015e36600461071e565b6102bd565b6100b6610171366004610776565b61032a565b6001546100e9906001600160a01b031681565b6040805160a0810182526001546001600160a01b0316606082019081526000546080830181905290825260208083018890528284018790528351808501855230815290810191909152915163187945bd60e11b81526e22d473030f116ddee9f6b43ac78ba3926330f28b7a9261020a929091908a90889088906004016108dc565b600060405180830381600087803b15801561022457600080fd5b505af1158015610238573d6000803e3d6000fd5b505050505050505050565b6040518060600160405280603b8152602001610aa2603b91398051906020012081565b6040518060600160405280603b8152602001610aa2603b913960405160200161028f9190610934565b60405160208183030381529060405281565b6040518060600160405280603b8152602001610aa2603b913981565b60006040518060600160405280603b8152602001610aa2603b9139805160209182012083518483015160405161030d94019283526001600160a01b03919091166020830152604082015260600190565b604051602081830303815290604052805190602001209050919050565b6000855160005461033b91906109b7565b905060008660405160200161035091906109e2565b60408051601f19818403018152828252805160209182012060a0840183526001546001600160a01b0316606085019081526080850187905284528382018a905283830189905282518084018452308082528184018890528451808601909552845291830181905293506e22d473030f116ddee9f6b43ac78ba39263137c29fe929091908c906103de906102bd565b6040518060600160405280603b8152602001610aa2603b91396040516020016104079190610934565b6040516020818303038152906040528a8a6040518863ffffffff1660e01b815260040161043a9796959493929190610a18565b600060405180830381600087803b15801561045457600080fd5b505af1158015610468573d6000803e3d6000fd5b505050506104768789610480565b5050505050505050565b60005b82518110156105825760008382815181106104a0576104a0610a8b565b602090810291909101810151600081815260029092526040909120549091506001600160a01b0316156105195760405162461bcd60e51b815260206004820181905260248201527f54686520636f6d6d69746d656e7420686173206265656e207665726966696564604482015260640160405180910390fd5b60008181526002602090815260409182902080546001600160a01b0319166001600160a01b038716908117909155915191825282917fa9b0993cd360203065cdbc30dd334b2a3eb63115cbb64d73246109d8af75a5f9910160405180910390a250600101610483565b505050565b80356001600160a01b038116811461059e57600080fd5b919050565b60008083601f8401126105b557600080fd5b50813567ffffffffffffffff8111156105cd57600080fd5b6020830191508360208285010111156105e557600080fd5b9250929050565b60008060008060006080868803121561060457600080fd5b61060d86610587565b94506020860135935060408601359250606086013567ffffffffffffffff81111561063757600080fd5b610643888289016105a3565b969995985093965092949392505050565b60005b8381101561066f578181015183820152602001610657565b50506000910152565b60008151808452610690816020860160208601610654565b601f01601f19169290920160200192915050565b6020815260006106b76020830184610678565b9392505050565b6000602082840312156106d057600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610716576107166106d7565b604052919050565b6000604082840312801561073157600080fd5b506040805190810167ffffffffffffffff81118282101715610755576107556106d7565b60405261076183610587565b81526020928301359281019290925250919050565b60008060008060008060a0878903121561078f57600080fd5b61079887610587565b9550602087013567ffffffffffffffff8111156107b457600080fd5b8701601f810189136107c557600080fd5b803567ffffffffffffffff8111156107df576107df6106d7565b8060051b6107ef602082016106ed565b9182526020818401810192908101908c84111561080b57600080fd5b6020850194505b8385101561083157843580835260209586019590935090910190610812565b9850505050604088013594505060608701359250608087013567ffffffffffffffff81111561085f57600080fd5b61086b89828a016105a3565b979a9699509497509295939492505050565b61089b82825180516001600160a01b03168252602090810151910152565b60208101516040830152604081015160608301525050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6108e6818761087d565b84516001600160a01b03166080820152602085015160a08201526001600160a01b03841660c082015261010060e0820181905260009061092990830184866108b3565b979650505050505050565b7f5065726d6974436f6d6d69746d656e7473207769746e6573732900000000000081526000825161096c81601a850160208701610654565b7f546f6b656e5065726d697373696f6e73286164647265737320746f6b656e2c75601a9390910192830152506d696e7432353620616d6f756e742960901b603a820152604801919050565b80820281158282048414176109dc57634e487b7160e01b600052601160045260246000fd5b92915050565b8151600090829060208501835b82811015610a0d5781518452602093840193909101906001016109ef565b509195945050505050565b610a22818961087d565b86516001600160a01b03166080820152602087015160a082015260018060a01b03861660c08201528460e08201526101406101008201526000610a69610140830186610678565b828103610120840152610a7d8185876108b3565b9a9950505050505050505050565b634e487b7160e01b600052603260045260246000fdfe5065726d6974436f6d6d69746d656e7473286164647265737320696e7374616e63652c6279746573333220636f6d6d69746d656e74734861736829a26469706673582212206a6ecdc893f53628220fd48e8b32741c8e8a1c0862bc81e1d55feb14bef95f1764736f6c634300081c0033"; +const isSuperArgs$S = (xs) => xs.length > 1; +class Permit2Mock__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$S(args)) { + super(...args); + } else { + super(_abi$1s, _bytecode$S, args[0]); + } + } + getDeployTransaction(_denomination, _token, overrides) { + return super.getDeployTransaction(_denomination, _token, overrides || {}); + } + deploy(_denomination, _token, overrides) { + return super.deploy(_denomination, _token, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$S; + static abi = _abi$1s; + static createInterface() { + return new interface_Interface(_abi$1s); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1s, runner); + } +} + +var index$F = /*#__PURE__*/Object.freeze({ + __proto__: null, + BadRecipient__factory: BadRecipient__factory, + ERC20Mock__factory: ERC20Mock__factory, + IDeployer__factory: IDeployer__factory$1, + MerkleTreeWithHistoryMock__factory: MerkleTreeWithHistoryMock__factory, + Permit2Mock__factory: Permit2Mock__factory, + iusdtSol: index$G +}); + +const _abi$1r = [ + { + inputs: [ + { + internalType: "bytes", + name: "_proof", + type: "bytes" + }, + { + internalType: "uint256[6]", + name: "_input", + type: "uint256[6]" + } + ], + name: "verifyProof", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +class IVerifier__factory { + static abi = _abi$1r; + static createInterface() { + return new interface_Interface(_abi$1r); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1r, runner); + } +} + +const _abi$1q = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "commitment", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint32", + name: "leafIndex", + type: "uint32" + }, + { + indexed: false, + internalType: "uint256", + name: "timestamp", + type: "uint256" + } + ], + name: "Deposit", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "bytes32", + name: "nullifierHash", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "relayer", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "fee", + type: "uint256" + } + ], + name: "Withdrawal", + type: "event" + }, + { + inputs: [], + name: "FIELD_SIZE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ROOT_HISTORY_SIZE", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ZERO_VALUE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "commitments", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "currentRootIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "denomination", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_commitment", + type: "bytes32" + } + ], + name: "deposit", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "filledSubtrees", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getLastRoot", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + }, + { + internalType: "bytes32", + name: "_left", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_right", + type: "bytes32" + } + ], + name: "hashLeftRight", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [], + name: "hasher", + outputs: [ + { + internalType: "contract IHasher", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + } + ], + name: "isKnownRoot", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + } + ], + name: "isSpent", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "_nullifierHashes", + type: "bytes32[]" + } + ], + name: "isSpentArray", + outputs: [ + { + internalType: "bool[]", + name: "spent", + type: "bool[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "levels", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "nextIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "nullifierHashes", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "roots", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "verifier", + outputs: [ + { + internalType: "contract IVerifier", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "_proof", + type: "bytes" + }, + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + }, + { + internalType: "address payable", + name: "_recipient", + type: "address" + }, + { + internalType: "address payable", + name: "_relayer", + type: "address" + }, + { + internalType: "uint256", + name: "_fee", + type: "uint256" + }, + { + internalType: "uint256", + name: "_refund", + type: "uint256" + } + ], + name: "withdraw", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "zeros", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + } +]; +class Tornado__factory { + static abi = _abi$1q; + static createInterface() { + return new interface_Interface(_abi$1q); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1q, runner); + } +} + +var index$E = /*#__PURE__*/Object.freeze({ + __proto__: null, + IVerifier__factory: IVerifier__factory, + Tornado__factory: Tornado__factory +}); + +const _abi$1p = [ + { + inputs: [], + name: "denomination", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "commitment", + type: "bytes32" + } + ], + name: "deposit", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "token", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "proof", + type: "bytes" + }, + { + internalType: "bytes32", + name: "root", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "nullifierHash", + type: "bytes32" + }, + { + internalType: "address payable", + name: "recipient", + type: "address" + }, + { + internalType: "address payable", + name: "relayer", + type: "address" + }, + { + internalType: "uint256", + name: "fee", + type: "uint256" + }, + { + internalType: "uint256", + name: "refund", + type: "uint256" + } + ], + name: "withdraw", + outputs: [], + stateMutability: "payable", + type: "function" + } +]; +let ITornadoInstance__factory$1 = class ITornadoInstance__factory { + static abi = _abi$1p; + static createInterface() { + return new interface_Interface(_abi$1p); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1p, runner); + } +}; + +const _abi$1o = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + }, + { + indexed: false, + internalType: "bytes", + name: "encryptedNote", + type: "bytes" + } + ], + name: "EncryptedNote", + type: "event" + }, + { + inputs: [ + { + internalType: "bytes[]", + name: "_encryptedNotes", + type: "bytes[]" + } + ], + name: "backupNotes", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "_tornado", + type: "address" + }, + { + internalType: "bytes32", + name: "_commitment", + type: "bytes32" + }, + { + internalType: "bytes", + name: "_encryptedNote", + type: "bytes" + } + ], + name: "deposit", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "_tornado", + type: "address" + }, + { + internalType: "bytes", + name: "_proof", + type: "bytes" + }, + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + }, + { + internalType: "address payable", + name: "_recipient", + type: "address" + }, + { + internalType: "address payable", + name: "_relayer", + type: "address" + }, + { + internalType: "uint256", + name: "_fee", + type: "uint256" + }, + { + internalType: "uint256", + name: "_refund", + type: "uint256" + } + ], + name: "withdraw", + outputs: [], + stateMutability: "payable", + type: "function" + } +]; +const _bytecode$R = "0x608060405234801561001057600080fd5b506104f6806100206000396000f3fe6080604052600436106100345760003560e01c806313d98d13146100395780636485ba2a1461004e578063b438689f1461006e575b600080fd5b61004c6100473660046102c7565b610081565b005b34801561005a57600080fd5b5061004c610069366004610258565b61012a565b61004c61007c366004610321565b610198565b60405163b214faa560e01b81526001600160a01b0385169063b214faa59034906100af9087906004016103ec565b6000604051808303818588803b1580156100c857600080fd5b505af11580156100dc573d6000803e3d6000fd5b5050505050336001600160a01b03167ffa28df43db3553771f7209dcef046f3bdfea15870ab625dcda30ac58b82b4008838360405161011c9291906103f5565b60405180910390a250505050565b60005b8181101561019357337ffa28df43db3553771f7209dcef046f3bdfea15870ab625dcda30ac58b82b400884848481811061016357fe5b90506020028101906101759190610463565b6040516101839291906103f5565b60405180910390a260010161012d565b505050565b6040516310d056db60e11b81526001600160a01b038a16906321a0adb69034906101d4908c908c908c908c908c908c908c908c90600401610411565b6000604051808303818588803b1580156101ed57600080fd5b505af1158015610201573d6000803e3d6000fd5b5050505050505050505050505050565b60008083601f840112610222578182fd5b50813567ffffffffffffffff811115610239578182fd5b60208301915083602082850101111561025157600080fd5b9250929050565b6000806020838503121561026a578182fd5b823567ffffffffffffffff80821115610281578384fd5b818501915085601f830112610294578384fd5b8135818111156102a2578485fd5b86602080830285010111156102b5578485fd5b60209290920196919550909350505050565b600080600080606085870312156102dc578182fd5b84356102e7816104a8565b935060208501359250604085013567ffffffffffffffff811115610309578283fd5b61031587828801610211565b95989497509550505050565b60008060008060008060008060006101008a8c03121561033f578485fd5b893561034a816104a8565b985060208a013567ffffffffffffffff811115610365578586fd5b6103718c828d01610211565b90995097505060408a0135955060608a0135945060808a0135610393816104a8565b935060a08a01356103a3816104a8565b8093505060c08a0135915060e08a013590509295985092959850929598565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b90815260200190565b6000602082526104096020830184866103c2565b949350505050565b600060e0825261042560e083018a8c6103c2565b60208301989098525060408101959095526001600160a01b03938416606086015291909216608084015260a083019190915260c09091015292915050565b6000808335601e19843603018112610479578283fd5b83018035915067ffffffffffffffff821115610493578283fd5b60200191503681900382131561025157600080fd5b6001600160a01b03811681146104bd57600080fd5b5056fea2646970667358221220a833625c5e7cc02dff95b380fd1e6d47b08cffea90c70cfe6739960deee47b8364736f6c634300060c0033"; +const isSuperArgs$R = (xs) => xs.length > 1; +class TornadoProxyLight__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$R(args)) { + super(...args); + } else { + super(_abi$1o, _bytecode$R, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$R; + static abi = _abi$1o; + static createInterface() { + return new interface_Interface(_abi$1o); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1o, runner); + } +} + +var index$D = /*#__PURE__*/Object.freeze({ + __proto__: null, + ITornadoInstance__factory: ITornadoInstance__factory$1, + TornadoProxyLight__factory: TornadoProxyLight__factory +}); + +const _abi$1n = [ + { + inputs: [], + name: "DOMAIN_SEPARATOR", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "nonces", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "permit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +class IERC20__factory { + static abi = _abi$1n; + static createInterface() { + return new interface_Interface(_abi$1n); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1n, runner); + } +} + +const _abi$1m = [ + { + inputs: [ + { + internalType: "uint256", + name: "maxAmount", + type: "uint256" + } + ], + name: "InvalidAmount", + type: "error" + }, + { + inputs: [], + name: "LengthMismatch", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "word", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "mask", + type: "uint256" + } + ], + name: "UnorderedNonceInvalidation", + type: "event" + }, + { + inputs: [], + name: "DOMAIN_SEPARATOR", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "wordPos", + type: "uint256" + }, + { + internalType: "uint256", + name: "mask", + type: "uint256" + } + ], + name: "invalidateUnorderedNonces", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + }, + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "nonceBitmap", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + components: [ + { + components: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.TokenPermissions", + name: "permitted", + type: "tuple" + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.PermitTransferFrom", + name: "permit", + type: "tuple" + }, + { + components: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "requestedAmount", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.SignatureTransferDetails", + name: "transferDetails", + type: "tuple" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "bytes", + name: "signature", + type: "bytes" + } + ], + name: "permitTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + components: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.TokenPermissions[]", + name: "permitted", + type: "tuple[]" + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.PermitBatchTransferFrom", + name: "permit", + type: "tuple" + }, + { + components: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "requestedAmount", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.SignatureTransferDetails[]", + name: "transferDetails", + type: "tuple[]" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "bytes", + name: "signature", + type: "bytes" + } + ], + name: "permitTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + components: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.TokenPermissions", + name: "permitted", + type: "tuple" + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.PermitTransferFrom", + name: "permit", + type: "tuple" + }, + { + components: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "requestedAmount", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.SignatureTransferDetails", + name: "transferDetails", + type: "tuple" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "bytes32", + name: "witness", + type: "bytes32" + }, + { + internalType: "string", + name: "witnessTypeString", + type: "string" + }, + { + internalType: "bytes", + name: "signature", + type: "bytes" + } + ], + name: "permitWitnessTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + components: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.TokenPermissions[]", + name: "permitted", + type: "tuple[]" + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.PermitBatchTransferFrom", + name: "permit", + type: "tuple" + }, + { + components: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "requestedAmount", + type: "uint256" + } + ], + internalType: "struct ISignatureTransfer.SignatureTransferDetails[]", + name: "transferDetails", + type: "tuple[]" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "bytes32", + name: "witness", + type: "bytes32" + }, + { + internalType: "string", + name: "witnessTypeString", + type: "string" + }, + { + internalType: "bytes", + name: "signature", + type: "bytes" + } + ], + name: "permitWitnessTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class ISignatureTransfer__factory { + static abi = _abi$1m; + static createInterface() { + return new interface_Interface(_abi$1m); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1m, runner); + } +} + +var index$C = /*#__PURE__*/Object.freeze({ + __proto__: null, + IERC20__factory: IERC20__factory, + ISignatureTransfer__factory: ISignatureTransfer__factory +}); + +const _abi$1l = [ + { + inputs: [ + { + internalType: "contract IVerifier", + name: "_verifier", + type: "address" + }, + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + }, + { + internalType: "uint256", + name: "_denomination", + type: "uint256" + }, + { + internalType: "uint32", + name: "_merkleTreeHeight", + type: "uint32" + }, + { + internalType: "contract IERC20", + name: "_token", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "commitment", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint32", + name: "leafIndex", + type: "uint32" + }, + { + indexed: false, + internalType: "uint256", + name: "timestamp", + type: "uint256" + } + ], + name: "Deposit", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "bytes32", + name: "nullifierHash", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "relayer", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "fee", + type: "uint256" + } + ], + name: "Withdrawal", + type: "event" + }, + { + inputs: [], + name: "FIELD_SIZE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ROOT_HISTORY_SIZE", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ZERO_VALUE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "commitments", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "currentRootIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "denomination", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_commitment", + type: "bytes32" + } + ], + name: "deposit", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "filledSubtrees", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getLastRoot", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + }, + { + internalType: "bytes32", + name: "_left", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_right", + type: "bytes32" + } + ], + name: "hashLeftRight", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [], + name: "hasher", + outputs: [ + { + internalType: "contract IHasher", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + } + ], + name: "isKnownRoot", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + } + ], + name: "isSpent", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "_nullifierHashes", + type: "bytes32[]" + } + ], + name: "isSpentArray", + outputs: [ + { + internalType: "bool[]", + name: "spent", + type: "bool[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "levels", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "nextIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "nullifierHashes", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "roots", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "token", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "verifier", + outputs: [ + { + internalType: "contract IVerifier", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "_proof", + type: "bytes" + }, + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + }, + { + internalType: "address payable", + name: "_recipient", + type: "address" + }, + { + internalType: "address payable", + name: "_relayer", + type: "address" + }, + { + internalType: "uint256", + name: "_fee", + type: "uint256" + }, + { + internalType: "uint256", + name: "_refund", + type: "uint256" + } + ], + name: "withdraw", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "zeros", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$Q = "0x610120604052600380546001600160401b031916905534801561002157600080fd5b50604051611dc5380380611dc583398101604081905261004091610420565b84848484808360008263ffffffff16116100ad5760405162461bcd60e51b815260206004820152602360248201527f5f6c6576656c732073686f756c642062652067726561746572207468616e207a60448201526265726f60e81b60648201526084015b60405180910390fd5b60208263ffffffff16106101035760405162461bcd60e51b815260206004820152601e60248201527f5f6c6576656c732073686f756c64206265206c657373207468616e203332000060448201526064016100a4565b63ffffffff821660a0526001600160a01b0381166080527f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c60005b8363ffffffff168163ffffffff16101561018b5763ffffffff8116600090815260016020908152604080832085905590829052902082905561018183838061023b565b915060010161013e565b506000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b5550506001600455816102195760405162461bcd60e51b815260206004820152602560248201527f64656e6f6d696e6174696f6e2073686f756c6420626520677265617465722074604482015264068616e20360dc1b60648201526084016100a4565b506001600160a01b0392831660c05260e052501661010052506104b892505050565b6000600080516020611da5833981519152831061029a5760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c6460448201526064016100a4565b600080516020611da583398151915282106103015760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b60648201526084016100a4565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610350573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103749190610494565b9092509050600080516020611da583398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156103d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103fd9190610494565b509695505050505050565b6001600160a01b038116811461041d57600080fd5b50565b600080600080600060a0868803121561043857600080fd5b855161044381610408565b602087015190955061045481610408565b60408701516060880151919550935063ffffffff8116811461047557600080fd5b608087015190925061048681610408565b809150509295509295909350565b600080604083850312156104a757600080fd5b505080516020909101519092909150565b60805160a05160c05160e05161010051611863610542600039600081816104ca01528181610cfa01528181610d34015261108e0152600081816102bb0152818161056f01528181610ccc01526110b20152600081816101a601526106d801526000818161022201528181610e150152610eb70152600081816104690152610f4f01526118636000f3fe6080604052600436106101355760003560e01c8063b214faa5116100ab578063e82955881161006f578063e8295588146103f6578063ec73295914610423578063ed33639f14610457578063f178e47c1461048b578063fc0c546a146104b8578063fc7e9c6f146104ec57600080fd5b8063b214faa514610347578063ba70f7571461035a578063c2b40ae414610384578063cd87a3b4146103b1578063e5285dcc146103c657600080fd5b80636d9833e3116100fd5780636d9833e314610259578063839df945146102795780638bca6d16146102a95780638ea3099e146102dd57806390eeb02b146102fd5780639fa12d0b1461031a57600080fd5b806317cc915c1461013a57806321a0adb61461017f5780632b7ac3f314610194578063414a37ba146101e05780634ecf518b14610210575b600080fd5b34801561014657600080fd5b5061016a61015536600461131d565b60056020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b61019261018d36600461135e565b610511565b005b3480156101a057600080fd5b506101c87f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610176565b3480156101ec57600080fd5b5061020260008051602061180e83398151915281565b604051908152602001610176565b34801561021c57600080fd5b506102447f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff9091168152602001610176565b34801561026557600080fd5b5061016a61027436600461131d565b61081c565b34801561028557600080fd5b5061016a61029436600461131d565b60066020526000908152604090205460ff1681565b3480156102b557600080fd5b506102027f000000000000000000000000000000000000000000000000000000000000000081565b3480156102e957600080fd5b506102026102f8366004611417565b61089a565b34801561030957600080fd5b506003546102449063ffffffff1681565b34801561032657600080fd5b5061033a61033536600461144c565b610a67565b60405161017691906114c3565b61019261035536600461131d565b610b23565b34801561036657600080fd5b5060035463ffffffff16600090815260026020526040902054610202565b34801561039057600080fd5b5061020261039f36600461131d565b60026020526000908152604090205481565b3480156103bd57600080fd5b50610244601e81565b3480156103d257600080fd5b5061016a6103e136600461131d565b60009081526005602052604090205460ff1690565b34801561040257600080fd5b5061020261041136600461131d565b60016020526000908152604090205481565b34801561042f57600080fd5b506102027f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c81565b34801561046357600080fd5b506101c87f000000000000000000000000000000000000000000000000000000000000000081565b34801561049757600080fd5b506102026104a636600461131d565b60006020819052908152604090205481565b3480156104c457600080fd5b506101c87f000000000000000000000000000000000000000000000000000000000000000081565b3480156104f857600080fd5b5060035461024490640100000000900463ffffffff1681565b6002600454036105685760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60026004557f00000000000000000000000000000000000000000000000000000000000000008211156105dd5760405162461bcd60e51b815260206004820152601a60248201527f4665652065786365656473207472616e736665722076616c7565000000000000604482015260640161055f565b60008581526005602052604090205460ff161561063c5760405162461bcd60e51b815260206004820152601f60248201527f546865206e6f746520686173206265656e20616c7265616479207370656e7400604482015260640161055f565b6106458661081c565b6106915760405162461bcd60e51b815260206004820152601c60248201527f43616e6e6f742066696e6420796f7572206d65726b6c6520726f6f7400000000604482015260640161055f565b6040805160c081018252878152602081018790526001600160a01b038681168284015285811660608301526080820185905260a08201849052915163695ef6f960e01b81527f00000000000000000000000000000000000000000000000000000000000000009092169163695ef6f991610711918c918c91600401611508565b6020604051808303816000875af1158015610730573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107549190611568565b6107995760405162461bcd60e51b815260206004820152601660248201527524b73b30b634b2103bb4ba34323930bb90383937b7b360511b604482015260640161055f565b6000858152600560205260409020805460ff191660011790556107be84848484610c5a565b604080516001600160a01b03868116825260208201889052918101849052908416907fe9e508bad6d4c3227e881ca19068f099da81b5164dd6d62b2eaf1e8bc6c349319060600160405180910390a250506001600455505050505050565b600081810361082d57506000919050565b60035463ffffffff16805b63ffffffff8116600090815260026020526040902054840361085e575060019392505050565b8063ffffffff166000036108705750601e5b8061087a816115a7565b9150508163ffffffff168163ffffffff1603610838575060009392505050565b600060008051602061180e83398151915283106108f95760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c64604482015260640161055f565b60008051602061180e83398151915282106109605760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b606482015260840161055f565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156109af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d391906115c7565b909250905060008051602061180e83398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610a38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5c91906115c7565b509695505050505050565b60608167ffffffffffffffff811115610a8257610a82611601565b604051908082528060200260200182016040528015610aab578160200160208202803683370190505b50905060005b82811015610b1c57610aea848483818110610ace57610ace611617565b9050602002013560009081526005602052604090205460ff1690565b15610b14576001828281518110610b0357610b03611617565b911515602092830291909101909101525b600101610ab1565b5092915050565b600260045403610b755760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161055f565b600260045560008181526006602052604090205460ff1615610be35760405162461bcd60e51b815260206004820152602160248201527f54686520636f6d6d69746d656e7420686173206265656e207375626d697474656044820152601960fa1b606482015260840161055f565b6000610bee82610dfc565b6000838152600660205260409020805460ff191660011790559050610c1161101a565b6040805163ffffffff8316815242602082015283917fa945e51eec50ab98c161376f0db4cf2aeba3ec92755fe2fcd388bdbbb80ff196910160405180910390a250506001600455565b803414610cc25760405162461bcd60e51b815260206004820152603060248201527f496e636f727265637420726566756e6420616d6f756e7420726563656976656460448201526f08189e481d1a194818dbdb9d1c9858dd60821b606482015260840161055f565b610d2184610cf0847f000000000000000000000000000000000000000000000000000000000000000061162d565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691906110d8565b8115610d5b57610d5b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001684846110d8565b8015610df6576000846001600160a01b03168260405160006040518083038185875af1925050503d8060008114610dae576040519150601f19603f3d011682016040523d82523d6000602084013e610db3565b606091505b5050905080610df4576040516001600160a01b0385169083156108fc029084906000818181858888f19350505050158015610df2573d6000803e3d6000fd5b505b505b50505050565b600354600090640100000000900463ffffffff16610e3b7f0000000000000000000000000000000000000000000000000000000000000000600261175a565b63ffffffff168163ffffffff1603610eae5760405162461bcd60e51b815260206004820152603060248201527f4d65726b6c6520747265652069732066756c6c2e204e6f206d6f7265206c656160448201526f1d995cc818d85b88189948185919195960821b606482015260840161055f565b8083600080805b7f000000000000000000000000000000000000000000000000000000000000000063ffffffff168163ffffffff161015610f8c57610ef4600286611772565b63ffffffff16600003610f2e5763ffffffff8116600090815260016020908152604080832054918390529091208590558493509150610f4a565b63ffffffff811660009081526020819052604090205492508391505b610f757f0000000000000000000000000000000000000000000000000000000000000000848461089a565b9350610f8260028661179a565b9450600101610eb5565b50600354600090601e90610fa79063ffffffff1660016117c2565b610fb19190611772565b6003805463ffffffff191663ffffffff831690811790915560009081526002602052604090208590559050610fe78660016117c2565b6003805463ffffffff929092166401000000000267ffffffff000000001990921691909117905550939695505050505050565b34156110815760405162461bcd60e51b815260206004820152603060248201527f4554482076616c756520697320737570706f73656420746f206265203020666f60448201526f7220455243323020696e7374616e636560801b606482015260840161055f565b6110d66001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633307f00000000000000000000000000000000000000000000000000000000000000006111f1565b565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b179052915160009283929087169161113491906117de565b6000604051808303816000865af19150503d8060008114611171576040519150601f19603f3d011682016040523d82523d6000602084013e611176565b606091505b50915091508161118857805181602001fd5b805115806111a55750808060200190518101906111a59190611568565b610df45760405162461bcd60e51b815260206004820152601e60248201527f5361666545524332303a20736166655472616e73666572206661696c65640000604482015260640161055f565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b179052915160009283929088169161125591906117de565b6000604051808303816000865af19150503d8060008114611292576040519150601f19603f3d011682016040523d82523d6000602084013e611297565b606091505b5091509150816112a957805181602001fd5b805115806112c65750808060200190518101906112c69190611568565b610df25760405162461bcd60e51b815260206004820152602260248201527f5361666545524332303a20736166655472616e7366657246726f6d206661696c604482015261195960f21b606482015260840161055f565b60006020828403121561132f57600080fd5b5035919050565b6001600160a01b038116811461134b57600080fd5b50565b803561135981611336565b919050565b60008060008060008060008060e0898b03121561137a57600080fd5b883567ffffffffffffffff81111561139157600080fd5b8901601f81018b136113a257600080fd5b803567ffffffffffffffff8111156113b957600080fd5b8b60208284010111156113cb57600080fd5b6020918201995097508901359550604089013594506113ec60608a0161134e565b93506113fa60808a0161134e565b979a969950949793969295929450505060a08201359160c0013590565b60008060006060848603121561142c57600080fd5b833561143781611336565b95602085013595506040909401359392505050565b6000806020838503121561145f57600080fd5b823567ffffffffffffffff81111561147657600080fd5b8301601f8101851361148757600080fd5b803567ffffffffffffffff81111561149e57600080fd5b8560208260051b84010111156114b357600080fd5b6020919091019590945092505050565b602080825282518282018190526000918401906040840190835b818110156114fd57835115158352602093840193909201916001016114dd565b509095945050505050565b60e081528260e08201528284610100830137600061010084830101526000610100601f19601f8601168301019050602082018360005b600681101561155d57815183526020928301929091019060010161153e565b505050949350505050565b60006020828403121561157a57600080fd5b8151801515811461158a57600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b600063ffffffff8216806115bd576115bd611591565b6000190192915050565b600080604083850312156115da57600080fd5b505080516020909101519092909150565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b8181038181111561164057611640611591565b92915050565b6001815b60018411156116815780850481111561166557611665611591565b600184161561167357908102905b60019390931c92800261164a565b935093915050565b60008261169857506001611640565b816116a557506000611640565b81600181146116bb57600281146116c5576116f6565b6001915050611640565b60ff8411156116d6576116d6611591565b6001841b915063ffffffff8211156116f0576116f0611591565b50611640565b5060208310610133831016604e8410600b841016171561172d575081810a63ffffffff81111561172857611728611591565b611640565b61173c63ffffffff8484611646565b8063ffffffff0482111561175257611752611591565b029392505050565b600061158a63ffffffff841663ffffffff8416611689565b600063ffffffff831680611788576117886115eb565b8063ffffffff84160691505092915050565b600063ffffffff8316806117b0576117b06115eb565b8063ffffffff84160491505092915050565b63ffffffff818116838216019081111561164057611640611591565b6000825160005b818110156117ff57602081860181015185830152016117e5565b50600092019182525091905056fe30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001a2646970667358221220b02ff0aa2482e2d5c96dc808653f03833fb36ec1e6b15aae7d79ca885ffda98164736f6c634300081c003330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001"; +const isSuperArgs$Q = (xs) => xs.length > 1; +class ERC20Tornado__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$Q(args)) { + super(...args); + } else { + super(_abi$1l, _bytecode$Q, args[0]); + } + } + getDeployTransaction(_verifier, _hasher, _denomination, _merkleTreeHeight, _token, overrides) { + return super.getDeployTransaction( + _verifier, + _hasher, + _denomination, + _merkleTreeHeight, + _token, + overrides || {} + ); + } + deploy(_verifier, _hasher, _denomination, _merkleTreeHeight, _token, overrides) { + return super.deploy( + _verifier, + _hasher, + _denomination, + _merkleTreeHeight, + _token, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$Q; + static abi = _abi$1l; + static createInterface() { + return new interface_Interface(_abi$1l); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1l, runner); + } +} + +const _abi$1k = [ + { + inputs: [ + { + internalType: "contract IVerifier", + name: "_verifier", + type: "address" + }, + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + }, + { + internalType: "uint256", + name: "_denomination", + type: "uint256" + }, + { + internalType: "uint32", + name: "_merkleTreeHeight", + type: "uint32" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "commitment", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint32", + name: "leafIndex", + type: "uint32" + }, + { + indexed: false, + internalType: "uint256", + name: "timestamp", + type: "uint256" + } + ], + name: "Deposit", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "bytes32", + name: "nullifierHash", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "relayer", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "fee", + type: "uint256" + } + ], + name: "Withdrawal", + type: "event" + }, + { + inputs: [], + name: "FIELD_SIZE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ROOT_HISTORY_SIZE", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ZERO_VALUE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "commitments", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "currentRootIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "denomination", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_commitment", + type: "bytes32" + } + ], + name: "deposit", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "filledSubtrees", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getLastRoot", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + }, + { + internalType: "bytes32", + name: "_left", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_right", + type: "bytes32" + } + ], + name: "hashLeftRight", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [], + name: "hasher", + outputs: [ + { + internalType: "contract IHasher", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + } + ], + name: "isKnownRoot", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + } + ], + name: "isSpent", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "_nullifierHashes", + type: "bytes32[]" + } + ], + name: "isSpentArray", + outputs: [ + { + internalType: "bool[]", + name: "spent", + type: "bool[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "levels", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "nextIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "nullifierHashes", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "roots", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "verifier", + outputs: [ + { + internalType: "contract IVerifier", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "_proof", + type: "bytes" + }, + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + }, + { + internalType: "address payable", + name: "_recipient", + type: "address" + }, + { + internalType: "address payable", + name: "_relayer", + type: "address" + }, + { + internalType: "uint256", + name: "_fee", + type: "uint256" + }, + { + internalType: "uint256", + name: "_refund", + type: "uint256" + } + ], + name: "withdraw", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "zeros", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$P = "0x610100604052600380546001600160401b031916905534801561002157600080fd5b50604051611b75380380611b758339810160408190526100409161041b565b83838383808360008263ffffffff16116100ad5760405162461bcd60e51b815260206004820152602360248201527f5f6c6576656c732073686f756c642062652067726561746572207468616e207a60448201526265726f60e81b60648201526084015b60405180910390fd5b60208263ffffffff16106101035760405162461bcd60e51b815260206004820152601e60248201527f5f6c6576656c732073686f756c64206265206c657373207468616e203332000060448201526064016100a4565b63ffffffff821660a0526001600160a01b0381166080527f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c60005b8363ffffffff168163ffffffff16101561018b5763ffffffff81166000908152600160209081526040808320859055908290529020829055610181838380610236565b915060010161013e565b506000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b5550506001600455816102195760405162461bcd60e51b815260206004820152602560248201527f64656e6f6d696e6174696f6e2073686f756c6420626520677265617465722074604482015264068616e20360dc1b60648201526084016100a4565b506001600160a01b0390921660c0525060e0525061049d92505050565b6000600080516020611b5583398151915283106102955760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c6460448201526064016100a4565b600080516020611b5583398151915282106102fc5760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b60648201526084016100a4565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa15801561034b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036f9190610479565b9092509050600080516020611b5583398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156103d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f89190610479565b509695505050505050565b6001600160a01b038116811461041857600080fd5b50565b6000806000806080858703121561043157600080fd5b845161043c81610403565b602086015190945061044d81610403565b60408601516060870151919450925063ffffffff8116811461046e57600080fd5b939692955090935050565b6000806040838503121561048c57600080fd5b505080516020909101519092909150565b60805160a05160c05160e05161164e610507600039600081816102b00152818161053001528181610d0401526110a201526000818161019b015261069901526000818161021701528181610e9b0152610f3d01526000818161045e0152610fd5015261164e6000f3fe60806040526004361061012a5760003560e01c80639fa12d0b116100ab578063e5285dcc1161006f578063e5285dcc146103bb578063e8295588146103eb578063ec73295914610418578063ed33639f1461044c578063f178e47c14610480578063fc7e9c6f146104ad57600080fd5b80639fa12d0b1461030f578063b214faa51461033c578063ba70f7571461034f578063c2b40ae414610379578063cd87a3b4146103a657600080fd5b80636d9833e3116100f25780636d9833e31461024e578063839df9451461026e5780638bca6d161461029e5780638ea3099e146102d257806390eeb02b146102f257600080fd5b806317cc915c1461012f57806321a0adb6146101745780632b7ac3f314610189578063414a37ba146101d55780634ecf518b14610205575b600080fd5b34801561013b57600080fd5b5061015f61014a366004611137565b60056020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b610187610182366004611178565b6104d2565b005b34801561019557600080fd5b506101bd7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161016b565b3480156101e157600080fd5b506101f76000805160206115f983398151915281565b60405190815260200161016b565b34801561021157600080fd5b506102397f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff909116815260200161016b565b34801561025a57600080fd5b5061015f610269366004611137565b6107dd565b34801561027a57600080fd5b5061015f610289366004611137565b60066020526000908152604090205460ff1681565b3480156102aa57600080fd5b506101f77f000000000000000000000000000000000000000000000000000000000000000081565b3480156102de57600080fd5b506101f76102ed366004611231565b61085b565b3480156102fe57600080fd5b506003546102399063ffffffff1681565b34801561031b57600080fd5b5061032f61032a366004611266565b610a28565b60405161016b91906112dd565b61018761034a366004611137565b610ae4565b34801561035b57600080fd5b5060035463ffffffff166000908152600260205260409020546101f7565b34801561038557600080fd5b506101f7610394366004611137565b60026020526000908152604090205481565b3480156103b257600080fd5b50610239601e81565b3480156103c757600080fd5b5061015f6103d6366004611137565b60009081526005602052604090205460ff1690565b3480156103f757600080fd5b506101f7610406366004611137565b60016020526000908152604090205481565b34801561042457600080fd5b506101f77f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c81565b34801561045857600080fd5b506101bd7f000000000000000000000000000000000000000000000000000000000000000081565b34801561048c57600080fd5b506101f761049b366004611137565b60006020819052908152604090205481565b3480156104b957600080fd5b5060035461023990640100000000900463ffffffff1681565b6002600454036105295760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60026004557f000000000000000000000000000000000000000000000000000000000000000082111561059e5760405162461bcd60e51b815260206004820152601a60248201527f4665652065786365656473207472616e736665722076616c75650000000000006044820152606401610520565b60008581526005602052604090205460ff16156105fd5760405162461bcd60e51b815260206004820152601f60248201527f546865206e6f746520686173206265656e20616c7265616479207370656e74006044820152606401610520565b610606866107dd565b6106525760405162461bcd60e51b815260206004820152601c60248201527f43616e6e6f742066696e6420796f7572206d65726b6c6520726f6f74000000006044820152606401610520565b6040805160c081018252878152602081018790526001600160a01b038681168284015285811660608301526080820185905260a08201849052915163695ef6f960e01b81527f00000000000000000000000000000000000000000000000000000000000000009092169163695ef6f9916106d2918c918c91600401611322565b6020604051808303816000875af11580156106f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107159190611382565b61075a5760405162461bcd60e51b815260206004820152601660248201527524b73b30b634b2103bb4ba34323930bb90383937b7b360511b6044820152606401610520565b6000858152600560205260409020805460ff1916600117905561077f84848484610c1b565b604080516001600160a01b03868116825260208201889052918101849052908416907fe9e508bad6d4c3227e881ca19068f099da81b5164dd6d62b2eaf1e8bc6c349319060600160405180910390a250506001600455505050505050565b60008181036107ee57506000919050565b60035463ffffffff16805b63ffffffff8116600090815260026020526040902054840361081f575060019392505050565b8063ffffffff166000036108315750601e5b8061083b816113c1565b9150508163ffffffff168163ffffffff16036107f9575060009392505050565b60006000805160206115f983398151915283106108ba5760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c646044820152606401610520565b6000805160206115f983398151915282106109215760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b6064820152608401610520565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610970573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099491906113e1565b90925090506000805160206115f983398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156109f9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a1d91906113e1565b509695505050505050565b60608167ffffffffffffffff811115610a4357610a4361141b565b604051908082528060200260200182016040528015610a6c578160200160208202803683370190505b50905060005b82811015610add57610aab848483818110610a8f57610a8f611431565b9050602002013560009081526005602052604090205460ff1690565b15610ad5576001828281518110610ac457610ac4611431565b911515602092830291909101909101525b600101610a72565b5092915050565b600260045403610b365760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610520565b600260045560008181526006602052604090205460ff1615610ba45760405162461bcd60e51b815260206004820152602160248201527f54686520636f6d6d69746d656e7420686173206265656e207375626d697474656044820152601960fa1b6064820152608401610520565b6000610baf82610e82565b6000838152600660205260409020805460ff191660011790559050610bd26110a0565b6040805163ffffffff8316815242602082015283917fa945e51eec50ab98c161376f0db4cf2aeba3ec92755fe2fcd388bdbbb80ff196910160405180910390a250506001600455565b3415610c875760405162461bcd60e51b815260206004820152603560248201527f4d6573736167652076616c756520697320737570706f73656420746f206265206044820152747a65726f20666f722045544820696e7374616e636560581b6064820152608401610520565b8015610cf25760405162461bcd60e51b815260206004820152603460248201527f526566756e642076616c756520697320737570706f73656420746f206265207a60448201527365726f20666f722045544820696e7374616e636560601b6064820152608401610520565b60006001600160a01b038516610d28847f0000000000000000000000000000000000000000000000000000000000000000611447565b604051600081818185875af1925050503d8060008114610d64576040519150601f19603f3d011682016040523d82523d6000602084013e610d69565b606091505b5050905080610dc85760405162461bcd60e51b815260206004820152602560248201527f7061796d656e7420746f205f726563697069656e7420646964206e6f7420676f604482015264207468727560d81b6064820152608401610520565b8215610e7b576040516001600160a01b038516908490600081818185875af1925050503d8060008114610e17576040519150601f19603f3d011682016040523d82523d6000602084013e610e1c565b606091505b50508091505080610e7b5760405162461bcd60e51b815260206004820152602360248201527f7061796d656e7420746f205f72656c6179657220646964206e6f7420676f207460448201526268727560e81b6064820152608401610520565b5050505050565b600354600090640100000000900463ffffffff16610ec17f00000000000000000000000000000000000000000000000000000000000000006002611574565b63ffffffff168163ffffffff1603610f345760405162461bcd60e51b815260206004820152603060248201527f4d65726b6c6520747265652069732066756c6c2e204e6f206d6f7265206c656160448201526f1d995cc818d85b88189948185919195960821b6064820152608401610520565b8083600080805b7f000000000000000000000000000000000000000000000000000000000000000063ffffffff168163ffffffff16101561101257610f7a60028661158c565b63ffffffff16600003610fb45763ffffffff8116600090815260016020908152604080832054918390529091208590558493509150610fd0565b63ffffffff811660009081526020819052604090205492508391505b610ffb7f0000000000000000000000000000000000000000000000000000000000000000848461085b565b93506110086002866115b4565b9450600101610f3b565b50600354600090601e9061102d9063ffffffff1660016115dc565b611037919061158c565b6003805463ffffffff191663ffffffff83169081179091556000908152600260205260409020859055905061106d8660016115dc565b6003805463ffffffff929092166401000000000267ffffffff000000001990921691909117905550939695505050505050565b7f000000000000000000000000000000000000000000000000000000000000000034146111355760405162461bcd60e51b815260206004820152603860248201527f506c656173652073656e6420606d697844656e6f6d696e6174696f6e6020455460448201527f4820616c6f6e672077697468207472616e73616374696f6e00000000000000006064820152608401610520565b565b60006020828403121561114957600080fd5b5035919050565b6001600160a01b038116811461116557600080fd5b50565b803561117381611150565b919050565b60008060008060008060008060e0898b03121561119457600080fd5b883567ffffffffffffffff8111156111ab57600080fd5b8901601f81018b136111bc57600080fd5b803567ffffffffffffffff8111156111d357600080fd5b8b60208284010111156111e557600080fd5b60209182019950975089013595506040890135945061120660608a01611168565b935061121460808a01611168565b979a969950949793969295929450505060a08201359160c0013590565b60008060006060848603121561124657600080fd5b833561125181611150565b95602085013595506040909401359392505050565b6000806020838503121561127957600080fd5b823567ffffffffffffffff81111561129057600080fd5b8301601f810185136112a157600080fd5b803567ffffffffffffffff8111156112b857600080fd5b8560208260051b84010111156112cd57600080fd5b6020919091019590945092505050565b602080825282518282018190526000918401906040840190835b8181101561131757835115158352602093840193909201916001016112f7565b509095945050505050565b60e081528260e08201528284610100830137600061010084830101526000610100601f19601f8601168301019050602082018360005b6006811015611377578151835260209283019290910190600101611358565b505050949350505050565b60006020828403121561139457600080fd5b815180151581146113a457600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b600063ffffffff8216806113d7576113d76113ab565b6000190192915050565b600080604083850312156113f457600080fd5b505080516020909101519092909150565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b8181038181111561145a5761145a6113ab565b92915050565b6001815b600184111561149b5780850481111561147f5761147f6113ab565b600184161561148d57908102905b60019390931c928002611464565b935093915050565b6000826114b25750600161145a565b816114bf5750600061145a565b81600181146114d557600281146114df57611510565b600191505061145a565b60ff8411156114f0576114f06113ab565b6001841b915063ffffffff82111561150a5761150a6113ab565b5061145a565b5060208310610133831016604e8410600b8410161715611547575081810a63ffffffff811115611542576115426113ab565b61145a565b61155663ffffffff8484611460565b8063ffffffff0482111561156c5761156c6113ab565b029392505050565b60006113a463ffffffff841663ffffffff84166114a3565b600063ffffffff8316806115a2576115a2611405565b8063ffffffff84160691505092915050565b600063ffffffff8316806115ca576115ca611405565b8063ffffffff84160491505092915050565b63ffffffff818116838216019081111561145a5761145a6113ab56fe30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001a264697066735822122030cdb3d931ce1408ab144147edd7c76e28173ecad063b971dad09ea221811b3c64736f6c634300081c003330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001"; +const isSuperArgs$P = (xs) => xs.length > 1; +class ETHTornado__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$P(args)) { + super(...args); + } else { + super(_abi$1k, _bytecode$P, args[0]); + } + } + getDeployTransaction(_verifier, _hasher, _denomination, _merkleTreeHeight, overrides) { + return super.getDeployTransaction( + _verifier, + _hasher, + _denomination, + _merkleTreeHeight, + overrides || {} + ); + } + deploy(_verifier, _hasher, _denomination, _merkleTreeHeight, overrides) { + return super.deploy( + _verifier, + _hasher, + _denomination, + _merkleTreeHeight, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$P; + static abi = _abi$1k; + static createInterface() { + return new interface_Interface(_abi$1k); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1k, runner); + } +} + +const _abi$1j = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "who", + type: "address" + }, + { + indexed: false, + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "Echo", + type: "event" + }, + { + inputs: [ + { + internalType: "bytes", + name: "_data", + type: "bytes" + } + ], + name: "echo", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$O = "0x6080604052348015600f57600080fd5b506101658061001f6000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063624fbfdc14610030575b600080fd5b61004361003e36600461008c565b610045565b005b336001600160a01b03167f50d6f3fc915efd1695d8a4cb50da185984f50d256834b9cb308295eb3c872c9c8383604051610080929190610100565b60405180910390a25050565b6000806020838503121561009f57600080fd5b823567ffffffffffffffff8111156100b657600080fd5b8301601f810185136100c757600080fd5b803567ffffffffffffffff8111156100de57600080fd5b8560208284010111156100f057600080fd5b6020919091019590945092505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f1916010191905056fea264697066735822122050c4191eadbd3981b9be4954b8abbadae91d7cfb743a47cc6930c8fe566e1c6e64736f6c634300081c0033"; +const isSuperArgs$O = (xs) => xs.length > 1; +class Echoer__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$O(args)) { + super(...args); + } else { + super(_abi$1j, _bytecode$O, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$O; + static abi = _abi$1j; + static createInterface() { + return new interface_Interface(_abi$1j); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1j, runner); + } +} + +const _abi$1i = [ + { + inputs: [ + { + internalType: "contract IVerifier", + name: "_verifier", + type: "address" + }, + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + }, + { + internalType: "uint256", + name: "_denomination", + type: "uint256" + }, + { + internalType: "uint32", + name: "_merkleTreeHeight", + type: "uint32" + }, + { + internalType: "contract IERC20", + name: "_token", + type: "address" + }, + { + internalType: "address", + name: "_tornadoProxyLight", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "commitment", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint32", + name: "leafIndex", + type: "uint32" + }, + { + indexed: false, + internalType: "uint256", + name: "timestamp", + type: "uint256" + } + ], + name: "Deposit", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "commitment", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "VerifiedCommitment", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "bytes32", + name: "nullifierHash", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "relayer", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "fee", + type: "uint256" + } + ], + name: "Withdrawal", + type: "event" + }, + { + inputs: [], + name: "COMMITMENT_TYPE", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "COMMITMENT_TYPEHASH", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "FIELD_SIZE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ROOT_HISTORY_SIZE", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "WITNESS_TYPE_STRING", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ZERO_VALUE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "commitments", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "currentRootIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "denomination", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_commitment", + type: "bytes32" + } + ], + name: "deposit", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_commitment", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "depositCommitment", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "filledSubtrees", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getLastRoot", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + }, + { + internalType: "bytes32", + name: "_left", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_right", + type: "bytes32" + } + ], + name: "hashLeftRight", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [], + name: "hasher", + outputs: [ + { + internalType: "contract IHasher", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + } + ], + name: "isKnownRoot", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + } + ], + name: "isSpent", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "_nullifierHashes", + type: "bytes32[]" + } + ], + name: "isSpentArray", + outputs: [ + { + internalType: "bool[]", + name: "spent", + type: "bool[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "levels", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "nextIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "nullifierHashes", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "permit2", + outputs: [ + { + internalType: "contract ISignatureTransfer", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "bytes32[]", + name: "_commitments", + type: "bytes32[]" + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "bytes", + name: "_signature", + type: "bytes" + } + ], + name: "permit2Commitments", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "bytes32[]", + name: "_commitments", + type: "bytes32[]" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "permitCommitments", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "roots", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "token", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "tornadoProxyLight", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "verifiedCommitments", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "verifier", + outputs: [ + { + internalType: "contract IVerifier", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "_proof", + type: "bytes" + }, + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + }, + { + internalType: "address payable", + name: "_recipient", + type: "address" + }, + { + internalType: "address payable", + name: "_relayer", + type: "address" + }, + { + internalType: "uint256", + name: "_fee", + type: "uint256" + }, + { + internalType: "uint256", + name: "_refund", + type: "uint256" + } + ], + name: "withdraw", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "instance", + type: "address" + }, + { + internalType: "bytes32", + name: "commitmentsHash", + type: "bytes32" + } + ], + internalType: "struct PermitTornado.PermitCommitments", + name: "permitData", + type: "tuple" + } + ], + name: "witness", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "zeros", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$N = "0x610140604052600380546001600160401b031916905534801561002157600080fd5b50604051612b91380380612b9183398101604081905261004091610434565b858585858584848484808360008263ffffffff16116100b25760405162461bcd60e51b815260206004820152602360248201527f5f6c6576656c732073686f756c642062652067726561746572207468616e207a60448201526265726f60e81b60648201526084015b60405180910390fd5b60208263ffffffff16106101085760405162461bcd60e51b815260206004820152601e60248201527f5f6c6576656c732073686f756c64206265206c657373207468616e203332000060448201526064016100a9565b63ffffffff821660a0526001600160a01b0381166080527f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c60005b8363ffffffff168163ffffffff1610156101905763ffffffff8116600090815260016020908152604080832085905590829052902082905561018683838061024f565b9150600101610143565b506000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b55505060016004558161021e5760405162461bcd60e51b815260206004820152602560248201527f64656e6f6d696e6174696f6e2073686f756c6420626520677265617465722074604482015264068616e20360dc1b60648201526084016100a9565b506001600160a01b0392831660c05260e05250908116610100529490941661012052506104de975050505050505050565b6000600080516020612b7183398151915283106102ae5760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c6460448201526064016100a9565b600080516020612b7183398151915282106103155760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b60648201526084016100a9565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610364573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038891906104ba565b9092509050600080516020612b7183398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156103ed573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041191906104ba565b509695505050505050565b6001600160a01b038116811461043157600080fd5b50565b60008060008060008060c0878903121561044d57600080fd5b86516104588161041c565b60208801519096506104698161041c565b60408801516060890151919650945063ffffffff8116811461048a57600080fd5b608088015190935061049b8161041c565b60a08801519092506104ac8161041c565b809150509295509295509295565b600080604083850312156104cd57600080fd5b505080516020909101519092909150565b60805160a05160c05160e05161010051610120516125c66105ab600039600081816103b301526119460152600081816106d101528181610ba101528181610c0a015281816111eb015281816113be015281816113f8015281816119790152611b5801526000818161042c015281816107a801528181610b0501528181611192015281816113900152818161199d0152611b7c0152600081816102d4015261091101526000818161032a0152818161173701526117d9015260008181610650015261187101526125c66000f3fe6080604052600436106101e35760003560e01c80639e67ab1e11610102578063e5285dcc11610095578063f15ea35911610064578063f15ea35914610672578063f178e47c14610692578063fc0c546a146106bf578063fc7e9c6f146106f357600080fd5b8063e5285dcc146105ad578063e8295588146105dd578063ec7329591461060a578063ed33639f1461063e57600080fd5b8063ba70f757116100d1578063ba70f75714610521578063c2b40ae41461054b578063c58b4c4914610578578063cd87a3b41461059857600080fd5b80639e67ab1e1461048b5780639fa12d0b146104c1578063a9f6f2b7146104ee578063b214faa51461050e57600080fd5b80636d9833e31161017a578063839df94511610149578063839df945146103ea5780638bca6d161461041a5780638ea3099e1461044e57806390eeb02b1461046e57600080fd5b80636d9833e31461036157806372286fcb14610381578063761f894e146103a15780637e89f31f146103d557600080fd5b806321a0adb6116101b657806321a0adb6146102ad5780632b7ac3f3146102c2578063414a37ba146102f65780634ecf518b1461031857600080fd5b806304f03273146101e857806312261ee714610210578063156e21521461024b57806317cc915c1461026d575b600080fd5b3480156101f457600080fd5b506101fd610718565b6040519081526020015b60405180910390f35b34801561021c57600080fd5b506102336e22d473030f116ddee9f6b43ac78ba381565b6040516001600160a01b039091168152602001610207565b34801561025757600080fd5b5061026061073b565b6040516102079190611bf0565b34801561027957600080fd5b5061029d610288366004611c0a565b60056020526000908152604090205460ff1681565b6040519015158152602001610207565b6102c06102bb366004611c84565b610776565b005b3480156102ce57600080fd5b506102337f000000000000000000000000000000000000000000000000000000000000000081565b34801561030257600080fd5b506101fd60008051602061253683398151915281565b34801561032457600080fd5b5061034c7f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff9091168152602001610207565b34801561036d57600080fd5b5061029d61037c366004611c0a565b610a55565b34801561038d57600080fd5b506102c061039c366004611ddc565b610ad3565b3480156103ad57600080fd5b506102337f000000000000000000000000000000000000000000000000000000000000000081565b3480156103e157600080fd5b50610260610c4c565b3480156103f657600080fd5b5061029d610405366004611c0a565b60066020526000908152604090205460ff1681565b34801561042657600080fd5b506101fd7f000000000000000000000000000000000000000000000000000000000000000081565b34801561045a57600080fd5b506101fd610469366004611e56565b610c68565b34801561047a57600080fd5b5060035461034c9063ffffffff1681565b34801561049757600080fd5b506102336104a6366004611c0a565b6007602052600090815260409020546001600160a01b031681565b3480156104cd57600080fd5b506104e16104dc366004611e8b565b610e35565b6040516102079190611f02565b3480156104fa57600080fd5b506102c0610509366004611f47565b610ef1565b6102c061051c366004611c0a565b611026565b34801561052d57600080fd5b5060035463ffffffff166000908152600260205260409020546101fd565b34801561055757600080fd5b506101fd610566366004611c0a565b60026020526000908152604090205481565b34801561058457600080fd5b506101fd610593366004611f77565b6110f3565b3480156105a457600080fd5b5061034c601e81565b3480156105b957600080fd5b5061029d6105c8366004611c0a565b60009081526005602052604090205460ff1690565b3480156105e957600080fd5b506101fd6105f8366004611c0a565b60016020526000908152604090205481565b34801561061657600080fd5b506101fd7f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c81565b34801561064a57600080fd5b506102337f000000000000000000000000000000000000000000000000000000000000000081565b34801561067e57600080fd5b506102c061068d366004611fd1565b611160565b34801561069e57600080fd5b506101fd6106ad366004611c0a565b60006020819052908152604090205481565b3480156106cb57600080fd5b506102337f000000000000000000000000000000000000000000000000000000000000000081565b3480156106ff57600080fd5b5060035461034c90640100000000900463ffffffff1681565b6040518060600160405280603b8152602001612556603b91398051906020012081565b6040518060600160405280603b8152602001612556603b91396040516020016107649190612066565b60405160208183030381529060405281565b6002600454036107a15760405162461bcd60e51b8152600401610798906120e9565b60405180910390fd5b60026004557f00000000000000000000000000000000000000000000000000000000000000008211156108165760405162461bcd60e51b815260206004820152601a60248201527f4665652065786365656473207472616e736665722076616c75650000000000006044820152606401610798565b60008581526005602052604090205460ff16156108755760405162461bcd60e51b815260206004820152601f60248201527f546865206e6f746520686173206265656e20616c7265616479207370656e74006044820152606401610798565b61087e86610a55565b6108ca5760405162461bcd60e51b815260206004820152601c60248201527f43616e6e6f742066696e6420796f7572206d65726b6c6520726f6f74000000006044820152606401610798565b6040805160c081018252878152602081018790526001600160a01b038681168284015285811660608301526080820185905260a08201849052915163695ef6f960e01b81527f00000000000000000000000000000000000000000000000000000000000000009092169163695ef6f99161094a918c918c91600401612149565b6020604051808303816000875af1158015610969573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098d9190612191565b6109d25760405162461bcd60e51b815260206004820152601660248201527524b73b30b634b2103bb4ba34323930bb90383937b7b360511b6044820152606401610798565b6000858152600560205260409020805460ff191660011790556109f78484848461131e565b604080516001600160a01b03868116825260208201889052918101849052908416907fe9e508bad6d4c3227e881ca19068f099da81b5164dd6d62b2eaf1e8bc6c349319060600160405180910390a250506001600455505050505050565b6000818103610a6657506000919050565b60035463ffffffff16805b63ffffffff81166000908152600260205260409020548403610a97575060019392505050565b8063ffffffff16600003610aa95750601e5b80610ab3816121c9565b9150508163ffffffff168163ffffffff1603610a71575060009392505050565b600260045403610af55760405162461bcd60e51b8152600401610798906120e9565b60026004558351600090610b29907f00000000000000000000000000000000000000000000000000000000000000006121e9565b9050600085604051602001610b3e9190612206565b60408051808303601f1901815290829052805160209091012063d505accf60e01b82526001600160a01b038981166004840152306024840152604483018590526064830182905260ff8816608484015260a4830187905260c483018690529092507f0000000000000000000000000000000000000000000000000000000000000000169063d505accf9060e401600060405180830381600087803b158015610be557600080fd5b505af1158015610bf9573d6000803e3d6000fd5b50610c349250506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690508830856114c0565b610c3e86886115ec565b505060016004555050505050565b6040518060600160405280603b8152602001612556603b913981565b60006000805160206125368339815191528310610cc75760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c646044820152606401610798565b6000805160206125368339815191528210610d2e5760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b6064820152608401610798565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610d7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da1919061223c565b909250905060008051602061253683398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610e06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2a919061223c565b509695505050505050565b60608167ffffffffffffffff811115610e5057610e50611d12565b604051908082528060200260200182016040528015610e79578160200160208202803683370190505b50905060005b82811015610eea57610eb8848483818110610e9c57610e9c612276565b9050602002013560009081526005602052604090205460ff1690565b15610ee2576001828281518110610ed157610ed1612276565b911515602092830291909101909101525b600101610e7f565b5092915050565b600260045403610f135760405162461bcd60e51b8152600401610798906120e9565b60026004556000828152600760205260409020546001600160a01b03828116911614610f795760405162461bcd60e51b8152602060048201526015602482015274155b985c1c1c9bdd99590818dbdb5b5a5d1b595b9d605a1b6044820152606401610798565b60008281526006602052604090205460ff1615610fa85760405162461bcd60e51b81526004016107989061228c565b6000610fb38361171e565b60008481526006602052604090819020805460ff191660011790555190915083907fa945e51eec50ab98c161376f0db4cf2aeba3ec92755fe2fcd388bdbbb80ff19690611014908490429063ffffffff929092168252602082015260400190565b60405180910390a25050600160045550565b6002600454036110485760405162461bcd60e51b8152600401610798906120e9565b600260045560008181526006602052604090205460ff161561107c5760405162461bcd60e51b81526004016107989061228c565b60006110878261171e565b6000838152600660205260409020805460ff1916600117905590506110aa61193c565b6040805163ffffffff8316815242602082015283917fa945e51eec50ab98c161376f0db4cf2aeba3ec92755fe2fcd388bdbbb80ff196910160405180910390a250506001600455565b60006040518060600160405280603b8152602001612556603b9139805160209182012083518483015160405161114394019283526001600160a01b03919091166020830152604082015260600190565b604051602081830303815290604052805190602001209050919050565b6002600454036111825760405162461bcd60e51b8152600401610798906120e9565b600260045584516000906111b6907f00000000000000000000000000000000000000000000000000000000000000006121e9565b90506000866040516020016111cb9190612206565b60408051601f19818403018152828252805160209182012060a0840183527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316606085019081526080850187905284528382018a905283830189905282518084018452308082528184018890528451808601909552845291830181905293506e22d473030f116ddee9f6b43ac78ba39263137c29fe929091908c90611277906110f3565b6040518060600160405280603b8152602001612556603b91396040516020016112a09190612066565b6040516020818303038152906040528a8a6040518863ffffffff1660e01b81526004016112d397969594939291906122cd565b600060405180830381600087803b1580156112ed57600080fd5b505af1158015611301573d6000803e3d6000fd5b5050505061130f87896115ec565b50506001600455505050505050565b8034146113865760405162461bcd60e51b815260206004820152603060248201527f496e636f727265637420726566756e6420616d6f756e7420726563656976656460448201526f08189e481d1a194818dbdb9d1c9858dd60821b6064820152608401610798565b6113e5846113b4847f000000000000000000000000000000000000000000000000000000000000000061236e565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691906119cb565b811561141f5761141f6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001684846119cb565b80156114ba576000846001600160a01b03168260405160006040518083038185875af1925050503d8060008114611472576040519150601f19603f3d011682016040523d82523d6000602084013e611477565b606091505b50509050806114b8576040516001600160a01b0385169083156108fc029084906000818181858888f193505050501580156114b6573d6000803e3d6000fd5b505b505b50505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291516000928392908816916115249190612381565b6000604051808303816000865af19150503d8060008114611561576040519150601f19603f3d011682016040523d82523d6000602084013e611566565b606091505b50915091508161157857805181602001fd5b805115806115955750808060200190518101906115959190612191565b6114b65760405162461bcd60e51b815260206004820152602260248201527f5361666545524332303a20736166655472616e7366657246726f6d206661696c604482015261195960f21b6064820152608401610798565b60005b825181101561171957600083828151811061160c5761160c612276565b602090810291909101810151600081815260079092526040909120549091506001600160a01b0316156116815760405162461bcd60e51b815260206004820181905260248201527f54686520636f6d6d69746d656e7420686173206265656e2076657269666965646044820152606401610798565b60008181526006602052604090205460ff16156116b05760405162461bcd60e51b81526004016107989061228c565b60008181526007602090815260409182902080546001600160a01b0319166001600160a01b038716908117909155915191825282917fa9b0993cd360203065cdbc30dd334b2a3eb63115cbb64d73246109d8af75a5f9910160405180910390a2506001016115ef565b505050565b600354600090640100000000900463ffffffff1661175d7f000000000000000000000000000000000000000000000000000000000000000060026124b1565b63ffffffff168163ffffffff16036117d05760405162461bcd60e51b815260206004820152603060248201527f4d65726b6c6520747265652069732066756c6c2e204e6f206d6f7265206c656160448201526f1d995cc818d85b88189948185919195960821b6064820152608401610798565b8083600080805b7f000000000000000000000000000000000000000000000000000000000000000063ffffffff168163ffffffff1610156118ae576118166002866124c9565b63ffffffff166000036118505763ffffffff811660009081526001602090815260408083205491839052909120859055849350915061186c565b63ffffffff811660009081526020819052604090205492508391505b6118977f00000000000000000000000000000000000000000000000000000000000000008484610c68565b93506118a46002866124f1565b94506001016117d7565b50600354600090601e906118c99063ffffffff166001612519565b6118d391906124c9565b6003805463ffffffff191663ffffffff831690811790915560009081526002602052604090208590559050611909866001612519565b6003805463ffffffff929092166401000000000267ffffffff000000001990921691909117905550939695505050505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633036119c3576119c16001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001632307f00000000000000000000000000000000000000000000000000000000000000006114c0565b565b6119c1611ae4565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600092839290871691611a279190612381565b6000604051808303816000865af19150503d8060008114611a64576040519150601f19603f3d011682016040523d82523d6000602084013e611a69565b606091505b509150915081611a7b57805181602001fd5b80511580611a98575080806020019051810190611a989190612191565b6114b85760405162461bcd60e51b815260206004820152601e60248201527f5361666545524332303a20736166655472616e73666572206661696c656400006044820152606401610798565b3415611b4b5760405162461bcd60e51b815260206004820152603060248201527f4554482076616c756520697320737570706f73656420746f206265203020666f60448201526f7220455243323020696e7374616e636560801b6064820152608401610798565b6119c16001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633307f00000000000000000000000000000000000000000000000000000000000000006114c0565b60005b83811015611bbb578181015183820152602001611ba3565b50506000910152565b60008151808452611bdc816020860160208601611ba0565b601f01601f19169290920160200192915050565b602081526000611c036020830184611bc4565b9392505050565b600060208284031215611c1c57600080fd5b5035919050565b60008083601f840112611c3557600080fd5b50813567ffffffffffffffff811115611c4d57600080fd5b602083019150836020828501011115611c6557600080fd5b9250929050565b6001600160a01b0381168114611c8157600080fd5b50565b60008060008060008060008060e0898b031215611ca057600080fd5b883567ffffffffffffffff811115611cb757600080fd5b611cc38b828c01611c23565b90995097505060208901359550604089013594506060890135611ce581611c6c565b93506080890135611cf581611c6c565b979a969950949793969295929450505060a08201359160c0013590565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611d5157611d51611d12565b604052919050565b600082601f830112611d6a57600080fd5b813567ffffffffffffffff811115611d8457611d84611d12565b8060051b611d9460208201611d28565b91825260208185018101929081019086841115611db057600080fd5b6020860192505b83831015611dd2578235825260209283019290910190611db7565b9695505050505050565b600080600080600060a08688031215611df457600080fd5b8535611dff81611c6c565b9450602086013567ffffffffffffffff811115611e1b57600080fd5b611e2788828901611d59565b945050604086013560ff81168114611e3e57600080fd5b94979396509394606081013594506080013592915050565b600080600060608486031215611e6b57600080fd5b8335611e7681611c6c565b95602085013595506040909401359392505050565b60008060208385031215611e9e57600080fd5b823567ffffffffffffffff811115611eb557600080fd5b8301601f81018513611ec657600080fd5b803567ffffffffffffffff811115611edd57600080fd5b8560208260051b8401011115611ef257600080fd5b6020919091019590945092505050565b602080825282518282018190526000918401906040840190835b81811015611f3c5783511515835260209384019390920191600101611f1c565b509095945050505050565b60008060408385031215611f5a57600080fd5b823591506020830135611f6c81611c6c565b809150509250929050565b60006040828403128015611f8a57600080fd5b506040805190810167ffffffffffffffff81118282101715611fae57611fae611d12565b6040528235611fbc81611c6c565b81526020928301359281019290925250919050565b60008060008060008060a08789031215611fea57600080fd5b8635611ff581611c6c565b9550602087013567ffffffffffffffff81111561201157600080fd5b61201d89828a01611d59565b9550506040870135935060608701359250608087013567ffffffffffffffff81111561204857600080fd5b61205489828a01611c23565b979a9699509497509295939492505050565b7f5065726d6974436f6d6d69746d656e7473207769746e6573732900000000000081526000825161209e81601a850160208701611ba0565b7f546f6b656e5065726d697373696f6e73286164647265737320746f6b656e2c75601a9390910192830152506d696e7432353620616d6f756e742960901b603a820152604801919050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60e08152600061215d60e083018587612120565b9050602082018360005b6006811015612186578151835260209283019290910190600101612167565b505050949350505050565b6000602082840312156121a357600080fd5b81518015158114611c0357600080fd5b634e487b7160e01b600052601160045260246000fd5b600063ffffffff8216806121df576121df6121b3565b6000190192915050565b8082028115828204841417612200576122006121b3565b92915050565b8151600090829060208501835b82811015612231578151845260209384019390910190600101612213565b509195945050505050565b6000806040838503121561224f57600080fd5b505080516020909101519092909150565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60208082526021908201527f54686520636f6d6d69746d656e7420686173206265656e207375626d697474656040820152601960fa1b606082015260800190565b6122eb81895180516001600160a01b03168252602090810151910152565b602088015160408201526040880151606082015261231f608082018880516001600160a01b03168252602090810151910152565b60018060a01b03861660c08201528460e0820152610140610100820152600061234c610140830186611bc4565b828103610120840152612360818587612120565b9a9950505050505050505050565b81810381811115612200576122006121b3565b60008251612393818460208701611ba0565b9190910192915050565b6001815b60018411156123d8578085048111156123bc576123bc6121b3565b60018416156123ca57908102905b60019390931c9280026123a1565b935093915050565b6000826123ef57506001612200565b816123fc57506000612200565b8160018114612412576002811461241c5761244d565b6001915050612200565b60ff84111561242d5761242d6121b3565b6001841b915063ffffffff821115612447576124476121b3565b50612200565b5060208310610133831016604e8410600b8410161715612484575081810a63ffffffff81111561247f5761247f6121b3565b612200565b61249363ffffffff848461239d565b8063ffffffff048211156124a9576124a96121b3565b029392505050565b6000611c0363ffffffff841663ffffffff84166123e0565b600063ffffffff8316806124df576124df612260565b8063ffffffff84160691505092915050565b600063ffffffff83168061250757612507612260565b8063ffffffff84160491505092915050565b63ffffffff8181168382160190811115612200576122006121b356fe30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000015065726d6974436f6d6d69746d656e7473286164647265737320696e7374616e63652c6279746573333220636f6d6d69746d656e74734861736829a2646970667358221220154929f9a41ef21e6f1ac58d55712a26e4fe53fb384431d666fe2d06cdf5aaa864736f6c634300081c003330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001"; +const isSuperArgs$N = (xs) => xs.length > 1; +class PermitTornado__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$N(args)) { + super(...args); + } else { + super(_abi$1i, _bytecode$N, args[0]); + } + } + getDeployTransaction(_verifier, _hasher, _denomination, _merkleTreeHeight, _token, _tornadoProxyLight, overrides) { + return super.getDeployTransaction( + _verifier, + _hasher, + _denomination, + _merkleTreeHeight, + _token, + _tornadoProxyLight, + overrides || {} + ); + } + deploy(_verifier, _hasher, _denomination, _merkleTreeHeight, _token, _tornadoProxyLight, overrides) { + return super.deploy( + _verifier, + _hasher, + _denomination, + _merkleTreeHeight, + _token, + _tornadoProxyLight, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$N; + static abi = _abi$1i; + static createInterface() { + return new interface_Interface(_abi$1i); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1i, runner); + } +} + +const _abi$1h = [ + { + inputs: [ + { + internalType: "bytes", + name: "proof", + type: "bytes" + }, + { + internalType: "uint256[6]", + name: "input", + type: "uint256[6]" + } + ], + name: "verifyProof", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$M = "0x6080604052348015600f57600080fd5b5061109e8061001f6000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063695ef6f914610030575b600080fd5b61004361003e366004610eae565b610057565b604051901515815260200160405180910390f35b6000808380602001905181019061006e9190610f5a565b905060005b60088160ff161015610129577f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47828260ff16600881106100b5576100b5610fbe565b6020020151106101175760405162461bcd60e51b815260206004820152602260248201527f76657269666965722d70726f6f662d656c656d656e742d6774652d7072696d656044820152612d7160f01b60648201526084015b60405180910390fd5b8061012181610fea565b915050610073565b50610132610ca2565b6040805180820182528351815260208085015181830152908352815160808082018452858401518285019081526060808801519084015282528351808501855290860151815260a08601518184015281830152838201528151808301835260c0850151815260e0850151918101919091529082015260006101b1610321565b90506000604051806040016040528060008152602001600081525090506101f38183608001516000600781106101e9576101e9610fbe565b60200201516107ec565b905060005b60068110156102df577f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000187826006811061023457610234610fbe565b6020020151106102865760405162461bcd60e51b815260206004820152601f60248201527f76657269666965722d6774652d736e61726b2d7363616c61722d6669656c6400604482015260640161010e565b6102d5826102d0856080015184600161029f9190611009565b600781106102af576102af610fbe565b60200201518a85600681106102c6576102c6610fbe565b602002015161088d565b6107ec565b91506001016101f8565b506103146102f0846000015161091b565b846020015184600001518560200151858760400151896040015189606001516109d5565b9450505050505b92915050565b610329610cf3565b6040805180820182527f2dbfc3ec62a3eee5a3b4b464bcf1f8527bbca12adea0f1f12033cd4f61b0e09181527f19e55bd0b72c126da18665039556776642ff82e2f347f24fcea2475f4db087df6020808301919091529083528151608080820184527f1ae724ab134e5a7c6bd8a116fa5505b259522c0f164a5e8126e3ec7d34465f6e8285019081527e9f1bcdc853f8e3531756bb625b0d1dc014f4ab57c3f79f4f4e2e7ef7e0ead6606080850191909152908352845180860186527f23a8ca5760457e726365b92fd0ceb486665797cd68c35dcffd8e4ae8066691e981527f13ec7182c9fd68331a10f8be0fe885d730de5c7f89aa7d0b7bafaa009bbc9e3e818601528385015285840192909252835180820185527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c28186019081527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed828501528152845180860186527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b81527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa818601528185015285850152835180820185527f2f0c63d0c53b3dfbca27b6b43ae7fbf55a38d78a21470996485b03128accc2088186019081527e556502356e37ed150db2e36531b0f275fd6835c0fc1945922e270b48c48a86828501528152845180860186527f02644c27b5dbd793592a70b735e22c798a5e309fa17a992a7dc2a050e01b298f81527f194776b6a53439d7336f389d2a8f6651e40885f5ca2538b0dc9cb534fb23f7fa818601528185015282860152835180850185527f23df1bc9165e9c1c9b2bc036d8ebdd10e7aeae7e5e8019fde68aec7c818bb23e81527f0b6c92080d37c5fb2ddf30892a33665e5478432ef3f71ac8768ecbbe62c7789281850152818601805191909152845180860186527f1c7b2adf45e046caea000956b2ecb2d8617e710d2a7bb201a95ea276f92307b481527f2b15f07536f45948cf4abe6596637d902ffabb18c8c2f5c151544c294ce4a672818601528151850152845180860186527f1cecfe92882a8c835a47bf01bfa655cf628cbba7f81cf4042179fd13edcd6a3981527f0154bfbb2cb786ca247d4b69183d1751f267bbc7656be8d0f0e7a5a47e2c1101818601528151860152845180860186527f1584616a7423efcc72f69ea84fa0b2bc01433677297f4e8351bebfc15bcd0cda81527f0623755b1488526daa9fecf0e11b110dd6df12c461579d792e1db65af523c8be81860152815190930192909252835180850185527f12fbb5bfca9d61357ba2d641604cf4852e21ef54faa180fe539c18994dc1da5a81527f2f09dd9972a1af5f7bcfccf3d7ab600c9d898ea6d6933150ba0ae228ece17e5f81850152825190910152825180840184527f0adb513796fdf2103022c64151ce05f7c7a6d9200e8d819fa59e654fc4bfe83c81527f2d64f72ef4eddf9ca032058ed2bf691758387e913a77cf99d6a3cfb37c8ba7ee81840152815160a0015282518084019093527f21e7c9bffda74bfd2c4393b6803d775545de6fa89145f4a23476241d9881b66183527f0bbe41e52237ac13eb7b01f3cb999b7394d08734e71b1c3ada62713e17eb560c918301919091525160c0015290565b6040805180820190915260008082526020820152610808610d44565b8351815260208085015181830152835160408301528301516060808301919091526000908360c08460066107d05a03fa9050808061084257fe5b50806108855760405162461bcd60e51b81526020600482015260126024820152711c185a5c9a5b99cb5859190b59985a5b195960721b604482015260640161010e565b505092915050565b60408051808201909152600080825260208201526108a9610d62565b835181526020808501519082015260408101839052600060608360808460076107d05a03fa905080806108d857fe5b50806108855760405162461bcd60e51b81526020600482015260126024820152711c185a5c9a5b99cb5b5d5b0b59985a5b195960721b604482015260640161010e565b6040805180820190915260008082526020820152815115801561094057506020820151155b1561095e575050604080518082019091526000808252602082015290565b6040518060400160405280836000015181526020017f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4784602001516109a3919061101c565b6109cd907f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4761103e565b905292915050565b60408051608080820183528a825260208083018a90528284018890526060808401879052845192830185528b83528282018a9052828501889052820185905283516018808252610320820190955260009491859190839082016103008036833701905050905060005b6004811015610c1f576000610a54826006611051565b9050858260048110610a6857610a68610fbe565b60200201515183610a7a836000611009565b81518110610a8a57610a8a610fbe565b602002602001018181525050858260048110610aa857610aa8610fbe565b60200201516020015183826001610abf9190611009565b81518110610acf57610acf610fbe565b602002602001018181525050848260048110610aed57610aed610fbe565b6020020151515183610b00836002611009565b81518110610b1057610b10610fbe565b602002602001018181525050848260048110610b2e57610b2e610fbe565b6020020151516001602002015183610b47836003611009565b81518110610b5757610b57610fbe565b602002602001018181525050848260048110610b7557610b75610fbe565b602002015160200151600060028110610b9057610b90610fbe565b602002015183610ba1836004611009565b81518110610bb157610bb1610fbe565b602002602001018181525050848260048110610bcf57610bcf610fbe565b602002015160200151600160028110610bea57610bea610fbe565b602002015183610bfb836005611009565b81518110610c0b57610c0b610fbe565b602090810291909101015250600101610a3e565b50610c28610d80565b6000602082602086026020860160086107d05a03fa90508080610c4757fe5b5080610c8d5760405162461bcd60e51b81526020600482015260156024820152741c185a5c9a5b99cb5bdc18dbd9194b59985a5b1959605a1b604482015260640161010e565b505115159d9c50505050505050505050505050565b6040805160a081019091526000606082018181526080830191909152815260208101610ccc610d9e565b8152602001610cee604051806040016040528060008152602001600081525090565b905290565b6040805160e08101909152600060a0820181815260c0830191909152815260208101610d1d610d9e565b8152602001610d2a610d9e565b8152602001610d37610d9e565b8152602001610cee610dbe565b60405180608001604052806004906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b60405180602001604052806001906020820280368337509192915050565b6040518060400160405280610db1610df7565b8152602001610cee610df7565b6040518060e001604052806007905b6040805180820190915260008082526020820152815260200190600190039081610dcd5790505090565b60405180604001604052806002906020820280368337509192915050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610e5457610e54610e15565b604052919050565b600082601f830112610e6d57600080fd5b610e7760c0610e2b565b8060c0840185811115610e8957600080fd5b845b81811015610ea3578035845260209384019301610e8b565b509095945050505050565b60008060e08385031215610ec157600080fd5b823567ffffffffffffffff811115610ed857600080fd5b8301601f81018513610ee957600080fd5b803567ffffffffffffffff811115610f0357610f03610e15565b610f16601f8201601f1916602001610e2b565b818152866020838501011115610f2b57600080fd5b81602084016020830137600060208383010152809450505050610f518460208501610e5c565b90509250929050565b60006101008284031215610f6d57600080fd5b82601f830112610f7c57600080fd5b610100610f8881610e2b565b908301908085831115610f9a57600080fd5b845b83811015610fb4578051835260209283019201610f9c565b5095945050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060ff821660ff810361100057611000610fd4565b60010192915050565b8082018082111561031b5761031b610fd4565b60008261103957634e487b7160e01b600052601260045260246000fd5b500690565b8181038181111561031b5761031b610fd4565b808202811582820484141761031b5761031b610fd456fea2646970667358221220582b0c53304fb81b34031d12ae65a2c10ae44c3d4f7d6f3dffa078ee96b6cf3164736f6c634300081c0033"; +const isSuperArgs$M = (xs) => xs.length > 1; +class Verifier__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$M(args)) { + super(...args); + } else { + super(_abi$1h, _bytecode$M, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$M; + static abi = _abi$1h; + static createInterface() { + return new interface_Interface(_abi$1h); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1h, runner); + } +} + +const _abi$1g = [ + { + inputs: [ + { + internalType: "address", + name: "_governance", + type: "address" + }, + { + internalType: "contract IERC20", + name: "_comp", + type: "address" + }, + { + internalType: "contract IVerifier", + name: "_verifier", + type: "address" + }, + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + }, + { + internalType: "uint256", + name: "_denomination", + type: "uint256" + }, + { + internalType: "uint32", + name: "_merkleTreeHeight", + type: "uint32" + }, + { + internalType: "contract IERC20", + name: "_token", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "commitment", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint32", + name: "leafIndex", + type: "uint32" + }, + { + indexed: false, + internalType: "uint256", + name: "timestamp", + type: "uint256" + } + ], + name: "Deposit", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "bytes32", + name: "nullifierHash", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "relayer", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "fee", + type: "uint256" + } + ], + name: "Withdrawal", + type: "event" + }, + { + inputs: [], + name: "FIELD_SIZE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ROOT_HISTORY_SIZE", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ZERO_VALUE", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "claimComp", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "commitments", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "comp", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "currentRootIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "denomination", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_commitment", + type: "bytes32" + } + ], + name: "deposit", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "filledSubtrees", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getLastRoot", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "governance", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IHasher", + name: "_hasher", + type: "address" + }, + { + internalType: "bytes32", + name: "_left", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_right", + type: "bytes32" + } + ], + name: "hashLeftRight", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [], + name: "hasher", + outputs: [ + { + internalType: "contract IHasher", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + } + ], + name: "isKnownRoot", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + } + ], + name: "isSpent", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "_nullifierHashes", + type: "bytes32[]" + } + ], + name: "isSpentArray", + outputs: [ + { + internalType: "bool[]", + name: "spent", + type: "bool[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "levels", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "nextIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "nullifierHashes", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "roots", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "token", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "verifier", + outputs: [ + { + internalType: "contract IVerifier", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "_proof", + type: "bytes" + }, + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + }, + { + internalType: "address payable", + name: "_recipient", + type: "address" + }, + { + internalType: "address payable", + name: "_relayer", + type: "address" + }, + { + internalType: "uint256", + name: "_fee", + type: "uint256" + }, + { + internalType: "uint256", + name: "_refund", + type: "uint256" + } + ], + name: "withdraw", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "zeros", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$L = "0x610160604052600380546001600160401b031916905534801561002157600080fd5b506040516120673803806120678339810160408190526100409161048f565b848484848484848484808360008263ffffffff16116100b25760405162461bcd60e51b815260206004820152602360248201527f5f6c6576656c732073686f756c642062652067726561746572207468616e207a60448201526265726f60e81b60648201526084015b60405180910390fd5b60208263ffffffff16106101085760405162461bcd60e51b815260206004820152601e60248201527f5f6c6576656c732073686f756c64206265206c657373207468616e203332000060448201526064016100a9565b63ffffffff821660a0526001600160a01b0381166080527f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c60005b8363ffffffff168163ffffffff1610156101905763ffffffff811660009081526001602090815260408083208590559082905290208290556101868383806102aa565b9150600101610143565b506000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b55505060016004558161021e5760405162461bcd60e51b815260206004820152602560248201527f64656e6f6d696e6174696f6e2073686f756c6420626520677265617465722074604482015264068616e20360dc1b60648201526084016100a9565b506001600160a01b0392831660c05260e05250908116610100528a16935061028c925050505760405162461bcd60e51b815260206004820152601a60248201527f496e76616c696420434f4d5020746f6b656e206164647265737300000000000060448201526064016100a9565b5050506001600160a01b03938416610120525050166101405261054e565b600060008051602061204783398151915283106103095760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c6460448201526064016100a9565b60008051602061204783398151915282106103705760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b60648201526084016100a9565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156103bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103e3919061052a565b909250905060008051602061204783398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610448573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061046c919061052a565b509695505050505050565b6001600160a01b038116811461048c57600080fd5b50565b600080600080600080600060e0888a0312156104aa57600080fd5b87516104b581610477565b60208901519097506104c681610477565b60408901519096506104d781610477565b60608901519095506104e881610477565b608089015160a08a0151919550935063ffffffff8116811461050957600080fd5b60c089015190925061051a81610477565b8091505092959891949750929550565b6000806040838503121561053d57600080fd5b505080516020909101519092909150565b60805160a05160c05160e051610100516101205161014051611a4b6105fc6000396000818161017d01526105d40152600081816102e5015261060501526000818161057801528181610ecc01528181610f0601526112600152600081816103690152818161074101528181610e9e015261128401526000818161023801526108aa01526000818161029c01528181610fe7015261108901526000818161051701526111210152611a4b6000f3fe6080604052600436106101665760003560e01c806390eeb02b116100d1578063e5285dcc1161008a578063ed33639f11610064578063ed33639f14610505578063f178e47c14610539578063fc0c546a14610566578063fc7e9c6f1461059a57600080fd5b8063e5285dcc14610474578063e8295588146104a4578063ec732959146104d157600080fd5b806390eeb02b146103ab5780639fa12d0b146103c8578063b214faa5146103f5578063ba70f75714610408578063c2b40ae414610432578063cd87a3b41461045f57600080fd5b80634ecf518b116101235780634ecf518b1461028a5780635aa6e675146102d35780636d9833e314610307578063839df945146103275780638bca6d16146103575780638ea3099e1461038b57600080fd5b8063109d0af81461016b57806317cc915c146101bc5780631bd85bdb146101fc57806321a0adb6146102135780632b7ac3f314610226578063414a37ba1461025a575b600080fd5b34801561017757600080fd5b5061019f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156101c857600080fd5b506101ec6101d73660046114ef565b60056020526000908152604090205460ff1681565b60405190151581526020016101b3565b34801561020857600080fd5b506102116105bf565b005b61021161022136600461152d565b6106e3565b34801561023257600080fd5b5061019f7f000000000000000000000000000000000000000000000000000000000000000081565b34801561026657600080fd5b5061027c6000805160206119f683398151915281565b6040519081526020016101b3565b34801561029657600080fd5b506102be7f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff90911681526020016101b3565b3480156102df57600080fd5b5061019f7f000000000000000000000000000000000000000000000000000000000000000081565b34801561031357600080fd5b506101ec6103223660046114ef565b6109ee565b34801561033357600080fd5b506101ec6103423660046114ef565b60066020526000908152604090205460ff1681565b34801561036357600080fd5b5061027c7f000000000000000000000000000000000000000000000000000000000000000081565b34801561039757600080fd5b5061027c6103a63660046115e6565b610a6c565b3480156103b757600080fd5b506003546102be9063ffffffff1681565b3480156103d457600080fd5b506103e86103e336600461161b565b610c39565b6040516101b39190611692565b6102116104033660046114ef565b610cf5565b34801561041457600080fd5b5060035463ffffffff1660009081526002602052604090205461027c565b34801561043e57600080fd5b5061027c61044d3660046114ef565b60026020526000908152604090205481565b34801561046b57600080fd5b506102be601e81565b34801561048057600080fd5b506101ec61048f3660046114ef565b60009081526005602052604090205460ff1690565b3480156104b057600080fd5b5061027c6104bf3660046114ef565b60016020526000908152604090205481565b3480156104dd57600080fd5b5061027c7f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c81565b34801561051157600080fd5b5061019f7f000000000000000000000000000000000000000000000000000000000000000081565b34801561054557600080fd5b5061027c6105543660046114ef565b60006020819052908152604090205481565b34801561057257600080fd5b5061019f7f000000000000000000000000000000000000000000000000000000000000000081565b3480156105a657600080fd5b506003546102be90640100000000900463ffffffff1681565b6040516370a0823160e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a9059cbb907f00000000000000000000000000000000000000000000000000000000000000009083906370a0823190602401602060405180830381865afa15801561064d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067191906116d7565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156106bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e091906116f0565b50565b60026004540361073a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60026004557f00000000000000000000000000000000000000000000000000000000000000008211156107af5760405162461bcd60e51b815260206004820152601a60248201527f4665652065786365656473207472616e736665722076616c75650000000000006044820152606401610731565b60008581526005602052604090205460ff161561080e5760405162461bcd60e51b815260206004820152601f60248201527f546865206e6f746520686173206265656e20616c7265616479207370656e74006044820152606401610731565b610817866109ee565b6108635760405162461bcd60e51b815260206004820152601c60248201527f43616e6e6f742066696e6420796f7572206d65726b6c6520726f6f74000000006044820152606401610731565b6040805160c081018252878152602081018790526001600160a01b038681168284015285811660608301526080820185905260a08201849052915163695ef6f960e01b81527f00000000000000000000000000000000000000000000000000000000000000009092169163695ef6f9916108e3918c918c91600401611719565b6020604051808303816000875af1158015610902573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092691906116f0565b61096b5760405162461bcd60e51b815260206004820152601660248201527524b73b30b634b2103bb4ba34323930bb90383937b7b360511b6044820152606401610731565b6000858152600560205260409020805460ff1916600117905561099084848484610e2c565b604080516001600160a01b03868116825260208201889052918101849052908416907fe9e508bad6d4c3227e881ca19068f099da81b5164dd6d62b2eaf1e8bc6c349319060600160405180910390a250506001600455505050505050565b60008181036109ff57506000919050565b60035463ffffffff16805b63ffffffff81166000908152600260205260409020548403610a30575060019392505050565b8063ffffffff16600003610a425750601e5b80610a4c8161178f565b9150508163ffffffff168163ffffffff1603610a0a575060009392505050565b60006000805160206119f68339815191528310610acb5760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c646044820152606401610731565b6000805160206119f68339815191528210610b325760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b6064820152608401610731565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610b81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba591906117af565b90925090506000805160206119f683398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610c0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2e91906117af565b509695505050505050565b60608167ffffffffffffffff811115610c5457610c546117e9565b604051908082528060200260200182016040528015610c7d578160200160208202803683370190505b50905060005b82811015610cee57610cbc848483818110610ca057610ca06117ff565b9050602002013560009081526005602052604090205460ff1690565b15610ce6576001828281518110610cd557610cd56117ff565b911515602092830291909101909101525b600101610c83565b5092915050565b600260045403610d475760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610731565b600260045560008181526006602052604090205460ff1615610db55760405162461bcd60e51b815260206004820152602160248201527f54686520636f6d6d69746d656e7420686173206265656e207375626d697474656044820152601960fa1b6064820152608401610731565b6000610dc082610fce565b6000838152600660205260409020805460ff191660011790559050610de36111ec565b6040805163ffffffff8316815242602082015283917fa945e51eec50ab98c161376f0db4cf2aeba3ec92755fe2fcd388bdbbb80ff196910160405180910390a250506001600455565b803414610e945760405162461bcd60e51b815260206004820152603060248201527f496e636f727265637420726566756e6420616d6f756e7420726563656976656460448201526f08189e481d1a194818dbdb9d1c9858dd60821b6064820152608401610731565b610ef384610ec2847f0000000000000000000000000000000000000000000000000000000000000000611815565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691906112aa565b8115610f2d57610f2d6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001684846112aa565b8015610fc8576000846001600160a01b03168260405160006040518083038185875af1925050503d8060008114610f80576040519150601f19603f3d011682016040523d82523d6000602084013e610f85565b606091505b5050905080610fc6576040516001600160a01b0385169083156108fc029084906000818181858888f19350505050158015610fc4573d6000803e3d6000fd5b505b505b50505050565b600354600090640100000000900463ffffffff1661100d7f00000000000000000000000000000000000000000000000000000000000000006002611942565b63ffffffff168163ffffffff16036110805760405162461bcd60e51b815260206004820152603060248201527f4d65726b6c6520747265652069732066756c6c2e204e6f206d6f7265206c656160448201526f1d995cc818d85b88189948185919195960821b6064820152608401610731565b8083600080805b7f000000000000000000000000000000000000000000000000000000000000000063ffffffff168163ffffffff16101561115e576110c660028661195a565b63ffffffff166000036111005763ffffffff811660009081526001602090815260408083205491839052909120859055849350915061111c565b63ffffffff811660009081526020819052604090205492508391505b6111477f00000000000000000000000000000000000000000000000000000000000000008484610a6c565b9350611154600286611982565b9450600101611087565b50600354600090601e906111799063ffffffff1660016119aa565b611183919061195a565b6003805463ffffffff191663ffffffff8316908117909155600090815260026020526040902085905590506111b98660016119aa565b6003805463ffffffff929092166401000000000267ffffffff000000001990921691909117905550939695505050505050565b34156112535760405162461bcd60e51b815260206004820152603060248201527f4554482076616c756520697320737570706f73656420746f206265203020666f60448201526f7220455243323020696e7374616e636560801b6064820152608401610731565b6112a86001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633307f00000000000000000000000000000000000000000000000000000000000000006113c3565b565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b179052915160009283929087169161130691906119c6565b6000604051808303816000865af19150503d8060008114611343576040519150601f19603f3d011682016040523d82523d6000602084013e611348565b606091505b50915091508161135a57805181602001fd5b8051158061137757508080602001905181019061137791906116f0565b610fc65760405162461bcd60e51b815260206004820152601e60248201527f5361666545524332303a20736166655472616e73666572206661696c656400006044820152606401610731565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b179052915160009283929088169161142791906119c6565b6000604051808303816000865af19150503d8060008114611464576040519150601f19603f3d011682016040523d82523d6000602084013e611469565b606091505b50915091508161147b57805181602001fd5b8051158061149857508080602001905181019061149891906116f0565b610fc45760405162461bcd60e51b815260206004820152602260248201527f5361666545524332303a20736166655472616e7366657246726f6d206661696c604482015261195960f21b6064820152608401610731565b60006020828403121561150157600080fd5b5035919050565b6001600160a01b03811681146106e057600080fd5b803561152881611508565b919050565b60008060008060008060008060e0898b03121561154957600080fd5b883567ffffffffffffffff81111561156057600080fd5b8901601f81018b1361157157600080fd5b803567ffffffffffffffff81111561158857600080fd5b8b602082840101111561159a57600080fd5b6020918201995097508901359550604089013594506115bb60608a0161151d565b93506115c960808a0161151d565b979a969950949793969295929450505060a08201359160c0013590565b6000806000606084860312156115fb57600080fd5b833561160681611508565b95602085013595506040909401359392505050565b6000806020838503121561162e57600080fd5b823567ffffffffffffffff81111561164557600080fd5b8301601f8101851361165657600080fd5b803567ffffffffffffffff81111561166d57600080fd5b8560208260051b840101111561168257600080fd5b6020919091019590945092505050565b602080825282518282018190526000918401906040840190835b818110156116cc57835115158352602093840193909201916001016116ac565b509095945050505050565b6000602082840312156116e957600080fd5b5051919050565b60006020828403121561170257600080fd5b8151801515811461171257600080fd5b9392505050565b60e081528260e08201528284610100830137600061010084830101526000610100601f19601f8601168301019050602082018360005b600681101561176e57815183526020928301929091019060010161174f565b505050949350505050565b634e487b7160e01b600052601160045260246000fd5b600063ffffffff8216806117a5576117a5611779565b6000190192915050565b600080604083850312156117c257600080fd5b505080516020909101519092909150565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b8181038181111561182857611828611779565b92915050565b6001815b60018411156118695780850481111561184d5761184d611779565b600184161561185b57908102905b60019390931c928002611832565b935093915050565b60008261188057506001611828565b8161188d57506000611828565b81600181146118a357600281146118ad576118de565b6001915050611828565b60ff8411156118be576118be611779565b6001841b915063ffffffff8211156118d8576118d8611779565b50611828565b5060208310610133831016604e8410600b8410161715611915575081810a63ffffffff81111561191057611910611779565b611828565b61192463ffffffff848461182e565b8063ffffffff0482111561193a5761193a611779565b029392505050565b600061171263ffffffff841663ffffffff8416611871565b600063ffffffff831680611970576119706117d3565b8063ffffffff84160691505092915050565b600063ffffffff831680611998576119986117d3565b8063ffffffff84160491505092915050565b63ffffffff818116838216019081111561182857611828611779565b6000825160005b818110156119e757602081860181015185830152016119cd565b50600092019182525091905056fe30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001a26469706673582212207ba9bd4e8d26bbfcb07faf36daf24a1575b7c43d30b2842a5b2498dac1615c5d64736f6c634300081c003330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001"; +const isSuperArgs$L = (xs) => xs.length > 1; +class CTornado__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$L(args)) { + super(...args); + } else { + super(_abi$1g, _bytecode$L, args[0]); + } + } + getDeployTransaction(_governance, _comp, _verifier, _hasher, _denomination, _merkleTreeHeight, _token, overrides) { + return super.getDeployTransaction( + _governance, + _comp, + _verifier, + _hasher, + _denomination, + _merkleTreeHeight, + _token, + overrides || {} + ); + } + deploy(_governance, _comp, _verifier, _hasher, _denomination, _merkleTreeHeight, _token, overrides) { + return super.deploy( + _governance, + _comp, + _verifier, + _hasher, + _denomination, + _merkleTreeHeight, + _token, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$L; + static abi = _abi$1g; + static createInterface() { + return new interface_Interface(_abi$1g); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1g, runner); + } +} + +var index$B = /*#__PURE__*/Object.freeze({ + __proto__: null, + CTornado__factory: CTornado__factory, + ERC20Tornado__factory: ERC20Tornado__factory, + ETHTornado__factory: ETHTornado__factory, + Echoer__factory: Echoer__factory, + PermitTornado__factory: PermitTornado__factory, + Verifier__factory: Verifier__factory, + interfaces: index$C, + merkleTreeWithHistorySol: index$H, + mocks: index$F, + tornadoProxyLightSol: index$D, + tornadoSol: index$E +}); + +const _abi$1f = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "ApprovalForAll", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "bytes32", + name: "label", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "NewOwner", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "NewResolver", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "NewTTL", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "operator", + type: "address" + } + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "recordExists", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "resolver", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "setApprovalForAll", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "setOwner", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setRecord", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "setResolver", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "label", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "setSubnodeOwner", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "label", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setSubnodeRecord", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setTTL", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "ttl", + outputs: [ + { + internalType: "uint64", + name: "", + type: "uint64" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IENSRegistry__factory { + static abi = _abi$1f; + static createInterface() { + return new interface_Interface(_abi$1f); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1f, runner); + } +} + +const _abi$1e = [ + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "addr", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "string", + name: "key", + type: "string" + } + ], + name: "text", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IENSResolver__factory { + static abi = _abi$1e; + static createInterface() { + return new interface_Interface(_abi$1e); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1e, runner); + } +} + +const _abi$1d = [ + { + inputs: [ + { + internalType: "address", + name: "relayer", + type: "address" + } + ], + name: "getRelayerBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "relayer", + type: "address" + }, + { + internalType: "address", + name: "toResolve", + type: "address" + } + ], + name: "isRelayerRegistered", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IRelayerRegistry__factory { + static abi = _abi$1d; + static createInterface() { + return new interface_Interface(_abi$1d); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1d, runner); + } +} + +const _abi$1c = [ + { + inputs: [ + { + internalType: "address", + name: "_IENSRegistry", + type: "address" + }, + { + internalType: "address", + name: "_IRelayerRegistry", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "ENSRegistry", + outputs: [ + { + internalType: "contract IENSRegistry", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "RelayerRegistry", + outputs: [ + { + internalType: "contract IRelayerRegistry", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "_relayers", + type: "bytes32[]" + }, + { + internalType: "string[]", + name: "_subdomains", + type: "string[]" + } + ], + name: "relayersData", + outputs: [ + { + components: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "bool", + name: "isRegistered", + type: "bool" + }, + { + internalType: "string[20]", + name: "records", + type: "string[20]" + } + ], + internalType: "struct Relayer[]", + name: "", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$K = "0x60c060405234801561001057600080fd5b50604051610b74380380610b7483398101604081905261002f9161004d565b6001600160601b0319606092831b8116608052911b1660a05261009e565b6000806040838503121561005f578182fd5b825161006a81610086565b602084015190925061007b81610086565b809150509250929050565b6001600160a01b038116811461009b57600080fd5b50565b60805160601c60a05160601c610a9b6100d96000398060b2528061040352806104f1525080608e528061013a528061021b5250610a9b6000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631cb120d61461004657806339c16356146100645780634d47d7751461006c575b600080fd5b61004e61008c565b60405161005b9190610891565b60405180910390f35b61004e6100b0565b61007f61007a366004610702565b6100d4565b60405161005b91906108bf565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b606080835167ffffffffffffffff811180156100ef57600080fd5b5060405190808252806020026020018201604052801561012957816020015b6101166105cd565b81526020019060019003908161010e5790505b50905060005b84518110156105c5577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166302571be386838151811061017357fe5b60200260200101516040518263ffffffff1660e01b8152600401610197919061099d565b60206040518083038186803b1580156101af57600080fd5b505afa1580156101c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101e791906106d4565b8282815181106101f357fe5b6020026020010151600001906001600160a01b031690816001600160a01b03168152505060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630178b8bf87848151811061025457fe5b60200260200101516040518263ffffffff1660e01b8152600401610278919061099d565b60206040518083038186803b15801561029057600080fd5b505afa1580156102a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c891906106d4565b905060005b85518110156104005760008784815181106102e457fe5b60200260200101518783815181106102f857fe5b60200260200101516040516020016103109190610875565b60405160208183030381529060405280519060200120604051602001610337929190610867565b60408051601f19818403018152908290528051602090910120631674750f60e21b825291506001600160a01b038416906359d1d43c9061037b9084906004016109a6565b60006040518083038186803b15801561039357600080fd5b505afa1580156103a7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103cf91908101906107dc565b8585815181106103db57fe5b60200260200101516060015183601481106103f257fe5b6020020152506001016102cd565b507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b69fd4ab84848151811061043c57fe5b60200260200101516000015185858151811061045457fe5b6020026020010151600001516040518363ffffffff1660e01b815260040161047d9291906108a5565b60206040518083038186803b15801561049557600080fd5b505afa1580156104a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104cd91906107bc565b8383815181106104d957fe5b602002602001015160400190151590811515815250507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b971a6bf84848151811061052a57fe5b6020026020010151600001516040518263ffffffff1660e01b81526004016105529190610891565b60206040518083038186803b15801561056a57600080fd5b505afa15801561057e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a2919061084f565b8383815181106105ae57fe5b60209081029190910181015101525060010161012f565b509392505050565b604051806080016040528060006001600160a01b0316815260200160008152602001600015158152602001610600610605565b905290565b6040518061028001604052806014905b60608152602001906001900390816106155790505090565b600082601f83011261063d578081fd5b813561065061064b826109f1565b6109ca565b818152915060208083019084810160005b848110156106c9578135870188603f82011261067c57600080fd5b8381013561068c61064b82610a11565b81815260408b818486010111156106a257600080fd5b82818501888401375060009181018601919091528552509282019290820190600101610661565b505050505092915050565b6000602082840312156106e5578081fd5b81516001600160a01b03811681146106fb578182fd5b9392505050565b60008060408385031215610714578081fd5b823567ffffffffffffffff8082111561072b578283fd5b818501915085601f83011261073e578283fd5b813561074c61064b826109f1565b80828252602080830192508086018a82838702890101111561076c578788fd5b8796505b8487101561078e578035845260019690960195928101928101610770565b5090965087013593505050808211156107a5578283fd5b506107b28582860161062d565b9150509250929050565b6000602082840312156107cd578081fd5b815180151581146106fb578182fd5b6000602082840312156107ed578081fd5b815167ffffffffffffffff811115610803578182fd5b8201601f81018413610813578182fd5b805161082161064b82610a11565b818152856020838501011115610835578384fd5b610846826020830160208601610a35565b95945050505050565b600060208284031215610860578081fd5b5051919050565b918252602082015260400190565b60008251610887818460208701610a35565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6000602080830181845280855180835260408601915060408482028701019250838701855b8281101561099057878503603f19018452815180516001600160a01b03168652868101518787015260408082015115159087015260609081015160809187018290529086016103008701895b601481101561097b57888203607f1901835283518051610950818561099d565b61095d82828f8601610a35565b958c0195948c0194601f91909101601f191601925050600101610930565b509650505092850192908501906001016108e4565b5092979650505050505050565b90815260200190565b908152604060208201819052600390820152621d5c9b60ea1b606082015260800190565b60405181810167ffffffffffffffff811182821017156109e957600080fd5b604052919050565b600067ffffffffffffffff821115610a07578081fd5b5060209081020190565b600067ffffffffffffffff821115610a27578081fd5b50601f01601f191660200190565b60005b83811015610a50578181015183820152602001610a38565b83811115610a5f576000848401525b5050505056fea2646970667358221220628a366714cdda82fe91d785ad928e44e4b9f7976ed987e5fef72d207582dbaf64736f6c634300060c0033"; +const isSuperArgs$K = (xs) => xs.length > 1; +class RelayerAggregator__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$K(args)) { + super(...args); + } else { + super(_abi$1c, _bytecode$K, args[0]); + } + } + getDeployTransaction(_IENSRegistry, _IRelayerRegistry, overrides) { + return super.getDeployTransaction( + _IENSRegistry, + _IRelayerRegistry, + overrides || {} + ); + } + deploy(_IENSRegistry, _IRelayerRegistry, overrides) { + return super.deploy( + _IENSRegistry, + _IRelayerRegistry, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$K; + static abi = _abi$1c; + static createInterface() { + return new interface_Interface(_abi$1c); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1c, runner); + } +} + +var index$A = /*#__PURE__*/Object.freeze({ + __proto__: null, + IENSRegistry__factory: IENSRegistry__factory, + IENSResolver__factory: IENSResolver__factory, + IRelayerRegistry__factory: IRelayerRegistry__factory, + RelayerAggregator__factory: RelayerAggregator__factory +}); + +const _abi$1b = [ + { + inputs: [ + { + internalType: "address", + name: "_ensRegistry", + type: "address" + }, + { + internalType: "address", + name: "_relayerRegistry", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "ENSRegistry", + outputs: [ + { + internalType: "contract IENSRegistry", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "RelayerRegistry", + outputs: [ + { + internalType: "contract IRelayerRegistry", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract Governance", + name: "governance", + type: "address" + } + ], + name: "getAllProposals", + outputs: [ + { + components: [ + { + internalType: "address", + name: "proposer", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "forVotes", + type: "uint256" + }, + { + internalType: "uint256", + name: "againstVotes", + type: "uint256" + }, + { + internalType: "bool", + name: "executed", + type: "bool" + }, + { + internalType: "bool", + name: "extended", + type: "bool" + }, + { + internalType: "enum Governance.ProposalState", + name: "state", + type: "uint8" + } + ], + internalType: "struct GovernanceAggregator.Proposal[]", + name: "proposals", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract Governance", + name: "governance", + type: "address" + }, + { + internalType: "address[]", + name: "accs", + type: "address[]" + } + ], + name: "getGovernanceBalances", + outputs: [ + { + internalType: "uint256[]", + name: "amounts", + type: "uint256[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract Governance", + name: "governance", + type: "address" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "getUserData", + outputs: [ + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "uint256", + name: "latestProposalId", + type: "uint256" + }, + { + internalType: "uint256", + name: "latestProposalIdState", + type: "uint256" + }, + { + internalType: "uint256", + name: "timelock", + type: "uint256" + }, + { + internalType: "address", + name: "delegatee", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "_relayers", + type: "bytes32[]" + }, + { + internalType: "string[]", + name: "_subdomains", + type: "string[]" + } + ], + name: "relayersData", + outputs: [ + { + components: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "bool", + name: "isRegistered", + type: "bool" + }, + { + internalType: "string[20]", + name: "records", + type: "string[20]" + } + ], + internalType: "struct Relayer[]", + name: "", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$J = "0x60c060405234801561001057600080fd5b5060405161155d38038061155d83398101604081905261002f9161004d565b6001600160601b0319606092831b8116608052911b1660a05261009e565b6000806040838503121561005f578182fd5b825161006a81610086565b602084015190925061007b81610086565b809150509250929050565b6001600160a01b038116811461009b57600080fd5b50565b60805160601c60a05160601c6114826100db6000398061024b528061059c528061068a52508061022752806102d352806103b452506114826000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063029fcae7146100675780631cb120d61461009057806339c16356146100a55780634d47d775146100ad5780639853d922146100cd578063f4eeefe9146100ed575b600080fd5b61007a610075366004610fa1565b610111565b60405161008791906112ee565b60405180910390f35b610098610225565b6040516100879190611118565b610098610249565b6100c06100bb366004610e93565b61026d565b6040516100879190611210565b6100e06100db366004610dcc565b61075e565b6040516100879190611146565b6101006100fb366004610f69565b6109dd565b60405161008795949392919061135f565b60608167ffffffffffffffff8111801561012a57600080fd5b50604051908082528060200260200182016040528015610154578160200160208202803683370190505b50905060005b8281101561021d57846001600160a01b0316639ae697bf85858481811061017d57fe5b90506020020160208101906101929190610dcc565b6040518263ffffffff1660e01b81526004016101ae9190611118565b60206040518083038186803b1580156101c657600080fd5b505afa1580156101da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fe91906110b5565b82828151811061020a57fe5b602090810291909101015260010161015a565b509392505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b606080835167ffffffffffffffff8111801561028857600080fd5b506040519080825280602002602001820160405280156102c257816020015b6102af610c79565b8152602001906001900390816102a75790505b50905060005b845181101561021d577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166302571be386838151811061030c57fe5b60200260200101516040518263ffffffff1660e01b81526004016103309190611332565b60206040518083038186803b15801561034857600080fd5b505afa15801561035c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103809190610def565b82828151811061038c57fe5b6020026020010151600001906001600160a01b031690816001600160a01b03168152505060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630178b8bf8784815181106103ed57fe5b60200260200101516040518263ffffffff1660e01b81526004016104119190611332565b60206040518083038186803b15801561042957600080fd5b505afa15801561043d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104619190610def565b905060005b855181101561059957600087848151811061047d57fe5b602002602001015187838151811061049157fe5b60200260200101516040516020016104a991906110fc565b604051602081830303815290604052805190602001206040516020016104d09291906110ee565b60408051601f19818403018152908290528051602090910120631674750f60e21b825291506001600160a01b038416906359d1d43c9061051490849060040161133b565b60006040518083038186803b15801561052c57600080fd5b505afa158015610540573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526105689190810190611042565b85858151811061057457fe5b602002602001015160600151836014811061058b57fe5b602002015250600101610466565b507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b69fd4ab8484815181106105d557fe5b6020026020010151600001518585815181106105ed57fe5b6020026020010151600001516040518363ffffffff1660e01b815260040161061692919061112c565b60206040518083038186803b15801561062e57600080fd5b505afa158015610642573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106669190610f4d565b83838151811061067257fe5b602002602001015160400190151590811515815250507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b971a6bf8484815181106106c357fe5b6020026020010151600001516040518263ffffffff1660e01b81526004016106eb9190611118565b60206040518083038186803b15801561070357600080fd5b505afa158015610717573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073b91906110b5565b83838151811061074757fe5b6020908102919091018101510152506001016102c8565b6060816001600160a01b031663da35c6646040518163ffffffff1660e01b815260040160206040518083038186803b15801561079957600080fd5b505afa1580156107ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d191906110b5565b67ffffffffffffffff811180156107e757600080fd5b5060405190808252806020026020018201604052801561082157816020015b61080e610cb1565b8152602001906001900390816108065790505b50905060005b81518110156109d7576000806000806000806000808a6001600160a01b031663013cf08b8a6001016040518263ffffffff1660e01b815260040161086b9190611332565b6101006040518083038186803b15801561088457600080fd5b505afa158015610898573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108bc9190610e0b565b97509750975097509750975097509750604051806101200160405280896001600160a01b03168152602001886001600160a01b03168152602001878152602001868152602001858152602001848152602001831515815260200182151581526020018c6001600160a01b0316633e4f49e68c6001016040518263ffffffff1660e01b815260040161094d9190611332565b60206040518083038186803b15801561096557600080fd5b505afa158015610979573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099d9190611023565b60068111156109a857fe5b8152508a8a815181106109b757fe5b602002602001018190525050505050505050508080600101915050610827565b50919050565b6000806000806000866001600160a01b0316639ae697bf876040518263ffffffff1660e01b8152600401610a119190611118565b60206040518083038186803b158015610a2957600080fd5b505afa158015610a3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6191906110b5565b6040516317977c6160e01b81529095506001600160a01b038816906317977c6190610a90908990600401611118565b60206040518083038186803b158015610aa857600080fd5b505afa158015610abc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae091906110b5565b93508315610b7257604051631f27a4f360e11b81526001600160a01b03881690633e4f49e690610b14908790600401611332565b60206040518083038186803b158015610b2c57600080fd5b505afa158015610b40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b649190611023565b6006811115610b6f57fe5b92505b60405163a72edda360e01b81526001600160a01b0388169063a72edda390610b9e908990600401611118565b60206040518083038186803b158015610bb657600080fd5b505afa158015610bca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bee91906110b5565b604051631976849960e21b81529092506001600160a01b038816906365da126490610c1d908990600401611118565b60206040518083038186803b158015610c3557600080fd5b505afa158015610c49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6d9190610def565b90509295509295909350565b604051806080016040528060006001600160a01b0316815260200160008152602001600015158152602001610cac610cfd565b905290565b6040805161012081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905290610100820190610cac565b6040518061028001604052806014905b6060815260200190600190039081610d0d5790505090565b600082601f830112610d35578081fd5b8135610d48610d43826113b2565b61138b565b818152915060208083019084810160005b84811015610dc1578135870188603f820112610d7457600080fd5b83810135610d84610d43826113d2565b81815260408b81848601011115610d9a57600080fd5b82818501888401375060009181018601919091528552509282019290820190600101610d59565b505050505092915050565b600060208284031215610ddd578081fd5b8135610de881611426565b9392505050565b600060208284031215610e00578081fd5b8151610de881611426565b600080600080600080600080610100898b031215610e27578384fd5b8851610e3281611426565b60208a0151909850610e4381611426565b8097505060408901519550606089015194506080890151935060a0890151925060c0890151610e718161143e565b60e08a0151909250610e828161143e565b809150509295985092959890939650565b60008060408385031215610ea5578182fd5b823567ffffffffffffffff80821115610ebc578384fd5b818501915085601f830112610ecf578384fd5b8135610edd610d43826113b2565b80828252602080830192508086018a828387028901011115610efd578889fd5b8896505b84871015610f1f578035845260019690960195928101928101610f01565b509096508701359350505080821115610f36578283fd5b50610f4385828601610d25565b9150509250929050565b600060208284031215610f5e578081fd5b8151610de88161143e565b60008060408385031215610f7b578182fd5b8235610f8681611426565b91506020830135610f9681611426565b809150509250929050565b600080600060408486031215610fb5578283fd5b8335610fc081611426565b9250602084013567ffffffffffffffff80821115610fdc578384fd5b818601915086601f830112610fef578384fd5b813581811115610ffd578485fd5b8760208083028501011115611010578485fd5b6020830194508093505050509250925092565b600060208284031215611034578081fd5b815160078110610de8578182fd5b600060208284031215611053578081fd5b815167ffffffffffffffff811115611069578182fd5b8201601f81018413611079578182fd5b8051611087610d43826113d2565b81815285602083850101111561109b578384fd5b6110ac8260208301602086016113f6565b95945050505050565b6000602082840312156110c6578081fd5b5051919050565b6001600160a01b03169052565b15159052565b600781106110ea57fe5b9052565b918252602082015260400190565b6000825161110e8184602087016113f6565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b602080825282518282018190526000919060409081850190868401855b8281101561120357815180516001600160a01b031685528681015161118a888701826110cd565b508086015185870152606080820151908601526080808201519086015260a0808201519086015260c0808201516111c3828801826110da565b505060e0808201516111d7828801826110da565b505061010090810151906111ed868201836110e0565b5050610120939093019290850190600101611163565b5091979650505050505050565b6000602080830181845280855180835260408601915060408482028701019250838701855b828110156112e157878503603f19018452815180516001600160a01b03168652868101518787015260408082015115159087015260609081015160809187018290529086016103008701895b60148110156112cc57888203607f19018352835180516112a18185611332565b6112ae82828f86016113f6565b958c0195948c0194601f91909101601f191601925050600101611281565b50965050509285019290850190600101611235565b5092979650505050505050565b6020808252825182820181905260009190848201906040850190845b818110156113265783518352928401929184019160010161130a565b50909695505050505050565b90815260200190565b908152604060208201819052600390820152621d5c9b60ea1b606082015260800190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b60405181810167ffffffffffffffff811182821017156113aa57600080fd5b604052919050565b600067ffffffffffffffff8211156113c8578081fd5b5060209081020190565b600067ffffffffffffffff8211156113e8578081fd5b50601f01601f191660200190565b60005b838110156114115781810151838201526020016113f9565b83811115611420576000848401525b50505050565b6001600160a01b038116811461143b57600080fd5b50565b801515811461143b57600080fdfea26469706673582212209edead2cf5d16a9f09d7d75c5aa042cb00130c9febd0bf0e908fbf9c3f34f1a164736f6c634300060c0033"; +const isSuperArgs$J = (xs) => xs.length > 1; +class Aggregator__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$J(args)) { + super(...args); + } else { + super(_abi$1b, _bytecode$J, args[0]); + } + } + getDeployTransaction(_ensRegistry, _relayerRegistry, overrides) { + return super.getDeployTransaction( + _ensRegistry, + _relayerRegistry, + overrides || {} + ); + } + deploy(_ensRegistry, _relayerRegistry, overrides) { + return super.deploy( + _ensRegistry, + _relayerRegistry, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$J; + static abi = _abi$1b; + static createInterface() { + return new interface_Interface(_abi$1b); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1b, runner); + } +} + +const _abi$1a = [ + { + inputs: [ + { + internalType: "contract Governance", + name: "governance", + type: "address" + } + ], + name: "getAllProposals", + outputs: [ + { + components: [ + { + internalType: "address", + name: "proposer", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "forVotes", + type: "uint256" + }, + { + internalType: "uint256", + name: "againstVotes", + type: "uint256" + }, + { + internalType: "bool", + name: "executed", + type: "bool" + }, + { + internalType: "bool", + name: "extended", + type: "bool" + }, + { + internalType: "enum Governance.ProposalState", + name: "state", + type: "uint8" + } + ], + internalType: "struct GovernanceAggregator.Proposal[]", + name: "proposals", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract Governance", + name: "governance", + type: "address" + }, + { + internalType: "address[]", + name: "accs", + type: "address[]" + } + ], + name: "getGovernanceBalances", + outputs: [ + { + internalType: "uint256[]", + name: "amounts", + type: "uint256[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract Governance", + name: "governance", + type: "address" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "getUserData", + outputs: [ + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "uint256", + name: "latestProposalId", + type: "uint256" + }, + { + internalType: "uint256", + name: "latestProposalIdState", + type: "uint256" + }, + { + internalType: "uint256", + name: "timelock", + type: "uint256" + }, + { + internalType: "address", + name: "delegatee", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$I = "0x608060405234801561001057600080fd5b50610ab8806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063029fcae7146100465780639853d9221461006f578063f4eeefe91461008f575b600080fd5b61005961005436600461082b565b6100b3565b60405161006691906109e3565b60405180910390f35b61008261007d36600461072c565b6101c7565b6040516100669190610919565b6100a261009d3660046107f3565b610446565b604051610066959493929190610a30565b60608167ffffffffffffffff811180156100cc57600080fd5b506040519080825280602002602001820160405280156100f6578160200160208202803683370190505b50905060005b828110156101bf57846001600160a01b0316639ae697bf85858481811061011f57fe5b9050602002016020810190610134919061072c565b6040518263ffffffff1660e01b81526004016101509190610905565b60206040518083038186803b15801561016857600080fd5b505afa15801561017c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a091906108cc565b8282815181106101ac57fe5b60209081029190910101526001016100fc565b509392505050565b6060816001600160a01b031663da35c6646040518163ffffffff1660e01b815260040160206040518083038186803b15801561020257600080fd5b505afa158015610216573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061023a91906108cc565b67ffffffffffffffff8111801561025057600080fd5b5060405190808252806020026020018201604052801561028a57816020015b6102776106e2565b81526020019060019003908161026f5790505b50905060005b8151811015610440576000806000806000806000808a6001600160a01b031663013cf08b8a6001016040518263ffffffff1660e01b81526004016102d49190610a27565b6101006040518083038186803b1580156102ed57600080fd5b505afa158015610301573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610325919061076b565b97509750975097509750975097509750604051806101200160405280896001600160a01b03168152602001886001600160a01b03168152602001878152602001868152602001858152602001848152602001831515815260200182151581526020018c6001600160a01b0316633e4f49e68c6001016040518263ffffffff1660e01b81526004016103b69190610a27565b60206040518083038186803b1580156103ce57600080fd5b505afa1580156103e2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061040691906108ad565b600681111561041157fe5b8152508a8a8151811061042057fe5b602002602001018190525050505050505050508080600101915050610290565b50919050565b6000806000806000866001600160a01b0316639ae697bf876040518263ffffffff1660e01b815260040161047a9190610905565b60206040518083038186803b15801561049257600080fd5b505afa1580156104a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ca91906108cc565b6040516317977c6160e01b81529095506001600160a01b038816906317977c61906104f9908990600401610905565b60206040518083038186803b15801561051157600080fd5b505afa158015610525573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054991906108cc565b935083156105db57604051631f27a4f360e11b81526001600160a01b03881690633e4f49e69061057d908790600401610a27565b60206040518083038186803b15801561059557600080fd5b505afa1580156105a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105cd91906108ad565b60068111156105d857fe5b92505b60405163a72edda360e01b81526001600160a01b0388169063a72edda390610607908990600401610905565b60206040518083038186803b15801561061f57600080fd5b505afa158015610633573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065791906108cc565b604051631976849960e21b81529092506001600160a01b038816906365da126490610686908990600401610905565b60206040518083038186803b15801561069e57600080fd5b505afa1580156106b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d6919061074f565b90509295509295909350565b6040805161012081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290529061010082015290565b60006020828403121561073d578081fd5b813561074881610a5c565b9392505050565b600060208284031215610760578081fd5b815161074881610a5c565b600080600080600080600080610100898b031215610787578384fd5b885161079281610a5c565b60208a01519098506107a381610a5c565b8097505060408901519550606089015194506080890151935060a0890151925060c08901516107d181610a74565b60e08a01519092506107e281610a74565b809150509295985092959890939650565b60008060408385031215610805578182fd5b823561081081610a5c565b9150602083013561082081610a5c565b809150509250929050565b60008060006040848603121561083f578283fd5b833561084a81610a5c565b9250602084013567ffffffffffffffff80821115610866578384fd5b818601915086601f830112610879578384fd5b813581811115610887578485fd5b876020808302850101111561089a578485fd5b6020830194508093505050509250925092565b6000602082840312156108be578081fd5b815160078110610748578182fd5b6000602082840312156108dd578081fd5b5051919050565b6001600160a01b03169052565b15159052565b6007811061090157fe5b9052565b6001600160a01b0391909116815260200190565b602080825282518282018190526000919060409081850190868401855b828110156109d657815180516001600160a01b031685528681015161095d888701826108e4565b508086015185870152606080820151908601526080808201519086015260a0808201519086015260c080820151610996828801826108f1565b505060e0808201516109aa828801826108f1565b505061010090810151906109c0868201836108f7565b5050610120939093019290850190600101610936565b5091979650505050505050565b6020808252825182820181905260009190848201906040850190845b81811015610a1b578351835292840192918401916001016109ff565b50909695505050505050565b90815260200190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b6001600160a01b0381168114610a7157600080fd5b50565b8015158114610a7157600080fdfea2646970667358221220c68e065ff95a2c91c1e5904ff4ba8c709291d5227b10049b437e89d35c33af4d64736f6c634300060c0033"; +const isSuperArgs$I = (xs) => xs.length > 1; +class GovernanceAggregator__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$I(args)) { + super(...args); + } else { + super(_abi$1a, _bytecode$I, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$I; + static abi = _abi$1a; + static createInterface() { + return new interface_Interface(_abi$1a); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$1a, + runner + ); + } +} + +var index$z = /*#__PURE__*/Object.freeze({ + __proto__: null, + Aggregator__factory: Aggregator__factory, + GovernanceAggregator__factory: GovernanceAggregator__factory, + relayerAggregatorSol: index$A +}); + +const _abi$19 = [ + { + inputs: [ + { + internalType: "contract IDeployer", + name: "_deployer", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "addr", + type: "address" + } + ], + name: "Deployed", + type: "event" + }, + { + inputs: [ + { + internalType: "bytes", + name: "_initCode", + type: "bytes" + }, + { + internalType: "bytes32", + name: "_salt", + type: "bytes32" + } + ], + name: "deploy", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "deployer", + outputs: [ + { + internalType: "contract IDeployer", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$H = "0x60a060405234801561001057600080fd5b506040516103a93803806103a98339818101604052602081101561003357600080fd5b50516001600160a01b0381161561004a5780610060565b73ce0042b868300000d44a59004da54a005ffdcf9f5b60601b6001600160601b031916608052604051309032907f09e48df7857bd0c1e0d31bb8a85d42cf1874817895f171c917f6ee2cea73ec2090600090a35060805160601c6102e96100c06000398061010d528061029152506102e96000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80634af63f021461003b578063d5f39488146100e5575b600080fd5b6100e36004803603604081101561005157600080fd5b81019060208101813564010000000081111561006c57600080fd5b82018360208201111561007e57600080fd5b803590602001918460018302840111640100000000831117156100a057600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610109915050565b005b6100ed61028f565b604080516001600160a01b039092168252519081900360200190f35b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634af63f0284846040518363ffffffff1660e01b81526004018080602001838152602001828103825284818151815260200191508051906020019080838360005b8381101561018e578181015183820152602001610176565b50505050905090810190601f1680156101bb5780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b1580156101db57600080fd5b505af11580156101ef573d6000803e3d6000fd5b505050506040513d602081101561020557600080fd5b505190506001600160a01b038116610254576040805162461bcd60e51b815260206004820152600d60248201526c11195c1b1bde4819985a5b1959609a1b604482015290519081900360640190fd5b6040516001600160a01b0382169033907f09e48df7857bd0c1e0d31bb8a85d42cf1874817895f171c917f6ee2cea73ec2090600090a3505050565b7f00000000000000000000000000000000000000000000000000000000000000008156fea26469706673582212209824ac82969e56106968b899123a2ecac48f942b4ed3dcae2ced58022879d32364736f6c634300060c0033"; +const isSuperArgs$H = (xs) => xs.length > 1; +class Deployer__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$H(args)) { + super(...args); + } else { + super(_abi$19, _bytecode$H, args[0]); + } + } + getDeployTransaction(_deployer, overrides) { + return super.getDeployTransaction(_deployer, overrides || {}); + } + deploy(_deployer, overrides) { + return super.deploy(_deployer, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$H; + static abi = _abi$19; + static createInterface() { + return new interface_Interface(_abi$19); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$19, runner); + } +} + +const _abi$18 = [ + { + inputs: [ + { + internalType: "bytes", + name: "_initCode", + type: "bytes" + }, + { + internalType: "bytes32", + name: "_salt", + type: "bytes32" + } + ], + name: "deploy", + outputs: [ + { + internalType: "address payable", + name: "createdContract", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +class IDeployer__factory { + static abi = _abi$18; + static createInterface() { + return new interface_Interface(_abi$18); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$18, runner); + } +} + +var index$y = /*#__PURE__*/Object.freeze({ + __proto__: null, + Deployer__factory: Deployer__factory, + IDeployer__factory: IDeployer__factory +}); + +const _abi$17 = [ + { + inputs: [ + { + internalType: "contract IERC20", + name: "_token", + type: "address" + }, + { + internalType: "address", + name: "_spender", + type: "address" + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256" + } + ], + name: "approveExactToken", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class ITornadoRouter__factory { + static abi = _abi$17; + static createInterface() { + return new interface_Interface(_abi$17); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$17, runner); + } +} + +const _abi$16 = [ + { + inputs: [ + { + internalType: "address", + name: "_governance", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "contract ITornadoInstance", + name: "instance", + type: "address" + }, + { + indexed: false, + internalType: "enum InstanceRegistry.InstanceState", + name: "state", + type: "uint8" + } + ], + name: "InstanceStateUpdated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "tornadoRouter", + type: "address" + } + ], + name: "RouterRegistered", + type: "event" + }, + { + inputs: [], + name: "getAllInstanceAddresses", + outputs: [ + { + internalType: "contract ITornadoInstance[]", + name: "result", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getAllInstances", + outputs: [ + { + components: [ + { + internalType: "contract ITornadoInstance", + name: "addr", + type: "address" + }, + { + components: [ + { + internalType: "bool", + name: "isERC20", + type: "bool" + }, + { + internalType: "contract IERC20", + name: "token", + type: "address" + }, + { + internalType: "enum InstanceRegistry.InstanceState", + name: "state", + type: "uint8" + }, + { + internalType: "uint24", + name: "uniswapPoolSwappingFee", + type: "uint24" + }, + { + internalType: "uint32", + name: "protocolFeePercentage", + type: "uint32" + } + ], + internalType: "struct InstanceRegistry.Instance", + name: "instance", + type: "tuple" + } + ], + internalType: "struct InstanceRegistry.Tornado[]", + name: "result", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "instance", + type: "address" + } + ], + name: "getPoolToken", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "governance", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "contract ITornadoInstance", + name: "addr", + type: "address" + }, + { + components: [ + { + internalType: "bool", + name: "isERC20", + type: "bool" + }, + { + internalType: "contract IERC20", + name: "token", + type: "address" + }, + { + internalType: "enum InstanceRegistry.InstanceState", + name: "state", + type: "uint8" + }, + { + internalType: "uint24", + name: "uniswapPoolSwappingFee", + type: "uint24" + }, + { + internalType: "uint32", + name: "protocolFeePercentage", + type: "uint32" + } + ], + internalType: "struct InstanceRegistry.Instance", + name: "instance", + type: "tuple" + } + ], + internalType: "struct InstanceRegistry.Tornado[]", + name: "_instances", + type: "tuple[]" + }, + { + internalType: "address", + name: "_router", + type: "address" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "instanceIds", + outputs: [ + { + internalType: "contract ITornadoInstance", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "", + type: "address" + } + ], + name: "instances", + outputs: [ + { + internalType: "bool", + name: "isERC20", + type: "bool" + }, + { + internalType: "contract IERC20", + name: "token", + type: "address" + }, + { + internalType: "enum InstanceRegistry.InstanceState", + name: "state", + type: "uint8" + }, + { + internalType: "uint24", + name: "uniswapPoolSwappingFee", + type: "uint24" + }, + { + internalType: "uint32", + name: "protocolFeePercentage", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "_instanceId", + type: "uint256" + } + ], + name: "removeInstance", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "router", + outputs: [ + { + internalType: "contract ITornadoRouter", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "instance", + type: "address" + }, + { + internalType: "uint32", + name: "newFee", + type: "uint32" + } + ], + name: "setProtocolFee", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "routerAddress", + type: "address" + } + ], + name: "setTornadoRouter", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "contract ITornadoInstance", + name: "addr", + type: "address" + }, + { + components: [ + { + internalType: "bool", + name: "isERC20", + type: "bool" + }, + { + internalType: "contract IERC20", + name: "token", + type: "address" + }, + { + internalType: "enum InstanceRegistry.InstanceState", + name: "state", + type: "uint8" + }, + { + internalType: "uint24", + name: "uniswapPoolSwappingFee", + type: "uint24" + }, + { + internalType: "uint32", + name: "protocolFeePercentage", + type: "uint32" + } + ], + internalType: "struct InstanceRegistry.Instance", + name: "instance", + type: "tuple" + } + ], + internalType: "struct InstanceRegistry.Tornado", + name: "_tornado", + type: "tuple" + } + ], + name: "updateInstance", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$G = "0x60a060405234801561001057600080fd5b5060405161146738038061146783398101604081905261002f91610044565b60601b6001600160601b031916608052610072565b600060208284031215610055578081fd5b81516001600160a01b038116811461006b578182fd5b9392505050565b60805160601c6113c46100a3600039806103e552806105c052806105ed528061073a52806107e652506113c46000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80636c9be937116100715780636c9be9371461014d578063908e3b371461016057806392b65a4114610173578063b5b899b714610186578063cf552c8914610199578063f887ea40146101ac576100b4565b8063032bb443146100b957806310c13ac3146100e65780631ad058a9146100fb5780634ba16d9d1461011057806352c228e3146101235780635aa6e67514610138575b600080fd5b6100cc6100c7366004610e89565b6101b4565b6040516100dd959493929190611194565b60405180910390f35b6100ee6101fe565b6040516100dd9190611097565b61010e610109366004610ec8565b6102af565b005b61010e61011e366004610e89565b6103da565b61012b61047f565b6040516100dd91906110e4565b6101406105be565b6040516100dd9190611069565b61010e61015b366004610fd3565b6105e2565b61014061016e366004610e89565b610709565b61010e610181366004610f80565b61072f565b610140610194366004611005565b6107b4565b61010e6101a7366004611005565b6107db565b610140610a77565b60016020526000908152604090205460ff8082169161010081046001600160a01b031691600160a81b82041690600160b01b810462ffffff1690600160c81b900463ffffffff1685565b60025460609067ffffffffffffffff8111801561021a57600080fd5b50604051908082528060200260200182016040528015610244578160200160208202803683370190505b50905060005b6002548110156102ab576002818154811061026157fe5b9060005260206000200160009054906101000a90046001600160a01b031682828151811061028b57fe5b6001600160a01b039092166020928302919091019091015260010161024a565b5090565b600054610100900460ff16806102c857506102c8610a8c565b806102d6575060005460ff16155b6102fb5760405162461bcd60e51b81526004016102f290611214565b60405180910390fd5b600054610100900460ff16158015610326576000805460ff1961ff0019909116610100171660011790555b6000805462010000600160b01b031916620100006001600160a01b038516021781555b83518110156103c25761036e84828151811061036157fe5b6020026020010151610a92565b600284828151811061037c57fe5b6020908102919091018101515182546001808201855560009485529290932090920180546001600160a01b0319166001600160a01b039093169290921790915501610349565b5080156103d5576000805461ff00191690555b505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104225760405162461bcd60e51b81526004016102f2906112c2565b6000805462010000600160b01b031916620100006001600160a01b038416021790556040517f94df8c3a8087dce110e5fbc5acf380c83c94bbd31b2c8ed4c08e1396a696e1a890610474908390611069565b60405180910390a150565b60025460609067ffffffffffffffff8111801561049b57600080fd5b506040519080825280602002602001820160405280156104d557816020015b6104c2610d64565b8152602001906001900390816104ba5790505b50905060005b6002548110156102ab576000600282815481106104f457fe5b60009182526020808320909101546040805180820182526001600160a01b03928316808252808652600180865295839020835160a081018552815460ff8082161515835261010082049097168289015292985092969587019592949093850192600160a81b909204169081111561056757fe5b600181111561057257fe5b81529054600160b01b810462ffffff166020830152600160c81b900463ffffffff16604090910152905283518490849081106105aa57fe5b6020908102919091010152506001016104db565b7f000000000000000000000000000000000000000000000000000000000000000081565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461062a5760405162461bcd60e51b81526004016102f2906112c2565b600061063c6080830160608401610fb8565b600181111561064757fe5b14156106655760405162461bcd60e51b81526004016102f29061128b565b6000600160006106786020850185610e89565b6001600160a01b03168152602081019190915260400160002054600160a81b900460ff1660018111156106a757fe5b14156106ef5760026106bc6020830183610e89565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b039092169190911790555b61070661070136839003830183610fea565b610a92565b50565b6001600160a01b038082166000908152600160205260409020546101009004165b919050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146107775760405162461bcd60e51b81526004016102f2906112c2565b6001600160a01b039091166000908152600160205260409020805463ffffffff909216600160c81b0263ffffffff60c81b19909216919091179055565b600281815481106107c157fe5b6000918252602090912001546001600160a01b0316905081565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108235760405162461bcd60e51b81526004016102f2906112c2565b60006002828154811061083257fe5b60009182526020808320909101546001600160a01b03908116808452600190925260409092205490925060ff8116916101009091041681156109705760008054604051636eb1769f60e11b81526001600160a01b038085169263dd62ed3e926108aa926201000090920490911690889060040161107d565b60206040518083038186803b1580156108c257600080fd5b505afa1580156108d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108fa919061101d565b9050801561096e5760008054604051633ef1078360e01b8152620100009091046001600160a01b031691633ef107839161093b9186918991906004016111db565b600060405180830381600087803b15801561095557600080fd5b505af1158015610969573d6000803e3d6000fd5b505050505b505b6001600160a01b038316600090815260016020526040902080546001600160e81b03191690556002805460001981019081106109a857fe5b600091825260209091200154600280546001600160a01b0390921691869081106109ce57fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506002805480610a0757fe5b6001900381819060005260206000200160006101000a8154906001600160a01b0302191690559055826001600160a01b03167f02826f62d88a4d9f1978eb9c06f8663f642d032908e65a915d5898f3585421c06000604051610a6991906111ff565b60405180910390a250505050565b6000546201000090046001600160a01b031681565b303b1590565b60208181015182516001600160a01b0390811660009081526001808552604091829020845181549686015160ff1990971690151517610100600160a81b0319166101009690941695909502929092178085559083015192939291839160ff60a81b191690600160a81b908490811115610b0757fe5b02179055506060820151815460809093015163ffffffff16600160c81b0263ffffffff60c81b1962ffffff909216600160b01b0262ffffff60b01b19909416939093171691909117905560208101515115610d1457600081600001516001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b158015610b9b57600080fd5b505afa158015610baf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd39190610eac565b90508160200151602001516001600160a01b0316816001600160a01b031614610c0e5760405162461bcd60e51b81526004016102f290611262565b600080548351604051636eb1769f60e11b81526001600160a01b038086169363dd62ed3e93610c4b9362010000909204909216919060040161107d565b60206040518083038186803b158015610c6357600080fd5b505afa158015610c77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9b919061101d565b905080610d11576000548351604051633ef1078360e01b8152620100009092046001600160a01b031691633ef1078391610cde91869190600019906004016111db565b600060405180830381600087803b158015610cf857600080fd5b505af1158015610d0c573d6000803e3d6000fd5b505050505b50505b80600001516001600160a01b03167f02826f62d88a4d9f1978eb9c06f8663f642d032908e65a915d5898f3585421c0826020015160400151604051610d5991906111ff565b60405180910390a250565b604051806040016040528060006001600160a01b03168152602001610d87610d8c565b905290565b6040805160a0810182526000808252602082018190529091820190815260006020820181905260409091015290565b8035610dc681611348565b92915050565b803560028110610dc657600080fd5b600081830360c0811215610ded578182fd5b610df760406112ea565b91508235610e0481611348565b825260a0601f1982011215610e1857600080fd5b50610e2360a06112ea565b6020830135610e318161135d565b81526040830135610e4181611348565b6020820152610e538460608501610dcc565b60408201526080830135610e668161136b565b606082015260a0830135610e798161137c565b6080820152602082015292915050565b600060208284031215610e9a578081fd5b8135610ea581611348565b9392505050565b600060208284031215610ebd578081fd5b8151610ea581611348565b60008060408385031215610eda578081fd5b823567ffffffffffffffff811115610ef0578182fd5b8301601f81018513610f00578182fd5b8035610f13610f0e82611311565b6112ea565b808282526020808301925080850160c08a838288028901011115610f35578788fd5b8796505b85871015610f6157610f4b8b83610ddb565b8552600196909601959382019390810190610f39565b5050819650610f7289828a01610dbb565b955050505050509250929050565b60008060408385031215610f92578182fd5b8235610f9d81611348565b91506020830135610fad8161137c565b809150509250929050565b600060208284031215610fc9578081fd5b610ea58383610dcc565b600060c08284031215610fe4578081fd5b50919050565b600060c08284031215610ffb578081fd5b610ea58383610ddb565b600060208284031215611016578081fd5b5035919050565b60006020828403121561102e578081fd5b5051919050565b15159052565b6001600160a01b03169052565b6002811061105257fe5b9052565b62ffffff169052565b63ffffffff169052565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6020808252825182820181905260009190848201906040850190845b818110156110d85783516001600160a01b0316835292840192918401916001016110b3565b50909695505050505050565b602080825282518282018190526000919060409081850190868401855b828110156111875781516111158151611331565b855286015180516111299088870190611035565b868101516111398787018261103b565b5085810151606061114c81880183611048565b8201519050608061115f87820183611056565b9190910151905061117360a086018261105f565b5060c0939093019290850190600101611101565b5091979650505050505050565b85151581526001600160a01b038516602082015260a081016111b58561133d565b604083015262ffffff8416606083015263ffffffff831660808301529695505050505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6020810161120c8361133d565b825292915050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252600f908201526e24b731b7b93932b1ba103a37b5b2b760891b604082015260600190565b6020808252601f908201527f5573652072656d6f7665496e7374616e6365282920666f722072656d6f766500604082015260600190565b6020808252600e908201526d139bdd08185d5d1a1bdc9a5e995960921b604082015260600190565b60405181810167ffffffffffffffff8111828210171561130957600080fd5b604052919050565b600067ffffffffffffffff821115611327578081fd5b5060209081020190565b6001600160a01b031690565b806002811061072a57fe5b6001600160a01b038116811461070657600080fd5b801515811461070657600080fd5b62ffffff8116811461070657600080fd5b63ffffffff8116811461070657600080fdfea26469706673582212207c46c875176b62100d16a46c273e615cd9eb5336dbcd238b33b227f39ff9106564736f6c634300060c0033"; +const isSuperArgs$G = (xs) => xs.length > 1; +class InstanceRegistry__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$G(args)) { + super(...args); + } else { + super(_abi$16, _bytecode$G, args[0]); + } + } + getDeployTransaction(_governance, overrides) { + return super.getDeployTransaction(_governance, overrides || {}); + } + deploy(_governance, overrides) { + return super.deploy(_governance, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$G; + static abi = _abi$16; + static createInterface() { + return new interface_Interface(_abi$16); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$16, runner); + } +} + +var index$x = /*#__PURE__*/Object.freeze({ + __proto__: null, + ITornadoRouter__factory: ITornadoRouter__factory, + InstanceRegistry__factory: InstanceRegistry__factory +}); + +const _abi$15 = [ + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IENS__factory { + static abi = _abi$15; + static createInterface() { + return new interface_Interface(_abi$15); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$15, runner); + } +} + +const _abi$14 = [ + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "_instance", + type: "address" + } + ], + name: "instanceFeeWithUpdate", + outputs: [ + { + internalType: "uint160", + name: "", + type: "uint160" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +class IFeeManager__factory { + static abi = _abi$14; + static createInterface() { + return new interface_Interface(_abi$14); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$14, runner); + } +} + +const _abi$13 = [ + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + }, + { + internalType: "address", + name: "_governance", + type: "address" + }, + { + internalType: "address", + name: "_ens", + type: "address" + }, + { + internalType: "address", + name: "_staking", + type: "address" + }, + { + internalType: "address", + name: "_feeManager", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "minStakeAmount", + type: "uint256" + } + ], + name: "MinimumStakeAmount", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "relayer", + type: "address" + } + ], + name: "RelayerBalanceNullified", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "bytes32", + name: "relayer", + type: "bytes32" + }, + { + indexed: false, + internalType: "string", + name: "ensName", + type: "string" + }, + { + indexed: false, + internalType: "address", + name: "relayerAddress", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "stakedAmount", + type: "uint256" + } + ], + name: "RelayerRegistered", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "relayer", + type: "address" + } + ], + name: "RelayerUnregistered", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "tornadoRouter", + type: "address" + } + ], + name: "RouterRegistered", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "relayer", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "amountStakeAdded", + type: "uint256" + } + ], + name: "StakeAddedToRelayer", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "relayer", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "amountBurned", + type: "uint256" + } + ], + name: "StakeBurned", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "relayer", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "worker", + type: "address" + } + ], + name: "WorkerRegistered", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "relayer", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "worker", + type: "address" + } + ], + name: "WorkerUnregistered", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "address", + name: "relayer", + type: "address" + }, + { + internalType: "contract ITornadoInstance", + name: "pool", + type: "address" + } + ], + name: "burn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "ens", + outputs: [ + { + internalType: "contract IENS", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "feeManager", + outputs: [ + { + internalType: "contract IFeeManager", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "relayer", + type: "address" + } + ], + name: "getRelayerBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "relayer", + type: "address" + } + ], + name: "getRelayerEnsHash", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "governance", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_tornadoRouter", + type: "address" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "toResolve", + type: "address" + } + ], + name: "isRelayer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "relayer", + type: "address" + }, + { + internalType: "address", + name: "toResolve", + type: "address" + } + ], + name: "isRelayerRegistered", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "minStakeAmount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "relayer", + type: "address" + } + ], + name: "nullifyBalance", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "string", + name: "ensName", + type: "string" + }, + { + internalType: "uint256", + name: "stake", + type: "uint256" + }, + { + internalType: "address[]", + name: "workersToRegister", + type: "address[]" + } + ], + name: "register", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "string", + name: "ensName", + type: "string" + }, + { + internalType: "uint256", + name: "stake", + type: "uint256" + }, + { + internalType: "address[]", + name: "workersToRegister", + type: "address[]" + }, + { + internalType: "address", + name: "relayer", + type: "address" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "registerPermit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "relayer", + type: "address" + }, + { + internalType: "address", + name: "worker", + type: "address" + } + ], + name: "registerWorker", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "relayers", + outputs: [ + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "bytes32", + name: "ensHash", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "minAmount", + type: "uint256" + } + ], + name: "setMinStakeAmount", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "tornadoRouterAddress", + type: "address" + } + ], + name: "setTornadoRouter", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "relayer", + type: "address" + }, + { + internalType: "uint256", + name: "stake", + type: "uint256" + } + ], + name: "stakeToRelayer", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "relayer", + type: "address" + }, + { + internalType: "uint256", + name: "stake", + type: "uint256" + }, + { + internalType: "address", + name: "staker", + type: "address" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "stakeToRelayerPermit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "staking", + outputs: [ + { + internalType: "contract TornadoStakingRewards", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract TORN", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "tornadoRouter", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "relayer", + type: "address" + } + ], + name: "unregisterRelayer", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "worker", + type: "address" + } + ], + name: "unregisterWorker", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "workers", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$F = "0x6101206040523480156200001257600080fd5b5060405162001fab38038062001fab83398101604081905262000035916200006d565b6001600160601b0319606095861b811660805293851b841660a05291841b831660c052831b821660e05290911b166101005262000105565b600080600080600060a0868803121562000085578081fd5b85516200009281620000ec565b6020870151909550620000a581620000ec565b6040870151909450620000b881620000ec565b6060870151909350620000cb81620000ec565b6080870151909250620000de81620000ec565b809150509295509295909350565b6001600160a01b03811681146200010257600080fd5b50565b60805160601c60a05160601c60c05160601c60e05160601c6101005160601c611e1662000195600039806106785280610bf352508061075452806108af5280610ea852806111685250806105625280610f99525080610351528061080952806108dc52806109e75280610ce4525080610a205280610aa95280610c375280610e8552806111455250611e166000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c80635aa6e675116100de578063c4d66de811610097578063e37e8bcc11610071578063e37e8bcc14610305578063e43fdb3c14610318578063eb4af0451461032b578063f18876841461033e57610173565b8063c4d66de8146102d7578063d0fb0203146102ea578063d990231d146102f257610173565b80635aa6e6751461026e57806385a2968314610276578063adf898a414610289578063ae53941c14610291578063b69fd4ab146102b1578063b971a6bf146102c457610173565b80634ba16d9d116101305780634ba16d9d146101f75780634cb16c2e1461020a5780634cf088d9146102125780634d4efd041461021a5780635300f8411461022d578063541d55481461024e57610173565b806314d92307146101785780632e6506491461018d5780633523dc85146101a05780633f15457f146101b35780634048a257146101d157806345a11cec146101e4575b600080fd5b61018b610186366004611612565b610346565b005b61018b61019b36600461164a565b610414565b61018b6101ae366004611612565b610460565b6101bb610560565b6040516101c891906118f5565b60405180910390f35b6101bb6101df366004611612565b610584565b61018b6101f2366004611682565b61059f565b61018b610205366004611612565b6107fe565b6101bb610898565b6101bb6108ad565b61018b610228366004611612565b6108d1565b61024061023b366004611612565b6109ac565b6040516101c89291906118cb565b61026161025c366004611612565b6109c5565b6040516101c891906119a1565b6101bb6109e5565b61018b6102843660046116f7565b610a09565b6101bb610aa7565b6102a461029f366004611612565b610acb565b6040516101c891906119ac565b6102616102bf36600461164a565b610af9565b6102a46102d2366004611612565b610b20565b61018b6102e5366004611612565b610b4b565b6101bb610bf1565b61018b6103003660046116cc565b610c15565b61018b6103133660046117fc565b610c20565b61018b610326366004611785565b610cc4565b61018b6103393660046118b3565b610cd9565b6102a4610d56565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146103975760405162461bcd60e51b815260040161038e90611ae4565b60405180910390fd5b6103a0816108d1565b6001600160a01b038116600090815260026020908152604080832083815560010183905560039091529081902080546001600160a01b0319169055517f490a66cc56c789979052c7052fc0c10a6c4627d8e6165caec80db97a4c383521906104099083906118f5565b60405180910390a150565b3360008181526003602052604090205483906001600160a01b038083169116146104505760405162461bcd60e51b815260040161038e90611c83565b61045a8484610d5c565b50505050565b6001600160a01b03811633146104a9576001600160a01b038181166000908152600360205260409020541633146104a95760405162461bcd60e51b815260040161038e90611cd8565b6001600160a01b0380821660008181526003602052604090205490911614156104e45760405162461bcd60e51b815260040161038e90611b8b565b6001600160a01b03808216600090815260036020526040908190205490517fb2a8e18b9e887f502d65c1683e60b723fa582a6903ea4e8eb23907a19c1ce8a0926105319216908490611909565b60405180910390a16001600160a01b0316600090815260036020526040902080546001600160a01b0319169055565b7f000000000000000000000000000000000000000000000000000000000000000081565b6003602052600090815260409020546001600160a01b031681565b6000546201000090046001600160a01b031633146105cf5760405162461bcd60e51b815260040161038e90611a64565b6001600160a01b03808416600090815260036020526040902054168061062d576001600160a01b0383811660009081526003602052604090205416156106275760405162461bcd60e51b815260040161038e90611be8565b506107f9565b826001600160a01b0316816001600160a01b03161461065e5760405162461bcd60e51b815260040161038e90611c83565b604051630bbefce160e21b81526000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690632efbf384906106ad9086906004016118f5565b602060405180830381600087803b1580156106c757600080fd5b505af11580156106db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ff919061162e565b6001600160a01b03858116600090815260026020526040902054911691506107279082610df5565b6001600160a01b038086166000908152600260205260409081902092909255905163338610af60e01b81527f00000000000000000000000000000000000000000000000000000000000000009091169063338610af9061078b9084906004016119ac565b600060405180830381600087803b1580156107a557600080fd5b505af11580156107b9573d6000803e3d6000fd5b505050507f659f33fc6677bebf3a9bf3101092792e31f35766d0358e54577bdd91a655f6a084826040516107ee929190611988565b60405180910390a150505b505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108465760405162461bcd60e51b815260040161038e90611ae4565b6000805462010000600160b01b031916620100006001600160a01b038416021790556040517f94df8c3a8087dce110e5fbc5acf380c83c94bbd31b2c8ed4c08e1396a696e1a8906104099083906118f5565b6000546201000090046001600160a01b031681565b7f000000000000000000000000000000000000000000000000000000000000000081565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109195760405162461bcd60e51b815260040161038e90611ae4565b6001600160a01b038082166000818152600360205260409020549091169081146109555760405162461bcd60e51b815260040161038e90611d74565b6001600160a01b03811660009081526002602052604080822091909155517fafa759fb3c68e89eaaba359f0930ab40c24875b73cc9e2f6a38b0180019eb8f3906109a09084906118f5565b60405180910390a15050565b6002602052600090815260409020805460019091015482565b6001600160a01b0390811660009081526003602052604090205416151590565b7f000000000000000000000000000000000000000000000000000000000000000081565b60405163d505accf60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d505accf90610a6190889030908b908a908a908a908a90600401611947565b600060405180830381600087803b158015610a7b57600080fd5b505af1158015610a8f573d6000803e3d6000fd5b50505050610a9e858888610e3e565b50505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001600160a01b03908116600090815260036020908152604080832054909316825260029052206001015490565b6001600160a01b038181166000908152600360205260409020548116908316145b92915050565b6001600160a01b03908116600090815260036020908152604080832054909316825260029052205490565b600054610100900460ff1680610b645750610b64610f4c565b80610b72575060005460ff16155b610b8e5760405162461bcd60e51b815260040161038e90611b3d565b600054610100900460ff16158015610bb9576000805460ff1961ff0019909116610100171660011790555b6000805462010000600160b01b031916620100006001600160a01b038516021790558015610bed576000805461ff00191690555b5050565b7f000000000000000000000000000000000000000000000000000000000000000081565b610bed338383610e3e565b60405163d505accf60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d505accf90610c7890889030908d908a908a908a908a90600401611947565b600060405180830381600087803b158015610c9257600080fd5b505af1158015610ca6573d6000803e3d6000fd5b50505050610cb8858b8b8b8b8b610f52565b50505050505050505050565b610cd2338686868686610f52565b5050505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610d215760405162461bcd60e51b815260040161038e90611ae4565b60018190556040517f404663163d528ec45288abc4389b81bd96fabf858ff57577ebd4ee7f15d7b0a6906104099083906119ac565b60015481565b6001600160a01b038181166000908152600360205260409020541615610d945760405162461bcd60e51b815260040161038e90611b0d565b6001600160a01b038181166000908152600360205260409081902080546001600160a01b03191692851692909217909155517fcde75bd02c5f739608c891bcd9aa6809e6c4a7035ac7b9f3fd5fea756db74724906109a09084908490611909565b6000610e3783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611287565b9392505050565b6001600160a01b0380831660008181526003602052604090205490911614610e785760405162461bcd60e51b815260040161038e90611abf565b610ecd6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016847f0000000000000000000000000000000000000000000000000000000000000000846112b3565b6001600160a01b038216600090815260026020526040902054610ef190829061130b565b6001600160a01b0383166000908152600260205260409081902091909155517f1275dbe2a271b2b822e60f1d44894fa5fb337e7e2dc6a200205b1a5b17c07d6490610f3f9084908490611988565b60405180910390a1505050565b303b1590565b6000610f9386868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061133092505050565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166302571be3836040518263ffffffff1660e01b8152600401610fe391906119ac565b60206040518083038186803b158015610ffb57600080fd5b505afa15801561100f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611033919061162e565b905073d4416b13d2b3a9abae7acd5d6c2bbdbe256864016001600160a01b0382168114156110735760405162461bcd60e51b815260040161038e90611c15565b816001600160a01b0316896001600160a01b0316146110a45760405162461bcd60e51b815260040161038e90611ca9565b6001600160a01b0389811660009081526003602052604090205416156110dc5760405162461bcd60e51b815260040161038e90611bbb565b6001600160a01b03891660009081526002602052604090206001810154156111165760405162461bcd60e51b815260040161038e90611a38565b6001548710156111385760405162461bcd60e51b815260040161038e90611d50565b61118d6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168b7f00000000000000000000000000000000000000000000000000000000000000008a6112b3565b7f1275dbe2a271b2b822e60f1d44894fa5fb337e7e2dc6a200205b1a5b17c07d648a886040516111be929190611988565b60405180910390a1868155600181018490556001600160a01b038a16600081815260036020526040812080546001600160a01b0319169092179091555b8581101561123b57600087878381811061121157fe5b90506020020160208101906112269190611612565b90506112328c82610d5c565b506001016111fb565b507f9ca7c9c762eff27b021608f232b4c4b8f9b8bf9a3d322297e47cc4209a67d5e2848a8a8d8b6040516112739594939291906119b5565b60405180910390a150505050505050505050565b600081848411156112ab5760405162461bcd60e51b815260040161038e9190611a05565b505050900390565b61045a846323b872dd60e01b8585856040516024016112d493929190611923565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261133d565b600082820183811015610e375760405162461bcd60e51b815260040161038e90611a88565b6000610b1a8260006113cc565b6060611392826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166114369092919063ffffffff16565b8051909150156107f957808060200190518101906113b09190611765565b6107f95760405162461bcd60e51b815260040161038e90611d06565b6000818351116113de57506000610b1a565b60006113ea848461144d565b90506113fb848285016001016113cc565b611406858584611492565b6040516020016114179291906118cb565b6040516020818303038152906040528051906020012091505092915050565b606061144584846000856114ae565b949350505050565b6000805b8351818401141580156114855750838184018151811061146d57fe5b6020910101516001600160f81b031916601760f91b14155b15610e3757600101611451565b6000835182840111156114a457600080fd5b5091016020012090565b60606114b985611572565b6114d55760405162461bcd60e51b815260040161038e90611c4c565b60006060866001600160a01b031685876040516114f291906118d9565b60006040518083038185875af1925050503d806000811461152f576040519150601f19603f3d011682016040523d82523d6000602084013e611534565b606091505b509150915081156115485791506114459050565b8051156115585780518082602001fd5b8360405162461bcd60e51b815260040161038e9190611a05565b3b151590565b60008083601f840112611589578182fd5b50813567ffffffffffffffff8111156115a0578182fd5b60208301915083602080830285010111156115ba57600080fd5b9250929050565b60008083601f8401126115d2578182fd5b50813567ffffffffffffffff8111156115e9578182fd5b6020830191508360208285010111156115ba57600080fd5b803560ff81168114610b1a57600080fd5b600060208284031215611623578081fd5b8135610e3781611dc8565b60006020828403121561163f578081fd5b8151610e3781611dc8565b6000806040838503121561165c578081fd5b823561166781611dc8565b9150602083013561167781611dc8565b809150509250929050565b600080600060608486031215611696578081fd5b83356116a181611dc8565b925060208401356116b181611dc8565b915060408401356116c181611dc8565b809150509250925092565b600080604083850312156116de578182fd5b82356116e981611dc8565b946020939093013593505050565b600080600080600080600060e0888a031215611711578283fd5b873561171c81611dc8565b965060208801359550604088013561173381611dc8565b9450606088013593506117498960808a01611601565b925060a0880135915060c0880135905092959891949750929550565b600060208284031215611776578081fd5b81518015158114610e37578182fd5b60008060008060006060868803121561179c578081fd5b853567ffffffffffffffff808211156117b3578283fd5b6117bf89838a016115c1565b90975095506020880135945060408801359150808211156117de578283fd5b506117eb88828901611578565b969995985093965092949392505050565b6000806000806000806000806000806101008b8d03121561181b578283fd5b8a3567ffffffffffffffff80821115611832578485fd5b61183e8e838f016115c1565b909c509a5060208d0135995060408d013591508082111561185d578485fd5b5061186a8d828e01611578565b90985096505060608b013561187e81611dc8565b945060808b013593506118948c60a08d01611601565b925060c08b0135915060e08b013590509295989b9194979a5092959850565b6000602082840312156118c4578081fd5b5035919050565b918252602082015260400190565b600082516118eb818460208701611d9c565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b90815260200190565b600086825260806020830152846080830152848660a084013760a08583018101919091526001600160a01b039390931660408201526060810191909152601f909201601f19169091010192915050565b6000602082528251806020840152611a24816040850160208701611d9c565b601f01601f19169190910160400192915050565b6020808252601290820152717265676973746572656420616c726561647960701b604082015260600190565b6020808252600a90820152696f6e6c792070726f787960b01b604082015260600190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252600b908201526a085c9959da5cdd195c995960aa1b604082015260600190565b6020808252600f908201526e6f6e6c7920676f7665726e616e636560881b604082015260600190565b60208082526016908201527563616e277420737465616c20616e206164647265737360501b604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526016908201527531b0b73a103ab73932b3b4b9ba32b91036b0b9ba32b960511b604082015260600190565b60208082526013908201527231b0b73a103932b3b4b9ba32b91030b3b0b4b760691b604082015260600190565b60208082526013908201527227b7363c9031bab9ba37b6903932b630bcb2b960691b604082015260600190565b6020808252601a908201527f6f6e6c7920756e7772617070656420656e7320646f6d61696e73000000000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252600c908201526b37b7363c903932b630bcb2b960a11b604082015260600190565b60208082526015908201527437b7363c9032b739903237b6b0b4b71037bbb732b960591b604082015260600190565b60208082526014908201527337b7363c9037bbb732b91037b3103bb7b935b2b960611b604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252600a9082015269216d696e5f7374616b6560b01b604082015260600190565b6020808252600e908201526d36bab9ba1031329036b0b9ba32b960911b604082015260600190565b60005b83811015611db7578181015183820152602001611d9f565b8381111561045a5750506000910152565b6001600160a01b0381168114611ddd57600080fd5b5056fea26469706673582212206f4cc4f67dba9ba55aab193d3511cc31e3b32c37cef7bd7df74b3ebff2b3ca5b64736f6c634300060c0033"; +const isSuperArgs$F = (xs) => xs.length > 1; +class RelayerRegistry__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$F(args)) { + super(...args); + } else { + super(_abi$13, _bytecode$F, args[0]); + } + } + getDeployTransaction(_torn, _governance, _ens, _staking, _feeManager, overrides) { + return super.getDeployTransaction( + _torn, + _governance, + _ens, + _staking, + _feeManager, + overrides || {} + ); + } + deploy(_torn, _governance, _ens, _staking, _feeManager, overrides) { + return super.deploy( + _torn, + _governance, + _ens, + _staking, + _feeManager, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$F; + static abi = _abi$13; + static createInterface() { + return new interface_Interface(_abi$13); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$13, runner); + } +} + +var index$w = /*#__PURE__*/Object.freeze({ + __proto__: null, + IENS__factory: IENS__factory, + IFeeManager__factory: IFeeManager__factory, + RelayerRegistry__factory: RelayerRegistry__factory +}); + +const _abi$12 = [ + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "resolver", + outputs: [ + { + internalType: "contract Resolver", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +class ENS__factory { + static abi = _abi$12; + static createInterface() { + return new interface_Interface(_abi$12); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$12, runner); + } +} + +const _abi$11 = [ + { + inputs: [ + { + internalType: "bytes32[]", + name: "domains", + type: "bytes32[]" + } + ], + name: "bulkResolve", + outputs: [ + { + internalType: "address[]", + name: "result", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "resolve", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$E = "0x608060405234801561001057600080fd5b5061036d806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80635c23bdf51461003b578063f9e5423414610074575b600080fd5b6100586004803603602081101561005157600080fd5b5035610167565b604080516001600160a01b039092168252519081900360200190f35b6101176004803603602081101561008a57600080fd5b8101906020810181356401000000008111156100a557600080fd5b8201836020820111156100b757600080fd5b803590602001918460208302840111640100000000831117156100d957600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610292945050505050565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561015357818101518382015260200161013b565b505050509050019250505060405180910390f35b600080610172610333565b60011461019357738595bfb0d940dfedc98943fa8a907091203f25ee6101a4565b6e0c2e074ec69a0dfb2997ba6c7d2e1e5b9050806001600160a01b0316630178b8bf846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156101ea57600080fd5b505afa1580156101fe573d6000803e3d6000fd5b505050506040513d602081101561021457600080fd5b505160408051631d9dabef60e11b81526004810186905290516001600160a01b0390921691633b3b57de91602480820192602092909190829003018186803b15801561025f57600080fd5b505afa158015610273573d6000803e3d6000fd5b505050506040513d602081101561028957600080fd5b50519392505050565b6060815167ffffffffffffffff811180156102ac57600080fd5b506040519080825280602002602001820160405280156102d6578160200160208202803683370190505b50905060005b825181101561032d576103018382815181106102f457fe5b6020026020010151610167565b82828151811061030d57fe5b6001600160a01b03909216602092830291909101909101526001016102dc565b50919050565b469056fea26469706673582212201849a5e31df8347ec61f3d54e8cef603101becea24443df7d4e43cc42ff12a7564736f6c634300060c0033"; +const isSuperArgs$E = (xs) => xs.length > 1; +class EnsResolve__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$E(args)) { + super(...args); + } else { + super(_abi$11, _bytecode$E, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$E; + static abi = _abi$11; + static createInterface() { + return new interface_Interface(_abi$11); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$11, runner); + } +} + +const _abi$10 = [ + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "addr", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +class Resolver__factory { + static abi = _abi$10; + static createInterface() { + return new interface_Interface(_abi$10); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$10, runner); + } +} + +var index$v = /*#__PURE__*/Object.freeze({ + __proto__: null, + ENS__factory: ENS__factory, + EnsResolve__factory: EnsResolve__factory, + Resolver__factory: Resolver__factory +}); + +const _abi$$ = [ + { + inputs: [ + { + internalType: "bytes32", + name: "tokenAddress", + type: "bytes32" + }, + { + components: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + internalType: "struct Airdrop.Recipient[]", + name: "targets", + type: "tuple[]" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "domains", + type: "bytes32[]" + } + ], + name: "bulkResolve", + outputs: [ + { + internalType: "address[]", + name: "result", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "addr", + type: "bytes32" + } + ], + name: "resolve", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$D = "0x608060405234801561001057600080fd5b5060405161039938038061039983398101604081905261002f91610220565b8181600061003c836101aa565b90506000816001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161006c91906102e4565b60206040518083038186803b15801561008457600080fd5b505afa158015610098573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100bc91906102cc565b116100e25760405162461bcd60e51b81526004016100d990610311565b60405180910390fd5b60005b82518110156101a557816001600160a01b031663a9059cbb84838151811061010957fe5b60200260200101516000015185848151811061012157fe5b6020026020010151602001516040518363ffffffff1660e01b815260040161014a9291906102f8565b602060405180830381600087803b15801561016457600080fd5b505af1158015610178573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019c91906101f9565b506001016100e5565b506000ff5b60601c90565b6000604082840312156101c1578081fd5b6101cb6040610353565b82519091506001600160a01b03811681146101e557600080fd5b808252506020820151602082015292915050565b60006020828403121561020a578081fd5b81518015158114610219578182fd5b9392505050565b6000806040808486031215610233578182fd5b8351602080860151919450906001600160401b03811115610252578384fd5b8501601f81018713610262578384fd5b805161027561027082610379565b610353565b81815283810190838501868402850186018b1015610291578788fd5b8794505b838510156102bb576102a78b826101b0565b835260019490940193918501918601610295565b508096505050505050509250929050565b6000602082840312156102dd578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b60208082526022908201527f42616c616e636520697320302c2061697264726f7020616c726561647920646f6040820152616e6560f01b606082015260800190565b6040518181016001600160401b038111828210171561037157600080fd5b604052919050565b60006001600160401b0382111561038e578081fd5b506020908102019056fe"; +const isSuperArgs$D = (xs) => xs.length > 1; +class AirdropMock__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$D(args)) { + super(...args); + } else { + super(_abi$$, _bytecode$D, args[0]); + } + } + getDeployTransaction(tokenAddress, targets, overrides) { + return super.getDeployTransaction(tokenAddress, targets, overrides || {}); + } + deploy(tokenAddress, targets, overrides) { + return super.deploy(tokenAddress, targets, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$D; + static abi = _abi$$; + static createInterface() { + return new interface_Interface(_abi$$); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$$, runner); + } +} + +const _abi$_ = [ + { + inputs: [ + { + internalType: "bytes32", + name: "_node", + type: "bytes32" + } + ], + name: "addr", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes[]", + name: "data", + type: "bytes[]" + } + ], + name: "multicall", + outputs: [ + { + internalType: "bytes[]", + name: "results", + type: "bytes[]" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "registry", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "resolver", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_node", + type: "bytes32" + }, + { + internalType: "address", + name: "_addr", + type: "address" + } + ], + name: "setAddr", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$C = "0x608060405234801561001057600080fd5b5061044b806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80630178b8bf1461005c5780633b3b57de146100855780637ef5029814610098578063ac9650d8146100ab578063d5fa2b00146100cb575b600080fd5b61006f61006a3660046102bc565b6100e0565b60405161007c919061031e565b60405180910390f35b61006f6100933660046102bc565b6100e5565b61006f6100a63660046102bc565b610100565b6100be6100b936600461024d565b61011b565b60405161007c9190610332565b6100de6100d93660046102d4565b61021f565b005b503090565b6000908152602081905260409020546001600160a01b031690565b6000602081905290815260409020546001600160a01b031681565b60608167ffffffffffffffff8111801561013457600080fd5b5060405190808252806020026020018201604052801561016857816020015b60608152602001906001900390816101535790505b50905060005b8281101561021857600060603086868581811061018757fe5b905060200281019061019991906103c9565b6040516101a792919061030e565b600060405180830381855af49150503d80600081146101e2576040519150601f19603f3d011682016040523d82523d6000602084013e6101e7565b606091505b5091509150816101f657600080fd5b8084848151811061020357fe5b6020908102919091010152505060010161016e565b5092915050565b60009182526020829052604090912080546001600160a01b0319166001600160a01b03909216919091179055565b6000806020838503121561025f578182fd5b823567ffffffffffffffff80821115610276578384fd5b818501915085601f830112610289578384fd5b813581811115610297578485fd5b86602080830285010111156102aa578485fd5b60209290920196919550909350505050565b6000602082840312156102cd578081fd5b5035919050565b600080604083850312156102e6578182fd5b8235915060208301356001600160a01b0381168114610303578182fd5b809150509250929050565b6000828483379101908152919050565b6001600160a01b0391909116815260200190565b6000602080830181845280855180835260408601915060408482028701019250838701855b828110156103bc57878503603f1901845281518051808752885b8181101561038c578281018901518882018a01528801610371565b8181111561039c578989838a0101525b50601f01601f191695909501860194509285019290850190600101610357565b5092979650505050505050565b6000808335601e198436030181126103df578283fd5b83018035915067ffffffffffffffff8211156103f9578283fd5b60200191503681900382131561040e57600080fd5b925092905056fea26469706673582212202e44de42b72aec6265acc191876b290bc887c846ffca216ac5d28a16fd49092564736f6c634300060c0033"; +const isSuperArgs$C = (xs) => xs.length > 1; +class ENSMock__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$C(args)) { + super(...args); + } else { + super(_abi$_, _bytecode$C, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$C; + static abi = _abi$_; + static createInterface() { + return new interface_Interface(_abi$_); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$_, runner); + } +} + +const _abi$Z = [ + { + inputs: [ + { + internalType: "address", + name: "_governance", + type: "address" + }, + { + internalType: "uint256", + name: "_pausePeriod", + type: "uint256" + }, + { + components: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + internalType: "struct TORN.Recipient[]", + name: "_vesting", + type: "tuple[]" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + } + ], + name: "Allowed", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + } + ], + name: "Disallowed", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address" + } + ], + name: "Paused", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address" + } + ], + name: "Unpaused", + type: "event" + }, + { + inputs: [ + { + internalType: "address[]", + name: "target", + type: "address[]" + } + ], + name: "addToAllowedList", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "allowedTransferee", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "blockTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "burn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "burnFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "canUnpauseAfter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "chainID", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "chainId", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bool", + name: "decision", + type: "bool" + } + ], + name: "changeTransferability", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "subtractedValue", + type: "uint256" + } + ], + name: "decreaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "fakeTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "governance", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "addedValue", + type: "uint256" + } + ], + name: "increaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "nonces", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "paused", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "permit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "target", + type: "address[]" + } + ], + name: "removeFromAllowedList", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "_token", + type: "address" + }, + { + internalType: "address payable", + name: "_to", + type: "address" + }, + { + internalType: "uint256", + name: "_balance", + type: "uint256" + } + ], + name: "rescueTokens", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "_chainId", + type: "uint256" + } + ], + name: "setChainId", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "_fakeTimestamp", + type: "uint256" + } + ], + name: "setFakeTimestamp", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$B = "0x60c06040523480156200001157600080fd5b506040516200298e3803806200298e8339810160408190526200003491620006d6565b604080518082018252600b81526a0a8dee4dcc2c8de86c2e6d60ab1b6020808301918252835180850190945260048452632a27a92760e11b90840152815186938693869390926200008891600391620005e4565b5080516200009e906004906020840190620005e4565b50506005805460ff1916601217905550620000b8620001f8565b506008805460ff199081169091556001600160601b0319606085901b1660a0526001600160a01b0384166000908152600960205260408120805490921660011790915583905b82518110156200017b5760008382815181106200011757fe5b60200260200101516000015190506200014f818584815181106200013757fe5b602002602001015160200151620002b460201b60201c565b6001600160a01b03166000908152600960205260409020805460ff1916600190811790915501620000fe565b506200019f836200018b62000397565b620003b360201b62000d721790919060201c565b608052620001ac620003e4565b620001b66200045b565b6a084595161401484a00000014620001eb5760405162461bcd60e51b8152600401620001e290620008a8565b60405180910390fd5b5050505050505062000946565b6000806200020562000461565b905060007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6200023462000467565b805160209182012060408051808201825260018152603160f81b90840152516200028693927fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6918791309101620007be565b60408051601f1981840301815291815281516020928301206000948552600790925290922082905550905090565b6001600160a01b038216620002dd5760405162461bcd60e51b8152600401620001e290620008df565b620002eb6000838362000501565b6200030781600254620003b360201b62000d721790919060201c565b6002556001600160a01b038216600090815260208181526040909120546200033a91839062000d72620003b3821b17901c565b6001600160a01b0383166000818152602081905260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906200038b90859062000916565b60405180910390a35050565b6000620003ae620005bc60201b62000d9e1760201c565b905090565b600082820183811015620003db5760405162461bcd60e51b8152600401620001e290620007ea565b90505b92915050565b60085460ff16156200040a5760405162461bcd60e51b8152600401620001e2906200087e565b6008805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25862000442620005d7565b604051620004519190620007aa565b60405180910390a1565b60025490565b600b5490565b60038054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015620004f75780601f10620004cb57610100808354040283529160200191620004f7565b820191906000526020600020905b815481529060010190602001808311620004d957829003601f168201915b5050505050905090565b62000519838383620005b760201b620007421760201c565b62000523620005db565b15806200054857506001600160a01b03831660009081526009602052604090205460ff165b806200056c57506001600160a01b03821660009081526009602052604090205460ff165b6200058b5760405162461bcd60e51b8152600401620001e29062000858565b6001600160a01b038216301415620005b75760405162461bcd60e51b8152600401620001e29062000821565b505050565b6000600a54600014620005d257600a54620003ae565b504290565b3390565b60085460ff1690565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200062757805160ff191683800117855562000657565b8280016001018555821562000657579182015b82811115620006575782518255916020019190600101906200063a565b506200066592915062000669565b5090565b5b808211156200066557600081556001016200066a565b80516001600160a01b0381168114620003de57600080fd5b600060408284031215620006aa578081fd5b620006b660406200091f565b9050620006c4838362000680565b81526020820151602082015292915050565b600080600060608486031215620006eb578283fd5b620006f7858562000680565b9250602080850151925060408086015160018060401b03808211156200071b578485fd5b818801915088601f8301126200072f578485fd5b8151818111156200073e578586fd5b6200074d85868302016200091f565b8181528581019250838601858302850187018c10156200076b578788fd5b8794505b828510156200079957620007848c8262000698565b8452600194909401939286019285016200076f565b508096505050505050509250925092565b6001600160a01b0391909116815260200190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526017908201527f544f524e3a20696e76616c696420726563697069656e74000000000000000000604082015260600190565b6020808252600c908201526b1513d4938e881c185d5cd95960a21b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252601c908201527f544f524e3a20696e636f727265637420646973747269627574696f6e00000000604082015260600190565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b90815260200190565b6040518181016001600160401b03811182821017156200093e57600080fd5b604052919050565b60805160a05160601c612008620009866000398061056f52806106975280610764528061081d5280610a215250806107bc5280610d2052506120086000f3fe608060405234801561001057600080fd5b50600436106101cf5760003560e01c80637ecebe0011610104578063adb61832116100a2578063d505accf11610071578063d505accf1461038d578063dc0f0d12146103a0578063dd62ed3e146103a8578063ef0e2ff4146103bb576101cf565b8063adb6183214610357578063adc879e91461035f578063c565882714610367578063cea9d26f1461037a576101cf565b806395d89b41116100de57806395d89b41146103215780639a8a059214610329578063a457c2d714610331578063a9059cbb14610344576101cf565b80637ecebe00146102e857806381893c7c146102fb578063885ad0cf1461030e576101cf565b80633c8d76d1116101715780635c975abb1161014b5780635c975abb146102a75780635d4545a0146102af57806370a08231146102c257806379cc6790146102d5576101cf565b80633c8d76d11461026a57806342966c681461027f5780635aa6e67514610292576101cf565b806318160ddd116101ad57806318160ddd1461022757806323b872dd1461022f578063313ce567146102425780633950935114610257576101cf565b806301ec0fab146101d457806306fdde03146101f2578063095ea7b314610207575b600080fd5b6101dc6103ce565b6040516101e99190611e68565b60405180910390f35b6101fa6103d4565b6040516101e99190611943565b61021a610215366004611708565b61046b565b6040516101e991906118ba565b6101dc610489565b61021a61023d366004611653565b61048f565b61024a610516565b6040516101e99190611e71565b61021a610265366004611708565b61051f565b61027d610278366004611733565b61056d565b005b61027d61028d36600461181c565b610681565b61029a610695565b6040516101e9919061188d565b61021a6106b9565b61021a6102bd3660046115ff565b6106c2565b6101dc6102d03660046115ff565b6106d7565b61027d6102e3366004611708565b6106f2565b6101dc6102f63660046115ff565b610747565b61027d6103093660046117d0565b610762565b61027d61031c366004611733565b61081b565b6101fa610922565b6101dc610983565b61021a61033f366004611708565b610989565b61021a610352366004611708565b6109f1565b6101dc610a05565b6101dc610a14565b61027d61037536600461181c565b610a1a565b61027d610388366004611808565b610a1f565b61027d61039b366004611693565b610bdd565b6101dc610d1e565b6101dc6103b636600461161b565b610d42565b61027d6103c936600461181c565b610d6d565b600a5481565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104605780601f1061043557610100808354040283529160200191610460565b820191906000526020600020905b81548152906001019060200180831161044357829003601f168201915b505050505090505b90565b600061047f610478610db7565b8484610dbb565b5060015b92915050565b60025490565b600061049c848484610e6f565b61050c846104a8610db7565b61050785604051806060016040528060288152602001611f62602891396001600160a01b038a166000908152600160205260408120906104e6610db7565b6001600160a01b031681526020810191909152604001600020549190610f84565b610dbb565b5060019392505050565b60055460ff1690565b600061047f61052c610db7565b84610507856001600061053d610db7565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610d72565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661059f610db7565b6001600160a01b0316146105ce5760405162461bcd60e51b81526004016105c590611de4565b60405180910390fd5b60005b815181101561067d576000600960008484815181106105ec57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055507f9ef90a89b00db1a1891a357dc96b2a273add9d883e378c350d22bad87a9d7d3082828151811061065857fe5b602002602001015160405161066d919061188d565b60405180910390a16001016105d1565b5050565b61069261068c610db7565b82610fb0565b50565b7f000000000000000000000000000000000000000000000000000000000000000081565b60085460ff1690565b60096020526000908152604090205460ff1681565b6001600160a01b031660009081526020819052604090205490565b600061072482604051806060016040528060248152602001611f8a6024913961071d866103b6610db7565b9190610f84565b905061073883610732610db7565b83610dbb565b6107428383610fb0565b505050565b6001600160a01b031660009081526006602052604090205490565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610794610db7565b6001600160a01b0316146107ba5760405162461bcd60e51b81526004016105c590611de4565b7f00000000000000000000000000000000000000000000000000000000000000006107e3610a05565b116108005760405162461bcd60e51b81526004016105c590611bd9565b80156108135761080e611092565b610692565b6106926110fe565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661084d610db7565b6001600160a01b0316146108735760405162461bcd60e51b81526004016105c590611de4565b60005b815181101561067d5760016009600084848151811061089157fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055507f77a7dbc6ad97703ad411a8d5edfcd1df382fb34b076a90898b11884f7ebdcc058282815181106108fd57fe5b6020026020010151604051610912919061188d565b60405180910390a1600101610876565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104605780601f1061043557610100808354040283529160200191610460565b600b5481565b600061047f610996610db7565b8461050785604051806060016040528060258152602001611fae60259139600160006109c0610db7565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610f84565b600061047f6109fe610db7565b8484610e6f565b6000610a0f610d9e565b905090565b600b5490565b600a55565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610a51610db7565b6001600160a01b031614610a775760405162461bcd60e51b81526004016105c590611de4565b6001600160a01b038216610a9d5760405162461bcd60e51b81526004016105c590611d58565b6001600160a01b038316610b06574760008215610ac357610abe8284611157565b610ac5565b815b6040519091506001600160a01b0385169082156108fc029083906000818181858888f19350505050158015610afe573d6000803e3d6000fd5b505050610742565b6040516370a0823160e01b81526000906001600160a01b038516906370a0823190610b3590309060040161188d565b60206040518083038186803b158015610b4d57600080fd5b505afa158015610b61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b859190611834565b905060008215610b9e57610b998284611157565b610ba0565b815b905060008111610bc25760405162461bcd60e51b81526004016105c590611e31565b610bd66001600160a01b038616858361116d565b5050505050565b83610be6610a05565b1115610c045760405162461bcd60e51b81526004016105c590611ace565b6001600160a01b0387166000908152600660209081526040808320549051610c57927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9928c928c928c92918c91016118c5565b6040516020818303038152906040528051906020012090506000611901610c7c6111c3565b83604051602001610c8f93929190611868565b6040516020818303038152906040528051906020012090506000610cb582878787611202565b9050896001600160a01b0316816001600160a01b031614610ce85760405162461bcd60e51b81526004016105c590611c20565b6001600160a01b038a16600090815260066020526040902080546001019055610d128a8a8a610dbb565b50505050505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b600b55565b600082820183811015610d975760405162461bcd60e51b81526004016105c590611a60565b9392505050565b6000600a54600014610db257600a54610a0f565b504290565b3390565b6001600160a01b038316610de15760405162461bcd60e51b81526004016105c590611cdd565b6001600160a01b038216610e075760405162461bcd60e51b81526004016105c590611a1e565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610e62908590611e68565b60405180910390a3505050565b6001600160a01b038316610e955760405162461bcd60e51b81526004016105c590611c98565b6001600160a01b038216610ebb5760405162461bcd60e51b81526004016105c5906119ad565b610ec68383836112fa565b610f0381604051806060016040528060268152602001611f3c602691396001600160a01b0386166000908152602081905260409020549190610f84565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610f329082610d72565b6001600160a01b0380841660008181526020819052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610e62908590611e68565b60008184841115610fa85760405162461bcd60e51b81526004016105c59190611943565b505050900390565b6001600160a01b038216610fd65760405162461bcd60e51b81526004016105c590611c57565b610fe2826000836112fa565b61101f81604051806060016040528060228152602001611f1a602291396001600160a01b0385166000908152602081905260409020549190610f84565b6001600160a01b0383166000908152602081905260409020556002546110459082611399565b6002556040516000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611086908590611e68565b60405180910390a35050565b60085460ff166110b45760405162461bcd60e51b81526004016105c5906119f0565b6008805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6110e7610db7565b6040516110f4919061188d565b60405180910390a1565b60085460ff16156111215760405162461bcd60e51b81526004016105c590611b6d565b6008805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586110e7610db7565b60008183106111665781610d97565b5090919050565b6107428363a9059cbb60e01b848460405160240161118c9291906118a1565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526113db565b600080600760006111d2610a14565b8152602081019190915260400160002054905080156111f2579050610468565b6111fa61146a565b915050610468565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08211156112445760405162461bcd60e51b81526004016105c590611b2b565b8360ff16601b148061125957508360ff16601c145b6112755760405162461bcd60e51b81526004016105c590611b97565b60006001868686866040516000815260200160405260405161129a9493929190611925565b6020604051602081039080840390855afa1580156112bc573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166112ef5760405162461bcd60e51b81526004016105c590611976565b90505b949350505050565b611305838383610742565b61130d6106b9565b158061133157506001600160a01b03831660009081526009602052604090205460ff165b8061135457506001600160a01b03821660009081526009602052604090205460ff165b6113705760405162461bcd60e51b81526004016105c590611b05565b6001600160a01b0382163014156107425760405162461bcd60e51b81526004016105c590611a97565b6000610d9783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f84565b6060611430826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166115209092919063ffffffff16565b805190915015610742578080602001905181019061144e91906117ec565b6107425760405162461bcd60e51b81526004016105c590611d9a565b600080611475610a14565b905060007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6114a26103d4565b805160209182012060408051808201825260018152603160f81b90840152516114f293927fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc69187913091016118f9565b60408051601f1981840301815291815281516020928301206000948552600790925290922082905550905090565b60606112f284846000856060611535856115ee565b6115515760405162461bcd60e51b81526004016105c590611d21565b60006060866001600160a01b0316858760405161156e919061184c565b60006040518083038185875af1925050503d80600081146115ab576040519150601f19603f3d011682016040523d82523d6000602084013e6115b0565b606091505b509150915081156115c45791506112f29050565b8051156115d45780518082602001fd5b8360405162461bcd60e51b81526004016105c59190611943565b3b151590565b803561048381611ef6565b600060208284031215611610578081fd5b8135610d9781611ef6565b6000806040838503121561162d578081fd5b823561163881611ef6565b9150602083013561164881611ef6565b809150509250929050565b600080600060608486031215611667578081fd5b833561167281611ef6565b9250602084013561168281611ef6565b929592945050506040919091013590565b600080600080600080600060e0888a0312156116ad578283fd5b87356116b881611ef6565b965060208801356116c881611ef6565b95506040880135945060608801359350608088013560ff811681146116eb578384fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561171a578182fd5b823561172581611ef6565b946020939093013593505050565b60006020808385031215611745578182fd5b823567ffffffffffffffff81111561175b578283fd5b8301601f8101851361176b578283fd5b803561177e61177982611ea6565b611e7f565b818152838101908385018584028501860189101561179a578687fd5b8694505b838510156117c4576117b089826115f4565b83526001949094019391850191850161179e565b50979650505050505050565b6000602082840312156117e1578081fd5b8135610d9781611f0b565b6000602082840312156117fd578081fd5b8151610d9781611f0b565b600080600060608486031215611667578283fd5b60006020828403121561182d578081fd5b5035919050565b600060208284031215611845578081fd5b5051919050565b6000825161185e818460208701611ec6565b9190910192915050565b60f09390931b6001600160f01b03191683526002830191909152602282015260420190565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b9586526001600160a01b0394851660208701529290931660408501526060840152608083019190915260a082015260c00190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b93845260ff9290921660208401526040830152606082015260800190565b6000602082528251806020840152611962816040850160208701611ec6565b601f01601f19169190910160400192915050565b60208082526018908201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604082015260600190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526014908201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604082015260600190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526017908201527f544f524e3a20696e76616c696420726563697069656e74000000000000000000604082015260600190565b6020808252601d908201527f45524332305065726d69743a206578706972656420646561646c696e65000000604082015260600190565b6020808252600c908201526b1513d4938e881c185d5cd95960a21b604082015260600190565b60208082526022908201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604082015261756560f01b606082015260800190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526022908201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604082015261756560f01b606082015260800190565b60208082526027908201527f544f524e3a2063616e6e6f74206368616e6765207472616e736665726162696c6040820152661a5d1e481e595d60ca1b606082015260800190565b6020808252601e908201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604082015260600190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526022908201527f544f524e3a2063616e206e6f742073656e6420746f207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252602d908201527f544f524e3a206f6e6c7920676f7665726e616e63652063616e20706572666f7260408201526c36903a3434b99030b1ba34b7b760991b606082015260800190565b6020808252601e908201527f544f524e3a20747279696e6720746f2073656e6420302062616c616e63650000604082015260600190565b90815260200190565b60ff91909116815260200190565b60405181810167ffffffffffffffff81118282101715611e9e57600080fd5b604052919050565b600067ffffffffffffffff821115611ebc578081fd5b5060209081020190565b60005b83811015611ee1578181015183820152602001611ec9565b83811115611ef0576000848401525b50505050565b6001600160a01b038116811461069257600080fd5b801515811461069257600080fdfe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e20616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220c25cb2cef98080abbebec9b5719a4f46d638fbe559a3ab7a9de64272855c3c1064736f6c634300060c0033"; +const isSuperArgs$B = (xs) => xs.length > 1; +class TORNMock__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$B(args)) { + super(...args); + } else { + super(_abi$Z, _bytecode$B, args[0]); + } + } + getDeployTransaction(_governance, _pausePeriod, _vesting, overrides) { + return super.getDeployTransaction( + _governance, + _pausePeriod, + _vesting, + overrides || {} + ); + } + deploy(_governance, _pausePeriod, _vesting, overrides) { + return super.deploy( + _governance, + _pausePeriod, + _vesting, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$B; + static abi = _abi$Z; + static createInterface() { + return new interface_Interface(_abi$Z); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$Z, runner); + } +} + +const _abi$Y = [ + { + inputs: [], + name: "blockTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "fakeTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "_fakeTimestamp", + type: "uint256" + } + ], + name: "setFakeTimestamp", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$A = "0x608060405234801561001057600080fd5b5060d28061001f6000396000f3fe6080604052348015600f57600080fd5b5060043610603c5760003560e01c806301ec0fab146041578063adb61832146059578063c565882714605f575b600080fd5b6047607b565b60408051918252519081900360200190f35b60476081565b607960048036036020811015607357600080fd5b50356097565b005b60005481565b60008054156090576000546092565b425b905090565b60005556fea2646970667358221220b2410460a5b24aec9983bcf8349aa3b589a0dff9120af5b704feae536a65813064736f6c634300060c0033"; +const isSuperArgs$A = (xs) => xs.length > 1; +class Timestamp__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$A(args)) { + super(...args); + } else { + super(_abi$Y, _bytecode$A, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$A; + static abi = _abi$Y; + static createInterface() { + return new interface_Interface(_abi$Y); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$Y, runner); + } +} + +const _abi$X = [ + { + inputs: [ + { + internalType: "address", + name: "_token", + type: "address" + }, + { + internalType: "address", + name: "_beneficiary", + type: "address" + }, + { + internalType: "uint256", + name: "_startTimestamp", + type: "uint256" + }, + { + internalType: "uint256", + name: "_cliffInMonths", + type: "uint256" + }, + { + internalType: "uint256", + name: "_durationInMonths", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "Released", + type: "event" + }, + { + inputs: [], + name: "SECONDS_PER_MONTH", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "beneficiary", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "blockTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "cliffInMonths", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "durationInMonths", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "fakeTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "release", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "released", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "_fakeTimestamp", + type: "uint256" + } + ], + name: "setFakeTimestamp", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "startTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "token", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "vestedAmount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$z = "0x61012060405234801561001157600080fd5b50604051610d2e380380610d2e833981810160405260a081101561003457600080fd5b5080516020820151604083015160608401516080909401519293919290919084848484846001600160a01b0384166100b3576040805162461bcd60e51b815260206004820152601b60248201527f42656e65666963696172792063616e6e6f7420626520656d7074790000000000604482015290519081900360640190fd5b80821115610108576040805162461bcd60e51b815260206004820152601e60248201527f436c6966662069732067726561746572207468616e206475726174696f6e0000604482015290519081900360640190fd5b6001600160601b0319606086811b821660a05285901b1660805261010081905260c082905282156101395782610141565b610141610154565b60e0525061018698505050505050505050565b600061016861016d60201b6105b81760201c565b905090565b600060015460001461018157600154610168565b504290565b60805160601c60a05160601c60c05160e05161010051610b366101f86000398061024452806103bc528061041e52508061019352806101cf52806105725250806102115280610534525080610289528061030952806104b5528061059652508061016d52806104d75250610b366000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c8063928d89ae11610071578063928d89ae146101195780639613252114610121578063adb6183214610129578063c565882714610131578063e6fd48bc1461014e578063fc0c546a14610156576100b4565b806301ec0fab146100b957806310786deb146100d357806338af3eed146100db57806344b1231f146100ff57806367097a4b1461010757806386d1a69f1461010f575b600080fd5b6100c161015e565b60408051918252519081900360200190f35b6100c1610164565b6100e361016b565b604080516001600160a01b039092168252519081900360200190f35b6100c161018f565b6100c161041c565b610117610440565b005b6100c1610532565b6100c1610556565b6100c161055c565b6101176004803603602081101561014757600080fd5b503561056b565b6100c1610570565b6100e3610594565b60015481565b62278d0081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60007f00000000000000000000000000000000000000000000000000000000000000006101ba61055c565b10156101c857506000610419565b60006101fc7f00000000000000000000000000000000000000000000000000000000000000006101f661055c565b906105d1565b9050600061020d8262278d0061061c565b90507f000000000000000000000000000000000000000000000000000000000000000081101561024257600092505050610419565b7f0000000000000000000000000000000000000000000000000000000000000000811061030557604080516370a0823160e01b815230600482015290516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916370a08231916024808301926020929190829003018186803b1580156102cf57600080fd5b505afa1580156102e3573d6000803e3d6000fd5b505050506040513d60208110156102f957600080fd5b50519250610419915050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561037457600080fd5b505afa158015610388573d6000803e3d6000fd5b505050506040513d602081101561039e57600080fd5b505160008054919250906103b390839061065e565b905060006103eb7f00000000000000000000000000000000000000000000000000000000000000006103e584876106b8565b9061061c565b90506000610404600054836105d190919063ffffffff16565b90506104108482610711565b96505050505050505b90565b7f000000000000000000000000000000000000000000000000000000000000000081565b600061044a61018f565b905060008111610498576040805162461bcd60e51b81526020600482015260146024820152734e6f20746f6b656e7320746f2072656c6561736560601b604482015290519081900360640190fd5b6000546104a5908261065e565b6000556104fc6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f000000000000000000000000000000000000000000000000000000000000000083610727565b6040805182815290517ffb81f9b30d73d830c3544b34d827c08142579ee75710b490bab0b3995468c5659181900360200190a150565b7f000000000000000000000000000000000000000000000000000000000000000081565b60005481565b60006105666105b8565b905090565b600155565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60006001546000146105cc57600154610566565b504290565b600061061383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061077e565b90505b92915050565b600061061383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610815565b600082820183811015610613576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000826106c757506000610616565b828202828482816106d457fe5b04146106135760405162461bcd60e51b8152600401808060200182810382526021815260200180610ab66021913960400191505060405180910390fd5b60008183106107205781610613565b5090919050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261077990849061087a565b505050565b6000818484111561080d5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156107d25781810151838201526020016107ba565b50505050905090810190601f1680156107ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836108645760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156107d25781810151838201526020016107ba565b50600083858161087057fe5b0495945050505050565b60606108cf826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661092b9092919063ffffffff16565b805190915015610779578080602001905160208110156108ee57600080fd5b50516107795760405162461bcd60e51b815260040180806020018281038252602a815260200180610ad7602a913960400191505060405180910390fd5b606061093a8484600085610942565b949350505050565b606061094d85610aaf565b61099e576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106109dd5780518252601f1990920191602091820191016109be565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610a3f576040519150601f19603f3d011682016040523d82523d6000602084013e610a44565b606091505b50915091508115610a5857915061093a9050565b805115610a685780518082602001fd5b60405162461bcd60e51b81526020600482018181528651602484015286518793919283926044019190850190808383600083156107d25781810151838201526020016107ba565b3b15159056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220852e02606e74d747094138d7e10fc9f005278a953559d85ca961b67f95c9fa8f64736f6c634300060c0033"; +const isSuperArgs$z = (xs) => xs.length > 1; +class VestingMock__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$z(args)) { + super(...args); + } else { + super(_abi$X, _bytecode$z, args[0]); + } + } + getDeployTransaction(_token, _beneficiary, _startTimestamp, _cliffInMonths, _durationInMonths, overrides) { + return super.getDeployTransaction( + _token, + _beneficiary, + _startTimestamp, + _cliffInMonths, + _durationInMonths, + overrides || {} + ); + } + deploy(_token, _beneficiary, _startTimestamp, _cliffInMonths, _durationInMonths, overrides) { + return super.deploy( + _token, + _beneficiary, + _startTimestamp, + _cliffInMonths, + _durationInMonths, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$z; + static abi = _abi$X; + static createInterface() { + return new interface_Interface(_abi$X); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$X, runner); + } +} + +const _abi$W = [ + { + inputs: [ + { + internalType: "bytes32", + name: "_torn", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_governance", + type: "bytes32" + }, + { + internalType: "uint256", + name: "_duration", + type: "uint256" + }, + { + components: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + internalType: "struct Voucher.Recipient[]", + name: "_airdrops", + type: "tuple[]" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "allowedTransferee", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "blockTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "domains", + type: "bytes32[]" + } + ], + name: "bulkResolve", + outputs: [ + { + internalType: "address[]", + name: "result", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "subtractedValue", + type: "uint256" + } + ], + name: "decreaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "expiresAt", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "fakeTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "governance", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "addedValue", + type: "uint256" + } + ], + name: "increaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "redeem", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "rescueExpiredTokens", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "addr", + type: "bytes32" + } + ], + name: "resolve", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "_fakeTimestamp", + type: "uint256" + } + ], + name: "setFakeTimestamp", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$y = "0x60e06040523480156200001157600080fd5b5060405162001b7838038062001b78833981016040819052620000349162000476565b8383838360405180606001604052806026815260200162001b5260269139604051806040016040528060058152602001643b2a27a92760d91b8152508160039080519060200190620000889291906200038d565b5080516200009e9060049060208401906200038d565b50506005805460ff1916601217905550620000b984620001b7565b60601b6001600160601b031916608052620000d483620001b7565b60601b6001600160601b03191660c0526200010782620000f3620001bd565b620001d960201b6200089d1790919060201c565b60a05260005b8151811015620001a857620001598282815181106200012857fe5b6020026020010151600001518383815181106200014157fe5b6020026020010151602001516200021160201b60201c565b6001600660008484815181106200016c57fe5b602090810291909101810151516001600160a01b03168252810191909152604001600020805460ff19169115159190911790556001016200010d565b5050505050505050506200061d565b60601c90565b6000620001d4620002f460201b620008c91760201c565b905090565b6000828201838110156200020a5760405162461bcd60e51b8152600401620002019062000548565b60405180910390fd5b9392505050565b6001600160a01b0382166200023a5760405162461bcd60e51b81526004016200020190620005b6565b62000248600083836200030f565b6200026481600254620001d960201b6200089d1790919060201c565b6002556001600160a01b03821660009081526020818152604090912054620002979183906200089d620001d9821b17901c565b6001600160a01b0383166000818152602081905260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90620002e8908590620005ed565b60405180910390a35050565b60006007546000146200030a57600754620001d4565b504290565b620003278383836200038860201b620008e21760201c565b6001600160a01b03821615806200034557506001600160a01b038316155b806200036957506001600160a01b03831660009081526006602052604090205460ff165b620003885760405162461bcd60e51b815260040162000201906200057f565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620003d057805160ff191683800117855562000400565b8280016001018555821562000400579182015b8281111562000400578251825591602001919060010190620003e3565b506200040e92915062000412565b5090565b5b808211156200040e576000815560010162000413565b6000604082840312156200043b578081fd5b620004476040620005f6565b82519091506001600160a01b03811681146200046257600080fd5b808252506020820151602082015292915050565b600080600080608085870312156200048c578384fd5b8451935060208086015193506040808701519350606087015160018060401b0380821115620004b9578485fd5b818901915089601f830112620004cd578485fd5b815181811115620004dc578586fd5b620004eb8586830201620005f6565b8181528581019250838601858302850187018d101562000509578788fd5b8794505b828510156200053757620005228d8262000429565b8452600194909401939286019285016200050d565b50989b979a50959850505050505050565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601e908201527f45524332303a207472616e73666572206973206e6f7420616c6c6f7765640000604082015260600190565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b90815260200190565b6040518181016001600160401b03811182821017156200061557600080fd5b604052919050565b60805160601c60a05160c05160601c6114e46200066e6000398061046952806106de5250806104c352806105f752806106945250806105d3528061066852806106ff52806107a352506114e46000f3fe608060405234801561001057600080fd5b50600436106101425760003560e01c80638622a689116100b8578063adf898a41161007c578063adf898a414610269578063be040fb014610271578063c39ef8551461027b578063c565882714610283578063dd62ed3e14610296578063f9e54234146102a957610142565b80638622a6891461022b57806395d89b4114610233578063a457c2d71461023b578063a9059cbb1461024e578063adb618321461026157610142565b8063313ce5671161010a578063313ce567146101b557806339509351146101ca5780635aa6e675146101dd5780635c23bdf5146101f25780635d4545a01461020557806370a082311461021857610142565b806301ec0fab1461014757806306fdde0314610165578063095ea7b31461017a57806318160ddd1461019a57806323b872dd146101a2575b600080fd5b61014f6102c9565b60405161015c9190611376565b60405180910390f35b61016d6102cf565b60405161015c9190611087565b61018d610188366004610ed7565b610365565b60405161015c919061107c565b61014f610383565b61018d6101b0366004610e97565b610389565b6101bd610410565b60405161015c919061137f565b61018d6101d8366004610ed7565b610419565b6101e5610467565b60405161015c9190611002565b6101e5610200366004610fb6565b61048b565b61018d610213366004610e48565b610491565b61014f610226366004610e48565b6104a6565b61014f6104c1565b61016d6104e5565b61018d610249366004610ed7565b610546565b61018d61025c366004610ed7565b6105ae565b61014f6105c2565b6101e56105d1565b6102796105f5565b005b610279610692565b610279610291366004610fb6565b6107cc565b61014f6102a4366004610e63565b6107d1565b6102bc6102b7366004610f01565b6107fc565b60405161015c919061102f565b60075481565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561035b5780601f106103305761010080835404028352916020019161035b565b820191906000526020600020905b81548152906001019060200180831161033e57829003601f168201915b5050505050905090565b60006103796103726108e7565b84846108eb565b5060015b92915050565b60025490565b600061039684848461099f565b610406846103a26108e7565b61040185604051806060016040528060288152602001611462602891396001600160a01b038a166000908152600160205260408120906103e06108e7565b6001600160a01b031681526020810191909152604001600020549190610ab4565b6108eb565b5060019392505050565b60055460ff1690565b60006103796104266108e7565b8461040185600160006104376108e7565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549061089d565b7f000000000000000000000000000000000000000000000000000000000000000081565b60601c90565b60066020526000908152604090205460ff1681565b6001600160a01b031660009081526020819052604090205490565b7f000000000000000000000000000000000000000000000000000000000000000081565b60048054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561035b5780601f106103305761010080835404028352916020019161035b565b60006103796105536108e7565b846104018560405180606001604052806025815260200161148a602591396001600061057d6108e7565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610ab4565b60006103796105bb6108e7565b848461099f565b60006105cc6108c9565b905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000061061e6105c2565b106106445760405162461bcd60e51b815260040161063b90611176565b60405180910390fd5b600061064f336104a6565b905061065b3382610ae0565b61068f6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163383610bc2565b50565b7f00000000000000000000000000000000000000000000000000000000000000006106bb6105c2565b10156106d95760405162461bcd60e51b815260040161063b906111ad565b6107ca7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016107499190611002565b60206040518083038186803b15801561076157600080fd5b505afa158015610775573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107999190610fce565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169190610bc2565b565b600755565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060815167ffffffffffffffff8111801561081657600080fd5b50604051908082528060200260200182016040528015610840578160200160208202803683370190505b50905060005b82518110156108975761086b83828151811061085e57fe5b602002602001015161048b565b82828151811061087757fe5b6001600160a01b0390921660209283029190910190910152600101610846565b50919050565b6000828201838110156108c25760405162461bcd60e51b815260040161063b9061113f565b9392505050565b60006007546000146108dd576007546105cc565b504290565b505050565b3390565b6001600160a01b0383166109115760405162461bcd60e51b815260040161063b906112b1565b6001600160a01b0382166109375760405162461bcd60e51b815260040161063b906110fd565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610992908590611376565b60405180910390a3505050565b6001600160a01b0383166109c55760405162461bcd60e51b815260040161063b9061126c565b6001600160a01b0382166109eb5760405162461bcd60e51b815260040161063b906110ba565b6109f6838383610c18565b610a338160405180606001604052806026815260200161143c602691396001600160a01b0386166000908152602081905260409020549190610ab4565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610a62908261089d565b6001600160a01b0380841660008181526020819052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610992908590611376565b60008184841115610ad85760405162461bcd60e51b815260040161063b9190611087565b505050900390565b6001600160a01b038216610b065760405162461bcd60e51b815260040161063b9061122b565b610b1282600083610c18565b610b4f8160405180606001604052806022815260200161141a602291396001600160a01b0385166000908152602081905260409020549190610ab4565b6001600160a01b038316600090815260208190526040902055600254610b759082610c7f565b6002556040516000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610bb6908590611376565b60405180910390a35050565b6108e28363a9059cbb60e01b8484604051602401610be1929190611016565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610cc1565b610c238383836108e2565b6001600160a01b0382161580610c4057506001600160a01b038316155b80610c6357506001600160a01b03831660009081526006602052604090205460ff165b6108e25760405162461bcd60e51b815260040161063b906111f4565b60006108c283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ab4565b6060610d16826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610d509092919063ffffffff16565b8051909150156108e25780806020019051810190610d349190610f96565b6108e25760405162461bcd60e51b815260040161063b9061132c565b6060610d5f8484600085610d67565b949350505050565b6060610d7285610e2b565b610d8e5760405162461bcd60e51b815260040161063b906112f5565b60006060866001600160a01b03168587604051610dab9190610fe6565b60006040518083038185875af1925050503d8060008114610de8576040519150601f19603f3d011682016040523d82523d6000602084013e610ded565b606091505b50915091508115610e01579150610d5f9050565b805115610e115780518082602001fd5b8360405162461bcd60e51b815260040161063b9190611087565b3b151590565b80356001600160a01b038116811461037d57600080fd5b600060208284031215610e59578081fd5b6108c28383610e31565b60008060408385031215610e75578081fd5b610e7f8484610e31565b9150610e8e8460208501610e31565b90509250929050565b600080600060608486031215610eab578081fd5b8335610eb681611404565b92506020840135610ec681611404565b929592945050506040919091013590565b60008060408385031215610ee9578182fd5b610ef38484610e31565b946020939093013593505050565b60006020808385031215610f13578182fd5b823567ffffffffffffffff811115610f29578283fd5b8301601f81018513610f39578283fd5b8035610f4c610f47826113b4565b61138d565b8181528381019083850185840285018601891015610f68578687fd5b8694505b83851015610f8a578035835260019490940193918501918501610f6c565b50979650505050505050565b600060208284031215610fa7578081fd5b815180151581146108c2578182fd5b600060208284031215610fc7578081fd5b5035919050565b600060208284031215610fdf578081fd5b5051919050565b60008251610ff88184602087016113d4565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b818110156110705783516001600160a01b03168352928401929184019160010161104b565b50909695505050505050565b901515815260200190565b60006020825282518060208401526110a68160408501602087016113d4565b601f01601f19169190910160400192915050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601f908201527f41697264726f702072656465656d20706572696f642068617320656e64656400604082015260600190565b60208082526027908201527f41697264726f702072656465656d20706572696f6420686173206e6f7420656e604082015266191959081e595d60ca1b606082015260800190565b6020808252601e908201527f45524332303a207472616e73666572206973206e6f7420616c6c6f7765640000604082015260600190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b90815260200190565b60ff91909116815260200190565b60405181810167ffffffffffffffff811182821017156113ac57600080fd5b604052919050565b600067ffffffffffffffff8211156113ca578081fd5b5060209081020190565b60005b838110156113ef5781810151838201526020016113d7565b838111156113fe576000848401525b50505050565b6001600160a01b038116811461068f57600080fdfe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220794126baf4ea3c44b9afb84b4d8a20535aca899e75471e5d9bb4c8e671aabde664736f6c634300060c0033546f726e61646f4361736820766f756368657220666f72206561726c792061646f7074657273"; +const isSuperArgs$y = (xs) => xs.length > 1; +class VoucherMock__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$y(args)) { + super(...args); + } else { + super(_abi$W, _bytecode$y, args[0]); + } + } + getDeployTransaction(_torn, _governance, _duration, _airdrops, overrides) { + return super.getDeployTransaction( + _torn, + _governance, + _duration, + _airdrops, + overrides || {} + ); + } + deploy(_torn, _governance, _duration, _airdrops, overrides) { + return super.deploy( + _torn, + _governance, + _duration, + _airdrops, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$y; + static abi = _abi$W; + static createInterface() { + return new interface_Interface(_abi$W); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$W, runner); + } +} + +var index$u = /*#__PURE__*/Object.freeze({ + __proto__: null, + AirdropMock__factory: AirdropMock__factory, + ENSMock__factory: ENSMock__factory, + TORNMock__factory: TORNMock__factory, + Timestamp__factory: Timestamp__factory, + VestingMock__factory: VestingMock__factory, + VoucherMock__factory: VoucherMock__factory +}); + +const _abi$V = [ + { + inputs: [ + { + internalType: "bytes32", + name: "tokenAddress", + type: "bytes32" + }, + { + components: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + internalType: "struct Airdrop.Recipient[]", + name: "targets", + type: "tuple[]" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "domains", + type: "bytes32[]" + } + ], + name: "bulkResolve", + outputs: [ + { + internalType: "address[]", + name: "result", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "resolve", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$x = "0x60806040523480156200001157600080fd5b506040516200054038038062000540833981016040819052620000349162000396565b60006200004183620001c2565b90506000816001600160a01b03166370a08231306040518263ffffffff1660e01b815260040162000073919062000467565b60206040518083038186803b1580156200008c57600080fd5b505afa158015620000a1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000c791906200044e565b11620000f05760405162461bcd60e51b8152600401620000e7906200049d565b60405180910390fd5b60005b8251811015620001bd57816001600160a01b031663a9059cbb8483815181106200011957fe5b6020026020010151600001518584815181106200013257fe5b6020026020010151602001516040518363ffffffff1660e01b81526004016200015d9291906200047b565b602060405180830381600087803b1580156200017857600080fd5b505af11580156200018d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b3919062000374565b50600101620000f3565b506000ff5b600080620001cf62000310565b600114620001f257738595bfb0d940dfedc98943fa8a907091203f25ee62000203565b6e0c2e074ec69a0dfb2997ba6c7d2e1e5b604051630178b8bf60e01b81529091506001600160a01b03821690630178b8bf906200023490869060040162000494565b60206040518083038186803b1580156200024d57600080fd5b505afa15801562000262573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000288919062000355565b6001600160a01b0316633b3b57de846040518263ffffffff1660e01b8152600401620002b5919062000494565b60206040518083038186803b158015620002ce57600080fd5b505afa158015620002e3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000309919062000355565b9392505050565b4690565b60006040828403121562000326578081fd5b620003326040620004df565b90508151620003418162000526565b808252506020820151602082015292915050565b60006020828403121562000367578081fd5b8151620003098162000526565b60006020828403121562000386578081fd5b8151801515811462000309578182fd5b6000806040808486031215620003aa578182fd5b8351602080860151919450906001600160401b03811115620003ca578384fd5b8501601f81018713620003db578384fd5b8051620003f2620003ec8262000506565b620004df565b81815283810190838501868402850186018b10156200040f578788fd5b8794505b838510156200043d57620004288b8262000314565b83526001949094019391850191860162000413565b508096505050505050509250929050565b60006020828403121562000460578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b90815260200190565b60208082526022908201527f42616c616e636520697320302c2061697264726f7020616c726561647920646f6040820152616e6560f01b606082015260800190565b6040518181016001600160401b0381118282101715620004fe57600080fd5b604052919050565b60006001600160401b038211156200051c578081fd5b5060209081020190565b6001600160a01b03811681146200053c57600080fd5b5056fe"; +const isSuperArgs$x = (xs) => xs.length > 1; +class Airdrop__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$x(args)) { + super(...args); + } else { + super(_abi$V, _bytecode$x, args[0]); + } + } + getDeployTransaction(tokenAddress, targets, overrides) { + return super.getDeployTransaction(tokenAddress, targets, overrides || {}); + } + deploy(tokenAddress, targets, overrides) { + return super.deploy(tokenAddress, targets, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$x; + static abi = _abi$V; + static createInterface() { + return new interface_Interface(_abi$V); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$V, runner); + } +} + +const _abi$U = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "blockTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "chainID", + outputs: [ + { + internalType: "uint256", + name: "_chainID", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "subtractedValue", + type: "uint256" + } + ], + name: "decreaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "addedValue", + type: "uint256" + } + ], + name: "increaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "nonces", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "permit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +class ERC20Permit__factory { + static abi = _abi$U; + static createInterface() { + return new interface_Interface(_abi$U); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$U, runner); + } +} + +const _abi$T = [ + { + inputs: [ + { + internalType: "address", + name: "_governance", + type: "address" + }, + { + internalType: "uint256", + name: "_pausePeriod", + type: "uint256" + }, + { + components: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + internalType: "struct TORN.Recipient[]", + name: "_vestings", + type: "tuple[]" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + } + ], + name: "Allowed", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + } + ], + name: "Disallowed", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address" + } + ], + name: "Paused", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address" + } + ], + name: "Unpaused", + type: "event" + }, + { + inputs: [ + { + internalType: "address[]", + name: "target", + type: "address[]" + } + ], + name: "addToAllowedList", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "allowedTransferee", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "blockTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "burn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "burnFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "canUnpauseAfter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "chainID", + outputs: [ + { + internalType: "uint256", + name: "_chainID", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bool", + name: "decision", + type: "bool" + } + ], + name: "changeTransferability", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "subtractedValue", + type: "uint256" + } + ], + name: "decreaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "governance", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "addedValue", + type: "uint256" + } + ], + name: "increaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "nonces", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "paused", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "permit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "target", + type: "address[]" + } + ], + name: "removeFromAllowedList", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "_token", + type: "address" + }, + { + internalType: "address payable", + name: "_to", + type: "address" + }, + { + internalType: "uint256", + name: "_balance", + type: "uint256" + } + ], + name: "rescueTokens", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$w = "0x60c06040523480156200001157600080fd5b506040516200288338038062002883833981016040819052620000349162000699565b604080518082018252600b81526a0a8dee4dcc2c8de86c2e6d60ab1b6020808301918252835180850190945260048452632a27a92760e11b9084015281519192916200008391600391620005a7565b50805162000099906004906020840190620005a7565b50506005805460ff1916601217905550620000b3620001f0565b506008805460ff199081169091556001600160601b0319606085901b1660a0526001600160a01b0384166000908152600960205260408120805490921660011790915583905b8251811015620001765760008382815181106200011257fe5b60200260200101516000015190506200014a818584815181106200013257fe5b602002602001015160200151620002ac60201b60201c565b6001600160a01b03166000908152600960205260409020805460ff1916600190811790915501620000f9565b506200019a83620001866200038f565b6200039360201b62000cbd1790919060201c565b608052620001a7620003c4565b620001b16200043b565b6a084595161401484a00000014620001e65760405162461bcd60e51b8152600401620001dd906200086b565b60405180910390fd5b5050505062000909565b600080620001fd62000441565b905060007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6200022c62000445565b805160209182012060408051808201825260018152603160f81b90840152516200027e93927fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc691879130910162000781565b60408051601f1981840301815291815281516020928301206000948552600790925290922082905550905090565b6001600160a01b038216620002d55760405162461bcd60e51b8152600401620001dd90620008a2565b620002e360008383620004df565b620002ff816002546200039360201b62000cbd1790919060201c565b6002556001600160a01b038216600090815260208181526040909120546200033291839062000cbd62000393821b17901c565b6001600160a01b0383166000818152602081905260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9062000383908590620008d9565b60405180910390a35050565b4290565b600082820183811015620003bb5760405162461bcd60e51b8152600401620001dd90620007ad565b90505b92915050565b60085460ff1615620003ea5760405162461bcd60e51b8152600401620001dd9062000841565b6008805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258620004226200059a565b6040516200043191906200076d565b60405180910390a1565b60025490565b4690565b60038054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015620004d55780601f10620004a957610100808354040283529160200191620004d5565b820191906000526020600020905b815481529060010190602001808311620004b757829003601f168201915b5050505050905090565b620004f78383836200059560201b620006aa1760201c565b620005016200059e565b15806200052657506001600160a01b03831660009081526009602052604090205460ff165b806200054a57506001600160a01b03821660009081526009602052604090205460ff165b620005695760405162461bcd60e51b8152600401620001dd906200081b565b6001600160a01b038216301415620005955760405162461bcd60e51b8152600401620001dd90620007e4565b505050565b3390565b60085460ff1690565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620005ea57805160ff19168380011785556200061a565b828001600101855582156200061a579182015b828111156200061a578251825591602001919060010190620005fd565b50620006289291506200062c565b5090565b5b808211156200062857600081556001016200062d565b80516001600160a01b0381168114620003be57600080fd5b6000604082840312156200066d578081fd5b620006796040620008e2565b905062000687838362000643565b81526020820151602082015292915050565b600080600060608486031215620006ae578283fd5b620006ba858562000643565b9250602080850151925060408086015160018060401b0380821115620006de578485fd5b818801915088601f830112620006f2578485fd5b81518181111562000701578586fd5b620007108586830201620008e2565b8181528581019250838601858302850187018c10156200072e578788fd5b8794505b828510156200075c57620007478c826200065b565b84526001949094019392860192850162000732565b508096505050505050509250925092565b6001600160a01b0391909116815260200190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526017908201527f544f524e3a20696e76616c696420726563697069656e74000000000000000000604082015260600190565b6020808252600c908201526b1513d4938e881c185d5cd95960a21b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252601c908201527f544f524e3a20696e636f727265637420646973747269627574696f6e00000000604082015260600190565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b90815260200190565b6040518181016001600160401b03811182821017156200090157600080fd5b604052919050565b60805160a05160601c611f3a62000949600039806104d752806105ff52806106cc528061078552806109715250806107245280610c705250611f3a6000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c806379cc6790116100de578063a9059cbb11610097578063cea9d26f11610071578063cea9d26f146102fb578063d505accf1461030e578063dc0f0d1214610321578063dd62ed3e1461032957610173565b8063a9059cbb146102d8578063adb61832146102eb578063adc879e9146102f357610173565b806379cc6790146102715780637ecebe001461028457806381893c7c14610297578063885ad0cf146102aa57806395d89b41146102bd578063a457c2d7146102c557610173565b80633c8d76d1116101305780633c8d76d11461020657806342966c681461021b5780635aa6e6751461022e5780635c975abb146102435780635d4545a01461024b57806370a082311461025e57610173565b806306fdde0314610178578063095ea7b31461019657806318160ddd146101b657806323b872dd146101cb578063313ce567146101de57806339509351146101f3575b600080fd5b61018061033c565b60405161018d9190611875565b60405180910390f35b6101a96101a436600461163a565b6103d3565b60405161018d91906117ec565b6101be6103f1565b60405161018d9190611d9a565b6101a96101d9366004611585565b6103f7565b6101e661047e565b60405161018d9190611da3565b6101a961020136600461163a565b610487565b610219610214366004611665565b6104d5565b005b61021961022936600461174e565b6105e9565b6102366105fd565b60405161018d91906117bf565b6101a9610621565b6101a9610259366004611531565b61062a565b6101be61026c366004611531565b61063f565b61021961027f36600461163a565b61065a565b6101be610292366004611531565b6106af565b6102196102a5366004611702565b6106ca565b6102196102b8366004611665565b610783565b61018061088a565b6101a96102d336600461163a565b6108eb565b6101a96102e636600461163a565b610953565b6101be610967565b6101be61096b565b61021961030936600461173a565b61096f565b61021961031c3660046115c5565b610b2d565b6101be610c6e565b6101be61033736600461154d565b610c92565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103c85780601f1061039d576101008083540402835291602001916103c8565b820191906000526020600020905b8154815290600101906020018083116103ab57829003601f168201915b505050505090505b90565b60006103e76103e0610ce9565b8484610ced565b5060015b92915050565b60025490565b6000610404848484610da1565b61047484610410610ce9565b61046f85604051806060016040528060288152602001611e94602891396001600160a01b038a1660009081526001602052604081209061044e610ce9565b6001600160a01b031681526020810191909152604001600020549190610eb6565b610ced565b5060019392505050565b60055460ff1690565b60006103e7610494610ce9565b8461046f85600160006104a5610ce9565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610cbd565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610507610ce9565b6001600160a01b0316146105365760405162461bcd60e51b815260040161052d90611d16565b60405180910390fd5b60005b81518110156105e55760006009600084848151811061055457fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055507f9ef90a89b00db1a1891a357dc96b2a273add9d883e378c350d22bad87a9d7d308282815181106105c057fe5b60200260200101516040516105d591906117bf565b60405180910390a1600101610539565b5050565b6105fa6105f4610ce9565b82610ee2565b50565b7f000000000000000000000000000000000000000000000000000000000000000081565b60085460ff1690565b60096020526000908152604090205460ff1681565b6001600160a01b031660009081526020819052604090205490565b600061068c82604051806060016040528060248152602001611ebc6024913961068586610337610ce9565b9190610eb6565b90506106a08361069a610ce9565b83610ced565b6106aa8383610ee2565b505050565b6001600160a01b031660009081526006602052604090205490565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166106fc610ce9565b6001600160a01b0316146107225760405162461bcd60e51b815260040161052d90611d16565b7f000000000000000000000000000000000000000000000000000000000000000061074b610967565b116107685760405162461bcd60e51b815260040161052d90611b0b565b801561077b57610776610fc4565b6105fa565b6105fa611030565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166107b5610ce9565b6001600160a01b0316146107db5760405162461bcd60e51b815260040161052d90611d16565b60005b81518110156105e5576001600960008484815181106107f957fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055507f77a7dbc6ad97703ad411a8d5edfcd1df382fb34b076a90898b11884f7ebdcc0582828151811061086557fe5b602002602001015160405161087a91906117bf565b60405180910390a16001016107de565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103c85780601f1061039d576101008083540402835291602001916103c8565b60006103e76108f8610ce9565b8461046f85604051806060016040528060258152602001611ee06025913960016000610922610ce9565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610eb6565b60006103e7610960610ce9565b8484610da1565b4290565b4690565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166109a1610ce9565b6001600160a01b0316146109c75760405162461bcd60e51b815260040161052d90611d16565b6001600160a01b0382166109ed5760405162461bcd60e51b815260040161052d90611c8a565b6001600160a01b038316610a56574760008215610a1357610a0e8284611089565b610a15565b815b6040519091506001600160a01b0385169082156108fc029083906000818181858888f19350505050158015610a4e573d6000803e3d6000fd5b5050506106aa565b6040516370a0823160e01b81526000906001600160a01b038516906370a0823190610a859030906004016117bf565b60206040518083038186803b158015610a9d57600080fd5b505afa158015610ab1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad59190611766565b905060008215610aee57610ae98284611089565b610af0565b815b905060008111610b125760405162461bcd60e51b815260040161052d90611d63565b610b266001600160a01b038616858361109f565b5050505050565b83610b36610967565b1115610b545760405162461bcd60e51b815260040161052d90611a00565b6001600160a01b0387166000908152600660209081526040808320549051610ba7927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9928c928c928c92918c91016117f7565b6040516020818303038152906040528051906020012090506000611901610bcc6110f5565b83604051602001610bdf9392919061179a565b6040516020818303038152906040528051906020012090506000610c0582878787611134565b9050896001600160a01b0316816001600160a01b031614610c385760405162461bcd60e51b815260040161052d90611b52565b6001600160a01b038a16600090815260066020526040902080546001019055610c628a8a8a610ced565b50505050505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b600082820183811015610ce25760405162461bcd60e51b815260040161052d90611992565b9392505050565b3390565b6001600160a01b038316610d135760405162461bcd60e51b815260040161052d90611c0f565b6001600160a01b038216610d395760405162461bcd60e51b815260040161052d90611950565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610d94908590611d9a565b60405180910390a3505050565b6001600160a01b038316610dc75760405162461bcd60e51b815260040161052d90611bca565b6001600160a01b038216610ded5760405162461bcd60e51b815260040161052d906118df565b610df883838361122c565b610e3581604051806060016040528060268152602001611e6e602691396001600160a01b0386166000908152602081905260409020549190610eb6565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610e649082610cbd565b6001600160a01b0380841660008181526020819052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610d94908590611d9a565b60008184841115610eda5760405162461bcd60e51b815260040161052d9190611875565b505050900390565b6001600160a01b038216610f085760405162461bcd60e51b815260040161052d90611b89565b610f148260008361122c565b610f5181604051806060016040528060228152602001611e4c602291396001600160a01b0385166000908152602081905260409020549190610eb6565b6001600160a01b038316600090815260208190526040902055600254610f7790826112cb565b6002556040516000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610fb8908590611d9a565b60405180910390a35050565b60085460ff16610fe65760405162461bcd60e51b815260040161052d90611922565b6008805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa611019610ce9565b60405161102691906117bf565b60405180910390a1565b60085460ff16156110535760405162461bcd60e51b815260040161052d90611a9f565b6008805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611019610ce9565b60008183106110985781610ce2565b5090919050565b6106aa8363a9059cbb60e01b84846040516024016110be9291906117d3565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261130d565b6000806007600061110461096b565b8152602081019190915260400160002054905080156111245790506103d0565b61112c61139c565b9150506103d0565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08211156111765760405162461bcd60e51b815260040161052d90611a5d565b8360ff16601b148061118b57508360ff16601c145b6111a75760405162461bcd60e51b815260040161052d90611ac9565b6000600186868686604051600081526020016040526040516111cc9493929190611857565b6020604051602081039080840390855afa1580156111ee573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166112215760405162461bcd60e51b815260040161052d906118a8565b90505b949350505050565b6112378383836106aa565b61123f610621565b158061126357506001600160a01b03831660009081526009602052604090205460ff165b8061128657506001600160a01b03821660009081526009602052604090205460ff165b6112a25760405162461bcd60e51b815260040161052d90611a37565b6001600160a01b0382163014156106aa5760405162461bcd60e51b815260040161052d906119c9565b6000610ce283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610eb6565b6060611362826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166114529092919063ffffffff16565b8051909150156106aa5780806020019051810190611380919061171e565b6106aa5760405162461bcd60e51b815260040161052d90611ccc565b6000806113a761096b565b905060007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6113d461033c565b805160209182012060408051808201825260018152603160f81b908401525161142493927fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc691879130910161182b565b60408051601f1981840301815291815281516020928301206000948552600790925290922082905550905090565b60606112248484600085606061146785611520565b6114835760405162461bcd60e51b815260040161052d90611c53565b60006060866001600160a01b031685876040516114a0919061177e565b60006040518083038185875af1925050503d80600081146114dd576040519150601f19603f3d011682016040523d82523d6000602084013e6114e2565b606091505b509150915081156114f65791506112249050565b8051156115065780518082602001fd5b8360405162461bcd60e51b815260040161052d9190611875565b3b151590565b80356103eb81611e28565b600060208284031215611542578081fd5b8135610ce281611e28565b6000806040838503121561155f578081fd5b823561156a81611e28565b9150602083013561157a81611e28565b809150509250929050565b600080600060608486031215611599578081fd5b83356115a481611e28565b925060208401356115b481611e28565b929592945050506040919091013590565b600080600080600080600060e0888a0312156115df578283fd5b87356115ea81611e28565b965060208801356115fa81611e28565b95506040880135945060608801359350608088013560ff8116811461161d578384fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561164c578182fd5b823561165781611e28565b946020939093013593505050565b60006020808385031215611677578182fd5b823567ffffffffffffffff81111561168d578283fd5b8301601f8101851361169d578283fd5b80356116b06116ab82611dd8565b611db1565b81815283810190838501858402850186018910156116cc578687fd5b8694505b838510156116f6576116e28982611526565b8352600194909401939185019185016116d0565b50979650505050505050565b600060208284031215611713578081fd5b8135610ce281611e3d565b60006020828403121561172f578081fd5b8151610ce281611e3d565b600080600060608486031215611599578283fd5b60006020828403121561175f578081fd5b5035919050565b600060208284031215611777578081fd5b5051919050565b60008251611790818460208701611df8565b9190910192915050565b60f09390931b6001600160f01b03191683526002830191909152602282015260420190565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b9586526001600160a01b0394851660208701529290931660408501526060840152608083019190915260a082015260c00190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b93845260ff9290921660208401526040830152606082015260800190565b6000602082528251806020840152611894816040850160208701611df8565b601f01601f19169190910160400192915050565b60208082526018908201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604082015260600190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526014908201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604082015260600190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526017908201527f544f524e3a20696e76616c696420726563697069656e74000000000000000000604082015260600190565b6020808252601d908201527f45524332305065726d69743a206578706972656420646561646c696e65000000604082015260600190565b6020808252600c908201526b1513d4938e881c185d5cd95960a21b604082015260600190565b60208082526022908201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604082015261756560f01b606082015260800190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526022908201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604082015261756560f01b606082015260800190565b60208082526027908201527f544f524e3a2063616e6e6f74206368616e6765207472616e736665726162696c6040820152661a5d1e481e595d60ca1b606082015260800190565b6020808252601e908201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604082015260600190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526022908201527f544f524e3a2063616e206e6f742073656e6420746f207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252602d908201527f544f524e3a206f6e6c7920676f7665726e616e63652063616e20706572666f7260408201526c36903a3434b99030b1ba34b7b760991b606082015260800190565b6020808252601e908201527f544f524e3a20747279696e6720746f2073656e6420302062616c616e63650000604082015260600190565b90815260200190565b60ff91909116815260200190565b60405181810167ffffffffffffffff81118282101715611dd057600080fd5b604052919050565b600067ffffffffffffffff821115611dee578081fd5b5060209081020190565b60005b83811015611e13578181015183820152602001611dfb565b83811115611e22576000848401525b50505050565b6001600160a01b03811681146105fa57600080fd5b80151581146105fa57600080fdfe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e20616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220fd515804eca384cb14c99861e60dc5364ae65ba9ddfdfe00d195788ee631d01064736f6c634300060c0033"; +const isSuperArgs$w = (xs) => xs.length > 1; +class TORN__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$w(args)) { + super(...args); + } else { + super(_abi$T, _bytecode$w, args[0]); + } + } + getDeployTransaction(_governance, _pausePeriod, _vestings, overrides) { + return super.getDeployTransaction( + _governance, + _pausePeriod, + _vestings, + overrides || {} + ); + } + deploy(_governance, _pausePeriod, _vestings, overrides) { + return super.deploy( + _governance, + _pausePeriod, + _vestings, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$w; + static abi = _abi$T; + static createInterface() { + return new interface_Interface(_abi$T); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$T, runner); + } +} + +const _abi$S = [ + { + inputs: [ + { + internalType: "address", + name: "_token", + type: "address" + }, + { + internalType: "address", + name: "_beneficiary", + type: "address" + }, + { + internalType: "uint256", + name: "_startTimestamp", + type: "uint256" + }, + { + internalType: "uint256", + name: "_cliffInMonths", + type: "uint256" + }, + { + internalType: "uint256", + name: "_durationInMonths", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "Released", + type: "event" + }, + { + inputs: [], + name: "SECONDS_PER_MONTH", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "beneficiary", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "blockTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "cliffInMonths", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "durationInMonths", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "release", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "released", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "startTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "token", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "vestedAmount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$v = "0x61012060405234801561001157600080fd5b50604051610c8c380380610c8c833981810160405260a081101561003457600080fd5b508051602082015160408301516060840151608090940151929391929091906001600160a01b0384166100ae576040805162461bcd60e51b815260206004820152601b60248201527f42656e65666963696172792063616e6e6f7420626520656d7074790000000000604482015290519081900360640190fd5b80821115610103576040805162461bcd60e51b815260206004820152601e60248201527f436c6966662069732067726561746572207468616e206475726174696f6e0000604482015290519081900360640190fd5b6001600160601b0319606086811b821660a05285901b1660805261010081905260c08290528215610134578261013c565b61013c61014a565b60e0525061014e9350505050565b4290565b60805160601c60a05160601c60c05160e05161010051610acc6101c060003980610203528061037b52806103dd525080610152528061018e52806105215250806101d052806104f352508061024852806102c85280610474528061054552508061012c52806104965250610acc6000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063928d89ae11610066578063928d89ae146100fb5780639613252114610103578063adb618321461010b578063e6fd48bc14610113578063fc0c546a1461011b5761009e565b806310786deb146100a357806338af3eed146100bd57806344b1231f146100e157806367097a4b146100e957806386d1a69f146100f1575b600080fd5b6100ab610123565b60408051918252519081900360200190f35b6100c561012a565b604080516001600160a01b039092168252519081900360200190f35b6100ab61014e565b6100ab6103db565b6100f96103ff565b005b6100ab6104f1565b6100ab610515565b6100ab61051b565b6100ab61051f565b6100c5610543565b62278d0081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60007f000000000000000000000000000000000000000000000000000000000000000061017961051b565b1015610187575060006103d8565b60006101bb7f00000000000000000000000000000000000000000000000000000000000000006101b561051b565b90610567565b905060006101cc8262278d006105b2565b90507f0000000000000000000000000000000000000000000000000000000000000000811015610201576000925050506103d8565b7f000000000000000000000000000000000000000000000000000000000000000081106102c457604080516370a0823160e01b815230600482015290516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916370a08231916024808301926020929190829003018186803b15801561028e57600080fd5b505afa1580156102a2573d6000803e3d6000fd5b505050506040513d60208110156102b857600080fd5b505192506103d8915050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561033357600080fd5b505afa158015610347573d6000803e3d6000fd5b505050506040513d602081101561035d57600080fd5b505160008054919250906103729083906105f4565b905060006103aa7f00000000000000000000000000000000000000000000000000000000000000006103a4848761064e565b906105b2565b905060006103c36000548361056790919063ffffffff16565b90506103cf84826106a7565b96505050505050505b90565b7f000000000000000000000000000000000000000000000000000000000000000081565b600061040961014e565b905060008111610457576040805162461bcd60e51b81526020600482015260146024820152734e6f20746f6b656e7320746f2072656c6561736560601b604482015290519081900360640190fd5b60005461046490826105f4565b6000556104bb6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f0000000000000000000000000000000000000000000000000000000000000000836106bd565b6040805182815290517ffb81f9b30d73d830c3544b34d827c08142579ee75710b490bab0b3995468c5659181900360200190a150565b7f000000000000000000000000000000000000000000000000000000000000000081565b60005481565b4290565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60006105a983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610714565b90505b92915050565b60006105a983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506107ab565b6000828201838110156105a9576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008261065d575060006105ac565b8282028284828161066a57fe5b04146105a95760405162461bcd60e51b8152600401808060200182810382526021815260200180610a4c6021913960400191505060405180910390fd5b60008183106106b657816105a9565b5090919050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261070f908490610810565b505050565b600081848411156107a35760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610768578181015183820152602001610750565b50505050905090810190601f1680156107955780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836107fa5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610768578181015183820152602001610750565b50600083858161080657fe5b0495945050505050565b6060610865826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166108c19092919063ffffffff16565b80519091501561070f5780806020019051602081101561088457600080fd5b505161070f5760405162461bcd60e51b815260040180806020018281038252602a815260200180610a6d602a913960400191505060405180910390fd5b60606108d084846000856108d8565b949350505050565b60606108e385610a45565b610934576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106109735780518252601f199092019160209182019101610954565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146109d5576040519150601f19603f3d011682016040523d82523d6000602084013e6109da565b606091505b509150915081156109ee5791506108d09050565b8051156109fe5780518082602001fd5b60405162461bcd60e51b8152602060048201818152865160248401528651879391928392604401919085019080838360008315610768578181015183820152602001610750565b3b15159056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a26469706673582212203b3e8370e345374172efb9e3693b20807c318ecfcc569df94f28df8a94f2727a64736f6c634300060c0033"; +const isSuperArgs$v = (xs) => xs.length > 1; +class Vesting__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$v(args)) { + super(...args); + } else { + super(_abi$S, _bytecode$v, args[0]); + } + } + getDeployTransaction(_token, _beneficiary, _startTimestamp, _cliffInMonths, _durationInMonths, overrides) { + return super.getDeployTransaction( + _token, + _beneficiary, + _startTimestamp, + _cliffInMonths, + _durationInMonths, + overrides || {} + ); + } + deploy(_token, _beneficiary, _startTimestamp, _cliffInMonths, _durationInMonths, overrides) { + return super.deploy( + _token, + _beneficiary, + _startTimestamp, + _cliffInMonths, + _durationInMonths, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$v; + static abi = _abi$S; + static createInterface() { + return new interface_Interface(_abi$S); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$S, runner); + } +} + +const _abi$R = [ + { + inputs: [ + { + internalType: "bytes32", + name: "_torn", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_governance", + type: "bytes32" + }, + { + internalType: "uint256", + name: "_duration", + type: "uint256" + }, + { + components: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + internalType: "struct Voucher.Recipient[]", + name: "_airdrops", + type: "tuple[]" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "allowedTransferee", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "blockTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "domains", + type: "bytes32[]" + } + ], + name: "bulkResolve", + outputs: [ + { + internalType: "address[]", + name: "result", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "subtractedValue", + type: "uint256" + } + ], + name: "decreaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "expiresAt", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "governance", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "addedValue", + type: "uint256" + } + ], + name: "increaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "redeem", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "rescueExpiredTokens", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "resolve", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$u = "0x60e06040523480156200001157600080fd5b5060405162001d8d38038062001d8d833981016040819052620000349162000593565b60405180606001604052806026815260200162001d6760269139604051806040016040528060058152602001643b2a27a92760d91b81525081600390805190602001906200008492919062000497565b5080516200009a90600490602084019062000497565b50506005805460ff1916601217905550620000b584620001af565b60601b6001600160601b031916608052620000d083620001af565b60601b6001600160601b03191660c0526200010382620000ef620002fd565b6200030160201b6200098d1790919060201c565b60a05260005b8151811015620001a457620001558282815181106200012457fe5b6020026020010151600001518383815181106200013d57fe5b6020026020010151602001516200033260201b60201c565b6001600660008484815181106200016857fe5b602090810291909101810151516001600160a01b03168252810191909152604001600020805460ff191691151591909117905560010162000109565b505050505062000753565b600080620001bc62000415565b600114620001df57738595bfb0d940dfedc98943fa8a907091203f25ee620001f0565b6e0c2e074ec69a0dfb2997ba6c7d2e1e5b604051630178b8bf60e01b81529091506001600160a01b03821690630178b8bf906200022190869060040162000665565b60206040518083038186803b1580156200023a57600080fd5b505afa1580156200024f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000275919062000574565b6001600160a01b0316633b3b57de846040518263ffffffff1660e01b8152600401620002a2919062000665565b60206040518083038186803b158015620002bb57600080fd5b505afa158015620002d0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002f6919062000574565b9392505050565b4290565b600082820183811015620002f65760405162461bcd60e51b815260040162000329906200066e565b60405180910390fd5b6001600160a01b0382166200035b5760405162461bcd60e51b81526004016200032990620006dc565b620003696000838362000419565b62000385816002546200030160201b6200098d1790919060201c565b6002556001600160a01b03821660009081526020818152604090912054620003b89183906200098d62000301821b17901c565b6001600160a01b0383166000818152602081905260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906200040990859062000665565b60405180910390a35050565b4690565b620004318383836200049260201b620009b21760201c565b6001600160a01b03821615806200044f57506001600160a01b038316155b806200047357506001600160a01b03831660009081526006602052604090205460ff165b620004925760405162461bcd60e51b81526004016200032990620006a5565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620004da57805160ff19168380011785556200050a565b828001600101855582156200050a579182015b828111156200050a578251825591602001919060010190620004ed565b50620005189291506200051c565b5090565b5b808211156200051857600081556001016200051d565b60006040828403121562000545578081fd5b62000551604062000713565b9050815162000560816200073a565b808252506020820151602082015292915050565b60006020828403121562000586578081fd5b8151620002f6816200073a565b60008060008060808587031215620005a9578283fd5b8451935060208086015193506040808701519350606087015160018060401b0380821115620005d6578485fd5b818901915089601f830112620005ea578485fd5b815181811115620005f9578586fd5b62000608858683020162000713565b8181528581019250838601858302850187018d101562000626578788fd5b8794505b8285101562000654576200063f8d8262000533565b8452600194909401939286019285016200062a565b50989b979a50959850505050505050565b90815260200190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601e908201527f45524332303a207472616e73666572206973206e6f7420616c6c6f7765640000604082015260600190565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b6040518181016001600160401b03811182821017156200073257600080fd5b604052919050565b6001600160a01b03811681146200075057600080fd5b50565b60805160601c60a05160c05160601c6115c3620007a46000398061043152806107d35250806105c352806106ec52806107895250806106c8528061075d52806107f4528061089852506115c36000f3fe608060405234801561001057600080fd5b506004361061012c5760003560e01c80638622a689116100ad578063adf898a411610071578063adf898a41461024b578063be040fb014610253578063c39ef8551461025d578063dd62ed3e14610265578063f9e54234146102785761012c565b80638622a6891461020d57806395d89b4114610215578063a457c2d71461021d578063a9059cbb14610230578063adb61832146102435761012c565b806339509351116100f457806339509351146101ac5780635aa6e675146101bf5780635c23bdf5146101d45780635d4545a0146101e757806370a08231146101fa5761012c565b806306fdde0314610131578063095ea7b31461014f57806318160ddd1461016f57806323b872dd14610184578063313ce56714610197575b600080fd5b610139610298565b604051610146919061116f565b60405180910390f35b61016261015d366004610fb5565b61032e565b604051610146919061115b565b61017761034b565b6040516101469190611166565b610162610192366004610f75565b610351565b61019f6103d8565b604051610146919061145e565b6101626101ba366004610fb5565b6103e1565b6101c761042f565b60405161014691906110e1565b6101c76101e2366004611095565b610453565b6101626101f5366004610f05565b610591565b610177610208366004610f05565b6105a6565b6101776105c1565b6101396105e5565b61016261022b366004610fb5565b610646565b61016261023e366004610fb5565b6106ae565b6101776106c2565b6101c76106c6565b61025b6106ea565b005b61025b610787565b610177610273366004610f3d565b6108c1565b61028b610286366004610fe0565b6108ec565b604051610146919061110e565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103245780601f106102f957610100808354040283529160200191610324565b820191906000526020600020905b81548152906001019060200180831161030757829003601f168201915b5050505050905090565b600061034261033b6109b7565b84846109bb565b50600192915050565b60025490565b600061035e848484610a6f565b6103ce8461036a6109b7565b6103c985604051806060016040528060288152602001611541602891396001600160a01b038a166000908152600160205260408120906103a86109b7565b6001600160a01b031681526020810191909152604001600020549190610b84565b6109bb565b5060019392505050565b60055460ff1690565b60006103426103ee6109b7565b846103c985600160006103ff6109b7565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549061098d565b7f000000000000000000000000000000000000000000000000000000000000000081565b60008061045e610bb0565b60011461047f57738595bfb0d940dfedc98943fa8a907091203f25ee610490565b6e0c2e074ec69a0dfb2997ba6c7d2e1e5b604051630178b8bf60e01b81529091506001600160a01b03821690630178b8bf906104bf908690600401611166565b60206040518083038186803b1580156104d757600080fd5b505afa1580156104eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050f9190610f21565b6001600160a01b0316633b3b57de846040518263ffffffff1660e01b815260040161053a9190611166565b60206040518083038186803b15801561055257600080fd5b505afa158015610566573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058a9190610f21565b9392505050565b60066020526000908152604090205460ff1681565b6001600160a01b031660009081526020819052604090205490565b7f000000000000000000000000000000000000000000000000000000000000000081565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103245780601f106102f957610100808354040283529160200191610324565b60006103426106536109b7565b846103c985604051806060016040528060258152602001611569602591396001600061067d6109b7565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610b84565b60006103426106bb6109b7565b8484610a6f565b4290565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f00000000000000000000000000000000000000000000000000000000000000006107136106c2565b106107395760405162461bcd60e51b81526004016107309061125e565b60405180910390fd5b6000610744336105a6565b90506107503382610bb4565b6107846001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163383610c96565b50565b7f00000000000000000000000000000000000000000000000000000000000000006107b06106c2565b10156107ce5760405162461bcd60e51b815260040161073090611295565b6108bf7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161083e91906110e1565b60206040518083038186803b15801561085657600080fd5b505afa15801561086a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088e91906110ad565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169190610c96565b565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060815167ffffffffffffffff8111801561090657600080fd5b50604051908082528060200260200182016040528015610930578160200160208202803683370190505b50905060005b82518110156109875761095b83828151811061094e57fe5b6020026020010151610453565b82828151811061096757fe5b6001600160a01b0390921660209283029190910190910152600101610936565b50919050565b60008282018381101561058a5760405162461bcd60e51b815260040161073090611227565b505050565b3390565b6001600160a01b0383166109e15760405162461bcd60e51b815260040161073090611399565b6001600160a01b038216610a075760405162461bcd60e51b8152600401610730906111e5565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610a62908590611166565b60405180910390a3505050565b6001600160a01b038316610a955760405162461bcd60e51b815260040161073090611354565b6001600160a01b038216610abb5760405162461bcd60e51b8152600401610730906111a2565b610ac6838383610cec565b610b038160405180606001604052806026815260200161151b602691396001600160a01b0386166000908152602081905260409020549190610b84565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610b32908261098d565b6001600160a01b0380841660008181526020819052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610a62908590611166565b60008184841115610ba85760405162461bcd60e51b8152600401610730919061116f565b505050900390565b4690565b6001600160a01b038216610bda5760405162461bcd60e51b815260040161073090611313565b610be682600083610cec565b610c23816040518060600160405280602281526020016114f9602291396001600160a01b0385166000908152602081905260409020549190610b84565b6001600160a01b038316600090815260208190526040902055600254610c499082610d53565b6002556040516000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610c8a908590611166565b60405180910390a35050565b6109b28363a9059cbb60e01b8484604051602401610cb59291906110f5565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610d95565b610cf78383836109b2565b6001600160a01b0382161580610d1457506001600160a01b038316155b80610d3757506001600160a01b03831660009081526006602052604090205460ff165b6109b25760405162461bcd60e51b8152600401610730906112dc565b600061058a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610b84565b6060610dea826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610e249092919063ffffffff16565b8051909150156109b25780806020019051810190610e089190611075565b6109b25760405162461bcd60e51b815260040161073090611414565b6060610e338484600085610e3b565b949350505050565b6060610e4685610eff565b610e625760405162461bcd60e51b8152600401610730906113dd565b60006060866001600160a01b03168587604051610e7f91906110c5565b60006040518083038185875af1925050503d8060008114610ebc576040519150601f19603f3d011682016040523d82523d6000602084013e610ec1565b606091505b50915091508115610ed5579150610e339050565b805115610ee55780518082602001fd5b8360405162461bcd60e51b8152600401610730919061116f565b3b151590565b600060208284031215610f16578081fd5b813561058a816114e3565b600060208284031215610f32578081fd5b815161058a816114e3565b60008060408385031215610f4f578081fd5b8235610f5a816114e3565b91506020830135610f6a816114e3565b809150509250929050565b600080600060608486031215610f89578081fd5b8335610f94816114e3565b92506020840135610fa4816114e3565b929592945050506040919091013590565b60008060408385031215610fc7578182fd5b8235610fd2816114e3565b946020939093013593505050565b60006020808385031215610ff2578182fd5b823567ffffffffffffffff811115611008578283fd5b8301601f81018513611018578283fd5b803561102b61102682611493565b61146c565b8181528381019083850185840285018601891015611047578687fd5b8694505b8385101561106957803583526001949094019391850191850161104b565b50979650505050505050565b600060208284031215611086578081fd5b8151801515811461058a578182fd5b6000602082840312156110a6578081fd5b5035919050565b6000602082840312156110be578081fd5b5051919050565b600082516110d78184602087016114b3565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b8181101561114f5783516001600160a01b03168352928401929184019160010161112a565b50909695505050505050565b901515815260200190565b90815260200190565b600060208252825180602084015261118e8160408501602087016114b3565b601f01601f19169190910160400192915050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601f908201527f41697264726f702072656465656d20706572696f642068617320656e64656400604082015260600190565b60208082526027908201527f41697264726f702072656465656d20706572696f6420686173206e6f7420656e604082015266191959081e595d60ca1b606082015260800190565b6020808252601e908201527f45524332303a207472616e73666572206973206e6f7420616c6c6f7765640000604082015260600190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b60ff91909116815260200190565b60405181810167ffffffffffffffff8111828210171561148b57600080fd5b604052919050565b600067ffffffffffffffff8211156114a9578081fd5b5060209081020190565b60005b838110156114ce5781810151838201526020016114b6565b838111156114dd576000848401525b50505050565b6001600160a01b038116811461078457600080fdfe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212209b2d6f14167bc062b61418b8fca6b7946d243420e3df874c9632acb30079c69b64736f6c634300060c0033546f726e61646f4361736820766f756368657220666f72206561726c792061646f7074657273"; +const isSuperArgs$u = (xs) => xs.length > 1; +class Voucher__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$u(args)) { + super(...args); + } else { + super(_abi$R, _bytecode$u, args[0]); + } + } + getDeployTransaction(_torn, _governance, _duration, _airdrops, overrides) { + return super.getDeployTransaction( + _torn, + _governance, + _duration, + _airdrops, + overrides || {} + ); + } + deploy(_torn, _governance, _duration, _airdrops, overrides) { + return super.deploy( + _torn, + _governance, + _duration, + _airdrops, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$u; + static abi = _abi$R; + static createInterface() { + return new interface_Interface(_abi$R); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$R, runner); + } +} + +var index$t = /*#__PURE__*/Object.freeze({ + __proto__: null, + Airdrop__factory: Airdrop__factory, + ERC20Permit__factory: ERC20Permit__factory, + TORN__factory: TORN__factory, + Vesting__factory: Vesting__factory, + Voucher__factory: Voucher__factory, + ensSol: index$v, + mocks: index$u +}); + +const _abi$Q = [ + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "decimal", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "latestAnswer", + outputs: [ + { + internalType: "int256", + name: "answer", + type: "int256" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IChainlinkOracle__factory { + static abi = _abi$Q; + static createInterface() { + return new interface_Interface(_abi$Q); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$Q, runner); + } +} + +const _abi$P = [ + { + inputs: [ + { + internalType: "address", + name: "srcToken", + type: "address" + }, + { + internalType: "bool", + name: "useSrcWrappers", + type: "bool" + } + ], + name: "getRateToEth", + outputs: [ + { + internalType: "uint256", + name: "weightedRate", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IOffchainOracle__factory { + static abi = _abi$P; + static createInterface() { + return new interface_Interface(_abi$P); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$P, runner); + } +} + +const _abi$O = [ + { + inputs: [ + { + internalType: "address", + name: "_stablecoin", + type: "address" + }, + { + internalType: "address", + name: "_stablecoinOracle", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "NotOwner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "arbitraryPrice", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "chainlinkOracles", + outputs: [ + { + internalType: "contract IChainlinkOracle", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "price", + type: "uint256" + } + ], + name: "changeArbitraryPrice", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "changeOwner", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address" + } + ], + name: "getOracleUSD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "srcToken", + type: "address" + }, + { + internalType: "bool", + name: "useSrcWrappers", + type: "bool" + } + ], + name: "getRateToEth", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "isStablecoin", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "address", + name: "oracle", + type: "address" + }, + { + internalType: "bool", + name: "_isStablecoin", + type: "bool" + } + ], + name: "setOracle", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "stablecoin", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$t = "0x6080604052348015600f57600080fd5b50604051610905380380610905833981016040819052602c9160a7565b600080546001600160a01b039384166001600160a01b0319918216811783558252600260209081526040808420805460ff1916600190811790915590915290912080549290931691811691909117909155600480549091163317905560d5565b80516001600160a01b038116811460a257600080fd5b919050565b6000806040838503121560b957600080fd5b60c083608c565b915060cc60208401608c565b90509250929050565b610821806100e46000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063d16c130711610066578063d16c130714610165578063dd01555214610178578063dd3a825a1461018b578063df60d05a1461019e578063e9cbd822146101be57600080fd5b80631a650cc7146100a35780636a75aa66146100db5780637de4fd101461011c5780638da5cb5b1461013d578063a6f9dae114610150575b600080fd5b6100c66100b1366004610566565b60026020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b6101046100e9366004610566565b6001602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020016100d2565b61012f61012a366004610598565b6101d1565b6040519081526020016100d2565b600454610104906001600160a01b031681565b61016361015e366004610566565b610320565b005b6101636101733660046105cb565b61036d565b61012f610186366004610566565b6103f1565b61016361019936600461060e565b610503565b61012f6101ac366004610566565b60036020526000908152604090205481565b600054610104906001600160a01b031681565b6001600160a01b0382811660009081526001602052604081205490911661021157506001600160a01b03821660009081526003602052604090205461031a565b6000836001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610251573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102759190610638565b6001600160a01b03851660009081526002602052604090205490915060ff16156102ca576102a4816012610671565b6102af90600a610771565b6102b8856103f1565b6102c29190610780565b91505061031a565b600080546102e0906001600160a01b03166103f1565b90506102eb856103f1565b6102f6836024610671565b61030190600a610771565b61030b9083610780565b6103159190610797565b925050505b92915050565b6004546001600160a01b0316331461034b576040516330cd747160e01b815260040160405180910390fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6004546001600160a01b03163314610398576040516330cd747160e01b815260040160405180910390fd5b80156103c2576001600160a01b0383166000908152600260205260409020805460ff191660011790555b506001600160a01b03918216600090815260016020526040902080546001600160a01b03191691909216179055565b6001600160a01b03808216600090815260016020908152604080832054815163313ce56760e01b815291519394169284928392859263313ce567926004808401939192918290030181865afa15801561044e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104729190610638565b836001600160a01b03166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d491906107b9565b9092509050806104e58360126107d2565b6104f090600a610771565b6104fa9190610797565b95945050505050565b6004546001600160a01b0316331461052e576040516330cd747160e01b815260040160405180910390fd5b6001600160a01b03909116600090815260036020526040902055565b80356001600160a01b038116811461056157600080fd5b919050565b60006020828403121561057857600080fd5b6105818261054a565b9392505050565b8035801515811461056157600080fd5b600080604083850312156105ab57600080fd5b6105b48361054a565b91506105c260208401610588565b90509250929050565b6000806000606084860312156105e057600080fd5b6105e98461054a565b92506105f76020850161054a565b915061060560408501610588565b90509250925092565b6000806040838503121561062157600080fd5b61062a8361054a565b946020939093013593505050565b60006020828403121561064a57600080fd5b815160ff8116811461058157600080fd5b634e487b7160e01b600052601160045260246000fd5b60ff828116828216039081111561031a5761031a61065b565b6001815b60018411156106c5578085048111156106a9576106a961065b565b60018416156106b757908102905b60019390931c92800261068e565b935093915050565b6000826106dc5750600161031a565b816106e95750600061031a565b81600181146106ff576002811461070957610725565b600191505061031a565b60ff84111561071a5761071a61065b565b50506001821b61031a565b5060208310610133831016604e8410600b8410161715610748575081810a61031a565b610755600019848461068a565b80600019048211156107695761076961065b565b029392505050565b600061058160ff8416836106cd565b808202811582820484141761031a5761031a61065b565b6000826107b457634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156107cb57600080fd5b5051919050565b60ff818116838216019081111561031a5761031a61065b56fea264697066735822122014c0c48f05ab025151413c0ef2c884b3844e6a66084576e34b8337df8af8cf4564736f6c634300081c0033"; +const isSuperArgs$t = (xs) => xs.length > 1; +class TestnetOracle__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$t(args)) { + super(...args); + } else { + super(_abi$O, _bytecode$t, args[0]); + } + } + getDeployTransaction(_stablecoin, _stablecoinOracle, overrides) { + return super.getDeployTransaction( + _stablecoin, + _stablecoinOracle, + overrides || {} + ); + } + deploy(_stablecoin, _stablecoinOracle, overrides) { + return super.deploy( + _stablecoin, + _stablecoinOracle, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$t; + static abi = _abi$O; + static createInterface() { + return new interface_Interface(_abi$O); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$O, runner); + } +} + +var index$s = /*#__PURE__*/Object.freeze({ + __proto__: null, + IChainlinkOracle__factory: IChainlinkOracle__factory, + IOffchainOracle__factory: IOffchainOracle__factory, + TestnetOracle__factory: TestnetOracle__factory +}); + +const _abi$N = [ + { + inputs: [ + { + internalType: "address", + name: "_logic", + type: "address" + }, + { + internalType: "address", + name: "_admin", + type: "address" + }, + { + internalType: "bytes", + name: "_data", + type: "bytes" + } + ], + stateMutability: "payable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "previousAdmin", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "AdminChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "implementation", + type: "address" + } + ], + name: "Upgraded", + type: "event" + }, + { + stateMutability: "payable", + type: "fallback" + }, + { + inputs: [], + name: "admin", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "callToOwner", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "changeAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "changeOwner", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "delegateToOwner", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "getCurrentOwner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "implementation", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + } + ], + name: "upgradeTo", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "upgradeToAndCall", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + } + ], + name: "upgradeToOwner", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$s = "0x608060405260405162000e6738038062000e67833981810160405260608110156200002957600080fd5b815160208301516040808501805191519395929483019291846401000000008211156200005557600080fd5b9083019060208201858111156200006b57600080fd5b82516401000000008111828201881017156200008657600080fd5b82525081516020918201929091019080838360005b83811015620000b55781810151838201526020016200009b565b50505050905090810190601f168015620000e35780820380516001836020036101000a031916815260200191505b5060405250849150839050828282828281620000ff82620001f6565b805115620001bd576000826001600160a01b0316826040518082805190602001908083835b60208310620001455780518252601f19909201916020918201910162000124565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114620001a7576040519150601f19603f3d011682016040523d82523d6000602084013e620001ac565b606091505b5050905080620001bb57600080fd5b505b50620001c69050565b620001d1826200026d565b505050505050620001ed336200029160201b620008ab1760201c565b50505062000308565b6200020c81620002bd60201b620008d51760201c565b620002495760405162461bcd60e51b815260040180806020018281038252603681526020018062000e316036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b806200029c620002c3565b80546001600160a01b0319166001600160a01b039290921691909117905550565b3b151590565b604080517fb4d03667d60278cc15e9a68fa7679dc39ebe71350c4566a2c23c26580da4e0b3602080830191909152825180830382018152918301909252805191012090565b610b1980620003186000396000f3fe6080604052600436106100955760003560e01c80635c60da1b116100595780635c60da1b146102fe5780638f2839701461032f578063a18a186b14610362578063a6f9dae114610377578063f851a440146103aa576100a4565b806323711ab1146100ac57806323c735f1146101625780632e44e0e0146101955780633659cfe61461024b5780634f1ef2861461027e576100a4565b366100a4576100a26103bf565b005b6100a26103bf565b6100a2600480360360408110156100c257600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100ed57600080fd5b8201836020820111156100ff57600080fd5b8035906020019184600183028401116401000000008311171561012157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506103d9945050505050565b34801561016e57600080fd5b506100a26004803603602081101561018557600080fd5b50356001600160a01b03166104e7565b6100a2600480360360408110156101ab57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156101d657600080fd5b8201836020820111156101e857600080fd5b8035906020019184600183028401116401000000008311171561020a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610546945050505050565b34801561025757600080fd5b506100a26004803603602081101561026e57600080fd5b50356001600160a01b031661063a565b6100a26004803603604081101561029457600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156102bf57600080fd5b8201836020820111156102d157600080fd5b803590602001918460018302840111640100000000831117156102f357600080fd5b509092509050610671565b34801561030a57600080fd5b5061031361071e565b604080516001600160a01b039092168252519081900360200190f35b34801561033b57600080fd5b506100a26004803603602081101561035257600080fd5b50356001600160a01b031661075b565b34801561036e57600080fd5b50610313610815565b34801561038357600080fd5b506100a26004803603602081101561039a57600080fd5b50356001600160a01b0316610824565b3480156103b657600080fd5b50610313610880565b6103c76103d7565b6103d76103d26108db565b610900565b565b336103e2610924565b6001600160a01b03161461042c576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b6020831061046a5780518252601f19909201916020918201910161044b565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146104ca576040519150601f19603f3d011682016040523d82523d6000602084013e6104cf565b606091505b5091509150816104e157805181602001fd5b50505050565b336104f0610924565b6001600160a01b03161461053a576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b6105438161093d565b50565b3361054f610924565b6001600160a01b031614610599576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b60006060836001600160a01b031634846040518082805190602001908083835b602083106105d85780518252601f1990920191602091820191016105b9565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146104ca576040519150601f19603f3d011682016040523d82523d6000602084013e6104cf565b61064261097d565b6001600160a01b0316336001600160a01b03161415610669576106648161093d565b610543565b6105436103bf565b61067961097d565b6001600160a01b0316336001600160a01b031614156107115761069b8361093d565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146106f8576040519150601f19603f3d011682016040523d82523d6000602084013e6106fd565b606091505b505090508061070b57600080fd5b50610719565b6107196103bf565b505050565b600061072861097d565b6001600160a01b0316336001600160a01b03161415610750576107496108db565b9050610758565b6107586103bf565b90565b61076361097d565b6001600160a01b0316336001600160a01b03161415610669576001600160a01b0381166107c15760405162461bcd60e51b815260040180806020018281038252603a815260200180610a74603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6107ea61097d565b604080516001600160a01b03928316815291841660208301528051918290030190a1610664816109a2565b600061081f610924565b905090565b3361082d610924565b6001600160a01b031614610877576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b610543816108ab565b600061088a61097d565b6001600160a01b0316336001600160a01b031614156107505761074961097d565b806108b46109c6565b80546001600160a01b0319166001600160a01b039290921691909117905550565b3b151590565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561091f573d6000f35b3d6000fd5b600061092e6109c6565b546001600160a01b0316919050565b61094681610a0b565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b604080517fb4d03667d60278cc15e9a68fa7679dc39ebe71350c4566a2c23c26580da4e0b3602080830191909152825180830382018152918301909252805191012090565b610a14816108d5565b610a4f5760405162461bcd60e51b8152600401808060200182810382526036815260200180610aae6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374a264697066735822122001f07e10d1eeadbd61da070e50227b529a3ec4b8f2e780a0e6bc1dc6028ba95764736f6c634300060c00335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374"; +const isSuperArgs$s = (xs) => xs.length > 1; +class TestnetAdminProxy__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$s(args)) { + super(...args); + } else { + super(_abi$N, _bytecode$s, args[0]); + } + } + getDeployTransaction(_logic, _admin, _data, overrides) { + return super.getDeployTransaction(_logic, _admin, _data, overrides || {}); + } + deploy(_logic, _admin, _data, overrides) { + return super.deploy(_logic, _admin, _data, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$s; + static abi = _abi$N; + static createInterface() { + return new interface_Interface(_abi$N); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$N, runner); + } +} + +const _abi$M = [ + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + }, + { + internalType: "address", + name: "_governance", + type: "address" + }, + { + internalType: "address", + name: "_registry", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "instance", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "newFee", + type: "uint256" + } + ], + name: "FeeUpdated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint24", + name: "newFee", + type: "uint24" + } + ], + name: "UniswapTornPoolSwappingFeeChanged", + type: "event" + }, + { + inputs: [], + name: "PROTOCOL_FEE_DIVIDER", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "_instance", + type: "address" + } + ], + name: "calculatePoolFee", + outputs: [ + { + internalType: "uint160", + name: "", + type: "uint160" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "feeDeviations", + outputs: [ + { + components: [ + { + internalType: "address", + name: "instance", + type: "address" + }, + { + internalType: "int256", + name: "deviation", + type: "int256" + } + ], + internalType: "struct FeeManager.Deviation[]", + name: "results", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_token", + type: "address" + }, + { + internalType: "uint24", + name: "_uniswapPoolSwappingFee", + type: "uint24" + } + ], + name: "getTokenPriceRatio", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "governance", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "", + type: "address" + } + ], + name: "instanceFee", + outputs: [ + { + internalType: "uint160", + name: "", + type: "uint160" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "", + type: "address" + } + ], + name: "instanceFeeUpdated", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "_instance", + type: "address" + } + ], + name: "instanceFeeWithUpdate", + outputs: [ + { + internalType: "uint160", + name: "", + type: "uint160" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "registry", + outputs: [ + { + internalType: "contract InstanceRegistry", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint32", + name: "newPeriod", + type: "uint32" + } + ], + name: "setPeriodForTWAPOracle", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_token", + type: "address" + }, + { + internalType: "uint256", + name: "_price", + type: "uint256" + } + ], + name: "setTokenPrice", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint24", + name: "_uniswapTornPoolSwappingFee", + type: "uint24" + } + ], + name: "setUniswapTornPoolSwappingFee", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint24", + name: "newLimit", + type: "uint24" + } + ], + name: "setUpdateFeeTimeLimit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "uniswapTimePeriod", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "uniswapTornPoolSwappingFee", + outputs: [ + { + internalType: "uint24", + name: "", + type: "uint24" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "updateAllFees", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "_instance", + type: "address" + } + ], + name: "updateFee", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "updateFeeTimeLimit", + outputs: [ + { + internalType: "uint24", + name: "", + type: "uint24" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance[]", + name: "_instances", + type: "address[]" + } + ], + name: "updateFees", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$r = "0x60e06040523480156200001157600080fd5b5060405162001ca738038062001ca783398101604081905262000034916200005c565b6001600160601b0319606093841b811660805291831b821660a05290911b1660c052620000c8565b60008060006060848603121562000071578283fd5b83516200007e81620000af565b60208501519093506200009181620000af565b6040850151909250620000a481620000af565b809150509250925092565b6001600160a01b0381168114620000c557600080fd5b50565b60805160601c60a05160601c60c05160601c611b866200012160003980610350528061061452806108915280610a42525080610539528061064c528061072d528061082252508061059852806107ad5250611b866000f3fe608060405234801561001057600080fd5b506004361061012c5760003560e01c806380eb7bf0116100ad578063bcc5ee6411610071578063bcc5ee641461024b578063c51c229714610253578063d8718fb114610266578063e1f121561461027b578063f522d6d61461028e5761012c565b806380eb7bf014610202578063a028752014610215578063adf898a414610228578063aeb3077a14610230578063b19a2972146102385761012c565b8063603a54fe116100f4578063603a54fe146101ac57806369574fef146101bf5780637b103999146101d25780637ccd2f48146101da57806380679eb3146101ef5761012c565b806305e34364146101315780632efbf3841461015a578063431f63c91461017a5780634bf0a5421461018f5780635aa6e675146101a4575b600080fd5b61014461013f366004611848565b610296565b6040516101519190611ab4565b60405180910390f35b61016d610168366004611848565b6102a8565b60405161015191906118d5565b61018d6101883660046115bc565b610305565b005b61019761034b565b6040516101519190611911565b61016d610537565b61016d6101ba366004611848565b61055b565b6101446101cd366004611584565b610576565b61016d610612565b6101e2610636565b6040516101519190611aa4565b61018d6101fd366004611898565b610641565b61018d610210366004611848565b61069c565b61018d610223366004611864565b610722565b61016d6107ab565b6101446107cf565b61018d6102463660046115e7565b6107d5565b6101e2610805565b61018d610261366004611864565b610817565b61026e610874565b6040516101519190611abd565b61016d610289366004611848565b610887565b61018d610a3d565b60026020526000908152604090205481565b600080546001600160a01b038316825260026020526040822054600160381b90910462ffffff16429190910311156102e3576102e38261069c565b506001600160a01b03808216600090815260016020526040902054165b919050565b3361030e610ad7565b6001600160a01b03161461033d5760405162461bcd60e51b815260040161033490611a06565b60405180910390fd5b6103478282610af0565b5050565b6060807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166310c13ac36040518163ffffffff1660e01b815260040160006040518083038186803b1580156103a757600080fd5b505afa1580156103bb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103e3919081019061167f565b9050805167ffffffffffffffff811180156103fd57600080fd5b5060405190808252806020026020018201604052801561043757816020015b6104246114b2565b81526020019060019003908161041c5790505b50915060005b815181101561053257600061046483838151811061045757fe5b6020026020010151610887565b6001600160a01b03169050600081156104e0576103e8826001600087878151811061048b57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060009054906101000a90046001600160a01b03166103e8026001600160a01b0316816104db57fe5b040390505b60405180604001604052808585815181106104f757fe5b60200260200101516001600160a01b031681526020018281525085848151811061051d57fe5b6020908102919091010152505060010161043d565b505090565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001602052600090815260409020546001600160a01b031681565b600061058183610b19565b610600576040805180820182526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811682528516602080830191909152825180840190935260005462ffffff80821685528616918401919091526105fb929063ffffffff630100000090910416610b44565b610609565b61060983610b19565b90505b92915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60005462ffffff1681565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461067657600080fd5b6000805463ffffffff90921663010000000266ffffffff00000019909216919091179055565b60006106a782610887565b6001600160a01b03838116600081815260016020908152604080832080546001600160a01b03191695871695909517909455600290528290204290559051919250907f6f0eaf2c2f89fb4cfe96a1dee5e764d60b52c7f48aaa590f0850e308aa1b953a906107169084906118d5565b60405180910390a25050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461075757600080fd5b6000805462ffffff191662ffffff83811691909117918290556040517fbfe65cfc2359076c4468c9b895156c309c78f94fb09f6d2fc0463c4ca9a71ac2926107a0921690611aa4565b60405180910390a150565b7f000000000000000000000000000000000000000000000000000000000000000081565b61271081565b60005b8151811015610347576107fd8282815181106107f057fe5b602002602001015161069c565b6001016107d8565b600054600160381b900462ffffff1681565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461084c57600080fd5b6000805462ffffff909216600160381b0269ffffff0000000000000019909216919091179055565b6000546301000000900463ffffffff1681565b60008060008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663032bb443876040518263ffffffff1660e01b81526004016108db91906118d5565b60a06040518083038186803b1580156108f357600080fd5b505afa158015610907573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092b91906117cd565b9450945050935093508063ffffffff1660001415610950576000945050505050610300565b6001600160a01b038316158015610965575083155b61096f5782610985565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25b925060006109938484610576565b9050610a32612710610a2c8463ffffffff16610a2685610a2c670de0b6b3a76400008e6001600160a01b0316638bca6d166040518163ffffffff1660e01b815260040160206040518083038186803b1580156109ee57600080fd5b505afa158015610a02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a269190611880565b90610b90565b90610bca565b979650505050505050565b610ad57f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166310c13ac36040518163ffffffff1660e01b815260040160006040518083038186803b158015610a9957600080fd5b505afa158015610aad573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610246919081019061167f565b565b6000610ae1610c0c565b546001600160a01b0316919050565b6000610afa610c61565b6001600160a01b03909316600090815260209390935250604090912055565b600080610b24610c61565b6001600160a01b0390931660009081526020939093525050604090205490565b60208084015190830151600091610b5b9184610c98565b84518451610b7e91670de0b6b3a764000091610b78919087610c98565b90610cc2565b81610b8557fe5b0490505b9392505050565b600082610b9f5750600061060c565b82820282848281610bac57fe5b04146106095760405162461bcd60e51b815260040161033490611a63565b600061060983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610ce6565b6000807fb4d03667d60278cc15e9a68fa7679dc39ebe71350c4566a2c23c26580da4e0b360001c604051602001610c439190611ab4565b60408051601f19818403018152919052805160209091012092915050565b6000807f6521c13ddfc30471ec629848a30b01f73c36737d417c11843e7a9afa6985e84860001c604051602001610c439190611ab4565b6000610cba8473c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28585610d1d565b949350505050565b6000821580610cdd57505081810281838281610cda57fe5b04145b61060c57600080fd5b60008183610d075760405162461bcd60e51b815260040161033491906119b3565b506000838581610d1357fe5b0495945050505050565b600080846001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610d5957600080fd5b505afa158015610d6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9191906118b4565b60ff16600a0a90506001600160a01b038681169086161415610dbd576001600160801b03169050610cba565b604051630b4c774160e11b8152610e5e90610e5690731f98431c8ad98523631ae4a59f267346ea31f98490631698ee8290610e00908b908b908b906004016118e9565b60206040518083038186803b158015610e1857600080fd5b505afa158015610e2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e509190611568565b85610e6f565b828888611004565b915050610cba565b50949350505050565b600063ffffffff8216610e945760405162461bcd60e51b815260040161033490611a2c565b60408051600280825260608083018452926020830190803683370190505090508281600081518110610ec257fe5b602002602001019063ffffffff16908163ffffffff1681525050600081600181518110610eeb57fe5b63ffffffff9092166020928302919091019091015260405163883bdbfd60e01b81526060906001600160a01b0386169063883bdbfd90610f2f908590600401611969565b60006040518083038186803b158015610f4757600080fd5b505afa158015610f5b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f83919081019061170b565b509050600081600081518110610f9557fe5b602002602001015182600181518110610faa57fe5b60200260200101510390508463ffffffff168160060b81610fc757fe5b05935060008160060b128015610fee57508463ffffffff168160060b81610fea57fe5b0715155b15610ffb57600019909301925b50505092915050565b600080611010866110ee565b90506001600160801b036001600160a01b0382161161107f576001600160a01b038082168002908481169086161061105f5761105a600160c01b876001600160801b031683611407565b611077565b61107781876001600160801b0316600160c01b611407565b925050610e66565b600061109e6001600160a01b0383168068010000000000000000611407565b9050836001600160a01b0316856001600160a01b0316106110d6576110d1600160801b876001600160801b031683611407565b610a32565b610a3281876001600160801b0316600160801b611407565b60008060008360020b12611105578260020b61110d565b8260020b6000035b9050620d89e88111156111325760405162461bcd60e51b815260040161033490611a48565b60006001821661114657600160801b611158565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff169050600282161561118c576ffff97272373d413259a46990580e213a0260801c5b60048216156111ab576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b60088216156111ca576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b60108216156111e9576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615611208576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615611227576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615611246576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615611266576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615611286576ff987a7253ac413176f2b074cf7815e540260801c5b6104008216156112a6576ff3392b0822b70005940c7a398e4b70f30260801c5b6108008216156112c6576fe7159475a2c29b7443b29c7fa6e889d90260801c5b6110008216156112e6576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615611306576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615611326576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615611346576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615611367576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b62020000821615611387576e5d6af8dedb81196699c329225ee6040260801c5b620400008216156113a6576d2216e584f5fa1ea926041bedfe980260801c5b620800008216156113c3576b048a170391f7dc42444e8fa20260801c5b60008460020b13156113de5780600019816113da57fe5b0490505b6401000000008106156113f25760016113f5565b60005b60ff16602082901c0192505050919050565b600080806000198587098686029250828110908390030390508061143d576000841161143257600080fd5b508290049050610b89565b80841161144957600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b604080518082019091526000808252602082015290565b600082601f8301126114d9578081fd5b81516114ec6114e782611af5565b611ace565b81815291506020808301908481018184028601820187101561150d57600080fd5b60005b8481101561153557815161152381611b15565b84529282019290820190600101611510565b505050505092915050565b803561060c81611b15565b805161060c81611b15565b8051600681900b811461060c57600080fd5b600060208284031215611579578081fd5b815161060981611b15565b60008060408385031215611596578081fd5b82356115a181611b15565b915060208301356115b181611b2d565b809150509250929050565b600080604083850312156115ce578182fd5b82356115d981611b15565b946020939093013593505050565b600060208083850312156115f9578182fd5b823567ffffffffffffffff81111561160f578283fd5b8301601f8101851361161f578283fd5b803561162d6114e782611af5565b8181528381019083850185840285018601891015611649578687fd5b8694505b838510156116735761165f8982611540565b83526001949094019391850191850161164d565b50979650505050505050565b60006020808385031215611691578182fd5b825167ffffffffffffffff8111156116a7578283fd5b8301601f810185136116b7578283fd5b80516116c56114e782611af5565b81815283810190838501858402850186018910156116e1578687fd5b8694505b83851015611673576116f7898261154b565b8352600194909401939185019185016116e5565b6000806040838503121561171d578182fd5b825167ffffffffffffffff80821115611734578384fd5b818501915085601f830112611747578384fd5b81516117556114e782611af5565b80828252602080830192508086018a828387028901011115611775578889fd5b8896505b8487101561179f5761178b8b82611556565b845260019690960195928101928101611779565b5088015190965093505050808211156117b6578283fd5b506117c3858286016114c9565b9150509250929050565b600080600080600060a086880312156117e4578081fd5b855180151581146117f3578182fd5b602087015190955061180481611b15565b604087015190945060028110611818578182fd5b606087015190935061182981611b2d565b608087015190925061183a81611b3e565b809150509295509295909350565b600060208284031215611859578081fd5b813561060981611b15565b600060208284031215611875578081fd5b813561060981611b2d565b600060208284031215611891578081fd5b5051919050565b6000602082840312156118a9578081fd5b813561060981611b3e565b6000602082840312156118c5578081fd5b815160ff81168114610609578182fd5b6001600160a01b0391909116815260200190565b6001600160a01b03938416815291909216602082015262ffffff909116604082015260600190565b602080825282518282018190526000919060409081850190868401855b8281101561195c57815180516001600160a01b0316855286015186850152928401929085019060010161192e565b5091979650505050505050565b6020808252825182820181905260009190848201906040850190845b818110156119a757835163ffffffff1683529284019291840191600101611985565b50909695505050505050565b6000602080835283518082850152825b818110156119df578581018301518582016040015282016119c3565b818111156119f05783604083870101525b50601f01601f1916929092016040019392505050565b6020808252600c908201526b2737ba1030b71037bbb732b960a11b604082015260600190565b602080825260029082015261042560f41b604082015260600190565b6020808252600190820152601560fa1b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b62ffffff91909116815260200190565b90815260200190565b63ffffffff91909116815260200190565b60405181810167ffffffffffffffff81118282101715611aed57600080fd5b604052919050565b600067ffffffffffffffff821115611b0b578081fd5b5060209081020190565b6001600160a01b0381168114611b2a57600080fd5b50565b62ffffff81168114611b2a57600080fd5b63ffffffff81168114611b2a57600080fdfea2646970667358221220e716ce7751ca9331e897d31f3744c6916e2f742be6df42551b069b566751df4c64736f6c634300060c0033"; +const isSuperArgs$r = (xs) => xs.length > 1; +class TestnetFeeManager__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$r(args)) { + super(...args); + } else { + super(_abi$M, _bytecode$r, args[0]); + } + } + getDeployTransaction(_torn, _governance, _registry, overrides) { + return super.getDeployTransaction( + _torn, + _governance, + _registry, + overrides || {} + ); + } + deploy(_torn, _governance, _registry, overrides) { + return super.deploy( + _torn, + _governance, + _registry, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$r; + static abi = _abi$M; + static createInterface() { + return new interface_Interface(_abi$M); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$M, runner); + } +} + +const _abi$L = [ + { + inputs: [ + { + internalType: "address", + name: "_logic", + type: "address" + }, + { + internalType: "bytes", + name: "_data", + type: "bytes" + } + ], + stateMutability: "payable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "previousAdmin", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "AdminChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "implementation", + type: "address" + } + ], + name: "Upgraded", + type: "event" + }, + { + stateMutability: "payable", + type: "fallback" + }, + { + inputs: [], + name: "admin", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "callToOwner", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "changeAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "changeOwner", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "delegateToOwner", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "getCurrentOwner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "implementation", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + } + ], + name: "upgradeTo", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "upgradeToAndCall", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + } + ], + name: "upgradeToOwner", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$q = "0x608060405260405162000e6038038062000e60833981810160405260408110156200002957600080fd5b8151602083018051604051929492938301929190846401000000008211156200005157600080fd5b9083019060208201858111156200006757600080fd5b82516401000000008111828201881017156200008257600080fd5b82525081516020918201929091019080838360005b83811015620000b157818101518382015260200162000097565b50505050905090810190601f168015620000df5780820380516001836020036101000a031916815260200191505b50604052508391508290508130828281620000fa82620001ef565b805115620001b8576000826001600160a01b0316826040518082805190602001908083835b60208310620001405780518252601f1990920191602091820191016200011f565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114620001a2576040519150601f19603f3d011682016040523d82523d6000602084013e620001a7565b606091505b5050905080620001b657600080fd5b505b50620001c19050565b620001cc8262000266565b5050505050620001e7336200028a60201b620008ab1760201c565b505062000301565b6200020581620002b660201b620008d51760201c565b620002425760405162461bcd60e51b815260040180806020018281038252603681526020018062000e2a6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b8062000295620002bc565b80546001600160a01b0319166001600160a01b039290921691909117905550565b3b151590565b604080517fb4d03667d60278cc15e9a68fa7679dc39ebe71350c4566a2c23c26580da4e0b3602080830191909152825180830382018152918301909252805191012090565b610b1980620003116000396000f3fe6080604052600436106100955760003560e01c80635c60da1b116100595780635c60da1b146102fe5780638f2839701461032f578063a18a186b14610362578063a6f9dae114610377578063f851a440146103aa576100a4565b806323711ab1146100ac57806323c735f1146101625780632e44e0e0146101955780633659cfe61461024b5780634f1ef2861461027e576100a4565b366100a4576100a26103bf565b005b6100a26103bf565b6100a2600480360360408110156100c257600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100ed57600080fd5b8201836020820111156100ff57600080fd5b8035906020019184600183028401116401000000008311171561012157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506103d9945050505050565b34801561016e57600080fd5b506100a26004803603602081101561018557600080fd5b50356001600160a01b03166104e7565b6100a2600480360360408110156101ab57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156101d657600080fd5b8201836020820111156101e857600080fd5b8035906020019184600183028401116401000000008311171561020a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610546945050505050565b34801561025757600080fd5b506100a26004803603602081101561026e57600080fd5b50356001600160a01b031661063a565b6100a26004803603604081101561029457600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156102bf57600080fd5b8201836020820111156102d157600080fd5b803590602001918460018302840111640100000000831117156102f357600080fd5b509092509050610671565b34801561030a57600080fd5b5061031361071e565b604080516001600160a01b039092168252519081900360200190f35b34801561033b57600080fd5b506100a26004803603602081101561035257600080fd5b50356001600160a01b031661075b565b34801561036e57600080fd5b50610313610815565b34801561038357600080fd5b506100a26004803603602081101561039a57600080fd5b50356001600160a01b0316610824565b3480156103b657600080fd5b50610313610880565b6103c76103d7565b6103d76103d26108db565b610900565b565b336103e2610924565b6001600160a01b03161461042c576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b6020831061046a5780518252601f19909201916020918201910161044b565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146104ca576040519150601f19603f3d011682016040523d82523d6000602084013e6104cf565b606091505b5091509150816104e157805181602001fd5b50505050565b336104f0610924565b6001600160a01b03161461053a576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b6105438161093d565b50565b3361054f610924565b6001600160a01b031614610599576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b60006060836001600160a01b031634846040518082805190602001908083835b602083106105d85780518252601f1990920191602091820191016105b9565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146104ca576040519150601f19603f3d011682016040523d82523d6000602084013e6104cf565b61064261097d565b6001600160a01b0316336001600160a01b03161415610669576106648161093d565b610543565b6105436103bf565b61067961097d565b6001600160a01b0316336001600160a01b031614156107115761069b8361093d565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146106f8576040519150601f19603f3d011682016040523d82523d6000602084013e6106fd565b606091505b505090508061070b57600080fd5b50610719565b6107196103bf565b505050565b600061072861097d565b6001600160a01b0316336001600160a01b03161415610750576107496108db565b9050610758565b6107586103bf565b90565b61076361097d565b6001600160a01b0316336001600160a01b03161415610669576001600160a01b0381166107c15760405162461bcd60e51b815260040180806020018281038252603a815260200180610a74603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6107ea61097d565b604080516001600160a01b03928316815291841660208301528051918290030190a1610664816109a2565b600061081f610924565b905090565b3361082d610924565b6001600160a01b031614610877576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b610543816108ab565b600061088a61097d565b6001600160a01b0316336001600160a01b031614156107505761074961097d565b806108b46109c6565b80546001600160a01b0319166001600160a01b039290921691909117905550565b3b151590565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561091f573d6000f35b3d6000fd5b600061092e6109c6565b546001600160a01b0316919050565b61094681610a0b565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b604080517fb4d03667d60278cc15e9a68fa7679dc39ebe71350c4566a2c23c26580da4e0b3602080830191909152825180830382018152918301909252805191012090565b610a14816108d5565b610a4f5760405162461bcd60e51b8152600401808060200182810382526036815260200180610aae6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374a2646970667358221220486b8f46c84e133fdcdf09d6e85ae28603a923477471dc965d4d7f5f3634234c64736f6c634300060c00335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374"; +const isSuperArgs$q = (xs) => xs.length > 1; +class TestnetGovernanceProxy__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$q(args)) { + super(...args); + } else { + super(_abi$L, _bytecode$q, args[0]); + } + } + getDeployTransaction(_logic, _data, overrides) { + return super.getDeployTransaction(_logic, _data, overrides || {}); + } + deploy(_logic, _data, overrides) { + return super.deploy(_logic, _data, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$q; + static abi = _abi$L; + static createInterface() { + return new interface_Interface(_abi$L); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$L, + runner + ); + } +} + +var index$r = /*#__PURE__*/Object.freeze({ + __proto__: null, + TestnetAdminProxy__factory: TestnetAdminProxy__factory, + TestnetFeeManager__factory: TestnetFeeManager__factory, + TestnetGovernanceProxy__factory: TestnetGovernanceProxy__factory, + testnetOracleSol: index$s +}); + +const _abi$K = [ + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "lockedBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "userVault", + outputs: [ + { + internalType: "contract ITornadoVault", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +class ITornadoGovernance__factory { + static abi = _abi$K; + static createInterface() { + return new interface_Interface(_abi$K); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$K, runner); + } +} + +const _abi$J = [ + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdrawTorn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +let ITornadoVault__factory$1 = class ITornadoVault__factory { + static abi = _abi$J; + static createInterface() { + return new interface_Interface(_abi$J); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$J, runner); + } +}; + +const _abi$I = [ + { + inputs: [ + { + internalType: "address", + name: "governanceAddress", + type: "address" + }, + { + internalType: "address", + name: "tornAddress", + type: "address" + }, + { + internalType: "address", + name: "_relayerRegistry", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "rewardsClaimed", + type: "uint256" + } + ], + name: "RewardsClaimed", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "rewards", + type: "uint256" + } + ], + name: "RewardsUpdated", + type: "event" + }, + { + inputs: [], + name: "Governance", + outputs: [ + { + internalType: "contract ITornadoGovernance", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "accumulatedRewardPerTorn", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "accumulatedRewardRateOnLastUpdate", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "accumulatedRewards", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "addBurnRewards", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "checkReward", + outputs: [ + { + internalType: "uint256", + name: "rewards", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getReward", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "ratioConstant", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "relayerRegistry", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "setReward", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "amountLockedBeforehand", + type: "uint256" + } + ], + name: "updateRewardsOnLockedBalanceChange", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdrawTorn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$p = "0x6101006040523480156200001257600080fd5b50604051620011e4380380620011e48339810160408190526200003591620000e0565b6001600160601b0319606084811b821660a05283811b821660c05282901b1660e052604080516318160ddd60e01b815290516001600160a01b038416916318160ddd916004808301926020929190829003018186803b1580156200009857600080fd5b505afa158015620000ad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000d3919062000133565b6080525062000165915050565b600080600060608486031215620000f5578283fd5b835162000102816200014c565b602085015190935062000115816200014c565b604085015190925062000128816200014c565b809150509250925092565b60006020828403121562000145578081fd5b5051919050565b6001600160a01b03811681146200016257600080fd5b50565b60805160a05160601c60c05160601c60e05160601c610ff0620001f4600039806101eb52806104f652508061023a52806104815280610574528061084252806108d75250806101b9528061026952806103ab5280610550528061059b52806106e5528061078052806107e452806108f952508061036a528061052c528061065f52806109f55250610ff06000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063adf898a41161008c578063e0d3265211610066578063e0d326521461016d578063e113335f14610175578063eacccaf014610188578063f58073b11461019b576100cf565b8063adf898a41461013f578063c3c90e6414610147578063d7ada20d1461015a576100cf565b8063338610af146100d45780633d18b912146100e957806347ff589d146100f157806373f273fc1461010f57806380a120411461012f5780639453911214610137575b600080fd5b6100e76100e2366004610d78565b6101ae565b005b6100e76103a3565b6100f96104f4565b6040516101069190610dc4565b60405180910390f35b61012261011d366004610cf5565b610518565b6040516101069190610f6c565b61012261052a565b6100f961054e565b6100f9610572565b610122610155366004610cf5565b610596565b610122610168366004610cf5565b6106c2565b6101226106d4565b6100e7610183366004610d11565b6106da565b6100e7610196366004610d11565b610775565b6100e76101a9366004610d78565b6107d9565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061020d5750336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016145b6102325760405162461bcd60e51b815260040161022990610ec5565b60405180910390fd5b61039d6103947f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a082317f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639daafec76040518163ffffffff1660e01b815260040160206040518083038186803b1580156102c057600080fd5b505afa1580156102d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f89190610d5c565b6040518263ffffffff1660e01b81526004016103149190610dc4565b60206040518083038186803b15801561032c57600080fd5b505afa158015610340573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103649190610d90565b61038e847f0000000000000000000000000000000000000000000000000000000000000000610921565b90610964565b600154906109a6565b60015550565b600061044a337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639ae697bf336040518263ffffffff1660e01b81526004016103f59190610dc4565b60206040518083038186803b15801561040d57600080fd5b505afa158015610421573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104459190610d90565b6109cb565b336000908152600360205260409020549091506104689082906109a6565b336000818152600360205260408120559091506104b0907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169083610a85565b336001600160a01b03167ffc30cddea38e2bf4d6ea7d3f9ed3b6ad7f176419f4963bd81318067a4aee73fe826040516104e99190610f6c565b60405180910390a250565b7f000000000000000000000000000000000000000000000000000000000000000081565b60036020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639ae697bf846040518263ffffffff1660e01b81526004016105e59190610dc4565b60206040518083038186803b1580156105fd57600080fd5b505afa158015610611573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106359190610d90565b90508015610697576001600160a01b038316600090815260026020526040902054600154610694917f00000000000000000000000000000000000000000000000000000000000000009161038e91859161068e91610ae0565b90610921565b91505b6001600160a01b0383166000908152600360205260409020546106bb9083906109a6565b9392505050565b60026020526000908152604090205481565b60015481565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146107225760405162461bcd60e51b815260040161022990610e5b565b600061072e83836109cb565b6001600160a01b03841660009081526003602052604090205490915061075490826109a6565b6001600160a01b039093166000908152600360205260409020929092555050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146107bd5760405162461bcd60e51b815260040161022990610e5b565b6001600160a01b03909116600090815260036020526040902055565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108215760405162461bcd60e51b815260040161022990610e5b565b6000198114156108ca576040516370a0823160e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190610877903090600401610dc4565b60206040518083038186803b15801561088f57600080fd5b505afa1580156108a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c79190610d90565b90505b61091e6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f000000000000000000000000000000000000000000000000000000000000000083610a85565b50565b6000826109305750600061095e565b8282028284828161093d57fe5b041461095b5760405162461bcd60e51b815260040161022990610e84565b90505b92915050565b600061095b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610b22565b60008282018381101561095b5760405162461bcd60e51b815260040161022990610e24565b60008115610a27576001600160a01b038316600090815260026020526040902054600154610a24917f00000000000000000000000000000000000000000000000000000000000000009161038e91869161068e91610ae0565b90505b6001546001600160a01b038416600081815260026020526040908190209290925590517f39fe62076cf7adf3c60e355a2da5a4f17a958ca319e8eba385a6c09a8b64901690610a77908490610f6c565b60405180910390a292915050565b610adb8363a9059cbb60e01b8484604051602401610aa4929190610dd8565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b59565b505050565b600061095b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610be8565b60008183610b435760405162461bcd60e51b81526004016102299190610df1565b506000838581610b4f57fe5b0495945050505050565b6060610bae826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c149092919063ffffffff16565b805190915015610adb5780806020019051810190610bcc9190610d3c565b610adb5760405162461bcd60e51b815260040161022990610f22565b60008184841115610c0c5760405162461bcd60e51b81526004016102299190610df1565b505050900390565b6060610c238484600085610c2b565b949350505050565b6060610c3685610cef565b610c525760405162461bcd60e51b815260040161022990610eeb565b60006060866001600160a01b03168587604051610c6f9190610da8565b60006040518083038185875af1925050503d8060008114610cac576040519150601f19603f3d011682016040523d82523d6000602084013e610cb1565b606091505b50915091508115610cc5579150610c239050565b805115610cd55780518082602001fd5b8360405162461bcd60e51b81526004016102299190610df1565b3b151590565b600060208284031215610d06578081fd5b813561095b81610fa5565b60008060408385031215610d23578081fd5b8235610d2e81610fa5565b946020939093013593505050565b600060208284031215610d4d578081fd5b8151801515811461095b578182fd5b600060208284031215610d6d578081fd5b815161095b81610fa5565b600060208284031215610d89578081fd5b5035919050565b600060208284031215610da1578081fd5b5051919050565b60008251610dba818460208701610f75565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6000602082528251806020840152610e10816040850160208701610f75565b601f01601f19169190910160400192915050565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252600f908201526e6f6e6c7920676f7665726e616e636560881b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252600c908201526b1d5b985d5d1a1bdc9a5e995960a21b604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b90815260200190565b60005b83811015610f90578181015183820152602001610f78565b83811115610f9f576000848401525b50505050565b6001600160a01b038116811461091e57600080fdfea2646970667358221220007ef4aab133b842800388614e081de933a2da981d94088bca1e1a924db5174764736f6c634300060c0033"; +const isSuperArgs$p = (xs) => xs.length > 1; +class TornadoStakingRewards__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$p(args)) { + super(...args); + } else { + super(_abi$I, _bytecode$p, args[0]); + } + } + getDeployTransaction(governanceAddress, tornAddress, _relayerRegistry, overrides) { + return super.getDeployTransaction( + governanceAddress, + tornAddress, + _relayerRegistry, + overrides || {} + ); + } + deploy(governanceAddress, tornAddress, _relayerRegistry, overrides) { + return super.deploy( + governanceAddress, + tornAddress, + _relayerRegistry, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$p; + static abi = _abi$I; + static createInterface() { + return new interface_Interface(_abi$I); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$I, + runner + ); + } +} + +var index$q = /*#__PURE__*/Object.freeze({ + __proto__: null, + ITornadoGovernance__factory: ITornadoGovernance__factory, + ITornadoVault__factory: ITornadoVault__factory$1, + TornadoStakingRewards__factory: TornadoStakingRewards__factory +}); + +const _abi$H = [ + { + inputs: [ + { + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + internalType: "uint128", + name: "amount", + type: "uint128" + } + ], + name: "burn", + outputs: [ + { + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount1", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + internalType: "uint128", + name: "amount0Requested", + type: "uint128" + }, + { + internalType: "uint128", + name: "amount1Requested", + type: "uint128" + } + ], + name: "collect", + outputs: [ + { + internalType: "uint128", + name: "amount0", + type: "uint128" + }, + { + internalType: "uint128", + name: "amount1", + type: "uint128" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount1", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "flash", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint16", + name: "observationCardinalityNext", + type: "uint16" + } + ], + name: "increaseObservationCardinalityNext", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint160", + name: "sqrtPriceX96", + type: "uint160" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + internalType: "uint128", + name: "amount", + type: "uint128" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "mint", + outputs: [ + { + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount1", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "bool", + name: "zeroForOne", + type: "bool" + }, + { + internalType: "int256", + name: "amountSpecified", + type: "int256" + }, + { + internalType: "uint160", + name: "sqrtPriceLimitX96", + type: "uint160" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "swap", + outputs: [ + { + internalType: "int256", + name: "amount0", + type: "int256" + }, + { + internalType: "int256", + name: "amount1", + type: "int256" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +class IUniswapV3PoolActions__factory { + static abi = _abi$H; + static createInterface() { + return new interface_Interface(_abi$H); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$H, + runner + ); + } +} + +const _abi$G = [ + { + inputs: [ + { + internalType: "uint32[]", + name: "secondsAgos", + type: "uint32[]" + } + ], + name: "observe", + outputs: [ + { + internalType: "int56[]", + name: "tickCumulatives", + type: "int56[]" + }, + { + internalType: "uint160[]", + name: "secondsPerLiquidityCumulativeX128s", + type: "uint160[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24" + } + ], + name: "snapshotCumulativesInside", + outputs: [ + { + internalType: "int56", + name: "tickCumulativeInside", + type: "int56" + }, + { + internalType: "uint160", + name: "secondsPerLiquidityInsideX128", + type: "uint160" + }, + { + internalType: "uint32", + name: "secondsInside", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IUniswapV3PoolDerivedState__factory { + static abi = _abi$G; + static createInterface() { + return new interface_Interface(_abi$G); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$G, + runner + ); + } +} + +const _abi$F = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + indexed: true, + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + indexed: false, + internalType: "uint128", + name: "amount", + type: "uint128" + }, + { + indexed: false, + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "amount1", + type: "uint256" + } + ], + name: "Burn", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "recipient", + type: "address" + }, + { + indexed: true, + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + indexed: true, + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + indexed: false, + internalType: "uint128", + name: "amount0", + type: "uint128" + }, + { + indexed: false, + internalType: "uint128", + name: "amount1", + type: "uint128" + } + ], + name: "Collect", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "recipient", + type: "address" + }, + { + indexed: false, + internalType: "uint128", + name: "amount0", + type: "uint128" + }, + { + indexed: false, + internalType: "uint128", + name: "amount1", + type: "uint128" + } + ], + name: "CollectProtocol", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "recipient", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "amount1", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "paid0", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "paid1", + type: "uint256" + } + ], + name: "Flash", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint16", + name: "observationCardinalityNextOld", + type: "uint16" + }, + { + indexed: false, + internalType: "uint16", + name: "observationCardinalityNextNew", + type: "uint16" + } + ], + name: "IncreaseObservationCardinalityNext", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint160", + name: "sqrtPriceX96", + type: "uint160" + }, + { + indexed: false, + internalType: "int24", + name: "tick", + type: "int24" + } + ], + name: "Initialize", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "sender", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + indexed: true, + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + indexed: false, + internalType: "uint128", + name: "amount", + type: "uint128" + }, + { + indexed: false, + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "amount1", + type: "uint256" + } + ], + name: "Mint", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint8", + name: "feeProtocol0Old", + type: "uint8" + }, + { + indexed: false, + internalType: "uint8", + name: "feeProtocol1Old", + type: "uint8" + }, + { + indexed: false, + internalType: "uint8", + name: "feeProtocol0New", + type: "uint8" + }, + { + indexed: false, + internalType: "uint8", + name: "feeProtocol1New", + type: "uint8" + } + ], + name: "SetFeeProtocol", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "recipient", + type: "address" + }, + { + indexed: false, + internalType: "int256", + name: "amount0", + type: "int256" + }, + { + indexed: false, + internalType: "int256", + name: "amount1", + type: "int256" + }, + { + indexed: false, + internalType: "uint160", + name: "sqrtPriceX96", + type: "uint160" + }, + { + indexed: false, + internalType: "uint128", + name: "liquidity", + type: "uint128" + }, + { + indexed: false, + internalType: "int24", + name: "tick", + type: "int24" + } + ], + name: "Swap", + type: "event" + } +]; +class IUniswapV3PoolEvents__factory { + static abi = _abi$F; + static createInterface() { + return new interface_Interface(_abi$F); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$F, + runner + ); + } +} + +const _abi$E = [ + { + inputs: [], + name: "factory", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "fee", + outputs: [ + { + internalType: "uint24", + name: "", + type: "uint24" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "maxLiquidityPerTick", + outputs: [ + { + internalType: "uint128", + name: "", + type: "uint128" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "tickSpacing", + outputs: [ + { + internalType: "int24", + name: "", + type: "int24" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "token0", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "token1", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IUniswapV3PoolImmutables__factory { + static abi = _abi$E; + static createInterface() { + return new interface_Interface(_abi$E); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$E, + runner + ); + } +} + +const _abi$D = [ + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint128", + name: "amount0Requested", + type: "uint128" + }, + { + internalType: "uint128", + name: "amount1Requested", + type: "uint128" + } + ], + name: "collectProtocol", + outputs: [ + { + internalType: "uint128", + name: "amount0", + type: "uint128" + }, + { + internalType: "uint128", + name: "amount1", + type: "uint128" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint8", + name: "feeProtocol0", + type: "uint8" + }, + { + internalType: "uint8", + name: "feeProtocol1", + type: "uint8" + } + ], + name: "setFeeProtocol", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class IUniswapV3PoolOwnerActions__factory { + static abi = _abi$D; + static createInterface() { + return new interface_Interface(_abi$D); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$D, + runner + ); + } +} + +const _abi$C = [ + { + inputs: [], + name: "feeGrowthGlobal0X128", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "feeGrowthGlobal1X128", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "liquidity", + outputs: [ + { + internalType: "uint128", + name: "", + type: "uint128" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "index", + type: "uint256" + } + ], + name: "observations", + outputs: [ + { + internalType: "uint32", + name: "blockTimestamp", + type: "uint32" + }, + { + internalType: "int56", + name: "tickCumulative", + type: "int56" + }, + { + internalType: "uint160", + name: "secondsPerLiquidityCumulativeX128", + type: "uint160" + }, + { + internalType: "bool", + name: "initialized", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "key", + type: "bytes32" + } + ], + name: "positions", + outputs: [ + { + internalType: "uint128", + name: "_liquidity", + type: "uint128" + }, + { + internalType: "uint256", + name: "feeGrowthInside0LastX128", + type: "uint256" + }, + { + internalType: "uint256", + name: "feeGrowthInside1LastX128", + type: "uint256" + }, + { + internalType: "uint128", + name: "tokensOwed0", + type: "uint128" + }, + { + internalType: "uint128", + name: "tokensOwed1", + type: "uint128" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "protocolFees", + outputs: [ + { + internalType: "uint128", + name: "token0", + type: "uint128" + }, + { + internalType: "uint128", + name: "token1", + type: "uint128" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "slot0", + outputs: [ + { + internalType: "uint160", + name: "sqrtPriceX96", + type: "uint160" + }, + { + internalType: "int24", + name: "tick", + type: "int24" + }, + { + internalType: "uint16", + name: "observationIndex", + type: "uint16" + }, + { + internalType: "uint16", + name: "observationCardinality", + type: "uint16" + }, + { + internalType: "uint16", + name: "observationCardinalityNext", + type: "uint16" + }, + { + internalType: "uint8", + name: "feeProtocol", + type: "uint8" + }, + { + internalType: "bool", + name: "unlocked", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "int16", + name: "wordPosition", + type: "int16" + } + ], + name: "tickBitmap", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "int24", + name: "tick", + type: "int24" + } + ], + name: "ticks", + outputs: [ + { + internalType: "uint128", + name: "liquidityGross", + type: "uint128" + }, + { + internalType: "int128", + name: "liquidityNet", + type: "int128" + }, + { + internalType: "uint256", + name: "feeGrowthOutside0X128", + type: "uint256" + }, + { + internalType: "uint256", + name: "feeGrowthOutside1X128", + type: "uint256" + }, + { + internalType: "int56", + name: "tickCumulativeOutside", + type: "int56" + }, + { + internalType: "uint160", + name: "secondsPerLiquidityOutsideX128", + type: "uint160" + }, + { + internalType: "uint32", + name: "secondsOutside", + type: "uint32" + }, + { + internalType: "bool", + name: "initialized", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IUniswapV3PoolState__factory { + static abi = _abi$C; + static createInterface() { + return new interface_Interface(_abi$C); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$C, + runner + ); + } +} + +var index$p = /*#__PURE__*/Object.freeze({ + __proto__: null, + IUniswapV3PoolActions__factory: IUniswapV3PoolActions__factory, + IUniswapV3PoolDerivedState__factory: IUniswapV3PoolDerivedState__factory, + IUniswapV3PoolEvents__factory: IUniswapV3PoolEvents__factory, + IUniswapV3PoolImmutables__factory: IUniswapV3PoolImmutables__factory, + IUniswapV3PoolOwnerActions__factory: IUniswapV3PoolOwnerActions__factory, + IUniswapV3PoolState__factory: IUniswapV3PoolState__factory +}); + +const _abi$B = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint24", + name: "fee", + type: "uint24" + }, + { + indexed: true, + internalType: "int24", + name: "tickSpacing", + type: "int24" + } + ], + name: "FeeAmountEnabled", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "oldOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnerChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "token0", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "token1", + type: "address" + }, + { + indexed: true, + internalType: "uint24", + name: "fee", + type: "uint24" + }, + { + indexed: false, + internalType: "int24", + name: "tickSpacing", + type: "int24" + }, + { + indexed: false, + internalType: "address", + name: "pool", + type: "address" + } + ], + name: "PoolCreated", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "tokenA", + type: "address" + }, + { + internalType: "address", + name: "tokenB", + type: "address" + }, + { + internalType: "uint24", + name: "fee", + type: "uint24" + } + ], + name: "createPool", + outputs: [ + { + internalType: "address", + name: "pool", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint24", + name: "fee", + type: "uint24" + }, + { + internalType: "int24", + name: "tickSpacing", + type: "int24" + } + ], + name: "enableFeeAmount", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint24", + name: "fee", + type: "uint24" + } + ], + name: "feeAmountTickSpacing", + outputs: [ + { + internalType: "int24", + name: "", + type: "int24" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "tokenA", + type: "address" + }, + { + internalType: "address", + name: "tokenB", + type: "address" + }, + { + internalType: "uint24", + name: "fee", + type: "uint24" + } + ], + name: "getPool", + outputs: [ + { + internalType: "address", + name: "pool", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_owner", + type: "address" + } + ], + name: "setOwner", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class IUniswapV3Factory__factory { + static abi = _abi$B; + static createInterface() { + return new interface_Interface(_abi$B); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$B, runner); + } +} + +const _abi$A = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + indexed: true, + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + indexed: false, + internalType: "uint128", + name: "amount", + type: "uint128" + }, + { + indexed: false, + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "amount1", + type: "uint256" + } + ], + name: "Burn", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "recipient", + type: "address" + }, + { + indexed: true, + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + indexed: true, + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + indexed: false, + internalType: "uint128", + name: "amount0", + type: "uint128" + }, + { + indexed: false, + internalType: "uint128", + name: "amount1", + type: "uint128" + } + ], + name: "Collect", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "recipient", + type: "address" + }, + { + indexed: false, + internalType: "uint128", + name: "amount0", + type: "uint128" + }, + { + indexed: false, + internalType: "uint128", + name: "amount1", + type: "uint128" + } + ], + name: "CollectProtocol", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "recipient", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "amount1", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "paid0", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "paid1", + type: "uint256" + } + ], + name: "Flash", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint16", + name: "observationCardinalityNextOld", + type: "uint16" + }, + { + indexed: false, + internalType: "uint16", + name: "observationCardinalityNextNew", + type: "uint16" + } + ], + name: "IncreaseObservationCardinalityNext", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint160", + name: "sqrtPriceX96", + type: "uint160" + }, + { + indexed: false, + internalType: "int24", + name: "tick", + type: "int24" + } + ], + name: "Initialize", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "sender", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + indexed: true, + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + indexed: false, + internalType: "uint128", + name: "amount", + type: "uint128" + }, + { + indexed: false, + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "amount1", + type: "uint256" + } + ], + name: "Mint", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint8", + name: "feeProtocol0Old", + type: "uint8" + }, + { + indexed: false, + internalType: "uint8", + name: "feeProtocol1Old", + type: "uint8" + }, + { + indexed: false, + internalType: "uint8", + name: "feeProtocol0New", + type: "uint8" + }, + { + indexed: false, + internalType: "uint8", + name: "feeProtocol1New", + type: "uint8" + } + ], + name: "SetFeeProtocol", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "recipient", + type: "address" + }, + { + indexed: false, + internalType: "int256", + name: "amount0", + type: "int256" + }, + { + indexed: false, + internalType: "int256", + name: "amount1", + type: "int256" + }, + { + indexed: false, + internalType: "uint160", + name: "sqrtPriceX96", + type: "uint160" + }, + { + indexed: false, + internalType: "uint128", + name: "liquidity", + type: "uint128" + }, + { + indexed: false, + internalType: "int24", + name: "tick", + type: "int24" + } + ], + name: "Swap", + type: "event" + }, + { + inputs: [ + { + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + internalType: "uint128", + name: "amount", + type: "uint128" + } + ], + name: "burn", + outputs: [ + { + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount1", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + internalType: "uint128", + name: "amount0Requested", + type: "uint128" + }, + { + internalType: "uint128", + name: "amount1Requested", + type: "uint128" + } + ], + name: "collect", + outputs: [ + { + internalType: "uint128", + name: "amount0", + type: "uint128" + }, + { + internalType: "uint128", + name: "amount1", + type: "uint128" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint128", + name: "amount0Requested", + type: "uint128" + }, + { + internalType: "uint128", + name: "amount1Requested", + type: "uint128" + } + ], + name: "collectProtocol", + outputs: [ + { + internalType: "uint128", + name: "amount0", + type: "uint128" + }, + { + internalType: "uint128", + name: "amount1", + type: "uint128" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "factory", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "fee", + outputs: [ + { + internalType: "uint24", + name: "", + type: "uint24" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "feeGrowthGlobal0X128", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "feeGrowthGlobal1X128", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount1", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "flash", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint16", + name: "observationCardinalityNext", + type: "uint16" + } + ], + name: "increaseObservationCardinalityNext", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint160", + name: "sqrtPriceX96", + type: "uint160" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "liquidity", + outputs: [ + { + internalType: "uint128", + name: "", + type: "uint128" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "maxLiquidityPerTick", + outputs: [ + { + internalType: "uint128", + name: "", + type: "uint128" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + internalType: "uint128", + name: "amount", + type: "uint128" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "mint", + outputs: [ + { + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount1", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "index", + type: "uint256" + } + ], + name: "observations", + outputs: [ + { + internalType: "uint32", + name: "blockTimestamp", + type: "uint32" + }, + { + internalType: "int56", + name: "tickCumulative", + type: "int56" + }, + { + internalType: "uint160", + name: "secondsPerLiquidityCumulativeX128", + type: "uint160" + }, + { + internalType: "bool", + name: "initialized", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint32[]", + name: "secondsAgos", + type: "uint32[]" + } + ], + name: "observe", + outputs: [ + { + internalType: "int56[]", + name: "tickCumulatives", + type: "int56[]" + }, + { + internalType: "uint160[]", + name: "secondsPerLiquidityCumulativeX128s", + type: "uint160[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "key", + type: "bytes32" + } + ], + name: "positions", + outputs: [ + { + internalType: "uint128", + name: "_liquidity", + type: "uint128" + }, + { + internalType: "uint256", + name: "feeGrowthInside0LastX128", + type: "uint256" + }, + { + internalType: "uint256", + name: "feeGrowthInside1LastX128", + type: "uint256" + }, + { + internalType: "uint128", + name: "tokensOwed0", + type: "uint128" + }, + { + internalType: "uint128", + name: "tokensOwed1", + type: "uint128" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "protocolFees", + outputs: [ + { + internalType: "uint128", + name: "token0", + type: "uint128" + }, + { + internalType: "uint128", + name: "token1", + type: "uint128" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint8", + name: "feeProtocol0", + type: "uint8" + }, + { + internalType: "uint8", + name: "feeProtocol1", + type: "uint8" + } + ], + name: "setFeeProtocol", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "slot0", + outputs: [ + { + internalType: "uint160", + name: "sqrtPriceX96", + type: "uint160" + }, + { + internalType: "int24", + name: "tick", + type: "int24" + }, + { + internalType: "uint16", + name: "observationIndex", + type: "uint16" + }, + { + internalType: "uint16", + name: "observationCardinality", + type: "uint16" + }, + { + internalType: "uint16", + name: "observationCardinalityNext", + type: "uint16" + }, + { + internalType: "uint8", + name: "feeProtocol", + type: "uint8" + }, + { + internalType: "bool", + name: "unlocked", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24" + } + ], + name: "snapshotCumulativesInside", + outputs: [ + { + internalType: "int56", + name: "tickCumulativeInside", + type: "int56" + }, + { + internalType: "uint160", + name: "secondsPerLiquidityInsideX128", + type: "uint160" + }, + { + internalType: "uint32", + name: "secondsInside", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "bool", + name: "zeroForOne", + type: "bool" + }, + { + internalType: "int256", + name: "amountSpecified", + type: "int256" + }, + { + internalType: "uint160", + name: "sqrtPriceLimitX96", + type: "uint160" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "swap", + outputs: [ + { + internalType: "int256", + name: "amount0", + type: "int256" + }, + { + internalType: "int256", + name: "amount1", + type: "int256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "int16", + name: "wordPosition", + type: "int16" + } + ], + name: "tickBitmap", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "tickSpacing", + outputs: [ + { + internalType: "int24", + name: "", + type: "int24" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "int24", + name: "tick", + type: "int24" + } + ], + name: "ticks", + outputs: [ + { + internalType: "uint128", + name: "liquidityGross", + type: "uint128" + }, + { + internalType: "int128", + name: "liquidityNet", + type: "int128" + }, + { + internalType: "uint256", + name: "feeGrowthOutside0X128", + type: "uint256" + }, + { + internalType: "uint256", + name: "feeGrowthOutside1X128", + type: "uint256" + }, + { + internalType: "int56", + name: "tickCumulativeOutside", + type: "int56" + }, + { + internalType: "uint160", + name: "secondsPerLiquidityOutsideX128", + type: "uint160" + }, + { + internalType: "uint32", + name: "secondsOutside", + type: "uint32" + }, + { + internalType: "bool", + name: "initialized", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "token0", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "token1", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IUniswapV3Pool__factory { + static abi = _abi$A; + static createInterface() { + return new interface_Interface(_abi$A); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$A, runner); + } +} + +var index$o = /*#__PURE__*/Object.freeze({ + __proto__: null, + IUniswapV3Factory__factory: IUniswapV3Factory__factory, + IUniswapV3Pool__factory: IUniswapV3Pool__factory, + pool: index$p +}); + +var index$n = /*#__PURE__*/Object.freeze({ + __proto__: null, + interfaces: index$o +}); + +var index$m = /*#__PURE__*/Object.freeze({ + __proto__: null, + contracts: index$n +}); + +var index$l = /*#__PURE__*/Object.freeze({ + __proto__: null, + v3Core: index$m +}); + +const _abi$z = [ + { + inputs: [], + name: "denomination", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "commitment", + type: "bytes32" + } + ], + name: "deposit", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "token", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "proof", + type: "bytes" + }, + { + internalType: "bytes32", + name: "root", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "nullifierHash", + type: "bytes32" + }, + { + internalType: "address payable", + name: "recipient", + type: "address" + }, + { + internalType: "address payable", + name: "relayer", + type: "address" + }, + { + internalType: "uint256", + name: "fee", + type: "uint256" + }, + { + internalType: "uint256", + name: "refund", + type: "uint256" + } + ], + name: "withdraw", + outputs: [], + stateMutability: "payable", + type: "function" + } +]; +class ITornadoInstance__factory { + static abi = _abi$z; + static createInterface() { + return new interface_Interface(_abi$z); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$z, runner); + } +} + +var index$k = /*#__PURE__*/Object.freeze({ + __proto__: null, + ITornadoInstance__factory: ITornadoInstance__factory +}); + +const _abi$y = [ + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IERC20Decimals__factory { + static abi = _abi$y; + static createInterface() { + return new interface_Interface(_abi$y); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$y, runner); + } +} + +var index$j = /*#__PURE__*/Object.freeze({ + __proto__: null, + IERC20Decimals__factory: IERC20Decimals__factory +}); + +var index$i = /*#__PURE__*/Object.freeze({ + __proto__: null, + uniswapV3OracleHelperSol: index$j +}); + +const _abi$x = [ + { + inputs: [], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "text", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "value", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$o = "0x608060405234801561001057600080fd5b50610278806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631f1bd692146100465780633fa4f245146100c35780638129fc1c146100dd575b600080fd5b61004e6100e7565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610088578181015183820152602001610070565b50505050905090810190601f1680156100b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100cb610174565b60408051918252519081900360200190f35b6100e561017a565b005b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561016c5780601f106101415761010080835404028352916020019161016c565b820191906000526020600020905b81548152906001019060200180831161014f57829003601f168201915b505050505081565b60005481565b600160008190556040805180820190915260058082526464756d6d7960d81b60209092019182526101ac9291906101af565b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106101f057805160ff191683800117855561021d565b8280016001018555821561021d579182015b8281111561021d578251825591602001919060010190610202565b5061022992915061022d565b5090565b5b80821115610229576000815560010161022e56fea26469706673582212204b4d54284aeff9c7c570415da4a9efb9bf7115fe94a322210f9981c1c7ae107a64736f6c634300060c0033"; +const isSuperArgs$o = (xs) => xs.length > 1; +class Dummy__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$o(args)) { + super(...args); + } else { + super(_abi$x, _bytecode$o, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$o; + static abi = _abi$x; + static createInterface() { + return new interface_Interface(_abi$x); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$x, runner); + } +} + +const _abi$w = [ + { + inputs: [], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "text", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "value", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$n = "0x608060405234801561001057600080fd5b50610278806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631f1bd692146100465780633fa4f245146100c35780638129fc1c146100dd575b600080fd5b61004e6100e7565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610088578181015183820152602001610070565b50505050905090810190601f1680156100b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100cb610174565b60408051918252519081900360200190f35b6100e561017a565b005b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561016c5780601f106101415761010080835404028352916020019161016c565b820191906000526020600020905b81548152906001019060200180831161014f57829003601f168201915b505050505081565b60005481565b600260005560408051808201909152600680825265323ab6b6bc9960d11b60209092019182526101ac916001916101af565b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106101f057805160ff191683800117855561021d565b8280016001018555821561021d579182015b8281111561021d578251825591602001919060010190610202565b5061022992915061022d565b5090565b5b80821115610229576000815560010161022e56fea2646970667358221220056d994e19772e421a19f4bcf8cb09061d5645867c4c352106bf6b809fb5de3664736f6c634300060c0033"; +const isSuperArgs$n = (xs) => xs.length > 1; +class DummySecond__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$n(args)) { + super(...args); + } else { + super(_abi$w, _bytecode$n, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$n; + static abi = _abi$w; + static createInterface() { + return new interface_Interface(_abi$w); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$w, runner); + } +} + +var index$h = /*#__PURE__*/Object.freeze({ + __proto__: null, + DummySecond__factory: DummySecond__factory, + Dummy__factory: Dummy__factory +}); + +const _abi$v = [ + { + inputs: [ + { + internalType: "uint256", + name: "delay", + type: "uint256" + } + ], + name: "setExecutionDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class IGovernance__factory { + static abi = _abi$v; + static createInterface() { + return new interface_Interface(_abi$v); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$v, runner); + } +} + +const _abi$u = [ + { + inputs: [], + name: "executeProposal", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$m = "0x608060405234801561001057600080fd5b5060c48061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063373058b814602d575b600080fd5b60336035565b005b6040805163e4917d9f60e01b81526203f48060048201529051309163e4917d9f91602480830192600092919082900301818387803b158015607557600080fd5b505af11580156088573d6000803e3d6000fd5b5050505056fea264697066735822122080cc4a797d58ff69ba6d6a0d2a3849574ef67da2d75c41e66a86d3f6e162209d64736f6c634300060c0033"; +const isSuperArgs$m = (xs) => xs.length > 1; +class ProposalStateChangeGovernance__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$m(args)) { + super(...args); + } else { + super(_abi$u, _bytecode$m, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$m; + static abi = _abi$u; + static createInterface() { + return new interface_Interface(_abi$u); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$u, + runner + ); + } +} + +var index$g = /*#__PURE__*/Object.freeze({ + __proto__: null, + IGovernance__factory: IGovernance__factory, + ProposalStateChangeGovernance__factory: ProposalStateChangeGovernance__factory +}); + +const _abi$t = [ + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + } + ], + name: "upgradeTo", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class IProxy__factory { + static abi = _abi$t; + static createInterface() { + return new interface_Interface(_abi$t); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$t, runner); + } +} + +const _abi$s = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + } + ], + name: "Delegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "x", + type: "uint256" + } + ], + name: "Overriden", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "proposer", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + indexed: false, + internalType: "string", + name: "description", + type: "string" + } + ], + name: "ProposalCreated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "ProposalExecuted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + } + ], + name: "Undelegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "voter", + type: "address" + }, + { + indexed: true, + internalType: "bool", + name: "support", + type: "bool" + }, + { + indexed: false, + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + name: "Voted", + type: "event" + }, + { + inputs: [], + name: "CLOSING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_EXPIRATION", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PROPOSAL_THRESHOLD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "QUORUM_VOTES", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTE_EXTEND_TIME", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "canWithdrawAfter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "from", + type: "address[]" + }, + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castDelegatedVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + } + ], + name: "delegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "delegatedTo", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "execute", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "voter", + type: "address" + } + ], + name: "getReceipt", + outputs: [ + { + components: [ + { + internalType: "bool", + name: "hasVoted", + type: "bool" + }, + { + internalType: "bool", + name: "support", + type: "bool" + }, + { + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + internalType: "struct Governance.Receipt", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "latestProposalIds", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "lock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "lockWithApproval", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "lockedBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "newVariable", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "proposalCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "proposals", + outputs: [ + { + internalType: "address", + name: "proposer", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "forVotes", + type: "uint256" + }, + { + internalType: "uint256", + name: "againstVotes", + type: "uint256" + }, + { + internalType: "bool", + name: "executed", + type: "bool" + }, + { + internalType: "bool", + name: "extended", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "propose", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "proposeByDelegate", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "closingPeriod", + type: "uint256" + } + ], + name: "setClosingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionDelay", + type: "uint256" + } + ], + name: "setExecutionDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionExpiration", + type: "uint256" + } + ], + name: "setExecutionExpiration", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalThreshold", + type: "uint256" + } + ], + name: "setProposalThreshold", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "quorumVotes", + type: "uint256" + } + ], + name: "setQuorumVotes", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "time_", + type: "uint256" + } + ], + name: "setTimestamp", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "torna", + type: "address" + } + ], + name: "setTorn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "voteExtendTime", + type: "uint256" + } + ], + name: "setVoteExtendTime", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingDelay", + type: "uint256" + } + ], + name: "setVotingDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingPeriod", + type: "uint256" + } + ], + name: "setVotingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "state", + outputs: [ + { + internalType: "enum Governance.ProposalState", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "time", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract TORN", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "undelegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "unlock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$l = "0x6080604052426041553480156200001557600080fd5b50600054610100900460ff168062000032575062000032620000cd565b8062000041575060005460ff16155b620000695760405162461bcd60e51b8152600401620000609062000114565b60405180910390fd5b600054610100900460ff1615801562000095576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000b3620000d3565b8015620000c6576000805461ff00191690555b5062000162565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6123ac80620001726000396000f3fe60806040526004361061023b5760003560e01c8063a0a2b5731161012e578063ce25d71c116100ab578063e4917d9f1161006f578063e4917d9f14610664578063ea0217cf14610684578063ece40cc1146106a4578063f0b76892146106c4578063fe0d94c1146106e45761023b565b8063ce25d71c146105d8578063d6159fe5146105ed578063d6f0948c14610602578063da35c66414610622578063e23a9a52146106375761023b565b8063b54426c8116100f2578063b54426c814610538578063b5f6a74314610558578063b859f11b14610578578063c0c0e82014610598578063c4d66de8146105b85761023b565b8063a0a2b573146104b9578063a6c26603146104d9578063a72edda3146104ee578063adf898a41461050e578063b1610d7e146105235761023b565b80636198e339116101bc57806370b0f6601161018057806370b0f6601461042f5780638d7a72f31461044f57806392ab89bb146104645780639a9e3b6e146104795780639ae697bf146104995761023b565b80636198e3391461039857806365da1264146103b8578063671dd275146103e55780636a661755146103fa5780636dc2dc6c1461040f5761023b565b806337f135d71161020357806337f135d7146103015780633e4f49e614610316578063587a6ecb1461034357806358e9fff0146103585780635c19a95c146103785761023b565b8063013cf08b1461024057806302ec8f9e1461027d57806315373e3d1461029f57806316ada547146102bf57806317977c61146102e1575b600080fd5b34801561024c57600080fd5b5061026061025b366004611cd6565b6106f7565b604051610274989796959493929190611de5565b60405180910390f35b34801561028957600080fd5b5061029d610298366004611cd6565b61075c565b005b3480156102ab57600080fd5b5061029d6102ba366004611d1a565b610789565b3480156102cb57600080fd5b506102d4610798565b6040516102749190612323565b3480156102ed57600080fd5b506102d46102fc366004611acd565b61079e565b34801561030d57600080fd5b506102d46107b0565b34801561032257600080fd5b50610336610331366004611cd6565b6107b6565b6040516102749190611ea3565b34801561034f57600080fd5b506102d46108f9565b34801561036457600080fd5b506102d4610373366004611ae8565b6108ff565b34801561038457600080fd5b5061029d610393366004611acd565b61094d565b3480156103a457600080fd5b5061029d6103b3366004611cd6565b610a6f565b3480156103c457600080fd5b506103d86103d3366004611acd565b610ba6565b6040516102749190611d94565b3480156103f157600080fd5b506102d4610bc1565b34801561040657600080fd5b506102d4610bc7565b34801561041b57600080fd5b5061029d61042a366004611cd6565b610bcd565b34801561043b57600080fd5b5061029d61044a366004611cd6565b610c12565b34801561045b57600080fd5b506102d4610c36565b34801561047057600080fd5b5061029d610c3c565b34801561048557600080fd5b5061029d610494366004611cd6565b610cc3565b3480156104a557600080fd5b506102d46104b4366004611acd565b610ce7565b3480156104c557600080fd5b5061029d6104d4366004611cd6565b610cf9565b3480156104e557600080fd5b506102d4610cfe565b3480156104fa57600080fd5b506102d4610509366004611acd565b610d04565b34801561051a57600080fd5b506103d8610d16565b34801561052f57600080fd5b506102d4610d25565b34801561054457600080fd5b5061029d610553366004611cd6565b610d2b565b34801561056457600080fd5b5061029d610573366004611acd565b610d35565b34801561058457600080fd5b5061029d610593366004611bf5565b610d57565b3480156105a457600080fd5b5061029d6105b3366004611cd6565b610e0e565b3480156105c457600080fd5b5061029d6105d3366004611acd565b610e32565b3480156105e457600080fd5b506102d4611075565b3480156105f957600080fd5b506102d461107b565b34801561060e57600080fd5b506102d461061d366004611b48565b611081565b34801561062e57600080fd5b506102d4611097565b34801561064357600080fd5b50610657610652366004611cee565b6110a1565b60405161027491906122fe565b34801561067057600080fd5b5061029d61067f366004611cd6565b611113565b34801561069057600080fd5b5061029d61069f366004611cd6565b611137565b3480156106b057600080fd5b5061029d6106bf366004611cd6565b61115b565b3480156106d057600080fd5b5061029d6106df366004611b96565b61117f565b61029d6106f2366004611cd6565b6111ff565b603d818154811061070457fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b3330146107845760405162461bcd60e51b815260040161077b90612101565b60405180910390fd5b603555565b610794338383611240565b5050565b60415481565b603e6020526000908152604090205481565b60335481565b60006107c0611097565b82111580156107cf5750600082115b6107eb5760405162461bcd60e51b815260040161077b90612237565b6000603d83815481106107fa57fe5b906000526020600020906008020190508060020154610817611471565b116108265760009150506108f4565b8060030154610833611471565b116108425760019150506108f4565b8060050154816004015411158061086457506035548160050154826004015401105b156108735760029150506108f4565b600681015460ff161561088a5760059150506108f4565b6108af6034546108a9603354846003015461147790919063ffffffff16565b90611477565b6108b7611471565b106108c65760069150506108f4565b60335460038201546108d791611477565b6108df611471565b106108ee5760049150506108f4565b60039150505b919050565b603a5481565b6001600160a01b038381166000908152603c6020526040812054909116331461093a5760405162461bcd60e51b815260040161077b906122c7565b61094584848461149c565b949350505050565b336000818152603c60205260409020546001600160a01b03908116919083161480159061098357506001600160a01b0382163014155b801561099757506001600160a01b03821615155b80156109b55750806001600160a01b0316826001600160a01b031614155b6109d15760405162461bcd60e51b815260040161077b90612138565b6001600160a01b03811615610a17576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000908152603f6020526040902054610a87611471565b11610aa45760405162461bcd60e51b815260040161077b90612064565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054610af29183906117ea565b336000818152603b602052604090819020929092558154915163a9059cbb60e01b81526001600160a01b039092169163a9059cbb91610b35918590600401611da8565b602060405180830381600087803b158015610b4f57600080fd5b505af1158015610b63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b879190611cba565b610ba35760405162461bcd60e51b815260040161077b9061209b565b50565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610bec5760405162461bcd60e51b815260040161077b90612101565b6033548110610c0d5760405162461bcd60e51b815260040161077b90612020565b603a55565b333014610c315760405162461bcd60e51b815260040161077b90612101565b603755565b60425481565b336000908152603c60205260409020546001600160a01b031680610c725760405162461bcd60e51b815260040161077b9061227d565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b333014610ce25760405162461bcd60e51b815260040161077b90612101565b603455565b603b6020526000908152604090205481565b604155565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b610ba33382611816565b604080546001600160a01b0319166001600160a01b0392909216919091179055565b60005b8351811015610de857336001600160a01b0316603c6000868481518110610d7d57fe5b6020908102919091018101516001600160a01b03908116835290820192909252604001600020541614610dc25760405162461bcd60e51b815260040161077b906122c7565b610de0848281518110610dd157fe5b60200260200101518484611240565b600101610d5a565b50336000908152603b602052604090205415610e0957610e09338383611240565b505050565b333014610e2d5760405162461bcd60e51b815260040161077b90612101565b603955565b600054610100900460ff1680610e4b5750610e4b6118fb565b80610e59575060005460ff16155b610e755760405162461bcd60e51b815260040161077b906121e9565b600054610100900460ff16158015610ea0576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff199094169390931716919091179055611060611901565b8015610794576000805461ff00191690555050565b60395481565b60375481565b600061108e33848461149c565b90505b92915050565b603d546000190190565b6110a96119c7565b603d83815481106110b657fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b3330146111325760405162461bcd60e51b815260040161077b90612101565b603355565b3330146111565760405162461bcd60e51b815260040161077b90612101565b603855565b33301461117a5760405162461bcd60e51b815260040161077b90612101565b603655565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf906111bb90899030908a908a908a908a908a90600401611e2b565b600060405180830381600087803b1580156111d557600080fd5b505af11580156111e9573d6000803e3d6000fd5b505050506111f78686611816565b505050505050565b6103e76042556040517fc22c84ebcf25b30190d2b53474def7b552efd2018ef8acaf6bed1b67e8d2be7c90611235908390612323565b60405180910390a150565b600161124b836107b6565b600681111561125657fe5b146112735760405162461bcd60e51b815260040161077b90611f45565b6000603d838154811061128257fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b9094529190942054929450101590806112e15760405162461bcd60e51b815260040161077b9061216f565b825460ff1615611330578254610100900460ff1615611317576001830154600485015461130d91611942565b6004850155611330565b6001830154600585015461132a91611942565b60058501555b841561134f5760048401546113459082611477565b6004850155611364565b600584015461135e9082611477565b60058501555b6006840154610100900460ff161580156113945750603954611392611387611471565b600387015490611942565b105b156113d85760058401546004850154111582151581146113d65760068501805461ff001916610100179055603a5460038601546113d091611477565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a546003870154611423938b9361141e9391926108a992839190611477565b611984565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b5846040516114609190612323565b60405180910390a450505050505050565b60415490565b60008282018381101561108e5760405162461bcd60e51b815260040161077b90611fe9565b6001600160a01b0383166000908152603b60205260408120546036548110156114d75760405162461bcd60e51b815260040161077b90611f8c565b6114e0846119c1565b6114fc5760405162461bcd60e51b815260040161077b906121a6565b6001600160a01b0385166000908152603e6020526040902054801561156e576000611526826107b6565b9050600181600681111561153657fe5b141580156115505750600081600681111561154d57fe5b14155b61156c5760405162461bcd60e51b815260040161077b90611eca565b505b600061157e6037546108a9611471565b905060006115976038548361147790919063ffffffff16565b90506115a16119e7565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff19909316929092179490941617905590611753611097565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a54929350611795928d9261141e9290916108a9919082908a90611477565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d6040516117d59493929190611e6c565b60405180910390a39998505050505050505050565b6000818484111561180e5760405162461bcd60e51b815260040161077b9190611eb7565b505050900390565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd9061184a90859030908690600401611dc1565b602060405180830381600087803b15801561186457600080fd5b505af1158015611878573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061189c9190611cba565b6118b85760405162461bcd60e51b815260040161077b906120ca565b6001600160a01b0382166000908152603b60205260409020546118db9082611477565b6001600160a01b039092166000908152603b602052604090209190915550565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b600061108e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506117ea565b6001600160a01b0382166000908152603f6020526040902054811115610794576001600160a01b03919091166000908152603f6020526040902055565b3b151590565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b038116811461109157600080fd5b803561109181612368565b600082601f830112611a74578081fd5b813567ffffffffffffffff811115611a8a578182fd5b611a9d601f8201601f191660200161232c565b9150808252836020828501011115611ab457600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215611ade578081fd5b61108e8383611a42565b600080600060608486031215611afc578182fd5b8335611b0781612353565b92506020840135611b1781612353565b9150604084013567ffffffffffffffff811115611b32578182fd5b611b3e86828701611a64565b9150509250925092565b60008060408385031215611b5a578182fd5b8235611b6581612353565b9150602083013567ffffffffffffffff811115611b80578182fd5b611b8c85828601611a64565b9150509250929050565b60008060008060008060c08789031215611bae578182fd5b611bb88888611a42565b95506020870135945060408701359350606087013560ff81168114611bdb578283fd5b9598949750929560808101359460a0909101359350915050565b600080600060608486031215611c09578283fd5b833567ffffffffffffffff80821115611c20578485fd5b818601915086601f830112611c33578485fd5b813581811115611c41578586fd5b60209150818102611c5383820161232c565b8281528381019085850183870186018c1015611c6d57898afd5b8996505b84871015611c9757611c838c82611a42565b835260019690960195918501918501611c71565b5097505050508501359250611cb190508560408601611a59565b90509250925092565b600060208284031215611ccb578081fd5b815161108e81612368565b600060208284031215611ce7578081fd5b5035919050565b60008060408385031215611d00578182fd5b82359150611d118460208501611a42565b90509250929050565b60008060408385031215611d2c578182fd5b823591506020830135611d3e81612368565b809150509250929050565b60008151808452815b81811015611d6e57602081850181015186830182015201611d52565b81811115611d7f5782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b038616825284602083015283604083015260806060830152611e996080830184611d49565b9695505050505050565b6020810160078310611eb157fe5b91905290565b60006020825261108e6020830184611d49565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b6020808252601590820152741513d4938e881d1c985b9cd9995c8819985a5b1959605a1b604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b90815260200190565b60405181810167ffffffffffffffff8111828210171561234b57600080fd5b604052919050565b6001600160a01b0381168114610ba357600080fd5b8015158114610ba357600080fdfea264697066735822122077147b2d24ffd383c4a2d0eb254eb72ba4274421278e284354c4848ff7c9df0164736f6c634300060c0033"; +const isSuperArgs$l = (xs) => xs.length > 1; +class NewImplementation__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$l(args)) { + super(...args); + } else { + super(_abi$s, _bytecode$l, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$l; + static abi = _abi$s; + static createInterface() { + return new interface_Interface(_abi$s); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$s, runner); + } +} + +const _abi$r = [ + { + inputs: [ + { + internalType: "address", + name: "_newLogic", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "executeProposal", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "newLogic", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$k = "0x60a060405234801561001057600080fd5b506040516101da3803806101da83398101604081905261002f91610044565b60601b6001600160601b031916608052610072565b600060208284031215610055578081fd5b81516001600160a01b038116811461006b578182fd5b9392505050565b60805160601c610148610092600039806065528060a252506101486000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806305ccb23e1461003b578063373058b814610059575b600080fd5b610043610063565b60405161005091906100fe565b60405180910390f35b610061610087565b005b7f000000000000000000000000000000000000000000000000000000000000000081565b604051631b2ce7f360e11b81523090633659cfe6906100ca907f0000000000000000000000000000000000000000000000000000000000000000906004016100fe565b600060405180830381600087803b1580156100e457600080fd5b505af11580156100f8573d6000803e3d6000fd5b50505050565b6001600160a01b039190911681526020019056fea26469706673582212207d2c2c988cd8f64fa7efb7ef33cfeee3b01f81a501e4a71ae8a63d6a5e269eb664736f6c634300060c0033"; +const isSuperArgs$k = (xs) => xs.length > 1; +class ProposalUpgrade__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$k(args)) { + super(...args); + } else { + super(_abi$r, _bytecode$k, args[0]); + } + } + getDeployTransaction(_newLogic, overrides) { + return super.getDeployTransaction(_newLogic, overrides || {}); + } + deploy(_newLogic, overrides) { + return super.deploy(_newLogic, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$k; + static abi = _abi$r; + static createInterface() { + return new interface_Interface(_abi$r); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$r, runner); + } +} + +var index$f = /*#__PURE__*/Object.freeze({ + __proto__: null, + IProxy__factory: IProxy__factory, + NewImplementation__factory: NewImplementation__factory, + ProposalUpgrade__factory: ProposalUpgrade__factory +}); + +const _abi$q = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + } + ], + name: "Delegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "proposer", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + indexed: false, + internalType: "string", + name: "description", + type: "string" + } + ], + name: "ProposalCreated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "ProposalExecuted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + } + ], + name: "Undelegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "voter", + type: "address" + }, + { + indexed: true, + internalType: "bool", + name: "support", + type: "bool" + }, + { + indexed: false, + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + name: "Voted", + type: "event" + }, + { + inputs: [], + name: "CLOSING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_EXPIRATION", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PROPOSAL_THRESHOLD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "QUORUM_VOTES", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTE_EXTEND_TIME", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "canWithdrawAfter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "from", + type: "address[]" + }, + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castDelegatedVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + } + ], + name: "delegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "delegatedTo", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "execute", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "voter", + type: "address" + } + ], + name: "getReceipt", + outputs: [ + { + components: [ + { + internalType: "bool", + name: "hasVoted", + type: "bool" + }, + { + internalType: "bool", + name: "support", + type: "bool" + }, + { + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + internalType: "struct Governance.Receipt", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "latestProposalIds", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "lock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "lockWithApproval", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "lockedBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "proposalCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "proposals", + outputs: [ + { + internalType: "address", + name: "proposer", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "forVotes", + type: "uint256" + }, + { + internalType: "uint256", + name: "againstVotes", + type: "uint256" + }, + { + internalType: "bool", + name: "executed", + type: "bool" + }, + { + internalType: "bool", + name: "extended", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "propose", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "proposeByDelegate", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "closingPeriod", + type: "uint256" + } + ], + name: "setClosingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionDelay", + type: "uint256" + } + ], + name: "setExecutionDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionExpiration", + type: "uint256" + } + ], + name: "setExecutionExpiration", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalThreshold", + type: "uint256" + } + ], + name: "setProposalThreshold", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "quorumVotes", + type: "uint256" + } + ], + name: "setQuorumVotes", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "time_", + type: "uint256" + } + ], + name: "setTimestamp", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "torna", + type: "address" + } + ], + name: "setTorn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "voteExtendTime", + type: "uint256" + } + ], + name: "setVoteExtendTime", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingDelay", + type: "uint256" + } + ], + name: "setVotingDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingPeriod", + type: "uint256" + } + ], + name: "setVotingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "state", + outputs: [ + { + internalType: "enum Governance.ProposalState", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "time", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract TORN", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "undelegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "unlock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$j = "0x6080604052426041553480156200001557600080fd5b50600054610100900460ff168062000032575062000032620000cd565b8062000041575060005460ff16155b620000695760405162461bcd60e51b8152600401620000609062000114565b60405180910390fd5b600054610100900460ff1615801562000095576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000b3620000d3565b8015620000c6576000805461ff00191690555b5062000162565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6125c980620001726000396000f3fe6080604052600436106102305760003560e01c8063a0a2b5731161012e578063ce25d71c116100ab578063e4917d9f1161006f578063e4917d9f14610644578063ea0217cf14610664578063ece40cc114610684578063f0b76892146106a4578063fe0d94c1146106c457610230565b8063ce25d71c146105b8578063d6159fe5146105cd578063d6f0948c146105e2578063da35c66414610602578063e23a9a521461061757610230565b8063b54426c8116100f2578063b54426c814610518578063b5f6a74314610538578063b859f11b14610558578063c0c0e82014610578578063c4d66de81461059857610230565b8063a0a2b57314610499578063a6c26603146104b9578063a72edda3146104ce578063adf898a4146104ee578063b1610d7e1461050357610230565b80635c19a95c116101bc5780636dc2dc6c116101805780636dc2dc6c1461040457806370b0f6601461042457806392ab89bb146104445780639a9e3b6e146104595780639ae697bf1461047957610230565b80635c19a95c1461036d5780636198e3391461038d57806365da1264146103ad578063671dd275146103da5780636a661755146103ef57610230565b806317977c611161020357806317977c61146102d657806337f135d7146102f65780633e4f49e61461030b578063587a6ecb1461033857806358e9fff01461034d57610230565b8063013cf08b1461023557806302ec8f9e1461027257806315373e3d1461029457806316ada547146102b4575b600080fd5b34801561024157600080fd5b50610255610250366004611e01565b6106d7565b604051610269989796959493929190611f0d565b60405180910390f35b34801561027e57600080fd5b5061029261028d366004611e01565b61073c565b005b3480156102a057600080fd5b506102926102af366004611e45565b610769565b3480156102c057600080fd5b506102c9610778565b6040516102699190612510565b3480156102e257600080fd5b506102c96102f1366004611bf8565b61077e565b34801561030257600080fd5b506102c9610790565b34801561031757600080fd5b5061032b610326366004611e01565b610796565b6040516102699190611fcb565b34801561034457600080fd5b506102c96108d9565b34801561035957600080fd5b506102c9610368366004611c13565b6108df565b34801561037957600080fd5b50610292610388366004611bf8565b61092d565b34801561039957600080fd5b506102926103a8366004611e01565b610a4f565b3480156103b957600080fd5b506103cd6103c8366004611bf8565b610b86565b6040516102699190611ebc565b3480156103e657600080fd5b506102c9610ba1565b3480156103fb57600080fd5b506102c9610ba7565b34801561041057600080fd5b5061029261041f366004611e01565b610bad565b34801561043057600080fd5b5061029261043f366004611e01565b610bf2565b34801561045057600080fd5b50610292610c16565b34801561046557600080fd5b50610292610474366004611e01565b610c9d565b34801561048557600080fd5b506102c9610494366004611bf8565b610cc1565b3480156104a557600080fd5b506102926104b4366004611e01565b610cd3565b3480156104c557600080fd5b506102c9610cd8565b3480156104da57600080fd5b506102c96104e9366004611bf8565b610cde565b3480156104fa57600080fd5b506103cd610cf0565b34801561050f57600080fd5b506102c9610cff565b34801561052457600080fd5b50610292610533366004611e01565b610d05565b34801561054457600080fd5b50610292610553366004611bf8565b610d0f565b34801561056457600080fd5b50610292610573366004611d20565b610d31565b34801561058457600080fd5b50610292610593366004611e01565b610de8565b3480156105a457600080fd5b506102926105b3366004611bf8565b610e0c565b3480156105c457600080fd5b506102c961104f565b3480156105d957600080fd5b506102c9611055565b3480156105ee57600080fd5b506102c96105fd366004611c73565b61105b565b34801561060e57600080fd5b506102c9611071565b34801561062357600080fd5b50610637610632366004611e19565b61107b565b60405161026991906124eb565b34801561065057600080fd5b5061029261065f366004611e01565b6110ed565b34801561067057600080fd5b5061029261067f366004611e01565b611111565b34801561069057600080fd5b5061029261069f366004611e01565b611135565b3480156106b057600080fd5b506102926106bf366004611cc1565b611159565b6102926106d2366004611e01565b6111d9565b603d81815481106106e457fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b3330146107645760405162461bcd60e51b815260040161075b906122b7565b60405180910390fd5b603555565b61077433838361136b565b5050565b60415481565b603e6020526000908152604090205481565b60335481565b60006107a0611071565b82111580156107af5750600082115b6107cb5760405162461bcd60e51b815260040161075b906123ed565b6000603d83815481106107da57fe5b9060005260206000209060080201905080600201546107f761159c565b116108065760009150506108d4565b806003015461081361159c565b116108225760019150506108d4565b8060050154816004015411158061084457506035548160050154826004015401105b156108535760029150506108d4565b600681015460ff161561086a5760059150506108d4565b61088f60345461088960335484600301546115a290919063ffffffff16565b906115a2565b61089761159c565b106108a65760069150506108d4565b60335460038201546108b7916115a2565b6108bf61159c565b106108ce5760049150506108d4565b60039150505b919050565b603a5481565b6001600160a01b038381166000908152603c6020526040812054909116331461091a5760405162461bcd60e51b815260040161075b9061247d565b6109258484846115c7565b949350505050565b336000818152603c60205260409020546001600160a01b03908116919083161480159061096357506001600160a01b0382163014155b801561097757506001600160a01b03821615155b80156109955750806001600160a01b0316826001600160a01b031614155b6109b15760405162461bcd60e51b815260040161075b906122ee565b6001600160a01b038116156109f7576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000908152603f6020526040902054610a6761159c565b11610a845760405162461bcd60e51b815260040161075b9061221a565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054610ad2918390611915565b336000818152603b602052604090819020929092558154915163a9059cbb60e01b81526001600160a01b039092169163a9059cbb91610b15918590600401611ed0565b602060405180830381600087803b158015610b2f57600080fd5b505af1158015610b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b679190611de5565b610b835760405162461bcd60e51b815260040161075b90612251565b50565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610bcc5760405162461bcd60e51b815260040161075b906122b7565b6033548110610bed5760405162461bcd60e51b815260040161075b906121d6565b603a55565b333014610c115760405162461bcd60e51b815260040161075b906122b7565b603755565b336000908152603c60205260409020546001600160a01b031680610c4c5760405162461bcd60e51b815260040161075b90612433565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b333014610cbc5760405162461bcd60e51b815260040161075b906122b7565b603455565b603b6020526000908152604090205481565b604155565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b610b833382611941565b604080546001600160a01b0319166001600160a01b0392909216919091179055565b60005b8351811015610dc257336001600160a01b0316603c6000868481518110610d5757fe5b6020908102919091018101516001600160a01b03908116835290820192909252604001600020541614610d9c5760405162461bcd60e51b815260040161075b9061247d565b610dba848281518110610dab57fe5b6020026020010151848461136b565b600101610d34565b50336000908152603b602052604090205415610de357610de333838361136b565b505050565b333014610e075760405162461bcd60e51b815260040161075b906122b7565b603955565b600054610100900460ff1680610e255750610e25611a26565b80610e33575060005460ff16155b610e4f5760405162461bcd60e51b815260040161075b9061239f565b600054610100900460ff16158015610e7a576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff19909416939093171691909117905561103a611a2c565b8015610774576000805461ff00191690555050565b60395481565b60375481565b60006110683384846115c7565b90505b92915050565b603d546000190190565b611083611af2565b603d838154811061109057fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b33301461110c5760405162461bcd60e51b815260040161075b906122b7565b603355565b3330146111305760405162461bcd60e51b815260040161075b906122b7565b603855565b3330146111545760405162461bcd60e51b815260040161075b906122b7565b603655565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf9061119590899030908a908a908a908a908a90600401611f53565b600060405180830381600087803b1580156111af57600080fd5b505af11580156111c3573d6000803e3d6000fd5b505050506111d18686611941565b505050505050565b60046111e482610796565b60068111156111ef57fe5b1461120c5760405162461bcd60e51b815260040161075b90612035565b6000603d828154811061121b57fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b031661125681611a6d565b6112725760405162461bcd60e51b815260040161075b90611ff2565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b038516916112b691611ea0565b600060405180830381855af49150503d80600081146112f1576040519150601f19603f3d011682016040523d82523d6000602084013e6112f6565b606091505b50915091508161133957805115611321578060405162461bcd60e51b815260040161075b9190611fdf565b60405162461bcd60e51b815260040161075b906124b4565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b600161137683610796565b600681111561138157fe5b1461139e5760405162461bcd60e51b815260040161075b906120fb565b6000603d83815481106113ad57fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b90945291909420549294501015908061140c5760405162461bcd60e51b815260040161075b90612325565b825460ff161561145b578254610100900460ff1615611442576001830154600485015461143891611a73565b600485015561145b565b6001830154600585015461145591611a73565b60058501555b841561147a57600484015461147090826115a2565b600485015561148f565b600584015461148990826115a2565b60058501555b6006840154610100900460ff161580156114bf57506039546114bd6114b261159c565b600387015490611a73565b105b156115035760058401546004850154111582151581146115015760068501805461ff001916610100179055603a5460038601546114fb916115a2565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a54600387015461154e938b93611549939192610889928391906115a2565b611ab5565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b58460405161158b9190612510565b60405180910390a450505050505050565b60415490565b6000828201838110156110685760405162461bcd60e51b815260040161075b9061219f565b6001600160a01b0383166000908152603b60205260408120546036548110156116025760405162461bcd60e51b815260040161075b90612142565b61160b84611a6d565b6116275760405162461bcd60e51b815260040161075b9061235c565b6001600160a01b0385166000908152603e6020526040902054801561169957600061165182610796565b9050600181600681111561166157fe5b1415801561167b5750600081600681111561167857fe5b14155b6116975760405162461bcd60e51b815260040161075b90612080565b505b60006116a960375461088961159c565b905060006116c2603854836115a290919063ffffffff16565b90506116cc611b12565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff1990931692909217949094161790559061187e611071565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a549293506118c0928d92611549929091610889919082908a906115a2565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d6040516119009493929190611f94565b60405180910390a39998505050505050505050565b600081848411156119395760405162461bcd60e51b815260040161075b9190611fdf565b505050900390565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd9061197590859030908690600401611ee9565b602060405180830381600087803b15801561198f57600080fd5b505af11580156119a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c79190611de5565b6119e35760405162461bcd60e51b815260040161075b90612280565b6001600160a01b0382166000908152603b6020526040902054611a0690826115a2565b6001600160a01b039092166000908152603b602052604090209190915550565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b3b151590565b600061106883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611915565b6001600160a01b0382166000908152603f6020526040902054811115610774576001600160a01b03919091166000908152603f6020526040902055565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b038116811461106b57600080fd5b803561106b81612585565b600082601f830112611b9f578081fd5b813567ffffffffffffffff811115611bb5578182fd5b611bc8601f8201601f1916602001612519565b9150808252836020828501011115611bdf57600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215611c09578081fd5b6110688383611b6d565b600080600060608486031215611c27578182fd5b8335611c3281612570565b92506020840135611c4281612570565b9150604084013567ffffffffffffffff811115611c5d578182fd5b611c6986828701611b8f565b9150509250925092565b60008060408385031215611c85578182fd5b8235611c9081612570565b9150602083013567ffffffffffffffff811115611cab578182fd5b611cb785828601611b8f565b9150509250929050565b60008060008060008060c08789031215611cd9578182fd5b611ce38888611b6d565b95506020870135945060408701359350606087013560ff81168114611d06578283fd5b9598949750929560808101359460a0909101359350915050565b600080600060608486031215611d34578283fd5b833567ffffffffffffffff80821115611d4b578485fd5b818601915086601f830112611d5e578485fd5b813581811115611d6c578586fd5b60209150818102611d7e838201612519565b8281528381019085850183870186018c1015611d9857898afd5b8996505b84871015611dc257611dae8c82611b6d565b835260019690960195918501918501611d9c565b5097505050508501359250611ddc90508560408601611b84565b90509250925092565b600060208284031215611df6578081fd5b815161106881612585565b600060208284031215611e12578081fd5b5035919050565b60008060408385031215611e2b578182fd5b82359150611e3c8460208501611b6d565b90509250929050565b60008060408385031215611e57578182fd5b823591506020830135611e6981612585565b809150509250929050565b60008151808452611e8c816020860160208601612540565b601f01601f19169290920160200192915050565b60008251611eb2818460208701612540565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b038616825284602083015283604083015260806060830152611fc16080830184611e74565b9695505050505050565b6020810160078310611fd957fe5b91905290565b6000602082526110686020830184611e74565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b6020808252601590820152741513d4938e881d1c985b9cd9995c8819985a5b1959605a1b604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b90815260200190565b60405181810167ffffffffffffffff8111828210171561253857600080fd5b604052919050565b60005b8381101561255b578181015183820152602001612543565b8381111561256a576000848401525b50505050565b6001600160a01b0381168114610b8357600080fd5b8015158114610b8357600080fdfea264697066735822122079a24ea0dc3d5ef34041a37a137cef69305763e031faa841e2db8f078345f2af64736f6c634300060c0033"; +const isSuperArgs$j = (xs) => xs.length > 1; +class MockGovernance__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$j(args)) { + super(...args); + } else { + super(_abi$q, _bytecode$j, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$j; + static abi = _abi$q; + static createInterface() { + return new interface_Interface(_abi$q); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$q, runner); + } +} + +const _abi$p = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "output", + type: "address" + } + ], + name: "Debug", + type: "event" + }, + { + inputs: [], + name: "executeProposal", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$i = "0x608060405234801561001057600080fd5b506103d5806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063373058b814610030575b600080fd5b61003861003a565b005b6000604051610048906100fa565b604051809103906000f080158015610064573d6000803e3d6000fd5b509050806001600160a01b0316638129fc1c6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156100a257600080fd5b505af11580156100b6573d6000803e3d6000fd5b5050604080516001600160a01b038516815290517f330da4cde831ccab151372275307c2f0cce2bcce846635cd66e6908f10d203639350908190036020019150a150565b610298806101088339019056fe608060405234801561001057600080fd5b50610278806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631f1bd692146100465780633fa4f245146100c35780638129fc1c146100dd575b600080fd5b61004e6100e7565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610088578181015183820152602001610070565b50505050905090810190601f1680156100b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100cb610174565b60408051918252519081900360200190f35b6100e561017a565b005b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561016c5780601f106101415761010080835404028352916020019161016c565b820191906000526020600020905b81548152906001019060200180831161014f57829003601f168201915b505050505081565b60005481565b600160008190556040805180820190915260058082526464756d6d7960d81b60209092019182526101ac9291906101af565b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106101f057805160ff191683800117855561021d565b8280016001018555821561021d579182015b8281111561021d578251825591602001919060010190610202565b5061022992915061022d565b5090565b5b80821115610229576000815560010161022e56fea26469706673582212204b4d54284aeff9c7c570415da4a9efb9bf7115fe94a322210f9981c1c7ae107a64736f6c634300060c0033a26469706673582212205967b156db23a5fd2372953049f5c366f68a9f95cfa116f9fbd6d0c8e7bdaa6364736f6c634300060c0033"; +const isSuperArgs$i = (xs) => xs.length > 1; +class Proposal__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$i(args)) { + super(...args); + } else { + super(_abi$p, _bytecode$i, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$i; + static abi = _abi$p; + static createInterface() { + return new interface_Interface(_abi$p); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$p, runner); + } +} + +var index$e = /*#__PURE__*/Object.freeze({ + __proto__: null, + MockGovernance__factory: MockGovernance__factory, + Proposal__factory: Proposal__factory, + dummySol: index$h, + proposalStateChangeGovernanceSol: index$g, + proposalUpgradeSol: index$f +}); + +const _abi$o = [ + { + inputs: [], + name: "CLOSING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_EXPIRATION", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PROPOSAL_THRESHOLD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "QUORUM_VOTES", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTE_EXTEND_TIME", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "closingPeriod", + type: "uint256" + } + ], + name: "setClosingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionDelay", + type: "uint256" + } + ], + name: "setExecutionDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionExpiration", + type: "uint256" + } + ], + name: "setExecutionExpiration", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalThreshold", + type: "uint256" + } + ], + name: "setProposalThreshold", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "quorumVotes", + type: "uint256" + } + ], + name: "setQuorumVotes", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "voteExtendTime", + type: "uint256" + } + ], + name: "setVoteExtendTime", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingDelay", + type: "uint256" + } + ], + name: "setVotingDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingPeriod", + type: "uint256" + } + ], + name: "setVotingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$h = "0x608060405234801561001057600080fd5b50610563806100206000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c8063a6c2660311610097578063d6159fe511610066578063d6159fe5146101e2578063e4917d9f146101ea578063ea0217cf14610207578063ece40cc11461022457610100565b8063a6c26603146101ad578063b1610d7e146101b5578063c0c0e820146101bd578063ce25d71c146101da57610100565b80636a661755116100d35780636a6617551461014e5780636dc2dc6c1461015657806370b0f660146101735780639a9e3b6e1461019057610100565b806302ec8f9e1461010557806337f135d714610124578063587a6ecb1461013e578063671dd27514610146575b600080fd5b6101226004803603602081101561011b57600080fd5b5035610241565b005b61012c610288565b60408051918252519081900360200190f35b61012c61028e565b61012c610294565b61012c61029a565b6101226004803603602081101561016c57600080fd5b50356102a0565b6101226004803603602081101561018957600080fd5b5035610327565b610122600480360360208110156101a657600080fd5b503561036e565b61012c6103b5565b61012c6103bb565b610122600480360360208110156101d357600080fd5b50356103c1565b61012c610408565b61012c61040e565b6101226004803603602081101561020057600080fd5b5035610414565b6101226004803603602081101561021d57600080fd5b503561045b565b6101226004803603602081101561023a57600080fd5b50356104a2565b333014610283576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b600255565b60005481565b60075481565b60025481565b60015481565b3330146102e2576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b60005481106103225760405162461bcd60e51b81526004018080602001828103825260248152602001806104ea6024913960400191505060405180910390fd5b600755565b333014610369576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b600455565b3330146103b0576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b600155565b60035481565b60055481565b333014610403576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b600655565b60065481565b60045481565b333014610456576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b600055565b33301461049d576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b600555565b3330146104e4576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b60035556fe476f7665726e616e63653a20696e636f727265637420766f7465457874656e6454696d65476f7665726e616e63653a20756e617574686f72697a65640000000000000000a26469706673582212208fff4d62d622acc801ece8b6a7cc281f67f5959bf09e0ca68afde2a0ab0bc83164736f6c634300060c0033"; +const isSuperArgs$h = (xs) => xs.length > 1; +class Configuration__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$h(args)) { + super(...args); + } else { + super(_abi$o, _bytecode$h, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$h; + static abi = _abi$o; + static createInterface() { + return new interface_Interface(_abi$o); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$o, runner); + } +} + +const _abi$n = [ + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "lockedBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + } +]; +class Core__factory { + static abi = _abi$n; + static createInterface() { + return new interface_Interface(_abi$n); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$n, runner); + } +} + +const _abi$m = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + } + ], + name: "Delegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + } + ], + name: "Undelegated", + type: "event" + }, + { + inputs: [ + { + internalType: "address[]", + name: "from", + type: "address[]" + }, + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castDelegatedVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + } + ], + name: "delegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "delegatedTo", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "lockedBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "proposeByDelegate", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "undelegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class Delegation__factory { + static abi = _abi$m; + static createInterface() { + return new interface_Interface(_abi$m); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$m, runner); + } +} + +const _abi$l = [ + { + inputs: [], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + } + ], + name: "Delegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "proposer", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + indexed: false, + internalType: "string", + name: "description", + type: "string" + } + ], + name: "ProposalCreated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "ProposalExecuted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + } + ], + name: "Undelegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "voter", + type: "address" + }, + { + indexed: true, + internalType: "bool", + name: "support", + type: "bool" + }, + { + indexed: false, + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + name: "Voted", + type: "event" + }, + { + inputs: [], + name: "CLOSING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_EXPIRATION", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PROPOSAL_THRESHOLD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "QUORUM_VOTES", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTE_EXTEND_TIME", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "canWithdrawAfter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "from", + type: "address[]" + }, + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castDelegatedVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + } + ], + name: "delegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "delegatedTo", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "execute", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "voter", + type: "address" + } + ], + name: "getReceipt", + outputs: [ + { + components: [ + { + internalType: "bool", + name: "hasVoted", + type: "bool" + }, + { + internalType: "bool", + name: "support", + type: "bool" + }, + { + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + internalType: "struct Governance.Receipt", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "latestProposalIds", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "lock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "lockWithApproval", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "lockedBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "proposalCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "proposals", + outputs: [ + { + internalType: "address", + name: "proposer", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "forVotes", + type: "uint256" + }, + { + internalType: "uint256", + name: "againstVotes", + type: "uint256" + }, + { + internalType: "bool", + name: "executed", + type: "bool" + }, + { + internalType: "bool", + name: "extended", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "propose", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "proposeByDelegate", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "closingPeriod", + type: "uint256" + } + ], + name: "setClosingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionDelay", + type: "uint256" + } + ], + name: "setExecutionDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionExpiration", + type: "uint256" + } + ], + name: "setExecutionExpiration", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalThreshold", + type: "uint256" + } + ], + name: "setProposalThreshold", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "quorumVotes", + type: "uint256" + } + ], + name: "setQuorumVotes", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "voteExtendTime", + type: "uint256" + } + ], + name: "setVoteExtendTime", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingDelay", + type: "uint256" + } + ], + name: "setVotingDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingPeriod", + type: "uint256" + } + ], + name: "setVotingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "state", + outputs: [ + { + internalType: "enum Governance.ProposalState", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract TORN", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "undelegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "unlock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$g = "0x60806040523480156200001157600080fd5b50600054610100900460ff16806200002e57506200002e620000c9565b806200003d575060005460ff16155b620000655760405162461bcd60e51b81526004016200005c9062000110565b60405180910390fd5b600054610100900460ff1615801562000091576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000af620000cf565b8015620000c2576000805461ff00191690555b506200015e565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b612524806200016e6000396000f3fe60806040526004361061020f5760003560e01c8063a6c2660311610118578063d6159fe5116100a0578063e4917d9f1161006f578063e4917d9f146105ce578063ea0217cf146105ee578063ece40cc11461060e578063f0b768921461062e578063fe0d94c11461064e5761020f565b8063d6159fe514610557578063d6f0948c1461056c578063da35c6641461058c578063e23a9a52146105a15761020f565b8063b54426c8116100e7578063b54426c8146104c2578063b859f11b146104e2578063c0c0e82014610502578063c4d66de814610522578063ce25d71c146105425761020f565b8063a6c2660314610463578063a72edda314610478578063adf898a414610498578063b1610d7e146104ad5761020f565b80636198e3391161019b5780636dc2dc6c1161016a5780636dc2dc6c146103ce57806370b0f660146103ee57806392ab89bb1461040e5780639a9e3b6e146104235780639ae697bf146104435761020f565b80636198e3391461035757806365da126414610377578063671dd275146103a45780636a661755146103b95761020f565b806337f135d7116101e257806337f135d7146102c05780633e4f49e6146102d5578063587a6ecb1461030257806358e9fff0146103175780635c19a95c146103375761020f565b8063013cf08b1461021457806302ec8f9e1461025157806315373e3d1461027357806317977c6114610293575b600080fd5b34801561022057600080fd5b5061023461022f366004611d5c565b610661565b604051610248989796959493929190611e68565b60405180910390f35b34801561025d57600080fd5b5061027161026c366004611d5c565b6106c6565b005b34801561027f57600080fd5b5061027161028e366004611da0565b6106f3565b34801561029f57600080fd5b506102b36102ae366004611b53565b610702565b604051610248919061246b565b3480156102cc57600080fd5b506102b3610714565b3480156102e157600080fd5b506102f56102f0366004611d5c565b61071a565b6040516102489190611f26565b34801561030e57600080fd5b506102b361085d565b34801561032357600080fd5b506102b3610332366004611b6e565b610863565b34801561034357600080fd5b50610271610352366004611b53565b6108b1565b34801561036357600080fd5b50610271610372366004611d5c565b6109d3565b34801561038357600080fd5b50610397610392366004611b53565b610b0a565b6040516102489190611e17565b3480156103b057600080fd5b506102b3610b25565b3480156103c557600080fd5b506102b3610b2b565b3480156103da57600080fd5b506102716103e9366004611d5c565b610b31565b3480156103fa57600080fd5b50610271610409366004611d5c565b610b76565b34801561041a57600080fd5b50610271610b9a565b34801561042f57600080fd5b5061027161043e366004611d5c565b610c21565b34801561044f57600080fd5b506102b361045e366004611b53565b610c45565b34801561046f57600080fd5b506102b3610c57565b34801561048457600080fd5b506102b3610493366004611b53565b610c5d565b3480156104a457600080fd5b50610397610c6f565b3480156104b957600080fd5b506102b3610c7e565b3480156104ce57600080fd5b506102716104dd366004611d5c565b610c84565b3480156104ee57600080fd5b506102716104fd366004611c7b565b610c8e565b34801561050e57600080fd5b5061027161051d366004611d5c565b610d45565b34801561052e57600080fd5b5061027161053d366004611b53565b610d69565b34801561054e57600080fd5b506102b3610fac565b34801561056357600080fd5b506102b3610fb2565b34801561057857600080fd5b506102b3610587366004611bce565b610fb8565b34801561059857600080fd5b506102b3610fce565b3480156105ad57600080fd5b506105c16105bc366004611d74565b610fd8565b6040516102489190612446565b3480156105da57600080fd5b506102716105e9366004611d5c565b61104a565b3480156105fa57600080fd5b50610271610609366004611d5c565b61106e565b34801561061a57600080fd5b50610271610629366004611d5c565b611092565b34801561063a57600080fd5b50610271610649366004611c1c565b6110b6565b61027161065c366004611d5c565b611136565b603d818154811061066e57fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b3330146106ee5760405162461bcd60e51b81526004016106e590612212565b60405180910390fd5b603555565b6106fe3383836112c8565b5050565b603e6020526000908152604090205481565b60335481565b6000610724610fce565b82111580156107335750600082115b61074f5760405162461bcd60e51b81526004016106e590612348565b6000603d838154811061075e57fe5b90600052602060002090600802019050806002015461077b6114f9565b1161078a576000915050610858565b80600301546107976114f9565b116107a6576001915050610858565b806005015481600401541115806107c857506035548160050154826004015401105b156107d7576002915050610858565b600681015460ff16156107ee576005915050610858565b61081360345461080d60335484600301546114fd90919063ffffffff16565b906114fd565b61081b6114f9565b1061082a576006915050610858565b603354600382015461083b916114fd565b6108436114f9565b10610852576004915050610858565b60039150505b919050565b603a5481565b6001600160a01b038381166000908152603c6020526040812054909116331461089e5760405162461bcd60e51b81526004016106e5906123d8565b6108a9848484611522565b949350505050565b336000818152603c60205260409020546001600160a01b0390811691908316148015906108e757506001600160a01b0382163014155b80156108fb57506001600160a01b03821615155b80156109195750806001600160a01b0316826001600160a01b031614155b6109355760405162461bcd60e51b81526004016106e590612249565b6001600160a01b0381161561097b576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000908152603f60205260409020546109eb6114f9565b11610a085760405162461bcd60e51b81526004016106e590612175565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054610a56918390611870565b336000818152603b602052604090819020929092558154915163a9059cbb60e01b81526001600160a01b039092169163a9059cbb91610a99918590600401611e2b565b602060405180830381600087803b158015610ab357600080fd5b505af1158015610ac7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aeb9190611d40565b610b075760405162461bcd60e51b81526004016106e5906121ac565b50565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610b505760405162461bcd60e51b81526004016106e590612212565b6033548110610b715760405162461bcd60e51b81526004016106e590612131565b603a55565b333014610b955760405162461bcd60e51b81526004016106e590612212565b603755565b336000908152603c60205260409020546001600160a01b031680610bd05760405162461bcd60e51b81526004016106e59061238e565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b333014610c405760405162461bcd60e51b81526004016106e590612212565b603455565b603b6020526000908152604090205481565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b610b07338261189c565b60005b8351811015610d1f57336001600160a01b0316603c6000868481518110610cb457fe5b6020908102919091018101516001600160a01b03908116835290820192909252604001600020541614610cf95760405162461bcd60e51b81526004016106e5906123d8565b610d17848281518110610d0857fe5b602002602001015184846112c8565b600101610c91565b50336000908152603b602052604090205415610d4057610d403383836112c8565b505050565b333014610d645760405162461bcd60e51b81526004016106e590612212565b603955565b600054610100900460ff1680610d825750610d82611981565b80610d90575060005460ff16155b610dac5760405162461bcd60e51b81526004016106e5906122fa565b600054610100900460ff16158015610dd7576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff199094169390931716919091179055610f97611987565b80156106fe576000805461ff00191690555050565b60395481565b60375481565b6000610fc5338484611522565b90505b92915050565b603d546000190190565b610fe0611a4d565b603d8381548110610fed57fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b3330146110695760405162461bcd60e51b81526004016106e590612212565b603355565b33301461108d5760405162461bcd60e51b81526004016106e590612212565b603855565b3330146110b15760405162461bcd60e51b81526004016106e590612212565b603655565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf906110f290899030908a908a908a908a908a90600401611eae565b600060405180830381600087803b15801561110c57600080fd5b505af1158015611120573d6000803e3d6000fd5b5050505061112e868661189c565b505050505050565b60046111418261071a565b600681111561114c57fe5b146111695760405162461bcd60e51b81526004016106e590611f90565b6000603d828154811061117857fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b03166111b3816119c8565b6111cf5760405162461bcd60e51b81526004016106e590611f4d565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b0385169161121391611dfb565b600060405180830381855af49150503d806000811461124e576040519150601f19603f3d011682016040523d82523d6000602084013e611253565b606091505b5091509150816112965780511561127e578060405162461bcd60e51b81526004016106e59190611f3a565b60405162461bcd60e51b81526004016106e59061240f565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b60016112d38361071a565b60068111156112de57fe5b146112fb5760405162461bcd60e51b81526004016106e590612056565b6000603d838154811061130a57fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b9094529190942054929450101590806113695760405162461bcd60e51b81526004016106e590612280565b825460ff16156113b8578254610100900460ff161561139f5760018301546004850154611395916119ce565b60048501556113b8565b600183015460058501546113b2916119ce565b60058501555b84156113d75760048401546113cd90826114fd565b60048501556113ec565b60058401546113e690826114fd565b60058501555b6006840154610100900460ff1615801561141c575060395461141a61140f6114f9565b6003870154906119ce565b105b1561146057600584015460048501541115821515811461145e5760068501805461ff001916610100179055603a546003860154611458916114fd565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a5460038701546114ab938b936114a693919261080d928391906114fd565b611a10565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b5846040516114e8919061246b565b60405180910390a450505050505050565b4290565b600082820183811015610fc55760405162461bcd60e51b81526004016106e5906120fa565b6001600160a01b0383166000908152603b602052604081205460365481101561155d5760405162461bcd60e51b81526004016106e59061209d565b611566846119c8565b6115825760405162461bcd60e51b81526004016106e5906122b7565b6001600160a01b0385166000908152603e602052604090205480156115f45760006115ac8261071a565b905060018160068111156115bc57fe5b141580156115d6575060008160068111156115d357fe5b14155b6115f25760405162461bcd60e51b81526004016106e590611fdb565b505b600061160460375461080d6114f9565b9050600061161d603854836114fd90919063ffffffff16565b9050611627611a6d565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff199093169290921794909416179055906117d9610fce565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a5492935061181b928d926114a692909161080d919082908a906114fd565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d60405161185b9493929190611eef565b60405180910390a39998505050505050505050565b600081848411156118945760405162461bcd60e51b81526004016106e59190611f3a565b505050900390565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd906118d090859030908690600401611e44565b602060405180830381600087803b1580156118ea57600080fd5b505af11580156118fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119229190611d40565b61193e5760405162461bcd60e51b81526004016106e5906121db565b6001600160a01b0382166000908152603b602052604090205461196190826114fd565b6001600160a01b039092166000908152603b602052604090209190915550565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b3b151590565b6000610fc583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611870565b6001600160a01b0382166000908152603f60205260409020548111156106fe576001600160a01b03919091166000908152603f6020526040902055565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b0381168114610fc857600080fd5b8035610fc8816124e0565b600082601f830112611afa578081fd5b813567ffffffffffffffff811115611b10578182fd5b611b23601f8201601f1916602001612474565b9150808252836020828501011115611b3a57600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215611b64578081fd5b610fc58383611ac8565b600080600060608486031215611b82578182fd5b8335611b8d816124cb565b92506020840135611b9d816124cb565b9150604084013567ffffffffffffffff811115611bb8578182fd5b611bc486828701611aea565b9150509250925092565b60008060408385031215611be0578182fd5b8235611beb816124cb565b9150602083013567ffffffffffffffff811115611c06578182fd5b611c1285828601611aea565b9150509250929050565b60008060008060008060c08789031215611c34578182fd5b611c3e8888611ac8565b95506020870135945060408701359350606087013560ff81168114611c61578283fd5b9598949750929560808101359460a0909101359350915050565b600080600060608486031215611c8f578283fd5b833567ffffffffffffffff80821115611ca6578485fd5b818601915086601f830112611cb9578485fd5b813581811115611cc7578586fd5b60209150818102611cd9838201612474565b8281528381019085850183870186018c1015611cf357898afd5b8996505b84871015611d1d57611d098c82611ac8565b835260019690960195918501918501611cf7565b5097505050508501359250611d3790508560408601611adf565b90509250925092565b600060208284031215611d51578081fd5b8151610fc5816124e0565b600060208284031215611d6d578081fd5b5035919050565b60008060408385031215611d86578182fd5b82359150611d978460208501611ac8565b90509250929050565b60008060408385031215611db2578182fd5b823591506020830135611dc4816124e0565b809150509250929050565b60008151808452611de781602086016020860161249b565b601f01601f19169290920160200192915050565b60008251611e0d81846020870161249b565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b038616825284602083015283604083015260806060830152611f1c6080830184611dcf565b9695505050505050565b6020810160078310611f3457fe5b91905290565b600060208252610fc56020830184611dcf565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b6020808252601590820152741513d4938e881d1c985b9cd9995c8819985a5b1959605a1b604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b90815260200190565b60405181810167ffffffffffffffff8111828210171561249357600080fd5b604052919050565b60005b838110156124b657818101518382015260200161249e565b838111156124c5576000848401525b50505050565b6001600160a01b0381168114610b0757600080fd5b8015158114610b0757600080fdfea26469706673582212208c8a57d0dd9da76417112ba79eab1d38dbdf5e0a8bc014651f10bebe82ce8f9b64736f6c634300060c0033"; +const isSuperArgs$g = (xs) => xs.length > 1; +class Governance__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$g(args)) { + super(...args); + } else { + super(_abi$l, _bytecode$g, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$g; + static abi = _abi$l; + static createInterface() { + return new interface_Interface(_abi$l); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$l, runner); + } +} + +var index$d = /*#__PURE__*/Object.freeze({ + __proto__: null, + Configuration__factory: Configuration__factory, + Core__factory: Core__factory, + Delegation__factory: Delegation__factory, + Governance__factory: Governance__factory, + mocks: index$e +}); + +const _abi$k = [ + { + inputs: [ + { + internalType: "address", + name: "_gasCompensationVault", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "gasCompensationVault", + outputs: [ + { + internalType: "contract IGasCompensationVault", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "_gasCompensationsLimit", + type: "uint256" + } + ], + name: "setGasCompensations", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdrawFromHelper", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class GasCompensator__factory { + static abi = _abi$k; + static createInterface() { + return new interface_Interface(_abi$k); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$k, runner); + } +} + +const _abi$j = [ + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "gasAmount", + type: "uint256" + } + ], + name: "compensateGas", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdrawToGovernance", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class IGasCompensationVault__factory { + static abi = _abi$j; + static createInterface() { + return new interface_Interface(_abi$j); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$j, + runner + ); + } +} + +var index$c = /*#__PURE__*/Object.freeze({ + __proto__: null, + GasCompensator__factory: GasCompensator__factory, + IGasCompensationVault__factory: IGasCompensationVault__factory +}); + +const _abi$i = [ + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdrawTorn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class ITornadoVault__factory { + static abi = _abi$i; + static createInterface() { + return new interface_Interface(_abi$i); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$i, runner); + } +} + +var index$b = /*#__PURE__*/Object.freeze({ + __proto__: null, + ITornadoVault__factory: ITornadoVault__factory +}); + +const _abi$h = [ + { + inputs: [ + { + internalType: "address", + name: "_gasCompLogic", + type: "address" + }, + { + internalType: "address", + name: "_userVault", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + } + ], + name: "Delegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "proposer", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + indexed: false, + internalType: "string", + name: "description", + type: "string" + } + ], + name: "ProposalCreated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "ProposalExecuted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + } + ], + name: "Undelegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "voter", + type: "address" + }, + { + indexed: true, + internalType: "bool", + name: "support", + type: "bool" + }, + { + indexed: false, + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + name: "Voted", + type: "event" + }, + { + inputs: [], + name: "CLOSING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_EXPIRATION", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PROPOSAL_THRESHOLD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "QUORUM_VOTES", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTE_EXTEND_TIME", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "canWithdrawAfter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "from", + type: "address[]" + }, + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castDelegatedVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "checkIfQuorumReached", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + } + ], + name: "delegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "delegatedTo", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "execute", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "gasCompensationVault", + outputs: [ + { + internalType: "contract IGasCompensationVault", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "voter", + type: "address" + } + ], + name: "getReceipt", + outputs: [ + { + components: [ + { + internalType: "bool", + name: "hasVoted", + type: "bool" + }, + { + internalType: "bool", + name: "support", + type: "bool" + }, + { + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + internalType: "struct Governance.Receipt", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "hasAccountVoted", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "latestProposalIds", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "lock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "lockWithApproval", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "lockedBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "proposalCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "proposals", + outputs: [ + { + internalType: "address", + name: "proposer", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "forVotes", + type: "uint256" + }, + { + internalType: "uint256", + name: "againstVotes", + type: "uint256" + }, + { + internalType: "bool", + name: "executed", + type: "bool" + }, + { + internalType: "bool", + name: "extended", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "propose", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "proposeByDelegate", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "returnMultisigAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "closingPeriod", + type: "uint256" + } + ], + name: "setClosingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionDelay", + type: "uint256" + } + ], + name: "setExecutionDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionExpiration", + type: "uint256" + } + ], + name: "setExecutionExpiration", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "gasCompensationsLimit", + type: "uint256" + } + ], + name: "setGasCompensations", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalThreshold", + type: "uint256" + } + ], + name: "setProposalThreshold", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "quorumVotes", + type: "uint256" + } + ], + name: "setQuorumVotes", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "voteExtendTime", + type: "uint256" + } + ], + name: "setVoteExtendTime", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingDelay", + type: "uint256" + } + ], + name: "setVotingDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingPeriod", + type: "uint256" + } + ], + name: "setVotingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "state", + outputs: [ + { + internalType: "enum Governance.ProposalState", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract TORN", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "undelegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "unlock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "userVault", + outputs: [ + { + internalType: "contract ITornadoVault", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "version", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdrawFromHelper", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$f = "0x60c06040523480156200001157600080fd5b5060405162002e3138038062002e31833981016040819052620000349162000153565b60005482908290610100900460ff1680620000545750620000546200010c565b8062000063575060005460ff16155b6200008b5760405162461bcd60e51b8152600401620000829062000191565b60405180910390fd5b600054610100900460ff16158015620000b7576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000d562000112565b8015620000e8576000805461ff00191690555b506001600160601b0319606091821b811660805291901b1660a05250620001f89050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6000806040838503121562000166578182fd5b82516200017381620001df565b60208401519092506200018681620001df565b809150509250929050565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6001600160a01b0381168114620001f557600080fd5b50565b60805160601c60a05160601c612bf162000240600039806108c55280610e525280610f4a52806114505280611ee1525080610d545280610fb75280611cf75250612bf16000f3fe60806040526004361061026b5760003560e01c80639ae697bf11610144578063d6159fe5116100b6578063e525aa081161007a578063e525aa08146106ff578063ea0217cf1461071f578063ece40cc11461073f578063ef3f8bb11461075f578063f0b768921461077f578063fe0d94c11461079f57610272565b8063d6159fe514610668578063d6f0948c1461067d578063da35c6641461069d578063e23a9a52146106b2578063e4917d9f146106df57610272565b8063b1610d7e11610108578063b1610d7e146105be578063b54426c8146105d3578063b859f11b146105f3578063c0c0e82014610613578063c4d66de814610633578063ce25d71c1461065357610272565b80639ae697bf1461053f5780639daafec71461055f578063a6c2660314610574578063a72edda314610589578063adf898a4146105a957610272565b80635c19a95c116101dd5780636dc2dc6c116101a15780636dc2dc6c1461049557806370b0f660146104b55780638b34a960146104d557806392ab89bb146104ea578063932d5157146104ff5780639a9e3b6e1461051f57610272565b80635c19a95c1461040b5780636198e3391461042b57806365da12641461044b578063671dd2751461046b5780636a6617551461048057610272565b806332687ec11161022f57806332687ec11461034557806337f135d7146103725780633e4f49e61461038757806354fd4d50146103b4578063587a6ecb146103d657806358e9fff0146103eb57610272565b8063013cf08b1461027757806302ec8f9e146102b457806315373e3d146102d657806317977c61146102f657806324b0435f1461032357610272565b3661027257005b600080fd5b34801561028357600080fd5b506102976102923660046123c5565b6107b2565b6040516102ab9897969594939291906124d1565b60405180910390f35b3480156102c057600080fd5b506102d46102cf3660046123c5565b610817565b005b3480156102e257600080fd5b506102d46102f1366004612409565b610844565b34801561030257600080fd5b506103166103113660046121bc565b610947565b6040516102ab9190612b38565b34801561032f57600080fd5b50610338610959565b6040516102ab9190612480565b34801561035157600080fd5b506103656103603660046123c5565b610971565b6040516102ab919061258f565b34801561037e57600080fd5b506103166109bf565b34801561039357600080fd5b506103a76103a23660046123c5565b6109c5565b6040516102ab919061259a565b3480156103c057600080fd5b506103c9610b01565b6040516102ab91906125ae565b3480156103e257600080fd5b50610316610b38565b3480156103f757600080fd5b506103166104063660046121d7565b610b3e565b34801561041757600080fd5b506102d46104263660046121bc565b610b8c565b34801561043757600080fd5b506102d46104463660046123c5565b610cae565b34801561045757600080fd5b506103386104663660046121bc565b610dc0565b34801561047757600080fd5b50610316610ddb565b34801561048c57600080fd5b50610316610de1565b3480156104a157600080fd5b506102d46104b03660046123c5565b610de7565b3480156104c157600080fd5b506102d46104d03660046123c5565b610e2c565b3480156104e157600080fd5b50610338610e50565b3480156104f657600080fd5b506102d4610e74565b34801561050b57600080fd5b506102d461051a3660046123c5565b610efb565b34801561052b57600080fd5b506102d461053a3660046123c5565b610f7f565b34801561054b57600080fd5b5061031661055a3660046121bc565b610fa3565b34801561056b57600080fd5b50610338610fb5565b34801561058057600080fd5b50610316610fd9565b34801561059557600080fd5b506103166105a43660046121bc565b610fdf565b3480156105b557600080fd5b50610338610ff1565b3480156105ca57600080fd5b50610316611000565b3480156105df57600080fd5b506102d46105ee3660046123c5565b611006565b3480156105ff57600080fd5b506102d461060e3660046122e4565b611013565b34801561061f57600080fd5b506102d461062e3660046123c5565b611061565b34801561063f57600080fd5b506102d461064e3660046121bc565b611085565b34801561065f57600080fd5b506103166112c9565b34801561067457600080fd5b506103166112cf565b34801561068957600080fd5b50610316610698366004612237565b6112d5565b3480156106a957600080fd5b506103166112eb565b3480156106be57600080fd5b506106d26106cd3660046123dd565b6112f5565b6040516102ab9190612b13565b3480156106eb57600080fd5b506102d46106fa3660046123c5565b611367565b34801561070b57600080fd5b5061036561071a3660046123dd565b61138b565b34801561072b57600080fd5b506102d461073a3660046123c5565b6113ce565b34801561074b57600080fd5b506102d461075a3660046123c5565b6113f2565b34801561076b57600080fd5b506102d461077a3660046123c5565b611416565b34801561078b57600080fd5b506102d461079a366004612285565b6114a5565b6102d46107ad3660046123c5565b611525565b603d81815481106107bf57fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b33301461083f5760405162461bcd60e51b815260040161083690612881565b60405180910390fd5b603555565b3361084f833361138b565b158015610862575061086083610971565b155b333214610870576000610874565b6152085b61ffff1681156109355760005a905061088e3387876116b7565b60006108ab6127106108a5856108a55a87906118e8565b9061192a565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce807906108fc9088908590600401612494565b600060405180830381600087803b15801561091657600080fd5b505af115801561092a573d6000803e3d6000fd5b505050505050610940565b6109403386866116b7565b5050505050565b603e6020526000908152604090205481565b73b04e030140b30c27bcdfaafffa98c57d80eda7b490565b6000603554603d838154811061098357fe5b906000526020600020906008020160050154603d84815481106109a257fe5b90600052602060002090600802016004015401101590505b919050565b60335481565b60006109cf6112eb565b82111580156109de5750600082115b6109fa5760405162461bcd60e51b8152600401610836906129de565b6000603d8381548110610a0957fe5b906000526020600020906008020190508060020154610a2661194f565b11610a355760009150506109ba565b8060030154610a4261194f565b11610a515760019150506109ba565b80600501548160040154111580610a7357506035548160050154826004015401105b15610a825760029150506109ba565b600681015460ff1615610a995760059150506109ba565b610ab86034546108a5603354846003015461192a90919063ffffffff16565b610ac061194f565b10610acf5760069150506109ba565b6033546003820154610ae09161192a565b610ae861194f565b10610af75760049150506109ba565b60039150506109ba565b60408051808201909152601981527f322e6c6f74746572792d616e642d6761732d7570677261646500000000000000602082015290565b603a5481565b6001600160a01b038381166000908152603c60205260408120549091163314610b795760405162461bcd60e51b815260040161083690612a6e565b610b84848484611953565b949350505050565b336000818152603c60205260409020546001600160a01b039081169190831614801590610bc257506001600160a01b0382163014155b8015610bd657506001600160a01b03821615155b8015610bf45750806001600160a01b0316826001600160a01b031614155b610c105760405162461bcd60e51b8152600401610836906128b8565b6001600160a01b03811615610c56576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000908152603f6020526040902054610cc661194f565b11610ce35760405162461bcd60e51b8152600401610836906127e9565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054610d31918390611ca1565b336000818152603b6020526040908190209290925590516391fe357360e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316916391fe357391610d9291908590600401612494565b600060405180830381600087803b158015610dac57600080fd5b505af1158015610940573d6000803e3d6000fd5b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610e065760405162461bcd60e51b815260040161083690612881565b6033548110610e275760405162461bcd60e51b8152600401610836906127a5565b603a55565b333014610e4b5760405162461bcd60e51b815260040161083690612881565b603755565b7f000000000000000000000000000000000000000000000000000000000000000081565b336000908152603c60205260409020546001600160a01b031680610eaa5760405162461bcd60e51b815260040161083690612a24565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b610f03610959565b6001600160a01b0316336001600160a01b031614610f335760405162461bcd60e51b8152600401610836906129b7565b604051633a08bde160e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e822f78490610d92908490600401612b38565b333014610f9e5760405162461bcd60e51b815260040161083690612881565b603455565b603b6020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b6110103382611ccd565b50565b60008351116110345760405162461bcd60e51b815260040161083690612857565b61105c838383611044863361138b565b158015611057575061105586610971565b155b611dd2565b505050565b3330146110805760405162461bcd60e51b815260040161083690612881565b603955565b600054610100900460ff168061109e575061109e612016565b806110ac575060005460ff16155b6110c85760405162461bcd60e51b815260040161083690612969565b600054610100900460ff161580156110f3576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff1990941693909317169190911790556112b361201c565b80156112c5576000805461ff00191690555b5050565b60395481565b60375481565b60006112e2338484611953565b90505b92915050565b603d546000190190565b6112fd6120b6565b603d838154811061130a57fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b3330146113865760405162461bcd60e51b815260040161083690612881565b603355565b6000603d838154811061139a57fe5b600091825260208083206001600160a01b03861684526007600890930201919091019052604090205460ff16905092915050565b3330146113ed5760405162461bcd60e51b815260040161083690612881565b603855565b3330146114115760405162461bcd60e51b815260040161083690612881565b603655565b61141e610959565b6001600160a01b0316336001600160a01b03161461144e5760405162461bcd60e51b8152600401610836906129b7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166108fc611485834761205d565b6040518115909202916000818181858888f1935050505061101057600080fd5b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf906114e190899030908a908a908a908a908a90600401612517565b600060405180830381600087803b1580156114fb57600080fd5b505af115801561150f573d6000803e3d6000fd5b5050505061151d8686611ccd565b505050505050565b6004611530826109c5565b600681111561153b57fe5b146115585760405162461bcd60e51b815260040161083690612604565b6000603d828154811061156757fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b03166115a281612073565b6115be5760405162461bcd60e51b8152600401610836906125c1565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b0385169161160291612464565b600060405180830381855af49150503d806000811461163d576040519150601f19603f3d011682016040523d82523d6000602084013e611642565b606091505b5091509150816116855780511561166d578060405162461bcd60e51b815260040161083691906125ae565b60405162461bcd60e51b815260040161083690612aa5565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b60016116c2836109c5565b60068111156116cd57fe5b146116ea5760405162461bcd60e51b8152600401610836906126ca565b6000603d83815481106116f957fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b9094529190942054929450101590806117585760405162461bcd60e51b8152600401610836906128ef565b825460ff16156117a7578254610100900460ff161561178e5760018301546004850154611784916118e8565b60048501556117a7565b600183015460058501546117a1916118e8565b60058501555b84156117c65760048401546117bc908261192a565b60048501556117db565b60058401546117d5908261192a565b60058501555b6006840154610100900460ff1615801561180b57506039546118096117fe61194f565b6003870154906118e8565b105b1561184f57600584015460048501541115821515811461184d5760068501805461ff001916610100179055603a5460038601546118479161192a565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a54600387015461189a938b936118959391926108a59283919061192a565b612079565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b5846040516118d79190612b38565b60405180910390a450505050505050565b60006112e283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ca1565b6000828201838110156112e25760405162461bcd60e51b81526004016108369061276e565b4290565b6001600160a01b0383166000908152603b602052604081205460365481101561198e5760405162461bcd60e51b815260040161083690612711565b61199784612073565b6119b35760405162461bcd60e51b815260040161083690612926565b6001600160a01b0385166000908152603e60205260409020548015611a255760006119dd826109c5565b905060018160068111156119ed57fe5b14158015611a0757506000816006811115611a0457fe5b14155b611a235760405162461bcd60e51b81526004016108369061264f565b505b6000611a356037546108a561194f565b90506000611a4e6038548361192a90919063ffffffff16565b9050611a586120d6565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff19909316929092179490941617905590611c0a6112eb565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a54929350611c4c928d926118959290916108a5919082908a9061192a565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d604051611c8c9493929190612558565b60405180910390a39998505050505050505050565b60008184841115611cc55760405162461bcd60e51b815260040161083691906125ae565b505050900390565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd90611d219085907f00000000000000000000000000000000000000000000000000000000000000009086906004016124ad565b602060405180830381600087803b158015611d3b57600080fd5b505af1158015611d4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d7391906123a9565b611d8f5760405162461bcd60e51b815260040161083690612820565b6001600160a01b0382166000908152603b6020526040902054611db2908261192a565b6001600160a01b039092166000908152603b602052604090209190915550565b3381328214611de2576000611de6565b6152085b61ffff168115611f515760005a905060005b8851811015611eaf576000898281518110611e0f57fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611e4f57506001600160a01b03811633145b611e6b5760405162461bcd60e51b815260040161083690612a6e565b861580611e7f5750611e7d898261138b565b155b611e9b5760405162461bcd60e51b815260040161083690612adc565b611ea6818a8a6116b7565b50600101611df8565b506000611ec76127106108a5856108a55a87906118e8565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce80790611f189088908590600401612494565b600060405180830381600087803b158015611f3257600080fd5b505af1158015611f46573d6000803e3d6000fd5b50505050505061200d565b60005b875181101561200b576000888281518110611f6b57fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611fab57506001600160a01b03811633145b611fc75760405162461bcd60e51b815260040161083690612a6e565b851580611fdb5750611fd9888261138b565b155b611ff75760405162461bcd60e51b815260040161083690612adc565b6120028189896116b7565b50600101611f54565b505b50505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b600081831061206c57816112e2565b5090919050565b3b151590565b6001600160a01b0382166000908152603f60205260409020548111156112c5576001600160a01b03919091166000908152603f6020526040902055565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b03811681146112e557600080fd5b80356112e581612bad565b600082601f830112612163578081fd5b813567ffffffffffffffff811115612179578182fd5b61218c601f8201601f1916602001612b41565b91508082528360208285010111156121a357600080fd5b8060208401602084013760009082016020015292915050565b6000602082840312156121cd578081fd5b6112e28383612131565b6000806000606084860312156121eb578182fd5b83356121f681612b98565b9250602084013561220681612b98565b9150604084013567ffffffffffffffff811115612221578182fd5b61222d86828701612153565b9150509250925092565b60008060408385031215612249578182fd5b823561225481612b98565b9150602083013567ffffffffffffffff81111561226f578182fd5b61227b85828601612153565b9150509250929050565b60008060008060008060c0878903121561229d578182fd5b6122a78888612131565b95506020870135945060408701359350606087013560ff811681146122ca578283fd5b9598949750929560808101359460a0909101359350915050565b6000806000606084860312156122f8578283fd5b833567ffffffffffffffff8082111561230f578485fd5b818601915086601f830112612322578485fd5b813581811115612330578586fd5b60209150818102612342838201612b41565b8281528381019085850183870186018c101561235c57898afd5b8996505b84871015612386576123728c82612131565b835260019690960195918501918501612360565b50975050505085013592506123a090508560408601612148565b90509250925092565b6000602082840312156123ba578081fd5b81516112e281612bad565b6000602082840312156123d6578081fd5b5035919050565b600080604083850312156123ef578182fd5b823591506124008460208501612131565b90509250929050565b6000806040838503121561241b578182fd5b82359150602083013561242d81612bad565b809150509250929050565b60008151808452612450816020860160208601612b68565b601f01601f19169290920160200192915050565b60008251612476818460208701612b68565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b0386168252846020830152836040830152608060608301526125856080830184612438565b9695505050505050565b901515815260200190565b60208101600783106125a857fe5b91905290565b6000602082526112e26020830184612438565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526010908201526f43616e206e6f7420626520656d70747960801b604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252600d908201526c6f6e6c79206d756c746973696760981b604082015260600190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b60208082526019908201527f476f7665726e616e63653a20766f74656420616c726561647900000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b90815260200190565b60405181810167ffffffffffffffff81118282101715612b6057600080fd5b604052919050565b60005b83811015612b83578181015183820152602001612b6b565b83811115612b92576000848401525b50505050565b6001600160a01b038116811461101057600080fd5b801515811461101057600080fdfea2646970667358221220a9ae24380315e86f1632949f167f44c17322fe48a1385357edbfdf8bc543469764736f6c634300060c0033"; +const isSuperArgs$f = (xs) => xs.length > 1; +class GovernanceGasUpgrade__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$f(args)) { + super(...args); + } else { + super(_abi$h, _bytecode$f, args[0]); + } + } + getDeployTransaction(_gasCompLogic, _userVault, overrides) { + return super.getDeployTransaction( + _gasCompLogic, + _userVault, + overrides || {} + ); + } + deploy(_gasCompLogic, _userVault, overrides) { + return super.deploy(_gasCompLogic, _userVault, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$f; + static abi = _abi$h; + static createInterface() { + return new interface_Interface(_abi$h); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$h, + runner + ); + } +} + +const _abi$g = [ + { + inputs: [ + { + internalType: "address", + name: "_userVault", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + } + ], + name: "Delegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "proposer", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + indexed: false, + internalType: "string", + name: "description", + type: "string" + } + ], + name: "ProposalCreated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "ProposalExecuted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + } + ], + name: "Undelegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "voter", + type: "address" + }, + { + indexed: true, + internalType: "bool", + name: "support", + type: "bool" + }, + { + indexed: false, + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + name: "Voted", + type: "event" + }, + { + inputs: [], + name: "CLOSING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_EXPIRATION", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PROPOSAL_THRESHOLD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "QUORUM_VOTES", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTE_EXTEND_TIME", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "canWithdrawAfter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "from", + type: "address[]" + }, + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castDelegatedVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + } + ], + name: "delegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "delegatedTo", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "execute", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "voter", + type: "address" + } + ], + name: "getReceipt", + outputs: [ + { + components: [ + { + internalType: "bool", + name: "hasVoted", + type: "bool" + }, + { + internalType: "bool", + name: "support", + type: "bool" + }, + { + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + internalType: "struct Governance.Receipt", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "latestProposalIds", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "lock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "lockWithApproval", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "lockedBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "proposalCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "proposals", + outputs: [ + { + internalType: "address", + name: "proposer", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "forVotes", + type: "uint256" + }, + { + internalType: "uint256", + name: "againstVotes", + type: "uint256" + }, + { + internalType: "bool", + name: "executed", + type: "bool" + }, + { + internalType: "bool", + name: "extended", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "propose", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "proposeByDelegate", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "closingPeriod", + type: "uint256" + } + ], + name: "setClosingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionDelay", + type: "uint256" + } + ], + name: "setExecutionDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionExpiration", + type: "uint256" + } + ], + name: "setExecutionExpiration", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalThreshold", + type: "uint256" + } + ], + name: "setProposalThreshold", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "quorumVotes", + type: "uint256" + } + ], + name: "setQuorumVotes", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "voteExtendTime", + type: "uint256" + } + ], + name: "setVoteExtendTime", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingDelay", + type: "uint256" + } + ], + name: "setVotingDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingPeriod", + type: "uint256" + } + ], + name: "setVotingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "state", + outputs: [ + { + internalType: "enum Governance.ProposalState", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract TORN", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "undelegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "unlock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "userVault", + outputs: [ + { + internalType: "contract ITornadoVault", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "version", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "pure", + type: "function" + } +]; +const _bytecode$e = "0x60a06040523480156200001157600080fd5b506040516200277e3803806200277e833981016040819052620000349162000142565b600054610100900460ff168062000050575062000050620000fb565b806200005f575060005460ff16155b620000875760405162461bcd60e51b81526004016200007e9062000172565b60405180910390fd5b600054610100900460ff16158015620000b3576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000d162000101565b8015620000e4576000805461ff00191690555b5060601b6001600160601b031916608052620001c0565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b60006020828403121562000154578081fd5b81516001600160a01b03811681146200016b578182fd5b9392505050565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b60805160601c612596620001e860003980610af15280610cb3528061194752506125966000f3fe6080604052600436106102255760003560e01c80639daafec711610123578063ce25d71c116100ab578063e4917d9f1161006f578063e4917d9f1461061b578063ea0217cf1461063b578063ece40cc11461065b578063f0b768921461067b578063fe0d94c11461069b57610225565b8063ce25d71c1461058f578063d6159fe5146105a4578063d6f0948c146105b9578063da35c664146105d9578063e23a9a52146105ee57610225565b8063b1610d7e116100f2578063b1610d7e146104fa578063b54426c81461050f578063b859f11b1461052f578063c0c0e8201461054f578063c4d66de81461056f57610225565b80639daafec71461049b578063a6c26603146104b0578063a72edda3146104c5578063adf898a4146104e557610225565b80635c19a95c116101b15780636dc2dc6c116101755780636dc2dc6c1461040657806370b0f6601461042657806392ab89bb146104465780639a9e3b6e1461045b5780639ae697bf1461047b57610225565b80635c19a95c1461036f5780636198e3391461038f57806365da1264146103af578063671dd275146103dc5780636a661755146103f157610225565b806337f135d7116101f857806337f135d7146102d65780633e4f49e6146102eb57806354fd4d5014610318578063587a6ecb1461033a57806358e9fff01461034f57610225565b8063013cf08b1461022a57806302ec8f9e1461026757806315373e3d1461028957806317977c61146102a9575b600080fd5b34801561023657600080fd5b5061024a610245366004611dfd565b6106ae565b60405161025e989796959493929190611f09565b60405180910390f35b34801561027357600080fd5b50610287610282366004611dfd565b610713565b005b34801561029557600080fd5b506102876102a4366004611e41565b610740565b3480156102b557600080fd5b506102c96102c4366004611bf4565b61074f565b60405161025e91906124dd565b3480156102e257600080fd5b506102c9610761565b3480156102f757600080fd5b5061030b610306366004611dfd565b610767565b60405161025e9190611fc7565b34801561032457600080fd5b5061032d6108aa565b60405161025e9190611fdb565b34801561034657600080fd5b506102c96108d5565b34801561035b57600080fd5b506102c961036a366004611c0f565b6108db565b34801561037b57600080fd5b5061028761038a366004611bf4565b610929565b34801561039b57600080fd5b506102876103aa366004611dfd565b610a4b565b3480156103bb57600080fd5b506103cf6103ca366004611bf4565b610b64565b60405161025e9190611eb8565b3480156103e857600080fd5b506102c9610b7f565b3480156103fd57600080fd5b506102c9610b85565b34801561041257600080fd5b50610287610421366004611dfd565b610b8b565b34801561043257600080fd5b50610287610441366004611dfd565b610bd0565b34801561045257600080fd5b50610287610bf4565b34801561046757600080fd5b50610287610476366004611dfd565b610c7b565b34801561048757600080fd5b506102c9610496366004611bf4565b610c9f565b3480156104a757600080fd5b506103cf610cb1565b3480156104bc57600080fd5b506102c9610cd5565b3480156104d157600080fd5b506102c96104e0366004611bf4565b610cdb565b3480156104f157600080fd5b506103cf610ced565b34801561050657600080fd5b506102c9610cfc565b34801561051b57600080fd5b5061028761052a366004611dfd565b610d02565b34801561053b57600080fd5b5061028761054a366004611d1c565b610d0f565b34801561055b57600080fd5b5061028761056a366004611dfd565b610dc6565b34801561057b57600080fd5b5061028761058a366004611bf4565b610dea565b34801561059b57600080fd5b506102c961102d565b3480156105b057600080fd5b506102c9611033565b3480156105c557600080fd5b506102c96105d4366004611c6f565b611039565b3480156105e557600080fd5b506102c961104f565b3480156105fa57600080fd5b5061060e610609366004611e15565b611059565b60405161025e91906124b8565b34801561062757600080fd5b50610287610636366004611dfd565b6110cb565b34801561064757600080fd5b50610287610656366004611dfd565b6110ef565b34801561066757600080fd5b50610287610676366004611dfd565b611113565b34801561068757600080fd5b50610287610696366004611cbd565b611137565b6102876106a9366004611dfd565b6111b7565b603d81815481106106bb57fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b33301461073b5760405162461bcd60e51b815260040161073290612284565b60405180910390fd5b603555565b61074b338383611349565b5050565b603e6020526000908152604090205481565b60335481565b600061077161104f565b82111580156107805750600082115b61079c5760405162461bcd60e51b8152600401610732906123ba565b6000603d83815481106107ab57fe5b9060005260206000209060080201905080600201546107c861157a565b116107d75760009150506108a5565b80600301546107e461157a565b116107f35760019150506108a5565b8060050154816004015411158061081557506035548160050154826004015401105b156108245760029150506108a5565b600681015460ff161561083b5760059150506108a5565b61086060345461085a603354846003015461157e90919063ffffffff16565b9061157e565b61086861157a565b106108775760069150506108a5565b60335460038201546108889161157e565b61089061157a565b1061089f5760049150506108a5565b60039150505b919050565b60408051808201909152601181527019173b30bab63a16b6b4b3b930ba34b7b760791b602082015290565b603a5481565b6001600160a01b038381166000908152603c602052604081205490911633146109165760405162461bcd60e51b81526004016107329061244a565b6109218484846115a3565b949350505050565b336000818152603c60205260409020546001600160a01b03908116919083161480159061095f57506001600160a01b0382163014155b801561097357506001600160a01b03821615155b80156109915750806001600160a01b0316826001600160a01b031614155b6109ad5760405162461bcd60e51b8152600401610732906122bb565b6001600160a01b038116156109f3576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000908152603f6020526040902054610a6361157a565b11610a805760405162461bcd60e51b815260040161073290612216565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054610ace9183906118f1565b336000818152603b6020526040908190209290925590516391fe357360e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316916391fe357391610b2f91908590600401611ecc565b600060405180830381600087803b158015610b4957600080fd5b505af1158015610b5d573d6000803e3d6000fd5b5050505050565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610baa5760405162461bcd60e51b815260040161073290612284565b6033548110610bcb5760405162461bcd60e51b8152600401610732906121d2565b603a55565b333014610bef5760405162461bcd60e51b815260040161073290612284565b603755565b336000908152603c60205260409020546001600160a01b031680610c2a5760405162461bcd60e51b815260040161073290612400565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b333014610c9a5760405162461bcd60e51b815260040161073290612284565b603455565b603b6020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b610d0c338261191d565b50565b60005b8351811015610da057336001600160a01b0316603c6000868481518110610d3557fe5b6020908102919091018101516001600160a01b03908116835290820192909252604001600020541614610d7a5760405162461bcd60e51b81526004016107329061244a565b610d98848281518110610d8957fe5b60200260200101518484611349565b600101610d12565b50336000908152603b602052604090205415610dc157610dc1338383611349565b505050565b333014610de55760405162461bcd60e51b815260040161073290612284565b603955565b600054610100900460ff1680610e035750610e03611a22565b80610e11575060005460ff16155b610e2d5760405162461bcd60e51b81526004016107329061236c565b600054610100900460ff16158015610e58576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff199094169390931716919091179055611018611a28565b801561074b576000805461ff00191690555050565b60395481565b60375481565b60006110463384846115a3565b90505b92915050565b603d546000190190565b611061611aee565b603d838154811061106e57fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b3330146110ea5760405162461bcd60e51b815260040161073290612284565b603355565b33301461110e5760405162461bcd60e51b815260040161073290612284565b603855565b3330146111325760405162461bcd60e51b815260040161073290612284565b603655565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf9061117390899030908a908a908a908a908a90600401611f4f565b600060405180830381600087803b15801561118d57600080fd5b505af11580156111a1573d6000803e3d6000fd5b505050506111af868661191d565b505050505050565b60046111c282610767565b60068111156111cd57fe5b146111ea5760405162461bcd60e51b815260040161073290612031565b6000603d82815481106111f957fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b031661123481611a69565b6112505760405162461bcd60e51b815260040161073290611fee565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b0385169161129491611e9c565b600060405180830381855af49150503d80600081146112cf576040519150601f19603f3d011682016040523d82523d6000602084013e6112d4565b606091505b509150915081611317578051156112ff578060405162461bcd60e51b81526004016107329190611fdb565b60405162461bcd60e51b815260040161073290612481565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b600161135483610767565b600681111561135f57fe5b1461137c5760405162461bcd60e51b8152600401610732906120f7565b6000603d838154811061138b57fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b9094529190942054929450101590806113ea5760405162461bcd60e51b8152600401610732906122f2565b825460ff1615611439578254610100900460ff1615611420576001830154600485015461141691611a6f565b6004850155611439565b6001830154600585015461143391611a6f565b60058501555b841561145857600484015461144e908261157e565b600485015561146d565b6005840154611467908261157e565b60058501555b6006840154610100900460ff1615801561149d575060395461149b61149061157a565b600387015490611a6f565b105b156114e15760058401546004850154111582151581146114df5760068501805461ff001916610100179055603a5460038601546114d99161157e565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a54600387015461152c938b9361152793919261085a9283919061157e565b611ab1565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b58460405161156991906124dd565b60405180910390a450505050505050565b4290565b6000828201838110156110465760405162461bcd60e51b81526004016107329061219b565b6001600160a01b0383166000908152603b60205260408120546036548110156115de5760405162461bcd60e51b81526004016107329061213e565b6115e784611a69565b6116035760405162461bcd60e51b815260040161073290612329565b6001600160a01b0385166000908152603e6020526040902054801561167557600061162d82610767565b9050600181600681111561163d57fe5b141580156116575750600081600681111561165457fe5b14155b6116735760405162461bcd60e51b81526004016107329061207c565b505b600061168560375461085a61157a565b9050600061169e6038548361157e90919063ffffffff16565b90506116a8611b0e565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff1990931692909217949094161790559061185a61104f565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a5492935061189c928d9261152792909161085a919082908a9061157e565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d6040516118dc9493929190611f90565b60405180910390a39998505050505050505050565b600081848411156119155760405162461bcd60e51b81526004016107329190611fdb565b505050900390565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd906119719085907f0000000000000000000000000000000000000000000000000000000000000000908690600401611ee5565b602060405180830381600087803b15801561198b57600080fd5b505af115801561199f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c39190611de1565b6119df5760405162461bcd60e51b81526004016107329061224d565b6001600160a01b0382166000908152603b6020526040902054611a02908261157e565b6001600160a01b039092166000908152603b602052604090209190915550565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b3b151590565b600061104683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506118f1565b6001600160a01b0382166000908152603f602052604090205481111561074b576001600160a01b03919091166000908152603f6020526040902055565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b038116811461104957600080fd5b803561104981612552565b600082601f830112611b9b578081fd5b813567ffffffffffffffff811115611bb1578182fd5b611bc4601f8201601f19166020016124e6565b9150808252836020828501011115611bdb57600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215611c05578081fd5b6110468383611b69565b600080600060608486031215611c23578182fd5b8335611c2e8161253d565b92506020840135611c3e8161253d565b9150604084013567ffffffffffffffff811115611c59578182fd5b611c6586828701611b8b565b9150509250925092565b60008060408385031215611c81578182fd5b8235611c8c8161253d565b9150602083013567ffffffffffffffff811115611ca7578182fd5b611cb385828601611b8b565b9150509250929050565b60008060008060008060c08789031215611cd5578182fd5b611cdf8888611b69565b95506020870135945060408701359350606087013560ff81168114611d02578283fd5b9598949750929560808101359460a0909101359350915050565b600080600060608486031215611d30578283fd5b833567ffffffffffffffff80821115611d47578485fd5b818601915086601f830112611d5a578485fd5b813581811115611d68578586fd5b60209150818102611d7a8382016124e6565b8281528381019085850183870186018c1015611d9457898afd5b8996505b84871015611dbe57611daa8c82611b69565b835260019690960195918501918501611d98565b5097505050508501359250611dd890508560408601611b80565b90509250925092565b600060208284031215611df2578081fd5b815161104681612552565b600060208284031215611e0e578081fd5b5035919050565b60008060408385031215611e27578182fd5b82359150611e388460208501611b69565b90509250929050565b60008060408385031215611e53578182fd5b823591506020830135611e6581612552565b809150509250929050565b60008151808452611e8881602086016020860161250d565b601f01601f19169290920160200192915050565b60008251611eae81846020870161250d565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b038616825284602083015283604083015260806060830152611fbd6080830184611e70565b9695505050505050565b6020810160078310611fd557fe5b91905290565b6000602082526110466020830184611e70565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b90815260200190565b60405181810167ffffffffffffffff8111828210171561250557600080fd5b604052919050565b60005b83811015612528578181015183820152602001612510565b83811115612537576000848401525b50505050565b6001600160a01b0381168114610d0c57600080fd5b8015158114610d0c57600080fdfea26469706673582212204b0042571b6576e17c0708c8f251958898bb0e0a9f340387b1eed439d732af7264736f6c634300060c0033"; +const isSuperArgs$e = (xs) => xs.length > 1; +class GovernanceVaultUpgrade__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$e(args)) { + super(...args); + } else { + super(_abi$g, _bytecode$e, args[0]); + } + } + getDeployTransaction(_userVault, overrides) { + return super.getDeployTransaction(_userVault, overrides || {}); + } + deploy(_userVault, overrides) { + return super.deploy(_userVault, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$e; + static abi = _abi$g; + static createInterface() { + return new interface_Interface(_abi$g); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$g, + runner + ); + } +} + +var index$a = /*#__PURE__*/Object.freeze({ + __proto__: null, + GovernanceGasUpgrade__factory: GovernanceGasUpgrade__factory, + GovernanceVaultUpgrade__factory: GovernanceVaultUpgrade__factory, + gasCompensatorSol: index$c, + interfaces: index$b +}); + +const _abi$f = [ + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "amountLockedBeforehand", + type: "uint256" + } + ], + name: "updateRewardsOnLockedBalanceChange", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class ITornadoStakingRewards__factory { + static abi = _abi$f; + static createInterface() { + return new interface_Interface(_abi$f); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$f, + runner + ); + } +} + +var index$9 = /*#__PURE__*/Object.freeze({ + __proto__: null, + ITornadoStakingRewards__factory: ITornadoStakingRewards__factory +}); + +const _abi$e = [ + { + inputs: [ + { + internalType: "address", + name: "stakingRewardsAddress", + type: "address" + }, + { + internalType: "address", + name: "gasCompLogic", + type: "address" + }, + { + internalType: "address", + name: "userVaultAddress", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + } + ], + name: "Delegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "proposer", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + indexed: false, + internalType: "string", + name: "description", + type: "string" + } + ], + name: "ProposalCreated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "ProposalExecuted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "bytes", + name: "errorData", + type: "bytes" + } + ], + name: "RewardUpdateFailed", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + } + ], + name: "RewardUpdateSuccessful", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + } + ], + name: "Undelegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "voter", + type: "address" + }, + { + indexed: true, + internalType: "bool", + name: "support", + type: "bool" + }, + { + indexed: false, + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + name: "Voted", + type: "event" + }, + { + inputs: [], + name: "CLOSING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_EXPIRATION", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PROPOSAL_THRESHOLD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "QUORUM_VOTES", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "Staking", + outputs: [ + { + internalType: "contract ITornadoStakingRewards", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTE_EXTEND_TIME", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "canWithdrawAfter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "from", + type: "address[]" + }, + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castDelegatedVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "checkIfQuorumReached", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + } + ], + name: "delegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "delegatedTo", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "execute", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "gasCompensationVault", + outputs: [ + { + internalType: "contract IGasCompensationVault", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "voter", + type: "address" + } + ], + name: "getReceipt", + outputs: [ + { + components: [ + { + internalType: "bool", + name: "hasVoted", + type: "bool" + }, + { + internalType: "bool", + name: "support", + type: "bool" + }, + { + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + internalType: "struct Governance.Receipt", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "hasAccountVoted", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "latestProposalIds", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "lock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "lockWithApproval", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "lockedBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "proposalCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "proposals", + outputs: [ + { + internalType: "address", + name: "proposer", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "forVotes", + type: "uint256" + }, + { + internalType: "uint256", + name: "againstVotes", + type: "uint256" + }, + { + internalType: "bool", + name: "executed", + type: "bool" + }, + { + internalType: "bool", + name: "extended", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "propose", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "proposeByDelegate", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "returnMultisigAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "closingPeriod", + type: "uint256" + } + ], + name: "setClosingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionDelay", + type: "uint256" + } + ], + name: "setExecutionDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionExpiration", + type: "uint256" + } + ], + name: "setExecutionExpiration", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "gasCompensationsLimit", + type: "uint256" + } + ], + name: "setGasCompensations", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalThreshold", + type: "uint256" + } + ], + name: "setProposalThreshold", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "quorumVotes", + type: "uint256" + } + ], + name: "setQuorumVotes", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "voteExtendTime", + type: "uint256" + } + ], + name: "setVoteExtendTime", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingDelay", + type: "uint256" + } + ], + name: "setVotingDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingPeriod", + type: "uint256" + } + ], + name: "setVotingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "state", + outputs: [ + { + internalType: "enum Governance.ProposalState", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract TORN", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "undelegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "unlock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "userVault", + outputs: [ + { + internalType: "contract ITornadoVault", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "version", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdrawFromHelper", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$d = "0x60e06040523480156200001157600080fd5b50604051620032a6380380620032a6833981016040819052620000349162000165565b81818181600060019054906101000a900460ff1680620000595750620000596200011e565b8062000068575060005460ff16155b620000905760405162461bcd60e51b81526004016200008790620001b8565b60405180910390fd5b600054610100900460ff16158015620000bc576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000da62000124565b8015620000ed576000805461ff00191690555b506001600160601b0319606091821b811660805291811b821660a0529590951b90941660c052506200021f92505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6000806000606084860312156200017a578283fd5b8351620001878162000206565b60208501519093506200019a8162000206565b6040850151909250620001ad8162000206565b809150509250925092565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6001600160a01b03811681146200021c57600080fd5b50565b60805160601c60a05160601c60c05160601c6130246200028260003980610cf652806110b7528061169852806117c95250806108e55280610ead5280610fa552806116145280612164525080611040528061200d528061240e52506130246000f3fe6080604052600436106102765760003560e01c80639ae697bf1161014f578063d6159fe5116100c1578063ea0217cf1161007a578063ea0217cf1461072a578063ece40cc11461074a578063ef3f8bb11461076a578063f0b768921461078a578063f57df22e146107aa578063fe0d94c1146107bf5761027d565b8063d6159fe514610673578063d6f0948c14610688578063da35c664146106a8578063e23a9a52146106bd578063e4917d9f146106ea578063e525aa081461070a5761027d565b8063b1610d7e11610113578063b1610d7e146105c9578063b54426c8146105de578063b859f11b146105fe578063c0c0e8201461061e578063c4d66de81461063e578063ce25d71c1461065e5761027d565b80639ae697bf1461054a5780639daafec71461056a578063a6c266031461057f578063a72edda314610594578063adf898a4146105b45761027d565b80635c19a95c116101e85780636dc2dc6c116101ac5780636dc2dc6c146104a057806370b0f660146104c05780638b34a960146104e057806392ab89bb146104f5578063932d51571461050a5780639a9e3b6e1461052a5761027d565b80635c19a95c146104165780636198e3391461043657806365da126414610456578063671dd275146104765780636a6617551461048b5761027d565b806332687ec11161023a57806332687ec11461035057806337f135d71461037d5780633e4f49e61461039257806354fd4d50146103bf578063587a6ecb146103e157806358e9fff0146103f65761027d565b8063013cf08b1461028257806302ec8f9e146102bf57806315373e3d146102e157806317977c611461030157806324b0435f1461032e5761027d565b3661027d57005b600080fd5b34801561028e57600080fd5b506102a261029d3660046127f8565b6107d2565b6040516102b6989796959493929190612904565b60405180910390f35b3480156102cb57600080fd5b506102df6102da3660046127f8565b610837565b005b3480156102ed57600080fd5b506102df6102fc36600461283c565b610864565b34801561030d57600080fd5b5061032161031c3660046125ef565b610967565b6040516102b69190612f6b565b34801561033a57600080fd5b50610343610979565b6040516102b691906128b3565b34801561035c57600080fd5b5061037061036b3660046127f8565b610991565b6040516102b691906129c2565b34801561038957600080fd5b506103216109df565b34801561039e57600080fd5b506103b26103ad3660046127f8565b6109e5565b6040516102b691906129cd565b3480156103cb57600080fd5b506103d4610b21565b6040516102b691906129e1565b3480156103ed57600080fd5b50610321610b58565b34801561040257600080fd5b5061032161041136600461260a565b610b5e565b34801561042257600080fd5b506102df6104313660046125ef565b610bac565b34801561044257600080fd5b506102df6104513660046127f8565b610cce565b34801561046257600080fd5b506103436104713660046125ef565b610e1b565b34801561048257600080fd5b50610321610e36565b34801561049757600080fd5b50610321610e3c565b3480156104ac57600080fd5b506102df6104bb3660046127f8565b610e42565b3480156104cc57600080fd5b506102df6104db3660046127f8565b610e87565b3480156104ec57600080fd5b50610343610eab565b34801561050157600080fd5b506102df610ecf565b34801561051657600080fd5b506102df6105253660046127f8565b610f56565b34801561053657600080fd5b506102df6105453660046127f8565b611008565b34801561055657600080fd5b506103216105653660046125ef565b61102c565b34801561057657600080fd5b5061034361103e565b34801561058b57600080fd5b50610321611062565b3480156105a057600080fd5b506103216105af3660046125ef565b611068565b3480156105c057600080fd5b5061034361107a565b3480156105d557600080fd5b50610321611089565b3480156105ea57600080fd5b506102df6105f93660046127f8565b61108f565b34801561060a57600080fd5b506102df610619366004612717565b6111d8565b34801561062a57600080fd5b506102df6106393660046127f8565b611226565b34801561064a57600080fd5b506102df6106593660046125ef565b61124a565b34801561066a57600080fd5b5061032161148d565b34801561067f57600080fd5b50610321611493565b34801561069457600080fd5b506103216106a336600461266a565b611499565b3480156106b457600080fd5b506103216114af565b3480156106c957600080fd5b506106dd6106d8366004612810565b6114b9565b6040516102b69190612f46565b3480156106f657600080fd5b506102df6107053660046127f8565b61152b565b34801561071657600080fd5b50610370610725366004612810565b61154f565b34801561073657600080fd5b506102df6107453660046127f8565b611592565b34801561075657600080fd5b506102df6107653660046127f8565b6115b6565b34801561077657600080fd5b506102df6107853660046127f8565b6115da565b34801561079657600080fd5b506102df6107a53660046126b8565b61166c565b3480156107b657600080fd5b506103436117c7565b6102df6107cd3660046127f8565b6117eb565b603d81815481106107df57fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b33301461085f5760405162461bcd60e51b815260040161085690612cb4565b60405180910390fd5b603555565b3361086f833361154f565b158015610882575061088083610991565b155b333214610890576000610894565b6152085b61ffff1681156109555760005a90506108ae33878761197d565b60006108cb6127106108c5856108c55a8790611bae565b90611bf0565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce8079061091c90889085906004016128c7565b600060405180830381600087803b15801561093657600080fd5b505af115801561094a573d6000803e3d6000fd5b505050505050610960565b61096033868661197d565b5050505050565b603e6020526000908152604090205481565b73b04e030140b30c27bcdfaafffa98c57d80eda7b490565b6000603554603d83815481106109a357fe5b906000526020600020906008020160050154603d84815481106109c257fe5b90600052602060002090600802016004015401101590505b919050565b60335481565b60006109ef6114af565b82111580156109fe5750600082115b610a1a5760405162461bcd60e51b815260040161085690612e11565b6000603d8381548110610a2957fe5b906000526020600020906008020190508060020154610a46611c15565b11610a555760009150506109da565b8060030154610a62611c15565b11610a715760019150506109da565b80600501548160040154111580610a9357506035548160050154826004015401105b15610aa25760029150506109da565b600681015460ff1615610ab95760059150506109da565b610ad86034546108c56033548460030154611bf090919063ffffffff16565b610ae0611c15565b10610aef5760069150506109da565b6033546003820154610b0091611bf0565b610b08611c15565b10610b175760049150506109da565b60039150506109da565b60408051808201909152601981527f322e6c6f74746572792d616e642d6761732d7570677261646500000000000000602082015290565b603a5481565b6001600160a01b038381166000908152603c60205260408120549091163314610b995760405162461bcd60e51b815260040161085690612ea1565b610ba4848484611c19565b949350505050565b336000818152603c60205260409020546001600160a01b039081169190831614801590610be257506001600160a01b0382163014155b8015610bf657506001600160a01b03821615155b8015610c145750806001600160a01b0316826001600160a01b031614155b610c305760405162461bcd60e51b815260040161085690612ceb565b6001600160a01b03811615610c76576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f91610d2b9185916004016128c7565b600060405180830381600087803b158015610d4557600080fd5b505af1925050508015610d56575060015b610dd9573d808015610d84576040519150601f19603f3d011682016040523d82523d6000602084013e610d89565b606091505b5080604051610d989190612897565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a350610e0e565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e1782611f67565b5050565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610e615760405162461bcd60e51b815260040161085690612cb4565b6033548110610e825760405162461bcd60e51b815260040161085690612bd8565b603a55565b333014610ea65760405162461bcd60e51b815260040161085690612cb4565b603755565b7f000000000000000000000000000000000000000000000000000000000000000081565b336000908152603c60205260409020546001600160a01b031680610f055760405162461bcd60e51b815260040161085690612e57565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b610f5e610979565b6001600160a01b0316336001600160a01b031614610f8e5760405162461bcd60e51b815260040161085690612dea565b604051633a08bde160e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e822f78490610fda908490600401612f6b565b600060405180830381600087803b158015610ff457600080fd5b505af1158015610960573d6000803e3d6000fd5b3330146110275760405162461bcd60e51b815260040161085690612cb4565b603455565b603b6020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916110ec9185916004016128c7565b600060405180830381600087803b15801561110657600080fd5b505af1925050508015611117575060015b61119a573d808015611145576040519150601f19603f3d011682016040523d82523d6000602084013e61114a565b606091505b50806040516111599190612897565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506111cf565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e178261204b565b60008351116111f95760405162461bcd60e51b815260040161085690612c8a565b611221838383611209863361154f565b15801561121c575061121a86610991565b155b612055565b505050565b3330146112455760405162461bcd60e51b815260040161085690612cb4565b603955565b600054610100900460ff16806112635750611263612298565b80611271575060005460ff16155b61128d5760405162461bcd60e51b815260040161085690612d9c565b600054610100900460ff161580156112b8576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff19909416939093171691909117905561147861229e565b8015610e17576000805461ff00191690555050565b60395481565b60375481565b60006114a6338484611c19565b90505b92915050565b603d546000190190565b6114c16124e9565b603d83815481106114ce57fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b33301461154a5760405162461bcd60e51b815260040161085690612cb4565b603355565b6000603d838154811061155e57fe5b600091825260208083206001600160a01b03861684526007600890930201919091019052604090205460ff16905092915050565b3330146115b15760405162461bcd60e51b815260040161085690612cb4565b603855565b3330146115d55760405162461bcd60e51b815260040161085690612cb4565b603655565b6115e2610979565b6001600160a01b0316336001600160a01b0316146116125760405162461bcd60e51b815260040161085690612dea565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166108fc61164983476122df565b6040518115909202916000818181858888f1935050505061166957600080fd5b50565b6001600160a01b038087166000908152603b60205260409081902054905163e113335f60e01b815288927f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916116cd9185916004016128c7565b600060405180830381600087803b1580156116e757600080fd5b505af19250505080156116f8575060015b61177b573d808015611726576040519150601f19603f3d011682016040523d82523d6000602084013e61172b565b606091505b508060405161173a9190612897565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506117b0565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b6117be8787878787876122f5565b50505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60046117f6826109e5565b600681111561180157fe5b1461181e5760405162461bcd60e51b815260040161085690612a37565b6000603d828154811061182d57fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b031661186881612375565b6118845760405162461bcd60e51b8152600401610856906129f4565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b038516916118c891612897565b600060405180830381855af49150503d8060008114611903576040519150601f19603f3d011682016040523d82523d6000602084013e611908565b606091505b50915091508161194b57805115611933578060405162461bcd60e51b815260040161085691906129e1565b60405162461bcd60e51b815260040161085690612ed8565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b6001611988836109e5565b600681111561199357fe5b146119b05760405162461bcd60e51b815260040161085690612afd565b6000603d83815481106119bf57fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b909452919094205492945010159080611a1e5760405162461bcd60e51b815260040161085690612d22565b825460ff1615611a6d578254610100900460ff1615611a545760018301546004850154611a4a91611bae565b6004850155611a6d565b60018301546005850154611a6791611bae565b60058501555b8415611a8c576004840154611a829082611bf0565b6004850155611aa1565b6005840154611a9b9082611bf0565b60058501555b6006840154610100900460ff16158015611ad15750603954611acf611ac4611c15565b600387015490611bae565b105b15611b15576005840154600485015411158215158114611b135760068501805461ff001916610100179055603a546003860154611b0d91611bf0565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a546003870154611b60938b93611b5b9391926108c592839190611bf0565b61237b565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b584604051611b9d9190612f6b565b60405180910390a450505050505050565b60006114a683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506123b8565b6000828201838110156114a65760405162461bcd60e51b815260040161085690612ba1565b4290565b6001600160a01b0383166000908152603b6020526040812054603654811015611c545760405162461bcd60e51b815260040161085690612b44565b611c5d84612375565b611c795760405162461bcd60e51b815260040161085690612d59565b6001600160a01b0385166000908152603e60205260409020548015611ceb576000611ca3826109e5565b90506001816006811115611cb357fe5b14158015611ccd57506000816006811115611cca57fe5b14155b611ce95760405162461bcd60e51b815260040161085690612a82565b505b6000611cfb6037546108c5611c15565b90506000611d1460385483611bf090919063ffffffff16565b9050611d1e612509565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff19909316929092179490941617905590611ed06114af565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a54929350611f12928d92611b5b9290916108c5919082908a90611bf0565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d604051611f52949392919061298b565b60405180910390a39998505050505050505050565b336000908152603f6020526040902054611f7f611c15565b11611f9c5760405162461bcd60e51b815260040161085690612c1c565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054611fea9183906123b8565b336000818152603b6020526040908190209290925590516391fe357360e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316916391fe357391610fda919085906004016128c7565b61166933826123e4565b3381328214612065576000612069565b6152085b61ffff1681156121d45760005a905060005b885181101561213257600089828151811061209257fe5b6020908102919091018101516001600160a01b038082166000908152603c909352604090922054909250163314806120d257506001600160a01b03811633145b6120ee5760405162461bcd60e51b815260040161085690612ea1565b8615806121025750612100898261154f565b155b61211e5760405162461bcd60e51b815260040161085690612f0f565b612129818a8a61197d565b5060010161207b565b50600061214a6127106108c5856108c55a8790611bae565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce8079061219b90889085906004016128c7565b600060405180830381600087803b1580156121b557600080fd5b505af11580156121c9573d6000803e3d6000fd5b5050505050506117be565b60005b875181101561228e5760008882815181106121ee57fe5b6020908102919091018101516001600160a01b038082166000908152603c9093526040909220549092501633148061222e57506001600160a01b03811633145b61224a5760405162461bcd60e51b815260040161085690612ea1565b85158061225e575061225c888261154f565b155b61227a5760405162461bcd60e51b815260040161085690612f0f565b61228581898961197d565b506001016121d7565b5050505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b60008183106122ee57816114a6565b5090919050565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf9061233190899030908a908a908a908a908a9060040161294a565b600060405180830381600087803b15801561234b57600080fd5b505af115801561235f573d6000803e3d6000fd5b5050505061236d86866123e4565b505050505050565b3b151590565b6001600160a01b0382166000908152603f6020526040902054811115610e17576001600160a01b03919091166000908152603f6020526040902055565b600081848411156123dc5760405162461bcd60e51b815260040161085691906129e1565b505050900390565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd906124389085907f00000000000000000000000000000000000000000000000000000000000000009086906004016128e0565b602060405180830381600087803b15801561245257600080fd5b505af1158015612466573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061248a91906127dc565b6124a65760405162461bcd60e51b815260040161085690612c53565b6001600160a01b0382166000908152603b60205260409020546124c99082611bf0565b6001600160a01b039092166000908152603b602052604090209190915550565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b03811681146114a957600080fd5b80356114a981612fe0565b600082601f830112612596578081fd5b813567ffffffffffffffff8111156125ac578182fd5b6125bf601f8201601f1916602001612f74565b91508082528360208285010111156125d657600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215612600578081fd5b6114a68383612564565b60008060006060848603121561261e578182fd5b833561262981612fcb565b9250602084013561263981612fcb565b9150604084013567ffffffffffffffff811115612654578182fd5b61266086828701612586565b9150509250925092565b6000806040838503121561267c578182fd5b823561268781612fcb565b9150602083013567ffffffffffffffff8111156126a2578182fd5b6126ae85828601612586565b9150509250929050565b60008060008060008060c087890312156126d0578182fd5b6126da8888612564565b95506020870135945060408701359350606087013560ff811681146126fd578283fd5b9598949750929560808101359460a0909101359350915050565b60008060006060848603121561272b578283fd5b833567ffffffffffffffff80821115612742578485fd5b818601915086601f830112612755578485fd5b813581811115612763578586fd5b60209150818102612775838201612f74565b8281528381019085850183870186018c101561278f57898afd5b8996505b848710156127b9576127a58c82612564565b835260019690960195918501918501612793565b50975050505085013592506127d39050856040860161257b565b90509250925092565b6000602082840312156127ed578081fd5b81516114a681612fe0565b600060208284031215612809578081fd5b5035919050565b60008060408385031215612822578182fd5b823591506128338460208501612564565b90509250929050565b6000806040838503121561284e578182fd5b82359150602083013561286081612fe0565b809150509250929050565b60008151808452612883816020860160208601612f9b565b601f01601f19169290920160200192915050565b600082516128a9818460208701612f9b565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b0386168252846020830152836040830152608060608301526129b8608083018461286b565b9695505050505050565b901515815260200190565b60208101600783106129db57fe5b91905290565b6000602082526114a6602083018461286b565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526010908201526f43616e206e6f7420626520656d70747960801b604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252600d908201526c6f6e6c79206d756c746973696760981b604082015260600190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b60208082526019908201527f476f7665726e616e63653a20766f74656420616c726561647900000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b90815260200190565b60405181810167ffffffffffffffff81118282101715612f9357600080fd5b604052919050565b60005b83811015612fb6578181015183820152602001612f9e565b83811115612fc5576000848401525b50505050565b6001600160a01b038116811461166957600080fd5b801515811461166957600080fdfea2646970667358221220e1f35bea256ff1c0e43f98312094903f31941303df43a2edbe8b9bd0fa323c8864736f6c634300060c0033"; +const isSuperArgs$d = (xs) => xs.length > 1; +class GovernanceStakingUpgrade__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$d(args)) { + super(...args); + } else { + super(_abi$e, _bytecode$d, args[0]); + } + } + getDeployTransaction(stakingRewardsAddress, gasCompLogic, userVaultAddress, overrides) { + return super.getDeployTransaction( + stakingRewardsAddress, + gasCompLogic, + userVaultAddress, + overrides || {} + ); + } + deploy(stakingRewardsAddress, gasCompLogic, userVaultAddress, overrides) { + return super.deploy( + stakingRewardsAddress, + gasCompLogic, + userVaultAddress, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$d; + static abi = _abi$e; + static createInterface() { + return new interface_Interface(_abi$e); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$e, + runner + ); + } +} + +var index$8 = /*#__PURE__*/Object.freeze({ + __proto__: null, + GovernanceStakingUpgrade__factory: GovernanceStakingUpgrade__factory, + interfaces: index$9 +}); + +const _abi$d = [ + { + inputs: [ + { + internalType: "bytes32", + name: "salt", + type: "bytes32" + }, + { + internalType: "address", + name: "implementationContract", + type: "address" + }, + { + internalType: "bytes", + name: "metamorphicContractInitializationCalldata", + type: "bytes" + } + ], + name: "deployMetamorphicContractFromExistingImplementation", + outputs: [ + { + internalType: "address", + name: "metamorphicContractAddress", + type: "address" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "salt", + type: "bytes32" + } + ], + name: "findMetamorphicContractAddress", + outputs: [ + { + internalType: "address", + name: "metamorphicContractAddress", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +class IMetamorphicContractFactory__factory { + static abi = _abi$d; + static createInterface() { + return new interface_Interface(_abi$d); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$d, + runner + ); + } +} + +var index$7 = /*#__PURE__*/Object.freeze({ + __proto__: null, + IMetamorphicContractFactory__factory: IMetamorphicContractFactory__factory +}); + +const _abi$c = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "num", + type: "uint256" + } + ], + name: "MockExecuted", + type: "event" + }, + { + inputs: [], + name: "emergencyStop", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "executeProposal", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$c = "0x608060405234801561001057600080fd5b5060c08061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c8063373058b814603757806363a599a414603f575b600080fd5b603d6045565b005b603d607d565b7f2ff532ec74fd1130db9b7b6800e0992b2363095b00331a891a27edfab97c45406001604051607391906081565b60405180910390a1565b6000ff5b9081526020019056fea264697066735822122018779fa63005d6573862657b4a5cd55f75b705b28a7ff69222461665b78f408a64736f6c634300060c0033"; +const isSuperArgs$c = (xs) => xs.length > 1; +class InitialProposal__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$c(args)) { + super(...args); + } else { + super(_abi$c, _bytecode$c, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$c; + static abi = _abi$c; + static createInterface() { + return new interface_Interface(_abi$c); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$c, runner); + } +} + +const _abi$b = [ + { + inputs: [], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "num", + type: "uint256" + } + ], + name: "MockExecuted", + type: "event" + }, + { + inputs: [], + name: "deployer", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "emergencyStop", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "executeProposal", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$b = "0x60a060405234801561001057600080fd5b5033606081901b6080526102746100366000398061012952806101b052506102746000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063373058b81461004657806363a599a414610050578063d5f3948814610058575b600080fd5b61004e610076565b005b61004e6101aa565b6100606101ae565b60405161006d9190610211565b60405180910390f35b6040516370a0823160e01b81527377777feddddffc19ff86db637967013e6c6a116c9060009082906370a08231906100b2903090600401610211565b60206040518083038186803b1580156100ca57600080fd5b505afa1580156100de573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010291906101f9565b60405163a9059cbb60e01b81529091506001600160a01b0383169063a9059cbb90610153907f0000000000000000000000000000000000000000000000000000000000000000908590600401610225565b602060405180830381600087803b15801561016d57600080fd5b505af1158015610181573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a591906101d2565b505050565b6000ff5b7f000000000000000000000000000000000000000000000000000000000000000081565b6000602082840312156101e3578081fd5b815180151581146101f2578182fd5b9392505050565b60006020828403121561020a578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b0392909216825260208201526040019056fea2646970667358221220c120adf2a3856eb39e4d2305abf19175fb5f11d87cd96e5c70ce2a9f702ba53664736f6c634300060c0033"; +const isSuperArgs$b = (xs) => xs.length > 1; +class MaliciousProposal__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$b(args)) { + super(...args); + } else { + super(_abi$b, _bytecode$b, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$b; + static abi = _abi$b; + static createInterface() { + return new interface_Interface(_abi$b); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$b, runner); + } +} + +var index$6 = /*#__PURE__*/Object.freeze({ + __proto__: null, + InitialProposal__factory: InitialProposal__factory, + MaliciousProposal__factory: MaliciousProposal__factory +}); + +var index$5 = /*#__PURE__*/Object.freeze({ + __proto__: null, + mockProposalsSol: index$6 +}); + +const _abi$a = [ + { + inputs: [ + { + internalType: "address", + name: "_logic", + type: "address" + }, + { + internalType: "address", + name: "_admin", + type: "address" + }, + { + internalType: "bytes", + name: "_data", + type: "bytes" + } + ], + stateMutability: "payable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "previousAdmin", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "AdminChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "implementation", + type: "address" + } + ], + name: "Upgraded", + type: "event" + }, + { + stateMutability: "payable", + type: "fallback" + }, + { + inputs: [], + name: "admin", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "changeAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "implementation", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + } + ], + name: "upgradeTo", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "upgradeToAndCall", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$a = "0x60806040526040516108403803806108408339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508390508282816100f1826101c5565b8051156101a9576000826001600160a01b0316826040518082805190602001908083835b602083106101345780518252601f199092019160209182019101610115565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610194576040519150601f19603f3d011682016040523d82523d6000602084013e610199565b606091505b50509050806101a757600080fd5b505b506101b19050565b6101ba82610237565b505050505050610261565b6101d88161025b60201b6103b41760201c565b6102135760405162461bcd60e51b815260040180806020018281038252603681526020018061080a6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3b151590565b61059a806102706000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996101a9565b6101a96101a46103ba565b6103df565b565b6101b3610403565b6001600160a01b0316336001600160a01b031614156101da576101d581610428565b6101e2565b6101e2610191565b50565b6101ed610403565b6001600160a01b0316336001600160a01b031614156102855761020f83610428565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610403565b6001600160a01b0316336001600160a01b031614156102c4576102bd6103ba565b90506102cc565b6102cc610191565b90565b6102d7610403565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b815260040180806020018281038252603a8152602001806104f5603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610403565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d581610468565b6000610393610403565b6001600160a01b0316336001600160a01b031614156102c4576102bd610403565b3b151590565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156103fe573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6104318161048c565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610495816103b4565b6104d05760405162461bcd60e51b815260040180806020018281038252603681526020018061052f6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374a26469706673582212203c0c6456361fbff816ff53c5547d39ad0e807130f877d2661772f7bffc95b82764736f6c634300060c00335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374"; +const isSuperArgs$a = (xs) => xs.length > 1; +let AdminUpgradeableProxy__factory$1 = class AdminUpgradeableProxy__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$a(args)) { + super(...args); + } else { + super(_abi$a, _bytecode$a, args[0]); + } + } + getDeployTransaction(_logic, _admin, _data, overrides) { + return super.getDeployTransaction(_logic, _admin, _data, overrides || {}); + } + deploy(_logic, _admin, _data, overrides) { + return super.deploy(_logic, _admin, _data, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$a; + static abi = _abi$a; + static createInterface() { + return new interface_Interface(_abi$a); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$a, + runner + ); + } +}; + +const _abi$9 = [ + { + inputs: [ + { + internalType: "address", + name: "stakingRewardsAddress", + type: "address" + }, + { + internalType: "address", + name: "gasCompLogic", + type: "address" + }, + { + internalType: "address", + name: "userVaultAddress", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + } + ], + name: "Delegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "proposer", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + indexed: false, + internalType: "string", + name: "description", + type: "string" + } + ], + name: "ProposalCreated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "ProposalExecuted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "bytes", + name: "errorData", + type: "bytes" + } + ], + name: "RewardUpdateFailed", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + } + ], + name: "RewardUpdateSuccessful", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + } + ], + name: "Undelegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "voter", + type: "address" + }, + { + indexed: true, + internalType: "bool", + name: "support", + type: "bool" + }, + { + indexed: false, + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + name: "Voted", + type: "event" + }, + { + inputs: [], + name: "CLOSING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_EXPIRATION", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PROPOSAL_THRESHOLD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "QUORUM_VOTES", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "Staking", + outputs: [ + { + internalType: "contract ITornadoStakingRewards", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTE_EXTEND_TIME", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "canWithdrawAfter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "from", + type: "address[]" + }, + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castDelegatedVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "checkIfQuorumReached", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + } + ], + name: "delegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "delegatedTo", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "execute", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "gasCompensationVault", + outputs: [ + { + internalType: "contract IGasCompensationVault", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "voter", + type: "address" + } + ], + name: "getReceipt", + outputs: [ + { + components: [ + { + internalType: "bool", + name: "hasVoted", + type: "bool" + }, + { + internalType: "bool", + name: "support", + type: "bool" + }, + { + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + internalType: "struct Governance.Receipt", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "hasAccountVoted", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "latestProposalIds", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "lock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "lockWithApproval", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "lockedBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "proposalCodehashes", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "proposalCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "proposals", + outputs: [ + { + internalType: "address", + name: "proposer", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "forVotes", + type: "uint256" + }, + { + internalType: "uint256", + name: "againstVotes", + type: "uint256" + }, + { + internalType: "bool", + name: "executed", + type: "bool" + }, + { + internalType: "bool", + name: "extended", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "propose", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "proposeByDelegate", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "returnMultisigAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "closingPeriod", + type: "uint256" + } + ], + name: "setClosingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionDelay", + type: "uint256" + } + ], + name: "setExecutionDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionExpiration", + type: "uint256" + } + ], + name: "setExecutionExpiration", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "gasCompensationsLimit", + type: "uint256" + } + ], + name: "setGasCompensations", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalThreshold", + type: "uint256" + } + ], + name: "setProposalThreshold", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "quorumVotes", + type: "uint256" + } + ], + name: "setQuorumVotes", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "voteExtendTime", + type: "uint256" + } + ], + name: "setVoteExtendTime", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingDelay", + type: "uint256" + } + ], + name: "setVotingDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingPeriod", + type: "uint256" + } + ], + name: "setVotingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "state", + outputs: [ + { + internalType: "enum Governance.ProposalState", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract TORN", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "undelegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "unlock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "userVault", + outputs: [ + { + internalType: "contract ITornadoVault", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "version", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdrawFromHelper", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$9 = "0x60e06040523480156200001157600080fd5b50604051620034343803806200343483398101604081905262000034916200016b565b82828281818181600060019054906101000a900460ff16806200005c57506200005c62000124565b806200006b575060005460ff16155b620000935760405162461bcd60e51b81526004016200008a90620001be565b60405180910390fd5b600054610100900460ff16158015620000bf576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000dd6200012a565b8015620000f0576000805461ff00191690555b506001600160601b0319606091821b811660805291811b821660a0529590951b90941660c052506200022595505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b60008060006060848603121562000180578283fd5b83516200018d816200020c565b6020850151909350620001a0816200020c565b6040850151909250620001b3816200020c565b809150509250925092565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6001600160a01b03811681146200022257600080fd5b50565b60805160601c60a05160601c60c05160601c6131ac6200028860003980610d1352806110d452806116c752806117f85250806109105280610eca5280610fc252806116435280611d6d52508061105d5280611c1652806124f152506131ac6000f3fe6080604052600436106102815760003560e01c80639daafec71161014f578063d6f0948c116100c1578063ea0217cf1161007a578063ea0217cf14610755578063ece40cc114610775578063ef3f8bb114610795578063f0b76892146107b5578063f57df22e146107d5578063fe0d94c1146107ea57610288565b8063d6f0948c14610693578063da35c664146106b3578063e01f5237146106c8578063e23a9a52146106e8578063e4917d9f14610715578063e525aa081461073557610288565b8063b54426c811610113578063b54426c8146105e9578063b859f11b14610609578063c0c0e82014610629578063c4d66de814610649578063ce25d71c14610669578063d6159fe51461067e57610288565b80639daafec714610575578063a6c266031461058a578063a72edda31461059f578063adf898a4146105bf578063b1610d7e146105d457610288565b80635c19a95c116101f357806370b0f660116101ac57806370b0f660146104cb5780638b34a960146104eb57806392ab89bb14610500578063932d5157146105155780639a9e3b6e146105355780639ae697bf1461055557610288565b80635c19a95c146104215780636198e3391461044157806365da126414610461578063671dd275146104815780636a661755146104965780636dc2dc6c146104ab57610288565b806332687ec11161024557806332687ec11461035b57806337f135d7146103885780633e4f49e61461039d57806354fd4d50146103ca578063587a6ecb146103ec57806358e9fff01461040157610288565b8063013cf08b1461028d57806302ec8f9e146102ca57806315373e3d146102ec57806317977c611461030c57806324b0435f1461033957610288565b3661028857005b600080fd5b34801561029957600080fd5b506102ad6102a83660046128e1565b6107fd565b6040516102c19897969594939291906129ed565b60405180910390f35b3480156102d657600080fd5b506102ea6102e53660046128e1565b610862565b005b3480156102f857600080fd5b506102ea610307366004612925565b61088f565b34801561031857600080fd5b5061032c6103273660046126d8565b610992565b6040516102c19190612ab6565b34801561034557600080fd5b5061034e6109a4565b6040516102c1919061299c565b34801561036757600080fd5b5061037b6103763660046128e1565b6109bc565b6040516102c19190612aab565b34801561039457600080fd5b5061032c610a0a565b3480156103a957600080fd5b506103bd6103b83660046128e1565b610a10565b6040516102c19190612abf565b3480156103d657600080fd5b506103df610b4c565b6040516102c19190612ad3565b3480156103f857600080fd5b5061032c610b75565b34801561040d57600080fd5b5061032c61041c3660046126f3565b610b7b565b34801561042d57600080fd5b506102ea61043c3660046126d8565b610bc9565b34801561044d57600080fd5b506102ea61045c3660046128e1565b610ceb565b34801561046d57600080fd5b5061034e61047c3660046126d8565b610e38565b34801561048d57600080fd5b5061032c610e53565b3480156104a257600080fd5b5061032c610e59565b3480156104b757600080fd5b506102ea6104c63660046128e1565b610e5f565b3480156104d757600080fd5b506102ea6104e63660046128e1565b610ea4565b3480156104f757600080fd5b5061034e610ec8565b34801561050c57600080fd5b506102ea610eec565b34801561052157600080fd5b506102ea6105303660046128e1565b610f73565b34801561054157600080fd5b506102ea6105503660046128e1565b611025565b34801561056157600080fd5b5061032c6105703660046126d8565b611049565b34801561058157600080fd5b5061034e61105b565b34801561059657600080fd5b5061032c61107f565b3480156105ab57600080fd5b5061032c6105ba3660046126d8565b611085565b3480156105cb57600080fd5b5061034e611097565b3480156105e057600080fd5b5061032c6110a6565b3480156105f557600080fd5b506102ea6106043660046128e1565b6110ac565b34801561061557600080fd5b506102ea610624366004612800565b6111f5565b34801561063557600080fd5b506102ea6106443660046128e1565b611243565b34801561065557600080fd5b506102ea6106643660046126d8565b611267565b34801561067557600080fd5b5061032c6114aa565b34801561068a57600080fd5b5061032c6114b0565b34801561069f57600080fd5b5061032c6106ae366004612753565b6114b6565b3480156106bf57600080fd5b5061032c6114cc565b3480156106d457600080fd5b5061032c6106e33660046128e1565b6114d6565b3480156106f457600080fd5b506107086107033660046128f9565b6114e8565b6040516102c191906130db565b34801561072157600080fd5b506102ea6107303660046128e1565b61155a565b34801561074157600080fd5b5061037b6107503660046128f9565b61157e565b34801561076157600080fd5b506102ea6107703660046128e1565b6115c1565b34801561078157600080fd5b506102ea6107903660046128e1565b6115e5565b3480156107a157600080fd5b506102ea6107b03660046128e1565b611609565b3480156107c157600080fd5b506102ea6107d03660046127a1565b61169b565b3480156107e157600080fd5b5061034e6117f6565b6102ea6107f83660046128e1565b61181a565b603d818154811061080a57fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b33301461088a5760405162461bcd60e51b815260040161088190612e49565b60405180910390fd5b603555565b3361089a833361157e565b1580156108ad57506108ab836109bc565b155b3332146108bb5760006108bf565b6152085b61ffff1681156109805760005a90506108d93387876118ac565b60006108f66127106108f0856108f05a8790611add565b90611b1f565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce8079061094790889085906004016129b0565b600060405180830381600087803b15801561096157600080fd5b505af1158015610975573d6000803e3d6000fd5b50505050505061098b565b61098b3386866118ac565b5050505050565b603e6020526000908152604090205481565b73b04e030140b30c27bcdfaafffa98c57d80eda7b490565b6000603554603d83815481106109ce57fe5b906000526020600020906008020160050154603d84815481106109ed57fe5b90600052602060002090600802016004015401101590505b919050565b60335481565b6000610a1a6114cc565b8211158015610a295750600082115b610a455760405162461bcd60e51b815260040161088190612fa6565b6000603d8381548110610a5457fe5b906000526020600020906008020190508060020154610a71611b44565b11610a80576000915050610a05565b8060030154610a8d611b44565b11610a9c576001915050610a05565b80600501548160040154111580610abe57506035548160050154826004015401105b15610acd576002915050610a05565b600681015460ff1615610ae4576005915050610a05565b610b036034546108f06033548460030154611b1f90919063ffffffff16565b610b0b611b44565b10610b1a576006915050610a05565b6033546003820154610b2b91611b1f565b610b33611b44565b10610b42576004915050610a05565b6003915050610a05565b60408051808201909152600f81526e0d0b9c185d18da0b595e1c1b1bda5d608a1b602082015290565b603a5481565b6001600160a01b038381166000908152603c60205260408120549091163314610bb65760405162461bcd60e51b815260040161088190613036565b610bc1848484611b48565b949350505050565b336000818152603c60205260409020546001600160a01b039081169190831614801590610bff57506001600160a01b0382163014155b8015610c1357506001600160a01b03821615155b8015610c315750806001600160a01b0316826001600160a01b031614155b610c4d5760405162461bcd60e51b815260040161088190612e80565b6001600160a01b03811615610c93576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f91610d489185916004016129b0565b600060405180830381600087803b158015610d6257600080fd5b505af1925050508015610d73575060015b610df6573d808015610da1576040519150601f19603f3d011682016040523d82523d6000602084013e610da6565b606091505b5080604051610db59190612980565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a350610e2b565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e3482611b70565b5050565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610e7e5760405162461bcd60e51b815260040161088190612e49565b6033548110610e9f5760405162461bcd60e51b815260040161088190612d6d565b603a55565b333014610ec35760405162461bcd60e51b815260040161088190612e49565b603755565b7f000000000000000000000000000000000000000000000000000000000000000081565b336000908152603c60205260409020546001600160a01b031680610f225760405162461bcd60e51b815260040161088190612fec565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b610f7b6109a4565b6001600160a01b0316336001600160a01b031614610fab5760405162461bcd60e51b815260040161088190612f7f565b604051633a08bde160e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e822f78490610ff7908490600401612ab6565b600060405180830381600087803b15801561101157600080fd5b505af115801561098b573d6000803e3d6000fd5b3330146110445760405162461bcd60e51b815260040161088190612e49565b603455565b603b6020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916111099185916004016129b0565b600060405180830381600087803b15801561112357600080fd5b505af1925050508015611134575060015b6111b7573d808015611162576040519150601f19603f3d011682016040523d82523d6000602084013e611167565b606091505b50806040516111769190612980565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506111ec565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e3482611c54565b60008351116112165760405162461bcd60e51b815260040161088190612e1f565b61123e838383611226863361157e565b1580156112395750611237866109bc565b155b611c5e565b505050565b3330146112625760405162461bcd60e51b815260040161088190612e49565b603955565b600054610100900460ff16806112805750611280611ea1565b8061128e575060005460ff16155b6112aa5760405162461bcd60e51b815260040161088190612f31565b600054610100900460ff161580156112d5576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff199094169390931716919091179055611495611ea7565b8015610e34576000805461ff00191690555050565b60395481565b60375481565b60006114c3338484611b48565b90505b92915050565b603d546000190190565b60416020526000908152604090205481565b6114f06125d2565b603d83815481106114fd57fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b3330146115795760405162461bcd60e51b815260040161088190612e49565b603355565b6000603d838154811061158d57fe5b600091825260208083206001600160a01b03861684526007600890930201919091019052604090205460ff16905092915050565b3330146115e05760405162461bcd60e51b815260040161088190612e49565b603855565b3330146116045760405162461bcd60e51b815260040161088190612e49565b603655565b6116116109a4565b6001600160a01b0316336001600160a01b0316146116415760405162461bcd60e51b815260040161088190612f7f565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166108fc6116788347611ee8565b6040518115909202916000818181858888f1935050505061169857600080fd5b50565b6001600160a01b038087166000908152603b60205260409081902054905163e113335f60e01b815288927f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916116fc9185916004016129b0565b600060405180830381600087803b15801561171657600080fd5b505af1925050508015611727575060015b6117aa573d808015611755576040519150601f19603f3d011682016040523d82523d6000602084013e61175a565b606091505b50806040516117699190612980565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506117df565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b6117ed878787878787611efe565b50505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b3330141561183a5760405162461bcd60e51b815260040161088190612c36565b6000603d828154811061184957fe5b6000918252602080832060016008909302019182015485845260419091526040909220549092506001600160a01b0390911690813f90811461189d5760405162461bcd60e51b815260040161088190612d17565b6118a684611f7e565b50505050565b60016118b783610a10565b60068111156118c257fe5b146118df5760405162461bcd60e51b815260040161088190612bef565b6000603d83815481106118ee57fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b90945291909420549294501015908061194d5760405162461bcd60e51b815260040161088190612eb7565b825460ff161561199c578254610100900460ff1615611983576001830154600485015461197991611add565b600485015561199c565b6001830154600585015461199691611add565b60058501555b84156119bb5760048401546119b19082611b1f565b60048501556119d0565b60058401546119ca9082611b1f565b60058501555b6006840154610100900460ff16158015611a0057506039546119fe6119f3611b44565b600387015490611add565b105b15611a44576005840154600485015411158215158114611a425760068501805461ff001916610100179055603a546003860154611a3c91611b1f565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a546003870154611a8f938b93611a8a9391926108f092839190611b1f565b612110565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b584604051611acc9190612ab6565b60405180910390a450505050505050565b60006114c383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061214d565b6000828201838110156114c35760405162461bcd60e51b815260040161088190612ce0565b4290565b6000611b55848484612179565b6000818152604160205260409020933f909355509092915050565b336000908152603f6020526040902054611b88611b44565b11611ba55760405162461bcd60e51b815260040161088190612db1565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054611bf391839061214d565b336000818152603b6020526040908190209290925590516391fe357360e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316916391fe357391610ff7919085906004016129b0565b61169833826124c7565b3381328214611c6e576000611c72565b6152085b61ffff168115611ddd5760005a905060005b8851811015611d3b576000898281518110611c9b57fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611cdb57506001600160a01b03811633145b611cf75760405162461bcd60e51b815260040161088190613036565b861580611d0b5750611d09898261157e565b155b611d275760405162461bcd60e51b8152600401610881906130a4565b611d32818a8a6118ac565b50600101611c84565b506000611d536127106108f0856108f05a8790611add565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce80790611da490889085906004016129b0565b600060405180830381600087803b158015611dbe57600080fd5b505af1158015611dd2573d6000803e3d6000fd5b5050505050506117ed565b60005b8751811015611e97576000888281518110611df757fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611e3757506001600160a01b03811633145b611e535760405162461bcd60e51b815260040161088190613036565b851580611e675750611e65888261157e565b155b611e835760405162461bcd60e51b8152600401610881906130a4565b611e8e8189896118ac565b50600101611de0565b5050505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6000818310611ef757816114c3565b5090919050565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf90611f3a90899030908a908a908a908a908a90600401612a33565b600060405180830381600087803b158015611f5457600080fd5b505af1158015611f68573d6000803e3d6000fd5b50505050611f7686866124c7565b505050505050565b6004611f8982610a10565b6006811115611f9457fe5b14611fb15760405162461bcd60e51b815260040161088190612b29565b6000603d8281548110611fc057fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b0316611ffb816125cc565b6120175760405162461bcd60e51b815260040161088190612ae6565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b0385169161205b91612980565b600060405180830381855af49150503d8060008114612096576040519150601f19603f3d011682016040523d82523d6000602084013e61209b565b606091505b5091509150816120de578051156120c6578060405162461bcd60e51b81526004016108819190612ad3565b60405162461bcd60e51b81526004016108819061306d565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b6001600160a01b0382166000908152603f6020526040902054811115610e34576001600160a01b03919091166000908152603f6020526040902055565b600081848411156121715760405162461bcd60e51b81526004016108819190612ad3565b505050900390565b6001600160a01b0383166000908152603b60205260408120546036548110156121b45760405162461bcd60e51b815260040161088190612c83565b6121bd846125cc565b6121d95760405162461bcd60e51b815260040161088190612eee565b6001600160a01b0385166000908152603e6020526040902054801561224b57600061220382610a10565b9050600181600681111561221357fe5b1415801561222d5750600081600681111561222a57fe5b14155b6122495760405162461bcd60e51b815260040161088190612b74565b505b600061225b6037546108f0611b44565b9050600061227460385483611b1f90919063ffffffff16565b905061227e6125f2565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff199093169290921794909416179055906124306114cc565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a54929350612472928d92611a8a9290916108f0919082908a90611b1f565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d6040516124b29493929190612a74565b60405180910390a39998505050505050505050565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd9061251b9085907f00000000000000000000000000000000000000000000000000000000000000009086906004016129c9565b602060405180830381600087803b15801561253557600080fd5b505af1158015612549573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061256d91906128c5565b6125895760405162461bcd60e51b815260040161088190612de8565b6001600160a01b0382166000908152603b60205260409020546125ac9082611b1f565b6001600160a01b039092166000908152603b602052604090209190915550565b3b151590565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b03811681146114c657600080fd5b80356114c681613168565b600082601f83011261267f578081fd5b813567ffffffffffffffff811115612695578182fd5b6126a8601f8201601f1916602001613100565b91508082528360208285010111156126bf57600080fd5b8060208401602084013760009082016020015292915050565b6000602082840312156126e9578081fd5b6114c3838361264d565b600080600060608486031215612707578182fd5b833561271281613153565b9250602084013561272281613153565b9150604084013567ffffffffffffffff81111561273d578182fd5b6127498682870161266f565b9150509250925092565b60008060408385031215612765578182fd5b823561277081613153565b9150602083013567ffffffffffffffff81111561278b578182fd5b6127978582860161266f565b9150509250929050565b60008060008060008060c087890312156127b9578182fd5b6127c3888861264d565b95506020870135945060408701359350606087013560ff811681146127e6578283fd5b9598949750929560808101359460a0909101359350915050565b600080600060608486031215612814578283fd5b833567ffffffffffffffff8082111561282b578485fd5b818601915086601f83011261283e578485fd5b81358181111561284c578586fd5b6020915081810261285e838201613100565b8281528381019085850183870186018c101561287857898afd5b8996505b848710156128a25761288e8c8261264d565b83526001969096019591850191850161287c565b50975050505085013592506128bc90508560408601612664565b90509250925092565b6000602082840312156128d6578081fd5b81516114c381613168565b6000602082840312156128f2578081fd5b5035919050565b6000806040838503121561290b578182fd5b8235915061291c846020850161264d565b90509250929050565b60008060408385031215612937578182fd5b82359150602083013561294981613168565b809150509250929050565b6000815180845261296c816020860160208601613127565b601f01601f19169290920160200192915050565b60008251612992818460208701613127565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b038616825284602083015283604083015260806060830152612aa16080830184612954565b9695505050505050565b901515815260200190565b90815260200190565b6020810160078310612acd57fe5b91905290565b6000602082526114c36020830184612954565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252602d908201527f476f7665726e616e63653a3a70726f706f73653a2070736575646f2d6578746560408201526c393730b610333ab731ba34b7b760991b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526036908201527f476f7665726e616e63653a3a70726f706f73653a206d6574616d6f72706869636040820152750818dbdb9d1c9858dd1cc81b9bdd08185b1b1bddd95960521b606082015260800190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526010908201526f43616e206e6f7420626520656d70747960801b604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252600d908201526c6f6e6c79206d756c746973696760981b604082015260600190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b60208082526019908201527f476f7665726e616e63653a20766f74656420616c726561647900000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b60405181810167ffffffffffffffff8111828210171561311f57600080fd5b604052919050565b60005b8381101561314257818101518382015260200161312a565b838111156118a65750506000910152565b6001600160a01b038116811461169857600080fd5b801515811461169857600080fdfea2646970667358221220b75004153b6c8b4905c018daca78cb0fa6d3859298be55252bcf6ba75ea68d0e64736f6c634300060c0033"; +const isSuperArgs$9 = (xs) => xs.length > 1; +class GovernanceExploitPatchUpgrade__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$9(args)) { + super(...args); + } else { + super(_abi$9, _bytecode$9, args[0]); + } + } + getDeployTransaction(stakingRewardsAddress, gasCompLogic, userVaultAddress, overrides) { + return super.getDeployTransaction( + stakingRewardsAddress, + gasCompLogic, + userVaultAddress, + overrides || {} + ); + } + deploy(stakingRewardsAddress, gasCompLogic, userVaultAddress, overrides) { + return super.deploy( + stakingRewardsAddress, + gasCompLogic, + userVaultAddress, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$9; + static abi = _abi$9; + static createInterface() { + return new interface_Interface(_abi$9); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$9, + runner + ); + } +} + +const _abi$8 = [ + { + inputs: [ + { + internalType: "address", + name: "_deployedStakingProxyContractAddress", + type: "address" + }, + { + internalType: "address", + name: "_deployedRelayerRegistryImplementationAddress", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "TORN", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "deployedRelayerRegistryImplementationAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "deployedStakingProxyContractAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "executeProposal", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "gasCompensationVaultAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "governanceProxyAddress", + outputs: [ + { + internalType: "address payable", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "oldStakingProxyAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "registryProxyAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "userVaultAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } +]; +const _bytecode$8 = "0x60c060405234801561001057600080fd5b50604051613adb380380613adb83398101604081905261002f9161004d565b6001600160601b0319606092831b8116608052911b1660a05261009e565b6000806040838503121561005f578182fd5b825161006a81610086565b602084015190925061007b81610086565b809150509250929050565b6001600160a01b038116811461009b57600080fd5b50565b60805160601c60a05160601c613a056100d66000398061027a52806104985250806102f952806103f452806104bc5250613a056000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063373058b811610066578063373058b8146100ce5780634655478f146100d857806361697d64146100e05780636fc6091d146100e85780639b49989a146100f057610093565b80630cc784761461009857806313f32237146100b657806324044543146100be57806332bf1039146100c6575b600080fd5b6100a06100f8565b6040516100ad9190610542565b60405180910390f35b6100a0610110565b6100a0610128565b6100a0610140565b6100d6610158565b005b6100a061047e565b6100a0610496565b6100a06104ba565b6100a06104de565b7358e8dcc13be9780fc42e8723d8ead4cf46943df281565b732fc93484614a34f26f7970cbb94615ba109bb4bf81565b73fa4c1f3f7d5dd7c12a9adb82cd7dda542e3d59ef81565b7377777feddddffc19ff86db637967013e6c6a116c81565b6040516370a0823160e01b8152732fc93484614a34f26f7970cbb94615ba109bb4bf90819063f58073b1907377777feddddffc19ff86db637967013e6c6a116c906370a08231906101ad908590600401610542565b60206040518083038186803b1580156101c557600080fd5b505afa1580156101d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fd919061052a565b6040518263ffffffff1660e01b81526004016102199190610592565b600060405180830381600087803b15801561023357600080fd5b505af1158015610247573d6000803e3d6000fd5b5050604051631b2ce7f360e11b81527358e8dcc13be9780fc42e8723d8ead4cf46943df29250633659cfe691506102a2907f000000000000000000000000000000000000000000000000000000000000000090600401610542565b600060405180830381600087803b1580156102bc57600080fd5b505af11580156102d0573d6000803e3d6000fd5b50505050735efda50f22d34f262c29268506c5fa42cb56a1ce6001600160a01b0316633659cfe67f000000000000000000000000000000000000000000000000000000000000000073fa4c1f3f7d5dd7c12a9adb82cd7dda542e3d59ef732f50508a8a3d323b91336fa3ea6ae50e55f3218560405161034e906104f6565b61035a93929190610556565b604051809103906000f080158015610376573d6000803e3d6000fd5b506040518263ffffffff1660e01b81526004016103939190610542565b600060405180830381600087803b1580156103ad57600080fd5b505af11580156103c1573d6000803e3d6000fd5b505060405163a9059cbb60e01b81527377777feddddffc19ff86db637967013e6c6a116c925063a9059cbb9150610428907f0000000000000000000000000000000000000000000000000000000000000000906913ecbccf7737e6b0000090600401610579565b602060405180830381600087803b15801561044257600080fd5b505af1158015610456573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047a9190610503565b5050565b735efda50f22d34f262c29268506c5fa42cb56a1ce81565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b732f50508a8a3d323b91336fa3ea6ae50e55f3218581565b6134348061059c83390190565b600060208284031215610514578081fd5b81518015158114610523578182fd5b9392505050565b60006020828403121561053b578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b0393841681529183166020830152909116604082015260600190565b6001600160a01b03929092168252602082015260400190565b9081526020019056fe60e06040523480156200001157600080fd5b50604051620034343803806200343483398101604081905262000034916200016b565b82828281818181600060019054906101000a900460ff16806200005c57506200005c62000124565b806200006b575060005460ff16155b620000935760405162461bcd60e51b81526004016200008a90620001be565b60405180910390fd5b600054610100900460ff16158015620000bf576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000dd6200012a565b8015620000f0576000805461ff00191690555b506001600160601b0319606091821b811660805291811b821660a0529590951b90941660c052506200022595505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b60008060006060848603121562000180578283fd5b83516200018d816200020c565b6020850151909350620001a0816200020c565b6040850151909250620001b3816200020c565b809150509250925092565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6001600160a01b03811681146200022257600080fd5b50565b60805160601c60a05160601c60c05160601c6131ac6200028860003980610d1352806110d452806116c752806117f85250806109105280610eca5280610fc252806116435280611d6d52508061105d5280611c1652806124f152506131ac6000f3fe6080604052600436106102815760003560e01c80639daafec71161014f578063d6f0948c116100c1578063ea0217cf1161007a578063ea0217cf14610755578063ece40cc114610775578063ef3f8bb114610795578063f0b76892146107b5578063f57df22e146107d5578063fe0d94c1146107ea57610288565b8063d6f0948c14610693578063da35c664146106b3578063e01f5237146106c8578063e23a9a52146106e8578063e4917d9f14610715578063e525aa081461073557610288565b8063b54426c811610113578063b54426c8146105e9578063b859f11b14610609578063c0c0e82014610629578063c4d66de814610649578063ce25d71c14610669578063d6159fe51461067e57610288565b80639daafec714610575578063a6c266031461058a578063a72edda31461059f578063adf898a4146105bf578063b1610d7e146105d457610288565b80635c19a95c116101f357806370b0f660116101ac57806370b0f660146104cb5780638b34a960146104eb57806392ab89bb14610500578063932d5157146105155780639a9e3b6e146105355780639ae697bf1461055557610288565b80635c19a95c146104215780636198e3391461044157806365da126414610461578063671dd275146104815780636a661755146104965780636dc2dc6c146104ab57610288565b806332687ec11161024557806332687ec11461035b57806337f135d7146103885780633e4f49e61461039d57806354fd4d50146103ca578063587a6ecb146103ec57806358e9fff01461040157610288565b8063013cf08b1461028d57806302ec8f9e146102ca57806315373e3d146102ec57806317977c611461030c57806324b0435f1461033957610288565b3661028857005b600080fd5b34801561029957600080fd5b506102ad6102a83660046128e1565b6107fd565b6040516102c19897969594939291906129ed565b60405180910390f35b3480156102d657600080fd5b506102ea6102e53660046128e1565b610862565b005b3480156102f857600080fd5b506102ea610307366004612925565b61088f565b34801561031857600080fd5b5061032c6103273660046126d8565b610992565b6040516102c19190612ab6565b34801561034557600080fd5b5061034e6109a4565b6040516102c1919061299c565b34801561036757600080fd5b5061037b6103763660046128e1565b6109bc565b6040516102c19190612aab565b34801561039457600080fd5b5061032c610a0a565b3480156103a957600080fd5b506103bd6103b83660046128e1565b610a10565b6040516102c19190612abf565b3480156103d657600080fd5b506103df610b4c565b6040516102c19190612ad3565b3480156103f857600080fd5b5061032c610b75565b34801561040d57600080fd5b5061032c61041c3660046126f3565b610b7b565b34801561042d57600080fd5b506102ea61043c3660046126d8565b610bc9565b34801561044d57600080fd5b506102ea61045c3660046128e1565b610ceb565b34801561046d57600080fd5b5061034e61047c3660046126d8565b610e38565b34801561048d57600080fd5b5061032c610e53565b3480156104a257600080fd5b5061032c610e59565b3480156104b757600080fd5b506102ea6104c63660046128e1565b610e5f565b3480156104d757600080fd5b506102ea6104e63660046128e1565b610ea4565b3480156104f757600080fd5b5061034e610ec8565b34801561050c57600080fd5b506102ea610eec565b34801561052157600080fd5b506102ea6105303660046128e1565b610f73565b34801561054157600080fd5b506102ea6105503660046128e1565b611025565b34801561056157600080fd5b5061032c6105703660046126d8565b611049565b34801561058157600080fd5b5061034e61105b565b34801561059657600080fd5b5061032c61107f565b3480156105ab57600080fd5b5061032c6105ba3660046126d8565b611085565b3480156105cb57600080fd5b5061034e611097565b3480156105e057600080fd5b5061032c6110a6565b3480156105f557600080fd5b506102ea6106043660046128e1565b6110ac565b34801561061557600080fd5b506102ea610624366004612800565b6111f5565b34801561063557600080fd5b506102ea6106443660046128e1565b611243565b34801561065557600080fd5b506102ea6106643660046126d8565b611267565b34801561067557600080fd5b5061032c6114aa565b34801561068a57600080fd5b5061032c6114b0565b34801561069f57600080fd5b5061032c6106ae366004612753565b6114b6565b3480156106bf57600080fd5b5061032c6114cc565b3480156106d457600080fd5b5061032c6106e33660046128e1565b6114d6565b3480156106f457600080fd5b506107086107033660046128f9565b6114e8565b6040516102c191906130db565b34801561072157600080fd5b506102ea6107303660046128e1565b61155a565b34801561074157600080fd5b5061037b6107503660046128f9565b61157e565b34801561076157600080fd5b506102ea6107703660046128e1565b6115c1565b34801561078157600080fd5b506102ea6107903660046128e1565b6115e5565b3480156107a157600080fd5b506102ea6107b03660046128e1565b611609565b3480156107c157600080fd5b506102ea6107d03660046127a1565b61169b565b3480156107e157600080fd5b5061034e6117f6565b6102ea6107f83660046128e1565b61181a565b603d818154811061080a57fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b33301461088a5760405162461bcd60e51b815260040161088190612e49565b60405180910390fd5b603555565b3361089a833361157e565b1580156108ad57506108ab836109bc565b155b3332146108bb5760006108bf565b6152085b61ffff1681156109805760005a90506108d93387876118ac565b60006108f66127106108f0856108f05a8790611add565b90611b1f565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce8079061094790889085906004016129b0565b600060405180830381600087803b15801561096157600080fd5b505af1158015610975573d6000803e3d6000fd5b50505050505061098b565b61098b3386866118ac565b5050505050565b603e6020526000908152604090205481565b73b04e030140b30c27bcdfaafffa98c57d80eda7b490565b6000603554603d83815481106109ce57fe5b906000526020600020906008020160050154603d84815481106109ed57fe5b90600052602060002090600802016004015401101590505b919050565b60335481565b6000610a1a6114cc565b8211158015610a295750600082115b610a455760405162461bcd60e51b815260040161088190612fa6565b6000603d8381548110610a5457fe5b906000526020600020906008020190508060020154610a71611b44565b11610a80576000915050610a05565b8060030154610a8d611b44565b11610a9c576001915050610a05565b80600501548160040154111580610abe57506035548160050154826004015401105b15610acd576002915050610a05565b600681015460ff1615610ae4576005915050610a05565b610b036034546108f06033548460030154611b1f90919063ffffffff16565b610b0b611b44565b10610b1a576006915050610a05565b6033546003820154610b2b91611b1f565b610b33611b44565b10610b42576004915050610a05565b6003915050610a05565b60408051808201909152600f81526e0d0b9c185d18da0b595e1c1b1bda5d608a1b602082015290565b603a5481565b6001600160a01b038381166000908152603c60205260408120549091163314610bb65760405162461bcd60e51b815260040161088190613036565b610bc1848484611b48565b949350505050565b336000818152603c60205260409020546001600160a01b039081169190831614801590610bff57506001600160a01b0382163014155b8015610c1357506001600160a01b03821615155b8015610c315750806001600160a01b0316826001600160a01b031614155b610c4d5760405162461bcd60e51b815260040161088190612e80565b6001600160a01b03811615610c93576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f91610d489185916004016129b0565b600060405180830381600087803b158015610d6257600080fd5b505af1925050508015610d73575060015b610df6573d808015610da1576040519150601f19603f3d011682016040523d82523d6000602084013e610da6565b606091505b5080604051610db59190612980565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a350610e2b565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e3482611b70565b5050565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610e7e5760405162461bcd60e51b815260040161088190612e49565b6033548110610e9f5760405162461bcd60e51b815260040161088190612d6d565b603a55565b333014610ec35760405162461bcd60e51b815260040161088190612e49565b603755565b7f000000000000000000000000000000000000000000000000000000000000000081565b336000908152603c60205260409020546001600160a01b031680610f225760405162461bcd60e51b815260040161088190612fec565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b610f7b6109a4565b6001600160a01b0316336001600160a01b031614610fab5760405162461bcd60e51b815260040161088190612f7f565b604051633a08bde160e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e822f78490610ff7908490600401612ab6565b600060405180830381600087803b15801561101157600080fd5b505af115801561098b573d6000803e3d6000fd5b3330146110445760405162461bcd60e51b815260040161088190612e49565b603455565b603b6020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916111099185916004016129b0565b600060405180830381600087803b15801561112357600080fd5b505af1925050508015611134575060015b6111b7573d808015611162576040519150601f19603f3d011682016040523d82523d6000602084013e611167565b606091505b50806040516111769190612980565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506111ec565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e3482611c54565b60008351116112165760405162461bcd60e51b815260040161088190612e1f565b61123e838383611226863361157e565b1580156112395750611237866109bc565b155b611c5e565b505050565b3330146112625760405162461bcd60e51b815260040161088190612e49565b603955565b600054610100900460ff16806112805750611280611ea1565b8061128e575060005460ff16155b6112aa5760405162461bcd60e51b815260040161088190612f31565b600054610100900460ff161580156112d5576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff199094169390931716919091179055611495611ea7565b8015610e34576000805461ff00191690555050565b60395481565b60375481565b60006114c3338484611b48565b90505b92915050565b603d546000190190565b60416020526000908152604090205481565b6114f06125d2565b603d83815481106114fd57fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b3330146115795760405162461bcd60e51b815260040161088190612e49565b603355565b6000603d838154811061158d57fe5b600091825260208083206001600160a01b03861684526007600890930201919091019052604090205460ff16905092915050565b3330146115e05760405162461bcd60e51b815260040161088190612e49565b603855565b3330146116045760405162461bcd60e51b815260040161088190612e49565b603655565b6116116109a4565b6001600160a01b0316336001600160a01b0316146116415760405162461bcd60e51b815260040161088190612f7f565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166108fc6116788347611ee8565b6040518115909202916000818181858888f1935050505061169857600080fd5b50565b6001600160a01b038087166000908152603b60205260409081902054905163e113335f60e01b815288927f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916116fc9185916004016129b0565b600060405180830381600087803b15801561171657600080fd5b505af1925050508015611727575060015b6117aa573d808015611755576040519150601f19603f3d011682016040523d82523d6000602084013e61175a565b606091505b50806040516117699190612980565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506117df565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b6117ed878787878787611efe565b50505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b3330141561183a5760405162461bcd60e51b815260040161088190612c36565b6000603d828154811061184957fe5b6000918252602080832060016008909302019182015485845260419091526040909220549092506001600160a01b0390911690813f90811461189d5760405162461bcd60e51b815260040161088190612d17565b6118a684611f7e565b50505050565b60016118b783610a10565b60068111156118c257fe5b146118df5760405162461bcd60e51b815260040161088190612bef565b6000603d83815481106118ee57fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b90945291909420549294501015908061194d5760405162461bcd60e51b815260040161088190612eb7565b825460ff161561199c578254610100900460ff1615611983576001830154600485015461197991611add565b600485015561199c565b6001830154600585015461199691611add565b60058501555b84156119bb5760048401546119b19082611b1f565b60048501556119d0565b60058401546119ca9082611b1f565b60058501555b6006840154610100900460ff16158015611a0057506039546119fe6119f3611b44565b600387015490611add565b105b15611a44576005840154600485015411158215158114611a425760068501805461ff001916610100179055603a546003860154611a3c91611b1f565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a546003870154611a8f938b93611a8a9391926108f092839190611b1f565b612110565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b584604051611acc9190612ab6565b60405180910390a450505050505050565b60006114c383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061214d565b6000828201838110156114c35760405162461bcd60e51b815260040161088190612ce0565b4290565b6000611b55848484612179565b6000818152604160205260409020933f909355509092915050565b336000908152603f6020526040902054611b88611b44565b11611ba55760405162461bcd60e51b815260040161088190612db1565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054611bf391839061214d565b336000818152603b6020526040908190209290925590516391fe357360e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316916391fe357391610ff7919085906004016129b0565b61169833826124c7565b3381328214611c6e576000611c72565b6152085b61ffff168115611ddd5760005a905060005b8851811015611d3b576000898281518110611c9b57fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611cdb57506001600160a01b03811633145b611cf75760405162461bcd60e51b815260040161088190613036565b861580611d0b5750611d09898261157e565b155b611d275760405162461bcd60e51b8152600401610881906130a4565b611d32818a8a6118ac565b50600101611c84565b506000611d536127106108f0856108f05a8790611add565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce80790611da490889085906004016129b0565b600060405180830381600087803b158015611dbe57600080fd5b505af1158015611dd2573d6000803e3d6000fd5b5050505050506117ed565b60005b8751811015611e97576000888281518110611df757fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611e3757506001600160a01b03811633145b611e535760405162461bcd60e51b815260040161088190613036565b851580611e675750611e65888261157e565b155b611e835760405162461bcd60e51b8152600401610881906130a4565b611e8e8189896118ac565b50600101611de0565b5050505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6000818310611ef757816114c3565b5090919050565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf90611f3a90899030908a908a908a908a908a90600401612a33565b600060405180830381600087803b158015611f5457600080fd5b505af1158015611f68573d6000803e3d6000fd5b50505050611f7686866124c7565b505050505050565b6004611f8982610a10565b6006811115611f9457fe5b14611fb15760405162461bcd60e51b815260040161088190612b29565b6000603d8281548110611fc057fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b0316611ffb816125cc565b6120175760405162461bcd60e51b815260040161088190612ae6565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b0385169161205b91612980565b600060405180830381855af49150503d8060008114612096576040519150601f19603f3d011682016040523d82523d6000602084013e61209b565b606091505b5091509150816120de578051156120c6578060405162461bcd60e51b81526004016108819190612ad3565b60405162461bcd60e51b81526004016108819061306d565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b6001600160a01b0382166000908152603f6020526040902054811115610e34576001600160a01b03919091166000908152603f6020526040902055565b600081848411156121715760405162461bcd60e51b81526004016108819190612ad3565b505050900390565b6001600160a01b0383166000908152603b60205260408120546036548110156121b45760405162461bcd60e51b815260040161088190612c83565b6121bd846125cc565b6121d95760405162461bcd60e51b815260040161088190612eee565b6001600160a01b0385166000908152603e6020526040902054801561224b57600061220382610a10565b9050600181600681111561221357fe5b1415801561222d5750600081600681111561222a57fe5b14155b6122495760405162461bcd60e51b815260040161088190612b74565b505b600061225b6037546108f0611b44565b9050600061227460385483611b1f90919063ffffffff16565b905061227e6125f2565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff199093169290921794909416179055906124306114cc565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a54929350612472928d92611a8a9290916108f0919082908a90611b1f565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d6040516124b29493929190612a74565b60405180910390a39998505050505050505050565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd9061251b9085907f00000000000000000000000000000000000000000000000000000000000000009086906004016129c9565b602060405180830381600087803b15801561253557600080fd5b505af1158015612549573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061256d91906128c5565b6125895760405162461bcd60e51b815260040161088190612de8565b6001600160a01b0382166000908152603b60205260409020546125ac9082611b1f565b6001600160a01b039092166000908152603b602052604090209190915550565b3b151590565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b03811681146114c657600080fd5b80356114c681613168565b600082601f83011261267f578081fd5b813567ffffffffffffffff811115612695578182fd5b6126a8601f8201601f1916602001613100565b91508082528360208285010111156126bf57600080fd5b8060208401602084013760009082016020015292915050565b6000602082840312156126e9578081fd5b6114c3838361264d565b600080600060608486031215612707578182fd5b833561271281613153565b9250602084013561272281613153565b9150604084013567ffffffffffffffff81111561273d578182fd5b6127498682870161266f565b9150509250925092565b60008060408385031215612765578182fd5b823561277081613153565b9150602083013567ffffffffffffffff81111561278b578182fd5b6127978582860161266f565b9150509250929050565b60008060008060008060c087890312156127b9578182fd5b6127c3888861264d565b95506020870135945060408701359350606087013560ff811681146127e6578283fd5b9598949750929560808101359460a0909101359350915050565b600080600060608486031215612814578283fd5b833567ffffffffffffffff8082111561282b578485fd5b818601915086601f83011261283e578485fd5b81358181111561284c578586fd5b6020915081810261285e838201613100565b8281528381019085850183870186018c101561287857898afd5b8996505b848710156128a25761288e8c8261264d565b83526001969096019591850191850161287c565b50975050505085013592506128bc90508560408601612664565b90509250925092565b6000602082840312156128d6578081fd5b81516114c381613168565b6000602082840312156128f2578081fd5b5035919050565b6000806040838503121561290b578182fd5b8235915061291c846020850161264d565b90509250929050565b60008060408385031215612937578182fd5b82359150602083013561294981613168565b809150509250929050565b6000815180845261296c816020860160208601613127565b601f01601f19169290920160200192915050565b60008251612992818460208701613127565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b038616825284602083015283604083015260806060830152612aa16080830184612954565b9695505050505050565b901515815260200190565b90815260200190565b6020810160078310612acd57fe5b91905290565b6000602082526114c36020830184612954565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252602d908201527f476f7665726e616e63653a3a70726f706f73653a2070736575646f2d6578746560408201526c393730b610333ab731ba34b7b760991b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526036908201527f476f7665726e616e63653a3a70726f706f73653a206d6574616d6f72706869636040820152750818dbdb9d1c9858dd1cc81b9bdd08185b1b1bddd95960521b606082015260800190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526010908201526f43616e206e6f7420626520656d70747960801b604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252600d908201526c6f6e6c79206d756c746973696760981b604082015260600190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b60208082526019908201527f476f7665726e616e63653a20766f74656420616c726561647900000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b60405181810167ffffffffffffffff8111828210171561311f57600080fd5b604052919050565b60005b8381101561314257818101518382015260200161312a565b838111156118a65750506000910152565b6001600160a01b038116811461169857600080fd5b801515811461169857600080fdfea2646970667358221220b75004153b6c8b4905c018daca78cb0fa6d3859298be55252bcf6ba75ea68d0e64736f6c634300060c0033a26469706673582212205ce84e9446fce11b2c9c1572684a150170d4bffa09fb4c56f9926d2efe573f6b64736f6c634300060c0033"; +const isSuperArgs$8 = (xs) => xs.length > 1; +class PatchProposal__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$8(args)) { + super(...args); + } else { + super(_abi$8, _bytecode$8, args[0]); + } + } + getDeployTransaction(_deployedStakingProxyContractAddress, _deployedRelayerRegistryImplementationAddress, overrides) { + return super.getDeployTransaction( + _deployedStakingProxyContractAddress, + _deployedRelayerRegistryImplementationAddress, + overrides || {} + ); + } + deploy(_deployedStakingProxyContractAddress, _deployedRelayerRegistryImplementationAddress, overrides) { + return super.deploy( + _deployedStakingProxyContractAddress, + _deployedRelayerRegistryImplementationAddress, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$8; + static abi = _abi$8; + static createInterface() { + return new interface_Interface(_abi$8); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$8, runner); + } +} + +var index$4 = /*#__PURE__*/Object.freeze({ + __proto__: null, + AdminUpgradeableProxy__factory: AdminUpgradeableProxy__factory$1, + GovernanceExploitPatchUpgrade__factory: GovernanceExploitPatchUpgrade__factory, + PatchProposal__factory: PatchProposal__factory, + metamorphic: index$7, + mock: index$5 +}); + +const _abi$7 = [ + { + inputs: [ + { + internalType: "address", + name: "stakingRewardsAddress", + type: "address" + }, + { + internalType: "address", + name: "gasCompLogic", + type: "address" + }, + { + internalType: "address", + name: "userVaultAddress", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + } + ], + name: "Delegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "proposer", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "target", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + indexed: false, + internalType: "string", + name: "description", + type: "string" + } + ], + name: "ProposalCreated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "ProposalExecuted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "bytes", + name: "errorData", + type: "bytes" + } + ], + name: "RewardUpdateFailed", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + } + ], + name: "RewardUpdateSuccessful", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + } + ], + name: "Undelegated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "voter", + type: "address" + }, + { + indexed: true, + internalType: "bool", + name: "support", + type: "bool" + }, + { + indexed: false, + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + name: "Voted", + type: "event" + }, + { + inputs: [], + name: "CLOSING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "EXECUTION_EXPIRATION", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PROPOSAL_THRESHOLD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "QUORUM_VOTES", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "Staking", + outputs: [ + { + internalType: "contract ITornadoStakingRewards", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTE_EXTEND_TIME", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_DELAY", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "VOTING_PERIOD", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "canWithdrawAfter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "from", + type: "address[]" + }, + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castDelegatedVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "bool", + name: "support", + type: "bool" + } + ], + name: "castVote", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "checkIfQuorumReached", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + } + ], + name: "delegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "delegatedTo", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "execute", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "gasCompensationVault", + outputs: [ + { + internalType: "contract IGasCompensationVault", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "voter", + type: "address" + } + ], + name: "getReceipt", + outputs: [ + { + components: [ + { + internalType: "bool", + name: "hasVoted", + type: "bool" + }, + { + internalType: "bool", + name: "support", + type: "bool" + }, + { + internalType: "uint256", + name: "votes", + type: "uint256" + } + ], + internalType: "struct Governance.Receipt", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "hasAccountVoted", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + } + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "latestProposalIds", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "lock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "lockWithApproval", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "lockedBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "proposalCodehashes", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "proposalCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "proposals", + outputs: [ + { + internalType: "address", + name: "proposer", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "forVotes", + type: "uint256" + }, + { + internalType: "uint256", + name: "againstVotes", + type: "uint256" + }, + { + internalType: "bool", + name: "executed", + type: "bool" + }, + { + internalType: "bool", + name: "extended", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "propose", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "string", + name: "description", + type: "string" + } + ], + name: "proposeByDelegate", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "returnMultisigAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "closingPeriod", + type: "uint256" + } + ], + name: "setClosingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionDelay", + type: "uint256" + } + ], + name: "setExecutionDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "executionExpiration", + type: "uint256" + } + ], + name: "setExecutionExpiration", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "gasCompensationsLimit", + type: "uint256" + } + ], + name: "setGasCompensations", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalThreshold", + type: "uint256" + } + ], + name: "setProposalThreshold", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "quorumVotes", + type: "uint256" + } + ], + name: "setQuorumVotes", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "voteExtendTime", + type: "uint256" + } + ], + name: "setVoteExtendTime", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingDelay", + type: "uint256" + } + ], + name: "setVotingDelay", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "votingPeriod", + type: "uint256" + } + ], + name: "setVotingPeriod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "proposalId", + type: "uint256" + } + ], + name: "state", + outputs: [ + { + internalType: "enum Governance.ProposalState", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "contract TORN", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "undelegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "unlock", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "userVault", + outputs: [ + { + internalType: "contract ITornadoVault", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "version", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdrawFromHelper", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$7 = "0x60e06040523480156200001157600080fd5b506040516200344138038062003441833981016040819052620000349162000171565b82828282828281818181600060019054906101000a900460ff16806200005f57506200005f6200012a565b806200006e575060005460ff16155b620000965760405162461bcd60e51b81526004016200008d90620001c4565b60405180910390fd5b600054610100900460ff16158015620000c2576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000e062000130565b8015620000f3576000805461ff00191690555b506001600160601b0319606091821b811660805291811b821660a0529590951b90941660c052506200022b98505050505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b60008060006060848603121562000186578283fd5b8351620001938162000212565b6020850151909350620001a68162000212565b6040850151909250620001b98162000212565b809150509250925092565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6001600160a01b03811681146200022857600080fd5b50565b60805160601c60a05160601c60c05160601c6131b36200028e60003980610d1a52806110db52806116ce52806117ff5250806109105280610ed15280610fc9528061164a5280611d745250806110645280611c1d52806124f852506131b36000f3fe6080604052600436106102815760003560e01c80639daafec71161014f578063d6f0948c116100c1578063ea0217cf1161007a578063ea0217cf14610755578063ece40cc114610775578063ef3f8bb114610795578063f0b76892146107b5578063f57df22e146107d5578063fe0d94c1146107ea57610288565b8063d6f0948c14610693578063da35c664146106b3578063e01f5237146106c8578063e23a9a52146106e8578063e4917d9f14610715578063e525aa081461073557610288565b8063b54426c811610113578063b54426c8146105e9578063b859f11b14610609578063c0c0e82014610629578063c4d66de814610649578063ce25d71c14610669578063d6159fe51461067e57610288565b80639daafec714610575578063a6c266031461058a578063a72edda31461059f578063adf898a4146105bf578063b1610d7e146105d457610288565b80635c19a95c116101f357806370b0f660116101ac57806370b0f660146104cb5780638b34a960146104eb57806392ab89bb14610500578063932d5157146105155780639a9e3b6e146105355780639ae697bf1461055557610288565b80635c19a95c146104215780636198e3391461044157806365da126414610461578063671dd275146104815780636a661755146104965780636dc2dc6c146104ab57610288565b806332687ec11161024557806332687ec11461035b57806337f135d7146103885780633e4f49e61461039d57806354fd4d50146103ca578063587a6ecb146103ec57806358e9fff01461040157610288565b8063013cf08b1461028d57806302ec8f9e146102ca57806315373e3d146102ec57806317977c611461030c57806324b0435f1461033957610288565b3661028857005b600080fd5b34801561029957600080fd5b506102ad6102a83660046128e8565b6107fd565b6040516102c19897969594939291906129f4565b60405180910390f35b3480156102d657600080fd5b506102ea6102e53660046128e8565b610862565b005b3480156102f857600080fd5b506102ea61030736600461292c565b61088f565b34801561031857600080fd5b5061032c6103273660046126df565b610992565b6040516102c19190612abd565b34801561034557600080fd5b5061034e6109a4565b6040516102c191906129a3565b34801561036757600080fd5b5061037b6103763660046128e8565b6109bc565b6040516102c19190612ab2565b34801561039457600080fd5b5061032c610a0a565b3480156103a957600080fd5b506103bd6103b83660046128e8565b610a10565b6040516102c19190612ac6565b3480156103d657600080fd5b506103df610b4c565b6040516102c19190612ada565b3480156103f857600080fd5b5061032c610b7c565b34801561040d57600080fd5b5061032c61041c3660046126fa565b610b82565b34801561042d57600080fd5b506102ea61043c3660046126df565b610bd0565b34801561044d57600080fd5b506102ea61045c3660046128e8565b610cf2565b34801561046d57600080fd5b5061034e61047c3660046126df565b610e3f565b34801561048d57600080fd5b5061032c610e5a565b3480156104a257600080fd5b5061032c610e60565b3480156104b757600080fd5b506102ea6104c63660046128e8565b610e66565b3480156104d757600080fd5b506102ea6104e63660046128e8565b610eab565b3480156104f757600080fd5b5061034e610ecf565b34801561050c57600080fd5b506102ea610ef3565b34801561052157600080fd5b506102ea6105303660046128e8565b610f7a565b34801561054157600080fd5b506102ea6105503660046128e8565b61102c565b34801561056157600080fd5b5061032c6105703660046126df565b611050565b34801561058157600080fd5b5061034e611062565b34801561059657600080fd5b5061032c611086565b3480156105ab57600080fd5b5061032c6105ba3660046126df565b61108c565b3480156105cb57600080fd5b5061034e61109e565b3480156105e057600080fd5b5061032c6110ad565b3480156105f557600080fd5b506102ea6106043660046128e8565b6110b3565b34801561061557600080fd5b506102ea610624366004612807565b6111fc565b34801561063557600080fd5b506102ea6106443660046128e8565b61124a565b34801561065557600080fd5b506102ea6106643660046126df565b61126e565b34801561067557600080fd5b5061032c6114b1565b34801561068a57600080fd5b5061032c6114b7565b34801561069f57600080fd5b5061032c6106ae36600461275a565b6114bd565b3480156106bf57600080fd5b5061032c6114d3565b3480156106d457600080fd5b5061032c6106e33660046128e8565b6114dd565b3480156106f457600080fd5b50610708610703366004612900565b6114ef565b6040516102c191906130e2565b34801561072157600080fd5b506102ea6107303660046128e8565b611561565b34801561074157600080fd5b5061037b610750366004612900565b611585565b34801561076157600080fd5b506102ea6107703660046128e8565b6115c8565b34801561078157600080fd5b506102ea6107903660046128e8565b6115ec565b3480156107a157600080fd5b506102ea6107b03660046128e8565b611610565b3480156107c157600080fd5b506102ea6107d03660046127a8565b6116a2565b3480156107e157600080fd5b5061034e6117fd565b6102ea6107f83660046128e8565b611821565b603d818154811061080a57fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b33301461088a5760405162461bcd60e51b815260040161088190612e50565b60405180910390fd5b603555565b3361089a8333611585565b1580156108ad57506108ab836109bc565b155b3332146108bb5760006108bf565b6152085b61ffff1681156109805760005a90506108d93387876118b3565b60006108f66127106108f0856108f05a8790611ae4565b90611b26565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce8079061094790889085906004016129b7565b600060405180830381600087803b15801561096157600080fd5b505af1158015610975573d6000803e3d6000fd5b50505050505061098b565b61098b3386866118b3565b5050505050565b603e6020526000908152604090205481565b73b04e030140b30c27bcdfaafffa98c57d80eda7b490565b6000603554603d83815481106109ce57fe5b906000526020600020906008020160050154603d84815481106109ed57fe5b90600052602060002090600802016004015401101590505b919050565b60335481565b6000610a1a6114d3565b8211158015610a295750600082115b610a455760405162461bcd60e51b815260040161088190612fad565b6000603d8381548110610a5457fe5b906000526020600020906008020190508060020154610a71611b4b565b11610a80576000915050610a05565b8060030154610a8d611b4b565b11610a9c576001915050610a05565b600681015460ff1615610ab3576005915050610a05565b80600501548160040154111580610ad557506035548160050154826004015401105b15610ae4576002915050610a05565b610b036034546108f06033548460030154611b2690919063ffffffff16565b610b0b611b4b565b10610b1a576006915050610a05565b6033546003820154610b2b91611b26565b610b33611b4b565b10610b42576004915050610a05565b6003915050610a05565b60408051808201909152601681527506a5ce0e4dee0dee6c2d85ae6e8c2e8ca5ae0c2e8c6d60531b602082015290565b603a5481565b6001600160a01b038381166000908152603c60205260408120549091163314610bbd5760405162461bcd60e51b81526004016108819061303d565b610bc8848484611b4f565b949350505050565b336000818152603c60205260409020546001600160a01b039081169190831614801590610c0657506001600160a01b0382163014155b8015610c1a57506001600160a01b03821615155b8015610c385750806001600160a01b0316826001600160a01b031614155b610c545760405162461bcd60e51b815260040161088190612e87565b6001600160a01b03811615610c9a576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f91610d4f9185916004016129b7565b600060405180830381600087803b158015610d6957600080fd5b505af1925050508015610d7a575060015b610dfd573d808015610da8576040519150601f19603f3d011682016040523d82523d6000602084013e610dad565b606091505b5080604051610dbc9190612987565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a350610e32565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e3b82611b77565b5050565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610e855760405162461bcd60e51b815260040161088190612e50565b6033548110610ea65760405162461bcd60e51b815260040161088190612d74565b603a55565b333014610eca5760405162461bcd60e51b815260040161088190612e50565b603755565b7f000000000000000000000000000000000000000000000000000000000000000081565b336000908152603c60205260409020546001600160a01b031680610f295760405162461bcd60e51b815260040161088190612ff3565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b610f826109a4565b6001600160a01b0316336001600160a01b031614610fb25760405162461bcd60e51b815260040161088190612f86565b604051633a08bde160e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e822f78490610ffe908490600401612abd565b600060405180830381600087803b15801561101857600080fd5b505af115801561098b573d6000803e3d6000fd5b33301461104b5760405162461bcd60e51b815260040161088190612e50565b603455565b603b6020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916111109185916004016129b7565b600060405180830381600087803b15801561112a57600080fd5b505af192505050801561113b575060015b6111be573d808015611169576040519150601f19603f3d011682016040523d82523d6000602084013e61116e565b606091505b508060405161117d9190612987565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506111f3565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e3b82611c5b565b600083511161121d5760405162461bcd60e51b815260040161088190612e26565b61124583838361122d8633611585565b158015611240575061123e866109bc565b155b611c65565b505050565b3330146112695760405162461bcd60e51b815260040161088190612e50565b603955565b600054610100900460ff16806112875750611287611ea8565b80611295575060005460ff16155b6112b15760405162461bcd60e51b815260040161088190612f38565b600054610100900460ff161580156112dc576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff19909416939093171691909117905561149c611eae565b8015610e3b576000805461ff00191690555050565b60395481565b60375481565b60006114ca338484611b4f565b90505b92915050565b603d546000190190565b60416020526000908152604090205481565b6114f76125d9565b603d838154811061150457fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b3330146115805760405162461bcd60e51b815260040161088190612e50565b603355565b6000603d838154811061159457fe5b600091825260208083206001600160a01b03861684526007600890930201919091019052604090205460ff16905092915050565b3330146115e75760405162461bcd60e51b815260040161088190612e50565b603855565b33301461160b5760405162461bcd60e51b815260040161088190612e50565b603655565b6116186109a4565b6001600160a01b0316336001600160a01b0316146116485760405162461bcd60e51b815260040161088190612f86565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166108fc61167f8347611eef565b6040518115909202916000818181858888f1935050505061169f57600080fd5b50565b6001600160a01b038087166000908152603b60205260409081902054905163e113335f60e01b815288927f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916117039185916004016129b7565b600060405180830381600087803b15801561171d57600080fd5b505af192505050801561172e575060015b6117b1573d80801561175c576040519150601f19603f3d011682016040523d82523d6000602084013e611761565b606091505b50806040516117709190612987565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506117e6565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b6117f4878787878787611f05565b50505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b333014156118415760405162461bcd60e51b815260040161088190612c3d565b6000603d828154811061185057fe5b6000918252602080832060016008909302019182015485845260419091526040909220549092506001600160a01b0390911690813f9081146118a45760405162461bcd60e51b815260040161088190612d1e565b6118ad84611f85565b50505050565b60016118be83610a10565b60068111156118c957fe5b146118e65760405162461bcd60e51b815260040161088190612bf6565b6000603d83815481106118f557fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b9094529190942054929450101590806119545760405162461bcd60e51b815260040161088190612ebe565b825460ff16156119a3578254610100900460ff161561198a576001830154600485015461198091611ae4565b60048501556119a3565b6001830154600585015461199d91611ae4565b60058501555b84156119c25760048401546119b89082611b26565b60048501556119d7565b60058401546119d19082611b26565b60058501555b6006840154610100900460ff16158015611a075750603954611a056119fa611b4b565b600387015490611ae4565b105b15611a4b576005840154600485015411158215158114611a495760068501805461ff001916610100179055603a546003860154611a4391611b26565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a546003870154611a96938b93611a919391926108f092839190611b26565b612117565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b584604051611ad39190612abd565b60405180910390a450505050505050565b60006114ca83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612154565b6000828201838110156114ca5760405162461bcd60e51b815260040161088190612ce7565b4290565b6000611b5c848484612180565b6000818152604160205260409020933f909355509092915050565b336000908152603f6020526040902054611b8f611b4b565b11611bac5760405162461bcd60e51b815260040161088190612db8565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054611bfa918390612154565b336000818152603b6020526040908190209290925590516391fe357360e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316916391fe357391610ffe919085906004016129b7565b61169f33826124ce565b3381328214611c75576000611c79565b6152085b61ffff168115611de45760005a905060005b8851811015611d42576000898281518110611ca257fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611ce257506001600160a01b03811633145b611cfe5760405162461bcd60e51b81526004016108819061303d565b861580611d125750611d108982611585565b155b611d2e5760405162461bcd60e51b8152600401610881906130ab565b611d39818a8a6118b3565b50600101611c8b565b506000611d5a6127106108f0856108f05a8790611ae4565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce80790611dab90889085906004016129b7565b600060405180830381600087803b158015611dc557600080fd5b505af1158015611dd9573d6000803e3d6000fd5b5050505050506117f4565b60005b8751811015611e9e576000888281518110611dfe57fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611e3e57506001600160a01b03811633145b611e5a5760405162461bcd60e51b81526004016108819061303d565b851580611e6e5750611e6c8882611585565b155b611e8a5760405162461bcd60e51b8152600401610881906130ab565b611e958189896118b3565b50600101611de7565b5050505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6000818310611efe57816114ca565b5090919050565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf90611f4190899030908a908a908a908a908a90600401612a3a565b600060405180830381600087803b158015611f5b57600080fd5b505af1158015611f6f573d6000803e3d6000fd5b50505050611f7d86866124ce565b505050505050565b6004611f9082610a10565b6006811115611f9b57fe5b14611fb85760405162461bcd60e51b815260040161088190612b30565b6000603d8281548110611fc757fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b0316612002816125d3565b61201e5760405162461bcd60e51b815260040161088190612aed565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b0385169161206291612987565b600060405180830381855af49150503d806000811461209d576040519150601f19603f3d011682016040523d82523d6000602084013e6120a2565b606091505b5091509150816120e5578051156120cd578060405162461bcd60e51b81526004016108819190612ada565b60405162461bcd60e51b815260040161088190613074565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b6001600160a01b0382166000908152603f6020526040902054811115610e3b576001600160a01b03919091166000908152603f6020526040902055565b600081848411156121785760405162461bcd60e51b81526004016108819190612ada565b505050900390565b6001600160a01b0383166000908152603b60205260408120546036548110156121bb5760405162461bcd60e51b815260040161088190612c8a565b6121c4846125d3565b6121e05760405162461bcd60e51b815260040161088190612ef5565b6001600160a01b0385166000908152603e6020526040902054801561225257600061220a82610a10565b9050600181600681111561221a57fe5b141580156122345750600081600681111561223157fe5b14155b6122505760405162461bcd60e51b815260040161088190612b7b565b505b60006122626037546108f0611b4b565b9050600061227b60385483611b2690919063ffffffff16565b90506122856125f9565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff199093169290921794909416179055906124376114d3565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a54929350612479928d92611a919290916108f0919082908a90611b26565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d6040516124b99493929190612a7b565b60405180910390a39998505050505050505050565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd906125229085907f00000000000000000000000000000000000000000000000000000000000000009086906004016129d0565b602060405180830381600087803b15801561253c57600080fd5b505af1158015612550573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061257491906128cc565b6125905760405162461bcd60e51b815260040161088190612def565b6001600160a01b0382166000908152603b60205260409020546125b39082611b26565b6001600160a01b039092166000908152603b602052604090209190915550565b3b151590565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b03811681146114cd57600080fd5b80356114cd8161316f565b600082601f830112612686578081fd5b813567ffffffffffffffff81111561269c578182fd5b6126af601f8201601f1916602001613107565b91508082528360208285010111156126c657600080fd5b8060208401602084013760009082016020015292915050565b6000602082840312156126f0578081fd5b6114ca8383612654565b60008060006060848603121561270e578182fd5b83356127198161315a565b925060208401356127298161315a565b9150604084013567ffffffffffffffff811115612744578182fd5b61275086828701612676565b9150509250925092565b6000806040838503121561276c578182fd5b82356127778161315a565b9150602083013567ffffffffffffffff811115612792578182fd5b61279e85828601612676565b9150509250929050565b60008060008060008060c087890312156127c0578182fd5b6127ca8888612654565b95506020870135945060408701359350606087013560ff811681146127ed578283fd5b9598949750929560808101359460a0909101359350915050565b60008060006060848603121561281b578283fd5b833567ffffffffffffffff80821115612832578485fd5b818601915086601f830112612845578485fd5b813581811115612853578586fd5b60209150818102612865838201613107565b8281528381019085850183870186018c101561287f57898afd5b8996505b848710156128a9576128958c82612654565b835260019690960195918501918501612883565b50975050505085013592506128c39050856040860161266b565b90509250925092565b6000602082840312156128dd578081fd5b81516114ca8161316f565b6000602082840312156128f9578081fd5b5035919050565b60008060408385031215612912578182fd5b823591506129238460208501612654565b90509250929050565b6000806040838503121561293e578182fd5b8235915060208301356129508161316f565b809150509250929050565b6000815180845261297381602086016020860161312e565b601f01601f19169290920160200192915050565b6000825161299981846020870161312e565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b038616825284602083015283604083015260806060830152612aa8608083018461295b565b9695505050505050565b901515815260200190565b90815260200190565b6020810160078310612ad457fe5b91905290565b6000602082526114ca602083018461295b565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252602d908201527f476f7665726e616e63653a3a70726f706f73653a2070736575646f2d6578746560408201526c393730b610333ab731ba34b7b760991b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526036908201527f476f7665726e616e63653a3a70726f706f73653a206d6574616d6f72706869636040820152750818dbdb9d1c9858dd1cc81b9bdd08185b1b1bddd95960521b606082015260800190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526010908201526f43616e206e6f7420626520656d70747960801b604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252600d908201526c6f6e6c79206d756c746973696760981b604082015260600190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b60208082526019908201527f476f7665726e616e63653a20766f74656420616c726561647900000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b60405181810167ffffffffffffffff8111828210171561312657600080fd5b604052919050565b60005b83811015613149578181015183820152602001613131565b838111156118ad5750506000910152565b6001600160a01b038116811461169f57600080fd5b801515811461169f57600080fdfea26469706673582212209ae80078297b488112cf4c0eaef3af85f34156332aa7d60065ce1ebb90ab93c264736f6c634300060c0033"; +const isSuperArgs$7 = (xs) => xs.length > 1; +class GovernanceProposalStateUpgrade__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$7(args)) { + super(...args); + } else { + super(_abi$7, _bytecode$7, args[0]); + } + } + getDeployTransaction(stakingRewardsAddress, gasCompLogic, userVaultAddress, overrides) { + return super.getDeployTransaction( + stakingRewardsAddress, + gasCompLogic, + userVaultAddress, + overrides || {} + ); + } + deploy(stakingRewardsAddress, gasCompLogic, userVaultAddress, overrides) { + return super.deploy( + stakingRewardsAddress, + gasCompLogic, + userVaultAddress, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$7; + static abi = _abi$7; + static createInterface() { + return new interface_Interface(_abi$7); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$7, + runner + ); + } +} + +var index$3 = /*#__PURE__*/Object.freeze({ + __proto__: null, + GovernanceProposalStateUpgrade__factory: GovernanceProposalStateUpgrade__factory +}); + +const _abi$6 = [ + { + inputs: [ + { + internalType: "address", + name: "_logic", + type: "address" + }, + { + internalType: "address", + name: "_admin", + type: "address" + }, + { + internalType: "bytes", + name: "_data", + type: "bytes" + } + ], + stateMutability: "payable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "previousAdmin", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "AdminChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "implementation", + type: "address" + } + ], + name: "Upgraded", + type: "event" + }, + { + stateMutability: "payable", + type: "fallback" + }, + { + inputs: [], + name: "admin", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "changeAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "implementation", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + } + ], + name: "upgradeTo", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "upgradeToAndCall", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$6 = "0x60806040526040516108403803806108408339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508390508282816100f1826101c5565b8051156101a9576000826001600160a01b0316826040518082805190602001908083835b602083106101345780518252601f199092019160209182019101610115565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610194576040519150601f19603f3d011682016040523d82523d6000602084013e610199565b606091505b50509050806101a757600080fd5b505b506101b19050565b6101ba82610237565b505050505050610261565b6101d88161025b60201b6103b41760201c565b6102135760405162461bcd60e51b815260040180806020018281038252603681526020018061080a6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3b151590565b61059a806102706000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996101a9565b6101a96101a46103ba565b6103df565b565b6101b3610403565b6001600160a01b0316336001600160a01b031614156101da576101d581610428565b6101e2565b6101e2610191565b50565b6101ed610403565b6001600160a01b0316336001600160a01b031614156102855761020f83610428565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610403565b6001600160a01b0316336001600160a01b031614156102c4576102bd6103ba565b90506102cc565b6102cc610191565b90565b6102d7610403565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b815260040180806020018281038252603a8152602001806104f5603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610403565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d581610468565b6000610393610403565b6001600160a01b0316336001600160a01b031614156102c4576102bd610403565b3b151590565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156103fe573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6104318161048c565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610495816103b4565b6104d05760405162461bcd60e51b815260040180806020018281038252603681526020018061052f6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374a2646970667358221220f9da162f8a2d779a4f5f08577ac886bc4694791f749bd6ecc5d270427405583364736f6c634300060c00335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374"; +const isSuperArgs$6 = (xs) => xs.length > 1; +class AdminUpgradeableProxy__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$6(args)) { + super(...args); + } else { + super(_abi$6, _bytecode$6, args[0]); + } + } + getDeployTransaction(_logic, _admin, _data, overrides) { + return super.getDeployTransaction(_logic, _admin, _data, overrides || {}); + } + deploy(_logic, _admin, _data, overrides) { + return super.deploy(_logic, _admin, _data, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$6; + static abi = _abi$6; + static createInterface() { + return new interface_Interface(_abi$6); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$6, + runner + ); + } +} + +const _abi$5 = [ + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + }, + { + internalType: "address", + name: "_governance", + type: "address" + }, + { + internalType: "address", + name: "_registry", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "instance", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "newFee", + type: "uint256" + } + ], + name: "FeeUpdated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint24", + name: "newFee", + type: "uint24" + } + ], + name: "UniswapTornPoolSwappingFeeChanged", + type: "event" + }, + { + inputs: [], + name: "PROTOCOL_FEE_DIVIDER", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "_instance", + type: "address" + } + ], + name: "calculatePoolFee", + outputs: [ + { + internalType: "uint160", + name: "", + type: "uint160" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "feeDeviations", + outputs: [ + { + components: [ + { + internalType: "address", + name: "instance", + type: "address" + }, + { + internalType: "int256", + name: "deviation", + type: "int256" + } + ], + internalType: "struct FeeManager.Deviation[]", + name: "results", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "governance", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "", + type: "address" + } + ], + name: "instanceFee", + outputs: [ + { + internalType: "uint160", + name: "", + type: "uint160" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "", + type: "address" + } + ], + name: "instanceFeeUpdated", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "_instance", + type: "address" + } + ], + name: "instanceFeeWithUpdate", + outputs: [ + { + internalType: "uint160", + name: "", + type: "uint160" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "registry", + outputs: [ + { + internalType: "contract InstanceRegistry", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint32", + name: "newPeriod", + type: "uint32" + } + ], + name: "setPeriodForTWAPOracle", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint24", + name: "_uniswapTornPoolSwappingFee", + type: "uint24" + } + ], + name: "setUniswapTornPoolSwappingFee", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint24", + name: "newLimit", + type: "uint24" + } + ], + name: "setUpdateFeeTimeLimit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "torn", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "uniswapTimePeriod", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "uniswapTornPoolSwappingFee", + outputs: [ + { + internalType: "uint24", + name: "", + type: "uint24" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "updateAllFees", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "_instance", + type: "address" + } + ], + name: "updateFee", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "updateFeeTimeLimit", + outputs: [ + { + internalType: "uint24", + name: "", + type: "uint24" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance[]", + name: "_instances", + type: "address[]" + } + ], + name: "updateFees", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$5 = "0x60e06040523480156200001157600080fd5b5060405162001a8938038062001a8983398101604081905262000034916200005c565b6001600160601b0319606093841b811660805291831b821660a05290911b1660c052620000c8565b60008060006060848603121562000071578283fd5b83516200007e81620000af565b60208501519093506200009181620000af565b6040850151909250620000a481620000af565b809150509250925092565b6001600160a01b0381168114620000c557600080fd5b50565b60805160601c60a05160601c60c05160601c61196862000121600039806102ce52806104f6528061077752806109945250806104b7528061052e528061060f528061070852508061068f528061087e52506119686000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c8063a0287520116100a2578063bcc5ee6411610071578063bcc5ee641461020f578063c51c229714610217578063d8718fb11461022a578063e1f121561461023f578063f522d6d61461025257610116565b8063a0287520146101d9578063adf898a4146101ec578063aeb3077a146101f4578063b19a2972146101fc57610116565b8063603a54fe116100e9578063603a54fe146101815780637b103999146101945780637ccd2f481461019c57806380679eb3146101b157806380eb7bf0146101c657610116565b806305e343641461011b5780632efbf384146101445780634bf0a542146101645780635aa6e67514610179575b600080fd5b61012e610129366004611650565b61025a565b60405161013b9190611896565b60405180910390f35b610157610152366004611650565b61026c565b60405161013b91906116dd565b61016c6102c9565b60405161013b9190611719565b6101576104b5565b61015761018f366004611650565b6104d9565b6101576104f4565b6101a4610518565b60405161013b9190611886565b6101c46101bf3660046116a0565b610523565b005b6101c46101d4366004611650565b61057e565b6101c46101e736600461166c565b610604565b61015761068d565b61012e6106b1565b6101c461020a3660046113ef565b6106b7565b6101a46106eb565b6101c461022536600461166c565b6106fd565b61023261075a565b60405161013b919061189f565b61015761024d366004611650565b61076d565b6101c461098f565b60026020526000908152604090205481565b600080546001600160a01b038316825260026020526040822054600160381b90910462ffffff16429190910311156102a7576102a78261057e565b506001600160a01b03808216600090815260016020526040902054165b919050565b6060807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166310c13ac36040518163ffffffff1660e01b815260040160006040518083038186803b15801561032557600080fd5b505afa158015610339573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103619190810190611487565b9050805167ffffffffffffffff8111801561037b57600080fd5b506040519080825280602002602001820160405280156103b557816020015b6103a261131d565b81526020019060019003908161039a5790505b50915060005b81518110156104b05760006103e28383815181106103d557fe5b602002602001015161076d565b6001600160a01b031690506000811561045e576103e8826001600087878151811061040957fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060009054906101000a90046001600160a01b03166103e8026001600160a01b03168161045957fe5b040390505b604051806040016040528085858151811061047557fe5b60200260200101516001600160a01b031681526020018281525085848151811061049b57fe5b602090810291909101015250506001016103bb565b505090565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001602052600090815260409020546001600160a01b031681565b7f000000000000000000000000000000000000000000000000000000000000000081565b60005462ffffff1681565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461055857600080fd5b6000805463ffffffff90921663010000000266ffffffff00000019909216919091179055565b60006105898261076d565b6001600160a01b03838116600081815260016020908152604080832080546001600160a01b03191695871695909517909455600290528290204290559051919250907f6f0eaf2c2f89fb4cfe96a1dee5e764d60b52c7f48aaa590f0850e308aa1b953a906105f89084906116dd565b60405180910390a25050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461063957600080fd5b6000805462ffffff191662ffffff83811691909117918290556040517fbfe65cfc2359076c4468c9b895156c309c78f94fb09f6d2fc0463c4ca9a71ac292610682921690611886565b60405180910390a150565b7f000000000000000000000000000000000000000000000000000000000000000081565b61271081565b60005b81518110156106e7576106df8282815181106106d257fe5b602002602001015161057e565b6001016106ba565b5050565b600054600160381b900462ffffff1681565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461073257600080fd5b6000805462ffffff909216600160381b0269ffffff0000000000000019909216919091179055565b6000546301000000900463ffffffff1681565b60008060008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663032bb443876040518263ffffffff1660e01b81526004016107c191906116dd565b60a06040518083038186803b1580156107d957600080fd5b505afa1580156107ed573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081191906115d5565b9450945050935093508063ffffffff16600014156108365760009450505050506102c4565b6001600160a01b03831615801561084b575083155b610855578261086b565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25b6040805180820182526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081168252831660208083019190915282518084019093526000805462ffffff80821686528816928501929092529396506108e5929063ffffffff630100000090910416610a29565b905061098461271061097e8463ffffffff166109788561097e670de0b6b3a76400008e6001600160a01b0316638bca6d166040518163ffffffff1660e01b815260040160206040518083038186803b15801561094057600080fd5b505afa158015610954573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109789190611688565b90610a75565b90610ac1565b979650505050505050565b610a277f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166310c13ac36040518163ffffffff1660e01b815260040160006040518083038186803b1580156109eb57600080fd5b505afa1580156109ff573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261020a9190810190611487565b565b60208084015190830151600091610a409184610b03565b84518451610a6391670de0b6b3a764000091610a5d919087610b03565b90610b2d565b81610a6a57fe5b0490505b9392505050565b600082610a8457506000610abb565b82820282848281610a9157fe5b0414610ab85760405162461bcd60e51b8152600401610aaf90611845565b60405180910390fd5b90505b92915050565b6000610ab883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610b51565b6000610b258473c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28585610b88565b949350505050565b6000821580610b4857505081810281838281610b4557fe5b04145b610abb57600080fd5b60008183610b725760405162461bcd60e51b8152600401610aaf91906117bb565b506000838581610b7e57fe5b0495945050505050565b600080846001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610bc457600080fd5b505afa158015610bd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfc91906116bc565b60ff16600a0a90506001600160a01b038681169086161415610c28576001600160801b03169050610b25565b604051630b4c774160e11b8152610cc990610cc190731f98431c8ad98523631ae4a59f267346ea31f98490631698ee8290610c6b908b908b908b906004016116f1565b60206040518083038186803b158015610c8357600080fd5b505afa158015610c97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cbb91906113d3565b85610cda565b828888610e6f565b915050610b25565b50949350505050565b600063ffffffff8216610cff5760405162461bcd60e51b8152600401610aaf9061180e565b60408051600280825260608083018452926020830190803683370190505090508281600081518110610d2d57fe5b602002602001019063ffffffff16908163ffffffff1681525050600081600181518110610d5657fe5b63ffffffff9092166020928302919091019091015260405163883bdbfd60e01b81526060906001600160a01b0386169063883bdbfd90610d9a908590600401611771565b60006040518083038186803b158015610db257600080fd5b505afa158015610dc6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610dee9190810190611513565b509050600081600081518110610e0057fe5b602002602001015182600181518110610e1557fe5b60200260200101510390508463ffffffff168160060b81610e3257fe5b05935060008160060b128015610e5957508463ffffffff168160060b81610e5557fe5b0715155b15610e6657600019909301925b50505092915050565b600080610e7b86610f59565b90506001600160801b036001600160a01b03821611610eea576001600160a01b0380821680029084811690861610610eca57610ec5600160c01b876001600160801b031683611272565b610ee2565b610ee281876001600160801b0316600160c01b611272565b925050610cd1565b6000610f096001600160a01b0383168068010000000000000000611272565b9050836001600160a01b0316856001600160a01b031610610f4157610f3c600160801b876001600160801b031683611272565b610984565b61098481876001600160801b0316600160801b611272565b60008060008360020b12610f70578260020b610f78565b8260020b6000035b9050620d89e8811115610f9d5760405162461bcd60e51b8152600401610aaf9061182a565b600060018216610fb157600160801b610fc3565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615610ff7576ffff97272373d413259a46990580e213a0260801c5b6004821615611016576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615611035576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615611054576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615611073576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615611092576fff2ea16466c96a3843ec78b326b528610260801c5b60808216156110b1576ffe5dee046a99a2a811c461f1969c30530260801c5b6101008216156110d1576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b6102008216156110f1576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615611111576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615611131576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615611151576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615611171576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615611191576f70d869a156d2a1b890bb3df62baf32f70260801c5b6180008216156111b1576f31be135f97d08fd981231505542fcfa60260801c5b620100008216156111d2576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b620200008216156111f2576e5d6af8dedb81196699c329225ee6040260801c5b62040000821615611211576d2216e584f5fa1ea926041bedfe980260801c5b6208000082161561122e576b048a170391f7dc42444e8fa20260801c5b60008460020b131561124957806000198161124557fe5b0490505b64010000000081061561125d576001611260565b60005b60ff16602082901c0192505050919050565b60008080600019858709868602925082811090839003039050806112a8576000841161129d57600080fd5b508290049050610a6e565b8084116112b457600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b604080518082019091526000808252602082015290565b600082601f830112611344578081fd5b8151611357611352826118d7565b6118b0565b81815291506020808301908481018184028601820187101561137857600080fd5b60005b848110156113a057815161138e816118f7565b8452928201929082019060010161137b565b505050505092915050565b8035610abb816118f7565b8051610abb816118f7565b8051600681900b8114610abb57600080fd5b6000602082840312156113e4578081fd5b8151610ab8816118f7565b60006020808385031215611401578182fd5b823567ffffffffffffffff811115611417578283fd5b8301601f81018513611427578283fd5b8035611435611352826118d7565b8181528381019083850185840285018601891015611451578687fd5b8694505b8385101561147b5761146789826113ab565b835260019490940193918501918501611455565b50979650505050505050565b60006020808385031215611499578182fd5b825167ffffffffffffffff8111156114af578283fd5b8301601f810185136114bf578283fd5b80516114cd611352826118d7565b81815283810190838501858402850186018910156114e9578687fd5b8694505b8385101561147b576114ff89826113b6565b8352600194909401939185019185016114ed565b60008060408385031215611525578081fd5b825167ffffffffffffffff8082111561153c578283fd5b818501915085601f83011261154f578283fd5b815161155d611352826118d7565b80828252602080830192508086018a82838702890101111561157d578788fd5b8796505b848710156115a7576115938b826113c1565b845260019690960195928101928101611581565b5088015190965093505050808211156115be578283fd5b506115cb85828601611334565b9150509250929050565b600080600080600060a086880312156115ec578081fd5b855180151581146115fb578182fd5b602087015190955061160c816118f7565b604087015190945060028110611620578182fd5b60608701519093506116318161190f565b608087015190925061164281611920565b809150509295509295909350565b600060208284031215611661578081fd5b8135610ab8816118f7565b60006020828403121561167d578081fd5b8135610ab88161190f565b600060208284031215611699578081fd5b5051919050565b6000602082840312156116b1578081fd5b8135610ab881611920565b6000602082840312156116cd578081fd5b815160ff81168114610ab8578182fd5b6001600160a01b0391909116815260200190565b6001600160a01b03938416815291909216602082015262ffffff909116604082015260600190565b602080825282518282018190526000919060409081850190868401855b8281101561176457815180516001600160a01b03168552860151868501529284019290850190600101611736565b5091979650505050505050565b6020808252825182820181905260009190848201906040850190845b818110156117af57835163ffffffff168352928401929184019160010161178d565b50909695505050505050565b6000602080835283518082850152825b818110156117e7578581018301518582016040015282016117cb565b818111156117f85783604083870101525b50601f01601f1916929092016040019392505050565b602080825260029082015261042560f41b604082015260600190565b6020808252600190820152601560fa1b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b62ffffff91909116815260200190565b90815260200190565b63ffffffff91909116815260200190565b60405181810167ffffffffffffffff811182821017156118cf57600080fd5b604052919050565b600067ffffffffffffffff8211156118ed578081fd5b5060209081020190565b6001600160a01b038116811461190c57600080fd5b50565b62ffffff8116811461190c57600080fd5b63ffffffff8116811461190c57600080fdfea26469706673582212205690be246e00d9bf30da35441a160026439ececfa962348f01e498d25f89f5d164736f6c634300060c0033"; +const isSuperArgs$5 = (xs) => xs.length > 1; +class FeeManager__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$5(args)) { + super(...args); + } else { + super(_abi$5, _bytecode$5, args[0]); + } + } + getDeployTransaction(_torn, _governance, _registry, overrides) { + return super.getDeployTransaction( + _torn, + _governance, + _registry, + overrides || {} + ); + } + deploy(_torn, _governance, _registry, overrides) { + return super.deploy( + _torn, + _governance, + _registry, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$5; + static abi = _abi$5; + static createInterface() { + return new interface_Interface(_abi$5); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$5, runner); + } +} + +const _abi$4 = [ + { + inputs: [ + { + internalType: "address", + name: "_governance", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "GovernanceAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "gasAmount", + type: "uint256" + } + ], + name: "compensateGas", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdrawToGovernance", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$4 = "0x60a060405234801561001057600080fd5b5060405161047838038061047883398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516103da61009e6000396000818160560152818160e101528181610212015261027701526103da6000f3fe6080604052600436106100385760003560e01c8063a3221c2e14610044578063a99ce80714610094578063e822f784146100b657600080fd5b3661003f57005b600080fd5b34801561005057600080fd5b506100787f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200160405180910390f35b3480156100a057600080fd5b506100b46100af366004610328565b6100d6565b005b3480156100c257600080fd5b506100b46100d1366004610360565b610207565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461013e5760405162461bcd60e51b815260206004820152600860248201526737b7363c9033b7bb60c11b60448201526064015b60405180910390fd5b47600061014b4884610379565b90508160000361015b5750505050565b6000846001600160a01b03168383116101745782610176565b835b604051600081818185875af1925050503d80600081146101b2576040519150601f19603f3d011682016040523d82523d6000602084013e6101b7565b606091505b50509050806102005760405162461bcd60e51b815260206004820152601560248201527418dbdb5c195b9cd85d194819d85cc819985a5b1959605a1b6044820152606401610135565b5050505050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461026a5760405162461bcd60e51b815260206004820152600860248201526737b7363c9033b7bb60c11b6044820152606401610135565b4760006001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168284116102a457836102a6565b825b604051600081818185875af1925050503d80600081146102e2576040519150601f19603f3d011682016040523d82523d6000602084013e6102e7565b606091505b50509050806103235760405162461bcd60e51b81526020600482015260086024820152671c185e4819985a5b60c21b6044820152606401610135565b505050565b6000806040838503121561033b57600080fd5b82356001600160a01b038116811461035257600080fd5b946020939093013593505050565b60006020828403121561037257600080fd5b5035919050565b808202811582820484141761039e57634e487b7160e01b600052601160045260246000fd5b9291505056fea2646970667358221220fbe5a836dfa015bd3b2b1ffb61149001940255ee2f1f9b05c13681937e89ff9264736f6c634300081c0033"; +const isSuperArgs$4 = (xs) => xs.length > 1; +class GasCompensationVault__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$4(args)) { + super(...args); + } else { + super(_abi$4, _bytecode$4, args[0]); + } + } + getDeployTransaction(_governance, overrides) { + return super.getDeployTransaction(_governance, overrides || {}); + } + deploy(_governance, overrides) { + return super.deploy(_governance, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$4; + static abi = _abi$4; + static createInterface() { + return new interface_Interface(_abi$4); + } + static connect(address, runner) { + return new contract_Contract( + address, + _abi$4, + runner + ); + } +} + +const _abi$3 = [ + { + inputs: [ + { + internalType: "address", + name: "_logic", + type: "address" + }, + { + internalType: "bytes", + name: "_data", + type: "bytes" + } + ], + stateMutability: "payable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "previousAdmin", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "AdminChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "implementation", + type: "address" + } + ], + name: "Upgraded", + type: "event" + }, + { + stateMutability: "payable", + type: "fallback" + }, + { + inputs: [], + name: "admin", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "changeAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "implementation", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + } + ], + name: "upgradeTo", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newImplementation", + type: "address" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "upgradeToAndCall", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } +]; +const _bytecode$3 = "0x608060405260405161083b38038061083b8339818101604052604081101561002657600080fd5b81516020830180516040519294929383019291908464010000000082111561004d57600080fd5b90830190602082018581111561006257600080fd5b825164010000000081118282018810171561007c57600080fd5b82525081516020918201929091019080838360005b838110156100a9578181015183820152602001610091565b50505050905090810190601f1680156100d65780820380516001836020036101000a031916815260200191505b50604052508391503090508282816100ed826101c0565b8051156101a5576000826001600160a01b0316826040518082805190602001908083835b602083106101305780518252601f199092019160209182019101610111565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610190576040519150601f19603f3d011682016040523d82523d6000602084013e610195565b606091505b50509050806101a357600080fd5b505b506101ad9050565b6101b682610232565b505050505061025c565b6101d38161025660201b6103b41760201c565b61020e5760405162461bcd60e51b81526004018080602001828103825260368152602001806108056036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3b151590565b61059a8061026b6000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996101a9565b6101a96101a46103ba565b6103df565b565b6101b3610403565b6001600160a01b0316336001600160a01b031614156101da576101d581610428565b6101e2565b6101e2610191565b50565b6101ed610403565b6001600160a01b0316336001600160a01b031614156102855761020f83610428565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610403565b6001600160a01b0316336001600160a01b031614156102c4576102bd6103ba565b90506102cc565b6102cc610191565b90565b6102d7610403565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b815260040180806020018281038252603a8152602001806104f5603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610403565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d581610468565b6000610393610403565b6001600160a01b0316336001600160a01b031614156102c4576102bd610403565b3b151590565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156103fe573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6104318161048c565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610495816103b4565b6104d05760405162461bcd60e51b815260040180806020018281038252603681526020018061052f6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374a264697066735822122014d721b179bdff3154685a6f1f0fecdd0d99b7cfc61b3f1a2f7a95c6f6d2c2ae64736f6c634300060c00335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374"; +const isSuperArgs$3 = (xs) => xs.length > 1; +class LoopbackProxy__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$3(args)) { + super(...args); + } else { + super(_abi$3, _bytecode$3, args[0]); + } + } + getDeployTransaction(_logic, _data, overrides) { + return super.getDeployTransaction(_logic, _data, overrides || {}); + } + deploy(_logic, _data, overrides) { + return super.deploy(_logic, _data, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$3; + static abi = _abi$3; + static createInterface() { + return new interface_Interface(_abi$3); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$3, runner); + } +} + +const _abi$2 = [ + { + inputs: [ + { + internalType: "bytes", + name: "_initCode", + type: "bytes" + }, + { + internalType: "bytes32", + name: "_salt", + type: "bytes32" + } + ], + name: "deploy", + outputs: [ + { + internalType: "address payable", + name: "createdContract", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode$2 = "0x608060405234801561001057600080fd5b50610134806100206000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80634af63f0214602d575b600080fd5b60cf60048036036040811015604157600080fd5b810190602081018135640100000000811115605b57600080fd5b820183602082011115606c57600080fd5b80359060200191846001830284011164010000000083111715608d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550509135925060eb915050565b604080516001600160a01b039092168252519081900360200190f35b6000818351602085016000f5939250505056fea26469706673582212208761ae5cfc40689ce98cd25a56b929c259b167501a941e4f0164890ebab1c0bb64736f6c634300060c0033"; +const isSuperArgs$2 = (xs) => xs.length > 1; +class SingletonFactory__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$2(args)) { + super(...args); + } else { + super(_abi$2, _bytecode$2, args[0]); + } + } + getDeployTransaction(overrides) { + return super.getDeployTransaction(overrides || {}); + } + deploy(overrides) { + return super.deploy(overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$2; + static abi = _abi$2; + static createInterface() { + return new interface_Interface(_abi$2); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$2, runner); + } +} + +const _abi$1 = [ + { + inputs: [ + { + internalType: "address", + name: "_governance", + type: "address" + }, + { + internalType: "address", + name: "_instanceRegistry", + type: "address" + }, + { + internalType: "address", + name: "_relayerRegistry", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + }, + { + indexed: false, + internalType: "bytes", + name: "encryptedNote", + type: "bytes" + } + ], + name: "EncryptedNote", + type: "event" + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "_token", + type: "address" + }, + { + internalType: "address", + name: "_spender", + type: "address" + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256" + } + ], + name: "approveExactToken", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes[]", + name: "_encryptedNotes", + type: "bytes[]" + } + ], + name: "backupNotes", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "_tornado", + type: "address" + }, + { + internalType: "bytes32", + name: "_commitment", + type: "bytes32" + }, + { + internalType: "bytes", + name: "_encryptedNote", + type: "bytes" + } + ], + name: "deposit", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "governance", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "instanceRegistry", + outputs: [ + { + internalType: "contract InstanceRegistry", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "relayerRegistry", + outputs: [ + { + internalType: "contract RelayerRegistry", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "_token", + type: "address" + }, + { + internalType: "address payable", + name: "_to", + type: "address" + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256" + } + ], + name: "rescueTokens", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ITornadoInstance", + name: "_tornado", + type: "address" + }, + { + internalType: "bytes", + name: "_proof", + type: "bytes" + }, + { + internalType: "bytes32", + name: "_root", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "_nullifierHash", + type: "bytes32" + }, + { + internalType: "address payable", + name: "_recipient", + type: "address" + }, + { + internalType: "address payable", + name: "_relayer", + type: "address" + }, + { + internalType: "uint256", + name: "_fee", + type: "uint256" + }, + { + internalType: "uint256", + name: "_refund", + type: "uint256" + } + ], + name: "withdraw", + outputs: [], + stateMutability: "payable", + type: "function" + } +]; +const _bytecode$1 = "0x60e060405234801561001057600080fd5b5060405161128438038061128483398101604081905261002f91610056565b6001600160601b0319606093841b811660805291831b821660a05290911b1660c0526100ba565b60008060006060848603121561006a578283fd5b8351610075816100a2565b6020850151909350610086816100a2565b6040850151909250610097816100a2565b809150509250925092565b6001600160a01b03811681146100b757600080fd5b50565b60805160601c60a05160601c60c05160601c61117c610108600039806103ff528061059e525080610164528061037a52806103a752806104c8525080610423528061068e525061117c6000f3fe60806040526004361061007b5760003560e01c80635aa6e6751161004e5780635aa6e675146100f55780636485ba2a1461010a578063b438689f1461012a578063cea9d26f1461013d5761007b565b806313d98d131461008057806336a3874b146100955780633ef10783146100c057806347ff589d146100e0575b600080fd5b61009361008e366004610c77565b61015d565b005b3480156100a157600080fd5b506100aa610378565b6040516100b79190610dd0565b60405180910390f35b3480156100cc57600080fd5b506100936100db366004610c37565b61039c565b3480156100ec57600080fd5b506100aa6103fd565b34801561010157600080fd5b506100aa610421565b34801561011657600080fd5b50610093610125366004610b26565b610445565b610093610138366004610cd1565b6104ae565b34801561014957600080fd5b50610093610158366004610c37565b610683565b60008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663032bb443886040518263ffffffff1660e01b81526004016101ae9190610dd0565b60a06040518083038186803b1580156101c657600080fd5b505afa1580156101da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fe9190610bb1565b5092955090935091506000905081600181111561021757fe5b141561023e5760405162461bcd60e51b815260040161023590610f00565b60405180910390fd5b82156102cc576102cc3330896001600160a01b0316638bca6d166040518163ffffffff1660e01b815260040160206040518083038186803b15801561028257600080fd5b505afa158015610296573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ba9190610d72565b6001600160a01b038616929190610817565b60405163b214faa560e01b81526001600160a01b0388169063b214faa59034906102fa908a90600401610e5e565b6000604051808303818588803b15801561031357600080fd5b505af1158015610327573d6000803e3d6000fd5b5050505050336001600160a01b03167ffa28df43db3553771f7209dcef046f3bdfea15870ab625dcda30ac58b82b40088686604051610367929190610e67565b60405180910390a250505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146103e45760405162461bcd60e51b815260040161023590611087565b6103f86001600160a01b0384168383610875565b505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60005b818110156103f857337ffa28df43db3553771f7209dcef046f3bdfea15870ab625dcda30ac58b82b400884848481811061047e57fe5b905060200281019061049091906110af565b60405161049e929190610e67565b60405180910390a2600101610448565b60405163032bb44360e01b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063032bb443906104fd908d90600401610dd0565b60a06040518083038186803b15801561051557600080fd5b505afa158015610529573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054d9190610bb1565b509093506000925061055d915050565b81600181111561056957fe5b14156105875760405162461bcd60e51b815260040161023590610f00565b604051631168473b60e21b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906345a11cec906105d790339088908f90600401610de4565b600060405180830381600087803b1580156105f157600080fd5b505af1158015610605573d6000803e3d6000fd5b50506040516310d056db60e11b81526001600160a01b038d1692506321a0adb691503490610645908d908d908d908d908d908d908d908d90600401610e7b565b6000604051808303818588803b15801561065e57600080fd5b505af1158015610672573d6000803e3d6000fd5b505050505050505050505050505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146106cb5760405162461bcd60e51b815260040161023590611087565b6001600160a01b0382166106f15760405162461bcd60e51b815260040161023590610f6e565b6001600160a01b03831661074d5747600061070c8284610938565b6040519091506001600160a01b0385169082156108fc029083906000818181858888f19350505050158015610745573d6000803e3d6000fd5b5050506103f8565b6040516370a0823160e01b81526000906001600160a01b038516906370a082319061077c903090600401610dd0565b60206040518083038186803b15801561079457600080fd5b505afa1580156107a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107cc9190610d72565b905060006107da8284610938565b9050600081116107fc5760405162461bcd60e51b815260040161023590610ffa565b6108106001600160a01b0386168583610950565b5050505050565b61086f846323b872dd60e01b85858560405160240161083893929190610e21565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261096f565b50505050565b8015806108fd5750604051636eb1769f60e11b81526001600160a01b0384169063dd62ed3e906108ab9030908690600401610e07565b60206040518083038186803b1580156108c357600080fd5b505afa1580156108d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108fb9190610d72565b155b6109195760405162461bcd60e51b815260040161023590611031565b6103f88363095ea7b360e01b8484604051602401610838929190610e45565b60008183106109475781610949565b825b9392505050565b6103f88363a9059cbb60e01b8484604051602401610838929190610e45565b60606109c4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166109fe9092919063ffffffff16565b8051909150156103f857808060200190518101906109e29190610b95565b6103f85760405162461bcd60e51b815260040161023590610fb0565b6060610a0d8484600085610a15565b949350505050565b6060610a2085610ad9565b610a3c5760405162461bcd60e51b815260040161023590610f37565b60006060866001600160a01b03168587604051610a599190610db4565b60006040518083038185875af1925050503d8060008114610a96576040519150601f19603f3d011682016040523d82523d6000602084013e610a9b565b606091505b50915091508115610aaf579150610a0d9050565b805115610abf5780518082602001fd5b8360405162461bcd60e51b81526004016102359190610ecd565b3b151590565b60008083601f840112610af0578182fd5b50813567ffffffffffffffff811115610b07578182fd5b602083019150836020828501011115610b1f57600080fd5b9250929050565b60008060208385031215610b38578182fd5b823567ffffffffffffffff80821115610b4f578384fd5b818501915085601f830112610b62578384fd5b813581811115610b70578485fd5b8660208083028501011115610b83578485fd5b60209290920196919550909350505050565b600060208284031215610ba6578081fd5b815161094981611138565b600080600080600060a08688031215610bc8578081fd5b8551610bd381611138565b6020870151909550610be481611120565b604087015190945060028110610bf8578182fd5b606087015190935062ffffff81168114610c10578182fd5b608087015190925063ffffffff81168114610c29578182fd5b809150509295509295909350565b600080600060608486031215610c4b578283fd5b8335610c5681611120565b92506020840135610c6681611120565b929592945050506040919091013590565b60008060008060608587031215610c8c578384fd5b8435610c9781611120565b935060208501359250604085013567ffffffffffffffff811115610cb9578283fd5b610cc587828801610adf565b95989497509550505050565b60008060008060008060008060006101008a8c031215610cef578384fd5b8935610cfa81611120565b985060208a013567ffffffffffffffff811115610d15578485fd5b610d218c828d01610adf565b90995097505060408a0135955060608a0135945060808a0135610d4381611120565b935060a08a0135610d5381611120565b8093505060c08a0135915060e08a013590509295985092959850929598565b600060208284031215610d83578081fd5b5051919050565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b60008251610dc68184602087016110f4565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0393841681529183166020830152909116604082015260600190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b90815260200190565b600060208252610a0d602083018486610d8a565b600060e08252610e8f60e083018a8c610d8a565b60208301989098525060408101959095526001600160a01b03938416606086015291909216608084015260a083019190915260c09091015292915050565b6000602082528251806020840152610eec8160408501602087016110f4565b601f01601f19169190910160400192915050565b6020808252601d908201527f54686520696e7374616e6365206973206e6f7420737570706f72746564000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526022908201527f544f524e3a2063616e206e6f742073656e6420746f207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252601e908201527f544f524e3a20747279696e6720746f2073656e6420302062616c616e63650000604082015260600190565b60208082526036908201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60408201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606082015260800190565b6020808252600e908201526d139bdd08185d5d1a1bdc9a5e995960921b604082015260600190565b6000808335601e198436030181126110c5578283fd5b83018035915067ffffffffffffffff8211156110df578283fd5b602001915036819003821315610b1f57600080fd5b60005b8381101561110f5781810151838201526020016110f7565b8381111561086f5750506000910152565b6001600160a01b038116811461113557600080fd5b50565b801515811461113557600080fdfea264697066735822122004c0e245ab0b87d2916977a9650f299de2e526143487c917a63e4b88e54387e364736f6c634300060c0033"; +const isSuperArgs$1 = (xs) => xs.length > 1; +class TornadoRouter__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs$1(args)) { + super(...args); + } else { + super(_abi$1, _bytecode$1, args[0]); + } + } + getDeployTransaction(_governance, _instanceRegistry, _relayerRegistry, overrides) { + return super.getDeployTransaction( + _governance, + _instanceRegistry, + _relayerRegistry, + overrides || {} + ); + } + deploy(_governance, _instanceRegistry, _relayerRegistry, overrides) { + return super.deploy( + _governance, + _instanceRegistry, + _relayerRegistry, + overrides || {} + ); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode$1; + static abi = _abi$1; + static createInterface() { + return new interface_Interface(_abi$1); + } + static connect(address, runner) { + return new contract_Contract(address, _abi$1, runner); + } +} + +const _abi = [ + { + inputs: [ + { + internalType: "address", + name: "_torn", + type: "address" + }, + { + internalType: "address", + name: "_governance", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdrawTorn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +const _bytecode = "0x60c060405234801561001057600080fd5b506040516104aa3803806104aa8339818101604052604081101561003357600080fd5b5080516020909101516001600160601b0319606092831b8116608052911b1660a05260805160601c60a05160601c61042e61007c60003980606952508060d3525061042e6000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806391fe357314610030575b600080fd5b61005c6004803603604081101561004657600080fd5b506001600160a01b03813516906020013561005e565b005b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146100c6576040805162461bcd60e51b815260206004820152600860248201526737b7363c9033b7bb60c11b604482015290519081900360640190fd5b6100fa6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001683836100fe565b5050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610150908490610155565b505050565b60606101aa826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166102069092919063ffffffff16565b805190915015610150578080602001905160208110156101c957600080fd5b50516101505760405162461bcd60e51b815260040180806020018281038252602a8152602001806103cf602a913960400191505060405180910390fd5b6060610215848460008561021d565b949350505050565b6060610228856103c8565b610279576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106102b85780518252601f199092019160209182019101610299565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461031a576040519150601f19603f3d011682016040523d82523d6000602084013e61031f565b606091505b509150915081156103335791506102159050565b8051156103435780518082602001fd5b8360405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561038d578181015183820152602001610375565b50505050905090810190601f1680156103ba5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b3b15159056fe5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a26469706673582212208fc65ae8299d617f6cff836a2822363849c7fb35b0b27a6f0aebfa62084005c764736f6c634300060c0033"; +const isSuperArgs = (xs) => xs.length > 1; +class TornadoVault__factory extends ContractFactory { + constructor(...args) { + if (isSuperArgs(args)) { + super(...args); + } else { + super(_abi, _bytecode, args[0]); + } + } + getDeployTransaction(_torn, _governance, overrides) { + return super.getDeployTransaction(_torn, _governance, overrides || {}); + } + deploy(_torn, _governance, overrides) { + return super.deploy(_torn, _governance, overrides || {}); + } + connect(runner) { + return super.connect(runner); + } + static bytecode = _bytecode; + static abi = _abi; + static createInterface() { + return new interface_Interface(_abi); + } + static connect(address, runner) { + return new contract_Contract(address, _abi, runner); + } +} + +var index$2 = /*#__PURE__*/Object.freeze({ + __proto__: null, + AdminUpgradeableProxy__factory: AdminUpgradeableProxy__factory, + FeeManager__factory: FeeManager__factory, + GasCompensationVault__factory: GasCompensationVault__factory, + LoopbackProxy__factory: LoopbackProxy__factory, + SingletonFactory__factory: SingletonFactory__factory, + TornadoRouter__factory: TornadoRouter__factory, + TornadoVault__factory: TornadoVault__factory, + aggregator: index$z, + deployerSol: index$y, + instanceRegistrySol: index$x, + interfaces: index$k, + libraries: index$i, + relayerRegistrySol: index$w, + testnet: index$r, + torn: index$t, + tornadoStakingRewardsSol: index$q, + uniswap: index$l, + v1: index$d, + v2VaultAndGas: index$a, + v3RelayerRegistry: index$8, + v4ExploitPatch: index$4, + v5ProposalStatePatch: index$3 +}); + +var index$1 = /*#__PURE__*/Object.freeze({ + __proto__: null, + classic: index$B, + governance: index$2 +}); + +var index = /*#__PURE__*/Object.freeze({ + __proto__: null, + contracts: index$1, + openzeppelin: index$I +}); + + + +;// ./src/typechain/factories/ENS__factory.ts + + +const ENS_factory_abi = [ + { + constant: true, + inputs: [ + { + internalType: "bytes4", + name: "interfaceID", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + payable: false, + stateMutability: "pure", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "string", + name: "key", + type: "string" + }, + { + internalType: "string", + name: "value", + type: "string" + } + ], + name: "setText", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes4", + name: "interfaceID", + type: "bytes4" + } + ], + name: "interfaceImplementer", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint256", + name: "contentTypes", + type: "uint256" + } + ], + name: "ABI", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + }, + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "x", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "y", + type: "bytes32" + } + ], + name: "setPubkey", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes", + name: "hash", + type: "bytes" + } + ], + name: "setContenthash", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "addr", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "bool", + name: "isAuthorised", + type: "bool" + } + ], + name: "setAuthorisation", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "string", + name: "key", + type: "string" + } + ], + name: "text", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint256", + name: "contentType", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "setABI", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "string", + name: "name", + type: "string" + } + ], + name: "setName", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint256", + name: "coinType", + type: "uint256" + }, + { + internalType: "bytes", + name: "a", + type: "bytes" + } + ], + name: "setAddr", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "contenthash", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "pubkey", + outputs: [ + { + internalType: "bytes32", + name: "x", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "y", + type: "bytes32" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "a", + type: "address" + } + ], + name: "setAddr", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes4", + name: "interfaceID", + type: "bytes4" + }, + { + internalType: "address", + name: "implementer", + type: "address" + } + ], + name: "setInterface", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint256", + name: "coinType", + type: "uint256" + } + ], + name: "addr", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + }, + { + internalType: "address", + name: "", + type: "address" + }, + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "authorisations", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract ENS", + name: "_ens", + type: "address" + } + ], + payable: false, + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "target", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "isAuthorised", + type: "bool" + } + ], + name: "AuthorisationChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "string", + name: "indexedKey", + type: "string" + }, + { + indexed: false, + internalType: "string", + name: "key", + type: "string" + } + ], + name: "TextChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes32", + name: "x", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes32", + name: "y", + type: "bytes32" + } + ], + name: "PubkeyChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "string", + name: "name", + type: "string" + } + ], + name: "NameChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "bytes4", + name: "interfaceID", + type: "bytes4" + }, + { + indexed: false, + internalType: "address", + name: "implementer", + type: "address" + } + ], + name: "InterfaceChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes", + name: "hash", + type: "bytes" + } + ], + name: "ContenthashChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "a", + type: "address" + } + ], + name: "AddrChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint256", + name: "coinType", + type: "uint256" + }, + { + indexed: false, + internalType: "bytes", + name: "newAddress", + type: "bytes" + } + ], + name: "AddressChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "uint256", + name: "contentType", + type: "uint256" + } + ], + name: "ABIChanged", + type: "event" + } +]; +class ENS_factory_ENS_factory { + static abi = (/* unused pure expression or super */ null && (ENS_factory_abi)); + static createInterface() { + return new Interface(ENS_factory_abi); + } + static connect(address, runner) { + return new Contract(address, ENS_factory_abi, runner); + } +} + +;// ./src/typechain/factories/ENSNameWrapper__factory.ts + + +const ENSNameWrapper_factory_abi = [ + { + inputs: [ + { + internalType: "contract ENS", + name: "_ens", + type: "address" + }, + { + internalType: "contract IBaseRegistrar", + name: "_registrar", + type: "address" + }, + { + internalType: "contract IMetadataService", + name: "_metadataService", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "CannotUpgrade", + type: "error" + }, + { + inputs: [], + name: "IncompatibleParent", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "IncorrectTargetOwner", + type: "error" + }, + { + inputs: [], + name: "IncorrectTokenType", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "labelHash", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "expectedLabelhash", + type: "bytes32" + } + ], + name: "LabelMismatch", + type: "error" + }, + { + inputs: [ + { + internalType: "string", + name: "label", + type: "string" + } + ], + name: "LabelTooLong", + type: "error" + }, + { + inputs: [], + name: "LabelTooShort", + type: "error" + }, + { + inputs: [], + name: "NameIsNotWrapped", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "OperationProhibited", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "addr", + type: "address" + } + ], + name: "Unauthorised", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "approved", + type: "address" + }, + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "ApprovalForAll", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "controller", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "active", + type: "bool" + } + ], + name: "ControllerChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "ExpiryExtended", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint32", + name: "fuses", + type: "uint32" + } + ], + name: "FusesSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "NameUnwrapped", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes", + name: "name", + type: "bytes" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: false, + internalType: "uint32", + name: "fuses", + type: "uint32" + }, + { + indexed: false, + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "NameWrapped", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256[]", + name: "ids", + type: "uint256[]" + }, + { + indexed: false, + internalType: "uint256[]", + name: "values", + type: "uint256[]" + } + ], + name: "TransferBatch", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "TransferSingle", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "string", + name: "value", + type: "string" + }, + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256" + } + ], + name: "URI", + type: "event" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "_tokens", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint32", + name: "fuseMask", + type: "uint32" + } + ], + name: "allFusesBurned", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "approve", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "id", + type: "uint256" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "accounts", + type: "address[]" + }, + { + internalType: "uint256[]", + name: "ids", + type: "uint256[]" + } + ], + name: "balanceOfBatch", + outputs: [ + { + internalType: "uint256[]", + name: "", + type: "uint256[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "addr", + type: "address" + } + ], + name: "canExtendSubnames", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "addr", + type: "address" + } + ], + name: "canModifyName", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "controllers", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ens", + outputs: [ + { + internalType: "contract ENS", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32" + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "extendExpiry", + outputs: [ + { + internalType: "uint64", + name: "", + type: "uint64" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "id", + type: "uint256" + } + ], + name: "getApproved", + outputs: [ + { + internalType: "address", + name: "operator", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "id", + type: "uint256" + } + ], + name: "getData", + outputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint32", + name: "fuses", + type: "uint32" + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "address", + name: "operator", + type: "address" + } + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32" + } + ], + name: "isWrapped", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "isWrapped", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "metadataService", + outputs: [ + { + internalType: "contract IMetadataService", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "names", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "address", + name: "", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "onERC721Received", + outputs: [ + { + internalType: "bytes4", + name: "", + type: "bytes4" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "id", + type: "uint256" + } + ], + name: "ownerOf", + outputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_token", + type: "address" + }, + { + internalType: "address", + name: "_to", + type: "address" + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256" + } + ], + name: "recoverFunds", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "string", + name: "label", + type: "string" + }, + { + internalType: "address", + name: "wrappedOwner", + type: "address" + }, + { + internalType: "uint256", + name: "duration", + type: "uint256" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint16", + name: "ownerControlledFuses", + type: "uint16" + } + ], + name: "registerAndWrapETH2LD", + outputs: [ + { + internalType: "uint256", + name: "registrarExpiry", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "registrar", + outputs: [ + { + internalType: "contract IBaseRegistrar", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "duration", + type: "uint256" + } + ], + name: "renew", + outputs: [ + { + internalType: "uint256", + name: "expires", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256[]", + name: "ids", + type: "uint256[]" + }, + { + internalType: "uint256[]", + name: "amounts", + type: "uint256[]" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "safeBatchTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "id", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "setApprovalForAll", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32" + }, + { + internalType: "uint32", + name: "fuses", + type: "uint32" + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "setChildFuses", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "controller", + type: "address" + }, + { + internalType: "bool", + name: "active", + type: "bool" + } + ], + name: "setController", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint16", + name: "ownerControlledFuses", + type: "uint16" + } + ], + name: "setFuses", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IMetadataService", + name: "_metadataService", + type: "address" + } + ], + name: "setMetadataService", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setRecord", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "setResolver", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "string", + name: "label", + type: "string" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint32", + name: "fuses", + type: "uint32" + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "setSubnodeOwner", + outputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "string", + name: "label", + type: "string" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + }, + { + internalType: "uint32", + name: "fuses", + type: "uint32" + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + name: "setSubnodeRecord", + outputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setTTL", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract INameWrapperUpgrade", + name: "_upgradeAddress", + type: "address" + } + ], + name: "setUpgradeContract", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32" + }, + { + internalType: "address", + name: "controller", + type: "address" + } + ], + name: "unwrap", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32" + }, + { + internalType: "address", + name: "registrant", + type: "address" + }, + { + internalType: "address", + name: "controller", + type: "address" + } + ], + name: "unwrapETH2LD", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "name", + type: "bytes" + }, + { + internalType: "bytes", + name: "extraData", + type: "bytes" + } + ], + name: "upgrade", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "upgradeContract", + outputs: [ + { + internalType: "contract INameWrapperUpgrade", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "uri", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "name", + type: "bytes" + }, + { + internalType: "address", + name: "wrappedOwner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "wrap", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "string", + name: "label", + type: "string" + }, + { + internalType: "address", + name: "wrappedOwner", + type: "address" + }, + { + internalType: "uint16", + name: "ownerControlledFuses", + type: "uint16" + }, + { + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "wrapETH2LD", + outputs: [ + { + internalType: "uint64", + name: "expiry", + type: "uint64" + } + ], + stateMutability: "nonpayable", + type: "function" + } +]; +class ENSNameWrapper__factory { + static abi = ENSNameWrapper_factory_abi; + static createInterface() { + return new interface_Interface(ENSNameWrapper_factory_abi); + } + static connect(address, runner) { + return new contract_Contract(address, ENSNameWrapper_factory_abi, runner); + } +} + +;// ./src/typechain/factories/ENSRegistry__factory.ts + + +const ENSRegistry_factory_abi = [ + { + inputs: [ + { + internalType: "contract ENS", + name: "_old", + type: "address" + } + ], + payable: false, + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "ApprovalForAll", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "bytes32", + name: "label", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "NewOwner", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "NewResolver", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "NewTTL", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "Transfer", + type: "event" + }, + { + constant: true, + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "operator", + type: "address" + } + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [], + name: "old", + outputs: [ + { + internalType: "contract ENS", + name: "", + type: "address" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "recordExists", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "resolver", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "setApprovalForAll", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "setOwner", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setRecord", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "resolver", + type: "address" + } + ], + name: "setResolver", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "label", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "setSubnodeOwner", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "label", + type: "bytes32" + }, + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "resolver", + type: "address" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setSubnodeRecord", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64" + } + ], + name: "setTTL", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "ttl", + outputs: [ + { + internalType: "uint64", + name: "", + type: "uint64" + } + ], + payable: false, + stateMutability: "view", + type: "function" + } +]; +class ENSRegistry__factory { + static abi = ENSRegistry_factory_abi; + static createInterface() { + return new interface_Interface(ENSRegistry_factory_abi); + } + static connect(address, runner) { + return new contract_Contract(address, ENSRegistry_factory_abi, runner); + } +} + +;// ./src/typechain/factories/ENSResolver__factory.ts + + +const ENSResolver_factory_abi = [ + { + inputs: [ + { + internalType: "contract ENS", + name: "_ens", + type: "address" + }, + { + internalType: "contract INameWrapper", + name: "wrapperAddress", + type: "address" + }, + { + internalType: "address", + name: "_trustedETHController", + type: "address" + }, + { + internalType: "address", + name: "_trustedReverseRegistrar", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "uint256", + name: "contentType", + type: "uint256" + } + ], + name: "ABIChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "address", + name: "a", + type: "address" + } + ], + name: "AddrChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint256", + name: "coinType", + type: "uint256" + }, + { + indexed: false, + internalType: "bytes", + name: "newAddress", + type: "bytes" + } + ], + name: "AddressChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "ApprovalForAll", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "delegate", + type: "address" + }, + { + indexed: true, + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "Approved", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes", + name: "hash", + type: "bytes" + } + ], + name: "ContenthashChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes", + name: "name", + type: "bytes" + }, + { + indexed: false, + internalType: "uint16", + name: "resource", + type: "uint16" + }, + { + indexed: false, + internalType: "bytes", + name: "record", + type: "bytes" + } + ], + name: "DNSRecordChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes", + name: "name", + type: "bytes" + }, + { + indexed: false, + internalType: "uint16", + name: "resource", + type: "uint16" + } + ], + name: "DNSRecordDeleted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes", + name: "lastzonehash", + type: "bytes" + }, + { + indexed: false, + internalType: "bytes", + name: "zonehash", + type: "bytes" + } + ], + name: "DNSZonehashChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "bytes4", + name: "interfaceID", + type: "bytes4" + }, + { + indexed: false, + internalType: "address", + name: "implementer", + type: "address" + } + ], + name: "InterfaceChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "string", + name: "name", + type: "string" + } + ], + name: "NameChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes32", + name: "x", + type: "bytes32" + }, + { + indexed: false, + internalType: "bytes32", + name: "y", + type: "bytes32" + } + ], + name: "PubkeyChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: true, + internalType: "string", + name: "indexedKey", + type: "string" + }, + { + indexed: false, + internalType: "string", + name: "key", + type: "string" + }, + { + indexed: false, + internalType: "string", + name: "value", + type: "string" + } + ], + name: "TextChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint64", + name: "newVersion", + type: "uint64" + } + ], + name: "VersionChanged", + type: "event" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint256", + name: "contentTypes", + type: "uint256" + } + ], + name: "ABI", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + }, + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "addr", + outputs: [ + { + internalType: "address payable", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint256", + name: "coinType", + type: "uint256" + } + ], + name: "addr", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "delegate", + type: "address" + }, + { + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "approve", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "clearRecords", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "contenthash", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "name", + type: "bytes32" + }, + { + internalType: "uint16", + name: "resource", + type: "uint16" + } + ], + name: "dnsRecord", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "name", + type: "bytes32" + } + ], + name: "hasDNSRecords", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes4", + name: "interfaceID", + type: "bytes4" + } + ], + name: "interfaceImplementer", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "delegate", + type: "address" + } + ], + name: "isApprovedFor", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "address", + name: "operator", + type: "address" + } + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes[]", + name: "data", + type: "bytes[]" + } + ], + name: "multicall", + outputs: [ + { + internalType: "bytes[]", + name: "results", + type: "bytes[]" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "nodehash", + type: "bytes32" + }, + { + internalType: "bytes[]", + name: "data", + type: "bytes[]" + } + ], + name: "multicallWithNodeCheck", + outputs: [ + { + internalType: "bytes[]", + name: "results", + type: "bytes[]" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "pubkey", + outputs: [ + { + internalType: "bytes32", + name: "x", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "y", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "recordVersions", + outputs: [ + { + internalType: "uint64", + name: "", + type: "uint64" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint256", + name: "contentType", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "setABI", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "uint256", + name: "coinType", + type: "uint256" + }, + { + internalType: "bytes", + name: "a", + type: "bytes" + } + ], + name: "setAddr", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "address", + name: "a", + type: "address" + } + ], + name: "setAddr", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "setApprovalForAll", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes", + name: "hash", + type: "bytes" + } + ], + name: "setContenthash", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "setDNSRecords", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes4", + name: "interfaceID", + type: "bytes4" + }, + { + internalType: "address", + name: "implementer", + type: "address" + } + ], + name: "setInterface", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "string", + name: "newName", + type: "string" + } + ], + name: "setName", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "x", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "y", + type: "bytes32" + } + ], + name: "setPubkey", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "string", + name: "key", + type: "string" + }, + { + internalType: "string", + name: "value", + type: "string" + } + ], + name: "setText", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "bytes", + name: "hash", + type: "bytes" + } + ], + name: "setZonehash", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceID", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + }, + { + internalType: "string", + name: "key", + type: "string" + } + ], + name: "text", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32" + } + ], + name: "zonehash", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + } +]; +class ENSResolver__factory { + static abi = ENSResolver_factory_abi; + static createInterface() { + return new interface_Interface(ENSResolver_factory_abi); + } + static connect(address, runner) { + return new contract_Contract(address, ENSResolver_factory_abi, runner); + } +} + +;// ./src/typechain/factories/ERC20__factory.ts + + +const ERC20_factory_abi = [ + { + constant: true, + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [], + name: "_totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [ + { + internalType: "address", + name: "who", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: true, + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transfer", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + constant: true, + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + payable: false, + stateMutability: "view", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + constant: false, + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "approve", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "nonces", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "permit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class ERC20_factory_ERC20_factory { + static abi = (/* unused pure expression or super */ null && (ERC20_factory_abi)); + static createInterface() { + return new Interface(ERC20_factory_abi); + } + static connect(address, runner) { + return new Contract(address, ERC20_factory_abi, runner); + } +} + +;// ./src/typechain/factories/Multicall__factory.ts + + +const Multicall_factory_abi = [ + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "bytes", + name: "callData", + type: "bytes" + } + ], + internalType: "struct Multicall3.Call[]", + name: "calls", + type: "tuple[]" + } + ], + name: "aggregate", + outputs: [ + { + internalType: "uint256", + name: "blockNumber", + type: "uint256" + }, + { + internalType: "bytes[]", + name: "returnData", + type: "bytes[]" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "bool", + name: "allowFailure", + type: "bool" + }, + { + internalType: "bytes", + name: "callData", + type: "bytes" + } + ], + internalType: "struct Multicall3.Call3[]", + name: "calls", + type: "tuple[]" + } + ], + name: "aggregate3", + outputs: [ + { + components: [ + { + internalType: "bool", + name: "success", + type: "bool" + }, + { + internalType: "bytes", + name: "returnData", + type: "bytes" + } + ], + internalType: "struct Multicall3.Result[]", + name: "returnData", + type: "tuple[]" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "bool", + name: "allowFailure", + type: "bool" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + }, + { + internalType: "bytes", + name: "callData", + type: "bytes" + } + ], + internalType: "struct Multicall3.Call3Value[]", + name: "calls", + type: "tuple[]" + } + ], + name: "aggregate3Value", + outputs: [ + { + components: [ + { + internalType: "bool", + name: "success", + type: "bool" + }, + { + internalType: "bytes", + name: "returnData", + type: "bytes" + } + ], + internalType: "struct Multicall3.Result[]", + name: "returnData", + type: "tuple[]" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "bytes", + name: "callData", + type: "bytes" + } + ], + internalType: "struct Multicall3.Call[]", + name: "calls", + type: "tuple[]" + } + ], + name: "blockAndAggregate", + outputs: [ + { + internalType: "uint256", + name: "blockNumber", + type: "uint256" + }, + { + internalType: "bytes32", + name: "blockHash", + type: "bytes32" + }, + { + components: [ + { + internalType: "bool", + name: "success", + type: "bool" + }, + { + internalType: "bytes", + name: "returnData", + type: "bytes" + } + ], + internalType: "struct Multicall3.Result[]", + name: "returnData", + type: "tuple[]" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "getBasefee", + outputs: [ + { + internalType: "uint256", + name: "basefee", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "blockNumber", + type: "uint256" + } + ], + name: "getBlockHash", + outputs: [ + { + internalType: "bytes32", + name: "blockHash", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getBlockNumber", + outputs: [ + { + internalType: "uint256", + name: "blockNumber", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getChainId", + outputs: [ + { + internalType: "uint256", + name: "chainid", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getCurrentBlockCoinbase", + outputs: [ + { + internalType: "address", + name: "coinbase", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getCurrentBlockDifficulty", + outputs: [ + { + internalType: "uint256", + name: "difficulty", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getCurrentBlockGasLimit", + outputs: [ + { + internalType: "uint256", + name: "gaslimit", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getCurrentBlockTimestamp", + outputs: [ + { + internalType: "uint256", + name: "timestamp", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "addr", + type: "address" + } + ], + name: "getEthBalance", + outputs: [ + { + internalType: "uint256", + name: "balance", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getLastBlockHash", + outputs: [ + { + internalType: "bytes32", + name: "blockHash", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bool", + name: "requireSuccess", + type: "bool" + }, + { + components: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "bytes", + name: "callData", + type: "bytes" + } + ], + internalType: "struct Multicall3.Call[]", + name: "calls", + type: "tuple[]" + } + ], + name: "tryAggregate", + outputs: [ + { + components: [ + { + internalType: "bool", + name: "success", + type: "bool" + }, + { + internalType: "bytes", + name: "returnData", + type: "bytes" + } + ], + internalType: "struct Multicall3.Result[]", + name: "returnData", + type: "tuple[]" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "bool", + name: "requireSuccess", + type: "bool" + }, + { + components: [ + { + internalType: "address", + name: "target", + type: "address" + }, + { + internalType: "bytes", + name: "callData", + type: "bytes" + } + ], + internalType: "struct Multicall3.Call[]", + name: "calls", + type: "tuple[]" + } + ], + name: "tryBlockAndAggregate", + outputs: [ + { + internalType: "uint256", + name: "blockNumber", + type: "uint256" + }, + { + internalType: "bytes32", + name: "blockHash", + type: "bytes32" + }, + { + components: [ + { + internalType: "bool", + name: "success", + type: "bool" + }, + { + internalType: "bytes", + name: "returnData", + type: "bytes" + } + ], + internalType: "struct Multicall3.Result[]", + name: "returnData", + type: "tuple[]" + } + ], + stateMutability: "payable", + type: "function" + } +]; +class Multicall__factory { + static abi = Multicall_factory_abi; + static createInterface() { + return new interface_Interface(Multicall_factory_abi); + } + static connect(address, runner) { + return new contract_Contract(address, Multicall_factory_abi, runner); + } +} + +;// ./src/typechain/factories/OffchainOracle__factory.ts + + +const OffchainOracle_factory_abi = [ + { + inputs: [ + { + internalType: "contract MultiWrapper", + name: "_multiWrapper", + type: "address" + }, + { + internalType: "contract IOracle[]", + name: "existingOracles", + type: "address[]" + }, + { + internalType: "enum OffchainOracle.OracleType[]", + name: "oracleTypes", + type: "uint8[]" + }, + { + internalType: "contract IERC20[]", + name: "existingConnectors", + type: "address[]" + }, + { + internalType: "contract IERC20", + name: "wBase", + type: "address" + }, + { + internalType: "address", + name: "owner", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "ArraysLengthMismatch", + type: "error" + }, + { + inputs: [], + name: "ConnectorAlreadyAdded", + type: "error" + }, + { + inputs: [], + name: "InvalidOracleTokenKind", + type: "error" + }, + { + inputs: [], + name: "OracleAlreadyAdded", + type: "error" + }, + { + inputs: [], + name: "SameTokens", + type: "error" + }, + { + inputs: [], + name: "TooBigThreshold", + type: "error" + }, + { + inputs: [], + name: "UnknownConnector", + type: "error" + }, + { + inputs: [], + name: "UnknownOracle", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "contract IERC20", + name: "connector", + type: "address" + } + ], + name: "ConnectorAdded", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "contract IERC20", + name: "connector", + type: "address" + } + ], + name: "ConnectorRemoved", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "contract MultiWrapper", + name: "multiWrapper", + type: "address" + } + ], + name: "MultiWrapperUpdated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "contract IOracle", + name: "oracle", + type: "address" + }, + { + indexed: false, + internalType: "enum OffchainOracle.OracleType", + name: "oracleType", + type: "uint8" + } + ], + name: "OracleAdded", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "contract IOracle", + name: "oracle", + type: "address" + }, + { + indexed: false, + internalType: "enum OffchainOracle.OracleType", + name: "oracleType", + type: "uint8" + } + ], + name: "OracleRemoved", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "connector", + type: "address" + } + ], + name: "addConnector", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IOracle", + name: "oracle", + type: "address" + }, + { + internalType: "enum OffchainOracle.OracleType", + name: "oracleKind", + type: "uint8" + } + ], + name: "addOracle", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "connectors", + outputs: [ + { + internalType: "contract IERC20[]", + name: "allConnectors", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "srcToken", + type: "address" + }, + { + internalType: "contract IERC20", + name: "dstToken", + type: "address" + }, + { + internalType: "bool", + name: "useWrappers", + type: "bool" + } + ], + name: "getRate", + outputs: [ + { + internalType: "uint256", + name: "weightedRate", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "srcToken", + type: "address" + }, + { + internalType: "bool", + name: "useSrcWrappers", + type: "bool" + } + ], + name: "getRateToEth", + outputs: [ + { + internalType: "uint256", + name: "weightedRate", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "srcToken", + type: "address" + }, + { + internalType: "bool", + name: "useSrcWrappers", + type: "bool" + }, + { + internalType: "contract IERC20[]", + name: "customConnectors", + type: "address[]" + }, + { + internalType: "uint256", + name: "thresholdFilter", + type: "uint256" + } + ], + name: "getRateToEthWithCustomConnectors", + outputs: [ + { + internalType: "uint256", + name: "weightedRate", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "srcToken", + type: "address" + }, + { + internalType: "bool", + name: "useSrcWrappers", + type: "bool" + }, + { + internalType: "uint256", + name: "thresholdFilter", + type: "uint256" + } + ], + name: "getRateToEthWithThreshold", + outputs: [ + { + internalType: "uint256", + name: "weightedRate", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "srcToken", + type: "address" + }, + { + internalType: "contract IERC20", + name: "dstToken", + type: "address" + }, + { + internalType: "bool", + name: "useWrappers", + type: "bool" + }, + { + internalType: "contract IERC20[]", + name: "customConnectors", + type: "address[]" + }, + { + internalType: "uint256", + name: "thresholdFilter", + type: "uint256" + } + ], + name: "getRateWithCustomConnectors", + outputs: [ + { + internalType: "uint256", + name: "weightedRate", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "srcToken", + type: "address" + }, + { + internalType: "contract IERC20", + name: "dstToken", + type: "address" + }, + { + internalType: "bool", + name: "useWrappers", + type: "bool" + }, + { + internalType: "uint256", + name: "thresholdFilter", + type: "uint256" + } + ], + name: "getRateWithThreshold", + outputs: [ + { + internalType: "uint256", + name: "weightedRate", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "multiWrapper", + outputs: [ + { + internalType: "contract MultiWrapper", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "oracles", + outputs: [ + { + internalType: "contract IOracle[]", + name: "allOracles", + type: "address[]" + }, + { + internalType: "enum OffchainOracle.OracleType[]", + name: "oracleTypes", + type: "uint8[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "connector", + type: "address" + } + ], + name: "removeConnector", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IOracle", + name: "oracle", + type: "address" + }, + { + internalType: "enum OffchainOracle.OracleType", + name: "oracleKind", + type: "uint8" + } + ], + name: "removeOracle", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract MultiWrapper", + name: "_multiWrapper", + type: "address" + } + ], + name: "setMultiWrapper", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class OffchainOracle__factory { + static abi = OffchainOracle_factory_abi; + static createInterface() { + return new interface_Interface(OffchainOracle_factory_abi); + } + static connect(address, runner) { + return new contract_Contract(address, OffchainOracle_factory_abi, runner); + } +} + +;// ./src/typechain/factories/OvmGasPriceOracle__factory.ts + + +const OvmGasPriceOracle_factory_abi = [ + { + inputs: [ + { + internalType: "address", + name: "_owner", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "DecimalsUpdated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "GasPriceUpdated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "L1BaseFeeUpdated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "OverheadUpdated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "ScalarUpdated", + type: "event" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "gasPrice", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "_data", + type: "bytes" + } + ], + name: "getL1Fee", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "_data", + type: "bytes" + } + ], + name: "getL1GasUsed", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "l1BaseFee", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "overhead", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "scalar", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "_decimals", + type: "uint256" + } + ], + name: "setDecimals", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "_gasPrice", + type: "uint256" + } + ], + name: "setGasPrice", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "_baseFee", + type: "uint256" + } + ], + name: "setL1BaseFee", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "_overhead", + type: "uint256" + } + ], + name: "setOverhead", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "_scalar", + type: "uint256" + } + ], + name: "setScalar", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } +]; +class OvmGasPriceOracle__factory { + static abi = OvmGasPriceOracle_factory_abi; + static createInterface() { + return new interface_Interface(OvmGasPriceOracle_factory_abi); + } + static connect(address, runner) { + return new contract_Contract(address, OvmGasPriceOracle_factory_abi, runner); + } +} + +;// ./src/typechain/factories/ReverseRecords__factory.ts + + +const ReverseRecords_factory_abi = [ + { + inputs: [ + { + internalType: "contract ENS", + name: "_ens", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [ + { + internalType: "address[]", + name: "addresses", + type: "address[]" + } + ], + name: "getNames", + outputs: [ + { + internalType: "string[]", + name: "r", + type: "string[]" + } + ], + stateMutability: "view", + type: "function" + } +]; +class ReverseRecords__factory { + static abi = ReverseRecords_factory_abi; + static createInterface() { + return new interface_Interface(ReverseRecords_factory_abi); + } + static connect(address, runner) { + return new contract_Contract(address, ReverseRecords_factory_abi, runner); + } +} + +;// ./src/typechain/factories/index.ts + + + + + + + + + + + +;// ./src/typechain/index.ts + + + + + + + + + + + + +;// ./src/contracts.ts + + + + +/******/ return __webpack_exports__; +/******/ })() +; +}); \ No newline at end of file diff --git a/dist/tornadoContracts.umd.min.js b/dist/tornadoContracts.umd.min.js new file mode 100644 index 0000000..a55bd53 --- /dev/null +++ b/dist/tornadoContracts.umd.min.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.TornadoContracts=t():e.TornadoContracts=t()}(self,(()=>(()=>{"use strict";var e={d:(t,a)=>{for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{AdminUpgradeableProxy__factory:()=>hr,Aggregator__factory:()=>Af,AirdropMock__factory:()=>cd,Airdrop__factory:()=>Pd,BadRecipient__factory:()=>Ib,CTornado__factory:()=>Tf,Configuration__factory:()=>gs,Core__factory:()=>hs,Delegation__factory:()=>Ms,Deployer__factory:()=>Ff,DummySecond__factory:()=>$i,Dummy__factory:()=>Hi,ECDSA__factory:()=>Mn,EIP712__factory:()=>xn,ENSMock__factory:()=>od,ENSNameWrapper:()=>a.ENSNameWrapper,ENSNameWrapper__factory:()=>Hr,ENSRegistry:()=>a.ENSRegistry,ENSRegistry__factory:()=>Wr,ENSResolver:()=>a.ENSResolver,ENSResolver__factory:()=>Xr,ENS__factory:()=>ad,ERC20Basic__factory:()=>wb,ERC20Burnable__factory:()=>ab,ERC20Mock__factory:()=>Ob,ERC20Permit__factory:()=>pn,ERC20Tornado__factory:()=>tf,ERC20__factory:()=>eb,ETHTornado__factory:()=>bf,Echoer__factory:()=>sf,EnsResolve__factory:()=>fd,FeeManager__factory:()=>_r,GasCompensationVault__factory:()=>Er,GasCompensator__factory:()=>Os,GovernanceAggregator__factory:()=>Nf,GovernanceExploitPatchUpgrade__factory:()=>rr,GovernanceGasUpgrade__factory:()=>Us,GovernanceProposalStateUpgrade__factory:()=>mr,GovernanceStakingUpgrade__factory:()=>$s,GovernanceVaultUpgrade__factory:()=>Ls,Governance__factory:()=>Is,IChainlinkOracle__factory:()=>Hd,IDeployer__factory:()=>Pb,IENSRegistry__factory:()=>hf,IENSResolver__factory:()=>Mf,IENS__factory:()=>qf,IERC1155Errors__factory:()=>Za,IERC20Decimals__factory:()=>Fi,IERC20Errors__factory:()=>en,IERC20Metadata__factory:()=>un,IERC20Permit__factory:()=>on,IERC20__factory:()=>bb,IERC5267__factory:()=>fn,IERC721Errors__factory:()=>an,IFeeManager__factory:()=>Yf,IGasCompensationVault__factory:()=>Ps,IGovernance__factory:()=>Ji,IHasher__factory:()=>yb,IMetamorphicContractFactory__factory:()=>Js,IOffchainOracle__factory:()=>Wd,IProxy__factory:()=>ts,IRelayerRegistry__factory:()=>xf,ISignatureTransfer__factory:()=>Kb,ITornadoGovernance__factory:()=>ii,ITornadoInstance__factory:()=>zb,ITornadoRouter__factory:()=>jf,ITornadoStakingRewards__factory:()=>js,ITornadoVault__factory:()=>ri,IUSDT__factory:()=>vb,IUniswapV3Factory__factory:()=>Oi,IUniswapV3PoolActions__factory:()=>li,IUniswapV3PoolDerivedState__factory:()=>Ti,IUniswapV3PoolEvents__factory:()=>wi,IUniswapV3PoolImmutables__factory:()=>vi,IUniswapV3PoolOwnerActions__factory:()=>_i,IUniswapV3PoolState__factory:()=>Ii,IUniswapV3Pool__factory:()=>Pi,IVerifier__factory:()=>Lb,InitialProposal__factory:()=>Qs,InstanceRegistry__factory:()=>Wf,LoopbackProxy__factory:()=>kr,MaliciousProposal__factory:()=>ar,Math__factory:()=>On,MerkleTreeWithHistoryMock__factory:()=>Sb,MerkleTreeWithHistory__factory:()=>mb,MockGovernance__factory:()=>cs,Multicall:()=>a.Multicall,Multicall__factory:()=>Jr,NewImplementation__factory:()=>bs,Nonces__factory:()=>An,OffchainOracle:()=>a.OffchainOracle,OffchainOracle__factory:()=>Kr,OvmGasPriceOracle:()=>a.OvmGasPriceOracle,OvmGasPriceOracle__factory:()=>Qr,Ownable__factory:()=>Bn,PatchProposal__factory:()=>ur,Pausable__factory:()=>sb,Permit2Mock__factory:()=>Ub,PermitTornado__factory:()=>cf,ProposalStateChangeGovernance__factory:()=>Zi,ProposalUpgrade__factory:()=>is,Proposal__factory:()=>os,Proxy__factory:()=>zn,RelayerAggregator__factory:()=>Rf,RelayerRegistry__factory:()=>Qf,Resolver__factory:()=>id,ReverseRecords:()=>a.ReverseRecords,ReverseRecords__factory:()=>tp,ShortStrings__factory:()=>Nn,SingletonFactory__factory:()=>Cr,Strings__factory:()=>Vn,TORNMock__factory:()=>Td,TORN__factory:()=>Nd,TestnetAdminProxy__factory:()=>Zd,TestnetFeeManager__factory:()=>ti,TestnetGovernanceProxy__factory:()=>bi,TestnetOracle__factory:()=>qd,Timestamp__factory:()=>hd,TornadoProxyLight__factory:()=>Xb,TornadoRouter__factory:()=>Dr,TornadoStakingRewards__factory:()=>ui,TornadoVault__factory:()=>Fr,Tornado__factory:()=>Bb,TransparentUpgradeableProxy__factory:()=>Xn,UpgradeableProxy__factory:()=>Yn,Verifier__factory:()=>of,VestingMock__factory:()=>_d,Vesting__factory:()=>Vd,VoucherMock__factory:()=>Ed,Voucher__factory:()=>Gd,factories:()=>Br});var a={};function n(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function b(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function f(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}e.r(a),e.d(a,{rZ:()=>Hr,S4:()=>Wr,BB:()=>Xr,Q2:()=>Jr,Hk:()=>Kr,Ld:()=>Qr,Rp:()=>tp});const d=BigInt(2**32-1),i=BigInt(32);function s(e,t=!1){return t?{h:Number(e&d),l:Number(e>>i&d)}:{h:0|Number(e>>i&d),l:0|Number(e&d)}}function r(e,t=!1){let a=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let b=0;b>g)*h)%w,t&T&&(b^=m<<(m<a>32?((e,t,a)=>t<>>64-a)(e,t,a):((e,t,a)=>e<>>32-a)(e,t,a),x=(e,t,a)=>a>32?((e,t,a)=>e<>>64-a)(e,t,a):((e,t,a)=>t<>>32-a)(e,t,a);class I extends c{constructor(e,t,a,b=!1,f=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=a,this.enableXOF=b,this.rounds=f,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,n(a),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var d;this.state=new Uint8Array(200),this.state32=(d=this.state,new Uint32Array(d.buffer,d.byteOffset,Math.floor(d.byteLength/4)))}keccak(){!function(e,t=24){const a=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)a[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,b=(t+2)%10,f=a[b],d=a[b+1],i=_(f,d,1)^a[n],s=x(f,d,1)^a[n+1];for(let a=0;a<50;a+=10)e[t+a]^=i,e[t+a+1]^=s}let t=e[2],b=e[3];for(let a=0;a<24;a++){const n=y[a],f=_(t,b,n),d=x(t,b,n),i=u[a];t=e[i],b=e[i+1],e[i]=f,e[i+1]=d}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)a[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~a[(n+2)%10]&a[(n+4)%10]}e[0]^=v[n],e[1]^=M[n]}a.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){f(this);const{blockLen:t,state:a}=this,n=(e=p(e)).length;for(let b=0;b=a&&this.keccak();const f=Math.min(a-this.posOut,b-n);e.set(t.subarray(this.posOut,this.posOut+f),n),this.posOut+=f,n+=f}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return n(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(function(e,t){b(e);const a=t.outputLen;if(e.lengthfunction(e){const t=t=>e().update(p(t)).digest(),a=e();return t.outputLen=a.outputLen,t.blockLen=a.blockLen,t.create=()=>e(),t}((()=>new I(t,e,a))))(1,136,32);function R(e,t,a){const n=t.split("|").map((e=>e.trim()));for(let a=0;aPromise.resolve(e[t]))))).reduce(((e,a,n)=>(e[t[n]]=a,e)),{})}function k(e,t,a){for(let n in t){let b=t[n];const f=a?a[n]:null;f&&R(b,f,n),Object.defineProperty(e,n,{enumerable:!0,value:b,writable:!1})}}function P(e){if(null==e)return"null";if(Array.isArray(e))return"[ "+e.map(P).join(", ")+" ]";if(e instanceof Uint8Array){const t="0123456789abcdef";let a="0x";for(let n=0;n>4],a+=t[15&e[n]];return a}if("object"==typeof e&&"function"==typeof e.toJSON)return P(e.toJSON());switch(typeof e){case"boolean":case"symbol":case"number":return e.toString();case"bigint":return BigInt(e).toString();case"string":return JSON.stringify(e);case"object":{const t=Object.keys(e);return t.sort(),"{ "+t.map((t=>`${P(t)}: ${P(e[t])}`)).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function A(e,t){return e&&e.code===t}function C(e){return A(e,"CALL_EXCEPTION")}function S(e,t,a){let n,b=e;{const n=[];if(a){if("message"in a||"code"in a||"name"in a)throw new Error(`value will overwrite populated values: ${P(a)}`);for(const e in a){if("shortMessage"===e)continue;const t=a[e];n.push(e+"="+P(t))}}n.push(`code=${t}`),n.push("version=6.13.4"),n.length&&(e+=" ("+n.join(", ")+")")}switch(t){case"INVALID_ARGUMENT":n=new TypeError(e);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":n=new RangeError(e);break;default:n=new Error(e)}return k(n,{code:t}),a&&Object.assign(n,a),null==n.shortMessage&&k(n,{shortMessage:b}),n}function N(e,t,a,n){if(!e)throw S(t,a,n)}function D(e,t,a,n){N(e,t,"INVALID_ARGUMENT",{argument:a,value:n})}function U(e,t,a){null==a&&(a=""),a&&(a=": "+a),N(e>=t,"missing arguemnt"+a,"MISSING_ARGUMENT",{count:e,expectedCount:t}),N(e<=t,"too many arguments"+a,"UNEXPECTED_ARGUMENT",{count:e,expectedCount:t})}const V=["NFD","NFC","NFKD","NFKC"].reduce(((e,t)=>{try{if("test"!=="test".normalize(t))throw new Error("bad");if("NFD"===t){if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken")}e.push(t)}catch(e){}return e}),[]);function F(e,t,a){if(null==a&&(a=""),e!==t){let e=a,t="new";a&&(e+=".",t+=" "+a),N(!1,`private constructor; use ${e}from* methods`,"UNSUPPORTED_OPERATION",{operation:t})}}function L(e,t,a){if(e instanceof Uint8Array)return a?new Uint8Array(e):e;if("string"==typeof e&&e.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const t=new Uint8Array((e.length-2)/2);let a=2;for(let n=0;n>4]+H[15&n]}return a}function W(e){return"0x"+e.map((e=>z(e).substring(2))).join("")}function $(e,t,a){const n=G(e);return null!=a&&a>n.length&&N(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:a}),z(n.slice(null==t?0:t,null==a?n.length:a))}function X(e,t,a){const n=G(e);N(t>=n.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(n),length:t,offset:t+1});const b=new Uint8Array(t);return b.fill(0),a?b.set(n,t-n.length):b.set(n,0),z(b)}let q=!1;const J=function(e){return E(e)};let Y=J;function K(e){const t=G(e,"data");return z(Y(t))}function Z(e,t,a,n,b){if("BAD_PREFIX"===e||"UNEXPECTED_CONTINUE"===e){let e=0;for(let n=t+1;n>6==2;n++)e++;return e}return"OVERRUN"===e?a.length-t-1:0}K._=J,K.lock=function(){q=!0},K.register=function(e){if(q)throw new TypeError("keccak256 is locked");Y=e},Object.freeze(K);const Q=Object.freeze({error:function(e,t,a,n,b){D(!1,`invalid codepoint at offset ${t}; ${e}`,"bytes",a)},ignore:Z,replace:function(e,t,a,n,b){return"OVERLONG"===e?(D("number"==typeof b,"invalid bad code point for replacement","badCodepoint",b),n.push(b),0):(n.push(65533),Z(e,t,a))}});function ee(e,t){D("string"==typeof e,"invalid string value","str",e),null!=t&&(function(e){N(V.indexOf(e)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:e}})}(t),e=e.normalize(t));let a=[];for(let t=0;t>6|192),a.push(63&n|128);else if(55296==(64512&n)){t++;const b=e.charCodeAt(t);D(t>18|240),a.push(f>>12&63|128),a.push(f>>6&63|128),a.push(63&f|128)}else a.push(n>>12|224),a.push(n>>6&63|128),a.push(63&n|128)}return new Uint8Array(a)}function te(e,t){return function(e,t){null==t&&(t=Q.error);const a=G(e,"bytes"),n=[];let b=0;for(;b>7)){n.push(e);continue}let f=null,d=null;if(192==(224&e))f=1,d=127;else if(224==(240&e))f=2,d=2047;else{if(240!=(248&e)){b+=t(128==(192&e)?"UNEXPECTED_CONTINUE":"BAD_PREFIX",b-1,a,n);continue}f=3,d=65535}if(b-1+f>=a.length){b+=t("OVERRUN",b-1,a,n);continue}let i=e&(1<<8-f-1)-1;for(let e=0;e1114111?b+=t("OUT_OF_RANGE",b-1-f,a,n,i):i>=55296&&i<=57343?b+=t("UTF16_SURROGATE",b-1-f,a,n,i):i<=d?b+=t("OVERLONG",b-1-f,a,n,i):n.push(i))}return n}(e,t).map((e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e))))).join("")}function ae(e){return K(ee(e))}const ne=BigInt(0),be=BigInt(1),fe=9007199254740991;function de(e,t){const a=se(e,"value"),n=BigInt(ce(t,"bits"));return a&(be<=-fe&&e<=fe,"overflow",t||"value",e),BigInt(e);case"string":try{if(""===e)throw new Error("empty string");return"-"===e[0]&&"-"!==e[1]?-BigInt(e.substring(1)):BigInt(e)}catch(a){D(!1,`invalid BigNumberish string: ${a.message}`,t||"value",e)}}D(!1,"invalid BigNumberish value",t||"value",e)}function se(e,t){const a=ie(e,t);return N(a>=ne,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:e}),a}const re="0123456789abcdef";function pe(e){if(e instanceof Uint8Array){let t="0x0";for(const a of e)t+=re[a>>4],t+=re[15&a];return BigInt(t)}return ie(e)}function ce(e,t){switch(typeof e){case"bigint":return D(e>=-fe&&e<=fe,"overflow",t||"value",e),Number(e);case"number":return D(Number.isInteger(e),"underflow",t||"value",e),D(e>=-fe&&e<=fe,"overflow",t||"value",e),e;case"string":try{if(""===e)throw new Error("empty string");return ce(BigInt(e),t)}catch(a){D(!1,`invalid numeric string: ${a.message}`,t||"value",e)}}D(!1,"invalid numeric value",t||"value",e)}function ue(e,t){let a=se(e,"value").toString(16);if(null==t)a.length%2&&(a="0"+a);else{const n=ce(t,"width");for(N(2*n>=a.length,`value exceeds width (${n} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:e});a.length<2*n;)a="0"+a}return"0x"+a}const ye=32,oe=new Uint8Array(ye),le=["then"],me={},Te=new WeakMap;function ge(e){return Te.get(e)}function we(e,t){Te.set(e,t)}function he(e,t){const a=new Error(`deferred error during ABI decoding triggered accessing ${e}`);throw a.error=t,a}function ve(e,t,a){return e.indexOf(null)>=0?t.map(((e,t)=>e instanceof Me?ve(ge(e),e,a):e)):e.reduce(((e,n,b)=>{let f=t.getValue(n);return n in e||(a&&f instanceof Me&&(f=ve(ge(f),f,a)),e[n]=f),e}),{})}class Me extends Array{#e;constructor(...e){const t=e[0];let a=e[1],n=(e[2]||[]).slice(),b=!0;t!==me&&(a=e,n=[],b=!1),super(a.length),a.forEach(((e,t)=>{this[t]=e}));const f=n.reduce(((e,t)=>("string"==typeof t&&e.set(t,(e.get(t)||0)+1),e)),new Map);if(we(this,Object.freeze(a.map(((e,t)=>{const a=n[t];return null!=a&&1===f.get(a)?a:null})))),this.#e=[],null==this.#e&&this.#e,!b)return;Object.freeze(this);const d=new Proxy(this,{get:(e,t,a)=>{if("string"==typeof t){if(t.match(/^[0-9]+$/)){const a=ce(t,"%index");if(a<0||a>=this.length)throw new RangeError("out of result range");const n=e[a];return n instanceof Error&&he(`index ${a}`,n),n}if(le.indexOf(t)>=0)return Reflect.get(e,t,a);const n=e[t];if(n instanceof Function)return function(...t){return n.apply(this===a?e:this,t)};if(!(t in e))return e.getValue.apply(this===a?e:this,[t])}return Reflect.get(e,t,a)}});return we(d,ge(this)),d}toArray(e){const t=[];return this.forEach(((a,n)=>{a instanceof Error&&he(`index ${n}`,a),e&&a instanceof Me&&(a=a.toArray(e)),t.push(a)})),t}toObject(e){const t=ge(this);return t.reduce(((a,n,b)=>(N(null!=n,`value at index ${b} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),ve(t,this,e))),{})}slice(e,t){null==e&&(e=0),e<0&&(e+=this.length)<0&&(e=0),null==t&&(t=this.length),t<0&&(t+=this.length)<0&&(t=0),t>this.length&&(t=this.length);const a=ge(this),n=[],b=[];for(let f=e;f{this.#t[e]=_e(t)}}}class Ee{allowLoose;#t;#b;#f;#d;#i;constructor(e,t,a){k(this,{allowLoose:!!t}),this.#t=B(e),this.#f=0,this.#d=null,this.#i=null!=a?a:1024,this.#b=0}get data(){return z(this.#t)}get dataLength(){return this.#t.length}get consumed(){return this.#b}get bytes(){return new Uint8Array(this.#t)}#s(e){if(this.#d)return this.#d.#s(e);this.#f+=e,N(this.#i<1||this.#f<=this.#i*this.dataLength,`compressed ABI data exceeds inflation ratio of ${this.#i} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:B(this.#t),offset:this.#b,length:e,info:{bytesRead:this.#f,dataLength:this.dataLength}})}#r(e,t,a){let n=Math.ceil(t/ye)*ye;return this.#b+n>this.#t.length&&(this.allowLoose&&a&&this.#b+t<=this.#t.length?n=t:N(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:B(this.#t),length:this.#t.length,offset:this.#b+n})),this.#t.slice(this.#b,this.#b+n)}subReader(e){const t=new Ee(this.#t.slice(this.#b+e),this.allowLoose,this.#i);return t.#d=this,t}readBytes(e,t){let a=this.#r(0,e,!!t);return this.#s(e),this.#b+=a.length,a.slice(0,e)}readValue(){return pe(this.readBytes(ye))}readIndex(){return ce(pe(this.readBytes(ye)))}}const Re=BigInt(0),Oe=BigInt(36);function ke(e){const t=(e=e.toLowerCase()).substring(2).split(""),a=new Uint8Array(40);for(let e=0;e<40;e++)a[e]=t[e].charCodeAt(0);const n=G(K(a));for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&(t[e]=t[e].toUpperCase()),(15&n[e>>1])>=8&&(t[e+1]=t[e+1].toUpperCase());return"0x"+t.join("")}const Pe={};for(let e=0;e<10;e++)Pe[String(e)]=String(e);for(let e=0;e<26;e++)Pe[String.fromCharCode(65+e)]=String(10+e);const Ae=function(){const e={};for(let t=0;t<36;t++)e["0123456789abcdefghijklmnopqrstuvwxyz"[t]]=BigInt(t);return e}();function Ce(e){if(D("string"==typeof e,"invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/)){e.startsWith("0x")||(e="0x"+e);const t=ke(e);return D(!e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||t===e,"bad address checksum","address",e),t}if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){D(e.substring(2,4)===function(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((e=>Pe[e])).join("");for(;t.length>=15;){let e=t.substring(0,15);t=parseInt(e,10)%97+t.substring(e.length)}let a=String(98-parseInt(t,10)%97);for(;a.length<2;)a="0"+a;return a}(e),"bad icap checksum","address",e);let t=function(e){e=e.toLowerCase();let t=Re;for(let a=0;ae.format())).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return"string"===this.type}get tupleName(){if("tuple"!==this.type)throw TypeError("not a tuple");return this.#p}get arrayLength(){if("array"!==this.type)throw TypeError("not an array");return!0===this.#p?-1:!1===this.#p?this.value.length:null}static from(e,t){return new Ve(Se,e,t)}static uint8(e){return Ne(e,8)}static uint16(e){return Ne(e,16)}static uint24(e){return Ne(e,24)}static uint32(e){return Ne(e,32)}static uint40(e){return Ne(e,40)}static uint48(e){return Ne(e,48)}static uint56(e){return Ne(e,56)}static uint64(e){return Ne(e,64)}static uint72(e){return Ne(e,72)}static uint80(e){return Ne(e,80)}static uint88(e){return Ne(e,88)}static uint96(e){return Ne(e,96)}static uint104(e){return Ne(e,104)}static uint112(e){return Ne(e,112)}static uint120(e){return Ne(e,120)}static uint128(e){return Ne(e,128)}static uint136(e){return Ne(e,136)}static uint144(e){return Ne(e,144)}static uint152(e){return Ne(e,152)}static uint160(e){return Ne(e,160)}static uint168(e){return Ne(e,168)}static uint176(e){return Ne(e,176)}static uint184(e){return Ne(e,184)}static uint192(e){return Ne(e,192)}static uint200(e){return Ne(e,200)}static uint208(e){return Ne(e,208)}static uint216(e){return Ne(e,216)}static uint224(e){return Ne(e,224)}static uint232(e){return Ne(e,232)}static uint240(e){return Ne(e,240)}static uint248(e){return Ne(e,248)}static uint256(e){return Ne(e,256)}static uint(e){return Ne(e,256)}static int8(e){return Ne(e,-8)}static int16(e){return Ne(e,-16)}static int24(e){return Ne(e,-24)}static int32(e){return Ne(e,-32)}static int40(e){return Ne(e,-40)}static int48(e){return Ne(e,-48)}static int56(e){return Ne(e,-56)}static int64(e){return Ne(e,-64)}static int72(e){return Ne(e,-72)}static int80(e){return Ne(e,-80)}static int88(e){return Ne(e,-88)}static int96(e){return Ne(e,-96)}static int104(e){return Ne(e,-104)}static int112(e){return Ne(e,-112)}static int120(e){return Ne(e,-120)}static int128(e){return Ne(e,-128)}static int136(e){return Ne(e,-136)}static int144(e){return Ne(e,-144)}static int152(e){return Ne(e,-152)}static int160(e){return Ne(e,-160)}static int168(e){return Ne(e,-168)}static int176(e){return Ne(e,-176)}static int184(e){return Ne(e,-184)}static int192(e){return Ne(e,-192)}static int200(e){return Ne(e,-200)}static int208(e){return Ne(e,-208)}static int216(e){return Ne(e,-216)}static int224(e){return Ne(e,-224)}static int232(e){return Ne(e,-232)}static int240(e){return Ne(e,-240)}static int248(e){return Ne(e,-248)}static int256(e){return Ne(e,-256)}static int(e){return Ne(e,-256)}static bytes1(e){return De(e,1)}static bytes2(e){return De(e,2)}static bytes3(e){return De(e,3)}static bytes4(e){return De(e,4)}static bytes5(e){return De(e,5)}static bytes6(e){return De(e,6)}static bytes7(e){return De(e,7)}static bytes8(e){return De(e,8)}static bytes9(e){return De(e,9)}static bytes10(e){return De(e,10)}static bytes11(e){return De(e,11)}static bytes12(e){return De(e,12)}static bytes13(e){return De(e,13)}static bytes14(e){return De(e,14)}static bytes15(e){return De(e,15)}static bytes16(e){return De(e,16)}static bytes17(e){return De(e,17)}static bytes18(e){return De(e,18)}static bytes19(e){return De(e,19)}static bytes20(e){return De(e,20)}static bytes21(e){return De(e,21)}static bytes22(e){return De(e,22)}static bytes23(e){return De(e,23)}static bytes24(e){return De(e,24)}static bytes25(e){return De(e,25)}static bytes26(e){return De(e,26)}static bytes27(e){return De(e,27)}static bytes28(e){return De(e,28)}static bytes29(e){return De(e,29)}static bytes30(e){return De(e,30)}static bytes31(e){return De(e,31)}static bytes32(e){return De(e,32)}static address(e){return new Ve(Se,"address",e)}static bool(e){return new Ve(Se,"bool",!!e)}static bytes(e){return new Ve(Se,"bytes",e)}static string(e){return new Ve(Se,"string",e)}static array(e,t){throw new Error("not implemented yet")}static tuple(e,t){throw new Error("not implemented yet")}static overrides(e){return new Ve(Se,"overrides",Object.assign({},e))}static isTyped(e){return e&&"object"==typeof e&&"_typedSymbol"in e&&e._typedSymbol===Ue}static dereference(e,t){if(Ve.isTyped(e)){if(e.type!==t)throw new Error(`invalid type: expecetd ${t}, got ${e.type}`);return e.value}return e}}class Fe extends xe{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){let a=Ve.dereference(t,"string");try{a=Ce(a)}catch(e){return this._throwError(e.message,t)}return e.writeValue(a)}decode(e){return Ce(ue(e.readValue(),20))}}class Le extends xe{coder;constructor(e){super(e.name,e.type,"_",e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}}function Ge(e,t,a){let n=[];if(Array.isArray(a))n=a;else if(a&&"object"==typeof a){let e={};n=t.map((t=>{const n=t.localName;return N(n,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:t},value:a}),N(!e[n],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:t},value:a}),e[n]=!0,a[n]}))}else D(!1,"invalid tuple value","tuple",a);D(t.length===n.length,"types/value length mismatch","tuple",a);let b=new Ie,f=new Ie,d=[];t.forEach(((e,t)=>{let a=n[t];if(e.dynamic){let t=f.length;e.encode(f,a);let n=b.writeUpdatableValue();d.push((e=>{n(e+t)}))}else e.encode(b,a)})),d.forEach((e=>{e(b.length)}));let i=e.appendWriter(b);return i+=e.appendWriter(f),i}function Be(e,t){let a=[],n=[],b=e.subReader(0);return t.forEach((t=>{let f=null;if(t.dynamic){let a=e.readIndex(),n=b.subReader(a);try{f=t.decode(n)}catch(e){if(A(e,"BUFFER_OVERRUN"))throw e;f=e,f.baseType=t.name,f.name=t.localName,f.type=t.type}}else try{f=t.decode(e)}catch(e){if(A(e,"BUFFER_OVERRUN"))throw e;f=e,f.baseType=t.name,f.name=t.localName,f.type=t.type}if(null==f)throw new Error("investigate");a.push(f),n.push(t.localName||null)})),Me.fromItems(a,n)}class je extends xe{coder;length;constructor(e,t,a){super("array",e.type+"["+(t>=0?t:"")+"]",a,-1===t||e.dynamic),k(this,{coder:e,length:t})}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let a=0;ae||a<-(e+Ye))&&this._throwError("value out-of-bounds",t),a=function(e){let t=ie(e,"value");const a=BigInt(ce(256,"width")),n=be<de(n,8*this.size))&&this._throwError("value out-of-bounds",t);return e.writeValue(a)}decode(e){let t=de(e.readValue(),8*this.size);return this.signed&&(t=function(e,t){const a=se(e,"value"),n=BigInt(ce(t,"width"));return N(a>>n===ne,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:e}),a>>n-be?-((~a&(be<{e.dynamic&&(a=!0),n.push(e.type)})),super("tuple","tuple("+n.join(",")+")",t,a),k(this,{coders:Object.freeze(e.slice())})}defaultValue(){const e=[];this.coders.forEach((t=>{e.push(t.defaultValue())}));const t=this.coders.reduce(((e,t)=>{const a=t.localName;return a&&(e[a]||(e[a]=0),e[a]++),e}),{});return this.coders.forEach(((a,n)=>{let b=a.localName;b&&1===t[b]&&("length"===b&&(b="_length"),null==e[b]&&(e[b]=e[n]))})),Object.freeze(e)}encode(e,t){const a=Ve.dereference(t,"tuple");return Ge(e,this.coders,a)}decode(e){return Be(e,this.coders)}}function tt(e){const t=new Set;return e.forEach((e=>t.add(e))),Object.freeze(t)}const at=tt("external public payable override".split(" ")),nt="constant external internal payable private public pure view override",bt=tt(nt.split(" ")),ft="constructor error event fallback function receive struct",dt=tt(ft.split(" ")),it="calldata memory storage payable indexed",st=tt(it.split(" ")),rt=tt([ft,it,"tuple returns",nt].join(" ").split(" ")),pt={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},ct=new RegExp("^(\\s*)"),ut=new RegExp("^([0-9]+)"),yt=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),ot=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),lt=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");class mt{#b;#c;get offset(){return this.#b}get length(){return this.#c.length-this.#b}constructor(e){this.#b=0,this.#c=e.slice()}clone(){return new mt(this.#c)}reset(){this.#b=0}#u(e=0,t=0){return new mt(this.#c.slice(e,t).map((t=>Object.freeze(Object.assign({},t,{match:t.match-e,linkBack:t.linkBack-e,linkNext:t.linkNext-e})))))}popKeyword(e){const t=this.peek();if("KEYWORD"!==t.type||!e.has(t.text))throw new Error(`expected keyword ${t.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const t=this.peek();throw new Error(`expected ${e}; got ${t.type} ${JSON.stringify(t.text)}`)}return this.pop().text}popParen(){const e=this.peek();if("OPEN_PAREN"!==e.type)throw new Error("bad start");const t=this.#u(this.#b+1,e.match+1);return this.#b=e.match+1,t}popParams(){const e=this.peek();if("OPEN_PAREN"!==e.type)throw new Error("bad start");const t=[];for(;this.#b=this.#c.length)throw new Error("out-of-bounds");return this.#c[this.#b]}peekKeyword(e){const t=this.peekType("KEYWORD");return null!=t&&e.has(t)?t:null}peekType(e){if(0===this.length)return null;const t=this.peek();return t.type===e?t.text:null}pop(){const e=this.peek();return this.#b++,e}toString(){const e=[];for(let t=this.#b;t`}}function Tt(e){const t=[],a=t=>{const a=f0&&"NUMBER"===t[t.length-1].type){const a=t.pop().text;e=a+e,t[t.length-1].value=ce(a)}if(0===t.length||"BRACKET"!==t[t.length-1].type)throw new Error("missing opening bracket");t[t.length-1].text+=e}}else if(i=d.match(yt),i){if(s.text=i[1],f+=s.text.length,rt.has(s.text)){s.type="KEYWORD";continue}if(s.text.match(lt)){s.type="TYPE";continue}s.type="ID"}else{if(i=d.match(ut),!i)throw new Error(`unexpected token ${JSON.stringify(d[0])} at position ${f}`);s.text=i[1],s.type="NUMBER",f+=s.text.length}}return new mt(t.map((e=>Object.freeze(e))))}function gt(e,t){let a=[];for(const n in t.keys())e.has(n)&&a.push(n);if(a.length>1)throw new Error(`conflicting types: ${a.join(", ")}`)}function wt(e,t){if(t.peekKeyword(dt)){const a=t.pop().text;if(a!==e)throw new Error(`expected ${e}, got ${a}`)}return t.popType("ID")}function ht(e,t){const a=new Set;for(;;){const n=e.peekType("KEYWORD");if(null==n||t&&!t.has(n))break;if(e.pop(),a.has(n))throw new Error(`duplicate keywords: ${JSON.stringify(n)}`);a.add(n)}return Object.freeze(a)}function vt(e){let t=ht(e,bt);return gt(t,tt("constant payable nonpayable".split(" "))),gt(t,tt("pure view payable nonpayable".split(" "))),t.has("view")?"view":t.has("pure")?"pure":t.has("payable")?"payable":t.has("nonpayable")?"nonpayable":t.has("constant")?"view":"nonpayable"}function Mt(e,t){return e.popParams().map((e=>Ut.from(e,t)))}function _t(e){if(e.peekType("AT")){if(e.pop(),e.peekType("NUMBER"))return ie(e.pop().text);throw new Error("invalid gas")}return null}function xt(e){if(e.length)throw new Error(`unexpected tokens at offset ${e.offset}: ${e.toString()}`)}const It=new RegExp(/^(.*)\[([0-9]*)\]$/);function Et(e){const t=e.match(lt);if(D(t,"invalid type","type",e),"uint"===e)return"uint256";if("int"===e)return"int256";if(t[2]){const a=parseInt(t[2]);D(0!==a&&a<=32,"invalid bytes length","type",e)}else if(t[3]){const a=parseInt(t[3]);D(0!==a&&a<=256&&a%8==0,"invalid numeric width","type",e)}return e}const Rt={},Ot=Symbol.for("_ethers_internal"),kt="_ParamTypeInternal",Pt="_ErrorInternal",At="_EventInternal",Ct="_ConstructorInternal",St="_FallbackInternal",Nt="_FunctionInternal",Dt="_StructInternal";class Ut{name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(e,t,a,n,b,f,d,i){if(F(e,Rt,"ParamType"),Object.defineProperty(this,Ot,{value:kt}),f&&(f=Object.freeze(f.slice())),"array"===n){if(null==d||null==i)throw new Error("")}else if(null!=d||null!=i)throw new Error("");if("tuple"===n){if(null==f)throw new Error("")}else if(null!=f)throw new Error("");k(this,{name:t,type:a,baseType:n,indexed:b,components:f,arrayLength:d,arrayChildren:i})}format(e){if(null==e&&(e="sighash"),"json"===e){const t=this.name||"";if(this.isArray()){const e=JSON.parse(this.arrayChildren.format("json"));return e.name=t,e.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(e)}const a={type:"tuple"===this.baseType?"tuple":this.type,name:t};return"boolean"==typeof this.indexed&&(a.indexed=this.indexed),this.isTuple()&&(a.components=this.components.map((t=>JSON.parse(t.format(e))))),JSON.stringify(a)}let t="";return this.isArray()?(t+=this.arrayChildren.format(e),t+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?t+="("+this.components.map((t=>t.format(e))).join("full"===e?", ":",")+")":t+=this.type,"sighash"!==e&&(!0===this.indexed&&(t+=" indexed"),"full"===e&&this.name&&(t+=" "+this.name)),t}isArray(){return"array"===this.baseType}isTuple(){return"tuple"===this.baseType}isIndexable(){return null!=this.indexed}walk(e,t){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(-1!==this.arrayLength&&e.length!==this.arrayLength)throw new Error("array is wrong length");const a=this;return e.map((e=>a.arrayChildren.walk(e,t)))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const a=this;return e.map(((e,n)=>a.components[n].walk(e,t)))}return t(this.type,e)}#y(e,t,a,n){if(this.isArray()){if(!Array.isArray(t))throw new Error("invalid array value");if(-1!==this.arrayLength&&t.length!==this.arrayLength)throw new Error("array is wrong length");const b=this.arrayChildren,f=t.slice();return f.forEach(((t,n)=>{b.#y(e,t,a,(e=>{f[n]=e}))})),void n(f)}if(this.isTuple()){const b=this.components;let f;if(Array.isArray(t))f=t.slice();else{if(null==t||"object"!=typeof t)throw new Error("invalid tuple value");f=b.map((e=>{if(!e.name)throw new Error("cannot use object value with unnamed components");if(!(e.name in t))throw new Error(`missing value for component ${e.name}`);return t[e.name]}))}if(f.length!==this.components.length)throw new Error("array is wrong length");return f.forEach(((t,n)=>{b[n].#y(e,t,a,(e=>{f[n]=e}))})),void n(f)}const b=a(this.type,t);b.then?e.push(async function(){n(await b)}()):n(b)}async walkAsync(e,t){const a=[],n=[e];return this.#y(a,e,t,(e=>{n[0]=e})),a.length&&await Promise.all(a),n[0]}static from(e,t){if(Ut.isParamType(e))return e;if("string"==typeof e)try{return Ut.from(Tt(e),t)}catch(t){D(!1,"invalid param type","obj",e)}else if(e instanceof mt){let a="",n="",b=null;ht(e,tt(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(n="tuple",b=e.popParams().map((e=>Ut.from(e))),a=`tuple(${b.map((e=>e.format())).join(",")})`):(a=Et(e.popType("TYPE")),n=a);let f=null,d=null;for(;e.length&&e.peekType("BRACKET");){const t=e.pop();f=new Ut(Rt,"",a,n,null,b,d,f),d=t.value,a+=t.text,n="array",b=null}let i=null;if(ht(e,st).has("indexed")){if(!t)throw new Error("");i=!0}const s=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new Ut(Rt,s,a,n,i,b,d,f)}const a=e.name;D(!a||"string"==typeof a&&a.match(ot),"invalid name","obj.name",a);let n=e.indexed;null!=n&&(D(t,"parameter cannot be indexed","obj.indexed",e.indexed),n=!!n);let b=e.type,f=b.match(It);if(f){const t=parseInt(f[2]||"-1"),d=Ut.from({type:f[1],components:e.components});return new Ut(Rt,a||"",b,"array",n,null,t,d)}if("tuple"===b||b.startsWith("tuple(")||b.startsWith("(")){const t=null!=e.components?e.components.map((e=>Ut.from(e))):null;return new Ut(Rt,a||"",b,"tuple",n,t,null,null)}return b=Et(e.type),new Ut(Rt,a||"",b,b,n,null,null,null)}static isParamType(e){return e&&e[Ot]===kt}}class Vt{type;inputs;constructor(e,t,a){F(e,Rt,"Fragment"),k(this,{type:t,inputs:a=Object.freeze(a.slice())})}static from(e){if("string"==typeof e){try{Vt.from(JSON.parse(e))}catch(e){}return Vt.from(Tt(e))}if(e instanceof mt)switch(e.peekKeyword(dt)){case"constructor":return jt.from(e);case"error":return Gt.from(e);case"event":return Bt.from(e);case"fallback":case"receive":return Ht.from(e);case"function":return zt.from(e);case"struct":return Wt.from(e)}else if("object"==typeof e){switch(e.type){case"constructor":return jt.from(e);case"error":return Gt.from(e);case"event":return Bt.from(e);case"fallback":case"receive":return Ht.from(e);case"function":return zt.from(e);case"struct":return Wt.from(e)}N(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}D(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return jt.isFragment(e)}static isError(e){return Gt.isFragment(e)}static isEvent(e){return Bt.isFragment(e)}static isFunction(e){return zt.isFragment(e)}static isStruct(e){return Wt.isFragment(e)}}class Ft extends Vt{name;constructor(e,t,a,n){super(e,t,n),D("string"==typeof a&&a.match(ot),"invalid identifier","name",a),n=Object.freeze(n.slice()),k(this,{name:a})}}function Lt(e,t){return"("+t.map((t=>t.format(e))).join("full"===e?", ":",")+")"}class Gt extends Ft{constructor(e,t,a){super(e,"error",t,a),Object.defineProperty(this,Ot,{value:Pt})}get selector(){return ae(this.format("sighash")).substring(0,10)}format(e){if(null==e&&(e="sighash"),"json"===e)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});const t=[];return"sighash"!==e&&t.push("error"),t.push(this.name+Lt(e,this.inputs)),t.join(" ")}static from(e){if(Gt.isFragment(e))return e;if("string"==typeof e)return Gt.from(Tt(e));if(e instanceof mt){const t=wt("error",e),a=Mt(e);return xt(e),new Gt(Rt,t,a)}return new Gt(Rt,e.name,e.inputs?e.inputs.map(Ut.from):[])}static isFragment(e){return e&&e[Ot]===Pt}}class Bt extends Ft{anonymous;constructor(e,t,a,n){super(e,"event",t,a),Object.defineProperty(this,Ot,{value:At}),k(this,{anonymous:n})}get topicHash(){return ae(this.format("sighash"))}format(e){if(null==e&&(e="sighash"),"json"===e)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});const t=[];return"sighash"!==e&&t.push("event"),t.push(this.name+Lt(e,this.inputs)),"sighash"!==e&&this.anonymous&&t.push("anonymous"),t.join(" ")}static getTopicHash(e,t){return t=(t||[]).map((e=>Ut.from(e))),new Bt(Rt,e,t,!1).topicHash}static from(e){if(Bt.isFragment(e))return e;if("string"==typeof e)try{return Bt.from(Tt(e))}catch(t){D(!1,"invalid event fragment","obj",e)}else if(e instanceof mt){const t=wt("event",e),a=Mt(e,!0),n=!!ht(e,tt(["anonymous"])).has("anonymous");return xt(e),new Bt(Rt,t,a,n)}return new Bt(Rt,e.name,e.inputs?e.inputs.map((e=>Ut.from(e,!0))):[],!!e.anonymous)}static isFragment(e){return e&&e[Ot]===At}}class jt extends Vt{payable;gas;constructor(e,t,a,n,b){super(e,t,a),Object.defineProperty(this,Ot,{value:Ct}),k(this,{payable:n,gas:b})}format(e){if(N(null!=e&&"sighash"!==e,"cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),"json"===e)return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:null!=this.gas?this.gas:void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});const t=[`constructor${Lt(e,this.inputs)}`];return this.payable&&t.push("payable"),null!=this.gas&&t.push(`@${this.gas.toString()}`),t.join(" ")}static from(e){if(jt.isFragment(e))return e;if("string"==typeof e)try{return jt.from(Tt(e))}catch(t){D(!1,"invalid constuctor fragment","obj",e)}else if(e instanceof mt){ht(e,tt(["constructor"]));const t=Mt(e),a=!!ht(e,at).has("payable"),n=_t(e);return xt(e),new jt(Rt,"constructor",t,a,n)}return new jt(Rt,"constructor",e.inputs?e.inputs.map(Ut.from):[],!!e.payable,null!=e.gas?e.gas:null)}static isFragment(e){return e&&e[Ot]===Ct}}class Ht extends Vt{payable;constructor(e,t,a){super(e,"fallback",t),Object.defineProperty(this,Ot,{value:St}),k(this,{payable:a})}format(e){const t=0===this.inputs.length?"receive":"fallback";if("json"===e){const e=this.payable?"payable":"nonpayable";return JSON.stringify({type:t,stateMutability:e})}return`${t}()${this.payable?" payable":""}`}static from(e){if(Ht.isFragment(e))return e;if("string"==typeof e)try{return Ht.from(Tt(e))}catch(t){D(!1,"invalid fallback fragment","obj",e)}else if(e instanceof mt){const t=e.toString();if(D(e.peekKeyword(tt(["fallback","receive"])),"type must be fallback or receive","obj",t),"receive"===e.popKeyword(tt(["fallback","receive"]))){const t=Mt(e);return D(0===t.length,"receive cannot have arguments","obj.inputs",t),ht(e,tt(["payable"])),xt(e),new Ht(Rt,[],!0)}let a=Mt(e);a.length?D(1===a.length&&"bytes"===a[0].type,"invalid fallback inputs","obj.inputs",a.map((e=>e.format("minimal"))).join(", ")):a=[Ut.from("bytes")];const n=vt(e);if(D("nonpayable"===n||"payable"===n,"fallback cannot be constants","obj.stateMutability",n),ht(e,tt(["returns"])).has("returns")){const t=Mt(e);D(1===t.length&&"bytes"===t[0].type,"invalid fallback outputs","obj.outputs",t.map((e=>e.format("minimal"))).join(", "))}return xt(e),new Ht(Rt,a,"payable"===n)}if("receive"===e.type)return new Ht(Rt,[],!0);if("fallback"===e.type){const t=[Ut.from("bytes")],a="payable"===e.stateMutability;return new Ht(Rt,t,a)}D(!1,"invalid fallback description","obj",e)}static isFragment(e){return e&&e[Ot]===St}}class zt extends Ft{constant;outputs;stateMutability;payable;gas;constructor(e,t,a,n,b,f){super(e,"function",t,n),Object.defineProperty(this,Ot,{value:Nt}),k(this,{constant:"view"===a||"pure"===a,gas:f,outputs:b=Object.freeze(b.slice()),payable:"payable"===a,stateMutability:a})}get selector(){return ae(this.format("sighash")).substring(0,10)}format(e){if(null==e&&(e="sighash"),"json"===e)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:null!=this.gas?this.gas:void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e)))),outputs:this.outputs.map((t=>JSON.parse(t.format(e))))});const t=[];return"sighash"!==e&&t.push("function"),t.push(this.name+Lt(e,this.inputs)),"sighash"!==e&&("nonpayable"!==this.stateMutability&&t.push(this.stateMutability),this.outputs&&this.outputs.length&&(t.push("returns"),t.push(Lt(e,this.outputs))),null!=this.gas&&t.push(`@${this.gas.toString()}`)),t.join(" ")}static getSelector(e,t){return t=(t||[]).map((e=>Ut.from(e))),new zt(Rt,e,"view",t,[],null).selector}static from(e){if(zt.isFragment(e))return e;if("string"==typeof e)try{return zt.from(Tt(e))}catch(t){D(!1,"invalid function fragment","obj",e)}else if(e instanceof mt){const t=wt("function",e),a=Mt(e),n=vt(e);let b=[];ht(e,tt(["returns"])).has("returns")&&(b=Mt(e));const f=_t(e);return xt(e),new zt(Rt,t,n,a,b,f)}let t=e.stateMutability;return null==t&&(t="payable","boolean"==typeof e.constant?(t="view",e.constant||(t="payable","boolean"!=typeof e.payable||e.payable||(t="nonpayable"))):"boolean"!=typeof e.payable||e.payable||(t="nonpayable")),new zt(Rt,e.name,t,e.inputs?e.inputs.map(Ut.from):[],e.outputs?e.outputs.map(Ut.from):[],null!=e.gas?e.gas:null)}static isFragment(e){return e&&e[Ot]===Nt}}class Wt extends Ft{constructor(e,t,a){super(e,"struct",t,a),Object.defineProperty(this,Ot,{value:Dt})}format(){throw new Error("@TODO")}static from(e){if("string"==typeof e)try{return Wt.from(Tt(e))}catch(t){D(!1,"invalid struct fragment","obj",e)}else if(e instanceof mt){const t=wt("struct",e),a=Mt(e);return xt(e),new Wt(Rt,t,a)}return new Wt(Rt,e.name,e.inputs?e.inputs.map(Ut.from):[])}static isFragment(e){return e&&e[Ot]===Dt}}const $t=new Map;$t.set(0,"GENERIC_PANIC"),$t.set(1,"ASSERT_FALSE"),$t.set(17,"OVERFLOW"),$t.set(18,"DIVIDE_BY_ZERO"),$t.set(33,"ENUM_RANGE_ERROR"),$t.set(34,"BAD_STORAGE_DATA"),$t.set(49,"STACK_UNDERFLOW"),$t.set(50,"ARRAY_RANGE_ERROR"),$t.set(65,"OUT_OF_MEMORY"),$t.set(81,"UNINITIALIZED_FUNCTION_CALL");const Xt=new RegExp(/^bytes([0-9]*)$/),qt=new RegExp(/^(u?int)([0-9]*)$/);let Jt=null,Yt=1024;class Kt{#o(e){if(e.isArray())return new je(this.#o(e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new et(e.components.map((e=>this.#o(e))),e.name);switch(e.baseType){case"address":return new Fe(e.name);case"bool":return new He(e.name);case"string":return new Qe(e.name);case"bytes":return new We(e.name);case"":return new qe(e.name)}let t=e.type.match(qt);if(t){let a=parseInt(t[2]||"256");return D(0!==a&&a<=256&&a%8==0,"invalid "+t[1]+" bit length","param",e),new Ze(a/8,"int"===t[1],e.name)}if(t=e.type.match(Xt),t){let a=parseInt(t[1]);return D(0!==a&&a<=32,"invalid bytes length","param",e),new $e(a,e.name)}D(!1,"invalid type","type",e.type)}getDefaultValue(e){const t=e.map((e=>this.#o(Ut.from(e))));return new et(t,"_").defaultValue()}encode(e,t){U(t.length,e.length,"types/values length mismatch");const a=e.map((e=>this.#o(Ut.from(e)))),n=new et(a,"_"),b=new Ie;return n.encode(b,t),b.data}decode(e,t,a){const n=e.map((e=>this.#o(Ut.from(e))));return new et(n,"_").decode(new Ee(t,a,Yt))}static _setDefaultMaxInflation(e){D("number"==typeof e&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),Yt=e}static defaultAbiCoder(){return null==Jt&&(Jt=new Kt),Jt}static getBuiltinCallException(e,t,a){return function(e,t,a,n){let b="missing revert data",f=null,d=null;if(a){b="execution reverted";const e=G(a);if(a=z(a),0===e.length)b+=" (no data present; likely require(false) occurred",f="require(false)";else if(e.length%32!=4)b+=" (could not decode reason; invalid data length)";else if("0x08c379a0"===z(e.slice(0,4)))try{f=n.decode(["string"],e.slice(4))[0],d={signature:"Error(string)",name:"Error",args:[f]},b+=`: ${JSON.stringify(f)}`}catch(e){b+=" (could not decode reason; invalid string data)"}else if("0x4e487b71"===z(e.slice(0,4)))try{const t=Number(n.decode(["uint256"],e.slice(4))[0]);d={signature:"Panic(uint256)",name:"Panic",args:[t]},f=`Panic due to ${$t.get(t)||"UNKNOWN"}(${t})`,b+=`: ${f}`}catch(e){b+=" (could not decode panic code)"}else b+=" (unknown custom error)"}const i={to:t.to?Ce(t.to):null,data:t.data||"0x"};return t.from&&(i.from=Ce(t.from)),S(b,"CALL_EXCEPTION",{action:e,data:a,reason:f,transaction:i,invocation:null,revert:d})}(e,t,a,Kt.defaultAbiCoder())}}class Zt{fragment;name;signature;topic;args;constructor(e,t,a){const n=e.name,b=e.format();k(this,{fragment:e,name:n,signature:b,topic:t,args:a})}}class Qt{fragment;name;args;signature;selector;value;constructor(e,t,a,n){const b=e.name,f=e.format();k(this,{fragment:e,name:b,args:a,signature:f,selector:t,value:n})}}class ea{fragment;name;args;signature;selector;constructor(e,t,a){const n=e.name,b=e.format();k(this,{fragment:e,name:n,args:a,signature:b,selector:t})}}class ta{hash;_isIndexed;static isIndexed(e){return!(!e||!e._isIndexed)}constructor(e){k(this,{hash:e,_isIndexed:!0})}}const aa={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},na={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:e=>`reverted with reason string ${JSON.stringify(e)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:e=>{let t="unknown panic code";return e>=0&&e<=255&&aa[e.toString()]&&(t=aa[e.toString()]),`reverted with panic code 0x${e.toString(16)} (${t})`}}};class ba{fragments;deploy;fallback;receive;#l;#m;#T;#g;constructor(e){let t=[];t="string"==typeof e?JSON.parse(e):e,this.#T=new Map,this.#l=new Map,this.#m=new Map;const a=[];for(const e of t)try{a.push(Vt.from(e))}catch(t){console.log(`[Warning] Invalid Fragment ${JSON.stringify(e)}:`,t.message)}k(this,{fragments:Object.freeze(a)});let n=null,b=!1;this.#g=this.getAbiCoder(),this.fragments.forEach(((e,t)=>{let a;switch(e.type){case"constructor":return this.deploy?void console.log("duplicate definition - constructor"):void k(this,{deploy:e});case"fallback":return void(0===e.inputs.length?b=!0:(D(!n||e.payable!==n.payable,"conflicting fallback fragments",`fragments[${t}]`,e),n=e,b=n.payable));case"function":a=this.#T;break;case"event":a=this.#m;break;case"error":a=this.#l;break;default:return}const f=e.format();a.has(f)||a.set(f,e)})),this.deploy||k(this,{deploy:jt.from("constructor()")}),k(this,{fallback:n,receive:b})}format(e){const t=e?"minimal":"full";return this.fragments.map((e=>e.format(t)))}formatJson(){const e=this.fragments.map((e=>e.format("json")));return JSON.stringify(e.map((e=>JSON.parse(e))))}getAbiCoder(){return Kt.defaultAbiCoder()}#w(e,t,a){if(j(e)){const t=e.toLowerCase();for(const e of this.#T.values())if(t===e.selector)return e;return null}if(-1===e.indexOf("(")){const n=[];for(const[t,a]of this.#T)t.split("(")[0]===e&&n.push(a);if(t){const e=t.length>0?t[t.length-1]:null;let a=t.length,b=!0;Ve.isTyped(e)&&"overrides"===e.type&&(b=!1,a--);for(let e=n.length-1;e>=0;e--){const t=n[e].inputs.length;t===a||b&&t===a-1||n.splice(e,1)}for(let e=n.length-1;e>=0;e--){const a=n[e].inputs;for(let b=0;b=a.length){if("overrides"===t[b].type)continue;n.splice(e,1);break}if(t[b].type!==a[b].baseType){n.splice(e,1);break}}}}if(1===n.length&&t&&t.length!==n[0].inputs.length){const e=t[t.length-1];(null==e||Array.isArray(e)||"object"!=typeof e)&&n.splice(0,1)}return 0===n.length?null:(n.length>1&&a&&D(!1,`ambiguous function description (i.e. matches ${n.map((e=>JSON.stringify(e.format()))).join(", ")})`,"key",e),n[0])}return this.#T.get(zt.from(e).format())||null}getFunctionName(e){const t=this.#w(e,null,!1);return D(t,"no matching function","key",e),t.name}hasFunction(e){return!!this.#w(e,null,!1)}getFunction(e,t){return this.#w(e,t||null,!0)}forEachFunction(e){const t=Array.from(this.#T.keys());t.sort(((e,t)=>e.localeCompare(t)));for(let a=0;a=0;e--)n[e].inputs.length=0;e--){const a=n[e].inputs;for(let b=0;b1&&a&&D(!1,`ambiguous event description (i.e. matches ${n.map((e=>JSON.stringify(e.format()))).join(", ")})`,"key",e),n[0])}return this.#m.get(Bt.from(e).format())||null}getEventName(e){const t=this.#h(e,null,!1);return D(t,"no matching event","key",e),t.name}hasEvent(e){return!!this.#h(e,null,!1)}getEvent(e,t){return this.#h(e,t||null,!0)}forEachEvent(e){const t=Array.from(this.#m.keys());t.sort(((e,t)=>e.localeCompare(t)));for(let a=0;a1&&D(!1,`ambiguous error description (i.e. ${t.map((e=>JSON.stringify(e.format()))).join(", ")})`,"name",e),t[0])}if("Error(string)"===(e=Gt.from(e).format()))return Gt.from("error Error(string)");if("Panic(uint256)"===e)return Gt.from("error Panic(uint256)");return this.#l.get(e)||null}forEachError(e){const t=Array.from(this.#l.keys());t.sort(((e,t)=>e.localeCompare(t)));for(let a=0;a"string"===e.type?ae(t):"bytes"===e.type?K(z(t)):("bool"===e.type&&"boolean"==typeof t?t=t?"0x01":"0x00":e.type.match(/^u?int/)?t=ue(t):e.type.match(/^bytes/)?t=X(t,32,!1):"address"===e.type&&this.#g.encode(["address"],[t]),X(z(t),32,!0));for(t.forEach(((t,b)=>{const f=e.inputs[b];f.indexed?null==t?a.push(null):"array"===f.baseType||"tuple"===f.baseType?D(!1,"filtering with tuples or arrays not supported","contract."+f.name,t):Array.isArray(t)?a.push(t.map((e=>n(f,e)))):a.push(n(f,t)):D(null==t,"cannot filter non-indexed parameters; must be null","contract."+f.name,t)}));a.length&&null===a[a.length-1];)a.pop();return a}encodeEventLog(e,t){if("string"==typeof e){const t=this.getEvent(e);D(t,"unknown event","eventFragment",e),e=t}const a=[],n=[],b=[];return e.anonymous||a.push(e.topicHash),D(t.length===e.inputs.length,"event arguments/values mismatch","values",t),e.inputs.forEach(((e,f)=>{const d=t[f];if(e.indexed)if("string"===e.type)a.push(ae(d));else if("bytes"===e.type)a.push(K(d));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");a.push(this.#g.encode([e.type],[d]))}else n.push(e),b.push(d)})),{data:this.#g.encode(n,b),topics:a}}decodeEventLog(e,t,a){if("string"==typeof e){const t=this.getEvent(e);D(t,"unknown event","eventFragment",e),e=t}if(null!=a&&!e.anonymous){const t=e.topicHash;D(j(a[0],32)&&a[0].toLowerCase()===t,"fragment/topic mismatch","topics[0]",a[0]),a=a.slice(1)}const n=[],b=[],f=[];e.inputs.forEach(((e,t)=>{e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(n.push(Ut.from({type:"bytes32",name:e.name})),f.push(!0)):(n.push(e),f.push(!1)):(b.push(e),f.push(!1))}));const d=null!=a?this.#g.decode(n,W(a)):null,i=this.#g.decode(b,t,!0),s=[],r=[];let p=0,c=0;return e.inputs.forEach(((e,t)=>{let a=null;if(e.indexed)if(null==d)a=new ta(null);else if(f[t])a=new ta(d[c++]);else try{a=d[c++]}catch(e){a=e}else try{a=i[p++]}catch(e){a=e}s.push(a),r.push(e.name||null)})),Me.fromItems(s,r)}parseTransaction(e){const t=G(e.data,"tx.data"),a=ie(null!=e.value?e.value:0,"tx.value"),n=this.getFunction(z(t.slice(0,4)));if(!n)return null;const b=this.#g.decode(n.inputs,t.slice(4));return new Qt(n,n.selector,b,a)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new Zt(t,t.topicHash,this.decodeEventLog(t,e.data,e.topics))}parseError(e){const t=z(e),a=this.getError($(t,0,4));if(!a)return null;const n=this.#g.decode(a.inputs,$(t,4));return new ea(a,a.selector,n)}static from(e){return e instanceof ba?e:"string"==typeof e?new ba(JSON.parse(e)):"function"==typeof e.formatJson?new ba(e.formatJson()):"function"==typeof e.format?new ba(e.format("json")):new ba(e)}}function fa(e){return e&&"function"==typeof e.getAddress}async function da(e,t){const a=await t;return null!=a&&"0x0000000000000000000000000000000000000000"!==a||(N("string"!=typeof e,"unconfigured name","UNCONFIGURED_NAME",{value:e}),D(!1,"invalid AddressLike value; did not resolve to a value address","target",e)),Ce(a)}function ia(e,t){return"string"==typeof e?e.match(/^0x[0-9a-f]{40}$/i)?Ce(e):(N(null!=t,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),da(e,t.resolveName(e))):fa(e)?da(e,e.getAddress()):e&&"function"==typeof e.then?da(e,e):void D(!1,"unsupported addressable value","target",e)}function sa(e,t){return{address:Ce(e),storageKeys:t.map(((e,t)=>(D(j(e,32),"invalid slot",`storageKeys[${t}]`,e),e.toLowerCase())))}}const ra=BigInt(0);function pa(e){return null==e?null:e.toString()}Symbol.iterator;class ca{provider;transactionHash;blockHash;blockNumber;removed;address;data;topics;index;transactionIndex;constructor(e,t){this.provider=t;const a=Object.freeze(e.topics.slice());k(this,{transactionHash:e.transactionHash,blockHash:e.blockHash,blockNumber:e.blockNumber,removed:e.removed,address:e.address,data:e.data,topics:a,index:e.index,transactionIndex:e.transactionIndex})}toJSON(){const{address:e,blockHash:t,blockNumber:a,data:n,index:b,removed:f,topics:d,transactionHash:i,transactionIndex:s}=this;return{_type:"log",address:e,blockHash:t,blockNumber:a,data:n,index:b,removed:f,topics:d,transactionHash:i,transactionIndex:s}}async getBlock(){const e=await this.provider.getBlock(this.blockHash);return N(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransaction(){const e=await this.provider.getTransaction(this.transactionHash);return N(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransactionReceipt(){const e=await this.provider.getTransactionReceipt(this.transactionHash);return N(!!e,"failed to find transaction receipt","UNKNOWN_ERROR",{}),e}removedEvent(){return{orphan:"drop-log",log:{transactionHash:(e=this).transactionHash,blockHash:e.blockHash,blockNumber:e.blockNumber,address:e.address,data:e.data,topics:Object.freeze(e.topics.slice()),index:e.index}};var e}}class ua{provider;to;from;contractAddress;hash;index;blockHash;blockNumber;logsBloom;gasUsed;blobGasUsed;cumulativeGasUsed;gasPrice;blobGasPrice;type;status;root;#v;constructor(e,t){this.#v=Object.freeze(e.logs.map((e=>new ca(e,t))));let a=ra;null!=e.effectiveGasPrice?a=e.effectiveGasPrice:null!=e.gasPrice&&(a=e.gasPrice),k(this,{provider:t,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:a,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return this.#v}toJSON(){const{to:e,from:t,contractAddress:a,hash:n,index:b,blockHash:f,blockNumber:d,logsBloom:i,logs:s,status:r,root:p}=this;return{_type:"TransactionReceipt",blockHash:f,blockNumber:d,contractAddress:a,cumulativeGasUsed:pa(this.cumulativeGasUsed),from:t,gasPrice:pa(this.gasPrice),blobGasUsed:pa(this.blobGasUsed),blobGasPrice:pa(this.blobGasPrice),gasUsed:pa(this.gasUsed),hash:n,index:b,logs:s,logsBloom:i,root:p,status:r,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e{if(d)return null;const{blockNumber:e,nonce:t}=await O({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(t{if(null==e||0!==e.status)return e;N(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:e.to,from:e.from,data:""},receipt:e})},r=await this.provider.getTransactionReceipt(this.hash);if(0===a)return s(r);if(r){if(await r.confirmations()>=a)return s(r)}else if(await i(),0===a)return null;const p=new Promise(((e,t)=>{const f=[],r=()=>{f.forEach((e=>e()))};if(f.push((()=>{d=!0})),n>0){const e=setTimeout((()=>{r(),t(S("wait for transaction timeout","TIMEOUT"))}),n);f.push((()=>{clearTimeout(e)}))}const p=async n=>{if(await n.confirmations()>=a){r();try{e(s(n))}catch(e){t(e)}}};if(f.push((()=>{this.provider.off(this.hash,p)})),this.provider.on(this.hash,p),b>=0){const e=async()=>{try{await i()}catch(e){if(A(e,"TRANSACTION_REPLACED"))return r(),void t(e)}d||this.provider.once("block",e)};f.push((()=>{this.provider.off("block",e)})),this.provider.once("block",e)}}));return await p}isMined(){return null!=this.blockHash}isLegacy(){return 0===this.type}isBerlin(){return 1===this.type}isLondon(){return 2===this.type}isCancun(){return 3===this.type}removedEvent(){return N(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),la(this)}reorderedEvent(e){return N(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),N(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),oa(this,e)}replaceableTransaction(e){D(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const t=new ya(this,this.provider);return t.#M=e,t}}function oa(e,t){return{orphan:"reorder-transaction",tx:e,other:t}}function la(e){return{orphan:"drop-transaction",tx:e}}class ma{filter;emitter;#_;constructor(e,t,a){this.#_=t,k(this,{emitter:e,filter:a})}async removeListener(){null!=this.#_&&await this.emitter.off(this.filter,this.#_)}}class Ta extends ca{interface;fragment;args;constructor(e,t,a){super(e,e.provider),k(this,{args:t.decodeEventLog(a,e.data,e.topics),fragment:a,interface:t})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class ga extends ca{error;constructor(e,t){super(e,e.provider),k(this,{error:t})}}class wa extends ua{#x;constructor(e,t,a){super(a,t),this.#x=e}get logs(){return super.logs.map((e=>{const t=e.topics.length?this.#x.getEvent(e.topics[0]):null;if(t)try{return new Ta(e,this.#x,t)}catch(t){return new ga(e,t)}return e}))}}class ha extends ya{#x;constructor(e,t,a){super(a,t),this.#x=e}async wait(e,t){const a=await super.wait(e,t);return null==a?null:new wa(this.#x,this.provider,a)}}class va extends ma{log;constructor(e,t,a,n){super(e,t,a),k(this,{log:n})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class Ma extends va{constructor(e,t,a,n,b){super(e,t,a,new Ta(b,e.interface,n)),k(this,{args:e.interface.decodeEventLog(n,this.log.data,this.log.topics),fragment:n})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const _a=BigInt(0);function xa(e){return e&&"function"==typeof e.call}function Ia(e){return e&&"function"==typeof e.estimateGas}function Ea(e){return e&&"function"==typeof e.resolveName}function Ra(e){return e&&"function"==typeof e.sendTransaction}function Oa(e){if(null!=e){if(Ea(e))return e;if(e.provider)return e.provider}}class ka{#I;fragment;constructor(e,t,a){if(k(this,{fragment:t}),t.inputs.lengthnull==a[t]?null:e.walkAsync(a[t],((e,t)=>"address"===e?Array.isArray(t)?Promise.all(t.map((e=>ia(e,b)))):ia(t,b):t)))));return e.interface.encodeFilterTopics(t,n)}()}getTopicFilter(){return this.#I}}function Pa(e,t){return null==e?null:"function"==typeof e[t]?e:e.provider&&"function"==typeof e.provider[t]?e.provider:null}function Aa(e){return null==e?null:e.provider||null}async function Ca(e,t){const a=Ve.dereference(e,"overrides");D("object"==typeof a,"invalid overrides parameter","overrides",e);const n=function(e){const t={};e.to&&(t.to=e.to),e.from&&(t.from=e.from),e.data&&(t.data=z(e.data));const a="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const n of a)n in e&&null!=e[n]&&(t[n]=ie(e[n],`request.${n}`));const n="type,nonce".split(/,/);for(const a of n)a in e&&null!=e[a]&&(t[a]=ce(e[a],`request.${a}`));return e.accessList&&(t.accessList=function(e){if(Array.isArray(e))return e.map(((t,a)=>Array.isArray(t)?(D(2===t.length,"invalid slot set",`value[${a}]`,t),sa(t[0],t[1])):(D(null!=t&&"object"==typeof t,"invalid address-slot set","value",e),sa(t.address,t.storageKeys))));D(null!=e&&"object"==typeof e,"invalid access list","value",e);const t=Object.keys(e).map((t=>{const a=e[t].reduce(((e,t)=>(e[t]=!0,e)),{});return sa(t,Object.keys(a).sort())}));return t.sort(((e,t)=>e.address.localeCompare(t.address))),t}(e.accessList)),"blockTag"in e&&(t.blockTag=e.blockTag),"enableCcipRead"in e&&(t.enableCcipRead=!!e.enableCcipRead),"customData"in e&&(t.customData=e.customData),"blobVersionedHashes"in e&&e.blobVersionedHashes&&(t.blobVersionedHashes=e.blobVersionedHashes.slice()),"kzg"in e&&(t.kzg=e.kzg),"blobs"in e&&e.blobs&&(t.blobs=e.blobs.map((e=>{return j(t=e,!0)||t instanceof Uint8Array?z(e):Object.assign({},e);var t}))),t}(a);return D(null==n.to||(t||[]).indexOf("to")>=0,"cannot override to","overrides.to",n.to),D(null==n.data||(t||[]).indexOf("data")>=0,"cannot override data","overrides.data",n.data),n.from&&(n.from=n.from),n}async function Sa(e,t,a){const n=Pa(e,"resolveName"),b=Ea(n)?n:null;return await Promise.all(t.map(((e,t)=>e.walkAsync(a[t],((e,t)=>(t=Ve.dereference(t,e),"address"===e?ia(t,b):t))))))}function Na(e){const t=async function(t){const a=await Ca(t,["data"]);a.to=await e.getAddress(),a.from&&(a.from=await ia(a.from,Oa(e.runner)));const n=e.interface,b=ie(a.value||_a,"overrides.value")===_a,f="0x"===(a.data||"0x");return!n.fallback||n.fallback.payable||!n.receive||f||b||D(!1,"cannot send data to receive or send value to non-payable fallback","overrides",t),D(n.fallback||f,"cannot send data to receive-only contract","overrides.data",a.data),D(n.receive||n.fallback&&n.fallback.payable||b,"cannot send value to non-payable fallback","overrides.value",a.value),D(n.fallback||f,"cannot send data to receive-only contract","overrides.data",a.data),a},a=async function(a){const n=e.runner;N(Ra(n),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const b=await n.sendTransaction(await t(a)),f=Aa(e.runner);return new ha(e.interface,f,b)},n=async e=>await a(e);return k(n,{_contract:e,estimateGas:async function(a){const n=Pa(e.runner,"estimateGas");return N(Ia(n),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await n.estimateGas(await t(a))},populateTransaction:t,send:a,staticCall:async function(a){const n=Pa(e.runner,"call");N(xa(n),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const b=await t(a);try{return await n.call(b)}catch(t){if(C(t)&&t.data)throw e.interface.makeError(t.data,b);throw t}}}),n}const Da=Symbol.for("_ethersInternal_contract"),Ua=new WeakMap;function Va(e){return Ua.get(e[Da])}async function Fa(e,t){let a,n=null;if(Array.isArray(t)){const n=function(t){if(j(t,32))return t;const a=e.interface.getEvent(t);return D(a,"unknown fragment","name",t),a.topicHash};a=t.map((e=>null==e?null:Array.isArray(e)?e.map(n):n(e)))}else"*"===t?a=[null]:"string"==typeof t?j(t,32)?a=[t]:(n=e.interface.getEvent(t),D(n,"unknown fragment","event",t),a=[n.topicHash]):(b=t)&&"object"==typeof b&&"getTopicFilter"in b&&"function"==typeof b.getTopicFilter&&b.fragment?a=await t.getTopicFilter():"fragment"in t?(n=t.fragment,a=[n.topicHash]):D(!1,"unknown event name","event",t);var b;return a=a.map((e=>{if(null==e)return null;if(Array.isArray(e)){const t=Array.from(new Set(e.map((e=>e.toLowerCase()))).values());return 1===t.length?t[0]:(t.sort(),t)}return e.toLowerCase()})),{fragment:n,tag:a.map((e=>null==e?"null":Array.isArray(e)?e.join("|"):e)).join("&"),topics:a}}async function La(e,t){const{subs:a}=Va(e);return a.get((await Fa(e,t)).tag)||null}async function Ga(e,t,a){const n=Aa(e.runner);N(n,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:t});const{fragment:b,tag:f,topics:d}=await Fa(e,a),{addr:i,subs:s}=Va(e);let r=s.get(f);if(!r){const t={address:i||e,topics:d},p=t=>{let n=b;if(null==n)try{n=e.interface.getEvent(t.topics[0])}catch(e){}if(n){const f=n,d=b?e.interface.decodeEventLog(b,t.data,t.topics):[];ja(e,a,d,(n=>new Ma(e,n,a,f,t)))}else ja(e,a,[],(n=>new va(e,n,a,t)))};let c=[];r={tag:f,listeners:[],start:()=>{c.length||c.push(n.on(t,p))},stop:async()=>{if(0==c.length)return;let e=c;c=[],await Promise.all(e),n.off(t,p)}},s.set(f,r)}return r}let Ba=Promise.resolve();async function ja(e,t,a,n){try{await Ba}catch(e){}const b=async function(e,t,a,n){await Ba;const b=await La(e,t);if(!b)return!1;const f=b.listeners.length;return b.listeners=b.listeners.filter((({listener:t,once:b})=>{const f=Array.from(a);n&&f.push(n(b?null:t));try{t.call(e,...f)}catch(e){}return!b})),0===b.listeners.length&&(b.stop(),Va(e).subs.delete(b.tag)),f>0}(e,t,a,n);return Ba=b,await b}const Ha=["then"];class za{target;interface;runner;filters;[Da];fallback;constructor(e,t,a,n){D("string"==typeof e||fa(e),"invalid value for Contract target","target",e),null==a&&(a=null);const b=ba.from(t);let f;k(this,{target:e,runner:a,interface:b}),Object.defineProperty(this,Da,{value:{}});let d=null,i=null;if(n){const e=Aa(a);i=new ha(this.interface,e,n)}let s=new Map;if("string"==typeof e)if(j(e))d=e,f=Promise.resolve(e);else{const t=Pa(a,"resolveName");if(!Ea(t))throw S("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});f=t.resolveName(e).then((t=>{if(null==t)throw S("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return Va(this).addr=t,t}))}else f=e.getAddress().then((e=>{if(null==e)throw new Error("TODO");return Va(this).addr=e,e}));var r;r={addrPromise:f,addr:d,deployTx:i,subs:s},Ua.set(this[Da],r);const p=new Proxy({},{get:(e,t,a)=>{if("symbol"==typeof t||Ha.indexOf(t)>=0)return Reflect.get(e,t,a);try{return this.getEvent(t)}catch(e){if(!A(e,"INVALID_ARGUMENT")||"key"!==e.argument)throw e}},has:(e,t)=>Ha.indexOf(t)>=0?Reflect.has(e,t):Reflect.has(e,t)||this.interface.hasEvent(String(t))});return k(this,{filters:p}),k(this,{fallback:b.receive||b.fallback?Na(this):null}),new Proxy(this,{get:(e,t,a)=>{if("symbol"==typeof t||t in e||Ha.indexOf(t)>=0)return Reflect.get(e,t,a);try{return e.getFunction(t)}catch(e){if(!A(e,"INVALID_ARGUMENT")||"key"!==e.argument)throw e}},has:(e,t)=>"symbol"==typeof t||t in e||Ha.indexOf(t)>=0?Reflect.has(e,t):e.interface.hasFunction(t)})}connect(e){return new za(this.target,this.interface,e)}attach(e){return new za(e,this.interface,this.runner)}async getAddress(){return await Va(this).addrPromise}async getDeployedCode(){const e=Aa(this.runner);N(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const t=await e.getCode(await this.getAddress());return"0x"===t?null:t}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(null!=await this.getDeployedCode())return this;const t=Aa(this.runner);return N(null!=t,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise(((e,a)=>{const n=async()=>{try{if(null!=await this.getDeployedCode())return e(this);t.once("block",n)}catch(e){a(e)}};n()}))}deploymentTransaction(){return Va(this).deployTx}getFunction(e){"string"!=typeof e&&(e=e.format());const t=function(e,t){const a=function(...a){const n=e.interface.getFunction(t,a);return N(n,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t,args:a}}),n},n=async function(...t){const n=a(...t);let b={};if(n.inputs.length+1===t.length&&(b=await Ca(t.pop()),b.from&&(b.from=await ia(b.from,Oa(e.runner)))),n.inputs.length!==t.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const f=await Sa(e.runner,n.inputs,t);return Object.assign({},b,await O({to:e.getAddress(),data:e.interface.encodeFunctionData(n,f)}))},b=async function(...e){const t=await d(...e);return 1===t.length?t[0]:t},f=async function(...t){const a=e.runner;N(Ra(a),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const b=await a.sendTransaction(await n(...t)),f=Aa(e.runner);return new ha(e.interface,f,b)},d=async function(...t){const b=Pa(e.runner,"call");N(xa(b),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const f=await n(...t);let d="0x";try{d=await b.call(f)}catch(t){if(C(t)&&t.data)throw e.interface.makeError(t.data,f);throw t}const i=a(...t);return e.interface.decodeFunctionResult(i,d)},i=async(...e)=>a(...e).constant?await b(...e):await f(...e);return k(i,{name:e.interface.getFunctionName(t),_contract:e,_key:t,getFragment:a,estimateGas:async function(...t){const a=Pa(e.runner,"estimateGas");return N(Ia(a),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await a.estimateGas(await n(...t))},populateTransaction:n,send:f,staticCall:b,staticCallResult:d}),Object.defineProperty(i,"fragment",{configurable:!1,enumerable:!0,get:()=>{const a=e.interface.getFunction(t);return N(a,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t}}),a}}),i}(this,e);return t}getEvent(e){return"string"!=typeof e&&(e=e.format()),function(e,t){const a=function(...a){const n=e.interface.getEvent(t,a);return N(n,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t,args:a}}),n},n=function(...t){return new ka(e,a(...t),t)};return k(n,{name:e.interface.getEventName(t),_contract:e,_key:t,getFragment:a}),Object.defineProperty(n,"fragment",{configurable:!1,enumerable:!0,get:()=>{const a=e.interface.getEvent(t);return N(a,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t}}),a}}),n}(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,t,a){null==t&&(t=0),null==a&&(a="latest");const{addr:n,addrPromise:b}=Va(this),f=n||await b,{fragment:d,topics:i}=await Fa(this,e),s={address:f,topics:i,fromBlock:t,toBlock:a},r=Aa(this.runner);return N(r,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await r.getLogs(s)).map((e=>{let t=d;if(null==t)try{t=this.interface.getEvent(e.topics[0])}catch(e){}if(t)try{return new Ta(e,this.interface,t)}catch(t){return new ga(e,t)}return new ca(e,r)}))}async on(e,t){const a=await Ga(this,"on",e);return a.listeners.push({listener:t,once:!1}),a.start(),this}async once(e,t){const a=await Ga(this,"once",e);return a.listeners.push({listener:t,once:!0}),a.start(),this}async emit(e,...t){return await ja(this,e,t,null)}async listenerCount(e){if(e){const t=await La(this,e);return t?t.listeners.length:0}const{subs:t}=Va(this);let a=0;for(const{listeners:e}of t.values())a+=e.length;return a}async listeners(e){if(e){const t=await La(this,e);return t?t.listeners.map((({listener:e})=>e)):[]}const{subs:t}=Va(this);let a=[];for(const{listeners:e}of t.values())a=a.concat(e.map((({listener:e})=>e)));return a}async off(e,t){const a=await La(this,e);if(!a)return this;if(t){const e=a.listeners.map((({listener:e})=>e)).indexOf(t);e>=0&&a.listeners.splice(e,1)}return null!=t&&0!==a.listeners.length||(a.stop(),Va(this).subs.delete(a.tag)),this}async removeAllListeners(e){if(e){const t=await La(this,e);if(!t)return this;t.stop(),Va(this).subs.delete(t.tag)}else{const{subs:e}=Va(this);for(const{tag:t,stop:a}of e.values())a(),e.delete(t)}return this}async addListener(e,t){return await this.on(e,t)}async removeListener(e,t){return await this.off(e,t)}static buildClass(e){return class extends za{constructor(t,a=null){super(t,e,a)}}}static from(e,t,a){return null==a&&(a=null),new this(e,t,a)}}class Wa extends(function(){return za}()){}function $a(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function Xa(e){if(Array.isArray(e)){let t=[];if(e.forEach((function(e){t=t.concat(Xa(e))})),t.length<=55)return t.unshift(192+t.length),t;const a=$a(t.length);return a.unshift(247+a.length),a.concat(t)}const t=Array.prototype.slice.call(G(e,"object"));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const a=$a(t.length);return a.unshift(183+a.length),a.concat(t)}const qa="0123456789abcdef";function Ja(e){let t="0x";for(const a of Xa(e))t+=qa[a>>4],t+=qa[15&a];return t}class Ya{interface;bytecode;runner;constructor(e,t,a){const n=ba.from(e);t instanceof Uint8Array||("object"==typeof t&&(t=t.object),t.startsWith("0x")||(t="0x"+t)),k(this,{bytecode:t=z(G(t)),interface:n,runner:a||null})}attach(e){return new za(e,this.interface,this.runner)}async getDeployTransaction(...e){let t={};const a=this.interface.deploy;if(a.inputs.length+1===e.length&&(t=await Ca(e.pop())),a.inputs.length!==e.length)throw new Error("incorrect number of arguments to constructor");const n=await Sa(this.runner,a.inputs,e),b=W([this.bytecode,this.interface.encodeDeploy(n)]);return Object.assign({},t,{data:b})}async deploy(...e){const t=await this.getDeployTransaction(...e);N(this.runner&&"function"==typeof this.runner.sendTransaction,"factory runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const a=await this.runner.sendTransaction(t),n=function(e){const t=Ce(e.from);let a=ie(e.nonce,"tx.nonce").toString(16);return a="0"===a?"0x":a.length%2?"0x0"+a:"0x"+a,Ce($(K(Ja([t,a])),12))}(a);return new za(n,this.interface,this.runner,a)}connect(e){return new Ya(this.interface,this.bytecode,e)}static fromSolidity(e,t){D(null!=e,"bad compiler output","output",e),"string"==typeof e&&(e=JSON.parse(e));const a=e.abi;let n="";return e.bytecode?n=e.bytecode:e.evm&&e.evm.bytecode&&(n=e.evm.bytecode),new this(a,n,t)}}const Ka=[{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ERC1155InsufficientBalance",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC1155InvalidApprover",type:"error"},{inputs:[{internalType:"uint256",name:"idsLength",type:"uint256"},{internalType:"uint256",name:"valuesLength",type:"uint256"}],name:"ERC1155InvalidArrayLength",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"}],name:"ERC1155InvalidOperator",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC1155InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC1155InvalidSender",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"address",name:"owner",type:"address"}],name:"ERC1155MissingApprovalForAll",type:"error"}];class Za{static abi=Ka;static createInterface(){return new ba(Ka)}static connect(e,t){return new Wa(e,Ka,t)}}const Qa=[{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"allowance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientAllowance",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientBalance",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC20InvalidApprover",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC20InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC20InvalidSender",type:"error"},{inputs:[{internalType:"address",name:"spender",type:"address"}],name:"ERC20InvalidSpender",type:"error"}];class en{static abi=Qa;static createInterface(){return new ba(Qa)}static connect(e,t){return new Wa(e,Qa,t)}}const tn=[{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"owner",type:"address"}],name:"ERC721IncorrectOwner",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ERC721InsufficientApproval",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC721InvalidApprover",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"}],name:"ERC721InvalidOperator",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"ERC721InvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC721InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC721InvalidSender",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ERC721NonexistentToken",type:"error"}];class an{static abi=tn;static createInterface(){return new ba(tn)}static connect(e,t){return new Wa(e,tn,t)}}var nn=Object.freeze({__proto__:null,IERC1155Errors__factory:Za,IERC20Errors__factory:en,IERC721Errors__factory:an});const bn=[{anonymous:!1,inputs:[],name:"EIP712DomainChanged",type:"event"},{inputs:[],name:"eip712Domain",outputs:[{internalType:"bytes1",name:"fields",type:"bytes1"},{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"version",type:"string"},{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"address",name:"verifyingContract",type:"address"},{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"uint256[]",name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}];class fn{static abi=bn;static createInterface(){return new ba(bn)}static connect(e,t){return new Wa(e,bn,t)}}var dn=Object.freeze({__proto__:null,IERC5267__factory:fn,draftIerc6093Sol:nn});const sn=[{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"allowance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientAllowance",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientBalance",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC20InvalidApprover",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC20InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC20InvalidSender",type:"error"},{inputs:[{internalType:"address",name:"spender",type:"address"}],name:"ERC20InvalidSpender",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"value",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"burnFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],rn=[{inputs:[],name:"ECDSAInvalidSignature",type:"error"},{inputs:[{internalType:"uint256",name:"length",type:"uint256"}],name:"ECDSAInvalidSignatureLength",type:"error"},{inputs:[{internalType:"bytes32",name:"s",type:"bytes32"}],name:"ECDSAInvalidSignatureS",type:"error"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"allowance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientAllowance",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientBalance",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC20InvalidApprover",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC20InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC20InvalidSender",type:"error"},{inputs:[{internalType:"address",name:"spender",type:"address"}],name:"ERC20InvalidSpender",type:"error"},{inputs:[{internalType:"uint256",name:"deadline",type:"uint256"}],name:"ERC2612ExpiredSignature",type:"error"},{inputs:[{internalType:"address",name:"signer",type:"address"},{internalType:"address",name:"owner",type:"address"}],name:"ERC2612InvalidSigner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"currentNonce",type:"uint256"}],name:"InvalidAccountNonce",type:"error"},{inputs:[],name:"InvalidShortString",type:"error"},{inputs:[{internalType:"string",name:"str",type:"string"}],name:"StringTooLong",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[],name:"EIP712DomainChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"eip712Domain",outputs:[{internalType:"bytes1",name:"fields",type:"bytes1"},{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"version",type:"string"},{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"address",name:"verifyingContract",type:"address"},{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"uint256[]",name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}];let pn=class{static abi=rn;static createInterface(){return new ba(rn)}static connect(e,t){return new Wa(e,rn,t)}};const cn=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}];class un{static abi=cn;static createInterface(){return new ba(cn)}static connect(e,t){return new Wa(e,cn,t)}}const yn=[{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"}];class on{static abi=yn;static createInterface(){return new ba(yn)}static connect(e,t){return new Wa(e,yn,t)}}var ln=Object.freeze({__proto__:null,ERC20Burnable__factory:class{static abi=sn;static createInterface(){return new ba(sn)}static connect(e,t){return new Wa(e,sn,t)}},ERC20Permit__factory:pn,IERC20Metadata__factory:un,IERC20Permit__factory:on});const mn=[{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"allowance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientAllowance",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientBalance",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC20InvalidApprover",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC20InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC20InvalidSender",type:"error"},{inputs:[{internalType:"address",name:"spender",type:"address"}],name:"ERC20InvalidSpender",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],Tn=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}];var gn=Object.freeze({__proto__:null,ERC20__factory:class{static abi=mn;static createInterface(){return new ba(mn)}static connect(e,t){return new Wa(e,mn,t)}},IERC20__factory:class{static abi=Tn;static createInterface(){return new ba(Tn)}static connect(e,t){return new Wa(e,Tn,t)}},extensions:ln}),wn=Object.freeze({__proto__:null,erc20:gn});const hn=[{inputs:[],name:"ECDSAInvalidSignature",type:"error"},{inputs:[{internalType:"uint256",name:"length",type:"uint256"}],name:"ECDSAInvalidSignatureLength",type:"error"},{inputs:[{internalType:"bytes32",name:"s",type:"bytes32"}],name:"ECDSAInvalidSignatureS",type:"error"}],vn="0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122045318690f3888125255e48382b32b90ae3da72675cabe3bcd6e9478e8383086264736f6c634300081c0033";class Mn extends Ya{constructor(...e){e.length>1?super(...e):super(hn,vn,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=vn;static abi=hn;static createInterface(){return new ba(hn)}static connect(e,t){return new Wa(e,hn,t)}}const _n=[{inputs:[],name:"InvalidShortString",type:"error"},{inputs:[{internalType:"string",name:"str",type:"string"}],name:"StringTooLong",type:"error"},{anonymous:!1,inputs:[],name:"EIP712DomainChanged",type:"event"},{inputs:[],name:"eip712Domain",outputs:[{internalType:"bytes1",name:"fields",type:"bytes1"},{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"version",type:"string"},{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"address",name:"verifyingContract",type:"address"},{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"uint256[]",name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}];class xn{static abi=_n;static createInterface(){return new ba(_n)}static connect(e,t){return new Wa(e,_n,t)}}var In=Object.freeze({__proto__:null,ECDSA__factory:Mn,EIP712__factory:xn});const En=[{inputs:[],name:"MathOverflowedMulDiv",type:"error"}],Rn="0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122054710e438b4d818c9886821c7249e64e03942ccb6f261579743c3dd2da7d85c964736f6c634300081c0033";class On extends Ya{constructor(...e){e.length>1?super(...e):super(En,Rn,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=Rn;static abi=En;static createInterface(){return new ba(En)}static connect(e,t){return new Wa(e,En,t)}}var kn=Object.freeze({__proto__:null,Math__factory:On});const Pn=[{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"currentNonce",type:"uint256"}],name:"InvalidAccountNonce",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"}];class An{static abi=Pn;static createInterface(){return new ba(Pn)}static connect(e,t){return new Wa(e,Pn,t)}}const Cn=[{inputs:[],name:"InvalidShortString",type:"error"},{inputs:[{internalType:"string",name:"str",type:"string"}],name:"StringTooLong",type:"error"}],Sn="0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212206a078d04f950e0ca410dd1769613f6ca85ff5970fa2ea088000c56fd336fbcaf64736f6c634300081c0033";class Nn extends Ya{constructor(...e){e.length>1?super(...e):super(Cn,Sn,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=Sn;static abi=Cn;static createInterface(){return new ba(Cn)}static connect(e,t){return new Wa(e,Cn,t)}}const Dn=[{inputs:[{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"length",type:"uint256"}],name:"StringsInsufficientHexLength",type:"error"}],Un="0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220cdd8289a2d34ad06cf0635eabbcac19a2c578b590d1b046b83c091f968f77dd664736f6c634300081c0033";class Vn extends Ya{constructor(...e){e.length>1?super(...e):super(Dn,Un,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=Un;static abi=Dn;static createInterface(){return new ba(Dn)}static connect(e,t){return new Wa(e,Dn,t)}}var Fn=Object.freeze({__proto__:null,Nonces__factory:An,ShortStrings__factory:Nn,Strings__factory:Vn,cryptography:In,math:kn}),Ln=Object.freeze({__proto__:null,interfaces:dn,token:wn,utils:Fn});const Gn=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}];class Bn{static abi=Gn;static createInterface(){return new ba(Gn)}static connect(e,t){return new Wa(e,Gn,t)}}var jn=Object.freeze({__proto__:null,Ownable__factory:Bn});const Hn=[{stateMutability:"payable",type:"fallback"},{stateMutability:"payable",type:"receive"}];class zn{static abi=Hn;static createInterface(){return new ba(Hn)}static connect(e,t){return new Wa(e,Hn,t)}}const Wn=[{inputs:[{internalType:"address",name:"_logic",type:"address"},{internalType:"address",name:"_admin",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"}],stateMutability:"payable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"previousAdmin",type:"address"},{indexed:!1,internalType:"address",name:"newAdmin",type:"address"}],name:"AdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{stateMutability:"payable",type:"fallback"},{inputs:[],name:"admin",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newAdmin",type:"address"}],name:"changeAdmin",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"implementation",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{stateMutability:"payable",type:"receive"}],$n="0x60806040526040516108dc3803806108dc8339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508290506100ee826101bf565b8051156101a6576000826001600160a01b0316826040518082805190602001908083835b602083106101315780518252601f199092019160209182019101610112565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610191576040519150601f19603f3d011682016040523d82523d6000602084013e610196565b606091505b50509050806101a457600080fd5b505b506101ae9050565b6101b782610231565b50505061025b565b6101d28161025560201b6103b41760201c565b61020d5760405162461bcd60e51b81526004018080602001828103825260368152602001806108a66036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3b151590565b61063c8061026a6000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b815260040180806020018281038252603a815260200180610555603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260428152602001806105c56042913960600191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603681526020018061058f6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a26469706673582212200bf5c74f32000c92994fb0de053047d19f9c526eb1b1953df8bcb7d7e0df8d2864736f6c634300060c00335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374";class Xn extends Ya{constructor(...e){e.length>1?super(...e):super(Wn,$n,e[0])}getDeployTransaction(e,t,a,n){return super.getDeployTransaction(e,t,a,n||{})}deploy(e,t,a,n){return super.deploy(e,t,a,n||{})}connect(e){return super.connect(e)}static bytecode=$n;static abi=Wn;static createInterface(){return new ba(Wn)}static connect(e,t){return new Wa(e,Wn,t)}}const qn=[{inputs:[{internalType:"address",name:"_logic",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"}],stateMutability:"payable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{stateMutability:"payable",type:"fallback"},{stateMutability:"payable",type:"receive"}],Jn="0x60806040526040516103123803806103128339818101604052604081101561002657600080fd5b81516020830180516040519294929383019291908464010000000082111561004d57600080fd5b90830190602082018581111561006257600080fd5b825164010000000081118282018810171561007c57600080fd5b82525081516020918201929091019080838360005b838110156100a9578181015183820152602001610091565b50505050905090810190601f1680156100d65780820380516001836020036101000a031916815260200191505b50604052506100e3915050565b6100ec826101ab565b8051156101a4576000826001600160a01b0316826040518082805190602001908083835b6020831061012f5780518252601f199092019160209182019101610110565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d806000811461018f576040519150601f19603f3d011682016040523d82523d6000602084013e610194565b606091505b50509050806101a257600080fd5b505b5050610223565b6101be8161021d60201b6100271760201c565b6101f95760405162461bcd60e51b81526004018080602001828103825260368152602001806102dc6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b3b151590565b60ab806102316000396000f3fe608060405236601057600e6013565b005b600e5b60196025565b60256021602d565b6052565b565b3b151590565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156070573d6000f35b3d6000fdfea2646970667358221220621b7042bfb847b4073a3c58bdbea5295ce2e761b4e2307ca010caaac996d80c64736f6c634300060c00335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374";class Yn extends Ya{constructor(...e){e.length>1?super(...e):super(qn,Jn,e[0])}getDeployTransaction(e,t,a){return super.getDeployTransaction(e,t,a||{})}deploy(e,t,a){return super.deploy(e,t,a||{})}connect(e){return super.connect(e)}static bytecode=Jn;static abi=qn;static createInterface(){return new ba(qn)}static connect(e,t){return new Wa(e,qn,t)}}var Kn=Object.freeze({__proto__:null,Proxy__factory:zn,TransparentUpgradeableProxy__factory:Xn,UpgradeableProxy__factory:Yn});const Zn=[{inputs:[{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"symbol",type:"string"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],Qn="0x608060405234801561001057600080fd5b5060405162000c6238038062000c628339818101604052604081101561003557600080fd5b810190808051604051939291908464010000000082111561005557600080fd5b90830190602082018581111561006a57600080fd5b825164010000000081118282018810171561008457600080fd5b82525081516020918201929091019080838360005b838110156100b1578181015183820152602001610099565b50505050905090810190601f1680156100de5780820380516001836020036101000a031916815260200191505b506040526020018051604051939291908464010000000082111561010157600080fd5b90830190602082018581111561011657600080fd5b825164010000000081118282018810171561013057600080fd5b82525081516020918201929091019080838360005b8381101561015d578181015183820152602001610145565b50505050905090810190601f16801561018a5780820380516001836020036101000a031916815260200191505b50604052505082516101a4915060039060208501906101cd565b5080516101b89060049060208401906101cd565b50506005805460ff1916601217905550610260565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061020e57805160ff191683800117855561023b565b8280016001018555821561023b579182015b8281111561023b578251825591602001919060010190610220565b5061024792915061024b565b5090565b5b80821115610247576000815560010161024c565b6109f280620002706000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c8063395093511161007157806339509351146101d957806370a082311461020557806395d89b411461022b578063a457c2d714610233578063a9059cbb1461025f578063dd62ed3e1461028b576100a9565b806306fdde03146100ae578063095ea7b31461012b57806318160ddd1461016b57806323b872dd14610185578063313ce567146101bb575b600080fd5b6100b66102b9565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f05781810151838201526020016100d8565b50505050905090810190601f16801561011d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101576004803603604081101561014157600080fd5b506001600160a01b03813516906020013561034f565b604080519115158252519081900360200190f35b61017361036c565b60408051918252519081900360200190f35b6101576004803603606081101561019b57600080fd5b506001600160a01b03813581169160208101359091169060400135610372565b6101c36103f9565b6040805160ff9092168252519081900360200190f35b610157600480360360408110156101ef57600080fd5b506001600160a01b038135169060200135610402565b6101736004803603602081101561021b57600080fd5b50356001600160a01b0316610450565b6100b661046b565b6101576004803603604081101561024957600080fd5b506001600160a01b0381351690602001356104cc565b6101576004803603604081101561027557600080fd5b506001600160a01b038135169060200135610534565b610173600480360360408110156102a157600080fd5b506001600160a01b0381358116916020013516610548565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103455780601f1061031a57610100808354040283529160200191610345565b820191906000526020600020905b81548152906001019060200180831161032857829003601f168201915b5050505050905090565b600061036361035c610573565b8484610577565b50600192915050565b60025490565b600061037f848484610663565b6103ef8461038b610573565b6103ea85604051806060016040528060288152602001610927602891396001600160a01b038a166000908152600160205260408120906103c9610573565b6001600160a01b0316815260208101919091526040016000205491906107be565b610577565b5060019392505050565b60055460ff1690565b600061036361040f610573565b846103ea8560016000610420610573565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610855565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103455780601f1061031a57610100808354040283529160200191610345565b60006103636104d9610573565b846103ea856040518060600160405280602581526020016109986025913960016000610503610573565b6001600160a01b03908116825260208083019390935260409182016000908120918d168152925290205491906107be565b6000610363610541610573565b8484610663565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166105bc5760405162461bcd60e51b81526004018080602001828103825260248152602001806109746024913960400191505060405180910390fd5b6001600160a01b0382166106015760405162461bcd60e51b81526004018080602001828103825260228152602001806108df6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166106a85760405162461bcd60e51b815260040180806020018281038252602581526020018061094f6025913960400191505060405180910390fd5b6001600160a01b0382166106ed5760405162461bcd60e51b81526004018080602001828103825260238152602001806108bc6023913960400191505060405180910390fd5b6106f88383836108b6565b61073581604051806060016040528060268152602001610901602691396001600160a01b03861660009081526020819052604090205491906107be565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546107649082610855565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6000818484111561084d5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156108125781810151838201526020016107fa565b50505050905090810190601f16801561083f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000828201838110156108af576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220347718b9db0288208ab5957df73278c6f781963df0e13918151971217fc2827964736f6c634300060c0033";class eb extends Ya{constructor(...e){e.length>1?super(...e):super(Zn,Qn,e[0])}getDeployTransaction(e,t,a){return super.getDeployTransaction(e,t,a||{})}deploy(e,t,a){return super.deploy(e,t,a||{})}connect(e){return super.connect(e)}static bytecode=Qn;static abi=Zn;static createInterface(){return new ba(Zn)}static connect(e,t){return new Wa(e,Zn,t)}}const tb=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"burnFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}];class ab{static abi=tb;static createInterface(){return new ba(tb)}static connect(e,t){return new Wa(e,tb,t)}}const nb=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}];let bb=class{static abi=nb;static createInterface(){return new ba(nb)}static connect(e,t){return new Wa(e,nb,t)}};var fb=Object.freeze({__proto__:null,ERC20Burnable__factory:ab,ERC20__factory:eb,IERC20__factory:bb}),db=Object.freeze({__proto__:null,erc20:fb});const ib=[{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"}];class sb{static abi=ib;static createInterface(){return new ba(ib)}static connect(e,t){return new Wa(e,ib,t)}}var rb=Object.freeze({__proto__:null,Pausable__factory:sb}),pb=Object.freeze({__proto__:null,access:jn,proxy:Kn,token:db,utils:rb}),cb=Object.freeze({__proto__:null,contracts:Ln,contractsV3:pb});const ub=[{inputs:[{internalType:"uint256",name:"in_xL",type:"uint256"},{internalType:"uint256",name:"in_xR",type:"uint256"}],name:"MiMCSponge",outputs:[{internalType:"uint256",name:"xL",type:"uint256"},{internalType:"uint256",name:"xR",type:"uint256"}],stateMutability:"pure",type:"function"}];class yb{static abi=ub;static createInterface(){return new ba(ub)}static connect(e,t){return new Wa(e,ub,t)}}const ob=[{inputs:[{internalType:"uint32",name:"_levels",type:"uint32"},{internalType:"contract IHasher",name:"_hasher",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"FIELD_SIZE",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"ROOT_HISTORY_SIZE",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"ZERO_VALUE",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"currentRootIndex",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"filledSubtrees",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLastRoot",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IHasher",name:"_hasher",type:"address"},{internalType:"bytes32",name:"_left",type:"bytes32"},{internalType:"bytes32",name:"_right",type:"bytes32"}],name:"hashLeftRight",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"pure",type:"function"},{inputs:[],name:"hasher",outputs:[{internalType:"contract IHasher",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"_root",type:"bytes32"}],name:"isKnownRoot",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"levels",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"nextIndex",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"roots",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"zeros",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"}],lb="0x60c0604052600380546001600160401b031916905534801561002057600080fd5b50604051610a10380380610a1083398101604081905261003f91610385565b60008263ffffffff16116100a65760405162461bcd60e51b815260206004820152602360248201527f5f6c6576656c732073686f756c642062652067726561746572207468616e207a60448201526265726f60e81b60648201526084015b60405180910390fd5b60208263ffffffff16106100fc5760405162461bcd60e51b815260206004820152601e60248201527f5f6c6576656c732073686f756c64206265206c657373207468616e2033320000604482015260640161009d565b63ffffffff821660a0526001600160a01b0381166080527f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c60005b8363ffffffff168163ffffffff1610156101845763ffffffff8116600090815260016020908152604080832085905590829052902082905561017a8383806101b8565b9150600101610137565b506000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b55506103f89050565b60006000805160206109f083398151915283106102175760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c64604482015260640161009d565b6000805160206109f0833981519152821061027e5760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b606482015260840161009d565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156102cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f191906103d4565b90925090506000805160206109f083398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610356573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061037a91906103d4565b509695505050505050565b6000806040838503121561039857600080fd5b825163ffffffff811681146103ac57600080fd5b60208401519092506001600160a01b03811681146103c957600080fd5b809150509250929050565b600080604083850312156103e757600080fd5b505080516020909101519092909150565b60805160a0516105d361041d60003960006101010152600061020f01526105d36000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063c2b40ae41161008c578063ec73295911610066578063ec732959146101e3578063ed33639f1461020a578063f178e47c14610249578063fc7e9c6f1461026957600080fd5b8063c2b40ae41461019b578063cd87a3b4146101bb578063e8295588146101c357600080fd5b8063414a37ba146100d45780634ecf518b146100fc5780636d9833e3146101385780638ea3099e1461015b57806390eeb02b1461016e578063ba70f7571461017e575b600080fd5b6100e960008051602061057e83398151915281565b6040519081526020015b60405180910390f35b6101237f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff90911681526020016100f3565b61014b6101463660046104d1565b610281565b60405190151581526020016100f3565b6100e96101693660046104ea565b6102ff565b6003546101239063ffffffff1681565b60035463ffffffff166000908152600260205260409020546100e9565b6100e96101a93660046104d1565b60026020526000908152604090205481565b610123601e81565b6100e96101d13660046104d1565b60016020526000908152604090205481565b6100e97f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c81565b6102317f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100f3565b6100e96102573660046104d1565b60006020819052908152604090205481565b60035461012390640100000000900463ffffffff1681565b600081810361029257506000919050565b60035463ffffffff16805b63ffffffff811660009081526002602052604090205484036102c3575060019392505050565b8063ffffffff166000036102d55750601e5b806102df8161052b565b9150508163ffffffff168163ffffffff160361029d575060009392505050565b600060008051602061057e83398151915283106103635760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c6460448201526064015b60405180910390fd5b60008051602061057e83398151915282106103ca5760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b606482015260840161035a565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610419573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061043d9190610559565b909250905060008051602061057e83398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156104a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c69190610559565b509695505050505050565b6000602082840312156104e357600080fd5b5035919050565b6000806000606084860312156104ff57600080fd5b83356001600160a01b038116811461051657600080fd5b95602085013595506040909401359392505050565b600063ffffffff82168061054f57634e487b7160e01b600052601160045260246000fd5b6000190192915050565b6000806040838503121561056c57600080fd5b50508051602090910151909290915056fe30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001a2646970667358221220f11e23d9109ed5a17bac47fbd258c25bee376ed054e1d1f4c83e9dd46ebf2e1264736f6c634300081c003330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001";class mb extends Ya{constructor(...e){e.length>1?super(...e):super(ob,lb,e[0])}getDeployTransaction(e,t,a){return super.getDeployTransaction(e,t,a||{})}deploy(e,t,a){return super.deploy(e,t,a||{})}connect(e){return super.connect(e)}static bytecode=lb;static abi=ob;static createInterface(){return new ba(ob)}static connect(e,t){return new Wa(e,ob,t)}}var Tb=Object.freeze({__proto__:null,IHasher__factory:yb,MerkleTreeWithHistory__factory:mb});const gb=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"_totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"who",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transfer",outputs:[],stateMutability:"nonpayable",type:"function"}];class wb{static abi=gb;static createInterface(){return new ba(gb)}static connect(e,t){return new Wa(e,gb,t)}}const hb=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"_totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"who",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transfer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"}];class vb{static abi=hb;static createInterface(){return new ba(hb)}static connect(e,t){return new Wa(e,hb,t)}}var Mb=Object.freeze({__proto__:null,ERC20Basic__factory:wb,IUSDT__factory:vb});const _b=[{stateMutability:"nonpayable",type:"fallback"}],xb="0x6080604052348015600f57600080fd5b50609c80601d6000396000f3fe6080604052348015600f57600080fd5b5060405162461bcd60e51b815260206004820152602160248201527f7468697320636f6e747261637420646f6573206e6f74206163636570742045546044820152600960fb1b606482015260840160405180910390fdfea2646970667358221220e3ea6c7cc6115518097ca37048fbc2dbf908554443ac49cb9f0f128dbca7c44e64736f6c634300081c0033";class Ib extends Ya{constructor(...e){e.length>1?super(...e):super(_b,xb,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=xb;static abi=_b;static createInterface(){return new ba(_b)}static connect(e,t){return new Wa(e,_b,t)}}const Eb=[{inputs:[],name:"ECDSAInvalidSignature",type:"error"},{inputs:[{internalType:"uint256",name:"length",type:"uint256"}],name:"ECDSAInvalidSignatureLength",type:"error"},{inputs:[{internalType:"bytes32",name:"s",type:"bytes32"}],name:"ECDSAInvalidSignatureS",type:"error"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"allowance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientAllowance",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientBalance",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC20InvalidApprover",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC20InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC20InvalidSender",type:"error"},{inputs:[{internalType:"address",name:"spender",type:"address"}],name:"ERC20InvalidSpender",type:"error"},{inputs:[{internalType:"uint256",name:"deadline",type:"uint256"}],name:"ERC2612ExpiredSignature",type:"error"},{inputs:[{internalType:"address",name:"signer",type:"address"},{internalType:"address",name:"owner",type:"address"}],name:"ERC2612InvalidSigner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"currentNonce",type:"uint256"}],name:"InvalidAccountNonce",type:"error"},{inputs:[],name:"InvalidShortString",type:"error"},{inputs:[{internalType:"string",name:"str",type:"string"}],name:"StringTooLong",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[],name:"EIP712DomainChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"value",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"burnFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"eip712Domain",outputs:[{internalType:"bytes1",name:"fields",type:"bytes1"},{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"version",type:"string"},{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"address",name:"verifyingContract",type:"address"},{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"uint256[]",name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],Rb="0x61016060405234801561001157600080fd5b50604051806040016040528060078152602001664441494d6f636b60c81b81525080604051806040016040528060018152602001603160f81b815250604051806040016040528060078152602001664441494d6f636b60c81b815250604051806040016040528060048152602001634441494d60e01b8152508160039081610099919061027a565b5060046100a6828261027a565b506100b691508390506005610161565b610120526100c5816006610161565b61014052815160208084019190912060e052815190820120610100524660a05261015260e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60805250503060c052506103aa565b600060208351101561017d5761017683610194565b905061018e565b81610188848261027a565b5060ff90505b92915050565b600080829050601f815111156101c8578260405163305a27a960e01b81526004016101bf9190610338565b60405180910390fd5b80516101d382610386565b179392505050565b634e487b7160e01b600052604160045260246000fd5b600181811c9082168061020557607f821691505b60208210810361022557634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561027557806000526020600020601f840160051c810160208510156102525750805b601f840160051c820191505b81811015610272576000815560010161025e565b50505b505050565b81516001600160401b03811115610293576102936101db565b6102a7816102a184546101f1565b8461022b565b6020601f8211600181146102db57600083156102c35750848201515b600019600385901b1c1916600184901b178455610272565b600084815260208120601f198516915b8281101561030b57878501518255602094850194600190920191016102eb565b50848210156103295786840151600019600387901b60f8161c191681555b50505050600190811b01905550565b602081526000825180602084015260005b818110156103665760208186018101516040868401015201610349565b506000604082850101526040601f19601f83011684010191505092915050565b805160208083015191908110156102255760001960209190910360031b1b16919050565b60805160a05160c05160e05161010051610120516101405161101a6104046000396000610804015260006107d701526000610713015260006106eb01526000610646015260006106700152600061069a015261101a6000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c806370a082311161009757806395d89b411161006657806395d89b4114610214578063a9059cbb1461021c578063d505accf1461022f578063dd62ed3e1461024257600080fd5b806370a08231146101aa57806379cc6790146101d35780637ecebe00146101e657806384b0196e146101f957600080fd5b8063313ce567116100d3578063313ce5671461016b5780633644e5151461017a57806340c10f191461018257806342966c681461019757600080fd5b806306fdde0314610105578063095ea7b31461012357806318160ddd1461014657806323b872dd14610158575b600080fd5b61010d61027b565b60405161011a9190610d64565b60405180910390f35b610136610131366004610d9a565b61030d565b604051901515815260200161011a565b6002545b60405190815260200161011a565b610136610166366004610dc4565b610327565b6040516012815260200161011a565b61014a61034b565b610195610190366004610d9a565b61035a565b005b6101956101a5366004610e01565b610368565b61014a6101b8366004610e1a565b6001600160a01b031660009081526020819052604090205490565b6101956101e1366004610d9a565b610375565b61014a6101f4366004610e1a565b61038a565b6102016103a8565b60405161011a9796959493929190610e35565b61010d6103ee565b61013661022a366004610d9a565b6103fd565b61019561023d366004610ecd565b61040b565b61014a610250366004610f40565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60606003805461028a90610f73565b80601f01602080910402602001604051908101604052809291908181526020018280546102b690610f73565b80156103035780601f106102d857610100808354040283529160200191610303565b820191906000526020600020905b8154815290600101906020018083116102e657829003601f168201915b5050505050905090565b60003361031b81858561054a565b60019150505b92915050565b60003361033585828561055c565b6103408585856105da565b506001949350505050565b6000610355610639565b905090565b6103648282610764565b5050565b610372338261079a565b50565b61038082338361055c565b610364828261079a565b6001600160a01b038116600090815260076020526040812054610321565b6000606080600080600060606103bc6107d0565b6103c46107fd565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b60606004805461028a90610f73565b60003361031b8185856105da565b834211156104345760405163313c898160e11b8152600481018590526024015b60405180910390fd5b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886104818c6001600160a01b0316600090815260076020526040902080546001810190915590565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e00160405160208183030381529060405280519060200120905060006104dc8261082a565b905060006104ec82878787610857565b9050896001600160a01b0316816001600160a01b031614610533576040516325c0072360e11b81526001600160a01b0380831660048301528b16602482015260440161042b565b61053e8a8a8a61054a565b50505050505050505050565b6105578383836001610885565b505050565b6001600160a01b0383811660009081526001602090815260408083209386168352929052205460001981146105d457818110156105c557604051637dc7a0d960e11b81526001600160a01b0384166004820152602481018290526044810183905260640161042b565b6105d484848484036000610885565b50505050565b6001600160a01b03831661060457604051634b637e8f60e11b81526000600482015260240161042b565b6001600160a01b03821661062e5760405163ec442f0560e01b81526000600482015260240161042b565b61055783838361095a565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561069257507f000000000000000000000000000000000000000000000000000000000000000046145b156106bc57507f000000000000000000000000000000000000000000000000000000000000000090565b610355604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b6001600160a01b03821661078e5760405163ec442f0560e01b81526000600482015260240161042b565b6103646000838361095a565b6001600160a01b0382166107c457604051634b637e8f60e11b81526000600482015260240161042b565b6103648260008361095a565b60606103557f00000000000000000000000000000000000000000000000000000000000000006005610a84565b60606103557f00000000000000000000000000000000000000000000000000000000000000006006610a84565b6000610321610837610639565b8360405161190160f01b8152600281019290925260228201526042902090565b60008060008061086988888888610b2f565b9250925092506108798282610bfe565b50909695505050505050565b6001600160a01b0384166108af5760405163e602df0560e01b81526000600482015260240161042b565b6001600160a01b0383166108d957604051634a1406b160e11b81526000600482015260240161042b565b6001600160a01b03808516600090815260016020908152604080832093871683529290522082905580156105d457826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161094c91815260200190565b60405180910390a350505050565b6001600160a01b03831661098557806002600082825461097a9190610fad565b909155506109f79050565b6001600160a01b038316600090815260208190526040902054818110156109d85760405163391434e360e21b81526001600160a01b0385166004820152602481018290526044810183905260640161042b565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b038216610a1357600280548290039055610a32565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610a7791815260200190565b60405180910390a3505050565b606060ff8314610a9e57610a9783610cb7565b9050610321565b818054610aaa90610f73565b80601f0160208091040260200160405190810160405280929190818152602001828054610ad690610f73565b8015610b235780601f10610af857610100808354040283529160200191610b23565b820191906000526020600020905b815481529060010190602001808311610b0657829003601f168201915b50505050509050610321565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610b6a5750600091506003905082610bf4565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610bbe573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610bea57506000925060019150829050610bf4565b9250600091508190505b9450945094915050565b6000826003811115610c1257610c12610fce565b03610c1b575050565b6001826003811115610c2f57610c2f610fce565b03610c4d5760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115610c6157610c61610fce565b03610c825760405163fce698f760e01b81526004810182905260240161042b565b6003826003811115610c9657610c96610fce565b03610364576040516335e2f38360e21b81526004810182905260240161042b565b60606000610cc483610cf6565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b600060ff8216601f81111561032157604051632cd44ac360e21b815260040160405180910390fd5b6000815180845260005b81811015610d4457602081850181015186830182015201610d28565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000610d776020830184610d1e565b9392505050565b80356001600160a01b0381168114610d9557600080fd5b919050565b60008060408385031215610dad57600080fd5b610db683610d7e565b946020939093013593505050565b600080600060608486031215610dd957600080fd5b610de284610d7e565b9250610df060208501610d7e565b929592945050506040919091013590565b600060208284031215610e1357600080fd5b5035919050565b600060208284031215610e2c57600080fd5b610d7782610d7e565b60ff60f81b8816815260e060208201526000610e5460e0830189610d1e565b8281036040840152610e668189610d1e565b606084018890526001600160a01b038716608085015260a0840186905283810360c08501528451808252602080870193509091019060005b81811015610ebc578351835260209384019390920191600101610e9e565b50909b9a5050505050505050505050565b600080600080600080600060e0888a031215610ee857600080fd5b610ef188610d7e565b9650610eff60208901610d7e565b95506040880135945060608801359350608088013560ff81168114610f2357600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215610f5357600080fd5b610f5c83610d7e565b9150610f6a60208401610d7e565b90509250929050565b600181811c90821680610f8757607f821691505b602082108103610fa757634e487b7160e01b600052602260045260246000fd5b50919050565b8082018082111561032157634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fdfea2646970667358221220e576ea72175cad97303c16106a449691832d2c19ed98a87d7dad19549b0d754564736f6c634300081c0033";class Ob extends Ya{constructor(...e){e.length>1?super(...e):super(Eb,Rb,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=Rb;static abi=Eb;static createInterface(){return new ba(Eb)}static connect(e,t){return new Wa(e,Eb,t)}}const kb=[{inputs:[{internalType:"bytes",name:"_initCode",type:"bytes"},{internalType:"bytes32",name:"_salt",type:"bytes32"}],name:"deploy",outputs:[{internalType:"address payable",name:"createdContract",type:"address"}],stateMutability:"nonpayable",type:"function"}];let Pb=class{static abi=kb;static createInterface(){return new ba(kb)}static connect(e,t){return new Wa(e,kb,t)}};const Ab=[{inputs:[{internalType:"uint32",name:"_treeLevels",type:"uint32"},{internalType:"contract IHasher",name:"_hasher",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"FIELD_SIZE",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"ROOT_HISTORY_SIZE",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"ZERO_VALUE",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"currentRootIndex",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"filledSubtrees",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLastRoot",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IHasher",name:"_hasher",type:"address"},{internalType:"bytes32",name:"_left",type:"bytes32"},{internalType:"bytes32",name:"_right",type:"bytes32"}],name:"hashLeftRight",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"pure",type:"function"},{inputs:[],name:"hasher",outputs:[{internalType:"contract IHasher",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"_leaf",type:"bytes32"}],name:"insert",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"_root",type:"bytes32"}],name:"isKnownRoot",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"levels",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"nextIndex",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"roots",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"zeros",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"}],Cb="0x60c0604052600380546001600160401b031916905534801561002057600080fd5b50604051610e43380380610e4383398101604081905261003f91610389565b818160008263ffffffff16116100a85760405162461bcd60e51b815260206004820152602360248201527f5f6c6576656c732073686f756c642062652067726561746572207468616e207a60448201526265726f60e81b60648201526084015b60405180910390fd5b60208263ffffffff16106100fe5760405162461bcd60e51b815260206004820152601e60248201527f5f6c6576656c732073686f756c64206265206c657373207468616e2033320000604482015260640161009f565b63ffffffff821660a0526001600160a01b0381166080527f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c60005b8363ffffffff168163ffffffff1610156101865763ffffffff8116600090815260016020908152604080832085905590829052902082905561017c8383806101bc565b9150600101610139565b506000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b55506103fc92505050565b6000600080516020610e23833981519152831061021b5760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c64604482015260640161009f565b600080516020610e2383398151915282106102825760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b606482015260840161009f565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156102d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f591906103d8565b9092509050600080516020610e2383398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa15801561035a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061037e91906103d8565b509695505050505050565b6000806040838503121561039c57600080fd5b825163ffffffff811681146103b057600080fd5b60208401519092506001600160a01b03811681146103cd57600080fd5b809150509250929050565b600080604083850312156103eb57600080fd5b505080516020909101519092909150565b60805160a0516109ed610436600039600081816101310152818161052701526105c901526000818161023f015261066101526109ed6000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063c2b40ae41161008c578063ec73295911610066578063ec73295914610213578063ed33639f1461023a578063f178e47c14610279578063fc7e9c6f1461029957600080fd5b8063c2b40ae4146101cb578063cd87a3b4146101eb578063e8295588146101f357600080fd5b80636d9833e3116100c85780636d9833e3146101685780638ea3099e1461018b57806390eeb02b1461019e578063ba70f757146101ae57600080fd5b80632d287e43146100ef578063414a37ba146101045780634ecf518b1461012c575b600080fd5b6101026100fd36600461072c565b6102b1565b005b61011960008051602061099883398151915281565b6040519081526020015b60405180910390f35b6101537f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff9091168152602001610123565b61017b61017636600461072c565b6102be565b6040519015158152602001610123565b610119610199366004610745565b61033c565b6003546101539063ffffffff1681565b60035463ffffffff16600090815260026020526040902054610119565b6101196101d936600461072c565b60026020526000908152604090205481565b610153601e81565b61011961020136600461072c565b60016020526000908152604090205481565b6101197f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c81565b6102617f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610123565b61011961028736600461072c565b60006020819052908152604090205481565b60035461015390640100000000900463ffffffff1681565b6102ba8161050e565b5050565b60008181036102cf57506000919050565b60035463ffffffff16805b63ffffffff81166000908152600260205260409020548403610300575060019392505050565b8063ffffffff166000036103125750601e5b8061031c8161079c565b9150508163ffffffff168163ffffffff16036102da575060009392505050565b600060008051602061099883398151915283106103a05760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c6460448201526064015b60405180910390fd5b60008051602061099883398151915282106104075760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b6064820152608401610397565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610456573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047a91906107bc565b909250905060008051602061099883398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156104df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050391906107bc565b509695505050505050565b600354600090640100000000900463ffffffff1661054d7f0000000000000000000000000000000000000000000000000000000000000000600261090c565b63ffffffff168163ffffffff16036105c05760405162461bcd60e51b815260206004820152603060248201527f4d65726b6c6520747265652069732066756c6c2e204e6f206d6f7265206c656160448201526f1d995cc818d85b88189948185919195960821b6064820152608401610397565b8083600080805b7f000000000000000000000000000000000000000000000000000000000000000063ffffffff168163ffffffff16101561069e5761060660028661092b565b63ffffffff166000036106405763ffffffff811660009081526001602090815260408083205491839052909120859055849350915061065c565b63ffffffff811660009081526020819052604090205492508391505b6106877f0000000000000000000000000000000000000000000000000000000000000000848461033c565b9350610694600286610953565b94506001016105c7565b50600354600090601e906106b99063ffffffff16600161097b565b6106c3919061092b565b6003805463ffffffff191663ffffffff8316908117909155600090815260026020526040902085905590506106f986600161097b565b6003805463ffffffff929092166401000000000267ffffffff000000001990921691909117905550939695505050505050565b60006020828403121561073e57600080fd5b5035919050565b60008060006060848603121561075a57600080fd5b83356001600160a01b038116811461077157600080fd5b95602085013595506040909401359392505050565b634e487b7160e01b600052601160045260246000fd5b600063ffffffff8216806107b2576107b2610786565b6000190192915050565b600080604083850312156107cf57600080fd5b505080516020909101519092909150565b634e487b7160e01b600052601260045260246000fd5b6001815b60018411156108315780850481111561081557610815610786565b600184161561082357908102905b60019390931c9280026107fa565b935093915050565b60008261084857506001610906565b8161085557506000610906565b816001811461086b5760028114610875576108a6565b6001915050610906565b60ff84111561088657610886610786565b6001841b915063ffffffff8211156108a0576108a0610786565b50610906565b5060208310610133831016604e8410600b84101617156108dd575081810a63ffffffff8111156108d8576108d8610786565b610906565b6108ec63ffffffff84846107f6565b8063ffffffff0482111561090257610902610786565b0290505b92915050565b600061092463ffffffff841663ffffffff8416610839565b9392505050565b600063ffffffff831680610941576109416107e0565b8063ffffffff84160691505092915050565b600063ffffffff831680610969576109696107e0565b8063ffffffff84160491505092915050565b63ffffffff81811683821601908111156109065761090661078656fe30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001a2646970667358221220d4af2da17834eee5c4dc18614acb3b0fdfdd29ac766eb65a8d0826d4773a4afb64736f6c634300081c003330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001";class Sb extends Ya{constructor(...e){e.length>1?super(...e):super(Ab,Cb,e[0])}getDeployTransaction(e,t,a){return super.getDeployTransaction(e,t,a||{})}deploy(e,t,a){return super.deploy(e,t,a||{})}connect(e){return super.connect(e)}static bytecode=Cb;static abi=Ab;static createInterface(){return new ba(Ab)}static connect(e,t){return new Wa(e,Ab,t)}}const Nb=[{inputs:[{internalType:"uint256",name:"_denomination",type:"uint256"},{internalType:"address",name:"_token",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"commitment",type:"bytes32"},{indexed:!1,internalType:"address",name:"owner",type:"address"}],name:"VerifiedCommitment",type:"event"},{inputs:[],name:"COMMITMENT_TYPE",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[],name:"COMMITMENT_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"WITNESS_TYPE_STRING",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"denomination",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"permit2",outputs:[{internalType:"contract ISignatureTransfer",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"bytes32[]",name:"_commitments",type:"bytes32[]"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"bytes",name:"_signature",type:"bytes"}],name:"permit2Commitments",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"bytes",name:"_signature",type:"bytes"}],name:"permit2Test",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"verifiedCommitments",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"instance",type:"address"},{internalType:"bytes32",name:"commitmentsHash",type:"bytes32"}],internalType:"struct Permit2Mock.PermitCommitments",name:"permitData",type:"tuple"}],name:"witness",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"pure",type:"function"}],Db="0x6080604052348015600f57600080fd5b50604051610bb1380380610bb1833981016040819052602c916055565b600091909155600180546001600160a01b0319166001600160a01b039092169190911790556090565b60008060408385031215606757600080fd5b825160208401519092506001600160a01b0381168114608557600080fd5b809150509250929050565b610b128061009f6000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c80638bca6d16116100665780638bca6d161461011e5780639e67ab1e14610127578063c58b4c4914610150578063f15ea35914610163578063fc0c546a1461017657600080fd5b806303ac0673146100a357806304f03273146100b857806312261ee7146100d3578063156e2152146101015780637e89f31f14610116575b600080fd5b6100b66100b13660046105ec565b610189565b005b6100c0610243565b6040519081526020015b60405180910390f35b6100e96e22d473030f116ddee9f6b43ac78ba381565b6040516001600160a01b0390911681526020016100ca565b610109610266565b6040516100ca91906106a4565b6101096102a1565b6100c060005481565b6100e96101353660046106be565b6002602052600090815260409020546001600160a01b031681565b6100c061015e36600461071e565b6102bd565b6100b6610171366004610776565b61032a565b6001546100e9906001600160a01b031681565b6040805160a0810182526001546001600160a01b0316606082019081526000546080830181905290825260208083018890528284018790528351808501855230815290810191909152915163187945bd60e11b81526e22d473030f116ddee9f6b43ac78ba3926330f28b7a9261020a929091908a90889088906004016108dc565b600060405180830381600087803b15801561022457600080fd5b505af1158015610238573d6000803e3d6000fd5b505050505050505050565b6040518060600160405280603b8152602001610aa2603b91398051906020012081565b6040518060600160405280603b8152602001610aa2603b913960405160200161028f9190610934565b60405160208183030381529060405281565b6040518060600160405280603b8152602001610aa2603b913981565b60006040518060600160405280603b8152602001610aa2603b9139805160209182012083518483015160405161030d94019283526001600160a01b03919091166020830152604082015260600190565b604051602081830303815290604052805190602001209050919050565b6000855160005461033b91906109b7565b905060008660405160200161035091906109e2565b60408051601f19818403018152828252805160209182012060a0840183526001546001600160a01b0316606085019081526080850187905284528382018a905283830189905282518084018452308082528184018890528451808601909552845291830181905293506e22d473030f116ddee9f6b43ac78ba39263137c29fe929091908c906103de906102bd565b6040518060600160405280603b8152602001610aa2603b91396040516020016104079190610934565b6040516020818303038152906040528a8a6040518863ffffffff1660e01b815260040161043a9796959493929190610a18565b600060405180830381600087803b15801561045457600080fd5b505af1158015610468573d6000803e3d6000fd5b505050506104768789610480565b5050505050505050565b60005b82518110156105825760008382815181106104a0576104a0610a8b565b602090810291909101810151600081815260029092526040909120549091506001600160a01b0316156105195760405162461bcd60e51b815260206004820181905260248201527f54686520636f6d6d69746d656e7420686173206265656e207665726966696564604482015260640160405180910390fd5b60008181526002602090815260409182902080546001600160a01b0319166001600160a01b038716908117909155915191825282917fa9b0993cd360203065cdbc30dd334b2a3eb63115cbb64d73246109d8af75a5f9910160405180910390a250600101610483565b505050565b80356001600160a01b038116811461059e57600080fd5b919050565b60008083601f8401126105b557600080fd5b50813567ffffffffffffffff8111156105cd57600080fd5b6020830191508360208285010111156105e557600080fd5b9250929050565b60008060008060006080868803121561060457600080fd5b61060d86610587565b94506020860135935060408601359250606086013567ffffffffffffffff81111561063757600080fd5b610643888289016105a3565b969995985093965092949392505050565b60005b8381101561066f578181015183820152602001610657565b50506000910152565b60008151808452610690816020860160208601610654565b601f01601f19169290920160200192915050565b6020815260006106b76020830184610678565b9392505050565b6000602082840312156106d057600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610716576107166106d7565b604052919050565b6000604082840312801561073157600080fd5b506040805190810167ffffffffffffffff81118282101715610755576107556106d7565b60405261076183610587565b81526020928301359281019290925250919050565b60008060008060008060a0878903121561078f57600080fd5b61079887610587565b9550602087013567ffffffffffffffff8111156107b457600080fd5b8701601f810189136107c557600080fd5b803567ffffffffffffffff8111156107df576107df6106d7565b8060051b6107ef602082016106ed565b9182526020818401810192908101908c84111561080b57600080fd5b6020850194505b8385101561083157843580835260209586019590935090910190610812565b9850505050604088013594505060608701359250608087013567ffffffffffffffff81111561085f57600080fd5b61086b89828a016105a3565b979a9699509497509295939492505050565b61089b82825180516001600160a01b03168252602090810151910152565b60208101516040830152604081015160608301525050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6108e6818761087d565b84516001600160a01b03166080820152602085015160a08201526001600160a01b03841660c082015261010060e0820181905260009061092990830184866108b3565b979650505050505050565b7f5065726d6974436f6d6d69746d656e7473207769746e6573732900000000000081526000825161096c81601a850160208701610654565b7f546f6b656e5065726d697373696f6e73286164647265737320746f6b656e2c75601a9390910192830152506d696e7432353620616d6f756e742960901b603a820152604801919050565b80820281158282048414176109dc57634e487b7160e01b600052601160045260246000fd5b92915050565b8151600090829060208501835b82811015610a0d5781518452602093840193909101906001016109ef565b509195945050505050565b610a22818961087d565b86516001600160a01b03166080820152602087015160a082015260018060a01b03861660c08201528460e08201526101406101008201526000610a69610140830186610678565b828103610120840152610a7d8185876108b3565b9a9950505050505050505050565b634e487b7160e01b600052603260045260246000fdfe5065726d6974436f6d6d69746d656e7473286164647265737320696e7374616e63652c6279746573333220636f6d6d69746d656e74734861736829a26469706673582212206a6ecdc893f53628220fd48e8b32741c8e8a1c0862bc81e1d55feb14bef95f1764736f6c634300081c0033";class Ub extends Ya{constructor(...e){e.length>1?super(...e):super(Nb,Db,e[0])}getDeployTransaction(e,t,a){return super.getDeployTransaction(e,t,a||{})}deploy(e,t,a){return super.deploy(e,t,a||{})}connect(e){return super.connect(e)}static bytecode=Db;static abi=Nb;static createInterface(){return new ba(Nb)}static connect(e,t){return new Wa(e,Nb,t)}}var Vb=Object.freeze({__proto__:null,BadRecipient__factory:Ib,ERC20Mock__factory:Ob,IDeployer__factory:Pb,MerkleTreeWithHistoryMock__factory:Sb,Permit2Mock__factory:Ub,iusdtSol:Mb});const Fb=[{inputs:[{internalType:"bytes",name:"_proof",type:"bytes"},{internalType:"uint256[6]",name:"_input",type:"uint256[6]"}],name:"verifyProof",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}];class Lb{static abi=Fb;static createInterface(){return new ba(Fb)}static connect(e,t){return new Wa(e,Fb,t)}}const Gb=[{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"commitment",type:"bytes32"},{indexed:!1,internalType:"uint32",name:"leafIndex",type:"uint32"},{indexed:!1,internalType:"uint256",name:"timestamp",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"bytes32",name:"nullifierHash",type:"bytes32"},{indexed:!0,internalType:"address",name:"relayer",type:"address"},{indexed:!1,internalType:"uint256",name:"fee",type:"uint256"}],name:"Withdrawal",type:"event"},{inputs:[],name:"FIELD_SIZE",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"ROOT_HISTORY_SIZE",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"ZERO_VALUE",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"commitments",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"currentRootIndex",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"denomination",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"_commitment",type:"bytes32"}],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"filledSubtrees",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLastRoot",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IHasher",name:"_hasher",type:"address"},{internalType:"bytes32",name:"_left",type:"bytes32"},{internalType:"bytes32",name:"_right",type:"bytes32"}],name:"hashLeftRight",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"pure",type:"function"},{inputs:[],name:"hasher",outputs:[{internalType:"contract IHasher",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"_root",type:"bytes32"}],name:"isKnownRoot",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"_nullifierHash",type:"bytes32"}],name:"isSpent",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32[]",name:"_nullifierHashes",type:"bytes32[]"}],name:"isSpentArray",outputs:[{internalType:"bool[]",name:"spent",type:"bool[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"levels",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"nextIndex",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"nullifierHashes",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"roots",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"verifier",outputs:[{internalType:"contract IVerifier",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"_proof",type:"bytes"},{internalType:"bytes32",name:"_root",type:"bytes32"},{internalType:"bytes32",name:"_nullifierHash",type:"bytes32"},{internalType:"address payable",name:"_recipient",type:"address"},{internalType:"address payable",name:"_relayer",type:"address"},{internalType:"uint256",name:"_fee",type:"uint256"},{internalType:"uint256",name:"_refund",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"zeros",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"}];class Bb{static abi=Gb;static createInterface(){return new ba(Gb)}static connect(e,t){return new Wa(e,Gb,t)}}var jb=Object.freeze({__proto__:null,IVerifier__factory:Lb,Tornado__factory:Bb});const Hb=[{inputs:[],name:"denomination",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"commitment",type:"bytes32"}],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"proof",type:"bytes"},{internalType:"bytes32",name:"root",type:"bytes32"},{internalType:"bytes32",name:"nullifierHash",type:"bytes32"},{internalType:"address payable",name:"recipient",type:"address"},{internalType:"address payable",name:"relayer",type:"address"},{internalType:"uint256",name:"fee",type:"uint256"},{internalType:"uint256",name:"refund",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"payable",type:"function"}];let zb=class{static abi=Hb;static createInterface(){return new ba(Hb)}static connect(e,t){return new Wa(e,Hb,t)}};const Wb=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"bytes",name:"encryptedNote",type:"bytes"}],name:"EncryptedNote",type:"event"},{inputs:[{internalType:"bytes[]",name:"_encryptedNotes",type:"bytes[]"}],name:"backupNotes",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract ITornadoInstance",name:"_tornado",type:"address"},{internalType:"bytes32",name:"_commitment",type:"bytes32"},{internalType:"bytes",name:"_encryptedNote",type:"bytes"}],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"contract ITornadoInstance",name:"_tornado",type:"address"},{internalType:"bytes",name:"_proof",type:"bytes"},{internalType:"bytes32",name:"_root",type:"bytes32"},{internalType:"bytes32",name:"_nullifierHash",type:"bytes32"},{internalType:"address payable",name:"_recipient",type:"address"},{internalType:"address payable",name:"_relayer",type:"address"},{internalType:"uint256",name:"_fee",type:"uint256"},{internalType:"uint256",name:"_refund",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"payable",type:"function"}],$b="0x608060405234801561001057600080fd5b506104f6806100206000396000f3fe6080604052600436106100345760003560e01c806313d98d13146100395780636485ba2a1461004e578063b438689f1461006e575b600080fd5b61004c6100473660046102c7565b610081565b005b34801561005a57600080fd5b5061004c610069366004610258565b61012a565b61004c61007c366004610321565b610198565b60405163b214faa560e01b81526001600160a01b0385169063b214faa59034906100af9087906004016103ec565b6000604051808303818588803b1580156100c857600080fd5b505af11580156100dc573d6000803e3d6000fd5b5050505050336001600160a01b03167ffa28df43db3553771f7209dcef046f3bdfea15870ab625dcda30ac58b82b4008838360405161011c9291906103f5565b60405180910390a250505050565b60005b8181101561019357337ffa28df43db3553771f7209dcef046f3bdfea15870ab625dcda30ac58b82b400884848481811061016357fe5b90506020028101906101759190610463565b6040516101839291906103f5565b60405180910390a260010161012d565b505050565b6040516310d056db60e11b81526001600160a01b038a16906321a0adb69034906101d4908c908c908c908c908c908c908c908c90600401610411565b6000604051808303818588803b1580156101ed57600080fd5b505af1158015610201573d6000803e3d6000fd5b5050505050505050505050505050565b60008083601f840112610222578182fd5b50813567ffffffffffffffff811115610239578182fd5b60208301915083602082850101111561025157600080fd5b9250929050565b6000806020838503121561026a578182fd5b823567ffffffffffffffff80821115610281578384fd5b818501915085601f830112610294578384fd5b8135818111156102a2578485fd5b86602080830285010111156102b5578485fd5b60209290920196919550909350505050565b600080600080606085870312156102dc578182fd5b84356102e7816104a8565b935060208501359250604085013567ffffffffffffffff811115610309578283fd5b61031587828801610211565b95989497509550505050565b60008060008060008060008060006101008a8c03121561033f578485fd5b893561034a816104a8565b985060208a013567ffffffffffffffff811115610365578586fd5b6103718c828d01610211565b90995097505060408a0135955060608a0135945060808a0135610393816104a8565b935060a08a01356103a3816104a8565b8093505060c08a0135915060e08a013590509295985092959850929598565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b90815260200190565b6000602082526104096020830184866103c2565b949350505050565b600060e0825261042560e083018a8c6103c2565b60208301989098525060408101959095526001600160a01b03938416606086015291909216608084015260a083019190915260c09091015292915050565b6000808335601e19843603018112610479578283fd5b83018035915067ffffffffffffffff821115610493578283fd5b60200191503681900382131561025157600080fd5b6001600160a01b03811681146104bd57600080fd5b5056fea2646970667358221220a833625c5e7cc02dff95b380fd1e6d47b08cffea90c70cfe6739960deee47b8364736f6c634300060c0033";class Xb extends Ya{constructor(...e){e.length>1?super(...e):super(Wb,$b,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=$b;static abi=Wb;static createInterface(){return new ba(Wb)}static connect(e,t){return new Wa(e,Wb,t)}}var qb=Object.freeze({__proto__:null,ITornadoInstance__factory:zb,TornadoProxyLight__factory:Xb});const Jb=[{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],Yb=[{inputs:[{internalType:"uint256",name:"maxAmount",type:"uint256"}],name:"InvalidAmount",type:"error"},{inputs:[],name:"LengthMismatch",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!1,internalType:"uint256",name:"word",type:"uint256"},{indexed:!1,internalType:"uint256",name:"mask",type:"uint256"}],name:"UnorderedNonceInvalidation",type:"event"},{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"wordPos",type:"uint256"},{internalType:"uint256",name:"mask",type:"uint256"}],name:"invalidateUnorderedNonces",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],name:"nonceBitmap",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],internalType:"struct ISignatureTransfer.TokenPermissions",name:"permitted",type:"tuple"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"}],internalType:"struct ISignatureTransfer.PermitTransferFrom",name:"permit",type:"tuple"},{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"requestedAmount",type:"uint256"}],internalType:"struct ISignatureTransfer.SignatureTransferDetails",name:"transferDetails",type:"tuple"},{internalType:"address",name:"owner",type:"address"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"permitTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],internalType:"struct ISignatureTransfer.TokenPermissions[]",name:"permitted",type:"tuple[]"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"}],internalType:"struct ISignatureTransfer.PermitBatchTransferFrom",name:"permit",type:"tuple"},{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"requestedAmount",type:"uint256"}],internalType:"struct ISignatureTransfer.SignatureTransferDetails[]",name:"transferDetails",type:"tuple[]"},{internalType:"address",name:"owner",type:"address"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"permitTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],internalType:"struct ISignatureTransfer.TokenPermissions",name:"permitted",type:"tuple"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"}],internalType:"struct ISignatureTransfer.PermitTransferFrom",name:"permit",type:"tuple"},{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"requestedAmount",type:"uint256"}],internalType:"struct ISignatureTransfer.SignatureTransferDetails",name:"transferDetails",type:"tuple"},{internalType:"address",name:"owner",type:"address"},{internalType:"bytes32",name:"witness",type:"bytes32"},{internalType:"string",name:"witnessTypeString",type:"string"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"permitWitnessTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],internalType:"struct ISignatureTransfer.TokenPermissions[]",name:"permitted",type:"tuple[]"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"}],internalType:"struct ISignatureTransfer.PermitBatchTransferFrom",name:"permit",type:"tuple"},{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"requestedAmount",type:"uint256"}],internalType:"struct ISignatureTransfer.SignatureTransferDetails[]",name:"transferDetails",type:"tuple[]"},{internalType:"address",name:"owner",type:"address"},{internalType:"bytes32",name:"witness",type:"bytes32"},{internalType:"string",name:"witnessTypeString",type:"string"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"permitWitnessTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"}];class Kb{static abi=Yb;static createInterface(){return new ba(Yb)}static connect(e,t){return new Wa(e,Yb,t)}}var Zb=Object.freeze({__proto__:null,IERC20__factory:class{static abi=Jb;static createInterface(){return new ba(Jb)}static connect(e,t){return new Wa(e,Jb,t)}},ISignatureTransfer__factory:Kb});const Qb=[{inputs:[{internalType:"contract IVerifier",name:"_verifier",type:"address"},{internalType:"contract IHasher",name:"_hasher",type:"address"},{internalType:"uint256",name:"_denomination",type:"uint256"},{internalType:"uint32",name:"_merkleTreeHeight",type:"uint32"},{internalType:"contract IERC20",name:"_token",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"commitment",type:"bytes32"},{indexed:!1,internalType:"uint32",name:"leafIndex",type:"uint32"},{indexed:!1,internalType:"uint256",name:"timestamp",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"bytes32",name:"nullifierHash",type:"bytes32"},{indexed:!0,internalType:"address",name:"relayer",type:"address"},{indexed:!1,internalType:"uint256",name:"fee",type:"uint256"}],name:"Withdrawal",type:"event"},{inputs:[],name:"FIELD_SIZE",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"ROOT_HISTORY_SIZE",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"ZERO_VALUE",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"commitments",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"currentRootIndex",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"denomination",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"_commitment",type:"bytes32"}],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"filledSubtrees",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLastRoot",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IHasher",name:"_hasher",type:"address"},{internalType:"bytes32",name:"_left",type:"bytes32"},{internalType:"bytes32",name:"_right",type:"bytes32"}],name:"hashLeftRight",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"pure",type:"function"},{inputs:[],name:"hasher",outputs:[{internalType:"contract IHasher",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"_root",type:"bytes32"}],name:"isKnownRoot",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"_nullifierHash",type:"bytes32"}],name:"isSpent",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32[]",name:"_nullifierHashes",type:"bytes32[]"}],name:"isSpentArray",outputs:[{internalType:"bool[]",name:"spent",type:"bool[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"levels",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"nextIndex",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"nullifierHashes",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"roots",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"contract IERC20",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"verifier",outputs:[{internalType:"contract IVerifier",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"_proof",type:"bytes"},{internalType:"bytes32",name:"_root",type:"bytes32"},{internalType:"bytes32",name:"_nullifierHash",type:"bytes32"},{internalType:"address payable",name:"_recipient",type:"address"},{internalType:"address payable",name:"_relayer",type:"address"},{internalType:"uint256",name:"_fee",type:"uint256"},{internalType:"uint256",name:"_refund",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"zeros",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"}],ef="0x610120604052600380546001600160401b031916905534801561002157600080fd5b50604051611dc5380380611dc583398101604081905261004091610420565b84848484808360008263ffffffff16116100ad5760405162461bcd60e51b815260206004820152602360248201527f5f6c6576656c732073686f756c642062652067726561746572207468616e207a60448201526265726f60e81b60648201526084015b60405180910390fd5b60208263ffffffff16106101035760405162461bcd60e51b815260206004820152601e60248201527f5f6c6576656c732073686f756c64206265206c657373207468616e203332000060448201526064016100a4565b63ffffffff821660a0526001600160a01b0381166080527f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c60005b8363ffffffff168163ffffffff16101561018b5763ffffffff8116600090815260016020908152604080832085905590829052902082905561018183838061023b565b915060010161013e565b506000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b5550506001600455816102195760405162461bcd60e51b815260206004820152602560248201527f64656e6f6d696e6174696f6e2073686f756c6420626520677265617465722074604482015264068616e20360dc1b60648201526084016100a4565b506001600160a01b0392831660c05260e052501661010052506104b892505050565b6000600080516020611da5833981519152831061029a5760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c6460448201526064016100a4565b600080516020611da583398151915282106103015760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b60648201526084016100a4565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610350573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103749190610494565b9092509050600080516020611da583398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156103d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103fd9190610494565b509695505050505050565b6001600160a01b038116811461041d57600080fd5b50565b600080600080600060a0868803121561043857600080fd5b855161044381610408565b602087015190955061045481610408565b60408701516060880151919550935063ffffffff8116811461047557600080fd5b608087015190925061048681610408565b809150509295509295909350565b600080604083850312156104a757600080fd5b505080516020909101519092909150565b60805160a05160c05160e05161010051611863610542600039600081816104ca01528181610cfa01528181610d34015261108e0152600081816102bb0152818161056f01528181610ccc01526110b20152600081816101a601526106d801526000818161022201528181610e150152610eb70152600081816104690152610f4f01526118636000f3fe6080604052600436106101355760003560e01c8063b214faa5116100ab578063e82955881161006f578063e8295588146103f6578063ec73295914610423578063ed33639f14610457578063f178e47c1461048b578063fc0c546a146104b8578063fc7e9c6f146104ec57600080fd5b8063b214faa514610347578063ba70f7571461035a578063c2b40ae414610384578063cd87a3b4146103b1578063e5285dcc146103c657600080fd5b80636d9833e3116100fd5780636d9833e314610259578063839df945146102795780638bca6d16146102a95780638ea3099e146102dd57806390eeb02b146102fd5780639fa12d0b1461031a57600080fd5b806317cc915c1461013a57806321a0adb61461017f5780632b7ac3f314610194578063414a37ba146101e05780634ecf518b14610210575b600080fd5b34801561014657600080fd5b5061016a61015536600461131d565b60056020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b61019261018d36600461135e565b610511565b005b3480156101a057600080fd5b506101c87f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610176565b3480156101ec57600080fd5b5061020260008051602061180e83398151915281565b604051908152602001610176565b34801561021c57600080fd5b506102447f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff9091168152602001610176565b34801561026557600080fd5b5061016a61027436600461131d565b61081c565b34801561028557600080fd5b5061016a61029436600461131d565b60066020526000908152604090205460ff1681565b3480156102b557600080fd5b506102027f000000000000000000000000000000000000000000000000000000000000000081565b3480156102e957600080fd5b506102026102f8366004611417565b61089a565b34801561030957600080fd5b506003546102449063ffffffff1681565b34801561032657600080fd5b5061033a61033536600461144c565b610a67565b60405161017691906114c3565b61019261035536600461131d565b610b23565b34801561036657600080fd5b5060035463ffffffff16600090815260026020526040902054610202565b34801561039057600080fd5b5061020261039f36600461131d565b60026020526000908152604090205481565b3480156103bd57600080fd5b50610244601e81565b3480156103d257600080fd5b5061016a6103e136600461131d565b60009081526005602052604090205460ff1690565b34801561040257600080fd5b5061020261041136600461131d565b60016020526000908152604090205481565b34801561042f57600080fd5b506102027f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c81565b34801561046357600080fd5b506101c87f000000000000000000000000000000000000000000000000000000000000000081565b34801561049757600080fd5b506102026104a636600461131d565b60006020819052908152604090205481565b3480156104c457600080fd5b506101c87f000000000000000000000000000000000000000000000000000000000000000081565b3480156104f857600080fd5b5060035461024490640100000000900463ffffffff1681565b6002600454036105685760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60026004557f00000000000000000000000000000000000000000000000000000000000000008211156105dd5760405162461bcd60e51b815260206004820152601a60248201527f4665652065786365656473207472616e736665722076616c7565000000000000604482015260640161055f565b60008581526005602052604090205460ff161561063c5760405162461bcd60e51b815260206004820152601f60248201527f546865206e6f746520686173206265656e20616c7265616479207370656e7400604482015260640161055f565b6106458661081c565b6106915760405162461bcd60e51b815260206004820152601c60248201527f43616e6e6f742066696e6420796f7572206d65726b6c6520726f6f7400000000604482015260640161055f565b6040805160c081018252878152602081018790526001600160a01b038681168284015285811660608301526080820185905260a08201849052915163695ef6f960e01b81527f00000000000000000000000000000000000000000000000000000000000000009092169163695ef6f991610711918c918c91600401611508565b6020604051808303816000875af1158015610730573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107549190611568565b6107995760405162461bcd60e51b815260206004820152601660248201527524b73b30b634b2103bb4ba34323930bb90383937b7b360511b604482015260640161055f565b6000858152600560205260409020805460ff191660011790556107be84848484610c5a565b604080516001600160a01b03868116825260208201889052918101849052908416907fe9e508bad6d4c3227e881ca19068f099da81b5164dd6d62b2eaf1e8bc6c349319060600160405180910390a250506001600455505050505050565b600081810361082d57506000919050565b60035463ffffffff16805b63ffffffff8116600090815260026020526040902054840361085e575060019392505050565b8063ffffffff166000036108705750601e5b8061087a816115a7565b9150508163ffffffff168163ffffffff1603610838575060009392505050565b600060008051602061180e83398151915283106108f95760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c64604482015260640161055f565b60008051602061180e83398151915282106109605760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b606482015260840161055f565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156109af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d391906115c7565b909250905060008051602061180e83398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610a38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5c91906115c7565b509695505050505050565b60608167ffffffffffffffff811115610a8257610a82611601565b604051908082528060200260200182016040528015610aab578160200160208202803683370190505b50905060005b82811015610b1c57610aea848483818110610ace57610ace611617565b9050602002013560009081526005602052604090205460ff1690565b15610b14576001828281518110610b0357610b03611617565b911515602092830291909101909101525b600101610ab1565b5092915050565b600260045403610b755760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161055f565b600260045560008181526006602052604090205460ff1615610be35760405162461bcd60e51b815260206004820152602160248201527f54686520636f6d6d69746d656e7420686173206265656e207375626d697474656044820152601960fa1b606482015260840161055f565b6000610bee82610dfc565b6000838152600660205260409020805460ff191660011790559050610c1161101a565b6040805163ffffffff8316815242602082015283917fa945e51eec50ab98c161376f0db4cf2aeba3ec92755fe2fcd388bdbbb80ff196910160405180910390a250506001600455565b803414610cc25760405162461bcd60e51b815260206004820152603060248201527f496e636f727265637420726566756e6420616d6f756e7420726563656976656460448201526f08189e481d1a194818dbdb9d1c9858dd60821b606482015260840161055f565b610d2184610cf0847f000000000000000000000000000000000000000000000000000000000000000061162d565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691906110d8565b8115610d5b57610d5b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001684846110d8565b8015610df6576000846001600160a01b03168260405160006040518083038185875af1925050503d8060008114610dae576040519150601f19603f3d011682016040523d82523d6000602084013e610db3565b606091505b5050905080610df4576040516001600160a01b0385169083156108fc029084906000818181858888f19350505050158015610df2573d6000803e3d6000fd5b505b505b50505050565b600354600090640100000000900463ffffffff16610e3b7f0000000000000000000000000000000000000000000000000000000000000000600261175a565b63ffffffff168163ffffffff1603610eae5760405162461bcd60e51b815260206004820152603060248201527f4d65726b6c6520747265652069732066756c6c2e204e6f206d6f7265206c656160448201526f1d995cc818d85b88189948185919195960821b606482015260840161055f565b8083600080805b7f000000000000000000000000000000000000000000000000000000000000000063ffffffff168163ffffffff161015610f8c57610ef4600286611772565b63ffffffff16600003610f2e5763ffffffff8116600090815260016020908152604080832054918390529091208590558493509150610f4a565b63ffffffff811660009081526020819052604090205492508391505b610f757f0000000000000000000000000000000000000000000000000000000000000000848461089a565b9350610f8260028661179a565b9450600101610eb5565b50600354600090601e90610fa79063ffffffff1660016117c2565b610fb19190611772565b6003805463ffffffff191663ffffffff831690811790915560009081526002602052604090208590559050610fe78660016117c2565b6003805463ffffffff929092166401000000000267ffffffff000000001990921691909117905550939695505050505050565b34156110815760405162461bcd60e51b815260206004820152603060248201527f4554482076616c756520697320737570706f73656420746f206265203020666f60448201526f7220455243323020696e7374616e636560801b606482015260840161055f565b6110d66001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633307f00000000000000000000000000000000000000000000000000000000000000006111f1565b565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b179052915160009283929087169161113491906117de565b6000604051808303816000865af19150503d8060008114611171576040519150601f19603f3d011682016040523d82523d6000602084013e611176565b606091505b50915091508161118857805181602001fd5b805115806111a55750808060200190518101906111a59190611568565b610df45760405162461bcd60e51b815260206004820152601e60248201527f5361666545524332303a20736166655472616e73666572206661696c65640000604482015260640161055f565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b179052915160009283929088169161125591906117de565b6000604051808303816000865af19150503d8060008114611292576040519150601f19603f3d011682016040523d82523d6000602084013e611297565b606091505b5091509150816112a957805181602001fd5b805115806112c65750808060200190518101906112c69190611568565b610df25760405162461bcd60e51b815260206004820152602260248201527f5361666545524332303a20736166655472616e7366657246726f6d206661696c604482015261195960f21b606482015260840161055f565b60006020828403121561132f57600080fd5b5035919050565b6001600160a01b038116811461134b57600080fd5b50565b803561135981611336565b919050565b60008060008060008060008060e0898b03121561137a57600080fd5b883567ffffffffffffffff81111561139157600080fd5b8901601f81018b136113a257600080fd5b803567ffffffffffffffff8111156113b957600080fd5b8b60208284010111156113cb57600080fd5b6020918201995097508901359550604089013594506113ec60608a0161134e565b93506113fa60808a0161134e565b979a969950949793969295929450505060a08201359160c0013590565b60008060006060848603121561142c57600080fd5b833561143781611336565b95602085013595506040909401359392505050565b6000806020838503121561145f57600080fd5b823567ffffffffffffffff81111561147657600080fd5b8301601f8101851361148757600080fd5b803567ffffffffffffffff81111561149e57600080fd5b8560208260051b84010111156114b357600080fd5b6020919091019590945092505050565b602080825282518282018190526000918401906040840190835b818110156114fd57835115158352602093840193909201916001016114dd565b509095945050505050565b60e081528260e08201528284610100830137600061010084830101526000610100601f19601f8601168301019050602082018360005b600681101561155d57815183526020928301929091019060010161153e565b505050949350505050565b60006020828403121561157a57600080fd5b8151801515811461158a57600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b600063ffffffff8216806115bd576115bd611591565b6000190192915050565b600080604083850312156115da57600080fd5b505080516020909101519092909150565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b8181038181111561164057611640611591565b92915050565b6001815b60018411156116815780850481111561166557611665611591565b600184161561167357908102905b60019390931c92800261164a565b935093915050565b60008261169857506001611640565b816116a557506000611640565b81600181146116bb57600281146116c5576116f6565b6001915050611640565b60ff8411156116d6576116d6611591565b6001841b915063ffffffff8211156116f0576116f0611591565b50611640565b5060208310610133831016604e8410600b841016171561172d575081810a63ffffffff81111561172857611728611591565b611640565b61173c63ffffffff8484611646565b8063ffffffff0482111561175257611752611591565b029392505050565b600061158a63ffffffff841663ffffffff8416611689565b600063ffffffff831680611788576117886115eb565b8063ffffffff84160691505092915050565b600063ffffffff8316806117b0576117b06115eb565b8063ffffffff84160491505092915050565b63ffffffff818116838216019081111561164057611640611591565b6000825160005b818110156117ff57602081860181015185830152016117e5565b50600092019182525091905056fe30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001a2646970667358221220b02ff0aa2482e2d5c96dc808653f03833fb36ec1e6b15aae7d79ca885ffda98164736f6c634300081c003330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001";class tf extends Ya{constructor(...e){e.length>1?super(...e):super(Qb,ef,e[0])}getDeployTransaction(e,t,a,n,b,f){return super.getDeployTransaction(e,t,a,n,b,f||{})}deploy(e,t,a,n,b,f){return super.deploy(e,t,a,n,b,f||{})}connect(e){return super.connect(e)}static bytecode=ef;static abi=Qb;static createInterface(){return new ba(Qb)}static connect(e,t){return new Wa(e,Qb,t)}}const af=[{inputs:[{internalType:"contract IVerifier",name:"_verifier",type:"address"},{internalType:"contract IHasher",name:"_hasher",type:"address"},{internalType:"uint256",name:"_denomination",type:"uint256"},{internalType:"uint32",name:"_merkleTreeHeight",type:"uint32"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"commitment",type:"bytes32"},{indexed:!1,internalType:"uint32",name:"leafIndex",type:"uint32"},{indexed:!1,internalType:"uint256",name:"timestamp",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"bytes32",name:"nullifierHash",type:"bytes32"},{indexed:!0,internalType:"address",name:"relayer",type:"address"},{indexed:!1,internalType:"uint256",name:"fee",type:"uint256"}],name:"Withdrawal",type:"event"},{inputs:[],name:"FIELD_SIZE",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"ROOT_HISTORY_SIZE",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"ZERO_VALUE",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"commitments",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"currentRootIndex",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"denomination",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"_commitment",type:"bytes32"}],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"filledSubtrees",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLastRoot",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IHasher",name:"_hasher",type:"address"},{internalType:"bytes32",name:"_left",type:"bytes32"},{internalType:"bytes32",name:"_right",type:"bytes32"}],name:"hashLeftRight",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"pure",type:"function"},{inputs:[],name:"hasher",outputs:[{internalType:"contract IHasher",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"_root",type:"bytes32"}],name:"isKnownRoot",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"_nullifierHash",type:"bytes32"}],name:"isSpent",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32[]",name:"_nullifierHashes",type:"bytes32[]"}],name:"isSpentArray",outputs:[{internalType:"bool[]",name:"spent",type:"bool[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"levels",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"nextIndex",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"nullifierHashes",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"roots",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"verifier",outputs:[{internalType:"contract IVerifier",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"_proof",type:"bytes"},{internalType:"bytes32",name:"_root",type:"bytes32"},{internalType:"bytes32",name:"_nullifierHash",type:"bytes32"},{internalType:"address payable",name:"_recipient",type:"address"},{internalType:"address payable",name:"_relayer",type:"address"},{internalType:"uint256",name:"_fee",type:"uint256"},{internalType:"uint256",name:"_refund",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"zeros",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"}],nf="0x610100604052600380546001600160401b031916905534801561002157600080fd5b50604051611b75380380611b758339810160408190526100409161041b565b83838383808360008263ffffffff16116100ad5760405162461bcd60e51b815260206004820152602360248201527f5f6c6576656c732073686f756c642062652067726561746572207468616e207a60448201526265726f60e81b60648201526084015b60405180910390fd5b60208263ffffffff16106101035760405162461bcd60e51b815260206004820152601e60248201527f5f6c6576656c732073686f756c64206265206c657373207468616e203332000060448201526064016100a4565b63ffffffff821660a0526001600160a01b0381166080527f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c60005b8363ffffffff168163ffffffff16101561018b5763ffffffff81166000908152600160209081526040808320859055908290529020829055610181838380610236565b915060010161013e565b506000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b5550506001600455816102195760405162461bcd60e51b815260206004820152602560248201527f64656e6f6d696e6174696f6e2073686f756c6420626520677265617465722074604482015264068616e20360dc1b60648201526084016100a4565b506001600160a01b0390921660c0525060e0525061049d92505050565b6000600080516020611b5583398151915283106102955760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c6460448201526064016100a4565b600080516020611b5583398151915282106102fc5760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b60648201526084016100a4565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa15801561034b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036f9190610479565b9092509050600080516020611b5583398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156103d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f89190610479565b509695505050505050565b6001600160a01b038116811461041857600080fd5b50565b6000806000806080858703121561043157600080fd5b845161043c81610403565b602086015190945061044d81610403565b60408601516060870151919450925063ffffffff8116811461046e57600080fd5b939692955090935050565b6000806040838503121561048c57600080fd5b505080516020909101519092909150565b60805160a05160c05160e05161164e610507600039600081816102b00152818161053001528181610d0401526110a201526000818161019b015261069901526000818161021701528181610e9b0152610f3d01526000818161045e0152610fd5015261164e6000f3fe60806040526004361061012a5760003560e01c80639fa12d0b116100ab578063e5285dcc1161006f578063e5285dcc146103bb578063e8295588146103eb578063ec73295914610418578063ed33639f1461044c578063f178e47c14610480578063fc7e9c6f146104ad57600080fd5b80639fa12d0b1461030f578063b214faa51461033c578063ba70f7571461034f578063c2b40ae414610379578063cd87a3b4146103a657600080fd5b80636d9833e3116100f25780636d9833e31461024e578063839df9451461026e5780638bca6d161461029e5780638ea3099e146102d257806390eeb02b146102f257600080fd5b806317cc915c1461012f57806321a0adb6146101745780632b7ac3f314610189578063414a37ba146101d55780634ecf518b14610205575b600080fd5b34801561013b57600080fd5b5061015f61014a366004611137565b60056020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b610187610182366004611178565b6104d2565b005b34801561019557600080fd5b506101bd7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161016b565b3480156101e157600080fd5b506101f76000805160206115f983398151915281565b60405190815260200161016b565b34801561021157600080fd5b506102397f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff909116815260200161016b565b34801561025a57600080fd5b5061015f610269366004611137565b6107dd565b34801561027a57600080fd5b5061015f610289366004611137565b60066020526000908152604090205460ff1681565b3480156102aa57600080fd5b506101f77f000000000000000000000000000000000000000000000000000000000000000081565b3480156102de57600080fd5b506101f76102ed366004611231565b61085b565b3480156102fe57600080fd5b506003546102399063ffffffff1681565b34801561031b57600080fd5b5061032f61032a366004611266565b610a28565b60405161016b91906112dd565b61018761034a366004611137565b610ae4565b34801561035b57600080fd5b5060035463ffffffff166000908152600260205260409020546101f7565b34801561038557600080fd5b506101f7610394366004611137565b60026020526000908152604090205481565b3480156103b257600080fd5b50610239601e81565b3480156103c757600080fd5b5061015f6103d6366004611137565b60009081526005602052604090205460ff1690565b3480156103f757600080fd5b506101f7610406366004611137565b60016020526000908152604090205481565b34801561042457600080fd5b506101f77f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c81565b34801561045857600080fd5b506101bd7f000000000000000000000000000000000000000000000000000000000000000081565b34801561048c57600080fd5b506101f761049b366004611137565b60006020819052908152604090205481565b3480156104b957600080fd5b5060035461023990640100000000900463ffffffff1681565b6002600454036105295760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60026004557f000000000000000000000000000000000000000000000000000000000000000082111561059e5760405162461bcd60e51b815260206004820152601a60248201527f4665652065786365656473207472616e736665722076616c75650000000000006044820152606401610520565b60008581526005602052604090205460ff16156105fd5760405162461bcd60e51b815260206004820152601f60248201527f546865206e6f746520686173206265656e20616c7265616479207370656e74006044820152606401610520565b610606866107dd565b6106525760405162461bcd60e51b815260206004820152601c60248201527f43616e6e6f742066696e6420796f7572206d65726b6c6520726f6f74000000006044820152606401610520565b6040805160c081018252878152602081018790526001600160a01b038681168284015285811660608301526080820185905260a08201849052915163695ef6f960e01b81527f00000000000000000000000000000000000000000000000000000000000000009092169163695ef6f9916106d2918c918c91600401611322565b6020604051808303816000875af11580156106f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107159190611382565b61075a5760405162461bcd60e51b815260206004820152601660248201527524b73b30b634b2103bb4ba34323930bb90383937b7b360511b6044820152606401610520565b6000858152600560205260409020805460ff1916600117905561077f84848484610c1b565b604080516001600160a01b03868116825260208201889052918101849052908416907fe9e508bad6d4c3227e881ca19068f099da81b5164dd6d62b2eaf1e8bc6c349319060600160405180910390a250506001600455505050505050565b60008181036107ee57506000919050565b60035463ffffffff16805b63ffffffff8116600090815260026020526040902054840361081f575060019392505050565b8063ffffffff166000036108315750601e5b8061083b816113c1565b9150508163ffffffff168163ffffffff16036107f9575060009392505050565b60006000805160206115f983398151915283106108ba5760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c646044820152606401610520565b6000805160206115f983398151915282106109215760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b6064820152608401610520565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610970573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099491906113e1565b90925090506000805160206115f983398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156109f9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a1d91906113e1565b509695505050505050565b60608167ffffffffffffffff811115610a4357610a4361141b565b604051908082528060200260200182016040528015610a6c578160200160208202803683370190505b50905060005b82811015610add57610aab848483818110610a8f57610a8f611431565b9050602002013560009081526005602052604090205460ff1690565b15610ad5576001828281518110610ac457610ac4611431565b911515602092830291909101909101525b600101610a72565b5092915050565b600260045403610b365760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610520565b600260045560008181526006602052604090205460ff1615610ba45760405162461bcd60e51b815260206004820152602160248201527f54686520636f6d6d69746d656e7420686173206265656e207375626d697474656044820152601960fa1b6064820152608401610520565b6000610baf82610e82565b6000838152600660205260409020805460ff191660011790559050610bd26110a0565b6040805163ffffffff8316815242602082015283917fa945e51eec50ab98c161376f0db4cf2aeba3ec92755fe2fcd388bdbbb80ff196910160405180910390a250506001600455565b3415610c875760405162461bcd60e51b815260206004820152603560248201527f4d6573736167652076616c756520697320737570706f73656420746f206265206044820152747a65726f20666f722045544820696e7374616e636560581b6064820152608401610520565b8015610cf25760405162461bcd60e51b815260206004820152603460248201527f526566756e642076616c756520697320737570706f73656420746f206265207a60448201527365726f20666f722045544820696e7374616e636560601b6064820152608401610520565b60006001600160a01b038516610d28847f0000000000000000000000000000000000000000000000000000000000000000611447565b604051600081818185875af1925050503d8060008114610d64576040519150601f19603f3d011682016040523d82523d6000602084013e610d69565b606091505b5050905080610dc85760405162461bcd60e51b815260206004820152602560248201527f7061796d656e7420746f205f726563697069656e7420646964206e6f7420676f604482015264207468727560d81b6064820152608401610520565b8215610e7b576040516001600160a01b038516908490600081818185875af1925050503d8060008114610e17576040519150601f19603f3d011682016040523d82523d6000602084013e610e1c565b606091505b50508091505080610e7b5760405162461bcd60e51b815260206004820152602360248201527f7061796d656e7420746f205f72656c6179657220646964206e6f7420676f207460448201526268727560e81b6064820152608401610520565b5050505050565b600354600090640100000000900463ffffffff16610ec17f00000000000000000000000000000000000000000000000000000000000000006002611574565b63ffffffff168163ffffffff1603610f345760405162461bcd60e51b815260206004820152603060248201527f4d65726b6c6520747265652069732066756c6c2e204e6f206d6f7265206c656160448201526f1d995cc818d85b88189948185919195960821b6064820152608401610520565b8083600080805b7f000000000000000000000000000000000000000000000000000000000000000063ffffffff168163ffffffff16101561101257610f7a60028661158c565b63ffffffff16600003610fb45763ffffffff8116600090815260016020908152604080832054918390529091208590558493509150610fd0565b63ffffffff811660009081526020819052604090205492508391505b610ffb7f0000000000000000000000000000000000000000000000000000000000000000848461085b565b93506110086002866115b4565b9450600101610f3b565b50600354600090601e9061102d9063ffffffff1660016115dc565b611037919061158c565b6003805463ffffffff191663ffffffff83169081179091556000908152600260205260409020859055905061106d8660016115dc565b6003805463ffffffff929092166401000000000267ffffffff000000001990921691909117905550939695505050505050565b7f000000000000000000000000000000000000000000000000000000000000000034146111355760405162461bcd60e51b815260206004820152603860248201527f506c656173652073656e6420606d697844656e6f6d696e6174696f6e6020455460448201527f4820616c6f6e672077697468207472616e73616374696f6e00000000000000006064820152608401610520565b565b60006020828403121561114957600080fd5b5035919050565b6001600160a01b038116811461116557600080fd5b50565b803561117381611150565b919050565b60008060008060008060008060e0898b03121561119457600080fd5b883567ffffffffffffffff8111156111ab57600080fd5b8901601f81018b136111bc57600080fd5b803567ffffffffffffffff8111156111d357600080fd5b8b60208284010111156111e557600080fd5b60209182019950975089013595506040890135945061120660608a01611168565b935061121460808a01611168565b979a969950949793969295929450505060a08201359160c0013590565b60008060006060848603121561124657600080fd5b833561125181611150565b95602085013595506040909401359392505050565b6000806020838503121561127957600080fd5b823567ffffffffffffffff81111561129057600080fd5b8301601f810185136112a157600080fd5b803567ffffffffffffffff8111156112b857600080fd5b8560208260051b84010111156112cd57600080fd5b6020919091019590945092505050565b602080825282518282018190526000918401906040840190835b8181101561131757835115158352602093840193909201916001016112f7565b509095945050505050565b60e081528260e08201528284610100830137600061010084830101526000610100601f19601f8601168301019050602082018360005b6006811015611377578151835260209283019290910190600101611358565b505050949350505050565b60006020828403121561139457600080fd5b815180151581146113a457600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b600063ffffffff8216806113d7576113d76113ab565b6000190192915050565b600080604083850312156113f457600080fd5b505080516020909101519092909150565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b8181038181111561145a5761145a6113ab565b92915050565b6001815b600184111561149b5780850481111561147f5761147f6113ab565b600184161561148d57908102905b60019390931c928002611464565b935093915050565b6000826114b25750600161145a565b816114bf5750600061145a565b81600181146114d557600281146114df57611510565b600191505061145a565b60ff8411156114f0576114f06113ab565b6001841b915063ffffffff82111561150a5761150a6113ab565b5061145a565b5060208310610133831016604e8410600b8410161715611547575081810a63ffffffff811115611542576115426113ab565b61145a565b61155663ffffffff8484611460565b8063ffffffff0482111561156c5761156c6113ab565b029392505050565b60006113a463ffffffff841663ffffffff84166114a3565b600063ffffffff8316806115a2576115a2611405565b8063ffffffff84160691505092915050565b600063ffffffff8316806115ca576115ca611405565b8063ffffffff84160491505092915050565b63ffffffff818116838216019081111561145a5761145a6113ab56fe30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001a264697066735822122030cdb3d931ce1408ab144147edd7c76e28173ecad063b971dad09ea221811b3c64736f6c634300081c003330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001";class bf extends Ya{constructor(...e){e.length>1?super(...e):super(af,nf,e[0])}getDeployTransaction(e,t,a,n,b){return super.getDeployTransaction(e,t,a,n,b||{})}deploy(e,t,a,n,b){return super.deploy(e,t,a,n,b||{})}connect(e){return super.connect(e)}static bytecode=nf;static abi=af;static createInterface(){return new ba(af)}static connect(e,t){return new Wa(e,af,t)}}const ff=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"who",type:"address"},{indexed:!1,internalType:"bytes",name:"data",type:"bytes"}],name:"Echo",type:"event"},{inputs:[{internalType:"bytes",name:"_data",type:"bytes"}],name:"echo",outputs:[],stateMutability:"nonpayable",type:"function"}],df="0x6080604052348015600f57600080fd5b506101658061001f6000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063624fbfdc14610030575b600080fd5b61004361003e36600461008c565b610045565b005b336001600160a01b03167f50d6f3fc915efd1695d8a4cb50da185984f50d256834b9cb308295eb3c872c9c8383604051610080929190610100565b60405180910390a25050565b6000806020838503121561009f57600080fd5b823567ffffffffffffffff8111156100b657600080fd5b8301601f810185136100c757600080fd5b803567ffffffffffffffff8111156100de57600080fd5b8560208284010111156100f057600080fd5b6020919091019590945092505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f1916010191905056fea264697066735822122050c4191eadbd3981b9be4954b8abbadae91d7cfb743a47cc6930c8fe566e1c6e64736f6c634300081c0033";class sf extends Ya{constructor(...e){e.length>1?super(...e):super(ff,df,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=df;static abi=ff;static createInterface(){return new ba(ff)}static connect(e,t){return new Wa(e,ff,t)}}const rf=[{inputs:[{internalType:"contract IVerifier",name:"_verifier",type:"address"},{internalType:"contract IHasher",name:"_hasher",type:"address"},{internalType:"uint256",name:"_denomination",type:"uint256"},{internalType:"uint32",name:"_merkleTreeHeight",type:"uint32"},{internalType:"contract IERC20",name:"_token",type:"address"},{internalType:"address",name:"_tornadoProxyLight",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"commitment",type:"bytes32"},{indexed:!1,internalType:"uint32",name:"leafIndex",type:"uint32"},{indexed:!1,internalType:"uint256",name:"timestamp",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"commitment",type:"bytes32"},{indexed:!1,internalType:"address",name:"owner",type:"address"}],name:"VerifiedCommitment",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"bytes32",name:"nullifierHash",type:"bytes32"},{indexed:!0,internalType:"address",name:"relayer",type:"address"},{indexed:!1,internalType:"uint256",name:"fee",type:"uint256"}],name:"Withdrawal",type:"event"},{inputs:[],name:"COMMITMENT_TYPE",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[],name:"COMMITMENT_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"FIELD_SIZE",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"ROOT_HISTORY_SIZE",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"WITNESS_TYPE_STRING",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"ZERO_VALUE",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"commitments",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"currentRootIndex",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"denomination",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"_commitment",type:"bytes32"}],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"_commitment",type:"bytes32"},{internalType:"address",name:"owner",type:"address"}],name:"depositCommitment",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"filledSubtrees",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLastRoot",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IHasher",name:"_hasher",type:"address"},{internalType:"bytes32",name:"_left",type:"bytes32"},{internalType:"bytes32",name:"_right",type:"bytes32"}],name:"hashLeftRight",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"pure",type:"function"},{inputs:[],name:"hasher",outputs:[{internalType:"contract IHasher",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"_root",type:"bytes32"}],name:"isKnownRoot",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"_nullifierHash",type:"bytes32"}],name:"isSpent",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32[]",name:"_nullifierHashes",type:"bytes32[]"}],name:"isSpentArray",outputs:[{internalType:"bool[]",name:"spent",type:"bool[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"levels",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"nextIndex",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"nullifierHashes",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"permit2",outputs:[{internalType:"contract ISignatureTransfer",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"bytes32[]",name:"_commitments",type:"bytes32[]"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"bytes",name:"_signature",type:"bytes"}],name:"permit2Commitments",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"bytes32[]",name:"_commitments",type:"bytes32[]"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permitCommitments",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"roots",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"contract IERC20",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"tornadoProxyLight",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"verifiedCommitments",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"verifier",outputs:[{internalType:"contract IVerifier",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"_proof",type:"bytes"},{internalType:"bytes32",name:"_root",type:"bytes32"},{internalType:"bytes32",name:"_nullifierHash",type:"bytes32"},{internalType:"address payable",name:"_recipient",type:"address"},{internalType:"address payable",name:"_relayer",type:"address"},{internalType:"uint256",name:"_fee",type:"uint256"},{internalType:"uint256",name:"_refund",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"instance",type:"address"},{internalType:"bytes32",name:"commitmentsHash",type:"bytes32"}],internalType:"struct PermitTornado.PermitCommitments",name:"permitData",type:"tuple"}],name:"witness",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"zeros",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"}],pf="0x610140604052600380546001600160401b031916905534801561002157600080fd5b50604051612b91380380612b9183398101604081905261004091610434565b858585858584848484808360008263ffffffff16116100b25760405162461bcd60e51b815260206004820152602360248201527f5f6c6576656c732073686f756c642062652067726561746572207468616e207a60448201526265726f60e81b60648201526084015b60405180910390fd5b60208263ffffffff16106101085760405162461bcd60e51b815260206004820152601e60248201527f5f6c6576656c732073686f756c64206265206c657373207468616e203332000060448201526064016100a9565b63ffffffff821660a0526001600160a01b0381166080527f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c60005b8363ffffffff168163ffffffff1610156101905763ffffffff8116600090815260016020908152604080832085905590829052902082905561018683838061024f565b9150600101610143565b506000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b55505060016004558161021e5760405162461bcd60e51b815260206004820152602560248201527f64656e6f6d696e6174696f6e2073686f756c6420626520677265617465722074604482015264068616e20360dc1b60648201526084016100a9565b506001600160a01b0392831660c05260e05250908116610100529490941661012052506104de975050505050505050565b6000600080516020612b7183398151915283106102ae5760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c6460448201526064016100a9565b600080516020612b7183398151915282106103155760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b60648201526084016100a9565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610364573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038891906104ba565b9092509050600080516020612b7183398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156103ed573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041191906104ba565b509695505050505050565b6001600160a01b038116811461043157600080fd5b50565b60008060008060008060c0878903121561044d57600080fd5b86516104588161041c565b60208801519096506104698161041c565b60408801516060890151919650945063ffffffff8116811461048a57600080fd5b608088015190935061049b8161041c565b60a08801519092506104ac8161041c565b809150509295509295509295565b600080604083850312156104cd57600080fd5b505080516020909101519092909150565b60805160a05160c05160e05161010051610120516125c66105ab600039600081816103b301526119460152600081816106d101528181610ba101528181610c0a015281816111eb015281816113be015281816113f8015281816119790152611b5801526000818161042c015281816107a801528181610b0501528181611192015281816113900152818161199d0152611b7c0152600081816102d4015261091101526000818161032a0152818161173701526117d9015260008181610650015261187101526125c66000f3fe6080604052600436106101e35760003560e01c80639e67ab1e11610102578063e5285dcc11610095578063f15ea35911610064578063f15ea35914610672578063f178e47c14610692578063fc0c546a146106bf578063fc7e9c6f146106f357600080fd5b8063e5285dcc146105ad578063e8295588146105dd578063ec7329591461060a578063ed33639f1461063e57600080fd5b8063ba70f757116100d1578063ba70f75714610521578063c2b40ae41461054b578063c58b4c4914610578578063cd87a3b41461059857600080fd5b80639e67ab1e1461048b5780639fa12d0b146104c1578063a9f6f2b7146104ee578063b214faa51461050e57600080fd5b80636d9833e31161017a578063839df94511610149578063839df945146103ea5780638bca6d161461041a5780638ea3099e1461044e57806390eeb02b1461046e57600080fd5b80636d9833e31461036157806372286fcb14610381578063761f894e146103a15780637e89f31f146103d557600080fd5b806321a0adb6116101b657806321a0adb6146102ad5780632b7ac3f3146102c2578063414a37ba146102f65780634ecf518b1461031857600080fd5b806304f03273146101e857806312261ee714610210578063156e21521461024b57806317cc915c1461026d575b600080fd5b3480156101f457600080fd5b506101fd610718565b6040519081526020015b60405180910390f35b34801561021c57600080fd5b506102336e22d473030f116ddee9f6b43ac78ba381565b6040516001600160a01b039091168152602001610207565b34801561025757600080fd5b5061026061073b565b6040516102079190611bf0565b34801561027957600080fd5b5061029d610288366004611c0a565b60056020526000908152604090205460ff1681565b6040519015158152602001610207565b6102c06102bb366004611c84565b610776565b005b3480156102ce57600080fd5b506102337f000000000000000000000000000000000000000000000000000000000000000081565b34801561030257600080fd5b506101fd60008051602061253683398151915281565b34801561032457600080fd5b5061034c7f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff9091168152602001610207565b34801561036d57600080fd5b5061029d61037c366004611c0a565b610a55565b34801561038d57600080fd5b506102c061039c366004611ddc565b610ad3565b3480156103ad57600080fd5b506102337f000000000000000000000000000000000000000000000000000000000000000081565b3480156103e157600080fd5b50610260610c4c565b3480156103f657600080fd5b5061029d610405366004611c0a565b60066020526000908152604090205460ff1681565b34801561042657600080fd5b506101fd7f000000000000000000000000000000000000000000000000000000000000000081565b34801561045a57600080fd5b506101fd610469366004611e56565b610c68565b34801561047a57600080fd5b5060035461034c9063ffffffff1681565b34801561049757600080fd5b506102336104a6366004611c0a565b6007602052600090815260409020546001600160a01b031681565b3480156104cd57600080fd5b506104e16104dc366004611e8b565b610e35565b6040516102079190611f02565b3480156104fa57600080fd5b506102c0610509366004611f47565b610ef1565b6102c061051c366004611c0a565b611026565b34801561052d57600080fd5b5060035463ffffffff166000908152600260205260409020546101fd565b34801561055757600080fd5b506101fd610566366004611c0a565b60026020526000908152604090205481565b34801561058457600080fd5b506101fd610593366004611f77565b6110f3565b3480156105a457600080fd5b5061034c601e81565b3480156105b957600080fd5b5061029d6105c8366004611c0a565b60009081526005602052604090205460ff1690565b3480156105e957600080fd5b506101fd6105f8366004611c0a565b60016020526000908152604090205481565b34801561061657600080fd5b506101fd7f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c81565b34801561064a57600080fd5b506102337f000000000000000000000000000000000000000000000000000000000000000081565b34801561067e57600080fd5b506102c061068d366004611fd1565b611160565b34801561069e57600080fd5b506101fd6106ad366004611c0a565b60006020819052908152604090205481565b3480156106cb57600080fd5b506102337f000000000000000000000000000000000000000000000000000000000000000081565b3480156106ff57600080fd5b5060035461034c90640100000000900463ffffffff1681565b6040518060600160405280603b8152602001612556603b91398051906020012081565b6040518060600160405280603b8152602001612556603b91396040516020016107649190612066565b60405160208183030381529060405281565b6002600454036107a15760405162461bcd60e51b8152600401610798906120e9565b60405180910390fd5b60026004557f00000000000000000000000000000000000000000000000000000000000000008211156108165760405162461bcd60e51b815260206004820152601a60248201527f4665652065786365656473207472616e736665722076616c75650000000000006044820152606401610798565b60008581526005602052604090205460ff16156108755760405162461bcd60e51b815260206004820152601f60248201527f546865206e6f746520686173206265656e20616c7265616479207370656e74006044820152606401610798565b61087e86610a55565b6108ca5760405162461bcd60e51b815260206004820152601c60248201527f43616e6e6f742066696e6420796f7572206d65726b6c6520726f6f74000000006044820152606401610798565b6040805160c081018252878152602081018790526001600160a01b038681168284015285811660608301526080820185905260a08201849052915163695ef6f960e01b81527f00000000000000000000000000000000000000000000000000000000000000009092169163695ef6f99161094a918c918c91600401612149565b6020604051808303816000875af1158015610969573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098d9190612191565b6109d25760405162461bcd60e51b815260206004820152601660248201527524b73b30b634b2103bb4ba34323930bb90383937b7b360511b6044820152606401610798565b6000858152600560205260409020805460ff191660011790556109f78484848461131e565b604080516001600160a01b03868116825260208201889052918101849052908416907fe9e508bad6d4c3227e881ca19068f099da81b5164dd6d62b2eaf1e8bc6c349319060600160405180910390a250506001600455505050505050565b6000818103610a6657506000919050565b60035463ffffffff16805b63ffffffff81166000908152600260205260409020548403610a97575060019392505050565b8063ffffffff16600003610aa95750601e5b80610ab3816121c9565b9150508163ffffffff168163ffffffff1603610a71575060009392505050565b600260045403610af55760405162461bcd60e51b8152600401610798906120e9565b60026004558351600090610b29907f00000000000000000000000000000000000000000000000000000000000000006121e9565b9050600085604051602001610b3e9190612206565b60408051808303601f1901815290829052805160209091012063d505accf60e01b82526001600160a01b038981166004840152306024840152604483018590526064830182905260ff8816608484015260a4830187905260c483018690529092507f0000000000000000000000000000000000000000000000000000000000000000169063d505accf9060e401600060405180830381600087803b158015610be557600080fd5b505af1158015610bf9573d6000803e3d6000fd5b50610c349250506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690508830856114c0565b610c3e86886115ec565b505060016004555050505050565b6040518060600160405280603b8152602001612556603b913981565b60006000805160206125368339815191528310610cc75760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c646044820152606401610798565b6000805160206125368339815191528210610d2e5760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b6064820152608401610798565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610d7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da1919061223c565b909250905060008051602061253683398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610e06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2a919061223c565b509695505050505050565b60608167ffffffffffffffff811115610e5057610e50611d12565b604051908082528060200260200182016040528015610e79578160200160208202803683370190505b50905060005b82811015610eea57610eb8848483818110610e9c57610e9c612276565b9050602002013560009081526005602052604090205460ff1690565b15610ee2576001828281518110610ed157610ed1612276565b911515602092830291909101909101525b600101610e7f565b5092915050565b600260045403610f135760405162461bcd60e51b8152600401610798906120e9565b60026004556000828152600760205260409020546001600160a01b03828116911614610f795760405162461bcd60e51b8152602060048201526015602482015274155b985c1c1c9bdd99590818dbdb5b5a5d1b595b9d605a1b6044820152606401610798565b60008281526006602052604090205460ff1615610fa85760405162461bcd60e51b81526004016107989061228c565b6000610fb38361171e565b60008481526006602052604090819020805460ff191660011790555190915083907fa945e51eec50ab98c161376f0db4cf2aeba3ec92755fe2fcd388bdbbb80ff19690611014908490429063ffffffff929092168252602082015260400190565b60405180910390a25050600160045550565b6002600454036110485760405162461bcd60e51b8152600401610798906120e9565b600260045560008181526006602052604090205460ff161561107c5760405162461bcd60e51b81526004016107989061228c565b60006110878261171e565b6000838152600660205260409020805460ff1916600117905590506110aa61193c565b6040805163ffffffff8316815242602082015283917fa945e51eec50ab98c161376f0db4cf2aeba3ec92755fe2fcd388bdbbb80ff196910160405180910390a250506001600455565b60006040518060600160405280603b8152602001612556603b9139805160209182012083518483015160405161114394019283526001600160a01b03919091166020830152604082015260600190565b604051602081830303815290604052805190602001209050919050565b6002600454036111825760405162461bcd60e51b8152600401610798906120e9565b600260045584516000906111b6907f00000000000000000000000000000000000000000000000000000000000000006121e9565b90506000866040516020016111cb9190612206565b60408051601f19818403018152828252805160209182012060a0840183527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316606085019081526080850187905284528382018a905283830189905282518084018452308082528184018890528451808601909552845291830181905293506e22d473030f116ddee9f6b43ac78ba39263137c29fe929091908c90611277906110f3565b6040518060600160405280603b8152602001612556603b91396040516020016112a09190612066565b6040516020818303038152906040528a8a6040518863ffffffff1660e01b81526004016112d397969594939291906122cd565b600060405180830381600087803b1580156112ed57600080fd5b505af1158015611301573d6000803e3d6000fd5b5050505061130f87896115ec565b50506001600455505050505050565b8034146113865760405162461bcd60e51b815260206004820152603060248201527f496e636f727265637420726566756e6420616d6f756e7420726563656976656460448201526f08189e481d1a194818dbdb9d1c9858dd60821b6064820152608401610798565b6113e5846113b4847f000000000000000000000000000000000000000000000000000000000000000061236e565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691906119cb565b811561141f5761141f6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001684846119cb565b80156114ba576000846001600160a01b03168260405160006040518083038185875af1925050503d8060008114611472576040519150601f19603f3d011682016040523d82523d6000602084013e611477565b606091505b50509050806114b8576040516001600160a01b0385169083156108fc029084906000818181858888f193505050501580156114b6573d6000803e3d6000fd5b505b505b50505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291516000928392908816916115249190612381565b6000604051808303816000865af19150503d8060008114611561576040519150601f19603f3d011682016040523d82523d6000602084013e611566565b606091505b50915091508161157857805181602001fd5b805115806115955750808060200190518101906115959190612191565b6114b65760405162461bcd60e51b815260206004820152602260248201527f5361666545524332303a20736166655472616e7366657246726f6d206661696c604482015261195960f21b6064820152608401610798565b60005b825181101561171957600083828151811061160c5761160c612276565b602090810291909101810151600081815260079092526040909120549091506001600160a01b0316156116815760405162461bcd60e51b815260206004820181905260248201527f54686520636f6d6d69746d656e7420686173206265656e2076657269666965646044820152606401610798565b60008181526006602052604090205460ff16156116b05760405162461bcd60e51b81526004016107989061228c565b60008181526007602090815260409182902080546001600160a01b0319166001600160a01b038716908117909155915191825282917fa9b0993cd360203065cdbc30dd334b2a3eb63115cbb64d73246109d8af75a5f9910160405180910390a2506001016115ef565b505050565b600354600090640100000000900463ffffffff1661175d7f000000000000000000000000000000000000000000000000000000000000000060026124b1565b63ffffffff168163ffffffff16036117d05760405162461bcd60e51b815260206004820152603060248201527f4d65726b6c6520747265652069732066756c6c2e204e6f206d6f7265206c656160448201526f1d995cc818d85b88189948185919195960821b6064820152608401610798565b8083600080805b7f000000000000000000000000000000000000000000000000000000000000000063ffffffff168163ffffffff1610156118ae576118166002866124c9565b63ffffffff166000036118505763ffffffff811660009081526001602090815260408083205491839052909120859055849350915061186c565b63ffffffff811660009081526020819052604090205492508391505b6118977f00000000000000000000000000000000000000000000000000000000000000008484610c68565b93506118a46002866124f1565b94506001016117d7565b50600354600090601e906118c99063ffffffff166001612519565b6118d391906124c9565b6003805463ffffffff191663ffffffff831690811790915560009081526002602052604090208590559050611909866001612519565b6003805463ffffffff929092166401000000000267ffffffff000000001990921691909117905550939695505050505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633036119c3576119c16001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001632307f00000000000000000000000000000000000000000000000000000000000000006114c0565b565b6119c1611ae4565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600092839290871691611a279190612381565b6000604051808303816000865af19150503d8060008114611a64576040519150601f19603f3d011682016040523d82523d6000602084013e611a69565b606091505b509150915081611a7b57805181602001fd5b80511580611a98575080806020019051810190611a989190612191565b6114b85760405162461bcd60e51b815260206004820152601e60248201527f5361666545524332303a20736166655472616e73666572206661696c656400006044820152606401610798565b3415611b4b5760405162461bcd60e51b815260206004820152603060248201527f4554482076616c756520697320737570706f73656420746f206265203020666f60448201526f7220455243323020696e7374616e636560801b6064820152608401610798565b6119c16001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633307f00000000000000000000000000000000000000000000000000000000000000006114c0565b60005b83811015611bbb578181015183820152602001611ba3565b50506000910152565b60008151808452611bdc816020860160208601611ba0565b601f01601f19169290920160200192915050565b602081526000611c036020830184611bc4565b9392505050565b600060208284031215611c1c57600080fd5b5035919050565b60008083601f840112611c3557600080fd5b50813567ffffffffffffffff811115611c4d57600080fd5b602083019150836020828501011115611c6557600080fd5b9250929050565b6001600160a01b0381168114611c8157600080fd5b50565b60008060008060008060008060e0898b031215611ca057600080fd5b883567ffffffffffffffff811115611cb757600080fd5b611cc38b828c01611c23565b90995097505060208901359550604089013594506060890135611ce581611c6c565b93506080890135611cf581611c6c565b979a969950949793969295929450505060a08201359160c0013590565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611d5157611d51611d12565b604052919050565b600082601f830112611d6a57600080fd5b813567ffffffffffffffff811115611d8457611d84611d12565b8060051b611d9460208201611d28565b91825260208185018101929081019086841115611db057600080fd5b6020860192505b83831015611dd2578235825260209283019290910190611db7565b9695505050505050565b600080600080600060a08688031215611df457600080fd5b8535611dff81611c6c565b9450602086013567ffffffffffffffff811115611e1b57600080fd5b611e2788828901611d59565b945050604086013560ff81168114611e3e57600080fd5b94979396509394606081013594506080013592915050565b600080600060608486031215611e6b57600080fd5b8335611e7681611c6c565b95602085013595506040909401359392505050565b60008060208385031215611e9e57600080fd5b823567ffffffffffffffff811115611eb557600080fd5b8301601f81018513611ec657600080fd5b803567ffffffffffffffff811115611edd57600080fd5b8560208260051b8401011115611ef257600080fd5b6020919091019590945092505050565b602080825282518282018190526000918401906040840190835b81811015611f3c5783511515835260209384019390920191600101611f1c565b509095945050505050565b60008060408385031215611f5a57600080fd5b823591506020830135611f6c81611c6c565b809150509250929050565b60006040828403128015611f8a57600080fd5b506040805190810167ffffffffffffffff81118282101715611fae57611fae611d12565b6040528235611fbc81611c6c565b81526020928301359281019290925250919050565b60008060008060008060a08789031215611fea57600080fd5b8635611ff581611c6c565b9550602087013567ffffffffffffffff81111561201157600080fd5b61201d89828a01611d59565b9550506040870135935060608701359250608087013567ffffffffffffffff81111561204857600080fd5b61205489828a01611c23565b979a9699509497509295939492505050565b7f5065726d6974436f6d6d69746d656e7473207769746e6573732900000000000081526000825161209e81601a850160208701611ba0565b7f546f6b656e5065726d697373696f6e73286164647265737320746f6b656e2c75601a9390910192830152506d696e7432353620616d6f756e742960901b603a820152604801919050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60e08152600061215d60e083018587612120565b9050602082018360005b6006811015612186578151835260209283019290910190600101612167565b505050949350505050565b6000602082840312156121a357600080fd5b81518015158114611c0357600080fd5b634e487b7160e01b600052601160045260246000fd5b600063ffffffff8216806121df576121df6121b3565b6000190192915050565b8082028115828204841417612200576122006121b3565b92915050565b8151600090829060208501835b82811015612231578151845260209384019390910190600101612213565b509195945050505050565b6000806040838503121561224f57600080fd5b505080516020909101519092909150565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60208082526021908201527f54686520636f6d6d69746d656e7420686173206265656e207375626d697474656040820152601960fa1b606082015260800190565b6122eb81895180516001600160a01b03168252602090810151910152565b602088015160408201526040880151606082015261231f608082018880516001600160a01b03168252602090810151910152565b60018060a01b03861660c08201528460e0820152610140610100820152600061234c610140830186611bc4565b828103610120840152612360818587612120565b9a9950505050505050505050565b81810381811115612200576122006121b3565b60008251612393818460208701611ba0565b9190910192915050565b6001815b60018411156123d8578085048111156123bc576123bc6121b3565b60018416156123ca57908102905b60019390931c9280026123a1565b935093915050565b6000826123ef57506001612200565b816123fc57506000612200565b8160018114612412576002811461241c5761244d565b6001915050612200565b60ff84111561242d5761242d6121b3565b6001841b915063ffffffff821115612447576124476121b3565b50612200565b5060208310610133831016604e8410600b8410161715612484575081810a63ffffffff81111561247f5761247f6121b3565b612200565b61249363ffffffff848461239d565b8063ffffffff048211156124a9576124a96121b3565b029392505050565b6000611c0363ffffffff841663ffffffff84166123e0565b600063ffffffff8316806124df576124df612260565b8063ffffffff84160691505092915050565b600063ffffffff83168061250757612507612260565b8063ffffffff84160491505092915050565b63ffffffff8181168382160190811115612200576122006121b356fe30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000015065726d6974436f6d6d69746d656e7473286164647265737320696e7374616e63652c6279746573333220636f6d6d69746d656e74734861736829a2646970667358221220154929f9a41ef21e6f1ac58d55712a26e4fe53fb384431d666fe2d06cdf5aaa864736f6c634300081c003330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001";class cf extends Ya{constructor(...e){e.length>1?super(...e):super(rf,pf,e[0])}getDeployTransaction(e,t,a,n,b,f,d){return super.getDeployTransaction(e,t,a,n,b,f,d||{})}deploy(e,t,a,n,b,f,d){return super.deploy(e,t,a,n,b,f,d||{})}connect(e){return super.connect(e)}static bytecode=pf;static abi=rf;static createInterface(){return new ba(rf)}static connect(e,t){return new Wa(e,rf,t)}}const uf=[{inputs:[{internalType:"bytes",name:"proof",type:"bytes"},{internalType:"uint256[6]",name:"input",type:"uint256[6]"}],name:"verifyProof",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"}],yf="0x6080604052348015600f57600080fd5b5061109e8061001f6000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063695ef6f914610030575b600080fd5b61004361003e366004610eae565b610057565b604051901515815260200160405180910390f35b6000808380602001905181019061006e9190610f5a565b905060005b60088160ff161015610129577f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47828260ff16600881106100b5576100b5610fbe565b6020020151106101175760405162461bcd60e51b815260206004820152602260248201527f76657269666965722d70726f6f662d656c656d656e742d6774652d7072696d656044820152612d7160f01b60648201526084015b60405180910390fd5b8061012181610fea565b915050610073565b50610132610ca2565b6040805180820182528351815260208085015181830152908352815160808082018452858401518285019081526060808801519084015282528351808501855290860151815260a08601518184015281830152838201528151808301835260c0850151815260e0850151918101919091529082015260006101b1610321565b90506000604051806040016040528060008152602001600081525090506101f38183608001516000600781106101e9576101e9610fbe565b60200201516107ec565b905060005b60068110156102df577f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000187826006811061023457610234610fbe565b6020020151106102865760405162461bcd60e51b815260206004820152601f60248201527f76657269666965722d6774652d736e61726b2d7363616c61722d6669656c6400604482015260640161010e565b6102d5826102d0856080015184600161029f9190611009565b600781106102af576102af610fbe565b60200201518a85600681106102c6576102c6610fbe565b602002015161088d565b6107ec565b91506001016101f8565b506103146102f0846000015161091b565b846020015184600001518560200151858760400151896040015189606001516109d5565b9450505050505b92915050565b610329610cf3565b6040805180820182527f2dbfc3ec62a3eee5a3b4b464bcf1f8527bbca12adea0f1f12033cd4f61b0e09181527f19e55bd0b72c126da18665039556776642ff82e2f347f24fcea2475f4db087df6020808301919091529083528151608080820184527f1ae724ab134e5a7c6bd8a116fa5505b259522c0f164a5e8126e3ec7d34465f6e8285019081527e9f1bcdc853f8e3531756bb625b0d1dc014f4ab57c3f79f4f4e2e7ef7e0ead6606080850191909152908352845180860186527f23a8ca5760457e726365b92fd0ceb486665797cd68c35dcffd8e4ae8066691e981527f13ec7182c9fd68331a10f8be0fe885d730de5c7f89aa7d0b7bafaa009bbc9e3e818601528385015285840192909252835180820185527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c28186019081527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed828501528152845180860186527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b81527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa818601528185015285850152835180820185527f2f0c63d0c53b3dfbca27b6b43ae7fbf55a38d78a21470996485b03128accc2088186019081527e556502356e37ed150db2e36531b0f275fd6835c0fc1945922e270b48c48a86828501528152845180860186527f02644c27b5dbd793592a70b735e22c798a5e309fa17a992a7dc2a050e01b298f81527f194776b6a53439d7336f389d2a8f6651e40885f5ca2538b0dc9cb534fb23f7fa818601528185015282860152835180850185527f23df1bc9165e9c1c9b2bc036d8ebdd10e7aeae7e5e8019fde68aec7c818bb23e81527f0b6c92080d37c5fb2ddf30892a33665e5478432ef3f71ac8768ecbbe62c7789281850152818601805191909152845180860186527f1c7b2adf45e046caea000956b2ecb2d8617e710d2a7bb201a95ea276f92307b481527f2b15f07536f45948cf4abe6596637d902ffabb18c8c2f5c151544c294ce4a672818601528151850152845180860186527f1cecfe92882a8c835a47bf01bfa655cf628cbba7f81cf4042179fd13edcd6a3981527f0154bfbb2cb786ca247d4b69183d1751f267bbc7656be8d0f0e7a5a47e2c1101818601528151860152845180860186527f1584616a7423efcc72f69ea84fa0b2bc01433677297f4e8351bebfc15bcd0cda81527f0623755b1488526daa9fecf0e11b110dd6df12c461579d792e1db65af523c8be81860152815190930192909252835180850185527f12fbb5bfca9d61357ba2d641604cf4852e21ef54faa180fe539c18994dc1da5a81527f2f09dd9972a1af5f7bcfccf3d7ab600c9d898ea6d6933150ba0ae228ece17e5f81850152825190910152825180840184527f0adb513796fdf2103022c64151ce05f7c7a6d9200e8d819fa59e654fc4bfe83c81527f2d64f72ef4eddf9ca032058ed2bf691758387e913a77cf99d6a3cfb37c8ba7ee81840152815160a0015282518084019093527f21e7c9bffda74bfd2c4393b6803d775545de6fa89145f4a23476241d9881b66183527f0bbe41e52237ac13eb7b01f3cb999b7394d08734e71b1c3ada62713e17eb560c918301919091525160c0015290565b6040805180820190915260008082526020820152610808610d44565b8351815260208085015181830152835160408301528301516060808301919091526000908360c08460066107d05a03fa9050808061084257fe5b50806108855760405162461bcd60e51b81526020600482015260126024820152711c185a5c9a5b99cb5859190b59985a5b195960721b604482015260640161010e565b505092915050565b60408051808201909152600080825260208201526108a9610d62565b835181526020808501519082015260408101839052600060608360808460076107d05a03fa905080806108d857fe5b50806108855760405162461bcd60e51b81526020600482015260126024820152711c185a5c9a5b99cb5b5d5b0b59985a5b195960721b604482015260640161010e565b6040805180820190915260008082526020820152815115801561094057506020820151155b1561095e575050604080518082019091526000808252602082015290565b6040518060400160405280836000015181526020017f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4784602001516109a3919061101c565b6109cd907f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4761103e565b905292915050565b60408051608080820183528a825260208083018a90528284018890526060808401879052845192830185528b83528282018a9052828501889052820185905283516018808252610320820190955260009491859190839082016103008036833701905050905060005b6004811015610c1f576000610a54826006611051565b9050858260048110610a6857610a68610fbe565b60200201515183610a7a836000611009565b81518110610a8a57610a8a610fbe565b602002602001018181525050858260048110610aa857610aa8610fbe565b60200201516020015183826001610abf9190611009565b81518110610acf57610acf610fbe565b602002602001018181525050848260048110610aed57610aed610fbe565b6020020151515183610b00836002611009565b81518110610b1057610b10610fbe565b602002602001018181525050848260048110610b2e57610b2e610fbe565b6020020151516001602002015183610b47836003611009565b81518110610b5757610b57610fbe565b602002602001018181525050848260048110610b7557610b75610fbe565b602002015160200151600060028110610b9057610b90610fbe565b602002015183610ba1836004611009565b81518110610bb157610bb1610fbe565b602002602001018181525050848260048110610bcf57610bcf610fbe565b602002015160200151600160028110610bea57610bea610fbe565b602002015183610bfb836005611009565b81518110610c0b57610c0b610fbe565b602090810291909101015250600101610a3e565b50610c28610d80565b6000602082602086026020860160086107d05a03fa90508080610c4757fe5b5080610c8d5760405162461bcd60e51b81526020600482015260156024820152741c185a5c9a5b99cb5bdc18dbd9194b59985a5b1959605a1b604482015260640161010e565b505115159d9c50505050505050505050505050565b6040805160a081019091526000606082018181526080830191909152815260208101610ccc610d9e565b8152602001610cee604051806040016040528060008152602001600081525090565b905290565b6040805160e08101909152600060a0820181815260c0830191909152815260208101610d1d610d9e565b8152602001610d2a610d9e565b8152602001610d37610d9e565b8152602001610cee610dbe565b60405180608001604052806004906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b60405180602001604052806001906020820280368337509192915050565b6040518060400160405280610db1610df7565b8152602001610cee610df7565b6040518060e001604052806007905b6040805180820190915260008082526020820152815260200190600190039081610dcd5790505090565b60405180604001604052806002906020820280368337509192915050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610e5457610e54610e15565b604052919050565b600082601f830112610e6d57600080fd5b610e7760c0610e2b565b8060c0840185811115610e8957600080fd5b845b81811015610ea3578035845260209384019301610e8b565b509095945050505050565b60008060e08385031215610ec157600080fd5b823567ffffffffffffffff811115610ed857600080fd5b8301601f81018513610ee957600080fd5b803567ffffffffffffffff811115610f0357610f03610e15565b610f16601f8201601f1916602001610e2b565b818152866020838501011115610f2b57600080fd5b81602084016020830137600060208383010152809450505050610f518460208501610e5c565b90509250929050565b60006101008284031215610f6d57600080fd5b82601f830112610f7c57600080fd5b610100610f8881610e2b565b908301908085831115610f9a57600080fd5b845b83811015610fb4578051835260209283019201610f9c565b5095945050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060ff821660ff810361100057611000610fd4565b60010192915050565b8082018082111561031b5761031b610fd4565b60008261103957634e487b7160e01b600052601260045260246000fd5b500690565b8181038181111561031b5761031b610fd4565b808202811582820484141761031b5761031b610fd456fea2646970667358221220582b0c53304fb81b34031d12ae65a2c10ae44c3d4f7d6f3dffa078ee96b6cf3164736f6c634300081c0033";class of extends Ya{constructor(...e){e.length>1?super(...e):super(uf,yf,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=yf;static abi=uf;static createInterface(){return new ba(uf)}static connect(e,t){return new Wa(e,uf,t)}}const lf=[{inputs:[{internalType:"address",name:"_governance",type:"address"},{internalType:"contract IERC20",name:"_comp",type:"address"},{internalType:"contract IVerifier",name:"_verifier",type:"address"},{internalType:"contract IHasher",name:"_hasher",type:"address"},{internalType:"uint256",name:"_denomination",type:"uint256"},{internalType:"uint32",name:"_merkleTreeHeight",type:"uint32"},{internalType:"contract IERC20",name:"_token",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"commitment",type:"bytes32"},{indexed:!1,internalType:"uint32",name:"leafIndex",type:"uint32"},{indexed:!1,internalType:"uint256",name:"timestamp",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"bytes32",name:"nullifierHash",type:"bytes32"},{indexed:!0,internalType:"address",name:"relayer",type:"address"},{indexed:!1,internalType:"uint256",name:"fee",type:"uint256"}],name:"Withdrawal",type:"event"},{inputs:[],name:"FIELD_SIZE",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"ROOT_HISTORY_SIZE",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"ZERO_VALUE",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"claimComp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"commitments",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"comp",outputs:[{internalType:"contract IERC20",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"currentRootIndex",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"denomination",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"_commitment",type:"bytes32"}],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"filledSubtrees",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLastRoot",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"governance",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IHasher",name:"_hasher",type:"address"},{internalType:"bytes32",name:"_left",type:"bytes32"},{internalType:"bytes32",name:"_right",type:"bytes32"}],name:"hashLeftRight",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"pure",type:"function"},{inputs:[],name:"hasher",outputs:[{internalType:"contract IHasher",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"_root",type:"bytes32"}],name:"isKnownRoot",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"_nullifierHash",type:"bytes32"}],name:"isSpent",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32[]",name:"_nullifierHashes",type:"bytes32[]"}],name:"isSpentArray",outputs:[{internalType:"bool[]",name:"spent",type:"bool[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"levels",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"nextIndex",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"nullifierHashes",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"roots",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"contract IERC20",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"verifier",outputs:[{internalType:"contract IVerifier",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"_proof",type:"bytes"},{internalType:"bytes32",name:"_root",type:"bytes32"},{internalType:"bytes32",name:"_nullifierHash",type:"bytes32"},{internalType:"address payable",name:"_recipient",type:"address"},{internalType:"address payable",name:"_relayer",type:"address"},{internalType:"uint256",name:"_fee",type:"uint256"},{internalType:"uint256",name:"_refund",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"zeros",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"}],mf="0x610160604052600380546001600160401b031916905534801561002157600080fd5b506040516120673803806120678339810160408190526100409161048f565b848484848484848484808360008263ffffffff16116100b25760405162461bcd60e51b815260206004820152602360248201527f5f6c6576656c732073686f756c642062652067726561746572207468616e207a60448201526265726f60e81b60648201526084015b60405180910390fd5b60208263ffffffff16106101085760405162461bcd60e51b815260206004820152601e60248201527f5f6c6576656c732073686f756c64206265206c657373207468616e203332000060448201526064016100a9565b63ffffffff821660a0526001600160a01b0381166080527f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c60005b8363ffffffff168163ffffffff1610156101905763ffffffff811660009081526001602090815260408083208590559082905290208290556101868383806102aa565b9150600101610143565b506000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b55505060016004558161021e5760405162461bcd60e51b815260206004820152602560248201527f64656e6f6d696e6174696f6e2073686f756c6420626520677265617465722074604482015264068616e20360dc1b60648201526084016100a9565b506001600160a01b0392831660c05260e05250908116610100528a16935061028c925050505760405162461bcd60e51b815260206004820152601a60248201527f496e76616c696420434f4d5020746f6b656e206164647265737300000000000060448201526064016100a9565b5050506001600160a01b03938416610120525050166101405261054e565b600060008051602061204783398151915283106103095760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c6460448201526064016100a9565b60008051602061204783398151915282106103705760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b60648201526084016100a9565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa1580156103bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103e3919061052a565b909250905060008051602061204783398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610448573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061046c919061052a565b509695505050505050565b6001600160a01b038116811461048c57600080fd5b50565b600080600080600080600060e0888a0312156104aa57600080fd5b87516104b581610477565b60208901519097506104c681610477565b60408901519096506104d781610477565b60608901519095506104e881610477565b608089015160a08a0151919550935063ffffffff8116811461050957600080fd5b60c089015190925061051a81610477565b8091505092959891949750929550565b6000806040838503121561053d57600080fd5b505080516020909101519092909150565b60805160a05160c05160e051610100516101205161014051611a4b6105fc6000396000818161017d01526105d40152600081816102e5015261060501526000818161057801528181610ecc01528181610f0601526112600152600081816103690152818161074101528181610e9e015261128401526000818161023801526108aa01526000818161029c01528181610fe7015261108901526000818161051701526111210152611a4b6000f3fe6080604052600436106101665760003560e01c806390eeb02b116100d1578063e5285dcc1161008a578063ed33639f11610064578063ed33639f14610505578063f178e47c14610539578063fc0c546a14610566578063fc7e9c6f1461059a57600080fd5b8063e5285dcc14610474578063e8295588146104a4578063ec732959146104d157600080fd5b806390eeb02b146103ab5780639fa12d0b146103c8578063b214faa5146103f5578063ba70f75714610408578063c2b40ae414610432578063cd87a3b41461045f57600080fd5b80634ecf518b116101235780634ecf518b1461028a5780635aa6e675146102d35780636d9833e314610307578063839df945146103275780638bca6d16146103575780638ea3099e1461038b57600080fd5b8063109d0af81461016b57806317cc915c146101bc5780631bd85bdb146101fc57806321a0adb6146102135780632b7ac3f314610226578063414a37ba1461025a575b600080fd5b34801561017757600080fd5b5061019f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156101c857600080fd5b506101ec6101d73660046114ef565b60056020526000908152604090205460ff1681565b60405190151581526020016101b3565b34801561020857600080fd5b506102116105bf565b005b61021161022136600461152d565b6106e3565b34801561023257600080fd5b5061019f7f000000000000000000000000000000000000000000000000000000000000000081565b34801561026657600080fd5b5061027c6000805160206119f683398151915281565b6040519081526020016101b3565b34801561029657600080fd5b506102be7f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff90911681526020016101b3565b3480156102df57600080fd5b5061019f7f000000000000000000000000000000000000000000000000000000000000000081565b34801561031357600080fd5b506101ec6103223660046114ef565b6109ee565b34801561033357600080fd5b506101ec6103423660046114ef565b60066020526000908152604090205460ff1681565b34801561036357600080fd5b5061027c7f000000000000000000000000000000000000000000000000000000000000000081565b34801561039757600080fd5b5061027c6103a63660046115e6565b610a6c565b3480156103b757600080fd5b506003546102be9063ffffffff1681565b3480156103d457600080fd5b506103e86103e336600461161b565b610c39565b6040516101b39190611692565b6102116104033660046114ef565b610cf5565b34801561041457600080fd5b5060035463ffffffff1660009081526002602052604090205461027c565b34801561043e57600080fd5b5061027c61044d3660046114ef565b60026020526000908152604090205481565b34801561046b57600080fd5b506102be601e81565b34801561048057600080fd5b506101ec61048f3660046114ef565b60009081526005602052604090205460ff1690565b3480156104b057600080fd5b5061027c6104bf3660046114ef565b60016020526000908152604090205481565b3480156104dd57600080fd5b5061027c7f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c81565b34801561051157600080fd5b5061019f7f000000000000000000000000000000000000000000000000000000000000000081565b34801561054557600080fd5b5061027c6105543660046114ef565b60006020819052908152604090205481565b34801561057257600080fd5b5061019f7f000000000000000000000000000000000000000000000000000000000000000081565b3480156105a657600080fd5b506003546102be90640100000000900463ffffffff1681565b6040516370a0823160e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a9059cbb907f00000000000000000000000000000000000000000000000000000000000000009083906370a0823190602401602060405180830381865afa15801561064d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067191906116d7565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156106bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e091906116f0565b50565b60026004540361073a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60026004557f00000000000000000000000000000000000000000000000000000000000000008211156107af5760405162461bcd60e51b815260206004820152601a60248201527f4665652065786365656473207472616e736665722076616c75650000000000006044820152606401610731565b60008581526005602052604090205460ff161561080e5760405162461bcd60e51b815260206004820152601f60248201527f546865206e6f746520686173206265656e20616c7265616479207370656e74006044820152606401610731565b610817866109ee565b6108635760405162461bcd60e51b815260206004820152601c60248201527f43616e6e6f742066696e6420796f7572206d65726b6c6520726f6f74000000006044820152606401610731565b6040805160c081018252878152602081018790526001600160a01b038681168284015285811660608301526080820185905260a08201849052915163695ef6f960e01b81527f00000000000000000000000000000000000000000000000000000000000000009092169163695ef6f9916108e3918c918c91600401611719565b6020604051808303816000875af1158015610902573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092691906116f0565b61096b5760405162461bcd60e51b815260206004820152601660248201527524b73b30b634b2103bb4ba34323930bb90383937b7b360511b6044820152606401610731565b6000858152600560205260409020805460ff1916600117905561099084848484610e2c565b604080516001600160a01b03868116825260208201889052918101849052908416907fe9e508bad6d4c3227e881ca19068f099da81b5164dd6d62b2eaf1e8bc6c349319060600160405180910390a250506001600455505050505050565b60008181036109ff57506000919050565b60035463ffffffff16805b63ffffffff81166000908152600260205260409020548403610a30575060019392505050565b8063ffffffff16600003610a425750601e5b80610a4c8161178f565b9150508163ffffffff168163ffffffff1603610a0a575060009392505050565b60006000805160206119f68339815191528310610acb5760405162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c646044820152606401610731565b6000805160206119f68339815191528210610b325760405162461bcd60e51b815260206004820152602160248201527f5f72696768742073686f756c6420626520696e7369646520746865206669656c6044820152601960fa1b6064820152608401610731565b60405163f47d33b560e01b81526004810184905260006024820181905284916001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610b81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba591906117af565b90925090506000805160206119f683398151915284830860405163f47d33b560e01b815260048101829052602481018390529092506001600160a01b0387169063f47d33b5906044016040805180830381865afa158015610c0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2e91906117af565b509695505050505050565b60608167ffffffffffffffff811115610c5457610c546117e9565b604051908082528060200260200182016040528015610c7d578160200160208202803683370190505b50905060005b82811015610cee57610cbc848483818110610ca057610ca06117ff565b9050602002013560009081526005602052604090205460ff1690565b15610ce6576001828281518110610cd557610cd56117ff565b911515602092830291909101909101525b600101610c83565b5092915050565b600260045403610d475760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610731565b600260045560008181526006602052604090205460ff1615610db55760405162461bcd60e51b815260206004820152602160248201527f54686520636f6d6d69746d656e7420686173206265656e207375626d697474656044820152601960fa1b6064820152608401610731565b6000610dc082610fce565b6000838152600660205260409020805460ff191660011790559050610de36111ec565b6040805163ffffffff8316815242602082015283917fa945e51eec50ab98c161376f0db4cf2aeba3ec92755fe2fcd388bdbbb80ff196910160405180910390a250506001600455565b803414610e945760405162461bcd60e51b815260206004820152603060248201527f496e636f727265637420726566756e6420616d6f756e7420726563656976656460448201526f08189e481d1a194818dbdb9d1c9858dd60821b6064820152608401610731565b610ef384610ec2847f0000000000000000000000000000000000000000000000000000000000000000611815565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691906112aa565b8115610f2d57610f2d6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001684846112aa565b8015610fc8576000846001600160a01b03168260405160006040518083038185875af1925050503d8060008114610f80576040519150601f19603f3d011682016040523d82523d6000602084013e610f85565b606091505b5050905080610fc6576040516001600160a01b0385169083156108fc029084906000818181858888f19350505050158015610fc4573d6000803e3d6000fd5b505b505b50505050565b600354600090640100000000900463ffffffff1661100d7f00000000000000000000000000000000000000000000000000000000000000006002611942565b63ffffffff168163ffffffff16036110805760405162461bcd60e51b815260206004820152603060248201527f4d65726b6c6520747265652069732066756c6c2e204e6f206d6f7265206c656160448201526f1d995cc818d85b88189948185919195960821b6064820152608401610731565b8083600080805b7f000000000000000000000000000000000000000000000000000000000000000063ffffffff168163ffffffff16101561115e576110c660028661195a565b63ffffffff166000036111005763ffffffff811660009081526001602090815260408083205491839052909120859055849350915061111c565b63ffffffff811660009081526020819052604090205492508391505b6111477f00000000000000000000000000000000000000000000000000000000000000008484610a6c565b9350611154600286611982565b9450600101611087565b50600354600090601e906111799063ffffffff1660016119aa565b611183919061195a565b6003805463ffffffff191663ffffffff8316908117909155600090815260026020526040902085905590506111b98660016119aa565b6003805463ffffffff929092166401000000000267ffffffff000000001990921691909117905550939695505050505050565b34156112535760405162461bcd60e51b815260206004820152603060248201527f4554482076616c756520697320737570706f73656420746f206265203020666f60448201526f7220455243323020696e7374616e636560801b6064820152608401610731565b6112a86001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633307f00000000000000000000000000000000000000000000000000000000000000006113c3565b565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b179052915160009283929087169161130691906119c6565b6000604051808303816000865af19150503d8060008114611343576040519150601f19603f3d011682016040523d82523d6000602084013e611348565b606091505b50915091508161135a57805181602001fd5b8051158061137757508080602001905181019061137791906116f0565b610fc65760405162461bcd60e51b815260206004820152601e60248201527f5361666545524332303a20736166655472616e73666572206661696c656400006044820152606401610731565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b179052915160009283929088169161142791906119c6565b6000604051808303816000865af19150503d8060008114611464576040519150601f19603f3d011682016040523d82523d6000602084013e611469565b606091505b50915091508161147b57805181602001fd5b8051158061149857508080602001905181019061149891906116f0565b610fc45760405162461bcd60e51b815260206004820152602260248201527f5361666545524332303a20736166655472616e7366657246726f6d206661696c604482015261195960f21b6064820152608401610731565b60006020828403121561150157600080fd5b5035919050565b6001600160a01b03811681146106e057600080fd5b803561152881611508565b919050565b60008060008060008060008060e0898b03121561154957600080fd5b883567ffffffffffffffff81111561156057600080fd5b8901601f81018b1361157157600080fd5b803567ffffffffffffffff81111561158857600080fd5b8b602082840101111561159a57600080fd5b6020918201995097508901359550604089013594506115bb60608a0161151d565b93506115c960808a0161151d565b979a969950949793969295929450505060a08201359160c0013590565b6000806000606084860312156115fb57600080fd5b833561160681611508565b95602085013595506040909401359392505050565b6000806020838503121561162e57600080fd5b823567ffffffffffffffff81111561164557600080fd5b8301601f8101851361165657600080fd5b803567ffffffffffffffff81111561166d57600080fd5b8560208260051b840101111561168257600080fd5b6020919091019590945092505050565b602080825282518282018190526000918401906040840190835b818110156116cc57835115158352602093840193909201916001016116ac565b509095945050505050565b6000602082840312156116e957600080fd5b5051919050565b60006020828403121561170257600080fd5b8151801515811461171257600080fd5b9392505050565b60e081528260e08201528284610100830137600061010084830101526000610100601f19601f8601168301019050602082018360005b600681101561176e57815183526020928301929091019060010161174f565b505050949350505050565b634e487b7160e01b600052601160045260246000fd5b600063ffffffff8216806117a5576117a5611779565b6000190192915050565b600080604083850312156117c257600080fd5b505080516020909101519092909150565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b8181038181111561182857611828611779565b92915050565b6001815b60018411156118695780850481111561184d5761184d611779565b600184161561185b57908102905b60019390931c928002611832565b935093915050565b60008261188057506001611828565b8161188d57506000611828565b81600181146118a357600281146118ad576118de565b6001915050611828565b60ff8411156118be576118be611779565b6001841b915063ffffffff8211156118d8576118d8611779565b50611828565b5060208310610133831016604e8410600b8410161715611915575081810a63ffffffff81111561191057611910611779565b611828565b61192463ffffffff848461182e565b8063ffffffff0482111561193a5761193a611779565b029392505050565b600061171263ffffffff841663ffffffff8416611871565b600063ffffffff831680611970576119706117d3565b8063ffffffff84160691505092915050565b600063ffffffff831680611998576119986117d3565b8063ffffffff84160491505092915050565b63ffffffff818116838216019081111561182857611828611779565b6000825160005b818110156119e757602081860181015185830152016119cd565b50600092019182525091905056fe30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001a26469706673582212207ba9bd4e8d26bbfcb07faf36daf24a1575b7c43d30b2842a5b2498dac1615c5d64736f6c634300081c003330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001";class Tf extends Ya{constructor(...e){e.length>1?super(...e):super(lf,mf,e[0])}getDeployTransaction(e,t,a,n,b,f,d,i){return super.getDeployTransaction(e,t,a,n,b,f,d,i||{})}deploy(e,t,a,n,b,f,d,i){return super.deploy(e,t,a,n,b,f,d,i||{})}connect(e){return super.connect(e)}static bytecode=mf;static abi=lf;static createInterface(){return new ba(lf)}static connect(e,t){return new Wa(e,lf,t)}}var gf=Object.freeze({__proto__:null,CTornado__factory:Tf,ERC20Tornado__factory:tf,ETHTornado__factory:bf,Echoer__factory:sf,PermitTornado__factory:cf,Verifier__factory:of,interfaces:Zb,merkleTreeWithHistorySol:Tb,mocks:Vb,tornadoProxyLightSol:qb,tornadoSol:jb});const wf=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"label",type:"bytes32"},{indexed:!1,internalType:"address",name:"owner",type:"address"}],name:"NewOwner",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"address",name:"resolver",type:"address"}],name:"NewResolver",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint64",name:"ttl",type:"uint64"}],name:"NewTTL",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"address",name:"owner",type:"address"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"recordExists",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"resolver",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"owner",type:"address"}],name:"setOwner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"resolver",type:"address"},{internalType:"uint64",name:"ttl",type:"uint64"}],name:"setRecord",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"resolver",type:"address"}],name:"setResolver",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"label",type:"bytes32"},{internalType:"address",name:"owner",type:"address"}],name:"setSubnodeOwner",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"label",type:"bytes32"},{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"resolver",type:"address"},{internalType:"uint64",name:"ttl",type:"uint64"}],name:"setSubnodeRecord",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint64",name:"ttl",type:"uint64"}],name:"setTTL",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"ttl",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"}];class hf{static abi=wf;static createInterface(){return new ba(wf)}static connect(e,t){return new Wa(e,wf,t)}}const vf=[{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"addr",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"key",type:"string"}],name:"text",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}];class Mf{static abi=vf;static createInterface(){return new ba(vf)}static connect(e,t){return new Wa(e,vf,t)}}const _f=[{inputs:[{internalType:"address",name:"relayer",type:"address"}],name:"getRelayerBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"relayer",type:"address"},{internalType:"address",name:"toResolve",type:"address"}],name:"isRelayerRegistered",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"}];class xf{static abi=_f;static createInterface(){return new ba(_f)}static connect(e,t){return new Wa(e,_f,t)}}const If=[{inputs:[{internalType:"address",name:"_IENSRegistry",type:"address"},{internalType:"address",name:"_IRelayerRegistry",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"ENSRegistry",outputs:[{internalType:"contract IENSRegistry",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"RelayerRegistry",outputs:[{internalType:"contract IRelayerRegistry",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32[]",name:"_relayers",type:"bytes32[]"},{internalType:"string[]",name:"_subdomains",type:"string[]"}],name:"relayersData",outputs:[{components:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"bool",name:"isRegistered",type:"bool"},{internalType:"string[20]",name:"records",type:"string[20]"}],internalType:"struct Relayer[]",name:"",type:"tuple[]"}],stateMutability:"view",type:"function"}],Ef="0x60c060405234801561001057600080fd5b50604051610b74380380610b7483398101604081905261002f9161004d565b6001600160601b0319606092831b8116608052911b1660a05261009e565b6000806040838503121561005f578182fd5b825161006a81610086565b602084015190925061007b81610086565b809150509250929050565b6001600160a01b038116811461009b57600080fd5b50565b60805160601c60a05160601c610a9b6100d96000398060b2528061040352806104f1525080608e528061013a528061021b5250610a9b6000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631cb120d61461004657806339c16356146100645780634d47d7751461006c575b600080fd5b61004e61008c565b60405161005b9190610891565b60405180910390f35b61004e6100b0565b61007f61007a366004610702565b6100d4565b60405161005b91906108bf565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b606080835167ffffffffffffffff811180156100ef57600080fd5b5060405190808252806020026020018201604052801561012957816020015b6101166105cd565b81526020019060019003908161010e5790505b50905060005b84518110156105c5577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166302571be386838151811061017357fe5b60200260200101516040518263ffffffff1660e01b8152600401610197919061099d565b60206040518083038186803b1580156101af57600080fd5b505afa1580156101c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101e791906106d4565b8282815181106101f357fe5b6020026020010151600001906001600160a01b031690816001600160a01b03168152505060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630178b8bf87848151811061025457fe5b60200260200101516040518263ffffffff1660e01b8152600401610278919061099d565b60206040518083038186803b15801561029057600080fd5b505afa1580156102a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c891906106d4565b905060005b85518110156104005760008784815181106102e457fe5b60200260200101518783815181106102f857fe5b60200260200101516040516020016103109190610875565b60405160208183030381529060405280519060200120604051602001610337929190610867565b60408051601f19818403018152908290528051602090910120631674750f60e21b825291506001600160a01b038416906359d1d43c9061037b9084906004016109a6565b60006040518083038186803b15801561039357600080fd5b505afa1580156103a7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103cf91908101906107dc565b8585815181106103db57fe5b60200260200101516060015183601481106103f257fe5b6020020152506001016102cd565b507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b69fd4ab84848151811061043c57fe5b60200260200101516000015185858151811061045457fe5b6020026020010151600001516040518363ffffffff1660e01b815260040161047d9291906108a5565b60206040518083038186803b15801561049557600080fd5b505afa1580156104a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104cd91906107bc565b8383815181106104d957fe5b602002602001015160400190151590811515815250507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b971a6bf84848151811061052a57fe5b6020026020010151600001516040518263ffffffff1660e01b81526004016105529190610891565b60206040518083038186803b15801561056a57600080fd5b505afa15801561057e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a2919061084f565b8383815181106105ae57fe5b60209081029190910181015101525060010161012f565b509392505050565b604051806080016040528060006001600160a01b0316815260200160008152602001600015158152602001610600610605565b905290565b6040518061028001604052806014905b60608152602001906001900390816106155790505090565b600082601f83011261063d578081fd5b813561065061064b826109f1565b6109ca565b818152915060208083019084810160005b848110156106c9578135870188603f82011261067c57600080fd5b8381013561068c61064b82610a11565b81815260408b818486010111156106a257600080fd5b82818501888401375060009181018601919091528552509282019290820190600101610661565b505050505092915050565b6000602082840312156106e5578081fd5b81516001600160a01b03811681146106fb578182fd5b9392505050565b60008060408385031215610714578081fd5b823567ffffffffffffffff8082111561072b578283fd5b818501915085601f83011261073e578283fd5b813561074c61064b826109f1565b80828252602080830192508086018a82838702890101111561076c578788fd5b8796505b8487101561078e578035845260019690960195928101928101610770565b5090965087013593505050808211156107a5578283fd5b506107b28582860161062d565b9150509250929050565b6000602082840312156107cd578081fd5b815180151581146106fb578182fd5b6000602082840312156107ed578081fd5b815167ffffffffffffffff811115610803578182fd5b8201601f81018413610813578182fd5b805161082161064b82610a11565b818152856020838501011115610835578384fd5b610846826020830160208601610a35565b95945050505050565b600060208284031215610860578081fd5b5051919050565b918252602082015260400190565b60008251610887818460208701610a35565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6000602080830181845280855180835260408601915060408482028701019250838701855b8281101561099057878503603f19018452815180516001600160a01b03168652868101518787015260408082015115159087015260609081015160809187018290529086016103008701895b601481101561097b57888203607f1901835283518051610950818561099d565b61095d82828f8601610a35565b958c0195948c0194601f91909101601f191601925050600101610930565b509650505092850192908501906001016108e4565b5092979650505050505050565b90815260200190565b908152604060208201819052600390820152621d5c9b60ea1b606082015260800190565b60405181810167ffffffffffffffff811182821017156109e957600080fd5b604052919050565b600067ffffffffffffffff821115610a07578081fd5b5060209081020190565b600067ffffffffffffffff821115610a27578081fd5b50601f01601f191660200190565b60005b83811015610a50578181015183820152602001610a38565b83811115610a5f576000848401525b5050505056fea2646970667358221220628a366714cdda82fe91d785ad928e44e4b9f7976ed987e5fef72d207582dbaf64736f6c634300060c0033";class Rf extends Ya{constructor(...e){e.length>1?super(...e):super(If,Ef,e[0])}getDeployTransaction(e,t,a){return super.getDeployTransaction(e,t,a||{})}deploy(e,t,a){return super.deploy(e,t,a||{})}connect(e){return super.connect(e)}static bytecode=Ef;static abi=If;static createInterface(){return new ba(If)}static connect(e,t){return new Wa(e,If,t)}}var Of=Object.freeze({__proto__:null,IENSRegistry__factory:hf,IENSResolver__factory:Mf,IRelayerRegistry__factory:xf,RelayerAggregator__factory:Rf});const kf=[{inputs:[{internalType:"address",name:"_ensRegistry",type:"address"},{internalType:"address",name:"_relayerRegistry",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"ENSRegistry",outputs:[{internalType:"contract IENSRegistry",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"RelayerRegistry",outputs:[{internalType:"contract IRelayerRegistry",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract Governance",name:"governance",type:"address"}],name:"getAllProposals",outputs:[{components:[{internalType:"address",name:"proposer",type:"address"},{internalType:"address",name:"target",type:"address"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"uint256",name:"forVotes",type:"uint256"},{internalType:"uint256",name:"againstVotes",type:"uint256"},{internalType:"bool",name:"executed",type:"bool"},{internalType:"bool",name:"extended",type:"bool"},{internalType:"enum Governance.ProposalState",name:"state",type:"uint8"}],internalType:"struct GovernanceAggregator.Proposal[]",name:"proposals",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract Governance",name:"governance",type:"address"},{internalType:"address[]",name:"accs",type:"address[]"}],name:"getGovernanceBalances",outputs:[{internalType:"uint256[]",name:"amounts",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract Governance",name:"governance",type:"address"},{internalType:"address",name:"account",type:"address"}],name:"getUserData",outputs:[{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"uint256",name:"latestProposalId",type:"uint256"},{internalType:"uint256",name:"latestProposalIdState",type:"uint256"},{internalType:"uint256",name:"timelock",type:"uint256"},{internalType:"address",name:"delegatee",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32[]",name:"_relayers",type:"bytes32[]"},{internalType:"string[]",name:"_subdomains",type:"string[]"}],name:"relayersData",outputs:[{components:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"bool",name:"isRegistered",type:"bool"},{internalType:"string[20]",name:"records",type:"string[20]"}],internalType:"struct Relayer[]",name:"",type:"tuple[]"}],stateMutability:"view",type:"function"}],Pf="0x60c060405234801561001057600080fd5b5060405161155d38038061155d83398101604081905261002f9161004d565b6001600160601b0319606092831b8116608052911b1660a05261009e565b6000806040838503121561005f578182fd5b825161006a81610086565b602084015190925061007b81610086565b809150509250929050565b6001600160a01b038116811461009b57600080fd5b50565b60805160601c60a05160601c6114826100db6000398061024b528061059c528061068a52508061022752806102d352806103b452506114826000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063029fcae7146100675780631cb120d61461009057806339c16356146100a55780634d47d775146100ad5780639853d922146100cd578063f4eeefe9146100ed575b600080fd5b61007a610075366004610fa1565b610111565b60405161008791906112ee565b60405180910390f35b610098610225565b6040516100879190611118565b610098610249565b6100c06100bb366004610e93565b61026d565b6040516100879190611210565b6100e06100db366004610dcc565b61075e565b6040516100879190611146565b6101006100fb366004610f69565b6109dd565b60405161008795949392919061135f565b60608167ffffffffffffffff8111801561012a57600080fd5b50604051908082528060200260200182016040528015610154578160200160208202803683370190505b50905060005b8281101561021d57846001600160a01b0316639ae697bf85858481811061017d57fe5b90506020020160208101906101929190610dcc565b6040518263ffffffff1660e01b81526004016101ae9190611118565b60206040518083038186803b1580156101c657600080fd5b505afa1580156101da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fe91906110b5565b82828151811061020a57fe5b602090810291909101015260010161015a565b509392505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b606080835167ffffffffffffffff8111801561028857600080fd5b506040519080825280602002602001820160405280156102c257816020015b6102af610c79565b8152602001906001900390816102a75790505b50905060005b845181101561021d577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166302571be386838151811061030c57fe5b60200260200101516040518263ffffffff1660e01b81526004016103309190611332565b60206040518083038186803b15801561034857600080fd5b505afa15801561035c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103809190610def565b82828151811061038c57fe5b6020026020010151600001906001600160a01b031690816001600160a01b03168152505060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630178b8bf8784815181106103ed57fe5b60200260200101516040518263ffffffff1660e01b81526004016104119190611332565b60206040518083038186803b15801561042957600080fd5b505afa15801561043d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104619190610def565b905060005b855181101561059957600087848151811061047d57fe5b602002602001015187838151811061049157fe5b60200260200101516040516020016104a991906110fc565b604051602081830303815290604052805190602001206040516020016104d09291906110ee565b60408051601f19818403018152908290528051602090910120631674750f60e21b825291506001600160a01b038416906359d1d43c9061051490849060040161133b565b60006040518083038186803b15801561052c57600080fd5b505afa158015610540573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526105689190810190611042565b85858151811061057457fe5b602002602001015160600151836014811061058b57fe5b602002015250600101610466565b507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b69fd4ab8484815181106105d557fe5b6020026020010151600001518585815181106105ed57fe5b6020026020010151600001516040518363ffffffff1660e01b815260040161061692919061112c565b60206040518083038186803b15801561062e57600080fd5b505afa158015610642573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106669190610f4d565b83838151811061067257fe5b602002602001015160400190151590811515815250507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b971a6bf8484815181106106c357fe5b6020026020010151600001516040518263ffffffff1660e01b81526004016106eb9190611118565b60206040518083038186803b15801561070357600080fd5b505afa158015610717573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073b91906110b5565b83838151811061074757fe5b6020908102919091018101510152506001016102c8565b6060816001600160a01b031663da35c6646040518163ffffffff1660e01b815260040160206040518083038186803b15801561079957600080fd5b505afa1580156107ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d191906110b5565b67ffffffffffffffff811180156107e757600080fd5b5060405190808252806020026020018201604052801561082157816020015b61080e610cb1565b8152602001906001900390816108065790505b50905060005b81518110156109d7576000806000806000806000808a6001600160a01b031663013cf08b8a6001016040518263ffffffff1660e01b815260040161086b9190611332565b6101006040518083038186803b15801561088457600080fd5b505afa158015610898573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108bc9190610e0b565b97509750975097509750975097509750604051806101200160405280896001600160a01b03168152602001886001600160a01b03168152602001878152602001868152602001858152602001848152602001831515815260200182151581526020018c6001600160a01b0316633e4f49e68c6001016040518263ffffffff1660e01b815260040161094d9190611332565b60206040518083038186803b15801561096557600080fd5b505afa158015610979573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099d9190611023565b60068111156109a857fe5b8152508a8a815181106109b757fe5b602002602001018190525050505050505050508080600101915050610827565b50919050565b6000806000806000866001600160a01b0316639ae697bf876040518263ffffffff1660e01b8152600401610a119190611118565b60206040518083038186803b158015610a2957600080fd5b505afa158015610a3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6191906110b5565b6040516317977c6160e01b81529095506001600160a01b038816906317977c6190610a90908990600401611118565b60206040518083038186803b158015610aa857600080fd5b505afa158015610abc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae091906110b5565b93508315610b7257604051631f27a4f360e11b81526001600160a01b03881690633e4f49e690610b14908790600401611332565b60206040518083038186803b158015610b2c57600080fd5b505afa158015610b40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b649190611023565b6006811115610b6f57fe5b92505b60405163a72edda360e01b81526001600160a01b0388169063a72edda390610b9e908990600401611118565b60206040518083038186803b158015610bb657600080fd5b505afa158015610bca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bee91906110b5565b604051631976849960e21b81529092506001600160a01b038816906365da126490610c1d908990600401611118565b60206040518083038186803b158015610c3557600080fd5b505afa158015610c49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6d9190610def565b90509295509295909350565b604051806080016040528060006001600160a01b0316815260200160008152602001600015158152602001610cac610cfd565b905290565b6040805161012081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905290610100820190610cac565b6040518061028001604052806014905b6060815260200190600190039081610d0d5790505090565b600082601f830112610d35578081fd5b8135610d48610d43826113b2565b61138b565b818152915060208083019084810160005b84811015610dc1578135870188603f820112610d7457600080fd5b83810135610d84610d43826113d2565b81815260408b81848601011115610d9a57600080fd5b82818501888401375060009181018601919091528552509282019290820190600101610d59565b505050505092915050565b600060208284031215610ddd578081fd5b8135610de881611426565b9392505050565b600060208284031215610e00578081fd5b8151610de881611426565b600080600080600080600080610100898b031215610e27578384fd5b8851610e3281611426565b60208a0151909850610e4381611426565b8097505060408901519550606089015194506080890151935060a0890151925060c0890151610e718161143e565b60e08a0151909250610e828161143e565b809150509295985092959890939650565b60008060408385031215610ea5578182fd5b823567ffffffffffffffff80821115610ebc578384fd5b818501915085601f830112610ecf578384fd5b8135610edd610d43826113b2565b80828252602080830192508086018a828387028901011115610efd578889fd5b8896505b84871015610f1f578035845260019690960195928101928101610f01565b509096508701359350505080821115610f36578283fd5b50610f4385828601610d25565b9150509250929050565b600060208284031215610f5e578081fd5b8151610de88161143e565b60008060408385031215610f7b578182fd5b8235610f8681611426565b91506020830135610f9681611426565b809150509250929050565b600080600060408486031215610fb5578283fd5b8335610fc081611426565b9250602084013567ffffffffffffffff80821115610fdc578384fd5b818601915086601f830112610fef578384fd5b813581811115610ffd578485fd5b8760208083028501011115611010578485fd5b6020830194508093505050509250925092565b600060208284031215611034578081fd5b815160078110610de8578182fd5b600060208284031215611053578081fd5b815167ffffffffffffffff811115611069578182fd5b8201601f81018413611079578182fd5b8051611087610d43826113d2565b81815285602083850101111561109b578384fd5b6110ac8260208301602086016113f6565b95945050505050565b6000602082840312156110c6578081fd5b5051919050565b6001600160a01b03169052565b15159052565b600781106110ea57fe5b9052565b918252602082015260400190565b6000825161110e8184602087016113f6565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b602080825282518282018190526000919060409081850190868401855b8281101561120357815180516001600160a01b031685528681015161118a888701826110cd565b508086015185870152606080820151908601526080808201519086015260a0808201519086015260c0808201516111c3828801826110da565b505060e0808201516111d7828801826110da565b505061010090810151906111ed868201836110e0565b5050610120939093019290850190600101611163565b5091979650505050505050565b6000602080830181845280855180835260408601915060408482028701019250838701855b828110156112e157878503603f19018452815180516001600160a01b03168652868101518787015260408082015115159087015260609081015160809187018290529086016103008701895b60148110156112cc57888203607f19018352835180516112a18185611332565b6112ae82828f86016113f6565b958c0195948c0194601f91909101601f191601925050600101611281565b50965050509285019290850190600101611235565b5092979650505050505050565b6020808252825182820181905260009190848201906040850190845b818110156113265783518352928401929184019160010161130a565b50909695505050505050565b90815260200190565b908152604060208201819052600390820152621d5c9b60ea1b606082015260800190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b60405181810167ffffffffffffffff811182821017156113aa57600080fd5b604052919050565b600067ffffffffffffffff8211156113c8578081fd5b5060209081020190565b600067ffffffffffffffff8211156113e8578081fd5b50601f01601f191660200190565b60005b838110156114115781810151838201526020016113f9565b83811115611420576000848401525b50505050565b6001600160a01b038116811461143b57600080fd5b50565b801515811461143b57600080fdfea26469706673582212209edead2cf5d16a9f09d7d75c5aa042cb00130c9febd0bf0e908fbf9c3f34f1a164736f6c634300060c0033";class Af extends Ya{constructor(...e){e.length>1?super(...e):super(kf,Pf,e[0])}getDeployTransaction(e,t,a){return super.getDeployTransaction(e,t,a||{})}deploy(e,t,a){return super.deploy(e,t,a||{})}connect(e){return super.connect(e)}static bytecode=Pf;static abi=kf;static createInterface(){return new ba(kf)}static connect(e,t){return new Wa(e,kf,t)}}const Cf=[{inputs:[{internalType:"contract Governance",name:"governance",type:"address"}],name:"getAllProposals",outputs:[{components:[{internalType:"address",name:"proposer",type:"address"},{internalType:"address",name:"target",type:"address"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"uint256",name:"forVotes",type:"uint256"},{internalType:"uint256",name:"againstVotes",type:"uint256"},{internalType:"bool",name:"executed",type:"bool"},{internalType:"bool",name:"extended",type:"bool"},{internalType:"enum Governance.ProposalState",name:"state",type:"uint8"}],internalType:"struct GovernanceAggregator.Proposal[]",name:"proposals",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract Governance",name:"governance",type:"address"},{internalType:"address[]",name:"accs",type:"address[]"}],name:"getGovernanceBalances",outputs:[{internalType:"uint256[]",name:"amounts",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract Governance",name:"governance",type:"address"},{internalType:"address",name:"account",type:"address"}],name:"getUserData",outputs:[{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"uint256",name:"latestProposalId",type:"uint256"},{internalType:"uint256",name:"latestProposalIdState",type:"uint256"},{internalType:"uint256",name:"timelock",type:"uint256"},{internalType:"address",name:"delegatee",type:"address"}],stateMutability:"view",type:"function"}],Sf="0x608060405234801561001057600080fd5b50610ab8806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063029fcae7146100465780639853d9221461006f578063f4eeefe91461008f575b600080fd5b61005961005436600461082b565b6100b3565b60405161006691906109e3565b60405180910390f35b61008261007d36600461072c565b6101c7565b6040516100669190610919565b6100a261009d3660046107f3565b610446565b604051610066959493929190610a30565b60608167ffffffffffffffff811180156100cc57600080fd5b506040519080825280602002602001820160405280156100f6578160200160208202803683370190505b50905060005b828110156101bf57846001600160a01b0316639ae697bf85858481811061011f57fe5b9050602002016020810190610134919061072c565b6040518263ffffffff1660e01b81526004016101509190610905565b60206040518083038186803b15801561016857600080fd5b505afa15801561017c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a091906108cc565b8282815181106101ac57fe5b60209081029190910101526001016100fc565b509392505050565b6060816001600160a01b031663da35c6646040518163ffffffff1660e01b815260040160206040518083038186803b15801561020257600080fd5b505afa158015610216573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061023a91906108cc565b67ffffffffffffffff8111801561025057600080fd5b5060405190808252806020026020018201604052801561028a57816020015b6102776106e2565b81526020019060019003908161026f5790505b50905060005b8151811015610440576000806000806000806000808a6001600160a01b031663013cf08b8a6001016040518263ffffffff1660e01b81526004016102d49190610a27565b6101006040518083038186803b1580156102ed57600080fd5b505afa158015610301573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610325919061076b565b97509750975097509750975097509750604051806101200160405280896001600160a01b03168152602001886001600160a01b03168152602001878152602001868152602001858152602001848152602001831515815260200182151581526020018c6001600160a01b0316633e4f49e68c6001016040518263ffffffff1660e01b81526004016103b69190610a27565b60206040518083038186803b1580156103ce57600080fd5b505afa1580156103e2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061040691906108ad565b600681111561041157fe5b8152508a8a8151811061042057fe5b602002602001018190525050505050505050508080600101915050610290565b50919050565b6000806000806000866001600160a01b0316639ae697bf876040518263ffffffff1660e01b815260040161047a9190610905565b60206040518083038186803b15801561049257600080fd5b505afa1580156104a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ca91906108cc565b6040516317977c6160e01b81529095506001600160a01b038816906317977c61906104f9908990600401610905565b60206040518083038186803b15801561051157600080fd5b505afa158015610525573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054991906108cc565b935083156105db57604051631f27a4f360e11b81526001600160a01b03881690633e4f49e69061057d908790600401610a27565b60206040518083038186803b15801561059557600080fd5b505afa1580156105a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105cd91906108ad565b60068111156105d857fe5b92505b60405163a72edda360e01b81526001600160a01b0388169063a72edda390610607908990600401610905565b60206040518083038186803b15801561061f57600080fd5b505afa158015610633573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065791906108cc565b604051631976849960e21b81529092506001600160a01b038816906365da126490610686908990600401610905565b60206040518083038186803b15801561069e57600080fd5b505afa1580156106b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d6919061074f565b90509295509295909350565b6040805161012081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290529061010082015290565b60006020828403121561073d578081fd5b813561074881610a5c565b9392505050565b600060208284031215610760578081fd5b815161074881610a5c565b600080600080600080600080610100898b031215610787578384fd5b885161079281610a5c565b60208a01519098506107a381610a5c565b8097505060408901519550606089015194506080890151935060a0890151925060c08901516107d181610a74565b60e08a01519092506107e281610a74565b809150509295985092959890939650565b60008060408385031215610805578182fd5b823561081081610a5c565b9150602083013561082081610a5c565b809150509250929050565b60008060006040848603121561083f578283fd5b833561084a81610a5c565b9250602084013567ffffffffffffffff80821115610866578384fd5b818601915086601f830112610879578384fd5b813581811115610887578485fd5b876020808302850101111561089a578485fd5b6020830194508093505050509250925092565b6000602082840312156108be578081fd5b815160078110610748578182fd5b6000602082840312156108dd578081fd5b5051919050565b6001600160a01b03169052565b15159052565b6007811061090157fe5b9052565b6001600160a01b0391909116815260200190565b602080825282518282018190526000919060409081850190868401855b828110156109d657815180516001600160a01b031685528681015161095d888701826108e4565b508086015185870152606080820151908601526080808201519086015260a0808201519086015260c080820151610996828801826108f1565b505060e0808201516109aa828801826108f1565b505061010090810151906109c0868201836108f7565b5050610120939093019290850190600101610936565b5091979650505050505050565b6020808252825182820181905260009190848201906040850190845b81811015610a1b578351835292840192918401916001016109ff565b50909695505050505050565b90815260200190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b6001600160a01b0381168114610a7157600080fd5b50565b8015158114610a7157600080fdfea2646970667358221220c68e065ff95a2c91c1e5904ff4ba8c709291d5227b10049b437e89d35c33af4d64736f6c634300060c0033";class Nf extends Ya{constructor(...e){e.length>1?super(...e):super(Cf,Sf,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=Sf;static abi=Cf;static createInterface(){return new ba(Cf)}static connect(e,t){return new Wa(e,Cf,t)}}var Df=Object.freeze({__proto__:null,Aggregator__factory:Af,GovernanceAggregator__factory:Nf,relayerAggregatorSol:Of});const Uf=[{inputs:[{internalType:"contract IDeployer",name:"_deployer",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!0,internalType:"address",name:"addr",type:"address"}],name:"Deployed",type:"event"},{inputs:[{internalType:"bytes",name:"_initCode",type:"bytes"},{internalType:"bytes32",name:"_salt",type:"bytes32"}],name:"deploy",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"deployer",outputs:[{internalType:"contract IDeployer",name:"",type:"address"}],stateMutability:"view",type:"function"}],Vf="0x60a060405234801561001057600080fd5b506040516103a93803806103a98339818101604052602081101561003357600080fd5b50516001600160a01b0381161561004a5780610060565b73ce0042b868300000d44a59004da54a005ffdcf9f5b60601b6001600160601b031916608052604051309032907f09e48df7857bd0c1e0d31bb8a85d42cf1874817895f171c917f6ee2cea73ec2090600090a35060805160601c6102e96100c06000398061010d528061029152506102e96000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80634af63f021461003b578063d5f39488146100e5575b600080fd5b6100e36004803603604081101561005157600080fd5b81019060208101813564010000000081111561006c57600080fd5b82018360208201111561007e57600080fd5b803590602001918460018302840111640100000000831117156100a057600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610109915050565b005b6100ed61028f565b604080516001600160a01b039092168252519081900360200190f35b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634af63f0284846040518363ffffffff1660e01b81526004018080602001838152602001828103825284818151815260200191508051906020019080838360005b8381101561018e578181015183820152602001610176565b50505050905090810190601f1680156101bb5780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b1580156101db57600080fd5b505af11580156101ef573d6000803e3d6000fd5b505050506040513d602081101561020557600080fd5b505190506001600160a01b038116610254576040805162461bcd60e51b815260206004820152600d60248201526c11195c1b1bde4819985a5b1959609a1b604482015290519081900360640190fd5b6040516001600160a01b0382169033907f09e48df7857bd0c1e0d31bb8a85d42cf1874817895f171c917f6ee2cea73ec2090600090a3505050565b7f00000000000000000000000000000000000000000000000000000000000000008156fea26469706673582212209824ac82969e56106968b899123a2ecac48f942b4ed3dcae2ced58022879d32364736f6c634300060c0033";class Ff extends Ya{constructor(...e){e.length>1?super(...e):super(Uf,Vf,e[0])}getDeployTransaction(e,t){return super.getDeployTransaction(e,t||{})}deploy(e,t){return super.deploy(e,t||{})}connect(e){return super.connect(e)}static bytecode=Vf;static abi=Uf;static createInterface(){return new ba(Uf)}static connect(e,t){return new Wa(e,Uf,t)}}const Lf=[{inputs:[{internalType:"bytes",name:"_initCode",type:"bytes"},{internalType:"bytes32",name:"_salt",type:"bytes32"}],name:"deploy",outputs:[{internalType:"address payable",name:"createdContract",type:"address"}],stateMutability:"nonpayable",type:"function"}];var Gf=Object.freeze({__proto__:null,Deployer__factory:Ff,IDeployer__factory:class{static abi=Lf;static createInterface(){return new ba(Lf)}static connect(e,t){return new Wa(e,Lf,t)}}});const Bf=[{inputs:[{internalType:"contract IERC20",name:"_token",type:"address"},{internalType:"address",name:"_spender",type:"address"},{internalType:"uint256",name:"_amount",type:"uint256"}],name:"approveExactToken",outputs:[],stateMutability:"nonpayable",type:"function"}];class jf{static abi=Bf;static createInterface(){return new ba(Bf)}static connect(e,t){return new Wa(e,Bf,t)}}const Hf=[{inputs:[{internalType:"address",name:"_governance",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"contract ITornadoInstance",name:"instance",type:"address"},{indexed:!1,internalType:"enum InstanceRegistry.InstanceState",name:"state",type:"uint8"}],name:"InstanceStateUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"tornadoRouter",type:"address"}],name:"RouterRegistered",type:"event"},{inputs:[],name:"getAllInstanceAddresses",outputs:[{internalType:"contract ITornadoInstance[]",name:"result",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getAllInstances",outputs:[{components:[{internalType:"contract ITornadoInstance",name:"addr",type:"address"},{components:[{internalType:"bool",name:"isERC20",type:"bool"},{internalType:"contract IERC20",name:"token",type:"address"},{internalType:"enum InstanceRegistry.InstanceState",name:"state",type:"uint8"},{internalType:"uint24",name:"uniswapPoolSwappingFee",type:"uint24"},{internalType:"uint32",name:"protocolFeePercentage",type:"uint32"}],internalType:"struct InstanceRegistry.Instance",name:"instance",type:"tuple"}],internalType:"struct InstanceRegistry.Tornado[]",name:"result",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract ITornadoInstance",name:"instance",type:"address"}],name:"getPoolToken",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"governance",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"contract ITornadoInstance",name:"addr",type:"address"},{components:[{internalType:"bool",name:"isERC20",type:"bool"},{internalType:"contract IERC20",name:"token",type:"address"},{internalType:"enum InstanceRegistry.InstanceState",name:"state",type:"uint8"},{internalType:"uint24",name:"uniswapPoolSwappingFee",type:"uint24"},{internalType:"uint32",name:"protocolFeePercentage",type:"uint32"}],internalType:"struct InstanceRegistry.Instance",name:"instance",type:"tuple"}],internalType:"struct InstanceRegistry.Tornado[]",name:"_instances",type:"tuple[]"},{internalType:"address",name:"_router",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"instanceIds",outputs:[{internalType:"contract ITornadoInstance",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract ITornadoInstance",name:"",type:"address"}],name:"instances",outputs:[{internalType:"bool",name:"isERC20",type:"bool"},{internalType:"contract IERC20",name:"token",type:"address"},{internalType:"enum InstanceRegistry.InstanceState",name:"state",type:"uint8"},{internalType:"uint24",name:"uniswapPoolSwappingFee",type:"uint24"},{internalType:"uint32",name:"protocolFeePercentage",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_instanceId",type:"uint256"}],name:"removeInstance",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"router",outputs:[{internalType:"contract ITornadoRouter",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract ITornadoInstance",name:"instance",type:"address"},{internalType:"uint32",name:"newFee",type:"uint32"}],name:"setProtocolFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"routerAddress",type:"address"}],name:"setTornadoRouter",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"contract ITornadoInstance",name:"addr",type:"address"},{components:[{internalType:"bool",name:"isERC20",type:"bool"},{internalType:"contract IERC20",name:"token",type:"address"},{internalType:"enum InstanceRegistry.InstanceState",name:"state",type:"uint8"},{internalType:"uint24",name:"uniswapPoolSwappingFee",type:"uint24"},{internalType:"uint32",name:"protocolFeePercentage",type:"uint32"}],internalType:"struct InstanceRegistry.Instance",name:"instance",type:"tuple"}],internalType:"struct InstanceRegistry.Tornado",name:"_tornado",type:"tuple"}],name:"updateInstance",outputs:[],stateMutability:"nonpayable",type:"function"}],zf="0x60a060405234801561001057600080fd5b5060405161146738038061146783398101604081905261002f91610044565b60601b6001600160601b031916608052610072565b600060208284031215610055578081fd5b81516001600160a01b038116811461006b578182fd5b9392505050565b60805160601c6113c46100a3600039806103e552806105c052806105ed528061073a52806107e652506113c46000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80636c9be937116100715780636c9be9371461014d578063908e3b371461016057806392b65a4114610173578063b5b899b714610186578063cf552c8914610199578063f887ea40146101ac576100b4565b8063032bb443146100b957806310c13ac3146100e65780631ad058a9146100fb5780634ba16d9d1461011057806352c228e3146101235780635aa6e67514610138575b600080fd5b6100cc6100c7366004610e89565b6101b4565b6040516100dd959493929190611194565b60405180910390f35b6100ee6101fe565b6040516100dd9190611097565b61010e610109366004610ec8565b6102af565b005b61010e61011e366004610e89565b6103da565b61012b61047f565b6040516100dd91906110e4565b6101406105be565b6040516100dd9190611069565b61010e61015b366004610fd3565b6105e2565b61014061016e366004610e89565b610709565b61010e610181366004610f80565b61072f565b610140610194366004611005565b6107b4565b61010e6101a7366004611005565b6107db565b610140610a77565b60016020526000908152604090205460ff8082169161010081046001600160a01b031691600160a81b82041690600160b01b810462ffffff1690600160c81b900463ffffffff1685565b60025460609067ffffffffffffffff8111801561021a57600080fd5b50604051908082528060200260200182016040528015610244578160200160208202803683370190505b50905060005b6002548110156102ab576002818154811061026157fe5b9060005260206000200160009054906101000a90046001600160a01b031682828151811061028b57fe5b6001600160a01b039092166020928302919091019091015260010161024a565b5090565b600054610100900460ff16806102c857506102c8610a8c565b806102d6575060005460ff16155b6102fb5760405162461bcd60e51b81526004016102f290611214565b60405180910390fd5b600054610100900460ff16158015610326576000805460ff1961ff0019909116610100171660011790555b6000805462010000600160b01b031916620100006001600160a01b038516021781555b83518110156103c25761036e84828151811061036157fe5b6020026020010151610a92565b600284828151811061037c57fe5b6020908102919091018101515182546001808201855560009485529290932090920180546001600160a01b0319166001600160a01b039093169290921790915501610349565b5080156103d5576000805461ff00191690555b505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104225760405162461bcd60e51b81526004016102f2906112c2565b6000805462010000600160b01b031916620100006001600160a01b038416021790556040517f94df8c3a8087dce110e5fbc5acf380c83c94bbd31b2c8ed4c08e1396a696e1a890610474908390611069565b60405180910390a150565b60025460609067ffffffffffffffff8111801561049b57600080fd5b506040519080825280602002602001820160405280156104d557816020015b6104c2610d64565b8152602001906001900390816104ba5790505b50905060005b6002548110156102ab576000600282815481106104f457fe5b60009182526020808320909101546040805180820182526001600160a01b03928316808252808652600180865295839020835160a081018552815460ff8082161515835261010082049097168289015292985092969587019592949093850192600160a81b909204169081111561056757fe5b600181111561057257fe5b81529054600160b01b810462ffffff166020830152600160c81b900463ffffffff16604090910152905283518490849081106105aa57fe5b6020908102919091010152506001016104db565b7f000000000000000000000000000000000000000000000000000000000000000081565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461062a5760405162461bcd60e51b81526004016102f2906112c2565b600061063c6080830160608401610fb8565b600181111561064757fe5b14156106655760405162461bcd60e51b81526004016102f29061128b565b6000600160006106786020850185610e89565b6001600160a01b03168152602081019190915260400160002054600160a81b900460ff1660018111156106a757fe5b14156106ef5760026106bc6020830183610e89565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b039092169190911790555b61070661070136839003830183610fea565b610a92565b50565b6001600160a01b038082166000908152600160205260409020546101009004165b919050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146107775760405162461bcd60e51b81526004016102f2906112c2565b6001600160a01b039091166000908152600160205260409020805463ffffffff909216600160c81b0263ffffffff60c81b19909216919091179055565b600281815481106107c157fe5b6000918252602090912001546001600160a01b0316905081565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108235760405162461bcd60e51b81526004016102f2906112c2565b60006002828154811061083257fe5b60009182526020808320909101546001600160a01b03908116808452600190925260409092205490925060ff8116916101009091041681156109705760008054604051636eb1769f60e11b81526001600160a01b038085169263dd62ed3e926108aa926201000090920490911690889060040161107d565b60206040518083038186803b1580156108c257600080fd5b505afa1580156108d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108fa919061101d565b9050801561096e5760008054604051633ef1078360e01b8152620100009091046001600160a01b031691633ef107839161093b9186918991906004016111db565b600060405180830381600087803b15801561095557600080fd5b505af1158015610969573d6000803e3d6000fd5b505050505b505b6001600160a01b038316600090815260016020526040902080546001600160e81b03191690556002805460001981019081106109a857fe5b600091825260209091200154600280546001600160a01b0390921691869081106109ce57fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506002805480610a0757fe5b6001900381819060005260206000200160006101000a8154906001600160a01b0302191690559055826001600160a01b03167f02826f62d88a4d9f1978eb9c06f8663f642d032908e65a915d5898f3585421c06000604051610a6991906111ff565b60405180910390a250505050565b6000546201000090046001600160a01b031681565b303b1590565b60208181015182516001600160a01b0390811660009081526001808552604091829020845181549686015160ff1990971690151517610100600160a81b0319166101009690941695909502929092178085559083015192939291839160ff60a81b191690600160a81b908490811115610b0757fe5b02179055506060820151815460809093015163ffffffff16600160c81b0263ffffffff60c81b1962ffffff909216600160b01b0262ffffff60b01b19909416939093171691909117905560208101515115610d1457600081600001516001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b158015610b9b57600080fd5b505afa158015610baf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd39190610eac565b90508160200151602001516001600160a01b0316816001600160a01b031614610c0e5760405162461bcd60e51b81526004016102f290611262565b600080548351604051636eb1769f60e11b81526001600160a01b038086169363dd62ed3e93610c4b9362010000909204909216919060040161107d565b60206040518083038186803b158015610c6357600080fd5b505afa158015610c77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9b919061101d565b905080610d11576000548351604051633ef1078360e01b8152620100009092046001600160a01b031691633ef1078391610cde91869190600019906004016111db565b600060405180830381600087803b158015610cf857600080fd5b505af1158015610d0c573d6000803e3d6000fd5b505050505b50505b80600001516001600160a01b03167f02826f62d88a4d9f1978eb9c06f8663f642d032908e65a915d5898f3585421c0826020015160400151604051610d5991906111ff565b60405180910390a250565b604051806040016040528060006001600160a01b03168152602001610d87610d8c565b905290565b6040805160a0810182526000808252602082018190529091820190815260006020820181905260409091015290565b8035610dc681611348565b92915050565b803560028110610dc657600080fd5b600081830360c0811215610ded578182fd5b610df760406112ea565b91508235610e0481611348565b825260a0601f1982011215610e1857600080fd5b50610e2360a06112ea565b6020830135610e318161135d565b81526040830135610e4181611348565b6020820152610e538460608501610dcc565b60408201526080830135610e668161136b565b606082015260a0830135610e798161137c565b6080820152602082015292915050565b600060208284031215610e9a578081fd5b8135610ea581611348565b9392505050565b600060208284031215610ebd578081fd5b8151610ea581611348565b60008060408385031215610eda578081fd5b823567ffffffffffffffff811115610ef0578182fd5b8301601f81018513610f00578182fd5b8035610f13610f0e82611311565b6112ea565b808282526020808301925080850160c08a838288028901011115610f35578788fd5b8796505b85871015610f6157610f4b8b83610ddb565b8552600196909601959382019390810190610f39565b5050819650610f7289828a01610dbb565b955050505050509250929050565b60008060408385031215610f92578182fd5b8235610f9d81611348565b91506020830135610fad8161137c565b809150509250929050565b600060208284031215610fc9578081fd5b610ea58383610dcc565b600060c08284031215610fe4578081fd5b50919050565b600060c08284031215610ffb578081fd5b610ea58383610ddb565b600060208284031215611016578081fd5b5035919050565b60006020828403121561102e578081fd5b5051919050565b15159052565b6001600160a01b03169052565b6002811061105257fe5b9052565b62ffffff169052565b63ffffffff169052565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6020808252825182820181905260009190848201906040850190845b818110156110d85783516001600160a01b0316835292840192918401916001016110b3565b50909695505050505050565b602080825282518282018190526000919060409081850190868401855b828110156111875781516111158151611331565b855286015180516111299088870190611035565b868101516111398787018261103b565b5085810151606061114c81880183611048565b8201519050608061115f87820183611056565b9190910151905061117360a086018261105f565b5060c0939093019290850190600101611101565b5091979650505050505050565b85151581526001600160a01b038516602082015260a081016111b58561133d565b604083015262ffffff8416606083015263ffffffff831660808301529695505050505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6020810161120c8361133d565b825292915050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252600f908201526e24b731b7b93932b1ba103a37b5b2b760891b604082015260600190565b6020808252601f908201527f5573652072656d6f7665496e7374616e6365282920666f722072656d6f766500604082015260600190565b6020808252600e908201526d139bdd08185d5d1a1bdc9a5e995960921b604082015260600190565b60405181810167ffffffffffffffff8111828210171561130957600080fd5b604052919050565b600067ffffffffffffffff821115611327578081fd5b5060209081020190565b6001600160a01b031690565b806002811061072a57fe5b6001600160a01b038116811461070657600080fd5b801515811461070657600080fd5b62ffffff8116811461070657600080fd5b63ffffffff8116811461070657600080fdfea26469706673582212207c46c875176b62100d16a46c273e615cd9eb5336dbcd238b33b227f39ff9106564736f6c634300060c0033";class Wf extends Ya{constructor(...e){e.length>1?super(...e):super(Hf,zf,e[0])}getDeployTransaction(e,t){return super.getDeployTransaction(e,t||{})}deploy(e,t){return super.deploy(e,t||{})}connect(e){return super.connect(e)}static bytecode=zf;static abi=Hf;static createInterface(){return new ba(Hf)}static connect(e,t){return new Wa(e,Hf,t)}}var $f=Object.freeze({__proto__:null,ITornadoRouter__factory:jf,InstanceRegistry__factory:Wf});const Xf=[{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}];class qf{static abi=Xf;static createInterface(){return new ba(Xf)}static connect(e,t){return new Wa(e,Xf,t)}}const Jf=[{inputs:[{internalType:"contract ITornadoInstance",name:"_instance",type:"address"}],name:"instanceFeeWithUpdate",outputs:[{internalType:"uint160",name:"",type:"uint160"}],stateMutability:"nonpayable",type:"function"}];class Yf{static abi=Jf;static createInterface(){return new ba(Jf)}static connect(e,t){return new Wa(e,Jf,t)}}const Kf=[{inputs:[{internalType:"address",name:"_torn",type:"address"},{internalType:"address",name:"_governance",type:"address"},{internalType:"address",name:"_ens",type:"address"},{internalType:"address",name:"_staking",type:"address"},{internalType:"address",name:"_feeManager",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"minStakeAmount",type:"uint256"}],name:"MinimumStakeAmount",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"relayer",type:"address"}],name:"RelayerBalanceNullified",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"relayer",type:"bytes32"},{indexed:!1,internalType:"string",name:"ensName",type:"string"},{indexed:!1,internalType:"address",name:"relayerAddress",type:"address"},{indexed:!1,internalType:"uint256",name:"stakedAmount",type:"uint256"}],name:"RelayerRegistered",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"relayer",type:"address"}],name:"RelayerUnregistered",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"tornadoRouter",type:"address"}],name:"RouterRegistered",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"relayer",type:"address"},{indexed:!1,internalType:"uint256",name:"amountStakeAdded",type:"uint256"}],name:"StakeAddedToRelayer",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"relayer",type:"address"},{indexed:!1,internalType:"uint256",name:"amountBurned",type:"uint256"}],name:"StakeBurned",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"relayer",type:"address"},{indexed:!1,internalType:"address",name:"worker",type:"address"}],name:"WorkerRegistered",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"relayer",type:"address"},{indexed:!1,internalType:"address",name:"worker",type:"address"}],name:"WorkerUnregistered",type:"event"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"relayer",type:"address"},{internalType:"contract ITornadoInstance",name:"pool",type:"address"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"ens",outputs:[{internalType:"contract IENS",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"feeManager",outputs:[{internalType:"contract IFeeManager",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"relayer",type:"address"}],name:"getRelayerBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"relayer",type:"address"}],name:"getRelayerEnsHash",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"governance",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_tornadoRouter",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"toResolve",type:"address"}],name:"isRelayer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"relayer",type:"address"},{internalType:"address",name:"toResolve",type:"address"}],name:"isRelayerRegistered",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"minStakeAmount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"relayer",type:"address"}],name:"nullifyBalance",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"ensName",type:"string"},{internalType:"uint256",name:"stake",type:"uint256"},{internalType:"address[]",name:"workersToRegister",type:"address[]"}],name:"register",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"ensName",type:"string"},{internalType:"uint256",name:"stake",type:"uint256"},{internalType:"address[]",name:"workersToRegister",type:"address[]"},{internalType:"address",name:"relayer",type:"address"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"registerPermit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"relayer",type:"address"},{internalType:"address",name:"worker",type:"address"}],name:"registerWorker",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"relayers",outputs:[{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"bytes32",name:"ensHash",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"minAmount",type:"uint256"}],name:"setMinStakeAmount",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"tornadoRouterAddress",type:"address"}],name:"setTornadoRouter",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"relayer",type:"address"},{internalType:"uint256",name:"stake",type:"uint256"}],name:"stakeToRelayer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"relayer",type:"address"},{internalType:"uint256",name:"stake",type:"uint256"},{internalType:"address",name:"staker",type:"address"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"stakeToRelayerPermit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"staking",outputs:[{internalType:"contract TornadoStakingRewards",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"torn",outputs:[{internalType:"contract TORN",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"tornadoRouter",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"relayer",type:"address"}],name:"unregisterRelayer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"worker",type:"address"}],name:"unregisterWorker",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"workers",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}],Zf="0x6101206040523480156200001257600080fd5b5060405162001fab38038062001fab83398101604081905262000035916200006d565b6001600160601b0319606095861b811660805293851b841660a05291841b831660c052831b821660e05290911b166101005262000105565b600080600080600060a0868803121562000085578081fd5b85516200009281620000ec565b6020870151909550620000a581620000ec565b6040870151909450620000b881620000ec565b6060870151909350620000cb81620000ec565b6080870151909250620000de81620000ec565b809150509295509295909350565b6001600160a01b03811681146200010257600080fd5b50565b60805160601c60a05160601c60c05160601c60e05160601c6101005160601c611e1662000195600039806106785280610bf352508061075452806108af5280610ea852806111685250806105625280610f99525080610351528061080952806108dc52806109e75280610ce4525080610a205280610aa95280610c375280610e8552806111455250611e166000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c80635aa6e675116100de578063c4d66de811610097578063e37e8bcc11610071578063e37e8bcc14610305578063e43fdb3c14610318578063eb4af0451461032b578063f18876841461033e57610173565b8063c4d66de8146102d7578063d0fb0203146102ea578063d990231d146102f257610173565b80635aa6e6751461026e57806385a2968314610276578063adf898a414610289578063ae53941c14610291578063b69fd4ab146102b1578063b971a6bf146102c457610173565b80634ba16d9d116101305780634ba16d9d146101f75780634cb16c2e1461020a5780634cf088d9146102125780634d4efd041461021a5780635300f8411461022d578063541d55481461024e57610173565b806314d92307146101785780632e6506491461018d5780633523dc85146101a05780633f15457f146101b35780634048a257146101d157806345a11cec146101e4575b600080fd5b61018b610186366004611612565b610346565b005b61018b61019b36600461164a565b610414565b61018b6101ae366004611612565b610460565b6101bb610560565b6040516101c891906118f5565b60405180910390f35b6101bb6101df366004611612565b610584565b61018b6101f2366004611682565b61059f565b61018b610205366004611612565b6107fe565b6101bb610898565b6101bb6108ad565b61018b610228366004611612565b6108d1565b61024061023b366004611612565b6109ac565b6040516101c89291906118cb565b61026161025c366004611612565b6109c5565b6040516101c891906119a1565b6101bb6109e5565b61018b6102843660046116f7565b610a09565b6101bb610aa7565b6102a461029f366004611612565b610acb565b6040516101c891906119ac565b6102616102bf36600461164a565b610af9565b6102a46102d2366004611612565b610b20565b61018b6102e5366004611612565b610b4b565b6101bb610bf1565b61018b6103003660046116cc565b610c15565b61018b6103133660046117fc565b610c20565b61018b610326366004611785565b610cc4565b61018b6103393660046118b3565b610cd9565b6102a4610d56565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146103975760405162461bcd60e51b815260040161038e90611ae4565b60405180910390fd5b6103a0816108d1565b6001600160a01b038116600090815260026020908152604080832083815560010183905560039091529081902080546001600160a01b0319169055517f490a66cc56c789979052c7052fc0c10a6c4627d8e6165caec80db97a4c383521906104099083906118f5565b60405180910390a150565b3360008181526003602052604090205483906001600160a01b038083169116146104505760405162461bcd60e51b815260040161038e90611c83565b61045a8484610d5c565b50505050565b6001600160a01b03811633146104a9576001600160a01b038181166000908152600360205260409020541633146104a95760405162461bcd60e51b815260040161038e90611cd8565b6001600160a01b0380821660008181526003602052604090205490911614156104e45760405162461bcd60e51b815260040161038e90611b8b565b6001600160a01b03808216600090815260036020526040908190205490517fb2a8e18b9e887f502d65c1683e60b723fa582a6903ea4e8eb23907a19c1ce8a0926105319216908490611909565b60405180910390a16001600160a01b0316600090815260036020526040902080546001600160a01b0319169055565b7f000000000000000000000000000000000000000000000000000000000000000081565b6003602052600090815260409020546001600160a01b031681565b6000546201000090046001600160a01b031633146105cf5760405162461bcd60e51b815260040161038e90611a64565b6001600160a01b03808416600090815260036020526040902054168061062d576001600160a01b0383811660009081526003602052604090205416156106275760405162461bcd60e51b815260040161038e90611be8565b506107f9565b826001600160a01b0316816001600160a01b03161461065e5760405162461bcd60e51b815260040161038e90611c83565b604051630bbefce160e21b81526000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690632efbf384906106ad9086906004016118f5565b602060405180830381600087803b1580156106c757600080fd5b505af11580156106db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ff919061162e565b6001600160a01b03858116600090815260026020526040902054911691506107279082610df5565b6001600160a01b038086166000908152600260205260409081902092909255905163338610af60e01b81527f00000000000000000000000000000000000000000000000000000000000000009091169063338610af9061078b9084906004016119ac565b600060405180830381600087803b1580156107a557600080fd5b505af11580156107b9573d6000803e3d6000fd5b505050507f659f33fc6677bebf3a9bf3101092792e31f35766d0358e54577bdd91a655f6a084826040516107ee929190611988565b60405180910390a150505b505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108465760405162461bcd60e51b815260040161038e90611ae4565b6000805462010000600160b01b031916620100006001600160a01b038416021790556040517f94df8c3a8087dce110e5fbc5acf380c83c94bbd31b2c8ed4c08e1396a696e1a8906104099083906118f5565b6000546201000090046001600160a01b031681565b7f000000000000000000000000000000000000000000000000000000000000000081565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109195760405162461bcd60e51b815260040161038e90611ae4565b6001600160a01b038082166000818152600360205260409020549091169081146109555760405162461bcd60e51b815260040161038e90611d74565b6001600160a01b03811660009081526002602052604080822091909155517fafa759fb3c68e89eaaba359f0930ab40c24875b73cc9e2f6a38b0180019eb8f3906109a09084906118f5565b60405180910390a15050565b6002602052600090815260409020805460019091015482565b6001600160a01b0390811660009081526003602052604090205416151590565b7f000000000000000000000000000000000000000000000000000000000000000081565b60405163d505accf60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d505accf90610a6190889030908b908a908a908a908a90600401611947565b600060405180830381600087803b158015610a7b57600080fd5b505af1158015610a8f573d6000803e3d6000fd5b50505050610a9e858888610e3e565b50505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001600160a01b03908116600090815260036020908152604080832054909316825260029052206001015490565b6001600160a01b038181166000908152600360205260409020548116908316145b92915050565b6001600160a01b03908116600090815260036020908152604080832054909316825260029052205490565b600054610100900460ff1680610b645750610b64610f4c565b80610b72575060005460ff16155b610b8e5760405162461bcd60e51b815260040161038e90611b3d565b600054610100900460ff16158015610bb9576000805460ff1961ff0019909116610100171660011790555b6000805462010000600160b01b031916620100006001600160a01b038516021790558015610bed576000805461ff00191690555b5050565b7f000000000000000000000000000000000000000000000000000000000000000081565b610bed338383610e3e565b60405163d505accf60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d505accf90610c7890889030908d908a908a908a908a90600401611947565b600060405180830381600087803b158015610c9257600080fd5b505af1158015610ca6573d6000803e3d6000fd5b50505050610cb8858b8b8b8b8b610f52565b50505050505050505050565b610cd2338686868686610f52565b5050505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610d215760405162461bcd60e51b815260040161038e90611ae4565b60018190556040517f404663163d528ec45288abc4389b81bd96fabf858ff57577ebd4ee7f15d7b0a6906104099083906119ac565b60015481565b6001600160a01b038181166000908152600360205260409020541615610d945760405162461bcd60e51b815260040161038e90611b0d565b6001600160a01b038181166000908152600360205260409081902080546001600160a01b03191692851692909217909155517fcde75bd02c5f739608c891bcd9aa6809e6c4a7035ac7b9f3fd5fea756db74724906109a09084908490611909565b6000610e3783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611287565b9392505050565b6001600160a01b0380831660008181526003602052604090205490911614610e785760405162461bcd60e51b815260040161038e90611abf565b610ecd6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016847f0000000000000000000000000000000000000000000000000000000000000000846112b3565b6001600160a01b038216600090815260026020526040902054610ef190829061130b565b6001600160a01b0383166000908152600260205260409081902091909155517f1275dbe2a271b2b822e60f1d44894fa5fb337e7e2dc6a200205b1a5b17c07d6490610f3f9084908490611988565b60405180910390a1505050565b303b1590565b6000610f9386868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061133092505050565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166302571be3836040518263ffffffff1660e01b8152600401610fe391906119ac565b60206040518083038186803b158015610ffb57600080fd5b505afa15801561100f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611033919061162e565b905073d4416b13d2b3a9abae7acd5d6c2bbdbe256864016001600160a01b0382168114156110735760405162461bcd60e51b815260040161038e90611c15565b816001600160a01b0316896001600160a01b0316146110a45760405162461bcd60e51b815260040161038e90611ca9565b6001600160a01b0389811660009081526003602052604090205416156110dc5760405162461bcd60e51b815260040161038e90611bbb565b6001600160a01b03891660009081526002602052604090206001810154156111165760405162461bcd60e51b815260040161038e90611a38565b6001548710156111385760405162461bcd60e51b815260040161038e90611d50565b61118d6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168b7f00000000000000000000000000000000000000000000000000000000000000008a6112b3565b7f1275dbe2a271b2b822e60f1d44894fa5fb337e7e2dc6a200205b1a5b17c07d648a886040516111be929190611988565b60405180910390a1868155600181018490556001600160a01b038a16600081815260036020526040812080546001600160a01b0319169092179091555b8581101561123b57600087878381811061121157fe5b90506020020160208101906112269190611612565b90506112328c82610d5c565b506001016111fb565b507f9ca7c9c762eff27b021608f232b4c4b8f9b8bf9a3d322297e47cc4209a67d5e2848a8a8d8b6040516112739594939291906119b5565b60405180910390a150505050505050505050565b600081848411156112ab5760405162461bcd60e51b815260040161038e9190611a05565b505050900390565b61045a846323b872dd60e01b8585856040516024016112d493929190611923565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261133d565b600082820183811015610e375760405162461bcd60e51b815260040161038e90611a88565b6000610b1a8260006113cc565b6060611392826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166114369092919063ffffffff16565b8051909150156107f957808060200190518101906113b09190611765565b6107f95760405162461bcd60e51b815260040161038e90611d06565b6000818351116113de57506000610b1a565b60006113ea848461144d565b90506113fb848285016001016113cc565b611406858584611492565b6040516020016114179291906118cb565b6040516020818303038152906040528051906020012091505092915050565b606061144584846000856114ae565b949350505050565b6000805b8351818401141580156114855750838184018151811061146d57fe5b6020910101516001600160f81b031916601760f91b14155b15610e3757600101611451565b6000835182840111156114a457600080fd5b5091016020012090565b60606114b985611572565b6114d55760405162461bcd60e51b815260040161038e90611c4c565b60006060866001600160a01b031685876040516114f291906118d9565b60006040518083038185875af1925050503d806000811461152f576040519150601f19603f3d011682016040523d82523d6000602084013e611534565b606091505b509150915081156115485791506114459050565b8051156115585780518082602001fd5b8360405162461bcd60e51b815260040161038e9190611a05565b3b151590565b60008083601f840112611589578182fd5b50813567ffffffffffffffff8111156115a0578182fd5b60208301915083602080830285010111156115ba57600080fd5b9250929050565b60008083601f8401126115d2578182fd5b50813567ffffffffffffffff8111156115e9578182fd5b6020830191508360208285010111156115ba57600080fd5b803560ff81168114610b1a57600080fd5b600060208284031215611623578081fd5b8135610e3781611dc8565b60006020828403121561163f578081fd5b8151610e3781611dc8565b6000806040838503121561165c578081fd5b823561166781611dc8565b9150602083013561167781611dc8565b809150509250929050565b600080600060608486031215611696578081fd5b83356116a181611dc8565b925060208401356116b181611dc8565b915060408401356116c181611dc8565b809150509250925092565b600080604083850312156116de578182fd5b82356116e981611dc8565b946020939093013593505050565b600080600080600080600060e0888a031215611711578283fd5b873561171c81611dc8565b965060208801359550604088013561173381611dc8565b9450606088013593506117498960808a01611601565b925060a0880135915060c0880135905092959891949750929550565b600060208284031215611776578081fd5b81518015158114610e37578182fd5b60008060008060006060868803121561179c578081fd5b853567ffffffffffffffff808211156117b3578283fd5b6117bf89838a016115c1565b90975095506020880135945060408801359150808211156117de578283fd5b506117eb88828901611578565b969995985093965092949392505050565b6000806000806000806000806000806101008b8d03121561181b578283fd5b8a3567ffffffffffffffff80821115611832578485fd5b61183e8e838f016115c1565b909c509a5060208d0135995060408d013591508082111561185d578485fd5b5061186a8d828e01611578565b90985096505060608b013561187e81611dc8565b945060808b013593506118948c60a08d01611601565b925060c08b0135915060e08b013590509295989b9194979a5092959850565b6000602082840312156118c4578081fd5b5035919050565b918252602082015260400190565b600082516118eb818460208701611d9c565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b90815260200190565b600086825260806020830152846080830152848660a084013760a08583018101919091526001600160a01b039390931660408201526060810191909152601f909201601f19169091010192915050565b6000602082528251806020840152611a24816040850160208701611d9c565b601f01601f19169190910160400192915050565b6020808252601290820152717265676973746572656420616c726561647960701b604082015260600190565b6020808252600a90820152696f6e6c792070726f787960b01b604082015260600190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252600b908201526a085c9959da5cdd195c995960aa1b604082015260600190565b6020808252600f908201526e6f6e6c7920676f7665726e616e636560881b604082015260600190565b60208082526016908201527563616e277420737465616c20616e206164647265737360501b604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526016908201527531b0b73a103ab73932b3b4b9ba32b91036b0b9ba32b960511b604082015260600190565b60208082526013908201527231b0b73a103932b3b4b9ba32b91030b3b0b4b760691b604082015260600190565b60208082526013908201527227b7363c9031bab9ba37b6903932b630bcb2b960691b604082015260600190565b6020808252601a908201527f6f6e6c7920756e7772617070656420656e7320646f6d61696e73000000000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252600c908201526b37b7363c903932b630bcb2b960a11b604082015260600190565b60208082526015908201527437b7363c9032b739903237b6b0b4b71037bbb732b960591b604082015260600190565b60208082526014908201527337b7363c9037bbb732b91037b3103bb7b935b2b960611b604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252600a9082015269216d696e5f7374616b6560b01b604082015260600190565b6020808252600e908201526d36bab9ba1031329036b0b9ba32b960911b604082015260600190565b60005b83811015611db7578181015183820152602001611d9f565b8381111561045a5750506000910152565b6001600160a01b0381168114611ddd57600080fd5b5056fea26469706673582212206f4cc4f67dba9ba55aab193d3511cc31e3b32c37cef7bd7df74b3ebff2b3ca5b64736f6c634300060c0033";class Qf extends Ya{constructor(...e){e.length>1?super(...e):super(Kf,Zf,e[0])}getDeployTransaction(e,t,a,n,b,f){return super.getDeployTransaction(e,t,a,n,b,f||{})}deploy(e,t,a,n,b,f){return super.deploy(e,t,a,n,b,f||{})}connect(e){return super.connect(e)}static bytecode=Zf;static abi=Kf;static createInterface(){return new ba(Kf)}static connect(e,t){return new Wa(e,Kf,t)}}var ed=Object.freeze({__proto__:null,IENS__factory:qf,IFeeManager__factory:Yf,RelayerRegistry__factory:Qf});const td=[{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"resolver",outputs:[{internalType:"contract Resolver",name:"",type:"address"}],stateMutability:"view",type:"function"}];class ad{static abi=td;static createInterface(){return new ba(td)}static connect(e,t){return new Wa(e,td,t)}}const nd=[{inputs:[{internalType:"bytes32[]",name:"domains",type:"bytes32[]"}],name:"bulkResolve",outputs:[{internalType:"address[]",name:"result",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"resolve",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}],bd="0x608060405234801561001057600080fd5b5061036d806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80635c23bdf51461003b578063f9e5423414610074575b600080fd5b6100586004803603602081101561005157600080fd5b5035610167565b604080516001600160a01b039092168252519081900360200190f35b6101176004803603602081101561008a57600080fd5b8101906020810181356401000000008111156100a557600080fd5b8201836020820111156100b757600080fd5b803590602001918460208302840111640100000000831117156100d957600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610292945050505050565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561015357818101518382015260200161013b565b505050509050019250505060405180910390f35b600080610172610333565b60011461019357738595bfb0d940dfedc98943fa8a907091203f25ee6101a4565b6e0c2e074ec69a0dfb2997ba6c7d2e1e5b9050806001600160a01b0316630178b8bf846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156101ea57600080fd5b505afa1580156101fe573d6000803e3d6000fd5b505050506040513d602081101561021457600080fd5b505160408051631d9dabef60e11b81526004810186905290516001600160a01b0390921691633b3b57de91602480820192602092909190829003018186803b15801561025f57600080fd5b505afa158015610273573d6000803e3d6000fd5b505050506040513d602081101561028957600080fd5b50519392505050565b6060815167ffffffffffffffff811180156102ac57600080fd5b506040519080825280602002602001820160405280156102d6578160200160208202803683370190505b50905060005b825181101561032d576103018382815181106102f457fe5b6020026020010151610167565b82828151811061030d57fe5b6001600160a01b03909216602092830291909101909101526001016102dc565b50919050565b469056fea26469706673582212201849a5e31df8347ec61f3d54e8cef603101becea24443df7d4e43cc42ff12a7564736f6c634300060c0033";class fd extends Ya{constructor(...e){e.length>1?super(...e):super(nd,bd,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=bd;static abi=nd;static createInterface(){return new ba(nd)}static connect(e,t){return new Wa(e,nd,t)}}const dd=[{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"addr",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}];class id{static abi=dd;static createInterface(){return new ba(dd)}static connect(e,t){return new Wa(e,dd,t)}}var sd=Object.freeze({__proto__:null,ENS__factory:ad,EnsResolve__factory:fd,Resolver__factory:id});const rd=[{inputs:[{internalType:"bytes32",name:"tokenAddress",type:"bytes32"},{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],internalType:"struct Airdrop.Recipient[]",name:"targets",type:"tuple[]"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"bytes32[]",name:"domains",type:"bytes32[]"}],name:"bulkResolve",outputs:[{internalType:"address[]",name:"result",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"addr",type:"bytes32"}],name:"resolve",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}],pd="0x608060405234801561001057600080fd5b5060405161039938038061039983398101604081905261002f91610220565b8181600061003c836101aa565b90506000816001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161006c91906102e4565b60206040518083038186803b15801561008457600080fd5b505afa158015610098573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100bc91906102cc565b116100e25760405162461bcd60e51b81526004016100d990610311565b60405180910390fd5b60005b82518110156101a557816001600160a01b031663a9059cbb84838151811061010957fe5b60200260200101516000015185848151811061012157fe5b6020026020010151602001516040518363ffffffff1660e01b815260040161014a9291906102f8565b602060405180830381600087803b15801561016457600080fd5b505af1158015610178573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019c91906101f9565b506001016100e5565b506000ff5b60601c90565b6000604082840312156101c1578081fd5b6101cb6040610353565b82519091506001600160a01b03811681146101e557600080fd5b808252506020820151602082015292915050565b60006020828403121561020a578081fd5b81518015158114610219578182fd5b9392505050565b6000806040808486031215610233578182fd5b8351602080860151919450906001600160401b03811115610252578384fd5b8501601f81018713610262578384fd5b805161027561027082610379565b610353565b81815283810190838501868402850186018b1015610291578788fd5b8794505b838510156102bb576102a78b826101b0565b835260019490940193918501918601610295565b508096505050505050509250929050565b6000602082840312156102dd578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b60208082526022908201527f42616c616e636520697320302c2061697264726f7020616c726561647920646f6040820152616e6560f01b606082015260800190565b6040518181016001600160401b038111828210171561037157600080fd5b604052919050565b60006001600160401b0382111561038e578081fd5b506020908102019056fe";class cd extends Ya{constructor(...e){e.length>1?super(...e):super(rd,pd,e[0])}getDeployTransaction(e,t,a){return super.getDeployTransaction(e,t,a||{})}deploy(e,t,a){return super.deploy(e,t,a||{})}connect(e){return super.connect(e)}static bytecode=pd;static abi=rd;static createInterface(){return new ba(rd)}static connect(e,t){return new Wa(e,rd,t)}}const ud=[{inputs:[{internalType:"bytes32",name:"_node",type:"bytes32"}],name:"addr",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"registry",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"resolver",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"_node",type:"bytes32"},{internalType:"address",name:"_addr",type:"address"}],name:"setAddr",outputs:[],stateMutability:"nonpayable",type:"function"}],yd="0x608060405234801561001057600080fd5b5061044b806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80630178b8bf1461005c5780633b3b57de146100855780637ef5029814610098578063ac9650d8146100ab578063d5fa2b00146100cb575b600080fd5b61006f61006a3660046102bc565b6100e0565b60405161007c919061031e565b60405180910390f35b61006f6100933660046102bc565b6100e5565b61006f6100a63660046102bc565b610100565b6100be6100b936600461024d565b61011b565b60405161007c9190610332565b6100de6100d93660046102d4565b61021f565b005b503090565b6000908152602081905260409020546001600160a01b031690565b6000602081905290815260409020546001600160a01b031681565b60608167ffffffffffffffff8111801561013457600080fd5b5060405190808252806020026020018201604052801561016857816020015b60608152602001906001900390816101535790505b50905060005b8281101561021857600060603086868581811061018757fe5b905060200281019061019991906103c9565b6040516101a792919061030e565b600060405180830381855af49150503d80600081146101e2576040519150601f19603f3d011682016040523d82523d6000602084013e6101e7565b606091505b5091509150816101f657600080fd5b8084848151811061020357fe5b6020908102919091010152505060010161016e565b5092915050565b60009182526020829052604090912080546001600160a01b0319166001600160a01b03909216919091179055565b6000806020838503121561025f578182fd5b823567ffffffffffffffff80821115610276578384fd5b818501915085601f830112610289578384fd5b813581811115610297578485fd5b86602080830285010111156102aa578485fd5b60209290920196919550909350505050565b6000602082840312156102cd578081fd5b5035919050565b600080604083850312156102e6578182fd5b8235915060208301356001600160a01b0381168114610303578182fd5b809150509250929050565b6000828483379101908152919050565b6001600160a01b0391909116815260200190565b6000602080830181845280855180835260408601915060408482028701019250838701855b828110156103bc57878503603f1901845281518051808752885b8181101561038c578281018901518882018a01528801610371565b8181111561039c578989838a0101525b50601f01601f191695909501860194509285019290850190600101610357565b5092979650505050505050565b6000808335601e198436030181126103df578283fd5b83018035915067ffffffffffffffff8211156103f9578283fd5b60200191503681900382131561040e57600080fd5b925092905056fea26469706673582212202e44de42b72aec6265acc191876b290bc887c846ffca216ac5d28a16fd49092564736f6c634300060c0033";class od extends Ya{constructor(...e){e.length>1?super(...e):super(ud,yd,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=yd;static abi=ud;static createInterface(){return new ba(ud)}static connect(e,t){return new Wa(e,ud,t)}}const ld=[{inputs:[{internalType:"address",name:"_governance",type:"address"},{internalType:"uint256",name:"_pausePeriod",type:"uint256"},{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],internalType:"struct TORN.Recipient[]",name:"_vesting",type:"tuple[]"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"target",type:"address"}],name:"Allowed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"target",type:"address"}],name:"Disallowed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{inputs:[{internalType:"address[]",name:"target",type:"address[]"}],name:"addToAllowedList",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"allowedTransferee",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"blockTimestamp",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"burnFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"canUnpauseAfter",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"chainID",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"chainId",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bool",name:"decision",type:"bool"}],name:"changeTransferability",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"fakeTimestamp",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"governance",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address[]",name:"target",type:"address[]"}],name:"removeFromAllowedList",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"_token",type:"address"},{internalType:"address payable",name:"_to",type:"address"},{internalType:"uint256",name:"_balance",type:"uint256"}],name:"rescueTokens",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_chainId",type:"uint256"}],name:"setChainId",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_fakeTimestamp",type:"uint256"}],name:"setFakeTimestamp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],md="0x60c06040523480156200001157600080fd5b506040516200298e3803806200298e8339810160408190526200003491620006d6565b604080518082018252600b81526a0a8dee4dcc2c8de86c2e6d60ab1b6020808301918252835180850190945260048452632a27a92760e11b90840152815186938693869390926200008891600391620005e4565b5080516200009e906004906020840190620005e4565b50506005805460ff1916601217905550620000b8620001f8565b506008805460ff199081169091556001600160601b0319606085901b1660a0526001600160a01b0384166000908152600960205260408120805490921660011790915583905b82518110156200017b5760008382815181106200011757fe5b60200260200101516000015190506200014f818584815181106200013757fe5b602002602001015160200151620002b460201b60201c565b6001600160a01b03166000908152600960205260409020805460ff1916600190811790915501620000fe565b506200019f836200018b62000397565b620003b360201b62000d721790919060201c565b608052620001ac620003e4565b620001b66200045b565b6a084595161401484a00000014620001eb5760405162461bcd60e51b8152600401620001e290620008a8565b60405180910390fd5b5050505050505062000946565b6000806200020562000461565b905060007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6200023462000467565b805160209182012060408051808201825260018152603160f81b90840152516200028693927fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6918791309101620007be565b60408051601f1981840301815291815281516020928301206000948552600790925290922082905550905090565b6001600160a01b038216620002dd5760405162461bcd60e51b8152600401620001e290620008df565b620002eb6000838362000501565b6200030781600254620003b360201b62000d721790919060201c565b6002556001600160a01b038216600090815260208181526040909120546200033a91839062000d72620003b3821b17901c565b6001600160a01b0383166000818152602081905260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906200038b90859062000916565b60405180910390a35050565b6000620003ae620005bc60201b62000d9e1760201c565b905090565b600082820183811015620003db5760405162461bcd60e51b8152600401620001e290620007ea565b90505b92915050565b60085460ff16156200040a5760405162461bcd60e51b8152600401620001e2906200087e565b6008805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25862000442620005d7565b604051620004519190620007aa565b60405180910390a1565b60025490565b600b5490565b60038054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015620004f75780601f10620004cb57610100808354040283529160200191620004f7565b820191906000526020600020905b815481529060010190602001808311620004d957829003601f168201915b5050505050905090565b62000519838383620005b760201b620007421760201c565b62000523620005db565b15806200054857506001600160a01b03831660009081526009602052604090205460ff165b806200056c57506001600160a01b03821660009081526009602052604090205460ff165b6200058b5760405162461bcd60e51b8152600401620001e29062000858565b6001600160a01b038216301415620005b75760405162461bcd60e51b8152600401620001e29062000821565b505050565b6000600a54600014620005d257600a54620003ae565b504290565b3390565b60085460ff1690565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200062757805160ff191683800117855562000657565b8280016001018555821562000657579182015b82811115620006575782518255916020019190600101906200063a565b506200066592915062000669565b5090565b5b808211156200066557600081556001016200066a565b80516001600160a01b0381168114620003de57600080fd5b600060408284031215620006aa578081fd5b620006b660406200091f565b9050620006c4838362000680565b81526020820151602082015292915050565b600080600060608486031215620006eb578283fd5b620006f7858562000680565b9250602080850151925060408086015160018060401b03808211156200071b578485fd5b818801915088601f8301126200072f578485fd5b8151818111156200073e578586fd5b6200074d85868302016200091f565b8181528581019250838601858302850187018c10156200076b578788fd5b8794505b828510156200079957620007848c8262000698565b8452600194909401939286019285016200076f565b508096505050505050509250925092565b6001600160a01b0391909116815260200190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526017908201527f544f524e3a20696e76616c696420726563697069656e74000000000000000000604082015260600190565b6020808252600c908201526b1513d4938e881c185d5cd95960a21b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252601c908201527f544f524e3a20696e636f727265637420646973747269627574696f6e00000000604082015260600190565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b90815260200190565b6040518181016001600160401b03811182821017156200093e57600080fd5b604052919050565b60805160a05160601c612008620009866000398061056f52806106975280610764528061081d5280610a215250806107bc5280610d2052506120086000f3fe608060405234801561001057600080fd5b50600436106101cf5760003560e01c80637ecebe0011610104578063adb61832116100a2578063d505accf11610071578063d505accf1461038d578063dc0f0d12146103a0578063dd62ed3e146103a8578063ef0e2ff4146103bb576101cf565b8063adb6183214610357578063adc879e91461035f578063c565882714610367578063cea9d26f1461037a576101cf565b806395d89b41116100de57806395d89b41146103215780639a8a059214610329578063a457c2d714610331578063a9059cbb14610344576101cf565b80637ecebe00146102e857806381893c7c146102fb578063885ad0cf1461030e576101cf565b80633c8d76d1116101715780635c975abb1161014b5780635c975abb146102a75780635d4545a0146102af57806370a08231146102c257806379cc6790146102d5576101cf565b80633c8d76d11461026a57806342966c681461027f5780635aa6e67514610292576101cf565b806318160ddd116101ad57806318160ddd1461022757806323b872dd1461022f578063313ce567146102425780633950935114610257576101cf565b806301ec0fab146101d457806306fdde03146101f2578063095ea7b314610207575b600080fd5b6101dc6103ce565b6040516101e99190611e68565b60405180910390f35b6101fa6103d4565b6040516101e99190611943565b61021a610215366004611708565b61046b565b6040516101e991906118ba565b6101dc610489565b61021a61023d366004611653565b61048f565b61024a610516565b6040516101e99190611e71565b61021a610265366004611708565b61051f565b61027d610278366004611733565b61056d565b005b61027d61028d36600461181c565b610681565b61029a610695565b6040516101e9919061188d565b61021a6106b9565b61021a6102bd3660046115ff565b6106c2565b6101dc6102d03660046115ff565b6106d7565b61027d6102e3366004611708565b6106f2565b6101dc6102f63660046115ff565b610747565b61027d6103093660046117d0565b610762565b61027d61031c366004611733565b61081b565b6101fa610922565b6101dc610983565b61021a61033f366004611708565b610989565b61021a610352366004611708565b6109f1565b6101dc610a05565b6101dc610a14565b61027d61037536600461181c565b610a1a565b61027d610388366004611808565b610a1f565b61027d61039b366004611693565b610bdd565b6101dc610d1e565b6101dc6103b636600461161b565b610d42565b61027d6103c936600461181c565b610d6d565b600a5481565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104605780601f1061043557610100808354040283529160200191610460565b820191906000526020600020905b81548152906001019060200180831161044357829003601f168201915b505050505090505b90565b600061047f610478610db7565b8484610dbb565b5060015b92915050565b60025490565b600061049c848484610e6f565b61050c846104a8610db7565b61050785604051806060016040528060288152602001611f62602891396001600160a01b038a166000908152600160205260408120906104e6610db7565b6001600160a01b031681526020810191909152604001600020549190610f84565b610dbb565b5060019392505050565b60055460ff1690565b600061047f61052c610db7565b84610507856001600061053d610db7565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610d72565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661059f610db7565b6001600160a01b0316146105ce5760405162461bcd60e51b81526004016105c590611de4565b60405180910390fd5b60005b815181101561067d576000600960008484815181106105ec57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055507f9ef90a89b00db1a1891a357dc96b2a273add9d883e378c350d22bad87a9d7d3082828151811061065857fe5b602002602001015160405161066d919061188d565b60405180910390a16001016105d1565b5050565b61069261068c610db7565b82610fb0565b50565b7f000000000000000000000000000000000000000000000000000000000000000081565b60085460ff1690565b60096020526000908152604090205460ff1681565b6001600160a01b031660009081526020819052604090205490565b600061072482604051806060016040528060248152602001611f8a6024913961071d866103b6610db7565b9190610f84565b905061073883610732610db7565b83610dbb565b6107428383610fb0565b505050565b6001600160a01b031660009081526006602052604090205490565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610794610db7565b6001600160a01b0316146107ba5760405162461bcd60e51b81526004016105c590611de4565b7f00000000000000000000000000000000000000000000000000000000000000006107e3610a05565b116108005760405162461bcd60e51b81526004016105c590611bd9565b80156108135761080e611092565b610692565b6106926110fe565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661084d610db7565b6001600160a01b0316146108735760405162461bcd60e51b81526004016105c590611de4565b60005b815181101561067d5760016009600084848151811061089157fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055507f77a7dbc6ad97703ad411a8d5edfcd1df382fb34b076a90898b11884f7ebdcc058282815181106108fd57fe5b6020026020010151604051610912919061188d565b60405180910390a1600101610876565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104605780601f1061043557610100808354040283529160200191610460565b600b5481565b600061047f610996610db7565b8461050785604051806060016040528060258152602001611fae60259139600160006109c0610db7565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610f84565b600061047f6109fe610db7565b8484610e6f565b6000610a0f610d9e565b905090565b600b5490565b600a55565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610a51610db7565b6001600160a01b031614610a775760405162461bcd60e51b81526004016105c590611de4565b6001600160a01b038216610a9d5760405162461bcd60e51b81526004016105c590611d58565b6001600160a01b038316610b06574760008215610ac357610abe8284611157565b610ac5565b815b6040519091506001600160a01b0385169082156108fc029083906000818181858888f19350505050158015610afe573d6000803e3d6000fd5b505050610742565b6040516370a0823160e01b81526000906001600160a01b038516906370a0823190610b3590309060040161188d565b60206040518083038186803b158015610b4d57600080fd5b505afa158015610b61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b859190611834565b905060008215610b9e57610b998284611157565b610ba0565b815b905060008111610bc25760405162461bcd60e51b81526004016105c590611e31565b610bd66001600160a01b038616858361116d565b5050505050565b83610be6610a05565b1115610c045760405162461bcd60e51b81526004016105c590611ace565b6001600160a01b0387166000908152600660209081526040808320549051610c57927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9928c928c928c92918c91016118c5565b6040516020818303038152906040528051906020012090506000611901610c7c6111c3565b83604051602001610c8f93929190611868565b6040516020818303038152906040528051906020012090506000610cb582878787611202565b9050896001600160a01b0316816001600160a01b031614610ce85760405162461bcd60e51b81526004016105c590611c20565b6001600160a01b038a16600090815260066020526040902080546001019055610d128a8a8a610dbb565b50505050505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b600b55565b600082820183811015610d975760405162461bcd60e51b81526004016105c590611a60565b9392505050565b6000600a54600014610db257600a54610a0f565b504290565b3390565b6001600160a01b038316610de15760405162461bcd60e51b81526004016105c590611cdd565b6001600160a01b038216610e075760405162461bcd60e51b81526004016105c590611a1e565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610e62908590611e68565b60405180910390a3505050565b6001600160a01b038316610e955760405162461bcd60e51b81526004016105c590611c98565b6001600160a01b038216610ebb5760405162461bcd60e51b81526004016105c5906119ad565b610ec68383836112fa565b610f0381604051806060016040528060268152602001611f3c602691396001600160a01b0386166000908152602081905260409020549190610f84565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610f329082610d72565b6001600160a01b0380841660008181526020819052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610e62908590611e68565b60008184841115610fa85760405162461bcd60e51b81526004016105c59190611943565b505050900390565b6001600160a01b038216610fd65760405162461bcd60e51b81526004016105c590611c57565b610fe2826000836112fa565b61101f81604051806060016040528060228152602001611f1a602291396001600160a01b0385166000908152602081905260409020549190610f84565b6001600160a01b0383166000908152602081905260409020556002546110459082611399565b6002556040516000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611086908590611e68565b60405180910390a35050565b60085460ff166110b45760405162461bcd60e51b81526004016105c5906119f0565b6008805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6110e7610db7565b6040516110f4919061188d565b60405180910390a1565b60085460ff16156111215760405162461bcd60e51b81526004016105c590611b6d565b6008805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586110e7610db7565b60008183106111665781610d97565b5090919050565b6107428363a9059cbb60e01b848460405160240161118c9291906118a1565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526113db565b600080600760006111d2610a14565b8152602081019190915260400160002054905080156111f2579050610468565b6111fa61146a565b915050610468565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08211156112445760405162461bcd60e51b81526004016105c590611b2b565b8360ff16601b148061125957508360ff16601c145b6112755760405162461bcd60e51b81526004016105c590611b97565b60006001868686866040516000815260200160405260405161129a9493929190611925565b6020604051602081039080840390855afa1580156112bc573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166112ef5760405162461bcd60e51b81526004016105c590611976565b90505b949350505050565b611305838383610742565b61130d6106b9565b158061133157506001600160a01b03831660009081526009602052604090205460ff165b8061135457506001600160a01b03821660009081526009602052604090205460ff165b6113705760405162461bcd60e51b81526004016105c590611b05565b6001600160a01b0382163014156107425760405162461bcd60e51b81526004016105c590611a97565b6000610d9783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f84565b6060611430826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166115209092919063ffffffff16565b805190915015610742578080602001905181019061144e91906117ec565b6107425760405162461bcd60e51b81526004016105c590611d9a565b600080611475610a14565b905060007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6114a26103d4565b805160209182012060408051808201825260018152603160f81b90840152516114f293927fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc69187913091016118f9565b60408051601f1981840301815291815281516020928301206000948552600790925290922082905550905090565b60606112f284846000856060611535856115ee565b6115515760405162461bcd60e51b81526004016105c590611d21565b60006060866001600160a01b0316858760405161156e919061184c565b60006040518083038185875af1925050503d80600081146115ab576040519150601f19603f3d011682016040523d82523d6000602084013e6115b0565b606091505b509150915081156115c45791506112f29050565b8051156115d45780518082602001fd5b8360405162461bcd60e51b81526004016105c59190611943565b3b151590565b803561048381611ef6565b600060208284031215611610578081fd5b8135610d9781611ef6565b6000806040838503121561162d578081fd5b823561163881611ef6565b9150602083013561164881611ef6565b809150509250929050565b600080600060608486031215611667578081fd5b833561167281611ef6565b9250602084013561168281611ef6565b929592945050506040919091013590565b600080600080600080600060e0888a0312156116ad578283fd5b87356116b881611ef6565b965060208801356116c881611ef6565b95506040880135945060608801359350608088013560ff811681146116eb578384fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561171a578182fd5b823561172581611ef6565b946020939093013593505050565b60006020808385031215611745578182fd5b823567ffffffffffffffff81111561175b578283fd5b8301601f8101851361176b578283fd5b803561177e61177982611ea6565b611e7f565b818152838101908385018584028501860189101561179a578687fd5b8694505b838510156117c4576117b089826115f4565b83526001949094019391850191850161179e565b50979650505050505050565b6000602082840312156117e1578081fd5b8135610d9781611f0b565b6000602082840312156117fd578081fd5b8151610d9781611f0b565b600080600060608486031215611667578283fd5b60006020828403121561182d578081fd5b5035919050565b600060208284031215611845578081fd5b5051919050565b6000825161185e818460208701611ec6565b9190910192915050565b60f09390931b6001600160f01b03191683526002830191909152602282015260420190565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b9586526001600160a01b0394851660208701529290931660408501526060840152608083019190915260a082015260c00190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b93845260ff9290921660208401526040830152606082015260800190565b6000602082528251806020840152611962816040850160208701611ec6565b601f01601f19169190910160400192915050565b60208082526018908201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604082015260600190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526014908201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604082015260600190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526017908201527f544f524e3a20696e76616c696420726563697069656e74000000000000000000604082015260600190565b6020808252601d908201527f45524332305065726d69743a206578706972656420646561646c696e65000000604082015260600190565b6020808252600c908201526b1513d4938e881c185d5cd95960a21b604082015260600190565b60208082526022908201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604082015261756560f01b606082015260800190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526022908201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604082015261756560f01b606082015260800190565b60208082526027908201527f544f524e3a2063616e6e6f74206368616e6765207472616e736665726162696c6040820152661a5d1e481e595d60ca1b606082015260800190565b6020808252601e908201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604082015260600190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526022908201527f544f524e3a2063616e206e6f742073656e6420746f207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252602d908201527f544f524e3a206f6e6c7920676f7665726e616e63652063616e20706572666f7260408201526c36903a3434b99030b1ba34b7b760991b606082015260800190565b6020808252601e908201527f544f524e3a20747279696e6720746f2073656e6420302062616c616e63650000604082015260600190565b90815260200190565b60ff91909116815260200190565b60405181810167ffffffffffffffff81118282101715611e9e57600080fd5b604052919050565b600067ffffffffffffffff821115611ebc578081fd5b5060209081020190565b60005b83811015611ee1578181015183820152602001611ec9565b83811115611ef0576000848401525b50505050565b6001600160a01b038116811461069257600080fd5b801515811461069257600080fdfe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e20616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220c25cb2cef98080abbebec9b5719a4f46d638fbe559a3ab7a9de64272855c3c1064736f6c634300060c0033";class Td extends Ya{constructor(...e){e.length>1?super(...e):super(ld,md,e[0])}getDeployTransaction(e,t,a,n){return super.getDeployTransaction(e,t,a,n||{})}deploy(e,t,a,n){return super.deploy(e,t,a,n||{})}connect(e){return super.connect(e)}static bytecode=md;static abi=ld;static createInterface(){return new ba(ld)}static connect(e,t){return new Wa(e,ld,t)}}const gd=[{inputs:[],name:"blockTimestamp",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"fakeTimestamp",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_fakeTimestamp",type:"uint256"}],name:"setFakeTimestamp",outputs:[],stateMutability:"nonpayable",type:"function"}],wd="0x608060405234801561001057600080fd5b5060d28061001f6000396000f3fe6080604052348015600f57600080fd5b5060043610603c5760003560e01c806301ec0fab146041578063adb61832146059578063c565882714605f575b600080fd5b6047607b565b60408051918252519081900360200190f35b60476081565b607960048036036020811015607357600080fd5b50356097565b005b60005481565b60008054156090576000546092565b425b905090565b60005556fea2646970667358221220b2410460a5b24aec9983bcf8349aa3b589a0dff9120af5b704feae536a65813064736f6c634300060c0033";class hd extends Ya{constructor(...e){e.length>1?super(...e):super(gd,wd,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=wd;static abi=gd;static createInterface(){return new ba(gd)}static connect(e,t){return new Wa(e,gd,t)}}const vd=[{inputs:[{internalType:"address",name:"_token",type:"address"},{internalType:"address",name:"_beneficiary",type:"address"},{internalType:"uint256",name:"_startTimestamp",type:"uint256"},{internalType:"uint256",name:"_cliffInMonths",type:"uint256"},{internalType:"uint256",name:"_durationInMonths",type:"uint256"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Released",type:"event"},{inputs:[],name:"SECONDS_PER_MONTH",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"beneficiary",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"blockTimestamp",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"cliffInMonths",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"durationInMonths",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"fakeTimestamp",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"release",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"released",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_fakeTimestamp",type:"uint256"}],name:"setFakeTimestamp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"startTimestamp",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"contract IERC20",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"vestedAmount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"}],Md="0x61012060405234801561001157600080fd5b50604051610d2e380380610d2e833981810160405260a081101561003457600080fd5b5080516020820151604083015160608401516080909401519293919290919084848484846001600160a01b0384166100b3576040805162461bcd60e51b815260206004820152601b60248201527f42656e65666963696172792063616e6e6f7420626520656d7074790000000000604482015290519081900360640190fd5b80821115610108576040805162461bcd60e51b815260206004820152601e60248201527f436c6966662069732067726561746572207468616e206475726174696f6e0000604482015290519081900360640190fd5b6001600160601b0319606086811b821660a05285901b1660805261010081905260c082905282156101395782610141565b610141610154565b60e0525061018698505050505050505050565b600061016861016d60201b6105b81760201c565b905090565b600060015460001461018157600154610168565b504290565b60805160601c60a05160601c60c05160e05161010051610b366101f86000398061024452806103bc528061041e52508061019352806101cf52806105725250806102115280610534525080610289528061030952806104b5528061059652508061016d52806104d75250610b366000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c8063928d89ae11610071578063928d89ae146101195780639613252114610121578063adb6183214610129578063c565882714610131578063e6fd48bc1461014e578063fc0c546a14610156576100b4565b806301ec0fab146100b957806310786deb146100d357806338af3eed146100db57806344b1231f146100ff57806367097a4b1461010757806386d1a69f1461010f575b600080fd5b6100c161015e565b60408051918252519081900360200190f35b6100c1610164565b6100e361016b565b604080516001600160a01b039092168252519081900360200190f35b6100c161018f565b6100c161041c565b610117610440565b005b6100c1610532565b6100c1610556565b6100c161055c565b6101176004803603602081101561014757600080fd5b503561056b565b6100c1610570565b6100e3610594565b60015481565b62278d0081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60007f00000000000000000000000000000000000000000000000000000000000000006101ba61055c565b10156101c857506000610419565b60006101fc7f00000000000000000000000000000000000000000000000000000000000000006101f661055c565b906105d1565b9050600061020d8262278d0061061c565b90507f000000000000000000000000000000000000000000000000000000000000000081101561024257600092505050610419565b7f0000000000000000000000000000000000000000000000000000000000000000811061030557604080516370a0823160e01b815230600482015290516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916370a08231916024808301926020929190829003018186803b1580156102cf57600080fd5b505afa1580156102e3573d6000803e3d6000fd5b505050506040513d60208110156102f957600080fd5b50519250610419915050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561037457600080fd5b505afa158015610388573d6000803e3d6000fd5b505050506040513d602081101561039e57600080fd5b505160008054919250906103b390839061065e565b905060006103eb7f00000000000000000000000000000000000000000000000000000000000000006103e584876106b8565b9061061c565b90506000610404600054836105d190919063ffffffff16565b90506104108482610711565b96505050505050505b90565b7f000000000000000000000000000000000000000000000000000000000000000081565b600061044a61018f565b905060008111610498576040805162461bcd60e51b81526020600482015260146024820152734e6f20746f6b656e7320746f2072656c6561736560601b604482015290519081900360640190fd5b6000546104a5908261065e565b6000556104fc6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f000000000000000000000000000000000000000000000000000000000000000083610727565b6040805182815290517ffb81f9b30d73d830c3544b34d827c08142579ee75710b490bab0b3995468c5659181900360200190a150565b7f000000000000000000000000000000000000000000000000000000000000000081565b60005481565b60006105666105b8565b905090565b600155565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60006001546000146105cc57600154610566565b504290565b600061061383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061077e565b90505b92915050565b600061061383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610815565b600082820183811015610613576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000826106c757506000610616565b828202828482816106d457fe5b04146106135760405162461bcd60e51b8152600401808060200182810382526021815260200180610ab66021913960400191505060405180910390fd5b60008183106107205781610613565b5090919050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261077990849061087a565b505050565b6000818484111561080d5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156107d25781810151838201526020016107ba565b50505050905090810190601f1680156107ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836108645760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156107d25781810151838201526020016107ba565b50600083858161087057fe5b0495945050505050565b60606108cf826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661092b9092919063ffffffff16565b805190915015610779578080602001905160208110156108ee57600080fd5b50516107795760405162461bcd60e51b815260040180806020018281038252602a815260200180610ad7602a913960400191505060405180910390fd5b606061093a8484600085610942565b949350505050565b606061094d85610aaf565b61099e576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106109dd5780518252601f1990920191602091820191016109be565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610a3f576040519150601f19603f3d011682016040523d82523d6000602084013e610a44565b606091505b50915091508115610a5857915061093a9050565b805115610a685780518082602001fd5b60405162461bcd60e51b81526020600482018181528651602484015286518793919283926044019190850190808383600083156107d25781810151838201526020016107ba565b3b15159056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220852e02606e74d747094138d7e10fc9f005278a953559d85ca961b67f95c9fa8f64736f6c634300060c0033";class _d extends Ya{constructor(...e){e.length>1?super(...e):super(vd,Md,e[0])}getDeployTransaction(e,t,a,n,b,f){return super.getDeployTransaction(e,t,a,n,b,f||{})}deploy(e,t,a,n,b,f){return super.deploy(e,t,a,n,b,f||{})}connect(e){return super.connect(e)}static bytecode=Md;static abi=vd;static createInterface(){return new ba(vd)}static connect(e,t){return new Wa(e,vd,t)}}const xd=[{inputs:[{internalType:"bytes32",name:"_torn",type:"bytes32"},{internalType:"bytes32",name:"_governance",type:"bytes32"},{internalType:"uint256",name:"_duration",type:"uint256"},{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],internalType:"struct Voucher.Recipient[]",name:"_airdrops",type:"tuple[]"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"allowedTransferee",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"blockTimestamp",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32[]",name:"domains",type:"bytes32[]"}],name:"bulkResolve",outputs:[{internalType:"address[]",name:"result",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"expiresAt",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"fakeTimestamp",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"governance",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"redeem",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"rescueExpiredTokens",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"addr",type:"bytes32"}],name:"resolve",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_fakeTimestamp",type:"uint256"}],name:"setFakeTimestamp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"torn",outputs:[{internalType:"contract IERC20",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],Id="0x60e06040523480156200001157600080fd5b5060405162001b7838038062001b78833981016040819052620000349162000476565b8383838360405180606001604052806026815260200162001b5260269139604051806040016040528060058152602001643b2a27a92760d91b8152508160039080519060200190620000889291906200038d565b5080516200009e9060049060208401906200038d565b50506005805460ff1916601217905550620000b984620001b7565b60601b6001600160601b031916608052620000d483620001b7565b60601b6001600160601b03191660c0526200010782620000f3620001bd565b620001d960201b6200089d1790919060201c565b60a05260005b8151811015620001a857620001598282815181106200012857fe5b6020026020010151600001518383815181106200014157fe5b6020026020010151602001516200021160201b60201c565b6001600660008484815181106200016c57fe5b602090810291909101810151516001600160a01b03168252810191909152604001600020805460ff19169115159190911790556001016200010d565b5050505050505050506200061d565b60601c90565b6000620001d4620002f460201b620008c91760201c565b905090565b6000828201838110156200020a5760405162461bcd60e51b8152600401620002019062000548565b60405180910390fd5b9392505050565b6001600160a01b0382166200023a5760405162461bcd60e51b81526004016200020190620005b6565b62000248600083836200030f565b6200026481600254620001d960201b6200089d1790919060201c565b6002556001600160a01b03821660009081526020818152604090912054620002979183906200089d620001d9821b17901c565b6001600160a01b0383166000818152602081905260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90620002e8908590620005ed565b60405180910390a35050565b60006007546000146200030a57600754620001d4565b504290565b620003278383836200038860201b620008e21760201c565b6001600160a01b03821615806200034557506001600160a01b038316155b806200036957506001600160a01b03831660009081526006602052604090205460ff165b620003885760405162461bcd60e51b815260040162000201906200057f565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620003d057805160ff191683800117855562000400565b8280016001018555821562000400579182015b8281111562000400578251825591602001919060010190620003e3565b506200040e92915062000412565b5090565b5b808211156200040e576000815560010162000413565b6000604082840312156200043b578081fd5b620004476040620005f6565b82519091506001600160a01b03811681146200046257600080fd5b808252506020820151602082015292915050565b600080600080608085870312156200048c578384fd5b8451935060208086015193506040808701519350606087015160018060401b0380821115620004b9578485fd5b818901915089601f830112620004cd578485fd5b815181811115620004dc578586fd5b620004eb8586830201620005f6565b8181528581019250838601858302850187018d101562000509578788fd5b8794505b828510156200053757620005228d8262000429565b8452600194909401939286019285016200050d565b50989b979a50959850505050505050565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601e908201527f45524332303a207472616e73666572206973206e6f7420616c6c6f7765640000604082015260600190565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b90815260200190565b6040518181016001600160401b03811182821017156200061557600080fd5b604052919050565b60805160601c60a05160c05160601c6114e46200066e6000398061046952806106de5250806104c352806105f752806106945250806105d3528061066852806106ff52806107a352506114e46000f3fe608060405234801561001057600080fd5b50600436106101425760003560e01c80638622a689116100b8578063adf898a41161007c578063adf898a414610269578063be040fb014610271578063c39ef8551461027b578063c565882714610283578063dd62ed3e14610296578063f9e54234146102a957610142565b80638622a6891461022b57806395d89b4114610233578063a457c2d71461023b578063a9059cbb1461024e578063adb618321461026157610142565b8063313ce5671161010a578063313ce567146101b557806339509351146101ca5780635aa6e675146101dd5780635c23bdf5146101f25780635d4545a01461020557806370a082311461021857610142565b806301ec0fab1461014757806306fdde0314610165578063095ea7b31461017a57806318160ddd1461019a57806323b872dd146101a2575b600080fd5b61014f6102c9565b60405161015c9190611376565b60405180910390f35b61016d6102cf565b60405161015c9190611087565b61018d610188366004610ed7565b610365565b60405161015c919061107c565b61014f610383565b61018d6101b0366004610e97565b610389565b6101bd610410565b60405161015c919061137f565b61018d6101d8366004610ed7565b610419565b6101e5610467565b60405161015c9190611002565b6101e5610200366004610fb6565b61048b565b61018d610213366004610e48565b610491565b61014f610226366004610e48565b6104a6565b61014f6104c1565b61016d6104e5565b61018d610249366004610ed7565b610546565b61018d61025c366004610ed7565b6105ae565b61014f6105c2565b6101e56105d1565b6102796105f5565b005b610279610692565b610279610291366004610fb6565b6107cc565b61014f6102a4366004610e63565b6107d1565b6102bc6102b7366004610f01565b6107fc565b60405161015c919061102f565b60075481565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561035b5780601f106103305761010080835404028352916020019161035b565b820191906000526020600020905b81548152906001019060200180831161033e57829003601f168201915b5050505050905090565b60006103796103726108e7565b84846108eb565b5060015b92915050565b60025490565b600061039684848461099f565b610406846103a26108e7565b61040185604051806060016040528060288152602001611462602891396001600160a01b038a166000908152600160205260408120906103e06108e7565b6001600160a01b031681526020810191909152604001600020549190610ab4565b6108eb565b5060019392505050565b60055460ff1690565b60006103796104266108e7565b8461040185600160006104376108e7565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549061089d565b7f000000000000000000000000000000000000000000000000000000000000000081565b60601c90565b60066020526000908152604090205460ff1681565b6001600160a01b031660009081526020819052604090205490565b7f000000000000000000000000000000000000000000000000000000000000000081565b60048054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561035b5780601f106103305761010080835404028352916020019161035b565b60006103796105536108e7565b846104018560405180606001604052806025815260200161148a602591396001600061057d6108e7565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610ab4565b60006103796105bb6108e7565b848461099f565b60006105cc6108c9565b905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000061061e6105c2565b106106445760405162461bcd60e51b815260040161063b90611176565b60405180910390fd5b600061064f336104a6565b905061065b3382610ae0565b61068f6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163383610bc2565b50565b7f00000000000000000000000000000000000000000000000000000000000000006106bb6105c2565b10156106d95760405162461bcd60e51b815260040161063b906111ad565b6107ca7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016107499190611002565b60206040518083038186803b15801561076157600080fd5b505afa158015610775573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107999190610fce565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169190610bc2565b565b600755565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060815167ffffffffffffffff8111801561081657600080fd5b50604051908082528060200260200182016040528015610840578160200160208202803683370190505b50905060005b82518110156108975761086b83828151811061085e57fe5b602002602001015161048b565b82828151811061087757fe5b6001600160a01b0390921660209283029190910190910152600101610846565b50919050565b6000828201838110156108c25760405162461bcd60e51b815260040161063b9061113f565b9392505050565b60006007546000146108dd576007546105cc565b504290565b505050565b3390565b6001600160a01b0383166109115760405162461bcd60e51b815260040161063b906112b1565b6001600160a01b0382166109375760405162461bcd60e51b815260040161063b906110fd565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610992908590611376565b60405180910390a3505050565b6001600160a01b0383166109c55760405162461bcd60e51b815260040161063b9061126c565b6001600160a01b0382166109eb5760405162461bcd60e51b815260040161063b906110ba565b6109f6838383610c18565b610a338160405180606001604052806026815260200161143c602691396001600160a01b0386166000908152602081905260409020549190610ab4565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610a62908261089d565b6001600160a01b0380841660008181526020819052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610992908590611376565b60008184841115610ad85760405162461bcd60e51b815260040161063b9190611087565b505050900390565b6001600160a01b038216610b065760405162461bcd60e51b815260040161063b9061122b565b610b1282600083610c18565b610b4f8160405180606001604052806022815260200161141a602291396001600160a01b0385166000908152602081905260409020549190610ab4565b6001600160a01b038316600090815260208190526040902055600254610b759082610c7f565b6002556040516000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610bb6908590611376565b60405180910390a35050565b6108e28363a9059cbb60e01b8484604051602401610be1929190611016565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610cc1565b610c238383836108e2565b6001600160a01b0382161580610c4057506001600160a01b038316155b80610c6357506001600160a01b03831660009081526006602052604090205460ff165b6108e25760405162461bcd60e51b815260040161063b906111f4565b60006108c283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ab4565b6060610d16826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610d509092919063ffffffff16565b8051909150156108e25780806020019051810190610d349190610f96565b6108e25760405162461bcd60e51b815260040161063b9061132c565b6060610d5f8484600085610d67565b949350505050565b6060610d7285610e2b565b610d8e5760405162461bcd60e51b815260040161063b906112f5565b60006060866001600160a01b03168587604051610dab9190610fe6565b60006040518083038185875af1925050503d8060008114610de8576040519150601f19603f3d011682016040523d82523d6000602084013e610ded565b606091505b50915091508115610e01579150610d5f9050565b805115610e115780518082602001fd5b8360405162461bcd60e51b815260040161063b9190611087565b3b151590565b80356001600160a01b038116811461037d57600080fd5b600060208284031215610e59578081fd5b6108c28383610e31565b60008060408385031215610e75578081fd5b610e7f8484610e31565b9150610e8e8460208501610e31565b90509250929050565b600080600060608486031215610eab578081fd5b8335610eb681611404565b92506020840135610ec681611404565b929592945050506040919091013590565b60008060408385031215610ee9578182fd5b610ef38484610e31565b946020939093013593505050565b60006020808385031215610f13578182fd5b823567ffffffffffffffff811115610f29578283fd5b8301601f81018513610f39578283fd5b8035610f4c610f47826113b4565b61138d565b8181528381019083850185840285018601891015610f68578687fd5b8694505b83851015610f8a578035835260019490940193918501918501610f6c565b50979650505050505050565b600060208284031215610fa7578081fd5b815180151581146108c2578182fd5b600060208284031215610fc7578081fd5b5035919050565b600060208284031215610fdf578081fd5b5051919050565b60008251610ff88184602087016113d4565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b818110156110705783516001600160a01b03168352928401929184019160010161104b565b50909695505050505050565b901515815260200190565b60006020825282518060208401526110a68160408501602087016113d4565b601f01601f19169190910160400192915050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601f908201527f41697264726f702072656465656d20706572696f642068617320656e64656400604082015260600190565b60208082526027908201527f41697264726f702072656465656d20706572696f6420686173206e6f7420656e604082015266191959081e595d60ca1b606082015260800190565b6020808252601e908201527f45524332303a207472616e73666572206973206e6f7420616c6c6f7765640000604082015260600190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b90815260200190565b60ff91909116815260200190565b60405181810167ffffffffffffffff811182821017156113ac57600080fd5b604052919050565b600067ffffffffffffffff8211156113ca578081fd5b5060209081020190565b60005b838110156113ef5781810151838201526020016113d7565b838111156113fe576000848401525b50505050565b6001600160a01b038116811461068f57600080fdfe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220794126baf4ea3c44b9afb84b4d8a20535aca899e75471e5d9bb4c8e671aabde664736f6c634300060c0033546f726e61646f4361736820766f756368657220666f72206561726c792061646f7074657273";class Ed extends Ya{constructor(...e){e.length>1?super(...e):super(xd,Id,e[0])}getDeployTransaction(e,t,a,n,b){return super.getDeployTransaction(e,t,a,n,b||{})}deploy(e,t,a,n,b){return super.deploy(e,t,a,n,b||{})}connect(e){return super.connect(e)}static bytecode=Id;static abi=xd;static createInterface(){return new ba(xd)}static connect(e,t){return new Wa(e,xd,t)}}var Rd=Object.freeze({__proto__:null,AirdropMock__factory:cd,ENSMock__factory:od,TORNMock__factory:Td,Timestamp__factory:hd,VestingMock__factory:_d,VoucherMock__factory:Ed});const Od=[{inputs:[{internalType:"bytes32",name:"tokenAddress",type:"bytes32"},{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],internalType:"struct Airdrop.Recipient[]",name:"targets",type:"tuple[]"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"bytes32[]",name:"domains",type:"bytes32[]"}],name:"bulkResolve",outputs:[{internalType:"address[]",name:"result",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"resolve",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}],kd="0x60806040523480156200001157600080fd5b506040516200054038038062000540833981016040819052620000349162000396565b60006200004183620001c2565b90506000816001600160a01b03166370a08231306040518263ffffffff1660e01b815260040162000073919062000467565b60206040518083038186803b1580156200008c57600080fd5b505afa158015620000a1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000c791906200044e565b11620000f05760405162461bcd60e51b8152600401620000e7906200049d565b60405180910390fd5b60005b8251811015620001bd57816001600160a01b031663a9059cbb8483815181106200011957fe5b6020026020010151600001518584815181106200013257fe5b6020026020010151602001516040518363ffffffff1660e01b81526004016200015d9291906200047b565b602060405180830381600087803b1580156200017857600080fd5b505af11580156200018d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b3919062000374565b50600101620000f3565b506000ff5b600080620001cf62000310565b600114620001f257738595bfb0d940dfedc98943fa8a907091203f25ee62000203565b6e0c2e074ec69a0dfb2997ba6c7d2e1e5b604051630178b8bf60e01b81529091506001600160a01b03821690630178b8bf906200023490869060040162000494565b60206040518083038186803b1580156200024d57600080fd5b505afa15801562000262573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000288919062000355565b6001600160a01b0316633b3b57de846040518263ffffffff1660e01b8152600401620002b5919062000494565b60206040518083038186803b158015620002ce57600080fd5b505afa158015620002e3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000309919062000355565b9392505050565b4690565b60006040828403121562000326578081fd5b620003326040620004df565b90508151620003418162000526565b808252506020820151602082015292915050565b60006020828403121562000367578081fd5b8151620003098162000526565b60006020828403121562000386578081fd5b8151801515811462000309578182fd5b6000806040808486031215620003aa578182fd5b8351602080860151919450906001600160401b03811115620003ca578384fd5b8501601f81018713620003db578384fd5b8051620003f2620003ec8262000506565b620004df565b81815283810190838501868402850186018b10156200040f578788fd5b8794505b838510156200043d57620004288b8262000314565b83526001949094019391850191860162000413565b508096505050505050509250929050565b60006020828403121562000460578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b90815260200190565b60208082526022908201527f42616c616e636520697320302c2061697264726f7020616c726561647920646f6040820152616e6560f01b606082015260800190565b6040518181016001600160401b0381118282101715620004fe57600080fd5b604052919050565b60006001600160401b038211156200051c578081fd5b5060209081020190565b6001600160a01b03811681146200053c57600080fd5b5056fe";class Pd extends Ya{constructor(...e){e.length>1?super(...e):super(Od,kd,e[0])}getDeployTransaction(e,t,a){return super.getDeployTransaction(e,t,a||{})}deploy(e,t,a){return super.deploy(e,t,a||{})}connect(e){return super.connect(e)}static bytecode=kd;static abi=Od;static createInterface(){return new ba(Od)}static connect(e,t){return new Wa(e,Od,t)}}const Ad=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"blockTimestamp",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"chainID",outputs:[{internalType:"uint256",name:"_chainID",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],Cd=[{inputs:[{internalType:"address",name:"_governance",type:"address"},{internalType:"uint256",name:"_pausePeriod",type:"uint256"},{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],internalType:"struct TORN.Recipient[]",name:"_vestings",type:"tuple[]"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"target",type:"address"}],name:"Allowed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"target",type:"address"}],name:"Disallowed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{inputs:[{internalType:"address[]",name:"target",type:"address[]"}],name:"addToAllowedList",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"allowedTransferee",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"blockTimestamp",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"burnFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"canUnpauseAfter",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"chainID",outputs:[{internalType:"uint256",name:"_chainID",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bool",name:"decision",type:"bool"}],name:"changeTransferability",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"governance",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address[]",name:"target",type:"address[]"}],name:"removeFromAllowedList",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"_token",type:"address"},{internalType:"address payable",name:"_to",type:"address"},{internalType:"uint256",name:"_balance",type:"uint256"}],name:"rescueTokens",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],Sd="0x60c06040523480156200001157600080fd5b506040516200288338038062002883833981016040819052620000349162000699565b604080518082018252600b81526a0a8dee4dcc2c8de86c2e6d60ab1b6020808301918252835180850190945260048452632a27a92760e11b9084015281519192916200008391600391620005a7565b50805162000099906004906020840190620005a7565b50506005805460ff1916601217905550620000b3620001f0565b506008805460ff199081169091556001600160601b0319606085901b1660a0526001600160a01b0384166000908152600960205260408120805490921660011790915583905b8251811015620001765760008382815181106200011257fe5b60200260200101516000015190506200014a818584815181106200013257fe5b602002602001015160200151620002ac60201b60201c565b6001600160a01b03166000908152600960205260409020805460ff1916600190811790915501620000f9565b506200019a83620001866200038f565b6200039360201b62000cbd1790919060201c565b608052620001a7620003c4565b620001b16200043b565b6a084595161401484a00000014620001e65760405162461bcd60e51b8152600401620001dd906200086b565b60405180910390fd5b5050505062000909565b600080620001fd62000441565b905060007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6200022c62000445565b805160209182012060408051808201825260018152603160f81b90840152516200027e93927fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc691879130910162000781565b60408051601f1981840301815291815281516020928301206000948552600790925290922082905550905090565b6001600160a01b038216620002d55760405162461bcd60e51b8152600401620001dd90620008a2565b620002e360008383620004df565b620002ff816002546200039360201b62000cbd1790919060201c565b6002556001600160a01b038216600090815260208181526040909120546200033291839062000cbd62000393821b17901c565b6001600160a01b0383166000818152602081905260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9062000383908590620008d9565b60405180910390a35050565b4290565b600082820183811015620003bb5760405162461bcd60e51b8152600401620001dd90620007ad565b90505b92915050565b60085460ff1615620003ea5760405162461bcd60e51b8152600401620001dd9062000841565b6008805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258620004226200059a565b6040516200043191906200076d565b60405180910390a1565b60025490565b4690565b60038054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015620004d55780601f10620004a957610100808354040283529160200191620004d5565b820191906000526020600020905b815481529060010190602001808311620004b757829003601f168201915b5050505050905090565b620004f78383836200059560201b620006aa1760201c565b620005016200059e565b15806200052657506001600160a01b03831660009081526009602052604090205460ff165b806200054a57506001600160a01b03821660009081526009602052604090205460ff165b620005695760405162461bcd60e51b8152600401620001dd906200081b565b6001600160a01b038216301415620005955760405162461bcd60e51b8152600401620001dd90620007e4565b505050565b3390565b60085460ff1690565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620005ea57805160ff19168380011785556200061a565b828001600101855582156200061a579182015b828111156200061a578251825591602001919060010190620005fd565b50620006289291506200062c565b5090565b5b808211156200062857600081556001016200062d565b80516001600160a01b0381168114620003be57600080fd5b6000604082840312156200066d578081fd5b620006796040620008e2565b905062000687838362000643565b81526020820151602082015292915050565b600080600060608486031215620006ae578283fd5b620006ba858562000643565b9250602080850151925060408086015160018060401b0380821115620006de578485fd5b818801915088601f830112620006f2578485fd5b81518181111562000701578586fd5b620007108586830201620008e2565b8181528581019250838601858302850187018c10156200072e578788fd5b8794505b828510156200075c57620007478c826200065b565b84526001949094019392860192850162000732565b508096505050505050509250925092565b6001600160a01b0391909116815260200190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526017908201527f544f524e3a20696e76616c696420726563697069656e74000000000000000000604082015260600190565b6020808252600c908201526b1513d4938e881c185d5cd95960a21b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252601c908201527f544f524e3a20696e636f727265637420646973747269627574696f6e00000000604082015260600190565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b90815260200190565b6040518181016001600160401b03811182821017156200090157600080fd5b604052919050565b60805160a05160601c611f3a62000949600039806104d752806105ff52806106cc528061078552806109715250806107245280610c705250611f3a6000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c806379cc6790116100de578063a9059cbb11610097578063cea9d26f11610071578063cea9d26f146102fb578063d505accf1461030e578063dc0f0d1214610321578063dd62ed3e1461032957610173565b8063a9059cbb146102d8578063adb61832146102eb578063adc879e9146102f357610173565b806379cc6790146102715780637ecebe001461028457806381893c7c14610297578063885ad0cf146102aa57806395d89b41146102bd578063a457c2d7146102c557610173565b80633c8d76d1116101305780633c8d76d11461020657806342966c681461021b5780635aa6e6751461022e5780635c975abb146102435780635d4545a01461024b57806370a082311461025e57610173565b806306fdde0314610178578063095ea7b31461019657806318160ddd146101b657806323b872dd146101cb578063313ce567146101de57806339509351146101f3575b600080fd5b61018061033c565b60405161018d9190611875565b60405180910390f35b6101a96101a436600461163a565b6103d3565b60405161018d91906117ec565b6101be6103f1565b60405161018d9190611d9a565b6101a96101d9366004611585565b6103f7565b6101e661047e565b60405161018d9190611da3565b6101a961020136600461163a565b610487565b610219610214366004611665565b6104d5565b005b61021961022936600461174e565b6105e9565b6102366105fd565b60405161018d91906117bf565b6101a9610621565b6101a9610259366004611531565b61062a565b6101be61026c366004611531565b61063f565b61021961027f36600461163a565b61065a565b6101be610292366004611531565b6106af565b6102196102a5366004611702565b6106ca565b6102196102b8366004611665565b610783565b61018061088a565b6101a96102d336600461163a565b6108eb565b6101a96102e636600461163a565b610953565b6101be610967565b6101be61096b565b61021961030936600461173a565b61096f565b61021961031c3660046115c5565b610b2d565b6101be610c6e565b6101be61033736600461154d565b610c92565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103c85780601f1061039d576101008083540402835291602001916103c8565b820191906000526020600020905b8154815290600101906020018083116103ab57829003601f168201915b505050505090505b90565b60006103e76103e0610ce9565b8484610ced565b5060015b92915050565b60025490565b6000610404848484610da1565b61047484610410610ce9565b61046f85604051806060016040528060288152602001611e94602891396001600160a01b038a1660009081526001602052604081209061044e610ce9565b6001600160a01b031681526020810191909152604001600020549190610eb6565b610ced565b5060019392505050565b60055460ff1690565b60006103e7610494610ce9565b8461046f85600160006104a5610ce9565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610cbd565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610507610ce9565b6001600160a01b0316146105365760405162461bcd60e51b815260040161052d90611d16565b60405180910390fd5b60005b81518110156105e55760006009600084848151811061055457fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055507f9ef90a89b00db1a1891a357dc96b2a273add9d883e378c350d22bad87a9d7d308282815181106105c057fe5b60200260200101516040516105d591906117bf565b60405180910390a1600101610539565b5050565b6105fa6105f4610ce9565b82610ee2565b50565b7f000000000000000000000000000000000000000000000000000000000000000081565b60085460ff1690565b60096020526000908152604090205460ff1681565b6001600160a01b031660009081526020819052604090205490565b600061068c82604051806060016040528060248152602001611ebc6024913961068586610337610ce9565b9190610eb6565b90506106a08361069a610ce9565b83610ced565b6106aa8383610ee2565b505050565b6001600160a01b031660009081526006602052604090205490565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166106fc610ce9565b6001600160a01b0316146107225760405162461bcd60e51b815260040161052d90611d16565b7f000000000000000000000000000000000000000000000000000000000000000061074b610967565b116107685760405162461bcd60e51b815260040161052d90611b0b565b801561077b57610776610fc4565b6105fa565b6105fa611030565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166107b5610ce9565b6001600160a01b0316146107db5760405162461bcd60e51b815260040161052d90611d16565b60005b81518110156105e5576001600960008484815181106107f957fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055507f77a7dbc6ad97703ad411a8d5edfcd1df382fb34b076a90898b11884f7ebdcc0582828151811061086557fe5b602002602001015160405161087a91906117bf565b60405180910390a16001016107de565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103c85780601f1061039d576101008083540402835291602001916103c8565b60006103e76108f8610ce9565b8461046f85604051806060016040528060258152602001611ee06025913960016000610922610ce9565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610eb6565b60006103e7610960610ce9565b8484610da1565b4290565b4690565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166109a1610ce9565b6001600160a01b0316146109c75760405162461bcd60e51b815260040161052d90611d16565b6001600160a01b0382166109ed5760405162461bcd60e51b815260040161052d90611c8a565b6001600160a01b038316610a56574760008215610a1357610a0e8284611089565b610a15565b815b6040519091506001600160a01b0385169082156108fc029083906000818181858888f19350505050158015610a4e573d6000803e3d6000fd5b5050506106aa565b6040516370a0823160e01b81526000906001600160a01b038516906370a0823190610a859030906004016117bf565b60206040518083038186803b158015610a9d57600080fd5b505afa158015610ab1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad59190611766565b905060008215610aee57610ae98284611089565b610af0565b815b905060008111610b125760405162461bcd60e51b815260040161052d90611d63565b610b266001600160a01b038616858361109f565b5050505050565b83610b36610967565b1115610b545760405162461bcd60e51b815260040161052d90611a00565b6001600160a01b0387166000908152600660209081526040808320549051610ba7927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9928c928c928c92918c91016117f7565b6040516020818303038152906040528051906020012090506000611901610bcc6110f5565b83604051602001610bdf9392919061179a565b6040516020818303038152906040528051906020012090506000610c0582878787611134565b9050896001600160a01b0316816001600160a01b031614610c385760405162461bcd60e51b815260040161052d90611b52565b6001600160a01b038a16600090815260066020526040902080546001019055610c628a8a8a610ced565b50505050505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b600082820183811015610ce25760405162461bcd60e51b815260040161052d90611992565b9392505050565b3390565b6001600160a01b038316610d135760405162461bcd60e51b815260040161052d90611c0f565b6001600160a01b038216610d395760405162461bcd60e51b815260040161052d90611950565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610d94908590611d9a565b60405180910390a3505050565b6001600160a01b038316610dc75760405162461bcd60e51b815260040161052d90611bca565b6001600160a01b038216610ded5760405162461bcd60e51b815260040161052d906118df565b610df883838361122c565b610e3581604051806060016040528060268152602001611e6e602691396001600160a01b0386166000908152602081905260409020549190610eb6565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610e649082610cbd565b6001600160a01b0380841660008181526020819052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610d94908590611d9a565b60008184841115610eda5760405162461bcd60e51b815260040161052d9190611875565b505050900390565b6001600160a01b038216610f085760405162461bcd60e51b815260040161052d90611b89565b610f148260008361122c565b610f5181604051806060016040528060228152602001611e4c602291396001600160a01b0385166000908152602081905260409020549190610eb6565b6001600160a01b038316600090815260208190526040902055600254610f7790826112cb565b6002556040516000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610fb8908590611d9a565b60405180910390a35050565b60085460ff16610fe65760405162461bcd60e51b815260040161052d90611922565b6008805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa611019610ce9565b60405161102691906117bf565b60405180910390a1565b60085460ff16156110535760405162461bcd60e51b815260040161052d90611a9f565b6008805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611019610ce9565b60008183106110985781610ce2565b5090919050565b6106aa8363a9059cbb60e01b84846040516024016110be9291906117d3565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261130d565b6000806007600061110461096b565b8152602081019190915260400160002054905080156111245790506103d0565b61112c61139c565b9150506103d0565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08211156111765760405162461bcd60e51b815260040161052d90611a5d565b8360ff16601b148061118b57508360ff16601c145b6111a75760405162461bcd60e51b815260040161052d90611ac9565b6000600186868686604051600081526020016040526040516111cc9493929190611857565b6020604051602081039080840390855afa1580156111ee573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166112215760405162461bcd60e51b815260040161052d906118a8565b90505b949350505050565b6112378383836106aa565b61123f610621565b158061126357506001600160a01b03831660009081526009602052604090205460ff165b8061128657506001600160a01b03821660009081526009602052604090205460ff165b6112a25760405162461bcd60e51b815260040161052d90611a37565b6001600160a01b0382163014156106aa5760405162461bcd60e51b815260040161052d906119c9565b6000610ce283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610eb6565b6060611362826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166114529092919063ffffffff16565b8051909150156106aa5780806020019051810190611380919061171e565b6106aa5760405162461bcd60e51b815260040161052d90611ccc565b6000806113a761096b565b905060007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6113d461033c565b805160209182012060408051808201825260018152603160f81b908401525161142493927fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc691879130910161182b565b60408051601f1981840301815291815281516020928301206000948552600790925290922082905550905090565b60606112248484600085606061146785611520565b6114835760405162461bcd60e51b815260040161052d90611c53565b60006060866001600160a01b031685876040516114a0919061177e565b60006040518083038185875af1925050503d80600081146114dd576040519150601f19603f3d011682016040523d82523d6000602084013e6114e2565b606091505b509150915081156114f65791506112249050565b8051156115065780518082602001fd5b8360405162461bcd60e51b815260040161052d9190611875565b3b151590565b80356103eb81611e28565b600060208284031215611542578081fd5b8135610ce281611e28565b6000806040838503121561155f578081fd5b823561156a81611e28565b9150602083013561157a81611e28565b809150509250929050565b600080600060608486031215611599578081fd5b83356115a481611e28565b925060208401356115b481611e28565b929592945050506040919091013590565b600080600080600080600060e0888a0312156115df578283fd5b87356115ea81611e28565b965060208801356115fa81611e28565b95506040880135945060608801359350608088013560ff8116811461161d578384fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561164c578182fd5b823561165781611e28565b946020939093013593505050565b60006020808385031215611677578182fd5b823567ffffffffffffffff81111561168d578283fd5b8301601f8101851361169d578283fd5b80356116b06116ab82611dd8565b611db1565b81815283810190838501858402850186018910156116cc578687fd5b8694505b838510156116f6576116e28982611526565b8352600194909401939185019185016116d0565b50979650505050505050565b600060208284031215611713578081fd5b8135610ce281611e3d565b60006020828403121561172f578081fd5b8151610ce281611e3d565b600080600060608486031215611599578283fd5b60006020828403121561175f578081fd5b5035919050565b600060208284031215611777578081fd5b5051919050565b60008251611790818460208701611df8565b9190910192915050565b60f09390931b6001600160f01b03191683526002830191909152602282015260420190565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b9586526001600160a01b0394851660208701529290931660408501526060840152608083019190915260a082015260c00190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b93845260ff9290921660208401526040830152606082015260800190565b6000602082528251806020840152611894816040850160208701611df8565b601f01601f19169190910160400192915050565b60208082526018908201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604082015260600190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526014908201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604082015260600190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526017908201527f544f524e3a20696e76616c696420726563697069656e74000000000000000000604082015260600190565b6020808252601d908201527f45524332305065726d69743a206578706972656420646561646c696e65000000604082015260600190565b6020808252600c908201526b1513d4938e881c185d5cd95960a21b604082015260600190565b60208082526022908201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604082015261756560f01b606082015260800190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526022908201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604082015261756560f01b606082015260800190565b60208082526027908201527f544f524e3a2063616e6e6f74206368616e6765207472616e736665726162696c6040820152661a5d1e481e595d60ca1b606082015260800190565b6020808252601e908201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604082015260600190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526022908201527f544f524e3a2063616e206e6f742073656e6420746f207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252602d908201527f544f524e3a206f6e6c7920676f7665726e616e63652063616e20706572666f7260408201526c36903a3434b99030b1ba34b7b760991b606082015260800190565b6020808252601e908201527f544f524e3a20747279696e6720746f2073656e6420302062616c616e63650000604082015260600190565b90815260200190565b60ff91909116815260200190565b60405181810167ffffffffffffffff81118282101715611dd057600080fd5b604052919050565b600067ffffffffffffffff821115611dee578081fd5b5060209081020190565b60005b83811015611e13578181015183820152602001611dfb565b83811115611e22576000848401525b50505050565b6001600160a01b03811681146105fa57600080fd5b80151581146105fa57600080fdfe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e20616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220fd515804eca384cb14c99861e60dc5364ae65ba9ddfdfe00d195788ee631d01064736f6c634300060c0033";class Nd extends Ya{constructor(...e){e.length>1?super(...e):super(Cd,Sd,e[0])}getDeployTransaction(e,t,a,n){return super.getDeployTransaction(e,t,a,n||{})}deploy(e,t,a,n){return super.deploy(e,t,a,n||{})}connect(e){return super.connect(e)}static bytecode=Sd;static abi=Cd;static createInterface(){return new ba(Cd)}static connect(e,t){return new Wa(e,Cd,t)}}const Dd=[{inputs:[{internalType:"address",name:"_token",type:"address"},{internalType:"address",name:"_beneficiary",type:"address"},{internalType:"uint256",name:"_startTimestamp",type:"uint256"},{internalType:"uint256",name:"_cliffInMonths",type:"uint256"},{internalType:"uint256",name:"_durationInMonths",type:"uint256"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Released",type:"event"},{inputs:[],name:"SECONDS_PER_MONTH",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"beneficiary",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"blockTimestamp",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"cliffInMonths",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"durationInMonths",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"release",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"released",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"startTimestamp",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"contract IERC20",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"vestedAmount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"}],Ud="0x61012060405234801561001157600080fd5b50604051610c8c380380610c8c833981810160405260a081101561003457600080fd5b508051602082015160408301516060840151608090940151929391929091906001600160a01b0384166100ae576040805162461bcd60e51b815260206004820152601b60248201527f42656e65666963696172792063616e6e6f7420626520656d7074790000000000604482015290519081900360640190fd5b80821115610103576040805162461bcd60e51b815260206004820152601e60248201527f436c6966662069732067726561746572207468616e206475726174696f6e0000604482015290519081900360640190fd5b6001600160601b0319606086811b821660a05285901b1660805261010081905260c08290528215610134578261013c565b61013c61014a565b60e0525061014e9350505050565b4290565b60805160601c60a05160601c60c05160e05161010051610acc6101c060003980610203528061037b52806103dd525080610152528061018e52806105215250806101d052806104f352508061024852806102c85280610474528061054552508061012c52806104965250610acc6000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063928d89ae11610066578063928d89ae146100fb5780639613252114610103578063adb618321461010b578063e6fd48bc14610113578063fc0c546a1461011b5761009e565b806310786deb146100a357806338af3eed146100bd57806344b1231f146100e157806367097a4b146100e957806386d1a69f146100f1575b600080fd5b6100ab610123565b60408051918252519081900360200190f35b6100c561012a565b604080516001600160a01b039092168252519081900360200190f35b6100ab61014e565b6100ab6103db565b6100f96103ff565b005b6100ab6104f1565b6100ab610515565b6100ab61051b565b6100ab61051f565b6100c5610543565b62278d0081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60007f000000000000000000000000000000000000000000000000000000000000000061017961051b565b1015610187575060006103d8565b60006101bb7f00000000000000000000000000000000000000000000000000000000000000006101b561051b565b90610567565b905060006101cc8262278d006105b2565b90507f0000000000000000000000000000000000000000000000000000000000000000811015610201576000925050506103d8565b7f000000000000000000000000000000000000000000000000000000000000000081106102c457604080516370a0823160e01b815230600482015290516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916370a08231916024808301926020929190829003018186803b15801561028e57600080fd5b505afa1580156102a2573d6000803e3d6000fd5b505050506040513d60208110156102b857600080fd5b505192506103d8915050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561033357600080fd5b505afa158015610347573d6000803e3d6000fd5b505050506040513d602081101561035d57600080fd5b505160008054919250906103729083906105f4565b905060006103aa7f00000000000000000000000000000000000000000000000000000000000000006103a4848761064e565b906105b2565b905060006103c36000548361056790919063ffffffff16565b90506103cf84826106a7565b96505050505050505b90565b7f000000000000000000000000000000000000000000000000000000000000000081565b600061040961014e565b905060008111610457576040805162461bcd60e51b81526020600482015260146024820152734e6f20746f6b656e7320746f2072656c6561736560601b604482015290519081900360640190fd5b60005461046490826105f4565b6000556104bb6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f0000000000000000000000000000000000000000000000000000000000000000836106bd565b6040805182815290517ffb81f9b30d73d830c3544b34d827c08142579ee75710b490bab0b3995468c5659181900360200190a150565b7f000000000000000000000000000000000000000000000000000000000000000081565b60005481565b4290565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60006105a983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610714565b90505b92915050565b60006105a983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506107ab565b6000828201838110156105a9576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008261065d575060006105ac565b8282028284828161066a57fe5b04146105a95760405162461bcd60e51b8152600401808060200182810382526021815260200180610a4c6021913960400191505060405180910390fd5b60008183106106b657816105a9565b5090919050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261070f908490610810565b505050565b600081848411156107a35760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610768578181015183820152602001610750565b50505050905090810190601f1680156107955780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836107fa5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610768578181015183820152602001610750565b50600083858161080657fe5b0495945050505050565b6060610865826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166108c19092919063ffffffff16565b80519091501561070f5780806020019051602081101561088457600080fd5b505161070f5760405162461bcd60e51b815260040180806020018281038252602a815260200180610a6d602a913960400191505060405180910390fd5b60606108d084846000856108d8565b949350505050565b60606108e385610a45565b610934576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106109735780518252601f199092019160209182019101610954565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146109d5576040519150601f19603f3d011682016040523d82523d6000602084013e6109da565b606091505b509150915081156109ee5791506108d09050565b8051156109fe5780518082602001fd5b60405162461bcd60e51b8152602060048201818152865160248401528651879391928392604401919085019080838360008315610768578181015183820152602001610750565b3b15159056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a26469706673582212203b3e8370e345374172efb9e3693b20807c318ecfcc569df94f28df8a94f2727a64736f6c634300060c0033";class Vd extends Ya{constructor(...e){e.length>1?super(...e):super(Dd,Ud,e[0])}getDeployTransaction(e,t,a,n,b,f){return super.getDeployTransaction(e,t,a,n,b,f||{})}deploy(e,t,a,n,b,f){return super.deploy(e,t,a,n,b,f||{})}connect(e){return super.connect(e)}static bytecode=Ud;static abi=Dd;static createInterface(){return new ba(Dd)}static connect(e,t){return new Wa(e,Dd,t)}}const Fd=[{inputs:[{internalType:"bytes32",name:"_torn",type:"bytes32"},{internalType:"bytes32",name:"_governance",type:"bytes32"},{internalType:"uint256",name:"_duration",type:"uint256"},{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],internalType:"struct Voucher.Recipient[]",name:"_airdrops",type:"tuple[]"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"allowedTransferee",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"blockTimestamp",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32[]",name:"domains",type:"bytes32[]"}],name:"bulkResolve",outputs:[{internalType:"address[]",name:"result",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"expiresAt",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"governance",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"redeem",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"rescueExpiredTokens",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"resolve",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"torn",outputs:[{internalType:"contract IERC20",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],Ld="0x60e06040523480156200001157600080fd5b5060405162001d8d38038062001d8d833981016040819052620000349162000593565b60405180606001604052806026815260200162001d6760269139604051806040016040528060058152602001643b2a27a92760d91b81525081600390805190602001906200008492919062000497565b5080516200009a90600490602084019062000497565b50506005805460ff1916601217905550620000b584620001af565b60601b6001600160601b031916608052620000d083620001af565b60601b6001600160601b03191660c0526200010382620000ef620002fd565b6200030160201b6200098d1790919060201c565b60a05260005b8151811015620001a457620001558282815181106200012457fe5b6020026020010151600001518383815181106200013d57fe5b6020026020010151602001516200033260201b60201c565b6001600660008484815181106200016857fe5b602090810291909101810151516001600160a01b03168252810191909152604001600020805460ff191691151591909117905560010162000109565b505050505062000753565b600080620001bc62000415565b600114620001df57738595bfb0d940dfedc98943fa8a907091203f25ee620001f0565b6e0c2e074ec69a0dfb2997ba6c7d2e1e5b604051630178b8bf60e01b81529091506001600160a01b03821690630178b8bf906200022190869060040162000665565b60206040518083038186803b1580156200023a57600080fd5b505afa1580156200024f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000275919062000574565b6001600160a01b0316633b3b57de846040518263ffffffff1660e01b8152600401620002a2919062000665565b60206040518083038186803b158015620002bb57600080fd5b505afa158015620002d0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002f6919062000574565b9392505050565b4290565b600082820183811015620002f65760405162461bcd60e51b815260040162000329906200066e565b60405180910390fd5b6001600160a01b0382166200035b5760405162461bcd60e51b81526004016200032990620006dc565b620003696000838362000419565b62000385816002546200030160201b6200098d1790919060201c565b6002556001600160a01b03821660009081526020818152604090912054620003b89183906200098d62000301821b17901c565b6001600160a01b0383166000818152602081905260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906200040990859062000665565b60405180910390a35050565b4690565b620004318383836200049260201b620009b21760201c565b6001600160a01b03821615806200044f57506001600160a01b038316155b806200047357506001600160a01b03831660009081526006602052604090205460ff165b620004925760405162461bcd60e51b81526004016200032990620006a5565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620004da57805160ff19168380011785556200050a565b828001600101855582156200050a579182015b828111156200050a578251825591602001919060010190620004ed565b50620005189291506200051c565b5090565b5b808211156200051857600081556001016200051d565b60006040828403121562000545578081fd5b62000551604062000713565b9050815162000560816200073a565b808252506020820151602082015292915050565b60006020828403121562000586578081fd5b8151620002f6816200073a565b60008060008060808587031215620005a9578283fd5b8451935060208086015193506040808701519350606087015160018060401b0380821115620005d6578485fd5b818901915089601f830112620005ea578485fd5b815181811115620005f9578586fd5b62000608858683020162000713565b8181528581019250838601858302850187018d101562000626578788fd5b8794505b8285101562000654576200063f8d8262000533565b8452600194909401939286019285016200062a565b50989b979a50959850505050505050565b90815260200190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601e908201527f45524332303a207472616e73666572206973206e6f7420616c6c6f7765640000604082015260600190565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b6040518181016001600160401b03811182821017156200073257600080fd5b604052919050565b6001600160a01b03811681146200075057600080fd5b50565b60805160601c60a05160c05160601c6115c3620007a46000398061043152806107d35250806105c352806106ec52806107895250806106c8528061075d52806107f4528061089852506115c36000f3fe608060405234801561001057600080fd5b506004361061012c5760003560e01c80638622a689116100ad578063adf898a411610071578063adf898a41461024b578063be040fb014610253578063c39ef8551461025d578063dd62ed3e14610265578063f9e54234146102785761012c565b80638622a6891461020d57806395d89b4114610215578063a457c2d71461021d578063a9059cbb14610230578063adb61832146102435761012c565b806339509351116100f457806339509351146101ac5780635aa6e675146101bf5780635c23bdf5146101d45780635d4545a0146101e757806370a08231146101fa5761012c565b806306fdde0314610131578063095ea7b31461014f57806318160ddd1461016f57806323b872dd14610184578063313ce56714610197575b600080fd5b610139610298565b604051610146919061116f565b60405180910390f35b61016261015d366004610fb5565b61032e565b604051610146919061115b565b61017761034b565b6040516101469190611166565b610162610192366004610f75565b610351565b61019f6103d8565b604051610146919061145e565b6101626101ba366004610fb5565b6103e1565b6101c761042f565b60405161014691906110e1565b6101c76101e2366004611095565b610453565b6101626101f5366004610f05565b610591565b610177610208366004610f05565b6105a6565b6101776105c1565b6101396105e5565b61016261022b366004610fb5565b610646565b61016261023e366004610fb5565b6106ae565b6101776106c2565b6101c76106c6565b61025b6106ea565b005b61025b610787565b610177610273366004610f3d565b6108c1565b61028b610286366004610fe0565b6108ec565b604051610146919061110e565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103245780601f106102f957610100808354040283529160200191610324565b820191906000526020600020905b81548152906001019060200180831161030757829003601f168201915b5050505050905090565b600061034261033b6109b7565b84846109bb565b50600192915050565b60025490565b600061035e848484610a6f565b6103ce8461036a6109b7565b6103c985604051806060016040528060288152602001611541602891396001600160a01b038a166000908152600160205260408120906103a86109b7565b6001600160a01b031681526020810191909152604001600020549190610b84565b6109bb565b5060019392505050565b60055460ff1690565b60006103426103ee6109b7565b846103c985600160006103ff6109b7565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549061098d565b7f000000000000000000000000000000000000000000000000000000000000000081565b60008061045e610bb0565b60011461047f57738595bfb0d940dfedc98943fa8a907091203f25ee610490565b6e0c2e074ec69a0dfb2997ba6c7d2e1e5b604051630178b8bf60e01b81529091506001600160a01b03821690630178b8bf906104bf908690600401611166565b60206040518083038186803b1580156104d757600080fd5b505afa1580156104eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050f9190610f21565b6001600160a01b0316633b3b57de846040518263ffffffff1660e01b815260040161053a9190611166565b60206040518083038186803b15801561055257600080fd5b505afa158015610566573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058a9190610f21565b9392505050565b60066020526000908152604090205460ff1681565b6001600160a01b031660009081526020819052604090205490565b7f000000000000000000000000000000000000000000000000000000000000000081565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103245780601f106102f957610100808354040283529160200191610324565b60006103426106536109b7565b846103c985604051806060016040528060258152602001611569602591396001600061067d6109b7565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610b84565b60006103426106bb6109b7565b8484610a6f565b4290565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f00000000000000000000000000000000000000000000000000000000000000006107136106c2565b106107395760405162461bcd60e51b81526004016107309061125e565b60405180910390fd5b6000610744336105a6565b90506107503382610bb4565b6107846001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163383610c96565b50565b7f00000000000000000000000000000000000000000000000000000000000000006107b06106c2565b10156107ce5760405162461bcd60e51b815260040161073090611295565b6108bf7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161083e91906110e1565b60206040518083038186803b15801561085657600080fd5b505afa15801561086a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088e91906110ad565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169190610c96565b565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060815167ffffffffffffffff8111801561090657600080fd5b50604051908082528060200260200182016040528015610930578160200160208202803683370190505b50905060005b82518110156109875761095b83828151811061094e57fe5b6020026020010151610453565b82828151811061096757fe5b6001600160a01b0390921660209283029190910190910152600101610936565b50919050565b60008282018381101561058a5760405162461bcd60e51b815260040161073090611227565b505050565b3390565b6001600160a01b0383166109e15760405162461bcd60e51b815260040161073090611399565b6001600160a01b038216610a075760405162461bcd60e51b8152600401610730906111e5565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610a62908590611166565b60405180910390a3505050565b6001600160a01b038316610a955760405162461bcd60e51b815260040161073090611354565b6001600160a01b038216610abb5760405162461bcd60e51b8152600401610730906111a2565b610ac6838383610cec565b610b038160405180606001604052806026815260200161151b602691396001600160a01b0386166000908152602081905260409020549190610b84565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610b32908261098d565b6001600160a01b0380841660008181526020819052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610a62908590611166565b60008184841115610ba85760405162461bcd60e51b8152600401610730919061116f565b505050900390565b4690565b6001600160a01b038216610bda5760405162461bcd60e51b815260040161073090611313565b610be682600083610cec565b610c23816040518060600160405280602281526020016114f9602291396001600160a01b0385166000908152602081905260409020549190610b84565b6001600160a01b038316600090815260208190526040902055600254610c499082610d53565b6002556040516000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610c8a908590611166565b60405180910390a35050565b6109b28363a9059cbb60e01b8484604051602401610cb59291906110f5565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610d95565b610cf78383836109b2565b6001600160a01b0382161580610d1457506001600160a01b038316155b80610d3757506001600160a01b03831660009081526006602052604090205460ff165b6109b25760405162461bcd60e51b8152600401610730906112dc565b600061058a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610b84565b6060610dea826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610e249092919063ffffffff16565b8051909150156109b25780806020019051810190610e089190611075565b6109b25760405162461bcd60e51b815260040161073090611414565b6060610e338484600085610e3b565b949350505050565b6060610e4685610eff565b610e625760405162461bcd60e51b8152600401610730906113dd565b60006060866001600160a01b03168587604051610e7f91906110c5565b60006040518083038185875af1925050503d8060008114610ebc576040519150601f19603f3d011682016040523d82523d6000602084013e610ec1565b606091505b50915091508115610ed5579150610e339050565b805115610ee55780518082602001fd5b8360405162461bcd60e51b8152600401610730919061116f565b3b151590565b600060208284031215610f16578081fd5b813561058a816114e3565b600060208284031215610f32578081fd5b815161058a816114e3565b60008060408385031215610f4f578081fd5b8235610f5a816114e3565b91506020830135610f6a816114e3565b809150509250929050565b600080600060608486031215610f89578081fd5b8335610f94816114e3565b92506020840135610fa4816114e3565b929592945050506040919091013590565b60008060408385031215610fc7578182fd5b8235610fd2816114e3565b946020939093013593505050565b60006020808385031215610ff2578182fd5b823567ffffffffffffffff811115611008578283fd5b8301601f81018513611018578283fd5b803561102b61102682611493565b61146c565b8181528381019083850185840285018601891015611047578687fd5b8694505b8385101561106957803583526001949094019391850191850161104b565b50979650505050505050565b600060208284031215611086578081fd5b8151801515811461058a578182fd5b6000602082840312156110a6578081fd5b5035919050565b6000602082840312156110be578081fd5b5051919050565b600082516110d78184602087016114b3565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b8181101561114f5783516001600160a01b03168352928401929184019160010161112a565b50909695505050505050565b901515815260200190565b90815260200190565b600060208252825180602084015261118e8160408501602087016114b3565b601f01601f19169190910160400192915050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601f908201527f41697264726f702072656465656d20706572696f642068617320656e64656400604082015260600190565b60208082526027908201527f41697264726f702072656465656d20706572696f6420686173206e6f7420656e604082015266191959081e595d60ca1b606082015260800190565b6020808252601e908201527f45524332303a207472616e73666572206973206e6f7420616c6c6f7765640000604082015260600190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b60ff91909116815260200190565b60405181810167ffffffffffffffff8111828210171561148b57600080fd5b604052919050565b600067ffffffffffffffff8211156114a9578081fd5b5060209081020190565b60005b838110156114ce5781810151838201526020016114b6565b838111156114dd576000848401525b50505050565b6001600160a01b038116811461078457600080fdfe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212209b2d6f14167bc062b61418b8fca6b7946d243420e3df874c9632acb30079c69b64736f6c634300060c0033546f726e61646f4361736820766f756368657220666f72206561726c792061646f7074657273";class Gd extends Ya{constructor(...e){e.length>1?super(...e):super(Fd,Ld,e[0])}getDeployTransaction(e,t,a,n,b){return super.getDeployTransaction(e,t,a,n,b||{})}deploy(e,t,a,n,b){return super.deploy(e,t,a,n,b||{})}connect(e){return super.connect(e)}static bytecode=Ld;static abi=Fd;static createInterface(){return new ba(Fd)}static connect(e,t){return new Wa(e,Fd,t)}}var Bd=Object.freeze({__proto__:null,Airdrop__factory:Pd,ERC20Permit__factory:class{static abi=Ad;static createInterface(){return new ba(Ad)}static connect(e,t){return new Wa(e,Ad,t)}},TORN__factory:Nd,Vesting__factory:Vd,Voucher__factory:Gd,ensSol:sd,mocks:Rd});const jd=[{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"decimal",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"latestAnswer",outputs:[{internalType:"int256",name:"answer",type:"int256"}],stateMutability:"view",type:"function"}];class Hd{static abi=jd;static createInterface(){return new ba(jd)}static connect(e,t){return new Wa(e,jd,t)}}const zd=[{inputs:[{internalType:"address",name:"srcToken",type:"address"},{internalType:"bool",name:"useSrcWrappers",type:"bool"}],name:"getRateToEth",outputs:[{internalType:"uint256",name:"weightedRate",type:"uint256"}],stateMutability:"view",type:"function"}];class Wd{static abi=zd;static createInterface(){return new ba(zd)}static connect(e,t){return new Wa(e,zd,t)}}const $d=[{inputs:[{internalType:"address",name:"_stablecoin",type:"address"},{internalType:"address",name:"_stablecoinOracle",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"NotOwner",type:"error"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"arbitraryPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"chainlinkOracles",outputs:[{internalType:"contract IChainlinkOracle",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"price",type:"uint256"}],name:"changeArbitraryPrice",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"changeOwner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"}],name:"getOracleUSD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"srcToken",type:"address"},{internalType:"bool",name:"useSrcWrappers",type:"bool"}],name:"getRateToEth",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"isStablecoin",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address",name:"oracle",type:"address"},{internalType:"bool",name:"_isStablecoin",type:"bool"}],name:"setOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"stablecoin",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}],Xd="0x6080604052348015600f57600080fd5b50604051610905380380610905833981016040819052602c9160a7565b600080546001600160a01b039384166001600160a01b0319918216811783558252600260209081526040808420805460ff1916600190811790915590915290912080549290931691811691909117909155600480549091163317905560d5565b80516001600160a01b038116811460a257600080fd5b919050565b6000806040838503121560b957600080fd5b60c083608c565b915060cc60208401608c565b90509250929050565b610821806100e46000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063d16c130711610066578063d16c130714610165578063dd01555214610178578063dd3a825a1461018b578063df60d05a1461019e578063e9cbd822146101be57600080fd5b80631a650cc7146100a35780636a75aa66146100db5780637de4fd101461011c5780638da5cb5b1461013d578063a6f9dae114610150575b600080fd5b6100c66100b1366004610566565b60026020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b6101046100e9366004610566565b6001602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020016100d2565b61012f61012a366004610598565b6101d1565b6040519081526020016100d2565b600454610104906001600160a01b031681565b61016361015e366004610566565b610320565b005b6101636101733660046105cb565b61036d565b61012f610186366004610566565b6103f1565b61016361019936600461060e565b610503565b61012f6101ac366004610566565b60036020526000908152604090205481565b600054610104906001600160a01b031681565b6001600160a01b0382811660009081526001602052604081205490911661021157506001600160a01b03821660009081526003602052604090205461031a565b6000836001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610251573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102759190610638565b6001600160a01b03851660009081526002602052604090205490915060ff16156102ca576102a4816012610671565b6102af90600a610771565b6102b8856103f1565b6102c29190610780565b91505061031a565b600080546102e0906001600160a01b03166103f1565b90506102eb856103f1565b6102f6836024610671565b61030190600a610771565b61030b9083610780565b6103159190610797565b925050505b92915050565b6004546001600160a01b0316331461034b576040516330cd747160e01b815260040160405180910390fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6004546001600160a01b03163314610398576040516330cd747160e01b815260040160405180910390fd5b80156103c2576001600160a01b0383166000908152600260205260409020805460ff191660011790555b506001600160a01b03918216600090815260016020526040902080546001600160a01b03191691909216179055565b6001600160a01b03808216600090815260016020908152604080832054815163313ce56760e01b815291519394169284928392859263313ce567926004808401939192918290030181865afa15801561044e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104729190610638565b836001600160a01b03166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d491906107b9565b9092509050806104e58360126107d2565b6104f090600a610771565b6104fa9190610797565b95945050505050565b6004546001600160a01b0316331461052e576040516330cd747160e01b815260040160405180910390fd5b6001600160a01b03909116600090815260036020526040902055565b80356001600160a01b038116811461056157600080fd5b919050565b60006020828403121561057857600080fd5b6105818261054a565b9392505050565b8035801515811461056157600080fd5b600080604083850312156105ab57600080fd5b6105b48361054a565b91506105c260208401610588565b90509250929050565b6000806000606084860312156105e057600080fd5b6105e98461054a565b92506105f76020850161054a565b915061060560408501610588565b90509250925092565b6000806040838503121561062157600080fd5b61062a8361054a565b946020939093013593505050565b60006020828403121561064a57600080fd5b815160ff8116811461058157600080fd5b634e487b7160e01b600052601160045260246000fd5b60ff828116828216039081111561031a5761031a61065b565b6001815b60018411156106c5578085048111156106a9576106a961065b565b60018416156106b757908102905b60019390931c92800261068e565b935093915050565b6000826106dc5750600161031a565b816106e95750600061031a565b81600181146106ff576002811461070957610725565b600191505061031a565b60ff84111561071a5761071a61065b565b50506001821b61031a565b5060208310610133831016604e8410600b8410161715610748575081810a61031a565b610755600019848461068a565b80600019048211156107695761076961065b565b029392505050565b600061058160ff8416836106cd565b808202811582820484141761031a5761031a61065b565b6000826107b457634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156107cb57600080fd5b5051919050565b60ff818116838216019081111561031a5761031a61065b56fea264697066735822122014c0c48f05ab025151413c0ef2c884b3844e6a66084576e34b8337df8af8cf4564736f6c634300081c0033";class qd extends Ya{constructor(...e){e.length>1?super(...e):super($d,Xd,e[0])}getDeployTransaction(e,t,a){return super.getDeployTransaction(e,t,a||{})}deploy(e,t,a){return super.deploy(e,t,a||{})}connect(e){return super.connect(e)}static bytecode=Xd;static abi=$d;static createInterface(){return new ba($d)}static connect(e,t){return new Wa(e,$d,t)}}var Jd=Object.freeze({__proto__:null,IChainlinkOracle__factory:Hd,IOffchainOracle__factory:Wd,TestnetOracle__factory:qd});const Yd=[{inputs:[{internalType:"address",name:"_logic",type:"address"},{internalType:"address",name:"_admin",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"}],stateMutability:"payable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"previousAdmin",type:"address"},{indexed:!1,internalType:"address",name:"newAdmin",type:"address"}],name:"AdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{stateMutability:"payable",type:"fallback"},{inputs:[],name:"admin",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"callToOwner",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"newAdmin",type:"address"}],name:"changeAdmin",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"changeOwner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"delegateToOwner",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"getCurrentOwner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"implementation",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeToOwner",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],Kd="0x608060405260405162000e6738038062000e67833981810160405260608110156200002957600080fd5b815160208301516040808501805191519395929483019291846401000000008211156200005557600080fd5b9083019060208201858111156200006b57600080fd5b82516401000000008111828201881017156200008657600080fd5b82525081516020918201929091019080838360005b83811015620000b55781810151838201526020016200009b565b50505050905090810190601f168015620000e35780820380516001836020036101000a031916815260200191505b5060405250849150839050828282828281620000ff82620001f6565b805115620001bd576000826001600160a01b0316826040518082805190602001908083835b60208310620001455780518252601f19909201916020918201910162000124565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114620001a7576040519150601f19603f3d011682016040523d82523d6000602084013e620001ac565b606091505b5050905080620001bb57600080fd5b505b50620001c69050565b620001d1826200026d565b505050505050620001ed336200029160201b620008ab1760201c565b50505062000308565b6200020c81620002bd60201b620008d51760201c565b620002495760405162461bcd60e51b815260040180806020018281038252603681526020018062000e316036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b806200029c620002c3565b80546001600160a01b0319166001600160a01b039290921691909117905550565b3b151590565b604080517fb4d03667d60278cc15e9a68fa7679dc39ebe71350c4566a2c23c26580da4e0b3602080830191909152825180830382018152918301909252805191012090565b610b1980620003186000396000f3fe6080604052600436106100955760003560e01c80635c60da1b116100595780635c60da1b146102fe5780638f2839701461032f578063a18a186b14610362578063a6f9dae114610377578063f851a440146103aa576100a4565b806323711ab1146100ac57806323c735f1146101625780632e44e0e0146101955780633659cfe61461024b5780634f1ef2861461027e576100a4565b366100a4576100a26103bf565b005b6100a26103bf565b6100a2600480360360408110156100c257600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100ed57600080fd5b8201836020820111156100ff57600080fd5b8035906020019184600183028401116401000000008311171561012157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506103d9945050505050565b34801561016e57600080fd5b506100a26004803603602081101561018557600080fd5b50356001600160a01b03166104e7565b6100a2600480360360408110156101ab57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156101d657600080fd5b8201836020820111156101e857600080fd5b8035906020019184600183028401116401000000008311171561020a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610546945050505050565b34801561025757600080fd5b506100a26004803603602081101561026e57600080fd5b50356001600160a01b031661063a565b6100a26004803603604081101561029457600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156102bf57600080fd5b8201836020820111156102d157600080fd5b803590602001918460018302840111640100000000831117156102f357600080fd5b509092509050610671565b34801561030a57600080fd5b5061031361071e565b604080516001600160a01b039092168252519081900360200190f35b34801561033b57600080fd5b506100a26004803603602081101561035257600080fd5b50356001600160a01b031661075b565b34801561036e57600080fd5b50610313610815565b34801561038357600080fd5b506100a26004803603602081101561039a57600080fd5b50356001600160a01b0316610824565b3480156103b657600080fd5b50610313610880565b6103c76103d7565b6103d76103d26108db565b610900565b565b336103e2610924565b6001600160a01b03161461042c576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b6020831061046a5780518252601f19909201916020918201910161044b565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146104ca576040519150601f19603f3d011682016040523d82523d6000602084013e6104cf565b606091505b5091509150816104e157805181602001fd5b50505050565b336104f0610924565b6001600160a01b03161461053a576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b6105438161093d565b50565b3361054f610924565b6001600160a01b031614610599576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b60006060836001600160a01b031634846040518082805190602001908083835b602083106105d85780518252601f1990920191602091820191016105b9565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146104ca576040519150601f19603f3d011682016040523d82523d6000602084013e6104cf565b61064261097d565b6001600160a01b0316336001600160a01b03161415610669576106648161093d565b610543565b6105436103bf565b61067961097d565b6001600160a01b0316336001600160a01b031614156107115761069b8361093d565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146106f8576040519150601f19603f3d011682016040523d82523d6000602084013e6106fd565b606091505b505090508061070b57600080fd5b50610719565b6107196103bf565b505050565b600061072861097d565b6001600160a01b0316336001600160a01b03161415610750576107496108db565b9050610758565b6107586103bf565b90565b61076361097d565b6001600160a01b0316336001600160a01b03161415610669576001600160a01b0381166107c15760405162461bcd60e51b815260040180806020018281038252603a815260200180610a74603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6107ea61097d565b604080516001600160a01b03928316815291841660208301528051918290030190a1610664816109a2565b600061081f610924565b905090565b3361082d610924565b6001600160a01b031614610877576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b610543816108ab565b600061088a61097d565b6001600160a01b0316336001600160a01b031614156107505761074961097d565b806108b46109c6565b80546001600160a01b0319166001600160a01b039290921691909117905550565b3b151590565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561091f573d6000f35b3d6000fd5b600061092e6109c6565b546001600160a01b0316919050565b61094681610a0b565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b604080517fb4d03667d60278cc15e9a68fa7679dc39ebe71350c4566a2c23c26580da4e0b3602080830191909152825180830382018152918301909252805191012090565b610a14816108d5565b610a4f5760405162461bcd60e51b8152600401808060200182810382526036815260200180610aae6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374a264697066735822122001f07e10d1eeadbd61da070e50227b529a3ec4b8f2e780a0e6bc1dc6028ba95764736f6c634300060c00335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374";class Zd extends Ya{constructor(...e){e.length>1?super(...e):super(Yd,Kd,e[0])}getDeployTransaction(e,t,a,n){return super.getDeployTransaction(e,t,a,n||{})}deploy(e,t,a,n){return super.deploy(e,t,a,n||{})}connect(e){return super.connect(e)}static bytecode=Kd;static abi=Yd;static createInterface(){return new ba(Yd)}static connect(e,t){return new Wa(e,Yd,t)}}const Qd=[{inputs:[{internalType:"address",name:"_torn",type:"address"},{internalType:"address",name:"_governance",type:"address"},{internalType:"address",name:"_registry",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"instance",type:"address"},{indexed:!1,internalType:"uint256",name:"newFee",type:"uint256"}],name:"FeeUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint24",name:"newFee",type:"uint24"}],name:"UniswapTornPoolSwappingFeeChanged",type:"event"},{inputs:[],name:"PROTOCOL_FEE_DIVIDER",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract ITornadoInstance",name:"_instance",type:"address"}],name:"calculatePoolFee",outputs:[{internalType:"uint160",name:"",type:"uint160"}],stateMutability:"view",type:"function"},{inputs:[],name:"feeDeviations",outputs:[{components:[{internalType:"address",name:"instance",type:"address"},{internalType:"int256",name:"deviation",type:"int256"}],internalType:"struct FeeManager.Deviation[]",name:"results",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_token",type:"address"},{internalType:"uint24",name:"_uniswapPoolSwappingFee",type:"uint24"}],name:"getTokenPriceRatio",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"governance",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract ITornadoInstance",name:"",type:"address"}],name:"instanceFee",outputs:[{internalType:"uint160",name:"",type:"uint160"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract ITornadoInstance",name:"",type:"address"}],name:"instanceFeeUpdated",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract ITornadoInstance",name:"_instance",type:"address"}],name:"instanceFeeWithUpdate",outputs:[{internalType:"uint160",name:"",type:"uint160"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"registry",outputs:[{internalType:"contract InstanceRegistry",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint32",name:"newPeriod",type:"uint32"}],name:"setPeriodForTWAPOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_token",type:"address"},{internalType:"uint256",name:"_price",type:"uint256"}],name:"setTokenPrice",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint24",name:"_uniswapTornPoolSwappingFee",type:"uint24"}],name:"setUniswapTornPoolSwappingFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint24",name:"newLimit",type:"uint24"}],name:"setUpdateFeeTimeLimit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"torn",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"uniswapTimePeriod",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"uniswapTornPoolSwappingFee",outputs:[{internalType:"uint24",name:"",type:"uint24"}],stateMutability:"view",type:"function"},{inputs:[],name:"updateAllFees",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract ITornadoInstance",name:"_instance",type:"address"}],name:"updateFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"updateFeeTimeLimit",outputs:[{internalType:"uint24",name:"",type:"uint24"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract ITornadoInstance[]",name:"_instances",type:"address[]"}],name:"updateFees",outputs:[],stateMutability:"nonpayable",type:"function"}],ei="0x60e06040523480156200001157600080fd5b5060405162001ca738038062001ca783398101604081905262000034916200005c565b6001600160601b0319606093841b811660805291831b821660a05290911b1660c052620000c8565b60008060006060848603121562000071578283fd5b83516200007e81620000af565b60208501519093506200009181620000af565b6040850151909250620000a481620000af565b809150509250925092565b6001600160a01b0381168114620000c557600080fd5b50565b60805160601c60a05160601c60c05160601c611b866200012160003980610350528061061452806108915280610a42525080610539528061064c528061072d528061082252508061059852806107ad5250611b866000f3fe608060405234801561001057600080fd5b506004361061012c5760003560e01c806380eb7bf0116100ad578063bcc5ee6411610071578063bcc5ee641461024b578063c51c229714610253578063d8718fb114610266578063e1f121561461027b578063f522d6d61461028e5761012c565b806380eb7bf014610202578063a028752014610215578063adf898a414610228578063aeb3077a14610230578063b19a2972146102385761012c565b8063603a54fe116100f4578063603a54fe146101ac57806369574fef146101bf5780637b103999146101d25780637ccd2f48146101da57806380679eb3146101ef5761012c565b806305e34364146101315780632efbf3841461015a578063431f63c91461017a5780634bf0a5421461018f5780635aa6e675146101a4575b600080fd5b61014461013f366004611848565b610296565b6040516101519190611ab4565b60405180910390f35b61016d610168366004611848565b6102a8565b60405161015191906118d5565b61018d6101883660046115bc565b610305565b005b61019761034b565b6040516101519190611911565b61016d610537565b61016d6101ba366004611848565b61055b565b6101446101cd366004611584565b610576565b61016d610612565b6101e2610636565b6040516101519190611aa4565b61018d6101fd366004611898565b610641565b61018d610210366004611848565b61069c565b61018d610223366004611864565b610722565b61016d6107ab565b6101446107cf565b61018d6102463660046115e7565b6107d5565b6101e2610805565b61018d610261366004611864565b610817565b61026e610874565b6040516101519190611abd565b61016d610289366004611848565b610887565b61018d610a3d565b60026020526000908152604090205481565b600080546001600160a01b038316825260026020526040822054600160381b90910462ffffff16429190910311156102e3576102e38261069c565b506001600160a01b03808216600090815260016020526040902054165b919050565b3361030e610ad7565b6001600160a01b03161461033d5760405162461bcd60e51b815260040161033490611a06565b60405180910390fd5b6103478282610af0565b5050565b6060807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166310c13ac36040518163ffffffff1660e01b815260040160006040518083038186803b1580156103a757600080fd5b505afa1580156103bb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103e3919081019061167f565b9050805167ffffffffffffffff811180156103fd57600080fd5b5060405190808252806020026020018201604052801561043757816020015b6104246114b2565b81526020019060019003908161041c5790505b50915060005b815181101561053257600061046483838151811061045757fe5b6020026020010151610887565b6001600160a01b03169050600081156104e0576103e8826001600087878151811061048b57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060009054906101000a90046001600160a01b03166103e8026001600160a01b0316816104db57fe5b040390505b60405180604001604052808585815181106104f757fe5b60200260200101516001600160a01b031681526020018281525085848151811061051d57fe5b6020908102919091010152505060010161043d565b505090565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001602052600090815260409020546001600160a01b031681565b600061058183610b19565b610600576040805180820182526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811682528516602080830191909152825180840190935260005462ffffff80821685528616918401919091526105fb929063ffffffff630100000090910416610b44565b610609565b61060983610b19565b90505b92915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60005462ffffff1681565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461067657600080fd5b6000805463ffffffff90921663010000000266ffffffff00000019909216919091179055565b60006106a782610887565b6001600160a01b03838116600081815260016020908152604080832080546001600160a01b03191695871695909517909455600290528290204290559051919250907f6f0eaf2c2f89fb4cfe96a1dee5e764d60b52c7f48aaa590f0850e308aa1b953a906107169084906118d5565b60405180910390a25050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461075757600080fd5b6000805462ffffff191662ffffff83811691909117918290556040517fbfe65cfc2359076c4468c9b895156c309c78f94fb09f6d2fc0463c4ca9a71ac2926107a0921690611aa4565b60405180910390a150565b7f000000000000000000000000000000000000000000000000000000000000000081565b61271081565b60005b8151811015610347576107fd8282815181106107f057fe5b602002602001015161069c565b6001016107d8565b600054600160381b900462ffffff1681565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461084c57600080fd5b6000805462ffffff909216600160381b0269ffffff0000000000000019909216919091179055565b6000546301000000900463ffffffff1681565b60008060008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663032bb443876040518263ffffffff1660e01b81526004016108db91906118d5565b60a06040518083038186803b1580156108f357600080fd5b505afa158015610907573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092b91906117cd565b9450945050935093508063ffffffff1660001415610950576000945050505050610300565b6001600160a01b038316158015610965575083155b61096f5782610985565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25b925060006109938484610576565b9050610a32612710610a2c8463ffffffff16610a2685610a2c670de0b6b3a76400008e6001600160a01b0316638bca6d166040518163ffffffff1660e01b815260040160206040518083038186803b1580156109ee57600080fd5b505afa158015610a02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a269190611880565b90610b90565b90610bca565b979650505050505050565b610ad57f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166310c13ac36040518163ffffffff1660e01b815260040160006040518083038186803b158015610a9957600080fd5b505afa158015610aad573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610246919081019061167f565b565b6000610ae1610c0c565b546001600160a01b0316919050565b6000610afa610c61565b6001600160a01b03909316600090815260209390935250604090912055565b600080610b24610c61565b6001600160a01b0390931660009081526020939093525050604090205490565b60208084015190830151600091610b5b9184610c98565b84518451610b7e91670de0b6b3a764000091610b78919087610c98565b90610cc2565b81610b8557fe5b0490505b9392505050565b600082610b9f5750600061060c565b82820282848281610bac57fe5b04146106095760405162461bcd60e51b815260040161033490611a63565b600061060983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610ce6565b6000807fb4d03667d60278cc15e9a68fa7679dc39ebe71350c4566a2c23c26580da4e0b360001c604051602001610c439190611ab4565b60408051601f19818403018152919052805160209091012092915050565b6000807f6521c13ddfc30471ec629848a30b01f73c36737d417c11843e7a9afa6985e84860001c604051602001610c439190611ab4565b6000610cba8473c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28585610d1d565b949350505050565b6000821580610cdd57505081810281838281610cda57fe5b04145b61060c57600080fd5b60008183610d075760405162461bcd60e51b815260040161033491906119b3565b506000838581610d1357fe5b0495945050505050565b600080846001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610d5957600080fd5b505afa158015610d6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9191906118b4565b60ff16600a0a90506001600160a01b038681169086161415610dbd576001600160801b03169050610cba565b604051630b4c774160e11b8152610e5e90610e5690731f98431c8ad98523631ae4a59f267346ea31f98490631698ee8290610e00908b908b908b906004016118e9565b60206040518083038186803b158015610e1857600080fd5b505afa158015610e2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e509190611568565b85610e6f565b828888611004565b915050610cba565b50949350505050565b600063ffffffff8216610e945760405162461bcd60e51b815260040161033490611a2c565b60408051600280825260608083018452926020830190803683370190505090508281600081518110610ec257fe5b602002602001019063ffffffff16908163ffffffff1681525050600081600181518110610eeb57fe5b63ffffffff9092166020928302919091019091015260405163883bdbfd60e01b81526060906001600160a01b0386169063883bdbfd90610f2f908590600401611969565b60006040518083038186803b158015610f4757600080fd5b505afa158015610f5b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f83919081019061170b565b509050600081600081518110610f9557fe5b602002602001015182600181518110610faa57fe5b60200260200101510390508463ffffffff168160060b81610fc757fe5b05935060008160060b128015610fee57508463ffffffff168160060b81610fea57fe5b0715155b15610ffb57600019909301925b50505092915050565b600080611010866110ee565b90506001600160801b036001600160a01b0382161161107f576001600160a01b038082168002908481169086161061105f5761105a600160c01b876001600160801b031683611407565b611077565b61107781876001600160801b0316600160c01b611407565b925050610e66565b600061109e6001600160a01b0383168068010000000000000000611407565b9050836001600160a01b0316856001600160a01b0316106110d6576110d1600160801b876001600160801b031683611407565b610a32565b610a3281876001600160801b0316600160801b611407565b60008060008360020b12611105578260020b61110d565b8260020b6000035b9050620d89e88111156111325760405162461bcd60e51b815260040161033490611a48565b60006001821661114657600160801b611158565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff169050600282161561118c576ffff97272373d413259a46990580e213a0260801c5b60048216156111ab576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b60088216156111ca576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b60108216156111e9576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615611208576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615611227576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615611246576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615611266576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615611286576ff987a7253ac413176f2b074cf7815e540260801c5b6104008216156112a6576ff3392b0822b70005940c7a398e4b70f30260801c5b6108008216156112c6576fe7159475a2c29b7443b29c7fa6e889d90260801c5b6110008216156112e6576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615611306576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615611326576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615611346576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615611367576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b62020000821615611387576e5d6af8dedb81196699c329225ee6040260801c5b620400008216156113a6576d2216e584f5fa1ea926041bedfe980260801c5b620800008216156113c3576b048a170391f7dc42444e8fa20260801c5b60008460020b13156113de5780600019816113da57fe5b0490505b6401000000008106156113f25760016113f5565b60005b60ff16602082901c0192505050919050565b600080806000198587098686029250828110908390030390508061143d576000841161143257600080fd5b508290049050610b89565b80841161144957600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b604080518082019091526000808252602082015290565b600082601f8301126114d9578081fd5b81516114ec6114e782611af5565b611ace565b81815291506020808301908481018184028601820187101561150d57600080fd5b60005b8481101561153557815161152381611b15565b84529282019290820190600101611510565b505050505092915050565b803561060c81611b15565b805161060c81611b15565b8051600681900b811461060c57600080fd5b600060208284031215611579578081fd5b815161060981611b15565b60008060408385031215611596578081fd5b82356115a181611b15565b915060208301356115b181611b2d565b809150509250929050565b600080604083850312156115ce578182fd5b82356115d981611b15565b946020939093013593505050565b600060208083850312156115f9578182fd5b823567ffffffffffffffff81111561160f578283fd5b8301601f8101851361161f578283fd5b803561162d6114e782611af5565b8181528381019083850185840285018601891015611649578687fd5b8694505b838510156116735761165f8982611540565b83526001949094019391850191850161164d565b50979650505050505050565b60006020808385031215611691578182fd5b825167ffffffffffffffff8111156116a7578283fd5b8301601f810185136116b7578283fd5b80516116c56114e782611af5565b81815283810190838501858402850186018910156116e1578687fd5b8694505b83851015611673576116f7898261154b565b8352600194909401939185019185016116e5565b6000806040838503121561171d578182fd5b825167ffffffffffffffff80821115611734578384fd5b818501915085601f830112611747578384fd5b81516117556114e782611af5565b80828252602080830192508086018a828387028901011115611775578889fd5b8896505b8487101561179f5761178b8b82611556565b845260019690960195928101928101611779565b5088015190965093505050808211156117b6578283fd5b506117c3858286016114c9565b9150509250929050565b600080600080600060a086880312156117e4578081fd5b855180151581146117f3578182fd5b602087015190955061180481611b15565b604087015190945060028110611818578182fd5b606087015190935061182981611b2d565b608087015190925061183a81611b3e565b809150509295509295909350565b600060208284031215611859578081fd5b813561060981611b15565b600060208284031215611875578081fd5b813561060981611b2d565b600060208284031215611891578081fd5b5051919050565b6000602082840312156118a9578081fd5b813561060981611b3e565b6000602082840312156118c5578081fd5b815160ff81168114610609578182fd5b6001600160a01b0391909116815260200190565b6001600160a01b03938416815291909216602082015262ffffff909116604082015260600190565b602080825282518282018190526000919060409081850190868401855b8281101561195c57815180516001600160a01b0316855286015186850152928401929085019060010161192e565b5091979650505050505050565b6020808252825182820181905260009190848201906040850190845b818110156119a757835163ffffffff1683529284019291840191600101611985565b50909695505050505050565b6000602080835283518082850152825b818110156119df578581018301518582016040015282016119c3565b818111156119f05783604083870101525b50601f01601f1916929092016040019392505050565b6020808252600c908201526b2737ba1030b71037bbb732b960a11b604082015260600190565b602080825260029082015261042560f41b604082015260600190565b6020808252600190820152601560fa1b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b62ffffff91909116815260200190565b90815260200190565b63ffffffff91909116815260200190565b60405181810167ffffffffffffffff81118282101715611aed57600080fd5b604052919050565b600067ffffffffffffffff821115611b0b578081fd5b5060209081020190565b6001600160a01b0381168114611b2a57600080fd5b50565b62ffffff81168114611b2a57600080fd5b63ffffffff81168114611b2a57600080fdfea2646970667358221220e716ce7751ca9331e897d31f3744c6916e2f742be6df42551b069b566751df4c64736f6c634300060c0033";class ti extends Ya{constructor(...e){e.length>1?super(...e):super(Qd,ei,e[0])}getDeployTransaction(e,t,a,n){return super.getDeployTransaction(e,t,a,n||{})}deploy(e,t,a,n){return super.deploy(e,t,a,n||{})}connect(e){return super.connect(e)}static bytecode=ei;static abi=Qd;static createInterface(){return new ba(Qd)}static connect(e,t){return new Wa(e,Qd,t)}}const ai=[{inputs:[{internalType:"address",name:"_logic",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"}],stateMutability:"payable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"previousAdmin",type:"address"},{indexed:!1,internalType:"address",name:"newAdmin",type:"address"}],name:"AdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{stateMutability:"payable",type:"fallback"},{inputs:[],name:"admin",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"callToOwner",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"newAdmin",type:"address"}],name:"changeAdmin",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"changeOwner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"delegateToOwner",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"getCurrentOwner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"implementation",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeToOwner",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],ni="0x608060405260405162000e6038038062000e60833981810160405260408110156200002957600080fd5b8151602083018051604051929492938301929190846401000000008211156200005157600080fd5b9083019060208201858111156200006757600080fd5b82516401000000008111828201881017156200008257600080fd5b82525081516020918201929091019080838360005b83811015620000b157818101518382015260200162000097565b50505050905090810190601f168015620000df5780820380516001836020036101000a031916815260200191505b50604052508391508290508130828281620000fa82620001ef565b805115620001b8576000826001600160a01b0316826040518082805190602001908083835b60208310620001405780518252601f1990920191602091820191016200011f565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114620001a2576040519150601f19603f3d011682016040523d82523d6000602084013e620001a7565b606091505b5050905080620001b657600080fd5b505b50620001c19050565b620001cc8262000266565b5050505050620001e7336200028a60201b620008ab1760201c565b505062000301565b6200020581620002b660201b620008d51760201c565b620002425760405162461bcd60e51b815260040180806020018281038252603681526020018062000e2a6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b8062000295620002bc565b80546001600160a01b0319166001600160a01b039290921691909117905550565b3b151590565b604080517fb4d03667d60278cc15e9a68fa7679dc39ebe71350c4566a2c23c26580da4e0b3602080830191909152825180830382018152918301909252805191012090565b610b1980620003116000396000f3fe6080604052600436106100955760003560e01c80635c60da1b116100595780635c60da1b146102fe5780638f2839701461032f578063a18a186b14610362578063a6f9dae114610377578063f851a440146103aa576100a4565b806323711ab1146100ac57806323c735f1146101625780632e44e0e0146101955780633659cfe61461024b5780634f1ef2861461027e576100a4565b366100a4576100a26103bf565b005b6100a26103bf565b6100a2600480360360408110156100c257600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100ed57600080fd5b8201836020820111156100ff57600080fd5b8035906020019184600183028401116401000000008311171561012157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506103d9945050505050565b34801561016e57600080fd5b506100a26004803603602081101561018557600080fd5b50356001600160a01b03166104e7565b6100a2600480360360408110156101ab57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156101d657600080fd5b8201836020820111156101e857600080fd5b8035906020019184600183028401116401000000008311171561020a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610546945050505050565b34801561025757600080fd5b506100a26004803603602081101561026e57600080fd5b50356001600160a01b031661063a565b6100a26004803603604081101561029457600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156102bf57600080fd5b8201836020820111156102d157600080fd5b803590602001918460018302840111640100000000831117156102f357600080fd5b509092509050610671565b34801561030a57600080fd5b5061031361071e565b604080516001600160a01b039092168252519081900360200190f35b34801561033b57600080fd5b506100a26004803603602081101561035257600080fd5b50356001600160a01b031661075b565b34801561036e57600080fd5b50610313610815565b34801561038357600080fd5b506100a26004803603602081101561039a57600080fd5b50356001600160a01b0316610824565b3480156103b657600080fd5b50610313610880565b6103c76103d7565b6103d76103d26108db565b610900565b565b336103e2610924565b6001600160a01b03161461042c576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b6020831061046a5780518252601f19909201916020918201910161044b565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146104ca576040519150601f19603f3d011682016040523d82523d6000602084013e6104cf565b606091505b5091509150816104e157805181602001fd5b50505050565b336104f0610924565b6001600160a01b03161461053a576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b6105438161093d565b50565b3361054f610924565b6001600160a01b031614610599576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b60006060836001600160a01b031634846040518082805190602001908083835b602083106105d85780518252601f1990920191602091820191016105b9565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146104ca576040519150601f19603f3d011682016040523d82523d6000602084013e6104cf565b61064261097d565b6001600160a01b0316336001600160a01b03161415610669576106648161093d565b610543565b6105436103bf565b61067961097d565b6001600160a01b0316336001600160a01b031614156107115761069b8361093d565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146106f8576040519150601f19603f3d011682016040523d82523d6000602084013e6106fd565b606091505b505090508061070b57600080fd5b50610719565b6107196103bf565b505050565b600061072861097d565b6001600160a01b0316336001600160a01b03161415610750576107496108db565b9050610758565b6107586103bf565b90565b61076361097d565b6001600160a01b0316336001600160a01b03161415610669576001600160a01b0381166107c15760405162461bcd60e51b815260040180806020018281038252603a815260200180610a74603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6107ea61097d565b604080516001600160a01b03928316815291841660208301528051918290030190a1610664816109a2565b600061081f610924565b905090565b3361082d610924565b6001600160a01b031614610877576040805162461bcd60e51b815260206004820152600c60248201526b2737ba1030b71037bbb732b960a11b604482015290519081900360640190fd5b610543816108ab565b600061088a61097d565b6001600160a01b0316336001600160a01b031614156107505761074961097d565b806108b46109c6565b80546001600160a01b0319166001600160a01b039290921691909117905550565b3b151590565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561091f573d6000f35b3d6000fd5b600061092e6109c6565b546001600160a01b0316919050565b61094681610a0b565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b604080517fb4d03667d60278cc15e9a68fa7679dc39ebe71350c4566a2c23c26580da4e0b3602080830191909152825180830382018152918301909252805191012090565b610a14816108d5565b610a4f5760405162461bcd60e51b8152600401808060200182810382526036815260200180610aae6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374a2646970667358221220486b8f46c84e133fdcdf09d6e85ae28603a923477471dc965d4d7f5f3634234c64736f6c634300060c00335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374";class bi extends Ya{constructor(...e){e.length>1?super(...e):super(ai,ni,e[0])}getDeployTransaction(e,t,a){return super.getDeployTransaction(e,t,a||{})}deploy(e,t,a){return super.deploy(e,t,a||{})}connect(e){return super.connect(e)}static bytecode=ni;static abi=ai;static createInterface(){return new ba(ai)}static connect(e,t){return new Wa(e,ai,t)}}var fi=Object.freeze({__proto__:null,TestnetAdminProxy__factory:Zd,TestnetFeeManager__factory:ti,TestnetGovernanceProxy__factory:bi,testnetOracleSol:Jd});const di=[{inputs:[{internalType:"address",name:"account",type:"address"}],name:"lockedBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"userVault",outputs:[{internalType:"contract ITornadoVault",name:"",type:"address"}],stateMutability:"view",type:"function"}];class ii{static abi=di;static createInterface(){return new ba(di)}static connect(e,t){return new Wa(e,di,t)}}const si=[{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawTorn",outputs:[],stateMutability:"nonpayable",type:"function"}];let ri=class{static abi=si;static createInterface(){return new ba(si)}static connect(e,t){return new Wa(e,si,t)}};const pi=[{inputs:[{internalType:"address",name:"governanceAddress",type:"address"},{internalType:"address",name:"tornAddress",type:"address"},{internalType:"address",name:"_relayerRegistry",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"rewardsClaimed",type:"uint256"}],name:"RewardsClaimed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"rewards",type:"uint256"}],name:"RewardsUpdated",type:"event"},{inputs:[],name:"Governance",outputs:[{internalType:"contract ITornadoGovernance",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"accumulatedRewardPerTorn",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"accumulatedRewardRateOnLastUpdate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"accumulatedRewards",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"addBurnRewards",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"checkReward",outputs:[{internalType:"uint256",name:"rewards",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"ratioConstant",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"relayerRegistry",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"setReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"torn",outputs:[{internalType:"contract IERC20",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amountLockedBeforehand",type:"uint256"}],name:"updateRewardsOnLockedBalanceChange",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawTorn",outputs:[],stateMutability:"nonpayable",type:"function"}],ci="0x6101006040523480156200001257600080fd5b50604051620011e4380380620011e48339810160408190526200003591620000e0565b6001600160601b0319606084811b821660a05283811b821660c05282901b1660e052604080516318160ddd60e01b815290516001600160a01b038416916318160ddd916004808301926020929190829003018186803b1580156200009857600080fd5b505afa158015620000ad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000d3919062000133565b6080525062000165915050565b600080600060608486031215620000f5578283fd5b835162000102816200014c565b602085015190935062000115816200014c565b604085015190925062000128816200014c565b809150509250925092565b60006020828403121562000145578081fd5b5051919050565b6001600160a01b03811681146200016257600080fd5b50565b60805160a05160601c60c05160601c60e05160601c610ff0620001f4600039806101eb52806104f652508061023a52806104815280610574528061084252806108d75250806101b9528061026952806103ab5280610550528061059b52806106e5528061078052806107e452806108f952508061036a528061052c528061065f52806109f55250610ff06000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063adf898a41161008c578063e0d3265211610066578063e0d326521461016d578063e113335f14610175578063eacccaf014610188578063f58073b11461019b576100cf565b8063adf898a41461013f578063c3c90e6414610147578063d7ada20d1461015a576100cf565b8063338610af146100d45780633d18b912146100e957806347ff589d146100f157806373f273fc1461010f57806380a120411461012f5780639453911214610137575b600080fd5b6100e76100e2366004610d78565b6101ae565b005b6100e76103a3565b6100f96104f4565b6040516101069190610dc4565b60405180910390f35b61012261011d366004610cf5565b610518565b6040516101069190610f6c565b61012261052a565b6100f961054e565b6100f9610572565b610122610155366004610cf5565b610596565b610122610168366004610cf5565b6106c2565b6101226106d4565b6100e7610183366004610d11565b6106da565b6100e7610196366004610d11565b610775565b6100e76101a9366004610d78565b6107d9565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061020d5750336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016145b6102325760405162461bcd60e51b815260040161022990610ec5565b60405180910390fd5b61039d6103947f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a082317f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639daafec76040518163ffffffff1660e01b815260040160206040518083038186803b1580156102c057600080fd5b505afa1580156102d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f89190610d5c565b6040518263ffffffff1660e01b81526004016103149190610dc4565b60206040518083038186803b15801561032c57600080fd5b505afa158015610340573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103649190610d90565b61038e847f0000000000000000000000000000000000000000000000000000000000000000610921565b90610964565b600154906109a6565b60015550565b600061044a337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639ae697bf336040518263ffffffff1660e01b81526004016103f59190610dc4565b60206040518083038186803b15801561040d57600080fd5b505afa158015610421573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104459190610d90565b6109cb565b336000908152600360205260409020549091506104689082906109a6565b336000818152600360205260408120559091506104b0907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169083610a85565b336001600160a01b03167ffc30cddea38e2bf4d6ea7d3f9ed3b6ad7f176419f4963bd81318067a4aee73fe826040516104e99190610f6c565b60405180910390a250565b7f000000000000000000000000000000000000000000000000000000000000000081565b60036020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639ae697bf846040518263ffffffff1660e01b81526004016105e59190610dc4565b60206040518083038186803b1580156105fd57600080fd5b505afa158015610611573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106359190610d90565b90508015610697576001600160a01b038316600090815260026020526040902054600154610694917f00000000000000000000000000000000000000000000000000000000000000009161038e91859161068e91610ae0565b90610921565b91505b6001600160a01b0383166000908152600360205260409020546106bb9083906109a6565b9392505050565b60026020526000908152604090205481565b60015481565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146107225760405162461bcd60e51b815260040161022990610e5b565b600061072e83836109cb565b6001600160a01b03841660009081526003602052604090205490915061075490826109a6565b6001600160a01b039093166000908152600360205260409020929092555050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146107bd5760405162461bcd60e51b815260040161022990610e5b565b6001600160a01b03909116600090815260036020526040902055565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108215760405162461bcd60e51b815260040161022990610e5b565b6000198114156108ca576040516370a0823160e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190610877903090600401610dc4565b60206040518083038186803b15801561088f57600080fd5b505afa1580156108a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c79190610d90565b90505b61091e6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f000000000000000000000000000000000000000000000000000000000000000083610a85565b50565b6000826109305750600061095e565b8282028284828161093d57fe5b041461095b5760405162461bcd60e51b815260040161022990610e84565b90505b92915050565b600061095b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610b22565b60008282018381101561095b5760405162461bcd60e51b815260040161022990610e24565b60008115610a27576001600160a01b038316600090815260026020526040902054600154610a24917f00000000000000000000000000000000000000000000000000000000000000009161038e91869161068e91610ae0565b90505b6001546001600160a01b038416600081815260026020526040908190209290925590517f39fe62076cf7adf3c60e355a2da5a4f17a958ca319e8eba385a6c09a8b64901690610a77908490610f6c565b60405180910390a292915050565b610adb8363a9059cbb60e01b8484604051602401610aa4929190610dd8565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b59565b505050565b600061095b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610be8565b60008183610b435760405162461bcd60e51b81526004016102299190610df1565b506000838581610b4f57fe5b0495945050505050565b6060610bae826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c149092919063ffffffff16565b805190915015610adb5780806020019051810190610bcc9190610d3c565b610adb5760405162461bcd60e51b815260040161022990610f22565b60008184841115610c0c5760405162461bcd60e51b81526004016102299190610df1565b505050900390565b6060610c238484600085610c2b565b949350505050565b6060610c3685610cef565b610c525760405162461bcd60e51b815260040161022990610eeb565b60006060866001600160a01b03168587604051610c6f9190610da8565b60006040518083038185875af1925050503d8060008114610cac576040519150601f19603f3d011682016040523d82523d6000602084013e610cb1565b606091505b50915091508115610cc5579150610c239050565b805115610cd55780518082602001fd5b8360405162461bcd60e51b81526004016102299190610df1565b3b151590565b600060208284031215610d06578081fd5b813561095b81610fa5565b60008060408385031215610d23578081fd5b8235610d2e81610fa5565b946020939093013593505050565b600060208284031215610d4d578081fd5b8151801515811461095b578182fd5b600060208284031215610d6d578081fd5b815161095b81610fa5565b600060208284031215610d89578081fd5b5035919050565b600060208284031215610da1578081fd5b5051919050565b60008251610dba818460208701610f75565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6000602082528251806020840152610e10816040850160208701610f75565b601f01601f19169190910160400192915050565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252600f908201526e6f6e6c7920676f7665726e616e636560881b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252600c908201526b1d5b985d5d1a1bdc9a5e995960a21b604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b90815260200190565b60005b83811015610f90578181015183820152602001610f78565b83811115610f9f576000848401525b50505050565b6001600160a01b038116811461091e57600080fdfea2646970667358221220007ef4aab133b842800388614e081de933a2da981d94088bca1e1a924db5174764736f6c634300060c0033";class ui extends Ya{constructor(...e){e.length>1?super(...e):super(pi,ci,e[0])}getDeployTransaction(e,t,a,n){return super.getDeployTransaction(e,t,a,n||{})}deploy(e,t,a,n){return super.deploy(e,t,a,n||{})}connect(e){return super.connect(e)}static bytecode=ci;static abi=pi;static createInterface(){return new ba(pi)}static connect(e,t){return new Wa(e,pi,t)}}var yi=Object.freeze({__proto__:null,ITornadoGovernance__factory:ii,ITornadoVault__factory:ri,TornadoStakingRewards__factory:ui});const oi=[{inputs:[{internalType:"int24",name:"tickLower",type:"int24"},{internalType:"int24",name:"tickUpper",type:"int24"},{internalType:"uint128",name:"amount",type:"uint128"}],name:"burn",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"int24",name:"tickLower",type:"int24"},{internalType:"int24",name:"tickUpper",type:"int24"},{internalType:"uint128",name:"amount0Requested",type:"uint128"},{internalType:"uint128",name:"amount1Requested",type:"uint128"}],name:"collect",outputs:[{internalType:"uint128",name:"amount0",type:"uint128"},{internalType:"uint128",name:"amount1",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"flash",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint16",name:"observationCardinalityNext",type:"uint16"}],name:"increaseObservationCardinalityNext",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint160",name:"sqrtPriceX96",type:"uint160"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"int24",name:"tickLower",type:"int24"},{internalType:"int24",name:"tickUpper",type:"int24"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mint",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"bool",name:"zeroForOne",type:"bool"},{internalType:"int256",name:"amountSpecified",type:"int256"},{internalType:"uint160",name:"sqrtPriceLimitX96",type:"uint160"},{internalType:"bytes",name:"data",type:"bytes"}],name:"swap",outputs:[{internalType:"int256",name:"amount0",type:"int256"},{internalType:"int256",name:"amount1",type:"int256"}],stateMutability:"nonpayable",type:"function"}];class li{static abi=oi;static createInterface(){return new ba(oi)}static connect(e,t){return new Wa(e,oi,t)}}const mi=[{inputs:[{internalType:"uint32[]",name:"secondsAgos",type:"uint32[]"}],name:"observe",outputs:[{internalType:"int56[]",name:"tickCumulatives",type:"int56[]"},{internalType:"uint160[]",name:"secondsPerLiquidityCumulativeX128s",type:"uint160[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"int24",name:"tickLower",type:"int24"},{internalType:"int24",name:"tickUpper",type:"int24"}],name:"snapshotCumulativesInside",outputs:[{internalType:"int56",name:"tickCumulativeInside",type:"int56"},{internalType:"uint160",name:"secondsPerLiquidityInsideX128",type:"uint160"},{internalType:"uint32",name:"secondsInside",type:"uint32"}],stateMutability:"view",type:"function"}];class Ti{static abi=mi;static createInterface(){return new ba(mi)}static connect(e,t){return new Wa(e,mi,t)}}const gi=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"int24",name:"tickLower",type:"int24"},{indexed:!0,internalType:"int24",name:"tickUpper",type:"int24"},{indexed:!1,internalType:"uint128",name:"amount",type:"uint128"},{indexed:!1,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1",type:"uint256"}],name:"Burn",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!0,internalType:"int24",name:"tickLower",type:"int24"},{indexed:!0,internalType:"int24",name:"tickUpper",type:"int24"},{indexed:!1,internalType:"uint128",name:"amount0",type:"uint128"},{indexed:!1,internalType:"uint128",name:"amount1",type:"uint128"}],name:"Collect",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!0,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"uint128",name:"amount0",type:"uint128"},{indexed:!1,internalType:"uint128",name:"amount1",type:"uint128"}],name:"CollectProtocol",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!0,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1",type:"uint256"},{indexed:!1,internalType:"uint256",name:"paid0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"paid1",type:"uint256"}],name:"Flash",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint16",name:"observationCardinalityNextOld",type:"uint16"},{indexed:!1,internalType:"uint16",name:"observationCardinalityNextNew",type:"uint16"}],name:"IncreaseObservationCardinalityNext",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint160",name:"sqrtPriceX96",type:"uint160"},{indexed:!1,internalType:"int24",name:"tick",type:"int24"}],name:"Initialize",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"sender",type:"address"},{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"int24",name:"tickLower",type:"int24"},{indexed:!0,internalType:"int24",name:"tickUpper",type:"int24"},{indexed:!1,internalType:"uint128",name:"amount",type:"uint128"},{indexed:!1,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1",type:"uint256"}],name:"Mint",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint8",name:"feeProtocol0Old",type:"uint8"},{indexed:!1,internalType:"uint8",name:"feeProtocol1Old",type:"uint8"},{indexed:!1,internalType:"uint8",name:"feeProtocol0New",type:"uint8"},{indexed:!1,internalType:"uint8",name:"feeProtocol1New",type:"uint8"}],name:"SetFeeProtocol",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!0,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"int256",name:"amount0",type:"int256"},{indexed:!1,internalType:"int256",name:"amount1",type:"int256"},{indexed:!1,internalType:"uint160",name:"sqrtPriceX96",type:"uint160"},{indexed:!1,internalType:"uint128",name:"liquidity",type:"uint128"},{indexed:!1,internalType:"int24",name:"tick",type:"int24"}],name:"Swap",type:"event"}];class wi{static abi=gi;static createInterface(){return new ba(gi)}static connect(e,t){return new Wa(e,gi,t)}}const hi=[{inputs:[],name:"factory",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"fee",outputs:[{internalType:"uint24",name:"",type:"uint24"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxLiquidityPerTick",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"tickSpacing",outputs:[{internalType:"int24",name:"",type:"int24"}],stateMutability:"view",type:"function"},{inputs:[],name:"token0",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"token1",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}];class vi{static abi=hi;static createInterface(){return new ba(hi)}static connect(e,t){return new Wa(e,hi,t)}}const Mi=[{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint128",name:"amount0Requested",type:"uint128"},{internalType:"uint128",name:"amount1Requested",type:"uint128"}],name:"collectProtocol",outputs:[{internalType:"uint128",name:"amount0",type:"uint128"},{internalType:"uint128",name:"amount1",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint8",name:"feeProtocol0",type:"uint8"},{internalType:"uint8",name:"feeProtocol1",type:"uint8"}],name:"setFeeProtocol",outputs:[],stateMutability:"nonpayable",type:"function"}];class _i{static abi=Mi;static createInterface(){return new ba(Mi)}static connect(e,t){return new Wa(e,Mi,t)}}const xi=[{inputs:[],name:"feeGrowthGlobal0X128",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"feeGrowthGlobal1X128",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"liquidity",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"observations",outputs:[{internalType:"uint32",name:"blockTimestamp",type:"uint32"},{internalType:"int56",name:"tickCumulative",type:"int56"},{internalType:"uint160",name:"secondsPerLiquidityCumulativeX128",type:"uint160"},{internalType:"bool",name:"initialized",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"key",type:"bytes32"}],name:"positions",outputs:[{internalType:"uint128",name:"_liquidity",type:"uint128"},{internalType:"uint256",name:"feeGrowthInside0LastX128",type:"uint256"},{internalType:"uint256",name:"feeGrowthInside1LastX128",type:"uint256"},{internalType:"uint128",name:"tokensOwed0",type:"uint128"},{internalType:"uint128",name:"tokensOwed1",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"protocolFees",outputs:[{internalType:"uint128",name:"token0",type:"uint128"},{internalType:"uint128",name:"token1",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"slot0",outputs:[{internalType:"uint160",name:"sqrtPriceX96",type:"uint160"},{internalType:"int24",name:"tick",type:"int24"},{internalType:"uint16",name:"observationIndex",type:"uint16"},{internalType:"uint16",name:"observationCardinality",type:"uint16"},{internalType:"uint16",name:"observationCardinalityNext",type:"uint16"},{internalType:"uint8",name:"feeProtocol",type:"uint8"},{internalType:"bool",name:"unlocked",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"int16",name:"wordPosition",type:"int16"}],name:"tickBitmap",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"int24",name:"tick",type:"int24"}],name:"ticks",outputs:[{internalType:"uint128",name:"liquidityGross",type:"uint128"},{internalType:"int128",name:"liquidityNet",type:"int128"},{internalType:"uint256",name:"feeGrowthOutside0X128",type:"uint256"},{internalType:"uint256",name:"feeGrowthOutside1X128",type:"uint256"},{internalType:"int56",name:"tickCumulativeOutside",type:"int56"},{internalType:"uint160",name:"secondsPerLiquidityOutsideX128",type:"uint160"},{internalType:"uint32",name:"secondsOutside",type:"uint32"},{internalType:"bool",name:"initialized",type:"bool"}],stateMutability:"view",type:"function"}];class Ii{static abi=xi;static createInterface(){return new ba(xi)}static connect(e,t){return new Wa(e,xi,t)}}var Ei=Object.freeze({__proto__:null,IUniswapV3PoolActions__factory:li,IUniswapV3PoolDerivedState__factory:Ti,IUniswapV3PoolEvents__factory:wi,IUniswapV3PoolImmutables__factory:vi,IUniswapV3PoolOwnerActions__factory:_i,IUniswapV3PoolState__factory:Ii});const Ri=[{anonymous:!1,inputs:[{indexed:!0,internalType:"uint24",name:"fee",type:"uint24"},{indexed:!0,internalType:"int24",name:"tickSpacing",type:"int24"}],name:"FeeAmountEnabled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnerChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"token0",type:"address"},{indexed:!0,internalType:"address",name:"token1",type:"address"},{indexed:!0,internalType:"uint24",name:"fee",type:"uint24"},{indexed:!1,internalType:"int24",name:"tickSpacing",type:"int24"},{indexed:!1,internalType:"address",name:"pool",type:"address"}],name:"PoolCreated",type:"event"},{inputs:[{internalType:"address",name:"tokenA",type:"address"},{internalType:"address",name:"tokenB",type:"address"},{internalType:"uint24",name:"fee",type:"uint24"}],name:"createPool",outputs:[{internalType:"address",name:"pool",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint24",name:"fee",type:"uint24"},{internalType:"int24",name:"tickSpacing",type:"int24"}],name:"enableFeeAmount",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint24",name:"fee",type:"uint24"}],name:"feeAmountTickSpacing",outputs:[{internalType:"int24",name:"",type:"int24"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"tokenA",type:"address"},{internalType:"address",name:"tokenB",type:"address"},{internalType:"uint24",name:"fee",type:"uint24"}],name:"getPool",outputs:[{internalType:"address",name:"pool",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_owner",type:"address"}],name:"setOwner",outputs:[],stateMutability:"nonpayable",type:"function"}];class Oi{static abi=Ri;static createInterface(){return new ba(Ri)}static connect(e,t){return new Wa(e,Ri,t)}}const ki=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"int24",name:"tickLower",type:"int24"},{indexed:!0,internalType:"int24",name:"tickUpper",type:"int24"},{indexed:!1,internalType:"uint128",name:"amount",type:"uint128"},{indexed:!1,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1",type:"uint256"}],name:"Burn",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!0,internalType:"int24",name:"tickLower",type:"int24"},{indexed:!0,internalType:"int24",name:"tickUpper",type:"int24"},{indexed:!1,internalType:"uint128",name:"amount0",type:"uint128"},{indexed:!1,internalType:"uint128",name:"amount1",type:"uint128"}],name:"Collect",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!0,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"uint128",name:"amount0",type:"uint128"},{indexed:!1,internalType:"uint128",name:"amount1",type:"uint128"}],name:"CollectProtocol",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!0,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1",type:"uint256"},{indexed:!1,internalType:"uint256",name:"paid0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"paid1",type:"uint256"}],name:"Flash",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint16",name:"observationCardinalityNextOld",type:"uint16"},{indexed:!1,internalType:"uint16",name:"observationCardinalityNextNew",type:"uint16"}],name:"IncreaseObservationCardinalityNext",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint160",name:"sqrtPriceX96",type:"uint160"},{indexed:!1,internalType:"int24",name:"tick",type:"int24"}],name:"Initialize",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"sender",type:"address"},{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"int24",name:"tickLower",type:"int24"},{indexed:!0,internalType:"int24",name:"tickUpper",type:"int24"},{indexed:!1,internalType:"uint128",name:"amount",type:"uint128"},{indexed:!1,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1",type:"uint256"}],name:"Mint",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint8",name:"feeProtocol0Old",type:"uint8"},{indexed:!1,internalType:"uint8",name:"feeProtocol1Old",type:"uint8"},{indexed:!1,internalType:"uint8",name:"feeProtocol0New",type:"uint8"},{indexed:!1,internalType:"uint8",name:"feeProtocol1New",type:"uint8"}],name:"SetFeeProtocol",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!0,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"int256",name:"amount0",type:"int256"},{indexed:!1,internalType:"int256",name:"amount1",type:"int256"},{indexed:!1,internalType:"uint160",name:"sqrtPriceX96",type:"uint160"},{indexed:!1,internalType:"uint128",name:"liquidity",type:"uint128"},{indexed:!1,internalType:"int24",name:"tick",type:"int24"}],name:"Swap",type:"event"},{inputs:[{internalType:"int24",name:"tickLower",type:"int24"},{internalType:"int24",name:"tickUpper",type:"int24"},{internalType:"uint128",name:"amount",type:"uint128"}],name:"burn",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"int24",name:"tickLower",type:"int24"},{internalType:"int24",name:"tickUpper",type:"int24"},{internalType:"uint128",name:"amount0Requested",type:"uint128"},{internalType:"uint128",name:"amount1Requested",type:"uint128"}],name:"collect",outputs:[{internalType:"uint128",name:"amount0",type:"uint128"},{internalType:"uint128",name:"amount1",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint128",name:"amount0Requested",type:"uint128"},{internalType:"uint128",name:"amount1Requested",type:"uint128"}],name:"collectProtocol",outputs:[{internalType:"uint128",name:"amount0",type:"uint128"},{internalType:"uint128",name:"amount1",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"factory",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"fee",outputs:[{internalType:"uint24",name:"",type:"uint24"}],stateMutability:"view",type:"function"},{inputs:[],name:"feeGrowthGlobal0X128",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"feeGrowthGlobal1X128",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"flash",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint16",name:"observationCardinalityNext",type:"uint16"}],name:"increaseObservationCardinalityNext",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint160",name:"sqrtPriceX96",type:"uint160"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"liquidity",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxLiquidityPerTick",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"int24",name:"tickLower",type:"int24"},{internalType:"int24",name:"tickUpper",type:"int24"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mint",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"observations",outputs:[{internalType:"uint32",name:"blockTimestamp",type:"uint32"},{internalType:"int56",name:"tickCumulative",type:"int56"},{internalType:"uint160",name:"secondsPerLiquidityCumulativeX128",type:"uint160"},{internalType:"bool",name:"initialized",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint32[]",name:"secondsAgos",type:"uint32[]"}],name:"observe",outputs:[{internalType:"int56[]",name:"tickCumulatives",type:"int56[]"},{internalType:"uint160[]",name:"secondsPerLiquidityCumulativeX128s",type:"uint160[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"key",type:"bytes32"}],name:"positions",outputs:[{internalType:"uint128",name:"_liquidity",type:"uint128"},{internalType:"uint256",name:"feeGrowthInside0LastX128",type:"uint256"},{internalType:"uint256",name:"feeGrowthInside1LastX128",type:"uint256"},{internalType:"uint128",name:"tokensOwed0",type:"uint128"},{internalType:"uint128",name:"tokensOwed1",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"protocolFees",outputs:[{internalType:"uint128",name:"token0",type:"uint128"},{internalType:"uint128",name:"token1",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint8",name:"feeProtocol0",type:"uint8"},{internalType:"uint8",name:"feeProtocol1",type:"uint8"}],name:"setFeeProtocol",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"slot0",outputs:[{internalType:"uint160",name:"sqrtPriceX96",type:"uint160"},{internalType:"int24",name:"tick",type:"int24"},{internalType:"uint16",name:"observationIndex",type:"uint16"},{internalType:"uint16",name:"observationCardinality",type:"uint16"},{internalType:"uint16",name:"observationCardinalityNext",type:"uint16"},{internalType:"uint8",name:"feeProtocol",type:"uint8"},{internalType:"bool",name:"unlocked",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"int24",name:"tickLower",type:"int24"},{internalType:"int24",name:"tickUpper",type:"int24"}],name:"snapshotCumulativesInside",outputs:[{internalType:"int56",name:"tickCumulativeInside",type:"int56"},{internalType:"uint160",name:"secondsPerLiquidityInsideX128",type:"uint160"},{internalType:"uint32",name:"secondsInside",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"bool",name:"zeroForOne",type:"bool"},{internalType:"int256",name:"amountSpecified",type:"int256"},{internalType:"uint160",name:"sqrtPriceLimitX96",type:"uint160"},{internalType:"bytes",name:"data",type:"bytes"}],name:"swap",outputs:[{internalType:"int256",name:"amount0",type:"int256"},{internalType:"int256",name:"amount1",type:"int256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"int16",name:"wordPosition",type:"int16"}],name:"tickBitmap",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"tickSpacing",outputs:[{internalType:"int24",name:"",type:"int24"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"int24",name:"tick",type:"int24"}],name:"ticks",outputs:[{internalType:"uint128",name:"liquidityGross",type:"uint128"},{internalType:"int128",name:"liquidityNet",type:"int128"},{internalType:"uint256",name:"feeGrowthOutside0X128",type:"uint256"},{internalType:"uint256",name:"feeGrowthOutside1X128",type:"uint256"},{internalType:"int56",name:"tickCumulativeOutside",type:"int56"},{internalType:"uint160",name:"secondsPerLiquidityOutsideX128",type:"uint160"},{internalType:"uint32",name:"secondsOutside",type:"uint32"},{internalType:"bool",name:"initialized",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"token0",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"token1",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}];class Pi{static abi=ki;static createInterface(){return new ba(ki)}static connect(e,t){return new Wa(e,ki,t)}}var Ai=Object.freeze({__proto__:null,IUniswapV3Factory__factory:Oi,IUniswapV3Pool__factory:Pi,pool:Ei}),Ci=Object.freeze({__proto__:null,interfaces:Ai}),Si=Object.freeze({__proto__:null,contracts:Ci}),Ni=Object.freeze({__proto__:null,v3Core:Si});const Di=[{inputs:[],name:"denomination",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"commitment",type:"bytes32"}],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"proof",type:"bytes"},{internalType:"bytes32",name:"root",type:"bytes32"},{internalType:"bytes32",name:"nullifierHash",type:"bytes32"},{internalType:"address payable",name:"recipient",type:"address"},{internalType:"address payable",name:"relayer",type:"address"},{internalType:"uint256",name:"fee",type:"uint256"},{internalType:"uint256",name:"refund",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"payable",type:"function"}];var Ui=Object.freeze({__proto__:null,ITornadoInstance__factory:class{static abi=Di;static createInterface(){return new ba(Di)}static connect(e,t){return new Wa(e,Di,t)}}});const Vi=[{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"}];class Fi{static abi=Vi;static createInterface(){return new ba(Vi)}static connect(e,t){return new Wa(e,Vi,t)}}var Li=Object.freeze({__proto__:null,IERC20Decimals__factory:Fi}),Gi=Object.freeze({__proto__:null,uniswapV3OracleHelperSol:Li});const Bi=[{inputs:[],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"text",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"value",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"}],ji="0x608060405234801561001057600080fd5b50610278806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631f1bd692146100465780633fa4f245146100c35780638129fc1c146100dd575b600080fd5b61004e6100e7565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610088578181015183820152602001610070565b50505050905090810190601f1680156100b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100cb610174565b60408051918252519081900360200190f35b6100e561017a565b005b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561016c5780601f106101415761010080835404028352916020019161016c565b820191906000526020600020905b81548152906001019060200180831161014f57829003601f168201915b505050505081565b60005481565b600160008190556040805180820190915260058082526464756d6d7960d81b60209092019182526101ac9291906101af565b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106101f057805160ff191683800117855561021d565b8280016001018555821561021d579182015b8281111561021d578251825591602001919060010190610202565b5061022992915061022d565b5090565b5b80821115610229576000815560010161022e56fea26469706673582212204b4d54284aeff9c7c570415da4a9efb9bf7115fe94a322210f9981c1c7ae107a64736f6c634300060c0033";class Hi extends Ya{constructor(...e){e.length>1?super(...e):super(Bi,ji,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=ji;static abi=Bi;static createInterface(){return new ba(Bi)}static connect(e,t){return new Wa(e,Bi,t)}}const zi=[{inputs:[],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"text",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"value",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"}],Wi="0x608060405234801561001057600080fd5b50610278806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631f1bd692146100465780633fa4f245146100c35780638129fc1c146100dd575b600080fd5b61004e6100e7565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610088578181015183820152602001610070565b50505050905090810190601f1680156100b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100cb610174565b60408051918252519081900360200190f35b6100e561017a565b005b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561016c5780601f106101415761010080835404028352916020019161016c565b820191906000526020600020905b81548152906001019060200180831161014f57829003601f168201915b505050505081565b60005481565b600260005560408051808201909152600680825265323ab6b6bc9960d11b60209092019182526101ac916001916101af565b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106101f057805160ff191683800117855561021d565b8280016001018555821561021d579182015b8281111561021d578251825591602001919060010190610202565b5061022992915061022d565b5090565b5b80821115610229576000815560010161022e56fea2646970667358221220056d994e19772e421a19f4bcf8cb09061d5645867c4c352106bf6b809fb5de3664736f6c634300060c0033";class $i extends Ya{constructor(...e){e.length>1?super(...e):super(zi,Wi,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=Wi;static abi=zi;static createInterface(){return new ba(zi)}static connect(e,t){return new Wa(e,zi,t)}}var Xi=Object.freeze({__proto__:null,DummySecond__factory:$i,Dummy__factory:Hi});const qi=[{inputs:[{internalType:"uint256",name:"delay",type:"uint256"}],name:"setExecutionDelay",outputs:[],stateMutability:"nonpayable",type:"function"}];class Ji{static abi=qi;static createInterface(){return new ba(qi)}static connect(e,t){return new Wa(e,qi,t)}}const Yi=[{inputs:[],name:"executeProposal",outputs:[],stateMutability:"nonpayable",type:"function"}],Ki="0x608060405234801561001057600080fd5b5060c48061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063373058b814602d575b600080fd5b60336035565b005b6040805163e4917d9f60e01b81526203f48060048201529051309163e4917d9f91602480830192600092919082900301818387803b158015607557600080fd5b505af11580156088573d6000803e3d6000fd5b5050505056fea264697066735822122080cc4a797d58ff69ba6d6a0d2a3849574ef67da2d75c41e66a86d3f6e162209d64736f6c634300060c0033";class Zi extends Ya{constructor(...e){e.length>1?super(...e):super(Yi,Ki,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=Ki;static abi=Yi;static createInterface(){return new ba(Yi)}static connect(e,t){return new Wa(e,Yi,t)}}var Qi=Object.freeze({__proto__:null,IGovernance__factory:Ji,ProposalStateChangeGovernance__factory:Zi});const es=[{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"nonpayable",type:"function"}];class ts{static abi=es;static createInterface(){return new ba(es)}static connect(e,t){return new Wa(e,es,t)}}const as=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"}],name:"Delegated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"x",type:"uint256"}],name:"Overriden",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"proposer",type:"address"},{indexed:!1,internalType:"address",name:"target",type:"address"},{indexed:!1,internalType:"uint256",name:"startTime",type:"uint256"},{indexed:!1,internalType:"uint256",name:"endTime",type:"uint256"},{indexed:!1,internalType:"string",name:"description",type:"string"}],name:"ProposalCreated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"proposalId",type:"uint256"}],name:"ProposalExecuted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"}],name:"Undelegated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"proposalId",type:"uint256"},{indexed:!0,internalType:"address",name:"voter",type:"address"},{indexed:!0,internalType:"bool",name:"support",type:"bool"},{indexed:!1,internalType:"uint256",name:"votes",type:"uint256"}],name:"Voted",type:"event"},{inputs:[],name:"CLOSING_PERIOD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"EXECUTION_DELAY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"EXECUTION_EXPIRATION",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"PROPOSAL_THRESHOLD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"QUORUM_VOTES",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTE_EXTEND_TIME",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTING_DELAY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTING_PERIOD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"canWithdrawAfter",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address[]",name:"from",type:"address[]"},{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"bool",name:"support",type:"bool"}],name:"castDelegatedVote",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"bool",name:"support",type:"bool"}],name:"castVote",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"delegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"delegatedTo",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"}],name:"execute",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"address",name:"voter",type:"address"}],name:"getReceipt",outputs:[{components:[{internalType:"bool",name:"hasVoted",type:"bool"},{internalType:"bool",name:"support",type:"bool"},{internalType:"uint256",name:"votes",type:"uint256"}],internalType:"struct Governance.Receipt",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_torn",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"latestProposalIds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"lock",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"lockWithApproval",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"lockedBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"newVariable",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"proposalCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"proposals",outputs:[{internalType:"address",name:"proposer",type:"address"},{internalType:"address",name:"target",type:"address"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"uint256",name:"forVotes",type:"uint256"},{internalType:"uint256",name:"againstVotes",type:"uint256"},{internalType:"bool",name:"executed",type:"bool"},{internalType:"bool",name:"extended",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"target",type:"address"},{internalType:"string",name:"description",type:"string"}],name:"propose",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"target",type:"address"},{internalType:"string",name:"description",type:"string"}],name:"proposeByDelegate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"closingPeriod",type:"uint256"}],name:"setClosingPeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"executionDelay",type:"uint256"}],name:"setExecutionDelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"executionExpiration",type:"uint256"}],name:"setExecutionExpiration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalThreshold",type:"uint256"}],name:"setProposalThreshold",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"quorumVotes",type:"uint256"}],name:"setQuorumVotes",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"time_",type:"uint256"}],name:"setTimestamp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"torna",type:"address"}],name:"setTorn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"voteExtendTime",type:"uint256"}],name:"setVoteExtendTime",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"votingDelay",type:"uint256"}],name:"setVotingDelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"votingPeriod",type:"uint256"}],name:"setVotingPeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"}],name:"state",outputs:[{internalType:"enum Governance.ProposalState",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"time",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"torn",outputs:[{internalType:"contract TORN",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"undelegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"unlock",outputs:[],stateMutability:"nonpayable",type:"function"}],ns="0x6080604052426041553480156200001557600080fd5b50600054610100900460ff168062000032575062000032620000cd565b8062000041575060005460ff16155b620000695760405162461bcd60e51b8152600401620000609062000114565b60405180910390fd5b600054610100900460ff1615801562000095576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000b3620000d3565b8015620000c6576000805461ff00191690555b5062000162565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6123ac80620001726000396000f3fe60806040526004361061023b5760003560e01c8063a0a2b5731161012e578063ce25d71c116100ab578063e4917d9f1161006f578063e4917d9f14610664578063ea0217cf14610684578063ece40cc1146106a4578063f0b76892146106c4578063fe0d94c1146106e45761023b565b8063ce25d71c146105d8578063d6159fe5146105ed578063d6f0948c14610602578063da35c66414610622578063e23a9a52146106375761023b565b8063b54426c8116100f2578063b54426c814610538578063b5f6a74314610558578063b859f11b14610578578063c0c0e82014610598578063c4d66de8146105b85761023b565b8063a0a2b573146104b9578063a6c26603146104d9578063a72edda3146104ee578063adf898a41461050e578063b1610d7e146105235761023b565b80636198e339116101bc57806370b0f6601161018057806370b0f6601461042f5780638d7a72f31461044f57806392ab89bb146104645780639a9e3b6e146104795780639ae697bf146104995761023b565b80636198e3391461039857806365da1264146103b8578063671dd275146103e55780636a661755146103fa5780636dc2dc6c1461040f5761023b565b806337f135d71161020357806337f135d7146103015780633e4f49e614610316578063587a6ecb1461034357806358e9fff0146103585780635c19a95c146103785761023b565b8063013cf08b1461024057806302ec8f9e1461027d57806315373e3d1461029f57806316ada547146102bf57806317977c61146102e1575b600080fd5b34801561024c57600080fd5b5061026061025b366004611cd6565b6106f7565b604051610274989796959493929190611de5565b60405180910390f35b34801561028957600080fd5b5061029d610298366004611cd6565b61075c565b005b3480156102ab57600080fd5b5061029d6102ba366004611d1a565b610789565b3480156102cb57600080fd5b506102d4610798565b6040516102749190612323565b3480156102ed57600080fd5b506102d46102fc366004611acd565b61079e565b34801561030d57600080fd5b506102d46107b0565b34801561032257600080fd5b50610336610331366004611cd6565b6107b6565b6040516102749190611ea3565b34801561034f57600080fd5b506102d46108f9565b34801561036457600080fd5b506102d4610373366004611ae8565b6108ff565b34801561038457600080fd5b5061029d610393366004611acd565b61094d565b3480156103a457600080fd5b5061029d6103b3366004611cd6565b610a6f565b3480156103c457600080fd5b506103d86103d3366004611acd565b610ba6565b6040516102749190611d94565b3480156103f157600080fd5b506102d4610bc1565b34801561040657600080fd5b506102d4610bc7565b34801561041b57600080fd5b5061029d61042a366004611cd6565b610bcd565b34801561043b57600080fd5b5061029d61044a366004611cd6565b610c12565b34801561045b57600080fd5b506102d4610c36565b34801561047057600080fd5b5061029d610c3c565b34801561048557600080fd5b5061029d610494366004611cd6565b610cc3565b3480156104a557600080fd5b506102d46104b4366004611acd565b610ce7565b3480156104c557600080fd5b5061029d6104d4366004611cd6565b610cf9565b3480156104e557600080fd5b506102d4610cfe565b3480156104fa57600080fd5b506102d4610509366004611acd565b610d04565b34801561051a57600080fd5b506103d8610d16565b34801561052f57600080fd5b506102d4610d25565b34801561054457600080fd5b5061029d610553366004611cd6565b610d2b565b34801561056457600080fd5b5061029d610573366004611acd565b610d35565b34801561058457600080fd5b5061029d610593366004611bf5565b610d57565b3480156105a457600080fd5b5061029d6105b3366004611cd6565b610e0e565b3480156105c457600080fd5b5061029d6105d3366004611acd565b610e32565b3480156105e457600080fd5b506102d4611075565b3480156105f957600080fd5b506102d461107b565b34801561060e57600080fd5b506102d461061d366004611b48565b611081565b34801561062e57600080fd5b506102d4611097565b34801561064357600080fd5b50610657610652366004611cee565b6110a1565b60405161027491906122fe565b34801561067057600080fd5b5061029d61067f366004611cd6565b611113565b34801561069057600080fd5b5061029d61069f366004611cd6565b611137565b3480156106b057600080fd5b5061029d6106bf366004611cd6565b61115b565b3480156106d057600080fd5b5061029d6106df366004611b96565b61117f565b61029d6106f2366004611cd6565b6111ff565b603d818154811061070457fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b3330146107845760405162461bcd60e51b815260040161077b90612101565b60405180910390fd5b603555565b610794338383611240565b5050565b60415481565b603e6020526000908152604090205481565b60335481565b60006107c0611097565b82111580156107cf5750600082115b6107eb5760405162461bcd60e51b815260040161077b90612237565b6000603d83815481106107fa57fe5b906000526020600020906008020190508060020154610817611471565b116108265760009150506108f4565b8060030154610833611471565b116108425760019150506108f4565b8060050154816004015411158061086457506035548160050154826004015401105b156108735760029150506108f4565b600681015460ff161561088a5760059150506108f4565b6108af6034546108a9603354846003015461147790919063ffffffff16565b90611477565b6108b7611471565b106108c65760069150506108f4565b60335460038201546108d791611477565b6108df611471565b106108ee5760049150506108f4565b60039150505b919050565b603a5481565b6001600160a01b038381166000908152603c6020526040812054909116331461093a5760405162461bcd60e51b815260040161077b906122c7565b61094584848461149c565b949350505050565b336000818152603c60205260409020546001600160a01b03908116919083161480159061098357506001600160a01b0382163014155b801561099757506001600160a01b03821615155b80156109b55750806001600160a01b0316826001600160a01b031614155b6109d15760405162461bcd60e51b815260040161077b90612138565b6001600160a01b03811615610a17576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000908152603f6020526040902054610a87611471565b11610aa45760405162461bcd60e51b815260040161077b90612064565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054610af29183906117ea565b336000818152603b602052604090819020929092558154915163a9059cbb60e01b81526001600160a01b039092169163a9059cbb91610b35918590600401611da8565b602060405180830381600087803b158015610b4f57600080fd5b505af1158015610b63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b879190611cba565b610ba35760405162461bcd60e51b815260040161077b9061209b565b50565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610bec5760405162461bcd60e51b815260040161077b90612101565b6033548110610c0d5760405162461bcd60e51b815260040161077b90612020565b603a55565b333014610c315760405162461bcd60e51b815260040161077b90612101565b603755565b60425481565b336000908152603c60205260409020546001600160a01b031680610c725760405162461bcd60e51b815260040161077b9061227d565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b333014610ce25760405162461bcd60e51b815260040161077b90612101565b603455565b603b6020526000908152604090205481565b604155565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b610ba33382611816565b604080546001600160a01b0319166001600160a01b0392909216919091179055565b60005b8351811015610de857336001600160a01b0316603c6000868481518110610d7d57fe5b6020908102919091018101516001600160a01b03908116835290820192909252604001600020541614610dc25760405162461bcd60e51b815260040161077b906122c7565b610de0848281518110610dd157fe5b60200260200101518484611240565b600101610d5a565b50336000908152603b602052604090205415610e0957610e09338383611240565b505050565b333014610e2d5760405162461bcd60e51b815260040161077b90612101565b603955565b600054610100900460ff1680610e4b5750610e4b6118fb565b80610e59575060005460ff16155b610e755760405162461bcd60e51b815260040161077b906121e9565b600054610100900460ff16158015610ea0576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff199094169390931716919091179055611060611901565b8015610794576000805461ff00191690555050565b60395481565b60375481565b600061108e33848461149c565b90505b92915050565b603d546000190190565b6110a96119c7565b603d83815481106110b657fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b3330146111325760405162461bcd60e51b815260040161077b90612101565b603355565b3330146111565760405162461bcd60e51b815260040161077b90612101565b603855565b33301461117a5760405162461bcd60e51b815260040161077b90612101565b603655565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf906111bb90899030908a908a908a908a908a90600401611e2b565b600060405180830381600087803b1580156111d557600080fd5b505af11580156111e9573d6000803e3d6000fd5b505050506111f78686611816565b505050505050565b6103e76042556040517fc22c84ebcf25b30190d2b53474def7b552efd2018ef8acaf6bed1b67e8d2be7c90611235908390612323565b60405180910390a150565b600161124b836107b6565b600681111561125657fe5b146112735760405162461bcd60e51b815260040161077b90611f45565b6000603d838154811061128257fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b9094529190942054929450101590806112e15760405162461bcd60e51b815260040161077b9061216f565b825460ff1615611330578254610100900460ff1615611317576001830154600485015461130d91611942565b6004850155611330565b6001830154600585015461132a91611942565b60058501555b841561134f5760048401546113459082611477565b6004850155611364565b600584015461135e9082611477565b60058501555b6006840154610100900460ff161580156113945750603954611392611387611471565b600387015490611942565b105b156113d85760058401546004850154111582151581146113d65760068501805461ff001916610100179055603a5460038601546113d091611477565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a546003870154611423938b9361141e9391926108a992839190611477565b611984565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b5846040516114609190612323565b60405180910390a450505050505050565b60415490565b60008282018381101561108e5760405162461bcd60e51b815260040161077b90611fe9565b6001600160a01b0383166000908152603b60205260408120546036548110156114d75760405162461bcd60e51b815260040161077b90611f8c565b6114e0846119c1565b6114fc5760405162461bcd60e51b815260040161077b906121a6565b6001600160a01b0385166000908152603e6020526040902054801561156e576000611526826107b6565b9050600181600681111561153657fe5b141580156115505750600081600681111561154d57fe5b14155b61156c5760405162461bcd60e51b815260040161077b90611eca565b505b600061157e6037546108a9611471565b905060006115976038548361147790919063ffffffff16565b90506115a16119e7565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff19909316929092179490941617905590611753611097565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a54929350611795928d9261141e9290916108a9919082908a90611477565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d6040516117d59493929190611e6c565b60405180910390a39998505050505050505050565b6000818484111561180e5760405162461bcd60e51b815260040161077b9190611eb7565b505050900390565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd9061184a90859030908690600401611dc1565b602060405180830381600087803b15801561186457600080fd5b505af1158015611878573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061189c9190611cba565b6118b85760405162461bcd60e51b815260040161077b906120ca565b6001600160a01b0382166000908152603b60205260409020546118db9082611477565b6001600160a01b039092166000908152603b602052604090209190915550565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b600061108e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506117ea565b6001600160a01b0382166000908152603f6020526040902054811115610794576001600160a01b03919091166000908152603f6020526040902055565b3b151590565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b038116811461109157600080fd5b803561109181612368565b600082601f830112611a74578081fd5b813567ffffffffffffffff811115611a8a578182fd5b611a9d601f8201601f191660200161232c565b9150808252836020828501011115611ab457600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215611ade578081fd5b61108e8383611a42565b600080600060608486031215611afc578182fd5b8335611b0781612353565b92506020840135611b1781612353565b9150604084013567ffffffffffffffff811115611b32578182fd5b611b3e86828701611a64565b9150509250925092565b60008060408385031215611b5a578182fd5b8235611b6581612353565b9150602083013567ffffffffffffffff811115611b80578182fd5b611b8c85828601611a64565b9150509250929050565b60008060008060008060c08789031215611bae578182fd5b611bb88888611a42565b95506020870135945060408701359350606087013560ff81168114611bdb578283fd5b9598949750929560808101359460a0909101359350915050565b600080600060608486031215611c09578283fd5b833567ffffffffffffffff80821115611c20578485fd5b818601915086601f830112611c33578485fd5b813581811115611c41578586fd5b60209150818102611c5383820161232c565b8281528381019085850183870186018c1015611c6d57898afd5b8996505b84871015611c9757611c838c82611a42565b835260019690960195918501918501611c71565b5097505050508501359250611cb190508560408601611a59565b90509250925092565b600060208284031215611ccb578081fd5b815161108e81612368565b600060208284031215611ce7578081fd5b5035919050565b60008060408385031215611d00578182fd5b82359150611d118460208501611a42565b90509250929050565b60008060408385031215611d2c578182fd5b823591506020830135611d3e81612368565b809150509250929050565b60008151808452815b81811015611d6e57602081850181015186830182015201611d52565b81811115611d7f5782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b038616825284602083015283604083015260806060830152611e996080830184611d49565b9695505050505050565b6020810160078310611eb157fe5b91905290565b60006020825261108e6020830184611d49565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b6020808252601590820152741513d4938e881d1c985b9cd9995c8819985a5b1959605a1b604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b90815260200190565b60405181810167ffffffffffffffff8111828210171561234b57600080fd5b604052919050565b6001600160a01b0381168114610ba357600080fd5b8015158114610ba357600080fdfea264697066735822122077147b2d24ffd383c4a2d0eb254eb72ba4274421278e284354c4848ff7c9df0164736f6c634300060c0033";class bs extends Ya{constructor(...e){e.length>1?super(...e):super(as,ns,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=ns;static abi=as;static createInterface(){return new ba(as)}static connect(e,t){return new Wa(e,as,t)}}const fs=[{inputs:[{internalType:"address",name:"_newLogic",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"executeProposal",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"newLogic",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}],ds="0x60a060405234801561001057600080fd5b506040516101da3803806101da83398101604081905261002f91610044565b60601b6001600160601b031916608052610072565b600060208284031215610055578081fd5b81516001600160a01b038116811461006b578182fd5b9392505050565b60805160601c610148610092600039806065528060a252506101486000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806305ccb23e1461003b578063373058b814610059575b600080fd5b610043610063565b60405161005091906100fe565b60405180910390f35b610061610087565b005b7f000000000000000000000000000000000000000000000000000000000000000081565b604051631b2ce7f360e11b81523090633659cfe6906100ca907f0000000000000000000000000000000000000000000000000000000000000000906004016100fe565b600060405180830381600087803b1580156100e457600080fd5b505af11580156100f8573d6000803e3d6000fd5b50505050565b6001600160a01b039190911681526020019056fea26469706673582212207d2c2c988cd8f64fa7efb7ef33cfeee3b01f81a501e4a71ae8a63d6a5e269eb664736f6c634300060c0033";class is extends Ya{constructor(...e){e.length>1?super(...e):super(fs,ds,e[0])}getDeployTransaction(e,t){return super.getDeployTransaction(e,t||{})}deploy(e,t){return super.deploy(e,t||{})}connect(e){return super.connect(e)}static bytecode=ds;static abi=fs;static createInterface(){return new ba(fs)}static connect(e,t){return new Wa(e,fs,t)}}var ss=Object.freeze({__proto__:null,IProxy__factory:ts,NewImplementation__factory:bs,ProposalUpgrade__factory:is});const rs=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"}],name:"Delegated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"proposer",type:"address"},{indexed:!1,internalType:"address",name:"target",type:"address"},{indexed:!1,internalType:"uint256",name:"startTime",type:"uint256"},{indexed:!1,internalType:"uint256",name:"endTime",type:"uint256"},{indexed:!1,internalType:"string",name:"description",type:"string"}],name:"ProposalCreated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"proposalId",type:"uint256"}],name:"ProposalExecuted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"}],name:"Undelegated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"proposalId",type:"uint256"},{indexed:!0,internalType:"address",name:"voter",type:"address"},{indexed:!0,internalType:"bool",name:"support",type:"bool"},{indexed:!1,internalType:"uint256",name:"votes",type:"uint256"}],name:"Voted",type:"event"},{inputs:[],name:"CLOSING_PERIOD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"EXECUTION_DELAY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"EXECUTION_EXPIRATION",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"PROPOSAL_THRESHOLD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"QUORUM_VOTES",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTE_EXTEND_TIME",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTING_DELAY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTING_PERIOD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"canWithdrawAfter",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address[]",name:"from",type:"address[]"},{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"bool",name:"support",type:"bool"}],name:"castDelegatedVote",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"bool",name:"support",type:"bool"}],name:"castVote",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"delegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"delegatedTo",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"}],name:"execute",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"address",name:"voter",type:"address"}],name:"getReceipt",outputs:[{components:[{internalType:"bool",name:"hasVoted",type:"bool"},{internalType:"bool",name:"support",type:"bool"},{internalType:"uint256",name:"votes",type:"uint256"}],internalType:"struct Governance.Receipt",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_torn",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"latestProposalIds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"lock",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"lockWithApproval",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"lockedBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"proposalCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"proposals",outputs:[{internalType:"address",name:"proposer",type:"address"},{internalType:"address",name:"target",type:"address"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"uint256",name:"forVotes",type:"uint256"},{internalType:"uint256",name:"againstVotes",type:"uint256"},{internalType:"bool",name:"executed",type:"bool"},{internalType:"bool",name:"extended",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"target",type:"address"},{internalType:"string",name:"description",type:"string"}],name:"propose",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"target",type:"address"},{internalType:"string",name:"description",type:"string"}],name:"proposeByDelegate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"closingPeriod",type:"uint256"}],name:"setClosingPeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"executionDelay",type:"uint256"}],name:"setExecutionDelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"executionExpiration",type:"uint256"}],name:"setExecutionExpiration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalThreshold",type:"uint256"}],name:"setProposalThreshold",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"quorumVotes",type:"uint256"}],name:"setQuorumVotes",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"time_",type:"uint256"}],name:"setTimestamp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"torna",type:"address"}],name:"setTorn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"voteExtendTime",type:"uint256"}],name:"setVoteExtendTime",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"votingDelay",type:"uint256"}],name:"setVotingDelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"votingPeriod",type:"uint256"}],name:"setVotingPeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"}],name:"state",outputs:[{internalType:"enum Governance.ProposalState",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"time",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"torn",outputs:[{internalType:"contract TORN",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"undelegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"unlock",outputs:[],stateMutability:"nonpayable",type:"function"}],ps="0x6080604052426041553480156200001557600080fd5b50600054610100900460ff168062000032575062000032620000cd565b8062000041575060005460ff16155b620000695760405162461bcd60e51b8152600401620000609062000114565b60405180910390fd5b600054610100900460ff1615801562000095576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000b3620000d3565b8015620000c6576000805461ff00191690555b5062000162565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6125c980620001726000396000f3fe6080604052600436106102305760003560e01c8063a0a2b5731161012e578063ce25d71c116100ab578063e4917d9f1161006f578063e4917d9f14610644578063ea0217cf14610664578063ece40cc114610684578063f0b76892146106a4578063fe0d94c1146106c457610230565b8063ce25d71c146105b8578063d6159fe5146105cd578063d6f0948c146105e2578063da35c66414610602578063e23a9a521461061757610230565b8063b54426c8116100f2578063b54426c814610518578063b5f6a74314610538578063b859f11b14610558578063c0c0e82014610578578063c4d66de81461059857610230565b8063a0a2b57314610499578063a6c26603146104b9578063a72edda3146104ce578063adf898a4146104ee578063b1610d7e1461050357610230565b80635c19a95c116101bc5780636dc2dc6c116101805780636dc2dc6c1461040457806370b0f6601461042457806392ab89bb146104445780639a9e3b6e146104595780639ae697bf1461047957610230565b80635c19a95c1461036d5780636198e3391461038d57806365da1264146103ad578063671dd275146103da5780636a661755146103ef57610230565b806317977c611161020357806317977c61146102d657806337f135d7146102f65780633e4f49e61461030b578063587a6ecb1461033857806358e9fff01461034d57610230565b8063013cf08b1461023557806302ec8f9e1461027257806315373e3d1461029457806316ada547146102b4575b600080fd5b34801561024157600080fd5b50610255610250366004611e01565b6106d7565b604051610269989796959493929190611f0d565b60405180910390f35b34801561027e57600080fd5b5061029261028d366004611e01565b61073c565b005b3480156102a057600080fd5b506102926102af366004611e45565b610769565b3480156102c057600080fd5b506102c9610778565b6040516102699190612510565b3480156102e257600080fd5b506102c96102f1366004611bf8565b61077e565b34801561030257600080fd5b506102c9610790565b34801561031757600080fd5b5061032b610326366004611e01565b610796565b6040516102699190611fcb565b34801561034457600080fd5b506102c96108d9565b34801561035957600080fd5b506102c9610368366004611c13565b6108df565b34801561037957600080fd5b50610292610388366004611bf8565b61092d565b34801561039957600080fd5b506102926103a8366004611e01565b610a4f565b3480156103b957600080fd5b506103cd6103c8366004611bf8565b610b86565b6040516102699190611ebc565b3480156103e657600080fd5b506102c9610ba1565b3480156103fb57600080fd5b506102c9610ba7565b34801561041057600080fd5b5061029261041f366004611e01565b610bad565b34801561043057600080fd5b5061029261043f366004611e01565b610bf2565b34801561045057600080fd5b50610292610c16565b34801561046557600080fd5b50610292610474366004611e01565b610c9d565b34801561048557600080fd5b506102c9610494366004611bf8565b610cc1565b3480156104a557600080fd5b506102926104b4366004611e01565b610cd3565b3480156104c557600080fd5b506102c9610cd8565b3480156104da57600080fd5b506102c96104e9366004611bf8565b610cde565b3480156104fa57600080fd5b506103cd610cf0565b34801561050f57600080fd5b506102c9610cff565b34801561052457600080fd5b50610292610533366004611e01565b610d05565b34801561054457600080fd5b50610292610553366004611bf8565b610d0f565b34801561056457600080fd5b50610292610573366004611d20565b610d31565b34801561058457600080fd5b50610292610593366004611e01565b610de8565b3480156105a457600080fd5b506102926105b3366004611bf8565b610e0c565b3480156105c457600080fd5b506102c961104f565b3480156105d957600080fd5b506102c9611055565b3480156105ee57600080fd5b506102c96105fd366004611c73565b61105b565b34801561060e57600080fd5b506102c9611071565b34801561062357600080fd5b50610637610632366004611e19565b61107b565b60405161026991906124eb565b34801561065057600080fd5b5061029261065f366004611e01565b6110ed565b34801561067057600080fd5b5061029261067f366004611e01565b611111565b34801561069057600080fd5b5061029261069f366004611e01565b611135565b3480156106b057600080fd5b506102926106bf366004611cc1565b611159565b6102926106d2366004611e01565b6111d9565b603d81815481106106e457fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b3330146107645760405162461bcd60e51b815260040161075b906122b7565b60405180910390fd5b603555565b61077433838361136b565b5050565b60415481565b603e6020526000908152604090205481565b60335481565b60006107a0611071565b82111580156107af5750600082115b6107cb5760405162461bcd60e51b815260040161075b906123ed565b6000603d83815481106107da57fe5b9060005260206000209060080201905080600201546107f761159c565b116108065760009150506108d4565b806003015461081361159c565b116108225760019150506108d4565b8060050154816004015411158061084457506035548160050154826004015401105b156108535760029150506108d4565b600681015460ff161561086a5760059150506108d4565b61088f60345461088960335484600301546115a290919063ffffffff16565b906115a2565b61089761159c565b106108a65760069150506108d4565b60335460038201546108b7916115a2565b6108bf61159c565b106108ce5760049150506108d4565b60039150505b919050565b603a5481565b6001600160a01b038381166000908152603c6020526040812054909116331461091a5760405162461bcd60e51b815260040161075b9061247d565b6109258484846115c7565b949350505050565b336000818152603c60205260409020546001600160a01b03908116919083161480159061096357506001600160a01b0382163014155b801561097757506001600160a01b03821615155b80156109955750806001600160a01b0316826001600160a01b031614155b6109b15760405162461bcd60e51b815260040161075b906122ee565b6001600160a01b038116156109f7576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000908152603f6020526040902054610a6761159c565b11610a845760405162461bcd60e51b815260040161075b9061221a565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054610ad2918390611915565b336000818152603b602052604090819020929092558154915163a9059cbb60e01b81526001600160a01b039092169163a9059cbb91610b15918590600401611ed0565b602060405180830381600087803b158015610b2f57600080fd5b505af1158015610b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b679190611de5565b610b835760405162461bcd60e51b815260040161075b90612251565b50565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610bcc5760405162461bcd60e51b815260040161075b906122b7565b6033548110610bed5760405162461bcd60e51b815260040161075b906121d6565b603a55565b333014610c115760405162461bcd60e51b815260040161075b906122b7565b603755565b336000908152603c60205260409020546001600160a01b031680610c4c5760405162461bcd60e51b815260040161075b90612433565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b333014610cbc5760405162461bcd60e51b815260040161075b906122b7565b603455565b603b6020526000908152604090205481565b604155565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b610b833382611941565b604080546001600160a01b0319166001600160a01b0392909216919091179055565b60005b8351811015610dc257336001600160a01b0316603c6000868481518110610d5757fe5b6020908102919091018101516001600160a01b03908116835290820192909252604001600020541614610d9c5760405162461bcd60e51b815260040161075b9061247d565b610dba848281518110610dab57fe5b6020026020010151848461136b565b600101610d34565b50336000908152603b602052604090205415610de357610de333838361136b565b505050565b333014610e075760405162461bcd60e51b815260040161075b906122b7565b603955565b600054610100900460ff1680610e255750610e25611a26565b80610e33575060005460ff16155b610e4f5760405162461bcd60e51b815260040161075b9061239f565b600054610100900460ff16158015610e7a576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff19909416939093171691909117905561103a611a2c565b8015610774576000805461ff00191690555050565b60395481565b60375481565b60006110683384846115c7565b90505b92915050565b603d546000190190565b611083611af2565b603d838154811061109057fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b33301461110c5760405162461bcd60e51b815260040161075b906122b7565b603355565b3330146111305760405162461bcd60e51b815260040161075b906122b7565b603855565b3330146111545760405162461bcd60e51b815260040161075b906122b7565b603655565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf9061119590899030908a908a908a908a908a90600401611f53565b600060405180830381600087803b1580156111af57600080fd5b505af11580156111c3573d6000803e3d6000fd5b505050506111d18686611941565b505050505050565b60046111e482610796565b60068111156111ef57fe5b1461120c5760405162461bcd60e51b815260040161075b90612035565b6000603d828154811061121b57fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b031661125681611a6d565b6112725760405162461bcd60e51b815260040161075b90611ff2565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b038516916112b691611ea0565b600060405180830381855af49150503d80600081146112f1576040519150601f19603f3d011682016040523d82523d6000602084013e6112f6565b606091505b50915091508161133957805115611321578060405162461bcd60e51b815260040161075b9190611fdf565b60405162461bcd60e51b815260040161075b906124b4565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b600161137683610796565b600681111561138157fe5b1461139e5760405162461bcd60e51b815260040161075b906120fb565b6000603d83815481106113ad57fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b90945291909420549294501015908061140c5760405162461bcd60e51b815260040161075b90612325565b825460ff161561145b578254610100900460ff1615611442576001830154600485015461143891611a73565b600485015561145b565b6001830154600585015461145591611a73565b60058501555b841561147a57600484015461147090826115a2565b600485015561148f565b600584015461148990826115a2565b60058501555b6006840154610100900460ff161580156114bf57506039546114bd6114b261159c565b600387015490611a73565b105b156115035760058401546004850154111582151581146115015760068501805461ff001916610100179055603a5460038601546114fb916115a2565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a54600387015461154e938b93611549939192610889928391906115a2565b611ab5565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b58460405161158b9190612510565b60405180910390a450505050505050565b60415490565b6000828201838110156110685760405162461bcd60e51b815260040161075b9061219f565b6001600160a01b0383166000908152603b60205260408120546036548110156116025760405162461bcd60e51b815260040161075b90612142565b61160b84611a6d565b6116275760405162461bcd60e51b815260040161075b9061235c565b6001600160a01b0385166000908152603e6020526040902054801561169957600061165182610796565b9050600181600681111561166157fe5b1415801561167b5750600081600681111561167857fe5b14155b6116975760405162461bcd60e51b815260040161075b90612080565b505b60006116a960375461088961159c565b905060006116c2603854836115a290919063ffffffff16565b90506116cc611b12565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff1990931692909217949094161790559061187e611071565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a549293506118c0928d92611549929091610889919082908a906115a2565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d6040516119009493929190611f94565b60405180910390a39998505050505050505050565b600081848411156119395760405162461bcd60e51b815260040161075b9190611fdf565b505050900390565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd9061197590859030908690600401611ee9565b602060405180830381600087803b15801561198f57600080fd5b505af11580156119a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c79190611de5565b6119e35760405162461bcd60e51b815260040161075b90612280565b6001600160a01b0382166000908152603b6020526040902054611a0690826115a2565b6001600160a01b039092166000908152603b602052604090209190915550565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b3b151590565b600061106883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611915565b6001600160a01b0382166000908152603f6020526040902054811115610774576001600160a01b03919091166000908152603f6020526040902055565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b038116811461106b57600080fd5b803561106b81612585565b600082601f830112611b9f578081fd5b813567ffffffffffffffff811115611bb5578182fd5b611bc8601f8201601f1916602001612519565b9150808252836020828501011115611bdf57600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215611c09578081fd5b6110688383611b6d565b600080600060608486031215611c27578182fd5b8335611c3281612570565b92506020840135611c4281612570565b9150604084013567ffffffffffffffff811115611c5d578182fd5b611c6986828701611b8f565b9150509250925092565b60008060408385031215611c85578182fd5b8235611c9081612570565b9150602083013567ffffffffffffffff811115611cab578182fd5b611cb785828601611b8f565b9150509250929050565b60008060008060008060c08789031215611cd9578182fd5b611ce38888611b6d565b95506020870135945060408701359350606087013560ff81168114611d06578283fd5b9598949750929560808101359460a0909101359350915050565b600080600060608486031215611d34578283fd5b833567ffffffffffffffff80821115611d4b578485fd5b818601915086601f830112611d5e578485fd5b813581811115611d6c578586fd5b60209150818102611d7e838201612519565b8281528381019085850183870186018c1015611d9857898afd5b8996505b84871015611dc257611dae8c82611b6d565b835260019690960195918501918501611d9c565b5097505050508501359250611ddc90508560408601611b84565b90509250925092565b600060208284031215611df6578081fd5b815161106881612585565b600060208284031215611e12578081fd5b5035919050565b60008060408385031215611e2b578182fd5b82359150611e3c8460208501611b6d565b90509250929050565b60008060408385031215611e57578182fd5b823591506020830135611e6981612585565b809150509250929050565b60008151808452611e8c816020860160208601612540565b601f01601f19169290920160200192915050565b60008251611eb2818460208701612540565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b038616825284602083015283604083015260806060830152611fc16080830184611e74565b9695505050505050565b6020810160078310611fd957fe5b91905290565b6000602082526110686020830184611e74565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b6020808252601590820152741513d4938e881d1c985b9cd9995c8819985a5b1959605a1b604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b90815260200190565b60405181810167ffffffffffffffff8111828210171561253857600080fd5b604052919050565b60005b8381101561255b578181015183820152602001612543565b8381111561256a576000848401525b50505050565b6001600160a01b0381168114610b8357600080fd5b8015158114610b8357600080fdfea264697066735822122079a24ea0dc3d5ef34041a37a137cef69305763e031faa841e2db8f078345f2af64736f6c634300060c0033";class cs extends Ya{constructor(...e){e.length>1?super(...e):super(rs,ps,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=ps;static abi=rs;static createInterface(){return new ba(rs)}static connect(e,t){return new Wa(e,rs,t)}}const us=[{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"output",type:"address"}],name:"Debug",type:"event"},{inputs:[],name:"executeProposal",outputs:[],stateMutability:"nonpayable",type:"function"}],ys="0x608060405234801561001057600080fd5b506103d5806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063373058b814610030575b600080fd5b61003861003a565b005b6000604051610048906100fa565b604051809103906000f080158015610064573d6000803e3d6000fd5b509050806001600160a01b0316638129fc1c6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156100a257600080fd5b505af11580156100b6573d6000803e3d6000fd5b5050604080516001600160a01b038516815290517f330da4cde831ccab151372275307c2f0cce2bcce846635cd66e6908f10d203639350908190036020019150a150565b610298806101088339019056fe608060405234801561001057600080fd5b50610278806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631f1bd692146100465780633fa4f245146100c35780638129fc1c146100dd575b600080fd5b61004e6100e7565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610088578181015183820152602001610070565b50505050905090810190601f1680156100b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100cb610174565b60408051918252519081900360200190f35b6100e561017a565b005b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561016c5780601f106101415761010080835404028352916020019161016c565b820191906000526020600020905b81548152906001019060200180831161014f57829003601f168201915b505050505081565b60005481565b600160008190556040805180820190915260058082526464756d6d7960d81b60209092019182526101ac9291906101af565b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106101f057805160ff191683800117855561021d565b8280016001018555821561021d579182015b8281111561021d578251825591602001919060010190610202565b5061022992915061022d565b5090565b5b80821115610229576000815560010161022e56fea26469706673582212204b4d54284aeff9c7c570415da4a9efb9bf7115fe94a322210f9981c1c7ae107a64736f6c634300060c0033a26469706673582212205967b156db23a5fd2372953049f5c366f68a9f95cfa116f9fbd6d0c8e7bdaa6364736f6c634300060c0033";class os extends Ya{constructor(...e){e.length>1?super(...e):super(us,ys,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=ys;static abi=us;static createInterface(){return new ba(us)}static connect(e,t){return new Wa(e,us,t)}}var ls=Object.freeze({__proto__:null,MockGovernance__factory:cs,Proposal__factory:os,dummySol:Xi,proposalStateChangeGovernanceSol:Qi,proposalUpgradeSol:ss});const ms=[{inputs:[],name:"CLOSING_PERIOD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"EXECUTION_DELAY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"EXECUTION_EXPIRATION",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"PROPOSAL_THRESHOLD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"QUORUM_VOTES",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTE_EXTEND_TIME",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTING_DELAY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTING_PERIOD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"closingPeriod",type:"uint256"}],name:"setClosingPeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"executionDelay",type:"uint256"}],name:"setExecutionDelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"executionExpiration",type:"uint256"}],name:"setExecutionExpiration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalThreshold",type:"uint256"}],name:"setProposalThreshold",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"quorumVotes",type:"uint256"}],name:"setQuorumVotes",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"voteExtendTime",type:"uint256"}],name:"setVoteExtendTime",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"votingDelay",type:"uint256"}],name:"setVotingDelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"votingPeriod",type:"uint256"}],name:"setVotingPeriod",outputs:[],stateMutability:"nonpayable",type:"function"}],Ts="0x608060405234801561001057600080fd5b50610563806100206000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c8063a6c2660311610097578063d6159fe511610066578063d6159fe5146101e2578063e4917d9f146101ea578063ea0217cf14610207578063ece40cc11461022457610100565b8063a6c26603146101ad578063b1610d7e146101b5578063c0c0e820146101bd578063ce25d71c146101da57610100565b80636a661755116100d35780636a6617551461014e5780636dc2dc6c1461015657806370b0f660146101735780639a9e3b6e1461019057610100565b806302ec8f9e1461010557806337f135d714610124578063587a6ecb1461013e578063671dd27514610146575b600080fd5b6101226004803603602081101561011b57600080fd5b5035610241565b005b61012c610288565b60408051918252519081900360200190f35b61012c61028e565b61012c610294565b61012c61029a565b6101226004803603602081101561016c57600080fd5b50356102a0565b6101226004803603602081101561018957600080fd5b5035610327565b610122600480360360208110156101a657600080fd5b503561036e565b61012c6103b5565b61012c6103bb565b610122600480360360208110156101d357600080fd5b50356103c1565b61012c610408565b61012c61040e565b6101226004803603602081101561020057600080fd5b5035610414565b6101226004803603602081101561021d57600080fd5b503561045b565b6101226004803603602081101561023a57600080fd5b50356104a2565b333014610283576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b600255565b60005481565b60075481565b60025481565b60015481565b3330146102e2576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b60005481106103225760405162461bcd60e51b81526004018080602001828103825260248152602001806104ea6024913960400191505060405180910390fd5b600755565b333014610369576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b600455565b3330146103b0576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b600155565b60035481565b60055481565b333014610403576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b600655565b60065481565b60045481565b333014610456576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b600055565b33301461049d576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b600555565b3330146104e4576040805162461bcd60e51b8152602060048201526018602482015260008051602061050e833981519152604482015290519081900360640190fd5b60035556fe476f7665726e616e63653a20696e636f727265637420766f7465457874656e6454696d65476f7665726e616e63653a20756e617574686f72697a65640000000000000000a26469706673582212208fff4d62d622acc801ece8b6a7cc281f67f5959bf09e0ca68afde2a0ab0bc83164736f6c634300060c0033";class gs extends Ya{constructor(...e){e.length>1?super(...e):super(ms,Ts,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=Ts;static abi=ms;static createInterface(){return new ba(ms)}static connect(e,t){return new Wa(e,ms,t)}}const ws=[{inputs:[{internalType:"address",name:"",type:"address"}],name:"lockedBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"}];class hs{static abi=ws;static createInterface(){return new ba(ws)}static connect(e,t){return new Wa(e,ws,t)}}const vs=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"}],name:"Delegated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"}],name:"Undelegated",type:"event"},{inputs:[{internalType:"address[]",name:"from",type:"address[]"},{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"bool",name:"support",type:"bool"}],name:"castDelegatedVote",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"delegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"delegatedTo",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"lockedBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"target",type:"address"},{internalType:"string",name:"description",type:"string"}],name:"proposeByDelegate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"undelegate",outputs:[],stateMutability:"nonpayable",type:"function"}];class Ms{static abi=vs;static createInterface(){return new ba(vs)}static connect(e,t){return new Wa(e,vs,t)}}const _s=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"}],name:"Delegated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"proposer",type:"address"},{indexed:!1,internalType:"address",name:"target",type:"address"},{indexed:!1,internalType:"uint256",name:"startTime",type:"uint256"},{indexed:!1,internalType:"uint256",name:"endTime",type:"uint256"},{indexed:!1,internalType:"string",name:"description",type:"string"}],name:"ProposalCreated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"proposalId",type:"uint256"}],name:"ProposalExecuted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"}],name:"Undelegated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"proposalId",type:"uint256"},{indexed:!0,internalType:"address",name:"voter",type:"address"},{indexed:!0,internalType:"bool",name:"support",type:"bool"},{indexed:!1,internalType:"uint256",name:"votes",type:"uint256"}],name:"Voted",type:"event"},{inputs:[],name:"CLOSING_PERIOD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"EXECUTION_DELAY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"EXECUTION_EXPIRATION",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"PROPOSAL_THRESHOLD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"QUORUM_VOTES",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTE_EXTEND_TIME",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTING_DELAY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTING_PERIOD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"canWithdrawAfter",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address[]",name:"from",type:"address[]"},{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"bool",name:"support",type:"bool"}],name:"castDelegatedVote",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"bool",name:"support",type:"bool"}],name:"castVote",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"delegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"delegatedTo",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"}],name:"execute",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"address",name:"voter",type:"address"}],name:"getReceipt",outputs:[{components:[{internalType:"bool",name:"hasVoted",type:"bool"},{internalType:"bool",name:"support",type:"bool"},{internalType:"uint256",name:"votes",type:"uint256"}],internalType:"struct Governance.Receipt",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_torn",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"latestProposalIds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"lock",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"lockWithApproval",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"lockedBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"proposalCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"proposals",outputs:[{internalType:"address",name:"proposer",type:"address"},{internalType:"address",name:"target",type:"address"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"uint256",name:"forVotes",type:"uint256"},{internalType:"uint256",name:"againstVotes",type:"uint256"},{internalType:"bool",name:"executed",type:"bool"},{internalType:"bool",name:"extended",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"target",type:"address"},{internalType:"string",name:"description",type:"string"}],name:"propose",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"target",type:"address"},{internalType:"string",name:"description",type:"string"}],name:"proposeByDelegate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"closingPeriod",type:"uint256"}],name:"setClosingPeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"executionDelay",type:"uint256"}],name:"setExecutionDelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"executionExpiration",type:"uint256"}],name:"setExecutionExpiration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalThreshold",type:"uint256"}],name:"setProposalThreshold",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"quorumVotes",type:"uint256"}],name:"setQuorumVotes",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"voteExtendTime",type:"uint256"}],name:"setVoteExtendTime",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"votingDelay",type:"uint256"}],name:"setVotingDelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"votingPeriod",type:"uint256"}],name:"setVotingPeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"}],name:"state",outputs:[{internalType:"enum Governance.ProposalState",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"torn",outputs:[{internalType:"contract TORN",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"undelegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"unlock",outputs:[],stateMutability:"nonpayable",type:"function"}],xs="0x60806040523480156200001157600080fd5b50600054610100900460ff16806200002e57506200002e620000c9565b806200003d575060005460ff16155b620000655760405162461bcd60e51b81526004016200005c9062000110565b60405180910390fd5b600054610100900460ff1615801562000091576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000af620000cf565b8015620000c2576000805461ff00191690555b506200015e565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b612524806200016e6000396000f3fe60806040526004361061020f5760003560e01c8063a6c2660311610118578063d6159fe5116100a0578063e4917d9f1161006f578063e4917d9f146105ce578063ea0217cf146105ee578063ece40cc11461060e578063f0b768921461062e578063fe0d94c11461064e5761020f565b8063d6159fe514610557578063d6f0948c1461056c578063da35c6641461058c578063e23a9a52146105a15761020f565b8063b54426c8116100e7578063b54426c8146104c2578063b859f11b146104e2578063c0c0e82014610502578063c4d66de814610522578063ce25d71c146105425761020f565b8063a6c2660314610463578063a72edda314610478578063adf898a414610498578063b1610d7e146104ad5761020f565b80636198e3391161019b5780636dc2dc6c1161016a5780636dc2dc6c146103ce57806370b0f660146103ee57806392ab89bb1461040e5780639a9e3b6e146104235780639ae697bf146104435761020f565b80636198e3391461035757806365da126414610377578063671dd275146103a45780636a661755146103b95761020f565b806337f135d7116101e257806337f135d7146102c05780633e4f49e6146102d5578063587a6ecb1461030257806358e9fff0146103175780635c19a95c146103375761020f565b8063013cf08b1461021457806302ec8f9e1461025157806315373e3d1461027357806317977c6114610293575b600080fd5b34801561022057600080fd5b5061023461022f366004611d5c565b610661565b604051610248989796959493929190611e68565b60405180910390f35b34801561025d57600080fd5b5061027161026c366004611d5c565b6106c6565b005b34801561027f57600080fd5b5061027161028e366004611da0565b6106f3565b34801561029f57600080fd5b506102b36102ae366004611b53565b610702565b604051610248919061246b565b3480156102cc57600080fd5b506102b3610714565b3480156102e157600080fd5b506102f56102f0366004611d5c565b61071a565b6040516102489190611f26565b34801561030e57600080fd5b506102b361085d565b34801561032357600080fd5b506102b3610332366004611b6e565b610863565b34801561034357600080fd5b50610271610352366004611b53565b6108b1565b34801561036357600080fd5b50610271610372366004611d5c565b6109d3565b34801561038357600080fd5b50610397610392366004611b53565b610b0a565b6040516102489190611e17565b3480156103b057600080fd5b506102b3610b25565b3480156103c557600080fd5b506102b3610b2b565b3480156103da57600080fd5b506102716103e9366004611d5c565b610b31565b3480156103fa57600080fd5b50610271610409366004611d5c565b610b76565b34801561041a57600080fd5b50610271610b9a565b34801561042f57600080fd5b5061027161043e366004611d5c565b610c21565b34801561044f57600080fd5b506102b361045e366004611b53565b610c45565b34801561046f57600080fd5b506102b3610c57565b34801561048457600080fd5b506102b3610493366004611b53565b610c5d565b3480156104a457600080fd5b50610397610c6f565b3480156104b957600080fd5b506102b3610c7e565b3480156104ce57600080fd5b506102716104dd366004611d5c565b610c84565b3480156104ee57600080fd5b506102716104fd366004611c7b565b610c8e565b34801561050e57600080fd5b5061027161051d366004611d5c565b610d45565b34801561052e57600080fd5b5061027161053d366004611b53565b610d69565b34801561054e57600080fd5b506102b3610fac565b34801561056357600080fd5b506102b3610fb2565b34801561057857600080fd5b506102b3610587366004611bce565b610fb8565b34801561059857600080fd5b506102b3610fce565b3480156105ad57600080fd5b506105c16105bc366004611d74565b610fd8565b6040516102489190612446565b3480156105da57600080fd5b506102716105e9366004611d5c565b61104a565b3480156105fa57600080fd5b50610271610609366004611d5c565b61106e565b34801561061a57600080fd5b50610271610629366004611d5c565b611092565b34801561063a57600080fd5b50610271610649366004611c1c565b6110b6565b61027161065c366004611d5c565b611136565b603d818154811061066e57fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b3330146106ee5760405162461bcd60e51b81526004016106e590612212565b60405180910390fd5b603555565b6106fe3383836112c8565b5050565b603e6020526000908152604090205481565b60335481565b6000610724610fce565b82111580156107335750600082115b61074f5760405162461bcd60e51b81526004016106e590612348565b6000603d838154811061075e57fe5b90600052602060002090600802019050806002015461077b6114f9565b1161078a576000915050610858565b80600301546107976114f9565b116107a6576001915050610858565b806005015481600401541115806107c857506035548160050154826004015401105b156107d7576002915050610858565b600681015460ff16156107ee576005915050610858565b61081360345461080d60335484600301546114fd90919063ffffffff16565b906114fd565b61081b6114f9565b1061082a576006915050610858565b603354600382015461083b916114fd565b6108436114f9565b10610852576004915050610858565b60039150505b919050565b603a5481565b6001600160a01b038381166000908152603c6020526040812054909116331461089e5760405162461bcd60e51b81526004016106e5906123d8565b6108a9848484611522565b949350505050565b336000818152603c60205260409020546001600160a01b0390811691908316148015906108e757506001600160a01b0382163014155b80156108fb57506001600160a01b03821615155b80156109195750806001600160a01b0316826001600160a01b031614155b6109355760405162461bcd60e51b81526004016106e590612249565b6001600160a01b0381161561097b576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000908152603f60205260409020546109eb6114f9565b11610a085760405162461bcd60e51b81526004016106e590612175565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054610a56918390611870565b336000818152603b602052604090819020929092558154915163a9059cbb60e01b81526001600160a01b039092169163a9059cbb91610a99918590600401611e2b565b602060405180830381600087803b158015610ab357600080fd5b505af1158015610ac7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aeb9190611d40565b610b075760405162461bcd60e51b81526004016106e5906121ac565b50565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610b505760405162461bcd60e51b81526004016106e590612212565b6033548110610b715760405162461bcd60e51b81526004016106e590612131565b603a55565b333014610b955760405162461bcd60e51b81526004016106e590612212565b603755565b336000908152603c60205260409020546001600160a01b031680610bd05760405162461bcd60e51b81526004016106e59061238e565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b333014610c405760405162461bcd60e51b81526004016106e590612212565b603455565b603b6020526000908152604090205481565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b610b07338261189c565b60005b8351811015610d1f57336001600160a01b0316603c6000868481518110610cb457fe5b6020908102919091018101516001600160a01b03908116835290820192909252604001600020541614610cf95760405162461bcd60e51b81526004016106e5906123d8565b610d17848281518110610d0857fe5b602002602001015184846112c8565b600101610c91565b50336000908152603b602052604090205415610d4057610d403383836112c8565b505050565b333014610d645760405162461bcd60e51b81526004016106e590612212565b603955565b600054610100900460ff1680610d825750610d82611981565b80610d90575060005460ff16155b610dac5760405162461bcd60e51b81526004016106e5906122fa565b600054610100900460ff16158015610dd7576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff199094169390931716919091179055610f97611987565b80156106fe576000805461ff00191690555050565b60395481565b60375481565b6000610fc5338484611522565b90505b92915050565b603d546000190190565b610fe0611a4d565b603d8381548110610fed57fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b3330146110695760405162461bcd60e51b81526004016106e590612212565b603355565b33301461108d5760405162461bcd60e51b81526004016106e590612212565b603855565b3330146110b15760405162461bcd60e51b81526004016106e590612212565b603655565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf906110f290899030908a908a908a908a908a90600401611eae565b600060405180830381600087803b15801561110c57600080fd5b505af1158015611120573d6000803e3d6000fd5b5050505061112e868661189c565b505050505050565b60046111418261071a565b600681111561114c57fe5b146111695760405162461bcd60e51b81526004016106e590611f90565b6000603d828154811061117857fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b03166111b3816119c8565b6111cf5760405162461bcd60e51b81526004016106e590611f4d565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b0385169161121391611dfb565b600060405180830381855af49150503d806000811461124e576040519150601f19603f3d011682016040523d82523d6000602084013e611253565b606091505b5091509150816112965780511561127e578060405162461bcd60e51b81526004016106e59190611f3a565b60405162461bcd60e51b81526004016106e59061240f565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b60016112d38361071a565b60068111156112de57fe5b146112fb5760405162461bcd60e51b81526004016106e590612056565b6000603d838154811061130a57fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b9094529190942054929450101590806113695760405162461bcd60e51b81526004016106e590612280565b825460ff16156113b8578254610100900460ff161561139f5760018301546004850154611395916119ce565b60048501556113b8565b600183015460058501546113b2916119ce565b60058501555b84156113d75760048401546113cd90826114fd565b60048501556113ec565b60058401546113e690826114fd565b60058501555b6006840154610100900460ff1615801561141c575060395461141a61140f6114f9565b6003870154906119ce565b105b1561146057600584015460048501541115821515811461145e5760068501805461ff001916610100179055603a546003860154611458916114fd565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a5460038701546114ab938b936114a693919261080d928391906114fd565b611a10565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b5846040516114e8919061246b565b60405180910390a450505050505050565b4290565b600082820183811015610fc55760405162461bcd60e51b81526004016106e5906120fa565b6001600160a01b0383166000908152603b602052604081205460365481101561155d5760405162461bcd60e51b81526004016106e59061209d565b611566846119c8565b6115825760405162461bcd60e51b81526004016106e5906122b7565b6001600160a01b0385166000908152603e602052604090205480156115f45760006115ac8261071a565b905060018160068111156115bc57fe5b141580156115d6575060008160068111156115d357fe5b14155b6115f25760405162461bcd60e51b81526004016106e590611fdb565b505b600061160460375461080d6114f9565b9050600061161d603854836114fd90919063ffffffff16565b9050611627611a6d565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff199093169290921794909416179055906117d9610fce565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a5492935061181b928d926114a692909161080d919082908a906114fd565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d60405161185b9493929190611eef565b60405180910390a39998505050505050505050565b600081848411156118945760405162461bcd60e51b81526004016106e59190611f3a565b505050900390565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd906118d090859030908690600401611e44565b602060405180830381600087803b1580156118ea57600080fd5b505af11580156118fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119229190611d40565b61193e5760405162461bcd60e51b81526004016106e5906121db565b6001600160a01b0382166000908152603b602052604090205461196190826114fd565b6001600160a01b039092166000908152603b602052604090209190915550565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b3b151590565b6000610fc583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611870565b6001600160a01b0382166000908152603f60205260409020548111156106fe576001600160a01b03919091166000908152603f6020526040902055565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b0381168114610fc857600080fd5b8035610fc8816124e0565b600082601f830112611afa578081fd5b813567ffffffffffffffff811115611b10578182fd5b611b23601f8201601f1916602001612474565b9150808252836020828501011115611b3a57600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215611b64578081fd5b610fc58383611ac8565b600080600060608486031215611b82578182fd5b8335611b8d816124cb565b92506020840135611b9d816124cb565b9150604084013567ffffffffffffffff811115611bb8578182fd5b611bc486828701611aea565b9150509250925092565b60008060408385031215611be0578182fd5b8235611beb816124cb565b9150602083013567ffffffffffffffff811115611c06578182fd5b611c1285828601611aea565b9150509250929050565b60008060008060008060c08789031215611c34578182fd5b611c3e8888611ac8565b95506020870135945060408701359350606087013560ff81168114611c61578283fd5b9598949750929560808101359460a0909101359350915050565b600080600060608486031215611c8f578283fd5b833567ffffffffffffffff80821115611ca6578485fd5b818601915086601f830112611cb9578485fd5b813581811115611cc7578586fd5b60209150818102611cd9838201612474565b8281528381019085850183870186018c1015611cf357898afd5b8996505b84871015611d1d57611d098c82611ac8565b835260019690960195918501918501611cf7565b5097505050508501359250611d3790508560408601611adf565b90509250925092565b600060208284031215611d51578081fd5b8151610fc5816124e0565b600060208284031215611d6d578081fd5b5035919050565b60008060408385031215611d86578182fd5b82359150611d978460208501611ac8565b90509250929050565b60008060408385031215611db2578182fd5b823591506020830135611dc4816124e0565b809150509250929050565b60008151808452611de781602086016020860161249b565b601f01601f19169290920160200192915050565b60008251611e0d81846020870161249b565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b038616825284602083015283604083015260806060830152611f1c6080830184611dcf565b9695505050505050565b6020810160078310611f3457fe5b91905290565b600060208252610fc56020830184611dcf565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b6020808252601590820152741513d4938e881d1c985b9cd9995c8819985a5b1959605a1b604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b90815260200190565b60405181810167ffffffffffffffff8111828210171561249357600080fd5b604052919050565b60005b838110156124b657818101518382015260200161249e565b838111156124c5576000848401525b50505050565b6001600160a01b0381168114610b0757600080fd5b8015158114610b0757600080fdfea26469706673582212208c8a57d0dd9da76417112ba79eab1d38dbdf5e0a8bc014651f10bebe82ce8f9b64736f6c634300060c0033";class Is extends Ya{constructor(...e){e.length>1?super(...e):super(_s,xs,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=xs;static abi=_s;static createInterface(){return new ba(_s)}static connect(e,t){return new Wa(e,_s,t)}}var Es=Object.freeze({__proto__:null,Configuration__factory:gs,Core__factory:hs,Delegation__factory:Ms,Governance__factory:Is,mocks:ls});const Rs=[{inputs:[{internalType:"address",name:"_gasCompensationVault",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"gasCompensationVault",outputs:[{internalType:"contract IGasCompensationVault",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_gasCompensationsLimit",type:"uint256"}],name:"setGasCompensations",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawFromHelper",outputs:[],stateMutability:"nonpayable",type:"function"}];class Os{static abi=Rs;static createInterface(){return new ba(Rs)}static connect(e,t){return new Wa(e,Rs,t)}}const ks=[{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"gasAmount",type:"uint256"}],name:"compensateGas",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawToGovernance",outputs:[],stateMutability:"nonpayable",type:"function"}];class Ps{static abi=ks;static createInterface(){return new ba(ks)}static connect(e,t){return new Wa(e,ks,t)}}var As=Object.freeze({__proto__:null,GasCompensator__factory:Os,IGasCompensationVault__factory:Ps});const Cs=[{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawTorn",outputs:[],stateMutability:"nonpayable",type:"function"}];var Ss=Object.freeze({__proto__:null,ITornadoVault__factory:class{static abi=Cs;static createInterface(){return new ba(Cs)}static connect(e,t){return new Wa(e,Cs,t)}}});const Ns=[{inputs:[{internalType:"address",name:"_gasCompLogic",type:"address"},{internalType:"address",name:"_userVault",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"}],name:"Delegated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"proposer",type:"address"},{indexed:!1,internalType:"address",name:"target",type:"address"},{indexed:!1,internalType:"uint256",name:"startTime",type:"uint256"},{indexed:!1,internalType:"uint256",name:"endTime",type:"uint256"},{indexed:!1,internalType:"string",name:"description",type:"string"}],name:"ProposalCreated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"proposalId",type:"uint256"}],name:"ProposalExecuted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"}],name:"Undelegated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"proposalId",type:"uint256"},{indexed:!0,internalType:"address",name:"voter",type:"address"},{indexed:!0,internalType:"bool",name:"support",type:"bool"},{indexed:!1,internalType:"uint256",name:"votes",type:"uint256"}],name:"Voted",type:"event"},{inputs:[],name:"CLOSING_PERIOD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"EXECUTION_DELAY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"EXECUTION_EXPIRATION",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"PROPOSAL_THRESHOLD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"QUORUM_VOTES",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTE_EXTEND_TIME",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTING_DELAY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTING_PERIOD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"canWithdrawAfter",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address[]",name:"from",type:"address[]"},{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"bool",name:"support",type:"bool"}],name:"castDelegatedVote",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"bool",name:"support",type:"bool"}],name:"castVote",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"}],name:"checkIfQuorumReached",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"delegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"delegatedTo",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"}],name:"execute",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"gasCompensationVault",outputs:[{internalType:"contract IGasCompensationVault",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"address",name:"voter",type:"address"}],name:"getReceipt",outputs:[{components:[{internalType:"bool",name:"hasVoted",type:"bool"},{internalType:"bool",name:"support",type:"bool"},{internalType:"uint256",name:"votes",type:"uint256"}],internalType:"struct Governance.Receipt",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"address",name:"account",type:"address"}],name:"hasAccountVoted",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_torn",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"latestProposalIds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"lock",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"lockWithApproval",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"lockedBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"proposalCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"proposals",outputs:[{internalType:"address",name:"proposer",type:"address"},{internalType:"address",name:"target",type:"address"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"uint256",name:"forVotes",type:"uint256"},{internalType:"uint256",name:"againstVotes",type:"uint256"},{internalType:"bool",name:"executed",type:"bool"},{internalType:"bool",name:"extended",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"target",type:"address"},{internalType:"string",name:"description",type:"string"}],name:"propose",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"target",type:"address"},{internalType:"string",name:"description",type:"string"}],name:"proposeByDelegate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"returnMultisigAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"closingPeriod",type:"uint256"}],name:"setClosingPeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"executionDelay",type:"uint256"}],name:"setExecutionDelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"executionExpiration",type:"uint256"}],name:"setExecutionExpiration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"gasCompensationsLimit",type:"uint256"}],name:"setGasCompensations",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalThreshold",type:"uint256"}],name:"setProposalThreshold",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"quorumVotes",type:"uint256"}],name:"setQuorumVotes",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"voteExtendTime",type:"uint256"}],name:"setVoteExtendTime",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"votingDelay",type:"uint256"}],name:"setVotingDelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"votingPeriod",type:"uint256"}],name:"setVotingPeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"}],name:"state",outputs:[{internalType:"enum Governance.ProposalState",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"torn",outputs:[{internalType:"contract TORN",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"undelegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"unlock",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"userVault",outputs:[{internalType:"contract ITornadoVault",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"version",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawFromHelper",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],Ds="0x60c06040523480156200001157600080fd5b5060405162002e3138038062002e31833981016040819052620000349162000153565b60005482908290610100900460ff1680620000545750620000546200010c565b8062000063575060005460ff16155b6200008b5760405162461bcd60e51b8152600401620000829062000191565b60405180910390fd5b600054610100900460ff16158015620000b7576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000d562000112565b8015620000e8576000805461ff00191690555b506001600160601b0319606091821b811660805291901b1660a05250620001f89050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6000806040838503121562000166578182fd5b82516200017381620001df565b60208401519092506200018681620001df565b809150509250929050565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6001600160a01b0381168114620001f557600080fd5b50565b60805160601c60a05160601c612bf162000240600039806108c55280610e525280610f4a52806114505280611ee1525080610d545280610fb75280611cf75250612bf16000f3fe60806040526004361061026b5760003560e01c80639ae697bf11610144578063d6159fe5116100b6578063e525aa081161007a578063e525aa08146106ff578063ea0217cf1461071f578063ece40cc11461073f578063ef3f8bb11461075f578063f0b768921461077f578063fe0d94c11461079f57610272565b8063d6159fe514610668578063d6f0948c1461067d578063da35c6641461069d578063e23a9a52146106b2578063e4917d9f146106df57610272565b8063b1610d7e11610108578063b1610d7e146105be578063b54426c8146105d3578063b859f11b146105f3578063c0c0e82014610613578063c4d66de814610633578063ce25d71c1461065357610272565b80639ae697bf1461053f5780639daafec71461055f578063a6c2660314610574578063a72edda314610589578063adf898a4146105a957610272565b80635c19a95c116101dd5780636dc2dc6c116101a15780636dc2dc6c1461049557806370b0f660146104b55780638b34a960146104d557806392ab89bb146104ea578063932d5157146104ff5780639a9e3b6e1461051f57610272565b80635c19a95c1461040b5780636198e3391461042b57806365da12641461044b578063671dd2751461046b5780636a6617551461048057610272565b806332687ec11161022f57806332687ec11461034557806337f135d7146103725780633e4f49e61461038757806354fd4d50146103b4578063587a6ecb146103d657806358e9fff0146103eb57610272565b8063013cf08b1461027757806302ec8f9e146102b457806315373e3d146102d657806317977c61146102f657806324b0435f1461032357610272565b3661027257005b600080fd5b34801561028357600080fd5b506102976102923660046123c5565b6107b2565b6040516102ab9897969594939291906124d1565b60405180910390f35b3480156102c057600080fd5b506102d46102cf3660046123c5565b610817565b005b3480156102e257600080fd5b506102d46102f1366004612409565b610844565b34801561030257600080fd5b506103166103113660046121bc565b610947565b6040516102ab9190612b38565b34801561032f57600080fd5b50610338610959565b6040516102ab9190612480565b34801561035157600080fd5b506103656103603660046123c5565b610971565b6040516102ab919061258f565b34801561037e57600080fd5b506103166109bf565b34801561039357600080fd5b506103a76103a23660046123c5565b6109c5565b6040516102ab919061259a565b3480156103c057600080fd5b506103c9610b01565b6040516102ab91906125ae565b3480156103e257600080fd5b50610316610b38565b3480156103f757600080fd5b506103166104063660046121d7565b610b3e565b34801561041757600080fd5b506102d46104263660046121bc565b610b8c565b34801561043757600080fd5b506102d46104463660046123c5565b610cae565b34801561045757600080fd5b506103386104663660046121bc565b610dc0565b34801561047757600080fd5b50610316610ddb565b34801561048c57600080fd5b50610316610de1565b3480156104a157600080fd5b506102d46104b03660046123c5565b610de7565b3480156104c157600080fd5b506102d46104d03660046123c5565b610e2c565b3480156104e157600080fd5b50610338610e50565b3480156104f657600080fd5b506102d4610e74565b34801561050b57600080fd5b506102d461051a3660046123c5565b610efb565b34801561052b57600080fd5b506102d461053a3660046123c5565b610f7f565b34801561054b57600080fd5b5061031661055a3660046121bc565b610fa3565b34801561056b57600080fd5b50610338610fb5565b34801561058057600080fd5b50610316610fd9565b34801561059557600080fd5b506103166105a43660046121bc565b610fdf565b3480156105b557600080fd5b50610338610ff1565b3480156105ca57600080fd5b50610316611000565b3480156105df57600080fd5b506102d46105ee3660046123c5565b611006565b3480156105ff57600080fd5b506102d461060e3660046122e4565b611013565b34801561061f57600080fd5b506102d461062e3660046123c5565b611061565b34801561063f57600080fd5b506102d461064e3660046121bc565b611085565b34801561065f57600080fd5b506103166112c9565b34801561067457600080fd5b506103166112cf565b34801561068957600080fd5b50610316610698366004612237565b6112d5565b3480156106a957600080fd5b506103166112eb565b3480156106be57600080fd5b506106d26106cd3660046123dd565b6112f5565b6040516102ab9190612b13565b3480156106eb57600080fd5b506102d46106fa3660046123c5565b611367565b34801561070b57600080fd5b5061036561071a3660046123dd565b61138b565b34801561072b57600080fd5b506102d461073a3660046123c5565b6113ce565b34801561074b57600080fd5b506102d461075a3660046123c5565b6113f2565b34801561076b57600080fd5b506102d461077a3660046123c5565b611416565b34801561078b57600080fd5b506102d461079a366004612285565b6114a5565b6102d46107ad3660046123c5565b611525565b603d81815481106107bf57fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b33301461083f5760405162461bcd60e51b815260040161083690612881565b60405180910390fd5b603555565b3361084f833361138b565b158015610862575061086083610971565b155b333214610870576000610874565b6152085b61ffff1681156109355760005a905061088e3387876116b7565b60006108ab6127106108a5856108a55a87906118e8565b9061192a565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce807906108fc9088908590600401612494565b600060405180830381600087803b15801561091657600080fd5b505af115801561092a573d6000803e3d6000fd5b505050505050610940565b6109403386866116b7565b5050505050565b603e6020526000908152604090205481565b73b04e030140b30c27bcdfaafffa98c57d80eda7b490565b6000603554603d838154811061098357fe5b906000526020600020906008020160050154603d84815481106109a257fe5b90600052602060002090600802016004015401101590505b919050565b60335481565b60006109cf6112eb565b82111580156109de5750600082115b6109fa5760405162461bcd60e51b8152600401610836906129de565b6000603d8381548110610a0957fe5b906000526020600020906008020190508060020154610a2661194f565b11610a355760009150506109ba565b8060030154610a4261194f565b11610a515760019150506109ba565b80600501548160040154111580610a7357506035548160050154826004015401105b15610a825760029150506109ba565b600681015460ff1615610a995760059150506109ba565b610ab86034546108a5603354846003015461192a90919063ffffffff16565b610ac061194f565b10610acf5760069150506109ba565b6033546003820154610ae09161192a565b610ae861194f565b10610af75760049150506109ba565b60039150506109ba565b60408051808201909152601981527f322e6c6f74746572792d616e642d6761732d7570677261646500000000000000602082015290565b603a5481565b6001600160a01b038381166000908152603c60205260408120549091163314610b795760405162461bcd60e51b815260040161083690612a6e565b610b84848484611953565b949350505050565b336000818152603c60205260409020546001600160a01b039081169190831614801590610bc257506001600160a01b0382163014155b8015610bd657506001600160a01b03821615155b8015610bf45750806001600160a01b0316826001600160a01b031614155b610c105760405162461bcd60e51b8152600401610836906128b8565b6001600160a01b03811615610c56576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000908152603f6020526040902054610cc661194f565b11610ce35760405162461bcd60e51b8152600401610836906127e9565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054610d31918390611ca1565b336000818152603b6020526040908190209290925590516391fe357360e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316916391fe357391610d9291908590600401612494565b600060405180830381600087803b158015610dac57600080fd5b505af1158015610940573d6000803e3d6000fd5b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610e065760405162461bcd60e51b815260040161083690612881565b6033548110610e275760405162461bcd60e51b8152600401610836906127a5565b603a55565b333014610e4b5760405162461bcd60e51b815260040161083690612881565b603755565b7f000000000000000000000000000000000000000000000000000000000000000081565b336000908152603c60205260409020546001600160a01b031680610eaa5760405162461bcd60e51b815260040161083690612a24565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b610f03610959565b6001600160a01b0316336001600160a01b031614610f335760405162461bcd60e51b8152600401610836906129b7565b604051633a08bde160e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e822f78490610d92908490600401612b38565b333014610f9e5760405162461bcd60e51b815260040161083690612881565b603455565b603b6020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b6110103382611ccd565b50565b60008351116110345760405162461bcd60e51b815260040161083690612857565b61105c838383611044863361138b565b158015611057575061105586610971565b155b611dd2565b505050565b3330146110805760405162461bcd60e51b815260040161083690612881565b603955565b600054610100900460ff168061109e575061109e612016565b806110ac575060005460ff16155b6110c85760405162461bcd60e51b815260040161083690612969565b600054610100900460ff161580156110f3576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff1990941693909317169190911790556112b361201c565b80156112c5576000805461ff00191690555b5050565b60395481565b60375481565b60006112e2338484611953565b90505b92915050565b603d546000190190565b6112fd6120b6565b603d838154811061130a57fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b3330146113865760405162461bcd60e51b815260040161083690612881565b603355565b6000603d838154811061139a57fe5b600091825260208083206001600160a01b03861684526007600890930201919091019052604090205460ff16905092915050565b3330146113ed5760405162461bcd60e51b815260040161083690612881565b603855565b3330146114115760405162461bcd60e51b815260040161083690612881565b603655565b61141e610959565b6001600160a01b0316336001600160a01b03161461144e5760405162461bcd60e51b8152600401610836906129b7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166108fc611485834761205d565b6040518115909202916000818181858888f1935050505061101057600080fd5b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf906114e190899030908a908a908a908a908a90600401612517565b600060405180830381600087803b1580156114fb57600080fd5b505af115801561150f573d6000803e3d6000fd5b5050505061151d8686611ccd565b505050505050565b6004611530826109c5565b600681111561153b57fe5b146115585760405162461bcd60e51b815260040161083690612604565b6000603d828154811061156757fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b03166115a281612073565b6115be5760405162461bcd60e51b8152600401610836906125c1565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b0385169161160291612464565b600060405180830381855af49150503d806000811461163d576040519150601f19603f3d011682016040523d82523d6000602084013e611642565b606091505b5091509150816116855780511561166d578060405162461bcd60e51b815260040161083691906125ae565b60405162461bcd60e51b815260040161083690612aa5565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b60016116c2836109c5565b60068111156116cd57fe5b146116ea5760405162461bcd60e51b8152600401610836906126ca565b6000603d83815481106116f957fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b9094529190942054929450101590806117585760405162461bcd60e51b8152600401610836906128ef565b825460ff16156117a7578254610100900460ff161561178e5760018301546004850154611784916118e8565b60048501556117a7565b600183015460058501546117a1916118e8565b60058501555b84156117c65760048401546117bc908261192a565b60048501556117db565b60058401546117d5908261192a565b60058501555b6006840154610100900460ff1615801561180b57506039546118096117fe61194f565b6003870154906118e8565b105b1561184f57600584015460048501541115821515811461184d5760068501805461ff001916610100179055603a5460038601546118479161192a565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a54600387015461189a938b936118959391926108a59283919061192a565b612079565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b5846040516118d79190612b38565b60405180910390a450505050505050565b60006112e283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ca1565b6000828201838110156112e25760405162461bcd60e51b81526004016108369061276e565b4290565b6001600160a01b0383166000908152603b602052604081205460365481101561198e5760405162461bcd60e51b815260040161083690612711565b61199784612073565b6119b35760405162461bcd60e51b815260040161083690612926565b6001600160a01b0385166000908152603e60205260409020548015611a255760006119dd826109c5565b905060018160068111156119ed57fe5b14158015611a0757506000816006811115611a0457fe5b14155b611a235760405162461bcd60e51b81526004016108369061264f565b505b6000611a356037546108a561194f565b90506000611a4e6038548361192a90919063ffffffff16565b9050611a586120d6565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff19909316929092179490941617905590611c0a6112eb565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a54929350611c4c928d926118959290916108a5919082908a9061192a565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d604051611c8c9493929190612558565b60405180910390a39998505050505050505050565b60008184841115611cc55760405162461bcd60e51b815260040161083691906125ae565b505050900390565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd90611d219085907f00000000000000000000000000000000000000000000000000000000000000009086906004016124ad565b602060405180830381600087803b158015611d3b57600080fd5b505af1158015611d4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d7391906123a9565b611d8f5760405162461bcd60e51b815260040161083690612820565b6001600160a01b0382166000908152603b6020526040902054611db2908261192a565b6001600160a01b039092166000908152603b602052604090209190915550565b3381328214611de2576000611de6565b6152085b61ffff168115611f515760005a905060005b8851811015611eaf576000898281518110611e0f57fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611e4f57506001600160a01b03811633145b611e6b5760405162461bcd60e51b815260040161083690612a6e565b861580611e7f5750611e7d898261138b565b155b611e9b5760405162461bcd60e51b815260040161083690612adc565b611ea6818a8a6116b7565b50600101611df8565b506000611ec76127106108a5856108a55a87906118e8565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce80790611f189088908590600401612494565b600060405180830381600087803b158015611f3257600080fd5b505af1158015611f46573d6000803e3d6000fd5b50505050505061200d565b60005b875181101561200b576000888281518110611f6b57fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611fab57506001600160a01b03811633145b611fc75760405162461bcd60e51b815260040161083690612a6e565b851580611fdb5750611fd9888261138b565b155b611ff75760405162461bcd60e51b815260040161083690612adc565b6120028189896116b7565b50600101611f54565b505b50505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b600081831061206c57816112e2565b5090919050565b3b151590565b6001600160a01b0382166000908152603f60205260409020548111156112c5576001600160a01b03919091166000908152603f6020526040902055565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b03811681146112e557600080fd5b80356112e581612bad565b600082601f830112612163578081fd5b813567ffffffffffffffff811115612179578182fd5b61218c601f8201601f1916602001612b41565b91508082528360208285010111156121a357600080fd5b8060208401602084013760009082016020015292915050565b6000602082840312156121cd578081fd5b6112e28383612131565b6000806000606084860312156121eb578182fd5b83356121f681612b98565b9250602084013561220681612b98565b9150604084013567ffffffffffffffff811115612221578182fd5b61222d86828701612153565b9150509250925092565b60008060408385031215612249578182fd5b823561225481612b98565b9150602083013567ffffffffffffffff81111561226f578182fd5b61227b85828601612153565b9150509250929050565b60008060008060008060c0878903121561229d578182fd5b6122a78888612131565b95506020870135945060408701359350606087013560ff811681146122ca578283fd5b9598949750929560808101359460a0909101359350915050565b6000806000606084860312156122f8578283fd5b833567ffffffffffffffff8082111561230f578485fd5b818601915086601f830112612322578485fd5b813581811115612330578586fd5b60209150818102612342838201612b41565b8281528381019085850183870186018c101561235c57898afd5b8996505b84871015612386576123728c82612131565b835260019690960195918501918501612360565b50975050505085013592506123a090508560408601612148565b90509250925092565b6000602082840312156123ba578081fd5b81516112e281612bad565b6000602082840312156123d6578081fd5b5035919050565b600080604083850312156123ef578182fd5b823591506124008460208501612131565b90509250929050565b6000806040838503121561241b578182fd5b82359150602083013561242d81612bad565b809150509250929050565b60008151808452612450816020860160208601612b68565b601f01601f19169290920160200192915050565b60008251612476818460208701612b68565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b0386168252846020830152836040830152608060608301526125856080830184612438565b9695505050505050565b901515815260200190565b60208101600783106125a857fe5b91905290565b6000602082526112e26020830184612438565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526010908201526f43616e206e6f7420626520656d70747960801b604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252600d908201526c6f6e6c79206d756c746973696760981b604082015260600190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b60208082526019908201527f476f7665726e616e63653a20766f74656420616c726561647900000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b90815260200190565b60405181810167ffffffffffffffff81118282101715612b6057600080fd5b604052919050565b60005b83811015612b83578181015183820152602001612b6b565b83811115612b92576000848401525b50505050565b6001600160a01b038116811461101057600080fd5b801515811461101057600080fdfea2646970667358221220a9ae24380315e86f1632949f167f44c17322fe48a1385357edbfdf8bc543469764736f6c634300060c0033";class Us extends Ya{constructor(...e){e.length>1?super(...e):super(Ns,Ds,e[0])}getDeployTransaction(e,t,a){return super.getDeployTransaction(e,t,a||{})}deploy(e,t,a){return super.deploy(e,t,a||{})}connect(e){return super.connect(e)}static bytecode=Ds;static abi=Ns;static createInterface(){return new ba(Ns)}static connect(e,t){return new Wa(e,Ns,t)}}const Vs=[{inputs:[{internalType:"address",name:"_userVault",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"}],name:"Delegated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"proposer",type:"address"},{indexed:!1,internalType:"address",name:"target",type:"address"},{indexed:!1,internalType:"uint256",name:"startTime",type:"uint256"},{indexed:!1,internalType:"uint256",name:"endTime",type:"uint256"},{indexed:!1,internalType:"string",name:"description",type:"string"}],name:"ProposalCreated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"proposalId",type:"uint256"}],name:"ProposalExecuted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"}],name:"Undelegated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"proposalId",type:"uint256"},{indexed:!0,internalType:"address",name:"voter",type:"address"},{indexed:!0,internalType:"bool",name:"support",type:"bool"},{indexed:!1,internalType:"uint256",name:"votes",type:"uint256"}],name:"Voted",type:"event"},{inputs:[],name:"CLOSING_PERIOD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"EXECUTION_DELAY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"EXECUTION_EXPIRATION",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"PROPOSAL_THRESHOLD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"QUORUM_VOTES",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTE_EXTEND_TIME",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTING_DELAY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTING_PERIOD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"canWithdrawAfter",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address[]",name:"from",type:"address[]"},{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"bool",name:"support",type:"bool"}],name:"castDelegatedVote",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"bool",name:"support",type:"bool"}],name:"castVote",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"delegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"delegatedTo",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"}],name:"execute",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"address",name:"voter",type:"address"}],name:"getReceipt",outputs:[{components:[{internalType:"bool",name:"hasVoted",type:"bool"},{internalType:"bool",name:"support",type:"bool"},{internalType:"uint256",name:"votes",type:"uint256"}],internalType:"struct Governance.Receipt",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_torn",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"latestProposalIds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"lock",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"lockWithApproval",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"lockedBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"proposalCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"proposals",outputs:[{internalType:"address",name:"proposer",type:"address"},{internalType:"address",name:"target",type:"address"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"uint256",name:"forVotes",type:"uint256"},{internalType:"uint256",name:"againstVotes",type:"uint256"},{internalType:"bool",name:"executed",type:"bool"},{internalType:"bool",name:"extended",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"target",type:"address"},{internalType:"string",name:"description",type:"string"}],name:"propose",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"target",type:"address"},{internalType:"string",name:"description",type:"string"}],name:"proposeByDelegate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"closingPeriod",type:"uint256"}],name:"setClosingPeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"executionDelay",type:"uint256"}],name:"setExecutionDelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"executionExpiration",type:"uint256"}],name:"setExecutionExpiration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalThreshold",type:"uint256"}],name:"setProposalThreshold",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"quorumVotes",type:"uint256"}],name:"setQuorumVotes",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"voteExtendTime",type:"uint256"}],name:"setVoteExtendTime",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"votingDelay",type:"uint256"}],name:"setVotingDelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"votingPeriod",type:"uint256"}],name:"setVotingPeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"}],name:"state",outputs:[{internalType:"enum Governance.ProposalState",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"torn",outputs:[{internalType:"contract TORN",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"undelegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"unlock",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"userVault",outputs:[{internalType:"contract ITornadoVault",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"version",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"}],Fs="0x60a06040523480156200001157600080fd5b506040516200277e3803806200277e833981016040819052620000349162000142565b600054610100900460ff168062000050575062000050620000fb565b806200005f575060005460ff16155b620000875760405162461bcd60e51b81526004016200007e9062000172565b60405180910390fd5b600054610100900460ff16158015620000b3576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000d162000101565b8015620000e4576000805461ff00191690555b5060601b6001600160601b031916608052620001c0565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b60006020828403121562000154578081fd5b81516001600160a01b03811681146200016b578182fd5b9392505050565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b60805160601c612596620001e860003980610af15280610cb3528061194752506125966000f3fe6080604052600436106102255760003560e01c80639daafec711610123578063ce25d71c116100ab578063e4917d9f1161006f578063e4917d9f1461061b578063ea0217cf1461063b578063ece40cc11461065b578063f0b768921461067b578063fe0d94c11461069b57610225565b8063ce25d71c1461058f578063d6159fe5146105a4578063d6f0948c146105b9578063da35c664146105d9578063e23a9a52146105ee57610225565b8063b1610d7e116100f2578063b1610d7e146104fa578063b54426c81461050f578063b859f11b1461052f578063c0c0e8201461054f578063c4d66de81461056f57610225565b80639daafec71461049b578063a6c26603146104b0578063a72edda3146104c5578063adf898a4146104e557610225565b80635c19a95c116101b15780636dc2dc6c116101755780636dc2dc6c1461040657806370b0f6601461042657806392ab89bb146104465780639a9e3b6e1461045b5780639ae697bf1461047b57610225565b80635c19a95c1461036f5780636198e3391461038f57806365da1264146103af578063671dd275146103dc5780636a661755146103f157610225565b806337f135d7116101f857806337f135d7146102d65780633e4f49e6146102eb57806354fd4d5014610318578063587a6ecb1461033a57806358e9fff01461034f57610225565b8063013cf08b1461022a57806302ec8f9e1461026757806315373e3d1461028957806317977c61146102a9575b600080fd5b34801561023657600080fd5b5061024a610245366004611dfd565b6106ae565b60405161025e989796959493929190611f09565b60405180910390f35b34801561027357600080fd5b50610287610282366004611dfd565b610713565b005b34801561029557600080fd5b506102876102a4366004611e41565b610740565b3480156102b557600080fd5b506102c96102c4366004611bf4565b61074f565b60405161025e91906124dd565b3480156102e257600080fd5b506102c9610761565b3480156102f757600080fd5b5061030b610306366004611dfd565b610767565b60405161025e9190611fc7565b34801561032457600080fd5b5061032d6108aa565b60405161025e9190611fdb565b34801561034657600080fd5b506102c96108d5565b34801561035b57600080fd5b506102c961036a366004611c0f565b6108db565b34801561037b57600080fd5b5061028761038a366004611bf4565b610929565b34801561039b57600080fd5b506102876103aa366004611dfd565b610a4b565b3480156103bb57600080fd5b506103cf6103ca366004611bf4565b610b64565b60405161025e9190611eb8565b3480156103e857600080fd5b506102c9610b7f565b3480156103fd57600080fd5b506102c9610b85565b34801561041257600080fd5b50610287610421366004611dfd565b610b8b565b34801561043257600080fd5b50610287610441366004611dfd565b610bd0565b34801561045257600080fd5b50610287610bf4565b34801561046757600080fd5b50610287610476366004611dfd565b610c7b565b34801561048757600080fd5b506102c9610496366004611bf4565b610c9f565b3480156104a757600080fd5b506103cf610cb1565b3480156104bc57600080fd5b506102c9610cd5565b3480156104d157600080fd5b506102c96104e0366004611bf4565b610cdb565b3480156104f157600080fd5b506103cf610ced565b34801561050657600080fd5b506102c9610cfc565b34801561051b57600080fd5b5061028761052a366004611dfd565b610d02565b34801561053b57600080fd5b5061028761054a366004611d1c565b610d0f565b34801561055b57600080fd5b5061028761056a366004611dfd565b610dc6565b34801561057b57600080fd5b5061028761058a366004611bf4565b610dea565b34801561059b57600080fd5b506102c961102d565b3480156105b057600080fd5b506102c9611033565b3480156105c557600080fd5b506102c96105d4366004611c6f565b611039565b3480156105e557600080fd5b506102c961104f565b3480156105fa57600080fd5b5061060e610609366004611e15565b611059565b60405161025e91906124b8565b34801561062757600080fd5b50610287610636366004611dfd565b6110cb565b34801561064757600080fd5b50610287610656366004611dfd565b6110ef565b34801561066757600080fd5b50610287610676366004611dfd565b611113565b34801561068757600080fd5b50610287610696366004611cbd565b611137565b6102876106a9366004611dfd565b6111b7565b603d81815481106106bb57fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b33301461073b5760405162461bcd60e51b815260040161073290612284565b60405180910390fd5b603555565b61074b338383611349565b5050565b603e6020526000908152604090205481565b60335481565b600061077161104f565b82111580156107805750600082115b61079c5760405162461bcd60e51b8152600401610732906123ba565b6000603d83815481106107ab57fe5b9060005260206000209060080201905080600201546107c861157a565b116107d75760009150506108a5565b80600301546107e461157a565b116107f35760019150506108a5565b8060050154816004015411158061081557506035548160050154826004015401105b156108245760029150506108a5565b600681015460ff161561083b5760059150506108a5565b61086060345461085a603354846003015461157e90919063ffffffff16565b9061157e565b61086861157a565b106108775760069150506108a5565b60335460038201546108889161157e565b61089061157a565b1061089f5760049150506108a5565b60039150505b919050565b60408051808201909152601181527019173b30bab63a16b6b4b3b930ba34b7b760791b602082015290565b603a5481565b6001600160a01b038381166000908152603c602052604081205490911633146109165760405162461bcd60e51b81526004016107329061244a565b6109218484846115a3565b949350505050565b336000818152603c60205260409020546001600160a01b03908116919083161480159061095f57506001600160a01b0382163014155b801561097357506001600160a01b03821615155b80156109915750806001600160a01b0316826001600160a01b031614155b6109ad5760405162461bcd60e51b8152600401610732906122bb565b6001600160a01b038116156109f3576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000908152603f6020526040902054610a6361157a565b11610a805760405162461bcd60e51b815260040161073290612216565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054610ace9183906118f1565b336000818152603b6020526040908190209290925590516391fe357360e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316916391fe357391610b2f91908590600401611ecc565b600060405180830381600087803b158015610b4957600080fd5b505af1158015610b5d573d6000803e3d6000fd5b5050505050565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610baa5760405162461bcd60e51b815260040161073290612284565b6033548110610bcb5760405162461bcd60e51b8152600401610732906121d2565b603a55565b333014610bef5760405162461bcd60e51b815260040161073290612284565b603755565b336000908152603c60205260409020546001600160a01b031680610c2a5760405162461bcd60e51b815260040161073290612400565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b333014610c9a5760405162461bcd60e51b815260040161073290612284565b603455565b603b6020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b610d0c338261191d565b50565b60005b8351811015610da057336001600160a01b0316603c6000868481518110610d3557fe5b6020908102919091018101516001600160a01b03908116835290820192909252604001600020541614610d7a5760405162461bcd60e51b81526004016107329061244a565b610d98848281518110610d8957fe5b60200260200101518484611349565b600101610d12565b50336000908152603b602052604090205415610dc157610dc1338383611349565b505050565b333014610de55760405162461bcd60e51b815260040161073290612284565b603955565b600054610100900460ff1680610e035750610e03611a22565b80610e11575060005460ff16155b610e2d5760405162461bcd60e51b81526004016107329061236c565b600054610100900460ff16158015610e58576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff199094169390931716919091179055611018611a28565b801561074b576000805461ff00191690555050565b60395481565b60375481565b60006110463384846115a3565b90505b92915050565b603d546000190190565b611061611aee565b603d838154811061106e57fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b3330146110ea5760405162461bcd60e51b815260040161073290612284565b603355565b33301461110e5760405162461bcd60e51b815260040161073290612284565b603855565b3330146111325760405162461bcd60e51b815260040161073290612284565b603655565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf9061117390899030908a908a908a908a908a90600401611f4f565b600060405180830381600087803b15801561118d57600080fd5b505af11580156111a1573d6000803e3d6000fd5b505050506111af868661191d565b505050505050565b60046111c282610767565b60068111156111cd57fe5b146111ea5760405162461bcd60e51b815260040161073290612031565b6000603d82815481106111f957fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b031661123481611a69565b6112505760405162461bcd60e51b815260040161073290611fee565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b0385169161129491611e9c565b600060405180830381855af49150503d80600081146112cf576040519150601f19603f3d011682016040523d82523d6000602084013e6112d4565b606091505b509150915081611317578051156112ff578060405162461bcd60e51b81526004016107329190611fdb565b60405162461bcd60e51b815260040161073290612481565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b600161135483610767565b600681111561135f57fe5b1461137c5760405162461bcd60e51b8152600401610732906120f7565b6000603d838154811061138b57fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b9094529190942054929450101590806113ea5760405162461bcd60e51b8152600401610732906122f2565b825460ff1615611439578254610100900460ff1615611420576001830154600485015461141691611a6f565b6004850155611439565b6001830154600585015461143391611a6f565b60058501555b841561145857600484015461144e908261157e565b600485015561146d565b6005840154611467908261157e565b60058501555b6006840154610100900460ff1615801561149d575060395461149b61149061157a565b600387015490611a6f565b105b156114e15760058401546004850154111582151581146114df5760068501805461ff001916610100179055603a5460038601546114d99161157e565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a54600387015461152c938b9361152793919261085a9283919061157e565b611ab1565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b58460405161156991906124dd565b60405180910390a450505050505050565b4290565b6000828201838110156110465760405162461bcd60e51b81526004016107329061219b565b6001600160a01b0383166000908152603b60205260408120546036548110156115de5760405162461bcd60e51b81526004016107329061213e565b6115e784611a69565b6116035760405162461bcd60e51b815260040161073290612329565b6001600160a01b0385166000908152603e6020526040902054801561167557600061162d82610767565b9050600181600681111561163d57fe5b141580156116575750600081600681111561165457fe5b14155b6116735760405162461bcd60e51b81526004016107329061207c565b505b600061168560375461085a61157a565b9050600061169e6038548361157e90919063ffffffff16565b90506116a8611b0e565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff1990931692909217949094161790559061185a61104f565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a5492935061189c928d9261152792909161085a919082908a9061157e565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d6040516118dc9493929190611f90565b60405180910390a39998505050505050505050565b600081848411156119155760405162461bcd60e51b81526004016107329190611fdb565b505050900390565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd906119719085907f0000000000000000000000000000000000000000000000000000000000000000908690600401611ee5565b602060405180830381600087803b15801561198b57600080fd5b505af115801561199f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c39190611de1565b6119df5760405162461bcd60e51b81526004016107329061224d565b6001600160a01b0382166000908152603b6020526040902054611a02908261157e565b6001600160a01b039092166000908152603b602052604090209190915550565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b3b151590565b600061104683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506118f1565b6001600160a01b0382166000908152603f602052604090205481111561074b576001600160a01b03919091166000908152603f6020526040902055565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b038116811461104957600080fd5b803561104981612552565b600082601f830112611b9b578081fd5b813567ffffffffffffffff811115611bb1578182fd5b611bc4601f8201601f19166020016124e6565b9150808252836020828501011115611bdb57600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215611c05578081fd5b6110468383611b69565b600080600060608486031215611c23578182fd5b8335611c2e8161253d565b92506020840135611c3e8161253d565b9150604084013567ffffffffffffffff811115611c59578182fd5b611c6586828701611b8b565b9150509250925092565b60008060408385031215611c81578182fd5b8235611c8c8161253d565b9150602083013567ffffffffffffffff811115611ca7578182fd5b611cb385828601611b8b565b9150509250929050565b60008060008060008060c08789031215611cd5578182fd5b611cdf8888611b69565b95506020870135945060408701359350606087013560ff81168114611d02578283fd5b9598949750929560808101359460a0909101359350915050565b600080600060608486031215611d30578283fd5b833567ffffffffffffffff80821115611d47578485fd5b818601915086601f830112611d5a578485fd5b813581811115611d68578586fd5b60209150818102611d7a8382016124e6565b8281528381019085850183870186018c1015611d9457898afd5b8996505b84871015611dbe57611daa8c82611b69565b835260019690960195918501918501611d98565b5097505050508501359250611dd890508560408601611b80565b90509250925092565b600060208284031215611df2578081fd5b815161104681612552565b600060208284031215611e0e578081fd5b5035919050565b60008060408385031215611e27578182fd5b82359150611e388460208501611b69565b90509250929050565b60008060408385031215611e53578182fd5b823591506020830135611e6581612552565b809150509250929050565b60008151808452611e8881602086016020860161250d565b601f01601f19169290920160200192915050565b60008251611eae81846020870161250d565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b038616825284602083015283604083015260806060830152611fbd6080830184611e70565b9695505050505050565b6020810160078310611fd557fe5b91905290565b6000602082526110466020830184611e70565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b90815260200190565b60405181810167ffffffffffffffff8111828210171561250557600080fd5b604052919050565b60005b83811015612528578181015183820152602001612510565b83811115612537576000848401525b50505050565b6001600160a01b0381168114610d0c57600080fd5b8015158114610d0c57600080fdfea26469706673582212204b0042571b6576e17c0708c8f251958898bb0e0a9f340387b1eed439d732af7264736f6c634300060c0033";class Ls extends Ya{constructor(...e){e.length>1?super(...e):super(Vs,Fs,e[0])}getDeployTransaction(e,t){return super.getDeployTransaction(e,t||{})}deploy(e,t){return super.deploy(e,t||{})}connect(e){return super.connect(e)}static bytecode=Fs;static abi=Vs;static createInterface(){return new ba(Vs)}static connect(e,t){return new Wa(e,Vs,t)}}var Gs=Object.freeze({__proto__:null,GovernanceGasUpgrade__factory:Us,GovernanceVaultUpgrade__factory:Ls,gasCompensatorSol:As,interfaces:Ss});const Bs=[{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amountLockedBeforehand",type:"uint256"}],name:"updateRewardsOnLockedBalanceChange",outputs:[],stateMutability:"nonpayable",type:"function"}];class js{static abi=Bs;static createInterface(){return new ba(Bs)}static connect(e,t){return new Wa(e,Bs,t)}}var Hs=Object.freeze({__proto__:null,ITornadoStakingRewards__factory:js});const zs=[{inputs:[{internalType:"address",name:"stakingRewardsAddress",type:"address"},{internalType:"address",name:"gasCompLogic",type:"address"},{internalType:"address",name:"userVaultAddress",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"}],name:"Delegated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"proposer",type:"address"},{indexed:!1,internalType:"address",name:"target",type:"address"},{indexed:!1,internalType:"uint256",name:"startTime",type:"uint256"},{indexed:!1,internalType:"uint256",name:"endTime",type:"uint256"},{indexed:!1,internalType:"string",name:"description",type:"string"}],name:"ProposalCreated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"proposalId",type:"uint256"}],name:"ProposalExecuted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"bytes",name:"errorData",type:"bytes"}],name:"RewardUpdateFailed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"}],name:"RewardUpdateSuccessful",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"}],name:"Undelegated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"proposalId",type:"uint256"},{indexed:!0,internalType:"address",name:"voter",type:"address"},{indexed:!0,internalType:"bool",name:"support",type:"bool"},{indexed:!1,internalType:"uint256",name:"votes",type:"uint256"}],name:"Voted",type:"event"},{inputs:[],name:"CLOSING_PERIOD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"EXECUTION_DELAY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"EXECUTION_EXPIRATION",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"PROPOSAL_THRESHOLD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"QUORUM_VOTES",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"Staking",outputs:[{internalType:"contract ITornadoStakingRewards",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTE_EXTEND_TIME",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTING_DELAY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTING_PERIOD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"canWithdrawAfter",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address[]",name:"from",type:"address[]"},{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"bool",name:"support",type:"bool"}],name:"castDelegatedVote",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"bool",name:"support",type:"bool"}],name:"castVote",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"}],name:"checkIfQuorumReached",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"delegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"delegatedTo",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"}],name:"execute",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"gasCompensationVault",outputs:[{internalType:"contract IGasCompensationVault",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"address",name:"voter",type:"address"}],name:"getReceipt",outputs:[{components:[{internalType:"bool",name:"hasVoted",type:"bool"},{internalType:"bool",name:"support",type:"bool"},{internalType:"uint256",name:"votes",type:"uint256"}],internalType:"struct Governance.Receipt",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"address",name:"account",type:"address"}],name:"hasAccountVoted",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_torn",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"latestProposalIds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"lock",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"lockWithApproval",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"lockedBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"proposalCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"proposals",outputs:[{internalType:"address",name:"proposer",type:"address"},{internalType:"address",name:"target",type:"address"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"uint256",name:"forVotes",type:"uint256"},{internalType:"uint256",name:"againstVotes",type:"uint256"},{internalType:"bool",name:"executed",type:"bool"},{internalType:"bool",name:"extended",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"target",type:"address"},{internalType:"string",name:"description",type:"string"}],name:"propose",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"target",type:"address"},{internalType:"string",name:"description",type:"string"}],name:"proposeByDelegate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"returnMultisigAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"closingPeriod",type:"uint256"}],name:"setClosingPeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"executionDelay",type:"uint256"}],name:"setExecutionDelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"executionExpiration",type:"uint256"}],name:"setExecutionExpiration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"gasCompensationsLimit",type:"uint256"}],name:"setGasCompensations",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalThreshold",type:"uint256"}],name:"setProposalThreshold",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"quorumVotes",type:"uint256"}],name:"setQuorumVotes",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"voteExtendTime",type:"uint256"}],name:"setVoteExtendTime",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"votingDelay",type:"uint256"}],name:"setVotingDelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"votingPeriod",type:"uint256"}],name:"setVotingPeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"}],name:"state",outputs:[{internalType:"enum Governance.ProposalState",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"torn",outputs:[{internalType:"contract TORN",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"undelegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"unlock",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"userVault",outputs:[{internalType:"contract ITornadoVault",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"version",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawFromHelper",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],Ws="0x60e06040523480156200001157600080fd5b50604051620032a6380380620032a6833981016040819052620000349162000165565b81818181600060019054906101000a900460ff1680620000595750620000596200011e565b8062000068575060005460ff16155b620000905760405162461bcd60e51b81526004016200008790620001b8565b60405180910390fd5b600054610100900460ff16158015620000bc576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000da62000124565b8015620000ed576000805461ff00191690555b506001600160601b0319606091821b811660805291811b821660a0529590951b90941660c052506200021f92505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6000806000606084860312156200017a578283fd5b8351620001878162000206565b60208501519093506200019a8162000206565b6040850151909250620001ad8162000206565b809150509250925092565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6001600160a01b03811681146200021c57600080fd5b50565b60805160601c60a05160601c60c05160601c6130246200028260003980610cf652806110b7528061169852806117c95250806108e55280610ead5280610fa552806116145280612164525080611040528061200d528061240e52506130246000f3fe6080604052600436106102765760003560e01c80639ae697bf1161014f578063d6159fe5116100c1578063ea0217cf1161007a578063ea0217cf1461072a578063ece40cc11461074a578063ef3f8bb11461076a578063f0b768921461078a578063f57df22e146107aa578063fe0d94c1146107bf5761027d565b8063d6159fe514610673578063d6f0948c14610688578063da35c664146106a8578063e23a9a52146106bd578063e4917d9f146106ea578063e525aa081461070a5761027d565b8063b1610d7e11610113578063b1610d7e146105c9578063b54426c8146105de578063b859f11b146105fe578063c0c0e8201461061e578063c4d66de81461063e578063ce25d71c1461065e5761027d565b80639ae697bf1461054a5780639daafec71461056a578063a6c266031461057f578063a72edda314610594578063adf898a4146105b45761027d565b80635c19a95c116101e85780636dc2dc6c116101ac5780636dc2dc6c146104a057806370b0f660146104c05780638b34a960146104e057806392ab89bb146104f5578063932d51571461050a5780639a9e3b6e1461052a5761027d565b80635c19a95c146104165780636198e3391461043657806365da126414610456578063671dd275146104765780636a6617551461048b5761027d565b806332687ec11161023a57806332687ec11461035057806337f135d71461037d5780633e4f49e61461039257806354fd4d50146103bf578063587a6ecb146103e157806358e9fff0146103f65761027d565b8063013cf08b1461028257806302ec8f9e146102bf57806315373e3d146102e157806317977c611461030157806324b0435f1461032e5761027d565b3661027d57005b600080fd5b34801561028e57600080fd5b506102a261029d3660046127f8565b6107d2565b6040516102b6989796959493929190612904565b60405180910390f35b3480156102cb57600080fd5b506102df6102da3660046127f8565b610837565b005b3480156102ed57600080fd5b506102df6102fc36600461283c565b610864565b34801561030d57600080fd5b5061032161031c3660046125ef565b610967565b6040516102b69190612f6b565b34801561033a57600080fd5b50610343610979565b6040516102b691906128b3565b34801561035c57600080fd5b5061037061036b3660046127f8565b610991565b6040516102b691906129c2565b34801561038957600080fd5b506103216109df565b34801561039e57600080fd5b506103b26103ad3660046127f8565b6109e5565b6040516102b691906129cd565b3480156103cb57600080fd5b506103d4610b21565b6040516102b691906129e1565b3480156103ed57600080fd5b50610321610b58565b34801561040257600080fd5b5061032161041136600461260a565b610b5e565b34801561042257600080fd5b506102df6104313660046125ef565b610bac565b34801561044257600080fd5b506102df6104513660046127f8565b610cce565b34801561046257600080fd5b506103436104713660046125ef565b610e1b565b34801561048257600080fd5b50610321610e36565b34801561049757600080fd5b50610321610e3c565b3480156104ac57600080fd5b506102df6104bb3660046127f8565b610e42565b3480156104cc57600080fd5b506102df6104db3660046127f8565b610e87565b3480156104ec57600080fd5b50610343610eab565b34801561050157600080fd5b506102df610ecf565b34801561051657600080fd5b506102df6105253660046127f8565b610f56565b34801561053657600080fd5b506102df6105453660046127f8565b611008565b34801561055657600080fd5b506103216105653660046125ef565b61102c565b34801561057657600080fd5b5061034361103e565b34801561058b57600080fd5b50610321611062565b3480156105a057600080fd5b506103216105af3660046125ef565b611068565b3480156105c057600080fd5b5061034361107a565b3480156105d557600080fd5b50610321611089565b3480156105ea57600080fd5b506102df6105f93660046127f8565b61108f565b34801561060a57600080fd5b506102df610619366004612717565b6111d8565b34801561062a57600080fd5b506102df6106393660046127f8565b611226565b34801561064a57600080fd5b506102df6106593660046125ef565b61124a565b34801561066a57600080fd5b5061032161148d565b34801561067f57600080fd5b50610321611493565b34801561069457600080fd5b506103216106a336600461266a565b611499565b3480156106b457600080fd5b506103216114af565b3480156106c957600080fd5b506106dd6106d8366004612810565b6114b9565b6040516102b69190612f46565b3480156106f657600080fd5b506102df6107053660046127f8565b61152b565b34801561071657600080fd5b50610370610725366004612810565b61154f565b34801561073657600080fd5b506102df6107453660046127f8565b611592565b34801561075657600080fd5b506102df6107653660046127f8565b6115b6565b34801561077657600080fd5b506102df6107853660046127f8565b6115da565b34801561079657600080fd5b506102df6107a53660046126b8565b61166c565b3480156107b657600080fd5b506103436117c7565b6102df6107cd3660046127f8565b6117eb565b603d81815481106107df57fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b33301461085f5760405162461bcd60e51b815260040161085690612cb4565b60405180910390fd5b603555565b3361086f833361154f565b158015610882575061088083610991565b155b333214610890576000610894565b6152085b61ffff1681156109555760005a90506108ae33878761197d565b60006108cb6127106108c5856108c55a8790611bae565b90611bf0565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce8079061091c90889085906004016128c7565b600060405180830381600087803b15801561093657600080fd5b505af115801561094a573d6000803e3d6000fd5b505050505050610960565b61096033868661197d565b5050505050565b603e6020526000908152604090205481565b73b04e030140b30c27bcdfaafffa98c57d80eda7b490565b6000603554603d83815481106109a357fe5b906000526020600020906008020160050154603d84815481106109c257fe5b90600052602060002090600802016004015401101590505b919050565b60335481565b60006109ef6114af565b82111580156109fe5750600082115b610a1a5760405162461bcd60e51b815260040161085690612e11565b6000603d8381548110610a2957fe5b906000526020600020906008020190508060020154610a46611c15565b11610a555760009150506109da565b8060030154610a62611c15565b11610a715760019150506109da565b80600501548160040154111580610a9357506035548160050154826004015401105b15610aa25760029150506109da565b600681015460ff1615610ab95760059150506109da565b610ad86034546108c56033548460030154611bf090919063ffffffff16565b610ae0611c15565b10610aef5760069150506109da565b6033546003820154610b0091611bf0565b610b08611c15565b10610b175760049150506109da565b60039150506109da565b60408051808201909152601981527f322e6c6f74746572792d616e642d6761732d7570677261646500000000000000602082015290565b603a5481565b6001600160a01b038381166000908152603c60205260408120549091163314610b995760405162461bcd60e51b815260040161085690612ea1565b610ba4848484611c19565b949350505050565b336000818152603c60205260409020546001600160a01b039081169190831614801590610be257506001600160a01b0382163014155b8015610bf657506001600160a01b03821615155b8015610c145750806001600160a01b0316826001600160a01b031614155b610c305760405162461bcd60e51b815260040161085690612ceb565b6001600160a01b03811615610c76576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f91610d2b9185916004016128c7565b600060405180830381600087803b158015610d4557600080fd5b505af1925050508015610d56575060015b610dd9573d808015610d84576040519150601f19603f3d011682016040523d82523d6000602084013e610d89565b606091505b5080604051610d989190612897565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a350610e0e565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e1782611f67565b5050565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610e615760405162461bcd60e51b815260040161085690612cb4565b6033548110610e825760405162461bcd60e51b815260040161085690612bd8565b603a55565b333014610ea65760405162461bcd60e51b815260040161085690612cb4565b603755565b7f000000000000000000000000000000000000000000000000000000000000000081565b336000908152603c60205260409020546001600160a01b031680610f055760405162461bcd60e51b815260040161085690612e57565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b610f5e610979565b6001600160a01b0316336001600160a01b031614610f8e5760405162461bcd60e51b815260040161085690612dea565b604051633a08bde160e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e822f78490610fda908490600401612f6b565b600060405180830381600087803b158015610ff457600080fd5b505af1158015610960573d6000803e3d6000fd5b3330146110275760405162461bcd60e51b815260040161085690612cb4565b603455565b603b6020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916110ec9185916004016128c7565b600060405180830381600087803b15801561110657600080fd5b505af1925050508015611117575060015b61119a573d808015611145576040519150601f19603f3d011682016040523d82523d6000602084013e61114a565b606091505b50806040516111599190612897565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506111cf565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e178261204b565b60008351116111f95760405162461bcd60e51b815260040161085690612c8a565b611221838383611209863361154f565b15801561121c575061121a86610991565b155b612055565b505050565b3330146112455760405162461bcd60e51b815260040161085690612cb4565b603955565b600054610100900460ff16806112635750611263612298565b80611271575060005460ff16155b61128d5760405162461bcd60e51b815260040161085690612d9c565b600054610100900460ff161580156112b8576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff19909416939093171691909117905561147861229e565b8015610e17576000805461ff00191690555050565b60395481565b60375481565b60006114a6338484611c19565b90505b92915050565b603d546000190190565b6114c16124e9565b603d83815481106114ce57fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b33301461154a5760405162461bcd60e51b815260040161085690612cb4565b603355565b6000603d838154811061155e57fe5b600091825260208083206001600160a01b03861684526007600890930201919091019052604090205460ff16905092915050565b3330146115b15760405162461bcd60e51b815260040161085690612cb4565b603855565b3330146115d55760405162461bcd60e51b815260040161085690612cb4565b603655565b6115e2610979565b6001600160a01b0316336001600160a01b0316146116125760405162461bcd60e51b815260040161085690612dea565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166108fc61164983476122df565b6040518115909202916000818181858888f1935050505061166957600080fd5b50565b6001600160a01b038087166000908152603b60205260409081902054905163e113335f60e01b815288927f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916116cd9185916004016128c7565b600060405180830381600087803b1580156116e757600080fd5b505af19250505080156116f8575060015b61177b573d808015611726576040519150601f19603f3d011682016040523d82523d6000602084013e61172b565b606091505b508060405161173a9190612897565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506117b0565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b6117be8787878787876122f5565b50505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60046117f6826109e5565b600681111561180157fe5b1461181e5760405162461bcd60e51b815260040161085690612a37565b6000603d828154811061182d57fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b031661186881612375565b6118845760405162461bcd60e51b8152600401610856906129f4565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b038516916118c891612897565b600060405180830381855af49150503d8060008114611903576040519150601f19603f3d011682016040523d82523d6000602084013e611908565b606091505b50915091508161194b57805115611933578060405162461bcd60e51b815260040161085691906129e1565b60405162461bcd60e51b815260040161085690612ed8565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b6001611988836109e5565b600681111561199357fe5b146119b05760405162461bcd60e51b815260040161085690612afd565b6000603d83815481106119bf57fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b909452919094205492945010159080611a1e5760405162461bcd60e51b815260040161085690612d22565b825460ff1615611a6d578254610100900460ff1615611a545760018301546004850154611a4a91611bae565b6004850155611a6d565b60018301546005850154611a6791611bae565b60058501555b8415611a8c576004840154611a829082611bf0565b6004850155611aa1565b6005840154611a9b9082611bf0565b60058501555b6006840154610100900460ff16158015611ad15750603954611acf611ac4611c15565b600387015490611bae565b105b15611b15576005840154600485015411158215158114611b135760068501805461ff001916610100179055603a546003860154611b0d91611bf0565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a546003870154611b60938b93611b5b9391926108c592839190611bf0565b61237b565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b584604051611b9d9190612f6b565b60405180910390a450505050505050565b60006114a683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506123b8565b6000828201838110156114a65760405162461bcd60e51b815260040161085690612ba1565b4290565b6001600160a01b0383166000908152603b6020526040812054603654811015611c545760405162461bcd60e51b815260040161085690612b44565b611c5d84612375565b611c795760405162461bcd60e51b815260040161085690612d59565b6001600160a01b0385166000908152603e60205260409020548015611ceb576000611ca3826109e5565b90506001816006811115611cb357fe5b14158015611ccd57506000816006811115611cca57fe5b14155b611ce95760405162461bcd60e51b815260040161085690612a82565b505b6000611cfb6037546108c5611c15565b90506000611d1460385483611bf090919063ffffffff16565b9050611d1e612509565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff19909316929092179490941617905590611ed06114af565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a54929350611f12928d92611b5b9290916108c5919082908a90611bf0565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d604051611f52949392919061298b565b60405180910390a39998505050505050505050565b336000908152603f6020526040902054611f7f611c15565b11611f9c5760405162461bcd60e51b815260040161085690612c1c565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054611fea9183906123b8565b336000818152603b6020526040908190209290925590516391fe357360e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316916391fe357391610fda919085906004016128c7565b61166933826123e4565b3381328214612065576000612069565b6152085b61ffff1681156121d45760005a905060005b885181101561213257600089828151811061209257fe5b6020908102919091018101516001600160a01b038082166000908152603c909352604090922054909250163314806120d257506001600160a01b03811633145b6120ee5760405162461bcd60e51b815260040161085690612ea1565b8615806121025750612100898261154f565b155b61211e5760405162461bcd60e51b815260040161085690612f0f565b612129818a8a61197d565b5060010161207b565b50600061214a6127106108c5856108c55a8790611bae565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce8079061219b90889085906004016128c7565b600060405180830381600087803b1580156121b557600080fd5b505af11580156121c9573d6000803e3d6000fd5b5050505050506117be565b60005b875181101561228e5760008882815181106121ee57fe5b6020908102919091018101516001600160a01b038082166000908152603c9093526040909220549092501633148061222e57506001600160a01b03811633145b61224a5760405162461bcd60e51b815260040161085690612ea1565b85158061225e575061225c888261154f565b155b61227a5760405162461bcd60e51b815260040161085690612f0f565b61228581898961197d565b506001016121d7565b5050505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b60008183106122ee57816114a6565b5090919050565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf9061233190899030908a908a908a908a908a9060040161294a565b600060405180830381600087803b15801561234b57600080fd5b505af115801561235f573d6000803e3d6000fd5b5050505061236d86866123e4565b505050505050565b3b151590565b6001600160a01b0382166000908152603f6020526040902054811115610e17576001600160a01b03919091166000908152603f6020526040902055565b600081848411156123dc5760405162461bcd60e51b815260040161085691906129e1565b505050900390565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd906124389085907f00000000000000000000000000000000000000000000000000000000000000009086906004016128e0565b602060405180830381600087803b15801561245257600080fd5b505af1158015612466573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061248a91906127dc565b6124a65760405162461bcd60e51b815260040161085690612c53565b6001600160a01b0382166000908152603b60205260409020546124c99082611bf0565b6001600160a01b039092166000908152603b602052604090209190915550565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b03811681146114a957600080fd5b80356114a981612fe0565b600082601f830112612596578081fd5b813567ffffffffffffffff8111156125ac578182fd5b6125bf601f8201601f1916602001612f74565b91508082528360208285010111156125d657600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215612600578081fd5b6114a68383612564565b60008060006060848603121561261e578182fd5b833561262981612fcb565b9250602084013561263981612fcb565b9150604084013567ffffffffffffffff811115612654578182fd5b61266086828701612586565b9150509250925092565b6000806040838503121561267c578182fd5b823561268781612fcb565b9150602083013567ffffffffffffffff8111156126a2578182fd5b6126ae85828601612586565b9150509250929050565b60008060008060008060c087890312156126d0578182fd5b6126da8888612564565b95506020870135945060408701359350606087013560ff811681146126fd578283fd5b9598949750929560808101359460a0909101359350915050565b60008060006060848603121561272b578283fd5b833567ffffffffffffffff80821115612742578485fd5b818601915086601f830112612755578485fd5b813581811115612763578586fd5b60209150818102612775838201612f74565b8281528381019085850183870186018c101561278f57898afd5b8996505b848710156127b9576127a58c82612564565b835260019690960195918501918501612793565b50975050505085013592506127d39050856040860161257b565b90509250925092565b6000602082840312156127ed578081fd5b81516114a681612fe0565b600060208284031215612809578081fd5b5035919050565b60008060408385031215612822578182fd5b823591506128338460208501612564565b90509250929050565b6000806040838503121561284e578182fd5b82359150602083013561286081612fe0565b809150509250929050565b60008151808452612883816020860160208601612f9b565b601f01601f19169290920160200192915050565b600082516128a9818460208701612f9b565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b0386168252846020830152836040830152608060608301526129b8608083018461286b565b9695505050505050565b901515815260200190565b60208101600783106129db57fe5b91905290565b6000602082526114a6602083018461286b565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526010908201526f43616e206e6f7420626520656d70747960801b604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252600d908201526c6f6e6c79206d756c746973696760981b604082015260600190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b60208082526019908201527f476f7665726e616e63653a20766f74656420616c726561647900000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b90815260200190565b60405181810167ffffffffffffffff81118282101715612f9357600080fd5b604052919050565b60005b83811015612fb6578181015183820152602001612f9e565b83811115612fc5576000848401525b50505050565b6001600160a01b038116811461166957600080fd5b801515811461166957600080fdfea2646970667358221220e1f35bea256ff1c0e43f98312094903f31941303df43a2edbe8b9bd0fa323c8864736f6c634300060c0033";class $s extends Ya{constructor(...e){e.length>1?super(...e):super(zs,Ws,e[0])}getDeployTransaction(e,t,a,n){return super.getDeployTransaction(e,t,a,n||{})}deploy(e,t,a,n){return super.deploy(e,t,a,n||{})}connect(e){return super.connect(e)}static bytecode=Ws;static abi=zs;static createInterface(){return new ba(zs)}static connect(e,t){return new Wa(e,zs,t)}}var Xs=Object.freeze({__proto__:null,GovernanceStakingUpgrade__factory:$s,interfaces:Hs});const qs=[{inputs:[{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"address",name:"implementationContract",type:"address"},{internalType:"bytes",name:"metamorphicContractInitializationCalldata",type:"bytes"}],name:"deployMetamorphicContractFromExistingImplementation",outputs:[{internalType:"address",name:"metamorphicContractAddress",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"salt",type:"bytes32"}],name:"findMetamorphicContractAddress",outputs:[{internalType:"address",name:"metamorphicContractAddress",type:"address"}],stateMutability:"view",type:"function"}];class Js{static abi=qs;static createInterface(){return new ba(qs)}static connect(e,t){return new Wa(e,qs,t)}}var Ys=Object.freeze({__proto__:null,IMetamorphicContractFactory__factory:Js});const Ks=[{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"num",type:"uint256"}],name:"MockExecuted",type:"event"},{inputs:[],name:"emergencyStop",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"executeProposal",outputs:[],stateMutability:"nonpayable",type:"function"}],Zs="0x608060405234801561001057600080fd5b5060c08061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c8063373058b814603757806363a599a414603f575b600080fd5b603d6045565b005b603d607d565b7f2ff532ec74fd1130db9b7b6800e0992b2363095b00331a891a27edfab97c45406001604051607391906081565b60405180910390a1565b6000ff5b9081526020019056fea264697066735822122018779fa63005d6573862657b4a5cd55f75b705b28a7ff69222461665b78f408a64736f6c634300060c0033";class Qs extends Ya{constructor(...e){e.length>1?super(...e):super(Ks,Zs,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=Zs;static abi=Ks;static createInterface(){return new ba(Ks)}static connect(e,t){return new Wa(e,Ks,t)}}const er=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"num",type:"uint256"}],name:"MockExecuted",type:"event"},{inputs:[],name:"deployer",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"emergencyStop",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"executeProposal",outputs:[],stateMutability:"nonpayable",type:"function"}],tr="0x60a060405234801561001057600080fd5b5033606081901b6080526102746100366000398061012952806101b052506102746000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063373058b81461004657806363a599a414610050578063d5f3948814610058575b600080fd5b61004e610076565b005b61004e6101aa565b6100606101ae565b60405161006d9190610211565b60405180910390f35b6040516370a0823160e01b81527377777feddddffc19ff86db637967013e6c6a116c9060009082906370a08231906100b2903090600401610211565b60206040518083038186803b1580156100ca57600080fd5b505afa1580156100de573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010291906101f9565b60405163a9059cbb60e01b81529091506001600160a01b0383169063a9059cbb90610153907f0000000000000000000000000000000000000000000000000000000000000000908590600401610225565b602060405180830381600087803b15801561016d57600080fd5b505af1158015610181573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a591906101d2565b505050565b6000ff5b7f000000000000000000000000000000000000000000000000000000000000000081565b6000602082840312156101e3578081fd5b815180151581146101f2578182fd5b9392505050565b60006020828403121561020a578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b0392909216825260208201526040019056fea2646970667358221220c120adf2a3856eb39e4d2305abf19175fb5f11d87cd96e5c70ce2a9f702ba53664736f6c634300060c0033";class ar extends Ya{constructor(...e){e.length>1?super(...e):super(er,tr,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=tr;static abi=er;static createInterface(){return new ba(er)}static connect(e,t){return new Wa(e,er,t)}}var nr=Object.freeze({__proto__:null,InitialProposal__factory:Qs,MaliciousProposal__factory:ar}),br=Object.freeze({__proto__:null,mockProposalsSol:nr});const fr=[{inputs:[{internalType:"address",name:"_logic",type:"address"},{internalType:"address",name:"_admin",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"}],stateMutability:"payable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"previousAdmin",type:"address"},{indexed:!1,internalType:"address",name:"newAdmin",type:"address"}],name:"AdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{stateMutability:"payable",type:"fallback"},{inputs:[],name:"admin",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newAdmin",type:"address"}],name:"changeAdmin",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"implementation",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{stateMutability:"payable",type:"receive"}],dr="0x60806040526040516108403803806108408339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508390508282816100f1826101c5565b8051156101a9576000826001600160a01b0316826040518082805190602001908083835b602083106101345780518252601f199092019160209182019101610115565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610194576040519150601f19603f3d011682016040523d82523d6000602084013e610199565b606091505b50509050806101a757600080fd5b505b506101b19050565b6101ba82610237565b505050505050610261565b6101d88161025b60201b6103b41760201c565b6102135760405162461bcd60e51b815260040180806020018281038252603681526020018061080a6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3b151590565b61059a806102706000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996101a9565b6101a96101a46103ba565b6103df565b565b6101b3610403565b6001600160a01b0316336001600160a01b031614156101da576101d581610428565b6101e2565b6101e2610191565b50565b6101ed610403565b6001600160a01b0316336001600160a01b031614156102855761020f83610428565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610403565b6001600160a01b0316336001600160a01b031614156102c4576102bd6103ba565b90506102cc565b6102cc610191565b90565b6102d7610403565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b815260040180806020018281038252603a8152602001806104f5603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610403565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d581610468565b6000610393610403565b6001600160a01b0316336001600160a01b031614156102c4576102bd610403565b3b151590565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156103fe573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6104318161048c565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610495816103b4565b6104d05760405162461bcd60e51b815260040180806020018281038252603681526020018061052f6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374a26469706673582212203c0c6456361fbff816ff53c5547d39ad0e807130f877d2661772f7bffc95b82764736f6c634300060c00335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374",ir=[{inputs:[{internalType:"address",name:"stakingRewardsAddress",type:"address"},{internalType:"address",name:"gasCompLogic",type:"address"},{internalType:"address",name:"userVaultAddress",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"}],name:"Delegated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"proposer",type:"address"},{indexed:!1,internalType:"address",name:"target",type:"address"},{indexed:!1,internalType:"uint256",name:"startTime",type:"uint256"},{indexed:!1,internalType:"uint256",name:"endTime",type:"uint256"},{indexed:!1,internalType:"string",name:"description",type:"string"}],name:"ProposalCreated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"proposalId",type:"uint256"}],name:"ProposalExecuted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"bytes",name:"errorData",type:"bytes"}],name:"RewardUpdateFailed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"}],name:"RewardUpdateSuccessful",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"}],name:"Undelegated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"proposalId",type:"uint256"},{indexed:!0,internalType:"address",name:"voter",type:"address"},{indexed:!0,internalType:"bool",name:"support",type:"bool"},{indexed:!1,internalType:"uint256",name:"votes",type:"uint256"}],name:"Voted",type:"event"},{inputs:[],name:"CLOSING_PERIOD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"EXECUTION_DELAY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"EXECUTION_EXPIRATION",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"PROPOSAL_THRESHOLD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"QUORUM_VOTES",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"Staking",outputs:[{internalType:"contract ITornadoStakingRewards",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTE_EXTEND_TIME",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTING_DELAY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTING_PERIOD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"canWithdrawAfter",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address[]",name:"from",type:"address[]"},{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"bool",name:"support",type:"bool"}],name:"castDelegatedVote",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"bool",name:"support",type:"bool"}],name:"castVote",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"}],name:"checkIfQuorumReached",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"delegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"delegatedTo",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"}],name:"execute",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"gasCompensationVault",outputs:[{internalType:"contract IGasCompensationVault",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"address",name:"voter",type:"address"}],name:"getReceipt",outputs:[{components:[{internalType:"bool",name:"hasVoted",type:"bool"},{internalType:"bool",name:"support",type:"bool"},{internalType:"uint256",name:"votes",type:"uint256"}],internalType:"struct Governance.Receipt",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"address",name:"account",type:"address"}],name:"hasAccountVoted",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_torn",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"latestProposalIds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"lock",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"lockWithApproval",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"lockedBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"proposalCodehashes",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"proposalCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"proposals",outputs:[{internalType:"address",name:"proposer",type:"address"},{internalType:"address",name:"target",type:"address"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"uint256",name:"forVotes",type:"uint256"},{internalType:"uint256",name:"againstVotes",type:"uint256"},{internalType:"bool",name:"executed",type:"bool"},{internalType:"bool",name:"extended",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"target",type:"address"},{internalType:"string",name:"description",type:"string"}],name:"propose",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"target",type:"address"},{internalType:"string",name:"description",type:"string"}],name:"proposeByDelegate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"returnMultisigAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"closingPeriod",type:"uint256"}],name:"setClosingPeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"executionDelay",type:"uint256"}],name:"setExecutionDelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"executionExpiration",type:"uint256"}],name:"setExecutionExpiration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"gasCompensationsLimit",type:"uint256"}],name:"setGasCompensations",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalThreshold",type:"uint256"}],name:"setProposalThreshold",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"quorumVotes",type:"uint256"}],name:"setQuorumVotes",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"voteExtendTime",type:"uint256"}],name:"setVoteExtendTime",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"votingDelay",type:"uint256"}],name:"setVotingDelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"votingPeriod",type:"uint256"}],name:"setVotingPeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"}],name:"state",outputs:[{internalType:"enum Governance.ProposalState",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"torn",outputs:[{internalType:"contract TORN",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"undelegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"unlock",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"userVault",outputs:[{internalType:"contract ITornadoVault",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"version",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawFromHelper",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],sr="0x60e06040523480156200001157600080fd5b50604051620034343803806200343483398101604081905262000034916200016b565b82828281818181600060019054906101000a900460ff16806200005c57506200005c62000124565b806200006b575060005460ff16155b620000935760405162461bcd60e51b81526004016200008a90620001be565b60405180910390fd5b600054610100900460ff16158015620000bf576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000dd6200012a565b8015620000f0576000805461ff00191690555b506001600160601b0319606091821b811660805291811b821660a0529590951b90941660c052506200022595505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b60008060006060848603121562000180578283fd5b83516200018d816200020c565b6020850151909350620001a0816200020c565b6040850151909250620001b3816200020c565b809150509250925092565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6001600160a01b03811681146200022257600080fd5b50565b60805160601c60a05160601c60c05160601c6131ac6200028860003980610d1352806110d452806116c752806117f85250806109105280610eca5280610fc252806116435280611d6d52508061105d5280611c1652806124f152506131ac6000f3fe6080604052600436106102815760003560e01c80639daafec71161014f578063d6f0948c116100c1578063ea0217cf1161007a578063ea0217cf14610755578063ece40cc114610775578063ef3f8bb114610795578063f0b76892146107b5578063f57df22e146107d5578063fe0d94c1146107ea57610288565b8063d6f0948c14610693578063da35c664146106b3578063e01f5237146106c8578063e23a9a52146106e8578063e4917d9f14610715578063e525aa081461073557610288565b8063b54426c811610113578063b54426c8146105e9578063b859f11b14610609578063c0c0e82014610629578063c4d66de814610649578063ce25d71c14610669578063d6159fe51461067e57610288565b80639daafec714610575578063a6c266031461058a578063a72edda31461059f578063adf898a4146105bf578063b1610d7e146105d457610288565b80635c19a95c116101f357806370b0f660116101ac57806370b0f660146104cb5780638b34a960146104eb57806392ab89bb14610500578063932d5157146105155780639a9e3b6e146105355780639ae697bf1461055557610288565b80635c19a95c146104215780636198e3391461044157806365da126414610461578063671dd275146104815780636a661755146104965780636dc2dc6c146104ab57610288565b806332687ec11161024557806332687ec11461035b57806337f135d7146103885780633e4f49e61461039d57806354fd4d50146103ca578063587a6ecb146103ec57806358e9fff01461040157610288565b8063013cf08b1461028d57806302ec8f9e146102ca57806315373e3d146102ec57806317977c611461030c57806324b0435f1461033957610288565b3661028857005b600080fd5b34801561029957600080fd5b506102ad6102a83660046128e1565b6107fd565b6040516102c19897969594939291906129ed565b60405180910390f35b3480156102d657600080fd5b506102ea6102e53660046128e1565b610862565b005b3480156102f857600080fd5b506102ea610307366004612925565b61088f565b34801561031857600080fd5b5061032c6103273660046126d8565b610992565b6040516102c19190612ab6565b34801561034557600080fd5b5061034e6109a4565b6040516102c1919061299c565b34801561036757600080fd5b5061037b6103763660046128e1565b6109bc565b6040516102c19190612aab565b34801561039457600080fd5b5061032c610a0a565b3480156103a957600080fd5b506103bd6103b83660046128e1565b610a10565b6040516102c19190612abf565b3480156103d657600080fd5b506103df610b4c565b6040516102c19190612ad3565b3480156103f857600080fd5b5061032c610b75565b34801561040d57600080fd5b5061032c61041c3660046126f3565b610b7b565b34801561042d57600080fd5b506102ea61043c3660046126d8565b610bc9565b34801561044d57600080fd5b506102ea61045c3660046128e1565b610ceb565b34801561046d57600080fd5b5061034e61047c3660046126d8565b610e38565b34801561048d57600080fd5b5061032c610e53565b3480156104a257600080fd5b5061032c610e59565b3480156104b757600080fd5b506102ea6104c63660046128e1565b610e5f565b3480156104d757600080fd5b506102ea6104e63660046128e1565b610ea4565b3480156104f757600080fd5b5061034e610ec8565b34801561050c57600080fd5b506102ea610eec565b34801561052157600080fd5b506102ea6105303660046128e1565b610f73565b34801561054157600080fd5b506102ea6105503660046128e1565b611025565b34801561056157600080fd5b5061032c6105703660046126d8565b611049565b34801561058157600080fd5b5061034e61105b565b34801561059657600080fd5b5061032c61107f565b3480156105ab57600080fd5b5061032c6105ba3660046126d8565b611085565b3480156105cb57600080fd5b5061034e611097565b3480156105e057600080fd5b5061032c6110a6565b3480156105f557600080fd5b506102ea6106043660046128e1565b6110ac565b34801561061557600080fd5b506102ea610624366004612800565b6111f5565b34801561063557600080fd5b506102ea6106443660046128e1565b611243565b34801561065557600080fd5b506102ea6106643660046126d8565b611267565b34801561067557600080fd5b5061032c6114aa565b34801561068a57600080fd5b5061032c6114b0565b34801561069f57600080fd5b5061032c6106ae366004612753565b6114b6565b3480156106bf57600080fd5b5061032c6114cc565b3480156106d457600080fd5b5061032c6106e33660046128e1565b6114d6565b3480156106f457600080fd5b506107086107033660046128f9565b6114e8565b6040516102c191906130db565b34801561072157600080fd5b506102ea6107303660046128e1565b61155a565b34801561074157600080fd5b5061037b6107503660046128f9565b61157e565b34801561076157600080fd5b506102ea6107703660046128e1565b6115c1565b34801561078157600080fd5b506102ea6107903660046128e1565b6115e5565b3480156107a157600080fd5b506102ea6107b03660046128e1565b611609565b3480156107c157600080fd5b506102ea6107d03660046127a1565b61169b565b3480156107e157600080fd5b5061034e6117f6565b6102ea6107f83660046128e1565b61181a565b603d818154811061080a57fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b33301461088a5760405162461bcd60e51b815260040161088190612e49565b60405180910390fd5b603555565b3361089a833361157e565b1580156108ad57506108ab836109bc565b155b3332146108bb5760006108bf565b6152085b61ffff1681156109805760005a90506108d93387876118ac565b60006108f66127106108f0856108f05a8790611add565b90611b1f565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce8079061094790889085906004016129b0565b600060405180830381600087803b15801561096157600080fd5b505af1158015610975573d6000803e3d6000fd5b50505050505061098b565b61098b3386866118ac565b5050505050565b603e6020526000908152604090205481565b73b04e030140b30c27bcdfaafffa98c57d80eda7b490565b6000603554603d83815481106109ce57fe5b906000526020600020906008020160050154603d84815481106109ed57fe5b90600052602060002090600802016004015401101590505b919050565b60335481565b6000610a1a6114cc565b8211158015610a295750600082115b610a455760405162461bcd60e51b815260040161088190612fa6565b6000603d8381548110610a5457fe5b906000526020600020906008020190508060020154610a71611b44565b11610a80576000915050610a05565b8060030154610a8d611b44565b11610a9c576001915050610a05565b80600501548160040154111580610abe57506035548160050154826004015401105b15610acd576002915050610a05565b600681015460ff1615610ae4576005915050610a05565b610b036034546108f06033548460030154611b1f90919063ffffffff16565b610b0b611b44565b10610b1a576006915050610a05565b6033546003820154610b2b91611b1f565b610b33611b44565b10610b42576004915050610a05565b6003915050610a05565b60408051808201909152600f81526e0d0b9c185d18da0b595e1c1b1bda5d608a1b602082015290565b603a5481565b6001600160a01b038381166000908152603c60205260408120549091163314610bb65760405162461bcd60e51b815260040161088190613036565b610bc1848484611b48565b949350505050565b336000818152603c60205260409020546001600160a01b039081169190831614801590610bff57506001600160a01b0382163014155b8015610c1357506001600160a01b03821615155b8015610c315750806001600160a01b0316826001600160a01b031614155b610c4d5760405162461bcd60e51b815260040161088190612e80565b6001600160a01b03811615610c93576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f91610d489185916004016129b0565b600060405180830381600087803b158015610d6257600080fd5b505af1925050508015610d73575060015b610df6573d808015610da1576040519150601f19603f3d011682016040523d82523d6000602084013e610da6565b606091505b5080604051610db59190612980565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a350610e2b565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e3482611b70565b5050565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610e7e5760405162461bcd60e51b815260040161088190612e49565b6033548110610e9f5760405162461bcd60e51b815260040161088190612d6d565b603a55565b333014610ec35760405162461bcd60e51b815260040161088190612e49565b603755565b7f000000000000000000000000000000000000000000000000000000000000000081565b336000908152603c60205260409020546001600160a01b031680610f225760405162461bcd60e51b815260040161088190612fec565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b610f7b6109a4565b6001600160a01b0316336001600160a01b031614610fab5760405162461bcd60e51b815260040161088190612f7f565b604051633a08bde160e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e822f78490610ff7908490600401612ab6565b600060405180830381600087803b15801561101157600080fd5b505af115801561098b573d6000803e3d6000fd5b3330146110445760405162461bcd60e51b815260040161088190612e49565b603455565b603b6020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916111099185916004016129b0565b600060405180830381600087803b15801561112357600080fd5b505af1925050508015611134575060015b6111b7573d808015611162576040519150601f19603f3d011682016040523d82523d6000602084013e611167565b606091505b50806040516111769190612980565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506111ec565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e3482611c54565b60008351116112165760405162461bcd60e51b815260040161088190612e1f565b61123e838383611226863361157e565b1580156112395750611237866109bc565b155b611c5e565b505050565b3330146112625760405162461bcd60e51b815260040161088190612e49565b603955565b600054610100900460ff16806112805750611280611ea1565b8061128e575060005460ff16155b6112aa5760405162461bcd60e51b815260040161088190612f31565b600054610100900460ff161580156112d5576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff199094169390931716919091179055611495611ea7565b8015610e34576000805461ff00191690555050565b60395481565b60375481565b60006114c3338484611b48565b90505b92915050565b603d546000190190565b60416020526000908152604090205481565b6114f06125d2565b603d83815481106114fd57fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b3330146115795760405162461bcd60e51b815260040161088190612e49565b603355565b6000603d838154811061158d57fe5b600091825260208083206001600160a01b03861684526007600890930201919091019052604090205460ff16905092915050565b3330146115e05760405162461bcd60e51b815260040161088190612e49565b603855565b3330146116045760405162461bcd60e51b815260040161088190612e49565b603655565b6116116109a4565b6001600160a01b0316336001600160a01b0316146116415760405162461bcd60e51b815260040161088190612f7f565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166108fc6116788347611ee8565b6040518115909202916000818181858888f1935050505061169857600080fd5b50565b6001600160a01b038087166000908152603b60205260409081902054905163e113335f60e01b815288927f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916116fc9185916004016129b0565b600060405180830381600087803b15801561171657600080fd5b505af1925050508015611727575060015b6117aa573d808015611755576040519150601f19603f3d011682016040523d82523d6000602084013e61175a565b606091505b50806040516117699190612980565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506117df565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b6117ed878787878787611efe565b50505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b3330141561183a5760405162461bcd60e51b815260040161088190612c36565b6000603d828154811061184957fe5b6000918252602080832060016008909302019182015485845260419091526040909220549092506001600160a01b0390911690813f90811461189d5760405162461bcd60e51b815260040161088190612d17565b6118a684611f7e565b50505050565b60016118b783610a10565b60068111156118c257fe5b146118df5760405162461bcd60e51b815260040161088190612bef565b6000603d83815481106118ee57fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b90945291909420549294501015908061194d5760405162461bcd60e51b815260040161088190612eb7565b825460ff161561199c578254610100900460ff1615611983576001830154600485015461197991611add565b600485015561199c565b6001830154600585015461199691611add565b60058501555b84156119bb5760048401546119b19082611b1f565b60048501556119d0565b60058401546119ca9082611b1f565b60058501555b6006840154610100900460ff16158015611a0057506039546119fe6119f3611b44565b600387015490611add565b105b15611a44576005840154600485015411158215158114611a425760068501805461ff001916610100179055603a546003860154611a3c91611b1f565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a546003870154611a8f938b93611a8a9391926108f092839190611b1f565b612110565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b584604051611acc9190612ab6565b60405180910390a450505050505050565b60006114c383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061214d565b6000828201838110156114c35760405162461bcd60e51b815260040161088190612ce0565b4290565b6000611b55848484612179565b6000818152604160205260409020933f909355509092915050565b336000908152603f6020526040902054611b88611b44565b11611ba55760405162461bcd60e51b815260040161088190612db1565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054611bf391839061214d565b336000818152603b6020526040908190209290925590516391fe357360e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316916391fe357391610ff7919085906004016129b0565b61169833826124c7565b3381328214611c6e576000611c72565b6152085b61ffff168115611ddd5760005a905060005b8851811015611d3b576000898281518110611c9b57fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611cdb57506001600160a01b03811633145b611cf75760405162461bcd60e51b815260040161088190613036565b861580611d0b5750611d09898261157e565b155b611d275760405162461bcd60e51b8152600401610881906130a4565b611d32818a8a6118ac565b50600101611c84565b506000611d536127106108f0856108f05a8790611add565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce80790611da490889085906004016129b0565b600060405180830381600087803b158015611dbe57600080fd5b505af1158015611dd2573d6000803e3d6000fd5b5050505050506117ed565b60005b8751811015611e97576000888281518110611df757fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611e3757506001600160a01b03811633145b611e535760405162461bcd60e51b815260040161088190613036565b851580611e675750611e65888261157e565b155b611e835760405162461bcd60e51b8152600401610881906130a4565b611e8e8189896118ac565b50600101611de0565b5050505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6000818310611ef757816114c3565b5090919050565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf90611f3a90899030908a908a908a908a908a90600401612a33565b600060405180830381600087803b158015611f5457600080fd5b505af1158015611f68573d6000803e3d6000fd5b50505050611f7686866124c7565b505050505050565b6004611f8982610a10565b6006811115611f9457fe5b14611fb15760405162461bcd60e51b815260040161088190612b29565b6000603d8281548110611fc057fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b0316611ffb816125cc565b6120175760405162461bcd60e51b815260040161088190612ae6565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b0385169161205b91612980565b600060405180830381855af49150503d8060008114612096576040519150601f19603f3d011682016040523d82523d6000602084013e61209b565b606091505b5091509150816120de578051156120c6578060405162461bcd60e51b81526004016108819190612ad3565b60405162461bcd60e51b81526004016108819061306d565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b6001600160a01b0382166000908152603f6020526040902054811115610e34576001600160a01b03919091166000908152603f6020526040902055565b600081848411156121715760405162461bcd60e51b81526004016108819190612ad3565b505050900390565b6001600160a01b0383166000908152603b60205260408120546036548110156121b45760405162461bcd60e51b815260040161088190612c83565b6121bd846125cc565b6121d95760405162461bcd60e51b815260040161088190612eee565b6001600160a01b0385166000908152603e6020526040902054801561224b57600061220382610a10565b9050600181600681111561221357fe5b1415801561222d5750600081600681111561222a57fe5b14155b6122495760405162461bcd60e51b815260040161088190612b74565b505b600061225b6037546108f0611b44565b9050600061227460385483611b1f90919063ffffffff16565b905061227e6125f2565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff199093169290921794909416179055906124306114cc565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a54929350612472928d92611a8a9290916108f0919082908a90611b1f565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d6040516124b29493929190612a74565b60405180910390a39998505050505050505050565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd9061251b9085907f00000000000000000000000000000000000000000000000000000000000000009086906004016129c9565b602060405180830381600087803b15801561253557600080fd5b505af1158015612549573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061256d91906128c5565b6125895760405162461bcd60e51b815260040161088190612de8565b6001600160a01b0382166000908152603b60205260409020546125ac9082611b1f565b6001600160a01b039092166000908152603b602052604090209190915550565b3b151590565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b03811681146114c657600080fd5b80356114c681613168565b600082601f83011261267f578081fd5b813567ffffffffffffffff811115612695578182fd5b6126a8601f8201601f1916602001613100565b91508082528360208285010111156126bf57600080fd5b8060208401602084013760009082016020015292915050565b6000602082840312156126e9578081fd5b6114c3838361264d565b600080600060608486031215612707578182fd5b833561271281613153565b9250602084013561272281613153565b9150604084013567ffffffffffffffff81111561273d578182fd5b6127498682870161266f565b9150509250925092565b60008060408385031215612765578182fd5b823561277081613153565b9150602083013567ffffffffffffffff81111561278b578182fd5b6127978582860161266f565b9150509250929050565b60008060008060008060c087890312156127b9578182fd5b6127c3888861264d565b95506020870135945060408701359350606087013560ff811681146127e6578283fd5b9598949750929560808101359460a0909101359350915050565b600080600060608486031215612814578283fd5b833567ffffffffffffffff8082111561282b578485fd5b818601915086601f83011261283e578485fd5b81358181111561284c578586fd5b6020915081810261285e838201613100565b8281528381019085850183870186018c101561287857898afd5b8996505b848710156128a25761288e8c8261264d565b83526001969096019591850191850161287c565b50975050505085013592506128bc90508560408601612664565b90509250925092565b6000602082840312156128d6578081fd5b81516114c381613168565b6000602082840312156128f2578081fd5b5035919050565b6000806040838503121561290b578182fd5b8235915061291c846020850161264d565b90509250929050565b60008060408385031215612937578182fd5b82359150602083013561294981613168565b809150509250929050565b6000815180845261296c816020860160208601613127565b601f01601f19169290920160200192915050565b60008251612992818460208701613127565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b038616825284602083015283604083015260806060830152612aa16080830184612954565b9695505050505050565b901515815260200190565b90815260200190565b6020810160078310612acd57fe5b91905290565b6000602082526114c36020830184612954565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252602d908201527f476f7665726e616e63653a3a70726f706f73653a2070736575646f2d6578746560408201526c393730b610333ab731ba34b7b760991b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526036908201527f476f7665726e616e63653a3a70726f706f73653a206d6574616d6f72706869636040820152750818dbdb9d1c9858dd1cc81b9bdd08185b1b1bddd95960521b606082015260800190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526010908201526f43616e206e6f7420626520656d70747960801b604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252600d908201526c6f6e6c79206d756c746973696760981b604082015260600190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b60208082526019908201527f476f7665726e616e63653a20766f74656420616c726561647900000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b60405181810167ffffffffffffffff8111828210171561311f57600080fd5b604052919050565b60005b8381101561314257818101518382015260200161312a565b838111156118a65750506000910152565b6001600160a01b038116811461169857600080fd5b801515811461169857600080fdfea2646970667358221220b75004153b6c8b4905c018daca78cb0fa6d3859298be55252bcf6ba75ea68d0e64736f6c634300060c0033";class rr extends Ya{constructor(...e){e.length>1?super(...e):super(ir,sr,e[0])}getDeployTransaction(e,t,a,n){return super.getDeployTransaction(e,t,a,n||{})}deploy(e,t,a,n){return super.deploy(e,t,a,n||{})}connect(e){return super.connect(e)}static bytecode=sr;static abi=ir;static createInterface(){return new ba(ir)}static connect(e,t){return new Wa(e,ir,t)}}const pr=[{inputs:[{internalType:"address",name:"_deployedStakingProxyContractAddress",type:"address"},{internalType:"address",name:"_deployedRelayerRegistryImplementationAddress",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"TORN",outputs:[{internalType:"contract IERC20",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"deployedRelayerRegistryImplementationAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"deployedStakingProxyContractAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"executeProposal",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"gasCompensationVaultAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"governanceProxyAddress",outputs:[{internalType:"address payable",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"oldStakingProxyAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"registryProxyAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"userVaultAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}],cr="0x60c060405234801561001057600080fd5b50604051613adb380380613adb83398101604081905261002f9161004d565b6001600160601b0319606092831b8116608052911b1660a05261009e565b6000806040838503121561005f578182fd5b825161006a81610086565b602084015190925061007b81610086565b809150509250929050565b6001600160a01b038116811461009b57600080fd5b50565b60805160601c60a05160601c613a056100d66000398061027a52806104985250806102f952806103f452806104bc5250613a056000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063373058b811610066578063373058b8146100ce5780634655478f146100d857806361697d64146100e05780636fc6091d146100e85780639b49989a146100f057610093565b80630cc784761461009857806313f32237146100b657806324044543146100be57806332bf1039146100c6575b600080fd5b6100a06100f8565b6040516100ad9190610542565b60405180910390f35b6100a0610110565b6100a0610128565b6100a0610140565b6100d6610158565b005b6100a061047e565b6100a0610496565b6100a06104ba565b6100a06104de565b7358e8dcc13be9780fc42e8723d8ead4cf46943df281565b732fc93484614a34f26f7970cbb94615ba109bb4bf81565b73fa4c1f3f7d5dd7c12a9adb82cd7dda542e3d59ef81565b7377777feddddffc19ff86db637967013e6c6a116c81565b6040516370a0823160e01b8152732fc93484614a34f26f7970cbb94615ba109bb4bf90819063f58073b1907377777feddddffc19ff86db637967013e6c6a116c906370a08231906101ad908590600401610542565b60206040518083038186803b1580156101c557600080fd5b505afa1580156101d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fd919061052a565b6040518263ffffffff1660e01b81526004016102199190610592565b600060405180830381600087803b15801561023357600080fd5b505af1158015610247573d6000803e3d6000fd5b5050604051631b2ce7f360e11b81527358e8dcc13be9780fc42e8723d8ead4cf46943df29250633659cfe691506102a2907f000000000000000000000000000000000000000000000000000000000000000090600401610542565b600060405180830381600087803b1580156102bc57600080fd5b505af11580156102d0573d6000803e3d6000fd5b50505050735efda50f22d34f262c29268506c5fa42cb56a1ce6001600160a01b0316633659cfe67f000000000000000000000000000000000000000000000000000000000000000073fa4c1f3f7d5dd7c12a9adb82cd7dda542e3d59ef732f50508a8a3d323b91336fa3ea6ae50e55f3218560405161034e906104f6565b61035a93929190610556565b604051809103906000f080158015610376573d6000803e3d6000fd5b506040518263ffffffff1660e01b81526004016103939190610542565b600060405180830381600087803b1580156103ad57600080fd5b505af11580156103c1573d6000803e3d6000fd5b505060405163a9059cbb60e01b81527377777feddddffc19ff86db637967013e6c6a116c925063a9059cbb9150610428907f0000000000000000000000000000000000000000000000000000000000000000906913ecbccf7737e6b0000090600401610579565b602060405180830381600087803b15801561044257600080fd5b505af1158015610456573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047a9190610503565b5050565b735efda50f22d34f262c29268506c5fa42cb56a1ce81565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b732f50508a8a3d323b91336fa3ea6ae50e55f3218581565b6134348061059c83390190565b600060208284031215610514578081fd5b81518015158114610523578182fd5b9392505050565b60006020828403121561053b578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b0393841681529183166020830152909116604082015260600190565b6001600160a01b03929092168252602082015260400190565b9081526020019056fe60e06040523480156200001157600080fd5b50604051620034343803806200343483398101604081905262000034916200016b565b82828281818181600060019054906101000a900460ff16806200005c57506200005c62000124565b806200006b575060005460ff16155b620000935760405162461bcd60e51b81526004016200008a90620001be565b60405180910390fd5b600054610100900460ff16158015620000bf576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000dd6200012a565b8015620000f0576000805461ff00191690555b506001600160601b0319606091821b811660805291811b821660a0529590951b90941660c052506200022595505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b60008060006060848603121562000180578283fd5b83516200018d816200020c565b6020850151909350620001a0816200020c565b6040850151909250620001b3816200020c565b809150509250925092565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6001600160a01b03811681146200022257600080fd5b50565b60805160601c60a05160601c60c05160601c6131ac6200028860003980610d1352806110d452806116c752806117f85250806109105280610eca5280610fc252806116435280611d6d52508061105d5280611c1652806124f152506131ac6000f3fe6080604052600436106102815760003560e01c80639daafec71161014f578063d6f0948c116100c1578063ea0217cf1161007a578063ea0217cf14610755578063ece40cc114610775578063ef3f8bb114610795578063f0b76892146107b5578063f57df22e146107d5578063fe0d94c1146107ea57610288565b8063d6f0948c14610693578063da35c664146106b3578063e01f5237146106c8578063e23a9a52146106e8578063e4917d9f14610715578063e525aa081461073557610288565b8063b54426c811610113578063b54426c8146105e9578063b859f11b14610609578063c0c0e82014610629578063c4d66de814610649578063ce25d71c14610669578063d6159fe51461067e57610288565b80639daafec714610575578063a6c266031461058a578063a72edda31461059f578063adf898a4146105bf578063b1610d7e146105d457610288565b80635c19a95c116101f357806370b0f660116101ac57806370b0f660146104cb5780638b34a960146104eb57806392ab89bb14610500578063932d5157146105155780639a9e3b6e146105355780639ae697bf1461055557610288565b80635c19a95c146104215780636198e3391461044157806365da126414610461578063671dd275146104815780636a661755146104965780636dc2dc6c146104ab57610288565b806332687ec11161024557806332687ec11461035b57806337f135d7146103885780633e4f49e61461039d57806354fd4d50146103ca578063587a6ecb146103ec57806358e9fff01461040157610288565b8063013cf08b1461028d57806302ec8f9e146102ca57806315373e3d146102ec57806317977c611461030c57806324b0435f1461033957610288565b3661028857005b600080fd5b34801561029957600080fd5b506102ad6102a83660046128e1565b6107fd565b6040516102c19897969594939291906129ed565b60405180910390f35b3480156102d657600080fd5b506102ea6102e53660046128e1565b610862565b005b3480156102f857600080fd5b506102ea610307366004612925565b61088f565b34801561031857600080fd5b5061032c6103273660046126d8565b610992565b6040516102c19190612ab6565b34801561034557600080fd5b5061034e6109a4565b6040516102c1919061299c565b34801561036757600080fd5b5061037b6103763660046128e1565b6109bc565b6040516102c19190612aab565b34801561039457600080fd5b5061032c610a0a565b3480156103a957600080fd5b506103bd6103b83660046128e1565b610a10565b6040516102c19190612abf565b3480156103d657600080fd5b506103df610b4c565b6040516102c19190612ad3565b3480156103f857600080fd5b5061032c610b75565b34801561040d57600080fd5b5061032c61041c3660046126f3565b610b7b565b34801561042d57600080fd5b506102ea61043c3660046126d8565b610bc9565b34801561044d57600080fd5b506102ea61045c3660046128e1565b610ceb565b34801561046d57600080fd5b5061034e61047c3660046126d8565b610e38565b34801561048d57600080fd5b5061032c610e53565b3480156104a257600080fd5b5061032c610e59565b3480156104b757600080fd5b506102ea6104c63660046128e1565b610e5f565b3480156104d757600080fd5b506102ea6104e63660046128e1565b610ea4565b3480156104f757600080fd5b5061034e610ec8565b34801561050c57600080fd5b506102ea610eec565b34801561052157600080fd5b506102ea6105303660046128e1565b610f73565b34801561054157600080fd5b506102ea6105503660046128e1565b611025565b34801561056157600080fd5b5061032c6105703660046126d8565b611049565b34801561058157600080fd5b5061034e61105b565b34801561059657600080fd5b5061032c61107f565b3480156105ab57600080fd5b5061032c6105ba3660046126d8565b611085565b3480156105cb57600080fd5b5061034e611097565b3480156105e057600080fd5b5061032c6110a6565b3480156105f557600080fd5b506102ea6106043660046128e1565b6110ac565b34801561061557600080fd5b506102ea610624366004612800565b6111f5565b34801561063557600080fd5b506102ea6106443660046128e1565b611243565b34801561065557600080fd5b506102ea6106643660046126d8565b611267565b34801561067557600080fd5b5061032c6114aa565b34801561068a57600080fd5b5061032c6114b0565b34801561069f57600080fd5b5061032c6106ae366004612753565b6114b6565b3480156106bf57600080fd5b5061032c6114cc565b3480156106d457600080fd5b5061032c6106e33660046128e1565b6114d6565b3480156106f457600080fd5b506107086107033660046128f9565b6114e8565b6040516102c191906130db565b34801561072157600080fd5b506102ea6107303660046128e1565b61155a565b34801561074157600080fd5b5061037b6107503660046128f9565b61157e565b34801561076157600080fd5b506102ea6107703660046128e1565b6115c1565b34801561078157600080fd5b506102ea6107903660046128e1565b6115e5565b3480156107a157600080fd5b506102ea6107b03660046128e1565b611609565b3480156107c157600080fd5b506102ea6107d03660046127a1565b61169b565b3480156107e157600080fd5b5061034e6117f6565b6102ea6107f83660046128e1565b61181a565b603d818154811061080a57fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b33301461088a5760405162461bcd60e51b815260040161088190612e49565b60405180910390fd5b603555565b3361089a833361157e565b1580156108ad57506108ab836109bc565b155b3332146108bb5760006108bf565b6152085b61ffff1681156109805760005a90506108d93387876118ac565b60006108f66127106108f0856108f05a8790611add565b90611b1f565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce8079061094790889085906004016129b0565b600060405180830381600087803b15801561096157600080fd5b505af1158015610975573d6000803e3d6000fd5b50505050505061098b565b61098b3386866118ac565b5050505050565b603e6020526000908152604090205481565b73b04e030140b30c27bcdfaafffa98c57d80eda7b490565b6000603554603d83815481106109ce57fe5b906000526020600020906008020160050154603d84815481106109ed57fe5b90600052602060002090600802016004015401101590505b919050565b60335481565b6000610a1a6114cc565b8211158015610a295750600082115b610a455760405162461bcd60e51b815260040161088190612fa6565b6000603d8381548110610a5457fe5b906000526020600020906008020190508060020154610a71611b44565b11610a80576000915050610a05565b8060030154610a8d611b44565b11610a9c576001915050610a05565b80600501548160040154111580610abe57506035548160050154826004015401105b15610acd576002915050610a05565b600681015460ff1615610ae4576005915050610a05565b610b036034546108f06033548460030154611b1f90919063ffffffff16565b610b0b611b44565b10610b1a576006915050610a05565b6033546003820154610b2b91611b1f565b610b33611b44565b10610b42576004915050610a05565b6003915050610a05565b60408051808201909152600f81526e0d0b9c185d18da0b595e1c1b1bda5d608a1b602082015290565b603a5481565b6001600160a01b038381166000908152603c60205260408120549091163314610bb65760405162461bcd60e51b815260040161088190613036565b610bc1848484611b48565b949350505050565b336000818152603c60205260409020546001600160a01b039081169190831614801590610bff57506001600160a01b0382163014155b8015610c1357506001600160a01b03821615155b8015610c315750806001600160a01b0316826001600160a01b031614155b610c4d5760405162461bcd60e51b815260040161088190612e80565b6001600160a01b03811615610c93576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f91610d489185916004016129b0565b600060405180830381600087803b158015610d6257600080fd5b505af1925050508015610d73575060015b610df6573d808015610da1576040519150601f19603f3d011682016040523d82523d6000602084013e610da6565b606091505b5080604051610db59190612980565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a350610e2b565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e3482611b70565b5050565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610e7e5760405162461bcd60e51b815260040161088190612e49565b6033548110610e9f5760405162461bcd60e51b815260040161088190612d6d565b603a55565b333014610ec35760405162461bcd60e51b815260040161088190612e49565b603755565b7f000000000000000000000000000000000000000000000000000000000000000081565b336000908152603c60205260409020546001600160a01b031680610f225760405162461bcd60e51b815260040161088190612fec565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b610f7b6109a4565b6001600160a01b0316336001600160a01b031614610fab5760405162461bcd60e51b815260040161088190612f7f565b604051633a08bde160e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e822f78490610ff7908490600401612ab6565b600060405180830381600087803b15801561101157600080fd5b505af115801561098b573d6000803e3d6000fd5b3330146110445760405162461bcd60e51b815260040161088190612e49565b603455565b603b6020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916111099185916004016129b0565b600060405180830381600087803b15801561112357600080fd5b505af1925050508015611134575060015b6111b7573d808015611162576040519150601f19603f3d011682016040523d82523d6000602084013e611167565b606091505b50806040516111769190612980565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506111ec565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e3482611c54565b60008351116112165760405162461bcd60e51b815260040161088190612e1f565b61123e838383611226863361157e565b1580156112395750611237866109bc565b155b611c5e565b505050565b3330146112625760405162461bcd60e51b815260040161088190612e49565b603955565b600054610100900460ff16806112805750611280611ea1565b8061128e575060005460ff16155b6112aa5760405162461bcd60e51b815260040161088190612f31565b600054610100900460ff161580156112d5576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff199094169390931716919091179055611495611ea7565b8015610e34576000805461ff00191690555050565b60395481565b60375481565b60006114c3338484611b48565b90505b92915050565b603d546000190190565b60416020526000908152604090205481565b6114f06125d2565b603d83815481106114fd57fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b3330146115795760405162461bcd60e51b815260040161088190612e49565b603355565b6000603d838154811061158d57fe5b600091825260208083206001600160a01b03861684526007600890930201919091019052604090205460ff16905092915050565b3330146115e05760405162461bcd60e51b815260040161088190612e49565b603855565b3330146116045760405162461bcd60e51b815260040161088190612e49565b603655565b6116116109a4565b6001600160a01b0316336001600160a01b0316146116415760405162461bcd60e51b815260040161088190612f7f565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166108fc6116788347611ee8565b6040518115909202916000818181858888f1935050505061169857600080fd5b50565b6001600160a01b038087166000908152603b60205260409081902054905163e113335f60e01b815288927f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916116fc9185916004016129b0565b600060405180830381600087803b15801561171657600080fd5b505af1925050508015611727575060015b6117aa573d808015611755576040519150601f19603f3d011682016040523d82523d6000602084013e61175a565b606091505b50806040516117699190612980565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506117df565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b6117ed878787878787611efe565b50505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b3330141561183a5760405162461bcd60e51b815260040161088190612c36565b6000603d828154811061184957fe5b6000918252602080832060016008909302019182015485845260419091526040909220549092506001600160a01b0390911690813f90811461189d5760405162461bcd60e51b815260040161088190612d17565b6118a684611f7e565b50505050565b60016118b783610a10565b60068111156118c257fe5b146118df5760405162461bcd60e51b815260040161088190612bef565b6000603d83815481106118ee57fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b90945291909420549294501015908061194d5760405162461bcd60e51b815260040161088190612eb7565b825460ff161561199c578254610100900460ff1615611983576001830154600485015461197991611add565b600485015561199c565b6001830154600585015461199691611add565b60058501555b84156119bb5760048401546119b19082611b1f565b60048501556119d0565b60058401546119ca9082611b1f565b60058501555b6006840154610100900460ff16158015611a0057506039546119fe6119f3611b44565b600387015490611add565b105b15611a44576005840154600485015411158215158114611a425760068501805461ff001916610100179055603a546003860154611a3c91611b1f565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a546003870154611a8f938b93611a8a9391926108f092839190611b1f565b612110565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b584604051611acc9190612ab6565b60405180910390a450505050505050565b60006114c383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061214d565b6000828201838110156114c35760405162461bcd60e51b815260040161088190612ce0565b4290565b6000611b55848484612179565b6000818152604160205260409020933f909355509092915050565b336000908152603f6020526040902054611b88611b44565b11611ba55760405162461bcd60e51b815260040161088190612db1565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054611bf391839061214d565b336000818152603b6020526040908190209290925590516391fe357360e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316916391fe357391610ff7919085906004016129b0565b61169833826124c7565b3381328214611c6e576000611c72565b6152085b61ffff168115611ddd5760005a905060005b8851811015611d3b576000898281518110611c9b57fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611cdb57506001600160a01b03811633145b611cf75760405162461bcd60e51b815260040161088190613036565b861580611d0b5750611d09898261157e565b155b611d275760405162461bcd60e51b8152600401610881906130a4565b611d32818a8a6118ac565b50600101611c84565b506000611d536127106108f0856108f05a8790611add565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce80790611da490889085906004016129b0565b600060405180830381600087803b158015611dbe57600080fd5b505af1158015611dd2573d6000803e3d6000fd5b5050505050506117ed565b60005b8751811015611e97576000888281518110611df757fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611e3757506001600160a01b03811633145b611e535760405162461bcd60e51b815260040161088190613036565b851580611e675750611e65888261157e565b155b611e835760405162461bcd60e51b8152600401610881906130a4565b611e8e8189896118ac565b50600101611de0565b5050505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6000818310611ef757816114c3565b5090919050565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf90611f3a90899030908a908a908a908a908a90600401612a33565b600060405180830381600087803b158015611f5457600080fd5b505af1158015611f68573d6000803e3d6000fd5b50505050611f7686866124c7565b505050505050565b6004611f8982610a10565b6006811115611f9457fe5b14611fb15760405162461bcd60e51b815260040161088190612b29565b6000603d8281548110611fc057fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b0316611ffb816125cc565b6120175760405162461bcd60e51b815260040161088190612ae6565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b0385169161205b91612980565b600060405180830381855af49150503d8060008114612096576040519150601f19603f3d011682016040523d82523d6000602084013e61209b565b606091505b5091509150816120de578051156120c6578060405162461bcd60e51b81526004016108819190612ad3565b60405162461bcd60e51b81526004016108819061306d565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b6001600160a01b0382166000908152603f6020526040902054811115610e34576001600160a01b03919091166000908152603f6020526040902055565b600081848411156121715760405162461bcd60e51b81526004016108819190612ad3565b505050900390565b6001600160a01b0383166000908152603b60205260408120546036548110156121b45760405162461bcd60e51b815260040161088190612c83565b6121bd846125cc565b6121d95760405162461bcd60e51b815260040161088190612eee565b6001600160a01b0385166000908152603e6020526040902054801561224b57600061220382610a10565b9050600181600681111561221357fe5b1415801561222d5750600081600681111561222a57fe5b14155b6122495760405162461bcd60e51b815260040161088190612b74565b505b600061225b6037546108f0611b44565b9050600061227460385483611b1f90919063ffffffff16565b905061227e6125f2565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff199093169290921794909416179055906124306114cc565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a54929350612472928d92611a8a9290916108f0919082908a90611b1f565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d6040516124b29493929190612a74565b60405180910390a39998505050505050505050565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd9061251b9085907f00000000000000000000000000000000000000000000000000000000000000009086906004016129c9565b602060405180830381600087803b15801561253557600080fd5b505af1158015612549573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061256d91906128c5565b6125895760405162461bcd60e51b815260040161088190612de8565b6001600160a01b0382166000908152603b60205260409020546125ac9082611b1f565b6001600160a01b039092166000908152603b602052604090209190915550565b3b151590565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b03811681146114c657600080fd5b80356114c681613168565b600082601f83011261267f578081fd5b813567ffffffffffffffff811115612695578182fd5b6126a8601f8201601f1916602001613100565b91508082528360208285010111156126bf57600080fd5b8060208401602084013760009082016020015292915050565b6000602082840312156126e9578081fd5b6114c3838361264d565b600080600060608486031215612707578182fd5b833561271281613153565b9250602084013561272281613153565b9150604084013567ffffffffffffffff81111561273d578182fd5b6127498682870161266f565b9150509250925092565b60008060408385031215612765578182fd5b823561277081613153565b9150602083013567ffffffffffffffff81111561278b578182fd5b6127978582860161266f565b9150509250929050565b60008060008060008060c087890312156127b9578182fd5b6127c3888861264d565b95506020870135945060408701359350606087013560ff811681146127e6578283fd5b9598949750929560808101359460a0909101359350915050565b600080600060608486031215612814578283fd5b833567ffffffffffffffff8082111561282b578485fd5b818601915086601f83011261283e578485fd5b81358181111561284c578586fd5b6020915081810261285e838201613100565b8281528381019085850183870186018c101561287857898afd5b8996505b848710156128a25761288e8c8261264d565b83526001969096019591850191850161287c565b50975050505085013592506128bc90508560408601612664565b90509250925092565b6000602082840312156128d6578081fd5b81516114c381613168565b6000602082840312156128f2578081fd5b5035919050565b6000806040838503121561290b578182fd5b8235915061291c846020850161264d565b90509250929050565b60008060408385031215612937578182fd5b82359150602083013561294981613168565b809150509250929050565b6000815180845261296c816020860160208601613127565b601f01601f19169290920160200192915050565b60008251612992818460208701613127565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b038616825284602083015283604083015260806060830152612aa16080830184612954565b9695505050505050565b901515815260200190565b90815260200190565b6020810160078310612acd57fe5b91905290565b6000602082526114c36020830184612954565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252602d908201527f476f7665726e616e63653a3a70726f706f73653a2070736575646f2d6578746560408201526c393730b610333ab731ba34b7b760991b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526036908201527f476f7665726e616e63653a3a70726f706f73653a206d6574616d6f72706869636040820152750818dbdb9d1c9858dd1cc81b9bdd08185b1b1bddd95960521b606082015260800190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526010908201526f43616e206e6f7420626520656d70747960801b604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252600d908201526c6f6e6c79206d756c746973696760981b604082015260600190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b60208082526019908201527f476f7665726e616e63653a20766f74656420616c726561647900000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b60405181810167ffffffffffffffff8111828210171561311f57600080fd5b604052919050565b60005b8381101561314257818101518382015260200161312a565b838111156118a65750506000910152565b6001600160a01b038116811461169857600080fd5b801515811461169857600080fdfea2646970667358221220b75004153b6c8b4905c018daca78cb0fa6d3859298be55252bcf6ba75ea68d0e64736f6c634300060c0033a26469706673582212205ce84e9446fce11b2c9c1572684a150170d4bffa09fb4c56f9926d2efe573f6b64736f6c634300060c0033";class ur extends Ya{constructor(...e){e.length>1?super(...e):super(pr,cr,e[0])}getDeployTransaction(e,t,a){return super.getDeployTransaction(e,t,a||{})}deploy(e,t,a){return super.deploy(e,t,a||{})}connect(e){return super.connect(e)}static bytecode=cr;static abi=pr;static createInterface(){return new ba(pr)}static connect(e,t){return new Wa(e,pr,t)}}var yr=Object.freeze({__proto__:null,AdminUpgradeableProxy__factory:class extends Ya{constructor(...e){e.length>1?super(...e):super(fr,dr,e[0])}getDeployTransaction(e,t,a,n){return super.getDeployTransaction(e,t,a,n||{})}deploy(e,t,a,n){return super.deploy(e,t,a,n||{})}connect(e){return super.connect(e)}static bytecode=dr;static abi=fr;static createInterface(){return new ba(fr)}static connect(e,t){return new Wa(e,fr,t)}},GovernanceExploitPatchUpgrade__factory:rr,PatchProposal__factory:ur,metamorphic:Ys,mock:br});const or=[{inputs:[{internalType:"address",name:"stakingRewardsAddress",type:"address"},{internalType:"address",name:"gasCompLogic",type:"address"},{internalType:"address",name:"userVaultAddress",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"}],name:"Delegated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"proposer",type:"address"},{indexed:!1,internalType:"address",name:"target",type:"address"},{indexed:!1,internalType:"uint256",name:"startTime",type:"uint256"},{indexed:!1,internalType:"uint256",name:"endTime",type:"uint256"},{indexed:!1,internalType:"string",name:"description",type:"string"}],name:"ProposalCreated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"proposalId",type:"uint256"}],name:"ProposalExecuted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"bytes",name:"errorData",type:"bytes"}],name:"RewardUpdateFailed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"}],name:"RewardUpdateSuccessful",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"}],name:"Undelegated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"proposalId",type:"uint256"},{indexed:!0,internalType:"address",name:"voter",type:"address"},{indexed:!0,internalType:"bool",name:"support",type:"bool"},{indexed:!1,internalType:"uint256",name:"votes",type:"uint256"}],name:"Voted",type:"event"},{inputs:[],name:"CLOSING_PERIOD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"EXECUTION_DELAY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"EXECUTION_EXPIRATION",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"PROPOSAL_THRESHOLD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"QUORUM_VOTES",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"Staking",outputs:[{internalType:"contract ITornadoStakingRewards",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTE_EXTEND_TIME",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTING_DELAY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"VOTING_PERIOD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"canWithdrawAfter",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address[]",name:"from",type:"address[]"},{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"bool",name:"support",type:"bool"}],name:"castDelegatedVote",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"bool",name:"support",type:"bool"}],name:"castVote",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"}],name:"checkIfQuorumReached",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"delegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"delegatedTo",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"}],name:"execute",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"gasCompensationVault",outputs:[{internalType:"contract IGasCompensationVault",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"address",name:"voter",type:"address"}],name:"getReceipt",outputs:[{components:[{internalType:"bool",name:"hasVoted",type:"bool"},{internalType:"bool",name:"support",type:"bool"},{internalType:"uint256",name:"votes",type:"uint256"}],internalType:"struct Governance.Receipt",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"},{internalType:"address",name:"account",type:"address"}],name:"hasAccountVoted",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_torn",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"latestProposalIds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"lock",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"lockWithApproval",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"lockedBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"proposalCodehashes",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"proposalCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"proposals",outputs:[{internalType:"address",name:"proposer",type:"address"},{internalType:"address",name:"target",type:"address"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"uint256",name:"forVotes",type:"uint256"},{internalType:"uint256",name:"againstVotes",type:"uint256"},{internalType:"bool",name:"executed",type:"bool"},{internalType:"bool",name:"extended",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"target",type:"address"},{internalType:"string",name:"description",type:"string"}],name:"propose",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"target",type:"address"},{internalType:"string",name:"description",type:"string"}],name:"proposeByDelegate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"returnMultisigAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"closingPeriod",type:"uint256"}],name:"setClosingPeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"executionDelay",type:"uint256"}],name:"setExecutionDelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"executionExpiration",type:"uint256"}],name:"setExecutionExpiration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"gasCompensationsLimit",type:"uint256"}],name:"setGasCompensations",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalThreshold",type:"uint256"}],name:"setProposalThreshold",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"quorumVotes",type:"uint256"}],name:"setQuorumVotes",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"voteExtendTime",type:"uint256"}],name:"setVoteExtendTime",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"votingDelay",type:"uint256"}],name:"setVotingDelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"votingPeriod",type:"uint256"}],name:"setVotingPeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"proposalId",type:"uint256"}],name:"state",outputs:[{internalType:"enum Governance.ProposalState",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"torn",outputs:[{internalType:"contract TORN",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"undelegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"unlock",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"userVault",outputs:[{internalType:"contract ITornadoVault",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"version",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawFromHelper",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],lr="0x60e06040523480156200001157600080fd5b506040516200344138038062003441833981016040819052620000349162000171565b82828282828281818181600060019054906101000a900460ff16806200005f57506200005f6200012a565b806200006e575060005460ff16155b620000965760405162461bcd60e51b81526004016200008d90620001c4565b60405180910390fd5b600054610100900460ff16158015620000c2576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b03191661dead179055620000e062000130565b8015620000f3576000805461ff00191690555b506001600160601b0319606091821b811660805291811b821660a0529590951b90941660c052506200022b98505050505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b60008060006060848603121562000186578283fd5b8351620001938162000212565b6020850151909350620001a68162000212565b6040850151909250620001b98162000212565b809150509250925092565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6001600160a01b03811681146200022857600080fd5b50565b60805160601c60a05160601c60c05160601c6131b36200028e60003980610d1a52806110db52806116ce52806117ff5250806109105280610ed15280610fc9528061164a5280611d745250806110645280611c1d52806124f852506131b36000f3fe6080604052600436106102815760003560e01c80639daafec71161014f578063d6f0948c116100c1578063ea0217cf1161007a578063ea0217cf14610755578063ece40cc114610775578063ef3f8bb114610795578063f0b76892146107b5578063f57df22e146107d5578063fe0d94c1146107ea57610288565b8063d6f0948c14610693578063da35c664146106b3578063e01f5237146106c8578063e23a9a52146106e8578063e4917d9f14610715578063e525aa081461073557610288565b8063b54426c811610113578063b54426c8146105e9578063b859f11b14610609578063c0c0e82014610629578063c4d66de814610649578063ce25d71c14610669578063d6159fe51461067e57610288565b80639daafec714610575578063a6c266031461058a578063a72edda31461059f578063adf898a4146105bf578063b1610d7e146105d457610288565b80635c19a95c116101f357806370b0f660116101ac57806370b0f660146104cb5780638b34a960146104eb57806392ab89bb14610500578063932d5157146105155780639a9e3b6e146105355780639ae697bf1461055557610288565b80635c19a95c146104215780636198e3391461044157806365da126414610461578063671dd275146104815780636a661755146104965780636dc2dc6c146104ab57610288565b806332687ec11161024557806332687ec11461035b57806337f135d7146103885780633e4f49e61461039d57806354fd4d50146103ca578063587a6ecb146103ec57806358e9fff01461040157610288565b8063013cf08b1461028d57806302ec8f9e146102ca57806315373e3d146102ec57806317977c611461030c57806324b0435f1461033957610288565b3661028857005b600080fd5b34801561029957600080fd5b506102ad6102a83660046128e8565b6107fd565b6040516102c19897969594939291906129f4565b60405180910390f35b3480156102d657600080fd5b506102ea6102e53660046128e8565b610862565b005b3480156102f857600080fd5b506102ea61030736600461292c565b61088f565b34801561031857600080fd5b5061032c6103273660046126df565b610992565b6040516102c19190612abd565b34801561034557600080fd5b5061034e6109a4565b6040516102c191906129a3565b34801561036757600080fd5b5061037b6103763660046128e8565b6109bc565b6040516102c19190612ab2565b34801561039457600080fd5b5061032c610a0a565b3480156103a957600080fd5b506103bd6103b83660046128e8565b610a10565b6040516102c19190612ac6565b3480156103d657600080fd5b506103df610b4c565b6040516102c19190612ada565b3480156103f857600080fd5b5061032c610b7c565b34801561040d57600080fd5b5061032c61041c3660046126fa565b610b82565b34801561042d57600080fd5b506102ea61043c3660046126df565b610bd0565b34801561044d57600080fd5b506102ea61045c3660046128e8565b610cf2565b34801561046d57600080fd5b5061034e61047c3660046126df565b610e3f565b34801561048d57600080fd5b5061032c610e5a565b3480156104a257600080fd5b5061032c610e60565b3480156104b757600080fd5b506102ea6104c63660046128e8565b610e66565b3480156104d757600080fd5b506102ea6104e63660046128e8565b610eab565b3480156104f757600080fd5b5061034e610ecf565b34801561050c57600080fd5b506102ea610ef3565b34801561052157600080fd5b506102ea6105303660046128e8565b610f7a565b34801561054157600080fd5b506102ea6105503660046128e8565b61102c565b34801561056157600080fd5b5061032c6105703660046126df565b611050565b34801561058157600080fd5b5061034e611062565b34801561059657600080fd5b5061032c611086565b3480156105ab57600080fd5b5061032c6105ba3660046126df565b61108c565b3480156105cb57600080fd5b5061034e61109e565b3480156105e057600080fd5b5061032c6110ad565b3480156105f557600080fd5b506102ea6106043660046128e8565b6110b3565b34801561061557600080fd5b506102ea610624366004612807565b6111fc565b34801561063557600080fd5b506102ea6106443660046128e8565b61124a565b34801561065557600080fd5b506102ea6106643660046126df565b61126e565b34801561067557600080fd5b5061032c6114b1565b34801561068a57600080fd5b5061032c6114b7565b34801561069f57600080fd5b5061032c6106ae36600461275a565b6114bd565b3480156106bf57600080fd5b5061032c6114d3565b3480156106d457600080fd5b5061032c6106e33660046128e8565b6114dd565b3480156106f457600080fd5b50610708610703366004612900565b6114ef565b6040516102c191906130e2565b34801561072157600080fd5b506102ea6107303660046128e8565b611561565b34801561074157600080fd5b5061037b610750366004612900565b611585565b34801561076157600080fd5b506102ea6107703660046128e8565b6115c8565b34801561078157600080fd5b506102ea6107903660046128e8565b6115ec565b3480156107a157600080fd5b506102ea6107b03660046128e8565b611610565b3480156107c157600080fd5b506102ea6107d03660046127a8565b6116a2565b3480156107e157600080fd5b5061034e6117fd565b6102ea6107f83660046128e8565b611821565b603d818154811061080a57fe5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff8082169161010090041688565b33301461088a5760405162461bcd60e51b815260040161088190612e50565b60405180910390fd5b603555565b3361089a8333611585565b1580156108ad57506108ab836109bc565b155b3332146108bb5760006108bf565b6152085b61ffff1681156109805760005a90506108d93387876118b3565b60006108f66127106108f0856108f05a8790611ae4565b90611b26565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce8079061094790889085906004016129b7565b600060405180830381600087803b15801561096157600080fd5b505af1158015610975573d6000803e3d6000fd5b50505050505061098b565b61098b3386866118b3565b5050505050565b603e6020526000908152604090205481565b73b04e030140b30c27bcdfaafffa98c57d80eda7b490565b6000603554603d83815481106109ce57fe5b906000526020600020906008020160050154603d84815481106109ed57fe5b90600052602060002090600802016004015401101590505b919050565b60335481565b6000610a1a6114d3565b8211158015610a295750600082115b610a455760405162461bcd60e51b815260040161088190612fad565b6000603d8381548110610a5457fe5b906000526020600020906008020190508060020154610a71611b4b565b11610a80576000915050610a05565b8060030154610a8d611b4b565b11610a9c576001915050610a05565b600681015460ff1615610ab3576005915050610a05565b80600501548160040154111580610ad557506035548160050154826004015401105b15610ae4576002915050610a05565b610b036034546108f06033548460030154611b2690919063ffffffff16565b610b0b611b4b565b10610b1a576006915050610a05565b6033546003820154610b2b91611b26565b610b33611b4b565b10610b42576004915050610a05565b6003915050610a05565b60408051808201909152601681527506a5ce0e4dee0dee6c2d85ae6e8c2e8ca5ae0c2e8c6d60531b602082015290565b603a5481565b6001600160a01b038381166000908152603c60205260408120549091163314610bbd5760405162461bcd60e51b81526004016108819061303d565b610bc8848484611b4f565b949350505050565b336000818152603c60205260409020546001600160a01b039081169190831614801590610c0657506001600160a01b0382163014155b8015610c1a57506001600160a01b03821615155b8015610c385750806001600160a01b0316826001600160a01b031614155b610c545760405162461bcd60e51b815260040161088190612e87565b6001600160a01b03811615610c9a576040516001600160a01b0382169033907f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7290600090a35b336000818152603c602052604080822080546001600160a01b0319166001600160a01b03871690811790915590519092917f4bc154dd35d6a5cb9206482ecb473cdbf2473006d6bce728b9cc0741bcc59ea291a35050565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f91610d4f9185916004016129b7565b600060405180830381600087803b158015610d6957600080fd5b505af1925050508015610d7a575060015b610dfd573d808015610da8576040519150601f19603f3d011682016040523d82523d6000602084013e610dad565b606091505b5080604051610dbc9190612987565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a350610e32565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e3b82611b77565b5050565b603c602052600090815260409020546001600160a01b031681565b60355481565b60345481565b333014610e855760405162461bcd60e51b815260040161088190612e50565b6033548110610ea65760405162461bcd60e51b815260040161088190612d74565b603a55565b333014610eca5760405162461bcd60e51b815260040161088190612e50565b603755565b7f000000000000000000000000000000000000000000000000000000000000000081565b336000908152603c60205260409020546001600160a01b031680610f295760405162461bcd60e51b815260040161088190612ff3565b336000818152603c602052604080822080546001600160a01b0319169055516001600160a01b03841692917f1af5b1c85495b3618ea659a1ba256c8b8974b437297d3b914e321e086a28da7291a350565b610f826109a4565b6001600160a01b0316336001600160a01b031614610fb25760405162461bcd60e51b815260040161088190612f86565b604051633a08bde160e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e822f78490610ffe908490600401612abd565b600060405180830381600087803b15801561101857600080fd5b505af115801561098b573d6000803e3d6000fd5b33301461104b5760405162461bcd60e51b815260040161088190612e50565b603455565b603b6020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b60365481565b603f6020526000908152604090205481565b6040546001600160a01b031681565b60385481565b336000818152603b60205260409081902054905163e113335f60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916111109185916004016129b7565b600060405180830381600087803b15801561112a57600080fd5b505af192505050801561113b575060015b6111be573d808015611169576040519150601f19603f3d011682016040523d82523d6000602084013e61116e565b606091505b508060405161117d9190612987565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506111f3565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b610e3b82611c5b565b600083511161121d5760405162461bcd60e51b815260040161088190612e26565b61124583838361122d8633611585565b158015611240575061123e866109bc565b155b611c65565b505050565b3330146112695760405162461bcd60e51b815260040161088190612e50565b603955565b600054610100900460ff16806112875750611287611ea8565b80611295575060005460ff16155b6112b15760405162461bcd60e51b815260040161088190612f38565b600054610100900460ff161580156112dc576000805460ff1961ff0019909116610100171660011790555b604080546001600160a01b038085166001600160a01b03199283161783558251610100818101855230825261dead602083019081526000958301868152606084018781526080850188815260a08601898152600160c0880181815260e089018c8152603d80549384018155909c52975160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b16928c169290921790915594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc4860180549190991699169890981790965590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc5830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc682015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc784015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc8830155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990910180549351151590920261ff001991151560ff19909416939093171691909117905561149c611eae565b8015610e3b576000805461ff00191690555050565b60395481565b60375481565b60006114ca338484611b4f565b90505b92915050565b603d546000190190565b60416020526000908152604090205481565b6114f76125d9565b603d838154811061150457fe5b600091825260208083206001600160a01b0395909516835260089190910290930160070183526040908190208151606081018352815460ff8082161515835261010090910416151594810194909452600101549083015250919050565b3330146115805760405162461bcd60e51b815260040161088190612e50565b603355565b6000603d838154811061159457fe5b600091825260208083206001600160a01b03861684526007600890930201919091019052604090205460ff16905092915050565b3330146115e75760405162461bcd60e51b815260040161088190612e50565b603855565b33301461160b5760405162461bcd60e51b815260040161088190612e50565b603655565b6116186109a4565b6001600160a01b0316336001600160a01b0316146116485760405162461bcd60e51b815260040161088190612f86565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166108fc61167f8347611eef565b6040518115909202916000818181858888f1935050505061169f57600080fd5b50565b6001600160a01b038087166000908152603b60205260409081902054905163e113335f60e01b815288927f0000000000000000000000000000000000000000000000000000000000000000169163e113335f916117039185916004016129b7565b600060405180830381600087803b15801561171d57600080fd5b505af192505050801561172e575060015b6117b1573d80801561175c576040519150601f19603f3d011682016040523d82523d6000602084013e611761565b606091505b50806040516117709190612987565b604051908190038120906001600160a01b038416907f5a6216e80d86159dc87dcebfe519205477a94005b7d9d6bd313606450a5344f690600090a3506117e6565b6040516001600160a01b038216907f9b227b0c1ae308b34f72d4fdf9a1943fa769ff4814933595e7bc5230a117698b90600090a25b6117f4878787878787611f05565b50505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b333014156118415760405162461bcd60e51b815260040161088190612c3d565b6000603d828154811061185057fe5b6000918252602080832060016008909302019182015485845260419091526040909220549092506001600160a01b0390911690813f9081146118a45760405162461bcd60e51b815260040161088190612d1e565b6118ad84611f85565b50505050565b60016118be83610a10565b60068111156118c957fe5b146118e65760405162461bcd60e51b815260040161088190612bf6565b6000603d83815481106118f557fe5b600091825260208083206001600160a01b038816845260076008909302019182018152604080842060058401546004850154603b9094529190942054929450101590806119545760405162461bcd60e51b815260040161088190612ebe565b825460ff16156119a3578254610100900460ff161561198a576001830154600485015461198091611ae4565b60048501556119a3565b6001830154600585015461199d91611ae4565b60058501555b84156119c25760048401546119b89082611b26565b60048501556119d7565b60058401546119d19082611b26565b60058501555b6006840154610100900460ff16158015611a075750603954611a056119fa611b4b565b600387015490611ae4565b105b15611a4b576005840154600485015411158215158114611a495760068501805461ff001916610100179055603a546003860154611a4391611b26565b60038601555b505b8254600160ff19909116811761ff001916610100871515021784558301819055603354603454603a546003870154611a96938b93611a919391926108f092839190611b26565b612117565b841515876001600160a01b0316877f7c2de587c00d75474a0c6c6fa96fd3b45dc974cd4e8a75f712bb84c950dce1b584604051611ad39190612abd565b60405180910390a450505050505050565b60006114ca83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612154565b6000828201838110156114ca5760405162461bcd60e51b815260040161088190612ce7565b4290565b6000611b5c848484612180565b6000818152604160205260409020933f909355509092915050565b336000908152603f6020526040902054611b8f611b4b565b11611bac5760405162461bcd60e51b815260040161088190612db8565b60408051808201825260208082527f476f7665726e616e63653a20696e73756666696369656e742062616c616e636581830152336000908152603b9091529190912054611bfa918390612154565b336000818152603b6020526040908190209290925590516391fe357360e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316916391fe357391610ffe919085906004016129b7565b61169f33826124ce565b3381328214611c75576000611c79565b6152085b61ffff168115611de45760005a905060005b8851811015611d42576000898281518110611ca257fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611ce257506001600160a01b03811633145b611cfe5760405162461bcd60e51b81526004016108819061303d565b861580611d125750611d108982611585565b155b611d2e5760405162461bcd60e51b8152600401610881906130ab565b611d39818a8a6118b3565b50600101611c8b565b506000611d5a6127106108f0856108f05a8790611ae4565b60405163a99ce80760e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a99ce80790611dab90889085906004016129b7565b600060405180830381600087803b158015611dc557600080fd5b505af1158015611dd9573d6000803e3d6000fd5b5050505050506117f4565b60005b8751811015611e9e576000888281518110611dfe57fe5b6020908102919091018101516001600160a01b038082166000908152603c90935260409092205490925016331480611e3e57506001600160a01b03811633145b611e5a5760405162461bcd60e51b81526004016108819061303d565b851580611e6e5750611e6c8882611585565b155b611e8a5760405162461bcd60e51b8152600401610881906130ab565b611e958189896118b3565b50600101611de7565b5050505050505050565b303b1590565b6202a3006033556203f480603481905569054b40b1f852bda00000603555683635c9adc5dea00000603655604b603755603855610e10603955615460603a55565b6000818310611efe57816114ca565b5090919050565b60408054905163d505accf60e01b81526001600160a01b039091169063d505accf90611f4190899030908a908a908a908a908a90600401612a3a565b600060405180830381600087803b158015611f5b57600080fd5b505af1158015611f6f573d6000803e3d6000fd5b50505050611f7d86866124ce565b505050505050565b6004611f9082610a10565b6006811115611f9b57fe5b14611fb85760405162461bcd60e51b815260040161088190612b30565b6000603d8281548110611fc757fe5b600091825260209091206006600890920201908101805460ff191660019081179091558101549091506001600160a01b0316612002816125d3565b61201e5760405162461bcd60e51b815260040161088190612aed565b60408051600481526024810182526020810180516001600160e01b03166306e60b1760e31b17905290516000916060916001600160a01b0385169161206291612987565b600060405180830381855af49150503d806000811461209d576040519150601f19603f3d011682016040523d82523d6000602084013e6120a2565b606091505b5091509150816120e5578051156120cd578060405162461bcd60e51b81526004016108819190612ada565b60405162461bcd60e51b815260040161088190613074565b60405185907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f90600090a25050505050565b6001600160a01b0382166000908152603f6020526040902054811115610e3b576001600160a01b03919091166000908152603f6020526040902055565b600081848411156121785760405162461bcd60e51b81526004016108819190612ada565b505050900390565b6001600160a01b0383166000908152603b60205260408120546036548110156121bb5760405162461bcd60e51b815260040161088190612c8a565b6121c4846125d3565b6121e05760405162461bcd60e51b815260040161088190612ef5565b6001600160a01b0385166000908152603e6020526040902054801561225257600061220a82610a10565b9050600181600681111561221a57fe5b141580156122345750600081600681111561223157fe5b14155b6122505760405162461bcd60e51b815260040161088190612b7b565b505b60006122626037546108f0611b4b565b9050600061227b60385483611b2690919063ffffffff16565b90506122856125f9565b506040805161010080820183526001600160a01b03808c1683528a8116602084019081529383018681526060840186815260006080860181815260a0870182815260c0880183815260e08901848152603d80546001810182559086528a5160089091027fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc381018054928b166001600160a01b03199384161790559b517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc48d01805491909a1691161790975594517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc58a015592517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc6890155517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc788015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc887015590517fece66cfdbd22e3f37d348a3d8e19074452862cd65fd4b9a11f0336d1ac6d1dc990950180549251151590930261ff001995151560ff199093169290921794909416179055906124376114d3565b82516001600160a01b03166000908152603e60205260409020819055603354603454603a54929350612479928d92611a919290916108f0919082908a90611b26565b896001600160a01b0316817f90ec05050aa23d54ba425e926fe646c318e85825bc400b13a46010abe86eb2f08b87878d6040516124b99493929190612a7b565b60405180910390a39998505050505050505050565b6040805490516323b872dd60e01b81526001600160a01b03909116906323b872dd906125229085907f00000000000000000000000000000000000000000000000000000000000000009086906004016129d0565b602060405180830381600087803b15801561253c57600080fd5b505af1158015612550573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061257491906128cc565b6125905760405162461bcd60e51b815260040161088190612def565b6001600160a01b0382166000908152603b60205260409020546125b39082611b26565b6001600160a01b039092166000908152603b602052604090209190915550565b3b151590565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b80356001600160a01b03811681146114cd57600080fd5b80356114cd8161316f565b600082601f830112612686578081fd5b813567ffffffffffffffff81111561269c578182fd5b6126af601f8201601f1916602001613107565b91508082528360208285010111156126c657600080fd5b8060208401602084013760009082016020015292915050565b6000602082840312156126f0578081fd5b6114ca8383612654565b60008060006060848603121561270e578182fd5b83356127198161315a565b925060208401356127298161315a565b9150604084013567ffffffffffffffff811115612744578182fd5b61275086828701612676565b9150509250925092565b6000806040838503121561276c578182fd5b82356127778161315a565b9150602083013567ffffffffffffffff811115612792578182fd5b61279e85828601612676565b9150509250929050565b60008060008060008060c087890312156127c0578182fd5b6127ca8888612654565b95506020870135945060408701359350606087013560ff811681146127ed578283fd5b9598949750929560808101359460a0909101359350915050565b60008060006060848603121561281b578283fd5b833567ffffffffffffffff80821115612832578485fd5b818601915086601f830112612845578485fd5b813581811115612853578586fd5b60209150818102612865838201613107565b8281528381019085850183870186018c101561287f57898afd5b8996505b848710156128a9576128958c82612654565b835260019690960195918501918501612883565b50975050505085013592506128c39050856040860161266b565b90509250925092565b6000602082840312156128dd578081fd5b81516114ca8161316f565b6000602082840312156128f9578081fd5b5035919050565b60008060408385031215612912578182fd5b823591506129238460208501612654565b90509250929050565b6000806040838503121561293e578182fd5b8235915060208301356129508161316f565b809150509250929050565b6000815180845261297381602086016020860161312e565b601f01601f19169290920160200192915050565b6000825161299981846020870161312e565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a0830152151560c082015290151560e08201526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b038616825284602083015283604083015260806060830152612aa8608083018461295b565b9695505050505050565b901515815260200190565b90815260200190565b6020810160078310612ad457fe5b91905290565b6000602082526114ca602083018461295b565b60208082526023908201527f476f7665726e616e63653a3a657865637574653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602b908201527f476f7665726e616e63653a3a657865637574653a20696e76616c69642070726f60408201526a706f73616c20737461746560a81b606082015260800190565b60208082526055908201527f476f7665726e616e63653a3a70726f706f73653a206f6e65206c69766520707260408201527f6f706f73616c207065722070726f706f7365722c20666f756e6420616e20616c6060820152741c9958591e481858dd1a5d99481c1c9bdc1bdcd85b605a1b608082015260a00190565b60208082526027908201527f476f7665726e616e63653a3a5f63617374566f74653a20766f74696e672069736040820152660818db1bdcd95960ca1b606082015260800190565b6020808252602d908201527f476f7665726e616e63653a3a70726f706f73653a2070736575646f2d6578746560408201526c393730b610333ab731ba34b7b760991b606082015260800190565b6020808252603c908201527f476f7665726e616e63653a3a70726f706f73653a2070726f706f73657220766f60408201527f7465732062656c6f772070726f706f73616c207468726573686f6c6400000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526036908201527f476f7665726e616e63653a3a70726f706f73653a206d6574616d6f72706869636040820152750818dbdb9d1c9858dd1cc81b9bdd08185b1b1bddd95960521b606082015260800190565b60208082526024908201527f476f7665726e616e63653a20696e636f727265637420766f7465457874656e6460408201526354696d6560e01b606082015260800190565b6020808252601d908201527f476f7665726e616e63653a20746f6b656e7320617265206c6f636b6564000000604082015260600190565b60208082526019908201527f544f524e3a207472616e7366657246726f6d206661696c656400000000000000604082015260600190565b60208082526010908201526f43616e206e6f7420626520656d70747960801b604082015260600190565b60208082526018908201527f476f7665726e616e63653a20756e617574686f72697a65640000000000000000604082015260600190565b6020808252601d908201527f476f7665726e616e63653a20696e76616c69642064656c656761746565000000604082015260600190565b60208082526018908201527f476f7665726e616e63653a2062616c616e636520697320300000000000000000604082015260600190565b60208082526023908201527f476f7665726e616e63653a3a70726f706f73653a206e6f74206120636f6e74726040820152621858dd60ea1b606082015260800190565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252600d908201526c6f6e6c79206d756c746973696760981b604082015260600190565b60208082526026908201527f476f7665726e616e63653a3a73746174653a20696e76616c69642070726f706f6040820152651cd85b081a5960d21b606082015260800190565b6020808252602a908201527f476f7665726e616e63653a20746f6b656e732061726520616c726561647920756040820152691b99195b1959d85d195960b21b606082015260800190565b6020808252601a908201527f476f7665726e616e63653a206e6f7420617574686f72697a6564000000000000604082015260600190565b60208082526019908201527f50726f706f73616c20657865637574696f6e206661696c656400000000000000604082015260600190565b60208082526019908201527f476f7665726e616e63653a20766f74656420616c726561647900000000000000604082015260600190565b8151151581526020808301511515908201526040918201519181019190915260600190565b60405181810167ffffffffffffffff8111828210171561312657600080fd5b604052919050565b60005b83811015613149578181015183820152602001613131565b838111156118ad5750506000910152565b6001600160a01b038116811461169f57600080fd5b801515811461169f57600080fdfea26469706673582212209ae80078297b488112cf4c0eaef3af85f34156332aa7d60065ce1ebb90ab93c264736f6c634300060c0033";class mr extends Ya{constructor(...e){e.length>1?super(...e):super(or,lr,e[0])}getDeployTransaction(e,t,a,n){return super.getDeployTransaction(e,t,a,n||{})}deploy(e,t,a,n){return super.deploy(e,t,a,n||{})}connect(e){return super.connect(e)}static bytecode=lr;static abi=or;static createInterface(){return new ba(or)}static connect(e,t){return new Wa(e,or,t)}}var Tr=Object.freeze({__proto__:null,GovernanceProposalStateUpgrade__factory:mr});const gr=[{inputs:[{internalType:"address",name:"_logic",type:"address"},{internalType:"address",name:"_admin",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"}],stateMutability:"payable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"previousAdmin",type:"address"},{indexed:!1,internalType:"address",name:"newAdmin",type:"address"}],name:"AdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{stateMutability:"payable",type:"fallback"},{inputs:[],name:"admin",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newAdmin",type:"address"}],name:"changeAdmin",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"implementation",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{stateMutability:"payable",type:"receive"}],wr="0x60806040526040516108403803806108408339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508390508282816100f1826101c5565b8051156101a9576000826001600160a01b0316826040518082805190602001908083835b602083106101345780518252601f199092019160209182019101610115565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610194576040519150601f19603f3d011682016040523d82523d6000602084013e610199565b606091505b50509050806101a757600080fd5b505b506101b19050565b6101ba82610237565b505050505050610261565b6101d88161025b60201b6103b41760201c565b6102135760405162461bcd60e51b815260040180806020018281038252603681526020018061080a6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3b151590565b61059a806102706000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996101a9565b6101a96101a46103ba565b6103df565b565b6101b3610403565b6001600160a01b0316336001600160a01b031614156101da576101d581610428565b6101e2565b6101e2610191565b50565b6101ed610403565b6001600160a01b0316336001600160a01b031614156102855761020f83610428565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610403565b6001600160a01b0316336001600160a01b031614156102c4576102bd6103ba565b90506102cc565b6102cc610191565b90565b6102d7610403565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b815260040180806020018281038252603a8152602001806104f5603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610403565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d581610468565b6000610393610403565b6001600160a01b0316336001600160a01b031614156102c4576102bd610403565b3b151590565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156103fe573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6104318161048c565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610495816103b4565b6104d05760405162461bcd60e51b815260040180806020018281038252603681526020018061052f6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374a2646970667358221220f9da162f8a2d779a4f5f08577ac886bc4694791f749bd6ecc5d270427405583364736f6c634300060c00335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374";class hr extends Ya{constructor(...e){e.length>1?super(...e):super(gr,wr,e[0])}getDeployTransaction(e,t,a,n){return super.getDeployTransaction(e,t,a,n||{})}deploy(e,t,a,n){return super.deploy(e,t,a,n||{})}connect(e){return super.connect(e)}static bytecode=wr;static abi=gr;static createInterface(){return new ba(gr)}static connect(e,t){return new Wa(e,gr,t)}}const vr=[{inputs:[{internalType:"address",name:"_torn",type:"address"},{internalType:"address",name:"_governance",type:"address"},{internalType:"address",name:"_registry",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"instance",type:"address"},{indexed:!1,internalType:"uint256",name:"newFee",type:"uint256"}],name:"FeeUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint24",name:"newFee",type:"uint24"}],name:"UniswapTornPoolSwappingFeeChanged",type:"event"},{inputs:[],name:"PROTOCOL_FEE_DIVIDER",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract ITornadoInstance",name:"_instance",type:"address"}],name:"calculatePoolFee",outputs:[{internalType:"uint160",name:"",type:"uint160"}],stateMutability:"view",type:"function"},{inputs:[],name:"feeDeviations",outputs:[{components:[{internalType:"address",name:"instance",type:"address"},{internalType:"int256",name:"deviation",type:"int256"}],internalType:"struct FeeManager.Deviation[]",name:"results",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"governance",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract ITornadoInstance",name:"",type:"address"}],name:"instanceFee",outputs:[{internalType:"uint160",name:"",type:"uint160"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract ITornadoInstance",name:"",type:"address"}],name:"instanceFeeUpdated",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract ITornadoInstance",name:"_instance",type:"address"}],name:"instanceFeeWithUpdate",outputs:[{internalType:"uint160",name:"",type:"uint160"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"registry",outputs:[{internalType:"contract InstanceRegistry",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint32",name:"newPeriod",type:"uint32"}],name:"setPeriodForTWAPOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint24",name:"_uniswapTornPoolSwappingFee",type:"uint24"}],name:"setUniswapTornPoolSwappingFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint24",name:"newLimit",type:"uint24"}],name:"setUpdateFeeTimeLimit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"torn",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"uniswapTimePeriod",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"uniswapTornPoolSwappingFee",outputs:[{internalType:"uint24",name:"",type:"uint24"}],stateMutability:"view",type:"function"},{inputs:[],name:"updateAllFees",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract ITornadoInstance",name:"_instance",type:"address"}],name:"updateFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"updateFeeTimeLimit",outputs:[{internalType:"uint24",name:"",type:"uint24"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract ITornadoInstance[]",name:"_instances",type:"address[]"}],name:"updateFees",outputs:[],stateMutability:"nonpayable",type:"function"}],Mr="0x60e06040523480156200001157600080fd5b5060405162001a8938038062001a8983398101604081905262000034916200005c565b6001600160601b0319606093841b811660805291831b821660a05290911b1660c052620000c8565b60008060006060848603121562000071578283fd5b83516200007e81620000af565b60208501519093506200009181620000af565b6040850151909250620000a481620000af565b809150509250925092565b6001600160a01b0381168114620000c557600080fd5b50565b60805160601c60a05160601c60c05160601c61196862000121600039806102ce52806104f6528061077752806109945250806104b7528061052e528061060f528061070852508061068f528061087e52506119686000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c8063a0287520116100a2578063bcc5ee6411610071578063bcc5ee641461020f578063c51c229714610217578063d8718fb11461022a578063e1f121561461023f578063f522d6d61461025257610116565b8063a0287520146101d9578063adf898a4146101ec578063aeb3077a146101f4578063b19a2972146101fc57610116565b8063603a54fe116100e9578063603a54fe146101815780637b103999146101945780637ccd2f481461019c57806380679eb3146101b157806380eb7bf0146101c657610116565b806305e343641461011b5780632efbf384146101445780634bf0a542146101645780635aa6e67514610179575b600080fd5b61012e610129366004611650565b61025a565b60405161013b9190611896565b60405180910390f35b610157610152366004611650565b61026c565b60405161013b91906116dd565b61016c6102c9565b60405161013b9190611719565b6101576104b5565b61015761018f366004611650565b6104d9565b6101576104f4565b6101a4610518565b60405161013b9190611886565b6101c46101bf3660046116a0565b610523565b005b6101c46101d4366004611650565b61057e565b6101c46101e736600461166c565b610604565b61015761068d565b61012e6106b1565b6101c461020a3660046113ef565b6106b7565b6101a46106eb565b6101c461022536600461166c565b6106fd565b61023261075a565b60405161013b919061189f565b61015761024d366004611650565b61076d565b6101c461098f565b60026020526000908152604090205481565b600080546001600160a01b038316825260026020526040822054600160381b90910462ffffff16429190910311156102a7576102a78261057e565b506001600160a01b03808216600090815260016020526040902054165b919050565b6060807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166310c13ac36040518163ffffffff1660e01b815260040160006040518083038186803b15801561032557600080fd5b505afa158015610339573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103619190810190611487565b9050805167ffffffffffffffff8111801561037b57600080fd5b506040519080825280602002602001820160405280156103b557816020015b6103a261131d565b81526020019060019003908161039a5790505b50915060005b81518110156104b05760006103e28383815181106103d557fe5b602002602001015161076d565b6001600160a01b031690506000811561045e576103e8826001600087878151811061040957fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060009054906101000a90046001600160a01b03166103e8026001600160a01b03168161045957fe5b040390505b604051806040016040528085858151811061047557fe5b60200260200101516001600160a01b031681526020018281525085848151811061049b57fe5b602090810291909101015250506001016103bb565b505090565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001602052600090815260409020546001600160a01b031681565b7f000000000000000000000000000000000000000000000000000000000000000081565b60005462ffffff1681565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461055857600080fd5b6000805463ffffffff90921663010000000266ffffffff00000019909216919091179055565b60006105898261076d565b6001600160a01b03838116600081815260016020908152604080832080546001600160a01b03191695871695909517909455600290528290204290559051919250907f6f0eaf2c2f89fb4cfe96a1dee5e764d60b52c7f48aaa590f0850e308aa1b953a906105f89084906116dd565b60405180910390a25050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461063957600080fd5b6000805462ffffff191662ffffff83811691909117918290556040517fbfe65cfc2359076c4468c9b895156c309c78f94fb09f6d2fc0463c4ca9a71ac292610682921690611886565b60405180910390a150565b7f000000000000000000000000000000000000000000000000000000000000000081565b61271081565b60005b81518110156106e7576106df8282815181106106d257fe5b602002602001015161057e565b6001016106ba565b5050565b600054600160381b900462ffffff1681565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461073257600080fd5b6000805462ffffff909216600160381b0269ffffff0000000000000019909216919091179055565b6000546301000000900463ffffffff1681565b60008060008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663032bb443876040518263ffffffff1660e01b81526004016107c191906116dd565b60a06040518083038186803b1580156107d957600080fd5b505afa1580156107ed573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081191906115d5565b9450945050935093508063ffffffff16600014156108365760009450505050506102c4565b6001600160a01b03831615801561084b575083155b610855578261086b565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25b6040805180820182526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081168252831660208083019190915282518084019093526000805462ffffff80821686528816928501929092529396506108e5929063ffffffff630100000090910416610a29565b905061098461271061097e8463ffffffff166109788561097e670de0b6b3a76400008e6001600160a01b0316638bca6d166040518163ffffffff1660e01b815260040160206040518083038186803b15801561094057600080fd5b505afa158015610954573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109789190611688565b90610a75565b90610ac1565b979650505050505050565b610a277f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166310c13ac36040518163ffffffff1660e01b815260040160006040518083038186803b1580156109eb57600080fd5b505afa1580156109ff573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261020a9190810190611487565b565b60208084015190830151600091610a409184610b03565b84518451610a6391670de0b6b3a764000091610a5d919087610b03565b90610b2d565b81610a6a57fe5b0490505b9392505050565b600082610a8457506000610abb565b82820282848281610a9157fe5b0414610ab85760405162461bcd60e51b8152600401610aaf90611845565b60405180910390fd5b90505b92915050565b6000610ab883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610b51565b6000610b258473c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28585610b88565b949350505050565b6000821580610b4857505081810281838281610b4557fe5b04145b610abb57600080fd5b60008183610b725760405162461bcd60e51b8152600401610aaf91906117bb565b506000838581610b7e57fe5b0495945050505050565b600080846001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610bc457600080fd5b505afa158015610bd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfc91906116bc565b60ff16600a0a90506001600160a01b038681169086161415610c28576001600160801b03169050610b25565b604051630b4c774160e11b8152610cc990610cc190731f98431c8ad98523631ae4a59f267346ea31f98490631698ee8290610c6b908b908b908b906004016116f1565b60206040518083038186803b158015610c8357600080fd5b505afa158015610c97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cbb91906113d3565b85610cda565b828888610e6f565b915050610b25565b50949350505050565b600063ffffffff8216610cff5760405162461bcd60e51b8152600401610aaf9061180e565b60408051600280825260608083018452926020830190803683370190505090508281600081518110610d2d57fe5b602002602001019063ffffffff16908163ffffffff1681525050600081600181518110610d5657fe5b63ffffffff9092166020928302919091019091015260405163883bdbfd60e01b81526060906001600160a01b0386169063883bdbfd90610d9a908590600401611771565b60006040518083038186803b158015610db257600080fd5b505afa158015610dc6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610dee9190810190611513565b509050600081600081518110610e0057fe5b602002602001015182600181518110610e1557fe5b60200260200101510390508463ffffffff168160060b81610e3257fe5b05935060008160060b128015610e5957508463ffffffff168160060b81610e5557fe5b0715155b15610e6657600019909301925b50505092915050565b600080610e7b86610f59565b90506001600160801b036001600160a01b03821611610eea576001600160a01b0380821680029084811690861610610eca57610ec5600160c01b876001600160801b031683611272565b610ee2565b610ee281876001600160801b0316600160c01b611272565b925050610cd1565b6000610f096001600160a01b0383168068010000000000000000611272565b9050836001600160a01b0316856001600160a01b031610610f4157610f3c600160801b876001600160801b031683611272565b610984565b61098481876001600160801b0316600160801b611272565b60008060008360020b12610f70578260020b610f78565b8260020b6000035b9050620d89e8811115610f9d5760405162461bcd60e51b8152600401610aaf9061182a565b600060018216610fb157600160801b610fc3565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615610ff7576ffff97272373d413259a46990580e213a0260801c5b6004821615611016576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615611035576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615611054576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615611073576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615611092576fff2ea16466c96a3843ec78b326b528610260801c5b60808216156110b1576ffe5dee046a99a2a811c461f1969c30530260801c5b6101008216156110d1576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b6102008216156110f1576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615611111576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615611131576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615611151576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615611171576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615611191576f70d869a156d2a1b890bb3df62baf32f70260801c5b6180008216156111b1576f31be135f97d08fd981231505542fcfa60260801c5b620100008216156111d2576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b620200008216156111f2576e5d6af8dedb81196699c329225ee6040260801c5b62040000821615611211576d2216e584f5fa1ea926041bedfe980260801c5b6208000082161561122e576b048a170391f7dc42444e8fa20260801c5b60008460020b131561124957806000198161124557fe5b0490505b64010000000081061561125d576001611260565b60005b60ff16602082901c0192505050919050565b60008080600019858709868602925082811090839003039050806112a8576000841161129d57600080fd5b508290049050610a6e565b8084116112b457600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b604080518082019091526000808252602082015290565b600082601f830112611344578081fd5b8151611357611352826118d7565b6118b0565b81815291506020808301908481018184028601820187101561137857600080fd5b60005b848110156113a057815161138e816118f7565b8452928201929082019060010161137b565b505050505092915050565b8035610abb816118f7565b8051610abb816118f7565b8051600681900b8114610abb57600080fd5b6000602082840312156113e4578081fd5b8151610ab8816118f7565b60006020808385031215611401578182fd5b823567ffffffffffffffff811115611417578283fd5b8301601f81018513611427578283fd5b8035611435611352826118d7565b8181528381019083850185840285018601891015611451578687fd5b8694505b8385101561147b5761146789826113ab565b835260019490940193918501918501611455565b50979650505050505050565b60006020808385031215611499578182fd5b825167ffffffffffffffff8111156114af578283fd5b8301601f810185136114bf578283fd5b80516114cd611352826118d7565b81815283810190838501858402850186018910156114e9578687fd5b8694505b8385101561147b576114ff89826113b6565b8352600194909401939185019185016114ed565b60008060408385031215611525578081fd5b825167ffffffffffffffff8082111561153c578283fd5b818501915085601f83011261154f578283fd5b815161155d611352826118d7565b80828252602080830192508086018a82838702890101111561157d578788fd5b8796505b848710156115a7576115938b826113c1565b845260019690960195928101928101611581565b5088015190965093505050808211156115be578283fd5b506115cb85828601611334565b9150509250929050565b600080600080600060a086880312156115ec578081fd5b855180151581146115fb578182fd5b602087015190955061160c816118f7565b604087015190945060028110611620578182fd5b60608701519093506116318161190f565b608087015190925061164281611920565b809150509295509295909350565b600060208284031215611661578081fd5b8135610ab8816118f7565b60006020828403121561167d578081fd5b8135610ab88161190f565b600060208284031215611699578081fd5b5051919050565b6000602082840312156116b1578081fd5b8135610ab881611920565b6000602082840312156116cd578081fd5b815160ff81168114610ab8578182fd5b6001600160a01b0391909116815260200190565b6001600160a01b03938416815291909216602082015262ffffff909116604082015260600190565b602080825282518282018190526000919060409081850190868401855b8281101561176457815180516001600160a01b03168552860151868501529284019290850190600101611736565b5091979650505050505050565b6020808252825182820181905260009190848201906040850190845b818110156117af57835163ffffffff168352928401929184019160010161178d565b50909695505050505050565b6000602080835283518082850152825b818110156117e7578581018301518582016040015282016117cb565b818111156117f85783604083870101525b50601f01601f1916929092016040019392505050565b602080825260029082015261042560f41b604082015260600190565b6020808252600190820152601560fa1b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b62ffffff91909116815260200190565b90815260200190565b63ffffffff91909116815260200190565b60405181810167ffffffffffffffff811182821017156118cf57600080fd5b604052919050565b600067ffffffffffffffff8211156118ed578081fd5b5060209081020190565b6001600160a01b038116811461190c57600080fd5b50565b62ffffff8116811461190c57600080fd5b63ffffffff8116811461190c57600080fdfea26469706673582212205690be246e00d9bf30da35441a160026439ececfa962348f01e498d25f89f5d164736f6c634300060c0033";class _r extends Ya{constructor(...e){e.length>1?super(...e):super(vr,Mr,e[0])}getDeployTransaction(e,t,a,n){return super.getDeployTransaction(e,t,a,n||{})}deploy(e,t,a,n){return super.deploy(e,t,a,n||{})}connect(e){return super.connect(e)}static bytecode=Mr;static abi=vr;static createInterface(){return new ba(vr)}static connect(e,t){return new Wa(e,vr,t)}}const xr=[{inputs:[{internalType:"address",name:"_governance",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"GovernanceAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"gasAmount",type:"uint256"}],name:"compensateGas",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawToGovernance",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],Ir="0x60a060405234801561001057600080fd5b5060405161047838038061047883398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516103da61009e6000396000818160560152818160e101528181610212015261027701526103da6000f3fe6080604052600436106100385760003560e01c8063a3221c2e14610044578063a99ce80714610094578063e822f784146100b657600080fd5b3661003f57005b600080fd5b34801561005057600080fd5b506100787f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200160405180910390f35b3480156100a057600080fd5b506100b46100af366004610328565b6100d6565b005b3480156100c257600080fd5b506100b46100d1366004610360565b610207565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461013e5760405162461bcd60e51b815260206004820152600860248201526737b7363c9033b7bb60c11b60448201526064015b60405180910390fd5b47600061014b4884610379565b90508160000361015b5750505050565b6000846001600160a01b03168383116101745782610176565b835b604051600081818185875af1925050503d80600081146101b2576040519150601f19603f3d011682016040523d82523d6000602084013e6101b7565b606091505b50509050806102005760405162461bcd60e51b815260206004820152601560248201527418dbdb5c195b9cd85d194819d85cc819985a5b1959605a1b6044820152606401610135565b5050505050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461026a5760405162461bcd60e51b815260206004820152600860248201526737b7363c9033b7bb60c11b6044820152606401610135565b4760006001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168284116102a457836102a6565b825b604051600081818185875af1925050503d80600081146102e2576040519150601f19603f3d011682016040523d82523d6000602084013e6102e7565b606091505b50509050806103235760405162461bcd60e51b81526020600482015260086024820152671c185e4819985a5b60c21b6044820152606401610135565b505050565b6000806040838503121561033b57600080fd5b82356001600160a01b038116811461035257600080fd5b946020939093013593505050565b60006020828403121561037257600080fd5b5035919050565b808202811582820484141761039e57634e487b7160e01b600052601160045260246000fd5b9291505056fea2646970667358221220fbe5a836dfa015bd3b2b1ffb61149001940255ee2f1f9b05c13681937e89ff9264736f6c634300081c0033";class Er extends Ya{constructor(...e){e.length>1?super(...e):super(xr,Ir,e[0])}getDeployTransaction(e,t){return super.getDeployTransaction(e,t||{})}deploy(e,t){return super.deploy(e,t||{})}connect(e){return super.connect(e)}static bytecode=Ir;static abi=xr;static createInterface(){return new ba(xr)}static connect(e,t){return new Wa(e,xr,t)}}const Rr=[{inputs:[{internalType:"address",name:"_logic",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"}],stateMutability:"payable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"previousAdmin",type:"address"},{indexed:!1,internalType:"address",name:"newAdmin",type:"address"}],name:"AdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{stateMutability:"payable",type:"fallback"},{inputs:[],name:"admin",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newAdmin",type:"address"}],name:"changeAdmin",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"implementation",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{stateMutability:"payable",type:"receive"}],Or="0x608060405260405161083b38038061083b8339818101604052604081101561002657600080fd5b81516020830180516040519294929383019291908464010000000082111561004d57600080fd5b90830190602082018581111561006257600080fd5b825164010000000081118282018810171561007c57600080fd5b82525081516020918201929091019080838360005b838110156100a9578181015183820152602001610091565b50505050905090810190601f1680156100d65780820380516001836020036101000a031916815260200191505b50604052508391503090508282816100ed826101c0565b8051156101a5576000826001600160a01b0316826040518082805190602001908083835b602083106101305780518252601f199092019160209182019101610111565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610190576040519150601f19603f3d011682016040523d82523d6000602084013e610195565b606091505b50509050806101a357600080fd5b505b506101ad9050565b6101b682610232565b505050505061025c565b6101d38161025660201b6103b41760201c565b61020e5760405162461bcd60e51b81526004018080602001828103825260368152602001806108056036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3b151590565b61059a8061026b6000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996101a9565b6101a96101a46103ba565b6103df565b565b6101b3610403565b6001600160a01b0316336001600160a01b031614156101da576101d581610428565b6101e2565b6101e2610191565b50565b6101ed610403565b6001600160a01b0316336001600160a01b031614156102855761020f83610428565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610403565b6001600160a01b0316336001600160a01b031614156102c4576102bd6103ba565b90506102cc565b6102cc610191565b90565b6102d7610403565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b815260040180806020018281038252603a8152602001806104f5603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610403565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d581610468565b6000610393610403565b6001600160a01b0316336001600160a01b031614156102c4576102bd610403565b3b151590565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156103fe573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6104318161048c565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610495816103b4565b6104d05760405162461bcd60e51b815260040180806020018281038252603681526020018061052f6036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374a264697066735822122014d721b179bdff3154685a6f1f0fecdd0d99b7cfc61b3f1a2f7a95c6f6d2c2ae64736f6c634300060c00335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374";class kr extends Ya{constructor(...e){e.length>1?super(...e):super(Rr,Or,e[0])}getDeployTransaction(e,t,a){return super.getDeployTransaction(e,t,a||{})}deploy(e,t,a){return super.deploy(e,t,a||{})}connect(e){return super.connect(e)}static bytecode=Or;static abi=Rr;static createInterface(){return new ba(Rr)}static connect(e,t){return new Wa(e,Rr,t)}}const Pr=[{inputs:[{internalType:"bytes",name:"_initCode",type:"bytes"},{internalType:"bytes32",name:"_salt",type:"bytes32"}],name:"deploy",outputs:[{internalType:"address payable",name:"createdContract",type:"address"}],stateMutability:"nonpayable",type:"function"}],Ar="0x608060405234801561001057600080fd5b50610134806100206000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80634af63f0214602d575b600080fd5b60cf60048036036040811015604157600080fd5b810190602081018135640100000000811115605b57600080fd5b820183602082011115606c57600080fd5b80359060200191846001830284011164010000000083111715608d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550509135925060eb915050565b604080516001600160a01b039092168252519081900360200190f35b6000818351602085016000f5939250505056fea26469706673582212208761ae5cfc40689ce98cd25a56b929c259b167501a941e4f0164890ebab1c0bb64736f6c634300060c0033";class Cr extends Ya{constructor(...e){e.length>1?super(...e):super(Pr,Ar,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static bytecode=Ar;static abi=Pr;static createInterface(){return new ba(Pr)}static connect(e,t){return new Wa(e,Pr,t)}}const Sr=[{inputs:[{internalType:"address",name:"_governance",type:"address"},{internalType:"address",name:"_instanceRegistry",type:"address"},{internalType:"address",name:"_relayerRegistry",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"bytes",name:"encryptedNote",type:"bytes"}],name:"EncryptedNote",type:"event"},{inputs:[{internalType:"contract IERC20",name:"_token",type:"address"},{internalType:"address",name:"_spender",type:"address"},{internalType:"uint256",name:"_amount",type:"uint256"}],name:"approveExactToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes[]",name:"_encryptedNotes",type:"bytes[]"}],name:"backupNotes",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract ITornadoInstance",name:"_tornado",type:"address"},{internalType:"bytes32",name:"_commitment",type:"bytes32"},{internalType:"bytes",name:"_encryptedNote",type:"bytes"}],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"governance",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"instanceRegistry",outputs:[{internalType:"contract InstanceRegistry",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"relayerRegistry",outputs:[{internalType:"contract RelayerRegistry",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"_token",type:"address"},{internalType:"address payable",name:"_to",type:"address"},{internalType:"uint256",name:"_amount",type:"uint256"}],name:"rescueTokens",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract ITornadoInstance",name:"_tornado",type:"address"},{internalType:"bytes",name:"_proof",type:"bytes"},{internalType:"bytes32",name:"_root",type:"bytes32"},{internalType:"bytes32",name:"_nullifierHash",type:"bytes32"},{internalType:"address payable",name:"_recipient",type:"address"},{internalType:"address payable",name:"_relayer",type:"address"},{internalType:"uint256",name:"_fee",type:"uint256"},{internalType:"uint256",name:"_refund",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"payable",type:"function"}],Nr="0x60e060405234801561001057600080fd5b5060405161128438038061128483398101604081905261002f91610056565b6001600160601b0319606093841b811660805291831b821660a05290911b1660c0526100ba565b60008060006060848603121561006a578283fd5b8351610075816100a2565b6020850151909350610086816100a2565b6040850151909250610097816100a2565b809150509250925092565b6001600160a01b03811681146100b757600080fd5b50565b60805160601c60a05160601c60c05160601c61117c610108600039806103ff528061059e525080610164528061037a52806103a752806104c8525080610423528061068e525061117c6000f3fe60806040526004361061007b5760003560e01c80635aa6e6751161004e5780635aa6e675146100f55780636485ba2a1461010a578063b438689f1461012a578063cea9d26f1461013d5761007b565b806313d98d131461008057806336a3874b146100955780633ef10783146100c057806347ff589d146100e0575b600080fd5b61009361008e366004610c77565b61015d565b005b3480156100a157600080fd5b506100aa610378565b6040516100b79190610dd0565b60405180910390f35b3480156100cc57600080fd5b506100936100db366004610c37565b61039c565b3480156100ec57600080fd5b506100aa6103fd565b34801561010157600080fd5b506100aa610421565b34801561011657600080fd5b50610093610125366004610b26565b610445565b610093610138366004610cd1565b6104ae565b34801561014957600080fd5b50610093610158366004610c37565b610683565b60008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663032bb443886040518263ffffffff1660e01b81526004016101ae9190610dd0565b60a06040518083038186803b1580156101c657600080fd5b505afa1580156101da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fe9190610bb1565b5092955090935091506000905081600181111561021757fe5b141561023e5760405162461bcd60e51b815260040161023590610f00565b60405180910390fd5b82156102cc576102cc3330896001600160a01b0316638bca6d166040518163ffffffff1660e01b815260040160206040518083038186803b15801561028257600080fd5b505afa158015610296573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ba9190610d72565b6001600160a01b038616929190610817565b60405163b214faa560e01b81526001600160a01b0388169063b214faa59034906102fa908a90600401610e5e565b6000604051808303818588803b15801561031357600080fd5b505af1158015610327573d6000803e3d6000fd5b5050505050336001600160a01b03167ffa28df43db3553771f7209dcef046f3bdfea15870ab625dcda30ac58b82b40088686604051610367929190610e67565b60405180910390a250505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146103e45760405162461bcd60e51b815260040161023590611087565b6103f86001600160a01b0384168383610875565b505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60005b818110156103f857337ffa28df43db3553771f7209dcef046f3bdfea15870ab625dcda30ac58b82b400884848481811061047e57fe5b905060200281019061049091906110af565b60405161049e929190610e67565b60405180910390a2600101610448565b60405163032bb44360e01b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063032bb443906104fd908d90600401610dd0565b60a06040518083038186803b15801561051557600080fd5b505afa158015610529573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054d9190610bb1565b509093506000925061055d915050565b81600181111561056957fe5b14156105875760405162461bcd60e51b815260040161023590610f00565b604051631168473b60e21b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906345a11cec906105d790339088908f90600401610de4565b600060405180830381600087803b1580156105f157600080fd5b505af1158015610605573d6000803e3d6000fd5b50506040516310d056db60e11b81526001600160a01b038d1692506321a0adb691503490610645908d908d908d908d908d908d908d908d90600401610e7b565b6000604051808303818588803b15801561065e57600080fd5b505af1158015610672573d6000803e3d6000fd5b505050505050505050505050505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146106cb5760405162461bcd60e51b815260040161023590611087565b6001600160a01b0382166106f15760405162461bcd60e51b815260040161023590610f6e565b6001600160a01b03831661074d5747600061070c8284610938565b6040519091506001600160a01b0385169082156108fc029083906000818181858888f19350505050158015610745573d6000803e3d6000fd5b5050506103f8565b6040516370a0823160e01b81526000906001600160a01b038516906370a082319061077c903090600401610dd0565b60206040518083038186803b15801561079457600080fd5b505afa1580156107a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107cc9190610d72565b905060006107da8284610938565b9050600081116107fc5760405162461bcd60e51b815260040161023590610ffa565b6108106001600160a01b0386168583610950565b5050505050565b61086f846323b872dd60e01b85858560405160240161083893929190610e21565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261096f565b50505050565b8015806108fd5750604051636eb1769f60e11b81526001600160a01b0384169063dd62ed3e906108ab9030908690600401610e07565b60206040518083038186803b1580156108c357600080fd5b505afa1580156108d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108fb9190610d72565b155b6109195760405162461bcd60e51b815260040161023590611031565b6103f88363095ea7b360e01b8484604051602401610838929190610e45565b60008183106109475781610949565b825b9392505050565b6103f88363a9059cbb60e01b8484604051602401610838929190610e45565b60606109c4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166109fe9092919063ffffffff16565b8051909150156103f857808060200190518101906109e29190610b95565b6103f85760405162461bcd60e51b815260040161023590610fb0565b6060610a0d8484600085610a15565b949350505050565b6060610a2085610ad9565b610a3c5760405162461bcd60e51b815260040161023590610f37565b60006060866001600160a01b03168587604051610a599190610db4565b60006040518083038185875af1925050503d8060008114610a96576040519150601f19603f3d011682016040523d82523d6000602084013e610a9b565b606091505b50915091508115610aaf579150610a0d9050565b805115610abf5780518082602001fd5b8360405162461bcd60e51b81526004016102359190610ecd565b3b151590565b60008083601f840112610af0578182fd5b50813567ffffffffffffffff811115610b07578182fd5b602083019150836020828501011115610b1f57600080fd5b9250929050565b60008060208385031215610b38578182fd5b823567ffffffffffffffff80821115610b4f578384fd5b818501915085601f830112610b62578384fd5b813581811115610b70578485fd5b8660208083028501011115610b83578485fd5b60209290920196919550909350505050565b600060208284031215610ba6578081fd5b815161094981611138565b600080600080600060a08688031215610bc8578081fd5b8551610bd381611138565b6020870151909550610be481611120565b604087015190945060028110610bf8578182fd5b606087015190935062ffffff81168114610c10578182fd5b608087015190925063ffffffff81168114610c29578182fd5b809150509295509295909350565b600080600060608486031215610c4b578283fd5b8335610c5681611120565b92506020840135610c6681611120565b929592945050506040919091013590565b60008060008060608587031215610c8c578384fd5b8435610c9781611120565b935060208501359250604085013567ffffffffffffffff811115610cb9578283fd5b610cc587828801610adf565b95989497509550505050565b60008060008060008060008060006101008a8c031215610cef578384fd5b8935610cfa81611120565b985060208a013567ffffffffffffffff811115610d15578485fd5b610d218c828d01610adf565b90995097505060408a0135955060608a0135945060808a0135610d4381611120565b935060a08a0135610d5381611120565b8093505060c08a0135915060e08a013590509295985092959850929598565b600060208284031215610d83578081fd5b5051919050565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b60008251610dc68184602087016110f4565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0393841681529183166020830152909116604082015260600190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b90815260200190565b600060208252610a0d602083018486610d8a565b600060e08252610e8f60e083018a8c610d8a565b60208301989098525060408101959095526001600160a01b03938416606086015291909216608084015260a083019190915260c09091015292915050565b6000602082528251806020840152610eec8160408501602087016110f4565b601f01601f19169190910160400192915050565b6020808252601d908201527f54686520696e7374616e6365206973206e6f7420737570706f72746564000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526022908201527f544f524e3a2063616e206e6f742073656e6420746f207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252601e908201527f544f524e3a20747279696e6720746f2073656e6420302062616c616e63650000604082015260600190565b60208082526036908201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60408201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606082015260800190565b6020808252600e908201526d139bdd08185d5d1a1bdc9a5e995960921b604082015260600190565b6000808335601e198436030181126110c5578283fd5b83018035915067ffffffffffffffff8211156110df578283fd5b602001915036819003821315610b1f57600080fd5b60005b8381101561110f5781810151838201526020016110f7565b8381111561086f5750506000910152565b6001600160a01b038116811461113557600080fd5b50565b801515811461113557600080fdfea264697066735822122004c0e245ab0b87d2916977a9650f299de2e526143487c917a63e4b88e54387e364736f6c634300060c0033";class Dr extends Ya{constructor(...e){e.length>1?super(...e):super(Sr,Nr,e[0])}getDeployTransaction(e,t,a,n){return super.getDeployTransaction(e,t,a,n||{})}deploy(e,t,a,n){return super.deploy(e,t,a,n||{})}connect(e){return super.connect(e)}static bytecode=Nr;static abi=Sr;static createInterface(){return new ba(Sr)}static connect(e,t){return new Wa(e,Sr,t)}}const Ur=[{inputs:[{internalType:"address",name:"_torn",type:"address"},{internalType:"address",name:"_governance",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawTorn",outputs:[],stateMutability:"nonpayable",type:"function"}],Vr="0x60c060405234801561001057600080fd5b506040516104aa3803806104aa8339818101604052604081101561003357600080fd5b5080516020909101516001600160601b0319606092831b8116608052911b1660a05260805160601c60a05160601c61042e61007c60003980606952508060d3525061042e6000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806391fe357314610030575b600080fd5b61005c6004803603604081101561004657600080fd5b506001600160a01b03813516906020013561005e565b005b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146100c6576040805162461bcd60e51b815260206004820152600860248201526737b7363c9033b7bb60c11b604482015290519081900360640190fd5b6100fa6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001683836100fe565b5050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610150908490610155565b505050565b60606101aa826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166102069092919063ffffffff16565b805190915015610150578080602001905160208110156101c957600080fd5b50516101505760405162461bcd60e51b815260040180806020018281038252602a8152602001806103cf602a913960400191505060405180910390fd5b6060610215848460008561021d565b949350505050565b6060610228856103c8565b610279576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106102b85780518252601f199092019160209182019101610299565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461031a576040519150601f19603f3d011682016040523d82523d6000602084013e61031f565b606091505b509150915081156103335791506102159050565b8051156103435780518082602001fd5b8360405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561038d578181015183820152602001610375565b50505050905090810190601f1680156103ba5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b3b15159056fe5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a26469706673582212208fc65ae8299d617f6cff836a2822363849c7fb35b0b27a6f0aebfa62084005c764736f6c634300060c0033";class Fr extends Ya{constructor(...e){e.length>1?super(...e):super(Ur,Vr,e[0])}getDeployTransaction(e,t,a){return super.getDeployTransaction(e,t,a||{})}deploy(e,t,a){return super.deploy(e,t,a||{})}connect(e){return super.connect(e)}static bytecode=Vr;static abi=Ur;static createInterface(){return new ba(Ur)}static connect(e,t){return new Wa(e,Ur,t)}}var Lr=Object.freeze({__proto__:null,AdminUpgradeableProxy__factory:hr,FeeManager__factory:_r,GasCompensationVault__factory:Er,LoopbackProxy__factory:kr,SingletonFactory__factory:Cr,TornadoRouter__factory:Dr,TornadoVault__factory:Fr,aggregator:Df,deployerSol:Gf,instanceRegistrySol:$f,interfaces:Ui,libraries:Gi,relayerRegistrySol:ed,testnet:fi,torn:Bd,tornadoStakingRewardsSol:yi,uniswap:Ni,v1:Es,v2VaultAndGas:Gs,v3RelayerRegistry:Xs,v4ExploitPatch:yr,v5ProposalStatePatch:Tr}),Gr=Object.freeze({__proto__:null,classic:gf,governance:Lr}),Br=Object.freeze({__proto__:null,contracts:Gr,openzeppelin:cb});const jr=[{inputs:[{internalType:"contract ENS",name:"_ens",type:"address"},{internalType:"contract IBaseRegistrar",name:"_registrar",type:"address"},{internalType:"contract IMetadataService",name:"_metadataService",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"CannotUpgrade",type:"error"},{inputs:[],name:"IncompatibleParent",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"IncorrectTargetOwner",type:"error"},{inputs:[],name:"IncorrectTokenType",type:"error"},{inputs:[{internalType:"bytes32",name:"labelHash",type:"bytes32"},{internalType:"bytes32",name:"expectedLabelhash",type:"bytes32"}],name:"LabelMismatch",type:"error"},{inputs:[{internalType:"string",name:"label",type:"string"}],name:"LabelTooLong",type:"error"},{inputs:[],name:"LabelTooShort",type:"error"},{inputs:[],name:"NameIsNotWrapped",type:"error"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"OperationProhibited",type:"error"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"addr",type:"address"}],name:"Unauthorised",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"controller",type:"address"},{indexed:!1,internalType:"bool",name:"active",type:"bool"}],name:"ControllerChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint64",name:"expiry",type:"uint64"}],name:"ExpiryExtended",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint32",name:"fuses",type:"uint32"}],name:"FusesSet",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"address",name:"owner",type:"address"}],name:"NameUnwrapped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"name",type:"bytes"},{indexed:!1,internalType:"address",name:"owner",type:"address"},{indexed:!1,internalType:"uint32",name:"fuses",type:"uint32"},{indexed:!1,internalType:"uint64",name:"expiry",type:"uint64"}],name:"NameWrapped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256[]",name:"ids",type:"uint256[]"},{indexed:!1,internalType:"uint256[]",name:"values",type:"uint256[]"}],name:"TransferBatch",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"TransferSingle",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"value",type:"string"},{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"URI",type:"event"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"_tokens",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint32",name:"fuseMask",type:"uint32"}],name:"allFusesBurned",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address[]",name:"accounts",type:"address[]"},{internalType:"uint256[]",name:"ids",type:"uint256[]"}],name:"balanceOfBatch",outputs:[{internalType:"uint256[]",name:"",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"addr",type:"address"}],name:"canExtendSubnames",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"addr",type:"address"}],name:"canModifyName",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"controllers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"ens",outputs:[{internalType:"contract ENS",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"parentNode",type:"bytes32"},{internalType:"bytes32",name:"labelhash",type:"bytes32"},{internalType:"uint64",name:"expiry",type:"uint64"}],name:"extendExpiry",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"operator",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"getData",outputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint32",name:"fuses",type:"uint32"},{internalType:"uint64",name:"expiry",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"parentNode",type:"bytes32"},{internalType:"bytes32",name:"labelhash",type:"bytes32"}],name:"isWrapped",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"isWrapped",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"metadataService",outputs:[{internalType:"contract IMetadataService",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"names",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"onERC721Received",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"owner",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_token",type:"address"},{internalType:"address",name:"_to",type:"address"},{internalType:"uint256",name:"_amount",type:"uint256"}],name:"recoverFunds",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"label",type:"string"},{internalType:"address",name:"wrappedOwner",type:"address"},{internalType:"uint256",name:"duration",type:"uint256"},{internalType:"address",name:"resolver",type:"address"},{internalType:"uint16",name:"ownerControlledFuses",type:"uint16"}],name:"registerAndWrapETH2LD",outputs:[{internalType:"uint256",name:"registrarExpiry",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"registrar",outputs:[{internalType:"contract IBaseRegistrar",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"duration",type:"uint256"}],name:"renew",outputs:[{internalType:"uint256",name:"expires",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"ids",type:"uint256[]"},{internalType:"uint256[]",name:"amounts",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeBatchTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"id",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"parentNode",type:"bytes32"},{internalType:"bytes32",name:"labelhash",type:"bytes32"},{internalType:"uint32",name:"fuses",type:"uint32"},{internalType:"uint64",name:"expiry",type:"uint64"}],name:"setChildFuses",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"controller",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"setController",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint16",name:"ownerControlledFuses",type:"uint16"}],name:"setFuses",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IMetadataService",name:"_metadataService",type:"address"}],name:"setMetadataService",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"resolver",type:"address"},{internalType:"uint64",name:"ttl",type:"uint64"}],name:"setRecord",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"resolver",type:"address"}],name:"setResolver",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"parentNode",type:"bytes32"},{internalType:"string",name:"label",type:"string"},{internalType:"address",name:"owner",type:"address"},{internalType:"uint32",name:"fuses",type:"uint32"},{internalType:"uint64",name:"expiry",type:"uint64"}],name:"setSubnodeOwner",outputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"parentNode",type:"bytes32"},{internalType:"string",name:"label",type:"string"},{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"resolver",type:"address"},{internalType:"uint64",name:"ttl",type:"uint64"},{internalType:"uint32",name:"fuses",type:"uint32"},{internalType:"uint64",name:"expiry",type:"uint64"}],name:"setSubnodeRecord",outputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint64",name:"ttl",type:"uint64"}],name:"setTTL",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract INameWrapperUpgrade",name:"_upgradeAddress",type:"address"}],name:"setUpgradeContract",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"parentNode",type:"bytes32"},{internalType:"bytes32",name:"labelhash",type:"bytes32"},{internalType:"address",name:"controller",type:"address"}],name:"unwrap",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"labelhash",type:"bytes32"},{internalType:"address",name:"registrant",type:"address"},{internalType:"address",name:"controller",type:"address"}],name:"unwrapETH2LD",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"name",type:"bytes"},{internalType:"bytes",name:"extraData",type:"bytes"}],name:"upgrade",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"upgradeContract",outputs:[{internalType:"contract INameWrapperUpgrade",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"uri",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"name",type:"bytes"},{internalType:"address",name:"wrappedOwner",type:"address"},{internalType:"address",name:"resolver",type:"address"}],name:"wrap",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"label",type:"string"},{internalType:"address",name:"wrappedOwner",type:"address"},{internalType:"uint16",name:"ownerControlledFuses",type:"uint16"},{internalType:"address",name:"resolver",type:"address"}],name:"wrapETH2LD",outputs:[{internalType:"uint64",name:"expiry",type:"uint64"}],stateMutability:"nonpayable",type:"function"}];class Hr{static abi=jr;static createInterface(){return new ba(jr)}static connect(e,t){return new Wa(e,jr,t)}}const zr=[{inputs:[{internalType:"contract ENS",name:"_old",type:"address"}],payable:!1,stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"label",type:"bytes32"},{indexed:!1,internalType:"address",name:"owner",type:"address"}],name:"NewOwner",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"address",name:"resolver",type:"address"}],name:"NewResolver",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint64",name:"ttl",type:"uint64"}],name:"NewTTL",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"address",name:"owner",type:"address"}],name:"Transfer",type:"event"},{constant:!0,inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"old",outputs:[{internalType:"contract ENS",name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"recordExists",outputs:[{internalType:"bool",name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"resolver",outputs:[{internalType:"address",name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"owner",type:"address"}],name:"setOwner",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"resolver",type:"address"},{internalType:"uint64",name:"ttl",type:"uint64"}],name:"setRecord",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"resolver",type:"address"}],name:"setResolver",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"label",type:"bytes32"},{internalType:"address",name:"owner",type:"address"}],name:"setSubnodeOwner",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"label",type:"bytes32"},{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"resolver",type:"address"},{internalType:"uint64",name:"ttl",type:"uint64"}],name:"setSubnodeRecord",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint64",name:"ttl",type:"uint64"}],name:"setTTL",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"ttl",outputs:[{internalType:"uint64",name:"",type:"uint64"}],payable:!1,stateMutability:"view",type:"function"}];class Wr{static abi=zr;static createInterface(){return new ba(zr)}static connect(e,t){return new Wa(e,zr,t)}}const $r=[{inputs:[{internalType:"contract ENS",name:"_ens",type:"address"},{internalType:"contract INameWrapper",name:"wrapperAddress",type:"address"},{internalType:"address",name:"_trustedETHController",type:"address"},{internalType:"address",name:"_trustedReverseRegistrar",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"uint256",name:"contentType",type:"uint256"}],name:"ABIChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"address",name:"a",type:"address"}],name:"AddrChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"coinType",type:"uint256"},{indexed:!1,internalType:"bytes",name:"newAddress",type:"bytes"}],name:"AddressChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"address",name:"delegate",type:"address"},{indexed:!0,internalType:"bool",name:"approved",type:"bool"}],name:"Approved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"hash",type:"bytes"}],name:"ContenthashChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"name",type:"bytes"},{indexed:!1,internalType:"uint16",name:"resource",type:"uint16"},{indexed:!1,internalType:"bytes",name:"record",type:"bytes"}],name:"DNSRecordChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"name",type:"bytes"},{indexed:!1,internalType:"uint16",name:"resource",type:"uint16"}],name:"DNSRecordDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"lastzonehash",type:"bytes"},{indexed:!1,internalType:"bytes",name:"zonehash",type:"bytes"}],name:"DNSZonehashChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"bytes4",name:"interfaceID",type:"bytes4"},{indexed:!1,internalType:"address",name:"implementer",type:"address"}],name:"InterfaceChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"string",name:"name",type:"string"}],name:"NameChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"x",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"y",type:"bytes32"}],name:"PubkeyChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"string",name:"indexedKey",type:"string"},{indexed:!1,internalType:"string",name:"key",type:"string"},{indexed:!1,internalType:"string",name:"value",type:"string"}],name:"TextChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint64",name:"newVersion",type:"uint64"}],name:"VersionChanged",type:"event"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"contentTypes",type:"uint256"}],name:"ABI",outputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"addr",outputs:[{internalType:"address payable",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"coinType",type:"uint256"}],name:"addr",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"delegate",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"clearRecords",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"contenthash",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"name",type:"bytes32"},{internalType:"uint16",name:"resource",type:"uint16"}],name:"dnsRecord",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"name",type:"bytes32"}],name:"hasDNSRecords",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes4",name:"interfaceID",type:"bytes4"}],name:"interfaceImplementer",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"delegate",type:"address"}],name:"isApprovedFor",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"nodehash",type:"bytes32"},{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicallWithNodeCheck",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"pubkey",outputs:[{internalType:"bytes32",name:"x",type:"bytes32"},{internalType:"bytes32",name:"y",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"recordVersions",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"contentType",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"setABI",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"coinType",type:"uint256"},{internalType:"bytes",name:"a",type:"bytes"}],name:"setAddr",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"a",type:"address"}],name:"setAddr",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes",name:"hash",type:"bytes"}],name:"setContenthash",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes",name:"data",type:"bytes"}],name:"setDNSRecords",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes4",name:"interfaceID",type:"bytes4"},{internalType:"address",name:"implementer",type:"address"}],name:"setInterface",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"newName",type:"string"}],name:"setName",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"x",type:"bytes32"},{internalType:"bytes32",name:"y",type:"bytes32"}],name:"setPubkey",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"key",type:"string"},{internalType:"string",name:"value",type:"string"}],name:"setText",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes",name:"hash",type:"bytes"}],name:"setZonehash",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceID",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"key",type:"string"}],name:"text",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"zonehash",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"}];class Xr{static abi=$r;static createInterface(){return new ba($r)}static connect(e,t){return new Wa(e,$r,t)}}const qr=[{inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall3.Call[]",name:"calls",type:"tuple[]"}],name:"aggregate",outputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"},{internalType:"bytes[]",name:"returnData",type:"bytes[]"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bool",name:"allowFailure",type:"bool"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall3.Call3[]",name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct Multicall3.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bool",name:"allowFailure",type:"bool"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall3.Call3Value[]",name:"calls",type:"tuple[]"}],name:"aggregate3Value",outputs:[{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct Multicall3.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall3.Call[]",name:"calls",type:"tuple[]"}],name:"blockAndAggregate",outputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"},{internalType:"bytes32",name:"blockHash",type:"bytes32"},{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct Multicall3.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[],name:"getBasefee",outputs:[{internalType:"uint256",name:"basefee",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"}],name:"getBlockHash",outputs:[{internalType:"bytes32",name:"blockHash",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"getBlockNumber",outputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getChainId",outputs:[{internalType:"uint256",name:"chainid",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockCoinbase",outputs:[{internalType:"address",name:"coinbase",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockDifficulty",outputs:[{internalType:"uint256",name:"difficulty",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockGasLimit",outputs:[{internalType:"uint256",name:"gaslimit",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"}],name:"getEthBalance",outputs:[{internalType:"uint256",name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLastBlockHash",outputs:[{internalType:"bytes32",name:"blockHash",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bool",name:"requireSuccess",type:"bool"},{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall3.Call[]",name:"calls",type:"tuple[]"}],name:"tryAggregate",outputs:[{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct Multicall3.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bool",name:"requireSuccess",type:"bool"},{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall3.Call[]",name:"calls",type:"tuple[]"}],name:"tryBlockAndAggregate",outputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"},{internalType:"bytes32",name:"blockHash",type:"bytes32"},{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct Multicall3.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"payable",type:"function"}];class Jr{static abi=qr;static createInterface(){return new ba(qr)}static connect(e,t){return new Wa(e,qr,t)}}const Yr=[{inputs:[{internalType:"contract MultiWrapper",name:"_multiWrapper",type:"address"},{internalType:"contract IOracle[]",name:"existingOracles",type:"address[]"},{internalType:"enum OffchainOracle.OracleType[]",name:"oracleTypes",type:"uint8[]"},{internalType:"contract IERC20[]",name:"existingConnectors",type:"address[]"},{internalType:"contract IERC20",name:"wBase",type:"address"},{internalType:"address",name:"owner",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"ArraysLengthMismatch",type:"error"},{inputs:[],name:"ConnectorAlreadyAdded",type:"error"},{inputs:[],name:"InvalidOracleTokenKind",type:"error"},{inputs:[],name:"OracleAlreadyAdded",type:"error"},{inputs:[],name:"SameTokens",type:"error"},{inputs:[],name:"TooBigThreshold",type:"error"},{inputs:[],name:"UnknownConnector",type:"error"},{inputs:[],name:"UnknownOracle",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"contract IERC20",name:"connector",type:"address"}],name:"ConnectorAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"contract IERC20",name:"connector",type:"address"}],name:"ConnectorRemoved",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"contract MultiWrapper",name:"multiWrapper",type:"address"}],name:"MultiWrapperUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"contract IOracle",name:"oracle",type:"address"},{indexed:!1,internalType:"enum OffchainOracle.OracleType",name:"oracleType",type:"uint8"}],name:"OracleAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"contract IOracle",name:"oracle",type:"address"},{indexed:!1,internalType:"enum OffchainOracle.OracleType",name:"oracleType",type:"uint8"}],name:"OracleRemoved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{inputs:[{internalType:"contract IERC20",name:"connector",type:"address"}],name:"addConnector",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IOracle",name:"oracle",type:"address"},{internalType:"enum OffchainOracle.OracleType",name:"oracleKind",type:"uint8"}],name:"addOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"connectors",outputs:[{internalType:"contract IERC20[]",name:"allConnectors",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"srcToken",type:"address"},{internalType:"contract IERC20",name:"dstToken",type:"address"},{internalType:"bool",name:"useWrappers",type:"bool"}],name:"getRate",outputs:[{internalType:"uint256",name:"weightedRate",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"srcToken",type:"address"},{internalType:"bool",name:"useSrcWrappers",type:"bool"}],name:"getRateToEth",outputs:[{internalType:"uint256",name:"weightedRate",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"srcToken",type:"address"},{internalType:"bool",name:"useSrcWrappers",type:"bool"},{internalType:"contract IERC20[]",name:"customConnectors",type:"address[]"},{internalType:"uint256",name:"thresholdFilter",type:"uint256"}],name:"getRateToEthWithCustomConnectors",outputs:[{internalType:"uint256",name:"weightedRate",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"srcToken",type:"address"},{internalType:"bool",name:"useSrcWrappers",type:"bool"},{internalType:"uint256",name:"thresholdFilter",type:"uint256"}],name:"getRateToEthWithThreshold",outputs:[{internalType:"uint256",name:"weightedRate",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"srcToken",type:"address"},{internalType:"contract IERC20",name:"dstToken",type:"address"},{internalType:"bool",name:"useWrappers",type:"bool"},{internalType:"contract IERC20[]",name:"customConnectors",type:"address[]"},{internalType:"uint256",name:"thresholdFilter",type:"uint256"}],name:"getRateWithCustomConnectors",outputs:[{internalType:"uint256",name:"weightedRate",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"srcToken",type:"address"},{internalType:"contract IERC20",name:"dstToken",type:"address"},{internalType:"bool",name:"useWrappers",type:"bool"},{internalType:"uint256",name:"thresholdFilter",type:"uint256"}],name:"getRateWithThreshold",outputs:[{internalType:"uint256",name:"weightedRate",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"multiWrapper",outputs:[{internalType:"contract MultiWrapper",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"oracles",outputs:[{internalType:"contract IOracle[]",name:"allOracles",type:"address[]"},{internalType:"enum OffchainOracle.OracleType[]",name:"oracleTypes",type:"uint8[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"connector",type:"address"}],name:"removeConnector",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IOracle",name:"oracle",type:"address"},{internalType:"enum OffchainOracle.OracleType",name:"oracleKind",type:"uint8"}],name:"removeOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract MultiWrapper",name:"_multiWrapper",type:"address"}],name:"setMultiWrapper",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}];class Kr{static abi=Yr;static createInterface(){return new ba(Yr)}static connect(e,t){return new Wa(e,Yr,t)}}const Zr=[{inputs:[{internalType:"address",name:"_owner",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"",type:"uint256"}],name:"DecimalsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"",type:"uint256"}],name:"GasPriceUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"",type:"uint256"}],name:"L1BaseFeeUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"",type:"uint256"}],name:"OverheadUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"",type:"uint256"}],name:"ScalarUpdated",type:"event"},{inputs:[],name:"decimals",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"gasPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"_data",type:"bytes"}],name:"getL1Fee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"_data",type:"bytes"}],name:"getL1GasUsed",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"l1BaseFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"overhead",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"scalar",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_decimals",type:"uint256"}],name:"setDecimals",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_gasPrice",type:"uint256"}],name:"setGasPrice",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_baseFee",type:"uint256"}],name:"setL1BaseFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_overhead",type:"uint256"}],name:"setOverhead",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_scalar",type:"uint256"}],name:"setScalar",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}];class Qr{static abi=Zr;static createInterface(){return new ba(Zr)}static connect(e,t){return new Wa(e,Zr,t)}}const ep=[{inputs:[{internalType:"contract ENS",name:"_ens",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"address[]",name:"addresses",type:"address[]"}],name:"getNames",outputs:[{internalType:"string[]",name:"r",type:"string[]"}],stateMutability:"view",type:"function"}];class tp{static abi=ep;static createInterface(){return new ba(ep)}static connect(e,t){return new Wa(e,ep,t)}}return t})())); \ No newline at end of file diff --git a/dist/tovarishClient.d.ts b/dist/tovarishClient.d.ts new file mode 100644 index 0000000..f1ecf32 --- /dev/null +++ b/dist/tovarishClient.d.ts @@ -0,0 +1,71 @@ +import { RelayerClient, RelayerClientConstructor, RelayerError, RelayerInfo, RelayerStatus } from './relayerClient'; +import { CachedRelayerInfo, MinimalEvents } from './events'; +export declare const MAX_TOVARISH_EVENTS = 5000; +export interface EventsStatus { + events: number; + lastBlock: number; +} +export interface TovarishEventsStatus { + governance?: EventsStatus; + registry?: EventsStatus; + revenue?: EventsStatus; + echo: EventsStatus; + encrypted_notes: EventsStatus; + tornado: EventsStatus; +} +export interface TovarishSyncStatus { + events: boolean; + tokenPrice: boolean; + gasPrice: boolean; +} +export interface TovarishStatus extends RelayerStatus { + latestBalance: string; + events: TovarishEventsStatus; + syncStatus: TovarishSyncStatus; + onSyncEvents: boolean; +} +export interface TovarishInfo extends RelayerInfo { + latestBlock: number; + latestBalance: string; + version: string; + events: TovarishEventsStatus; + syncStatus: TovarishSyncStatus; +} +export interface TovarishEventsQuery { + type: string; + currency?: string; + amount?: string; + fromBlock: number; + recent?: boolean; +} +export interface BaseTovarishEvents { + events: T[]; + lastSyncBlock: number; +} +export declare class TovarishClient extends RelayerClient { + selectedRelayer?: TovarishInfo; + constructor(clientConstructor: RelayerClientConstructor); + askRelayerStatus({ hostname, url, relayerAddress, }: { + hostname?: string; + url?: string; + relayerAddress?: string; + }): Promise; + /** + * Ask status for all enabled chains for tovarish relayer + */ + askAllStatus({ hostname, url, relayerAddress, }: { + hostname?: string; + url?: string; + relayerAddress?: string; + }): Promise; + filterRelayer(relayer: CachedRelayerInfo): Promise; + getValidRelayers(relayers: CachedRelayerInfo[]): Promise<{ + validRelayers: TovarishInfo[]; + invalidRelayers: RelayerError[]; + }>; + getTovarishRelayers(relayers: CachedRelayerInfo[]): Promise<{ + validRelayers: TovarishInfo[]; + invalidRelayers: RelayerError[]; + }>; + getEvents({ type, currency, amount, fromBlock, recent, }: TovarishEventsQuery): Promise>; +} diff --git a/dist/typechain/ENSNameWrapper.d.ts b/dist/typechain/ENSNameWrapper.d.ts new file mode 100644 index 0000000..c72fafa --- /dev/null +++ b/dist/typechain/ENSNameWrapper.d.ts @@ -0,0 +1,847 @@ +import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, EventFragment, AddressLike, ContractRunner, ContractMethod, Listener } from "ethers"; +import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedLogDescription, TypedListener, TypedContractMethod } from "./common"; +export interface ENSNameWrapperInterface extends Interface { + getFunction(nameOrSignature: "_tokens" | "allFusesBurned" | "approve" | "balanceOf" | "balanceOfBatch" | "canExtendSubnames" | "canModifyName" | "controllers" | "ens" | "extendExpiry" | "getApproved" | "getData" | "isApprovedForAll" | "isWrapped(bytes32,bytes32)" | "isWrapped(bytes32)" | "metadataService" | "name" | "names" | "onERC721Received" | "owner" | "ownerOf" | "recoverFunds" | "registerAndWrapETH2LD" | "registrar" | "renew" | "renounceOwnership" | "safeBatchTransferFrom" | "safeTransferFrom" | "setApprovalForAll" | "setChildFuses" | "setController" | "setFuses" | "setMetadataService" | "setRecord" | "setResolver" | "setSubnodeOwner" | "setSubnodeRecord" | "setTTL" | "setUpgradeContract" | "supportsInterface" | "transferOwnership" | "unwrap" | "unwrapETH2LD" | "upgrade" | "upgradeContract" | "uri" | "wrap" | "wrapETH2LD"): FunctionFragment; + getEvent(nameOrSignatureOrTopic: "Approval" | "ApprovalForAll" | "ControllerChanged" | "ExpiryExtended" | "FusesSet" | "NameUnwrapped" | "NameWrapped" | "OwnershipTransferred" | "TransferBatch" | "TransferSingle" | "URI"): EventFragment; + encodeFunctionData(functionFragment: "_tokens", values: [BigNumberish]): string; + encodeFunctionData(functionFragment: "allFusesBurned", values: [BytesLike, BigNumberish]): string; + encodeFunctionData(functionFragment: "approve", values: [AddressLike, BigNumberish]): string; + encodeFunctionData(functionFragment: "balanceOf", values: [AddressLike, BigNumberish]): string; + encodeFunctionData(functionFragment: "balanceOfBatch", values: [AddressLike[], BigNumberish[]]): string; + encodeFunctionData(functionFragment: "canExtendSubnames", values: [BytesLike, AddressLike]): string; + encodeFunctionData(functionFragment: "canModifyName", values: [BytesLike, AddressLike]): string; + encodeFunctionData(functionFragment: "controllers", values: [AddressLike]): string; + encodeFunctionData(functionFragment: "ens", values?: undefined): string; + encodeFunctionData(functionFragment: "extendExpiry", values: [BytesLike, BytesLike, BigNumberish]): string; + encodeFunctionData(functionFragment: "getApproved", values: [BigNumberish]): string; + encodeFunctionData(functionFragment: "getData", values: [BigNumberish]): string; + encodeFunctionData(functionFragment: "isApprovedForAll", values: [AddressLike, AddressLike]): string; + encodeFunctionData(functionFragment: "isWrapped(bytes32,bytes32)", values: [BytesLike, BytesLike]): string; + encodeFunctionData(functionFragment: "isWrapped(bytes32)", values: [BytesLike]): string; + encodeFunctionData(functionFragment: "metadataService", values?: undefined): string; + encodeFunctionData(functionFragment: "name", values?: undefined): string; + encodeFunctionData(functionFragment: "names", values: [BytesLike]): string; + encodeFunctionData(functionFragment: "onERC721Received", values: [AddressLike, AddressLike, BigNumberish, BytesLike]): string; + encodeFunctionData(functionFragment: "owner", values?: undefined): string; + encodeFunctionData(functionFragment: "ownerOf", values: [BigNumberish]): string; + encodeFunctionData(functionFragment: "recoverFunds", values: [AddressLike, AddressLike, BigNumberish]): string; + encodeFunctionData(functionFragment: "registerAndWrapETH2LD", values: [string, AddressLike, BigNumberish, AddressLike, BigNumberish]): string; + encodeFunctionData(functionFragment: "registrar", values?: undefined): string; + encodeFunctionData(functionFragment: "renew", values: [BigNumberish, BigNumberish]): string; + encodeFunctionData(functionFragment: "renounceOwnership", values?: undefined): string; + encodeFunctionData(functionFragment: "safeBatchTransferFrom", values: [ + AddressLike, + AddressLike, + BigNumberish[], + BigNumberish[], + BytesLike + ]): string; + encodeFunctionData(functionFragment: "safeTransferFrom", values: [AddressLike, AddressLike, BigNumberish, BigNumberish, BytesLike]): string; + encodeFunctionData(functionFragment: "setApprovalForAll", values: [AddressLike, boolean]): string; + encodeFunctionData(functionFragment: "setChildFuses", values: [BytesLike, BytesLike, BigNumberish, BigNumberish]): string; + encodeFunctionData(functionFragment: "setController", values: [AddressLike, boolean]): string; + encodeFunctionData(functionFragment: "setFuses", values: [BytesLike, BigNumberish]): string; + encodeFunctionData(functionFragment: "setMetadataService", values: [AddressLike]): string; + encodeFunctionData(functionFragment: "setRecord", values: [BytesLike, AddressLike, AddressLike, BigNumberish]): string; + encodeFunctionData(functionFragment: "setResolver", values: [BytesLike, AddressLike]): string; + encodeFunctionData(functionFragment: "setSubnodeOwner", values: [BytesLike, string, AddressLike, BigNumberish, BigNumberish]): string; + encodeFunctionData(functionFragment: "setSubnodeRecord", values: [ + BytesLike, + string, + AddressLike, + AddressLike, + BigNumberish, + BigNumberish, + BigNumberish + ]): string; + encodeFunctionData(functionFragment: "setTTL", values: [BytesLike, BigNumberish]): string; + encodeFunctionData(functionFragment: "setUpgradeContract", values: [AddressLike]): string; + encodeFunctionData(functionFragment: "supportsInterface", values: [BytesLike]): string; + encodeFunctionData(functionFragment: "transferOwnership", values: [AddressLike]): string; + encodeFunctionData(functionFragment: "unwrap", values: [BytesLike, BytesLike, AddressLike]): string; + encodeFunctionData(functionFragment: "unwrapETH2LD", values: [BytesLike, AddressLike, AddressLike]): string; + encodeFunctionData(functionFragment: "upgrade", values: [BytesLike, BytesLike]): string; + encodeFunctionData(functionFragment: "upgradeContract", values?: undefined): string; + encodeFunctionData(functionFragment: "uri", values: [BigNumberish]): string; + encodeFunctionData(functionFragment: "wrap", values: [BytesLike, AddressLike, AddressLike]): string; + encodeFunctionData(functionFragment: "wrapETH2LD", values: [string, AddressLike, BigNumberish, AddressLike]): string; + decodeFunctionResult(functionFragment: "_tokens", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "allFusesBurned", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "balanceOfBatch", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "canExtendSubnames", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "canModifyName", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "controllers", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "ens", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "extendExpiry", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "getApproved", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "getData", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "isApprovedForAll", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "isWrapped(bytes32,bytes32)", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "isWrapped(bytes32)", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "metadataService", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "name", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "names", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "onERC721Received", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "ownerOf", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "recoverFunds", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "registerAndWrapETH2LD", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "registrar", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "renew", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "renounceOwnership", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "safeBatchTransferFrom", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "safeTransferFrom", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setApprovalForAll", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setChildFuses", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setController", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setFuses", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setMetadataService", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setRecord", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setResolver", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setSubnodeOwner", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setSubnodeRecord", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setTTL", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setUpgradeContract", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "supportsInterface", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "transferOwnership", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "unwrap", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "unwrapETH2LD", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "upgrade", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "upgradeContract", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "uri", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "wrap", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "wrapETH2LD", data: BytesLike): Result; +} +export declare namespace ApprovalEvent { + type InputTuple = [ + owner: AddressLike, + approved: AddressLike, + tokenId: BigNumberish + ]; + type OutputTuple = [owner: string, approved: string, tokenId: bigint]; + interface OutputObject { + owner: string; + approved: string; + tokenId: bigint; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace ApprovalForAllEvent { + type InputTuple = [ + account: AddressLike, + operator: AddressLike, + approved: boolean + ]; + type OutputTuple = [ + account: string, + operator: string, + approved: boolean + ]; + interface OutputObject { + account: string; + operator: string; + approved: boolean; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace ControllerChangedEvent { + type InputTuple = [controller: AddressLike, active: boolean]; + type OutputTuple = [controller: string, active: boolean]; + interface OutputObject { + controller: string; + active: boolean; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace ExpiryExtendedEvent { + type InputTuple = [node: BytesLike, expiry: BigNumberish]; + type OutputTuple = [node: string, expiry: bigint]; + interface OutputObject { + node: string; + expiry: bigint; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace FusesSetEvent { + type InputTuple = [node: BytesLike, fuses: BigNumberish]; + type OutputTuple = [node: string, fuses: bigint]; + interface OutputObject { + node: string; + fuses: bigint; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace NameUnwrappedEvent { + type InputTuple = [node: BytesLike, owner: AddressLike]; + type OutputTuple = [node: string, owner: string]; + interface OutputObject { + node: string; + owner: string; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace NameWrappedEvent { + type InputTuple = [ + node: BytesLike, + name: BytesLike, + owner: AddressLike, + fuses: BigNumberish, + expiry: BigNumberish + ]; + type OutputTuple = [ + node: string, + name: string, + owner: string, + fuses: bigint, + expiry: bigint + ]; + interface OutputObject { + node: string; + name: string; + owner: string; + fuses: bigint; + expiry: bigint; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace OwnershipTransferredEvent { + type InputTuple = [previousOwner: AddressLike, newOwner: AddressLike]; + type OutputTuple = [previousOwner: string, newOwner: string]; + interface OutputObject { + previousOwner: string; + newOwner: string; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace TransferBatchEvent { + type InputTuple = [ + operator: AddressLike, + from: AddressLike, + to: AddressLike, + ids: BigNumberish[], + values: BigNumberish[] + ]; + type OutputTuple = [ + operator: string, + from: string, + to: string, + ids: bigint[], + values: bigint[] + ]; + interface OutputObject { + operator: string; + from: string; + to: string; + ids: bigint[]; + values: bigint[]; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace TransferSingleEvent { + type InputTuple = [ + operator: AddressLike, + from: AddressLike, + to: AddressLike, + id: BigNumberish, + value: BigNumberish + ]; + type OutputTuple = [ + operator: string, + from: string, + to: string, + id: bigint, + value: bigint + ]; + interface OutputObject { + operator: string; + from: string; + to: string; + id: bigint; + value: bigint; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace URIEvent { + type InputTuple = [value: string, id: BigNumberish]; + type OutputTuple = [value: string, id: bigint]; + interface OutputObject { + value: string; + id: bigint; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export interface ENSNameWrapper extends BaseContract { + connect(runner?: ContractRunner | null): ENSNameWrapper; + waitForDeployment(): Promise; + interface: ENSNameWrapperInterface; + queryFilter(event: TCEvent, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; + queryFilter(filter: TypedDeferredTopicFilter, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; + on(event: TCEvent, listener: TypedListener): Promise; + on(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; + once(event: TCEvent, listener: TypedListener): Promise; + once(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; + listeners(event: TCEvent): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners(event?: TCEvent): Promise; + _tokens: TypedContractMethod<[arg0: BigNumberish], [bigint], "view">; + allFusesBurned: TypedContractMethod<[ + node: BytesLike, + fuseMask: BigNumberish + ], [ + boolean + ], "view">; + approve: TypedContractMethod<[ + to: AddressLike, + tokenId: BigNumberish + ], [ + void + ], "nonpayable">; + balanceOf: TypedContractMethod<[ + account: AddressLike, + id: BigNumberish + ], [ + bigint + ], "view">; + balanceOfBatch: TypedContractMethod<[ + accounts: AddressLike[], + ids: BigNumberish[] + ], [ + bigint[] + ], "view">; + canExtendSubnames: TypedContractMethod<[ + node: BytesLike, + addr: AddressLike + ], [ + boolean + ], "view">; + canModifyName: TypedContractMethod<[ + node: BytesLike, + addr: AddressLike + ], [ + boolean + ], "view">; + controllers: TypedContractMethod<[arg0: AddressLike], [boolean], "view">; + ens: TypedContractMethod<[], [string], "view">; + extendExpiry: TypedContractMethod<[ + parentNode: BytesLike, + labelhash: BytesLike, + expiry: BigNumberish + ], [ + bigint + ], "nonpayable">; + getApproved: TypedContractMethod<[id: BigNumberish], [string], "view">; + getData: TypedContractMethod<[ + id: BigNumberish + ], [ + [ + string, + bigint, + bigint + ] & { + owner: string; + fuses: bigint; + expiry: bigint; + } + ], "view">; + isApprovedForAll: TypedContractMethod<[ + account: AddressLike, + operator: AddressLike + ], [ + boolean + ], "view">; + "isWrapped(bytes32,bytes32)": TypedContractMethod<[ + parentNode: BytesLike, + labelhash: BytesLike + ], [ + boolean + ], "view">; + "isWrapped(bytes32)": TypedContractMethod<[ + node: BytesLike + ], [ + boolean + ], "view">; + metadataService: TypedContractMethod<[], [string], "view">; + name: TypedContractMethod<[], [string], "view">; + names: TypedContractMethod<[arg0: BytesLike], [string], "view">; + onERC721Received: TypedContractMethod<[ + to: AddressLike, + arg1: AddressLike, + tokenId: BigNumberish, + data: BytesLike + ], [ + string + ], "nonpayable">; + owner: TypedContractMethod<[], [string], "view">; + ownerOf: TypedContractMethod<[id: BigNumberish], [string], "view">; + recoverFunds: TypedContractMethod<[ + _token: AddressLike, + _to: AddressLike, + _amount: BigNumberish + ], [ + void + ], "nonpayable">; + registerAndWrapETH2LD: TypedContractMethod<[ + label: string, + wrappedOwner: AddressLike, + duration: BigNumberish, + resolver: AddressLike, + ownerControlledFuses: BigNumberish + ], [ + bigint + ], "nonpayable">; + registrar: TypedContractMethod<[], [string], "view">; + renew: TypedContractMethod<[ + tokenId: BigNumberish, + duration: BigNumberish + ], [ + bigint + ], "nonpayable">; + renounceOwnership: TypedContractMethod<[], [void], "nonpayable">; + safeBatchTransferFrom: TypedContractMethod<[ + from: AddressLike, + to: AddressLike, + ids: BigNumberish[], + amounts: BigNumberish[], + data: BytesLike + ], [ + void + ], "nonpayable">; + safeTransferFrom: TypedContractMethod<[ + from: AddressLike, + to: AddressLike, + id: BigNumberish, + amount: BigNumberish, + data: BytesLike + ], [ + void + ], "nonpayable">; + setApprovalForAll: TypedContractMethod<[ + operator: AddressLike, + approved: boolean + ], [ + void + ], "nonpayable">; + setChildFuses: TypedContractMethod<[ + parentNode: BytesLike, + labelhash: BytesLike, + fuses: BigNumberish, + expiry: BigNumberish + ], [ + void + ], "nonpayable">; + setController: TypedContractMethod<[ + controller: AddressLike, + active: boolean + ], [ + void + ], "nonpayable">; + setFuses: TypedContractMethod<[ + node: BytesLike, + ownerControlledFuses: BigNumberish + ], [ + bigint + ], "nonpayable">; + setMetadataService: TypedContractMethod<[ + _metadataService: AddressLike + ], [ + void + ], "nonpayable">; + setRecord: TypedContractMethod<[ + node: BytesLike, + owner: AddressLike, + resolver: AddressLike, + ttl: BigNumberish + ], [ + void + ], "nonpayable">; + setResolver: TypedContractMethod<[ + node: BytesLike, + resolver: AddressLike + ], [ + void + ], "nonpayable">; + setSubnodeOwner: TypedContractMethod<[ + parentNode: BytesLike, + label: string, + owner: AddressLike, + fuses: BigNumberish, + expiry: BigNumberish + ], [ + string + ], "nonpayable">; + setSubnodeRecord: TypedContractMethod<[ + parentNode: BytesLike, + label: string, + owner: AddressLike, + resolver: AddressLike, + ttl: BigNumberish, + fuses: BigNumberish, + expiry: BigNumberish + ], [ + string + ], "nonpayable">; + setTTL: TypedContractMethod<[ + node: BytesLike, + ttl: BigNumberish + ], [ + void + ], "nonpayable">; + setUpgradeContract: TypedContractMethod<[ + _upgradeAddress: AddressLike + ], [ + void + ], "nonpayable">; + supportsInterface: TypedContractMethod<[ + interfaceId: BytesLike + ], [ + boolean + ], "view">; + transferOwnership: TypedContractMethod<[ + newOwner: AddressLike + ], [ + void + ], "nonpayable">; + unwrap: TypedContractMethod<[ + parentNode: BytesLike, + labelhash: BytesLike, + controller: AddressLike + ], [ + void + ], "nonpayable">; + unwrapETH2LD: TypedContractMethod<[ + labelhash: BytesLike, + registrant: AddressLike, + controller: AddressLike + ], [ + void + ], "nonpayable">; + upgrade: TypedContractMethod<[ + name: BytesLike, + extraData: BytesLike + ], [ + void + ], "nonpayable">; + upgradeContract: TypedContractMethod<[], [string], "view">; + uri: TypedContractMethod<[tokenId: BigNumberish], [string], "view">; + wrap: TypedContractMethod<[ + name: BytesLike, + wrappedOwner: AddressLike, + resolver: AddressLike + ], [ + void + ], "nonpayable">; + wrapETH2LD: TypedContractMethod<[ + label: string, + wrappedOwner: AddressLike, + ownerControlledFuses: BigNumberish, + resolver: AddressLike + ], [ + bigint + ], "nonpayable">; + getFunction(key: string | FunctionFragment): T; + getFunction(nameOrSignature: "_tokens"): TypedContractMethod<[arg0: BigNumberish], [bigint], "view">; + getFunction(nameOrSignature: "allFusesBurned"): TypedContractMethod<[ + node: BytesLike, + fuseMask: BigNumberish + ], [ + boolean + ], "view">; + getFunction(nameOrSignature: "approve"): TypedContractMethod<[ + to: AddressLike, + tokenId: BigNumberish + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "balanceOf"): TypedContractMethod<[ + account: AddressLike, + id: BigNumberish + ], [ + bigint + ], "view">; + getFunction(nameOrSignature: "balanceOfBatch"): TypedContractMethod<[ + accounts: AddressLike[], + ids: BigNumberish[] + ], [ + bigint[] + ], "view">; + getFunction(nameOrSignature: "canExtendSubnames"): TypedContractMethod<[ + node: BytesLike, + addr: AddressLike + ], [ + boolean + ], "view">; + getFunction(nameOrSignature: "canModifyName"): TypedContractMethod<[ + node: BytesLike, + addr: AddressLike + ], [ + boolean + ], "view">; + getFunction(nameOrSignature: "controllers"): TypedContractMethod<[arg0: AddressLike], [boolean], "view">; + getFunction(nameOrSignature: "ens"): TypedContractMethod<[], [string], "view">; + getFunction(nameOrSignature: "extendExpiry"): TypedContractMethod<[ + parentNode: BytesLike, + labelhash: BytesLike, + expiry: BigNumberish + ], [ + bigint + ], "nonpayable">; + getFunction(nameOrSignature: "getApproved"): TypedContractMethod<[id: BigNumberish], [string], "view">; + getFunction(nameOrSignature: "getData"): TypedContractMethod<[ + id: BigNumberish + ], [ + [ + string, + bigint, + bigint + ] & { + owner: string; + fuses: bigint; + expiry: bigint; + } + ], "view">; + getFunction(nameOrSignature: "isApprovedForAll"): TypedContractMethod<[ + account: AddressLike, + operator: AddressLike + ], [ + boolean + ], "view">; + getFunction(nameOrSignature: "isWrapped(bytes32,bytes32)"): TypedContractMethod<[ + parentNode: BytesLike, + labelhash: BytesLike + ], [ + boolean + ], "view">; + getFunction(nameOrSignature: "isWrapped(bytes32)"): TypedContractMethod<[node: BytesLike], [boolean], "view">; + getFunction(nameOrSignature: "metadataService"): TypedContractMethod<[], [string], "view">; + getFunction(nameOrSignature: "name"): TypedContractMethod<[], [string], "view">; + getFunction(nameOrSignature: "names"): TypedContractMethod<[arg0: BytesLike], [string], "view">; + getFunction(nameOrSignature: "onERC721Received"): TypedContractMethod<[ + to: AddressLike, + arg1: AddressLike, + tokenId: BigNumberish, + data: BytesLike + ], [ + string + ], "nonpayable">; + getFunction(nameOrSignature: "owner"): TypedContractMethod<[], [string], "view">; + getFunction(nameOrSignature: "ownerOf"): TypedContractMethod<[id: BigNumberish], [string], "view">; + getFunction(nameOrSignature: "recoverFunds"): TypedContractMethod<[ + _token: AddressLike, + _to: AddressLike, + _amount: BigNumberish + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "registerAndWrapETH2LD"): TypedContractMethod<[ + label: string, + wrappedOwner: AddressLike, + duration: BigNumberish, + resolver: AddressLike, + ownerControlledFuses: BigNumberish + ], [ + bigint + ], "nonpayable">; + getFunction(nameOrSignature: "registrar"): TypedContractMethod<[], [string], "view">; + getFunction(nameOrSignature: "renew"): TypedContractMethod<[ + tokenId: BigNumberish, + duration: BigNumberish + ], [ + bigint + ], "nonpayable">; + getFunction(nameOrSignature: "renounceOwnership"): TypedContractMethod<[], [void], "nonpayable">; + getFunction(nameOrSignature: "safeBatchTransferFrom"): TypedContractMethod<[ + from: AddressLike, + to: AddressLike, + ids: BigNumberish[], + amounts: BigNumberish[], + data: BytesLike + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "safeTransferFrom"): TypedContractMethod<[ + from: AddressLike, + to: AddressLike, + id: BigNumberish, + amount: BigNumberish, + data: BytesLike + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "setApprovalForAll"): TypedContractMethod<[ + operator: AddressLike, + approved: boolean + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "setChildFuses"): TypedContractMethod<[ + parentNode: BytesLike, + labelhash: BytesLike, + fuses: BigNumberish, + expiry: BigNumberish + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "setController"): TypedContractMethod<[ + controller: AddressLike, + active: boolean + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "setFuses"): TypedContractMethod<[ + node: BytesLike, + ownerControlledFuses: BigNumberish + ], [ + bigint + ], "nonpayable">; + getFunction(nameOrSignature: "setMetadataService"): TypedContractMethod<[_metadataService: AddressLike], [void], "nonpayable">; + getFunction(nameOrSignature: "setRecord"): TypedContractMethod<[ + node: BytesLike, + owner: AddressLike, + resolver: AddressLike, + ttl: BigNumberish + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "setResolver"): TypedContractMethod<[ + node: BytesLike, + resolver: AddressLike + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "setSubnodeOwner"): TypedContractMethod<[ + parentNode: BytesLike, + label: string, + owner: AddressLike, + fuses: BigNumberish, + expiry: BigNumberish + ], [ + string + ], "nonpayable">; + getFunction(nameOrSignature: "setSubnodeRecord"): TypedContractMethod<[ + parentNode: BytesLike, + label: string, + owner: AddressLike, + resolver: AddressLike, + ttl: BigNumberish, + fuses: BigNumberish, + expiry: BigNumberish + ], [ + string + ], "nonpayable">; + getFunction(nameOrSignature: "setTTL"): TypedContractMethod<[ + node: BytesLike, + ttl: BigNumberish + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "setUpgradeContract"): TypedContractMethod<[_upgradeAddress: AddressLike], [void], "nonpayable">; + getFunction(nameOrSignature: "supportsInterface"): TypedContractMethod<[interfaceId: BytesLike], [boolean], "view">; + getFunction(nameOrSignature: "transferOwnership"): TypedContractMethod<[newOwner: AddressLike], [void], "nonpayable">; + getFunction(nameOrSignature: "unwrap"): TypedContractMethod<[ + parentNode: BytesLike, + labelhash: BytesLike, + controller: AddressLike + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "unwrapETH2LD"): TypedContractMethod<[ + labelhash: BytesLike, + registrant: AddressLike, + controller: AddressLike + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "upgrade"): TypedContractMethod<[ + name: BytesLike, + extraData: BytesLike + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "upgradeContract"): TypedContractMethod<[], [string], "view">; + getFunction(nameOrSignature: "uri"): TypedContractMethod<[tokenId: BigNumberish], [string], "view">; + getFunction(nameOrSignature: "wrap"): TypedContractMethod<[ + name: BytesLike, + wrappedOwner: AddressLike, + resolver: AddressLike + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "wrapETH2LD"): TypedContractMethod<[ + label: string, + wrappedOwner: AddressLike, + ownerControlledFuses: BigNumberish, + resolver: AddressLike + ], [ + bigint + ], "nonpayable">; + getEvent(key: "Approval"): TypedContractEvent; + getEvent(key: "ApprovalForAll"): TypedContractEvent; + getEvent(key: "ControllerChanged"): TypedContractEvent; + getEvent(key: "ExpiryExtended"): TypedContractEvent; + getEvent(key: "FusesSet"): TypedContractEvent; + getEvent(key: "NameUnwrapped"): TypedContractEvent; + getEvent(key: "NameWrapped"): TypedContractEvent; + getEvent(key: "OwnershipTransferred"): TypedContractEvent; + getEvent(key: "TransferBatch"): TypedContractEvent; + getEvent(key: "TransferSingle"): TypedContractEvent; + getEvent(key: "URI"): TypedContractEvent; + filters: { + "Approval(address,address,uint256)": TypedContractEvent; + Approval: TypedContractEvent; + "ApprovalForAll(address,address,bool)": TypedContractEvent; + ApprovalForAll: TypedContractEvent; + "ControllerChanged(address,bool)": TypedContractEvent; + ControllerChanged: TypedContractEvent; + "ExpiryExtended(bytes32,uint64)": TypedContractEvent; + ExpiryExtended: TypedContractEvent; + "FusesSet(bytes32,uint32)": TypedContractEvent; + FusesSet: TypedContractEvent; + "NameUnwrapped(bytes32,address)": TypedContractEvent; + NameUnwrapped: TypedContractEvent; + "NameWrapped(bytes32,bytes,address,uint32,uint64)": TypedContractEvent; + NameWrapped: TypedContractEvent; + "OwnershipTransferred(address,address)": TypedContractEvent; + OwnershipTransferred: TypedContractEvent; + "TransferBatch(address,address,address,uint256[],uint256[])": TypedContractEvent; + TransferBatch: TypedContractEvent; + "TransferSingle(address,address,address,uint256,uint256)": TypedContractEvent; + TransferSingle: TypedContractEvent; + "URI(string,uint256)": TypedContractEvent; + URI: TypedContractEvent; + }; +} diff --git a/dist/typechain/ENSRegistry.d.ts b/dist/typechain/ENSRegistry.d.ts new file mode 100644 index 0000000..27da38f --- /dev/null +++ b/dist/typechain/ENSRegistry.d.ts @@ -0,0 +1,256 @@ +import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, EventFragment, AddressLike, ContractRunner, ContractMethod, Listener } from "ethers"; +import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedLogDescription, TypedListener, TypedContractMethod } from "./common"; +export interface ENSRegistryInterface extends Interface { + getFunction(nameOrSignature: "isApprovedForAll" | "old" | "owner" | "recordExists" | "resolver" | "setApprovalForAll" | "setOwner" | "setRecord" | "setResolver" | "setSubnodeOwner" | "setSubnodeRecord" | "setTTL" | "ttl"): FunctionFragment; + getEvent(nameOrSignatureOrTopic: "ApprovalForAll" | "NewOwner" | "NewResolver" | "NewTTL" | "Transfer"): EventFragment; + encodeFunctionData(functionFragment: "isApprovedForAll", values: [AddressLike, AddressLike]): string; + encodeFunctionData(functionFragment: "old", values?: undefined): string; + encodeFunctionData(functionFragment: "owner", values: [BytesLike]): string; + encodeFunctionData(functionFragment: "recordExists", values: [BytesLike]): string; + encodeFunctionData(functionFragment: "resolver", values: [BytesLike]): string; + encodeFunctionData(functionFragment: "setApprovalForAll", values: [AddressLike, boolean]): string; + encodeFunctionData(functionFragment: "setOwner", values: [BytesLike, AddressLike]): string; + encodeFunctionData(functionFragment: "setRecord", values: [BytesLike, AddressLike, AddressLike, BigNumberish]): string; + encodeFunctionData(functionFragment: "setResolver", values: [BytesLike, AddressLike]): string; + encodeFunctionData(functionFragment: "setSubnodeOwner", values: [BytesLike, BytesLike, AddressLike]): string; + encodeFunctionData(functionFragment: "setSubnodeRecord", values: [BytesLike, BytesLike, AddressLike, AddressLike, BigNumberish]): string; + encodeFunctionData(functionFragment: "setTTL", values: [BytesLike, BigNumberish]): string; + encodeFunctionData(functionFragment: "ttl", values: [BytesLike]): string; + decodeFunctionResult(functionFragment: "isApprovedForAll", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "old", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "recordExists", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "resolver", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setApprovalForAll", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setOwner", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setRecord", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setResolver", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setSubnodeOwner", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setSubnodeRecord", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setTTL", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "ttl", data: BytesLike): Result; +} +export declare namespace ApprovalForAllEvent { + type InputTuple = [ + owner: AddressLike, + operator: AddressLike, + approved: boolean + ]; + type OutputTuple = [ + owner: string, + operator: string, + approved: boolean + ]; + interface OutputObject { + owner: string; + operator: string; + approved: boolean; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace NewOwnerEvent { + type InputTuple = [ + node: BytesLike, + label: BytesLike, + owner: AddressLike + ]; + type OutputTuple = [node: string, label: string, owner: string]; + interface OutputObject { + node: string; + label: string; + owner: string; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace NewResolverEvent { + type InputTuple = [node: BytesLike, resolver: AddressLike]; + type OutputTuple = [node: string, resolver: string]; + interface OutputObject { + node: string; + resolver: string; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace NewTTLEvent { + type InputTuple = [node: BytesLike, ttl: BigNumberish]; + type OutputTuple = [node: string, ttl: bigint]; + interface OutputObject { + node: string; + ttl: bigint; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace TransferEvent { + type InputTuple = [node: BytesLike, owner: AddressLike]; + type OutputTuple = [node: string, owner: string]; + interface OutputObject { + node: string; + owner: string; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export interface ENSRegistry extends BaseContract { + connect(runner?: ContractRunner | null): ENSRegistry; + waitForDeployment(): Promise; + interface: ENSRegistryInterface; + queryFilter(event: TCEvent, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; + queryFilter(filter: TypedDeferredTopicFilter, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; + on(event: TCEvent, listener: TypedListener): Promise; + on(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; + once(event: TCEvent, listener: TypedListener): Promise; + once(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; + listeners(event: TCEvent): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners(event?: TCEvent): Promise; + isApprovedForAll: TypedContractMethod<[ + owner: AddressLike, + operator: AddressLike + ], [ + boolean + ], "view">; + old: TypedContractMethod<[], [string], "view">; + owner: TypedContractMethod<[node: BytesLike], [string], "view">; + recordExists: TypedContractMethod<[node: BytesLike], [boolean], "view">; + resolver: TypedContractMethod<[node: BytesLike], [string], "view">; + setApprovalForAll: TypedContractMethod<[ + operator: AddressLike, + approved: boolean + ], [ + void + ], "nonpayable">; + setOwner: TypedContractMethod<[ + node: BytesLike, + owner: AddressLike + ], [ + void + ], "nonpayable">; + setRecord: TypedContractMethod<[ + node: BytesLike, + owner: AddressLike, + resolver: AddressLike, + ttl: BigNumberish + ], [ + void + ], "nonpayable">; + setResolver: TypedContractMethod<[ + node: BytesLike, + resolver: AddressLike + ], [ + void + ], "nonpayable">; + setSubnodeOwner: TypedContractMethod<[ + node: BytesLike, + label: BytesLike, + owner: AddressLike + ], [ + string + ], "nonpayable">; + setSubnodeRecord: TypedContractMethod<[ + node: BytesLike, + label: BytesLike, + owner: AddressLike, + resolver: AddressLike, + ttl: BigNumberish + ], [ + void + ], "nonpayable">; + setTTL: TypedContractMethod<[ + node: BytesLike, + ttl: BigNumberish + ], [ + void + ], "nonpayable">; + ttl: TypedContractMethod<[node: BytesLike], [bigint], "view">; + getFunction(key: string | FunctionFragment): T; + getFunction(nameOrSignature: "isApprovedForAll"): TypedContractMethod<[ + owner: AddressLike, + operator: AddressLike + ], [ + boolean + ], "view">; + getFunction(nameOrSignature: "old"): TypedContractMethod<[], [string], "view">; + getFunction(nameOrSignature: "owner"): TypedContractMethod<[node: BytesLike], [string], "view">; + getFunction(nameOrSignature: "recordExists"): TypedContractMethod<[node: BytesLike], [boolean], "view">; + getFunction(nameOrSignature: "resolver"): TypedContractMethod<[node: BytesLike], [string], "view">; + getFunction(nameOrSignature: "setApprovalForAll"): TypedContractMethod<[ + operator: AddressLike, + approved: boolean + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "setOwner"): TypedContractMethod<[ + node: BytesLike, + owner: AddressLike + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "setRecord"): TypedContractMethod<[ + node: BytesLike, + owner: AddressLike, + resolver: AddressLike, + ttl: BigNumberish + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "setResolver"): TypedContractMethod<[ + node: BytesLike, + resolver: AddressLike + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "setSubnodeOwner"): TypedContractMethod<[ + node: BytesLike, + label: BytesLike, + owner: AddressLike + ], [ + string + ], "nonpayable">; + getFunction(nameOrSignature: "setSubnodeRecord"): TypedContractMethod<[ + node: BytesLike, + label: BytesLike, + owner: AddressLike, + resolver: AddressLike, + ttl: BigNumberish + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "setTTL"): TypedContractMethod<[ + node: BytesLike, + ttl: BigNumberish + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "ttl"): TypedContractMethod<[node: BytesLike], [bigint], "view">; + getEvent(key: "ApprovalForAll"): TypedContractEvent; + getEvent(key: "NewOwner"): TypedContractEvent; + getEvent(key: "NewResolver"): TypedContractEvent; + getEvent(key: "NewTTL"): TypedContractEvent; + getEvent(key: "Transfer"): TypedContractEvent; + filters: { + "ApprovalForAll(address,address,bool)": TypedContractEvent; + ApprovalForAll: TypedContractEvent; + "NewOwner(bytes32,bytes32,address)": TypedContractEvent; + NewOwner: TypedContractEvent; + "NewResolver(bytes32,address)": TypedContractEvent; + NewResolver: TypedContractEvent; + "NewTTL(bytes32,uint64)": TypedContractEvent; + NewTTL: TypedContractEvent; + "Transfer(bytes32,address)": TypedContractEvent; + Transfer: TypedContractEvent; + }; +} diff --git a/dist/typechain/ENSResolver.d.ts b/dist/typechain/ENSResolver.d.ts new file mode 100644 index 0000000..6958bd8 --- /dev/null +++ b/dist/typechain/ENSResolver.d.ts @@ -0,0 +1,660 @@ +import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, EventFragment, AddressLike, ContractRunner, ContractMethod, Listener } from "ethers"; +import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedLogDescription, TypedListener, TypedContractMethod } from "./common"; +export interface ENSResolverInterface extends Interface { + getFunction(nameOrSignature: "ABI" | "addr(bytes32)" | "addr(bytes32,uint256)" | "approve" | "clearRecords" | "contenthash" | "dnsRecord" | "hasDNSRecords" | "interfaceImplementer" | "isApprovedFor" | "isApprovedForAll" | "multicall" | "multicallWithNodeCheck" | "name" | "pubkey" | "recordVersions" | "setABI" | "setAddr(bytes32,uint256,bytes)" | "setAddr(bytes32,address)" | "setApprovalForAll" | "setContenthash" | "setDNSRecords" | "setInterface" | "setName" | "setPubkey" | "setText" | "setZonehash" | "supportsInterface" | "text" | "zonehash"): FunctionFragment; + getEvent(nameOrSignatureOrTopic: "ABIChanged" | "AddrChanged" | "AddressChanged" | "ApprovalForAll" | "Approved" | "ContenthashChanged" | "DNSRecordChanged" | "DNSRecordDeleted" | "DNSZonehashChanged" | "InterfaceChanged" | "NameChanged" | "PubkeyChanged" | "TextChanged" | "VersionChanged"): EventFragment; + encodeFunctionData(functionFragment: "ABI", values: [BytesLike, BigNumberish]): string; + encodeFunctionData(functionFragment: "addr(bytes32)", values: [BytesLike]): string; + encodeFunctionData(functionFragment: "addr(bytes32,uint256)", values: [BytesLike, BigNumberish]): string; + encodeFunctionData(functionFragment: "approve", values: [BytesLike, AddressLike, boolean]): string; + encodeFunctionData(functionFragment: "clearRecords", values: [BytesLike]): string; + encodeFunctionData(functionFragment: "contenthash", values: [BytesLike]): string; + encodeFunctionData(functionFragment: "dnsRecord", values: [BytesLike, BytesLike, BigNumberish]): string; + encodeFunctionData(functionFragment: "hasDNSRecords", values: [BytesLike, BytesLike]): string; + encodeFunctionData(functionFragment: "interfaceImplementer", values: [BytesLike, BytesLike]): string; + encodeFunctionData(functionFragment: "isApprovedFor", values: [AddressLike, BytesLike, AddressLike]): string; + encodeFunctionData(functionFragment: "isApprovedForAll", values: [AddressLike, AddressLike]): string; + encodeFunctionData(functionFragment: "multicall", values: [BytesLike[]]): string; + encodeFunctionData(functionFragment: "multicallWithNodeCheck", values: [BytesLike, BytesLike[]]): string; + encodeFunctionData(functionFragment: "name", values: [BytesLike]): string; + encodeFunctionData(functionFragment: "pubkey", values: [BytesLike]): string; + encodeFunctionData(functionFragment: "recordVersions", values: [BytesLike]): string; + encodeFunctionData(functionFragment: "setABI", values: [BytesLike, BigNumberish, BytesLike]): string; + encodeFunctionData(functionFragment: "setAddr(bytes32,uint256,bytes)", values: [BytesLike, BigNumberish, BytesLike]): string; + encodeFunctionData(functionFragment: "setAddr(bytes32,address)", values: [BytesLike, AddressLike]): string; + encodeFunctionData(functionFragment: "setApprovalForAll", values: [AddressLike, boolean]): string; + encodeFunctionData(functionFragment: "setContenthash", values: [BytesLike, BytesLike]): string; + encodeFunctionData(functionFragment: "setDNSRecords", values: [BytesLike, BytesLike]): string; + encodeFunctionData(functionFragment: "setInterface", values: [BytesLike, BytesLike, AddressLike]): string; + encodeFunctionData(functionFragment: "setName", values: [BytesLike, string]): string; + encodeFunctionData(functionFragment: "setPubkey", values: [BytesLike, BytesLike, BytesLike]): string; + encodeFunctionData(functionFragment: "setText", values: [BytesLike, string, string]): string; + encodeFunctionData(functionFragment: "setZonehash", values: [BytesLike, BytesLike]): string; + encodeFunctionData(functionFragment: "supportsInterface", values: [BytesLike]): string; + encodeFunctionData(functionFragment: "text", values: [BytesLike, string]): string; + encodeFunctionData(functionFragment: "zonehash", values: [BytesLike]): string; + decodeFunctionResult(functionFragment: "ABI", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "addr(bytes32)", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "addr(bytes32,uint256)", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "clearRecords", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "contenthash", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "dnsRecord", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "hasDNSRecords", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "interfaceImplementer", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "isApprovedFor", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "isApprovedForAll", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "multicall", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "multicallWithNodeCheck", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "name", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "pubkey", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "recordVersions", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setABI", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setAddr(bytes32,uint256,bytes)", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setAddr(bytes32,address)", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setApprovalForAll", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setContenthash", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setDNSRecords", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setInterface", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setName", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setPubkey", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setText", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setZonehash", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "supportsInterface", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "text", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "zonehash", data: BytesLike): Result; +} +export declare namespace ABIChangedEvent { + type InputTuple = [node: BytesLike, contentType: BigNumberish]; + type OutputTuple = [node: string, contentType: bigint]; + interface OutputObject { + node: string; + contentType: bigint; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace AddrChangedEvent { + type InputTuple = [node: BytesLike, a: AddressLike]; + type OutputTuple = [node: string, a: string]; + interface OutputObject { + node: string; + a: string; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace AddressChangedEvent { + type InputTuple = [ + node: BytesLike, + coinType: BigNumberish, + newAddress: BytesLike + ]; + type OutputTuple = [ + node: string, + coinType: bigint, + newAddress: string + ]; + interface OutputObject { + node: string; + coinType: bigint; + newAddress: string; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace ApprovalForAllEvent { + type InputTuple = [ + owner: AddressLike, + operator: AddressLike, + approved: boolean + ]; + type OutputTuple = [ + owner: string, + operator: string, + approved: boolean + ]; + interface OutputObject { + owner: string; + operator: string; + approved: boolean; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace ApprovedEvent { + type InputTuple = [ + owner: AddressLike, + node: BytesLike, + delegate: AddressLike, + approved: boolean + ]; + type OutputTuple = [ + owner: string, + node: string, + delegate: string, + approved: boolean + ]; + interface OutputObject { + owner: string; + node: string; + delegate: string; + approved: boolean; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace ContenthashChangedEvent { + type InputTuple = [node: BytesLike, hash: BytesLike]; + type OutputTuple = [node: string, hash: string]; + interface OutputObject { + node: string; + hash: string; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace DNSRecordChangedEvent { + type InputTuple = [ + node: BytesLike, + name: BytesLike, + resource: BigNumberish, + record: BytesLike + ]; + type OutputTuple = [ + node: string, + name: string, + resource: bigint, + record: string + ]; + interface OutputObject { + node: string; + name: string; + resource: bigint; + record: string; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace DNSRecordDeletedEvent { + type InputTuple = [ + node: BytesLike, + name: BytesLike, + resource: BigNumberish + ]; + type OutputTuple = [node: string, name: string, resource: bigint]; + interface OutputObject { + node: string; + name: string; + resource: bigint; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace DNSZonehashChangedEvent { + type InputTuple = [ + node: BytesLike, + lastzonehash: BytesLike, + zonehash: BytesLike + ]; + type OutputTuple = [ + node: string, + lastzonehash: string, + zonehash: string + ]; + interface OutputObject { + node: string; + lastzonehash: string; + zonehash: string; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace InterfaceChangedEvent { + type InputTuple = [ + node: BytesLike, + interfaceID: BytesLike, + implementer: AddressLike + ]; + type OutputTuple = [ + node: string, + interfaceID: string, + implementer: string + ]; + interface OutputObject { + node: string; + interfaceID: string; + implementer: string; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace NameChangedEvent { + type InputTuple = [node: BytesLike, name: string]; + type OutputTuple = [node: string, name: string]; + interface OutputObject { + node: string; + name: string; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace PubkeyChangedEvent { + type InputTuple = [node: BytesLike, x: BytesLike, y: BytesLike]; + type OutputTuple = [node: string, x: string, y: string]; + interface OutputObject { + node: string; + x: string; + y: string; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace TextChangedEvent { + type InputTuple = [ + node: BytesLike, + indexedKey: string, + key: string, + value: string + ]; + type OutputTuple = [ + node: string, + indexedKey: string, + key: string, + value: string + ]; + interface OutputObject { + node: string; + indexedKey: string; + key: string; + value: string; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace VersionChangedEvent { + type InputTuple = [node: BytesLike, newVersion: BigNumberish]; + type OutputTuple = [node: string, newVersion: bigint]; + interface OutputObject { + node: string; + newVersion: bigint; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export interface ENSResolver extends BaseContract { + connect(runner?: ContractRunner | null): ENSResolver; + waitForDeployment(): Promise; + interface: ENSResolverInterface; + queryFilter(event: TCEvent, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; + queryFilter(filter: TypedDeferredTopicFilter, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; + on(event: TCEvent, listener: TypedListener): Promise; + on(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; + once(event: TCEvent, listener: TypedListener): Promise; + once(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; + listeners(event: TCEvent): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners(event?: TCEvent): Promise; + ABI: TypedContractMethod<[ + node: BytesLike, + contentTypes: BigNumberish + ], [ + [bigint, string] + ], "view">; + "addr(bytes32)": TypedContractMethod<[node: BytesLike], [string], "view">; + "addr(bytes32,uint256)": TypedContractMethod<[ + node: BytesLike, + coinType: BigNumberish + ], [ + string + ], "view">; + approve: TypedContractMethod<[ + node: BytesLike, + delegate: AddressLike, + approved: boolean + ], [ + void + ], "nonpayable">; + clearRecords: TypedContractMethod<[node: BytesLike], [void], "nonpayable">; + contenthash: TypedContractMethod<[node: BytesLike], [string], "view">; + dnsRecord: TypedContractMethod<[ + node: BytesLike, + name: BytesLike, + resource: BigNumberish + ], [ + string + ], "view">; + hasDNSRecords: TypedContractMethod<[ + node: BytesLike, + name: BytesLike + ], [ + boolean + ], "view">; + interfaceImplementer: TypedContractMethod<[ + node: BytesLike, + interfaceID: BytesLike + ], [ + string + ], "view">; + isApprovedFor: TypedContractMethod<[ + owner: AddressLike, + node: BytesLike, + delegate: AddressLike + ], [ + boolean + ], "view">; + isApprovedForAll: TypedContractMethod<[ + account: AddressLike, + operator: AddressLike + ], [ + boolean + ], "view">; + multicall: TypedContractMethod<[data: BytesLike[]], [string[]], "nonpayable">; + multicallWithNodeCheck: TypedContractMethod<[ + nodehash: BytesLike, + data: BytesLike[] + ], [ + string[] + ], "nonpayable">; + name: TypedContractMethod<[node: BytesLike], [string], "view">; + pubkey: TypedContractMethod<[ + node: BytesLike + ], [ + [string, string] & { + x: string; + y: string; + } + ], "view">; + recordVersions: TypedContractMethod<[arg0: BytesLike], [bigint], "view">; + setABI: TypedContractMethod<[ + node: BytesLike, + contentType: BigNumberish, + data: BytesLike + ], [ + void + ], "nonpayable">; + "setAddr(bytes32,uint256,bytes)": TypedContractMethod<[ + node: BytesLike, + coinType: BigNumberish, + a: BytesLike + ], [ + void + ], "nonpayable">; + "setAddr(bytes32,address)": TypedContractMethod<[ + node: BytesLike, + a: AddressLike + ], [ + void + ], "nonpayable">; + setApprovalForAll: TypedContractMethod<[ + operator: AddressLike, + approved: boolean + ], [ + void + ], "nonpayable">; + setContenthash: TypedContractMethod<[ + node: BytesLike, + hash: BytesLike + ], [ + void + ], "nonpayable">; + setDNSRecords: TypedContractMethod<[ + node: BytesLike, + data: BytesLike + ], [ + void + ], "nonpayable">; + setInterface: TypedContractMethod<[ + node: BytesLike, + interfaceID: BytesLike, + implementer: AddressLike + ], [ + void + ], "nonpayable">; + setName: TypedContractMethod<[ + node: BytesLike, + newName: string + ], [ + void + ], "nonpayable">; + setPubkey: TypedContractMethod<[ + node: BytesLike, + x: BytesLike, + y: BytesLike + ], [ + void + ], "nonpayable">; + setText: TypedContractMethod<[ + node: BytesLike, + key: string, + value: string + ], [ + void + ], "nonpayable">; + setZonehash: TypedContractMethod<[ + node: BytesLike, + hash: BytesLike + ], [ + void + ], "nonpayable">; + supportsInterface: TypedContractMethod<[ + interfaceID: BytesLike + ], [ + boolean + ], "view">; + text: TypedContractMethod<[node: BytesLike, key: string], [string], "view">; + zonehash: TypedContractMethod<[node: BytesLike], [string], "view">; + getFunction(key: string | FunctionFragment): T; + getFunction(nameOrSignature: "ABI"): TypedContractMethod<[ + node: BytesLike, + contentTypes: BigNumberish + ], [ + [bigint, string] + ], "view">; + getFunction(nameOrSignature: "addr(bytes32)"): TypedContractMethod<[node: BytesLike], [string], "view">; + getFunction(nameOrSignature: "addr(bytes32,uint256)"): TypedContractMethod<[ + node: BytesLike, + coinType: BigNumberish + ], [ + string + ], "view">; + getFunction(nameOrSignature: "approve"): TypedContractMethod<[ + node: BytesLike, + delegate: AddressLike, + approved: boolean + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "clearRecords"): TypedContractMethod<[node: BytesLike], [void], "nonpayable">; + getFunction(nameOrSignature: "contenthash"): TypedContractMethod<[node: BytesLike], [string], "view">; + getFunction(nameOrSignature: "dnsRecord"): TypedContractMethod<[ + node: BytesLike, + name: BytesLike, + resource: BigNumberish + ], [ + string + ], "view">; + getFunction(nameOrSignature: "hasDNSRecords"): TypedContractMethod<[node: BytesLike, name: BytesLike], [boolean], "view">; + getFunction(nameOrSignature: "interfaceImplementer"): TypedContractMethod<[ + node: BytesLike, + interfaceID: BytesLike + ], [ + string + ], "view">; + getFunction(nameOrSignature: "isApprovedFor"): TypedContractMethod<[ + owner: AddressLike, + node: BytesLike, + delegate: AddressLike + ], [ + boolean + ], "view">; + getFunction(nameOrSignature: "isApprovedForAll"): TypedContractMethod<[ + account: AddressLike, + operator: AddressLike + ], [ + boolean + ], "view">; + getFunction(nameOrSignature: "multicall"): TypedContractMethod<[data: BytesLike[]], [string[]], "nonpayable">; + getFunction(nameOrSignature: "multicallWithNodeCheck"): TypedContractMethod<[ + nodehash: BytesLike, + data: BytesLike[] + ], [ + string[] + ], "nonpayable">; + getFunction(nameOrSignature: "name"): TypedContractMethod<[node: BytesLike], [string], "view">; + getFunction(nameOrSignature: "pubkey"): TypedContractMethod<[ + node: BytesLike + ], [ + [string, string] & { + x: string; + y: string; + } + ], "view">; + getFunction(nameOrSignature: "recordVersions"): TypedContractMethod<[arg0: BytesLike], [bigint], "view">; + getFunction(nameOrSignature: "setABI"): TypedContractMethod<[ + node: BytesLike, + contentType: BigNumberish, + data: BytesLike + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "setAddr(bytes32,uint256,bytes)"): TypedContractMethod<[ + node: BytesLike, + coinType: BigNumberish, + a: BytesLike + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "setAddr(bytes32,address)"): TypedContractMethod<[ + node: BytesLike, + a: AddressLike + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "setApprovalForAll"): TypedContractMethod<[ + operator: AddressLike, + approved: boolean + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "setContenthash"): TypedContractMethod<[ + node: BytesLike, + hash: BytesLike + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "setDNSRecords"): TypedContractMethod<[ + node: BytesLike, + data: BytesLike + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "setInterface"): TypedContractMethod<[ + node: BytesLike, + interfaceID: BytesLike, + implementer: AddressLike + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "setName"): TypedContractMethod<[ + node: BytesLike, + newName: string + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "setPubkey"): TypedContractMethod<[ + node: BytesLike, + x: BytesLike, + y: BytesLike + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "setText"): TypedContractMethod<[ + node: BytesLike, + key: string, + value: string + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "setZonehash"): TypedContractMethod<[ + node: BytesLike, + hash: BytesLike + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "supportsInterface"): TypedContractMethod<[interfaceID: BytesLike], [boolean], "view">; + getFunction(nameOrSignature: "text"): TypedContractMethod<[node: BytesLike, key: string], [string], "view">; + getFunction(nameOrSignature: "zonehash"): TypedContractMethod<[node: BytesLike], [string], "view">; + getEvent(key: "ABIChanged"): TypedContractEvent; + getEvent(key: "AddrChanged"): TypedContractEvent; + getEvent(key: "AddressChanged"): TypedContractEvent; + getEvent(key: "ApprovalForAll"): TypedContractEvent; + getEvent(key: "Approved"): TypedContractEvent; + getEvent(key: "ContenthashChanged"): TypedContractEvent; + getEvent(key: "DNSRecordChanged"): TypedContractEvent; + getEvent(key: "DNSRecordDeleted"): TypedContractEvent; + getEvent(key: "DNSZonehashChanged"): TypedContractEvent; + getEvent(key: "InterfaceChanged"): TypedContractEvent; + getEvent(key: "NameChanged"): TypedContractEvent; + getEvent(key: "PubkeyChanged"): TypedContractEvent; + getEvent(key: "TextChanged"): TypedContractEvent; + getEvent(key: "VersionChanged"): TypedContractEvent; + filters: { + "ABIChanged(bytes32,uint256)": TypedContractEvent; + ABIChanged: TypedContractEvent; + "AddrChanged(bytes32,address)": TypedContractEvent; + AddrChanged: TypedContractEvent; + "AddressChanged(bytes32,uint256,bytes)": TypedContractEvent; + AddressChanged: TypedContractEvent; + "ApprovalForAll(address,address,bool)": TypedContractEvent; + ApprovalForAll: TypedContractEvent; + "Approved(address,bytes32,address,bool)": TypedContractEvent; + Approved: TypedContractEvent; + "ContenthashChanged(bytes32,bytes)": TypedContractEvent; + ContenthashChanged: TypedContractEvent; + "DNSRecordChanged(bytes32,bytes,uint16,bytes)": TypedContractEvent; + DNSRecordChanged: TypedContractEvent; + "DNSRecordDeleted(bytes32,bytes,uint16)": TypedContractEvent; + DNSRecordDeleted: TypedContractEvent; + "DNSZonehashChanged(bytes32,bytes,bytes)": TypedContractEvent; + DNSZonehashChanged: TypedContractEvent; + "InterfaceChanged(bytes32,bytes4,address)": TypedContractEvent; + InterfaceChanged: TypedContractEvent; + "NameChanged(bytes32,string)": TypedContractEvent; + NameChanged: TypedContractEvent; + "PubkeyChanged(bytes32,bytes32,bytes32)": TypedContractEvent; + PubkeyChanged: TypedContractEvent; + "TextChanged(bytes32,string,string,string)": TypedContractEvent; + TextChanged: TypedContractEvent; + "VersionChanged(bytes32,uint64)": TypedContractEvent; + VersionChanged: TypedContractEvent; + }; +} diff --git a/dist/typechain/factories/ENSNameWrapper__factory.d.ts b/dist/typechain/factories/ENSNameWrapper__factory.d.ts new file mode 100644 index 0000000..dcb3fd4 --- /dev/null +++ b/dist/typechain/factories/ENSNameWrapper__factory.d.ts @@ -0,0 +1,1127 @@ +import { type ContractRunner } from "ethers"; +import type { ENSNameWrapper, ENSNameWrapperInterface } from "../ENSNameWrapper"; +export declare class ENSNameWrapper__factory { + static readonly abi: readonly [{ + readonly inputs: readonly [{ + readonly internalType: "contract ENS"; + readonly name: "_ens"; + readonly type: "address"; + }, { + readonly internalType: "contract IBaseRegistrar"; + readonly name: "_registrar"; + readonly type: "address"; + }, { + readonly internalType: "contract IMetadataService"; + readonly name: "_metadataService"; + readonly type: "address"; + }]; + readonly stateMutability: "nonpayable"; + readonly type: "constructor"; + }, { + readonly inputs: readonly []; + readonly name: "CannotUpgrade"; + readonly type: "error"; + }, { + readonly inputs: readonly []; + readonly name: "IncompatibleParent"; + readonly type: "error"; + }, { + readonly inputs: readonly [{ + readonly internalType: "address"; + readonly name: "owner"; + readonly type: "address"; + }]; + readonly name: "IncorrectTargetOwner"; + readonly type: "error"; + }, { + readonly inputs: readonly []; + readonly name: "IncorrectTokenType"; + readonly type: "error"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "labelHash"; + readonly type: "bytes32"; + }, { + readonly internalType: "bytes32"; + readonly name: "expectedLabelhash"; + readonly type: "bytes32"; + }]; + readonly name: "LabelMismatch"; + readonly type: "error"; + }, { + readonly inputs: readonly [{ + readonly internalType: "string"; + readonly name: "label"; + readonly type: "string"; + }]; + readonly name: "LabelTooLong"; + readonly type: "error"; + }, { + readonly inputs: readonly []; + readonly name: "LabelTooShort"; + readonly type: "error"; + }, { + readonly inputs: readonly []; + readonly name: "NameIsNotWrapped"; + readonly type: "error"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }]; + readonly name: "OperationProhibited"; + readonly type: "error"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "address"; + readonly name: "addr"; + readonly type: "address"; + }]; + readonly name: "Unauthorised"; + readonly type: "error"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "address"; + readonly name: "owner"; + readonly type: "address"; + }, { + readonly indexed: true; + readonly internalType: "address"; + readonly name: "approved"; + readonly type: "address"; + }, { + readonly indexed: true; + readonly internalType: "uint256"; + readonly name: "tokenId"; + readonly type: "uint256"; + }]; + readonly name: "Approval"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "address"; + readonly name: "account"; + readonly type: "address"; + }, { + readonly indexed: true; + readonly internalType: "address"; + readonly name: "operator"; + readonly type: "address"; + }, { + readonly indexed: false; + readonly internalType: "bool"; + readonly name: "approved"; + readonly type: "bool"; + }]; + readonly name: "ApprovalForAll"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "address"; + readonly name: "controller"; + readonly type: "address"; + }, { + readonly indexed: false; + readonly internalType: "bool"; + readonly name: "active"; + readonly type: "bool"; + }]; + readonly name: "ControllerChanged"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly indexed: false; + readonly internalType: "uint64"; + readonly name: "expiry"; + readonly type: "uint64"; + }]; + readonly name: "ExpiryExtended"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly indexed: false; + readonly internalType: "uint32"; + readonly name: "fuses"; + readonly type: "uint32"; + }]; + readonly name: "FusesSet"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly indexed: false; + readonly internalType: "address"; + readonly name: "owner"; + readonly type: "address"; + }]; + readonly name: "NameUnwrapped"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly indexed: false; + readonly internalType: "bytes"; + readonly name: "name"; + readonly type: "bytes"; + }, { + readonly indexed: false; + readonly internalType: "address"; + readonly name: "owner"; + readonly type: "address"; + }, { + readonly indexed: false; + readonly internalType: "uint32"; + readonly name: "fuses"; + readonly type: "uint32"; + }, { + readonly indexed: false; + readonly internalType: "uint64"; + readonly name: "expiry"; + readonly type: "uint64"; + }]; + readonly name: "NameWrapped"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "address"; + readonly name: "previousOwner"; + readonly type: "address"; + }, { + readonly indexed: true; + readonly internalType: "address"; + readonly name: "newOwner"; + readonly type: "address"; + }]; + readonly name: "OwnershipTransferred"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "address"; + readonly name: "operator"; + readonly type: "address"; + }, { + readonly indexed: true; + readonly internalType: "address"; + readonly name: "from"; + readonly type: "address"; + }, { + readonly indexed: true; + readonly internalType: "address"; + readonly name: "to"; + readonly type: "address"; + }, { + readonly indexed: false; + readonly internalType: "uint256[]"; + readonly name: "ids"; + readonly type: "uint256[]"; + }, { + readonly indexed: false; + readonly internalType: "uint256[]"; + readonly name: "values"; + readonly type: "uint256[]"; + }]; + readonly name: "TransferBatch"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "address"; + readonly name: "operator"; + readonly type: "address"; + }, { + readonly indexed: true; + readonly internalType: "address"; + readonly name: "from"; + readonly type: "address"; + }, { + readonly indexed: true; + readonly internalType: "address"; + readonly name: "to"; + readonly type: "address"; + }, { + readonly indexed: false; + readonly internalType: "uint256"; + readonly name: "id"; + readonly type: "uint256"; + }, { + readonly indexed: false; + readonly internalType: "uint256"; + readonly name: "value"; + readonly type: "uint256"; + }]; + readonly name: "TransferSingle"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: false; + readonly internalType: "string"; + readonly name: "value"; + readonly type: "string"; + }, { + readonly indexed: true; + readonly internalType: "uint256"; + readonly name: "id"; + readonly type: "uint256"; + }]; + readonly name: "URI"; + readonly type: "event"; + }, { + readonly inputs: readonly [{ + readonly internalType: "uint256"; + readonly name: ""; + readonly type: "uint256"; + }]; + readonly name: "_tokens"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: ""; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "uint32"; + readonly name: "fuseMask"; + readonly type: "uint32"; + }]; + readonly name: "allFusesBurned"; + readonly outputs: readonly [{ + readonly internalType: "bool"; + readonly name: ""; + readonly type: "bool"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "address"; + readonly name: "to"; + readonly type: "address"; + }, { + readonly internalType: "uint256"; + readonly name: "tokenId"; + readonly type: "uint256"; + }]; + readonly name: "approve"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "address"; + readonly name: "account"; + readonly type: "address"; + }, { + readonly internalType: "uint256"; + readonly name: "id"; + readonly type: "uint256"; + }]; + readonly name: "balanceOf"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: ""; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "address[]"; + readonly name: "accounts"; + readonly type: "address[]"; + }, { + readonly internalType: "uint256[]"; + readonly name: "ids"; + readonly type: "uint256[]"; + }]; + readonly name: "balanceOfBatch"; + readonly outputs: readonly [{ + readonly internalType: "uint256[]"; + readonly name: ""; + readonly type: "uint256[]"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "address"; + readonly name: "addr"; + readonly type: "address"; + }]; + readonly name: "canExtendSubnames"; + readonly outputs: readonly [{ + readonly internalType: "bool"; + readonly name: ""; + readonly type: "bool"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "address"; + readonly name: "addr"; + readonly type: "address"; + }]; + readonly name: "canModifyName"; + readonly outputs: readonly [{ + readonly internalType: "bool"; + readonly name: ""; + readonly type: "bool"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "address"; + readonly name: ""; + readonly type: "address"; + }]; + readonly name: "controllers"; + readonly outputs: readonly [{ + readonly internalType: "bool"; + readonly name: ""; + readonly type: "bool"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "ens"; + readonly outputs: readonly [{ + readonly internalType: "contract ENS"; + readonly name: ""; + readonly type: "address"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "parentNode"; + readonly type: "bytes32"; + }, { + readonly internalType: "bytes32"; + readonly name: "labelhash"; + readonly type: "bytes32"; + }, { + readonly internalType: "uint64"; + readonly name: "expiry"; + readonly type: "uint64"; + }]; + readonly name: "extendExpiry"; + readonly outputs: readonly [{ + readonly internalType: "uint64"; + readonly name: ""; + readonly type: "uint64"; + }]; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "id"; + readonly type: "uint256"; + }]; + readonly name: "getApproved"; + readonly outputs: readonly [{ + readonly internalType: "address"; + readonly name: "operator"; + readonly type: "address"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "id"; + readonly type: "uint256"; + }]; + readonly name: "getData"; + readonly outputs: readonly [{ + readonly internalType: "address"; + readonly name: "owner"; + readonly type: "address"; + }, { + readonly internalType: "uint32"; + readonly name: "fuses"; + readonly type: "uint32"; + }, { + readonly internalType: "uint64"; + readonly name: "expiry"; + readonly type: "uint64"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "address"; + readonly name: "account"; + readonly type: "address"; + }, { + readonly internalType: "address"; + readonly name: "operator"; + readonly type: "address"; + }]; + readonly name: "isApprovedForAll"; + readonly outputs: readonly [{ + readonly internalType: "bool"; + readonly name: ""; + readonly type: "bool"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "parentNode"; + readonly type: "bytes32"; + }, { + readonly internalType: "bytes32"; + readonly name: "labelhash"; + readonly type: "bytes32"; + }]; + readonly name: "isWrapped"; + readonly outputs: readonly [{ + readonly internalType: "bool"; + readonly name: ""; + readonly type: "bool"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }]; + readonly name: "isWrapped"; + readonly outputs: readonly [{ + readonly internalType: "bool"; + readonly name: ""; + readonly type: "bool"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "metadataService"; + readonly outputs: readonly [{ + readonly internalType: "contract IMetadataService"; + readonly name: ""; + readonly type: "address"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "name"; + readonly outputs: readonly [{ + readonly internalType: "string"; + readonly name: ""; + readonly type: "string"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: ""; + readonly type: "bytes32"; + }]; + readonly name: "names"; + readonly outputs: readonly [{ + readonly internalType: "bytes"; + readonly name: ""; + readonly type: "bytes"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "address"; + readonly name: "to"; + readonly type: "address"; + }, { + readonly internalType: "address"; + readonly name: ""; + readonly type: "address"; + }, { + readonly internalType: "uint256"; + readonly name: "tokenId"; + readonly type: "uint256"; + }, { + readonly internalType: "bytes"; + readonly name: "data"; + readonly type: "bytes"; + }]; + readonly name: "onERC721Received"; + readonly outputs: readonly [{ + readonly internalType: "bytes4"; + readonly name: ""; + readonly type: "bytes4"; + }]; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "owner"; + readonly outputs: readonly [{ + readonly internalType: "address"; + readonly name: ""; + readonly type: "address"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "id"; + readonly type: "uint256"; + }]; + readonly name: "ownerOf"; + readonly outputs: readonly [{ + readonly internalType: "address"; + readonly name: "owner"; + readonly type: "address"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "address"; + readonly name: "_token"; + readonly type: "address"; + }, { + readonly internalType: "address"; + readonly name: "_to"; + readonly type: "address"; + }, { + readonly internalType: "uint256"; + readonly name: "_amount"; + readonly type: "uint256"; + }]; + readonly name: "recoverFunds"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "string"; + readonly name: "label"; + readonly type: "string"; + }, { + readonly internalType: "address"; + readonly name: "wrappedOwner"; + readonly type: "address"; + }, { + readonly internalType: "uint256"; + readonly name: "duration"; + readonly type: "uint256"; + }, { + readonly internalType: "address"; + readonly name: "resolver"; + readonly type: "address"; + }, { + readonly internalType: "uint16"; + readonly name: "ownerControlledFuses"; + readonly type: "uint16"; + }]; + readonly name: "registerAndWrapETH2LD"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "registrarExpiry"; + readonly type: "uint256"; + }]; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "registrar"; + readonly outputs: readonly [{ + readonly internalType: "contract IBaseRegistrar"; + readonly name: ""; + readonly type: "address"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "tokenId"; + readonly type: "uint256"; + }, { + readonly internalType: "uint256"; + readonly name: "duration"; + readonly type: "uint256"; + }]; + readonly name: "renew"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "expires"; + readonly type: "uint256"; + }]; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "renounceOwnership"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "address"; + readonly name: "from"; + readonly type: "address"; + }, { + readonly internalType: "address"; + readonly name: "to"; + readonly type: "address"; + }, { + readonly internalType: "uint256[]"; + readonly name: "ids"; + readonly type: "uint256[]"; + }, { + readonly internalType: "uint256[]"; + readonly name: "amounts"; + readonly type: "uint256[]"; + }, { + readonly internalType: "bytes"; + readonly name: "data"; + readonly type: "bytes"; + }]; + readonly name: "safeBatchTransferFrom"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "address"; + readonly name: "from"; + readonly type: "address"; + }, { + readonly internalType: "address"; + readonly name: "to"; + readonly type: "address"; + }, { + readonly internalType: "uint256"; + readonly name: "id"; + readonly type: "uint256"; + }, { + readonly internalType: "uint256"; + readonly name: "amount"; + readonly type: "uint256"; + }, { + readonly internalType: "bytes"; + readonly name: "data"; + readonly type: "bytes"; + }]; + readonly name: "safeTransferFrom"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "address"; + readonly name: "operator"; + readonly type: "address"; + }, { + readonly internalType: "bool"; + readonly name: "approved"; + readonly type: "bool"; + }]; + readonly name: "setApprovalForAll"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "parentNode"; + readonly type: "bytes32"; + }, { + readonly internalType: "bytes32"; + readonly name: "labelhash"; + readonly type: "bytes32"; + }, { + readonly internalType: "uint32"; + readonly name: "fuses"; + readonly type: "uint32"; + }, { + readonly internalType: "uint64"; + readonly name: "expiry"; + readonly type: "uint64"; + }]; + readonly name: "setChildFuses"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "address"; + readonly name: "controller"; + readonly type: "address"; + }, { + readonly internalType: "bool"; + readonly name: "active"; + readonly type: "bool"; + }]; + readonly name: "setController"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "uint16"; + readonly name: "ownerControlledFuses"; + readonly type: "uint16"; + }]; + readonly name: "setFuses"; + readonly outputs: readonly [{ + readonly internalType: "uint32"; + readonly name: ""; + readonly type: "uint32"; + }]; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "contract IMetadataService"; + readonly name: "_metadataService"; + readonly type: "address"; + }]; + readonly name: "setMetadataService"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "address"; + readonly name: "owner"; + readonly type: "address"; + }, { + readonly internalType: "address"; + readonly name: "resolver"; + readonly type: "address"; + }, { + readonly internalType: "uint64"; + readonly name: "ttl"; + readonly type: "uint64"; + }]; + readonly name: "setRecord"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "address"; + readonly name: "resolver"; + readonly type: "address"; + }]; + readonly name: "setResolver"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "parentNode"; + readonly type: "bytes32"; + }, { + readonly internalType: "string"; + readonly name: "label"; + readonly type: "string"; + }, { + readonly internalType: "address"; + readonly name: "owner"; + readonly type: "address"; + }, { + readonly internalType: "uint32"; + readonly name: "fuses"; + readonly type: "uint32"; + }, { + readonly internalType: "uint64"; + readonly name: "expiry"; + readonly type: "uint64"; + }]; + readonly name: "setSubnodeOwner"; + readonly outputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }]; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "parentNode"; + readonly type: "bytes32"; + }, { + readonly internalType: "string"; + readonly name: "label"; + readonly type: "string"; + }, { + readonly internalType: "address"; + readonly name: "owner"; + readonly type: "address"; + }, { + readonly internalType: "address"; + readonly name: "resolver"; + readonly type: "address"; + }, { + readonly internalType: "uint64"; + readonly name: "ttl"; + readonly type: "uint64"; + }, { + readonly internalType: "uint32"; + readonly name: "fuses"; + readonly type: "uint32"; + }, { + readonly internalType: "uint64"; + readonly name: "expiry"; + readonly type: "uint64"; + }]; + readonly name: "setSubnodeRecord"; + readonly outputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }]; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "uint64"; + readonly name: "ttl"; + readonly type: "uint64"; + }]; + readonly name: "setTTL"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "contract INameWrapperUpgrade"; + readonly name: "_upgradeAddress"; + readonly type: "address"; + }]; + readonly name: "setUpgradeContract"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes4"; + readonly name: "interfaceId"; + readonly type: "bytes4"; + }]; + readonly name: "supportsInterface"; + readonly outputs: readonly [{ + readonly internalType: "bool"; + readonly name: ""; + readonly type: "bool"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "address"; + readonly name: "newOwner"; + readonly type: "address"; + }]; + readonly name: "transferOwnership"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "parentNode"; + readonly type: "bytes32"; + }, { + readonly internalType: "bytes32"; + readonly name: "labelhash"; + readonly type: "bytes32"; + }, { + readonly internalType: "address"; + readonly name: "controller"; + readonly type: "address"; + }]; + readonly name: "unwrap"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "labelhash"; + readonly type: "bytes32"; + }, { + readonly internalType: "address"; + readonly name: "registrant"; + readonly type: "address"; + }, { + readonly internalType: "address"; + readonly name: "controller"; + readonly type: "address"; + }]; + readonly name: "unwrapETH2LD"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes"; + readonly name: "name"; + readonly type: "bytes"; + }, { + readonly internalType: "bytes"; + readonly name: "extraData"; + readonly type: "bytes"; + }]; + readonly name: "upgrade"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "upgradeContract"; + readonly outputs: readonly [{ + readonly internalType: "contract INameWrapperUpgrade"; + readonly name: ""; + readonly type: "address"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "tokenId"; + readonly type: "uint256"; + }]; + readonly name: "uri"; + readonly outputs: readonly [{ + readonly internalType: "string"; + readonly name: ""; + readonly type: "string"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes"; + readonly name: "name"; + readonly type: "bytes"; + }, { + readonly internalType: "address"; + readonly name: "wrappedOwner"; + readonly type: "address"; + }, { + readonly internalType: "address"; + readonly name: "resolver"; + readonly type: "address"; + }]; + readonly name: "wrap"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "string"; + readonly name: "label"; + readonly type: "string"; + }, { + readonly internalType: "address"; + readonly name: "wrappedOwner"; + readonly type: "address"; + }, { + readonly internalType: "uint16"; + readonly name: "ownerControlledFuses"; + readonly type: "uint16"; + }, { + readonly internalType: "address"; + readonly name: "resolver"; + readonly type: "address"; + }]; + readonly name: "wrapETH2LD"; + readonly outputs: readonly [{ + readonly internalType: "uint64"; + readonly name: "expiry"; + readonly type: "uint64"; + }]; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }]; + static createInterface(): ENSNameWrapperInterface; + static connect(address: string, runner?: ContractRunner | null): ENSNameWrapper; +} diff --git a/dist/typechain/factories/ENSRegistry__factory.d.ts b/dist/typechain/factories/ENSRegistry__factory.d.ts new file mode 100644 index 0000000..97d0bac --- /dev/null +++ b/dist/typechain/factories/ENSRegistry__factory.d.ts @@ -0,0 +1,337 @@ +import { type ContractRunner } from "ethers"; +import type { ENSRegistry, ENSRegistryInterface } from "../ENSRegistry"; +export declare class ENSRegistry__factory { + static readonly abi: readonly [{ + readonly inputs: readonly [{ + readonly internalType: "contract ENS"; + readonly name: "_old"; + readonly type: "address"; + }]; + readonly payable: false; + readonly stateMutability: "nonpayable"; + readonly type: "constructor"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "address"; + readonly name: "owner"; + readonly type: "address"; + }, { + readonly indexed: true; + readonly internalType: "address"; + readonly name: "operator"; + readonly type: "address"; + }, { + readonly indexed: false; + readonly internalType: "bool"; + readonly name: "approved"; + readonly type: "bool"; + }]; + readonly name: "ApprovalForAll"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly indexed: true; + readonly internalType: "bytes32"; + readonly name: "label"; + readonly type: "bytes32"; + }, { + readonly indexed: false; + readonly internalType: "address"; + readonly name: "owner"; + readonly type: "address"; + }]; + readonly name: "NewOwner"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly indexed: false; + readonly internalType: "address"; + readonly name: "resolver"; + readonly type: "address"; + }]; + readonly name: "NewResolver"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly indexed: false; + readonly internalType: "uint64"; + readonly name: "ttl"; + readonly type: "uint64"; + }]; + readonly name: "NewTTL"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly indexed: false; + readonly internalType: "address"; + readonly name: "owner"; + readonly type: "address"; + }]; + readonly name: "Transfer"; + readonly type: "event"; + }, { + readonly constant: true; + readonly inputs: readonly [{ + readonly internalType: "address"; + readonly name: "owner"; + readonly type: "address"; + }, { + readonly internalType: "address"; + readonly name: "operator"; + readonly type: "address"; + }]; + readonly name: "isApprovedForAll"; + readonly outputs: readonly [{ + readonly internalType: "bool"; + readonly name: ""; + readonly type: "bool"; + }]; + readonly payable: false; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly constant: true; + readonly inputs: readonly []; + readonly name: "old"; + readonly outputs: readonly [{ + readonly internalType: "contract ENS"; + readonly name: ""; + readonly type: "address"; + }]; + readonly payable: false; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly constant: true; + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }]; + readonly name: "owner"; + readonly outputs: readonly [{ + readonly internalType: "address"; + readonly name: ""; + readonly type: "address"; + }]; + readonly payable: false; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly constant: true; + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }]; + readonly name: "recordExists"; + readonly outputs: readonly [{ + readonly internalType: "bool"; + readonly name: ""; + readonly type: "bool"; + }]; + readonly payable: false; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly constant: true; + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }]; + readonly name: "resolver"; + readonly outputs: readonly [{ + readonly internalType: "address"; + readonly name: ""; + readonly type: "address"; + }]; + readonly payable: false; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly constant: false; + readonly inputs: readonly [{ + readonly internalType: "address"; + readonly name: "operator"; + readonly type: "address"; + }, { + readonly internalType: "bool"; + readonly name: "approved"; + readonly type: "bool"; + }]; + readonly name: "setApprovalForAll"; + readonly outputs: readonly []; + readonly payable: false; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly constant: false; + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "address"; + readonly name: "owner"; + readonly type: "address"; + }]; + readonly name: "setOwner"; + readonly outputs: readonly []; + readonly payable: false; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly constant: false; + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "address"; + readonly name: "owner"; + readonly type: "address"; + }, { + readonly internalType: "address"; + readonly name: "resolver"; + readonly type: "address"; + }, { + readonly internalType: "uint64"; + readonly name: "ttl"; + readonly type: "uint64"; + }]; + readonly name: "setRecord"; + readonly outputs: readonly []; + readonly payable: false; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly constant: false; + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "address"; + readonly name: "resolver"; + readonly type: "address"; + }]; + readonly name: "setResolver"; + readonly outputs: readonly []; + readonly payable: false; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly constant: false; + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "bytes32"; + readonly name: "label"; + readonly type: "bytes32"; + }, { + readonly internalType: "address"; + readonly name: "owner"; + readonly type: "address"; + }]; + readonly name: "setSubnodeOwner"; + readonly outputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: ""; + readonly type: "bytes32"; + }]; + readonly payable: false; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly constant: false; + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "bytes32"; + readonly name: "label"; + readonly type: "bytes32"; + }, { + readonly internalType: "address"; + readonly name: "owner"; + readonly type: "address"; + }, { + readonly internalType: "address"; + readonly name: "resolver"; + readonly type: "address"; + }, { + readonly internalType: "uint64"; + readonly name: "ttl"; + readonly type: "uint64"; + }]; + readonly name: "setSubnodeRecord"; + readonly outputs: readonly []; + readonly payable: false; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly constant: false; + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "uint64"; + readonly name: "ttl"; + readonly type: "uint64"; + }]; + readonly name: "setTTL"; + readonly outputs: readonly []; + readonly payable: false; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly constant: true; + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }]; + readonly name: "ttl"; + readonly outputs: readonly [{ + readonly internalType: "uint64"; + readonly name: ""; + readonly type: "uint64"; + }]; + readonly payable: false; + readonly stateMutability: "view"; + readonly type: "function"; + }]; + static createInterface(): ENSRegistryInterface; + static connect(address: string, runner?: ContractRunner | null): ENSRegistry; +} diff --git a/dist/typechain/factories/ENSResolver__factory.d.ts b/dist/typechain/factories/ENSResolver__factory.d.ts new file mode 100644 index 0000000..1987045 --- /dev/null +++ b/dist/typechain/factories/ENSResolver__factory.d.ts @@ -0,0 +1,789 @@ +import { type ContractRunner } from "ethers"; +import type { ENSResolver, ENSResolverInterface } from "../ENSResolver"; +export declare class ENSResolver__factory { + static readonly abi: readonly [{ + readonly inputs: readonly [{ + readonly internalType: "contract ENS"; + readonly name: "_ens"; + readonly type: "address"; + }, { + readonly internalType: "contract INameWrapper"; + readonly name: "wrapperAddress"; + readonly type: "address"; + }, { + readonly internalType: "address"; + readonly name: "_trustedETHController"; + readonly type: "address"; + }, { + readonly internalType: "address"; + readonly name: "_trustedReverseRegistrar"; + readonly type: "address"; + }]; + readonly stateMutability: "nonpayable"; + readonly type: "constructor"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly indexed: true; + readonly internalType: "uint256"; + readonly name: "contentType"; + readonly type: "uint256"; + }]; + readonly name: "ABIChanged"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly indexed: false; + readonly internalType: "address"; + readonly name: "a"; + readonly type: "address"; + }]; + readonly name: "AddrChanged"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly indexed: false; + readonly internalType: "uint256"; + readonly name: "coinType"; + readonly type: "uint256"; + }, { + readonly indexed: false; + readonly internalType: "bytes"; + readonly name: "newAddress"; + readonly type: "bytes"; + }]; + readonly name: "AddressChanged"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "address"; + readonly name: "owner"; + readonly type: "address"; + }, { + readonly indexed: true; + readonly internalType: "address"; + readonly name: "operator"; + readonly type: "address"; + }, { + readonly indexed: false; + readonly internalType: "bool"; + readonly name: "approved"; + readonly type: "bool"; + }]; + readonly name: "ApprovalForAll"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: false; + readonly internalType: "address"; + readonly name: "owner"; + readonly type: "address"; + }, { + readonly indexed: true; + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly indexed: true; + readonly internalType: "address"; + readonly name: "delegate"; + readonly type: "address"; + }, { + readonly indexed: true; + readonly internalType: "bool"; + readonly name: "approved"; + readonly type: "bool"; + }]; + readonly name: "Approved"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly indexed: false; + readonly internalType: "bytes"; + readonly name: "hash"; + readonly type: "bytes"; + }]; + readonly name: "ContenthashChanged"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly indexed: false; + readonly internalType: "bytes"; + readonly name: "name"; + readonly type: "bytes"; + }, { + readonly indexed: false; + readonly internalType: "uint16"; + readonly name: "resource"; + readonly type: "uint16"; + }, { + readonly indexed: false; + readonly internalType: "bytes"; + readonly name: "record"; + readonly type: "bytes"; + }]; + readonly name: "DNSRecordChanged"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly indexed: false; + readonly internalType: "bytes"; + readonly name: "name"; + readonly type: "bytes"; + }, { + readonly indexed: false; + readonly internalType: "uint16"; + readonly name: "resource"; + readonly type: "uint16"; + }]; + readonly name: "DNSRecordDeleted"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly indexed: false; + readonly internalType: "bytes"; + readonly name: "lastzonehash"; + readonly type: "bytes"; + }, { + readonly indexed: false; + readonly internalType: "bytes"; + readonly name: "zonehash"; + readonly type: "bytes"; + }]; + readonly name: "DNSZonehashChanged"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly indexed: true; + readonly internalType: "bytes4"; + readonly name: "interfaceID"; + readonly type: "bytes4"; + }, { + readonly indexed: false; + readonly internalType: "address"; + readonly name: "implementer"; + readonly type: "address"; + }]; + readonly name: "InterfaceChanged"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly indexed: false; + readonly internalType: "string"; + readonly name: "name"; + readonly type: "string"; + }]; + readonly name: "NameChanged"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly indexed: false; + readonly internalType: "bytes32"; + readonly name: "x"; + readonly type: "bytes32"; + }, { + readonly indexed: false; + readonly internalType: "bytes32"; + readonly name: "y"; + readonly type: "bytes32"; + }]; + readonly name: "PubkeyChanged"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly indexed: true; + readonly internalType: "string"; + readonly name: "indexedKey"; + readonly type: "string"; + }, { + readonly indexed: false; + readonly internalType: "string"; + readonly name: "key"; + readonly type: "string"; + }, { + readonly indexed: false; + readonly internalType: "string"; + readonly name: "value"; + readonly type: "string"; + }]; + readonly name: "TextChanged"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly indexed: false; + readonly internalType: "uint64"; + readonly name: "newVersion"; + readonly type: "uint64"; + }]; + readonly name: "VersionChanged"; + readonly type: "event"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "uint256"; + readonly name: "contentTypes"; + readonly type: "uint256"; + }]; + readonly name: "ABI"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: ""; + readonly type: "uint256"; + }, { + readonly internalType: "bytes"; + readonly name: ""; + readonly type: "bytes"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }]; + readonly name: "addr"; + readonly outputs: readonly [{ + readonly internalType: "address payable"; + readonly name: ""; + readonly type: "address"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "uint256"; + readonly name: "coinType"; + readonly type: "uint256"; + }]; + readonly name: "addr"; + readonly outputs: readonly [{ + readonly internalType: "bytes"; + readonly name: ""; + readonly type: "bytes"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "address"; + readonly name: "delegate"; + readonly type: "address"; + }, { + readonly internalType: "bool"; + readonly name: "approved"; + readonly type: "bool"; + }]; + readonly name: "approve"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }]; + readonly name: "clearRecords"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }]; + readonly name: "contenthash"; + readonly outputs: readonly [{ + readonly internalType: "bytes"; + readonly name: ""; + readonly type: "bytes"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "bytes32"; + readonly name: "name"; + readonly type: "bytes32"; + }, { + readonly internalType: "uint16"; + readonly name: "resource"; + readonly type: "uint16"; + }]; + readonly name: "dnsRecord"; + readonly outputs: readonly [{ + readonly internalType: "bytes"; + readonly name: ""; + readonly type: "bytes"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "bytes32"; + readonly name: "name"; + readonly type: "bytes32"; + }]; + readonly name: "hasDNSRecords"; + readonly outputs: readonly [{ + readonly internalType: "bool"; + readonly name: ""; + readonly type: "bool"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "bytes4"; + readonly name: "interfaceID"; + readonly type: "bytes4"; + }]; + readonly name: "interfaceImplementer"; + readonly outputs: readonly [{ + readonly internalType: "address"; + readonly name: ""; + readonly type: "address"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "address"; + readonly name: "owner"; + readonly type: "address"; + }, { + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "address"; + readonly name: "delegate"; + readonly type: "address"; + }]; + readonly name: "isApprovedFor"; + readonly outputs: readonly [{ + readonly internalType: "bool"; + readonly name: ""; + readonly type: "bool"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "address"; + readonly name: "account"; + readonly type: "address"; + }, { + readonly internalType: "address"; + readonly name: "operator"; + readonly type: "address"; + }]; + readonly name: "isApprovedForAll"; + readonly outputs: readonly [{ + readonly internalType: "bool"; + readonly name: ""; + readonly type: "bool"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes[]"; + readonly name: "data"; + readonly type: "bytes[]"; + }]; + readonly name: "multicall"; + readonly outputs: readonly [{ + readonly internalType: "bytes[]"; + readonly name: "results"; + readonly type: "bytes[]"; + }]; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "nodehash"; + readonly type: "bytes32"; + }, { + readonly internalType: "bytes[]"; + readonly name: "data"; + readonly type: "bytes[]"; + }]; + readonly name: "multicallWithNodeCheck"; + readonly outputs: readonly [{ + readonly internalType: "bytes[]"; + readonly name: "results"; + readonly type: "bytes[]"; + }]; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }]; + readonly name: "name"; + readonly outputs: readonly [{ + readonly internalType: "string"; + readonly name: ""; + readonly type: "string"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }]; + readonly name: "pubkey"; + readonly outputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "x"; + readonly type: "bytes32"; + }, { + readonly internalType: "bytes32"; + readonly name: "y"; + readonly type: "bytes32"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: ""; + readonly type: "bytes32"; + }]; + readonly name: "recordVersions"; + readonly outputs: readonly [{ + readonly internalType: "uint64"; + readonly name: ""; + readonly type: "uint64"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "uint256"; + readonly name: "contentType"; + readonly type: "uint256"; + }, { + readonly internalType: "bytes"; + readonly name: "data"; + readonly type: "bytes"; + }]; + readonly name: "setABI"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "uint256"; + readonly name: "coinType"; + readonly type: "uint256"; + }, { + readonly internalType: "bytes"; + readonly name: "a"; + readonly type: "bytes"; + }]; + readonly name: "setAddr"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "address"; + readonly name: "a"; + readonly type: "address"; + }]; + readonly name: "setAddr"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "address"; + readonly name: "operator"; + readonly type: "address"; + }, { + readonly internalType: "bool"; + readonly name: "approved"; + readonly type: "bool"; + }]; + readonly name: "setApprovalForAll"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "bytes"; + readonly name: "hash"; + readonly type: "bytes"; + }]; + readonly name: "setContenthash"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "bytes"; + readonly name: "data"; + readonly type: "bytes"; + }]; + readonly name: "setDNSRecords"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "bytes4"; + readonly name: "interfaceID"; + readonly type: "bytes4"; + }, { + readonly internalType: "address"; + readonly name: "implementer"; + readonly type: "address"; + }]; + readonly name: "setInterface"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "string"; + readonly name: "newName"; + readonly type: "string"; + }]; + readonly name: "setName"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "bytes32"; + readonly name: "x"; + readonly type: "bytes32"; + }, { + readonly internalType: "bytes32"; + readonly name: "y"; + readonly type: "bytes32"; + }]; + readonly name: "setPubkey"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "string"; + readonly name: "key"; + readonly type: "string"; + }, { + readonly internalType: "string"; + readonly name: "value"; + readonly type: "string"; + }]; + readonly name: "setText"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "bytes"; + readonly name: "hash"; + readonly type: "bytes"; + }]; + readonly name: "setZonehash"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes4"; + readonly name: "interfaceID"; + readonly type: "bytes4"; + }]; + readonly name: "supportsInterface"; + readonly outputs: readonly [{ + readonly internalType: "bool"; + readonly name: ""; + readonly type: "bool"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }, { + readonly internalType: "string"; + readonly name: "key"; + readonly type: "string"; + }]; + readonly name: "text"; + readonly outputs: readonly [{ + readonly internalType: "string"; + readonly name: ""; + readonly type: "string"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "node"; + readonly type: "bytes32"; + }]; + readonly name: "zonehash"; + readonly outputs: readonly [{ + readonly internalType: "bytes"; + readonly name: ""; + readonly type: "bytes"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }]; + static createInterface(): ENSResolverInterface; + static connect(address: string, runner?: ContractRunner | null): ENSResolver; +} diff --git a/dist/typechain/factories/index.d.ts b/dist/typechain/factories/index.d.ts index ab90b86..88eace5 100644 --- a/dist/typechain/factories/index.d.ts +++ b/dist/typechain/factories/index.d.ts @@ -1,6 +1,8 @@ export { ENS__factory } from "./ENS__factory"; +export { ENSNameWrapper__factory } from "./ENSNameWrapper__factory"; +export { ENSRegistry__factory } from "./ENSRegistry__factory"; +export { ENSResolver__factory } from "./ENSResolver__factory"; export { ERC20__factory } from "./ERC20__factory"; -export { GasPriceOracle__factory } from "./GasPriceOracle__factory"; export { Multicall__factory } from "./Multicall__factory"; export { OffchainOracle__factory } from "./OffchainOracle__factory"; export { OvmGasPriceOracle__factory } from "./OvmGasPriceOracle__factory"; diff --git a/dist/typechain/index.d.ts b/dist/typechain/index.d.ts index 7f5f66e..ce7c7c4 100644 --- a/dist/typechain/index.d.ts +++ b/dist/typechain/index.d.ts @@ -1,14 +1,18 @@ export type { ENS } from "./ENS"; +export type { ENSNameWrapper } from "./ENSNameWrapper"; +export type { ENSRegistry } from "./ENSRegistry"; +export type { ENSResolver } from "./ENSResolver"; export type { ERC20 } from "./ERC20"; -export type { GasPriceOracle } from "./GasPriceOracle"; export type { Multicall } from "./Multicall"; export type { OffchainOracle } from "./OffchainOracle"; export type { OvmGasPriceOracle } from "./OvmGasPriceOracle"; export type { ReverseRecords } from "./ReverseRecords"; export * as factories from "./factories"; export { ENS__factory } from "./factories/ENS__factory"; +export { ENSNameWrapper__factory } from "./factories/ENSNameWrapper__factory"; +export { ENSRegistry__factory } from "./factories/ENSRegistry__factory"; +export { ENSResolver__factory } from "./factories/ENSResolver__factory"; export { ERC20__factory } from "./factories/ERC20__factory"; -export { GasPriceOracle__factory } from "./factories/GasPriceOracle__factory"; export { Multicall__factory } from "./factories/Multicall__factory"; export { OffchainOracle__factory } from "./factories/OffchainOracle__factory"; export { OvmGasPriceOracle__factory } from "./factories/OvmGasPriceOracle__factory"; diff --git a/dist/utils.d.ts b/dist/utils.d.ts index 8ffe743..cbb7cd6 100644 --- a/dist/utils.d.ts +++ b/dist/utils.d.ts @@ -1,5 +1,3 @@ -/// -/// import { webcrypto } from 'crypto'; import BN from 'bn.js'; import type { BigNumberish } from 'ethers'; @@ -22,6 +20,12 @@ export declare function leInt2Buff(bigint: bnInput | bigint): Uint8Array; export declare function toFixedHex(numberish: BigNumberish, length?: number): string; export declare function toFixedLength(string: string, length?: number): string; export declare function rBigInt(nbytes?: number): bigint; +export declare function rHex(nbytes?: number): string; export declare function bigIntReplacer(key: any, value: any): any; export declare function substring(str: string, length?: number): string; +export declare function digest(bytes: Uint8Array, algo?: string): Promise; +export declare function numberFormatter(num: string | number | bigint, digits?: number): string; +export declare function isHex(value: string): boolean; +export declare function toContentHash(ipfsUrl: string): any; +export declare function fromContentHash(contentHash: string): any; export {}; diff --git a/dist/websnark.d.ts b/dist/websnark.d.ts index 3d06a56..fbda0cc 100644 --- a/dist/websnark.d.ts +++ b/dist/websnark.d.ts @@ -1,28 +1,27 @@ import type { Element } from '@tornado/fixed-merkle-tree'; -import type { AddressLike, BytesLike, BigNumberish } from 'ethers'; -export type snarkInputs = { +export interface snarkInputs { root: Element; nullifierHex: string; - recipient: AddressLike; - relayer: AddressLike; + recipient: string; + relayer: string; fee: bigint; refund: bigint; nullifier: bigint; secret: bigint; pathElements: Element[]; pathIndices: Element[]; -}; +} export type snarkArgs = [ - _root: BytesLike, - _nullifierHash: BytesLike, - _recipient: AddressLike, - _relayer: AddressLike, - _fee: BigNumberish, - _refund: BigNumberish + _root: string, + _nullifierHash: string, + _recipient: string, + _relayer: string, + _fee: string, + _refund: string ]; -export type snarkProofs = { - proof: BytesLike; +export interface snarkProofs { + proof: string; args: snarkArgs; -}; +} export declare function initGroth16(): Promise; export declare function calculateSnarkProof(input: snarkInputs, circuit: object, provingKey: ArrayBuffer): Promise; diff --git a/dist/zip.d.ts b/dist/zip.d.ts new file mode 100644 index 0000000..2fd1db1 --- /dev/null +++ b/dist/zip.d.ts @@ -0,0 +1,9 @@ +import { AsyncZippable, Unzipped, ZipAttributes } from 'fflate'; +export declare function zipAsync(file: AsyncZippable, options?: ZipAttributes): Promise; +export declare function unzipAsync(data: Uint8Array): Promise; +export declare function downloadZip({ staticUrl, zipName, zipDigest, parseJson, }: { + staticUrl?: string; + zipName: string; + zipDigest?: string; + parseJson?: boolean; +}): Promise; diff --git a/hardhat.config.ts b/hardhat.config.ts new file mode 100644 index 0000000..a0ade0c --- /dev/null +++ b/hardhat.config.ts @@ -0,0 +1,9 @@ +import type { HardhatUserConfig } from 'hardhat/types'; +import '@nomicfoundation/hardhat-toolbox'; +import '@nomicfoundation/hardhat-ethers'; + +const config: HardhatUserConfig = { + solidity: '0.8.28', +}; + +export default config; \ No newline at end of file diff --git a/package.json b/package.json index be3a331..7e7a52e 100644 --- a/package.json +++ b/package.json @@ -1,76 +1,101 @@ { - "name": "@tornado/core", - "version": "1.0.1", - "description": "An SDK for building applications on top of Privacy Pools", - "main": "./dist/index.js", - "module": "./dist/index.mjs", - "types": "./dist/index.d.ts", - "unpkg": "./dist/index.umd.js", - "jsdelivr": "./dist/index.umd.js", - "scripts": { - "typechain": "typechain --target ethers-v6 --out-dir src/typechain src/abi/*.json", - "types": "tsc --declaration --emitDeclarationOnly", - "lint": "eslint src/**/*.ts --ext .ts --ignore-pattern src/typechain", - "build:node": "rollup -c", - "build:web": "webpack", - "build": "yarn types && yarn build:node && yarn build:web" - }, - "author": "", - "license": "MIT", - "files": [ - "dist", - "src", - ".eslintrc.js", - ".gitattributes", - ".gitignore", - ".npmrc", - "logo.png", - "logo2.png", - "rollup.config.mjs", - "tsconfig.json", - "yarn.lock" - ], - "dependencies": { - "@metamask/eth-sig-util": "^7.0.1", - "@tornado/contracts": "^1.0.0", - "@tornado/fixed-merkle-tree": "^0.7.3", - "@tornado/snarkjs": "^0.1.20", - "@tornado/websnark": "^0.0.4", - "ajv": "^8.12.0", - "bn.js": "^5.2.1", - "circomlibjs": "0.1.7", - "cross-fetch": "^4.0.0", - "ethers": "^6.4.0", - "ffjavascript": "0.2.48", - "fflate": "^0.8.2" - }, - "optionalDependencies": {}, - "devDependencies": { - "@rollup/plugin-commonjs": "^25.0.7", - "@rollup/plugin-json": "^6.1.0", - "@rollup/plugin-node-resolve": "^15.2.3", - "@typechain/ethers-v6": "^0.5.1", - "@types/bn.js": "^5.1.5", - "@types/circomlibjs": "^0.1.6", - "@types/node": "^20.12.5", - "@types/node-fetch": "^2.6.11", - "@typescript-eslint/eslint-plugin": "^7.6.0", - "@typescript-eslint/parser": "^7.6.0", - "esbuild": "^0.20.2", - "esbuild-loader": "^4.1.0", - "eslint": "^8.57.0", - "eslint-config-prettier": "^9.1.0", - "eslint-import-resolver-typescript": "^3.6.1", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-prettier": "^5.1.3", - "node-polyfill-webpack-plugin": "^3.0.0", - "prettier": "^3.2.5", - "rollup": "^4.14.1", - "rollup-plugin-esbuild": "^6.1.1", - "tsc": "^2.0.4", - "typechain": "^8.3.2", - "typescript": "^5.4.4", - "webpack": "^5.91.0", - "webpack-cli": "^5.1.4" - } + "name": "@tornado/core", + "version": "1.0.19", + "description": "An SDK for building applications on top of Privacy Pools", + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", + "unpkg": "./dist/tornado.umd.min.js", + "jsdelivr": "./dist/tornado.umd.min.js", + "scripts": { + "typechain": "typechain --target ethers-v6 --out-dir src/typechain src/abi/*.json", + "types": "tsc --declaration --emitDeclarationOnly -p tsconfig.build.json", + "lint": "eslint src/**/*.ts test/**/*.ts --ext .ts --ignore-pattern src/typechain", + "build:node": "rollup -c", + "build:web": "webpack", + "build": "yarn types && yarn build:node && yarn build:web", + "test": "nyc mocha --require ts-node/register --require source-map-support/register --recursive 'test/**/*.ts' --timeout '300000'" + }, + "author": "", + "license": "MIT", + "files": [ + "dist", + "src", + ".eslintrc.js", + ".gitattributes", + ".gitignore", + ".npmrc", + "logo.png", + "logo2.png", + "rollup.config.mjs", + "tsconfig.json", + "yarn.lock" + ], + "dependencies": { + "@ensdomains/content-hash": "2.5.7", + "@metamask/eth-sig-util": "^8.0.0", + "@tornado/contracts": "git+https://git.tornado.ws/tornadocontrib/tornado-contracts.git#1b1d707878c16a3dc60d295299d4f0e7ce6ba831", + "@tornado/fixed-merkle-tree": "^0.7.3", + "@tornado/snarkjs": "^0.1.20", + "@tornado/websnark": "^0.0.4", + "ajv": "^8.17.1", + "bn.js": "^5.2.1", + "circomlibjs": "0.1.7", + "cross-fetch": "^4.0.0", + "ethers": "^6.13.4", + "ffjavascript": "0.2.48", + "fflate": "^0.8.2", + "idb": "^8.0.0" + }, + "devDependencies": { + "@nomicfoundation/hardhat-chai-matchers": "^2.0.7", + "@nomicfoundation/hardhat-ethers": "^3.0.8", + "@nomicfoundation/hardhat-ignition": "^0.15.5", + "@nomicfoundation/hardhat-ignition-ethers": "^0.15.5", + "@nomicfoundation/hardhat-network-helpers": "^1.0.11", + "@nomicfoundation/hardhat-toolbox": "^5.0.0", + "@nomicfoundation/hardhat-verify": "^2.0.10", + "@nomicfoundation/ignition-core": "^0.15.5", + "@rollup/plugin-commonjs": "^28.0.1", + "@rollup/plugin-json": "^6.1.0", + "@rollup/plugin-node-resolve": "^15.3.0", + "@typechain/ethers-v6": "^0.5.1", + "@typechain/hardhat": "^9.1.0", + "@types/bn.js": "^5.1.6", + "@types/chai": "^4.2.0", + "@types/circomlibjs": "^0.1.6", + "@types/mocha": "^10.0.9", + "@types/node": "^22.8.0", + "@types/node-fetch": "^2.6.11", + "@typescript-eslint/eslint-plugin": "^8.11.0", + "@typescript-eslint/parser": "^8.11.0", + "esbuild-loader": "^4.2.2", + "eslint": "8.57.0", + "eslint-config-prettier": "^9.1.0", + "eslint-import-resolver-typescript": "^3.6.3", + "eslint-plugin-import": "^2.31.0", + "eslint-plugin-prettier": "^5.2.1", + "fetch-mock": "^12.0.2", + "hardhat": "^2.22.10", + "hardhat-gas-reporter": "^2.2.1", + "mocha": "^10.7.3", + "node-polyfill-webpack-plugin": "^4.0.0", + "nyc": "^17.1.0", + "prettier": "^3.3.3", + "rollup": "^4.24.0", + "rollup-plugin-esbuild": "^6.1.1", + "solidity-coverage": "^0.8.13", + "ts-node": "^10.9.2", + "tsc": "^2.0.4", + "typechain": "^8.3.2", + "typescript": "^5.6.3", + "webpack": "^5.95.0", + "webpack-cli": "^5.1.4" + }, + "resolutions": { + "strip-ansi": "6.0.1", + "@adraffy/ens-normalize": "1.10.1", + "@noble/curves": "1.2.0", + "@noble/hashes": "1.3.2" + } } diff --git a/rollup.config.mjs b/rollup.config.mjs index a8f7b5f..9bc68b0 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -7,81 +7,81 @@ import { readFileSync } from 'fs'; const pkgJson = JSON.parse(readFileSync("./package.json")); const external = Object.keys(pkgJson.dependencies).concat( - Object.keys(pkgJson.optionalDependencies), - [ - 'http-proxy-agent', - 'https-proxy-agent', - 'socks-proxy-agent', - '@tornado/websnark/src/utils', - '@tornado/websnark/src/groth16', - ] + Object.keys(pkgJson.optionalDependencies || {}), + [ + 'http-proxy-agent', + 'https-proxy-agent', + 'socks-proxy-agent', + '@tornado/websnark/src/utils', + '@tornado/websnark/src/groth16', + ] ); const config = [ - { - input: 'src/index.ts', - output: [ - { - file: pkgJson.main, - format: "cjs", - esModule: false, - }, - ], - external, - plugins: [ - esbuild({ - include: /\.[jt]sx?$/, - minify: false, - sourceMap: true, - target: 'es2016', - }), - commonjs(), - nodeResolve(), - json() - ], - }, - { - input: 'src/index.ts', - output: [ - { - file: pkgJson.module, - format: "esm", - }, - ], - external, - plugins: [ - esbuild({ - include: /\.[jt]sx?$/, - minify: false, - sourceMap: true, - target: 'es2016', - }), - nodeResolve(), - json() - ], - }, - { - input: 'src/merkleTreeWorker.ts', - output: [ - { - file: 'dist/merkleTreeWorker.js', - format: "cjs", - esModule: false, - }, - ], - treeshake: 'smallest', - plugins: [ - esbuild({ - include: /\.[jt]sx?$/, - minify: false, - sourceMap: true, - target: 'es2016', - }), - commonjs(), - nodeResolve(), - json() - ], - } + { + input: 'src/index.ts', + output: [ + { + file: pkgJson.main, + format: "cjs", + esModule: false, + }, + ], + external, + plugins: [ + esbuild({ + include: /\.[jt]sx?$/, + minify: false, + sourceMap: true, + target: 'es2022', + }), + commonjs(), + nodeResolve(), + json() + ], + }, + { + input: 'src/index.ts', + output: [ + { + file: pkgJson.module, + format: "esm", + }, + ], + external, + plugins: [ + esbuild({ + include: /\.[jt]sx?$/, + minify: false, + sourceMap: true, + target: 'es2022', + }), + nodeResolve(), + json() + ], + }, + { + input: 'src/merkleTreeWorker.ts', + output: [ + { + file: 'dist/merkleTreeWorker.js', + format: "cjs", + esModule: false, + }, + ], + treeshake: 'smallest', + plugins: [ + esbuild({ + include: /\.[jt]sx?$/, + minify: false, + sourceMap: true, + target: 'es2022', + }), + commonjs(), + nodeResolve(), + json() + ], + } ] export default config; \ No newline at end of file diff --git a/src/abi/ENSNameWrapper.json b/src/abi/ENSNameWrapper.json new file mode 100644 index 0000000..47c8945 --- /dev/null +++ b/src/abi/ENSNameWrapper.json @@ -0,0 +1 @@ +[{"inputs":[{"internalType":"contract ENS","name":"_ens","type":"address"},{"internalType":"contract IBaseRegistrar","name":"_registrar","type":"address"},{"internalType":"contract IMetadataService","name":"_metadataService","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CannotUpgrade","type":"error"},{"inputs":[],"name":"IncompatibleParent","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"IncorrectTargetOwner","type":"error"},{"inputs":[],"name":"IncorrectTokenType","type":"error"},{"inputs":[{"internalType":"bytes32","name":"labelHash","type":"bytes32"},{"internalType":"bytes32","name":"expectedLabelhash","type":"bytes32"}],"name":"LabelMismatch","type":"error"},{"inputs":[{"internalType":"string","name":"label","type":"string"}],"name":"LabelTooLong","type":"error"},{"inputs":[],"name":"LabelTooShort","type":"error"},{"inputs":[],"name":"NameIsNotWrapped","type":"error"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"OperationProhibited","type":"error"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"addr","type":"address"}],"name":"Unauthorised","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"controller","type":"address"},{"indexed":false,"internalType":"bool","name":"active","type":"bool"}],"name":"ControllerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"expiry","type":"uint64"}],"name":"ExpiryExtended","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"fuses","type":"uint32"}],"name":"FusesSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"address","name":"owner","type":"address"}],"name":"NameUnwrapped","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"name","type":"bytes"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint32","name":"fuses","type":"uint32"},{"indexed":false,"internalType":"uint64","name":"expiry","type":"uint64"}],"name":"NameWrapped","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"_tokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"uint32","name":"fuseMask","type":"uint32"}],"name":"allFusesBurned","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"addr","type":"address"}],"name":"canExtendSubnames","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"addr","type":"address"}],"name":"canModifyName","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"controllers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ens","outputs":[{"internalType":"contract ENS","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"parentNode","type":"bytes32"},{"internalType":"bytes32","name":"labelhash","type":"bytes32"},{"internalType":"uint64","name":"expiry","type":"uint64"}],"name":"extendExpiry","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"operator","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getData","outputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint32","name":"fuses","type":"uint32"},{"internalType":"uint64","name":"expiry","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"parentNode","type":"bytes32"},{"internalType":"bytes32","name":"labelhash","type":"bytes32"}],"name":"isWrapped","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"isWrapped","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"metadataService","outputs":[{"internalType":"contract IMetadataService","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"names","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"recoverFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"label","type":"string"},{"internalType":"address","name":"wrappedOwner","type":"address"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"address","name":"resolver","type":"address"},{"internalType":"uint16","name":"ownerControlledFuses","type":"uint16"}],"name":"registerAndWrapETH2LD","outputs":[{"internalType":"uint256","name":"registrarExpiry","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"registrar","outputs":[{"internalType":"contract IBaseRegistrar","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"renew","outputs":[{"internalType":"uint256","name":"expires","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"parentNode","type":"bytes32"},{"internalType":"bytes32","name":"labelhash","type":"bytes32"},{"internalType":"uint32","name":"fuses","type":"uint32"},{"internalType":"uint64","name":"expiry","type":"uint64"}],"name":"setChildFuses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"controller","type":"address"},{"internalType":"bool","name":"active","type":"bool"}],"name":"setController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"uint16","name":"ownerControlledFuses","type":"uint16"}],"name":"setFuses","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IMetadataService","name":"_metadataService","type":"address"}],"name":"setMetadataService","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"resolver","type":"address"},{"internalType":"uint64","name":"ttl","type":"uint64"}],"name":"setRecord","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"resolver","type":"address"}],"name":"setResolver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"parentNode","type":"bytes32"},{"internalType":"string","name":"label","type":"string"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint32","name":"fuses","type":"uint32"},{"internalType":"uint64","name":"expiry","type":"uint64"}],"name":"setSubnodeOwner","outputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"parentNode","type":"bytes32"},{"internalType":"string","name":"label","type":"string"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"resolver","type":"address"},{"internalType":"uint64","name":"ttl","type":"uint64"},{"internalType":"uint32","name":"fuses","type":"uint32"},{"internalType":"uint64","name":"expiry","type":"uint64"}],"name":"setSubnodeRecord","outputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"uint64","name":"ttl","type":"uint64"}],"name":"setTTL","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract INameWrapperUpgrade","name":"_upgradeAddress","type":"address"}],"name":"setUpgradeContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"parentNode","type":"bytes32"},{"internalType":"bytes32","name":"labelhash","type":"bytes32"},{"internalType":"address","name":"controller","type":"address"}],"name":"unwrap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"labelhash","type":"bytes32"},{"internalType":"address","name":"registrant","type":"address"},{"internalType":"address","name":"controller","type":"address"}],"name":"unwrapETH2LD","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"name","type":"bytes"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"name":"upgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"upgradeContract","outputs":[{"internalType":"contract INameWrapperUpgrade","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"name","type":"bytes"},{"internalType":"address","name":"wrappedOwner","type":"address"},{"internalType":"address","name":"resolver","type":"address"}],"name":"wrap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"label","type":"string"},{"internalType":"address","name":"wrappedOwner","type":"address"},{"internalType":"uint16","name":"ownerControlledFuses","type":"uint16"},{"internalType":"address","name":"resolver","type":"address"}],"name":"wrapETH2LD","outputs":[{"internalType":"uint64","name":"expiry","type":"uint64"}],"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/src/abi/ENSRegistry.json b/src/abi/ENSRegistry.json new file mode 100644 index 0000000..d0cfe79 --- /dev/null +++ b/src/abi/ENSRegistry.json @@ -0,0 +1 @@ +[{"inputs":[{"internalType":"contract ENS","name":"_old","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"label","type":"bytes32"},{"indexed":false,"internalType":"address","name":"owner","type":"address"}],"name":"NewOwner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"address","name":"resolver","type":"address"}],"name":"NewResolver","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"ttl","type":"uint64"}],"name":"NewTTL","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"address","name":"owner","type":"address"}],"name":"Transfer","type":"event"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"old","outputs":[{"internalType":"contract ENS","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"recordExists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"resolver","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"owner","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"resolver","type":"address"},{"internalType":"uint64","name":"ttl","type":"uint64"}],"name":"setRecord","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"resolver","type":"address"}],"name":"setResolver","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes32","name":"label","type":"bytes32"},{"internalType":"address","name":"owner","type":"address"}],"name":"setSubnodeOwner","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes32","name":"label","type":"bytes32"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"resolver","type":"address"},{"internalType":"uint64","name":"ttl","type":"uint64"}],"name":"setSubnodeRecord","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"uint64","name":"ttl","type":"uint64"}],"name":"setTTL","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"ttl","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"}] \ No newline at end of file diff --git a/src/abi/ENSResolver.json b/src/abi/ENSResolver.json new file mode 100644 index 0000000..302db71 --- /dev/null +++ b/src/abi/ENSResolver.json @@ -0,0 +1 @@ +[{"inputs":[{"internalType":"contract ENS","name":"_ens","type":"address"},{"internalType":"contract INameWrapper","name":"wrapperAddress","type":"address"},{"internalType":"address","name":"_trustedETHController","type":"address"},{"internalType":"address","name":"_trustedReverseRegistrar","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":true,"internalType":"uint256","name":"contentType","type":"uint256"}],"name":"ABIChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"address","name":"a","type":"address"}],"name":"AddrChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"coinType","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"newAddress","type":"bytes"}],"name":"AddressChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":true,"internalType":"address","name":"delegate","type":"address"},{"indexed":true,"internalType":"bool","name":"approved","type":"bool"}],"name":"Approved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"hash","type":"bytes"}],"name":"ContenthashChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"name","type":"bytes"},{"indexed":false,"internalType":"uint16","name":"resource","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"record","type":"bytes"}],"name":"DNSRecordChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"name","type":"bytes"},{"indexed":false,"internalType":"uint16","name":"resource","type":"uint16"}],"name":"DNSRecordDeleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"lastzonehash","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"zonehash","type":"bytes"}],"name":"DNSZonehashChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":true,"internalType":"bytes4","name":"interfaceID","type":"bytes4"},{"indexed":false,"internalType":"address","name":"implementer","type":"address"}],"name":"InterfaceChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"string","name":"name","type":"string"}],"name":"NameChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"x","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"y","type":"bytes32"}],"name":"PubkeyChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":true,"internalType":"string","name":"indexedKey","type":"string"},{"indexed":false,"internalType":"string","name":"key","type":"string"},{"indexed":false,"internalType":"string","name":"value","type":"string"}],"name":"TextChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"newVersion","type":"uint64"}],"name":"VersionChanged","type":"event"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"uint256","name":"contentTypes","type":"uint256"}],"name":"ABI","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"addr","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"uint256","name":"coinType","type":"uint256"}],"name":"addr","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"delegate","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"clearRecords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"contenthash","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes32","name":"name","type":"bytes32"},{"internalType":"uint16","name":"resource","type":"uint16"}],"name":"dnsRecord","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes32","name":"name","type":"bytes32"}],"name":"hasDNSRecords","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes4","name":"interfaceID","type":"bytes4"}],"name":"interfaceImplementer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"delegate","type":"address"}],"name":"isApprovedFor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"nodehash","type":"bytes32"},{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicallWithNodeCheck","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"pubkey","outputs":[{"internalType":"bytes32","name":"x","type":"bytes32"},{"internalType":"bytes32","name":"y","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"recordVersions","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"uint256","name":"contentType","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"setABI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"uint256","name":"coinType","type":"uint256"},{"internalType":"bytes","name":"a","type":"bytes"}],"name":"setAddr","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"a","type":"address"}],"name":"setAddr","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes","name":"hash","type":"bytes"}],"name":"setContenthash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"setDNSRecords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes4","name":"interfaceID","type":"bytes4"},{"internalType":"address","name":"implementer","type":"address"}],"name":"setInterface","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"string","name":"newName","type":"string"}],"name":"setName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes32","name":"x","type":"bytes32"},{"internalType":"bytes32","name":"y","type":"bytes32"}],"name":"setPubkey","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"string","name":"key","type":"string"},{"internalType":"string","name":"value","type":"string"}],"name":"setText","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes","name":"hash","type":"bytes"}],"name":"setZonehash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceID","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"string","name":"key","type":"string"}],"name":"text","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"zonehash","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"}] \ No newline at end of file diff --git a/src/abi/GasPriceOracle.json b/src/abi/GasPriceOracle.json deleted file mode 100644 index 2ef8f09..0000000 --- a/src/abi/GasPriceOracle.json +++ /dev/null @@ -1,189 +0,0 @@ -[ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "GAS_UNIT", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "_derivationThresold", - "type": "uint32" - } - ], - "name": "changeDerivationThresold", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "_gasUnit", - "type": "uint32" - } - ], - "name": "changeGasUnit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "_heartbeat", - "type": "uint32" - } - ], - "name": "changeHeartbeat", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_owner", - "type": "address" - } - ], - "name": "changeOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "derivationThresold", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "gasPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "heartbeat", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxFeePerGas", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxPriorityFeePerGas", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pastGasPrice", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "_gasPrice", - "type": "uint32" - } - ], - "name": "setGasPrice", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "timestamp", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file diff --git a/src/batch.ts b/src/batch.ts index aee3532..0271c5d 100644 --- a/src/batch.ts +++ b/src/batch.ts @@ -1,339 +1,572 @@ -import type { Provider, BlockTag, Block, TransactionResponse, BaseContract, ContractEventName, EventLog } from 'ethers'; +import { + Provider, + BlockTag, + Block, + TransactionResponse, + BaseContract, + ContractEventName, + EventLog, + TransactionReceipt, + isHexString, + assert, + assertArgument, + DeferredTopicFilter, + EventFragment, + TopicFilter, + Interface, + UndecodedEventLog, + Log, +} from 'ethers'; import { chunk, sleep } from './utils'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function isDeferred(value: any): value is DeferredTopicFilter { + return ( + value && + typeof value === 'object' && + 'getTopicFilter' in value && + typeof value.getTopicFilter === 'function' && + value.fragment + ); +} + +/** + * Copied from ethers.js as they don't export this function + * https://github.com/ethers-io/ethers.js/blob/main/src.ts/contract/contract.ts#L464 + */ +export async function getSubInfo( + abiInterface: Interface, + event: ContractEventName, +): Promise<{ + fragment: null | EventFragment; + tag: string; + topics: TopicFilter; +}> { + let topics: Array>; + let fragment: null | EventFragment = null; + + // Convert named events to topicHash and get the fragment for + // events which need deconstructing. + + if (Array.isArray(event)) { + const topicHashify = function (name: string): string { + if (isHexString(name, 32)) { + return name; + } + const fragment = abiInterface.getEvent(name); + assertArgument(fragment, 'unknown fragment', 'name', name); + return fragment.topicHash; + }; + + // Array of Topics and Names; e.g. `[ "0x1234...89ab", "Transfer(address)" ]` + topics = event.map((e) => { + if (e == null) { + return null; + } + if (Array.isArray(e)) { + return e.map(topicHashify); + } + return topicHashify(e); + }); + } else if (event === '*') { + topics = [null]; + } else if (typeof event === 'string') { + if (isHexString(event, 32)) { + // Topic Hash + topics = [event]; + } else { + // Name or Signature; e.g. `"Transfer", `"Transfer(address)"` + fragment = abiInterface.getEvent(event); + assertArgument(fragment, 'unknown fragment', 'event', event); + topics = [fragment.topicHash]; + } + } else if (isDeferred(event)) { + // Deferred Topic Filter; e.g. `contract.filter.Transfer(from)` + topics = await event.getTopicFilter(); + } else if ('fragment' in event) { + // ContractEvent; e.g. `contract.filter.Transfer` + fragment = event.fragment; + topics = [fragment.topicHash]; + } else { + assertArgument(false, 'unknown event name', 'event', event); + } + + // Normalize topics and sort TopicSets + topics = topics.map((t) => { + if (t == null) { + return null; + } + if (Array.isArray(t)) { + const items = Array.from(new Set(t.map((t) => t.toLowerCase())).values()); + if (items.length === 1) { + return items[0]; + } + items.sort(); + return items; + } + return t.toLowerCase(); + }); + + const tag = topics + .map((t) => { + if (t == null) { + return 'null'; + } + if (Array.isArray(t)) { + return t.join('|'); + } + return t; + }) + .join('&'); + + return { fragment, tag, topics }; +} + +export async function multiQueryFilter( + // Single address will scan for a single contract, array for multiple, and * for all contracts with event topic + address: string | string[], + contract: BaseContract, + event: ContractEventName, + fromBlock?: BlockTag, + toBlock?: BlockTag, +) { + if (fromBlock == null) { + fromBlock = 0; + } + if (toBlock == null) { + toBlock = 'latest'; + } + + const { fragment, topics } = await getSubInfo(contract.interface, event); + + const filter = { + address: address === '*' ? undefined : address, + topics, + fromBlock, + toBlock, + }; + + const provider = contract.runner as Provider | null; + + assert(provider, 'contract runner does not have a provider', 'UNSUPPORTED_OPERATION', { operation: 'queryFilter' }); + + return (await provider.getLogs(filter)).map((log) => { + let foundFragment = fragment; + if (foundFragment == null) { + try { + foundFragment = contract.interface.getEvent(log.topics[0]); + // eslint-disable-next-line no-empty + } catch {} + } + + if (foundFragment) { + try { + return new EventLog(log, contract.interface, foundFragment); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } catch (error: any) { + return new UndecodedEventLog(log, error); + } + } + + return new Log(log, provider); + }); +} + export interface BatchBlockServiceConstructor { - provider: Provider; - onProgress?: BatchBlockOnProgress; - concurrencySize?: number; - batchSize?: number; - shouldRetry?: boolean; - retryMax?: number; - retryOn?: number; + provider: Provider; + onProgress?: BatchBlockOnProgress; + concurrencySize?: number; + batchSize?: number; + shouldRetry?: boolean; + retryMax?: number; + retryOn?: number; } export type BatchBlockOnProgress = ({ - percentage, - currentIndex, - totalIndex, + percentage, + currentIndex, + totalIndex, }: { - percentage: number; - currentIndex?: number; - totalIndex?: number; + percentage: number; + currentIndex?: number; + totalIndex?: number; }) => void; /** * Fetch blocks from web3 provider on batches */ export class BatchBlockService { - provider: Provider; - onProgress?: BatchBlockOnProgress; - concurrencySize: number; - batchSize: number; - shouldRetry: boolean; - retryMax: number; - retryOn: number; - constructor({ - provider, - onProgress, - concurrencySize = 10, - batchSize = 10, - shouldRetry = true, - retryMax = 5, - retryOn = 500, - }: BatchBlockServiceConstructor) { - this.provider = provider; - this.onProgress = onProgress; - this.concurrencySize = concurrencySize; - this.batchSize = batchSize; - this.shouldRetry = shouldRetry; - this.retryMax = retryMax; - this.retryOn = retryOn; - } - - async getBlock(blockTag: BlockTag): Promise { - const blockObject = await this.provider.getBlock(blockTag); - - // if the provider returns null (which they have corrupted block data for one of their nodes) throw and retry - if (!blockObject) { - const errMsg = `No block for ${blockTag}`; - throw new Error(errMsg); + provider: Provider; + onProgress?: BatchBlockOnProgress; + concurrencySize: number; + batchSize: number; + shouldRetry: boolean; + retryMax: number; + retryOn: number; + constructor({ + provider, + onProgress, + concurrencySize = 10, + batchSize = 10, + shouldRetry = true, + retryMax = 5, + retryOn = 500, + }: BatchBlockServiceConstructor) { + this.provider = provider; + this.onProgress = onProgress; + this.concurrencySize = concurrencySize; + this.batchSize = batchSize; + this.shouldRetry = shouldRetry; + this.retryMax = retryMax; + this.retryOn = retryOn; } - return blockObject; - } + async getBlock(blockTag: BlockTag): Promise { + const blockObject = await this.provider.getBlock(blockTag); - createBatchRequest(batchArray: BlockTag[][]): Promise[] { - return batchArray.map(async (blocks: BlockTag[], index: number) => { - // send batch requests on milliseconds to avoid including them on a single batch request - await sleep(20 * index); - - return (async () => { - let retries = 0; - let err; - - // eslint-disable-next-line no-unmodified-loop-condition - while ((!this.shouldRetry && retries === 0) || (this.shouldRetry && retries < this.retryMax)) { - try { - return await Promise.all(blocks.map((b) => this.getBlock(b))); - } catch (e) { - retries++; - err = e; - - // retry on 0.5 seconds - await sleep(this.retryOn); - } + // if the provider returns null (which they have corrupted block data for one of their nodes) throw and retry + if (!blockObject) { + const errMsg = `No block for ${blockTag}`; + throw new Error(errMsg); } - throw err; - })(); - }); - } - - async getBatchBlocks(blocks: BlockTag[]): Promise { - let blockCount = 0; - const results: Block[] = []; - - for (const chunks of chunk(blocks, this.concurrencySize * this.batchSize)) { - const chunksResult = (await Promise.all(this.createBatchRequest(chunk(chunks, this.batchSize)))).flat(); - - results.push(...chunksResult); - - blockCount += chunks.length; - - if (typeof this.onProgress === 'function') { - this.onProgress({ - percentage: blockCount / blocks.length, - currentIndex: blockCount, - totalIndex: blocks.length, - }); - } + return blockObject; } - return results; - } + createBatchRequest(batchArray: BlockTag[][]): Promise[] { + return batchArray.map(async (blocks: BlockTag[], index: number) => { + // send batch requests on milliseconds to avoid including them on a single batch request + await sleep(40 * index); + + return (async () => { + let retries = 0; + let err; + + // eslint-disable-next-line no-unmodified-loop-condition + while ((!this.shouldRetry && retries === 0) || (this.shouldRetry && retries < this.retryMax)) { + try { + return await Promise.all(blocks.map((b) => this.getBlock(b))); + } catch (e) { + retries++; + err = e; + + // retry on 0.5 seconds + await sleep(this.retryOn); + } + } + + throw err; + })(); + }); + } + + async getBatchBlocks(blocks: BlockTag[]): Promise { + let blockCount = 0; + const results: Block[] = []; + + for (const chunks of chunk(blocks, this.concurrencySize * this.batchSize)) { + const chunksResult = (await Promise.all(this.createBatchRequest(chunk(chunks, this.batchSize)))).flat(); + + results.push(...chunksResult); + + blockCount += chunks.length; + + if (typeof this.onProgress === 'function') { + this.onProgress({ + percentage: blockCount / blocks.length, + currentIndex: blockCount, + totalIndex: blocks.length, + }); + } + } + + return results; + } } /** * Fetch transactions from web3 provider on batches */ export class BatchTransactionService { - provider: Provider; - onProgress?: BatchBlockOnProgress; - concurrencySize: number; - batchSize: number; - shouldRetry: boolean; - retryMax: number; - retryOn: number; - constructor({ - provider, - onProgress, - concurrencySize = 10, - batchSize = 10, - shouldRetry = true, - retryMax = 5, - retryOn = 500, - }: BatchBlockServiceConstructor) { - this.provider = provider; - this.onProgress = onProgress; - this.concurrencySize = concurrencySize; - this.batchSize = batchSize; - this.shouldRetry = shouldRetry; - this.retryMax = retryMax; - this.retryOn = retryOn; - } - - async getTransaction(txHash: string): Promise { - const txObject = await this.provider.getTransaction(txHash); - - if (!txObject) { - const errMsg = `No transaction for ${txHash}`; - throw new Error(errMsg); + provider: Provider; + onProgress?: BatchBlockOnProgress; + concurrencySize: number; + batchSize: number; + shouldRetry: boolean; + retryMax: number; + retryOn: number; + constructor({ + provider, + onProgress, + concurrencySize = 10, + batchSize = 10, + shouldRetry = true, + retryMax = 5, + retryOn = 500, + }: BatchBlockServiceConstructor) { + this.provider = provider; + this.onProgress = onProgress; + this.concurrencySize = concurrencySize; + this.batchSize = batchSize; + this.shouldRetry = shouldRetry; + this.retryMax = retryMax; + this.retryOn = retryOn; } - return txObject; - } + async getTransaction(txHash: string): Promise { + const txObject = await this.provider.getTransaction(txHash); - createBatchRequest(batchArray: string[][]): Promise[] { - return batchArray.map(async (txs: string[], index: number) => { - await sleep(20 * index); - - return (async () => { - let retries = 0; - let err; - - // eslint-disable-next-line no-unmodified-loop-condition - while ((!this.shouldRetry && retries === 0) || (this.shouldRetry && retries < this.retryMax)) { - try { - return await Promise.all(txs.map((tx) => this.getTransaction(tx))); - } catch (e) { - retries++; - err = e; - - // retry on 0.5 seconds - await sleep(this.retryOn); - } + if (!txObject) { + const errMsg = `No transaction for ${txHash}`; + throw new Error(errMsg); } - throw err; - })(); - }); - } - - async getBatchTransactions(txs: string[]): Promise { - let txCount = 0; - const results = []; - - for (const chunks of chunk(txs, this.concurrencySize * this.batchSize)) { - const chunksResult = (await Promise.all(this.createBatchRequest(chunk(chunks, this.batchSize)))).flat(); - - results.push(...chunksResult); - - txCount += chunks.length; - - if (typeof this.onProgress === 'function') { - this.onProgress({ percentage: txCount / txs.length, currentIndex: txCount, totalIndex: txs.length }); - } + return txObject; } - return results; - } + async getTransactionReceipt(txHash: string): Promise { + const txObject = await this.provider.getTransactionReceipt(txHash); + + if (!txObject) { + const errMsg = `No transaction receipt for ${txHash}`; + throw new Error(errMsg); + } + + return txObject; + } + + createBatchRequest( + batchArray: string[][], + receipt?: boolean, + ): Promise[] { + return batchArray.map(async (txs: string[], index: number) => { + await sleep(40 * index); + + return (async () => { + let retries = 0; + let err; + + // eslint-disable-next-line no-unmodified-loop-condition + while ((!this.shouldRetry && retries === 0) || (this.shouldRetry && retries < this.retryMax)) { + try { + if (!receipt) { + return await Promise.all(txs.map((tx) => this.getTransaction(tx))); + } else { + return await Promise.all(txs.map((tx) => this.getTransactionReceipt(tx))); + } + } catch (e) { + retries++; + err = e; + + // retry on 0.5 seconds + await sleep(this.retryOn); + } + } + + throw err; + })(); + }); + } + + async getBatchTransactions(txs: string[]): Promise { + let txCount = 0; + const results = []; + + for (const chunks of chunk(txs, this.concurrencySize * this.batchSize)) { + const chunksResult = ( + await Promise.all(this.createBatchRequest(chunk(chunks, this.batchSize))) + ).flat() as TransactionResponse[]; + + results.push(...chunksResult); + + txCount += chunks.length; + + if (typeof this.onProgress === 'function') { + this.onProgress({ + percentage: txCount / txs.length, + currentIndex: txCount, + totalIndex: txs.length, + }); + } + } + + return results; + } + + async getBatchReceipt(txs: string[]): Promise { + let txCount = 0; + const results = []; + + for (const chunks of chunk(txs, this.concurrencySize * this.batchSize)) { + const chunksResult = ( + await Promise.all(this.createBatchRequest(chunk(chunks, this.batchSize), true)) + ).flat() as TransactionReceipt[]; + + results.push(...chunksResult); + + txCount += chunks.length; + + if (typeof this.onProgress === 'function') { + this.onProgress({ + percentage: txCount / txs.length, + currentIndex: txCount, + totalIndex: txs.length, + }); + } + } + + return results; + } } export interface BatchEventServiceConstructor { - provider: Provider; - contract: BaseContract; - onProgress?: BatchEventOnProgress; - concurrencySize?: number; - blocksPerRequest?: number; - shouldRetry?: boolean; - retryMax?: number; - retryOn?: number; + provider: Provider; + contract: BaseContract; + address?: string | string[]; + onProgress?: BatchEventOnProgress; + concurrencySize?: number; + blocksPerRequest?: number; + shouldRetry?: boolean; + retryMax?: number; + retryOn?: number; } export type BatchEventOnProgress = ({ - percentage, - type, - fromBlock, - toBlock, - count, + percentage, + type, + fromBlock, + toBlock, + count, }: { - percentage: number; - type?: ContractEventName; - fromBlock?: number; - toBlock?: number; - count?: number; + percentage: number; + type?: ContractEventName; + fromBlock?: number; + toBlock?: number; + count?: number; }) => void; // To enable iteration only numbers are accepted for fromBlock input -export type EventInput = { - fromBlock: number; - toBlock: number; - type: ContractEventName; -}; +export interface EventInput { + fromBlock: number; + toBlock: number; + type: ContractEventName; +} /** * Fetch events from web3 provider on bulk */ export class BatchEventsService { - provider: Provider; - contract: BaseContract; - onProgress?: BatchEventOnProgress; - concurrencySize: number; - blocksPerRequest: number; - shouldRetry: boolean; - retryMax: number; - retryOn: number; - constructor({ - provider, - contract, - onProgress, - concurrencySize = 10, - blocksPerRequest = 2000, - shouldRetry = true, - retryMax = 5, - retryOn = 500, - }: BatchEventServiceConstructor) { - this.provider = provider; - this.contract = contract; - this.onProgress = onProgress; - this.concurrencySize = concurrencySize; - this.blocksPerRequest = blocksPerRequest; - this.shouldRetry = shouldRetry; - this.retryMax = retryMax; - this.retryOn = retryOn; - } + provider: Provider; + contract: BaseContract; + address?: string | string[]; + onProgress?: BatchEventOnProgress; + concurrencySize: number; + blocksPerRequest: number; + shouldRetry: boolean; + retryMax: number; + retryOn: number; + constructor({ + provider, + contract, + address, + onProgress, + concurrencySize = 10, + blocksPerRequest = 5000, + shouldRetry = true, + retryMax = 5, + retryOn = 500, + }: BatchEventServiceConstructor) { + this.provider = provider; + this.contract = contract; + this.address = address; + this.onProgress = onProgress; + this.concurrencySize = concurrencySize; + this.blocksPerRequest = blocksPerRequest; + this.shouldRetry = shouldRetry; + this.retryMax = retryMax; + this.retryOn = retryOn; + } - async getPastEvents({ fromBlock, toBlock, type }: EventInput): Promise { - let err; - let retries = 0; + async getPastEvents({ fromBlock, toBlock, type }: EventInput): Promise { + let err; + let retries = 0; - // eslint-disable-next-line no-unmodified-loop-condition - while ((!this.shouldRetry && retries === 0) || (this.shouldRetry && retries < this.retryMax)) { - try { - return (await this.contract.queryFilter(type, fromBlock, toBlock)) as EventLog[]; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - } catch (e: any) { - err = e; - retries++; + // eslint-disable-next-line no-unmodified-loop-condition + while ((!this.shouldRetry && retries === 0) || (this.shouldRetry && retries < this.retryMax)) { + try { + if (this.address) { + return (await multiQueryFilter( + this.address, + this.contract, + type, + fromBlock, + toBlock, + )) as EventLog[]; + } + return (await this.contract.queryFilter(type, fromBlock, toBlock)) as EventLog[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } catch (e: any) { + err = e; + retries++; - // If provider.getBlockNumber returned last block that isn't accepted (happened on Avalanche/Gnosis), - // get events to last accepted block - if (e.message.includes('after last accepted block')) { - const acceptedBlock = parseInt(e.message.split('after last accepted block ')[1]); - toBlock = acceptedBlock; + // If provider.getBlockNumber returned last block that isn't accepted (happened on Avalanche/Gnosis), + // get events to last accepted block + if (e.message.includes('after last accepted block')) { + const acceptedBlock = parseInt(e.message.split('after last accepted block ')[1]); + toBlock = acceptedBlock; + } + + // retry on 0.5 seconds + await sleep(this.retryOn); + } } - // retry on 0.5 seconds - await sleep(this.retryOn); - } + throw err; } - throw err; - } + createBatchRequest(batchArray: EventInput[]): Promise[] { + return batchArray.map(async (event: EventInput, index: number) => { + await sleep(10 * index); - createBatchRequest(batchArray: EventInput[]): Promise[] { - return batchArray.map(async (event: EventInput, index: number) => { - await sleep(20 * index); - - return this.getPastEvents(event); - }); - } - - async getBatchEvents({ fromBlock, toBlock, type = '*' }: EventInput): Promise { - if (!toBlock) { - toBlock = await this.provider.getBlockNumber(); - } - - const eventsToSync = []; - - for (let i = fromBlock; i < toBlock; i += this.blocksPerRequest) { - const j = i + this.blocksPerRequest - 1 > toBlock ? toBlock : i + this.blocksPerRequest - 1; - - eventsToSync.push({ fromBlock: i, toBlock: j, type }); - } - - const events = []; - const eventChunk = chunk(eventsToSync, this.concurrencySize); - - let chunkCount = 0; - - for (const chunk of eventChunk) { - chunkCount++; - - const fetchedEvents = (await Promise.all(this.createBatchRequest(chunk))).flat(); - events.push(...fetchedEvents); - - if (typeof this.onProgress === 'function') { - this.onProgress({ - percentage: chunkCount / eventChunk.length, - type, - fromBlock: chunk[0].fromBlock, - toBlock: chunk[chunk.length - 1].toBlock, - count: fetchedEvents.length, + return this.getPastEvents(event); }); - } } - return events; - } + async getBatchEvents({ fromBlock, toBlock, type = '*' }: EventInput): Promise { + if (!toBlock) { + toBlock = await this.provider.getBlockNumber(); + } + + const eventsToSync = []; + + for (let i = fromBlock; i < toBlock; i += this.blocksPerRequest) { + const j = i + this.blocksPerRequest - 1 > toBlock ? toBlock : i + this.blocksPerRequest - 1; + + eventsToSync.push({ fromBlock: i, toBlock: j, type }); + } + + const events = []; + const eventChunk = chunk(eventsToSync, this.concurrencySize); + + let chunkCount = 0; + + for (const chunk of eventChunk) { + chunkCount++; + + const fetchedEvents = (await Promise.all(this.createBatchRequest(chunk))).flat(); + events.push(...fetchedEvents); + + if (typeof this.onProgress === 'function') { + this.onProgress({ + percentage: chunkCount / eventChunk.length, + type, + fromBlock: chunk[0].fromBlock, + toBlock: chunk[chunk.length - 1].toBlock, + count: fetchedEvents.length, + }); + } + } + + return events; + } } diff --git a/src/contracts.ts b/src/contracts.ts new file mode 100644 index 0000000..1a13791 --- /dev/null +++ b/src/contracts.ts @@ -0,0 +1,17 @@ +export * from '@tornado/contracts'; +export { + Multicall, + Multicall__factory, + OffchainOracle, + OffchainOracle__factory, + OvmGasPriceOracle, + OvmGasPriceOracle__factory, + ReverseRecords, + ReverseRecords__factory, + ENSNameWrapper, + ENSNameWrapper__factory, + ENSRegistry, + ENSRegistry__factory, + ENSResolver, + ENSResolver__factory, +} from './typechain'; diff --git a/src/deposits.ts b/src/deposits.ts index 2e7d8e1..5871c4f 100644 --- a/src/deposits.ts +++ b/src/deposits.ts @@ -2,246 +2,271 @@ import { bnToBytes, bytesToBN, leBuff2Int, leInt2Buff, rBigInt, toFixedHex } fro import { buffPedersenHash } from './pedersen'; import type { NetIdType } from './networkConfig'; -export type DepositType = { - currency: string; - amount: string; - netId: NetIdType; -}; +export interface DepositType { + currency: string; + amount: string; + netId: NetIdType; +} -export type createDepositParams = { - nullifier: bigint; - secret: bigint; -}; +export interface createDepositParams { + nullifier: bigint; + secret: bigint; +} -export type createDepositObject = { - preimage: Uint8Array; - noteHex: string; - commitment: bigint; - commitmentHex: string; - nullifierHash: bigint; - nullifierHex: string; -}; +export interface createDepositObject { + preimage: Uint8Array; + noteHex: string; + commitment: bigint; + commitmentHex: string; + nullifierHash: bigint; + nullifierHex: string; +} -export type createNoteParams = DepositType & { - nullifier?: bigint; - secret?: bigint; -}; +export interface createNoteParams extends DepositType { + nullifier?: bigint; + secret?: bigint; +} -export type parsedNoteExec = DepositType & { - note: string; -}; +export interface parsedNoteExec extends DepositType { + note: string; + noteHex: string; +} -export type depositTx = { - from: string; - transactionHash: string; -}; +export interface parsedInvoiceExec extends DepositType { + invoice: string; + commitmentHex: string; +} -export type withdrawalTx = { - to: string; - transactionHash: string; -}; +export function parseNote(noteString: string): parsedNoteExec | undefined { + const noteRegex = /tornado-(?\w+)-(?[\d.]+)-(?\d+)-0x(?[0-9a-fA-F]{124})/g; + const match = noteRegex.exec(noteString); + if (!match) { + return; + } + + const { currency, amount, netId, noteHex } = match.groups as unknown as parsedNoteExec; + + return { + currency: currency.toLowerCase(), + amount, + netId: Number(netId), + noteHex: '0x' + noteHex, + note: noteString, + }; +} + +export function parseInvoice(invoiceString: string): parsedInvoiceExec | undefined { + const invoiceRegex = + /tornadoInvoice-(?\w+)-(?[\d.]+)-(?\d+)-0x(?[0-9a-fA-F]{64})/g; + const match = invoiceRegex.exec(invoiceString); + if (!match) { + return; + } + + const { currency, amount, netId, commitmentHex } = match.groups as unknown as parsedInvoiceExec; + + return { + currency: currency.toLowerCase(), + amount, + netId: Number(netId), + commitmentHex: '0x' + commitmentHex, + invoice: invoiceString, + }; +} export async function createDeposit({ nullifier, secret }: createDepositParams): Promise { - const preimage = new Uint8Array([...leInt2Buff(nullifier), ...leInt2Buff(secret)]); - const noteHex = toFixedHex(bytesToBN(preimage), 62); - const commitment = BigInt(await buffPedersenHash(preimage)); - const commitmentHex = toFixedHex(commitment); - const nullifierHash = BigInt(await buffPedersenHash(leInt2Buff(nullifier))); - const nullifierHex = toFixedHex(nullifierHash); + const preimage = new Uint8Array([...leInt2Buff(nullifier), ...leInt2Buff(secret)]); + const noteHex = toFixedHex(bytesToBN(preimage), 62); + const commitment = BigInt(await buffPedersenHash(preimage)); + const commitmentHex = toFixedHex(commitment); + const nullifierHash = BigInt(await buffPedersenHash(leInt2Buff(nullifier))); + const nullifierHex = toFixedHex(nullifierHash); - return { - preimage, - noteHex, - commitment, - commitmentHex, - nullifierHash, - nullifierHex, - }; + return { + preimage, + noteHex, + commitment, + commitmentHex, + nullifierHash, + nullifierHex, + }; } export interface DepositConstructor { - currency: string; - amount: string; - netId: NetIdType; - nullifier: bigint; - secret: bigint; - note: string; - noteHex: string; - invoice: string; - commitmentHex: string; - nullifierHex: string; + currency: string; + amount: string; + netId: NetIdType; + nullifier: bigint; + secret: bigint; + note: string; + noteHex: string; + invoice: string; + commitmentHex: string; + nullifierHex: string; } export class Deposit { - currency: string; - amount: string; - netId: NetIdType; + currency: string; + amount: string; + netId: NetIdType; - nullifier: bigint; - secret: bigint; + nullifier: bigint; + secret: bigint; - note: string; - noteHex: string; - invoice: string; + note: string; + noteHex: string; + invoice: string; - commitmentHex: string; - nullifierHex: string; + commitmentHex: string; + nullifierHex: string; - constructor({ - currency, - amount, - netId, - nullifier, - secret, - note, - noteHex, - invoice, - commitmentHex, - nullifierHex, - }: DepositConstructor) { - this.currency = currency; - this.amount = amount; - this.netId = netId; + constructor({ + currency, + amount, + netId, + nullifier, + secret, + note, + noteHex, + invoice, + commitmentHex, + nullifierHex, + }: DepositConstructor) { + this.currency = currency; + this.amount = amount; + this.netId = netId; - this.nullifier = nullifier; - this.secret = secret; + this.nullifier = nullifier; + this.secret = secret; - this.note = note; - this.noteHex = noteHex; - this.invoice = invoice; + this.note = note; + this.noteHex = noteHex; + this.invoice = invoice; - this.commitmentHex = commitmentHex; - this.nullifierHex = nullifierHex; - } - - toString() { - return JSON.stringify( - { - currency: this.currency, - amount: this.amount, - netId: this.netId, - nullifier: this.nullifier, - secret: this.secret, - note: this.note, - noteHex: this.noteHex, - invoice: this.invoice, - commitmentHex: this.commitmentHex, - nullifierHex: this.nullifierHex, - }, - null, - 2, - ); - } - - static async createNote({ currency, amount, netId, nullifier, secret }: createNoteParams): Promise { - if (!nullifier) { - nullifier = rBigInt(31); - } - if (!secret) { - secret = rBigInt(31); + this.commitmentHex = commitmentHex; + this.nullifierHex = nullifierHex; } - const depositObject = await createDeposit({ - nullifier, - secret, - }); - - const newDeposit = new Deposit({ - currency: currency.toLowerCase(), - amount: amount, - netId, - note: `tornado-${currency.toLowerCase()}-${amount}-${netId}-${depositObject.noteHex}`, - noteHex: depositObject.noteHex, - invoice: `tornadoInvoice-${currency.toLowerCase()}-${amount}-${netId}-${depositObject.commitmentHex}`, - nullifier: nullifier, - secret: secret, - commitmentHex: depositObject.commitmentHex, - nullifierHex: depositObject.nullifierHex, - }); - - return newDeposit; - } - - static async parseNote(noteString: string): Promise { - const noteRegex = /tornado-(?\w+)-(?[\d.]+)-(?\d+)-0x(?[0-9a-fA-F]{124})/g; - const match = noteRegex.exec(noteString); - if (!match) { - throw new Error('The note has invalid format'); + toString() { + return JSON.stringify( + { + currency: this.currency, + amount: this.amount, + netId: this.netId, + nullifier: this.nullifier, + secret: this.secret, + note: this.note, + noteHex: this.noteHex, + invoice: this.invoice, + commitmentHex: this.commitmentHex, + nullifierHex: this.nullifierHex, + }, + null, + 2, + ); } - const matchGroup = match?.groups as unknown as parsedNoteExec; - const currency = matchGroup.currency.toLowerCase(); - const amount = matchGroup.amount; - const netId = Number(matchGroup.netId); + static async createNote({ currency, amount, netId, nullifier, secret }: createNoteParams): Promise { + if (!nullifier) { + nullifier = rBigInt(31); + } + if (!secret) { + secret = rBigInt(31); + } - const bytes = bnToBytes('0x' + matchGroup.note); - const nullifier = BigInt(leBuff2Int(bytes.slice(0, 31)).toString()); - const secret = BigInt(leBuff2Int(bytes.slice(31, 62)).toString()); + const depositObject = await createDeposit({ + nullifier, + secret, + }); - const depositObject = await createDeposit({ nullifier, secret }); + const newDeposit = new Deposit({ + currency: currency.toLowerCase(), + amount: amount, + netId, + note: `tornado-${currency.toLowerCase()}-${amount}-${netId}-${depositObject.noteHex}`, + noteHex: depositObject.noteHex, + invoice: `tornadoInvoice-${currency.toLowerCase()}-${amount}-${netId}-${depositObject.commitmentHex}`, + nullifier: nullifier, + secret: secret, + commitmentHex: depositObject.commitmentHex, + nullifierHex: depositObject.nullifierHex, + }); - const invoice = `tornadoInvoice-${currency}-${amount}-${netId}-${depositObject.commitmentHex}`; + return newDeposit; + } - const newDeposit = new Deposit({ - currency, - amount, - netId, - note: noteString, - noteHex: depositObject.noteHex, - invoice, - nullifier, - secret, - commitmentHex: depositObject.commitmentHex, - nullifierHex: depositObject.nullifierHex, - }); + static async parseNote(noteString: string): Promise { + const parsedNote = parseNote(noteString); - return newDeposit; - } + if (!parsedNote) { + throw new Error('The note has invalid format'); + } + + const { currency, amount, netId, note, noteHex: parsedNoteHex } = parsedNote; + + const bytes = bnToBytes(parsedNoteHex); + const nullifier = BigInt(leBuff2Int(bytes.slice(0, 31)).toString()); + const secret = BigInt(leBuff2Int(bytes.slice(31, 62)).toString()); + + const { noteHex, commitmentHex, nullifierHex } = await createDeposit({ + nullifier, + secret, + }); + + const invoice = `tornadoInvoice-${currency}-${amount}-${netId}-${commitmentHex}`; + + const newDeposit = new Deposit({ + currency, + amount, + netId, + note, + noteHex, + invoice, + nullifier, + secret, + commitmentHex, + nullifierHex, + }); + + return newDeposit; + } } -export type parsedInvoiceExec = DepositType & { - commitment: string; -}; - export class Invoice { - currency: string; - amount: string; - netId: NetIdType; - commitment: string; - invoice: string; + currency: string; + amount: string; + netId: NetIdType; + commitmentHex: string; + invoice: string; - constructor(invoiceString: string) { - const invoiceRegex = - /tornadoInvoice-(?\w+)-(?[\d.]+)-(?\d+)-0x(?[0-9a-fA-F]{64})/g; - const match = invoiceRegex.exec(invoiceString); - if (!match) { - throw new Error('The note has invalid format'); + constructor(invoiceString: string) { + const parsedInvoice = parseInvoice(invoiceString); + + if (!parsedInvoice) { + throw new Error('The invoice has invalid format'); + } + + const { currency, amount, netId, invoice, commitmentHex } = parsedInvoice; + + this.currency = currency; + this.amount = amount; + this.netId = netId; + + this.commitmentHex = commitmentHex; + this.invoice = invoice; } - const matchGroup = match?.groups as unknown as parsedInvoiceExec; - const currency = matchGroup.currency.toLowerCase(); - const amount = matchGroup.amount; - const netId = Number(matchGroup.netId); - - this.currency = currency; - this.amount = amount; - this.netId = netId; - - this.commitment = '0x' + matchGroup.commitment; - this.invoice = invoiceString; - } - - toString() { - return JSON.stringify( - { - currency: this.currency, - amount: this.amount, - netId: this.netId, - commitment: this.commitment, - invoice: this.invoice, - }, - null, - 2, - ); - } + toString() { + return JSON.stringify( + { + currency: this.currency, + amount: this.amount, + netId: this.netId, + commitmentHex: this.commitmentHex, + invoice: this.invoice, + }, + null, + 2, + ); + } } diff --git a/src/encryptedNotes.ts b/src/encryptedNotes.ts index 1064491..e4f696f 100644 --- a/src/encryptedNotes.ts +++ b/src/encryptedNotes.ts @@ -1,189 +1,209 @@ import { getEncryptionPublicKey, encrypt, decrypt, EthEncryptedData } from '@metamask/eth-sig-util'; -import { Echoer } from '@tornado/contracts'; -import { Wallet, computeAddress, getAddress } from 'ethers'; -import { crypto, base64ToBytes, bytesToBase64, bytesToHex, hexToBytes, toFixedHex, concatBytes } from './utils'; +import { JsonRpcApiProvider, Signer, Wallet, computeAddress, getAddress } from 'ethers'; +import { base64ToBytes, bytesToBase64, bytesToHex, hexToBytes, toFixedHex, concatBytes, rHex } from './utils'; import { EchoEvents, EncryptedNotesEvents } from './events'; -import type { NetIdType } from './networkConfig'; export interface NoteToEncrypt { - address: string; - noteHex: string; + address: string; + noteHex: string; } export interface DecryptedNotes { - blockNumber: number; - address: string; - noteHex: string; + blockNumber: number; + address: string; + noteHex: string; } export function packEncryptedMessage({ nonce, ephemPublicKey, ciphertext }: EthEncryptedData) { - const nonceBuf = toFixedHex(bytesToHex(base64ToBytes(nonce)), 24); - const ephemPublicKeyBuf = toFixedHex(bytesToHex(base64ToBytes(ephemPublicKey)), 32); - const ciphertextBuf = bytesToHex(base64ToBytes(ciphertext)); + const nonceBuf = toFixedHex(bytesToHex(base64ToBytes(nonce)), 24); + const ephemPublicKeyBuf = toFixedHex(bytesToHex(base64ToBytes(ephemPublicKey)), 32); + const ciphertextBuf = bytesToHex(base64ToBytes(ciphertext)); - const messageBuff = concatBytes(hexToBytes(nonceBuf), hexToBytes(ephemPublicKeyBuf), hexToBytes(ciphertextBuf)); + const messageBuff = concatBytes(hexToBytes(nonceBuf), hexToBytes(ephemPublicKeyBuf), hexToBytes(ciphertextBuf)); - return bytesToHex(messageBuff); + return bytesToHex(messageBuff); } export function unpackEncryptedMessage(encryptedMessage: string) { - const messageBuff = hexToBytes(encryptedMessage); - const nonceBuf = bytesToBase64(messageBuff.slice(0, 24)); - const ephemPublicKeyBuf = bytesToBase64(messageBuff.slice(24, 56)); - const ciphertextBuf = bytesToBase64(messageBuff.slice(56)); + const messageBuff = hexToBytes(encryptedMessage); + const nonceBuf = bytesToBase64(messageBuff.slice(0, 24)); + const ephemPublicKeyBuf = bytesToBase64(messageBuff.slice(24, 56)); + const ciphertextBuf = bytesToBase64(messageBuff.slice(56)); - return { - messageBuff: bytesToHex(messageBuff), - version: 'x25519-xsalsa20-poly1305', - nonce: nonceBuf, - ephemPublicKey: ephemPublicKeyBuf, - ciphertext: ciphertextBuf, - } as EthEncryptedData & { - messageBuff: string; - }; + return { + messageBuff: bytesToHex(messageBuff), + version: 'x25519-xsalsa20-poly1305', + nonce: nonceBuf, + ephemPublicKey: ephemPublicKeyBuf, + ciphertext: ciphertextBuf, + } as EthEncryptedData & { + messageBuff: string; + }; } export interface NoteAccountConstructor { - netId: NetIdType; - blockNumber?: number; - // hex - recoveryKey?: string; - Echoer: Echoer; + blockNumber?: number; + // hex + recoveryKey?: string; } export class NoteAccount { - netId: NetIdType; - blockNumber?: number; - // Dedicated 32 bytes private key only used for note encryption, backed up to an Echoer and local for future derivation - // Note that unlike the private key it shouldn't have the 0x prefix - recoveryKey: string; - // Address derived from recoveryKey, only used for frontend UI - recoveryAddress: string; - // Note encryption public key derived from recoveryKey - recoveryPublicKey: string; - Echoer: Echoer; + blockNumber?: number; + // Dedicated 32 bytes private key only used for note encryption, backed up to an Echoer and local for future derivation + // Note that unlike the private key it shouldn't have the 0x prefix + recoveryKey: string; + // Address derived from recoveryKey, only used for frontend UI + recoveryAddress: string; + // Note encryption public key derived from recoveryKey + recoveryPublicKey: string; - constructor({ netId, blockNumber, recoveryKey, Echoer }: NoteAccountConstructor) { - if (!recoveryKey) { - recoveryKey = bytesToHex(crypto.getRandomValues(new Uint8Array(32))).slice(2); + constructor({ blockNumber, recoveryKey }: NoteAccountConstructor) { + if (!recoveryKey) { + recoveryKey = rHex(32).slice(2); + } + + this.blockNumber = blockNumber; + this.recoveryKey = recoveryKey; + this.recoveryAddress = computeAddress('0x' + recoveryKey); + this.recoveryPublicKey = getEncryptionPublicKey(recoveryKey); } - this.netId = Math.floor(Number(netId)); - this.blockNumber = blockNumber; - this.recoveryKey = recoveryKey; - this.recoveryAddress = computeAddress('0x' + recoveryKey); - this.recoveryPublicKey = getEncryptionPublicKey(recoveryKey); - this.Echoer = Echoer; - } + /** + * Intends to mock eth_getEncryptionPublicKey behavior from MetaMask + * In order to make the recoveryKey retrival from Echoer possible from the bare private key + */ + static async getSignerPublicKey(signer: Signer | Wallet) { + if ((signer as Wallet).privateKey) { + const wallet = signer as Wallet; + const privateKey = wallet.privateKey.slice(0, 2) === '0x' ? wallet.privateKey.slice(2) : wallet.privateKey; - /** - * Intends to mock eth_getEncryptionPublicKey behavior from MetaMask - * In order to make the recoveryKey retrival from Echoer possible from the bare private key - */ - static getWalletPublicKey(wallet: Wallet) { - let { privateKey } = wallet; + // Should return base64 encoded public key + return getEncryptionPublicKey(privateKey); + } - if (privateKey.startsWith('0x')) { - privateKey = privateKey.replace('0x', ''); + const provider = signer.provider as JsonRpcApiProvider; + + return (await provider.send('eth_getEncryptionPublicKey', [ + (signer as Signer & { address: string }).address, + ])) as string; } - // Should return base64 encoded public key - return getEncryptionPublicKey(privateKey); - } - - // This function intends to provide an encrypted value of recoveryKey for an on-chain Echoer backup purpose - // Thus, the pubKey should be derived by a Wallet instance or from Web3 wallets - // pubKey: base64 encoded 32 bytes key from https://docs.metamask.io/wallet/reference/eth_getencryptionpublickey/ - getEncryptedAccount(walletPublicKey: string) { - const encryptedData = encrypt({ - publicKey: walletPublicKey, - data: this.recoveryKey, - version: 'x25519-xsalsa20-poly1305', - }); - - const data = packEncryptedMessage(encryptedData); - - return { - // Use this later to save hexPrivateKey generated with - // Buffer.from(JSON.stringify(encryptedData)).toString('hex') - // As we don't use buffer with this library we should leave UI to do the rest - encryptedData, - // Data that could be used as an echo(data) params - data, - }; - } - - /** - * Decrypt Echoer backuped note encryption account with private keys - */ - decryptAccountsWithWallet(wallet: Wallet, events: EchoEvents[]): NoteAccount[] { - let { privateKey } = wallet; - - if (privateKey.startsWith('0x')) { - privateKey = privateKey.replace('0x', ''); - } - - const decryptedEvents = []; - - for (const event of events) { - try { - const unpackedMessage = unpackEncryptedMessage(event.encryptedAccount); - - const recoveryKey = decrypt({ - encryptedData: unpackedMessage, - privateKey, + // This function intends to provide an encrypted value of recoveryKey for an on-chain Echoer backup purpose + // Thus, the pubKey should be derived by a Wallet instance or from Web3 wallets + // pubKey: base64 encoded 32 bytes key from https://docs.metamask.io/wallet/reference/eth_getencryptionpublickey/ + getEncryptedAccount(walletPublicKey: string) { + const encryptedData = encrypt({ + publicKey: walletPublicKey, + data: this.recoveryKey, + version: 'x25519-xsalsa20-poly1305', }); - decryptedEvents.push( - new NoteAccount({ - netId: this.netId, - blockNumber: event.blockNumber, - recoveryKey, - Echoer: this.Echoer, - }), - ); - } catch { - // decryption may fail for invalid accounts - continue; - } + const data = packEncryptedMessage(encryptedData); + + return { + // Use this later to save hexPrivateKey generated with + // Buffer.from(JSON.stringify(encryptedData)).toString('hex') + // As we don't use buffer with this library we should leave UI to do the rest + encryptedData, + // Data that could be used as an echo(data) params + data, + }; } - return decryptedEvents; - } + /** + * Decrypt Echoer backuped note encryption account with private keys + */ + static async decryptSignerNoteAccounts(signer: Signer | Wallet, events: EchoEvents[]): Promise { + const signerAddress = (signer as (Signer & { address: string }) | Wallet).address; - decryptNotes(events: EncryptedNotesEvents[]): DecryptedNotes[] { - const decryptedEvents = []; + const decryptedEvents = []; - for (const event of events) { - try { - const unpackedMessage = unpackEncryptedMessage(event.encryptedNote); + for (const event of events) { + if (event.address !== signerAddress) { + continue; + } - const [address, noteHex] = decrypt({ - encryptedData: unpackedMessage, - privateKey: this.recoveryKey, - }).split('-'); + try { + const unpackedMessage = unpackEncryptedMessage(event.encryptedAccount); - decryptedEvents.push({ - blockNumber: event.blockNumber, - address: getAddress(address), - noteHex, + let recoveryKey; + + if ((signer as Wallet).privateKey) { + const wallet = signer as Wallet; + const privateKey = + wallet.privateKey.slice(0, 2) === '0x' ? wallet.privateKey.slice(2) : wallet.privateKey; + + recoveryKey = decrypt({ + encryptedData: unpackedMessage, + privateKey, + }); + } else { + const { version, nonce, ephemPublicKey, ciphertext } = unpackedMessage; + + const unpackedBuffer = bytesToHex( + new TextEncoder().encode( + JSON.stringify({ + version, + nonce, + ephemPublicKey, + ciphertext, + }), + ), + ); + + const provider = signer.provider as JsonRpcApiProvider; + + recoveryKey = await provider.send('eth_decrypt', [unpackedBuffer, signerAddress]); + } + + decryptedEvents.push( + new NoteAccount({ + blockNumber: event.blockNumber, + recoveryKey, + }), + ); + } catch { + // decryption may fail for invalid accounts + continue; + } + } + + return decryptedEvents; + } + + decryptNotes(events: EncryptedNotesEvents[]): DecryptedNotes[] { + const decryptedEvents = []; + + for (const event of events) { + try { + const unpackedMessage = unpackEncryptedMessage(event.encryptedNote); + + const [address, noteHex] = decrypt({ + encryptedData: unpackedMessage, + privateKey: this.recoveryKey, + }).split('-'); + + decryptedEvents.push({ + blockNumber: event.blockNumber, + address: getAddress(address), + noteHex, + }); + } catch { + // decryption may fail for foreign notes + continue; + } + } + + return decryptedEvents; + } + + encryptNote({ address, noteHex }: NoteToEncrypt) { + const encryptedData = encrypt({ + publicKey: this.recoveryPublicKey, + data: `${address}-${noteHex}`, + version: 'x25519-xsalsa20-poly1305', }); - } catch { - // decryption may fail for foreign notes - continue; - } + + return packEncryptedMessage(encryptedData); } - - return decryptedEvents; - } - - encryptNote({ address, noteHex }: NoteToEncrypt) { - const encryptedData = encrypt({ - publicKey: this.recoveryPublicKey, - data: `${address}-${noteHex}`, - version: 'x25519-xsalsa20-poly1305', - }); - - return packEncryptedMessage(encryptedData); - } } diff --git a/src/ens.ts b/src/ens.ts new file mode 100644 index 0000000..5cd30e7 --- /dev/null +++ b/src/ens.ts @@ -0,0 +1,145 @@ +import { namehash, EnsResolver, AbstractProvider, keccak256, Signer } from 'ethers'; + +import { + ENSNameWrapper, + ENSNameWrapper__factory, + ENSRegistry, + ENSRegistry__factory, + ENSResolver, + ENSResolver__factory, +} from './typechain'; +import { bytesToHex, isHex } from './utils'; +import { NetId, NetIdType } from './networkConfig'; + +export function encodedLabelToLabelhash(label: string): string | null { + if (label.length !== 66) return null; + if (label.indexOf('[') !== 0) return null; + if (label.indexOf(']') !== 65) return null; + const hash = `0x${label.slice(1, 65)}`; + if (!isHex(hash)) return null; + return hash; +} + +export function labelhash(label: string) { + if (!label) { + return bytesToHex(new Uint8Array(32).fill(0)); + } + return encodedLabelToLabelhash(label) || keccak256(new TextEncoder().encode(label)); +} + +export function makeLabelNodeAndParent(name: string) { + const labels = name.split('.'); + const label = labels.shift() as string; + const parentNode = namehash(labels.join('.')); + + return { + label, + labelhash: labelhash(label), + parentNode, + }; +} + +// https://github.com/ensdomains/ensjs/blob/main/packages/ensjs/src/contracts/consts.ts +export const EnsContracts: { + [key: NetIdType]: { + ensRegistry: string; + ensPublicResolver: string; + ensNameWrapper: string; + }; +} = { + [NetId.MAINNET]: { + ensRegistry: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', + ensPublicResolver: '0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63', + ensNameWrapper: '0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401', + }, + [NetId.SEPOLIA]: { + ensRegistry: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', + ensPublicResolver: '0x8FADE66B79cC9f707aB26799354482EB93a5B7dD', + ensNameWrapper: '0x0635513f179D50A207757E05759CbD106d7dFcE8', + }, +}; + +/** + * ENSUtils to manage on-chain registered relayers + */ +export class ENSUtils { + ENSRegistry?: ENSRegistry; + ENSResolver?: ENSResolver; + ENSNameWrapper?: ENSNameWrapper; + provider: AbstractProvider; + + constructor(provider: AbstractProvider) { + this.provider = provider; + } + + async getContracts() { + const { chainId } = await this.provider.getNetwork(); + + const { ensRegistry, ensPublicResolver, ensNameWrapper } = EnsContracts[Number(chainId)]; + + this.ENSRegistry = ENSRegistry__factory.connect(ensRegistry, this.provider); + this.ENSResolver = ENSResolver__factory.connect(ensPublicResolver, this.provider); + this.ENSNameWrapper = ENSNameWrapper__factory.connect(ensNameWrapper, this.provider); + } + + async getOwner(name: string) { + if (!this.ENSRegistry) { + await this.getContracts(); + } + + return (this.ENSRegistry as ENSRegistry).owner(namehash(name)); + } + + // nameWrapper connected with wallet signer + async unwrap(signer: Signer, name: string) { + if (!this.ENSNameWrapper) { + await this.getContracts(); + } + + const owner = (signer as unknown as { address: string }).address; + + const nameWrapper = (this.ENSNameWrapper as ENSNameWrapper).connect(signer); + + const { labelhash } = makeLabelNodeAndParent(name); + + return nameWrapper.unwrapETH2LD(labelhash, owner, owner); + } + + // https://github.com/ensdomains/ensjs/blob/main/packages/ensjs/src/functions/wallet/createSubname.ts + async setSubnodeRecord(signer: Signer, name: string) { + if (!this.ENSResolver) { + await this.getContracts(); + } + + const resolver = this.ENSResolver as ENSResolver; + const registry = (this.ENSRegistry as ENSRegistry).connect(signer); + + const owner = (signer as unknown as { address: string }).address; + + const { labelhash, parentNode } = makeLabelNodeAndParent(name); + + return registry.setSubnodeRecord(parentNode, labelhash, owner, resolver.target, BigInt(0)); + } + + getResolver(name: string) { + return EnsResolver.fromName(this.provider, name); + } + + async getText(name: string, key: string) { + const resolver = await this.getResolver(name); + + // Retuns null if the name doesn't exist + if (!resolver) { + return resolver; + } + + return (await resolver.getText(key)) || ''; + } + + // https://github.com/ensdomains/ensjs/blob/main/packages/ensjs/src/functions/wallet/setTextRecord.ts + async setText(signer: Signer, name: string, key: string, value: string) { + const resolver = ENSResolver__factory.connect((await this.getResolver(name))?.address as string, signer); + + return resolver.setText(namehash(name), key, value); + } +} diff --git a/src/events/base.ts b/src/events/base.ts index 507f140..91f93c5 100644 --- a/src/events/base.ts +++ b/src/events/base.ts @@ -1,794 +1,1484 @@ -import { BaseContract, Provider, EventLog, TransactionResponse, getAddress, Block, ContractEventName } from 'ethers'; -import type { - Tornado, - TornadoRouter, - TornadoProxyLight, - Governance, - RelayerRegistry, - Echoer, -} from '@tornado/contracts'; -import * as graph from '../graphql'; import { - BatchEventsService, - BatchBlockService, - BatchTransactionService, - BatchEventOnProgress, - BatchBlockOnProgress, + BaseContract, + Provider, + EventLog, + TransactionResponse, + getAddress, + namehash, + formatEther, + AbiCoder, + dataLength, + dataSlice, +} from 'ethers'; + +import { + Tornado, + TornadoRouter, + TornadoProxyLight, + Governance, + RelayerRegistry, + Echoer, + Aggregator, + Tornado__factory, +} from '@tornado/contracts'; + +import type { MerkleTree } from '@tornado/fixed-merkle-tree'; +import { + BatchEventsService, + BatchBlockService, + BatchTransactionService, + BatchEventOnProgress, + BatchBlockOnProgress, } from '../batch'; -import { fetchDataOptions } from '../providers'; -import type { NetIdType } from '../networkConfig'; + +import { fetchData, fetchDataOptions } from '../providers'; +import { enabledChains, type NetIdType, type SubdomainMap } from '../networkConfig'; +import { RelayerParams, MIN_STAKE_BALANCE } from '../relayerClient'; +import type { TovarishClient } from '../tovarishClient'; + +import type { ReverseRecords } from '../typechain'; +import type { MerkleTreeService } from '../merkleTree'; +import type { DepositType } from '../deposits'; import type { - BaseEvents, - MinimalEvents, - DepositsEvents, - WithdrawalsEvents, - EncryptedNotesEvents, - AllGovernanceEvents, - GovernanceProposalCreatedEvents, - GovernanceVotedEvents, - GovernanceDelegatedEvents, - GovernanceUndelegatedEvents, - RegistersEvents, - BaseGraphEvents, - EchoEvents, + BaseEvents, + CachedEvents, + MinimalEvents, + DepositsEvents, + WithdrawalsEvents, + EncryptedNotesEvents, + AllGovernanceEvents, + GovernanceProposalCreatedEvents, + GovernanceVotedEvents, + GovernanceDelegatedEvents, + GovernanceUndelegatedEvents, + EchoEvents, + RelayerRegisteredEvents, + RelayerUnregisteredEvents, + WorkerRegisteredEvents, + WorkerUnregisteredEvents, + AllRelayerRegistryEvents, + StakeBurnedEvents, + MultiDepositsEvents, + MultiWithdrawalsEvents, } from './types'; -export const DEPOSIT = 'deposit'; -export const WITHDRAWAL = 'withdrawal'; - -export type BaseEventsServiceConstructor = { - netId: NetIdType; - provider: Provider; - graphApi?: string; - subgraphName?: string; - contract: BaseContract; - type?: string; - deployedBlock?: number; - fetchDataOptions?: fetchDataOptions; -}; - -export type BatchGraphOnProgress = ({ - type, - fromBlock, - toBlock, - count, -}: { - type?: ContractEventName; - fromBlock?: number; - toBlock?: number; - count?: number; -}) => void; - -export type BaseGraphParams = { - graphApi: string; - subgraphName: string; - fetchDataOptions?: fetchDataOptions; - onProgress?: BatchGraphOnProgress; -}; +export interface BaseEventsServiceConstructor { + netId: NetIdType; + provider: Provider; + contract: BaseContract; + type: string; + deployedBlock?: number; + fetchDataOptions?: fetchDataOptions; + tovarishClient?: TovarishClient; +} export class BaseEventsService { - netId: NetIdType; - provider: Provider; - graphApi?: string; - subgraphName?: string; - contract: BaseContract; - type: string; - deployedBlock: number; - batchEventsService: BatchEventsService; - fetchDataOptions?: fetchDataOptions; + netId: NetIdType; + provider: Provider; + contract: BaseContract; + type: string; + deployedBlock: number; + batchEventsService: BatchEventsService; + fetchDataOptions?: fetchDataOptions; + tovarishClient?: TovarishClient; - saveEventsPromise?: Promise; + constructor({ + netId, + provider, + contract, + type = '', + deployedBlock = 0, + fetchDataOptions, + tovarishClient, + }: BaseEventsServiceConstructor) { + this.netId = netId; + this.provider = provider; + this.fetchDataOptions = fetchDataOptions; - constructor({ - netId, - provider, - graphApi, - subgraphName, - contract, - type = '', - deployedBlock = 0, - fetchDataOptions, - }: BaseEventsServiceConstructor) { - this.netId = netId; - this.provider = provider; - this.graphApi = graphApi; - this.subgraphName = subgraphName; - this.fetchDataOptions = fetchDataOptions; + this.contract = contract; + this.type = type; + this.deployedBlock = deployedBlock; - this.contract = contract; - this.type = type; - this.deployedBlock = deployedBlock; + this.batchEventsService = new BatchEventsService({ + provider, + contract, + onProgress: this.updateEventProgress, + }); - this.batchEventsService = new BatchEventsService({ - provider, - contract, - onProgress: this.updateEventProgress, - }); - } - - getInstanceName(): string { - return ''; - } - - getType(): string { - return this.type || ''; - } - - getGraphMethod(): string { - return ''; - } - - getGraphParams(): BaseGraphParams { - return { - graphApi: this.graphApi || '', - subgraphName: this.subgraphName || '', - fetchDataOptions: this.fetchDataOptions, - onProgress: this.updateGraphProgress, - }; - } - - /* eslint-disable @typescript-eslint/no-unused-vars */ - updateEventProgress({ percentage, type, fromBlock, toBlock, count }: Parameters[0]) {} - - updateBlockProgress({ percentage, currentIndex, totalIndex }: Parameters[0]) {} - - updateTransactionProgress({ percentage, currentIndex, totalIndex }: Parameters[0]) {} - - updateGraphProgress({ type, fromBlock, toBlock, count }: Parameters[0]) {} - /* eslint-enable @typescript-eslint/no-unused-vars */ - - async formatEvents(events: EventLog[]): Promise { - // eslint-disable-next-line no-return-await - return await new Promise((resolve) => resolve(events as unknown as EventType[])); - } - - /** - * Get saved or cached events - */ - - async getEventsFromDB(): Promise> { - return { - events: [], - lastBlock: null, - }; - } - - async getEventsFromCache(): Promise> { - return { - events: [], - lastBlock: null, - }; - } - - async getSavedEvents(): Promise> { - let cachedEvents = await this.getEventsFromDB(); - - if (!cachedEvents || !cachedEvents.events.length) { - cachedEvents = await this.getEventsFromCache(); + this.tovarishClient = tovarishClient; } - return cachedEvents; - } + getInstanceName(): string { + return ''; + } - /** - * Get latest events - */ + getType(): string { + return this.type || ''; + } - async getEventsFromGraph({ - fromBlock, - methodName = '', - }: { - fromBlock: number; - methodName?: string; - }): Promise> { - if (!this.graphApi || !this.subgraphName) { - return { - events: [], - lastBlock: fromBlock, - }; + getTovarishType(): string { + return String(this.getType() || '').toLowerCase(); + } + + /* eslint-disable @typescript-eslint/no-unused-vars */ + updateEventProgress({ percentage, type, fromBlock, toBlock, count }: Parameters[0]) {} + + updateBlockProgress({ percentage, currentIndex, totalIndex }: Parameters[0]) {} + + updateTransactionProgress({ percentage, currentIndex, totalIndex }: Parameters[0]) {} + + /* eslint-enable @typescript-eslint/no-unused-vars */ + + async formatEvents(events: EventLog[]): Promise { + // eslint-disable-next-line no-return-await + return await new Promise((resolve) => resolve(events as unknown as EventType[])); + } + + /** + * Get saved or cached events + */ + + async getEventsFromDB(): Promise> { + return { + events: [], + lastBlock: 0, + }; + } + + /** + * Events from remote cache (Either from local cache, CDN, or from IPFS) + */ + async getEventsFromCache(): Promise> { + return { + events: [], + lastBlock: 0, + fromCache: true, + }; + } + + async getSavedEvents(): Promise | CachedEvents> { + let dbEvents = await this.getEventsFromDB(); + + if (!dbEvents.lastBlock) { + dbEvents = await this.getEventsFromCache(); + } + + return dbEvents; + } + + async getEventsFromRpc({ + fromBlock, + toBlock, + }: { + fromBlock: number; + toBlock?: number; + }): Promise> { + try { + if (!toBlock) { + toBlock = await this.provider.getBlockNumber(); + } + + if (fromBlock >= toBlock) { + return { + events: [], + lastBlock: toBlock, + }; + } + + this.updateEventProgress({ percentage: 0, type: this.getType() }); + + const events = await this.formatEvents( + await this.batchEventsService.getBatchEvents({ + fromBlock, + toBlock, + type: this.getType(), + }), + ); + + return { + events, + lastBlock: toBlock, + }; + } catch (err) { + console.log(err); + return { + events: [], + lastBlock: fromBlock, + }; + } + } + + async getLatestEvents({ fromBlock }: { fromBlock: number }): Promise> { + if (this.tovarishClient?.selectedRelayer) { + const { events, lastSyncBlock: lastBlock } = await this.tovarishClient.getEvents({ + type: this.getTovarishType(), + fromBlock, + }); + + return { + events, + lastBlock, + }; + } + + return await this.getEventsFromRpc({ + fromBlock, + }); + } + + /* eslint-disable @typescript-eslint/no-unused-vars */ + async validateEvents({ + events, + newEvents, + lastBlock, + }: BaseEvents & { newEvents: EventType[] }): Promise { + return undefined as S; + } + /* eslint-enable @typescript-eslint/no-unused-vars */ + + /** + * Handle saving events + */ + + // eslint-disable-next-line @typescript-eslint/no-unused-vars + async saveEvents({ events, newEvents, lastBlock }: BaseEvents & { newEvents: EventType[] }) {} + + /** + * Trigger saving and receiving latest events + */ + + async updateEvents() { + const savedEvents = await this.getSavedEvents(); + + let fromBlock = this.deployedBlock; + + if (savedEvents && savedEvents.lastBlock) { + fromBlock = savedEvents.lastBlock + 1; + } + + const newEvents = await this.getLatestEvents({ fromBlock }); + + const eventSet = new Set(); + + const allEvents: EventType[] = [...savedEvents.events, ...newEvents.events] + .sort((a, b) => { + if (a.blockNumber === b.blockNumber) { + return a.logIndex - b.logIndex; + } + return a.blockNumber - b.blockNumber; + }) + .filter(({ transactionHash, logIndex }) => { + const eventKey = `${transactionHash}_${logIndex}`; + const hasEvent = eventSet.has(eventKey); + eventSet.add(eventKey); + return !hasEvent; + }); + + const lastBlock = newEvents.lastBlock || allEvents[allEvents.length - 1]?.blockNumber; + + const validateResult = await this.validateEvents({ + events: allEvents, + newEvents: newEvents.events, + lastBlock, + }); + + // If the events are loaded from cache or we have found new events, save them + if ((savedEvents as CachedEvents).fromCache || newEvents.events.length) { + await this.saveEvents({ events: allEvents, newEvents: newEvents.events, lastBlock }); + } + + return { + events: allEvents, + lastBlock, + validateResult, + }; + } +} + +export interface BaseTornadoServiceConstructor extends Omit { + Tornado: Tornado; + amount: string; + currency: string; + optionalTree?: boolean; + merkleTreeService?: MerkleTreeService; +} + +export class BaseTornadoService extends BaseEventsService { + amount: string; + currency: string; + + optionalTree?: boolean; + merkleTreeService?: MerkleTreeService; + batchTransactionService: BatchTransactionService; + batchBlockService: BatchBlockService; + + constructor(serviceConstructor: BaseTornadoServiceConstructor) { + const { Tornado: contract, amount, currency, provider, optionalTree, merkleTreeService } = serviceConstructor; + + super({ + ...serviceConstructor, + contract, + }); + + this.amount = amount; + this.currency = currency; + + this.optionalTree = optionalTree; + this.merkleTreeService = merkleTreeService; + + this.batchTransactionService = new BatchTransactionService({ + provider, + onProgress: this.updateTransactionProgress, + }); + + this.batchBlockService = new BatchBlockService({ + provider, + onProgress: this.updateBlockProgress, + }); + } + + getInstanceName(): string { + return `${this.getType().toLowerCase()}s_${this.netId}_${this.currency}_${this.amount}`; + } + + async formatEvents(events: EventLog[]): Promise<(DepositsEvents | WithdrawalsEvents)[]> { + const type = this.getType(); + if (type === 'Deposit') { + const txs = await this.batchTransactionService.getBatchTransactions([ + ...new Set(events.map(({ transactionHash }) => transactionHash)), + ]); + + return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { + const { commitment, leafIndex, timestamp } = args; + + return { + blockNumber, + logIndex, + transactionHash, + commitment: commitment as string, + leafIndex: Number(leafIndex), + timestamp: Number(timestamp), + from: txs.find(({ hash }) => hash === transactionHash)?.from || '', + }; + }); + } else { + const blocks = await this.batchBlockService.getBatchBlocks([ + ...new Set(events.map(({ blockNumber }) => blockNumber)), + ]); + + return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { + const { nullifierHash, to, fee } = args; + + return { + blockNumber, + logIndex, + transactionHash, + nullifierHash: String(nullifierHash), + to: getAddress(to), + fee: String(fee), + timestamp: blocks.find(({ number }) => number === blockNumber)?.timestamp || 0, + }; + }); + } + } + + async validateEvents({ + events, + newEvents, + }: BaseEvents & { + newEvents: (DepositsEvents | WithdrawalsEvents)[]; + }) { + if (events.length && this.getType() === 'Deposit') { + const depositEvents = events as DepositsEvents[]; + + const lastEvent = depositEvents[depositEvents.length - 1]; + + if (lastEvent.leafIndex !== depositEvents.length - 1) { + const errMsg = `Deposit events invalid wants ${depositEvents.length - 1} leafIndex have ${lastEvent.leafIndex}`; + throw new Error(errMsg); + } + + if (this.merkleTreeService && (!this.optionalTree || newEvents.length)) { + return (await this.merkleTreeService.verifyTree(depositEvents)) as S; + } + } + + return undefined as S; + } + + async getLatestEvents({ + fromBlock, + }: { + fromBlock: number; + }): Promise> { + if (this.tovarishClient?.selectedRelayer) { + const { events, lastSyncBlock: lastBlock } = await this.tovarishClient.getEvents< + DepositsEvents | WithdrawalsEvents + >({ + type: this.getTovarishType(), + currency: this.currency, + amount: this.amount, + fromBlock, + }); + + return { + events, + lastBlock, + }; + } + + return await this.getEventsFromRpc({ + fromBlock, + }); + } +} + +export interface BaseMultiTornadoServiceConstructor extends Omit { + instances: { + [key in string]: DepositType; + }; + optionalTree?: boolean; + merkleTreeService?: MerkleTreeService; +} + +export class BaseMultiTornadoService extends BaseEventsService { + instances: { + [key in string]: DepositType; + }; + + optionalTree?: boolean; + merkleTreeService?: MerkleTreeService; + batchTransactionService: BatchTransactionService; + batchBlockService: BatchBlockService; + + constructor(serviceConstructor: BaseMultiTornadoServiceConstructor) { + const { instances, provider, optionalTree, merkleTreeService } = serviceConstructor; + + const contract = + merkleTreeService?.Tornado || Tornado__factory.connect(Object.keys(instances)[0] as string, provider); + + super({ + ...serviceConstructor, + contract, + type: '*', + }); + + this.batchEventsService = new BatchEventsService({ + provider, + contract, + address: Object.keys(instances), + onProgress: this.updateEventProgress, + }); + + this.instances = instances; + + this.optionalTree = optionalTree; + this.merkleTreeService = merkleTreeService; + + this.batchTransactionService = new BatchTransactionService({ + provider, + onProgress: this.updateTransactionProgress, + }); + + this.batchBlockService = new BatchBlockService({ + provider, + onProgress: this.updateBlockProgress, + }); + } + + getInstanceName(): string { + return `tornado_${this.netId}`; + } + + getTovarishType(): string { + return 'tornado'; + } + + async formatEvents(events: EventLog[]): Promise<(MultiDepositsEvents | MultiWithdrawalsEvents)[]> { + const txs = await this.batchTransactionService.getBatchTransactions([ + ...new Set( + events.filter(({ eventName }) => eventName === 'Deposit').map(({ transactionHash }) => transactionHash), + ), + ]); + + const blocks = await this.batchBlockService.getBatchBlocks([ + ...new Set( + events.filter(({ eventName }) => eventName === 'Withdrawal').map(({ blockNumber }) => blockNumber), + ), + ]); + + return events + .map( + ({ + address: instanceAddress, + blockNumber, + index: logIndex, + transactionHash, + args, + eventName: event, + }) => { + const eventObjects = { + blockNumber, + logIndex, + transactionHash, + event, + instanceAddress, + }; + + if (event === 'Deposit') { + const { commitment, leafIndex, timestamp } = args; + + return { + ...eventObjects, + commitment: commitment as string, + leafIndex: Number(leafIndex), + timestamp: Number(timestamp), + from: txs.find(({ hash }) => hash === transactionHash)?.from || '', + } as MultiDepositsEvents; + } + + if (event === 'Withdrawal') { + const { nullifierHash, to, relayer: relayerAddress, fee } = args; + + return { + ...eventObjects, + logIndex, + transactionHash, + nullifierHash: String(nullifierHash), + to, + relayerAddress, + fee: String(fee), + timestamp: blocks.find(({ number }) => number === blockNumber)?.timestamp || 0, + } as MultiWithdrawalsEvents; + } + }, + ) + .filter((e) => e) as (MultiDepositsEvents | MultiWithdrawalsEvents)[]; + } + + async validateEvents({ + events, + newEvents, + }: BaseEvents & { + newEvents: (MultiDepositsEvents | MultiWithdrawalsEvents)[]; + }) { + const instancesWithNewEvents = [ + ...new Set( + newEvents.filter(({ event }) => event === 'Deposit').map(({ instanceAddress }) => instanceAddress), + ), + ]; + + let tree: S | undefined; + + const requiredTree = this.merkleTreeService?.Tornado?.target as string | undefined; + + // Audit and create deposit tree + if (requiredTree && !instancesWithNewEvents.includes(requiredTree)) { + instancesWithNewEvents.push(requiredTree); + } + + for (const instance of instancesWithNewEvents) { + const depositEvents = events.filter( + ({ instanceAddress, event }) => instanceAddress === instance && event === 'Deposit', + ) as MultiDepositsEvents[]; + + const lastEvent = depositEvents[depositEvents.length - 1]; + + if (lastEvent.leafIndex !== depositEvents.length - 1) { + const errMsg = `Invalid deposit events for ${instance} wants ${depositEvents.length - 1} leafIndex have ${lastEvent.leafIndex}`; + throw new Error(errMsg); + } + + if (requiredTree === instance && !this.optionalTree) { + tree = (await this.merkleTreeService?.verifyTree(depositEvents)) as S; + } + } + + return tree as S; + } + + async getEvents(instanceAddress: string) { + const { events, validateResult: tree, lastBlock } = await this.updateEvents(); + + const { depositEvents, withdrawalEvents } = events.reduce( + (acc, curr) => { + if (curr.instanceAddress === instanceAddress) { + if (curr.event === 'Deposit') { + acc.depositEvents.push(curr as MultiDepositsEvents); + } else if (curr.event === 'Withdrawal') { + acc.withdrawalEvents.push(curr as MultiWithdrawalsEvents); + } + } + return acc; + }, + {} as { + depositEvents: MultiDepositsEvents[]; + withdrawalEvents: MultiWithdrawalsEvents[]; + }, + ); + + return { + depositEvents, + withdrawalEvents, + tree, + lastBlock, + }; + } +} + +export interface BaseEchoServiceConstructor extends Omit { + Echoer: Echoer; +} + +export class BaseEchoService extends BaseEventsService { + constructor(serviceConstructor: BaseEchoServiceConstructor) { + super({ + ...serviceConstructor, + contract: serviceConstructor.Echoer, + type: 'Echo', + }); + } + + getInstanceName(): string { + return `echo_${this.netId}`; + } + + async formatEvents(events: EventLog[]) { + return events + .map(({ blockNumber, index: logIndex, transactionHash, args }) => { + const { who, data } = args; + + if (who && data) { + const eventObjects = { + blockNumber, + logIndex, + transactionHash, + }; + + return { + ...eventObjects, + address: who, + encryptedAccount: data, + }; + } + }) + .filter((e) => e) as EchoEvents[]; + } +} + +export interface BaseEncryptedNotesServiceConstructor extends Omit { + Router: TornadoRouter | TornadoProxyLight; +} + +export class BaseEncryptedNotesService extends BaseEventsService { + constructor(serviceConstructor: BaseEncryptedNotesServiceConstructor) { + super({ + ...serviceConstructor, + contract: serviceConstructor.Router, + type: 'EncryptedNote', + }); + } + + getInstanceName(): string { + return `encrypted_notes_${this.netId}`; + } + + getTovarishType(): string { + return 'encrypted_notes'; + } + + async formatEvents(events: EventLog[]) { + return events + .map(({ blockNumber, index: logIndex, transactionHash, args }) => { + const { encryptedNote } = args; + + if (encryptedNote && encryptedNote !== '0x') { + const eventObjects = { + blockNumber, + logIndex, + transactionHash, + }; + + return { + ...eventObjects, + encryptedNote, + }; + } + }) + .filter((e) => e) as EncryptedNotesEvents[]; + } +} + +const abiCoder = AbiCoder.defaultAbiCoder(); + +export const proposalState: { [key: string]: string } = { + 0: 'Pending', + 1: 'Active', + 2: 'Defeated', + 3: 'Timelocked', + 4: 'AwaitingExecution', + 5: 'Executed', + 6: 'Expired', +}; + +function parseDescription(id: number, text: string): { title: string; description: string } { + switch (id) { + case 1: + return { + title: text, + description: 'See: https://torn.community/t/proposal-1-enable-torn-transfers/38', + }; + case 10: + text = text.replace('\n', '\\n\\n'); + break; + case 11: + text = text.replace('"description"', ',"description"'); + break; + case 13: + text = text.replace(/\\\\n\\\\n(\s)?(\\n)?/g, '\\n'); + break; + // Fix invalid JSON in proposal 15: replace single quotes with double and add comma before description + case 15: + // eslint-disable-next-line prettier/prettier + text = text.replaceAll('\'', '"'); + text = text.replace('"description"', ',"description"'); + break; + case 16: + text = text.replace('#16: ', ''); + break; + // Add title to empty (without title and description) hacker proposal 21 + case 21: + return { + title: 'Proposal #21: Restore Governance', + description: '', + }; } // eslint-disable-next-line @typescript-eslint/no-explicit-any - const { events, lastSyncBlock } = (await (graph as any)[methodName || this.getGraphMethod()]({ - fromBlock, - ...this.getGraphParams(), - })) as BaseGraphEvents; - return { - events, - lastBlock: lastSyncBlock, - }; - } - - async getEventsFromRpc({ - fromBlock, - toBlock, - }: { - fromBlock: number; - toBlock?: number; - }): Promise> { + let title: string, description: string, rest: any; try { - if (!toBlock) { - toBlock = await this.provider.getBlockNumber(); - } - - if (fromBlock >= toBlock) { - return { - events: [], - lastBlock: toBlock, - }; - } - - this.updateEventProgress({ percentage: 0, type: this.getType() }); - - const events = await this.formatEvents( - await this.batchEventsService.getBatchEvents({ fromBlock, toBlock, type: this.getType() }), - ); - - if (!events.length) { - return { - events, - lastBlock: toBlock, - }; - } - - return { - events, - lastBlock: toBlock, - }; - } catch (err) { - console.log(err); - return { - events: [], - lastBlock: fromBlock, - }; + ({ title, description } = JSON.parse(text)); + } catch { + [title, ...rest] = text.split('\n', 2); + description = rest.join('\n'); } - } - - async getLatestEvents({ fromBlock }: { fromBlock: number }): Promise> { - const allEvents = []; - const graphEvents = await this.getEventsFromGraph({ fromBlock }); - const lastSyncBlock = - graphEvents.lastBlock && graphEvents.lastBlock >= fromBlock ? graphEvents.lastBlock : fromBlock; - const rpcEvents = await this.getEventsFromRpc({ fromBlock: lastSyncBlock }); - allEvents.push(...graphEvents.events); - allEvents.push(...rpcEvents.events); - const lastBlock = rpcEvents - ? rpcEvents.lastBlock - : allEvents[allEvents.length - 1] - ? allEvents[allEvents.length - 1].blockNumber - : fromBlock; return { - events: allEvents, - lastBlock, + title, + description, }; - } - - // eslint-disable-next-line @typescript-eslint/no-unused-vars - validateEvents({ events, lastBlock }: BaseEvents) {} - - /** - * Handle saving events - */ - - // eslint-disable-next-line @typescript-eslint/no-unused-vars - async saveEvents({ events, lastBlock }: BaseEvents) {} - - /** - * Trigger saving and receiving latest events - */ - - async updateEvents() { - const savedEvents = await this.getSavedEvents(); - - let fromBlock = this.deployedBlock; - - if (savedEvents && savedEvents.lastBlock) { - fromBlock = savedEvents.lastBlock + 1; - } - - const newEvents = await this.getLatestEvents({ fromBlock }); - - const eventSet = new Set(); - - let allEvents: EventType[] = []; - - allEvents.push(...savedEvents.events); - allEvents.push(...newEvents.events); - - allEvents = allEvents - .sort((a, b) => { - if (a.blockNumber === b.blockNumber) { - return a.logIndex - b.logIndex; - } - return a.blockNumber - b.blockNumber; - }) - .filter(({ transactionHash, logIndex }) => { - const eventKey = `${transactionHash}_${logIndex}`; - const hasEvent = eventSet.has(eventKey); - eventSet.add(eventKey); - return !hasEvent; - }); - const lastBlock = newEvents - ? newEvents.lastBlock - : allEvents[allEvents.length - 1] - ? allEvents[allEvents.length - 1].blockNumber - : null; - - this.validateEvents({ events: allEvents, lastBlock }); - - this.saveEventsPromise = this.saveEvents({ events: allEvents, lastBlock }); - - return { - events: allEvents, - lastBlock, - }; - } } -export type BaseTornadoServiceConstructor = { - netId: NetIdType; - provider: Provider; - graphApi?: string; - subgraphName?: string; - Tornado: Tornado; - type: string; - amount: string; - currency: string; - deployedBlock?: number; - fetchDataOptions?: fetchDataOptions; -}; +function parseComment(Governance: Governance, calldata: string): { contact: string; message: string } { + try { + const methodLength = 4; + const result = abiCoder.decode(['address[]', 'uint256', 'bool'], dataSlice(calldata, methodLength)); + const data = Governance.interface.encodeFunctionData( + // @ts-expect-error encodeFunctionData is broken lol + 'castDelegatedVote', + result, + ); + const length = dataLength(data); -export type DepositsGraphParams = BaseGraphParams & { - amount: string; - currency: string; -}; - -export class BaseTornadoService extends BaseEventsService { - amount: string; - currency: string; - batchTransactionService: BatchTransactionService; - batchBlockService: BatchBlockService; - - constructor({ - netId, - provider, - graphApi, - subgraphName, - Tornado, - type, - amount, - currency, - deployedBlock, - fetchDataOptions, - }: BaseTornadoServiceConstructor) { - super({ netId, provider, graphApi, subgraphName, contract: Tornado, type, deployedBlock, fetchDataOptions }); - - this.amount = amount; - this.currency = currency; - - this.batchTransactionService = new BatchTransactionService({ - provider, - onProgress: this.updateTransactionProgress, - }); - - this.batchBlockService = new BatchBlockService({ - provider, - onProgress: this.updateBlockProgress, - }); - } - - getInstanceName(): string { - return `${this.getType().toLowerCase()}s_${this.netId}_${this.currency}_${this.amount}`; - } - - getGraphMethod(): string { - return `getAll${this.getType()}s`; - } - - getGraphParams(): DepositsGraphParams { - return { - graphApi: this.graphApi || '', - subgraphName: this.subgraphName || '', - amount: this.amount, - currency: this.currency, - fetchDataOptions: this.fetchDataOptions, - onProgress: this.updateGraphProgress, - }; - } - - async formatEvents(events: EventLog[]): Promise<(DepositsEvents | WithdrawalsEvents)[]> { - const type = this.getType().toLowerCase(); - if (type === DEPOSIT) { - const formattedEvents = events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { - const { commitment, leafIndex, timestamp } = args; + const str: string = abiCoder.decode(['string'], dataSlice(calldata, length))[0]; + const [contact, message] = JSON.parse(str) as string[]; return { - blockNumber, - logIndex, - transactionHash, - commitment: commitment as string, - leafIndex: Number(leafIndex), - timestamp: Number(timestamp), + contact, + message, }; - }); - - const txs = await this.batchTransactionService.getBatchTransactions([ - ...new Set(formattedEvents.map(({ transactionHash }) => transactionHash)), - ]); - - return formattedEvents.map((event) => { - const { from } = txs.find(({ hash }) => hash === event.transactionHash) as TransactionResponse; - + } catch { return { - ...event, - from, + contact: '', + message: '', }; - }); - } else { - const formattedEvents = events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { - const { nullifierHash, to, fee } = args; - - return { - blockNumber, - logIndex, - transactionHash, - nullifierHash: String(nullifierHash), - to: getAddress(to), - fee: String(fee), - }; - }); - - const blocks = await this.batchBlockService.getBatchBlocks([ - ...new Set(formattedEvents.map(({ blockNumber }) => blockNumber)), - ]); - - return formattedEvents.map((event) => { - const { timestamp } = blocks.find(({ number }) => number === event.blockNumber) as Block; - - return { - ...event, - timestamp, - }; - }); } - } - - validateEvents({ events }: { events: (DepositsEvents | WithdrawalsEvents)[] }) { - if (events.length && this.getType().toLowerCase() === DEPOSIT) { - const lastEvent = events[events.length - 1] as DepositsEvents; - - if (lastEvent.leafIndex !== events.length - 1) { - const errMsg = `Deposit events invalid wants ${events.length - 1} leafIndex have ${lastEvent.leafIndex}`; - throw new Error(errMsg); - } - } - } } -export type BaseEchoServiceConstructor = { - netId: NetIdType; - provider: Provider; - graphApi?: string; - subgraphName?: string; - Echoer: Echoer; - deployedBlock?: number; - fetchDataOptions?: fetchDataOptions; -}; - -export class BaseEchoService extends BaseEventsService { - constructor({ - netId, - provider, - graphApi, - subgraphName, - Echoer, - deployedBlock, - fetchDataOptions, - }: BaseEchoServiceConstructor) { - super({ netId, provider, graphApi, subgraphName, contract: Echoer, deployedBlock, fetchDataOptions }); - } - - getInstanceName(): string { - return `echo_${this.netId}`; - } - - getType(): string { - return 'Echo'; - } - - getGraphMethod(): string { - return 'getAllGraphEchoEvents'; - } - - async formatEvents(events: EventLog[]) { - return events - .map(({ blockNumber, index: logIndex, transactionHash, args }) => { - const { who, data } = args; - - if (who && data) { - const eventObjects = { - blockNumber, - logIndex, - transactionHash, - }; - - return { - ...eventObjects, - address: who, - encryptedAccount: data, - }; - } - }) - .filter((e) => e) as EchoEvents[]; - } - - async getEventsFromGraph({ fromBlock }: { fromBlock: number }): Promise> { - // TheGraph doesn't support our batch sync due to missing blockNumber field - if (!this.graphApi || this.graphApi.includes('api.thegraph.com')) { - return { - events: [], - lastBlock: fromBlock, - }; - } - - return super.getEventsFromGraph({ fromBlock }); - } +export interface GovernanceProposals extends GovernanceProposalCreatedEvents { + title: string; + proposerName?: string; + forVotes: bigint; + againstVotes: bigint; + executed: boolean; + extended: boolean; + quorum: string; + state: string; } -export type BaseEncryptedNotesServiceConstructor = { - netId: NetIdType; - provider: Provider; - graphApi?: string; - subgraphName?: string; - Router: TornadoRouter | TornadoProxyLight; - deployedBlock?: number; - fetchDataOptions?: fetchDataOptions; -}; - -export class BaseEncryptedNotesService extends BaseEventsService { - constructor({ - netId, - provider, - graphApi, - subgraphName, - Router, - deployedBlock, - fetchDataOptions, - }: BaseEncryptedNotesServiceConstructor) { - super({ netId, provider, graphApi, subgraphName, contract: Router, deployedBlock, fetchDataOptions }); - } - - getInstanceName(): string { - return `encrypted_notes_${this.netId}`; - } - - getType(): string { - return 'EncryptedNote'; - } - - getGraphMethod(): string { - return 'getAllEncryptedNotes'; - } - - async formatEvents(events: EventLog[]) { - return events - .map(({ blockNumber, index: logIndex, transactionHash, args }) => { - const { encryptedNote } = args; - - if (encryptedNote) { - const eventObjects = { - blockNumber, - logIndex, - transactionHash, - }; - - return { - ...eventObjects, - encryptedNote, - }; - } - }) - .filter((e) => e) as EncryptedNotesEvents[]; - } +export interface GovernanceVotes extends GovernanceVotedEvents { + contact: string; + message: string; + fromName?: string; + voterName?: string; } -export type BaseGovernanceServiceConstructor = { - netId: NetIdType; - provider: Provider; - graphApi?: string; - subgraphName?: string; - Governance: Governance; - deployedBlock?: number; - fetchDataOptions?: fetchDataOptions; -}; +export interface BaseGovernanceServiceConstructor extends Omit { + Governance: Governance; + Aggregator: Aggregator; + ReverseRecords: ReverseRecords; +} export class BaseGovernanceService extends BaseEventsService { - batchTransactionService: BatchTransactionService; + Governance: Governance; + Aggregator: Aggregator; + ReverseRecords: ReverseRecords; - constructor({ - netId, - provider, - graphApi, - subgraphName, - Governance, - deployedBlock, - fetchDataOptions, - }: BaseGovernanceServiceConstructor) { - super({ netId, provider, graphApi, subgraphName, contract: Governance, deployedBlock, fetchDataOptions }); + batchTransactionService: BatchTransactionService; - this.batchTransactionService = new BatchTransactionService({ - provider, - onProgress: this.updateTransactionProgress, - }); - } + constructor(serviceConstructor: BaseGovernanceServiceConstructor) { + const { Governance, Aggregator, ReverseRecords, provider } = serviceConstructor; - getInstanceName() { - return `governance_${this.netId}`; - } - - getType() { - return '*'; - } - - getGraphMethod() { - return 'getAllGovernanceEvents'; - } - - async formatEvents(events: EventLog[]): Promise { - const proposalEvents: GovernanceProposalCreatedEvents[] = []; - const votedEvents: GovernanceVotedEvents[] = []; - const delegatedEvents: GovernanceDelegatedEvents[] = []; - const undelegatedEvents: GovernanceUndelegatedEvents[] = []; - - events.forEach(({ blockNumber, index: logIndex, transactionHash, args, eventName: event }) => { - const eventObjects = { - blockNumber, - logIndex, - transactionHash, - event, - }; - - if (event === 'ProposalCreated') { - const { id, proposer, target, startTime, endTime, description } = args; - - proposalEvents.push({ - ...eventObjects, - id: Number(id), - proposer, - target, - startTime: Number(startTime), - endTime: Number(endTime), - description, + super({ + ...serviceConstructor, + contract: Governance, + type: '*', }); - } - if (event === 'Voted') { - const { proposalId, voter, support, votes } = args; + this.Governance = Governance; + this.Aggregator = Aggregator; + this.ReverseRecords = ReverseRecords; - votedEvents.push({ - ...eventObjects, - proposalId: Number(proposalId), - voter, - support, - votes, - from: '', - input: '', + this.batchTransactionService = new BatchTransactionService({ + provider, + onProgress: this.updateTransactionProgress, }); - } + } - if (event === 'Delegated') { - const { account, to: delegateTo } = args; + getInstanceName() { + return `governance_${this.netId}`; + } - delegatedEvents.push({ - ...eventObjects, - account, - delegateTo, + getTovarishType(): string { + return 'governance'; + } + + async formatEvents(events: EventLog[]): Promise { + const proposalEvents: GovernanceProposalCreatedEvents[] = []; + const votedEvents: GovernanceVotedEvents[] = []; + const delegatedEvents: GovernanceDelegatedEvents[] = []; + const undelegatedEvents: GovernanceUndelegatedEvents[] = []; + + events.forEach(({ blockNumber, index: logIndex, transactionHash, args, eventName: event }) => { + const eventObjects = { + blockNumber, + logIndex, + transactionHash, + event, + }; + + if (event === 'ProposalCreated') { + const { id, proposer, target, startTime, endTime, description } = args; + + proposalEvents.push({ + ...eventObjects, + id: Number(id), + proposer, + target, + startTime: Number(startTime), + endTime: Number(endTime), + description, + }); + } + + if (event === 'Voted') { + const { proposalId, voter, support, votes } = args; + + votedEvents.push({ + ...eventObjects, + proposalId: Number(proposalId), + voter, + support, + votes, + from: '', + input: '', + }); + } + + if (event === 'Delegated') { + const { account, to: delegateTo } = args; + + delegatedEvents.push({ + ...eventObjects, + account, + delegateTo, + }); + } + + if (event === 'Undelegated') { + const { account, from: delegateFrom } = args; + + undelegatedEvents.push({ + ...eventObjects, + account, + delegateFrom, + }); + } }); - } - if (event === 'Undelegated') { - const { account, from: delegateFrom } = args; + if (votedEvents.length) { + this.updateTransactionProgress({ percentage: 0 }); - undelegatedEvents.push({ - ...eventObjects, - account, - delegateFrom, - }); - } - }); + const txs = await this.batchTransactionService.getBatchTransactions([ + ...new Set(votedEvents.map(({ transactionHash }) => transactionHash)), + ]); - if (votedEvents.length) { - this.updateTransactionProgress({ percentage: 0 }); + votedEvents.forEach((event, index) => { + // eslint-disable-next-line prefer-const + let { data: input, from } = txs.find((t) => t.hash === event.transactionHash) as TransactionResponse; - const txs = await this.batchTransactionService.getBatchTransactions([ - ...new Set(votedEvents.map(({ transactionHash }) => transactionHash)), - ]); + // Filter spammy txs + if (!input || input.length > 2048) { + input = ''; + } - votedEvents.forEach((event, index) => { - // eslint-disable-next-line prefer-const - let { data: input, from } = txs.find((t) => t.hash === event.transactionHash) as TransactionResponse; - - // Filter spammy txs - if (!input || input.length > 2048) { - input = ''; + votedEvents[index].from = from; + votedEvents[index].input = input; + }); } - votedEvents[index].from = from; - votedEvents[index].input = input; - }); + return [...proposalEvents, ...votedEvents, ...delegatedEvents, ...undelegatedEvents]; } - return [...proposalEvents, ...votedEvents, ...delegatedEvents, ...undelegatedEvents]; - } + async getAllProposals(): Promise { + const { events } = await this.updateEvents(); - async getEventsFromGraph({ fromBlock }: { fromBlock: number }): Promise> { - // TheGraph doesn't support governance subgraphs - if (!this.graphApi || !this.subgraphName || this.graphApi.includes('api.thegraph.com')) { - return { - events: [], - lastBlock: fromBlock, - }; + const proposalEvents = events.filter((e) => e.event === 'ProposalCreated') as GovernanceProposalCreatedEvents[]; + + const allProposers = [...new Set(proposalEvents.map((e) => [e.proposer]).flat())]; + + const [QUORUM_VOTES, proposalStatus, proposerNameRecords] = await Promise.all([ + this.Governance.QUORUM_VOTES(), + this.Aggregator.getAllProposals(this.Governance.target), + this.ReverseRecords.getNames(allProposers), + ]); + + const proposerNames = allProposers.reduce( + (acc, address, index) => { + if (proposerNameRecords[index]) { + acc[address] = proposerNameRecords[index]; + } + return acc; + }, + {} as { [key: string]: string }, + ); + + return proposalEvents.map((event, index) => { + const { id, proposer, description: text } = event; + + const status = proposalStatus[index]; + + const { forVotes, againstVotes, executed, extended, state } = status; + + const { title, description } = parseDescription(id, text); + + const quorum = ((Number(forVotes + againstVotes) / Number(QUORUM_VOTES)) * 100).toFixed(0) + '%'; + + return { + ...event, + title, + proposerName: proposerNames[proposer] || undefined, + description, + forVotes, + againstVotes, + executed, + extended, + quorum, + state: proposalState[String(state)], + }; + }); } - return super.getEventsFromGraph({ fromBlock }); - } + async getVotes(proposalId: number): Promise { + const { events } = await this.getSavedEvents(); + + const votedEvents = events.filter( + (e) => e.event === 'Voted' && (e as GovernanceVotedEvents).proposalId === proposalId, + ) as GovernanceVotedEvents[]; + + const allVoters = [...new Set(votedEvents.map((e) => [e.from, e.voter]).flat())]; + + const names = await this.ReverseRecords.getNames(allVoters); + + const ensNames = allVoters.reduce( + (acc, address, index) => { + if (names[index]) { + acc[address] = names[index]; + } + return acc; + }, + {} as { [key: string]: string }, + ); + + const votes = votedEvents.map((event) => { + const { from, voter } = event; + + const { contact, message } = parseComment(this.Governance, event.input); + + return { + ...event, + contact, + message, + fromName: ensNames[from] || undefined, + voterName: ensNames[voter] || undefined, + }; + }); + + return votes; + } + + async getDelegatedBalance(ethAccount: string) { + const { events } = await this.getSavedEvents(); + + const delegatedAccs = events + .filter((e) => e.event === 'Delegated' && (e as GovernanceDelegatedEvents).delegateTo === ethAccount) + .map((e) => (e as GovernanceDelegatedEvents).account); + + const undelegatedAccs = events + .filter((e) => e.event === 'Undelegated' && (e as GovernanceUndelegatedEvents).delegateFrom === ethAccount) + .map((e) => (e as GovernanceUndelegatedEvents).account); + + const undel = [...undelegatedAccs]; + + const uniq = delegatedAccs.filter((acc) => { + const indexUndelegated = undel.indexOf(acc); + if (indexUndelegated !== -1) { + undel.splice(indexUndelegated, 1); + return false; + } + return true; + }); + + const [balances, uniqNameRecords] = await Promise.all([ + this.Aggregator.getGovernanceBalances(this.Governance.target, uniq), + this.ReverseRecords.getNames(uniq), + ]); + + const uniqNames = uniq.reduce( + (acc, address, index) => { + if (uniqNameRecords[index]) { + acc[address] = uniqNameRecords[index]; + } + return acc; + }, + {} as { [key: string]: string }, + ); + + return { + delegatedAccs, + undelegatedAccs, + uniq, + uniqNames, + balances, + balance: balances.reduce((acc, curr) => acc + curr, BigInt(0)), + }; + } } -export type BaseRegistryServiceConstructor = { - netId: NetIdType; - provider: Provider; - graphApi?: string; - subgraphName?: string; - RelayerRegistry: RelayerRegistry; - deployedBlock?: number; - fetchDataOptions?: fetchDataOptions; -}; - -export class BaseRegistryService extends BaseEventsService { - constructor({ - netId, - provider, - graphApi, - subgraphName, - RelayerRegistry, - deployedBlock, - fetchDataOptions, - }: BaseRegistryServiceConstructor) { - super({ netId, provider, graphApi, subgraphName, contract: RelayerRegistry, deployedBlock, fetchDataOptions }); - } - - getInstanceName() { - return `registered_${this.netId}`; - } - - // Name of type used for events - getType() { - return 'RelayerRegistered'; - } - - // Name of method used for graph - getGraphMethod() { - return 'getAllRegisters'; - } - - async formatEvents(events: EventLog[]) { - return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { - const eventObjects = { - blockNumber, - logIndex, - transactionHash, - }; - - return { - ...eventObjects, - ensName: args.ensName, - relayerAddress: args.relayerAddress, - }; - }); - } - - async fetchRelayers(): Promise { - return (await this.updateEvents()).events; - } +export async function getTovarishNetworks(registryService: BaseRegistryService, relayers: CachedRelayerInfo[]) { + await Promise.all( + relayers + .filter((r) => r.tovarishHost) + .map(async (relayer) => { + try { + relayer.tovarishNetworks = await fetchData(relayer.tovarishHost as string, { + ...registryService.fetchDataOptions, + headers: { + 'Content-Type': 'application/json', + }, + timeout: 30000, + maxRetry: registryService.fetchDataOptions?.torPort ? 2 : 0, + }); + } catch { + // Ignore error and disable relayer + relayer.tovarishNetworks = []; + } + }), + ); +} + +/** + * Essential params: + * ensName, relayerAddress, hostnames + * Other data is for historic purpose from relayer registry + */ +export interface CachedRelayerInfo extends RelayerParams { + isRegistered?: boolean; + registeredAddress?: string; + stakeBalance?: string; + hostnames: SubdomainMap; + tovarishHost?: string; + tovarishNetworks?: number[]; +} + +/** + * Static relayer provided by tornadowithdraw.eth + * This relayer isn't compatible with the current UI (tornadocash.eth) and only works as experimental mode + * Once DAO approves changes to UI to support new Tovarish Relayer software register relayer and remove static list + */ +const staticRelayers: CachedRelayerInfo[] = [ + { + ensName: 'tornadowithdraw.eth', + relayerAddress: '0x40c3d1656a26C9266f4A10fed0D87EFf79F54E64', + hostnames: {}, + tovarishHost: 'tornadowithdraw.com', + tovarishNetworks: enabledChains, + }, +]; + +export interface CachedRelayers { + lastBlock: number; + timestamp: number; + relayers: CachedRelayerInfo[]; + fromCache?: boolean; +} + +export interface BaseRegistryServiceConstructor extends Omit { + RelayerRegistry: RelayerRegistry; + Aggregator: Aggregator; + relayerEnsSubdomains: SubdomainMap; +} + +export class BaseRegistryService extends BaseEventsService { + Aggregator: Aggregator; + relayerEnsSubdomains: SubdomainMap; + updateInterval: number; + + constructor(serviceConstructor: BaseRegistryServiceConstructor) { + const { RelayerRegistry: contract, Aggregator, relayerEnsSubdomains } = serviceConstructor; + + super({ + ...serviceConstructor, + contract, + type: '*', + }); + + this.Aggregator = Aggregator; + this.relayerEnsSubdomains = relayerEnsSubdomains; + + this.updateInterval = 86400; + } + + getInstanceName() { + return `registry_${this.netId}`; + } + + getTovarishType(): string { + return 'registry'; + } + + async formatEvents(events: EventLog[]): Promise { + const relayerRegisteredEvents: RelayerRegisteredEvents[] = []; + const relayerUnregisteredEvents: RelayerUnregisteredEvents[] = []; + const workerRegisteredEvents: WorkerRegisteredEvents[] = []; + const workerUnregisteredEvents: WorkerUnregisteredEvents[] = []; + + events.forEach(({ blockNumber, index: logIndex, transactionHash, args, eventName: event }) => { + const eventObjects = { + blockNumber, + logIndex, + transactionHash, + event, + }; + + if (event === 'RelayerRegistered') { + const { relayer: ensHash, ensName, relayerAddress, stakedAmount } = args; + + relayerRegisteredEvents.push({ + ...eventObjects, + ensName, + relayerAddress, + ensHash, + stakedAmount: formatEther(stakedAmount), + }); + } + + if (event === 'RelayerUnregistered') { + const { relayer: relayerAddress } = args; + + relayerUnregisteredEvents.push({ + ...eventObjects, + relayerAddress, + }); + } + + if (event === 'WorkerRegistered') { + const { relayer: relayerAddress, worker: workerAddress } = args; + + workerRegisteredEvents.push({ + ...eventObjects, + relayerAddress, + workerAddress, + }); + } + + if (event === 'WorkerUnregistered') { + const { relayer: relayerAddress, worker: workerAddress } = args; + + workerUnregisteredEvents.push({ + ...eventObjects, + relayerAddress, + workerAddress, + }); + } + }); + + return [ + ...relayerRegisteredEvents, + ...relayerUnregisteredEvents, + ...workerRegisteredEvents, + ...workerUnregisteredEvents, + ]; + } + + /** + * Get saved or cached relayers + */ + async getRelayersFromDB(): Promise { + return { + lastBlock: 0, + timestamp: 0, + relayers: [], + }; + } + + /** + * Relayers from remote cache (Either from local cache, CDN, or from IPFS) + */ + async getRelayersFromCache(): Promise { + return { + lastBlock: 0, + timestamp: 0, + relayers: [], + fromCache: true, + }; + } + + async getSavedRelayers(): Promise { + let cachedRelayers = await this.getRelayersFromDB(); + + if (!cachedRelayers || !cachedRelayers.relayers.length) { + cachedRelayers = await this.getRelayersFromCache(); + } + + return cachedRelayers; + } + + async getLatestRelayers(): Promise { + const { events: allEvents, lastBlock } = await this.updateEvents(); + + const events = allEvents.filter((e) => e.event === 'RelayerRegistered') as RelayerRegisteredEvents[]; + + const subdomains = Object.values(this.relayerEnsSubdomains); + + const registerSet = new Set(); + + const uniqueRegisters = events.filter(({ ensName }) => { + if (!registerSet.has(ensName)) { + registerSet.add(ensName); + return true; + } + return false; + }); + + const relayerNameHashes = uniqueRegisters.map((r) => namehash(r.ensName)); + + const [relayersData, timestamp] = await Promise.all([ + this.Aggregator.relayersData.staticCall(relayerNameHashes, subdomains.concat('tovarish-relayer')), + this.provider.getBlock(lastBlock).then((b) => Number(b?.timestamp)), + ]); + + const relayers = relayersData + .map(({ owner, balance: stakeBalance, records, isRegistered }, index) => { + const { ensName, relayerAddress } = uniqueRegisters[index]; + + let tovarishHost = undefined; + + const hostnames = records.reduce((acc, record, recordIndex) => { + if (record) { + // tovarish-relayer.relayer.eth + if (recordIndex === records.length - 1) { + tovarishHost = record; + return acc; + } + + acc[Number(Object.keys(this.relayerEnsSubdomains)[recordIndex])] = record; + } + return acc; + }, {} as SubdomainMap); + + const hasMinBalance = stakeBalance >= MIN_STAKE_BALANCE; + + const preCondition = Object.keys(hostnames).length && isRegistered && hasMinBalance; + + if (preCondition) { + return { + ensName, + relayerAddress: owner, + registeredAddress: owner !== relayerAddress ? relayerAddress : undefined, + isRegistered, + stakeBalance: formatEther(stakeBalance), + hostnames, + tovarishHost, + } as CachedRelayerInfo; + } + }) + .filter((r) => r) as CachedRelayerInfo[]; + + await getTovarishNetworks(this, relayers); + + const allRelayers = [...staticRelayers, ...relayers]; + const tovarishRelayers = allRelayers.filter((r) => r.tovarishHost); + const classicRelayers = allRelayers.filter((r) => !r.tovarishHost); + + return { + lastBlock, + timestamp, + relayers: [...tovarishRelayers, ...classicRelayers], + }; + } + + /** + * Handle saving relayers + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + async saveRelayers({ lastBlock, timestamp, relayers }: CachedRelayers) {} + + /** + * Get cached or latest relayer and save to local + */ + async updateRelayers(): Promise { + // eslint-disable-next-line prefer-const + let { lastBlock, timestamp, relayers, fromCache } = await this.getSavedRelayers(); + + let shouldSave = fromCache ?? false; + + if (!relayers.length || timestamp + this.updateInterval < Math.floor(Date.now() / 1000)) { + console.log('\nUpdating relayers from registry\n'); + + ({ lastBlock, timestamp, relayers } = await this.getLatestRelayers()); + + shouldSave = true; + } + + if (shouldSave) { + await this.saveRelayers({ lastBlock, timestamp, relayers }); + } + + return { lastBlock, timestamp, relayers }; + } +} + +export interface BaseRevenueServiceConstructor extends Omit { + RelayerRegistry: RelayerRegistry; +} + +/** + * Tracks TORN burned events from RelayerRegistry contract + */ + +export class BaseRevenueService extends BaseEventsService { + batchTransactionService: BatchTransactionService; + batchBlockService: BatchBlockService; + + constructor(serviceConstructor: BaseRevenueServiceConstructor) { + const { RelayerRegistry: contract, provider } = serviceConstructor; + + super({ + ...serviceConstructor, + contract, + type: 'StakeBurned', + }); + + this.batchTransactionService = new BatchTransactionService({ + provider, + onProgress: this.updateTransactionProgress, + }); + + this.batchBlockService = new BatchBlockService({ + provider, + onProgress: this.updateBlockProgress, + }); + } + + getInstanceName() { + return `revenue_${this.netId}`; + } + + getTovarishType(): string { + return 'revenue'; + } + + async formatEvents(events: EventLog[]): Promise { + const blocks = await this.batchBlockService.getBatchBlocks([ + ...new Set(events.map(({ blockNumber }) => blockNumber)), + ]); + + const receipts = await this.batchTransactionService.getBatchReceipt([ + ...new Set(events.map(({ transactionHash }) => transactionHash)), + ]); + + const registeredRelayers = new Set(events.map(({ args }) => args.relayer)); + + const tornadoInterface = Tornado__factory.createInterface(); + + const withdrawHash = tornadoInterface.getEvent('Withdrawal').topicHash; + + const withdrawalLogs = receipts + .map( + (receipt) => + receipt.logs + .map((log) => { + if (log.topics[0] === withdrawHash) { + const block = blocks.find((b) => b.number === log.blockNumber); + + const parsedLog = tornadoInterface.parseLog(log); + + if (parsedLog && registeredRelayers.has(parsedLog.args.relayer)) { + return { + instanceAddress: log.address, + gasFee: (receipt.cumulativeGasUsed * receipt.gasPrice).toString(), + relayerFee: parsedLog.args.fee.toString(), + timestamp: block?.timestamp || 0, + }; + } + } + }) + .filter((l) => l) as { + instanceAddress: string; + gasFee: string; + relayerFee: string; + timestamp: number; + }[], + ) + .flat(); + + if (withdrawalLogs.length !== events.length) { + console.log( + `\nRevenueService: Mismatch on withdrawal logs (${withdrawalLogs.length} ) and events logs (${events.length})\n`, + ); + } + + return events.map(({ blockNumber, index: logIndex, transactionHash, args }, index) => { + const eventObjects = { + blockNumber, + logIndex, + transactionHash, + }; + + const { relayer: relayerAddress, amountBurned } = args; + + const { instanceAddress, gasFee, relayerFee, timestamp } = withdrawalLogs[index]; + + return { + ...eventObjects, + relayerAddress, + amountBurned: amountBurned.toString(), + instanceAddress, + gasFee, + relayerFee, + timestamp, + }; + }); + } } diff --git a/src/events/db.ts b/src/events/db.ts new file mode 100644 index 0000000..36252a4 --- /dev/null +++ b/src/events/db.ts @@ -0,0 +1,497 @@ +import { downloadZip } from '../zip'; +import { IndexedDB } from '../idb'; + +import { bytesToBase64, digest } from '../utils'; +import { fetchData } from '../providers'; +import { + BaseTornadoService, + BaseTornadoServiceConstructor, + BaseEchoService, + BaseEchoServiceConstructor, + BaseEncryptedNotesService, + BaseEncryptedNotesServiceConstructor, + BaseGovernanceService, + BaseGovernanceServiceConstructor, + BaseRegistryService, + BaseRegistryServiceConstructor, + BaseRevenueService, + BaseRevenueServiceConstructor, + CachedRelayers, +} from './base'; + +import { + BaseEvents, + MinimalEvents, + DepositsEvents, + WithdrawalsEvents, + CachedEvents, + EchoEvents, + EncryptedNotesEvents, + AllGovernanceEvents, + AllRelayerRegistryEvents, + StakeBurnedEvents, +} from './types'; + +export async function saveDBEvents({ + idb, + instanceName, + events, + lastBlock, +}: { + idb: IndexedDB; + instanceName: string; + events: T[]; + lastBlock: number; +}) { + try { + const formattedEvents = events.map((e) => { + return { + eid: `${e.transactionHash}_${e.logIndex}`, + ...e, + }; + }); + + await idb.createMultipleTransactions({ + data: formattedEvents, + storeName: instanceName, + }); + + await idb.putItem({ + data: { + blockNumber: lastBlock, + name: instanceName, + }, + storeName: 'lastEvents', + }); + } catch (err) { + console.log('Method saveDBEvents has error'); + console.log(err); + } +} + +export async function loadDBEvents({ + idb, + instanceName, +}: { + idb: IndexedDB; + instanceName: string; +}): Promise> { + try { + const lastBlockStore = await idb.getItem<{ + blockNumber: number; + name: string; + }>({ + storeName: 'lastEvents', + key: instanceName, + }); + + if (!lastBlockStore?.blockNumber) { + return { + events: [], + lastBlock: 0, + }; + } + + const events = ( + await idb.getAll<(T & { eid?: string })[]>({ + storeName: instanceName, + }) + ).map((e) => { + delete e.eid; + return e; + }); + + return { + events, + lastBlock: lastBlockStore.blockNumber, + }; + } catch (err) { + console.log('Method loadDBEvents has error'); + console.log(err); + + return { + events: [], + lastBlock: 0, + }; + } +} + +export async function loadRemoteEvents({ + staticUrl, + instanceName, + deployedBlock, + zipDigest, +}: { + staticUrl: string; + instanceName: string; + deployedBlock: number; + zipDigest?: string; +}): Promise> { + try { + const zipName = `${instanceName}.json`.toLowerCase(); + + const events = await downloadZip({ + staticUrl, + zipName, + zipDigest, + }); + + if (!Array.isArray(events)) { + const errStr = `Invalid events from ${staticUrl}/${zipName}`; + throw new Error(errStr); + } + + return { + events, + lastBlock: events[events.length - 1]?.blockNumber || deployedBlock, + fromCache: true, + }; + } catch (err) { + console.log('Method loadRemoteEvents has error'); + console.log(err); + + return { + events: [], + lastBlock: deployedBlock, + fromCache: true, + }; + } +} + +export interface DBTornadoServiceConstructor extends BaseTornadoServiceConstructor { + staticUrl: string; + idb: IndexedDB; +} + +export class DBTornadoService extends BaseTornadoService { + staticUrl: string; + idb: IndexedDB; + + zipDigest?: string; + + constructor(params: DBTornadoServiceConstructor) { + super(params); + + this.staticUrl = params.staticUrl; + this.idb = params.idb; + } + + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + }); + } + + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest, + }); + } + + async saveEvents({ events, lastBlock }: BaseEvents) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock, + }); + } +} + +export interface DBEchoServiceConstructor extends BaseEchoServiceConstructor { + staticUrl: string; + idb: IndexedDB; +} + +export class DBEchoService extends BaseEchoService { + staticUrl: string; + idb: IndexedDB; + + zipDigest?: string; + + constructor(params: DBEchoServiceConstructor) { + super(params); + + this.staticUrl = params.staticUrl; + this.idb = params.idb; + } + + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + }); + } + + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest, + }); + } + + async saveEvents({ events, lastBlock }: BaseEvents) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock, + }); + } +} + +export interface DBEncryptedNotesServiceConstructor extends BaseEncryptedNotesServiceConstructor { + staticUrl: string; + idb: IndexedDB; +} + +export class DBEncryptedNotesService extends BaseEncryptedNotesService { + staticUrl: string; + idb: IndexedDB; + + zipDigest?: string; + + constructor(params: DBEncryptedNotesServiceConstructor) { + super(params); + + this.staticUrl = params.staticUrl; + this.idb = params.idb; + } + + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + }); + } + + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest, + }); + } + + async saveEvents({ events, lastBlock }: BaseEvents) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock, + }); + } +} + +export interface DBGovernanceServiceConstructor extends BaseGovernanceServiceConstructor { + staticUrl: string; + idb: IndexedDB; +} + +export class DBGovernanceService extends BaseGovernanceService { + staticUrl: string; + idb: IndexedDB; + + zipDigest?: string; + + constructor(params: DBGovernanceServiceConstructor) { + super(params); + + this.staticUrl = params.staticUrl; + this.idb = params.idb; + } + + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + }); + } + + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest, + }); + } + + async saveEvents({ events, lastBlock }: BaseEvents) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock, + }); + } +} + +export interface DBRegistryServiceConstructor extends BaseRegistryServiceConstructor { + staticUrl: string; + idb: IndexedDB; +} + +export class DBRegistryService extends BaseRegistryService { + staticUrl: string; + idb: IndexedDB; + + zipDigest?: string; + relayerJsonDigest?: string; + + constructor(params: DBRegistryServiceConstructor) { + super(params); + + this.staticUrl = params.staticUrl; + this.idb = params.idb; + } + + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + }); + } + + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest, + }); + } + + async saveEvents({ events, lastBlock }: BaseEvents) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock, + }); + } + + async getRelayersFromDB(): Promise { + try { + const allCachedRelayers = await this.idb.getAll({ + storeName: `relayers_${this.netId}`, + }); + + if (!allCachedRelayers?.length) { + return { + lastBlock: 0, + timestamp: 0, + relayers: [], + }; + } + + return allCachedRelayers.slice(-1)[0]; + } catch (err) { + console.log('Method getRelayersFromDB has error'); + console.log(err); + + return { + lastBlock: 0, + timestamp: 0, + relayers: [], + }; + } + } + + async getRelayersFromCache(): Promise { + const url = `${this.staticUrl}/relayers.json`; + + try { + const resp = await fetchData(url, { + method: 'GET', + returnResponse: true, + }); + + const data = new Uint8Array(await resp.arrayBuffer()); + + if (this.relayerJsonDigest) { + const hash = 'sha384-' + bytesToBase64(await digest(data)); + + if (hash !== this.relayerJsonDigest) { + const errMsg = `Invalid digest hash for ${url}, wants ${this.relayerJsonDigest} has ${hash}`; + throw new Error(errMsg); + } + } + + return JSON.parse(new TextDecoder().decode(data)) as CachedRelayers; + } catch (err) { + console.log('Method getRelayersFromCache has error'); + console.log(err); + + return { + lastBlock: 0, + timestamp: 0, + relayers: [], + }; + } + } + + async saveRelayers(cachedRelayers: CachedRelayers): Promise { + try { + await this.idb.putItem({ + data: cachedRelayers, + storeName: `relayers_${this.netId}`, + }); + } catch (err) { + console.log('Method saveRelayers has error'); + console.log(err); + } + } +} + +export interface DBRevenueServiceConstructor extends BaseRevenueServiceConstructor { + staticUrl: string; + idb: IndexedDB; +} + +export class DBRevenueService extends BaseRevenueService { + staticUrl: string; + idb: IndexedDB; + + zipDigest?: string; + relayerJsonDigest?: string; + + constructor(params: DBRevenueServiceConstructor) { + super(params); + + this.staticUrl = params.staticUrl; + this.idb = params.idb; + } + + async getEventsFromDB() { + return await loadDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + }); + } + + async getEventsFromCache() { + return await loadRemoteEvents({ + staticUrl: this.staticUrl, + instanceName: this.getInstanceName(), + deployedBlock: this.deployedBlock, + zipDigest: this.zipDigest, + }); + } + + async saveEvents({ events, lastBlock }: BaseEvents) { + await saveDBEvents({ + idb: this.idb, + instanceName: this.getInstanceName(), + events, + lastBlock, + }); + } +} diff --git a/src/events/index.ts b/src/events/index.ts index 63fa69b..77219eb 100644 --- a/src/events/index.ts +++ b/src/events/index.ts @@ -1,2 +1,3 @@ export * from './types'; export * from './base'; +export * from './db'; diff --git a/src/events/types.ts b/src/events/types.ts index 3a2ed69..0125269 100644 --- a/src/events/types.ts +++ b/src/events/types.ts @@ -1,80 +1,134 @@ import { RelayerParams } from '../relayerClient'; export interface BaseEvents { - events: T[]; - lastBlock: number | null; + events: T[]; + lastBlock: number; +} + +export interface CachedEvents extends BaseEvents { + fromCache: boolean; } export interface BaseGraphEvents { - events: T[]; - lastSyncBlock: number; + events: T[]; + lastSyncBlock: number; } export interface MinimalEvents { - blockNumber: number; - logIndex: number; - transactionHash: string; + blockNumber: number; + logIndex: number; + transactionHash: string; } -export type GovernanceEvents = MinimalEvents & { - event: string; -}; +export interface GovernanceEvents extends MinimalEvents { + event: string; +} -export type GovernanceProposalCreatedEvents = GovernanceEvents & { - id: number; - proposer: string; - target: string; - startTime: number; - endTime: number; - description: string; -}; +export interface GovernanceProposalCreatedEvents extends GovernanceEvents { + id: number; + proposer: string; + target: string; + startTime: number; + endTime: number; + description: string; +} -export type GovernanceVotedEvents = GovernanceEvents & { - proposalId: number; - voter: string; - support: boolean; - votes: string; - from: string; - input: string; -}; +export interface GovernanceVotedEvents extends GovernanceEvents { + proposalId: number; + voter: string; + support: boolean; + votes: string; + from: string; + input: string; +} -export type GovernanceDelegatedEvents = GovernanceEvents & { - account: string; - delegateTo: string; -}; +export interface GovernanceDelegatedEvents extends GovernanceEvents { + account: string; + delegateTo: string; +} -export type GovernanceUndelegatedEvents = GovernanceEvents & { - account: string; - delegateFrom: string; -}; +export interface GovernanceUndelegatedEvents extends GovernanceEvents { + account: string; + delegateFrom: string; +} export type AllGovernanceEvents = - | GovernanceProposalCreatedEvents - | GovernanceVotedEvents - | GovernanceDelegatedEvents - | GovernanceUndelegatedEvents; + | GovernanceProposalCreatedEvents + | GovernanceVotedEvents + | GovernanceDelegatedEvents + | GovernanceUndelegatedEvents; +export interface RelayerRegistryEvents extends MinimalEvents { + event: string; +} + +export interface RelayerRegisteredEvents extends RelayerRegistryEvents, RelayerParams { + ensHash: string; + stakedAmount: string; +} + +export interface RelayerUnregisteredEvents extends RelayerRegistryEvents { + relayerAddress: string; +} + +export interface WorkerRegisteredEvents extends RelayerRegistryEvents { + relayerAddress: string; + workerAddress: string; +} + +export interface WorkerUnregisteredEvents extends RelayerRegistryEvents { + relayerAddress: string; + workerAddress: string; +} + +export type AllRelayerRegistryEvents = + | RelayerRegisteredEvents + | RelayerUnregisteredEvents + | WorkerRegisteredEvents + | WorkerUnregisteredEvents; + +export interface StakeBurnedEvents extends MinimalEvents { + relayerAddress: string; + amountBurned: string; + instanceAddress: string; + gasFee: string; + relayerFee: string; + timestamp: number; +} + +// Deprecated type export type RegistersEvents = MinimalEvents & RelayerParams; -export type DepositsEvents = MinimalEvents & { - commitment: string; - leafIndex: number; - timestamp: number; - from: string; -}; +export interface DepositsEvents extends MinimalEvents { + commitment: string; + leafIndex: number; + timestamp: number; + from: string; +} -export type WithdrawalsEvents = MinimalEvents & { - nullifierHash: string; - to: string; - fee: string; - timestamp: number; -}; +export interface WithdrawalsEvents extends MinimalEvents { + nullifierHash: string; + to: string; + fee: string; + timestamp: number; +} -export type EchoEvents = MinimalEvents & { - address: string; - encryptedAccount: string; -}; +export interface BaseMultiTornadoEvents { + event: string; + instanceAddress: string; +} -export type EncryptedNotesEvents = MinimalEvents & { - encryptedNote: string; -}; +export interface MultiDepositsEvents extends BaseMultiTornadoEvents, DepositsEvents {} + +export interface MultiWithdrawalsEvents extends BaseMultiTornadoEvents, WithdrawalsEvents { + relayerAddress: string; +} + +export interface EchoEvents extends MinimalEvents { + address: string; + encryptedAccount: string; +} + +export interface EncryptedNotesEvents extends MinimalEvents { + encryptedNote: string; +} diff --git a/src/fees.ts b/src/fees.ts index 5cd5187..82ac49a 100644 --- a/src/fees.ts +++ b/src/fees.ts @@ -1,13 +1,13 @@ import { Transaction, parseUnits } from 'ethers'; -import type { BigNumberish, TransactionLike } from 'ethers'; +import type { BigNumberish, JsonRpcApiProvider, TransactionLike } from 'ethers'; import { OvmGasPriceOracle } from './typechain'; const DUMMY_ADDRESS = '0x1111111111111111111111111111111111111111'; -const DUMMY_NONCE = '0x1111111111111111111111111111111111111111111111111111111111111111'; +const DUMMY_NONCE = 1024; const DUMMY_WITHDRAW_DATA = - '0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111'; + '0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111'; /** * Example: @@ -15,110 +15,141 @@ const DUMMY_WITHDRAW_DATA = * amountInWei (0.1 ETH) * tokenDecimals (18) * tokenPriceInWei (0.0008) = 125 TOKEN */ export function convertETHToTokenAmount( - amountInWei: BigNumberish, - tokenPriceInWei: BigNumberish, - tokenDecimals: number = 18, + amountInWei: BigNumberish, + tokenPriceInWei: BigNumberish, + tokenDecimals: number = 18, ): bigint { - const tokenDecimalsMultiplier = BigInt(10 ** Number(tokenDecimals)); - return (BigInt(amountInWei) * tokenDecimalsMultiplier) / BigInt(tokenPriceInWei); + const tokenDecimalsMultiplier = BigInt(10 ** Number(tokenDecimals)); + return (BigInt(amountInWei) * tokenDecimalsMultiplier) / BigInt(tokenPriceInWei); } export interface RelayerFeeParams { - gasPrice: BigNumberish; - gasLimit?: BigNumberish; - l1Fee?: BigNumberish; - denomination: BigNumberish; - ethRefund: BigNumberish; - tokenPriceInWei: BigNumberish; - tokenDecimals: number; - relayerFeePercent?: number; - isEth?: boolean; - premiumPercent?: number; + gasPrice: BigNumberish; + gasLimit?: BigNumberish; + l1Fee?: BigNumberish; + denomination: BigNumberish; + ethRefund: BigNumberish; + tokenPriceInWei: BigNumberish; + tokenDecimals: number; + relayerFeePercent?: number; + isEth?: boolean; + premiumPercent?: number; } export class TornadoFeeOracle { - ovmGasPriceOracle?: OvmGasPriceOracle; + provider: JsonRpcApiProvider; + ovmGasPriceOracle?: OvmGasPriceOracle; - constructor(ovmGasPriceOracle?: OvmGasPriceOracle) { - if (ovmGasPriceOracle) { - this.ovmGasPriceOracle = ovmGasPriceOracle; - } - } + constructor(provider: JsonRpcApiProvider, ovmGasPriceOracle?: OvmGasPriceOracle) { + this.provider = provider; - /** - * Calculate L1 fee for op-stack chains - * - * This is required since relayers would pay the full transaction fees for users - */ - fetchL1OptimismFee(tx?: TransactionLike): Promise { - if (!this.ovmGasPriceOracle) { - return new Promise((resolve) => resolve(BigInt(0))); + if (ovmGasPriceOracle) { + this.ovmGasPriceOracle = ovmGasPriceOracle; + } } - if (!tx) { - // this tx is only used to simulate bytes size of the encoded tx so has nothing to with the accuracy - // inspired by the old style classic-ui calculation - tx = { - type: 0, - gasLimit: 1_000_000, - nonce: Number(DUMMY_NONCE), - data: DUMMY_WITHDRAW_DATA, - gasPrice: parseUnits('1', 'gwei'), - from: DUMMY_ADDRESS, - to: DUMMY_ADDRESS, - }; + /** + * Calculates Gas Price + * We apply 50% premium of EIP-1559 network fees instead of 100% from ethers.js + * (This should cover up to 4 full blocks which is equivalent of minute) + * (A single block can bump 12.5% of fees, see the methodology https://hackmd.io/@tvanepps/1559-wallets) + * (Still it is recommended to use 100% premium for sending transactions to prevent stucking it) + */ + async gasPrice() { + const [block, getGasPrice, getPriorityFee] = await Promise.all([ + this.provider.getBlock('latest'), + (async () => { + try { + return BigInt(await this.provider.send('eth_gasPrice', [])); + } catch { + return parseUnits('1', 'gwei'); + } + })(), + (async () => { + try { + return BigInt(await this.provider.send('eth_maxPriorityFeePerGas', [])); + } catch { + return BigInt(0); + } + })(), + ]); + + return block?.baseFeePerGas ? (block.baseFeePerGas * BigInt(15)) / BigInt(10) + getPriorityFee : getGasPrice; } - return this.ovmGasPriceOracle.getL1Fee.staticCall(Transaction.from(tx).unsignedSerialized); - } + /** + * Calculate L1 fee for op-stack chains + * + * This is required since relayers would pay the full transaction fees for users + */ + fetchL1OptimismFee(tx?: TransactionLike): Promise { + if (!this.ovmGasPriceOracle) { + return new Promise((resolve) => resolve(BigInt(0))); + } - /** - * We don't need to distinguish default refunds by tokens since most users interact with other defi protocols after withdrawal - * So we default with 1M gas which is enough for two or three swaps - * Using 30 gwei for default but it is recommended to supply cached gasPrice value from the UI - */ - defaultEthRefund(gasPrice?: BigNumberish, gasLimit?: BigNumberish): bigint { - return (gasPrice ? BigInt(gasPrice) : parseUnits('30', 'gwei')) * BigInt(gasLimit || 1_000_000); - } + if (!tx) { + // this tx is only used to simulate bytes size of the encoded tx so has nothing to with the accuracy + // inspired by the old style classic-ui calculation + tx = { + type: 0, + gasLimit: 1_000_000, + nonce: DUMMY_NONCE, + data: DUMMY_WITHDRAW_DATA, + gasPrice: parseUnits('1', 'gwei'), + to: DUMMY_ADDRESS, + }; + } - /** - * Calculates token amount for required ethRefund purchases required to calculate fees - */ - calculateTokenAmount(ethRefund: BigNumberish, tokenPriceInEth: BigNumberish, tokenDecimals?: number): bigint { - return convertETHToTokenAmount(ethRefund, tokenPriceInEth, tokenDecimals); - } - - /** - * Warning: For tokens you need to check if the fees are above denomination - * (Usually happens for small denomination pool or if the gas price is high) - */ - calculateRelayerFee({ - gasPrice, - gasLimit = 600_000, - l1Fee = 0, - denomination, - ethRefund = BigInt(0), - tokenPriceInWei, - tokenDecimals = 18, - relayerFeePercent = 0.33, - isEth = true, - premiumPercent = 20, - }: RelayerFeeParams): bigint { - const gasCosts = BigInt(gasPrice) * BigInt(gasLimit) + BigInt(l1Fee); - - const relayerFee = (BigInt(denomination) * BigInt(Math.floor(10000 * relayerFeePercent))) / BigInt(10000 * 100); - - if (isEth) { - // Add 20% premium - return ((gasCosts + relayerFee) * BigInt(premiumPercent ? 100 + premiumPercent : 100)) / BigInt(100); + return this.ovmGasPriceOracle.getL1Fee.staticCall(Transaction.from(tx).unsignedSerialized); } - const feeInEth = gasCosts + BigInt(ethRefund); + /** + * We don't need to distinguish default refunds by tokens since most users interact with other defi protocols after withdrawal + * So we default with 1M gas which is enough for two or three swaps + * Using 30 gwei for default but it is recommended to supply cached gasPrice value from the UI + */ + defaultEthRefund(gasPrice?: BigNumberish, gasLimit?: BigNumberish): bigint { + return (gasPrice ? BigInt(gasPrice) : parseUnits('30', 'gwei')) * BigInt(gasLimit || 1_000_000); + } - return ( - ((convertETHToTokenAmount(feeInEth, tokenPriceInWei, tokenDecimals) + relayerFee) * - BigInt(premiumPercent ? 100 + premiumPercent : 100)) / - BigInt(100) - ); - } + /** + * Calculates token amount for required ethRefund purchases required to calculate fees + */ + calculateTokenAmount(ethRefund: BigNumberish, tokenPriceInEth: BigNumberish, tokenDecimals?: number): bigint { + return convertETHToTokenAmount(ethRefund, tokenPriceInEth, tokenDecimals); + } + + /** + * Warning: For tokens you need to check if the fees are above denomination + * (Usually happens for small denomination pool or if the gas price is high) + */ + calculateRelayerFee({ + gasPrice, + gasLimit = 600_000, + l1Fee = 0, + denomination, + ethRefund = BigInt(0), + tokenPriceInWei, + tokenDecimals = 18, + relayerFeePercent = 0.33, + isEth = true, + premiumPercent = 20, + }: RelayerFeeParams): bigint { + const gasCosts = BigInt(gasPrice) * BigInt(gasLimit) + BigInt(l1Fee); + + const relayerFee = (BigInt(denomination) * BigInt(Math.floor(10000 * relayerFeePercent))) / BigInt(10000 * 100); + + if (isEth) { + // Add 20% premium + return ((gasCosts + relayerFee) * BigInt(premiumPercent ? 100 + premiumPercent : 100)) / BigInt(100); + } + + const feeInEth = gasCosts + BigInt(ethRefund); + + return ( + ((convertETHToTokenAmount(feeInEth, tokenPriceInWei, tokenDecimals) + relayerFee) * + BigInt(premiumPercent ? 100 + premiumPercent : 100)) / + BigInt(100) + ); + } } diff --git a/src/gaszip.ts b/src/gaszip.ts new file mode 100644 index 0000000..588a28c --- /dev/null +++ b/src/gaszip.ts @@ -0,0 +1,54 @@ +import { isAddress } from 'ethers'; +import { NetId, NetIdType } from './networkConfig'; + +// https://dev.gas.zip/gas/chain-support/inbound +export const gasZipInbounds: { [key in NetIdType]: string } = { + [NetId.MAINNET]: '0x391E7C679d29bD940d63be94AD22A25d25b5A604', + [NetId.BSC]: '0x391E7C679d29bD940d63be94AD22A25d25b5A604', + [NetId.POLYGON]: '0x391E7C679d29bD940d63be94AD22A25d25b5A604', + [NetId.OPTIMISM]: '0x391E7C679d29bD940d63be94AD22A25d25b5A604', + [NetId.ARBITRUM]: '0x391E7C679d29bD940d63be94AD22A25d25b5A604', + [NetId.GNOSIS]: '0x391E7C679d29bD940d63be94AD22A25d25b5A604', + [NetId.AVALANCHE]: '0x391E7C679d29bD940d63be94AD22A25d25b5A604', +}; + +// https://dev.gas.zip/gas/chain-support/outbound +export const gasZipID: { [key in NetIdType]: number } = { + [NetId.MAINNET]: 255, + [NetId.BSC]: 14, + [NetId.POLYGON]: 17, + [NetId.OPTIMISM]: 55, + [NetId.ARBITRUM]: 57, + [NetId.GNOSIS]: 16, + [NetId.AVALANCHE]: 15, + [NetId.SEPOLIA]: 102, +}; + +// https://dev.gas.zip/gas/code-examples/eoaDeposit +export function gasZipInput(to: string, shorts: number[]): string | null { + let data = '0x'; + if (isAddress(to)) { + if (to.length === 42) { + data += '02'; + data += to.slice(2); + } else { + return null; + } + } else { + data += '01'; // to == sender + } + + for (const i in shorts) { + data += Number(shorts[i]).toString(16).padStart(4, '0'); + } + + return data; +} + +export function gasZipMinMax(ethUsd: number) { + return { + min: 1 / ethUsd, + max: 50 / ethUsd, + ethUsd, + }; +} diff --git a/src/graphql/index.ts b/src/graphql/index.ts index e5c9454..7058aef 100644 --- a/src/graphql/index.ts +++ b/src/graphql/index.ts @@ -1,30 +1,29 @@ -import { getAddress } from 'ethers'; +import { ContractEventName, getAddress } from 'ethers'; import { fetchData, fetchDataOptions } from '../providers'; import type { - BaseGraphEvents, - RegistersEvents, - DepositsEvents, - WithdrawalsEvents, - EncryptedNotesEvents, - BatchGraphOnProgress, - EchoEvents, - AllGovernanceEvents, - GovernanceProposalCreatedEvents, - GovernanceVotedEvents, - GovernanceDelegatedEvents, - GovernanceUndelegatedEvents, + BaseGraphEvents, + RegistersEvents, + DepositsEvents, + WithdrawalsEvents, + EncryptedNotesEvents, + EchoEvents, + AllGovernanceEvents, + GovernanceProposalCreatedEvents, + GovernanceVotedEvents, + GovernanceDelegatedEvents, + GovernanceUndelegatedEvents, } from '../events'; import { - _META, - GET_DEPOSITS, - GET_STATISTIC, - GET_REGISTERED, - GET_WITHDRAWALS, - GET_NOTE_ACCOUNTS, - GET_ENCRYPTED_NOTES, - GET_ECHO_EVENTS, - GET_GOVERNANCE_EVENTS, + _META, + GET_DEPOSITS, + GET_STATISTIC, + GET_REGISTERED, + GET_WITHDRAWALS, + GET_NOTE_ACCOUNTS, + GET_ENCRYPTED_NOTES, + GET_ECHO_EVENTS, + GET_GOVERNANCE_EVENTS, } from './queries'; export * from './queries'; @@ -34,1106 +33,1168 @@ const isEmptyArray = (arr: object) => !Array.isArray(arr) || !arr.length; // https://thegraph.com/docs/en/developing/developer-faqs/#23-is-there-a-limit-to-how-many-objects-the-graph-can-return-per-query const GRAPHQL_LIMIT = 1000; -export type queryGraphParams = { - graphApi: string; - subgraphName: string; - query: string; - variables?: { - [key: string]: string | number; - }; - fetchDataOptions?: fetchDataOptions; -}; +export type BatchGraphOnProgress = ({ + type, + fromBlock, + toBlock, + count, +}: { + type?: ContractEventName; + fromBlock?: number; + toBlock?: number; + count?: number; +}) => void; + +export interface queryGraphParams { + graphApi: string; + subgraphName: string; + query: string; + variables?: { + [key: string]: string | number; + }; + fetchDataOptions?: fetchDataOptions; +} export async function queryGraph({ - graphApi, - subgraphName, - query, - variables, - fetchDataOptions, + graphApi, + subgraphName, + query, + variables, + fetchDataOptions, }: queryGraphParams): Promise { - const graphUrl = `${graphApi}/subgraphs/name/${subgraphName}`; + const graphUrl = `${graphApi}/subgraphs/name/${subgraphName}`; - const { data, errors } = await fetchData(graphUrl, { - ...fetchDataOptions, - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ - query, - variables, - }), - }); + const { data, errors } = await fetchData(graphUrl, { + ...fetchDataOptions, + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + query, + variables, + }), + }); - if (errors) { - throw new Error(JSON.stringify(errors)); - } + if (errors) { + throw new Error(JSON.stringify(errors)); + } - if (data?._meta?.hasIndexingErrors) { - throw new Error('Subgraph has indexing errors'); - } + if (data?._meta?.hasIndexingErrors) { + throw new Error('Subgraph has indexing errors'); + } - return data; + return data; } export interface GraphStatistic { - deposits: { - index: string; - timestamp: string; - blockNumber: string; - }[]; - _meta: { - block: { - number: number; + deposits: { + index: string; + timestamp: string; + blockNumber: string; + }[]; + _meta: { + block: { + number: number; + }; + hasIndexingErrors: boolean; }; - hasIndexingErrors: boolean; - }; } export interface getStatisticParams { - graphApi: string; - subgraphName: string; - currency: string; - amount: string; - fetchDataOptions?: fetchDataOptions; + graphApi: string; + subgraphName: string; + currency: string; + amount: string; + fetchDataOptions?: fetchDataOptions; } export interface getStatisticReturns { - events: { - timestamp: number; - leafIndex: number; - blockNumber: number; - }[]; - lastSyncBlock: null | number; + events: { + timestamp: number; + leafIndex: number; + blockNumber: number; + }[]; + lastSyncBlock: null | number; } export async function getStatistic({ - graphApi, - subgraphName, - currency, - amount, - fetchDataOptions, + graphApi, + subgraphName, + currency, + amount, + fetchDataOptions, }: getStatisticParams): Promise { - try { - const { - deposits, - _meta: { - block: { number: lastSyncBlock }, - }, - } = await queryGraph({ - graphApi, - subgraphName, - query: GET_STATISTIC, - variables: { - currency, - first: 10, - orderBy: 'index', - orderDirection: 'desc', - amount, - }, - fetchDataOptions, - }); + try { + const { + deposits, + _meta: { + block: { number: lastSyncBlock }, + }, + } = await queryGraph({ + graphApi, + subgraphName, + query: GET_STATISTIC, + variables: { + currency, + first: 10, + orderBy: 'index', + orderDirection: 'desc', + amount, + }, + fetchDataOptions, + }); - const events = deposits - .map((e) => ({ - timestamp: Number(e.timestamp), - leafIndex: Number(e.index), - blockNumber: Number(e.blockNumber), - })) - .reverse(); + const events = deposits + .map((e) => ({ + timestamp: Number(e.timestamp), + leafIndex: Number(e.index), + blockNumber: Number(e.blockNumber), + })) + .reverse(); - const [lastEvent] = events.slice(-1); + const [lastEvent] = events.slice(-1); - return { - events, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock, - }; - } catch (err) { - console.log('Error from getStatistic query'); - console.log(err); - return { - events: [], - lastSyncBlock: null, - }; - } + return { + events, + lastSyncBlock: + lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock, + }; + } catch (err) { + console.log('Error from getStatistic query'); + console.log(err); + return { + events: [], + lastSyncBlock: null, + }; + } } export interface GraphMeta { - _meta: { - block: { - number: number; + _meta: { + block: { + number: number; + }; + hasIndexingErrors: boolean; }; - hasIndexingErrors: boolean; - }; } export interface getMetaParams { - graphApi: string; - subgraphName: string; - fetchDataOptions?: fetchDataOptions; + graphApi: string; + subgraphName: string; + fetchDataOptions?: fetchDataOptions; } export interface getMetaReturns { - lastSyncBlock: null | number; - hasIndexingErrors: null | boolean; + lastSyncBlock: null | number; + hasIndexingErrors: null | boolean; } export async function getMeta({ graphApi, subgraphName, fetchDataOptions }: getMetaParams): Promise { - try { - const { - _meta: { - block: { number: lastSyncBlock }, - hasIndexingErrors, - }, - } = await queryGraph({ - graphApi, - subgraphName, - query: _META, - fetchDataOptions, - }); + try { + const { + _meta: { + block: { number: lastSyncBlock }, + hasIndexingErrors, + }, + } = await queryGraph({ + graphApi, + subgraphName, + query: _META, + fetchDataOptions, + }); - return { - lastSyncBlock, - hasIndexingErrors, - }; - } catch (err) { - console.log('Error from getMeta query'); - console.log(err); - return { - lastSyncBlock: null, - hasIndexingErrors: null, - }; - } + return { + lastSyncBlock, + hasIndexingErrors, + }; + } catch (err) { + console.log('Error from getMeta query'); + console.log(err); + return { + lastSyncBlock: null, + hasIndexingErrors: null, + }; + } } export interface GraphRegisters { - relayers: { - id: string; - address: string; - ensName: string; - blockRegistration: string; - }[]; - _meta: { - block: { - number: number; + relayers: { + id: string; + address: string; + ensName: string; + blockRegistration: string; + }[]; + _meta: { + block: { + number: number; + }; + hasIndexingErrors: boolean; }; - hasIndexingErrors: boolean; - }; } export interface getRegistersParams { - graphApi: string; - subgraphName: string; - fromBlock: number; - fetchDataOptions?: fetchDataOptions; - onProgress?: BatchGraphOnProgress; + graphApi: string; + subgraphName: string; + fromBlock: number; + fetchDataOptions?: fetchDataOptions; + onProgress?: BatchGraphOnProgress; } export function getRegisters({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions, -}: getRegistersParams): Promise { - return queryGraph({ graphApi, subgraphName, - query: GET_REGISTERED, - variables: { - first: GRAPHQL_LIMIT, - fromBlock, - }, + fromBlock, fetchDataOptions, - }); +}: getRegistersParams): Promise { + return queryGraph({ + graphApi, + subgraphName, + query: GET_REGISTERED, + variables: { + first: GRAPHQL_LIMIT, + fromBlock, + }, + fetchDataOptions, + }); } export async function getAllRegisters({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions, - onProgress, + graphApi, + subgraphName, + fromBlock, + fetchDataOptions, + onProgress, }: getRegistersParams): Promise> { - try { - const events = []; - let lastSyncBlock = fromBlock; + try { + const events = []; + let lastSyncBlock = fromBlock; - // eslint-disable-next-line no-constant-condition - while (true) { - let { - relayers: result, - _meta: { - // eslint-disable-next-line prefer-const - block: { number: currentBlock }, - }, - } = await getRegisters({ graphApi, subgraphName, fromBlock, fetchDataOptions }); + // eslint-disable-next-line no-constant-condition + while (true) { + let { + relayers: result, + _meta: { + // eslint-disable-next-line prefer-const + block: { number: currentBlock }, + }, + } = await getRegisters({ + graphApi, + subgraphName, + fromBlock, + fetchDataOptions, + }); - lastSyncBlock = currentBlock; + lastSyncBlock = currentBlock; - if (isEmptyArray(result)) { - break; - } + if (isEmptyArray(result)) { + break; + } - const [firstEvent] = result; - const [lastEvent] = result.slice(-1); + const [firstEvent] = result; + const [lastEvent] = result.slice(-1); - if (typeof onProgress === 'function') { - onProgress({ - type: 'Registers', - fromBlock: Number(firstEvent.blockRegistration), - toBlock: Number(lastEvent.blockRegistration), - count: result.length, + if (typeof onProgress === 'function') { + onProgress({ + type: 'Registers', + fromBlock: Number(firstEvent.blockRegistration), + toBlock: Number(lastEvent.blockRegistration), + count: result.length, + }); + } + + if (result.length < 900) { + events.push(...result); + break; + } + + result = result.filter(({ blockRegistration }) => blockRegistration !== lastEvent.blockRegistration); + fromBlock = Number(lastEvent.blockRegistration); + + events.push(...result); + } + + if (!events.length) { + return { + events: [], + lastSyncBlock, + }; + } + + const result = events.map(({ id, address, ensName, blockRegistration }) => { + const [transactionHash, logIndex] = id.split('-'); + + return { + blockNumber: Number(blockRegistration), + logIndex: Number(logIndex), + transactionHash, + ensName, + relayerAddress: getAddress(address), + }; }); - } - if (result.length < 900) { - events.push(...result); - break; - } - - result = result.filter(({ blockRegistration }) => blockRegistration !== lastEvent.blockRegistration); - fromBlock = Number(lastEvent.blockRegistration); - - events.push(...result); + return { + events: result, + lastSyncBlock, + }; + } catch (err) { + console.log('Error from getAllRegisters query'); + console.log(err); + return { events: [], lastSyncBlock: fromBlock }; } - - if (!events.length) { - return { - events: [], - lastSyncBlock, - }; - } - - const result = events.map(({ id, address, ensName, blockRegistration }) => { - const [transactionHash, logIndex] = id.split('-'); - - return { - blockNumber: Number(blockRegistration), - logIndex: Number(logIndex), - transactionHash, - ensName, - relayerAddress: getAddress(address), - }; - }); - - return { - events: result, - lastSyncBlock, - }; - } catch (err) { - console.log('Error from getAllRegisters query'); - console.log(err); - return { events: [], lastSyncBlock: fromBlock }; - } } export interface GraphDeposits { - deposits: { - id: string; - blockNumber: string; - commitment: string; - index: string; - timestamp: string; - from: string; - }[]; - _meta: { - block: { - number: number; + deposits: { + id: string; + blockNumber: string; + commitment: string; + index: string; + timestamp: string; + from: string; + }[]; + _meta: { + block: { + number: number; + }; + hasIndexingErrors: boolean; }; - hasIndexingErrors: boolean; - }; } export interface getDepositsParams { - graphApi: string; - subgraphName: string; - currency: string; - amount: string; - fromBlock: number; - fetchDataOptions?: fetchDataOptions; - onProgress?: BatchGraphOnProgress; + graphApi: string; + subgraphName: string; + currency: string; + amount: string; + fromBlock: number; + fetchDataOptions?: fetchDataOptions; + onProgress?: BatchGraphOnProgress; } export function getDeposits({ - graphApi, - subgraphName, - currency, - amount, - fromBlock, - fetchDataOptions, -}: getDepositsParams): Promise { - return queryGraph({ graphApi, subgraphName, - query: GET_DEPOSITS, - variables: { - currency, - amount, - first: GRAPHQL_LIMIT, - fromBlock, - }, + currency, + amount, + fromBlock, fetchDataOptions, - }); +}: getDepositsParams): Promise { + return queryGraph({ + graphApi, + subgraphName, + query: GET_DEPOSITS, + variables: { + currency, + amount, + first: GRAPHQL_LIMIT, + fromBlock, + }, + fetchDataOptions, + }); } export async function getAllDeposits({ - graphApi, - subgraphName, - currency, - amount, - fromBlock, - fetchDataOptions, - onProgress, + graphApi, + subgraphName, + currency, + amount, + fromBlock, + fetchDataOptions, + onProgress, }: getDepositsParams): Promise> { - try { - const events = []; - let lastSyncBlock = fromBlock; + try { + const events = []; + let lastSyncBlock = fromBlock; - // eslint-disable-next-line no-constant-condition - while (true) { - let { - deposits: result, - _meta: { - // eslint-disable-next-line prefer-const - block: { number: currentBlock }, - }, - } = await getDeposits({ graphApi, subgraphName, currency, amount, fromBlock, fetchDataOptions }); + // eslint-disable-next-line no-constant-condition + while (true) { + let { + deposits: result, + _meta: { + // eslint-disable-next-line prefer-const + block: { number: currentBlock }, + }, + } = await getDeposits({ + graphApi, + subgraphName, + currency, + amount, + fromBlock, + fetchDataOptions, + }); - lastSyncBlock = currentBlock; + lastSyncBlock = currentBlock; - if (isEmptyArray(result)) { - break; - } + if (isEmptyArray(result)) { + break; + } - const [firstEvent] = result; - const [lastEvent] = result.slice(-1); + const [firstEvent] = result; + const [lastEvent] = result.slice(-1); - if (typeof onProgress === 'function') { - onProgress({ - type: 'Deposits', - fromBlock: Number(firstEvent.blockNumber), - toBlock: Number(lastEvent.blockNumber), - count: result.length, + if (typeof onProgress === 'function') { + onProgress({ + type: 'Deposits', + fromBlock: Number(firstEvent.blockNumber), + toBlock: Number(lastEvent.blockNumber), + count: result.length, + }); + } + + if (result.length < 900) { + events.push(...result); + break; + } + + result = result.filter(({ blockNumber }) => blockNumber !== lastEvent.blockNumber); + fromBlock = Number(lastEvent.blockNumber); + + events.push(...result); + } + + if (!events.length) { + return { + events: [], + lastSyncBlock, + }; + } + + const result = events.map(({ id, blockNumber, commitment, index, timestamp, from }) => { + const [transactionHash, logIndex] = id.split('-'); + + return { + blockNumber: Number(blockNumber), + logIndex: Number(logIndex), + transactionHash, + commitment, + leafIndex: Number(index), + timestamp: Number(timestamp), + from: getAddress(from), + }; }); - } - if (result.length < 900) { - events.push(...result); - break; - } + const [lastEvent] = result.slice(-1); - result = result.filter(({ blockNumber }) => blockNumber !== lastEvent.blockNumber); - fromBlock = Number(lastEvent.blockNumber); - - events.push(...result); + return { + events: result, + lastSyncBlock: + lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock, + }; + } catch (err) { + console.log('Error from getAllDeposits query'); + console.log(err); + return { + events: [], + lastSyncBlock: fromBlock, + }; } - - if (!events.length) { - return { - events: [], - lastSyncBlock, - }; - } - - const result = events.map(({ id, blockNumber, commitment, index, timestamp, from }) => { - const [transactionHash, logIndex] = id.split('-'); - - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - commitment, - leafIndex: Number(index), - timestamp: Number(timestamp), - from: getAddress(from), - }; - }); - - const [lastEvent] = result.slice(-1); - - return { - events: result, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock, - }; - } catch (err) { - console.log('Error from getAllDeposits query'); - console.log(err); - return { - events: [], - lastSyncBlock: fromBlock, - }; - } } export interface GraphWithdrawals { - withdrawals: { - id: string; - blockNumber: string; - nullifier: string; - to: string; - fee: string; - timestamp: string; - }[]; - _meta: { - block: { - number: number; + withdrawals: { + id: string; + blockNumber: string; + nullifier: string; + to: string; + fee: string; + timestamp: string; + }[]; + _meta: { + block: { + number: number; + }; + hasIndexingErrors: boolean; }; - hasIndexingErrors: boolean; - }; } export interface getWithdrawalParams { - graphApi: string; - subgraphName: string; - currency: string; - amount: string; - fromBlock: number; - fetchDataOptions?: fetchDataOptions; - onProgress?: BatchGraphOnProgress; + graphApi: string; + subgraphName: string; + currency: string; + amount: string; + fromBlock: number; + fetchDataOptions?: fetchDataOptions; + onProgress?: BatchGraphOnProgress; } export function getWithdrawals({ - graphApi, - subgraphName, - currency, - amount, - fromBlock, - fetchDataOptions, -}: getWithdrawalParams): Promise { - return queryGraph({ graphApi, subgraphName, - query: GET_WITHDRAWALS, - variables: { - currency, - amount, - first: GRAPHQL_LIMIT, - fromBlock, - }, + currency, + amount, + fromBlock, fetchDataOptions, - }); +}: getWithdrawalParams): Promise { + return queryGraph({ + graphApi, + subgraphName, + query: GET_WITHDRAWALS, + variables: { + currency, + amount, + first: GRAPHQL_LIMIT, + fromBlock, + }, + fetchDataOptions, + }); } export async function getAllWithdrawals({ - graphApi, - subgraphName, - currency, - amount, - fromBlock, - fetchDataOptions, - onProgress, + graphApi, + subgraphName, + currency, + amount, + fromBlock, + fetchDataOptions, + onProgress, }: getWithdrawalParams): Promise> { - try { - const events = []; - let lastSyncBlock = fromBlock; + try { + const events = []; + let lastSyncBlock = fromBlock; - // eslint-disable-next-line no-constant-condition - while (true) { - let { - withdrawals: result, - _meta: { - // eslint-disable-next-line prefer-const - block: { number: currentBlock }, - }, - } = await getWithdrawals({ graphApi, subgraphName, currency, amount, fromBlock, fetchDataOptions }); + // eslint-disable-next-line no-constant-condition + while (true) { + let { + withdrawals: result, + _meta: { + // eslint-disable-next-line prefer-const + block: { number: currentBlock }, + }, + } = await getWithdrawals({ + graphApi, + subgraphName, + currency, + amount, + fromBlock, + fetchDataOptions, + }); - lastSyncBlock = currentBlock; + lastSyncBlock = currentBlock; - if (isEmptyArray(result)) { - break; - } + if (isEmptyArray(result)) { + break; + } - const [firstEvent] = result; - const [lastEvent] = result.slice(-1); + const [firstEvent] = result; + const [lastEvent] = result.slice(-1); - if (typeof onProgress === 'function') { - onProgress({ - type: 'Withdrawals', - fromBlock: Number(firstEvent.blockNumber), - toBlock: Number(lastEvent.blockNumber), - count: result.length, + if (typeof onProgress === 'function') { + onProgress({ + type: 'Withdrawals', + fromBlock: Number(firstEvent.blockNumber), + toBlock: Number(lastEvent.blockNumber), + count: result.length, + }); + } + + if (result.length < 900) { + events.push(...result); + break; + } + + result = result.filter(({ blockNumber }) => blockNumber !== lastEvent.blockNumber); + fromBlock = Number(lastEvent.blockNumber); + + events.push(...result); + } + + if (!events.length) { + return { + events: [], + lastSyncBlock, + }; + } + + const result = events.map(({ id, blockNumber, nullifier, to, fee, timestamp }) => { + const [transactionHash, logIndex] = id.split('-'); + + return { + blockNumber: Number(blockNumber), + logIndex: Number(logIndex), + transactionHash, + nullifierHash: nullifier, + to: getAddress(to), + fee, + timestamp: Number(timestamp), + }; }); - } - if (result.length < 900) { - events.push(...result); - break; - } + const [lastEvent] = result.slice(-1); - result = result.filter(({ blockNumber }) => blockNumber !== lastEvent.blockNumber); - fromBlock = Number(lastEvent.blockNumber); - - events.push(...result); + return { + events: result, + lastSyncBlock: + lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock, + }; + } catch (err) { + console.log('Error from getAllWithdrawals query'); + console.log(err); + return { + events: [], + lastSyncBlock: fromBlock, + }; } - - if (!events.length) { - return { - events: [], - lastSyncBlock, - }; - } - - const result = events.map(({ id, blockNumber, nullifier, to, fee, timestamp }) => { - const [transactionHash, logIndex] = id.split('-'); - - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - nullifierHash: nullifier, - to: getAddress(to), - fee, - timestamp: Number(timestamp), - }; - }); - - const [lastEvent] = result.slice(-1); - - return { - events: result, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock, - }; - } catch (err) { - console.log('Error from getAllWithdrawals query'); - console.log(err); - return { - events: [], - lastSyncBlock: fromBlock, - }; - } } export interface GraphNoteAccounts { - noteAccounts: { - id: string; - index: string; - address: string; - encryptedAccount: string; - }[]; - _meta: { - block: { - number: number; + noteAccounts: { + id: string; + index: string; + address: string; + encryptedAccount: string; + }[]; + _meta: { + block: { + number: number; + }; + hasIndexingErrors: boolean; }; - hasIndexingErrors: boolean; - }; } export interface getNoteAccountsParams { - graphApi: string; - subgraphName: string; - address: string; - fetchDataOptions?: fetchDataOptions; + graphApi: string; + subgraphName: string; + address: string; + fetchDataOptions?: fetchDataOptions; } export interface getNoteAccountsReturns { - events: { - id: string; - index: string; - address: string; - encryptedAccount: string; - }[]; - lastSyncBlock: null | number; + events: { + id: string; + index: string; + address: string; + encryptedAccount: string; + }[]; + lastSyncBlock: null | number; } export async function getNoteAccounts({ - graphApi, - subgraphName, - address, - fetchDataOptions, + graphApi, + subgraphName, + address, + fetchDataOptions, }: getNoteAccountsParams): Promise { - try { - const { - noteAccounts: events, - _meta: { - block: { number: lastSyncBlock }, - }, - } = await queryGraph({ - graphApi, - subgraphName, - query: GET_NOTE_ACCOUNTS, - variables: { - address: address.toLowerCase(), - }, - fetchDataOptions, - }); + try { + const { + noteAccounts: events, + _meta: { + block: { number: lastSyncBlock }, + }, + } = await queryGraph({ + graphApi, + subgraphName, + query: GET_NOTE_ACCOUNTS, + variables: { + address: address.toLowerCase(), + }, + fetchDataOptions, + }); - return { - events, - lastSyncBlock, - }; - } catch (err) { - console.log('Error from getNoteAccounts query'); - console.log(err); - return { - events: [], - lastSyncBlock: null, - }; - } + return { + events, + lastSyncBlock, + }; + } catch (err) { + console.log('Error from getNoteAccounts query'); + console.log(err); + return { + events: [], + lastSyncBlock: null, + }; + } } export interface GraphEchoEvents { - noteAccounts: { - id: string; - blockNumber: string; - address: string; - encryptedAccount: string; - }[]; - _meta: { - block: { - number: number; + noteAccounts: { + id: string; + blockNumber: string; + address: string; + encryptedAccount: string; + }[]; + _meta: { + block: { + number: number; + }; + hasIndexingErrors: boolean; }; - hasIndexingErrors: boolean; - }; } export interface getGraphEchoEventsParams { - graphApi: string; - subgraphName: string; - fromBlock: number; - fetchDataOptions?: fetchDataOptions; - onProgress?: BatchGraphOnProgress; + graphApi: string; + subgraphName: string; + fromBlock: number; + fetchDataOptions?: fetchDataOptions; + onProgress?: BatchGraphOnProgress; } export function getGraphEchoEvents({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions, -}: getGraphEchoEventsParams): Promise { - return queryGraph({ graphApi, subgraphName, - query: GET_ECHO_EVENTS, - variables: { - first: GRAPHQL_LIMIT, - fromBlock, - }, + fromBlock, fetchDataOptions, - }); +}: getGraphEchoEventsParams): Promise { + return queryGraph({ + graphApi, + subgraphName, + query: GET_ECHO_EVENTS, + variables: { + first: GRAPHQL_LIMIT, + fromBlock, + }, + fetchDataOptions, + }); } export async function getAllGraphEchoEvents({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions, - onProgress, + graphApi, + subgraphName, + fromBlock, + fetchDataOptions, + onProgress, }: getGraphEchoEventsParams): Promise> { - try { - const events = []; - let lastSyncBlock = fromBlock; + try { + const events = []; + let lastSyncBlock = fromBlock; - // eslint-disable-next-line no-constant-condition - while (true) { - let { - noteAccounts: result, - _meta: { - // eslint-disable-next-line prefer-const - block: { number: currentBlock }, - }, - } = await getGraphEchoEvents({ graphApi, subgraphName, fromBlock, fetchDataOptions }); + // eslint-disable-next-line no-constant-condition + while (true) { + let { + noteAccounts: result, + _meta: { + // eslint-disable-next-line prefer-const + block: { number: currentBlock }, + }, + } = await getGraphEchoEvents({ + graphApi, + subgraphName, + fromBlock, + fetchDataOptions, + }); - lastSyncBlock = currentBlock; + lastSyncBlock = currentBlock; - if (isEmptyArray(result)) { - break; - } + if (isEmptyArray(result)) { + break; + } - const [firstEvent] = result; - const [lastEvent] = result.slice(-1); + const [firstEvent] = result; + const [lastEvent] = result.slice(-1); - if (typeof onProgress === 'function') { - onProgress({ - type: 'EchoEvents', - fromBlock: Number(firstEvent.blockNumber), - toBlock: Number(lastEvent.blockNumber), - count: result.length, + if (typeof onProgress === 'function') { + onProgress({ + type: 'EchoEvents', + fromBlock: Number(firstEvent.blockNumber), + toBlock: Number(lastEvent.blockNumber), + count: result.length, + }); + } + + if (result.length < 900) { + events.push(...result); + break; + } + + result = result.filter(({ blockNumber }) => blockNumber !== lastEvent.blockNumber); + fromBlock = Number(lastEvent.blockNumber); + + events.push(...result); + } + + if (!events.length) { + return { + events: [], + lastSyncBlock, + }; + } + + const result = events.map((e) => { + const [transactionHash, logIndex] = e.id.split('-'); + + return { + blockNumber: Number(e.blockNumber), + logIndex: Number(logIndex), + transactionHash: transactionHash, + address: getAddress(e.address), + encryptedAccount: e.encryptedAccount, + }; }); - } - if (result.length < 900) { - events.push(...result); - break; - } + const [lastEvent] = result.slice(-1); - result = result.filter(({ blockNumber }) => blockNumber !== lastEvent.blockNumber); - fromBlock = Number(lastEvent.blockNumber); - - events.push(...result); + return { + events: result, + lastSyncBlock: + lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock, + }; + } catch (err) { + console.log('Error from getAllGraphEchoEvents query'); + console.log(err); + return { + events: [], + lastSyncBlock: fromBlock, + }; } - - if (!events.length) { - return { - events: [], - lastSyncBlock, - }; - } - - const result = events.map((e) => { - const [transactionHash, logIndex] = e.id.split('-'); - - return { - blockNumber: Number(e.blockNumber), - logIndex: Number(logIndex), - transactionHash: transactionHash, - address: getAddress(e.address), - encryptedAccount: e.encryptedAccount, - }; - }); - - const [lastEvent] = result.slice(-1); - - return { - events: result, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock, - }; - } catch (err) { - console.log('Error from getAllGraphEchoEvents query'); - console.log(err); - return { - events: [], - lastSyncBlock: fromBlock, - }; - } } export interface GraphEncryptedNotes { - encryptedNotes: { - blockNumber: string; - index: string; - transactionHash: string; - encryptedNote: string; - }[]; - _meta: { - block: { - number: number; + encryptedNotes: { + blockNumber: string; + index: string; + transactionHash: string; + encryptedNote: string; + }[]; + _meta: { + block: { + number: number; + }; + hasIndexingErrors: boolean; }; - hasIndexingErrors: boolean; - }; } export interface getEncryptedNotesParams { - graphApi: string; - subgraphName: string; - fromBlock: number; - fetchDataOptions?: fetchDataOptions; - onProgress?: BatchGraphOnProgress; + graphApi: string; + subgraphName: string; + fromBlock: number; + fetchDataOptions?: fetchDataOptions; + onProgress?: BatchGraphOnProgress; } export function getEncryptedNotes({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions, -}: getEncryptedNotesParams): Promise { - return queryGraph({ graphApi, subgraphName, - query: GET_ENCRYPTED_NOTES, - variables: { - first: GRAPHQL_LIMIT, - fromBlock, - }, + fromBlock, fetchDataOptions, - }); +}: getEncryptedNotesParams): Promise { + return queryGraph({ + graphApi, + subgraphName, + query: GET_ENCRYPTED_NOTES, + variables: { + first: GRAPHQL_LIMIT, + fromBlock, + }, + fetchDataOptions, + }); } export async function getAllEncryptedNotes({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions, - onProgress, + graphApi, + subgraphName, + fromBlock, + fetchDataOptions, + onProgress, }: getEncryptedNotesParams): Promise> { - try { - const events = []; - let lastSyncBlock = fromBlock; + try { + const events = []; + let lastSyncBlock = fromBlock; - // eslint-disable-next-line no-constant-condition - while (true) { - let { - encryptedNotes: result, - _meta: { - // eslint-disable-next-line prefer-const - block: { number: currentBlock }, - }, - } = await getEncryptedNotes({ graphApi, subgraphName, fromBlock, fetchDataOptions }); + // eslint-disable-next-line no-constant-condition + while (true) { + let { + encryptedNotes: result, + _meta: { + // eslint-disable-next-line prefer-const + block: { number: currentBlock }, + }, + } = await getEncryptedNotes({ + graphApi, + subgraphName, + fromBlock, + fetchDataOptions, + }); - lastSyncBlock = currentBlock; + lastSyncBlock = currentBlock; - if (isEmptyArray(result)) { - break; - } + if (isEmptyArray(result)) { + break; + } - const [firstEvent] = result; - const [lastEvent] = result.slice(-1); + const [firstEvent] = result; + const [lastEvent] = result.slice(-1); - if (typeof onProgress === 'function') { - onProgress({ - type: 'EncryptedNotes', - fromBlock: Number(firstEvent.blockNumber), - toBlock: Number(lastEvent.blockNumber), - count: result.length, - }); - } + if (typeof onProgress === 'function') { + onProgress({ + type: 'EncryptedNotes', + fromBlock: Number(firstEvent.blockNumber), + toBlock: Number(lastEvent.blockNumber), + count: result.length, + }); + } - if (result.length < 900) { - events.push(...result); - break; - } + if (result.length < 900) { + events.push(...result); + break; + } - result = result.filter(({ blockNumber }) => blockNumber !== lastEvent.blockNumber); - fromBlock = Number(lastEvent.blockNumber); + result = result.filter(({ blockNumber }) => blockNumber !== lastEvent.blockNumber); + fromBlock = Number(lastEvent.blockNumber); - events.push(...result); + events.push(...result); + } + + if (!events.length) { + return { + events: [], + lastSyncBlock, + }; + } + + const result = events.map((e) => ({ + blockNumber: Number(e.blockNumber), + logIndex: Number(e.index), + transactionHash: e.transactionHash, + encryptedNote: e.encryptedNote, + })); + + const [lastEvent] = result.slice(-1); + + return { + events: result, + lastSyncBlock: + lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock, + }; + } catch (err) { + console.log('Error from getAllEncryptedNotes query'); + console.log(err); + return { + events: [], + lastSyncBlock: fromBlock, + }; } - - if (!events.length) { - return { - events: [], - lastSyncBlock, - }; - } - - const result = events.map((e) => ({ - blockNumber: Number(e.blockNumber), - logIndex: Number(e.index), - transactionHash: e.transactionHash, - encryptedNote: e.encryptedNote, - })); - - const [lastEvent] = result.slice(-1); - - return { - events: result, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock, - }; - } catch (err) { - console.log('Error from getAllEncryptedNotes query'); - console.log(err); - return { - events: [], - lastSyncBlock: fromBlock, - }; - } } export interface GraphGovernanceEvents { - proposals: { - blockNumber: number; - logIndex: number; - transactionHash: string; - proposalId: number; - proposer: string; - target: string; - startTime: number; - endTime: number; - description: string; - }[]; - votes: { - blockNumber: number; - logIndex: number; - transactionHash: string; - proposalId: number; - voter: string; - support: boolean; - votes: string; - from: string; - input: string; - }[]; - delegates: { - blockNumber: number; - logIndex: number; - transactionHash: string; - account: string; - delegateTo: string; - }[]; - undelegates: { - blockNumber: number; - logIndex: number; - transactionHash: string; - account: string; - delegateFrom: string; - }[]; - _meta: { - block: { - number: number; + proposals: { + blockNumber: number; + logIndex: number; + transactionHash: string; + proposalId: number; + proposer: string; + target: string; + startTime: number; + endTime: number; + description: string; + }[]; + votes: { + blockNumber: number; + logIndex: number; + transactionHash: string; + proposalId: number; + voter: string; + support: boolean; + votes: string; + from: string; + input: string; + }[]; + delegates: { + blockNumber: number; + logIndex: number; + transactionHash: string; + account: string; + delegateTo: string; + }[]; + undelegates: { + blockNumber: number; + logIndex: number; + transactionHash: string; + account: string; + delegateFrom: string; + }[]; + _meta: { + block: { + number: number; + }; + hasIndexingErrors: boolean; }; - hasIndexingErrors: boolean; - }; } export interface getGovernanceEventsParams { - graphApi: string; - subgraphName: string; - fromBlock: number; - fetchDataOptions?: fetchDataOptions; - onProgress?: BatchGraphOnProgress; + graphApi: string; + subgraphName: string; + fromBlock: number; + fetchDataOptions?: fetchDataOptions; + onProgress?: BatchGraphOnProgress; } export function getGovernanceEvents({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions, -}: getGovernanceEventsParams): Promise { - return queryGraph({ graphApi, subgraphName, - query: GET_GOVERNANCE_EVENTS, - variables: { - first: GRAPHQL_LIMIT, - fromBlock, - }, + fromBlock, fetchDataOptions, - }); +}: getGovernanceEventsParams): Promise { + return queryGraph({ + graphApi, + subgraphName, + query: GET_GOVERNANCE_EVENTS, + variables: { + first: GRAPHQL_LIMIT, + fromBlock, + }, + fetchDataOptions, + }); } export async function getAllGovernanceEvents({ - graphApi, - subgraphName, - fromBlock, - fetchDataOptions, - onProgress, + graphApi, + subgraphName, + fromBlock, + fetchDataOptions, + onProgress, }: getGovernanceEventsParams): Promise> { - try { - const result = []; + try { + const result = []; - let lastSyncBlock = fromBlock; + let lastSyncBlock = fromBlock; - // eslint-disable-next-line no-constant-condition - while (true) { - const { - proposals, - votes, - delegates, - undelegates, - _meta: { - block: { number: currentBlock }, - }, - } = await getGovernanceEvents({ graphApi, subgraphName, fromBlock, fetchDataOptions }); + // eslint-disable-next-line no-constant-condition + while (true) { + const { + proposals, + votes, + delegates, + undelegates, + _meta: { + block: { number: currentBlock }, + }, + } = await getGovernanceEvents({ + graphApi, + subgraphName, + fromBlock, + fetchDataOptions, + }); - lastSyncBlock = currentBlock; + lastSyncBlock = currentBlock; - const eventsLength = proposals.length + votes.length + delegates.length + undelegates.length; + const eventsLength = proposals.length + votes.length + delegates.length + undelegates.length; - if (eventsLength === 0) { - break; - } + if (eventsLength === 0) { + break; + } - const formattedProposals: GovernanceProposalCreatedEvents[] = proposals.map( - ({ blockNumber, logIndex, transactionHash, proposalId, proposer, target, startTime, endTime, description }) => { - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - event: 'ProposalCreated', - id: Number(proposalId), - proposer: getAddress(proposer), - target: getAddress(target), - startTime: Number(startTime), - endTime: Number(endTime), - description, - }; - }, - ); + const formattedProposals: GovernanceProposalCreatedEvents[] = proposals.map( + ({ + blockNumber, + logIndex, + transactionHash, + proposalId, + proposer, + target, + startTime, + endTime, + description, + }) => { + return { + blockNumber: Number(blockNumber), + logIndex: Number(logIndex), + transactionHash, + event: 'ProposalCreated', + id: Number(proposalId), + proposer: getAddress(proposer), + target: getAddress(target), + startTime: Number(startTime), + endTime: Number(endTime), + description, + }; + }, + ); - const formattedVotes: GovernanceVotedEvents[] = votes.map( - ({ blockNumber, logIndex, transactionHash, proposalId, voter, support, votes, from, input }) => { - // Filter spammy txs - if (!input || input.length > 2048) { - input = ''; - } + const formattedVotes: GovernanceVotedEvents[] = votes.map( + ({ blockNumber, logIndex, transactionHash, proposalId, voter, support, votes, from, input }) => { + // Filter spammy txs + if (!input || input.length > 2048) { + input = ''; + } - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - event: 'Voted', - proposalId: Number(proposalId), - voter: getAddress(voter), - support, - votes, - from: getAddress(from), - input, - }; - }, - ); + return { + blockNumber: Number(blockNumber), + logIndex: Number(logIndex), + transactionHash, + event: 'Voted', + proposalId: Number(proposalId), + voter: getAddress(voter), + support, + votes, + from: getAddress(from), + input, + }; + }, + ); - const formattedDelegates: GovernanceDelegatedEvents[] = delegates.map( - ({ blockNumber, logIndex, transactionHash, account, delegateTo }) => { - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - event: 'Delegated', - account: getAddress(account), - delegateTo: getAddress(delegateTo), - }; - }, - ); + const formattedDelegates: GovernanceDelegatedEvents[] = delegates.map( + ({ blockNumber, logIndex, transactionHash, account, delegateTo }) => { + return { + blockNumber: Number(blockNumber), + logIndex: Number(logIndex), + transactionHash, + event: 'Delegated', + account: getAddress(account), + delegateTo: getAddress(delegateTo), + }; + }, + ); - const formattedUndelegates: GovernanceUndelegatedEvents[] = undelegates.map( - ({ blockNumber, logIndex, transactionHash, account, delegateFrom }) => { - return { - blockNumber: Number(blockNumber), - logIndex: Number(logIndex), - transactionHash, - event: 'Undelegated', - account: getAddress(account), - delegateFrom: getAddress(delegateFrom), - }; - }, - ); + const formattedUndelegates: GovernanceUndelegatedEvents[] = undelegates.map( + ({ blockNumber, logIndex, transactionHash, account, delegateFrom }) => { + return { + blockNumber: Number(blockNumber), + logIndex: Number(logIndex), + transactionHash, + event: 'Undelegated', + account: getAddress(account), + delegateFrom: getAddress(delegateFrom), + }; + }, + ); - let formattedEvents = [ - ...formattedProposals, - ...formattedVotes, - ...formattedDelegates, - ...formattedUndelegates, - ].sort((a, b) => { - if (a.blockNumber === b.blockNumber) { - return a.logIndex - b.logIndex; + let formattedEvents = [ + ...formattedProposals, + ...formattedVotes, + ...formattedDelegates, + ...formattedUndelegates, + ].sort((a, b) => { + if (a.blockNumber === b.blockNumber) { + return a.logIndex - b.logIndex; + } + return a.blockNumber - b.blockNumber; + }); + + if (eventsLength < 900) { + result.push(...formattedEvents); + break; + } + + const [firstEvent] = formattedEvents; + const [lastEvent] = formattedEvents.slice(-1); + + if (typeof onProgress === 'function') { + onProgress({ + type: 'Governance Events', + fromBlock: Number(firstEvent.blockNumber), + toBlock: Number(lastEvent.blockNumber), + count: eventsLength, + }); + } + + formattedEvents = formattedEvents.filter(({ blockNumber }) => blockNumber !== lastEvent.blockNumber); + + fromBlock = Number(lastEvent.blockNumber); + + result.push(...formattedEvents); } - return a.blockNumber - b.blockNumber; - }); - if (eventsLength < 900) { - result.push(...formattedEvents); - break; - } + const [lastEvent] = result.slice(-1); - const [firstEvent] = formattedEvents; - const [lastEvent] = formattedEvents.slice(-1); - - if (typeof onProgress === 'function') { - onProgress({ - type: 'Governance Events', - fromBlock: Number(firstEvent.blockNumber), - toBlock: Number(lastEvent.blockNumber), - count: eventsLength, - }); - } - - formattedEvents = formattedEvents.filter(({ blockNumber }) => blockNumber !== lastEvent.blockNumber); - - fromBlock = Number(lastEvent.blockNumber); - - result.push(...formattedEvents); + return { + events: result, + lastSyncBlock: + lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock, + }; + } catch (err) { + console.log('Error from getAllGovernance query'); + console.log(err); + return { + events: [], + lastSyncBlock: fromBlock, + }; } - - const [lastEvent] = result.slice(-1); - - return { - events: result, - lastSyncBlock: lastEvent && lastEvent.blockNumber >= lastSyncBlock ? lastEvent.blockNumber + 1 : lastSyncBlock, - }; - } catch (err) { - console.log('Error from getAllGovernance query'); - console.log(err); - return { - events: [], - lastSyncBlock: fromBlock, - }; - } } diff --git a/src/hasher.ts b/src/hasher.ts new file mode 100644 index 0000000..ed48117 --- /dev/null +++ b/src/hasher.ts @@ -0,0 +1,8 @@ +import { Signer } from 'ethers'; + +export const hasherBytecode = + '0x38600c600039612b1b6000f3606460006000377c01000000000000000000000000000000000000000000000000000000006000510463f47d33b5146200003557fe5b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000016004518160245181838180828009800909089082827f0fbe43c36a80e36d7c7c584d4f8f3759fb51f0d66065d8a227b688d12488c5d408839081808280098009098391089082827f9c48cd3e00a6195a253fc009e60f249456f802ff9baf6549210d201321efc1cc08839081808280098009098391089082827f27c0849dba2643077c13eb42ffb97663cdcecd669bf10f756be30bab71b86cf808839081808280098009098391089082827f2bf76744736132e5c68f7dfdd5b792681d415098554fd8280f00d11b172b80d208839081808280098009098391089082827f33133eb4a1a1ab45037c8bdf9adbb2999baf06f20a9c95180dc4ccdcbec5856808839081808280098009098391089082827f588bb66012356dbc9b059ef1d792b563d6c18624dddecc3fe4583fd3551e9b3008839081808280098009098391089082827f71bc3e244e1b92911fe7f53cf523e491fd6ff487d59337a1d92f92668c4f4c3608839081808280098009098391089082827fd1808e2b039fd010c489768f78d7499938ccc0858f3295151787cfe8b7e40be108839081808280098009098391089082827f76978af3ded437cf41b3faa40cd6bcfce94f27f4abcc3ed34be19abd2c4537d008839081808280098009098391089082827f0a9baee798a320b0ca5b1cf888386d1dc12c13b38e10225aa4e9f03069a099f508839081808280098009098391089082827fb79dbf6050a03b16c3ade8d77e11c767d2251af9cdbd6cdf9a8a0ee921b32c7908839081808280098009098391089082827fa74bbcf5067f067faec2cce4b98d130d7927456f5c5f6c00e0f5406a24eb8b1908839081808280098009098391089082827fab7ab080d4c4018bda6ecc8bd67468bc4619ba12f25b0da879a639c758c8855d08839081808280098009098391089082827fe6a5b797c2bba7e9a873b37f5c41adc47765e9be4a1f0e0650e6a24ad226876308839081808280098009098391089082827f6270ae87cf3d82cf9c0b5f428466c429d7b7cbe234cecff39969171af006016c08839081808280098009098391089082827f9951c9f6e76d636b52f7600d979ca9f3b643dfbe9551c83b31542830321b2a6608839081808280098009098391089082827f4119469e44229cc40c4ff555a2b6f6b39961088e741e3c20a3c9b47f130c555008839081808280098009098391089082827f5d795e02bbaf90ff1f384741e5f18f8b644a0080441315d0e5b3c8123452a0b008839081808280098009098391089082827f281e90a515e6409e9177b4f297f8049ce3d4c3659423c48b3fd64e83596ff10108839081808280098009098391089082827f424185c60a21e84970f7d32cacaa2725aa8a844caea7ed760d2b965af1bf3e7d08839081808280098009098391089082827fd96fcbc3960614ea887da609187a5dada2e1b829f23309a6375212cea1f25c0908839081808280098009098391089082827ffde84026d7c294300af18f7712fc3662f43387ae8cf7fdda1f9a810f4b24bcf208839081808280098009098391089082827f3a9d568575846aa6b8a890b3c237fd0447426db878e6e25333b8eb9b386195c108839081808280098009098391089082827f55a2aa32c84a4cae196dd4094b685dd11757470a3be094d98eea73f02452aa3608839081808280098009098391089082827fcbc9481380978d29ebc5b0a8d4481cd2ef654ee800907adb3d38dc2fd9265fab08839081808280098009098391089082827f24e53af71ef06bacb76d3294c11223911e9d177ff09b7009febc484add0beb7408839081808280098009098391089082827fdbd44e16108225766dac3e5fe7acbe9df519bbba97380e5e9437a90658f2139308839081808280098009098391089082827fc6f434863c79013bb2c202331e04bccea2251c1ff6f191dc2afa23e6f6d28e4e08839081808280098009098391089082827f3490eeb39a733c0e8062d87f981ae65a8fccf25c448f4455d27db3915351b06608839081808280098009098391089082827f30b89830ff7ade3558a5361a24869130ce1fcce97211602962e34859525dac4f08839081808280098009098391089082827f29bae21b579d080a75c1694da628d0ecfd83efc9c8468704f410300062f64ca908839081808280098009098391089082827fe326499de0476e719915dd1c661ef4550723d4aee9ee9af224edd208790fce4408839081808280098009098391089082827f8c45208b8baa6f473821415957088c0b7e72a465f460b09ece2d270aee2f184108839081808280098009098391089082827ffe2ad454f451348f26ce2cc7e7914aef3eb96e8f89a4619a1dc7d11f8401c35208839081808280098009098391089082827f0929db368ef2af2d29bca38845325b0b7a820a4889e44b5829bbe1ed47fd4d5208839081808280098009098391089082827f16531d424b0cbaf9abbf2d2acde698462ea4555bf32ccf1bbd26697e905066f608839081808280098009098391089082827ff5c30d247f045ff6d05cf0dd0a49c9823e7a24b0d751d3c721353b96f29d76f608839081808280098009098391089082827f6eb7a3614056c230c6f171370fdd9d1048bb00b2cdd1b2721d11bdda5023f48608839081808280098009098391089082827f0ee9c4621642a272f710908707557498d25a6fdd51866da5d9f0d205355a618908839081808280098009098391089082827f78ca1cb1c7f6c6894d1cf94f327b8763be173151b6b06f99dfc6a944bb5a72f008839081808280098009098391089082827f5d24d0b1b304d05311ce0f274b0d93746a4860ed5cdd8d4348de557ea7a5ee7a08839081808280098009098391089082827f77423dabd1a3cddc8691438fc5891e3fd49ac0f3e21aaf249791bfde1303d2f308839081808280098009098391089082827f0642e8800a48cc04c0168232c6f542396597a67cf395ad622d947e98bb68697a08839081808280098009098391089082827fc1e7d3cbbc4c35b7490647d8402e56d334336943bda91fe2d34ca9727c0e3df508839081808280098009098391089082827f8d6fb1730335204f38f85e408ac861e76f24349ab6ee0469c22e19350bb24fe108839081808280098009098391089082827f67d0faf5f0db32a1b60e13dc4914246b9edac7990fb4990b19aa86815586441a08839081808280098009098391089082827f2605b9b909ded1b04971eae979027c4e0de57f3b6a60d5ed58aba619c34749ce08839081808280098009098391089082827fd276890b2c205db85f000d1f5111ed8f177e279cae3e52862780f04e846228d008839081808280098009098391089082827f2ac5905f9450a21ef6905ed5951a91b3730e3a2e2d62b50bdeb810015d50376b08839081808280098009098391089082827f7a366839f0291ca54da674ac3f0e1e9aa8b687ba533926cb40268039e57b967a08839081808280098009098391089082827f67ab0f3466989c3dbbe209c37ec272ba83984ba6e445be6d472b63e3ca7270e308839081808280098009098391089082827f0e786007d0ce7e28a90e31d3263887d40c556dec88fcb8b56bc9e9c05ecc0c2908839081808280098009098391089082827f0b814ed99bd00eca389b0022663dbfddfbfa15e321c19abcf1eaf9556075fb6808839081808280098009098391089082827f65c0321ba26fcee4fdc35b4999b78ceb54dcaf9fec2e3bdea98e9f82925c093208839081808280098009098391089082827fab2d2a929601f9c3520e0b14aaa6ba9f1e79821a5b768919670a4ea970722bf408839081808280098009098391089082827fcdd2e0744d4af1a81918de69ec12128a5871367303ff83ed764771cbbdf6502308839081808280098009098391089082827f74527d0c0868f2ec628086b874fa66a7347d3d3b918d2e07a5f33e1067e8ac5808839081808280098009098391089082827f1c6bf6ac0314caead23e357bfcbbaa17d670672ae3a475f80934c716f10aca2508839081808280098009098391089082827f3c4007e286f8dc7efd5d0eeb0e95d7aa6589361d128a0cccb17b554c851a643208839081808280098009098391089082827fae468a86a5a7db7c763a053eb09ac1a02809ce095258c88101ee319e12b0697e08839081808280098009098391089082827f9333e3d052b7c77fcac1eb366f610f6f97852242b1317a87b80f3bbc5c8c2d1d08839081808280098009098391089082827f52ec1d675cf5353153f6b628414783ca6b7fc0fe01948ca206daad712296e39508839081808280098009098391089082827f13ceeeb301572b4991076750e11ea7e7fcbfee454d90dc1763989004a1894f9308839081808280098009098391089082827f8505737e7e94939a08d8cda10b6fbbbf879b2141ae7eabc30fcd22405135fe6408839081808280098009098391089082827f6127db7ac5200a212092b66ec2bfc63653f4dc8ac66c76008fef885258a258b508839081808280098009098391089082827f12692a7d808f44e31d628dbcfea377eb073fb918d7beb8136ea47f8cf094c88c08839081808280098009098391089082827f260e384b1268e3a347c91d6987fd280fa0a275541a7c5be34bf126af35c962e008839081808280098009098391089082827fd88c3b01966d90e713aee8d482ceaa6925311d2342e1a5aca4fcd2f44b6daddc08839081808280098009098391089082827fb87e868affd91b078a87fa75ac9332a6cf23587d94e20c3262db5e91f30bf04b08839081808280098009098391089082827fb5ba5f8acad1a950a3bbf2201055cd3ea27056c0c53f0c4c97f33cda8dbfe90908839081808280098009098391089082827f59ca814b49e00d7b3118c53a2986ded128584acd7428735e08ade6661c457f7508839081808280098009098391089082827f0fc4c0bea813a223fd510c07f7bbe337badd4bcf28649a0d378970c2a15b3aa508839081808280098009098391089082827f0053f1ea6dd60e7a6db09a00be77549ff3d4ee3737be7fb42052ae1321f667c308839081808280098009098391089082827feb937077bb10c8fe38716d4e38edc1f9e7b18c6414fef85fe7e9c5567baa4a0408839081808280098009098391089082827fbacb14c0f1508d828f7fd048d716b8044aec7f0fb48e85e717bf532db972520708839081808280098009098391089082827f4ca0abb8beb7cff572a0c1e6f58e080e1bb243d497a3e74538442a4555ad40be08839081808280098009098391089082827fda9eefd411e590d7e44592cce298af87b2c62aa3cc8bb137aa99ca8d4aa551b508839081808280098009098391089082827f153dae43cef763e7a2fc9846f09a2973b0ad9c35894c220699bcc2954501c6bd08839081808280098009098391089082827fd4ed2a09375813b4fb504c7a9ba13110bdd8549a47349db82c15a434c090e87b08839081808280098009098391089082827f0063a5c4c9c12dcf4bae72c69f3a225664469503d61d9eae5d9553bfb006095b08839081808280098009098391089082827fdc8a4d35ad28e59dd3713b45985cd3b70e37ccc2be42086f1ea078fe2dc9d82d08839081808280098009098391089082827f486ba219308f0c847b22fcb4449f8855192536c01b8057904e81c1c7814f483b08839081808280098009098391089082827f34d9604140a1ac9fdb204285b9fe1b303c281af2fc5fb362f6577282b423bcf308839081808280098009098391089082827fc1681959ec4bc3656911db2b2f56aa4db709c26f1a0a25c879286e37f437465d08839081808280098009098391089082827ffcd849f3b5f9e4368af75619fb27f2e335adbb9b44988f17c4d389fa751ad47a08839081808280098009098391089082827ff5f7fc22ad64c8e7c1e005110e13f4f1c6b1f8f8cc59000db0e3bb38f99554a508839081808280098009098391089082827fa9133b8a20fbae4633ec5f82cb47a38ae1877d12d1febb23982c7c808aa5317508839081808280098009098391089082827ff4827c5c7b61141cc31b75984bb3ed16ed579e5b72e32a1289b63ab55eaf8c1208839081808280098009098391089082827fcca361819ffefe3e50fe34c91a322c9405f4e5a168c1fc0a0a1883993e32c9f408839081808280098009098391089082827f6656088842bfc9e325a532784d3362cecfa86f9c7b208a6b499836ebe48ff15708839081808280098009098391089082827f00129c7cd00e42ed05a37dbceb80d47b65e1d750ef2148278a54723fdf42c4cc08839081808280098009098391089082827fa85b235631b786f85cd46f7768f6c71ae004ad267ae59bdf929ada149b19588808839081808280098009098391089082827f34df65a82686be09c5b237911abf237a9887c1a418f279ac79b446d7d311f5ea08839081808280098009098391089082827f815a850c3989df9ca6231e0bdd9916fc0e076f2c6c7f0f260a846d0179f9c32d08839081808280098009098391089082827f50fb0940848a67aee83d348421fadd79aefc7a2adabeec6e64904ebe1bf63e7d08839081808280098009098391089082827fbab63a16273599f8b66895461e62a19ff0d103693be771d93e3691bba89cdd8d08839081808280098009098391089082827f6931a091756e0bc709ebecfffba5038634c5b3d5d0c5876dd72aac67452db8a208839081808280098009098391089082827f55559b8bb79db8809c46ee627f1b5ce1d8e6d89bf94a9987a1407759d1ba896308839081808280098009098391089082827fa9a1a11b2979018cb155914d09f1df19b7ffec241e8b2487b6f6272a56a44a0a08839081808280098009098391089082827ff83293400e7bccea4bb86dcb0d5ca57fa2466e13a572d7d3531c6fa491cb0f1b08839081808280098009098391089082827fb7cb5742b6bc5339624d3568a33c21f31b877f8396972582028da999abf249f208839081808280098009098391089082827ff56efb400f8500b5c5bf811c65c86c7ed2e965f14f1a69bca436c0c60b79f46508839081808280098009098391089082827fd7c4427998d9c440f849dcd75b7157996eaad1b9a1d58cc2441931300e26eb2208839081808280098009098391089082827fca5ed18ad53e33fdc3ae8cf353ff3f6dd315f60060442b74f6b614b24ebd4cc308839081808280098009098391089082827f9ad3e9376c97b194a0fbf43e22a3616981d777365c765ead09a1d033fdf536b708839081808280098009098391089082827fc6daeff5769a06b26fe3b8fef30df07b1387373a7814cef364fe1d6059eaf54a08839081808280098009098391089082827fc20a78398345c6b8cf439643dab96223bf879c302648293eaf496fee5c978c6608839081808280098009098391089082827f589ca65b6cf0e90653c06dddc057dc61ba2839974569051c98b43e8618716efb08839081808280098009098391089082827f83064161f127d8c59fc73625957e21630dc6dc99e5443f6ce37ecd6bf28e69b708839081808280098009098391089082827f46d0ba662b50100b9a3af52052f68932feec1d12290b2033c4f49148893d8ba308839081808280098009098391089082827f18dd55b4a83a53f2ee578eb3e6d26f594824d44670fc3f4de80642344d15c09a08839081808280098009098391089082827f9fb5b594f48bc58b345ab90ded705920a7274b8e070eee8ce8cf90c72c3604b608839081808280098009098391089082827f1901d8f4f2c8449128e00663978f2050f2eb1cd6acb60d9d09c57c5d46ee54fe08839081808280098009098391089082827f5ec56789beab24ef7ee32f594d5fc561ec59dfeb93606dc7dcc6fe65133a7db408839081808280098009098391089082827f01c0b2cbe4fa9877a3d08eb67c510e8630da0a8beda94a6d9283e6f70d268bc508839081808280098009098391089082827f0b1d85acd9031a9107350eed946a25734e974799c5ba7cff13b15a5a623a25f008839081808280098009098391089082827f204497d1d359552905a2fe655f3d6f94926ea92d12cdaa6556ec26362f239f6408839081808280098009098391089082827fe075f7edc6631a8d7ffe33019f44fc91f286236d5a5f90f16de4791b72a2a5f008839081808280098009098391089082827f243f46e353354256ab8fe0ca4e9230dfc330bc163e602dfeaf307c1d1a7264b908839081808280098009098391089082827fd448ae5e09625fa1fcfd732fc9cd8f06e4c33b81f0a9240c83da56f41e9ecceb08839081808280098009098391089082827f2f312eef69a33d9fa753c08840275692a03432b3e6da67f9c59b9f9f4971cd5608839081808280098009098391089082827f5f333996af231bd5a293137da91801e191a6f24eb532ad1a7e6e9a2ad0efbc0008839081808280098009098391089082827fa8f771e0383a832dc8e2eaa8efabda300947acaf0684fabddf8b4abb0abd8a6208839081808280098009098391089082827f9ff0b3d7a4643596f651b70c1963cc4fa6c46018d78f05cb2c5f187e25df83a908839081808280098009098391089082827f9c373b704838325648273734dcdf962d7c156f431f70380ba4855832c4a238b808839081808280098009098391089082827fea2afa02604b8afeeb570f48a0e97a5e6bfe9613394b9a6b0026ecd6cec8c33a08839081808280098009098391089082827f68892258cd8eb43b71caa6d6837ec9959bfdfd72f25c9005ebaffc4011f8a7bf08839081808280098009098391089082827ff2824f561f6f82e3c1232836b0d268fa3b1b5489edd39a5fe1503bfc7ca91f4908839081808280098009098391089082827f164eda75fda2861f9d812f24e37ac938844fbe383c243b32b9f66ae2e76be71908839081808280098009098391089082827ff0a6fc431f5bf0dd1cca93b8b65b3f72c91f0693e2c74be9243b15abb31afcc008839081808280098009098391089082827fe68db66ba891ef0cd527f09ec6fff3ec0a269cf3d891a35ec13c902f70334b4f08839081808280098009098391089082827f3a44a5b102f7883a2b8630a3cae6e6db2e6e483bb7cfeb3492cbd91793ef598e08839081808280098009098391089082827f43939fe8ef789acb33cbf129ba8a3aa1bd61510a178022a05177c9c5a1c59bf108839081808280098009098391089082827f936fe3b66dfda1bc5a7aae241b4db442858bd720c1d579c0c869f273cd55d77408839081808280098009098391089082827f3490fcaa8ffa37f35dc67ae006e81352c7103945417b8e4b142afcaefa344b8508839081808280098009098391089082827fcae66096cff344caca53ffe0e58aafeb468bd174f00d8abc425b2099c088187408839081808280098009098391089082827fc7d05783a41bc14f3c9a45384b6d5e2547c5b6a224c8316910b208f2718a70ab08839081808280098009098391089082827f5ac6b9ba94040d5692b865b6677b60ef3201b5c2121699f70beb9f9b2528a02608839081808280098009098391089082827fa902a3d4d9ecbfb9b2c76fddf780554bf93cad97b244e805d3adb94e1816290008839081808280098009098391089082827fe9df91ffeeb086a4d26041c29dac6fca1d56a4d022fe34b38831267395b98d2708839081808280098009098391089082827f862646f851d91a8840ad9ee711f12ec13b3e8f980ff5ef5ee43ca4520d57def708839081808280098009098391089082827f30b7381c9725b9db07816baf8524943a79cea135807c84cce0833485c11e0c2e08839081808280098009098391089082827f96afc10c5cedaddbda99df79387397c9be74a5b50f3a0c04ccb68d4e0f3a989f08839081808280098009098391089082827f3543da80d10da251c548776fe907c4ef89993d62e0062ae5c0496fcb851c366108839081808280098009098391089082827fe5140fe26d8b008430fccd50a68e3e11c1163d63b6d8b7cc40bc6f3c1d0b1b0608839081808280098009098391089082827ffefdf1872e4475e8bbb0ef6fab7f561bff121314695c433bd4c29ec118060c9608839081808280098009098391089082827f6bb8c9f3d57b18e002df059db1e6a5d42ad566f153f18460774f68ac2650940008839081808280098009098391089082827f5415122d50b26f4fab5784004c56cf03f128f825ad2236f4b3d51f74737bd97308839081808280098009098391089082827f00e115c4a98efae6a3a5ecc873b0cef63ccd5b515710a3ab03ec52218f784dc908839081808280098009098391089082827fda7d525427bad87b88238657c21331245578bc76aa6240b7f972382537a202ab08839081808280098009098391089082827f83332e8b34505b83010270dc795290a2f515b8f89c163acecdf4799df04c62f808839081808280098009098391089082827fb09ecb6033d1a065f17a61066cd737d0c3c5873b51c3ab0a285e26939e62aa1808839081808280098009098391089082827f24e65c718938c2b937378e7435332174329730bde85a4185e37875824eb4985908839081808280098009098391089082827f68e41430ccd41cc5e92a9f9acd2e955c1385b9f5ed8d3f133d767429484a8eba08839081808280098009098391089082827fc038fe9d0125ab8be54545276f841274e414c596ed4c9eaa6919604603d1ffa908839081808280098009098391089082827f23248698612cd8e83234fcf5db9b6b225f4b0ba78d72ef13ea1edff5f0fb029808839081808280098009098391089082827fd2a9fa3d39c1ba91eefa666a1db71c6e0e4e3b707626b0197a4e59e7110cf0d408839081808280098009098391089082827fc28931ee7dfa02b62872e0d937ba3dc5c637118273a1f1f0c4fc880905c82efc08839081808280098009098391089082827f01cd399556445e3d7b201d6c5e56a5794e60be2cfd9a4643e7ead79bb4f60f7908839081808280098009098391089082827fac855cc58d5fbb0dff91a79683eb0e914c1b7d8d0a540d416838a89f83a8312f08839081808280098009098391089082827ff7798af7ccf36b836705849f7dd40328bf9346657255b431446ec75a6817181608839081808280098009098391089082827fe52a24c92d3f067bf551eeaf98c62ba525e84882d7adad835fad8de72986b2b108839081808280098009098391089082827fffc8682759a2bf1dd67c87a77c285467801f1c44fd78fa4eb5957a4832c9d72d08839081808280098009098391089082827f1482ac3e7e4f321627850d95a13942aea6d2923402b913046856ff7e8aaf9aff08839081808280098009098391089082827f17332b4c7aac2a07ccfe954de7ad22ccf6fcb4c5fa15c130ed22a40ae9398f4708839081808280098009098391089082827fd4be0546013f84a0d1e118b37589723b58e323983263616d1b036f8b3fdd858308839081808280098009098391089082827fa64ec737d31dddf939b184438ccdd3e1d3e667572857cd6c9c31a0d1d9b7b08508839081808280098009098391089082827f8ad12fbc74117cff4743d674539c86548c6758710a07a6abe3715e4b53526d3408839081808280098009098391089082827f15a16435a2300b27a337561401f06682ba85019aa0af61b264a1177d38b5c13c08839081808280098009098391089082827f22616f306e76352293a22ab6ee15509d9b108d4136b32fa7f9ed259793f392a108839081808280098009098391089082827f519727b25560caf00ce0d3f911bd4356f907160ab5186da10a629c7ccae1851e08839081808280098009098391089082827fcff39e77928ce9310118d50e29bc87e7f78b53ad51366359aa17f07902ae639208839081808280098009098391089082827f17dead3bfa1968c744118023dead77cdbee22c5b7c2414f5a6bdf82fd94cf3ad08839081808280098009098391089082827f2bef0f8b22a1cfb90100f4a552a9d02b772130123de8144a00c4d57497e1d7f408839081808280098009098391089082827fbf5188713fef90b31c35243f92cfa4331ab076e30e24b355c79b01f41d152a1108839081808280098009098391089082827f3baadd2fd92e3e12fb371be0578941dc0a108fbca0a7d81b88316fb94d6b4dfe08839081808280098009098391089082827fd4f955742e20a28d38611bf9fc4a478c97b673a7cd40d0113a58a1efe338d9aa08839081808280098009098391089082827f3c1c3fe9a5f7ccd54ad5a51a224b3f94775266d19c3733017e4920d7391ad64508839081808280098009098391089082827f6372df6148abeed66fda5461779a9651130c6c525df733852bcd929016768a7a08839081808280098009098391089082827f6d098e848fb853f95adb5a6364b5ab33c79fb08877f2cf3e0e160d9fcb3ebcc508839081808280098009098391089082827f48c5fc90f27431fabfe496dfba14bb0dba71141eb5472a365fd13023f4fe629608839081808280098009098391089082827fbb988dfc0c4dfe53999bd34840adcb63fdbf501ccd622ca2ddf5064ad8cdebf408839081808280098009098391089082827f25b068c942724c424ed5851c9575c22752c9bd25f91ebfa589de3d88ee7627f908839081808280098009098391089082827fed98a1931e361add218de11ff7879bd7114cda19c24ddbe15b3b0190ce01e1aa08839081808280098009098391089082827fc80b5a7d63f6c43542ad612023d3ffd6c684ce2eab837180addcb4decf51854408839081808280098009098391089082827fe2ef24bf47c5203118c6ff96657dd3c6fdff7212d5c798d826455de77b4b70cd08839081808280098009098391089082827f907da812fd5a8375587e4860f87691d0a8d61d454c507d09e5562e1a5d0fcc7608839081808280098009098391089082827fc459abbc62bc6070cacdff597e97990de56edc51cc6643afb0f6789fef1bad6308839081808280098009098391089082827f38d61f5e566855d70d36ef0f0f1fefcd7c829bdd60d95e0ef1fb5b98856280a408839081808280098009098391089082827f13218626665c420d3aa2b0fa49224a3dce8e08b8b56f8851bd9cb5e25cb3042d08839081808280098009098391089082827f6f685fb152dba21b4d02422e237e246df73d7d711ae6d7d33983bae0f873e31008839081808280098009098391089082827f5ade34719e2498dde70e4571c40474475a4af706a3cb82ac18a7fa44c22d1c4708839081808280098009098391089082827f8a0c3dc7a496adca059cb95d9b173812a00f3c4d435e0b9e8116e0c4b5f56acb08839081808280098009098391089082827f196bc98252f63169ed79073ee091a0e8ed0b5af51017da143940c00bdb86370908839081808280098009098391089082827fd979bf70695d93f8efb552a413701918afec9e12dfe213f4d0c27cfa68fad6c208839081808280098009098391089082827fb803072d02f54d237a3c6c4cc18eda6dce87a03c6819df54e4ed8aed6dc56d4608839081808280098009098391089082827f1efcda9d986cddcf431af4d59c6a7709d650885b7886cba70f0e7cd92b331cdc08839081808280098009098391089082827fd3ca5f7859b82ac50b63da06d43aa68a6b685f0a60397638bbea173b3f60419208839081808280098009098391089082827fa59d392c0667316ad37a06be2d51aabe9e79bdef0013bc109985648a14c7e41f08839081808280098009098391089082827fac2f5f0d2146791b396e2bed6cf15a20bc22cc4c8cf7dd4b3514ac00148dd0a708839081808280098009098391089082827f17a993a6af068d72bc36f0e814d29fef3f97d7a72aa963889b16a8457409861a08839081808280098009098391089082827f6f1bf99686550e0396f7f4e2df6fdaa090fbc272c8c76eb32a3c6791de5a07b508839081808280098009098391089082827f8234d705e1ecdc59cc6ed40749069d4b45e63deb49b5b7d7f527abd31c072b1b08839081808280098009098391089082827f6fe929a1fd6aacba5c4012c45dd727d2c816119567450003913d882cb97bc47e08839081808280098009098391089082827fad5371215f2aba49026b2e48739c11b4d8ffbb24dd4a6e41b9763862af96787a08839081808280098009098391089082827fd0e704566c49e1a11edc2c128b2e07f36dc0c755468268f8fe4c4859b9fa595b08839081808280098009098391089082827f263e1195090d00be1d8fb37de17ccf3b66d180645efa0d831865cfaa8797769e08839081808280098009098391089082827fe65c090eebde2cfa7f9c92cf75641c7683fb8e81f4a48f5b7a9c7eb26a85029f08839081808280098009098391089082827fa18971781c6855f6a9752912780bb9b719c14a677a4c6393d62d6e046b97a2ac08839081808280098009098391089082827ff6fc1ef1bca8bec055cc66edecc5dc99030fe78311a3f21d8cd624df4f89e62508839081808280098009098391089082827f824e4e2838501516d3296542cb47a59a1ca4326e947c9c874d88dccc8e37b99a08839081808280098009098391089082827f3cd5a9e7353a50e454c9c1381b556b543897cc89153c3e3749f2021d8237226308839081808280098009098391089082827fb4bcedbd54d0c917a315cc7ca785e3c5995abbeeb3deb3ebaf02c7a9bf6cc83f08839081808280098009098391089082827f1f7476211105b3039cef009c51155ae93526c53a74973ecfce40754b3df1052108839081808280098009098391089082827f58aefbd978440c94b4b9fbd36e00e6e36caeacf82b0da0a6161d34c541a5a6e308839081808280098009098391089082827fc22cd6d61be780a33c77677bc6ba40307b597ed981db57cb485313eec2a5a49708839081808280098009098391089082827fd9ffc4fe0dc5f835c8dcdc1e60b8f0b1637f32a809175371b94a057272b0748d08839081808280098009098391089082827ff6a5268541bc4c64ad0ade8f55dda3492604857a71c923662a214dd7e9c20c1008839081808280098009098391089082826000088390818082800980090983910860205260005260406000f3'; + +export function deployHasher(signer: Signer) { + return signer.sendTransaction({ data: hasherBytecode }); +} diff --git a/src/idb.ts b/src/idb.ts new file mode 100644 index 0000000..de3bc35 --- /dev/null +++ b/src/idb.ts @@ -0,0 +1,473 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import { openDB, deleteDB, OpenDBCallbacks, IDBPDatabase } from 'idb'; +import { getConfig, NetIdType } from './networkConfig'; + +export const INDEX_DB_ERROR = 'A mutation operation was attempted on a database that did not allow mutations.'; + +export interface IDBIndex { + name: string; + unique?: boolean; +} + +export interface IDBStores { + name: string; + keyPath?: string; + indexes?: IDBIndex[]; +} + +export interface IDBConstructor { + dbName: string; + stores?: IDBStores[]; +} + +export class IndexedDB { + dbExists: boolean; + isBlocked: boolean; + // todo: TestDBSchema on any + options: OpenDBCallbacks; + dbName: string; + dbVersion: number; + db?: IDBPDatabase; + + constructor({ dbName, stores }: IDBConstructor) { + this.dbExists = false; + this.isBlocked = false; + + this.options = { + upgrade(db) { + Object.values(db.objectStoreNames).forEach((value) => { + db.deleteObjectStore(value); + }); + + [{ name: 'keyval' }, ...(stores || [])].forEach(({ name, keyPath, indexes }) => { + const store = db.createObjectStore(name, { + keyPath, + autoIncrement: true, + }); + + if (Array.isArray(indexes)) { + indexes.forEach(({ name, unique = false }) => { + store.createIndex(name, name, { unique }); + }); + } + }); + }, + }; + + this.dbName = dbName; + this.dbVersion = 35; + } + + async initDB() { + try { + if (this.dbExists || this.isBlocked) { + return; + } + + this.db = await openDB(this.dbName, this.dbVersion, this.options); + this.db.addEventListener('onupgradeneeded', async () => { + await this._removeExist(); + }); + + this.dbExists = true; + } catch (err: any) { + // needed for private mode firefox browser + if (err.message.includes(INDEX_DB_ERROR)) { + console.log('This browser does not support IndexedDB!'); + this.isBlocked = true; + return; + } + + if (err.message.includes('less than the existing version')) { + console.log(`Upgrading DB ${this.dbName} to ${this.dbVersion}`); + await this._removeExist(); + return; + } + + console.error(`Method initDB has error: ${err.message}`); + } + } + + async _removeExist() { + await deleteDB(this.dbName); + this.dbExists = false; + + await this.initDB(); + } + + async getFromIndex({ + storeName, + indexName, + key, + }: { + storeName: string; + indexName: string; + key?: string; + }): Promise { + await this.initDB(); + + if (!this.db) { + return; + } + + try { + return (await this.db.getFromIndex(storeName, indexName, key)) as T; + } catch (err: any) { + throw new Error(`Method getFromIndex has error: ${err.message}`); + } + } + + async getAllFromIndex({ + storeName, + indexName, + key, + count, + }: { + storeName: string; + indexName: string; + key?: string; + count?: number; + }): Promise { + await this.initDB(); + + if (!this.db) { + return [] as T; + } + + try { + return (await this.db.getAllFromIndex(storeName, indexName, key, count)) as T; + } catch (err: any) { + throw new Error(`Method getAllFromIndex has error: ${err.message}`); + } + } + + async getItem({ storeName, key }: { storeName: string; key: string }): Promise { + await this.initDB(); + + if (!this.db) { + return; + } + + try { + const store = this.db.transaction(storeName).objectStore(storeName); + + return (await store.get(key)) as T; + } catch (err: any) { + throw new Error(`Method getItem has error: ${err.message}`); + } + } + + async addItem({ storeName, data, key = '' }: { storeName: string; data: any; key: string }) { + await this.initDB(); + + if (!this.db) { + return; + } + + try { + const tx = this.db.transaction(storeName, 'readwrite'); + const isExist = await tx.objectStore(storeName).get(key); + + if (!isExist) { + await tx.objectStore(storeName).add(data); + } + } catch (err: any) { + throw new Error(`Method addItem has error: ${err.message}`); + } + } + + async putItem({ storeName, data, key }: { storeName: string; data: any; key?: string }) { + await this.initDB(); + + if (!this.db) { + return; + } + + try { + const tx = this.db.transaction(storeName, 'readwrite'); + + await tx.objectStore(storeName).put(data, key); + } catch (err: any) { + throw new Error(`Method putItem has error: ${err.message}`); + } + } + + async deleteItem({ storeName, key }: { storeName: string; key: string }) { + await this.initDB(); + + if (!this.db) { + return; + } + + try { + const tx = this.db.transaction(storeName, 'readwrite'); + + await tx.objectStore(storeName).delete(key); + } catch (err: any) { + throw new Error(`Method deleteItem has error: ${err.message}`); + } + } + + async getAll({ storeName }: { storeName: string }): Promise { + await this.initDB(); + + if (!this.db) { + return [] as T; + } + + try { + const tx = this.db.transaction(storeName, 'readonly'); + + return (await tx.objectStore(storeName).getAll()) as T; + } catch (err: any) { + throw new Error(`Method getAll has error: ${err.message}`); + } + } + + /** + * Simple key-value store inspired by idb-keyval package + */ + getValue(key: string) { + return this.getItem({ storeName: 'keyval', key }); + } + + setValue(key: string, data: any) { + return this.putItem({ storeName: 'keyval', key, data }); + } + + delValue(key: string) { + return this.deleteItem({ storeName: 'keyval', key }); + } + + async clearStore({ storeName, mode = 'readwrite' }: { storeName: string; mode: IDBTransactionMode }) { + await this.initDB(); + + if (!this.db) { + return; + } + + try { + const tx = this.db.transaction(storeName, mode); + + await (tx.objectStore(storeName).clear as () => Promise)(); + } catch (err: any) { + throw new Error(`Method clearStore has error: ${err.message}`); + } + } + + async createTransactions({ + storeName, + data, + mode = 'readwrite', + }: { + storeName: string; + data: any; + mode: IDBTransactionMode; + }) { + await this.initDB(); + + if (!this.db) { + return; + } + + try { + const tx = this.db.transaction(storeName, mode); + + await (tx.objectStore(storeName).add as (value: any, key?: any) => Promise)(data); + await tx.done; + } catch (err: any) { + throw new Error(`Method createTransactions has error: ${err.message}`); + } + } + + async createMultipleTransactions({ + storeName, + data, + index, + mode = 'readwrite', + }: { + storeName: string; + data: any[]; + index?: any; + mode?: IDBTransactionMode; + }) { + await this.initDB(); + + if (!this.db) { + return; + } + + try { + const tx = this.db.transaction(storeName, mode); + + for (const item of data) { + if (item) { + await (tx.store.put as (value: any, key?: any) => Promise)({ ...item, ...index }); + } + } + } catch (err: any) { + throw new Error(`Method createMultipleTransactions has error: ${err.message}`); + } + } +} + +/** + * Should check if DB is initialized well + */ +export async function getIndexedDB(netId?: NetIdType) { + // key-value db for settings + if (!netId) { + const idb = new IndexedDB({ dbName: 'tornado-core' }); + await idb.initDB(); + return idb; + } + + const minimalIndexes = [ + { + name: 'blockNumber', + unique: false, + }, + { + name: 'transactionHash', + unique: false, + }, + ]; + + const defaultState = [ + { + name: `echo_${netId}`, + keyPath: 'eid', + indexes: [ + ...minimalIndexes, + { + name: 'address', + unique: false, + }, + ], + }, + { + name: `encrypted_notes_${netId}`, + keyPath: 'eid', + indexes: minimalIndexes, + }, + { + name: 'lastEvents', + keyPath: 'name', + indexes: [ + { + name: 'name', + unique: false, + }, + ], + }, + ]; + + const config = getConfig(netId); + + const { tokens, nativeCurrency, registryContract, governanceContract } = config; + + const stores = [...defaultState]; + + if (registryContract) { + stores.push({ + name: `registry_${netId}`, + keyPath: 'ensName', + indexes: [ + ...minimalIndexes, + { + name: 'event', + unique: false, + }, + ], + }); + + stores.push({ + name: `relayers_${netId}`, + keyPath: 'timestamp', + indexes: [ + { + name: 'timestamp', + unique: true, + }, + ], + }); + + stores.push({ + name: `revenue_${netId}`, + keyPath: 'timestamp', + indexes: [ + { + name: 'timestamp', + unique: true, + }, + ], + }); + } + + if (governanceContract) { + stores.push({ + name: `governance_${netId}`, + keyPath: 'eid', + indexes: [ + ...minimalIndexes, + { + name: 'event', + unique: false, + }, + ], + }); + } + + Object.entries(tokens).forEach(([token, { instanceAddress }]) => { + Object.keys(instanceAddress).forEach((amount) => { + if (nativeCurrency === token) { + stores.push( + { + name: `stringify_bloom_${netId}_${token}_${amount}`, + keyPath: 'hashBloom', + indexes: [], + }, + { + name: `stringify_tree_${netId}_${token}_${amount}`, + keyPath: 'hashTree', + indexes: [], + }, + ); + } + + stores.push( + { + name: `deposits_${netId}_${token}_${amount}`, + keyPath: 'leafIndex', // the key by which it refers to the object must be in all instances of the storage + indexes: [ + ...minimalIndexes, + { + name: 'commitment', + unique: true, + }, + ], + }, + { + name: `withdrawals_${netId}_${token}_${amount}`, + keyPath: 'eid', + indexes: [ + ...minimalIndexes, + { + name: 'nullifierHash', + unique: true, + }, // keys on which the index is created + ], + }, + ); + }); + }); + + const idb = new IndexedDB({ + dbName: `tornado_core_${netId}`, + stores, + }); + + await idb.initDB(); + + return idb; +} diff --git a/src/index.ts b/src/index.ts index 959e645..15c71ed 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,19 +1,27 @@ export * from './events'; -export * from './graphql'; +//export * from './graphql'; export * from './schemas'; export * from './typechain'; export * from './batch'; export * from './deposits'; export * from './encryptedNotes'; +export * from './ens'; export * from './fees'; +export * from './gaszip'; +export * from './hasher'; +export * from './idb'; +export * from './ip'; export * from './merkleTree'; export * from './mimc'; export * from './multicall'; export * from './networkConfig'; export * from './pedersen'; +export * from './permit'; export * from './prices'; export * from './providers'; export * from './relayerClient'; export * from './tokens'; +export * from './tovarishClient'; export * from './utils'; export * from './websnark'; +export * from './zip'; diff --git a/src/ip.ts b/src/ip.ts new file mode 100644 index 0000000..ec622d6 --- /dev/null +++ b/src/ip.ts @@ -0,0 +1,14 @@ +import { fetchData } from './providers'; + +export interface IPResult { + ip: string; + iso?: string; + tor?: boolean; +} + +export async function fetchIp(ipEcho: string) { + return (await fetchData(ipEcho, { + method: 'GET', + timeout: 30000, + })) as IPResult; +} diff --git a/src/merkleTree.ts b/src/merkleTree.ts index 9c4aaaf..3fbaf76 100644 --- a/src/merkleTree.ts +++ b/src/merkleTree.ts @@ -7,193 +7,196 @@ import type { DepositType } from './deposits'; import type { DepositsEvents } from './events'; import type { NetIdType } from './networkConfig'; -export type MerkleTreeConstructor = DepositType & { - Tornado: Tornado; - commitmentHex?: string; - merkleTreeHeight?: number; - emptyElement?: string; - merkleWorkerPath?: string; -}; +export interface MerkleTreeConstructor extends DepositType { + Tornado: Tornado; + commitmentHex?: string; + merkleTreeHeight?: number; + emptyElement?: string; + merkleWorkerPath?: string; +} export class MerkleTreeService { - currency: string; - amount: string; - netId: NetIdType; - Tornado: Tornado; - commitmentHex?: string; - instanceName: string; + currency: string; + amount: string; + netId: NetIdType; + Tornado: Tornado; + commitmentHex?: string; + instanceName: string; - merkleTreeHeight: number; - emptyElement: string; + merkleTreeHeight: number; + emptyElement: string; - merkleWorkerPath?: string; + merkleWorkerPath?: string; - constructor({ - netId, - amount, - currency, - Tornado, - commitmentHex, - merkleTreeHeight = 20, - emptyElement = '21663839004416932945382355908790599225266501822907911457504978515578255421292', - merkleWorkerPath, - }: MerkleTreeConstructor) { - const instanceName = `${netId}_${currency}_${amount}`; + constructor({ + netId, + amount, + currency, + Tornado, + commitmentHex, + merkleTreeHeight = 20, + emptyElement = '21663839004416932945382355908790599225266501822907911457504978515578255421292', + merkleWorkerPath, + }: MerkleTreeConstructor) { + const instanceName = `${netId}_${currency}_${amount}`; - this.currency = currency; - this.amount = amount; - this.netId = Number(netId); + this.currency = currency; + this.amount = amount; + this.netId = Number(netId); - this.Tornado = Tornado; - this.instanceName = instanceName; - this.commitmentHex = commitmentHex; + this.Tornado = Tornado; + this.instanceName = instanceName; + this.commitmentHex = commitmentHex; - this.merkleTreeHeight = merkleTreeHeight; - this.emptyElement = emptyElement; - this.merkleWorkerPath = merkleWorkerPath; - } + this.merkleTreeHeight = merkleTreeHeight; + this.emptyElement = emptyElement; + this.merkleWorkerPath = merkleWorkerPath; + } - async createTree(events: Element[]) { - const { hash: hashFunction } = await mimc.getHash(); + async createTree(events: Element[]) { + const { hash: hashFunction } = await mimc.getHash(); - if (this.merkleWorkerPath) { - console.log('Using merkleWorker\n'); + if (this.merkleWorkerPath) { + console.log('Using merkleWorker\n'); - try { - if (isNode) { - const merkleWorkerPromise = new Promise((resolve, reject) => { - const worker = new NodeWorker(this.merkleWorkerPath as string, { - workerData: { - merkleTreeHeight: this.merkleTreeHeight, - elements: events, - zeroElement: this.emptyElement, - }, - }); - worker.on('message', resolve); - worker.on('error', reject); - worker.on('exit', (code) => { - if (code !== 0) { - reject(new Error(`Worker stopped with exit code ${code}`)); - } - }); - }) as Promise; + try { + if (isNode) { + const merkleWorkerPromise = new Promise((resolve, reject) => { + const worker = new NodeWorker(this.merkleWorkerPath as string, { + workerData: { + merkleTreeHeight: this.merkleTreeHeight, + elements: events, + zeroElement: this.emptyElement, + }, + }); + worker.on('message', resolve); + worker.on('error', reject); + worker.on('exit', (code) => { + if (code !== 0) { + reject(new Error(`Worker stopped with exit code ${code}`)); + } + }); + }) as Promise; - return MerkleTree.deserialize(JSON.parse(await merkleWorkerPromise), hashFunction); - } else { - const merkleWorkerPromise = new Promise((resolve, reject) => { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const worker = new (Worker as any)(this.merkleWorkerPath); + return MerkleTree.deserialize(JSON.parse(await merkleWorkerPromise), hashFunction); + } else { + const merkleWorkerPromise = new Promise((resolve, reject) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const worker = new (Worker as any)(this.merkleWorkerPath); - worker.onmessage = (e: { data: string }) => { - resolve(e.data); - }; + worker.onmessage = (e: { data: string }) => { + resolve(e.data); + }; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - worker.onerror = (e: any) => { - reject(e); - }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + worker.onerror = (e: any) => { + reject(e); + }; - worker.postMessage({ - merkleTreeHeight: this.merkleTreeHeight, - elements: events, - zeroElement: this.emptyElement, - }); - }) as Promise; + worker.postMessage({ + merkleTreeHeight: this.merkleTreeHeight, + elements: events, + zeroElement: this.emptyElement, + }); + }) as Promise; - return MerkleTree.deserialize(JSON.parse(await merkleWorkerPromise), hashFunction); + return MerkleTree.deserialize(JSON.parse(await merkleWorkerPromise), hashFunction); + } + } catch (err) { + console.log('merkleWorker failed, falling back to synchronous merkle tree'); + console.log(err); + } } - } catch (err) { - console.log('merkleWorker failed, falling back to synchronous merkle tree'); - console.log(err); - } + + return new MerkleTree(this.merkleTreeHeight, events, { + zeroElement: this.emptyElement, + hashFunction, + }); } - return new MerkleTree(this.merkleTreeHeight, events, { - zeroElement: this.emptyElement, - hashFunction, - }); - } + async createPartialTree({ edge, elements }: { edge: TreeEdge; elements: Element[] }) { + const { hash: hashFunction } = await mimc.getHash(); - async createPartialTree({ edge, elements }: { edge: TreeEdge; elements: Element[] }) { - const { hash: hashFunction } = await mimc.getHash(); + if (this.merkleWorkerPath) { + console.log('Using merkleWorker\n'); - if (this.merkleWorkerPath) { - console.log('Using merkleWorker\n'); + try { + if (isNode) { + const merkleWorkerPromise = new Promise((resolve, reject) => { + const worker = new NodeWorker(this.merkleWorkerPath as string, { + workerData: { + merkleTreeHeight: this.merkleTreeHeight, + edge, + elements, + zeroElement: this.emptyElement, + }, + }); + worker.on('message', resolve); + worker.on('error', reject); + worker.on('exit', (code) => { + if (code !== 0) { + reject(new Error(`Worker stopped with exit code ${code}`)); + } + }); + }) as Promise; - try { - if (isNode) { - const merkleWorkerPromise = new Promise((resolve, reject) => { - const worker = new NodeWorker(this.merkleWorkerPath as string, { - workerData: { - merkleTreeHeight: this.merkleTreeHeight, - edge, - elements, - zeroElement: this.emptyElement, - }, - }); - worker.on('message', resolve); - worker.on('error', reject); - worker.on('exit', (code) => { - if (code !== 0) { - reject(new Error(`Worker stopped with exit code ${code}`)); - } - }); - }) as Promise; + return PartialMerkleTree.deserialize(JSON.parse(await merkleWorkerPromise), hashFunction); + } else { + const merkleWorkerPromise = new Promise((resolve, reject) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const worker = new (Worker as any)(this.merkleWorkerPath); - return PartialMerkleTree.deserialize(JSON.parse(await merkleWorkerPromise), hashFunction); - } else { - const merkleWorkerPromise = new Promise((resolve, reject) => { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const worker = new (Worker as any)(this.merkleWorkerPath); + worker.onmessage = (e: { data: string }) => { + resolve(e.data); + }; - worker.onmessage = (e: { data: string }) => { - resolve(e.data); - }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + worker.onerror = (e: any) => { + reject(e); + }; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - worker.onerror = (e: any) => { - reject(e); - }; + worker.postMessage({ + merkleTreeHeight: this.merkleTreeHeight, + edge, + elements, + zeroElement: this.emptyElement, + }); + }) as Promise; - worker.postMessage({ - merkleTreeHeight: this.merkleTreeHeight, - edge, - elements, - zeroElement: this.emptyElement, - }); - }) as Promise; - - return PartialMerkleTree.deserialize(JSON.parse(await merkleWorkerPromise), hashFunction); + return PartialMerkleTree.deserialize(JSON.parse(await merkleWorkerPromise), hashFunction); + } + } catch (err) { + console.log('merkleWorker failed, falling back to synchronous merkle tree'); + console.log(err); + } } - } catch (err) { - console.log('merkleWorker failed, falling back to synchronous merkle tree'); - console.log(err); - } + + return new PartialMerkleTree(this.merkleTreeHeight, edge, elements, { + zeroElement: this.emptyElement, + hashFunction, + }); } - return new PartialMerkleTree(this.merkleTreeHeight, edge, elements, { - zeroElement: this.emptyElement, - hashFunction, - }); - } + async verifyTree(events: DepositsEvents[]) { + console.log( + `\nCreating deposit tree for ${this.netId} ${this.amount} ${this.currency.toUpperCase()} would take a while\n`, + ); - async verifyTree(events: DepositsEvents[]) { - console.log( - `\nCreating deposit tree for ${this.netId} ${this.amount} ${this.currency.toUpperCase()} would take a while\n`, - ); + const timeStart = Date.now(); - console.time('Created tree in'); - const tree = await this.createTree(events.map(({ commitment }) => commitment)); - console.timeEnd('Created tree in'); - console.log(''); + const tree = await this.createTree(events.map(({ commitment }) => commitment)); - const isKnownRoot = await this.Tornado.isKnownRoot(toFixedHex(BigInt(tree.root))); + const isKnownRoot = await this.Tornado.isKnownRoot(toFixedHex(BigInt(tree.root))); - if (!isKnownRoot) { - const errMsg = `Deposit Event ${this.netId} ${this.amount} ${this.currency} is invalid`; - throw new Error(errMsg); + if (!isKnownRoot) { + const errMsg = `Deposit Event ${this.netId} ${this.amount} ${this.currency} is invalid`; + throw new Error(errMsg); + } + + console.log( + `\nCreated ${this.netId} ${this.amount} ${this.currency.toUpperCase()} tree in ${Date.now() - timeStart}ms\n`, + ); + + return tree; } - - return tree; - } } diff --git a/src/merkleTreeWorker.ts b/src/merkleTreeWorker.ts index 1797688..3236af5 100644 --- a/src/merkleTreeWorker.ts +++ b/src/merkleTreeWorker.ts @@ -5,66 +5,66 @@ import { mimc } from './mimc'; import { isNode } from './utils'; interface WorkData { - merkleTreeHeight: number; - edge?: TreeEdge; - elements: Element[]; - zeroElement: string; + merkleTreeHeight: number; + edge?: TreeEdge; + elements: Element[]; + zeroElement: string; } async function nodePostWork() { - const { hash: hashFunction } = await mimc.getHash(); - const { merkleTreeHeight, edge, elements, zeroElement } = workerThreads.workerData as WorkData; - - if (edge) { - const merkleTree = new PartialMerkleTree(merkleTreeHeight, edge, elements, { - zeroElement, - hashFunction, - }); - - (workerThreads.parentPort as workerThreads.MessagePort).postMessage(merkleTree.toString()); - return; - } - - const merkleTree = new MerkleTree(merkleTreeHeight, elements, { - zeroElement, - hashFunction, - }); - - (workerThreads.parentPort as workerThreads.MessagePort).postMessage(merkleTree.toString()); -} - -if (isNode && workerThreads) { - nodePostWork(); -} else if (!isNode && typeof addEventListener === 'function' && typeof postMessage === 'function') { - addEventListener('message', async (e: any) => { - let data; - - if (e.data) { - data = e.data; - } else { - data = e; - } - const { hash: hashFunction } = await mimc.getHash(); - const { merkleTreeHeight, edge, elements, zeroElement } = data as WorkData; + const { merkleTreeHeight, edge, elements, zeroElement } = workerThreads.workerData as WorkData; if (edge) { - const merkleTree = new PartialMerkleTree(merkleTreeHeight, edge, elements, { - zeroElement, - hashFunction, - }); + const merkleTree = new PartialMerkleTree(merkleTreeHeight, edge, elements, { + zeroElement, + hashFunction, + }); - postMessage(merkleTree.toString()); - return; + (workerThreads.parentPort as workerThreads.MessagePort).postMessage(merkleTree.toString()); + return; } const merkleTree = new MerkleTree(merkleTreeHeight, elements, { - zeroElement, - hashFunction, + zeroElement, + hashFunction, }); - postMessage(merkleTree.toString()); - }); -} else { - throw new Error('This browser / environment does not support workers!'); + (workerThreads.parentPort as workerThreads.MessagePort).postMessage(merkleTree.toString()); +} + +if (isNode && workerThreads) { + nodePostWork(); +} else if (!isNode && typeof addEventListener === 'function' && typeof postMessage === 'function') { + addEventListener('message', async (e: any) => { + let data; + + if (e.data) { + data = e.data; + } else { + data = e; + } + + const { hash: hashFunction } = await mimc.getHash(); + const { merkleTreeHeight, edge, elements, zeroElement } = data as WorkData; + + if (edge) { + const merkleTree = new PartialMerkleTree(merkleTreeHeight, edge, elements, { + zeroElement, + hashFunction, + }); + + postMessage(merkleTree.toString()); + return; + } + + const merkleTree = new MerkleTree(merkleTreeHeight, elements, { + zeroElement, + hashFunction, + }); + + postMessage(merkleTree.toString()); + }); +} else { + throw new Error('This browser / environment does not support workers!'); } diff --git a/src/mimc.ts b/src/mimc.ts index e731137..e538a96 100644 --- a/src/mimc.ts +++ b/src/mimc.ts @@ -2,27 +2,27 @@ import { MimcSponge, buildMimcSponge } from 'circomlibjs'; import type { Element, HashFunction } from '@tornado/fixed-merkle-tree'; export class Mimc { - sponge?: MimcSponge; - hash?: HashFunction; - mimcPromise: Promise; + sponge?: MimcSponge; + hash?: HashFunction; + mimcPromise: Promise; - constructor() { - this.mimcPromise = this.initMimc(); - } + constructor() { + this.mimcPromise = this.initMimc(); + } - async initMimc() { - this.sponge = await buildMimcSponge(); - this.hash = (left, right) => this.sponge?.F.toString(this.sponge?.multiHash([BigInt(left), BigInt(right)])); - } + async initMimc() { + this.sponge = await buildMimcSponge(); + this.hash = (left, right) => this.sponge?.F.toString(this.sponge?.multiHash([BigInt(left), BigInt(right)])); + } - async getHash() { - await this.mimcPromise; + async getHash() { + await this.mimcPromise; - return { - sponge: this.sponge, - hash: this.hash, - }; - } + return { + sponge: this.sponge, + hash: this.hash, + }; + } } export const mimc = new Mimc(); diff --git a/src/multicall.ts b/src/multicall.ts index 59ea812..5985c04 100644 --- a/src/multicall.ts +++ b/src/multicall.ts @@ -2,36 +2,36 @@ import { BaseContract, Interface } from 'ethers'; import { Multicall } from './typechain'; export interface Call3 { - contract?: BaseContract; - address?: string; - interface?: Interface; - name: string; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - params?: any[]; - allowFailure?: boolean; + contract?: BaseContract; + address?: string; + interface?: Interface; + name: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + params?: any[]; + allowFailure?: boolean; } export async function multicall(Multicall: Multicall, calls: Call3[]) { - const calldata = calls.map((call) => { - const target = (call.contract?.target || call.address) as string; - const callInterface = (call.contract?.interface || call.interface) as Interface; + const calldata = calls.map((call) => { + const target = (call.contract?.target || call.address) as string; + const callInterface = (call.contract?.interface || call.interface) as Interface; - return { - target, - callData: callInterface.encodeFunctionData(call.name, call.params), - allowFailure: call.allowFailure ?? false, - }; - }); + return { + target, + callData: callInterface.encodeFunctionData(call.name, call.params), + allowFailure: call.allowFailure ?? false, + }; + }); - const returnData = await Multicall.aggregate3.staticCall(calldata); + const returnData = await Multicall.aggregate3.staticCall(calldata); - const res = returnData.map((call, i) => { - const callInterface = (calls[i].contract?.interface || calls[i].interface) as Interface; - const [result, data] = call; - const decodeResult = - result && data && data !== '0x' ? callInterface.decodeFunctionResult(calls[i].name, data) : null; - return !decodeResult ? null : decodeResult.length === 1 ? decodeResult[0] : decodeResult; - }); + const res = returnData.map((call, i) => { + const callInterface = (calls[i].contract?.interface || calls[i].interface) as Interface; + const [result, data] = call; + const decodeResult = + result && data && data !== '0x' ? callInterface.decodeFunctionResult(calls[i].name, data) : null; + return !decodeResult ? null : decodeResult.length === 1 ? decodeResult[0] : decodeResult; + }); - return res; + return res; } diff --git a/src/networkConfig.ts b/src/networkConfig.ts index 139a89c..3811b92 100644 --- a/src/networkConfig.ts +++ b/src/networkConfig.ts @@ -1,669 +1,656 @@ +import type { DepositType } from './deposits'; + /** * Type of default supported networks */ export enum NetId { - MAINNET = 1, - BSC = 56, - POLYGON = 137, - OPTIMISM = 10, - ARBITRUM = 42161, - GNOSIS = 100, - AVALANCHE = 43114, - SEPOLIA = 11155111, + MAINNET = 1, + BSC = 56, + POLYGON = 137, + OPTIMISM = 10, + ARBITRUM = 42161, + GNOSIS = 100, + AVALANCHE = 43114, + SEPOLIA = 11155111, } export type NetIdType = NetId | number; export interface RpcUrl { - name: string; - url: string; + name: string; + url: string; } -export type RpcUrls = { - [key in string]: RpcUrl; -}; +export interface RpcUrls { + [key: string]: RpcUrl; +} export interface SubgraphUrl { - name: string; - url: string; + name: string; + url: string; } -export type SubgraphUrls = { - [key in string]: SubgraphUrl; -}; +export interface SubgraphUrls { + [key: string]: SubgraphUrl; +} -export type TornadoInstance = { - instanceAddress: { - [key in string]: string; - }; - optionalInstances?: string[]; - tokenAddress?: string; - tokenGasLimit?: number; - symbol: string; - decimals: number; - gasLimit?: number; -}; +export interface TornadoInstance { + instanceAddress: { + [key: string]: string; + }; + optionalInstances?: string[]; + tokenAddress?: string; + tokenGasLimit?: number; + symbol: string; + decimals: number; + gasLimit?: number; +} -export type TokenInstances = { - [key in string]: TornadoInstance; -}; +export interface TokenInstances { + [key: string]: TornadoInstance; +} -export type Config = { - rpcCallRetryAttempt?: number; - // Should be in gwei - gasPrices: { - // fallback gasPrice / maxFeePerGas value - instant: number; - fast?: number; - standard?: number; - low?: number; - // fallback EIP-1559 params - maxPriorityFeePerGas?: number; - }; - nativeCurrency: string; - currencyName: string; - explorerUrl: string; - merkleTreeHeight: number; - emptyElement: string; - networkName: string; - deployedBlock: number; - rpcUrls: RpcUrls; - multicallContract: string; - routerContract: string; - echoContract: string; - offchainOracleContract?: string; - tornContract?: string; - governanceContract?: string; - stakingRewardsContract?: string; - registryContract?: string; - aggregatorContract?: string; - reverseRecordsContract?: string; - gasPriceOracleContract?: string; - gasStationApi?: string; - ovmGasPriceOracleContract?: string; - tornadoSubgraph: string; - registrySubgraph?: string; - governanceSubgraph?: string; - subgraphs: SubgraphUrls; - tokens: TokenInstances; - optionalTokens?: string[]; - relayerEnsSubdomain: string; - // Should be in seconds - pollInterval: number; - constants: { - GOVERNANCE_BLOCK?: number; - NOTE_ACCOUNT_BLOCK?: number; - ENCRYPTED_NOTES_BLOCK?: number; - REGISTRY_BLOCK?: number; +export interface Config { + rpcCallRetryAttempt?: number; + // Should be in gwei + gasPrices: { + // fallback gasPrice / maxFeePerGas value + instant: number; + fast?: number; + standard?: number; + low?: number; + // fallback EIP-1559 params + maxPriorityFeePerGas?: number; + }; + nativeCurrency: string; + currencyName: string; + explorerUrl: string; + merkleTreeHeight: number; + emptyElement: string; + networkName: string; + deployedBlock: number; + rpcUrls: RpcUrls; + // Contract Address of stablecoin token, used for fiat conversion + stablecoin: string; + multicallContract: string; + routerContract: string; + echoContract: string; + offchainOracleContract?: string; + tornContract?: string; + governanceContract?: string; + stakingRewardsContract?: string; + registryContract?: string; + aggregatorContract?: string; + reverseRecordsContract?: string; + ovmGasPriceOracleContract?: string; + tornadoSubgraph: string; + registrySubgraph?: string; + governanceSubgraph?: string; + subgraphs: SubgraphUrls; + tokens: TokenInstances; + optionalTokens?: string[]; + disabledTokens?: string[]; + relayerEnsSubdomain: string; // Should be in seconds - MINING_BLOCK_TIME?: number; - }; -}; + pollInterval: number; + constants: { + GOVERNANCE_BLOCK?: number; + NOTE_ACCOUNT_BLOCK?: number; + ENCRYPTED_NOTES_BLOCK?: number; + REGISTRY_BLOCK?: number; + // Should be in seconds + MINING_BLOCK_TIME?: number; + }; +} -export type networkConfig = { - [key in NetIdType]: Config; -}; +export interface networkConfig { + [key: NetIdType]: Config; +} -const theGraph = { - name: 'Hosted Graph', - url: 'https://api.thegraph.com', -}; -const tornado = { - name: 'Tornado Subgraphs', - url: 'https://tornadocash-rpc.com', -}; +export interface SubdomainMap { + [key: NetIdType]: string; +} export const defaultConfig: networkConfig = { - [NetId.MAINNET]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 80, - fast: 50, - standard: 25, - low: 8, - }, - nativeCurrency: 'eth', - currencyName: 'ETH', - explorerUrl: 'https://etherscan.io', - merkleTreeHeight: 20, - emptyElement: '21663839004416932945382355908790599225266501822907911457504978515578255421292', - networkName: 'Ethereum Mainnet', - deployedBlock: 9116966, - rpcUrls: { - tornadoRPC: { - name: 'Tornado RPC', - url: 'https://tornadocash-rpc.com/mainnet', - }, - chainnodes: { - name: 'Chainnodes RPC', - url: 'https://mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607', - }, - mevblockerRPC: { - name: 'MevblockerRPC', - url: 'https://rpc.mevblocker.io', - }, - oneRPC: { - name: '1RPC', - url: 'https://1rpc.io/eth', - }, - }, - multicallContract: '0xcA11bde05977b3631167028862bE2a173976CA11', - routerContract: '0xd90e2f925DA726b50C4Ed8D0Fb90Ad053324F31b', - echoContract: '0x9B27DD5Bb15d42DC224FCD0B7caEbBe16161Df42', - offchainOracleContract: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8', - tornContract: '0x77777FeDdddFfC19Ff86DB637967013e6C6A116C', - governanceContract: '0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce', - stakingRewardsContract: '0x5B3f656C80E8ddb9ec01Dd9018815576E9238c29', - registryContract: '0x58E8dCC13BE9780fC42E8723D8EaD4CF46943dF2', - aggregatorContract: '0xE8F47A78A6D52D317D0D2FFFac56739fE14D1b49', - reverseRecordsContract: '0x3671aE578E63FdF66ad4F3E12CC0c0d71Ac7510C', - tornadoSubgraph: 'tornadocash/mainnet-tornado-subgraph', - registrySubgraph: 'tornadocash/tornado-relayer-registry', - governanceSubgraph: 'tornadocash/tornado-governance', - subgraphs: { - tornado, - theGraph, - }, - tokens: { - eth: { - instanceAddress: { - '0.1': '0x12D66f87A04A9E220743712cE6d9bB1B5616B8Fc', - '1': '0x47CE0C6eD5B0Ce3d3A51fdb1C52DC66a7c3c2936', - '10': '0x910Cbd523D972eb0a6f4cAe4618aD62622b39DbF', - '100': '0xA160cdAB225685dA1d56aa342Ad8841c3b53f291', + [NetId.MAINNET]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 80, + fast: 50, + standard: 25, + low: 8, }, - symbol: 'ETH', - decimals: 18, - }, - dai: { - instanceAddress: { - '100': '0xD4B88Df4D29F5CedD6857912842cff3b20C8Cfa3', - '1000': '0xFD8610d20aA15b7B2E3Be39B396a1bC3516c7144', - '10000': '0x07687e702b410Fa43f4cB4Af7FA097918ffD2730', - '100000': '0x23773E65ed146A459791799d01336DB287f25334', + nativeCurrency: 'eth', + currencyName: 'ETH', + explorerUrl: 'https://etherscan.io', + merkleTreeHeight: 20, + emptyElement: '21663839004416932945382355908790599225266501822907911457504978515578255421292', + networkName: 'Ethereum Mainnet', + deployedBlock: 9116966, + rpcUrls: { + mevblockerRPC: { + name: 'MEV Blocker', + url: 'https://rpc.mevblocker.io', + }, + keydonix: { + name: 'Horswap ( Keydonix )', + url: 'https://ethereum.keydonix.com/v1/mainnet', + }, + SecureRpc: { + name: 'SecureRpc', + url: 'https://api.securerpc.com/v1', + }, + stackup: { + name: 'Stackup', + url: 'https://public.stackup.sh/api/v1/node/ethereum-mainnet', + }, + oneRpc: { + name: '1RPC', + url: 'https://1rpc.io/eth', + }, }, - tokenAddress: '0x6B175474E89094C44Da98b954EedeAC495271d0F', - tokenGasLimit: 70_000, - symbol: 'DAI', - decimals: 18, - gasLimit: 700_000, - }, - cdai: { - instanceAddress: { - '5000': '0x22aaA7720ddd5388A3c0A3333430953C68f1849b', - '50000': '0x03893a7c7463AE47D46bc7f091665f1893656003', - '500000': '0x2717c5e28cf931547B621a5dddb772Ab6A35B701', - '5000000': '0xD21be7248e0197Ee08E0c20D4a96DEBdaC3D20Af', + stablecoin: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', + multicallContract: '0xcA11bde05977b3631167028862bE2a173976CA11', + routerContract: '0xd90e2f925DA726b50C4Ed8D0Fb90Ad053324F31b', + echoContract: '0x9B27DD5Bb15d42DC224FCD0B7caEbBe16161Df42', + offchainOracleContract: '0x00000000000D6FFc74A8feb35aF5827bf57f6786', + tornContract: '0x77777FeDdddFfC19Ff86DB637967013e6C6A116C', + governanceContract: '0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce', + stakingRewardsContract: '0x5B3f656C80E8ddb9ec01Dd9018815576E9238c29', + registryContract: '0x58E8dCC13BE9780fC42E8723D8EaD4CF46943dF2', + aggregatorContract: '0xE8F47A78A6D52D317D0D2FFFac56739fE14D1b49', + reverseRecordsContract: '0x3671aE578E63FdF66ad4F3E12CC0c0d71Ac7510C', + tornadoSubgraph: 'tornadocash/mainnet-tornado-subgraph', + registrySubgraph: 'tornadocash/tornado-relayer-registry', + governanceSubgraph: 'tornadocash/tornado-governance', + subgraphs: {}, + tokens: { + eth: { + instanceAddress: { + '0.1': '0x12D66f87A04A9E220743712cE6d9bB1B5616B8Fc', + '1': '0x47CE0C6eD5B0Ce3d3A51fdb1C52DC66a7c3c2936', + '10': '0x910Cbd523D972eb0a6f4cAe4618aD62622b39DbF', + '100': '0xA160cdAB225685dA1d56aa342Ad8841c3b53f291', + }, + symbol: 'ETH', + decimals: 18, + }, + dai: { + instanceAddress: { + '100': '0xD4B88Df4D29F5CedD6857912842cff3b20C8Cfa3', + '1000': '0xFD8610d20aA15b7B2E3Be39B396a1bC3516c7144', + '10000': '0x07687e702b410Fa43f4cB4Af7FA097918ffD2730', + '100000': '0x23773E65ed146A459791799d01336DB287f25334', + }, + tokenAddress: '0x6B175474E89094C44Da98b954EedeAC495271d0F', + tokenGasLimit: 70_000, + symbol: 'DAI', + decimals: 18, + gasLimit: 700_000, + }, + cdai: { + instanceAddress: { + '5000': '0x22aaA7720ddd5388A3c0A3333430953C68f1849b', + '50000': '0x03893a7c7463AE47D46bc7f091665f1893656003', + '500000': '0x2717c5e28cf931547B621a5dddb772Ab6A35B701', + '5000000': '0xD21be7248e0197Ee08E0c20D4a96DEBdaC3D20Af', + }, + tokenAddress: '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643', + tokenGasLimit: 200_000, + symbol: 'cDAI', + decimals: 8, + gasLimit: 700_000, + }, + usdc: { + instanceAddress: { + '100': '0xd96f2B1c14Db8458374d9Aca76E26c3D18364307', + '1000': '0x4736dCf1b7A3d580672CcE6E7c65cd5cc9cFBa9D', + }, + tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', + tokenGasLimit: 70_000, + symbol: 'USDC', + decimals: 6, + gasLimit: 700_000, + }, + usdt: { + instanceAddress: { + '100': '0x169AD27A470D064DEDE56a2D3ff727986b15D52B', + '1000': '0x0836222F2B2B24A3F36f98668Ed8F0B38D1a872f', + }, + tokenAddress: '0xdAC17F958D2ee523a2206206994597C13D831ec7', + tokenGasLimit: 70_000, + symbol: 'USDT', + decimals: 6, + gasLimit: 700_000, + }, + wbtc: { + instanceAddress: { + '0.1': '0x178169B423a011fff22B9e3F3abeA13414dDD0F1', + '1': '0x610B717796ad172B316836AC95a2ffad065CeaB4', + '10': '0xbB93e510BbCD0B7beb5A853875f9eC60275CF498', + }, + tokenAddress: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', + tokenGasLimit: 70_000, + symbol: 'WBTC', + decimals: 8, + gasLimit: 700_000, + }, }, - tokenAddress: '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643', - tokenGasLimit: 200_000, - symbol: 'cDAI', - decimals: 8, - gasLimit: 700_000, - }, - usdc: { - instanceAddress: { - '100': '0xd96f2B1c14Db8458374d9Aca76E26c3D18364307', - '1000': '0x4736dCf1b7A3d580672CcE6E7c65cd5cc9cFBa9D', + // Inactive tokens to filter from schema verification and syncing events + disabledTokens: ['cdai', 'usdt', 'usdc'], + relayerEnsSubdomain: 'mainnet-tornado', + pollInterval: 15, + constants: { + GOVERNANCE_BLOCK: 11474695, + NOTE_ACCOUNT_BLOCK: 11842486, + ENCRYPTED_NOTES_BLOCK: 12143762, + REGISTRY_BLOCK: 14173129, + MINING_BLOCK_TIME: 15, }, - tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', - tokenGasLimit: 70_000, - symbol: 'USDC', - decimals: 6, - gasLimit: 700_000, - }, - usdt: { - instanceAddress: { - '100': '0x169AD27A470D064DEDE56a2D3ff727986b15D52B', - '1000': '0x0836222F2B2B24A3F36f98668Ed8F0B38D1a872f', + }, + [NetId.BSC]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 5, + fast: 5, + standard: 5, + low: 5, }, - tokenAddress: '0xdAC17F958D2ee523a2206206994597C13D831ec7', - tokenGasLimit: 70_000, - symbol: 'USDT', - decimals: 6, - gasLimit: 700_000, - }, - wbtc: { - instanceAddress: { - '0.1': '0x178169B423a011fff22B9e3F3abeA13414dDD0F1', - '1': '0x610B717796ad172B316836AC95a2ffad065CeaB4', - '10': '0xbB93e510BbCD0B7beb5A853875f9eC60275CF498', + nativeCurrency: 'bnb', + currencyName: 'BNB', + explorerUrl: 'https://bscscan.com', + merkleTreeHeight: 20, + emptyElement: '21663839004416932945382355908790599225266501822907911457504978515578255421292', + networkName: 'Binance Smart Chain', + deployedBlock: 8158799, + stablecoin: '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d', + multicallContract: '0xcA11bde05977b3631167028862bE2a173976CA11', + routerContract: '0x0D5550d52428E7e3175bfc9550207e4ad3859b17', + echoContract: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', + offchainOracleContract: '0x00000000000D6FFc74A8feb35aF5827bf57f6786', + tornadoSubgraph: 'tornadocash/bsc-tornado-subgraph', + subgraphs: {}, + rpcUrls: { + bnbchain: { + name: 'BNB Chain', + url: 'https://bsc-dataseed.bnbchain.org', + }, + ninicoin: { + name: 'BNB Chain 2', + url: 'https://bsc-dataseed1.ninicoin.io', + }, + nodereal: { + name: 'NodeReal', + url: 'https://binance.nodereal.io', + }, + stackup: { + name: 'Stackup', + url: 'https://public.stackup.sh/api/v1/node/bsc-mainnet', + }, + oneRpc: { + name: '1RPC', + url: 'https://1rpc.io/bnb', + }, }, - tokenAddress: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', - tokenGasLimit: 70_000, - symbol: 'WBTC', - decimals: 8, - gasLimit: 700_000, - }, - }, - relayerEnsSubdomain: 'mainnet-tornado', - pollInterval: 15, - constants: { - GOVERNANCE_BLOCK: 11474695, - NOTE_ACCOUNT_BLOCK: 11842486, - ENCRYPTED_NOTES_BLOCK: 12143762, - REGISTRY_BLOCK: 14173129, - MINING_BLOCK_TIME: 15, - }, - }, - [NetId.BSC]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 5, - fast: 5, - standard: 5, - low: 5, - }, - nativeCurrency: 'bnb', - currencyName: 'BNB', - explorerUrl: 'https://bscscan.com', - merkleTreeHeight: 20, - emptyElement: '21663839004416932945382355908790599225266501822907911457504978515578255421292', - networkName: 'Binance Smart Chain', - deployedBlock: 8158799, - multicallContract: '0xcA11bde05977b3631167028862bE2a173976CA11', - routerContract: '0x0D5550d52428E7e3175bfc9550207e4ad3859b17', - echoContract: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', - offchainOracleContract: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8', - tornadoSubgraph: 'tornadocash/bsc-tornado-subgraph', - subgraphs: { - tornado, - theGraph, - }, - rpcUrls: { - tornadoRPC: { - name: 'Tornado RPC', - url: 'https://tornadocash-rpc.com/bsc', - }, - chainnodes: { - name: 'Chainnodes RPC', - url: 'https://bsc-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607', - }, - oneRPC: { - name: '1RPC', - url: 'https://1rpc.io/bnb', - }, - }, - tokens: { - bnb: { - instanceAddress: { - '0.1': '0x84443CFd09A48AF6eF360C6976C5392aC5023a1F', - '1': '0xd47438C816c9E7f2E2888E060936a499Af9582b3', - '10': '0x330bdFADE01eE9bF63C209Ee33102DD334618e0a', - '100': '0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD', + tokens: { + bnb: { + instanceAddress: { + '0.1': '0x84443CFd09A48AF6eF360C6976C5392aC5023a1F', + '1': '0xd47438C816c9E7f2E2888E060936a499Af9582b3', + '10': '0x330bdFADE01eE9bF63C209Ee33102DD334618e0a', + '100': '0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD', + }, + symbol: 'BNB', + decimals: 18, + }, }, - symbol: 'BNB', - decimals: 18, - }, - }, - relayerEnsSubdomain: 'bsc-tornado', - pollInterval: 10, - constants: { - NOTE_ACCOUNT_BLOCK: 8159269, - ENCRYPTED_NOTES_BLOCK: 8159269, - }, - }, - [NetId.POLYGON]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 100, - fast: 75, - standard: 50, - low: 30, - }, - nativeCurrency: 'matic', - currencyName: 'MATIC', - explorerUrl: 'https://polygonscan.com', - merkleTreeHeight: 20, - emptyElement: '21663839004416932945382355908790599225266501822907911457504978515578255421292', - networkName: 'Polygon (Matic) Network', - deployedBlock: 16257962, - multicallContract: '0xcA11bde05977b3631167028862bE2a173976CA11', - routerContract: '0x0D5550d52428E7e3175bfc9550207e4ad3859b17', - echoContract: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', - offchainOracleContract: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8', - gasPriceOracleContract: '0xF81A8D8D3581985D3969fe53bFA67074aDFa8F3C', - tornadoSubgraph: 'tornadocash/matic-tornado-subgraph', - subgraphs: { - tornado, - theGraph, - }, - rpcUrls: { - chainnodes: { - name: 'Chainnodes RPC', - url: 'https://polygon-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607', - }, - oneRpc: { - name: '1RPC', - url: 'https://1rpc.io/matic', - }, - }, - tokens: { - matic: { - instanceAddress: { - '100': '0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD', - '1000': '0xdf231d99Ff8b6c6CBF4E9B9a945CBAcEF9339178', - '10000': '0xaf4c0B70B2Ea9FB7487C7CbB37aDa259579fe040', - '100000': '0xa5C2254e4253490C54cef0a4347fddb8f75A4998', + relayerEnsSubdomain: 'bsc-tornado', + pollInterval: 10, + constants: { + NOTE_ACCOUNT_BLOCK: 8159269, + ENCRYPTED_NOTES_BLOCK: 8159269, }, - symbol: 'MATIC', - decimals: 18, - }, }, - relayerEnsSubdomain: 'polygon-tornado', - pollInterval: 10, - constants: { - NOTE_ACCOUNT_BLOCK: 16257996, - ENCRYPTED_NOTES_BLOCK: 16257996, - }, - }, - [NetId.OPTIMISM]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 0.001, - fast: 0.001, - standard: 0.001, - low: 0.001, - }, - nativeCurrency: 'eth', - currencyName: 'ETH', - explorerUrl: 'https://optimistic.etherscan.io', - merkleTreeHeight: 20, - emptyElement: '21663839004416932945382355908790599225266501822907911457504978515578255421292', - networkName: 'Optimism', - deployedBlock: 2243689, - multicallContract: '0xcA11bde05977b3631167028862bE2a173976CA11', - routerContract: '0x0D5550d52428E7e3175bfc9550207e4ad3859b17', - echoContract: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', - offchainOracleContract: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8', - ovmGasPriceOracleContract: '0x420000000000000000000000000000000000000F', - tornadoSubgraph: 'tornadocash/optimism-tornado-subgraph', - subgraphs: { - tornado, - theGraph, - }, - rpcUrls: { - tornadoRPC: { - name: 'Tornado RPC', - url: 'https://tornadocash-rpc.com/op', - }, - chainnodes: { - name: 'Chainnodes RPC', - url: 'https://optimism-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607', - }, - oneRpc: { - name: '1RPC', - url: 'https://1rpc.io/op', - }, - }, - tokens: { - eth: { - instanceAddress: { - '0.1': '0x84443CFd09A48AF6eF360C6976C5392aC5023a1F', - '1': '0xd47438C816c9E7f2E2888E060936a499Af9582b3', - '10': '0x330bdFADE01eE9bF63C209Ee33102DD334618e0a', - '100': '0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD', + [NetId.POLYGON]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 100, + fast: 75, + standard: 50, + low: 30, }, - symbol: 'ETH', - decimals: 18, - }, - }, - relayerEnsSubdomain: 'optimism-tornado', - pollInterval: 15, - constants: { - NOTE_ACCOUNT_BLOCK: 2243694, - ENCRYPTED_NOTES_BLOCK: 2243694, - }, - }, - [NetId.ARBITRUM]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 4, - fast: 3, - standard: 2.52, - low: 2.29, - }, - nativeCurrency: 'eth', - currencyName: 'ETH', - explorerUrl: 'https://arbiscan.io', - merkleTreeHeight: 20, - emptyElement: '21663839004416932945382355908790599225266501822907911457504978515578255421292', - networkName: 'Arbitrum One', - deployedBlock: 3430648, - multicallContract: '0xcA11bde05977b3631167028862bE2a173976CA11', - routerContract: '0x0D5550d52428E7e3175bfc9550207e4ad3859b17', - echoContract: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', - offchainOracleContract: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8', - tornadoSubgraph: 'tornadocash/arbitrum-tornado-subgraph', - subgraphs: { - tornado, - theGraph, - }, - rpcUrls: { - tornadoRPC: { - name: 'Tornado RPC', - url: 'https://tornadocash-rpc.com/arbitrum', - }, - chainnodes: { - name: 'Chainnodes RPC', - url: 'https://arbitrum-one.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607', - }, - oneRpc: { - name: '1rpc', - url: 'https://1rpc.io/arb', - }, - Arbitrum: { - name: 'Arbitrum RPC', - url: 'https://arb1.arbitrum.io/rpc', - }, - }, - tokens: { - eth: { - instanceAddress: { - '0.1': '0x84443CFd09A48AF6eF360C6976C5392aC5023a1F', - '1': '0xd47438C816c9E7f2E2888E060936a499Af9582b3', - '10': '0x330bdFADE01eE9bF63C209Ee33102DD334618e0a', - '100': '0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD', + nativeCurrency: 'matic', + currencyName: 'MATIC', + explorerUrl: 'https://polygonscan.com', + merkleTreeHeight: 20, + emptyElement: '21663839004416932945382355908790599225266501822907911457504978515578255421292', + networkName: 'Polygon (Matic) Network', + deployedBlock: 16257962, + stablecoin: '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359', + multicallContract: '0xcA11bde05977b3631167028862bE2a173976CA11', + routerContract: '0x0D5550d52428E7e3175bfc9550207e4ad3859b17', + echoContract: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', + offchainOracleContract: '0x00000000000D6FFc74A8feb35aF5827bf57f6786', + tornadoSubgraph: 'tornadocash/matic-tornado-subgraph', + subgraphs: {}, + rpcUrls: { + oneRpc: { + name: '1RPC', + url: 'https://1rpc.io/matic', + }, + stackup: { + name: 'Stackup', + url: 'https://public.stackup.sh/api/v1/node/polygon-mainnet', + }, }, - symbol: 'ETH', - decimals: 18, - }, - }, - relayerEnsSubdomain: 'arbitrum-tornado', - pollInterval: 15, - constants: { - NOTE_ACCOUNT_BLOCK: 3430605, - ENCRYPTED_NOTES_BLOCK: 3430605, - }, - }, - [NetId.GNOSIS]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 6, - fast: 5, - standard: 4, - low: 1, - }, - nativeCurrency: 'xdai', - currencyName: 'xDAI', - explorerUrl: 'https://gnosisscan.io', - merkleTreeHeight: 20, - emptyElement: '21663839004416932945382355908790599225266501822907911457504978515578255421292', - networkName: 'Gnosis Chain', - deployedBlock: 17754561, - multicallContract: '0xcA11bde05977b3631167028862bE2a173976CA11', - routerContract: '0x0D5550d52428E7e3175bfc9550207e4ad3859b17', - echoContract: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', - offchainOracleContract: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8', - tornadoSubgraph: 'tornadocash/xdai-tornado-subgraph', - subgraphs: { - tornado, - theGraph, - }, - rpcUrls: { - tornadoRPC: { - name: 'Tornado RPC', - url: 'https://tornadocash-rpc.com/gnosis', - }, - chainnodes: { - name: 'Chainnodes RPC', - url: 'https://gnosis-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607', - }, - blockPi: { - name: 'BlockPi', - url: 'https://gnosis.blockpi.network/v1/rpc/public', - }, - }, - tokens: { - xdai: { - instanceAddress: { - '100': '0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD', - '1000': '0xdf231d99Ff8b6c6CBF4E9B9a945CBAcEF9339178', - '10000': '0xaf4c0B70B2Ea9FB7487C7CbB37aDa259579fe040', - '100000': '0xa5C2254e4253490C54cef0a4347fddb8f75A4998', + tokens: { + matic: { + instanceAddress: { + '100': '0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD', + '1000': '0xdf231d99Ff8b6c6CBF4E9B9a945CBAcEF9339178', + '10000': '0xaf4c0B70B2Ea9FB7487C7CbB37aDa259579fe040', + '100000': '0xa5C2254e4253490C54cef0a4347fddb8f75A4998', + }, + symbol: 'MATIC', + decimals: 18, + }, }, - symbol: 'xDAI', - decimals: 18, - }, - }, - relayerEnsSubdomain: 'gnosis-tornado', - pollInterval: 15, - constants: { - NOTE_ACCOUNT_BLOCK: 17754564, - ENCRYPTED_NOTES_BLOCK: 17754564, - }, - }, - [NetId.AVALANCHE]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 225, - fast: 35, - standard: 25, - low: 25, - }, - nativeCurrency: 'avax', - currencyName: 'AVAX', - explorerUrl: 'https://snowtrace.io', - merkleTreeHeight: 20, - emptyElement: '21663839004416932945382355908790599225266501822907911457504978515578255421292', - networkName: 'Avalanche Mainnet', - deployedBlock: 4429818, - multicallContract: '0xcA11bde05977b3631167028862bE2a173976CA11', - routerContract: '0x0D5550d52428E7e3175bfc9550207e4ad3859b17', - echoContract: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', - offchainOracleContract: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8', - tornadoSubgraph: 'tornadocash/avalanche-tornado-subgraph', - subgraphs: { - theGraph, - }, - rpcUrls: { - publicRpc: { - name: 'Avalanche RPC', - url: 'https://api.avax.network/ext/bc/C/rpc', - }, - meowRPC: { - name: 'Meow RPC', - url: 'https://avax.meowrpc.com', - }, - oneRPC: { - name: 'OneRPC', - url: 'https://1rpc.io/avax/c', - }, - }, - tokens: { - avax: { - instanceAddress: { - '10': '0x330bdFADE01eE9bF63C209Ee33102DD334618e0a', - '100': '0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD', - '500': '0xaf8d1839c3c67cf571aa74B5c12398d4901147B3', + relayerEnsSubdomain: 'polygon-tornado', + pollInterval: 10, + constants: { + NOTE_ACCOUNT_BLOCK: 16257996, + ENCRYPTED_NOTES_BLOCK: 16257996, }, - symbol: 'AVAX', - decimals: 18, - }, }, - relayerEnsSubdomain: 'avalanche-tornado', - pollInterval: 10, - constants: { - NOTE_ACCOUNT_BLOCK: 4429813, - ENCRYPTED_NOTES_BLOCK: 4429813, - }, - }, - [NetId.SEPOLIA]: { - rpcCallRetryAttempt: 15, - gasPrices: { - instant: 2, - fast: 2, - standard: 2, - low: 2, - }, - nativeCurrency: 'eth', - currencyName: 'SepoliaETH', - explorerUrl: 'https://sepolia.etherscan.io', - merkleTreeHeight: 20, - emptyElement: '21663839004416932945382355908790599225266501822907911457504978515578255421292', - networkName: 'Ethereum Sepolia', - deployedBlock: 5594395, - multicallContract: '0xcA11bde05977b3631167028862bE2a173976CA11', - routerContract: '0x1572AFE6949fdF51Cb3E0856216670ae9Ee160Ee', - echoContract: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', - tornContract: '0x3AE6667167C0f44394106E197904519D808323cA', - governanceContract: '0xe5324cD7602eeb387418e594B87aCADee08aeCAD', - stakingRewardsContract: '0x6d0018890751Efd31feb8166711B16732E2b496b', - registryContract: '0x1428e5d2356b13778A13108b10c440C83011dfB8', - aggregatorContract: '0x4088712AC9fad39ea133cdb9130E465d235e9642', - reverseRecordsContract: '0xEc29700C0283e5Be64AcdFe8077d6cC95dE23C23', - tornadoSubgraph: 'tornadocash/sepolia-tornado-subgraph', - subgraphs: { - tornado, - }, - rpcUrls: { - tornadoRPC: { - name: 'Tornado RPC', - url: 'https://tornadocash-rpc.com/sepolia', - }, - sepolia: { - name: 'Sepolia RPC', - url: 'https://rpc.sepolia.org', - }, - chainnodes: { - name: 'Chainnodes RPC', - url: 'https://sepolia.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607', - }, - }, - tokens: { - eth: { - instanceAddress: { - '0.1': '0x8C4A04d872a6C1BE37964A21ba3a138525dFF50b', - '1': '0x8cc930096B4Df705A007c4A039BDFA1320Ed2508', - '10': '0x8D10d506D29Fc62ABb8A290B99F66dB27Fc43585', - '100': '0x44c5C92ed73dB43888210264f0C8b36Fd68D8379', + [NetId.OPTIMISM]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 0.001, + fast: 0.001, + standard: 0.001, + low: 0.001, }, - symbol: 'ETH', - decimals: 18, - }, - dai: { - instanceAddress: { - '100': '0x6921fd1a97441dd603a997ED6DDF388658daf754', - '1000': '0x50a637770F5d161999420F7d70d888DE47207145', - '10000': '0xecD649870407cD43923A816Cc6334a5bdf113621', - '100000': '0x73B4BD04bF83206B6e979BE2507098F92EDf4F90', + nativeCurrency: 'eth', + currencyName: 'ETH', + explorerUrl: 'https://optimistic.etherscan.io', + merkleTreeHeight: 20, + emptyElement: '21663839004416932945382355908790599225266501822907911457504978515578255421292', + networkName: 'Optimism', + deployedBlock: 2243689, + stablecoin: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85', + multicallContract: '0xcA11bde05977b3631167028862bE2a173976CA11', + routerContract: '0x0D5550d52428E7e3175bfc9550207e4ad3859b17', + echoContract: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', + offchainOracleContract: '0x00000000000D6FFc74A8feb35aF5827bf57f6786', + ovmGasPriceOracleContract: '0x420000000000000000000000000000000000000F', + tornadoSubgraph: 'tornadocash/optimism-tornado-subgraph', + subgraphs: {}, + rpcUrls: { + oneRpc: { + name: '1RPC', + url: 'https://1rpc.io/op', + }, + stackup: { + name: 'Stackup', + url: 'https://public.stackup.sh/api/v1/node/optimism-mainnet', + }, + }, + tokens: { + eth: { + instanceAddress: { + '0.1': '0x84443CFd09A48AF6eF360C6976C5392aC5023a1F', + '1': '0xd47438C816c9E7f2E2888E060936a499Af9582b3', + '10': '0x330bdFADE01eE9bF63C209Ee33102DD334618e0a', + '100': '0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD', + }, + symbol: 'ETH', + decimals: 18, + }, + }, + relayerEnsSubdomain: 'optimism-tornado', + pollInterval: 15, + constants: { + NOTE_ACCOUNT_BLOCK: 2243694, + ENCRYPTED_NOTES_BLOCK: 2243694, }, - tokenAddress: '0xFF34B3d4Aee8ddCd6F9AFFFB6Fe49bD371b8a357', - tokenGasLimit: 70_000, - symbol: 'DAI', - decimals: 18, - gasLimit: 700_000, - }, }, - relayerEnsSubdomain: 'sepolia-tornado', - pollInterval: 15, - constants: { - GOVERNANCE_BLOCK: 5594395, - NOTE_ACCOUNT_BLOCK: 5594395, - ENCRYPTED_NOTES_BLOCK: 5594395, - MINING_BLOCK_TIME: 15, + [NetId.ARBITRUM]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 4, + fast: 3, + standard: 2.52, + low: 2.29, + }, + nativeCurrency: 'eth', + currencyName: 'ETH', + explorerUrl: 'https://arbiscan.io', + merkleTreeHeight: 20, + emptyElement: '21663839004416932945382355908790599225266501822907911457504978515578255421292', + networkName: 'Arbitrum One', + deployedBlock: 3430648, + stablecoin: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831', + multicallContract: '0xcA11bde05977b3631167028862bE2a173976CA11', + routerContract: '0x0D5550d52428E7e3175bfc9550207e4ad3859b17', + echoContract: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', + offchainOracleContract: '0x00000000000D6FFc74A8feb35aF5827bf57f6786', + tornadoSubgraph: 'tornadocash/arbitrum-tornado-subgraph', + subgraphs: {}, + rpcUrls: { + Arbitrum: { + name: 'Arbitrum', + url: 'https://arb1.arbitrum.io/rpc', + }, + stackup: { + name: 'Stackup', + url: 'https://public.stackup.sh/api/v1/node/arbitrum-one', + }, + oneRpc: { + name: '1RPC', + url: 'https://1rpc.io/arb', + }, + }, + tokens: { + eth: { + instanceAddress: { + '0.1': '0x84443CFd09A48AF6eF360C6976C5392aC5023a1F', + '1': '0xd47438C816c9E7f2E2888E060936a499Af9582b3', + '10': '0x330bdFADE01eE9bF63C209Ee33102DD334618e0a', + '100': '0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD', + }, + symbol: 'ETH', + decimals: 18, + }, + }, + relayerEnsSubdomain: 'arbitrum-tornado', + pollInterval: 15, + constants: { + NOTE_ACCOUNT_BLOCK: 3430605, + ENCRYPTED_NOTES_BLOCK: 3430605, + }, + }, + [NetId.GNOSIS]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 6, + fast: 5, + standard: 4, + low: 1, + }, + nativeCurrency: 'xdai', + currencyName: 'xDAI', + explorerUrl: 'https://gnosisscan.io', + merkleTreeHeight: 20, + emptyElement: '21663839004416932945382355908790599225266501822907911457504978515578255421292', + networkName: 'Gnosis Chain', + deployedBlock: 17754561, + stablecoin: '0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83', + multicallContract: '0xcA11bde05977b3631167028862bE2a173976CA11', + routerContract: '0x0D5550d52428E7e3175bfc9550207e4ad3859b17', + echoContract: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', + offchainOracleContract: '0x00000000000D6FFc74A8feb35aF5827bf57f6786', + tornadoSubgraph: 'tornadocash/xdai-tornado-subgraph', + subgraphs: {}, + rpcUrls: { + gnosis: { + name: 'Gnosis', + url: 'https://rpc.gnosischain.com', + }, + oneRpc: { + name: '1RPC', + url: 'https://1rpc.io/gnosis', + }, + }, + tokens: { + xdai: { + instanceAddress: { + '100': '0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD', + '1000': '0xdf231d99Ff8b6c6CBF4E9B9a945CBAcEF9339178', + '10000': '0xaf4c0B70B2Ea9FB7487C7CbB37aDa259579fe040', + '100000': '0xa5C2254e4253490C54cef0a4347fddb8f75A4998', + }, + symbol: 'xDAI', + decimals: 18, + }, + }, + relayerEnsSubdomain: 'gnosis-tornado', + pollInterval: 15, + constants: { + NOTE_ACCOUNT_BLOCK: 17754564, + ENCRYPTED_NOTES_BLOCK: 17754564, + }, + }, + [NetId.AVALANCHE]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 225, + fast: 35, + standard: 25, + low: 25, + }, + nativeCurrency: 'avax', + currencyName: 'AVAX', + explorerUrl: 'https://snowtrace.io', + merkleTreeHeight: 20, + emptyElement: '21663839004416932945382355908790599225266501822907911457504978515578255421292', + networkName: 'Avalanche Mainnet', + deployedBlock: 4429818, + stablecoin: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E', + multicallContract: '0xcA11bde05977b3631167028862bE2a173976CA11', + routerContract: '0x0D5550d52428E7e3175bfc9550207e4ad3859b17', + echoContract: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', + offchainOracleContract: '0x00000000000D6FFc74A8feb35aF5827bf57f6786', + tornadoSubgraph: 'tornadocash/avalanche-tornado-subgraph', + subgraphs: {}, + rpcUrls: { + oneRpc: { + name: '1RPC', + url: 'https://1rpc.io/avax/c', + }, + stackup: { + name: 'Stackup', + url: 'https://public.stackup.sh/api/v1/node/avalanche-mainnet', + }, + }, + tokens: { + avax: { + instanceAddress: { + '10': '0x330bdFADE01eE9bF63C209Ee33102DD334618e0a', + '100': '0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD', + '500': '0xaf8d1839c3c67cf571aa74B5c12398d4901147B3', + }, + symbol: 'AVAX', + decimals: 18, + }, + }, + relayerEnsSubdomain: 'avalanche-tornado', + pollInterval: 10, + constants: { + NOTE_ACCOUNT_BLOCK: 4429813, + ENCRYPTED_NOTES_BLOCK: 4429813, + }, + }, + [NetId.SEPOLIA]: { + rpcCallRetryAttempt: 15, + gasPrices: { + instant: 2, + fast: 2, + standard: 2, + low: 2, + }, + nativeCurrency: 'eth', + currencyName: 'SepoliaETH', + explorerUrl: 'https://sepolia.etherscan.io', + merkleTreeHeight: 20, + emptyElement: '21663839004416932945382355908790599225266501822907911457504978515578255421292', + networkName: 'Ethereum Sepolia', + deployedBlock: 5594395, + stablecoin: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238', + multicallContract: '0xcA11bde05977b3631167028862bE2a173976CA11', + routerContract: '0x1572AFE6949fdF51Cb3E0856216670ae9Ee160Ee', + echoContract: '0xcDD1fc3F5ac2782D83449d3AbE80D6b7B273B0e5', + offchainOracleContract: '0x1f89EAF03E5b260Bc6D4Ae3c3334b1B750F3e127', + tornContract: '0x3AE6667167C0f44394106E197904519D808323cA', + governanceContract: '0xe5324cD7602eeb387418e594B87aCADee08aeCAD', + stakingRewardsContract: '0x6d0018890751Efd31feb8166711B16732E2b496b', + registryContract: '0x1428e5d2356b13778A13108b10c440C83011dfB8', + aggregatorContract: '0x4088712AC9fad39ea133cdb9130E465d235e9642', + reverseRecordsContract: '0xEc29700C0283e5Be64AcdFe8077d6cC95dE23C23', + tornadoSubgraph: 'tornadocash/sepolia-tornado-subgraph', + subgraphs: {}, + rpcUrls: { + sepolia: { + name: 'Sepolia RPC', + url: 'https://rpc.sepolia.org', + }, + stackup: { + name: 'Stackup', + url: 'https://public.stackup.sh/api/v1/node/ethereum-sepolia', + }, + oneRpc: { + name: '1RPC', + url: 'https://1rpc.io/sepolia', + }, + ethpandaops: { + name: 'ethpandaops', + url: 'https://rpc.sepolia.ethpandaops.io', + }, + }, + tokens: { + eth: { + instanceAddress: { + '0.1': '0x8C4A04d872a6C1BE37964A21ba3a138525dFF50b', + '1': '0x8cc930096B4Df705A007c4A039BDFA1320Ed2508', + '10': '0x8D10d506D29Fc62ABb8A290B99F66dB27Fc43585', + '100': '0x44c5C92ed73dB43888210264f0C8b36Fd68D8379', + }, + symbol: 'ETH', + decimals: 18, + }, + dai: { + instanceAddress: { + '100': '0x6921fd1a97441dd603a997ED6DDF388658daf754', + '1000': '0x50a637770F5d161999420F7d70d888DE47207145', + '10000': '0xecD649870407cD43923A816Cc6334a5bdf113621', + '100000': '0x73B4BD04bF83206B6e979BE2507098F92EDf4F90', + }, + tokenAddress: '0xFF34B3d4Aee8ddCd6F9AFFFB6Fe49bD371b8a357', + tokenGasLimit: 70_000, + symbol: 'DAI', + decimals: 18, + gasLimit: 700_000, + }, + }, + relayerEnsSubdomain: 'sepolia-tornado', + pollInterval: 15, + constants: { + GOVERNANCE_BLOCK: 5594395, + NOTE_ACCOUNT_BLOCK: 5594395, + ENCRYPTED_NOTES_BLOCK: 5594395, + REGISTRY_BLOCK: 5594395, + MINING_BLOCK_TIME: 15, + }, }, - }, }; export const enabledChains = Object.values(NetId).filter((n) => typeof n === 'number') as NetIdType[]; @@ -682,61 +669,103 @@ export let customConfig: networkConfig = {}; * Could be also called on the UI hook so that the UI could allow people to use custom privacy pools */ export function addNetwork(newConfig: networkConfig) { - enabledChains.push( - ...Object.keys(newConfig) - .map((netId) => Number(netId)) - .filter((netId) => !enabledChains.includes(netId)), - ); + enabledChains.push( + ...Object.keys(newConfig) + .map((netId) => Number(netId)) + .filter((netId) => !enabledChains.includes(netId)), + ); - customConfig = { - ...customConfig, - ...newConfig, - }; + customConfig = { + ...customConfig, + ...newConfig, + }; } export function getNetworkConfig(): networkConfig { - // customConfig object - const allConfig = { - ...defaultConfig, - ...customConfig, - }; + // customConfig object + const allConfig = { + ...defaultConfig, + ...customConfig, + }; - return enabledChains.reduce((acc, curr) => { - acc[curr] = allConfig[curr]; - return acc; - }, {} as networkConfig); + return enabledChains.reduce((acc, curr) => { + acc[curr] = allConfig[curr]; + return acc; + }, {} as networkConfig); } export function getConfig(netId: NetIdType) { - const allConfig = getNetworkConfig(); + const allConfig = getNetworkConfig(); - const chainConfig = allConfig[netId]; + const chainConfig = allConfig[netId]; - if (!chainConfig) { - const errMsg = `No config found for network ${netId}!`; - throw new Error(errMsg); - } - - return chainConfig; -} - -export function getInstanceByAddress({ netId, address }: { netId: NetIdType; address: string }) { - const { tokens } = getConfig(netId); - - for (const [currency, { instanceAddress }] of Object.entries(tokens)) { - for (const [amount, instance] of Object.entries(instanceAddress)) { - if (instance === address) { - return { - amount, - currency, - }; - } + if (!chainConfig) { + const errMsg = `No config found for network ${netId}!`; + throw new Error(errMsg); } - } + + return chainConfig; } -export function getSubdomains() { - const allConfig = getNetworkConfig(); +export function getActiveTokens(config: Config): string[] { + const { tokens, disabledTokens } = config; - return enabledChains.map((chain) => allConfig[chain].relayerEnsSubdomain); + return Object.keys(tokens).filter((t) => !disabledTokens?.includes(t)); +} + +export function getActiveTokenInstances(config: Config): TokenInstances { + const { tokens, disabledTokens } = config; + + return Object.entries(tokens).reduce((acc, [token, instances]) => { + if (!disabledTokens?.includes(token)) { + acc[token] = instances; + } + return acc; + }, {} as TokenInstances); +} + +export function getInstanceByAddress(config: Config, address: string) { + const { tokens, disabledTokens } = config; + + for (const [currency, { instanceAddress, tokenAddress, symbol, decimals }] of Object.entries(tokens)) { + if (disabledTokens?.includes(currency)) { + continue; + } + for (const [amount, instance] of Object.entries(instanceAddress)) { + if (instance === address) { + return { + amount, + currency, + symbol, + decimals, + tokenAddress, + }; + } + } + } +} + +export function getRelayerEnsSubdomains() { + const allConfig = getNetworkConfig(); + + return enabledChains.reduce((acc, chain) => { + acc[chain] = allConfig[chain].relayerEnsSubdomain; + return acc; + }, {} as SubdomainMap); +} + +export function getMultiInstances(netId: NetIdType, config: Config): { [key in string]: DepositType } { + return Object.entries(config.tokens).reduce( + (acc, [currency, { instanceAddress }]) => { + Object.entries(instanceAddress).forEach(([amount, contractAddress]) => { + acc[contractAddress] = { + currency, + amount, + netId, + }; + }); + return acc; + }, + {} as { [key in string]: DepositType }, + ); } diff --git a/src/pedersen.ts b/src/pedersen.ts index 8440621..bb3290e 100644 --- a/src/pedersen.ts +++ b/src/pedersen.ts @@ -1,32 +1,32 @@ import { BabyJub, PedersenHash, Point, buildPedersenHash } from 'circomlibjs'; export class Pedersen { - pedersenHash?: PedersenHash; - babyJub?: BabyJub; - pedersenPromise: Promise; + pedersenHash?: PedersenHash; + babyJub?: BabyJub; + pedersenPromise: Promise; - constructor() { - this.pedersenPromise = this.initPedersen(); - } + constructor() { + this.pedersenPromise = this.initPedersen(); + } - async initPedersen() { - this.pedersenHash = await buildPedersenHash(); - this.babyJub = this.pedersenHash.babyJub; - } + async initPedersen() { + this.pedersenHash = await buildPedersenHash(); + this.babyJub = this.pedersenHash.babyJub; + } - async unpackPoint(buffer: Uint8Array) { - await this.pedersenPromise; - return this.babyJub?.unpackPoint(this.pedersenHash?.hash(buffer) as Uint8Array); - } + async unpackPoint(buffer: Uint8Array) { + await this.pedersenPromise; + return this.babyJub?.unpackPoint(this.pedersenHash?.hash(buffer) as Uint8Array); + } - toStringBuffer(buffer: Uint8Array): string { - return this.babyJub?.F.toString(buffer); - } + toStringBuffer(buffer: Uint8Array): string { + return this.babyJub?.F.toString(buffer); + } } export const pedersen = new Pedersen(); export async function buffPedersenHash(buffer: Uint8Array): Promise { - const [hash] = (await pedersen.unpackPoint(buffer)) as Point; - return pedersen.toStringBuffer(hash); + const [hash] = (await pedersen.unpackPoint(buffer)) as Point; + return pedersen.toStringBuffer(hash); } diff --git a/src/permit.ts b/src/permit.ts new file mode 100644 index 0000000..f7e0dee --- /dev/null +++ b/src/permit.ts @@ -0,0 +1,242 @@ +import { ERC20Permit, ERC20Mock, TORN, PermitTornado } from '@tornado/contracts'; +import { + BaseContract, + MaxUint256, + Provider, + Signature, + Signer, + solidityPackedKeccak256, + TypedDataEncoder, + TypedDataField, +} from 'ethers'; +import { rBigInt } from './utils'; + +export interface PermitValue { + spender: string; + value: bigint; + nonce?: bigint; + deadline?: bigint; +} + +export interface PermitCommitments { + denomination: bigint; + commitments: string[]; + nonce?: bigint; + deadline?: bigint; +} + +export const permit2Address = '0x000000000022D473030F116dDEE9F6B43aC78BA3'; + +/** + * From @uniswap/permit2-sdk ported for ethers.js v6 + */ +export interface Witness { + witnessTypeName: string; + witnessType: { + [key: string]: TypedDataField[]; + }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + witness: any; +} + +export async function getPermitSignature({ + Token, + signer, + spender, + value, + nonce, + deadline, +}: PermitValue & { + Token: ERC20Permit | ERC20Mock | TORN; + signer?: Signer; +}) { + const sigSigner = (signer || Token.runner) as Signer & { address: string }; + const provider = sigSigner.provider as Provider; + + const [name, lastNonce, { chainId }] = await Promise.all([ + Token.name(), + Token.nonces(sigSigner.address), + provider.getNetwork(), + ]); + + const DOMAIN_SEPARATOR = { + name, + version: '1', + chainId, + verifyingContract: Token.target as string, + }; + + const PERMIT_TYPE = { + Permit: [ + { name: 'owner', type: 'address' }, + { name: 'spender', type: 'address' }, + { name: 'value', type: 'uint256' }, + { name: 'nonce', type: 'uint256' }, + { name: 'deadline', type: 'uint256' }, + ], + }; + + return Signature.from( + await sigSigner.signTypedData(DOMAIN_SEPARATOR, PERMIT_TYPE, { + owner: sigSigner.address, + spender, + value, + nonce: nonce || lastNonce, + deadline: deadline || MaxUint256, + }), + ); +} + +export async function getPermitCommitmentsSignature({ + PermitTornado, + Token, + signer, + denomination, + commitments, + nonce, +}: PermitCommitments & { + PermitTornado: PermitTornado; + Token: ERC20Permit | ERC20Mock | TORN; + signer?: Signer; +}) { + const value = BigInt(commitments.length) * denomination; + const commitmentsHash = solidityPackedKeccak256(['bytes32[]'], [commitments]); + + return await getPermitSignature({ + Token, + signer, + spender: PermitTornado.target as string, + value, + nonce, + deadline: BigInt(commitmentsHash), + }); +} + +export async function getPermit2Signature({ + Token, + signer, + spender, + value: amount, + nonce, + deadline, + witness, +}: PermitValue & { + Token: BaseContract; + signer?: Signer; + witness?: Witness; +}) { + const sigSigner = (signer || Token.runner) as Signer & { address: string }; + const provider = sigSigner.provider as Provider; + + const domain = { + name: 'Permit2', + chainId: (await provider.getNetwork()).chainId, + verifyingContract: permit2Address, + }; + + const types: { + [key: string]: TypedDataField[]; + } = !witness + ? { + PermitTransferFrom: [ + { name: 'permitted', type: 'TokenPermissions' }, + { name: 'spender', type: 'address' }, + { name: 'nonce', type: 'uint256' }, + { name: 'deadline', type: 'uint256' }, + ], + TokenPermissions: [ + { name: 'token', type: 'address' }, + { name: 'amount', type: 'uint256' }, + ], + } + : { + PermitWitnessTransferFrom: [ + { name: 'permitted', type: 'TokenPermissions' }, + { name: 'spender', type: 'address' }, + { name: 'nonce', type: 'uint256' }, + { name: 'deadline', type: 'uint256' }, + { name: 'witness', type: witness.witnessTypeName }, + ], + TokenPermissions: [ + { name: 'token', type: 'address' }, + { name: 'amount', type: 'uint256' }, + ], + ...witness.witnessType, + }; + + const values: { + permitted: { + token: string; + amount: bigint; + }; + spender: string; + nonce: bigint; + deadline: bigint; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + witness?: any; + } = { + permitted: { + token: Token.target as string, + amount, + }, + spender, + // Sorted nonce are not required for Permit2 + nonce: nonce || rBigInt(16), + deadline: deadline || MaxUint256, + }; + + if (witness) { + values.witness = witness.witness; + } + + const hash = new TypedDataEncoder(types).hash(values); + + const signature = Signature.from(await sigSigner.signTypedData(domain, types, values)); + + return { + domain, + types, + values, + hash, + signature, + }; +} + +export async function getPermit2CommitmentsSignature({ + PermitTornado, + Token, + signer, + denomination, + commitments, + nonce, + deadline, +}: PermitCommitments & { + PermitTornado: PermitTornado; + Token: BaseContract; + signer?: Signer; +}) { + const value = BigInt(commitments.length) * denomination; + const commitmentsHash = solidityPackedKeccak256(['bytes32[]'], [commitments]); + + return await getPermit2Signature({ + Token, + signer, + spender: PermitTornado.target as string, + value, + nonce, + deadline, + witness: { + witnessTypeName: 'PermitCommitments', + witnessType: { + PermitCommitments: [ + { name: 'instance', type: 'address' }, + { name: 'commitmentsHash', type: 'bytes32' }, + ], + }, + witness: { + instance: PermitTornado.target, + commitmentsHash, + }, + }, + }); +} diff --git a/src/prices.ts b/src/prices.ts index 35097d0..578c06c 100644 --- a/src/prices.ts +++ b/src/prices.ts @@ -1,40 +1,103 @@ -import { parseEther, type Provider } from 'ethers'; -import type { OffchainOracle, Multicall } from './typechain'; -import { multicall } from './multicall'; +import { formatEther, parseEther, type Provider } from 'ethers'; +import { ERC20__factory, OffchainOracle, Multicall } from './typechain'; +import { multicall, Call3 } from './multicall'; export class TokenPriceOracle { - oracle?: OffchainOracle; - multicall: Multicall; - provider: Provider; + oracle?: OffchainOracle; + multicall: Multicall; + provider: Provider; - constructor(provider: Provider, multicall: Multicall, oracle?: OffchainOracle) { - this.provider = provider; - this.multicall = multicall; - this.oracle = oracle; - } + fallbackPrice: bigint; - async fetchPrices( - tokens: { - tokenAddress: string; - decimals: number; - }[], - ): Promise { - // setup mock price for testnets - if (!this.oracle) { - return new Promise((resolve) => resolve(tokens.map(() => parseEther('0.0001')))); + constructor(provider: Provider, multicall: Multicall, oracle?: OffchainOracle) { + this.provider = provider; + this.multicall = multicall; + this.oracle = oracle; + this.fallbackPrice = parseEther('0.0001'); } - const prices = (await multicall( - this.multicall, - tokens.map(({ tokenAddress }) => ({ - contract: this.oracle, - name: 'getRateToEth', - params: [tokenAddress, true], - })), - )) as bigint[]; + buildCalls( + tokens: { + tokenAddress: string; + decimals: number; + }[], + ): Call3[] { + return tokens.map(({ tokenAddress }) => ({ + contract: this.oracle, + name: 'getRateToEth', + params: [tokenAddress, true], + allowFailure: true, + })); + } - return prices.map((price, index) => { - return (price * BigInt(10 ** tokens[index].decimals)) / BigInt(10 ** 18); - }); - } + buildStable(stablecoinAddress: string): Call3[] { + const stablecoin = ERC20__factory.connect(stablecoinAddress, this.provider); + + return [ + { + contract: stablecoin, + name: 'decimals', + }, + { + contract: this.oracle, + name: 'getRateToEth', + params: [stablecoin.target, true], + allowFailure: true, + }, + ]; + } + + async fetchPrice(tokenAddress: string, decimals: number): Promise { + // setup mock price for testnets + if (!this.oracle) { + return new Promise((resolve) => resolve(this.fallbackPrice)); + } + + try { + const price = await this.oracle.getRateToEth(tokenAddress, true); + + return (price * BigInt(10 ** decimals)) / BigInt(10 ** 18); + } catch (err) { + console.log( + `Failed to fetch oracle price for ${tokenAddress}, will use fallback price ${this.fallbackPrice}`, + ); + console.log(err); + return this.fallbackPrice; + } + } + + async fetchPrices( + tokens: { + tokenAddress: string; + decimals: number; + }[], + ): Promise { + // setup mock price for testnets + if (!this.oracle) { + return new Promise((resolve) => resolve(tokens.map(() => this.fallbackPrice))); + } + + const prices = (await multicall(this.multicall, this.buildCalls(tokens))) as (bigint | null)[]; + + return prices.map((price, index) => { + if (!price) { + price = this.fallbackPrice; + } + return (price * BigInt(10 ** tokens[index].decimals)) / BigInt(10 ** 18); + }); + } + + async fetchEthUSD(stablecoinAddress: string): Promise { + // setup mock price for testnets + if (!this.oracle) { + return new Promise((resolve) => resolve(10 ** 18 / Number(this.fallbackPrice))); + } + + const [decimals, price] = await multicall(this.multicall, this.buildStable(stablecoinAddress)); + + // eth wei price of usdc token + const ethPrice = ((price || this.fallbackPrice) * BigInt(10n ** decimals)) / BigInt(10 ** 18); + + return 1 / Number(formatEther(ethPrice)); + } } diff --git a/src/providers.ts b/src/providers.ts index cecf4a3..39aa93e 100644 --- a/src/providers.ts +++ b/src/providers.ts @@ -2,601 +2,475 @@ import type { EventEmitter } from 'stream'; import type { RequestOptions } from 'http'; import crossFetch from 'cross-fetch'; import { - FetchRequest, - JsonRpcApiProvider, - JsonRpcProvider, - Wallet, - HDNodeWallet, - FetchGetUrlFunc, - Provider, - SigningKey, - TransactionRequest, - JsonRpcSigner, - BrowserProvider, - Networkish, - Eip1193Provider, - VoidSigner, - Network, - parseUnits, - FetchUrlFeeDataNetworkPlugin, - FeeData, - EnsPlugin, - GasCostPlugin, + FetchRequest, + JsonRpcApiProvider, + JsonRpcProvider, + Wallet, + HDNodeWallet, + FetchGetUrlFunc, + Provider, + SigningKey, + TransactionRequest, + JsonRpcSigner, + BrowserProvider, + Networkish, + Eip1193Provider, + VoidSigner, + Network, + EnsPlugin, + GasCostPlugin, + FetchCancelSignal, } from 'ethers'; import type { RequestInfo, RequestInit, Response, HeadersInit } from 'node-fetch'; -import { GasPriceOracle, GasPriceOracle__factory, Multicall, Multicall__factory } from './typechain'; +// Temporary workaround until @types/node-fetch is compatible with @types/node +import type { AbortSignal as FetchAbortSignal } from 'node-fetch/externals'; import { isNode, sleep } from './utils'; import type { Config, NetIdType } from './networkConfig'; -import { multicall } from './multicall'; declare global { - interface Window { - ethereum?: Eip1193Provider & EventEmitter; - } + interface Window { + ethereum?: Eip1193Provider & EventEmitter; + } } // Update this for every Tor Browser release -export const defaultUserAgent = 'Mozilla/5.0 (Windows NT 10.0; rv:109.0) Gecko/20100101 Firefox/115.0'; - -export const fetch = crossFetch as unknown as nodeFetch; +export const defaultUserAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0'; export type nodeFetch = (url: RequestInfo, init?: RequestInit) => Promise; export type fetchDataOptions = RequestInit & { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - headers?: HeadersInit | any; - maxRetry?: number; - retryOn?: number; - userAgent?: string; - timeout?: number; - proxy?: string; - torPort?: number; - // eslint-disable-next-line @typescript-eslint/ban-types - debug?: Function; - returnResponse?: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + headers?: HeadersInit | any; + maxRetry?: number; + retryOn?: number; + userAgent?: string; + timeout?: number; + proxy?: string; + torPort?: number; + // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type + debug?: Function; + returnResponse?: boolean; + cancelSignal?: FetchCancelSignal; }; export type NodeAgent = RequestOptions['agent'] | ((parsedUrl: URL) => RequestOptions['agent']); export function getHttpAgent({ - fetchUrl, - proxyUrl, - torPort, - retry, + fetchUrl, + proxyUrl, + torPort, + retry, }: { - fetchUrl: string; - proxyUrl?: string; - torPort?: number; - retry: number; + fetchUrl: string; + proxyUrl?: string; + torPort?: number; + retry: number; }): NodeAgent | undefined { - /* eslint-disable @typescript-eslint/no-var-requires */ - const { HttpProxyAgent } = require('http-proxy-agent'); - const { HttpsProxyAgent } = require('https-proxy-agent'); - const { SocksProxyAgent } = require('socks-proxy-agent'); - /* eslint-enable @typescript-eslint/no-var-requires */ + /* eslint-disable @typescript-eslint/no-require-imports */ + const { HttpProxyAgent } = require('http-proxy-agent'); + const { HttpsProxyAgent } = require('https-proxy-agent'); + const { SocksProxyAgent } = require('socks-proxy-agent'); + /* eslint-enable @typescript-eslint/no-require-imports */ - if (torPort) { - return new SocksProxyAgent(`socks5h://tor${retry}@127.0.0.1:${torPort}`); - } - - if (!proxyUrl) { - return; - } - - const isHttps = fetchUrl.includes('https://'); - - if (proxyUrl.includes('socks://') || proxyUrl.includes('socks4://') || proxyUrl.includes('socks5://')) { - return new SocksProxyAgent(proxyUrl); - } - - if (proxyUrl.includes('http://') || proxyUrl.includes('https://')) { - if (isHttps) { - return new HttpsProxyAgent(proxyUrl); + if (torPort) { + return new SocksProxyAgent(`socks5h://tor${retry}@127.0.0.1:${torPort}`); + } + + if (!proxyUrl) { + return; + } + + const isHttps = fetchUrl.includes('https://'); + + if (proxyUrl.includes('socks://') || proxyUrl.includes('socks4://') || proxyUrl.includes('socks5://')) { + return new SocksProxyAgent(proxyUrl); + } + + if (proxyUrl.includes('http://') || proxyUrl.includes('https://')) { + if (isHttps) { + return new HttpsProxyAgent(proxyUrl); + } + return new HttpProxyAgent(proxyUrl); } - return new HttpProxyAgent(proxyUrl); - } } export async function fetchData(url: string, options: fetchDataOptions = {}) { - const MAX_RETRY = options.maxRetry ?? 3; - const RETRY_ON = options.retryOn ?? 500; - const userAgent = options.userAgent ?? defaultUserAgent; + const MAX_RETRY = options.maxRetry ?? 3; + const RETRY_ON = options.retryOn ?? 500; + const userAgent = options.userAgent ?? defaultUserAgent; - let retry = 0; - let errorObject; + const fetch = ((globalThis as unknown as { useGlobalFetch?: boolean }).useGlobalFetch + ? globalThis.fetch + : crossFetch) as unknown as nodeFetch; - if (!options.method) { - if (!options.body) { - options.method = 'GET'; - } else { - options.method = 'POST'; - } - } + let retry = 0; + let errorObject; - if (!options.headers) { - options.headers = {}; - } - - if (isNode && !options.headers['User-Agent']) { - options.headers['User-Agent'] = userAgent; - } - - while (retry < MAX_RETRY + 1) { - let timeout; - - // Define promise timeout when the options.timeout is available - if (!options.signal && options.timeout) { - const controller = new AbortController(); - - options.signal = controller.signal; - - // Define timeout in seconds - timeout = setTimeout(() => { - controller.abort(); - }, options.timeout); + if (!options.method) { + if (!options.body) { + options.method = 'GET'; + } else { + options.method = 'POST'; + } } - if (!options.agent && isNode && (options.proxy || options.torPort)) { - options.agent = getHttpAgent({ - fetchUrl: url, - proxyUrl: options.proxy, - torPort: options.torPort, - retry, - }); + if (!options.headers) { + options.headers = {}; + } + + if (isNode && !options.headers['User-Agent']) { + options.headers['User-Agent'] = userAgent; + } + + while (retry < MAX_RETRY + 1) { + let timeout; + + if (!options.signal && options.timeout) { + const controller = new AbortController(); + + // Temporary workaround until @types/node-fetch is compatible with @types/node + options.signal = controller.signal as FetchAbortSignal; + + // Define timeout in seconds + timeout = setTimeout(() => { + controller.abort(); + }, options.timeout); + + // Support Ethers.js style FetchCancelSignal class + if (options.cancelSignal) { + // assert(_signal == null || !_signal.cancelled, "request cancelled before sending", "CANCELLED"); + if (options.cancelSignal.cancelled) { + throw new Error('request cancelled before sending'); + } + + options.cancelSignal.addListener(() => { + controller.abort(); + }); + } + } + + if (!options.agent && isNode && (options.proxy || options.torPort)) { + options.agent = getHttpAgent({ + fetchUrl: url, + proxyUrl: options.proxy, + torPort: options.torPort, + retry, + }); + } + + if (options.debug && typeof options.debug === 'function') { + options.debug('request', { + url, + retry, + errorObject, + options, + }); + } + + try { + const resp = await fetch(url, { + method: options.method, + headers: options.headers, + body: options.body, + redirect: options.redirect, + signal: options.signal, + agent: options.agent, + }); + + if (options.debug && typeof options.debug === 'function') { + options.debug('response', resp); + } + + if (!resp.ok) { + const errMsg = `Request to ${url} failed with error code ${resp.status}:\n` + (await resp.text()); + throw new Error(errMsg); + } + + if (options.returnResponse) { + return resp; + } + + const contentType = resp.headers.get('content-type'); + + // If server returns JSON object, parse it and return as an object + if (contentType?.includes('application/json')) { + return await resp.json(); + } + + // Else if the server returns text parse it as a string + if (contentType?.includes('text')) { + return await resp.text(); + } + + // Return as a response object https://developer.mozilla.org/en-US/docs/Web/API/Response + return resp; + } catch (error) { + if (timeout) { + clearTimeout(timeout); + } + + errorObject = error; + + retry++; + + await sleep(RETRY_ON); + } finally { + if (timeout) { + clearTimeout(timeout); + } + } } if (options.debug && typeof options.debug === 'function') { - options.debug('request', { - url, - retry, - errorObject, - options, - }); + options.debug('error', errorObject); } - try { - const resp = await fetch(url, { - method: options.method, - headers: options.headers, - body: options.body, - redirect: options.redirect, - signal: options.signal, - agent: options.agent, - }); - - if (options.debug && typeof options.debug === 'function') { - options.debug('response', resp); - } - - if (!resp.ok) { - const errMsg = `Request to ${url} failed with error code ${resp.status}:\n` + (await resp.text()); - throw new Error(errMsg); - } - - if (options.returnResponse) { - return resp; - } - - const contentType = resp.headers.get('content-type'); - - // If server returns JSON object, parse it and return as an object - if (contentType?.includes('application/json')) { - return await resp.json(); - } - - // Else if the server returns text parse it as a string - if (contentType?.includes('text')) { - return await resp.text(); - } - - // Return as a response object https://developer.mozilla.org/en-US/docs/Web/API/Response - return resp; - } catch (error) { - if (timeout) { - clearTimeout(timeout); - } - - errorObject = error; - - retry++; - - await sleep(RETRY_ON); - } finally { - if (timeout) { - clearTimeout(timeout); - } - } - } - - if (options.debug && typeof options.debug === 'function') { - options.debug('error', errorObject); - } - - throw errorObject; + throw errorObject; } /* eslint-disable @typescript-eslint/no-explicit-any */ export const fetchGetUrlFunc = - (options: fetchDataOptions = {}): FetchGetUrlFunc => - async (req, _signal) => { - let signal; + (options: fetchDataOptions = {}): FetchGetUrlFunc => + async (req, _signal) => { + const init = { + ...options, + method: req.method || 'POST', + headers: req.headers, + body: req.body || undefined, + timeout: options.timeout || req.timeout, + cancelSignal: _signal, + returnResponse: true, + }; - if (_signal) { - const controller = new AbortController(); - signal = controller.signal; - _signal.addListener(() => { - controller.abort(); - }); - } + const resp = await fetchData(req.url, init); - const init = { - ...options, - method: req.method || 'POST', - headers: req.headers, - body: req.body || undefined, - signal, - returnResponse: true, + const headers = {} as { [key in string]: any }; + resp.headers.forEach((value: any, key: string) => { + headers[key.toLowerCase()] = value; + }); + + const respBody = await resp.arrayBuffer(); + const body = respBody == null ? null : new Uint8Array(respBody); + + return { + statusCode: resp.status, + statusMessage: resp.statusText, + headers, + body, + }; }; - - const resp = await fetchData(req.url, init); - - const headers = {} as { [key in string]: any }; - resp.headers.forEach((value: any, key: string) => { - headers[key.toLowerCase()] = value; - }); - - const respBody = await resp.arrayBuffer(); - const body = respBody == null ? null : new Uint8Array(respBody); - - return { - statusCode: resp.status, - statusMessage: resp.statusText, - headers, - body, - }; - }; /* eslint-enable @typescript-eslint/no-explicit-any */ -// caching to improve performance -const oracleMapper = new Map(); -const multicallMapper = new Map(); - export type getProviderOptions = fetchDataOptions & { - pollingInterval?: number; - gasPriceOracle?: string; - gasStationApi?: string; + // NetId to check against rpc + netId?: NetIdType; + pollingInterval?: number; }; -export function getGasOraclePlugin(networkKey: string, fetchOptions?: getProviderOptions) { - const gasStationApi = fetchOptions?.gasStationApi || 'https://gasstation.polygon.technology/v2'; - - // eslint-disable-next-line @typescript-eslint/no-unused-vars - return new FetchUrlFeeDataNetworkPlugin(gasStationApi, async (fetchFeeData, provider, request) => { - if (!oracleMapper.has(networkKey)) { - oracleMapper.set(networkKey, GasPriceOracle__factory.connect(fetchOptions?.gasPriceOracle as string, provider)); - } - if (!multicallMapper.has(networkKey)) { - multicallMapper.set( - networkKey, - Multicall__factory.connect('0xcA11bde05977b3631167028862bE2a173976CA11', provider), - ); - } - const Oracle = oracleMapper.get(networkKey) as GasPriceOracle; - const Multicall = multicallMapper.get(networkKey) as Multicall; - - const [timestamp, heartbeat, feePerGas, priorityFeePerGas] = await multicall(Multicall, [ - { - contract: Oracle, - name: 'timestamp', - }, - { - contract: Oracle, - name: 'heartbeat', - }, - { - contract: Oracle, - name: 'maxFeePerGas', - }, - { - contract: Oracle, - name: 'maxPriorityFeePerGas', - }, - ]); - - const isOutdated = Number(timestamp) <= Date.now() / 1000 - Number(heartbeat); - - if (!isOutdated) { - const maxPriorityFeePerGas = (priorityFeePerGas * BigInt(13)) / BigInt(10); - const maxFeePerGas = feePerGas * BigInt(2) + maxPriorityFeePerGas; - - return { - gasPrice: maxFeePerGas, - maxFeePerGas, - maxPriorityFeePerGas, - }; - } - - const fetchReq = new FetchRequest(gasStationApi); - fetchReq.getUrlFunc = fetchGetUrlFunc(fetchOptions); - if (isNode) { - // Prevent Cloudflare from blocking our request in node.js - fetchReq.setHeader('User-Agent', 'ethers'); - } - - const [ - { - bodyJson: { fast }, - }, - { gasPrice }, - ] = await Promise.all([fetchReq.send(), fetchFeeData()]); - - return { - gasPrice, - maxFeePerGas: parseUnits(`${fast.maxFee}`, 9), - maxPriorityFeePerGas: parseUnits(`${fast.maxPriorityFee}`, 9), - }; - }); -} - export async function getProvider(rpcUrl: string, fetchOptions?: getProviderOptions): Promise { - const fetchReq = new FetchRequest(rpcUrl); - fetchReq.getUrlFunc = fetchGetUrlFunc(fetchOptions); - // omit network plugins and mimic registerEth function (required for polygon) - const _staticNetwork = await new JsonRpcProvider(fetchReq).getNetwork(); - const ensPlugin = _staticNetwork.getPlugin('org.ethers.plugins.network.Ens'); - const gasCostPlugin = _staticNetwork.getPlugin('org.ethers.plugins.network.GasCost'); - const gasStationPlugin = ( - _staticNetwork.getPlugin('org.ethers.plugins.network.FetchUrlFeeDataPlugin') - ); - const staticNetwork = new Network(_staticNetwork.name, _staticNetwork.chainId); - if (ensPlugin) { - staticNetwork.attachPlugin(ensPlugin); - } - if (gasCostPlugin) { - staticNetwork.attachPlugin(gasCostPlugin); - } - if (fetchOptions?.gasPriceOracle) { - staticNetwork.attachPlugin(getGasOraclePlugin(`${_staticNetwork.chainId}_${rpcUrl}`, fetchOptions)); - } else if (gasStationPlugin) { - staticNetwork.attachPlugin(gasStationPlugin); - } - const provider = new JsonRpcProvider(fetchReq, staticNetwork, { - staticNetwork, - }); - provider.pollingInterval = fetchOptions?.pollingInterval || 1000; - return provider; + const fetchReq = new FetchRequest(rpcUrl); + + fetchReq.getUrlFunc = fetchGetUrlFunc(fetchOptions); + + const staticNetwork = await new JsonRpcProvider(fetchReq).getNetwork(); + + const chainId = Number(staticNetwork.chainId); + + if (fetchOptions?.netId && fetchOptions.netId !== chainId) { + const errMsg = `Wrong network for ${rpcUrl}, wants ${fetchOptions.netId} got ${chainId}`; + throw new Error(errMsg); + } + + return new JsonRpcProvider(fetchReq, staticNetwork, { + staticNetwork, + pollingInterval: fetchOptions?.pollingInterval || 1000, + }); } export function getProviderWithNetId( - netId: NetIdType, - rpcUrl: string, - config: Config, - fetchOptions?: getProviderOptions, + netId: NetIdType, + rpcUrl: string, + config: Config, + fetchOptions?: getProviderOptions, ): JsonRpcProvider { - const { networkName, reverseRecordsContract, gasPriceOracleContract, gasStationApi, pollInterval } = config; - const hasEns = Boolean(reverseRecordsContract); + const { networkName, reverseRecordsContract, pollInterval } = config; + const hasEns = Boolean(reverseRecordsContract); - const fetchReq = new FetchRequest(rpcUrl); - fetchReq.getUrlFunc = fetchGetUrlFunc(fetchOptions); - const staticNetwork = new Network(networkName, netId); - if (hasEns) { - staticNetwork.attachPlugin(new EnsPlugin(null, Number(netId))); - } + const fetchReq = new FetchRequest(rpcUrl); + fetchReq.getUrlFunc = fetchGetUrlFunc(fetchOptions); + const staticNetwork = new Network(networkName, netId); + if (hasEns) { + staticNetwork.attachPlugin(new EnsPlugin(null, Number(netId))); + } + staticNetwork.attachPlugin(new GasCostPlugin()); - staticNetwork.attachPlugin(new GasCostPlugin()); + const provider = new JsonRpcProvider(fetchReq, staticNetwork, { + staticNetwork, + pollingInterval: fetchOptions?.pollingInterval || pollInterval * 1000, + }); - if (gasPriceOracleContract) { - staticNetwork.attachPlugin( - getGasOraclePlugin(`${netId}_${rpcUrl}`, { - gasPriceOracle: gasPriceOracleContract, - gasStationApi, - }), - ); - } - - const provider = new JsonRpcProvider(fetchReq, staticNetwork, { - staticNetwork, - }); - - provider.pollingInterval = fetchOptions?.pollingInterval || pollInterval * 1000; - - return provider; + return provider; } export const populateTransaction = async ( - signer: TornadoWallet | TornadoVoidSigner | TornadoRpcSigner, - tx: TransactionRequest, + signer: TornadoWallet | TornadoVoidSigner | TornadoRpcSigner, + tx: TransactionRequest, ) => { - const provider = signer.provider as Provider; + const provider = signer.provider as Provider; - if (!tx.from) { - tx.from = signer.address; - } else if (tx.from !== signer.address) { - const errMsg = `populateTransaction: signer mismatch for tx, wants ${tx.from} have ${signer.address}`; - throw new Error(errMsg); - } - - const [feeData, nonce] = await Promise.all([ - (async () => { - if (tx.maxFeePerGas && tx.maxPriorityFeePerGas) { - return new FeeData(null, BigInt(tx.maxFeePerGas), BigInt(tx.maxPriorityFeePerGas)); - } - - if (tx.gasPrice) { - return new FeeData(BigInt(tx.gasPrice), null, null); - } - - const fetchedFeeData = await provider.getFeeData(); - - if (fetchedFeeData.maxFeePerGas && fetchedFeeData.maxPriorityFeePerGas) { - return new FeeData( - null, - (fetchedFeeData.maxFeePerGas * (BigInt(10000) + BigInt(signer.gasPriceBump))) / BigInt(10000), - fetchedFeeData.maxPriorityFeePerGas, - ); - } else { - return new FeeData( - ((fetchedFeeData.gasPrice as bigint) * (BigInt(10000) + BigInt(signer.gasPriceBump))) / BigInt(10000), - null, - null, - ); - } - })(), - (async () => { - if (tx.nonce) { - return tx.nonce; - } - - let fetchedNonce = await provider.getTransactionCount(signer.address, 'pending'); - - // Deal with cached nonce results - if (signer.bumpNonce && signer.nonce && signer.nonce >= fetchedNonce) { - console.log( - `populateTransaction: bumping nonce from ${fetchedNonce} to ${fetchedNonce + 1} for ${signer.address}`, - ); - fetchedNonce++; - } - - return fetchedNonce; - })(), - ]); - - tx.nonce = nonce; - - // EIP-1559 - if (feeData.maxFeePerGas && feeData.maxPriorityFeePerGas) { - tx.maxFeePerGas = feeData.maxFeePerGas; - tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; - if (!tx.type) { - tx.type = 2; + if (!tx.from) { + tx.from = signer.address; + } else if (tx.from !== signer.address) { + const errMsg = `populateTransaction: signer mismatch for tx, wants ${tx.from} have ${signer.address}`; + throw new Error(errMsg); } - delete tx.gasPrice; - } else if (feeData.gasPrice) { - tx.gasPrice = feeData.gasPrice; - if (!tx.type) { - tx.type = 0; - } - delete tx.maxFeePerGas; - delete tx.maxPriorityFeePerGas; - } - // gasLimit - tx.gasLimit = - tx.gasLimit || - (await (async () => { - try { - const gasLimit = await provider.estimateGas(tx); - return gasLimit === BigInt(21000) - ? gasLimit - : (gasLimit * (BigInt(10000) + BigInt(signer.gasLimitBump))) / BigInt(10000); - } catch (err) { - if (signer.gasFailover) { - console.log('populateTransaction: warning gas estimation failed falling back to 3M gas'); - // Gas failover - return BigInt('3000000'); + const [feeData, nonce] = await Promise.all([ + tx.maxFeePerGas || tx.gasPrice ? undefined : provider.getFeeData(), + tx.nonce ? undefined : provider.getTransactionCount(signer.address, 'pending'), + ]); + + if (feeData) { + // EIP-1559 + if (feeData.maxFeePerGas) { + if (!tx.type) { + tx.type = 2; + } + + tx.maxFeePerGas = (feeData.maxFeePerGas * (BigInt(10000) + BigInt(signer.gasPriceBump))) / BigInt(10000); + tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + delete tx.gasPrice; + } else if (feeData.gasPrice) { + if (!tx.type) { + tx.type = 0; + } + tx.gasPrice = feeData.gasPrice; + delete tx.maxFeePerGas; + delete tx.maxPriorityFeePerGas; } - throw err; - } - })()); + } - return tx; + if (nonce) { + tx.nonce = nonce; + } + + if (!tx.gasLimit) { + try { + const gasLimit = await provider.estimateGas(tx); + + tx.gasLimit = + gasLimit === BigInt(21000) + ? gasLimit + : (gasLimit * (BigInt(10000) + BigInt(signer.gasLimitBump))) / BigInt(10000); + } catch (error) { + if (signer.gasFailover) { + console.log('populateTransaction: warning gas estimation failed falling back to 3M gas'); + // Gas failover + tx.gasLimit = BigInt('3000000'); + } else { + throw error; + } + } + } + + return tx; }; -export type TornadoWalletOptions = { - gasPriceBump?: number; - gasLimitBump?: number; - gasFailover?: boolean; - bumpNonce?: boolean; -}; +export interface TornadoWalletOptions { + gasPriceBump?: number; + gasLimitBump?: number; + gasFailover?: boolean; + bumpNonce?: boolean; +} export class TornadoWallet extends Wallet { - nonce?: number | null; - gasPriceBump: number; - gasLimitBump: number; - gasFailover: boolean; - bumpNonce: boolean; - constructor( - key: string | SigningKey, - provider?: null | Provider, - { gasPriceBump, gasLimitBump, gasFailover, bumpNonce }: TornadoWalletOptions = {}, - ) { - super(key, provider); - // 10% bump from the recommended fee - this.gasPriceBump = gasPriceBump ?? 1000; - // 30% bump from the recommended gaslimit - this.gasLimitBump = gasLimitBump ?? 3000; - this.gasFailover = gasFailover ?? false; - // Disable bump nonce feature unless being used by the server environment - this.bumpNonce = bumpNonce ?? false; - } + nonce?: number; + gasPriceBump: number; + gasLimitBump: number; + gasFailover: boolean; + bumpNonce: boolean; + constructor( + key: string | SigningKey, + provider?: Provider, + { gasPriceBump, gasLimitBump, gasFailover, bumpNonce }: TornadoWalletOptions = {}, + ) { + super(key, provider); + // 10% bump from the recommended fee + this.gasPriceBump = gasPriceBump ?? 0; + // 30% bump from the recommended gaslimit + this.gasLimitBump = gasLimitBump ?? 3000; + this.gasFailover = gasFailover ?? false; + // Disable bump nonce feature unless being used by the server environment + this.bumpNonce = bumpNonce ?? false; + } - static fromMnemonic(mneomnic: string, provider: Provider, index = 0, options?: TornadoWalletOptions) { - const defaultPath = `m/44'/60'/0'/0/${index}`; - const { privateKey } = HDNodeWallet.fromPhrase(mneomnic, undefined, defaultPath); - return new TornadoWallet(privateKey as unknown as SigningKey, provider, options); - } + static fromMnemonic(mneomnic: string, provider: Provider, index = 0, options?: TornadoWalletOptions) { + const defaultPath = `m/44'/60'/0'/0/${index}`; + const { privateKey } = HDNodeWallet.fromPhrase(mneomnic, undefined, defaultPath); + return new TornadoWallet(privateKey as unknown as SigningKey, provider, options); + } - async populateTransaction(tx: TransactionRequest) { - const txObject = await populateTransaction(this, tx); - this.nonce = txObject.nonce; + async populateTransaction(tx: TransactionRequest) { + const txObject = await populateTransaction(this, tx); + this.nonce = Number(txObject.nonce); - return super.populateTransaction(txObject); - } + return super.populateTransaction(txObject); + } } export class TornadoVoidSigner extends VoidSigner { - nonce?: number | null; - gasPriceBump: number; - gasLimitBump: number; - gasFailover: boolean; - bumpNonce: boolean; - constructor( - address: string, - provider?: null | Provider, - { gasPriceBump, gasLimitBump, gasFailover, bumpNonce }: TornadoWalletOptions = {}, - ) { - super(address, provider); - // 10% bump from the recommended fee - this.gasPriceBump = gasPriceBump ?? 1000; - // 30% bump from the recommended gaslimit - this.gasLimitBump = gasLimitBump ?? 3000; - this.gasFailover = gasFailover ?? false; - // turn off bumpNonce feature for view only wallet - this.bumpNonce = bumpNonce ?? false; - } + nonce?: number; + gasPriceBump: number; + gasLimitBump: number; + gasFailover: boolean; + bumpNonce: boolean; + constructor( + address: string, + provider?: Provider, + { gasPriceBump, gasLimitBump, gasFailover, bumpNonce }: TornadoWalletOptions = {}, + ) { + super(address, provider); + // 10% bump from the recommended fee + this.gasPriceBump = gasPriceBump ?? 0; + // 30% bump from the recommended gaslimit + this.gasLimitBump = gasLimitBump ?? 3000; + this.gasFailover = gasFailover ?? false; + // turn off bumpNonce feature for view only wallet + this.bumpNonce = bumpNonce ?? false; + } - async populateTransaction(tx: TransactionRequest) { - const txObject = await populateTransaction(this, tx); - this.nonce = txObject.nonce; + async populateTransaction(tx: TransactionRequest) { + const txObject = await populateTransaction(this, tx); + this.nonce = Number(txObject.nonce); - return super.populateTransaction(txObject); - } + return super.populateTransaction(txObject); + } } export class TornadoRpcSigner extends JsonRpcSigner { - nonce?: number | null; - gasPriceBump: number; - gasLimitBump: number; - gasFailover: boolean; - bumpNonce: boolean; - constructor( - provider: JsonRpcApiProvider, - address: string, - { gasPriceBump, gasLimitBump, gasFailover, bumpNonce }: TornadoWalletOptions = {}, - ) { - super(provider, address); - // 10% bump from the recommended fee - this.gasPriceBump = gasPriceBump ?? 1000; - // 30% bump from the recommended gaslimit - this.gasLimitBump = gasLimitBump ?? 3000; - this.gasFailover = gasFailover ?? false; - // turn off bumpNonce feature for browser wallet - this.bumpNonce = bumpNonce ?? false; - } + nonce?: number; + gasPriceBump: number; + gasLimitBump: number; + gasFailover: boolean; + bumpNonce: boolean; + constructor( + provider: JsonRpcApiProvider, + address: string, + { gasPriceBump, gasLimitBump, gasFailover, bumpNonce }: TornadoWalletOptions = {}, + ) { + super(provider, address); + // 10% bump from the recommended fee + this.gasPriceBump = gasPriceBump ?? 0; + // 30% bump from the recommended gaslimit + this.gasLimitBump = gasLimitBump ?? 3000; + this.gasFailover = gasFailover ?? false; + // turn off bumpNonce feature for browser wallet + this.bumpNonce = bumpNonce ?? false; + } - async sendUncheckedTransaction(tx: TransactionRequest) { - return super.sendUncheckedTransaction(await populateTransaction(this, tx)); - } + async sendUncheckedTransaction(tx: TransactionRequest) { + return super.sendUncheckedTransaction(await populateTransaction(this, tx)); + } } /* eslint-disable @typescript-eslint/no-explicit-any */ @@ -605,44 +479,44 @@ export type connectWalletFunc = (...args: any[]) => Promise; export type handleWalletFunc = (...args: any[]) => void; /* eslint-enable @typescript-eslint/no-explicit-any */ -export type TornadoBrowserProviderOptions = TornadoWalletOptions & { - webChainId?: NetIdType; - connectWallet?: connectWalletFunc; - handleNetworkChanges?: handleWalletFunc; - handleAccountChanges?: handleWalletFunc; - handleAccountDisconnect?: handleWalletFunc; -}; +export interface TornadoBrowserProviderOptions extends TornadoWalletOptions { + netId?: NetIdType; + connectWallet?: connectWalletFunc; + handleNetworkChanges?: handleWalletFunc; + handleAccountChanges?: handleWalletFunc; + handleAccountDisconnect?: handleWalletFunc; +} export class TornadoBrowserProvider extends BrowserProvider { - options?: TornadoBrowserProviderOptions; - constructor(ethereum: Eip1193Provider, network?: Networkish, options?: TornadoBrowserProviderOptions) { - super(ethereum, network); - this.options = options; - } - - async getSigner(address: string): Promise { - const signerAddress = (await super.getSigner(address)).address; - - if ( - this.options?.webChainId && - this.options?.connectWallet && - Number(await super.send('eth_chainId', [])) !== Number(this.options?.webChainId) - ) { - await this.options.connectWallet(); + options?: TornadoBrowserProviderOptions; + constructor(ethereum: Eip1193Provider, network?: Networkish, options?: TornadoBrowserProviderOptions) { + super(ethereum, network); + this.options = options; } - if (this.options?.handleNetworkChanges) { - window?.ethereum?.on('chainChanged', this.options.handleNetworkChanges); - } + async getSigner(address: string): Promise { + const signerAddress = (await super.getSigner(address)).address; - if (this.options?.handleAccountChanges) { - window?.ethereum?.on('accountsChanged', this.options.handleAccountChanges); - } + if ( + this.options?.netId && + this.options?.connectWallet && + Number(await super.send('net_version', [])) !== this.options?.netId + ) { + await this.options.connectWallet(this.options?.netId); + } - if (this.options?.handleAccountDisconnect) { - window?.ethereum?.on('disconnect', this.options.handleAccountDisconnect); - } + if (this.options?.handleNetworkChanges) { + window?.ethereum?.on('chainChanged', this.options.handleNetworkChanges); + } - return new TornadoRpcSigner(this, signerAddress, this.options); - } + if (this.options?.handleAccountChanges) { + window?.ethereum?.on('accountsChanged', this.options.handleAccountChanges); + } + + if (this.options?.handleAccountDisconnect) { + window?.ethereum?.on('disconnect', this.options.handleAccountDisconnect); + } + + return new TornadoRpcSigner(this, signerAddress, this.options); + } } diff --git a/src/relayerClient.ts b/src/relayerClient.ts index 5f633c5..7b95893 100644 --- a/src/relayerClient.ts +++ b/src/relayerClient.ts @@ -1,96 +1,103 @@ -import { getAddress, namehash, parseEther } from 'ethers'; -import type { Aggregator } from '@tornado/contracts'; -import type { RelayerStructOutput } from '@tornado/contracts/dist/contracts/Governance/Aggregator/Aggregator'; +import { getAddress, parseEther } from 'ethers'; import { sleep } from './utils'; import { NetId, NetIdType, Config } from './networkConfig'; import { fetchData, fetchDataOptions } from './providers'; -import { ajv, jobsSchema, getStatusSchema } from './schemas'; +import { ajv, jobsSchema, jobRequestSchema, getStatusSchema } from './schemas'; import type { snarkProofs } from './websnark'; +import type { CachedRelayerInfo } from './events'; + +export const MIN_FEE = 0.1; + +export const MAX_FEE = 0.9; export const MIN_STAKE_BALANCE = parseEther('500'); export interface RelayerParams { - ensName: string; - relayerAddress?: string; + ensName: string; + relayerAddress: string; } -export interface Relayer { - netId: NetIdType; - url: string; - hostname: string; - rewardAccount: string; - instances: string[]; - gasPrice?: number; - ethPrices?: { - [key in string]: string; - }; - currentQueue: number; - tornadoServiceFee: number; +/** + * Info from relayer status + */ +export interface RelayerInfo extends RelayerParams { + netId: NetIdType; + url: string; + hostname: string; + rewardAccount: string; + instances: string[]; + stakeBalance?: string; + gasPrice?: number; + ethPrices?: { + [key in string]: string; + }; + currentQueue: number; + tornadoServiceFee: number; } -export type RelayerInfo = Relayer & { - ensName: string; - stakeBalance: bigint; - relayerAddress: string; -}; - -export type RelayerError = { - hostname: string; - relayerAddress?: string; - errorMessage?: string; -}; +export interface RelayerError { + hostname: string; + relayerAddress?: string; + errorMessage?: string; + hasError: boolean; +} export interface RelayerStatus { - url: string; - rewardAccount: string; - instances: { - [key in string]: { - instanceAddress: { - [key in string]: string; - }; - tokenAddress?: string; - symbol: string; - decimals: number; + url: string; + rewardAccount: string; + instances: { + [key in string]: { + instanceAddress: { + [key in string]: string; + }; + tokenAddress?: string; + symbol: string; + decimals: number; + }; }; - }; - gasPrices?: { - fast: number; - additionalProperties?: number; - }; - netId: NetIdType; - ethPrices?: { - [key in string]: string; - }; - tornadoServiceFee: number; - latestBlock?: number; - version: string; - health: { - status: string; - error: string; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - errorsLog: any[]; - }; - currentQueue: number; + gasPrices?: { + fast: number; + additionalProperties?: number; + }; + netId: NetIdType; + ethPrices?: { + [key in string]: string; + }; + tornadoServiceFee: number; + latestBlock?: number; + version: string; + health: { + status: string; + error: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + errorsLog: any[]; + }; + currentQueue: number; +} + +export interface TornadoWithdrawParams extends snarkProofs { + contract: string; } export interface RelayerTornadoWithdraw { - id?: string; - error?: string; + id?: string; + error?: string; } export interface RelayerTornadoJobs { - error?: string; - id: string; - type?: string; - status: string; - contract?: string; - proof?: string; - args?: string[]; - txHash?: string; - confirmations?: number; - failedReason?: string; + error?: string; + id: string; + type?: string; + status: string; + contract?: string; + proof?: string; + args?: string[]; + txHash?: string; + confirmations?: number; + failedReason?: string; } +/** const semVerRegex = /^(?0|[1-9]\d*)\.(?0|[1-9]\d*)\.(?0|[1-9]\d*)(?:-(?(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/; @@ -116,319 +123,298 @@ export function isRelayerUpdated(relayerVersion: string, netId: NetIdType) { if (prerelease) return false; return isUpdatedMajor && (Number(patch) >= 5 || netId !== NetId.MAINNET); // Patch checking - also backwards compatibility for Mainnet } +**/ -export function calculateScore({ stakeBalance, tornadoServiceFee }: RelayerInfo, minFee = 0.33, maxFee = 0.53) { - if (tornadoServiceFee < minFee) { - tornadoServiceFee = minFee; - } else if (tornadoServiceFee >= maxFee) { - return BigInt(0); - } +export function calculateScore({ stakeBalance, tornadoServiceFee }: RelayerInfo) { + if (tornadoServiceFee < MIN_FEE) { + tornadoServiceFee = MIN_FEE; + } else if (tornadoServiceFee >= MAX_FEE) { + return BigInt(0); + } - const serviceFeeCoefficient = (tornadoServiceFee - minFee) ** 2; - const feeDiffCoefficient = 1 / (maxFee - minFee) ** 2; - const coefficientsMultiplier = 1 - feeDiffCoefficient * serviceFeeCoefficient; + const serviceFeeCoefficient = (tornadoServiceFee - MIN_FEE) ** 2; + const feeDiffCoefficient = 1 / (MAX_FEE - MIN_FEE) ** 2; + const coefficientsMultiplier = 1 - feeDiffCoefficient * serviceFeeCoefficient; - return BigInt(Math.floor(Number(stakeBalance) * coefficientsMultiplier)); + return BigInt(Math.floor(Number(stakeBalance || '0') * coefficientsMultiplier)); } export function getWeightRandom(weightsScores: bigint[], random: bigint) { - for (let i = 0; i < weightsScores.length; i++) { - if (random < weightsScores[i]) { - return i; + for (let i = 0; i < weightsScores.length; i++) { + if (random < weightsScores[i]) { + return i; + } + random = random - weightsScores[i]; } - random = random - weightsScores[i]; - } - return Math.floor(Math.random() * weightsScores.length); + return Math.floor(Math.random() * weightsScores.length); } -export type RelayerInstanceList = { - [key in string]: { - instanceAddress: { - [key in string]: string; +export interface RelayerInstanceList { + [key: string]: { + instanceAddress: { + [key: string]: string; + }; }; - }; -}; +} export function getSupportedInstances(instanceList: RelayerInstanceList) { - const rawList = Object.values(instanceList) - .map(({ instanceAddress }) => { - return Object.values(instanceAddress); - }) - .flat(); + const rawList = Object.values(instanceList) + .map(({ instanceAddress }) => { + return Object.values(instanceAddress); + }) + .flat(); - return rawList.map((l) => getAddress(l)); + return rawList.map((l) => getAddress(l)); } -export function pickWeightedRandomRelayer(relayers: RelayerInfo[], netId: NetIdType) { - let minFee: number, maxFee: number; +export function pickWeightedRandomRelayer(relayers: RelayerInfo[]) { + const weightsScores = relayers.map((el) => calculateScore(el)); + const totalWeight = weightsScores.reduce((acc, curr) => { + return (acc = acc + curr); + }, BigInt('0')); - if (netId !== NetId.MAINNET) { - minFee = 0.01; - maxFee = 0.3; - } + const random = BigInt(Math.floor(Number(totalWeight) * Math.random())); + const weightRandomIndex = getWeightRandom(weightsScores, random); - const weightsScores = relayers.map((el) => calculateScore(el, minFee, maxFee)); - const totalWeight = weightsScores.reduce((acc, curr) => { - return (acc = acc + curr); - }, BigInt('0')); - - const random = BigInt(Number(totalWeight) * Math.random()); - const weightRandomIndex = getWeightRandom(weightsScores, random); - - return relayers[weightRandomIndex]; + return relayers[weightRandomIndex]; } export interface RelayerClientConstructor { - netId: NetIdType; - config: Config; - Aggregator: Aggregator; - fetchDataOptions?: fetchDataOptions; + netId: NetIdType; + config: Config; + fetchDataOptions?: fetchDataOptions; } -export type RelayerClientWithdraw = snarkProofs & { - contract: string; -}; - export class RelayerClient { - netId: NetIdType; - config: Config; - Aggregator: Aggregator; - selectedRelayer?: Relayer; - fetchDataOptions?: fetchDataOptions; + netId: NetIdType; + config: Config; + selectedRelayer?: RelayerInfo; + fetchDataOptions?: fetchDataOptions; + tovarish: boolean; - constructor({ netId, config, Aggregator, fetchDataOptions }: RelayerClientConstructor) { - this.netId = netId; - this.config = config; - this.Aggregator = Aggregator; - this.fetchDataOptions = fetchDataOptions; - } - - async askRelayerStatus({ - hostname, - relayerAddress, - }: { - hostname: string; - relayerAddress?: string; - }): Promise { - const url = `https://${!hostname.endsWith('/') ? hostname + '/' : hostname}`; - - const rawStatus = (await fetchData(`${url}status`, { - ...this.fetchDataOptions, - headers: { - 'Content-Type': 'application/json, application/x-www-form-urlencoded', - }, - timeout: this.fetchDataOptions?.torPort ? 10000 : 3000, - maxRetry: this.fetchDataOptions?.torPort ? 2 : 0, - })) as object; - - const statusValidator = ajv.compile(getStatusSchema(this.netId, this.config)); - - if (!statusValidator(rawStatus)) { - throw new Error('Invalid status schema'); + constructor({ netId, config, fetchDataOptions }: RelayerClientConstructor) { + this.netId = netId; + this.config = config; + this.fetchDataOptions = fetchDataOptions; + this.tovarish = false; } - const status = { - ...rawStatus, - url, - } as RelayerStatus; - - if (status.currentQueue > 5) { - throw new Error('Withdrawal queue is overloaded'); - } - - if (status.netId !== this.netId) { - throw new Error('This relayer serves a different network'); - } - - if (relayerAddress && this.netId === NetId.MAINNET && status.rewardAccount !== relayerAddress) { - throw new Error('The Relayer reward address must match registered address'); - } - - if (!isRelayerUpdated(status.version, this.netId)) { - throw new Error('Outdated version.'); - } - - return status; - } - - async filterRelayer( - curr: RelayerStructOutput, - relayer: RelayerParams, - subdomains: string[], - debugRelayer: boolean = false, - ): Promise { - const { relayerEnsSubdomain } = this.config; - const subdomainIndex = subdomains.indexOf(relayerEnsSubdomain); - const mainnetSubdomain = curr.records[0]; - const hostname = curr.records[subdomainIndex]; - const isHostWithProtocol = hostname.includes('http'); - - const { owner, balance: stakeBalance, isRegistered } = curr; - const { ensName, relayerAddress } = relayer; - - const isOwner = !relayerAddress || relayerAddress === owner; - const hasMinBalance = stakeBalance >= MIN_STAKE_BALANCE; - - const preCondition = - hostname && isOwner && mainnetSubdomain && isRegistered && hasMinBalance && !isHostWithProtocol; - - if (preCondition || debugRelayer) { - try { - const status = await this.askRelayerStatus({ hostname, relayerAddress }); - - return { - netId: status.netId, - url: status.url, - hostname, - ensName, - stakeBalance, - relayerAddress, - rewardAccount: getAddress(status.rewardAccount), - instances: getSupportedInstances(status.instances), - gasPrice: status.gasPrices?.fast, - ethPrices: status.ethPrices, - currentQueue: status.currentQueue, - tornadoServiceFee: status.tornadoServiceFee, - } as RelayerInfo; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - } catch (err: any) { - if (debugRelayer) { - throw err; - } - return { - hostname, - relayerAddress, - errorMessage: err.message, - } as RelayerError; - } - } else { - if (debugRelayer) { - const errMsg = `Relayer ${hostname} condition not met`; - throw new Error(errMsg); - } - return { + async askRelayerStatus({ hostname, + url, relayerAddress, - errorMessage: `Relayer ${hostname} condition not met`, - }; - } - } - - async getValidRelayers( - // this should be ascending order of events - relayers: RelayerParams[], - subdomains: string[], - debugRelayer: boolean = false, - ): Promise<{ - validRelayers: RelayerInfo[]; - invalidRelayers: RelayerError[]; - }> { - const relayersSet = new Set(); - - const uniqueRelayers = relayers.reverse().filter(({ ensName }) => { - if (!relayersSet.has(ensName)) { - relayersSet.add(ensName); - return true; - } - return false; - }); - - const relayerNameHashes = uniqueRelayers.map((r) => namehash(r.ensName)); - - const relayersData = await this.Aggregator.relayersData.staticCall(relayerNameHashes, subdomains); - - const invalidRelayers: RelayerError[] = []; - - const validRelayers = ( - await Promise.all( - relayersData.map((curr, index) => this.filterRelayer(curr, uniqueRelayers[index], subdomains, debugRelayer)), - ) - ).filter((r) => { - if ((r as RelayerError).errorMessage) { - invalidRelayers.push(r); - return false; - } - return true; - }) as RelayerInfo[]; - - return { - validRelayers, - invalidRelayers, - }; - } - - pickWeightedRandomRelayer(relayers: RelayerInfo[]) { - return pickWeightedRandomRelayer(relayers, this.netId); - } - - async tornadoWithdraw({ contract, proof, args }: RelayerClientWithdraw) { - const { url } = this.selectedRelayer as Relayer; - - const withdrawResponse = (await fetchData(`${url}v1/tornadoWithdraw`, { - ...this.fetchDataOptions, - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ - contract, - proof, - args, - }), - })) as RelayerTornadoWithdraw; - - const { id, error } = withdrawResponse; - - if (error) { - throw new Error(error); - } - - let relayerStatus: string | undefined; - - const jobUrl = `${url}v1/jobs/${id}`; - - console.log(`Job submitted: ${jobUrl}\n`); - - while (!relayerStatus || !['FAILED', 'CONFIRMED'].includes(relayerStatus)) { - const jobResponse = await fetchData(jobUrl, { - ...this.fetchDataOptions, - method: 'GET', - headers: { - 'Content-Type': 'application/json', - }, - }); - - if (jobResponse.error) { - throw new Error(error); - } - - const jobValidator = ajv.compile(jobsSchema); - - if (!jobValidator(jobResponse)) { - const errMsg = `${jobUrl} has an invalid job response`; - throw new Error(errMsg); - } - - const { status, txHash, confirmations, failedReason } = jobResponse as unknown as RelayerTornadoJobs; - - if (relayerStatus !== status) { - if (status === 'FAILED') { - const errMsg = `Job ${status}: ${jobUrl} failed reason: ${failedReason}`; - throw new Error(errMsg); - } else if (status === 'SENT') { - console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash}\n`); - } else if (status === 'MINED') { - console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash}, confirmations: ${confirmations}\n`); - } else if (status === 'CONFIRMED') { - console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash}, confirmations: ${confirmations}\n`); + }: { + hostname?: string; + // optional url if entered manually + url?: string; + // relayerAddress from registry contract to prevent cheating + relayerAddress?: string; + }): Promise { + if (!url && hostname) { + url = `https://${!hostname.endsWith('/') ? hostname + '/' : hostname}`; + } else if (url && !url.endsWith('/')) { + url += '/'; } else { - console.log(`Job ${status}: ${jobUrl}\n`); + url = ''; } - relayerStatus = status; - } + const rawStatus = (await fetchData(`${url}status`, { + ...this.fetchDataOptions, + headers: { + 'Content-Type': 'application/json, application/x-www-form-urlencoded', + }, + timeout: 30000, + maxRetry: this.fetchDataOptions?.torPort ? 2 : 0, + })) as object; - await sleep(3000); + const statusValidator = ajv.compile(getStatusSchema(this.netId, this.config, this.tovarish)); + + if (!statusValidator(rawStatus)) { + throw new Error('Invalid status schema'); + } + + const status = { + ...rawStatus, + url, + } as RelayerStatus; + + if (status.currentQueue > 5) { + throw new Error('Withdrawal queue is overloaded'); + } + + if (status.netId !== this.netId) { + throw new Error('This relayer serves a different network'); + } + + if (relayerAddress && this.netId === NetId.MAINNET && status.rewardAccount !== relayerAddress) { + throw new Error('The Relayer reward address must match registered address'); + } + + return status; + } + + async filterRelayer(relayer: CachedRelayerInfo): Promise { + const hostname = relayer.hostnames[this.netId]; + const { ensName, relayerAddress } = relayer; + + if (!hostname) { + return; + } + + try { + const status = await this.askRelayerStatus({ + hostname, + relayerAddress, + }); + + return { + netId: status.netId, + url: status.url, + hostname, + ensName, + relayerAddress, + rewardAccount: getAddress(status.rewardAccount), + instances: getSupportedInstances(status.instances), + stakeBalance: relayer.stakeBalance, + gasPrice: status.gasPrices?.fast, + ethPrices: status.ethPrices, + currentQueue: status.currentQueue, + tornadoServiceFee: status.tornadoServiceFee, + } as RelayerInfo; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } catch (err: any) { + return { + hostname, + relayerAddress, + errorMessage: err.message, + hasError: true, + } as RelayerError; + } + } + + async getValidRelayers(relayers: CachedRelayerInfo[]): Promise<{ + validRelayers: RelayerInfo[]; + invalidRelayers: RelayerError[]; + }> { + const invalidRelayers: RelayerError[] = []; + + const validRelayers = (await Promise.all(relayers.map((relayer) => this.filterRelayer(relayer)))).filter( + (r) => { + if (!r) { + return false; + } + if ((r as RelayerError).hasError) { + invalidRelayers.push(r as RelayerError); + return false; + } + return true; + }, + ) as RelayerInfo[]; + + return { + validRelayers, + invalidRelayers, + }; + } + + pickWeightedRandomRelayer(relayers: RelayerInfo[]) { + return pickWeightedRandomRelayer(relayers); + } + + async tornadoWithdraw( + { contract, proof, args }: TornadoWithdrawParams, + callback?: (jobResp: RelayerTornadoWithdraw | RelayerTornadoJobs) => void, + ) { + const { url } = this.selectedRelayer as RelayerInfo; + + /** + * Request new job + */ + + const withdrawResponse = (await fetchData(`${url}v1/tornadoWithdraw`, { + ...this.fetchDataOptions, + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + contract, + proof, + args, + }), + })) as RelayerTornadoWithdraw; + + const { id, error } = withdrawResponse; + + if (error) { + throw new Error(error); + } + + const jobValidator = ajv.compile(jobRequestSchema); + + if (!jobValidator(withdrawResponse)) { + const errMsg = `${url}v1/tornadoWithdraw has an invalid job response`; + throw new Error(errMsg); + } + + if (typeof callback === 'function') { + callback(withdrawResponse as unknown as RelayerTornadoWithdraw); + } + + /** + * Get job status + */ + + let relayerStatus: string | undefined; + + const jobUrl = `${url}v1/jobs/${id}`; + + console.log(`Job submitted: ${jobUrl}\n`); + + while (!relayerStatus || !['FAILED', 'CONFIRMED'].includes(relayerStatus)) { + const jobResponse = await fetchData(jobUrl, { + ...this.fetchDataOptions, + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + }); + + if (jobResponse.error) { + throw new Error(error); + } + + const jobValidator = ajv.compile(jobsSchema); + + if (!jobValidator(jobResponse)) { + const errMsg = `${jobUrl} has an invalid job response`; + throw new Error(errMsg); + } + + const { status, txHash, confirmations, failedReason } = jobResponse as unknown as RelayerTornadoJobs; + + if (relayerStatus !== status) { + if (status === 'FAILED') { + const errMsg = `Job ${status}: ${jobUrl} failed reason: ${failedReason}`; + throw new Error(errMsg); + } else if (status === 'SENT') { + console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash}\n`); + } else if (status === 'MINED') { + console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash}, confirmations: ${confirmations}\n`); + } else if (status === 'CONFIRMED') { + console.log(`Job ${status}: ${jobUrl}, txhash: ${txHash}, confirmations: ${confirmations}\n`); + } else { + console.log(`Job ${status}: ${jobUrl}\n`); + } + + relayerStatus = status; + + if (typeof callback === 'function') { + callback(jobResponse as unknown as RelayerTornadoJobs); + } + } + + await sleep(3000); + } } - } } diff --git a/src/schemas/ajv.ts b/src/schemas/ajv.ts new file mode 100644 index 0000000..9c95624 --- /dev/null +++ b/src/schemas/ajv.ts @@ -0,0 +1,31 @@ +import Ajv from 'ajv'; +import { BigNumberish, isAddress } from 'ethers'; + +export const ajv = new Ajv({ allErrors: true }); + +ajv.addKeyword({ + keyword: 'BN', + // eslint-disable-next-line @typescript-eslint/no-explicit-any + validate: (schema: any, data: BigNumberish) => { + try { + BigInt(data); + return true; + } catch { + return false; + } + }, + errors: true, +}); + +ajv.addKeyword({ + keyword: 'isAddress', + // eslint-disable-next-line @typescript-eslint/no-explicit-any + validate: (schema: any, data: string) => { + try { + return isAddress(data); + } catch { + return false; + } + }, + errors: true, +}); diff --git a/src/schemas/events.ts b/src/schemas/events.ts new file mode 100644 index 0000000..63874b3 --- /dev/null +++ b/src/schemas/events.ts @@ -0,0 +1,321 @@ +import { ajv } from './ajv'; +import { addressSchemaType, bnSchemaType, bytes32SchemaType } from './types'; + +const baseEventsSchemaProperty = { + blockNumber: { + type: 'number', + }, + logIndex: { + type: 'number', + }, + transactionHash: bytes32SchemaType, +} as const; + +const baseEventsSchemaRequired = Object.keys(baseEventsSchemaProperty) as string[]; + +export const governanceEventsSchema = { + type: 'array', + items: { + anyOf: [ + { + type: 'object', + properties: { + ...baseEventsSchemaProperty, + event: { type: 'string' }, + id: { type: 'number' }, + proposer: addressSchemaType, + target: addressSchemaType, + startTime: { type: 'number' }, + endTime: { type: 'number' }, + description: { type: 'string' }, + }, + required: [ + ...baseEventsSchemaRequired, + 'event', + 'id', + 'proposer', + 'target', + 'startTime', + 'endTime', + 'description', + ], + additionalProperties: false, + }, + { + type: 'object', + properties: { + ...baseEventsSchemaProperty, + event: { type: 'string' }, + proposalId: { type: 'number' }, + voter: addressSchemaType, + support: { type: 'boolean' }, + votes: { type: 'string' }, + from: addressSchemaType, + input: { type: 'string' }, + }, + required: [ + ...baseEventsSchemaRequired, + 'event', + 'proposalId', + 'voter', + 'support', + 'votes', + 'from', + 'input', + ], + additionalProperties: false, + }, + { + type: 'object', + properties: { + ...baseEventsSchemaProperty, + event: { type: 'string' }, + account: addressSchemaType, + delegateTo: addressSchemaType, + }, + required: [...baseEventsSchemaRequired, 'account', 'delegateTo'], + additionalProperties: false, + }, + { + type: 'object', + properties: { + ...baseEventsSchemaProperty, + event: { type: 'string' }, + account: addressSchemaType, + delegateFrom: addressSchemaType, + }, + required: [...baseEventsSchemaRequired, 'account', 'delegateFrom'], + additionalProperties: false, + }, + ], + }, +} as const; + +export const relayerRegistryEventsSchema = { + type: 'array', + items: { + anyOf: [ + // RelayerRegisteredEvents + { + type: 'object', + properties: { + ...baseEventsSchemaProperty, + event: { type: 'string' }, + ensName: { type: 'string' }, + relayerAddress: addressSchemaType, + ensHash: { type: 'string' }, + stakedAmount: { type: 'string' }, + }, + required: [ + ...baseEventsSchemaRequired, + 'event', + 'ensName', + 'relayerAddress', + 'ensHash', + 'stakedAmount', + ], + additionalProperties: false, + }, + // RelayerUnregisteredEvents + { + type: 'object', + properties: { + ...baseEventsSchemaProperty, + event: { type: 'string' }, + relayerAddress: addressSchemaType, + }, + required: [...baseEventsSchemaRequired, 'event', 'relayerAddress'], + additionalProperties: false, + }, + // WorkerRegisteredEvents & WorkerUnregisteredEvents + { + type: 'object', + properties: { + ...baseEventsSchemaProperty, + event: { type: 'string' }, + relayerAddress: addressSchemaType, + workerAddress: addressSchemaType, + }, + required: [...baseEventsSchemaRequired, 'event', 'relayerAddress', 'workerAddress'], + additionalProperties: false, + }, + ], + }, +} as const; + +export const stakeBurnedEventsSchema = { + type: 'array', + items: { + type: 'object', + properties: { + ...baseEventsSchemaProperty, + relayerAddress: addressSchemaType, + amountBurned: bnSchemaType, + instanceAddress: addressSchemaType, + gasFee: bnSchemaType, + relayerFee: bnSchemaType, + timestamp: { type: 'number' }, + }, + required: [ + ...baseEventsSchemaRequired, + 'relayerAddress', + 'amountBurned', + 'instanceAddress', + 'gasFee', + 'relayerFee', + 'timestamp', + ], + additionalProperties: false, + }, +} as const; + +export const depositsEventsSchema = { + type: 'array', + items: { + type: 'object', + properties: { + ...baseEventsSchemaProperty, + commitment: bytes32SchemaType, + leafIndex: { type: 'number' }, + timestamp: { type: 'number' }, + from: addressSchemaType, + }, + required: [...baseEventsSchemaRequired, 'commitment', 'leafIndex', 'timestamp', 'from'], + additionalProperties: false, + }, +} as const; + +export const withdrawalsEventsSchema = { + type: 'array', + items: { + type: 'object', + properties: { + ...baseEventsSchemaProperty, + nullifierHash: bytes32SchemaType, + to: addressSchemaType, + fee: bnSchemaType, + timestamp: { type: 'number' }, + }, + required: [...baseEventsSchemaRequired, 'nullifierHash', 'to', 'fee', 'timestamp'], + additionalProperties: false, + }, +} as const; + +export const tornadoEventsSchema = { + type: 'array', + items: { + anyOf: [ + // depositsEvents + { + type: 'object', + properties: { + ...baseEventsSchemaProperty, + event: { type: 'string' }, + instanceAddress: { type: 'string' }, + commitment: bytes32SchemaType, + leafIndex: { type: 'number' }, + timestamp: { type: 'number' }, + from: addressSchemaType, + }, + required: [ + ...baseEventsSchemaRequired, + 'event', + 'instanceAddress', + 'commitment', + 'leafIndex', + 'timestamp', + 'from', + ], + additionalProperties: false, + }, + // withdrawalEvents + { + type: 'object', + properties: { + ...baseEventsSchemaProperty, + event: { type: 'string' }, + instanceAddress: { type: 'string' }, + nullifierHash: bytes32SchemaType, + to: addressSchemaType, + relayerAddress: addressSchemaType, + fee: bnSchemaType, + timestamp: { type: 'number' }, + }, + required: [ + ...baseEventsSchemaRequired, + 'event', + 'instanceAddress', + 'nullifierHash', + 'to', + 'relayerAddress', + 'fee', + 'timestamp', + ], + additionalProperties: false, + }, + ], + }, +} as const; + +export const echoEventsSchema = { + type: 'array', + items: { + type: 'object', + properties: { + ...baseEventsSchemaProperty, + address: addressSchemaType, + encryptedAccount: { type: 'string' }, + }, + required: [...baseEventsSchemaRequired, 'address', 'encryptedAccount'], + additionalProperties: false, + }, +} as const; + +export const encryptedNotesSchema = { + type: 'array', + items: { + type: 'object', + properties: { + ...baseEventsSchemaProperty, + encryptedNote: { type: 'string' }, + }, + required: [...baseEventsSchemaRequired, 'encryptedNote'], + additionalProperties: false, + }, +} as const; + +export function getEventsSchemaValidator(type: string) { + if (type === 'tornado') { + return ajv.compile(tornadoEventsSchema); + } + + if (type === 'deposit') { + return ajv.compile(depositsEventsSchema); + } + + if (type === 'withdrawal') { + return ajv.compile(withdrawalsEventsSchema); + } + + if (type === 'governance') { + return ajv.compile(governanceEventsSchema); + } + + if (type === 'registry') { + return ajv.compile(relayerRegistryEventsSchema); + } + + if (type === 'revenue') { + return ajv.compile(stakeBurnedEventsSchema); + } + + if (type === 'echo') { + return ajv.compile(echoEventsSchema); + } + + if (type === 'encrypted_notes') { + return ajv.compile(encryptedNotesSchema); + } + + throw new Error('Unsupported event type for schema validation'); +} diff --git a/src/schemas/index.ts b/src/schemas/index.ts index b7059a2..f01c441 100644 --- a/src/schemas/index.ts +++ b/src/schemas/index.ts @@ -1,21 +1,5 @@ -import Ajv from 'ajv'; -import type { BigNumberish } from 'ethers'; - -export const ajv = new Ajv({ allErrors: true }); - -ajv.addKeyword({ - keyword: 'BN', - // eslint-disable-next-line @typescript-eslint/no-explicit-any - validate: (schema: any, data: BigNumberish) => { - try { - BigInt(data); - return true; - } catch (e) { - return false; - } - }, - errors: true, -}); - +export * from './ajv'; +export * from './events'; export * from './status'; export * from './jobs'; +export * from './types'; diff --git a/src/schemas/jobs.ts b/src/schemas/jobs.ts index 30624a1..75e1b02 100644 --- a/src/schemas/jobs.ts +++ b/src/schemas/jobs.ts @@ -1,59 +1,64 @@ -export type jobsSchema = { - type: string; - properties: { - error: { - type: string; +export interface jobsSchema { + type: string; + properties: { + error: { + type: string; + }; + id: { + type: string; + }; + type: { + type: string; + }; + status: { + type: string; + }; + contract: { + type: string; + }; + proof: { + type: string; + }; + args: { + type: string; + items: { + type: string; + }; + }; + txHash: { + type: string; + }; + confirmations: { + type: string; + }; + failedReason: { + type: string; + }; }; - id: { - type: string; - }; - type: { - type: string; - }; - status: { - type: string; - }; - contract: { - type: string; - }; - proof: { - type: string; - }; - args: { - type: string; - items: { - type: string; - }; - }; - txHash: { - type: string; - }; - confirmations: { - type: string; - }; - failedReason: { - type: string; - }; - }; - required: string[]; -}; + required: string[]; +} export const jobsSchema: jobsSchema = { - type: 'object', - properties: { - error: { type: 'string' }, - id: { type: 'string' }, - type: { type: 'string' }, - status: { type: 'string' }, - contract: { type: 'string' }, - proof: { type: 'string' }, - args: { - type: 'array', - items: { type: 'string' }, + type: 'object', + properties: { + error: { type: 'string' }, + id: { type: 'string' }, + type: { type: 'string' }, + status: { type: 'string' }, + contract: { type: 'string' }, + proof: { type: 'string' }, + args: { + type: 'array', + items: { type: 'string' }, + }, + txHash: { type: 'string' }, + confirmations: { type: 'number' }, + failedReason: { type: 'string' }, }, - txHash: { type: 'string' }, - confirmations: { type: 'number' }, - failedReason: { type: 'string' }, - }, - required: ['id', 'status'], + required: ['id', 'status'], +}; + +export const jobRequestSchema: jobsSchema = { + ...jobsSchema, + required: ['id'], }; diff --git a/src/schemas/status.ts b/src/schemas/status.ts index 4a0a516..6dd2d3e 100644 --- a/src/schemas/status.ts +++ b/src/schemas/status.ts @@ -1,181 +1,221 @@ import { Config, NetId, NetIdType } from '../networkConfig'; +import { addressSchemaType, bnSchemaType } from '.'; -export type statusInstanceType = { - type: string; - properties: { - instanceAddress: { - type: string; - properties: { - [key in string]: typeof addressType; - }; - required: string[]; - }; - tokenAddress?: typeof addressType; - symbol?: { enum: string[] }; - decimals: { enum: number[] }; - }; - required: string[]; -}; - -export type statusInstancesType = { - type: string; - properties: { - [key in string]: statusInstanceType; - }; - required: string[]; -}; - -export type statusEthPricesType = { - type: string; - properties: { - [key in string]: typeof bnType; - }; - required?: string[]; -}; - -export type statusSchema = { - type: string; - properties: { - rewardAccount: typeof addressType; - instances?: statusInstancesType; - gasPrices: { - type: string; - properties: { - [key in string]: { - type: string; +export interface statusInstanceType { + type: string; + properties: { + instanceAddress: { + type: string; + properties: { + [key in string]: typeof addressSchemaType; + }; + required: string[]; }; - }; - required: string[]; + tokenAddress?: typeof addressSchemaType; + symbol?: { enum: string[] }; + decimals: { enum: number[] }; }; - netId: { - type: string; - }; - ethPrices?: statusEthPricesType; - tornadoServiceFee?: { - type: string; - maximum: number; - minimum: number; - }; - latestBlock?: { - type: string; - }; - version: { - type: string; - }; - health: { - type: string; - properties: { - status: { const: string }; - error: { type: string }; - }; - required: string[]; - }; - currentQueue: { - type: string; - }; - }; - required: string[]; -}; + required: string[]; +} -const addressType = { type: 'string', pattern: '^0x[a-fA-F0-9]{40}$' }; +export interface statusInstancesType { + type: string; + properties: { + [key in string]: statusInstanceType; + }; + required: string[]; +} -const bnType = { type: 'string', BN: true }; +export interface statusEthPricesType { + type: string; + properties: { + [key in string]: typeof bnSchemaType; + }; + required?: string[]; +} + +export interface statusSchema { + type: string; + properties: { + rewardAccount: typeof addressSchemaType; + instances?: statusInstancesType; + gasPrices: { + type: string; + properties: { + [key in string]: { + type: string; + }; + }; + required: string[]; + }; + netId: { + type: string; + }; + ethPrices?: statusEthPricesType; + tornadoServiceFee?: { + type: string; + maximum: number; + minimum: number; + }; + latestBlock: { + type: string; + }; + latestBalance: { + type: string; + BN: boolean; + }; + version: { + type: string; + }; + health: { + type: string; + properties: { + status: { const: string }; + error: { type: string }; + }; + required: string[]; + }; + syncStatus: { + type: string; + properties: { + events: { type: string }; + tokenPrice: { type: string }; + gasPrice: { type: string }; + }; + required: string[]; + }; + onSyncEvents: { type: string }; + currentQueue: { + type: string; + }; + }; + required: string[]; +} const statusSchema: statusSchema = { - type: 'object', - properties: { - rewardAccount: addressType, - gasPrices: { - type: 'object', - properties: { - fast: { type: 'number' }, - additionalProperties: { type: 'number' }, - }, - required: ['fast'], + type: 'object', + properties: { + rewardAccount: addressSchemaType, + gasPrices: { + type: 'object', + properties: { + fast: { type: 'number' }, + additionalProperties: { type: 'number' }, + }, + required: ['fast'], + }, + netId: { type: 'integer' }, + tornadoServiceFee: { type: 'number', maximum: 20, minimum: 0 }, + latestBlock: { type: 'number' }, + latestBalance: bnSchemaType, + version: { type: 'string' }, + health: { + type: 'object', + properties: { + status: { const: 'true' }, + error: { type: 'string' }, + }, + required: ['status'], + }, + syncStatus: { + type: 'object', + properties: { + events: { type: 'boolean' }, + tokenPrice: { type: 'boolean' }, + gasPrice: { type: 'boolean' }, + }, + required: ['events', 'tokenPrice', 'gasPrice'], + }, + onSyncEvents: { type: 'boolean' }, + currentQueue: { type: 'number' }, }, - netId: { type: 'integer' }, - tornadoServiceFee: { type: 'number', maximum: 20, minimum: 0 }, - latestBlock: { type: 'number' }, - version: { type: 'string' }, - health: { - type: 'object', - properties: { - status: { const: 'true' }, - error: { type: 'string' }, - }, - required: ['status'], - }, - currentQueue: { type: 'number' }, - }, - required: ['rewardAccount', 'instances', 'netId', 'tornadoServiceFee', 'version', 'health'], + required: ['rewardAccount', 'instances', 'netId', 'tornadoServiceFee', 'version', 'health', 'currentQueue'], }; -export function getStatusSchema(netId: NetIdType, config: Config) { - const { tokens, optionalTokens = [], nativeCurrency } = config; +export function getStatusSchema(netId: NetIdType, config: Config, tovarish: boolean) { + const { tokens, optionalTokens, disabledTokens, nativeCurrency } = config; - // deep copy schema - const schema = JSON.parse(JSON.stringify(statusSchema)) as statusSchema; + // deep copy schema + const schema = JSON.parse(JSON.stringify(statusSchema)) as statusSchema; - const instances = Object.keys(tokens).reduce( - (acc: statusInstancesType, token) => { - const { instanceAddress, tokenAddress, symbol, decimals, optionalInstances = [] } = tokens[token]; - const amounts = Object.keys(instanceAddress); + const instances = Object.keys(tokens).reduce( + (acc: statusInstancesType, token) => { + const { instanceAddress, tokenAddress, symbol, decimals, optionalInstances = [] } = tokens[token]; + const amounts = Object.keys(instanceAddress); - const instanceProperties: statusInstanceType = { - type: 'object', - properties: { - instanceAddress: { - type: 'object', - properties: amounts.reduce((acc: { [key in string]: typeof addressType }, cur) => { - acc[cur] = addressType; - return acc; - }, {}), - required: amounts.filter((amount) => !optionalInstances.includes(amount)), - }, - decimals: { enum: [decimals] }, + const instanceProperties: statusInstanceType = { + type: 'object', + properties: { + instanceAddress: { + type: 'object', + properties: amounts.reduce( + ( + acc: { + [key in string]: typeof addressSchemaType; + }, + cur, + ) => { + acc[cur] = addressSchemaType; + return acc; + }, + {}, + ), + required: amounts.filter((amount) => !optionalInstances.includes(amount)), + }, + decimals: { enum: [decimals] }, + }, + required: ['instanceAddress', 'decimals'].concat( + tokenAddress ? ['tokenAddress'] : [], + symbol ? ['symbol'] : [], + ), + }; + + if (tokenAddress) { + instanceProperties.properties.tokenAddress = addressSchemaType; + } + if (symbol) { + instanceProperties.properties.symbol = { enum: [symbol] }; + } + + acc.properties[token] = instanceProperties; + if (!optionalTokens?.includes(token) && !disabledTokens?.includes(token)) { + acc.required.push(token); + } + return acc; }, - required: ['instanceAddress', 'decimals'].concat( - tokenAddress ? ['tokenAddress'] : [], - symbol ? ['symbol'] : [], - ), - }; + { + type: 'object', + properties: {}, + required: [], + }, + ); - if (tokenAddress) { - instanceProperties.properties.tokenAddress = addressType; - } - if (symbol) { - instanceProperties.properties.symbol = { enum: [symbol] }; - } + schema.properties.instances = instances; - acc.properties[token] = instanceProperties; - if (!optionalTokens.includes(token)) { - acc.required.push(token); - } - return acc; - }, - { - type: 'object', - properties: {}, - required: [], - }, - ); + const _tokens = Object.keys(tokens).filter( + (t) => t !== nativeCurrency && !config.optionalTokens?.includes(t) && !config.disabledTokens?.includes(t), + ); - schema.properties.instances = instances; + if (netId === NetId.MAINNET) { + _tokens.push('torn'); + } - if (netId === NetId.MAINNET) { - const _tokens = Object.keys(tokens).filter((t) => t !== nativeCurrency); + if (_tokens.length) { + const ethPrices: statusEthPricesType = { + type: 'object', + properties: _tokens.reduce((acc: { [key in string]: typeof bnSchemaType }, token: string) => { + acc[token] = bnSchemaType; + return acc; + }, {}), + required: _tokens, + }; + schema.properties.ethPrices = ethPrices; + schema.required.push('ethPrices'); + } - const ethPrices: statusEthPricesType = { - type: 'object', - properties: _tokens.reduce((acc: { [key in string]: typeof bnType }, token: string) => { - acc[token] = bnType; - return acc; - }, {}), - // required: _tokens - }; - schema.properties.ethPrices = ethPrices; - // schema.required.push('ethPrices') - } + if (tovarish) { + schema.required.push('gasPrices', 'latestBlock', 'latestBalance', 'syncStatus', 'onSyncEvents'); + } - return schema; + return schema; } diff --git a/src/schemas/types.ts b/src/schemas/types.ts new file mode 100644 index 0000000..f7c8e1c --- /dev/null +++ b/src/schemas/types.ts @@ -0,0 +1,15 @@ +export const addressSchemaType = { + type: 'string', + pattern: '^0x[a-fA-F0-9]{40}$', + isAddress: true, +} as const; +export const bnSchemaType = { type: 'string', BN: true } as const; +export const proofSchemaType = { + type: 'string', + pattern: '^0x[a-fA-F0-9]{512}$', +} as const; +export const bytes32SchemaType = { + type: 'string', + pattern: '^0x[a-fA-F0-9]{64}$', +} as const; +export const bytes32BNSchemaType = { ...bytes32SchemaType, BN: true } as const; diff --git a/src/tokens.ts b/src/tokens.ts index b5eac82..350998a 100644 --- a/src/tokens.ts +++ b/src/tokens.ts @@ -4,87 +4,87 @@ import { chunk } from './utils'; import { Call3, multicall } from './multicall'; export interface tokenBalances { - address: string; - name: string; - symbol: string; - decimals: number; - balance: bigint; + address: string; + name: string; + symbol: string; + decimals: number; + balance: bigint; } export async function getTokenBalances({ - provider, - Multicall, - currencyName, - userAddress, - tokenAddresses = [], + provider, + Multicall, + currencyName, + userAddress, + tokenAddresses = [], }: { - provider: Provider; - Multicall: Multicall; - currencyName: string; - userAddress: string; - tokenAddresses: string[]; + provider: Provider; + Multicall: Multicall; + currencyName: string; + userAddress: string; + tokenAddresses: string[]; }): Promise { - const tokenCalls = tokenAddresses - .map((tokenAddress) => { - const Token = ERC20__factory.connect(tokenAddress, provider); + const tokenCalls = tokenAddresses + .map((tokenAddress) => { + const Token = ERC20__factory.connect(tokenAddress, provider); - return [ + return [ + { + contract: Token, + name: 'balanceOf', + params: [userAddress], + }, + { + contract: Token, + name: 'name', + }, + { + contract: Token, + name: 'symbol', + }, + { + contract: Token, + name: 'decimals', + }, + ]; + }) + .flat() as Call3[]; + + const multicallResults = await multicall(Multicall, [ { - contract: Token, - name: 'balanceOf', - params: [userAddress], + contract: Multicall, + name: 'getEthBalance', + params: [userAddress], }, + ...(tokenCalls.length ? tokenCalls : []), + ]); + + const ethResults = multicallResults[0]; + const tokenResults = multicallResults.slice(1).length + ? chunk(multicallResults.slice(1), tokenCalls.length / tokenAddresses.length) + : []; + + const tokenBalances = tokenResults.map((tokenResult, index) => { + const [tokenBalance, tokenName, tokenSymbol, tokenDecimals] = tokenResult; + const tokenAddress = tokenAddresses[index]; + + return { + address: tokenAddress, + name: tokenName, + symbol: tokenSymbol, + decimals: Number(tokenDecimals), + balance: tokenBalance, + }; + }); + + return [ { - contract: Token, - name: 'name', + address: ZeroAddress, + name: currencyName, + symbol: currencyName, + decimals: 18, + balance: ethResults, }, - { - contract: Token, - name: 'symbol', - }, - { - contract: Token, - name: 'decimals', - }, - ]; - }) - .flat() as Call3[]; - - const multicallResults = await multicall(Multicall, [ - { - contract: Multicall, - name: 'getEthBalance', - params: [userAddress], - }, - ...(tokenCalls.length ? tokenCalls : []), - ]); - - const ethResults = multicallResults[0]; - const tokenResults = multicallResults.slice(1).length - ? chunk(multicallResults.slice(1), tokenCalls.length / tokenAddresses.length) - : []; - - const tokenBalances = tokenResults.map((tokenResult, index) => { - const [tokenBalance, tokenName, tokenSymbol, tokenDecimals] = tokenResult; - const tokenAddress = tokenAddresses[index]; - - return { - address: tokenAddress, - name: tokenName, - symbol: tokenSymbol, - decimals: Number(tokenDecimals), - balance: tokenBalance, - }; - }); - - return [ - { - address: ZeroAddress, - name: currencyName, - symbol: currencyName, - decimals: 18, - balance: ethResults, - }, - ...tokenBalances, - ]; + ...tokenBalances, + ]; } diff --git a/src/tovarishClient.ts b/src/tovarishClient.ts new file mode 100644 index 0000000..df47cff --- /dev/null +++ b/src/tovarishClient.ts @@ -0,0 +1,399 @@ +import { getAddress } from 'ethers'; + +import { + RelayerClient, + RelayerClientConstructor, + RelayerError, + RelayerInfo, + RelayerStatus, + getSupportedInstances, +} from './relayerClient'; +import { fetchData } from './providers'; +import { CachedRelayerInfo, MinimalEvents } from './events'; +import { ajv, getEventsSchemaValidator, getStatusSchema } from './schemas'; +import { enabledChains, getConfig, NetId, NetIdType } from './networkConfig'; + +// Return no more than 5K events per query +export const MAX_TOVARISH_EVENTS = 5000; + +export interface EventsStatus { + events: number; + lastBlock: number; +} + +export interface TovarishEventsStatus { + governance?: EventsStatus; + registry?: EventsStatus; + revenue?: EventsStatus; + echo: EventsStatus; + encrypted_notes: EventsStatus; + tornado: EventsStatus; +} + +export interface TovarishSyncStatus { + events: boolean; + tokenPrice: boolean; + gasPrice: boolean; +} + +// Expected response from /status endpoint +export interface TovarishStatus extends RelayerStatus { + latestBalance: string; + events: TovarishEventsStatus; + syncStatus: TovarishSyncStatus; + onSyncEvents: boolean; +} + +// Formatted TovarishStatus for Frontend usage +export interface TovarishInfo extends RelayerInfo { + latestBlock: number; + latestBalance: string; + version: string; + events: TovarishEventsStatus; + syncStatus: TovarishSyncStatus; +} + +// Query input for TovarishEvents +export interface TovarishEventsQuery { + type: string; + currency?: string; + amount?: string; + fromBlock: number; + recent?: boolean; +} + +export interface BaseTovarishEvents { + events: T[]; + lastSyncBlock: number; +} + +export class TovarishClient extends RelayerClient { + declare selectedRelayer?: TovarishInfo; + + constructor(clientConstructor: RelayerClientConstructor) { + super(clientConstructor); + this.tovarish = true; + } + + async askRelayerStatus({ + hostname, + url, + relayerAddress, + }: { + hostname?: string; + // optional url if entered manually + url?: string; + // relayerAddress from registry contract to prevent cheating + relayerAddress?: string; + }): Promise { + const status = (await super.askRelayerStatus({ + hostname, + url, + relayerAddress, + })) as TovarishStatus; + + if (!status.version.includes('tovarish')) { + throw new Error('Not a tovarish relayer!'); + } + + return status; + } + + /** + * Ask status for all enabled chains for tovarish relayer + */ + async askAllStatus({ + hostname, + url, + relayerAddress, + }: { + hostname?: string; + // optional url if entered manually + url?: string; + // relayerAddress from registry contract to prevent cheating + relayerAddress?: string; + }): Promise { + if (!url && hostname) { + url = `https://${!hostname.endsWith('/') ? hostname + '/' : hostname}`; + } else if (url && !url.endsWith('/')) { + url += '/'; + } else { + url = ''; + } + + const statusArray = (await fetchData(`${url}status`, { + ...this.fetchDataOptions, + headers: { + 'Content-Type': 'application/json, application/x-www-form-urlencoded', + }, + timeout: 30000, + maxRetry: this.fetchDataOptions?.torPort ? 2 : 0, + })) as object; + + if (!Array.isArray(statusArray)) { + return []; + } + + const tovarishStatus: TovarishStatus[] = []; + + for (const rawStatus of statusArray) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const netId = (rawStatus as any).netId as NetIdType; + const config = getConfig(netId); + + const statusValidator = ajv.compile( + getStatusSchema( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (rawStatus as any).netId, + config, + this.tovarish, + ), + ); + + if (!statusValidator) { + continue; + } + + const status = { + ...rawStatus, + url: `${url}${netId}/`, + } as TovarishStatus; + + if (status.currentQueue > 5) { + throw new Error('Withdrawal queue is overloaded'); + } + + if (!enabledChains.includes(status.netId)) { + throw new Error('This relayer serves a different network'); + } + + if (relayerAddress && status.netId === NetId.MAINNET && status.rewardAccount !== relayerAddress) { + throw new Error('The Relayer reward address must match registered address'); + } + + if (!status.version.includes('tovarish')) { + throw new Error('Not a tovarish relayer!'); + } + + tovarishStatus.push(status); + } + + return tovarishStatus; + } + + async filterRelayer(relayer: CachedRelayerInfo): Promise { + const { ensName, relayerAddress, tovarishHost, tovarishNetworks } = relayer; + + if (!tovarishHost || !tovarishNetworks?.includes(this.netId)) { + return; + } + + const hostname = `${tovarishHost}/${this.netId}`; + + try { + const status = await this.askRelayerStatus({ + hostname, + relayerAddress, + }); + + return { + netId: status.netId, + url: status.url, + hostname, + ensName, + relayerAddress, + rewardAccount: getAddress(status.rewardAccount), + instances: getSupportedInstances(status.instances), + stakeBalance: relayer.stakeBalance, + gasPrice: status.gasPrices?.fast, + ethPrices: status.ethPrices, + currentQueue: status.currentQueue, + tornadoServiceFee: status.tornadoServiceFee, + // Additional fields for tovarish relayer + latestBlock: Number(status.latestBlock), + latestBalance: status.latestBalance, + version: status.version, + events: status.events, + syncStatus: status.syncStatus, + } as TovarishInfo; + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } catch (err: any) { + return { + hostname, + relayerAddress, + errorMessage: err.message, + hasError: true, + } as RelayerError; + } + } + + async getValidRelayers(relayers: CachedRelayerInfo[]): Promise<{ + validRelayers: TovarishInfo[]; + invalidRelayers: RelayerError[]; + }> { + const invalidRelayers: RelayerError[] = []; + + const validRelayers = (await Promise.all(relayers.map((relayer) => this.filterRelayer(relayer)))).filter( + (r) => { + if (!r) { + return false; + } + if ((r as RelayerError).hasError) { + invalidRelayers.push(r as RelayerError); + return false; + } + return true; + }, + ) as TovarishInfo[]; + + return { + validRelayers, + invalidRelayers, + }; + } + + async getTovarishRelayers(relayers: CachedRelayerInfo[]): Promise<{ + validRelayers: TovarishInfo[]; + invalidRelayers: RelayerError[]; + }> { + const validRelayers: TovarishInfo[] = []; + const invalidRelayers: RelayerError[] = []; + + await Promise.all( + relayers + .filter((r) => r.tovarishHost && r.tovarishNetworks?.length) + .map(async (relayer) => { + const { ensName, relayerAddress, tovarishHost } = relayer; + + try { + const statusArray = await this.askAllStatus({ + hostname: tovarishHost as string, + relayerAddress, + }); + + for (const status of statusArray) { + validRelayers.push({ + netId: status.netId, + url: status.url, + hostname: tovarishHost as string, + ensName, + relayerAddress, + rewardAccount: getAddress(status.rewardAccount), + instances: getSupportedInstances(status.instances), + stakeBalance: relayer.stakeBalance, + gasPrice: status.gasPrices?.fast, + ethPrices: status.ethPrices, + currentQueue: status.currentQueue, + tornadoServiceFee: status.tornadoServiceFee, + // Additional fields for tovarish relayer + latestBlock: Number(status.latestBlock), + latestBalance: status.latestBalance, + version: status.version, + events: status.events, + syncStatus: status.syncStatus, + }); + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } catch (err: any) { + invalidRelayers.push({ + hostname: tovarishHost as string, + relayerAddress, + errorMessage: err.message, + hasError: true, + }); + } + }), + ); + + return { + validRelayers, + invalidRelayers, + }; + } + + async getEvents({ + type, + currency, + amount, + fromBlock, + recent, + }: TovarishEventsQuery): Promise> { + const url = `${this.selectedRelayer?.url}events`; + + const schemaValidator = getEventsSchemaValidator(type); + + try { + const events = []; + let lastSyncBlock = fromBlock; + + // eslint-disable-next-line no-constant-condition + while (true) { + // eslint-disable-next-line prefer-const + let { events: fetchedEvents, lastSyncBlock: currentBlock } = (await fetchData(url, { + ...this.fetchDataOptions, + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + type, + currency, + amount, + fromBlock, + recent, + }), + })) as BaseTovarishEvents; + + if (!schemaValidator(fetchedEvents)) { + const errMsg = `Schema validation failed for ${type} events`; + throw new Error(errMsg); + } + + if (recent) { + return { + events: fetchedEvents, + lastSyncBlock: currentBlock, + }; + } + + lastSyncBlock = currentBlock; + + if (!Array.isArray(fetchedEvents) || !fetchedEvents.length) { + break; + } + + fetchedEvents = fetchedEvents.sort((a, b) => { + if (a.blockNumber === b.blockNumber) { + return a.logIndex - b.logIndex; + } + return a.blockNumber - b.blockNumber; + }); + + const [lastEvent] = fetchedEvents.slice(-1); + + if (fetchedEvents.length < MAX_TOVARISH_EVENTS - 100) { + events.push(...fetchedEvents); + break; + } + + fetchedEvents = fetchedEvents.filter((e) => e.blockNumber !== lastEvent.blockNumber); + fromBlock = Number(lastEvent.blockNumber); + + events.push(...fetchedEvents); + } + + return { + events, + lastSyncBlock, + }; + } catch (err) { + console.log('Error from TovarishClient events endpoint'); + console.log(err); + return { + events: [], + lastSyncBlock: fromBlock, + }; + } + } +} diff --git a/src/typechain/ENSNameWrapper.ts b/src/typechain/ENSNameWrapper.ts new file mode 100644 index 0000000..34dc801 --- /dev/null +++ b/src/typechain/ENSNameWrapper.ts @@ -0,0 +1,1486 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumberish, + BytesLike, + FunctionFragment, + Result, + Interface, + EventFragment, + AddressLike, + ContractRunner, + ContractMethod, + Listener, +} from "ethers"; +import type { + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedLogDescription, + TypedListener, + TypedContractMethod, +} from "./common"; + +export interface ENSNameWrapperInterface extends Interface { + getFunction( + nameOrSignature: + | "_tokens" + | "allFusesBurned" + | "approve" + | "balanceOf" + | "balanceOfBatch" + | "canExtendSubnames" + | "canModifyName" + | "controllers" + | "ens" + | "extendExpiry" + | "getApproved" + | "getData" + | "isApprovedForAll" + | "isWrapped(bytes32,bytes32)" + | "isWrapped(bytes32)" + | "metadataService" + | "name" + | "names" + | "onERC721Received" + | "owner" + | "ownerOf" + | "recoverFunds" + | "registerAndWrapETH2LD" + | "registrar" + | "renew" + | "renounceOwnership" + | "safeBatchTransferFrom" + | "safeTransferFrom" + | "setApprovalForAll" + | "setChildFuses" + | "setController" + | "setFuses" + | "setMetadataService" + | "setRecord" + | "setResolver" + | "setSubnodeOwner" + | "setSubnodeRecord" + | "setTTL" + | "setUpgradeContract" + | "supportsInterface" + | "transferOwnership" + | "unwrap" + | "unwrapETH2LD" + | "upgrade" + | "upgradeContract" + | "uri" + | "wrap" + | "wrapETH2LD" + ): FunctionFragment; + + getEvent( + nameOrSignatureOrTopic: + | "Approval" + | "ApprovalForAll" + | "ControllerChanged" + | "ExpiryExtended" + | "FusesSet" + | "NameUnwrapped" + | "NameWrapped" + | "OwnershipTransferred" + | "TransferBatch" + | "TransferSingle" + | "URI" + ): EventFragment; + + encodeFunctionData( + functionFragment: "_tokens", + values: [BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "allFusesBurned", + values: [BytesLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "approve", + values: [AddressLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "balanceOf", + values: [AddressLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "balanceOfBatch", + values: [AddressLike[], BigNumberish[]] + ): string; + encodeFunctionData( + functionFragment: "canExtendSubnames", + values: [BytesLike, AddressLike] + ): string; + encodeFunctionData( + functionFragment: "canModifyName", + values: [BytesLike, AddressLike] + ): string; + encodeFunctionData( + functionFragment: "controllers", + values: [AddressLike] + ): string; + encodeFunctionData(functionFragment: "ens", values?: undefined): string; + encodeFunctionData( + functionFragment: "extendExpiry", + values: [BytesLike, BytesLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "getApproved", + values: [BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "getData", + values: [BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "isApprovedForAll", + values: [AddressLike, AddressLike] + ): string; + encodeFunctionData( + functionFragment: "isWrapped(bytes32,bytes32)", + values: [BytesLike, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "isWrapped(bytes32)", + values: [BytesLike] + ): string; + encodeFunctionData( + functionFragment: "metadataService", + values?: undefined + ): string; + encodeFunctionData(functionFragment: "name", values?: undefined): string; + encodeFunctionData(functionFragment: "names", values: [BytesLike]): string; + encodeFunctionData( + functionFragment: "onERC721Received", + values: [AddressLike, AddressLike, BigNumberish, BytesLike] + ): string; + encodeFunctionData(functionFragment: "owner", values?: undefined): string; + encodeFunctionData( + functionFragment: "ownerOf", + values: [BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "recoverFunds", + values: [AddressLike, AddressLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "registerAndWrapETH2LD", + values: [string, AddressLike, BigNumberish, AddressLike, BigNumberish] + ): string; + encodeFunctionData(functionFragment: "registrar", values?: undefined): string; + encodeFunctionData( + functionFragment: "renew", + values: [BigNumberish, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "renounceOwnership", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "safeBatchTransferFrom", + values: [ + AddressLike, + AddressLike, + BigNumberish[], + BigNumberish[], + BytesLike + ] + ): string; + encodeFunctionData( + functionFragment: "safeTransferFrom", + values: [AddressLike, AddressLike, BigNumberish, BigNumberish, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "setApprovalForAll", + values: [AddressLike, boolean] + ): string; + encodeFunctionData( + functionFragment: "setChildFuses", + values: [BytesLike, BytesLike, BigNumberish, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "setController", + values: [AddressLike, boolean] + ): string; + encodeFunctionData( + functionFragment: "setFuses", + values: [BytesLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "setMetadataService", + values: [AddressLike] + ): string; + encodeFunctionData( + functionFragment: "setRecord", + values: [BytesLike, AddressLike, AddressLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "setResolver", + values: [BytesLike, AddressLike] + ): string; + encodeFunctionData( + functionFragment: "setSubnodeOwner", + values: [BytesLike, string, AddressLike, BigNumberish, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "setSubnodeRecord", + values: [ + BytesLike, + string, + AddressLike, + AddressLike, + BigNumberish, + BigNumberish, + BigNumberish + ] + ): string; + encodeFunctionData( + functionFragment: "setTTL", + values: [BytesLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "setUpgradeContract", + values: [AddressLike] + ): string; + encodeFunctionData( + functionFragment: "supportsInterface", + values: [BytesLike] + ): string; + encodeFunctionData( + functionFragment: "transferOwnership", + values: [AddressLike] + ): string; + encodeFunctionData( + functionFragment: "unwrap", + values: [BytesLike, BytesLike, AddressLike] + ): string; + encodeFunctionData( + functionFragment: "unwrapETH2LD", + values: [BytesLike, AddressLike, AddressLike] + ): string; + encodeFunctionData( + functionFragment: "upgrade", + values: [BytesLike, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "upgradeContract", + values?: undefined + ): string; + encodeFunctionData(functionFragment: "uri", values: [BigNumberish]): string; + encodeFunctionData( + functionFragment: "wrap", + values: [BytesLike, AddressLike, AddressLike] + ): string; + encodeFunctionData( + functionFragment: "wrapETH2LD", + values: [string, AddressLike, BigNumberish, AddressLike] + ): string; + + decodeFunctionResult(functionFragment: "_tokens", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "allFusesBurned", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "balanceOfBatch", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "canExtendSubnames", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "canModifyName", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "controllers", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "ens", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "extendExpiry", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getApproved", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "getData", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "isApprovedForAll", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "isWrapped(bytes32,bytes32)", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "isWrapped(bytes32)", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "metadataService", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "name", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "names", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "onERC721Received", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "ownerOf", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "recoverFunds", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "registerAndWrapETH2LD", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "registrar", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "renew", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "renounceOwnership", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "safeBatchTransferFrom", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "safeTransferFrom", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setApprovalForAll", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setChildFuses", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setController", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "setFuses", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "setMetadataService", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "setRecord", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "setResolver", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setSubnodeOwner", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setSubnodeRecord", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "setTTL", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "setUpgradeContract", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "supportsInterface", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "transferOwnership", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "unwrap", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "unwrapETH2LD", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "upgrade", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "upgradeContract", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "uri", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "wrap", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "wrapETH2LD", data: BytesLike): Result; +} + +export namespace ApprovalEvent { + export type InputTuple = [ + owner: AddressLike, + approved: AddressLike, + tokenId: BigNumberish + ]; + export type OutputTuple = [owner: string, approved: string, tokenId: bigint]; + export interface OutputObject { + owner: string; + approved: string; + tokenId: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace ApprovalForAllEvent { + export type InputTuple = [ + account: AddressLike, + operator: AddressLike, + approved: boolean + ]; + export type OutputTuple = [ + account: string, + operator: string, + approved: boolean + ]; + export interface OutputObject { + account: string; + operator: string; + approved: boolean; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace ControllerChangedEvent { + export type InputTuple = [controller: AddressLike, active: boolean]; + export type OutputTuple = [controller: string, active: boolean]; + export interface OutputObject { + controller: string; + active: boolean; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace ExpiryExtendedEvent { + export type InputTuple = [node: BytesLike, expiry: BigNumberish]; + export type OutputTuple = [node: string, expiry: bigint]; + export interface OutputObject { + node: string; + expiry: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace FusesSetEvent { + export type InputTuple = [node: BytesLike, fuses: BigNumberish]; + export type OutputTuple = [node: string, fuses: bigint]; + export interface OutputObject { + node: string; + fuses: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace NameUnwrappedEvent { + export type InputTuple = [node: BytesLike, owner: AddressLike]; + export type OutputTuple = [node: string, owner: string]; + export interface OutputObject { + node: string; + owner: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace NameWrappedEvent { + export type InputTuple = [ + node: BytesLike, + name: BytesLike, + owner: AddressLike, + fuses: BigNumberish, + expiry: BigNumberish + ]; + export type OutputTuple = [ + node: string, + name: string, + owner: string, + fuses: bigint, + expiry: bigint + ]; + export interface OutputObject { + node: string; + name: string; + owner: string; + fuses: bigint; + expiry: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace OwnershipTransferredEvent { + export type InputTuple = [previousOwner: AddressLike, newOwner: AddressLike]; + export type OutputTuple = [previousOwner: string, newOwner: string]; + export interface OutputObject { + previousOwner: string; + newOwner: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace TransferBatchEvent { + export type InputTuple = [ + operator: AddressLike, + from: AddressLike, + to: AddressLike, + ids: BigNumberish[], + values: BigNumberish[] + ]; + export type OutputTuple = [ + operator: string, + from: string, + to: string, + ids: bigint[], + values: bigint[] + ]; + export interface OutputObject { + operator: string; + from: string; + to: string; + ids: bigint[]; + values: bigint[]; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace TransferSingleEvent { + export type InputTuple = [ + operator: AddressLike, + from: AddressLike, + to: AddressLike, + id: BigNumberish, + value: BigNumberish + ]; + export type OutputTuple = [ + operator: string, + from: string, + to: string, + id: bigint, + value: bigint + ]; + export interface OutputObject { + operator: string; + from: string; + to: string; + id: bigint; + value: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace URIEvent { + export type InputTuple = [value: string, id: BigNumberish]; + export type OutputTuple = [value: string, id: bigint]; + export interface OutputObject { + value: string; + id: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export interface ENSNameWrapper extends BaseContract { + connect(runner?: ContractRunner | null): ENSNameWrapper; + waitForDeployment(): Promise; + + interface: ENSNameWrapperInterface; + + queryFilter( + event: TCEvent, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + queryFilter( + filter: TypedDeferredTopicFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + + on( + event: TCEvent, + listener: TypedListener + ): Promise; + on( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + once( + event: TCEvent, + listener: TypedListener + ): Promise; + once( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + listeners( + event: TCEvent + ): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners( + event?: TCEvent + ): Promise; + + _tokens: TypedContractMethod<[arg0: BigNumberish], [bigint], "view">; + + allFusesBurned: TypedContractMethod< + [node: BytesLike, fuseMask: BigNumberish], + [boolean], + "view" + >; + + approve: TypedContractMethod< + [to: AddressLike, tokenId: BigNumberish], + [void], + "nonpayable" + >; + + balanceOf: TypedContractMethod< + [account: AddressLike, id: BigNumberish], + [bigint], + "view" + >; + + balanceOfBatch: TypedContractMethod< + [accounts: AddressLike[], ids: BigNumberish[]], + [bigint[]], + "view" + >; + + canExtendSubnames: TypedContractMethod< + [node: BytesLike, addr: AddressLike], + [boolean], + "view" + >; + + canModifyName: TypedContractMethod< + [node: BytesLike, addr: AddressLike], + [boolean], + "view" + >; + + controllers: TypedContractMethod<[arg0: AddressLike], [boolean], "view">; + + ens: TypedContractMethod<[], [string], "view">; + + extendExpiry: TypedContractMethod< + [parentNode: BytesLike, labelhash: BytesLike, expiry: BigNumberish], + [bigint], + "nonpayable" + >; + + getApproved: TypedContractMethod<[id: BigNumberish], [string], "view">; + + getData: TypedContractMethod< + [id: BigNumberish], + [ + [string, bigint, bigint] & { + owner: string; + fuses: bigint; + expiry: bigint; + } + ], + "view" + >; + + isApprovedForAll: TypedContractMethod< + [account: AddressLike, operator: AddressLike], + [boolean], + "view" + >; + + "isWrapped(bytes32,bytes32)": TypedContractMethod< + [parentNode: BytesLike, labelhash: BytesLike], + [boolean], + "view" + >; + + "isWrapped(bytes32)": TypedContractMethod< + [node: BytesLike], + [boolean], + "view" + >; + + metadataService: TypedContractMethod<[], [string], "view">; + + name: TypedContractMethod<[], [string], "view">; + + names: TypedContractMethod<[arg0: BytesLike], [string], "view">; + + onERC721Received: TypedContractMethod< + [ + to: AddressLike, + arg1: AddressLike, + tokenId: BigNumberish, + data: BytesLike + ], + [string], + "nonpayable" + >; + + owner: TypedContractMethod<[], [string], "view">; + + ownerOf: TypedContractMethod<[id: BigNumberish], [string], "view">; + + recoverFunds: TypedContractMethod< + [_token: AddressLike, _to: AddressLike, _amount: BigNumberish], + [void], + "nonpayable" + >; + + registerAndWrapETH2LD: TypedContractMethod< + [ + label: string, + wrappedOwner: AddressLike, + duration: BigNumberish, + resolver: AddressLike, + ownerControlledFuses: BigNumberish + ], + [bigint], + "nonpayable" + >; + + registrar: TypedContractMethod<[], [string], "view">; + + renew: TypedContractMethod< + [tokenId: BigNumberish, duration: BigNumberish], + [bigint], + "nonpayable" + >; + + renounceOwnership: TypedContractMethod<[], [void], "nonpayable">; + + safeBatchTransferFrom: TypedContractMethod< + [ + from: AddressLike, + to: AddressLike, + ids: BigNumberish[], + amounts: BigNumberish[], + data: BytesLike + ], + [void], + "nonpayable" + >; + + safeTransferFrom: TypedContractMethod< + [ + from: AddressLike, + to: AddressLike, + id: BigNumberish, + amount: BigNumberish, + data: BytesLike + ], + [void], + "nonpayable" + >; + + setApprovalForAll: TypedContractMethod< + [operator: AddressLike, approved: boolean], + [void], + "nonpayable" + >; + + setChildFuses: TypedContractMethod< + [ + parentNode: BytesLike, + labelhash: BytesLike, + fuses: BigNumberish, + expiry: BigNumberish + ], + [void], + "nonpayable" + >; + + setController: TypedContractMethod< + [controller: AddressLike, active: boolean], + [void], + "nonpayable" + >; + + setFuses: TypedContractMethod< + [node: BytesLike, ownerControlledFuses: BigNumberish], + [bigint], + "nonpayable" + >; + + setMetadataService: TypedContractMethod< + [_metadataService: AddressLike], + [void], + "nonpayable" + >; + + setRecord: TypedContractMethod< + [ + node: BytesLike, + owner: AddressLike, + resolver: AddressLike, + ttl: BigNumberish + ], + [void], + "nonpayable" + >; + + setResolver: TypedContractMethod< + [node: BytesLike, resolver: AddressLike], + [void], + "nonpayable" + >; + + setSubnodeOwner: TypedContractMethod< + [ + parentNode: BytesLike, + label: string, + owner: AddressLike, + fuses: BigNumberish, + expiry: BigNumberish + ], + [string], + "nonpayable" + >; + + setSubnodeRecord: TypedContractMethod< + [ + parentNode: BytesLike, + label: string, + owner: AddressLike, + resolver: AddressLike, + ttl: BigNumberish, + fuses: BigNumberish, + expiry: BigNumberish + ], + [string], + "nonpayable" + >; + + setTTL: TypedContractMethod< + [node: BytesLike, ttl: BigNumberish], + [void], + "nonpayable" + >; + + setUpgradeContract: TypedContractMethod< + [_upgradeAddress: AddressLike], + [void], + "nonpayable" + >; + + supportsInterface: TypedContractMethod< + [interfaceId: BytesLike], + [boolean], + "view" + >; + + transferOwnership: TypedContractMethod< + [newOwner: AddressLike], + [void], + "nonpayable" + >; + + unwrap: TypedContractMethod< + [parentNode: BytesLike, labelhash: BytesLike, controller: AddressLike], + [void], + "nonpayable" + >; + + unwrapETH2LD: TypedContractMethod< + [labelhash: BytesLike, registrant: AddressLike, controller: AddressLike], + [void], + "nonpayable" + >; + + upgrade: TypedContractMethod< + [name: BytesLike, extraData: BytesLike], + [void], + "nonpayable" + >; + + upgradeContract: TypedContractMethod<[], [string], "view">; + + uri: TypedContractMethod<[tokenId: BigNumberish], [string], "view">; + + wrap: TypedContractMethod< + [name: BytesLike, wrappedOwner: AddressLike, resolver: AddressLike], + [void], + "nonpayable" + >; + + wrapETH2LD: TypedContractMethod< + [ + label: string, + wrappedOwner: AddressLike, + ownerControlledFuses: BigNumberish, + resolver: AddressLike + ], + [bigint], + "nonpayable" + >; + + getFunction( + key: string | FunctionFragment + ): T; + + getFunction( + nameOrSignature: "_tokens" + ): TypedContractMethod<[arg0: BigNumberish], [bigint], "view">; + getFunction( + nameOrSignature: "allFusesBurned" + ): TypedContractMethod< + [node: BytesLike, fuseMask: BigNumberish], + [boolean], + "view" + >; + getFunction( + nameOrSignature: "approve" + ): TypedContractMethod< + [to: AddressLike, tokenId: BigNumberish], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "balanceOf" + ): TypedContractMethod< + [account: AddressLike, id: BigNumberish], + [bigint], + "view" + >; + getFunction( + nameOrSignature: "balanceOfBatch" + ): TypedContractMethod< + [accounts: AddressLike[], ids: BigNumberish[]], + [bigint[]], + "view" + >; + getFunction( + nameOrSignature: "canExtendSubnames" + ): TypedContractMethod< + [node: BytesLike, addr: AddressLike], + [boolean], + "view" + >; + getFunction( + nameOrSignature: "canModifyName" + ): TypedContractMethod< + [node: BytesLike, addr: AddressLike], + [boolean], + "view" + >; + getFunction( + nameOrSignature: "controllers" + ): TypedContractMethod<[arg0: AddressLike], [boolean], "view">; + getFunction( + nameOrSignature: "ens" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "extendExpiry" + ): TypedContractMethod< + [parentNode: BytesLike, labelhash: BytesLike, expiry: BigNumberish], + [bigint], + "nonpayable" + >; + getFunction( + nameOrSignature: "getApproved" + ): TypedContractMethod<[id: BigNumberish], [string], "view">; + getFunction( + nameOrSignature: "getData" + ): TypedContractMethod< + [id: BigNumberish], + [ + [string, bigint, bigint] & { + owner: string; + fuses: bigint; + expiry: bigint; + } + ], + "view" + >; + getFunction( + nameOrSignature: "isApprovedForAll" + ): TypedContractMethod< + [account: AddressLike, operator: AddressLike], + [boolean], + "view" + >; + getFunction( + nameOrSignature: "isWrapped(bytes32,bytes32)" + ): TypedContractMethod< + [parentNode: BytesLike, labelhash: BytesLike], + [boolean], + "view" + >; + getFunction( + nameOrSignature: "isWrapped(bytes32)" + ): TypedContractMethod<[node: BytesLike], [boolean], "view">; + getFunction( + nameOrSignature: "metadataService" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "name" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "names" + ): TypedContractMethod<[arg0: BytesLike], [string], "view">; + getFunction( + nameOrSignature: "onERC721Received" + ): TypedContractMethod< + [ + to: AddressLike, + arg1: AddressLike, + tokenId: BigNumberish, + data: BytesLike + ], + [string], + "nonpayable" + >; + getFunction( + nameOrSignature: "owner" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "ownerOf" + ): TypedContractMethod<[id: BigNumberish], [string], "view">; + getFunction( + nameOrSignature: "recoverFunds" + ): TypedContractMethod< + [_token: AddressLike, _to: AddressLike, _amount: BigNumberish], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "registerAndWrapETH2LD" + ): TypedContractMethod< + [ + label: string, + wrappedOwner: AddressLike, + duration: BigNumberish, + resolver: AddressLike, + ownerControlledFuses: BigNumberish + ], + [bigint], + "nonpayable" + >; + getFunction( + nameOrSignature: "registrar" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "renew" + ): TypedContractMethod< + [tokenId: BigNumberish, duration: BigNumberish], + [bigint], + "nonpayable" + >; + getFunction( + nameOrSignature: "renounceOwnership" + ): TypedContractMethod<[], [void], "nonpayable">; + getFunction( + nameOrSignature: "safeBatchTransferFrom" + ): TypedContractMethod< + [ + from: AddressLike, + to: AddressLike, + ids: BigNumberish[], + amounts: BigNumberish[], + data: BytesLike + ], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "safeTransferFrom" + ): TypedContractMethod< + [ + from: AddressLike, + to: AddressLike, + id: BigNumberish, + amount: BigNumberish, + data: BytesLike + ], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setApprovalForAll" + ): TypedContractMethod< + [operator: AddressLike, approved: boolean], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setChildFuses" + ): TypedContractMethod< + [ + parentNode: BytesLike, + labelhash: BytesLike, + fuses: BigNumberish, + expiry: BigNumberish + ], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setController" + ): TypedContractMethod< + [controller: AddressLike, active: boolean], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setFuses" + ): TypedContractMethod< + [node: BytesLike, ownerControlledFuses: BigNumberish], + [bigint], + "nonpayable" + >; + getFunction( + nameOrSignature: "setMetadataService" + ): TypedContractMethod<[_metadataService: AddressLike], [void], "nonpayable">; + getFunction( + nameOrSignature: "setRecord" + ): TypedContractMethod< + [ + node: BytesLike, + owner: AddressLike, + resolver: AddressLike, + ttl: BigNumberish + ], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setResolver" + ): TypedContractMethod< + [node: BytesLike, resolver: AddressLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setSubnodeOwner" + ): TypedContractMethod< + [ + parentNode: BytesLike, + label: string, + owner: AddressLike, + fuses: BigNumberish, + expiry: BigNumberish + ], + [string], + "nonpayable" + >; + getFunction( + nameOrSignature: "setSubnodeRecord" + ): TypedContractMethod< + [ + parentNode: BytesLike, + label: string, + owner: AddressLike, + resolver: AddressLike, + ttl: BigNumberish, + fuses: BigNumberish, + expiry: BigNumberish + ], + [string], + "nonpayable" + >; + getFunction( + nameOrSignature: "setTTL" + ): TypedContractMethod< + [node: BytesLike, ttl: BigNumberish], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setUpgradeContract" + ): TypedContractMethod<[_upgradeAddress: AddressLike], [void], "nonpayable">; + getFunction( + nameOrSignature: "supportsInterface" + ): TypedContractMethod<[interfaceId: BytesLike], [boolean], "view">; + getFunction( + nameOrSignature: "transferOwnership" + ): TypedContractMethod<[newOwner: AddressLike], [void], "nonpayable">; + getFunction( + nameOrSignature: "unwrap" + ): TypedContractMethod< + [parentNode: BytesLike, labelhash: BytesLike, controller: AddressLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "unwrapETH2LD" + ): TypedContractMethod< + [labelhash: BytesLike, registrant: AddressLike, controller: AddressLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "upgrade" + ): TypedContractMethod< + [name: BytesLike, extraData: BytesLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "upgradeContract" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "uri" + ): TypedContractMethod<[tokenId: BigNumberish], [string], "view">; + getFunction( + nameOrSignature: "wrap" + ): TypedContractMethod< + [name: BytesLike, wrappedOwner: AddressLike, resolver: AddressLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "wrapETH2LD" + ): TypedContractMethod< + [ + label: string, + wrappedOwner: AddressLike, + ownerControlledFuses: BigNumberish, + resolver: AddressLike + ], + [bigint], + "nonpayable" + >; + + getEvent( + key: "Approval" + ): TypedContractEvent< + ApprovalEvent.InputTuple, + ApprovalEvent.OutputTuple, + ApprovalEvent.OutputObject + >; + getEvent( + key: "ApprovalForAll" + ): TypedContractEvent< + ApprovalForAllEvent.InputTuple, + ApprovalForAllEvent.OutputTuple, + ApprovalForAllEvent.OutputObject + >; + getEvent( + key: "ControllerChanged" + ): TypedContractEvent< + ControllerChangedEvent.InputTuple, + ControllerChangedEvent.OutputTuple, + ControllerChangedEvent.OutputObject + >; + getEvent( + key: "ExpiryExtended" + ): TypedContractEvent< + ExpiryExtendedEvent.InputTuple, + ExpiryExtendedEvent.OutputTuple, + ExpiryExtendedEvent.OutputObject + >; + getEvent( + key: "FusesSet" + ): TypedContractEvent< + FusesSetEvent.InputTuple, + FusesSetEvent.OutputTuple, + FusesSetEvent.OutputObject + >; + getEvent( + key: "NameUnwrapped" + ): TypedContractEvent< + NameUnwrappedEvent.InputTuple, + NameUnwrappedEvent.OutputTuple, + NameUnwrappedEvent.OutputObject + >; + getEvent( + key: "NameWrapped" + ): TypedContractEvent< + NameWrappedEvent.InputTuple, + NameWrappedEvent.OutputTuple, + NameWrappedEvent.OutputObject + >; + getEvent( + key: "OwnershipTransferred" + ): TypedContractEvent< + OwnershipTransferredEvent.InputTuple, + OwnershipTransferredEvent.OutputTuple, + OwnershipTransferredEvent.OutputObject + >; + getEvent( + key: "TransferBatch" + ): TypedContractEvent< + TransferBatchEvent.InputTuple, + TransferBatchEvent.OutputTuple, + TransferBatchEvent.OutputObject + >; + getEvent( + key: "TransferSingle" + ): TypedContractEvent< + TransferSingleEvent.InputTuple, + TransferSingleEvent.OutputTuple, + TransferSingleEvent.OutputObject + >; + getEvent( + key: "URI" + ): TypedContractEvent< + URIEvent.InputTuple, + URIEvent.OutputTuple, + URIEvent.OutputObject + >; + + filters: { + "Approval(address,address,uint256)": TypedContractEvent< + ApprovalEvent.InputTuple, + ApprovalEvent.OutputTuple, + ApprovalEvent.OutputObject + >; + Approval: TypedContractEvent< + ApprovalEvent.InputTuple, + ApprovalEvent.OutputTuple, + ApprovalEvent.OutputObject + >; + + "ApprovalForAll(address,address,bool)": TypedContractEvent< + ApprovalForAllEvent.InputTuple, + ApprovalForAllEvent.OutputTuple, + ApprovalForAllEvent.OutputObject + >; + ApprovalForAll: TypedContractEvent< + ApprovalForAllEvent.InputTuple, + ApprovalForAllEvent.OutputTuple, + ApprovalForAllEvent.OutputObject + >; + + "ControllerChanged(address,bool)": TypedContractEvent< + ControllerChangedEvent.InputTuple, + ControllerChangedEvent.OutputTuple, + ControllerChangedEvent.OutputObject + >; + ControllerChanged: TypedContractEvent< + ControllerChangedEvent.InputTuple, + ControllerChangedEvent.OutputTuple, + ControllerChangedEvent.OutputObject + >; + + "ExpiryExtended(bytes32,uint64)": TypedContractEvent< + ExpiryExtendedEvent.InputTuple, + ExpiryExtendedEvent.OutputTuple, + ExpiryExtendedEvent.OutputObject + >; + ExpiryExtended: TypedContractEvent< + ExpiryExtendedEvent.InputTuple, + ExpiryExtendedEvent.OutputTuple, + ExpiryExtendedEvent.OutputObject + >; + + "FusesSet(bytes32,uint32)": TypedContractEvent< + FusesSetEvent.InputTuple, + FusesSetEvent.OutputTuple, + FusesSetEvent.OutputObject + >; + FusesSet: TypedContractEvent< + FusesSetEvent.InputTuple, + FusesSetEvent.OutputTuple, + FusesSetEvent.OutputObject + >; + + "NameUnwrapped(bytes32,address)": TypedContractEvent< + NameUnwrappedEvent.InputTuple, + NameUnwrappedEvent.OutputTuple, + NameUnwrappedEvent.OutputObject + >; + NameUnwrapped: TypedContractEvent< + NameUnwrappedEvent.InputTuple, + NameUnwrappedEvent.OutputTuple, + NameUnwrappedEvent.OutputObject + >; + + "NameWrapped(bytes32,bytes,address,uint32,uint64)": TypedContractEvent< + NameWrappedEvent.InputTuple, + NameWrappedEvent.OutputTuple, + NameWrappedEvent.OutputObject + >; + NameWrapped: TypedContractEvent< + NameWrappedEvent.InputTuple, + NameWrappedEvent.OutputTuple, + NameWrappedEvent.OutputObject + >; + + "OwnershipTransferred(address,address)": TypedContractEvent< + OwnershipTransferredEvent.InputTuple, + OwnershipTransferredEvent.OutputTuple, + OwnershipTransferredEvent.OutputObject + >; + OwnershipTransferred: TypedContractEvent< + OwnershipTransferredEvent.InputTuple, + OwnershipTransferredEvent.OutputTuple, + OwnershipTransferredEvent.OutputObject + >; + + "TransferBatch(address,address,address,uint256[],uint256[])": TypedContractEvent< + TransferBatchEvent.InputTuple, + TransferBatchEvent.OutputTuple, + TransferBatchEvent.OutputObject + >; + TransferBatch: TypedContractEvent< + TransferBatchEvent.InputTuple, + TransferBatchEvent.OutputTuple, + TransferBatchEvent.OutputObject + >; + + "TransferSingle(address,address,address,uint256,uint256)": TypedContractEvent< + TransferSingleEvent.InputTuple, + TransferSingleEvent.OutputTuple, + TransferSingleEvent.OutputObject + >; + TransferSingle: TypedContractEvent< + TransferSingleEvent.InputTuple, + TransferSingleEvent.OutputTuple, + TransferSingleEvent.OutputObject + >; + + "URI(string,uint256)": TypedContractEvent< + URIEvent.InputTuple, + URIEvent.OutputTuple, + URIEvent.OutputObject + >; + URI: TypedContractEvent< + URIEvent.InputTuple, + URIEvent.OutputTuple, + URIEvent.OutputObject + >; + }; +} diff --git a/src/typechain/ENSRegistry.ts b/src/typechain/ENSRegistry.ts new file mode 100644 index 0000000..e39d926 --- /dev/null +++ b/src/typechain/ENSRegistry.ts @@ -0,0 +1,497 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumberish, + BytesLike, + FunctionFragment, + Result, + Interface, + EventFragment, + AddressLike, + ContractRunner, + ContractMethod, + Listener, +} from "ethers"; +import type { + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedLogDescription, + TypedListener, + TypedContractMethod, +} from "./common"; + +export interface ENSRegistryInterface extends Interface { + getFunction( + nameOrSignature: + | "isApprovedForAll" + | "old" + | "owner" + | "recordExists" + | "resolver" + | "setApprovalForAll" + | "setOwner" + | "setRecord" + | "setResolver" + | "setSubnodeOwner" + | "setSubnodeRecord" + | "setTTL" + | "ttl" + ): FunctionFragment; + + getEvent( + nameOrSignatureOrTopic: + | "ApprovalForAll" + | "NewOwner" + | "NewResolver" + | "NewTTL" + | "Transfer" + ): EventFragment; + + encodeFunctionData( + functionFragment: "isApprovedForAll", + values: [AddressLike, AddressLike] + ): string; + encodeFunctionData(functionFragment: "old", values?: undefined): string; + encodeFunctionData(functionFragment: "owner", values: [BytesLike]): string; + encodeFunctionData( + functionFragment: "recordExists", + values: [BytesLike] + ): string; + encodeFunctionData(functionFragment: "resolver", values: [BytesLike]): string; + encodeFunctionData( + functionFragment: "setApprovalForAll", + values: [AddressLike, boolean] + ): string; + encodeFunctionData( + functionFragment: "setOwner", + values: [BytesLike, AddressLike] + ): string; + encodeFunctionData( + functionFragment: "setRecord", + values: [BytesLike, AddressLike, AddressLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "setResolver", + values: [BytesLike, AddressLike] + ): string; + encodeFunctionData( + functionFragment: "setSubnodeOwner", + values: [BytesLike, BytesLike, AddressLike] + ): string; + encodeFunctionData( + functionFragment: "setSubnodeRecord", + values: [BytesLike, BytesLike, AddressLike, AddressLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "setTTL", + values: [BytesLike, BigNumberish] + ): string; + encodeFunctionData(functionFragment: "ttl", values: [BytesLike]): string; + + decodeFunctionResult( + functionFragment: "isApprovedForAll", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "old", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "recordExists", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "resolver", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "setApprovalForAll", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "setOwner", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setRecord", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "setResolver", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setSubnodeOwner", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setSubnodeRecord", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "setTTL", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "ttl", data: BytesLike): Result; +} + +export namespace ApprovalForAllEvent { + export type InputTuple = [ + owner: AddressLike, + operator: AddressLike, + approved: boolean + ]; + export type OutputTuple = [ + owner: string, + operator: string, + approved: boolean + ]; + export interface OutputObject { + owner: string; + operator: string; + approved: boolean; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace NewOwnerEvent { + export type InputTuple = [ + node: BytesLike, + label: BytesLike, + owner: AddressLike + ]; + export type OutputTuple = [node: string, label: string, owner: string]; + export interface OutputObject { + node: string; + label: string; + owner: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace NewResolverEvent { + export type InputTuple = [node: BytesLike, resolver: AddressLike]; + export type OutputTuple = [node: string, resolver: string]; + export interface OutputObject { + node: string; + resolver: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace NewTTLEvent { + export type InputTuple = [node: BytesLike, ttl: BigNumberish]; + export type OutputTuple = [node: string, ttl: bigint]; + export interface OutputObject { + node: string; + ttl: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace TransferEvent { + export type InputTuple = [node: BytesLike, owner: AddressLike]; + export type OutputTuple = [node: string, owner: string]; + export interface OutputObject { + node: string; + owner: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export interface ENSRegistry extends BaseContract { + connect(runner?: ContractRunner | null): ENSRegistry; + waitForDeployment(): Promise; + + interface: ENSRegistryInterface; + + queryFilter( + event: TCEvent, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + queryFilter( + filter: TypedDeferredTopicFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + + on( + event: TCEvent, + listener: TypedListener + ): Promise; + on( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + once( + event: TCEvent, + listener: TypedListener + ): Promise; + once( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + listeners( + event: TCEvent + ): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners( + event?: TCEvent + ): Promise; + + isApprovedForAll: TypedContractMethod< + [owner: AddressLike, operator: AddressLike], + [boolean], + "view" + >; + + old: TypedContractMethod<[], [string], "view">; + + owner: TypedContractMethod<[node: BytesLike], [string], "view">; + + recordExists: TypedContractMethod<[node: BytesLike], [boolean], "view">; + + resolver: TypedContractMethod<[node: BytesLike], [string], "view">; + + setApprovalForAll: TypedContractMethod< + [operator: AddressLike, approved: boolean], + [void], + "nonpayable" + >; + + setOwner: TypedContractMethod< + [node: BytesLike, owner: AddressLike], + [void], + "nonpayable" + >; + + setRecord: TypedContractMethod< + [ + node: BytesLike, + owner: AddressLike, + resolver: AddressLike, + ttl: BigNumberish + ], + [void], + "nonpayable" + >; + + setResolver: TypedContractMethod< + [node: BytesLike, resolver: AddressLike], + [void], + "nonpayable" + >; + + setSubnodeOwner: TypedContractMethod< + [node: BytesLike, label: BytesLike, owner: AddressLike], + [string], + "nonpayable" + >; + + setSubnodeRecord: TypedContractMethod< + [ + node: BytesLike, + label: BytesLike, + owner: AddressLike, + resolver: AddressLike, + ttl: BigNumberish + ], + [void], + "nonpayable" + >; + + setTTL: TypedContractMethod< + [node: BytesLike, ttl: BigNumberish], + [void], + "nonpayable" + >; + + ttl: TypedContractMethod<[node: BytesLike], [bigint], "view">; + + getFunction( + key: string | FunctionFragment + ): T; + + getFunction( + nameOrSignature: "isApprovedForAll" + ): TypedContractMethod< + [owner: AddressLike, operator: AddressLike], + [boolean], + "view" + >; + getFunction( + nameOrSignature: "old" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "owner" + ): TypedContractMethod<[node: BytesLike], [string], "view">; + getFunction( + nameOrSignature: "recordExists" + ): TypedContractMethod<[node: BytesLike], [boolean], "view">; + getFunction( + nameOrSignature: "resolver" + ): TypedContractMethod<[node: BytesLike], [string], "view">; + getFunction( + nameOrSignature: "setApprovalForAll" + ): TypedContractMethod< + [operator: AddressLike, approved: boolean], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setOwner" + ): TypedContractMethod< + [node: BytesLike, owner: AddressLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setRecord" + ): TypedContractMethod< + [ + node: BytesLike, + owner: AddressLike, + resolver: AddressLike, + ttl: BigNumberish + ], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setResolver" + ): TypedContractMethod< + [node: BytesLike, resolver: AddressLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setSubnodeOwner" + ): TypedContractMethod< + [node: BytesLike, label: BytesLike, owner: AddressLike], + [string], + "nonpayable" + >; + getFunction( + nameOrSignature: "setSubnodeRecord" + ): TypedContractMethod< + [ + node: BytesLike, + label: BytesLike, + owner: AddressLike, + resolver: AddressLike, + ttl: BigNumberish + ], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setTTL" + ): TypedContractMethod< + [node: BytesLike, ttl: BigNumberish], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "ttl" + ): TypedContractMethod<[node: BytesLike], [bigint], "view">; + + getEvent( + key: "ApprovalForAll" + ): TypedContractEvent< + ApprovalForAllEvent.InputTuple, + ApprovalForAllEvent.OutputTuple, + ApprovalForAllEvent.OutputObject + >; + getEvent( + key: "NewOwner" + ): TypedContractEvent< + NewOwnerEvent.InputTuple, + NewOwnerEvent.OutputTuple, + NewOwnerEvent.OutputObject + >; + getEvent( + key: "NewResolver" + ): TypedContractEvent< + NewResolverEvent.InputTuple, + NewResolverEvent.OutputTuple, + NewResolverEvent.OutputObject + >; + getEvent( + key: "NewTTL" + ): TypedContractEvent< + NewTTLEvent.InputTuple, + NewTTLEvent.OutputTuple, + NewTTLEvent.OutputObject + >; + getEvent( + key: "Transfer" + ): TypedContractEvent< + TransferEvent.InputTuple, + TransferEvent.OutputTuple, + TransferEvent.OutputObject + >; + + filters: { + "ApprovalForAll(address,address,bool)": TypedContractEvent< + ApprovalForAllEvent.InputTuple, + ApprovalForAllEvent.OutputTuple, + ApprovalForAllEvent.OutputObject + >; + ApprovalForAll: TypedContractEvent< + ApprovalForAllEvent.InputTuple, + ApprovalForAllEvent.OutputTuple, + ApprovalForAllEvent.OutputObject + >; + + "NewOwner(bytes32,bytes32,address)": TypedContractEvent< + NewOwnerEvent.InputTuple, + NewOwnerEvent.OutputTuple, + NewOwnerEvent.OutputObject + >; + NewOwner: TypedContractEvent< + NewOwnerEvent.InputTuple, + NewOwnerEvent.OutputTuple, + NewOwnerEvent.OutputObject + >; + + "NewResolver(bytes32,address)": TypedContractEvent< + NewResolverEvent.InputTuple, + NewResolverEvent.OutputTuple, + NewResolverEvent.OutputObject + >; + NewResolver: TypedContractEvent< + NewResolverEvent.InputTuple, + NewResolverEvent.OutputTuple, + NewResolverEvent.OutputObject + >; + + "NewTTL(bytes32,uint64)": TypedContractEvent< + NewTTLEvent.InputTuple, + NewTTLEvent.OutputTuple, + NewTTLEvent.OutputObject + >; + NewTTL: TypedContractEvent< + NewTTLEvent.InputTuple, + NewTTLEvent.OutputTuple, + NewTTLEvent.OutputObject + >; + + "Transfer(bytes32,address)": TypedContractEvent< + TransferEvent.InputTuple, + TransferEvent.OutputTuple, + TransferEvent.OutputObject + >; + Transfer: TypedContractEvent< + TransferEvent.InputTuple, + TransferEvent.OutputTuple, + TransferEvent.OutputObject + >; + }; +} diff --git a/src/typechain/ENSResolver.ts b/src/typechain/ENSResolver.ts new file mode 100644 index 0000000..b061514 --- /dev/null +++ b/src/typechain/ENSResolver.ts @@ -0,0 +1,1157 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumberish, + BytesLike, + FunctionFragment, + Result, + Interface, + EventFragment, + AddressLike, + ContractRunner, + ContractMethod, + Listener, +} from "ethers"; +import type { + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedLogDescription, + TypedListener, + TypedContractMethod, +} from "./common"; + +export interface ENSResolverInterface extends Interface { + getFunction( + nameOrSignature: + | "ABI" + | "addr(bytes32)" + | "addr(bytes32,uint256)" + | "approve" + | "clearRecords" + | "contenthash" + | "dnsRecord" + | "hasDNSRecords" + | "interfaceImplementer" + | "isApprovedFor" + | "isApprovedForAll" + | "multicall" + | "multicallWithNodeCheck" + | "name" + | "pubkey" + | "recordVersions" + | "setABI" + | "setAddr(bytes32,uint256,bytes)" + | "setAddr(bytes32,address)" + | "setApprovalForAll" + | "setContenthash" + | "setDNSRecords" + | "setInterface" + | "setName" + | "setPubkey" + | "setText" + | "setZonehash" + | "supportsInterface" + | "text" + | "zonehash" + ): FunctionFragment; + + getEvent( + nameOrSignatureOrTopic: + | "ABIChanged" + | "AddrChanged" + | "AddressChanged" + | "ApprovalForAll" + | "Approved" + | "ContenthashChanged" + | "DNSRecordChanged" + | "DNSRecordDeleted" + | "DNSZonehashChanged" + | "InterfaceChanged" + | "NameChanged" + | "PubkeyChanged" + | "TextChanged" + | "VersionChanged" + ): EventFragment; + + encodeFunctionData( + functionFragment: "ABI", + values: [BytesLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "addr(bytes32)", + values: [BytesLike] + ): string; + encodeFunctionData( + functionFragment: "addr(bytes32,uint256)", + values: [BytesLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "approve", + values: [BytesLike, AddressLike, boolean] + ): string; + encodeFunctionData( + functionFragment: "clearRecords", + values: [BytesLike] + ): string; + encodeFunctionData( + functionFragment: "contenthash", + values: [BytesLike] + ): string; + encodeFunctionData( + functionFragment: "dnsRecord", + values: [BytesLike, BytesLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "hasDNSRecords", + values: [BytesLike, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "interfaceImplementer", + values: [BytesLike, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "isApprovedFor", + values: [AddressLike, BytesLike, AddressLike] + ): string; + encodeFunctionData( + functionFragment: "isApprovedForAll", + values: [AddressLike, AddressLike] + ): string; + encodeFunctionData( + functionFragment: "multicall", + values: [BytesLike[]] + ): string; + encodeFunctionData( + functionFragment: "multicallWithNodeCheck", + values: [BytesLike, BytesLike[]] + ): string; + encodeFunctionData(functionFragment: "name", values: [BytesLike]): string; + encodeFunctionData(functionFragment: "pubkey", values: [BytesLike]): string; + encodeFunctionData( + functionFragment: "recordVersions", + values: [BytesLike] + ): string; + encodeFunctionData( + functionFragment: "setABI", + values: [BytesLike, BigNumberish, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "setAddr(bytes32,uint256,bytes)", + values: [BytesLike, BigNumberish, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "setAddr(bytes32,address)", + values: [BytesLike, AddressLike] + ): string; + encodeFunctionData( + functionFragment: "setApprovalForAll", + values: [AddressLike, boolean] + ): string; + encodeFunctionData( + functionFragment: "setContenthash", + values: [BytesLike, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "setDNSRecords", + values: [BytesLike, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "setInterface", + values: [BytesLike, BytesLike, AddressLike] + ): string; + encodeFunctionData( + functionFragment: "setName", + values: [BytesLike, string] + ): string; + encodeFunctionData( + functionFragment: "setPubkey", + values: [BytesLike, BytesLike, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "setText", + values: [BytesLike, string, string] + ): string; + encodeFunctionData( + functionFragment: "setZonehash", + values: [BytesLike, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "supportsInterface", + values: [BytesLike] + ): string; + encodeFunctionData( + functionFragment: "text", + values: [BytesLike, string] + ): string; + encodeFunctionData(functionFragment: "zonehash", values: [BytesLike]): string; + + decodeFunctionResult(functionFragment: "ABI", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "addr(bytes32)", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "addr(bytes32,uint256)", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "clearRecords", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "contenthash", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "dnsRecord", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "hasDNSRecords", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "interfaceImplementer", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "isApprovedFor", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "isApprovedForAll", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "multicall", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "multicallWithNodeCheck", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "name", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "pubkey", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "recordVersions", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "setABI", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "setAddr(bytes32,uint256,bytes)", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setAddr(bytes32,address)", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setApprovalForAll", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setContenthash", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setDNSRecords", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setInterface", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "setName", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setPubkey", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setText", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "setZonehash", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "supportsInterface", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "text", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "zonehash", data: BytesLike): Result; +} + +export namespace ABIChangedEvent { + export type InputTuple = [node: BytesLike, contentType: BigNumberish]; + export type OutputTuple = [node: string, contentType: bigint]; + export interface OutputObject { + node: string; + contentType: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace AddrChangedEvent { + export type InputTuple = [node: BytesLike, a: AddressLike]; + export type OutputTuple = [node: string, a: string]; + export interface OutputObject { + node: string; + a: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace AddressChangedEvent { + export type InputTuple = [ + node: BytesLike, + coinType: BigNumberish, + newAddress: BytesLike + ]; + export type OutputTuple = [ + node: string, + coinType: bigint, + newAddress: string + ]; + export interface OutputObject { + node: string; + coinType: bigint; + newAddress: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace ApprovalForAllEvent { + export type InputTuple = [ + owner: AddressLike, + operator: AddressLike, + approved: boolean + ]; + export type OutputTuple = [ + owner: string, + operator: string, + approved: boolean + ]; + export interface OutputObject { + owner: string; + operator: string; + approved: boolean; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace ApprovedEvent { + export type InputTuple = [ + owner: AddressLike, + node: BytesLike, + delegate: AddressLike, + approved: boolean + ]; + export type OutputTuple = [ + owner: string, + node: string, + delegate: string, + approved: boolean + ]; + export interface OutputObject { + owner: string; + node: string; + delegate: string; + approved: boolean; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace ContenthashChangedEvent { + export type InputTuple = [node: BytesLike, hash: BytesLike]; + export type OutputTuple = [node: string, hash: string]; + export interface OutputObject { + node: string; + hash: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace DNSRecordChangedEvent { + export type InputTuple = [ + node: BytesLike, + name: BytesLike, + resource: BigNumberish, + record: BytesLike + ]; + export type OutputTuple = [ + node: string, + name: string, + resource: bigint, + record: string + ]; + export interface OutputObject { + node: string; + name: string; + resource: bigint; + record: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace DNSRecordDeletedEvent { + export type InputTuple = [ + node: BytesLike, + name: BytesLike, + resource: BigNumberish + ]; + export type OutputTuple = [node: string, name: string, resource: bigint]; + export interface OutputObject { + node: string; + name: string; + resource: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace DNSZonehashChangedEvent { + export type InputTuple = [ + node: BytesLike, + lastzonehash: BytesLike, + zonehash: BytesLike + ]; + export type OutputTuple = [ + node: string, + lastzonehash: string, + zonehash: string + ]; + export interface OutputObject { + node: string; + lastzonehash: string; + zonehash: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace InterfaceChangedEvent { + export type InputTuple = [ + node: BytesLike, + interfaceID: BytesLike, + implementer: AddressLike + ]; + export type OutputTuple = [ + node: string, + interfaceID: string, + implementer: string + ]; + export interface OutputObject { + node: string; + interfaceID: string; + implementer: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace NameChangedEvent { + export type InputTuple = [node: BytesLike, name: string]; + export type OutputTuple = [node: string, name: string]; + export interface OutputObject { + node: string; + name: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace PubkeyChangedEvent { + export type InputTuple = [node: BytesLike, x: BytesLike, y: BytesLike]; + export type OutputTuple = [node: string, x: string, y: string]; + export interface OutputObject { + node: string; + x: string; + y: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace TextChangedEvent { + export type InputTuple = [ + node: BytesLike, + indexedKey: string, + key: string, + value: string + ]; + export type OutputTuple = [ + node: string, + indexedKey: string, + key: string, + value: string + ]; + export interface OutputObject { + node: string; + indexedKey: string; + key: string; + value: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace VersionChangedEvent { + export type InputTuple = [node: BytesLike, newVersion: BigNumberish]; + export type OutputTuple = [node: string, newVersion: bigint]; + export interface OutputObject { + node: string; + newVersion: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export interface ENSResolver extends BaseContract { + connect(runner?: ContractRunner | null): ENSResolver; + waitForDeployment(): Promise; + + interface: ENSResolverInterface; + + queryFilter( + event: TCEvent, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + queryFilter( + filter: TypedDeferredTopicFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + + on( + event: TCEvent, + listener: TypedListener + ): Promise; + on( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + once( + event: TCEvent, + listener: TypedListener + ): Promise; + once( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + listeners( + event: TCEvent + ): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners( + event?: TCEvent + ): Promise; + + ABI: TypedContractMethod< + [node: BytesLike, contentTypes: BigNumberish], + [[bigint, string]], + "view" + >; + + "addr(bytes32)": TypedContractMethod<[node: BytesLike], [string], "view">; + + "addr(bytes32,uint256)": TypedContractMethod< + [node: BytesLike, coinType: BigNumberish], + [string], + "view" + >; + + approve: TypedContractMethod< + [node: BytesLike, delegate: AddressLike, approved: boolean], + [void], + "nonpayable" + >; + + clearRecords: TypedContractMethod<[node: BytesLike], [void], "nonpayable">; + + contenthash: TypedContractMethod<[node: BytesLike], [string], "view">; + + dnsRecord: TypedContractMethod< + [node: BytesLike, name: BytesLike, resource: BigNumberish], + [string], + "view" + >; + + hasDNSRecords: TypedContractMethod< + [node: BytesLike, name: BytesLike], + [boolean], + "view" + >; + + interfaceImplementer: TypedContractMethod< + [node: BytesLike, interfaceID: BytesLike], + [string], + "view" + >; + + isApprovedFor: TypedContractMethod< + [owner: AddressLike, node: BytesLike, delegate: AddressLike], + [boolean], + "view" + >; + + isApprovedForAll: TypedContractMethod< + [account: AddressLike, operator: AddressLike], + [boolean], + "view" + >; + + multicall: TypedContractMethod<[data: BytesLike[]], [string[]], "nonpayable">; + + multicallWithNodeCheck: TypedContractMethod< + [nodehash: BytesLike, data: BytesLike[]], + [string[]], + "nonpayable" + >; + + name: TypedContractMethod<[node: BytesLike], [string], "view">; + + pubkey: TypedContractMethod< + [node: BytesLike], + [[string, string] & { x: string; y: string }], + "view" + >; + + recordVersions: TypedContractMethod<[arg0: BytesLike], [bigint], "view">; + + setABI: TypedContractMethod< + [node: BytesLike, contentType: BigNumberish, data: BytesLike], + [void], + "nonpayable" + >; + + "setAddr(bytes32,uint256,bytes)": TypedContractMethod< + [node: BytesLike, coinType: BigNumberish, a: BytesLike], + [void], + "nonpayable" + >; + + "setAddr(bytes32,address)": TypedContractMethod< + [node: BytesLike, a: AddressLike], + [void], + "nonpayable" + >; + + setApprovalForAll: TypedContractMethod< + [operator: AddressLike, approved: boolean], + [void], + "nonpayable" + >; + + setContenthash: TypedContractMethod< + [node: BytesLike, hash: BytesLike], + [void], + "nonpayable" + >; + + setDNSRecords: TypedContractMethod< + [node: BytesLike, data: BytesLike], + [void], + "nonpayable" + >; + + setInterface: TypedContractMethod< + [node: BytesLike, interfaceID: BytesLike, implementer: AddressLike], + [void], + "nonpayable" + >; + + setName: TypedContractMethod< + [node: BytesLike, newName: string], + [void], + "nonpayable" + >; + + setPubkey: TypedContractMethod< + [node: BytesLike, x: BytesLike, y: BytesLike], + [void], + "nonpayable" + >; + + setText: TypedContractMethod< + [node: BytesLike, key: string, value: string], + [void], + "nonpayable" + >; + + setZonehash: TypedContractMethod< + [node: BytesLike, hash: BytesLike], + [void], + "nonpayable" + >; + + supportsInterface: TypedContractMethod< + [interfaceID: BytesLike], + [boolean], + "view" + >; + + text: TypedContractMethod<[node: BytesLike, key: string], [string], "view">; + + zonehash: TypedContractMethod<[node: BytesLike], [string], "view">; + + getFunction( + key: string | FunctionFragment + ): T; + + getFunction( + nameOrSignature: "ABI" + ): TypedContractMethod< + [node: BytesLike, contentTypes: BigNumberish], + [[bigint, string]], + "view" + >; + getFunction( + nameOrSignature: "addr(bytes32)" + ): TypedContractMethod<[node: BytesLike], [string], "view">; + getFunction( + nameOrSignature: "addr(bytes32,uint256)" + ): TypedContractMethod< + [node: BytesLike, coinType: BigNumberish], + [string], + "view" + >; + getFunction( + nameOrSignature: "approve" + ): TypedContractMethod< + [node: BytesLike, delegate: AddressLike, approved: boolean], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "clearRecords" + ): TypedContractMethod<[node: BytesLike], [void], "nonpayable">; + getFunction( + nameOrSignature: "contenthash" + ): TypedContractMethod<[node: BytesLike], [string], "view">; + getFunction( + nameOrSignature: "dnsRecord" + ): TypedContractMethod< + [node: BytesLike, name: BytesLike, resource: BigNumberish], + [string], + "view" + >; + getFunction( + nameOrSignature: "hasDNSRecords" + ): TypedContractMethod<[node: BytesLike, name: BytesLike], [boolean], "view">; + getFunction( + nameOrSignature: "interfaceImplementer" + ): TypedContractMethod< + [node: BytesLike, interfaceID: BytesLike], + [string], + "view" + >; + getFunction( + nameOrSignature: "isApprovedFor" + ): TypedContractMethod< + [owner: AddressLike, node: BytesLike, delegate: AddressLike], + [boolean], + "view" + >; + getFunction( + nameOrSignature: "isApprovedForAll" + ): TypedContractMethod< + [account: AddressLike, operator: AddressLike], + [boolean], + "view" + >; + getFunction( + nameOrSignature: "multicall" + ): TypedContractMethod<[data: BytesLike[]], [string[]], "nonpayable">; + getFunction( + nameOrSignature: "multicallWithNodeCheck" + ): TypedContractMethod< + [nodehash: BytesLike, data: BytesLike[]], + [string[]], + "nonpayable" + >; + getFunction( + nameOrSignature: "name" + ): TypedContractMethod<[node: BytesLike], [string], "view">; + getFunction( + nameOrSignature: "pubkey" + ): TypedContractMethod< + [node: BytesLike], + [[string, string] & { x: string; y: string }], + "view" + >; + getFunction( + nameOrSignature: "recordVersions" + ): TypedContractMethod<[arg0: BytesLike], [bigint], "view">; + getFunction( + nameOrSignature: "setABI" + ): TypedContractMethod< + [node: BytesLike, contentType: BigNumberish, data: BytesLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setAddr(bytes32,uint256,bytes)" + ): TypedContractMethod< + [node: BytesLike, coinType: BigNumberish, a: BytesLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setAddr(bytes32,address)" + ): TypedContractMethod< + [node: BytesLike, a: AddressLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setApprovalForAll" + ): TypedContractMethod< + [operator: AddressLike, approved: boolean], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setContenthash" + ): TypedContractMethod< + [node: BytesLike, hash: BytesLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setDNSRecords" + ): TypedContractMethod< + [node: BytesLike, data: BytesLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setInterface" + ): TypedContractMethod< + [node: BytesLike, interfaceID: BytesLike, implementer: AddressLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setName" + ): TypedContractMethod< + [node: BytesLike, newName: string], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setPubkey" + ): TypedContractMethod< + [node: BytesLike, x: BytesLike, y: BytesLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setText" + ): TypedContractMethod< + [node: BytesLike, key: string, value: string], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setZonehash" + ): TypedContractMethod< + [node: BytesLike, hash: BytesLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "supportsInterface" + ): TypedContractMethod<[interfaceID: BytesLike], [boolean], "view">; + getFunction( + nameOrSignature: "text" + ): TypedContractMethod<[node: BytesLike, key: string], [string], "view">; + getFunction( + nameOrSignature: "zonehash" + ): TypedContractMethod<[node: BytesLike], [string], "view">; + + getEvent( + key: "ABIChanged" + ): TypedContractEvent< + ABIChangedEvent.InputTuple, + ABIChangedEvent.OutputTuple, + ABIChangedEvent.OutputObject + >; + getEvent( + key: "AddrChanged" + ): TypedContractEvent< + AddrChangedEvent.InputTuple, + AddrChangedEvent.OutputTuple, + AddrChangedEvent.OutputObject + >; + getEvent( + key: "AddressChanged" + ): TypedContractEvent< + AddressChangedEvent.InputTuple, + AddressChangedEvent.OutputTuple, + AddressChangedEvent.OutputObject + >; + getEvent( + key: "ApprovalForAll" + ): TypedContractEvent< + ApprovalForAllEvent.InputTuple, + ApprovalForAllEvent.OutputTuple, + ApprovalForAllEvent.OutputObject + >; + getEvent( + key: "Approved" + ): TypedContractEvent< + ApprovedEvent.InputTuple, + ApprovedEvent.OutputTuple, + ApprovedEvent.OutputObject + >; + getEvent( + key: "ContenthashChanged" + ): TypedContractEvent< + ContenthashChangedEvent.InputTuple, + ContenthashChangedEvent.OutputTuple, + ContenthashChangedEvent.OutputObject + >; + getEvent( + key: "DNSRecordChanged" + ): TypedContractEvent< + DNSRecordChangedEvent.InputTuple, + DNSRecordChangedEvent.OutputTuple, + DNSRecordChangedEvent.OutputObject + >; + getEvent( + key: "DNSRecordDeleted" + ): TypedContractEvent< + DNSRecordDeletedEvent.InputTuple, + DNSRecordDeletedEvent.OutputTuple, + DNSRecordDeletedEvent.OutputObject + >; + getEvent( + key: "DNSZonehashChanged" + ): TypedContractEvent< + DNSZonehashChangedEvent.InputTuple, + DNSZonehashChangedEvent.OutputTuple, + DNSZonehashChangedEvent.OutputObject + >; + getEvent( + key: "InterfaceChanged" + ): TypedContractEvent< + InterfaceChangedEvent.InputTuple, + InterfaceChangedEvent.OutputTuple, + InterfaceChangedEvent.OutputObject + >; + getEvent( + key: "NameChanged" + ): TypedContractEvent< + NameChangedEvent.InputTuple, + NameChangedEvent.OutputTuple, + NameChangedEvent.OutputObject + >; + getEvent( + key: "PubkeyChanged" + ): TypedContractEvent< + PubkeyChangedEvent.InputTuple, + PubkeyChangedEvent.OutputTuple, + PubkeyChangedEvent.OutputObject + >; + getEvent( + key: "TextChanged" + ): TypedContractEvent< + TextChangedEvent.InputTuple, + TextChangedEvent.OutputTuple, + TextChangedEvent.OutputObject + >; + getEvent( + key: "VersionChanged" + ): TypedContractEvent< + VersionChangedEvent.InputTuple, + VersionChangedEvent.OutputTuple, + VersionChangedEvent.OutputObject + >; + + filters: { + "ABIChanged(bytes32,uint256)": TypedContractEvent< + ABIChangedEvent.InputTuple, + ABIChangedEvent.OutputTuple, + ABIChangedEvent.OutputObject + >; + ABIChanged: TypedContractEvent< + ABIChangedEvent.InputTuple, + ABIChangedEvent.OutputTuple, + ABIChangedEvent.OutputObject + >; + + "AddrChanged(bytes32,address)": TypedContractEvent< + AddrChangedEvent.InputTuple, + AddrChangedEvent.OutputTuple, + AddrChangedEvent.OutputObject + >; + AddrChanged: TypedContractEvent< + AddrChangedEvent.InputTuple, + AddrChangedEvent.OutputTuple, + AddrChangedEvent.OutputObject + >; + + "AddressChanged(bytes32,uint256,bytes)": TypedContractEvent< + AddressChangedEvent.InputTuple, + AddressChangedEvent.OutputTuple, + AddressChangedEvent.OutputObject + >; + AddressChanged: TypedContractEvent< + AddressChangedEvent.InputTuple, + AddressChangedEvent.OutputTuple, + AddressChangedEvent.OutputObject + >; + + "ApprovalForAll(address,address,bool)": TypedContractEvent< + ApprovalForAllEvent.InputTuple, + ApprovalForAllEvent.OutputTuple, + ApprovalForAllEvent.OutputObject + >; + ApprovalForAll: TypedContractEvent< + ApprovalForAllEvent.InputTuple, + ApprovalForAllEvent.OutputTuple, + ApprovalForAllEvent.OutputObject + >; + + "Approved(address,bytes32,address,bool)": TypedContractEvent< + ApprovedEvent.InputTuple, + ApprovedEvent.OutputTuple, + ApprovedEvent.OutputObject + >; + Approved: TypedContractEvent< + ApprovedEvent.InputTuple, + ApprovedEvent.OutputTuple, + ApprovedEvent.OutputObject + >; + + "ContenthashChanged(bytes32,bytes)": TypedContractEvent< + ContenthashChangedEvent.InputTuple, + ContenthashChangedEvent.OutputTuple, + ContenthashChangedEvent.OutputObject + >; + ContenthashChanged: TypedContractEvent< + ContenthashChangedEvent.InputTuple, + ContenthashChangedEvent.OutputTuple, + ContenthashChangedEvent.OutputObject + >; + + "DNSRecordChanged(bytes32,bytes,uint16,bytes)": TypedContractEvent< + DNSRecordChangedEvent.InputTuple, + DNSRecordChangedEvent.OutputTuple, + DNSRecordChangedEvent.OutputObject + >; + DNSRecordChanged: TypedContractEvent< + DNSRecordChangedEvent.InputTuple, + DNSRecordChangedEvent.OutputTuple, + DNSRecordChangedEvent.OutputObject + >; + + "DNSRecordDeleted(bytes32,bytes,uint16)": TypedContractEvent< + DNSRecordDeletedEvent.InputTuple, + DNSRecordDeletedEvent.OutputTuple, + DNSRecordDeletedEvent.OutputObject + >; + DNSRecordDeleted: TypedContractEvent< + DNSRecordDeletedEvent.InputTuple, + DNSRecordDeletedEvent.OutputTuple, + DNSRecordDeletedEvent.OutputObject + >; + + "DNSZonehashChanged(bytes32,bytes,bytes)": TypedContractEvent< + DNSZonehashChangedEvent.InputTuple, + DNSZonehashChangedEvent.OutputTuple, + DNSZonehashChangedEvent.OutputObject + >; + DNSZonehashChanged: TypedContractEvent< + DNSZonehashChangedEvent.InputTuple, + DNSZonehashChangedEvent.OutputTuple, + DNSZonehashChangedEvent.OutputObject + >; + + "InterfaceChanged(bytes32,bytes4,address)": TypedContractEvent< + InterfaceChangedEvent.InputTuple, + InterfaceChangedEvent.OutputTuple, + InterfaceChangedEvent.OutputObject + >; + InterfaceChanged: TypedContractEvent< + InterfaceChangedEvent.InputTuple, + InterfaceChangedEvent.OutputTuple, + InterfaceChangedEvent.OutputObject + >; + + "NameChanged(bytes32,string)": TypedContractEvent< + NameChangedEvent.InputTuple, + NameChangedEvent.OutputTuple, + NameChangedEvent.OutputObject + >; + NameChanged: TypedContractEvent< + NameChangedEvent.InputTuple, + NameChangedEvent.OutputTuple, + NameChangedEvent.OutputObject + >; + + "PubkeyChanged(bytes32,bytes32,bytes32)": TypedContractEvent< + PubkeyChangedEvent.InputTuple, + PubkeyChangedEvent.OutputTuple, + PubkeyChangedEvent.OutputObject + >; + PubkeyChanged: TypedContractEvent< + PubkeyChangedEvent.InputTuple, + PubkeyChangedEvent.OutputTuple, + PubkeyChangedEvent.OutputObject + >; + + "TextChanged(bytes32,string,string,string)": TypedContractEvent< + TextChangedEvent.InputTuple, + TextChangedEvent.OutputTuple, + TextChangedEvent.OutputObject + >; + TextChanged: TypedContractEvent< + TextChangedEvent.InputTuple, + TextChangedEvent.OutputTuple, + TextChangedEvent.OutputObject + >; + + "VersionChanged(bytes32,uint64)": TypedContractEvent< + VersionChangedEvent.InputTuple, + VersionChangedEvent.OutputTuple, + VersionChangedEvent.OutputObject + >; + VersionChanged: TypedContractEvent< + VersionChangedEvent.InputTuple, + VersionChangedEvent.OutputTuple, + VersionChangedEvent.OutputObject + >; + }; +} diff --git a/src/typechain/factories/ENSNameWrapper__factory.ts b/src/typechain/factories/ENSNameWrapper__factory.ts new file mode 100644 index 0000000..c74be5c --- /dev/null +++ b/src/typechain/factories/ENSNameWrapper__factory.ts @@ -0,0 +1,1478 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Interface, type ContractRunner } from "ethers"; +import type { + ENSNameWrapper, + ENSNameWrapperInterface, +} from "../ENSNameWrapper"; + +const _abi = [ + { + inputs: [ + { + internalType: "contract ENS", + name: "_ens", + type: "address", + }, + { + internalType: "contract IBaseRegistrar", + name: "_registrar", + type: "address", + }, + { + internalType: "contract IMetadataService", + name: "_metadataService", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [], + name: "CannotUpgrade", + type: "error", + }, + { + inputs: [], + name: "IncompatibleParent", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + ], + name: "IncorrectTargetOwner", + type: "error", + }, + { + inputs: [], + name: "IncorrectTokenType", + type: "error", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "labelHash", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "expectedLabelhash", + type: "bytes32", + }, + ], + name: "LabelMismatch", + type: "error", + }, + { + inputs: [ + { + internalType: "string", + name: "label", + type: "string", + }, + ], + name: "LabelTooLong", + type: "error", + }, + { + inputs: [], + name: "LabelTooShort", + type: "error", + }, + { + inputs: [], + name: "NameIsNotWrapped", + type: "error", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + ], + name: "OperationProhibited", + type: "error", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "address", + name: "addr", + type: "address", + }, + ], + name: "Unauthorised", + type: "error", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "approved", + type: "address", + }, + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "Approval", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address", + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool", + }, + ], + name: "ApprovalForAll", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "controller", + type: "address", + }, + { + indexed: false, + internalType: "bool", + name: "active", + type: "bool", + }, + ], + name: "ControllerChanged", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + indexed: false, + internalType: "uint64", + name: "expiry", + type: "uint64", + }, + ], + name: "ExpiryExtended", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + indexed: false, + internalType: "uint32", + name: "fuses", + type: "uint32", + }, + ], + name: "FusesSet", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address", + }, + ], + name: "NameUnwrapped", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + indexed: false, + internalType: "bytes", + name: "name", + type: "bytes", + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address", + }, + { + indexed: false, + internalType: "uint32", + name: "fuses", + type: "uint32", + }, + { + indexed: false, + internalType: "uint64", + name: "expiry", + type: "uint64", + }, + ], + name: "NameWrapped", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "OwnershipTransferred", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "operator", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + { + indexed: false, + internalType: "uint256[]", + name: "ids", + type: "uint256[]", + }, + { + indexed: false, + internalType: "uint256[]", + name: "values", + type: "uint256[]", + }, + ], + name: "TransferBatch", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "operator", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "id", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "TransferSingle", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "string", + name: "value", + type: "string", + }, + { + indexed: true, + internalType: "uint256", + name: "id", + type: "uint256", + }, + ], + name: "URI", + type: "event", + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "_tokens", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "uint32", + name: "fuseMask", + type: "uint32", + }, + ], + name: "allFusesBurned", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "approve", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address", + }, + { + internalType: "uint256", + name: "id", + type: "uint256", + }, + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address[]", + name: "accounts", + type: "address[]", + }, + { + internalType: "uint256[]", + name: "ids", + type: "uint256[]", + }, + ], + name: "balanceOfBatch", + outputs: [ + { + internalType: "uint256[]", + name: "", + type: "uint256[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "address", + name: "addr", + type: "address", + }, + ], + name: "canExtendSubnames", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "address", + name: "addr", + type: "address", + }, + ], + name: "canModifyName", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "controllers", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "ens", + outputs: [ + { + internalType: "contract ENS", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32", + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64", + }, + ], + name: "extendExpiry", + outputs: [ + { + internalType: "uint64", + name: "", + type: "uint64", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "id", + type: "uint256", + }, + ], + name: "getApproved", + outputs: [ + { + internalType: "address", + name: "operator", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "id", + type: "uint256", + }, + ], + name: "getData", + outputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + { + internalType: "uint32", + name: "fuses", + type: "uint32", + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address", + }, + { + internalType: "address", + name: "operator", + type: "address", + }, + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32", + }, + ], + name: "isWrapped", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + ], + name: "isWrapped", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "metadataService", + outputs: [ + { + internalType: "contract IMetadataService", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + name: "names", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "address", + name: "", + type: "address", + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + { + internalType: "bytes", + name: "data", + type: "bytes", + }, + ], + name: "onERC721Received", + outputs: [ + { + internalType: "bytes4", + name: "", + type: "bytes4", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "id", + type: "uint256", + }, + ], + name: "ownerOf", + outputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_token", + type: "address", + }, + { + internalType: "address", + name: "_to", + type: "address", + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256", + }, + ], + name: "recoverFunds", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "label", + type: "string", + }, + { + internalType: "address", + name: "wrappedOwner", + type: "address", + }, + { + internalType: "uint256", + name: "duration", + type: "uint256", + }, + { + internalType: "address", + name: "resolver", + type: "address", + }, + { + internalType: "uint16", + name: "ownerControlledFuses", + type: "uint16", + }, + ], + name: "registerAndWrapETH2LD", + outputs: [ + { + internalType: "uint256", + name: "registrarExpiry", + type: "uint256", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "registrar", + outputs: [ + { + internalType: "contract IBaseRegistrar", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + { + internalType: "uint256", + name: "duration", + type: "uint256", + }, + ], + name: "renew", + outputs: [ + { + internalType: "uint256", + name: "expires", + type: "uint256", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256[]", + name: "ids", + type: "uint256[]", + }, + { + internalType: "uint256[]", + name: "amounts", + type: "uint256[]", + }, + { + internalType: "bytes", + name: "data", + type: "bytes", + }, + ], + name: "safeBatchTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "id", + type: "uint256", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + { + internalType: "bytes", + name: "data", + type: "bytes", + }, + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address", + }, + { + internalType: "bool", + name: "approved", + type: "bool", + }, + ], + name: "setApprovalForAll", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32", + }, + { + internalType: "uint32", + name: "fuses", + type: "uint32", + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64", + }, + ], + name: "setChildFuses", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "controller", + type: "address", + }, + { + internalType: "bool", + name: "active", + type: "bool", + }, + ], + name: "setController", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "uint16", + name: "ownerControlledFuses", + type: "uint16", + }, + ], + name: "setFuses", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "contract IMetadataService", + name: "_metadataService", + type: "address", + }, + ], + name: "setMetadataService", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "address", + name: "owner", + type: "address", + }, + { + internalType: "address", + name: "resolver", + type: "address", + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64", + }, + ], + name: "setRecord", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "address", + name: "resolver", + type: "address", + }, + ], + name: "setResolver", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32", + }, + { + internalType: "string", + name: "label", + type: "string", + }, + { + internalType: "address", + name: "owner", + type: "address", + }, + { + internalType: "uint32", + name: "fuses", + type: "uint32", + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64", + }, + ], + name: "setSubnodeOwner", + outputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32", + }, + { + internalType: "string", + name: "label", + type: "string", + }, + { + internalType: "address", + name: "owner", + type: "address", + }, + { + internalType: "address", + name: "resolver", + type: "address", + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64", + }, + { + internalType: "uint32", + name: "fuses", + type: "uint32", + }, + { + internalType: "uint64", + name: "expiry", + type: "uint64", + }, + ], + name: "setSubnodeRecord", + outputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64", + }, + ], + name: "setTTL", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "contract INameWrapperUpgrade", + name: "_upgradeAddress", + type: "address", + }, + ], + name: "setUpgradeContract", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4", + }, + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "parentNode", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32", + }, + { + internalType: "address", + name: "controller", + type: "address", + }, + ], + name: "unwrap", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "labelhash", + type: "bytes32", + }, + { + internalType: "address", + name: "registrant", + type: "address", + }, + { + internalType: "address", + name: "controller", + type: "address", + }, + ], + name: "unwrapETH2LD", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes", + name: "name", + type: "bytes", + }, + { + internalType: "bytes", + name: "extraData", + type: "bytes", + }, + ], + name: "upgrade", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "upgradeContract", + outputs: [ + { + internalType: "contract INameWrapperUpgrade", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "uri", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes", + name: "name", + type: "bytes", + }, + { + internalType: "address", + name: "wrappedOwner", + type: "address", + }, + { + internalType: "address", + name: "resolver", + type: "address", + }, + ], + name: "wrap", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "label", + type: "string", + }, + { + internalType: "address", + name: "wrappedOwner", + type: "address", + }, + { + internalType: "uint16", + name: "ownerControlledFuses", + type: "uint16", + }, + { + internalType: "address", + name: "resolver", + type: "address", + }, + ], + name: "wrapETH2LD", + outputs: [ + { + internalType: "uint64", + name: "expiry", + type: "uint64", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, +] as const; + +export class ENSNameWrapper__factory { + static readonly abi = _abi; + static createInterface(): ENSNameWrapperInterface { + return new Interface(_abi) as ENSNameWrapperInterface; + } + static connect( + address: string, + runner?: ContractRunner | null + ): ENSNameWrapper { + return new Contract(address, _abi, runner) as unknown as ENSNameWrapper; + } +} diff --git a/src/typechain/factories/ENSRegistry__factory.ts b/src/typechain/factories/ENSRegistry__factory.ts new file mode 100644 index 0000000..bcc6212 --- /dev/null +++ b/src/typechain/factories/ENSRegistry__factory.ts @@ -0,0 +1,439 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Interface, type ContractRunner } from "ethers"; +import type { ENSRegistry, ENSRegistryInterface } from "../ENSRegistry"; + +const _abi = [ + { + inputs: [ + { + internalType: "contract ENS", + name: "_old", + type: "address", + }, + ], + payable: false, + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address", + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool", + }, + ], + name: "ApprovalForAll", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + indexed: true, + internalType: "bytes32", + name: "label", + type: "bytes32", + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address", + }, + ], + name: "NewOwner", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + indexed: false, + internalType: "address", + name: "resolver", + type: "address", + }, + ], + name: "NewResolver", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + indexed: false, + internalType: "uint64", + name: "ttl", + type: "uint64", + }, + ], + name: "NewTTL", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + indexed: false, + internalType: "address", + name: "owner", + type: "address", + }, + ], + name: "Transfer", + type: "event", + }, + { + constant: true, + inputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + { + internalType: "address", + name: "operator", + type: "address", + }, + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "old", + outputs: [ + { + internalType: "contract ENS", + name: "", + type: "address", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + ], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + ], + name: "recordExists", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + ], + name: "resolver", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { + internalType: "address", + name: "operator", + type: "address", + }, + { + internalType: "bool", + name: "approved", + type: "bool", + }, + ], + name: "setApprovalForAll", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "address", + name: "owner", + type: "address", + }, + ], + name: "setOwner", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "address", + name: "owner", + type: "address", + }, + { + internalType: "address", + name: "resolver", + type: "address", + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64", + }, + ], + name: "setRecord", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "address", + name: "resolver", + type: "address", + }, + ], + name: "setResolver", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "label", + type: "bytes32", + }, + { + internalType: "address", + name: "owner", + type: "address", + }, + ], + name: "setSubnodeOwner", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "label", + type: "bytes32", + }, + { + internalType: "address", + name: "owner", + type: "address", + }, + { + internalType: "address", + name: "resolver", + type: "address", + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64", + }, + ], + name: "setSubnodeRecord", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "uint64", + name: "ttl", + type: "uint64", + }, + ], + name: "setTTL", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + ], + name: "ttl", + outputs: [ + { + internalType: "uint64", + name: "", + type: "uint64", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, +] as const; + +export class ENSRegistry__factory { + static readonly abi = _abi; + static createInterface(): ENSRegistryInterface { + return new Interface(_abi) as ENSRegistryInterface; + } + static connect(address: string, runner?: ContractRunner | null): ENSRegistry { + return new Contract(address, _abi, runner) as unknown as ENSRegistry; + } +} diff --git a/src/typechain/factories/ENSResolver__factory.ts b/src/typechain/factories/ENSResolver__factory.ts new file mode 100644 index 0000000..c1e3e7e --- /dev/null +++ b/src/typechain/factories/ENSResolver__factory.ts @@ -0,0 +1,1030 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Interface, type ContractRunner } from "ethers"; +import type { ENSResolver, ENSResolverInterface } from "../ENSResolver"; + +const _abi = [ + { + inputs: [ + { + internalType: "contract ENS", + name: "_ens", + type: "address", + }, + { + internalType: "contract INameWrapper", + name: "wrapperAddress", + type: "address", + }, + { + internalType: "address", + name: "_trustedETHController", + type: "address", + }, + { + internalType: "address", + name: "_trustedReverseRegistrar", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + indexed: true, + internalType: "uint256", + name: "contentType", + type: "uint256", + }, + ], + name: "ABIChanged", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + indexed: false, + internalType: "address", + name: "a", + type: "address", + }, + ], + name: "AddrChanged", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + indexed: false, + internalType: "uint256", + name: "coinType", + type: "uint256", + }, + { + indexed: false, + internalType: "bytes", + name: "newAddress", + type: "bytes", + }, + ], + name: "AddressChanged", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address", + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool", + }, + ], + name: "ApprovalForAll", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "owner", + type: "address", + }, + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + indexed: true, + internalType: "address", + name: "delegate", + type: "address", + }, + { + indexed: true, + internalType: "bool", + name: "approved", + type: "bool", + }, + ], + name: "Approved", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + indexed: false, + internalType: "bytes", + name: "hash", + type: "bytes", + }, + ], + name: "ContenthashChanged", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + indexed: false, + internalType: "bytes", + name: "name", + type: "bytes", + }, + { + indexed: false, + internalType: "uint16", + name: "resource", + type: "uint16", + }, + { + indexed: false, + internalType: "bytes", + name: "record", + type: "bytes", + }, + ], + name: "DNSRecordChanged", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + indexed: false, + internalType: "bytes", + name: "name", + type: "bytes", + }, + { + indexed: false, + internalType: "uint16", + name: "resource", + type: "uint16", + }, + ], + name: "DNSRecordDeleted", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + indexed: false, + internalType: "bytes", + name: "lastzonehash", + type: "bytes", + }, + { + indexed: false, + internalType: "bytes", + name: "zonehash", + type: "bytes", + }, + ], + name: "DNSZonehashChanged", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + indexed: true, + internalType: "bytes4", + name: "interfaceID", + type: "bytes4", + }, + { + indexed: false, + internalType: "address", + name: "implementer", + type: "address", + }, + ], + name: "InterfaceChanged", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + indexed: false, + internalType: "string", + name: "name", + type: "string", + }, + ], + name: "NameChanged", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + indexed: false, + internalType: "bytes32", + name: "x", + type: "bytes32", + }, + { + indexed: false, + internalType: "bytes32", + name: "y", + type: "bytes32", + }, + ], + name: "PubkeyChanged", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + indexed: true, + internalType: "string", + name: "indexedKey", + type: "string", + }, + { + indexed: false, + internalType: "string", + name: "key", + type: "string", + }, + { + indexed: false, + internalType: "string", + name: "value", + type: "string", + }, + ], + name: "TextChanged", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + indexed: false, + internalType: "uint64", + name: "newVersion", + type: "uint64", + }, + ], + name: "VersionChanged", + type: "event", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "uint256", + name: "contentTypes", + type: "uint256", + }, + ], + name: "ABI", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + { + internalType: "bytes", + name: "", + type: "bytes", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + ], + name: "addr", + outputs: [ + { + internalType: "address payable", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "uint256", + name: "coinType", + type: "uint256", + }, + ], + name: "addr", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "address", + name: "delegate", + type: "address", + }, + { + internalType: "bool", + name: "approved", + type: "bool", + }, + ], + name: "approve", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + ], + name: "clearRecords", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + ], + name: "contenthash", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "name", + type: "bytes32", + }, + { + internalType: "uint16", + name: "resource", + type: "uint16", + }, + ], + name: "dnsRecord", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "name", + type: "bytes32", + }, + ], + name: "hasDNSRecords", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "bytes4", + name: "interfaceID", + type: "bytes4", + }, + ], + name: "interfaceImplementer", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "address", + name: "delegate", + type: "address", + }, + ], + name: "isApprovedFor", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address", + }, + { + internalType: "address", + name: "operator", + type: "address", + }, + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes[]", + name: "data", + type: "bytes[]", + }, + ], + name: "multicall", + outputs: [ + { + internalType: "bytes[]", + name: "results", + type: "bytes[]", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "nodehash", + type: "bytes32", + }, + { + internalType: "bytes[]", + name: "data", + type: "bytes[]", + }, + ], + name: "multicallWithNodeCheck", + outputs: [ + { + internalType: "bytes[]", + name: "results", + type: "bytes[]", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + ], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + ], + name: "pubkey", + outputs: [ + { + internalType: "bytes32", + name: "x", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "y", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + name: "recordVersions", + outputs: [ + { + internalType: "uint64", + name: "", + type: "uint64", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "uint256", + name: "contentType", + type: "uint256", + }, + { + internalType: "bytes", + name: "data", + type: "bytes", + }, + ], + name: "setABI", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "uint256", + name: "coinType", + type: "uint256", + }, + { + internalType: "bytes", + name: "a", + type: "bytes", + }, + ], + name: "setAddr", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "address", + name: "a", + type: "address", + }, + ], + name: "setAddr", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address", + }, + { + internalType: "bool", + name: "approved", + type: "bool", + }, + ], + name: "setApprovalForAll", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "bytes", + name: "hash", + type: "bytes", + }, + ], + name: "setContenthash", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "bytes", + name: "data", + type: "bytes", + }, + ], + name: "setDNSRecords", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "bytes4", + name: "interfaceID", + type: "bytes4", + }, + { + internalType: "address", + name: "implementer", + type: "address", + }, + ], + name: "setInterface", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "string", + name: "newName", + type: "string", + }, + ], + name: "setName", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "x", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "y", + type: "bytes32", + }, + ], + name: "setPubkey", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "string", + name: "key", + type: "string", + }, + { + internalType: "string", + name: "value", + type: "string", + }, + ], + name: "setText", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "bytes", + name: "hash", + type: "bytes", + }, + ], + name: "setZonehash", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceID", + type: "bytes4", + }, + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + { + internalType: "string", + name: "key", + type: "string", + }, + ], + name: "text", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "node", + type: "bytes32", + }, + ], + name: "zonehash", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes", + }, + ], + stateMutability: "view", + type: "function", + }, +] as const; + +export class ENSResolver__factory { + static readonly abi = _abi; + static createInterface(): ENSResolverInterface { + return new Interface(_abi) as ENSResolverInterface; + } + static connect(address: string, runner?: ContractRunner | null): ENSResolver { + return new Contract(address, _abi, runner) as unknown as ENSResolver; + } +} diff --git a/src/typechain/factories/index.ts b/src/typechain/factories/index.ts index b959d05..a75abcd 100644 --- a/src/typechain/factories/index.ts +++ b/src/typechain/factories/index.ts @@ -2,8 +2,10 @@ /* tslint:disable */ /* eslint-disable */ export { ENS__factory } from "./ENS__factory"; +export { ENSNameWrapper__factory } from "./ENSNameWrapper__factory"; +export { ENSRegistry__factory } from "./ENSRegistry__factory"; +export { ENSResolver__factory } from "./ENSResolver__factory"; export { ERC20__factory } from "./ERC20__factory"; -export { GasPriceOracle__factory } from "./GasPriceOracle__factory"; export { Multicall__factory } from "./Multicall__factory"; export { OffchainOracle__factory } from "./OffchainOracle__factory"; export { OvmGasPriceOracle__factory } from "./OvmGasPriceOracle__factory"; diff --git a/src/typechain/index.ts b/src/typechain/index.ts index 7267d3c..8c8a76c 100644 --- a/src/typechain/index.ts +++ b/src/typechain/index.ts @@ -2,16 +2,20 @@ /* tslint:disable */ /* eslint-disable */ export type { ENS } from "./ENS"; +export type { ENSNameWrapper } from "./ENSNameWrapper"; +export type { ENSRegistry } from "./ENSRegistry"; +export type { ENSResolver } from "./ENSResolver"; export type { ERC20 } from "./ERC20"; -export type { GasPriceOracle } from "./GasPriceOracle"; export type { Multicall } from "./Multicall"; export type { OffchainOracle } from "./OffchainOracle"; export type { OvmGasPriceOracle } from "./OvmGasPriceOracle"; export type { ReverseRecords } from "./ReverseRecords"; export * as factories from "./factories"; export { ENS__factory } from "./factories/ENS__factory"; +export { ENSNameWrapper__factory } from "./factories/ENSNameWrapper__factory"; +export { ENSRegistry__factory } from "./factories/ENSRegistry__factory"; +export { ENSResolver__factory } from "./factories/ENSResolver__factory"; export { ERC20__factory } from "./factories/ERC20__factory"; -export { GasPriceOracle__factory } from "./factories/GasPriceOracle__factory"; export { Multicall__factory } from "./factories/Multicall__factory"; export { OffchainOracle__factory } from "./factories/OffchainOracle__factory"; export { OvmGasPriceOracle__factory } from "./factories/OvmGasPriceOracle__factory"; diff --git a/src/utils.ts b/src/utils.ts index 5c550d1..462b02e 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,145 +1,186 @@ import { webcrypto } from 'crypto'; import BN from 'bn.js'; +// @ts-expect-error no-contenthash-types +import * as contentHashUtils from '@ensdomains/content-hash'; import type { BigNumberish } from 'ethers'; // eslint-disable-next-line @typescript-eslint/no-explicit-any (BigInt.prototype as any).toJSON = function () { - return this.toString(); + return this.toString(); }; type bnInput = number | string | number[] | Uint8Array | Buffer | BN; export const isNode = - !( - process as typeof process & { - browser?: boolean; - } - ).browser && typeof globalThis.window === 'undefined'; + !( + process as typeof process & { + browser?: boolean; + } + ).browser && typeof globalThis.window === 'undefined'; export const crypto = isNode ? webcrypto : (globalThis.crypto as typeof webcrypto); export const chunk = (arr: T[], size: number): T[][] => - [...Array(Math.ceil(arr.length / size))].map((_, i) => arr.slice(size * i, size + size * i)); + [...Array(Math.ceil(arr.length / size))].map((_, i) => arr.slice(size * i, size + size * i)); export function sleep(ms: number) { - return new Promise((resolve) => setTimeout(resolve, ms)); + return new Promise((resolve) => setTimeout(resolve, ms)); } export function validateUrl(url: string, protocols?: string[]) { - try { - const parsedUrl = new URL(url); - if (protocols && protocols.length) { - return protocols.map((p) => p.toLowerCase()).includes(parsedUrl.protocol); + try { + const parsedUrl = new URL(url); + if (protocols && protocols.length) { + return protocols.map((p) => p.toLowerCase()).includes(parsedUrl.protocol); + } + return true; + } catch { + return false; } - return true; - } catch { - return false; - } } export function concatBytes(...arrays: Uint8Array[]): Uint8Array { - const totalSize = arrays.reduce((acc, e) => acc + e.length, 0); - const merged = new Uint8Array(totalSize); + const totalSize = arrays.reduce((acc, e) => acc + e.length, 0); + const merged = new Uint8Array(totalSize); - arrays.forEach((array, i, arrays) => { - const offset = arrays.slice(0, i).reduce((acc, e) => acc + e.length, 0); - merged.set(array, offset); - }); + arrays.forEach((array, i, arrays) => { + const offset = arrays.slice(0, i).reduce((acc, e) => acc + e.length, 0); + merged.set(array, offset); + }); - return merged; + return merged; } export function bufferToBytes(b: Buffer) { - return new Uint8Array(b.buffer); + return new Uint8Array(b.buffer); } export function bytesToBase64(bytes: Uint8Array) { - return btoa(String.fromCharCode.apply(null, Array.from(bytes))); + return btoa(bytes.reduce((data, byte) => data + String.fromCharCode(byte), '')); } export function base64ToBytes(base64: string) { - return Uint8Array.from(atob(base64), (c) => c.charCodeAt(0)); + return Uint8Array.from(atob(base64), (c) => c.charCodeAt(0)); } export function bytesToHex(bytes: Uint8Array) { - return ( - '0x' + - Array.from(bytes) - .map((b) => b.toString(16).padStart(2, '0')) - .join('') - ); + return ( + '0x' + + Array.from(bytes) + .map((b) => b.toString(16).padStart(2, '0')) + .join('') + ); } export function hexToBytes(hexString: string) { - if (hexString.slice(0, 2) === '0x') { - hexString = hexString.replace('0x', ''); - } - if (hexString.length % 2 !== 0) { - hexString = '0' + hexString; - } - return Uint8Array.from((hexString.match(/.{1,2}/g) as string[]).map((byte) => parseInt(byte, 16))); + if (hexString.slice(0, 2) === '0x') { + hexString = hexString.slice(2); + } + if (hexString.length % 2 !== 0) { + hexString = '0' + hexString; + } + return Uint8Array.from((hexString.match(/.{1,2}/g) as string[]).map((byte) => parseInt(byte, 16))); } // Convert BE encoded bytes (Buffer | Uint8Array) array to BigInt export function bytesToBN(bytes: Uint8Array) { - return BigInt(bytesToHex(bytes)); + return BigInt(bytesToHex(bytes)); } // Convert BigInt to BE encoded Uint8Array type export function bnToBytes(bigint: bigint | string) { - // Parse bigint to hex string - let hexString: string = typeof bigint === 'bigint' ? bigint.toString(16) : bigint; - // Remove hex string prefix if exists - if (hexString.startsWith('0x')) { - hexString = hexString.replace('0x', ''); - } - // Hex string length should be a multiplier of two (To make correct bytes) - if (hexString.length % 2 !== 0) { - hexString = '0' + hexString; - } - return Uint8Array.from((hexString.match(/.{1,2}/g) as string[]).map((byte) => parseInt(byte, 16))); + // Parse bigint to hex string + let hexString: string = typeof bigint === 'bigint' ? bigint.toString(16) : bigint; + // Remove hex string prefix if exists + if (hexString.slice(0, 2) === '0x') { + hexString = hexString.slice(2); + } + // Hex string length should be a multiplier of two (To make correct bytes) + if (hexString.length % 2 !== 0) { + hexString = '0' + hexString; + } + return Uint8Array.from((hexString.match(/.{1,2}/g) as string[]).map((byte) => parseInt(byte, 16))); } // Convert LE encoded bytes (Buffer | Uint8Array) array to BigInt export function leBuff2Int(bytes: Uint8Array) { - return new BN(bytes, 16, 'le'); + return new BN(bytes, 16, 'le'); } // Convert BigInt to LE encoded Uint8Array type export function leInt2Buff(bigint: bnInput | bigint) { - return Uint8Array.from(new BN(bigint as bnInput).toArray('le', 31)); + return Uint8Array.from(new BN(bigint as bnInput).toArray('le', 31)); } // Inherited from tornado-core and tornado-cli export function toFixedHex(numberish: BigNumberish, length = 32) { - return ( - '0x' + - BigInt(numberish) - .toString(16) - .padStart(length * 2, '0') - ); + return ( + '0x' + + BigInt(numberish) + .toString(16) + .padStart(length * 2, '0') + ); } export function toFixedLength(string: string, length: number = 32) { - string = string.replace('0x', ''); - return '0x' + string.padStart(length * 2, '0'); + string = string.replace('0x', ''); + return '0x' + string.padStart(length * 2, '0'); } // Random BigInt in a range of bytes export function rBigInt(nbytes: number = 31) { - return bytesToBN(crypto.getRandomValues(new Uint8Array(nbytes))); + return bytesToBN(crypto.getRandomValues(new Uint8Array(nbytes))); +} + +export function rHex(nbytes: number = 32) { + return bytesToHex(crypto.getRandomValues(new Uint8Array(nbytes))); } // Used for JSON.stringify(value, bigIntReplacer, space) // eslint-disable-next-line @typescript-eslint/no-explicit-any export function bigIntReplacer(key: any, value: any) { - return typeof value === 'bigint' ? value.toString() : value; + return typeof value === 'bigint' ? value.toString() : value; } export function substring(str: string, length: number = 10) { - if (str.length < length * 2) { - return str; - } + if (str.length < length * 2) { + return str; + } - return `${str.substring(0, length)}...${str.substring(str.length - length)}`; + return `${str.substring(0, length)}...${str.substring(str.length - length)}`; +} + +export async function digest(bytes: Uint8Array, algo: string = 'SHA-384') { + return new Uint8Array(await crypto.subtle.digest(algo, bytes)); +} + +export function numberFormatter(num: string | number | bigint, digits: number = 3): string { + const lookup = [ + { value: 1, symbol: '' }, + { value: 1e3, symbol: 'K' }, + { value: 1e6, symbol: 'M' }, + { value: 1e9, symbol: 'G' }, + { value: 1e12, symbol: 'T' }, + { value: 1e15, symbol: 'P' }, + { value: 1e18, symbol: 'E' }, + ]; + const regexp = /\.0+$|(?<=\.[0-9]*[1-9])0+$/; + const item = lookup + .slice() + .reverse() + .find((item) => Number(num) >= item.value); + return item ? (Number(num) / item.value).toFixed(digits).replace(regexp, '').concat(item.symbol) : '0'; +} + +export function isHex(value: string) { + return /^0x[0-9a-fA-F]*$/.test(value); +} + +// Return binary format of IPFS URL https://eips.ethereum.org/EIPS/eip-1577 +export function toContentHash(ipfsUrl: string) { + return contentHashUtils.fromIpfs(ipfsUrl); +} + +export function fromContentHash(contentHash: string) { + return contentHashUtils.decode(contentHash); } diff --git a/src/websnark.ts b/src/websnark.ts index f40e281..b6c10f1 100644 --- a/src/websnark.ts +++ b/src/websnark.ts @@ -3,85 +3,84 @@ import * as websnarkUtils from '@tornado/websnark/src/utils'; // @ts-expect-error no-websnark-types import websnarkGroth from '@tornado/websnark/src/groth16'; import type { Element } from '@tornado/fixed-merkle-tree'; -import type { AddressLike, BytesLike, BigNumberish } from 'ethers'; import { toFixedHex } from './utils'; -export type snarkInputs = { - // Public snark inputs - root: Element; - nullifierHex: string; - recipient: AddressLike; - relayer: AddressLike; - fee: bigint; - refund: bigint; +export interface snarkInputs { + // Public snark inputs + root: Element; + nullifierHex: string; + recipient: string; + relayer: string; + fee: bigint; + refund: bigint; - // Private snark inputs - nullifier: bigint; - secret: bigint; - pathElements: Element[]; - pathIndices: Element[]; -}; + // Private snark inputs + nullifier: bigint; + secret: bigint; + pathElements: Element[]; + pathIndices: Element[]; +} export type snarkArgs = [ - _root: BytesLike, - _nullifierHash: BytesLike, - _recipient: AddressLike, - _relayer: AddressLike, - _fee: BigNumberish, - _refund: BigNumberish, + _root: string, + _nullifierHash: string, + _recipient: string, + _relayer: string, + _fee: string, + _refund: string, ]; -export type snarkProofs = { - proof: BytesLike; - args: snarkArgs; -}; +export interface snarkProofs { + proof: string; + args: snarkArgs; +} // eslint-disable-next-line @typescript-eslint/no-explicit-any let groth16: any; export async function initGroth16() { - if (!groth16) { - groth16 = await websnarkGroth({ wasmInitialMemory: 2000 }); - } + if (!groth16) { + groth16 = await websnarkGroth({ wasmInitialMemory: 2000 }); + } } export async function calculateSnarkProof( - input: snarkInputs, - circuit: object, - provingKey: ArrayBuffer, + input: snarkInputs, + circuit: object, + provingKey: ArrayBuffer, ): Promise { - if (!groth16) { - await initGroth16(); - } + if (!groth16) { + await initGroth16(); + } - const snarkInput = { - root: input.root, - nullifierHash: BigInt(input.nullifierHex).toString(), - recipient: BigInt(input.recipient as string), - relayer: BigInt(input.relayer as string), - fee: input.fee, - refund: input.refund, + const snarkInput = { + root: input.root, + nullifierHash: BigInt(input.nullifierHex).toString(), + recipient: BigInt(input.recipient as string), + relayer: BigInt(input.relayer as string), + fee: input.fee, + refund: input.refund, - nullifier: input.nullifier, - secret: input.secret, - pathElements: input.pathElements, - pathIndices: input.pathIndices, - }; + nullifier: input.nullifier, + secret: input.secret, + pathElements: input.pathElements, + pathIndices: input.pathIndices, + }; - console.log('Start generating SNARK proof', snarkInput); - console.time('SNARK proof time'); - const proofData = await websnarkUtils.genWitnessAndProve(await groth16, snarkInput, circuit, provingKey); - const proof = websnarkUtils.toSolidityInput(proofData).proof as BytesLike; - console.timeEnd('SNARK proof time'); + console.log('Start generating SNARK proof', snarkInput); + console.time('SNARK proof time'); + const proofData = await websnarkUtils.genWitnessAndProve(await groth16, snarkInput, circuit, provingKey); + const proof = websnarkUtils.toSolidityInput(proofData).proof; + console.timeEnd('SNARK proof time'); - const args = [ - toFixedHex(input.root, 32) as BytesLike, - toFixedHex(input.nullifierHex, 32) as BytesLike, - input.recipient, - input.relayer, - toFixedHex(input.fee, 32) as BigNumberish, - toFixedHex(input.refund, 32) as BigNumberish, - ] as snarkArgs; + const args = [ + toFixedHex(input.root, 32), + toFixedHex(input.nullifierHex, 32), + input.recipient, + input.relayer, + toFixedHex(input.fee, 32), + toFixedHex(input.refund, 32), + ] as snarkArgs; - return { proof, args }; + return { proof, args }; } diff --git a/src/zip.ts b/src/zip.ts new file mode 100644 index 0000000..c21e9f1 --- /dev/null +++ b/src/zip.ts @@ -0,0 +1,68 @@ +import { zip, unzip, AsyncZippable, Unzipped, ZipAttributes } from 'fflate'; +import { fetchData } from './providers'; +import { bytesToBase64, digest } from './utils'; + +export function zipAsync(file: AsyncZippable, options?: ZipAttributes): Promise { + return new Promise((res, rej) => { + zip(file, { ...(options || {}), mtime: new Date('1/1/1980') }, (err, data) => { + if (err) { + rej(err); + return; + } + res(data); + }); + }); +} + +export function unzipAsync(data: Uint8Array): Promise { + return new Promise((res, rej) => { + unzip(data, {}, (err, data) => { + if (err) { + rej(err); + return; + } + res(data); + }); + }); +} + +export async function downloadZip({ + staticUrl = '', + zipName, + zipDigest, + parseJson = true, +}: { + staticUrl?: string; + zipName: string; + zipDigest?: string; + parseJson?: boolean; +}): Promise { + const url = `${staticUrl}/${zipName}.zip`; + + const resp = (await fetchData(url, { + method: 'GET', + returnResponse: true, + })) as Response; + + const data = new Uint8Array(await resp.arrayBuffer()); + + // If the zip has digest value, compare it + if (zipDigest) { + const hash = 'sha384-' + bytesToBase64(await digest(data)); + + if (zipDigest !== hash) { + const errMsg = `Invalid digest hash for file ${url}, wants ${zipDigest} has ${hash}`; + throw new Error(errMsg); + } + } + + const { [zipName]: content } = await unzipAsync(data); + + console.log(`Downloaded ${url}${zipDigest ? ` ( Digest: ${zipDigest} )` : ''}`); + + if (parseJson) { + return JSON.parse(new TextDecoder().decode(content)) as T; + } + + return content as T; +} diff --git a/test/deposit.ts b/test/deposit.ts new file mode 100644 index 0000000..d35cf3a --- /dev/null +++ b/test/deposit.ts @@ -0,0 +1,68 @@ +import { loadFixture } from '@nomicfoundation/hardhat-toolbox/network-helpers'; +import { anyValue } from '@nomicfoundation/hardhat-chai-matchers/withArgs'; +import { ethers } from 'hardhat'; +import { expect } from 'chai'; +import { formatEther } from 'ethers'; + +import { ETHTornado__factory, Verifier__factory } from '@tornado/contracts'; +import { Deposit, deployHasher } from '../src'; + +const { getSigners } = ethers; + +const NOTES_COUNT = 100; + +describe('./src/deposit.ts', function () { + const instanceFixture = async () => { + const [owner] = await getSigners(); + + const Hasher = (await (await deployHasher(owner)).wait())?.contractAddress as string; + + const Verifier = await new Verifier__factory(owner).deploy(); + + const Instance = await new ETHTornado__factory(owner).deploy(Verifier.target, Hasher, 1n, 20); + + return { Instance }; + }; + + it('Deposit New Note', async function () { + const { Instance } = await loadFixture(instanceFixture); + + const [owner] = await getSigners(); + + const netId = Number((await owner.provider.getNetwork()).chainId); + + const deposit = await Deposit.createNote({ + currency: 'eth', + amount: formatEther(1), + netId, + }); + + const resp = await Instance.deposit(deposit.commitmentHex, { + value: 1n, + }); + + await expect(resp).to.emit(Instance, 'Deposit').withArgs(deposit.commitmentHex, 0, anyValue); + + expect(await Instance.commitments(deposit.commitmentHex)).to.be.true; + }); + + xit(`Creating ${NOTES_COUNT} random notes`, async function () { + const notes = (await Promise.all( + // eslint-disable-next-line prefer-spread + Array.apply(null, Array(NOTES_COUNT)).map(() => + Deposit.createNote({ + currency: 'eth', + amount: '0.1', + netId: 31337, + }), + ), + )) as Deposit[]; + + notes.forEach(({ noteHex, commitmentHex, nullifierHex }) => { + // ((secret.length: 31) + (nullifier.length: 31)) * 2 + (prefix: 2) = 126 + expect(noteHex.length === 126).to.be.true; + expect(commitmentHex.length === 66).to.be.true; + expect(nullifierHex.length === 66).to.be.true; + }); + }); +}); diff --git a/test/ipfs.ts b/test/ipfs.ts new file mode 100644 index 0000000..dd5bfb3 --- /dev/null +++ b/test/ipfs.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { toContentHash, fromContentHash } from '../src'; + +// https://etherscan.io/tx/0x6600d21cb35ab035a3d2137f9aa888f03a886890f5e8a473f836bf97c514630b + +const IPFS_URL = 'bafybeiguio2xvl2h47zh2jfh3oa6inattoqcyjyhmryydkpnlty3mmqxs4'; + +const CONTENT_HASH = 'e30101701220d443b57aaf47e7f27d24a7db81e434139ba02c2707647181a9ed5cf1b6321797'; + +describe('ipfs', function () { + it('contentHash', function () { + expect(toContentHash(IPFS_URL)).to.equal(CONTENT_HASH); + + expect(fromContentHash(CONTENT_HASH)).to.equal(IPFS_URL); + }); +}); diff --git a/test/provider.ts b/test/provider.ts new file mode 100644 index 0000000..2ea12a1 --- /dev/null +++ b/test/provider.ts @@ -0,0 +1,64 @@ +import fetchMock from 'fetch-mock'; +import { FetchRequest } from 'ethers'; +import { expect } from 'chai'; + +import { getProvider } from '../src'; + +(globalThis as unknown as { useGlobalFetch?: boolean }).useGlobalFetch = true; + +const ETHERS_DEFAULT_TIMEOUT = new FetchRequest('').timeout; + +describe('provider', function () { + it('getProvider', async function () { + // https://ethereum.github.io/execution-apis/api-documentation/ + fetchMock.mockGlobal(); + fetchMock.postOnce( + 'http://localhost:8545/', + { + jsonrpc: '2.0', + result: '0x1', + id: 0, + }, + { + delay: 1000, + }, + ); + + const provider = await getProvider('http://localhost:8545', { + netId: 1, + }); + + expect((await provider.getNetwork()).chainId).to.be.equal(1n); + + expect(provider._getConnection().timeout).to.be.equal(ETHERS_DEFAULT_TIMEOUT); + + fetchMock.unmockGlobal(); + }); + + it('timeout', async function () { + // https://ethereum.github.io/execution-apis/api-documentation/ + fetchMock.mockGlobal(); + fetchMock.postOnce( + 'http://localhost:8545/', + { + jsonrpc: '2.0', + result: '0x1', + id: 0, + }, + { + delay: 1000, + }, + ); + + try { + await getProvider('http://localhost:8545', { + netId: 1, + timeout: 100, + }); + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } catch (err: any) { + expect(err.message.includes('The operation was aborted')).to.be.true; + } + }); +}); diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 0000000..2574d36 --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "rootDir": "./src" + }, + "files": [] +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 8fd0f0f..8ab1eb8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,7 +15,7 @@ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ /* Language and Environment */ - "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ @@ -30,7 +30,7 @@ /* Modules */ "module": "commonjs", /* Specify what module code is generated. */ - "rootDir": "./src", /* Specify the root folder within your source files. */ + "rootDir": ".", /* Specify the root folder within your source files. */ // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ @@ -59,7 +59,7 @@ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ - "outDir": "./dist", /* Specify an output folder for all emitted files. */ + "outDir": "./dist", /* Specify an output folder for all emitted files. */ // "removeComments": true, /* Disable emitting comments. */ // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ @@ -110,5 +110,6 @@ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ "skipLibCheck": true /* Skip type checking all .d.ts files. */ }, - "include": ["./src/**/*"] + "include": ["./src/**/*"], + "files": ["./hardhat.config.ts"] } diff --git a/webpack.config.js b/webpack.config.js index 07d7e8e..05d3cd8 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,76 +1,173 @@ -const esbuild = require('esbuild'); +const { BannerPlugin } = require('webpack'); const path = require('path'); const NodePolyfillPlugin = require('node-polyfill-webpack-plugin'); const esbuildLoader = { - test: /\.ts?$/, - loader: 'esbuild-loader', - options: { - loader: 'ts', - target: 'es2016', - implementation: esbuild - } + test: /\.ts?$/, + loader: 'esbuild-loader', + options: { + loader: 'ts', + target: 'es2022', + } } const commonAlias = { - fs: false, - 'path': false, - 'url': false, - 'worker_threads': false, - 'fflate': 'fflate/browser', - 'http-proxy-agent': false, - 'https-proxy-agent': false, - 'socks-proxy-agent': false, + fs: false, + 'path': false, + 'url': false, + 'worker_threads': false, + 'fflate': 'fflate/browser', + 'http-proxy-agent': false, + 'https-proxy-agent': false, + 'socks-proxy-agent': false, } module.exports = [ - { - mode: 'production', - module: { - rules: [esbuildLoader] + { + mode: 'production', + module: { + rules: [esbuildLoader] + }, + entry: './src/index.ts', + output: { + filename: 'tornado.umd.js', + path: path.resolve(__dirname, './dist'), + library: 'Tornado', + libraryTarget: 'umd' + }, + plugins: [ + new NodePolyfillPlugin(), + ], + resolve: { + extensions: ['.tsx', '.ts', '.js'], + alias: { + ...commonAlias, + } + }, + optimization: { + minimize: false, + } }, - entry: './src/index.ts', - output: { - filename: 'index.umd.js', - path: path.resolve(__dirname, './dist'), - library: 'Tornado', - libraryTarget: 'umd' + { + mode: 'production', + module: { + rules: [esbuildLoader] + }, + entry: './src/index.ts', + output: { + filename: 'tornado.umd.min.js', + path: path.resolve(__dirname, './dist'), + library: 'Tornado', + libraryTarget: 'umd' + }, + plugins: [ + new NodePolyfillPlugin(), + ], + resolve: { + extensions: ['.tsx', '.ts', '.js'], + alias: { + ...commonAlias, + } + }, }, - plugins: [ - new NodePolyfillPlugin(), - ], - resolve: { - extensions: ['.tsx', '.ts', '.js'], - alias: { - ...commonAlias, - } + { + mode: 'production', + module: { + rules: [esbuildLoader] + }, + entry: './src/merkleTreeWorker.ts', + output: { + filename: 'merkleTreeWorker.umd.js', + path: path.resolve(__dirname, './dist'), + libraryTarget: 'umd' + }, + plugins: [ + new NodePolyfillPlugin(), + new BannerPlugin({ + banner: 'globalThis.process = { browser: true, env: {}, };\n', + raw: true, + }), + ], + resolve: { + extensions: ['.tsx', '.ts', '.js'], + alias: { + ...commonAlias, + } + }, + optimization: { + minimize: false, + } }, - optimization: { - minimize: false, - } - }, - { - mode: 'production', - module: { - rules: [esbuildLoader] + { + mode: 'production', + module: { + rules: [esbuildLoader] + }, + entry: './src/merkleTreeWorker.ts', + output: { + filename: 'merkleTreeWorker.umd.min.js', + path: path.resolve(__dirname, './dist'), + libraryTarget: 'umd' + }, + plugins: [ + new NodePolyfillPlugin(), + new BannerPlugin({ + banner: 'globalThis.process = { browser: true, env: {}, };', + raw: true, + }), + ], + resolve: { + extensions: ['.tsx', '.ts', '.js'], + alias: { + ...commonAlias, + } + }, }, - entry: './src/merkleTreeWorker.ts', - output: { - filename: 'merkleTreeWorker.umd.js', - path: path.resolve(__dirname, './dist'), - libraryTarget: 'umd' + { + mode: 'production', + module: { + rules: [esbuildLoader] + }, + entry: './src/contracts.ts', + output: { + filename: 'tornadoContracts.umd.js', + path: path.resolve(__dirname, './dist'), + library: 'TornadoContracts', + libraryTarget: 'umd' + }, + plugins: [ + new NodePolyfillPlugin(), + ], + resolve: { + extensions: ['.tsx', '.ts', '.js'], + alias: { + ...commonAlias, + } + }, + optimization: { + minimize: false, + } }, - plugins: [ - new NodePolyfillPlugin(), - ], - resolve: { - extensions: ['.tsx', '.ts', '.js'], - alias: { - ...commonAlias, - } + { + mode: 'production', + module: { + rules: [esbuildLoader] + }, + entry: './src/contracts.ts', + output: { + filename: 'tornadoContracts.umd.min.js', + path: path.resolve(__dirname, './dist'), + library: 'TornadoContracts', + libraryTarget: 'umd' + }, + plugins: [ + new NodePolyfillPlugin(), + ], + resolve: { + extensions: ['.tsx', '.ts', '.js'], + alias: { + ...commonAlias, + } + }, }, - optimization: { - minimize: false, - } - } ]; diff --git a/yarn.lock b/yarn.lock index 3103d8d..9cb0d24 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,158 +2,317 @@ # yarn lockfile v1 -"@aashutoshrathi/word-wrap@^1.2.3": - version "1.2.6" - resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" - integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== - -"@adraffy/ens-normalize@1.10.1": +"@adraffy/ens-normalize@1.10.0", "@adraffy/ens-normalize@1.10.1": version "1.10.1" resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz#63430d04bd8c5e74f8d7d049338f1cd9d4f02069" integrity sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw== -"@babel/code-frame@^7.0.0": - version "7.24.2" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.2.tgz#718b4b19841809a58b29b68cde80bc5e1aa6d9ae" - integrity sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ== +"@ampproject/remapping@^2.2.0": + version "2.3.0" + resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4" + integrity sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw== dependencies: - "@babel/highlight" "^7.24.2" + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.24" + +"@babel/code-frame@^7.0.0": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.7.tgz#882fd9e09e8ee324e496bd040401c6f046ef4465" + integrity sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA== + dependencies: + "@babel/highlight" "^7.24.7" picocolors "^1.0.0" -"@babel/helper-validator-identifier@^7.22.20": - version "7.22.20" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" - integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== - -"@babel/highlight@^7.24.2": - version "7.24.2" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.24.2.tgz#3f539503efc83d3c59080a10e6634306e0370d26" - integrity sha512-Yac1ao4flkTxTteCDZLEvdxg2fZfz1v8M4QpaGypq/WPDqg3ijHYbDfs+LG5hvzSoqaSZ9/Z9lKSP3CjZjv+pA== +"@babel/code-frame@^7.25.9", "@babel/code-frame@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.26.0.tgz#9374b5cd068d128dac0b94ff482594273b1c2815" + integrity sha512-INCKxTtbXtcNbUZ3YXutwMpEleqttcswhAdee7dhuoVrD2cnuc3PqtERBtxkX5nziX9vnBL8WXmSGwv8CuPV6g== dependencies: - "@babel/helper-validator-identifier" "^7.22.20" + "@babel/helper-validator-identifier" "^7.25.9" + js-tokens "^4.0.0" + picocolors "^1.0.0" + +"@babel/compat-data@^7.25.9": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.26.0.tgz#f02ba6d34e88fadd5e8861e8b38902f43cc1c819" + integrity sha512-qETICbZSLe7uXv9VE8T/RWOdIE5qqyTucOt4zLYMafj2MRO271VGgLd4RACJMeBO37UPWhXiKMBk7YlJ0fOzQA== + +"@babel/core@^7.23.9": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.26.0.tgz#d78b6023cc8f3114ccf049eb219613f74a747b40" + integrity sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg== + dependencies: + "@ampproject/remapping" "^2.2.0" + "@babel/code-frame" "^7.26.0" + "@babel/generator" "^7.26.0" + "@babel/helper-compilation-targets" "^7.25.9" + "@babel/helper-module-transforms" "^7.26.0" + "@babel/helpers" "^7.26.0" + "@babel/parser" "^7.26.0" + "@babel/template" "^7.25.9" + "@babel/traverse" "^7.25.9" + "@babel/types" "^7.26.0" + convert-source-map "^2.0.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.2.3" + semver "^6.3.1" + +"@babel/generator@^7.25.9", "@babel/generator@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.26.0.tgz#505cc7c90d92513f458a477e5ef0703e7c91b8d7" + integrity sha512-/AIkAmInnWwgEAJGQr9vY0c66Mj6kjkE2ZPB1PurTRaRAh3U+J45sAQMjQDJdh4WbR3l0x5xkimXBKyBXXAu2w== + dependencies: + "@babel/parser" "^7.26.0" + "@babel/types" "^7.26.0" + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.25" + jsesc "^3.0.2" + +"@babel/helper-compilation-targets@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.9.tgz#55af025ce365be3cdc0c1c1e56c6af617ce88875" + integrity sha512-j9Db8Suy6yV/VHa4qzrj9yZfZxhLWQdVnRlXxmKLYlhWUVB1sB2G5sxuWYXk/whHD9iW76PmNzxZ4UCnTQTVEQ== + dependencies: + "@babel/compat-data" "^7.25.9" + "@babel/helper-validator-option" "^7.25.9" + browserslist "^4.24.0" + lru-cache "^5.1.1" + semver "^6.3.1" + +"@babel/helper-module-imports@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz#e7f8d20602ebdbf9ebbea0a0751fb0f2a4141715" + integrity sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw== + dependencies: + "@babel/traverse" "^7.25.9" + "@babel/types" "^7.25.9" + +"@babel/helper-module-transforms@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz#8ce54ec9d592695e58d84cd884b7b5c6a2fdeeae" + integrity sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw== + dependencies: + "@babel/helper-module-imports" "^7.25.9" + "@babel/helper-validator-identifier" "^7.25.9" + "@babel/traverse" "^7.25.9" + +"@babel/helper-string-parser@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz#1aabb72ee72ed35789b4bbcad3ca2862ce614e8c" + integrity sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA== + +"@babel/helper-validator-identifier@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz#75b889cfaf9e35c2aaf42cf0d72c8e91719251db" + integrity sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w== + +"@babel/helper-validator-identifier@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz#24b64e2c3ec7cd3b3c547729b8d16871f22cbdc7" + integrity sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ== + +"@babel/helper-validator-option@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz#86e45bd8a49ab7e03f276577f96179653d41da72" + integrity sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw== + +"@babel/helpers@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.26.0.tgz#30e621f1eba5aa45fe6f4868d2e9154d884119a4" + integrity sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw== + dependencies: + "@babel/template" "^7.25.9" + "@babel/types" "^7.26.0" + +"@babel/highlight@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.24.7.tgz#a05ab1df134b286558aae0ed41e6c5f731bf409d" + integrity sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw== + dependencies: + "@babel/helper-validator-identifier" "^7.24.7" chalk "^2.4.2" js-tokens "^4.0.0" picocolors "^1.0.0" +"@babel/parser@^7.23.9", "@babel/parser@^7.25.9", "@babel/parser@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.26.0.tgz#710a75a7d805a8f72753154e451474e9795b121c" + integrity sha512-aP8x5pIw3xvYr/sXT+SEUwyhrXT8rUJRZltK/qN3Db80dcKpTett8cJxHyjk+xYSVXvNnl2SfcJVjbwxpOSscA== + dependencies: + "@babel/types" "^7.26.0" + +"@babel/template@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.25.9.tgz#ecb62d81a8a6f5dc5fe8abfc3901fc52ddf15016" + integrity sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg== + dependencies: + "@babel/code-frame" "^7.25.9" + "@babel/parser" "^7.25.9" + "@babel/types" "^7.25.9" + +"@babel/traverse@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.25.9.tgz#a50f8fe49e7f69f53de5bea7e413cd35c5e13c84" + integrity sha512-ZCuvfwOwlz/bawvAuvcj8rrithP2/N55Tzz342AkTvq4qaWbGfmCk/tKhNaV2cthijKrPAA8SRJV5WWe7IBMJw== + dependencies: + "@babel/code-frame" "^7.25.9" + "@babel/generator" "^7.25.9" + "@babel/parser" "^7.25.9" + "@babel/template" "^7.25.9" + "@babel/types" "^7.25.9" + debug "^4.3.1" + globals "^11.1.0" + +"@babel/types@^7.25.9", "@babel/types@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.26.0.tgz#deabd08d6b753bc8e0f198f8709fb575e31774ff" + integrity sha512-Z/yiTPj+lDVnF7lWeKCIJzaIkI0vYO87dMpZ4bg4TDrFe4XXLFWL1TbXU27gBP3QccxV9mZICCrnjnYlJjXHOA== + dependencies: + "@babel/helper-string-parser" "^7.25.9" + "@babel/helper-validator-identifier" "^7.25.9" + +"@colors/colors@1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" + integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ== + +"@cspotcode/source-map-support@^0.8.0": + version "0.8.1" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" + integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== + dependencies: + "@jridgewell/trace-mapping" "0.3.9" + "@discoveryjs/json-ext@^0.5.0": version "0.5.7" resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz#1d572bfbbe14b7704e0ba0f39b74815b84870d70" integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw== -"@esbuild/aix-ppc64@0.20.2": - version "0.20.2" - resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.20.2.tgz#a70f4ac11c6a1dfc18b8bbb13284155d933b9537" - integrity sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g== +"@ensdomains/content-hash@2.5.7": + version "2.5.7" + resolved "https://registry.yarnpkg.com/@ensdomains/content-hash/-/content-hash-2.5.7.tgz#180e4ceb6e585a05d69ba307619d4a0cf12948f1" + integrity sha512-WNdGKCeubMIAfyPYTMlKeX6cgXKIEo42OcWPOLBiclzJwMibkVqpaGgWKVH9dniJq7bLXLa2tQ0k/F1pt6gUxA== + dependencies: + cids "^1.1.5" + js-base64 "^3.6.0" + multicodec "^3.2.0" + multihashes "^2.0.0" -"@esbuild/android-arm64@0.20.2": - version "0.20.2" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.20.2.tgz#db1c9202a5bc92ea04c7b6840f1bbe09ebf9e6b9" - integrity sha512-mRzjLacRtl/tWU0SvD8lUEwb61yP9cqQo6noDZP/O8VkwafSYwZ4yWy24kan8jE/IMERpYncRt2dw438LP3Xmg== +"@esbuild/aix-ppc64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz#c7184a326533fcdf1b8ee0733e21c713b975575f" + integrity sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ== -"@esbuild/android-arm@0.20.2": - version "0.20.2" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.20.2.tgz#3b488c49aee9d491c2c8f98a909b785870d6e995" - integrity sha512-t98Ra6pw2VaDhqNWO2Oph2LXbz/EJcnLmKLGBJwEwXX/JAN83Fym1rU8l0JUWK6HkIbWONCSSatf4sf2NBRx/w== +"@esbuild/android-arm64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz#09d9b4357780da9ea3a7dfb833a1f1ff439b4052" + integrity sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A== -"@esbuild/android-x64@0.20.2": - version "0.20.2" - resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.20.2.tgz#3b1628029e5576249d2b2d766696e50768449f98" - integrity sha512-btzExgV+/lMGDDa194CcUQm53ncxzeBrWJcncOBxuC6ndBkKxnHdFJn86mCIgTELsooUmwUm9FkhSp5HYu00Rg== +"@esbuild/android-arm@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.21.5.tgz#9b04384fb771926dfa6d7ad04324ecb2ab9b2e28" + integrity sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg== -"@esbuild/darwin-arm64@0.20.2": - version "0.20.2" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.20.2.tgz#6e8517a045ddd86ae30c6608c8475ebc0c4000bb" - integrity sha512-4J6IRT+10J3aJH3l1yzEg9y3wkTDgDk7TSDFX+wKFiWjqWp/iCfLIYzGyasx9l0SAFPT1HwSCR+0w/h1ES/MjA== +"@esbuild/android-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.21.5.tgz#29918ec2db754cedcb6c1b04de8cd6547af6461e" + integrity sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA== -"@esbuild/darwin-x64@0.20.2": - version "0.20.2" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.20.2.tgz#90ed098e1f9dd8a9381695b207e1cff45540a0d0" - integrity sha512-tBcXp9KNphnNH0dfhv8KYkZhjc+H3XBkF5DKtswJblV7KlT9EI2+jeA8DgBjp908WEuYll6pF+UStUCfEpdysA== +"@esbuild/darwin-arm64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz#e495b539660e51690f3928af50a76fb0a6ccff2a" + integrity sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ== -"@esbuild/freebsd-arm64@0.20.2": - version "0.20.2" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.2.tgz#d71502d1ee89a1130327e890364666c760a2a911" - integrity sha512-d3qI41G4SuLiCGCFGUrKsSeTXyWG6yem1KcGZVS+3FYlYhtNoNgYrWcvkOoaqMhwXSMrZRl69ArHsGJ9mYdbbw== +"@esbuild/darwin-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz#c13838fa57372839abdddc91d71542ceea2e1e22" + integrity sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw== -"@esbuild/freebsd-x64@0.20.2": - version "0.20.2" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.20.2.tgz#aa5ea58d9c1dd9af688b8b6f63ef0d3d60cea53c" - integrity sha512-d+DipyvHRuqEeM5zDivKV1KuXn9WeRX6vqSqIDgwIfPQtwMP4jaDsQsDncjTDDsExT4lR/91OLjRo8bmC1e+Cw== +"@esbuild/freebsd-arm64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz#646b989aa20bf89fd071dd5dbfad69a3542e550e" + integrity sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g== -"@esbuild/linux-arm64@0.20.2": - version "0.20.2" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.20.2.tgz#055b63725df678379b0f6db9d0fa85463755b2e5" - integrity sha512-9pb6rBjGvTFNira2FLIWqDk/uaf42sSyLE8j1rnUpuzsODBq7FvpwHYZxQ/It/8b+QOS1RYfqgGFNLRI+qlq2A== +"@esbuild/freebsd-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz#aa615cfc80af954d3458906e38ca22c18cf5c261" + integrity sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ== -"@esbuild/linux-arm@0.20.2": - version "0.20.2" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.20.2.tgz#76b3b98cb1f87936fbc37f073efabad49dcd889c" - integrity sha512-VhLPeR8HTMPccbuWWcEUD1Az68TqaTYyj6nfE4QByZIQEQVWBB8vup8PpR7y1QHL3CpcF6xd5WVBU/+SBEvGTg== +"@esbuild/linux-arm64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz#70ac6fa14f5cb7e1f7f887bcffb680ad09922b5b" + integrity sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q== -"@esbuild/linux-ia32@0.20.2": - version "0.20.2" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.20.2.tgz#c0e5e787c285264e5dfc7a79f04b8b4eefdad7fa" - integrity sha512-o10utieEkNPFDZFQm9CoP7Tvb33UutoJqg3qKf1PWVeeJhJw0Q347PxMvBgVVFgouYLGIhFYG0UGdBumROyiig== +"@esbuild/linux-arm@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz#fc6fd11a8aca56c1f6f3894f2bea0479f8f626b9" + integrity sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA== -"@esbuild/linux-loong64@0.20.2": - version "0.20.2" - resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.20.2.tgz#a6184e62bd7cdc63e0c0448b83801001653219c5" - integrity sha512-PR7sp6R/UC4CFVomVINKJ80pMFlfDfMQMYynX7t1tNTeivQ6XdX5r2XovMmha/VjR1YN/HgHWsVcTRIMkymrgQ== +"@esbuild/linux-ia32@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz#3271f53b3f93e3d093d518d1649d6d68d346ede2" + integrity sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg== -"@esbuild/linux-mips64el@0.20.2": - version "0.20.2" - resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.20.2.tgz#d08e39ce86f45ef8fc88549d29c62b8acf5649aa" - integrity sha512-4BlTqeutE/KnOiTG5Y6Sb/Hw6hsBOZapOVF6njAESHInhlQAghVVZL1ZpIctBOoTFbQyGW+LsVYZ8lSSB3wkjA== +"@esbuild/linux-loong64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz#ed62e04238c57026aea831c5a130b73c0f9f26df" + integrity sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg== -"@esbuild/linux-ppc64@0.20.2": - version "0.20.2" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.20.2.tgz#8d252f0b7756ffd6d1cbde5ea67ff8fd20437f20" - integrity sha512-rD3KsaDprDcfajSKdn25ooz5J5/fWBylaaXkuotBDGnMnDP1Uv5DLAN/45qfnf3JDYyJv/ytGHQaziHUdyzaAg== +"@esbuild/linux-mips64el@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz#e79b8eb48bf3b106fadec1ac8240fb97b4e64cbe" + integrity sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg== -"@esbuild/linux-riscv64@0.20.2": - version "0.20.2" - resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.20.2.tgz#19f6dcdb14409dae607f66ca1181dd4e9db81300" - integrity sha512-snwmBKacKmwTMmhLlz/3aH1Q9T8v45bKYGE3j26TsaOVtjIag4wLfWSiZykXzXuE1kbCE+zJRmwp+ZbIHinnVg== +"@esbuild/linux-ppc64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz#5f2203860a143b9919d383ef7573521fb154c3e4" + integrity sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w== -"@esbuild/linux-s390x@0.20.2": - version "0.20.2" - resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.20.2.tgz#3c830c90f1a5d7dd1473d5595ea4ebb920988685" - integrity sha512-wcWISOobRWNm3cezm5HOZcYz1sKoHLd8VL1dl309DiixxVFoFe/o8HnwuIwn6sXre88Nwj+VwZUvJf4AFxkyrQ== +"@esbuild/linux-riscv64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz#07bcafd99322d5af62f618cb9e6a9b7f4bb825dc" + integrity sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA== -"@esbuild/linux-x64@0.20.2": - version "0.20.2" - resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.20.2.tgz#86eca35203afc0d9de0694c64ec0ab0a378f6fff" - integrity sha512-1MdwI6OOTsfQfek8sLwgyjOXAu+wKhLEoaOLTjbijk6E2WONYpH9ZU2mNtR+lZ2B4uwr+usqGuVfFT9tMtGvGw== +"@esbuild/linux-s390x@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz#b7ccf686751d6a3e44b8627ababc8be3ef62d8de" + integrity sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A== -"@esbuild/netbsd-x64@0.20.2": - version "0.20.2" - resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.20.2.tgz#e771c8eb0e0f6e1877ffd4220036b98aed5915e6" - integrity sha512-K8/DhBxcVQkzYc43yJXDSyjlFeHQJBiowJ0uVL6Tor3jGQfSGHNNJcWxNbOI8v5k82prYqzPuwkzHt3J1T1iZQ== +"@esbuild/linux-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz#6d8f0c768e070e64309af8004bb94e68ab2bb3b0" + integrity sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ== -"@esbuild/openbsd-x64@0.20.2": - version "0.20.2" - resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.20.2.tgz#9a795ae4b4e37e674f0f4d716f3e226dd7c39baf" - integrity sha512-eMpKlV0SThJmmJgiVyN9jTPJ2VBPquf6Kt/nAoo6DgHAoN57K15ZghiHaMvqjCye/uU4X5u3YSMgVBI1h3vKrQ== +"@esbuild/netbsd-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz#bbe430f60d378ecb88decb219c602667387a6047" + integrity sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg== -"@esbuild/sunos-x64@0.20.2": - version "0.20.2" - resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.20.2.tgz#7df23b61a497b8ac189def6e25a95673caedb03f" - integrity sha512-2UyFtRC6cXLyejf/YEld4Hajo7UHILetzE1vsRcGL3earZEW77JxrFjH4Ez2qaTiEfMgAXxfAZCm1fvM/G/o8w== +"@esbuild/openbsd-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz#99d1cf2937279560d2104821f5ccce220cb2af70" + integrity sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow== -"@esbuild/win32-arm64@0.20.2": - version "0.20.2" - resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.20.2.tgz#f1ae5abf9ca052ae11c1bc806fb4c0f519bacf90" - integrity sha512-GRibxoawM9ZCnDxnP3usoUDO9vUkpAxIIZ6GQI+IlVmr5kP3zUq+l17xELTHMWTWzjxa2guPNyrpq1GWmPvcGQ== +"@esbuild/sunos-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz#08741512c10d529566baba837b4fe052c8f3487b" + integrity sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg== -"@esbuild/win32-ia32@0.20.2": - version "0.20.2" - resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.20.2.tgz#241fe62c34d8e8461cd708277813e1d0ba55ce23" - integrity sha512-HfLOfn9YWmkSKRQqovpnITazdtquEW8/SoHW7pWpuEeguaZI4QnCRW6b+oZTztdBnZOS2hqJ6im/D5cPzBTTlQ== +"@esbuild/win32-arm64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz#675b7385398411240735016144ab2e99a60fc75d" + integrity sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A== -"@esbuild/win32-x64@0.20.2": - version "0.20.2" - resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.20.2.tgz#9c907b21e30a52db959ba4f80bb01a0cc403d5cc" - integrity sha512-N49X4lJX27+l9jbLKSqZ6bKNjzQvHaT8IIFUy+YIqmXQdjYCToGWwOItDrfby14c78aDd5NHQl29xingXfCdLQ== +"@esbuild/win32-ia32@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz#1bfc3ce98aa6ca9a0969e4d2af72144c59c1193b" + integrity sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA== + +"@esbuild/win32-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz#acad351d582d157bb145535db2a6ff53dd514b5c" + integrity sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw== "@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": version "4.4.0" @@ -163,9 +322,9 @@ eslint-visitor-keys "^3.3.0" "@eslint-community/regexpp@^4.10.0", "@eslint-community/regexpp@^4.6.1": - version "4.10.0" - resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.10.0.tgz#548f6de556857c8bb73bbee70c35dc82a2e74d63" - integrity sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA== + version "4.11.1" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.11.1.tgz#a547badfc719eb3e5f4b556325e542fbe9d7a18f" + integrity sha512-m4DVN9ZqskZoLU5GlWZadwDnYo3vAEydiUayB9widCl9ffWx2IvPnp6n3on5rJmziJSw9Bv+Z3ChDVdMwXCY8Q== "@eslint/eslintrc@^2.1.4": version "2.1.4" @@ -219,7 +378,7 @@ ethereum-cryptography "^2.0.0" micro-ftch "^0.3.1" -"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.7.0": +"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.0.9", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.7.0.tgz#b3f3e045bbbeed1af3947335c247ad625a44e449" integrity sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA== @@ -258,7 +417,18 @@ "@ethersproject/logger" "^5.7.0" "@ethersproject/properties" "^5.7.0" -"@ethersproject/address@5.7.0", "@ethersproject/address@^5.7.0": +"@ethersproject/address@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.6.1.tgz#ab57818d9aefee919c5721d28cd31fd95eff413d" + integrity sha512-uOgF0kS5MJv9ZvCz7x6T2EXJSzotiybApn4XlOgoTX0xdtyVIJ7pF+6cGPxiEq/dpBiTfMiw7Yc81JcwhSYA0Q== + dependencies: + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/keccak256" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/rlp" "^5.6.1" + +"@ethersproject/address@5.7.0", "@ethersproject/address@^5.0.2", "@ethersproject/address@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.7.0.tgz#19b56c4d74a3b0a46bfdbb6cfcc0a153fc697f37" integrity sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA== @@ -284,7 +454,7 @@ "@ethersproject/bytes" "^5.7.0" "@ethersproject/properties" "^5.7.0" -"@ethersproject/bignumber@5.7.0", "@ethersproject/bignumber@^5.7.0": +"@ethersproject/bignumber@5.7.0", "@ethersproject/bignumber@^5.6.2", "@ethersproject/bignumber@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.7.0.tgz#e2f03837f268ba655ffba03a57853e18a18dc9c2" integrity sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw== @@ -293,7 +463,7 @@ "@ethersproject/logger" "^5.7.0" bn.js "^5.2.1" -"@ethersproject/bytes@5.7.0", "@ethersproject/bytes@^5.7.0": +"@ethersproject/bytes@5.7.0", "@ethersproject/bytes@^5.6.1", "@ethersproject/bytes@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.7.0.tgz#a00f6ea8d7e7534d6d87f47188af1148d71f155d" integrity sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A== @@ -375,7 +545,7 @@ aes-js "3.0.0" scrypt-js "3.0.1" -"@ethersproject/keccak256@5.7.0", "@ethersproject/keccak256@^5.7.0": +"@ethersproject/keccak256@5.7.0", "@ethersproject/keccak256@^5.6.1", "@ethersproject/keccak256@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.7.0.tgz#3186350c6e1cd6aba7940384ec7d6d9db01f335a" integrity sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg== @@ -383,7 +553,7 @@ "@ethersproject/bytes" "^5.7.0" js-sha3 "0.8.0" -"@ethersproject/logger@5.7.0", "@ethersproject/logger@^5.7.0": +"@ethersproject/logger@5.7.0", "@ethersproject/logger@^5.6.0", "@ethersproject/logger@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.7.0.tgz#6ce9ae168e74fecf287be17062b590852c311892" integrity sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig== @@ -444,7 +614,7 @@ "@ethersproject/bytes" "^5.7.0" "@ethersproject/logger" "^5.7.0" -"@ethersproject/rlp@5.7.0", "@ethersproject/rlp@^5.7.0": +"@ethersproject/rlp@5.7.0", "@ethersproject/rlp@^5.6.1", "@ethersproject/rlp@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.7.0.tgz#de39e4d5918b9d74d46de93af80b7685a9c21304" integrity sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w== @@ -509,7 +679,7 @@ "@ethersproject/rlp" "^5.7.0" "@ethersproject/signing-key" "^5.7.0" -"@ethersproject/units@5.7.0": +"@ethersproject/units@5.7.0", "@ethersproject/units@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.7.0.tgz#637b563d7e14f42deeee39245275d477aae1d8b1" integrity sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg== @@ -561,6 +731,11 @@ "@ethersproject/properties" "^5.7.0" "@ethersproject/strings" "^5.7.0" +"@fastify/busboy@^2.0.0": + version "2.1.1" + resolved "https://registry.yarnpkg.com/@fastify/busboy/-/busboy-2.1.1.tgz#b9da6a878a371829a0502c9b6c1c143ef6663f4d" + integrity sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA== + "@humanwhocodes/config-array@^0.11.14": version "0.11.14" resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.14.tgz#d78e481a039f7566ecc9660b4ea7fe6b1fec442b" @@ -580,6 +755,34 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz#4a2868d75d6d6963e423bcf90b7fd1be343409d3" integrity sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA== +"@isaacs/cliui@^8.0.2": + version "8.0.2" + resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550" + integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA== + dependencies: + string-width "^5.1.2" + string-width-cjs "npm:string-width@^4.2.0" + strip-ansi "^7.0.1" + strip-ansi-cjs "npm:strip-ansi@^6.0.1" + wrap-ansi "^8.1.0" + wrap-ansi-cjs "npm:wrap-ansi@^7.0.0" + +"@istanbuljs/load-nyc-config@^1.0.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" + integrity sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ== + dependencies: + camelcase "^5.3.1" + find-up "^4.1.0" + get-package-type "^0.1.0" + js-yaml "^3.13.1" + resolve-from "^5.0.0" + +"@istanbuljs/schema@^0.1.2", "@istanbuljs/schema@^0.1.3": + version "0.1.3" + resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" + integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== + "@jridgewell/gen-mapping@^0.3.5": version "0.3.5" resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz#dcce6aff74bdf6dad1a95802b69b04a2fcb1fb36" @@ -589,7 +792,7 @@ "@jridgewell/sourcemap-codec" "^1.4.10" "@jridgewell/trace-mapping" "^0.3.24" -"@jridgewell/resolve-uri@^3.1.0": +"@jridgewell/resolve-uri@^3.0.3", "@jridgewell/resolve-uri@^3.1.0": version "3.1.2" resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== @@ -607,10 +810,18 @@ "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.25" -"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.4.15": - version "1.4.15" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" - integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== +"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a" + integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== + +"@jridgewell/trace-mapping@0.3.9": + version "0.3.9" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" + integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== + dependencies: + "@jridgewell/resolve-uri" "^3.0.3" + "@jridgewell/sourcemap-codec" "^1.4.10" "@jridgewell/trace-mapping@^0.3.20", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": version "0.3.25" @@ -620,69 +831,78 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@metamask/abi-utils@^2.0.2": - version "2.0.2" - resolved "https://registry.yarnpkg.com/@metamask/abi-utils/-/abi-utils-2.0.2.tgz#ad394e9cb8a95ac177cad942daadd88a246c0de8" - integrity sha512-B/A1dY/w4F/t6cDHUscklO6ovb/ztFsrsTXFd8QlqSByk/vyy+QbPE3VVpmmyI/7RX+PA1AJcvBdzCIz+r9dVQ== +"@metamask/abi-utils@^2.0.4": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@metamask/abi-utils/-/abi-utils-2.0.4.tgz#20908c1d910f7a17a89fdf5778a5c59d5cb8b8be" + integrity sha512-StnIgUB75x7a7AgUhiaUZDpCsqGp7VkNnZh2XivXkJ6mPkE83U8ARGQj5MbRis7VJY8BC5V1AbB1fjdh0hupPQ== dependencies: - "@metamask/utils" "^8.0.0" - superstruct "^1.0.3" + "@metamask/superstruct" "^3.1.0" + "@metamask/utils" "^9.0.0" -"@metamask/eth-sig-util@^7.0.1": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@metamask/eth-sig-util/-/eth-sig-util-7.0.1.tgz#ad3227d6120f15f9293478de7dd9685a5c329586" - integrity sha512-59GSrMyFH2fPfu7nKeIQdZ150zxXNNhAQIUaFRUW+MGtVA4w/ONbiQobcRBLi+jQProfIyss51G8pfLPcQ0ylg== +"@metamask/eth-sig-util@^4.0.0": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@metamask/eth-sig-util/-/eth-sig-util-4.0.1.tgz#3ad61f6ea9ad73ba5b19db780d40d9aae5157088" + integrity sha512-tghyZKLHZjcdlDqCA3gNZmLeR0XvOE9U1qoQO9ohyAZT6Pya+H9vkBPcsyXytmYLNgVoin7CKCmweo/R43V+tQ== dependencies: - "@ethereumjs/util" "^8.1.0" - "@metamask/abi-utils" "^2.0.2" - "@metamask/utils" "^8.1.0" - ethereum-cryptography "^2.1.2" + ethereumjs-abi "^0.6.8" + ethereumjs-util "^6.2.1" + ethjs-util "^0.1.6" tweetnacl "^1.0.3" tweetnacl-util "^0.15.1" -"@metamask/utils@^8.0.0", "@metamask/utils@^8.1.0": - version "8.4.0" - resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-8.4.0.tgz#f44812c96467a4e1b70b2edff6ee89a9caa4e354" - integrity sha512-dbIc3C7alOe0agCuBHM1h71UaEaEqOk2W8rAtEn8QGz4haH2Qq7MoK6i7v2guzvkJVVh79c+QCzIqphC3KvrJg== +"@metamask/eth-sig-util@^8.0.0": + version "8.0.0" + resolved "https://registry.yarnpkg.com/@metamask/eth-sig-util/-/eth-sig-util-8.0.0.tgz#6310d93cd1101cab3cc6bc2a1ff526290ed2695b" + integrity sha512-IwE6aoxUL39IhmsAgE4nk+OZbNo+ThFZRNsUjE1pjdEa4MFpWzm1Rue4zJ5DMy1oUyZBi/aiCLMhdMnjl2bh2Q== + dependencies: + "@ethereumjs/util" "^8.1.0" + "@metamask/abi-utils" "^2.0.4" + "@metamask/utils" "^9.0.0" + "@scure/base" "~1.1.3" + ethereum-cryptography "^2.1.2" + tweetnacl "^1.0.3" + +"@metamask/superstruct@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@metamask/superstruct/-/superstruct-3.1.0.tgz#148f786a674fba3ac885c1093ab718515bf7f648" + integrity sha512-N08M56HdOgBfRKkrgCMZvQppkZGcArEop3kixNEtVbJKm6P9Cfg0YkI6X0s1g78sNrj2fWUwvJADdZuzJgFttA== + +"@metamask/utils@^9.0.0": + version "9.2.1" + resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-9.2.1.tgz#d9f84706ff97e0c8d1bde5778549365b14269e81" + integrity sha512-/u663aUaB6+Xe75i3Mt/1cCljm41HDYIsna5oBrwGvgkY2zH7/9k9Zjd706cxoAbxN7QgLSVAReUiGnuxCuXrQ== dependencies: "@ethereumjs/tx" "^4.2.0" + "@metamask/superstruct" "^3.1.0" "@noble/hashes" "^1.3.1" "@scure/base" "^1.1.3" "@types/debug" "^4.1.7" debug "^4.3.4" pony-cause "^2.1.10" semver "^7.5.4" - superstruct "^1.0.3" uuid "^9.0.1" -"@noble/curves@1.2.0": +"@multiformats/base-x@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@multiformats/base-x/-/base-x-4.0.1.tgz#95ff0fa58711789d53aefb2590a8b7a4e715d121" + integrity sha512-eMk0b9ReBbV23xXU693TAIrLyeO5iTgBZGSJfpqriG8UkYvr/hC9u9pyMlAakDNHWmbhMZCDs6KQO0jzKD8OTw== + +"@noble/curves@1.2.0", "@noble/curves@1.4.2", "@noble/curves@~1.2.0", "@noble/curves@~1.4.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== dependencies: "@noble/hashes" "1.3.2" -"@noble/curves@1.3.0", "@noble/curves@~1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.3.0.tgz#01be46da4fd195822dab821e72f71bf4aeec635e" - integrity sha512-t01iSXPuN+Eqzb4eBX0S5oubSqXbK/xXa1Ne18Hj8f9pStxztHCE2gfboSp/dZRLSqfuLpRK2nDXDK+W9puocA== - dependencies: - "@noble/hashes" "1.3.3" - -"@noble/hashes@1.3.2": +"@noble/hashes@1.2.0", "@noble/hashes@1.3.2", "@noble/hashes@1.4.0", "@noble/hashes@^1.3.1", "@noble/hashes@^1.4.0", "@noble/hashes@~1.2.0", "@noble/hashes@~1.3.0", "@noble/hashes@~1.3.2", "@noble/hashes@~1.4.0": version "1.3.2" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== -"@noble/hashes@1.3.3", "@noble/hashes@~1.3.2": - version "1.3.3" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.3.tgz#39908da56a4adc270147bb07968bf3b16cfe1699" - integrity sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA== - -"@noble/hashes@^1.3.1": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426" - integrity sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg== +"@noble/secp256k1@1.7.1", "@noble/secp256k1@~1.7.0": + version "1.7.1" + resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.7.1.tgz#b251c70f824ce3ca7f8dc3df08d58f005cc0507c" + integrity sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw== "@nodelib/fs.scandir@2.1.5": version "2.1.5" @@ -705,6 +925,220 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" +"@nolyfill/is-core-module@1.0.39": + version "1.0.39" + resolved "https://registry.yarnpkg.com/@nolyfill/is-core-module/-/is-core-module-1.0.39.tgz#3dc35ba0f1e66b403c00b39344f870298ebb1c8e" + integrity sha512-nn5ozdjYQpUCZlWGuxcJY/KpxkWQs4DcbMCmKojjyrYDEAGy4Ce19NN4v5MduafTwJlbKc99UA8YhSVqq9yPZA== + +"@nomicfoundation/edr-darwin-arm64@0.6.4": + version "0.6.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.6.4.tgz#6eaa64a6ea5201e4c92b121f2b7fd197b26e450a" + integrity sha512-QNQErISLgssV9+qia8sIjRANqtbW8snSDvjspixT/kSQ5ZSGxxctTg7x72wPSrcu8+EBEveIe5uqENIp5GH8HQ== + +"@nomicfoundation/edr-darwin-x64@0.6.4": + version "0.6.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.6.4.tgz#d15ca89e9deef7d0a710cf90e79f3cc270a5a999" + integrity sha512-cjVmREiwByyc9+oGfvAh49IAw+oVJHF9WWYRD+Tm/ZlSpnEVWxrGNBak2bd/JSYjn+mZE7gmWS4SMRi4nKaLUg== + +"@nomicfoundation/edr-linux-arm64-gnu@0.6.4": + version "0.6.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.6.4.tgz#e73c41ca015dfddb5f4cb6cd3d9b2cbe5cc28989" + integrity sha512-96o9kRIVD6W5VkgKvUOGpWyUGInVQ5BRlME2Fa36YoNsRQMaKtmYJEU0ACosYES6ZTpYC8U5sjMulvPtVoEfOA== + +"@nomicfoundation/edr-linux-arm64-musl@0.6.4": + version "0.6.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.6.4.tgz#90906f733e4ad26657baeb22d28855d934ab7541" + integrity sha512-+JVEW9e5plHrUfQlSgkEj/UONrIU6rADTEk+Yp9pbe+mzNkJdfJYhs5JYiLQRP4OjxH4QOrXI97bKU6FcEbt5Q== + +"@nomicfoundation/edr-linux-x64-gnu@0.6.4": + version "0.6.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.6.4.tgz#11b8bd73df145a192e5a08199e5e81995fcde502" + integrity sha512-nzYWW+fO3EZItOeP4CrdMgDXfaGBIBkKg0Y/7ySpUxLqzut40O4Mb0/+quqLAFkacUSWMlFp8nsmypJfOH5zoA== + +"@nomicfoundation/edr-linux-x64-musl@0.6.4": + version "0.6.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.6.4.tgz#a34b9a2c9e34853207824dc81622668a069ca642" + integrity sha512-QFRoE9qSQ2boRrVeQ1HdzU+XN7NUgwZ1SIy5DQt4d7jCP+5qTNsq8LBNcqhRBOATgO63nsweNUhxX/Suj5r1Sw== + +"@nomicfoundation/edr-win32-x64-msvc@0.6.4": + version "0.6.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.6.4.tgz#ca035c6f66ae9f88fa3ef123a1f3a2099cce7a5a" + integrity sha512-2yopjelNkkCvIjUgBGhrn153IBPLwnsDeNiq6oA0WkeM8tGmQi4td+PGi9jAriUDAkc59Yoi2q9hYA6efiY7Zw== + +"@nomicfoundation/edr@^0.6.4": + version "0.6.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr/-/edr-0.6.4.tgz#1cd336c46a60f5af774e6cf0f1943f49f63dded6" + integrity sha512-YgrSuT3yo5ZQkbvBGqQ7hG+RDvz3YygSkddg4tb1Z0Y6pLXFzwrcEwWaJCFAVeeZxdxGfCgGMUYgRVneK+WXkw== + dependencies: + "@nomicfoundation/edr-darwin-arm64" "0.6.4" + "@nomicfoundation/edr-darwin-x64" "0.6.4" + "@nomicfoundation/edr-linux-arm64-gnu" "0.6.4" + "@nomicfoundation/edr-linux-arm64-musl" "0.6.4" + "@nomicfoundation/edr-linux-x64-gnu" "0.6.4" + "@nomicfoundation/edr-linux-x64-musl" "0.6.4" + "@nomicfoundation/edr-win32-x64-msvc" "0.6.4" + +"@nomicfoundation/ethereumjs-common@4.0.4": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-common/-/ethereumjs-common-4.0.4.tgz#9901f513af2d4802da87c66d6f255b510bef5acb" + integrity sha512-9Rgb658lcWsjiicr5GzNCjI1llow/7r0k50dLL95OJ+6iZJcVbi15r3Y0xh2cIO+zgX0WIHcbzIu6FeQf9KPrg== + dependencies: + "@nomicfoundation/ethereumjs-util" "9.0.4" + +"@nomicfoundation/ethereumjs-rlp@5.0.4": + version "5.0.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-rlp/-/ethereumjs-rlp-5.0.4.tgz#66c95256fc3c909f6fb18f6a586475fc9762fa30" + integrity sha512-8H1S3s8F6QueOc/X92SdrA4RDenpiAEqMg5vJH99kcQaCy/a3Q6fgseo75mgWlbanGJXSlAPtnCeG9jvfTYXlw== + +"@nomicfoundation/ethereumjs-tx@5.0.4": + version "5.0.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-tx/-/ethereumjs-tx-5.0.4.tgz#b0ceb58c98cc34367d40a30d255d6315b2f456da" + integrity sha512-Xjv8wAKJGMrP1f0n2PeyfFCCojHd7iS3s/Ab7qzF1S64kxZ8Z22LCMynArYsVqiFx6rzYy548HNVEyI+AYN/kw== + dependencies: + "@nomicfoundation/ethereumjs-common" "4.0.4" + "@nomicfoundation/ethereumjs-rlp" "5.0.4" + "@nomicfoundation/ethereumjs-util" "9.0.4" + ethereum-cryptography "0.1.3" + +"@nomicfoundation/ethereumjs-util@9.0.4": + version "9.0.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-util/-/ethereumjs-util-9.0.4.tgz#84c5274e82018b154244c877b76bc049a4ed7b38" + integrity sha512-sLOzjnSrlx9Bb9EFNtHzK/FJFsfg2re6bsGqinFinH1gCqVfz9YYlXiMWwDM4C/L4ywuHFCYwfKTVr/QHQcU0Q== + dependencies: + "@nomicfoundation/ethereumjs-rlp" "5.0.4" + ethereum-cryptography "0.1.3" + +"@nomicfoundation/hardhat-chai-matchers@^2.0.7": + version "2.0.8" + resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-chai-matchers/-/hardhat-chai-matchers-2.0.8.tgz#9c7cfc4ad0f0a5e9cf16aba8ab668c02f6e273aa" + integrity sha512-Z5PiCXH4xhNLASROlSUOADfhfpfhYO6D7Hn9xp8PddmHey0jq704cr6kfU8TRrQ4PUZbpfsZadPj+pCfZdjPIg== + dependencies: + "@types/chai-as-promised" "^7.1.3" + chai-as-promised "^7.1.1" + deep-eql "^4.0.1" + ordinal "^1.0.3" + +"@nomicfoundation/hardhat-ethers@^3.0.8": + version "3.0.8" + resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-ethers/-/hardhat-ethers-3.0.8.tgz#af078f566373abeb77e11cbe69fe3dd47f8bfc27" + integrity sha512-zhOZ4hdRORls31DTOqg+GmEZM0ujly8GGIuRY7t7szEk2zW/arY1qDug/py8AEktT00v5K+b6RvbVog+va51IA== + dependencies: + debug "^4.1.1" + lodash.isequal "^4.5.0" + +"@nomicfoundation/hardhat-ignition-ethers@^0.15.5": + version "0.15.7" + resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-ignition-ethers/-/hardhat-ignition-ethers-0.15.7.tgz#9abb5d9e027fa2957e1ee3ef4796a5828603c7e0" + integrity sha512-pUZWQeFNMwDe6F/yKIJsCo+87elk/M/Edjp6AnWWIBplRyPa13Nh63+yOqMSSd9Mx9lLuBaEGnYXoI2Uz2wYZA== + +"@nomicfoundation/hardhat-ignition@^0.15.5": + version "0.15.7" + resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-ignition/-/hardhat-ignition-0.15.7.tgz#7e7c159c7da4773e3b23ca5fa8df88439e51952d" + integrity sha512-RFhGazR0/JqHxuuIxjjMmM+nWFqEvA7wcVqcX7vUqqmAIGuok4HhnWQH8aOvBaVguiXvvlFDJL0PIlxmkFgIUg== + dependencies: + "@nomicfoundation/ignition-core" "^0.15.7" + "@nomicfoundation/ignition-ui" "^0.15.7" + chalk "^4.0.0" + debug "^4.3.2" + fs-extra "^10.0.0" + json5 "^2.2.3" + prompts "^2.4.2" + +"@nomicfoundation/hardhat-network-helpers@^1.0.11": + version "1.0.12" + resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-network-helpers/-/hardhat-network-helpers-1.0.12.tgz#2c0abec0c50b75f9d0d71776e49e3b5ef746d289" + integrity sha512-xTNQNI/9xkHvjmCJnJOTyqDSl8uq1rKb2WOVmixQxFtRd7Oa3ecO8zM0cyC2YmOK+jHB9WPZ+F/ijkHg1CoORA== + dependencies: + ethereumjs-util "^7.1.4" + +"@nomicfoundation/hardhat-toolbox@^5.0.0": + version "5.0.0" + resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-toolbox/-/hardhat-toolbox-5.0.0.tgz#165b47f8a3d2bf668cc5d453ce7f496a1156948d" + integrity sha512-FnUtUC5PsakCbwiVNsqlXVIWG5JIb5CEZoSXbJUsEBun22Bivx2jhF1/q9iQbzuaGpJKFQyOhemPB2+XlEE6pQ== + +"@nomicfoundation/hardhat-verify@^2.0.10": + version "2.0.11" + resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-verify/-/hardhat-verify-2.0.11.tgz#4ce12b592e01ee93a81933924609c233ed00d951" + integrity sha512-lGIo4dNjVQFdsiEgZp3KP6ntLiF7xJEJsbNHfSyIiFCyI0Yv0518ElsFtMC5uCuHEChiBBMrib9jWQvHHT+X3Q== + dependencies: + "@ethersproject/abi" "^5.1.2" + "@ethersproject/address" "^5.0.2" + cbor "^8.1.0" + chalk "^2.4.2" + debug "^4.1.1" + lodash.clonedeep "^4.5.0" + semver "^6.3.0" + table "^6.8.0" + undici "^5.14.0" + +"@nomicfoundation/ignition-core@^0.15.5", "@nomicfoundation/ignition-core@^0.15.7": + version "0.15.7" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ignition-core/-/ignition-core-0.15.7.tgz#ce205990f347737537b6a6c744ff1a245a2a3dc7" + integrity sha512-C4/0V/q2gNxKDt88cMr+Oxlf4NINQ7QgmJyciQ1/6UdCRUg+/Pgdgpd3vgGXQVTotq50Q/BU4ofNUAD/8HRqtg== + dependencies: + "@ethersproject/address" "5.6.1" + "@nomicfoundation/solidity-analyzer" "^0.1.1" + cbor "^9.0.0" + debug "^4.3.2" + ethers "^6.7.0" + fs-extra "^10.0.0" + immer "10.0.2" + lodash "4.17.21" + ndjson "2.0.0" + +"@nomicfoundation/ignition-ui@^0.15.7": + version "0.15.7" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ignition-ui/-/ignition-ui-0.15.7.tgz#586371dd25d10360337a7363683dfb229b8c8622" + integrity sha512-pj2LmXylgbHOTNrkFqFrre/FAOjcwYl4VKIKVH/QMMBH/DatbiT8aC5n9o2fbLD8uwlPEesD+uXZuKCE71KFBg== + +"@nomicfoundation/solidity-analyzer-darwin-arm64@0.1.2": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-darwin-arm64/-/solidity-analyzer-darwin-arm64-0.1.2.tgz#3a9c3b20d51360b20affb8f753e756d553d49557" + integrity sha512-JaqcWPDZENCvm++lFFGjrDd8mxtf+CtLd2MiXvMNTBD33dContTZ9TWETwNFwg7JTJT5Q9HEecH7FA+HTSsIUw== + +"@nomicfoundation/solidity-analyzer-darwin-x64@0.1.2": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-darwin-x64/-/solidity-analyzer-darwin-x64-0.1.2.tgz#74dcfabeb4ca373d95bd0d13692f44fcef133c28" + integrity sha512-fZNmVztrSXC03e9RONBT+CiksSeYcxI1wlzqyr0L7hsQlK1fzV+f04g2JtQ1c/Fe74ZwdV6aQBdd6Uwl1052sw== + +"@nomicfoundation/solidity-analyzer-linux-arm64-gnu@0.1.2": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-linux-arm64-gnu/-/solidity-analyzer-linux-arm64-gnu-0.1.2.tgz#4af5849a89e5a8f511acc04f28eb5d4460ba2b6a" + integrity sha512-3d54oc+9ZVBuB6nbp8wHylk4xh0N0Gc+bk+/uJae+rUgbOBwQSfuGIbAZt1wBXs5REkSmynEGcqx6DutoK0tPA== + +"@nomicfoundation/solidity-analyzer-linux-arm64-musl@0.1.2": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-linux-arm64-musl/-/solidity-analyzer-linux-arm64-musl-0.1.2.tgz#54036808a9a327b2ff84446c130a6687ee702a8e" + integrity sha512-iDJfR2qf55vgsg7BtJa7iPiFAsYf2d0Tv/0B+vhtnI16+wfQeTbP7teookbGvAo0eJo7aLLm0xfS/GTkvHIucA== + +"@nomicfoundation/solidity-analyzer-linux-x64-gnu@0.1.2": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-linux-x64-gnu/-/solidity-analyzer-linux-x64-gnu-0.1.2.tgz#466cda0d6e43691986c944b909fc6dbb8cfc594e" + integrity sha512-9dlHMAt5/2cpWyuJ9fQNOUXFB/vgSFORg1jpjX1Mh9hJ/MfZXlDdHQ+DpFCs32Zk5pxRBb07yGvSHk9/fezL+g== + +"@nomicfoundation/solidity-analyzer-linux-x64-musl@0.1.2": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-linux-x64-musl/-/solidity-analyzer-linux-x64-musl-0.1.2.tgz#2b35826987a6e94444140ac92310baa088ee7f94" + integrity sha512-GzzVeeJob3lfrSlDKQw2bRJ8rBf6mEYaWY+gW0JnTDHINA0s2gPR4km5RLIj1xeZZOYz4zRw+AEeYgLRqB2NXg== + +"@nomicfoundation/solidity-analyzer-win32-x64-msvc@0.1.2": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-win32-x64-msvc/-/solidity-analyzer-win32-x64-msvc-0.1.2.tgz#e6363d13b8709ca66f330562337dbc01ce8bbbd9" + integrity sha512-Fdjli4DCcFHb4Zgsz0uEJXZ2K7VEO+w5KVv7HmT7WO10iODdU9csC2az4jrhEsRtiR9Gfd74FlG0NYlw1BMdyA== + +"@nomicfoundation/solidity-analyzer@^0.1.0", "@nomicfoundation/solidity-analyzer@^0.1.1": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer/-/solidity-analyzer-0.1.2.tgz#8bcea7d300157bf3a770a851d9f5c5e2db34ac55" + integrity sha512-q4n32/FNKIhQ3zQGGw5CvPF6GTvDCpYwIf7bEY/dZTZbgfDsHyjJwURxUJf3VQuuJj+fDIFl4+KkBVbw4Ef6jA== + optionalDependencies: + "@nomicfoundation/solidity-analyzer-darwin-arm64" "0.1.2" + "@nomicfoundation/solidity-analyzer-darwin-x64" "0.1.2" + "@nomicfoundation/solidity-analyzer-linux-arm64-gnu" "0.1.2" + "@nomicfoundation/solidity-analyzer-linux-arm64-musl" "0.1.2" + "@nomicfoundation/solidity-analyzer-linux-x64-gnu" "0.1.2" + "@nomicfoundation/solidity-analyzer-linux-x64-musl" "0.1.2" + "@nomicfoundation/solidity-analyzer-win32-x64-msvc" "0.1.2" + "@openzeppelin/contracts-v3@npm:@openzeppelin/contracts@3.2.0-rc.0": version "3.2.0-rc.0" resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-3.2.0-rc.0.tgz#1f39e49df5f7a7b42fd49343ac1d758bbd24b826" @@ -715,22 +1149,28 @@ resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-5.0.2.tgz#b1d03075e49290d06570b2fd42154d76c2a5d210" integrity sha512-ytPc6eLGcHHnapAZ9S+5qsdomhjo6QBHTDRRBFfTxXIpsicMhVPouPgmUPebZZZGX7vt9USA+Z+0M0dSVtSUEA== +"@pkgjs/parseargs@^0.11.0": + version "0.11.0" + resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" + integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== + "@pkgr/core@^0.1.0": version "0.1.1" resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31" integrity sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA== -"@rollup/plugin-commonjs@^25.0.7": - version "25.0.7" - resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-25.0.7.tgz#145cec7589ad952171aeb6a585bbeabd0fd3b4cf" - integrity sha512-nEvcR+LRjEjsaSsc4x3XZfCCvZIaSMenZu/OiwOKGN2UhQpAYI7ru7czFvyWbErlpoGjnSX3D5Ch5FcMA3kRWQ== +"@rollup/plugin-commonjs@^28.0.1": + version "28.0.1" + resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-28.0.1.tgz#e2138e31cc0637676dc3d5cae7739131f7cd565e" + integrity sha512-+tNWdlWKbpB3WgBN7ijjYkq9X5uhjmcvyjEght4NmH5fAU++zfQzAJ6wumLS+dNcvwEZhKx2Z+skY8m7v0wGSA== dependencies: "@rollup/pluginutils" "^5.0.1" commondir "^1.0.1" estree-walker "^2.0.2" - glob "^8.0.3" + fdir "^6.2.0" is-reference "1.2.1" magic-string "^0.30.3" + picomatch "^4.0.2" "@rollup/plugin-json@^6.1.0": version "6.1.0" @@ -739,15 +1179,14 @@ dependencies: "@rollup/pluginutils" "^5.1.0" -"@rollup/plugin-node-resolve@^15.2.3": - version "15.2.3" - resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.2.3.tgz#e5e0b059bd85ca57489492f295ce88c2d4b0daf9" - integrity sha512-j/lym8nf5E21LwBT4Df1VD6hRO2L2iwUeUmP7litikRsVp1H6NWx20NEp0Y7su+7XGc476GnXXc4kFeZNGmaSQ== +"@rollup/plugin-node-resolve@^15.3.0": + version "15.3.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.3.0.tgz#efbb35515c9672e541c08d59caba2eff492a55d5" + integrity sha512-9eO5McEICxMzJpDW9OnMYSv4Sta3hmt7VtBFz5zR9273suNOydOyq/FrGeGy+KsTRFm8w0SLVhzig2ILFT63Ag== dependencies: "@rollup/pluginutils" "^5.0.1" "@types/resolve" "1.20.2" deepmerge "^4.2.2" - is-builtin-module "^3.2.1" is-module "^1.0.0" resolve "^1.22.1" @@ -760,111 +1199,227 @@ estree-walker "^2.0.2" picomatch "^2.3.1" -"@rollup/rollup-android-arm-eabi@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.14.1.tgz#ca0501dd836894216cb9572848c5dde4bfca3bec" - integrity sha512-fH8/o8nSUek8ceQnT7K4EQbSiV7jgkHq81m9lWZFIXjJ7lJzpWXbQFpT/Zh6OZYnpFykvzC3fbEvEAFZu03dPA== +"@rollup/rollup-android-arm-eabi@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.24.0.tgz#1661ff5ea9beb362795304cb916049aba7ac9c54" + integrity sha512-Q6HJd7Y6xdB48x8ZNVDOqsbh2uByBhgK8PiQgPhwkIw/HC/YX5Ghq2mQY5sRMZWHb3VsFkWooUVOZHKr7DmDIA== -"@rollup/rollup-android-arm64@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.14.1.tgz#154ca7e4f815d2e442ffc62ee7f64aee8b2547b0" - integrity sha512-Y/9OHLjzkunF+KGEoJr3heiD5X9OLa8sbT1lm0NYeKyaM3oMhhQFvPB0bNZYJwlq93j8Z6wSxh9+cyKQaxS7PQ== +"@rollup/rollup-android-arm64@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.24.0.tgz#2ffaa91f1b55a0082b8a722525741aadcbd3971e" + integrity sha512-ijLnS1qFId8xhKjT81uBHuuJp2lU4x2yxa4ctFPtG+MqEE6+C5f/+X/bStmxapgmwLwiL3ih122xv8kVARNAZA== -"@rollup/rollup-darwin-arm64@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.14.1.tgz#02b522ab6ccc2c504634651985ff8e657b42c055" - integrity sha512-+kecg3FY84WadgcuSVm6llrABOdQAEbNdnpi5X3UwWiFVhZIZvKgGrF7kmLguvxHNQy+UuRV66cLVl3S+Rkt+Q== +"@rollup/rollup-darwin-arm64@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.24.0.tgz#627007221b24b8cc3063703eee0b9177edf49c1f" + integrity sha512-bIv+X9xeSs1XCk6DVvkO+S/z8/2AMt/2lMqdQbMrmVpgFvXlmde9mLcbQpztXm1tajC3raFDqegsH18HQPMYtA== -"@rollup/rollup-darwin-x64@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.14.1.tgz#217737f9f73de729fdfd7d529afebb6c8283f554" - integrity sha512-2pYRzEjVqq2TB/UNv47BV/8vQiXkFGVmPFwJb+1E0IFFZbIX8/jo1olxqqMbo6xCXf8kabANhp5bzCij2tFLUA== +"@rollup/rollup-darwin-x64@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.24.0.tgz#0605506142b9e796c370d59c5984ae95b9758724" + integrity sha512-X6/nOwoFN7RT2svEQWUsW/5C/fYMBe4fnLK9DQk4SX4mgVBiTA9h64kjUYPvGQ0F/9xwJ5U5UfTbl6BEjaQdBQ== -"@rollup/rollup-linux-arm-gnueabihf@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.14.1.tgz#a87e478ab3f697c7f4e74c8b1cac1e0667f8f4be" - integrity sha512-mS6wQ6Do6/wmrF9aTFVpIJ3/IDXhg1EZcQFYHZLHqw6AzMBjTHWnCG35HxSqUNphh0EHqSM6wRTT8HsL1C0x5g== +"@rollup/rollup-linux-arm-gnueabihf@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.24.0.tgz#62dfd196d4b10c0c2db833897164d2d319ee0cbb" + integrity sha512-0KXvIJQMOImLCVCz9uvvdPgfyWo93aHHp8ui3FrtOP57svqrF/roSSR5pjqL2hcMp0ljeGlU4q9o/rQaAQ3AYA== -"@rollup/rollup-linux-arm64-gnu@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.14.1.tgz#4da6830eca27e5f4ca15f9197e5660952ca185c6" - integrity sha512-p9rGKYkHdFMzhckOTFubfxgyIO1vw//7IIjBBRVzyZebWlzRLeNhqxuSaZ7kCEKVkm/kuC9fVRW9HkC/zNRG2w== +"@rollup/rollup-linux-arm-musleabihf@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.24.0.tgz#53ce72aeb982f1f34b58b380baafaf6a240fddb3" + integrity sha512-it2BW6kKFVh8xk/BnHfakEeoLPv8STIISekpoF+nBgWM4d55CZKc7T4Dx1pEbTnYm/xEKMgy1MNtYuoA8RFIWw== -"@rollup/rollup-linux-arm64-musl@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.14.1.tgz#0b0ed35720aebc8f5e501d370a9ea0f686ead1e0" - integrity sha512-nDY6Yz5xS/Y4M2i9JLQd3Rofh5OR8Bn8qe3Mv/qCVpHFlwtZSBYSPaU4mrGazWkXrdQ98GB//H0BirGR/SKFSw== +"@rollup/rollup-linux-arm64-gnu@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.24.0.tgz#1632990f62a75c74f43e4b14ab3597d7ed416496" + integrity sha512-i0xTLXjqap2eRfulFVlSnM5dEbTVque/3Pi4g2y7cxrs7+a9De42z4XxKLYJ7+OhE3IgxvfQM7vQc43bwTgPwA== -"@rollup/rollup-linux-powerpc64le-gnu@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.14.1.tgz#024ad04d162726f25e62915851f7df69a9677c17" - integrity sha512-im7HE4VBL+aDswvcmfx88Mp1soqL9OBsdDBU8NqDEYtkri0qV0THhQsvZtZeNNlLeCUQ16PZyv7cqutjDF35qw== +"@rollup/rollup-linux-arm64-musl@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.24.0.tgz#8c03a996efb41e257b414b2e0560b7a21f2d9065" + integrity sha512-9E6MKUJhDuDh604Qco5yP/3qn3y7SLXYuiC0Rpr89aMScS2UAmK1wHP2b7KAa1nSjWJc/f/Lc0Wl1L47qjiyQw== -"@rollup/rollup-linux-riscv64-gnu@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.14.1.tgz#180694d1cd069ddbe22022bb5b1bead3b7de581c" - integrity sha512-RWdiHuAxWmzPJgaHJdpvUUlDz8sdQz4P2uv367T2JocdDa98iRw2UjIJ4QxSyt077mXZT2X6pKfT2iYtVEvOFw== +"@rollup/rollup-linux-powerpc64le-gnu@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.24.0.tgz#5b98729628d5bcc8f7f37b58b04d6845f85c7b5d" + integrity sha512-2XFFPJ2XMEiF5Zi2EBf4h73oR1V/lycirxZxHZNc93SqDN/IWhYYSYj8I9381ikUFXZrz2v7r2tOVk2NBwxrWw== -"@rollup/rollup-linux-s390x-gnu@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.14.1.tgz#f7b4e2b0ca49be4e34f9ef0b548c926d94edee87" - integrity sha512-VMgaGQ5zRX6ZqV/fas65/sUGc9cPmsntq2FiGmayW9KMNfWVG/j0BAqImvU4KTeOOgYSf1F+k6at1UfNONuNjA== +"@rollup/rollup-linux-riscv64-gnu@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.24.0.tgz#48e42e41f4cabf3573cfefcb448599c512e22983" + integrity sha512-M3Dg4hlwuntUCdzU7KjYqbbd+BLq3JMAOhCKdBE3TcMGMZbKkDdJ5ivNdehOssMCIokNHFOsv7DO4rlEOfyKpg== -"@rollup/rollup-linux-x64-gnu@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.14.1.tgz#0aaf79e5b9ccf7db3084fe6c3f2d2873a27d5af4" - integrity sha512-9Q7DGjZN+hTdJomaQ3Iub4m6VPu1r94bmK2z3UeWP3dGUecRC54tmVu9vKHTm1bOt3ASoYtEz6JSRLFzrysKlA== +"@rollup/rollup-linux-s390x-gnu@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.24.0.tgz#e0b4f9a966872cb7d3e21b9e412a4b7efd7f0b58" + integrity sha512-mjBaoo4ocxJppTorZVKWFpy1bfFj9FeCMJqzlMQGjpNPY9JwQi7OuS1axzNIk0nMX6jSgy6ZURDZ2w0QW6D56g== -"@rollup/rollup-linux-x64-musl@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.14.1.tgz#38f0a37ca5015eb07dff86a1b6f94279c179f4ed" - integrity sha512-JNEG/Ti55413SsreTguSx0LOVKX902OfXIKVg+TCXO6Gjans/k9O6ww9q3oLGjNDaTLxM+IHFMeXy/0RXL5R/g== +"@rollup/rollup-linux-x64-gnu@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.24.0.tgz#78144741993100f47bd3da72fce215e077ae036b" + integrity sha512-ZXFk7M72R0YYFN5q13niV0B7G8/5dcQ9JDp8keJSfr3GoZeXEoMHP/HlvqROA3OMbMdfr19IjCeNAnPUG93b6A== -"@rollup/rollup-win32-arm64-msvc@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.14.1.tgz#84d48c55740ede42c77373f76e85f368633a0cc3" - integrity sha512-ryS22I9y0mumlLNwDFYZRDFLwWh3aKaC72CWjFcFvxK0U6v/mOkM5Up1bTbCRAhv3kEIwW2ajROegCIQViUCeA== +"@rollup/rollup-linux-x64-musl@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.24.0.tgz#d9fe32971883cd1bd858336bd33a1c3ca6146127" + integrity sha512-w1i+L7kAXZNdYl+vFvzSZy8Y1arS7vMgIy8wusXJzRrPyof5LAb02KGr1PD2EkRcl73kHulIID0M501lN+vobQ== -"@rollup/rollup-win32-ia32-msvc@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.14.1.tgz#c1e0bc39e20e760f0a526ddf14ae0543af796605" - integrity sha512-TdloItiGk+T0mTxKx7Hp279xy30LspMso+GzQvV2maYePMAWdmrzqSNZhUpPj3CGw12aGj57I026PgLCTu8CGg== +"@rollup/rollup-win32-arm64-msvc@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.24.0.tgz#71fa3ea369316db703a909c790743972e98afae5" + integrity sha512-VXBrnPWgBpVDCVY6XF3LEW0pOU51KbaHhccHw6AS6vBWIC60eqsH19DAeeObl+g8nKAz04QFdl/Cefta0xQtUQ== -"@rollup/rollup-win32-x64-msvc@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.14.1.tgz#299eee74b7d87e116083ac5b1ce8dd9434668294" - integrity sha512-wQGI+LY/Py20zdUPq+XCem7JcPOyzIJBm3dli+56DJsQOHbnXZFEwgmnC6el1TPAfC8lBT3m+z69RmLykNUbew== +"@rollup/rollup-win32-ia32-msvc@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.24.0.tgz#653f5989a60658e17d7576a3996deb3902e342e2" + integrity sha512-xrNcGDU0OxVcPTH/8n/ShH4UevZxKIO6HJFK0e15XItZP2UcaiLFd5kiX7hJnqCbSztUF8Qot+JWBC/QXRPYWQ== -"@scure/base@^1.1.3", "@scure/base@~1.1.4": - version "1.1.6" - resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.6.tgz#8ce5d304b436e4c84f896e0550c83e4d88cb917d" - integrity sha512-ok9AWwhcgYuGG3Zfhyqg+zwl+Wn5uE+dwC0NV/2qQkx4dABbb/bx96vWu8NSj+BNjjSjno+JRYRjle1jV08k3g== +"@rollup/rollup-win32-x64-msvc@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.24.0.tgz#0574d7e87b44ee8511d08cc7f914bcb802b70818" + integrity sha512-fbMkAF7fufku0N2dE5TBXcNlg0pt0cJue4xBRE2Qc5Vqikxr4VCgKj/ht6SMdFcOacVA9rqF70APJ8RN/4vMJw== -"@scure/bip32@1.3.3": - version "1.3.3" - resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.3.tgz#a9624991dc8767087c57999a5d79488f48eae6c8" - integrity sha512-LJaN3HwRbfQK0X1xFSi0Q9amqOgzQnnDngIt+ZlsBC3Bm7/nE7K0kwshZHyaru79yIVRv/e1mQAjZyuZG6jOFQ== +"@rtsao/scc@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@rtsao/scc/-/scc-1.1.0.tgz#927dd2fae9bc3361403ac2c7a00c32ddce9ad7e8" + integrity sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g== + +"@scure/base@^1.1.3", "@scure/base@~1.1.0", "@scure/base@~1.1.2", "@scure/base@~1.1.3", "@scure/base@~1.1.6": + version "1.1.9" + resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.9.tgz#e5e142fbbfe251091f9c5f1dd4c834ac04c3dbd1" + integrity sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg== + +"@scure/bip32@1.1.5": + version "1.1.5" + resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.1.5.tgz#d2ccae16dcc2e75bc1d75f5ef3c66a338d1ba300" + integrity sha512-XyNh1rB0SkEqd3tXcXMi+Xe1fvg+kUIcoRIEujP1Jgv7DqW2r9lg3Ah0NkFaCs9sTkQAQA8kw7xiRXzENi9Rtw== dependencies: - "@noble/curves" "~1.3.0" - "@noble/hashes" "~1.3.2" - "@scure/base" "~1.1.4" + "@noble/hashes" "~1.2.0" + "@noble/secp256k1" "~1.7.0" + "@scure/base" "~1.1.0" -"@scure/bip39@1.2.2": - version "1.2.2" - resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.2.2.tgz#f3426813f4ced11a47489cbcf7294aa963966527" - integrity sha512-HYf9TUXG80beW+hGAt3TRM8wU6pQoYur9iNypTROm42dorCGmLnFe3eWjz3gOq6G62H2WRh0FCzAR1PI+29zIA== +"@scure/bip32@1.3.2": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.2.tgz#90e78c027d5e30f0b22c1f8d50ff12f3fb7559f8" + integrity sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA== dependencies: + "@noble/curves" "~1.2.0" "@noble/hashes" "~1.3.2" - "@scure/base" "~1.1.4" + "@scure/base" "~1.1.2" -"@tornado/contracts@^1.0.0": - version "1.0.0" - resolved "https://git.tornado.ws/api/packages/tornado-packages/npm/%40tornado%2Fcontracts/-/1.0.0/contracts-1.0.0.tgz#4ee8aada3d12bca94b641fbb3d6f552ec3838cbe" - integrity sha512-kdYoEV+9Wm6sTpY4x4I1AB1cNYZ5yS/DehDxzv0cq06a6/80vncnpG22gM9CxkKqqsQb40O8yDSPxIDEFFwi3w== +"@scure/bip32@1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.4.0.tgz#4e1f1e196abedcef395b33b9674a042524e20d67" + integrity sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg== + dependencies: + "@noble/curves" "~1.4.0" + "@noble/hashes" "~1.4.0" + "@scure/base" "~1.1.6" + +"@scure/bip39@1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.1.1.tgz#b54557b2e86214319405db819c4b6a370cf340c5" + integrity sha512-t+wDck2rVkh65Hmv280fYdVdY25J9YeEUIgn2LG1WM6gxFkGzcksoDiUkWVpVp3Oex9xGC68JU2dSbUfwZ2jPg== + dependencies: + "@noble/hashes" "~1.2.0" + "@scure/base" "~1.1.0" + +"@scure/bip39@1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.2.1.tgz#5cee8978656b272a917b7871c981e0541ad6ac2a" + integrity sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg== + dependencies: + "@noble/hashes" "~1.3.0" + "@scure/base" "~1.1.0" + +"@scure/bip39@1.3.0": + version "1.3.0" + resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.3.0.tgz#0f258c16823ddd00739461ac31398b4e7d6a18c3" + integrity sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ== + dependencies: + "@noble/hashes" "~1.4.0" + "@scure/base" "~1.1.6" + +"@sentry/core@5.30.0": + version "5.30.0" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.30.0.tgz#6b203664f69e75106ee8b5a2fe1d717379b331f3" + integrity sha512-TmfrII8w1PQZSZgPpUESqjB+jC6MvZJZdLtE/0hZ+SrnKhW3x5WlYLvTXZpcWePYBku7rl2wn1RZu6uT0qCTeg== + dependencies: + "@sentry/hub" "5.30.0" + "@sentry/minimal" "5.30.0" + "@sentry/types" "5.30.0" + "@sentry/utils" "5.30.0" + tslib "^1.9.3" + +"@sentry/hub@5.30.0": + version "5.30.0" + resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-5.30.0.tgz#2453be9b9cb903404366e198bd30c7ca74cdc100" + integrity sha512-2tYrGnzb1gKz2EkMDQcfLrDTvmGcQPuWxLnJKXJvYTQDGLlEvi2tWz1VIHjunmOvJrB5aIQLhm+dcMRwFZDCqQ== + dependencies: + "@sentry/types" "5.30.0" + "@sentry/utils" "5.30.0" + tslib "^1.9.3" + +"@sentry/minimal@5.30.0": + version "5.30.0" + resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-5.30.0.tgz#ce3d3a6a273428e0084adcb800bc12e72d34637b" + integrity sha512-BwWb/owZKtkDX+Sc4zCSTNcvZUq7YcH3uAVlmh/gtR9rmUvbzAA3ewLuB3myi4wWRAMEtny6+J/FN/x+2wn9Xw== + dependencies: + "@sentry/hub" "5.30.0" + "@sentry/types" "5.30.0" + tslib "^1.9.3" + +"@sentry/node@^5.18.1": + version "5.30.0" + resolved "https://registry.yarnpkg.com/@sentry/node/-/node-5.30.0.tgz#4ca479e799b1021285d7fe12ac0858951c11cd48" + integrity sha512-Br5oyVBF0fZo6ZS9bxbJZG4ApAjRqAnqFFurMVJJdunNb80brh7a5Qva2kjhm+U6r9NJAB5OmDyPkA1Qnt+QVg== + dependencies: + "@sentry/core" "5.30.0" + "@sentry/hub" "5.30.0" + "@sentry/tracing" "5.30.0" + "@sentry/types" "5.30.0" + "@sentry/utils" "5.30.0" + cookie "^0.4.1" + https-proxy-agent "^5.0.0" + lru_map "^0.3.3" + tslib "^1.9.3" + +"@sentry/tracing@5.30.0": + version "5.30.0" + resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-5.30.0.tgz#501d21f00c3f3be7f7635d8710da70d9419d4e1f" + integrity sha512-dUFowCr0AIMwiLD7Fs314Mdzcug+gBVo/+NCMyDw8tFxJkwWAKl7Qa2OZxLQ0ZHjakcj1hNKfCQJ9rhyfOl4Aw== + dependencies: + "@sentry/hub" "5.30.0" + "@sentry/minimal" "5.30.0" + "@sentry/types" "5.30.0" + "@sentry/utils" "5.30.0" + tslib "^1.9.3" + +"@sentry/types@5.30.0": + version "5.30.0" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-5.30.0.tgz#19709bbe12a1a0115bc790b8942917da5636f402" + integrity sha512-R8xOqlSTZ+htqrfteCWU5Nk0CDN5ApUTvrlvBuiH1DyP6czDZ4ktbZB0hAgBlVcK0U+qpD3ag3Tqqpa5Q67rPw== + +"@sentry/utils@5.30.0": + version "5.30.0" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-5.30.0.tgz#9a5bd7ccff85ccfe7856d493bffa64cabc41e980" + integrity sha512-zaYmoH0NWWtvnJjC9/CBseXMtKHm/tm40sz3YfJRxeQjyzRqNQPgivpd9R/oDJCYj999mzdW382p/qi2ypjLww== + dependencies: + "@sentry/types" "5.30.0" + tslib "^1.9.3" + +"@solidity-parser/parser@^0.18.0": + version "0.18.0" + resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.18.0.tgz#8e77a02a09ecce957255a2f48c9a7178ec191908" + integrity sha512-yfORGUIPgLck41qyN7nbwJRAx17/jAIXCTanHOJZhB6PJ1iAk/84b/xlsVKFSyNyLXIj0dhppoE0+CRws7wlzA== + +"@tornado/contracts@git+https://git.tornado.ws/tornadocontrib/tornado-contracts.git#1b1d707878c16a3dc60d295299d4f0e7ce6ba831": + version "1.0.2" + resolved "git+https://git.tornado.ws/tornadocontrib/tornado-contracts.git#1b1d707878c16a3dc60d295299d4f0e7ce6ba831" dependencies: "@openzeppelin/contracts" "5.0.2" "@openzeppelin/contracts-v3" "npm:@openzeppelin/contracts@3.2.0-rc.0" - ethers "^6.4.0" + ethers "^6.13.4" "@tornado/fixed-merkle-tree@^0.7.3": version "0.7.3" @@ -891,6 +1446,26 @@ "@tornado/snarkjs" "^0.1.20" big-integer "1.6.42" +"@tsconfig/node10@^1.0.7": + version "1.0.11" + resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.11.tgz#6ee46400685f130e278128c7b38b7e031ff5b2f2" + integrity sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw== + +"@tsconfig/node12@^1.0.7": + version "1.0.11" + resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d" + integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== + +"@tsconfig/node14@^1.0.0": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" + integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== + +"@tsconfig/node16@^1.0.2": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9" + integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA== + "@typechain/ethers-v6@^0.5.1": version "0.5.1" resolved "https://registry.yarnpkg.com/@typechain/ethers-v6/-/ethers-v6-0.5.1.tgz#42fe214a19a8b687086c93189b301e2b878797ea" @@ -899,13 +1474,44 @@ lodash "^4.17.15" ts-essentials "^7.0.1" -"@types/bn.js@^5.1.5": - version "5.1.5" - resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.5.tgz#2e0dacdcce2c0f16b905d20ff87aedbc6f7b4bf0" - integrity sha512-V46N0zwKRF5Q00AZ6hWtN0T8gGmDUaUzLWQvHFo5yThtVwK/VCenFY3wXVbOvNfajEpsTfQM4IN9k/d6gUVX3A== +"@typechain/hardhat@^9.1.0": + version "9.1.0" + resolved "https://registry.yarnpkg.com/@typechain/hardhat/-/hardhat-9.1.0.tgz#6985015f01dfb37ef2ca8a29c742d05890351ddc" + integrity sha512-mtaUlzLlkqTlfPwB3FORdejqBskSnh+Jl8AIJGjXNAQfRQ4ofHADPl1+oU7Z3pAJzmZbUXII8MhOLQltcHgKnA== + dependencies: + fs-extra "^9.1.0" + +"@types/bn.js@^4.11.3": + version "4.11.6" + resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-4.11.6.tgz#c306c70d9358aaea33cd4eda092a742b9505967c" + integrity sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg== dependencies: "@types/node" "*" +"@types/bn.js@^5.1.0", "@types/bn.js@^5.1.6": + version "5.1.6" + resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.6.tgz#9ba818eec0c85e4d3c679518428afdf611d03203" + integrity sha512-Xh8vSwUeMKeYYrj3cX4lGQgFSF/N03r+tv4AiLl1SucqV+uTQpxRcnM8AkXKHwYP9ZPXOYXRr2KPXpVlIvqh9w== + dependencies: + "@types/node" "*" + +"@types/chai-as-promised@^7.1.3": + version "7.1.8" + resolved "https://registry.yarnpkg.com/@types/chai-as-promised/-/chai-as-promised-7.1.8.tgz#f2b3d82d53c59626b5d6bbc087667ccb4b677fe9" + integrity sha512-ThlRVIJhr69FLlh6IctTXFkmhtP3NpMZ2QGq69StYLyKZFp/HOp1VdKZj7RvfNWYYcJ1xlbLGLLWj1UvP5u/Gw== + dependencies: + "@types/chai" "*" + +"@types/chai@*": + version "5.0.0" + resolved "https://registry.yarnpkg.com/@types/chai/-/chai-5.0.0.tgz#7f981e71e69c9b2d422f58f78de1c59179782133" + integrity sha512-+DwhEHAaFPPdJ2ral3kNHFQXnTfscEEFsUxzD+d7nlcLrFK23JtNjH71RGasTcHb88b4vVi4mTyfpf8u2L8bdA== + +"@types/chai@^4.2.0": + version "4.3.20" + resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.20.tgz#cb291577ed342ca92600430841a00329ba05cecc" + integrity sha512-/pC9HAB5I/xMlc5FP77qjCnI16ChlJfW0tGa0IUcFn38VJrTV6DeZ60NU5KZBtaOZqjdpwTWohz5HU1RrhiYxQ== + "@types/circomlibjs@^0.1.6": version "0.1.6" resolved "https://registry.yarnpkg.com/@types/circomlibjs/-/circomlibjs-0.1.6.tgz#dba1b9cc68ae4f75da045b8b14c50f3444b31d7f" @@ -918,28 +1524,25 @@ dependencies: "@types/ms" "*" -"@types/eslint-scope@^3.7.3": - version "3.7.7" - resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.7.tgz#3108bd5f18b0cdb277c867b3dd449c9ed7079ac5" - integrity sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg== +"@types/estree@*", "@types/estree@1.0.6", "@types/estree@^1.0.0", "@types/estree@^1.0.5": + version "1.0.6" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.6.tgz#628effeeae2064a1b4e79f78e81d87b7e5fc7b50" + integrity sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw== + +"@types/glob-to-regexp@^0.4.4": + version "0.4.4" + resolved "https://registry.yarnpkg.com/@types/glob-to-regexp/-/glob-to-regexp-0.4.4.tgz#409e71290253203185b1ea8a3d6ea406a4bdc902" + integrity sha512-nDKoaKJYbnn1MZxUY0cA1bPmmgZbg0cTq7Rh13d0KWYNOiKbqoR+2d89SnRPszGh7ROzSwZ/GOjZ4jPbmmZ6Eg== + +"@types/glob@^7.1.1": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.2.0.tgz#bc1b5bf3aa92f25bd5dd39f35c57361bdce5b2eb" + integrity sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA== dependencies: - "@types/eslint" "*" - "@types/estree" "*" + "@types/minimatch" "*" + "@types/node" "*" -"@types/eslint@*": - version "8.56.10" - resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.56.10.tgz#eb2370a73bf04a901eeba8f22595c7ee0f7eb58d" - integrity sha512-Shavhk87gCtY2fhXDctcfS3e6FdxWkCx1iUZ9eEUbh7rTqlZT0/IzOkCOVt0fCjcFuZ9FPYfuezTBImfHCDBGQ== - dependencies: - "@types/estree" "*" - "@types/json-schema" "*" - -"@types/estree@*", "@types/estree@1.0.5", "@types/estree@^1.0.0", "@types/estree@^1.0.5": - version "1.0.5" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4" - integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw== - -"@types/json-schema@*", "@types/json-schema@^7.0.15", "@types/json-schema@^7.0.8": +"@types/json-schema@^7.0.8": version "7.0.15" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== @@ -949,6 +1552,21 @@ resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== +"@types/lru-cache@^5.1.0": + version "5.1.1" + resolved "https://registry.yarnpkg.com/@types/lru-cache/-/lru-cache-5.1.1.tgz#c48c2e27b65d2a153b19bfc1a317e30872e01eef" + integrity sha512-ssE3Vlrys7sdIzs5LOxCzTVMsU7i9oa/IaW92wF32JFb3CVczqOkru2xspuKczHEbG3nvmPY7IFqVmGGHdNbYw== + +"@types/minimatch@*": + version "5.1.2" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" + integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== + +"@types/mocha@^10.0.9": + version "10.0.9" + resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-10.0.9.tgz#101e9da88d2c02e5ac8952982c23b224524d662a" + integrity sha512-sicdRoWtYevwxjOHNMPTl3vSfJM6oyW8o1wXeI7uww6b6xHg8eBznQDNSGBCDJmsE8UMxP05JgZRtsKbTqt//Q== + "@types/ms@*": version "0.7.34" resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.34.tgz#10964ba0dee6ac4cd462e2795b6bebd407303433" @@ -962,17 +1580,33 @@ "@types/node" "*" form-data "^4.0.0" -"@types/node@*", "@types/node@^20.12.5": - version "20.12.5" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.5.tgz#74c4f31ab17955d0b5808cdc8fd2839526ad00b3" - integrity sha512-BD+BjQ9LS/D8ST9p5uqBxghlN+S42iuNxjsUGjeZobe/ciXzk2qb1B6IXc6AnRLS+yFJRpN2IPEHMzwspfDJNw== +"@types/node@*": + version "22.5.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.5.5.tgz#52f939dd0f65fc552a4ad0b392f3c466cc5d7a44" + integrity sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA== dependencies: - undici-types "~5.26.4" + undici-types "~6.19.2" -"@types/node@18.15.13": - version "18.15.13" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.13.tgz#f64277c341150c979e42b00e4ac289290c9df469" - integrity sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q== +"@types/node@22.7.5": + version "22.7.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.5.tgz#cfde981727a7ab3611a481510b473ae54442b92b" + integrity sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ== + dependencies: + undici-types "~6.19.2" + +"@types/node@^22.8.0": + version "22.8.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.8.0.tgz#193c6f82f9356ce0e6bba86b59f2ffe06e7e320b" + integrity sha512-84rafSBHC/z1i1E3p0cJwKA+CfYDNSXX9WSZBRopjIzLET8oNt6ht2tei4C7izwDeEiLLfdeSVBv1egOH916hg== + dependencies: + undici-types "~6.19.8" + +"@types/pbkdf2@^3.0.0": + version "3.1.2" + resolved "https://registry.yarnpkg.com/@types/pbkdf2/-/pbkdf2-3.1.2.tgz#2dc43808e9985a2c69ff02e2d2027bd4fe33e8dc" + integrity sha512-uRwJqmiXmh9++aSu1VNEn3iIxWOhd8AHXNSdlaLfdAAdSTY9jYVeGWnzejM3dvrkbqE3/hyQkQQ29IFATEGlew== + dependencies: + "@types/node" "*" "@types/prettier@^2.1.1": version "2.7.3" @@ -984,95 +1618,92 @@ resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.20.2.tgz#97d26e00cd4a0423b4af620abecf3e6f442b7975" integrity sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q== -"@types/semver@^7.5.8": - version "7.5.8" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e" - integrity sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ== +"@types/secp256k1@^4.0.1": + version "4.0.6" + resolved "https://registry.yarnpkg.com/@types/secp256k1/-/secp256k1-4.0.6.tgz#d60ba2349a51c2cbc5e816dcd831a42029d376bf" + integrity sha512-hHxJU6PAEUn0TP4S/ZOzuTUvJWuZ6eIKeNKb5RBpODvSl6hp1Wrw4s7ATY50rklRCScUDpHzVA/DQdSjJ3UoYQ== + dependencies: + "@types/node" "*" -"@typescript-eslint/eslint-plugin@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.6.0.tgz#1f5df5cda490a0bcb6fbdd3382e19f1241024242" - integrity sha512-gKmTNwZnblUdnTIJu3e9kmeRRzV2j1a/LUO27KNNAnIC5zjy1aSvXSRp4rVNlmAoHlQ7HzX42NbKpcSr4jF80A== +"@typescript-eslint/eslint-plugin@^8.11.0": + version "8.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.11.0.tgz#c3f087d20715fa94310b30666c08b3349e0ab084" + integrity sha512-KhGn2LjW1PJT2A/GfDpiyOfS4a8xHQv2myUagTM5+zsormOmBlYsnQ6pobJ8XxJmh6hnHwa2Mbe3fPrDJoDhbA== dependencies: "@eslint-community/regexpp" "^4.10.0" - "@typescript-eslint/scope-manager" "7.6.0" - "@typescript-eslint/type-utils" "7.6.0" - "@typescript-eslint/utils" "7.6.0" - "@typescript-eslint/visitor-keys" "7.6.0" - debug "^4.3.4" + "@typescript-eslint/scope-manager" "8.11.0" + "@typescript-eslint/type-utils" "8.11.0" + "@typescript-eslint/utils" "8.11.0" + "@typescript-eslint/visitor-keys" "8.11.0" graphemer "^1.4.0" ignore "^5.3.1" natural-compare "^1.4.0" - semver "^7.6.0" ts-api-utils "^1.3.0" -"@typescript-eslint/parser@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-7.6.0.tgz#0aca5de3045d68b36e88903d15addaf13d040a95" - integrity sha512-usPMPHcwX3ZoPWnBnhhorc14NJw9J4HpSXQX4urF2TPKG0au0XhJoZyX62fmvdHONUkmyUe74Hzm1//XA+BoYg== +"@typescript-eslint/parser@^8.11.0": + version "8.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.11.0.tgz#2ad1481388dc1c937f50b2d138c9ca57cc6c5cce" + integrity sha512-lmt73NeHdy1Q/2ul295Qy3uninSqi6wQI18XwSpm8w0ZbQXUpjCAWP1Vlv/obudoBiIjJVjlztjQ+d/Md98Yxg== dependencies: - "@typescript-eslint/scope-manager" "7.6.0" - "@typescript-eslint/types" "7.6.0" - "@typescript-eslint/typescript-estree" "7.6.0" - "@typescript-eslint/visitor-keys" "7.6.0" + "@typescript-eslint/scope-manager" "8.11.0" + "@typescript-eslint/types" "8.11.0" + "@typescript-eslint/typescript-estree" "8.11.0" + "@typescript-eslint/visitor-keys" "8.11.0" debug "^4.3.4" -"@typescript-eslint/scope-manager@7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-7.6.0.tgz#1e9972f654210bd7500b31feadb61a233f5b5e9d" - integrity sha512-ngttyfExA5PsHSx0rdFgnADMYQi+Zkeiv4/ZxGYUWd0nLs63Ha0ksmp8VMxAIC0wtCFxMos7Lt3PszJssG/E6w== +"@typescript-eslint/scope-manager@8.11.0": + version "8.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.11.0.tgz#9d399ce624118966732824878bc9a83593a30405" + integrity sha512-Uholz7tWhXmA4r6epo+vaeV7yjdKy5QFCERMjs1kMVsLRKIrSdM6o21W2He9ftp5PP6aWOVpD5zvrvuHZC0bMQ== dependencies: - "@typescript-eslint/types" "7.6.0" - "@typescript-eslint/visitor-keys" "7.6.0" + "@typescript-eslint/types" "8.11.0" + "@typescript-eslint/visitor-keys" "8.11.0" -"@typescript-eslint/type-utils@7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-7.6.0.tgz#644f75075f379827d25fe0713e252ccd4e4a428c" - integrity sha512-NxAfqAPNLG6LTmy7uZgpK8KcuiS2NZD/HlThPXQRGwz6u7MDBWRVliEEl1Gj6U7++kVJTpehkhZzCJLMK66Scw== +"@typescript-eslint/type-utils@8.11.0": + version "8.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-8.11.0.tgz#b7f9e6120c1ddee8a1a07615646642ad85fc91b5" + integrity sha512-ItiMfJS6pQU0NIKAaybBKkuVzo6IdnAhPFZA/2Mba/uBjuPQPet/8+zh5GtLHwmuFRShZx+8lhIs7/QeDHflOg== dependencies: - "@typescript-eslint/typescript-estree" "7.6.0" - "@typescript-eslint/utils" "7.6.0" + "@typescript-eslint/typescript-estree" "8.11.0" + "@typescript-eslint/utils" "8.11.0" debug "^4.3.4" ts-api-utils "^1.3.0" -"@typescript-eslint/types@7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.6.0.tgz#53dba7c30c87e5f10a731054266dd905f1fbae38" - integrity sha512-h02rYQn8J+MureCvHVVzhl69/GAfQGPQZmOMjG1KfCl7o3HtMSlPaPUAPu6lLctXI5ySRGIYk94clD/AUMCUgQ== +"@typescript-eslint/types@8.11.0": + version "8.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.11.0.tgz#7c766250502097f49bbc2e651132e6bf489e20b8" + integrity sha512-tn6sNMHf6EBAYMvmPUaKaVeYvhUsrE6x+bXQTxjQRp360h1giATU0WvgeEys1spbvb5R+VpNOZ+XJmjD8wOUHw== -"@typescript-eslint/typescript-estree@7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-7.6.0.tgz#112a3775563799fd3f011890ac8322f80830ac17" - integrity sha512-+7Y/GP9VuYibecrCQWSKgl3GvUM5cILRttpWtnAu8GNL9j11e4tbuGZmZjJ8ejnKYyBRb2ddGQ3rEFCq3QjMJw== +"@typescript-eslint/typescript-estree@8.11.0": + version "8.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.11.0.tgz#35fe5d3636fc5727c52429393415412e552e222b" + integrity sha512-yHC3s1z1RCHoCz5t06gf7jH24rr3vns08XXhfEqzYpd6Hll3z/3g23JRi0jM8A47UFKNc3u/y5KIMx8Ynbjohg== dependencies: - "@typescript-eslint/types" "7.6.0" - "@typescript-eslint/visitor-keys" "7.6.0" + "@typescript-eslint/types" "8.11.0" + "@typescript-eslint/visitor-keys" "8.11.0" debug "^4.3.4" - globby "^11.1.0" + fast-glob "^3.3.2" is-glob "^4.0.3" minimatch "^9.0.4" semver "^7.6.0" ts-api-utils "^1.3.0" -"@typescript-eslint/utils@7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-7.6.0.tgz#e400d782280b6f724c8a1204269d984c79202282" - integrity sha512-x54gaSsRRI+Nwz59TXpCsr6harB98qjXYzsRxGqvA5Ue3kQH+FxS7FYU81g/omn22ML2pZJkisy6Q+ElK8pBCA== +"@typescript-eslint/utils@8.11.0": + version "8.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.11.0.tgz#4480d1e9f2bb18ea3510c79f870a1aefc118103d" + integrity sha512-CYiX6WZcbXNJV7UNB4PLDIBtSdRmRI/nb0FMyqHPTQD1rMjA0foPLaPUV39C/MxkTd/QKSeX+Gb34PPsDVC35g== dependencies: "@eslint-community/eslint-utils" "^4.4.0" - "@types/json-schema" "^7.0.15" - "@types/semver" "^7.5.8" - "@typescript-eslint/scope-manager" "7.6.0" - "@typescript-eslint/types" "7.6.0" - "@typescript-eslint/typescript-estree" "7.6.0" - semver "^7.6.0" + "@typescript-eslint/scope-manager" "8.11.0" + "@typescript-eslint/types" "8.11.0" + "@typescript-eslint/typescript-estree" "8.11.0" -"@typescript-eslint/visitor-keys@7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-7.6.0.tgz#d1ce13145844379021e1f9bd102c1d78946f4e76" - integrity sha512-4eLB7t+LlNUmXzfOu1VAIAdkjbu5xNSerURS9X/S5TUKWFRpXRQZbmtPqgKmYx8bj3J0irtQXSiWAOY82v+cgw== +"@typescript-eslint/visitor-keys@8.11.0": + version "8.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.11.0.tgz#273de1cbffe63d9f9cd7dfc20b5a5af66310cb92" + integrity sha512-EaewX6lxSjRJnc+99+dqzTeoDZUfyrA52d2/HRrkI830kgovWsmIiTfmr0NZorzqic7ga+1bS60lRBUgR3n/Bw== dependencies: - "@typescript-eslint/types" "7.6.0" + "@typescript-eslint/types" "8.11.0" eslint-visitor-keys "^3.4.3" "@ungap/structured-clone@^1.2.0": @@ -1226,6 +1857,26 @@ resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d" integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== +"@zxing/text-encoding@0.9.0": + version "0.9.0" + resolved "https://registry.yarnpkg.com/@zxing/text-encoding/-/text-encoding-0.9.0.tgz#fb50ffabc6c7c66a0c96b4c03e3d9be74864b70b" + integrity sha512-U/4aVJ2mxI0aDNI8Uq0wEhMgY+u4CNtEb0om3+y3+niDAsoTCOB33UF0sxpzqzdqXLqmvc+vZyAt4O8pPdfkwA== + +abbrev@1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" + integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== + +abbrev@1.0.x: + version "1.0.9" + resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135" + integrity sha512-LEyx4aLEC3x6T0UguF6YILf+ntvmOaWsVfENmIW0E9H09vKlLDGelMjjSm0jkDHALj8A8quZ/HapKNigzwge+Q== + +abitype@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/abitype/-/abitype-1.0.0.tgz#237176dace81d90d018bebf3a45cb42f2a2d9e97" + integrity sha512-NMeMah//6bJ56H5XRj8QCV4AwuW6hB6zqz2LnhhLdcWVQOsXki6/Pn3APeqxCma62nXIcmZWdu1DlHWS74umVQ== + abort-controller@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" @@ -1233,25 +1884,42 @@ abort-controller@^3.0.0: dependencies: event-target-shim "^5.0.0" -acorn-import-assertions@^1.9.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/acorn-import-assertions/-/acorn-import-assertions-1.9.0.tgz#507276249d684797c84e0734ef84860334cfb1ac" - integrity sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA== +acorn-import-attributes@^1.9.5: + version "1.9.5" + resolved "https://registry.yarnpkg.com/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz#7eb1557b1ba05ef18b5ed0ec67591bfab04688ef" + integrity sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ== acorn-jsx@^5.0.0, acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== +acorn-walk@^8.1.1: + version "8.3.4" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.4.tgz#794dd169c3977edf4ba4ea47583587c5866236b7" + integrity sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g== + dependencies: + acorn "^8.11.0" + acorn@^6.0.7: version "6.4.2" resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.2.tgz#35866fd710528e92de10cf06016498e47e39e1e6" integrity sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ== +acorn@^8.11.0, acorn@^8.4.1: + version "8.13.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.13.0.tgz#2a30d670818ad16ddd6a35d3842dacec9e5d7ca3" + integrity sha512-8zSiw54Oxrdym50NlZ9sUusyO1Z1ZchgRLWRaK6c86XJFClyCgFKetdowBg5bKxyp/u+CDBJG4Mpp0m3HLZl9w== + acorn@^8.7.1, acorn@^8.8.2, acorn@^8.9.0: - version "8.11.3" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a" - integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg== + version "8.12.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.1.tgz#71616bdccbe25e27a54439e0046e89ca76df2248" + integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg== + +adm-zip@^0.4.16: + version "0.4.16" + resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.4.16.tgz#cf4c508fdffab02c269cbc7f471a875f05570365" + integrity sha512-TFi4HBKSGfIKsK5YCkKaaFG2m4PEDyViZmEwof3MTIgzimHLto6muaHVpbrljdIvIrFZzEq/p4nafOeLcYegrg== aes-js@3.0.0: version "3.0.0" @@ -1263,6 +1931,21 @@ aes-js@4.0.0-beta.5: resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-4.0.0-beta.5.tgz#8d2452c52adedebc3a3e28465d858c11ca315873" integrity sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q== +agent-base@6: + version "6.0.2" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" + integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== + dependencies: + debug "4" + +aggregate-error@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a" + integrity sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA== + dependencies: + clean-stack "^2.0.0" + indent-string "^4.0.0" + ajv-keywords@^3.5.2: version "3.5.2" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz#31f29da5ab6e00d1c2d329acf7b5929614d5014d" @@ -1278,35 +1961,44 @@ ajv@^6.10.2, ajv@^6.12.4, ajv@^6.12.5, ajv@^6.9.1: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ajv@^8.12.0: - version "8.12.0" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.12.0.tgz#d1a0527323e22f53562c567c00991577dfbe19d1" - integrity sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA== +ajv@^8.0.1, ajv@^8.17.1: + version "8.17.1" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.17.1.tgz#37d9a5c776af6bc92d7f4f9510eba4c0a60d11a6" + integrity sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g== dependencies: - fast-deep-equal "^3.1.1" + fast-deep-equal "^3.1.3" + fast-uri "^3.0.1" json-schema-traverse "^1.0.0" require-from-string "^2.0.2" - uri-js "^4.2.2" + +amdefine@>=0.0.4: + version "1.0.1" + resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" + integrity sha512-S2Hw0TtNkMJhIabBwIojKL9YHO5T0n5eNqWJ7Lrlel/zDbftQpxpapi8tZs3X1HWa+u+QeydGmzzNU0m09+Rcg== + +ansi-align@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-3.0.1.tgz#0cdf12e111ace773a86e9a1fad1225c43cb19a59" + integrity sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w== + dependencies: + string-width "^4.1.0" + +ansi-colors@^4.1.1, ansi-colors@^4.1.3: + version "4.1.3" + resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b" + integrity sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw== ansi-escapes@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== -ansi-regex@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - integrity sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA== - -ansi-regex@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.1.tgz#123d6479e92ad45ad897d4054e3c7ca7db4944e1" - integrity sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw== - -ansi-regex@^4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.1.tgz#164daac87ab2d6f6db3a29875e2d1766582dabed" - integrity sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g== +ansi-escapes@^4.3.0: + version "4.3.2" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" + integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== + dependencies: + type-fest "^0.21.3" ansi-regex@^5.0.1: version "5.0.1" @@ -1320,13 +2012,43 @@ ansi-styles@^3.2.0, ansi-styles@^3.2.1: dependencies: color-convert "^1.9.0" -ansi-styles@^4.1.0: +ansi-styles@^4.0.0, ansi-styles@^4.1.0: version "4.3.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== dependencies: color-convert "^2.0.1" +ansi-styles@^6.1.0: + version "6.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" + integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== + +anymatch@~3.1.2: + version "3.1.3" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" + integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + +append-transform@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-2.0.0.tgz#99d9d29c7b38391e6f428d28ce136551f0b77e12" + integrity sha512-7yeyCEurROLQJFv5Xj4lEGTy0borxepjFv1g22oAdqFu//SrAlDl1O1Nxx15SH1RoliUml6p8dwJW9jvZughhg== + dependencies: + default-require-extensions "^3.0.0" + +archy@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/archy/-/archy-1.0.0.tgz#f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40" + integrity sha512-Xg+9RwCg/0p32teKdGMPTPnVXKD0w3DfHnFTficozsAgsvq2XenPJq/MYpzzQ/v8zrOyJn6Ds39VA4JIDwFfqw== + +arg@^4.1.0: + version "4.1.3" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" + integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== + argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -1357,7 +2079,7 @@ array-buffer-byte-length@^1.0.1: call-bind "^1.0.5" is-array-buffer "^3.0.4" -array-includes@^3.1.7: +array-includes@^3.1.8: version "3.1.8" resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.8.tgz#5e370cbe172fdd5dd6530c1d4aadda25281ba97d" integrity sha512-itaWrbYbqpGXkGhZPGUulwnhVf5Hpy1xiCFsGqyIGglbBxmG5vSjxQen3/WGOjPpNEv1RtBLKxbmVXm8HpJStQ== @@ -1374,7 +2096,7 @@ array-union@^2.1.0: resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== -array.prototype.findlastindex@^1.2.3: +array.prototype.findlastindex@^1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.5.tgz#8c35a755c72908719453f87145ca011e39334d0d" integrity sha512-zfETvRFA8o7EiNn++N5f/kaCw221hrpGsDmcpndVupkPzEc1Wuf3VgC0qby1BbHs7f5DVYjgtEU2LLh5bqeGfQ== @@ -1450,11 +2172,26 @@ astral-regex@^1.0.0: resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== +astral-regex@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" + integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== + +async@1.x: + version "1.5.2" + resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" + integrity sha512-nSVgobk4rv61R9PUSDtYt7mPVB2olxNR5RWJcAsH676/ef11bUZwvu7+RGYrYauVdDPcO519v68wRhXQtxsV9w== + asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== +at-least-node@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" + integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg== + available-typed-arrays@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz#a5cc375d6a03c2efc87a553f3e0b1522def14846" @@ -1462,6 +2199,15 @@ available-typed-arrays@^1.0.7: dependencies: possible-typed-array-names "^1.0.0" +axios@^1.6.7: + version "1.7.7" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.7.7.tgz#2f554296f9892a72ac8d8e4c5b79c14a91d0a47f" + integrity sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q== + dependencies: + follow-redirects "^1.15.6" + form-data "^4.0.0" + proxy-from-env "^1.1.0" + b4a@^1.0.1: version "1.6.6" resolved "https://registry.yarnpkg.com/b4a/-/b4a-1.6.6.tgz#a4cc349a3851987c3c4ac2d7785c18744f6da9ba" @@ -1472,6 +2218,13 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== +base-x@^3.0.2, base-x@^3.0.8: + version "3.0.10" + resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.10.tgz#62de58653f8762b5d6f8d9fe30fa75f7b2585a75" + integrity sha512-7d0s06rR9rYaIWHkpfLIFICM/tkSVdoPC9qYAQRpxn9DdKNWNsKC0uk++akckyLq16Tx2WIinnZ6WRriAt6njQ== + dependencies: + safe-buffer "^5.0.1" + base64-js@^1.3.1: version "1.5.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" @@ -1497,6 +2250,11 @@ big.js@^5.2.2: resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ== +binary-extensions@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.3.0.tgz#f6e14a97858d327252200242d4ccfe522c445522" + integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== + bindings@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" @@ -1534,16 +2292,35 @@ blakejs@^1.1.0: resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.2.1.tgz#5057e4206eadb4a97f7c0b6e197a505042fc3814" integrity sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ== -bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.9: +bn.js@4.11.6: + version "4.11.6" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.6.tgz#53344adb14617a13f6e8dd2ce28905d1c0ba3215" + integrity sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA== + +bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.0, bn.js@^4.11.8, bn.js@^4.11.9: version "4.12.0" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== -bn.js@^5.0.0, bn.js@^5.2.1: +bn.js@^5.0.0, bn.js@^5.1.2, bn.js@^5.2.0, bn.js@^5.2.1: version "5.2.1" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== +boxen@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/boxen/-/boxen-5.1.2.tgz#788cb686fc83c1f486dfa8a40c68fc2b831d2b50" + integrity sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ== + dependencies: + ansi-align "^3.0.0" + camelcase "^6.2.0" + chalk "^4.1.0" + cli-boxes "^2.2.1" + string-width "^4.2.2" + type-fest "^0.20.2" + widest-line "^3.1.0" + wrap-ansi "^7.0.0" + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -1559,18 +2336,28 @@ brace-expansion@^2.0.1: dependencies: balanced-match "^1.0.0" -braces@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" - integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== +braces@^3.0.3, braces@~3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" + integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== dependencies: - fill-range "^7.0.1" + fill-range "^7.1.1" brorand@^1.0.1, brorand@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" integrity sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w== +brotli-wasm@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/brotli-wasm/-/brotli-wasm-2.0.1.tgz#2b3f4dc3db0c3e60d2635c055e6bac4ddf4bd3f5" + integrity sha512-+3USgYsC7bzb5yU0/p2HnnynZl0ak0E6uoIm4UW4Aby/8s8HFCq6NCfrrf1E9c3O8OCSzq3oYO1tUVqIi61Nww== + +browser-stdout@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" + integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== + browserify-aes@^1.0.4, browserify-aes@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" @@ -1634,14 +2421,40 @@ browserify-zlib@^0.2.0: pako "~1.0.5" browserslist@^4.21.10: - version "4.23.0" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.23.0.tgz#8f3acc2bbe73af7213399430890f86c63a5674ab" - integrity sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ== + version "4.23.3" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.23.3.tgz#debb029d3c93ebc97ffbc8d9cbb03403e227c800" + integrity sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA== dependencies: - caniuse-lite "^1.0.30001587" - electron-to-chromium "^1.4.668" - node-releases "^2.0.14" - update-browserslist-db "^1.0.13" + caniuse-lite "^1.0.30001646" + electron-to-chromium "^1.5.4" + node-releases "^2.0.18" + update-browserslist-db "^1.1.0" + +browserslist@^4.24.0: + version "4.24.2" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.24.2.tgz#f5845bc91069dbd55ee89faf9822e1d885d16580" + integrity sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg== + dependencies: + caniuse-lite "^1.0.30001669" + electron-to-chromium "^1.5.41" + node-releases "^2.0.18" + update-browserslist-db "^1.1.1" + +bs58@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" + integrity sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw== + dependencies: + base-x "^3.0.2" + +bs58check@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" + integrity sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA== + dependencies: + bs58 "^4.0.0" + create-hash "^1.1.0" + safe-buffer "^5.1.2" buffer-from@^1.0.0: version "1.1.2" @@ -1653,6 +2466,14 @@ buffer-xor@^1.0.3: resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" integrity sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ== +buffer@^5.5.0, buffer@^5.6.0: + version "5.7.1" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" + integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.1.13" + buffer@^6.0.3: version "6.0.3" resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" @@ -1661,16 +2482,26 @@ buffer@^6.0.3: base64-js "^1.3.1" ieee754 "^1.2.1" -builtin-modules@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.3.0.tgz#cae62812b89801e9656336e46223e030386be7b6" - integrity sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw== - builtin-status-codes@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" integrity sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ== +bytes@3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" + integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== + +caching-transform@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/caching-transform/-/caching-transform-4.0.0.tgz#00d297a4206d71e2163c39eaffa8157ac0651f0f" + integrity sha512-kpqOvwXnjjN44D89K5ccQC+RUrsy7jB/XLlRrx0D7/2HNcTPqzsb6XgYoErwko6QsV184CA2YgS1fxDiiDZMWA== + dependencies: + hasha "^5.0.0" + make-dir "^3.0.0" + package-hash "^4.0.0" + write-file-atomic "^3.0.0" + call-bind@^1.0.0, call-bind@^1.0.2, call-bind@^1.0.5, call-bind@^1.0.6, call-bind@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.7.tgz#06016599c40c56498c18769d2730be242b6fa3b9" @@ -1687,20 +2518,51 @@ callsites@^3.0.0: resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== -camelcase@^5.0.0: +camelcase@^5.0.0, camelcase@^5.3.1: version "5.3.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -caniuse-lite@^1.0.30001587: - version "1.0.30001612" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001612.tgz#d34248b4ec1f117b70b24ad9ee04c90e0b8a14ae" - integrity sha512-lFgnZ07UhaCcsSZgWW0K5j4e69dK1u/ltrL9lTUiFOwNHs12S3UMIEYgBV0Z6C6hRDev7iRnMzzYmKabYdXF9g== +camelcase@^6.0.0, camelcase@^6.2.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" + integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== + +caniuse-lite@^1.0.30001646: + version "1.0.30001662" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001662.tgz#3574b22dfec54a3f3b6787331da1040fe8e763ec" + integrity sha512-sgMUVwLmGseH8ZIrm1d51UbrhqMCH3jvS7gF/M6byuHOnKyLOBL7W8yz5V02OHwgLGA36o/AFhWzzh4uc5aqTA== + +caniuse-lite@^1.0.30001669: + version "1.0.30001669" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001669.tgz#fda8f1d29a8bfdc42de0c170d7f34a9cf19ed7a3" + integrity sha512-DlWzFDJqstqtIVx1zeSpIMLjunf5SmwOw0N2Ck/QSQdS8PLS4+9HrLaYei4w8BIAL7IB/UEDu889d8vhCTPA0w== + +cbor@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/cbor/-/cbor-8.1.0.tgz#cfc56437e770b73417a2ecbfc9caf6b771af60d5" + integrity sha512-DwGjNW9omn6EwP70aXsn7FQJx5kO12tX0bZkaTjzdVFM6/7nhA4t0EENocKGx6D2Bch9PE2KzCUf5SceBdeijg== + dependencies: + nofilter "^3.1.0" + +cbor@^9.0.0: + version "9.0.2" + resolved "https://registry.yarnpkg.com/cbor/-/cbor-9.0.2.tgz#536b4f2d544411e70ec2b19a2453f10f83cd9fdb" + integrity sha512-JPypkxsB10s9QOWwa6zwPzqE1Md3vqpPc+cai4sAecuCsRyAtAl/pMyhPlMbT/xtPnm2dznJZYRLui57qiRhaQ== + dependencies: + nofilter "^3.1.0" + +chai-as-promised@^7.1.1: + version "7.1.2" + resolved "https://registry.yarnpkg.com/chai-as-promised/-/chai-as-promised-7.1.2.tgz#70cd73b74afd519754161386421fb71832c6d041" + integrity sha512-aBDHZxRzYnUYuIAIPBH2s511DjlKPzXNlXSGFC8CwmroWQLfrW0LtE1nK3MAwwNhJPa9raEjNCmRoFpG0Hurdw== + dependencies: + check-error "^1.0.2" chai@^4.2.0: - version "4.4.1" - resolved "https://registry.yarnpkg.com/chai/-/chai-4.4.1.tgz#3603fa6eba35425b0f2ac91a009fe924106e50d1" - integrity sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g== + version "4.5.0" + resolved "https://registry.yarnpkg.com/chai/-/chai-4.5.0.tgz#707e49923afdd9b13a8b0b47d33d732d13812fd8" + integrity sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw== dependencies: assertion-error "^1.1.0" check-error "^1.0.3" @@ -1708,7 +2570,15 @@ chai@^4.2.0: get-func-name "^2.0.2" loupe "^2.3.6" pathval "^1.1.1" - type-detect "^4.0.8" + type-detect "^4.1.0" + +chalk@4.1.2, chalk@^4.0.0, chalk@^4.1.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" chalk@^2.1.0, chalk@^2.4.2: version "2.4.2" @@ -1719,30 +2589,64 @@ chalk@^2.1.0, chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^4.0.0, chalk@^4.1.0: - version "4.1.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" - integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - chardet@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== -check-error@^1.0.3: +"charenc@>= 0.0.1": + version "0.0.2" + resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667" + integrity sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA== + +check-error@^1.0.2, check-error@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.3.tgz#a6502e4312a7ee969f646e83bb3ddd56281bd694" integrity sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg== dependencies: get-func-name "^2.0.2" +chokidar@^3.5.3: + version "3.6.0" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.6.0.tgz#197c6cc669ef2a8dc5e7b4d97ee4e092c3eb0d5b" + integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw== + dependencies: + anymatch "~3.1.2" + braces "~3.0.2" + glob-parent "~5.1.2" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.6.0" + optionalDependencies: + fsevents "~2.3.2" + +chokidar@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-4.0.1.tgz#4a6dff66798fb0f72a94f616abbd7e1a19f31d41" + integrity sha512-n8enUVCED/KVRQlab1hr3MVpcVMvxtZjmEa956u+4YijlmQED223XMSYj2tLuKvr4jcCTzNNMpQDUer72MMmzA== + dependencies: + readdirp "^4.0.1" + chrome-trace-event@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz#1015eced4741e15d06664a957dbbf50d041e26ac" - integrity sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg== + version "1.0.4" + resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz#05bffd7ff928465093314708c93bdfa9bd1f0f5b" + integrity sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ== + +ci-info@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" + integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== + +cids@^1.1.5: + version "1.1.9" + resolved "https://registry.yarnpkg.com/cids/-/cids-1.1.9.tgz#402c26db5c07059377bcd6fb82f2a24e7f2f4a4f" + integrity sha512-l11hWRfugIcbGuTZwAM5PwpjPPjyb6UZOGwlHSnOBV5o07XhQ4gNpBN67FbODvpjyHtd+0Xs6KNvUcGBiDRsdg== + dependencies: + multibase "^4.0.1" + multicodec "^3.0.1" + multihashes "^4.0.1" + uint8arrays "^3.0.0" cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: version "1.0.4" @@ -1762,6 +2666,16 @@ circomlibjs@0.1.7: ethers "^5.5.1" ffjavascript "^0.2.45" +clean-stack@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" + integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A== + +cli-boxes@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-2.2.1.tgz#ddd5035d25094fce220e9cab40a45840a440318f" + integrity sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw== + cli-cursor@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" @@ -1769,6 +2683,15 @@ cli-cursor@^2.1.0: dependencies: restore-cursor "^2.0.0" +cli-table3@^0.6.3: + version "0.6.5" + resolved "https://registry.yarnpkg.com/cli-table3/-/cli-table3-0.6.5.tgz#013b91351762739c16a9567c21a04632e449bf2f" + integrity sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ== + dependencies: + string-width "^4.2.0" + optionalDependencies: + "@colors/colors" "1.5.0" + cli-width@^2.0.0: version "2.2.1" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.1.tgz#b0433d0b4e9c847ef18868a4ef16fd5fc8271c48" @@ -1783,6 +2706,24 @@ cliui@^4.0.0: strip-ansi "^4.0.0" wrap-ansi "^2.0.0" +cliui@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1" + integrity sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^6.2.0" + +cliui@^7.0.2: + version "7.0.4" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" + integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^7.0.0" + clone-deep@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-4.0.1.tgz#c19fd9bdbbf85942b4fd979c84dcf7d5f07c2387" @@ -1833,6 +2774,11 @@ combined-stream@^1.0.8: dependencies: delayed-stream "~1.0.0" +command-exists@^1.2.8: + version "1.2.9" + resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.9.tgz#c50725af3808c8ab0260fd60b01fbfa25b954f69" + integrity sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w== + command-line-args@^5.1.1: version "5.2.1" resolved "https://registry.yarnpkg.com/command-line-args/-/command-line-args-5.2.1.tgz#c44c32e437a57d7c51157696893c5909e9cec42e" @@ -1863,6 +2809,11 @@ commander@^2.20.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== +commander@^8.1.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" + integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== + commondir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" @@ -1883,6 +2834,21 @@ constants-browserify@^1.0.0: resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" integrity sha512-xFxOwqIzR/e1k1gLiWEophSCMqXcwVHIH7akf7b/vxcUeGunlj3hvZaaqxwHsTgn+IndtkQJgSztIDWeumWJDQ== +convert-source-map@^1.7.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.9.0.tgz#7faae62353fb4213366d0ca98358d22e8368b05f" + integrity sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A== + +convert-source-map@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" + integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== + +cookie@^0.4.1: + version "0.4.2" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.2.tgz#0e41f24de5ecf317947c82fc789e06a884824432" + integrity sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA== + core-util-is@~1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" @@ -1924,6 +2890,11 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7: safe-buffer "^5.0.1" sha.js "^2.4.8" +create-require@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" + integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== + cross-fetch@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-4.0.0.tgz#f037aef1580bb3a1a35164ea2a848ba81b445983" @@ -1942,7 +2913,7 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" -cross-spawn@^7.0.2, cross-spawn@^7.0.3: +cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -1951,6 +2922,11 @@ cross-spawn@^7.0.2, cross-spawn@^7.0.3: shebang-command "^2.0.0" which "^2.0.1" +"crypt@>= 0.0.1": + version "0.0.2" + resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b" + integrity sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow== + crypto-browserify@^3.12.0: version "3.12.0" resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" @@ -1995,6 +2971,18 @@ data-view-byte-offset@^1.0.0: es-errors "^1.3.0" is-data-view "^1.0.1" +death@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/death/-/death-1.1.0.tgz#01aa9c401edd92750514470b8266390c66c67318" + integrity sha512-vsV6S4KVHvTGxbEcij7hkWRv0It+sGGWVOM67dQde/o5Xjnr+KmLjxWJii2uEObIrt1CcM9w0Yaovx+iOlIL+w== + +debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4, debug@^4.3.5: + version "4.3.7" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" + integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== + dependencies: + ms "^2.1.3" + debug@^3.2.7: version "3.2.7" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" @@ -2002,22 +2990,20 @@ debug@^3.2.7: dependencies: ms "^2.1.1" -debug@^4.0.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4: - version "4.3.4" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== - dependencies: - ms "2.1.2" - decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA== -deep-eql@^4.1.3: - version "4.1.3" - resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-4.1.3.tgz#7c7775513092f7df98d8df9996dd085eb668cc6d" - integrity sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw== +decamelize@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" + integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== + +deep-eql@^4.0.1, deep-eql@^4.1.3: + version "4.1.4" + resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-4.1.4.tgz#d0d3912865911bb8fac5afb4e3acfa6a28dc72b7" + integrity sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg== dependencies: type-detect "^4.0.0" @@ -2036,6 +3022,13 @@ deepmerge@^4.2.2: resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== +default-require-extensions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-3.0.1.tgz#bfae00feeaeada68c2ae256c62540f60b80625bd" + integrity sha512-eXTJmRbm2TIt9MgWTsOH1wEuhew6XGZcMeGKCtLedIg/NCsg1iBePXkceTdK4Fii7pzmN9tGsZhKzZ4h7O/fxw== + dependencies: + strip-bom "^4.0.0" + define-data-property@^1.0.1, define-data-property@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.4.tgz#894dc141bb7d3060ae4366f6a0107e68fbe48c5e" @@ -2059,6 +3052,16 @@ delayed-stream@~1.0.0: resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== +depd@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" + integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== + +dequal@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/dequal/-/dequal-2.0.3.tgz#2644214f1997d39ed0ee0ece72335490a7ac67be" + integrity sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA== + des.js@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.1.0.tgz#1d37f5766f3bbff4ee9638e871a8768c173b81da" @@ -2067,6 +3070,16 @@ des.js@^1.0.0: inherits "^2.0.1" minimalistic-assert "^1.0.0" +diff@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" + integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + +diff@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-5.2.0.tgz#26ded047cd1179b78b9537d5ef725503ce1ae531" + integrity sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A== + diffie-hellman@^5.0.0: version "5.0.3" resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" @@ -2076,6 +3089,13 @@ diffie-hellman@^5.0.0: miller-rabin "^4.0.0" randombytes "^2.0.0" +difflib@^0.2.4: + version "0.2.4" + resolved "https://registry.yarnpkg.com/difflib/-/difflib-0.2.4.tgz#b5e30361a6db023176d562892db85940a718f47e" + integrity sha512-9YVwmMb0wQHQNr5J9m6BSj6fk4pfGITGQOOs+D9Fl+INODWFOfvhIU1hNv6GgR1RBoC/9NJcwu77zShxV0kT7w== + dependencies: + heap ">= 0.2.0" + dir-glob@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" @@ -2097,15 +3117,25 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" -domain-browser@^4.22.0: - version "4.23.0" - resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-4.23.0.tgz#427ebb91efcb070f05cffdfb8a4e9a6c25f8c94b" - integrity sha512-ArzcM/II1wCCujdCNyQjXrAFwS4mrLh4C7DZWlaI8mdh7h3BfKdNd3bKXITfl2PT9FtfQqaGvhi1vPRQPimjGA== +domain-browser@^5.7.0: + version "5.7.0" + resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-5.7.0.tgz#81b942459672e3c7ed8f721fe31135a5628f31cf" + integrity sha512-edTFu0M/7wO1pXY6GDxVNVW086uqwWYIHP98txhcPyV995X21JIH2DtYp33sQJOupYoXKe9RwTw2Ya2vWaquTQ== -electron-to-chromium@^1.4.668: - version "1.4.748" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.748.tgz#aa7d4f2f3eac3a6a863cd1779bd4682b4bb68ed5" - integrity sha512-VWqjOlPZn70UZ8FTKUOkUvBLeTQ0xpty66qV0yJcAGY2/CthI4xyW9aEozRVtuwv3Kpf5xTesmJUcPwuJmgP4A== +eastasianwidth@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" + integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== + +electron-to-chromium@^1.5.4: + version "1.5.25" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.25.tgz#492ade1cde401332b9b75aa0c55fd5e1550ca66c" + integrity sha512-kMb204zvK3PsSlgvvwzI3wBIcAw15tRkYk+NQdsjdDtcQWTp2RABbMQ9rUBy8KNEOM+/E6ep+XC3AykiWZld4g== + +electron-to-chromium@^1.5.41: + version "1.5.46" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.46.tgz#69c98f809a3ea669386263d672f4d920be71da3a" + integrity sha512-1XDk0Z8/YRgB2t5GeEg8DPK592DLjVmd/5uwAu6c/S4Z0CUwV/RwYqe5GWxQqcoN3bJ5U7hYMiMRPZzpCzSBhQ== elliptic@6.5.4: version "6.5.4" @@ -2120,10 +3150,10 @@ elliptic@6.5.4: minimalistic-assert "^1.0.1" minimalistic-crypto-utils "^1.0.1" -elliptic@^6.5.3, elliptic@^6.5.5: - version "6.5.5" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.5.tgz#c715e09f78b6923977610d4c2346d6ce22e6dded" - integrity sha512-7EjbcmUm17NQFu4Pmgmq2olYMj8nwMnpcddByChSUjArp8F5DQWcIcpriwO4ZToLNAJig0yiyjswfyGNje/ixw== +elliptic@^6.5.2, elliptic@^6.5.3, elliptic@^6.5.5, elliptic@^6.5.7: + version "6.5.7" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.7.tgz#8ec4da2cb2939926a1b9a73619d768207e647c8b" + integrity sha512-ESVCtTwiA+XhY3wyh24QqRGBoP3rEdDUl3EDUUo9tft074fi19IrdpH7hLCMMP3CIj7jb3W96rn8lt/BqIlt5Q== dependencies: bn.js "^4.11.9" brorand "^1.1.0" @@ -2138,6 +3168,16 @@ emoji-regex@^7.0.1: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + +emoji-regex@^9.2.2: + version "9.2.2" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" + integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== + emojis-list@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-3.0.0.tgz#5570662046ad29e2e916e71aae260abdff4f6a78" @@ -2150,18 +3190,31 @@ end-of-stream@^1.1.0: dependencies: once "^1.4.0" -enhanced-resolve@^5.12.0, enhanced-resolve@^5.16.0: - version "5.16.0" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.16.0.tgz#65ec88778083056cb32487faa9aef82ed0864787" - integrity sha512-O+QWCviPNSSLAD9Ucn8Awv+poAkqn3T1XY5/N7kR7rQO9yfSGWkYZDwpJ+iKF7B8rxaQKWngSqACpgzeapSyoA== +enhanced-resolve@^5.15.0, enhanced-resolve@^5.17.1: + version "5.17.1" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz#67bfbbcc2f81d511be77d686a90267ef7f898a15" + integrity sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg== dependencies: graceful-fs "^4.2.4" tapable "^2.2.0" +enquirer@^2.3.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.4.1.tgz#93334b3fbd74fc7097b224ab4a8fb7e40bf4ae56" + integrity sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ== + dependencies: + ansi-colors "^4.1.1" + strip-ansi "^6.0.1" + +env-paths@^2.2.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2" + integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A== + envinfo@^7.7.3: - version "7.12.0" - resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.12.0.tgz#b56723b39c2053d67ea5714f026d05d4f5cc7acd" - integrity sha512-Iw9rQJBGpJRd3rwXm9ft/JiGoAZmLxxJZELYDQoPRZ4USVhkKtIcNBPw6U+/K2mBpaqM25JSV6Yl4Az9vO2wJg== + version "7.14.0" + resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.14.0.tgz#26dac5db54418f2a4c1159153a0b2ae980838aae" + integrity sha512-CO40UI41xDQzhLB1hWyqUKgFhs250pNcGbyGKe1l/e4FSaI/+YE4IMG76GDt0In67WLPACIITC+sOi08x4wIvg== es-abstract@^1.22.1, es-abstract@^1.22.3, es-abstract@^1.23.0, es-abstract@^1.23.2: version "1.23.3" @@ -2228,9 +3281,9 @@ es-errors@^1.2.1, es-errors@^1.3.0: integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== es-module-lexer@^1.2.1, es-module-lexer@^1.3.1: - version "1.5.0" - resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.5.0.tgz#4878fee3789ad99e065f975fdd3c645529ff0236" - integrity sha512-pqrTKmwEIgafsYZAGw9kszYzmagcE/n4dbgwGWLEXg7J4QFJVQRBld8j3Q3GNez79jzxZshq0bcT962QHOghjw== + version "1.5.4" + resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.5.4.tgz#a8efec3a3da991e60efa6b633a7cad6ab8d26b78" + integrity sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw== es-object-atoms@^1.0.0: version "1.0.0" @@ -2264,49 +3317,54 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" -esbuild-loader@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/esbuild-loader/-/esbuild-loader-4.1.0.tgz#06bddf224320c279fafbe4981feb1a0175b593e4" - integrity sha512-543TtIvqbqouEMlOHg4xKoDQkmdImlwIpyAIgpUtDPvMuklU/c2k+Qt2O3VeDBgAwozxmlEbjOzV+F8CZ0g+Bw== +es6-error@^4.0.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.1.1.tgz#9e3af407459deed47e9a91f9b885a84eb05c561d" + integrity sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg== + +esbuild-loader@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/esbuild-loader/-/esbuild-loader-4.2.2.tgz#cce9032097767d325d6aa231edbd7d66a5d7fa1b" + integrity sha512-Mdq/A1L8p37hkibp8jGFwuQTDSWhDmlueAefsrCPRwNWThEOlQmIglV7Gd6GE2mO5bt7ksfxKOMwkuY7jjVTXg== dependencies: - esbuild "^0.20.0" + esbuild "^0.21.0" get-tsconfig "^4.7.0" loader-utils "^2.0.4" webpack-sources "^1.4.3" -esbuild@^0.20.0, esbuild@^0.20.2: - version "0.20.2" - resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.20.2.tgz#9d6b2386561766ee6b5a55196c6d766d28c87ea1" - integrity sha512-WdOOppmUNU+IbZ0PaDiTst80zjnrOkyJNHoKupIcVyU8Lvla3Ugx94VzkQ32Ijqd7UhHJy75gNWDMUekcrSJ6g== +esbuild@^0.21.0: + version "0.21.5" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.21.5.tgz#9ca301b120922959b766360d8ac830da0d02997d" + integrity sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw== optionalDependencies: - "@esbuild/aix-ppc64" "0.20.2" - "@esbuild/android-arm" "0.20.2" - "@esbuild/android-arm64" "0.20.2" - "@esbuild/android-x64" "0.20.2" - "@esbuild/darwin-arm64" "0.20.2" - "@esbuild/darwin-x64" "0.20.2" - "@esbuild/freebsd-arm64" "0.20.2" - "@esbuild/freebsd-x64" "0.20.2" - "@esbuild/linux-arm" "0.20.2" - "@esbuild/linux-arm64" "0.20.2" - "@esbuild/linux-ia32" "0.20.2" - "@esbuild/linux-loong64" "0.20.2" - "@esbuild/linux-mips64el" "0.20.2" - "@esbuild/linux-ppc64" "0.20.2" - "@esbuild/linux-riscv64" "0.20.2" - "@esbuild/linux-s390x" "0.20.2" - "@esbuild/linux-x64" "0.20.2" - "@esbuild/netbsd-x64" "0.20.2" - "@esbuild/openbsd-x64" "0.20.2" - "@esbuild/sunos-x64" "0.20.2" - "@esbuild/win32-arm64" "0.20.2" - "@esbuild/win32-ia32" "0.20.2" - "@esbuild/win32-x64" "0.20.2" + "@esbuild/aix-ppc64" "0.21.5" + "@esbuild/android-arm" "0.21.5" + "@esbuild/android-arm64" "0.21.5" + "@esbuild/android-x64" "0.21.5" + "@esbuild/darwin-arm64" "0.21.5" + "@esbuild/darwin-x64" "0.21.5" + "@esbuild/freebsd-arm64" "0.21.5" + "@esbuild/freebsd-x64" "0.21.5" + "@esbuild/linux-arm" "0.21.5" + "@esbuild/linux-arm64" "0.21.5" + "@esbuild/linux-ia32" "0.21.5" + "@esbuild/linux-loong64" "0.21.5" + "@esbuild/linux-mips64el" "0.21.5" + "@esbuild/linux-ppc64" "0.21.5" + "@esbuild/linux-riscv64" "0.21.5" + "@esbuild/linux-s390x" "0.21.5" + "@esbuild/linux-x64" "0.21.5" + "@esbuild/netbsd-x64" "0.21.5" + "@esbuild/openbsd-x64" "0.21.5" + "@esbuild/sunos-x64" "0.21.5" + "@esbuild/win32-arm64" "0.21.5" + "@esbuild/win32-ia32" "0.21.5" + "@esbuild/win32-x64" "0.21.5" -escalade@^3.1.1: - version "3.1.2" - resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27" - integrity sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA== +escalade@^3.1.1, escalade@^3.1.2, escalade@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" + integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA== escape-string-regexp@^1.0.5: version "1.0.5" @@ -2318,6 +3376,18 @@ escape-string-regexp@^4.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== +escodegen@1.8.x: + version "1.8.1" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.8.1.tgz#5a5b53af4693110bebb0867aa3430dd3b70a1018" + integrity sha512-yhi5S+mNTOuRvyW4gWlg5W1byMaQGWWSYHXsuFZ7GBo7tpyOwi2EdzMP/QWxh9hwkD2m+wDVHJsxhRIj+v/b/A== + dependencies: + esprima "^2.7.1" + estraverse "^1.9.1" + esutils "^2.0.2" + optionator "^0.8.1" + optionalDependencies: + source-map "~0.2.0" + eslint-config-prettier@^9.1.0: version "9.1.0" resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz#31af3d94578645966c082fcb71a5846d3c94867f" @@ -2332,56 +3402,66 @@ eslint-import-resolver-node@^0.3.9: is-core-module "^2.13.0" resolve "^1.22.4" -eslint-import-resolver-typescript@^3.6.1: - version "3.6.1" - resolved "https://registry.yarnpkg.com/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.1.tgz#7b983680edd3f1c5bce1a5829ae0bc2d57fe9efa" - integrity sha512-xgdptdoi5W3niYeuQxKmzVDTATvLYqhpwmykwsh7f6HIOStGWEIL9iqZgQDF9u9OEzrRwR8no5q2VT+bjAujTg== +eslint-import-resolver-typescript@^3.6.3: + version "3.6.3" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.3.tgz#bb8e388f6afc0f940ce5d2c5fd4a3d147f038d9e" + integrity sha512-ud9aw4szY9cCT1EWWdGv1L1XR6hh2PaRWif0j2QjQ0pgTY/69iw+W0Z4qZv5wHahOl8isEr+k/JnyAqNQkLkIA== dependencies: - debug "^4.3.4" - enhanced-resolve "^5.12.0" - eslint-module-utils "^2.7.4" - fast-glob "^3.3.1" - get-tsconfig "^4.5.0" - is-core-module "^2.11.0" + "@nolyfill/is-core-module" "1.0.39" + debug "^4.3.5" + enhanced-resolve "^5.15.0" + eslint-module-utils "^2.8.1" + fast-glob "^3.3.2" + get-tsconfig "^4.7.5" + is-bun-module "^1.0.2" is-glob "^4.0.3" -eslint-module-utils@^2.7.4, eslint-module-utils@^2.8.0: - version "2.8.1" - resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.8.1.tgz#52f2404300c3bd33deece9d7372fb337cc1d7c34" - integrity sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q== +eslint-module-utils@^2.12.0: + version "2.12.0" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.12.0.tgz#fe4cfb948d61f49203d7b08871982b65b9af0b0b" + integrity sha512-wALZ0HFoytlyh/1+4wuZ9FJCD/leWHQzzrxJ8+rebyReSLk7LApMyd3WJaLVoN+D5+WIdJyDK1c6JnE65V4Zyg== dependencies: debug "^3.2.7" -eslint-plugin-import@^2.29.1: - version "2.29.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz#d45b37b5ef5901d639c15270d74d46d161150643" - integrity sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw== +eslint-module-utils@^2.8.1: + version "2.11.0" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.11.0.tgz#b99b211ca4318243f09661fae088f373ad5243c4" + integrity sha512-gbBE5Hitek/oG6MUVj6sFuzEjA/ClzNflVrLovHi/JgLdC7fiN5gLAY1WIPW1a0V5I999MnsrvVrCOGmmVqDBQ== dependencies: - array-includes "^3.1.7" - array.prototype.findlastindex "^1.2.3" + debug "^3.2.7" + +eslint-plugin-import@^2.31.0: + version "2.31.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.31.0.tgz#310ce7e720ca1d9c0bb3f69adfd1c6bdd7d9e0e7" + integrity sha512-ixmkI62Rbc2/w8Vfxyh1jQRTdRTF52VxwRVHl/ykPAmqG+Nb7/kNn+byLP0LxPgI7zWA16Jt82SybJInmMia3A== + dependencies: + "@rtsao/scc" "^1.1.0" + array-includes "^3.1.8" + array.prototype.findlastindex "^1.2.5" array.prototype.flat "^1.3.2" array.prototype.flatmap "^1.3.2" debug "^3.2.7" doctrine "^2.1.0" eslint-import-resolver-node "^0.3.9" - eslint-module-utils "^2.8.0" - hasown "^2.0.0" - is-core-module "^2.13.1" + eslint-module-utils "^2.12.0" + hasown "^2.0.2" + is-core-module "^2.15.1" is-glob "^4.0.3" minimatch "^3.1.2" - object.fromentries "^2.0.7" - object.groupby "^1.0.1" - object.values "^1.1.7" + object.fromentries "^2.0.8" + object.groupby "^1.0.3" + object.values "^1.2.0" semver "^6.3.1" + string.prototype.trimend "^1.0.8" tsconfig-paths "^3.15.0" -eslint-plugin-prettier@^5.1.3: - version "5.1.3" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.1.3.tgz#17cfade9e732cef32b5f5be53bd4e07afd8e67e1" - integrity sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw== +eslint-plugin-prettier@^5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz#d1c8f972d8f60e414c25465c163d16f209411f95" + integrity sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw== dependencies: prettier-linter-helpers "^1.0.0" - synckit "^0.8.6" + synckit "^0.9.1" eslint-scope@5.1.1: version "5.1.1" @@ -2424,49 +3504,7 @@ eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4 resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== -eslint@^5.16.0: - version "5.16.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.16.0.tgz#a1e3ac1aae4a3fbd8296fcf8f7ab7314cbb6abea" - integrity sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg== - dependencies: - "@babel/code-frame" "^7.0.0" - ajv "^6.9.1" - chalk "^2.1.0" - cross-spawn "^6.0.5" - debug "^4.0.1" - doctrine "^3.0.0" - eslint-scope "^4.0.3" - eslint-utils "^1.3.1" - eslint-visitor-keys "^1.0.0" - espree "^5.0.1" - esquery "^1.0.1" - esutils "^2.0.2" - file-entry-cache "^5.0.1" - functional-red-black-tree "^1.0.1" - glob "^7.1.2" - globals "^11.7.0" - ignore "^4.0.6" - import-fresh "^3.0.0" - imurmurhash "^0.1.4" - inquirer "^6.2.2" - js-yaml "^3.13.0" - json-stable-stringify-without-jsonify "^1.0.1" - levn "^0.3.0" - lodash "^4.17.11" - minimatch "^3.0.4" - mkdirp "^0.5.1" - natural-compare "^1.4.0" - optionator "^0.8.2" - path-is-inside "^1.0.2" - progress "^2.0.0" - regexpp "^2.0.1" - semver "^5.5.1" - strip-ansi "^4.0.0" - strip-json-comments "^2.0.1" - table "^5.2.3" - text-table "^0.2.0" - -eslint@^8.57.0: +eslint@8.57.0: version "8.57.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.57.0.tgz#c786a6fd0e0b68941aaf624596fb987089195668" integrity sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ== @@ -2510,6 +3548,48 @@ eslint@^8.57.0: strip-ansi "^6.0.1" text-table "^0.2.0" +eslint@^5.16.0: + version "5.16.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.16.0.tgz#a1e3ac1aae4a3fbd8296fcf8f7ab7314cbb6abea" + integrity sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg== + dependencies: + "@babel/code-frame" "^7.0.0" + ajv "^6.9.1" + chalk "^2.1.0" + cross-spawn "^6.0.5" + debug "^4.0.1" + doctrine "^3.0.0" + eslint-scope "^4.0.3" + eslint-utils "^1.3.1" + eslint-visitor-keys "^1.0.0" + espree "^5.0.1" + esquery "^1.0.1" + esutils "^2.0.2" + file-entry-cache "^5.0.1" + functional-red-black-tree "^1.0.1" + glob "^7.1.2" + globals "^11.7.0" + ignore "^4.0.6" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + inquirer "^6.2.2" + js-yaml "^3.13.0" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.3.0" + lodash "^4.17.11" + minimatch "^3.0.4" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + optionator "^0.8.2" + path-is-inside "^1.0.2" + progress "^2.0.0" + regexpp "^2.0.1" + semver "^5.5.1" + strip-ansi "^4.0.0" + strip-json-comments "^2.0.1" + table "^5.2.3" + text-table "^0.2.0" + espree@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/espree/-/espree-5.0.1.tgz#5d6526fa4fc7f0788a5cf75b15f30323e2f81f7a" @@ -2528,15 +3608,20 @@ espree@^9.6.0, espree@^9.6.1: acorn-jsx "^5.3.2" eslint-visitor-keys "^3.4.1" +esprima@2.7.x, esprima@^2.7.1: + version "2.7.3" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" + integrity sha512-OarPfz0lFCiW4/AV2Oy1Rp9qu0iusTKqykwTspGCZtPxmF81JR4MmIebvF1F9+UOKth2ZubLQ4XGGaU+hSn99A== + esprima@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== esquery@^1.0.1, esquery@^1.4.2: - version "1.5.0" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.5.0.tgz#6ce17738de8577694edd7361c57182ac8cb0db0b" - integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg== + version "1.6.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.6.0.tgz#91419234f804d852a82dceec3e16cdc22cf9dae7" + integrity sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg== dependencies: estraverse "^5.1.0" @@ -2547,6 +3632,11 @@ esrecurse@^4.1.0, esrecurse@^4.3.0: dependencies: estraverse "^5.2.0" +estraverse@^1.9.1: + version "1.9.3" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.9.3.tgz#af67f2dc922582415950926091a4005d29c9bb44" + integrity sha512-25w1fMXQrGdoquWnScXZGckOv+Wes+JDnuN/+7ex3SauFRS72r2lFDec0EKPt2YD1wUJ/IrfEex+9yp4hfSOJA== + estraverse@^4.1.1: version "4.3.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" @@ -2567,15 +3657,85 @@ esutils@^2.0.2: resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== -ethereum-cryptography@^2.0.0, ethereum-cryptography@^2.1.2: - version "2.1.3" - resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-2.1.3.tgz#1352270ed3b339fe25af5ceeadcf1b9c8e30768a" - integrity sha512-BlwbIL7/P45W8FGW2r7LGuvoEZ+7PWsniMvQ4p5s2xCyw9tmaDlpfsN9HjAucbF+t/qpVHwZUisgfK24TCW8aA== +ethereum-bloom-filters@^1.0.6: + version "1.2.0" + resolved "https://registry.yarnpkg.com/ethereum-bloom-filters/-/ethereum-bloom-filters-1.2.0.tgz#8294f074c1a6cbd32c39d2cc77ce86ff14797dab" + integrity sha512-28hyiE7HVsWubqhpVLVmZXFd4ITeHi+BUu05o9isf0GUpMtzBUi+8/gFrGaGYzvGAJQmJ3JKj77Mk9G98T84rA== dependencies: - "@noble/curves" "1.3.0" - "@noble/hashes" "1.3.3" - "@scure/bip32" "1.3.3" - "@scure/bip39" "1.2.2" + "@noble/hashes" "^1.4.0" + +ethereum-cryptography@0.1.3, ethereum-cryptography@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz#8d6143cfc3d74bf79bbd8edecdf29e4ae20dd191" + integrity sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ== + dependencies: + "@types/pbkdf2" "^3.0.0" + "@types/secp256k1" "^4.0.1" + blakejs "^1.1.0" + browserify-aes "^1.2.0" + bs58check "^2.1.2" + create-hash "^1.2.0" + create-hmac "^1.1.7" + hash.js "^1.1.7" + keccak "^3.0.0" + pbkdf2 "^3.0.17" + randombytes "^2.1.0" + safe-buffer "^5.1.2" + scrypt-js "^3.0.0" + secp256k1 "^4.0.1" + setimmediate "^1.0.5" + +ethereum-cryptography@^1.0.3: + version "1.2.0" + resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-1.2.0.tgz#5ccfa183e85fdaf9f9b299a79430c044268c9b3a" + integrity sha512-6yFQC9b5ug6/17CQpCyE3k9eKBMdhyVjzUy1WkiuY/E4vj/SXDBbCw8QEIaXqf0Mf2SnY6RmpDcwlUmBSS0EJw== + dependencies: + "@noble/hashes" "1.2.0" + "@noble/secp256k1" "1.7.1" + "@scure/bip32" "1.1.5" + "@scure/bip39" "1.1.1" + +ethereum-cryptography@^2.0.0, ethereum-cryptography@^2.1.2, ethereum-cryptography@^2.1.3: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz#58f2810f8e020aecb97de8c8c76147600b0b8ccf" + integrity sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg== + dependencies: + "@noble/curves" "1.4.2" + "@noble/hashes" "1.4.0" + "@scure/bip32" "1.4.0" + "@scure/bip39" "1.3.0" + +ethereumjs-abi@^0.6.8: + version "0.6.8" + resolved "https://registry.yarnpkg.com/ethereumjs-abi/-/ethereumjs-abi-0.6.8.tgz#71bc152db099f70e62f108b7cdfca1b362c6fcae" + integrity sha512-Tx0r/iXI6r+lRsdvkFDlut0N08jWMnKRZ6Gkq+Nmw75lZe4e6o3EkSnkaBP5NF6+m5PTGAr9JP43N3LyeoglsA== + dependencies: + bn.js "^4.11.8" + ethereumjs-util "^6.0.0" + +ethereumjs-util@^6.0.0, ethereumjs-util@^6.2.1: + version "6.2.1" + resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz#fcb4e4dd5ceacb9d2305426ab1a5cd93e3163b69" + integrity sha512-W2Ktez4L01Vexijrm5EB6w7dg4n/TgpoYU4avuT5T3Vmnw/eCRtiBrJfQYS/DCSvDIOLn2k57GcHdeBcgVxAqw== + dependencies: + "@types/bn.js" "^4.11.3" + bn.js "^4.11.0" + create-hash "^1.1.2" + elliptic "^6.5.2" + ethereum-cryptography "^0.1.3" + ethjs-util "0.1.6" + rlp "^2.2.3" + +ethereumjs-util@^7.1.4: + version "7.1.5" + resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz#9ecf04861e4fbbeed7465ece5f23317ad1129181" + integrity sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg== + dependencies: + "@types/bn.js" "^5.1.0" + bn.js "^5.1.2" + create-hash "^1.1.2" + ethereum-cryptography "^0.1.3" + rlp "^2.2.4" ethers@^5.5.1: version "5.7.2" @@ -2613,18 +3773,34 @@ ethers@^5.5.1: "@ethersproject/web" "5.7.1" "@ethersproject/wordlists" "5.7.0" -ethers@^6.4.0: - version "6.12.0" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.12.0.tgz#b0c2ce207ae5a3b5125be966e32ffea7c1f2481a" - integrity sha512-zL5NlOTjML239gIvtVJuaSk0N9GQLi1Hom3ZWUszE5lDTQE/IVB62mrPkQ2W1bGcZwVGSLaetQbWNQSvI4rGDQ== +ethers@^6.13.4, ethers@^6.7.0: + version "6.13.4" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.13.4.tgz#bd3e1c3dc1e7dc8ce10f9ffb4ee40967a651b53c" + integrity sha512-21YtnZVg4/zKkCQPjrDj38B1r4nQvTZLopUGMLQ1ePU2zV/joCfDC3t3iKQjWRzjjjbzR+mdAIoikeBRNkdllA== dependencies: "@adraffy/ens-normalize" "1.10.1" "@noble/curves" "1.2.0" "@noble/hashes" "1.3.2" - "@types/node" "18.15.13" + "@types/node" "22.7.5" aes-js "4.0.0-beta.5" - tslib "2.4.0" - ws "8.5.0" + tslib "2.7.0" + ws "8.17.1" + +ethjs-unit@0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/ethjs-unit/-/ethjs-unit-0.1.6.tgz#c665921e476e87bce2a9d588a6fe0405b2c41699" + integrity sha512-/Sn9Y0oKl0uqQuvgFk/zQgR7aw1g36qX/jzSQ5lSwlO0GigPymk4eGQfeNTD03w1dPOqfz8V77Cy43jH56pagw== + dependencies: + bn.js "4.11.6" + number-to-bn "1.7.0" + +ethjs-util@0.1.6, ethjs-util@^0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/ethjs-util/-/ethjs-util-0.1.6.tgz#f308b62f185f9fe6237132fb2a9818866a5cd536" + integrity sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w== + dependencies: + is-hex-prefixed "1.0.0" + strip-hex-prefix "1.0.0" event-target-shim@^5.0.0: version "5.0.1" @@ -2676,7 +3852,7 @@ fast-diff@^1.1.2: resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== -fast-glob@^3.2.9, fast-glob@^3.3.1: +fast-glob@^3.0.3, fast-glob@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== @@ -2697,6 +3873,11 @@ fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== +fast-uri@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.0.1.tgz#cddd2eecfc83a71c1be2cc2ef2061331be8a7134" + integrity sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw== + fastest-levenshtein@^1.0.12: version "1.0.16" resolved "https://registry.yarnpkg.com/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz#210e61b6ff181de91ea9b3d1b84fdedd47e034e5" @@ -2709,7 +3890,23 @@ fastq@^1.6.0: dependencies: reusify "^1.0.4" -ffjavascript@0.2.48, ffjavascript@^0.2.45: +fdir@^6.2.0: + version "6.4.0" + resolved "https://registry.yarnpkg.com/fdir/-/fdir-6.4.0.tgz#8e80ab4b18a2ac24beebf9d20d71e1bc2627dbae" + integrity sha512-3oB133prH1o4j/L5lLW7uOCF1PlD+/It2L0eL/iAqWMB91RBbqTewABqxhj0ibBd90EEmWZq7ntIWzVaWcXTGQ== + +fetch-mock@^12.0.2: + version "12.0.2" + resolved "https://registry.yarnpkg.com/fetch-mock/-/fetch-mock-12.0.2.tgz#380363c7a79e8d9f87d9d0267717eef56a3bbe64" + integrity sha512-9KVq/Scz06A+ThORLA/J/EACiPzLdSn6DeLV61hni57kd3DXhQVCtkpj4LgwES+8osEVEfcqA6LwdSX2FYVK7w== + dependencies: + "@types/glob-to-regexp" "^0.4.4" + dequal "^2.0.3" + glob-to-regexp "^0.4.1" + is-subset-of "^3.1.10" + regexparam "^3.0.0" + +ffjavascript@0.2.48: version "0.2.48" resolved "https://registry.yarnpkg.com/ffjavascript/-/ffjavascript-0.2.48.tgz#0ca408471d7b18bfc096a9631aa3ef3549c8c82b" integrity sha512-uNrWP+odLofNmmO+iCCPi/Xt/sJh1ku3pVKmKWVWCLFfdCP69hvRrogKUIGnsdiINcWn0lGxcEh5oEjStMFXQQ== @@ -2719,6 +3916,15 @@ ffjavascript@0.2.48, ffjavascript@^0.2.45: wasmcurves "0.1.0" web-worker "^1.2.0" +ffjavascript@^0.2.45: + version "0.2.63" + resolved "https://registry.yarnpkg.com/ffjavascript/-/ffjavascript-0.2.63.tgz#0c1216a1f123dc9181df69e144473704d2f115eb" + integrity sha512-dBgdsfGks58b66JnUZeZpGxdMIDQ4QsD3VYlRJyFVrKQHb2kJy4R2gufx5oetrTxXPT+aEjg0dOvOLg1N0on4A== + dependencies: + wasmbuilder "0.0.16" + wasmcurves "0.2.2" + web-worker "1.2.0" + fflate@^0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/fflate/-/fflate-0.8.2.tgz#fc8631f5347812ad6028bbe4a2308b2792aa1dea" @@ -2750,13 +3956,22 @@ file-uri-to-path@1.0.0: resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== -fill-range@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" - integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== +fill-range@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" + integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== dependencies: to-regex-range "^5.0.1" +find-cache-dir@^3.2.0: + version "3.3.2" + resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-3.3.2.tgz#b30c5b6eff0730731aea9bbd9dbecbd80256d64b" + integrity sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig== + dependencies: + commondir "^1.0.1" + make-dir "^3.0.2" + pkg-dir "^4.1.0" + find-replace@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/find-replace/-/find-replace-3.0.0.tgz#3e7e23d3b05167a76f770c9fbd5258b0def68c38" @@ -2764,6 +3979,13 @@ find-replace@^3.0.0: dependencies: array-back "^3.0.1" +find-up@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + integrity sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ== + dependencies: + locate-path "^2.0.0" + find-up@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" @@ -2771,7 +3993,7 @@ find-up@^3.0.0: dependencies: locate-path "^3.0.0" -find-up@^4.0.0: +find-up@^4.0.0, find-up@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== @@ -2820,6 +4042,11 @@ flatted@^3.2.9: resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a" integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw== +follow-redirects@^1.12.1, follow-redirects@^1.15.6: + version "1.15.9" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.9.tgz#a604fa10e443bf98ca94228d9eebcc2e8a2c8ee1" + integrity sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ== + for-each@^0.3.3: version "0.3.3" resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" @@ -2827,6 +4054,22 @@ for-each@^0.3.3: dependencies: is-callable "^1.1.3" +foreground-child@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-2.0.0.tgz#71b32800c9f15aa8f2f83f4a6bd9bff35d861a53" + integrity sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA== + dependencies: + cross-spawn "^7.0.0" + signal-exit "^3.0.2" + +foreground-child@^3.1.0, foreground-child@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.3.0.tgz#0ac8644c06e431439f8561db8ecf29a7b5519c77" + integrity sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg== + dependencies: + cross-spawn "^7.0.0" + signal-exit "^4.0.1" + form-data@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" @@ -2836,7 +4079,31 @@ form-data@^4.0.0: combined-stream "^1.0.8" mime-types "^2.1.12" -fs-extra@^7.0.0: +fp-ts@1.19.3: + version "1.19.3" + resolved "https://registry.yarnpkg.com/fp-ts/-/fp-ts-1.19.3.tgz#261a60d1088fbff01f91256f91d21d0caaaaa96f" + integrity sha512-H5KQDspykdHuztLTg+ajGN0Z2qUjcEf3Ybxc6hLt0k7/zPkn29XnKnxlBPyW2XIddWrGaJBzBl4VLYOtk39yZg== + +fp-ts@^1.0.0: + version "1.19.5" + resolved "https://registry.yarnpkg.com/fp-ts/-/fp-ts-1.19.5.tgz#3da865e585dfa1fdfd51785417357ac50afc520a" + integrity sha512-wDNqTimnzs8QqpldiId9OavWK2NptormjXnRJTQecNjzwfyp6P/8s/zG8e4h3ja3oqkKaY72UlTjQYt/1yXf9A== + +fromentries@^1.2.0: + version "1.3.2" + resolved "https://registry.yarnpkg.com/fromentries/-/fromentries-1.3.2.tgz#e4bca6808816bf8f93b52750f1127f5a6fd86e3a" + integrity sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg== + +fs-extra@^10.0.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf" + integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + +fs-extra@^7.0.0, fs-extra@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== @@ -2845,6 +4112,25 @@ fs-extra@^7.0.0: jsonfile "^4.0.0" universalify "^0.1.0" +fs-extra@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" + integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^4.0.0" + universalify "^0.1.0" + +fs-extra@^9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" + integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== + dependencies: + at-least-node "^1.0.0" + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -2880,11 +4166,21 @@ functions-have-names@^1.2.3: resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== +gensync@^1.0.0-beta.2: + version "1.0.0-beta.2" + resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" + integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== + get-caller-file@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== +get-caller-file@^2.0.1, get-caller-file@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + get-func-name@^2.0.1, get-func-name@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.2.tgz#0d7cf20cd13fda808669ffa88f4ffc7a3943fc41" @@ -2901,6 +4197,11 @@ get-intrinsic@^1.1.3, get-intrinsic@^1.2.1, get-intrinsic@^1.2.3, get-intrinsic@ has-symbols "^1.0.3" hasown "^2.0.0" +get-package-type@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" + integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== + get-stream@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" @@ -2917,14 +4218,22 @@ get-symbol-description@^1.0.2: es-errors "^1.3.0" get-intrinsic "^1.2.4" -get-tsconfig@^4.5.0, get-tsconfig@^4.7.0, get-tsconfig@^4.7.2: - version "4.7.3" - resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.7.3.tgz#0498163d98f7b58484dd4906999c0c9d5f103f83" - integrity sha512-ZvkrzoUA0PQZM6fy6+/Hce561s+faD1rsNwhnO5FelNjyy7EMGJ3Rz1AQ8GYDWjhRs/7dBLOEJvhK8MiEJOAFg== +get-tsconfig@^4.7.0, get-tsconfig@^4.7.2, get-tsconfig@^4.7.5: + version "4.8.1" + resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.8.1.tgz#8995eb391ae6e1638d251118c7b56de7eb425471" + integrity sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg== dependencies: resolve-pkg-maps "^1.0.0" -glob-parent@^5.1.2: +ghost-testrpc@^0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/ghost-testrpc/-/ghost-testrpc-0.0.2.tgz#c4de9557b1d1ae7b2d20bbe474a91378ca90ce92" + integrity sha512-i08dAEgJ2g8z5buJIrCTduwPIhih3DP+hOCTyyryikfV8T0bNvHnGXO67i0DD1H4GBDETTclPy9njZbfluQYrQ== + dependencies: + chalk "^2.4.2" + node-emoji "^1.10.0" + +glob-parent@^5.1.2, glob-parent@~5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== @@ -2955,7 +4264,42 @@ glob@7.1.7: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.1.2, glob@^7.1.3: +glob@7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" + integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +glob@^10.3.10: + version "10.4.5" + resolved "https://registry.yarnpkg.com/glob/-/glob-10.4.5.tgz#f4d9f0b90ffdbab09c9d77f5f29b4262517b0956" + integrity sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg== + dependencies: + foreground-child "^3.1.0" + jackspeak "^3.1.2" + minimatch "^9.0.4" + minipass "^7.1.2" + package-json-from-dist "^1.0.0" + path-scurry "^1.11.1" + +glob@^5.0.15: + version "5.0.15" + resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1" + integrity sha512-c9IPMazfRITpmAAKi22dK1VKxGDX9ehhqfABDriL/lzO92xcUKEJPQHrVA/2YHSNFB4iFlykVmWvwo48nr3OxA== + dependencies: + inflight "^1.0.4" + inherits "2" + minimatch "2 || 3" + once "^1.3.0" + path-is-absolute "^1.0.0" + +glob@^7.0.0, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== @@ -2967,7 +4311,7 @@ glob@^7.1.2, glob@^7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^8.0.3: +glob@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== @@ -2978,7 +4322,23 @@ glob@^8.0.3: minimatch "^5.0.1" once "^1.3.0" -globals@^11.7.0: +global-modules@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-2.0.0.tgz#997605ad2345f27f51539bea26574421215c7780" + integrity sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A== + dependencies: + global-prefix "^3.0.0" + +global-prefix@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/global-prefix/-/global-prefix-3.0.0.tgz#fc85f73064df69f50421f47f883fe5b913ba9b97" + integrity sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg== + dependencies: + ini "^1.3.5" + kind-of "^6.0.2" + which "^1.3.1" + +globals@^11.1.0, globals@^11.7.0: version "11.12.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== @@ -2991,22 +4351,25 @@ globals@^13.19.0: type-fest "^0.20.2" globalthis@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.3.tgz#5852882a52b80dc301b0660273e1ed082f0b6ccf" - integrity sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA== + version "1.0.4" + resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.4.tgz#7430ed3a975d97bfb59bcce41f5cabbafa651236" + integrity sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ== dependencies: - define-properties "^1.1.3" + define-properties "^1.2.1" + gopd "^1.0.1" -globby@^11.1.0: - version "11.1.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" - integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== +globby@^10.0.1: + version "10.0.2" + resolved "https://registry.yarnpkg.com/globby/-/globby-10.0.2.tgz#277593e745acaa4646c3ab411289ec47a0392543" + integrity sha512-7dUi7RvCoT/xast/o/dLN53oqND4yk0nsHkhRgn9w65C4PofCLOoJ39iSOg+qVDdWQPIEj+eszMHQ+aLVwwQSg== dependencies: + "@types/glob" "^7.1.1" array-union "^2.1.0" dir-glob "^3.0.1" - fast-glob "^3.2.9" - ignore "^5.2.0" - merge2 "^1.4.1" + fast-glob "^3.0.3" + glob "^7.1.3" + ignore "^5.1.1" + merge2 "^1.2.3" slash "^3.0.0" gopd@^1.0.1: @@ -3016,7 +4379,7 @@ gopd@^1.0.1: dependencies: get-intrinsic "^1.1.3" -graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.11, graceful-fs@^4.2.4: +graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.11, graceful-fs@^4.2.4: version "4.2.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== @@ -3026,11 +4389,99 @@ graphemer@^1.4.0: resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== +handlebars@^4.0.1: + version "4.7.8" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.8.tgz#41c42c18b1be2365439188c77c6afae71c0cd9e9" + integrity sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ== + dependencies: + minimist "^1.2.5" + neo-async "^2.6.2" + source-map "^0.6.1" + wordwrap "^1.0.0" + optionalDependencies: + uglify-js "^3.1.4" + +hardhat-gas-reporter@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/hardhat-gas-reporter/-/hardhat-gas-reporter-2.2.1.tgz#ce0b5437fdcaf919479d7a51cf45d8d72cbcd16b" + integrity sha512-3AfPDGBn6VPmRKU65W28qVvG5x+qYL2gH9PAivd31oGj/ZHpZTutqXh6wq46993Vz35rnPDnrGo028U4/NP/Vw== + dependencies: + "@ethersproject/abi" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/units" "^5.7.0" + "@solidity-parser/parser" "^0.18.0" + axios "^1.6.7" + brotli-wasm "^2.0.1" + chalk "4.1.2" + cli-table3 "^0.6.3" + ethereum-cryptography "^2.1.3" + glob "^10.3.10" + jsonschema "^1.4.1" + lodash "^4.17.21" + markdown-table "2.0.0" + sha1 "^1.1.1" + viem "2.7.14" + +hardhat@^2.22.10: + version "2.22.15" + resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.22.15.tgz#319b4948f875968fde3f0d09a7edfe74e16b1365" + integrity sha512-BpTGa9PE/sKAaHi4s/S1e9WGv63DR1m7Lzfd60C8gSEchDPfAJssVRSq0MZ2v2k76ig9m0kHAwVLf5teYwu/Mw== + dependencies: + "@ethersproject/abi" "^5.1.2" + "@metamask/eth-sig-util" "^4.0.0" + "@nomicfoundation/edr" "^0.6.4" + "@nomicfoundation/ethereumjs-common" "4.0.4" + "@nomicfoundation/ethereumjs-tx" "5.0.4" + "@nomicfoundation/ethereumjs-util" "9.0.4" + "@nomicfoundation/solidity-analyzer" "^0.1.0" + "@sentry/node" "^5.18.1" + "@types/bn.js" "^5.1.0" + "@types/lru-cache" "^5.1.0" + adm-zip "^0.4.16" + aggregate-error "^3.0.0" + ansi-escapes "^4.3.0" + boxen "^5.1.2" + chalk "^2.4.2" + chokidar "^4.0.0" + ci-info "^2.0.0" + debug "^4.1.1" + enquirer "^2.3.0" + env-paths "^2.2.0" + ethereum-cryptography "^1.0.3" + ethereumjs-abi "^0.6.8" + find-up "^2.1.0" + fp-ts "1.19.3" + fs-extra "^7.0.1" + glob "7.2.0" + immutable "^4.0.0-rc.12" + io-ts "1.10.4" + json-stream-stringify "^3.1.4" + keccak "^3.0.2" + lodash "^4.17.11" + mnemonist "^0.38.0" + mocha "^10.0.0" + p-map "^4.0.0" + raw-body "^2.4.1" + resolve "1.17.0" + semver "^6.3.0" + solc "0.8.26" + source-map-support "^0.5.13" + stacktrace-parser "^0.1.10" + tsort "0.0.1" + undici "^5.14.0" + uuid "^8.3.2" + ws "^7.4.6" + has-bigints@^1.0.1, has-bigints@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.2.tgz#0871bd3e3d51626f6ca0966668ba35d5602d6eaa" integrity sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ== +has-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" + integrity sha512-DyYHfIYwAJmjAjSSPKANxI8bFY9YtFrgkAfinBojQ8YJTOuOuav64tMUJv584SES4xl74PmuaevIyaLESHdTAA== + has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" @@ -3082,7 +4533,7 @@ hash-base@~3.0: inherits "^2.0.1" safe-buffer "^5.0.1" -hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3: +hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== @@ -3090,6 +4541,14 @@ hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3: inherits "^2.0.3" minimalistic-assert "^1.0.1" +hasha@^5.0.0: + version "5.2.2" + resolved "https://registry.yarnpkg.com/hasha/-/hasha-5.2.2.tgz#a48477989b3b327aea3c04f53096d816d97522a1" + integrity sha512-Hrp5vIK/xr5SkeN2onO32H0MgNZ0f17HRNH39WfL0SYUNOTZ5Lz1TJ8Pajo/87dYGEFlLMm7mIc/k/s6Bvz9HQ== + dependencies: + is-stream "^2.0.0" + type-fest "^0.8.0" + hasown@^2.0.0, hasown@^2.0.1, hasown@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" @@ -3097,6 +4556,16 @@ hasown@^2.0.0, hasown@^2.0.1, hasown@^2.0.2: dependencies: function-bind "^1.1.2" +he@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" + integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== + +"heap@>= 0.2.0": + version "0.2.7" + resolved "https://registry.yarnpkg.com/heap/-/heap-0.2.7.tgz#1e6adf711d3f27ce35a81fe3b7bd576c2260a8fc" + integrity sha512-2bsegYkkHO+h/9MGbn6KWcE45cHZgPANo5LXF7EvWdT0yT2EguSVO1nDgU5c8+ZOPwp2vMNa7YFsJhVcDR9Sdg== + hmac-drbg@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" @@ -3106,19 +4575,48 @@ hmac-drbg@^1.0.1: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.1" +html-escaper@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" + integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== + +http-errors@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3" + integrity sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ== + dependencies: + depd "2.0.0" + inherits "2.0.4" + setprototypeof "1.2.0" + statuses "2.0.1" + toidentifier "1.0.1" + https-browserify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" integrity sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg== -iconv-lite@^0.4.24: +https-proxy-agent@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" + integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== + dependencies: + agent-base "6" + debug "4" + +iconv-lite@0.4.24, iconv-lite@^0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== dependencies: safer-buffer ">= 2.1.2 < 3" -ieee754@^1.2.1: +idb@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/idb/-/idb-8.0.0.tgz#33d7ed894ed36e23bcb542fb701ad579bfaad41f" + integrity sha512-l//qvlAKGmQO31Qn7xdzagVPPaHTxXx199MhrAFuVBTPqydcPYBWjkrbv4Y0ktB+GmWOiwHl237UUOrLmQxLvw== + +ieee754@^1.1.13, ieee754@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== @@ -3128,10 +4626,20 @@ ignore@^4.0.6: resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== -ignore@^5.2.0, ignore@^5.3.1: - version "5.3.1" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef" - integrity sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw== +ignore@^5.1.1, ignore@^5.2.0, ignore@^5.3.1: + version "5.3.2" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5" + integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g== + +immer@10.0.2: + version "10.0.2" + resolved "https://registry.yarnpkg.com/immer/-/immer-10.0.2.tgz#11636c5b77acf529e059582d76faf338beb56141" + integrity sha512-Rx3CqeqQ19sxUtYV9CU911Vhy8/721wRFnJv3REVGWUmoAcIwzifTsdmJte/MV+0/XpM35LZdQMBGkRIoLPwQA== + +immutable@^4.0.0-rc.12: + version "4.3.7" + resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.3.7.tgz#c70145fc90d89fb02021e65c84eb0226e4e5a381" + integrity sha512-1hqclzwYwjRDFLjcFxOM5AYkkG0rpFPpr1RLPMEuGczoS7YA8gLhy8SWXYRAA/XwfEHpfo3cw5JGioS32fnMRw== import-fresh@^3.0.0, import-fresh@^3.2.1: version "3.3.0" @@ -3142,9 +4650,9 @@ import-fresh@^3.0.0, import-fresh@^3.2.1: resolve-from "^4.0.0" import-local@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.1.0.tgz#b4479df8a5fd44f6cdce24070675676063c95cb4" - integrity sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg== + version "3.2.0" + resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.2.0.tgz#c3d5c745798c02a6f8b897726aba5100186ee260" + integrity sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA== dependencies: pkg-dir "^4.2.0" resolve-cwd "^3.0.0" @@ -3154,6 +4662,11 @@ imurmurhash@^0.1.4: resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== +indent-string@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" + integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== + inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -3162,11 +4675,16 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3, inherits@~2.0.4: +inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3, inherits@~2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== +ini@^1.3.5: + version "1.3.8" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" + integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== + inquirer@^6.2.2: version "6.5.2" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.2.tgz#ad50942375d036d327ff528c08bd5fab089928ca" @@ -3195,6 +4713,11 @@ internal-slot@^1.0.7: hasown "^2.0.0" side-channel "^1.0.4" +interpret@^1.0.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" + integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA== + interpret@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/interpret/-/interpret-3.1.1.tgz#5be0ceed67ca79c6c4bc5cf0d7ee843dcea110c4" @@ -3205,6 +4728,13 @@ invert-kv@^2.0.0: resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-2.0.0.tgz#7393f5afa59ec9ff5f67a27620d11c226e3eec02" integrity sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA== +io-ts@1.10.4: + version "1.10.4" + resolved "https://registry.yarnpkg.com/io-ts/-/io-ts-1.10.4.tgz#cd5401b138de88e4f920adbcb7026e2d1967e6e2" + integrity sha512-b23PteSnYXSONJ6JQXRAlvJhuw8KOtkqa87W4wDtvMrud/DTJd5X+NpOOI+O/zZwVq6v0VLAaJ+1EDViKEuN9g== + dependencies: + fp-ts "^1.0.0" + is-arguments@^1.0.4: version "1.1.1" resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.1.1.tgz#15b3f88fda01f2a97fec84ca761a560f123efa9b" @@ -3228,6 +4758,13 @@ is-bigint@^1.0.1: dependencies: has-bigints "^1.0.1" +is-binary-path@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" + integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== + dependencies: + binary-extensions "^2.0.0" + is-boolean-object@^1.1.0: version "1.1.2" resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.1.2.tgz#5c6dc200246dd9321ae4b885a114bb1f75f63719" @@ -3236,24 +4773,24 @@ is-boolean-object@^1.1.0: call-bind "^1.0.2" has-tostringtag "^1.0.0" -is-builtin-module@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-3.2.1.tgz#f03271717d8654cfcaf07ab0463faa3571581169" - integrity sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A== +is-bun-module@^1.0.2: + version "1.2.1" + resolved "https://registry.yarnpkg.com/is-bun-module/-/is-bun-module-1.2.1.tgz#495e706f42e29f086fd5fe1ac3c51f106062b9fc" + integrity sha512-AmidtEM6D6NmUiLOvvU7+IePxjEjOzra2h0pSrsfSAcXwl/83zLLXDByafUJy9k/rKK0pvXMLdwKwGHlX2Ke6Q== dependencies: - builtin-modules "^3.3.0" + semver "^7.6.3" is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.7: version "1.2.7" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA== -is-core-module@^2.11.0, is-core-module@^2.13.0, is-core-module@^2.13.1: - version "2.13.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384" - integrity sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw== +is-core-module@^2.13.0, is-core-module@^2.15.1: + version "2.15.1" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.15.1.tgz#a7363a25bee942fefab0de13bf6aa372c82dcc37" + integrity sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ== dependencies: - hasown "^2.0.0" + hasown "^2.0.2" is-data-view@^1.0.1: version "1.0.1" @@ -3286,6 +4823,11 @@ is-fullwidth-code-point@^2.0.0: resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" integrity sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w== +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + is-generator-function@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.0.10.tgz#f1558baf1ac17e0deea7c0415c438351ff2b3c72" @@ -3293,13 +4835,18 @@ is-generator-function@^1.0.7: dependencies: has-tostringtag "^1.0.0" -is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: version "4.0.3" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== dependencies: is-extglob "^2.1.1" +is-hex-prefixed@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz#7d8d37e6ad77e5d127148913c573e082d777f554" + integrity sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA== + is-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" @@ -3335,6 +4882,11 @@ is-path-inside@^3.0.3: resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== +is-plain-obj@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" + integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== + is-plain-object@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" @@ -3369,6 +4921,11 @@ is-stream@^1.1.0: resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" integrity sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ== +is-stream@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" + integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== + is-string@^1.0.5, is-string@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.7.tgz#0dd12bf2006f255bb58f695110eff7491eebc0fd" @@ -3376,6 +4933,13 @@ is-string@^1.0.5, is-string@^1.0.7: dependencies: has-tostringtag "^1.0.0" +is-subset-of@^3.1.10: + version "3.1.10" + resolved "https://registry.yarnpkg.com/is-subset-of/-/is-subset-of-3.1.10.tgz#d3f4331b9ca288318fae92ad5d953241b6f7b00b" + integrity sha512-avvaYgVmYWyaZ1NDFiv4y9JGkrE2je3op1Po4VYKKJKR8H2qVPsg1GZuuXl5elCTxTlwAIsrAjWAs4BVrISFRw== + dependencies: + typedescriptor "3.0.2" + is-symbol@^1.0.2, is-symbol@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.4.tgz#a6dac93b635b063ca6872236de88910a57af139c" @@ -3390,6 +4954,16 @@ is-typed-array@^1.1.13, is-typed-array@^1.1.3: dependencies: which-typed-array "^1.1.14" +is-typedarray@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA== + +is-unicode-supported@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7" + integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== + is-weakref@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-weakref/-/is-weakref-1.0.2.tgz#9529f383a9338205e89765e0392efc2f100f06f2" @@ -3397,6 +4971,11 @@ is-weakref@^1.0.2: dependencies: call-bind "^1.0.2" +is-windows@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== + isarray@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" @@ -3417,6 +4996,81 @@ isobject@^3.0.1: resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" integrity sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg== +isows@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/isows/-/isows-1.0.3.tgz#93c1cf0575daf56e7120bab5c8c448b0809d0d74" + integrity sha512-2cKei4vlmg2cxEjm3wVSqn8pcoRF/LX/wpifuuNquFO4SQmPwarClT+SUCA2lt+l581tTeZIPIZuIDo2jWN1fg== + +istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz#2d166c4b0644d43a39f04bf6c2edd1e585f31756" + integrity sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg== + +istanbul-lib-hook@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-3.0.0.tgz#8f84c9434888cc6b1d0a9d7092a76d239ebf0cc6" + integrity sha512-Pt/uge1Q9s+5VAZ+pCo16TYMWPBIl+oaNIjgLQxcX0itS6ueeaA+pEfThZpH8WxhFgCiEb8sAJY6MdUKgiIWaQ== + dependencies: + append-transform "^2.0.0" + +istanbul-lib-instrument@^6.0.2: + version "6.0.3" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz#fa15401df6c15874bcb2105f773325d78c666765" + integrity sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q== + dependencies: + "@babel/core" "^7.23.9" + "@babel/parser" "^7.23.9" + "@istanbuljs/schema" "^0.1.3" + istanbul-lib-coverage "^3.2.0" + semver "^7.5.4" + +istanbul-lib-processinfo@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/istanbul-lib-processinfo/-/istanbul-lib-processinfo-2.0.3.tgz#366d454cd0dcb7eb6e0e419378e60072c8626169" + integrity sha512-NkwHbo3E00oybX6NGJi6ar0B29vxyvNwoC7eJ4G4Yq28UfY758Hgn/heV8VRFhevPED4LXfFz0DQ8z/0kw9zMg== + dependencies: + archy "^1.0.0" + cross-spawn "^7.0.3" + istanbul-lib-coverage "^3.2.0" + p-map "^3.0.0" + rimraf "^3.0.0" + uuid "^8.3.2" + +istanbul-lib-report@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz#908305bac9a5bd175ac6a74489eafd0fc2445a7d" + integrity sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw== + dependencies: + istanbul-lib-coverage "^3.0.0" + make-dir "^4.0.0" + supports-color "^7.1.0" + +istanbul-lib-source-maps@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz#895f3a709fcfba34c6de5a42939022f3e4358551" + integrity sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw== + dependencies: + debug "^4.1.1" + istanbul-lib-coverage "^3.0.0" + source-map "^0.6.1" + +istanbul-reports@^3.0.2: + version "3.1.7" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.7.tgz#daed12b9e1dca518e15c056e1e537e741280fa0b" + integrity sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g== + dependencies: + html-escaper "^2.0.0" + istanbul-lib-report "^3.0.0" + +jackspeak@^3.1.2: + version "3.4.3" + resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-3.4.3.tgz#8833a9d89ab4acde6188942bd1c53b6390ed5a8a" + integrity sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw== + dependencies: + "@isaacs/cliui" "^8.0.2" + optionalDependencies: + "@pkgjs/parseargs" "^0.11.0" + jest-worker@^27.4.5: version "27.5.1" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.5.1.tgz#8d146f0900e8973b106b6f73cc1e9a8cb86f8db0" @@ -3426,6 +5080,11 @@ jest-worker@^27.4.5: merge-stream "^2.0.0" supports-color "^8.0.0" +js-base64@^3.6.0: + version "3.7.7" + resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-3.7.7.tgz#e51b84bf78fbf5702b9541e2cb7bfcb893b43e79" + integrity sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw== + js-sha3@0.8.0, js-sha3@^0.8.0: version "0.8.0" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" @@ -3436,7 +5095,7 @@ js-tokens@^4.0.0: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@^3.13.0: +js-yaml@3.x, js-yaml@^3.13.0, js-yaml@^3.13.1: version "3.14.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== @@ -3451,6 +5110,11 @@ js-yaml@^4.1.0: dependencies: argparse "^2.0.1" +jsesc@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-3.0.2.tgz#bb8b09a6597ba426425f2e4a07245c3d00b9343e" + integrity sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g== + json-buffer@3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" @@ -3476,6 +5140,16 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== +json-stream-stringify@^3.1.4: + version "3.1.6" + resolved "https://registry.yarnpkg.com/json-stream-stringify/-/json-stream-stringify-3.1.6.tgz#ebe32193876fb99d4ec9f612389a8d8e2b5d54d4" + integrity sha512-x7fpwxOkbhFCaJDJ8vb1fBY3DdSa4AlITaz+HHILQJzdPMnHEFjxPwVUi1ALIbcIxDE0PNe/0i7frnY8QnBQog== + +json-stringify-safe@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== + json5@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593" @@ -3483,7 +5157,7 @@ json5@^1.0.2: dependencies: minimist "^1.2.0" -json5@^2.1.2: +json5@^2.1.2, json5@^2.2.3: version "2.2.3" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== @@ -3495,6 +5169,20 @@ jsonfile@^4.0.0: optionalDependencies: graceful-fs "^4.1.6" +jsonfile@^6.0.1: + version "6.1.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" + integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== + dependencies: + universalify "^2.0.0" + optionalDependencies: + graceful-fs "^4.1.6" + +jsonschema@^1.2.4, jsonschema@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/jsonschema/-/jsonschema-1.4.1.tgz#cc4c3f0077fb4542982973d8a083b6b34f482dab" + integrity sha512-S6cATIPVv1z0IlxdN+zUk5EPjkGCdnhN4wVSBlvoUO1tOLJootbo9CquNJmbIh4yikWHiUedhRYrNPn1arpEmQ== + keccak@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/keccak/-/keccak-2.1.0.tgz#734ea53f2edcfd0f42cdb8d5f4c358fef052752b" @@ -3505,6 +5193,15 @@ keccak@^2.0.0: nan "^2.14.0" safe-buffer "^5.2.0" +keccak@^3.0.0, keccak@^3.0.2: + version "3.0.4" + resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.4.tgz#edc09b89e633c0549da444432ecf062ffadee86d" + integrity sha512-3vKuW0jV8J3XNTzvfyicFR5qvxrSAGl7KIhvgOu5cmWwM7tZRj3fMbj/pfIf4be7aznbc+prBWGjywox/g2Y6Q== + dependencies: + node-addon-api "^2.0.0" + node-gyp-build "^4.2.0" + readable-stream "^3.6.0" + keyv@^4.5.3: version "4.5.4" resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" @@ -3517,6 +5214,11 @@ kind-of@^6.0.2: resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== +kleur@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" + integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== + lcid@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/lcid/-/lcid-2.0.0.tgz#6ef5d2df60e52f82eb228a4c373e8d1f397253cf" @@ -3554,6 +5256,14 @@ loader-utils@^2.0.4: emojis-list "^3.0.0" json5 "^2.1.2" +locate-path@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + integrity sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA== + dependencies: + p-locate "^2.0.0" + path-exists "^3.0.0" + locate-path@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" @@ -3581,16 +5291,44 @@ lodash.camelcase@^4.3.0: resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" integrity sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA== +lodash.clonedeep@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" + integrity sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ== + +lodash.flattendeep@^4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2" + integrity sha512-uHaJFihxmJcEX3kT4I23ABqKKalJ/zDrDg0lsFtc1h+3uw49SIJ5beyhx5ExVRti3AvKoOJngIj7xz3oylPdWQ== + +lodash.isequal@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" + integrity sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ== + lodash.merge@^4.6.2: version "4.6.2" resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== -lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.14, lodash@^4.17.15: +lodash.truncate@^4.4.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" + integrity sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw== + +lodash@4.17.21, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.21: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== +log-symbols@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" + integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== + dependencies: + chalk "^4.1.0" + is-unicode-supported "^0.1.0" + loupe@^2.3.6: version "2.3.7" resolved "https://registry.yarnpkg.com/loupe/-/loupe-2.3.7.tgz#6e69b7d4db7d3ab436328013d37d1c8c3540c697" @@ -3598,19 +5336,48 @@ loupe@^2.3.6: dependencies: get-func-name "^2.0.1" -lru-cache@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" - integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== +lru-cache@^10.2.0: + version "10.4.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119" + integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ== + +lru-cache@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" + integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w== dependencies: - yallist "^4.0.0" + yallist "^3.0.2" + +lru_map@^0.3.3: + version "0.3.3" + resolved "https://registry.yarnpkg.com/lru_map/-/lru_map-0.3.3.tgz#b5c8351b9464cbd750335a79650a0ec0e56118dd" + integrity sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ== magic-string@^0.30.3: - version "0.30.9" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.9.tgz#8927ae21bfdd856310e07a1bc8dd5e73cb6c251d" - integrity sha512-S1+hd+dIrC8EZqKyT9DstTH/0Z+f76kmmvZnkfQVmOpDEF9iVgdYif3Q/pIWHmCoo59bQVGW0kVL3e2nl+9+Sw== + version "0.30.11" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.11.tgz#301a6f93b3e8c2cb13ac1a7a673492c0dfd12954" + integrity sha512-+Wri9p0QHMy+545hKww7YAu5NyzF8iomPL/RQazugQ9+Ez4Ic3mERMd8ZTX5rfK944j+560ZJi8iAwgak1Ac7A== dependencies: - "@jridgewell/sourcemap-codec" "^1.4.15" + "@jridgewell/sourcemap-codec" "^1.5.0" + +make-dir@^3.0.0, make-dir@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" + integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== + dependencies: + semver "^6.0.0" + +make-dir@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-4.0.0.tgz#c3c2307a771277cd9638305f915c29ae741b614e" + integrity sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw== + dependencies: + semver "^7.5.3" + +make-error@^1.1.1: + version "1.3.6" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" + integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== map-age-cleaner@^0.1.1: version "0.1.3" @@ -3619,6 +5386,13 @@ map-age-cleaner@^0.1.1: dependencies: p-defer "^1.0.0" +markdown-table@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-2.0.0.tgz#194a90ced26d31fe753d8b9434430214c011865b" + integrity sha512-Ezda85ToJUBhM6WGaG6veasyym+Tbs3cMAw/ZhOPqXiYsr0jgocBV3j3nx+4lk47plLlIqjwuTm/ywVI+zjJ/A== + dependencies: + repeat-string "^1.0.0" + md5.js@^1.3.4: version "1.3.5" resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" @@ -3637,12 +5411,17 @@ mem@^4.0.0: mimic-fn "^2.0.0" p-is-promise "^2.0.0" +memorystream@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/memorystream/-/memorystream-0.3.1.tgz#86d7090b30ce455d63fbae12dda51a47ddcaf9b2" + integrity sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw== + merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== -merge2@^1.3.0, merge2@^1.4.1: +merge2@^1.2.3, merge2@^1.3.0: version "1.4.1" resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== @@ -3653,11 +5432,11 @@ micro-ftch@^0.3.1: integrity sha512-/0LLxhzP0tfiR5hcQebtudP56gUurs2CLkGarnCiB/OqEyUFQ6U3paQi/tgLv0hBJYt2rnr9MNpxz4fiiugstg== micromatch@^4.0.4: - version "4.0.5" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" - integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== + version "4.0.8" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" + integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA== dependencies: - braces "^3.0.2" + braces "^3.0.3" picomatch "^2.3.1" miller-rabin@^4.0.0: @@ -3700,14 +5479,14 @@ minimalistic-crypto-utils@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg== -minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: +"minimatch@2 || 3", minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== dependencies: brace-expansion "^1.1.7" -minimatch@^5.0.1: +minimatch@^5.0.1, minimatch@^5.1.6: version "5.1.6" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== @@ -3715,18 +5494,23 @@ minimatch@^5.0.1: brace-expansion "^2.0.1" minimatch@^9.0.4: - version "9.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.4.tgz#8e49c731d1749cbec05050ee5145147b32496a51" - integrity sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw== + version "9.0.5" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5" + integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow== dependencies: brace-expansion "^2.0.1" -minimist@^1.2.0, minimist@^1.2.6: +minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6: version "1.2.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== -mkdirp@^0.5.1: +"minipass@^5.0.0 || ^6.0.2 || ^7.0.0", minipass@^7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707" + integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== + +mkdirp@0.5.x, mkdirp@^0.5.1: version "0.5.6" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6" integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw== @@ -3738,25 +5522,101 @@ mkdirp@^1.0.4: resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== -ms@2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== +mnemonist@^0.38.0: + version "0.38.5" + resolved "https://registry.yarnpkg.com/mnemonist/-/mnemonist-0.38.5.tgz#4adc7f4200491237fe0fa689ac0b86539685cade" + integrity sha512-bZTFT5rrPKtPJxj8KSV0WkPyNxl72vQepqqVUAW2ARUpUSF2qXMB6jZj7hW5/k7C1rtpzqbD/IIbJwLXUjCHeg== + dependencies: + obliterator "^2.0.0" -ms@^2.1.1: +mocha@^10.0.0, mocha@^10.2.0, mocha@^10.7.3: + version "10.7.3" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.7.3.tgz#ae32003cabbd52b59aece17846056a68eb4b0752" + integrity sha512-uQWxAu44wwiACGqjbPYmjo7Lg8sFrS3dQe7PP2FQI+woptP4vZXSMcfMyFL/e1yFEeEpV4RtyTpZROOKmxis+A== + dependencies: + ansi-colors "^4.1.3" + browser-stdout "^1.3.1" + chokidar "^3.5.3" + debug "^4.3.5" + diff "^5.2.0" + escape-string-regexp "^4.0.0" + find-up "^5.0.0" + glob "^8.1.0" + he "^1.2.0" + js-yaml "^4.1.0" + log-symbols "^4.1.0" + minimatch "^5.1.6" + ms "^2.1.3" + serialize-javascript "^6.0.2" + strip-json-comments "^3.1.1" + supports-color "^8.1.1" + workerpool "^6.5.1" + yargs "^16.2.0" + yargs-parser "^20.2.9" + yargs-unparser "^2.0.0" + +ms@^2.1.1, ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== +multibase@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/multibase/-/multibase-2.0.0.tgz#e20a2a14813fa435dc69c702909209ac0741919e" + integrity sha512-xIrqUVsinSlFjqj+OtEgCJ6MRl5hXjHMBPWsUt1ZGSRMx8rzm+7hCLE4wDeSA3COomlUC9zHCoUlvWjvAMtfDg== + dependencies: + base-x "^3.0.8" + buffer "^5.5.0" + web-encoding "^1.0.2" + +multibase@^4.0.1: + version "4.0.6" + resolved "https://registry.yarnpkg.com/multibase/-/multibase-4.0.6.tgz#6e624341483d6123ca1ede956208cb821b440559" + integrity sha512-x23pDe5+svdLz/k5JPGCVdfn7Q5mZVMBETiC+ORfO+sor9Sgs0smJzAjfTbM5tckeCqnaUuMYoz+k3RXMmJClQ== + dependencies: + "@multiformats/base-x" "^4.0.1" + +multicodec@^3.0.1, multicodec@^3.2.0: + version "3.2.1" + resolved "https://registry.yarnpkg.com/multicodec/-/multicodec-3.2.1.tgz#82de3254a0fb163a107c1aab324f2a91ef51efb2" + integrity sha512-+expTPftro8VAW8kfvcuNNNBgb9gPeNYV9dn+z1kJRWF2vih+/S79f2RVeIwmrJBUJ6NT9IUPWnZDQvegEh5pw== + dependencies: + uint8arrays "^3.0.0" + varint "^6.0.0" + +multiformats@^9.4.2: + version "9.9.0" + resolved "https://registry.yarnpkg.com/multiformats/-/multiformats-9.9.0.tgz#c68354e7d21037a8f1f8833c8ccd68618e8f1d37" + integrity sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg== + +multihashes@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/multihashes/-/multihashes-2.0.0.tgz#4fa599d2d726ec6de33bf1e6f6d9f04b2351ace9" + integrity sha512-Mp94Y+7h3oWQx8JickVghlWR6VhRPDnlv/KZEUyNP0ISSkNEe3kQkWoyIGt1B45D6cTLoulg+MP6bugVewx32Q== + dependencies: + buffer "^5.6.0" + multibase "^2.0.0" + varint "^5.0.0" + web-encoding "^1.0.2" + +multihashes@^4.0.1: + version "4.0.3" + resolved "https://registry.yarnpkg.com/multihashes/-/multihashes-4.0.3.tgz#426610539cd2551edbf533adeac4c06b3b90fb05" + integrity sha512-0AhMH7Iu95XjDLxIeuCOOE4t9+vQZsACyKZ9Fxw2pcsRmlX4iCn1mby0hS0bb+nQOVpdQYWPpnyusw4da5RPhA== + dependencies: + multibase "^4.0.1" + uint8arrays "^3.0.0" + varint "^5.0.2" + mute-stream@0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" integrity sha512-r65nCZhrbXXb6dXOACihYApHw2Q6pV0M3V0PSxd74N0+D8nzAdEAITq2oAjA1jVnKI+tGvEBUpqiMh0+rW6zDQ== nan@^2.14.0: - version "2.19.0" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.19.0.tgz#bb58122ad55a6c5bc973303908d5b16cfdd5a8c0" - integrity sha512-nO1xXxfh/RWNxfd/XPfbIfFk5vgLsAxUR9y5O0cHMJu/AW9U95JLXqthYHjEp+8gQ5p96K9jUp8nbVOxCdRbtw== + version "2.20.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.20.0.tgz#08c5ea813dd54ed16e5bd6505bf42af4f7838ca3" + integrity sha512-bk3gXBZDGILuuo/6sKtr0DQmSThYHLtNCdSdXk9YkxD/jK6X2vmCyyXBBxyqZ4XcnzTyYEAThfX3DCEnLf6igw== nanoassert@^2.0.0: version "2.0.0" @@ -3768,6 +5628,17 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== +ndjson@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ndjson/-/ndjson-2.0.0.tgz#320ac86f6fe53f5681897349b86ac6f43bfa3a19" + integrity sha512-nGl7LRGrzugTtaFcJMhLbpzJM6XdivmbkdlaGcrk/LXg2KL/YBC6z1g70xh0/al+oFuVFP8N8kiWRucmeEH/qQ== + dependencies: + json-stringify-safe "^5.0.1" + minimist "^1.2.5" + readable-stream "^3.6.0" + split2 "^3.0.0" + through2 "^4.0.0" + neo-async@^2.6.2: version "2.6.2" resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" @@ -3778,11 +5649,28 @@ nice-try@^1.0.4: resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== +node-addon-api@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-2.0.2.tgz#432cfa82962ce494b132e9d72a15b29f71ff5d32" + integrity sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA== + node-addon-api@^3.0.0: version "3.2.1" resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-3.2.1.tgz#81325e0a2117789c0128dab65e7e38f07ceba161" integrity sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A== +node-addon-api@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-5.1.0.tgz#49da1ca055e109a23d537e9de43c09cca21eb762" + integrity sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA== + +node-emoji@^1.10.0: + version "1.11.0" + resolved "https://registry.yarnpkg.com/node-emoji/-/node-emoji-1.11.0.tgz#69a0150e6946e2f115e9d7ea4df7971e2628301c" + integrity sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A== + dependencies: + lodash "^4.17.21" + node-fetch@^2.6.12: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" @@ -3790,15 +5678,15 @@ node-fetch@^2.6.12: dependencies: whatwg-url "^5.0.0" -node-gyp-build@^4.2.2: - version "4.8.0" - resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.8.0.tgz#3fee9c1731df4581a3f9ead74664369ff00d26dd" - integrity sha512-u6fs2AEUljNho3EYTJNBfImO5QTo/J/1Etd+NVdCj7qWKUSN/bSLkZwhDv7I+w/MSC6qJ4cknepkAYykDdK8og== +node-gyp-build@^4.2.0, node-gyp-build@^4.2.2: + version "4.8.2" + resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.8.2.tgz#4f802b71c1ab2ca16af830e6c1ea7dd1ad9496fa" + integrity sha512-IRUxE4BVsHWXkV/SFOut4qTlagw2aM8T5/vnTsmrHJvVoKueJHRc/JaFND7QDDc61kLYUJ6qlZM3sqTSyx2dTw== -node-polyfill-webpack-plugin@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/node-polyfill-webpack-plugin/-/node-polyfill-webpack-plugin-3.0.0.tgz#296b8235d081af368cd413f4c77e68c98919d99c" - integrity sha512-QpG496dDBiaelQZu9wDcVvpLbtk7h9Ctz693RaUMZBgl8DUoFToO90ZTLKq57gP7rwKqYtGbMBXkcEgLSag2jQ== +node-polyfill-webpack-plugin@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/node-polyfill-webpack-plugin/-/node-polyfill-webpack-plugin-4.0.0.tgz#99c4e4a0b41073b65aa8c584b0d195798aed2c76" + integrity sha512-WLk77vLpbcpmTekRj6s6vYxk30XoyaY5MDZ4+9g8OaKoG3Ij+TjOqhpQjVUlfDZBPBgpNATDltaQkzuXSnnkwg== dependencies: assert "^2.1.0" browserify-zlib "^0.2.0" @@ -3806,29 +5694,53 @@ node-polyfill-webpack-plugin@^3.0.0: console-browserify "^1.2.0" constants-browserify "^1.0.0" crypto-browserify "^3.12.0" - domain-browser "^4.22.0" + domain-browser "^5.7.0" events "^3.3.0" https-browserify "^1.0.0" os-browserify "^0.3.0" path-browserify "^1.0.1" process "^0.11.10" - punycode "^2.3.0" + punycode "^2.3.1" querystring-es3 "^0.2.1" - readable-stream "^4.4.2" + readable-stream "^4.5.2" stream-browserify "^3.0.0" stream-http "^3.2.0" string_decoder "^1.3.0" timers-browserify "^2.0.12" tty-browserify "^0.0.1" - type-fest "^4.4.0" + type-fest "^4.18.2" url "^0.11.3" util "^0.12.5" vm-browserify "^1.1.2" -node-releases@^2.0.14: - version "2.0.14" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.14.tgz#2ffb053bceb8b2be8495ece1ab6ce600c4461b0b" - integrity sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw== +node-preload@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/node-preload/-/node-preload-0.2.1.tgz#c03043bb327f417a18fee7ab7ee57b408a144301" + integrity sha512-RM5oyBy45cLEoHqCeh+MNuFAxO0vTFBLskvQbOKnEE7YTTSN4tbN8QWDIPQ6L+WvKsB/qLEGpYe2ZZ9d4W9OIQ== + dependencies: + process-on-spawn "^1.0.0" + +node-releases@^2.0.18: + version "2.0.18" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.18.tgz#f010e8d35e2fe8d6b2944f03f70213ecedc4ca3f" + integrity sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g== + +nofilter@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/nofilter/-/nofilter-3.1.0.tgz#c757ba68801d41ff930ba2ec55bab52ca184aa66" + integrity sha512-l2NNj07e9afPnhAhvgVrCD/oy2Ai1yfLpuo3EpiO1jFTsB4sFz6oIfAfSZyQzVpkZQ9xS8ZS5g1jCBgq4Hwo0g== + +nopt@3.x: + version "3.0.6" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" + integrity sha512-4GUt3kSEYmk4ITxzB/b9vaIDfUVWN/Ml1Fwl11IlnIG2iaJ9O6WXZ9SrYM9NLI8OCBieN2Y8SWC2oJV0RQ7qYg== + dependencies: + abbrev "1" + +normalize-path@^3.0.0, normalize-path@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== npm-run-path@^2.0.0: version "2.0.2" @@ -3842,10 +5754,51 @@ number-is-nan@^1.0.0: resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" integrity sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ== +number-to-bn@1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/number-to-bn/-/number-to-bn-1.7.0.tgz#bb3623592f7e5f9e0030b1977bd41a0c53fe1ea0" + integrity sha512-wsJ9gfSz1/s4ZsJN01lyonwuxA1tml6X1yBDnfpMglypcBRFZZkus26EdPSlqS5GJfYddVZa22p3VNb3z5m5Ig== + dependencies: + bn.js "4.11.6" + strip-hex-prefix "1.0.0" + +nyc@^17.1.0: + version "17.1.0" + resolved "https://registry.yarnpkg.com/nyc/-/nyc-17.1.0.tgz#b6349a401a62ffeb912bd38ea9a018839fdb6eb1" + integrity sha512-U42vQ4czpKa0QdI1hu950XuNhYqgoM+ZF1HT+VuUHL9hPfDPVvNQyltmMqdE9bUHMVa+8yNbc3QKTj8zQhlVxQ== + dependencies: + "@istanbuljs/load-nyc-config" "^1.0.0" + "@istanbuljs/schema" "^0.1.2" + caching-transform "^4.0.0" + convert-source-map "^1.7.0" + decamelize "^1.2.0" + find-cache-dir "^3.2.0" + find-up "^4.1.0" + foreground-child "^3.3.0" + get-package-type "^0.1.0" + glob "^7.1.6" + istanbul-lib-coverage "^3.0.0" + istanbul-lib-hook "^3.0.0" + istanbul-lib-instrument "^6.0.2" + istanbul-lib-processinfo "^2.0.2" + istanbul-lib-report "^3.0.0" + istanbul-lib-source-maps "^4.0.0" + istanbul-reports "^3.0.2" + make-dir "^3.0.0" + node-preload "^0.2.1" + p-map "^3.0.0" + process-on-spawn "^1.0.0" + resolve-from "^5.0.0" + rimraf "^3.0.0" + signal-exit "^3.0.2" + spawn-wrap "^2.0.0" + test-exclude "^6.0.0" + yargs "^15.0.2" + object-inspect@^1.13.1: - version "1.13.1" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.1.tgz#b96c6109324ccfef6b12216a956ca4dc2ff94bc2" - integrity sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ== + version "1.13.2" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.2.tgz#dea0088467fb991e67af4058147a24824a3043ff" + integrity sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g== object-is@^1.1.5: version "1.1.6" @@ -3870,7 +5823,7 @@ object.assign@^4.1.4, object.assign@^4.1.5: has-symbols "^1.0.3" object-keys "^1.1.1" -object.fromentries@^2.0.7: +object.fromentries@^2.0.8: version "2.0.8" resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.8.tgz#f7195d8a9b97bd95cbc1999ea939ecd1a2b00c65" integrity sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ== @@ -3880,7 +5833,7 @@ object.fromentries@^2.0.7: es-abstract "^1.23.2" es-object-atoms "^1.0.0" -object.groupby@^1.0.1: +object.groupby@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/object.groupby/-/object.groupby-1.0.3.tgz#9b125c36238129f6f7b61954a1e7176148d5002e" integrity sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ== @@ -3889,7 +5842,7 @@ object.groupby@^1.0.1: define-properties "^1.2.1" es-abstract "^1.23.2" -object.values@^1.1.7: +object.values@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.2.0.tgz#65405a9d92cee68ac2d303002e0b8470a4d9ab1b" integrity sha512-yBYjY9QX2hnRmZHAjG/f13MzmBzxzYgQhFrke06TTyKY5zSTEqkOeukBzIdVA3j3ulu8Qa3MbVFShV7T2RmGtQ== @@ -3898,7 +5851,12 @@ object.values@^1.1.7: define-properties "^1.2.1" es-object-atoms "^1.0.0" -once@^1.3.0, once@^1.3.1, once@^1.4.0: +obliterator@^2.0.0: + version "2.0.4" + resolved "https://registry.yarnpkg.com/obliterator/-/obliterator-2.0.4.tgz#fa650e019b2d075d745e44f1effeb13a2adbe816" + integrity sha512-lgHwxlxV1qIg1Eap7LgIeoBWIMFibOjbrYPIPJZcI1mmGAI2m3lNYpK12Y+GBdPQ0U1hRwSord7GIaawz962qQ== + +once@1.x, once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== @@ -3912,7 +5870,7 @@ onetime@^2.0.0: dependencies: mimic-fn "^1.0.0" -optionator@^0.8.2: +optionator@^0.8.1, optionator@^0.8.2: version "0.8.3" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA== @@ -3925,16 +5883,21 @@ optionator@^0.8.2: word-wrap "~1.2.3" optionator@^0.9.3: - version "0.9.3" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64" - integrity sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg== + version "0.9.4" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.4.tgz#7ea1c1a5d91d764fb282139c88fe11e182a3a734" + integrity sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g== dependencies: - "@aashutoshrathi/word-wrap" "^1.2.3" deep-is "^0.1.3" fast-levenshtein "^2.0.6" levn "^0.4.1" prelude-ls "^1.2.1" type-check "^0.4.0" + word-wrap "^1.2.5" + +ordinal@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/ordinal/-/ordinal-1.0.3.tgz#1a3c7726a61728112f50944ad7c35c06ae3a0d4d" + integrity sha512-cMddMgb2QElm8G7vdaa02jhUNbTSrhsgAGUz1OokD83uJTwSUn+nKoNoKVVaRa08yF6sgfO7Maou1+bgLd9rdQ== os-browserify@^0.3.0: version "0.3.0" @@ -3970,6 +5933,13 @@ p-is-promise@^2.0.0: resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-2.1.0.tgz#918cebaea248a62cf7ffab8e3bca8c5f882fc42e" integrity sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg== +p-limit@^1.1.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" + integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q== + dependencies: + p-try "^1.0.0" + p-limit@^2.0.0, p-limit@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" @@ -3984,6 +5954,13 @@ p-limit@^3.0.2: dependencies: yocto-queue "^0.1.0" +p-locate@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + integrity sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg== + dependencies: + p-limit "^1.1.0" + p-locate@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" @@ -4005,11 +5982,45 @@ p-locate@^5.0.0: dependencies: p-limit "^3.0.2" +p-map@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-3.0.0.tgz#d704d9af8a2ba684e2600d9a215983d4141a979d" + integrity sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ== + dependencies: + aggregate-error "^3.0.0" + +p-map@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-4.0.0.tgz#bb2f95a5eda2ec168ec9274e06a747c3e2904d2b" + integrity sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ== + dependencies: + aggregate-error "^3.0.0" + +p-try@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + integrity sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww== + p-try@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== +package-hash@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/package-hash/-/package-hash-4.0.0.tgz#3537f654665ec3cc38827387fc904c163c54f506" + integrity sha512-whdkPIooSu/bASggZ96BWVvZTRMOFxnyUG5PnTSGKoJE2gd5mbVNmR2Nj20QFzxYYgAXpoqC+AiXzl+UMRh7zQ== + dependencies: + graceful-fs "^4.1.15" + hasha "^5.0.0" + lodash.flattendeep "^4.4.0" + release-zalgo "^1.0.0" + +package-json-from-dist@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz#4f1471a010827a86f94cfd9b0727e36d267de505" + integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw== + pako@~1.0.5: version "1.0.11" resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" @@ -4069,11 +6080,19 @@ path-key@^3.1.0: resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== -path-parse@^1.0.7: +path-parse@^1.0.6, path-parse@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== +path-scurry@^1.11.1: + version "1.11.1" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.11.1.tgz#7960a668888594a0720b12a911d1a742ab9f11d2" + integrity sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA== + dependencies: + lru-cache "^10.2.0" + minipass "^5.0.0 || ^6.0.2 || ^7.0.0" + path-type@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" @@ -4084,7 +6103,7 @@ pathval@^1.1.1: resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d" integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ== -pbkdf2@^3.0.3, pbkdf2@^3.1.2: +pbkdf2@^3.0.17, pbkdf2@^3.0.3, pbkdf2@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.2.tgz#dd822aa0887580e52f1a039dc3eda108efae3075" integrity sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA== @@ -4095,17 +6114,32 @@ pbkdf2@^3.0.3, pbkdf2@^3.1.2: safe-buffer "^5.0.1" sha.js "^2.4.8" -picocolors@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" - integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== +picocolors@^1.0.0, picocolors@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.0.tgz#5358b76a78cde483ba5cef6a9dc9671440b27d59" + integrity sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw== -picomatch@^2.3.1: +picocolors@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" + integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== + +picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== -pkg-dir@^4.2.0: +picomatch@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.2.tgz#77c742931e8f3b8820946c76cd0c1f13730d1dab" + integrity sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg== + +pify@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" + integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== + +pkg-dir@^4.1.0, pkg-dir@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== @@ -4144,16 +6178,23 @@ prettier@^2.3.1: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== -prettier@^3.2.5: - version "3.2.5" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.5.tgz#e52bc3090586e824964a8813b09aba6233b28368" - integrity sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A== +prettier@^3.3.3: + version "3.3.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.3.tgz#30c54fe0be0d8d12e6ae61dbb10109ea00d53105" + integrity sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew== process-nextick-args@~2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== +process-on-spawn@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/process-on-spawn/-/process-on-spawn-1.0.0.tgz#95b05a23073d30a17acfdc92a440efd2baefdc93" + integrity sha512-1WsPDsUSMmZH5LeMLegqkPDrsGgsWwk1Exipy2hvB0o/F0ASzbpIctSCcZIK1ykJvtTJULEH+20WOFjMvGnCTg== + dependencies: + fromentries "^1.2.0" + process@^0.11.10: version "0.11.10" resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" @@ -4164,6 +6205,19 @@ progress@^2.0.0: resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== +prompts@^2.4.2: + version "2.4.2" + resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" + integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q== + dependencies: + kleur "^3.0.3" + sisteransi "^1.0.5" + +proxy-from-env@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" + integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== + public-encrypt@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.3.tgz#4fcc9d77a07e48ba7527e7cbe0de33d0701331e0" @@ -4177,9 +6231,9 @@ public-encrypt@^4.0.0: safe-buffer "^5.1.2" pump@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" - integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== + version "3.0.2" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.2.tgz#836f3edd6bc2ee599256c924ffe0d88573ddcbf8" + integrity sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw== dependencies: end-of-stream "^1.1.0" once "^1.3.1" @@ -4189,15 +6243,15 @@ punycode@^1.4.1: resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" integrity sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ== -punycode@^2.1.0, punycode@^2.3.0: +punycode@^2.1.0, punycode@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== -qs@^6.11.2: - version "6.12.1" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.12.1.tgz#39422111ca7cbdb70425541cba20c7d7b216599a" - integrity sha512-zWmv4RSuB9r2mYQw3zxQuHWeU+42aKi1wWig/j4ele4ygELZ7PEO6MM7rim9oAQH2A5MWfsAVf/jPvTPgCbvUQ== +qs@^6.12.3: + version "6.13.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.13.0.tgz#6ca3bd58439f7e245655798997787b0d88a51906" + integrity sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg== dependencies: side-channel "^1.0.6" @@ -4226,6 +6280,25 @@ randomfill@^1.0.3: randombytes "^2.0.5" safe-buffer "^5.1.0" +raw-body@^2.4.1: + version "2.5.2" + resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.2.tgz#99febd83b90e08975087e8f1f9419a149366b68a" + integrity sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA== + dependencies: + bytes "3.1.2" + http-errors "2.0.0" + iconv-lite "0.4.24" + unpipe "1.0.0" + +readable-stream@3, readable-stream@^3.0.0, readable-stream@^3.5.0, readable-stream@^3.6.0: + version "3.6.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" + integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + readable-stream@^2.3.8: version "2.3.8" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b" @@ -4239,16 +6312,7 @@ readable-stream@^2.3.8: string_decoder "~1.1.1" util-deprecate "~1.0.1" -readable-stream@^3.5.0, readable-stream@^3.6.0: - version "3.6.2" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" - integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== - dependencies: - inherits "^2.0.3" - string_decoder "^1.1.1" - util-deprecate "^1.0.1" - -readable-stream@^4.4.2: +readable-stream@^4.5.2: version "4.5.2" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-4.5.2.tgz#9e7fc4c45099baeed934bff6eb97ba6cf2729e09" integrity sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g== @@ -4259,6 +6323,25 @@ readable-stream@^4.4.2: process "^0.11.10" string_decoder "^1.3.0" +readdirp@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-4.0.2.tgz#388fccb8b75665da3abffe2d8f8ed59fe74c230a" + integrity sha512-yDMz9g+VaZkqBYS/ozoBJwaBhTbZo3UNYQHNRw1D3UFQB8oHB4uS/tAODO+ZLjGWmUbKnIlOWO+aaIiAxrUWHA== + +readdirp@~3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" + integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== + dependencies: + picomatch "^2.2.1" + +rechoir@^0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" + integrity sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw== + dependencies: + resolve "^1.1.6" + rechoir@^0.8.0: version "0.8.0" resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.8.0.tgz#49f866e0d32146142da3ad8f0eff352b3215ff22" @@ -4266,6 +6349,13 @@ rechoir@^0.8.0: dependencies: resolve "^1.20.0" +recursive-readdir@^2.2.2: + version "2.2.3" + resolved "https://registry.yarnpkg.com/recursive-readdir/-/recursive-readdir-2.2.3.tgz#e726f328c0d69153bcabd5c322d3195252379372" + integrity sha512-8HrF5ZsXk5FAH9dgsx3BlUer73nIhuj+9OrQwEbLTPOBzGkL1lsFCR01am+v+0m2Cmbs1nP12hLDl5FA7EszKA== + dependencies: + minimatch "^3.0.5" + reduce-flatten@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/reduce-flatten/-/reduce-flatten-2.0.0.tgz#734fd84e65f375d7ca4465c69798c25c9d10ae27" @@ -4281,11 +6371,28 @@ regexp.prototype.flags@^1.5.2: es-errors "^1.3.0" set-function-name "^2.0.1" +regexparam@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/regexparam/-/regexparam-3.0.0.tgz#1673e09d41cb7fd41eaafd4040a6aa90daa0a21a" + integrity sha512-RSYAtP31mvYLkAHrOlh25pCNQ5hWnT106VukGaaFfuJrZFkGRX5GhUAdPqpSDXxOhA2c4akmRuplv1mRqnBn6Q== + regexpp@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== +release-zalgo@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/release-zalgo/-/release-zalgo-1.0.0.tgz#09700b7e5074329739330e535c5a90fb67851730" + integrity sha512-gUAyHVHPPC5wdqX/LG4LWtRYtgjxyX78oanFNTMMyFEfOqdC54s3eE82imuWKbOeqYht2CrNf64Qb8vgmmtZGA== + dependencies: + es6-error "^4.0.1" + +repeat-string@^1.0.0: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + integrity sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w== + require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" @@ -4301,6 +6408,11 @@ require-main-filename@^1.0.1: resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" integrity sha512-IqSUtOVP4ksd1C/ej5zeEh/BIP2ajqpn8c5x+q99gvcIG/Qf0cud5raVnE/Dwd0ua9TXYDoDc0RE5hBSdz22Ug== +require-main-filename@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" + integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== + resolve-cwd@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" @@ -4323,7 +6435,19 @@ resolve-pkg-maps@^1.0.0: resolved "https://registry.yarnpkg.com/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz#616b3dc2c57056b5588c31cdf4b3d64db133720f" integrity sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw== -resolve@^1.20.0, resolve@^1.22.1, resolve@^1.22.4: +resolve@1.1.x: + version "1.1.7" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" + integrity sha512-9znBF0vBcaSN3W2j7wKvdERPwqTxSpCq+if5C0WoTCyV9n24rua28jeuQ2pL/HOf+yUe/Mef+H/5p60K0Id3bg== + +resolve@1.17.0: + version "1.17.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" + integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w== + dependencies: + path-parse "^1.0.6" + +resolve@^1.1.6, resolve@^1.20.0, resolve@^1.22.1, resolve@^1.22.4: version "1.22.8" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== @@ -4352,7 +6476,7 @@ rimraf@2.6.3: dependencies: glob "^7.1.3" -rimraf@^3.0.2: +rimraf@^3.0.0, rimraf@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== @@ -4367,6 +6491,13 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" +rlp@^2.2.3, rlp@^2.2.4: + version "2.2.7" + resolved "https://registry.yarnpkg.com/rlp/-/rlp-2.2.7.tgz#33f31c4afac81124ac4b283e2bd4d9720b30beaf" + integrity sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ== + dependencies: + bn.js "^5.2.0" + rollup-plugin-esbuild@^6.1.1: version "6.1.1" resolved "https://registry.yarnpkg.com/rollup-plugin-esbuild/-/rollup-plugin-esbuild-6.1.1.tgz#ec1dba647dbe1974f76192c75e907aa6eb636399" @@ -4377,28 +6508,29 @@ rollup-plugin-esbuild@^6.1.1: es-module-lexer "^1.3.1" get-tsconfig "^4.7.2" -rollup@^4.14.1: - version "4.14.1" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.14.1.tgz#228d5159c3f4d8745bd24819d734bc6c6ca87c09" - integrity sha512-4LnHSdd3QK2pa1J6dFbfm1HN0D7vSK/ZuZTsdyUAlA6Rr1yTouUTL13HaDOGJVgby461AhrNGBS7sCGXXtT+SA== +rollup@^4.24.0: + version "4.24.0" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.24.0.tgz#c14a3576f20622ea6a5c9cad7caca5e6e9555d05" + integrity sha512-DOmrlGSXNk1DM0ljiQA+i+o0rSLhtii1je5wgk60j49d1jHT5YYttBv1iWOnYSTG+fZZESUOSNiAl89SIet+Cg== dependencies: - "@types/estree" "1.0.5" + "@types/estree" "1.0.6" optionalDependencies: - "@rollup/rollup-android-arm-eabi" "4.14.1" - "@rollup/rollup-android-arm64" "4.14.1" - "@rollup/rollup-darwin-arm64" "4.14.1" - "@rollup/rollup-darwin-x64" "4.14.1" - "@rollup/rollup-linux-arm-gnueabihf" "4.14.1" - "@rollup/rollup-linux-arm64-gnu" "4.14.1" - "@rollup/rollup-linux-arm64-musl" "4.14.1" - "@rollup/rollup-linux-powerpc64le-gnu" "4.14.1" - "@rollup/rollup-linux-riscv64-gnu" "4.14.1" - "@rollup/rollup-linux-s390x-gnu" "4.14.1" - "@rollup/rollup-linux-x64-gnu" "4.14.1" - "@rollup/rollup-linux-x64-musl" "4.14.1" - "@rollup/rollup-win32-arm64-msvc" "4.14.1" - "@rollup/rollup-win32-ia32-msvc" "4.14.1" - "@rollup/rollup-win32-x64-msvc" "4.14.1" + "@rollup/rollup-android-arm-eabi" "4.24.0" + "@rollup/rollup-android-arm64" "4.24.0" + "@rollup/rollup-darwin-arm64" "4.24.0" + "@rollup/rollup-darwin-x64" "4.24.0" + "@rollup/rollup-linux-arm-gnueabihf" "4.24.0" + "@rollup/rollup-linux-arm-musleabihf" "4.24.0" + "@rollup/rollup-linux-arm64-gnu" "4.24.0" + "@rollup/rollup-linux-arm64-musl" "4.24.0" + "@rollup/rollup-linux-powerpc64le-gnu" "4.24.0" + "@rollup/rollup-linux-riscv64-gnu" "4.24.0" + "@rollup/rollup-linux-s390x-gnu" "4.24.0" + "@rollup/rollup-linux-x64-gnu" "4.24.0" + "@rollup/rollup-linux-x64-musl" "4.24.0" + "@rollup/rollup-win32-arm64-msvc" "4.24.0" + "@rollup/rollup-win32-ia32-msvc" "4.24.0" + "@rollup/rollup-win32-x64-msvc" "4.24.0" fsevents "~2.3.2" run-async@^2.2.0: @@ -4454,6 +6586,26 @@ safe-regex-test@^1.0.3: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== +sc-istanbul@^0.4.5: + version "0.4.6" + resolved "https://registry.yarnpkg.com/sc-istanbul/-/sc-istanbul-0.4.6.tgz#cf6784355ff2076f92d70d59047d71c13703e839" + integrity sha512-qJFF/8tW/zJsbyfh/iT/ZM5QNHE3CXxtLJbZsL+CzdJLBsPD7SedJZoUA4d8iAcN2IoMp/Dx80shOOd2x96X/g== + dependencies: + abbrev "1.0.x" + async "1.x" + escodegen "1.8.x" + esprima "2.7.x" + glob "^5.0.15" + handlebars "^4.0.1" + js-yaml "3.x" + mkdirp "0.5.x" + nopt "3.x" + once "1.x" + resolve "1.1.x" + supports-color "^3.1.0" + which "^1.1.1" + wordwrap "^1.0.0" + schema-utils@^3.1.1, schema-utils@^3.2.0: version "3.3.0" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-3.3.0.tgz#f50a88877c3c01652a15b622ae9e9795df7a60fe" @@ -4463,29 +6615,36 @@ schema-utils@^3.1.1, schema-utils@^3.2.0: ajv "^6.12.5" ajv-keywords "^3.5.2" -scrypt-js@3.0.1: +scrypt-js@3.0.1, scrypt-js@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== +secp256k1@^4.0.1: + version "4.0.4" + resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-4.0.4.tgz#58f0bfe1830fe777d9ca1ffc7574962a8189f8ab" + integrity sha512-6JfvwvjUOn8F/jUoBY2Q1v5WY5XS+rj8qSe0v8Y4ezH4InLgTEeOOPQsRll9OV429Pvo6BCHGavIyJfr3TAhsw== + dependencies: + elliptic "^6.5.7" + node-addon-api "^5.0.0" + node-gyp-build "^4.2.0" + semver@^5.5.0, semver@^5.5.1: version "5.7.2" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== -semver@^6.3.1: +semver@^6.0.0, semver@^6.3.0, semver@^6.3.1: version "6.3.1" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.5.4, semver@^7.6.0: - version "7.6.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d" - integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg== - dependencies: - lru-cache "^6.0.0" +semver@^7.3.4, semver@^7.5.3, semver@^7.5.4, semver@^7.6.0, semver@^7.6.3: + version "7.6.3" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" + integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== -serialize-javascript@^6.0.1: +serialize-javascript@^6.0.1, serialize-javascript@^6.0.2: version "6.0.2" resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.2.tgz#defa1e055c83bf6d59ea805d8da862254eb6a6c2" integrity sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g== @@ -4519,11 +6678,16 @@ set-function-name@^2.0.1: functions-have-names "^1.2.3" has-property-descriptors "^1.0.2" -setimmediate@^1.0.4: +setimmediate@^1.0.4, setimmediate@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" integrity sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA== +setprototypeof@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" + integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== + sha.js@^2.4.0, sha.js@^2.4.8: version "2.4.11" resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" @@ -4532,6 +6696,14 @@ sha.js@^2.4.0, sha.js@^2.4.8: inherits "^2.0.1" safe-buffer "^5.0.1" +sha1@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/sha1/-/sha1-1.1.1.tgz#addaa7a93168f393f19eb2b15091618e2700f848" + integrity sha512-dZBS6OrMjtgVkopB1Gmo4RQCDKiZsqcpAQpkV/aaj+FCrCg8r4I4qMkDPQjBgLIxlmu9k4nUbWq6ohXahOneYA== + dependencies: + charenc ">= 0.0.1" + crypt ">= 0.0.1" + shallow-clone@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-3.0.1.tgz#8f2981ad92531f55035b01fb230769a40e02efa3" @@ -4563,6 +6735,15 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== +shelljs@^0.8.3: + version "0.8.5" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c" + integrity sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow== + dependencies: + glob "^7.0.0" + interpret "^1.0.0" + rechoir "^0.6.2" + side-channel@^1.0.4, side-channel@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.6.tgz#abd25fb7cd24baf45466406b1096b7831c9215f2" @@ -4578,6 +6759,16 @@ signal-exit@^3.0.0, signal-exit@^3.0.2: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== +signal-exit@^4.0.1: + version "4.1.0" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" + integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== + +sisteransi@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" + integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== + slash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" @@ -4592,12 +6783,59 @@ slice-ansi@^2.1.0: astral-regex "^1.0.0" is-fullwidth-code-point "^2.0.0" +slice-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-4.0.0.tgz#500e8dd0fd55b05815086255b3195adf2a45fe6b" + integrity sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ== + dependencies: + ansi-styles "^4.0.0" + astral-regex "^2.0.0" + is-fullwidth-code-point "^3.0.0" + +solc@0.8.26: + version "0.8.26" + resolved "https://registry.yarnpkg.com/solc/-/solc-0.8.26.tgz#afc78078953f6ab3e727c338a2fefcd80dd5b01a" + integrity sha512-yiPQNVf5rBFHwN6SIf3TUUvVAFKcQqmSUFeq+fb6pNRCo0ZCgpYOZDi3BVoezCPIAcKrVYd/qXlBLUP9wVrZ9g== + dependencies: + command-exists "^1.2.8" + commander "^8.1.0" + follow-redirects "^1.12.1" + js-sha3 "0.8.0" + memorystream "^0.3.1" + semver "^5.5.0" + tmp "0.0.33" + +solidity-coverage@^0.8.13: + version "0.8.13" + resolved "https://registry.yarnpkg.com/solidity-coverage/-/solidity-coverage-0.8.13.tgz#8eeada2e82ae19d25568368aa782a2baad0e0ce7" + integrity sha512-RiBoI+kF94V3Rv0+iwOj3HQVSqNzA9qm/qDP1ZDXK5IX0Cvho1qiz8hAXTsAo6KOIUeP73jfscq0KlLqVxzGWA== + dependencies: + "@ethersproject/abi" "^5.0.9" + "@solidity-parser/parser" "^0.18.0" + chalk "^2.4.2" + death "^1.1.0" + difflib "^0.2.4" + fs-extra "^8.1.0" + ghost-testrpc "^0.0.2" + global-modules "^2.0.0" + globby "^10.0.1" + jsonschema "^1.2.4" + lodash "^4.17.21" + mocha "^10.2.0" + node-emoji "^1.10.0" + pify "^4.0.1" + recursive-readdir "^2.2.2" + sc-istanbul "^0.4.5" + semver "^7.3.4" + shelljs "^0.8.3" + web3-utils "^1.3.6" + source-list-map@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34" integrity sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw== -source-map-support@~0.5.20: +source-map-support@^0.5.13, source-map-support@~0.5.20: version "0.5.21" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== @@ -4605,16 +6843,54 @@ source-map-support@~0.5.20: buffer-from "^1.0.0" source-map "^0.6.0" -source-map@^0.6.0, source-map@~0.6.1: +source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== +source-map@~0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.2.0.tgz#dab73fbcfc2ba819b4de03bd6f6eaa48164b3f9d" + integrity sha512-CBdZ2oa/BHhS4xj5DlhjWNHcan57/5YuvfdLf17iVmIpd9KRm+DFLmC6nBNj+6Ua7Kt3TmOjDpQT1aTYOQtoUA== + dependencies: + amdefine ">=0.0.4" + +spawn-wrap@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/spawn-wrap/-/spawn-wrap-2.0.0.tgz#103685b8b8f9b79771318827aa78650a610d457e" + integrity sha512-EeajNjfN9zMnULLwhZZQU3GWBoFNkbngTUPfaawT4RkMiviTxcX0qfhVbGey39mfctfDHkWtuecgQ8NJcyQWHg== + dependencies: + foreground-child "^2.0.0" + is-windows "^1.0.2" + make-dir "^3.0.0" + rimraf "^3.0.0" + signal-exit "^3.0.2" + which "^2.0.1" + +split2@^3.0.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/split2/-/split2-3.2.2.tgz#bf2cf2a37d838312c249c89206fd7a17dd12365f" + integrity sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg== + dependencies: + readable-stream "^3.0.0" + sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== +stacktrace-parser@^0.1.10: + version "0.1.10" + resolved "https://registry.yarnpkg.com/stacktrace-parser/-/stacktrace-parser-0.1.10.tgz#29fb0cae4e0d0b85155879402857a1639eb6051a" + integrity sha512-KJP1OCML99+8fhOHxwwzyWrlUuVX5GQ0ZpJTd1DFXhdkrvg1szxfHhawXUZ3g9TkXORQd4/WG68jMlQZ2p8wlg== + dependencies: + type-fest "^0.7.1" + +statuses@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" + integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== + stream-browserify@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-3.0.0.tgz#22b0a2850cdf6503e73085da1fc7b7d0c2122f2f" @@ -4638,6 +6914,15 @@ string-format@^2.0.0: resolved "https://registry.yarnpkg.com/string-format/-/string-format-2.0.0.tgz#f2df2e7097440d3b65de31b6d40d54c96eaffb9b" integrity sha512-bbEs3scLeYNXLecRRuk6uJxdXUSj6le/8rNPHChIJTn2V79aXVTR1EH2OH5zLKKoz0V02fOUKZZcw01pLUShZA== +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string-width@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" @@ -4664,6 +6949,24 @@ string-width@^3.0.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" +string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^5.0.1, string-width@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" + integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== + dependencies: + eastasianwidth "^0.2.0" + emoji-regex "^9.2.2" + strip-ansi "^7.0.1" + string.prototype.trim@^1.2.9: version "1.2.9" resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz#b6fa326d72d2c78b6df02f7759c73f8f6274faa4" @@ -4706,28 +7009,14 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -strip-ansi@^3.0.0, strip-ansi@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" - integrity sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg== +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== dependencies: - ansi-regex "^2.0.0" + ansi-regex "^5.0.1" -strip-ansi@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" - integrity sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow== - dependencies: - ansi-regex "^3.0.0" - -strip-ansi@^5.1.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" - integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== - dependencies: - ansi-regex "^4.1.0" - -strip-ansi@^6.0.1: +strip-ansi@6.0.1, strip-ansi@^3.0.0, strip-ansi@^3.0.1, strip-ansi@^4.0.0, strip-ansi@^5.1.0, strip-ansi@^6.0.0, strip-ansi@^6.0.1, strip-ansi@^7.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -4739,11 +7028,23 @@ strip-bom@^3.0.0: resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" integrity sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA== +strip-bom@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" + integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== + strip-eof@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" integrity sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q== +strip-hex-prefix@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz#0c5f155fef1151373377de9dbb588da05500e36f" + integrity sha512-q8d4ue7JGEiVcypji1bALTos+0pWtyGlivAWyPuTkHzuTCJqrK9sWxYQZUq6Nq3cuyv3bm734IhHvHtGGURU6A== + dependencies: + is-hex-prefixed "1.0.0" + strip-json-comments@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" @@ -4754,10 +7055,12 @@ strip-json-comments@^3.1.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== -superstruct@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/superstruct/-/superstruct-1.0.4.tgz#0adb99a7578bd2f1c526220da6571b2d485d91ca" - integrity sha512-7JpaAoX2NGyoFlI9NBh66BQXGONc+uE+MRS5i2iOBKuS4e+ccgMDjATgZldkah+33DakBxDHiss9kvUcGAO8UQ== +supports-color@^3.1.0: + version "3.2.3" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" + integrity sha512-Jds2VIYDrlp5ui7t8abHN2bjAu4LV/q4N2KivFPpGH0lrka0BMq/33AmECUXlKPcHigkNaqfXRENFju+rlcy+A== + dependencies: + has-flag "^1.0.0" supports-color@^5.3.0: version "5.5.0" @@ -4773,7 +7076,7 @@ supports-color@^7.1.0: dependencies: has-flag "^4.0.0" -supports-color@^8.0.0: +supports-color@^8.0.0, supports-color@^8.1.1: version "8.1.1" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== @@ -4785,10 +7088,10 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -synckit@^0.8.6: - version "0.8.8" - resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.8.8.tgz#fe7fe446518e3d3d49f5e429f443cf08b6edfcd7" - integrity sha512-HwOKAP7Wc5aRGYdKH+dw0PRRpbO841v2DENBtjnR5HFWoiNByAl7vrx3p0G/rCyYXQsrxqtX48TImFtPcIHSpQ== +synckit@^0.9.1: + version "0.9.1" + resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.9.1.tgz#febbfbb6649979450131f64735aa3f6c14575c88" + integrity sha512-7gr8p9TQP6RAHusBOSLs46F4564ZrjV8xFmw5zCmgmhGUcw2hxsShhJ6CEiHQMgPDwAQ1fWHPM0ypc4RMAig4A== dependencies: "@pkgr/core" "^0.1.0" tslib "^2.6.2" @@ -4813,6 +7116,17 @@ table@^5.2.3: slice-ansi "^2.1.0" string-width "^3.0.0" +table@^6.8.0: + version "6.8.2" + resolved "https://registry.yarnpkg.com/table/-/table-6.8.2.tgz#c5504ccf201213fa227248bdc8c5569716ac6c58" + integrity sha512-w2sfv80nrAh2VCbqR5AK27wswXhqcck2AhfnNW76beQXskGZ1V12GwS//yYVa3d3fcvAip2OUnbDAjW2k3v9fA== + dependencies: + ajv "^8.0.1" + lodash.truncate "^4.4.2" + slice-ansi "^4.0.0" + string-width "^4.2.3" + strip-ansi "^6.0.1" + tapable@^2.1.1, tapable@^2.2.0: version "2.2.1" resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" @@ -4830,20 +7144,36 @@ terser-webpack-plugin@^5.3.10: terser "^5.26.0" terser@^5.26.0: - version "5.30.4" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.30.4.tgz#62b4d16a819424e6317fd5ceffb4ee8dc769803a" - integrity sha512-xRdd0v64a8mFK9bnsKVdoNP9GQIKUAaJPTaqEQDL4w/J8WaW4sWXXoMZ+6SimPkfT5bElreXf8m9HnmPc3E1BQ== + version "5.33.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.33.0.tgz#8f9149538c7468ffcb1246cfec603c16720d2db1" + integrity sha512-JuPVaB7s1gdFKPKTelwUyRq5Sid2A3Gko2S0PncwdBq7kN9Ti9HPWDQ06MPsEDGsZeVESjKEnyGy68quBk1w6g== dependencies: "@jridgewell/source-map" "^0.3.3" acorn "^8.8.2" commander "^2.20.0" source-map-support "~0.5.20" +test-exclude@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" + integrity sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w== + dependencies: + "@istanbuljs/schema" "^0.1.2" + glob "^7.1.4" + minimatch "^3.0.4" + text-table@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== +through2@^4.0.0: + version "4.0.2" + resolved "https://registry.yarnpkg.com/through2/-/through2-4.0.2.tgz#a7ce3ac2a7a8b0b966c80e7c49f0484c3b239764" + integrity sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw== + dependencies: + readable-stream "3" + through@^2.3.6: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" @@ -4856,7 +7186,7 @@ timers-browserify@^2.0.12: dependencies: setimmediate "^1.0.4" -tmp@^0.0.33: +tmp@0.0.33, tmp@^0.0.33: version "0.0.33" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== @@ -4870,6 +7200,11 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" +toidentifier@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" + integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== + tr46@~0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" @@ -4895,6 +7230,25 @@ ts-essentials@^7.0.1: resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-7.0.3.tgz#686fd155a02133eedcc5362dc8b5056cde3e5a38" integrity sha512-8+gr5+lqO3G84KdiTSMRLtuyJ+nTBVRKuCrK4lidMPdVeEp0uqC875uE5NMcaA7YYMN7XsNiFQuMvasF8HT/xQ== +ts-node@^10.9.2: + version "10.9.2" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.2.tgz#70f021c9e185bccdca820e26dc413805c101c71f" + integrity sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ== + dependencies: + "@cspotcode/source-map-support" "^0.8.0" + "@tsconfig/node10" "^1.0.7" + "@tsconfig/node12" "^1.0.7" + "@tsconfig/node14" "^1.0.0" + "@tsconfig/node16" "^1.0.2" + acorn "^8.4.1" + acorn-walk "^8.1.1" + arg "^4.1.0" + create-require "^1.1.0" + diff "^4.0.1" + make-error "^1.1.1" + v8-compile-cache-lib "^3.0.1" + yn "3.1.1" + tsc@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/tsc/-/tsc-2.0.4.tgz#5f6499146abea5dca4420b451fa4f2f9345238f5" @@ -4910,20 +7264,20 @@ tsconfig-paths@^3.15.0: minimist "^1.2.6" strip-bom "^3.0.0" -tslib@2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" - integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== +tslib@2.7.0, tslib@^2.6.2: + version "2.7.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01" + integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA== -tslib@^1.9.0: +tslib@^1.9.0, tslib@^1.9.3: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" - integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== +tsort@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/tsort/-/tsort-0.0.1.tgz#e2280f5e817f8bf4275657fd0f9aebd44f5a2786" + integrity sha512-Tyrf5mxF8Ofs1tNoxA13lFeZ2Zrbd6cKbuH3V+MQ5sb6DtBj5FjrXVsRWT8YvNAQTqNoz66dz1WsbigI22aEnw== tty-browserify@^0.0.1: version "0.0.1" @@ -4954,20 +7308,35 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" -type-detect@^4.0.0, type-detect@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" - integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== +type-detect@^4.0.0, type-detect@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.1.0.tgz#deb2453e8f08dcae7ae98c626b13dddb0155906c" + integrity sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw== type-fest@^0.20.2: version "0.20.2" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== -type-fest@^4.4.0: - version "4.17.0" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-4.17.0.tgz#4c1b2c2852d2a40ba8c0236d3afc6fc68229e5bf" - integrity sha512-9flrz1zkfLRH3jO3bLflmTxryzKMxVa7841VeMgBaNQGY6vH4RCcpN/sQLB7mQQYh1GZ5utT2deypMuCy4yicw== +type-fest@^0.21.3: + version "0.21.3" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" + integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== + +type-fest@^0.7.1: + version "0.7.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.7.1.tgz#8dda65feaf03ed78f0a3f9678f1869147f7c5c48" + integrity sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg== + +type-fest@^0.8.0: + version "0.8.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" + integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== + +type-fest@^4.18.2: + version "4.26.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-4.26.1.tgz#a4a17fa314f976dd3e6d6675ef6c775c16d7955e" + integrity sha512-yOGpmOAL7CkKe/91I5O3gPICmJNLJ1G4zFYVAsRHg7M64biSnPtRj0WNQt++bRkjYOqjWXrhnUw1utzmVErAdg== typechain@^8.3.2: version "8.3.2" @@ -5029,10 +7398,22 @@ typed-array-length@^1.0.6: is-typed-array "^1.1.13" possible-typed-array-names "^1.0.0" -typescript@^5.4.4: - version "5.4.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.4.tgz#eb2471e7b0a5f1377523700a21669dce30c2d952" - integrity sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw== +typedarray-to-buffer@^3.1.5: + version "3.1.5" + resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" + integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== + dependencies: + is-typedarray "^1.0.0" + +typedescriptor@3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/typedescriptor/-/typedescriptor-3.0.2.tgz#9ad1715bc2be1cf063d5acbc4cd4bfc96d644225" + integrity sha512-hyVbaCUd18UiXk656g/imaBLMogpdijIEpnhWYrSda9rhvO4gOU16n2nh7xG5lv/rjumnZzGOdz0CEGTmFe0fQ== + +typescript@^5.6.3: + version "5.6.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.3.tgz#5f3449e31c9d94febb17de03cc081dd56d81db5b" + integrity sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw== typical@^4.0.0: version "4.0.0" @@ -5044,6 +7425,18 @@ typical@^5.2.0: resolved "https://registry.yarnpkg.com/typical/-/typical-5.2.0.tgz#4daaac4f2b5315460804f0acf6cb69c52bb93066" integrity sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg== +uglify-js@^3.1.4: + version "3.19.3" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.19.3.tgz#82315e9bbc6f2b25888858acd1fff8441035b77f" + integrity sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ== + +uint8arrays@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/uint8arrays/-/uint8arrays-3.1.1.tgz#2d8762acce159ccd9936057572dade9459f65ae0" + integrity sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg== + dependencies: + multiformats "^9.4.2" + unbox-primitive@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e" @@ -5054,23 +7447,48 @@ unbox-primitive@^1.0.2: has-symbols "^1.0.3" which-boxed-primitive "^1.0.2" -undici-types@~5.26.4: - version "5.26.5" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" - integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== +undici-types@~6.19.2, undici-types@~6.19.8: + version "6.19.8" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" + integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== + +undici@^5.14.0: + version "5.28.4" + resolved "https://registry.yarnpkg.com/undici/-/undici-5.28.4.tgz#6b280408edb6a1a604a9b20340f45b422e373068" + integrity sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g== + dependencies: + "@fastify/busboy" "^2.0.0" universalify@^0.1.0: version "0.1.2" resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== -update-browserslist-db@^1.0.13: - version "1.0.13" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz#3c5e4f5c083661bd38ef64b6328c26ed6c8248c4" - integrity sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg== +universalify@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d" + integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw== + +unpipe@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" + integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== + +update-browserslist-db@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz#7ca61c0d8650766090728046e416a8cde682859e" + integrity sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ== dependencies: - escalade "^3.1.1" - picocolors "^1.0.0" + escalade "^3.1.2" + picocolors "^1.0.1" + +update-browserslist-db@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz#80846fba1d79e82547fb661f8d141e0945755fe5" + integrity sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A== + dependencies: + escalade "^3.2.0" + picocolors "^1.1.0" uri-js@^4.2.2: version "4.4.1" @@ -5080,19 +7498,24 @@ uri-js@^4.2.2: punycode "^2.1.0" url@^0.11.3: - version "0.11.3" - resolved "https://registry.yarnpkg.com/url/-/url-0.11.3.tgz#6f495f4b935de40ce4a0a52faee8954244f3d3ad" - integrity sha512-6hxOLGfZASQK/cijlZnZJTq8OXAkt/3YGfQX45vvMYXpZoo8NdWZcY73K108Jf759lS1Bv/8wXnHDTSz17dSRw== + version "0.11.4" + resolved "https://registry.yarnpkg.com/url/-/url-0.11.4.tgz#adca77b3562d56b72746e76b330b7f27b6721f3c" + integrity sha512-oCwdVC7mTuWiPyjLUz/COz5TLk6wgp0RCsN+wHZ2Ekneac9w8uuV0njcbbie2ME+Vs+d6duwmYuR3HgQXs1fOg== dependencies: punycode "^1.4.1" - qs "^6.11.2" + qs "^6.12.3" + +utf8@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/utf8/-/utf8-3.0.0.tgz#f052eed1364d696e769ef058b183df88c87f69d1" + integrity sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ== util-deprecate@^1.0.1, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== -util@^0.12.5: +util@^0.12.3, util@^0.12.5: version "0.12.5" resolved "https://registry.yarnpkg.com/util/-/util-0.12.5.tgz#5f17a6059b73db61a875668781a1c2b136bd6fbc" integrity sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA== @@ -5103,16 +7526,55 @@ util@^0.12.5: is-typed-array "^1.1.3" which-typed-array "^1.1.2" +uuid@^8.3.2: + version "8.3.2" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" + integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== + uuid@^9.0.1: version "9.0.1" resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30" integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA== +v8-compile-cache-lib@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" + integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== + +varint@^5.0.0, varint@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/varint/-/varint-5.0.2.tgz#5b47f8a947eb668b848e034dcfa87d0ff8a7f7a4" + integrity sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow== + +varint@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/varint/-/varint-6.0.0.tgz#9881eb0ce8feaea6512439d19ddf84bf551661d0" + integrity sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg== + +viem@2.7.14: + version "2.7.14" + resolved "https://registry.yarnpkg.com/viem/-/viem-2.7.14.tgz#347d316cb5400f0b896b2205b1bc8073aa5e27e0" + integrity sha512-5b1KB1gXli02GOQHZIUsRluNUwssl2t4hqdFAzyWPwJ744N83jAOBOjOkrGz7K3qMIv9b0GQt3DoZIErSQTPkQ== + dependencies: + "@adraffy/ens-normalize" "1.10.0" + "@noble/curves" "1.2.0" + "@noble/hashes" "1.3.2" + "@scure/bip32" "1.3.2" + "@scure/bip39" "1.2.1" + abitype "1.0.0" + isows "1.0.3" + ws "8.13.0" + vm-browserify@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0" integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ== +wasmbuilder@0.0.16: + version "0.0.16" + resolved "https://registry.yarnpkg.com/wasmbuilder/-/wasmbuilder-0.0.16.tgz#f34c1f2c047d2f6e1065cbfec5603988f16d8549" + integrity sha512-Qx3lEFqaVvp1cEYW7Bfi+ebRJrOiwz2Ieu7ZG2l7YyeSJIok/reEQCQCuicj/Y32ITIJuGIM9xZQppGx5LrQdA== + wasmbuilder@^0.0.12: version "0.0.12" resolved "https://registry.yarnpkg.com/wasmbuilder/-/wasmbuilder-0.0.12.tgz#a60cb25d6d11f314fe5ab3f4ee041ccb493cb78a" @@ -5128,19 +7590,54 @@ wasmcurves@0.1.0: big-integer "^1.6.42" blakejs "^1.1.0" +wasmcurves@0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/wasmcurves/-/wasmcurves-0.2.2.tgz#ca444f6a6f6e2a5cbe6629d98ff478a62b4ccb2b" + integrity sha512-JRY908NkmKjFl4ytnTu5ED6AwPD+8VJ9oc94kdq7h5bIwbj0L4TDJ69mG+2aLs2SoCmGfqIesMWTEJjtYsoQXQ== + dependencies: + wasmbuilder "0.0.16" + watchpack@^2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.1.tgz#29308f2cac150fa8e4c92f90e0ec954a9fed7fff" - integrity sha512-8wrBCMtVhqcXP2Sup1ctSkga6uc2Bx0IIvKyT7yTFier5AXHooSI+QyQQAtTb7+E0IUCCKyTFmXqdqgum2XWGg== + version "2.4.2" + resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.2.tgz#2feeaed67412e7c33184e5a79ca738fbd38564da" + integrity sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw== dependencies: glob-to-regexp "^0.4.1" graceful-fs "^4.1.2" +web-encoding@^1.0.2: + version "1.1.5" + resolved "https://registry.yarnpkg.com/web-encoding/-/web-encoding-1.1.5.tgz#fc810cf7667364a6335c939913f5051d3e0c4864" + integrity sha512-HYLeVCdJ0+lBYV2FvNZmv3HJ2Nt0QYXqZojk3d9FJOLkwnuhzM9tmamh8d7HPM8QqjKH8DeHkFTx+CFlWpZZDA== + dependencies: + util "^0.12.3" + optionalDependencies: + "@zxing/text-encoding" "0.9.0" + +web-worker@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/web-worker/-/web-worker-1.2.0.tgz#5d85a04a7fbc1e7db58f66595d7a3ac7c9c180da" + integrity sha512-PgF341avzqyx60neE9DD+XS26MMNMoUQRz9NOZwW32nPQrF6p77f1htcnjBSEV8BGMKZ16choqUG4hyI0Hx7mA== + web-worker@^1.2.0: version "1.3.0" resolved "https://registry.yarnpkg.com/web-worker/-/web-worker-1.3.0.tgz#e5f2df5c7fe356755a5fb8f8410d4312627e6776" integrity sha512-BSR9wyRsy/KOValMgd5kMyr3JzpdeoR9KVId8u5GVlTTAtNChlsE4yTxeY7zMdNSyOmoKBv8NH2qeRY9Tg+IaA== +web3-utils@^1.3.6: + version "1.10.4" + resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.10.4.tgz#0daee7d6841641655d8b3726baf33b08eda1cbec" + integrity sha512-tsu8FiKJLk2PzhDl9fXbGUWTkkVXYhtTA+SmEFkKft+9BgwLxfCRpU96sWv7ICC8zixBNd3JURVoiR3dUXgP8A== + dependencies: + "@ethereumjs/util" "^8.1.0" + bn.js "^5.2.1" + ethereum-bloom-filters "^1.0.6" + ethereum-cryptography "^2.1.2" + ethjs-unit "0.1.6" + number-to-bn "1.7.0" + randombytes "^2.1.0" + utf8 "3.0.0" + webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" @@ -5187,21 +7684,20 @@ webpack-sources@^3.2.3: resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== -webpack@^5.91.0: - version "5.91.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.91.0.tgz#ffa92c1c618d18c878f06892bbdc3373c71a01d9" - integrity sha512-rzVwlLeBWHJbmgTC/8TvAcu5vpJNII+MelQpylD4jNERPwpBJOE2lEcko1zJX3QJeLjTTAnQxn/OJ8bjDzVQaw== +webpack@^5.95.0: + version "5.95.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.95.0.tgz#8fd8c454fa60dad186fbe36c400a55848307b4c0" + integrity sha512-2t3XstrKULz41MNMBF+cJ97TyHdyQ8HCt//pqErqDvNjU9YQBnZxIHa11VXsi7F3mb5/aO2tuDxdeTPdU7xu9Q== dependencies: - "@types/eslint-scope" "^3.7.3" "@types/estree" "^1.0.5" "@webassemblyjs/ast" "^1.12.1" "@webassemblyjs/wasm-edit" "^1.12.1" "@webassemblyjs/wasm-parser" "^1.12.1" acorn "^8.7.1" - acorn-import-assertions "^1.9.0" + acorn-import-attributes "^1.9.5" browserslist "^4.21.10" chrome-trace-event "^1.0.2" - enhanced-resolve "^5.16.0" + enhanced-resolve "^5.17.1" es-module-lexer "^1.2.1" eslint-scope "5.1.1" events "^3.2.0" @@ -5252,7 +7748,7 @@ which-typed-array@^1.1.14, which-typed-array@^1.1.15, which-typed-array@^1.1.2: gopd "^1.0.1" has-tostringtag "^1.0.2" -which@^1.2.9: +which@^1.1.1, which@^1.2.9, which@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== @@ -5266,16 +7762,28 @@ which@^2.0.1: dependencies: isexe "^2.0.0" +widest-line@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/widest-line/-/widest-line-3.1.0.tgz#8292333bbf66cb45ff0de1603b136b7ae1496eca" + integrity sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg== + dependencies: + string-width "^4.0.0" + wildcard@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.1.tgz#5ab10d02487198954836b6349f74fff961e10f67" integrity sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ== -word-wrap@~1.2.3: +word-wrap@^1.2.5, word-wrap@~1.2.3: version "1.2.5" resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34" integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA== +wordwrap@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== + wordwrapjs@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/wordwrapjs/-/wordwrapjs-4.0.1.tgz#d9790bccfb110a0fc7836b5ebce0937b37a8b98f" @@ -5284,6 +7792,20 @@ wordwrapjs@^4.0.0: reduce-flatten "^2.0.0" typical "^5.2.0" +workerpool@^6.5.1: + version "6.5.1" + resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.5.1.tgz#060f73b39d0caf97c6db64da004cd01b4c099544" + integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA== + +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" @@ -5292,11 +7814,48 @@ wrap-ansi@^2.0.0: string-width "^1.0.1" strip-ansi "^3.0.1" +wrap-ansi@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" + integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrap-ansi@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" + integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ== + dependencies: + ansi-styles "^6.1.0" + string-width "^5.0.1" + strip-ansi "^7.0.1" + wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== +write-file-atomic@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-3.0.3.tgz#56bd5c5a5c70481cd19c571bd39ab965a5de56e8" + integrity sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q== + dependencies: + imurmurhash "^0.1.4" + is-typedarray "^1.0.0" + signal-exit "^3.0.2" + typedarray-to-buffer "^3.1.5" + write@1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3" @@ -5309,25 +7868,40 @@ ws@7.4.6: resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== -ws@8.5.0: - version "8.5.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f" - integrity sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg== +ws@8.13.0: + version "8.13.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0" + integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== + +ws@8.17.1: + version "8.17.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b" + integrity sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ== + +ws@^7.4.6: + version "7.5.10" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.10.tgz#58b5c20dc281633f6c19113f39b349bd8bd558d9" + integrity sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ== xtend@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== -"y18n@^3.2.1 || ^4.0.0": +"y18n@^3.2.1 || ^4.0.0", y18n@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf" integrity sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ== -yallist@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" - integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== +y18n@^5.0.5: + version "5.0.8" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" + integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== + +yallist@^3.0.2: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" + integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== yargs-parser@^11.1.1: version "11.1.1" @@ -5337,6 +7911,29 @@ yargs-parser@^11.1.1: camelcase "^5.0.0" decamelize "^1.2.0" +yargs-parser@^18.1.2: + version "18.1.3" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0" + integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + +yargs-parser@^20.2.2, yargs-parser@^20.2.9: + version "20.2.9" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" + integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== + +yargs-unparser@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb" + integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA== + dependencies: + camelcase "^6.0.0" + decamelize "^4.0.0" + flat "^5.0.2" + is-plain-obj "^2.1.0" + yargs@^12.0.5: version "12.0.5" resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13" @@ -5355,6 +7952,41 @@ yargs@^12.0.5: y18n "^3.2.1 || ^4.0.0" yargs-parser "^11.1.1" +yargs@^15.0.2: + version "15.4.1" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" + integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A== + dependencies: + cliui "^6.0.0" + decamelize "^1.2.0" + find-up "^4.1.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^4.2.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^18.1.2" + +yargs@^16.2.0: + version "16.2.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" + integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== + dependencies: + cliui "^7.0.2" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.0" + y18n "^5.0.5" + yargs-parser "^20.2.2" + +yn@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== + yocto-queue@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"